diff --git a/awesome/laptop/rc.lua b/awesome/laptop/rc.lua index d2ec2360..fb58b3c4 100644 --- a/awesome/laptop/rc.lua +++ b/awesome/laptop/rc.lua @@ -404,32 +404,32 @@ clientkeys = gears.table.join( awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, {description = "move to screen", group = "client"}), awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, - {description = "toggle keep on top", group = "client"}) - -- awful.key({ modkey, }, "n", - -- function (c) - -- -- The client currently has the input focus, so it cannot be - -- -- minimized, since minimized clients can't have the focus. - -- c.minimized = true - -- end , - -- {description = "minimize", group = "client"}), - -- awful.key({ modkey, }, "m", - -- function (c) - -- c.maximized = not c.maximized - -- c:raise() - -- end , - -- {description = "(un)maximize", group = "client"}), - -- awful.key({ modkey, "Control" }, "m", - -- function (c) - -- c.maximized_vertical = not c.maximized_vertical - -- c:raise() - -- end , - -- {description = "(un)maximize vertically", group = "client"}), - -- awful.key({ modkey, "Shift" }, "m", - -- function (c) - -- c.maximized_horizontal = not c.maximized_horizontal - -- c:raise() - -- end , - -- {description = "(un)maximize horizontally", group = "client"}) + {description = "toggle keep on top", group = "client"}), + awful.key({ modkey, }, "n", + function (c) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + c.minimized = true + end , + {description = "minimize", group = "client"}), + awful.key({ modkey, }, "m", + function (c) + c.maximized = not c.maximized + c:raise() + end , + {description = "(un)maximize", group = "client"}), + awful.key({ modkey, "Control" }, "m", + function (c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end , + {description = "(un)maximize vertically", group = "client"}), + awful.key({ modkey, "Shift" }, "m", + function (c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end , + {description = "(un)maximize horizontally", group = "client"}) ) -- Bind all key numbers to tags. @@ -547,7 +547,7 @@ awful.rules.rules = { { rule_any = {type = { "normal", "dialog" } }, properties = { titlebars_enabled = false } }, - + { rule_any = { class = { "Thunderbird", "discord", "telegram-desktop", "TelegramDesktop" } diff --git a/fastfetch/config.conf b/fastfetch/config.conf index 0c581f03..923f8b0e 100644 --- a/fastfetch/config.conf +++ b/fastfetch/config.conf @@ -26,7 +26,7 @@ # List available modules with "fastfetch --list-modules". # Get the default structure with "fastfetch --print-structure". # --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:Locale:Break:Colors ---structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Resolution:DE:WM:WMTheme:Theme:Icons:CPU:GPU:Memory:Disk:Battery:Player:Song:Break +--structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Resolution:DE:WM:WMTheme:Theme:Icons:CPU:GPU:Memory:Disk:Battery:Song:Break # Multithreading option: # Sets if fastfetch should use multiple threads to detect the values. diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/dist/web/extension.js b/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/dist/web/extension.js deleted file mode 100644 index 777c6dea..00000000 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/dist/web/extension.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var __webpack_modules__={1924:(e,t,r)=>{"use strict";var n=r(210),i=r(5559),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},5559:(e,t,r)=>{"use strict";var n=r(8612),i=r(210),o=i("%Function.prototype.apply%"),s=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||n.call(s,o),l=i("%Object.getOwnPropertyDescriptor%",!0),u=i("%Object.defineProperty%",!0),c=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function(e){var t=a(n,s,arguments);if(l&&u){var r=l(t,"length");r.configurable&&u(t,"length",{value:1+c(0,e.length-(arguments.length-1))})}return t};var _=function(){return a(n,o,arguments)};u?u(e.exports,"apply",{value:_}):e.exports.apply=_},9804:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,n,i){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var s=0;s{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,i="[object Function]";e.exports=function(e){var o=this;if("function"!=typeof o||n.call(o)!==i)throw new TypeError(t+o);for(var s,a=r.call(arguments,1),l=function(){if(this instanceof s){var t=o.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return o.apply(e,a.concat(r.call(arguments)))},u=Math.max(0,o.length-a.length),c=[],_=0;_{"use strict";var n=r(7648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,i=SyntaxError,o=Function,s=TypeError,a=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch(e){l=null}var u=function(){throw new s},c=l?function(){try{return u}catch(e){try{return l(arguments,"callee").get}catch(e){return u}}}():u,_=r(1405)(),p=Object.getPrototypeOf||function(e){return e.__proto__},f={},h="undefined"==typeof Uint8Array?n:p(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":_?p([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":_?p(p([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&_?p((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&_?p((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":_?p(""[Symbol.iterator]()):n,"%Symbol%":_?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":c,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(r=p(i.prototype))}return d[t]=r,r},y={"%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"]},m=r(8612),b=r(7642),w=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),v=m.call(Function.call,String.prototype.replace),E=m.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,R=/\\(\\)?/g,S=function(e){var t=E(e,0,1),r=E(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return v(e,O,(function(e,t,r,i){n[n.length]=r?v(i,R,"$1"):t||e})),n},A=function(e,t){var r,n=e;if(b(y,n)&&(n="%"+(r=y[n])[0]+"%"),b(d,n)){var o=d[n];if(o===f&&(o=g(n)),void 0===o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=S(e),n=r.length>0?r[0]:"",o=A("%"+n+"%",t),a=o.name,u=o.value,c=!1,_=o.alias;_&&(n=_[0],x(r,w([0,1],_)));for(var p=1,f=!0;p=r.length){var m=l(u,h);u=(f=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:u[h]}else f=b(u,h),u=u[h];f&&!c&&(d[a]=u)}}return u}},1405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(5419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},5419: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"),r=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(r))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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6410:(e,t,r)=>{"use strict";var n=r(5419);e.exports=function(){return n()&&!!Symbol.toStringTag}},7642:(e,t,r)=>{"use strict";var n=r(8612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},5717: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 r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},2584:(e,t,r)=>{"use strict";var n=r(6410)(),i=r(1924)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},8662:(e,t,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=r(6410)(),l=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!l)return!1;if(void 0===n){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&l(t)}return l(e)===n}},5692:(e,t,r)=>{"use strict";var n=r(9804),i=r(3083),o=r(1924),s=o("Object.prototype.toString"),a=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,u=i(),c=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r-1}return!!f&&function(e){var t=!1;return n(p,(function(r,n){if(!t)try{t=r.call(e)===n}catch(e){}})),t}(e)}},4155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,l=[],u=!1,c=-1;function _(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&p())}function p(){if(!u){var e=s(_);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c1)for(var r=1;r{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},5955:(e,t,r)=>{"use strict";var n=r(2584),i=r(8662),o=r(6430),s=r(5692);function a(e){return e.call.bind(e)}var l="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,c=a(Object.prototype.toString),_=a(Number.prototype.valueOf),p=a(String.prototype.valueOf),f=a(Boolean.prototype.valueOf);if(l)var h=a(BigInt.prototype.valueOf);if(u)var d=a(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function y(e){return"[object Map]"===c(e)}function m(e){return"[object Set]"===c(e)}function b(e){return"[object WeakMap]"===c(e)}function w(e){return"[object WeakSet]"===c(e)}function x(e){return"[object ArrayBuffer]"===c(e)}function v(e){return"undefined"!=typeof ArrayBuffer&&(x.working?x(e):e instanceof ArrayBuffer)}function E(e){return"[object DataView]"===c(e)}function O(e){return"undefined"!=typeof DataView&&(E.working?E(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=s,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):s(e)||O(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},y.working="undefined"!=typeof Map&&y(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(y.working?y(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),t.isArrayBuffer=v,E.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=O;var R="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function S(e){return"[object SharedArrayBuffer]"===c(e)}function A(e){return void 0!==R&&(void 0===S.working&&(S.working=S(new R)),S.working?S(e):e instanceof R)}function q(e){return g(e,_)}function k(e){return g(e,p)}function T(e){return g(e,f)}function j(e){return l&&g(e,h)}function P(e){return u&&g(e,d)}t.isSharedArrayBuffer=A,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},t.isGeneratorObject=function(e){return"[object Generator]"===c(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},t.isNumberObject=q,t.isStringObject=k,t.isBooleanObject=T,t.isBigIntObject=j,t.isSymbolObject=P,t.isBoxedPrimitive=function(e){return q(e)||k(e)||T(e)||j(e)||P(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")}})}))},9539:(e,t,r)=>{var n=r(4155),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),p(n,e,n.depth)}function c(e,t){var r=u.styles[t];return r?"["+u.colors[r][0]+"m"+e+"["+u.colors[r][1]+"m":e}function _(e,t){return e}function p(e,r,n){if(e.customInspect&&r&&R(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=p(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),O(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(R(r)){var l=r.name?": "+r.name:"";return e.stylize("[Function"+l+"]","special")}if(x(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return f(r)}var u,c="",_=!1,v=["{","}"];return d(r)&&(_=!0,v=["[","]"]),R(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),x(r)&&(c=" "+RegExp.prototype.toString.call(r)),E(r)&&(c=" "+Date.prototype.toUTCString.call(r)),O(r)&&(c=" "+f(r)),0!==s.length||_&&0!=r.length?n<0?x(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=_?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(u,c,v)):v[0]+c+v[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),T(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=y(r)?p(e,l.value,null):p(e,l.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function x(e){return v(e)&&"[object RegExp]"===S(e)}function v(e){return"object"==typeof e&&null!==e}function E(e){return v(e)&&"[object Date]"===S(e)}function O(e){return v(e)&&("[object Error]"===S(e)||e instanceof Error)}function R(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!s[e])if(a.test(e)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(5955),t.isArray=d,t.isBoolean=g,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=x,t.types.isRegExp=x,t.isObject=v,t.isDate=E,t.types.isDate=E,t.isError=O,t.types.isNativeError=O,t.isFunction=R,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(384);var q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),q[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",k(),t.format.apply(t,arguments))},t.inherits=r(5717),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var j="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(j&&e[j]){var t;if("function"!=typeof(t=e[j]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,j,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o{"use strict";var n=r(9804),i=r(3083),o=r(1924),s=o("Object.prototype.toString"),a=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,u=i(),c=o("String.prototype.slice"),_={},p=r(882),f=Object.getPrototypeOf;a&&p&&f&&n(u,(function(e){if("function"==typeof l[e]){var t=new l[e];if(Symbol.toStringTag in t){var r=f(t),n=p(r,Symbol.toStringTag);if(!n){var i=f(r);n=p(i,Symbol.toStringTag)}_[e]=n.get}}}));var h=r(5692);e.exports=function(e){return!!h(e)&&(a&&Symbol.toStringTag in e?function(e){var t=!1;return n(_,(function(r,n){if(!t)try{var i=r.call(e);i===n&&(t=i)}catch(e){}})),t}(e):c(s(e),8,-1))}},45:(e,t,r)=>{var n=r(4155);const i=r(4949),o=r(5174),s=r(7857),a=r(6987),l=r(371),u=r(9496),c=r(8594);class _ extends Error{}function p(e){return"rbql_table_name:"+e}function f(e,t,r){var n,a="~"===(n=r).charAt(0)?s.join(i.homedir(),n.slice(1)):n;if(o.existsSync(a))return a;if(t&&!s.isAbsolute(a)&&(a=s.join(t,a),o.existsSync(a)))return a;let l=e?e.get(p(r)):null;return l&&o.existsSync(l)?l:null}function h(e,t){const r=e.lineCount;for(let n=0;n1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e1);let[i,o]=n[0],[s,a]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${s} -> ${a} fields`,l}(this.table_name,this.fields_info)),e}}class y extends a.RBQLOutputWriter{constructor(e,t){if(super(),this.delim=e,this.policy=t,this.header_len=null,this.null_in_output=!1,this.delim_in_simple_output=!1,this.output_lines=[],"simple"==t)this.polymorphic_join=this.simple_join;else if("quoted"==t)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==t)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==t)this.polymorphic_join=this.mono_join;else{if("whitespace"!=t)throw new d("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 d('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{i||(i=!0,n.close(),s(e))})),n.on("error",(e=>{a(e)})),l},e.exports.rbql_query_web=async function(e,t,r,n,i,o,s,l,u=null){let c=new m,_=new g(t,r,n,l,u),p=new y(i,o);return await a.query(e,_,p,s,c,""),p.output_lines},e.exports.rbql_query_node=async function(e,t,r,u,c,_,p,f,h,g,y=!1,m=null,w="",x=null){let v=null,E=null;x&&x.bulk_read&&r?E=r:v=null===r?n.stdin:o.createReadStream(r);let[O,R]=null===_?[n.stdout,!1]:[o.createWriteStream(_),!0];if('"'==u&&"quoted"==c)throw new d('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==h&&(h="binary"),!l.is_ascii(t)&&"binary"==h)throw new d("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(l.is_ascii(u)&&l.is_ascii(p)||"binary"!=h))throw new d("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let S=s.join(i.homedir(),".rbql_init_source.js");""==w&&o.existsSync(S)&&(w=l.read_user_init_code(S));let A=r?s.dirname(r):null,q=new b(e,A,u,c,h,y,m,x),k=new l.CSVRecordIterator(v,E,h,u,c,y,m),T=new l.CSVWriter(O,R,h,p,f);await a.query(t,k,T,g,q,w),q.get_warnings(g)},e.exports.get_header_line=h,e.exports.populate_optimistic_rfc_csv_record_map=function(e,t,r,n=null){let i=e.lineCount,o=null;var s;for(let a=r.length?(s=r,s[s.length-1])[1]:0;a=i&&""==t)break;if(n&&t.startsWith(n))continue;let s=t.match(/"/g),l=s&&s.length%2==1;if(null!==o||l)if(null===o&&l)o=a;else{if(!l)continue;r.push([o,a+1]),o=null}else r.push([a,a+1])}null!==o&&r.push([o,i])},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 bellow 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 bellow this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.align_columns=function(e,t,r,n){let i=[],o=e.lineCount,s=!1;const a=u.workspace.getConfiguration("rainbow_csv");let l=a?a.get("comment_prefix"):"";for(let a=0;a=n.length);e++){let t=u[e].trim(),r=n[e]-t.length;r>=0&&(t+=" ".repeat(r+1)),u[e]!=t&&(u[e]=t,s=!0)}i.push(u.join(t))}return s?i.join("\n"):null},e.exports.shrink_columns=function(e,t,r){let n=[],i=e.lineCount,o=!1;const s=u.workspace.getConfiguration("rainbow_csv");let a=s?s.get("comment_prefix"):"";for(let s=0;s{let t=new RegExp('^"((?:[^"]*"")*[^"]*)"'),r=new RegExp('^ *"((?:[^"]*"")*[^"]*)" *');function n(e,n,i,o,s,a){var l=!1;let u=e.substring(s),c=(o?r:t).exec(u);if(null!==c){let t=c[0].length;if(s+t==e.length||e[s+t]==n)return i?a.push(c[0]):a.push(c[1].replace(/""/g,'"')),[s+t+1,!1];l=!0}var _=e.indexOf(n,s);-1==_&&(_=e.length);var p=e.substring(s,_);return l=l||-1!=p.indexOf('"'),a.push(p),[_+1,l]}function i(e,t,r=!1){if(-1==e.indexOf('"'))return[e.split(t),!1];var i=[],o=0,s=!1;let a=" "!=t;for(;o{(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,r){return e.split(t).join(r)}class RBQLContext{constructor(e,t,r,n){this.query_text=e,this.input_iterator=t,this.writer=r,this.user_init_code=n,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.25.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=[],r=0,n=[];for(let i=0;ie.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 r="__RBQL_INTERNAL_STAR",n=/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(e),i=/^([ab])\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(e),o=/^([ab])\[([0-9]+)\]$/.exec(e),s=/^([ab])\[___RBQL_STRING_LITERAL([0-9]+)___\]$/.exec(e);if(null!==n){if(e==r)return{table_name:null,column_index:null,column_name:null,is_star:!0};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}:{table_name:null,column_index:null,column_name:e,is_star:!1}}if(null!==i){let e=i[1],t=i[2];return t==r?{table_name:e,column_index:null,column_name:null,is_star:!0}:{table_name:null,column_index:null,column_name:t,is_star:!1}}if(null!=o)return{table_name:o[1],column_index:parseInt(o[2])-1,column_name:null,is_star:!1};if(null!=s){s[1];let e=s[2];if(ecolumn_info_from_text_span(e,t)))}function stable_compare(e,t){for(var r=0;r=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),r=this.records.get(t);return r?r[0]+=1:this.records.set(t,[1,e]),!0}async finish(){for(var[e,t]of this.records){let[e,r]=t;if(r.unshift(e),!await this.subwriter.write(r))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;te instanceof UnnestMarker));for(var o=0;oo+e)),n.slice(0,e).concat(i).concat(n.slice(e+1)).join("\n")+"\n"}assert(!1)}function generate_main_loop_code(e){let t=null!==e.select_expression,r=null!==e.join_map,n=null===e.where_expression?"true":e.where_expression,i=null===e.aggregation_key_expression?"null":e.aggregation_key_expression,o=null===e.sort_key_expression?"null":e.sort_key_expression,s=embed_code(MAIN_LOOP_BODY,"__USER_INIT_CODE__",e.user_init_code);return t?(r?(s=embed_code(embed_code(s,"__CODE__",PROCESS_SELECT_JOIN),"__CODE__",PROCESS_SELECT_COMMON),s=embed_expression(s,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):s=embed_code(embed_code(s,"__CODE__",PROCESS_SELECT_SIMPLE),"__CODE__",PROCESS_SELECT_COMMON),s=embed_code(s,"__RBQLMP__variables_init_code",e.variables_init_code),s=embed_expression(s,"__RBQLMP__select_expression",e.select_expression),s=embed_expression(s,"__RBQLMP__where_expression",n),s=embed_expression(s,"__RBQLMP__aggregation_key_expression",i),s=embed_expression(s,"__RBQLMP__sort_key_expression",o)):(r?(s=embed_code(s,"__CODE__",PROCESS_UPDATE_JOIN),s=embed_expression(s,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):s=embed_code(s,"__CODE__",PROCESS_UPDATE_SIMPLE),s=embed_code(s,"__RBQLMP__variables_init_code",e.variables_init_code),s=embed_code(s,"__RBQLMP__update_expressions",e.update_expressions),s=embed_expression(s,"__RBQLMP__where_expression",n)),"(async () => {"+s+"})()"}async function compile_and_run(query_context){let main_loop_body=generate_main_loop_code(query_context);try{let main_loop_promise=eval(main_loop_body);await main_loop_promise}catch(e){if(e instanceof SyntaxError){let t=query_context.query_text.toLowerCase();if(-1!=t.indexOf(" having "))throw new SyntaxError(e.message+'\nRBQL doesn\'t support "HAVING" keyword');if(-1!=t.indexOf(" like "))throw new SyntaxError(e.message+"\nRBQL doesn't support \"LIKE\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... ");if(-1!=t.indexOf(" from "))throw new SyntaxError(e.message+'\nTip: If input table is defined by the environment, RBQL query should not have "FROM" keyword');if(e&&e.message&&-1!=String(e.message).toLowerCase().indexOf("unexpected identifier")){if(-1!=t.indexOf(" and "))throw new SyntaxError(e.message+"\nDid you use 'and' keyword in your query?\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!");if(-1!=t.indexOf(" or "))throw new SyntaxError(e.message+"\nDid you use 'or' keyword in your query?\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!")}}if(e&&e.message&&-1!=e.message.indexOf("Received an instance of RBQLAggregationToken"))throw new RbqlParsingError(wrong_aggregation_usage_error);throw e}}const GROUP_BY="GROUP BY",UPDATE="UPDATE",SELECT="SELECT",JOIN="JOIN",INNER_JOIN="INNER JOIN",LEFT_JOIN="LEFT JOIN",LEFT_OUTER_JOIN="LEFT OUTER JOIN",STRICT_LEFT_JOIN="STRICT LEFT JOIN",ORDER_BY="ORDER BY",WHERE="WHERE",LIMIT="LIMIT",EXCEPT="EXCEPT",WITH="WITH";function get_ambiguous_error_msg(e){return`Ambiguous variable name: "${e}" is present both in input and in join tables`}function get_all_matches(e,t){var r=[];let n=null;for(;null!==(n=e.exec(t));)r.push(n);return r}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 r=0;re[1]));for(let e of o){let o=r.indexOf(e);if(-1==o)throw new RbqlParsingError(`Unable to find column "${e}" in ${"a"==t?"input":"join"} ${n}`);i[`${t}.${e}`]={initialize:!0,index:o}}}function map_variables_directly(e,t,r){for(let n=0;n1)throw new RbqlParsingError(`More than one "${o}" statements found`);assert(1==s.length);var a=s[0],l=a[0];r.push([a.index,a.index+l.length,o]);break}}return r.sort((function(e,t){return e[0]-t[0]})),r}function separate_actions(e){e=str_strip(e);var t={};let r=/^(.*) *[Ww][Ii][Tt][Hh] *\(([a-z]{4,20})\) *$/.exec(e);null!==r&&(e=r[1],t[WITH]=r[2]);for(var n=locate_statements(e),i=0;ie-t)),[null===n?null:select_except(n,o),`select_except(record_a, [${o.join(",")}])`]}class HashJoinMap{constructor(e,t){this.max_record_len=0,this.hash_map=new Map,this.record_iterator=e,this.nr=0,1==t.length?(this.key_index=t[0],this.key_indices=null,this.polymorphic_get_key=this.get_single_key):(this.key_index=null,this.key_indices=t,this.polymorphic_get_key=this.get_multi_key)}get_single_key(e,t){if(this.key_index>=t.length)throw new RbqlRuntimeError(`No field with index ${this.key_index+1} at record ${this.nr} in "B" table`);return-1===this.key_index?this.nr:t[this.key_index]}get_multi_key(e,t){let r=[];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`);r.push(-1===e?this.nr:t[e])}return JSON.stringify(r)}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 r=this.polymorphic_get_key(this.nr,e),n=this.hash_map.get(r);void 0===n?this.hash_map.set(r,[[this.nr,t,e]]):n.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,r){if(null===e&&null===t)return null;null===e&&(e=[]),null===t&&(t=[]);let n=[];for(let i of r)null===i?n.push("col"+(n.length+1)):i.is_star?null===i.table_name?n=n.concat(e).concat(t):"a"===i.table_name?n=n.concat(e):"b"===i.table_name&&(n=n.concat(t)):null!==i.column_name?n.push(i.column_name):null!==i.column_index?"a"==i.table_name&&i.column_index1);let[i,o]=n[0],[s,a]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${s} -> ${a} fields`,l}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,r=!0,n="a"){super(),this.table=e,this.column_names=t,this.normalize_column_names=r,this.variable_prefix=n,this.nr=0,this.fields_info=new Object,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.hasOwnProperty(t)||(this.fields_info[t]=this.nr),e}get_warnings(){return Object.keys(this.fields_info).length>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,r=!0,n="b"){super(),this.table=e,this.table_id=n,this.column_names=t,this.normalize_column_names=r}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,r,n){e=cleanup_query(e);var[i,o]=separate_string_literals(e),s=separate_actions(i=remove_redundant_table_name(i));s.hasOwnProperty(WITH)&&t.handle_query_modifier(s[WITH]);var a=await t.get_variables_map(e);if(s.hasOwnProperty(ORDER_BY)&&s.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY" is not allowed in "UPDATE" queries');if(s.hasOwnProperty(GROUP_BY)){if(s.hasOwnProperty(ORDER_BY)||s.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');n.aggregation_key_expression="["+combine_string_literals(s[GROUP_BY].text,o)+"]"}let l=null,u=null;if(s.hasOwnProperty(JOIN)){var[c,_]=parse_join_expression(s[JOIN].text);if(null===r)throw new RbqlParsingError("JOIN operations are not supported by the application");let t=r.get_iterator_by_table_id(c);if(!t)throw new RbqlParsingError(`Unable to find join table: "${c}"`);s.hasOwnProperty(WITH)&&t.handle_query_modifier(s[WITH]),l=await t.get_variables_map(e),u=await t.get_header();let[i,p]=resolve_join_variables(a,l,_,o),f={JOIN:InnerJoiner,"INNER JOIN":InnerJoiner,"LEFT JOIN":LeftJoiner,"LEFT OUTER JOIN":LeftJoiner,"STRICT LEFT JOIN":StrictLeftJoiner}[s[JOIN].join_subtype];n.lhs_join_var_expression=1==i.length?i[0]:"JSON.stringify(["+i.join(",")+"])",n.join_map_impl=new HashJoinMap(t,p),await n.join_map_impl.build(),n.join_map=new f(n.join_map_impl)}if(n.variables_init_code=combine_string_literals(generate_init_statements(i,a,l," ".repeat(4)),o),s.hasOwnProperty(WHERE)){var p=s[WHERE].text;if(/[^>{var n=r(4155);const i=r(1606),o=r(4704),s=r(9426),a=r(9539),l=r(6987),u=r(8594),c="Unable to decode input table as UTF-8. Use binary (latin-1) encoding instead";class _ extends Error{}class p extends Error{}function f(e,t=null){if(!e)throw t||(t="Assertion error"),new p(t)}function h(e){return/^[\x00-\x7F]*$/.test(e)}function d(e){return i.readFileSync(e,"utf-8")}function g(e,t){var r,n="~"===(r=t).charAt(0)?s.join(o.homedir(),r.slice(1)):r;if(i.existsSync(n))return n;if(e&&!s.isAbsolute(n)&&(n=s.join(e,n),i.existsSync(n)))return n;var a=function(e,t){for(var r=function(e){var t=null;try{t=i.readFileSync(e,"utf-8")}catch(e){return[]}for(var r=t.split("\n"),n=[],o=0;o1&&i.existsSync(a[1])?a[1]:null}class y{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 m extends l.RBQLInputIterator{constructor(e,t,r,n,i,o=!1,s=null,l="input",u="a"){super(),this.stream=e,this.csv_path=t,f(null===this.stream!=(null===this.csv_path)),this.encoding=r,this.delim=n,this.policy=i,this.has_header=o,this.first_record=null,this.first_record_should_be_emitted=!o,this.header_preread_complete=!1,this.table_name=l,this.variable_prefix=u,this.comment_prefix=null!==s&&s.length?s:null,this.decoder=null,"utf-8"==r&&null===this.csv_path&&(this.decoder=new a.TextDecoder(r,{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 Object,this.NR=0,this.NL=0,this.rfc_line_buffer=[],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 y,this.process_line_polymorphic="quoted_rfc"==i?this.process_partial_rfc_record_line:this.process_record_line}handle_query_modifier(e){-1!=["header","headers"].indexOf(e)&&(this.has_header=!0,this.first_record_should_be_emitted=!1),-1!=["noheader","noheaders"].indexOf(e)&&(this.has_header=!1,this.first_record_should_be_emitted=!0)}reset_external_callbacks(){this.reject_current_record=null,this.resolve_current_record=null}try_propagate_exception(){if(this.current_exception&&this.reject_current_record){let e=this.reject_current_record,t=this.current_exception;this.reset_external_callbacks(),this.current_exception=null,e(t)}}store_or_propagate_exception(e){null===this.current_exception&&(this.current_exception=e),this.try_propagate_exception()}async preread_first_record(){this.header_preread_complete||(this.first_record=await this.get_record(),this.header_preread_complete=!0,null!==this.first_record&&(this.stream&&this.stream.pause(),this.first_record=this.first_record.slice()))}async get_variables_map(e){let t=new Object;return l.parse_basic_variables(e,this.variable_prefix,t),l.parse_array_variables(e,this.variable_prefix,t),await this.preread_first_record(),this.has_header&&this.first_record&&(l.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),l.parse_dictionary_variables(e,this.variable_prefix,this.first_record,t)),t}async get_header(){return await this.preread_first_record(),this.has_header?this.first_record:null}try_resolve_next_record(){if(this.try_propagate_exception(),null===this.resolve_current_record)return;let e=null;if(this.first_record_should_be_emitted&&this.header_preread_complete?(this.first_record_should_be_emitted=!1,e=this.first_record):e=this.produced_records_queue.dequeue(),null===e&&!this.input_exhausted)return;let t=this.resolve_current_record;this.reset_external_callbacks(),t(e)}async get_record(){this.started||await this.start(),this.stream&&this.stream.isPaused()&&this.stream.resume();let e=this,t=new Promise((function(t,r){e.resolve_current_record=t,e.reject_current_record=r}));return this.try_resolve_next_record(),t}async get_all_records(e=null){let t=[];for(;;){let r=await this.get_record();if(null===r)break;if(t.push(r),e&&t.length>=e){this.stop();break}}return t}process_record_line(e){if(null!==this.comment_prefix&&e.startsWith(this.comment_prefix))return;this.NR+=1;var[t,r]=u.smart_split(e,this.delim,this.policy,!1);r&&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 n=t.length;this.fields_info.hasOwnProperty(n)||(this.fields_info[n]=this.NR),this.produced_records_queue.enqueue(t),this.try_resolve_next_record()}process_partial_rfc_record_line(e){let t=u.accumulate_rfc_line_into_record(this.rfc_line_buffer,e,this.comment_prefix);null!==t&&this.process_record_line(t)}process_line(e){if(this.NL+=1,1===this.NL){var t=function(e,t){return"binary"==t&&e.length>=3&&239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)?e.substring(3):"utf-8"==t&&e.length>=1&&65279===e.charCodeAt(0)?e.substring(1):e}(e,this.encoding);t!=e&&(e=t,this.utf8_bom_removed=!0)}this.process_line_polymorphic(e)}process_data_stream_chunk(e){let t=null;if(this.decoder)try{t=this.decoder.decode(e)}catch(e){return void(e instanceof TypeError?this.store_or_propagate_exception(new _(c)):this.store_or_propagate_exception(e))}else t=e.toString(this.encoding);let r=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 n=u.split_lines(t);n[0]=this.partially_decoded_line+n[0],f(0==r||0==n[0].length),this.partially_decoded_line=n.pop();for(let e=r;e0&&this.process_record_line(this.rfc_line_buffer.join("\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.rfc_line_buffer.length>0&&this.process_record_line(this.rfc_line_buffer.join("\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,r){i.readFile(e.csv_path,((n,i)=>{n?r(n):(e.process_data_bulk(i),t())}))}))}this.stream.on("data",(e=>{this.process_data_stream_chunk(e)})),this.stream.on("end",(()=>{this.process_data_stream_end()}))}}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),this.utf8_bom_removed&&e.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`),Object.keys(this.fields_info).length>1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e1);let[i,o]=n[0],[s,a]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${s} -> ${a} fields`,l}(this.table_name,this.fields_info)),e}}class b extends l.RBQLOutputWriter{constructor(e,t,r,n,i,o="\n"){if(super(),this.stream=e,this.encoding=r,r&&this.stream.setDefaultEncoding(r),this.stream.on("error",(e=>{this.store_first_error(e)})),this.delim=n,this.policy=i,this.line_separator=o,this.sub_array_delim="|"==n?";":"|",this.close_stream_on_finish=t,this.null_in_output=!1,this.delim_in_simple_output=!1,this.header_len=null,this.first_error=null,"simple"==i)this.polymorphic_join=this.simple_join;else if("quoted"==i)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==i)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==i)this.polymorphic_join=this.mono_join;else{if("whitespace"!=i)throw new _("Unknown output csv policy");this.polymorphic_join=this.simple_join}}store_first_error(e){null===this.first_error&&(this.first_error=e)}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return u.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return u.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new _('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{i()})):setTimeout((()=>{i()}),0)}))}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class w extends l.RBQLTableRegistry{constructor(e,t,r,n,i=!1,o=null,s=null){super(),this.input_file_dir=e,this.delim=t,this.policy=r,this.encoding=n,this.has_header=i,this.comment_prefix=o,this.stream=null,this.record_iterator=null,this.options=s,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=g(this.input_file_dir,e),null===this.table_path)throw new _(`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 m(this.stream,this.bulk_input_path,this.encoding,this.delim,this.policy,this.has_header,this.comment_prefix,e,"b"),this.record_iterator}get_warnings(e){this.record_iterator&&this.has_header&&e.push(`The first record in JOIN file ${s.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.is_ascii=h,e.exports.CSVRecordIterator=m,e.exports.CSVWriter=b,e.exports.FileSystemCSVRegistry=w,e.exports.interpret_named_csv_format=function(e){if("monocolumn"==(e=e.toLowerCase()))return["","monocolumn"];if("csv"==e)return[",","quoted"];if("tsv"==e)return["\t","simple"];throw new _(`Unknown format name: "${e}"`)},e.exports.read_user_init_code=d,e.exports.query_csv=async function(e,t,r,a,u,c,p,f,g,y=!1,x=null,v="",E=null){let O=null,R=null;E&&E.bulk_read&&t?R=t:O=null===t?n.stdin:i.createReadStream(t);let[S,A]=null===u?[n.stdout,!1]:[i.createWriteStream(u),!0];if('"'==r&&"quoted"==a)throw new _('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==f&&(f="binary"),!h(e)&&"binary"==f)throw new _("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(h(r)&&h(c)||"binary"!=f))throw new _("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let q=s.join(o.homedir(),".rbql_init_source.js");""==v&&i.existsSync(q)&&(v=d(q));let k=t?s.dirname(t):null,T=new w(k,r,a,f,y,x,E),j=new m(O,R,f,r,a,y,x),P=new b(S,A,f,c,p);await l.query(e,j,P,g,T,v),T.get_warnings(g)},e.exports.RecordQueue=y,e.exports.exception_to_error_info=l.exception_to_error_info},9496:e=>{"use strict";e.exports=require("vscode")},1606:()=>{},4704:()=>{},9426:()=>{},2667:()=>{},5174:()=>{},4949:()=>{},7857:()=>{},8391:()=>{},3083:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.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__(9496),r=__webpack_require__(7857),n=__webpack_require__(5174),i=__webpack_require__(4949),o=__webpack_require__(2667),s=__webpack_require__(8594);var a=null,l=null;function u(){return null===l&&(l=__webpack_require__(45)),l}const c=void 0===i.homedir,_=100,p="vscode_rbql_scratch";let f=null;var h=new Map,d=new Set,g=new Set,y=new Map,m=new Map,b=null,w=null,x=null,v=null,E=null;let O=null;var R=null,S=new Map,A=null,q=null,k=null,T=null,j=null,P=null;const I={csv:[",","quoted"],tsv:["\t","simple"],"csv (semicolon)":[";","quoted"],"csv (pipe)":["|","simple"],"csv (tilde)":["~","simple"],"csv (caret)":["^","simple"],"csv (colon)":[":","simple"],"csv (double quote)":['"',"simple"],"csv (equals)":["=","simple"],"csv (dot)":[".","simple"],"csv (whitespace)":[" ","whitespace"],"csv (hyphen)":["-","simple"]};let N={"rbql_client.js":null,"contrib/textarea-caret-position/index.js":null,"rbql_suggest.js":null,"rbql_logo.svg":null,"rbql_client.html":null,"rbql mock/rbql_mock.py":null,"rbql_core/vscode_rbql.py":null};function L(e){var r=t.window;r&&r.showErrorMessage(e)}function C(e){return new Promise((t=>setTimeout(t,e)))}function U(e){for(let t in I)if(I.hasOwnProperty(t)&&I[t][0]==e)return t;return null}function B(e,t){if(q){var r=q.get(e);if(null!=r)return r}return t}async function M(e,t){return!(!q||!e||(await q.update(e,t),0))}function $(e,t,r){let n=[];for(let i=t;i250&&(t[e]=t[e].substr(0,250)+"###UI_STRING_TRIM_MARKER###")}t.preview_records=o,t.start_record_zero_based=e.requested_start_record}function F(e){return"rbql_header:"+e}function W(e){return"enable_rfc_newlines:"+e}function J(e){return"rbql_with_headers:"+e}function Q(e,r,n){const i=t.workspace.getConfiguration("rainbow_csv");let o=i?i.get("comment_prefix"):"",a=u().get_header_line(e,o);return s.smart_split(a,r,n,!1)[0]}function z(e,t,r){var n=e.fileName;if(n){let e=B(F(n),null);if(e)return JSON.parse(e)}return Q(e,t,r)}function G(e,t){if(!e.length)return null;for(var r=0,n=e[r].length+1;t>n&&r+1 "+n),await t.languages.setTextDocumentLanguage(e,n)),await async function(e){if(P=[],e&&e.length){var r=t.window;if(!r)return null;for(var n=0;n=1e4)L("Multicursor column edit works only for files smaller than 10000 lines.");else{for(let r=0;r=c.length)return void L(`Line ${r+1} doesn't have field number ${y+1}`);let _=c.slice(0,y).join("").length+y,p=c.slice(0,y+1).join("").length+y;if("ce_before"==e&&"quoted"==a&&-1!=i.substring(_-2,_+2).indexOf('"'))return void L(`Accidental data corruption prevention: Cursor at line ${r+1} will not be set: a double quote is in proximity.`);if("ce_after"==e&&"quoted"==a&&-1!=i.substring(p-2,p+2).indexOf('"'))return void L(`Accidental data corruption prevention: Cursor at line ${r+1} will not be set: a double quote is in proximity.`);if("ce_select"==e&&_==p)return void L(`Accidental data corruption prevention: The column can not be selected: field ${y+1} at line ${r+1} is empty.`);let f=new t.Position(r,_),h=new t.Position(r,p);"ce_before"==e&&m.push(new t.Selection(f,f)),"ce_after"==e&&m.push(new t.Selection(h,h)),"ce_select"==e&&m.push(new t.Selection(f,h))}r.selections=m,g&&t.window.showWarningMessage("Some lines have quoting issues: cursors positioning may be incorrect."),await t.window.showTextDocument(n)}}async function pe(e,r){let n=H(e);if(!n)return;let i=n.languageId;if(!I.hasOwnProperty(i))return;let[o,s]=I[i],[a,l]=u().shrink_columns(n,o,s);if(l)return void L(`Unable to shrink: Inconsistent double quotes at line ${l}`);if(d.delete(n.fileName),Z(n),null===a)return void t.window.showWarningMessage("No trailing whitespaces found, skipping");let c=new t.Range(0,0,n.lineCount,0),_=n.validateRange(c);r.replace(_,a)}async function fe(e,r){let n=H(e);if(!n)return;let i=n.languageId;if(!I.hasOwnProperty(i))return;let[o,s]=I[i],[a,l]=u().calc_column_sizes(n,o,s);if(l)return void L(`Unable to align: Inconsistent double quotes at line ${l}`);let c=u().align_columns(n,o,s,a);if(d.add(n.fileName),Z(n),null===c)return void t.window.showWarningMessage("Table is already aligned, skipping");let _=new t.Range(0,0,n.lineCount,0),p=n.validateRange(_);r.replace(p,c)}async function he(){if(c)return void L("This command is currently unavailable in web mode.");let e=H();if(!e)return;let r=e.fileName,n=m.get(r.toLowerCase());if(!n)return;let i=await t.workspace.openTextDocument(n),o=await t.window.showTextDocument(i);await async function(e,r){let n=e.getText(),i=H(r);if(!i)return;let o=new t.Range(0,0,i.lineCount,0),s=i.validateRange(o);await r.edit((e=>e.replace(s,n)))}(e,o)}async function de(e,o,l=null){let p=o.msg_type,f=async function(t,r){let n={msg_type:"rbql_report"};t&&(n.error_type=t),r&&(n.error_msg=r),j=n,await e.postMessage(n)};if("handshake"==p){var h={msg_type:"handshake",backend_language:B("rbql_backend_language","js"),encoding:B("rbql_encoding","utf-8")};D(R,h);let t=ie(R.input_document_path);S.has(t)&&(h.last_query=S.get(t));let r=B("rbql_query_history",[]);h.query_history=r,h.policy=R.policy,h.enable_rfc_newlines=R.enable_rfc_newlines,h.with_headers=R.with_headers,h.header=R.header,h.is_web_ext=c,l&&(h.integration_test_language=l.rbql_backend,h.integration_test_query=l.rbql_query,h.integration_test_with_headers=l.with_headers||!1,h.integration_test_enable_rfc_newlines=l.enable_rfc_newlines||!1),await e.postMessage(h)}if("fetch_table_header"==p)try{let t=o.table_id,n=o.encoding,i=R.input_document_path?r.dirname(R.input_document_path):null,a=u().find_table_path(q,i,t);if(!a)return;let l=await u().read_header(a,n),[c,_]=s.smart_split(l,R.delim,R.policy,!1);_||e.postMessage({msg_type:"fetch_table_header_response",header:c})}catch(e){console.error("Unable to get join table header: "+String(e))}if("update_query"==p){let e=o.query;if(!e)return;R.input_document_path&&S.set(ie(R.input_document_path),e)}if("newlines_policy_change"==p){R.enable_rfc_newlines=o.enable_rfc_newlines,R.input_document_path&&await M(W(R.input_document_path),R.enable_rfc_newlines);let t={msg_type:"resample"};D(R,t),await e.postMessage(t)}if("with_headers_change"==p&&(R.with_headers=o.with_headers,R.input_document_path&&await M(J(R.input_document_path),R.with_headers)),"navigate"==p){var d=o.direction;"backward"==d?R.requested_start_record-=_:"forward"==d?R.requested_start_record+=_:"begin"==d?R.requested_start_record=0:"end"==d&&(R.requested_start_record=R.input_document.lineCount);let t={msg_type:"navigate"};D(R,t),await e.postMessage(t)}if("run"==p){let e=o.query,n=o.backend_language,s=o.encoding,l=o.output_dialect,_=o.enable_rfc_newlines,p=o.with_headers;await async function(e){let t=B("rbql_query_history",[]),r=t.indexOf(e);-1!=r?t.splice(r,1):t.length>=20&&t.splice(0,1),t.push(e),await M("rbql_query_history",t)}(e),await async function(e,n,o,s,l,_,p,f){S.set(ie(e),s);var h="python";let d={process_reported:!1},[y,b]=[R.delim,R.policy];"quoted"==b&&_&&(b="quoted_rfc");let[w,x]=[y,b];"csv"==l&&([w,x]=[",","quoted"]),"tsv"==l&&([w,x]=["\t","simple"]),R.output_delim=w;let v=c?null:r.join(function(e){const n=t.workspace.getConfiguration("rainbow_csv");return n?"TMP"==n.get("rbql_output_dir")?i.tmpdir():"INPUT"==n.get("rbql_output_dir")?r.dirname(e):n.get("rbql_output_dir"):i.tmpdir()}(e),function(e,t){var n=r.basename(e),i=r.extname(n),o={"\t":".tsv",",":".csv"},s=".txt";o.hasOwnProperty(t)?s=o[t]:i.length>1&&(s=i);let a=n+s;return a==n&&(a+=".txt"),a}(e,w));if(s.startsWith("test "))return-1!=s.indexOf("nopython")&&(h="nopython"),void re(h,[N["rbql mock/rbql_mock.py"],s],d,(function(t,r,n){ne(e,v,t,r,n,f)}));if("js"==o){let r=[],i=null;try{if(c){let e={content:(await u().rbql_query_web(s,R.input_document,y,b,w,x,r,p,null)).join("\n"),language:U(w)};i=await t.workspace.openTextDocument(e)}else{let o={bulk_read:!0};await u().rbql_query_node(q,s,e,y,b,v,w,x,n,r,p,null,"",o),m.set(v.toLowerCase(),e),g.add(v),i=await t.workspace.openTextDocument(v)}}catch(e){let[t,r]=(null===a&&(a=__webpack_require__(371)),a).exception_to_error_info(e);return void f(t,r)}f(null,null),await te(i,r)}else{if(c)return void f("Input error","Python backend for RBQL is not supported in web version, please use JavaScript backend.");let t=Buffer.from(s,"utf-8").toString("base64"),r=[N["rbql_core/vscode_rbql.py"],t,e,y,b,v,w,x,n];p&&r.push("--with_headers"),re(h,r,d,(function(t,r,n){ne(e,v,t,r,n,f)}))}}(R.input_document_path,s,n,e,l,_,p,f)}if("edit_udf"==p){if(c)return void f("Input error","UDFs are currently not supported in web version");let e=null,s="";"js"==o.backend_language?(e=r.join(i.homedir(),".rbql_init_source.js"),s=u().get_default_js_udf_content()):(e=r.join(i.homedir(),".rbql_init_source.py"),s=u().get_default_python_udf_content()),n.existsSync(e)||n.writeFileSync(e,s);let a=await t.workspace.openTextDocument(e);await t.window.showTextDocument(a)}"global_param_change"==p&&await M(o.key,o.value)}async function ge(e=null){let o=t.window;if(!o)return;let s=o.activeTextEditor;if(!s)return;let a=s.document;if(!a)return;let l=a.uri;if(!l)return;if("file"!=l.scheme&&"untitled"!=l.scheme&&!c)return;if("file"==l.scheme&&a.isDirty&&!c)return void L("Unable to run RBQL: file has unsaved changes");let u=null;if("untitled"!=l.scheme||c)u=a.fileName;else{let e=a.getText(),t=String(Math.floor(1e6*Math.random()));u=r.join(i.tmpdir(),`vscode_rbql_scratch_${t}.txt`),n.writeFileSync(u,e)}if(!u)return void L("Unable to run RBQL for this file");const _=t.workspace.getConfiguration("rainbow_csv");let p=a.languageId,h="monocolumn",d="monocolumn";I.hasOwnProperty(p)&&([h,d]=I[p]);let g=B(W(u),!1),y=!!_&&_.get("rbql_with_headers_by_default"),m=B(J(u),y),b=Q(a,h,d);R={input_document:a,input_document_path:u,requested_start_record:0,delim:h,policy:d,rfc_record_map:[],enable_rfc_newlines:g,with_headers:m,header:b},k=t.window.createWebviewPanel("rbql-console","RBQL Console",t.ViewColumn.Active,{enableScripts:!0}),A||(A=c?f:n.readFileSync(N["rbql_client.html"],"utf8"));let w=A;w=function(e,r){for(const e of["contrib/textarea-caret-position/index.js","rbql_suggest.js","rbql_client.js","rbql_logo.svg"]){let n=null;n=c?N[e]:k.webview.asWebviewUri(t.Uri.file(N[e])),r=r.replace(`src="${e}"`,`src="${n}"`)}return r}(0,w),k.webview.html=w,k.webview.onDidReceiveMessage((function(t){de(k.webview,t,e)}))}function ye(e,r,n,i,o){var a=e.lineCount;let l=0,u=0;const c=t.workspace.getConfiguration("rainbow_csv");let _=c?c.get("comment_prefix"):"";_||(_="#");for(var p=0;p=o?l:0}function me(e,r){const n=t.workspace.getConfiguration("rainbow_csv");let i=n?n.get("autodetection_min_line_count"):10;if(e.lineCounts&&(s=u,o=n)}return o}async function be(e){if(!e)return;T&&(T.dispose(),T=null);let r=e.document;if(!r)return;let n=me(r,t.workspace.getConfiguration("rainbow_csv").get("autodetect_separators"));if(!n)return;let i=await t.languages.setTextDocumentLanguage(r,n);X(i,!1),Z(i)}function we(e){let t=H(e);X(t,!1),Z(t)}async function xe(e){await async function(e){if(!e)return;const r=t.workspace.getConfiguration("rainbow_csv");if(!r||!r.get("enable_separator_autodetection"))return;let n=r.get("autodetect_separators");var i=e.languageId,o=e.fileName;if(!o||g.has(o))return;let s=o.endsWith(".csv")&&"csv"==i;if("plaintext"!=i&&!s)return;let a=me(e,n);if(!a&&s&&(a=function(e,t){let r="csv",n=0,i=e.getText();if(!i)return r;for(let e=0;en&&(r=o,n=s)}return r}(e,n)),!a||a==i)return;let l=await t.languages.setTextDocumentLanguage(e,a);y.set(o,i),X(l,!1),Z(l)}(e),function(e){const r=t.workspace.getConfiguration("rainbow_csv");r&&r.get("enable_separator_autodetection")&&e&&!T&&(e.isUntitled||0==e.lineCount)&&(T=t.workspace.onDidChangeTextDocument(be))}(e),X(e,!1),Z(e)}async function ve(e,o){if(c)return void L("This command is currently unavailable in web mode.");var s=e.fsPath;if(!s||!n.existsSync(s))return void t.window.showErrorMessage("Invalid file");var a=1024e3,l=n.statSync(s).size;if(l<=a){t.window.showWarningMessage("Rainbow CSV: The file is not big enough, showing the full file instead. Use this preview for files larger than 1MB");let e=await t.workspace.openTextDocument(s);return void await t.window.showTextDocument(e)}let u=r.basename(s);const _=r.join(i.tmpdir(),`.rb_csv_preview.${o}.${u}`);n.open(s,"r",((e,r)=>{if(e)return console.log(e.message),void t.window.showErrorMessage("Unable to preview file");var i=Buffer.alloc(a);let s="head"==o?0:Math.max(l-a,0);n.read(r,i,0,a,s,(function(e,r){if(e)return console.log(e.message),void t.window.showErrorMessage("Unable to preview file");const s=i.toString();let a=null;a="head"==o?s.substr(0,s.lastIndexOf(s.includes("\r\n")?"\r\n":"\n")):s.substr(s.indexOf("\n")+1),n.writeFileSync(_,a),t.workspace.openTextDocument(_).then((e=>t.window.showTextDocument(e)))}))}))}function Ee(e,r){let n=t.languages.registerHoverProvider(e,{provideHover:(r,n,i)=>function(e,r,n,i){O!=e&&Z(e);const o=t.workspace.getConfiguration("rainbow_csv");if(o&&o.get("enable_tooltip")){var a=function(e,r,n,i,o){let[a,l]=I[n];var u=r.line,c=r.character,_=e.lineAt(u).text;const p=t.workspace.getConfiguration("rainbow_csv");let f=p?p.get("comment_prefix"):"";if(f&&_.startsWith(f))return"Comment";var h=s.smart_split(_,a,l,!0),d=h[0],g=h[1],y=G(d,c+1);if(null==y)return null;var m="Col #"+(y+1),b=z(e,a,l);if(i&&y -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","const os = require('os');\nconst fs = require('fs');\nconst path = require('path');\nconst rbql = require('./rbql_core/rbql-js/rbql.js');\nconst rbql_csv = require('./rbql_core/rbql-js/rbql_csv.js');\n\nconst vscode = require('vscode');\n\nconst csv_utils = require('./rbql_core/rbql-js/csv_utils.js');\n\n\nclass AssertionError extends Error {}\n\n\nfunction assert(condition, message=null) {\n if (!condition) {\n if (!message) {\n message = 'Assertion error';\n }\n throw new AssertionError(message);\n }\n}\n\n\nfunction get_default_js_udf_content() {\n let default_content = `// 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 bellow this line:\n `.replace(new RegExp(/^ */, 'mg'), '');\n return default_content;\n}\n\n\nfunction get_default_python_udf_content() {\n let default_content = `# 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 bellow this line:\n `.replace(new RegExp(/^ */, 'mg'), '');\n return default_content;\n}\n\n\nfunction calc_column_sizes(active_doc, delim, policy) {\n let result = [];\n let num_lines = active_doc.lineCount;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let comment_prefix = config ? config.get('comment_prefix') : '';\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning) {\n return [null, lnum + 1];\n }\n for (let i = 0; i < fields.length; i++) {\n if (result.length <= i)\n result.push(0);\n result[i] = Math.max(result[i], (fields[i].trim()).length);\n }\n }\n return [result, null];\n}\n\n\nfunction align_columns(active_doc, delim, policy, column_sizes) {\n let result_lines = [];\n let num_lines = active_doc.lineCount;\n let has_edit = false;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let comment_prefix = config ? config.get('comment_prefix') : '';\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix)) {\n result_lines.push(line_text);\n continue;\n }\n let fields = csv_utils.smart_split(line_text, delim, policy, true)[0];\n for (let i = 0; i < fields.length - 1; i++) {\n if (i >= column_sizes.length) // Safeguard against async doc edit.\n break;\n let adjusted = fields[i].trim();\n let delta_len = column_sizes[i] - adjusted.length;\n if (delta_len >= 0) { // Safeguard against async doc edit.\n adjusted += ' '.repeat(delta_len + 1);\n }\n if (fields[i] != adjusted) {\n fields[i] = adjusted;\n has_edit = true;\n }\n }\n result_lines.push(fields.join(delim));\n }\n if (!has_edit)\n return null;\n return result_lines.join('\\n');\n}\n\n\nfunction shrink_columns(active_doc, delim, policy) {\n let result_lines = [];\n let num_lines = active_doc.lineCount;\n let has_edit = false;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let comment_prefix = config ? config.get('comment_prefix') : '';\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix)) {\n result_lines.push(line_text);\n continue;\n }\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning) {\n return [null, lnum + 1];\n }\n for (let i = 0; i < fields.length; i++) {\n let adjusted = fields[i].trim();\n if (fields[i].length != adjusted.length) {\n fields[i] = adjusted;\n has_edit = true;\n }\n }\n result_lines.push(fields.join(delim));\n }\n if (!has_edit)\n return [null, null];\n return [result_lines.join('\\n'), null];\n}\n\n\nfunction get_last(arr) {\n return arr[arr.length - 1];\n}\n\n\nfunction populate_optimistic_rfc_csv_record_map(document, requested_end_record, dst_record_map, comment_prefix=null) {\n let num_lines = document.lineCount;\n let record_begin = null;\n let start_line_idx = dst_record_map.length ? get_last(dst_record_map)[1] : 0;\n for (let lnum = start_line_idx; lnum < num_lines && dst_record_map.length < requested_end_record; ++lnum) {\n let line_text = document.lineAt(lnum).text;\n if (lnum + 1 >= num_lines && line_text == \"\")\n break; // Skip the last empty line.\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let match_list = line_text.match(/\"/g);\n let has_unbalanced_double_quote = match_list && match_list.length % 2 == 1;\n if (record_begin === null && !has_unbalanced_double_quote) {\n dst_record_map.push([lnum, lnum + 1]);\n } else if (record_begin === null && has_unbalanced_double_quote) {\n record_begin = lnum;\n } else if (!has_unbalanced_double_quote) {\n continue;\n } else {\n dst_record_map.push([record_begin, lnum + 1]);\n record_begin = null;\n }\n }\n if (record_begin !== null) {\n dst_record_map.push([record_begin, num_lines]);\n }\n}\n\n\nfunction make_table_name_key(file_path) {\n return 'rbql_table_name:' + file_path;\n}\n\n\nfunction expanduser(filepath) {\n if (filepath.charAt(0) === '~') {\n return path.join(os.homedir(), filepath.slice(1));\n }\n return filepath;\n}\n\n\nfunction find_table_path(vscode_global_state, main_table_dir, table_id) {\n // If table_id is a relative path it could be relative either to the current directory or to the main table dir.\n var candidate_path = expanduser(table_id);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n if (main_table_dir && !path.isAbsolute(candidate_path)) {\n candidate_path = path.join(main_table_dir, candidate_path);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n }\n let table_path = vscode_global_state ? vscode_global_state.get(make_table_name_key(table_id)) : null;\n if (table_path && fs.existsSync(table_path)) {\n return table_path;\n }\n return null;\n}\n\n\nasync function read_header(table_path, encoding) {\n if (encoding == 'latin-1')\n encoding = 'binary';\n let readline = require('readline');\n let input_reader = readline.createInterface({ input: fs.createReadStream(table_path, {encoding: encoding}) });\n let closed = false;\n let promise_resolve = null;\n let promise_reject = null;\n let output_promise = new Promise(function(resolve, reject) {\n promise_resolve = resolve;\n promise_reject = reject;\n });\n input_reader.on('line', line => {\n if (!closed) {\n closed = true;\n input_reader.close();\n promise_resolve(line);\n }\n });\n input_reader.on('error', error => {\n promise_reject(error);\n });\n return output_promise;\n}\n\n\nfunction get_header_line(document, comment_prefix) {\n const num_lines = document.lineCount;\n for (let lnum = 0; lnum < num_lines; ++lnum) {\n const line_text = document.lineAt(lnum).text;\n if (!comment_prefix || !line_text.startsWith(comment_prefix)) {\n return line_text;\n }\n }\n return null;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\n\nclass RbqlIOHandlingError extends Error {}\n\nclass VSCodeRecordIterator extends rbql.RBQLInputIterator {\n constructor(document, delim, policy, has_header=false, comment_prefix=null, table_name='input', variable_prefix='a') {\n // We could have done a hack here actually: convert the document to stream/buffer and then use the standard reader.\n super();\n this.document = document;\n this.delim = delim;\n this.policy = policy;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.table_name = table_name;\n this.variable_prefix = variable_prefix;\n this.NR = 0; // Record number.\n this.NL = 0; // Line number (NL != NR when the CSV file has comments or multiline fields).\n this.fields_info = new Object();\n this.first_defective_line = null;\n this.first_record = this.get_first_record();\n }\n\n stop() {\n }\n\n get_first_record() {\n let header_line = get_header_line(this.document, this.comment_prefix);\n let first_record = csv_utils.smart_split(header_line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n return first_record;\n }\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n rbql.parse_basic_variables(query_text, this.variable_prefix, variable_map);\n rbql.parse_array_variables(query_text, this.variable_prefix, variable_map);\n let header_line = get_header_line(this.document, this.comment_prefix);\n let first_record = csv_utils.smart_split(header_line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n if (this.has_header) {\n rbql.parse_attribute_variables(query_text, this.variable_prefix, first_record, 'CSV header line', variable_map);\n rbql.parse_dictionary_variables(query_text, this.variable_prefix, first_record, variable_map);\n }\n return variable_map;\n }\n\n async get_header() {\n return this.has_header ? this.first_record : null;\n }\n\n get_line_rfc() {\n let rfc_line_buffer = [];\n const num_lines = this.document.lineCount;\n while (this.NL < num_lines) {\n let line = this.document.lineAt(this.NL).text;\n this.NL += 1;\n if (this.NL == num_lines && line.length == 0)\n return null; // Skip the last line if it is empty - this can happen due to trailing newline.\n let record_line = csv_utils.accumulate_rfc_line_into_record(rfc_line_buffer, line, this.comment_prefix);\n if (record_line !== null)\n return record_line;\n }\n return null;\n }\n\n get_line_simple() {\n const num_lines = this.document.lineCount;\n while (this.NL < num_lines) {\n let line = this.document.lineAt(this.NL).text;\n this.NL += 1;\n if (this.NL == num_lines && line.length == 0)\n return null; // Skip the last line if it is empty - this can happen due to trailing newline.\n if (this.comment_prefix === null || !line.startsWith(this.comment_prefix))\n return line;\n }\n return null;\n }\n\n do_get_record() {\n let line = (this.policy == 'quoted_rfc') ? this.get_line_rfc() : this.get_line_simple();\n if (line === null)\n return null;\n let [record, warning] = csv_utils.smart_split(line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false);\n if (warning) {\n if (this.first_defective_line === null) {\n this.first_defective_line = this.NL;\n if (this.policy == 'quoted_rfc')\n throw new RbqlIOHandlingError(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`);\n }\n }\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.NR;\n return record;\n }\n\n async get_record() {\n if (this.NR == 0 && this.has_header) {\n this.do_get_record(); // Skip the header record.\n }\n this.NR += 1;\n let record = this.do_get_record();\n return record;\n }\n\n get_warnings() {\n let result = [];\n if (this.first_defective_line !== null)\n result.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`);\n if (Object.keys(this.fields_info).length > 1)\n result.push(make_inconsistent_num_fields_warning(this.table_name, this.fields_info));\n return result;\n }\n}\n\n\nclass VSCodeWriter extends rbql.RBQLOutputWriter {\n constructor(delim, policy) {\n super();\n this.delim = delim;\n this.policy = policy;\n this.header_len = null;\n this.null_in_output = false;\n this.delim_in_simple_output = false;\n this.output_lines = [];\n\n if (policy == 'simple') {\n this.polymorphic_join = this.simple_join;\n } else if (policy == 'quoted') {\n this.polymorphic_join = this.quoted_join;\n } else if (policy == 'quoted_rfc') {\n this.polymorphic_join = this.quoted_join_rfc;\n } else if (policy == 'monocolumn') {\n this.polymorphic_join = this.mono_join;\n } else if (policy == 'whitespace') {\n this.polymorphic_join = this.simple_join;\n } else {\n throw new RbqlIOHandlingError('Unknown output csv policy');\n }\n }\n\n set_header(header) {\n if (header !== null) {\n this.header_len = header.length;\n this.write(header);\n }\n }\n\n quoted_join(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n quoted_join_rfc(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.rfc_quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n mono_join(fields) {\n if (fields.length > 1) {\n throw new RbqlIOHandlingError('Unable to use \"Monocolumn\" output format: some records have more than one field');\n }\n return fields[0];\n };\n\n\n simple_join(fields) {\n var res = fields.join(this.delim);\n if (fields.join('').indexOf(this.delim) != -1) {\n this.delim_in_simple_output = true;\n }\n return res;\n };\n\n\n normalize_fields(out_fields) {\n for (var i = 0; i < out_fields.length; i++) {\n if (out_fields[i] == null) {\n this.null_in_output = true;\n out_fields[i] = '';\n } else if (Array.isArray(out_fields[i])) {\n this.normalize_fields(out_fields[i]);\n out_fields[i] = out_fields[i].join(this.sub_array_delim);\n }\n }\n };\n\n\n write(fields) {\n if (this.header_len !== null && fields.length != this.header_len)\n throw new RbqlIOHandlingError(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${fields.length}`);\n this.normalize_fields(fields);\n this.output_lines.push(this.polymorphic_join(fields));\n return true;\n };\n\n async finish() {\n }\n\n get_warnings() {\n let result = [];\n if (this.null_in_output)\n result.push('null values in output were replaced by empty strings');\n if (this.delim_in_simple_output)\n result.push('Some output fields contain separator');\n return result;\n };\n}\n\nclass VSCodeTableRegistry {\n constructor(){}\n\n get_iterator_by_table_id(_table_id) {\n throw new RbqlIOHandlingError(\"JOIN queries are currently not supported in vscode.dev web version.\");\n }\n\n get_warnings() {\n return [];\n };\n}\n\nasync function rbql_query_web(query_text, input_document, input_delim, input_policy, output_delim, output_policy, output_warnings, with_headers, comment_prefix=null) {\n let user_init_code = ''; // TODO find a way to have init code.\n let join_tables_registry = new VSCodeTableRegistry(); // TODO find a way to have join registry.\n let input_iterator = new VSCodeRecordIterator(input_document, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new VSCodeWriter(output_delim, output_policy);\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n return output_writer.output_lines;\n}\n\n\nclass VSCodeFileSystemCSVRegistry extends rbql.RBQLTableRegistry {\n constructor(vscode_global_state, input_file_dir, delim, policy, encoding, has_header=false, comment_prefix=null, options=null) {\n super();\n this.vscode_global_state = vscode_global_state;\n this.input_file_dir = input_file_dir;\n this.delim = delim;\n this.policy = policy;\n this.encoding = encoding;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.stream = null;\n this.record_iterator = null;\n\n this.options = options;\n this.bulk_input_path = null;\n this.table_path = null;\n }\n\n get_iterator_by_table_id(table_id) {\n this.table_path = find_table_path(this.vscode_global_state, this.input_file_dir, table_id);\n if (this.table_path === null) {\n throw new RbqlIOHandlingError(`Unable to find join table \"${table_id}\"`);\n }\n if (this.options && this.options['bulk_read']) {\n this.bulk_input_path = this.table_path;\n } else {\n this.stream = fs.createReadStream(this.table_path);\n }\n this.record_iterator = new rbql_csv.CSVRecordIterator(this.stream, this.bulk_input_path, this.encoding, this.delim, this.policy, this.has_header, this.comment_prefix, table_id, 'b');\n return this.record_iterator;\n };\n\n get_warnings(output_warnings) {\n if (this.record_iterator && this.has_header) {\n output_warnings.push(`The first record in JOIN file ${path.basename(this.table_path)} was also treated as header (and skipped)`);\n }\n }\n}\n\n\nasync function rbql_query_node(vscode_global_state, query_text, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, output_warnings, with_headers=false, comment_prefix=null, user_init_code='', options=null) {\n let input_stream = null;\n let bulk_input_path = null;\n if (options && options['bulk_read'] && input_path) {\n bulk_input_path = input_path;\n } else {\n input_stream = input_path === null ? process.stdin : fs.createReadStream(input_path);\n }\n let [output_stream, close_output_on_finish] = output_path === null ? [process.stdout, false] : [fs.createWriteStream(output_path), true];\n if (input_delim == '\"' && input_policy == 'quoted')\n throw new RbqlIOHandlingError('Double quote delimiter is incompatible with \"quoted\" policy');\n if (csv_encoding == 'latin-1')\n csv_encoding = 'binary';\n if (!rbql_csv.is_ascii(query_text) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n if ((!rbql_csv.is_ascii(input_delim) || !rbql_csv.is_ascii(output_delim)) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n\n let default_init_source_path = path.join(os.homedir(), '.rbql_init_source.js');\n if (user_init_code == '' && fs.existsSync(default_init_source_path)) {\n user_init_code = rbql_csv.read_user_init_code(default_init_source_path);\n }\n let input_file_dir = input_path ? path.dirname(input_path) : null;\n let join_tables_registry = new VSCodeFileSystemCSVRegistry(vscode_global_state, input_file_dir, input_delim, input_policy, csv_encoding, with_headers, comment_prefix, options);\n let input_iterator = new rbql_csv.CSVRecordIterator(input_stream, bulk_input_path, csv_encoding, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new rbql_csv.CSVWriter(output_stream, close_output_on_finish, csv_encoding, output_delim, output_policy);\n\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n join_tables_registry.get_warnings(output_warnings);\n}\n\n\nmodule.exports.make_table_name_key = make_table_name_key;\nmodule.exports.find_table_path = find_table_path;\nmodule.exports.read_header = read_header;\nmodule.exports.rbql_query_web = rbql_query_web;\nmodule.exports.rbql_query_node = rbql_query_node;\nmodule.exports.get_header_line = get_header_line;\nmodule.exports.populate_optimistic_rfc_csv_record_map = populate_optimistic_rfc_csv_record_map;\nmodule.exports.get_default_js_udf_content = get_default_js_udf_content;\nmodule.exports.get_default_python_udf_content = get_default_python_udf_content;\nmodule.exports.align_columns = align_columns;\nmodule.exports.shrink_columns = shrink_columns;\nmodule.exports.calc_column_sizes = calc_column_sizes;\n","let field_regular_expression = '\"((?:[^\"]*\"\")*[^\"]*)\"';\nlet field_rgx = new RegExp('^' + field_regular_expression);\nlet field_rgx_external_whitespaces = new RegExp('^ *' + field_regular_expression + ' *');\n\n\n// TODO consider making this file (and rbql.js) both node and browser compatible: https://caolan.org/posts/writing_for_node_and_the_browser.html\n\n\nfunction split_lines(text) {\n return text.split(/\\r\\n|\\r|\\n/);\n}\n\n\nfunction extract_next_field(src, dlm, preserve_quotes_and_whitespaces, allow_external_whitespaces, cidx, result) {\n var warning = false;\n let src_cur = src.substring(cidx);\n let rgx = allow_external_whitespaces ? field_rgx_external_whitespaces : field_rgx;\n let match_obj = rgx.exec(src_cur);\n if (match_obj !== null) {\n let match_end = match_obj[0].length;\n if (cidx + match_end == src.length || src[cidx + match_end] == dlm) {\n if (preserve_quotes_and_whitespaces) {\n result.push(match_obj[0]);\n } else {\n result.push(match_obj[1].replace(/\"\"/g, '\"'));\n }\n return [cidx + match_end + 1, false];\n }\n warning = true;\n }\n var uidx = src.indexOf(dlm, cidx);\n if (uidx == -1)\n uidx = src.length;\n var field = src.substring(cidx, uidx);\n warning = warning || field.indexOf('\"') != -1;\n result.push(field);\n return [uidx + 1, warning];\n}\n\n\nfunction split_quoted_str(src, dlm, preserve_quotes_and_whitespaces=false) {\n // This function is newline-agnostic i.e. it can also split records with multiline fields.\n if (src.indexOf('\"') == -1) // Optimization for most common case\n return [src.split(dlm), false];\n var result = [];\n var cidx = 0;\n var warning = false;\n let allow_external_whitespaces = dlm != ' ';\n while (cidx < src.length) {\n var extraction_report = extract_next_field(src, dlm, preserve_quotes_and_whitespaces, allow_external_whitespaces, cidx, result);\n cidx = extraction_report[0];\n warning = warning || extraction_report[1];\n }\n if (src.charAt(src.length - 1) == dlm)\n result.push('');\n return [result, warning];\n}\n\n\nfunction quote_field(src, delim) {\n if (src.indexOf(delim) != -1 || src.indexOf('\"') != -1) {\n var escaped = src.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n }\n return src;\n}\n\n\nfunction rfc_quote_field(src, delim) {\n if (src.indexOf(delim) != -1 || src.indexOf('\"') != -1 || src.indexOf('\\n') != -1 || src.indexOf('\\r') != -1) {\n var escaped = src.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n }\n return src;\n}\n\n\nfunction unquote_field(field) {\n let rgx = new RegExp('^' + ' *' + field_regular_expression + ' *$');\n let match_obj = rgx.exec(field);\n if (match_obj !== null) {\n return match_obj[1].replace(/\"\"/g, '\"');\n }\n return field;\n}\n\n\nfunction unquote_fields(fields) {\n return fields.map(unquote_field);\n}\n\n\nfunction split_whitespace_separated_str(src, preserve_whitespaces=false) {\n var rgxp = preserve_whitespaces ? new RegExp(' *[^ ]+ *', 'g') : new RegExp('[^ ]+', 'g');\n let result = [];\n let match_obj = null;\n while((match_obj = rgxp.exec(src)) !== null) {\n result.push(match_obj[0]);\n }\n if (preserve_whitespaces) {\n for (let i = 0; i < result.length - 1; i++) {\n result[i] = result[i].slice(0, -1);\n }\n }\n return result;\n}\n\n\nfunction smart_split(src, dlm, policy, preserve_quotes_and_whitespaces) {\n if (policy === 'simple')\n return [src.split(dlm), false];\n if (policy === 'whitespace')\n return [split_whitespace_separated_str(src, preserve_quotes_and_whitespaces), false];\n if (policy === 'monocolumn')\n return [[src], false];\n return split_quoted_str(src, dlm, preserve_quotes_and_whitespaces);\n}\n\n\nfunction accumulate_rfc_line_into_record(external_rfc_line_buffer, current_line, comment_prefix=null) {\n // Return null if the current line yields no record.\n // Return a record string if the current line yields the record and cleans the external line buffer.\n if (comment_prefix !== null && external_rfc_line_buffer.length == 0 && current_line.startsWith(comment_prefix))\n return null;\n let match_list = current_line.match(/\"/g);\n let has_unbalanced_double_quote = match_list && match_list.length % 2 == 1;\n if (external_rfc_line_buffer.length == 0 && !has_unbalanced_double_quote) {\n return current_line;\n } else if (external_rfc_line_buffer.length == 0 && has_unbalanced_double_quote) {\n external_rfc_line_buffer.push(current_line);\n } else if (!has_unbalanced_double_quote) {\n external_rfc_line_buffer.push(current_line);\n } else {\n external_rfc_line_buffer.push(current_line);\n let multiline_row = external_rfc_line_buffer.join('\\n');\n external_rfc_line_buffer.splice(0, external_rfc_line_buffer.length); // Cleanup the external buffer.\n return multiline_row;\n }\n return null;\n}\n\n\nmodule.exports.split_quoted_str = split_quoted_str;\nmodule.exports.split_whitespace_separated_str = split_whitespace_separated_str;\nmodule.exports.smart_split = smart_split;\nmodule.exports.quote_field = quote_field;\nmodule.exports.rfc_quote_field = rfc_quote_field;\nmodule.exports.unquote_field = unquote_field;\nmodule.exports.unquote_fields = unquote_fields;\nmodule.exports.split_lines = split_lines;\nmodule.exports.accumulate_rfc_line_into_record = accumulate_rfc_line_into_record;\n","(function(exports){\n// The magic line above is to make the module both browser and Node compatible, see https://stackoverflow.com/questions/3225251/how-can-i-share-code-between-node-js-and-the-browser\n\n// This module works with records only. It is CSV-agnostic.\n// Do not add CSV-related logic or variables/functions/objects like \"delim\", \"separator\" etc\n\n\nclass RbqlParsingError extends Error {}\nclass RbqlRuntimeError extends Error {}\nclass AssertionError extends Error {}\nclass RbqlIOHandlingError extends Error {}\n\n\nclass InternalBadFieldError extends Error {\n constructor(bad_idx, ...params) {\n super(...params);\n this.bad_idx = bad_idx;\n }\n}\n\n\nfunction assert(condition, message=null) {\n if (!condition) {\n if (!message) {\n message = 'Assertion error';\n }\n throw new AssertionError(message);\n }\n}\n\n\nfunction replace_all(src, search, replacement) {\n return src.split(search).join(replacement);\n}\n\n\nclass RBQLContext {\n constructor(query_text, input_iterator, output_writer, user_init_code) {\n this.query_text = query_text;\n this.input_iterator = input_iterator;\n this.writer = output_writer;\n this.user_init_code = user_init_code;\n\n this.unnest_list = null;\n this.top_count = null;\n\n this.like_regex_cache = new Map();\n\n this.sort_key_expression = null;\n\n this.aggregation_stage = 0;\n this.aggregation_key_expression = null;\n this.functional_aggregators = [];\n\n this.join_map_impl = null;\n this.join_map = null;\n this.lhs_join_var_expression = null;\n\n this.where_expression = null;\n\n this.select_expression = null;\n\n this.update_expressions = null;\n\n this.variables_init_code = null;\n }\n}\n\nvar query_context = null; // Needs to be global for MIN(), MAX(), etc functions. TODO find a way to make it local.\n\n\nconst wrong_aggregation_usage_error = 'Usage of RBQL aggregation functions inside JavaScript expressions is not allowed, see the docs';\nconst RBQL_VERSION = '0.25.0';\n\n\nfunction check_if_brackets_match(opening_bracket, closing_bracket) {\n return (opening_bracket == '[' && closing_bracket == ']') || (opening_bracket == '(' && closing_bracket == ')') || (opening_bracket == '{' && closing_bracket == '}');\n}\n\n\nfunction parse_root_bracket_level_text_spans(select_expression) {\n let text_spans = []; // parts of text separated by commas at the root parenthesis level\n let last_pos = 0;\n let bracket_stack = [];\n for (let i = 0; i < select_expression.length; i++) {\n let cur_char = select_expression[i];\n if (cur_char == ',' && bracket_stack.length == 0) {\n text_spans.push(select_expression.substring(last_pos, i));\n last_pos = i + 1;\n } else if (['[', '{', '('].indexOf(cur_char) != -1) {\n bracket_stack.push(cur_char);\n } else if ([']', '}', ')'].indexOf(cur_char) != -1) {\n if (bracket_stack.length && check_if_brackets_match(bracket_stack[bracket_stack.length - 1], cur_char)) {\n bracket_stack.pop();\n } else {\n throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching opening bracket for closing \"${cur_char}\"`);\n }\n }\n }\n if (bracket_stack.length) {\n throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching closing bracket for opening \"${bracket_stack[0]}\"`);\n }\n text_spans.push(select_expression.substring(last_pos, select_expression.length));\n text_spans = text_spans.map(span => span.trim());\n return text_spans;\n}\n\n\nfunction unquote_string(quoted_str) {\n // It's possible to use eval here to unqoute the quoted_column_name, but it would be a little barbaric, let's do it manually instead\n if (!quoted_str || quoted_str.length < 2)\n return null;\n if (quoted_str[0] == \"'\" && quoted_str[quoted_str.length - 1] == \"'\") {\n return quoted_str.substring(1, quoted_str.length - 1).replace(/\\\\'/g, \"'\").replace(/\\\\\\\\/g, \"\\\\\");\n } else if (quoted_str[0] == '\"' && quoted_str[quoted_str.length - 1] == '\"') {\n return quoted_str.substring(1, quoted_str.length - 1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, \"\\\\\");\n } else {\n return null;\n }\n}\n\n\nfunction column_info_from_text_span(text_span, string_literals) {\n // This function is a rough equivalent of \"column_info_from_node()\" function in python version of RBQL\n text_span = text_span.trim();\n let rbql_star_marker = '__RBQL_INTERNAL_STAR';\n let simple_var_match = /^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(text_span);\n let attribute_match = /^([ab])\\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(text_span);\n let subscript_int_match = /^([ab])\\[([0-9]+)\\]$/.exec(text_span);\n let subscript_str_match = /^([ab])\\[___RBQL_STRING_LITERAL([0-9]+)___\\]$/.exec(text_span);\n if (simple_var_match !== null) {\n if (text_span == rbql_star_marker)\n return {table_name: null, column_index: null, column_name: null, is_star: true};\n if (text_span.startsWith('___RBQL_STRING_LITERAL'))\n return null;\n let match = /^([ab])([0-9]+)$/.exec(text_span);\n if (match !== null) {\n return {table_name: match[1], column_index: parseInt(match[2]) - 1, column_name: null, is_star: false};\n }\n // Some examples for this branch: NR, NF\n return {table_name: null, column_index: null, column_name: text_span, is_star: false};\n } else if (attribute_match !== null) {\n let table_name = attribute_match[1];\n let column_name = attribute_match[2];\n if (column_name == rbql_star_marker) {\n return {table_name: table_name, column_index: null, column_name: null, is_star: true};\n }\n return {table_name: null, column_index: null, column_name: column_name, is_star: false};\n } else if (subscript_int_match != null) {\n let table_name = subscript_int_match[1];\n let column_index = parseInt(subscript_int_match[2]) - 1;\n return {table_name: table_name, column_index: column_index, column_name: null, is_star: false};\n } else if (subscript_str_match != null) {\n let table_name = subscript_str_match[1];\n let replaced_string_literal_id = subscript_str_match[2];\n if (replaced_string_literal_id < string_literals.length) {\n let quoted_column_name = string_literals[replaced_string_literal_id];\n let unquoted_column_name = unquote_string(quoted_column_name);\n if (unquoted_column_name !== null && unquoted_column_name !== undefined) {\n return {table_name: null, column_index: null, column_name: unquoted_column_name, is_star: false};\n }\n }\n }\n return null;\n}\n\n\nfunction adhoc_parse_select_expression_to_column_infos(select_expression, string_literals) {\n // It is acceptable for the algorithm to provide null column name when it could be theorethically possible to deduce the name.\n // I.e. this algorithm guarantees precision but doesn't guarantee completeness in all theorethically possible queries.\n // Although the algorithm should be complete in all practical scenarios, i.e. it should be hard to come up with the query that doesn't produce complete set of column names.\n // The null column name just means that the output column will be named as col{i}, so the failure to detect the proper column name can be tolerated.\n // Specifically this function guarantees the following:\n // 1. The number of column_infos is correct and will match the number of fields in each record in the output - otherwise the exception should be thrown\n // 2. If column_info at pos j is not null, it is guaranteed to correctly represent that column name in the output\n let text_spans = parse_root_bracket_level_text_spans(select_expression);\n let column_infos = text_spans.map(ts => column_info_from_text_span(ts, string_literals));\n return column_infos;\n}\n\n\nfunction stable_compare(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i])\n return a[i] < b[i] ? -1 : 1;\n }\n}\n\n\nfunction safe_get(record, idx) {\n return idx < record.length ? record[idx] : null;\n}\n\n\nfunction safe_join_get(record, idx) {\n if (idx < record.length) {\n return record[idx];\n }\n throw new InternalBadFieldError(idx);\n}\n\n\nfunction safe_set(record, idx, value) {\n if (idx < record.length) {\n record[idx] = value;\n } else {\n throw new InternalBadFieldError(idx);\n }\n}\n\n\nfunction regexp_escape(text) {\n // From here: https://stackoverflow.com/a/6969486/2898283\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched text\n}\n\n\nfunction like_to_regex(pattern) {\n let p = 0;\n let i = 0;\n let converted = '';\n while (i < pattern.length) {\n if (pattern.charAt(i) == '_' || pattern.charAt(i) == '%') {\n converted += regexp_escape(pattern.substring(p, i));\n p = i + 1;\n if (pattern.charAt(i) == '_') {\n converted += '.';\n } else {\n converted += '.*';\n }\n }\n i += 1;\n }\n converted += regexp_escape(pattern.substring(p, i));\n return '^' + converted + '$';\n}\n\n\nfunction like(text, pattern) {\n let matcher = query_context.like_regex_cache.get(pattern);\n if (matcher === undefined) {\n matcher = new RegExp(like_to_regex(pattern));\n query_context.like_regex_cache.set(pattern, matcher);\n }\n return matcher.test(text);\n}\nconst LIKE = like;\n\n\nclass RBQLAggregationToken {\n constructor(marker_id, value) {\n this.marker_id = marker_id;\n this.value = value;\n }\n\n toString() {\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n }\n}\n\n\nclass UnnestMarker {}\n\n\nfunction UNNEST(vals) {\n if (query_context.unnest_list !== null) {\n // Technically we can support multiple UNNEST's but the implementation/algorithm is more complex and just doesn't worth it\n throw new RbqlParsingError('Only one UNNEST is allowed per query');\n }\n query_context.unnest_list = vals;\n return new UnnestMarker();\n}\nconst unnest = UNNEST;\nconst Unnest = UNNEST;\nconst UNFOLD = UNNEST; // \"UNFOLD\" is deprecated, just for backward compatibility\n\n\nfunction parse_number(val) {\n // We can do a more pedantic number test like `/^ *-{0,1}[0-9]+\\.{0,1}[0-9]* *$/.test(val)`, but user will probably use just Number(val) or parseInt/parseFloat\n let result = Number(val);\n if (isNaN(result)) {\n throw new RbqlRuntimeError(`Unable to convert value \"${val}\" to a number. MIN, MAX, SUM, AVG, MEDIAN and VARIANCE aggregate functions convert their string arguments to numeric values`);\n }\n return result;\n}\n\n\nclass MinAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, Math.min(cur_aggr, val));\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\n\nclass MaxAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, Math.max(cur_aggr, val));\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass SumAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, cur_aggr + val);\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass AvgAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val, 1]);\n } else {\n var cur_sum = cur_aggr[0];\n var cur_cnt = cur_aggr[1];\n this.stats.set(key, [cur_sum + val, cur_cnt + 1]);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n var cur_sum = cur_aggr[0];\n var cur_cnt = cur_aggr[1];\n var avg = cur_sum / cur_cnt;\n return avg;\n }\n}\n\n\nclass VarianceAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val, val * val, 1]);\n } else {\n var cur_sum = cur_aggr[0];\n var cur_sum_sq = cur_aggr[1];\n var cur_cnt = cur_aggr[2];\n this.stats.set(key, [cur_sum + val, cur_sum_sq + val * val, cur_cnt + 1]);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n var cur_sum = cur_aggr[0];\n var cur_sum_sq = cur_aggr[1];\n var cur_cnt = cur_aggr[2];\n var avg_val = cur_sum / cur_cnt;\n var variance = cur_sum_sq / cur_cnt - avg_val * avg_val;\n return variance;\n }\n}\n\n\nclass MedianAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val]);\n } else {\n cur_aggr.push(val);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n cur_aggr.sort(function(a, b) { return a - b; });\n var m = Math.floor(cur_aggr.length / 2);\n if (cur_aggr.length % 2) {\n return cur_aggr[m];\n } else {\n return (cur_aggr[m - 1] + cur_aggr[m]) / 2.0;\n }\n }\n}\n\n\nclass CountAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, 1);\n } else {\n this.stats.set(key, cur_aggr + 1);\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass ArrayAggAggregator {\n constructor(post_proc=null) {\n this.post_proc = post_proc;\n this.stats = new Map();\n }\n\n increment(key, val) {\n let cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val]);\n } else {\n cur_aggr.push(val);\n }\n }\n\n get_final(key) {\n let cur_aggr = this.stats.get(key);\n if (this.post_proc === null)\n return cur_aggr;\n return this.post_proc(cur_aggr);\n }\n}\n\n\nclass ConstGroupVerifier {\n constructor(output_index) {\n this.output_index = output_index;\n this.const_values = new Map();\n }\n\n increment(key, value) {\n var old_value = this.const_values.get(key);\n if (old_value === undefined) {\n this.const_values.set(key, value);\n } else if (old_value != value) {\n throw new RbqlRuntimeError(`Invalid aggregate expression: non-constant values in output column ${this.output_index + 1}. E.g. \"${old_value}\" and \"${value}\"`);\n }\n }\n\n get_final(key) {\n return this.const_values.get(key);\n }\n}\n\n\nfunction init_aggregator(generator_name, val, post_proc=null) {\n query_context.aggregation_stage = 1;\n var res = new RBQLAggregationToken(query_context.functional_aggregators.length, val);\n if (post_proc === null) {\n query_context.functional_aggregators.push(new generator_name());\n } else {\n query_context.functional_aggregators.push(new generator_name(post_proc));\n }\n return res;\n}\n\n\nfunction MIN(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MinAggregator, val) : val;\n}\nconst min = MIN;\nconst Min = MIN;\n\n\nfunction MAX(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MaxAggregator, val) : val;\n}\nconst max = MAX;\nconst Max = MAX;\n\nfunction COUNT(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(CountAggregator, 1) : 1;\n}\nconst count = COUNT;\nconst Count = COUNT;\n\nfunction SUM(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(SumAggregator, val) : val;\n}\nconst sum = SUM;\nconst Sum = SUM;\n\nfunction AVG(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(AvgAggregator, val) : val;\n}\nconst avg = AVG;\nconst Avg = AVG;\n\nfunction VARIANCE(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(VarianceAggregator, val) : val;\n}\nconst variance = VARIANCE;\nconst Variance = VARIANCE;\n\nfunction MEDIAN(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MedianAggregator, val) : val;\n}\nconst median = MEDIAN;\nconst Median = MEDIAN;\n\nfunction ARRAY_AGG(val, post_proc=null) {\n return query_context.aggregation_stage < 2 ? init_aggregator(ArrayAggAggregator, val, post_proc) : val;\n}\nconst array_agg = ARRAY_AGG;\nconst FOLD = ARRAY_AGG; // \"FOLD\" is deprecated, just for backward compatibility\n\n\nfunction add_to_set(dst_set, value) {\n var len_before = dst_set.size;\n dst_set.add(value);\n return len_before != dst_set.size;\n}\n\n\nclass TopWriter {\n constructor(subwriter, top_count) {\n this.subwriter = subwriter;\n this.NW = 0;\n this.top_count = top_count;\n }\n\n async write(record) {\n if (this.top_count !== null && this.NW >= this.top_count)\n return false;\n await this.subwriter.write(record);\n this.NW += 1;\n return true;\n }\n\n async finish() {\n await this.subwriter.finish();\n }\n}\n\n\nclass UniqWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.seen = new Set();\n }\n\n async write(record) {\n if (!add_to_set(this.seen, JSON.stringify(record)))\n return true;\n if (!await this.subwriter.write(record))\n return false;\n return true;\n }\n\n async finish() {\n await this.subwriter.finish();\n }\n}\n\n\nclass UniqCountWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.records = new Map();\n }\n\n async write(record) {\n var key = JSON.stringify(record);\n var old_val = this.records.get(key);\n if (old_val) {\n old_val[0] += 1;\n } else {\n this.records.set(key, [1, record]);\n }\n return true;\n }\n\n async finish() {\n for (var [key, value] of this.records) {\n let [count, record] = value;\n record.unshift(count);\n if (!await this.subwriter.write(record))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass SortedWriter {\n constructor(subwriter, reverse_sort) {\n this.subwriter = subwriter;\n this.reverse_sort = reverse_sort;\n this.unsorted_entries = [];\n }\n\n async write(stable_entry) {\n this.unsorted_entries.push(stable_entry);\n return true;\n }\n\n async finish() {\n var unsorted_entries = this.unsorted_entries;\n unsorted_entries.sort(stable_compare);\n if (this.reverse_sort)\n unsorted_entries.reverse();\n for (var i = 0; i < unsorted_entries.length; i++) {\n var entry = unsorted_entries[i];\n if (!await this.subwriter.write(entry[entry.length - 1]))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass AggregateWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.aggregators = [];\n this.aggregation_keys = new Set();\n }\n\n async finish() {\n var all_keys = Array.from(this.aggregation_keys);\n all_keys.sort();\n for (var i = 0; i < all_keys.length; i++) {\n var key = all_keys[i];\n var out_fields = [];\n for (var ag of this.aggregators) {\n out_fields.push(ag.get_final(key));\n }\n if (!await this.subwriter.write(out_fields))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass InnerJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n }\n\n get_rhs(lhs_key) {\n return this.join_map.get_join_records(lhs_key);\n }\n}\n\n\nclass LeftJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n this.null_record = [[null, join_map.max_record_len, Array(join_map.max_record_len).fill(null)]];\n }\n\n get_rhs(lhs_key) {\n let result = this.join_map.get_join_records(lhs_key);\n if (result.length == 0) {\n return this.null_record;\n }\n return result;\n }\n}\n\n\nclass StrictLeftJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n }\n\n get_rhs(lhs_key) {\n let result = this.join_map.get_join_records(lhs_key);\n if (result.length != 1) {\n throw new RbqlRuntimeError('In \"STRICT LEFT JOIN\" each key in A must have exactly one match in B. Bad A key: \"' + lhs_key + '\"');\n }\n return result;\n }\n}\n\n\nfunction select_except(src, except_fields) {\n let result = [];\n for (let i = 0; i < src.length; i++) {\n if (except_fields.indexOf(i) == -1)\n result.push(src[i]);\n }\n return result;\n}\n\n\nasync function select_simple(sort_key, NR, out_fields) {\n if (query_context.sort_key_expression !== null) {\n var sort_entry = sort_key.concat([NR, out_fields]);\n if (!await query_context.writer.write(sort_entry))\n return false;\n } else {\n if (!await query_context.writer.write(out_fields))\n return false;\n }\n return true;\n}\n\n\nfunction select_aggregated(key, transparent_values) {\n if (key !== null) {\n key = JSON.stringify(key);\n }\n if (query_context.aggregation_stage === 1) {\n if (!(query_context.writer instanceof TopWriter)) {\n throw new RbqlParsingError('\"ORDER BY\", \"UPDATE\" and \"DISTINCT\" keywords are not allowed in aggregate queries');\n }\n query_context.writer = new AggregateWriter(query_context.writer);\n let num_aggregators_found = 0;\n for (var i = 0; i < transparent_values.length; i++) {\n var trans_value = transparent_values[i];\n if (trans_value instanceof RBQLAggregationToken) {\n query_context.writer.aggregators.push(query_context.functional_aggregators[trans_value.marker_id]);\n query_context.writer.aggregators[query_context.writer.aggregators.length - 1].increment(key, trans_value.value);\n num_aggregators_found += 1;\n } else {\n query_context.writer.aggregators.push(new ConstGroupVerifier(query_context.writer.aggregators.length));\n query_context.writer.aggregators[query_context.writer.aggregators.length - 1].increment(key, trans_value);\n }\n }\n if (num_aggregators_found != query_context.functional_aggregators.length) {\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n }\n query_context.aggregation_stage = 2;\n } else {\n for (var i = 0; i < transparent_values.length; i++) {\n var trans_value = transparent_values[i];\n query_context.writer.aggregators[i].increment(key, trans_value);\n }\n }\n query_context.writer.aggregation_keys.add(key);\n}\n\n\nasync function select_unnested(sort_key, NR, folded_fields) {\n let out_fields = folded_fields.slice();\n let unnest_pos = folded_fields.findIndex(val => val instanceof UnnestMarker);\n for (var i = 0; i < query_context.unnest_list.length; i++) {\n out_fields[unnest_pos] = query_context.unnest_list[i];\n if (!await select_simple(sort_key, NR, out_fields.slice()))\n return false;\n }\n return true;\n}\n\n\nconst 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`;\n\n\nconst PROCESS_SELECT_SIMPLE = `\nlet star_fields = record_a;\n__CODE__\n`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nfunction embed_expression(parent_code, child_placeholder, child_expression) {\n return replace_all(parent_code, child_placeholder, child_expression);\n}\n\n\nfunction embed_code(parent_code, child_placeholder, child_code) {\n let parent_lines = parent_code.split('\\n');\n let child_lines = child_code.split('\\n');\n for (let i = 0; i < parent_lines.length; i++) {\n let pos = parent_lines[i].indexOf(child_placeholder);\n if (pos == -1)\n continue;\n assert(pos % 4 == 0);\n let placeholder_indentation = parent_lines[i].substring(0, pos);\n child_lines = child_lines.map(l => placeholder_indentation + l);\n let result_lines = parent_lines.slice(0, i).concat(child_lines).concat(parent_lines.slice(i + 1));\n return result_lines.join('\\n') + '\\n';\n }\n assert(false);\n}\n\n\nfunction generate_main_loop_code(query_context) {\n let is_select_query = query_context.select_expression !== null;\n let is_join_query = query_context.join_map !== null;\n let where_expression = query_context.where_expression === null ? 'true' : query_context.where_expression;\n let aggregation_key_expression = query_context.aggregation_key_expression === null ? 'null' : query_context.aggregation_key_expression;\n let sort_key_expression = query_context.sort_key_expression === null ? 'null' : query_context.sort_key_expression;\n let js_code = embed_code(MAIN_LOOP_BODY, '__USER_INIT_CODE__', query_context.user_init_code);\n if (is_select_query) {\n if (is_join_query) {\n js_code = embed_code(embed_code(js_code, '__CODE__', PROCESS_SELECT_JOIN), '__CODE__', PROCESS_SELECT_COMMON);\n js_code = embed_expression(js_code, '__RBQLMP__lhs_join_var_expression', query_context.lhs_join_var_expression);\n } else {\n js_code = embed_code(embed_code(js_code, '__CODE__', PROCESS_SELECT_SIMPLE), '__CODE__', PROCESS_SELECT_COMMON);\n }\n js_code = embed_code(js_code, '__RBQLMP__variables_init_code', query_context.variables_init_code);\n js_code = embed_expression(js_code, '__RBQLMP__select_expression', query_context.select_expression);\n js_code = embed_expression(js_code, '__RBQLMP__where_expression', where_expression);\n js_code = embed_expression(js_code, '__RBQLMP__aggregation_key_expression', aggregation_key_expression);\n js_code = embed_expression(js_code, '__RBQLMP__sort_key_expression', sort_key_expression);\n } else {\n if (is_join_query) {\n js_code = embed_code(js_code, '__CODE__', PROCESS_UPDATE_JOIN);\n js_code = embed_expression(js_code, '__RBQLMP__lhs_join_var_expression', query_context.lhs_join_var_expression);\n } else {\n js_code = embed_code(js_code, '__CODE__', PROCESS_UPDATE_SIMPLE);\n }\n js_code = embed_code(js_code, '__RBQLMP__variables_init_code', query_context.variables_init_code);\n js_code = embed_code(js_code, '__RBQLMP__update_expressions', query_context.update_expressions);\n js_code = embed_expression(js_code, '__RBQLMP__where_expression', where_expression);\n }\n return \"(async () => {\" + js_code + \"})()\";\n}\n\n\nasync function compile_and_run(query_context) {\n let main_loop_body = generate_main_loop_code(query_context);\n try {\n let main_loop_promise = eval(main_loop_body);\n await main_loop_promise;\n } catch (e) {\n if (e instanceof SyntaxError) {\n // SyntaxError's from eval() function do not contain detailed explanation of what has caused the syntax error, so to guess what was wrong we can only use the original query\n // v8 issue to fix eval: https://bugs.chromium.org/p/v8/issues/detail?id=2589\n let lower_case_query = query_context.query_text.toLowerCase();\n if (lower_case_query.indexOf(' having ') != -1)\n throw new SyntaxError(e.message + \"\\nRBQL doesn't support \\\"HAVING\\\" keyword\");\n if (lower_case_query.indexOf(' like ') != -1)\n throw new SyntaxError(e.message + \"\\nRBQL doesn't support \\\"LIKE\\\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... \"); // UT JSON\n if (lower_case_query.indexOf(' from ') != -1)\n throw new SyntaxError(e.message + \"\\nTip: If input table is defined by the environment, RBQL query should not have \\\"FROM\\\" keyword\"); // UT JSON\n if (e && e.message && String(e.message).toLowerCase().indexOf('unexpected identifier') != -1) {\n if (lower_case_query.indexOf(' and ') != -1)\n throw new SyntaxError(e.message + \"\\nDid you use 'and' keyword in your query?\\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!\");\n if (lower_case_query.indexOf(' or ') != -1)\n throw new SyntaxError(e.message + \"\\nDid you use 'or' keyword in your query?\\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!\");\n }\n }\n if (e && e.message && e.message.indexOf('Received an instance of RBQLAggregationToken') != -1)\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n throw e;\n }\n}\n\n\nconst GROUP_BY = 'GROUP BY';\nconst UPDATE = 'UPDATE';\nconst SELECT = 'SELECT';\nconst JOIN = 'JOIN';\nconst INNER_JOIN = 'INNER JOIN';\nconst LEFT_JOIN = 'LEFT JOIN';\nconst LEFT_OUTER_JOIN = 'LEFT OUTER JOIN';\nconst STRICT_LEFT_JOIN = 'STRICT LEFT JOIN';\nconst ORDER_BY = 'ORDER BY';\nconst WHERE = 'WHERE';\nconst LIMIT = 'LIMIT';\nconst EXCEPT = 'EXCEPT';\nconst WITH = 'WITH';\n\n\nfunction get_ambiguous_error_msg(variable_name) {\n return `Ambiguous variable name: \"${variable_name}\" is present both in input and in join tables`;\n}\n\n\nfunction get_all_matches(regexp, text) {\n var result = [];\n let match_obj = null;\n while((match_obj = regexp.exec(text)) !== null) {\n result.push(match_obj);\n }\n return result;\n}\n\n\nfunction str_strip(src) {\n return src.replace(/^ +| +$/g, '');\n}\n\n\nfunction strip_comments(cline) {\n cline = cline.trim();\n if (cline.startsWith('//'))\n return '';\n return cline;\n}\n\n\nfunction combine_string_literals(backend_expression, string_literals) {\n for (var i = 0; i < string_literals.length; i++) {\n backend_expression = replace_all(backend_expression, `___RBQL_STRING_LITERAL${i}___`, string_literals[i]);\n }\n return backend_expression;\n}\n\n\nfunction parse_basic_variables(query_text, prefix, dst_variables_map) {\n assert(prefix == 'a' || prefix == 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}([1-9][0-9]*)(?:$|(?=[^_a-zA-Z0-9]))`, 'g');\n let matches = get_all_matches(rgx, query_text);\n for (let i = 0; i < matches.length; i++) {\n let field_num = parseInt(matches[i][1]);\n dst_variables_map[prefix + String(field_num)] = {initialize: true, index: field_num - 1};\n }\n}\n\n\nfunction parse_array_variables(query_text, prefix, dst_variables_map) {\n assert(prefix == 'a' || prefix == 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\[([1-9][0-9]*)\\\\]`, 'g');\n let matches = get_all_matches(rgx, query_text);\n for (let i = 0; i < matches.length; i++) {\n let field_num = parseInt(matches[i][1]);\n dst_variables_map[`${prefix}[${field_num}]`] = {initialize: true, index: field_num - 1};\n }\n}\n\n\nfunction js_string_escape_column_name(column_name, quote_char) {\n column_name = column_name.replace(/\\\\/g, '\\\\\\\\');\n column_name = column_name.replace(/\\n/g, '\\\\n');\n column_name = column_name.replace(/\\r/g, '\\\\r');\n column_name = column_name.replace(/\\t/g, '\\\\t');\n if (quote_char === \"'\")\n return column_name.replace(/'/g, \"\\\\'\");\n if (quote_char === '\"')\n return column_name.replace(/\"/g, '\\\\\"');\n assert(quote_char === \"`\");\n return column_name.replace(/`/g, \"\\\\`\");\n}\n\n\nfunction query_probably_has_dictionary_variable(query_text, column_name) {\n let rgx = new RegExp('[-a-zA-Z0-9_:;+=!.,()%^#@&* ]+', 'g');\n let continuous_name_segments = get_all_matches(rgx, column_name);\n for (let continuous_segment of continuous_name_segments) {\n if (query_text.indexOf(continuous_segment) == -1)\n return false;\n }\n return true;\n}\n\n\nfunction parse_dictionary_variables(query_text, prefix, column_names, dst_variables_map) {\n // The purpose of this algorithm is to minimize number of variables in varibale_map to improve performance, ideally it should be only variables from the query\n\n // FIXME to prevent typos in attribute names either use query-based variable parsing which can properly handle back-tick strings or wrap \"a\" and \"b\" variables with ES6 Proxies https://stackoverflow.com/a/25658975/2898283\n assert(prefix === 'a' || prefix === 'b');\n let dict_test_rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\[`);\n if (query_text.search(dict_test_rgx) == -1)\n return;\n for (let i = 0; i < column_names.length; i++) {\n let column_name = column_names[i];\n if (query_probably_has_dictionary_variable(query_text, column_name)) {\n let escaped_column_name = js_string_escape_column_name(column_name, '\"');\n dst_variables_map[`${prefix}[\"${escaped_column_name}\"]`] = {initialize: true, index: i};\n escaped_column_name = js_string_escape_column_name(column_name, \"'\");\n dst_variables_map[`${prefix}['${escaped_column_name}']`] = {initialize: false, index: i};\n escaped_column_name = js_string_escape_column_name(column_name, \"`\");\n dst_variables_map[`${prefix}[\\`${escaped_column_name}\\`]`] = {initialize: false, index: i};\n }\n }\n}\n\n\nfunction parse_attribute_variables(query_text, prefix, column_names, column_names_source, dst_variables_map) {\n // The purpose of this algorithm is to minimize number of variables in varibale_map to improve performance, ideally it should be only variables from the query\n\n assert(prefix === 'a' || prefix === 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\.([_a-zA-Z][_a-zA-Z0-9]*)`, 'g');\n let matches = get_all_matches(rgx, query_text);\n let column_names_from_query = matches.map(v => v[1]);\n for (let column_name of column_names_from_query) {\n let zero_based_idx = column_names.indexOf(column_name);\n if (zero_based_idx != -1) {\n dst_variables_map[`${prefix}.${column_name}`] = {initialize: true, index: zero_based_idx};\n } else {\n throw new RbqlParsingError(`Unable to find column \"${column_name}\" in ${prefix == 'a' ? 'input' : 'join'} ${column_names_source}`);\n }\n }\n}\n\n\nfunction map_variables_directly(query_text, column_names, dst_variables_map) {\n for (let i = 0; i < column_names.length; i++) {\n let column_name = column_names[i];\n if ( /^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(column_name) === null)\n throw new RbqlIOHandlingError(`Unable to use column name \"${column_name}\" as RBQL/JS variable`);\n if (query_text.indexOf(column_name) != -1)\n dst_variables_map[column_name] = {initialize: true, index: i};\n }\n}\n\n\nfunction ensure_no_ambiguous_variables(query_text, input_column_names, join_column_names) {\n let join_column_names_set = new Set(join_column_names);\n for (let column_name of input_column_names) {\n if (join_column_names_set.has(column_name) && query_text.indexOf(column_name) != -1) // False positive is tolerable here\n throw new RbqlParsingError(get_ambiguous_error_msg(column_name));\n }\n}\n\n\nfunction parse_join_expression(src) {\n src = str_strip(src);\n const invalid_join_syntax_error = 'Invalid join syntax. Valid syntax: /path/to/B/table on a... == b... [and a... == b... [and ... ]]';\n let rgx = /^ *([^ ]+) +on +/i;\n let match = rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n let table_id = match[1];\n src = src.substr(match[0].length);\n\n let variable_pairs = [];\n var pair_rgx = /^([^ =]+) *==? *([^ =]+)/;\n var and_rgx = /^ +(and|&&) +/i;\n while (true) {\n match = pair_rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n variable_pairs.push([match[1], match[2]]);\n src = src.substr(match[0].length);\n if (!src.length)\n break;\n match = and_rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n src = src.substr(match[0].length);\n }\n return [table_id, variable_pairs];\n}\n\n\nfunction resolve_join_variables(input_variables_map, join_variables_map, variable_pairs, string_literals) {\n let lhs_variables = [];\n let rhs_indices = [];\n const valid_join_syntax_msg = 'Valid JOIN syntax: /path/to/B/table on a... == b... [and a... == b... [and ... ]]';\n for (let variable_pair of variable_pairs) {\n let [join_var_1, join_var_2] = variable_pair;\n join_var_1 = combine_string_literals(join_var_1, string_literals);\n join_var_2 = combine_string_literals(join_var_2, string_literals);\n if (input_variables_map.hasOwnProperty(join_var_1) && join_variables_map.hasOwnProperty(join_var_1))\n throw new RbqlParsingError(get_ambiguous_error_msg(join_var_1));\n if (input_variables_map.hasOwnProperty(join_var_2) && join_variables_map.hasOwnProperty(join_var_2))\n throw new RbqlParsingError(get_ambiguous_error_msg(join_var_2));\n if (input_variables_map.hasOwnProperty(join_var_2))\n [join_var_1, join_var_2] = [join_var_2, join_var_1];\n\n let [lhs_key_index, rhs_key_index] = [null, null];\n if (['NR', 'a.NR', 'aNR'].indexOf(join_var_1) != -1) {\n lhs_key_index = -1;\n } else if (input_variables_map.hasOwnProperty(join_var_1)) {\n lhs_key_index = input_variables_map[join_var_1].index;\n } else {\n throw new RbqlParsingError(`Unable to parse JOIN expression: Input table does not have field \"${join_var_1}\"\\n${valid_join_syntax_msg}`);\n }\n\n if (['b.NR', 'bNR'].indexOf(join_var_2) != -1) {\n rhs_key_index = -1;\n } else if (join_variables_map.hasOwnProperty(join_var_2)) {\n rhs_key_index = join_variables_map[join_var_2].index;\n } else {\n throw new RbqlParsingError(`Unable to parse JOIN expression: Join table does not have field \"${join_var_2}\"\\n${valid_join_syntax_msg}`);\n }\n\n let lhs_join_var_expression = lhs_key_index == -1 ? 'NR' : `safe_join_get(record_a, ${lhs_key_index})`;\n rhs_indices.push(rhs_key_index);\n lhs_variables.push(lhs_join_var_expression);\n }\n return [lhs_variables, rhs_indices];\n}\n\n\nfunction generate_common_init_code(query_text, variable_prefix) {\n assert(variable_prefix == 'a' || variable_prefix == 'b');\n let result = [];\n result.push(`${variable_prefix} = new Object();`);\n let base_var = variable_prefix == 'a' ? 'NR' : 'bNR';\n let attr_var = `${variable_prefix}.NR`;\n if (query_text.indexOf(attr_var) != -1)\n result.push(`${attr_var} = ${base_var};`);\n if (variable_prefix == 'a' && query_text.indexOf('aNR') != -1)\n result.push('aNR = NR;');\n return result;\n}\n\n\nfunction generate_init_statements(query_text, variables_map, join_variables_map, indent) {\n let code_lines = generate_common_init_code(query_text, 'a');\n let simple_var_name_rgx = /^[_0-9a-zA-Z]+$/;\n for (const [variable_name, var_info] of Object.entries(variables_map)) {\n if (var_info.initialize) {\n let variable_declaration_keyword = simple_var_name_rgx.exec(variable_name) ? 'var ' : '';\n code_lines.push(`${variable_declaration_keyword}${variable_name} = safe_get(record_a, ${var_info.index});`);\n }\n }\n if (join_variables_map) {\n code_lines = code_lines.concat(generate_common_init_code(query_text, 'b'));\n for (const [variable_name, var_info] of Object.entries(join_variables_map)) {\n if (var_info.initialize) {\n let variable_declaration_keyword = simple_var_name_rgx.exec(variable_name) ? 'var ' : '';\n code_lines.push(`${variable_declaration_keyword}${variable_name} = record_b === null ? null : safe_get(record_b, ${var_info.index});`);\n }\n }\n }\n for (let i = 1; i < code_lines.length; i++) {\n code_lines[i] = indent + code_lines[i];\n }\n return code_lines.join('\\n');\n}\n\n\nfunction replace_star_count(aggregate_expression) {\n var rgx = /(^|,) *COUNT\\( *\\* *\\) *(?:$|(?=,))/ig;\n var result = aggregate_expression.replace(rgx, '$1 COUNT(1)');\n return str_strip(result);\n}\n\n\nfunction replace_star_vars(rbql_expression) {\n let star_rgx = /(?:^|,) *(\\*|a\\.\\*|b\\.\\*) *(?=$|,)/g;\n let matches = get_all_matches(star_rgx, rbql_expression);\n let last_pos = 0;\n let result = '';\n for (let match of matches) {\n let star_expression = match[1];\n let replacement_expression = ']).concat(' + {'*': 'star_fields', 'a.*': 'record_a', 'b.*': 'record_b'}[star_expression] + ').concat([';\n if (last_pos < match.index)\n result += rbql_expression.substring(last_pos, match.index);\n result += replacement_expression;\n last_pos = match.index + match[0].length + 1; // Adding one to skip the lookahead comma\n }\n result += rbql_expression.substring(last_pos);\n return result;\n}\n\n\nfunction replace_star_vars_for_header_parsing(rbql_expression) {\n let star_rgx = /(?:(?<=^)|(?<=,)) *(\\*|a\\.\\*|b\\.\\*) *(?=$|,)/g;\n let matches = get_all_matches(star_rgx, rbql_expression);\n let last_pos = 0;\n let result = '';\n for (let match of matches) {\n let star_expression = match[1];\n let replacement_expression = {'*': '__RBQL_INTERNAL_STAR', 'a.*': 'a.__RBQL_INTERNAL_STAR', 'b.*': 'b.__RBQL_INTERNAL_STAR'}[star_expression];\n if (last_pos < match.index)\n result += rbql_expression.substring(last_pos, match.index);\n result += replacement_expression;\n last_pos = match.index + match[0].length;\n }\n result += rbql_expression.substring(last_pos);\n return result;\n}\n\n\nfunction translate_update_expression(update_expression, input_variables_map, string_literals, indent) {\n let first_assignment = str_strip(update_expression.split('=')[0]);\n let first_assignment_error = `Unable to parse \"UPDATE\" expression: the expression must start with assignment, but \"${first_assignment}\" does not look like an assignable field name`;\n\n let assignment_looking_rgx = /(?:^|,) *(a[.#a-zA-Z0-9\\[\\]_]*) *=(?=[^=])/g;\n let update_expressions = [];\n let pos = 0;\n while (true) {\n let match = assignment_looking_rgx.exec(update_expression);\n if (update_expressions.length == 0 && (match === null || match.index != 0)) {\n throw new RbqlParsingError(first_assignment_error);\n }\n if (match === null) {\n update_expressions[update_expressions.length - 1] += str_strip(update_expression.substr(pos)) + ');';\n break;\n }\n if (update_expressions.length)\n update_expressions[update_expressions.length - 1] += str_strip(update_expression.substring(pos, match.index)) + ');';\n let dst_var_name = combine_string_literals(str_strip(match[1]), string_literals);\n if (!input_variables_map.hasOwnProperty(dst_var_name))\n throw new RbqlParsingError(`Unable to parse \"UPDATE\" expression: Unknown field name: \"${dst_var_name}\"`);\n let var_index = input_variables_map[dst_var_name].index;\n let current_indent = update_expressions.length ? indent : '';\n update_expressions.push(`${current_indent}safe_set(up_fields, ${var_index}, `);\n pos = match.index + match[0].length;\n }\n return combine_string_literals(update_expressions.join('\\n'), string_literals);\n}\n\n\nfunction translate_select_expression(select_expression) {\n let expression_without_stars = replace_star_count(select_expression);\n let translated = str_strip(replace_star_vars(expression_without_stars));\n let translated_for_header = str_strip(replace_star_vars_for_header_parsing(expression_without_stars));\n if (!translated.length)\n throw new RbqlParsingError('\"SELECT\" expression is empty');\n return [`[].concat([${translated}])`, translated_for_header];\n}\n\n\nfunction separate_string_literals(rbql_expression) {\n // The regex consists of 3 almost identicall parts, the only difference is quote type\n var rgx = /('(\\\\(\\\\\\\\)*'|[^'])*')|(\"(\\\\(\\\\\\\\)*\"|[^\"])*\")|(`(\\\\(\\\\\\\\)*`|[^`])*`)/g;\n var match_obj = null;\n var format_parts = [];\n var string_literals = [];\n var idx_before = 0;\n while((match_obj = rgx.exec(rbql_expression)) !== null) {\n var literal_id = string_literals.length;\n var string_literal = match_obj[0];\n string_literals.push(string_literal);\n var start_index = match_obj.index;\n format_parts.push(rbql_expression.substring(idx_before, start_index));\n format_parts.push(`___RBQL_STRING_LITERAL${literal_id}___`);\n idx_before = rgx.lastIndex;\n }\n format_parts.push(rbql_expression.substring(idx_before));\n var format_expression = format_parts.join('');\n format_expression = format_expression.replace(/\\t/g, ' ');\n return [format_expression, string_literals];\n}\n\n\nfunction locate_statements(rbql_expression) {\n let statement_groups = [];\n statement_groups.push([STRICT_LEFT_JOIN, LEFT_OUTER_JOIN, LEFT_JOIN, INNER_JOIN, JOIN]);\n statement_groups.push([SELECT]);\n statement_groups.push([ORDER_BY]);\n statement_groups.push([WHERE]);\n statement_groups.push([UPDATE]);\n statement_groups.push([GROUP_BY]);\n statement_groups.push([LIMIT]);\n statement_groups.push([EXCEPT]);\n var result = [];\n for (var ig = 0; ig < statement_groups.length; ig++) {\n for (var is = 0; is < statement_groups[ig].length; is++) {\n var statement = statement_groups[ig][is];\n var rgxp = new RegExp('(?:^| )' + replace_all(statement, ' ', ' *') + '(?= )', 'ig');\n var matches = get_all_matches(rgxp, rbql_expression);\n if (!matches.length)\n continue;\n if (matches.length > 1)\n throw new RbqlParsingError(`More than one \"${statement}\" statements found`);\n assert(matches.length == 1);\n var match = matches[0];\n var match_str = match[0];\n result.push([match.index, match.index + match_str.length, statement]);\n break; // Break to avoid matching a sub-statement from the same group e.g. \"INNER JOIN\" -> \"JOIN\"\n }\n }\n result.sort(function(a, b) { return a[0] - b[0]; });\n return result;\n}\n\n\nfunction separate_actions(rbql_expression) {\n rbql_expression = str_strip(rbql_expression);\n var result = {};\n let with_match = /^(.*) *[Ww][Ii][Tt][Hh] *\\(([a-z]{4,20})\\) *$/.exec(rbql_expression);\n if (with_match !== null) {\n rbql_expression = with_match[1];\n result[WITH] = with_match[2];\n }\n var ordered_statements = locate_statements(rbql_expression);\n for (var i = 0; i < ordered_statements.length; i++) {\n var statement_start = ordered_statements[i][0];\n var span_start = ordered_statements[i][1];\n var statement = ordered_statements[i][2];\n var span_end = i + 1 < ordered_statements.length ? ordered_statements[i + 1][0] : rbql_expression.length;\n assert(statement_start < span_start);\n assert(span_start <= span_end);\n var span = rbql_expression.substring(span_start, span_end);\n var statement_params = {};\n if ([STRICT_LEFT_JOIN, LEFT_OUTER_JOIN, LEFT_JOIN, INNER_JOIN, JOIN].indexOf(statement) != -1) {\n statement_params['join_subtype'] = statement;\n statement = JOIN;\n }\n\n if (statement == UPDATE) {\n if (statement_start != 0)\n throw new RbqlParsingError('UPDATE keyword must be at the beginning of the query');\n span = span.replace(/^ *SET/i, '');\n }\n\n if (statement == ORDER_BY) {\n span = span.replace(/ ASC *$/i, '');\n var new_span = span.replace(/ DESC *$/i, '');\n if (new_span != span) {\n span = new_span;\n statement_params['reverse'] = true;\n } else {\n statement_params['reverse'] = false;\n }\n }\n\n if (statement == SELECT) {\n if (statement_start != 0)\n throw new RbqlParsingError('SELECT keyword must be at the beginning of the query');\n let match = /^ *TOP *([0-9]+) /i.exec(span);\n if (match !== null) {\n statement_params['top'] = parseInt(match[1]);\n span = span.substr(match.index + match[0].length);\n }\n match = /^ *DISTINCT *(COUNT)? /i.exec(span);\n if (match !== null) {\n statement_params['distinct'] = true;\n if (match[1]) {\n statement_params['distinct_count'] = true;\n }\n span = span.substr(match.index + match[0].length);\n }\n }\n statement_params['text'] = str_strip(span);\n result[statement] = statement_params;\n }\n if (!result.hasOwnProperty(SELECT) && !result.hasOwnProperty(UPDATE)) {\n throw new RbqlParsingError('Query must contain either SELECT or UPDATE statement');\n }\n assert(result.hasOwnProperty(SELECT) != result.hasOwnProperty(UPDATE));\n return result;\n}\n\n\nfunction find_top(rb_actions) {\n if (rb_actions.hasOwnProperty(LIMIT)) {\n var rgx = /^[0-9]+$/;\n if (rgx.exec(rb_actions[LIMIT]['text']) === null) {\n throw new RbqlParsingError('LIMIT keyword must be followed by an integer');\n }\n var result = parseInt(rb_actions[LIMIT]['text']);\n return result;\n }\n var select_action = rb_actions[SELECT];\n if (select_action && select_action.hasOwnProperty('top')) {\n return select_action['top'];\n }\n return null;\n}\n\n\nfunction translate_except_expression(except_expression, input_variables_map, string_literals, input_header) {\n let skip_vars = except_expression.split(',');\n skip_vars = skip_vars.map(str_strip);\n let skip_indices = [];\n for (let var_name of skip_vars) {\n var_name = combine_string_literals(var_name, string_literals);\n if (!input_variables_map.hasOwnProperty(var_name))\n throw new RbqlParsingError(`Unknown field in EXCEPT expression: \"${var_name}\"`);\n skip_indices.push(input_variables_map[var_name].index);\n }\n skip_indices = skip_indices.sort((a, b) => a - b);\n let output_header = input_header === null ? null : select_except(input_header, skip_indices);\n let indices_str = skip_indices.join(',');\n return [output_header, `select_except(record_a, [${indices_str}])`];\n}\n\n\nclass HashJoinMap {\n constructor(record_iterator, key_indices) {\n this.max_record_len = 0;\n this.hash_map = new Map();\n this.record_iterator = record_iterator;\n this.nr = 0;\n if (key_indices.length == 1) {\n this.key_index = key_indices[0];\n this.key_indices = null;\n this.polymorphic_get_key = this.get_single_key;\n } else {\n this.key_index = null;\n this.key_indices = key_indices;\n this.polymorphic_get_key = this.get_multi_key;\n }\n }\n\n get_single_key(nr, fields) {\n if (this.key_index >= fields.length)\n throw new RbqlRuntimeError(`No field with index ${this.key_index + 1} at record ${this.nr} in \"B\" table`);\n return this.key_index === -1 ? this.nr : fields[this.key_index];\n };\n\n get_multi_key(nr, fields) {\n let result = [];\n for (let ki of this.key_indices) {\n if (ki >= fields.length)\n throw new RbqlRuntimeError(`No field with index ${ki + 1} at record ${this.nr} in \"B\" table`);\n result.push(ki === -1 ? this.nr : fields[ki]);\n }\n return JSON.stringify(result);\n };\n\n async build() {\n while (true) {\n let fields = await this.record_iterator.get_record();\n if (fields === null)\n break;\n this.nr += 1;\n let nf = fields.length;\n this.max_record_len = Math.max(this.max_record_len, nf);\n let key = this.polymorphic_get_key(this.nr, fields);\n let key_records = this.hash_map.get(key);\n if (key_records === undefined) {\n this.hash_map.set(key, [[this.nr, nf, fields]]);\n } else {\n key_records.push([this.nr, nf, fields]);\n }\n }\n };\n\n get_join_records(key) {\n let result = this.hash_map.get(key);\n if (result === undefined)\n return [];\n return result;\n };\n\n get_warnings() {\n return this.record_iterator.get_warnings();\n };\n}\n\n\nfunction cleanup_query(query_text) {\n return query_text.split('\\n').map(strip_comments).filter(line => line.length).join(' ').replace(/;+$/g, '');\n}\n\n\nfunction remove_redundant_table_name(query_text) {\n query_text = str_strip(query_text.replace(/ +from +a(?: +|$)/gi, ' '));\n query_text = str_strip(query_text.replace(/^ *update +a +set /gi, 'update '));\n return query_text;\n}\n\n\nfunction select_output_header(input_header, join_header, query_column_infos) {\n if (input_header === null && join_header === null)\n return null;\n if (input_header === null)\n input_header = [];\n if (join_header === null)\n join_header = [];\n let output_header = [];\n for (let qci of query_column_infos) {\n // TODO refactor this and python version: extract this code into a function instead to always return something\n if (qci === null) {\n output_header.push('col' + (output_header.length + 1));\n } else if (qci.is_star) {\n if (qci.table_name === null) {\n output_header = output_header.concat(input_header).concat(join_header);\n } else if (qci.table_name === 'a') {\n output_header = output_header.concat(input_header);\n } else if (qci.table_name === 'b') {\n output_header = output_header.concat(join_header);\n }\n } else if (qci.column_name !== null) {\n output_header.push(qci.column_name);\n } else if (qci.column_index !== null) {\n if (qci.table_name == 'a' && qci.column_index < input_header.length) {\n output_header.push(input_header[qci.column_index]);\n } else if (qci.table_name == 'b' && qci.column_index < join_header.length) {\n output_header.push(join_header[qci.column_index]);\n } else {\n output_header.push('col' + (output_header.length + 1));\n }\n } else { // Should never happen\n output_header.push('col' + (output_header.length + 1));\n }\n }\n return output_header;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\nclass RBQLInputIterator {\n constructor(){}\n stop() {\n throw new Error(\"Unable to call the interface method\");\n }\n async get_variables_map(query_text) {\n throw new Error(\"Unable to call the interface method\");\n }\n async get_record() {\n throw new Error(\"Unable to call the interface method\");\n }\n handle_query_modifier() {\n return; // Reimplement if you need to handle a boolean query modifier that can be used like this: `SELECT * WITH (modifiername)`\n }\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n }\n async get_header() {\n return null; // Reimplement if your class can provide input header\n }\n}\n\n\nclass RBQLOutputWriter {\n constructor(){}\n\n async write(fields) {\n throw new Error(\"Unable to call the interface method\");\n }\n\n async finish() {\n // Reimplement if your class needs to do something on finish e.g. cleanup\n };\n\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n };\n\n set_header() {\n return; // Reimplement if your class can handle output headers in a meaningful way\n }\n}\n\n\nclass RBQLTableRegistry {\n constructor(){}\n\n get_iterator_by_table_id(table_id) {\n throw new Error(\"Unable to call the interface method\");\n }\n\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n };\n}\n\n\nclass TableIterator extends RBQLInputIterator {\n constructor(table, column_names=null, normalize_column_names=true, variable_prefix='a') {\n super();\n this.table = table;\n this.column_names = column_names;\n this.normalize_column_names = normalize_column_names;\n this.variable_prefix = variable_prefix;\n this.nr = 0;\n this.fields_info = new Object();\n this.stopped = false;\n }\n\n\n stop() {\n this.stopped = true;\n };\n\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n parse_basic_variables(query_text, this.variable_prefix, variable_map);\n parse_array_variables(query_text, this.variable_prefix, variable_map);\n if (this.column_names !== null) {\n if (this.table.length && this.column_names.length != this.table[0].length)\n throw new RbqlIOHandlingError('List of column names and table records have different lengths');\n if (this.normalize_column_names) {\n parse_dictionary_variables(query_text, this.variable_prefix, this.column_names, variable_map);\n parse_attribute_variables(query_text, this.variable_prefix, this.column_names, 'column names list', variable_map);\n } else {\n map_variables_directly(query_text, this.column_names, variable_map);\n }\n }\n return variable_map;\n };\n\n\n async get_record() {\n if (this.stopped)\n return null;\n if (this.nr >= this.table.length)\n return null;\n let record = this.table[this.nr];\n this.nr += 1;\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.nr;\n return record;\n };\n\n get_warnings() {\n if (Object.keys(this.fields_info).length > 1)\n return [make_inconsistent_num_fields_warning('input', this.fields_info)];\n return [];\n };\n\n async get_header() {\n return this.column_names;\n }\n}\n\n\nclass TableWriter extends RBQLOutputWriter {\n constructor(external_table) {\n super();\n this.table = external_table;\n this.header = null;\n }\n\n async write(fields) {\n this.table.push(fields);\n return true;\n };\n\n set_header(header) {\n this.header = header;\n }\n}\n\n\nclass SingleTableRegistry extends RBQLTableRegistry {\n constructor(table, column_names=null, normalize_column_names=true, table_id='b') {\n super();\n this.table = table;\n this.table_id = table_id;\n this.column_names = column_names;\n this.normalize_column_names = normalize_column_names;\n }\n\n get_iterator_by_table_id(table_id) {\n if (table_id.toLowerCase() !== this.table_id)\n throw new RbqlIOHandlingError(`Unable to find join table: \"${table_id}\"`);\n return new TableIterator(this.table, this.column_names, this.normalize_column_names, 'b');\n };\n}\n\n\nasync function shallow_parse_input_query(query_text, input_iterator, join_tables_registry, query_context) {\n query_text = cleanup_query(query_text);\n var [format_expression, string_literals] = separate_string_literals(query_text);\n format_expression = remove_redundant_table_name(format_expression);\n\n var rb_actions = separate_actions(format_expression);\n if (rb_actions.hasOwnProperty(WITH)) {\n input_iterator.handle_query_modifier(rb_actions[WITH]);\n }\n var input_variables_map = await input_iterator.get_variables_map(query_text);\n\n if (rb_actions.hasOwnProperty(ORDER_BY) && rb_actions.hasOwnProperty(UPDATE))\n throw new RbqlParsingError('\"ORDER BY\" is not allowed in \"UPDATE\" queries');\n\n if (rb_actions.hasOwnProperty(GROUP_BY)) {\n if (rb_actions.hasOwnProperty(ORDER_BY) || rb_actions.hasOwnProperty(UPDATE))\n throw new RbqlParsingError('\"ORDER BY\", \"UPDATE\" and \"DISTINCT\" keywords are not allowed in aggregate queries');\n query_context.aggregation_key_expression = '[' + combine_string_literals(rb_actions[GROUP_BY]['text'], string_literals) + ']';\n }\n\n let join_variables_map = null;\n let join_header = null;\n if (rb_actions.hasOwnProperty(JOIN)) {\n var [rhs_table_id, variable_pairs] = parse_join_expression(rb_actions[JOIN]['text']);\n if (join_tables_registry === null)\n throw new RbqlParsingError('JOIN operations are not supported by the application');\n let join_record_iterator = join_tables_registry.get_iterator_by_table_id(rhs_table_id);\n if (!join_record_iterator)\n throw new RbqlParsingError(`Unable to find join table: \"${rhs_table_id}\"`);\n if (rb_actions.hasOwnProperty(WITH)) {\n join_record_iterator.handle_query_modifier(rb_actions[WITH]);\n }\n join_variables_map = await join_record_iterator.get_variables_map(query_text);\n join_header = await join_record_iterator.get_header();\n let [lhs_variables, rhs_indices] = resolve_join_variables(input_variables_map, join_variables_map, variable_pairs, string_literals);\n let sql_join_type = {'JOIN': InnerJoiner, 'INNER JOIN': InnerJoiner, 'LEFT JOIN': LeftJoiner, 'LEFT OUTER JOIN': LeftJoiner, 'STRICT LEFT JOIN': StrictLeftJoiner}[rb_actions[JOIN]['join_subtype']];\n query_context.lhs_join_var_expression = lhs_variables.length == 1 ? lhs_variables[0] : 'JSON.stringify([' + lhs_variables.join(',') + '])';\n query_context.join_map_impl = new HashJoinMap(join_record_iterator, rhs_indices);\n await query_context.join_map_impl.build();\n query_context.join_map = new sql_join_type(query_context.join_map_impl);\n }\n\n query_context.variables_init_code = combine_string_literals(generate_init_statements(format_expression, input_variables_map, join_variables_map, ' '.repeat(4)), string_literals);\n\n if (rb_actions.hasOwnProperty(WHERE)) {\n var where_expression = rb_actions[WHERE]['text'];\n if (/[^>= 3 && line.charCodeAt(0) === 0xEF && line.charCodeAt(1) === 0xBB && line.charCodeAt(2) === 0xBF) {\n return line.substring(3);\n }\n if (assumed_source_encoding == 'utf-8' && line.length >= 1 && line.charCodeAt(0) === 0xFEFF) {\n return line.substring(1);\n }\n return line;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\nfunction expanduser(filepath) {\n if (filepath.charAt(0) === '~') {\n return path.join(os.homedir(), filepath.slice(1));\n }\n return filepath;\n}\n\n\nfunction try_read_index(index_path) {\n var content = null;\n try {\n content = fs.readFileSync(index_path, 'utf-8');\n } catch (e) {\n return [];\n }\n var lines = content.split('\\n');\n var records = [];\n for (var i = 0; i < lines.length; i++) {\n if (!lines[i])\n continue;\n var record = lines[i].split('\\t');\n records.push(record);\n }\n return records;\n}\n\n\nfunction get_index_record(index_path, key) {\n var records = try_read_index(index_path);\n for (var i = 0; i < records.length; i++) {\n if (records[i].length && records[i][0] == key) {\n return records[i];\n }\n }\n return null;\n}\n\n\nfunction find_table_path(main_table_dir, table_id) {\n // If table_id is a relative path it could be relative either to the current directory or to the main table dir.\n var candidate_path = expanduser(table_id);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n if (main_table_dir && !path.isAbsolute(candidate_path)) {\n candidate_path = path.join(main_table_dir, candidate_path);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n }\n let table_names_settings_path = path.join(os.homedir(), '.rbql_table_names');\n var name_record = get_index_record(table_names_settings_path, table_id);\n if (name_record && name_record.length > 1 && fs.existsSync(name_record[1])) {\n return name_record[1];\n }\n return null;\n}\n\n\nclass RecordQueue {\n // TODO compare performance with a linked list\n constructor() {\n this.push_stack = [];\n this.pull_stack = [];\n }\n\n enqueue(record) {\n this.push_stack.push(record);\n }\n\n dequeue() {\n if (!this.pull_stack.length) {\n if (!this.push_stack.length)\n return null;\n this.pull_stack = this.push_stack;\n this.pull_stack.reverse();\n this.push_stack = [];\n }\n return this.pull_stack.pop();\n }\n}\n\n\nclass CSVRecordIterator extends rbql.RBQLInputIterator {\n // CSVRecordIterator implements a typical async producer-consumer model with an internal buffer:\n // get_record() - consumer\n // stream.on('data') - producer\n constructor(stream, csv_path, encoding, delim, policy, has_header=false, comment_prefix=null, table_name='input', variable_prefix='a') {\n super();\n this.stream = stream;\n this.csv_path = csv_path;\n assert((this.stream === null) != (this.csv_path === null));\n this.encoding = encoding;\n this.delim = delim;\n this.policy = policy;\n\n this.has_header = has_header;\n this.first_record = null;\n this.first_record_should_be_emitted = !has_header;\n this.header_preread_complete = false;\n\n this.table_name = table_name;\n this.variable_prefix = variable_prefix;\n this.comment_prefix = (comment_prefix !== null && comment_prefix.length) ? comment_prefix : null;\n\n this.decoder = null;\n if (encoding == 'utf-8' && this.csv_path === null) {\n // Unfortunately util.TextDecoder has serious flaws:\n // 1. It doesn't work in Node without ICU: https://nodejs.org/api/util.html#util_new_textdecoder_encoding_options\n // 2. It is broken in Electron: https://github.com/electron/electron/issues/18733\n\n // Technically we can implement our own custom streaming text decoder, using the 3 following technologies:\n // 1. decode-encode validation method from https://stackoverflow.com/a/32279283/2898283\n // 2. Scanning buffer chunks for non-continuation utf-8 bytes from the end of the buffer:\n // src_buffer -> (buffer_before, buffer_after) where buffer_after is very small(a couple of bytes) and buffer_before is large and ends with a non-continuation bytes\n // 3. Internal buffer to store small tail part from the previous buffer\n this.decoder = new util.TextDecoder(encoding, {fatal: true, stream: true});\n }\n\n this.input_exhausted = false;\n this.started = false;\n\n this.utf8_bom_removed = false; // BOM doesn't get automatically removed by the decoder when utf-8 file is treated as latin-1\n this.first_defective_line = null;\n\n this.fields_info = new Object();\n this.NR = 0; // Record number\n this.NL = 0; // Line number (NL != NR when the CSV file has comments or multiline fields)\n\n this.rfc_line_buffer = [];\n\n this.partially_decoded_line = '';\n this.partially_decoded_line_ends_with_cr = false;\n\n // Holds an external \"resolve\" function which is called when everything is fine.\n this.resolve_current_record = null;\n // Holds an external \"reject\" function which is called when error has occured.\n this.reject_current_record = null;\n // Holds last exception if we don't have any reject callbacks from clients yet.\n this.current_exception = null;\n\n this.produced_records_queue = new RecordQueue();\n\n this.process_line_polymorphic = policy == 'quoted_rfc' ? this.process_partial_rfc_record_line : this.process_record_line;\n }\n\n\n handle_query_modifier(modifier) {\n // For `... WITH (header) ...` syntax\n if (['header', 'headers'].indexOf(modifier) != -1) {\n this.has_header = true;\n this.first_record_should_be_emitted = false;\n }\n if (['noheader', 'noheaders'].indexOf(modifier) != -1) {\n this.has_header = false;\n this.first_record_should_be_emitted = true;\n }\n }\n\n\n reset_external_callbacks() {\n // Drop external callbacks simultaneously since promises can only resolve once, see: https://stackoverflow.com/a/18218542/2898283\n this.reject_current_record = null;\n this.resolve_current_record = null;\n }\n\n try_propagate_exception() {\n if (this.current_exception && this.reject_current_record) {\n let reject = this.reject_current_record;\n let exception = this.current_exception;\n this.reset_external_callbacks();\n this.current_exception = null;\n reject(exception);\n }\n }\n\n\n store_or_propagate_exception(exception) {\n if (this.current_exception === null)\n // Ignore subsequent exceptions if we already have an unreported error. This way we prioritize earlier errors over the more recent ones.\n this.current_exception = exception;\n this.try_propagate_exception();\n }\n\n\n async preread_first_record() {\n if (this.header_preread_complete)\n return;\n this.first_record = await this.get_record();\n this.header_preread_complete = true; // We must set header_preread_complete to true after calling get_record(), because get_record() uses it internally.\n if (this.first_record === null) {\n return;\n }\n if (this.stream)\n this.stream.pause();\n this.first_record = this.first_record.slice();\n };\n\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n rbql.parse_basic_variables(query_text, this.variable_prefix, variable_map);\n rbql.parse_array_variables(query_text, this.variable_prefix, variable_map);\n\n await this.preread_first_record();\n if (this.has_header && this.first_record) {\n rbql.parse_attribute_variables(query_text, this.variable_prefix, this.first_record, 'CSV header line', variable_map);\n rbql.parse_dictionary_variables(query_text, this.variable_prefix, this.first_record, variable_map);\n }\n return variable_map;\n };\n\n async get_header() {\n await this.preread_first_record();\n return this.has_header ? this.first_record : null;\n }\n\n\n try_resolve_next_record() {\n this.try_propagate_exception();\n if (this.resolve_current_record === null)\n return;\n\n let record = null;\n if (this.first_record_should_be_emitted && this.header_preread_complete) {\n this.first_record_should_be_emitted = false;\n record = this.first_record;\n } else {\n record = this.produced_records_queue.dequeue();\n }\n\n if (record === null && !this.input_exhausted)\n return;\n let resolve = this.resolve_current_record;\n this.reset_external_callbacks();\n resolve(record);\n };\n\n\n async get_record() {\n if (!this.started)\n await this.start();\n if (this.stream && this.stream.isPaused())\n this.stream.resume();\n\n let parent_iterator = this;\n let current_record_promise = new Promise(function(resolve, reject) {\n parent_iterator.resolve_current_record = resolve;\n parent_iterator.reject_current_record = reject;\n });\n this.try_resolve_next_record();\n return current_record_promise;\n };\n\n\n async get_all_records(num_records=null) {\n let records = [];\n while (true) {\n let record = await this.get_record();\n if (record === null)\n break;\n records.push(record);\n if (num_records && records.length >= num_records) {\n this.stop();\n break;\n }\n }\n return records;\n };\n\n\n process_record_line(line) {\n if (this.comment_prefix !== null && line.startsWith(this.comment_prefix))\n return; // Just skip the line\n this.NR += 1;\n var [record, warning] = csv_utils.smart_split(line, this.delim, this.policy, false);\n if (warning) {\n if (this.first_defective_line === null) {\n this.first_defective_line = this.NL;\n if (this.policy == 'quoted_rfc')\n this.store_or_propagate_exception(new RbqlIOHandlingError(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`));\n }\n }\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.NR;\n this.produced_records_queue.enqueue(record);\n this.try_resolve_next_record();\n };\n\n\n process_partial_rfc_record_line(line) {\n let record_line = csv_utils.accumulate_rfc_line_into_record(this.rfc_line_buffer, line, this.comment_prefix);\n if (record_line !== null)\n this.process_record_line(record_line);\n };\n\n\n process_line(line) {\n this.NL += 1;\n if (this.NL === 1) {\n var clean_line = remove_utf8_bom(line, this.encoding);\n if (clean_line != line) {\n line = clean_line;\n this.utf8_bom_removed = true;\n }\n }\n this.process_line_polymorphic(line);\n };\n\n\n process_data_stream_chunk(data_chunk) {\n let decoded_string = null;\n if (this.decoder) {\n try {\n decoded_string = this.decoder.decode(data_chunk);\n } catch (e) {\n if (e instanceof TypeError) {\n this.store_or_propagate_exception(new RbqlIOHandlingError(utf_decoding_error));\n } else {\n this.store_or_propagate_exception(e);\n }\n return;\n }\n } else {\n decoded_string = data_chunk.toString(this.encoding);\n }\n let line_starts_with_lf = decoded_string.length && decoded_string[0] == '\\n';\n let first_line_index = line_starts_with_lf && this.partially_decoded_line_ends_with_cr ? 1 : 0;\n this.partially_decoded_line_ends_with_cr = decoded_string.length && decoded_string[decoded_string.length - 1] == '\\r';\n let lines = csv_utils.split_lines(decoded_string);\n lines[0] = this.partially_decoded_line + lines[0];\n assert(first_line_index == 0 || lines[0].length == 0);\n this.partially_decoded_line = lines.pop();\n for (let i = first_line_index; i < lines.length; i++) {\n this.process_line(lines[i]);\n }\n };\n\n\n process_data_bulk(data_chunk) {\n let decoded_string = data_chunk.toString(this.encoding);\n if (this.encoding == 'utf-8') {\n // Using hacky comparison method from here: https://stackoverflow.com/a/32279283/2898283\n // TODO get rid of this once TextDecoder is really fixed or when alternative method of reliable decoding appears\n let control_buffer = Buffer.from(decoded_string, 'utf-8');\n if (Buffer.compare(data_chunk, control_buffer) != 0) {\n this.store_or_propagate_exception(new RbqlIOHandlingError(utf_decoding_error));\n return;\n }\n }\n let lines = csv_utils.split_lines(decoded_string);\n if (lines.length && lines[lines.length - 1].length == 0)\n lines.pop();\n for (let i = 0; i < lines.length; i++) {\n this.process_line(lines[i]);\n }\n if (this.rfc_line_buffer.length > 0) {\n this.process_record_line(this.rfc_line_buffer.join('\\n'));\n }\n this.input_exhausted = true;\n this.try_resolve_next_record(); // Should be a NOOP here?\n }\n\n\n process_data_stream_end() {\n this.input_exhausted = true;\n if (this.partially_decoded_line.length) {\n let last_line = this.partially_decoded_line;\n this.partially_decoded_line = '';\n this.process_line(last_line);\n }\n if (this.rfc_line_buffer.length > 0) {\n this.process_record_line(this.rfc_line_buffer.join('\\n'));\n }\n this.try_resolve_next_record();\n };\n\n\n stop() {\n if (this.stream)\n this.stream.destroy(); // TODO consider using pause() instead\n };\n\n\n async start() {\n if (this.started)\n return;\n this.started = true;\n if (this.stream) {\n this.stream.on('data', (data_chunk) => { this.process_data_stream_chunk(data_chunk); });\n this.stream.on('end', () => { this.process_data_stream_end(); });\n } else {\n let parent_iterator = this;\n return new Promise(function(resolve, reject) {\n fs.readFile(parent_iterator.csv_path, (err, data_chunk) => {\n if (err) {\n reject(err);\n } else {\n parent_iterator.process_data_bulk(data_chunk);\n resolve();\n }\n });\n });\n }\n };\n\n\n get_warnings() {\n let result = [];\n if (this.first_defective_line !== null)\n result.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`);\n if (this.utf8_bom_removed)\n result.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`);\n if (Object.keys(this.fields_info).length > 1)\n result.push(make_inconsistent_num_fields_warning(this.table_name, this.fields_info));\n return result;\n };\n}\n\n\nclass CSVWriter extends rbql.RBQLOutputWriter {\n constructor(stream, close_stream_on_finish, encoding, delim, policy, line_separator='\\n') {\n super();\n this.stream = stream;\n this.encoding = encoding;\n if (encoding)\n this.stream.setDefaultEncoding(encoding);\n this.stream.on('error', (error_obj) => { this.store_first_error(error_obj); })\n this.delim = delim;\n this.policy = policy;\n this.line_separator = line_separator;\n this.sub_array_delim = delim == '|' ? ';' : '|';\n\n this.close_stream_on_finish = close_stream_on_finish;\n\n this.null_in_output = false;\n this.delim_in_simple_output = false;\n this.header_len = null;\n this.first_error = null;\n\n if (policy == 'simple') {\n this.polymorphic_join = this.simple_join;\n } else if (policy == 'quoted') {\n this.polymorphic_join = this.quoted_join;\n } else if (policy == 'quoted_rfc') {\n this.polymorphic_join = this.quoted_join_rfc;\n } else if (policy == 'monocolumn') {\n this.polymorphic_join = this.mono_join;\n } else if (policy == 'whitespace') {\n this.polymorphic_join = this.simple_join;\n } else {\n throw new RbqlIOHandlingError('Unknown output csv policy');\n }\n }\n\n\n store_first_error(error_obj) {\n // Store only first error because it is typically more important than the subsequent ones.\n if (this.first_error === null)\n this.first_error = error_obj;\n }\n\n set_header(header) {\n if (header !== null) {\n this.header_len = header.length;\n this.write(header);\n }\n }\n\n\n quoted_join(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n quoted_join_rfc(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.rfc_quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n mono_join(fields) {\n if (fields.length > 1) {\n throw new RbqlIOHandlingError('Unable to use \"Monocolumn\" output format: some records have more than one field');\n }\n return fields[0];\n };\n\n\n simple_join(fields) {\n var res = fields.join(this.delim);\n if (fields.join('').indexOf(this.delim) != -1) {\n this.delim_in_simple_output = true;\n }\n return res;\n };\n\n\n normalize_fields(out_fields) {\n for (var i = 0; i < out_fields.length; i++) {\n if (out_fields[i] == null) {\n this.null_in_output = true;\n out_fields[i] = '';\n } else if (Array.isArray(out_fields[i])) {\n this.normalize_fields(out_fields[i]);\n out_fields[i] = out_fields[i].join(this.sub_array_delim);\n }\n }\n };\n\n\n async write(fields) {\n if (this.header_len !== null && fields.length != this.header_len)\n throw new RbqlIOHandlingError(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${fields.length}`);\n this.normalize_fields(fields);\n this.stream.write(this.polymorphic_join(fields));\n this.stream.write(this.line_separator);\n let writer_error = this.first_error;\n return new Promise(function(resolve, reject) {\n if (writer_error !== null) {\n reject(writer_error);\n } else {\n resolve(true);\n }\n });\n };\n\n\n _write_all(table) {\n for (let i = 0; i < table.length; i++) {\n this.write(table[i]);\n }\n };\n\n\n async finish() {\n let close_stream_on_finish = this.close_stream_on_finish;\n let output_stream = this.stream;\n let output_encoding = this.encoding;\n let writer_error = this.first_error;\n let finish_promise = new Promise(function(resolve, reject) {\n if (writer_error !== null) {\n reject(writer_error);\n }\n if (close_stream_on_finish) {\n output_stream.end('', output_encoding, () => { resolve(); });\n } else {\n setTimeout(() => { resolve(); }, 0);\n }\n });\n return finish_promise;\n };\n\n\n get_warnings() {\n let result = [];\n if (this.null_in_output)\n result.push('null values in output were replaced by empty strings');\n if (this.delim_in_simple_output)\n result.push('Some output fields contain separator');\n return result;\n };\n\n}\n\n\nclass FileSystemCSVRegistry extends rbql.RBQLTableRegistry {\n constructor(input_file_dir, delim, policy, encoding, has_header=false, comment_prefix=null, options=null) {\n super();\n this.input_file_dir = input_file_dir;\n this.delim = delim;\n this.policy = policy;\n this.encoding = encoding;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.stream = null;\n this.record_iterator = null;\n\n this.options = options;\n this.bulk_input_path = null;\n this.table_path = null;\n }\n\n get_iterator_by_table_id(table_id) {\n this.table_path = find_table_path(this.input_file_dir, table_id);\n if (this.table_path === null) {\n throw new RbqlIOHandlingError(`Unable to find join table \"${table_id}\"`);\n }\n if (this.options && this.options['bulk_read']) {\n this.bulk_input_path = this.table_path;\n } else {\n this.stream = fs.createReadStream(this.table_path);\n }\n this.record_iterator = new CSVRecordIterator(this.stream, this.bulk_input_path, this.encoding, this.delim, this.policy, this.has_header, this.comment_prefix, table_id, 'b');\n return this.record_iterator;\n };\n\n get_warnings(output_warnings) {\n if (this.record_iterator && this.has_header) {\n output_warnings.push(`The first record in JOIN file ${path.basename(this.table_path)} was also treated as header (and skipped)`);\n }\n }\n}\n\n\nasync function query_csv(query_text, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, output_warnings, with_headers=false, comment_prefix=null, user_init_code='', options=null) {\n let input_stream = null;\n let bulk_input_path = null;\n if (options && options['bulk_read'] && input_path) {\n bulk_input_path = input_path;\n } else {\n input_stream = input_path === null ? process.stdin : fs.createReadStream(input_path);\n }\n let [output_stream, close_output_on_finish] = output_path === null ? [process.stdout, false] : [fs.createWriteStream(output_path), true];\n if (input_delim == '\"' && input_policy == 'quoted')\n throw new RbqlIOHandlingError('Double quote delimiter is incompatible with \"quoted\" policy');\n if (csv_encoding == 'latin-1')\n csv_encoding = 'binary';\n if (!is_ascii(query_text) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n if ((!is_ascii(input_delim) || !is_ascii(output_delim)) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n\n let default_init_source_path = path.join(os.homedir(), '.rbql_init_source.js');\n if (user_init_code == '' && fs.existsSync(default_init_source_path)) {\n user_init_code = read_user_init_code(default_init_source_path);\n }\n let input_file_dir = input_path ? path.dirname(input_path) : null;\n let join_tables_registry = new FileSystemCSVRegistry(input_file_dir, input_delim, input_policy, csv_encoding, with_headers, comment_prefix, options);\n let input_iterator = new CSVRecordIterator(input_stream, bulk_input_path, csv_encoding, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new CSVWriter(output_stream, close_output_on_finish, csv_encoding, output_delim, output_policy);\n\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n join_tables_registry.get_warnings(output_warnings);\n}\n\n\nmodule.exports.is_ascii = is_ascii;\nmodule.exports.CSVRecordIterator = CSVRecordIterator;\nmodule.exports.CSVWriter = CSVWriter;\nmodule.exports.FileSystemCSVRegistry = FileSystemCSVRegistry;\nmodule.exports.interpret_named_csv_format = interpret_named_csv_format;\nmodule.exports.read_user_init_code = read_user_init_code;\nmodule.exports.query_csv = query_csv;\nmodule.exports.RecordQueue = RecordQueue;\nmodule.exports.exception_to_error_info = rbql.exception_to_error_info;\n","module.exports = require(\"vscode\");","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","const vscode = require('vscode');\n\nconst path = require('path');\nconst fs = require('fs');\nconst os = require('os');\nconst child_process = require('child_process');\n\n// Please see DEV_README.md file for additional info.\n\nconst csv_utils = require('./rbql_core/rbql-js/csv_utils.js');\n\nvar rbql_csv = null; // Using lazy load to improve startup performance.\nfunction ll_rbql_csv() {\n if (rbql_csv === null)\n rbql_csv = require('./rbql_core/rbql-js/rbql_csv.js');\n return rbql_csv;\n}\n\n\nvar rainbow_utils = null; // Using lazy load to improve startup performance.\nfunction ll_rainbow_utils() {\n if (rainbow_utils === null)\n rainbow_utils = require('./rainbow_utils.js');\n return rainbow_utils;\n}\n\n\nconst is_web_ext = (os.homedir === undefined); // Runs as web extension in browser.\nconst preview_window_size = 100;\nconst max_preview_field_length = 250;\nconst scratch_buf_marker = 'vscode_rbql_scratch';\n\nlet client_html_template_web = null;\n\nvar lint_results = new Map();\nvar aligned_files = new Set();\nvar autodetection_stoplist = new Set();\nvar original_language_ids = new Map();\nvar result_set_parent_map = new Map();\n\nvar lint_status_bar_button = null;\nvar rbql_status_bar_button = null;\nvar align_shrink_button = null;\nvar rainbow_off_status_bar_button = null;\nvar copy_back_button = null;\n\nlet last_statusbar_doc = null;\n\nvar rbql_context = null;\n\nvar last_rbql_queries = new Map(); // Query history does not replace this structure, it is also used to store partially entered queries for preview window switch.\n\nvar client_html_template = null;\n\nvar global_state = null;\n\nvar preview_panel = null;\n\nvar doc_edit_subscription = null;\n\nvar _unit_test_last_rbql_report = null; // For unit tests only.\nvar _unit_test_last_warnings = null; // For unit tests only.\n\nconst dialect_map = {\n 'csv': [',', 'quoted'],\n 'tsv': ['\\t', 'simple'],\n 'csv (semicolon)': [';', 'quoted'],\n 'csv (pipe)': ['|', 'simple'],\n 'csv (tilde)': ['~', 'simple'],\n 'csv (caret)': ['^', 'simple'],\n 'csv (colon)': [':', 'simple'],\n 'csv (double quote)': ['\"', 'simple'],\n 'csv (equals)': ['=', 'simple'],\n 'csv (dot)': ['.', 'simple'],\n 'csv (whitespace)': [' ', 'whitespace'],\n 'csv (hyphen)': ['-', 'simple']\n};\n\n\n// This structure will get properly initialized during the startup.\nlet absolute_path_map = {\n 'rbql_client.js': null,\n 'contrib/textarea-caret-position/index.js': null,\n 'rbql_suggest.js': null,\n 'rbql_logo.svg': null,\n 'rbql_client.html': null,\n 'rbql mock/rbql_mock.py': null,\n 'rbql_core/vscode_rbql.py': null\n};\n\n\nfunction show_single_line_error(error_msg) {\n var active_window = vscode.window;\n if (!active_window)\n return;\n // Do not \"await\" error messages because the promise gets resolved only on error dismissal.\n active_window.showErrorMessage(error_msg);\n}\n\n\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n\nfunction map_separator_to_language_id(separator) {\n for (let language_id in dialect_map) {\n if (!dialect_map.hasOwnProperty(language_id))\n continue;\n if (dialect_map[language_id][0] == separator)\n return language_id;\n }\n return null;\n}\n\n\nfunction get_from_global_state(key, default_value) {\n if (global_state) {\n var value = global_state.get(key);\n if (value !== null && value !== undefined)\n return value;\n }\n return default_value;\n}\n\n\nasync function save_to_global_state(key, value) {\n if (global_state && key) {\n await global_state.update(key, value);\n return true;\n }\n return false;\n}\n\n\nfunction get_rfc_record_text(document, record_start, record_end) {\n let result = [];\n for (let i = record_start; i < record_end && i < document.lineCount; i++) {\n result.push(document.lineAt(i).text);\n }\n return result.join('\\n');\n}\n\n\nfunction sample_preview_records_from_context(rbql_context, dst_message) {\n let document = rbql_context.input_document;\n let delim = rbql_context.delim;\n let policy = rbql_context.policy;\n\n rbql_context.requested_start_record = Math.max(rbql_context.requested_start_record, 0);\n\n let preview_records = [];\n if (rbql_context.enable_rfc_newlines) {\n let requested_end_record = rbql_context.requested_start_record + preview_window_size;\n ll_rainbow_utils().populate_optimistic_rfc_csv_record_map(document, requested_end_record, rbql_context.rfc_record_map);\n rbql_context.requested_start_record = Math.max(0, Math.min(rbql_context.requested_start_record, rbql_context.rfc_record_map.length - preview_window_size));\n for (let nr = rbql_context.requested_start_record; nr < rbql_context.rfc_record_map.length && preview_records.length < preview_window_size; nr++) {\n let [record_start, record_end] = rbql_context.rfc_record_map[nr];\n let record_text = get_rfc_record_text(document, record_start, record_end);\n let [cur_record, warning] = csv_utils.smart_split(record_text, delim, policy, false);\n if (warning) {\n dst_message.preview_sampling_error = `Double quotes are not consistent in record ${nr + 1} which starts at line ${record_start + 1}`;\n return;\n }\n preview_records.push(cur_record);\n }\n } else {\n let num_records = document.lineCount;\n if (document.lineAt(Math.max(num_records - 1, 0)).text == '')\n num_records -= 1;\n rbql_context.requested_start_record = Math.max(0, Math.min(rbql_context.requested_start_record, num_records - preview_window_size));\n for (let nr = rbql_context.requested_start_record; nr < num_records && preview_records.length < preview_window_size; nr++) {\n let line_text = document.lineAt(nr).text;\n let cur_record = csv_utils.smart_split(line_text, delim, policy, false)[0];\n preview_records.push(cur_record);\n }\n }\n\n for (let r = 0; r < preview_records.length; r++) {\n let cur_record = preview_records[r];\n for (let c = 0; c < cur_record.length; c++) {\n if (cur_record[c].length > max_preview_field_length) {\n cur_record[c] = cur_record[c].substr(0, max_preview_field_length) + '###UI_STRING_TRIM_MARKER###';\n }\n }\n }\n dst_message.preview_records = preview_records;\n dst_message.start_record_zero_based = rbql_context.requested_start_record;\n}\n\n\nfunction make_header_key(file_path) {\n return 'rbql_header:' + file_path;\n}\n\n\nfunction make_rfc_policy_key(file_path) {\n return 'enable_rfc_newlines:' + file_path;\n}\n\n\nfunction make_with_headers_key(file_path) {\n return 'rbql_with_headers:' + file_path;\n}\n\n\nfunction get_header_from_document(document, delim, policy) {\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let comment_prefix = config ? config.get('comment_prefix') : '';\n let header_line = ll_rainbow_utils().get_header_line(document, comment_prefix);\n return csv_utils.smart_split(header_line, delim, policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n}\n\n\nfunction get_header(document, delim, policy) {\n var file_path = document.fileName;\n if (file_path) {\n let raw_header = get_from_global_state(make_header_key(file_path), null);\n if (raw_header) {\n return JSON.parse(raw_header);\n }\n }\n return get_header_from_document(document, delim, policy);\n}\n\n\nfunction get_field_by_line_position(fields, query_pos) {\n if (!fields.length)\n return null;\n var col_num = 0;\n var cpos = fields[col_num].length + 1;\n while (query_pos > cpos && col_num + 1 < fields.length) {\n col_num += 1;\n cpos = cpos + fields[col_num].length + 1;\n }\n return col_num;\n}\n\n\nfunction make_hover_text(document, position, language_id, enable_tooltip_column_names, enable_tooltip_warnings) {\n let [delim, policy] = dialect_map[language_id];\n var lnum = position.line;\n var cnum = position.character;\n var line = document.lineAt(lnum).text;\n\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let comment_prefix = config ? config.get('comment_prefix') : '';\n if (comment_prefix && line.startsWith(comment_prefix))\n return 'Comment';\n\n var report = csv_utils.smart_split(line, delim, policy, true);\n\n var entries = report[0];\n var warning = report[1];\n var col_num = get_field_by_line_position(entries, cnum + 1);\n\n if (col_num == null)\n return null;\n var result = 'Col #' + (col_num + 1);\n\n var header = get_header(document, delim, policy);\n if (enable_tooltip_column_names && col_num < header.length) {\n const max_label_len = 50;\n let column_label = header[col_num].trim();\n var short_column_label = column_label.substr(0, max_label_len);\n if (short_column_label != column_label)\n short_column_label = short_column_label + '...';\n result += ', Header: \"' + short_column_label + '\"';\n }\n if (enable_tooltip_warnings) {\n if (warning) {\n result += '; ERR: Inconsistent double quotes in line';\n } else if (header.length != entries.length) {\n result += `; WARN: Inconsistent num of fields, header: ${header.length}, this line: ${entries.length}`;\n }\n }\n return result;\n}\n\n\nfunction make_hover(document, position, language_id, cancellation_token) {\n if (last_statusbar_doc != document) {\n refresh_status_bar_buttons(document); // Being paranoid and making sure that the buttons are visible.\n }\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (!config)\n return;\n if (!config.get('enable_tooltip'))\n return;\n let enable_tooltip_column_names = config.get('enable_tooltip_column_names');\n let enable_tooltip_warnings = config.get('enable_tooltip_warnings');\n var hover_text = make_hover_text(document, position, language_id, enable_tooltip_column_names, enable_tooltip_warnings);\n if (hover_text && !cancellation_token.isCancellationRequested) {\n let mds = null;\n try {\n mds = new vscode.MarkdownString();\n mds.appendCodeblock(hover_text, 'rainbow hover markup');\n } catch (e) {\n mds = hover_text; // Older VSCode versions may not have MarkdownString/appendCodeblock functionality.\n }\n return new vscode.Hover(mds);\n } else {\n return null;\n }\n}\n\n\nfunction produce_lint_report(active_doc, delim, policy, config) {\n let comment_prefix = config.get('comment_prefix');\n let detect_trailing_spaces = config.get('csv_lint_detect_trailing_spaces');\n let first_trailing_space_line = null;\n var num_lines = active_doc.lineCount;\n var num_fields = null;\n for (var lnum = 0; lnum < num_lines; lnum++) {\n var line_text = active_doc.lineAt(lnum).text;\n if (lnum + 1 == num_lines && !line_text)\n break;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n var split_result = csv_utils.smart_split(line_text, delim, policy, true);\n if (split_result[1]) {\n return 'Error. Line ' + (lnum + 1) + ' has formatting error: double quote chars are not consistent';\n }\n if (detect_trailing_spaces && first_trailing_space_line === null) {\n let fields = split_result[0];\n for (let i = 0; i < fields.length; i++) {\n if (fields[i].length && (fields[i].charAt(0) == ' ' || fields[i].slice(-1) == ' ')) {\n first_trailing_space_line = lnum;\n }\n }\n }\n if (!num_fields) {\n num_fields = split_result[0].length;\n }\n if (num_fields != split_result[0].length) {\n return 'Error. Number of fields is not consistent: e.g. line 1 has ' + num_fields + ' fields, and line ' + (lnum + 1) + ' has ' + split_result[0].length + ' fields.';\n }\n }\n if (first_trailing_space_line !== null) {\n return 'Leading/Trailing spaces detected: e.g. at line ' + (first_trailing_space_line + 1) + '. Run \"Shrink\" command to remove them.';\n }\n return 'OK';\n}\n\n\nfunction get_active_editor() {\n var active_window = vscode.window;\n if (!active_window)\n return null;\n var active_editor = active_window.activeTextEditor;\n if (!active_editor)\n return null;\n return active_editor;\n}\n\n\nfunction get_active_doc(active_editor=null) {\n if (!active_editor)\n active_editor = get_active_editor();\n if (!active_editor)\n return null;\n var active_doc = active_editor.document;\n if (!active_doc)\n return null;\n return active_doc;\n}\n\n\nfunction show_lint_status_bar_button(file_path, language_id) {\n let lint_cache_key = `${file_path}.${language_id}`;\n if (!lint_results.has(lint_cache_key))\n return;\n var lint_report = lint_results.get(lint_cache_key);\n if (!lint_status_bar_button)\n lint_status_bar_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n lint_status_bar_button.text = 'CSVLint';\n if (lint_report === 'OK') {\n lint_status_bar_button.color = '#62f442';\n } else if (lint_report == 'Processing...') {\n lint_status_bar_button.color = '#A0A0A0';\n } else if (lint_report.indexOf('spaces detected') != -1) {\n lint_status_bar_button.color = '#ffff28';\n } else {\n lint_status_bar_button.color = '#f44242';\n }\n lint_status_bar_button.tooltip = lint_report + '\\nClick to recheck';\n lint_status_bar_button.command = 'rainbow-csv.CSVLint';\n lint_status_bar_button.show();\n}\n\n\nfunction show_align_shrink_button(file_path) {\n if (!align_shrink_button)\n align_shrink_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n if (aligned_files.has(file_path)) {\n align_shrink_button.text = 'Shrink';\n align_shrink_button.tooltip = 'Click to shrink table (Then you can click again to align)';\n align_shrink_button.command = 'rainbow-csv.Shrink';\n } else {\n align_shrink_button.text = 'Align';\n align_shrink_button.tooltip = 'Click to align table (Then you can click again to shrink)';\n align_shrink_button.command = 'rainbow-csv.Align';\n }\n align_shrink_button.show();\n}\n\n\nfunction show_rainbow_off_status_bar_button() {\n if (!rainbow_off_status_bar_button)\n rainbow_off_status_bar_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n rainbow_off_status_bar_button.text = 'Rainbow OFF';\n rainbow_off_status_bar_button.tooltip = 'Click to restore original file type and syntax';\n rainbow_off_status_bar_button.command = 'rainbow-csv.RainbowSeparatorOff';\n rainbow_off_status_bar_button.show();\n}\n\n\nfunction show_rbql_status_bar_button() {\n if (!rbql_status_bar_button)\n rbql_status_bar_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n rbql_status_bar_button.text = 'Query';\n rbql_status_bar_button.tooltip = 'Click to run SQL-like RBQL query';\n rbql_status_bar_button.command = 'rainbow-csv.RBQL';\n rbql_status_bar_button.show();\n}\n\n\nfunction hide_status_bar_buttons() {\n let all_buttons = [lint_status_bar_button, rbql_status_bar_button, rainbow_off_status_bar_button, copy_back_button, align_shrink_button];\n for (let i = 0; i < all_buttons.length; i++) {\n if (all_buttons[i])\n all_buttons[i].hide();\n }\n}\n\n\nfunction show_rbql_copy_to_source_button(file_path) {\n let parent_table_path = result_set_parent_map.get(file_path.toLowerCase());\n if (!parent_table_path || parent_table_path.indexOf(scratch_buf_marker) != -1)\n return;\n let parent_basename = path.basename(parent_table_path);\n if (!copy_back_button)\n copy_back_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n copy_back_button.text = 'Copy Back';\n copy_back_button.tooltip = `Copy to parent table: ${parent_basename}`;\n copy_back_button.command = 'rainbow-csv.CopyBack';\n copy_back_button.show();\n}\n\n\nfunction refresh_status_bar_buttons(active_doc=null) {\n if (!active_doc)\n active_doc = get_active_doc();\n last_statusbar_doc = active_doc;\n var file_path = active_doc ? active_doc.fileName : null;\n if (!active_doc || !file_path) {\n hide_status_bar_buttons();\n return;\n }\n if (file_path.endsWith('.git')) {\n return; // Sometimes for git-controlled dirs VSCode opens mysterious .git files. Skip them, don't hide buttons.\n }\n hide_status_bar_buttons();\n var language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return;\n show_lint_status_bar_button(file_path, language_id);\n show_rbql_status_bar_button();\n show_align_shrink_button(file_path);\n show_rainbow_off_status_bar_button();\n show_rbql_copy_to_source_button(file_path);\n}\n\n\nfunction csv_lint(active_doc, is_manual_op) {\n if (!active_doc)\n active_doc = get_active_doc();\n if (!active_doc)\n return null;\n var file_path = active_doc.fileName; // For new unitled scratch documents this would be \"Untitled-1\", \"Untitled-2\", etc...\n if (!file_path)\n return null;\n var language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return null;\n let lint_cache_key = `${file_path}.${language_id}`;\n if (!is_manual_op) {\n if (lint_results.has(lint_cache_key))\n return null;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (config && config.get('enable_auto_csv_lint') === false)\n return null;\n }\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (!config)\n return null;\n lint_results.set(lint_cache_key, 'Processing...');\n refresh_status_bar_buttons(active_doc); // Visual feedback.\n let [delim, policy] = dialect_map[language_id];\n var lint_report = produce_lint_report(active_doc, delim, policy, config);\n lint_results.set(lint_cache_key, lint_report);\n return lint_report;\n}\n\n\nasync function csv_lint_cmd() {\n // TODO re-run on each file save with content change.\n let lint_report = csv_lint(null, true);\n // Need timeout here to give user enough time to notice green -> yellow -> green switch, this is a sort of visual feedback.\n await sleep(500);\n refresh_status_bar_buttons();\n return lint_report;\n}\n\n\nasync function run_internal_test_cmd(integration_test_options) {\n if (integration_test_options && integration_test_options.check_initialization_state) {\n // This mode is to ensure that the most basic operations do not cause rainbow csv to load extra (potentially heavy) code.\n // Vim uses the same approach with its plugin/autoload folder layout design.\n return {initialized: global_state !== null, lazy_loaded: rainbow_utils !== null};\n }\n if (integration_test_options && integration_test_options.check_last_rbql_report) {\n return _unit_test_last_rbql_report;\n }\n if (integration_test_options && integration_test_options.check_last_rbql_warnings) {\n return {'warnings': _unit_test_last_warnings};\n }\n return null;\n}\n\n\nasync function show_warnings(warnings) {\n _unit_test_last_warnings = [];\n if (!warnings || !warnings.length)\n return;\n var active_window = vscode.window;\n if (!active_window)\n return null;\n for (var i = 0; i < warnings.length; i++) {\n // Do not \"await\" warning messages because the promise gets resolved only on warning dismissal.\n active_window.showWarningMessage('RBQL warning: ' + warnings[i]);\n }\n _unit_test_last_warnings = warnings;\n}\n\n\nasync function handle_rbql_result_file(text_doc, warnings) {\n var out_delim = rbql_context.output_delim;\n let language_id = map_separator_to_language_id(out_delim);\n var active_window = vscode.window;\n if (!active_window)\n return;\n try {\n await active_window.showTextDocument(text_doc);\n } catch (error) {\n show_single_line_error('Unable to open RBQL result document');\n return;\n }\n if (language_id && text_doc.language_id != language_id) {\n console.log('changing RBQL result language ' + text_doc.language_id + ' -> ' + language_id);\n await vscode.languages.setTextDocumentLanguage(text_doc, language_id);\n }\n await show_warnings(warnings);\n}\n\n\nfunction run_command(cmd, args, close_and_error_guard, callback_func) {\n var command = child_process.spawn(cmd, args, {'windowsHide': true});\n var stdout = '';\n var stderr = '';\n command.stdout.on('data', function(data) {\n stdout += data.toString();\n });\n command.stderr.on('data', function(data) {\n stderr += data.toString();\n });\n command.on('close', function(code) {\n if (!close_and_error_guard['process_reported']) {\n close_and_error_guard['process_reported'] = true;\n callback_func(code, stdout, stderr);\n }\n });\n command.on('error', function(error) {\n var error_msg = error ? error.name + ': ' + error.message : '';\n if (!close_and_error_guard['process_reported']) {\n close_and_error_guard['process_reported'] = true;\n callback_func(1, '', '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' + error_msg);\n }\n });\n}\n\n\nasync function handle_command_result(src_table_path, dst_table_path, error_code, stdout, stderr, webview_report_handler) {\n let json_report = stdout;\n let error_type = null;\n let error_msg = null;\n let warnings = [];\n if (error_code || !json_report || stderr) {\n error_type = 'Integration';\n error_msg = stderr ? stderr : 'empty error';\n } else {\n try {\n let report = JSON.parse(json_report);\n if (report.hasOwnProperty('error_type'))\n error_type = report['error_type'];\n if (report.hasOwnProperty('error_msg'))\n error_msg = report['error_msg'];\n if (report.hasOwnProperty('warnings'))\n warnings = report['warnings'];\n } catch (e) {\n error_type = 'Integration';\n error_msg = 'Unable to parse JSON report';\n }\n }\n webview_report_handler(error_type, error_msg);\n if (error_type || error_msg) {\n return; // Just exit: error would be shown in the preview window.\n }\n // No need to close the RBQL console here, better to leave it open so it can be used to quickly adjust the query if needed.\n autodetection_stoplist.add(dst_table_path);\n result_set_parent_map.set(dst_table_path.toLowerCase(), src_table_path);\n let doc = await vscode.workspace.openTextDocument(dst_table_path);\n await handle_rbql_result_file(doc, warnings);\n}\n\n\nfunction get_dst_table_name(input_path, output_delim) {\n var table_name = path.basename(input_path);\n var orig_extension = path.extname(table_name);\n var delim_ext_map = {'\\t': '.tsv', ',': '.csv'};\n var dst_extension = '.txt';\n if (delim_ext_map.hasOwnProperty(output_delim)) {\n dst_extension = delim_ext_map[output_delim];\n } else if (orig_extension.length > 1) {\n dst_extension = orig_extension;\n }\n let result_table_name = table_name + dst_extension;\n if (result_table_name == table_name) { // Just being paranoid to avoid overwriting input table accidentally when output dir configured to be the same as input.\n result_table_name += '.txt';\n }\n return result_table_name;\n}\n\n\nfunction file_path_to_query_key(file_path) {\n return (file_path && file_path.indexOf(scratch_buf_marker) != -1) ? scratch_buf_marker : file_path;\n}\n\nfunction get_dst_table_dir(input_table_path) {\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (!config)\n return os.tmpdir();\n if (config.get('rbql_output_dir') == 'TMP') {\n return os.tmpdir();\n } else if (config.get('rbql_output_dir') == 'INPUT') {\n return path.dirname(input_table_path);\n } else {\n // If the directory does not exist or isn't writable RBQL itself will report more or less clear error.\n return config.get('rbql_output_dir');\n }\n}\n\n\nasync function run_rbql_query(input_path, csv_encoding, backend_language, rbql_query, output_dialect, enable_rfc_newlines, with_headers, webview_report_handler) {\n last_rbql_queries.set(file_path_to_query_key(input_path), rbql_query);\n var cmd = 'python';\n const test_marker = 'test ';\n let close_and_error_guard = {'process_reported': false};\n\n let [input_delim, input_policy] = [rbql_context.delim, rbql_context.policy];\n if (input_policy == 'quoted' && enable_rfc_newlines)\n input_policy = 'quoted_rfc';\n let [output_delim, output_policy] = [input_delim, input_policy];\n if (output_dialect == 'csv')\n [output_delim, output_policy] = [',', 'quoted']; // XXX should it be \"quoted_rfc\" instead?\n if (output_dialect == 'tsv')\n [output_delim, output_policy] = ['\\t', 'simple'];\n rbql_context.output_delim = output_delim;\n\n let output_path = is_web_ext ? null : path.join(get_dst_table_dir(input_path), get_dst_table_name(input_path, output_delim));\n\n if (rbql_query.startsWith(test_marker)) {\n if (rbql_query.indexOf('nopython') != -1) {\n cmd = 'nopython';\n }\n let args = [absolute_path_map['rbql mock/rbql_mock.py'], rbql_query];\n run_command(cmd, args, close_and_error_guard, function(error_code, stdout, stderr) { handle_command_result(input_path, output_path, error_code, stdout, stderr, webview_report_handler); });\n return;\n }\n if (backend_language == 'js') {\n let warnings = [];\n let result_doc = null;\n try {\n if (is_web_ext) {\n let result_lines = await ll_rainbow_utils().rbql_query_web(rbql_query, rbql_context.input_document, input_delim, input_policy, output_delim, output_policy, warnings, with_headers, null);\n let output_doc_cfg = {content: result_lines.join('\\n'), language: map_separator_to_language_id(output_delim)};\n result_doc = await vscode.workspace.openTextDocument(output_doc_cfg);\n } else {\n let csv_options = {'bulk_read': true};\n await ll_rainbow_utils().rbql_query_node(global_state, rbql_query, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, warnings, with_headers, null, '', csv_options);\n result_set_parent_map.set(output_path.toLowerCase(), input_path);\n autodetection_stoplist.add(output_path);\n result_doc = await vscode.workspace.openTextDocument(output_path);\n }\n } catch (e) {\n let [error_type, error_msg] = ll_rbql_csv().exception_to_error_info(e);\n webview_report_handler(error_type, error_msg);\n return;\n }\n webview_report_handler(null, null);\n await handle_rbql_result_file(result_doc, warnings);\n } else {\n if (is_web_ext) {\n webview_report_handler('Input error', 'Python backend for RBQL is not supported in web version, please use JavaScript backend.');\n return;\n }\n let cmd_safe_query = Buffer.from(rbql_query, \"utf-8\").toString(\"base64\");\n let args = [absolute_path_map['rbql_core/vscode_rbql.py'], cmd_safe_query, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding];\n if (with_headers)\n args.push('--with_headers');\n run_command(cmd, args, close_and_error_guard, function(error_code, stdout, stderr) { handle_command_result(input_path, output_path, error_code, stdout, stderr, webview_report_handler); });\n }\n}\n\n\nfunction get_dialect(document) {\n var language_id = document.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return ['monocolumn', 'monocolumn'];\n return dialect_map[language_id];\n}\n\n\nasync function set_header_line() {\n let active_editor = get_active_editor();\n if (!active_editor)\n return;\n var active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n\n var dialect = get_dialect(active_doc);\n var delim = dialect[0];\n var policy = dialect[1];\n if (policy == 'monocolumn') {\n show_single_line_error('Unable to set header line: no separator specified');\n return;\n }\n let file_path = active_doc.fileName;\n if (!file_path) {\n show_single_line_error('Unable to set header line for non-file documents');\n return;\n }\n let selection = active_editor.selection;\n let raw_header = active_doc.lineAt(selection.start.line).text;\n\n let header = csv_utils.smart_split(raw_header, delim, policy, false)[0];\n await save_to_global_state(make_header_key(file_path), JSON.stringify(header));\n}\n\n\nasync function set_rainbow_separator() {\n let active_editor = get_active_editor();\n if (!active_editor)\n return;\n var active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let original_language_id = active_doc.languageId;\n let selection = active_editor.selection;\n if (!selection) {\n show_single_line_error(\"Selection is empty\");\n return;\n }\n if (selection.start.line != selection.end.line || selection.start.character + 1 != selection.end.character) {\n show_single_line_error(\"Selection must contain exactly one separator character\");\n return;\n }\n let separator = active_doc.lineAt(selection.start.line).text.charAt(selection.start.character);\n let language_id = map_separator_to_language_id(separator);\n if (!language_id) {\n show_single_line_error(\"Selected separator is not supported\");\n return;\n }\n\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, language_id);\n original_language_ids.set(doc.fileName, original_language_id);\n csv_lint(doc, false);\n refresh_status_bar_buttons(doc);\n}\n\n\nasync function restore_original_language() {\n var active_doc = get_active_doc();\n if (!active_doc)\n return;\n let file_path = active_doc.fileName;\n autodetection_stoplist.add(file_path);\n let original_language_id = 'plaintext';\n if (original_language_ids.has(file_path)) {\n original_language_id = original_language_ids.get(file_path);\n }\n if (!original_language_id || original_language_id == active_doc.languageId) {\n show_single_line_error(\"Unable to restore original language\");\n return;\n }\n\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, original_language_id);\n original_language_ids.delete(file_path);\n refresh_status_bar_buttons(doc);\n}\n\n\nasync function set_join_table_name() {\n if (is_web_ext) {\n show_single_line_error('This command is currently unavailable in web mode.');\n return;\n }\n var active_doc = get_active_doc();\n if (!active_doc)\n return;\n let file_path = active_doc.fileName;\n if (!file_path) {\n show_single_line_error('Unable to use this document as join table');\n return;\n }\n var title = \"Input table name to use in RBQL JOIN expressions instead of table path\";\n var input_box_props = {\"prompt\": title, \"value\": 'b'};\n let table_name = await vscode.window.showInputBox(input_box_props);\n if (!table_name)\n return; // User pressed Esc and closed the input box.\n save_to_global_state(ll_rainbow_utils().make_table_name_key(table_name), file_path);\n}\n\n\nasync function set_virtual_header() {\n var active_doc = get_active_doc();\n var dialect = get_dialect(active_doc);\n var delim = dialect[0];\n var policy = dialect[1];\n var file_path = active_doc.fileName;\n if (!file_path) {\n show_single_line_error('Unable to edit column names for non-file documents');\n return;\n }\n if (policy == 'monocolumn') {\n show_single_line_error('Unable to set virtual header: no separator specified');\n return;\n }\n var old_header = get_header(active_doc, delim, policy);\n var title = \"Adjust column names displayed in hover tooltips. Actual header line and file content won't be affected.\";\n var old_header_str = quoted_join(old_header, delim);\n var input_box_props = {\"prompt\": title, \"value\": old_header_str};\n let raw_new_header = await vscode.window.showInputBox(input_box_props);\n if (!raw_new_header)\n return; // User pressed Esc and closed the input box.\n let new_header = csv_utils.smart_split(raw_new_header, delim, policy, false)[0];\n await save_to_global_state(make_header_key(file_path), JSON.stringify(new_header));\n}\n\n\nasync function column_edit(edit_mode) {\n let active_editor = get_active_editor();\n if (!active_editor || !active_editor.selection)\n return;\n let active_doc = active_editor.document;\n if (!active_doc)\n return;\n let dialect = get_dialect(active_doc);\n let delim = dialect[0];\n let policy = dialect[1];\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (!config)\n return;\n let comment_prefix = config.get('comment_prefix');\n\n let position = active_editor.selection.active;\n let lnum = position.line;\n let cnum = position.character;\n let line = active_doc.lineAt(lnum).text;\n\n let report = csv_utils.smart_split(line, delim, policy, true);\n\n let entries = report[0];\n let quoting_warning = report[1];\n let col_num = get_field_by_line_position(entries, cnum + 1);\n\n let selections = [];\n let num_lines = active_doc.lineCount;\n if (num_lines >= 10000) {\n show_single_line_error('Multicursor column edit works only for files smaller than 10000 lines.');\n return;\n }\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (lnum + 1 == num_lines && !line_text)\n break;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let report = csv_utils.smart_split(line_text, delim, policy, true);\n let entries = report[0];\n quoting_warning = quoting_warning || report[1];\n if (col_num >= entries.length) {\n show_single_line_error(`Line ${lnum + 1} doesn't have field number ${col_num + 1}`);\n return;\n }\n let char_pos_before = entries.slice(0, col_num).join('').length + col_num;\n let char_pos_after = entries.slice(0, col_num + 1).join('').length + col_num;\n if (edit_mode == 'ce_before' && policy == 'quoted' && line_text.substring(char_pos_before - 2, char_pos_before + 2).indexOf('\"') != -1) {\n show_single_line_error(`Accidental data corruption prevention: Cursor at line ${lnum + 1} will not be set: a double quote is in proximity.`);\n return;\n }\n if (edit_mode == 'ce_after' && policy == 'quoted' && line_text.substring(char_pos_after - 2, char_pos_after + 2).indexOf('\"') != -1) {\n show_single_line_error(`Accidental data corruption prevention: Cursor at line ${lnum + 1} will not be set: a double quote is in proximity.`);\n return;\n }\n if (edit_mode == 'ce_select' && char_pos_before == char_pos_after) {\n show_single_line_error(`Accidental data corruption prevention: The column can not be selected: field ${col_num + 1} at line ${lnum + 1} is empty.`);\n return;\n }\n let position_before = new vscode.Position(lnum, char_pos_before);\n let position_after = new vscode.Position(lnum, char_pos_after);\n if (edit_mode == 'ce_before') {\n selections.push(new vscode.Selection(position_before, position_before));\n }\n if (edit_mode == 'ce_after') {\n selections.push(new vscode.Selection(position_after, position_after));\n }\n if (edit_mode == 'ce_select') {\n selections.push(new vscode.Selection(position_before, position_after));\n }\n }\n active_editor.selections = selections;\n if (quoting_warning) {\n vscode.window.showWarningMessage('Some lines have quoting issues: cursors positioning may be incorrect.');\n }\n // Call showTextDocument so that the editor will gain focus and the cursors will become active and blinking. This is a critical step here!\n await vscode.window.showTextDocument(active_doc);\n}\n\n\nasync function shrink_table(active_editor, edit_builder) {\n let active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return;\n let [delim, policy] = dialect_map[language_id];\n let [shrinked_doc_text, first_failed_line] = ll_rainbow_utils().shrink_columns(active_doc, delim, policy);\n if (first_failed_line) {\n show_single_line_error(`Unable to shrink: Inconsistent double quotes at line ${first_failed_line}`);\n return;\n }\n aligned_files.delete(active_doc.fileName);\n refresh_status_bar_buttons(active_doc);\n if (shrinked_doc_text === null) {\n vscode.window.showWarningMessage('No trailing whitespaces found, skipping');\n return;\n }\n let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0);\n let full_range = active_doc.validateRange(invalid_range);\n edit_builder.replace(full_range, shrinked_doc_text);\n}\n\n\nasync function align_table(active_editor, edit_builder) {\n let active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return;\n let [delim, policy] = dialect_map[language_id];\n let [column_sizes, first_failed_line] = ll_rainbow_utils().calc_column_sizes(active_doc, delim, policy);\n if (first_failed_line) {\n show_single_line_error(`Unable to align: Inconsistent double quotes at line ${first_failed_line}`);\n return;\n }\n let aligned_doc_text = ll_rainbow_utils().align_columns(active_doc, delim, policy, column_sizes);\n aligned_files.add(active_doc.fileName);\n refresh_status_bar_buttons(active_doc);\n if (aligned_doc_text === null) {\n vscode.window.showWarningMessage('Table is already aligned, skipping');\n return;\n }\n let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0);\n let full_range = active_doc.validateRange(invalid_range);\n edit_builder.replace(full_range, aligned_doc_text);\n}\n\n\nasync function do_copy_back(query_result_doc, active_editor) {\n let data = query_result_doc.getText();\n let active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0);\n let full_range = active_doc.validateRange(invalid_range);\n await active_editor.edit(edit => edit.replace(full_range, data));\n}\n\n\nasync function copy_back() {\n if (is_web_ext) {\n show_single_line_error('This command is currently unavailable in web mode.');\n return;\n }\n let result_doc = get_active_doc();\n if (!result_doc)\n return;\n let file_path = result_doc.fileName;\n let parent_table_path = result_set_parent_map.get(file_path.toLowerCase());\n if (!parent_table_path)\n return;\n let parent_doc = await vscode.workspace.openTextDocument(parent_table_path);\n let parent_editor = await vscode.window.showTextDocument(parent_doc);\n await do_copy_back(result_doc, parent_editor);\n}\n\n\nasync function update_query_history(query) {\n let history_list = get_from_global_state('rbql_query_history', []);\n let old_index = history_list.indexOf(query);\n if (old_index != -1) {\n history_list.splice(old_index, 1);\n } else if (history_list.length >= 20) {\n history_list.splice(0, 1);\n }\n history_list.push(query);\n await save_to_global_state('rbql_query_history', history_list);\n}\n\n\nasync function handle_rbql_client_message(webview, message, integration_test_options=null) {\n let message_type = message['msg_type'];\n\n let webview_report_handler = async function(error_type, error_msg) {\n let report_msg = {'msg_type': 'rbql_report'};\n if (error_type)\n report_msg[\"error_type\"] = error_type;\n if (error_msg)\n report_msg[\"error_msg\"] = error_msg;\n _unit_test_last_rbql_report = report_msg;\n await webview.postMessage(report_msg);\n };\n\n if (message_type == 'handshake') {\n var backend_language = get_from_global_state('rbql_backend_language', 'js');\n var encoding = get_from_global_state('rbql_encoding', 'utf-8');\n var init_msg = {'msg_type': 'handshake', 'backend_language': backend_language, 'encoding': encoding};\n sample_preview_records_from_context(rbql_context, init_msg);\n let path_key = file_path_to_query_key(rbql_context.input_document_path);\n if (last_rbql_queries.has(path_key))\n init_msg['last_query'] = last_rbql_queries.get(path_key);\n let history_list = get_from_global_state('rbql_query_history', []);\n init_msg['query_history'] = history_list;\n init_msg['policy'] = rbql_context.policy;\n init_msg['enable_rfc_newlines'] = rbql_context.enable_rfc_newlines;\n init_msg['with_headers'] = rbql_context.with_headers;\n init_msg['header'] = rbql_context.header;\n init_msg['is_web_ext'] = is_web_ext;\n if (integration_test_options) {\n init_msg['integration_test_language'] = integration_test_options.rbql_backend;\n init_msg['integration_test_query'] = integration_test_options.rbql_query;\n init_msg['integration_test_with_headers'] = integration_test_options.with_headers || false;\n init_msg['integration_test_enable_rfc_newlines'] = integration_test_options.enable_rfc_newlines || false;\n }\n await webview.postMessage(init_msg);\n }\n\n if (message_type == 'fetch_table_header') {\n try {\n let table_id = message['table_id'];\n let encoding = message['encoding'];\n\n let input_table_dir = rbql_context.input_document_path ? path.dirname(rbql_context.input_document_path) : null;\n let table_path = ll_rainbow_utils().find_table_path(global_state, input_table_dir, table_id);\n if (!table_path)\n return;\n let header_line = await ll_rainbow_utils().read_header(table_path, encoding);\n let [fields, warning] = csv_utils.smart_split(header_line, rbql_context.delim, rbql_context.policy, false);\n if (!warning) {\n webview.postMessage({'msg_type': 'fetch_table_header_response', 'header': fields});\n }\n } catch (e) {\n console.error('Unable to get join table header: ' + String(e));\n }\n }\n\n if (message_type == 'update_query') {\n let rbql_query = message['query'];\n if (!rbql_query)\n return;\n if (rbql_context.input_document_path)\n last_rbql_queries.set(file_path_to_query_key(rbql_context.input_document_path), rbql_query);\n }\n\n if (message_type == 'newlines_policy_change') {\n rbql_context.enable_rfc_newlines = message['enable_rfc_newlines'];\n if (rbql_context.input_document_path)\n await save_to_global_state(make_rfc_policy_key(rbql_context.input_document_path), rbql_context.enable_rfc_newlines);\n let protocol_message = {'msg_type': 'resample'};\n sample_preview_records_from_context(rbql_context, protocol_message);\n await webview.postMessage(protocol_message);\n }\n\n if (message_type == 'with_headers_change') {\n rbql_context.with_headers = message['with_headers'];\n if (rbql_context.input_document_path)\n await save_to_global_state(make_with_headers_key(rbql_context.input_document_path), rbql_context.with_headers);\n }\n\n if (message_type == 'navigate') {\n var navig_direction = message['direction'];\n if (navig_direction == 'backward') {\n rbql_context.requested_start_record -= preview_window_size;\n } else if (navig_direction == 'forward') {\n rbql_context.requested_start_record += preview_window_size;\n } else if (navig_direction == 'begin') {\n rbql_context.requested_start_record = 0;\n } else if (navig_direction == 'end') {\n rbql_context.requested_start_record = rbql_context.input_document.lineCount; // This is just max possible value which is incorrect and will be adjusted later.\n }\n let protocol_message = {'msg_type': 'navigate'};\n sample_preview_records_from_context(rbql_context, protocol_message);\n await webview.postMessage(protocol_message);\n }\n\n if (message_type == 'run') {\n let rbql_query = message['query'];\n let backend_language = message['backend_language'];\n let encoding = message['encoding'];\n let output_dialect = message['output_dialect'];\n let enable_rfc_newlines = message['enable_rfc_newlines'];\n let with_headers = message['with_headers'];\n await update_query_history(rbql_query);\n await run_rbql_query(rbql_context.input_document_path, encoding, backend_language, rbql_query, output_dialect, enable_rfc_newlines, with_headers, webview_report_handler);\n }\n\n if (message_type == 'edit_udf') {\n if (is_web_ext) {\n webview_report_handler('Input error', 'UDFs are currently not supported in web version');\n return;\n }\n let backend_language = message['backend_language'];\n let udf_file_path = null;\n let default_content = '';\n if (backend_language == 'js') {\n udf_file_path = path.join(os.homedir(), '.rbql_init_source.js');\n default_content = ll_rainbow_utils().get_default_js_udf_content();\n } else {\n udf_file_path = path.join(os.homedir(), '.rbql_init_source.py');\n default_content = ll_rainbow_utils().get_default_python_udf_content();\n }\n if (!fs.existsSync(udf_file_path)) {\n fs.writeFileSync(udf_file_path, default_content);\n }\n let udf_doc = await vscode.workspace.openTextDocument(udf_file_path);\n await vscode.window.showTextDocument(udf_doc);\n }\n\n if (message_type == 'global_param_change') {\n await save_to_global_state(message['key'], message['value']);\n }\n}\n\n\nfunction adjust_webview_paths(paths_list, client_html) {\n for (const local_path of paths_list) {\n let adjusted_webview_url = null;\n if (is_web_ext) {\n adjusted_webview_url = absolute_path_map[local_path];\n } else {\n adjusted_webview_url = preview_panel.webview.asWebviewUri(vscode.Uri.file(absolute_path_map[local_path]));\n }\n client_html = client_html.replace(`src=\"${local_path}\"`, `src=\"${adjusted_webview_url}\"`);\n }\n return client_html;\n}\n\n\nasync function edit_rbql(integration_test_options=null) {\n let active_window = vscode.window;\n if (!active_window)\n return;\n let active_editor = active_window.activeTextEditor;\n if (!active_editor)\n return;\n let active_doc = active_editor.document;\n if (!active_doc)\n return;\n let orig_uri = active_doc.uri;\n if (!orig_uri)\n return;\n // For web orig_uri.scheme can have other valid values e.g. `vscode-test-web` when testing the browser integration.\n if (orig_uri.scheme != 'file' && orig_uri.scheme != 'untitled' && !is_web_ext)\n return;\n if (orig_uri.scheme == 'file' && active_doc.isDirty && !is_web_ext) {\n show_single_line_error(\"Unable to run RBQL: file has unsaved changes\");\n return;\n }\n let input_path = null;\n if (orig_uri.scheme == 'untitled' && !is_web_ext) {\n // Scheme 'untitled' means that the document is a scratch buffer that hasn't been saved yet, see https://code.visualstudio.com/api/references/document-selector\n let data = active_doc.getText();\n let rnd_suffix = String(Math.floor(Math.random() * 1000000));\n input_path = path.join(os.tmpdir(), `${scratch_buf_marker}_${rnd_suffix}.txt`);\n // TODO consider adding username to the input_path and using chmod 600 on it.\n fs.writeFileSync(input_path, data);\n } else {\n input_path = active_doc.fileName;\n }\n\n if (!input_path) {\n show_single_line_error(\"Unable to run RBQL for this file\");\n return;\n }\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let language_id = active_doc.languageId;\n let delim = 'monocolumn';\n let policy = 'monocolumn';\n if (dialect_map.hasOwnProperty(language_id)) {\n [delim, policy] = dialect_map[language_id];\n }\n let enable_rfc_newlines = get_from_global_state(make_rfc_policy_key(input_path), false);\n let with_headers_by_default = config ? config.get('rbql_with_headers_by_default') : false;\n let with_headers = get_from_global_state(make_with_headers_key(input_path), with_headers_by_default);\n let header = get_header_from_document(active_doc, delim, policy);\n rbql_context = {\n \"input_document\": active_doc,\n \"input_document_path\": input_path,\n \"requested_start_record\": 0,\n \"delim\": delim,\n \"policy\": policy,\n \"rfc_record_map\": [],\n \"enable_rfc_newlines\": enable_rfc_newlines,\n \"with_headers\": with_headers,\n \"header\": header\n };\n\n preview_panel = vscode.window.createWebviewPanel('rbql-console', 'RBQL Console', vscode.ViewColumn.Active, {enableScripts: true});\n if (!client_html_template) {\n if (is_web_ext) {\n client_html_template = client_html_template_web;\n } else {\n client_html_template = fs.readFileSync(absolute_path_map['rbql_client.html'], \"utf8\");\n }\n }\n let client_html = client_html_template;\n client_html = adjust_webview_paths(['contrib/textarea-caret-position/index.js', 'rbql_suggest.js', 'rbql_client.js', 'rbql_logo.svg'], client_html);\n preview_panel.webview.html = client_html;\n preview_panel.webview.onDidReceiveMessage(function(message) { handle_rbql_client_message(preview_panel.webview, message, integration_test_options); });\n}\n\n\nfunction get_num_columns_if_delimited(active_doc, delim, policy, min_num_columns, min_num_lines) {\n var num_lines = active_doc.lineCount;\n let num_fields = 0;\n let num_lines_checked = 0;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let comment_prefix_for_autodetection = config ? config.get('comment_prefix') : '';\n if (!comment_prefix_for_autodetection)\n comment_prefix_for_autodetection = '#';\n for (var lnum = 0; lnum < num_lines; lnum++) {\n var line_text = active_doc.lineAt(lnum).text;\n if (lnum + 1 == num_lines && !line_text)\n break;\n if (line_text.startsWith(comment_prefix_for_autodetection))\n continue;\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning)\n return 0; // TODO don't fail on warnings?\n if (!num_fields)\n num_fields = fields.length;\n if (num_fields < min_num_columns || num_fields != fields.length)\n return 0;\n num_lines_checked += 1;\n }\n return num_lines_checked >= min_num_lines ? num_fields : 0;\n}\n\n\nfunction autodetect_dialect(active_doc, candidate_separators) {\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let min_num_lines = config ? config.get('autodetection_min_line_count') : 10;\n if (active_doc.lineCount < min_num_lines)\n return null;\n\n let best_dialect = null;\n let best_dialect_num_columns = 1;\n for (let i = 0; i < candidate_separators.length; i++) {\n let dialect_id = map_separator_to_language_id(candidate_separators[i]);\n if (!dialect_id)\n continue;\n let [delim, policy] = dialect_map[dialect_id];\n let cur_dialect_num_columns = get_num_columns_if_delimited(active_doc, delim, policy, best_dialect_num_columns + 1, min_num_lines);\n if (cur_dialect_num_columns > best_dialect_num_columns) {\n best_dialect_num_columns = cur_dialect_num_columns;\n best_dialect = dialect_id;\n }\n }\n return best_dialect;\n}\n\n\nfunction autodetect_dialect_frequency_based(active_doc, candidate_separators) {\n let best_dialect = 'csv';\n let best_dialect_frequency = 0;\n let data = active_doc.getText();\n if (!data)\n return best_dialect;\n for (let i = 0; i < candidate_separators.length; i++) {\n if (candidate_separators[i] == ' ' || candidate_separators[i] == '.')\n continue; // Whitespace and dot have advantage over other separators in this algorithm, so we just skip them.\n let dialect_id = map_separator_to_language_id(candidate_separators[i]);\n let frequency = 0;\n for (let j = 0; j < 10000 && j < data.length; j++) {\n if (data[j] == candidate_separators[i])\n frequency += 1;\n }\n if (frequency > best_dialect_frequency) {\n best_dialect = dialect_id;\n best_dialect_frequency = frequency;\n }\n }\n return best_dialect;\n}\n\n\nasync function autoenable_rainbow_csv(active_doc) {\n if (!active_doc)\n return;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (!config || !config.get('enable_separator_autodetection'))\n return;\n let candidate_separators = config.get('autodetect_separators');\n var original_language_id = active_doc.languageId;\n var file_path = active_doc.fileName;\n if (!file_path || autodetection_stoplist.has(file_path)) {\n return;\n }\n let is_default_csv = file_path.endsWith('.csv') && original_language_id == 'csv';\n if (original_language_id != 'plaintext' && !is_default_csv)\n return;\n let rainbow_csv_language_id = autodetect_dialect(active_doc, candidate_separators);\n if (!rainbow_csv_language_id && is_default_csv) {\n // Smart autodetection method has failed, but we need to choose a separator because this is a csv file. Let's just find the most popular one.\n rainbow_csv_language_id = autodetect_dialect_frequency_based(active_doc, candidate_separators);\n }\n if (!rainbow_csv_language_id || rainbow_csv_language_id == original_language_id)\n return;\n\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, rainbow_csv_language_id);\n original_language_ids.set(file_path, original_language_id);\n csv_lint(doc, false);\n refresh_status_bar_buttons(doc);\n}\n\n\nasync function handle_doc_edit(change_event) {\n if (!change_event)\n return;\n if (doc_edit_subscription) {\n doc_edit_subscription.dispose();\n doc_edit_subscription = null;\n }\n let active_doc = change_event.document;\n if (!active_doc)\n return;\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n let candidate_separators = config.get('autodetect_separators');\n let rainbow_csv_language_id = autodetect_dialect(active_doc, candidate_separators);\n if (!rainbow_csv_language_id)\n return;\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, rainbow_csv_language_id);\n csv_lint(doc, false);\n refresh_status_bar_buttons(doc);\n}\n\n\nfunction register_csv_copy_paste(active_doc) {\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n if (!config || !config.get('enable_separator_autodetection'))\n return;\n if (!active_doc || doc_edit_subscription)\n return;\n if (!active_doc.isUntitled && active_doc.lineCount != 0)\n return;\n doc_edit_subscription = vscode.workspace.onDidChangeTextDocument(handle_doc_edit);\n return;\n}\n\n\nfunction handle_editor_switch(editor) {\n let active_doc = get_active_doc(editor);\n csv_lint(active_doc, false);\n refresh_status_bar_buttons(active_doc);\n}\n\n\nasync function handle_doc_open(active_doc) {\n await autoenable_rainbow_csv(active_doc);\n register_csv_copy_paste(active_doc);\n csv_lint(active_doc, false);\n refresh_status_bar_buttons(active_doc);\n}\n\n\nfunction quote_field(field, delim) {\n if (field.indexOf('\"') != -1 || field.indexOf(delim) != -1) {\n return '\"' + field.replace(/\"/g, '\"\"') + '\"';\n }\n return field;\n}\n\n\nfunction quoted_join(fields, delim) {\n var quoted_fields = fields.map(function(val) { return quote_field(val, delim); });\n return quoted_fields.join(delim);\n}\n\n\nasync function make_preview(uri, preview_mode) {\n if (is_web_ext) {\n show_single_line_error('This command is currently unavailable in web mode.');\n return;\n }\n var file_path = uri.fsPath;\n if (!file_path || !fs.existsSync(file_path)) {\n vscode.window.showErrorMessage('Invalid file');\n return;\n }\n\n var size_limit = 1024000; // ~1MB\n var file_size_in_bytes = fs.statSync(file_path)['size'];\n if (file_size_in_bytes <= size_limit) {\n vscode.window.showWarningMessage('Rainbow CSV: The file is not big enough, showing the full file instead. Use this preview for files larger than 1MB');\n let full_orig_doc = await vscode.workspace.openTextDocument(file_path);\n await vscode.window.showTextDocument(full_orig_doc);\n return;\n }\n\n let file_basename = path.basename(file_path);\n const out_path = path.join(os.tmpdir(), `.rb_csv_preview.${preview_mode}.${file_basename}`);\n\n fs.open(file_path, 'r', (err, fd) => {\n if (err) {\n console.log(err.message);\n vscode.window.showErrorMessage('Unable to preview file');\n return;\n }\n\n var buffer = Buffer.alloc(size_limit);\n let read_begin_pos = preview_mode == 'head' ? 0 : Math.max(file_size_in_bytes - size_limit, 0);\n fs.read(fd, buffer, 0, size_limit, read_begin_pos, function(err, _num) {\n if (err) {\n console.log(err.message);\n vscode.window.showErrorMessage('Unable to preview file');\n return;\n }\n\n const buffer_str = buffer.toString();\n // TODO handle old mac '\\r' line endings - still used by Mac version of Excel.\n let content = null;\n if (preview_mode == 'head') {\n content = buffer_str.substr(0, buffer_str.lastIndexOf(buffer_str.includes('\\r\\n') ? '\\r\\n' : '\\n'));\n } else {\n content = buffer_str.substr(buffer_str.indexOf('\\n') + 1);\n }\n fs.writeFileSync(out_path, content);\n vscode.workspace.openTextDocument(out_path).then(doc => vscode.window.showTextDocument(doc));\n });\n });\n}\n\n\nfunction register_csv_hover_info_provider(language_id, context) {\n let hover_provider = vscode.languages.registerHoverProvider(language_id, {\n provideHover(document, position, token) {\n return make_hover(document, position, language_id, token);\n }\n });\n context.subscriptions.push(hover_provider);\n}\n\n\nasync function activate(context) {\n global_state = context.globalState;\n\n if (is_web_ext) {\n let rbql_client_uri = vscode.Uri.joinPath(context.extensionUri, 'rbql_client.html');\n let bytes = await vscode.workspace.fs.readFile(rbql_client_uri);\n // Using TextDecoder because it should work fine in web extension.\n client_html_template_web = new TextDecoder().decode(bytes);\n }\n\n for (let local_path in absolute_path_map) {\n if (absolute_path_map.hasOwnProperty(local_path)) {\n if (is_web_ext) {\n absolute_path_map[local_path] = vscode.Uri.joinPath(context.extensionUri, local_path);\n } else {\n absolute_path_map[local_path] = context.asAbsolutePath(local_path);\n }\n }\n }\n\n for (let language_id in dialect_map) {\n if (dialect_map.hasOwnProperty(language_id)) {\n register_csv_hover_info_provider(language_id, context);\n }\n }\n\n var lint_cmd = vscode.commands.registerCommand('rainbow-csv.CSVLint', csv_lint_cmd);\n var rbql_cmd = vscode.commands.registerCommand('rainbow-csv.RBQL', edit_rbql);\n var set_header_line_cmd = vscode.commands.registerCommand('rainbow-csv.SetHeaderLine', set_header_line);\n var edit_column_names_cmd = vscode.commands.registerCommand('rainbow-csv.SetVirtualHeader', set_virtual_header);\n var set_join_table_name_cmd = vscode.commands.registerCommand('rainbow-csv.SetJoinTableName', set_join_table_name); // WEB_DISABLED\n var column_edit_before_cmd = vscode.commands.registerCommand('rainbow-csv.ColumnEditBefore', async function() { await column_edit('ce_before'); });\n var column_edit_after_cmd = vscode.commands.registerCommand('rainbow-csv.ColumnEditAfter', async function() { await column_edit('ce_after'); });\n var column_edit_select_cmd = vscode.commands.registerCommand('rainbow-csv.ColumnEditSelect', async function() { await column_edit('ce_select'); });\n var set_separator_cmd = vscode.commands.registerCommand('rainbow-csv.RainbowSeparator', set_rainbow_separator);\n var rainbow_off_cmd = vscode.commands.registerCommand('rainbow-csv.RainbowSeparatorOff', restore_original_language);\n var sample_head_cmd = vscode.commands.registerCommand('rainbow-csv.SampleHead', async function(uri) { await make_preview(uri, 'head'); }); // WEB_DISABLED\n var sample_tail_cmd = vscode.commands.registerCommand('rainbow-csv.SampleTail', async function(uri) { await make_preview(uri, 'tail'); }); // WEB_DISABLED\n var align_cmd = vscode.commands.registerTextEditorCommand('rainbow-csv.Align', align_table);\n var shrink_cmd = vscode.commands.registerTextEditorCommand('rainbow-csv.Shrink', shrink_table);\n var copy_back_cmd = vscode.commands.registerCommand('rainbow-csv.CopyBack', copy_back); // WEB_DISABLED\n var internal_test_cmd = vscode.commands.registerCommand('rainbow-csv.InternalTest', run_internal_test_cmd);\n\n var doc_open_event = vscode.workspace.onDidOpenTextDocument(handle_doc_open);\n var switch_event = vscode.window.onDidChangeActiveTextEditor(handle_editor_switch);\n\n context.subscriptions.push(lint_cmd);\n context.subscriptions.push(rbql_cmd);\n context.subscriptions.push(edit_column_names_cmd);\n context.subscriptions.push(column_edit_before_cmd);\n context.subscriptions.push(column_edit_after_cmd);\n context.subscriptions.push(column_edit_select_cmd);\n context.subscriptions.push(doc_open_event);\n context.subscriptions.push(switch_event);\n context.subscriptions.push(set_separator_cmd);\n context.subscriptions.push(rainbow_off_cmd);\n context.subscriptions.push(sample_head_cmd);\n context.subscriptions.push(sample_tail_cmd);\n context.subscriptions.push(set_join_table_name_cmd);\n context.subscriptions.push(align_cmd);\n context.subscriptions.push(shrink_cmd);\n context.subscriptions.push(copy_back_cmd);\n context.subscriptions.push(set_header_line_cmd);\n context.subscriptions.push(internal_test_cmd);\n\n // Need this because \"onDidOpenTextDocument()\" doesn't get called for the first open document.\n // Another issue is when dev debug logging mode is enabled, the first document would be \"Log\" because it is printing something and gets VSCode focus.\n await sleep(1000);\n let active_doc = get_active_doc();\n handle_doc_open(active_doc);\n}\n\n\nfunction deactivate() {\n // This method is called when extension is deactivated.\n}\n\n\nexports.activate = activate;\nexports.deactivate = deactivate;\n"],"names":["GetIntrinsic","callBind","$indexOf","module","exports","name","allowMissing","intrinsic","bind","$apply","$call","$reflectApply","call","$gOPD","$defineProperty","$max","value","e","originalFunction","func","arguments","desc","configurable","length","applyBind","apply","hasOwn","Object","prototype","hasOwnProperty","toString","obj","fn","ctx","TypeError","l","i","k","ERROR_MESSAGE","slice","Array","toStr","funcType","that","target","this","bound","args","binder","result","concat","boundLength","Math","max","boundArgs","push","Function","join","Empty","implementation","undefined","$SyntaxError","SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","getOwnPropertyDescriptor","throwTypeError","ThrowTypeError","calleeThrows","get","gOPDthrows","hasSymbols","getProto","getPrototypeOf","x","__proto__","needsEval","TypedArray","Uint8Array","INTRINSICS","AggregateError","ArrayBuffer","Symbol","iterator","Atomics","BigInt","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","Error","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","isFinite","isNaN","JSON","Map","Number","parseFloat","parseInt","Promise","Proxy","RangeError","ReferenceError","Reflect","RegExp","Set","SharedArrayBuffer","String","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","doEval","gen","LEGACY_ALIASES","$concat","$spliceApply","splice","$replace","replace","$strSlice","rePropName","reEscapeChar","stringToPath","string","first","last","match","number","quote","subString","getBaseIntrinsic","alias","intrinsicName","parts","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","part","origSymbol","hasSymbolSham","getOwnPropertySymbols","sym","symObj","keys","getOwnPropertyNames","syms","propertyIsEnumerable","descriptor","enumerable","toStringTag","create","ctor","superCtor","super_","constructor","writable","TempCtor","hasToStringTag","$toString","callBound","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","GeneratorFunction","fnToStr","isFnRegex","test","generatorFunc","getGeneratorFunc","forEach","availableTypedArrays","g","globalThis","typedArrays","array","$slice","toStrTags","gOPD","typedArray","arr","proto","superProto","tag","anyTrue","getter","tryTypedArrays","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","len","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","arg","copy","fill","readUInt8","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","uncurryThis","f","BigIntSupported","SymbolSupported","ObjectToString","numberValue","valueOf","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isPromise","input","then","catch","isArrayBufferView","isView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isFloat32Array","isFloat64Array","isBigInt64Array","isBigUint64Array","isMap","isSet","isWeakMap","isWeakSet","SharedArrayBufferCopy","isSharedArrayBufferToString","isSharedArrayBuffer","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","isBoxedPrimitive","isAnyArrayBuffer","method","defineProperty","getOwnPropertyDescriptors","descriptors","formatRegExp","format","isString","objects","inspect","str","stringify","_","isNull","isObject","deprecate","msg","noDeprecation","warned","throwDeprecation","traceDeprecation","console","trace","error","debugs","debugEnvRegex","NODE_DEBUG","debugEnv","toUpperCase","opts","seen","stylize","stylizeNoColor","depth","colors","isBoolean","showHidden","_extend","isUndefined","customInspect","stylizeWithColor","formatValue","styleType","style","styles","recurseTimes","isFunction","ret","primitive","simple","isNumber","formatPrimitive","visibleKeys","hash","val","idx","arrayToHash","isError","indexOf","formatError","isRegExp","isDate","output","base","braces","isArray","toUTCString","formatProperty","key","formatArray","map","pop","reduce","prev","cur","reduceToSingleString","set","split","line","substr","ar","re","objectToString","d","o","pad","n","debuglog","pid","types","isNullOrUndefined","isSymbol","isNativeError","isPrimitive","isBuffer","months","timestamp","time","getHours","getMinutes","getSeconds","getDate","getMonth","prop","log","inherits","origin","add","kCustomPromisifiedSymbol","callbackifyOnRejected","reason","cb","newReason","promisify","original","promiseResolve","promiseReject","promise","resolve","reject","err","setPrototypeOf","defineProperties","custom","callbackify","callbackified","maybeCb","self","rej","foundName","os","fs","path","rbql","rbql_csv","vscode","csv_utils","AssertionError","make_table_name_key","file_path","find_table_path","vscode_global_state","main_table_dir","table_id","filepath","candidate_path","charAt","homedir","existsSync","isAbsolute","table_path","get_header_line","document","comment_prefix","num_lines","lineCount","lnum","line_text","lineAt","text","startsWith","RbqlIOHandlingError","VSCodeRecordIterator","RBQLInputIterator","delim","policy","has_header","table_name","variable_prefix","super","NR","NL","fields_info","first_defective_line","first_record","get_first_record","stop","header_line","smart_split","async","query_text","variable_map","parse_basic_variables","parse_array_variables","parse_attribute_variables","parse_dictionary_variables","get_line_rfc","rfc_line_buffer","record_line","accumulate_rfc_line_into_record","get_line_simple","do_get_record","record","warning","num_fields","get_warnings","inconsistent_records_info","entries","record_id","sort","a","b","condition","message","assert","record_1","num_fields_1","record_2","num_fields_2","warn_msg","make_inconsistent_num_fields_warning","VSCodeWriter","RBQLOutputWriter","header_len","null_in_output","delim_in_simple_output","output_lines","polymorphic_join","simple_join","quoted_join","quoted_join_rfc","mono_join","set_header","header","write","fields","v","quote_field","rfc_quote_field","res","normalize_fields","out_fields","sub_array_delim","VSCodeTableRegistry","get_iterator_by_table_id","_table_id","VSCodeFileSystemCSVRegistry","RBQLTableRegistry","input_file_dir","encoding","options","stream","record_iterator","bulk_input_path","createReadStream","CSVRecordIterator","output_warnings","basename","read_header","input_reader","createInterface","closed","promise_resolve","promise_reject","output_promise","close","rbql_query_web","input_document","input_delim","input_policy","output_delim","output_policy","with_headers","join_tables_registry","input_iterator","output_writer","query","rbql_query_node","input_path","output_path","csv_encoding","user_init_code","input_stream","stdin","output_stream","close_output_on_finish","stdout","createWriteStream","is_ascii","default_init_source_path","read_user_init_code","dirname","CSVWriter","populate_optimistic_rfc_csv_record_map","requested_end_record","dst_record_map","record_begin","match_list","has_unbalanced_double_quote","get_default_js_udf_content","get_default_python_udf_content","align_columns","active_doc","column_sizes","result_lines","has_edit","config","workspace","getConfiguration","adjusted","trim","delta_len","repeat","shrink_columns","calc_column_sizes","field_rgx","field_rgx_external_whitespaces","extract_next_field","src","dlm","preserve_quotes_and_whitespaces","allow_external_whitespaces","cidx","src_cur","substring","match_obj","exec","match_end","uidx","field","split_quoted_str","extraction_report","unquote_field","split_whitespace_separated_str","preserve_whitespaces","rgxp","unquote_fields","split_lines","external_rfc_line_buffer","current_line","multiline_row","RbqlParsingError","RbqlRuntimeError","InternalBadFieldError","bad_idx","params","replace_all","search","replacement","RBQLContext","writer","unnest_list","top_count","like_regex_cache","sort_key_expression","aggregation_stage","aggregation_key_expression","functional_aggregators","join_map_impl","join_map","lhs_join_var_expression","where_expression","select_expression","update_expressions","variables_init_code","query_context","wrong_aggregation_usage_error","RBQL_VERSION","check_if_brackets_match","opening_bracket","closing_bracket","parse_root_bracket_level_text_spans","text_spans","last_pos","bracket_stack","cur_char","span","unquote_string","quoted_str","column_info_from_text_span","text_span","string_literals","rbql_star_marker","simple_var_match","attribute_match","subscript_int_match","subscript_str_match","column_index","column_name","is_star","replaced_string_literal_id","unquoted_column_name","adhoc_parse_select_expression_to_column_infos","ts","stable_compare","safe_get","safe_join_get","safe_set","regexp_escape","like_to_regex","pattern","p","converted","like","matcher","LIKE","RBQLAggregationToken","marker_id","UnnestMarker","UNNEST","vals","unnest","Unnest","UNFOLD","parse_number","MinAggregator","stats","increment","cur_aggr","min","get_final","MaxAggregator","SumAggregator","AvgAggregator","cur_sum","cur_cnt","VarianceAggregator","cur_sum_sq","avg_val","MedianAggregator","m","floor","CountAggregator","ArrayAggAggregator","post_proc","ConstGroupVerifier","output_index","const_values","old_value","init_aggregator","generator_name","MIN","Min","MAX","Max","COUNT","count","Count","SUM","sum","Sum","AVG","avg","Avg","VARIANCE","variance","Variance","MEDIAN","median","Median","ARRAY_AGG","array_agg","FOLD","add_to_set","dst_set","len_before","size","TopWriter","subwriter","NW","finish","UniqWriter","UniqCountWriter","records","old_val","unshift","SortedWriter","reverse_sort","unsorted_entries","stable_entry","reverse","entry","AggregateWriter","aggregators","aggregation_keys","all_keys","from","ag","InnerJoiner","get_rhs","lhs_key","get_join_records","LeftJoiner","null_record","max_record_len","StrictLeftJoiner","select_except","except_fields","select_simple","sort_key","sort_entry","select_aggregated","transparent_values","num_aggregators_found","trans_value","select_unnested","folded_fields","unnest_pos","findIndex","PROCESS_SELECT_COMMON","PROCESS_SELECT_SIMPLE","PROCESS_SELECT_JOIN","PROCESS_UPDATE_JOIN","PROCESS_UPDATE_SIMPLE","MAIN_LOOP_BODY","embed_expression","parent_code","child_placeholder","child_expression","embed_code","child_code","parent_lines","child_lines","pos","placeholder_indentation","generate_main_loop_code","is_select_query","is_join_query","js_code","compile_and_run","main_loop_body","main_loop_promise","lower_case_query","toLowerCase","GROUP_BY","UPDATE","SELECT","JOIN","INNER_JOIN","LEFT_JOIN","LEFT_OUTER_JOIN","STRICT_LEFT_JOIN","ORDER_BY","WHERE","LIMIT","EXCEPT","WITH","get_ambiguous_error_msg","variable_name","get_all_matches","regexp","str_strip","strip_comments","cline","combine_string_literals","backend_expression","prefix","dst_variables_map","matches","field_num","initialize","index","js_string_escape_column_name","quote_char","query_probably_has_dictionary_variable","continuous_name_segments","continuous_segment","column_names","dict_test_rgx","escaped_column_name","column_names_source","column_names_from_query","zero_based_idx","map_variables_directly","ensure_no_ambiguous_variables","input_column_names","join_column_names","join_column_names_set","has","parse_join_expression","invalid_join_syntax_error","variable_pairs","pair_rgx","and_rgx","resolve_join_variables","input_variables_map","join_variables_map","lhs_variables","rhs_indices","valid_join_syntax_msg","variable_pair","join_var_1","join_var_2","lhs_key_index","rhs_key_index","generate_common_init_code","base_var","attr_var","generate_init_statements","variables_map","indent","code_lines","simple_var_name_rgx","var_info","variable_declaration_keyword","replace_star_count","aggregate_expression","replace_star_vars","rbql_expression","replacement_expression","replace_star_vars_for_header_parsing","translate_update_expression","update_expression","first_assignment_error","assignment_looking_rgx","dst_var_name","var_index","current_indent","translate_select_expression","expression_without_stars","translated","translated_for_header","separate_string_literals","rgx","format_parts","idx_before","literal_id","string_literal","start_index","lastIndex","format_expression","locate_statements","statement_groups","ig","is","statement","match_str","separate_actions","with_match","ordered_statements","statement_start","span_start","span_end","statement_params","new_span","find_top","rb_actions","select_action","translate_except_expression","except_expression","input_header","skip_vars","skip_indices","var_name","HashJoinMap","key_indices","hash_map","nr","key_index","polymorphic_get_key","get_single_key","get_multi_key","ki","get_record","nf","key_records","cleanup_query","filter","remove_redundant_table_name","select_output_header","join_header","query_column_infos","output_header","qci","handle_query_modifier","TableIterator","table","normalize_column_names","stopped","TableWriter","external_table","SingleTableRegistry","shallow_parse_input_query","get_variables_map","rhs_table_id","join_record_iterator","get_header","sql_join_type","build","select_expression_for_ast","query_table","input_table","output_table","join_table","output_column_names","exception_to_error_info","exceptions_type_map","error_type","util","utf_decoding_error","rbql_init_source_path","readFileSync","name_record","index_path","content","lines","try_read_index","get_index_record","RecordQueue","push_stack","pull_stack","enqueue","dequeue","csv_path","first_record_should_be_emitted","header_preread_complete","decoder","TextDecoder","fatal","input_exhausted","started","utf8_bom_removed","partially_decoded_line","partially_decoded_line_ends_with_cr","resolve_current_record","reject_current_record","current_exception","produced_records_queue","process_line_polymorphic","process_partial_rfc_record_line","process_record_line","modifier","reset_external_callbacks","try_propagate_exception","exception","store_or_propagate_exception","pause","preread_first_record","try_resolve_next_record","start","isPaused","resume","parent_iterator","current_record_promise","num_records","process_line","clean_line","assumed_source_encoding","charCodeAt","remove_utf8_bom","process_data_stream_chunk","data_chunk","decoded_string","decode","first_line_index","process_data_bulk","control_buffer","Buffer","compare","process_data_stream_end","last_line","destroy","readFile","close_stream_on_finish","line_separator","setDefaultEncoding","error_obj","store_first_error","first_error","writer_error","_write_all","output_encoding","end","FileSystemCSVRegistry","interpret_named_csv_format","format_name","query_csv","require","possibleNames","out","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","window","child_process","rainbow_utils","ll_rainbow_utils","is_web_ext","preview_window_size","scratch_buf_marker","client_html_template_web","lint_results","aligned_files","autodetection_stoplist","original_language_ids","result_set_parent_map","lint_status_bar_button","rbql_status_bar_button","align_shrink_button","rainbow_off_status_bar_button","copy_back_button","last_statusbar_doc","rbql_context","last_rbql_queries","client_html_template","global_state","preview_panel","doc_edit_subscription","_unit_test_last_rbql_report","_unit_test_last_warnings","dialect_map","absolute_path_map","show_single_line_error","error_msg","active_window","showErrorMessage","sleep","ms","map_separator_to_language_id","separator","language_id","get_from_global_state","default_value","save_to_global_state","update","get_rfc_record_text","record_start","record_end","sample_preview_records_from_context","dst_message","requested_start_record","preview_records","enable_rfc_newlines","rfc_record_map","record_text","cur_record","preview_sampling_error","r","c","start_record_zero_based","make_header_key","make_rfc_policy_key","make_with_headers_key","get_header_from_document","fileName","raw_header","parse","get_field_by_line_position","query_pos","col_num","cpos","get_active_editor","activeTextEditor","get_active_doc","active_editor","hide_status_bar_buttons","all_buttons","hide","refresh_status_bar_buttons","endsWith","languageId","lint_cache_key","lint_report","createStatusBarItem","StatusBarAlignment","Left","color","tooltip","command","show","show_lint_status_bar_button","show_align_shrink_button","parent_table_path","parent_basename","show_rbql_copy_to_source_button","csv_lint","is_manual_op","detect_trailing_spaces","first_trailing_space_line","split_result","produce_lint_report","csv_lint_cmd","run_internal_test_cmd","integration_test_options","check_initialization_state","initialized","lazy_loaded","check_last_rbql_report","check_last_rbql_warnings","handle_rbql_result_file","text_doc","warnings","showTextDocument","languages","setTextDocumentLanguage","showWarningMessage","show_warnings","run_command","cmd","close_and_error_guard","callback_func","spawn","stderr","data","code","handle_command_result","src_table_path","dst_table_path","error_code","webview_report_handler","json_report","report","doc","openTextDocument","file_path_to_query_key","get_dialect","set_header_line","dialect","selection","set_rainbow_separator","original_language_id","character","restore_original_language","delete","set_join_table_name","showInputBox","set_virtual_header","old_header_str","input_box_props","raw_new_header","new_header","column_edit","edit_mode","position","active","cnum","quoting_warning","selections","char_pos_before","char_pos_after","position_before","Position","position_after","Selection","shrink_table","edit_builder","shrinked_doc_text","first_failed_line","invalid_range","Range","full_range","validateRange","align_table","aligned_doc_text","copy_back","result_doc","parent_doc","parent_editor","query_result_doc","getText","edit","do_copy_back","handle_rbql_client_message","webview","message_type","report_msg","postMessage","init_msg","path_key","input_document_path","history_list","rbql_backend","rbql_query","input_table_dir","protocol_message","navig_direction","backend_language","output_dialect","old_index","update_query_history","input_table_path","tmpdir","get_dst_table_dir","orig_extension","extname","delim_ext_map","dst_extension","result_table_name","get_dst_table_name","output_doc_cfg","language","csv_options","cmd_safe_query","run_rbql_query","udf_file_path","default_content","writeFileSync","udf_doc","edit_rbql","orig_uri","uri","scheme","isDirty","rnd_suffix","random","with_headers_by_default","createWebviewPanel","ViewColumn","Active","enableScripts","client_html","paths_list","local_path","adjusted_webview_url","asWebviewUri","Uri","file","adjust_webview_paths","html","onDidReceiveMessage","get_num_columns_if_delimited","min_num_columns","min_num_lines","num_lines_checked","comment_prefix_for_autodetection","autodetect_dialect","candidate_separators","best_dialect","best_dialect_num_columns","dialect_id","cur_dialect_num_columns","handle_doc_edit","change_event","dispose","rainbow_csv_language_id","handle_editor_switch","editor","handle_doc_open","is_default_csv","best_dialect_frequency","frequency","j","autodetect_dialect_frequency_based","autoenable_rainbow_csv","isUntitled","onDidChangeTextDocument","register_csv_copy_paste","make_preview","preview_mode","fsPath","size_limit","file_size_in_bytes","statSync","full_orig_doc","file_basename","out_path","open","fd","buffer","alloc","read_begin_pos","read","_num","buffer_str","lastIndexOf","includes","register_csv_hover_info_provider","context","hover_provider","registerHoverProvider","provideHover","token","cancellation_token","hover_text","enable_tooltip_column_names","enable_tooltip_warnings","max_label_len","column_label","short_column_label","make_hover_text","isCancellationRequested","mds","MarkdownString","appendCodeblock","Hover","make_hover","subscriptions","activate","globalState","rbql_client_uri","joinPath","extensionUri","bytes","asAbsolutePath","lint_cmd","commands","registerCommand","rbql_cmd","set_header_line_cmd","edit_column_names_cmd","set_join_table_name_cmd","column_edit_before_cmd","column_edit_after_cmd","column_edit_select_cmd","set_separator_cmd","rainbow_off_cmd","sample_head_cmd","sample_tail_cmd","align_cmd","registerTextEditorCommand","shrink_cmd","copy_back_cmd","internal_test_cmd","doc_open_event","onDidOpenTextDocument","switch_event","onDidChangeActiveTextEditor","deactivate"],"sourceRoot":""} \ No newline at end of file diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/dist/web/test/suite/index.js b/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/dist/web/test/suite/index.js deleted file mode 100644 index 8a941063..00000000 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/dist/web/test/suite/index.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see index.js.LICENSE.txt */ -(()=>{var t={9282:(t,e,r)=>{"use strict";var n=r(4155);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}var a,i,c=r(2136).codes,u=c.ERR_AMBIGUOUS_ARGUMENT,l=c.ERR_INVALID_ARG_TYPE,s=c.ERR_INVALID_ARG_VALUE,f=c.ERR_INVALID_RETURN_VALUE,p=c.ERR_MISSING_ARGS,y=r(5961),g=r(9539).inspect,d=r(9539).types,m=d.isPromise,b=d.isRegExp,h=Object.assign?Object.assign:r(8091).assign,w=Object.is?Object.is:r(609);function v(){var t=r(9158);a=t.isDeepEqual,i=t.isDeepStrictEqual}new Map;var j=!1,x=t.exports=E,S={};function O(t){if(t.message instanceof Error)throw t.message;throw new y(t)}function A(t,e,r,n){if(!r){var o=!1;if(0===e)o=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var a=new y({actual:r,expected:!0,message:n,operator:"==",stackStartFn:t});throw a.generatedMessage=o,a}}function E(){for(var t=arguments.length,e=new Array(t),r=0;r1?r-1:0),o=1;o1?r-1:0),o=1;o1?r-1:0),o=1;o1?r-1:0),o=1;o{"use strict";var n=r(4155);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){for(var r=0;rt.length)&&(r=t.length),t.substring(r-e.length,r)===e}var b="",h="",w="",v="",j={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 x(t){var e=Object.keys(t),r=Object.create(Object.getPrototypeOf(t));return e.forEach((function(e){r[e]=t[e]})),Object.defineProperty(r,"message",{value:t.message}),r}function S(t){return g(t,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var O=function(t){function e(t){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),"object"!==y(t)||null===t)throw new d("options","Object",t);var o=t.message,a=t.operator,u=t.stackStartFn,l=t.actual,s=t.expected,f=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=o)r=i(this,p(e).call(this,String(o)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(b="",h="",v="",w=""):(b="",h="",v="",w="")),"object"===y(l)&&null!==l&&"object"===y(s)&&null!==s&&"stack"in l&&l instanceof Error&&"stack"in s&&s instanceof Error&&(l=x(l),s=x(s)),"deepStrictEqual"===a||"strictEqual"===a)r=i(this,p(e).call(this,function(t,e,r){var o="",a="",i=0,c="",u=!1,l=S(t),s=l.split("\n"),f=S(e).split("\n"),p=0,g="";if("strictEqual"===r&&"object"===y(t)&&"object"===y(e)&&null!==t&&null!==e&&(r="strictEqualObject"),1===s.length&&1===f.length&&s[0]!==f[0]){var d=s[0].length+f[0].length;if(d<=10){if(!("object"===y(t)&&null!==t||"object"===y(e)&&null!==e||0===t&&0===e))return"".concat(j[r],"\n\n")+"".concat(s[0]," !== ").concat(f[0],"\n")}else if("strictEqualObject"!==r&&d<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;s[0][p]===f[0][p];)p++;p>2&&(g="\n ".concat(function(t,e){if(e=Math.floor(e),0==t.length||0==e)return"";var r=t.length*e;for(e=Math.floor(Math.log(e)/Math.log(2));e;)t+=t,e--;return t+t.substring(0,r-t.length)}(" ",p),"^"),p=0)}}for(var x=s[s.length-1],O=f[f.length-1];x===O&&(p++<2?c="\n ".concat(x).concat(c):o=x,s.pop(),f.pop(),0!==s.length&&0!==f.length);)x=s[s.length-1],O=f[f.length-1];var A=Math.max(s.length,f.length);if(0===A){var E=l.split("\n");if(E.length>30)for(E[26]="".concat(b,"...").concat(v);E.length>27;)E.pop();return"".concat(j.notIdentical,"\n\n").concat(E.join("\n"),"\n")}p>3&&(c="\n".concat(b,"...").concat(v).concat(c),u=!0),""!==o&&(c="\n ".concat(o).concat(c),o="");var _=0,T=j[r]+"\n".concat(h,"+ actual").concat(v," ").concat(w,"- expected").concat(v),P=" ".concat(b,"...").concat(v," Lines skipped");for(p=0;p1&&p>2&&(k>4?(a+="\n".concat(b,"...").concat(v),u=!0):k>3&&(a+="\n ".concat(f[p-2]),_++),a+="\n ".concat(f[p-1]),_++),i=p,o+="\n".concat(w,"-").concat(v," ").concat(f[p]),_++;else if(f.length1&&p>2&&(k>4?(a+="\n".concat(b,"...").concat(v),u=!0):k>3&&(a+="\n ".concat(s[p-2]),_++),a+="\n ".concat(s[p-1]),_++),i=p,a+="\n".concat(h,"+").concat(v," ").concat(s[p]),_++;else{var q=f[p],I=s[p],R=I!==q&&(!m(I,",")||I.slice(0,-1)!==q);R&&m(q,",")&&q.slice(0,-1)===I&&(R=!1,I+=","),R?(k>1&&p>2&&(k>4?(a+="\n".concat(b,"...").concat(v),u=!0):k>3&&(a+="\n ".concat(s[p-2]),_++),a+="\n ".concat(s[p-1]),_++),i=p,a+="\n".concat(h,"+").concat(v," ").concat(I),o+="\n".concat(w,"-").concat(v," ").concat(q),_+=2):(a+=o,o="",1!==k&&0!==p||(a+="\n ".concat(I),_++))}if(_>20&&p30)for(O[26]="".concat(b,"...").concat(v);O.length>27;)O.pop();r=1===O.length?i(this,p(e).call(this,"".concat(g," ").concat(O[0]))):i(this,p(e).call(this,"".concat(g,"\n\n").concat(O.join("\n"),"\n")))}else{var A=S(l),E="",_=j[a];"notDeepEqual"===a||"notEqual"===a?(A="".concat(j[a],"\n\n").concat(A)).length>1024&&(A="".concat(A.slice(0,1021),"...")):(E="".concat(S(s)),A.length>512&&(A="".concat(A.slice(0,509),"...")),E.length>512&&(E="".concat(E.slice(0,509),"...")),"deepEqual"===a||"equal"===a?A="".concat(_,"\n\n").concat(A,"\n\nshould equal\n\n"):E=" ".concat(a," ").concat(E)),r=i(this,p(e).call(this,"".concat(A).concat(E)))}return Error.stackTraceLimit=f,r.generatedMessage=!o,Object.defineProperty(c(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=l,r.expected=s,r.operator=a,Error.captureStackTrace&&Error.captureStackTrace(c(r),u),r.stack,r.name="AssertionError",i(r)}var r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}(e,t),r=e,u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:g.custom,value:function(t,e){return g(this,function(t){for(var e=1;e{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}var i,c,u={};function l(t,e,r){r||(r=Error);var i=function(r){function i(r,a,c){var u,l,s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),l=this,s=o(i).call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,a,c)),u=!s||"object"!==n(s)&&"function"!=typeof s?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(l):s,u.code=t,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(i,r),i}(r);u[t]=i}function s(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",(function(t,e,o){var a,c,u,l,f;if(void 0===i&&(i=r(9282)),i("string"==typeof t,"'name' must be a string"),"string"==typeof e&&(c="not ",e.substr(0,c.length)===c)?(a="must not be",e=e.replace(/^not /,"")):a="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))u="The ".concat(t," ").concat(a," ").concat(s(e,"type"));else{var p=("number"!=typeof f&&(f=0),f+".".length>(l=t).length||-1===l.indexOf(".",f)?"argument":"property");u='The "'.concat(t,'" ').concat(p," ").concat(a," ").concat(s(e,"type"))}return u+". Received type ".concat(n(o))}),TypeError),l("ERR_INVALID_ARG_VALUE",(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===c&&(c=r(9539));var o=c.inspect(e);return o.length>128&&(o="".concat(o.slice(0,128),"...")),"The argument '".concat(t,"' ").concat(n,". Received ").concat(o)}),TypeError,RangeError),l("ERR_INVALID_RETURN_VALUE",(function(t,e,r){var o;return o=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(t,' to be returned from the "').concat(e,'"')+" function but got ".concat(o,".")}),TypeError),l("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),n=0;n0,"At least one arg needs to be specified");var o="The ",a=e.length;switch(e=e.map((function(t){return'"'.concat(t,'"')})),a){case 1:o+="".concat(e[0]," argument");break;case 2:o+="".concat(e[0]," and ").concat(e[1]," arguments");break;default:o+=e.slice(0,a-1).join(", "),o+=", and ".concat(e[a-1]," arguments")}return"".concat(o," must be specified")}),TypeError),t.exports.codes=u},9158:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}var a=void 0!==/a/g.flags,i=function(t){var e=[];return t.forEach((function(t){return e.push(t)})),e},c=function(t){var e=[];return t.forEach((function(t,r){return e.push([r,t])})),e},u=Object.is?Object.is:r(609),l=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},s=Number.isNaN?Number.isNaN:r(360);function f(t){return t.call.bind(t)}var p=f(Object.prototype.hasOwnProperty),y=f(Object.prototype.propertyIsEnumerable),g=f(Object.prototype.toString),d=r(9539).types,m=d.isAnyArrayBuffer,b=d.isArrayBufferView,h=d.isDate,w=d.isMap,v=d.isRegExp,j=d.isSet,x=d.isNativeError,S=d.isBoxedPrimitive,O=d.isNumberObject,A=d.isStringObject,E=d.isBooleanObject,_=d.isBigIntObject,T=d.isSymbolObject,P=d.isFloat32Array,k=d.isFloat64Array;function q(t){if(0===t.length||t.length>10)return!0;for(var e=0;e57)return!0}return 10===t.length&&t>=Math.pow(2,32)}function I(t){return Object.keys(t).filter(q).concat(l(t).filter(Object.prototype.propertyIsEnumerable.bind(t)))}function R(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,o=0,a=Math.min(r,n);o{"use strict";var n=r(210),o=r(5559),a=o(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&a(t,".prototype.")>-1?o(r):r}},5559:(t,e,r)=>{"use strict";var n=r(8612),o=r(210),a=o("%Function.prototype.apply%"),i=o("%Function.prototype.call%"),c=o("%Reflect.apply%",!0)||n.call(i,a),u=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),s=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(t){l=null}t.exports=function(t){var e=c(n,i,arguments);if(u&&l){var r=u(e,"length");r.configurable&&l(e,"length",{value:1+s(0,t.length-(arguments.length-1))})}return e};var f=function(){return c(n,a,arguments)};l?l(t.exports,"apply",{value:f}):t.exports.apply=f},4289:(t,e,r)=>{"use strict";var n=r(2215),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),a=Object.prototype.toString,i=Array.prototype.concat,c=Object.defineProperty,u=c&&function(){var t={};try{for(var e in c(t,"x",{enumerable:!1,value:t}),t)return!1;return t.x===t}catch(t){return!1}}(),l=function(t,e,r,n){var o;(!(e in t)||"function"==typeof(o=n)&&"[object Function]"===a.call(o)&&n())&&(u?c(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},s=function(t,e){var r=arguments.length>2?arguments[2]:{},a=n(e);o&&(a=i.call(a,Object.getOwnPropertySymbols(e)));for(var c=0;c{"use strict";function e(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var r=Object(t),n=1;n{var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=function(t,n,o){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var a=t.length;if(a===+a)for(var i=0;i{"use strict";var e="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";t.exports=function(t){var a=this;if("function"!=typeof a||n.call(a)!==o)throw new TypeError(e+a);for(var i,c=r.call(arguments,1),u=function(){if(this instanceof i){var e=a.apply(this,c.concat(r.call(arguments)));return Object(e)===e?e:this}return a.apply(t,c.concat(r.call(arguments)))},l=Math.max(0,a.length-c.length),s=[],f=0;f{"use strict";var n=r(7648);t.exports=Function.prototype.bind||n},210:(t,e,r)=>{"use strict";var n,o=SyntaxError,a=Function,i=TypeError,c=function(t){try{return a('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var l=function(){throw new i},s=u?function(){try{return l}catch(t){try{return u(arguments,"callee").get}catch(t){return l}}}():l,f=r(1405)(),p=Object.getPrototypeOf||function(t){return t.__proto__},y={},g="undefined"==typeof Uint8Array?n:p(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":f?p([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":y,"%AsyncGenerator%":y,"%AsyncGeneratorFunction%":y,"%AsyncIteratorPrototype%":y,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":y,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f?p(p([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&f?p((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&f?p((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f?p(""[Symbol.iterator]()):n,"%Symbol%":f?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":s,"%TypedArray%":g,"%TypeError%":i,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},m=function t(e){var r;if("%AsyncFunction%"===e)r=c("async function () {}");else if("%GeneratorFunction%"===e)r=c("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=c("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var o=t("%AsyncGenerator%");o&&(r=p(o.prototype))}return d[e]=r,r},b={"%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"]},h=r(8612),w=r(7642),v=h.call(Function.call,Array.prototype.concat),j=h.call(Function.apply,Array.prototype.splice),x=h.call(Function.call,String.prototype.replace),S=h.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A=/\\(\\)?/g,E=function(t){var e=S(t,0,1),r=S(t,-1);if("%"===e&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return x(t,O,(function(t,e,r,o){n[n.length]=r?x(o,A,"$1"):e||t})),n},_=function(t,e){var r,n=t;if(w(b,n)&&(n="%"+(r=b[n])[0]+"%"),w(d,n)){var a=d[n];if(a===y&&(a=m(n)),void 0===a&&!e)throw new i("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:a}}throw new o("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new i('"allowMissing" argument must be a boolean');var r=E(t),n=r.length>0?r[0]:"",a=_("%"+n+"%",e),c=a.name,l=a.value,s=!1,f=a.alias;f&&(n=f[0],j(r,v([0,1],f)));for(var p=1,y=!0;p=r.length){var h=u(l,g);l=(y=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:l[g]}else y=w(l,g),l=l[g];y&&!s&&(d[c]=l)}}return l}},1405:(t,e,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(5419);t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},5419:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},6410:(t,e,r)=>{"use strict";var n=r(5419);t.exports=function(){return n()&&!!Symbol.toStringTag}},7642:(t,e,r)=>{"use strict";var n=r(8612);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},2584:(t,e,r)=>{"use strict";var n=r(6410)(),o=r(1924)("Object.prototype.toString"),a=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===o(t)},i=function(t){return!!a(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==o(t)&&"[object Function]"===o(t.callee)},c=function(){return a(arguments)}();a.isLegacyArguments=i,t.exports=c?a:i},8662:(t,e,r)=>{"use strict";var n,o=Object.prototype.toString,a=Function.prototype.toString,i=/^\s*(?:function)?\*/,c=r(6410)(),u=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(i.test(a.call(t)))return!0;if(!c)return"[object GeneratorFunction]"===o.call(t);if(!u)return!1;if(void 0===n){var e=function(){if(!c)return!1;try{return Function("return function*() {}")()}catch(t){}}();n=!!e&&u(e)}return u(t)===n}},8611:t=>{"use strict";t.exports=function(t){return t!=t}},360:(t,e,r)=>{"use strict";var n=r(5559),o=r(4289),a=r(8611),i=r(9415),c=r(3194),u=n(i(),Number);o(u,{getPolyfill:i,implementation:a,shim:c}),t.exports=u},9415:(t,e,r)=>{"use strict";var n=r(8611);t.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},3194:(t,e,r)=>{"use strict";var n=r(4289),o=r(9415);t.exports=function(){var t=o();return n(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}},5692:(t,e,r)=>{"use strict";var n=r(9804),o=r(3083),a=r(1924),i=a("Object.prototype.toString"),c=r(6410)(),u="undefined"==typeof globalThis?r.g:globalThis,l=o(),s=a("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r-1}return!!y&&function(t){var e=!1;return n(p,(function(r,n){if(!e)try{e=r.call(t)===n}catch(t){}})),e}(t)}},4244:t=>{"use strict";var e=function(t){return t!=t};t.exports=function(t,r){return 0===t&&0===r?1/t==1/r:t===r||!(!e(t)||!e(r))}},609:(t,e,r)=>{"use strict";var n=r(4289),o=r(5559),a=r(4244),i=r(5624),c=r(2281),u=o(i(),Object);n(u,{getPolyfill:i,implementation:a,shim:c}),t.exports=u},5624:(t,e,r)=>{"use strict";var n=r(4244);t.exports=function(){return"function"==typeof Object.is?Object.is:n}},2281:(t,e,r)=>{"use strict";var n=r(5624),o=r(4289);t.exports=function(){var t=n();return o(Object,{is:t},{is:function(){return Object.is!==t}}),t}},8987:(t,e,r)=>{"use strict";var n;if(!Object.keys){var o=Object.prototype.hasOwnProperty,a=Object.prototype.toString,i=r(1414),c=Object.prototype.propertyIsEnumerable,u=!c.call({toString:null},"toString"),l=c.call((function(){}),"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(t){var e=t.constructor;return e&&e.prototype===t},p={$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},y=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+t]&&o.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{f(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===a.call(t),n=i(t),c=e&&"[object String]"===a.call(t),p=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var g=l&&r;if(c&&t.length>0&&!o.call(t,0))for(var d=0;d0)for(var m=0;m{"use strict";var n=Array.prototype.slice,o=r(1414),a=Object.keys,i=a?function(t){return a(t)}:r(8987),c=Object.keys;i.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return o(t)?c(n.call(t)):c(t)})}else Object.keys=i;return Object.keys||i},t.exports=i},1414:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),n}},4155:t=>{var e,r,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function i(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var c,u=[],l=!1,s=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):s=-1,u.length&&p())}function p(){if(!l){var t=i(f);l=!0;for(var e=u.length;e;){for(c=u,u=[];++s1)for(var r=1;r{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},5955:(t,e,r)=>{"use strict";var n=r(2584),o=r(8662),a=r(6430),i=r(5692);function c(t){return t.call.bind(t)}var u="undefined"!=typeof BigInt,l="undefined"!=typeof Symbol,s=c(Object.prototype.toString),f=c(Number.prototype.valueOf),p=c(String.prototype.valueOf),y=c(Boolean.prototype.valueOf);if(u)var g=c(BigInt.prototype.valueOf);if(l)var d=c(Symbol.prototype.valueOf);function m(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function b(t){return"[object Map]"===s(t)}function h(t){return"[object Set]"===s(t)}function w(t){return"[object WeakMap]"===s(t)}function v(t){return"[object WeakSet]"===s(t)}function j(t){return"[object ArrayBuffer]"===s(t)}function x(t){return"undefined"!=typeof ArrayBuffer&&(j.working?j(t):t instanceof ArrayBuffer)}function S(t){return"[object DataView]"===s(t)}function O(t){return"undefined"!=typeof DataView&&(S.working?S(t):t instanceof DataView)}e.isArgumentsObject=n,e.isGeneratorFunction=o,e.isTypedArray=i,e.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},e.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):i(t)||O(t)},e.isUint8Array=function(t){return"Uint8Array"===a(t)},e.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===a(t)},e.isUint16Array=function(t){return"Uint16Array"===a(t)},e.isUint32Array=function(t){return"Uint32Array"===a(t)},e.isInt8Array=function(t){return"Int8Array"===a(t)},e.isInt16Array=function(t){return"Int16Array"===a(t)},e.isInt32Array=function(t){return"Int32Array"===a(t)},e.isFloat32Array=function(t){return"Float32Array"===a(t)},e.isFloat64Array=function(t){return"Float64Array"===a(t)},e.isBigInt64Array=function(t){return"BigInt64Array"===a(t)},e.isBigUint64Array=function(t){return"BigUint64Array"===a(t)},b.working="undefined"!=typeof Map&&b(new Map),e.isMap=function(t){return"undefined"!=typeof Map&&(b.working?b(t):t instanceof Map)},h.working="undefined"!=typeof Set&&h(new Set),e.isSet=function(t){return"undefined"!=typeof Set&&(h.working?h(t):t instanceof Set)},w.working="undefined"!=typeof WeakMap&&w(new WeakMap),e.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(w.working?w(t):t instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),e.isWeakSet=function(t){return v(t)},j.working="undefined"!=typeof ArrayBuffer&&j(new ArrayBuffer),e.isArrayBuffer=x,S.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&S(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=O;var A="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function E(t){return"[object SharedArrayBuffer]"===s(t)}function _(t){return void 0!==A&&(void 0===E.working&&(E.working=E(new A)),E.working?E(t):t instanceof A)}function T(t){return m(t,f)}function P(t){return m(t,p)}function k(t){return m(t,y)}function q(t){return u&&m(t,g)}function I(t){return l&&m(t,d)}e.isSharedArrayBuffer=_,e.isAsyncFunction=function(t){return"[object AsyncFunction]"===s(t)},e.isMapIterator=function(t){return"[object Map Iterator]"===s(t)},e.isSetIterator=function(t){return"[object Set Iterator]"===s(t)},e.isGeneratorObject=function(t){return"[object Generator]"===s(t)},e.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===s(t)},e.isNumberObject=T,e.isStringObject=P,e.isBooleanObject=k,e.isBigIntObject=q,e.isSymbolObject=I,e.isBoxedPrimitive=function(t){return T(t)||P(t)||k(t)||q(t)||I(t)},e.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(x(t)||_(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},9539:(t,e,r)=>{var n=r(4155),o=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),c=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(r)?n.showHidden=r:r&&e._extend(n,r),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),p(n,t,n.depth)}function s(t,e){var r=l.styles[e];return r?"["+l.colors[r][0]+"m"+t+"["+l.colors[r][1]+"m":t}function f(t,e){return t}function p(t,r,n){if(t.customInspect&&r&&A(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return w(o)||(o=p(t,o,n)),o}var a=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(w(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return h(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):b(e)?t.stylize("null","null"):void 0}(t,r);if(a)return a;var i=Object.keys(r),c=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(i);if(t.showHidden&&(i=Object.getOwnPropertyNames(r)),O(r)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return y(r);if(0===i.length){if(A(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(j(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return t.stylize(Date.prototype.toString.call(r),"date");if(O(r))return y(r)}var l,s="",f=!1,x=["{","}"];return d(r)&&(f=!0,x=["[","]"]),A(r)&&(s=" [Function"+(r.name?": "+r.name:"")+"]"),j(r)&&(s=" "+RegExp.prototype.toString.call(r)),S(r)&&(s=" "+Date.prototype.toUTCString.call(r)),O(r)&&(s=" "+y(r)),0!==i.length||f&&0!=r.length?n<0?j(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),l=f?function(t,e,r,n,o){for(var a=[],i=0,c=e.length;i60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(l,s,x)):x[0]+s+x[1]}function y(t){return"["+Error.prototype.toString.call(t)+"]"}function g(t,e,r,n,o,a){var i,c,u;if((u=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?c=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(c=t.stylize("[Setter]","special")),k(n,o)||(i="["+o+"]"),c||(t.seen.indexOf(u.value)<0?(c=b(r)?p(t,u.value,null):p(t,u.value,r-1)).indexOf("\n")>-1&&(c=a?c.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+c.split("\n").map((function(t){return" "+t})).join("\n")):c=t.stylize("[Circular]","special")),v(i)){if(a&&o.match(/^\d+$/))return c;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+c}function d(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function b(t){return null===t}function h(t){return"number"==typeof t}function w(t){return"string"==typeof t}function v(t){return void 0===t}function j(t){return x(t)&&"[object RegExp]"===E(t)}function x(t){return"object"==typeof t&&null!==t}function S(t){return x(t)&&"[object Date]"===E(t)}function O(t){return x(t)&&("[object Error]"===E(t)||t instanceof Error)}function A(t){return"function"==typeof t}function E(t){return Object.prototype.toString.call(t)}function _(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!i[t])if(c.test(t)){var r=n.pid;i[t]=function(){var n=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,n)}}else i[t]=function(){};return i[t]},e.inspect=l,l.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]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=r(5955),e.isArray=d,e.isBoolean=m,e.isNull=b,e.isNullOrUndefined=function(t){return null==t},e.isNumber=h,e.isString=w,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=v,e.isRegExp=j,e.types.isRegExp=j,e.isObject=x,e.isDate=S,e.types.isDate=S,e.isError=O,e.types.isNativeError=O,e.isFunction=A,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(384);var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var t=new Date,e=[_(t.getHours()),_(t.getMinutes()),_(t.getSeconds())].join(":");return[t.getDate(),T[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",P(),e.format.apply(e,arguments))},e.inherits=r(5717),e._extend=function(t,e){if(!e||!x(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var q="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(q&&t[q]){var e;if("function"!=typeof(e=t[q]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,q,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),o=[],a=0;a{"use strict";var n=r(9804),o=r(3083),a=r(1924),i=a("Object.prototype.toString"),c=r(6410)(),u="undefined"==typeof globalThis?r.g:globalThis,l=o(),s=a("String.prototype.slice"),f={},p=r(882),y=Object.getPrototypeOf;c&&p&&y&&n(l,(function(t){if("function"==typeof u[t]){var e=new u[t];if(Symbol.toStringTag in e){var r=y(e),n=p(r,Symbol.toStringTag);if(!n){var o=y(r);n=p(o,Symbol.toStringTag)}f[t]=n.get}}}));var g=r(5692);t.exports=function(t){return!!g(t)&&(c&&Symbol.toStringTag in t?function(t){var e=!1;return n(f,(function(r,n){if(!e)try{var o=r.call(t);o===n&&(e=o)}catch(t){}})),e}(t):s(i(t),8,-1))}},9496:t=>{"use strict";t.exports=require("vscode")},7666:()=>{},3083:(t,e,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],o="undefined"==typeof globalThis?r.g:globalThis;t.exports=function(){for(var t=[],e=0;e{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var n={};(()=>{var t=n;const e=r(9282),o=r(7666),a=r(9496),i=void 0===o.homedir,c=6e3;function u(t){return new Promise((e=>setTimeout(e,t)))}function l(t){console.log("###RAINBOW_CSV_UNIT_TEST_MESSAGE### "+t)}t.run=async function(){try{l("Starting tests"),e.equal(-1,[1,2,3].indexOf(0)),e(a.workspace.workspaceFolders),e.equal(1,a.workspace.workspaceFolders.length);let t=a.workspace.workspaceFolders[0].uri;if(await async function(t){let r=a.Uri.joinPath(t,"test","csv_files","lorem_ipsum.txt"),n=await a.workspace.openTextDocument(r);l(`languageId for lorem_ipsum.txt: ${n.languageId}`),e.equal(n.languageId,"plaintext");let o=await a.window.showTextDocument(n);await u(1e3),r=a.Uri.joinPath(t,"test","suite","index.js"),n=await a.workspace.openTextDocument(r),l(`languageId for index.js: ${n.languageId}`),e.equal(n.languageId,"javascript"),o=await a.window.showTextDocument(n),await u(1e3),r=a.Uri.joinPath(t,"test","csv_files","lorem_ipsum"),n=await a.workspace.openTextDocument(r),l(`languageId for lorem_ipsum: ${n.languageId}`),e.equal(n.languageId,"plaintext"),o=await a.window.showTextDocument(n),await u(1e3)}(t),!i){let t=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});e(t.initialized),e(!t.lazy_loaded)}if(await async function(t){let r=a.Uri.joinPath(t,"test","csv_files","university_ranking_semicolon.txt"),n=await a.workspace.openTextDocument(r);await a.window.showTextDocument(n),l(`languageId for university_ranking_semicolon.txt: ${n.languageId}`),e.equal(n.languageId,"csv (semicolon)"),await u(1e3)}(t),await async function(t){let r=a.Uri.joinPath(t,"test","csv_files","small_movies.pipe"),n=await a.workspace.openTextDocument(r);l(`languageId for small_movies.pipe: ${n.languageId}`),e.equal(n.languageId,"plaintext"),await a.window.showTextDocument(n),await u(1e3);for(let t=0;t<6;t++)await a.commands.executeCommand("cursorRight");await a.commands.executeCommand("cursorRightSelect"),await u(1e3),await a.commands.executeCommand("rainbow-csv.RainbowSeparator"),await u(2e3),l(`languageId for small_movies.pipe after RainbowSeparator: ${n.languageId}`),e.equal(n.languageId,"csv (pipe)"),await a.commands.executeCommand("rainbow-csv.RainbowSeparatorOff"),await u(2e3),l(`languageId for small_movies.pipe after RainbowSeparatorOff: ${n.languageId}`),e.equal(n.languageId,"plaintext"),await u(1e3)}(t),!i){let t=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});e(t.initialized),e(!t.lazy_loaded)}if(i?await async function(t){let r=a.Uri.joinPath(t,"test","csv_files","university_ranking.csv"),n=await a.workspace.openTextDocument(r),o=await a.window.showTextDocument(n);await u(1e3);let i={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 a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c);let s=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});e.equal('["null values in output were replaced by empty strings"]',JSON.stringify(s.warnings)),n=a.window.activeTextEditor.document;let f=n.getText().length;l(`Length after first js query: ${f}`),e.equal(846,f),i={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),n=a.window.activeTextEditor.document,f=n.getText().length,l(`Length after second js query: ${f}`),e.equal(267,f),i={rbql_backend:"js",rbql_query:"select nonexistent_function(a1)"},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),s=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),e.equal("query execution",s.error_type),e.equal("At record 1, Details: nonexistent_function is not defined",s.error_msg),l("Starting multiline records test"),r=a.Uri.joinPath(t,"test","csv_files","synthetic_rfc_newline_data.csv"),n=await a.workspace.openTextDocument(r),o=await a.window.showTextDocument(n),await u(1e3),i={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),n=a.window.activeTextEditor.document,f=n.getText().length,l(`Length after js multiline-record query: ${f}`),e.equal(644,f)}(t):await async function(t){let r=a.Uri.joinPath(t,"test","csv_files","university_ranking.csv"),n=await a.workspace.openTextDocument(r),o=await a.window.showTextDocument(n);await u(1e3);let i={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 a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c);let s=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});e.equal('["None values in output were replaced by empty strings"]',JSON.stringify(s.warnings)),n=a.window.activeTextEditor.document;let f=n.getText().length;l(`Length after python query: ${f}`),e.equal(868,f),i={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),n=a.window.activeTextEditor.document,f=n.getText().length,l(`Length after js query: ${f}`),e.equal(268,f),i={rbql_backend:"python",rbql_query:"select nonexistent_function(a1)"},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),s=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),e.equal("query execution",s.error_type),e.equal("At record 1, Details: name 'nonexistent_function' is not defined",s.error_msg),r=a.Uri.joinPath(t,"test","csv_files","synthetic_rfc_newline_data.csv"),n=await a.workspace.openTextDocument(r),o=await a.window.showTextDocument(n),await u(1e3),i={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),n=a.window.activeTextEditor.document,f=n.getText().length,l(`Length after js multiline-record query: ${f}`),e.equal(645,f),r=a.Uri.joinPath(t,"test","csv_files","university_ranking.csv"),n=await a.workspace.openTextDocument(r),o=await a.window.showTextDocument(n),await u(1e3),i={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 a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),s=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),e.equal('["The first record in JOIN file countries.csv was also treated as header (and skipped)"]',JSON.stringify(s.warnings)),n=a.window.activeTextEditor.document,f=n.getText().length,l(`Length after join query: ${f}`),e.equal(11592,f),e.equal(202,n.lineCount),r=a.Uri.joinPath(t,"test","csv_files","countries.csv"),n=await a.workspace.openTextDocument(r);let p=n.fileName,y=n.getText().length;o=await a.window.showTextDocument(n),e(-1==n.getText().indexOf("oceania")),e(n.getText().indexOf("OCEANIA")>0),await u(1e3),i={rbql_backend:"python",with_headers:!0,rbql_query:"UPDATE set a.Region = a.Region.lower()"},await a.commands.executeCommand("rainbow-csv.RBQL",i),await u(c),s=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),e.equal("[]",JSON.stringify(s.warnings)),n=a.window.activeTextEditor.document,n.fileName,f=n.getText().length,l(`Length after update query: ${f}`),e.equal(y,f-n.lineCount+1),e(-1==n.getText().indexOf("OCEANIA")),e(n.getText().indexOf("oceania")>0),await u(1e3),await a.commands.executeCommand("rainbow-csv.CopyBack"),await u(1e3),n=await a.workspace.openTextDocument(r);let g=n.fileName;e.equal(p,g),e(-1==n.getText().indexOf("OCEANIA")),e(n.getText().indexOf("oceania")>0)}(t),!i){let t=await a.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});e(t.initialized),e(t.lazy_loaded)}await async function(t){let r=a.Uri.joinPath(t,"test","csv_files","university_ranking.csv"),n=await a.workspace.openTextDocument(r),o=(await a.window.showTextDocument(n),n.getText().length);l(`Original length: ${o}`),e.equal(12538,o),await u(2e3),await a.commands.executeCommand("rainbow-csv.Align");let i=n.getText().length;l(`Aligned length: ${i}`),e.equal(25896,i),e(i>o);let c=await a.commands.executeCommand("rainbow-csv.CSVLint");e.equal(c,"OK"),await u(2e3),await a.commands.executeCommand("rainbow-csv.Shrink");let s=n.getText().length;l(`Shrinked length: ${s}`),e.equal(o,s),await u(500);let f="foobar,";await a.commands.executeCommand("default:type",{text:f}),c=await a.commands.executeCommand("rainbow-csv.CSVLint"),e(-1!=c.indexOf("Number of fields is not consistent")),await u(500);for(let t=0;t\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = require('./internal/errors'),\n _require$codes = _require.codes,\n ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,\n ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n\nvar AssertionError = require('./internal/assert/assertion_error');\n\nvar _require2 = require('util/'),\n inspect = _require2.inspect;\n\nvar _require$types = require('util/').types,\n isPromise = _require$types.isPromise,\n isRegExp = _require$types.isRegExp;\n\nvar objectAssign = Object.assign ? Object.assign : require('es6-object-assign').assign;\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar errorCache = new Map();\nvar isDeepEqual;\nvar isDeepStrictEqual;\nvar parseExpressionAt;\nvar findNodeAround;\nvar decoder;\n\nfunction lazyLoadComparison() {\n var comparison = require('./internal/util/comparisons');\n\n isDeepEqual = comparison.isDeepEqual;\n isDeepStrictEqual = comparison.isDeepStrictEqual;\n} // Escape control characters but not \\n and \\t to keep the line breaks and\n// indentation intact.\n// eslint-disable-next-line no-control-regex\n\n\nvar escapeSequencesRegExp = /[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g;\nvar meta = [\"\\\\u0000\", \"\\\\u0001\", \"\\\\u0002\", \"\\\\u0003\", \"\\\\u0004\", \"\\\\u0005\", \"\\\\u0006\", \"\\\\u0007\", '\\\\b', '', '', \"\\\\u000b\", '\\\\f', '', \"\\\\u000e\", \"\\\\u000f\", \"\\\\u0010\", \"\\\\u0011\", \"\\\\u0012\", \"\\\\u0013\", \"\\\\u0014\", \"\\\\u0015\", \"\\\\u0016\", \"\\\\u0017\", \"\\\\u0018\", \"\\\\u0019\", \"\\\\u001a\", \"\\\\u001b\", \"\\\\u001c\", \"\\\\u001d\", \"\\\\u001e\", \"\\\\u001f\"];\n\nvar escapeFn = function escapeFn(str) {\n return meta[str.charCodeAt(0)];\n};\n\nvar warned = false; // The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\nvar NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction innerFail(obj) {\n if (obj.message instanceof Error) throw obj.message;\n throw new AssertionError(obj);\n}\n\nfunction fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length;\n var internalMessage;\n\n if (argsLen === 0) {\n internalMessage = 'Failed';\n } else if (argsLen === 1) {\n message = actual;\n actual = undefined;\n } else {\n if (warned === false) {\n warned = true;\n var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);\n warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');\n }\n\n if (argsLen === 2) operator = '!=';\n }\n\n if (message instanceof Error) throw message;\n var errArgs = {\n actual: actual,\n expected: expected,\n operator: operator === undefined ? 'fail' : operator,\n stackStartFn: stackStartFn || fail\n };\n\n if (message !== undefined) {\n errArgs.message = message;\n }\n\n var err = new AssertionError(errArgs);\n\n if (internalMessage) {\n err.message = internalMessage;\n err.generatedMessage = true;\n }\n\n throw err;\n}\n\nassert.fail = fail; // The AssertionError is defined in internal/error.\n\nassert.AssertionError = AssertionError;\n\nfunction innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = false;\n\n if (argLen === 0) {\n generatedMessage = true;\n message = 'No value argument passed to `assert.ok()`';\n } else if (message instanceof Error) {\n throw message;\n }\n\n var err = new AssertionError({\n actual: value,\n expected: true,\n message: message,\n operator: '==',\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n} // Pure assertion tests whether a value is truthy, as determined\n// by !!value.\n\n\nfunction ok() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n innerOk.apply(void 0, [ok, args.length].concat(args));\n}\n\nassert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.\n\n/* eslint-disable no-restricted-properties */\n\nassert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual != expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '==',\n stackStartFn: equal\n });\n }\n}; // The non-equality assertion tests for whether two objects are not\n// equal with !=.\n\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual == expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '!=',\n stackStartFn: notEqual\n });\n }\n}; // The equivalence assertion tests a deep equality relation.\n\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepEqual',\n stackStartFn: deepEqual\n });\n }\n}; // The non-equivalence assertion tests for any deep inequality.\n\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepEqual',\n stackStartFn: notDeepEqual\n });\n }\n};\n/* eslint-enable */\n\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepStrictEqual',\n stackStartFn: deepStrictEqual\n });\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\n\nfunction notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepStrictEqual',\n stackStartFn: notDeepStrictEqual\n });\n }\n}\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (!objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'strictEqual',\n stackStartFn: strictEqual\n });\n }\n};\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notStrictEqual',\n stackStartFn: notStrictEqual\n });\n }\n};\n\nvar Comparison = function Comparison(obj, keys, actual) {\n var _this = this;\n\n _classCallCheck(this, Comparison);\n\n keys.forEach(function (key) {\n if (key in obj) {\n if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {\n _this[key] = actual[key];\n } else {\n _this[key] = obj[key];\n }\n }\n });\n};\n\nfunction compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {\n if (!message) {\n // Create placeholder objects to create a nice output.\n var a = new Comparison(actual, keys);\n var b = new Comparison(expected, keys, actual);\n var err = new AssertionError({\n actual: a,\n expected: b,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.actual = actual;\n err.expected = expected;\n err.operator = fn.name;\n throw err;\n }\n\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n}\n\nfunction expectedException(actual, expected, msg, fn) {\n if (typeof expected !== 'function') {\n if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.\n\n if (arguments.length === 2) {\n throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);\n } // Handle primitives properly.\n\n\n if (_typeof(actual) !== 'object' || actual === null) {\n var err = new AssertionError({\n actual: actual,\n expected: expected,\n message: msg,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.operator = fn.name;\n throw err;\n }\n\n var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared\n // as well.\n\n if (expected instanceof Error) {\n keys.push('name', 'message');\n } else if (keys.length === 0) {\n throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n keys.forEach(function (key) {\n if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {\n return;\n }\n\n compareExceptionKey(actual, expected, key, msg, keys, fn);\n });\n return true;\n } // Guard instanceof against arrow functions as they don't have a prototype.\n\n\n if (expected.prototype !== undefined && actual instanceof expected) {\n return true;\n }\n\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n\n return expected.call({}, actual) === true;\n}\n\nfunction getActual(fn) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);\n }\n\n try {\n fn();\n } catch (e) {\n return e;\n }\n\n return NO_EXCEPTION_SENTINEL;\n}\n\nfunction checkIsPromise(obj) {\n // Accept native ES6 promises and promises that are implemented in a similar\n // way. Do not accept thenables that use a function as `obj` and that have no\n // `catch` handler.\n // TODO: thenables are checked up until they have the correct methods,\n // but according to documentation, the `then` method should receive\n // the `fulfill` and `reject` arguments as well or it may be never resolved.\n return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';\n}\n\nfunction waitForActual(promiseFn) {\n return Promise.resolve().then(function () {\n var resultPromise;\n\n if (typeof promiseFn === 'function') {\n // Return a rejected promise if `promiseFn` throws synchronously.\n resultPromise = promiseFn(); // Fail in case no promise is returned.\n\n if (!checkIsPromise(resultPromise)) {\n throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);\n }\n } else if (checkIsPromise(promiseFn)) {\n resultPromise = promiseFn;\n } else {\n throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);\n }\n\n return Promise.resolve().then(function () {\n return resultPromise;\n }).then(function () {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function (e) {\n return e;\n });\n });\n}\n\nfunction expectsError(stackStartFn, actual, error, message) {\n if (typeof error === 'string') {\n if (arguments.length === 4) {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (_typeof(actual) === 'object' && actual !== null) {\n if (actual.message === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error message \\\"\".concat(actual.message, \"\\\" is identical to the message.\"));\n }\n } else if (actual === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error \\\"\".concat(actual, \"\\\" is identical to the message.\"));\n }\n\n message = error;\n error = undefined;\n } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = '';\n\n if (error && error.name) {\n details += \" (\".concat(error.name, \")\");\n }\n\n details += message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';\n innerFail({\n actual: undefined,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn: stackStartFn\n });\n }\n\n if (error && !expectedException(actual, error, message, stackStartFn)) {\n throw actual;\n }\n}\n\nfunction expectsNoError(stackStartFn, actual, error, message) {\n if (actual === NO_EXCEPTION_SENTINEL) return;\n\n if (typeof error === 'string') {\n message = error;\n error = undefined;\n }\n\n if (!error || expectedException(actual, error)) {\n var details = message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';\n innerFail({\n actual: actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, \"\\n\") + \"Actual message: \\\"\".concat(actual && actual.message, \"\\\"\"),\n stackStartFn: stackStartFn\n });\n }\n\n throw actual;\n}\n\nassert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));\n};\n\nassert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n\n return waitForActual(promiseFn).then(function (result) {\n return expectsError.apply(void 0, [rejects, result].concat(args));\n });\n};\n\nassert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n};\n\nassert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n args[_key5 - 1] = arguments[_key5];\n }\n\n return waitForActual(fn).then(function (result) {\n return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));\n });\n};\n\nassert.ifError = function ifError(err) {\n if (err !== null && err !== undefined) {\n var message = 'ifError got unwanted exception: ';\n\n if (_typeof(err) === 'object' && typeof err.message === 'string') {\n if (err.message.length === 0 && err.constructor) {\n message += err.constructor.name;\n } else {\n message += err.message;\n }\n } else {\n message += inspect(err);\n }\n\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: 'ifError',\n message: message,\n stackStartFn: ifError\n }); // Make sure we actually have a stack trace!\n\n var origStack = err.stack;\n\n if (typeof origStack === 'string') {\n // This will remove any duplicated frames from the error frames taken\n // from within `ifError` and add the original error frames to the newly\n // created ones.\n var tmp2 = origStack.split('\\n');\n tmp2.shift(); // Filter all frames existing in err.stack.\n\n var tmp1 = newErr.stack.split('\\n');\n\n for (var i = 0; i < tmp2.length; i++) {\n // Find the first occurrence of the frame.\n var pos = tmp1.indexOf(tmp2[i]);\n\n if (pos !== -1) {\n // Only keep new frames.\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n\n newErr.stack = \"\".concat(tmp1.join('\\n'), \"\\n\").concat(tmp2.join('\\n'));\n }\n\n throw newErr;\n }\n}; // Expose a strict only variant of assert\n\n\nfunction strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n innerOk.apply(void 0, [strict, args.length].concat(args));\n}\n\nassert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n});\nassert.strict.strict = assert.strict;","// Currently in sync with Node.js lib/internal/assert/assertion_error.js\n// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar _require = require('util/'),\n inspect = _require.inspect;\n\nvar _require2 = require('../errors'),\n ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n\n\nfunction repeat(str, count) {\n count = Math.floor(count);\n if (str.length == 0 || count == 0) return '';\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n\n while (count) {\n str += str;\n count--;\n }\n\n str += str.substring(0, maxCount - str.length);\n return str;\n}\n\nvar blue = '';\nvar green = '';\nvar red = '';\nvar white = '';\nvar kReadableOperator = {\n deepStrictEqual: 'Expected values to be strictly deep-equal:',\n strictEqual: 'Expected values to be strictly equal:',\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: 'Expected values to be loosely deep-equal:',\n equal: 'Expected values to be loosely equal:',\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: 'Values identical but not reference-equal:'\n}; // Comparing short primitives should just show === / !== instead of using the\n// diff.\n\nvar kMaxShortLength = 10;\n\nfunction copyError(source) {\n var keys = Object.keys(source);\n var target = Object.create(Object.getPrototypeOf(source));\n keys.forEach(function (key) {\n target[key] = source[key];\n });\n Object.defineProperty(target, 'message', {\n value: source.message\n });\n return target;\n}\n\nfunction inspectValue(val) {\n // The util.inspect default values could be changed. This makes sure the\n // error messages contain the necessary information nevertheless.\n return inspect(val, {\n compact: false,\n customInspect: false,\n depth: 1000,\n maxArrayLength: Infinity,\n // Assert compares only enumerable properties (with a few exceptions).\n showHidden: false,\n // Having a long line as error is better than wrapping the line for\n // comparison for now.\n // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we\n // have meta information about the inspected properties (i.e., know where\n // in what line the property starts and ends).\n breakLength: Infinity,\n // Assert does not detect proxies currently.\n showProxy: false,\n sorted: true,\n // Inspect getters as we also check them when comparing entries.\n getters: true\n });\n}\n\nfunction createErrDiff(actual, expected, operator) {\n var other = '';\n var res = '';\n var lastPos = 0;\n var end = '';\n var skipped = false;\n var actualInspected = inspectValue(actual);\n var actualLines = actualInspected.split('\\n');\n var expectedLines = inspectValue(expected).split('\\n');\n var i = 0;\n var indicator = ''; // In case both values are objects explicitly mark them as not reference equal\n // for the `strictEqual` operator.\n\n if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {\n operator = 'strictEqualObject';\n } // If \"actual\" and \"expected\" fit on a single line and they are not strictly\n // equal, check further special handling.\n\n\n if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of \"actual\" and \"expected\" together is less than\n // kMaxShortLength and if neither is an object and at least one of them is\n // not `zero`, use the strict equal comparison to visualize the output.\n\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {\n // -0 === +0\n return \"\".concat(kReadableOperator[operator], \"\\n\\n\") + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], \"\\n\");\n }\n } else if (operator !== 'strictEqualObject') {\n // If the stderr is a tty and the input length is lower than the current\n // columns per line, add a mismatch indicator below the output. If it is\n // not a tty, use a default value of 80 characters.\n var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;\n\n if (inputLength < maxLength) {\n while (actualLines[0][i] === expectedLines[0][i]) {\n i++;\n } // Ignore the first characters.\n\n\n if (i > 2) {\n // Add position indicator for the first mismatch in case it is a\n // single line and the input length is less than the column length.\n indicator = \"\\n \".concat(repeat(' ', i), \"^\");\n i = 0;\n }\n }\n }\n } // Remove all ending lines that match (this optimizes the output for\n // readability by reducing the number of total changed lines).\n\n\n var a = actualLines[actualLines.length - 1];\n var b = expectedLines[expectedLines.length - 1];\n\n while (a === b) {\n if (i++ < 2) {\n end = \"\\n \".concat(a).concat(end);\n } else {\n other = a;\n }\n\n actualLines.pop();\n expectedLines.pop();\n if (actualLines.length === 0 || expectedLines.length === 0) break;\n a = actualLines[actualLines.length - 1];\n b = expectedLines[expectedLines.length - 1];\n }\n\n var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.\n // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })\n\n if (maxLines === 0) {\n // We have to get the result again. The lines were all removed before.\n var _actualLines = actualInspected.split('\\n'); // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (_actualLines.length > 30) {\n _actualLines[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (_actualLines.length > 27) {\n _actualLines.pop();\n }\n }\n\n return \"\".concat(kReadableOperator.notIdentical, \"\\n\\n\").concat(_actualLines.join('\\n'), \"\\n\");\n }\n\n if (i > 3) {\n end = \"\\n\".concat(blue, \"...\").concat(white).concat(end);\n skipped = true;\n }\n\n if (other !== '') {\n end = \"\\n \".concat(other).concat(end);\n other = '';\n }\n\n var printedLines = 0;\n var msg = kReadableOperator[operator] + \"\\n\".concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white);\n var skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n\n for (i = 0; i < maxLines; i++) {\n // Only extra expected lines exist\n var cur = i - lastPos;\n\n if (actualLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(expectedLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(expectedLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the expected line to the cache.\n\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]);\n printedLines++; // Only extra actual lines exist\n } else if (expectedLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLines[i]);\n printedLines++; // Lines diverge\n } else {\n var expectedLine = expectedLines[i];\n var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by\n // a trailing comma. In that case it is actually identical and we should\n // mark it as such.\n\n var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,\n // add a comma at the end of the actual line. Otherwise the output could\n // look weird as in:\n //\n // [\n // 1 // No comma at the end!\n // + 2\n // ]\n //\n\n if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {\n divergingLines = false;\n actualLine += ',';\n }\n\n if (divergingLines) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result and cache the expected diverging\n // line so consecutive diverging lines show up as +++--- and not +-+-+-.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLine);\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLine);\n printedLines += 2; // Lines are identical\n } else {\n // Add all cached information to the result before adding other things\n // and reset the cache.\n res += other;\n other = ''; // If the last diverging line is exactly one line above or if it is the\n // very first line, add the line to the result.\n\n if (cur === 1 || i === 0) {\n res += \"\\n \".concat(actualLine);\n printedLines++;\n }\n }\n } // Inspected object to big (Show ~20 rows max)\n\n\n if (printedLines > 20 && i < maxLines - 2) {\n return \"\".concat(msg).concat(skippedMsg, \"\\n\").concat(res, \"\\n\").concat(blue, \"...\").concat(white).concat(other, \"\\n\") + \"\".concat(blue, \"...\").concat(white);\n }\n }\n\n return \"\".concat(msg).concat(skipped ? skippedMsg : '', \"\\n\").concat(res).concat(other).concat(end).concat(indicator);\n}\n\nvar AssertionError =\n/*#__PURE__*/\nfunction (_Error) {\n _inherits(AssertionError, _Error);\n\n function AssertionError(options) {\n var _this;\n\n _classCallCheck(this, AssertionError);\n\n if (_typeof(options) !== 'object' || options === null) {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n\n var message = options.message,\n operator = options.operator,\n stackStartFn = options.stackStartFn;\n var actual = options.actual,\n expected = options.expected;\n var limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n\n if (message != null) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));\n } else {\n if (process.stderr && process.stderr.isTTY) {\n // Reset on each call to make sure we handle dynamically set environment\n // variables correct.\n if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {\n blue = \"\\x1B[34m\";\n green = \"\\x1B[32m\";\n white = \"\\x1B[39m\";\n red = \"\\x1B[31m\";\n } else {\n blue = '';\n green = '';\n white = '';\n red = '';\n }\n } // Prevent the error stack from being visible by duplicating the error\n // in a very close way to the original in case both sides are actually\n // instances of Error.\n\n\n if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {\n actual = copyError(actual);\n expected = copyError(expected);\n }\n\n if (operator === 'deepStrictEqual' || operator === 'strictEqual') {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));\n } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {\n // In case the objects are equal but the operator requires unequal, show\n // the first object and say A equals B\n var base = kReadableOperator[operator];\n var res = inspectValue(actual).split('\\n'); // In case \"actual\" is an object, it should not be reference equal.\n\n if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {\n base = kReadableOperator.notStrictEqualObject;\n } // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (res.length > 30) {\n res[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (res.length > 27) {\n res.pop();\n }\n } // Only print a single input.\n\n\n if (res.length === 1) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \" \").concat(res[0])));\n } else {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \"\\n\\n\").concat(res.join('\\n'), \"\\n\")));\n }\n } else {\n var _res = inspectValue(actual);\n\n var other = '';\n var knownOperators = kReadableOperator[operator];\n\n if (operator === 'notDeepEqual' || operator === 'notEqual') {\n _res = \"\".concat(kReadableOperator[operator], \"\\n\\n\").concat(_res);\n\n if (_res.length > 1024) {\n _res = \"\".concat(_res.slice(0, 1021), \"...\");\n }\n } else {\n other = \"\".concat(inspectValue(expected));\n\n if (_res.length > 512) {\n _res = \"\".concat(_res.slice(0, 509), \"...\");\n }\n\n if (other.length > 512) {\n other = \"\".concat(other.slice(0, 509), \"...\");\n }\n\n if (operator === 'deepEqual' || operator === 'equal') {\n _res = \"\".concat(knownOperators, \"\\n\\n\").concat(_res, \"\\n\\nshould equal\\n\\n\");\n } else {\n other = \" \".concat(operator, \" \").concat(other);\n }\n }\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(_res).concat(other)));\n }\n }\n\n Error.stackTraceLimit = limit;\n _this.generatedMessage = !message;\n Object.defineProperty(_assertThisInitialized(_this), 'name', {\n value: 'AssertionError [ERR_ASSERTION]',\n enumerable: false,\n writable: true,\n configurable: true\n });\n _this.code = 'ERR_ASSERTION';\n _this.actual = actual;\n _this.expected = expected;\n _this.operator = operator;\n\n if (Error.captureStackTrace) {\n // eslint-disable-next-line no-restricted-syntax\n Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);\n } // Create error message including the error code in the name.\n\n\n _this.stack; // Reset the name.\n\n _this.name = 'AssertionError';\n return _possibleConstructorReturn(_this);\n }\n\n _createClass(AssertionError, [{\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n }, {\n key: inspect.custom,\n value: function value(recurseTimes, ctx) {\n // This limits the `actual` and `expected` property default inspection to\n // the minimum depth. Otherwise those values would be too verbose compared\n // to the actual error message which contains a combined view of these two\n // input values.\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: false,\n depth: 0\n }));\n }\n }]);\n\n return AssertionError;\n}(_wrapNativeSuper(Error));\n\nmodule.exports = AssertionError;","// Currently in sync with Node.js lib/internal/errors.js\n// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f\n\n/* eslint node-core/documented-errors: \"error\" */\n\n/* eslint node-core/alphabetize-errors: \"error\" */\n\n/* eslint node-core/prefer-util-format-errors: \"error\" */\n'use strict'; // The whole point behind this internal module is to allow Node.js to no\n// longer be forced to treat every error message change as a semver-major\n// change. The NodeError classes here all expose a `code` property whose\n// value statically and permanently identifies the error. While the error\n// message may change, the code should not.\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar codes = {}; // Lazy loaded\n\nvar assert;\nvar util;\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inherits(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n var _this;\n\n _classCallCheck(this, NodeError);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));\n _this.code = code;\n return _this;\n }\n\n return NodeError;\n }(Base);\n\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The \"%s\" argument is ambiguous. %s', TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n if (assert === undefined) assert = require('../assert');\n assert(typeof name === 'string', \"'name' must be a string\"); // determiner: 'must be' or 'must not be'\n\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } // TODO(BridgeAR): Improve the output by showing `null` and similar.\n\n\n msg += \". Received type \".concat(_typeof(actual));\n return msg;\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {\n var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';\n if (util === undefined) util = require('util/');\n var inspected = util.inspect(value);\n\n if (inspected.length > 128) {\n inspected = \"\".concat(inspected.slice(0, 128), \"...\");\n }\n\n return \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n}, TypeError, RangeError);\ncreateErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {\n var type;\n\n if (value && value.constructor && value.constructor.name) {\n type = \"instance of \".concat(value.constructor.name);\n } else {\n type = \"type \".concat(_typeof(value));\n }\n\n return \"Expected \".concat(input, \" to be returned from the \\\"\").concat(name, \"\\\"\") + \" function but got \".concat(type, \".\");\n}, TypeError);\ncreateErrorType('ERR_MISSING_ARGS', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (assert === undefined) assert = require('../assert');\n assert(args.length > 0, 'At least one arg needs to be specified');\n var msg = 'The ';\n var len = args.length;\n args = args.map(function (a) {\n return \"\\\"\".concat(a, \"\\\"\");\n });\n\n switch (len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n\n default:\n msg += args.slice(0, len - 1).join(', ');\n msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n\n return \"\".concat(msg, \" must be specified\");\n}, TypeError);\nmodule.exports.codes = codes;","// Currently in sync with Node.js lib/internal/util/comparisons.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n'use strict';\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar regexFlagsSupported = /a/g.flags !== undefined;\n\nvar arrayFromSet = function arrayFromSet(set) {\n var array = [];\n set.forEach(function (value) {\n return array.push(value);\n });\n return array;\n};\n\nvar arrayFromMap = function arrayFromMap(map) {\n var array = [];\n map.forEach(function (value, key) {\n return array.push([key, value]);\n });\n return array;\n};\n\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {\n return [];\n};\nvar numberIsNaN = Number.isNaN ? Number.isNaN : require('is-nan');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);\nvar propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);\nvar objectToString = uncurryThis(Object.prototype.toString);\n\nvar _require$types = require('util/').types,\n isAnyArrayBuffer = _require$types.isAnyArrayBuffer,\n isArrayBufferView = _require$types.isArrayBufferView,\n isDate = _require$types.isDate,\n isMap = _require$types.isMap,\n isRegExp = _require$types.isRegExp,\n isSet = _require$types.isSet,\n isNativeError = _require$types.isNativeError,\n isBoxedPrimitive = _require$types.isBoxedPrimitive,\n isNumberObject = _require$types.isNumberObject,\n isStringObject = _require$types.isStringObject,\n isBooleanObject = _require$types.isBooleanObject,\n isBigIntObject = _require$types.isBigIntObject,\n isSymbolObject = _require$types.isSymbolObject,\n isFloat32Array = _require$types.isFloat32Array,\n isFloat64Array = _require$types.isFloat64Array;\n\nfunction isNonIndex(key) {\n if (key.length === 0 || key.length > 10) return true;\n\n for (var i = 0; i < key.length; i++) {\n var code = key.charCodeAt(i);\n if (code < 48 || code > 57) return true;\n } // The maximum size for an array is 2 ** 32 -1.\n\n\n return key.length === 10 && key >= Math.pow(2, 32);\n}\n\nfunction getOwnNonIndexProperties(value) {\n return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));\n} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js\n// original notice:\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n\nfunction compare(a, b) {\n if (a === b) {\n return 0;\n }\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) {\n return -1;\n }\n\n if (y < x) {\n return 1;\n }\n\n return 0;\n}\n\nvar ONLY_ENUMERABLE = undefined;\nvar kStrict = true;\nvar kLoose = false;\nvar kNoIterator = 0;\nvar kIsArray = 1;\nvar kIsSet = 2;\nvar kIsMap = 3; // Check if they have the same source and flags\n\nfunction areSimilarRegExps(a, b) {\n return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);\n}\n\nfunction areSimilarFloatArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n for (var offset = 0; offset < a.byteLength; offset++) {\n if (a[offset] !== b[offset]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction areSimilarTypedArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;\n}\n\nfunction areEqualArrayBuffers(buf1, buf2) {\n return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;\n}\n\nfunction isEqualBoxedPrimitive(val1, val2) {\n if (isNumberObject(val1)) {\n return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));\n }\n\n if (isStringObject(val1)) {\n return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);\n }\n\n if (isBooleanObject(val1)) {\n return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);\n }\n\n if (isBigIntObject(val1)) {\n return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);\n }\n\n return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);\n} // Notes: Type tags are historical [[Class]] properties that can be set by\n// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS\n// and retrieved using Object.prototype.toString.call(obj) in JS\n// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring\n// for a list of tags pre-defined in the spec.\n// There are some unspecified tags in the wild too (e.g. typed array tags).\n// Since tags can be altered, they only serve fast failures\n//\n// Typed arrays and buffers are checked by comparing the content in their\n// underlying ArrayBuffer. This optimization requires that it's\n// reasonable to interpret their underlying memory in the same way,\n// which is checked by comparing their type tags.\n// (e.g. a Uint8Array and a Uint16Array with the same memory content\n// could still be different because they will be interpreted differently).\n//\n// For strict comparison, objects should have\n// a) The same built-in type tags\n// b) The same prototypes.\n\n\nfunction innerDeepEqual(val1, val2, strict, memos) {\n // All identical values are equivalent, as determined by ===.\n if (val1 === val2) {\n if (val1 !== 0) return true;\n return strict ? objectIs(val1, val2) : true;\n } // Check more closely if val1 and val2 are equal.\n\n\n if (strict) {\n if (_typeof(val1) !== 'object') {\n return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);\n }\n\n if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {\n return false;\n }\n\n if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {\n return false;\n }\n } else {\n if (val1 === null || _typeof(val1) !== 'object') {\n if (val2 === null || _typeof(val2) !== 'object') {\n // eslint-disable-next-line eqeqeq\n return val1 == val2;\n }\n\n return false;\n }\n\n if (val2 === null || _typeof(val2) !== 'object') {\n return false;\n }\n }\n\n var val1Tag = objectToString(val1);\n var val2Tag = objectToString(val2);\n\n if (val1Tag !== val2Tag) {\n return false;\n }\n\n if (Array.isArray(val1)) {\n // Check for sparse arrays and general fast path\n if (val1.length !== val2.length) {\n return false;\n }\n\n var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsArray, keys1);\n } // [browserify] This triggers on certain types in IE (Map/Set) so we don't\n // wan't to early return out of the rest of the checks. However we can check\n // if the second value is one of these values and the first isn't.\n\n\n if (val1Tag === '[object Object]') {\n // return keyCheck(val1, val2, strict, memos, kNoIterator);\n if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {\n return false;\n }\n }\n\n if (isDate(val1)) {\n if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {\n return false;\n }\n } else if (isRegExp(val1)) {\n if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {\n return false;\n }\n } else if (isNativeError(val1) || val1 instanceof Error) {\n // Do not compare the stack as it might differ even though the error itself\n // is otherwise identical.\n if (val1.message !== val2.message || val1.name !== val2.name) {\n return false;\n }\n } else if (isArrayBufferView(val1)) {\n if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {\n if (!areSimilarFloatArrays(val1, val2)) {\n return false;\n }\n } else if (!areSimilarTypedArrays(val1, val2)) {\n return false;\n } // Buffer.compare returns true, so val1.length === val2.length. If they both\n // only contain numeric keys, we don't need to exam further than checking\n // the symbols.\n\n\n var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n\n var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (_keys.length !== _keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);\n } else if (isSet(val1)) {\n if (!isSet(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsSet);\n } else if (isMap(val1)) {\n if (!isMap(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsMap);\n } else if (isAnyArrayBuffer(val1)) {\n if (!areEqualArrayBuffers(val1, val2)) {\n return false;\n }\n } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator);\n}\n\nfunction getEnumerables(val, keys) {\n return keys.filter(function (k) {\n return propertyIsEnumerable(val, k);\n });\n}\n\nfunction keyCheck(val1, val2, strict, memos, iterationType, aKeys) {\n // For all remaining Object pairs, including Array, objects and Maps,\n // equivalence is determined by having:\n // a) The same number of owned enumerable properties\n // b) The same set of keys/indexes (although not necessarily the same order)\n // c) Equivalent values for every corresponding key/index\n // d) For Sets and Maps, equal contents\n // Note: this accounts for both named and indexed properties on Arrays.\n if (arguments.length === 5) {\n aKeys = Object.keys(val1);\n var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n } // Cheap key test\n\n\n var i = 0;\n\n for (; i < aKeys.length; i++) {\n if (!hasOwnProperty(val2, aKeys[i])) {\n return false;\n }\n }\n\n if (strict && arguments.length === 5) {\n var symbolKeysA = objectGetOwnPropertySymbols(val1);\n\n if (symbolKeysA.length !== 0) {\n var count = 0;\n\n for (i = 0; i < symbolKeysA.length; i++) {\n var key = symbolKeysA[i];\n\n if (propertyIsEnumerable(val1, key)) {\n if (!propertyIsEnumerable(val2, key)) {\n return false;\n }\n\n aKeys.push(key);\n count++;\n } else if (propertyIsEnumerable(val2, key)) {\n return false;\n }\n }\n\n var symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {\n return false;\n }\n } else {\n var _symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {\n return false;\n }\n }\n }\n\n if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {\n return true;\n } // Use memos to handle cycles.\n\n\n if (memos === undefined) {\n memos = {\n val1: new Map(),\n val2: new Map(),\n position: 0\n };\n } else {\n // We prevent up to two map.has(x) calls by directly retrieving the value\n // and checking for undefined. The map can only contain numbers, so it is\n // safe to check for undefined only.\n var val2MemoA = memos.val1.get(val1);\n\n if (val2MemoA !== undefined) {\n var val2MemoB = memos.val2.get(val2);\n\n if (val2MemoB !== undefined) {\n return val2MemoA === val2MemoB;\n }\n }\n\n memos.position++;\n }\n\n memos.val1.set(val1, memos.position);\n memos.val2.set(val2, memos.position);\n var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);\n memos.val1.delete(val1);\n memos.val2.delete(val2);\n return areEq;\n}\n\nfunction setHasEqualElement(set, val1, strict, memo) {\n // Go looking.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var val2 = setValues[i];\n\n if (innerDeepEqual(val1, val2, strict, memo)) {\n // Remove the matching element to make sure we do not check that again.\n set.delete(val2);\n return true;\n }\n }\n\n return false;\n} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using\n// Sadly it is not possible to detect corresponding values properly in case the\n// type is a string, number, bigint or boolean. The reason is that those values\n// can match lots of different string values (e.g., 1n == '+00001').\n\n\nfunction findLooseMatchingPrimitives(prim) {\n switch (_typeof(prim)) {\n case 'undefined':\n return null;\n\n case 'object':\n // Only pass in null as object!\n return undefined;\n\n case 'symbol':\n return false;\n\n case 'string':\n prim = +prim;\n // Loose equal entries exist only if the string is possible to convert to\n // a regular number and not NaN.\n // Fall through\n\n case 'number':\n if (numberIsNaN(prim)) {\n return false;\n }\n\n }\n\n return true;\n}\n\nfunction setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) return altValue;\n return b.has(altValue) && !a.has(altValue);\n}\n\nfunction mapMightHaveLoosePrim(a, b, prim, item, memo) {\n var altValue = findLooseMatchingPrimitives(prim);\n\n if (altValue != null) {\n return altValue;\n }\n\n var curB = b.get(altValue);\n\n if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {\n return false;\n }\n\n return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);\n}\n\nfunction setEquiv(a, b, strict, memo) {\n // This is a lazily initiated Set of entries which have to be compared\n // pairwise.\n var set = null;\n var aValues = arrayFromSet(a);\n\n for (var i = 0; i < aValues.length; i++) {\n var val = aValues[i]; // Note: Checking for the objects first improves the performance for object\n // heavy sets but it is a minor slow down for primitives. As they are fast\n // to check this improves the worst case scenario instead.\n\n if (_typeof(val) === 'object' && val !== null) {\n if (set === null) {\n set = new Set();\n } // If the specified value doesn't exist in the second set its an not null\n // object (or non strict only: a not matching primitive) we'll need to go\n // hunting for something thats deep-(strict-)equal to it. To make this\n // O(n log n) complexity we have to copy these values in a new set first.\n\n\n set.add(val);\n } else if (!b.has(val)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.\n\n if (!setMightHaveLoosePrim(a, b, val)) {\n return false;\n }\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(val);\n }\n }\n\n if (set !== null) {\n var bValues = arrayFromSet(b);\n\n for (var _i = 0; _i < bValues.length; _i++) {\n var _val = bValues[_i]; // We have to check if a primitive value is already\n // matching and only if it's not, go hunting for it.\n\n if (_typeof(_val) === 'object' && _val !== null) {\n if (!setHasEqualElement(set, _val, strict, memo)) return false;\n } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction mapHasEqualEntry(set, map, key1, item1, strict, memo) {\n // To be able to handle cases like:\n // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])\n // ... we need to consider *all* matching keys, not just the first we find.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var key2 = setValues[i];\n\n if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {\n set.delete(key2);\n return true;\n }\n }\n\n return false;\n}\n\nfunction mapEquiv(a, b, strict, memo) {\n var set = null;\n var aEntries = arrayFromMap(a);\n\n for (var i = 0; i < aEntries.length; i++) {\n var _aEntries$i = _slicedToArray(aEntries[i], 2),\n key = _aEntries$i[0],\n item1 = _aEntries$i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n } else {\n // By directly retrieving the value we prevent another b.has(key) check in\n // almost all possible cases.\n var item2 = b.get(key);\n\n if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null\n // keys.\n\n if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n }\n }\n }\n\n if (set !== null) {\n var bEntries = arrayFromMap(b);\n\n for (var _i2 = 0; _i2 < bEntries.length; _i2++) {\n var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),\n key = _bEntries$_i[0],\n item = _bEntries$_i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;\n } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction objEquiv(a, b, strict, keys, memos, iterationType) {\n // Sets and maps don't have their entries accessible via normal object\n // properties.\n var i = 0;\n\n if (iterationType === kIsSet) {\n if (!setEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsMap) {\n if (!mapEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsArray) {\n for (; i < a.length; i++) {\n if (hasOwnProperty(a, i)) {\n if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {\n return false;\n }\n } else if (hasOwnProperty(b, i)) {\n return false;\n } else {\n // Array is sparse.\n var keysA = Object.keys(a);\n\n for (; i < keysA.length; i++) {\n var key = keysA[i];\n\n if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {\n return false;\n }\n }\n\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n\n return true;\n }\n }\n } // The pair must have equivalent values for every corresponding key.\n // Possibly expensive deep test:\n\n\n for (i = 0; i < keys.length; i++) {\n var _key = keys[i];\n\n if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction isDeepEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kLoose);\n}\n\nfunction isDeepStrictEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kStrict);\n}\n\nmodule.exports = {\n isDeepEqual: isDeepEqual,\n isDeepStrictEqual: isDeepStrictEqual\n};","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar arePropertyDescriptorsSupported = function () {\n\tvar obj = {};\n\ttry {\n\t\torigDefineProperty(obj, 'x', { enumerable: false, value: obj });\n\t\t// eslint-disable-next-line no-unused-vars, no-restricted-syntax\n\t\tfor (var _ in obj) { // jscs:ignore disallowUnusedVariables\n\t\t\treturn false;\n\t\t}\n\t\treturn obj.x === obj;\n\t} catch (e) { /* this is IE 8. */\n\t\treturn false;\n\t}\n};\nvar supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value;\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","/**\n * Code refactored from Mozilla Developer Network:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n */\n\n'use strict';\n\nfunction assign(target, firstSource) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n for (var i = 1; i < arguments.length; i++) {\n var nextSource = arguments[i];\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n return to;\n}\n\nfunction polyfill() {\n if (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: assign\n });\n }\n}\n\nmodule.exports = {\n assign: assign,\n polyfill: polyfill\n};\n","\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function isNaN(value) {\n\treturn value !== value;\n};\n","'use strict';\n\nvar callBind = require('call-bind');\nvar define = require('define-properties');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Number);\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\tif (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) {\n\t\treturn Number.isNaN;\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function shimNumberIsNaN() {\n\tvar polyfill = getPolyfill();\n\tdefine(Number, { isNaN: polyfill }, {\n\t\tisNaN: function testIsNaN() {\n\t\t\treturn Number.isNaN !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","'use strict';\n\nvar numberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t}\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (numberIsNaN(a) && numberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.is === 'function' ? Object.is : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimObjectIs() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { is: polyfill }, {\n\t\tis: function testObjectIs() {\n\t\t\treturn Object.is !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","module.exports = require(\"vscode\");","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","const assert = require('assert');\nconst os = require('os');\n\nconst vscode = require('vscode');\n\nconst is_web_ext = (os.homedir === undefined); // Runs as web extension in browser.\n\n\n// TODO make RBQL command wait for the result to reduce the timeout.\nconst poor_rbql_async_design_workaround_timeout = 6000;\n\n\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n\nfunction log_message(msg) {\n console.log('###RAINBOW_CSV_UNIT_TEST_MESSAGE### ' + msg);\n}\n\n\nasync function test_rbql_node(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n // Test Python query.\n let test_task = {rbql_backend: \"python\", with_headers: true, rbql_query: \"select top 20 a1, math.ceil(float(a.total_score) * 100), a['university_name'], None, 'foo bar' order by a2\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n // Indirectly check reported warnings.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[\"None values in output were replaced by empty strings\"]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n let length_after_query = active_doc.getText().length;\n log_message(`Length after python query: ${length_after_query}`);\n assert.equal(868, length_after_query); // wc -c gives smaller value. Probably VSCode uses '\\r\\n' as line ends.\n\n // Test JS query.\n test_task = {rbql_backend: \"js\", rbql_query: \"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after js query: ${length_after_query}`);\n assert.equal(268, length_after_query);\n\n // Test RBQL query error reporting.\n test_task = {rbql_backend: \"python\", rbql_query: \"select nonexistent_function(a1)\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_report: true});\n assert.equal('query execution', state_report.error_type);\n assert.equal(\"At record 1, Details: name 'nonexistent_function' is not defined\", state_report.error_msg);\n\n // Test with multiline records.\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'synthetic_rfc_newline_data.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n test_task = {rbql_backend: \"js\", rbql_query: \"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR\", enable_rfc_newlines: true};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after js multiline-record query: ${length_after_query}`);\n assert.equal(645, length_after_query);\n\n // Test RBQL JOIN query.\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n test_task = {rbql_backend: \"python\", with_headers: true, 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\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[\"The first record in JOIN file countries.csv was also treated as header (and skipped)\"]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after join query: ${length_after_query}`);\n // Not sure why it is 11592 and not 11610, when saving the file `wc -c` gives 11610.\n assert.equal(11592, length_after_query);\n // We have 202 not 201 because the trailing '\\n' maps to a trailing empty line in VSCode.\n assert.equal(202, active_doc.lineCount);\n\n // Test UPDATE, no warnings and copy back.\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'countries.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n let filename_before = active_doc.fileName;\n let length_before_query = active_doc.getText().length;\n editor = await vscode.window.showTextDocument(active_doc);\n assert(active_doc.getText().indexOf('oceania') == -1);\n assert(active_doc.getText().indexOf('OCEANIA') > 0);\n await sleep(1000);\n\n test_task = {rbql_backend: \"python\", with_headers: true, rbql_query: \"UPDATE set a.Region = a.Region.lower()\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n let filename_after = active_doc.fileName;\n length_after_query = active_doc.getText().length;\n log_message(`Length after update query: ${length_after_query}`);\n // Changing column to lowercase should not affect the doc length if we account for the '\\r\\n' line endings.\n assert.equal(length_before_query, length_after_query - active_doc.lineCount + 1);\n assert(active_doc.getText().indexOf('OCEANIA') == -1);\n assert(active_doc.getText().indexOf('oceania') > 0);\n\n await sleep(1000);\n await vscode.commands.executeCommand('rainbow-csv.CopyBack');\n await sleep(1000);\n active_doc = await vscode.workspace.openTextDocument(uri);\n let filename_after_copy_back = active_doc.fileName;\n // Make sure that the name stays the same as the original doc but the content has changed.\n assert.equal(filename_before, filename_after_copy_back);\n assert(active_doc.getText().indexOf('OCEANIA') == -1);\n assert(active_doc.getText().indexOf('oceania') > 0);\n}\n\n\nasync function test_rbql_web(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n let test_task = {rbql_backend: \"js\", with_headers: true, rbql_query: \"select top 20 a1, Math.ceil(parseFloat(a.total_score) * 100), a['university_name'], null, 'foo bar' order by a2\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n // Indirectly check reported warnings.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[\"null values in output were replaced by empty strings\"]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n let length_after_query = active_doc.getText().length;\n log_message(`Length after first js query: ${length_after_query}`);\n assert.equal(846, length_after_query);\n\n test_task = {rbql_backend: \"js\", rbql_query: \"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after second js query: ${length_after_query}`);\n // 267 instead of 268 because no trailing '\\n' at the end of file.\n assert.equal(267, length_after_query);\n\n // Test RBQL query error reporting.\n test_task = {rbql_backend: \"js\", rbql_query: \"select nonexistent_function(a1)\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_report: true});\n assert.equal('query execution', state_report.error_type);\n assert.equal(\"At record 1, Details: nonexistent_function is not defined\", state_report.error_msg);\n\n // Test with multiline records.\n log_message('Starting multiline records test');\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'synthetic_rfc_newline_data.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n test_task = {rbql_backend: \"js\", rbql_query: \"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR\", enable_rfc_newlines: true};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after js multiline-record query: ${length_after_query}`);\n // 644 instead of 645 because no trailing '\\n' at the end of file.\n assert.equal(644, length_after_query);\n}\n\n\nasync function test_align_shrink_lint(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n let length_original = active_doc.getText().length;\n log_message(`Original length: ${length_original}`)\n assert.equal(12538, length_original);\n await sleep(2000);\n\n await vscode.commands.executeCommand('rainbow-csv.Align');\n let length_aligned = active_doc.getText().length;\n log_message(`Aligned length: ${length_aligned}`)\n assert.equal(25896, length_aligned);\n assert(length_aligned > length_original);\n let lint_report = await vscode.commands.executeCommand('rainbow-csv.CSVLint');\n assert.equal(lint_report, 'OK');\n await sleep(2000);\n\n await vscode.commands.executeCommand('rainbow-csv.Shrink');\n let length_shrinked = active_doc.getText().length;\n log_message(`Shrinked length: ${length_shrinked}`)\n // This is to ensure that after original -> align -> shrink sequence we get back to original doc.\n assert.equal(length_original, length_shrinked);\n await sleep(500);\n\n let text_with_comma = 'foobar,';\n await vscode.commands.executeCommand('default:type', { text: text_with_comma });\n lint_report = await vscode.commands.executeCommand('rainbow-csv.CSVLint');\n assert(lint_report.indexOf('Number of fields is not consistent') != -1);\n await sleep(500);\n\n for (let i = 0; i < text_with_comma.length; i++) {\n await vscode.commands.executeCommand(\"deleteLeft\");\n }\n await sleep(500);\n}\n\n\nasync function test_column_edit(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'movies.txt');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n let length_original = active_doc.getText().length;\n assert.equal(9986, length_original);\n for (let i = 0; i < 10; i++) {\n await vscode.commands.executeCommand(\"cursorRight\");\n }\n await sleep(1000);\n await vscode.commands.executeCommand(\"rainbow-csv.ColumnEditAfter\");\n await sleep(1000);\n let text_with_comma = 'foobar,';\n await vscode.commands.executeCommand('default:type', { text: text_with_comma });\n let length_after_column_edit = active_doc.getText().length;\n assert.equal(length_original + active_doc.lineCount * text_with_comma.length, length_after_column_edit);\n await sleep(1000);\n for (let i = 0; i < text_with_comma.length; i++) {\n await vscode.commands.executeCommand(\"deleteLeft\");\n }\n await sleep(1000);\n let length_after_delete = active_doc.getText().length;\n // Ensure that after multicursor deletion of the added `text_with_comma` text we get back to the original doc.\n assert.equal(length_original, length_after_delete);\n}\n\n\nasync function test_no_autodetection(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'lorem_ipsum.txt');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for lorem_ipsum.txt: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'suite', 'index.js');\n active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for index.js: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'javascript');\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'lorem_ipsum');\n active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for lorem_ipsum: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n}\n\n\nasync function test_autodetection(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking_semicolon.txt');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n log_message(`languageId for university_ranking_semicolon.txt: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'csv (semicolon)');\n await sleep(1000);\n}\n\n\nasync function test_manual_enable_disable(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'small_movies.pipe');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for small_movies.pipe: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n for (let i = 0; i < 6; i++) {\n await vscode.commands.executeCommand(\"cursorRight\");\n }\n await vscode.commands.executeCommand(\"cursorRightSelect\");\n await sleep(1000);\n await vscode.commands.executeCommand('rainbow-csv.RainbowSeparator');\n await sleep(2000);\n log_message(`languageId for small_movies.pipe after RainbowSeparator: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'csv (pipe)');\n await vscode.commands.executeCommand('rainbow-csv.RainbowSeparatorOff');\n await sleep(2000);\n log_message(`languageId for small_movies.pipe after RainbowSeparatorOff: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n await sleep(1000);\n}\n\n\nasync function run() {\n try {\n log_message('Starting tests');\n\n assert.equal(-1, [1, 2, 3].indexOf(0));\n\n assert(vscode.workspace.workspaceFolders);\n assert.equal(1, vscode.workspace.workspaceFolders.length);\n let workspace_folder_uri = vscode.workspace.workspaceFolders[0].uri;\n\n await test_no_autodetection(workspace_folder_uri);\n if (!is_web_ext) {\n // Ensure that opening non-csv files doesn't cause rainbow csv to import relatively heavy lazy-loaded code.\n // There is no point to check this in web since all of the files are bundled into a single script anyway.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_initialization_state: true});\n assert(state_report.initialized);\n assert(!state_report.lazy_loaded);\n }\n\n await test_autodetection(workspace_folder_uri);\n await test_manual_enable_disable(workspace_folder_uri);\n\n if (!is_web_ext) {\n // Ensure that basic operations don't cause rainbow csv to lazy load unnecessary code.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_initialization_state: true});\n assert(state_report.initialized);\n assert(!state_report.lazy_loaded);\n }\n\n if (is_web_ext) {\n await test_rbql_web(workspace_folder_uri);\n } else {\n await test_rbql_node(workspace_folder_uri);\n }\n\n if (!is_web_ext) {\n // Sanity check that after using advanced functionality such as RBQL, the non-basic code is lazy loaded.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_initialization_state: true});\n assert(state_report.initialized);\n assert(state_report.lazy_loaded);\n }\n\n await test_align_shrink_lint(workspace_folder_uri);\n await test_column_edit(workspace_folder_uri);\n\n log_message('Finishing tests');\n } catch (e) {\n log_message('Error: tests have failed. Exception:');\n log_message(String(e));\n log_message(String(e.stack));\n }\n}\n\nexports.run = run;\n"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","isDeepEqual","isDeepStrictEqual","_require$codes","codes","ERR_AMBIGUOUS_ARGUMENT","ERR_INVALID_ARG_TYPE","ERR_INVALID_ARG_VALUE","ERR_INVALID_RETURN_VALUE","ERR_MISSING_ARGS","AssertionError","inspect","_require$types","isPromise","isRegExp","objectAssign","Object","assign","objectIs","is","lazyLoadComparison","comparison","Map","warned","assert","module","exports","ok","NO_EXCEPTION_SENTINEL","innerFail","message","Error","innerOk","fn","argLen","value","generatedMessage","err","actual","expected","operator","stackStartFn","_len","arguments","length","args","Array","_key","apply","concat","fail","internalMessage","argsLen","undefined","warn","process","emitWarning","console","bind","errArgs","equal","notEqual","deepEqual","notDeepEqual","deepStrictEqual","notDeepStrictEqual","strictEqual","notStrictEqual","Comparison","keys","_this","this","instance","Constructor","TypeError","_classCallCheck","forEach","key","test","compareExceptionKey","a","b","name","expectedException","msg","push","isPrototypeOf","call","getActual","e","checkIsPromise","then","catch","waitForActual","promiseFn","Promise","resolve","resultPromise","expectsError","error","details","fnType","expectsNoError","strict","_len6","_key6","throws","_len2","_key2","rejects","_len3","_key3","result","doesNotThrow","_len4","_key4","doesNotReject","_len5","_key5","ifError","newErr","origStack","stack","tmp2","split","shift","tmp1","i","pos","indexOf","slice","join","_defineProperty","defineProperty","enumerable","configurable","writable","_defineProperties","target","props","descriptor","_possibleConstructorReturn","self","_assertThisInitialized","ReferenceError","_wrapNativeSuper","Class","_cache","Function","toString","has","get","set","Wrapper","_construct","_getPrototypeOf","create","_setPrototypeOf","isNativeReflectConstruct","Reflect","construct","sham","Proxy","Date","Parent","o","p","setPrototypeOf","__proto__","getPrototypeOf","endsWith","str","search","this_len","substring","blue","green","red","white","kReadableOperator","strictEqualObject","notStrictEqualObject","notIdentical","copyError","source","inspectValue","val","compact","customInspect","depth","maxArrayLength","Infinity","showHidden","breakLength","showProxy","sorted","getters","_Error","options","limit","stackTraceLimit","String","stderr","isTTY","getColorDepth","other","res","lastPos","end","skipped","actualInspected","actualLines","expectedLines","indicator","inputLength","columns","count","Math","floor","maxCount","log","repeat","pop","maxLines","max","_actualLines","printedLines","skippedMsg","cur","expectedLine","actualLine","divergingLines","createErrDiff","base","_res","knownOperators","code","captureStackTrace","protoProps","subClass","superClass","_inherits","custom","recurseTimes","ctx","ownKeys","getOwnPropertySymbols","filter","sym","getOwnPropertyDescriptor","_objectSpread","util","createErrorType","Base","NodeError","_Base","arg1","arg2","arg3","getMessage","oneOf","thing","isArray","len","map","determiner","start","substr","replace","type","reason","inspected","RangeError","input","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","_i","next","done","_iterableToArrayLimit","_nonIterableRest","regexFlagsSupported","flags","arrayFromSet","array","arrayFromMap","objectGetOwnPropertySymbols","numberIsNaN","Number","isNaN","uncurryThis","f","hasOwnProperty","propertyIsEnumerable","objectToString","isAnyArrayBuffer","isArrayBufferView","isDate","isMap","isSet","isNativeError","isBoxedPrimitive","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isFloat32Array","isFloat64Array","isNonIndex","charCodeAt","pow","getOwnNonIndexProperties","compare","x","y","min","innerDeepEqual","val1","val2","memos","buf1","buf2","val1Tag","keys1","keys2","keyCheck","getTime","RegExp","byteLength","Uint8Array","buffer","byteOffset","areSimilarTypedArrays","offset","areSimilarFloatArrays","_keys","_keys2","size","valueOf","Boolean","BigInt","isEqualBoxedPrimitive","getEnumerables","k","iterationType","aKeys","bKeys","symbolKeysA","symbolKeysB","_symbolKeysB","position","val2MemoA","val2MemoB","areEq","objEquiv","delete","setHasEqualElement","memo","setValues","findLooseMatchingPrimitives","prim","setMightHaveLoosePrim","altValue","mapMightHaveLoosePrim","item","curB","mapHasEqualEntry","key1","item1","key2","aValues","Set","add","bValues","_val","setEquiv","aEntries","_aEntries$i","item2","bEntries","_i2","_bEntries$_i","mapEquiv","keysA","GetIntrinsic","callBind","$indexOf","allowMissing","intrinsic","$apply","$call","$reflectApply","$gOPD","$defineProperty","$max","originalFunction","func","desc","applyBind","hasSymbols","toStr","origDefineProperty","supportsDescriptors","_","arePropertyDescriptorsSupported","object","predicate","defineProperties","predicates","firstSource","to","nextSource","keysArray","nextIndex","nextKey","polyfill","hasOwn","l","ERROR_MESSAGE","funcType","that","bound","binder","boundLength","boundArgs","Empty","implementation","$SyntaxError","SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","throwTypeError","ThrowTypeError","calleeThrows","gOPDthrows","getProto","needsEval","TypedArray","INTRINSICS","AggregateError","ArrayBuffer","Atomics","DataView","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","isFinite","JSON","parseFloat","parseInt","SharedArrayBuffer","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","doEval","gen","LEGACY_ALIASES","$concat","$spliceApply","splice","$replace","$strSlice","rePropName","reEscapeChar","stringToPath","string","first","last","match","number","quote","subString","getBaseIntrinsic","alias","intrinsicName","parts","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","part","origSymbol","hasSymbolSham","symObj","getOwnPropertyNames","syms","toStringTag","ctor","superCtor","super_","TempCtor","hasToStringTag","$toString","callBound","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","GeneratorFunction","fnToStr","isFnRegex","generatorFunc","getGeneratorFunc","define","getPolyfill","shim","NaN","availableTypedArrays","g","globalThis","typedArrays","$slice","toStrTags","gOPD","typedArray","proto","superProto","tag","anyTrue","getter","tryTypedArrays","keysShim","isArgs","isEnumerable","hasDontEnumBug","hasProtoEnumBug","dontEnums","equalsConstructorPrototype","excludedKeys","$applicationCache","$console","$external","$frame","$frameElement","$frames","$innerHeight","$innerWidth","$onmozfullscreenchange","$onmozfullscreenerror","$outerHeight","$outerWidth","$pageXOffset","$pageYOffset","$parent","$scrollLeft","$scrollTop","$scrollX","$scrollY","$self","$webkitIndexedDB","$webkitStorageInfo","$window","hasAutomationEqualityBug","window","isObject","isFunction","isArguments","isString","theKeys","skipProto","j","skipConstructor","equalsConstructorPrototypeIfNotBuggy","origKeys","originalKeys","keysWorksWithArguments","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","arg","copy","fill","readUInt8","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","BigIntSupported","SymbolSupported","ObjectToString","numberValue","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isBigInt64Array","isBigUint64Array","isWeakMap","isWeakSet","SharedArrayBufferCopy","isSharedArrayBufferToString","isSharedArrayBuffer","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","method","getOwnPropertyDescriptors","descriptors","formatRegExp","format","objects","stringify","isNull","deprecate","noDeprecation","throwDeprecation","traceDeprecation","trace","debugs","debugEnvRegex","NODE_DEBUG","debugEnv","toUpperCase","opts","seen","stylize","stylizeNoColor","colors","isBoolean","_extend","isUndefined","stylizeWithColor","formatValue","styleType","style","styles","ret","primitive","simple","isNumber","formatPrimitive","visibleKeys","hash","idx","arrayToHash","isError","formatError","output","braces","toUTCString","formatProperty","formatArray","reduce","prev","reduceToSingleString","line","ar","re","d","pad","n","debuglog","pid","types","isNullOrUndefined","isSymbol","isPrimitive","isBuffer","months","timestamp","time","getHours","getMinutes","getSeconds","getDate","getMonth","prop","inherits","origin","kCustomPromisifiedSymbol","callbackifyOnRejected","cb","newReason","promisify","original","promiseResolve","promiseReject","promise","reject","callbackify","callbackified","maybeCb","rej","foundName","require","possibleNames","out","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","os","vscode","is_web_ext","homedir","poor_rbql_async_design_workaround_timeout","sleep","ms","log_message","async","workspace","workspaceFolders","workspace_folder_uri","uri","Uri","joinPath","active_doc","openTextDocument","languageId","editor","showTextDocument","test_no_autodetection","state_report","commands","executeCommand","check_initialization_state","initialized","lazy_loaded","test_autodetection","test_manual_enable_disable","test_task","rbql_backend","with_headers","rbql_query","check_last_rbql_warnings","warnings","activeTextEditor","document","length_after_query","getText","check_last_rbql_report","error_type","error_msg","enable_rfc_newlines","test_rbql_web","lineCount","filename_before","fileName","length_before_query","filename_after_copy_back","test_rbql_node","length_original","length_aligned","lint_report","length_shrinked","text_with_comma","text","test_align_shrink_lint","length_after_column_edit","length_after_delete","test_column_edit"],"sourceRoot":""} \ No newline at end of file diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/.vsixmanifest b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/.vsixmanifest similarity index 97% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/.vsixmanifest rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/.vsixmanifest index 9c896c0c..6ec651da 100644 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/.vsixmanifest +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/.vsixmanifest @@ -1,7 +1,7 @@ - + Rainbow CSV Highlight CSV and TSV files, Run SQL-like queries csv,tsv,highlight,CSV,__ext_csv,TSV,__ext_tsv,__ext_tab,csv (pipe),CSV (pipe),csv (tilde),CSV (tilde),csv (whitespace),CSV (whitespace),csv (caret),CSV (caret),csv (colon),CSV (colon),csv (double quote),CSV (double quote),csv (equals),CSV (equals),csv (dot),CSV (dot),csv (hyphen),CSV (hyphen),csv (semicolon),CSV (semicolon),rainbow hover markup,plaintext,sql,__web_extension diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/CHANGELOG.md b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/CHANGELOG.md similarity index 94% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/CHANGELOG.md rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/CHANGELOG.md index b676eb13..a96ce80e 100644 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/CHANGELOG.md +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/CHANGELOG.md @@ -1,5 +1,9 @@ # Rainbow CSV for Visual Studio Code Change Log +## 2.3.0 +* Improve alignment algorithm: special handling of numeric columns, see [#106](https://github.com/mechatroner/vscode_rainbow_csv/issues/106). +* Show alignment progress indicator which is very nice for large files. + ## 2.2.0 * UI and UX improvements by [@anthroid](https://github.com/anthroid). diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/DEV_README.md b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/DEV_README.md similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/DEV_README.md rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/DEV_README.md diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/LICENSE.txt b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/LICENSE.txt similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/LICENSE.txt rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/LICENSE.txt diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/README.md b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/README.md similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/README.md rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/README.md diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/contrib/textarea-caret-position/LICENSE b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/contrib/textarea-caret-position/LICENSE similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/contrib/textarea-caret-position/LICENSE rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/contrib/textarea-caret-position/LICENSE diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/contrib/textarea-caret-position/index.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/contrib/textarea-caret-position/index.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/contrib/textarea-caret-position/index.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/contrib/textarea-caret-position/index.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/extension.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/extension.js new file mode 100644 index 00000000..e5623b0b --- /dev/null +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/extension.js @@ -0,0 +1 @@ +(()=>{var __webpack_modules__={1924:(e,t,r)=>{"use strict";var n=r(210),i=r(5559),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},5559:(e,t,r)=>{"use strict";var n=r(8612),i=r(210),o=i("%Function.prototype.apply%"),s=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||n.call(s,o),l=i("%Object.getOwnPropertyDescriptor%",!0),u=i("%Object.defineProperty%",!0),c=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function(e){var t=a(n,s,arguments);if(l&&u){var r=l(t,"length");r.configurable&&u(t,"length",{value:1+c(0,e.length-(arguments.length-1))})}return t};var _=function(){return a(n,o,arguments)};u?u(e.exports,"apply",{value:_}):e.exports.apply=_},9804:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,n,i){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var s=0;s{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,i="[object Function]";e.exports=function(e){var o=this;if("function"!=typeof o||n.call(o)!==i)throw new TypeError(t+o);for(var s,a=r.call(arguments,1),l=function(){if(this instanceof s){var t=o.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return o.apply(e,a.concat(r.call(arguments)))},u=Math.max(0,o.length-a.length),c=[],_=0;_{"use strict";var n=r(7648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,i=SyntaxError,o=Function,s=TypeError,a=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch(e){l=null}var u=function(){throw new s},c=l?function(){try{return u}catch(e){try{return l(arguments,"callee").get}catch(e){return u}}}():u,_=r(1405)(),p=Object.getPrototypeOf||function(e){return e.__proto__},f={},h="undefined"==typeof Uint8Array?n:p(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":_?p([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":_?p(p([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&_?p((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&_?p((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":_?p(""[Symbol.iterator]()):n,"%Symbol%":_?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":c,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(r=p(i.prototype))}return d[t]=r,r},y={"%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"]},m=r(8612),b=r(7642),w=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),v=m.call(Function.call,String.prototype.replace),E=m.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,R=function(e){var t=E(e,0,1),r=E(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return v(e,O,(function(e,t,r,i){n[n.length]=r?v(i,S,"$1"):t||e})),n},A=function(e,t){var r,n=e;if(b(y,n)&&(n="%"+(r=y[n])[0]+"%"),b(d,n)){var o=d[n];if(o===f&&(o=g(n)),void 0===o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=R(e),n=r.length>0?r[0]:"",o=A("%"+n+"%",t),a=o.name,u=o.value,c=!1,_=o.alias;_&&(n=_[0],x(r,w([0,1],_)));for(var p=1,f=!0;p=r.length){var m=l(u,h);u=(f=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:u[h]}else f=b(u,h),u=u[h];f&&!c&&(d[a]=u)}}return u}},1405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(5419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},5419: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"),r=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(r))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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6410:(e,t,r)=>{"use strict";var n=r(5419);e.exports=function(){return n()&&!!Symbol.toStringTag}},7642:(e,t,r)=>{"use strict";var n=r(8612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},5717: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 r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},2584:(e,t,r)=>{"use strict";var n=r(6410)(),i=r(1924)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},8662:(e,t,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=r(6410)(),l=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!l)return!1;if(void 0===n){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&l(t)}return l(e)===n}},5692:(e,t,r)=>{"use strict";var n=r(9804),i=r(3083),o=r(1924),s=o("Object.prototype.toString"),a=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,u=i(),c=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r-1}return!!f&&function(e){var t=!1;return n(p,(function(r,n){if(!t)try{t=r.call(e)===n}catch(e){}})),t}(e)}},4155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,l=[],u=!1,c=-1;function _(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&p())}function p(){if(!u){var e=s(_);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c1)for(var r=1;r{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},5955:(e,t,r)=>{"use strict";var n=r(2584),i=r(8662),o=r(6430),s=r(5692);function a(e){return e.call.bind(e)}var l="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,c=a(Object.prototype.toString),_=a(Number.prototype.valueOf),p=a(String.prototype.valueOf),f=a(Boolean.prototype.valueOf);if(l)var h=a(BigInt.prototype.valueOf);if(u)var d=a(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function y(e){return"[object Map]"===c(e)}function m(e){return"[object Set]"===c(e)}function b(e){return"[object WeakMap]"===c(e)}function w(e){return"[object WeakSet]"===c(e)}function x(e){return"[object ArrayBuffer]"===c(e)}function v(e){return"undefined"!=typeof ArrayBuffer&&(x.working?x(e):e instanceof ArrayBuffer)}function E(e){return"[object DataView]"===c(e)}function O(e){return"undefined"!=typeof DataView&&(E.working?E(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=s,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):s(e)||O(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},y.working="undefined"!=typeof Map&&y(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(y.working?y(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),t.isArrayBuffer=v,E.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=O;var S="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function R(e){return"[object SharedArrayBuffer]"===c(e)}function A(e){return void 0!==S&&(void 0===R.working&&(R.working=R(new S)),R.working?R(e):e instanceof S)}function q(e){return g(e,_)}function P(e){return g(e,p)}function j(e){return g(e,f)}function T(e){return l&&g(e,h)}function k(e){return u&&g(e,d)}t.isSharedArrayBuffer=A,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},t.isGeneratorObject=function(e){return"[object Generator]"===c(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},t.isNumberObject=q,t.isStringObject=P,t.isBooleanObject=j,t.isBigIntObject=T,t.isSymbolObject=k,t.isBoxedPrimitive=function(e){return q(e)||P(e)||j(e)||T(e)||k(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")}})}))},9539:(e,t,r)=>{var n=r(4155),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),p(n,e,n.depth)}function c(e,t){var r=u.styles[t];return r?"["+u.colors[r][0]+"m"+e+"["+u.colors[r][1]+"m":e}function _(e,t){return e}function p(e,r,n){if(e.customInspect&&r&&S(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=p(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),O(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(S(r)){var l=r.name?": "+r.name:"";return e.stylize("[Function"+l+"]","special")}if(x(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return f(r)}var u,c="",_=!1,v=["{","}"];return d(r)&&(_=!0,v=["[","]"]),S(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),x(r)&&(c=" "+RegExp.prototype.toString.call(r)),E(r)&&(c=" "+Date.prototype.toUTCString.call(r)),O(r)&&(c=" "+f(r)),0!==s.length||_&&0!=r.length?n<0?x(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=_?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(u,c,v)):v[0]+c+v[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),j(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=y(r)?p(e,l.value,null):p(e,l.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function x(e){return v(e)&&"[object RegExp]"===R(e)}function v(e){return"object"==typeof e&&null!==e}function E(e){return v(e)&&"[object Date]"===R(e)}function O(e){return v(e)&&("[object Error]"===R(e)||e instanceof Error)}function S(e){return"function"==typeof e}function R(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!s[e])if(a.test(e)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(5955),t.isArray=d,t.isBoolean=g,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=x,t.types.isRegExp=x,t.isObject=v,t.isDate=E,t.types.isDate=E,t.isError=O,t.types.isNativeError=O,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=r(384);var q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),q[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",P(),t.format.apply(t,arguments))},t.inherits=r(5717),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var T="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function k(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(T&&e[T]){var t;if("function"!=typeof(t=e[T]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,T,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o{"use strict";var n=r(9804),i=r(3083),o=r(1924),s=o("Object.prototype.toString"),a=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,u=i(),c=o("String.prototype.slice"),_={},p=r(882),f=Object.getPrototypeOf;a&&p&&f&&n(u,(function(e){if("function"==typeof l[e]){var t=new l[e];if(Symbol.toStringTag in t){var r=f(t),n=p(r,Symbol.toStringTag);if(!n){var i=f(r);n=p(i,Symbol.toStringTag)}_[e]=n.get}}}));var h=r(5692);e.exports=function(e){return!!h(e)&&(a&&Symbol.toStringTag in e?function(e){var t=!1;return n(_,(function(r,n){if(!t)try{var i=r.call(e);i===n&&(t=i)}catch(e){}})),t}(e):c(s(e),8,-1))}},45:(e,t,r)=>{var n=r(4155);const i=r(4949),o=r(5174),s=r(7857),a=r(6987),l=r(371),u=r(8594),c=/^([0-9]+)(\.[0-9]+)?$/;class _ extends Error{}function p(e,t,r){if(e.length>r[0]&&(r[0]=e.length),-1==r[1])return;let n=c.exec(e);if(null===n)return void(!t&&e.length&&(r[1]=-1,r[2]=-1));let i=n[1].length;r[1]=Math.max(r[1],i);let o=void 0===n[2]?0:n[2].length;r[2]=Math.max(r[2],o)}function f(e,t,r,n){if(e=e.trim(),-1==r[1]){let t=Math.max(r[0]-e.length,0);return n?e:e+" ".repeat(t+1)}if(t&&null===c.exec(e)){let t=Math.max(r[0]-e.length,0);return n?e:e+" ".repeat(t+1)}let i=e.indexOf("."),o=-1==i?e.length:i,s=-1==i?0:e.length-i,a=Math.max(r[1]-o,0),l=Math.max(r[2]-s),u=n?"":" ".repeat(l+1);return" ".repeat(a)+e+u}function h(e){return"rbql_table_name:"+e}function d(e,t,r){var n,a="~"===(n=r).charAt(0)?s.join(i.homedir(),n.slice(1)):n;if(o.existsSync(a))return a;if(t&&!s.isAbsolute(a)&&(a=s.join(t,a),o.existsSync(a)))return a;let l=e?e.get(h(r)):null;return l&&o.existsSync(l)?l:null}function g(e,t){const r=e.lineCount;for(let n=0;n1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e1);let[i,o]=n[0],[s,a]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${s} -> ${a} fields`,l}(this.table_name,this.fields_info)),e}}class b extends a.RBQLOutputWriter{constructor(e,t){if(super(),this.delim=e,this.policy=t,this.header_len=null,this.null_in_output=!1,this.delim_in_simple_output=!1,this.output_lines=[],"simple"==t)this.polymorphic_join=this.simple_join;else if("quoted"==t)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==t)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==t)this.polymorphic_join=this.mono_join;else{if("whitespace"!=t)throw new y("Unknown output csv policy");this.polymorphic_join=this.simple_join}}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return u.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return u.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new y('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{i||(i=!0,n.close(),s(e))})),n.on("error",(e=>{a(e)})),l},e.exports.rbql_query_web=async function(e,t,r,n,i,o,s,l,u=null){let c=new w,_=new m(t,r,n,l,u),p=new b(i,o);return await a.query(e,_,p,s,c,""),p.output_lines},e.exports.rbql_query_node=async function(e,t,r,u,c,_,p,f,h,d,g=!1,m=null,b="",w=null){let v=null,E=null;w&&w.bulk_read&&r?E=r:v=null===r?n.stdin:o.createReadStream(r);let[O,S]=null===_?[n.stdout,!1]:[o.createWriteStream(_),!0];if('"'==u&&"quoted"==c)throw new y('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==h&&(h="binary"),!l.is_ascii(t)&&"binary"==h)throw new y("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(l.is_ascii(u)&&l.is_ascii(p)||"binary"!=h))throw new y("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let R=s.join(i.homedir(),".rbql_init_source.js");""==b&&o.existsSync(R)&&(b=l.read_user_init_code(R));let A=r?s.dirname(r):null,q=new x(e,A,u,c,h,g,m,w),P=new l.CSVRecordIterator(v,E,h,u,c,g,m),j=new l.CSVWriter(O,S,h,p,f);await a.query(t,P,j,d,q,b),q.get_warnings(d)},e.exports.get_header_line=g,e.exports.populate_optimistic_rfc_csv_record_map=function(e,t,r,n=null){let i=e.lineCount,o=null;var s;for(let a=r.length?(s=r,s[s.length-1])[1]:0;a=i&&""==t)break;if(n&&t.startsWith(n))continue;let s=t.match(/"/g),l=s&&s.length%2==1;if(null!==o||l)if(null===o&&l)o=a;else{if(!l)continue;r.push([o,a+1]),o=null}else r.push([a,a+1])}null!==o&&r.push([o,i])},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 bellow 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 bellow this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.align_columns=function(e,t,r,n,i){let o=[],s=e.lineCount,a=!1,l=!0;for(let c=0;c=i.length);e++){let t=e+1==i.length,r=f(p[e],l,i[e],t);p[e]!=r&&(p[e]=r,a=!0)}l=!1,o.push(p.join(t))}return a?o.join("\n"):null},e.exports.shrink_columns=function(e,t,r,n){let i=[],o=e.lineCount,s=!1;for(let a=0;a0&&(r[1]+r[2]>r[0]&&(r[0]=r[1]+r[2]),r[0]-r[2]>r[1]&&(r[1]=r[0]-r[2]),r[0]!=r[1]+r[2]))return null;t.push(r)}return t},e.exports.update_subcomponent_stats=p,e.exports.align_field=f},8594:e=>{let t=new RegExp('^"((?:[^"]*"")*[^"]*)"'),r=new RegExp('^ *"((?:[^"]*"")*[^"]*)" *');function n(e,n,i,o,s,a){var l=!1;let u=e.substring(s),c=(o?r:t).exec(u);if(null!==c){let t=c[0].length;if(s+t==e.length||e[s+t]==n)return i?a.push(c[0]):a.push(c[1].replace(/""/g,'"')),[s+t+1,!1];l=!0}var _=e.indexOf(n,s);-1==_&&(_=e.length);var p=e.substring(s,_);return l=l||-1!=p.indexOf('"'),a.push(p),[_+1,l]}function i(e,t,r=!1){if(-1==e.indexOf('"'))return[e.split(t),!1];var i=[],o=0,s=!1;let a=" "!=t;for(;o{(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,r){return e.split(t).join(r)}class RBQLContext{constructor(e,t,r,n){this.query_text=e,this.input_iterator=t,this.writer=r,this.user_init_code=n,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.25.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=[],r=0,n=[];for(let i=0;ie.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 r="__RBQL_INTERNAL_STAR",n=/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(e),i=/^([ab])\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(e),o=/^([ab])\[([0-9]+)\]$/.exec(e),s=/^([ab])\[___RBQL_STRING_LITERAL([0-9]+)___\]$/.exec(e);if(null!==n){if(e==r)return{table_name:null,column_index:null,column_name:null,is_star:!0};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}:{table_name:null,column_index:null,column_name:e,is_star:!1}}if(null!==i){let e=i[1],t=i[2];return t==r?{table_name:e,column_index:null,column_name:null,is_star:!0}:{table_name:null,column_index:null,column_name:t,is_star:!1}}if(null!=o)return{table_name:o[1],column_index:parseInt(o[2])-1,column_name:null,is_star:!1};if(null!=s){s[1];let e=s[2];if(ecolumn_info_from_text_span(e,t)))}function stable_compare(e,t){for(var r=0;r=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),r=this.records.get(t);return r?r[0]+=1:this.records.set(t,[1,e]),!0}async finish(){for(var[e,t]of this.records){let[e,r]=t;if(r.unshift(e),!await this.subwriter.write(r))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;te instanceof UnnestMarker));for(var o=0;oo+e)),n.slice(0,e).concat(i).concat(n.slice(e+1)).join("\n")+"\n"}assert(!1)}function generate_main_loop_code(e){let t=null!==e.select_expression,r=null!==e.join_map,n=null===e.where_expression?"true":e.where_expression,i=null===e.aggregation_key_expression?"null":e.aggregation_key_expression,o=null===e.sort_key_expression?"null":e.sort_key_expression,s=embed_code(MAIN_LOOP_BODY,"__USER_INIT_CODE__",e.user_init_code);return t?(r?(s=embed_code(embed_code(s,"__CODE__",PROCESS_SELECT_JOIN),"__CODE__",PROCESS_SELECT_COMMON),s=embed_expression(s,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):s=embed_code(embed_code(s,"__CODE__",PROCESS_SELECT_SIMPLE),"__CODE__",PROCESS_SELECT_COMMON),s=embed_code(s,"__RBQLMP__variables_init_code",e.variables_init_code),s=embed_expression(s,"__RBQLMP__select_expression",e.select_expression),s=embed_expression(s,"__RBQLMP__where_expression",n),s=embed_expression(s,"__RBQLMP__aggregation_key_expression",i),s=embed_expression(s,"__RBQLMP__sort_key_expression",o)):(r?(s=embed_code(s,"__CODE__",PROCESS_UPDATE_JOIN),s=embed_expression(s,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):s=embed_code(s,"__CODE__",PROCESS_UPDATE_SIMPLE),s=embed_code(s,"__RBQLMP__variables_init_code",e.variables_init_code),s=embed_code(s,"__RBQLMP__update_expressions",e.update_expressions),s=embed_expression(s,"__RBQLMP__where_expression",n)),"(async () => {"+s+"})()"}async function compile_and_run(query_context){let main_loop_body=generate_main_loop_code(query_context);try{let main_loop_promise=eval(main_loop_body);await main_loop_promise}catch(e){if(e instanceof SyntaxError){let t=query_context.query_text.toLowerCase();if(-1!=t.indexOf(" having "))throw new SyntaxError(e.message+'\nRBQL doesn\'t support "HAVING" keyword');if(-1!=t.indexOf(" like "))throw new SyntaxError(e.message+"\nRBQL doesn't support \"LIKE\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... ");if(-1!=t.indexOf(" from "))throw new SyntaxError(e.message+'\nTip: If input table is defined by the environment, RBQL query should not have "FROM" keyword');if(e&&e.message&&-1!=String(e.message).toLowerCase().indexOf("unexpected identifier")){if(-1!=t.indexOf(" and "))throw new SyntaxError(e.message+"\nDid you use 'and' keyword in your query?\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!");if(-1!=t.indexOf(" or "))throw new SyntaxError(e.message+"\nDid you use 'or' keyword in your query?\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!")}}if(e&&e.message&&-1!=e.message.indexOf("Received an instance of RBQLAggregationToken"))throw new RbqlParsingError(wrong_aggregation_usage_error);throw e}}const GROUP_BY="GROUP BY",UPDATE="UPDATE",SELECT="SELECT",JOIN="JOIN",INNER_JOIN="INNER JOIN",LEFT_JOIN="LEFT JOIN",LEFT_OUTER_JOIN="LEFT OUTER JOIN",STRICT_LEFT_JOIN="STRICT LEFT JOIN",ORDER_BY="ORDER BY",WHERE="WHERE",LIMIT="LIMIT",EXCEPT="EXCEPT",WITH="WITH";function get_ambiguous_error_msg(e){return`Ambiguous variable name: "${e}" is present both in input and in join tables`}function get_all_matches(e,t){var r=[];let n=null;for(;null!==(n=e.exec(t));)r.push(n);return r}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 r=0;re[1]));for(let e of o){let o=r.indexOf(e);if(-1==o)throw new RbqlParsingError(`Unable to find column "${e}" in ${"a"==t?"input":"join"} ${n}`);i[`${t}.${e}`]={initialize:!0,index:o}}}function map_variables_directly(e,t,r){for(let n=0;n1)throw new RbqlParsingError(`More than one "${o}" statements found`);assert(1==s.length);var a=s[0],l=a[0];r.push([a.index,a.index+l.length,o]);break}}return r.sort((function(e,t){return e[0]-t[0]})),r}function separate_actions(e){e=str_strip(e);var t={};let r=/^(.*) *[Ww][Ii][Tt][Hh] *\(([a-z]{4,20})\) *$/.exec(e);null!==r&&(e=r[1],t[WITH]=r[2]);for(var n=locate_statements(e),i=0;ie-t)),[null===n?null:select_except(n,o),`select_except(record_a, [${o.join(",")}])`]}class HashJoinMap{constructor(e,t){this.max_record_len=0,this.hash_map=new Map,this.record_iterator=e,this.nr=0,1==t.length?(this.key_index=t[0],this.key_indices=null,this.polymorphic_get_key=this.get_single_key):(this.key_index=null,this.key_indices=t,this.polymorphic_get_key=this.get_multi_key)}get_single_key(e,t){if(this.key_index>=t.length)throw new RbqlRuntimeError(`No field with index ${this.key_index+1} at record ${this.nr} in "B" table`);return-1===this.key_index?this.nr:t[this.key_index]}get_multi_key(e,t){let r=[];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`);r.push(-1===e?this.nr:t[e])}return JSON.stringify(r)}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 r=this.polymorphic_get_key(this.nr,e),n=this.hash_map.get(r);void 0===n?this.hash_map.set(r,[[this.nr,t,e]]):n.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,r){if(null===e&&null===t)return null;null===e&&(e=[]),null===t&&(t=[]);let n=[];for(let i of r)null===i?n.push("col"+(n.length+1)):i.is_star?null===i.table_name?n=n.concat(e).concat(t):"a"===i.table_name?n=n.concat(e):"b"===i.table_name&&(n=n.concat(t)):null!==i.column_name?n.push(i.column_name):null!==i.column_index?"a"==i.table_name&&i.column_index1);let[i,o]=n[0],[s,a]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${s} -> ${a} fields`,l}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,r=!0,n="a"){super(),this.table=e,this.column_names=t,this.normalize_column_names=r,this.variable_prefix=n,this.nr=0,this.fields_info=new Object,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.hasOwnProperty(t)||(this.fields_info[t]=this.nr),e}get_warnings(){return Object.keys(this.fields_info).length>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,r=!0,n="b"){super(),this.table=e,this.table_id=n,this.column_names=t,this.normalize_column_names=r}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,r,n){e=cleanup_query(e);var[i,o]=separate_string_literals(e),s=separate_actions(i=remove_redundant_table_name(i));s.hasOwnProperty(WITH)&&t.handle_query_modifier(s[WITH]);var a=await t.get_variables_map(e);if(s.hasOwnProperty(ORDER_BY)&&s.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY" is not allowed in "UPDATE" queries');if(s.hasOwnProperty(GROUP_BY)){if(s.hasOwnProperty(ORDER_BY)||s.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');n.aggregation_key_expression="["+combine_string_literals(s[GROUP_BY].text,o)+"]"}let l=null,u=null;if(s.hasOwnProperty(JOIN)){var[c,_]=parse_join_expression(s[JOIN].text);if(null===r)throw new RbqlParsingError("JOIN operations are not supported by the application");let t=r.get_iterator_by_table_id(c);if(!t)throw new RbqlParsingError(`Unable to find join table: "${c}"`);s.hasOwnProperty(WITH)&&t.handle_query_modifier(s[WITH]),l=await t.get_variables_map(e),u=await t.get_header();let[i,p]=resolve_join_variables(a,l,_,o),f={JOIN:InnerJoiner,"INNER JOIN":InnerJoiner,"LEFT JOIN":LeftJoiner,"LEFT OUTER JOIN":LeftJoiner,"STRICT LEFT JOIN":StrictLeftJoiner}[s[JOIN].join_subtype];n.lhs_join_var_expression=1==i.length?i[0]:"JSON.stringify(["+i.join(",")+"])",n.join_map_impl=new HashJoinMap(t,p),await n.join_map_impl.build(),n.join_map=new f(n.join_map_impl)}if(n.variables_init_code=combine_string_literals(generate_init_statements(i,a,l," ".repeat(4)),o),s.hasOwnProperty(WHERE)){var p=s[WHERE].text;if(/[^>{var n=r(4155);const i=r(1606),o=r(4704),s=r(9426),a=r(9539),l=r(6987),u=r(8594),c="Unable to decode input table as UTF-8. Use binary (latin-1) encoding instead";class _ extends Error{}class p extends Error{}function f(e,t=null){if(!e)throw t||(t="Assertion error"),new p(t)}function h(e){return/^[\x00-\x7F]*$/.test(e)}function d(e){return i.readFileSync(e,"utf-8")}function g(e,t){var r,n="~"===(r=t).charAt(0)?s.join(o.homedir(),r.slice(1)):r;if(i.existsSync(n))return n;if(e&&!s.isAbsolute(n)&&(n=s.join(e,n),i.existsSync(n)))return n;var a=function(e,t){for(var r=function(e){var t=null;try{t=i.readFileSync(e,"utf-8")}catch(e){return[]}for(var r=t.split("\n"),n=[],o=0;o1&&i.existsSync(a[1])?a[1]:null}class y{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 m extends l.RBQLInputIterator{constructor(e,t,r,n,i,o=!1,s=null,l="input",u="a"){super(),this.stream=e,this.csv_path=t,f(null===this.stream!=(null===this.csv_path)),this.encoding=r,this.delim=n,this.policy=i,this.has_header=o,this.first_record=null,this.first_record_should_be_emitted=!o,this.header_preread_complete=!1,this.table_name=l,this.variable_prefix=u,this.comment_prefix=null!==s&&s.length?s:null,this.decoder=null,"utf-8"==r&&null===this.csv_path&&(this.decoder=new a.TextDecoder(r,{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 Object,this.NR=0,this.NL=0,this.rfc_line_buffer=[],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 y,this.process_line_polymorphic="quoted_rfc"==i?this.process_partial_rfc_record_line:this.process_record_line}handle_query_modifier(e){-1!=["header","headers"].indexOf(e)&&(this.has_header=!0,this.first_record_should_be_emitted=!1),-1!=["noheader","noheaders"].indexOf(e)&&(this.has_header=!1,this.first_record_should_be_emitted=!0)}reset_external_callbacks(){this.reject_current_record=null,this.resolve_current_record=null}try_propagate_exception(){if(this.current_exception&&this.reject_current_record){let e=this.reject_current_record,t=this.current_exception;this.reset_external_callbacks(),this.current_exception=null,e(t)}}store_or_propagate_exception(e){null===this.current_exception&&(this.current_exception=e),this.try_propagate_exception()}async preread_first_record(){this.header_preread_complete||(this.first_record=await this.get_record(),this.header_preread_complete=!0,null!==this.first_record&&(this.stream&&this.stream.pause(),this.first_record=this.first_record.slice()))}async get_variables_map(e){let t=new Object;return l.parse_basic_variables(e,this.variable_prefix,t),l.parse_array_variables(e,this.variable_prefix,t),await this.preread_first_record(),this.has_header&&this.first_record&&(l.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),l.parse_dictionary_variables(e,this.variable_prefix,this.first_record,t)),t}async get_header(){return await this.preread_first_record(),this.has_header?this.first_record:null}try_resolve_next_record(){if(this.try_propagate_exception(),null===this.resolve_current_record)return;let e=null;if(this.first_record_should_be_emitted&&this.header_preread_complete?(this.first_record_should_be_emitted=!1,e=this.first_record):e=this.produced_records_queue.dequeue(),null===e&&!this.input_exhausted)return;let t=this.resolve_current_record;this.reset_external_callbacks(),t(e)}async get_record(){this.started||await this.start(),this.stream&&this.stream.isPaused()&&this.stream.resume();let e=this,t=new Promise((function(t,r){e.resolve_current_record=t,e.reject_current_record=r}));return this.try_resolve_next_record(),t}async get_all_records(e=null){let t=[];for(;;){let r=await this.get_record();if(null===r)break;if(t.push(r),e&&t.length>=e){this.stop();break}}return t}process_record_line(e){if(null!==this.comment_prefix&&e.startsWith(this.comment_prefix))return;this.NR+=1;var[t,r]=u.smart_split(e,this.delim,this.policy,!1);r&&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 n=t.length;this.fields_info.hasOwnProperty(n)||(this.fields_info[n]=this.NR),this.produced_records_queue.enqueue(t),this.try_resolve_next_record()}process_partial_rfc_record_line(e){let t=u.accumulate_rfc_line_into_record(this.rfc_line_buffer,e,this.comment_prefix);null!==t&&this.process_record_line(t)}process_line(e){if(this.NL+=1,1===this.NL){var t=function(e,t){return"binary"==t&&e.length>=3&&239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)?e.substring(3):"utf-8"==t&&e.length>=1&&65279===e.charCodeAt(0)?e.substring(1):e}(e,this.encoding);t!=e&&(e=t,this.utf8_bom_removed=!0)}this.process_line_polymorphic(e)}process_data_stream_chunk(e){let t=null;if(this.decoder)try{t=this.decoder.decode(e)}catch(e){return void(e instanceof TypeError?this.store_or_propagate_exception(new _(c)):this.store_or_propagate_exception(e))}else t=e.toString(this.encoding);let r=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 n=u.split_lines(t);n[0]=this.partially_decoded_line+n[0],f(0==r||0==n[0].length),this.partially_decoded_line=n.pop();for(let e=r;e0&&this.process_record_line(this.rfc_line_buffer.join("\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.rfc_line_buffer.length>0&&this.process_record_line(this.rfc_line_buffer.join("\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,r){i.readFile(e.csv_path,((n,i)=>{n?r(n):(e.process_data_bulk(i),t())}))}))}this.stream.on("data",(e=>{this.process_data_stream_chunk(e)})),this.stream.on("end",(()=>{this.process_data_stream_end()}))}}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),this.utf8_bom_removed&&e.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`),Object.keys(this.fields_info).length>1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e1);let[i,o]=n[0],[s,a]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${s} -> ${a} fields`,l}(this.table_name,this.fields_info)),e}}class b extends l.RBQLOutputWriter{constructor(e,t,r,n,i,o="\n"){if(super(),this.stream=e,this.encoding=r,r&&this.stream.setDefaultEncoding(r),this.stream.on("error",(e=>{this.store_first_error(e)})),this.delim=n,this.policy=i,this.line_separator=o,this.sub_array_delim="|"==n?";":"|",this.close_stream_on_finish=t,this.null_in_output=!1,this.delim_in_simple_output=!1,this.header_len=null,this.first_error=null,"simple"==i)this.polymorphic_join=this.simple_join;else if("quoted"==i)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==i)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==i)this.polymorphic_join=this.mono_join;else{if("whitespace"!=i)throw new _("Unknown output csv policy");this.polymorphic_join=this.simple_join}}store_first_error(e){null===this.first_error&&(this.first_error=e)}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return u.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return u.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new _('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{i()})):setTimeout((()=>{i()}),0)}))}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class w extends l.RBQLTableRegistry{constructor(e,t,r,n,i=!1,o=null,s=null){super(),this.input_file_dir=e,this.delim=t,this.policy=r,this.encoding=n,this.has_header=i,this.comment_prefix=o,this.stream=null,this.record_iterator=null,this.options=s,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=g(this.input_file_dir,e),null===this.table_path)throw new _(`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 m(this.stream,this.bulk_input_path,this.encoding,this.delim,this.policy,this.has_header,this.comment_prefix,e,"b"),this.record_iterator}get_warnings(e){this.record_iterator&&this.has_header&&e.push(`The first record in JOIN file ${s.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.is_ascii=h,e.exports.CSVRecordIterator=m,e.exports.CSVWriter=b,e.exports.FileSystemCSVRegistry=w,e.exports.interpret_named_csv_format=function(e){if("monocolumn"==(e=e.toLowerCase()))return["","monocolumn"];if("csv"==e)return[",","quoted"];if("tsv"==e)return["\t","simple"];throw new _(`Unknown format name: "${e}"`)},e.exports.read_user_init_code=d,e.exports.query_csv=async function(e,t,r,a,u,c,p,f,g,y=!1,x=null,v="",E=null){let O=null,S=null;E&&E.bulk_read&&t?S=t:O=null===t?n.stdin:i.createReadStream(t);let[R,A]=null===u?[n.stdout,!1]:[i.createWriteStream(u),!0];if('"'==r&&"quoted"==a)throw new _('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==f&&(f="binary"),!h(e)&&"binary"==f)throw new _("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(h(r)&&h(c)||"binary"!=f))throw new _("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let q=s.join(o.homedir(),".rbql_init_source.js");""==v&&i.existsSync(q)&&(v=d(q));let P=t?s.dirname(t):null,j=new w(P,r,a,f,y,x,E),T=new m(O,S,f,r,a,y,x),k=new b(R,A,f,c,p);await l.query(e,T,k,g,j,v),j.get_warnings(g)},e.exports.RecordQueue=y,e.exports.exception_to_error_info=l.exception_to_error_info},9496:e=>{"use strict";e.exports=require("vscode")},1606:()=>{},4704:()=>{},9426:()=>{},2667:()=>{},5174:()=>{},4949:()=>{},7857:()=>{},8391:()=>{},3083:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.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__(9496),r=__webpack_require__(7857),n=__webpack_require__(5174),i=__webpack_require__(4949),o=__webpack_require__(2667),s=__webpack_require__(8594);var a=null,l=null;function u(){return null===l&&(l=__webpack_require__(45)),l}const c=void 0===i.homedir,_=100,p="vscode_rbql_scratch";let f=null;var h=new Map,d=new Set,g=new Set,y=new Map,m=new Map,b=null,w=null,x=null,v=null,E=null;let O=null;var S=null,R=new Map,A=null,q=null,P=null,j=null,T=null,k=null;const I={csv:[",","quoted"],tsv:["\t","simple"],"csv (semicolon)":[";","quoted"],"csv (pipe)":["|","simple"],"csv (tilde)":["~","simple"],"csv (caret)":["^","simple"],"csv (colon)":[":","simple"],"csv (double quote)":['"',"simple"],"csv (equals)":["=","simple"],"csv (dot)":[".","simple"],"csv (whitespace)":[" ","whitespace"],"csv (hyphen)":["-","simple"]};let N={"rbql_client.js":null,"contrib/textarea-caret-position/index.js":null,"rbql_suggest.js":null,"rbql_logo.svg":null,"rbql_client.html":null,"rbql mock/rbql_mock.py":null,"rbql_core/vscode_rbql.py":null};function L(e){var r=t.window;r&&r.showErrorMessage(e)}function C(e){return new Promise((t=>setTimeout(t,e)))}async function U(){await C(0)}function M(e){for(let t in I)if(I.hasOwnProperty(t)&&I[t][0]==e)return t;return null}function B(e,t){if(q){var r=q.get(e);if(null!=r)return r}return t}async function $(e,t){return!(!q||!e||(await q.update(e,t),0))}function D(e,t,r){let n=[];for(let i=t;ie.replace(o,n)))}function W(e,t){let r=e.input_document,n=e.delim,i=e.policy;e.requested_start_record=Math.max(e.requested_start_record,0);let o=[];if(e.enable_rfc_newlines){let a=e.requested_start_record+_;u().populate_optimistic_rfc_csv_record_map(r,a,e.rfc_record_map),e.requested_start_record=Math.max(0,Math.min(e.requested_start_record,e.rfc_record_map.length-_));for(let a=e.requested_start_record;a250&&(t[e]=t[e].substr(0,250)+"###UI_STRING_TRIM_MARKER###")}t.preview_records=o,t.start_record_zero_based=e.requested_start_record}function J(e){return"rbql_header:"+e}function Q(e){return"enable_rfc_newlines:"+e}function z(e){return"rbql_with_headers:"+e}function V(e,r){const n=t.workspace.getConfiguration("rainbow_csv");return n?n.get(e):r}function G(e,t,r){let n=V("comment_prefix",""),i=u().get_header_line(e,n);return s.smart_split(i,t,r,!1)[0]}function H(e,t,r){var n=e.fileName;if(n){let e=B(J(n),null);if(e)return JSON.parse(e)}return G(e,t,r)}function Y(e,t){if(!e.length)return null;for(var r=0,n=e[r].length+1;t>n&&r+1 "+n),await t.languages.setTextDocumentLanguage(e,n)),await async function(e){if(k=[],e&&e.length){var r=t.window;if(!r)return null;for(var n=0;n=1e4)L("Multicursor column edit works only for files smaller than 10000 lines.");else{for(let r=0;r=c.length)return void L(`Line ${r+1} doesn't have field number ${g+1}`);let _=c.slice(0,g).join("").length+g,p=c.slice(0,g+1).join("").length+g;if("ce_before"==e&&"quoted"==a&&-1!=i.substring(_-2,_+2).indexOf('"'))return void L(`Accidental data corruption prevention: Cursor at line ${r+1} will not be set: a double quote is in proximity.`);if("ce_after"==e&&"quoted"==a&&-1!=i.substring(p-2,p+2).indexOf('"'))return void L(`Accidental data corruption prevention: Cursor at line ${r+1} will not be set: a double quote is in proximity.`);if("ce_select"==e&&_==p)return void L(`Accidental data corruption prevention: The column can not be selected: field ${g+1} at line ${r+1} is empty.`);let f=new t.Position(r,_),h=new t.Position(r,p);"ce_before"==e&&y.push(new t.Selection(f,f)),"ce_after"==e&&y.push(new t.Selection(h,h)),"ce_select"==e&&y.push(new t.Selection(f,h))}r.selections=y,d&&t.window.showWarningMessage("Some lines have quoting issues: cursors positioning may be incorrect."),await t.window.showTextDocument(n)}}async function de(){let e=Z(),r=X(e);if(!r)return;let n=r.languageId;if(!I.hasOwnProperty(n))return;let[i,o]=I[n],s=V("comment_prefix",""),a={location:t.ProgressLocation.Window,title:"Rainbow CSV"};await t.window.withProgress(a,(async n=>{n.report({message:"Preparing"}),await U();let[a,l]=u().shrink_columns(r,i,o,s);l?L(`Unable to shrink: Inconsistent double quotes at line ${l}`):(d.delete(r.fileName),ee(r),null!==a?(n.report({message:"Shrinking columns"}),await U(),await F(e,r,a)):t.window.showWarningMessage("No trailing whitespaces found, skipping"))}))}async function ge(){let e=Z(),r=X(e);if(!r)return;let n=r.languageId;if(!I.hasOwnProperty(n))return;let[i,o]=I[n],s=V("comment_prefix",""),a={location:t.ProgressLocation.Window,title:"Rainbow CSV"};await t.window.withProgress(a,(async n=>{n.report({message:"Calculating column statistics"}),await U();let[a,l]=u().calc_column_stats(r,i,o,s);l?L(`Unable to align: Inconsistent double quotes at line ${l}`):(a=u().adjust_column_stats(a),null!==a?(n.report({message:"Preparing final alignment"}),await U(),aligned_doc_text=u().align_columns(r,i,o,s,a),d.add(r.fileName),ee(r),null!==aligned_doc_text?(n.report({message:"Aligning columns"}),await U(),await F(e,r,aligned_doc_text)):t.window.showWarningMessage("Table is already aligned, skipping")):L("Unable to allign: Internal Rainbow CSV Error"))}))}async function ye(){if(c)return void L("This command is currently unavailable in web mode.");let e=X();if(!e)return;let r=e.fileName,n=m.get(r.toLowerCase());if(!n)return;let i=await t.workspace.openTextDocument(n),o=await t.window.showTextDocument(i);await async function(e,t){let r=e.getText(),n=X(t);n&&await F(t,n,r)}(e,o)}async function me(e,o,l=null){let p=o.msg_type,f=async function(t,r){let n={msg_type:"rbql_report"};t&&(n.error_type=t),r&&(n.error_msg=r),T=n,await e.postMessage(n)};if("handshake"==p){var h={msg_type:"handshake",backend_language:B("rbql_backend_language","js"),encoding:B("rbql_encoding","utf-8")};W(S,h);let t=ae(S.input_document_path);R.has(t)&&(h.last_query=R.get(t));let r=B("rbql_query_history",[]);h.query_history=r,h.policy=S.policy,h.enable_rfc_newlines=S.enable_rfc_newlines,h.with_headers=S.with_headers,h.header=S.header,h.is_web_ext=c,l&&(h.integration_test_language=l.rbql_backend,h.integration_test_query=l.rbql_query,h.integration_test_with_headers=l.with_headers||!1,h.integration_test_enable_rfc_newlines=l.enable_rfc_newlines||!1),await e.postMessage(h)}if("fetch_table_header"==p)try{let t=o.table_id,n=o.encoding,i=S.input_document_path?r.dirname(S.input_document_path):null,a=u().find_table_path(q,i,t);if(!a)return;let l=await u().read_header(a,n),[c,_]=s.smart_split(l,S.delim,S.policy,!1);_||e.postMessage({msg_type:"fetch_table_header_response",header:c})}catch(e){console.error("Unable to get join table header: "+String(e))}if("update_query"==p){let e=o.query;if(!e)return;S.input_document_path&&R.set(ae(S.input_document_path),e)}if("newlines_policy_change"==p){S.enable_rfc_newlines=o.enable_rfc_newlines,S.input_document_path&&await $(Q(S.input_document_path),S.enable_rfc_newlines);let t={msg_type:"resample"};W(S,t),await e.postMessage(t)}if("with_headers_change"==p&&(S.with_headers=o.with_headers,S.input_document_path&&await $(z(S.input_document_path),S.with_headers)),"navigate"==p){var d=o.direction;"backward"==d?S.requested_start_record-=_:"forward"==d?S.requested_start_record+=_:"begin"==d?S.requested_start_record=0:"end"==d&&(S.requested_start_record=S.input_document.lineCount);let t={msg_type:"navigate"};W(S,t),await e.postMessage(t)}if("run"==p){let e=o.query,n=o.backend_language,s=o.encoding,l=o.output_dialect,_=o.enable_rfc_newlines,p=o.with_headers;await async function(e){let t=B("rbql_query_history",[]),r=t.indexOf(e);-1!=r?t.splice(r,1):t.length>=20&&t.splice(0,1),t.push(e),await $("rbql_query_history",t)}(e),await async function(e,n,o,s,l,_,p,f){R.set(ae(e),s);var h="python";let d={process_reported:!1},[y,b]=[S.delim,S.policy];"quoted"==b&&_&&(b="quoted_rfc");let[w,x]=[y,b];"csv"==l&&([w,x]=[",","quoted"]),"tsv"==l&&([w,x]=["\t","simple"]),S.output_delim=w;let v=c?null:r.join(function(e){let t=V("rbql_output_dir","TMP");return"TMP"==t?i.tmpdir():"INPUT"==t?r.dirname(e):t}(e),function(e,t){var n=r.basename(e),i=r.extname(n),o={"\t":".tsv",",":".csv"},s=".txt";o.hasOwnProperty(t)?s=o[t]:i.length>1&&(s=i);let a=n+s;return a==n&&(a+=".txt"),a}(e,w));if(s.startsWith("test "))return-1!=s.indexOf("nopython")&&(h="nopython"),void oe(h,[N["rbql mock/rbql_mock.py"],s],d,(function(t,r,n){se(e,v,t,r,n,f)}));if("js"==o){let r=[],i=null;try{if(c){let e={content:(await u().rbql_query_web(s,S.input_document,y,b,w,x,r,p,null)).join("\n"),language:M(w)};i=await t.workspace.openTextDocument(e)}else{let o={bulk_read:!0};await u().rbql_query_node(q,s,e,y,b,v,w,x,n,r,p,null,"",o),m.set(v.toLowerCase(),e),g.add(v),i=await t.workspace.openTextDocument(v)}}catch(e){let[t,r]=(null===a&&(a=__webpack_require__(371)),a).exception_to_error_info(e);return void f(t,r)}f(null,null),await ie(i,r)}else{if(c)return void f("Input error","Python backend for RBQL is not supported in web version, please use JavaScript backend.");let t=Buffer.from(s,"utf-8").toString("base64"),r=[N["rbql_core/vscode_rbql.py"],t,e,y,b,v,w,x,n];p&&r.push("--with_headers"),oe(h,r,d,(function(t,r,n){se(e,v,t,r,n,f)}))}}(S.input_document_path,s,n,e,l,_,p,f)}if("edit_udf"==p){if(c)return void f("Input error","UDFs are currently not supported in web version");let e=null,s="";"js"==o.backend_language?(e=r.join(i.homedir(),".rbql_init_source.js"),s=u().get_default_js_udf_content()):(e=r.join(i.homedir(),".rbql_init_source.py"),s=u().get_default_python_udf_content()),n.existsSync(e)||n.writeFileSync(e,s);let a=await t.workspace.openTextDocument(e);await t.window.showTextDocument(a)}"global_param_change"==p&&await $(o.key,o.value)}async function be(e=null){let o=t.window;if(!o)return;let s=o.activeTextEditor;if(!s)return;let a=s.document;if(!a)return;let l=a.uri;if(!l)return;if("file"!=l.scheme&&"untitled"!=l.scheme&&!c)return;if("file"==l.scheme&&a.isDirty&&!c)return void L("Unable to run RBQL: file has unsaved changes");let u=null;if("untitled"!=l.scheme||c)u=a.fileName;else{let e=a.getText(),t=String(Math.floor(1e6*Math.random()));u=r.join(i.tmpdir(),`vscode_rbql_scratch_${t}.txt`),n.writeFileSync(u,e)}if(!u)return void L("Unable to run RBQL for this file");let _=a.languageId,p="monocolumn",h="monocolumn";I.hasOwnProperty(_)&&([p,h]=I[_]);let d=B(Q(u),!1),g=V("rbql_with_headers_by_default",!1),y=B(z(u),g),m=G(a,p,h);S={input_document:a,input_document_path:u,requested_start_record:0,delim:p,policy:h,rfc_record_map:[],enable_rfc_newlines:d,with_headers:y,header:m},P=t.window.createWebviewPanel("rbql-console","RBQL Console",t.ViewColumn.Active,{enableScripts:!0}),A||(A=c?f:n.readFileSync(N["rbql_client.html"],"utf8"));let b=A;b=function(e,r){for(const e of["contrib/textarea-caret-position/index.js","rbql_suggest.js","rbql_client.js","rbql_logo.svg"]){let n=null;n=c?N[e]:P.webview.asWebviewUri(t.Uri.file(N[e])),r=r.replace(`src="${e}"`,`src="${n}"`)}return r}(0,b),P.webview.html=b,P.webview.onDidReceiveMessage((function(t){me(P.webview,t,e)}))}function we(e,t,r,n,i){var o=e.lineCount;let a=0,l=0,u=V("comment_prefix","");u||(u="#");for(var c=0;c=i?a:0}function xe(e,t){let r=V("autodetection_min_line_count",10);if(e.lineCounti&&(i=u,n=s)}return n}async function ve(e){if(!e)return;j&&(j.dispose(),j=null);let r=e.document;if(!r)return;let n=xe(r,V("autodetect_separators",[]));if(!n)return;let i=await t.languages.setTextDocumentLanguage(r,n);te(i,!1),ee(i)}function Ee(e){let t=X(e);te(t,!1),ee(t)}async function Oe(e){await async function(e){if(!e)return;if(!V("enable_separator_autodetection",!1))return;let r=V("autodetect_separators",[]);var n=e.languageId,i=e.fileName;if(!i||g.has(i))return;let o=i.endsWith(".csv")&&"csv"==n;if("plaintext"!=n&&!o)return;let s=xe(e,r);if(!s&&o&&(s=function(e,t){let r="csv",n=0,i=e.getText();if(!i)return r;for(let e=0;en&&(r=o,n=s)}return r}(e,r)),!s||s==n)return;let a=await t.languages.setTextDocumentLanguage(e,s);y.set(i,n),te(a,!1),ee(a)}(e),function(e){V("enable_separator_autodetection",!1)&&e&&!j&&(e.isUntitled||0==e.lineCount)&&(j=t.workspace.onDidChangeTextDocument(ve))}(e),te(e,!1),ee(e)}async function Se(e,o){if(c)return void L("This command is currently unavailable in web mode.");var s=e.fsPath;if(!s||!n.existsSync(s))return void t.window.showErrorMessage("Invalid file");var a=1024e3,l=n.statSync(s).size;if(l<=a){t.window.showWarningMessage("Rainbow CSV: The file is not big enough, showing the full file instead. Use this preview for files larger than 1MB");let e=await t.workspace.openTextDocument(s);return void await t.window.showTextDocument(e)}let u=r.basename(s);const _=r.join(i.tmpdir(),`.rb_csv_preview.${o}.${u}`);n.open(s,"r",((e,r)=>{if(e)return console.log(e.message),void t.window.showErrorMessage("Unable to preview file");var i=Buffer.alloc(a);let s="head"==o?0:Math.max(l-a,0);n.read(r,i,0,a,s,(function(e,r){if(e)return console.log(e.message),void t.window.showErrorMessage("Unable to preview file");const s=i.toString();let a=null;a="head"==o?s.substr(0,s.lastIndexOf(s.includes("\r\n")?"\r\n":"\n")):s.substr(s.indexOf("\n")+1),n.writeFileSync(_,a),t.workspace.openTextDocument(_).then((e=>t.window.showTextDocument(e)))}))}))}function Re(e,r){let n=t.languages.registerHoverProvider(e,{provideHover:(r,n,i)=>function(e,r,n,i){if(O!=e&&ee(e),V("enable_tooltip",!1)){var o=function(e,t,r,n,i){let[o,a]=I[r];var l=t.line,u=t.character,c=e.lineAt(l).text;let _=V("comment_prefix","");if(_&&c.startsWith(_))return"Comment";var p=s.smart_split(c,o,a,!0),f=p[0],h=p[1],d=Y(f,u+1);if(null==d)return null;var g="Col #"+(d+1),y=H(e,o,a);if(n&&d -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","const os = require('os');\nconst fs = require('fs');\nconst path = require('path');\n\nconst rbql = require('./rbql_core/rbql-js/rbql.js');\nconst rbql_csv = require('./rbql_core/rbql-js/rbql_csv.js');\nconst csv_utils = require('./rbql_core/rbql-js/csv_utils.js');\n\nconst non_numeric_sentinel = -1;\nconst number_regex = /^([0-9]+)(\\.[0-9]+)?$/;\n\nclass AssertionError extends Error {}\n\nfunction assert(condition, message=null) {\n if (!condition) {\n if (!message) {\n message = 'Assertion error';\n }\n throw new AssertionError(message);\n }\n}\n\n\nfunction get_default_js_udf_content() {\n let default_content = `// 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 bellow this line:\n `.replace(new RegExp(/^ */, 'mg'), '');\n return default_content;\n}\n\n\nfunction get_default_python_udf_content() {\n let default_content = `# 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 bellow this line:\n `.replace(new RegExp(/^ */, 'mg'), '');\n return default_content;\n}\n\n\nfunction update_subcomponent_stats(field, is_first_line, max_field_components_lens) {\n // Extract overall field length and length of integer and fractional parts of the field if it represents a number.\n // Here `max_field_components_lens` is a tuple: (max_field_length, max_integer_part_length, max_fractional_part_length)\n if (field.length > max_field_components_lens[0]) {\n max_field_components_lens[0] = field.length;\n }\n if (max_field_components_lens[1] == non_numeric_sentinel) {\n // Column is not a number, early return.\n return;\n }\n let match_result = number_regex.exec(field);\n if (match_result === null) {\n if (!is_first_line && field.length) { // Checking field_length here allows numeric columns to have some of the fields empty.\n // We only mark the column as non-header if we know that this is not a header line.\n max_field_components_lens[1] = non_numeric_sentinel;\n max_field_components_lens[2] = non_numeric_sentinel;\n }\n return;\n }\n let cur_integer_part_length = match_result[1].length;\n max_field_components_lens[1] = Math.max(max_field_components_lens[1], cur_integer_part_length);\n let cur_fractional_part_length = match_result[2] === undefined ? 0 : match_result[2].length;\n max_field_components_lens[2] = Math.max(max_field_components_lens[2], cur_fractional_part_length);\n}\n\n\nfunction calc_column_stats(active_doc, delim, policy, comment_prefix) {\n let column_stats = [];\n let num_lines = active_doc.lineCount;\n let is_first_line = true;\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning) {\n return [null, lnum + 1];\n }\n for (let fnum = 0; fnum < fields.length; fnum++) {\n let field = fields[fnum].trim();\n if (column_stats.length <= fnum) {\n column_stats.push([0, 0, 0]);\n }\n update_subcomponent_stats(field, is_first_line, column_stats[fnum]);\n }\n is_first_line = false;\n }\n return [column_stats, null];\n}\n\n\nfunction adjust_column_stats(column_stats) {\n // Ensure that numeric components max widths are consistent with non-numeric (header) width.\n let adjusted_stats = [];\n for (let column_stat of column_stats) {\n if (column_stat[1] <= 0) {\n column_stat[1] = -1;\n column_stat[2] = -1;\n }\n if (column_stat[1] > 0) {\n // The sum of integer and float parts can be bigger than the max width, e.g. here:\n // value\n // 0.12\n // 1234\n if (column_stat[1] + column_stat[2] > column_stat[0]) {\n column_stat[0] = column_stat[1] + column_stat[2];\n }\n // This is needed when the header is wider than numeric components and/or their sum.\n if (column_stat[0] - column_stat[2] > column_stat[1]) {\n column_stat[1] = column_stat[0] - column_stat[2];\n }\n // Sanity check.\n if (column_stat[0] != column_stat[1] + column_stat[2]) {\n // Assertion Error, this can never happen.\n return null;\n }\n }\n adjusted_stats.push(column_stat);\n }\n return adjusted_stats;\n}\n\n\nfunction align_field(field, is_first_line, max_field_components_lens, is_last_column) {\n // Align field, use Math.max() to avoid negative delta_length which can happen theorethically due to async doc edit.\n const extra_readability_whitespace_length = 1;\n field = field.trim();\n if (max_field_components_lens[1] == non_numeric_sentinel) {\n let delta_length = Math.max(max_field_components_lens[0] - field.length, 0);\n return is_last_column ? field : field + ' '.repeat(delta_length + extra_readability_whitespace_length);\n }\n if (is_first_line) {\n if (number_regex.exec(field) === null) {\n // The line must be a header - align it using max_width rule.\n let delta_length = Math.max(max_field_components_lens[0] - field.length, 0);\n return is_last_column ? field : field + ' '.repeat(delta_length + extra_readability_whitespace_length);\n }\n }\n let dot_pos = field.indexOf('.');\n let cur_integer_part_length = dot_pos == -1 ? field.length : dot_pos;\n // Here cur_fractional_part_length includes the leading dot too.\n let cur_fractional_part_length = dot_pos == -1 ? 0 : field.length - dot_pos;\n let integer_delta_length = Math.max(max_field_components_lens[1] - cur_integer_part_length, 0);\n let fractional_delta_length = Math.max(max_field_components_lens[2] - cur_fractional_part_length);\n let trailing_spaces = is_last_column ? '' : ' '.repeat(fractional_delta_length + extra_readability_whitespace_length);\n return ' '.repeat(integer_delta_length) + field + trailing_spaces;\n}\n\n\nfunction align_columns(active_doc, delim, policy, comment_prefix, column_stats) {\n let result_lines = [];\n let num_lines = active_doc.lineCount;\n let has_edit = false;\n let is_first_line = true;\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix)) {\n result_lines.push(line_text);\n continue;\n }\n if (lnum + 1 == num_lines && line_text == '') {\n // Skip the last empty line which corresponds to the trailing newline character.\n result_lines.push(line_text);\n continue;\n }\n let fields = csv_utils.smart_split(line_text, delim, policy, true)[0];\n for (let fnum = 0; fnum < fields.length; fnum++) {\n if (fnum >= column_stats.length) // Safeguard against async doc edit, should never happen.\n break;\n let is_last_column = fnum + 1 == column_stats.length;\n let adjusted = align_field(fields[fnum], is_first_line, column_stats[fnum], is_last_column);\n if (fields[fnum] != adjusted) {\n fields[fnum] = adjusted;\n has_edit = true;\n }\n }\n is_first_line = false;\n result_lines.push(fields.join(delim));\n }\n if (!has_edit)\n return null;\n return result_lines.join('\\n');\n}\n\n\nfunction shrink_columns(active_doc, delim, policy, comment_prefix) {\n let result_lines = [];\n let num_lines = active_doc.lineCount;\n let has_edit = false;\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix)) {\n result_lines.push(line_text);\n continue;\n }\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning) {\n return [null, lnum + 1];\n }\n for (let i = 0; i < fields.length; i++) {\n let adjusted = fields[i].trim();\n if (fields[i].length != adjusted.length) {\n fields[i] = adjusted;\n has_edit = true;\n }\n }\n result_lines.push(fields.join(delim));\n }\n if (!has_edit)\n return [null, null];\n return [result_lines.join('\\n'), null];\n}\n\n\nfunction get_last(arr) {\n return arr[arr.length - 1];\n}\n\n\nfunction populate_optimistic_rfc_csv_record_map(document, requested_end_record, dst_record_map, comment_prefix=null) {\n let num_lines = document.lineCount;\n let record_begin = null;\n let start_line_idx = dst_record_map.length ? get_last(dst_record_map)[1] : 0;\n for (let lnum = start_line_idx; lnum < num_lines && dst_record_map.length < requested_end_record; ++lnum) {\n let line_text = document.lineAt(lnum).text;\n if (lnum + 1 >= num_lines && line_text == \"\")\n break; // Skip the last empty line.\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let match_list = line_text.match(/\"/g);\n let has_unbalanced_double_quote = match_list && match_list.length % 2 == 1;\n if (record_begin === null && !has_unbalanced_double_quote) {\n dst_record_map.push([lnum, lnum + 1]);\n } else if (record_begin === null && has_unbalanced_double_quote) {\n record_begin = lnum;\n } else if (!has_unbalanced_double_quote) {\n continue;\n } else {\n dst_record_map.push([record_begin, lnum + 1]);\n record_begin = null;\n }\n }\n if (record_begin !== null) {\n dst_record_map.push([record_begin, num_lines]);\n }\n}\n\n\nfunction make_table_name_key(file_path) {\n return 'rbql_table_name:' + file_path;\n}\n\n\nfunction expanduser(filepath) {\n if (filepath.charAt(0) === '~') {\n return path.join(os.homedir(), filepath.slice(1));\n }\n return filepath;\n}\n\n\nfunction find_table_path(vscode_global_state, main_table_dir, table_id) {\n // If table_id is a relative path it could be relative either to the current directory or to the main table dir.\n var candidate_path = expanduser(table_id);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n if (main_table_dir && !path.isAbsolute(candidate_path)) {\n candidate_path = path.join(main_table_dir, candidate_path);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n }\n let table_path = vscode_global_state ? vscode_global_state.get(make_table_name_key(table_id)) : null;\n if (table_path && fs.existsSync(table_path)) {\n return table_path;\n }\n return null;\n}\n\n\nasync function read_header(table_path, encoding) {\n if (encoding == 'latin-1')\n encoding = 'binary';\n let readline = require('readline');\n let input_reader = readline.createInterface({ input: fs.createReadStream(table_path, {encoding: encoding}) });\n let closed = false;\n let promise_resolve = null;\n let promise_reject = null;\n let output_promise = new Promise(function(resolve, reject) {\n promise_resolve = resolve;\n promise_reject = reject;\n });\n input_reader.on('line', line => {\n if (!closed) {\n closed = true;\n input_reader.close();\n promise_resolve(line);\n }\n });\n input_reader.on('error', error => {\n promise_reject(error);\n });\n return output_promise;\n}\n\n\nfunction get_header_line(document, comment_prefix) {\n const num_lines = document.lineCount;\n for (let lnum = 0; lnum < num_lines; ++lnum) {\n const line_text = document.lineAt(lnum).text;\n if (!comment_prefix || !line_text.startsWith(comment_prefix)) {\n return line_text;\n }\n }\n return null;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\n\nclass RbqlIOHandlingError extends Error {}\n\nclass VSCodeRecordIterator extends rbql.RBQLInputIterator {\n constructor(document, delim, policy, has_header=false, comment_prefix=null, table_name='input', variable_prefix='a') {\n // We could have done a hack here actually: convert the document to stream/buffer and then use the standard reader.\n super();\n this.document = document;\n this.delim = delim;\n this.policy = policy;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.table_name = table_name;\n this.variable_prefix = variable_prefix;\n this.NR = 0; // Record number.\n this.NL = 0; // Line number (NL != NR when the CSV file has comments or multiline fields).\n this.fields_info = new Object();\n this.first_defective_line = null;\n this.first_record = this.get_first_record();\n }\n\n stop() {\n }\n\n get_first_record() {\n let header_line = get_header_line(this.document, this.comment_prefix);\n let first_record = csv_utils.smart_split(header_line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n return first_record;\n }\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n rbql.parse_basic_variables(query_text, this.variable_prefix, variable_map);\n rbql.parse_array_variables(query_text, this.variable_prefix, variable_map);\n let header_line = get_header_line(this.document, this.comment_prefix);\n let first_record = csv_utils.smart_split(header_line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n if (this.has_header) {\n rbql.parse_attribute_variables(query_text, this.variable_prefix, first_record, 'CSV header line', variable_map);\n rbql.parse_dictionary_variables(query_text, this.variable_prefix, first_record, variable_map);\n }\n return variable_map;\n }\n\n async get_header() {\n return this.has_header ? this.first_record : null;\n }\n\n get_line_rfc() {\n let rfc_line_buffer = [];\n const num_lines = this.document.lineCount;\n while (this.NL < num_lines) {\n let line = this.document.lineAt(this.NL).text;\n this.NL += 1;\n if (this.NL == num_lines && line.length == 0)\n return null; // Skip the last line if it is empty - this can happen due to trailing newline.\n let record_line = csv_utils.accumulate_rfc_line_into_record(rfc_line_buffer, line, this.comment_prefix);\n if (record_line !== null)\n return record_line;\n }\n return null;\n }\n\n get_line_simple() {\n const num_lines = this.document.lineCount;\n while (this.NL < num_lines) {\n let line = this.document.lineAt(this.NL).text;\n this.NL += 1;\n if (this.NL == num_lines && line.length == 0)\n return null; // Skip the last line if it is empty - this can happen due to trailing newline.\n if (this.comment_prefix === null || !line.startsWith(this.comment_prefix))\n return line;\n }\n return null;\n }\n\n do_get_record() {\n let line = (this.policy == 'quoted_rfc') ? this.get_line_rfc() : this.get_line_simple();\n if (line === null)\n return null;\n let [record, warning] = csv_utils.smart_split(line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false);\n if (warning) {\n if (this.first_defective_line === null) {\n this.first_defective_line = this.NL;\n if (this.policy == 'quoted_rfc')\n throw new RbqlIOHandlingError(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`);\n }\n }\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.NR;\n return record;\n }\n\n async get_record() {\n if (this.NR == 0 && this.has_header) {\n this.do_get_record(); // Skip the header record.\n }\n this.NR += 1;\n let record = this.do_get_record();\n return record;\n }\n\n get_warnings() {\n let result = [];\n if (this.first_defective_line !== null)\n result.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`);\n if (Object.keys(this.fields_info).length > 1)\n result.push(make_inconsistent_num_fields_warning(this.table_name, this.fields_info));\n return result;\n }\n}\n\n\nclass VSCodeWriter extends rbql.RBQLOutputWriter {\n constructor(delim, policy) {\n super();\n this.delim = delim;\n this.policy = policy;\n this.header_len = null;\n this.null_in_output = false;\n this.delim_in_simple_output = false;\n this.output_lines = [];\n\n if (policy == 'simple') {\n this.polymorphic_join = this.simple_join;\n } else if (policy == 'quoted') {\n this.polymorphic_join = this.quoted_join;\n } else if (policy == 'quoted_rfc') {\n this.polymorphic_join = this.quoted_join_rfc;\n } else if (policy == 'monocolumn') {\n this.polymorphic_join = this.mono_join;\n } else if (policy == 'whitespace') {\n this.polymorphic_join = this.simple_join;\n } else {\n throw new RbqlIOHandlingError('Unknown output csv policy');\n }\n }\n\n set_header(header) {\n if (header !== null) {\n this.header_len = header.length;\n this.write(header);\n }\n }\n\n quoted_join(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n quoted_join_rfc(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.rfc_quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n mono_join(fields) {\n if (fields.length > 1) {\n throw new RbqlIOHandlingError('Unable to use \"Monocolumn\" output format: some records have more than one field');\n }\n return fields[0];\n };\n\n\n simple_join(fields) {\n var res = fields.join(this.delim);\n if (fields.join('').indexOf(this.delim) != -1) {\n this.delim_in_simple_output = true;\n }\n return res;\n };\n\n\n normalize_fields(out_fields) {\n for (var i = 0; i < out_fields.length; i++) {\n if (out_fields[i] == null) {\n this.null_in_output = true;\n out_fields[i] = '';\n } else if (Array.isArray(out_fields[i])) {\n this.normalize_fields(out_fields[i]);\n out_fields[i] = out_fields[i].join(this.sub_array_delim);\n }\n }\n };\n\n\n write(fields) {\n if (this.header_len !== null && fields.length != this.header_len)\n throw new RbqlIOHandlingError(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${fields.length}`);\n this.normalize_fields(fields);\n this.output_lines.push(this.polymorphic_join(fields));\n return true;\n };\n\n async finish() {\n }\n\n get_warnings() {\n let result = [];\n if (this.null_in_output)\n result.push('null values in output were replaced by empty strings');\n if (this.delim_in_simple_output)\n result.push('Some output fields contain separator');\n return result;\n };\n}\n\nclass VSCodeTableRegistry {\n constructor(){}\n\n get_iterator_by_table_id(_table_id) {\n throw new RbqlIOHandlingError(\"JOIN queries are currently not supported in vscode.dev web version.\");\n }\n\n get_warnings() {\n return [];\n };\n}\n\nasync function rbql_query_web(query_text, input_document, input_delim, input_policy, output_delim, output_policy, output_warnings, with_headers, comment_prefix=null) {\n let user_init_code = ''; // TODO find a way to have init code.\n let join_tables_registry = new VSCodeTableRegistry(); // TODO find a way to have join registry.\n let input_iterator = new VSCodeRecordIterator(input_document, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new VSCodeWriter(output_delim, output_policy);\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n return output_writer.output_lines;\n}\n\n\nclass VSCodeFileSystemCSVRegistry extends rbql.RBQLTableRegistry {\n constructor(vscode_global_state, input_file_dir, delim, policy, encoding, has_header=false, comment_prefix=null, options=null) {\n super();\n this.vscode_global_state = vscode_global_state;\n this.input_file_dir = input_file_dir;\n this.delim = delim;\n this.policy = policy;\n this.encoding = encoding;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.stream = null;\n this.record_iterator = null;\n\n this.options = options;\n this.bulk_input_path = null;\n this.table_path = null;\n }\n\n get_iterator_by_table_id(table_id) {\n this.table_path = find_table_path(this.vscode_global_state, this.input_file_dir, table_id);\n if (this.table_path === null) {\n throw new RbqlIOHandlingError(`Unable to find join table \"${table_id}\"`);\n }\n if (this.options && this.options['bulk_read']) {\n this.bulk_input_path = this.table_path;\n } else {\n this.stream = fs.createReadStream(this.table_path);\n }\n this.record_iterator = new rbql_csv.CSVRecordIterator(this.stream, this.bulk_input_path, this.encoding, this.delim, this.policy, this.has_header, this.comment_prefix, table_id, 'b');\n return this.record_iterator;\n };\n\n get_warnings(output_warnings) {\n if (this.record_iterator && this.has_header) {\n output_warnings.push(`The first record in JOIN file ${path.basename(this.table_path)} was also treated as header (and skipped)`);\n }\n }\n}\n\n\nasync function rbql_query_node(vscode_global_state, query_text, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, output_warnings, with_headers=false, comment_prefix=null, user_init_code='', options=null) {\n let input_stream = null;\n let bulk_input_path = null;\n if (options && options['bulk_read'] && input_path) {\n bulk_input_path = input_path;\n } else {\n input_stream = input_path === null ? process.stdin : fs.createReadStream(input_path);\n }\n let [output_stream, close_output_on_finish] = output_path === null ? [process.stdout, false] : [fs.createWriteStream(output_path), true];\n if (input_delim == '\"' && input_policy == 'quoted')\n throw new RbqlIOHandlingError('Double quote delimiter is incompatible with \"quoted\" policy');\n if (csv_encoding == 'latin-1')\n csv_encoding = 'binary';\n if (!rbql_csv.is_ascii(query_text) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n if ((!rbql_csv.is_ascii(input_delim) || !rbql_csv.is_ascii(output_delim)) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n\n let default_init_source_path = path.join(os.homedir(), '.rbql_init_source.js');\n if (user_init_code == '' && fs.existsSync(default_init_source_path)) {\n user_init_code = rbql_csv.read_user_init_code(default_init_source_path);\n }\n let input_file_dir = input_path ? path.dirname(input_path) : null;\n let join_tables_registry = new VSCodeFileSystemCSVRegistry(vscode_global_state, input_file_dir, input_delim, input_policy, csv_encoding, with_headers, comment_prefix, options);\n let input_iterator = new rbql_csv.CSVRecordIterator(input_stream, bulk_input_path, csv_encoding, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new rbql_csv.CSVWriter(output_stream, close_output_on_finish, csv_encoding, output_delim, output_policy);\n\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n join_tables_registry.get_warnings(output_warnings);\n}\n\n\nmodule.exports.make_table_name_key = make_table_name_key;\nmodule.exports.find_table_path = find_table_path;\nmodule.exports.read_header = read_header;\nmodule.exports.rbql_query_web = rbql_query_web;\nmodule.exports.rbql_query_node = rbql_query_node;\nmodule.exports.get_header_line = get_header_line;\nmodule.exports.populate_optimistic_rfc_csv_record_map = populate_optimistic_rfc_csv_record_map;\nmodule.exports.get_default_js_udf_content = get_default_js_udf_content;\nmodule.exports.get_default_python_udf_content = get_default_python_udf_content;\nmodule.exports.align_columns = align_columns;\nmodule.exports.shrink_columns = shrink_columns;\nmodule.exports.calc_column_stats = calc_column_stats;\nmodule.exports.adjust_column_stats = adjust_column_stats;\nmodule.exports.update_subcomponent_stats = update_subcomponent_stats;\nmodule.exports.align_field = align_field;\n","let field_regular_expression = '\"((?:[^\"]*\"\")*[^\"]*)\"';\nlet field_rgx = new RegExp('^' + field_regular_expression);\nlet field_rgx_external_whitespaces = new RegExp('^ *' + field_regular_expression + ' *');\n\n\n// TODO consider making this file (and rbql.js) both node and browser compatible: https://caolan.org/posts/writing_for_node_and_the_browser.html\n\n\nfunction split_lines(text) {\n return text.split(/\\r\\n|\\r|\\n/);\n}\n\n\nfunction extract_next_field(src, dlm, preserve_quotes_and_whitespaces, allow_external_whitespaces, cidx, result) {\n var warning = false;\n let src_cur = src.substring(cidx);\n let rgx = allow_external_whitespaces ? field_rgx_external_whitespaces : field_rgx;\n let match_obj = rgx.exec(src_cur);\n if (match_obj !== null) {\n let match_end = match_obj[0].length;\n if (cidx + match_end == src.length || src[cidx + match_end] == dlm) {\n if (preserve_quotes_and_whitespaces) {\n result.push(match_obj[0]);\n } else {\n result.push(match_obj[1].replace(/\"\"/g, '\"'));\n }\n return [cidx + match_end + 1, false];\n }\n warning = true;\n }\n var uidx = src.indexOf(dlm, cidx);\n if (uidx == -1)\n uidx = src.length;\n var field = src.substring(cidx, uidx);\n warning = warning || field.indexOf('\"') != -1;\n result.push(field);\n return [uidx + 1, warning];\n}\n\n\nfunction split_quoted_str(src, dlm, preserve_quotes_and_whitespaces=false) {\n // This function is newline-agnostic i.e. it can also split records with multiline fields.\n if (src.indexOf('\"') == -1) // Optimization for most common case\n return [src.split(dlm), false];\n var result = [];\n var cidx = 0;\n var warning = false;\n let allow_external_whitespaces = dlm != ' ';\n while (cidx < src.length) {\n var extraction_report = extract_next_field(src, dlm, preserve_quotes_and_whitespaces, allow_external_whitespaces, cidx, result);\n cidx = extraction_report[0];\n warning = warning || extraction_report[1];\n }\n if (src.charAt(src.length - 1) == dlm)\n result.push('');\n return [result, warning];\n}\n\n\nfunction quote_field(src, delim) {\n if (src.indexOf(delim) != -1 || src.indexOf('\"') != -1) {\n var escaped = src.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n }\n return src;\n}\n\n\nfunction rfc_quote_field(src, delim) {\n if (src.indexOf(delim) != -1 || src.indexOf('\"') != -1 || src.indexOf('\\n') != -1 || src.indexOf('\\r') != -1) {\n var escaped = src.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n }\n return src;\n}\n\n\nfunction unquote_field(field) {\n let rgx = new RegExp('^' + ' *' + field_regular_expression + ' *$');\n let match_obj = rgx.exec(field);\n if (match_obj !== null) {\n return match_obj[1].replace(/\"\"/g, '\"');\n }\n return field;\n}\n\n\nfunction unquote_fields(fields) {\n return fields.map(unquote_field);\n}\n\n\nfunction split_whitespace_separated_str(src, preserve_whitespaces=false) {\n var rgxp = preserve_whitespaces ? new RegExp(' *[^ ]+ *', 'g') : new RegExp('[^ ]+', 'g');\n let result = [];\n let match_obj = null;\n while((match_obj = rgxp.exec(src)) !== null) {\n result.push(match_obj[0]);\n }\n if (preserve_whitespaces) {\n for (let i = 0; i < result.length - 1; i++) {\n result[i] = result[i].slice(0, -1);\n }\n }\n return result;\n}\n\n\nfunction smart_split(src, dlm, policy, preserve_quotes_and_whitespaces) {\n if (policy === 'simple')\n return [src.split(dlm), false];\n if (policy === 'whitespace')\n return [split_whitespace_separated_str(src, preserve_quotes_and_whitespaces), false];\n if (policy === 'monocolumn')\n return [[src], false];\n return split_quoted_str(src, dlm, preserve_quotes_and_whitespaces);\n}\n\n\nfunction accumulate_rfc_line_into_record(external_rfc_line_buffer, current_line, comment_prefix=null) {\n // Return null if the current line yields no record.\n // Return a record string if the current line yields the record and cleans the external line buffer.\n if (comment_prefix !== null && external_rfc_line_buffer.length == 0 && current_line.startsWith(comment_prefix))\n return null;\n let match_list = current_line.match(/\"/g);\n let has_unbalanced_double_quote = match_list && match_list.length % 2 == 1;\n if (external_rfc_line_buffer.length == 0 && !has_unbalanced_double_quote) {\n return current_line;\n } else if (external_rfc_line_buffer.length == 0 && has_unbalanced_double_quote) {\n external_rfc_line_buffer.push(current_line);\n } else if (!has_unbalanced_double_quote) {\n external_rfc_line_buffer.push(current_line);\n } else {\n external_rfc_line_buffer.push(current_line);\n let multiline_row = external_rfc_line_buffer.join('\\n');\n external_rfc_line_buffer.splice(0, external_rfc_line_buffer.length); // Cleanup the external buffer.\n return multiline_row;\n }\n return null;\n}\n\n\nmodule.exports.split_quoted_str = split_quoted_str;\nmodule.exports.split_whitespace_separated_str = split_whitespace_separated_str;\nmodule.exports.smart_split = smart_split;\nmodule.exports.quote_field = quote_field;\nmodule.exports.rfc_quote_field = rfc_quote_field;\nmodule.exports.unquote_field = unquote_field;\nmodule.exports.unquote_fields = unquote_fields;\nmodule.exports.split_lines = split_lines;\nmodule.exports.accumulate_rfc_line_into_record = accumulate_rfc_line_into_record;\n","(function(exports){\n// The magic line above is to make the module both browser and Node compatible, see https://stackoverflow.com/questions/3225251/how-can-i-share-code-between-node-js-and-the-browser\n\n// This module works with records only. It is CSV-agnostic.\n// Do not add CSV-related logic or variables/functions/objects like \"delim\", \"separator\" etc\n\n\nclass RbqlParsingError extends Error {}\nclass RbqlRuntimeError extends Error {}\nclass AssertionError extends Error {}\nclass RbqlIOHandlingError extends Error {}\n\n\nclass InternalBadFieldError extends Error {\n constructor(bad_idx, ...params) {\n super(...params);\n this.bad_idx = bad_idx;\n }\n}\n\n\nfunction assert(condition, message=null) {\n if (!condition) {\n if (!message) {\n message = 'Assertion error';\n }\n throw new AssertionError(message);\n }\n}\n\n\nfunction replace_all(src, search, replacement) {\n return src.split(search).join(replacement);\n}\n\n\nclass RBQLContext {\n constructor(query_text, input_iterator, output_writer, user_init_code) {\n this.query_text = query_text;\n this.input_iterator = input_iterator;\n this.writer = output_writer;\n this.user_init_code = user_init_code;\n\n this.unnest_list = null;\n this.top_count = null;\n\n this.like_regex_cache = new Map();\n\n this.sort_key_expression = null;\n\n this.aggregation_stage = 0;\n this.aggregation_key_expression = null;\n this.functional_aggregators = [];\n\n this.join_map_impl = null;\n this.join_map = null;\n this.lhs_join_var_expression = null;\n\n this.where_expression = null;\n\n this.select_expression = null;\n\n this.update_expressions = null;\n\n this.variables_init_code = null;\n }\n}\n\nvar query_context = null; // Needs to be global for MIN(), MAX(), etc functions. TODO find a way to make it local.\n\n\nconst wrong_aggregation_usage_error = 'Usage of RBQL aggregation functions inside JavaScript expressions is not allowed, see the docs';\nconst RBQL_VERSION = '0.25.0';\n\n\nfunction check_if_brackets_match(opening_bracket, closing_bracket) {\n return (opening_bracket == '[' && closing_bracket == ']') || (opening_bracket == '(' && closing_bracket == ')') || (opening_bracket == '{' && closing_bracket == '}');\n}\n\n\nfunction parse_root_bracket_level_text_spans(select_expression) {\n let text_spans = []; // parts of text separated by commas at the root parenthesis level\n let last_pos = 0;\n let bracket_stack = [];\n for (let i = 0; i < select_expression.length; i++) {\n let cur_char = select_expression[i];\n if (cur_char == ',' && bracket_stack.length == 0) {\n text_spans.push(select_expression.substring(last_pos, i));\n last_pos = i + 1;\n } else if (['[', '{', '('].indexOf(cur_char) != -1) {\n bracket_stack.push(cur_char);\n } else if ([']', '}', ')'].indexOf(cur_char) != -1) {\n if (bracket_stack.length && check_if_brackets_match(bracket_stack[bracket_stack.length - 1], cur_char)) {\n bracket_stack.pop();\n } else {\n throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching opening bracket for closing \"${cur_char}\"`);\n }\n }\n }\n if (bracket_stack.length) {\n throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching closing bracket for opening \"${bracket_stack[0]}\"`);\n }\n text_spans.push(select_expression.substring(last_pos, select_expression.length));\n text_spans = text_spans.map(span => span.trim());\n return text_spans;\n}\n\n\nfunction unquote_string(quoted_str) {\n // It's possible to use eval here to unqoute the quoted_column_name, but it would be a little barbaric, let's do it manually instead\n if (!quoted_str || quoted_str.length < 2)\n return null;\n if (quoted_str[0] == \"'\" && quoted_str[quoted_str.length - 1] == \"'\") {\n return quoted_str.substring(1, quoted_str.length - 1).replace(/\\\\'/g, \"'\").replace(/\\\\\\\\/g, \"\\\\\");\n } else if (quoted_str[0] == '\"' && quoted_str[quoted_str.length - 1] == '\"') {\n return quoted_str.substring(1, quoted_str.length - 1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, \"\\\\\");\n } else {\n return null;\n }\n}\n\n\nfunction column_info_from_text_span(text_span, string_literals) {\n // This function is a rough equivalent of \"column_info_from_node()\" function in python version of RBQL\n text_span = text_span.trim();\n let rbql_star_marker = '__RBQL_INTERNAL_STAR';\n let simple_var_match = /^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(text_span);\n let attribute_match = /^([ab])\\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(text_span);\n let subscript_int_match = /^([ab])\\[([0-9]+)\\]$/.exec(text_span);\n let subscript_str_match = /^([ab])\\[___RBQL_STRING_LITERAL([0-9]+)___\\]$/.exec(text_span);\n if (simple_var_match !== null) {\n if (text_span == rbql_star_marker)\n return {table_name: null, column_index: null, column_name: null, is_star: true};\n if (text_span.startsWith('___RBQL_STRING_LITERAL'))\n return null;\n let match = /^([ab])([0-9]+)$/.exec(text_span);\n if (match !== null) {\n return {table_name: match[1], column_index: parseInt(match[2]) - 1, column_name: null, is_star: false};\n }\n // Some examples for this branch: NR, NF\n return {table_name: null, column_index: null, column_name: text_span, is_star: false};\n } else if (attribute_match !== null) {\n let table_name = attribute_match[1];\n let column_name = attribute_match[2];\n if (column_name == rbql_star_marker) {\n return {table_name: table_name, column_index: null, column_name: null, is_star: true};\n }\n return {table_name: null, column_index: null, column_name: column_name, is_star: false};\n } else if (subscript_int_match != null) {\n let table_name = subscript_int_match[1];\n let column_index = parseInt(subscript_int_match[2]) - 1;\n return {table_name: table_name, column_index: column_index, column_name: null, is_star: false};\n } else if (subscript_str_match != null) {\n let table_name = subscript_str_match[1];\n let replaced_string_literal_id = subscript_str_match[2];\n if (replaced_string_literal_id < string_literals.length) {\n let quoted_column_name = string_literals[replaced_string_literal_id];\n let unquoted_column_name = unquote_string(quoted_column_name);\n if (unquoted_column_name !== null && unquoted_column_name !== undefined) {\n return {table_name: null, column_index: null, column_name: unquoted_column_name, is_star: false};\n }\n }\n }\n return null;\n}\n\n\nfunction adhoc_parse_select_expression_to_column_infos(select_expression, string_literals) {\n // It is acceptable for the algorithm to provide null column name when it could be theorethically possible to deduce the name.\n // I.e. this algorithm guarantees precision but doesn't guarantee completeness in all theorethically possible queries.\n // Although the algorithm should be complete in all practical scenarios, i.e. it should be hard to come up with the query that doesn't produce complete set of column names.\n // The null column name just means that the output column will be named as col{i}, so the failure to detect the proper column name can be tolerated.\n // Specifically this function guarantees the following:\n // 1. The number of column_infos is correct and will match the number of fields in each record in the output - otherwise the exception should be thrown\n // 2. If column_info at pos j is not null, it is guaranteed to correctly represent that column name in the output\n let text_spans = parse_root_bracket_level_text_spans(select_expression);\n let column_infos = text_spans.map(ts => column_info_from_text_span(ts, string_literals));\n return column_infos;\n}\n\n\nfunction stable_compare(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i])\n return a[i] < b[i] ? -1 : 1;\n }\n}\n\n\nfunction safe_get(record, idx) {\n return idx < record.length ? record[idx] : null;\n}\n\n\nfunction safe_join_get(record, idx) {\n if (idx < record.length) {\n return record[idx];\n }\n throw new InternalBadFieldError(idx);\n}\n\n\nfunction safe_set(record, idx, value) {\n if (idx < record.length) {\n record[idx] = value;\n } else {\n throw new InternalBadFieldError(idx);\n }\n}\n\n\nfunction regexp_escape(text) {\n // From here: https://stackoverflow.com/a/6969486/2898283\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched text\n}\n\n\nfunction like_to_regex(pattern) {\n let p = 0;\n let i = 0;\n let converted = '';\n while (i < pattern.length) {\n if (pattern.charAt(i) == '_' || pattern.charAt(i) == '%') {\n converted += regexp_escape(pattern.substring(p, i));\n p = i + 1;\n if (pattern.charAt(i) == '_') {\n converted += '.';\n } else {\n converted += '.*';\n }\n }\n i += 1;\n }\n converted += regexp_escape(pattern.substring(p, i));\n return '^' + converted + '$';\n}\n\n\nfunction like(text, pattern) {\n let matcher = query_context.like_regex_cache.get(pattern);\n if (matcher === undefined) {\n matcher = new RegExp(like_to_regex(pattern));\n query_context.like_regex_cache.set(pattern, matcher);\n }\n return matcher.test(text);\n}\nconst LIKE = like;\n\n\nclass RBQLAggregationToken {\n constructor(marker_id, value) {\n this.marker_id = marker_id;\n this.value = value;\n }\n\n toString() {\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n }\n}\n\n\nclass UnnestMarker {}\n\n\nfunction UNNEST(vals) {\n if (query_context.unnest_list !== null) {\n // Technically we can support multiple UNNEST's but the implementation/algorithm is more complex and just doesn't worth it\n throw new RbqlParsingError('Only one UNNEST is allowed per query');\n }\n query_context.unnest_list = vals;\n return new UnnestMarker();\n}\nconst unnest = UNNEST;\nconst Unnest = UNNEST;\nconst UNFOLD = UNNEST; // \"UNFOLD\" is deprecated, just for backward compatibility\n\n\nfunction parse_number(val) {\n // We can do a more pedantic number test like `/^ *-{0,1}[0-9]+\\.{0,1}[0-9]* *$/.test(val)`, but user will probably use just Number(val) or parseInt/parseFloat\n let result = Number(val);\n if (isNaN(result)) {\n throw new RbqlRuntimeError(`Unable to convert value \"${val}\" to a number. MIN, MAX, SUM, AVG, MEDIAN and VARIANCE aggregate functions convert their string arguments to numeric values`);\n }\n return result;\n}\n\n\nclass MinAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, Math.min(cur_aggr, val));\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\n\nclass MaxAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, Math.max(cur_aggr, val));\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass SumAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, cur_aggr + val);\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass AvgAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val, 1]);\n } else {\n var cur_sum = cur_aggr[0];\n var cur_cnt = cur_aggr[1];\n this.stats.set(key, [cur_sum + val, cur_cnt + 1]);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n var cur_sum = cur_aggr[0];\n var cur_cnt = cur_aggr[1];\n var avg = cur_sum / cur_cnt;\n return avg;\n }\n}\n\n\nclass VarianceAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val, val * val, 1]);\n } else {\n var cur_sum = cur_aggr[0];\n var cur_sum_sq = cur_aggr[1];\n var cur_cnt = cur_aggr[2];\n this.stats.set(key, [cur_sum + val, cur_sum_sq + val * val, cur_cnt + 1]);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n var cur_sum = cur_aggr[0];\n var cur_sum_sq = cur_aggr[1];\n var cur_cnt = cur_aggr[2];\n var avg_val = cur_sum / cur_cnt;\n var variance = cur_sum_sq / cur_cnt - avg_val * avg_val;\n return variance;\n }\n}\n\n\nclass MedianAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val]);\n } else {\n cur_aggr.push(val);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n cur_aggr.sort(function(a, b) { return a - b; });\n var m = Math.floor(cur_aggr.length / 2);\n if (cur_aggr.length % 2) {\n return cur_aggr[m];\n } else {\n return (cur_aggr[m - 1] + cur_aggr[m]) / 2.0;\n }\n }\n}\n\n\nclass CountAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, 1);\n } else {\n this.stats.set(key, cur_aggr + 1);\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass ArrayAggAggregator {\n constructor(post_proc=null) {\n this.post_proc = post_proc;\n this.stats = new Map();\n }\n\n increment(key, val) {\n let cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val]);\n } else {\n cur_aggr.push(val);\n }\n }\n\n get_final(key) {\n let cur_aggr = this.stats.get(key);\n if (this.post_proc === null)\n return cur_aggr;\n return this.post_proc(cur_aggr);\n }\n}\n\n\nclass ConstGroupVerifier {\n constructor(output_index) {\n this.output_index = output_index;\n this.const_values = new Map();\n }\n\n increment(key, value) {\n var old_value = this.const_values.get(key);\n if (old_value === undefined) {\n this.const_values.set(key, value);\n } else if (old_value != value) {\n throw new RbqlRuntimeError(`Invalid aggregate expression: non-constant values in output column ${this.output_index + 1}. E.g. \"${old_value}\" and \"${value}\"`);\n }\n }\n\n get_final(key) {\n return this.const_values.get(key);\n }\n}\n\n\nfunction init_aggregator(generator_name, val, post_proc=null) {\n query_context.aggregation_stage = 1;\n var res = new RBQLAggregationToken(query_context.functional_aggregators.length, val);\n if (post_proc === null) {\n query_context.functional_aggregators.push(new generator_name());\n } else {\n query_context.functional_aggregators.push(new generator_name(post_proc));\n }\n return res;\n}\n\n\nfunction MIN(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MinAggregator, val) : val;\n}\nconst min = MIN;\nconst Min = MIN;\n\n\nfunction MAX(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MaxAggregator, val) : val;\n}\nconst max = MAX;\nconst Max = MAX;\n\nfunction COUNT(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(CountAggregator, 1) : 1;\n}\nconst count = COUNT;\nconst Count = COUNT;\n\nfunction SUM(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(SumAggregator, val) : val;\n}\nconst sum = SUM;\nconst Sum = SUM;\n\nfunction AVG(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(AvgAggregator, val) : val;\n}\nconst avg = AVG;\nconst Avg = AVG;\n\nfunction VARIANCE(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(VarianceAggregator, val) : val;\n}\nconst variance = VARIANCE;\nconst Variance = VARIANCE;\n\nfunction MEDIAN(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MedianAggregator, val) : val;\n}\nconst median = MEDIAN;\nconst Median = MEDIAN;\n\nfunction ARRAY_AGG(val, post_proc=null) {\n return query_context.aggregation_stage < 2 ? init_aggregator(ArrayAggAggregator, val, post_proc) : val;\n}\nconst array_agg = ARRAY_AGG;\nconst FOLD = ARRAY_AGG; // \"FOLD\" is deprecated, just for backward compatibility\n\n\nfunction add_to_set(dst_set, value) {\n var len_before = dst_set.size;\n dst_set.add(value);\n return len_before != dst_set.size;\n}\n\n\nclass TopWriter {\n constructor(subwriter, top_count) {\n this.subwriter = subwriter;\n this.NW = 0;\n this.top_count = top_count;\n }\n\n async write(record) {\n if (this.top_count !== null && this.NW >= this.top_count)\n return false;\n await this.subwriter.write(record);\n this.NW += 1;\n return true;\n }\n\n async finish() {\n await this.subwriter.finish();\n }\n}\n\n\nclass UniqWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.seen = new Set();\n }\n\n async write(record) {\n if (!add_to_set(this.seen, JSON.stringify(record)))\n return true;\n if (!await this.subwriter.write(record))\n return false;\n return true;\n }\n\n async finish() {\n await this.subwriter.finish();\n }\n}\n\n\nclass UniqCountWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.records = new Map();\n }\n\n async write(record) {\n var key = JSON.stringify(record);\n var old_val = this.records.get(key);\n if (old_val) {\n old_val[0] += 1;\n } else {\n this.records.set(key, [1, record]);\n }\n return true;\n }\n\n async finish() {\n for (var [key, value] of this.records) {\n let [count, record] = value;\n record.unshift(count);\n if (!await this.subwriter.write(record))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass SortedWriter {\n constructor(subwriter, reverse_sort) {\n this.subwriter = subwriter;\n this.reverse_sort = reverse_sort;\n this.unsorted_entries = [];\n }\n\n async write(stable_entry) {\n this.unsorted_entries.push(stable_entry);\n return true;\n }\n\n async finish() {\n var unsorted_entries = this.unsorted_entries;\n unsorted_entries.sort(stable_compare);\n if (this.reverse_sort)\n unsorted_entries.reverse();\n for (var i = 0; i < unsorted_entries.length; i++) {\n var entry = unsorted_entries[i];\n if (!await this.subwriter.write(entry[entry.length - 1]))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass AggregateWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.aggregators = [];\n this.aggregation_keys = new Set();\n }\n\n async finish() {\n var all_keys = Array.from(this.aggregation_keys);\n all_keys.sort();\n for (var i = 0; i < all_keys.length; i++) {\n var key = all_keys[i];\n var out_fields = [];\n for (var ag of this.aggregators) {\n out_fields.push(ag.get_final(key));\n }\n if (!await this.subwriter.write(out_fields))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass InnerJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n }\n\n get_rhs(lhs_key) {\n return this.join_map.get_join_records(lhs_key);\n }\n}\n\n\nclass LeftJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n this.null_record = [[null, join_map.max_record_len, Array(join_map.max_record_len).fill(null)]];\n }\n\n get_rhs(lhs_key) {\n let result = this.join_map.get_join_records(lhs_key);\n if (result.length == 0) {\n return this.null_record;\n }\n return result;\n }\n}\n\n\nclass StrictLeftJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n }\n\n get_rhs(lhs_key) {\n let result = this.join_map.get_join_records(lhs_key);\n if (result.length != 1) {\n throw new RbqlRuntimeError('In \"STRICT LEFT JOIN\" each key in A must have exactly one match in B. Bad A key: \"' + lhs_key + '\"');\n }\n return result;\n }\n}\n\n\nfunction select_except(src, except_fields) {\n let result = [];\n for (let i = 0; i < src.length; i++) {\n if (except_fields.indexOf(i) == -1)\n result.push(src[i]);\n }\n return result;\n}\n\n\nasync function select_simple(sort_key, NR, out_fields) {\n if (query_context.sort_key_expression !== null) {\n var sort_entry = sort_key.concat([NR, out_fields]);\n if (!await query_context.writer.write(sort_entry))\n return false;\n } else {\n if (!await query_context.writer.write(out_fields))\n return false;\n }\n return true;\n}\n\n\nfunction select_aggregated(key, transparent_values) {\n if (key !== null) {\n key = JSON.stringify(key);\n }\n if (query_context.aggregation_stage === 1) {\n if (!(query_context.writer instanceof TopWriter)) {\n throw new RbqlParsingError('\"ORDER BY\", \"UPDATE\" and \"DISTINCT\" keywords are not allowed in aggregate queries');\n }\n query_context.writer = new AggregateWriter(query_context.writer);\n let num_aggregators_found = 0;\n for (var i = 0; i < transparent_values.length; i++) {\n var trans_value = transparent_values[i];\n if (trans_value instanceof RBQLAggregationToken) {\n query_context.writer.aggregators.push(query_context.functional_aggregators[trans_value.marker_id]);\n query_context.writer.aggregators[query_context.writer.aggregators.length - 1].increment(key, trans_value.value);\n num_aggregators_found += 1;\n } else {\n query_context.writer.aggregators.push(new ConstGroupVerifier(query_context.writer.aggregators.length));\n query_context.writer.aggregators[query_context.writer.aggregators.length - 1].increment(key, trans_value);\n }\n }\n if (num_aggregators_found != query_context.functional_aggregators.length) {\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n }\n query_context.aggregation_stage = 2;\n } else {\n for (var i = 0; i < transparent_values.length; i++) {\n var trans_value = transparent_values[i];\n query_context.writer.aggregators[i].increment(key, trans_value);\n }\n }\n query_context.writer.aggregation_keys.add(key);\n}\n\n\nasync function select_unnested(sort_key, NR, folded_fields) {\n let out_fields = folded_fields.slice();\n let unnest_pos = folded_fields.findIndex(val => val instanceof UnnestMarker);\n for (var i = 0; i < query_context.unnest_list.length; i++) {\n out_fields[unnest_pos] = query_context.unnest_list[i];\n if (!await select_simple(sort_key, NR, out_fields.slice()))\n return false;\n }\n return true;\n}\n\n\nconst 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`;\n\n\nconst PROCESS_SELECT_SIMPLE = `\nlet star_fields = record_a;\n__CODE__\n`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nfunction embed_expression(parent_code, child_placeholder, child_expression) {\n return replace_all(parent_code, child_placeholder, child_expression);\n}\n\n\nfunction embed_code(parent_code, child_placeholder, child_code) {\n let parent_lines = parent_code.split('\\n');\n let child_lines = child_code.split('\\n');\n for (let i = 0; i < parent_lines.length; i++) {\n let pos = parent_lines[i].indexOf(child_placeholder);\n if (pos == -1)\n continue;\n assert(pos % 4 == 0);\n let placeholder_indentation = parent_lines[i].substring(0, pos);\n child_lines = child_lines.map(l => placeholder_indentation + l);\n let result_lines = parent_lines.slice(0, i).concat(child_lines).concat(parent_lines.slice(i + 1));\n return result_lines.join('\\n') + '\\n';\n }\n assert(false);\n}\n\n\nfunction generate_main_loop_code(query_context) {\n let is_select_query = query_context.select_expression !== null;\n let is_join_query = query_context.join_map !== null;\n let where_expression = query_context.where_expression === null ? 'true' : query_context.where_expression;\n let aggregation_key_expression = query_context.aggregation_key_expression === null ? 'null' : query_context.aggregation_key_expression;\n let sort_key_expression = query_context.sort_key_expression === null ? 'null' : query_context.sort_key_expression;\n let js_code = embed_code(MAIN_LOOP_BODY, '__USER_INIT_CODE__', query_context.user_init_code);\n if (is_select_query) {\n if (is_join_query) {\n js_code = embed_code(embed_code(js_code, '__CODE__', PROCESS_SELECT_JOIN), '__CODE__', PROCESS_SELECT_COMMON);\n js_code = embed_expression(js_code, '__RBQLMP__lhs_join_var_expression', query_context.lhs_join_var_expression);\n } else {\n js_code = embed_code(embed_code(js_code, '__CODE__', PROCESS_SELECT_SIMPLE), '__CODE__', PROCESS_SELECT_COMMON);\n }\n js_code = embed_code(js_code, '__RBQLMP__variables_init_code', query_context.variables_init_code);\n js_code = embed_expression(js_code, '__RBQLMP__select_expression', query_context.select_expression);\n js_code = embed_expression(js_code, '__RBQLMP__where_expression', where_expression);\n js_code = embed_expression(js_code, '__RBQLMP__aggregation_key_expression', aggregation_key_expression);\n js_code = embed_expression(js_code, '__RBQLMP__sort_key_expression', sort_key_expression);\n } else {\n if (is_join_query) {\n js_code = embed_code(js_code, '__CODE__', PROCESS_UPDATE_JOIN);\n js_code = embed_expression(js_code, '__RBQLMP__lhs_join_var_expression', query_context.lhs_join_var_expression);\n } else {\n js_code = embed_code(js_code, '__CODE__', PROCESS_UPDATE_SIMPLE);\n }\n js_code = embed_code(js_code, '__RBQLMP__variables_init_code', query_context.variables_init_code);\n js_code = embed_code(js_code, '__RBQLMP__update_expressions', query_context.update_expressions);\n js_code = embed_expression(js_code, '__RBQLMP__where_expression', where_expression);\n }\n return \"(async () => {\" + js_code + \"})()\";\n}\n\n\nasync function compile_and_run(query_context) {\n let main_loop_body = generate_main_loop_code(query_context);\n try {\n let main_loop_promise = eval(main_loop_body);\n await main_loop_promise;\n } catch (e) {\n if (e instanceof SyntaxError) {\n // SyntaxError's from eval() function do not contain detailed explanation of what has caused the syntax error, so to guess what was wrong we can only use the original query\n // v8 issue to fix eval: https://bugs.chromium.org/p/v8/issues/detail?id=2589\n let lower_case_query = query_context.query_text.toLowerCase();\n if (lower_case_query.indexOf(' having ') != -1)\n throw new SyntaxError(e.message + \"\\nRBQL doesn't support \\\"HAVING\\\" keyword\");\n if (lower_case_query.indexOf(' like ') != -1)\n throw new SyntaxError(e.message + \"\\nRBQL doesn't support \\\"LIKE\\\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... \"); // UT JSON\n if (lower_case_query.indexOf(' from ') != -1)\n throw new SyntaxError(e.message + \"\\nTip: If input table is defined by the environment, RBQL query should not have \\\"FROM\\\" keyword\"); // UT JSON\n if (e && e.message && String(e.message).toLowerCase().indexOf('unexpected identifier') != -1) {\n if (lower_case_query.indexOf(' and ') != -1)\n throw new SyntaxError(e.message + \"\\nDid you use 'and' keyword in your query?\\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!\");\n if (lower_case_query.indexOf(' or ') != -1)\n throw new SyntaxError(e.message + \"\\nDid you use 'or' keyword in your query?\\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!\");\n }\n }\n if (e && e.message && e.message.indexOf('Received an instance of RBQLAggregationToken') != -1)\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n throw e;\n }\n}\n\n\nconst GROUP_BY = 'GROUP BY';\nconst UPDATE = 'UPDATE';\nconst SELECT = 'SELECT';\nconst JOIN = 'JOIN';\nconst INNER_JOIN = 'INNER JOIN';\nconst LEFT_JOIN = 'LEFT JOIN';\nconst LEFT_OUTER_JOIN = 'LEFT OUTER JOIN';\nconst STRICT_LEFT_JOIN = 'STRICT LEFT JOIN';\nconst ORDER_BY = 'ORDER BY';\nconst WHERE = 'WHERE';\nconst LIMIT = 'LIMIT';\nconst EXCEPT = 'EXCEPT';\nconst WITH = 'WITH';\n\n\nfunction get_ambiguous_error_msg(variable_name) {\n return `Ambiguous variable name: \"${variable_name}\" is present both in input and in join tables`;\n}\n\n\nfunction get_all_matches(regexp, text) {\n var result = [];\n let match_obj = null;\n while((match_obj = regexp.exec(text)) !== null) {\n result.push(match_obj);\n }\n return result;\n}\n\n\nfunction str_strip(src) {\n return src.replace(/^ +| +$/g, '');\n}\n\n\nfunction strip_comments(cline) {\n cline = cline.trim();\n if (cline.startsWith('//'))\n return '';\n return cline;\n}\n\n\nfunction combine_string_literals(backend_expression, string_literals) {\n for (var i = 0; i < string_literals.length; i++) {\n backend_expression = replace_all(backend_expression, `___RBQL_STRING_LITERAL${i}___`, string_literals[i]);\n }\n return backend_expression;\n}\n\n\nfunction parse_basic_variables(query_text, prefix, dst_variables_map) {\n assert(prefix == 'a' || prefix == 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}([1-9][0-9]*)(?:$|(?=[^_a-zA-Z0-9]))`, 'g');\n let matches = get_all_matches(rgx, query_text);\n for (let i = 0; i < matches.length; i++) {\n let field_num = parseInt(matches[i][1]);\n dst_variables_map[prefix + String(field_num)] = {initialize: true, index: field_num - 1};\n }\n}\n\n\nfunction parse_array_variables(query_text, prefix, dst_variables_map) {\n assert(prefix == 'a' || prefix == 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\[([1-9][0-9]*)\\\\]`, 'g');\n let matches = get_all_matches(rgx, query_text);\n for (let i = 0; i < matches.length; i++) {\n let field_num = parseInt(matches[i][1]);\n dst_variables_map[`${prefix}[${field_num}]`] = {initialize: true, index: field_num - 1};\n }\n}\n\n\nfunction js_string_escape_column_name(column_name, quote_char) {\n column_name = column_name.replace(/\\\\/g, '\\\\\\\\');\n column_name = column_name.replace(/\\n/g, '\\\\n');\n column_name = column_name.replace(/\\r/g, '\\\\r');\n column_name = column_name.replace(/\\t/g, '\\\\t');\n if (quote_char === \"'\")\n return column_name.replace(/'/g, \"\\\\'\");\n if (quote_char === '\"')\n return column_name.replace(/\"/g, '\\\\\"');\n assert(quote_char === \"`\");\n return column_name.replace(/`/g, \"\\\\`\");\n}\n\n\nfunction query_probably_has_dictionary_variable(query_text, column_name) {\n let rgx = new RegExp('[-a-zA-Z0-9_:;+=!.,()%^#@&* ]+', 'g');\n let continuous_name_segments = get_all_matches(rgx, column_name);\n for (let continuous_segment of continuous_name_segments) {\n if (query_text.indexOf(continuous_segment) == -1)\n return false;\n }\n return true;\n}\n\n\nfunction parse_dictionary_variables(query_text, prefix, column_names, dst_variables_map) {\n // The purpose of this algorithm is to minimize number of variables in varibale_map to improve performance, ideally it should be only variables from the query\n\n // FIXME to prevent typos in attribute names either use query-based variable parsing which can properly handle back-tick strings or wrap \"a\" and \"b\" variables with ES6 Proxies https://stackoverflow.com/a/25658975/2898283\n assert(prefix === 'a' || prefix === 'b');\n let dict_test_rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\[`);\n if (query_text.search(dict_test_rgx) == -1)\n return;\n for (let i = 0; i < column_names.length; i++) {\n let column_name = column_names[i];\n if (query_probably_has_dictionary_variable(query_text, column_name)) {\n let escaped_column_name = js_string_escape_column_name(column_name, '\"');\n dst_variables_map[`${prefix}[\"${escaped_column_name}\"]`] = {initialize: true, index: i};\n escaped_column_name = js_string_escape_column_name(column_name, \"'\");\n dst_variables_map[`${prefix}['${escaped_column_name}']`] = {initialize: false, index: i};\n escaped_column_name = js_string_escape_column_name(column_name, \"`\");\n dst_variables_map[`${prefix}[\\`${escaped_column_name}\\`]`] = {initialize: false, index: i};\n }\n }\n}\n\n\nfunction parse_attribute_variables(query_text, prefix, column_names, column_names_source, dst_variables_map) {\n // The purpose of this algorithm is to minimize number of variables in varibale_map to improve performance, ideally it should be only variables from the query\n\n assert(prefix === 'a' || prefix === 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\.([_a-zA-Z][_a-zA-Z0-9]*)`, 'g');\n let matches = get_all_matches(rgx, query_text);\n let column_names_from_query = matches.map(v => v[1]);\n for (let column_name of column_names_from_query) {\n let zero_based_idx = column_names.indexOf(column_name);\n if (zero_based_idx != -1) {\n dst_variables_map[`${prefix}.${column_name}`] = {initialize: true, index: zero_based_idx};\n } else {\n throw new RbqlParsingError(`Unable to find column \"${column_name}\" in ${prefix == 'a' ? 'input' : 'join'} ${column_names_source}`);\n }\n }\n}\n\n\nfunction map_variables_directly(query_text, column_names, dst_variables_map) {\n for (let i = 0; i < column_names.length; i++) {\n let column_name = column_names[i];\n if ( /^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(column_name) === null)\n throw new RbqlIOHandlingError(`Unable to use column name \"${column_name}\" as RBQL/JS variable`);\n if (query_text.indexOf(column_name) != -1)\n dst_variables_map[column_name] = {initialize: true, index: i};\n }\n}\n\n\nfunction ensure_no_ambiguous_variables(query_text, input_column_names, join_column_names) {\n let join_column_names_set = new Set(join_column_names);\n for (let column_name of input_column_names) {\n if (join_column_names_set.has(column_name) && query_text.indexOf(column_name) != -1) // False positive is tolerable here\n throw new RbqlParsingError(get_ambiguous_error_msg(column_name));\n }\n}\n\n\nfunction parse_join_expression(src) {\n src = str_strip(src);\n const invalid_join_syntax_error = 'Invalid join syntax. Valid syntax: /path/to/B/table on a... == b... [and a... == b... [and ... ]]';\n let rgx = /^ *([^ ]+) +on +/i;\n let match = rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n let table_id = match[1];\n src = src.substr(match[0].length);\n\n let variable_pairs = [];\n var pair_rgx = /^([^ =]+) *==? *([^ =]+)/;\n var and_rgx = /^ +(and|&&) +/i;\n while (true) {\n match = pair_rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n variable_pairs.push([match[1], match[2]]);\n src = src.substr(match[0].length);\n if (!src.length)\n break;\n match = and_rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n src = src.substr(match[0].length);\n }\n return [table_id, variable_pairs];\n}\n\n\nfunction resolve_join_variables(input_variables_map, join_variables_map, variable_pairs, string_literals) {\n let lhs_variables = [];\n let rhs_indices = [];\n const valid_join_syntax_msg = 'Valid JOIN syntax: /path/to/B/table on a... == b... [and a... == b... [and ... ]]';\n for (let variable_pair of variable_pairs) {\n let [join_var_1, join_var_2] = variable_pair;\n join_var_1 = combine_string_literals(join_var_1, string_literals);\n join_var_2 = combine_string_literals(join_var_2, string_literals);\n if (input_variables_map.hasOwnProperty(join_var_1) && join_variables_map.hasOwnProperty(join_var_1))\n throw new RbqlParsingError(get_ambiguous_error_msg(join_var_1));\n if (input_variables_map.hasOwnProperty(join_var_2) && join_variables_map.hasOwnProperty(join_var_2))\n throw new RbqlParsingError(get_ambiguous_error_msg(join_var_2));\n if (input_variables_map.hasOwnProperty(join_var_2))\n [join_var_1, join_var_2] = [join_var_2, join_var_1];\n\n let [lhs_key_index, rhs_key_index] = [null, null];\n if (['NR', 'a.NR', 'aNR'].indexOf(join_var_1) != -1) {\n lhs_key_index = -1;\n } else if (input_variables_map.hasOwnProperty(join_var_1)) {\n lhs_key_index = input_variables_map[join_var_1].index;\n } else {\n throw new RbqlParsingError(`Unable to parse JOIN expression: Input table does not have field \"${join_var_1}\"\\n${valid_join_syntax_msg}`);\n }\n\n if (['b.NR', 'bNR'].indexOf(join_var_2) != -1) {\n rhs_key_index = -1;\n } else if (join_variables_map.hasOwnProperty(join_var_2)) {\n rhs_key_index = join_variables_map[join_var_2].index;\n } else {\n throw new RbqlParsingError(`Unable to parse JOIN expression: Join table does not have field \"${join_var_2}\"\\n${valid_join_syntax_msg}`);\n }\n\n let lhs_join_var_expression = lhs_key_index == -1 ? 'NR' : `safe_join_get(record_a, ${lhs_key_index})`;\n rhs_indices.push(rhs_key_index);\n lhs_variables.push(lhs_join_var_expression);\n }\n return [lhs_variables, rhs_indices];\n}\n\n\nfunction generate_common_init_code(query_text, variable_prefix) {\n assert(variable_prefix == 'a' || variable_prefix == 'b');\n let result = [];\n result.push(`${variable_prefix} = new Object();`);\n let base_var = variable_prefix == 'a' ? 'NR' : 'bNR';\n let attr_var = `${variable_prefix}.NR`;\n if (query_text.indexOf(attr_var) != -1)\n result.push(`${attr_var} = ${base_var};`);\n if (variable_prefix == 'a' && query_text.indexOf('aNR') != -1)\n result.push('aNR = NR;');\n return result;\n}\n\n\nfunction generate_init_statements(query_text, variables_map, join_variables_map, indent) {\n let code_lines = generate_common_init_code(query_text, 'a');\n let simple_var_name_rgx = /^[_0-9a-zA-Z]+$/;\n for (const [variable_name, var_info] of Object.entries(variables_map)) {\n if (var_info.initialize) {\n let variable_declaration_keyword = simple_var_name_rgx.exec(variable_name) ? 'var ' : '';\n code_lines.push(`${variable_declaration_keyword}${variable_name} = safe_get(record_a, ${var_info.index});`);\n }\n }\n if (join_variables_map) {\n code_lines = code_lines.concat(generate_common_init_code(query_text, 'b'));\n for (const [variable_name, var_info] of Object.entries(join_variables_map)) {\n if (var_info.initialize) {\n let variable_declaration_keyword = simple_var_name_rgx.exec(variable_name) ? 'var ' : '';\n code_lines.push(`${variable_declaration_keyword}${variable_name} = record_b === null ? null : safe_get(record_b, ${var_info.index});`);\n }\n }\n }\n for (let i = 1; i < code_lines.length; i++) {\n code_lines[i] = indent + code_lines[i];\n }\n return code_lines.join('\\n');\n}\n\n\nfunction replace_star_count(aggregate_expression) {\n var rgx = /(^|,) *COUNT\\( *\\* *\\) *(?:$|(?=,))/ig;\n var result = aggregate_expression.replace(rgx, '$1 COUNT(1)');\n return str_strip(result);\n}\n\n\nfunction replace_star_vars(rbql_expression) {\n let star_rgx = /(?:^|,) *(\\*|a\\.\\*|b\\.\\*) *(?=$|,)/g;\n let matches = get_all_matches(star_rgx, rbql_expression);\n let last_pos = 0;\n let result = '';\n for (let match of matches) {\n let star_expression = match[1];\n let replacement_expression = ']).concat(' + {'*': 'star_fields', 'a.*': 'record_a', 'b.*': 'record_b'}[star_expression] + ').concat([';\n if (last_pos < match.index)\n result += rbql_expression.substring(last_pos, match.index);\n result += replacement_expression;\n last_pos = match.index + match[0].length + 1; // Adding one to skip the lookahead comma\n }\n result += rbql_expression.substring(last_pos);\n return result;\n}\n\n\nfunction replace_star_vars_for_header_parsing(rbql_expression) {\n let star_rgx = /(?:(?<=^)|(?<=,)) *(\\*|a\\.\\*|b\\.\\*) *(?=$|,)/g;\n let matches = get_all_matches(star_rgx, rbql_expression);\n let last_pos = 0;\n let result = '';\n for (let match of matches) {\n let star_expression = match[1];\n let replacement_expression = {'*': '__RBQL_INTERNAL_STAR', 'a.*': 'a.__RBQL_INTERNAL_STAR', 'b.*': 'b.__RBQL_INTERNAL_STAR'}[star_expression];\n if (last_pos < match.index)\n result += rbql_expression.substring(last_pos, match.index);\n result += replacement_expression;\n last_pos = match.index + match[0].length;\n }\n result += rbql_expression.substring(last_pos);\n return result;\n}\n\n\nfunction translate_update_expression(update_expression, input_variables_map, string_literals, indent) {\n let first_assignment = str_strip(update_expression.split('=')[0]);\n let first_assignment_error = `Unable to parse \"UPDATE\" expression: the expression must start with assignment, but \"${first_assignment}\" does not look like an assignable field name`;\n\n let assignment_looking_rgx = /(?:^|,) *(a[.#a-zA-Z0-9\\[\\]_]*) *=(?=[^=])/g;\n let update_expressions = [];\n let pos = 0;\n while (true) {\n let match = assignment_looking_rgx.exec(update_expression);\n if (update_expressions.length == 0 && (match === null || match.index != 0)) {\n throw new RbqlParsingError(first_assignment_error);\n }\n if (match === null) {\n update_expressions[update_expressions.length - 1] += str_strip(update_expression.substr(pos)) + ');';\n break;\n }\n if (update_expressions.length)\n update_expressions[update_expressions.length - 1] += str_strip(update_expression.substring(pos, match.index)) + ');';\n let dst_var_name = combine_string_literals(str_strip(match[1]), string_literals);\n if (!input_variables_map.hasOwnProperty(dst_var_name))\n throw new RbqlParsingError(`Unable to parse \"UPDATE\" expression: Unknown field name: \"${dst_var_name}\"`);\n let var_index = input_variables_map[dst_var_name].index;\n let current_indent = update_expressions.length ? indent : '';\n update_expressions.push(`${current_indent}safe_set(up_fields, ${var_index}, `);\n pos = match.index + match[0].length;\n }\n return combine_string_literals(update_expressions.join('\\n'), string_literals);\n}\n\n\nfunction translate_select_expression(select_expression) {\n let expression_without_stars = replace_star_count(select_expression);\n let translated = str_strip(replace_star_vars(expression_without_stars));\n let translated_for_header = str_strip(replace_star_vars_for_header_parsing(expression_without_stars));\n if (!translated.length)\n throw new RbqlParsingError('\"SELECT\" expression is empty');\n return [`[].concat([${translated}])`, translated_for_header];\n}\n\n\nfunction separate_string_literals(rbql_expression) {\n // The regex consists of 3 almost identicall parts, the only difference is quote type\n var rgx = /('(\\\\(\\\\\\\\)*'|[^'])*')|(\"(\\\\(\\\\\\\\)*\"|[^\"])*\")|(`(\\\\(\\\\\\\\)*`|[^`])*`)/g;\n var match_obj = null;\n var format_parts = [];\n var string_literals = [];\n var idx_before = 0;\n while((match_obj = rgx.exec(rbql_expression)) !== null) {\n var literal_id = string_literals.length;\n var string_literal = match_obj[0];\n string_literals.push(string_literal);\n var start_index = match_obj.index;\n format_parts.push(rbql_expression.substring(idx_before, start_index));\n format_parts.push(`___RBQL_STRING_LITERAL${literal_id}___`);\n idx_before = rgx.lastIndex;\n }\n format_parts.push(rbql_expression.substring(idx_before));\n var format_expression = format_parts.join('');\n format_expression = format_expression.replace(/\\t/g, ' ');\n return [format_expression, string_literals];\n}\n\n\nfunction locate_statements(rbql_expression) {\n let statement_groups = [];\n statement_groups.push([STRICT_LEFT_JOIN, LEFT_OUTER_JOIN, LEFT_JOIN, INNER_JOIN, JOIN]);\n statement_groups.push([SELECT]);\n statement_groups.push([ORDER_BY]);\n statement_groups.push([WHERE]);\n statement_groups.push([UPDATE]);\n statement_groups.push([GROUP_BY]);\n statement_groups.push([LIMIT]);\n statement_groups.push([EXCEPT]);\n var result = [];\n for (var ig = 0; ig < statement_groups.length; ig++) {\n for (var is = 0; is < statement_groups[ig].length; is++) {\n var statement = statement_groups[ig][is];\n var rgxp = new RegExp('(?:^| )' + replace_all(statement, ' ', ' *') + '(?= )', 'ig');\n var matches = get_all_matches(rgxp, rbql_expression);\n if (!matches.length)\n continue;\n if (matches.length > 1)\n throw new RbqlParsingError(`More than one \"${statement}\" statements found`);\n assert(matches.length == 1);\n var match = matches[0];\n var match_str = match[0];\n result.push([match.index, match.index + match_str.length, statement]);\n break; // Break to avoid matching a sub-statement from the same group e.g. \"INNER JOIN\" -> \"JOIN\"\n }\n }\n result.sort(function(a, b) { return a[0] - b[0]; });\n return result;\n}\n\n\nfunction separate_actions(rbql_expression) {\n rbql_expression = str_strip(rbql_expression);\n var result = {};\n let with_match = /^(.*) *[Ww][Ii][Tt][Hh] *\\(([a-z]{4,20})\\) *$/.exec(rbql_expression);\n if (with_match !== null) {\n rbql_expression = with_match[1];\n result[WITH] = with_match[2];\n }\n var ordered_statements = locate_statements(rbql_expression);\n for (var i = 0; i < ordered_statements.length; i++) {\n var statement_start = ordered_statements[i][0];\n var span_start = ordered_statements[i][1];\n var statement = ordered_statements[i][2];\n var span_end = i + 1 < ordered_statements.length ? ordered_statements[i + 1][0] : rbql_expression.length;\n assert(statement_start < span_start);\n assert(span_start <= span_end);\n var span = rbql_expression.substring(span_start, span_end);\n var statement_params = {};\n if ([STRICT_LEFT_JOIN, LEFT_OUTER_JOIN, LEFT_JOIN, INNER_JOIN, JOIN].indexOf(statement) != -1) {\n statement_params['join_subtype'] = statement;\n statement = JOIN;\n }\n\n if (statement == UPDATE) {\n if (statement_start != 0)\n throw new RbqlParsingError('UPDATE keyword must be at the beginning of the query');\n span = span.replace(/^ *SET/i, '');\n }\n\n if (statement == ORDER_BY) {\n span = span.replace(/ ASC *$/i, '');\n var new_span = span.replace(/ DESC *$/i, '');\n if (new_span != span) {\n span = new_span;\n statement_params['reverse'] = true;\n } else {\n statement_params['reverse'] = false;\n }\n }\n\n if (statement == SELECT) {\n if (statement_start != 0)\n throw new RbqlParsingError('SELECT keyword must be at the beginning of the query');\n let match = /^ *TOP *([0-9]+) /i.exec(span);\n if (match !== null) {\n statement_params['top'] = parseInt(match[1]);\n span = span.substr(match.index + match[0].length);\n }\n match = /^ *DISTINCT *(COUNT)? /i.exec(span);\n if (match !== null) {\n statement_params['distinct'] = true;\n if (match[1]) {\n statement_params['distinct_count'] = true;\n }\n span = span.substr(match.index + match[0].length);\n }\n }\n statement_params['text'] = str_strip(span);\n result[statement] = statement_params;\n }\n if (!result.hasOwnProperty(SELECT) && !result.hasOwnProperty(UPDATE)) {\n throw new RbqlParsingError('Query must contain either SELECT or UPDATE statement');\n }\n assert(result.hasOwnProperty(SELECT) != result.hasOwnProperty(UPDATE));\n return result;\n}\n\n\nfunction find_top(rb_actions) {\n if (rb_actions.hasOwnProperty(LIMIT)) {\n var rgx = /^[0-9]+$/;\n if (rgx.exec(rb_actions[LIMIT]['text']) === null) {\n throw new RbqlParsingError('LIMIT keyword must be followed by an integer');\n }\n var result = parseInt(rb_actions[LIMIT]['text']);\n return result;\n }\n var select_action = rb_actions[SELECT];\n if (select_action && select_action.hasOwnProperty('top')) {\n return select_action['top'];\n }\n return null;\n}\n\n\nfunction translate_except_expression(except_expression, input_variables_map, string_literals, input_header) {\n let skip_vars = except_expression.split(',');\n skip_vars = skip_vars.map(str_strip);\n let skip_indices = [];\n for (let var_name of skip_vars) {\n var_name = combine_string_literals(var_name, string_literals);\n if (!input_variables_map.hasOwnProperty(var_name))\n throw new RbqlParsingError(`Unknown field in EXCEPT expression: \"${var_name}\"`);\n skip_indices.push(input_variables_map[var_name].index);\n }\n skip_indices = skip_indices.sort((a, b) => a - b);\n let output_header = input_header === null ? null : select_except(input_header, skip_indices);\n let indices_str = skip_indices.join(',');\n return [output_header, `select_except(record_a, [${indices_str}])`];\n}\n\n\nclass HashJoinMap {\n constructor(record_iterator, key_indices) {\n this.max_record_len = 0;\n this.hash_map = new Map();\n this.record_iterator = record_iterator;\n this.nr = 0;\n if (key_indices.length == 1) {\n this.key_index = key_indices[0];\n this.key_indices = null;\n this.polymorphic_get_key = this.get_single_key;\n } else {\n this.key_index = null;\n this.key_indices = key_indices;\n this.polymorphic_get_key = this.get_multi_key;\n }\n }\n\n get_single_key(nr, fields) {\n if (this.key_index >= fields.length)\n throw new RbqlRuntimeError(`No field with index ${this.key_index + 1} at record ${this.nr} in \"B\" table`);\n return this.key_index === -1 ? this.nr : fields[this.key_index];\n };\n\n get_multi_key(nr, fields) {\n let result = [];\n for (let ki of this.key_indices) {\n if (ki >= fields.length)\n throw new RbqlRuntimeError(`No field with index ${ki + 1} at record ${this.nr} in \"B\" table`);\n result.push(ki === -1 ? this.nr : fields[ki]);\n }\n return JSON.stringify(result);\n };\n\n async build() {\n while (true) {\n let fields = await this.record_iterator.get_record();\n if (fields === null)\n break;\n this.nr += 1;\n let nf = fields.length;\n this.max_record_len = Math.max(this.max_record_len, nf);\n let key = this.polymorphic_get_key(this.nr, fields);\n let key_records = this.hash_map.get(key);\n if (key_records === undefined) {\n this.hash_map.set(key, [[this.nr, nf, fields]]);\n } else {\n key_records.push([this.nr, nf, fields]);\n }\n }\n };\n\n get_join_records(key) {\n let result = this.hash_map.get(key);\n if (result === undefined)\n return [];\n return result;\n };\n\n get_warnings() {\n return this.record_iterator.get_warnings();\n };\n}\n\n\nfunction cleanup_query(query_text) {\n return query_text.split('\\n').map(strip_comments).filter(line => line.length).join(' ').replace(/;+$/g, '');\n}\n\n\nfunction remove_redundant_table_name(query_text) {\n query_text = str_strip(query_text.replace(/ +from +a(?: +|$)/gi, ' '));\n query_text = str_strip(query_text.replace(/^ *update +a +set /gi, 'update '));\n return query_text;\n}\n\n\nfunction select_output_header(input_header, join_header, query_column_infos) {\n if (input_header === null && join_header === null)\n return null;\n if (input_header === null)\n input_header = [];\n if (join_header === null)\n join_header = [];\n let output_header = [];\n for (let qci of query_column_infos) {\n // TODO refactor this and python version: extract this code into a function instead to always return something\n if (qci === null) {\n output_header.push('col' + (output_header.length + 1));\n } else if (qci.is_star) {\n if (qci.table_name === null) {\n output_header = output_header.concat(input_header).concat(join_header);\n } else if (qci.table_name === 'a') {\n output_header = output_header.concat(input_header);\n } else if (qci.table_name === 'b') {\n output_header = output_header.concat(join_header);\n }\n } else if (qci.column_name !== null) {\n output_header.push(qci.column_name);\n } else if (qci.column_index !== null) {\n if (qci.table_name == 'a' && qci.column_index < input_header.length) {\n output_header.push(input_header[qci.column_index]);\n } else if (qci.table_name == 'b' && qci.column_index < join_header.length) {\n output_header.push(join_header[qci.column_index]);\n } else {\n output_header.push('col' + (output_header.length + 1));\n }\n } else { // Should never happen\n output_header.push('col' + (output_header.length + 1));\n }\n }\n return output_header;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\nclass RBQLInputIterator {\n constructor(){}\n stop() {\n throw new Error(\"Unable to call the interface method\");\n }\n async get_variables_map(query_text) {\n throw new Error(\"Unable to call the interface method\");\n }\n async get_record() {\n throw new Error(\"Unable to call the interface method\");\n }\n handle_query_modifier() {\n return; // Reimplement if you need to handle a boolean query modifier that can be used like this: `SELECT * WITH (modifiername)`\n }\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n }\n async get_header() {\n return null; // Reimplement if your class can provide input header\n }\n}\n\n\nclass RBQLOutputWriter {\n constructor(){}\n\n async write(fields) {\n throw new Error(\"Unable to call the interface method\");\n }\n\n async finish() {\n // Reimplement if your class needs to do something on finish e.g. cleanup\n };\n\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n };\n\n set_header() {\n return; // Reimplement if your class can handle output headers in a meaningful way\n }\n}\n\n\nclass RBQLTableRegistry {\n constructor(){}\n\n get_iterator_by_table_id(table_id) {\n throw new Error(\"Unable to call the interface method\");\n }\n\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n };\n}\n\n\nclass TableIterator extends RBQLInputIterator {\n constructor(table, column_names=null, normalize_column_names=true, variable_prefix='a') {\n super();\n this.table = table;\n this.column_names = column_names;\n this.normalize_column_names = normalize_column_names;\n this.variable_prefix = variable_prefix;\n this.nr = 0;\n this.fields_info = new Object();\n this.stopped = false;\n }\n\n\n stop() {\n this.stopped = true;\n };\n\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n parse_basic_variables(query_text, this.variable_prefix, variable_map);\n parse_array_variables(query_text, this.variable_prefix, variable_map);\n if (this.column_names !== null) {\n if (this.table.length && this.column_names.length != this.table[0].length)\n throw new RbqlIOHandlingError('List of column names and table records have different lengths');\n if (this.normalize_column_names) {\n parse_dictionary_variables(query_text, this.variable_prefix, this.column_names, variable_map);\n parse_attribute_variables(query_text, this.variable_prefix, this.column_names, 'column names list', variable_map);\n } else {\n map_variables_directly(query_text, this.column_names, variable_map);\n }\n }\n return variable_map;\n };\n\n\n async get_record() {\n if (this.stopped)\n return null;\n if (this.nr >= this.table.length)\n return null;\n let record = this.table[this.nr];\n this.nr += 1;\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.nr;\n return record;\n };\n\n get_warnings() {\n if (Object.keys(this.fields_info).length > 1)\n return [make_inconsistent_num_fields_warning('input', this.fields_info)];\n return [];\n };\n\n async get_header() {\n return this.column_names;\n }\n}\n\n\nclass TableWriter extends RBQLOutputWriter {\n constructor(external_table) {\n super();\n this.table = external_table;\n this.header = null;\n }\n\n async write(fields) {\n this.table.push(fields);\n return true;\n };\n\n set_header(header) {\n this.header = header;\n }\n}\n\n\nclass SingleTableRegistry extends RBQLTableRegistry {\n constructor(table, column_names=null, normalize_column_names=true, table_id='b') {\n super();\n this.table = table;\n this.table_id = table_id;\n this.column_names = column_names;\n this.normalize_column_names = normalize_column_names;\n }\n\n get_iterator_by_table_id(table_id) {\n if (table_id.toLowerCase() !== this.table_id)\n throw new RbqlIOHandlingError(`Unable to find join table: \"${table_id}\"`);\n return new TableIterator(this.table, this.column_names, this.normalize_column_names, 'b');\n };\n}\n\n\nasync function shallow_parse_input_query(query_text, input_iterator, join_tables_registry, query_context) {\n query_text = cleanup_query(query_text);\n var [format_expression, string_literals] = separate_string_literals(query_text);\n format_expression = remove_redundant_table_name(format_expression);\n\n var rb_actions = separate_actions(format_expression);\n if (rb_actions.hasOwnProperty(WITH)) {\n input_iterator.handle_query_modifier(rb_actions[WITH]);\n }\n var input_variables_map = await input_iterator.get_variables_map(query_text);\n\n if (rb_actions.hasOwnProperty(ORDER_BY) && rb_actions.hasOwnProperty(UPDATE))\n throw new RbqlParsingError('\"ORDER BY\" is not allowed in \"UPDATE\" queries');\n\n if (rb_actions.hasOwnProperty(GROUP_BY)) {\n if (rb_actions.hasOwnProperty(ORDER_BY) || rb_actions.hasOwnProperty(UPDATE))\n throw new RbqlParsingError('\"ORDER BY\", \"UPDATE\" and \"DISTINCT\" keywords are not allowed in aggregate queries');\n query_context.aggregation_key_expression = '[' + combine_string_literals(rb_actions[GROUP_BY]['text'], string_literals) + ']';\n }\n\n let join_variables_map = null;\n let join_header = null;\n if (rb_actions.hasOwnProperty(JOIN)) {\n var [rhs_table_id, variable_pairs] = parse_join_expression(rb_actions[JOIN]['text']);\n if (join_tables_registry === null)\n throw new RbqlParsingError('JOIN operations are not supported by the application');\n let join_record_iterator = join_tables_registry.get_iterator_by_table_id(rhs_table_id);\n if (!join_record_iterator)\n throw new RbqlParsingError(`Unable to find join table: \"${rhs_table_id}\"`);\n if (rb_actions.hasOwnProperty(WITH)) {\n join_record_iterator.handle_query_modifier(rb_actions[WITH]);\n }\n join_variables_map = await join_record_iterator.get_variables_map(query_text);\n join_header = await join_record_iterator.get_header();\n let [lhs_variables, rhs_indices] = resolve_join_variables(input_variables_map, join_variables_map, variable_pairs, string_literals);\n let sql_join_type = {'JOIN': InnerJoiner, 'INNER JOIN': InnerJoiner, 'LEFT JOIN': LeftJoiner, 'LEFT OUTER JOIN': LeftJoiner, 'STRICT LEFT JOIN': StrictLeftJoiner}[rb_actions[JOIN]['join_subtype']];\n query_context.lhs_join_var_expression = lhs_variables.length == 1 ? lhs_variables[0] : 'JSON.stringify([' + lhs_variables.join(',') + '])';\n query_context.join_map_impl = new HashJoinMap(join_record_iterator, rhs_indices);\n await query_context.join_map_impl.build();\n query_context.join_map = new sql_join_type(query_context.join_map_impl);\n }\n\n query_context.variables_init_code = combine_string_literals(generate_init_statements(format_expression, input_variables_map, join_variables_map, ' '.repeat(4)), string_literals);\n\n if (rb_actions.hasOwnProperty(WHERE)) {\n var where_expression = rb_actions[WHERE]['text'];\n if (/[^>= 3 && line.charCodeAt(0) === 0xEF && line.charCodeAt(1) === 0xBB && line.charCodeAt(2) === 0xBF) {\n return line.substring(3);\n }\n if (assumed_source_encoding == 'utf-8' && line.length >= 1 && line.charCodeAt(0) === 0xFEFF) {\n return line.substring(1);\n }\n return line;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\nfunction expanduser(filepath) {\n if (filepath.charAt(0) === '~') {\n return path.join(os.homedir(), filepath.slice(1));\n }\n return filepath;\n}\n\n\nfunction try_read_index(index_path) {\n var content = null;\n try {\n content = fs.readFileSync(index_path, 'utf-8');\n } catch (e) {\n return [];\n }\n var lines = content.split('\\n');\n var records = [];\n for (var i = 0; i < lines.length; i++) {\n if (!lines[i])\n continue;\n var record = lines[i].split('\\t');\n records.push(record);\n }\n return records;\n}\n\n\nfunction get_index_record(index_path, key) {\n var records = try_read_index(index_path);\n for (var i = 0; i < records.length; i++) {\n if (records[i].length && records[i][0] == key) {\n return records[i];\n }\n }\n return null;\n}\n\n\nfunction find_table_path(main_table_dir, table_id) {\n // If table_id is a relative path it could be relative either to the current directory or to the main table dir.\n var candidate_path = expanduser(table_id);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n if (main_table_dir && !path.isAbsolute(candidate_path)) {\n candidate_path = path.join(main_table_dir, candidate_path);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n }\n let table_names_settings_path = path.join(os.homedir(), '.rbql_table_names');\n var name_record = get_index_record(table_names_settings_path, table_id);\n if (name_record && name_record.length > 1 && fs.existsSync(name_record[1])) {\n return name_record[1];\n }\n return null;\n}\n\n\nclass RecordQueue {\n // TODO compare performance with a linked list\n constructor() {\n this.push_stack = [];\n this.pull_stack = [];\n }\n\n enqueue(record) {\n this.push_stack.push(record);\n }\n\n dequeue() {\n if (!this.pull_stack.length) {\n if (!this.push_stack.length)\n return null;\n this.pull_stack = this.push_stack;\n this.pull_stack.reverse();\n this.push_stack = [];\n }\n return this.pull_stack.pop();\n }\n}\n\n\nclass CSVRecordIterator extends rbql.RBQLInputIterator {\n // CSVRecordIterator implements a typical async producer-consumer model with an internal buffer:\n // get_record() - consumer\n // stream.on('data') - producer\n constructor(stream, csv_path, encoding, delim, policy, has_header=false, comment_prefix=null, table_name='input', variable_prefix='a') {\n super();\n this.stream = stream;\n this.csv_path = csv_path;\n assert((this.stream === null) != (this.csv_path === null));\n this.encoding = encoding;\n this.delim = delim;\n this.policy = policy;\n\n this.has_header = has_header;\n this.first_record = null;\n this.first_record_should_be_emitted = !has_header;\n this.header_preread_complete = false;\n\n this.table_name = table_name;\n this.variable_prefix = variable_prefix;\n this.comment_prefix = (comment_prefix !== null && comment_prefix.length) ? comment_prefix : null;\n\n this.decoder = null;\n if (encoding == 'utf-8' && this.csv_path === null) {\n // Unfortunately util.TextDecoder has serious flaws:\n // 1. It doesn't work in Node without ICU: https://nodejs.org/api/util.html#util_new_textdecoder_encoding_options\n // 2. It is broken in Electron: https://github.com/electron/electron/issues/18733\n\n // Technically we can implement our own custom streaming text decoder, using the 3 following technologies:\n // 1. decode-encode validation method from https://stackoverflow.com/a/32279283/2898283\n // 2. Scanning buffer chunks for non-continuation utf-8 bytes from the end of the buffer:\n // src_buffer -> (buffer_before, buffer_after) where buffer_after is very small(a couple of bytes) and buffer_before is large and ends with a non-continuation bytes\n // 3. Internal buffer to store small tail part from the previous buffer\n this.decoder = new util.TextDecoder(encoding, {fatal: true, stream: true});\n }\n\n this.input_exhausted = false;\n this.started = false;\n\n this.utf8_bom_removed = false; // BOM doesn't get automatically removed by the decoder when utf-8 file is treated as latin-1\n this.first_defective_line = null;\n\n this.fields_info = new Object();\n this.NR = 0; // Record number\n this.NL = 0; // Line number (NL != NR when the CSV file has comments or multiline fields)\n\n this.rfc_line_buffer = [];\n\n this.partially_decoded_line = '';\n this.partially_decoded_line_ends_with_cr = false;\n\n // Holds an external \"resolve\" function which is called when everything is fine.\n this.resolve_current_record = null;\n // Holds an external \"reject\" function which is called when error has occured.\n this.reject_current_record = null;\n // Holds last exception if we don't have any reject callbacks from clients yet.\n this.current_exception = null;\n\n this.produced_records_queue = new RecordQueue();\n\n this.process_line_polymorphic = policy == 'quoted_rfc' ? this.process_partial_rfc_record_line : this.process_record_line;\n }\n\n\n handle_query_modifier(modifier) {\n // For `... WITH (header) ...` syntax\n if (['header', 'headers'].indexOf(modifier) != -1) {\n this.has_header = true;\n this.first_record_should_be_emitted = false;\n }\n if (['noheader', 'noheaders'].indexOf(modifier) != -1) {\n this.has_header = false;\n this.first_record_should_be_emitted = true;\n }\n }\n\n\n reset_external_callbacks() {\n // Drop external callbacks simultaneously since promises can only resolve once, see: https://stackoverflow.com/a/18218542/2898283\n this.reject_current_record = null;\n this.resolve_current_record = null;\n }\n\n try_propagate_exception() {\n if (this.current_exception && this.reject_current_record) {\n let reject = this.reject_current_record;\n let exception = this.current_exception;\n this.reset_external_callbacks();\n this.current_exception = null;\n reject(exception);\n }\n }\n\n\n store_or_propagate_exception(exception) {\n if (this.current_exception === null)\n // Ignore subsequent exceptions if we already have an unreported error. This way we prioritize earlier errors over the more recent ones.\n this.current_exception = exception;\n this.try_propagate_exception();\n }\n\n\n async preread_first_record() {\n if (this.header_preread_complete)\n return;\n this.first_record = await this.get_record();\n this.header_preread_complete = true; // We must set header_preread_complete to true after calling get_record(), because get_record() uses it internally.\n if (this.first_record === null) {\n return;\n }\n if (this.stream)\n this.stream.pause();\n this.first_record = this.first_record.slice();\n };\n\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n rbql.parse_basic_variables(query_text, this.variable_prefix, variable_map);\n rbql.parse_array_variables(query_text, this.variable_prefix, variable_map);\n\n await this.preread_first_record();\n if (this.has_header && this.first_record) {\n rbql.parse_attribute_variables(query_text, this.variable_prefix, this.first_record, 'CSV header line', variable_map);\n rbql.parse_dictionary_variables(query_text, this.variable_prefix, this.first_record, variable_map);\n }\n return variable_map;\n };\n\n async get_header() {\n await this.preread_first_record();\n return this.has_header ? this.first_record : null;\n }\n\n\n try_resolve_next_record() {\n this.try_propagate_exception();\n if (this.resolve_current_record === null)\n return;\n\n let record = null;\n if (this.first_record_should_be_emitted && this.header_preread_complete) {\n this.first_record_should_be_emitted = false;\n record = this.first_record;\n } else {\n record = this.produced_records_queue.dequeue();\n }\n\n if (record === null && !this.input_exhausted)\n return;\n let resolve = this.resolve_current_record;\n this.reset_external_callbacks();\n resolve(record);\n };\n\n\n async get_record() {\n if (!this.started)\n await this.start();\n if (this.stream && this.stream.isPaused())\n this.stream.resume();\n\n let parent_iterator = this;\n let current_record_promise = new Promise(function(resolve, reject) {\n parent_iterator.resolve_current_record = resolve;\n parent_iterator.reject_current_record = reject;\n });\n this.try_resolve_next_record();\n return current_record_promise;\n };\n\n\n async get_all_records(num_records=null) {\n let records = [];\n while (true) {\n let record = await this.get_record();\n if (record === null)\n break;\n records.push(record);\n if (num_records && records.length >= num_records) {\n this.stop();\n break;\n }\n }\n return records;\n };\n\n\n process_record_line(line) {\n if (this.comment_prefix !== null && line.startsWith(this.comment_prefix))\n return; // Just skip the line\n this.NR += 1;\n var [record, warning] = csv_utils.smart_split(line, this.delim, this.policy, false);\n if (warning) {\n if (this.first_defective_line === null) {\n this.first_defective_line = this.NL;\n if (this.policy == 'quoted_rfc')\n this.store_or_propagate_exception(new RbqlIOHandlingError(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`));\n }\n }\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.NR;\n this.produced_records_queue.enqueue(record);\n this.try_resolve_next_record();\n };\n\n\n process_partial_rfc_record_line(line) {\n let record_line = csv_utils.accumulate_rfc_line_into_record(this.rfc_line_buffer, line, this.comment_prefix);\n if (record_line !== null)\n this.process_record_line(record_line);\n };\n\n\n process_line(line) {\n this.NL += 1;\n if (this.NL === 1) {\n var clean_line = remove_utf8_bom(line, this.encoding);\n if (clean_line != line) {\n line = clean_line;\n this.utf8_bom_removed = true;\n }\n }\n this.process_line_polymorphic(line);\n };\n\n\n process_data_stream_chunk(data_chunk) {\n let decoded_string = null;\n if (this.decoder) {\n try {\n decoded_string = this.decoder.decode(data_chunk);\n } catch (e) {\n if (e instanceof TypeError) {\n this.store_or_propagate_exception(new RbqlIOHandlingError(utf_decoding_error));\n } else {\n this.store_or_propagate_exception(e);\n }\n return;\n }\n } else {\n decoded_string = data_chunk.toString(this.encoding);\n }\n let line_starts_with_lf = decoded_string.length && decoded_string[0] == '\\n';\n let first_line_index = line_starts_with_lf && this.partially_decoded_line_ends_with_cr ? 1 : 0;\n this.partially_decoded_line_ends_with_cr = decoded_string.length && decoded_string[decoded_string.length - 1] == '\\r';\n let lines = csv_utils.split_lines(decoded_string);\n lines[0] = this.partially_decoded_line + lines[0];\n assert(first_line_index == 0 || lines[0].length == 0);\n this.partially_decoded_line = lines.pop();\n for (let i = first_line_index; i < lines.length; i++) {\n this.process_line(lines[i]);\n }\n };\n\n\n process_data_bulk(data_chunk) {\n let decoded_string = data_chunk.toString(this.encoding);\n if (this.encoding == 'utf-8') {\n // Using hacky comparison method from here: https://stackoverflow.com/a/32279283/2898283\n // TODO get rid of this once TextDecoder is really fixed or when alternative method of reliable decoding appears\n let control_buffer = Buffer.from(decoded_string, 'utf-8');\n if (Buffer.compare(data_chunk, control_buffer) != 0) {\n this.store_or_propagate_exception(new RbqlIOHandlingError(utf_decoding_error));\n return;\n }\n }\n let lines = csv_utils.split_lines(decoded_string);\n if (lines.length && lines[lines.length - 1].length == 0)\n lines.pop();\n for (let i = 0; i < lines.length; i++) {\n this.process_line(lines[i]);\n }\n if (this.rfc_line_buffer.length > 0) {\n this.process_record_line(this.rfc_line_buffer.join('\\n'));\n }\n this.input_exhausted = true;\n this.try_resolve_next_record(); // Should be a NOOP here?\n }\n\n\n process_data_stream_end() {\n this.input_exhausted = true;\n if (this.partially_decoded_line.length) {\n let last_line = this.partially_decoded_line;\n this.partially_decoded_line = '';\n this.process_line(last_line);\n }\n if (this.rfc_line_buffer.length > 0) {\n this.process_record_line(this.rfc_line_buffer.join('\\n'));\n }\n this.try_resolve_next_record();\n };\n\n\n stop() {\n if (this.stream)\n this.stream.destroy(); // TODO consider using pause() instead\n };\n\n\n async start() {\n if (this.started)\n return;\n this.started = true;\n if (this.stream) {\n this.stream.on('data', (data_chunk) => { this.process_data_stream_chunk(data_chunk); });\n this.stream.on('end', () => { this.process_data_stream_end(); });\n } else {\n let parent_iterator = this;\n return new Promise(function(resolve, reject) {\n fs.readFile(parent_iterator.csv_path, (err, data_chunk) => {\n if (err) {\n reject(err);\n } else {\n parent_iterator.process_data_bulk(data_chunk);\n resolve();\n }\n });\n });\n }\n };\n\n\n get_warnings() {\n let result = [];\n if (this.first_defective_line !== null)\n result.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`);\n if (this.utf8_bom_removed)\n result.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`);\n if (Object.keys(this.fields_info).length > 1)\n result.push(make_inconsistent_num_fields_warning(this.table_name, this.fields_info));\n return result;\n };\n}\n\n\nclass CSVWriter extends rbql.RBQLOutputWriter {\n constructor(stream, close_stream_on_finish, encoding, delim, policy, line_separator='\\n') {\n super();\n this.stream = stream;\n this.encoding = encoding;\n if (encoding)\n this.stream.setDefaultEncoding(encoding);\n this.stream.on('error', (error_obj) => { this.store_first_error(error_obj); })\n this.delim = delim;\n this.policy = policy;\n this.line_separator = line_separator;\n this.sub_array_delim = delim == '|' ? ';' : '|';\n\n this.close_stream_on_finish = close_stream_on_finish;\n\n this.null_in_output = false;\n this.delim_in_simple_output = false;\n this.header_len = null;\n this.first_error = null;\n\n if (policy == 'simple') {\n this.polymorphic_join = this.simple_join;\n } else if (policy == 'quoted') {\n this.polymorphic_join = this.quoted_join;\n } else if (policy == 'quoted_rfc') {\n this.polymorphic_join = this.quoted_join_rfc;\n } else if (policy == 'monocolumn') {\n this.polymorphic_join = this.mono_join;\n } else if (policy == 'whitespace') {\n this.polymorphic_join = this.simple_join;\n } else {\n throw new RbqlIOHandlingError('Unknown output csv policy');\n }\n }\n\n\n store_first_error(error_obj) {\n // Store only first error because it is typically more important than the subsequent ones.\n if (this.first_error === null)\n this.first_error = error_obj;\n }\n\n set_header(header) {\n if (header !== null) {\n this.header_len = header.length;\n this.write(header);\n }\n }\n\n\n quoted_join(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n quoted_join_rfc(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.rfc_quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n mono_join(fields) {\n if (fields.length > 1) {\n throw new RbqlIOHandlingError('Unable to use \"Monocolumn\" output format: some records have more than one field');\n }\n return fields[0];\n };\n\n\n simple_join(fields) {\n var res = fields.join(this.delim);\n if (fields.join('').indexOf(this.delim) != -1) {\n this.delim_in_simple_output = true;\n }\n return res;\n };\n\n\n normalize_fields(out_fields) {\n for (var i = 0; i < out_fields.length; i++) {\n if (out_fields[i] == null) {\n this.null_in_output = true;\n out_fields[i] = '';\n } else if (Array.isArray(out_fields[i])) {\n this.normalize_fields(out_fields[i]);\n out_fields[i] = out_fields[i].join(this.sub_array_delim);\n }\n }\n };\n\n\n async write(fields) {\n if (this.header_len !== null && fields.length != this.header_len)\n throw new RbqlIOHandlingError(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${fields.length}`);\n this.normalize_fields(fields);\n this.stream.write(this.polymorphic_join(fields));\n this.stream.write(this.line_separator);\n let writer_error = this.first_error;\n return new Promise(function(resolve, reject) {\n if (writer_error !== null) {\n reject(writer_error);\n } else {\n resolve(true);\n }\n });\n };\n\n\n _write_all(table) {\n for (let i = 0; i < table.length; i++) {\n this.write(table[i]);\n }\n };\n\n\n async finish() {\n let close_stream_on_finish = this.close_stream_on_finish;\n let output_stream = this.stream;\n let output_encoding = this.encoding;\n let writer_error = this.first_error;\n let finish_promise = new Promise(function(resolve, reject) {\n if (writer_error !== null) {\n reject(writer_error);\n }\n if (close_stream_on_finish) {\n output_stream.end('', output_encoding, () => { resolve(); });\n } else {\n setTimeout(() => { resolve(); }, 0);\n }\n });\n return finish_promise;\n };\n\n\n get_warnings() {\n let result = [];\n if (this.null_in_output)\n result.push('null values in output were replaced by empty strings');\n if (this.delim_in_simple_output)\n result.push('Some output fields contain separator');\n return result;\n };\n\n}\n\n\nclass FileSystemCSVRegistry extends rbql.RBQLTableRegistry {\n constructor(input_file_dir, delim, policy, encoding, has_header=false, comment_prefix=null, options=null) {\n super();\n this.input_file_dir = input_file_dir;\n this.delim = delim;\n this.policy = policy;\n this.encoding = encoding;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.stream = null;\n this.record_iterator = null;\n\n this.options = options;\n this.bulk_input_path = null;\n this.table_path = null;\n }\n\n get_iterator_by_table_id(table_id) {\n this.table_path = find_table_path(this.input_file_dir, table_id);\n if (this.table_path === null) {\n throw new RbqlIOHandlingError(`Unable to find join table \"${table_id}\"`);\n }\n if (this.options && this.options['bulk_read']) {\n this.bulk_input_path = this.table_path;\n } else {\n this.stream = fs.createReadStream(this.table_path);\n }\n this.record_iterator = new CSVRecordIterator(this.stream, this.bulk_input_path, this.encoding, this.delim, this.policy, this.has_header, this.comment_prefix, table_id, 'b');\n return this.record_iterator;\n };\n\n get_warnings(output_warnings) {\n if (this.record_iterator && this.has_header) {\n output_warnings.push(`The first record in JOIN file ${path.basename(this.table_path)} was also treated as header (and skipped)`);\n }\n }\n}\n\n\nasync function query_csv(query_text, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, output_warnings, with_headers=false, comment_prefix=null, user_init_code='', options=null) {\n let input_stream = null;\n let bulk_input_path = null;\n if (options && options['bulk_read'] && input_path) {\n bulk_input_path = input_path;\n } else {\n input_stream = input_path === null ? process.stdin : fs.createReadStream(input_path);\n }\n let [output_stream, close_output_on_finish] = output_path === null ? [process.stdout, false] : [fs.createWriteStream(output_path), true];\n if (input_delim == '\"' && input_policy == 'quoted')\n throw new RbqlIOHandlingError('Double quote delimiter is incompatible with \"quoted\" policy');\n if (csv_encoding == 'latin-1')\n csv_encoding = 'binary';\n if (!is_ascii(query_text) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n if ((!is_ascii(input_delim) || !is_ascii(output_delim)) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n\n let default_init_source_path = path.join(os.homedir(), '.rbql_init_source.js');\n if (user_init_code == '' && fs.existsSync(default_init_source_path)) {\n user_init_code = read_user_init_code(default_init_source_path);\n }\n let input_file_dir = input_path ? path.dirname(input_path) : null;\n let join_tables_registry = new FileSystemCSVRegistry(input_file_dir, input_delim, input_policy, csv_encoding, with_headers, comment_prefix, options);\n let input_iterator = new CSVRecordIterator(input_stream, bulk_input_path, csv_encoding, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new CSVWriter(output_stream, close_output_on_finish, csv_encoding, output_delim, output_policy);\n\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n join_tables_registry.get_warnings(output_warnings);\n}\n\n\nmodule.exports.is_ascii = is_ascii;\nmodule.exports.CSVRecordIterator = CSVRecordIterator;\nmodule.exports.CSVWriter = CSVWriter;\nmodule.exports.FileSystemCSVRegistry = FileSystemCSVRegistry;\nmodule.exports.interpret_named_csv_format = interpret_named_csv_format;\nmodule.exports.read_user_init_code = read_user_init_code;\nmodule.exports.query_csv = query_csv;\nmodule.exports.RecordQueue = RecordQueue;\nmodule.exports.exception_to_error_info = rbql.exception_to_error_info;\n","module.exports = require(\"vscode\");","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","const vscode = require('vscode');\n\nconst path = require('path');\nconst fs = require('fs');\nconst os = require('os');\nconst child_process = require('child_process');\n\n// Please see DEV_README.md file for additional info.\n\nconst csv_utils = require('./rbql_core/rbql-js/csv_utils.js');\n\nvar rbql_csv = null; // Using lazy load to improve startup performance.\nfunction ll_rbql_csv() {\n if (rbql_csv === null)\n rbql_csv = require('./rbql_core/rbql-js/rbql_csv.js');\n return rbql_csv;\n}\n\n\nvar rainbow_utils = null; // Using lazy load to improve startup performance.\nfunction ll_rainbow_utils() {\n if (rainbow_utils === null)\n rainbow_utils = require('./rainbow_utils.js');\n return rainbow_utils;\n}\n\n\nconst is_web_ext = (os.homedir === undefined); // Runs as web extension in browser.\nconst preview_window_size = 100;\nconst max_preview_field_length = 250;\nconst scratch_buf_marker = 'vscode_rbql_scratch';\n\nlet client_html_template_web = null;\n\nvar lint_results = new Map();\nvar aligned_files = new Set();\nvar autodetection_stoplist = new Set();\nvar original_language_ids = new Map();\nvar result_set_parent_map = new Map();\n\nvar lint_status_bar_button = null;\nvar rbql_status_bar_button = null;\nvar align_shrink_button = null;\nvar rainbow_off_status_bar_button = null;\nvar copy_back_button = null;\n\nlet last_statusbar_doc = null;\n\nvar rbql_context = null;\n\nvar last_rbql_queries = new Map(); // Query history does not replace this structure, it is also used to store partially entered queries for preview window switch.\n\nvar client_html_template = null;\n\nvar global_state = null;\n\nvar preview_panel = null;\n\nvar doc_edit_subscription = null;\n\nvar _unit_test_last_rbql_report = null; // For unit tests only.\nvar _unit_test_last_warnings = null; // For unit tests only.\n\nconst dialect_map = {\n 'csv': [',', 'quoted'],\n 'tsv': ['\\t', 'simple'],\n 'csv (semicolon)': [';', 'quoted'],\n 'csv (pipe)': ['|', 'simple'],\n 'csv (tilde)': ['~', 'simple'],\n 'csv (caret)': ['^', 'simple'],\n 'csv (colon)': [':', 'simple'],\n 'csv (double quote)': ['\"', 'simple'],\n 'csv (equals)': ['=', 'simple'],\n 'csv (dot)': ['.', 'simple'],\n 'csv (whitespace)': [' ', 'whitespace'],\n 'csv (hyphen)': ['-', 'simple']\n};\n\n\n// This structure will get properly initialized during the startup.\nlet absolute_path_map = {\n 'rbql_client.js': null,\n 'contrib/textarea-caret-position/index.js': null,\n 'rbql_suggest.js': null,\n 'rbql_logo.svg': null,\n 'rbql_client.html': null,\n 'rbql mock/rbql_mock.py': null,\n 'rbql_core/vscode_rbql.py': null\n};\n\n\nfunction show_single_line_error(error_msg) {\n var active_window = vscode.window;\n if (!active_window)\n return;\n // Do not \"await\" error messages because the promise gets resolved only on error dismissal.\n active_window.showErrorMessage(error_msg);\n}\n\n\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n\nasync function push_current_stack_to_js_callback_queue_to_allow_ui_update() {\n await sleep(0);\n}\n\n\nfunction map_separator_to_language_id(separator) {\n for (let language_id in dialect_map) {\n if (!dialect_map.hasOwnProperty(language_id))\n continue;\n if (dialect_map[language_id][0] == separator)\n return language_id;\n }\n return null;\n}\n\n\nfunction get_from_global_state(key, default_value) {\n if (global_state) {\n var value = global_state.get(key);\n if (value !== null && value !== undefined)\n return value;\n }\n return default_value;\n}\n\n\nasync function save_to_global_state(key, value) {\n if (global_state && key) {\n await global_state.update(key, value);\n return true;\n }\n return false;\n}\n\n\nfunction get_rfc_record_text(document, record_start, record_end) {\n let result = [];\n for (let i = record_start; i < record_end && i < document.lineCount; i++) {\n result.push(document.lineAt(i).text);\n }\n return result.join('\\n');\n}\n\n\nasync function replace_doc_content(active_editor, active_doc, new_content) {\n let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0);\n let full_range = active_doc.validateRange(invalid_range);\n await active_editor.edit(edit => edit.replace(full_range, new_content));\n}\n\n\nfunction sample_preview_records_from_context(rbql_context, dst_message) {\n let document = rbql_context.input_document;\n let delim = rbql_context.delim;\n let policy = rbql_context.policy;\n\n rbql_context.requested_start_record = Math.max(rbql_context.requested_start_record, 0);\n\n let preview_records = [];\n if (rbql_context.enable_rfc_newlines) {\n let requested_end_record = rbql_context.requested_start_record + preview_window_size;\n ll_rainbow_utils().populate_optimistic_rfc_csv_record_map(document, requested_end_record, rbql_context.rfc_record_map);\n rbql_context.requested_start_record = Math.max(0, Math.min(rbql_context.requested_start_record, rbql_context.rfc_record_map.length - preview_window_size));\n for (let nr = rbql_context.requested_start_record; nr < rbql_context.rfc_record_map.length && preview_records.length < preview_window_size; nr++) {\n let [record_start, record_end] = rbql_context.rfc_record_map[nr];\n let record_text = get_rfc_record_text(document, record_start, record_end);\n let [cur_record, warning] = csv_utils.smart_split(record_text, delim, policy, false);\n if (warning) {\n dst_message.preview_sampling_error = `Double quotes are not consistent in record ${nr + 1} which starts at line ${record_start + 1}`;\n return;\n }\n preview_records.push(cur_record);\n }\n } else {\n let num_records = document.lineCount;\n if (document.lineAt(Math.max(num_records - 1, 0)).text == '')\n num_records -= 1;\n rbql_context.requested_start_record = Math.max(0, Math.min(rbql_context.requested_start_record, num_records - preview_window_size));\n for (let nr = rbql_context.requested_start_record; nr < num_records && preview_records.length < preview_window_size; nr++) {\n let line_text = document.lineAt(nr).text;\n let cur_record = csv_utils.smart_split(line_text, delim, policy, false)[0];\n preview_records.push(cur_record);\n }\n }\n\n for (let r = 0; r < preview_records.length; r++) {\n let cur_record = preview_records[r];\n for (let c = 0; c < cur_record.length; c++) {\n if (cur_record[c].length > max_preview_field_length) {\n cur_record[c] = cur_record[c].substr(0, max_preview_field_length) + '###UI_STRING_TRIM_MARKER###';\n }\n }\n }\n dst_message.preview_records = preview_records;\n dst_message.start_record_zero_based = rbql_context.requested_start_record;\n}\n\n\nfunction make_header_key(file_path) {\n return 'rbql_header:' + file_path;\n}\n\n\nfunction make_rfc_policy_key(file_path) {\n return 'enable_rfc_newlines:' + file_path;\n}\n\n\nfunction make_with_headers_key(file_path) {\n return 'rbql_with_headers:' + file_path;\n}\n\n\nfunction get_from_config(param_name, default_value) {\n const config = vscode.workspace.getConfiguration('rainbow_csv');\n return config ? config.get(param_name) : default_value;\n}\n\n\nfunction get_header_from_document(document, delim, policy) {\n let comment_prefix = get_from_config('comment_prefix', '');\n let header_line = ll_rainbow_utils().get_header_line(document, comment_prefix);\n return csv_utils.smart_split(header_line, delim, policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n}\n\n\nfunction get_header(document, delim, policy) {\n var file_path = document.fileName;\n if (file_path) {\n let raw_header = get_from_global_state(make_header_key(file_path), null);\n if (raw_header) {\n return JSON.parse(raw_header);\n }\n }\n return get_header_from_document(document, delim, policy);\n}\n\n\nfunction get_field_by_line_position(fields, query_pos) {\n if (!fields.length)\n return null;\n var col_num = 0;\n var cpos = fields[col_num].length + 1;\n while (query_pos > cpos && col_num + 1 < fields.length) {\n col_num += 1;\n cpos = cpos + fields[col_num].length + 1;\n }\n return col_num;\n}\n\n\nfunction make_hover_text(document, position, language_id, enable_tooltip_column_names, enable_tooltip_warnings) {\n let [delim, policy] = dialect_map[language_id];\n var lnum = position.line;\n var cnum = position.character;\n var line = document.lineAt(lnum).text;\n\n let comment_prefix = get_from_config('comment_prefix', '');\n if (comment_prefix && line.startsWith(comment_prefix))\n return 'Comment';\n\n var report = csv_utils.smart_split(line, delim, policy, true);\n\n var entries = report[0];\n var warning = report[1];\n var col_num = get_field_by_line_position(entries, cnum + 1);\n\n if (col_num == null)\n return null;\n var result = 'Col #' + (col_num + 1);\n\n var header = get_header(document, delim, policy);\n if (enable_tooltip_column_names && col_num < header.length) {\n const max_label_len = 50;\n let column_label = header[col_num].trim();\n var short_column_label = column_label.substr(0, max_label_len);\n if (short_column_label != column_label)\n short_column_label = short_column_label + '...';\n result += ', Header: \"' + short_column_label + '\"';\n }\n if (enable_tooltip_warnings) {\n if (warning) {\n result += '; ERR: Inconsistent double quotes in line';\n } else if (header.length != entries.length) {\n result += `; WARN: Inconsistent num of fields, header: ${header.length}, this line: ${entries.length}`;\n }\n }\n return result;\n}\n\n\nfunction make_hover(document, position, language_id, cancellation_token) {\n if (last_statusbar_doc != document) {\n refresh_status_bar_buttons(document); // Being paranoid and making sure that the buttons are visible.\n }\n if (!get_from_config('enable_tooltip', false)) {\n return;\n }\n let enable_tooltip_column_names = get_from_config('enable_tooltip_column_names', false);\n let enable_tooltip_warnings = get_from_config('enable_tooltip_warnings', false);\n var hover_text = make_hover_text(document, position, language_id, enable_tooltip_column_names, enable_tooltip_warnings);\n if (hover_text && !cancellation_token.isCancellationRequested) {\n let mds = null;\n try {\n mds = new vscode.MarkdownString();\n mds.appendCodeblock(hover_text, 'rainbow hover markup');\n } catch (e) {\n mds = hover_text; // Older VSCode versions may not have MarkdownString/appendCodeblock functionality.\n }\n return new vscode.Hover(mds);\n } else {\n return null;\n }\n}\n\n\nfunction produce_lint_report(active_doc, delim, policy) {\n let comment_prefix = get_from_config('comment_prefix', '');\n let detect_trailing_spaces = get_from_config('csv_lint_detect_trailing_spaces', false);\n let first_trailing_space_line = null;\n var num_lines = active_doc.lineCount;\n var num_fields = null;\n for (var lnum = 0; lnum < num_lines; lnum++) {\n var line_text = active_doc.lineAt(lnum).text;\n if (lnum + 1 == num_lines && !line_text)\n break;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n var split_result = csv_utils.smart_split(line_text, delim, policy, true);\n if (split_result[1]) {\n return 'Error. Line ' + (lnum + 1) + ' has formatting error: double quote chars are not consistent';\n }\n if (detect_trailing_spaces && first_trailing_space_line === null) {\n let fields = split_result[0];\n for (let i = 0; i < fields.length; i++) {\n if (fields[i].length && (fields[i].charAt(0) == ' ' || fields[i].slice(-1) == ' ')) {\n first_trailing_space_line = lnum;\n }\n }\n }\n if (!num_fields) {\n num_fields = split_result[0].length;\n }\n if (num_fields != split_result[0].length) {\n return 'Error. Number of fields is not consistent: e.g. line 1 has ' + num_fields + ' fields, and line ' + (lnum + 1) + ' has ' + split_result[0].length + ' fields.';\n }\n }\n if (first_trailing_space_line !== null) {\n return 'Leading/Trailing spaces detected: e.g. at line ' + (first_trailing_space_line + 1) + '. Run \"Shrink\" command to remove them.';\n }\n return 'OK';\n}\n\n\nfunction get_active_editor() {\n var active_window = vscode.window;\n if (!active_window)\n return null;\n var active_editor = active_window.activeTextEditor;\n if (!active_editor)\n return null;\n return active_editor;\n}\n\n\nfunction get_active_doc(active_editor=null) {\n if (!active_editor)\n active_editor = get_active_editor();\n if (!active_editor)\n return null;\n var active_doc = active_editor.document;\n if (!active_doc)\n return null;\n return active_doc;\n}\n\n\nfunction show_lint_status_bar_button(file_path, language_id) {\n let lint_cache_key = `${file_path}.${language_id}`;\n if (!lint_results.has(lint_cache_key))\n return;\n var lint_report = lint_results.get(lint_cache_key);\n if (!lint_status_bar_button)\n lint_status_bar_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n lint_status_bar_button.text = 'CSVLint';\n if (lint_report === 'OK') {\n lint_status_bar_button.color = '#62f442';\n } else if (lint_report == 'Processing...') {\n lint_status_bar_button.color = '#A0A0A0';\n } else if (lint_report.indexOf('spaces detected') != -1) {\n lint_status_bar_button.color = '#ffff28';\n } else {\n lint_status_bar_button.color = '#f44242';\n }\n lint_status_bar_button.tooltip = lint_report + '\\nClick to recheck';\n lint_status_bar_button.command = 'rainbow-csv.CSVLint';\n lint_status_bar_button.show();\n}\n\n\nfunction show_align_shrink_button(file_path) {\n if (!align_shrink_button)\n align_shrink_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n if (aligned_files.has(file_path)) {\n align_shrink_button.text = 'Shrink';\n align_shrink_button.tooltip = 'Click to shrink table (Then you can click again to align)';\n align_shrink_button.command = 'rainbow-csv.Shrink';\n } else {\n align_shrink_button.text = 'Align';\n align_shrink_button.tooltip = 'Click to align table (Then you can click again to shrink)';\n align_shrink_button.command = 'rainbow-csv.Align';\n }\n align_shrink_button.show();\n}\n\n\nfunction show_rainbow_off_status_bar_button() {\n if (!rainbow_off_status_bar_button)\n rainbow_off_status_bar_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n rainbow_off_status_bar_button.text = 'Rainbow OFF';\n rainbow_off_status_bar_button.tooltip = 'Click to restore original file type and syntax';\n rainbow_off_status_bar_button.command = 'rainbow-csv.RainbowSeparatorOff';\n rainbow_off_status_bar_button.show();\n}\n\n\nfunction show_rbql_status_bar_button() {\n if (!rbql_status_bar_button)\n rbql_status_bar_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n rbql_status_bar_button.text = 'Query';\n rbql_status_bar_button.tooltip = 'Click to run SQL-like RBQL query';\n rbql_status_bar_button.command = 'rainbow-csv.RBQL';\n rbql_status_bar_button.show();\n}\n\n\nfunction hide_status_bar_buttons() {\n let all_buttons = [lint_status_bar_button, rbql_status_bar_button, rainbow_off_status_bar_button, copy_back_button, align_shrink_button];\n for (let i = 0; i < all_buttons.length; i++) {\n if (all_buttons[i])\n all_buttons[i].hide();\n }\n}\n\n\nfunction show_rbql_copy_to_source_button(file_path) {\n let parent_table_path = result_set_parent_map.get(file_path.toLowerCase());\n if (!parent_table_path || parent_table_path.indexOf(scratch_buf_marker) != -1)\n return;\n let parent_basename = path.basename(parent_table_path);\n if (!copy_back_button)\n copy_back_button = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);\n copy_back_button.text = 'Copy Back';\n copy_back_button.tooltip = `Copy to parent table: ${parent_basename}`;\n copy_back_button.command = 'rainbow-csv.CopyBack';\n copy_back_button.show();\n}\n\n\nfunction refresh_status_bar_buttons(active_doc=null) {\n if (!active_doc)\n active_doc = get_active_doc();\n last_statusbar_doc = active_doc;\n var file_path = active_doc ? active_doc.fileName : null;\n if (!active_doc || !file_path) {\n hide_status_bar_buttons();\n return;\n }\n if (file_path.endsWith('.git')) {\n return; // Sometimes for git-controlled dirs VSCode opens mysterious .git files. Skip them, don't hide buttons.\n }\n hide_status_bar_buttons();\n var language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return;\n show_lint_status_bar_button(file_path, language_id);\n show_rbql_status_bar_button();\n show_align_shrink_button(file_path);\n show_rainbow_off_status_bar_button();\n show_rbql_copy_to_source_button(file_path);\n}\n\n\nfunction csv_lint(active_doc, is_manual_op) {\n if (!active_doc)\n active_doc = get_active_doc();\n if (!active_doc)\n return null;\n var file_path = active_doc.fileName; // For new unitled scratch documents this would be \"Untitled-1\", \"Untitled-2\", etc...\n if (!file_path)\n return null;\n var language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return null;\n let lint_cache_key = `${file_path}.${language_id}`;\n if (!is_manual_op) {\n if (lint_results.has(lint_cache_key))\n return null;\n if (!get_from_config('enable_auto_csv_lint', false))\n return null;\n }\n lint_results.set(lint_cache_key, 'Processing...');\n refresh_status_bar_buttons(active_doc); // Visual feedback.\n let [delim, policy] = dialect_map[language_id];\n var lint_report = produce_lint_report(active_doc, delim, policy);\n lint_results.set(lint_cache_key, lint_report);\n return lint_report;\n}\n\n\nasync function csv_lint_cmd() {\n // TODO re-run on each file save with content change.\n let lint_report = csv_lint(null, true);\n // Need timeout here to give user enough time to notice green -> yellow -> green switch, this is a sort of visual feedback.\n await sleep(500);\n refresh_status_bar_buttons();\n return lint_report;\n}\n\n\nasync function run_internal_test_cmd(integration_test_options) {\n if (integration_test_options && integration_test_options.check_initialization_state) {\n // This mode is to ensure that the most basic operations do not cause rainbow csv to load extra (potentially heavy) code.\n // Vim uses the same approach with its plugin/autoload folder layout design.\n return {initialized: global_state !== null, lazy_loaded: rainbow_utils !== null};\n }\n if (integration_test_options && integration_test_options.check_last_rbql_report) {\n return _unit_test_last_rbql_report;\n }\n if (integration_test_options && integration_test_options.check_last_rbql_warnings) {\n return {'warnings': _unit_test_last_warnings};\n }\n return null;\n}\n\n\nasync function show_warnings(warnings) {\n _unit_test_last_warnings = [];\n if (!warnings || !warnings.length)\n return;\n var active_window = vscode.window;\n if (!active_window)\n return null;\n for (var i = 0; i < warnings.length; i++) {\n // Do not \"await\" warning messages because the promise gets resolved only on warning dismissal.\n active_window.showWarningMessage('RBQL warning: ' + warnings[i]);\n }\n _unit_test_last_warnings = warnings;\n}\n\n\nasync function handle_rbql_result_file(text_doc, warnings) {\n var out_delim = rbql_context.output_delim;\n let language_id = map_separator_to_language_id(out_delim);\n var active_window = vscode.window;\n if (!active_window)\n return;\n try {\n await active_window.showTextDocument(text_doc);\n } catch (error) {\n show_single_line_error('Unable to open RBQL result document');\n return;\n }\n if (language_id && text_doc.language_id != language_id) {\n console.log('changing RBQL result language ' + text_doc.language_id + ' -> ' + language_id);\n await vscode.languages.setTextDocumentLanguage(text_doc, language_id);\n }\n await show_warnings(warnings);\n}\n\n\nfunction run_command(cmd, args, close_and_error_guard, callback_func) {\n var command = child_process.spawn(cmd, args, {'windowsHide': true});\n var stdout = '';\n var stderr = '';\n command.stdout.on('data', function(data) {\n stdout += data.toString();\n });\n command.stderr.on('data', function(data) {\n stderr += data.toString();\n });\n command.on('close', function(code) {\n if (!close_and_error_guard['process_reported']) {\n close_and_error_guard['process_reported'] = true;\n callback_func(code, stdout, stderr);\n }\n });\n command.on('error', function(error) {\n var error_msg = error ? error.name + ': ' + error.message : '';\n if (!close_and_error_guard['process_reported']) {\n close_and_error_guard['process_reported'] = true;\n callback_func(1, '', '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' + error_msg);\n }\n });\n}\n\n\nasync function handle_command_result(src_table_path, dst_table_path, error_code, stdout, stderr, webview_report_handler) {\n let json_report = stdout;\n let error_type = null;\n let error_msg = null;\n let warnings = [];\n if (error_code || !json_report || stderr) {\n error_type = 'Integration';\n error_msg = stderr ? stderr : 'empty error';\n } else {\n try {\n let report = JSON.parse(json_report);\n if (report.hasOwnProperty('error_type'))\n error_type = report['error_type'];\n if (report.hasOwnProperty('error_msg'))\n error_msg = report['error_msg'];\n if (report.hasOwnProperty('warnings'))\n warnings = report['warnings'];\n } catch (e) {\n error_type = 'Integration';\n error_msg = 'Unable to parse JSON report';\n }\n }\n webview_report_handler(error_type, error_msg);\n if (error_type || error_msg) {\n return; // Just exit: error would be shown in the preview window.\n }\n // No need to close the RBQL console here, better to leave it open so it can be used to quickly adjust the query if needed.\n autodetection_stoplist.add(dst_table_path);\n result_set_parent_map.set(dst_table_path.toLowerCase(), src_table_path);\n let doc = await vscode.workspace.openTextDocument(dst_table_path);\n await handle_rbql_result_file(doc, warnings);\n}\n\n\nfunction get_dst_table_name(input_path, output_delim) {\n var table_name = path.basename(input_path);\n var orig_extension = path.extname(table_name);\n var delim_ext_map = {'\\t': '.tsv', ',': '.csv'};\n var dst_extension = '.txt';\n if (delim_ext_map.hasOwnProperty(output_delim)) {\n dst_extension = delim_ext_map[output_delim];\n } else if (orig_extension.length > 1) {\n dst_extension = orig_extension;\n }\n let result_table_name = table_name + dst_extension;\n if (result_table_name == table_name) { // Just being paranoid to avoid overwriting input table accidentally when output dir configured to be the same as input.\n result_table_name += '.txt';\n }\n return result_table_name;\n}\n\n\nfunction file_path_to_query_key(file_path) {\n return (file_path && file_path.indexOf(scratch_buf_marker) != -1) ? scratch_buf_marker : file_path;\n}\n\nfunction get_dst_table_dir(input_table_path) {\n let rbql_output_dir = get_from_config('rbql_output_dir', 'TMP')\n if (rbql_output_dir == 'TMP') {\n return os.tmpdir();\n } else if (rbql_output_dir == 'INPUT') {\n return path.dirname(input_table_path);\n } else {\n // Return custom directory. If the directory does not exist or isn't writable RBQL itself will report more or less clear error.\n return rbql_output_dir;\n }\n}\n\n\nasync function run_rbql_query(input_path, csv_encoding, backend_language, rbql_query, output_dialect, enable_rfc_newlines, with_headers, webview_report_handler) {\n last_rbql_queries.set(file_path_to_query_key(input_path), rbql_query);\n var cmd = 'python';\n const test_marker = 'test ';\n let close_and_error_guard = {'process_reported': false};\n\n let [input_delim, input_policy] = [rbql_context.delim, rbql_context.policy];\n if (input_policy == 'quoted' && enable_rfc_newlines)\n input_policy = 'quoted_rfc';\n let [output_delim, output_policy] = [input_delim, input_policy];\n if (output_dialect == 'csv')\n [output_delim, output_policy] = [',', 'quoted']; // XXX should it be \"quoted_rfc\" instead?\n if (output_dialect == 'tsv')\n [output_delim, output_policy] = ['\\t', 'simple'];\n rbql_context.output_delim = output_delim;\n\n let output_path = is_web_ext ? null : path.join(get_dst_table_dir(input_path), get_dst_table_name(input_path, output_delim));\n\n if (rbql_query.startsWith(test_marker)) {\n if (rbql_query.indexOf('nopython') != -1) {\n cmd = 'nopython';\n }\n let args = [absolute_path_map['rbql mock/rbql_mock.py'], rbql_query];\n run_command(cmd, args, close_and_error_guard, function(error_code, stdout, stderr) { handle_command_result(input_path, output_path, error_code, stdout, stderr, webview_report_handler); });\n return;\n }\n if (backend_language == 'js') {\n let warnings = [];\n let result_doc = null;\n try {\n if (is_web_ext) {\n let result_lines = await ll_rainbow_utils().rbql_query_web(rbql_query, rbql_context.input_document, input_delim, input_policy, output_delim, output_policy, warnings, with_headers, null);\n let output_doc_cfg = {content: result_lines.join('\\n'), language: map_separator_to_language_id(output_delim)};\n result_doc = await vscode.workspace.openTextDocument(output_doc_cfg);\n } else {\n let csv_options = {'bulk_read': true};\n await ll_rainbow_utils().rbql_query_node(global_state, rbql_query, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, warnings, with_headers, null, '', csv_options);\n result_set_parent_map.set(output_path.toLowerCase(), input_path);\n autodetection_stoplist.add(output_path);\n result_doc = await vscode.workspace.openTextDocument(output_path);\n }\n } catch (e) {\n let [error_type, error_msg] = ll_rbql_csv().exception_to_error_info(e);\n webview_report_handler(error_type, error_msg);\n return;\n }\n webview_report_handler(null, null);\n await handle_rbql_result_file(result_doc, warnings);\n } else {\n if (is_web_ext) {\n webview_report_handler('Input error', 'Python backend for RBQL is not supported in web version, please use JavaScript backend.');\n return;\n }\n let cmd_safe_query = Buffer.from(rbql_query, \"utf-8\").toString(\"base64\");\n let args = [absolute_path_map['rbql_core/vscode_rbql.py'], cmd_safe_query, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding];\n if (with_headers)\n args.push('--with_headers');\n run_command(cmd, args, close_and_error_guard, function(error_code, stdout, stderr) { handle_command_result(input_path, output_path, error_code, stdout, stderr, webview_report_handler); });\n }\n}\n\n\nfunction get_dialect(document) {\n var language_id = document.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return ['monocolumn', 'monocolumn'];\n return dialect_map[language_id];\n}\n\n\nasync function set_header_line() {\n let active_editor = get_active_editor();\n if (!active_editor)\n return;\n var active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n\n var dialect = get_dialect(active_doc);\n var delim = dialect[0];\n var policy = dialect[1];\n if (policy == 'monocolumn') {\n show_single_line_error('Unable to set header line: no separator specified');\n return;\n }\n let file_path = active_doc.fileName;\n if (!file_path) {\n show_single_line_error('Unable to set header line for non-file documents');\n return;\n }\n let selection = active_editor.selection;\n let raw_header = active_doc.lineAt(selection.start.line).text;\n\n let header = csv_utils.smart_split(raw_header, delim, policy, false)[0];\n await save_to_global_state(make_header_key(file_path), JSON.stringify(header));\n}\n\n\nasync function set_rainbow_separator() {\n let active_editor = get_active_editor();\n if (!active_editor)\n return;\n var active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let original_language_id = active_doc.languageId;\n let selection = active_editor.selection;\n if (!selection) {\n show_single_line_error(\"Selection is empty\");\n return;\n }\n if (selection.start.line != selection.end.line || selection.start.character + 1 != selection.end.character) {\n show_single_line_error(\"Selection must contain exactly one separator character\");\n return;\n }\n let separator = active_doc.lineAt(selection.start.line).text.charAt(selection.start.character);\n let language_id = map_separator_to_language_id(separator);\n if (!language_id) {\n show_single_line_error(\"Selected separator is not supported\");\n return;\n }\n\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, language_id);\n original_language_ids.set(doc.fileName, original_language_id);\n csv_lint(doc, false);\n refresh_status_bar_buttons(doc);\n}\n\n\nasync function restore_original_language() {\n var active_doc = get_active_doc();\n if (!active_doc)\n return;\n let file_path = active_doc.fileName;\n autodetection_stoplist.add(file_path);\n let original_language_id = 'plaintext';\n if (original_language_ids.has(file_path)) {\n original_language_id = original_language_ids.get(file_path);\n }\n if (!original_language_id || original_language_id == active_doc.languageId) {\n show_single_line_error(\"Unable to restore original language\");\n return;\n }\n\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, original_language_id);\n original_language_ids.delete(file_path);\n refresh_status_bar_buttons(doc);\n}\n\n\nasync function set_join_table_name() {\n if (is_web_ext) {\n show_single_line_error('This command is currently unavailable in web mode.');\n return;\n }\n var active_doc = get_active_doc();\n if (!active_doc)\n return;\n let file_path = active_doc.fileName;\n if (!file_path) {\n show_single_line_error('Unable to use this document as join table');\n return;\n }\n var title = \"Input table name to use in RBQL JOIN expressions instead of table path\";\n var input_box_props = {\"prompt\": title, \"value\": 'b'};\n let table_name = await vscode.window.showInputBox(input_box_props);\n if (!table_name)\n return; // User pressed Esc and closed the input box.\n save_to_global_state(ll_rainbow_utils().make_table_name_key(table_name), file_path);\n}\n\n\nasync function set_virtual_header() {\n var active_doc = get_active_doc();\n var dialect = get_dialect(active_doc);\n var delim = dialect[0];\n var policy = dialect[1];\n var file_path = active_doc.fileName;\n if (!file_path) {\n show_single_line_error('Unable to edit column names for non-file documents');\n return;\n }\n if (policy == 'monocolumn') {\n show_single_line_error('Unable to set virtual header: no separator specified');\n return;\n }\n var old_header = get_header(active_doc, delim, policy);\n var title = \"Adjust column names displayed in hover tooltips. Actual header line and file content won't be affected.\";\n var old_header_str = quoted_join(old_header, delim);\n var input_box_props = {\"prompt\": title, \"value\": old_header_str};\n let raw_new_header = await vscode.window.showInputBox(input_box_props);\n if (!raw_new_header)\n return; // User pressed Esc and closed the input box.\n let new_header = csv_utils.smart_split(raw_new_header, delim, policy, false)[0];\n await save_to_global_state(make_header_key(file_path), JSON.stringify(new_header));\n}\n\n\nasync function column_edit(edit_mode) {\n let active_editor = get_active_editor();\n if (!active_editor || !active_editor.selection)\n return;\n let active_doc = active_editor.document;\n if (!active_doc)\n return;\n let dialect = get_dialect(active_doc);\n let delim = dialect[0];\n let policy = dialect[1];\n let comment_prefix = get_from_config('comment_prefix', '');\n\n let position = active_editor.selection.active;\n let lnum = position.line;\n let cnum = position.character;\n let line = active_doc.lineAt(lnum).text;\n\n let report = csv_utils.smart_split(line, delim, policy, true);\n\n let entries = report[0];\n let quoting_warning = report[1];\n let col_num = get_field_by_line_position(entries, cnum + 1);\n\n let selections = [];\n let num_lines = active_doc.lineCount;\n if (num_lines >= 10000) {\n show_single_line_error('Multicursor column edit works only for files smaller than 10000 lines.');\n return;\n }\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (lnum + 1 == num_lines && !line_text)\n break;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let report = csv_utils.smart_split(line_text, delim, policy, true);\n let entries = report[0];\n quoting_warning = quoting_warning || report[1];\n if (col_num >= entries.length) {\n show_single_line_error(`Line ${lnum + 1} doesn't have field number ${col_num + 1}`);\n return;\n }\n let char_pos_before = entries.slice(0, col_num).join('').length + col_num;\n let char_pos_after = entries.slice(0, col_num + 1).join('').length + col_num;\n if (edit_mode == 'ce_before' && policy == 'quoted' && line_text.substring(char_pos_before - 2, char_pos_before + 2).indexOf('\"') != -1) {\n show_single_line_error(`Accidental data corruption prevention: Cursor at line ${lnum + 1} will not be set: a double quote is in proximity.`);\n return;\n }\n if (edit_mode == 'ce_after' && policy == 'quoted' && line_text.substring(char_pos_after - 2, char_pos_after + 2).indexOf('\"') != -1) {\n show_single_line_error(`Accidental data corruption prevention: Cursor at line ${lnum + 1} will not be set: a double quote is in proximity.`);\n return;\n }\n if (edit_mode == 'ce_select' && char_pos_before == char_pos_after) {\n show_single_line_error(`Accidental data corruption prevention: The column can not be selected: field ${col_num + 1} at line ${lnum + 1} is empty.`);\n return;\n }\n let position_before = new vscode.Position(lnum, char_pos_before);\n let position_after = new vscode.Position(lnum, char_pos_after);\n if (edit_mode == 'ce_before') {\n selections.push(new vscode.Selection(position_before, position_before));\n }\n if (edit_mode == 'ce_after') {\n selections.push(new vscode.Selection(position_after, position_after));\n }\n if (edit_mode == 'ce_select') {\n selections.push(new vscode.Selection(position_before, position_after));\n }\n }\n active_editor.selections = selections;\n if (quoting_warning) {\n vscode.window.showWarningMessage('Some lines have quoting issues: cursors positioning may be incorrect.');\n }\n // Call showTextDocument so that the editor will gain focus and the cursors will become active and blinking. This is a critical step here!\n await vscode.window.showTextDocument(active_doc);\n}\n\n\nasync function shrink_table() {\n let active_editor = get_active_editor();\n let active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return;\n let [delim, policy] = dialect_map[language_id];\n let comment_prefix = get_from_config('comment_prefix', '');\n let progress_options = {location: vscode.ProgressLocation.Window, title: 'Rainbow CSV'};\n await vscode.window.withProgress(progress_options, async (progress) => {\n progress.report({message: 'Preparing'});\n await push_current_stack_to_js_callback_queue_to_allow_ui_update();\n let [shrinked_doc_text, first_failed_line] = ll_rainbow_utils().shrink_columns(active_doc, delim, policy, comment_prefix);\n if (first_failed_line) {\n show_single_line_error(`Unable to shrink: Inconsistent double quotes at line ${first_failed_line}`);\n return;\n }\n aligned_files.delete(active_doc.fileName);\n refresh_status_bar_buttons(active_doc);\n if (shrinked_doc_text === null) {\n vscode.window.showWarningMessage('No trailing whitespaces found, skipping');\n return;\n }\n progress.report({message: 'Shrinking columns'});\n await push_current_stack_to_js_callback_queue_to_allow_ui_update();\n await replace_doc_content(active_editor, active_doc, shrinked_doc_text);\n });\n}\n\n\nasync function align_table() {\n let active_editor = get_active_editor();\n let active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n let language_id = active_doc.languageId;\n if (!dialect_map.hasOwnProperty(language_id))\n return;\n let [delim, policy] = dialect_map[language_id];\n let comment_prefix = get_from_config('comment_prefix', '');\n let progress_options = {location: vscode.ProgressLocation.Window, title: 'Rainbow CSV'};\n await vscode.window.withProgress(progress_options, async (progress) => {\n progress.report({message: 'Calculating column statistics'});\n await push_current_stack_to_js_callback_queue_to_allow_ui_update();\n let [column_stats, first_failed_line] = ll_rainbow_utils().calc_column_stats(active_doc, delim, policy, comment_prefix);\n if (first_failed_line) {\n show_single_line_error(`Unable to align: Inconsistent double quotes at line ${first_failed_line}`);\n return;\n }\n column_stats = ll_rainbow_utils().adjust_column_stats(column_stats);\n if (column_stats === null) {\n show_single_line_error('Unable to allign: Internal Rainbow CSV Error');\n return;\n }\n progress.report({message: 'Preparing final alignment'});\n await push_current_stack_to_js_callback_queue_to_allow_ui_update();\n aligned_doc_text = ll_rainbow_utils().align_columns(active_doc, delim, policy, comment_prefix, column_stats);\n aligned_files.add(active_doc.fileName);\n refresh_status_bar_buttons(active_doc);\n if (aligned_doc_text === null) {\n vscode.window.showWarningMessage('Table is already aligned, skipping');\n return;\n }\n // The last stage of actually applying the edits takes almost 80% of the whole alignment runtime.\n progress.report({message: 'Aligning columns'});\n await push_current_stack_to_js_callback_queue_to_allow_ui_update();\n await replace_doc_content(active_editor, active_doc, aligned_doc_text);\n });\n}\n\n\nasync function do_copy_back(query_result_doc, active_editor) {\n let data = query_result_doc.getText();\n let active_doc = get_active_doc(active_editor);\n if (!active_doc)\n return;\n await replace_doc_content(active_editor, active_doc, data);\n}\n\n\nasync function copy_back() {\n if (is_web_ext) {\n show_single_line_error('This command is currently unavailable in web mode.');\n return;\n }\n let result_doc = get_active_doc();\n if (!result_doc)\n return;\n let file_path = result_doc.fileName;\n let parent_table_path = result_set_parent_map.get(file_path.toLowerCase());\n if (!parent_table_path)\n return;\n let parent_doc = await vscode.workspace.openTextDocument(parent_table_path);\n let parent_editor = await vscode.window.showTextDocument(parent_doc);\n await do_copy_back(result_doc, parent_editor);\n}\n\n\nasync function update_query_history(query) {\n let history_list = get_from_global_state('rbql_query_history', []);\n let old_index = history_list.indexOf(query);\n if (old_index != -1) {\n history_list.splice(old_index, 1);\n } else if (history_list.length >= 20) {\n history_list.splice(0, 1);\n }\n history_list.push(query);\n await save_to_global_state('rbql_query_history', history_list);\n}\n\n\nasync function handle_rbql_client_message(webview, message, integration_test_options=null) {\n let message_type = message['msg_type'];\n\n let webview_report_handler = async function(error_type, error_msg) {\n let report_msg = {'msg_type': 'rbql_report'};\n if (error_type)\n report_msg[\"error_type\"] = error_type;\n if (error_msg)\n report_msg[\"error_msg\"] = error_msg;\n _unit_test_last_rbql_report = report_msg;\n await webview.postMessage(report_msg);\n };\n\n if (message_type == 'handshake') {\n var backend_language = get_from_global_state('rbql_backend_language', 'js');\n var encoding = get_from_global_state('rbql_encoding', 'utf-8');\n var init_msg = {'msg_type': 'handshake', 'backend_language': backend_language, 'encoding': encoding};\n sample_preview_records_from_context(rbql_context, init_msg);\n let path_key = file_path_to_query_key(rbql_context.input_document_path);\n if (last_rbql_queries.has(path_key))\n init_msg['last_query'] = last_rbql_queries.get(path_key);\n let history_list = get_from_global_state('rbql_query_history', []);\n init_msg['query_history'] = history_list;\n init_msg['policy'] = rbql_context.policy;\n init_msg['enable_rfc_newlines'] = rbql_context.enable_rfc_newlines;\n init_msg['with_headers'] = rbql_context.with_headers;\n init_msg['header'] = rbql_context.header;\n init_msg['is_web_ext'] = is_web_ext;\n if (integration_test_options) {\n init_msg['integration_test_language'] = integration_test_options.rbql_backend;\n init_msg['integration_test_query'] = integration_test_options.rbql_query;\n init_msg['integration_test_with_headers'] = integration_test_options.with_headers || false;\n init_msg['integration_test_enable_rfc_newlines'] = integration_test_options.enable_rfc_newlines || false;\n }\n await webview.postMessage(init_msg);\n }\n\n if (message_type == 'fetch_table_header') {\n try {\n let table_id = message['table_id'];\n let encoding = message['encoding'];\n\n let input_table_dir = rbql_context.input_document_path ? path.dirname(rbql_context.input_document_path) : null;\n let table_path = ll_rainbow_utils().find_table_path(global_state, input_table_dir, table_id);\n if (!table_path)\n return;\n let header_line = await ll_rainbow_utils().read_header(table_path, encoding);\n let [fields, warning] = csv_utils.smart_split(header_line, rbql_context.delim, rbql_context.policy, false);\n if (!warning) {\n webview.postMessage({'msg_type': 'fetch_table_header_response', 'header': fields});\n }\n } catch (e) {\n console.error('Unable to get join table header: ' + String(e));\n }\n }\n\n if (message_type == 'update_query') {\n let rbql_query = message['query'];\n if (!rbql_query)\n return;\n if (rbql_context.input_document_path)\n last_rbql_queries.set(file_path_to_query_key(rbql_context.input_document_path), rbql_query);\n }\n\n if (message_type == 'newlines_policy_change') {\n rbql_context.enable_rfc_newlines = message['enable_rfc_newlines'];\n if (rbql_context.input_document_path)\n await save_to_global_state(make_rfc_policy_key(rbql_context.input_document_path), rbql_context.enable_rfc_newlines);\n let protocol_message = {'msg_type': 'resample'};\n sample_preview_records_from_context(rbql_context, protocol_message);\n await webview.postMessage(protocol_message);\n }\n\n if (message_type == 'with_headers_change') {\n rbql_context.with_headers = message['with_headers'];\n if (rbql_context.input_document_path)\n await save_to_global_state(make_with_headers_key(rbql_context.input_document_path), rbql_context.with_headers);\n }\n\n if (message_type == 'navigate') {\n var navig_direction = message['direction'];\n if (navig_direction == 'backward') {\n rbql_context.requested_start_record -= preview_window_size;\n } else if (navig_direction == 'forward') {\n rbql_context.requested_start_record += preview_window_size;\n } else if (navig_direction == 'begin') {\n rbql_context.requested_start_record = 0;\n } else if (navig_direction == 'end') {\n rbql_context.requested_start_record = rbql_context.input_document.lineCount; // This is just max possible value which is incorrect and will be adjusted later.\n }\n let protocol_message = {'msg_type': 'navigate'};\n sample_preview_records_from_context(rbql_context, protocol_message);\n await webview.postMessage(protocol_message);\n }\n\n if (message_type == 'run') {\n let rbql_query = message['query'];\n let backend_language = message['backend_language'];\n let encoding = message['encoding'];\n let output_dialect = message['output_dialect'];\n let enable_rfc_newlines = message['enable_rfc_newlines'];\n let with_headers = message['with_headers'];\n await update_query_history(rbql_query);\n await run_rbql_query(rbql_context.input_document_path, encoding, backend_language, rbql_query, output_dialect, enable_rfc_newlines, with_headers, webview_report_handler);\n }\n\n if (message_type == 'edit_udf') {\n if (is_web_ext) {\n webview_report_handler('Input error', 'UDFs are currently not supported in web version');\n return;\n }\n let backend_language = message['backend_language'];\n let udf_file_path = null;\n let default_content = '';\n if (backend_language == 'js') {\n udf_file_path = path.join(os.homedir(), '.rbql_init_source.js');\n default_content = ll_rainbow_utils().get_default_js_udf_content();\n } else {\n udf_file_path = path.join(os.homedir(), '.rbql_init_source.py');\n default_content = ll_rainbow_utils().get_default_python_udf_content();\n }\n if (!fs.existsSync(udf_file_path)) {\n fs.writeFileSync(udf_file_path, default_content);\n }\n let udf_doc = await vscode.workspace.openTextDocument(udf_file_path);\n await vscode.window.showTextDocument(udf_doc);\n }\n\n if (message_type == 'global_param_change') {\n await save_to_global_state(message['key'], message['value']);\n }\n}\n\n\nfunction adjust_webview_paths(paths_list, client_html) {\n for (const local_path of paths_list) {\n let adjusted_webview_url = null;\n if (is_web_ext) {\n adjusted_webview_url = absolute_path_map[local_path];\n } else {\n adjusted_webview_url = preview_panel.webview.asWebviewUri(vscode.Uri.file(absolute_path_map[local_path]));\n }\n client_html = client_html.replace(`src=\"${local_path}\"`, `src=\"${adjusted_webview_url}\"`);\n }\n return client_html;\n}\n\n\nasync function edit_rbql(integration_test_options=null) {\n let active_window = vscode.window;\n if (!active_window)\n return;\n let active_editor = active_window.activeTextEditor;\n if (!active_editor)\n return;\n let active_doc = active_editor.document;\n if (!active_doc)\n return;\n let orig_uri = active_doc.uri;\n if (!orig_uri)\n return;\n // For web orig_uri.scheme can have other valid values e.g. `vscode-test-web` when testing the browser integration.\n if (orig_uri.scheme != 'file' && orig_uri.scheme != 'untitled' && !is_web_ext)\n return;\n if (orig_uri.scheme == 'file' && active_doc.isDirty && !is_web_ext) {\n show_single_line_error(\"Unable to run RBQL: file has unsaved changes\");\n return;\n }\n let input_path = null;\n if (orig_uri.scheme == 'untitled' && !is_web_ext) {\n // Scheme 'untitled' means that the document is a scratch buffer that hasn't been saved yet, see https://code.visualstudio.com/api/references/document-selector\n let data = active_doc.getText();\n let rnd_suffix = String(Math.floor(Math.random() * 1000000));\n input_path = path.join(os.tmpdir(), `${scratch_buf_marker}_${rnd_suffix}.txt`);\n // TODO consider adding username to the input_path and using chmod 600 on it.\n fs.writeFileSync(input_path, data);\n } else {\n input_path = active_doc.fileName;\n }\n\n if (!input_path) {\n show_single_line_error(\"Unable to run RBQL for this file\");\n return;\n }\n let language_id = active_doc.languageId;\n let delim = 'monocolumn';\n let policy = 'monocolumn';\n if (dialect_map.hasOwnProperty(language_id)) {\n [delim, policy] = dialect_map[language_id];\n }\n let enable_rfc_newlines = get_from_global_state(make_rfc_policy_key(input_path), false);\n let with_headers_by_default = get_from_config('rbql_with_headers_by_default', false);\n let with_headers = get_from_global_state(make_with_headers_key(input_path), with_headers_by_default);\n let header = get_header_from_document(active_doc, delim, policy);\n rbql_context = {\n \"input_document\": active_doc,\n \"input_document_path\": input_path,\n \"requested_start_record\": 0,\n \"delim\": delim,\n \"policy\": policy,\n \"rfc_record_map\": [],\n \"enable_rfc_newlines\": enable_rfc_newlines,\n \"with_headers\": with_headers,\n \"header\": header\n };\n\n preview_panel = vscode.window.createWebviewPanel('rbql-console', 'RBQL Console', vscode.ViewColumn.Active, {enableScripts: true});\n if (!client_html_template) {\n if (is_web_ext) {\n client_html_template = client_html_template_web;\n } else {\n client_html_template = fs.readFileSync(absolute_path_map['rbql_client.html'], \"utf8\");\n }\n }\n let client_html = client_html_template;\n client_html = adjust_webview_paths(['contrib/textarea-caret-position/index.js', 'rbql_suggest.js', 'rbql_client.js', 'rbql_logo.svg'], client_html);\n preview_panel.webview.html = client_html;\n preview_panel.webview.onDidReceiveMessage(function(message) { handle_rbql_client_message(preview_panel.webview, message, integration_test_options); });\n}\n\n\nfunction get_num_columns_if_delimited(active_doc, delim, policy, min_num_columns, min_num_lines) {\n var num_lines = active_doc.lineCount;\n let num_fields = 0;\n let num_lines_checked = 0;\n let comment_prefix_for_autodetection = get_from_config('comment_prefix', '');\n if (!comment_prefix_for_autodetection)\n comment_prefix_for_autodetection = '#';\n for (var lnum = 0; lnum < num_lines; lnum++) {\n var line_text = active_doc.lineAt(lnum).text;\n if (lnum + 1 == num_lines && !line_text)\n break;\n if (line_text.startsWith(comment_prefix_for_autodetection))\n continue;\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning)\n return 0; // TODO don't fail on warnings?\n if (!num_fields)\n num_fields = fields.length;\n if (num_fields < min_num_columns || num_fields != fields.length)\n return 0;\n num_lines_checked += 1;\n }\n return num_lines_checked >= min_num_lines ? num_fields : 0;\n}\n\n\nfunction autodetect_dialect(active_doc, candidate_separators) {\n let min_num_lines = get_from_config('autodetection_min_line_count', 10);\n if (active_doc.lineCount < min_num_lines)\n return null;\n\n let best_dialect = null;\n let best_dialect_num_columns = 1;\n for (let i = 0; i < candidate_separators.length; i++) {\n let dialect_id = map_separator_to_language_id(candidate_separators[i]);\n if (!dialect_id)\n continue;\n let [delim, policy] = dialect_map[dialect_id];\n let cur_dialect_num_columns = get_num_columns_if_delimited(active_doc, delim, policy, best_dialect_num_columns + 1, min_num_lines);\n if (cur_dialect_num_columns > best_dialect_num_columns) {\n best_dialect_num_columns = cur_dialect_num_columns;\n best_dialect = dialect_id;\n }\n }\n return best_dialect;\n}\n\n\nfunction autodetect_dialect_frequency_based(active_doc, candidate_separators) {\n let best_dialect = 'csv';\n let best_dialect_frequency = 0;\n let data = active_doc.getText();\n if (!data)\n return best_dialect;\n for (let i = 0; i < candidate_separators.length; i++) {\n if (candidate_separators[i] == ' ' || candidate_separators[i] == '.')\n continue; // Whitespace and dot have advantage over other separators in this algorithm, so we just skip them.\n let dialect_id = map_separator_to_language_id(candidate_separators[i]);\n let frequency = 0;\n for (let j = 0; j < 10000 && j < data.length; j++) {\n if (data[j] == candidate_separators[i])\n frequency += 1;\n }\n if (frequency > best_dialect_frequency) {\n best_dialect = dialect_id;\n best_dialect_frequency = frequency;\n }\n }\n return best_dialect;\n}\n\n\nasync function autoenable_rainbow_csv(active_doc) {\n if (!active_doc)\n return;\n if (!get_from_config('enable_separator_autodetection', false))\n return;\n let candidate_separators = get_from_config('autodetect_separators', []);\n var original_language_id = active_doc.languageId;\n var file_path = active_doc.fileName;\n if (!file_path || autodetection_stoplist.has(file_path)) {\n return;\n }\n let is_default_csv = file_path.endsWith('.csv') && original_language_id == 'csv';\n if (original_language_id != 'plaintext' && !is_default_csv)\n return;\n let rainbow_csv_language_id = autodetect_dialect(active_doc, candidate_separators);\n if (!rainbow_csv_language_id && is_default_csv) {\n // Smart autodetection method has failed, but we need to choose a separator because this is a csv file. Let's just find the most popular one.\n rainbow_csv_language_id = autodetect_dialect_frequency_based(active_doc, candidate_separators);\n }\n if (!rainbow_csv_language_id || rainbow_csv_language_id == original_language_id)\n return;\n\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, rainbow_csv_language_id);\n original_language_ids.set(file_path, original_language_id);\n csv_lint(doc, false);\n refresh_status_bar_buttons(doc);\n}\n\n\nasync function handle_doc_edit(change_event) {\n if (!change_event)\n return;\n if (doc_edit_subscription) {\n doc_edit_subscription.dispose();\n doc_edit_subscription = null;\n }\n let active_doc = change_event.document;\n if (!active_doc)\n return;\n let candidate_separators = get_from_config('autodetect_separators', []);\n let rainbow_csv_language_id = autodetect_dialect(active_doc, candidate_separators);\n if (!rainbow_csv_language_id)\n return;\n let doc = await vscode.languages.setTextDocumentLanguage(active_doc, rainbow_csv_language_id);\n csv_lint(doc, false);\n refresh_status_bar_buttons(doc);\n}\n\n\nfunction register_csv_copy_paste(active_doc) {\n if (!get_from_config('enable_separator_autodetection', false))\n return;\n if (!active_doc || doc_edit_subscription)\n return;\n if (!active_doc.isUntitled && active_doc.lineCount != 0)\n return;\n doc_edit_subscription = vscode.workspace.onDidChangeTextDocument(handle_doc_edit);\n return;\n}\n\n\nfunction handle_editor_switch(editor) {\n let active_doc = get_active_doc(editor);\n csv_lint(active_doc, false);\n refresh_status_bar_buttons(active_doc);\n}\n\n\nasync function handle_doc_open(active_doc) {\n await autoenable_rainbow_csv(active_doc);\n register_csv_copy_paste(active_doc);\n csv_lint(active_doc, false);\n refresh_status_bar_buttons(active_doc);\n}\n\n\nfunction quote_field(field, delim) {\n if (field.indexOf('\"') != -1 || field.indexOf(delim) != -1) {\n return '\"' + field.replace(/\"/g, '\"\"') + '\"';\n }\n return field;\n}\n\n\nfunction quoted_join(fields, delim) {\n var quoted_fields = fields.map(function(val) { return quote_field(val, delim); });\n return quoted_fields.join(delim);\n}\n\n\nasync function make_preview(uri, preview_mode) {\n if (is_web_ext) {\n show_single_line_error('This command is currently unavailable in web mode.');\n return;\n }\n var file_path = uri.fsPath;\n if (!file_path || !fs.existsSync(file_path)) {\n vscode.window.showErrorMessage('Invalid file');\n return;\n }\n\n var size_limit = 1024000; // ~1MB\n var file_size_in_bytes = fs.statSync(file_path)['size'];\n if (file_size_in_bytes <= size_limit) {\n vscode.window.showWarningMessage('Rainbow CSV: The file is not big enough, showing the full file instead. Use this preview for files larger than 1MB');\n let full_orig_doc = await vscode.workspace.openTextDocument(file_path);\n await vscode.window.showTextDocument(full_orig_doc);\n return;\n }\n\n let file_basename = path.basename(file_path);\n const out_path = path.join(os.tmpdir(), `.rb_csv_preview.${preview_mode}.${file_basename}`);\n\n fs.open(file_path, 'r', (err, fd) => {\n if (err) {\n console.log(err.message);\n vscode.window.showErrorMessage('Unable to preview file');\n return;\n }\n\n var buffer = Buffer.alloc(size_limit);\n let read_begin_pos = preview_mode == 'head' ? 0 : Math.max(file_size_in_bytes - size_limit, 0);\n fs.read(fd, buffer, 0, size_limit, read_begin_pos, function(err, _num) {\n if (err) {\n console.log(err.message);\n vscode.window.showErrorMessage('Unable to preview file');\n return;\n }\n\n const buffer_str = buffer.toString();\n // TODO handle old mac '\\r' line endings - still used by Mac version of Excel.\n let content = null;\n if (preview_mode == 'head') {\n content = buffer_str.substr(0, buffer_str.lastIndexOf(buffer_str.includes('\\r\\n') ? '\\r\\n' : '\\n'));\n } else {\n content = buffer_str.substr(buffer_str.indexOf('\\n') + 1);\n }\n fs.writeFileSync(out_path, content);\n vscode.workspace.openTextDocument(out_path).then(doc => vscode.window.showTextDocument(doc));\n });\n });\n}\n\n\nfunction register_csv_hover_info_provider(language_id, context) {\n let hover_provider = vscode.languages.registerHoverProvider(language_id, {\n provideHover(document, position, token) {\n return make_hover(document, position, language_id, token);\n }\n });\n context.subscriptions.push(hover_provider);\n}\n\n\nasync function activate(context) {\n global_state = context.globalState;\n\n if (is_web_ext) {\n let rbql_client_uri = vscode.Uri.joinPath(context.extensionUri, 'rbql_client.html');\n let bytes = await vscode.workspace.fs.readFile(rbql_client_uri);\n // Using TextDecoder because it should work fine in web extension.\n client_html_template_web = new TextDecoder().decode(bytes);\n }\n\n for (let local_path in absolute_path_map) {\n if (absolute_path_map.hasOwnProperty(local_path)) {\n if (is_web_ext) {\n absolute_path_map[local_path] = vscode.Uri.joinPath(context.extensionUri, local_path);\n } else {\n absolute_path_map[local_path] = context.asAbsolutePath(local_path);\n }\n }\n }\n\n for (let language_id in dialect_map) {\n if (dialect_map.hasOwnProperty(language_id)) {\n register_csv_hover_info_provider(language_id, context);\n }\n }\n\n var lint_cmd = vscode.commands.registerCommand('rainbow-csv.CSVLint', csv_lint_cmd);\n var rbql_cmd = vscode.commands.registerCommand('rainbow-csv.RBQL', edit_rbql);\n var set_header_line_cmd = vscode.commands.registerCommand('rainbow-csv.SetHeaderLine', set_header_line);\n var edit_column_names_cmd = vscode.commands.registerCommand('rainbow-csv.SetVirtualHeader', set_virtual_header);\n var set_join_table_name_cmd = vscode.commands.registerCommand('rainbow-csv.SetJoinTableName', set_join_table_name); // WEB_DISABLED\n var column_edit_before_cmd = vscode.commands.registerCommand('rainbow-csv.ColumnEditBefore', async function() { await column_edit('ce_before'); });\n var column_edit_after_cmd = vscode.commands.registerCommand('rainbow-csv.ColumnEditAfter', async function() { await column_edit('ce_after'); });\n var column_edit_select_cmd = vscode.commands.registerCommand('rainbow-csv.ColumnEditSelect', async function() { await column_edit('ce_select'); });\n var set_separator_cmd = vscode.commands.registerCommand('rainbow-csv.RainbowSeparator', set_rainbow_separator);\n var rainbow_off_cmd = vscode.commands.registerCommand('rainbow-csv.RainbowSeparatorOff', restore_original_language);\n var sample_head_cmd = vscode.commands.registerCommand('rainbow-csv.SampleHead', async function(uri) { await make_preview(uri, 'head'); }); // WEB_DISABLED\n var sample_tail_cmd = vscode.commands.registerCommand('rainbow-csv.SampleTail', async function(uri) { await make_preview(uri, 'tail'); }); // WEB_DISABLED\n var align_cmd = vscode.commands.registerCommand('rainbow-csv.Align', align_table);\n var shrink_cmd = vscode.commands.registerCommand('rainbow-csv.Shrink', shrink_table);\n var copy_back_cmd = vscode.commands.registerCommand('rainbow-csv.CopyBack', copy_back); // WEB_DISABLED\n var internal_test_cmd = vscode.commands.registerCommand('rainbow-csv.InternalTest', run_internal_test_cmd);\n\n var doc_open_event = vscode.workspace.onDidOpenTextDocument(handle_doc_open);\n var switch_event = vscode.window.onDidChangeActiveTextEditor(handle_editor_switch);\n\n context.subscriptions.push(lint_cmd);\n context.subscriptions.push(rbql_cmd);\n context.subscriptions.push(edit_column_names_cmd);\n context.subscriptions.push(column_edit_before_cmd);\n context.subscriptions.push(column_edit_after_cmd);\n context.subscriptions.push(column_edit_select_cmd);\n context.subscriptions.push(doc_open_event);\n context.subscriptions.push(switch_event);\n context.subscriptions.push(set_separator_cmd);\n context.subscriptions.push(rainbow_off_cmd);\n context.subscriptions.push(sample_head_cmd);\n context.subscriptions.push(sample_tail_cmd);\n context.subscriptions.push(set_join_table_name_cmd);\n context.subscriptions.push(align_cmd);\n context.subscriptions.push(shrink_cmd);\n context.subscriptions.push(copy_back_cmd);\n context.subscriptions.push(set_header_line_cmd);\n context.subscriptions.push(internal_test_cmd);\n\n // Need this because \"onDidOpenTextDocument()\" doesn't get called for the first open document.\n // Another issue is when dev debug logging mode is enabled, the first document would be \"Log\" because it is printing something and gets VSCode focus.\n await sleep(1000);\n let active_doc = get_active_doc();\n handle_doc_open(active_doc);\n}\n\n\nfunction deactivate() {\n // This method is called when extension is deactivated.\n}\n\n\nexports.activate = activate;\nexports.deactivate = deactivate;\n"],"names":["GetIntrinsic","callBind","$indexOf","module","exports","name","allowMissing","intrinsic","bind","$apply","$call","$reflectApply","call","$gOPD","$defineProperty","$max","value","e","originalFunction","func","arguments","desc","configurable","length","applyBind","apply","hasOwn","Object","prototype","hasOwnProperty","toString","obj","fn","ctx","TypeError","l","i","k","ERROR_MESSAGE","slice","Array","toStr","funcType","that","target","this","bound","args","binder","result","concat","boundLength","Math","max","boundArgs","push","Function","join","Empty","implementation","undefined","$SyntaxError","SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","getOwnPropertyDescriptor","throwTypeError","ThrowTypeError","calleeThrows","get","gOPDthrows","hasSymbols","getProto","getPrototypeOf","x","__proto__","needsEval","TypedArray","Uint8Array","INTRINSICS","AggregateError","ArrayBuffer","Symbol","iterator","Atomics","BigInt","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","Error","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","isFinite","isNaN","JSON","Map","Number","parseFloat","parseInt","Promise","Proxy","RangeError","ReferenceError","Reflect","RegExp","Set","SharedArrayBuffer","String","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","doEval","gen","LEGACY_ALIASES","$concat","$spliceApply","splice","$replace","replace","$strSlice","rePropName","reEscapeChar","stringToPath","string","first","last","match","number","quote","subString","getBaseIntrinsic","alias","intrinsicName","parts","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","part","origSymbol","hasSymbolSham","getOwnPropertySymbols","sym","symObj","keys","getOwnPropertyNames","syms","propertyIsEnumerable","descriptor","enumerable","toStringTag","create","ctor","superCtor","super_","constructor","writable","TempCtor","hasToStringTag","$toString","callBound","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","GeneratorFunction","fnToStr","isFnRegex","test","generatorFunc","getGeneratorFunc","forEach","availableTypedArrays","g","globalThis","typedArrays","array","$slice","toStrTags","gOPD","typedArray","arr","proto","superProto","tag","anyTrue","getter","tryTypedArrays","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","len","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","arg","copy","fill","readUInt8","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","uncurryThis","f","BigIntSupported","SymbolSupported","ObjectToString","numberValue","valueOf","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isPromise","input","then","catch","isArrayBufferView","isView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isFloat32Array","isFloat64Array","isBigInt64Array","isBigUint64Array","isMap","isSet","isWeakMap","isWeakSet","SharedArrayBufferCopy","isSharedArrayBufferToString","isSharedArrayBuffer","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","isBoxedPrimitive","isAnyArrayBuffer","method","defineProperty","getOwnPropertyDescriptors","descriptors","formatRegExp","format","isString","objects","inspect","str","stringify","_","isNull","isObject","deprecate","msg","noDeprecation","warned","throwDeprecation","traceDeprecation","console","trace","error","debugs","debugEnvRegex","NODE_DEBUG","debugEnv","toUpperCase","opts","seen","stylize","stylizeNoColor","depth","colors","isBoolean","showHidden","_extend","isUndefined","customInspect","stylizeWithColor","formatValue","styleType","style","styles","recurseTimes","isFunction","ret","primitive","simple","isNumber","formatPrimitive","visibleKeys","hash","val","idx","arrayToHash","isError","indexOf","formatError","isRegExp","isDate","output","base","braces","isArray","toUTCString","formatProperty","key","formatArray","map","pop","reduce","prev","cur","reduceToSingleString","set","split","line","substr","ar","re","objectToString","d","o","pad","n","debuglog","pid","types","isNullOrUndefined","isSymbol","isNativeError","isPrimitive","isBuffer","months","timestamp","time","getHours","getMinutes","getSeconds","getDate","getMonth","prop","log","inherits","origin","add","kCustomPromisifiedSymbol","callbackifyOnRejected","reason","cb","newReason","promisify","original","promiseResolve","promiseReject","promise","resolve","reject","err","setPrototypeOf","defineProperties","custom","callbackify","callbackified","maybeCb","self","rej","foundName","os","fs","path","rbql","rbql_csv","csv_utils","number_regex","AssertionError","update_subcomponent_stats","field","is_first_line","max_field_components_lens","match_result","exec","cur_integer_part_length","cur_fractional_part_length","align_field","is_last_column","trim","delta_length","repeat","dot_pos","integer_delta_length","fractional_delta_length","trailing_spaces","make_table_name_key","file_path","find_table_path","vscode_global_state","main_table_dir","table_id","filepath","candidate_path","charAt","homedir","existsSync","isAbsolute","table_path","get_header_line","document","comment_prefix","num_lines","lineCount","lnum","line_text","lineAt","text","startsWith","RbqlIOHandlingError","VSCodeRecordIterator","RBQLInputIterator","delim","policy","has_header","table_name","variable_prefix","super","NR","NL","fields_info","first_defective_line","first_record","get_first_record","stop","header_line","smart_split","async","query_text","variable_map","parse_basic_variables","parse_array_variables","parse_attribute_variables","parse_dictionary_variables","get_line_rfc","rfc_line_buffer","record_line","accumulate_rfc_line_into_record","get_line_simple","do_get_record","record","warning","num_fields","get_warnings","inconsistent_records_info","entries","record_id","sort","a","b","condition","message","assert","record_1","num_fields_1","record_2","num_fields_2","warn_msg","make_inconsistent_num_fields_warning","VSCodeWriter","RBQLOutputWriter","header_len","null_in_output","delim_in_simple_output","output_lines","polymorphic_join","simple_join","quoted_join","quoted_join_rfc","mono_join","set_header","header","write","fields","v","quote_field","rfc_quote_field","res","normalize_fields","out_fields","sub_array_delim","VSCodeTableRegistry","get_iterator_by_table_id","_table_id","VSCodeFileSystemCSVRegistry","RBQLTableRegistry","input_file_dir","encoding","options","stream","record_iterator","bulk_input_path","createReadStream","CSVRecordIterator","output_warnings","basename","read_header","input_reader","createInterface","closed","promise_resolve","promise_reject","output_promise","close","rbql_query_web","input_document","input_delim","input_policy","output_delim","output_policy","with_headers","join_tables_registry","input_iterator","output_writer","query","rbql_query_node","input_path","output_path","csv_encoding","user_init_code","input_stream","stdin","output_stream","close_output_on_finish","stdout","createWriteStream","is_ascii","default_init_source_path","read_user_init_code","dirname","CSVWriter","populate_optimistic_rfc_csv_record_map","requested_end_record","dst_record_map","record_begin","match_list","has_unbalanced_double_quote","get_default_js_udf_content","get_default_python_udf_content","align_columns","active_doc","column_stats","result_lines","has_edit","fnum","adjusted","shrink_columns","calc_column_stats","adjust_column_stats","adjusted_stats","column_stat","field_rgx","field_rgx_external_whitespaces","extract_next_field","src","dlm","preserve_quotes_and_whitespaces","allow_external_whitespaces","cidx","src_cur","substring","match_obj","match_end","uidx","split_quoted_str","extraction_report","unquote_field","split_whitespace_separated_str","preserve_whitespaces","rgxp","unquote_fields","split_lines","external_rfc_line_buffer","current_line","multiline_row","RbqlParsingError","RbqlRuntimeError","InternalBadFieldError","bad_idx","params","replace_all","search","replacement","RBQLContext","writer","unnest_list","top_count","like_regex_cache","sort_key_expression","aggregation_stage","aggregation_key_expression","functional_aggregators","join_map_impl","join_map","lhs_join_var_expression","where_expression","select_expression","update_expressions","variables_init_code","query_context","wrong_aggregation_usage_error","RBQL_VERSION","check_if_brackets_match","opening_bracket","closing_bracket","parse_root_bracket_level_text_spans","text_spans","last_pos","bracket_stack","cur_char","span","unquote_string","quoted_str","column_info_from_text_span","text_span","string_literals","rbql_star_marker","simple_var_match","attribute_match","subscript_int_match","subscript_str_match","column_index","column_name","is_star","replaced_string_literal_id","unquoted_column_name","adhoc_parse_select_expression_to_column_infos","ts","stable_compare","safe_get","safe_join_get","safe_set","regexp_escape","like_to_regex","pattern","p","converted","like","matcher","LIKE","RBQLAggregationToken","marker_id","UnnestMarker","UNNEST","vals","unnest","Unnest","UNFOLD","parse_number","MinAggregator","stats","increment","cur_aggr","min","get_final","MaxAggregator","SumAggregator","AvgAggregator","cur_sum","cur_cnt","VarianceAggregator","cur_sum_sq","avg_val","MedianAggregator","m","floor","CountAggregator","ArrayAggAggregator","post_proc","ConstGroupVerifier","output_index","const_values","old_value","init_aggregator","generator_name","MIN","Min","MAX","Max","COUNT","count","Count","SUM","sum","Sum","AVG","avg","Avg","VARIANCE","variance","Variance","MEDIAN","median","Median","ARRAY_AGG","array_agg","FOLD","add_to_set","dst_set","len_before","size","TopWriter","subwriter","NW","finish","UniqWriter","UniqCountWriter","records","old_val","unshift","SortedWriter","reverse_sort","unsorted_entries","stable_entry","reverse","entry","AggregateWriter","aggregators","aggregation_keys","all_keys","from","ag","InnerJoiner","get_rhs","lhs_key","get_join_records","LeftJoiner","null_record","max_record_len","StrictLeftJoiner","select_except","except_fields","select_simple","sort_key","sort_entry","select_aggregated","transparent_values","num_aggregators_found","trans_value","select_unnested","folded_fields","unnest_pos","findIndex","PROCESS_SELECT_COMMON","PROCESS_SELECT_SIMPLE","PROCESS_SELECT_JOIN","PROCESS_UPDATE_JOIN","PROCESS_UPDATE_SIMPLE","MAIN_LOOP_BODY","embed_expression","parent_code","child_placeholder","child_expression","embed_code","child_code","parent_lines","child_lines","pos","placeholder_indentation","generate_main_loop_code","is_select_query","is_join_query","js_code","compile_and_run","main_loop_body","main_loop_promise","lower_case_query","toLowerCase","GROUP_BY","UPDATE","SELECT","JOIN","INNER_JOIN","LEFT_JOIN","LEFT_OUTER_JOIN","STRICT_LEFT_JOIN","ORDER_BY","WHERE","LIMIT","EXCEPT","WITH","get_ambiguous_error_msg","variable_name","get_all_matches","regexp","str_strip","strip_comments","cline","combine_string_literals","backend_expression","prefix","dst_variables_map","matches","field_num","initialize","index","js_string_escape_column_name","quote_char","query_probably_has_dictionary_variable","continuous_name_segments","continuous_segment","column_names","dict_test_rgx","escaped_column_name","column_names_source","column_names_from_query","zero_based_idx","map_variables_directly","ensure_no_ambiguous_variables","input_column_names","join_column_names","join_column_names_set","has","parse_join_expression","invalid_join_syntax_error","variable_pairs","pair_rgx","and_rgx","resolve_join_variables","input_variables_map","join_variables_map","lhs_variables","rhs_indices","valid_join_syntax_msg","variable_pair","join_var_1","join_var_2","lhs_key_index","rhs_key_index","generate_common_init_code","base_var","attr_var","generate_init_statements","variables_map","indent","code_lines","simple_var_name_rgx","var_info","variable_declaration_keyword","replace_star_count","aggregate_expression","replace_star_vars","rbql_expression","replacement_expression","replace_star_vars_for_header_parsing","translate_update_expression","update_expression","first_assignment_error","assignment_looking_rgx","dst_var_name","var_index","current_indent","translate_select_expression","expression_without_stars","translated","translated_for_header","separate_string_literals","rgx","format_parts","idx_before","literal_id","string_literal","start_index","lastIndex","format_expression","locate_statements","statement_groups","ig","is","statement","match_str","separate_actions","with_match","ordered_statements","statement_start","span_start","span_end","statement_params","new_span","find_top","rb_actions","select_action","translate_except_expression","except_expression","input_header","skip_vars","skip_indices","var_name","HashJoinMap","key_indices","hash_map","nr","key_index","polymorphic_get_key","get_single_key","get_multi_key","ki","get_record","nf","key_records","cleanup_query","filter","remove_redundant_table_name","select_output_header","join_header","query_column_infos","output_header","qci","handle_query_modifier","TableIterator","table","normalize_column_names","stopped","TableWriter","external_table","SingleTableRegistry","shallow_parse_input_query","get_variables_map","rhs_table_id","join_record_iterator","get_header","sql_join_type","build","select_expression_for_ast","query_table","input_table","output_table","join_table","output_column_names","exception_to_error_info","exceptions_type_map","error_type","util","utf_decoding_error","rbql_init_source_path","readFileSync","name_record","index_path","content","lines","try_read_index","get_index_record","RecordQueue","push_stack","pull_stack","enqueue","dequeue","csv_path","first_record_should_be_emitted","header_preread_complete","decoder","TextDecoder","fatal","input_exhausted","started","utf8_bom_removed","partially_decoded_line","partially_decoded_line_ends_with_cr","resolve_current_record","reject_current_record","current_exception","produced_records_queue","process_line_polymorphic","process_partial_rfc_record_line","process_record_line","modifier","reset_external_callbacks","try_propagate_exception","exception","store_or_propagate_exception","pause","preread_first_record","try_resolve_next_record","start","isPaused","resume","parent_iterator","current_record_promise","num_records","process_line","clean_line","assumed_source_encoding","charCodeAt","remove_utf8_bom","process_data_stream_chunk","data_chunk","decoded_string","decode","first_line_index","process_data_bulk","control_buffer","Buffer","compare","process_data_stream_end","last_line","destroy","readFile","close_stream_on_finish","line_separator","setDefaultEncoding","error_obj","store_first_error","first_error","writer_error","_write_all","output_encoding","end","FileSystemCSVRegistry","interpret_named_csv_format","format_name","query_csv","require","possibleNames","out","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","window","vscode","child_process","rainbow_utils","ll_rainbow_utils","is_web_ext","preview_window_size","scratch_buf_marker","client_html_template_web","lint_results","aligned_files","autodetection_stoplist","original_language_ids","result_set_parent_map","lint_status_bar_button","rbql_status_bar_button","align_shrink_button","rainbow_off_status_bar_button","copy_back_button","last_statusbar_doc","rbql_context","last_rbql_queries","client_html_template","global_state","preview_panel","doc_edit_subscription","_unit_test_last_rbql_report","_unit_test_last_warnings","dialect_map","absolute_path_map","show_single_line_error","error_msg","active_window","showErrorMessage","sleep","ms","push_current_stack_to_js_callback_queue_to_allow_ui_update","map_separator_to_language_id","separator","language_id","get_from_global_state","default_value","save_to_global_state","update","get_rfc_record_text","record_start","record_end","replace_doc_content","active_editor","new_content","invalid_range","Range","full_range","validateRange","edit","sample_preview_records_from_context","dst_message","requested_start_record","preview_records","enable_rfc_newlines","rfc_record_map","record_text","cur_record","preview_sampling_error","r","c","start_record_zero_based","make_header_key","make_rfc_policy_key","make_with_headers_key","get_from_config","param_name","config","workspace","getConfiguration","get_header_from_document","fileName","raw_header","parse","get_field_by_line_position","query_pos","col_num","cpos","get_active_editor","activeTextEditor","get_active_doc","hide_status_bar_buttons","all_buttons","hide","refresh_status_bar_buttons","endsWith","languageId","lint_cache_key","lint_report","createStatusBarItem","StatusBarAlignment","Left","color","tooltip","command","show","show_lint_status_bar_button","show_align_shrink_button","parent_table_path","parent_basename","show_rbql_copy_to_source_button","csv_lint","is_manual_op","detect_trailing_spaces","first_trailing_space_line","split_result","produce_lint_report","csv_lint_cmd","run_internal_test_cmd","integration_test_options","check_initialization_state","initialized","lazy_loaded","check_last_rbql_report","check_last_rbql_warnings","handle_rbql_result_file","text_doc","warnings","showTextDocument","languages","setTextDocumentLanguage","showWarningMessage","show_warnings","run_command","cmd","close_and_error_guard","callback_func","spawn","stderr","data","code","handle_command_result","src_table_path","dst_table_path","error_code","webview_report_handler","json_report","report","doc","openTextDocument","file_path_to_query_key","get_dialect","set_header_line","dialect","selection","set_rainbow_separator","original_language_id","character","restore_original_language","delete","set_join_table_name","showInputBox","set_virtual_header","old_header_str","input_box_props","raw_new_header","new_header","column_edit","edit_mode","position","active","cnum","quoting_warning","selections","char_pos_before","char_pos_after","position_before","Position","position_after","Selection","shrink_table","progress_options","location","ProgressLocation","Window","withProgress","progress","shrinked_doc_text","first_failed_line","align_table","aligned_doc_text","copy_back","result_doc","parent_doc","parent_editor","query_result_doc","getText","do_copy_back","handle_rbql_client_message","webview","message_type","report_msg","postMessage","init_msg","path_key","input_document_path","history_list","rbql_backend","rbql_query","input_table_dir","protocol_message","navig_direction","backend_language","output_dialect","old_index","update_query_history","input_table_path","rbql_output_dir","tmpdir","get_dst_table_dir","orig_extension","extname","delim_ext_map","dst_extension","result_table_name","get_dst_table_name","output_doc_cfg","language","csv_options","cmd_safe_query","run_rbql_query","udf_file_path","default_content","writeFileSync","udf_doc","edit_rbql","orig_uri","uri","scheme","isDirty","rnd_suffix","random","with_headers_by_default","createWebviewPanel","ViewColumn","Active","enableScripts","client_html","paths_list","local_path","adjusted_webview_url","asWebviewUri","Uri","file","adjust_webview_paths","html","onDidReceiveMessage","get_num_columns_if_delimited","min_num_columns","min_num_lines","num_lines_checked","comment_prefix_for_autodetection","autodetect_dialect","candidate_separators","best_dialect","best_dialect_num_columns","dialect_id","cur_dialect_num_columns","handle_doc_edit","change_event","dispose","rainbow_csv_language_id","handle_editor_switch","editor","handle_doc_open","is_default_csv","best_dialect_frequency","frequency","j","autodetect_dialect_frequency_based","autoenable_rainbow_csv","isUntitled","onDidChangeTextDocument","register_csv_copy_paste","make_preview","preview_mode","fsPath","size_limit","file_size_in_bytes","statSync","full_orig_doc","file_basename","out_path","open","fd","buffer","alloc","read_begin_pos","read","_num","buffer_str","lastIndexOf","includes","register_csv_hover_info_provider","context","hover_provider","registerHoverProvider","provideHover","token","cancellation_token","hover_text","enable_tooltip_column_names","enable_tooltip_warnings","max_label_len","column_label","short_column_label","make_hover_text","isCancellationRequested","mds","MarkdownString","appendCodeblock","Hover","make_hover","subscriptions","activate","globalState","rbql_client_uri","joinPath","extensionUri","bytes","asAbsolutePath","lint_cmd","commands","registerCommand","rbql_cmd","set_header_line_cmd","edit_column_names_cmd","set_join_table_name_cmd","column_edit_before_cmd","column_edit_after_cmd","column_edit_select_cmd","set_separator_cmd","rainbow_off_cmd","sample_head_cmd","sample_tail_cmd","align_cmd","shrink_cmd","copy_back_cmd","internal_test_cmd","doc_open_event","onDidOpenTextDocument","switch_event","onDidChangeActiveTextEditor","deactivate"],"sourceRoot":""} \ No newline at end of file diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/test/suite/index.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/test/suite/index.js new file mode 100644 index 00000000..591ae1f0 --- /dev/null +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/test/suite/index.js @@ -0,0 +1,2 @@ +/*! For license information please see index.js.LICENSE.txt */ +(()=>{var __webpack_modules__={9282:(e,t,r)=>{"use strict";var n=r(4155);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,a,s=r(2136).codes,l=s.ERR_AMBIGUOUS_ARGUMENT,c=s.ERR_INVALID_ARG_TYPE,u=s.ERR_INVALID_ARG_VALUE,p=s.ERR_INVALID_RETURN_VALUE,_=s.ERR_MISSING_ARGS,f=r(5961),h=r(9539).inspect,d=r(9539).types,g=d.isPromise,y=d.isRegExp,m=Object.assign?Object.assign:r(8091).assign,b=Object.is?Object.is:r(609);function w(){var e=r(9158);o=e.isDeepEqual,a=e.isDeepStrictEqual}new Map;var x=!1,v=e.exports=S,E={};function O(e){if(e.message instanceof Error)throw e.message;throw new f(e)}function j(e,t,r,n){if(!r){var i=!1;if(0===t)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new f({actual:r,expected:!0,message:n,operator:"==",stackStartFn:e});throw o.generatedMessage=i,o}}function S(){for(var e=arguments.length,t=new Array(e),r=0;r1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i{"use strict";var n=r(4155);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;re.length)&&(r=e.length),e.substring(r-t.length,r)===t}var y="",m="",b="",w="",x={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 v(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){r[t]=e[t]})),Object.defineProperty(r,"message",{value:e.message}),r}function E(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){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),"object"!==f(e)||null===e)throw new d("options","Object",e);var i=e.message,o=e.operator,l=e.stackStartFn,c=e.actual,u=e.expected,p=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=a(this,_(t).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(y="",m="",w="",b=""):(y="",m="",w="",b="")),"object"===f(c)&&null!==c&&"object"===f(u)&&null!==u&&"stack"in c&&c instanceof Error&&"stack"in u&&u instanceof Error&&(c=v(c),u=v(u)),"deepStrictEqual"===o||"strictEqual"===o)r=a(this,_(t).call(this,function(e,t,r){var i="",o="",a=0,s="",l=!1,c=E(e),u=c.split("\n"),p=E(t).split("\n"),_=0,h="";if("strictEqual"===r&&"object"===f(e)&&"object"===f(t)&&null!==e&&null!==t&&(r="strictEqualObject"),1===u.length&&1===p.length&&u[0]!==p[0]){var d=u[0].length+p[0].length;if(d<=10){if(!("object"===f(e)&&null!==e||"object"===f(t)&&null!==t||0===e&&0===t))return"".concat(x[r],"\n\n")+"".concat(u[0]," !== ").concat(p[0],"\n")}else if("strictEqualObject"!==r&&d<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;u[0][_]===p[0][_];)_++;_>2&&(h="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,r-e.length)}(" ",_),"^"),_=0)}}for(var v=u[u.length-1],O=p[p.length-1];v===O&&(_++<2?s="\n ".concat(v).concat(s):i=v,u.pop(),p.pop(),0!==u.length&&0!==p.length);)v=u[u.length-1],O=p[p.length-1];var j=Math.max(u.length,p.length);if(0===j){var S=c.split("\n");if(S.length>30)for(S[26]="".concat(y,"...").concat(w);S.length>27;)S.pop();return"".concat(x.notIdentical,"\n\n").concat(S.join("\n"),"\n")}_>3&&(s="\n".concat(y,"...").concat(w).concat(s),l=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var R=0,A=x[r]+"\n".concat(m,"+ actual").concat(w," ").concat(b,"- expected").concat(w),q=" ".concat(y,"...").concat(w," Lines skipped");for(_=0;_1&&_>2&&(T>4?(o+="\n".concat(y,"...").concat(w),l=!0):T>3&&(o+="\n ".concat(p[_-2]),R++),o+="\n ".concat(p[_-1]),R++),a=_,i+="\n".concat(b,"-").concat(w," ").concat(p[_]),R++;else if(p.length<_+1)T>1&&_>2&&(T>4?(o+="\n".concat(y,"...").concat(w),l=!0):T>3&&(o+="\n ".concat(u[_-2]),R++),o+="\n ".concat(u[_-1]),R++),a=_,o+="\n".concat(m,"+").concat(w," ").concat(u[_]),R++;else{var k=p[_],P=u[_],I=P!==k&&(!g(P,",")||P.slice(0,-1)!==k);I&&g(k,",")&&k.slice(0,-1)===P&&(I=!1,P+=","),I?(T>1&&_>2&&(T>4?(o+="\n".concat(y,"...").concat(w),l=!0):T>3&&(o+="\n ".concat(u[_-2]),R++),o+="\n ".concat(u[_-1]),R++),a=_,o+="\n".concat(m,"+").concat(w," ").concat(P),i+="\n".concat(b,"-").concat(w," ").concat(k),R+=2):(o+=i,i="",1!==T&&0!==_||(o+="\n ".concat(P),R++))}if(R>20&&_30)for(O[26]="".concat(y,"...").concat(w);O.length>27;)O.pop();r=1===O.length?a(this,_(t).call(this,"".concat(h," ").concat(O[0]))):a(this,_(t).call(this,"".concat(h,"\n\n").concat(O.join("\n"),"\n")))}else{var j=E(c),S="",R=x[o];"notDeepEqual"===o||"notEqual"===o?(j="".concat(x[o],"\n\n").concat(j)).length>1024&&(j="".concat(j.slice(0,1021),"...")):(S="".concat(E(u)),j.length>512&&(j="".concat(j.slice(0,509),"...")),S.length>512&&(S="".concat(S.slice(0,509),"...")),"deepEqual"===o||"equal"===o?j="".concat(R,"\n\n").concat(j,"\n\nshould equal\n\n"):S=" ".concat(o," ").concat(S)),r=a(this,_(t).call(this,"".concat(j).concat(S)))}return Error.stackTraceLimit=p,r.generatedMessage=!i,Object.defineProperty(s(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=c,r.expected=u,r.operator=o,Error.captureStackTrace&&Error.captureStackTrace(s(r),l),r.stack,r.name="AssertionError",a(r)}var r,l;return 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}}),t&&p(e,t)}(t,e),r=t,l=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:h.custom,value:function(e,t){return h(this,function(e){for(var t=1;t{"use strict";function n(e){return n="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},n(e)}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}var a,s,l={};function c(e,t,r){r||(r=Error);var a=function(r){function a(r,o,s){var l,c,u;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),c=this,u=i(a).call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,o,s)),l=!u||"object"!==n(u)&&"function"!=typeof u?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(c):u,l.code=e,l}return 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}}),t&&o(e,t)}(a,r),a}(r);l[e]=a}function u(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"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,i){var o,s,l,c,p;if(void 0===a&&(a=r(9282)),a("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(s="not ",t.substr(0,s.length)===s)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))l="The ".concat(e," ").concat(o," ").concat(u(t,"type"));else{var _=("number"!=typeof p&&(p=0),p+".".length>(c=e).length||-1===c.indexOf(".",p)?"argument":"property");l='The "'.concat(e,'" ').concat(_," ").concat(o," ").concat(u(t,"type"))}return l+". Received type ".concat(n(i))}),TypeError),c("ERR_INVALID_ARG_VALUE",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=r(9539));var i=s.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),c("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")}),TypeError),c("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),n=0;n0,"At least one arg needs to be specified");var i="The ",o=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),o){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,o-1).join(", "),i+=", and ".concat(t[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),e.exports.codes=l},9158:(e,t,r)=>{"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}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,a=function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t},s=function(e){var t=[];return e.forEach((function(e,r){return t.push([r,e])})),t},l=Object.is?Object.is:r(609),c=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},u=Number.isNaN?Number.isNaN:r(360);function p(e){return e.call.bind(e)}var _=p(Object.prototype.hasOwnProperty),f=p(Object.prototype.propertyIsEnumerable),h=p(Object.prototype.toString),d=r(9539).types,g=d.isAnyArrayBuffer,y=d.isArrayBufferView,m=d.isDate,b=d.isMap,w=d.isRegExp,x=d.isSet,v=d.isNativeError,E=d.isBoxedPrimitive,O=d.isNumberObject,j=d.isStringObject,S=d.isBooleanObject,R=d.isBigIntObject,A=d.isSymbolObject,q=d.isFloat32Array,T=d.isFloat64Array;function k(e){if(0===e.length||e.length>10)return!0;for(var t=0;t57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function P(e){return Object.keys(e).filter(k).concat(c(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function I(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i{"use strict";var n=r(210),i=r(5559),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},5559:(e,t,r)=>{"use strict";var n=r(8612),i=r(210),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||n.call(a,o),l=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),u=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var t=s(n,a,arguments);if(l&&c){var r=l(t,"length");r.configurable&&c(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return s(n,o,arguments)};c?c(e.exports,"apply",{value:p}):e.exports.apply=p},4289:(e,t,r)=>{"use strict";var n=r(2215),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=r(1044)(),c=s&&l,u=function(e,t,r,n){var i;(!(t in e)||"function"==typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(c?s(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},p=function(e,t){var r=arguments.length>2?arguments[2]:{},o=n(t);i&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";function t(e,t){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var r=Object(e),n=1;n{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,n,i){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var a=0;a{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,i="[object Function]";e.exports=function(e){var o=this;if("function"!=typeof o||n.call(o)!==i)throw new TypeError(t+o);for(var a,s=r.call(arguments,1),l=function(){if(this instanceof a){var t=o.apply(this,s.concat(r.call(arguments)));return Object(t)===t?t:this}return o.apply(e,s.concat(r.call(arguments)))},c=Math.max(0,o.length-s.length),u=[],p=0;p{"use strict";var n=r(7648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,i=SyntaxError,o=Function,a=TypeError,s=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch(e){l=null}var c=function(){throw new a},u=l?function(){try{return c}catch(e){try{return l(arguments,"callee").get}catch(e){return c}}}():c,p=r(1405)(),_=Object.getPrototypeOf||function(e){return e.__proto__},f={},h="undefined"==typeof Uint8Array?n:_(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?_([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?_(_([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?_((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?_((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?_(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":u,"%TypedArray%":h,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=s("async function () {}");else if("%GeneratorFunction%"===t)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=s("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(r=_(i.prototype))}return d[t]=r,r},y={"%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"]},m=r(8612),b=r(7642),w=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),v=m.call(Function.call,String.prototype.replace),E=m.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,j=/\\(\\)?/g,S=function(e){var t=E(e,0,1),r=E(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return v(e,O,(function(e,t,r,i){n[n.length]=r?v(i,j,"$1"):t||e})),n},R=function(e,t){var r,n=e;if(b(y,n)&&(n="%"+(r=y[n])[0]+"%"),b(d,n)){var o=d[n];if(o===f&&(o=g(n)),void 0===o&&!t)throw new a("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');var r=S(e),n=r.length>0?r[0]:"",o=R("%"+n+"%",t),s=o.name,c=o.value,u=!1,p=o.alias;p&&(n=p[0],x(r,w([0,1],p)));for(var _=1,f=!0;_=r.length){var m=l(c,h);c=(f=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:c[h]}else f=b(c,h),c=c[h];f&&!u&&(d[s]=c)}}return c}},1044:(e,t,r)=>{"use strict";var n=r(210)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},1405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(5419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},5419: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"),r=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(r))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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6410:(e,t,r)=>{"use strict";var n=r(5419);e.exports=function(){return n()&&!!Symbol.toStringTag}},7642:(e,t,r)=>{"use strict";var n=r(8612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},5717: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 r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},2584:(e,t,r)=>{"use strict";var n=r(6410)(),i=r(1924)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},8662:(e,t,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(6410)(),l=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(a.test(o.call(e)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(e);if(!l)return!1;if(void 0===n){var t=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&l(t)}return l(e)===n}},8611:e=>{"use strict";e.exports=function(e){return e!=e}},360:(e,t,r)=>{"use strict";var n=r(5559),i=r(4289),o=r(8611),a=r(9415),s=r(3194),l=n(a(),Number);i(l,{getPolyfill:a,implementation:o,shim:s}),e.exports=l},9415:(e,t,r)=>{"use strict";var n=r(8611);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},3194:(e,t,r)=>{"use strict";var n=r(4289),i=r(9415);e.exports=function(){var e=i();return n(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},5692:(e,t,r)=>{"use strict";var n=r(9804),i=r(3083),o=r(1924),a=o("Object.prototype.toString"),s=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,c=i(),u=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r-1}return!!f&&function(e){var t=!1;return n(_,(function(r,n){if(!t)try{t=r.call(e)===n}catch(e){}})),t}(e)}},4244:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,r){return 0===e&&0===r?1/e==1/r:e===r||!(!t(e)||!t(r))}},609:(e,t,r)=>{"use strict";var n=r(4289),i=r(5559),o=r(4244),a=r(5624),s=r(2281),l=i(a(),Object);n(l,{getPolyfill:a,implementation:o,shim:s}),e.exports=l},5624:(e,t,r)=>{"use strict";var n=r(4244);e.exports=function(){return"function"==typeof Object.is?Object.is:n}},2281:(e,t,r)=>{"use strict";var n=r(5624),i=r(4289);e.exports=function(){var e=n();return i(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8987:(e,t,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1414),s=Object.prototype.propertyIsEnumerable,l=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(e){var t=e.constructor;return t&&t.prototype===e},_={$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},f=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!_["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{p(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),n=a(e),s=t&&"[object String]"===o.call(e),_=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var h=c&&r;if(s&&e.length>0&&!i.call(e,0))for(var d=0;d0)for(var g=0;g{"use strict";var n=Array.prototype.slice,i=r(1414),o=Object.keys,a=o?function(e){return o(e)}:r(8987),s=Object.keys;a.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 i(e)?s(n.call(e)):s(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},1414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},4155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,l=[],c=!1,u=-1;function p(){c&&s&&(c=!1,s.length?l=s.concat(l):u=-1,l.length&&_())}function _(){if(!c){var e=a(p);c=!0;for(var t=l.length;t;){for(s=l,l=[];++u1)for(var r=1;r{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},5955:(e,t,r)=>{"use strict";var n=r(2584),i=r(8662),o=r(6430),a=r(5692);function s(e){return e.call.bind(e)}var l="undefined"!=typeof BigInt,c="undefined"!=typeof Symbol,u=s(Object.prototype.toString),p=s(Number.prototype.valueOf),_=s(String.prototype.valueOf),f=s(Boolean.prototype.valueOf);if(l)var h=s(BigInt.prototype.valueOf);if(c)var d=s(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function y(e){return"[object Map]"===u(e)}function m(e){return"[object Set]"===u(e)}function b(e){return"[object WeakMap]"===u(e)}function w(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 E(e){return"[object DataView]"===u(e)}function O(e){return"undefined"!=typeof DataView&&(E.working?E(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=a,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):a(e)||O(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},y.working="undefined"!=typeof Map&&y(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(y.working?y(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),t.isArrayBuffer=v,E.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=O;var j="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function S(e){return"[object SharedArrayBuffer]"===u(e)}function R(e){return void 0!==j&&(void 0===S.working&&(S.working=S(new j)),S.working?S(e):e instanceof j)}function A(e){return g(e,p)}function q(e){return g(e,_)}function T(e){return g(e,f)}function k(e){return l&&g(e,h)}function P(e){return c&&g(e,d)}t.isSharedArrayBuffer=R,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=A,t.isStringObject=q,t.isBooleanObject=T,t.isBigIntObject=k,t.isSymbolObject=P,t.isBoxedPrimitive=function(e){return A(e)||q(e)||T(e)||k(e)||P(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(v(e)||R(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},9539:(e,t,r)=>{var n=r(4155),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),_(n,e,n.depth)}function u(e,t){var r=c.styles[t];return r?"["+c.colors[r][0]+"m"+e+"["+c.colors[r][1]+"m":e}function p(e,t){return e}function _(e,r,n){if(e.customInspect&&r&&j(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=_(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),O(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(r);if(0===a.length){if(j(r)){var l=r.name?": "+r.name:"";return e.stylize("[Function"+l+"]","special")}if(x(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return f(r)}var c,u="",p=!1,v=["{","}"];return d(r)&&(p=!0,v=["[","]"]),j(r)&&(u=" [Function"+(r.name?": "+r.name:"")+"]"),x(r)&&(u=" "+RegExp.prototype.toString.call(r)),E(r)&&(u=" "+Date.prototype.toUTCString.call(r)),O(r)&&(u=" "+f(r)),0!==a.length||p&&0!=r.length?n<0?x(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=p?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(c,u,v)):v[0]+u+v[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),T(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=y(r)?_(e,l.value,null):_(e,l.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function x(e){return v(e)&&"[object RegExp]"===S(e)}function v(e){return"object"==typeof e&&null!==e}function E(e){return v(e)&&"[object Date]"===S(e)}function O(e){return v(e)&&("[object Error]"===S(e)||e instanceof Error)}function j(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(s.test(e)){var r=n.pid;a[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else a[e]=function(){};return a[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=r(5955),t.isArray=d,t.isBoolean=g,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=x,t.types.isRegExp=x,t.isObject=v,t.isDate=E,t.types.isDate=E,t.isError=O,t.types.isNativeError=O,t.isFunction=j,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(384);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function q(){var e=new Date,t=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":");return[e.getDate(),A[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",q(),t.format.apply(t,arguments))},t.inherits=r(5717),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}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,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o{"use strict";var n=r(9804),i=r(3083),o=r(1924),a=o("Object.prototype.toString"),s=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,c=i(),u=o("String.prototype.slice"),p={},_=r(882),f=Object.getPrototypeOf;s&&_&&f&&n(c,(function(e){if("function"==typeof l[e]){var t=new l[e];if(Symbol.toStringTag in t){var r=f(t),n=_(r,Symbol.toStringTag);if(!n){var i=f(r);n=_(i,Symbol.toStringTag)}p[e]=n.get}}}));var h=r(5692);e.exports=function(e){return!!h(e)&&(s&&Symbol.toStringTag in e?function(e){var t=!1;return n(p,(function(r,n){if(!t)try{var i=r.call(e);i===n&&(t=i)}catch(e){}})),t}(e):u(a(e),8,-1))}},45:(e,t,r)=>{var n=r(4155);const i=r(4949),o=r(5174),a=r(7857),s=r(6987),l=r(371),c=r(8594),u=/^([0-9]+)(\.[0-9]+)?$/;class p extends Error{}function _(e,t,r){if(e.length>r[0]&&(r[0]=e.length),-1==r[1])return;let n=u.exec(e);if(null===n)return void(!t&&e.length&&(r[1]=-1,r[2]=-1));let i=n[1].length;r[1]=Math.max(r[1],i);let o=void 0===n[2]?0:n[2].length;r[2]=Math.max(r[2],o)}function f(e,t,r,n){if(e=e.trim(),-1==r[1]){let t=Math.max(r[0]-e.length,0);return n?e:e+" ".repeat(t+1)}if(t&&null===u.exec(e)){let t=Math.max(r[0]-e.length,0);return n?e:e+" ".repeat(t+1)}let i=e.indexOf("."),o=-1==i?e.length:i,a=-1==i?0:e.length-i,s=Math.max(r[1]-o,0),l=Math.max(r[2]-a),c=n?"":" ".repeat(l+1);return" ".repeat(s)+e+c}function h(e){return"rbql_table_name:"+e}function d(e,t,r){var n,s="~"===(n=r).charAt(0)?a.join(i.homedir(),n.slice(1)):n;if(o.existsSync(s))return s;if(t&&!a.isAbsolute(s)&&(s=a.join(t,s),o.existsSync(s)))return s;let l=e?e.get(h(r)):null;return l&&o.existsSync(l)?l:null}function g(e,t){const r=e.lineCount;for(let n=0;n1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e1);let[i,o]=n[0],[a,s]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${a} -> ${s} fields`,l}(this.table_name,this.fields_info)),e}}class b extends s.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 y("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 y('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{i||(i=!0,n.close(),a(e))})),n.on("error",(e=>{s(e)})),l},e.exports.rbql_query_web=async function(e,t,r,n,i,o,a,l,c=null){let u=new w,p=new m(t,r,n,l,c),_=new b(i,o);return await s.query(e,p,_,a,u,""),_.output_lines},e.exports.rbql_query_node=async function(e,t,r,c,u,p,_,f,h,d,g=!1,m=null,b="",w=null){let v=null,E=null;w&&w.bulk_read&&r?E=r:v=null===r?n.stdin:o.createReadStream(r);let[O,j]=null===p?[n.stdout,!1]:[o.createWriteStream(p),!0];if('"'==c&&"quoted"==u)throw new y('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==h&&(h="binary"),!l.is_ascii(t)&&"binary"==h)throw new y("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(l.is_ascii(c)&&l.is_ascii(_)||"binary"!=h))throw new y("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let S=a.join(i.homedir(),".rbql_init_source.js");""==b&&o.existsSync(S)&&(b=l.read_user_init_code(S));let R=r?a.dirname(r):null,A=new x(e,R,c,u,h,g,m,w),q=new l.CSVRecordIterator(v,E,h,c,u,g,m),T=new l.CSVWriter(O,j,h,_,f);await s.query(t,q,T,d,A,b),A.get_warnings(d)},e.exports.get_header_line=g,e.exports.populate_optimistic_rfc_csv_record_map=function(e,t,r,n=null){let i=e.lineCount,o=null;var a;for(let s=r.length?(a=r,a[a.length-1])[1]:0;s=i&&""==t)break;if(n&&t.startsWith(n))continue;let a=t.match(/"/g),l=a&&a.length%2==1;if(null!==o||l)if(null===o&&l)o=s;else{if(!l)continue;r.push([o,s+1]),o=null}else r.push([s,s+1])}null!==o&&r.push([o,i])},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 bellow 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 bellow this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.align_columns=function(e,t,r,n,i){let o=[],a=e.lineCount,s=!1,l=!0;for(let u=0;u=i.length);e++){let t=e+1==i.length,r=f(_[e],l,i[e],t);_[e]!=r&&(_[e]=r,s=!0)}l=!1,o.push(_.join(t))}return s?o.join("\n"):null},e.exports.shrink_columns=function(e,t,r,n){let i=[],o=e.lineCount,a=!1;for(let s=0;s0&&(r[1]+r[2]>r[0]&&(r[0]=r[1]+r[2]),r[0]-r[2]>r[1]&&(r[1]=r[0]-r[2]),r[0]!=r[1]+r[2]))return null;t.push(r)}return t},e.exports.update_subcomponent_stats=_,e.exports.align_field=f},8594:e=>{let t=new RegExp('^"((?:[^"]*"")*[^"]*)"'),r=new RegExp('^ *"((?:[^"]*"")*[^"]*)" *');function n(e,n,i,o,a,s){var l=!1;let c=e.substring(a),u=(o?r:t).exec(c);if(null!==u){let t=u[0].length;if(a+t==e.length||e[a+t]==n)return i?s.push(u[0]):s.push(u[1].replace(/""/g,'"')),[a+t+1,!1];l=!0}var p=e.indexOf(n,a);-1==p&&(p=e.length);var _=e.substring(a,p);return l=l||-1!=_.indexOf('"'),s.push(_),[p+1,l]}function i(e,t,r=!1){if(-1==e.indexOf('"'))return[e.split(t),!1];var i=[],o=0,a=!1;let s=" "!=t;for(;o{(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,r){return e.split(t).join(r)}class RBQLContext{constructor(e,t,r,n){this.query_text=e,this.input_iterator=t,this.writer=r,this.user_init_code=n,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.25.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=[],r=0,n=[];for(let i=0;ie.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 r="__RBQL_INTERNAL_STAR",n=/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(e),i=/^([ab])\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(e),o=/^([ab])\[([0-9]+)\]$/.exec(e),a=/^([ab])\[___RBQL_STRING_LITERAL([0-9]+)___\]$/.exec(e);if(null!==n){if(e==r)return{table_name:null,column_index:null,column_name:null,is_star:!0};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}:{table_name:null,column_index:null,column_name:e,is_star:!1}}if(null!==i){let e=i[1],t=i[2];return t==r?{table_name:e,column_index:null,column_name:null,is_star:!0}:{table_name:null,column_index:null,column_name:t,is_star:!1}}if(null!=o)return{table_name:o[1],column_index:parseInt(o[2])-1,column_name:null,is_star:!1};if(null!=a){a[1];let e=a[2];if(ecolumn_info_from_text_span(e,t)))}function stable_compare(e,t){for(var r=0;r=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),r=this.records.get(t);return r?r[0]+=1:this.records.set(t,[1,e]),!0}async finish(){for(var[e,t]of this.records){let[e,r]=t;if(r.unshift(e),!await this.subwriter.write(r))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;te instanceof UnnestMarker));for(var o=0;oo+e)),n.slice(0,e).concat(i).concat(n.slice(e+1)).join("\n")+"\n"}assert(!1)}function generate_main_loop_code(e){let t=null!==e.select_expression,r=null!==e.join_map,n=null===e.where_expression?"true":e.where_expression,i=null===e.aggregation_key_expression?"null":e.aggregation_key_expression,o=null===e.sort_key_expression?"null":e.sort_key_expression,a=embed_code(MAIN_LOOP_BODY,"__USER_INIT_CODE__",e.user_init_code);return t?(r?(a=embed_code(embed_code(a,"__CODE__",PROCESS_SELECT_JOIN),"__CODE__",PROCESS_SELECT_COMMON),a=embed_expression(a,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):a=embed_code(embed_code(a,"__CODE__",PROCESS_SELECT_SIMPLE),"__CODE__",PROCESS_SELECT_COMMON),a=embed_code(a,"__RBQLMP__variables_init_code",e.variables_init_code),a=embed_expression(a,"__RBQLMP__select_expression",e.select_expression),a=embed_expression(a,"__RBQLMP__where_expression",n),a=embed_expression(a,"__RBQLMP__aggregation_key_expression",i),a=embed_expression(a,"__RBQLMP__sort_key_expression",o)):(r?(a=embed_code(a,"__CODE__",PROCESS_UPDATE_JOIN),a=embed_expression(a,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):a=embed_code(a,"__CODE__",PROCESS_UPDATE_SIMPLE),a=embed_code(a,"__RBQLMP__variables_init_code",e.variables_init_code),a=embed_code(a,"__RBQLMP__update_expressions",e.update_expressions),a=embed_expression(a,"__RBQLMP__where_expression",n)),"(async () => {"+a+"})()"}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 r=[];let n=null;for(;null!==(n=e.exec(t));)r.push(n);return r}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 r=0;re[1]));for(let e of o){let o=r.indexOf(e);if(-1==o)throw new RbqlParsingError(`Unable to find column "${e}" in ${"a"==t?"input":"join"} ${n}`);i[`${t}.${e}`]={initialize:!0,index:o}}}function map_variables_directly(e,t,r){for(let n=0;n1)throw new RbqlParsingError(`More than one "${o}" statements found`);assert(1==a.length);var s=a[0],l=s[0];r.push([s.index,s.index+l.length,o]);break}}return r.sort((function(e,t){return e[0]-t[0]})),r}function separate_actions(e){e=str_strip(e);var t={};let r=/^(.*) *[Ww][Ii][Tt][Hh] *\(([a-z]{4,20})\) *$/.exec(e);null!==r&&(e=r[1],t[WITH]=r[2]);for(var n=locate_statements(e),i=0;ie-t)),[null===n?null:select_except(n,o),`select_except(record_a, [${o.join(",")}])`]}class HashJoinMap{constructor(e,t){this.max_record_len=0,this.hash_map=new Map,this.record_iterator=e,this.nr=0,1==t.length?(this.key_index=t[0],this.key_indices=null,this.polymorphic_get_key=this.get_single_key):(this.key_index=null,this.key_indices=t,this.polymorphic_get_key=this.get_multi_key)}get_single_key(e,t){if(this.key_index>=t.length)throw new RbqlRuntimeError(`No field with index ${this.key_index+1} at record ${this.nr} in "B" table`);return-1===this.key_index?this.nr:t[this.key_index]}get_multi_key(e,t){let r=[];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`);r.push(-1===e?this.nr:t[e])}return JSON.stringify(r)}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 r=this.polymorphic_get_key(this.nr,e),n=this.hash_map.get(r);void 0===n?this.hash_map.set(r,[[this.nr,t,e]]):n.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,r){if(null===e&&null===t)return null;null===e&&(e=[]),null===t&&(t=[]);let n=[];for(let i of r)null===i?n.push("col"+(n.length+1)):i.is_star?null===i.table_name?n=n.concat(e).concat(t):"a"===i.table_name?n=n.concat(e):"b"===i.table_name&&(n=n.concat(t)):null!==i.column_name?n.push(i.column_name):null!==i.column_index?"a"==i.table_name&&i.column_index1);let[i,o]=n[0],[a,s]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${a} -> ${s} fields`,l}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,r=!0,n="a"){super(),this.table=e,this.column_names=t,this.normalize_column_names=r,this.variable_prefix=n,this.nr=0,this.fields_info=new Object,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.hasOwnProperty(t)||(this.fields_info[t]=this.nr),e}get_warnings(){return Object.keys(this.fields_info).length>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,r=!0,n="b"){super(),this.table=e,this.table_id=n,this.column_names=t,this.normalize_column_names=r}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,r,n){e=cleanup_query(e);var[i,o]=separate_string_literals(e),a=separate_actions(i=remove_redundant_table_name(i));a.hasOwnProperty(WITH)&&t.handle_query_modifier(a[WITH]);var s=await t.get_variables_map(e);if(a.hasOwnProperty(ORDER_BY)&&a.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY" is not allowed in "UPDATE" queries');if(a.hasOwnProperty(GROUP_BY)){if(a.hasOwnProperty(ORDER_BY)||a.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');n.aggregation_key_expression="["+combine_string_literals(a[GROUP_BY].text,o)+"]"}let l=null,c=null;if(a.hasOwnProperty(JOIN)){var[u,p]=parse_join_expression(a[JOIN].text);if(null===r)throw new RbqlParsingError("JOIN operations are not supported by the application");let t=r.get_iterator_by_table_id(u);if(!t)throw new RbqlParsingError(`Unable to find join table: "${u}"`);a.hasOwnProperty(WITH)&&t.handle_query_modifier(a[WITH]),l=await t.get_variables_map(e),c=await t.get_header();let[i,_]=resolve_join_variables(s,l,p,o),f={JOIN:InnerJoiner,"INNER JOIN":InnerJoiner,"LEFT JOIN":LeftJoiner,"LEFT OUTER JOIN":LeftJoiner,"STRICT LEFT JOIN":StrictLeftJoiner}[a[JOIN].join_subtype];n.lhs_join_var_expression=1==i.length?i[0]:"JSON.stringify(["+i.join(",")+"])",n.join_map_impl=new HashJoinMap(t,_),await n.join_map_impl.build(),n.join_map=new f(n.join_map_impl)}if(n.variables_init_code=combine_string_literals(generate_init_statements(i,s,l," ".repeat(4)),o),a.hasOwnProperty(WHERE)){var _=a[WHERE].text;if(/[^>{var n=r(4155);const i=r(1606),o=r(4704),a=r(9426),s=r(9539),l=r(6987),c=r(8594),u="Unable to decode input table as UTF-8. Use binary (latin-1) encoding instead";class p extends Error{}class _ extends Error{}function f(e,t=null){if(!e)throw t||(t="Assertion error"),new _(t)}function h(e){return/^[\x00-\x7F]*$/.test(e)}function d(e){return i.readFileSync(e,"utf-8")}function g(e,t){var r,n="~"===(r=t).charAt(0)?a.join(o.homedir(),r.slice(1)):r;if(i.existsSync(n))return n;if(e&&!a.isAbsolute(n)&&(n=a.join(e,n),i.existsSync(n)))return n;var s=function(e,t){for(var r=function(e){var t=null;try{t=i.readFileSync(e,"utf-8")}catch(e){return[]}for(var r=t.split("\n"),n=[],o=0;o1&&i.existsSync(s[1])?s[1]:null}class y{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 m extends l.RBQLInputIterator{constructor(e,t,r,n,i,o=!1,a=null,l="input",c="a"){super(),this.stream=e,this.csv_path=t,f(null===this.stream!=(null===this.csv_path)),this.encoding=r,this.delim=n,this.policy=i,this.has_header=o,this.first_record=null,this.first_record_should_be_emitted=!o,this.header_preread_complete=!1,this.table_name=l,this.variable_prefix=c,this.comment_prefix=null!==a&&a.length?a:null,this.decoder=null,"utf-8"==r&&null===this.csv_path&&(this.decoder=new s.TextDecoder(r,{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 Object,this.NR=0,this.NL=0,this.rfc_line_buffer=[],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 y,this.process_line_polymorphic="quoted_rfc"==i?this.process_partial_rfc_record_line:this.process_record_line}handle_query_modifier(e){-1!=["header","headers"].indexOf(e)&&(this.has_header=!0,this.first_record_should_be_emitted=!1),-1!=["noheader","noheaders"].indexOf(e)&&(this.has_header=!1,this.first_record_should_be_emitted=!0)}reset_external_callbacks(){this.reject_current_record=null,this.resolve_current_record=null}try_propagate_exception(){if(this.current_exception&&this.reject_current_record){let e=this.reject_current_record,t=this.current_exception;this.reset_external_callbacks(),this.current_exception=null,e(t)}}store_or_propagate_exception(e){null===this.current_exception&&(this.current_exception=e),this.try_propagate_exception()}async preread_first_record(){this.header_preread_complete||(this.first_record=await this.get_record(),this.header_preread_complete=!0,null!==this.first_record&&(this.stream&&this.stream.pause(),this.first_record=this.first_record.slice()))}async get_variables_map(e){let t=new Object;return l.parse_basic_variables(e,this.variable_prefix,t),l.parse_array_variables(e,this.variable_prefix,t),await this.preread_first_record(),this.has_header&&this.first_record&&(l.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),l.parse_dictionary_variables(e,this.variable_prefix,this.first_record,t)),t}async get_header(){return await this.preread_first_record(),this.has_header?this.first_record:null}try_resolve_next_record(){if(this.try_propagate_exception(),null===this.resolve_current_record)return;let e=null;if(this.first_record_should_be_emitted&&this.header_preread_complete?(this.first_record_should_be_emitted=!1,e=this.first_record):e=this.produced_records_queue.dequeue(),null===e&&!this.input_exhausted)return;let t=this.resolve_current_record;this.reset_external_callbacks(),t(e)}async get_record(){this.started||await this.start(),this.stream&&this.stream.isPaused()&&this.stream.resume();let e=this,t=new Promise((function(t,r){e.resolve_current_record=t,e.reject_current_record=r}));return this.try_resolve_next_record(),t}async get_all_records(e=null){let t=[];for(;;){let r=await this.get_record();if(null===r)break;if(t.push(r),e&&t.length>=e){this.stop();break}}return t}process_record_line(e){if(null!==this.comment_prefix&&e.startsWith(this.comment_prefix))return;this.NR+=1;var[t,r]=c.smart_split(e,this.delim,this.policy,!1);r&&null===this.first_defective_line&&(this.first_defective_line=this.NL,"quoted_rfc"==this.policy&&this.store_or_propagate_exception(new p(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`)));let n=t.length;this.fields_info.hasOwnProperty(n)||(this.fields_info[n]=this.NR),this.produced_records_queue.enqueue(t),this.try_resolve_next_record()}process_partial_rfc_record_line(e){let t=c.accumulate_rfc_line_into_record(this.rfc_line_buffer,e,this.comment_prefix);null!==t&&this.process_record_line(t)}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 p(u)):this.store_or_propagate_exception(e))}else t=e.toString(this.encoding);let r=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 n=c.split_lines(t);n[0]=this.partially_decoded_line+n[0],f(0==r||0==n[0].length),this.partially_decoded_line=n.pop();for(let e=r;e0&&this.process_record_line(this.rfc_line_buffer.join("\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.rfc_line_buffer.length>0&&this.process_record_line(this.rfc_line_buffer.join("\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,r){i.readFile(e.csv_path,((n,i)=>{n?r(n):(e.process_data_bulk(i),t())}))}))}this.stream.on("data",(e=>{this.process_data_stream_chunk(e)})),this.stream.on("end",(()=>{this.process_data_stream_end()}))}}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),this.utf8_bom_removed&&e.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`),Object.keys(this.fields_info).length>1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e1);let[i,o]=n[0],[a,s]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${a} -> ${s} fields`,l}(this.table_name,this.fields_info)),e}}class b extends l.RBQLOutputWriter{constructor(e,t,r,n,i,o="\n"){if(super(),this.stream=e,this.encoding=r,r&&this.stream.setDefaultEncoding(r),this.stream.on("error",(e=>{this.store_first_error(e)})),this.delim=n,this.policy=i,this.line_separator=o,this.sub_array_delim="|"==n?";":"|",this.close_stream_on_finish=t,this.null_in_output=!1,this.delim_in_simple_output=!1,this.header_len=null,this.first_error=null,"simple"==i)this.polymorphic_join=this.simple_join;else if("quoted"==i)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==i)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==i)this.polymorphic_join=this.mono_join;else{if("whitespace"!=i)throw new p("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 p('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{i()})):setTimeout((()=>{i()}),0)}))}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class w extends l.RBQLTableRegistry{constructor(e,t,r,n,i=!1,o=null,a=null){super(),this.input_file_dir=e,this.delim=t,this.policy=r,this.encoding=n,this.has_header=i,this.comment_prefix=o,this.stream=null,this.record_iterator=null,this.options=a,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=g(this.input_file_dir,e),null===this.table_path)throw new p(`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 m(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 ${a.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.is_ascii=h,e.exports.CSVRecordIterator=m,e.exports.CSVWriter=b,e.exports.FileSystemCSVRegistry=w,e.exports.interpret_named_csv_format=function(e){if("monocolumn"==(e=e.toLowerCase()))return["","monocolumn"];if("csv"==e)return[",","quoted"];if("tsv"==e)return["\t","simple"];throw new p(`Unknown format name: "${e}"`)},e.exports.read_user_init_code=d,e.exports.query_csv=async function(e,t,r,s,c,u,_,f,g,y=!1,x=null,v="",E=null){let O=null,j=null;E&&E.bulk_read&&t?j=t:O=null===t?n.stdin:i.createReadStream(t);let[S,R]=null===c?[n.stdout,!1]:[i.createWriteStream(c),!0];if('"'==r&&"quoted"==s)throw new p('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==f&&(f="binary"),!h(e)&&"binary"==f)throw new p("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(h(r)&&h(u)||"binary"!=f))throw new p("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let A=a.join(o.homedir(),".rbql_init_source.js");""==v&&i.existsSync(A)&&(v=d(A));let q=t?a.dirname(t):null,T=new w(q,r,s,f,y,x,E),k=new m(O,j,f,r,s,y,x),P=new b(S,R,f,u,_);await l.query(e,k,P,g,T,v),T.get_warnings(g)},e.exports.RecordQueue=y,e.exports.exception_to_error_info=l.exception_to_error_info},9496:e=>{"use strict";e.exports=require("vscode")},1606:()=>{},4704:()=>{},9426:()=>{},7666:()=>{},5174:()=>{},4949:()=>{},7857:()=>{},8391:()=>{},3083:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.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__(9282),r=__webpack_require__(7666),n=__webpack_require__(9496),i=__webpack_require__(45),o=void 0===r.homedir,a=6e3;function s(e){return new Promise((t=>setTimeout(t,e)))}function l(e){console.log("###RAINBOW_CSV_UNIT_TEST_MESSAGE### "+e)}e.run=async function(){try{l("Starting tests"),t.equal(-1,[1,2,3].indexOf(0)),t(n.workspace.workspaceFolders),t.equal(1,n.workspace.workspaceFolders.length);let e=n.workspace.workspaceFolders[0].uri;if(await(function(){let e="foobar",r=0,n=[5,2,3];i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,-1,-1]),e="foobar",r=1,n=[0,0,0],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,0,0]),e="100000",r=0,n=[2,-1,-1],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,-1,-1]),e="",r=0,n=[5,2,3],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[5,2,3]),e="100.3",r=0,n=[7,4,3],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[7,4,3]),e="100000",r=0,n=[5,2,3],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,6,3]),e="1000.23",r=0,n=[3,3,0],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[7,4,3])}(),function(){let e="foobar",r=0,n=[10,-1,-1];n=i.adjust_column_stats([n])[0];let o=0,a=i.align_field(e,r,n,o);t.deepEqual("foobar ",a),e="foobar",r=0,n=[10,-1,-1],n=i.adjust_column_stats([n])[0],o=1,a=i.align_field(e,r,n,o),t.deepEqual("foobar",a),e="foobar",r=1,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("foobar ",a),e="10.1",r=1,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1 ",a),e="10.1",r=1,n=[10,-1,-1],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("10.1 ",a),e="10.1",r=0,n=[10,-1,-1],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("10.1 ",a),e="10.1",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1 ",a),e="10.1",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=1,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1",a),e="1000",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("1000 ",a),e="1000",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=1,a=i.align_field(e,r,n,o),t.deepEqual("1000",a),e="1000",r=0,n=[4,4,0],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("1000 ",a),e="1000",r=0,n=[6,4,0],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 1000 ",a),e="10.1",r=0,n=[12,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1 ",a)}(),void function(){let e=[10,-1,-1],r=i.adjust_column_stats([e])[0];t.deepEqual([10,-1,-1],r),e=[10,0,0],r=i.adjust_column_stats([e])[0],t.deepEqual([10,-1,-1],r),e=[5,4,3],r=i.adjust_column_stats([e])[0],t.deepEqual([7,4,3],r),e=[10,4,3],r=i.adjust_column_stats([e])[0],t.deepEqual([10,7,3],r)}()),await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","lorem_ipsum.txt"),i=await n.workspace.openTextDocument(r);l(`languageId for lorem_ipsum.txt: ${i.languageId}`),t.equal(i.languageId,"plaintext");let o=await n.window.showTextDocument(i);await s(1e3),r=n.Uri.joinPath(e,"test","suite","index.js"),i=await n.workspace.openTextDocument(r),l(`languageId for index.js: ${i.languageId}`),t.equal(i.languageId,"javascript"),o=await n.window.showTextDocument(i),await s(1e3),r=n.Uri.joinPath(e,"test","csv_files","lorem_ipsum"),i=await n.workspace.openTextDocument(r),l(`languageId for lorem_ipsum: ${i.languageId}`),t.equal(i.languageId,"plaintext"),o=await n.window.showTextDocument(i),await s(1e3)}(e),!o){let e=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(!e.lazy_loaded)}if(await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking_semicolon.txt"),i=await n.workspace.openTextDocument(r);await n.window.showTextDocument(i),l(`languageId for university_ranking_semicolon.txt: ${i.languageId}`),t.equal(i.languageId,"csv (semicolon)"),await s(1e3)}(e),await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","small_movies.pipe"),i=await n.workspace.openTextDocument(r);l(`languageId for small_movies.pipe: ${i.languageId}`),t.equal(i.languageId,"plaintext"),await n.window.showTextDocument(i),await s(1e3);for(let e=0;e<6;e++)await n.commands.executeCommand("cursorRight");await n.commands.executeCommand("cursorRightSelect"),await s(1e3),await n.commands.executeCommand("rainbow-csv.RainbowSeparator"),await s(2e3),l(`languageId for small_movies.pipe after RainbowSeparator: ${i.languageId}`),t.equal(i.languageId,"csv (pipe)"),await n.commands.executeCommand("rainbow-csv.RainbowSeparatorOff"),await s(2e3),l(`languageId for small_movies.pipe after RainbowSeparatorOff: ${i.languageId}`),t.equal(i.languageId,"plaintext"),await s(1e3)}(e),!o){let e=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(!e.lazy_loaded)}if(o?await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i);await s(1e3);let c={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 n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a);let u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});t.equal('["null values in output were replaced by empty strings"]',JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document;let p=i.getText().length;l(`Length after first js query: ${p}`),t.equal(846,p),c={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after second js query: ${p}`),t.equal(267,p),c={rbql_backend:"js",rbql_query:"select nonexistent_function(a1)"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),t.equal("query execution",u.error_type),t.equal("At record 1, Details: nonexistent_function is not defined",u.error_msg),l("Starting multiline records test"),r=n.Uri.joinPath(e,"test","csv_files","synthetic_rfc_newline_data.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i),await s(1e3),c={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after js multiline-record query: ${p}`),t.equal(644,p)}(e):await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i);await s(1e3);let c={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 n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a);let u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});t.equal('["None values in output were replaced by empty strings"]',JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document;let p=i.getText().length;l(`Length after python query: ${p}`),t.equal(868,p),c={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after js query: ${p}`),t.equal(268,p),c={rbql_backend:"python",rbql_query:"select nonexistent_function(a1)"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),t.equal("query execution",u.error_type),t.equal("At record 1, Details: name 'nonexistent_function' is not defined",u.error_msg),r=n.Uri.joinPath(e,"test","csv_files","synthetic_rfc_newline_data.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i),await s(1e3),c={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after js multiline-record query: ${p}`),t.equal(645,p),r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i),await s(1e3),c={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 n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.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(u.warnings)),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after join query: ${p}`),t.equal(11592,p),t.equal(202,i.lineCount),r=n.Uri.joinPath(e,"test","csv_files","countries.csv"),i=await n.workspace.openTextDocument(r);let _=i.fileName,f=i.getText().length;o=await n.window.showTextDocument(i),t(-1==i.getText().indexOf("oceania")),t(i.getText().indexOf("OCEANIA")>0),await s(1e3),c={rbql_backend:"python",with_headers:!0,rbql_query:"UPDATE set a.Region = a.Region.lower()"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),t.equal("[]",JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document,i.fileName,p=i.getText().length,l(`Length after update query: ${p}`),t.equal(f,p-i.lineCount+1),t(-1==i.getText().indexOf("OCEANIA")),t(i.getText().indexOf("oceania")>0),await s(1e3),await n.commands.executeCommand("rainbow-csv.CopyBack"),await s(1e3),i=await n.workspace.openTextDocument(r);let h=i.fileName;t.equal(_,h),t(-1==i.getText().indexOf("OCEANIA")),t(i.getText().indexOf("oceania")>0)}(e),!o){let e=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(e.lazy_loaded)}await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=(await n.window.showTextDocument(i),i.getText().length);l(`Original length: ${o}`),t.equal(12538,o),await s(2e3),await n.commands.executeCommand("rainbow-csv.Align");let a=i.getText().length;l(`Aligned length: ${a}`),t.equal(25896,a),t(a>o);let c=await n.commands.executeCommand("rainbow-csv.CSVLint");t.equal(c,"OK"),await s(2e3),await n.commands.executeCommand("rainbow-csv.Shrink");let u=i.getText().length;l(`Shrinked length: ${u}`),t.equal(o,u),await s(500);let p="foobar,";await n.commands.executeCommand("default:type",{text:p}),c=await n.commands.executeCommand("rainbow-csv.CSVLint"),t(-1!=c.indexOf("Number of fields is not consistent")),await s(500);for(let e=0;e\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = require('./internal/errors'),\n _require$codes = _require.codes,\n ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,\n ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n\nvar AssertionError = require('./internal/assert/assertion_error');\n\nvar _require2 = require('util/'),\n inspect = _require2.inspect;\n\nvar _require$types = require('util/').types,\n isPromise = _require$types.isPromise,\n isRegExp = _require$types.isRegExp;\n\nvar objectAssign = Object.assign ? Object.assign : require('es6-object-assign').assign;\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar errorCache = new Map();\nvar isDeepEqual;\nvar isDeepStrictEqual;\nvar parseExpressionAt;\nvar findNodeAround;\nvar decoder;\n\nfunction lazyLoadComparison() {\n var comparison = require('./internal/util/comparisons');\n\n isDeepEqual = comparison.isDeepEqual;\n isDeepStrictEqual = comparison.isDeepStrictEqual;\n} // Escape control characters but not \\n and \\t to keep the line breaks and\n// indentation intact.\n// eslint-disable-next-line no-control-regex\n\n\nvar escapeSequencesRegExp = /[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g;\nvar meta = [\"\\\\u0000\", \"\\\\u0001\", \"\\\\u0002\", \"\\\\u0003\", \"\\\\u0004\", \"\\\\u0005\", \"\\\\u0006\", \"\\\\u0007\", '\\\\b', '', '', \"\\\\u000b\", '\\\\f', '', \"\\\\u000e\", \"\\\\u000f\", \"\\\\u0010\", \"\\\\u0011\", \"\\\\u0012\", \"\\\\u0013\", \"\\\\u0014\", \"\\\\u0015\", \"\\\\u0016\", \"\\\\u0017\", \"\\\\u0018\", \"\\\\u0019\", \"\\\\u001a\", \"\\\\u001b\", \"\\\\u001c\", \"\\\\u001d\", \"\\\\u001e\", \"\\\\u001f\"];\n\nvar escapeFn = function escapeFn(str) {\n return meta[str.charCodeAt(0)];\n};\n\nvar warned = false; // The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\nvar NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction innerFail(obj) {\n if (obj.message instanceof Error) throw obj.message;\n throw new AssertionError(obj);\n}\n\nfunction fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length;\n var internalMessage;\n\n if (argsLen === 0) {\n internalMessage = 'Failed';\n } else if (argsLen === 1) {\n message = actual;\n actual = undefined;\n } else {\n if (warned === false) {\n warned = true;\n var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);\n warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');\n }\n\n if (argsLen === 2) operator = '!=';\n }\n\n if (message instanceof Error) throw message;\n var errArgs = {\n actual: actual,\n expected: expected,\n operator: operator === undefined ? 'fail' : operator,\n stackStartFn: stackStartFn || fail\n };\n\n if (message !== undefined) {\n errArgs.message = message;\n }\n\n var err = new AssertionError(errArgs);\n\n if (internalMessage) {\n err.message = internalMessage;\n err.generatedMessage = true;\n }\n\n throw err;\n}\n\nassert.fail = fail; // The AssertionError is defined in internal/error.\n\nassert.AssertionError = AssertionError;\n\nfunction innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = false;\n\n if (argLen === 0) {\n generatedMessage = true;\n message = 'No value argument passed to `assert.ok()`';\n } else if (message instanceof Error) {\n throw message;\n }\n\n var err = new AssertionError({\n actual: value,\n expected: true,\n message: message,\n operator: '==',\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n} // Pure assertion tests whether a value is truthy, as determined\n// by !!value.\n\n\nfunction ok() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n innerOk.apply(void 0, [ok, args.length].concat(args));\n}\n\nassert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.\n\n/* eslint-disable no-restricted-properties */\n\nassert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual != expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '==',\n stackStartFn: equal\n });\n }\n}; // The non-equality assertion tests for whether two objects are not\n// equal with !=.\n\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual == expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '!=',\n stackStartFn: notEqual\n });\n }\n}; // The equivalence assertion tests a deep equality relation.\n\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepEqual',\n stackStartFn: deepEqual\n });\n }\n}; // The non-equivalence assertion tests for any deep inequality.\n\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepEqual',\n stackStartFn: notDeepEqual\n });\n }\n};\n/* eslint-enable */\n\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepStrictEqual',\n stackStartFn: deepStrictEqual\n });\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\n\nfunction notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepStrictEqual',\n stackStartFn: notDeepStrictEqual\n });\n }\n}\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (!objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'strictEqual',\n stackStartFn: strictEqual\n });\n }\n};\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notStrictEqual',\n stackStartFn: notStrictEqual\n });\n }\n};\n\nvar Comparison = function Comparison(obj, keys, actual) {\n var _this = this;\n\n _classCallCheck(this, Comparison);\n\n keys.forEach(function (key) {\n if (key in obj) {\n if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {\n _this[key] = actual[key];\n } else {\n _this[key] = obj[key];\n }\n }\n });\n};\n\nfunction compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {\n if (!message) {\n // Create placeholder objects to create a nice output.\n var a = new Comparison(actual, keys);\n var b = new Comparison(expected, keys, actual);\n var err = new AssertionError({\n actual: a,\n expected: b,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.actual = actual;\n err.expected = expected;\n err.operator = fn.name;\n throw err;\n }\n\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n}\n\nfunction expectedException(actual, expected, msg, fn) {\n if (typeof expected !== 'function') {\n if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.\n\n if (arguments.length === 2) {\n throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);\n } // Handle primitives properly.\n\n\n if (_typeof(actual) !== 'object' || actual === null) {\n var err = new AssertionError({\n actual: actual,\n expected: expected,\n message: msg,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.operator = fn.name;\n throw err;\n }\n\n var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared\n // as well.\n\n if (expected instanceof Error) {\n keys.push('name', 'message');\n } else if (keys.length === 0) {\n throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n keys.forEach(function (key) {\n if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {\n return;\n }\n\n compareExceptionKey(actual, expected, key, msg, keys, fn);\n });\n return true;\n } // Guard instanceof against arrow functions as they don't have a prototype.\n\n\n if (expected.prototype !== undefined && actual instanceof expected) {\n return true;\n }\n\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n\n return expected.call({}, actual) === true;\n}\n\nfunction getActual(fn) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);\n }\n\n try {\n fn();\n } catch (e) {\n return e;\n }\n\n return NO_EXCEPTION_SENTINEL;\n}\n\nfunction checkIsPromise(obj) {\n // Accept native ES6 promises and promises that are implemented in a similar\n // way. Do not accept thenables that use a function as `obj` and that have no\n // `catch` handler.\n // TODO: thenables are checked up until they have the correct methods,\n // but according to documentation, the `then` method should receive\n // the `fulfill` and `reject` arguments as well or it may be never resolved.\n return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';\n}\n\nfunction waitForActual(promiseFn) {\n return Promise.resolve().then(function () {\n var resultPromise;\n\n if (typeof promiseFn === 'function') {\n // Return a rejected promise if `promiseFn` throws synchronously.\n resultPromise = promiseFn(); // Fail in case no promise is returned.\n\n if (!checkIsPromise(resultPromise)) {\n throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);\n }\n } else if (checkIsPromise(promiseFn)) {\n resultPromise = promiseFn;\n } else {\n throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);\n }\n\n return Promise.resolve().then(function () {\n return resultPromise;\n }).then(function () {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function (e) {\n return e;\n });\n });\n}\n\nfunction expectsError(stackStartFn, actual, error, message) {\n if (typeof error === 'string') {\n if (arguments.length === 4) {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (_typeof(actual) === 'object' && actual !== null) {\n if (actual.message === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error message \\\"\".concat(actual.message, \"\\\" is identical to the message.\"));\n }\n } else if (actual === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error \\\"\".concat(actual, \"\\\" is identical to the message.\"));\n }\n\n message = error;\n error = undefined;\n } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = '';\n\n if (error && error.name) {\n details += \" (\".concat(error.name, \")\");\n }\n\n details += message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';\n innerFail({\n actual: undefined,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn: stackStartFn\n });\n }\n\n if (error && !expectedException(actual, error, message, stackStartFn)) {\n throw actual;\n }\n}\n\nfunction expectsNoError(stackStartFn, actual, error, message) {\n if (actual === NO_EXCEPTION_SENTINEL) return;\n\n if (typeof error === 'string') {\n message = error;\n error = undefined;\n }\n\n if (!error || expectedException(actual, error)) {\n var details = message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';\n innerFail({\n actual: actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, \"\\n\") + \"Actual message: \\\"\".concat(actual && actual.message, \"\\\"\"),\n stackStartFn: stackStartFn\n });\n }\n\n throw actual;\n}\n\nassert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));\n};\n\nassert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n\n return waitForActual(promiseFn).then(function (result) {\n return expectsError.apply(void 0, [rejects, result].concat(args));\n });\n};\n\nassert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n};\n\nassert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n args[_key5 - 1] = arguments[_key5];\n }\n\n return waitForActual(fn).then(function (result) {\n return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));\n });\n};\n\nassert.ifError = function ifError(err) {\n if (err !== null && err !== undefined) {\n var message = 'ifError got unwanted exception: ';\n\n if (_typeof(err) === 'object' && typeof err.message === 'string') {\n if (err.message.length === 0 && err.constructor) {\n message += err.constructor.name;\n } else {\n message += err.message;\n }\n } else {\n message += inspect(err);\n }\n\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: 'ifError',\n message: message,\n stackStartFn: ifError\n }); // Make sure we actually have a stack trace!\n\n var origStack = err.stack;\n\n if (typeof origStack === 'string') {\n // This will remove any duplicated frames from the error frames taken\n // from within `ifError` and add the original error frames to the newly\n // created ones.\n var tmp2 = origStack.split('\\n');\n tmp2.shift(); // Filter all frames existing in err.stack.\n\n var tmp1 = newErr.stack.split('\\n');\n\n for (var i = 0; i < tmp2.length; i++) {\n // Find the first occurrence of the frame.\n var pos = tmp1.indexOf(tmp2[i]);\n\n if (pos !== -1) {\n // Only keep new frames.\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n\n newErr.stack = \"\".concat(tmp1.join('\\n'), \"\\n\").concat(tmp2.join('\\n'));\n }\n\n throw newErr;\n }\n}; // Expose a strict only variant of assert\n\n\nfunction strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n innerOk.apply(void 0, [strict, args.length].concat(args));\n}\n\nassert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n});\nassert.strict.strict = assert.strict;","// Currently in sync with Node.js lib/internal/assert/assertion_error.js\n// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar _require = require('util/'),\n inspect = _require.inspect;\n\nvar _require2 = require('../errors'),\n ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n\n\nfunction repeat(str, count) {\n count = Math.floor(count);\n if (str.length == 0 || count == 0) return '';\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n\n while (count) {\n str += str;\n count--;\n }\n\n str += str.substring(0, maxCount - str.length);\n return str;\n}\n\nvar blue = '';\nvar green = '';\nvar red = '';\nvar white = '';\nvar kReadableOperator = {\n deepStrictEqual: 'Expected values to be strictly deep-equal:',\n strictEqual: 'Expected values to be strictly equal:',\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: 'Expected values to be loosely deep-equal:',\n equal: 'Expected values to be loosely equal:',\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: 'Values identical but not reference-equal:'\n}; // Comparing short primitives should just show === / !== instead of using the\n// diff.\n\nvar kMaxShortLength = 10;\n\nfunction copyError(source) {\n var keys = Object.keys(source);\n var target = Object.create(Object.getPrototypeOf(source));\n keys.forEach(function (key) {\n target[key] = source[key];\n });\n Object.defineProperty(target, 'message', {\n value: source.message\n });\n return target;\n}\n\nfunction inspectValue(val) {\n // The util.inspect default values could be changed. This makes sure the\n // error messages contain the necessary information nevertheless.\n return inspect(val, {\n compact: false,\n customInspect: false,\n depth: 1000,\n maxArrayLength: Infinity,\n // Assert compares only enumerable properties (with a few exceptions).\n showHidden: false,\n // Having a long line as error is better than wrapping the line for\n // comparison for now.\n // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we\n // have meta information about the inspected properties (i.e., know where\n // in what line the property starts and ends).\n breakLength: Infinity,\n // Assert does not detect proxies currently.\n showProxy: false,\n sorted: true,\n // Inspect getters as we also check them when comparing entries.\n getters: true\n });\n}\n\nfunction createErrDiff(actual, expected, operator) {\n var other = '';\n var res = '';\n var lastPos = 0;\n var end = '';\n var skipped = false;\n var actualInspected = inspectValue(actual);\n var actualLines = actualInspected.split('\\n');\n var expectedLines = inspectValue(expected).split('\\n');\n var i = 0;\n var indicator = ''; // In case both values are objects explicitly mark them as not reference equal\n // for the `strictEqual` operator.\n\n if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {\n operator = 'strictEqualObject';\n } // If \"actual\" and \"expected\" fit on a single line and they are not strictly\n // equal, check further special handling.\n\n\n if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of \"actual\" and \"expected\" together is less than\n // kMaxShortLength and if neither is an object and at least one of them is\n // not `zero`, use the strict equal comparison to visualize the output.\n\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {\n // -0 === +0\n return \"\".concat(kReadableOperator[operator], \"\\n\\n\") + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], \"\\n\");\n }\n } else if (operator !== 'strictEqualObject') {\n // If the stderr is a tty and the input length is lower than the current\n // columns per line, add a mismatch indicator below the output. If it is\n // not a tty, use a default value of 80 characters.\n var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;\n\n if (inputLength < maxLength) {\n while (actualLines[0][i] === expectedLines[0][i]) {\n i++;\n } // Ignore the first characters.\n\n\n if (i > 2) {\n // Add position indicator for the first mismatch in case it is a\n // single line and the input length is less than the column length.\n indicator = \"\\n \".concat(repeat(' ', i), \"^\");\n i = 0;\n }\n }\n }\n } // Remove all ending lines that match (this optimizes the output for\n // readability by reducing the number of total changed lines).\n\n\n var a = actualLines[actualLines.length - 1];\n var b = expectedLines[expectedLines.length - 1];\n\n while (a === b) {\n if (i++ < 2) {\n end = \"\\n \".concat(a).concat(end);\n } else {\n other = a;\n }\n\n actualLines.pop();\n expectedLines.pop();\n if (actualLines.length === 0 || expectedLines.length === 0) break;\n a = actualLines[actualLines.length - 1];\n b = expectedLines[expectedLines.length - 1];\n }\n\n var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.\n // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })\n\n if (maxLines === 0) {\n // We have to get the result again. The lines were all removed before.\n var _actualLines = actualInspected.split('\\n'); // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (_actualLines.length > 30) {\n _actualLines[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (_actualLines.length > 27) {\n _actualLines.pop();\n }\n }\n\n return \"\".concat(kReadableOperator.notIdentical, \"\\n\\n\").concat(_actualLines.join('\\n'), \"\\n\");\n }\n\n if (i > 3) {\n end = \"\\n\".concat(blue, \"...\").concat(white).concat(end);\n skipped = true;\n }\n\n if (other !== '') {\n end = \"\\n \".concat(other).concat(end);\n other = '';\n }\n\n var printedLines = 0;\n var msg = kReadableOperator[operator] + \"\\n\".concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white);\n var skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n\n for (i = 0; i < maxLines; i++) {\n // Only extra expected lines exist\n var cur = i - lastPos;\n\n if (actualLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(expectedLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(expectedLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the expected line to the cache.\n\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]);\n printedLines++; // Only extra actual lines exist\n } else if (expectedLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLines[i]);\n printedLines++; // Lines diverge\n } else {\n var expectedLine = expectedLines[i];\n var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by\n // a trailing comma. In that case it is actually identical and we should\n // mark it as such.\n\n var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,\n // add a comma at the end of the actual line. Otherwise the output could\n // look weird as in:\n //\n // [\n // 1 // No comma at the end!\n // + 2\n // ]\n //\n\n if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {\n divergingLines = false;\n actualLine += ',';\n }\n\n if (divergingLines) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result and cache the expected diverging\n // line so consecutive diverging lines show up as +++--- and not +-+-+-.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLine);\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLine);\n printedLines += 2; // Lines are identical\n } else {\n // Add all cached information to the result before adding other things\n // and reset the cache.\n res += other;\n other = ''; // If the last diverging line is exactly one line above or if it is the\n // very first line, add the line to the result.\n\n if (cur === 1 || i === 0) {\n res += \"\\n \".concat(actualLine);\n printedLines++;\n }\n }\n } // Inspected object to big (Show ~20 rows max)\n\n\n if (printedLines > 20 && i < maxLines - 2) {\n return \"\".concat(msg).concat(skippedMsg, \"\\n\").concat(res, \"\\n\").concat(blue, \"...\").concat(white).concat(other, \"\\n\") + \"\".concat(blue, \"...\").concat(white);\n }\n }\n\n return \"\".concat(msg).concat(skipped ? skippedMsg : '', \"\\n\").concat(res).concat(other).concat(end).concat(indicator);\n}\n\nvar AssertionError =\n/*#__PURE__*/\nfunction (_Error) {\n _inherits(AssertionError, _Error);\n\n function AssertionError(options) {\n var _this;\n\n _classCallCheck(this, AssertionError);\n\n if (_typeof(options) !== 'object' || options === null) {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n\n var message = options.message,\n operator = options.operator,\n stackStartFn = options.stackStartFn;\n var actual = options.actual,\n expected = options.expected;\n var limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n\n if (message != null) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));\n } else {\n if (process.stderr && process.stderr.isTTY) {\n // Reset on each call to make sure we handle dynamically set environment\n // variables correct.\n if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {\n blue = \"\\x1B[34m\";\n green = \"\\x1B[32m\";\n white = \"\\x1B[39m\";\n red = \"\\x1B[31m\";\n } else {\n blue = '';\n green = '';\n white = '';\n red = '';\n }\n } // Prevent the error stack from being visible by duplicating the error\n // in a very close way to the original in case both sides are actually\n // instances of Error.\n\n\n if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {\n actual = copyError(actual);\n expected = copyError(expected);\n }\n\n if (operator === 'deepStrictEqual' || operator === 'strictEqual') {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));\n } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {\n // In case the objects are equal but the operator requires unequal, show\n // the first object and say A equals B\n var base = kReadableOperator[operator];\n var res = inspectValue(actual).split('\\n'); // In case \"actual\" is an object, it should not be reference equal.\n\n if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {\n base = kReadableOperator.notStrictEqualObject;\n } // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (res.length > 30) {\n res[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (res.length > 27) {\n res.pop();\n }\n } // Only print a single input.\n\n\n if (res.length === 1) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \" \").concat(res[0])));\n } else {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \"\\n\\n\").concat(res.join('\\n'), \"\\n\")));\n }\n } else {\n var _res = inspectValue(actual);\n\n var other = '';\n var knownOperators = kReadableOperator[operator];\n\n if (operator === 'notDeepEqual' || operator === 'notEqual') {\n _res = \"\".concat(kReadableOperator[operator], \"\\n\\n\").concat(_res);\n\n if (_res.length > 1024) {\n _res = \"\".concat(_res.slice(0, 1021), \"...\");\n }\n } else {\n other = \"\".concat(inspectValue(expected));\n\n if (_res.length > 512) {\n _res = \"\".concat(_res.slice(0, 509), \"...\");\n }\n\n if (other.length > 512) {\n other = \"\".concat(other.slice(0, 509), \"...\");\n }\n\n if (operator === 'deepEqual' || operator === 'equal') {\n _res = \"\".concat(knownOperators, \"\\n\\n\").concat(_res, \"\\n\\nshould equal\\n\\n\");\n } else {\n other = \" \".concat(operator, \" \").concat(other);\n }\n }\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(_res).concat(other)));\n }\n }\n\n Error.stackTraceLimit = limit;\n _this.generatedMessage = !message;\n Object.defineProperty(_assertThisInitialized(_this), 'name', {\n value: 'AssertionError [ERR_ASSERTION]',\n enumerable: false,\n writable: true,\n configurable: true\n });\n _this.code = 'ERR_ASSERTION';\n _this.actual = actual;\n _this.expected = expected;\n _this.operator = operator;\n\n if (Error.captureStackTrace) {\n // eslint-disable-next-line no-restricted-syntax\n Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);\n } // Create error message including the error code in the name.\n\n\n _this.stack; // Reset the name.\n\n _this.name = 'AssertionError';\n return _possibleConstructorReturn(_this);\n }\n\n _createClass(AssertionError, [{\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n }, {\n key: inspect.custom,\n value: function value(recurseTimes, ctx) {\n // This limits the `actual` and `expected` property default inspection to\n // the minimum depth. Otherwise those values would be too verbose compared\n // to the actual error message which contains a combined view of these two\n // input values.\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: false,\n depth: 0\n }));\n }\n }]);\n\n return AssertionError;\n}(_wrapNativeSuper(Error));\n\nmodule.exports = AssertionError;","// Currently in sync with Node.js lib/internal/errors.js\n// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f\n\n/* eslint node-core/documented-errors: \"error\" */\n\n/* eslint node-core/alphabetize-errors: \"error\" */\n\n/* eslint node-core/prefer-util-format-errors: \"error\" */\n'use strict'; // The whole point behind this internal module is to allow Node.js to no\n// longer be forced to treat every error message change as a semver-major\n// change. The NodeError classes here all expose a `code` property whose\n// value statically and permanently identifies the error. While the error\n// message may change, the code should not.\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar codes = {}; // Lazy loaded\n\nvar assert;\nvar util;\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inherits(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n var _this;\n\n _classCallCheck(this, NodeError);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));\n _this.code = code;\n return _this;\n }\n\n return NodeError;\n }(Base);\n\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The \"%s\" argument is ambiguous. %s', TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n if (assert === undefined) assert = require('../assert');\n assert(typeof name === 'string', \"'name' must be a string\"); // determiner: 'must be' or 'must not be'\n\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } // TODO(BridgeAR): Improve the output by showing `null` and similar.\n\n\n msg += \". Received type \".concat(_typeof(actual));\n return msg;\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {\n var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';\n if (util === undefined) util = require('util/');\n var inspected = util.inspect(value);\n\n if (inspected.length > 128) {\n inspected = \"\".concat(inspected.slice(0, 128), \"...\");\n }\n\n return \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n}, TypeError, RangeError);\ncreateErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {\n var type;\n\n if (value && value.constructor && value.constructor.name) {\n type = \"instance of \".concat(value.constructor.name);\n } else {\n type = \"type \".concat(_typeof(value));\n }\n\n return \"Expected \".concat(input, \" to be returned from the \\\"\").concat(name, \"\\\"\") + \" function but got \".concat(type, \".\");\n}, TypeError);\ncreateErrorType('ERR_MISSING_ARGS', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (assert === undefined) assert = require('../assert');\n assert(args.length > 0, 'At least one arg needs to be specified');\n var msg = 'The ';\n var len = args.length;\n args = args.map(function (a) {\n return \"\\\"\".concat(a, \"\\\"\");\n });\n\n switch (len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n\n default:\n msg += args.slice(0, len - 1).join(', ');\n msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n\n return \"\".concat(msg, \" must be specified\");\n}, TypeError);\nmodule.exports.codes = codes;","// Currently in sync with Node.js lib/internal/util/comparisons.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n'use strict';\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar regexFlagsSupported = /a/g.flags !== undefined;\n\nvar arrayFromSet = function arrayFromSet(set) {\n var array = [];\n set.forEach(function (value) {\n return array.push(value);\n });\n return array;\n};\n\nvar arrayFromMap = function arrayFromMap(map) {\n var array = [];\n map.forEach(function (value, key) {\n return array.push([key, value]);\n });\n return array;\n};\n\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {\n return [];\n};\nvar numberIsNaN = Number.isNaN ? Number.isNaN : require('is-nan');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);\nvar propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);\nvar objectToString = uncurryThis(Object.prototype.toString);\n\nvar _require$types = require('util/').types,\n isAnyArrayBuffer = _require$types.isAnyArrayBuffer,\n isArrayBufferView = _require$types.isArrayBufferView,\n isDate = _require$types.isDate,\n isMap = _require$types.isMap,\n isRegExp = _require$types.isRegExp,\n isSet = _require$types.isSet,\n isNativeError = _require$types.isNativeError,\n isBoxedPrimitive = _require$types.isBoxedPrimitive,\n isNumberObject = _require$types.isNumberObject,\n isStringObject = _require$types.isStringObject,\n isBooleanObject = _require$types.isBooleanObject,\n isBigIntObject = _require$types.isBigIntObject,\n isSymbolObject = _require$types.isSymbolObject,\n isFloat32Array = _require$types.isFloat32Array,\n isFloat64Array = _require$types.isFloat64Array;\n\nfunction isNonIndex(key) {\n if (key.length === 0 || key.length > 10) return true;\n\n for (var i = 0; i < key.length; i++) {\n var code = key.charCodeAt(i);\n if (code < 48 || code > 57) return true;\n } // The maximum size for an array is 2 ** 32 -1.\n\n\n return key.length === 10 && key >= Math.pow(2, 32);\n}\n\nfunction getOwnNonIndexProperties(value) {\n return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));\n} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js\n// original notice:\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n\nfunction compare(a, b) {\n if (a === b) {\n return 0;\n }\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) {\n return -1;\n }\n\n if (y < x) {\n return 1;\n }\n\n return 0;\n}\n\nvar ONLY_ENUMERABLE = undefined;\nvar kStrict = true;\nvar kLoose = false;\nvar kNoIterator = 0;\nvar kIsArray = 1;\nvar kIsSet = 2;\nvar kIsMap = 3; // Check if they have the same source and flags\n\nfunction areSimilarRegExps(a, b) {\n return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);\n}\n\nfunction areSimilarFloatArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n for (var offset = 0; offset < a.byteLength; offset++) {\n if (a[offset] !== b[offset]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction areSimilarTypedArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;\n}\n\nfunction areEqualArrayBuffers(buf1, buf2) {\n return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;\n}\n\nfunction isEqualBoxedPrimitive(val1, val2) {\n if (isNumberObject(val1)) {\n return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));\n }\n\n if (isStringObject(val1)) {\n return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);\n }\n\n if (isBooleanObject(val1)) {\n return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);\n }\n\n if (isBigIntObject(val1)) {\n return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);\n }\n\n return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);\n} // Notes: Type tags are historical [[Class]] properties that can be set by\n// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS\n// and retrieved using Object.prototype.toString.call(obj) in JS\n// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring\n// for a list of tags pre-defined in the spec.\n// There are some unspecified tags in the wild too (e.g. typed array tags).\n// Since tags can be altered, they only serve fast failures\n//\n// Typed arrays and buffers are checked by comparing the content in their\n// underlying ArrayBuffer. This optimization requires that it's\n// reasonable to interpret their underlying memory in the same way,\n// which is checked by comparing their type tags.\n// (e.g. a Uint8Array and a Uint16Array with the same memory content\n// could still be different because they will be interpreted differently).\n//\n// For strict comparison, objects should have\n// a) The same built-in type tags\n// b) The same prototypes.\n\n\nfunction innerDeepEqual(val1, val2, strict, memos) {\n // All identical values are equivalent, as determined by ===.\n if (val1 === val2) {\n if (val1 !== 0) return true;\n return strict ? objectIs(val1, val2) : true;\n } // Check more closely if val1 and val2 are equal.\n\n\n if (strict) {\n if (_typeof(val1) !== 'object') {\n return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);\n }\n\n if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {\n return false;\n }\n\n if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {\n return false;\n }\n } else {\n if (val1 === null || _typeof(val1) !== 'object') {\n if (val2 === null || _typeof(val2) !== 'object') {\n // eslint-disable-next-line eqeqeq\n return val1 == val2;\n }\n\n return false;\n }\n\n if (val2 === null || _typeof(val2) !== 'object') {\n return false;\n }\n }\n\n var val1Tag = objectToString(val1);\n var val2Tag = objectToString(val2);\n\n if (val1Tag !== val2Tag) {\n return false;\n }\n\n if (Array.isArray(val1)) {\n // Check for sparse arrays and general fast path\n if (val1.length !== val2.length) {\n return false;\n }\n\n var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsArray, keys1);\n } // [browserify] This triggers on certain types in IE (Map/Set) so we don't\n // wan't to early return out of the rest of the checks. However we can check\n // if the second value is one of these values and the first isn't.\n\n\n if (val1Tag === '[object Object]') {\n // return keyCheck(val1, val2, strict, memos, kNoIterator);\n if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {\n return false;\n }\n }\n\n if (isDate(val1)) {\n if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {\n return false;\n }\n } else if (isRegExp(val1)) {\n if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {\n return false;\n }\n } else if (isNativeError(val1) || val1 instanceof Error) {\n // Do not compare the stack as it might differ even though the error itself\n // is otherwise identical.\n if (val1.message !== val2.message || val1.name !== val2.name) {\n return false;\n }\n } else if (isArrayBufferView(val1)) {\n if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {\n if (!areSimilarFloatArrays(val1, val2)) {\n return false;\n }\n } else if (!areSimilarTypedArrays(val1, val2)) {\n return false;\n } // Buffer.compare returns true, so val1.length === val2.length. If they both\n // only contain numeric keys, we don't need to exam further than checking\n // the symbols.\n\n\n var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n\n var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (_keys.length !== _keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);\n } else if (isSet(val1)) {\n if (!isSet(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsSet);\n } else if (isMap(val1)) {\n if (!isMap(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsMap);\n } else if (isAnyArrayBuffer(val1)) {\n if (!areEqualArrayBuffers(val1, val2)) {\n return false;\n }\n } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator);\n}\n\nfunction getEnumerables(val, keys) {\n return keys.filter(function (k) {\n return propertyIsEnumerable(val, k);\n });\n}\n\nfunction keyCheck(val1, val2, strict, memos, iterationType, aKeys) {\n // For all remaining Object pairs, including Array, objects and Maps,\n // equivalence is determined by having:\n // a) The same number of owned enumerable properties\n // b) The same set of keys/indexes (although not necessarily the same order)\n // c) Equivalent values for every corresponding key/index\n // d) For Sets and Maps, equal contents\n // Note: this accounts for both named and indexed properties on Arrays.\n if (arguments.length === 5) {\n aKeys = Object.keys(val1);\n var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n } // Cheap key test\n\n\n var i = 0;\n\n for (; i < aKeys.length; i++) {\n if (!hasOwnProperty(val2, aKeys[i])) {\n return false;\n }\n }\n\n if (strict && arguments.length === 5) {\n var symbolKeysA = objectGetOwnPropertySymbols(val1);\n\n if (symbolKeysA.length !== 0) {\n var count = 0;\n\n for (i = 0; i < symbolKeysA.length; i++) {\n var key = symbolKeysA[i];\n\n if (propertyIsEnumerable(val1, key)) {\n if (!propertyIsEnumerable(val2, key)) {\n return false;\n }\n\n aKeys.push(key);\n count++;\n } else if (propertyIsEnumerable(val2, key)) {\n return false;\n }\n }\n\n var symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {\n return false;\n }\n } else {\n var _symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {\n return false;\n }\n }\n }\n\n if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {\n return true;\n } // Use memos to handle cycles.\n\n\n if (memos === undefined) {\n memos = {\n val1: new Map(),\n val2: new Map(),\n position: 0\n };\n } else {\n // We prevent up to two map.has(x) calls by directly retrieving the value\n // and checking for undefined. The map can only contain numbers, so it is\n // safe to check for undefined only.\n var val2MemoA = memos.val1.get(val1);\n\n if (val2MemoA !== undefined) {\n var val2MemoB = memos.val2.get(val2);\n\n if (val2MemoB !== undefined) {\n return val2MemoA === val2MemoB;\n }\n }\n\n memos.position++;\n }\n\n memos.val1.set(val1, memos.position);\n memos.val2.set(val2, memos.position);\n var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);\n memos.val1.delete(val1);\n memos.val2.delete(val2);\n return areEq;\n}\n\nfunction setHasEqualElement(set, val1, strict, memo) {\n // Go looking.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var val2 = setValues[i];\n\n if (innerDeepEqual(val1, val2, strict, memo)) {\n // Remove the matching element to make sure we do not check that again.\n set.delete(val2);\n return true;\n }\n }\n\n return false;\n} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using\n// Sadly it is not possible to detect corresponding values properly in case the\n// type is a string, number, bigint or boolean. The reason is that those values\n// can match lots of different string values (e.g., 1n == '+00001').\n\n\nfunction findLooseMatchingPrimitives(prim) {\n switch (_typeof(prim)) {\n case 'undefined':\n return null;\n\n case 'object':\n // Only pass in null as object!\n return undefined;\n\n case 'symbol':\n return false;\n\n case 'string':\n prim = +prim;\n // Loose equal entries exist only if the string is possible to convert to\n // a regular number and not NaN.\n // Fall through\n\n case 'number':\n if (numberIsNaN(prim)) {\n return false;\n }\n\n }\n\n return true;\n}\n\nfunction setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) return altValue;\n return b.has(altValue) && !a.has(altValue);\n}\n\nfunction mapMightHaveLoosePrim(a, b, prim, item, memo) {\n var altValue = findLooseMatchingPrimitives(prim);\n\n if (altValue != null) {\n return altValue;\n }\n\n var curB = b.get(altValue);\n\n if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {\n return false;\n }\n\n return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);\n}\n\nfunction setEquiv(a, b, strict, memo) {\n // This is a lazily initiated Set of entries which have to be compared\n // pairwise.\n var set = null;\n var aValues = arrayFromSet(a);\n\n for (var i = 0; i < aValues.length; i++) {\n var val = aValues[i]; // Note: Checking for the objects first improves the performance for object\n // heavy sets but it is a minor slow down for primitives. As they are fast\n // to check this improves the worst case scenario instead.\n\n if (_typeof(val) === 'object' && val !== null) {\n if (set === null) {\n set = new Set();\n } // If the specified value doesn't exist in the second set its an not null\n // object (or non strict only: a not matching primitive) we'll need to go\n // hunting for something thats deep-(strict-)equal to it. To make this\n // O(n log n) complexity we have to copy these values in a new set first.\n\n\n set.add(val);\n } else if (!b.has(val)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.\n\n if (!setMightHaveLoosePrim(a, b, val)) {\n return false;\n }\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(val);\n }\n }\n\n if (set !== null) {\n var bValues = arrayFromSet(b);\n\n for (var _i = 0; _i < bValues.length; _i++) {\n var _val = bValues[_i]; // We have to check if a primitive value is already\n // matching and only if it's not, go hunting for it.\n\n if (_typeof(_val) === 'object' && _val !== null) {\n if (!setHasEqualElement(set, _val, strict, memo)) return false;\n } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction mapHasEqualEntry(set, map, key1, item1, strict, memo) {\n // To be able to handle cases like:\n // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])\n // ... we need to consider *all* matching keys, not just the first we find.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var key2 = setValues[i];\n\n if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {\n set.delete(key2);\n return true;\n }\n }\n\n return false;\n}\n\nfunction mapEquiv(a, b, strict, memo) {\n var set = null;\n var aEntries = arrayFromMap(a);\n\n for (var i = 0; i < aEntries.length; i++) {\n var _aEntries$i = _slicedToArray(aEntries[i], 2),\n key = _aEntries$i[0],\n item1 = _aEntries$i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n } else {\n // By directly retrieving the value we prevent another b.has(key) check in\n // almost all possible cases.\n var item2 = b.get(key);\n\n if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null\n // keys.\n\n if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n }\n }\n }\n\n if (set !== null) {\n var bEntries = arrayFromMap(b);\n\n for (var _i2 = 0; _i2 < bEntries.length; _i2++) {\n var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),\n key = _bEntries$_i[0],\n item = _bEntries$_i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;\n } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction objEquiv(a, b, strict, keys, memos, iterationType) {\n // Sets and maps don't have their entries accessible via normal object\n // properties.\n var i = 0;\n\n if (iterationType === kIsSet) {\n if (!setEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsMap) {\n if (!mapEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsArray) {\n for (; i < a.length; i++) {\n if (hasOwnProperty(a, i)) {\n if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {\n return false;\n }\n } else if (hasOwnProperty(b, i)) {\n return false;\n } else {\n // Array is sparse.\n var keysA = Object.keys(a);\n\n for (; i < keysA.length; i++) {\n var key = keysA[i];\n\n if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {\n return false;\n }\n }\n\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n\n return true;\n }\n }\n } // The pair must have equivalent values for every corresponding key.\n // Possibly expensive deep test:\n\n\n for (i = 0; i < keys.length; i++) {\n var _key = keys[i];\n\n if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction isDeepEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kLoose);\n}\n\nfunction isDeepStrictEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kStrict);\n}\n\nmodule.exports = {\n isDeepEqual: isDeepEqual,\n isDeepStrictEqual: isDeepStrictEqual\n};","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar hasPropertyDescriptors = require('has-property-descriptors')();\n\nvar supportsDescriptors = origDefineProperty && hasPropertyDescriptors;\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value; // eslint-disable-line no-param-reassign\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","/**\n * Code refactored from Mozilla Developer Network:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n */\n\n'use strict';\n\nfunction assign(target, firstSource) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n for (var i = 1; i < arguments.length; i++) {\n var nextSource = arguments[i];\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n return to;\n}\n\nfunction polyfill() {\n if (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: assign\n });\n }\n}\n\nmodule.exports = {\n assign: assign,\n polyfill: polyfill\n};\n","\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\n\nvar hasPropertyDescriptors = function hasPropertyDescriptors() {\n\tif ($defineProperty) {\n\t\ttry {\n\t\t\t$defineProperty({}, 'a', { value: 1 });\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\t// IE 8 has a broken defineProperty\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn false;\n};\n\nhasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {\n\t// node v0.6 has a bug where array lengths can be Set but not Defined\n\tif (!hasPropertyDescriptors()) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn $defineProperty([], 'length', { value: 1 }).length !== 1;\n\t} catch (e) {\n\t\t// In Firefox 4-22, defining length on an array throws an exception.\n\t\treturn true;\n\t}\n};\n\nmodule.exports = hasPropertyDescriptors;\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function isNaN(value) {\n\treturn value !== value;\n};\n","'use strict';\n\nvar callBind = require('call-bind');\nvar define = require('define-properties');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Number);\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\tif (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) {\n\t\treturn Number.isNaN;\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function shimNumberIsNaN() {\n\tvar polyfill = getPolyfill();\n\tdefine(Number, { isNaN: polyfill }, {\n\t\tisNaN: function testIsNaN() {\n\t\t\treturn Number.isNaN !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","'use strict';\n\nvar numberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t}\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (numberIsNaN(a) && numberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.is === 'function' ? Object.is : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimObjectIs() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { is: polyfill }, {\n\t\tis: function testObjectIs() {\n\t\t\treturn Object.is !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","const os = require('os');\nconst fs = require('fs');\nconst path = require('path');\n\nconst rbql = require('./rbql_core/rbql-js/rbql.js');\nconst rbql_csv = require('./rbql_core/rbql-js/rbql_csv.js');\nconst csv_utils = require('./rbql_core/rbql-js/csv_utils.js');\n\nconst non_numeric_sentinel = -1;\nconst number_regex = /^([0-9]+)(\\.[0-9]+)?$/;\n\nclass AssertionError extends Error {}\n\nfunction assert(condition, message=null) {\n if (!condition) {\n if (!message) {\n message = 'Assertion error';\n }\n throw new AssertionError(message);\n }\n}\n\n\nfunction get_default_js_udf_content() {\n let default_content = `// 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 bellow this line:\n `.replace(new RegExp(/^ */, 'mg'), '');\n return default_content;\n}\n\n\nfunction get_default_python_udf_content() {\n let default_content = `# 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 bellow this line:\n `.replace(new RegExp(/^ */, 'mg'), '');\n return default_content;\n}\n\n\nfunction update_subcomponent_stats(field, is_first_line, max_field_components_lens) {\n // Extract overall field length and length of integer and fractional parts of the field if it represents a number.\n // Here `max_field_components_lens` is a tuple: (max_field_length, max_integer_part_length, max_fractional_part_length)\n if (field.length > max_field_components_lens[0]) {\n max_field_components_lens[0] = field.length;\n }\n if (max_field_components_lens[1] == non_numeric_sentinel) {\n // Column is not a number, early return.\n return;\n }\n let match_result = number_regex.exec(field);\n if (match_result === null) {\n if (!is_first_line && field.length) { // Checking field_length here allows numeric columns to have some of the fields empty.\n // We only mark the column as non-header if we know that this is not a header line.\n max_field_components_lens[1] = non_numeric_sentinel;\n max_field_components_lens[2] = non_numeric_sentinel;\n }\n return;\n }\n let cur_integer_part_length = match_result[1].length;\n max_field_components_lens[1] = Math.max(max_field_components_lens[1], cur_integer_part_length);\n let cur_fractional_part_length = match_result[2] === undefined ? 0 : match_result[2].length;\n max_field_components_lens[2] = Math.max(max_field_components_lens[2], cur_fractional_part_length);\n}\n\n\nfunction calc_column_stats(active_doc, delim, policy, comment_prefix) {\n let column_stats = [];\n let num_lines = active_doc.lineCount;\n let is_first_line = true;\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning) {\n return [null, lnum + 1];\n }\n for (let fnum = 0; fnum < fields.length; fnum++) {\n let field = fields[fnum].trim();\n if (column_stats.length <= fnum) {\n column_stats.push([0, 0, 0]);\n }\n update_subcomponent_stats(field, is_first_line, column_stats[fnum]);\n }\n is_first_line = false;\n }\n return [column_stats, null];\n}\n\n\nfunction adjust_column_stats(column_stats) {\n // Ensure that numeric components max widths are consistent with non-numeric (header) width.\n let adjusted_stats = [];\n for (let column_stat of column_stats) {\n if (column_stat[1] <= 0) {\n column_stat[1] = -1;\n column_stat[2] = -1;\n }\n if (column_stat[1] > 0) {\n // The sum of integer and float parts can be bigger than the max width, e.g. here:\n // value\n // 0.12\n // 1234\n if (column_stat[1] + column_stat[2] > column_stat[0]) {\n column_stat[0] = column_stat[1] + column_stat[2];\n }\n // This is needed when the header is wider than numeric components and/or their sum.\n if (column_stat[0] - column_stat[2] > column_stat[1]) {\n column_stat[1] = column_stat[0] - column_stat[2];\n }\n // Sanity check.\n if (column_stat[0] != column_stat[1] + column_stat[2]) {\n // Assertion Error, this can never happen.\n return null;\n }\n }\n adjusted_stats.push(column_stat);\n }\n return adjusted_stats;\n}\n\n\nfunction align_field(field, is_first_line, max_field_components_lens, is_last_column) {\n // Align field, use Math.max() to avoid negative delta_length which can happen theorethically due to async doc edit.\n const extra_readability_whitespace_length = 1;\n field = field.trim();\n if (max_field_components_lens[1] == non_numeric_sentinel) {\n let delta_length = Math.max(max_field_components_lens[0] - field.length, 0);\n return is_last_column ? field : field + ' '.repeat(delta_length + extra_readability_whitespace_length);\n }\n if (is_first_line) {\n if (number_regex.exec(field) === null) {\n // The line must be a header - align it using max_width rule.\n let delta_length = Math.max(max_field_components_lens[0] - field.length, 0);\n return is_last_column ? field : field + ' '.repeat(delta_length + extra_readability_whitespace_length);\n }\n }\n let dot_pos = field.indexOf('.');\n let cur_integer_part_length = dot_pos == -1 ? field.length : dot_pos;\n // Here cur_fractional_part_length includes the leading dot too.\n let cur_fractional_part_length = dot_pos == -1 ? 0 : field.length - dot_pos;\n let integer_delta_length = Math.max(max_field_components_lens[1] - cur_integer_part_length, 0);\n let fractional_delta_length = Math.max(max_field_components_lens[2] - cur_fractional_part_length);\n let trailing_spaces = is_last_column ? '' : ' '.repeat(fractional_delta_length + extra_readability_whitespace_length);\n return ' '.repeat(integer_delta_length) + field + trailing_spaces;\n}\n\n\nfunction align_columns(active_doc, delim, policy, comment_prefix, column_stats) {\n let result_lines = [];\n let num_lines = active_doc.lineCount;\n let has_edit = false;\n let is_first_line = true;\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix)) {\n result_lines.push(line_text);\n continue;\n }\n if (lnum + 1 == num_lines && line_text == '') {\n // Skip the last empty line which corresponds to the trailing newline character.\n result_lines.push(line_text);\n continue;\n }\n let fields = csv_utils.smart_split(line_text, delim, policy, true)[0];\n for (let fnum = 0; fnum < fields.length; fnum++) {\n if (fnum >= column_stats.length) // Safeguard against async doc edit, should never happen.\n break;\n let is_last_column = fnum + 1 == column_stats.length;\n let adjusted = align_field(fields[fnum], is_first_line, column_stats[fnum], is_last_column);\n if (fields[fnum] != adjusted) {\n fields[fnum] = adjusted;\n has_edit = true;\n }\n }\n is_first_line = false;\n result_lines.push(fields.join(delim));\n }\n if (!has_edit)\n return null;\n return result_lines.join('\\n');\n}\n\n\nfunction shrink_columns(active_doc, delim, policy, comment_prefix) {\n let result_lines = [];\n let num_lines = active_doc.lineCount;\n let has_edit = false;\n for (let lnum = 0; lnum < num_lines; lnum++) {\n let line_text = active_doc.lineAt(lnum).text;\n if (comment_prefix && line_text.startsWith(comment_prefix)) {\n result_lines.push(line_text);\n continue;\n }\n let [fields, warning] = csv_utils.smart_split(line_text, delim, policy, true);\n if (warning) {\n return [null, lnum + 1];\n }\n for (let i = 0; i < fields.length; i++) {\n let adjusted = fields[i].trim();\n if (fields[i].length != adjusted.length) {\n fields[i] = adjusted;\n has_edit = true;\n }\n }\n result_lines.push(fields.join(delim));\n }\n if (!has_edit)\n return [null, null];\n return [result_lines.join('\\n'), null];\n}\n\n\nfunction get_last(arr) {\n return arr[arr.length - 1];\n}\n\n\nfunction populate_optimistic_rfc_csv_record_map(document, requested_end_record, dst_record_map, comment_prefix=null) {\n let num_lines = document.lineCount;\n let record_begin = null;\n let start_line_idx = dst_record_map.length ? get_last(dst_record_map)[1] : 0;\n for (let lnum = start_line_idx; lnum < num_lines && dst_record_map.length < requested_end_record; ++lnum) {\n let line_text = document.lineAt(lnum).text;\n if (lnum + 1 >= num_lines && line_text == \"\")\n break; // Skip the last empty line.\n if (comment_prefix && line_text.startsWith(comment_prefix))\n continue;\n let match_list = line_text.match(/\"/g);\n let has_unbalanced_double_quote = match_list && match_list.length % 2 == 1;\n if (record_begin === null && !has_unbalanced_double_quote) {\n dst_record_map.push([lnum, lnum + 1]);\n } else if (record_begin === null && has_unbalanced_double_quote) {\n record_begin = lnum;\n } else if (!has_unbalanced_double_quote) {\n continue;\n } else {\n dst_record_map.push([record_begin, lnum + 1]);\n record_begin = null;\n }\n }\n if (record_begin !== null) {\n dst_record_map.push([record_begin, num_lines]);\n }\n}\n\n\nfunction make_table_name_key(file_path) {\n return 'rbql_table_name:' + file_path;\n}\n\n\nfunction expanduser(filepath) {\n if (filepath.charAt(0) === '~') {\n return path.join(os.homedir(), filepath.slice(1));\n }\n return filepath;\n}\n\n\nfunction find_table_path(vscode_global_state, main_table_dir, table_id) {\n // If table_id is a relative path it could be relative either to the current directory or to the main table dir.\n var candidate_path = expanduser(table_id);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n if (main_table_dir && !path.isAbsolute(candidate_path)) {\n candidate_path = path.join(main_table_dir, candidate_path);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n }\n let table_path = vscode_global_state ? vscode_global_state.get(make_table_name_key(table_id)) : null;\n if (table_path && fs.existsSync(table_path)) {\n return table_path;\n }\n return null;\n}\n\n\nasync function read_header(table_path, encoding) {\n if (encoding == 'latin-1')\n encoding = 'binary';\n let readline = require('readline');\n let input_reader = readline.createInterface({ input: fs.createReadStream(table_path, {encoding: encoding}) });\n let closed = false;\n let promise_resolve = null;\n let promise_reject = null;\n let output_promise = new Promise(function(resolve, reject) {\n promise_resolve = resolve;\n promise_reject = reject;\n });\n input_reader.on('line', line => {\n if (!closed) {\n closed = true;\n input_reader.close();\n promise_resolve(line);\n }\n });\n input_reader.on('error', error => {\n promise_reject(error);\n });\n return output_promise;\n}\n\n\nfunction get_header_line(document, comment_prefix) {\n const num_lines = document.lineCount;\n for (let lnum = 0; lnum < num_lines; ++lnum) {\n const line_text = document.lineAt(lnum).text;\n if (!comment_prefix || !line_text.startsWith(comment_prefix)) {\n return line_text;\n }\n }\n return null;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\n\nclass RbqlIOHandlingError extends Error {}\n\nclass VSCodeRecordIterator extends rbql.RBQLInputIterator {\n constructor(document, delim, policy, has_header=false, comment_prefix=null, table_name='input', variable_prefix='a') {\n // We could have done a hack here actually: convert the document to stream/buffer and then use the standard reader.\n super();\n this.document = document;\n this.delim = delim;\n this.policy = policy;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.table_name = table_name;\n this.variable_prefix = variable_prefix;\n this.NR = 0; // Record number.\n this.NL = 0; // Line number (NL != NR when the CSV file has comments or multiline fields).\n this.fields_info = new Object();\n this.first_defective_line = null;\n this.first_record = this.get_first_record();\n }\n\n stop() {\n }\n\n get_first_record() {\n let header_line = get_header_line(this.document, this.comment_prefix);\n let first_record = csv_utils.smart_split(header_line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n return first_record;\n }\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n rbql.parse_basic_variables(query_text, this.variable_prefix, variable_map);\n rbql.parse_array_variables(query_text, this.variable_prefix, variable_map);\n let header_line = get_header_line(this.document, this.comment_prefix);\n let first_record = csv_utils.smart_split(header_line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false)[0];\n if (this.has_header) {\n rbql.parse_attribute_variables(query_text, this.variable_prefix, first_record, 'CSV header line', variable_map);\n rbql.parse_dictionary_variables(query_text, this.variable_prefix, first_record, variable_map);\n }\n return variable_map;\n }\n\n async get_header() {\n return this.has_header ? this.first_record : null;\n }\n\n get_line_rfc() {\n let rfc_line_buffer = [];\n const num_lines = this.document.lineCount;\n while (this.NL < num_lines) {\n let line = this.document.lineAt(this.NL).text;\n this.NL += 1;\n if (this.NL == num_lines && line.length == 0)\n return null; // Skip the last line if it is empty - this can happen due to trailing newline.\n let record_line = csv_utils.accumulate_rfc_line_into_record(rfc_line_buffer, line, this.comment_prefix);\n if (record_line !== null)\n return record_line;\n }\n return null;\n }\n\n get_line_simple() {\n const num_lines = this.document.lineCount;\n while (this.NL < num_lines) {\n let line = this.document.lineAt(this.NL).text;\n this.NL += 1;\n if (this.NL == num_lines && line.length == 0)\n return null; // Skip the last line if it is empty - this can happen due to trailing newline.\n if (this.comment_prefix === null || !line.startsWith(this.comment_prefix))\n return line;\n }\n return null;\n }\n\n do_get_record() {\n let line = (this.policy == 'quoted_rfc') ? this.get_line_rfc() : this.get_line_simple();\n if (line === null)\n return null;\n let [record, warning] = csv_utils.smart_split(line, this.delim, this.policy, /*preserve_quotes_and_whitespaces=*/false);\n if (warning) {\n if (this.first_defective_line === null) {\n this.first_defective_line = this.NL;\n if (this.policy == 'quoted_rfc')\n throw new RbqlIOHandlingError(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`);\n }\n }\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.NR;\n return record;\n }\n\n async get_record() {\n if (this.NR == 0 && this.has_header) {\n this.do_get_record(); // Skip the header record.\n }\n this.NR += 1;\n let record = this.do_get_record();\n return record;\n }\n\n get_warnings() {\n let result = [];\n if (this.first_defective_line !== null)\n result.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`);\n if (Object.keys(this.fields_info).length > 1)\n result.push(make_inconsistent_num_fields_warning(this.table_name, this.fields_info));\n return result;\n }\n}\n\n\nclass VSCodeWriter extends rbql.RBQLOutputWriter {\n constructor(delim, policy) {\n super();\n this.delim = delim;\n this.policy = policy;\n this.header_len = null;\n this.null_in_output = false;\n this.delim_in_simple_output = false;\n this.output_lines = [];\n\n if (policy == 'simple') {\n this.polymorphic_join = this.simple_join;\n } else if (policy == 'quoted') {\n this.polymorphic_join = this.quoted_join;\n } else if (policy == 'quoted_rfc') {\n this.polymorphic_join = this.quoted_join_rfc;\n } else if (policy == 'monocolumn') {\n this.polymorphic_join = this.mono_join;\n } else if (policy == 'whitespace') {\n this.polymorphic_join = this.simple_join;\n } else {\n throw new RbqlIOHandlingError('Unknown output csv policy');\n }\n }\n\n set_header(header) {\n if (header !== null) {\n this.header_len = header.length;\n this.write(header);\n }\n }\n\n quoted_join(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n quoted_join_rfc(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.rfc_quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n mono_join(fields) {\n if (fields.length > 1) {\n throw new RbqlIOHandlingError('Unable to use \"Monocolumn\" output format: some records have more than one field');\n }\n return fields[0];\n };\n\n\n simple_join(fields) {\n var res = fields.join(this.delim);\n if (fields.join('').indexOf(this.delim) != -1) {\n this.delim_in_simple_output = true;\n }\n return res;\n };\n\n\n normalize_fields(out_fields) {\n for (var i = 0; i < out_fields.length; i++) {\n if (out_fields[i] == null) {\n this.null_in_output = true;\n out_fields[i] = '';\n } else if (Array.isArray(out_fields[i])) {\n this.normalize_fields(out_fields[i]);\n out_fields[i] = out_fields[i].join(this.sub_array_delim);\n }\n }\n };\n\n\n write(fields) {\n if (this.header_len !== null && fields.length != this.header_len)\n throw new RbqlIOHandlingError(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${fields.length}`);\n this.normalize_fields(fields);\n this.output_lines.push(this.polymorphic_join(fields));\n return true;\n };\n\n async finish() {\n }\n\n get_warnings() {\n let result = [];\n if (this.null_in_output)\n result.push('null values in output were replaced by empty strings');\n if (this.delim_in_simple_output)\n result.push('Some output fields contain separator');\n return result;\n };\n}\n\nclass VSCodeTableRegistry {\n constructor(){}\n\n get_iterator_by_table_id(_table_id) {\n throw new RbqlIOHandlingError(\"JOIN queries are currently not supported in vscode.dev web version.\");\n }\n\n get_warnings() {\n return [];\n };\n}\n\nasync function rbql_query_web(query_text, input_document, input_delim, input_policy, output_delim, output_policy, output_warnings, with_headers, comment_prefix=null) {\n let user_init_code = ''; // TODO find a way to have init code.\n let join_tables_registry = new VSCodeTableRegistry(); // TODO find a way to have join registry.\n let input_iterator = new VSCodeRecordIterator(input_document, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new VSCodeWriter(output_delim, output_policy);\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n return output_writer.output_lines;\n}\n\n\nclass VSCodeFileSystemCSVRegistry extends rbql.RBQLTableRegistry {\n constructor(vscode_global_state, input_file_dir, delim, policy, encoding, has_header=false, comment_prefix=null, options=null) {\n super();\n this.vscode_global_state = vscode_global_state;\n this.input_file_dir = input_file_dir;\n this.delim = delim;\n this.policy = policy;\n this.encoding = encoding;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.stream = null;\n this.record_iterator = null;\n\n this.options = options;\n this.bulk_input_path = null;\n this.table_path = null;\n }\n\n get_iterator_by_table_id(table_id) {\n this.table_path = find_table_path(this.vscode_global_state, this.input_file_dir, table_id);\n if (this.table_path === null) {\n throw new RbqlIOHandlingError(`Unable to find join table \"${table_id}\"`);\n }\n if (this.options && this.options['bulk_read']) {\n this.bulk_input_path = this.table_path;\n } else {\n this.stream = fs.createReadStream(this.table_path);\n }\n this.record_iterator = new rbql_csv.CSVRecordIterator(this.stream, this.bulk_input_path, this.encoding, this.delim, this.policy, this.has_header, this.comment_prefix, table_id, 'b');\n return this.record_iterator;\n };\n\n get_warnings(output_warnings) {\n if (this.record_iterator && this.has_header) {\n output_warnings.push(`The first record in JOIN file ${path.basename(this.table_path)} was also treated as header (and skipped)`);\n }\n }\n}\n\n\nasync function rbql_query_node(vscode_global_state, query_text, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, output_warnings, with_headers=false, comment_prefix=null, user_init_code='', options=null) {\n let input_stream = null;\n let bulk_input_path = null;\n if (options && options['bulk_read'] && input_path) {\n bulk_input_path = input_path;\n } else {\n input_stream = input_path === null ? process.stdin : fs.createReadStream(input_path);\n }\n let [output_stream, close_output_on_finish] = output_path === null ? [process.stdout, false] : [fs.createWriteStream(output_path), true];\n if (input_delim == '\"' && input_policy == 'quoted')\n throw new RbqlIOHandlingError('Double quote delimiter is incompatible with \"quoted\" policy');\n if (csv_encoding == 'latin-1')\n csv_encoding = 'binary';\n if (!rbql_csv.is_ascii(query_text) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n if ((!rbql_csv.is_ascii(input_delim) || !rbql_csv.is_ascii(output_delim)) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n\n let default_init_source_path = path.join(os.homedir(), '.rbql_init_source.js');\n if (user_init_code == '' && fs.existsSync(default_init_source_path)) {\n user_init_code = rbql_csv.read_user_init_code(default_init_source_path);\n }\n let input_file_dir = input_path ? path.dirname(input_path) : null;\n let join_tables_registry = new VSCodeFileSystemCSVRegistry(vscode_global_state, input_file_dir, input_delim, input_policy, csv_encoding, with_headers, comment_prefix, options);\n let input_iterator = new rbql_csv.CSVRecordIterator(input_stream, bulk_input_path, csv_encoding, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new rbql_csv.CSVWriter(output_stream, close_output_on_finish, csv_encoding, output_delim, output_policy);\n\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n join_tables_registry.get_warnings(output_warnings);\n}\n\n\nmodule.exports.make_table_name_key = make_table_name_key;\nmodule.exports.find_table_path = find_table_path;\nmodule.exports.read_header = read_header;\nmodule.exports.rbql_query_web = rbql_query_web;\nmodule.exports.rbql_query_node = rbql_query_node;\nmodule.exports.get_header_line = get_header_line;\nmodule.exports.populate_optimistic_rfc_csv_record_map = populate_optimistic_rfc_csv_record_map;\nmodule.exports.get_default_js_udf_content = get_default_js_udf_content;\nmodule.exports.get_default_python_udf_content = get_default_python_udf_content;\nmodule.exports.align_columns = align_columns;\nmodule.exports.shrink_columns = shrink_columns;\nmodule.exports.calc_column_stats = calc_column_stats;\nmodule.exports.adjust_column_stats = adjust_column_stats;\nmodule.exports.update_subcomponent_stats = update_subcomponent_stats;\nmodule.exports.align_field = align_field;\n","let field_regular_expression = '\"((?:[^\"]*\"\")*[^\"]*)\"';\nlet field_rgx = new RegExp('^' + field_regular_expression);\nlet field_rgx_external_whitespaces = new RegExp('^ *' + field_regular_expression + ' *');\n\n\n// TODO consider making this file (and rbql.js) both node and browser compatible: https://caolan.org/posts/writing_for_node_and_the_browser.html\n\n\nfunction split_lines(text) {\n return text.split(/\\r\\n|\\r|\\n/);\n}\n\n\nfunction extract_next_field(src, dlm, preserve_quotes_and_whitespaces, allow_external_whitespaces, cidx, result) {\n var warning = false;\n let src_cur = src.substring(cidx);\n let rgx = allow_external_whitespaces ? field_rgx_external_whitespaces : field_rgx;\n let match_obj = rgx.exec(src_cur);\n if (match_obj !== null) {\n let match_end = match_obj[0].length;\n if (cidx + match_end == src.length || src[cidx + match_end] == dlm) {\n if (preserve_quotes_and_whitespaces) {\n result.push(match_obj[0]);\n } else {\n result.push(match_obj[1].replace(/\"\"/g, '\"'));\n }\n return [cidx + match_end + 1, false];\n }\n warning = true;\n }\n var uidx = src.indexOf(dlm, cidx);\n if (uidx == -1)\n uidx = src.length;\n var field = src.substring(cidx, uidx);\n warning = warning || field.indexOf('\"') != -1;\n result.push(field);\n return [uidx + 1, warning];\n}\n\n\nfunction split_quoted_str(src, dlm, preserve_quotes_and_whitespaces=false) {\n // This function is newline-agnostic i.e. it can also split records with multiline fields.\n if (src.indexOf('\"') == -1) // Optimization for most common case\n return [src.split(dlm), false];\n var result = [];\n var cidx = 0;\n var warning = false;\n let allow_external_whitespaces = dlm != ' ';\n while (cidx < src.length) {\n var extraction_report = extract_next_field(src, dlm, preserve_quotes_and_whitespaces, allow_external_whitespaces, cidx, result);\n cidx = extraction_report[0];\n warning = warning || extraction_report[1];\n }\n if (src.charAt(src.length - 1) == dlm)\n result.push('');\n return [result, warning];\n}\n\n\nfunction quote_field(src, delim) {\n if (src.indexOf(delim) != -1 || src.indexOf('\"') != -1) {\n var escaped = src.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n }\n return src;\n}\n\n\nfunction rfc_quote_field(src, delim) {\n if (src.indexOf(delim) != -1 || src.indexOf('\"') != -1 || src.indexOf('\\n') != -1 || src.indexOf('\\r') != -1) {\n var escaped = src.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n }\n return src;\n}\n\n\nfunction unquote_field(field) {\n let rgx = new RegExp('^' + ' *' + field_regular_expression + ' *$');\n let match_obj = rgx.exec(field);\n if (match_obj !== null) {\n return match_obj[1].replace(/\"\"/g, '\"');\n }\n return field;\n}\n\n\nfunction unquote_fields(fields) {\n return fields.map(unquote_field);\n}\n\n\nfunction split_whitespace_separated_str(src, preserve_whitespaces=false) {\n var rgxp = preserve_whitespaces ? new RegExp(' *[^ ]+ *', 'g') : new RegExp('[^ ]+', 'g');\n let result = [];\n let match_obj = null;\n while((match_obj = rgxp.exec(src)) !== null) {\n result.push(match_obj[0]);\n }\n if (preserve_whitespaces) {\n for (let i = 0; i < result.length - 1; i++) {\n result[i] = result[i].slice(0, -1);\n }\n }\n return result;\n}\n\n\nfunction smart_split(src, dlm, policy, preserve_quotes_and_whitespaces) {\n if (policy === 'simple')\n return [src.split(dlm), false];\n if (policy === 'whitespace')\n return [split_whitespace_separated_str(src, preserve_quotes_and_whitespaces), false];\n if (policy === 'monocolumn')\n return [[src], false];\n return split_quoted_str(src, dlm, preserve_quotes_and_whitespaces);\n}\n\n\nfunction accumulate_rfc_line_into_record(external_rfc_line_buffer, current_line, comment_prefix=null) {\n // Return null if the current line yields no record.\n // Return a record string if the current line yields the record and cleans the external line buffer.\n if (comment_prefix !== null && external_rfc_line_buffer.length == 0 && current_line.startsWith(comment_prefix))\n return null;\n let match_list = current_line.match(/\"/g);\n let has_unbalanced_double_quote = match_list && match_list.length % 2 == 1;\n if (external_rfc_line_buffer.length == 0 && !has_unbalanced_double_quote) {\n return current_line;\n } else if (external_rfc_line_buffer.length == 0 && has_unbalanced_double_quote) {\n external_rfc_line_buffer.push(current_line);\n } else if (!has_unbalanced_double_quote) {\n external_rfc_line_buffer.push(current_line);\n } else {\n external_rfc_line_buffer.push(current_line);\n let multiline_row = external_rfc_line_buffer.join('\\n');\n external_rfc_line_buffer.splice(0, external_rfc_line_buffer.length); // Cleanup the external buffer.\n return multiline_row;\n }\n return null;\n}\n\n\nmodule.exports.split_quoted_str = split_quoted_str;\nmodule.exports.split_whitespace_separated_str = split_whitespace_separated_str;\nmodule.exports.smart_split = smart_split;\nmodule.exports.quote_field = quote_field;\nmodule.exports.rfc_quote_field = rfc_quote_field;\nmodule.exports.unquote_field = unquote_field;\nmodule.exports.unquote_fields = unquote_fields;\nmodule.exports.split_lines = split_lines;\nmodule.exports.accumulate_rfc_line_into_record = accumulate_rfc_line_into_record;\n","(function(exports){\n// The magic line above is to make the module both browser and Node compatible, see https://stackoverflow.com/questions/3225251/how-can-i-share-code-between-node-js-and-the-browser\n\n// This module works with records only. It is CSV-agnostic.\n// Do not add CSV-related logic or variables/functions/objects like \"delim\", \"separator\" etc\n\n\nclass RbqlParsingError extends Error {}\nclass RbqlRuntimeError extends Error {}\nclass AssertionError extends Error {}\nclass RbqlIOHandlingError extends Error {}\n\n\nclass InternalBadFieldError extends Error {\n constructor(bad_idx, ...params) {\n super(...params);\n this.bad_idx = bad_idx;\n }\n}\n\n\nfunction assert(condition, message=null) {\n if (!condition) {\n if (!message) {\n message = 'Assertion error';\n }\n throw new AssertionError(message);\n }\n}\n\n\nfunction replace_all(src, search, replacement) {\n return src.split(search).join(replacement);\n}\n\n\nclass RBQLContext {\n constructor(query_text, input_iterator, output_writer, user_init_code) {\n this.query_text = query_text;\n this.input_iterator = input_iterator;\n this.writer = output_writer;\n this.user_init_code = user_init_code;\n\n this.unnest_list = null;\n this.top_count = null;\n\n this.like_regex_cache = new Map();\n\n this.sort_key_expression = null;\n\n this.aggregation_stage = 0;\n this.aggregation_key_expression = null;\n this.functional_aggregators = [];\n\n this.join_map_impl = null;\n this.join_map = null;\n this.lhs_join_var_expression = null;\n\n this.where_expression = null;\n\n this.select_expression = null;\n\n this.update_expressions = null;\n\n this.variables_init_code = null;\n }\n}\n\nvar query_context = null; // Needs to be global for MIN(), MAX(), etc functions. TODO find a way to make it local.\n\n\nconst wrong_aggregation_usage_error = 'Usage of RBQL aggregation functions inside JavaScript expressions is not allowed, see the docs';\nconst RBQL_VERSION = '0.25.0';\n\n\nfunction check_if_brackets_match(opening_bracket, closing_bracket) {\n return (opening_bracket == '[' && closing_bracket == ']') || (opening_bracket == '(' && closing_bracket == ')') || (opening_bracket == '{' && closing_bracket == '}');\n}\n\n\nfunction parse_root_bracket_level_text_spans(select_expression) {\n let text_spans = []; // parts of text separated by commas at the root parenthesis level\n let last_pos = 0;\n let bracket_stack = [];\n for (let i = 0; i < select_expression.length; i++) {\n let cur_char = select_expression[i];\n if (cur_char == ',' && bracket_stack.length == 0) {\n text_spans.push(select_expression.substring(last_pos, i));\n last_pos = i + 1;\n } else if (['[', '{', '('].indexOf(cur_char) != -1) {\n bracket_stack.push(cur_char);\n } else if ([']', '}', ')'].indexOf(cur_char) != -1) {\n if (bracket_stack.length && check_if_brackets_match(bracket_stack[bracket_stack.length - 1], cur_char)) {\n bracket_stack.pop();\n } else {\n throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching opening bracket for closing \"${cur_char}\"`);\n }\n }\n }\n if (bracket_stack.length) {\n throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching closing bracket for opening \"${bracket_stack[0]}\"`);\n }\n text_spans.push(select_expression.substring(last_pos, select_expression.length));\n text_spans = text_spans.map(span => span.trim());\n return text_spans;\n}\n\n\nfunction unquote_string(quoted_str) {\n // It's possible to use eval here to unqoute the quoted_column_name, but it would be a little barbaric, let's do it manually instead\n if (!quoted_str || quoted_str.length < 2)\n return null;\n if (quoted_str[0] == \"'\" && quoted_str[quoted_str.length - 1] == \"'\") {\n return quoted_str.substring(1, quoted_str.length - 1).replace(/\\\\'/g, \"'\").replace(/\\\\\\\\/g, \"\\\\\");\n } else if (quoted_str[0] == '\"' && quoted_str[quoted_str.length - 1] == '\"') {\n return quoted_str.substring(1, quoted_str.length - 1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, \"\\\\\");\n } else {\n return null;\n }\n}\n\n\nfunction column_info_from_text_span(text_span, string_literals) {\n // This function is a rough equivalent of \"column_info_from_node()\" function in python version of RBQL\n text_span = text_span.trim();\n let rbql_star_marker = '__RBQL_INTERNAL_STAR';\n let simple_var_match = /^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(text_span);\n let attribute_match = /^([ab])\\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(text_span);\n let subscript_int_match = /^([ab])\\[([0-9]+)\\]$/.exec(text_span);\n let subscript_str_match = /^([ab])\\[___RBQL_STRING_LITERAL([0-9]+)___\\]$/.exec(text_span);\n if (simple_var_match !== null) {\n if (text_span == rbql_star_marker)\n return {table_name: null, column_index: null, column_name: null, is_star: true};\n if (text_span.startsWith('___RBQL_STRING_LITERAL'))\n return null;\n let match = /^([ab])([0-9]+)$/.exec(text_span);\n if (match !== null) {\n return {table_name: match[1], column_index: parseInt(match[2]) - 1, column_name: null, is_star: false};\n }\n // Some examples for this branch: NR, NF\n return {table_name: null, column_index: null, column_name: text_span, is_star: false};\n } else if (attribute_match !== null) {\n let table_name = attribute_match[1];\n let column_name = attribute_match[2];\n if (column_name == rbql_star_marker) {\n return {table_name: table_name, column_index: null, column_name: null, is_star: true};\n }\n return {table_name: null, column_index: null, column_name: column_name, is_star: false};\n } else if (subscript_int_match != null) {\n let table_name = subscript_int_match[1];\n let column_index = parseInt(subscript_int_match[2]) - 1;\n return {table_name: table_name, column_index: column_index, column_name: null, is_star: false};\n } else if (subscript_str_match != null) {\n let table_name = subscript_str_match[1];\n let replaced_string_literal_id = subscript_str_match[2];\n if (replaced_string_literal_id < string_literals.length) {\n let quoted_column_name = string_literals[replaced_string_literal_id];\n let unquoted_column_name = unquote_string(quoted_column_name);\n if (unquoted_column_name !== null && unquoted_column_name !== undefined) {\n return {table_name: null, column_index: null, column_name: unquoted_column_name, is_star: false};\n }\n }\n }\n return null;\n}\n\n\nfunction adhoc_parse_select_expression_to_column_infos(select_expression, string_literals) {\n // It is acceptable for the algorithm to provide null column name when it could be theorethically possible to deduce the name.\n // I.e. this algorithm guarantees precision but doesn't guarantee completeness in all theorethically possible queries.\n // Although the algorithm should be complete in all practical scenarios, i.e. it should be hard to come up with the query that doesn't produce complete set of column names.\n // The null column name just means that the output column will be named as col{i}, so the failure to detect the proper column name can be tolerated.\n // Specifically this function guarantees the following:\n // 1. The number of column_infos is correct and will match the number of fields in each record in the output - otherwise the exception should be thrown\n // 2. If column_info at pos j is not null, it is guaranteed to correctly represent that column name in the output\n let text_spans = parse_root_bracket_level_text_spans(select_expression);\n let column_infos = text_spans.map(ts => column_info_from_text_span(ts, string_literals));\n return column_infos;\n}\n\n\nfunction stable_compare(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i])\n return a[i] < b[i] ? -1 : 1;\n }\n}\n\n\nfunction safe_get(record, idx) {\n return idx < record.length ? record[idx] : null;\n}\n\n\nfunction safe_join_get(record, idx) {\n if (idx < record.length) {\n return record[idx];\n }\n throw new InternalBadFieldError(idx);\n}\n\n\nfunction safe_set(record, idx, value) {\n if (idx < record.length) {\n record[idx] = value;\n } else {\n throw new InternalBadFieldError(idx);\n }\n}\n\n\nfunction regexp_escape(text) {\n // From here: https://stackoverflow.com/a/6969486/2898283\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched text\n}\n\n\nfunction like_to_regex(pattern) {\n let p = 0;\n let i = 0;\n let converted = '';\n while (i < pattern.length) {\n if (pattern.charAt(i) == '_' || pattern.charAt(i) == '%') {\n converted += regexp_escape(pattern.substring(p, i));\n p = i + 1;\n if (pattern.charAt(i) == '_') {\n converted += '.';\n } else {\n converted += '.*';\n }\n }\n i += 1;\n }\n converted += regexp_escape(pattern.substring(p, i));\n return '^' + converted + '$';\n}\n\n\nfunction like(text, pattern) {\n let matcher = query_context.like_regex_cache.get(pattern);\n if (matcher === undefined) {\n matcher = new RegExp(like_to_regex(pattern));\n query_context.like_regex_cache.set(pattern, matcher);\n }\n return matcher.test(text);\n}\nconst LIKE = like;\n\n\nclass RBQLAggregationToken {\n constructor(marker_id, value) {\n this.marker_id = marker_id;\n this.value = value;\n }\n\n toString() {\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n }\n}\n\n\nclass UnnestMarker {}\n\n\nfunction UNNEST(vals) {\n if (query_context.unnest_list !== null) {\n // Technically we can support multiple UNNEST's but the implementation/algorithm is more complex and just doesn't worth it\n throw new RbqlParsingError('Only one UNNEST is allowed per query');\n }\n query_context.unnest_list = vals;\n return new UnnestMarker();\n}\nconst unnest = UNNEST;\nconst Unnest = UNNEST;\nconst UNFOLD = UNNEST; // \"UNFOLD\" is deprecated, just for backward compatibility\n\n\nfunction parse_number(val) {\n // We can do a more pedantic number test like `/^ *-{0,1}[0-9]+\\.{0,1}[0-9]* *$/.test(val)`, but user will probably use just Number(val) or parseInt/parseFloat\n let result = Number(val);\n if (isNaN(result)) {\n throw new RbqlRuntimeError(`Unable to convert value \"${val}\" to a number. MIN, MAX, SUM, AVG, MEDIAN and VARIANCE aggregate functions convert their string arguments to numeric values`);\n }\n return result;\n}\n\n\nclass MinAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, Math.min(cur_aggr, val));\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\n\nclass MaxAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, Math.max(cur_aggr, val));\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass SumAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, val);\n } else {\n this.stats.set(key, cur_aggr + val);\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass AvgAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val, 1]);\n } else {\n var cur_sum = cur_aggr[0];\n var cur_cnt = cur_aggr[1];\n this.stats.set(key, [cur_sum + val, cur_cnt + 1]);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n var cur_sum = cur_aggr[0];\n var cur_cnt = cur_aggr[1];\n var avg = cur_sum / cur_cnt;\n return avg;\n }\n}\n\n\nclass VarianceAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val, val * val, 1]);\n } else {\n var cur_sum = cur_aggr[0];\n var cur_sum_sq = cur_aggr[1];\n var cur_cnt = cur_aggr[2];\n this.stats.set(key, [cur_sum + val, cur_sum_sq + val * val, cur_cnt + 1]);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n var cur_sum = cur_aggr[0];\n var cur_sum_sq = cur_aggr[1];\n var cur_cnt = cur_aggr[2];\n var avg_val = cur_sum / cur_cnt;\n var variance = cur_sum_sq / cur_cnt - avg_val * avg_val;\n return variance;\n }\n}\n\n\nclass MedianAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n val = parse_number(val);\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val]);\n } else {\n cur_aggr.push(val);\n }\n }\n\n get_final(key) {\n var cur_aggr = this.stats.get(key);\n cur_aggr.sort(function(a, b) { return a - b; });\n var m = Math.floor(cur_aggr.length / 2);\n if (cur_aggr.length % 2) {\n return cur_aggr[m];\n } else {\n return (cur_aggr[m - 1] + cur_aggr[m]) / 2.0;\n }\n }\n}\n\n\nclass CountAggregator {\n constructor() {\n this.stats = new Map();\n }\n\n increment(key, val) {\n var cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, 1);\n } else {\n this.stats.set(key, cur_aggr + 1);\n }\n }\n\n get_final(key) {\n return this.stats.get(key);\n }\n}\n\n\nclass ArrayAggAggregator {\n constructor(post_proc=null) {\n this.post_proc = post_proc;\n this.stats = new Map();\n }\n\n increment(key, val) {\n let cur_aggr = this.stats.get(key);\n if (cur_aggr === undefined) {\n this.stats.set(key, [val]);\n } else {\n cur_aggr.push(val);\n }\n }\n\n get_final(key) {\n let cur_aggr = this.stats.get(key);\n if (this.post_proc === null)\n return cur_aggr;\n return this.post_proc(cur_aggr);\n }\n}\n\n\nclass ConstGroupVerifier {\n constructor(output_index) {\n this.output_index = output_index;\n this.const_values = new Map();\n }\n\n increment(key, value) {\n var old_value = this.const_values.get(key);\n if (old_value === undefined) {\n this.const_values.set(key, value);\n } else if (old_value != value) {\n throw new RbqlRuntimeError(`Invalid aggregate expression: non-constant values in output column ${this.output_index + 1}. E.g. \"${old_value}\" and \"${value}\"`);\n }\n }\n\n get_final(key) {\n return this.const_values.get(key);\n }\n}\n\n\nfunction init_aggregator(generator_name, val, post_proc=null) {\n query_context.aggregation_stage = 1;\n var res = new RBQLAggregationToken(query_context.functional_aggregators.length, val);\n if (post_proc === null) {\n query_context.functional_aggregators.push(new generator_name());\n } else {\n query_context.functional_aggregators.push(new generator_name(post_proc));\n }\n return res;\n}\n\n\nfunction MIN(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MinAggregator, val) : val;\n}\nconst min = MIN;\nconst Min = MIN;\n\n\nfunction MAX(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MaxAggregator, val) : val;\n}\nconst max = MAX;\nconst Max = MAX;\n\nfunction COUNT(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(CountAggregator, 1) : 1;\n}\nconst count = COUNT;\nconst Count = COUNT;\n\nfunction SUM(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(SumAggregator, val) : val;\n}\nconst sum = SUM;\nconst Sum = SUM;\n\nfunction AVG(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(AvgAggregator, val) : val;\n}\nconst avg = AVG;\nconst Avg = AVG;\n\nfunction VARIANCE(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(VarianceAggregator, val) : val;\n}\nconst variance = VARIANCE;\nconst Variance = VARIANCE;\n\nfunction MEDIAN(val) {\n return query_context.aggregation_stage < 2 ? init_aggregator(MedianAggregator, val) : val;\n}\nconst median = MEDIAN;\nconst Median = MEDIAN;\n\nfunction ARRAY_AGG(val, post_proc=null) {\n return query_context.aggregation_stage < 2 ? init_aggregator(ArrayAggAggregator, val, post_proc) : val;\n}\nconst array_agg = ARRAY_AGG;\nconst FOLD = ARRAY_AGG; // \"FOLD\" is deprecated, just for backward compatibility\n\n\nfunction add_to_set(dst_set, value) {\n var len_before = dst_set.size;\n dst_set.add(value);\n return len_before != dst_set.size;\n}\n\n\nclass TopWriter {\n constructor(subwriter, top_count) {\n this.subwriter = subwriter;\n this.NW = 0;\n this.top_count = top_count;\n }\n\n async write(record) {\n if (this.top_count !== null && this.NW >= this.top_count)\n return false;\n await this.subwriter.write(record);\n this.NW += 1;\n return true;\n }\n\n async finish() {\n await this.subwriter.finish();\n }\n}\n\n\nclass UniqWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.seen = new Set();\n }\n\n async write(record) {\n if (!add_to_set(this.seen, JSON.stringify(record)))\n return true;\n if (!await this.subwriter.write(record))\n return false;\n return true;\n }\n\n async finish() {\n await this.subwriter.finish();\n }\n}\n\n\nclass UniqCountWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.records = new Map();\n }\n\n async write(record) {\n var key = JSON.stringify(record);\n var old_val = this.records.get(key);\n if (old_val) {\n old_val[0] += 1;\n } else {\n this.records.set(key, [1, record]);\n }\n return true;\n }\n\n async finish() {\n for (var [key, value] of this.records) {\n let [count, record] = value;\n record.unshift(count);\n if (!await this.subwriter.write(record))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass SortedWriter {\n constructor(subwriter, reverse_sort) {\n this.subwriter = subwriter;\n this.reverse_sort = reverse_sort;\n this.unsorted_entries = [];\n }\n\n async write(stable_entry) {\n this.unsorted_entries.push(stable_entry);\n return true;\n }\n\n async finish() {\n var unsorted_entries = this.unsorted_entries;\n unsorted_entries.sort(stable_compare);\n if (this.reverse_sort)\n unsorted_entries.reverse();\n for (var i = 0; i < unsorted_entries.length; i++) {\n var entry = unsorted_entries[i];\n if (!await this.subwriter.write(entry[entry.length - 1]))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass AggregateWriter {\n constructor(subwriter) {\n this.subwriter = subwriter;\n this.aggregators = [];\n this.aggregation_keys = new Set();\n }\n\n async finish() {\n var all_keys = Array.from(this.aggregation_keys);\n all_keys.sort();\n for (var i = 0; i < all_keys.length; i++) {\n var key = all_keys[i];\n var out_fields = [];\n for (var ag of this.aggregators) {\n out_fields.push(ag.get_final(key));\n }\n if (!await this.subwriter.write(out_fields))\n break;\n }\n await this.subwriter.finish();\n }\n}\n\n\nclass InnerJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n }\n\n get_rhs(lhs_key) {\n return this.join_map.get_join_records(lhs_key);\n }\n}\n\n\nclass LeftJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n this.null_record = [[null, join_map.max_record_len, Array(join_map.max_record_len).fill(null)]];\n }\n\n get_rhs(lhs_key) {\n let result = this.join_map.get_join_records(lhs_key);\n if (result.length == 0) {\n return this.null_record;\n }\n return result;\n }\n}\n\n\nclass StrictLeftJoiner {\n constructor(join_map) {\n this.join_map = join_map;\n }\n\n get_rhs(lhs_key) {\n let result = this.join_map.get_join_records(lhs_key);\n if (result.length != 1) {\n throw new RbqlRuntimeError('In \"STRICT LEFT JOIN\" each key in A must have exactly one match in B. Bad A key: \"' + lhs_key + '\"');\n }\n return result;\n }\n}\n\n\nfunction select_except(src, except_fields) {\n let result = [];\n for (let i = 0; i < src.length; i++) {\n if (except_fields.indexOf(i) == -1)\n result.push(src[i]);\n }\n return result;\n}\n\n\nasync function select_simple(sort_key, NR, out_fields) {\n if (query_context.sort_key_expression !== null) {\n var sort_entry = sort_key.concat([NR, out_fields]);\n if (!await query_context.writer.write(sort_entry))\n return false;\n } else {\n if (!await query_context.writer.write(out_fields))\n return false;\n }\n return true;\n}\n\n\nfunction select_aggregated(key, transparent_values) {\n if (key !== null) {\n key = JSON.stringify(key);\n }\n if (query_context.aggregation_stage === 1) {\n if (!(query_context.writer instanceof TopWriter)) {\n throw new RbqlParsingError('\"ORDER BY\", \"UPDATE\" and \"DISTINCT\" keywords are not allowed in aggregate queries');\n }\n query_context.writer = new AggregateWriter(query_context.writer);\n let num_aggregators_found = 0;\n for (var i = 0; i < transparent_values.length; i++) {\n var trans_value = transparent_values[i];\n if (trans_value instanceof RBQLAggregationToken) {\n query_context.writer.aggregators.push(query_context.functional_aggregators[trans_value.marker_id]);\n query_context.writer.aggregators[query_context.writer.aggregators.length - 1].increment(key, trans_value.value);\n num_aggregators_found += 1;\n } else {\n query_context.writer.aggregators.push(new ConstGroupVerifier(query_context.writer.aggregators.length));\n query_context.writer.aggregators[query_context.writer.aggregators.length - 1].increment(key, trans_value);\n }\n }\n if (num_aggregators_found != query_context.functional_aggregators.length) {\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n }\n query_context.aggregation_stage = 2;\n } else {\n for (var i = 0; i < transparent_values.length; i++) {\n var trans_value = transparent_values[i];\n query_context.writer.aggregators[i].increment(key, trans_value);\n }\n }\n query_context.writer.aggregation_keys.add(key);\n}\n\n\nasync function select_unnested(sort_key, NR, folded_fields) {\n let out_fields = folded_fields.slice();\n let unnest_pos = folded_fields.findIndex(val => val instanceof UnnestMarker);\n for (var i = 0; i < query_context.unnest_list.length; i++) {\n out_fields[unnest_pos] = query_context.unnest_list[i];\n if (!await select_simple(sort_key, NR, out_fields.slice()))\n return false;\n }\n return true;\n}\n\n\nconst 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`;\n\n\nconst PROCESS_SELECT_SIMPLE = `\nlet star_fields = record_a;\n__CODE__\n`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nconst 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`;\n\n\nfunction embed_expression(parent_code, child_placeholder, child_expression) {\n return replace_all(parent_code, child_placeholder, child_expression);\n}\n\n\nfunction embed_code(parent_code, child_placeholder, child_code) {\n let parent_lines = parent_code.split('\\n');\n let child_lines = child_code.split('\\n');\n for (let i = 0; i < parent_lines.length; i++) {\n let pos = parent_lines[i].indexOf(child_placeholder);\n if (pos == -1)\n continue;\n assert(pos % 4 == 0);\n let placeholder_indentation = parent_lines[i].substring(0, pos);\n child_lines = child_lines.map(l => placeholder_indentation + l);\n let result_lines = parent_lines.slice(0, i).concat(child_lines).concat(parent_lines.slice(i + 1));\n return result_lines.join('\\n') + '\\n';\n }\n assert(false);\n}\n\n\nfunction generate_main_loop_code(query_context) {\n let is_select_query = query_context.select_expression !== null;\n let is_join_query = query_context.join_map !== null;\n let where_expression = query_context.where_expression === null ? 'true' : query_context.where_expression;\n let aggregation_key_expression = query_context.aggregation_key_expression === null ? 'null' : query_context.aggregation_key_expression;\n let sort_key_expression = query_context.sort_key_expression === null ? 'null' : query_context.sort_key_expression;\n let js_code = embed_code(MAIN_LOOP_BODY, '__USER_INIT_CODE__', query_context.user_init_code);\n if (is_select_query) {\n if (is_join_query) {\n js_code = embed_code(embed_code(js_code, '__CODE__', PROCESS_SELECT_JOIN), '__CODE__', PROCESS_SELECT_COMMON);\n js_code = embed_expression(js_code, '__RBQLMP__lhs_join_var_expression', query_context.lhs_join_var_expression);\n } else {\n js_code = embed_code(embed_code(js_code, '__CODE__', PROCESS_SELECT_SIMPLE), '__CODE__', PROCESS_SELECT_COMMON);\n }\n js_code = embed_code(js_code, '__RBQLMP__variables_init_code', query_context.variables_init_code);\n js_code = embed_expression(js_code, '__RBQLMP__select_expression', query_context.select_expression);\n js_code = embed_expression(js_code, '__RBQLMP__where_expression', where_expression);\n js_code = embed_expression(js_code, '__RBQLMP__aggregation_key_expression', aggregation_key_expression);\n js_code = embed_expression(js_code, '__RBQLMP__sort_key_expression', sort_key_expression);\n } else {\n if (is_join_query) {\n js_code = embed_code(js_code, '__CODE__', PROCESS_UPDATE_JOIN);\n js_code = embed_expression(js_code, '__RBQLMP__lhs_join_var_expression', query_context.lhs_join_var_expression);\n } else {\n js_code = embed_code(js_code, '__CODE__', PROCESS_UPDATE_SIMPLE);\n }\n js_code = embed_code(js_code, '__RBQLMP__variables_init_code', query_context.variables_init_code);\n js_code = embed_code(js_code, '__RBQLMP__update_expressions', query_context.update_expressions);\n js_code = embed_expression(js_code, '__RBQLMP__where_expression', where_expression);\n }\n return \"(async () => {\" + js_code + \"})()\";\n}\n\n\nasync function compile_and_run(query_context) {\n let main_loop_body = generate_main_loop_code(query_context);\n try {\n let main_loop_promise = eval(main_loop_body);\n await main_loop_promise;\n } catch (e) {\n if (e instanceof SyntaxError) {\n // SyntaxError's from eval() function do not contain detailed explanation of what has caused the syntax error, so to guess what was wrong we can only use the original query\n // v8 issue to fix eval: https://bugs.chromium.org/p/v8/issues/detail?id=2589\n let lower_case_query = query_context.query_text.toLowerCase();\n if (lower_case_query.indexOf(' having ') != -1)\n throw new SyntaxError(e.message + \"\\nRBQL doesn't support \\\"HAVING\\\" keyword\");\n if (lower_case_query.indexOf(' like ') != -1)\n throw new SyntaxError(e.message + \"\\nRBQL doesn't support \\\"LIKE\\\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... \"); // UT JSON\n if (lower_case_query.indexOf(' from ') != -1)\n throw new SyntaxError(e.message + \"\\nTip: If input table is defined by the environment, RBQL query should not have \\\"FROM\\\" keyword\"); // UT JSON\n if (e && e.message && String(e.message).toLowerCase().indexOf('unexpected identifier') != -1) {\n if (lower_case_query.indexOf(' and ') != -1)\n throw new SyntaxError(e.message + \"\\nDid you use 'and' keyword in your query?\\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!\");\n if (lower_case_query.indexOf(' or ') != -1)\n throw new SyntaxError(e.message + \"\\nDid you use 'or' keyword in your query?\\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!\");\n }\n }\n if (e && e.message && e.message.indexOf('Received an instance of RBQLAggregationToken') != -1)\n throw new RbqlParsingError(wrong_aggregation_usage_error);\n throw e;\n }\n}\n\n\nconst GROUP_BY = 'GROUP BY';\nconst UPDATE = 'UPDATE';\nconst SELECT = 'SELECT';\nconst JOIN = 'JOIN';\nconst INNER_JOIN = 'INNER JOIN';\nconst LEFT_JOIN = 'LEFT JOIN';\nconst LEFT_OUTER_JOIN = 'LEFT OUTER JOIN';\nconst STRICT_LEFT_JOIN = 'STRICT LEFT JOIN';\nconst ORDER_BY = 'ORDER BY';\nconst WHERE = 'WHERE';\nconst LIMIT = 'LIMIT';\nconst EXCEPT = 'EXCEPT';\nconst WITH = 'WITH';\n\n\nfunction get_ambiguous_error_msg(variable_name) {\n return `Ambiguous variable name: \"${variable_name}\" is present both in input and in join tables`;\n}\n\n\nfunction get_all_matches(regexp, text) {\n var result = [];\n let match_obj = null;\n while((match_obj = regexp.exec(text)) !== null) {\n result.push(match_obj);\n }\n return result;\n}\n\n\nfunction str_strip(src) {\n return src.replace(/^ +| +$/g, '');\n}\n\n\nfunction strip_comments(cline) {\n cline = cline.trim();\n if (cline.startsWith('//'))\n return '';\n return cline;\n}\n\n\nfunction combine_string_literals(backend_expression, string_literals) {\n for (var i = 0; i < string_literals.length; i++) {\n backend_expression = replace_all(backend_expression, `___RBQL_STRING_LITERAL${i}___`, string_literals[i]);\n }\n return backend_expression;\n}\n\n\nfunction parse_basic_variables(query_text, prefix, dst_variables_map) {\n assert(prefix == 'a' || prefix == 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}([1-9][0-9]*)(?:$|(?=[^_a-zA-Z0-9]))`, 'g');\n let matches = get_all_matches(rgx, query_text);\n for (let i = 0; i < matches.length; i++) {\n let field_num = parseInt(matches[i][1]);\n dst_variables_map[prefix + String(field_num)] = {initialize: true, index: field_num - 1};\n }\n}\n\n\nfunction parse_array_variables(query_text, prefix, dst_variables_map) {\n assert(prefix == 'a' || prefix == 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\[([1-9][0-9]*)\\\\]`, 'g');\n let matches = get_all_matches(rgx, query_text);\n for (let i = 0; i < matches.length; i++) {\n let field_num = parseInt(matches[i][1]);\n dst_variables_map[`${prefix}[${field_num}]`] = {initialize: true, index: field_num - 1};\n }\n}\n\n\nfunction js_string_escape_column_name(column_name, quote_char) {\n column_name = column_name.replace(/\\\\/g, '\\\\\\\\');\n column_name = column_name.replace(/\\n/g, '\\\\n');\n column_name = column_name.replace(/\\r/g, '\\\\r');\n column_name = column_name.replace(/\\t/g, '\\\\t');\n if (quote_char === \"'\")\n return column_name.replace(/'/g, \"\\\\'\");\n if (quote_char === '\"')\n return column_name.replace(/\"/g, '\\\\\"');\n assert(quote_char === \"`\");\n return column_name.replace(/`/g, \"\\\\`\");\n}\n\n\nfunction query_probably_has_dictionary_variable(query_text, column_name) {\n let rgx = new RegExp('[-a-zA-Z0-9_:;+=!.,()%^#@&* ]+', 'g');\n let continuous_name_segments = get_all_matches(rgx, column_name);\n for (let continuous_segment of continuous_name_segments) {\n if (query_text.indexOf(continuous_segment) == -1)\n return false;\n }\n return true;\n}\n\n\nfunction parse_dictionary_variables(query_text, prefix, column_names, dst_variables_map) {\n // The purpose of this algorithm is to minimize number of variables in varibale_map to improve performance, ideally it should be only variables from the query\n\n // FIXME to prevent typos in attribute names either use query-based variable parsing which can properly handle back-tick strings or wrap \"a\" and \"b\" variables with ES6 Proxies https://stackoverflow.com/a/25658975/2898283\n assert(prefix === 'a' || prefix === 'b');\n let dict_test_rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\[`);\n if (query_text.search(dict_test_rgx) == -1)\n return;\n for (let i = 0; i < column_names.length; i++) {\n let column_name = column_names[i];\n if (query_probably_has_dictionary_variable(query_text, column_name)) {\n let escaped_column_name = js_string_escape_column_name(column_name, '\"');\n dst_variables_map[`${prefix}[\"${escaped_column_name}\"]`] = {initialize: true, index: i};\n escaped_column_name = js_string_escape_column_name(column_name, \"'\");\n dst_variables_map[`${prefix}['${escaped_column_name}']`] = {initialize: false, index: i};\n escaped_column_name = js_string_escape_column_name(column_name, \"`\");\n dst_variables_map[`${prefix}[\\`${escaped_column_name}\\`]`] = {initialize: false, index: i};\n }\n }\n}\n\n\nfunction parse_attribute_variables(query_text, prefix, column_names, column_names_source, dst_variables_map) {\n // The purpose of this algorithm is to minimize number of variables in varibale_map to improve performance, ideally it should be only variables from the query\n\n assert(prefix === 'a' || prefix === 'b');\n let rgx = new RegExp(`(?:^|[^_a-zA-Z0-9])${prefix}\\\\.([_a-zA-Z][_a-zA-Z0-9]*)`, 'g');\n let matches = get_all_matches(rgx, query_text);\n let column_names_from_query = matches.map(v => v[1]);\n for (let column_name of column_names_from_query) {\n let zero_based_idx = column_names.indexOf(column_name);\n if (zero_based_idx != -1) {\n dst_variables_map[`${prefix}.${column_name}`] = {initialize: true, index: zero_based_idx};\n } else {\n throw new RbqlParsingError(`Unable to find column \"${column_name}\" in ${prefix == 'a' ? 'input' : 'join'} ${column_names_source}`);\n }\n }\n}\n\n\nfunction map_variables_directly(query_text, column_names, dst_variables_map) {\n for (let i = 0; i < column_names.length; i++) {\n let column_name = column_names[i];\n if ( /^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(column_name) === null)\n throw new RbqlIOHandlingError(`Unable to use column name \"${column_name}\" as RBQL/JS variable`);\n if (query_text.indexOf(column_name) != -1)\n dst_variables_map[column_name] = {initialize: true, index: i};\n }\n}\n\n\nfunction ensure_no_ambiguous_variables(query_text, input_column_names, join_column_names) {\n let join_column_names_set = new Set(join_column_names);\n for (let column_name of input_column_names) {\n if (join_column_names_set.has(column_name) && query_text.indexOf(column_name) != -1) // False positive is tolerable here\n throw new RbqlParsingError(get_ambiguous_error_msg(column_name));\n }\n}\n\n\nfunction parse_join_expression(src) {\n src = str_strip(src);\n const invalid_join_syntax_error = 'Invalid join syntax. Valid syntax: /path/to/B/table on a... == b... [and a... == b... [and ... ]]';\n let rgx = /^ *([^ ]+) +on +/i;\n let match = rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n let table_id = match[1];\n src = src.substr(match[0].length);\n\n let variable_pairs = [];\n var pair_rgx = /^([^ =]+) *==? *([^ =]+)/;\n var and_rgx = /^ +(and|&&) +/i;\n while (true) {\n match = pair_rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n variable_pairs.push([match[1], match[2]]);\n src = src.substr(match[0].length);\n if (!src.length)\n break;\n match = and_rgx.exec(src);\n if (match === null)\n throw new RbqlParsingError(invalid_join_syntax_error);\n src = src.substr(match[0].length);\n }\n return [table_id, variable_pairs];\n}\n\n\nfunction resolve_join_variables(input_variables_map, join_variables_map, variable_pairs, string_literals) {\n let lhs_variables = [];\n let rhs_indices = [];\n const valid_join_syntax_msg = 'Valid JOIN syntax: /path/to/B/table on a... == b... [and a... == b... [and ... ]]';\n for (let variable_pair of variable_pairs) {\n let [join_var_1, join_var_2] = variable_pair;\n join_var_1 = combine_string_literals(join_var_1, string_literals);\n join_var_2 = combine_string_literals(join_var_2, string_literals);\n if (input_variables_map.hasOwnProperty(join_var_1) && join_variables_map.hasOwnProperty(join_var_1))\n throw new RbqlParsingError(get_ambiguous_error_msg(join_var_1));\n if (input_variables_map.hasOwnProperty(join_var_2) && join_variables_map.hasOwnProperty(join_var_2))\n throw new RbqlParsingError(get_ambiguous_error_msg(join_var_2));\n if (input_variables_map.hasOwnProperty(join_var_2))\n [join_var_1, join_var_2] = [join_var_2, join_var_1];\n\n let [lhs_key_index, rhs_key_index] = [null, null];\n if (['NR', 'a.NR', 'aNR'].indexOf(join_var_1) != -1) {\n lhs_key_index = -1;\n } else if (input_variables_map.hasOwnProperty(join_var_1)) {\n lhs_key_index = input_variables_map[join_var_1].index;\n } else {\n throw new RbqlParsingError(`Unable to parse JOIN expression: Input table does not have field \"${join_var_1}\"\\n${valid_join_syntax_msg}`);\n }\n\n if (['b.NR', 'bNR'].indexOf(join_var_2) != -1) {\n rhs_key_index = -1;\n } else if (join_variables_map.hasOwnProperty(join_var_2)) {\n rhs_key_index = join_variables_map[join_var_2].index;\n } else {\n throw new RbqlParsingError(`Unable to parse JOIN expression: Join table does not have field \"${join_var_2}\"\\n${valid_join_syntax_msg}`);\n }\n\n let lhs_join_var_expression = lhs_key_index == -1 ? 'NR' : `safe_join_get(record_a, ${lhs_key_index})`;\n rhs_indices.push(rhs_key_index);\n lhs_variables.push(lhs_join_var_expression);\n }\n return [lhs_variables, rhs_indices];\n}\n\n\nfunction generate_common_init_code(query_text, variable_prefix) {\n assert(variable_prefix == 'a' || variable_prefix == 'b');\n let result = [];\n result.push(`${variable_prefix} = new Object();`);\n let base_var = variable_prefix == 'a' ? 'NR' : 'bNR';\n let attr_var = `${variable_prefix}.NR`;\n if (query_text.indexOf(attr_var) != -1)\n result.push(`${attr_var} = ${base_var};`);\n if (variable_prefix == 'a' && query_text.indexOf('aNR') != -1)\n result.push('aNR = NR;');\n return result;\n}\n\n\nfunction generate_init_statements(query_text, variables_map, join_variables_map, indent) {\n let code_lines = generate_common_init_code(query_text, 'a');\n let simple_var_name_rgx = /^[_0-9a-zA-Z]+$/;\n for (const [variable_name, var_info] of Object.entries(variables_map)) {\n if (var_info.initialize) {\n let variable_declaration_keyword = simple_var_name_rgx.exec(variable_name) ? 'var ' : '';\n code_lines.push(`${variable_declaration_keyword}${variable_name} = safe_get(record_a, ${var_info.index});`);\n }\n }\n if (join_variables_map) {\n code_lines = code_lines.concat(generate_common_init_code(query_text, 'b'));\n for (const [variable_name, var_info] of Object.entries(join_variables_map)) {\n if (var_info.initialize) {\n let variable_declaration_keyword = simple_var_name_rgx.exec(variable_name) ? 'var ' : '';\n code_lines.push(`${variable_declaration_keyword}${variable_name} = record_b === null ? null : safe_get(record_b, ${var_info.index});`);\n }\n }\n }\n for (let i = 1; i < code_lines.length; i++) {\n code_lines[i] = indent + code_lines[i];\n }\n return code_lines.join('\\n');\n}\n\n\nfunction replace_star_count(aggregate_expression) {\n var rgx = /(^|,) *COUNT\\( *\\* *\\) *(?:$|(?=,))/ig;\n var result = aggregate_expression.replace(rgx, '$1 COUNT(1)');\n return str_strip(result);\n}\n\n\nfunction replace_star_vars(rbql_expression) {\n let star_rgx = /(?:^|,) *(\\*|a\\.\\*|b\\.\\*) *(?=$|,)/g;\n let matches = get_all_matches(star_rgx, rbql_expression);\n let last_pos = 0;\n let result = '';\n for (let match of matches) {\n let star_expression = match[1];\n let replacement_expression = ']).concat(' + {'*': 'star_fields', 'a.*': 'record_a', 'b.*': 'record_b'}[star_expression] + ').concat([';\n if (last_pos < match.index)\n result += rbql_expression.substring(last_pos, match.index);\n result += replacement_expression;\n last_pos = match.index + match[0].length + 1; // Adding one to skip the lookahead comma\n }\n result += rbql_expression.substring(last_pos);\n return result;\n}\n\n\nfunction replace_star_vars_for_header_parsing(rbql_expression) {\n let star_rgx = /(?:(?<=^)|(?<=,)) *(\\*|a\\.\\*|b\\.\\*) *(?=$|,)/g;\n let matches = get_all_matches(star_rgx, rbql_expression);\n let last_pos = 0;\n let result = '';\n for (let match of matches) {\n let star_expression = match[1];\n let replacement_expression = {'*': '__RBQL_INTERNAL_STAR', 'a.*': 'a.__RBQL_INTERNAL_STAR', 'b.*': 'b.__RBQL_INTERNAL_STAR'}[star_expression];\n if (last_pos < match.index)\n result += rbql_expression.substring(last_pos, match.index);\n result += replacement_expression;\n last_pos = match.index + match[0].length;\n }\n result += rbql_expression.substring(last_pos);\n return result;\n}\n\n\nfunction translate_update_expression(update_expression, input_variables_map, string_literals, indent) {\n let first_assignment = str_strip(update_expression.split('=')[0]);\n let first_assignment_error = `Unable to parse \"UPDATE\" expression: the expression must start with assignment, but \"${first_assignment}\" does not look like an assignable field name`;\n\n let assignment_looking_rgx = /(?:^|,) *(a[.#a-zA-Z0-9\\[\\]_]*) *=(?=[^=])/g;\n let update_expressions = [];\n let pos = 0;\n while (true) {\n let match = assignment_looking_rgx.exec(update_expression);\n if (update_expressions.length == 0 && (match === null || match.index != 0)) {\n throw new RbqlParsingError(first_assignment_error);\n }\n if (match === null) {\n update_expressions[update_expressions.length - 1] += str_strip(update_expression.substr(pos)) + ');';\n break;\n }\n if (update_expressions.length)\n update_expressions[update_expressions.length - 1] += str_strip(update_expression.substring(pos, match.index)) + ');';\n let dst_var_name = combine_string_literals(str_strip(match[1]), string_literals);\n if (!input_variables_map.hasOwnProperty(dst_var_name))\n throw new RbqlParsingError(`Unable to parse \"UPDATE\" expression: Unknown field name: \"${dst_var_name}\"`);\n let var_index = input_variables_map[dst_var_name].index;\n let current_indent = update_expressions.length ? indent : '';\n update_expressions.push(`${current_indent}safe_set(up_fields, ${var_index}, `);\n pos = match.index + match[0].length;\n }\n return combine_string_literals(update_expressions.join('\\n'), string_literals);\n}\n\n\nfunction translate_select_expression(select_expression) {\n let expression_without_stars = replace_star_count(select_expression);\n let translated = str_strip(replace_star_vars(expression_without_stars));\n let translated_for_header = str_strip(replace_star_vars_for_header_parsing(expression_without_stars));\n if (!translated.length)\n throw new RbqlParsingError('\"SELECT\" expression is empty');\n return [`[].concat([${translated}])`, translated_for_header];\n}\n\n\nfunction separate_string_literals(rbql_expression) {\n // The regex consists of 3 almost identicall parts, the only difference is quote type\n var rgx = /('(\\\\(\\\\\\\\)*'|[^'])*')|(\"(\\\\(\\\\\\\\)*\"|[^\"])*\")|(`(\\\\(\\\\\\\\)*`|[^`])*`)/g;\n var match_obj = null;\n var format_parts = [];\n var string_literals = [];\n var idx_before = 0;\n while((match_obj = rgx.exec(rbql_expression)) !== null) {\n var literal_id = string_literals.length;\n var string_literal = match_obj[0];\n string_literals.push(string_literal);\n var start_index = match_obj.index;\n format_parts.push(rbql_expression.substring(idx_before, start_index));\n format_parts.push(`___RBQL_STRING_LITERAL${literal_id}___`);\n idx_before = rgx.lastIndex;\n }\n format_parts.push(rbql_expression.substring(idx_before));\n var format_expression = format_parts.join('');\n format_expression = format_expression.replace(/\\t/g, ' ');\n return [format_expression, string_literals];\n}\n\n\nfunction locate_statements(rbql_expression) {\n let statement_groups = [];\n statement_groups.push([STRICT_LEFT_JOIN, LEFT_OUTER_JOIN, LEFT_JOIN, INNER_JOIN, JOIN]);\n statement_groups.push([SELECT]);\n statement_groups.push([ORDER_BY]);\n statement_groups.push([WHERE]);\n statement_groups.push([UPDATE]);\n statement_groups.push([GROUP_BY]);\n statement_groups.push([LIMIT]);\n statement_groups.push([EXCEPT]);\n var result = [];\n for (var ig = 0; ig < statement_groups.length; ig++) {\n for (var is = 0; is < statement_groups[ig].length; is++) {\n var statement = statement_groups[ig][is];\n var rgxp = new RegExp('(?:^| )' + replace_all(statement, ' ', ' *') + '(?= )', 'ig');\n var matches = get_all_matches(rgxp, rbql_expression);\n if (!matches.length)\n continue;\n if (matches.length > 1)\n throw new RbqlParsingError(`More than one \"${statement}\" statements found`);\n assert(matches.length == 1);\n var match = matches[0];\n var match_str = match[0];\n result.push([match.index, match.index + match_str.length, statement]);\n break; // Break to avoid matching a sub-statement from the same group e.g. \"INNER JOIN\" -> \"JOIN\"\n }\n }\n result.sort(function(a, b) { return a[0] - b[0]; });\n return result;\n}\n\n\nfunction separate_actions(rbql_expression) {\n rbql_expression = str_strip(rbql_expression);\n var result = {};\n let with_match = /^(.*) *[Ww][Ii][Tt][Hh] *\\(([a-z]{4,20})\\) *$/.exec(rbql_expression);\n if (with_match !== null) {\n rbql_expression = with_match[1];\n result[WITH] = with_match[2];\n }\n var ordered_statements = locate_statements(rbql_expression);\n for (var i = 0; i < ordered_statements.length; i++) {\n var statement_start = ordered_statements[i][0];\n var span_start = ordered_statements[i][1];\n var statement = ordered_statements[i][2];\n var span_end = i + 1 < ordered_statements.length ? ordered_statements[i + 1][0] : rbql_expression.length;\n assert(statement_start < span_start);\n assert(span_start <= span_end);\n var span = rbql_expression.substring(span_start, span_end);\n var statement_params = {};\n if ([STRICT_LEFT_JOIN, LEFT_OUTER_JOIN, LEFT_JOIN, INNER_JOIN, JOIN].indexOf(statement) != -1) {\n statement_params['join_subtype'] = statement;\n statement = JOIN;\n }\n\n if (statement == UPDATE) {\n if (statement_start != 0)\n throw new RbqlParsingError('UPDATE keyword must be at the beginning of the query');\n span = span.replace(/^ *SET/i, '');\n }\n\n if (statement == ORDER_BY) {\n span = span.replace(/ ASC *$/i, '');\n var new_span = span.replace(/ DESC *$/i, '');\n if (new_span != span) {\n span = new_span;\n statement_params['reverse'] = true;\n } else {\n statement_params['reverse'] = false;\n }\n }\n\n if (statement == SELECT) {\n if (statement_start != 0)\n throw new RbqlParsingError('SELECT keyword must be at the beginning of the query');\n let match = /^ *TOP *([0-9]+) /i.exec(span);\n if (match !== null) {\n statement_params['top'] = parseInt(match[1]);\n span = span.substr(match.index + match[0].length);\n }\n match = /^ *DISTINCT *(COUNT)? /i.exec(span);\n if (match !== null) {\n statement_params['distinct'] = true;\n if (match[1]) {\n statement_params['distinct_count'] = true;\n }\n span = span.substr(match.index + match[0].length);\n }\n }\n statement_params['text'] = str_strip(span);\n result[statement] = statement_params;\n }\n if (!result.hasOwnProperty(SELECT) && !result.hasOwnProperty(UPDATE)) {\n throw new RbqlParsingError('Query must contain either SELECT or UPDATE statement');\n }\n assert(result.hasOwnProperty(SELECT) != result.hasOwnProperty(UPDATE));\n return result;\n}\n\n\nfunction find_top(rb_actions) {\n if (rb_actions.hasOwnProperty(LIMIT)) {\n var rgx = /^[0-9]+$/;\n if (rgx.exec(rb_actions[LIMIT]['text']) === null) {\n throw new RbqlParsingError('LIMIT keyword must be followed by an integer');\n }\n var result = parseInt(rb_actions[LIMIT]['text']);\n return result;\n }\n var select_action = rb_actions[SELECT];\n if (select_action && select_action.hasOwnProperty('top')) {\n return select_action['top'];\n }\n return null;\n}\n\n\nfunction translate_except_expression(except_expression, input_variables_map, string_literals, input_header) {\n let skip_vars = except_expression.split(',');\n skip_vars = skip_vars.map(str_strip);\n let skip_indices = [];\n for (let var_name of skip_vars) {\n var_name = combine_string_literals(var_name, string_literals);\n if (!input_variables_map.hasOwnProperty(var_name))\n throw new RbqlParsingError(`Unknown field in EXCEPT expression: \"${var_name}\"`);\n skip_indices.push(input_variables_map[var_name].index);\n }\n skip_indices = skip_indices.sort((a, b) => a - b);\n let output_header = input_header === null ? null : select_except(input_header, skip_indices);\n let indices_str = skip_indices.join(',');\n return [output_header, `select_except(record_a, [${indices_str}])`];\n}\n\n\nclass HashJoinMap {\n constructor(record_iterator, key_indices) {\n this.max_record_len = 0;\n this.hash_map = new Map();\n this.record_iterator = record_iterator;\n this.nr = 0;\n if (key_indices.length == 1) {\n this.key_index = key_indices[0];\n this.key_indices = null;\n this.polymorphic_get_key = this.get_single_key;\n } else {\n this.key_index = null;\n this.key_indices = key_indices;\n this.polymorphic_get_key = this.get_multi_key;\n }\n }\n\n get_single_key(nr, fields) {\n if (this.key_index >= fields.length)\n throw new RbqlRuntimeError(`No field with index ${this.key_index + 1} at record ${this.nr} in \"B\" table`);\n return this.key_index === -1 ? this.nr : fields[this.key_index];\n };\n\n get_multi_key(nr, fields) {\n let result = [];\n for (let ki of this.key_indices) {\n if (ki >= fields.length)\n throw new RbqlRuntimeError(`No field with index ${ki + 1} at record ${this.nr} in \"B\" table`);\n result.push(ki === -1 ? this.nr : fields[ki]);\n }\n return JSON.stringify(result);\n };\n\n async build() {\n while (true) {\n let fields = await this.record_iterator.get_record();\n if (fields === null)\n break;\n this.nr += 1;\n let nf = fields.length;\n this.max_record_len = Math.max(this.max_record_len, nf);\n let key = this.polymorphic_get_key(this.nr, fields);\n let key_records = this.hash_map.get(key);\n if (key_records === undefined) {\n this.hash_map.set(key, [[this.nr, nf, fields]]);\n } else {\n key_records.push([this.nr, nf, fields]);\n }\n }\n };\n\n get_join_records(key) {\n let result = this.hash_map.get(key);\n if (result === undefined)\n return [];\n return result;\n };\n\n get_warnings() {\n return this.record_iterator.get_warnings();\n };\n}\n\n\nfunction cleanup_query(query_text) {\n return query_text.split('\\n').map(strip_comments).filter(line => line.length).join(' ').replace(/;+$/g, '');\n}\n\n\nfunction remove_redundant_table_name(query_text) {\n query_text = str_strip(query_text.replace(/ +from +a(?: +|$)/gi, ' '));\n query_text = str_strip(query_text.replace(/^ *update +a +set /gi, 'update '));\n return query_text;\n}\n\n\nfunction select_output_header(input_header, join_header, query_column_infos) {\n if (input_header === null && join_header === null)\n return null;\n if (input_header === null)\n input_header = [];\n if (join_header === null)\n join_header = [];\n let output_header = [];\n for (let qci of query_column_infos) {\n // TODO refactor this and python version: extract this code into a function instead to always return something\n if (qci === null) {\n output_header.push('col' + (output_header.length + 1));\n } else if (qci.is_star) {\n if (qci.table_name === null) {\n output_header = output_header.concat(input_header).concat(join_header);\n } else if (qci.table_name === 'a') {\n output_header = output_header.concat(input_header);\n } else if (qci.table_name === 'b') {\n output_header = output_header.concat(join_header);\n }\n } else if (qci.column_name !== null) {\n output_header.push(qci.column_name);\n } else if (qci.column_index !== null) {\n if (qci.table_name == 'a' && qci.column_index < input_header.length) {\n output_header.push(input_header[qci.column_index]);\n } else if (qci.table_name == 'b' && qci.column_index < join_header.length) {\n output_header.push(join_header[qci.column_index]);\n } else {\n output_header.push('col' + (output_header.length + 1));\n }\n } else { // Should never happen\n output_header.push('col' + (output_header.length + 1));\n }\n }\n return output_header;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\nclass RBQLInputIterator {\n constructor(){}\n stop() {\n throw new Error(\"Unable to call the interface method\");\n }\n async get_variables_map(query_text) {\n throw new Error(\"Unable to call the interface method\");\n }\n async get_record() {\n throw new Error(\"Unable to call the interface method\");\n }\n handle_query_modifier() {\n return; // Reimplement if you need to handle a boolean query modifier that can be used like this: `SELECT * WITH (modifiername)`\n }\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n }\n async get_header() {\n return null; // Reimplement if your class can provide input header\n }\n}\n\n\nclass RBQLOutputWriter {\n constructor(){}\n\n async write(fields) {\n throw new Error(\"Unable to call the interface method\");\n }\n\n async finish() {\n // Reimplement if your class needs to do something on finish e.g. cleanup\n };\n\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n };\n\n set_header() {\n return; // Reimplement if your class can handle output headers in a meaningful way\n }\n}\n\n\nclass RBQLTableRegistry {\n constructor(){}\n\n get_iterator_by_table_id(table_id) {\n throw new Error(\"Unable to call the interface method\");\n }\n\n get_warnings() {\n return []; // Reimplement if your class can produce warnings\n };\n}\n\n\nclass TableIterator extends RBQLInputIterator {\n constructor(table, column_names=null, normalize_column_names=true, variable_prefix='a') {\n super();\n this.table = table;\n this.column_names = column_names;\n this.normalize_column_names = normalize_column_names;\n this.variable_prefix = variable_prefix;\n this.nr = 0;\n this.fields_info = new Object();\n this.stopped = false;\n }\n\n\n stop() {\n this.stopped = true;\n };\n\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n parse_basic_variables(query_text, this.variable_prefix, variable_map);\n parse_array_variables(query_text, this.variable_prefix, variable_map);\n if (this.column_names !== null) {\n if (this.table.length && this.column_names.length != this.table[0].length)\n throw new RbqlIOHandlingError('List of column names and table records have different lengths');\n if (this.normalize_column_names) {\n parse_dictionary_variables(query_text, this.variable_prefix, this.column_names, variable_map);\n parse_attribute_variables(query_text, this.variable_prefix, this.column_names, 'column names list', variable_map);\n } else {\n map_variables_directly(query_text, this.column_names, variable_map);\n }\n }\n return variable_map;\n };\n\n\n async get_record() {\n if (this.stopped)\n return null;\n if (this.nr >= this.table.length)\n return null;\n let record = this.table[this.nr];\n this.nr += 1;\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.nr;\n return record;\n };\n\n get_warnings() {\n if (Object.keys(this.fields_info).length > 1)\n return [make_inconsistent_num_fields_warning('input', this.fields_info)];\n return [];\n };\n\n async get_header() {\n return this.column_names;\n }\n}\n\n\nclass TableWriter extends RBQLOutputWriter {\n constructor(external_table) {\n super();\n this.table = external_table;\n this.header = null;\n }\n\n async write(fields) {\n this.table.push(fields);\n return true;\n };\n\n set_header(header) {\n this.header = header;\n }\n}\n\n\nclass SingleTableRegistry extends RBQLTableRegistry {\n constructor(table, column_names=null, normalize_column_names=true, table_id='b') {\n super();\n this.table = table;\n this.table_id = table_id;\n this.column_names = column_names;\n this.normalize_column_names = normalize_column_names;\n }\n\n get_iterator_by_table_id(table_id) {\n if (table_id.toLowerCase() !== this.table_id)\n throw new RbqlIOHandlingError(`Unable to find join table: \"${table_id}\"`);\n return new TableIterator(this.table, this.column_names, this.normalize_column_names, 'b');\n };\n}\n\n\nasync function shallow_parse_input_query(query_text, input_iterator, join_tables_registry, query_context) {\n query_text = cleanup_query(query_text);\n var [format_expression, string_literals] = separate_string_literals(query_text);\n format_expression = remove_redundant_table_name(format_expression);\n\n var rb_actions = separate_actions(format_expression);\n if (rb_actions.hasOwnProperty(WITH)) {\n input_iterator.handle_query_modifier(rb_actions[WITH]);\n }\n var input_variables_map = await input_iterator.get_variables_map(query_text);\n\n if (rb_actions.hasOwnProperty(ORDER_BY) && rb_actions.hasOwnProperty(UPDATE))\n throw new RbqlParsingError('\"ORDER BY\" is not allowed in \"UPDATE\" queries');\n\n if (rb_actions.hasOwnProperty(GROUP_BY)) {\n if (rb_actions.hasOwnProperty(ORDER_BY) || rb_actions.hasOwnProperty(UPDATE))\n throw new RbqlParsingError('\"ORDER BY\", \"UPDATE\" and \"DISTINCT\" keywords are not allowed in aggregate queries');\n query_context.aggregation_key_expression = '[' + combine_string_literals(rb_actions[GROUP_BY]['text'], string_literals) + ']';\n }\n\n let join_variables_map = null;\n let join_header = null;\n if (rb_actions.hasOwnProperty(JOIN)) {\n var [rhs_table_id, variable_pairs] = parse_join_expression(rb_actions[JOIN]['text']);\n if (join_tables_registry === null)\n throw new RbqlParsingError('JOIN operations are not supported by the application');\n let join_record_iterator = join_tables_registry.get_iterator_by_table_id(rhs_table_id);\n if (!join_record_iterator)\n throw new RbqlParsingError(`Unable to find join table: \"${rhs_table_id}\"`);\n if (rb_actions.hasOwnProperty(WITH)) {\n join_record_iterator.handle_query_modifier(rb_actions[WITH]);\n }\n join_variables_map = await join_record_iterator.get_variables_map(query_text);\n join_header = await join_record_iterator.get_header();\n let [lhs_variables, rhs_indices] = resolve_join_variables(input_variables_map, join_variables_map, variable_pairs, string_literals);\n let sql_join_type = {'JOIN': InnerJoiner, 'INNER JOIN': InnerJoiner, 'LEFT JOIN': LeftJoiner, 'LEFT OUTER JOIN': LeftJoiner, 'STRICT LEFT JOIN': StrictLeftJoiner}[rb_actions[JOIN]['join_subtype']];\n query_context.lhs_join_var_expression = lhs_variables.length == 1 ? lhs_variables[0] : 'JSON.stringify([' + lhs_variables.join(',') + '])';\n query_context.join_map_impl = new HashJoinMap(join_record_iterator, rhs_indices);\n await query_context.join_map_impl.build();\n query_context.join_map = new sql_join_type(query_context.join_map_impl);\n }\n\n query_context.variables_init_code = combine_string_literals(generate_init_statements(format_expression, input_variables_map, join_variables_map, ' '.repeat(4)), string_literals);\n\n if (rb_actions.hasOwnProperty(WHERE)) {\n var where_expression = rb_actions[WHERE]['text'];\n if (/[^>= 3 && line.charCodeAt(0) === 0xEF && line.charCodeAt(1) === 0xBB && line.charCodeAt(2) === 0xBF) {\n return line.substring(3);\n }\n if (assumed_source_encoding == 'utf-8' && line.length >= 1 && line.charCodeAt(0) === 0xFEFF) {\n return line.substring(1);\n }\n return line;\n}\n\n\nfunction make_inconsistent_num_fields_warning(table_name, inconsistent_records_info) {\n let keys = Object.keys(inconsistent_records_info);\n let entries = [];\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let record_id = inconsistent_records_info[key];\n entries.push([record_id, key]);\n }\n entries.sort(function(a, b) { return a[0] - b[0]; });\n assert(entries.length > 1);\n let [record_1, num_fields_1] = entries[0];\n let [record_2, num_fields_2] = entries[1];\n let warn_msg = `Number of fields in \"${table_name}\" table is not consistent: `;\n warn_msg += `e.g. record ${record_1} -> ${num_fields_1} fields, record ${record_2} -> ${num_fields_2} fields`;\n return warn_msg;\n}\n\n\nfunction expanduser(filepath) {\n if (filepath.charAt(0) === '~') {\n return path.join(os.homedir(), filepath.slice(1));\n }\n return filepath;\n}\n\n\nfunction try_read_index(index_path) {\n var content = null;\n try {\n content = fs.readFileSync(index_path, 'utf-8');\n } catch (e) {\n return [];\n }\n var lines = content.split('\\n');\n var records = [];\n for (var i = 0; i < lines.length; i++) {\n if (!lines[i])\n continue;\n var record = lines[i].split('\\t');\n records.push(record);\n }\n return records;\n}\n\n\nfunction get_index_record(index_path, key) {\n var records = try_read_index(index_path);\n for (var i = 0; i < records.length; i++) {\n if (records[i].length && records[i][0] == key) {\n return records[i];\n }\n }\n return null;\n}\n\n\nfunction find_table_path(main_table_dir, table_id) {\n // If table_id is a relative path it could be relative either to the current directory or to the main table dir.\n var candidate_path = expanduser(table_id);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n if (main_table_dir && !path.isAbsolute(candidate_path)) {\n candidate_path = path.join(main_table_dir, candidate_path);\n if (fs.existsSync(candidate_path)) {\n return candidate_path;\n }\n }\n let table_names_settings_path = path.join(os.homedir(), '.rbql_table_names');\n var name_record = get_index_record(table_names_settings_path, table_id);\n if (name_record && name_record.length > 1 && fs.existsSync(name_record[1])) {\n return name_record[1];\n }\n return null;\n}\n\n\nclass RecordQueue {\n // TODO compare performance with a linked list\n constructor() {\n this.push_stack = [];\n this.pull_stack = [];\n }\n\n enqueue(record) {\n this.push_stack.push(record);\n }\n\n dequeue() {\n if (!this.pull_stack.length) {\n if (!this.push_stack.length)\n return null;\n this.pull_stack = this.push_stack;\n this.pull_stack.reverse();\n this.push_stack = [];\n }\n return this.pull_stack.pop();\n }\n}\n\n\nclass CSVRecordIterator extends rbql.RBQLInputIterator {\n // CSVRecordIterator implements a typical async producer-consumer model with an internal buffer:\n // get_record() - consumer\n // stream.on('data') - producer\n constructor(stream, csv_path, encoding, delim, policy, has_header=false, comment_prefix=null, table_name='input', variable_prefix='a') {\n super();\n this.stream = stream;\n this.csv_path = csv_path;\n assert((this.stream === null) != (this.csv_path === null));\n this.encoding = encoding;\n this.delim = delim;\n this.policy = policy;\n\n this.has_header = has_header;\n this.first_record = null;\n this.first_record_should_be_emitted = !has_header;\n this.header_preread_complete = false;\n\n this.table_name = table_name;\n this.variable_prefix = variable_prefix;\n this.comment_prefix = (comment_prefix !== null && comment_prefix.length) ? comment_prefix : null;\n\n this.decoder = null;\n if (encoding == 'utf-8' && this.csv_path === null) {\n // Unfortunately util.TextDecoder has serious flaws:\n // 1. It doesn't work in Node without ICU: https://nodejs.org/api/util.html#util_new_textdecoder_encoding_options\n // 2. It is broken in Electron: https://github.com/electron/electron/issues/18733\n\n // Technically we can implement our own custom streaming text decoder, using the 3 following technologies:\n // 1. decode-encode validation method from https://stackoverflow.com/a/32279283/2898283\n // 2. Scanning buffer chunks for non-continuation utf-8 bytes from the end of the buffer:\n // src_buffer -> (buffer_before, buffer_after) where buffer_after is very small(a couple of bytes) and buffer_before is large and ends with a non-continuation bytes\n // 3. Internal buffer to store small tail part from the previous buffer\n this.decoder = new util.TextDecoder(encoding, {fatal: true, stream: true});\n }\n\n this.input_exhausted = false;\n this.started = false;\n\n this.utf8_bom_removed = false; // BOM doesn't get automatically removed by the decoder when utf-8 file is treated as latin-1\n this.first_defective_line = null;\n\n this.fields_info = new Object();\n this.NR = 0; // Record number\n this.NL = 0; // Line number (NL != NR when the CSV file has comments or multiline fields)\n\n this.rfc_line_buffer = [];\n\n this.partially_decoded_line = '';\n this.partially_decoded_line_ends_with_cr = false;\n\n // Holds an external \"resolve\" function which is called when everything is fine.\n this.resolve_current_record = null;\n // Holds an external \"reject\" function which is called when error has occured.\n this.reject_current_record = null;\n // Holds last exception if we don't have any reject callbacks from clients yet.\n this.current_exception = null;\n\n this.produced_records_queue = new RecordQueue();\n\n this.process_line_polymorphic = policy == 'quoted_rfc' ? this.process_partial_rfc_record_line : this.process_record_line;\n }\n\n\n handle_query_modifier(modifier) {\n // For `... WITH (header) ...` syntax\n if (['header', 'headers'].indexOf(modifier) != -1) {\n this.has_header = true;\n this.first_record_should_be_emitted = false;\n }\n if (['noheader', 'noheaders'].indexOf(modifier) != -1) {\n this.has_header = false;\n this.first_record_should_be_emitted = true;\n }\n }\n\n\n reset_external_callbacks() {\n // Drop external callbacks simultaneously since promises can only resolve once, see: https://stackoverflow.com/a/18218542/2898283\n this.reject_current_record = null;\n this.resolve_current_record = null;\n }\n\n try_propagate_exception() {\n if (this.current_exception && this.reject_current_record) {\n let reject = this.reject_current_record;\n let exception = this.current_exception;\n this.reset_external_callbacks();\n this.current_exception = null;\n reject(exception);\n }\n }\n\n\n store_or_propagate_exception(exception) {\n if (this.current_exception === null)\n // Ignore subsequent exceptions if we already have an unreported error. This way we prioritize earlier errors over the more recent ones.\n this.current_exception = exception;\n this.try_propagate_exception();\n }\n\n\n async preread_first_record() {\n if (this.header_preread_complete)\n return;\n this.first_record = await this.get_record();\n this.header_preread_complete = true; // We must set header_preread_complete to true after calling get_record(), because get_record() uses it internally.\n if (this.first_record === null) {\n return;\n }\n if (this.stream)\n this.stream.pause();\n this.first_record = this.first_record.slice();\n };\n\n\n async get_variables_map(query_text) {\n let variable_map = new Object();\n rbql.parse_basic_variables(query_text, this.variable_prefix, variable_map);\n rbql.parse_array_variables(query_text, this.variable_prefix, variable_map);\n\n await this.preread_first_record();\n if (this.has_header && this.first_record) {\n rbql.parse_attribute_variables(query_text, this.variable_prefix, this.first_record, 'CSV header line', variable_map);\n rbql.parse_dictionary_variables(query_text, this.variable_prefix, this.first_record, variable_map);\n }\n return variable_map;\n };\n\n async get_header() {\n await this.preread_first_record();\n return this.has_header ? this.first_record : null;\n }\n\n\n try_resolve_next_record() {\n this.try_propagate_exception();\n if (this.resolve_current_record === null)\n return;\n\n let record = null;\n if (this.first_record_should_be_emitted && this.header_preread_complete) {\n this.first_record_should_be_emitted = false;\n record = this.first_record;\n } else {\n record = this.produced_records_queue.dequeue();\n }\n\n if (record === null && !this.input_exhausted)\n return;\n let resolve = this.resolve_current_record;\n this.reset_external_callbacks();\n resolve(record);\n };\n\n\n async get_record() {\n if (!this.started)\n await this.start();\n if (this.stream && this.stream.isPaused())\n this.stream.resume();\n\n let parent_iterator = this;\n let current_record_promise = new Promise(function(resolve, reject) {\n parent_iterator.resolve_current_record = resolve;\n parent_iterator.reject_current_record = reject;\n });\n this.try_resolve_next_record();\n return current_record_promise;\n };\n\n\n async get_all_records(num_records=null) {\n let records = [];\n while (true) {\n let record = await this.get_record();\n if (record === null)\n break;\n records.push(record);\n if (num_records && records.length >= num_records) {\n this.stop();\n break;\n }\n }\n return records;\n };\n\n\n process_record_line(line) {\n if (this.comment_prefix !== null && line.startsWith(this.comment_prefix))\n return; // Just skip the line\n this.NR += 1;\n var [record, warning] = csv_utils.smart_split(line, this.delim, this.policy, false);\n if (warning) {\n if (this.first_defective_line === null) {\n this.first_defective_line = this.NL;\n if (this.policy == 'quoted_rfc')\n this.store_or_propagate_exception(new RbqlIOHandlingError(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`));\n }\n }\n let num_fields = record.length;\n if (!this.fields_info.hasOwnProperty(num_fields))\n this.fields_info[num_fields] = this.NR;\n this.produced_records_queue.enqueue(record);\n this.try_resolve_next_record();\n };\n\n\n process_partial_rfc_record_line(line) {\n let record_line = csv_utils.accumulate_rfc_line_into_record(this.rfc_line_buffer, line, this.comment_prefix);\n if (record_line !== null)\n this.process_record_line(record_line);\n };\n\n\n process_line(line) {\n this.NL += 1;\n if (this.NL === 1) {\n var clean_line = remove_utf8_bom(line, this.encoding);\n if (clean_line != line) {\n line = clean_line;\n this.utf8_bom_removed = true;\n }\n }\n this.process_line_polymorphic(line);\n };\n\n\n process_data_stream_chunk(data_chunk) {\n let decoded_string = null;\n if (this.decoder) {\n try {\n decoded_string = this.decoder.decode(data_chunk);\n } catch (e) {\n if (e instanceof TypeError) {\n this.store_or_propagate_exception(new RbqlIOHandlingError(utf_decoding_error));\n } else {\n this.store_or_propagate_exception(e);\n }\n return;\n }\n } else {\n decoded_string = data_chunk.toString(this.encoding);\n }\n let line_starts_with_lf = decoded_string.length && decoded_string[0] == '\\n';\n let first_line_index = line_starts_with_lf && this.partially_decoded_line_ends_with_cr ? 1 : 0;\n this.partially_decoded_line_ends_with_cr = decoded_string.length && decoded_string[decoded_string.length - 1] == '\\r';\n let lines = csv_utils.split_lines(decoded_string);\n lines[0] = this.partially_decoded_line + lines[0];\n assert(first_line_index == 0 || lines[0].length == 0);\n this.partially_decoded_line = lines.pop();\n for (let i = first_line_index; i < lines.length; i++) {\n this.process_line(lines[i]);\n }\n };\n\n\n process_data_bulk(data_chunk) {\n let decoded_string = data_chunk.toString(this.encoding);\n if (this.encoding == 'utf-8') {\n // Using hacky comparison method from here: https://stackoverflow.com/a/32279283/2898283\n // TODO get rid of this once TextDecoder is really fixed or when alternative method of reliable decoding appears\n let control_buffer = Buffer.from(decoded_string, 'utf-8');\n if (Buffer.compare(data_chunk, control_buffer) != 0) {\n this.store_or_propagate_exception(new RbqlIOHandlingError(utf_decoding_error));\n return;\n }\n }\n let lines = csv_utils.split_lines(decoded_string);\n if (lines.length && lines[lines.length - 1].length == 0)\n lines.pop();\n for (let i = 0; i < lines.length; i++) {\n this.process_line(lines[i]);\n }\n if (this.rfc_line_buffer.length > 0) {\n this.process_record_line(this.rfc_line_buffer.join('\\n'));\n }\n this.input_exhausted = true;\n this.try_resolve_next_record(); // Should be a NOOP here?\n }\n\n\n process_data_stream_end() {\n this.input_exhausted = true;\n if (this.partially_decoded_line.length) {\n let last_line = this.partially_decoded_line;\n this.partially_decoded_line = '';\n this.process_line(last_line);\n }\n if (this.rfc_line_buffer.length > 0) {\n this.process_record_line(this.rfc_line_buffer.join('\\n'));\n }\n this.try_resolve_next_record();\n };\n\n\n stop() {\n if (this.stream)\n this.stream.destroy(); // TODO consider using pause() instead\n };\n\n\n async start() {\n if (this.started)\n return;\n this.started = true;\n if (this.stream) {\n this.stream.on('data', (data_chunk) => { this.process_data_stream_chunk(data_chunk); });\n this.stream.on('end', () => { this.process_data_stream_end(); });\n } else {\n let parent_iterator = this;\n return new Promise(function(resolve, reject) {\n fs.readFile(parent_iterator.csv_path, (err, data_chunk) => {\n if (err) {\n reject(err);\n } else {\n parent_iterator.process_data_bulk(data_chunk);\n resolve();\n }\n });\n });\n }\n };\n\n\n get_warnings() {\n let result = [];\n if (this.first_defective_line !== null)\n result.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`);\n if (this.utf8_bom_removed)\n result.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`);\n if (Object.keys(this.fields_info).length > 1)\n result.push(make_inconsistent_num_fields_warning(this.table_name, this.fields_info));\n return result;\n };\n}\n\n\nclass CSVWriter extends rbql.RBQLOutputWriter {\n constructor(stream, close_stream_on_finish, encoding, delim, policy, line_separator='\\n') {\n super();\n this.stream = stream;\n this.encoding = encoding;\n if (encoding)\n this.stream.setDefaultEncoding(encoding);\n this.stream.on('error', (error_obj) => { this.store_first_error(error_obj); })\n this.delim = delim;\n this.policy = policy;\n this.line_separator = line_separator;\n this.sub_array_delim = delim == '|' ? ';' : '|';\n\n this.close_stream_on_finish = close_stream_on_finish;\n\n this.null_in_output = false;\n this.delim_in_simple_output = false;\n this.header_len = null;\n this.first_error = null;\n\n if (policy == 'simple') {\n this.polymorphic_join = this.simple_join;\n } else if (policy == 'quoted') {\n this.polymorphic_join = this.quoted_join;\n } else if (policy == 'quoted_rfc') {\n this.polymorphic_join = this.quoted_join_rfc;\n } else if (policy == 'monocolumn') {\n this.polymorphic_join = this.mono_join;\n } else if (policy == 'whitespace') {\n this.polymorphic_join = this.simple_join;\n } else {\n throw new RbqlIOHandlingError('Unknown output csv policy');\n }\n }\n\n\n store_first_error(error_obj) {\n // Store only first error because it is typically more important than the subsequent ones.\n if (this.first_error === null)\n this.first_error = error_obj;\n }\n\n set_header(header) {\n if (header !== null) {\n this.header_len = header.length;\n this.write(header);\n }\n }\n\n\n quoted_join(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n quoted_join_rfc(fields) {\n let delim = this.delim;\n var quoted_fields = fields.map(function(v) { return csv_utils.rfc_quote_field(String(v), delim); });\n return quoted_fields.join(this.delim);\n };\n\n\n mono_join(fields) {\n if (fields.length > 1) {\n throw new RbqlIOHandlingError('Unable to use \"Monocolumn\" output format: some records have more than one field');\n }\n return fields[0];\n };\n\n\n simple_join(fields) {\n var res = fields.join(this.delim);\n if (fields.join('').indexOf(this.delim) != -1) {\n this.delim_in_simple_output = true;\n }\n return res;\n };\n\n\n normalize_fields(out_fields) {\n for (var i = 0; i < out_fields.length; i++) {\n if (out_fields[i] == null) {\n this.null_in_output = true;\n out_fields[i] = '';\n } else if (Array.isArray(out_fields[i])) {\n this.normalize_fields(out_fields[i]);\n out_fields[i] = out_fields[i].join(this.sub_array_delim);\n }\n }\n };\n\n\n async write(fields) {\n if (this.header_len !== null && fields.length != this.header_len)\n throw new RbqlIOHandlingError(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${fields.length}`);\n this.normalize_fields(fields);\n this.stream.write(this.polymorphic_join(fields));\n this.stream.write(this.line_separator);\n let writer_error = this.first_error;\n return new Promise(function(resolve, reject) {\n if (writer_error !== null) {\n reject(writer_error);\n } else {\n resolve(true);\n }\n });\n };\n\n\n _write_all(table) {\n for (let i = 0; i < table.length; i++) {\n this.write(table[i]);\n }\n };\n\n\n async finish() {\n let close_stream_on_finish = this.close_stream_on_finish;\n let output_stream = this.stream;\n let output_encoding = this.encoding;\n let writer_error = this.first_error;\n let finish_promise = new Promise(function(resolve, reject) {\n if (writer_error !== null) {\n reject(writer_error);\n }\n if (close_stream_on_finish) {\n output_stream.end('', output_encoding, () => { resolve(); });\n } else {\n setTimeout(() => { resolve(); }, 0);\n }\n });\n return finish_promise;\n };\n\n\n get_warnings() {\n let result = [];\n if (this.null_in_output)\n result.push('null values in output were replaced by empty strings');\n if (this.delim_in_simple_output)\n result.push('Some output fields contain separator');\n return result;\n };\n\n}\n\n\nclass FileSystemCSVRegistry extends rbql.RBQLTableRegistry {\n constructor(input_file_dir, delim, policy, encoding, has_header=false, comment_prefix=null, options=null) {\n super();\n this.input_file_dir = input_file_dir;\n this.delim = delim;\n this.policy = policy;\n this.encoding = encoding;\n this.has_header = has_header;\n this.comment_prefix = comment_prefix;\n this.stream = null;\n this.record_iterator = null;\n\n this.options = options;\n this.bulk_input_path = null;\n this.table_path = null;\n }\n\n get_iterator_by_table_id(table_id) {\n this.table_path = find_table_path(this.input_file_dir, table_id);\n if (this.table_path === null) {\n throw new RbqlIOHandlingError(`Unable to find join table \"${table_id}\"`);\n }\n if (this.options && this.options['bulk_read']) {\n this.bulk_input_path = this.table_path;\n } else {\n this.stream = fs.createReadStream(this.table_path);\n }\n this.record_iterator = new CSVRecordIterator(this.stream, this.bulk_input_path, this.encoding, this.delim, this.policy, this.has_header, this.comment_prefix, table_id, 'b');\n return this.record_iterator;\n };\n\n get_warnings(output_warnings) {\n if (this.record_iterator && this.has_header) {\n output_warnings.push(`The first record in JOIN file ${path.basename(this.table_path)} was also treated as header (and skipped)`);\n }\n }\n}\n\n\nasync function query_csv(query_text, input_path, input_delim, input_policy, output_path, output_delim, output_policy, csv_encoding, output_warnings, with_headers=false, comment_prefix=null, user_init_code='', options=null) {\n let input_stream = null;\n let bulk_input_path = null;\n if (options && options['bulk_read'] && input_path) {\n bulk_input_path = input_path;\n } else {\n input_stream = input_path === null ? process.stdin : fs.createReadStream(input_path);\n }\n let [output_stream, close_output_on_finish] = output_path === null ? [process.stdout, false] : [fs.createWriteStream(output_path), true];\n if (input_delim == '\"' && input_policy == 'quoted')\n throw new RbqlIOHandlingError('Double quote delimiter is incompatible with \"quoted\" policy');\n if (csv_encoding == 'latin-1')\n csv_encoding = 'binary';\n if (!is_ascii(query_text) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n if ((!is_ascii(input_delim) || !is_ascii(output_delim)) && csv_encoding == 'binary')\n throw new RbqlIOHandlingError('To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary');\n\n let default_init_source_path = path.join(os.homedir(), '.rbql_init_source.js');\n if (user_init_code == '' && fs.existsSync(default_init_source_path)) {\n user_init_code = read_user_init_code(default_init_source_path);\n }\n let input_file_dir = input_path ? path.dirname(input_path) : null;\n let join_tables_registry = new FileSystemCSVRegistry(input_file_dir, input_delim, input_policy, csv_encoding, with_headers, comment_prefix, options);\n let input_iterator = new CSVRecordIterator(input_stream, bulk_input_path, csv_encoding, input_delim, input_policy, with_headers, comment_prefix);\n let output_writer = new CSVWriter(output_stream, close_output_on_finish, csv_encoding, output_delim, output_policy);\n\n await rbql.query(query_text, input_iterator, output_writer, output_warnings, join_tables_registry, user_init_code);\n join_tables_registry.get_warnings(output_warnings);\n}\n\n\nmodule.exports.is_ascii = is_ascii;\nmodule.exports.CSVRecordIterator = CSVRecordIterator;\nmodule.exports.CSVWriter = CSVWriter;\nmodule.exports.FileSystemCSVRegistry = FileSystemCSVRegistry;\nmodule.exports.interpret_named_csv_format = interpret_named_csv_format;\nmodule.exports.read_user_init_code = read_user_init_code;\nmodule.exports.query_csv = query_csv;\nmodule.exports.RecordQueue = RecordQueue;\nmodule.exports.exception_to_error_info = rbql.exception_to_error_info;\n","module.exports = require(\"vscode\");","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","const assert = require('assert');\nconst os = require('os');\n\nconst vscode = require('vscode');\n\nconst rainbow_utils = require('../../rainbow_utils.js');\n\nconst is_web_ext = (os.homedir === undefined); // Runs as web extension in browser.\n\n\n// TODO make RBQL command wait for the result to reduce the timeout.\nconst poor_rbql_async_design_workaround_timeout = 6000;\n\n\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n\nfunction log_message(msg) {\n console.log('###RAINBOW_CSV_UNIT_TEST_MESSAGE### ' + msg);\n}\n\n\nasync function test_rbql_node(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n // Test Python query.\n let test_task = {rbql_backend: \"python\", with_headers: true, rbql_query: \"select top 20 a1, math.ceil(float(a.total_score) * 100), a['university_name'], None, 'foo bar' order by a2\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n // Indirectly check reported warnings.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[\"None values in output were replaced by empty strings\"]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n let length_after_query = active_doc.getText().length;\n log_message(`Length after python query: ${length_after_query}`);\n assert.equal(868, length_after_query); // wc -c gives smaller value. Probably VSCode uses '\\r\\n' as line ends.\n\n // Test JS query.\n test_task = {rbql_backend: \"js\", rbql_query: \"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after js query: ${length_after_query}`);\n assert.equal(268, length_after_query);\n\n // Test RBQL query error reporting.\n test_task = {rbql_backend: \"python\", rbql_query: \"select nonexistent_function(a1)\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_report: true});\n assert.equal('query execution', state_report.error_type);\n assert.equal(\"At record 1, Details: name 'nonexistent_function' is not defined\", state_report.error_msg);\n\n // Test with multiline records.\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'synthetic_rfc_newline_data.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n test_task = {rbql_backend: \"js\", rbql_query: \"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR\", enable_rfc_newlines: true};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after js multiline-record query: ${length_after_query}`);\n assert.equal(645, length_after_query);\n\n // Test RBQL JOIN query.\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n test_task = {rbql_backend: \"python\", with_headers: true, 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\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[\"The first record in JOIN file countries.csv was also treated as header (and skipped)\"]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after join query: ${length_after_query}`);\n // Not sure why it is 11592 and not 11610, when saving the file `wc -c` gives 11610.\n assert.equal(11592, length_after_query);\n // We have 202 not 201 because the trailing '\\n' maps to a trailing empty line in VSCode.\n assert.equal(202, active_doc.lineCount);\n\n // Test UPDATE, no warnings and copy back.\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'countries.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n let filename_before = active_doc.fileName;\n let length_before_query = active_doc.getText().length;\n editor = await vscode.window.showTextDocument(active_doc);\n assert(active_doc.getText().indexOf('oceania') == -1);\n assert(active_doc.getText().indexOf('OCEANIA') > 0);\n await sleep(1000);\n\n test_task = {rbql_backend: \"python\", with_headers: true, rbql_query: \"UPDATE set a.Region = a.Region.lower()\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n let filename_after = active_doc.fileName;\n length_after_query = active_doc.getText().length;\n log_message(`Length after update query: ${length_after_query}`);\n // Changing column to lowercase should not affect the doc length if we account for the '\\r\\n' line endings.\n assert.equal(length_before_query, length_after_query - active_doc.lineCount + 1);\n assert(active_doc.getText().indexOf('OCEANIA') == -1);\n assert(active_doc.getText().indexOf('oceania') > 0);\n\n await sleep(1000);\n await vscode.commands.executeCommand('rainbow-csv.CopyBack');\n await sleep(1000);\n active_doc = await vscode.workspace.openTextDocument(uri);\n let filename_after_copy_back = active_doc.fileName;\n // Make sure that the name stays the same as the original doc but the content has changed.\n assert.equal(filename_before, filename_after_copy_back);\n assert(active_doc.getText().indexOf('OCEANIA') == -1);\n assert(active_doc.getText().indexOf('oceania') > 0);\n}\n\n\nasync function test_rbql_web(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n let test_task = {rbql_backend: \"js\", with_headers: true, rbql_query: \"select top 20 a1, Math.ceil(parseFloat(a.total_score) * 100), a['university_name'], null, 'foo bar' order by a2\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n // Indirectly check reported warnings.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_warnings: true});\n assert.equal('[\"null values in output were replaced by empty strings\"]', JSON.stringify(state_report.warnings));\n active_doc = vscode.window.activeTextEditor.document;\n let length_after_query = active_doc.getText().length;\n log_message(`Length after first js query: ${length_after_query}`);\n assert.equal(846, length_after_query);\n\n test_task = {rbql_backend: \"js\", rbql_query: \"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after second js query: ${length_after_query}`);\n // 267 instead of 268 because no trailing '\\n' at the end of file.\n assert.equal(267, length_after_query);\n\n // Test RBQL query error reporting.\n test_task = {rbql_backend: \"js\", rbql_query: \"select nonexistent_function(a1)\"};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_last_rbql_report: true});\n assert.equal('query execution', state_report.error_type);\n assert.equal(\"At record 1, Details: nonexistent_function is not defined\", state_report.error_msg);\n\n // Test with multiline records.\n log_message('Starting multiline records test');\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'synthetic_rfc_newline_data.csv');\n active_doc = await vscode.workspace.openTextDocument(uri);\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n test_task = {rbql_backend: \"js\", rbql_query: \"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR\", enable_rfc_newlines: true};\n await vscode.commands.executeCommand('rainbow-csv.RBQL', test_task);\n await sleep(poor_rbql_async_design_workaround_timeout);\n active_doc = vscode.window.activeTextEditor.document;\n length_after_query = active_doc.getText().length;\n log_message(`Length after js multiline-record query: ${length_after_query}`);\n // 644 instead of 645 because no trailing '\\n' at the end of file.\n assert.equal(644, length_after_query);\n}\n\n\nasync function test_align_shrink_lint(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking.csv');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n let length_original = active_doc.getText().length;\n log_message(`Original length: ${length_original}`)\n assert.equal(12538, length_original);\n await sleep(2000);\n\n await vscode.commands.executeCommand('rainbow-csv.Align');\n let length_aligned = active_doc.getText().length;\n log_message(`Aligned length: ${length_aligned}`)\n assert.equal(25896, length_aligned);\n assert(length_aligned > length_original);\n let lint_report = await vscode.commands.executeCommand('rainbow-csv.CSVLint');\n assert.equal(lint_report, 'OK');\n await sleep(2000);\n\n await vscode.commands.executeCommand('rainbow-csv.Shrink');\n let length_shrinked = active_doc.getText().length;\n log_message(`Shrinked length: ${length_shrinked}`)\n // This is to ensure that after original -> align -> shrink sequence we get back to original doc.\n assert.equal(length_original, length_shrinked);\n await sleep(500);\n\n let text_with_comma = 'foobar,';\n await vscode.commands.executeCommand('default:type', { text: text_with_comma });\n lint_report = await vscode.commands.executeCommand('rainbow-csv.CSVLint');\n assert(lint_report.indexOf('Number of fields is not consistent') != -1);\n await sleep(500);\n\n for (let i = 0; i < text_with_comma.length; i++) {\n await vscode.commands.executeCommand(\"deleteLeft\");\n }\n await sleep(500);\n}\n\n\nasync function test_column_edit(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'movies.txt');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n let length_original = active_doc.getText().length;\n assert.equal(9986, length_original);\n for (let i = 0; i < 10; i++) {\n await vscode.commands.executeCommand(\"cursorRight\");\n }\n await sleep(1000);\n await vscode.commands.executeCommand(\"rainbow-csv.ColumnEditAfter\");\n await sleep(1000);\n let text_with_comma = 'foobar,';\n await vscode.commands.executeCommand('default:type', { text: text_with_comma });\n let length_after_column_edit = active_doc.getText().length;\n assert.equal(length_original + active_doc.lineCount * text_with_comma.length, length_after_column_edit);\n await sleep(1000);\n for (let i = 0; i < text_with_comma.length; i++) {\n await vscode.commands.executeCommand(\"deleteLeft\");\n }\n await sleep(1000);\n let length_after_delete = active_doc.getText().length;\n // Ensure that after multicursor deletion of the added `text_with_comma` text we get back to the original doc.\n assert.equal(length_original, length_after_delete);\n}\n\n\nasync function test_no_autodetection(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'lorem_ipsum.txt');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for lorem_ipsum.txt: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'suite', 'index.js');\n active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for index.js: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'javascript');\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n\n uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'lorem_ipsum');\n active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for lorem_ipsum: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n}\n\n\nasync function test_autodetection(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'university_ranking_semicolon.txt');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n let editor = await vscode.window.showTextDocument(active_doc);\n log_message(`languageId for university_ranking_semicolon.txt: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'csv (semicolon)');\n await sleep(1000);\n}\n\n\nasync function test_manual_enable_disable(workspace_folder_uri) {\n let uri = vscode.Uri.joinPath(workspace_folder_uri, 'test', 'csv_files', 'small_movies.pipe');\n let active_doc = await vscode.workspace.openTextDocument(uri);\n log_message(`languageId for small_movies.pipe: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n let editor = await vscode.window.showTextDocument(active_doc);\n await sleep(1000);\n for (let i = 0; i < 6; i++) {\n await vscode.commands.executeCommand(\"cursorRight\");\n }\n await vscode.commands.executeCommand(\"cursorRightSelect\");\n await sleep(1000);\n await vscode.commands.executeCommand('rainbow-csv.RainbowSeparator');\n await sleep(2000);\n log_message(`languageId for small_movies.pipe after RainbowSeparator: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'csv (pipe)');\n await vscode.commands.executeCommand('rainbow-csv.RainbowSeparatorOff');\n await sleep(2000);\n log_message(`languageId for small_movies.pipe after RainbowSeparatorOff: ${active_doc.languageId}`)\n assert.equal(active_doc.languageId, 'plaintext');\n await sleep(1000);\n}\n\n\nfunction test_align_stats() {\n // Previous fields are numbers but the current one is not - mark the column as non-numeric.\n let field = 'foobar';\n let is_first_line = 0;\n let field_components = [5, 2, 3];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [6, -1, -1]);\n\n // The field is non-numeric but it is at the first line so could be a header - do not mark the column as non-numeric just yet.\n field = 'foobar';\n is_first_line = 1;\n field_components = [0, 0, 0];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [6, 0, 0]);\n\n // The field is a number but the column is already marked as non-numeric so we just update the max string width.\n field = '100000';\n is_first_line = 0;\n field_components = [2, -1, -1];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [6, -1, -1]);\n\n // Empty field should not mark a potentially numeric column as non-numeric.\n field = '';\n is_first_line = 0;\n field_components = [5, 2, 3];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [5, 2, 3]);\n\n // The field doesn't change stats because all of 3 components are smaller than the current maximums.\n field = '100.3';\n is_first_line = 0;\n field_components = [7, 4, 3];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [7, 4, 3]);\n\n // Integer update example.\n field = '100000';\n is_first_line = 0;\n field_components = [5, 2, 3];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [6, 6, 3]);\n\n // Float update example.\n field = '1000.23';\n is_first_line = 0;\n field_components = [3, 3, 0];\n rainbow_utils.update_subcomponent_stats(field, is_first_line, field_components);\n assert.deepEqual(field_components, [7, 4, 3]);\n}\n\n\nfunction test_field_align() {\n // Align field in non-numeric non-last column.\n let field = 'foobar';\n let is_first_line = 0;\n let max_components_lens = [10, -1, -1];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n let is_last_column = 0;\n let aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('foobar ', aligned_field);\n\n // Align field in non-numeric last column.\n field = 'foobar';\n is_first_line = 0;\n max_components_lens = [10, -1, -1];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 1;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('foobar', aligned_field);\n\n // Align non-numeric first line (potentially header) field in numeric column.\n field = 'foobar';\n is_first_line = 1;\n max_components_lens = [10, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('foobar ', aligned_field);\n\n // Align numeric first line (potentially header) field in numeric column.\n field = '10.1';\n is_first_line = 1;\n max_components_lens = [10, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual(' 10.1 ', aligned_field);\n\n // Align numeric field in non-numeric column (first line).\n field = '10.1';\n is_first_line = 1;\n max_components_lens = [10, -1, -1];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('10.1 ', aligned_field);\n\n // Align numeric field in non-numeric column (not first line).\n field = '10.1';\n is_first_line = 0;\n max_components_lens = [10, -1, -1];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('10.1 ', aligned_field);\n\n // Align numeric float in numeric non-last column.\n field = '10.1';\n is_first_line = 0;\n max_components_lens = [10, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual(' 10.1 ', aligned_field);\n\n // Align numeric float in numeric last column.\n field = '10.1';\n is_first_line = 0;\n max_components_lens = [10, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 1;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual(' 10.1', aligned_field);\n\n // Align numeric integer in numeric non-last column.\n field = '1000';\n is_first_line = 0;\n max_components_lens = [10, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('1000 ', aligned_field);\n\n // Align numeric integer in numeric last column.\n field = '1000';\n is_first_line = 0;\n max_components_lens = [10, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 1;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('1000', aligned_field);\n\n // Align numeric integer in numeric (integer) column.\n field = '1000';\n is_first_line = 0;\n max_components_lens = [4, 4, 0];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual('1000 ', aligned_field);\n\n // Align numeric integer in numeric (integer) column dominated by header width.\n field = '1000';\n is_first_line = 0;\n max_components_lens = [6, 4, 0];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual(' 1000 ', aligned_field);\n\n // Align numeric float in numeric column dominated by header width.\n field = '10.1';\n is_first_line = 0;\n max_components_lens = [12, 4, 6];\n max_components_lens = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n is_last_column = 0;\n aligned_field = rainbow_utils.align_field(field, is_first_line, max_components_lens, is_last_column);\n assert.deepEqual(' 10.1 ', aligned_field);\n}\n\n\nfunction test_adjust_column_stats() {\n // Not a numeric column, adjustment is NOOP.\n let max_components_lens = [10, -1, -1];\n let adjusted_components = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n assert.deepEqual([10, -1, -1], adjusted_components);\n\n // This is possisble with a single-line file.\n max_components_lens = [10, 0, 0];\n adjusted_components = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n assert.deepEqual([10, -1, -1], adjusted_components);\n\n // Header is smaller than the sum of the numeric components.\n // value\n // 0.12\n // 1234\n max_components_lens = [5, 4, 3];\n adjusted_components = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n assert.deepEqual([7, 4, 3], adjusted_components);\n\n // Header is bigger than the sum of the numeric components.\n max_components_lens = [10, 4, 3];\n adjusted_components = rainbow_utils.adjust_column_stats([max_components_lens])[0];\n assert.deepEqual([10, 7, 3], adjusted_components);\n}\n\n\nfunction unit_test_align_logic() {\n test_align_stats();\n test_field_align();\n test_adjust_column_stats();\n}\n\n\nasync function run() {\n try {\n log_message('Starting tests');\n\n assert.equal(-1, [1, 2, 3].indexOf(0));\n\n assert(vscode.workspace.workspaceFolders);\n assert.equal(1, vscode.workspace.workspaceFolders.length);\n let workspace_folder_uri = vscode.workspace.workspaceFolders[0].uri;\n\n await unit_test_align_logic();\n\n await test_no_autodetection(workspace_folder_uri);\n if (!is_web_ext) {\n // Ensure that opening non-csv files doesn't cause rainbow csv to import relatively heavy lazy-loaded code.\n // There is no point to check this in web since all of the files are bundled into a single script anyway.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_initialization_state: true});\n assert(state_report.initialized);\n assert(!state_report.lazy_loaded);\n }\n\n await test_autodetection(workspace_folder_uri);\n await test_manual_enable_disable(workspace_folder_uri);\n\n if (!is_web_ext) {\n // Ensure that basic operations don't cause rainbow csv to lazy load unnecessary code.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_initialization_state: true});\n assert(state_report.initialized);\n assert(!state_report.lazy_loaded);\n }\n\n if (is_web_ext) {\n await test_rbql_web(workspace_folder_uri);\n } else {\n await test_rbql_node(workspace_folder_uri);\n }\n\n if (!is_web_ext) {\n // Sanity check that after using advanced functionality such as RBQL, the non-basic code is lazy loaded.\n let state_report = await vscode.commands.executeCommand('rainbow-csv.InternalTest', {check_initialization_state: true});\n assert(state_report.initialized);\n assert(state_report.lazy_loaded);\n }\n\n await test_align_shrink_lint(workspace_folder_uri);\n await test_column_edit(workspace_folder_uri);\n\n log_message('Finishing tests');\n } catch (e) {\n log_message('Error: tests have failed. Exception:');\n log_message(String(e));\n log_message(String(e.stack));\n }\n}\n\nexports.run = run;\n"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","isDeepEqual","isDeepStrictEqual","_require$codes","codes","ERR_AMBIGUOUS_ARGUMENT","ERR_INVALID_ARG_TYPE","ERR_INVALID_ARG_VALUE","ERR_INVALID_RETURN_VALUE","ERR_MISSING_ARGS","AssertionError","inspect","_require$types","isPromise","isRegExp","objectAssign","Object","assign","objectIs","is","lazyLoadComparison","comparison","Map","warned","assert","module","exports","ok","NO_EXCEPTION_SENTINEL","innerFail","message","Error","innerOk","fn","argLen","value","generatedMessage","err","actual","expected","operator","stackStartFn","_len","arguments","length","args","Array","_key","apply","concat","fail","internalMessage","argsLen","undefined","warn","process","emitWarning","console","bind","errArgs","equal","notEqual","deepEqual","notDeepEqual","deepStrictEqual","notDeepStrictEqual","strictEqual","notStrictEqual","Comparison","keys","_this","this","instance","Constructor","TypeError","_classCallCheck","forEach","key","test","compareExceptionKey","a","b","name","expectedException","msg","push","isPrototypeOf","call","getActual","e","checkIsPromise","then","catch","waitForActual","promiseFn","Promise","resolve","resultPromise","expectsError","error","details","fnType","expectsNoError","strict","_len6","_key6","throws","_len2","_key2","rejects","_len3","_key3","result","doesNotThrow","_len4","_key4","doesNotReject","_len5","_key5","ifError","newErr","origStack","stack","tmp2","split","shift","tmp1","i","pos","indexOf","slice","join","_defineProperty","defineProperty","enumerable","configurable","writable","_defineProperties","target","props","descriptor","_possibleConstructorReturn","self","_assertThisInitialized","ReferenceError","_wrapNativeSuper","Class","_cache","Function","toString","has","get","set","Wrapper","_construct","_getPrototypeOf","create","_setPrototypeOf","isNativeReflectConstruct","Reflect","construct","sham","Proxy","Date","Parent","o","p","setPrototypeOf","__proto__","getPrototypeOf","endsWith","str","search","this_len","substring","blue","green","red","white","kReadableOperator","strictEqualObject","notStrictEqualObject","notIdentical","copyError","source","inspectValue","val","compact","customInspect","depth","maxArrayLength","Infinity","showHidden","breakLength","showProxy","sorted","getters","_Error","options","limit","stackTraceLimit","String","stderr","isTTY","getColorDepth","other","res","lastPos","end","skipped","actualInspected","actualLines","expectedLines","indicator","inputLength","columns","count","Math","floor","maxCount","log","repeat","pop","maxLines","max","_actualLines","printedLines","skippedMsg","cur","expectedLine","actualLine","divergingLines","createErrDiff","base","_res","knownOperators","code","captureStackTrace","protoProps","subClass","superClass","_inherits","custom","recurseTimes","ctx","ownKeys","getOwnPropertySymbols","filter","sym","getOwnPropertyDescriptor","_objectSpread","util","createErrorType","Base","NodeError","_Base","arg1","arg2","arg3","getMessage","oneOf","thing","isArray","len","map","determiner","start","substr","replace","type","reason","inspected","RangeError","input","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","_i","next","done","_iterableToArrayLimit","_nonIterableRest","regexFlagsSupported","flags","arrayFromSet","array","arrayFromMap","objectGetOwnPropertySymbols","numberIsNaN","Number","isNaN","uncurryThis","f","hasOwnProperty","propertyIsEnumerable","objectToString","isAnyArrayBuffer","isArrayBufferView","isDate","isMap","isSet","isNativeError","isBoxedPrimitive","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isFloat32Array","isFloat64Array","isNonIndex","charCodeAt","pow","getOwnNonIndexProperties","compare","x","y","min","innerDeepEqual","val1","val2","memos","buf1","buf2","val1Tag","keys1","keys2","keyCheck","getTime","RegExp","byteLength","Uint8Array","buffer","byteOffset","areSimilarTypedArrays","offset","areSimilarFloatArrays","_keys","_keys2","size","valueOf","Boolean","BigInt","isEqualBoxedPrimitive","getEnumerables","k","iterationType","aKeys","bKeys","symbolKeysA","symbolKeysB","_symbolKeysB","position","val2MemoA","val2MemoB","areEq","objEquiv","delete","setHasEqualElement","memo","setValues","findLooseMatchingPrimitives","prim","setMightHaveLoosePrim","altValue","mapMightHaveLoosePrim","item","curB","mapHasEqualEntry","key1","item1","key2","aValues","Set","add","bValues","_val","setEquiv","aEntries","_aEntries$i","item2","bEntries","_i2","_bEntries$_i","mapEquiv","keysA","GetIntrinsic","callBind","$indexOf","allowMissing","intrinsic","$apply","$call","$reflectApply","$gOPD","$defineProperty","$max","originalFunction","func","desc","applyBind","hasSymbols","toStr","origDefineProperty","hasPropertyDescriptors","supportsDescriptors","object","predicate","defineProperties","predicates","firstSource","to","nextSource","keysArray","nextIndex","nextKey","polyfill","hasOwn","l","ERROR_MESSAGE","funcType","that","bound","binder","boundLength","boundArgs","Empty","implementation","$SyntaxError","SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","throwTypeError","ThrowTypeError","calleeThrows","gOPDthrows","getProto","needsEval","TypedArray","INTRINSICS","AggregateError","ArrayBuffer","Atomics","DataView","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","isFinite","JSON","parseFloat","parseInt","SharedArrayBuffer","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","doEval","gen","LEGACY_ALIASES","$concat","$spliceApply","splice","$replace","$strSlice","rePropName","reEscapeChar","stringToPath","string","first","last","match","number","quote","subString","getBaseIntrinsic","alias","intrinsicName","parts","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","part","hasArrayLengthDefineBug","origSymbol","hasSymbolSham","symObj","getOwnPropertyNames","syms","toStringTag","ctor","superCtor","super_","TempCtor","hasToStringTag","$toString","callBound","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","GeneratorFunction","fnToStr","isFnRegex","generatorFunc","getGeneratorFunc","define","getPolyfill","shim","NaN","availableTypedArrays","g","globalThis","typedArrays","$slice","toStrTags","gOPD","typedArray","proto","superProto","tag","anyTrue","getter","tryTypedArrays","keysShim","isArgs","isEnumerable","hasDontEnumBug","hasProtoEnumBug","dontEnums","equalsConstructorPrototype","excludedKeys","$applicationCache","$console","$external","$frame","$frameElement","$frames","$innerHeight","$innerWidth","$onmozfullscreenchange","$onmozfullscreenerror","$outerHeight","$outerWidth","$pageXOffset","$pageYOffset","$parent","$scrollLeft","$scrollTop","$scrollX","$scrollY","$self","$webkitIndexedDB","$webkitStorageInfo","$window","hasAutomationEqualityBug","window","isObject","isFunction","isArguments","isString","theKeys","skipProto","j","skipConstructor","equalsConstructorPrototypeIfNotBuggy","origKeys","originalKeys","keysWorksWithArguments","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","arg","copy","fill","readUInt8","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","BigIntSupported","SymbolSupported","ObjectToString","numberValue","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isBigInt64Array","isBigUint64Array","isWeakMap","isWeakSet","SharedArrayBufferCopy","isSharedArrayBufferToString","isSharedArrayBuffer","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","method","getOwnPropertyDescriptors","descriptors","formatRegExp","format","objects","stringify","_","isNull","deprecate","noDeprecation","throwDeprecation","traceDeprecation","trace","debugs","debugEnvRegex","NODE_DEBUG","debugEnv","toUpperCase","opts","seen","stylize","stylizeNoColor","colors","isBoolean","_extend","isUndefined","stylizeWithColor","formatValue","styleType","style","styles","ret","primitive","simple","isNumber","formatPrimitive","visibleKeys","hash","idx","arrayToHash","isError","formatError","output","braces","toUTCString","formatProperty","formatArray","reduce","prev","reduceToSingleString","line","ar","re","d","pad","n","debuglog","pid","types","isNullOrUndefined","isSymbol","isPrimitive","isBuffer","months","timestamp","time","getHours","getMinutes","getSeconds","getDate","getMonth","prop","inherits","origin","kCustomPromisifiedSymbol","callbackifyOnRejected","cb","newReason","promisify","original","promiseResolve","promiseReject","promise","reject","callbackify","callbackified","maybeCb","rej","foundName","os","fs","path","rbql","rbql_csv","csv_utils","number_regex","update_subcomponent_stats","field","is_first_line","max_field_components_lens","match_result","exec","cur_integer_part_length","cur_fractional_part_length","align_field","is_last_column","trim","delta_length","dot_pos","integer_delta_length","fractional_delta_length","trailing_spaces","make_table_name_key","file_path","find_table_path","vscode_global_state","main_table_dir","table_id","filepath","candidate_path","charAt","homedir","existsSync","isAbsolute","table_path","get_header_line","document","comment_prefix","num_lines","lineCount","lnum","line_text","lineAt","text","startsWith","RbqlIOHandlingError","VSCodeRecordIterator","RBQLInputIterator","delim","policy","has_header","table_name","variable_prefix","super","NR","NL","fields_info","first_defective_line","first_record","get_first_record","stop","header_line","smart_split","async","query_text","variable_map","parse_basic_variables","parse_array_variables","parse_attribute_variables","parse_dictionary_variables","get_line_rfc","rfc_line_buffer","record_line","accumulate_rfc_line_into_record","get_line_simple","do_get_record","record","warning","num_fields","get_warnings","inconsistent_records_info","entries","record_id","sort","condition","record_1","num_fields_1","record_2","num_fields_2","warn_msg","make_inconsistent_num_fields_warning","VSCodeWriter","RBQLOutputWriter","header_len","null_in_output","delim_in_simple_output","output_lines","polymorphic_join","simple_join","quoted_join","quoted_join_rfc","mono_join","set_header","header","write","fields","v","quote_field","rfc_quote_field","normalize_fields","out_fields","sub_array_delim","VSCodeTableRegistry","get_iterator_by_table_id","_table_id","VSCodeFileSystemCSVRegistry","RBQLTableRegistry","input_file_dir","encoding","stream","record_iterator","bulk_input_path","createReadStream","CSVRecordIterator","output_warnings","basename","read_header","input_reader","createInterface","closed","promise_resolve","promise_reject","output_promise","close","rbql_query_web","input_document","input_delim","input_policy","output_delim","output_policy","with_headers","join_tables_registry","input_iterator","output_writer","query","rbql_query_node","input_path","output_path","csv_encoding","user_init_code","input_stream","stdin","output_stream","close_output_on_finish","stdout","createWriteStream","is_ascii","default_init_source_path","read_user_init_code","dirname","CSVWriter","populate_optimistic_rfc_csv_record_map","requested_end_record","dst_record_map","record_begin","match_list","has_unbalanced_double_quote","get_default_js_udf_content","get_default_python_udf_content","align_columns","active_doc","column_stats","result_lines","has_edit","fnum","adjusted","shrink_columns","calc_column_stats","adjust_column_stats","adjusted_stats","column_stat","field_rgx","field_rgx_external_whitespaces","extract_next_field","src","dlm","preserve_quotes_and_whitespaces","allow_external_whitespaces","cidx","src_cur","match_obj","match_end","uidx","split_quoted_str","extraction_report","unquote_field","split_whitespace_separated_str","preserve_whitespaces","rgxp","unquote_fields","split_lines","external_rfc_line_buffer","current_line","multiline_row","RbqlParsingError","RbqlRuntimeError","InternalBadFieldError","bad_idx","params","replace_all","replacement","RBQLContext","writer","unnest_list","top_count","like_regex_cache","sort_key_expression","aggregation_stage","aggregation_key_expression","functional_aggregators","join_map_impl","join_map","lhs_join_var_expression","where_expression","select_expression","update_expressions","variables_init_code","query_context","wrong_aggregation_usage_error","RBQL_VERSION","check_if_brackets_match","opening_bracket","closing_bracket","parse_root_bracket_level_text_spans","text_spans","last_pos","bracket_stack","cur_char","span","unquote_string","quoted_str","column_info_from_text_span","text_span","string_literals","rbql_star_marker","simple_var_match","attribute_match","subscript_int_match","subscript_str_match","column_index","column_name","is_star","replaced_string_literal_id","unquoted_column_name","adhoc_parse_select_expression_to_column_infos","ts","stable_compare","safe_get","safe_join_get","safe_set","regexp_escape","like_to_regex","pattern","converted","like","matcher","LIKE","RBQLAggregationToken","marker_id","UnnestMarker","UNNEST","vals","unnest","Unnest","UNFOLD","parse_number","MinAggregator","stats","increment","cur_aggr","get_final","MaxAggregator","SumAggregator","AvgAggregator","cur_sum","cur_cnt","VarianceAggregator","cur_sum_sq","avg_val","MedianAggregator","m","CountAggregator","ArrayAggAggregator","post_proc","ConstGroupVerifier","output_index","const_values","old_value","init_aggregator","generator_name","MIN","Min","MAX","Max","COUNT","Count","SUM","sum","Sum","AVG","avg","Avg","VARIANCE","variance","Variance","MEDIAN","median","Median","ARRAY_AGG","array_agg","FOLD","add_to_set","dst_set","len_before","TopWriter","subwriter","NW","finish","UniqWriter","UniqCountWriter","records","old_val","unshift","SortedWriter","reverse_sort","unsorted_entries","stable_entry","reverse","entry","AggregateWriter","aggregators","aggregation_keys","all_keys","from","ag","InnerJoiner","get_rhs","lhs_key","get_join_records","LeftJoiner","null_record","max_record_len","StrictLeftJoiner","select_except","except_fields","select_simple","sort_key","sort_entry","select_aggregated","transparent_values","num_aggregators_found","trans_value","select_unnested","folded_fields","unnest_pos","findIndex","PROCESS_SELECT_COMMON","PROCESS_SELECT_SIMPLE","PROCESS_SELECT_JOIN","PROCESS_UPDATE_JOIN","PROCESS_UPDATE_SIMPLE","MAIN_LOOP_BODY","embed_expression","parent_code","child_placeholder","child_expression","embed_code","child_code","parent_lines","child_lines","placeholder_indentation","generate_main_loop_code","is_select_query","is_join_query","js_code","compile_and_run","main_loop_body","main_loop_promise","lower_case_query","toLowerCase","GROUP_BY","UPDATE","SELECT","JOIN","INNER_JOIN","LEFT_JOIN","LEFT_OUTER_JOIN","STRICT_LEFT_JOIN","ORDER_BY","WHERE","LIMIT","EXCEPT","WITH","get_ambiguous_error_msg","variable_name","get_all_matches","regexp","str_strip","strip_comments","cline","combine_string_literals","backend_expression","prefix","dst_variables_map","matches","field_num","initialize","index","js_string_escape_column_name","quote_char","query_probably_has_dictionary_variable","continuous_name_segments","continuous_segment","column_names","dict_test_rgx","escaped_column_name","column_names_source","column_names_from_query","zero_based_idx","map_variables_directly","ensure_no_ambiguous_variables","input_column_names","join_column_names","join_column_names_set","parse_join_expression","invalid_join_syntax_error","variable_pairs","pair_rgx","and_rgx","resolve_join_variables","input_variables_map","join_variables_map","lhs_variables","rhs_indices","valid_join_syntax_msg","variable_pair","join_var_1","join_var_2","lhs_key_index","rhs_key_index","generate_common_init_code","base_var","attr_var","generate_init_statements","variables_map","indent","code_lines","simple_var_name_rgx","var_info","variable_declaration_keyword","replace_star_count","aggregate_expression","replace_star_vars","rbql_expression","replacement_expression","replace_star_vars_for_header_parsing","translate_update_expression","update_expression","first_assignment_error","assignment_looking_rgx","dst_var_name","var_index","current_indent","translate_select_expression","expression_without_stars","translated","translated_for_header","separate_string_literals","rgx","format_parts","idx_before","literal_id","string_literal","start_index","lastIndex","format_expression","locate_statements","statement_groups","ig","statement","match_str","separate_actions","with_match","ordered_statements","statement_start","span_start","span_end","statement_params","new_span","find_top","rb_actions","select_action","translate_except_expression","except_expression","input_header","skip_vars","skip_indices","var_name","HashJoinMap","key_indices","hash_map","nr","key_index","polymorphic_get_key","get_single_key","get_multi_key","ki","get_record","nf","key_records","cleanup_query","remove_redundant_table_name","select_output_header","join_header","query_column_infos","output_header","qci","handle_query_modifier","TableIterator","table","normalize_column_names","stopped","TableWriter","external_table","SingleTableRegistry","shallow_parse_input_query","get_variables_map","rhs_table_id","join_record_iterator","get_header","sql_join_type","build","select_expression_for_ast","query_table","input_table","output_table","join_table","output_column_names","exception_to_error_info","exceptions_type_map","error_type","utf_decoding_error","rbql_init_source_path","readFileSync","name_record","index_path","content","lines","try_read_index","get_index_record","RecordQueue","push_stack","pull_stack","enqueue","dequeue","csv_path","first_record_should_be_emitted","header_preread_complete","decoder","TextDecoder","fatal","input_exhausted","started","utf8_bom_removed","partially_decoded_line","partially_decoded_line_ends_with_cr","resolve_current_record","reject_current_record","current_exception","produced_records_queue","process_line_polymorphic","process_partial_rfc_record_line","process_record_line","modifier","reset_external_callbacks","try_propagate_exception","exception","store_or_propagate_exception","pause","preread_first_record","try_resolve_next_record","isPaused","resume","parent_iterator","current_record_promise","num_records","process_line","clean_line","assumed_source_encoding","remove_utf8_bom","process_data_stream_chunk","data_chunk","decoded_string","decode","first_line_index","process_data_bulk","control_buffer","Buffer","process_data_stream_end","last_line","destroy","readFile","close_stream_on_finish","line_separator","setDefaultEncoding","error_obj","store_first_error","first_error","writer_error","_write_all","output_encoding","FileSystemCSVRegistry","interpret_named_csv_format","format_name","query_csv","require","possibleNames","out","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","vscode","rainbow_utils","is_web_ext","poor_rbql_async_design_workaround_timeout","sleep","ms","log_message","workspace","workspaceFolders","workspace_folder_uri","uri","field_components","test_align_stats","max_components_lens","aligned_field","test_field_align","adjusted_components","test_adjust_column_stats","Uri","joinPath","openTextDocument","languageId","editor","showTextDocument","test_no_autodetection","state_report","commands","executeCommand","check_initialization_state","initialized","lazy_loaded","test_autodetection","test_manual_enable_disable","test_task","rbql_backend","rbql_query","check_last_rbql_warnings","warnings","activeTextEditor","length_after_query","getText","check_last_rbql_report","error_msg","enable_rfc_newlines","test_rbql_web","filename_before","fileName","length_before_query","filename_after_copy_back","test_rbql_node","length_original","length_aligned","lint_report","length_shrinked","text_with_comma","test_align_shrink_lint","length_after_column_edit","length_after_delete","test_column_edit"],"sourceRoot":""} \ No newline at end of file diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/extension.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/extension.js similarity index 91% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/extension.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/extension.js index 5fcbc9de..1ec0cf53 100644 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/extension.js +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/extension.js @@ -103,6 +103,11 @@ function sleep(ms) { } +async function push_current_stack_to_js_callback_queue_to_allow_ui_update() { + await sleep(0); +} + + function map_separator_to_language_id(separator) { for (let language_id in dialect_map) { if (!dialect_map.hasOwnProperty(language_id)) @@ -142,6 +147,13 @@ function get_rfc_record_text(document, record_start, record_end) { } +async function replace_doc_content(active_editor, active_doc, new_content) { + let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0); + let full_range = active_doc.validateRange(invalid_range); + await active_editor.edit(edit => edit.replace(full_range, new_content)); +} + + function sample_preview_records_from_context(rbql_context, dst_message) { let document = rbql_context.input_document; let delim = rbql_context.delim; @@ -204,9 +216,14 @@ function make_with_headers_key(file_path) { } -function get_header_from_document(document, delim, policy) { +function get_from_config(param_name, default_value) { const config = vscode.workspace.getConfiguration('rainbow_csv'); - let comment_prefix = config ? config.get('comment_prefix') : ''; + return config ? config.get(param_name) : default_value; +} + + +function get_header_from_document(document, delim, policy) { + let comment_prefix = get_from_config('comment_prefix', ''); let header_line = ll_rainbow_utils().get_header_line(document, comment_prefix); return csv_utils.smart_split(header_line, delim, policy, /*preserve_quotes_and_whitespaces=*/false)[0]; } @@ -243,8 +260,7 @@ function make_hover_text(document, position, language_id, enable_tooltip_column_ var cnum = position.character; var line = document.lineAt(lnum).text; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let comment_prefix = config ? config.get('comment_prefix') : ''; + let comment_prefix = get_from_config('comment_prefix', ''); if (comment_prefix && line.startsWith(comment_prefix)) return 'Comment'; @@ -282,13 +298,11 @@ function make_hover(document, position, language_id, cancellation_token) { if (last_statusbar_doc != document) { refresh_status_bar_buttons(document); // Being paranoid and making sure that the buttons are visible. } - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (!config) + if (!get_from_config('enable_tooltip', false)) { return; - if (!config.get('enable_tooltip')) - return; - let enable_tooltip_column_names = config.get('enable_tooltip_column_names'); - let enable_tooltip_warnings = config.get('enable_tooltip_warnings'); + } + let enable_tooltip_column_names = get_from_config('enable_tooltip_column_names', false); + let enable_tooltip_warnings = get_from_config('enable_tooltip_warnings', false); var hover_text = make_hover_text(document, position, language_id, enable_tooltip_column_names, enable_tooltip_warnings); if (hover_text && !cancellation_token.isCancellationRequested) { let mds = null; @@ -305,9 +319,9 @@ function make_hover(document, position, language_id, cancellation_token) { } -function produce_lint_report(active_doc, delim, policy, config) { - let comment_prefix = config.get('comment_prefix'); - let detect_trailing_spaces = config.get('csv_lint_detect_trailing_spaces'); +function produce_lint_report(active_doc, delim, policy) { + let comment_prefix = get_from_config('comment_prefix', ''); + let detect_trailing_spaces = get_from_config('csv_lint_detect_trailing_spaces', false); let first_trailing_space_line = null; var num_lines = active_doc.lineCount; var num_fields = null; @@ -487,17 +501,13 @@ function csv_lint(active_doc, is_manual_op) { if (!is_manual_op) { if (lint_results.has(lint_cache_key)) return null; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (config && config.get('enable_auto_csv_lint') === false) + if (!get_from_config('enable_auto_csv_lint', false)) return null; } - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (!config) - return null; lint_results.set(lint_cache_key, 'Processing...'); refresh_status_bar_buttons(active_doc); // Visual feedback. let [delim, policy] = dialect_map[language_id]; - var lint_report = produce_lint_report(active_doc, delim, policy, config); + var lint_report = produce_lint_report(active_doc, delim, policy); lint_results.set(lint_cache_key, lint_report); return lint_report; } @@ -647,16 +657,14 @@ function file_path_to_query_key(file_path) { } function get_dst_table_dir(input_table_path) { - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (!config) + let rbql_output_dir = get_from_config('rbql_output_dir', 'TMP') + if (rbql_output_dir == 'TMP') { return os.tmpdir(); - if (config.get('rbql_output_dir') == 'TMP') { - return os.tmpdir(); - } else if (config.get('rbql_output_dir') == 'INPUT') { + } else if (rbql_output_dir == 'INPUT') { return path.dirname(input_table_path); } else { - // If the directory does not exist or isn't writable RBQL itself will report more or less clear error. - return config.get('rbql_output_dir'); + // Return custom directory. If the directory does not exist or isn't writable RBQL itself will report more or less clear error. + return rbql_output_dir; } } @@ -869,10 +877,7 @@ async function column_edit(edit_mode) { let dialect = get_dialect(active_doc); let delim = dialect[0]; let policy = dialect[1]; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (!config) - return; - let comment_prefix = config.get('comment_prefix'); + let comment_prefix = get_from_config('comment_prefix', ''); let position = active_editor.selection.active; let lnum = position.line; @@ -939,7 +944,8 @@ async function column_edit(edit_mode) { } -async function shrink_table(active_editor, edit_builder) { +async function shrink_table() { + let active_editor = get_active_editor(); let active_doc = get_active_doc(active_editor); if (!active_doc) return; @@ -947,24 +953,31 @@ async function shrink_table(active_editor, edit_builder) { if (!dialect_map.hasOwnProperty(language_id)) return; let [delim, policy] = dialect_map[language_id]; - let [shrinked_doc_text, first_failed_line] = ll_rainbow_utils().shrink_columns(active_doc, delim, policy); - if (first_failed_line) { - show_single_line_error(`Unable to shrink: Inconsistent double quotes at line ${first_failed_line}`); - return; - } - aligned_files.delete(active_doc.fileName); - refresh_status_bar_buttons(active_doc); - if (shrinked_doc_text === null) { - vscode.window.showWarningMessage('No trailing whitespaces found, skipping'); - return; - } - let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0); - let full_range = active_doc.validateRange(invalid_range); - edit_builder.replace(full_range, shrinked_doc_text); + let comment_prefix = get_from_config('comment_prefix', ''); + let progress_options = {location: vscode.ProgressLocation.Window, title: 'Rainbow CSV'}; + await vscode.window.withProgress(progress_options, async (progress) => { + progress.report({message: 'Preparing'}); + await push_current_stack_to_js_callback_queue_to_allow_ui_update(); + let [shrinked_doc_text, first_failed_line] = ll_rainbow_utils().shrink_columns(active_doc, delim, policy, comment_prefix); + if (first_failed_line) { + show_single_line_error(`Unable to shrink: Inconsistent double quotes at line ${first_failed_line}`); + return; + } + aligned_files.delete(active_doc.fileName); + refresh_status_bar_buttons(active_doc); + if (shrinked_doc_text === null) { + vscode.window.showWarningMessage('No trailing whitespaces found, skipping'); + return; + } + progress.report({message: 'Shrinking columns'}); + await push_current_stack_to_js_callback_queue_to_allow_ui_update(); + await replace_doc_content(active_editor, active_doc, shrinked_doc_text); + }); } -async function align_table(active_editor, edit_builder) { +async function align_table() { + let active_editor = get_active_editor(); let active_doc = get_active_doc(active_editor); if (!active_doc) return; @@ -972,21 +985,35 @@ async function align_table(active_editor, edit_builder) { if (!dialect_map.hasOwnProperty(language_id)) return; let [delim, policy] = dialect_map[language_id]; - let [column_sizes, first_failed_line] = ll_rainbow_utils().calc_column_sizes(active_doc, delim, policy); - if (first_failed_line) { - show_single_line_error(`Unable to align: Inconsistent double quotes at line ${first_failed_line}`); - return; - } - let aligned_doc_text = ll_rainbow_utils().align_columns(active_doc, delim, policy, column_sizes); - aligned_files.add(active_doc.fileName); - refresh_status_bar_buttons(active_doc); - if (aligned_doc_text === null) { - vscode.window.showWarningMessage('Table is already aligned, skipping'); - return; - } - let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0); - let full_range = active_doc.validateRange(invalid_range); - edit_builder.replace(full_range, aligned_doc_text); + let comment_prefix = get_from_config('comment_prefix', ''); + let progress_options = {location: vscode.ProgressLocation.Window, title: 'Rainbow CSV'}; + await vscode.window.withProgress(progress_options, async (progress) => { + progress.report({message: 'Calculating column statistics'}); + await push_current_stack_to_js_callback_queue_to_allow_ui_update(); + let [column_stats, first_failed_line] = ll_rainbow_utils().calc_column_stats(active_doc, delim, policy, comment_prefix); + if (first_failed_line) { + show_single_line_error(`Unable to align: Inconsistent double quotes at line ${first_failed_line}`); + return; + } + column_stats = ll_rainbow_utils().adjust_column_stats(column_stats); + if (column_stats === null) { + show_single_line_error('Unable to allign: Internal Rainbow CSV Error'); + return; + } + progress.report({message: 'Preparing final alignment'}); + await push_current_stack_to_js_callback_queue_to_allow_ui_update(); + aligned_doc_text = ll_rainbow_utils().align_columns(active_doc, delim, policy, comment_prefix, column_stats); + aligned_files.add(active_doc.fileName); + refresh_status_bar_buttons(active_doc); + if (aligned_doc_text === null) { + vscode.window.showWarningMessage('Table is already aligned, skipping'); + return; + } + // The last stage of actually applying the edits takes almost 80% of the whole alignment runtime. + progress.report({message: 'Aligning columns'}); + await push_current_stack_to_js_callback_queue_to_allow_ui_update(); + await replace_doc_content(active_editor, active_doc, aligned_doc_text); + }); } @@ -995,9 +1022,7 @@ async function do_copy_back(query_result_doc, active_editor) { let active_doc = get_active_doc(active_editor); if (!active_doc) return; - let invalid_range = new vscode.Range(0, 0, active_doc.lineCount /* Intentionally missing the '-1' */, 0); - let full_range = active_doc.validateRange(invalid_range); - await active_editor.edit(edit => edit.replace(full_range, data)); + await replace_doc_content(active_editor, active_doc, data); } @@ -1216,7 +1241,6 @@ async function edit_rbql(integration_test_options=null) { show_single_line_error("Unable to run RBQL for this file"); return; } - const config = vscode.workspace.getConfiguration('rainbow_csv'); let language_id = active_doc.languageId; let delim = 'monocolumn'; let policy = 'monocolumn'; @@ -1224,7 +1248,7 @@ async function edit_rbql(integration_test_options=null) { [delim, policy] = dialect_map[language_id]; } let enable_rfc_newlines = get_from_global_state(make_rfc_policy_key(input_path), false); - let with_headers_by_default = config ? config.get('rbql_with_headers_by_default') : false; + let with_headers_by_default = get_from_config('rbql_with_headers_by_default', false); let with_headers = get_from_global_state(make_with_headers_key(input_path), with_headers_by_default); let header = get_header_from_document(active_doc, delim, policy); rbql_context = { @@ -1258,8 +1282,7 @@ function get_num_columns_if_delimited(active_doc, delim, policy, min_num_columns var num_lines = active_doc.lineCount; let num_fields = 0; let num_lines_checked = 0; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let comment_prefix_for_autodetection = config ? config.get('comment_prefix') : ''; + let comment_prefix_for_autodetection = get_from_config('comment_prefix', ''); if (!comment_prefix_for_autodetection) comment_prefix_for_autodetection = '#'; for (var lnum = 0; lnum < num_lines; lnum++) { @@ -1282,8 +1305,7 @@ function get_num_columns_if_delimited(active_doc, delim, policy, min_num_columns function autodetect_dialect(active_doc, candidate_separators) { - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let min_num_lines = config ? config.get('autodetection_min_line_count') : 10; + let min_num_lines = get_from_config('autodetection_min_line_count', 10); if (active_doc.lineCount < min_num_lines) return null; @@ -1331,10 +1353,9 @@ function autodetect_dialect_frequency_based(active_doc, candidate_separators) { async function autoenable_rainbow_csv(active_doc) { if (!active_doc) return; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (!config || !config.get('enable_separator_autodetection')) + if (!get_from_config('enable_separator_autodetection', false)) return; - let candidate_separators = config.get('autodetect_separators'); + let candidate_separators = get_from_config('autodetect_separators', []); var original_language_id = active_doc.languageId; var file_path = active_doc.fileName; if (!file_path || autodetection_stoplist.has(file_path)) { @@ -1368,8 +1389,7 @@ async function handle_doc_edit(change_event) { let active_doc = change_event.document; if (!active_doc) return; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let candidate_separators = config.get('autodetect_separators'); + let candidate_separators = get_from_config('autodetect_separators', []); let rainbow_csv_language_id = autodetect_dialect(active_doc, candidate_separators); if (!rainbow_csv_language_id) return; @@ -1380,8 +1400,7 @@ async function handle_doc_edit(change_event) { function register_csv_copy_paste(active_doc) { - const config = vscode.workspace.getConfiguration('rainbow_csv'); - if (!config || !config.get('enable_separator_autodetection')) + if (!get_from_config('enable_separator_autodetection', false)) return; if (!active_doc || doc_edit_subscription) return; @@ -1523,8 +1542,8 @@ async function activate(context) { var rainbow_off_cmd = vscode.commands.registerCommand('rainbow-csv.RainbowSeparatorOff', restore_original_language); var sample_head_cmd = vscode.commands.registerCommand('rainbow-csv.SampleHead', async function(uri) { await make_preview(uri, 'head'); }); // WEB_DISABLED var sample_tail_cmd = vscode.commands.registerCommand('rainbow-csv.SampleTail', async function(uri) { await make_preview(uri, 'tail'); }); // WEB_DISABLED - var align_cmd = vscode.commands.registerTextEditorCommand('rainbow-csv.Align', align_table); - var shrink_cmd = vscode.commands.registerTextEditorCommand('rainbow-csv.Shrink', shrink_table); + var align_cmd = vscode.commands.registerCommand('rainbow-csv.Align', align_table); + var shrink_cmd = vscode.commands.registerCommand('rainbow-csv.Shrink', shrink_table); var copy_back_cmd = vscode.commands.registerCommand('rainbow-csv.CopyBack', copy_back); // WEB_DISABLED var internal_test_cmd = vscode.commands.registerCommand('rainbow-csv.InternalTest', run_internal_test_cmd); diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/package.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/package.json similarity index 98% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/package.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/package.json index d61dda99..b002bf9b 100644 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/package.json +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/package.json @@ -2,7 +2,7 @@ "name": "rainbow-csv", "displayName": "Rainbow CSV", "description": "Highlight CSV and TSV files, Run SQL-like queries", - "version": "2.2.0", + "version": "2.3.0", "publisher": "mechatroner", "license": "MIT", "icon": "rainbow_csv_logo.png", @@ -424,8 +424,10 @@ "id": "3792588c-3d35-442d-91ea-fe6a755e8155", "publisherId": "0d5438b6-325a-4f88-aa28-6192aa2cf2a6", "publisherDisplayName": "mechatroner", + "targetPlatform": "undefined", + "updated": true, "isPreReleaseVersion": false, "preRelease": false, - "installedTimestamp": 1648374022933 + "installedTimestamp": 1651501115341 } } \ No newline at end of file diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rainbow_csv_logo.png b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rainbow_csv_logo.png similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rainbow_csv_logo.png rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rainbow_csv_logo.png diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rainbow_utils.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rainbow_utils.js similarity index 78% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rainbow_utils.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rainbow_utils.js index 7b35eecf..6645c851 100644 --- a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rainbow_utils.js +++ b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rainbow_utils.js @@ -1,17 +1,16 @@ const os = require('os'); const fs = require('fs'); const path = require('path'); + const rbql = require('./rbql_core/rbql-js/rbql.js'); const rbql_csv = require('./rbql_core/rbql-js/rbql_csv.js'); - -const vscode = require('vscode'); - const csv_utils = require('./rbql_core/rbql-js/csv_utils.js'); +const non_numeric_sentinel = -1; +const number_regex = /^([0-9]+)(\.[0-9]+)?$/; class AssertionError extends Error {} - function assert(condition, message=null) { if (!condition) { if (!message) { @@ -58,11 +57,36 @@ function get_default_python_udf_content() { } -function calc_column_sizes(active_doc, delim, policy) { - let result = []; +function update_subcomponent_stats(field, is_first_line, max_field_components_lens) { + // Extract overall field length and length of integer and fractional parts of the field if it represents a number. + // Here `max_field_components_lens` is a tuple: (max_field_length, max_integer_part_length, max_fractional_part_length) + if (field.length > max_field_components_lens[0]) { + max_field_components_lens[0] = field.length; + } + if (max_field_components_lens[1] == non_numeric_sentinel) { + // Column is not a number, early return. + return; + } + let match_result = number_regex.exec(field); + if (match_result === null) { + if (!is_first_line && field.length) { // Checking field_length here allows numeric columns to have some of the fields empty. + // We only mark the column as non-header if we know that this is not a header line. + max_field_components_lens[1] = non_numeric_sentinel; + max_field_components_lens[2] = non_numeric_sentinel; + } + return; + } + let cur_integer_part_length = match_result[1].length; + max_field_components_lens[1] = Math.max(max_field_components_lens[1], cur_integer_part_length); + let cur_fractional_part_length = match_result[2] === undefined ? 0 : match_result[2].length; + max_field_components_lens[2] = Math.max(max_field_components_lens[2], cur_fractional_part_length); +} + + +function calc_column_stats(active_doc, delim, policy, comment_prefix) { + let column_stats = []; let num_lines = active_doc.lineCount; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let comment_prefix = config ? config.get('comment_prefix') : ''; + let is_first_line = true; for (let lnum = 0; lnum < num_lines; lnum++) { let line_text = active_doc.lineAt(lnum).text; if (comment_prefix && line_text.startsWith(comment_prefix)) @@ -71,42 +95,105 @@ function calc_column_sizes(active_doc, delim, policy) { if (warning) { return [null, lnum + 1]; } - for (let i = 0; i < fields.length; i++) { - if (result.length <= i) - result.push(0); - result[i] = Math.max(result[i], (fields[i].trim()).length); + for (let fnum = 0; fnum < fields.length; fnum++) { + let field = fields[fnum].trim(); + if (column_stats.length <= fnum) { + column_stats.push([0, 0, 0]); + } + update_subcomponent_stats(field, is_first_line, column_stats[fnum]); } + is_first_line = false; } - return [result, null]; + return [column_stats, null]; } -function align_columns(active_doc, delim, policy, column_sizes) { +function adjust_column_stats(column_stats) { + // Ensure that numeric components max widths are consistent with non-numeric (header) width. + let adjusted_stats = []; + for (let column_stat of column_stats) { + if (column_stat[1] <= 0) { + column_stat[1] = -1; + column_stat[2] = -1; + } + if (column_stat[1] > 0) { + // The sum of integer and float parts can be bigger than the max width, e.g. here: + // value + // 0.12 + // 1234 + if (column_stat[1] + column_stat[2] > column_stat[0]) { + column_stat[0] = column_stat[1] + column_stat[2]; + } + // This is needed when the header is wider than numeric components and/or their sum. + if (column_stat[0] - column_stat[2] > column_stat[1]) { + column_stat[1] = column_stat[0] - column_stat[2]; + } + // Sanity check. + if (column_stat[0] != column_stat[1] + column_stat[2]) { + // Assertion Error, this can never happen. + return null; + } + } + adjusted_stats.push(column_stat); + } + return adjusted_stats; +} + + +function align_field(field, is_first_line, max_field_components_lens, is_last_column) { + // Align field, use Math.max() to avoid negative delta_length which can happen theorethically due to async doc edit. + const extra_readability_whitespace_length = 1; + field = field.trim(); + if (max_field_components_lens[1] == non_numeric_sentinel) { + let delta_length = Math.max(max_field_components_lens[0] - field.length, 0); + return is_last_column ? field : field + ' '.repeat(delta_length + extra_readability_whitespace_length); + } + if (is_first_line) { + if (number_regex.exec(field) === null) { + // The line must be a header - align it using max_width rule. + let delta_length = Math.max(max_field_components_lens[0] - field.length, 0); + return is_last_column ? field : field + ' '.repeat(delta_length + extra_readability_whitespace_length); + } + } + let dot_pos = field.indexOf('.'); + let cur_integer_part_length = dot_pos == -1 ? field.length : dot_pos; + // Here cur_fractional_part_length includes the leading dot too. + let cur_fractional_part_length = dot_pos == -1 ? 0 : field.length - dot_pos; + let integer_delta_length = Math.max(max_field_components_lens[1] - cur_integer_part_length, 0); + let fractional_delta_length = Math.max(max_field_components_lens[2] - cur_fractional_part_length); + let trailing_spaces = is_last_column ? '' : ' '.repeat(fractional_delta_length + extra_readability_whitespace_length); + return ' '.repeat(integer_delta_length) + field + trailing_spaces; +} + + +function align_columns(active_doc, delim, policy, comment_prefix, column_stats) { let result_lines = []; let num_lines = active_doc.lineCount; let has_edit = false; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let comment_prefix = config ? config.get('comment_prefix') : ''; + let is_first_line = true; for (let lnum = 0; lnum < num_lines; lnum++) { let line_text = active_doc.lineAt(lnum).text; if (comment_prefix && line_text.startsWith(comment_prefix)) { result_lines.push(line_text); continue; } + if (lnum + 1 == num_lines && line_text == '') { + // Skip the last empty line which corresponds to the trailing newline character. + result_lines.push(line_text); + continue; + } let fields = csv_utils.smart_split(line_text, delim, policy, true)[0]; - for (let i = 0; i < fields.length - 1; i++) { - if (i >= column_sizes.length) // Safeguard against async doc edit. + for (let fnum = 0; fnum < fields.length; fnum++) { + if (fnum >= column_stats.length) // Safeguard against async doc edit, should never happen. break; - let adjusted = fields[i].trim(); - let delta_len = column_sizes[i] - adjusted.length; - if (delta_len >= 0) { // Safeguard against async doc edit. - adjusted += ' '.repeat(delta_len + 1); - } - if (fields[i] != adjusted) { - fields[i] = adjusted; + let is_last_column = fnum + 1 == column_stats.length; + let adjusted = align_field(fields[fnum], is_first_line, column_stats[fnum], is_last_column); + if (fields[fnum] != adjusted) { + fields[fnum] = adjusted; has_edit = true; } } + is_first_line = false; result_lines.push(fields.join(delim)); } if (!has_edit) @@ -115,12 +202,10 @@ function align_columns(active_doc, delim, policy, column_sizes) { } -function shrink_columns(active_doc, delim, policy) { +function shrink_columns(active_doc, delim, policy, comment_prefix) { let result_lines = []; let num_lines = active_doc.lineCount; let has_edit = false; - const config = vscode.workspace.getConfiguration('rainbow_csv'); - let comment_prefix = config ? config.get('comment_prefix') : ''; for (let lnum = 0; lnum < num_lines; lnum++) { let line_text = active_doc.lineAt(lnum).text; if (comment_prefix && line_text.startsWith(comment_prefix)) { @@ -584,4 +669,7 @@ module.exports.get_default_js_udf_content = get_default_js_udf_content; module.exports.get_default_python_udf_content = get_default_python_udf_content; module.exports.align_columns = align_columns; module.exports.shrink_columns = shrink_columns; -module.exports.calc_column_sizes = calc_column_sizes; +module.exports.calc_column_stats = calc_column_stats; +module.exports.adjust_column_stats = adjust_column_stats; +module.exports.update_subcomponent_stats = update_subcomponent_stats; +module.exports.align_field = align_field; diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql mock/rbql_mock.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql mock/rbql_mock.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql mock/rbql_mock.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql mock/rbql_mock.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_client.html b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_client.html similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_client.html rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_client.html diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_client.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_client.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_client.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_client.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/LICENSE b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/LICENSE similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/LICENSE rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/LICENSE diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/README.md b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/README.md similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/README.md rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/README.md diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/.eslintrc.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/.eslintrc.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/.eslintrc.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/.eslintrc.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/cli_parser.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/cli_parser.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/cli_parser.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/cli_parser.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/cli_rbql.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/cli_rbql.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/cli_rbql.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/cli_rbql.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/csv_utils.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/csv_utils.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/csv_utils.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/csv_utils.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/rbql.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/rbql.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/rbql.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/rbql.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/rbql_csv.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/rbql_csv.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql-js/rbql_csv.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql-js/rbql_csv.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/__init__.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/__init__.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/__init__.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/__init__.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/__main__.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/__main__.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/__main__.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/__main__.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/_version.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/_version.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/_version.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/_version.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/csv_utils.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/csv_utils.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/csv_utils.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/csv_utils.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_csv.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_csv.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_csv.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_csv.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_engine.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_engine.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_engine.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_engine.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_ipython.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_ipython.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_ipython.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_ipython.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_main.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_main.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_main.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_main.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_pandas.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_pandas.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_pandas.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_pandas.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_sqlite.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_sqlite.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql/rbql_sqlite.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql/rbql_sqlite.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql_logo.png b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql_logo.png similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/rbql_logo.png rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/rbql_logo.png diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/vscode_rbql.py b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/vscode_rbql.py similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_core/vscode_rbql.py rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_core/vscode_rbql.py diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_logo.svg b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_logo.svg similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_logo.svg rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_logo.svg diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_suggest.js b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_suggest.js similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/rbql_suggest.js rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/rbql_suggest.js diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/clnsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/clnsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/clnsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/clnsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/crtsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/crtsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/crtsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/crtsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/csv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/csv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/csv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/csv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/dbqsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/dbqsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/dbqsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/dbqsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/dotsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/dotsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/dotsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/dotsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/eqlsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/eqlsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/eqlsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/eqlsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/hypsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/hypsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/hypsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/hypsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/pipe_simple.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/pipe_simple.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/pipe_simple.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/pipe_simple.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/rb_hover.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/rb_hover.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/rb_hover.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/rb_hover.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/scsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/scsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/scsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/scsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/tldsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/tldsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/tldsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/tldsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/tsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/tsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/tsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/tsv.tmLanguage.json diff --git a/vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/wspcsv.tmLanguage.json b/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/wspcsv.tmLanguage.json similarity index 100% rename from vscodium/extensions/mechatroner.rainbow-csv-2.2.0/syntaxes/wspcsv.tmLanguage.json rename to vscodium/extensions/mechatroner.rainbow-csv-2.3.0/syntaxes/wspcsv.tmLanguage.json diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/out/extension.js b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/out/extension.js deleted file mode 100644 index 4046c33b..00000000 --- a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/out/extension.js +++ /dev/null @@ -1,2 +0,0 @@ -(()=>{var e={8309:(e,t,r)=>{"use strict";const s=r(2081),n=r(4605),o=r(3743);function i(e,t,r){const i=n(e,t,r),a=s.spawn(i.command,i.args,i.options);return o.hookChildProcess(a,i),a}e.exports=i,e.exports.spawn=i,e.exports.sync=function(e,t,r){const i=n(e,t,r),a=s.spawnSync(i.command,i.args,i.options);return a.error=a.error||o.verifyENOENTSync(a.status,i),a},e.exports._parse=n,e.exports._enoent=o},3743:e=>{"use strict";const t="win32"===process.platform;function r(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function s(e,s){return t&&1===e&&!s.file?r(s.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;const n=e.emit;e.emit=function(t,o){if("exit"===t){const t=s(o,r);if(t)return n.call(e,"error",t)}return n.apply(e,arguments)}},verifyENOENT:s,verifyENOENTSync:function(e,s){return t&&1===e&&!s.file?r(s.original,"spawnSync"):null},notFoundError:r}},4605:(e,t,r)=>{"use strict";const s=r(1017),n=r(2202),o=r(5081),i=r(7550),a="win32"===process.platform,c=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);const d={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?d:function(e){if(!a)return e;const t=function(e){e.file=n(e);const t=e.file&&i(e.file);return t?(e.args.unshift(e.file),e.command=t,n(e)):e.file}(e),r=!c.test(t);if(e.options.forceShell||r){const r=l.test(t);e.command=s.normalize(e.command),e.command=o.command(e.command),e.args=e.args.map((e=>o.argument(e,r)));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(d)}},5081:e=>{"use strict";const t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=`"${e=(e=(e=`${e}`).replace(/(\\*)"/g,'$1$1\\"')).replace(/(\\*)$/,"$1$1")}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},7550:(e,t,r)=>{"use strict";const s=r(7147),n=r(2063);e.exports=function(e){const t=Buffer.alloc(150);let r;try{r=s.openSync(e,"r"),s.readSync(r,t,0,150,0),s.closeSync(r)}catch(e){}return n(t.toString())}},2202:(e,t,r)=>{"use strict";const s=r(1017),n=r(2806),o=r(3024);function i(e,t){const r=e.options.env||process.env,i=process.cwd(),a=null!=e.options.cwd,c=a&&void 0!==process.chdir&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch(e){}let l;try{l=n.sync(e.command,{path:r[o({env:r})],pathExt:t?s.delimiter:void 0})}catch(e){}finally{c&&process.chdir(i)}return l&&(l=s.resolve(a?e.options.cwd:"",l)),l}e.exports=function(e){return i(e)||i(e,!0)}},8468:(e,t,r)=>{"use strict";const s=r(1017),n=r(2081),o=r(8309),i=r(8150),a=r(6147),c=r(7678),l=r(4353),d=r(3111),{spawnedKill:u,spawnedCancel:h,setupTimeout:f,validateTimeout:p,setExitHandler:m}=r(3820),{handleInput:g,getSpawnedResult:_,makeAllStream:y,validateInputSync:v}=r(4994),{mergePromise:w,getSpawnedPromise:b}=r(1708),{joinCommand:S,parseCommand:x,getEscapedCommand:E}=r(4077),k=(e,t,r={})=>{const n=o._parse(e,t,r);return e=n.command,t=n.args,(r={maxBuffer:1e8,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:(r=n.options).cwd||process.cwd(),execPath:process.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r}).env=(({env:e,extendEnv:t,preferLocal:r,localDir:s,execPath:n})=>{const o=t?{...process.env,...e}:e;return r?a.env({env:o,cwd:s,execPath:n}):o})(r),r.stdio=d(r),"win32"===process.platform&&"cmd"===s.basename(e,".exe")&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},C=(e,t,r)=>"string"==typeof t||Buffer.isBuffer(t)?e.stripFinalNewline?i(t):t:void 0===r?void 0:"",O=(e,t,r)=>{const s=k(e,t,r),o=S(e,t),i=E(e,t);let a;p(s.options);try{a=n.spawn(s.file,s.args,s.options)}catch(e){const t=new n.ChildProcess,r=Promise.reject(l({error:e,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:s,timedOut:!1,isCanceled:!1,killed:!1}));return w(t,r)}const d=b(a),v=f(a,s.options,d),x=m(a,s.options,v),O={isCanceled:!1};a.kill=u.bind(null,a.kill.bind(a)),a.cancel=h.bind(null,a,O);const P=c((async()=>{const[{error:e,exitCode:t,signal:r,timedOut:n},c,d,u]=await _(a,s.options,x),h=C(s.options,c),f=C(s.options,d),p=C(s.options,u);if(e||0!==t||null!==r){const c=l({error:e,exitCode:t,signal:r,stdout:h,stderr:f,all:p,command:o,escapedCommand:i,parsed:s,timedOut:n,isCanceled:O.isCanceled,killed:a.killed});if(!s.options.reject)return c;throw c}return{command:o,escapedCommand:i,exitCode:0,stdout:h,stderr:f,all:p,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}));return g(a,s.options.input),a.all=y(a,s.options),w(a,P)};e.exports=O,e.exports.sync=(e,t,r)=>{const s=k(e,t,r),o=S(e,t),i=E(e,t);let a;v(s.options);try{a=n.spawnSync(s.file,s.args,s.options)}catch(e){throw l({error:e,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:s,timedOut:!1,isCanceled:!1,killed:!1})}const c=C(s.options,a.stdout,a.error),d=C(s.options,a.stderr,a.error);if(a.error||0!==a.status||null!==a.signal){const e=l({stdout:c,stderr:d,error:a.error,signal:a.signal,exitCode:a.status,command:o,escapedCommand:i,parsed:s,timedOut:a.error&&"ETIMEDOUT"===a.error.code,isCanceled:!1,killed:null!==a.signal});if(!s.options.reject)return e;throw e}return{command:o,escapedCommand:i,exitCode:0,stdout:c,stderr:d,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},e.exports.command=(e,t)=>{const[r,...s]=x(e);return O(r,s,t)},e.exports.commandSync=(e,t)=>{const[r,...s]=x(e);return O.sync(r,s,t)},e.exports.node=(e,t,r={})=>{t&&!Array.isArray(t)&&"object"==typeof t&&(r=t,t=[]);const s=d.node(r),n=process.execArgv.filter((e=>!e.startsWith("--inspect"))),{nodePath:o=process.execPath,nodeOptions:i=n}=r;return O(o,[...i,e,...Array.isArray(t)?t:[]],{...r,stdin:void 0,stdout:void 0,stderr:void 0,stdio:s,shell:!1})}},4077:e=>{"use strict";const t=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],r=/^[\w.-]+$/,s=/"/g,n=/ +/g;e.exports={joinCommand:(e,r)=>t(e,r).join(" "),getEscapedCommand:(e,n)=>t(e,n).map((e=>(e=>"string"!=typeof e||r.test(e)?e:`"${e.replace(s,'\\"')}"`)(e))).join(" "),parseCommand:e=>{const t=[];for(const r of e.trim().split(n)){const e=t[t.length-1];e&&e.endsWith("\\")?t[t.length-1]=`${e.slice(0,-1)} ${r}`:t.push(r)}return t}}},4353:(e,t,r)=>{"use strict";const{signalsByName:s}=r(7787);e.exports=({stdout:e,stderr:t,all:r,error:n,signal:o,exitCode:i,command:a,escapedCommand:c,timedOut:l,isCanceled:d,killed:u,parsed:{options:{timeout:h}}})=>{i=null===i?void 0:i;const f=void 0===(o=null===o?void 0:o)?void 0:s[o].description,p=`Command ${(({timedOut:e,timeout:t,errorCode:r,signal:s,signalDescription:n,exitCode:o,isCanceled:i})=>e?`timed out after ${t} milliseconds`:i?"was canceled":void 0!==r?`failed with ${r}`:void 0!==s?`was killed with ${s} (${n})`:void 0!==o?`failed with exit code ${o}`:"failed")({timedOut:l,timeout:h,errorCode:n&&n.code,signal:o,signalDescription:f,exitCode:i,isCanceled:d})}: ${a}`,m="[object Error]"===Object.prototype.toString.call(n),g=m?`${p}\n${n.message}`:p,_=[g,t,e].filter(Boolean).join("\n");return m?(n.originalMessage=n.message,n.message=_):n=new Error(_),n.shortMessage=g,n.command=a,n.escapedCommand=c,n.exitCode=i,n.signal=o,n.signalDescription=f,n.stdout=e,n.stderr=t,void 0!==r&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=Boolean(l),n.isCanceled=d,n.killed=u&&!l,n}},3820:(e,t,r)=>{"use strict";const s=r(2037),n=r(7908),o=(e,{forceKillAfterTimeout:t},r)=>i(e)&&!1!==t&&r,i=e=>e===s.constants.signals.SIGTERM||"string"==typeof e&&"SIGTERM"===e.toUpperCase(),a=({forceKillAfterTimeout:e=!0})=>{if(!0===e)return 5e3;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e};e.exports={spawnedKill:(e,t="SIGTERM",r={})=>{const s=e(t);return((e,t,r,s)=>{if(!o(t,r,s))return;const n=a(r),i=setTimeout((()=>{e("SIGKILL")}),n);i.unref&&i.unref()})(e,t,r,s),s},spawnedCancel:(e,t)=>{e.kill()&&(t.isCanceled=!0)},setupTimeout:(e,{timeout:t,killSignal:r="SIGTERM"},s)=>{if(0===t||void 0===t)return s;let n;const o=new Promise(((s,o)=>{n=setTimeout((()=>{((e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))})(e,r,o)}),t)})),i=s.finally((()=>{clearTimeout(n)}));return Promise.race([o,i])},validateTimeout:({timeout:e})=>{if(void 0!==e&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},setExitHandler:async(e,{cleanup:t,detached:r},s)=>{if(!t||r)return s;const o=n((()=>{e.kill()}));return s.finally((()=>{o()}))}}},1708:e=>{"use strict";const t=(async()=>{})().constructor.prototype,r=["then","catch","finally"].map((e=>[e,Reflect.getOwnPropertyDescriptor(t,e)]));e.exports={mergePromise:(e,t)=>{for(const[s,n]of r){const r="function"==typeof t?(...e)=>Reflect.apply(n.value,t(),e):n.value.bind(t);Reflect.defineProperty(e,s,{...n,value:r})}return e},getSpawnedPromise:e=>new Promise(((t,r)=>{e.on("exit",((e,r)=>{t({exitCode:e,signal:r})})),e.on("error",(e=>{r(e)})),e.stdin&&e.stdin.on("error",(e=>{r(e)}))}))}},3111:e=>{"use strict";const t=["stdin","stdout","stderr"],r=e=>{if(!e)return;const{stdio:r}=e;if(void 0===r)return t.map((t=>e[t]));if((e=>t.some((t=>void 0!==e[t])))(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${t.map((e=>`\`${e}\``)).join(", ")}`);if("string"==typeof r)return r;if(!Array.isArray(r))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof r}\``);const s=Math.max(r.length,t.length);return Array.from({length:s},((e,t)=>r[t]))};e.exports=r,e.exports.node=e=>{const t=r(e);return"ipc"===t?"ipc":void 0===t||"string"==typeof t?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}},4994:(e,t,r)=>{"use strict";const s=r(4970),n=r(31),o=r(4034),i=async(e,t)=>{if(e){e.destroy();try{return await t}catch(e){return e.bufferedData}}},a=(e,{encoding:t,buffer:r,maxBuffer:s})=>{if(e&&r)return t?n(e,{encoding:t,maxBuffer:s}):n.buffer(e,{maxBuffer:s})};e.exports={handleInput:(e,t)=>{void 0!==t&&void 0!==e.stdin&&(s(t)?t.pipe(e.stdin):e.stdin.end(t))},makeAllStream:(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const r=o();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},getSpawnedResult:async({stdout:e,stderr:t,all:r},{encoding:s,buffer:n,maxBuffer:o},c)=>{const l=a(e,{encoding:s,buffer:n,maxBuffer:o}),d=a(t,{encoding:s,buffer:n,maxBuffer:o}),u=a(r,{encoding:s,buffer:n,maxBuffer:2*o});try{return await Promise.all([c,l,d,u])}catch(s){return Promise.all([{error:s,signal:s.signal,timedOut:s.timedOut},i(e,l),i(t,d),i(r,u)])}},validateInputSync:({input:e})=>{if(s(e))throw new TypeError("The `input` option cannot be a stream in sync mode")}}},5105:(e,t,r)=>{"use strict";const{PassThrough:s}=r(2781);e.exports=e=>{e={...e};const{array:t}=e;let{encoding:r}=e;const n="buffer"===r;let o=!1;t?o=!(r||n):r=r||"utf8",n&&(r=null);const i=new s({objectMode:o});r&&i.setEncoding(r);let a=0;const c=[];return i.on("data",(e=>{c.push(e),o?a=c.length:a+=e.length})),i.getBufferedValue=()=>t?c:n?Buffer.concat(c,a):c.join(""),i.getBufferedLength=()=>a,i}},31:(e,t,r)=>{"use strict";const{constants:s}=r(4300),n=r(2781),{promisify:o}=r(3837),i=r(5105),a=o(n.pipeline);class c extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function l(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,n=i(t);return await new Promise(((t,o)=>{const i=e=>{e&&n.getBufferedLength()<=s.MAX_LENGTH&&(e.bufferedData=n.getBufferedValue()),o(e)};(async()=>{try{await a(e,n),t()}catch(e){i(e)}})(),n.on("data",(()=>{n.getBufferedLength()>r&&i(new c)}))})),n.getBufferedValue()}e.exports=l,e.exports.buffer=(e,t)=>l(e,{...t,encoding:"buffer"}),e.exports.array=(e,t)=>l(e,{...t,array:!0}),e.exports.MaxBufferError=c},7:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SIGNALS=void 0,t.SIGNALS=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]},7787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signalsByNumber=t.signalsByName=void 0;var s=r(2037),n=r(8699),o=r(7603);const i=(0,n.getSignals)().reduce((function(e,{name:t,number:r,description:s,supported:n,action:o,forced:i,standard:a}){return{...e,[t]:{name:t,number:r,description:s,supported:n,action:o,forced:i,standard:a}}}),{});t.signalsByName=i;const a=function(e,t){const r=t.find((({name:t})=>s.constants.signals[t]===e));return void 0!==r?r:t.find((t=>t.number===e))},c=function(){const e=(0,n.getSignals)(),t=o.SIGRTMAX+1,r=Array.from({length:t},((t,r)=>function(e,t){const r=a(e,t);if(void 0===r)return{};const{name:s,description:n,supported:o,action:i,forced:c,standard:l}=r;return{[e]:{name:s,number:e,description:n,supported:o,action:i,forced:c,standard:l}}}(r,e)));return Object.assign({},...r)}();t.signalsByNumber=c},7603:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SIGRTMAX=t.getRealtimeSignals=void 0,t.getRealtimeSignals=function(){const e=n-s+1;return Array.from({length:e},r)};const r=function(e,t){return{name:`SIGRT${t+1}`,number:s+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},s=34,n=64;t.SIGRTMAX=n},8699:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSignals=void 0;var s=r(2037),n=r(7),o=r(7603);t.getSignals=function(){const e=(0,o.getRealtimeSignals)();return[...n.SIGNALS,...e].map(i)};const i=function({name:e,number:t,description:r,action:n,forced:o=!1,standard:i}){const{signals:{[e]:a}}=s.constants,c=void 0!==a;return{name:e,number:c?a:t,description:r,supported:c,action:n,forced:o,standard:i}}},4970:e=>{"use strict";const t=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;t.writable=e=>t(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,t.readable=e=>t(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,t.duplex=e=>t.writable(e)&&t.readable(e),t.transform=e=>t.duplex(e)&&"function"==typeof e._transform&&"object"==typeof e._transformState,e.exports=t},1959:(e,t,r)=>{var s;function n(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise((function(r,s){n(e,t||{},(function(e,t){e?s(e):r(t)}))}))}s(e,t||{},(function(e,s){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,s=!1),r(e,s)}))}r(7147),s="win32"===process.platform||global.TESTING_WINDOWS?r(1429):r(4601),e.exports=n,n.sync=function(e,t){try{return s.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},4601:(e,t,r)=>{e.exports=n,n.sync=function(e,t){return o(s.statSync(e),t)};var s=r(7147);function n(e,t,r){s.stat(e,(function(e,s){r(e,!e&&o(s,t))}))}function o(e,t){return e.isFile()&&function(e,t){var r=e.mode,s=e.uid,n=e.gid,o=void 0!==t.uid?t.uid:process.getuid&&process.getuid(),i=void 0!==t.gid?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8);return r&parseInt("001",8)||r&c&&n===i||r&a&&s===o||r&(a|c)&&0===o}(e,t)}},1429:(e,t,r)=>{e.exports=o,o.sync=function(e,t){return n(s.statSync(e),e,t)};var s=r(7147);function n(e,t,r){return!(!e.isSymbolicLink()&&!e.isFile())&&function(e,t){var r=void 0!==t.pathExt?t.pathExt:process.env.PATHEXT;if(!r)return!0;if(-1!==(r=r.split(";")).indexOf(""))return!0;for(var s=0;s{"use strict";const{PassThrough:s}=r(2781);e.exports=function(){var e=[],t=new s({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(r),t;function r(s){return Array.isArray(s)?(s.forEach(r),this):(e.push(s),s.once("end",o.bind(null,s)),s.once("error",t.emit.bind(t,"error")),s.pipe(t,{end:!1}),this)}function n(){return 0==e.length}function o(r){!(e=e.filter((function(e){return e!==r}))).length&&t.readable&&t.end()}}},4341:e=>{"use strict";const t=(e,t)=>{for(const r of Reflect.ownKeys(t))Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));return e};e.exports=t,e.exports.default=t},6147:(e,t,r)=>{"use strict";const s=r(1017),n=r(3024),o=e=>{let t;e={cwd:process.cwd(),path:process.env[n()],execPath:process.execPath,...e};let r=s.resolve(e.cwd);const o=[];for(;t!==r;)o.push(s.join(r,"node_modules/.bin")),t=r,r=s.resolve(r,"..");const i=s.resolve(e.cwd,e.execPath,"..");return o.push(i),o.concat(e.path).join(s.delimiter)};e.exports=o,e.exports.default=o,e.exports.env=t=>{const r={...(t={env:process.env,...t}).env},s=n({env:r});return t.path=r[s],r[s]=e.exports(t),r}},7678:(e,t,r)=>{"use strict";const s=r(4341),n=new WeakMap,o=(e,t={})=>{if("function"!=typeof e)throw new TypeError("Expected a function");let r,o=0;const i=e.displayName||e.name||"",a=function(...s){if(n.set(a,++o),1===o)r=e.apply(this,s),e=null;else if(!0===t.throw)throw new Error(`Function \`${i}\` can only be called once`);return r};return s(a,e),n.set(a,o),a};e.exports=o,e.exports.default=o,e.exports.callCount=e=>{if(!n.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return n.get(e)}},3024:e=>{"use strict";const t=(e={})=>{const t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find((e=>"PATH"===e.toUpperCase()))||"Path"};e.exports=t,e.exports.default=t},2063:(e,t,r)=>{"use strict";const s=r(9395);e.exports=(e="")=>{const t=e.match(s);if(!t)return null;const[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return"env"===o?n:n?`${o} ${n}`:o}},9395:e=>{"use strict";e.exports=/^#!(.*)/},7908:(e,t,r)=>{var s,n=r(9491),o=r(5397),i=/^win/i.test(process.platform),a=r(2361);function c(){u&&(u=!1,o.forEach((function(e){try{process.removeListener(e,d[e])}catch(e){}})),process.emit=m,process.reallyExit=f,s.count-=1)}function l(e,t,r){s.emitted[e]||(s.emitted[e]=!0,s.emit(e,t,r))}"function"!=typeof a&&(a=a.EventEmitter),process.__signal_exit_emitter__?s=process.__signal_exit_emitter__:((s=process.__signal_exit_emitter__=new a).count=0,s.emitted={}),s.infinite||(s.setMaxListeners(1/0),s.infinite=!0),e.exports=function(e,t){n.equal(typeof e,"function","a callback must be provided for exit handler"),!1===u&&h();var r="exit";return t&&t.alwaysLast&&(r="afterexit"),s.on(r,e),function(){s.removeListener(r,e),0===s.listeners("exit").length&&0===s.listeners("afterexit").length&&c()}},e.exports.unload=c;var d={};o.forEach((function(e){d[e]=function(){process.listeners(e).length===s.count&&(c(),l("exit",null,e),l("afterexit",null,e),i&&"SIGHUP"===e&&(e="SIGINT"),process.kill(process.pid,e))}})),e.exports.signals=function(){return o},e.exports.load=h;var u=!1;function h(){u||(u=!0,s.count+=1,o=o.filter((function(e){try{return process.on(e,d[e]),!0}catch(e){return!1}})),process.emit=g,process.reallyExit=p)}var f=process.reallyExit;function p(e){process.exitCode=e||0,l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),f.call(process,process.exitCode)}var m=process.emit;function g(e,t){if("exit"===e){void 0!==t&&(process.exitCode=t);var r=m.apply(this,arguments);return l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),r}return m.apply(this,arguments)}},5397:e=>{e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],"win32"!==process.platform&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")},861:(e,t,r)=>{"use strict";const{Transform:s}=r(2781),{StringDecoder:n}=r(1576),o=Symbol("last"),i=Symbol("decoder");function a(e,t,r){let s;if(this.overflow){if(s=this[i].write(e).split(this.matcher),1===s.length)return r();s.shift(),this.overflow=!1}else this[o]+=this[i].write(e),s=this[o].split(this.matcher);this[o]=s.pop();for(let e=0;ethis.maxLength,!this.overflow||this.skipOverflow?r():r(new Error("maximum buffer reached"))}function c(e){if(this[o]+=this[i].end(),this[o])try{l(this,this.mapper(this[o]))}catch(t){return e(t)}e()}function l(e,t){void 0!==t&&e.push(t)}function d(e){return e}e.exports=function(e,t,r){switch(e=e||/\r?\n/,t=t||d,r=r||{},arguments.length){case 1:"function"==typeof e?(t=e,e=/\r?\n/):"object"!=typeof e||e instanceof RegExp||(r=e,e=/\r?\n/);break;case 2:"function"==typeof e?(r=t,t=e,e=/\r?\n/):"object"==typeof t&&(r=t,t=d)}(r=Object.assign({},r)).autoDestroy=!0,r.transform=a,r.flush=c,r.readableObjectMode=!0;const l=new s(r);return l[o]="",l[i]=new n("utf8"),l.matcher=e,l.mapper=t,l.maxLength=r.maxLength,l.skipOverflow=r.skipOverflow||!1,l.overflow=!1,l._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},l}},8150:e=>{"use strict";e.exports=e=>{const t="string"==typeof e?"\n":"\n".charCodeAt(),r="string"==typeof e?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e[e.length-1]===r&&(e=e.slice(0,e.length-1)),e}},6758:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserError=void 0;class r extends Error{}t.UserError=r},112:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.deactivate=t.activate=void 0;const i=o(r(9496)),a=r(6409),c=r(457),l=r(2037);let d;t.activate=function(e){var t,r;d=new a.SessionManager(new c.BrowserSpawner(null!==(r=null===(t=e.storageUri)||void 0===t?void 0:t.fsPath)&&void 0!==r?r:(0,l.tmpdir)(),e)),e.subscriptions.push(i.commands.registerCommand("js-debug-companion.launchAndAttach",(e=>{null==d||d.create(e).catch((e=>i.window.showErrorMessage(e.message)))})),i.commands.registerCommand("js-debug-companion.kill",(({launchId:e})=>{null==d||d.destroy(e)})))},t.deactivate=function(){null==d||d.dispose(),d=void 0}},5896:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.exists=void 0;const n=r(7147);t.exists=function(e){return s(this,void 0,void 0,(function*(){try{return yield n.promises.access(e),!0}catch(e){return!1}}))}},8224:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getWSEndpoint=t.retryGetWSEndpoint=void 0;const a=o(r(3685)),c=r(7310);function l(e,t){return i(this,void 0,void 0,(function*(){const r=yield d((0,c.resolve)(e,"/json/version"),t);if(null==r?void 0:r.webSocketDebuggerUrl)return u(e,r.webSocketDebuggerUrl);const s=yield d((0,c.resolve)(e,"/json/list"),t);if(null==s?void 0:s.length)return u(e,s[0].webSocketDebuggerUrl);throw new Error("Could not find any debuggable target")}))}function d(e,t){return i(this,void 0,void 0,(function*(){return JSON.parse(yield function(e,t){const r=[];return new Promise(((s,n)=>{const o=a.request(e,{headers:{host:"localhost"}},(e=>{r.push(t.onCancellationRequested((()=>e.destroy())));let o="";e.setEncoding("utf8"),e.on("data",(e=>o+=e)),e.on("end",(()=>s(o))),e.on("error",n)}));r.push(t.onCancellationRequested((()=>{o.destroy(),n(new Error(`Cancelled GET ${e}`))}))),o.on("error",n),o.end()})).finally((()=>r.forEach((e=>e.dispose()))))}(e,t))}))}function u(e,t){const r=new c.URL(e),s=new c.URL(t);return s.host=r.host,s.toString()}t.retryGetWSEndpoint=function e(t,r){return i(this,void 0,void 0,(function*(){try{return yield l(t,r)}catch(s){if(r.isCancellationRequested)throw new Error(`Could not connect to debug target at ${t}: ${s}`);return yield new Promise((e=>setTimeout(e,200))),e(t,r)}}))},t.getWSEndpoint=l},3928:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;const n=r(7310),o=r(9496),i=s(r(8777));class a{constructor(){this.qOrFn=[]}push(e){"function"==typeof this.qOrFn?this.qOrFn(e):this.qOrFn.push(e)}connect(e){if("function"==typeof this.qOrFn)throw new Error("Already connected");const t=this.qOrFn;this.qOrFn=e;for(const r of t)e(r)}}t.Session=class{constructor(){this.errorEmitter=new o.EventEmitter,this.onError=this.errorEmitter.event,this.closeEmitter=new o.EventEmitter,this.onClose=this.closeEmitter.event,this.disposed=!1,this.fromSocketQueue=new a,this.fromBrowserQueue=new a,this.onClose((()=>this.dispose())),this.onError((()=>this.dispose()))}attachSocket(e,t,r){const s=new n.URL(`ws://${e}:${t}${r}`);this.attachSocketLoop(s,Date.now()+5e3)}attachChild(e){this.disposed?e.dispose():(this.browserProcess=e,e.onClose((()=>this.closeEmitter.fire())),e.onError((e=>this.errorEmitter.fire(e))),e.onMessage((e=>this.fromBrowserQueue.push(e))),this.fromSocketQueue.connect((t=>e.send(t))))}dispose(){var e,t;this.disposed||(null===(e=this.browserProcess)||void 0===e||e.dispose(),null===(t=this.socket)||void 0===t||t.close(),this.disposed=!0)}attachSocketLoop(e,t){if(this.disposed)return;const r=new i.default(e,{perMessageDeflate:!0});r.on("open",(()=>{this.disposed?r.close():(this.socket=r,this.socket.on("close",(()=>this.closeEmitter.fire())),this.socket.on("message",(e=>this.fromSocketQueue.push(e))),this.fromBrowserQueue.connect((e=>r.send(e))))})),r.on("error",(s=>{this.socket===r||Date.now()>t?this.errorEmitter.fire(s):setTimeout((()=>this.attachSocketLoop(e,t)),100)}))}}},6409:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0;const a=o(r(9496)),c=r(3928),l=r(8389);t.SessionManager=class{constructor(e){this.spawn=e,this.sessions=new Map}create(e){return i(this,void 0,void 0,(function*(){const t=new c.Session;this.sessions.set(e.launchId,t),t.onClose((()=>this.sessions.delete(e.launchId))),t.onError((t=>{a.window.showErrorMessage(`Error running browserasd: ${t.message||t.stack}`),this.sessions.delete(e.launchId)})),yield Promise.all([this.addChildSocket(t,e),e.attach?this.addChildAttach(t,e.attach):this.addChildBrowser(t,e)])}))}destroy(e){const t=this.sessions.get(e);null==t||t.dispose(),this.sessions.delete(e)}dispose(){for(const e of this.sessions.values())e.dispose();this.sessions.clear()}addChildSocket(e,t){return i(this,void 0,void 0,(function*(){const[r,s]=t.proxyUri.split(":");e.attachSocket(r,Number(s),t.path)}))}addChildBrowser(e,t){return i(this,void 0,void 0,(function*(){const r=yield this.spawn.launch(t);e.attachChild(r)}))}addChildAttach(e,t){return i(this,void 0,void 0,(function*(){const r=yield l.AttachTarget.create(t.host,t.port);e.attachChild(r)}))}}},457:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserSpawner=void 0;const c=r(2081),l=a(r(8468)),d=r(7147),u=r(1017),h=r(2331),f=o(r(8472)),p=r(6758),m=r(5896),g=r(8389),_=f.loadMessageBundle(),y="--remote-debugging-port=",v="--remote-debugging-port=",w="availableBrowsers_";t.BrowserSpawner=class{constructor(e,t){this.storagePath=e,this.context=t,this.finders={edge:new h.EdgeBrowserFinder(process.env,d.promises,l.default),chrome:new h.ChromeBrowserFinder(process.env,d.promises,l.default)}}findBrowserPath(e,t){var r;return i(this,void 0,void 0,(function*(){if("*"!==t&&!(0,h.isQuality)(t))return t;if(!this.finders.hasOwnProperty(e))throw new p.UserError(`Browser type "${e}" is not supported.`);const s=this.context.globalState.get(w+e)||(yield this.finders[e].findAll()),n="*"===t?null!==(r=s.find((e=>"stable"===e.quality)))&&void 0!==r?r:s[0]:s.find((e=>e.quality===t));if(!n)throw yield this.context.globalState.update(w+e,void 0),"stable"!==t||s.length?new p.UserError(_("browserVersionNotFound",'Unable to find {0} version {1}. Available auto-discovered versions are: {2}. You can set the "runtimeExecutable" in your launch.json to one of these, or provide an absolute path to the browser executable.',e,t,JSON.stringify([...new Set(s)]))):new p.UserError(_("noBrowserInstallFound",'Unable to find a {0} installation on your system. Try installing it, or providing an absolute path to the browser in the "runtimeExecutable" in your launch.json.',e));return yield this.context.globalState.update(w+e,s),n.path}))}findBrowserByExe(e,t){var r;return i(this,void 0,void 0,(function*(){if("*"===t){const t=(yield e.findWhere((e=>"stable"===e.quality)))||(yield e.findAll())[0];return null==t?void 0:t.path}return(0,h.isQuality)(t)?null===(r=yield e.findWhere((e=>e.quality===t)))||void 0===r?void 0:r.path:t}))}getUserDataDir(e){var t;return i(this,void 0,void 0,(function*(){const r=e.params.userDataDir;if(!1===r)return;const s=(0,u.join)(this.storagePath,(null===(t=e.browserArgs)||void 0===t?void 0:t.includes("--headless"))?".headless-profile":".profile");return!0===r?s:(yield(0,m.exists)(r))?r:s}))}launch(e){var t;return i(this,void 0,void 0,(function*(){const r=yield this.findBrowserPath(e.type,e.params.runtimeExecutable),s=e.browserArgs.slice(),n=yield this.getUserDataDir(e);void 0!==n&&s.unshift(`--user-data-dir=${n}`);let o=e.params.cwd||e.params.webRoot;o&&(yield(0,m.exists)(o))||(o=process.cwd());const i=null===(t=s.find((e=>e.startsWith(y))))||void 0===t?void 0:t.slice(y.length);if(!i)return new g.PipedTarget((0,c.spawn)(r,s,{detached:"win32"!==process.platform,env:Object.assign(Object.assign(Object.assign({},process.env),{GDK_PIXBUF_MODULEDIR:void 0,GDK_PIXBUF_MODULE_FILE:void 0,ELECTRON_RUN_AS_NODE:void 0}),e.params.env),stdio:["ignore","ignore","ignore","pipe","pipe"],cwd:o}));s.includes(v)||s.unshift(v);const a=(0,c.spawn)(r,s,{detached:"win32"!==process.platform,env:Object.assign({ELECTRON_RUN_AS_NODE:void 0},e.params.env),stdio:"ignore",cwd:o});return yield g.ServerTarget.create(a,Number(i))}))}}},8389:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ServerTarget=t.AttachTarget=t.PipedTarget=void 0;const o=n(r(861)),i=r(9496),a=n(r(8777)),c=r(8224),l=e=>s(void 0,void 0,void 0,(function*(){e.exitCode||(yield Promise.race([new Promise((t=>e.on("exit",t))),new Promise((e=>setTimeout(e,1e3)))]))}));t.PipedTarget=class{constructor(e){if(this.process=e,this.errorEmitter=new i.EventEmitter,this.closeEmitter=new i.EventEmitter,this.messageEmitter=new i.EventEmitter,this.onError=this.errorEmitter.event,this.onClose=this.closeEmitter.event,this.onMessage=this.messageEmitter.event,this.process.stdio.length<5)throw new Error("Insufficient fd number on child process");e.on("error",(e=>this.errorEmitter.fire(e))),e.on("exit",(()=>this.closeEmitter.fire())),e.stdio[4].pipe((0,o.default)("\0")).on("data",(e=>this.messageEmitter.fire(e))).resume()}send(e){const t=this.process.stdio[3];if(e instanceof Uint8Array)t.write(e);else if(e instanceof ArrayBuffer)t.write(new Uint8Array(e));else for(const r of e)t.write(r);t.write("\0")}dispose(){return s(this,void 0,void 0,(function*(){yield l(this.process),this.process.kill()}))}};class d{constructor(e){this.ws=e,this.errorEmitter=new i.EventEmitter,this.closeEmitter=new i.EventEmitter,this.messageEmitter=new i.EventEmitter,this.onError=this.errorEmitter.event,this.onClose=this.closeEmitter.event,this.onMessage=this.messageEmitter.event,e.on("error",(e=>this.errorEmitter.fire(e))),e.on("close",(()=>this.closeEmitter.fire())),e.on("message",(e=>this.messageEmitter.fire(e)))}static create(e,t){return s(this,void 0,void 0,(function*(){const r=new i.CancellationTokenSource;setTimeout((()=>r.cancel()),1e4);const s=yield(0,c.retryGetWSEndpoint)(`http://${e}:${t}`,r.token),n=new a.default(s,[],{headers:{host:"localhost"},perMessageDeflate:!1,maxPayload:268435456,followRedirects:!0});return yield new Promise(((e,t)=>{n.addEventListener("open",(()=>e(new d(n)))),n.addEventListener("error",(e=>t(e.error)))}))}))}send(e){this.ws.send(e)}dispose(){return s(this,void 0,void 0,(function*(){yield new Promise((e=>{this.ws.on("close",e),this.ws.close()}))}))}}t.AttachTarget=d;class u{constructor(e,t){this.process=e,this.attach=t,this.errorEmitter=new i.EventEmitter,this.closeEmitter=new i.EventEmitter,this.messageEmitter=new i.EventEmitter,this.onError=this.errorEmitter.event,this.onClose=this.closeEmitter.event,this.onMessage=this.messageEmitter.event,e.on("error",(e=>this.errorEmitter.fire(e))),e.on("close",(()=>this.closeEmitter.fire())),t.onError((e=>this.errorEmitter.fire(e))),t.onClose((()=>this.closeEmitter.fire())),t.onMessage((e=>this.messageEmitter.fire(e)))}static create(e,t){return s(this,void 0,void 0,(function*(){const r=new i.CancellationTokenSource;setTimeout((()=>r.cancel()),1e4);try{const r=yield d.create("localhost",t);return new u(e,r)}catch(t){throw e.kill(),t}}))}send(e){this.attach.send(e)}dispose(){return s(this,void 0,void 0,(function*(){this.attach.dispose(),yield l(this.process),this.process.kill()}))}}t.ServerTarget=u},9135:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DarwinChromeBrowserFinder=void 0;const s=r(690),n=r(1668);class o extends n.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",quality:"stable"},{path:"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",quality:"canary"},{path:"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta",quality:"beta"},{path:"/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev",quality:"dev"}]}async findAll(){const e=await this.findLaunchRegisteredApps("google chrome\\( canary\\)\\?.app",["/Applications/Google Chrome.app","/Applications/Google Chrome Canary.app"],["/Contents/MacOS/Google Chrome Canary","/Contents/MacOS/Google Chrome"]);return(0,s.sort)(e,this.createPriorities([{name:"Chrome.app",weight:0,quality:"stable"},{name:"Chrome Canary.app",weight:1,quality:"canary"}]))}getPreferredPath(){return this.env.CHROME_PATH}}t.DarwinChromeBrowserFinder=o},9143:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DarwinEdgeBrowserFinder=void 0;const s=r(690),n=r(1668);class o extends n.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",quality:"stable"},{path:"/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary",quality:"canary"},{path:"/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta",quality:"beta"},{path:"/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev",quality:"dev"}]}async findAll(){const e=await this.findLaunchRegisteredApps("Microsoft Edge[A-Za-z ]*.app",["/Applications/Microsoft Edge.app"],["/Contents/MacOS/Microsoft Edge Canary","/Contents/MacOS/Microsoft Edge Beta","/Contents/MacOS/Microsoft Edge Dev","/Contents/MacOS/Microsoft Edge"]);return(0,s.sort)(e,this.createPriorities([{name:"Microsoft Edge.app",weight:0,quality:"stable"},{name:"Microsoft Edge Canary.app",weight:1,quality:"canary"},{name:"Microsoft Edge Beta.app",weight:2,quality:"beta"},{name:"Microsoft Edge Dev.app",weight:3,quality:"dev"}]))}getPreferredPath(){return this.env.EDGE_PATH}}t.DarwinEdgeBrowserFinder=o},1668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DarwinFinderBase=void 0;const s=r(1017),n=r(690),o=/( \(0x[a-f0-9]+\))/;t.DarwinFinderBase=class{constructor(e,t,r){this.env=e,this.fs=t,this.execa=r,this.lsRegisterCommand="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump",this.wellKnownPaths=[]}async findWhere(e){for(const t of this.wellKnownPaths)if(e(t)&&await(0,n.canAccess)(this.fs,t.path))return t;return(await this.findAll()).find(e)}async findLaunchRegisteredApps(e,t,r){const{stdout:n}=await this.execa.command(`${this.lsRegisterCommand} | awk '$0 ~ /${e}${o.source}?$/ { $1=""; print $0 }'`,{shell:!0,stdio:"pipe"}),i=[...t,...n.split("\n").map((e=>e.trim().replace(o,"")))].filter((e=>!!e)),a=this.getPreferredPath();a&&i.push(a);const c=new Set;for(const e of i)for(const t of r){const r=s.posix.join(e.trim(),t);try{await this.fs.access(r),c.add(r)}catch(e){}}return c}createPriorities(e){const t=this.env.HOME&&(0,n.escapeRegexSpecialChars)(this.env.HOME),r=this.getPreferredPath(),s=e.reduce(((e,r)=>[...e,{regex:new RegExp(`^/Applications/.*${r.name}`),weight:r.weight+100,quality:r.quality},{regex:new RegExp(`^${t}/Applications/.*${r.name}`),weight:r.weight,quality:r.quality},{regex:new RegExp(`^/Volumes/.*${r.name}`),weight:r.weight-100,quality:r.quality}]),[]);return r&&s.unshift({regex:new RegExp((0,n.escapeRegexSpecialChars)(r)),weight:151,quality:"custom"}),s}}},2331:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EdgeBrowserFinder=t.ChromeBrowserFinder=t.isQuality=t.allQualities=void 0;const s=r(9135),n=r(9143),o=r(8651),i=r(6718),a=r(9498),c=r(3061);t.allQualities=new Set(Object.keys({canary:null,stable:null,beta:null,dev:null,custom:null})),t.isQuality=e=>t.allQualities.has(e),t.ChromeBrowserFinder="win32"===process.platform?a.WindowsChromeBrowserFinder:"darwin"===process.platform?s.DarwinChromeBrowserFinder:o.LinuxChromeBrowserFinder,t.EdgeBrowserFinder="win32"===process.platform?c.WindowsEdgeBrowserFinder:"darwin"===process.platform?n.DarwinEdgeBrowserFinder:i.LinuxEdgeBrowserFinder},8651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinuxChromeBrowserFinder=void 0;const s=r(1017),n=r(690),o=r(2081),i=r(2037),a=/\r?\n/;t.LinuxChromeBrowserFinder=class{constructor(e,t){this.env=e,this.fs=t,this.pathEnvironmentVar="CHROME_PATH",this.priorities=[{regex:/chrome-wrapper$/,weight:54,quality:"custom"},{regex:/google-chrome-dev$/,weight:53,quality:"dev"},{regex:/google-chrome-canary$/,weight:52,quality:"canary"},{regex:/google-chrome-unstable$/,weight:51,quality:"canary"},{regex:/google-chrome-canary$/,weight:51,quality:"canary"},{regex:/google-chrome-stable$/,weight:50,quality:"stable"},{regex:/google-chrome$/,weight:49,quality:"stable"},{regex:/chromium-browser$/,weight:48,quality:"custom"},{regex:/chromium$/,weight:47,quality:"custom"}],this.executablesOnPath=["google-chrome-unstable","google-chrome-dev","google-chrome-beta","google-chrome-canary","google-chrome-stable","google-chrome","chromium-browser","chromium"]}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){const e=new Set,t=this.env[this.pathEnvironmentVar];if(t&&await(0,n.canAccess)(this.fs,t)&&e.add(t),[s.posix.join((0,i.homedir)(),".local/share/applications/"),"/usr/share/applications/","/usr/bin"].forEach((t=>{for(const r in this.findChromeExecutables(t))e.add(r)})),await Promise.all(this.executablesOnPath.map((async t=>{try{const r=(0,o.execFileSync)("which",[t],{stdio:"pipe"}).toString().split(a)[0];await(0,n.canAccess)(this.fs,r)&&e.add(r)}catch(e){}}))),!e.size)throw new Error(`The environment variable ${t} must be set to executable of a build of the browser.`);const r=t?[{regex:new RegExp((0,n.escapeRegexSpecialChars)(t)),weight:101,quality:"custom"}].concat(this.priorities):this.priorities;return(0,n.sort)(e,r)}async findChromeExecutables(e){const t=/(^[^ ]+).*/,r=`^Exec=/.*/(${this.executablesOnPath.join("|")})-.*`,s=[];if(await(0,n.canAccess)(this.fs,e)){let i;try{i=(0,o.execSync)(`grep -ER "${r}" ${e} | awk -F '=' '{print $2}'`)}catch(t){i=(0,o.execSync)(`grep -Er "${r}" ${e} | awk -F '=' '{print $2}'`)}const c=i.toString().split(a).map((e=>e.replace(t,"$1")));await Promise.all(c.map((async e=>{await(0,n.canAccess)(this.fs,e)&&s.push(e)})))}return s}}},6718:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinuxEdgeBrowserFinder=void 0;const s=r(8651);class n extends s.LinuxChromeBrowserFinder{constructor(){super(...arguments),this.pathEnvironmentVar="EDGE_PATH",this.executablesOnPath=["microsoft-edge-dev","microsoft-edge-beta","microsoft-edge-stable","microsoft-edge"],this.priorities=[{regex:/microsoft-edge\-wrapper$/,weight:52,quality:"custom"},{regex:/microsoft-edge\-dev$/,weight:51,quality:"dev"},{regex:/microsoft-edge\-beta$/,weight:51,quality:"beta"},{regex:/microsoft-edge\-stable$/,weight:50,quality:"stable"},{regex:/microsoft-edge$/,weight:49,quality:"stable"}]}}t.LinuxEdgeBrowserFinder=n},690:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findWindowsCandidates=t.sort=t.preferredEdgePath=t.preferredChromePath=t.escapeRegexSpecialChars=t.canAccess=void 0;const s=r(1017);async function n({access:e},t){if(!t)return!1;try{return await e(t),!0}catch(e){return!1}}t.canAccess=n,t.escapeRegexSpecialChars=function(e,t){const r="/\\.?*()^${}|[]+".split("").filter((e=>!t||t.indexOf(e)<0)).join("").replace(/[\\\]]/g,"\\$&"),s=new RegExp(`[${r}]`,"g");return e.replace(s,"\\$&")},t.preferredChromePath=async function(e,t){if(await n(e,t.CHROME_PATH))return t.CHROME_PATH},t.preferredEdgePath=async function(e,t){if(await n(e,t.EDGE_PATH))return t.EDGE_PATH},t.sort=function(e,t){return[...e].filter((e=>!!e)).map((e=>{const r=t.find((t=>t.regex.test(e)));return r?{path:e,weight:r.weight,quality:r.quality}:{path:e,weight:10,quality:"dev"}})).sort(((e,t)=>t.weight-e.weight)).map((e=>({path:e.path,quality:e.quality})))},t.findWindowsCandidates=async function(e,t,r){const o=[e.LOCALAPPDATA,e.PROGRAMFILES,e["PROGRAMFILES(X86)"]].filter((e=>!!e)),i=[];for(const e of o)for(const o of r){const r=s.win32.join(e,o.name);i.push(n(t,r).then((e=>e?{path:r,quality:o.type}:void 0)))}return(await Promise.all(i)).filter((e=>!!e))}},9498:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowsChromeBrowserFinder=void 0;const s=r(1017),n=r(690);t.WindowsChromeBrowserFinder=class{constructor(e,t){this.env=e,this.fs=t}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){const e=s.win32.sep,t=[{name:`${e}Google${e}Chrome Dev${e}Application${e}chrome.exe`,type:"dev"},{name:`${e}Google${e}Chrome SxS${e}Application${e}chrome.exe`,type:"canary"},{name:`${e}Google${e}Chrome Beta${e}Application${e}chrome.exe`,type:"beta"},{name:`${e}Google${e}Chrome${e}Application${e}chrome.exe`,type:"stable"}],r=await(0,n.findWindowsCandidates)(this.env,this.fs,t),o=await(0,n.preferredChromePath)(this.fs,this.env);return o&&r.unshift({path:o,quality:"custom"}),r}}},3061:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowsEdgeBrowserFinder=void 0;const s=r(1017),n=r(690);t.WindowsEdgeBrowserFinder=class{constructor(e,t){this.env=e,this.fs=t}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){const e=[{name:`${s.sep}Microsoft${s.sep}Edge SxS${s.sep}Application${s.sep}msedge.exe`,type:"canary"},{name:`${s.sep}Microsoft${s.sep}Edge Dev${s.sep}Application${s.sep}msedge.exe`,type:"dev"},{name:`${s.sep}Microsoft${s.sep}Edge Beta${s.sep}Application${s.sep}msedge.exe`,type:"beta"},{name:`${s.sep}Microsoft${s.sep}Edge${s.sep}Application${s.sep}msedge.exe`,type:"stable"}],t=await(0,n.findWindowsCandidates)(this.env,this.fs,e),r=await(0,n.preferredEdgePath)(this.fs,this.env);return r&&t.unshift({path:r,quality:"custom"}),t}}},800:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.localize=t.format=t.setPseudo=t.isPseudo=t.isDefined=t.BundleFormat=t.MessageFormat=void 0;var s,n,o,i=r(1926);function a(e){return void 0!==e}function c(e,r){return t.isPseudo&&(e="["+e.replace(/[aouei]/g,"$&$&")+"]"),0===r.length?e:e.replace(/\{(\d+)\}/g,(function(e,t){var s=t[0],n=r[s],o=e;return"string"==typeof n?o=n:"number"!=typeof n&&"boolean"!=typeof n&&null!=n||(o=String(n)),o}))}(o=t.MessageFormat||(t.MessageFormat={})).file="file",o.bundle="bundle",o.both="both",(n=t.BundleFormat||(t.BundleFormat={})).standalone="standalone",n.languagePack="languagePack",function(e){e.is=function(e){var t=e;return t&&a(t.key)&&a(t.comment)}}(s||(s={})),t.isDefined=a,t.isPseudo=!1,t.setPseudo=function(e){t.isPseudo=e},t.format=c,t.localize=function(e,t){for(var r=[],s=2;s{"use strict";var r;function s(){if(void 0===r)throw new Error("No runtime abstraction layer installed");return r}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");r=e}}(s||(s={})),t.default=s},8472:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=void 0;var s=r(1017),n=r(7147),o=r(1926),i=r(800),a=r(800);Object.defineProperty(t,"MessageFormat",{enumerable:!0,get:function(){return a.MessageFormat}}),Object.defineProperty(t,"BundleFormat",{enumerable:!0,get:function(){return a.BundleFormat}});var c,l,d=Object.prototype.toString;function u(e){return"[object Number]"===d.call(e)}function h(e){return"[object String]"===d.call(e)}function f(e){return JSON.parse(n.readFileSync(e,"utf8"))}function p(e){return function(t,r){for(var s=[],n=2;n=e.length?void console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: "+new Error("").stack):i.format(e[t],s):h(r)?(console.warn("Message "+r+" didn't get externalized correctly."),i.format(r,s)):void console.error("Broken localize call found. Stacktrace is\n: "+new Error("").stack)}}function m(e,t){return c[e]=t,t}function g(e){try{return function(e){var t=f(s.join(e,"nls.metadata.json")),r=Object.create(null);for(var n in t){var o=t[n];r[n]=o.messages}return r}(e)}catch(e){return void console.log("Generating default bundle from meta data failed.",e)}}function _(e,t){var r;if(!0===l.languagePackSupport&&void 0!==l.cacheRoot&&void 0!==l.languagePackId&&void 0!==l.translationsConfigFile&&void 0!==l.translationsConfig)try{r=function(e,t){var r,o,i,a=s.join(l.cacheRoot,e.id+"-"+e.hash+".json"),c=!1,d=!1;try{return r=JSON.parse(n.readFileSync(a,{encoding:"utf8",flag:"r"})),o=a,i=new Date,n.utimes(o,i,i,(function(){})),r}catch(e){if("ENOENT"===e.code)d=!0;else{if(!(e instanceof SyntaxError))throw e;console.log("Syntax error parsing message bundle: "+e.message+"."),n.unlink(a,(function(e){e&&console.error("Deleting corrupted bundle "+a+" failed.")})),c=!0}}if(!(r=function(e,t){var r=l.translationsConfig[e.id];if(r){var n=f(r).contents,o=f(s.join(t,"nls.metadata.json")),i=Object.create(null);for(var a in o){var c=o[a],d=n[e.outDir+"/"+a];if(d){for(var u=[],p=0;p0?t.substring(0,o):void 0}if(void 0===t&&(r=s.join(e,"nls.bundle.json"),n.existsSync(r)))return r}(t);if(o)try{return f(o)}catch(e){console.log("Loading in the box message bundle failed.",e)}r=g(t)}return r}function y(e){if(!e)return i.localize;var t=s.extname(e);if(t&&(e=e.substr(0,e.length-t.length)),l.messageFormat===i.MessageFormat.both||l.messageFormat===i.MessageFormat.bundle){var r=function(e){for(var t,r=s.dirname(e);t=s.join(r,"nls.metadata.header.json"),!n.existsSync(t);){var o=s.dirname(r);if(o===r){t=void 0;break}r=o}return t}(e);if(r){var o=s.dirname(r),a=c[o];if(void 0===a)try{var d=JSON.parse(n.readFileSync(r,"utf8"));try{var u=_(d,o);a=m(o,u?{header:d,nlsBundle:u}:null)}catch(e){console.error("Failed to load nls bundle",e),a=m(o,null)}}catch(e){console.error("Failed to read header file",e),a=m(o,null)}if(a){var h=e.substr(o.length+1).replace(/\\/g,"/"),g=a.nlsBundle[h];return void 0===g?(console.error("Messages for file "+e+" not found. See console for details."),function(){return"Messages not found."}):p(g)}}}if(l.messageFormat===i.MessageFormat.both||l.messageFormat===i.MessageFormat.file)try{var y=f(function(e){var t;if(l.cacheLanguageResolution&&t)t=t;else{if(i.isPseudo||!l.language)t=".nls.json";else for(var r=l.language;r;){var s=".nls."+r+".json";if(n.existsSync(e+s)){t=s;break}var o=r.lastIndexOf("-");o>0?r=r.substring(0,o):(t=".nls.json",r=null)}l.cacheLanguageResolution&&(t=t)}return e+t}(e));return Array.isArray(y)?p(y):i.isDefined(y.messages)&&i.isDefined(y.keys)?p(y.messages):(console.error("String bundle '"+e+"' uses an unsupported format."),function(){return"File bundle has unsupported format. See console for details"})}catch(e){"ENOENT"!==e.code&&console.error("Failed to load single file bundle",e)}return console.error("Failed to load message bundle for file "+e),function(){return"Failed to load message bundle. See console for details."}}function v(e){return e&&(h(e.locale)&&(l.locale=e.locale.toLowerCase(),l.language=l.locale,c=Object.create(null)),void 0!==e.messageFormat&&(l.messageFormat=e.messageFormat),e.bundleFormat===i.BundleFormat.standalone&&!0===l.languagePackSupport&&(l.languagePackSupport=!1)),i.setPseudo("pseudo"===l.locale),y}!function(){if(l={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:i.MessageFormat.bundle},h(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0;if(e.availableLanguages){var r=e.availableLanguages["*"];h(r)&&(t=r)}if(h(e.locale)&&(l.locale=e.locale.toLowerCase()),void 0===t?l.language=l.locale:"en"!==t&&(l.language=t),function(e){return!0===e||!1===e}(e._languagePackSupport)&&(l.languagePackSupport=e._languagePackSupport),h(e._cacheRoot)&&(l.cacheRoot=e._cacheRoot),h(e._languagePackId)&&(l.languagePackId=e._languagePackId),h(e._translationsConfigFile)){l.translationsConfigFile=e._translationsConfigFile;try{l.translationsConfig=f(l.translationsConfigFile)}catch(t){if(e._corruptedFile){var o=s.dirname(e._corruptedFile);n.exists(o,(function(t){t&&n.writeFile(e._corruptedFile,"corrupted","utf8",(function(e){console.error(e)}))}))}}}}catch(e){}i.setPseudo("pseudo"===l.locale),c=Object.create(null)}(),t.loadMessageBundle=y,t.config=v,o.default.install(Object.freeze({loadMessageBundle:y,config:v}))},2806:(e,t,r)=>{const s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,n=r(1017),o=s?";":":",i=r(1959),a=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),c=(e,t)=>{const r=t.colon||o,n=e.match(/\//)||s&&e.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],i=s?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=s?i.split(r):[""];return s&&-1!==e.indexOf(".")&&""!==a[0]&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:i}},l=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});const{pathEnv:s,pathExt:o,pathExtExe:l}=c(e,t),d=[],u=r=>new Promise(((o,i)=>{if(r===s.length)return t.all&&d.length?o(d):i(a(e));const c=s[r],l=/^".*"$/.test(c)?c.slice(1,-1):c,u=n.join(l,e),f=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;o(h(f,r,0))})),h=(e,r,s)=>new Promise(((n,a)=>{if(s===o.length)return n(u(r+1));const c=o[s];i(e+c,{pathExt:l},((o,i)=>{if(!o&&i){if(!t.all)return n(e+c);d.push(e+c)}return n(h(e,r,s+1))}))}));return r?u(0).then((e=>r(null,e)),r):u(0)};e.exports=l,l.sync=(e,t)=>{t=t||{};const{pathEnv:r,pathExt:s,pathExtExe:o}=c(e,t),l=[];for(let a=0;a{"use strict";const s=r(8762);s.createWebSocketStream=r(404),s.Server=r(9284),s.Receiver=r(2957),s.Sender=r(7330),s.WebSocket=s,s.WebSocketServer=s.Server,e.exports=s},977:(e,t,r)=>{"use strict";const{EMPTY_BUFFER:s}=r(1872);function n(e,t){if(0===e.length)return s;if(1===e.length)return e[0];const r=Buffer.allocUnsafe(t);let n=0;for(let t=0;t{"use strict";e.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},62:(e,t,r)=>{"use strict";const{kForOnEventAttribute:s,kListener:n}=r(1872),o=Symbol("kCode"),i=Symbol("kData"),a=Symbol("kError"),c=Symbol("kMessage"),l=Symbol("kReason"),d=Symbol("kTarget"),u=Symbol("kType"),h=Symbol("kWasClean");class f{constructor(e){this[d]=null,this[u]=e}get target(){return this[d]}get type(){return this[u]}}Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});class p extends f{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[l]=void 0===t.reason?"":t.reason,this[h]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[l]}get wasClean(){return this[h]}}Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});class m extends f{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[c]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});class g extends f{constructor(e,t={}){super(e),this[i]=void 0===t.data?null:t.data}get data(){return this[i]}}Object.defineProperty(g.prototype,"data",{enumerable:!0});const _={addEventListener(e,t,r={}){let o;if("message"===e)o=function(e,r){const s=new g("message",{data:r?e:e.toString()});s[d]=this,t.call(this,s)};else if("close"===e)o=function(e,r){const s=new p("close",{code:e,reason:r.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[d]=this,t.call(this,s)};else if("error"===e)o=function(e){const r=new m("error",{error:e,message:e.message});r[d]=this,t.call(this,r)};else{if("open"!==e)return;o=function(){const e=new f("open");e[d]=this,t.call(this,e)}}o[s]=!!r[s],o[n]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(const r of this.listeners(e))if(r[n]===t&&!r[s]){this.removeListener(e,r);break}}};e.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:_,MessageEvent:g}},1503:(e,t,r)=>{"use strict";const{tokenChars:s}=r(6746);function n(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}e.exports={format:function(e){return Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>[t].concat(Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const t=Object.create(null);let r,o,i=Object.create(null),a=!1,c=!1,l=!1,d=-1,u=-1,h=-1,f=0;for(;f{"use strict";const t=Symbol("kDone"),r=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}},5196:(e,t,r)=>{"use strict";const s=r(9796),n=r(977),o=r(305),{kStatusCode:i}=r(1872),a=Buffer.from([0,0,255,255]),c=Symbol("permessage-deflate"),l=Symbol("total-length"),d=Symbol("callback"),u=Symbol("buffers"),h=Symbol("error");let f;function p(e){this[u].push(e),this[l]+=e.length}function m(e){this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload?this[u].push(e):(this[h]=new RangeError("Max payload size exceeded"),this[h].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[h][i]=1009,this.removeListener("data",m),this.reset())}function g(e){this[c]._inflate=null,e[i]=1007,this[d](e)}e.exports=class{constructor(e,t,r){if(this._maxPayload=0|r,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!f){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;f=new o(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,r=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(r.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?r.client_max_window_bits=t.clientMaxWindowBits:!0!==r.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete r.client_max_window_bits,r}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let r=e[t];if(r.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(r=r[0],"client_max_window_bits"===t){if(!0!==r){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}else if("server_max_window_bits"===t){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==r)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}e[t]=r}))})),e}decompress(e,t,r){f.add((s=>{this._decompress(e,t,((e,t)=>{s(),r(e,t)}))}))}compress(e,t,r){f.add((s=>{this._compress(e,t,((e,t)=>{s(),r(e,t)}))}))}_decompress(e,t,r){const o=this._isServer?"client":"server";if(!this._inflate){const e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=s.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[u]=[],this._inflate.on("error",g),this._inflate.on("data",m)}this._inflate[d]=r,this._inflate.write(e),t&&this._inflate.write(a),this._inflate.flush((()=>{const e=this._inflate[h];if(e)return this._inflate.close(),this._inflate=null,void r(e);const s=n.concat(this._inflate[u],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[u]=[],t&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,s)}))}_compress(e,t,r){const o=this._isServer?"server":"client";if(!this._deflate){const e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=s.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[u]=[],this._deflate.on("data",p)}this._deflate[d]=r,this._deflate.write(e),this._deflate.flush(s.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=n.concat(this._deflate[u],this._deflate[l]);t&&(e=e.slice(0,e.length-4)),this._deflate[d]=null,this._deflate[l]=0,this._deflate[u]=[],t&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,e)}))}}},2957:(e,t,r)=>{"use strict";const{Writable:s}=r(2781),n=r(5196),{BINARY_TYPES:o,EMPTY_BUFFER:i,kStatusCode:a,kWebSocket:c}=r(1872),{concat:l,toArrayBuffer:d,unmask:u}=r(977),{isValidStatusCode:h,isValidUTF8:f}=r(6746);function p(e,t,r,s,n){const o=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,p),o.code=n,o[a]=s,o}e.exports=class extends s{constructor(e={}){super(),this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,r){if(8===this._opcode&&0==this._state)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,p(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[n.extensionName])return this._loop=!1,p(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,p(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,p(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,p(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,p(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,p(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,p(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,p(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,p(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,p(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,p(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,p(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=i;if(this._payloadLength){if(this._bufferedBytes7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[n.extensionName].decompress(e,this._fin,((e,r)=>{if(e)return t(e);if(r.length){if(this._messageLength+=r.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(p(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(r)}const s=this.dataMessage();if(s)return t(s);this.startLoop(t)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?l(t,e):"arraybuffer"===this._binaryType?d(l(t,e)):t,this.emit("message",r,!0)}else{const r=l(t,e);if(!this._skipUTF8Validation&&!f(r))return this._loop=!1,p(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,i),this.end();else{if(1===e.length)return p(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!h(t))return p(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const r=e.slice(2);if(!this._skipUTF8Validation&&!f(r))return p(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}},7330:(e,t,r)=>{"use strict";r(1808),r(4404);const{randomFillSync:s}=r(6113),n=r(5196),{EMPTY_BUFFER:o}=r(1872),{isValidStatusCode:i}=r(6746),{mask:a,toBuffer:c}=r(977),l=Symbol("kByteLength"),d=Buffer.alloc(4);class u{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,n,o=!1,i=2,c=!1;t.mask&&(r=t.maskBuffer||d,t.generateMask?t.generateMask(r):s(r,0,4),c=0==(r[0]|r[1]|r[2]|r[3]),i=6),"string"==typeof e?n=t.mask&&!c||void 0===t[l]?(e=Buffer.from(e)).length:t[l]:(n=e.length,o=t.mask&&t.readOnly&&!c);let u=n;n>=65536?(i+=8,u=127):n>125&&(i+=2,u=126);const h=Buffer.allocUnsafe(o?n+i:i);return h[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(h[0]|=64),h[1]=u,126===u?h.writeUInt16BE(n,2):127===u&&(h[2]=h[3]=0,h.writeUIntBE(n,4,6)),t.mask?(h[1]|=128,h[i-4]=r[0],h[i-3]=r[1],h[i-2]=r[2],h[i-1]=r[3],c?[h,e]:o?(a(e,r,h,i,n),[h]):(a(e,r,e,0,n),[h,e])):[h,e]}close(e,t,r,s){let n;if(void 0===e)n=o;else{if("number"!=typeof e||!i(e))throw new TypeError("First argument must be a valid error code number");if(void 0!==t&&t.length){const r=Buffer.byteLength(t);if(r>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+r),n.writeUInt16BE(e,0),"string"==typeof t?n.write(t,2):n.set(t,2)}else n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0)}const a={[l]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,a,s]):this.sendFrame(u.frame(n,a),s)}ping(e,t,r){let s,n;if("string"==typeof e?(s=Buffer.byteLength(e),n=!1):(s=(e=c(e)).length,n=c.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(u.frame(e,o),r)}pong(e,t,r){let s,n;if("string"==typeof e?(s=Buffer.byteLength(e),n=!1):(s=(e=c(e)).length,n=c.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(u.frame(e,o),r)}send(e,t,r){const s=this._extensions[n.extensionName];let o,i,a=t.binary?2:1,d=t.compress;if("string"==typeof e?(o=Buffer.byteLength(e),i=!1):(o=(e=c(e)).length,i=c.readOnly),this._firstFragment?(this._firstFragment=!1,d&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=o>=s._threshold),this._compress=d):(d=!1,a=0),t.fin&&(this._firstFragment=!0),s){const s={[l]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:i,rsv1:d};this._deflating?this.enqueue([this.dispatch,e,this._compress,s,r]):this.dispatch(e,this._compress,s,r)}else this.sendFrame(u.frame(e,{[l]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:i,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t)return void this.sendFrame(u.frame(e,r),s);const o=this._extensions[n.extensionName];this._bufferedBytes+=r[l],this._deflating=!0,o.compress(e,r.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof s&&s(e);for(let t=0;t{"use strict";const{Duplex:s}=r(2781);function n(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function i(e){this.removeListener("error",i),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let r=!0;const a=new s({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,r){const s=!r&&a._readableState.objectMode?t.toString():t;a.push(s)||e.pause()})),e.once("error",(function(e){a.destroyed||(r=!1,a.destroy(e))})),e.once("close",(function(){a.destroyed||a.push(null)})),a._destroy=function(t,s){if(e.readyState===e.CLOSED)return s(t),void process.nextTick(n,a);let o=!1;e.once("error",(function(e){o=!0,s(e)})),e.once("close",(function(){o||s(t),process.nextTick(n,a)})),r&&e.terminate()},a._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){a._final(t)}))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,r,s){e.readyState!==e.CONNECTING?e.send(t,s):e.once("open",(function(){a._write(t,r,s)}))},a.on("end",o),a.on("error",i),a}},640:(e,t,r)=>{"use strict";const{tokenChars:s}=r(6746);e.exports={parse:function(e){const t=new Set;let r=-1,n=-1,o=0;for(;o{"use strict";const s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function n(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function o(e){const t=e.length;let r=0;for(;r=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}try{const t=r(7838);e.exports={isValidStatusCode:n,isValidUTF8:e=>e.length<150?o(e):t(e),tokenChars:s}}catch(t){e.exports={isValidStatusCode:n,isValidUTF8:o,tokenChars:s}}},9284:(e,t,r)=>{"use strict";const s=r(2361),n=r(3685),{createHash:o}=(r(5687),r(1808),r(4404),r(6113)),i=r(1503),a=r(5196),c=r(640),l=r(8762),{GUID:d,kWebSocket:u}=r(1872),h=/^[+/0-9A-Za-z]{22}==$/;function f(e){e._state=2,e.emit("close")}function p(){this.destroy()}function m(e,t,r,s){e.writable&&(r=r||n.STATUS_CODES[t],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...s},e.write(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(s).map((e=>`${e}: ${s[e]}`)).join("\r\n")+"\r\n\r\n"+r)),e.removeListener("error",p),e.destroy()}e.exports=class extends s{constructor(e,t){if(super(),null==(e={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=n.createServer(((e,t)=>{const r=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":r.length,"Content-Type":"text/plain"}),t.end(r)})),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const r of Object.keys(t))e.on(r,t[r]);return function(){for(const r of Object.keys(t))e.removeListener(r,t[r])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,r,s)=>{this.handleUpgrade(t,r,s,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state)return e&&this.once("close",(()=>{e(new Error("The server is not running"))})),void process.nextTick(f,this);if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(f,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close((()=>{f(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",p);const n=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!n||!h.test(n)||8!==o&&13!==o||!this.shouldHandle(e))return m(t,400);const l=e.headers["sec-websocket-protocol"];let d=new Set;if(void 0!==l)try{d=c.parse(l)}catch(e){return m(t,400)}const u=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&void 0!==u){const e=new a(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=i.parse(u);t[a.extensionName]&&(e.accept(t[a.extensionName]),f[a.extensionName]=e)}catch(e){return m(t,400)}}if(this.options.verifyClient){const i={origin:e.headers[8===o?"sec-websocket-origin":"origin"],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(i,((o,i,a,c)=>{if(!o)return m(t,i||401,a,c);this.completeUpgrade(f,n,d,e,t,r,s)}));if(!this.options.verifyClient(i))return m(t,401)}this.completeUpgrade(f,n,d,e,t,r,s)}completeUpgrade(e,t,r,s,n,c,l){if(!n.readable||!n.writable)return n.destroy();if(n[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return m(n,503);const h=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${o("sha1").update(t+d).digest("base64")}`],g=new this.options.WebSocket(null);if(r.size){const e=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;e&&(h.push(`Sec-WebSocket-Protocol: ${e}`),g._protocol=e)}if(e[a.extensionName]){const t=e[a.extensionName].params,r=i.format({[a.extensionName]:[t]});h.push(`Sec-WebSocket-Extensions: ${r}`),g._extensions=e}this.emit("headers",h,s),n.write(h.concat("\r\n").join("\r\n")),n.removeListener("error",p),g.setSocket(n,c,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(g),g.on("close",(()=>{this.clients.delete(g),this._shouldEmitClose&&!this.clients.size&&process.nextTick(f,this)}))),l(g,s)}}},8762:(e,t,r)=>{"use strict";const s=r(2361),n=r(5687),o=r(3685),i=r(1808),a=r(4404),{randomBytes:c,createHash:l}=r(6113),{Readable:d}=r(2781),{URL:u}=r(7310),h=r(5196),f=r(2957),p=r(7330),{BINARY_TYPES:m,EMPTY_BUFFER:g,GUID:_,kForOnEventAttribute:y,kListener:v,kStatusCode:w,kWebSocket:b,NOOP:S}=r(1872),{EventTarget:{addEventListener:x,removeEventListener:E}}=r(62),{format:k,parse:C}=r(1503),{toBuffer:O}=r(977),P=["CONNECTING","OPEN","CLOSING","CLOSED"],T=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,M=[8,13];class B extends s{constructor(e,t,r){super(),this._binaryType=m[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=g,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=B.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(r=t,t=[]):t=[t]),L(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){m.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){const s=new f({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new p(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[b]=this,e[b]=this,s.on("conclude",j),s.on("drain",F),s.on("error",D),s.on("message",U),s.on("ping",q),s.on("pong",W),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",H),e.on("data",z),e.on("end",K),e.on("error",X),this._readyState=B.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=B.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[h.extensionName]&&this._extensions[h.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=B.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==B.CLOSED){if(this.readyState===B.CONNECTING){const e="WebSocket was closed before the connection was established";return R(this,this._req,e)}this.readyState!==B.CLOSING?(this._readyState=B.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==B.CONNECTING&&this.readyState!==B.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===B.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===B.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||g,t,r)):$(this,e,r)}pong(e,t,r){if(this.readyState===B.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===B.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||g,t,r)):$(this,e,r)}resume(){this.readyState!==B.CONNECTING&&this.readyState!==B.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===B.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(r=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==B.OPEN)return void $(this,e,r);const s={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[h.extensionName]||(s.compress=!1),this._sender.send(e||g,s,r)}terminate(){if(this.readyState!==B.CLOSED){if(this.readyState===B.CONNECTING){const e="WebSocket was closed before the connection was established";return R(this,this._req,e)}this._socket&&(this._readyState=B.CLOSING,this._socket.destroy())}}}function L(e,t,r,s){const i={protocolVersion:M[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!M.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${M.join(", ")})`);let a;if(t instanceof u)a=t,e._url=t.href;else{try{a=new u(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}e._url=t}const d="wss:"===a.protocol,f="ws+unix:"===a.protocol;let p;if("ws:"===a.protocol||d||f?f&&!a.pathname?p="The URL's pathname is empty":a.hash&&(p="The URL contains a fragment identifier"):p='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',p){const t=new SyntaxError(p);if(0===e._redirects)throw t;return void I(e,t)}const m=d?443:80,g=c(16).toString("base64"),y=d?n.get:o.get,v=new Set;let w;if(i.createConnection=d?A:N,i.defaultPort=i.defaultPort||m,i.port=a.port||m,i.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,i.headers={"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":g,Connection:"Upgrade",Upgrade:"websocket",...i.headers},i.path=a.pathname+a.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(w=new h(!0!==i.perMessageDeflate?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=k({[h.extensionName]:w.offer()})),r.length){for(const e of r){if("string"!=typeof e||!T.test(e)||v.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(e)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(a.username||a.password)&&(i.auth=`${a.username}:${a.password}`),f){const e=i.path.split(":");i.socketPath=e[0],i.path=e[1]}if(i.followRedirects){if(0===e._redirects){e._originalHost=a.host;const t=s&&s.headers;if(s={...s,headers:{}},t)for(const[e,r]of Object.entries(t))s.headers[e.toLowerCase()]=r}else a.host!==e._originalHost&&(delete i.headers.authorization,delete i.headers.cookie,delete i.headers.host,i.auth=void 0);i.auth&&!s.headers.authorization&&(s.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64"))}let b=e._req=y(i);i.timeout&&b.on("timeout",(()=>{R(e,b,"Opening handshake has timed out")})),b.on("error",(t=>{null===b||b.aborted||(b=e._req=null,I(e,t))})),b.on("response",(n=>{const o=n.headers.location,a=n.statusCode;if(o&&i.followRedirects&&a>=300&&a<400){if(++e._redirects>i.maxRedirects)return void R(e,b,"Maximum redirects exceeded");let n;b.abort();try{n=new u(o,t)}catch(t){const r=new SyntaxError(`Invalid URL: ${o}`);return void I(e,r)}L(e,n,r,s)}else e.emit("unexpected-response",b,n)||R(e,b,`Unexpected server response: ${n.statusCode}`)})),b.on("upgrade",((t,r,s)=>{if(e.emit("upgrade",t),e.readyState!==B.CONNECTING)return;b=e._req=null;const n=l("sha1").update(g+_).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void R(e,r,"Invalid Sec-WebSocket-Accept header");const o=t.headers["sec-websocket-protocol"];let a;if(void 0!==o?v.size?v.has(o)||(a="Server sent an invalid subprotocol"):a="Server sent a subprotocol but none was requested":v.size&&(a="Server sent no subprotocol"),a)return void R(e,r,a);o&&(e._protocol=o);const c=t.headers["sec-websocket-extensions"];if(void 0!==c){if(!w)return void R(e,r,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let t;try{t=C(c)}catch(t){return void R(e,r,"Invalid Sec-WebSocket-Extensions header")}const s=Object.keys(t);if(1!==s.length||s[0]!==h.extensionName)return void R(e,r,"Server indicated an extension that was not requested");try{w.accept(t[h.extensionName])}catch(t){return void R(e,r,"Invalid Sec-WebSocket-Extensions header")}e._extensions[h.extensionName]=w}e.setSocket(r,s,{generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}))}function I(e,t){e._readyState=B.CLOSING,e.emit("error",t),e.emitClose()}function N(e){return e.path=e.socketPath,i.connect(e)}function A(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=i.isIP(e.host)?"":e.host),a.connect(e)}function R(e,t,r){e._readyState=B.CLOSING;const s=new Error(r);Error.captureStackTrace(s,R),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",s)):(t.destroy(s),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function $(e,t,r){if(t){const r=O(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}r&&r(new Error(`WebSocket is not open: readyState ${e.readyState} (${P[e.readyState]})`))}function j(e,t){const r=this[b];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,void 0!==r._socket[b]&&(r._socket.removeListener("data",z),process.nextTick(V,r._socket),1005===e?r.close():r.close(e,t))}function F(){const e=this[b];e.isPaused||e._socket.resume()}function D(e){const t=this[b];void 0!==t._socket[b]&&(t._socket.removeListener("data",z),process.nextTick(V,t._socket),t.close(e[w])),t.emit("error",e)}function G(){this[b].emitClose()}function U(e,t){this[b].emit("message",e,t)}function q(e){const t=this[b];t.pong(e,!t._isServer,S),t.emit("ping",e)}function W(e){this[b].emit("pong",e)}function V(e){e.resume()}function H(){const e=this[b];let t;this.removeListener("close",H),this.removeListener("data",z),this.removeListener("end",K),e._readyState=B.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[b]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",G),e._receiver.on("finish",G))}function z(e){this[b]._receiver.write(e)||this.pause()}function K(){const e=this[b];e._readyState=B.CLOSING,e._receiver.end(),this.end()}function X(){const e=this[b];this.removeListener("error",X),this.on("error",S),e&&(e._readyState=B.CLOSING,this.destroy())}Object.defineProperty(B,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(B.prototype,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(B,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(B.prototype,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(B,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(B.prototype,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(B,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),Object.defineProperty(B.prototype,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(B.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(B.prototype,`on${e}`,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[y])return t[v];return null},set(t){for(const t of this.listeners(e))if(t[y]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[y]:!0})}})})),B.prototype.addEventListener=x,B.prototype.removeEventListener=E,e.exports=B},8447:e=>{"use strict";e.exports=require("bufferutil")},7838:e=>{"use strict";e.exports=require("utf-8-validate")},9496:e=>{"use strict";e.exports=require("vscode")},9491:e=>{"use strict";e.exports=require("assert")},4300:e=>{"use strict";e.exports=require("buffer")},2081:e=>{"use strict";e.exports=require("child_process")},6113:e=>{"use strict";e.exports=require("crypto")},2361:e=>{"use strict";e.exports=require("events")},7147:e=>{"use strict";e.exports=require("fs")},3685:e=>{"use strict";e.exports=require("http")},5687:e=>{"use strict";e.exports=require("https")},1808:e=>{"use strict";e.exports=require("net")},2037:e=>{"use strict";e.exports=require("os")},1017:e=>{"use strict";e.exports=require("path")},2781:e=>{"use strict";e.exports=require("stream")},1576:e=>{"use strict";e.exports=require("string_decoder")},4404:e=>{"use strict";e.exports=require("tls")},7310:e=>{"use strict";e.exports=require("url")},3837:e=>{"use strict";e.exports=require("util")},9796:e=>{"use strict";e.exports=require("zlib")}},t={},r=function r(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s].call(o.exports,o,o.exports,r),o.exports}(112);module.exports=r})(); -//# sourceMappingURL=extension.js.map \ No newline at end of file diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/.vsixmanifest b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/.vsixmanifest similarity index 98% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/.vsixmanifest rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/.vsixmanifest index 3e8679fa..6ac321c2 100644 --- a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/.vsixmanifest +++ b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/.vsixmanifest @@ -1,7 +1,7 @@ - + JavaScript Debugger Companion Extension Companion extension to js-debug that provides capability for remote debugging javascript diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/LICENSE.txt b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/LICENSE.txt similarity index 100% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/LICENSE.txt rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/LICENSE.txt diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/README.md b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/README.md similarity index 100% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/README.md rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/README.md diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/SECURITY.md b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/SECURITY.md similarity index 100% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/SECURITY.md rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/SECURITY.md diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/ThirdPartyNotices.txt b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/ThirdPartyNotices.txt similarity index 99% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/ThirdPartyNotices.txt rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/ThirdPartyNotices.txt index f28b5409..60a95a0c 100644 --- a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/ThirdPartyNotices.txt +++ b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/ThirdPartyNotices.txt @@ -232,7 +232,7 @@ Copyright 2019 human-signals 2.1.0 - Apache-2.0 https://git.io/JeluP -Copyright 2019 +Copyright 2019 ehmicky Apache License Version 2.0, January 2004 @@ -496,7 +496,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. signal-exit 3.0.3 - ISC https://github.com/tapjs/signal-exit -Copyright (c) 2015 +Copyright (c) 2015, Contributors The ISC License diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/ci.yml b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/ci.yml similarity index 100% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/ci.yml rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/ci.yml diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/out/extension.js b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/out/extension.js new file mode 100644 index 00000000..6c0ea2a9 --- /dev/null +++ b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/out/extension.js @@ -0,0 +1,2 @@ +(()=>{var e={8309:(e,t,r)=>{"use strict";const s=r(2081),n=r(4605),o=r(3743);function i(e,t,r){const i=n(e,t,r),a=s.spawn(i.command,i.args,i.options);return o.hookChildProcess(a,i),a}e.exports=i,e.exports.spawn=i,e.exports.sync=function(e,t,r){const i=n(e,t,r),a=s.spawnSync(i.command,i.args,i.options);return a.error=a.error||o.verifyENOENTSync(a.status,i),a},e.exports._parse=n,e.exports._enoent=o},3743:e=>{"use strict";const t="win32"===process.platform;function r(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function s(e,s){return t&&1===e&&!s.file?r(s.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;const n=e.emit;e.emit=function(t,o){if("exit"===t){const t=s(o,r);if(t)return n.call(e,"error",t)}return n.apply(e,arguments)}},verifyENOENT:s,verifyENOENTSync:function(e,s){return t&&1===e&&!s.file?r(s.original,"spawnSync"):null},notFoundError:r}},4605:(e,t,r)=>{"use strict";const s=r(1017),n=r(2202),o=r(5081),i=r(7550),a="win32"===process.platform,c=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);const d={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?d:function(e){if(!a)return e;const t=function(e){e.file=n(e);const t=e.file&&i(e.file);return t?(e.args.unshift(e.file),e.command=t,n(e)):e.file}(e),r=!c.test(t);if(e.options.forceShell||r){const r=l.test(t);e.command=s.normalize(e.command),e.command=o.command(e.command),e.args=e.args.map((e=>o.argument(e,r)));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(d)}},5081:e=>{"use strict";const t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=`"${e=(e=(e=`${e}`).replace(/(\\*)"/g,'$1$1\\"')).replace(/(\\*)$/,"$1$1")}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},7550:(e,t,r)=>{"use strict";const s=r(7147),n=r(2063);e.exports=function(e){const t=Buffer.alloc(150);let r;try{r=s.openSync(e,"r"),s.readSync(r,t,0,150,0),s.closeSync(r)}catch(e){}return n(t.toString())}},2202:(e,t,r)=>{"use strict";const s=r(1017),n=r(2806),o=r(3024);function i(e,t){const r=e.options.env||process.env,i=process.cwd(),a=null!=e.options.cwd,c=a&&void 0!==process.chdir&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch(e){}let l;try{l=n.sync(e.command,{path:r[o({env:r})],pathExt:t?s.delimiter:void 0})}catch(e){}finally{c&&process.chdir(i)}return l&&(l=s.resolve(a?e.options.cwd:"",l)),l}e.exports=function(e){return i(e)||i(e,!0)}},8468:(e,t,r)=>{"use strict";const s=r(1017),n=r(2081),o=r(8309),i=r(8150),a=r(6147),c=r(7678),l=r(4353),d=r(3111),{spawnedKill:u,spawnedCancel:h,setupTimeout:f,validateTimeout:p,setExitHandler:m}=r(3820),{handleInput:g,getSpawnedResult:_,makeAllStream:y,validateInputSync:v}=r(4994),{mergePromise:w,getSpawnedPromise:b}=r(1708),{joinCommand:S,parseCommand:x,getEscapedCommand:E}=r(4077),k=(e,t,r={})=>{const n=o._parse(e,t,r);return e=n.command,t=n.args,(r={maxBuffer:1e8,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:(r=n.options).cwd||process.cwd(),execPath:process.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r}).env=(({env:e,extendEnv:t,preferLocal:r,localDir:s,execPath:n})=>{const o=t?{...process.env,...e}:e;return r?a.env({env:o,cwd:s,execPath:n}):o})(r),r.stdio=d(r),"win32"===process.platform&&"cmd"===s.basename(e,".exe")&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},C=(e,t,r)=>"string"==typeof t||Buffer.isBuffer(t)?e.stripFinalNewline?i(t):t:void 0===r?void 0:"",O=(e,t,r)=>{const s=k(e,t,r),o=S(e,t),i=E(e,t);let a;p(s.options);try{a=n.spawn(s.file,s.args,s.options)}catch(e){const t=new n.ChildProcess,r=Promise.reject(l({error:e,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:s,timedOut:!1,isCanceled:!1,killed:!1}));return w(t,r)}const d=b(a),v=f(a,s.options,d),x=m(a,s.options,v),O={isCanceled:!1};a.kill=u.bind(null,a.kill.bind(a)),a.cancel=h.bind(null,a,O);const P=c((async()=>{const[{error:e,exitCode:t,signal:r,timedOut:n},c,d,u]=await _(a,s.options,x),h=C(s.options,c),f=C(s.options,d),p=C(s.options,u);if(e||0!==t||null!==r){const c=l({error:e,exitCode:t,signal:r,stdout:h,stderr:f,all:p,command:o,escapedCommand:i,parsed:s,timedOut:n,isCanceled:O.isCanceled,killed:a.killed});if(!s.options.reject)return c;throw c}return{command:o,escapedCommand:i,exitCode:0,stdout:h,stderr:f,all:p,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}));return g(a,s.options.input),a.all=y(a,s.options),w(a,P)};e.exports=O,e.exports.sync=(e,t,r)=>{const s=k(e,t,r),o=S(e,t),i=E(e,t);let a;v(s.options);try{a=n.spawnSync(s.file,s.args,s.options)}catch(e){throw l({error:e,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:s,timedOut:!1,isCanceled:!1,killed:!1})}const c=C(s.options,a.stdout,a.error),d=C(s.options,a.stderr,a.error);if(a.error||0!==a.status||null!==a.signal){const e=l({stdout:c,stderr:d,error:a.error,signal:a.signal,exitCode:a.status,command:o,escapedCommand:i,parsed:s,timedOut:a.error&&"ETIMEDOUT"===a.error.code,isCanceled:!1,killed:null!==a.signal});if(!s.options.reject)return e;throw e}return{command:o,escapedCommand:i,exitCode:0,stdout:c,stderr:d,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},e.exports.command=(e,t)=>{const[r,...s]=x(e);return O(r,s,t)},e.exports.commandSync=(e,t)=>{const[r,...s]=x(e);return O.sync(r,s,t)},e.exports.node=(e,t,r={})=>{t&&!Array.isArray(t)&&"object"==typeof t&&(r=t,t=[]);const s=d.node(r),n=process.execArgv.filter((e=>!e.startsWith("--inspect"))),{nodePath:o=process.execPath,nodeOptions:i=n}=r;return O(o,[...i,e,...Array.isArray(t)?t:[]],{...r,stdin:void 0,stdout:void 0,stderr:void 0,stdio:s,shell:!1})}},4077:e=>{"use strict";const t=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],r=/^[\w.-]+$/,s=/"/g,n=/ +/g;e.exports={joinCommand:(e,r)=>t(e,r).join(" "),getEscapedCommand:(e,n)=>t(e,n).map((e=>(e=>"string"!=typeof e||r.test(e)?e:`"${e.replace(s,'\\"')}"`)(e))).join(" "),parseCommand:e=>{const t=[];for(const r of e.trim().split(n)){const e=t[t.length-1];e&&e.endsWith("\\")?t[t.length-1]=`${e.slice(0,-1)} ${r}`:t.push(r)}return t}}},4353:(e,t,r)=>{"use strict";const{signalsByName:s}=r(7787);e.exports=({stdout:e,stderr:t,all:r,error:n,signal:o,exitCode:i,command:a,escapedCommand:c,timedOut:l,isCanceled:d,killed:u,parsed:{options:{timeout:h}}})=>{i=null===i?void 0:i;const f=void 0===(o=null===o?void 0:o)?void 0:s[o].description,p=`Command ${(({timedOut:e,timeout:t,errorCode:r,signal:s,signalDescription:n,exitCode:o,isCanceled:i})=>e?`timed out after ${t} milliseconds`:i?"was canceled":void 0!==r?`failed with ${r}`:void 0!==s?`was killed with ${s} (${n})`:void 0!==o?`failed with exit code ${o}`:"failed")({timedOut:l,timeout:h,errorCode:n&&n.code,signal:o,signalDescription:f,exitCode:i,isCanceled:d})}: ${a}`,m="[object Error]"===Object.prototype.toString.call(n),g=m?`${p}\n${n.message}`:p,_=[g,t,e].filter(Boolean).join("\n");return m?(n.originalMessage=n.message,n.message=_):n=new Error(_),n.shortMessage=g,n.command=a,n.escapedCommand=c,n.exitCode=i,n.signal=o,n.signalDescription=f,n.stdout=e,n.stderr=t,void 0!==r&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=Boolean(l),n.isCanceled=d,n.killed=u&&!l,n}},3820:(e,t,r)=>{"use strict";const s=r(2037),n=r(7908),o=(e,{forceKillAfterTimeout:t},r)=>i(e)&&!1!==t&&r,i=e=>e===s.constants.signals.SIGTERM||"string"==typeof e&&"SIGTERM"===e.toUpperCase(),a=({forceKillAfterTimeout:e=!0})=>{if(!0===e)return 5e3;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e};e.exports={spawnedKill:(e,t="SIGTERM",r={})=>{const s=e(t);return((e,t,r,s)=>{if(!o(t,r,s))return;const n=a(r),i=setTimeout((()=>{e("SIGKILL")}),n);i.unref&&i.unref()})(e,t,r,s),s},spawnedCancel:(e,t)=>{e.kill()&&(t.isCanceled=!0)},setupTimeout:(e,{timeout:t,killSignal:r="SIGTERM"},s)=>{if(0===t||void 0===t)return s;let n;const o=new Promise(((s,o)=>{n=setTimeout((()=>{((e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))})(e,r,o)}),t)})),i=s.finally((()=>{clearTimeout(n)}));return Promise.race([o,i])},validateTimeout:({timeout:e})=>{if(void 0!==e&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},setExitHandler:async(e,{cleanup:t,detached:r},s)=>{if(!t||r)return s;const o=n((()=>{e.kill()}));return s.finally((()=>{o()}))}}},1708:e=>{"use strict";const t=(async()=>{})().constructor.prototype,r=["then","catch","finally"].map((e=>[e,Reflect.getOwnPropertyDescriptor(t,e)]));e.exports={mergePromise:(e,t)=>{for(const[s,n]of r){const r="function"==typeof t?(...e)=>Reflect.apply(n.value,t(),e):n.value.bind(t);Reflect.defineProperty(e,s,{...n,value:r})}return e},getSpawnedPromise:e=>new Promise(((t,r)=>{e.on("exit",((e,r)=>{t({exitCode:e,signal:r})})),e.on("error",(e=>{r(e)})),e.stdin&&e.stdin.on("error",(e=>{r(e)}))}))}},3111:e=>{"use strict";const t=["stdin","stdout","stderr"],r=e=>{if(!e)return;const{stdio:r}=e;if(void 0===r)return t.map((t=>e[t]));if((e=>t.some((t=>void 0!==e[t])))(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${t.map((e=>`\`${e}\``)).join(", ")}`);if("string"==typeof r)return r;if(!Array.isArray(r))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof r}\``);const s=Math.max(r.length,t.length);return Array.from({length:s},((e,t)=>r[t]))};e.exports=r,e.exports.node=e=>{const t=r(e);return"ipc"===t?"ipc":void 0===t||"string"==typeof t?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}},4994:(e,t,r)=>{"use strict";const s=r(4970),n=r(31),o=r(4034),i=async(e,t)=>{if(e){e.destroy();try{return await t}catch(e){return e.bufferedData}}},a=(e,{encoding:t,buffer:r,maxBuffer:s})=>{if(e&&r)return t?n(e,{encoding:t,maxBuffer:s}):n.buffer(e,{maxBuffer:s})};e.exports={handleInput:(e,t)=>{void 0!==t&&void 0!==e.stdin&&(s(t)?t.pipe(e.stdin):e.stdin.end(t))},makeAllStream:(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const r=o();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},getSpawnedResult:async({stdout:e,stderr:t,all:r},{encoding:s,buffer:n,maxBuffer:o},c)=>{const l=a(e,{encoding:s,buffer:n,maxBuffer:o}),d=a(t,{encoding:s,buffer:n,maxBuffer:o}),u=a(r,{encoding:s,buffer:n,maxBuffer:2*o});try{return await Promise.all([c,l,d,u])}catch(s){return Promise.all([{error:s,signal:s.signal,timedOut:s.timedOut},i(e,l),i(t,d),i(r,u)])}},validateInputSync:({input:e})=>{if(s(e))throw new TypeError("The `input` option cannot be a stream in sync mode")}}},5105:(e,t,r)=>{"use strict";const{PassThrough:s}=r(2781);e.exports=e=>{e={...e};const{array:t}=e;let{encoding:r}=e;const n="buffer"===r;let o=!1;t?o=!(r||n):r=r||"utf8",n&&(r=null);const i=new s({objectMode:o});r&&i.setEncoding(r);let a=0;const c=[];return i.on("data",(e=>{c.push(e),o?a=c.length:a+=e.length})),i.getBufferedValue=()=>t?c:n?Buffer.concat(c,a):c.join(""),i.getBufferedLength=()=>a,i}},31:(e,t,r)=>{"use strict";const{constants:s}=r(4300),n=r(2781),{promisify:o}=r(3837),i=r(5105),a=o(n.pipeline);class c extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function l(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,n=i(t);return await new Promise(((t,o)=>{const i=e=>{e&&n.getBufferedLength()<=s.MAX_LENGTH&&(e.bufferedData=n.getBufferedValue()),o(e)};(async()=>{try{await a(e,n),t()}catch(e){i(e)}})(),n.on("data",(()=>{n.getBufferedLength()>r&&i(new c)}))})),n.getBufferedValue()}e.exports=l,e.exports.buffer=(e,t)=>l(e,{...t,encoding:"buffer"}),e.exports.array=(e,t)=>l(e,{...t,array:!0}),e.exports.MaxBufferError=c},7:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SIGNALS=void 0,t.SIGNALS=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]},7787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signalsByNumber=t.signalsByName=void 0;var s=r(2037),n=r(8699),o=r(7603);const i=(0,n.getSignals)().reduce((function(e,{name:t,number:r,description:s,supported:n,action:o,forced:i,standard:a}){return{...e,[t]:{name:t,number:r,description:s,supported:n,action:o,forced:i,standard:a}}}),{});t.signalsByName=i;const a=function(e,t){const r=t.find((({name:t})=>s.constants.signals[t]===e));return void 0!==r?r:t.find((t=>t.number===e))},c=function(){const e=(0,n.getSignals)(),t=o.SIGRTMAX+1,r=Array.from({length:t},((t,r)=>function(e,t){const r=a(e,t);if(void 0===r)return{};const{name:s,description:n,supported:o,action:i,forced:c,standard:l}=r;return{[e]:{name:s,number:e,description:n,supported:o,action:i,forced:c,standard:l}}}(r,e)));return Object.assign({},...r)}();t.signalsByNumber=c},7603:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SIGRTMAX=t.getRealtimeSignals=void 0,t.getRealtimeSignals=function(){const e=n-s+1;return Array.from({length:e},r)};const r=function(e,t){return{name:`SIGRT${t+1}`,number:s+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},s=34,n=64;t.SIGRTMAX=n},8699:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSignals=void 0;var s=r(2037),n=r(7),o=r(7603);t.getSignals=function(){const e=(0,o.getRealtimeSignals)();return[...n.SIGNALS,...e].map(i)};const i=function({name:e,number:t,description:r,action:n,forced:o=!1,standard:i}){const{signals:{[e]:a}}=s.constants,c=void 0!==a;return{name:e,number:c?a:t,description:r,supported:c,action:n,forced:o,standard:i}}},4970:e=>{"use strict";const t=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;t.writable=e=>t(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,t.readable=e=>t(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,t.duplex=e=>t.writable(e)&&t.readable(e),t.transform=e=>t.duplex(e)&&"function"==typeof e._transform&&"object"==typeof e._transformState,e.exports=t},1959:(e,t,r)=>{var s;function n(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise((function(r,s){n(e,t||{},(function(e,t){e?s(e):r(t)}))}))}s(e,t||{},(function(e,s){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,s=!1),r(e,s)}))}r(7147),s="win32"===process.platform||global.TESTING_WINDOWS?r(1429):r(4601),e.exports=n,n.sync=function(e,t){try{return s.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},4601:(e,t,r)=>{e.exports=n,n.sync=function(e,t){return o(s.statSync(e),t)};var s=r(7147);function n(e,t,r){s.stat(e,(function(e,s){r(e,!e&&o(s,t))}))}function o(e,t){return e.isFile()&&function(e,t){var r=e.mode,s=e.uid,n=e.gid,o=void 0!==t.uid?t.uid:process.getuid&&process.getuid(),i=void 0!==t.gid?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8);return r&parseInt("001",8)||r&c&&n===i||r&a&&s===o||r&(a|c)&&0===o}(e,t)}},1429:(e,t,r)=>{e.exports=o,o.sync=function(e,t){return n(s.statSync(e),e,t)};var s=r(7147);function n(e,t,r){return!(!e.isSymbolicLink()&&!e.isFile())&&function(e,t){var r=void 0!==t.pathExt?t.pathExt:process.env.PATHEXT;if(!r)return!0;if(-1!==(r=r.split(";")).indexOf(""))return!0;for(var s=0;s{"use strict";const{PassThrough:s}=r(2781);e.exports=function(){var e=[],t=new s({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(r),t;function r(s){return Array.isArray(s)?(s.forEach(r),this):(e.push(s),s.once("end",o.bind(null,s)),s.once("error",t.emit.bind(t,"error")),s.pipe(t,{end:!1}),this)}function n(){return 0==e.length}function o(r){!(e=e.filter((function(e){return e!==r}))).length&&t.readable&&t.end()}}},4341:e=>{"use strict";const t=(e,t)=>{for(const r of Reflect.ownKeys(t))Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));return e};e.exports=t,e.exports.default=t},6147:(e,t,r)=>{"use strict";const s=r(1017),n=r(3024),o=e=>{let t;e={cwd:process.cwd(),path:process.env[n()],execPath:process.execPath,...e};let r=s.resolve(e.cwd);const o=[];for(;t!==r;)o.push(s.join(r,"node_modules/.bin")),t=r,r=s.resolve(r,"..");const i=s.resolve(e.cwd,e.execPath,"..");return o.push(i),o.concat(e.path).join(s.delimiter)};e.exports=o,e.exports.default=o,e.exports.env=t=>{const r={...(t={env:process.env,...t}).env},s=n({env:r});return t.path=r[s],r[s]=e.exports(t),r}},7678:(e,t,r)=>{"use strict";const s=r(4341),n=new WeakMap,o=(e,t={})=>{if("function"!=typeof e)throw new TypeError("Expected a function");let r,o=0;const i=e.displayName||e.name||"",a=function(...s){if(n.set(a,++o),1===o)r=e.apply(this,s),e=null;else if(!0===t.throw)throw new Error(`Function \`${i}\` can only be called once`);return r};return s(a,e),n.set(a,o),a};e.exports=o,e.exports.default=o,e.exports.callCount=e=>{if(!n.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return n.get(e)}},3024:e=>{"use strict";const t=(e={})=>{const t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find((e=>"PATH"===e.toUpperCase()))||"Path"};e.exports=t,e.exports.default=t},2063:(e,t,r)=>{"use strict";const s=r(9395);e.exports=(e="")=>{const t=e.match(s);if(!t)return null;const[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return"env"===o?n:n?`${o} ${n}`:o}},9395:e=>{"use strict";e.exports=/^#!(.*)/},7908:(e,t,r)=>{var s,n=r(9491),o=r(5397),i=/^win/i.test(process.platform),a=r(2361);function c(){u&&(u=!1,o.forEach((function(e){try{process.removeListener(e,d[e])}catch(e){}})),process.emit=m,process.reallyExit=f,s.count-=1)}function l(e,t,r){s.emitted[e]||(s.emitted[e]=!0,s.emit(e,t,r))}"function"!=typeof a&&(a=a.EventEmitter),process.__signal_exit_emitter__?s=process.__signal_exit_emitter__:((s=process.__signal_exit_emitter__=new a).count=0,s.emitted={}),s.infinite||(s.setMaxListeners(1/0),s.infinite=!0),e.exports=function(e,t){n.equal(typeof e,"function","a callback must be provided for exit handler"),!1===u&&h();var r="exit";return t&&t.alwaysLast&&(r="afterexit"),s.on(r,e),function(){s.removeListener(r,e),0===s.listeners("exit").length&&0===s.listeners("afterexit").length&&c()}},e.exports.unload=c;var d={};o.forEach((function(e){d[e]=function(){process.listeners(e).length===s.count&&(c(),l("exit",null,e),l("afterexit",null,e),i&&"SIGHUP"===e&&(e="SIGINT"),process.kill(process.pid,e))}})),e.exports.signals=function(){return o},e.exports.load=h;var u=!1;function h(){u||(u=!0,s.count+=1,o=o.filter((function(e){try{return process.on(e,d[e]),!0}catch(e){return!1}})),process.emit=g,process.reallyExit=p)}var f=process.reallyExit;function p(e){process.exitCode=e||0,l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),f.call(process,process.exitCode)}var m=process.emit;function g(e,t){if("exit"===e){void 0!==t&&(process.exitCode=t);var r=m.apply(this,arguments);return l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),r}return m.apply(this,arguments)}},5397:e=>{e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],"win32"!==process.platform&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")},861:(e,t,r)=>{"use strict";const{Transform:s}=r(2781),{StringDecoder:n}=r(1576),o=Symbol("last"),i=Symbol("decoder");function a(e,t,r){let s;if(this.overflow){if(s=this[i].write(e).split(this.matcher),1===s.length)return r();s.shift(),this.overflow=!1}else this[o]+=this[i].write(e),s=this[o].split(this.matcher);this[o]=s.pop();for(let e=0;ethis.maxLength,!this.overflow||this.skipOverflow?r():r(new Error("maximum buffer reached"))}function c(e){if(this[o]+=this[i].end(),this[o])try{l(this,this.mapper(this[o]))}catch(t){return e(t)}e()}function l(e,t){void 0!==t&&e.push(t)}function d(e){return e}e.exports=function(e,t,r){switch(e=e||/\r?\n/,t=t||d,r=r||{},arguments.length){case 1:"function"==typeof e?(t=e,e=/\r?\n/):"object"!=typeof e||e instanceof RegExp||(r=e,e=/\r?\n/);break;case 2:"function"==typeof e?(r=t,t=e,e=/\r?\n/):"object"==typeof t&&(r=t,t=d)}(r=Object.assign({},r)).autoDestroy=!0,r.transform=a,r.flush=c,r.readableObjectMode=!0;const l=new s(r);return l[o]="",l[i]=new n("utf8"),l.matcher=e,l.mapper=t,l.maxLength=r.maxLength,l.skipOverflow=r.skipOverflow||!1,l.overflow=!1,l._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},l}},8150:e=>{"use strict";e.exports=e=>{const t="string"==typeof e?"\n":"\n".charCodeAt(),r="string"==typeof e?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e[e.length-1]===r&&(e=e.slice(0,e.length-1)),e}},6758:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserError=void 0;class r extends Error{}t.UserError=r},112:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.deactivate=t.activate=void 0;const i=o(r(9496)),a=r(6409),c=r(457),l=r(2037);let d;t.activate=function(e){var t,r;d=new a.SessionManager(new c.BrowserSpawner(null!==(r=null===(t=e.storageUri)||void 0===t?void 0:t.fsPath)&&void 0!==r?r:(0,l.tmpdir)(),e)),e.subscriptions.push(i.commands.registerCommand("js-debug-companion.launchAndAttach",(e=>{null==d||d.create(e).catch((e=>i.window.showErrorMessage(e.message)))})),i.commands.registerCommand("js-debug-companion.kill",(({launchId:e})=>{null==d||d.destroy(e)})))},t.deactivate=function(){null==d||d.dispose(),d=void 0}},5896:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.exists=void 0;const n=r(7147);t.exists=function(e){return s(this,void 0,void 0,(function*(){try{return yield n.promises.access(e),!0}catch(e){return!1}}))}},8224:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getWSEndpoint=t.retryGetWSEndpoint=void 0;const a=o(r(3685)),c=r(7310);function l(e,t){return i(this,void 0,void 0,(function*(){const r=yield d((0,c.resolve)(e,"/json/version"),t);if(null==r?void 0:r.webSocketDebuggerUrl)return u(e,r.webSocketDebuggerUrl);const s=yield d((0,c.resolve)(e,"/json/list"),t);if(null==s?void 0:s.length)return u(e,s[0].webSocketDebuggerUrl);throw new Error("Could not find any debuggable target")}))}function d(e,t){return i(this,void 0,void 0,(function*(){return JSON.parse(yield function(e,t){const r=[];return new Promise(((s,n)=>{const o=a.request(e,{headers:{host:"localhost"}},(e=>{r.push(t.onCancellationRequested((()=>e.destroy())));let o="";e.setEncoding("utf8"),e.on("data",(e=>o+=e)),e.on("end",(()=>s(o))),e.on("error",n)}));r.push(t.onCancellationRequested((()=>{o.destroy(),n(new Error(`Cancelled GET ${e}`))}))),o.on("error",n),o.end()})).finally((()=>r.forEach((e=>e.dispose()))))}(e,t))}))}function u(e,t){const r=new c.URL(e),s=new c.URL(t);return s.host=r.host,s.toString()}t.retryGetWSEndpoint=function e(t,r){return i(this,void 0,void 0,(function*(){try{return yield l(t,r)}catch(s){if(r.isCancellationRequested)throw new Error(`Could not connect to debug target at ${t}: ${s}`);return yield new Promise((e=>setTimeout(e,200))),e(t,r)}}))},t.getWSEndpoint=l},3928:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;const n=r(7310),o=r(9496),i=s(r(8777));class a{constructor(){this.qOrFn=[]}push(e){"function"==typeof this.qOrFn?this.qOrFn(e):this.qOrFn.push(e)}connect(e){if("function"==typeof this.qOrFn)throw new Error("Already connected");const t=this.qOrFn;this.qOrFn=e;for(const r of t)e(r)}}t.Session=class{constructor(){this.errorEmitter=new o.EventEmitter,this.onError=this.errorEmitter.event,this.closeEmitter=new o.EventEmitter,this.onClose=this.closeEmitter.event,this.disposed=!1,this.fromSocketQueue=new a,this.fromBrowserQueue=new a,this.onClose((()=>this.dispose())),this.onError((()=>this.dispose()))}attachSocket(e,t,r){const s=new n.URL(`ws://${e}:${t}${r}`);this.attachSocketLoop(s,Date.now()+5e3)}attachChild(e){this.disposed?e.dispose():(this.browserProcess=e,e.onClose((()=>this.closeEmitter.fire())),e.onError((e=>this.errorEmitter.fire(e))),e.onMessage((e=>this.fromBrowserQueue.push(e))),this.fromSocketQueue.connect((t=>e.send(t))))}dispose(){var e,t;this.disposed||(null===(e=this.browserProcess)||void 0===e||e.dispose(),null===(t=this.socket)||void 0===t||t.close(),this.disposed=!0)}attachSocketLoop(e,t){if(this.disposed)return;const r=new i.default(e,{perMessageDeflate:!0});r.on("open",(()=>{this.disposed?r.close():(this.socket=r,this.socket.on("close",(()=>this.closeEmitter.fire())),this.socket.on("message",(e=>this.fromSocketQueue.push(e))),this.fromBrowserQueue.connect((e=>r.send(e))))})),r.on("error",(s=>{this.socket===r||Date.now()>t?this.errorEmitter.fire(s):setTimeout((()=>this.attachSocketLoop(e,t)),100)}))}}},6409:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0;const a=o(r(9496)),c=r(3928),l=r(8389);t.SessionManager=class{constructor(e){this.spawn=e,this.sessions=new Map}create(e){return i(this,void 0,void 0,(function*(){const t=new c.Session;this.sessions.set(e.launchId,t),t.onClose((()=>this.sessions.delete(e.launchId))),t.onError((t=>{a.window.showErrorMessage(`Error running browserasd: ${t.message||t.stack}`),this.sessions.delete(e.launchId)})),yield Promise.all([this.addChildSocket(t,e),e.attach?this.addChildAttach(t,e.attach):this.addChildBrowser(t,e)])}))}destroy(e){const t=this.sessions.get(e);null==t||t.dispose(),this.sessions.delete(e)}dispose(){for(const e of this.sessions.values())e.dispose();this.sessions.clear()}addChildSocket(e,t){return i(this,void 0,void 0,(function*(){const[r,s]=t.proxyUri.split(":");e.attachSocket(r,Number(s),t.path)}))}addChildBrowser(e,t){return i(this,void 0,void 0,(function*(){const r=yield this.spawn.launch(t);e.attachChild(r)}))}addChildAttach(e,t){return i(this,void 0,void 0,(function*(){const r=yield l.AttachTarget.create(t.host,t.port);e.attachChild(r)}))}}},457:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserSpawner=void 0;const c=r(2081),l=a(r(8468)),d=r(7147),u=r(1017),h=r(2331),f=o(r(8472)),p=r(6758),m=r(5896),g=r(8389),_=f.loadMessageBundle(),y="--remote-debugging-port=",v="--remote-debugging-port=",w="availableBrowsers_";t.BrowserSpawner=class{constructor(e,t){this.storagePath=e,this.context=t,this.finders={edge:new h.EdgeBrowserFinder(process.env,d.promises,l.default),chrome:new h.ChromeBrowserFinder(process.env,d.promises,l.default)}}findBrowserPath(e,t){var r;return i(this,void 0,void 0,(function*(){if("*"!==t&&!(0,h.isQuality)(t))return t;if(!this.finders.hasOwnProperty(e))throw new p.UserError(`Browser type "${e}" is not supported.`);const s=this.context.globalState.get(w+e)||(yield this.finders[e].findAll()),n="*"===t?null!==(r=s.find((e=>"stable"===e.quality)))&&void 0!==r?r:s[0]:s.find((e=>e.quality===t));if(!n)throw yield this.context.globalState.update(w+e,void 0),"stable"!==t||s.length?new p.UserError(_("browserVersionNotFound",'Unable to find {0} version {1}. Available auto-discovered versions are: {2}. You can set the "runtimeExecutable" in your launch.json to one of these, or provide an absolute path to the browser executable.',e,t,JSON.stringify([...new Set(s)]))):new p.UserError(_("noBrowserInstallFound",'Unable to find a {0} installation on your system. Try installing it, or providing an absolute path to the browser in the "runtimeExecutable" in your launch.json.',e));return yield this.context.globalState.update(w+e,s),n.path}))}findBrowserByExe(e,t){var r;return i(this,void 0,void 0,(function*(){if("*"===t){const t=(yield e.findWhere((e=>"stable"===e.quality)))||(yield e.findAll())[0];return null==t?void 0:t.path}return(0,h.isQuality)(t)?null===(r=yield e.findWhere((e=>e.quality===t)))||void 0===r?void 0:r.path:t}))}getUserDataDir(e){var t;return i(this,void 0,void 0,(function*(){const r=e.params.userDataDir;if(!1===r)return;const s=(0,u.join)(this.storagePath,(null===(t=e.browserArgs)||void 0===t?void 0:t.includes("--headless"))?".headless-profile":".profile");return!0===r?s:(yield(0,m.exists)(r))?r:s}))}launch(e){var t;return i(this,void 0,void 0,(function*(){const r=yield this.findBrowserPath(e.type,e.params.runtimeExecutable),s=e.browserArgs.slice(),n=yield this.getUserDataDir(e);void 0!==n&&s.unshift(`--user-data-dir=${n}`);let o=e.params.cwd||e.params.webRoot;o&&(yield(0,m.exists)(o))||(o=process.cwd());const i=null===(t=s.find((e=>e.startsWith(y))))||void 0===t?void 0:t.slice(y.length);if(!i)return new g.PipedTarget((0,c.spawn)(r,s,{detached:"win32"!==process.platform,env:Object.assign(Object.assign(Object.assign({},process.env),{GDK_PIXBUF_MODULEDIR:void 0,GDK_PIXBUF_MODULE_FILE:void 0,ELECTRON_RUN_AS_NODE:void 0}),e.params.env),stdio:["ignore","ignore","ignore","pipe","pipe"],cwd:o}));s.includes(v)||s.unshift(v);const a=(0,c.spawn)(r,s,{detached:"win32"!==process.platform,env:Object.assign({ELECTRON_RUN_AS_NODE:void 0},e.params.env),stdio:"ignore",cwd:o});return yield g.ServerTarget.create(a,Number(i))}))}}},8389:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ServerTarget=t.AttachTarget=t.PipedTarget=void 0;const o=n(r(861)),i=r(9496),a=n(r(8777)),c=r(8224),l=e=>s(void 0,void 0,void 0,(function*(){e.exitCode||(yield Promise.race([new Promise((t=>e.on("exit",t))),new Promise((e=>setTimeout(e,1e3)))]))}));t.PipedTarget=class{constructor(e){if(this.process=e,this.errorEmitter=new i.EventEmitter,this.closeEmitter=new i.EventEmitter,this.messageEmitter=new i.EventEmitter,this.onError=this.errorEmitter.event,this.onClose=this.closeEmitter.event,this.onMessage=this.messageEmitter.event,this.process.stdio.length<5)throw new Error("Insufficient fd number on child process");e.on("error",(e=>this.errorEmitter.fire(e))),e.on("exit",(()=>this.closeEmitter.fire())),e.stdio[4].pipe((0,o.default)("\0")).on("data",(e=>this.messageEmitter.fire(e))).resume()}send(e){const t=this.process.stdio[3];if(e instanceof Uint8Array)t.write(e);else if(e instanceof ArrayBuffer)t.write(new Uint8Array(e));else for(const r of e)t.write(r);t.write("\0")}dispose(){return s(this,void 0,void 0,(function*(){yield l(this.process),this.process.kill()}))}};class d{constructor(e){this.ws=e,this.errorEmitter=new i.EventEmitter,this.closeEmitter=new i.EventEmitter,this.messageEmitter=new i.EventEmitter,this.onError=this.errorEmitter.event,this.onClose=this.closeEmitter.event,this.onMessage=this.messageEmitter.event,e.on("error",(e=>this.errorEmitter.fire(e))),e.on("close",(()=>this.closeEmitter.fire())),e.on("message",(e=>this.messageEmitter.fire(e)))}static create(e,t){return s(this,void 0,void 0,(function*(){const r=new i.CancellationTokenSource;setTimeout((()=>r.cancel()),1e4);const s=yield(0,c.retryGetWSEndpoint)(`http://${e}:${t}`,r.token),n=new a.default(s,[],{headers:{host:"localhost"},perMessageDeflate:!1,maxPayload:268435456,followRedirects:!0});return yield new Promise(((e,t)=>{n.addEventListener("open",(()=>e(new d(n)))),n.addEventListener("error",(e=>t(e.error)))}))}))}send(e){this.ws.send(e.toString())}dispose(){return s(this,void 0,void 0,(function*(){yield new Promise((e=>{this.ws.on("close",e),this.ws.close()}))}))}}t.AttachTarget=d;class u{constructor(e,t){this.process=e,this.attach=t,this.errorEmitter=new i.EventEmitter,this.closeEmitter=new i.EventEmitter,this.messageEmitter=new i.EventEmitter,this.onError=this.errorEmitter.event,this.onClose=this.closeEmitter.event,this.onMessage=this.messageEmitter.event,e.on("error",(e=>this.errorEmitter.fire(e))),e.on("close",(()=>this.closeEmitter.fire())),t.onError((e=>this.errorEmitter.fire(e))),t.onClose((()=>this.closeEmitter.fire())),t.onMessage((e=>this.messageEmitter.fire(e)))}static create(e,t){return s(this,void 0,void 0,(function*(){const r=new i.CancellationTokenSource;setTimeout((()=>r.cancel()),1e4);try{const r=yield d.create("localhost",t);return new u(e,r)}catch(t){throw e.kill(),t}}))}send(e){this.attach.send(e)}dispose(){return s(this,void 0,void 0,(function*(){this.attach.dispose(),yield l(this.process),this.process.kill()}))}}t.ServerTarget=u},9135:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DarwinChromeBrowserFinder=void 0;const s=r(690),n=r(1668);class o extends n.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",quality:"stable"},{path:"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",quality:"canary"},{path:"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta",quality:"beta"},{path:"/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev",quality:"dev"}]}async findAll(){const e=await this.findLaunchRegisteredApps("google chrome\\( canary\\)\\?.app",["/Applications/Google Chrome.app","/Applications/Google Chrome Canary.app"],["/Contents/MacOS/Google Chrome Canary","/Contents/MacOS/Google Chrome"]);return(0,s.sort)(e,this.createPriorities([{name:"Chrome.app",weight:0,quality:"stable"},{name:"Chrome Canary.app",weight:1,quality:"canary"}]))}getPreferredPath(){return this.env.CHROME_PATH}}t.DarwinChromeBrowserFinder=o},9143:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DarwinEdgeBrowserFinder=void 0;const s=r(690),n=r(1668);class o extends n.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",quality:"stable"},{path:"/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary",quality:"canary"},{path:"/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta",quality:"beta"},{path:"/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev",quality:"dev"}]}async findAll(){const e=await this.findLaunchRegisteredApps("Microsoft Edge[A-Za-z ]*.app",["/Applications/Microsoft Edge.app"],["/Contents/MacOS/Microsoft Edge Canary","/Contents/MacOS/Microsoft Edge Beta","/Contents/MacOS/Microsoft Edge Dev","/Contents/MacOS/Microsoft Edge"]);return(0,s.sort)(e,this.createPriorities([{name:"Microsoft Edge.app",weight:0,quality:"stable"},{name:"Microsoft Edge Canary.app",weight:1,quality:"canary"},{name:"Microsoft Edge Beta.app",weight:2,quality:"beta"},{name:"Microsoft Edge Dev.app",weight:3,quality:"dev"}]))}getPreferredPath(){return this.env.EDGE_PATH}}t.DarwinEdgeBrowserFinder=o},1668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DarwinFinderBase=void 0;const s=r(1017),n=r(690),o=/( \(0x[a-f0-9]+\))/;t.DarwinFinderBase=class{constructor(e,t,r){this.env=e,this.fs=t,this.execa=r,this.lsRegisterCommand="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump",this.wellKnownPaths=[]}async findWhere(e){for(const t of this.wellKnownPaths)if(e(t)&&await(0,n.canAccess)(this.fs,t.path))return t;return(await this.findAll()).find(e)}async findLaunchRegisteredApps(e,t,r){const{stdout:n}=await this.execa.command(`${this.lsRegisterCommand} | awk '$0 ~ /${e}${o.source}?$/ { $1=""; print $0 }'`,{shell:!0,stdio:"pipe"}),i=[...t,...n.split("\n").map((e=>e.trim().replace(o,"")))].filter((e=>!!e)),a=this.getPreferredPath();a&&i.push(a);const c=new Set;for(const e of i)for(const t of r){const r=s.posix.join(e.trim(),t);try{await this.fs.access(r),c.add(r)}catch(e){}}return c}createPriorities(e){const t=this.env.HOME&&(0,n.escapeRegexSpecialChars)(this.env.HOME),r=this.getPreferredPath(),s=e.reduce(((e,r)=>[...e,{regex:new RegExp(`^/Applications/.*${r.name}`),weight:r.weight+100,quality:r.quality},{regex:new RegExp(`^${t}/Applications/.*${r.name}`),weight:r.weight,quality:r.quality},{regex:new RegExp(`^/Volumes/.*${r.name}`),weight:r.weight-100,quality:r.quality}]),[]);return r&&s.unshift({regex:new RegExp((0,n.escapeRegexSpecialChars)(r)),weight:151,quality:"custom"}),s}}},2331:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EdgeBrowserFinder=t.ChromeBrowserFinder=t.isQuality=t.allQualities=void 0;const s=r(9135),n=r(9143),o=r(8651),i=r(6718),a=r(9498),c=r(3061);t.allQualities=new Set(Object.keys({canary:null,stable:null,beta:null,dev:null,custom:null})),t.isQuality=e=>t.allQualities.has(e),t.ChromeBrowserFinder="win32"===process.platform?a.WindowsChromeBrowserFinder:"darwin"===process.platform?s.DarwinChromeBrowserFinder:o.LinuxChromeBrowserFinder,t.EdgeBrowserFinder="win32"===process.platform?c.WindowsEdgeBrowserFinder:"darwin"===process.platform?n.DarwinEdgeBrowserFinder:i.LinuxEdgeBrowserFinder},8651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinuxChromeBrowserFinder=void 0;const s=r(1017),n=r(690),o=r(2081),i=r(2037),a=/\r?\n/;t.LinuxChromeBrowserFinder=class{constructor(e,t){this.env=e,this.fs=t,this.pathEnvironmentVar="CHROME_PATH",this.priorities=[{regex:/chrome-wrapper$/,weight:54,quality:"custom"},{regex:/google-chrome-dev$/,weight:53,quality:"dev"},{regex:/google-chrome-canary$/,weight:52,quality:"canary"},{regex:/google-chrome-unstable$/,weight:51,quality:"canary"},{regex:/google-chrome-canary$/,weight:51,quality:"canary"},{regex:/google-chrome-stable$/,weight:50,quality:"stable"},{regex:/google-chrome$/,weight:49,quality:"stable"},{regex:/chromium-browser$/,weight:48,quality:"custom"},{regex:/chromium$/,weight:47,quality:"custom"}],this.executablesOnPath=["google-chrome-unstable","google-chrome-dev","google-chrome-beta","google-chrome-canary","google-chrome-stable","google-chrome","chromium-browser","chromium"]}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){const e=new Set,t=this.env[this.pathEnvironmentVar];if(t&&await(0,n.canAccess)(this.fs,t)&&e.add(t),[s.posix.join((0,i.homedir)(),".local/share/applications/"),"/usr/share/applications/","/usr/bin"].forEach((t=>{for(const r in this.findChromeExecutables(t))e.add(r)})),await Promise.all(this.executablesOnPath.map((async t=>{try{const r=(0,o.execFileSync)("which",[t],{stdio:"pipe"}).toString().split(a)[0];await(0,n.canAccess)(this.fs,r)&&e.add(r)}catch(e){}}))),!e.size)throw new Error(`The environment variable ${t} must be set to executable of a build of the browser.`);const r=t?[{regex:new RegExp((0,n.escapeRegexSpecialChars)(t)),weight:101,quality:"custom"}].concat(this.priorities):this.priorities;return(0,n.sort)(e,r)}async findChromeExecutables(e){const t=/(^[^ ]+).*/,r=`^Exec=/.*/(${this.executablesOnPath.join("|")})-.*`,s=[];if(await(0,n.canAccess)(this.fs,e)){let i;try{i=(0,o.execSync)(`grep -ER "${r}" ${e} | awk -F '=' '{print $2}'`)}catch(t){i=(0,o.execSync)(`grep -Er "${r}" ${e} | awk -F '=' '{print $2}'`)}const c=i.toString().split(a).map((e=>e.replace(t,"$1")));await Promise.all(c.map((async e=>{await(0,n.canAccess)(this.fs,e)&&s.push(e)})))}return s}}},6718:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinuxEdgeBrowserFinder=void 0;const s=r(8651);class n extends s.LinuxChromeBrowserFinder{constructor(){super(...arguments),this.pathEnvironmentVar="EDGE_PATH",this.executablesOnPath=["microsoft-edge-dev","microsoft-edge-beta","microsoft-edge-stable","microsoft-edge"],this.priorities=[{regex:/microsoft-edge\-wrapper$/,weight:52,quality:"custom"},{regex:/microsoft-edge\-dev$/,weight:51,quality:"dev"},{regex:/microsoft-edge\-beta$/,weight:51,quality:"beta"},{regex:/microsoft-edge\-stable$/,weight:50,quality:"stable"},{regex:/microsoft-edge$/,weight:49,quality:"stable"}]}}t.LinuxEdgeBrowserFinder=n},690:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findWindowsCandidates=t.sort=t.preferredEdgePath=t.preferredChromePath=t.escapeRegexSpecialChars=t.canAccess=void 0;const s=r(1017);async function n({access:e},t){if(!t)return!1;try{return await e(t),!0}catch(e){return!1}}t.canAccess=n,t.escapeRegexSpecialChars=function(e,t){const r="/\\.?*()^${}|[]+".split("").filter((e=>!t||t.indexOf(e)<0)).join("").replace(/[\\\]]/g,"\\$&"),s=new RegExp(`[${r}]`,"g");return e.replace(s,"\\$&")},t.preferredChromePath=async function(e,t){if(await n(e,t.CHROME_PATH))return t.CHROME_PATH},t.preferredEdgePath=async function(e,t){if(await n(e,t.EDGE_PATH))return t.EDGE_PATH},t.sort=function(e,t){return[...e].filter((e=>!!e)).map((e=>{const r=t.find((t=>t.regex.test(e)));return r?{path:e,weight:r.weight,quality:r.quality}:{path:e,weight:10,quality:"dev"}})).sort(((e,t)=>t.weight-e.weight)).map((e=>({path:e.path,quality:e.quality})))},t.findWindowsCandidates=async function(e,t,r){const o=[e.LOCALAPPDATA,e.PROGRAMFILES,e["PROGRAMFILES(X86)"]].filter((e=>!!e)),i=[];for(const e of o)for(const o of r){const r=s.win32.join(e,o.name);i.push(n(t,r).then((e=>e?{path:r,quality:o.type}:void 0)))}return(await Promise.all(i)).filter((e=>!!e))}},9498:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowsChromeBrowserFinder=void 0;const s=r(1017),n=r(690);t.WindowsChromeBrowserFinder=class{constructor(e,t){this.env=e,this.fs=t}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){const e=s.win32.sep,t=[{name:`${e}Google${e}Chrome Dev${e}Application${e}chrome.exe`,type:"dev"},{name:`${e}Google${e}Chrome SxS${e}Application${e}chrome.exe`,type:"canary"},{name:`${e}Google${e}Chrome Beta${e}Application${e}chrome.exe`,type:"beta"},{name:`${e}Google${e}Chrome${e}Application${e}chrome.exe`,type:"stable"}],r=await(0,n.findWindowsCandidates)(this.env,this.fs,t),o=await(0,n.preferredChromePath)(this.fs,this.env);return o&&r.unshift({path:o,quality:"custom"}),r}}},3061:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowsEdgeBrowserFinder=void 0;const s=r(1017),n=r(690);t.WindowsEdgeBrowserFinder=class{constructor(e,t){this.env=e,this.fs=t}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){const e=[{name:`${s.sep}Microsoft${s.sep}Edge SxS${s.sep}Application${s.sep}msedge.exe`,type:"canary"},{name:`${s.sep}Microsoft${s.sep}Edge Dev${s.sep}Application${s.sep}msedge.exe`,type:"dev"},{name:`${s.sep}Microsoft${s.sep}Edge Beta${s.sep}Application${s.sep}msedge.exe`,type:"beta"},{name:`${s.sep}Microsoft${s.sep}Edge${s.sep}Application${s.sep}msedge.exe`,type:"stable"}],t=await(0,n.findWindowsCandidates)(this.env,this.fs,e),r=await(0,n.preferredEdgePath)(this.fs,this.env);return r&&t.unshift({path:r,quality:"custom"}),t}}},800:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.localize=t.format=t.setPseudo=t.isPseudo=t.isDefined=t.BundleFormat=t.MessageFormat=void 0;var s,n,o,i=r(1926);function a(e){return void 0!==e}function c(e,r){return t.isPseudo&&(e="["+e.replace(/[aouei]/g,"$&$&")+"]"),0===r.length?e:e.replace(/\{(\d+)\}/g,(function(e,t){var s=t[0],n=r[s],o=e;return"string"==typeof n?o=n:"number"!=typeof n&&"boolean"!=typeof n&&null!=n||(o=String(n)),o}))}(o=t.MessageFormat||(t.MessageFormat={})).file="file",o.bundle="bundle",o.both="both",(n=t.BundleFormat||(t.BundleFormat={})).standalone="standalone",n.languagePack="languagePack",function(e){e.is=function(e){var t=e;return t&&a(t.key)&&a(t.comment)}}(s||(s={})),t.isDefined=a,t.isPseudo=!1,t.setPseudo=function(e){t.isPseudo=e},t.format=c,t.localize=function(e,t){for(var r=[],s=2;s{"use strict";var r;function s(){if(void 0===r)throw new Error("No runtime abstraction layer installed");return r}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");r=e}}(s||(s={})),t.default=s},8472:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=void 0;var s=r(1017),n=r(7147),o=r(1926),i=r(800),a=r(800);Object.defineProperty(t,"MessageFormat",{enumerable:!0,get:function(){return a.MessageFormat}}),Object.defineProperty(t,"BundleFormat",{enumerable:!0,get:function(){return a.BundleFormat}});var c,l,d=Object.prototype.toString;function u(e){return"[object Number]"===d.call(e)}function h(e){return"[object String]"===d.call(e)}function f(e){return JSON.parse(n.readFileSync(e,"utf8"))}function p(e){return function(t,r){for(var s=[],n=2;n=e.length?void console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: "+new Error("").stack):i.format(e[t],s):h(r)?(console.warn("Message "+r+" didn't get externalized correctly."),i.format(r,s)):void console.error("Broken localize call found. Stacktrace is\n: "+new Error("").stack)}}function m(e,t){return c[e]=t,t}function g(e){try{return function(e){var t=f(s.join(e,"nls.metadata.json")),r=Object.create(null);for(var n in t){var o=t[n];r[n]=o.messages}return r}(e)}catch(e){return void console.log("Generating default bundle from meta data failed.",e)}}function _(e,t){var r;if(!0===l.languagePackSupport&&void 0!==l.cacheRoot&&void 0!==l.languagePackId&&void 0!==l.translationsConfigFile&&void 0!==l.translationsConfig)try{r=function(e,t){var r,o,i,a=s.join(l.cacheRoot,e.id+"-"+e.hash+".json"),c=!1,d=!1;try{return r=JSON.parse(n.readFileSync(a,{encoding:"utf8",flag:"r"})),o=a,i=new Date,n.utimes(o,i,i,(function(){})),r}catch(e){if("ENOENT"===e.code)d=!0;else{if(!(e instanceof SyntaxError))throw e;console.log("Syntax error parsing message bundle: "+e.message+"."),n.unlink(a,(function(e){e&&console.error("Deleting corrupted bundle "+a+" failed.")})),c=!0}}if(!(r=function(e,t){var r=l.translationsConfig[e.id];if(r){var n=f(r).contents,o=f(s.join(t,"nls.metadata.json")),i=Object.create(null);for(var a in o){var c=o[a],d=n[e.outDir+"/"+a];if(d){for(var u=[],p=0;p0?t.substring(0,o):void 0}if(void 0===t&&(r=s.join(e,"nls.bundle.json"),n.existsSync(r)))return r}(t);if(o)try{return f(o)}catch(e){console.log("Loading in the box message bundle failed.",e)}r=g(t)}return r}function y(e){if(!e)return i.localize;var t=s.extname(e);if(t&&(e=e.substr(0,e.length-t.length)),l.messageFormat===i.MessageFormat.both||l.messageFormat===i.MessageFormat.bundle){var r=function(e){for(var t,r=s.dirname(e);t=s.join(r,"nls.metadata.header.json"),!n.existsSync(t);){var o=s.dirname(r);if(o===r){t=void 0;break}r=o}return t}(e);if(r){var o=s.dirname(r),a=c[o];if(void 0===a)try{var d=JSON.parse(n.readFileSync(r,"utf8"));try{var u=_(d,o);a=m(o,u?{header:d,nlsBundle:u}:null)}catch(e){console.error("Failed to load nls bundle",e),a=m(o,null)}}catch(e){console.error("Failed to read header file",e),a=m(o,null)}if(a){var h=e.substr(o.length+1).replace(/\\/g,"/"),g=a.nlsBundle[h];return void 0===g?(console.error("Messages for file "+e+" not found. See console for details."),function(){return"Messages not found."}):p(g)}}}if(l.messageFormat===i.MessageFormat.both||l.messageFormat===i.MessageFormat.file)try{var y=f(function(e){var t;if(l.cacheLanguageResolution&&t)t=t;else{if(i.isPseudo||!l.language)t=".nls.json";else for(var r=l.language;r;){var s=".nls."+r+".json";if(n.existsSync(e+s)){t=s;break}var o=r.lastIndexOf("-");o>0?r=r.substring(0,o):(t=".nls.json",r=null)}l.cacheLanguageResolution&&(t=t)}return e+t}(e));return Array.isArray(y)?p(y):i.isDefined(y.messages)&&i.isDefined(y.keys)?p(y.messages):(console.error("String bundle '"+e+"' uses an unsupported format."),function(){return"File bundle has unsupported format. See console for details"})}catch(e){"ENOENT"!==e.code&&console.error("Failed to load single file bundle",e)}return console.error("Failed to load message bundle for file "+e),function(){return"Failed to load message bundle. See console for details."}}function v(e){return e&&(h(e.locale)&&(l.locale=e.locale.toLowerCase(),l.language=l.locale,c=Object.create(null)),void 0!==e.messageFormat&&(l.messageFormat=e.messageFormat),e.bundleFormat===i.BundleFormat.standalone&&!0===l.languagePackSupport&&(l.languagePackSupport=!1)),i.setPseudo("pseudo"===l.locale),y}!function(){if(l={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:i.MessageFormat.bundle},h(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0;if(e.availableLanguages){var r=e.availableLanguages["*"];h(r)&&(t=r)}if(h(e.locale)&&(l.locale=e.locale.toLowerCase()),void 0===t?l.language=l.locale:"en"!==t&&(l.language=t),function(e){return!0===e||!1===e}(e._languagePackSupport)&&(l.languagePackSupport=e._languagePackSupport),h(e._cacheRoot)&&(l.cacheRoot=e._cacheRoot),h(e._languagePackId)&&(l.languagePackId=e._languagePackId),h(e._translationsConfigFile)){l.translationsConfigFile=e._translationsConfigFile;try{l.translationsConfig=f(l.translationsConfigFile)}catch(t){if(e._corruptedFile){var o=s.dirname(e._corruptedFile);n.exists(o,(function(t){t&&n.writeFile(e._corruptedFile,"corrupted","utf8",(function(e){console.error(e)}))}))}}}}catch(e){}i.setPseudo("pseudo"===l.locale),c=Object.create(null)}(),t.loadMessageBundle=y,t.config=v,o.default.install(Object.freeze({loadMessageBundle:y,config:v}))},2806:(e,t,r)=>{const s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,n=r(1017),o=s?";":":",i=r(1959),a=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),c=(e,t)=>{const r=t.colon||o,n=e.match(/\//)||s&&e.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],i=s?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=s?i.split(r):[""];return s&&-1!==e.indexOf(".")&&""!==a[0]&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:i}},l=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});const{pathEnv:s,pathExt:o,pathExtExe:l}=c(e,t),d=[],u=r=>new Promise(((o,i)=>{if(r===s.length)return t.all&&d.length?o(d):i(a(e));const c=s[r],l=/^".*"$/.test(c)?c.slice(1,-1):c,u=n.join(l,e),f=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;o(h(f,r,0))})),h=(e,r,s)=>new Promise(((n,a)=>{if(s===o.length)return n(u(r+1));const c=o[s];i(e+c,{pathExt:l},((o,i)=>{if(!o&&i){if(!t.all)return n(e+c);d.push(e+c)}return n(h(e,r,s+1))}))}));return r?u(0).then((e=>r(null,e)),r):u(0)};e.exports=l,l.sync=(e,t)=>{t=t||{};const{pathEnv:r,pathExt:s,pathExtExe:o}=c(e,t),l=[];for(let a=0;a{"use strict";const s=r(8762);s.createWebSocketStream=r(404),s.Server=r(9284),s.Receiver=r(2957),s.Sender=r(7330),s.WebSocket=s,s.WebSocketServer=s.Server,e.exports=s},977:(e,t,r)=>{"use strict";const{EMPTY_BUFFER:s}=r(1872);function n(e,t){if(0===e.length)return s;if(1===e.length)return e[0];const r=Buffer.allocUnsafe(t);let n=0;for(let t=0;t{"use strict";e.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},62:(e,t,r)=>{"use strict";const{kForOnEventAttribute:s,kListener:n}=r(1872),o=Symbol("kCode"),i=Symbol("kData"),a=Symbol("kError"),c=Symbol("kMessage"),l=Symbol("kReason"),d=Symbol("kTarget"),u=Symbol("kType"),h=Symbol("kWasClean");class f{constructor(e){this[d]=null,this[u]=e}get target(){return this[d]}get type(){return this[u]}}Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});class p extends f{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[l]=void 0===t.reason?"":t.reason,this[h]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[l]}get wasClean(){return this[h]}}Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});class m extends f{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[c]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});class g extends f{constructor(e,t={}){super(e),this[i]=void 0===t.data?null:t.data}get data(){return this[i]}}Object.defineProperty(g.prototype,"data",{enumerable:!0});const _={addEventListener(e,t,r={}){let o;if("message"===e)o=function(e,r){const s=new g("message",{data:r?e:e.toString()});s[d]=this,t.call(this,s)};else if("close"===e)o=function(e,r){const s=new p("close",{code:e,reason:r.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[d]=this,t.call(this,s)};else if("error"===e)o=function(e){const r=new m("error",{error:e,message:e.message});r[d]=this,t.call(this,r)};else{if("open"!==e)return;o=function(){const e=new f("open");e[d]=this,t.call(this,e)}}o[s]=!!r[s],o[n]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(const r of this.listeners(e))if(r[n]===t&&!r[s]){this.removeListener(e,r);break}}};e.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:_,MessageEvent:g}},1503:(e,t,r)=>{"use strict";const{tokenChars:s}=r(6746);function n(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}e.exports={format:function(e){return Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>[t].concat(Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const t=Object.create(null);let r,o,i=Object.create(null),a=!1,c=!1,l=!1,d=-1,u=-1,h=-1,f=0;for(;f{"use strict";const t=Symbol("kDone"),r=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}},5196:(e,t,r)=>{"use strict";const s=r(9796),n=r(977),o=r(305),{kStatusCode:i}=r(1872),a=Buffer.from([0,0,255,255]),c=Symbol("permessage-deflate"),l=Symbol("total-length"),d=Symbol("callback"),u=Symbol("buffers"),h=Symbol("error");let f;function p(e){this[u].push(e),this[l]+=e.length}function m(e){this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload?this[u].push(e):(this[h]=new RangeError("Max payload size exceeded"),this[h].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[h][i]=1009,this.removeListener("data",m),this.reset())}function g(e){this[c]._inflate=null,e[i]=1007,this[d](e)}e.exports=class{constructor(e,t,r){if(this._maxPayload=0|r,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!f){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;f=new o(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,r=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(r.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?r.client_max_window_bits=t.clientMaxWindowBits:!0!==r.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete r.client_max_window_bits,r}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let r=e[t];if(r.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(r=r[0],"client_max_window_bits"===t){if(!0!==r){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}else if("server_max_window_bits"===t){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==r)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}e[t]=r}))})),e}decompress(e,t,r){f.add((s=>{this._decompress(e,t,((e,t)=>{s(),r(e,t)}))}))}compress(e,t,r){f.add((s=>{this._compress(e,t,((e,t)=>{s(),r(e,t)}))}))}_decompress(e,t,r){const o=this._isServer?"client":"server";if(!this._inflate){const e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=s.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[u]=[],this._inflate.on("error",g),this._inflate.on("data",m)}this._inflate[d]=r,this._inflate.write(e),t&&this._inflate.write(a),this._inflate.flush((()=>{const e=this._inflate[h];if(e)return this._inflate.close(),this._inflate=null,void r(e);const s=n.concat(this._inflate[u],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[u]=[],t&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,s)}))}_compress(e,t,r){const o=this._isServer?"server":"client";if(!this._deflate){const e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=s.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[u]=[],this._deflate.on("data",p)}this._deflate[d]=r,this._deflate.write(e),this._deflate.flush(s.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=n.concat(this._deflate[u],this._deflate[l]);t&&(e=e.slice(0,e.length-4)),this._deflate[d]=null,this._deflate[l]=0,this._deflate[u]=[],t&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,e)}))}}},2957:(e,t,r)=>{"use strict";const{Writable:s}=r(2781),n=r(5196),{BINARY_TYPES:o,EMPTY_BUFFER:i,kStatusCode:a,kWebSocket:c}=r(1872),{concat:l,toArrayBuffer:d,unmask:u}=r(977),{isValidStatusCode:h,isValidUTF8:f}=r(6746);function p(e,t,r,s,n){const o=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,p),o.code=n,o[a]=s,o}e.exports=class extends s{constructor(e={}){super(),this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,r){if(8===this._opcode&&0==this._state)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,p(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[n.extensionName])return this._loop=!1,p(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,p(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,p(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,p(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,p(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,p(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,p(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,p(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,p(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,p(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,p(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,p(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=i;if(this._payloadLength){if(this._bufferedBytes7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[n.extensionName].decompress(e,this._fin,((e,r)=>{if(e)return t(e);if(r.length){if(this._messageLength+=r.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(p(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(r)}const s=this.dataMessage();if(s)return t(s);this.startLoop(t)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?l(t,e):"arraybuffer"===this._binaryType?d(l(t,e)):t,this.emit("message",r,!0)}else{const r=l(t,e);if(!this._skipUTF8Validation&&!f(r))return this._loop=!1,p(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,i),this.end();else{if(1===e.length)return p(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!h(t))return p(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const r=e.slice(2);if(!this._skipUTF8Validation&&!f(r))return p(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}},7330:(e,t,r)=>{"use strict";r(1808),r(4404);const{randomFillSync:s}=r(6113),n=r(5196),{EMPTY_BUFFER:o}=r(1872),{isValidStatusCode:i}=r(6746),{mask:a,toBuffer:c}=r(977),l=Symbol("kByteLength"),d=Buffer.alloc(4);class u{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,n,o=!1,i=2,c=!1;t.mask&&(r=t.maskBuffer||d,t.generateMask?t.generateMask(r):s(r,0,4),c=0==(r[0]|r[1]|r[2]|r[3]),i=6),"string"==typeof e?n=t.mask&&!c||void 0===t[l]?(e=Buffer.from(e)).length:t[l]:(n=e.length,o=t.mask&&t.readOnly&&!c);let u=n;n>=65536?(i+=8,u=127):n>125&&(i+=2,u=126);const h=Buffer.allocUnsafe(o?n+i:i);return h[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(h[0]|=64),h[1]=u,126===u?h.writeUInt16BE(n,2):127===u&&(h[2]=h[3]=0,h.writeUIntBE(n,4,6)),t.mask?(h[1]|=128,h[i-4]=r[0],h[i-3]=r[1],h[i-2]=r[2],h[i-1]=r[3],c?[h,e]:o?(a(e,r,h,i,n),[h]):(a(e,r,e,0,n),[h,e])):[h,e]}close(e,t,r,s){let n;if(void 0===e)n=o;else{if("number"!=typeof e||!i(e))throw new TypeError("First argument must be a valid error code number");if(void 0!==t&&t.length){const r=Buffer.byteLength(t);if(r>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+r),n.writeUInt16BE(e,0),"string"==typeof t?n.write(t,2):n.set(t,2)}else n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0)}const a={[l]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,a,s]):this.sendFrame(u.frame(n,a),s)}ping(e,t,r){let s,n;if("string"==typeof e?(s=Buffer.byteLength(e),n=!1):(s=(e=c(e)).length,n=c.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(u.frame(e,o),r)}pong(e,t,r){let s,n;if("string"==typeof e?(s=Buffer.byteLength(e),n=!1):(s=(e=c(e)).length,n=c.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(u.frame(e,o),r)}send(e,t,r){const s=this._extensions[n.extensionName];let o,i,a=t.binary?2:1,d=t.compress;if("string"==typeof e?(o=Buffer.byteLength(e),i=!1):(o=(e=c(e)).length,i=c.readOnly),this._firstFragment?(this._firstFragment=!1,d&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=o>=s._threshold),this._compress=d):(d=!1,a=0),t.fin&&(this._firstFragment=!0),s){const s={[l]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:i,rsv1:d};this._deflating?this.enqueue([this.dispatch,e,this._compress,s,r]):this.dispatch(e,this._compress,s,r)}else this.sendFrame(u.frame(e,{[l]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:i,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t)return void this.sendFrame(u.frame(e,r),s);const o=this._extensions[n.extensionName];this._bufferedBytes+=r[l],this._deflating=!0,o.compress(e,r.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof s&&s(e);for(let t=0;t{"use strict";const{Duplex:s}=r(2781);function n(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function i(e){this.removeListener("error",i),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let r=!0;const a=new s({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,r){const s=!r&&a._readableState.objectMode?t.toString():t;a.push(s)||e.pause()})),e.once("error",(function(e){a.destroyed||(r=!1,a.destroy(e))})),e.once("close",(function(){a.destroyed||a.push(null)})),a._destroy=function(t,s){if(e.readyState===e.CLOSED)return s(t),void process.nextTick(n,a);let o=!1;e.once("error",(function(e){o=!0,s(e)})),e.once("close",(function(){o||s(t),process.nextTick(n,a)})),r&&e.terminate()},a._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){a._final(t)}))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,r,s){e.readyState!==e.CONNECTING?e.send(t,s):e.once("open",(function(){a._write(t,r,s)}))},a.on("end",o),a.on("error",i),a}},640:(e,t,r)=>{"use strict";const{tokenChars:s}=r(6746);e.exports={parse:function(e){const t=new Set;let r=-1,n=-1,o=0;for(;o{"use strict";const s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function n(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function o(e){const t=e.length;let r=0;for(;r=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}try{const t=r(7838);e.exports={isValidStatusCode:n,isValidUTF8:e=>e.length<150?o(e):t(e),tokenChars:s}}catch(t){e.exports={isValidStatusCode:n,isValidUTF8:o,tokenChars:s}}},9284:(e,t,r)=>{"use strict";const s=r(2361),n=r(3685),{createHash:o}=(r(5687),r(1808),r(4404),r(6113)),i=r(1503),a=r(5196),c=r(640),l=r(8762),{GUID:d,kWebSocket:u}=r(1872),h=/^[+/0-9A-Za-z]{22}==$/;function f(e){e._state=2,e.emit("close")}function p(){this.destroy()}function m(e,t,r,s){e.writable&&(r=r||n.STATUS_CODES[t],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...s},e.write(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(s).map((e=>`${e}: ${s[e]}`)).join("\r\n")+"\r\n\r\n"+r)),e.removeListener("error",p),e.destroy()}e.exports=class extends s{constructor(e,t){if(super(),null==(e={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=n.createServer(((e,t)=>{const r=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":r.length,"Content-Type":"text/plain"}),t.end(r)})),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const r of Object.keys(t))e.on(r,t[r]);return function(){for(const r of Object.keys(t))e.removeListener(r,t[r])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,r,s)=>{this.handleUpgrade(t,r,s,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state)return e&&this.once("close",(()=>{e(new Error("The server is not running"))})),void process.nextTick(f,this);if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(f,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close((()=>{f(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",p);const n=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!n||!h.test(n)||8!==o&&13!==o||!this.shouldHandle(e))return m(t,400);const l=e.headers["sec-websocket-protocol"];let d=new Set;if(void 0!==l)try{d=c.parse(l)}catch(e){return m(t,400)}const u=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&void 0!==u){const e=new a(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=i.parse(u);t[a.extensionName]&&(e.accept(t[a.extensionName]),f[a.extensionName]=e)}catch(e){return m(t,400)}}if(this.options.verifyClient){const i={origin:e.headers[8===o?"sec-websocket-origin":"origin"],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(i,((o,i,a,c)=>{if(!o)return m(t,i||401,a,c);this.completeUpgrade(f,n,d,e,t,r,s)}));if(!this.options.verifyClient(i))return m(t,401)}this.completeUpgrade(f,n,d,e,t,r,s)}completeUpgrade(e,t,r,s,n,c,l){if(!n.readable||!n.writable)return n.destroy();if(n[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return m(n,503);const h=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${o("sha1").update(t+d).digest("base64")}`],g=new this.options.WebSocket(null);if(r.size){const e=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;e&&(h.push(`Sec-WebSocket-Protocol: ${e}`),g._protocol=e)}if(e[a.extensionName]){const t=e[a.extensionName].params,r=i.format({[a.extensionName]:[t]});h.push(`Sec-WebSocket-Extensions: ${r}`),g._extensions=e}this.emit("headers",h,s),n.write(h.concat("\r\n").join("\r\n")),n.removeListener("error",p),g.setSocket(n,c,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(g),g.on("close",(()=>{this.clients.delete(g),this._shouldEmitClose&&!this.clients.size&&process.nextTick(f,this)}))),l(g,s)}}},8762:(e,t,r)=>{"use strict";const s=r(2361),n=r(5687),o=r(3685),i=r(1808),a=r(4404),{randomBytes:c,createHash:l}=r(6113),{Readable:d}=r(2781),{URL:u}=r(7310),h=r(5196),f=r(2957),p=r(7330),{BINARY_TYPES:m,EMPTY_BUFFER:g,GUID:_,kForOnEventAttribute:y,kListener:v,kStatusCode:w,kWebSocket:b,NOOP:S}=r(1872),{EventTarget:{addEventListener:x,removeEventListener:E}}=r(62),{format:k,parse:C}=r(1503),{toBuffer:O}=r(977),P=["CONNECTING","OPEN","CLOSING","CLOSED"],T=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,M=[8,13];class B extends s{constructor(e,t,r){super(),this._binaryType=m[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=g,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=B.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(r=t,t=[]):t=[t]),L(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){m.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){const s=new f({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new p(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[b]=this,e[b]=this,s.on("conclude",j),s.on("drain",F),s.on("error",D),s.on("message",U),s.on("ping",q),s.on("pong",W),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",H),e.on("data",z),e.on("end",K),e.on("error",X),this._readyState=B.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=B.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[h.extensionName]&&this._extensions[h.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=B.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==B.CLOSED){if(this.readyState===B.CONNECTING){const e="WebSocket was closed before the connection was established";return R(this,this._req,e)}this.readyState!==B.CLOSING?(this._readyState=B.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==B.CONNECTING&&this.readyState!==B.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===B.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===B.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||g,t,r)):$(this,e,r)}pong(e,t,r){if(this.readyState===B.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===B.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||g,t,r)):$(this,e,r)}resume(){this.readyState!==B.CONNECTING&&this.readyState!==B.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===B.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(r=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==B.OPEN)return void $(this,e,r);const s={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[h.extensionName]||(s.compress=!1),this._sender.send(e||g,s,r)}terminate(){if(this.readyState!==B.CLOSED){if(this.readyState===B.CONNECTING){const e="WebSocket was closed before the connection was established";return R(this,this._req,e)}this._socket&&(this._readyState=B.CLOSING,this._socket.destroy())}}}function L(e,t,r,s){const i={protocolVersion:M[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!M.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${M.join(", ")})`);let a;if(t instanceof u)a=t,e._url=t.href;else{try{a=new u(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}e._url=t}const d="wss:"===a.protocol,f="ws+unix:"===a.protocol;let p;if("ws:"===a.protocol||d||f?f&&!a.pathname?p="The URL's pathname is empty":a.hash&&(p="The URL contains a fragment identifier"):p='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',p){const t=new SyntaxError(p);if(0===e._redirects)throw t;return void I(e,t)}const m=d?443:80,g=c(16).toString("base64"),y=d?n.get:o.get,v=new Set;let w;if(i.createConnection=d?A:N,i.defaultPort=i.defaultPort||m,i.port=a.port||m,i.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,i.headers={"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":g,Connection:"Upgrade",Upgrade:"websocket",...i.headers},i.path=a.pathname+a.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(w=new h(!0!==i.perMessageDeflate?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=k({[h.extensionName]:w.offer()})),r.length){for(const e of r){if("string"!=typeof e||!T.test(e)||v.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(e)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(a.username||a.password)&&(i.auth=`${a.username}:${a.password}`),f){const e=i.path.split(":");i.socketPath=e[0],i.path=e[1]}if(i.followRedirects){if(0===e._redirects){e._originalHost=a.host;const t=s&&s.headers;if(s={...s,headers:{}},t)for(const[e,r]of Object.entries(t))s.headers[e.toLowerCase()]=r}else a.host!==e._originalHost&&(delete i.headers.authorization,delete i.headers.cookie,delete i.headers.host,i.auth=void 0);i.auth&&!s.headers.authorization&&(s.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64"))}let b=e._req=y(i);i.timeout&&b.on("timeout",(()=>{R(e,b,"Opening handshake has timed out")})),b.on("error",(t=>{null===b||b.aborted||(b=e._req=null,I(e,t))})),b.on("response",(n=>{const o=n.headers.location,a=n.statusCode;if(o&&i.followRedirects&&a>=300&&a<400){if(++e._redirects>i.maxRedirects)return void R(e,b,"Maximum redirects exceeded");let n;b.abort();try{n=new u(o,t)}catch(t){const r=new SyntaxError(`Invalid URL: ${o}`);return void I(e,r)}L(e,n,r,s)}else e.emit("unexpected-response",b,n)||R(e,b,`Unexpected server response: ${n.statusCode}`)})),b.on("upgrade",((t,r,s)=>{if(e.emit("upgrade",t),e.readyState!==B.CONNECTING)return;b=e._req=null;const n=l("sha1").update(g+_).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void R(e,r,"Invalid Sec-WebSocket-Accept header");const o=t.headers["sec-websocket-protocol"];let a;if(void 0!==o?v.size?v.has(o)||(a="Server sent an invalid subprotocol"):a="Server sent a subprotocol but none was requested":v.size&&(a="Server sent no subprotocol"),a)return void R(e,r,a);o&&(e._protocol=o);const c=t.headers["sec-websocket-extensions"];if(void 0!==c){if(!w)return void R(e,r,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let t;try{t=C(c)}catch(t){return void R(e,r,"Invalid Sec-WebSocket-Extensions header")}const s=Object.keys(t);if(1!==s.length||s[0]!==h.extensionName)return void R(e,r,"Server indicated an extension that was not requested");try{w.accept(t[h.extensionName])}catch(t){return void R(e,r,"Invalid Sec-WebSocket-Extensions header")}e._extensions[h.extensionName]=w}e.setSocket(r,s,{generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}))}function I(e,t){e._readyState=B.CLOSING,e.emit("error",t),e.emitClose()}function N(e){return e.path=e.socketPath,i.connect(e)}function A(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=i.isIP(e.host)?"":e.host),a.connect(e)}function R(e,t,r){e._readyState=B.CLOSING;const s=new Error(r);Error.captureStackTrace(s,R),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",s)):(t.destroy(s),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function $(e,t,r){if(t){const r=O(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}r&&r(new Error(`WebSocket is not open: readyState ${e.readyState} (${P[e.readyState]})`))}function j(e,t){const r=this[b];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,void 0!==r._socket[b]&&(r._socket.removeListener("data",z),process.nextTick(V,r._socket),1005===e?r.close():r.close(e,t))}function F(){const e=this[b];e.isPaused||e._socket.resume()}function D(e){const t=this[b];void 0!==t._socket[b]&&(t._socket.removeListener("data",z),process.nextTick(V,t._socket),t.close(e[w])),t.emit("error",e)}function G(){this[b].emitClose()}function U(e,t){this[b].emit("message",e,t)}function q(e){const t=this[b];t.pong(e,!t._isServer,S),t.emit("ping",e)}function W(e){this[b].emit("pong",e)}function V(e){e.resume()}function H(){const e=this[b];let t;this.removeListener("close",H),this.removeListener("data",z),this.removeListener("end",K),e._readyState=B.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[b]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",G),e._receiver.on("finish",G))}function z(e){this[b]._receiver.write(e)||this.pause()}function K(){const e=this[b];e._readyState=B.CLOSING,e._receiver.end(),this.end()}function X(){const e=this[b];this.removeListener("error",X),this.on("error",S),e&&(e._readyState=B.CLOSING,this.destroy())}Object.defineProperty(B,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(B.prototype,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(B,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(B.prototype,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(B,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(B.prototype,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(B,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),Object.defineProperty(B.prototype,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(B.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(B.prototype,`on${e}`,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[y])return t[v];return null},set(t){for(const t of this.listeners(e))if(t[y]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[y]:!0})}})})),B.prototype.addEventListener=x,B.prototype.removeEventListener=E,e.exports=B},8447:e=>{"use strict";e.exports=require("bufferutil")},7838:e=>{"use strict";e.exports=require("utf-8-validate")},9496:e=>{"use strict";e.exports=require("vscode")},9491:e=>{"use strict";e.exports=require("assert")},4300:e=>{"use strict";e.exports=require("buffer")},2081:e=>{"use strict";e.exports=require("child_process")},6113:e=>{"use strict";e.exports=require("crypto")},2361:e=>{"use strict";e.exports=require("events")},7147:e=>{"use strict";e.exports=require("fs")},3685:e=>{"use strict";e.exports=require("http")},5687:e=>{"use strict";e.exports=require("https")},1808:e=>{"use strict";e.exports=require("net")},2037:e=>{"use strict";e.exports=require("os")},1017:e=>{"use strict";e.exports=require("path")},2781:e=>{"use strict";e.exports=require("stream")},1576:e=>{"use strict";e.exports=require("string_decoder")},4404:e=>{"use strict";e.exports=require("tls")},7310:e=>{"use strict";e.exports=require("url")},3837:e=>{"use strict";e.exports=require("util")},9796:e=>{"use strict";e.exports=require("zlib")}},t={},r=function r(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s].call(o.exports,o,o.exports,r),o.exports}(112);module.exports=r})(); +//# sourceMappingURL=extension.js.map \ No newline at end of file diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/package.json b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/package.json similarity index 97% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/package.json rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/package.json index fa35a7db..0800b0b7 100644 --- a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/package.json +++ b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/package.json @@ -2,7 +2,7 @@ "name": "js-debug-companion", "displayName": "JavaScript Debugger Companion Extension", "description": "Companion extension to js-debug that provides capability for remote debugging", - "version": "1.0.17", + "version": "1.0.18", "publisher": "ms-vscode", "engines": { "vscode": "^1.65.0" @@ -91,6 +91,6 @@ "updated": true, "isPreReleaseVersion": false, "preRelease": false, - "installedTimestamp": 1649320100391 + "installedTimestamp": 1651564989793 } } \ No newline at end of file diff --git a/vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/resources/logo.png b/vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/resources/logo.png similarity index 100% rename from vscodium/extensions/ms-vscode.js-debug-companion-1.0.17/resources/logo.png rename to vscodium/extensions/ms-vscode.js-debug-companion-1.0.18/resources/logo.png diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/.vsixmanifest b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/.vsixmanifest similarity index 99% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/.vsixmanifest rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/.vsixmanifest index d14fc07b..9b818d50 100644 --- a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/.vsixmanifest +++ b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/.vsixmanifest @@ -1,7 +1,7 @@ - + Tabnine AI Autocomplete for Javascript, Python, Typescript, PHP, Go, Java, Ruby & more 👩‍💻🤖 JavaScript, Python, Java, Typescript & all other languages - AI Code completion plugin. Tabnine makes developers more productive by auto-completing their code. javascript,python,typescript,php,autocomplete,ruby,java,go,golang,bash,kotlin,html,css,ocaml,perl,rust,julia,lua,haskell,c,cpp,c++,csharp,c#,react,swift,objective-c,objectivec,ai,method completion,intellicode,intellisense,snippets,kite,nodejs,node,node.js,jupyter,keybindings diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/LICENSE.txt b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/LICENSE.txt similarity index 100% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/LICENSE.txt rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/LICENSE.txt diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/README.md b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/README.md similarity index 75% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/README.md rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/README.md index f648ccb5..51f25777 100644 --- a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/README.md +++ b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/README.md @@ -17,6 +17,12 @@ ![Tabnine insights](https://raw.githubusercontent.com/codota/tabnine-vscode/master/assets/hub-user-insights.gif)
+####TL;DR +**[Frequently Asked Questions](#frequently-asked-questions)** +**[Easy Installation](#easy-installation)** +**[Supported Languages](#all-the-languages-you-love)** +**[Tabnine for Teams](#personalized-ai-model-trained-on-your-code)** + Boost your productivity with the expert guidance of an AI code completion assistant **trusted by millions of developers**. Whether you are a new dev or a seasoned pro, working solo or part of a team, Tabnine’s AI assistant will increase your development velocity with code completions in all the most popular coding languages and IDEs. @@ -27,12 +33,12 @@ Whether you are a new dev or a seasoned pro, working solo or part of a team, Tab ## Personalized AI Model Trained On Your Code -Tabnine for Teams provides expert inline coding guidance with an AI assistant privately trained on your team’s coding standards. +Tabnine for Teams provides expert inline coding guidance with an AI assistant privately trained on your team’s coding standards. [Learn more](https://www.tabnine.com/team?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace)
## GitHub, GitLab and Bitbucket Integration -Tabnine makes it easy and secure for team admins to grant their AI assistant access to their Github, GitLab and Bitbucket repositories. Simply assign the repositories you want your AI assistant to learn from. +Tabnine makes it easy and secure for team admins to grant their AI assistant access to their Github, GitLab and Bitbucket repositories. Simply assign the repositories you want your AI assistant to learn from. [Learn more](https://www.tabnine.com/team?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace)
![Github integration](https://raw.githubusercontent.com/codota/tabnine-vscode/master/assets/hub-github-Integration.gif) @@ -188,20 +194,33 @@ Deep Tabnine is based on GPT-2, which uses the **_Transformers Network Architect --- -- **Q: What is the difference between Tabnine Free and Tabnine Pro?** -- A: Tabnine’s Free version is a great option for junior developers working alone. The Free plan provides a reliable AI code completion assistant running an algorithm trained on a limited block of open-source code. - Tabnine Pro delivers increased productivity and AI code completion accuracy for independent professional developers and teams of up to 50. Tabnine Pro’s algorithm trains on deep machine learning, a larger public code sampling, and language-specific models. The advanced AI assistant learns your team’s code, projects, preferences, and patterns, providing an unmatched real-time, in-IDE code completion experience. The more team members your Tabnine AI assistant interacts with, the more accurate your code completions become. +### Frequently Asked Questions + +- **Q: What is the difference between Tabnine Free and Tabnine Team?** +- A: Tabnine's Free version is a great option for junior developers working alone. The Free plan provides a reliable Basic AI code completion assistant trained on a limited block of open-source code with permissive licenses. + Tabnine for Teams provides multi-model advanced AI code completions for teams of professional developers. The Tabnine Teams Private Model is trained exclusively on your team's code and the repositories you specify, maximizing the value of every development team member, improving team-wide code standardization, accelerating onboarding, and cutting code review costs. + The Private AI Model significantly improves your code completion accuracy by incorporating your organization's coding standards and best practices. + Tabnine for Teams users also have the option to grant their AI assistant secure read-only access to their GitHub, GitLab, and Bitbucket repositories. Every line of team-created code the AI assistant learns from amplifies the accuracy of its code completions, boosting productivity for the entire team.

-- **Q: What are the benefits for individual developers upgrading to Tabnine Pro (Teams)?** -- A: Experience improved productivity with longer, more accurate code completions thanks to Tabnine Pro’s advanced AI algorithm and language-specific models. Tabnine Pro learns from your code, projects, preferences, and patterns, providing a real-time, in-IDE code completion experience that is continuously improving. In addition, Tabnine Pro utilizes an advanced Public Code AI algorithm based on more than a billion lines of open-source code with permissive licenses. +- **Q: What are the benefits for developers upgrading to Tabnine for Teams?** +- A: Tabnine for Teams private AI code completion assistant is trained exclusively on your team's code and the repositories you specify. Your team's AI assistant maximizes the value of every development team member, improving team-wide code standardization, accelerating onboarding, and cutting code review costs.

-- **Q: What are the benefits for teams of developers upgrading to Tabnine Pro (Teams)?** -- A: You and your team will experience improved productivity with longer, more accurate code completions thanks to Tabnine Pro’s Advanced AI code completion assistant. - Tabnine Pro is powered by our Team Learning AI, advanced Public Code algorithm, and a variety of language-specific models. The result is a real-time, in-IDE code completion assistant that is constantly learning, adapting, and improving. The more team members your AI assistant interacts with, the better it gets at anticipating your team’s code completion needs. +- **Q: How do I enable GitHub integration??** +- A: Tabnine team admins can enable GitHub integration in the [Tabnine App](https://app.tabnine.com/?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace). Tabnine's GitHub integration makes it easy and secure to give your AI assistant access to your Github repositories. You assign the repositories you want your AI assistant to learn from, and you control the permissions. +
+
+ +- **Q: How do I enable GitLab integration??** +- A: Tabnine team admins can enable GitHub integration in the [Tabnine App](https://app.tabnine.com/?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace). Tabnine's GitHub integration makes it easy and secure to give your AI assistant access to your Github repositories. You assign the repositories you want your AI assistant to learn from, and you control the permissions. +
+
+ +- **Q: How do I enable GitLab integration??** +- A: Tabnine team admins can enable GitLab integration in the [Tabnine App](https://app.tabnine.com/?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace). Tabnine's GitLab integration makes it easy and secure to give your AI assistant access to your GitLab repositories. You assign the repositories you want your AI assistant to learn from, and you control the permissions.

@@ -211,12 +230,8 @@ Deep Tabnine is based on GPT-2, which uses the **_Transformers Network Architect
- **Q: Can I install Tabnine on multiple machines?** -- A: You can use your Tabnine license on as many computers and operating systems as you like. All Tabnine licenses are per-user, rather than per-machine. -
-
- -- **Q: Is there a Tabnine Student program?** -- A: Yes, If you’re a student, you can register for Tabnine Pro for FREE using your school email address. [Get Tabnine Student now](https://www.tabnine.com/students?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace) +- A: You can use your Tabnine license on as many computers and operating systems as you like. +All Tabnine licenses are per-seat, rather than per-machine.

@@ -230,13 +245,8 @@ Deep Tabnine is based on GPT-2, which uses the **_Transformers Network Architect

-- **Q: Do both the Tabnine AI algorithms work together?** -- A: Yes, the two algorithms work in tandem, simultaneously providing next-level AI accuracy. Tabnine’s Public Code algorithm bases its suggestions on trusted public code with permissive licenses while the Team Learning Algorithm adapts to you and your team’s preferences, code selections, and ongoing AI interactions. -
-
- - **Q: Can I run Tabnine locally, or do I need to use the Cloud?** -- A: You can run Tabnine locally or on the cloud, you choose! Regardless, your code is never shared or used as part of Tabnine’s Public Code Trained AI - That’s the Tabnine Privacy Promise. +- A: You can run Tabnine locally or on the cloud, you choose! Regardless, your code is never shared.

@@ -247,7 +257,8 @@ See the full list of IDEs and languages [HERE](https://www.tabnine.com/install?u
- **Q: How many languages does Tabnine support?** -- A: Tabnine supports dozens of languages with more being added all the time. See the full list of IDEs and languages [HERE](https://www.tabnine.com/install?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace). +- A: Tabnine supports dozens of languages with more being added all the time. +See the full list of IDEs and languages [HERE](https://www.tabnine.com/install?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace).

@@ -257,16 +268,6 @@ See the full list of IDEs and languages [HERE](https://www.tabnine.com/install?u
- **Q: Can Tabnine be trained on my team’s existing codebase?** -- A: Yes - Tabnine Pro users have the option to train their private Tabnine AI algorithm on their existing codebase. This will provide an instant increase in the accuracy of you and your team’s code completions. +- A: Yes - Tabnine Team users have the option to train their private Tabnine Team Learning AI model on their existing codebase using Tabnine Connect. Tabnine Connect makes it easy and secure to give your Tabnine AI assistant access to your Github, GitLab, or Bitbucket repositories. You assign the repositories that you want it to learn from, and you control the permissions.
-
- -- **Q: What do you need to qualify for the Tabnine Student discount?** -- A: School can be tough so we’ve made getting the Tabnine Student Pass simple - all you need to register for your Free Tabnine Student Pro account is your school email address. -[Get Tabnine Student now](https://www.tabnine.com/students?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace) -
-
- -- **Q: How long does the Tabnine Student discount last?** -- A: Your FREE Tabnine Student Pro account is good for an entire year, and you can renew your Tabnine Student account every year for as long as you are in school. -[Get Tabnine Student now](https://www.tabnine.com/students?utm_source=ide_marketplace&utm_medium=organic&utm_campaign=vscode_marketplace) \ No newline at end of file +
\ No newline at end of file diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/logo-dark.svg b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/logo-dark.svg similarity index 100% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/logo-dark.svg rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/logo-dark.svg diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/logo-light.svg b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/logo-light.svg similarity index 100% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/logo-light.svg rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/logo-light.svg diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/logo.svg b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/logo.svg similarity index 100% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/logo.svg rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/logo.svg diff --git a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/out/extension.js b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/out/extension.js similarity index 53% rename from vscodium/extensions/tabnine.tabnine-vscode-3.5.42/out/extension.js rename to vscodium/extensions/tabnine.tabnine-vscode-3.5.45/out/extension.js index 632ef5f7..9dfdcc1a 100644 --- a/vscodium/extensions/tabnine.tabnine-vscode-3.5.42/out/extension.js +++ b/vscodium/extensions/tabnine.tabnine-vscode-3.5.45/out/extension.js @@ -1,4 +1,4 @@ -(()=>{var e={8054:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(8614),o=r(n(5158)),s=r(n(6304)),a=o.default("agent-base");function c(){const{stack:e}=new Error;return"string"==typeof e&&e.split("\n").some((e=>-1!==e.indexOf("(https.js:")||-1!==e.indexOf("node:https:")))}function l(e,t){return new l.Agent(e,t)}!function(e){class t extends i.EventEmitter{constructor(e,t){super();let n=t;"function"==typeof e?this.callback=e:e&&(n=e),this.timeout=null,n&&"number"==typeof n.timeout&&(this.timeout=n.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return"number"==typeof this.explicitDefaultPort?this.explicitDefaultPort:c()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){return"string"==typeof this.explicitProtocol?this.explicitProtocol:c()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,n){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const n=Object.assign({},t);"boolean"!=typeof n.secureEndpoint&&(n.secureEndpoint=c()),null==n.host&&(n.host="localhost"),null==n.port&&(n.port=n.secureEndpoint?443:80),null==n.protocol&&(n.protocol=n.secureEndpoint?"https:":"http:"),n.host&&n.path&&delete n.path,delete n.agent,delete n.hostname,delete n._defaultAgent,delete n.defaultPort,delete n.createConnection,e._last=!0,e.shouldKeepAlive=!1;let r=!1,i=null;const o=n.timeout||this.timeout,l=t=>{e._hadError||(e.emit("error",t),e._hadError=!0)},u=()=>{i=null,r=!0;const e=new Error(`A "socket" was not created for HTTP request before ${o}ms`);e.code="ETIMEOUT",l(e)},p=e=>{r||(null!==i&&(clearTimeout(i),i=null),l(e))},d=t=>{if(r)return;if(null!=i&&(clearTimeout(i),i=null),o=t,Boolean(o)&&"function"==typeof o.addRequest)return a("Callback returned another Agent instance %o",t.constructor.name),void t.addRequest(e,n);var o;if(t)return t.once("free",(()=>{this.freeSocket(t,n)})),void e.onSocket(t);const s=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);l(s)};if("function"==typeof this.callback){this.promisifiedCallback||(this.callback.length>=3?(a("Converting legacy callback function to promise"),this.promisifiedCallback=s.default(this.callback)):this.promisifiedCallback=this.callback),"number"==typeof o&&o>0&&(i=setTimeout(u,o)),"port"in n&&"number"!=typeof n.port&&(n.port=Number(n.port));try{a("Resolving socket for %o request: %o",n.protocol,`${e.method} ${e.path}`),Promise.resolve(this.promisifiedCallback(e,n)).then(d,p)}catch(e){Promise.reject(e).catch(p)}}else l(new Error("`callback` is not defined"))}freeSocket(e,t){a("Freeing socket %o %o",e.constructor.name,t),e.destroy()}destroy(){a("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype}(l||(l={})),e.exports=l},6304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){return new Promise(((r,i)=>{e.call(this,t,n,((e,t)=>{e?i(e):r(t)}))}))}}},6281:(e,t,n)=>{"use strict";var r=n(7396),i=function(){function e(t){if(e.INSTANCE)throw new Error("Console logging adapter tracking should be configured from the applicationInsights object");this._client=t,e.INSTANCE=this}return e.prototype.enable=function(e,t){r.IsInitialized&&(n(4309).wp(e&&t,this._client),n(5823).wp(e,this._client),n(454).wp(e,this._client))},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1,!1)},e._methodNames=["debug","info","log","warn","error"],e}();e.exports=i},894:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5282),i=n(7396),o=function(){function e(){}return e.getCurrentContext=function(){if(!e.enabled)return null;var t=e.session.get(e.CONTEXT_NAME);return void 0===t?null:t},e.generateContextObject=function(e,t,n,r,i,o){return t=t||e,this.enabled?{operation:{name:n,id:e,parentId:t,traceparent:i,tracestate:o},customProperties:new s(r)}:null},e.runWithContext=function(t,n){return e.enabled?e.session.bind(n,((r={})[e.CONTEXT_NAME]=t,r))():n();var r},e.wrapEmitter=function(t){e.enabled&&e.session.bindEmitter(t)},e.wrapCallback=function(t){return e.enabled?e.session.bind(t):t},e.enable=function(t){this.enabled||(this.isNodeVersionCompatible()?(e.hasEverEnabled||(this.forceClsHooked=t,this.hasEverEnabled=!0,void 0===this.cls&&(!0===e.forceClsHooked||void 0===e.forceClsHooked&&e.shouldUseClsHooked()?this.cls=n(9562):this.cls=n(3057)),e.session=this.cls.createNamespace("AI-CLS-Session"),i.registerContextPreservation((function(t){return e.session.bind(t)}))),this.enabled=!0):this.enabled=!1)},e.disable=function(){this.enabled=!1},e.reset=function(){e.hasEverEnabled&&(e.session=null,e.session=this.cls.createNamespace("AI-CLS-Session"))},e.isNodeVersionCompatible=function(){var e=process.versions.node.split(".");return parseInt(e[0])>3||parseInt(e[0])>2&&parseInt(e[1])>2},e.shouldUseClsHooked=function(){var e=process.versions.node.split(".");return parseInt(e[0])>8||parseInt(e[0])>=8&&parseInt(e[1])>=2},e.canUseClsHooked=function(){var e=process.versions.node.split("."),t=parseInt(e[0])>8||parseInt(e[0])>=8&&parseInt(e[1])>=0,n=parseInt(e[0])<8||parseInt(e[0])<=8&&parseInt(e[1])<2,r=parseInt(e[0])>4||parseInt(e[0])>=4&&parseInt(e[1])>=7;return!(t&&n)&&r},e.enabled=!1,e.hasEverEnabled=!1,e.forceClsHooked=void 0,e.CONTEXT_NAME="ApplicationInsights-Context",e}();t.CorrelationContextManager=o;var s=function(){function e(e){this.props=[],this.addHeaderData(e)}return e.prototype.addHeaderData=function(e){var t=e?e.split(", "):[];this.props=t.map((function(e){var t=e.split("=");return{key:t[0],value:t[1]}})).concat(this.props)},e.prototype.serializeToHeader=function(){return this.props.map((function(e){return e.key+"="+e.value})).join(", ")},e.prototype.getProperty=function(e){for(var t=0;t0)for(var a=0,c=o;a{"use strict";var r=n(2087),i=n(3580),o=function(){function e(t,n,r){void 0===n&&(n=6e4),void 0===r&&(r=!1),this._lastIntervalRequestExecutionTime=0,this._lastIntervalDependencyExecutionTime=0,e.INSTANCE||(e.INSTANCE=this),this._isInitialized=!1,this._client=t,this._collectionInterval=n,this._enableLiveMetricsCounters=r}return e.prototype.enable=function(t,n){var i=this;this._isEnabled=t,this._isEnabled&&!this._isInitialized&&(this._isInitialized=!0),t?this._handle||(this._lastCpus=r.cpus(),this._lastRequests={totalRequestCount:e._totalRequestCount,totalFailedRequestCount:e._totalFailedRequestCount,time:+new Date},this._lastDependencies={totalDependencyCount:e._totalDependencyCount,totalFailedDependencyCount:e._totalFailedDependencyCount,time:+new Date},this._lastExceptions={totalExceptionCount:e._totalExceptionCount,time:+new Date},"function"==typeof process.cpuUsage&&(this._lastAppCpuUsage=process.cpuUsage()),this._lastHrtime=process.hrtime(),this._collectionInterval=n||this._collectionInterval,this._handle=setInterval((function(){return i.trackPerformance()}),this._collectionInterval),this._handle.unref()):this._handle&&(clearInterval(this._handle),this._handle=void 0)},e.countRequest=function(t,n){var r;if(e.isEnabled()){if("string"==typeof t)r=+new Date("1970-01-01T"+t+"Z");else{if("number"!=typeof t)return;r=t}e._intervalRequestExecutionTime+=r,!1===n&&e._totalFailedRequestCount++,e._totalRequestCount++}},e.countException=function(){e._totalExceptionCount++},e.countDependency=function(t,n){var r;if(e.isEnabled()){if("string"==typeof t)r=+new Date("1970-01-01T"+t+"Z");else{if("number"!=typeof t)return;r=t}e._intervalDependencyExecutionTime+=r,!1===n&&e._totalFailedDependencyCount++,e._totalDependencyCount++}},e.prototype.isInitialized=function(){return this._isInitialized},e.isEnabled=function(){return e.INSTANCE&&e.INSTANCE._isEnabled},e.prototype.trackPerformance=function(){this._trackCpu(),this._trackMemory(),this._trackNetwork(),this._trackDependencyRate(),this._trackExceptionRate()},e.prototype._trackCpu=function(){var e=r.cpus();if(e&&e.length&&this._lastCpus&&e.length===this._lastCpus.length){for(var t=0,n=0,o=0,s=0,a=0,c=0;e&&c0){var l=r/a,u=o/a;this._client.trackMetric({name:i.PerformanceCounter.REQUEST_RATE,value:l}),(!this._enableLiveMetricsCounters||r>0)&&this._client.trackMetric({name:i.PerformanceCounter.REQUEST_DURATION,value:c}),this._enableLiveMetricsCounters&&this._client.trackMetric({name:i.QuickPulseCounter.REQUEST_FAILURE_RATE,value:u})}this._lastRequests=n},e.prototype._trackDependencyRate=function(){if(this._enableLiveMetricsCounters){var t=this._lastDependencies,n={totalDependencyCount:e._totalDependencyCount,totalFailedDependencyCount:e._totalFailedDependencyCount,time:+new Date},r=n.totalDependencyCount-t.totalDependencyCount||0,o=n.totalFailedDependencyCount-t.totalFailedDependencyCount||0,s=n.time-t.time,a=s/1e3,c=(e._intervalDependencyExecutionTime-this._lastIntervalDependencyExecutionTime)/r||0;if(this._lastIntervalDependencyExecutionTime=e._intervalDependencyExecutionTime,s>0){var l=r/a,u=o/a;this._client.trackMetric({name:i.QuickPulseCounter.DEPENDENCY_RATE,value:l}),this._client.trackMetric({name:i.QuickPulseCounter.DEPENDENCY_FAILURE_RATE,value:u}),(!this._enableLiveMetricsCounters||r>0)&&this._client.trackMetric({name:i.QuickPulseCounter.DEPENDENCY_DURATION,value:c})}this._lastDependencies=n}},e.prototype._trackExceptionRate=function(){if(this._enableLiveMetricsCounters){var t=this._lastExceptions,n={totalExceptionCount:e._totalExceptionCount,time:+new Date},r=n.totalExceptionCount-t.totalExceptionCount||0,o=n.time-t.time;if(o>0){var s=r/(o/1e3);this._client.trackMetric({name:i.QuickPulseCounter.EXCEPTION_RATE,value:s})}this._lastExceptions=n}},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1),this._isInitialized=!1},e._totalRequestCount=0,e._totalFailedRequestCount=0,e._lastRequestExecutionTime=0,e._totalDependencyCount=0,e._totalFailedDependencyCount=0,e._lastDependencyExecutionTime=0,e._totalExceptionCount=0,e._intervalDependencyExecutionTime=0,e._intervalRequestExecutionTime=0,e}();e.exports=o},3054:e=>{"use strict";var t=function(){function e(){}return e.prototype.getUrl=function(){return this.url},e.prototype.RequestParser=function(){this.startTime=+new Date},e.prototype._setStatus=function(e,t){var n=+new Date;this.duration=n-this.startTime,this.statusCode=e;var r=this.properties||{};if(t)if("string"==typeof t)r.error=t;else if(t instanceof Error)r.error=t.message;else if("object"==typeof t)for(var i in t)r[i]=t[i]&&t[i].toString&&t[i].toString();this.properties=r},e.prototype._isSuccess=function(){return 0{"use strict";var r=n(5290),i=n(4953),o=[],s={10:r.SeverityLevel.Verbose,20:r.SeverityLevel.Verbose,30:r.SeverityLevel.Information,40:r.SeverityLevel.Warning,50:r.SeverityLevel.Error,60:r.SeverityLevel.Critical},a=function(e){var t=e.data.result;o.forEach((function(n){var r=s[e.data.level];t instanceof Error?n.trackException({exception:t}):n.trackTrace({message:t,severity:r})}))};t.wp=function(e,t){e?(0===o.length&&i.channel.subscribe("bunyan",a),o.push(t)):0===(o=o.filter((function(e){return e!=t}))).length&&i.channel.unsubscribe("bunyan",a)}},4309:(e,t,n)=>{"use strict";var r=n(5290),i=n(4953),o=[],s=function(e){var t=e.data.message;o.forEach((function(n){t instanceof Error?n.trackException({exception:t}):(t.lastIndexOf("\n")==t.length-1&&(t=t.substring(0,t.length-1)),n.trackTrace({message:t,severity:e.data.stderr?r.SeverityLevel.Warning:r.SeverityLevel.Information}))}))};t.wp=function(e,t){e?(0===o.length&&i.channel.subscribe("console",s),o.push(t)):0===(o=o.filter((function(e){return e!=t}))).length&&i.channel.unsubscribe("console",s)}},7396:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5282);t.IsInitialized=!process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL;var i="DiagnosticChannel";if(t.IsInitialized){var o=n(4106),s=(process.env.APPLICATION_INSIGHTS_NO_PATCH_MODULES||"").split(","),a={bunyan:o.bunyan,console:o.console,mongodb:o.mongodb,mongodbCore:o.mongodbCore,mysql:o.mysql,redis:o.redis,pg:o.pg,pgPool:o.pgPool,winston:o.winston};for(var c in a)-1===s.indexOf(c)&&(a[c].enable(),r.info(i,"Subscribed to "+c+" events"));s.length>0&&r.info(i,"Some modules will not be patched",s)}else r.info(i,"Not subscribing to dependency autocollection because APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL was set");t.registerContextPreservation=function(e){t.IsInitialized&&n(4953).channel.addContextPreservation(e)}},7886:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){e.data.event.commandName,i.forEach((function(t){var n=e.data.startedData&&e.data.startedData.databaseName||"Unknown database";t.trackDependency({target:n,data:e.data.event.commandName,name:e.data.event.commandName,duration:e.data.event.duration,success:e.data.succeeded,resultCode:e.data.succeeded?"0":"1",dependencyTypeName:"mongodb"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("mongodb",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("mongodb",t.qP)}},4777:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){i.forEach((function(t){var n=e.data.query||{},r=n.sql||"Unknown query",i=!e.data.err,o=(n._connection||{}).config||{},s=o.socketPath?o.socketPath:(o.host||"localhost")+":"+o.port;t.trackDependency({target:s,data:r,name:r,duration:e.data.duration,success:i,resultCode:i?"0":"1",dependencyTypeName:"mysql"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("mysql",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("mysql",t.qP)}},9843:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){i.forEach((function(t){var n=e.data.query,r=n.preparable&&n.preparable.text||n.plan||n.text||"unknown query",i=!e.data.error,o=e.data.database.host+":"+e.data.database.port;t.trackDependency({target:o,data:r,name:r,duration:e.data.duration,success:i,resultCode:i?"0":"1",dependencyTypeName:"postgres"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("postgres",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("postgres",t.qP)}},5071:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){i.forEach((function(t){"info"!==e.data.commandObj.command&&t.trackDependency({target:e.data.address,name:e.data.commandObj.command,data:e.data.commandObj.command,duration:e.data.duration,success:!e.data.err,resultCode:e.data.err?"1":"0",dependencyTypeName:"redis"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("redis",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("redis",t.qP)}},454:(e,t,n)=>{"use strict";var r=n(5290),i=n(4953),o=[],s={syslog:function(e){var t={emerg:r.SeverityLevel.Critical,alert:r.SeverityLevel.Critical,crit:r.SeverityLevel.Critical,error:r.SeverityLevel.Error,warning:r.SeverityLevel.Warning,notice:r.SeverityLevel.Information,info:r.SeverityLevel.Information,debug:r.SeverityLevel.Verbose};return void 0===t[e]?r.SeverityLevel.Information:t[e]},npm:function(e){var t={error:r.SeverityLevel.Error,warn:r.SeverityLevel.Warning,info:r.SeverityLevel.Information,verbose:r.SeverityLevel.Verbose,debug:r.SeverityLevel.Verbose,silly:r.SeverityLevel.Verbose};return void 0===t[e]?r.SeverityLevel.Information:t[e]},unknown:function(e){return r.SeverityLevel.Information}},a=function(e){var t=e.data.message;o.forEach((function(n){if(t instanceof Error)n.trackException({exception:t,properties:e.data.meta});else{var r=s[e.data.levelKind](e.data.level);n.trackTrace({message:t,severity:r,properties:e.data.meta})}}))};t.wp=function(e,t){e?(0===o.length&&i.channel.subscribe("winston",a),o.push(t)):0===(o=o.filter((function(e){return e!=t}))).length&&i.channel.unsubscribe("winston",a)}},3580:(e,t)=>{"use strict";var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_BREEZE_ENDPOINT="https://dc.services.visualstudio.com",t.DEFAULT_LIVEMETRICS_ENDPOINT="https://rt.services.visualstudio.com",t.DEFAULT_LIVEMETRICS_HOST="rt.services.visualstudio.com",function(e){e.COMMITTED_BYTES="\\Memory\\Committed Bytes",e.PROCESSOR_TIME="\\Processor(_Total)\\% Processor Time",e.REQUEST_RATE="\\ApplicationInsights\\Requests/Sec",e.REQUEST_FAILURE_RATE="\\ApplicationInsights\\Requests Failed/Sec",e.REQUEST_DURATION="\\ApplicationInsights\\Request Duration",e.DEPENDENCY_RATE="\\ApplicationInsights\\Dependency Calls/Sec",e.DEPENDENCY_FAILURE_RATE="\\ApplicationInsights\\Dependency Calls Failed/Sec",e.DEPENDENCY_DURATION="\\ApplicationInsights\\Dependency Call Duration",e.EXCEPTION_RATE="\\ApplicationInsights\\Exceptions/Sec"}(n=t.QuickPulseCounter||(t.QuickPulseCounter={})),function(e){e.PRIVATE_BYTES="\\Process(??APP_WIN32_PROC??)\\Private Bytes",e.AVAILABLE_BYTES="\\Memory\\Available Bytes",e.PROCESSOR_TIME="\\Processor(_Total)\\% Processor Time",e.PROCESS_TIME="\\Process(??APP_WIN32_PROC??)\\% Processor Time",e.REQUEST_RATE="\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Requests/Sec",e.REQUEST_DURATION="\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Request Execution Time"}(r=t.PerformanceCounter||(t.PerformanceCounter={})),t.PerformanceToQuickPulseCounter=((i={})[r.PROCESSOR_TIME]=n.PROCESSOR_TIME,i[r.REQUEST_RATE]=n.REQUEST_RATE,i[r.REQUEST_DURATION]=n.REQUEST_DURATION,i[n.COMMITTED_BYTES]=n.COMMITTED_BYTES,i[n.REQUEST_FAILURE_RATE]=n.REQUEST_FAILURE_RATE,i[n.DEPENDENCY_RATE]=n.DEPENDENCY_RATE,i[n.DEPENDENCY_FAILURE_RATE]=n.DEPENDENCY_FAILURE_RATE,i[n.DEPENDENCY_DURATION]=n.DEPENDENCY_DURATION,i[n.EXCEPTION_RATE]=n.EXCEPTION_RATE,i),t.QuickPulseDocumentType={Event:"Event",Exception:"Exception",Trace:"Trace",Metric:"Metric",Request:"Request",Dependency:"RemoteDependency",Availability:"Availability"},t.QuickPulseType={Event:"EventTelemetryDocument",Exception:"ExceptionTelemetryDocument",Trace:"TraceTelemetryDocument",Metric:"MetricTelemetryDocument",Request:"RequestTelemetryDocument",Dependency:"DependencyTelemetryDocument",Availability:"AvailabilityTelemetryDocument"},t.TelemetryTypeStringToQuickPulseType={EventData:t.QuickPulseType.Event,ExceptionData:t.QuickPulseType.Exception,MessageData:t.QuickPulseType.Trace,MetricData:t.QuickPulseType.Metric,RequestData:t.QuickPulseType.Request,RemoteDependencyData:t.QuickPulseType.Dependency,AvailabilityData:t.QuickPulseType.Availability},t.TelemetryTypeStringToQuickPulseDocumentType={EventData:t.QuickPulseDocumentType.Event,ExceptionData:t.QuickPulseDocumentType.Exception,MessageData:t.QuickPulseDocumentType.Trace,MetricData:t.QuickPulseDocumentType.Metric,RequestData:t.QuickPulseDocumentType.Request,RemoteDependencyData:t.QuickPulseDocumentType.Dependency,AvailabilityData:t.QuickPulseDocumentType.Availability}},9382:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9958),i=function(){function e(){}return e.TYPE_HTTP="Http",e.TYPE_AI="Http (tracked component)",e}();t.RemoteDependencyDataConstants=i,t.domainSupportsProperties=function(e){return"properties"in e||e instanceof r.EventData||e instanceof r.ExceptionData||e instanceof r.MessageData||e instanceof r.MetricData||e instanceof r.PageViewData||e instanceof r.RemoteDependencyData||e instanceof r.RequestData}},7220:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},4101:e=>{"use strict";var t=function(){};e.exports=t},9871:e=>{"use strict";var t=function(){this.applicationVersion="ai.application.ver",this.deviceId="ai.device.id",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceOEMName="ai.device.oemName",this.deviceOSVersion="ai.device.osVersion",this.deviceType="ai.device.type",this.locationIp="ai.location.ip",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.userAccountId="ai.user.accountId",this.userId="ai.user.id",this.userAuthUserId="ai.user.authUserId",this.cloudRole="ai.cloud.role",this.cloudRoleInstance="ai.cloud.roleInstance",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion",this.internalNodeName="ai.internal.nodeName"};e.exports=t},320:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){return e.call(this)||this}return i(t,e),t}(n(4101));e.exports=o},8602:(e,t,n)=>{"use strict";var r=n(495),i=function(){this.kind=r.Measurement};e.exports=i},495:e=>{"use strict";var t;!function(e){e[e.Measurement=0]="Measurement",e[e.Aggregation=1]="Aggregation"}(t||(t={})),e.exports=t},8934:e=>{"use strict";var t=function(){};e.exports=t},7300:e=>{"use strict";var t=function(){this.ver=1,this.sampleRate=100,this.tags={}};e.exports=t},4526:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},935:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.exceptions=[],t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},8082:e=>{"use strict";var t=function(){this.hasFullStack=!0,this.parsedStack=[]};e.exports=t},901:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t}return i(t,e),t}(n(8934));e.exports=o},3092:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.metrics=[],t.properties={},t}return i(t,e),t}(n(8934));e.exports=o},6279:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(4526));e.exports=o},6290:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.success=!0,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},7339:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},9697:e=>{"use strict";var t;!function(e){e[e.Verbose=0]="Verbose",e[e.Information=1]="Information",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Critical=4]="Critical"}(t||(t={})),e.exports=t},6781:e=>{"use strict";var t=function(){};e.exports=t},9958:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AvailabilityData=n(7220),t.Base=n(4101),t.ContextTagKeys=n(9871),t.Data=n(320),t.DataPoint=n(8602),t.DataPointType=n(495),t.Domain=n(8934),t.Envelope=n(7300),t.EventData=n(4526),t.ExceptionData=n(935),t.ExceptionDetails=n(8082),t.MessageData=n(901),t.MetricData=n(3092),t.PageViewData=n(6279),t.RemoteDependencyData=n(6290),t.RequestData=n(7339),t.SeverityLevel=n(9697),t.StackFrame=n(6781)},5481:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.telemetryTypeToBaseType=function(e){switch(e){case n.Event:return"EventData";case n.Exception:return"ExceptionData";case n.Trace:return"MessageData";case n.Metric:return"MetricData";case n.Request:return"RequestData";case n.Dependency:return"RemoteDependencyData";case n.Availability:return"AvailabilityData"}},t.baseTypeToTelemetryType=function(e){switch(e){case"EventData":return n.Event;case"ExceptionData":return n.Exception;case"MessageData":return n.Trace;case"MetricData":return n.Metric;case"RequestData":return n.Request;case"RemoteDependencyData":return n.Dependency;case"AvailabilityData":return n.Availability}},t.TelemetryTypeString={Event:"EventData",Exception:"ExceptionData",Trace:"MessageData",Metric:"MetricData",Request:"RequestData",Dependency:"RemoteDependencyData",Availability:"AvailabilityData"},function(e){e[e.Event=0]="Event",e[e.Exception=1]="Exception",e[e.Trace=2]="Trace",e[e.Metric=3]="Metric",e[e.Request=4]="Request",e[e.Dependency=5]="Dependency",e[e.Availability=6]="Availability"}(n=t.TelemetryType||(t.TelemetryType={}))},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(5481))},5290:(e,t,n)=>{"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(9382)),r(n(9958)),r(n(2626))},3504:(e,t,n)=>{"use strict";var r=n(5282),i=function(){function e(e,t,n,r){this._buffer=[],this._lastSend=0,this._isDisabled=e,this._getBatchSize=t,this._getBatchIntervalMs=n,this._sender=r}return e.prototype.setUseDiskRetryCaching=function(e,t,n){this._sender.setDiskRetryMode(e,t,n)},e.prototype.send=function(e){var t=this;if(!this._isDisabled())if(e){var n=this._stringify(e);"string"==typeof n&&(this._buffer.push(n),this._buffer.length>=this._getBatchSize()?this.triggerSend(!1):!this._timeoutHandle&&this._buffer.length>0&&(this._timeoutHandle=setTimeout((function(){t._timeoutHandle=null,t.triggerSend(!1)}),this._getBatchIntervalMs())))}else r.warn("Cannot send null/undefined telemetry")},e.prototype.triggerSend=function(e,t){var n=this._buffer.length<1;if(!n){var r=this._buffer.join("\n");e?(this._sender.saveOnCrash(r),"function"==typeof t&&t("data saved on crash")):this._sender.send(Buffer.from?Buffer.from(r):new Buffer(r),t)}this._lastSend=+new Date,this._buffer.length=0,clearTimeout(this._timeoutHandle),this._timeoutHandle=null,n&&"function"==typeof t&&t("no data to send")},e.prototype._stringify=function(e){try{return JSON.stringify(e)}catch(t){r.warn("Failed to serialize payload",t,e)}},e}();e.exports=i},9253:(e,t,n)=>{"use strict";var r=n(9962),i=n(640),o=n(3580),s=n(8835),a=function(){function e(t){var n=this;this.endpointBase=o.DEFAULT_BREEZE_ENDPOINT;var r=process.env[e.ENV_connectionString],a=i.parse(t),c=i.parse(r),l=!a.instrumentationkey&&Object.keys(a).length>0?null:t;this.instrumentationKey=a.instrumentationkey||l||c.instrumentationkey||e._getInstrumentationKey(),this.endpointUrl=(a.ingestionendpoint||c.ingestionendpoint||this.endpointBase)+"/v2/track",this.maxBatchSize=250,this.maxBatchIntervalMs=15e3,this.disableAppInsights=!1,this.samplingPercentage=100,this.correlationIdRetryIntervalMs=3e4,this.correlationHeaderExcludedDomains=["*.core.windows.net","*.core.chinacloudapi.cn","*.core.cloudapi.de","*.core.usgovcloudapi.net","*.core.microsoft.scloud","*.core.eaglex.ic.gov"],this.setCorrelationId=function(e){return n.correlationId=e},this.proxyHttpUrl=process.env[e.ENV_http_proxy]||void 0,this.proxyHttpsUrl=process.env[e.ENV_https_proxy]||void 0,this.httpAgent=void 0,this.httpsAgent=void 0,this.profileQueryEndpoint=a.ingestionendpoint||c.ingestionendpoint||process.env[e.ENV_profileQueryEndpoint]||this.endpointBase,this._quickPulseHost=a.liveendpoint||c.liveendpoint||process.env[e.ENV_quickPulseHost]||o.DEFAULT_LIVEMETRICS_HOST,this._quickPulseHost.match(/^https?:\/\//)&&(this._quickPulseHost=s.parse(this._quickPulseHost).host)}return Object.defineProperty(e.prototype,"profileQueryEndpoint",{get:function(){return this._profileQueryEndpoint},set:function(e){r.cancelCorrelationIdQuery(this,this.setCorrelationId),this._profileQueryEndpoint=e,this.correlationId=r.correlationIdPrefix,r.queryCorrelationId(this,this.setCorrelationId)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"quickPulseHost",{get:function(){return this._quickPulseHost},set:function(e){this._quickPulseHost=e},enumerable:!0,configurable:!0}),e._getInstrumentationKey=function(){var t=process.env[e.ENV_iKey]||process.env[e.ENV_azurePrefix+e.ENV_iKey]||process.env[e.legacy_ENV_iKey]||process.env[e.ENV_azurePrefix+e.legacy_ENV_iKey];if(!t||""==t)throw new Error("Instrumentation key not found, pass the key in the config to this method or set the key in the environment variable APPINSIGHTS_INSTRUMENTATIONKEY before starting the server");return t},e.ENV_azurePrefix="APPSETTING_",e.ENV_iKey="APPINSIGHTS_INSTRUMENTATIONKEY",e.legacy_ENV_iKey="APPINSIGHTS_INSTRUMENTATION_KEY",e.ENV_profileQueryEndpoint="APPINSIGHTS_PROFILE_QUERY_ENDPOINT",e.ENV_quickPulseHost="APPINSIGHTS_QUICKPULSE_HOST",e.ENV_connectionString="APPLICATIONINSIGHTS_CONNECTION_STRING",e.ENV_nativeMetricsDisablers="APPLICATION_INSIGHTS_DISABLE_EXTENDED_METRIC",e.ENV_nativeMetricsDisableAll="APPLICATION_INSIGHTS_DISABLE_ALL_EXTENDED_METRICS",e.ENV_http_proxy="http_proxy",e.ENV_https_proxy="https_proxy",e}();e.exports=a},640:(e,t,n)=>{"use strict";var r=n(3580),i=function(){function e(){}return e.parse=function(t){if(!t)return{};var n=t.split(e._FIELDS_SEPARATOR).reduce((function(t,n){var r=n.split(e._FIELD_KEY_VALUE_SEPARATOR);if(2===r.length){var i=r[0].toLowerCase(),o=r[1];t[i]=o}return t}),{});if(Object.keys(n).length>0){if(n.endpointsuffix){var i=n.location?n.location+".":"";n.ingestionendpoint=n.ingestionendpoint||"https://"+i+"dc."+n.endpointsuffix,n.liveendpoint=n.liveendpoint||"https://"+i+"live."+n.endpointsuffix}n.ingestionendpoint=n.ingestionendpoint||r.DEFAULT_BREEZE_ENDPOINT,n.liveendpoint=n.liveendpoint||r.DEFAULT_LIVEMETRICS_ENDPOINT}return n},e._FIELDS_SEPARATOR=";",e._FIELD_KEY_VALUE_SEPARATOR="=",e}();e.exports=i},4470:(e,t,n)=>{"use strict";var r=n(2087),i=n(5747),o=n(5622),s=n(5290),a=n(5282),c=function(){function e(e){this.keys=new s.ContextTagKeys,this.tags={},this._loadApplicationContext(),this._loadDeviceContext(),this._loadInternalContext()}return e.prototype._loadApplicationContext=function(t){if(t=t||o.resolve(__dirname,"../../../../package.json"),!e.appVersion[t]){e.appVersion[t]="unknown";try{var n=JSON.parse(i.readFileSync(t,"utf8"));n&&"string"==typeof n.version&&(e.appVersion[t]=n.version)}catch(e){a.info("unable to read app version: ",e)}}this.tags[this.keys.applicationVersion]=e.appVersion[t]},e.prototype._loadDeviceContext=function(){this.tags[this.keys.deviceId]="",this.tags[this.keys.cloudRoleInstance]=r&&r.hostname(),this.tags[this.keys.deviceOSVersion]=r&&r.type()+" "+r.release(),this.tags[this.keys.cloudRole]=e.DefaultRoleName,this.tags["ai.device.osArchitecture"]=r&&r.arch(),this.tags["ai.device.osPlatform"]=r&&r.platform()},e.prototype._loadInternalContext=function(){var t=o.resolve(__dirname,"../../package.json");if(!e.sdkVersion){e.sdkVersion="unknown";try{var n=JSON.parse(i.readFileSync(t,"utf8"));n&&"string"==typeof n.version&&(e.sdkVersion=n.version)}catch(e){a.info("unable to read app version: ",e)}}this.tags[this.keys.internalSdkVersion]="node:"+e.sdkVersion},e.DefaultRoleName="Web",e.appVersion={},e.sdkVersion=null,e}();e.exports=c},9962:(e,t,n)=>{"use strict";var r=n(5740),i=n(5282),o=function(){function e(){}return e.queryCorrelationId=function(t,n){var o=t.profileQueryEndpoint+"/api/profiles/"+t.instrumentationKey+"/appId";if(e.completedLookups.hasOwnProperty(o))n(e.completedLookups[o]);else if(e.pendingLookups[o])e.pendingLookups[o].push(n);else{e.pendingLookups[o]=[n];var s=function(){if(e.pendingLookups[o]){var n={method:"GET",disableAppInsightsAutoCollection:!0};i.info(e.TAG,n);var a=r.makeRequest(t,o,n,(function(n){if(200===n.statusCode){var r="";n.setEncoding("utf-8"),n.on("data",(function(e){r+=e})),n.on("end",(function(){i.info(e.TAG,r);var t=e.correlationIdPrefix+r;e.completedLookups[o]=t,e.pendingLookups[o]&&e.pendingLookups[o].forEach((function(e){return e(t)})),delete e.pendingLookups[o]}))}else n.statusCode>=400&&n.statusCode<500?(e.completedLookups[o]=void 0,delete e.pendingLookups[o]):setTimeout(s,t.correlationIdRetryIntervalMs)}));a&&(a.on("error",(function(t){i.warn(e.TAG,t)})),a.end())}};setTimeout(s,0)}},e.cancelCorrelationIdQuery=function(t,n){var r=t.profileQueryEndpoint+"/api/profiles/"+t.instrumentationKey+"/appId",i=e.pendingLookups[r];i&&(e.pendingLookups[r]=i.filter((function(e){return e!=n})),0==e.pendingLookups[r].length&&delete e.pendingLookups[r])},e.generateRequestId=function(t){if(t){"."!==(t="|"==t[0]?t:"|"+t)[t.length-1]&&(t+=".");var n=(e.currentRootId++).toString(16);return e.appendSuffix(t,n,"_")}return e.generateRootId()},e.getRootId=function(e){var t=e.indexOf(".");t<0&&(t=e.length);var n="|"===e[0]?1:0;return e.substring(n,t)},e.generateRootId=function(){return"|"+r.w3cTraceId()+"."},e.appendSuffix=function(t,n,i){if(t.length+n.lengtho)for(;o>1;--o){var s=t[o-1];if("."===s||"_"===s)break}if(o<=1)return e.generateRootId();for(n=r.randomu32().toString(16);n.length<8;)n="0"+n;return t.substring(0,o)+n+"#"},e.TAG="CorrelationIdManager",e.correlationIdPrefix="cid-v1:",e.w3cEnabled=!1,e.pendingLookups={},e.completedLookups={},e.requestIdMaxLength=1024,e.currentRootId=r.randomu32(),e}();e.exports=o},9813:(e,t,n)=>{"use strict";var r=n(5290),i=n(5740),o=n(894),s=function(){function e(){}return e.createEnvelope=function(t,n,o,s,a){var c=null;switch(n){case r.TelemetryType.Trace:c=e.createTraceData(t);break;case r.TelemetryType.Dependency:c=e.createDependencyData(t);break;case r.TelemetryType.Event:c=e.createEventData(t);break;case r.TelemetryType.Exception:c=e.createExceptionData(t);break;case r.TelemetryType.Request:c=e.createRequestData(t);break;case r.TelemetryType.Metric:c=e.createMetricData(t);break;case r.TelemetryType.Availability:c=e.createAvailabilityData(t)}if(o&&r.domainSupportsProperties(c.baseData)){if(c&&c.baseData)if(c.baseData.properties)for(var l in o)c.baseData.properties[l]||(c.baseData.properties[l]=o[l]);else c.baseData.properties=o;c.baseData.properties=i.validateStringMap(c.baseData.properties)}var u=a&&a.instrumentationKey||"",p=new r.Envelope;return p.data=c,p.iKey=u,p.name="Microsoft.ApplicationInsights."+u.replace(/-/g,"")+"."+c.baseType.substr(0,c.baseType.length-4),p.tags=this.getTags(s,t.tagOverrides),p.time=(new Date).toISOString(),p.ver=1,p.sampleRate=a?a.samplingPercentage:100,n===r.TelemetryType.Metric&&(p.sampleRate=100),p},e.createTraceData=function(e){var t=new r.MessageData;t.message=e.message,t.properties=e.properties,isNaN(e.severity)?t.severityLevel=r.SeverityLevel.Information:t.severityLevel=e.severity;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Trace),n.baseData=t,n},e.createDependencyData=function(e){var t=new r.RemoteDependencyData;"string"==typeof e.name&&(t.name=e.name.length>1024?e.name.slice(0,1021)+"...":e.name),t.data=e.data,t.target=e.target,t.duration=i.msToTimeSpan(e.duration),t.success=e.success,t.type=e.dependencyTypeName,t.properties=e.properties,t.resultCode=e.resultCode?e.resultCode+"":"",e.id?t.id=e.id:t.id=i.w3cTraceId();var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Dependency),n.baseData=t,n},e.createEventData=function(e){var t=new r.EventData;t.name=e.name,t.properties=e.properties,t.measurements=e.measurements;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Event),n.baseData=t,n},e.createExceptionData=function(e){var t=new r.ExceptionData;t.properties=e.properties,isNaN(e.severity)?t.severityLevel=r.SeverityLevel.Error:t.severityLevel=e.severity,t.measurements=e.measurements,t.exceptions=[];var n=e.exception.stack,o=new r.ExceptionDetails;o.message=e.exception.message,o.typeName=e.exception.name,o.parsedStack=this.parseStack(n),o.hasFullStack=i.isArray(o.parsedStack)&&o.parsedStack.length>0,t.exceptions.push(o);var s=new r.Data;return s.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Exception),s.baseData=t,s},e.createRequestData=function(e){var t=new r.RequestData;e.id?t.id=e.id:t.id=i.w3cTraceId(),t.name=e.name,t.url=e.url,t.source=e.source,t.duration=i.msToTimeSpan(e.duration),t.responseCode=e.resultCode?e.resultCode+"":"",t.success=e.success,t.properties=e.properties;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Request),n.baseData=t,n},e.createMetricData=function(e){var t=new r.MetricData;t.metrics=[];var n=new r.DataPoint;n.count=isNaN(e.count)?1:e.count,n.kind=r.DataPointType.Aggregation,n.max=isNaN(e.max)?e.value:e.max,n.min=isNaN(e.min)?e.value:e.min,n.name=e.name,n.stdDev=isNaN(e.stdDev)?0:e.stdDev,n.value=e.value,t.metrics.push(n),t.properties=e.properties;var i=new r.Data;return i.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Metric),i.baseData=t,i},e.createAvailabilityData=function(e){var t=new r.AvailabilityData;e.id?t.id=e.id:t.id=i.w3cTraceId(),t.name=e.name,t.duration=i.msToTimeSpan(e.duration),t.success=e.success,t.runLocation=e.runLocation,t.message=e.message,t.measurements=e.measurements,t.properties=e.properties;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Availability),n.baseData=t,n},e.getTags=function(e,t){var n=o.CorrelationContextManager.getCurrentContext(),r={};if(e&&e.tags)for(var i in e.tags)r[i]=e.tags[i];if(t)for(var i in t)r[i]=t[i];return n&&(r[e.keys.operationId]=r[e.keys.operationId]||n.operation.id,r[e.keys.operationName]=r[e.keys.operationName]||n.operation.name,r[e.keys.operationParentId]=r[e.keys.operationParentId]||n.operation.parentId),r},e.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,o=0;o<=n.length;o++){var s=n[o];if(a.regex.test(s)){var c=new a(n[o],r++);i+=c.sizeInBytes,t.push(c)}}if(i>32768)for(var l=0,u=t.length-1,p=0,d=l,f=u;l32768){var h=f-d+1;t.splice(d,h);break}d=l,f=u,l++,u--}}return t},e}(),a=function(){function e(t,n){this.sizeInBytes=0,this.level=n,this.method="",this.assembly=i.trim(t);var r=t.match(e.regex);r&&r.length>=5&&(this.method=i.trim(r[2])||this.method,this.fileName=i.trim(r[4])||"",this.line=parseInt(r[5])||0),this.sizeInBytes+=this.method.length,this.sizeInBytes+=this.fileName.length,this.sizeInBytes+=this.assembly.length,this.sizeInBytes+=e.baseSize,this.sizeInBytes+=this.level.toString().length,this.sizeInBytes+=this.line.toString().length}return e.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,e.baseSize=58,e}();e.exports=s},5282:e=>{"use strict";var t=function(){function e(){}return e.info=function(t){for(var n=[],r=1;r0?t:null,InstrumentationKey:n.instrumentationKey||"",Metrics:e.length>0?e:null,InvariantVersion:1,Timestamp:"/Date("+Date.now()+")/",Version:r.tags[r.keys.internalSdkVersion],StreamId:l,MachineName:o,Instance:s}},e.createQuickPulseMetric=function(e){return{Name:e.name,Value:e.value,Weight:e.count||1}},e.telemetryEnvelopeToQuickPulseDocument=function(t){switch(t.data.baseType){case o.TelemetryTypeString.Event:return e.createQuickPulseEventDocument(t);case o.TelemetryTypeString.Exception:return e.createQuickPulseExceptionDocument(t);case o.TelemetryTypeString.Trace:return e.createQuickPulseTraceDocument(t);case o.TelemetryTypeString.Dependency:return e.createQuickPulseDependencyDocument(t);case o.TelemetryTypeString.Request:return e.createQuickPulseRequestDocument(t)}return null},e.createQuickPulseEventDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData.name;return r({},n,{Name:i})},e.createQuickPulseTraceDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData.severityLevel||0;return r({},n,{Message:t.data.baseData.message,SeverityLevel:o.SeverityLevel[i]})},e.createQuickPulseExceptionDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData.exceptions,o="",s="",a="";return i&&i.length>0&&(i[0].parsedStack&&i[0].parsedStack.length>0?i[0].parsedStack.forEach((function(e){o+=e.assembly+"\n"})):i[0].stack&&i[0].stack.length>0&&(o=i[0].stack),s=i[0].message,a=i[0].typeName),r({},n,{Exception:o,ExceptionMessage:s,ExceptionType:a})},e.createQuickPulseRequestDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData;return r({},n,{Name:i.name,Success:i.success,Duration:i.duration,ResponseCode:i.responseCode,OperationName:i.name})},e.createQuickPulseDependencyDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData;return r({},n,{Name:i.name,Target:i.target,Success:i.success,Duration:i.duration,ResultCode:i.resultCode,CommandName:i.data,OperationName:n.OperationId,DependencyTypeName:i.type})},e.createQuickPulseDocument=function(t){var n,r;return t.data.baseType?(r=s.TelemetryTypeStringToQuickPulseType[t.data.baseType],n=s.TelemetryTypeStringToQuickPulseDocumentType[t.data.baseType]):c.warn("Document type invalid; not sending live metric document",t.data.baseType),{DocumentType:n,__type:r,OperationId:t.tags[e.keys.operationId],Version:"1.0",Properties:e.aggregateProperties(t)}},e.aggregateProperties=function(e){var t=[],n=e.data.baseData.measurements||{};for(var r in n)if(n.hasOwnProperty(r)){var i={key:r,value:n[r]};t.push(i)}var o=e.data.baseData.properties||{};for(var r in o)if(o.hasOwnProperty(r)){i={key:r,value:o[r]};t.push(i)}return t},e.keys=new o.ContextTagKeys,e}();e.exports=u},9184:(e,t,n)=>{"use strict";var r=n(7211),i=n(8723),o=n(5282),s="POST",a="x-ms-qps-transmission-time",c="x-ms-qps-subscribed",l=function(){function e(e){this._config=e,this._consecutiveErrors=0}return e.prototype.ping=function(e,t){this._submitData(e,t,"ping")},e.prototype.post=function(e,t){this._submitData([e],t,"post")},e.prototype._submitData=function(t,n,l){var u,p,d=this,f=JSON.stringify(t),h=((u={})[i.disableCollectionRequestOption]=!0,u.host=this._config.quickPulseHost,u.method=s,u.path="/QuickPulseService.svc/"+l+"?ikey="+this._config.instrumentationKey,u.headers=((p={Expect:"100-continue"})[a]=1e4*Date.now(),p["Content-Type"]="application/json",p["Content-Length"]=Buffer.byteLength(f),p),u),m=r.request(h,(function(e){var t="true"===e.headers[c];d._consecutiveErrors=0,n(t,e)}));m.on("error",(function(t){d._consecutiveErrors++;var r="Transient error connecting to the Live Metrics endpoint. This packet will not appear in your Live Metrics Stream. Error:";d._consecutiveErrors%e.MAX_QPS_FAILURES_BEFORE_WARN==0?(r="Live Metrics endpoint could not be reached "+d._consecutiveErrors+" consecutive times. Most recent error:",o.warn(e.TAG,r,t)):o.info(e.TAG,r,t),n()})),m.write(f),m.end()},e.TAG="QuickPulseSender",e.MAX_QPS_FAILURES_BEFORE_WARN=25,e}();e.exports=l},3668:(e,t,n)=>{"use strict";var r=n(5282),i=n(9253),o=n(7148),s=n(9184),a=n(3580),c=n(4470),l=function(){function e(e,t){this._isCollectingData=!1,this._lastSuccessTime=Date.now(),this._lastSendSucceeded=!0,this._metrics={},this._documents=[],this._collectors=[],this.config=new i(e),this.context=t||new c,this._sender=new s(this.config),this._isEnabled=!1}return e.prototype.addCollector=function(e){this._collectors.push(e)},e.prototype.trackMetric=function(e){this._addMetric(e)},e.prototype.addDocument=function(e){var t=o.telemetryEnvelopeToQuickPulseDocument(e);t&&this._documents.push(t)},e.prototype.enable=function(e){e&&!this._isEnabled?(this._isEnabled=!0,this._goQuickPulse()):!e&&this._isEnabled&&(this._isEnabled=!1,clearTimeout(this._handle),this._handle=void 0)},e.prototype.enableCollectors=function(e){this._collectors.forEach((function(t){t.enable(e)}))},e.prototype._addMetric=function(e){var t=e.value,n=e.count||1,r=a.PerformanceToQuickPulseCounter[e.name];r&&(this._metrics[r]?(this._metrics[r].Value=(this._metrics[r].Value*this._metrics[r].Weight+t*n)/(this._metrics[r].Weight+n),this._metrics[r].Weight+=n):(this._metrics[r]=o.createQuickPulseMetric(e),this._metrics[r].Name=r,this._metrics[r].Weight=1))},e.prototype._resetQuickPulseBuffer=function(){delete this._metrics,this._metrics={},this._documents.length=0},e.prototype._goQuickPulse=function(){var t=this,n=Object.keys(this._metrics).map((function(e){return t._metrics[e]})),r=o.createQuickPulseEnvelope(n,this._documents.slice(),this.config,this.context);this._resetQuickPulseBuffer(),this._isCollectingData?this._post(r):this._ping(r);var i=this._isCollectingData?e.POST_INTERVAL:e.PING_INTERVAL;this._isCollectingData&&Date.now()-this._lastSuccessTime>=e.MAX_POST_WAIT_TIME&&!this._lastSendSucceeded?(this._isCollectingData=!1,i=e.FALLBACK_INTERVAL):!this._isCollectingData&&Date.now()-this._lastSuccessTime>=e.MAX_PING_WAIT_TIME&&!this._lastSendSucceeded&&(i=e.FALLBACK_INTERVAL),this._lastSendSucceeded=null,this._handle=setTimeout(this._goQuickPulse.bind(this),i),this._handle.unref()},e.prototype._ping=function(e){this._sender.ping(e,this._quickPulseDone.bind(this))},e.prototype._post=function(e){this._sender.post(e,this._quickPulseDone.bind(this))},e.prototype._quickPulseDone=function(e,t){null!=e?(this._isCollectingData!==e&&(r.info("Live Metrics sending data",e),this.enableCollectors(e)),this._isCollectingData=e,t&&t.statusCode<300&&t.statusCode>=200?(this._lastSuccessTime=Date.now(),this._lastSendSucceeded=!0):this._lastSendSucceeded=!1):this._lastSendSucceeded=!1},e.MAX_POST_WAIT_TIME=2e4,e.MAX_PING_WAIT_TIME=6e4,e.FALLBACK_INTERVAL=6e4,e.PING_INTERVAL=5e3,e.POST_INTERVAL=1e3,e}();e.exports=l},9036:e=>{"use strict";e.exports={requestContextHeader:"request-context",requestContextSourceKey:"appId",requestContextTargetKey:"appId",requestIdHeader:"request-id",parentIdHeader:"x-ms-request-id",rootIdHeader:"x-ms-request-root-id",correlationContextHeader:"correlation-context",traceparentHeader:"traceparent",traceStateHeader:"tracestate"}},2588:(e,t,n)=>{"use strict";var r=n(5747),i=n(2087),o=n(5622),s=n(8761),a=n(3129),c=n(5282),l=n(8723),u=n(5740),p=function(){function e(t,n,i){if(this._config=t,this._onSuccess=n,this._onError=i,this._enableDiskRetryMode=!1,this._resendInterval=e.WAIT_BETWEEN_RESEND,this._maxBytesOnDisk=e.MAX_BYTES_ON_DISK,this._numConsecutiveFailures=0,!e.OS_PROVIDES_FILE_PROTECTION)if(e.USE_ICACLS){try{e.OS_PROVIDES_FILE_PROTECTION=r.existsSync(e.ICACLS_PATH)}catch(e){}e.OS_PROVIDES_FILE_PROTECTION||c.warn(e.TAG,"Could not find ICACLS in expected location! This is necessary to use disk retry mode on Windows.")}else e.OS_PROVIDES_FILE_PROTECTION=!0}return e.prototype.setDiskRetryMode=function(t,n,r){this._enableDiskRetryMode=e.OS_PROVIDES_FILE_PROTECTION&&t,"number"==typeof n&&n>=0&&(this._resendInterval=Math.floor(n)),"number"==typeof r&&r>=0&&(this._maxBytesOnDisk=Math.floor(r)),t&&!e.OS_PROVIDES_FILE_PROTECTION&&(this._enableDiskRetryMode=!1,c.warn(e.TAG,"Ignoring request to enable disk retry mode. Sufficient file protection capabilities were not detected."))},e.prototype.send=function(t,n){var r=this,i=this._config.endpointUrl,o={method:"POST",withCredentials:!1,headers:{"Content-Type":"application/x-json-stream"}};s.gzip(t,(function(s,a){var p=a;s?(c.warn(s),p=t,o.headers["Content-Length"]=t.length.toString()):(o.headers["Content-Encoding"]="gzip",o.headers["Content-Length"]=a.length),c.info(e.TAG,o),o[l.disableCollectionRequestOption]=!0;var d=u.makeRequest(r._config,i,o,(function(i){i.setEncoding("utf-8");var o="";i.on("data",(function(e){o+=e})),i.on("end",(function(){r._numConsecutiveFailures=0,c.info(e.TAG,o),"function"==typeof r._onSuccess&&r._onSuccess(o),"function"==typeof n&&n(o),r._enableDiskRetryMode&&(200===i.statusCode?setTimeout((function(){return r._sendFirstFileOnDisk()}),r._resendInterval).unref():408!==i.statusCode&&429!==i.statusCode&&439!==i.statusCode&&500!==i.statusCode&&503!==i.statusCode||r._storeToDisk(t))}))}));d.on("error",(function(i){if(r._numConsecutiveFailures++,!r._enableDiskRetryMode||r._numConsecutiveFailures>0&&r._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN==0){var o="Ingestion endpoint could not be reached. This batch of telemetry items has been lost. Use Disk Retry Caching to enable resending of failed telemetry. Error:";r._enableDiskRetryMode&&(o="Ingestion endpoint could not be reached "+r._numConsecutiveFailures+" consecutive times. There may be resulting telemetry loss. Most recent error:"),c.warn(e.TAG,o,i)}else{o="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";c.info(e.TAG,o,i)}if(r._onErrorHelper(i),"function"==typeof n){var s="error sending telemetry";i&&"function"==typeof i.toString&&(s=i.toString()),n(s)}r._enableDiskRetryMode&&r._storeToDisk(t)})),d.write(p),d.end()}))},e.prototype.saveOnCrash=function(e){this._enableDiskRetryMode&&this._storeToDiskSync(e)},e.prototype._runICACLS=function(t,n){var r=a.spawn(e.ICACLS_PATH,t,{windowsHide:!0});r.on("error",(function(e){return n(e)})),r.on("close",(function(e,t){return n(0===e?null:new Error("Setting ACL restrictions did not succeed (ICACLS returned code "+e+")"))}))},e.prototype._runICACLSSync=function(t){if(!a.spawnSync)throw new Error("Could not synchronously call ICACLS under current version of Node.js");var n=a.spawnSync(e.ICACLS_PATH,t,{windowsHide:!0});if(n.error)throw n.error;if(0!==n.status)throw new Error("Setting ACL restrictions did not succeed (ICACLS returned code "+n.status+")")},e.prototype._getACLIdentity=function(t){if(e.ACL_IDENTITY)return t(null,e.ACL_IDENTITY);var n=a.spawn(e.POWERSHELL_PATH,["-Command","[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),r="";n.stdout.on("data",(function(e){return r+=e})),n.on("error",(function(e){return t(e,null)})),n.on("close",(function(n,i){return e.ACL_IDENTITY=r&&r.trim(),t(0===n?null:new Error("Getting ACL identity did not succeed (PS returned code "+n+")"),e.ACL_IDENTITY)}))},e.prototype._getACLIdentitySync=function(){if(e.ACL_IDENTITY)return e.ACL_IDENTITY;if(a.spawnSync){var t=a.spawnSync(e.POWERSHELL_PATH,["-Command","[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]});if(t.error)throw t.error;if(0!==t.status)throw new Error("Getting ACL identity did not succeed (PS returned code "+t.status+")");return e.ACL_IDENTITY=t.stdout&&t.stdout.toString().trim(),e.ACL_IDENTITY}throw new Error("Could not synchronously get ACL identity under current version of Node.js")},e.prototype._getACLArguments=function(e,t){return[e,"/grant","*S-1-5-32-544:(OI)(CI)F","/grant",t+":(OI)(CI)F","/inheritance:r"]},e.prototype._applyACLRules=function(t,n){var r=this;return e.USE_ICACLS?void 0!==e.ACLED_DIRECTORIES[t]?n(e.ACLED_DIRECTORIES[t]?null:new Error("Setting ACL restrictions did not succeed (cached result)")):(e.ACLED_DIRECTORIES[t]=!1,void this._getACLIdentity((function(i,o){if(i)return e.ACLED_DIRECTORIES[t]=!1,n(i);r._runICACLS(r._getACLArguments(t,o),(function(r){return e.ACLED_DIRECTORIES[t]=!r,n(r)}))}))):n(null)},e.prototype._applyACLRulesSync=function(t){if(e.USE_ICACLS){if(void 0===e.ACLED_DIRECTORIES[t])return this._runICACLSSync(this._getACLArguments(t,this._getACLIdentitySync())),void(e.ACLED_DIRECTORIES[t]=!0);if(!e.ACLED_DIRECTORIES[t])throw new Error("Setting ACL restrictions did not succeed (cached result)")}},e.prototype._confirmDirExists=function(e,t){var n=this;r.lstat(e,(function(i,o){i&&"ENOENT"===i.code?r.mkdir(e,(function(r){r&&"EEXIST"!==r.code?t(r):n._applyACLRules(e,t)})):!i&&o.isDirectory()?n._applyACLRules(e,t):t(i||new Error("Path existed but was not a directory"))}))},e.prototype._getShallowDirectorySize=function(e,t){r.readdir(e,(function(n,i){if(n)return t(n,-1);var s=null,a=0,c=0;if(0!==i.length)for(var l=0;ln._maxBytesOnDisk)c.warn(e.TAG,"Not saving data due to max size limit being met. Directory size in bytes is: "+a);else{var l=(new Date).getTime()+".ai.json",u=o.join(s,l);c.info(e.TAG,"saving data to disk at: "+u),r.writeFile(u,t,{mode:384},(function(e){return n._onErrorHelper(e)}))}}))}))},e.prototype._storeToDiskSync=function(t){var n=o.join(i.tmpdir(),e.TEMPDIR_PREFIX+this._config.instrumentationKey);try{c.info(e.TAG,"Checking existance of data storage directory: "+n),r.existsSync(n)||r.mkdirSync(n),this._applyACLRulesSync(n);var s=this._getShallowDirectorySizeSync(n);if(s>this._maxBytesOnDisk)return void c.info(e.TAG,"Not saving data due to max size limit being met. Directory size in bytes is: "+s);var a=(new Date).getTime()+".ai.json",l=o.join(n,a);c.info(e.TAG,"saving data before crash to disk at: "+l),r.writeFileSync(l,t,{mode:384})}catch(t){c.warn(e.TAG,"Error while saving data to disk: "+(t&&t.message)),this._onErrorHelper(t)}},e.prototype._sendFirstFileOnDisk=function(){var t=this,n=o.join(i.tmpdir(),e.TEMPDIR_PREFIX+this._config.instrumentationKey);r.exists(n,(function(e){e&&r.readdir(n,(function(e,i){if(e)t._onErrorHelper(e);else if((i=i.filter((function(e){return o.basename(e).indexOf(".ai.json")>-1}))).length>0){var s=i[0],a=o.join(n,s);r.readFile(a,(function(e,n){e?t._onErrorHelper(e):r.unlink(a,(function(e){e?t._onErrorHelper(e):t.send(n)}))}))}}))}))},e.prototype._onErrorHelper=function(e){"function"==typeof this._onError&&this._onError(e)},e.TAG="Sender",e.ICACLS_PATH=process.env.systemdrive+"/windows/system32/icacls.exe",e.POWERSHELL_PATH=process.env.systemdrive+"/windows/system32/windowspowershell/v1.0/powershell.exe",e.ACLED_DIRECTORIES={},e.ACL_IDENTITY=null,e.WAIT_BETWEEN_RESEND=6e4,e.MAX_BYTES_ON_DISK=5e7,e.MAX_CONNECTION_FAILURES_BEFORE_WARN=5,e.TEMPDIR_PREFIX="appInsights-node",e.OS_PROVIDES_FILE_PROTECTION=!1,e.USE_ICACLS="Windows_NT"===i.type(),e}();e.exports=p},7625:(e,t,n)=>{"use strict";var r=n(8835),i=n(9253),o=n(4470),s=n(5290),a=n(3504),c=n(9428),l=n(894),u=n(2588),p=n(5740),d=n(5282),f=n(9813),h=function(){function e(e){this._telemetryProcessors=[];var t=new i(e);this.config=t,this.context=new o,this.commonProperties={};var n=new u(this.config);this.channel=new a((function(){return t.disableAppInsights}),(function(){return t.maxBatchSize}),(function(){return t.maxBatchIntervalMs}),n)}return e.prototype.trackAvailability=function(e){this.track(e,s.TelemetryType.Availability)},e.prototype.trackTrace=function(e){this.track(e,s.TelemetryType.Trace)},e.prototype.trackMetric=function(e){this.track(e,s.TelemetryType.Metric)},e.prototype.trackException=function(e){e&&e.exception&&!p.isError(e.exception)&&(e.exception=new Error(e.exception.toString())),this.track(e,s.TelemetryType.Exception)},e.prototype.trackEvent=function(e){this.track(e,s.TelemetryType.Event)},e.prototype.trackRequest=function(e){this.track(e,s.TelemetryType.Request)},e.prototype.trackDependency=function(e){e&&!e.target&&e.data&&(e.target=r.parse(e.data).host),this.track(e,s.TelemetryType.Dependency)},e.prototype.flush=function(e){this.channel.triggerSend(!!e&&!!e.isAppCrashing,e?e.callback:void 0)},e.prototype.track=function(e,t){if(e&&s.telemetryTypeToBaseType(t)){var n=f.createEnvelope(e,t,this.commonProperties,this.context,this.config);e.time&&(n.time=e.time.toISOString());var r=this.runTelemetryProcessors(n,e.contextObjects);r=r&&c.samplingTelemetryProcessor(n,{correlationContext:l.CorrelationContextManager.getCurrentContext()}),c.performanceMetricsTelemetryProcessor(n,this.quickPulseClient),r&&this.channel.send(n)}else d.warn("track() requires telemetry object and telemetryType to be specified.")},e.prototype.addTelemetryProcessor=function(e){this._telemetryProcessors.push(e)},e.prototype.clearTelemetryProcessors=function(){this._telemetryProcessors=[]},e.prototype.runTelemetryProcessors=function(e,t){var n=!0,r=this._telemetryProcessors.length;if(0===r)return n;(t=t||{}).correlationContext=l.CorrelationContextManager.getCurrentContext();for(var i=0;i{"use strict";var r=n(5740),i=n(9962),o=function(){function e(t,n){if(this.traceFlag=e.DEFAULT_TRACE_FLAG,this.version=e.DEFAULT_VERSION,t&&"string"==typeof t)if(t.split(",").length>1)this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16);else{var o=t.trim().split("-"),s=o.length;s>=4?(this.version=o[0],this.traceId=o[1],this.spanId=o[2],this.traceFlag=o[3]):(this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)),this.version.match(/^[0-9a-f]{2}$/g)||(this.version=e.DEFAULT_VERSION,this.traceId=r.w3cTraceId()),"00"===this.version&&4!==s&&(this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)),"ff"===this.version&&(this.version=e.DEFAULT_VERSION,this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)),this.version.match(/^0[0-9a-f]$/g)||(this.version=e.DEFAULT_VERSION),this.traceFlag.match(/^[0-9a-f]{2}$/g)||(this.traceFlag=e.DEFAULT_TRACE_FLAG,this.traceId=r.w3cTraceId()),e.isValidTraceId(this.traceId)||(this.traceId=r.w3cTraceId()),e.isValidSpanId(this.spanId)||(this.spanId=r.w3cTraceId().substr(0,16),this.traceId=r.w3cTraceId()),this.parentId=this.getBackCompatRequestId()}else if(n){this.parentId=n.slice();var a=i.getRootId(n);e.isValidTraceId(a)||(this.legacyRootId=a,a=r.w3cTraceId()),-1!==n.indexOf("|")&&(n=n.substring(1+n.substring(0,n.length-1).lastIndexOf("."),n.length-1)),this.traceId=a,this.spanId=n}else this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)}return e.isValidTraceId=function(e){return e.match(/^[0-9a-f]{32}$/)&&"00000000000000000000000000000000"!==e},e.isValidSpanId=function(e){return e.match(/^[0-9a-f]{16}$/)&&"0000000000000000"!==e},e.prototype.getBackCompatRequestId=function(){return"|"+this.traceId+"."+this.spanId+"."},e.prototype.toString=function(){return this.version+"-"+this.traceId+"-"+this.spanId+"-"+this.traceFlag},e.prototype.updateSpanId=function(){this.spanId=r.w3cTraceId().substr(0,16)},e.DEFAULT_TRACE_FLAG="01",e.DEFAULT_VERSION="00",e}();e.exports=o},6333:e=>{"use strict";var t=function(){function e(e){this.fieldmap=[],e&&(this.fieldmap=this.parseHeader(e))}return e.prototype.toString=function(){var e=this.fieldmap;return e&&0!=e.length?e.join(", "):null},e.validateKeyChars=function(e){var t=e.split("@");if(2==t.length){var n=t[0].trim(),r=t[1].trim(),i=Boolean(n.match(/^[\ ]?[a-z0-9\*\-\_/]{1,241}$/)),o=Boolean(r.match(/^[\ ]?[a-z0-9\*\-\_/]{1,14}$/));return i&&o}return 1==t.length&&Boolean(e.match(/^[\ ]?[a-z0-9\*\-\_/]{1,256}$/))},e.prototype.parseHeader=function(t){var n=[],r={},i=t.split(",");if(i.length>32)return null;for(var o=0,s=i;o>t&255)},n=e.map((function(e){return t(e,24)+t(e,16)+t(e,8)+t(e,0)})).join(""),r=(Buffer.from?Buffer.from(n,"binary"):new Buffer(n,"binary")).toString("base64");return r.substr(0,r.indexOf("="))},e.random32=function(){return 4294967296*Math.random()|0},e.randomu32=function(){return e.random32()+2147483648},e.w3cTraceId=function(){for(var t,n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],r="",i=0;i<4;i++)r+=n[15&(t=e.random32())]+n[t>>4&15]+n[t>>8&15]+n[t>>12&15]+n[t>>16&15]+n[t>>20&15]+n[t>>24&15]+n[t>>28&15];var o=n[8+4*Math.random()|0];return r.substr(0,8)+r.substr(9,4)+"4"+r.substr(13,3)+o+r.substr(16,3)+r.substr(19,12)},e.isValidW3CId=function(e){return 32===e.length&&"00000000000000000000000000000000"!==e},e.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},e.isError=function(e){return e instanceof Error},e.isPrimitive=function(e){var t=typeof e;return"string"===t||"number"===t||"boolean"===t},e.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},e.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=(e/1e3%60).toFixed(7).replace(/0{0,4}$/,""),n=""+Math.floor(e/6e4)%60,r=""+Math.floor(e/36e5)%24,i=Math.floor(e/864e5);return t=t.indexOf(".")<2?"0"+t:t,n=n.length<2?"0"+n:n,(i>0?i+".":"")+(r=r.length<2?"0"+r:r)+":"+n+":"+t},e.extractError=function(e){var t=e;return{message:e.message,code:t.code||t.id||""}},e.extractObject=function(t){return t instanceof Error?e.extractError(t):"function"==typeof t.toJSON?t.toJSON():t},e.validateStringMap=function(t){if("object"==typeof t){var n={};for(var r in t){var i="",o=t[r],s=typeof o;if(e.isPrimitive(o))i=o.toString();else if(null===o||"undefined"===s)i="";else{if("function"===s){c.info("key: "+r+" was function; will not serialize");continue}var a=e.isArray(o)?o:e.extractObject(o);try{i=e.isPrimitive(a)?a:JSON.stringify(a)}catch(e){i=o.constructor.name.toString()+" (Error: "+e.message+")",c.info("key: "+r+", could not be serialized")}}n[r]=i.substring(0,e.MAX_PROPERTY_LENGTH)}return n}c.info("Invalid properties dropped from payload")},e.canIncludeCorrelationHeader=function(e,t){var n=e&&e.config&&e.config.correlationHeaderExcludedDomains;if(!n||0==n.length||!t)return!0;for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4350),i=n(5290);t.performanceMetricsTelemetryProcessor=function(e,t){switch(t&&t.addDocument(e),e.data.baseType){case i.TelemetryTypeString.Exception:r.countException();break;case i.TelemetryTypeString.Request:var n=e.data.baseData;r.countRequest(n.duration,n.success);break;case i.TelemetryTypeString.Dependency:var o=e.data.baseData;r.countDependency(o.duration,o.success)}return!0}},2037:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5290);function i(e){var t=2147483647,n=5381;if(!e)return 0;for(;e.length<8;)e+=e;for(var r=0;r=100||(!(!e.data||r.TelemetryType.Metric!==r.baseTypeToTelemetryType(e.data.baseType))||(t.correlationContext&&t.correlationContext.operation?i(t.correlationContext.operation.id){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2037)),r(n(4127))},9574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(894),o=n(6281),s=n(6639),a=n(4350),c=n(8723),l=n(731),u=n(9962),p=n(5282),d=n(3668),f=n(1629);t.TelemetryClient=n(1259),t.Contracts=n(5290),function(e){e[e.AI=0]="AI",e[e.AI_AND_W3C=1]="AI_AND_W3C"}(r=t.DistributedTracingModes||(t.DistributedTracingModes={}));var h,m,g,v,y,_,E,b,w,S=!0,I=!1,C=!0,x=!0,O=!0,T=!0,A=!0,N=!0,P=!1,L=!0,R=void 0,D=void 0,k=!1;function M(){return t.defaultClient?(k=!0,g.enable(S,I),v.enable(C),y.enable(x),_.enable(L,m),E.useAutoCorrelation(N,h),E.enable(O),b.enable(T),t.liveMetricsClient&&P&&t.liveMetricsClient.enable(P)):p.warn("Start cannot be called before setup"),V}t.setup=function(e){return t.defaultClient?p.info("The default client is already setup"):(t.defaultClient=new t.TelemetryClient(e),g=new o(t.defaultClient),v=new s(t.defaultClient),y=new a(t.defaultClient),E=new l(t.defaultClient),b=new c(t.defaultClient),_||(_=new f.AutoCollectNativePerformance(t.defaultClient))),t.defaultClient&&t.defaultClient.channel&&t.defaultClient.channel.setUseDiskRetryCaching(A,R,D),V},t.start=M,t.getCorrelationContext=function(){return N?i.CorrelationContextManager.getCurrentContext():null},t.wrapWithCorrelationContext=function(e){return i.CorrelationContextManager.wrapCallback(e)};var V=function(){function e(){}return e.setDistributedTracingMode=function(t){return u.w3cEnabled=t===r.AI_AND_W3C,e},e.setAutoCollectConsole=function(t,n){return void 0===n&&(n=!1),S=t,I=n,k&&g.enable(t,n),e},e.setAutoCollectExceptions=function(t){return C=t,k&&v.enable(t),e},e.setAutoCollectPerformance=function(t,n){void 0===n&&(n=!0),x=t;var r=f.AutoCollectNativePerformance.parseEnabled(n);return L=r.isEnabled,m=r.disabledMetrics,k&&(y.enable(t),_.enable(r.isEnabled,r.disabledMetrics)),e},e.setAutoCollectRequests=function(t){return O=t,k&&E.enable(t),e},e.setAutoCollectDependencies=function(t){return T=t,k&&b.enable(t),e},e.setAutoDependencyCorrelation=function(t,n){return N=t,h=n,k&&E.useAutoCorrelation(t,n),e},e.setUseDiskRetryCaching=function(n,r,i){return A=n,R=r,D=i,t.defaultClient&&t.defaultClient.channel&&t.defaultClient.channel.setUseDiskRetryCaching(n,r,i),e},e.setInternalLogging=function(t,n){return void 0===t&&(t=!1),void 0===n&&(n=!0),p.enableDebug=t,p.disableWarnings=!n,e},e.setSendLiveMetrics=function(n){return void 0===n&&(n=!1),t.defaultClient?(!t.liveMetricsClient&&n?(t.liveMetricsClient=new d(t.defaultClient.config.instrumentationKey),w=new a(t.liveMetricsClient,1e3,!0),t.liveMetricsClient.addCollector(w),t.defaultClient.quickPulseClient=t.liveMetricsClient):t.liveMetricsClient&&t.liveMetricsClient.enable(n),P=n,e):(p.warn("Live metrics client cannot be setup without the default client"),e)},e.start=M,e}();t.Configuration=V,t.dispose=function(){t.defaultClient=null,k=!1,g&&g.dispose(),v&&v.dispose(),y&&y.dispose(),_&&_.dispose(),E&&E.dispose(),b&&b.dispose(),t.liveMetricsClient&&(t.liveMetricsClient.enable(!1),P=!1,t.liveMetricsClient=void 0)}},9822:(e,t,n)=>{"use strict";const r=process.binding("async_wrap"),i=r.Providers.TIMERWRAP,o={nextTick:n(3269),promise:n(9565),timers:n(7190)},s=new Set;function a(){this.enabled=!1,this.counter=0}function c(){const e=this.initFns=[],t=this.preFns=[],n=this.postFns=[],r=this.destroyFns=[];this.init=function(t,n,r,o){if(n!==i)for(const i of e)i(t,this,n,r,o);else s.add(t)},this.pre=function(e){if(!s.has(e))for(const n of t)n(e,this)},this.post=function(e,t){if(!s.has(e))for(const r of n)r(e,this,t)},this.destroy=function(e){if(s.has(e))s.delete(e);else for(const t of r)t(e)}}function l(e,t){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}function u(){this._state=new a,this._hooks=new c,this.version=n(1910).i8,this.providers=r.Providers;for(const e of Object.keys(o))o[e].call(this);process.env.hasOwnProperty("NODE_ASYNC_HOOK_WARNING")&&console.warn("warning: you are using async-hook-jl which is unstable."),r.setupHooks({init:this._hooks.init,pre:this._hooks.pre,post:this._hooks.post,destroy:this._hooks.destroy})}c.prototype.add=function(e){e.init&&this.initFns.push(e.init),e.pre&&this.preFns.push(e.pre),e.post&&this.postFns.push(e.post),e.destroy&&this.destroyFns.push(e.destroy)},c.prototype.remove=function(e){e.init&&l(this.initFns,e.init),e.pre&&l(this.preFns,e.pre),e.post&&l(this.postFns,e.post),e.destroy&&l(this.destroyFns,e.destroy)},e.exports=u,u.prototype.addHooks=function(e){this._hooks.add(e)},u.prototype.removeHooks=function(e){this._hooks.remove(e)},u.prototype.enable=function(){this._state.enabled=!0,r.enable()},u.prototype.disable=function(){this._state.enabled=!1,r.disable()}},3223:(e,t,n)=>{"use strict";const r=n(9822);if(global._asyncHook){if(global._asyncHook.version!==n(1910).i8)throw new Error("Conflicting version of async-hook-jl found");e.exports=global._asyncHook}else{n(2512).filter.attach((function(e,t){return t.filter((function(e){const t=e.getFileName();return!(t&&t.slice(0,__dirname.length)===__dirname)}))})),e.exports=global._asyncHook=new r}},1910:e=>{"use strict";e.exports={i8:"1.7.6"}},3269:e=>{"use strict";function t(){}e.exports=function(){const e=this._hooks,n=this._state,r=process.nextTick;process.nextTick=function(){if(!n.enabled)return r.apply(process,arguments);const i=new Array(arguments.length);for(let e=0;e0&&process.once("uncaughtException",(function(){e.post.call(s,a,!0),e.destroy.call(null,a)}))}e.post.call(s,a,!1),e.destroy.call(null,a)},r.apply(process,i)}}},9565:e=>{"use strict";function t(){}e.exports=function(){const e=this._hooks,n=this._state,r=global.Promise,i=r.prototype.then;function o(t,n,r,i){return"function"!=typeof t?i?function(t){return function(n){return e.destroy.call(null,t),n}}(r):function(t){return function(n){throw e.destroy.call(null,t),n}}(r):function(){e.pre.call(n,r);try{return t.apply(this,arguments)}finally{e.post.call(n,r,!1),e.destroy.call(null,r)}}}r.prototype.then=function(r,s){if(!n.enabled)return i.call(this,r,s);const a=new t,c=--n.counter;return e.init.call(a,c,0,null,null),i.call(this,o(r,a,c,!0),o(s,a,c,!1))}}},7190:(e,t,n)=>{"use strict";const r=n(8213);function i(){}function o(){}function s(){}const a=new Map,c=new Map,l=new Map;let u=null,p=!1;function d(e,t,n,i,o,s,a){const c=r[n],l=r[i];r[n]=function(){if(!t.enabled)return c.apply(r,arguments);const n=new Array(arguments.length);for(let e=0;e0&&process.once("uncaughtException",(function(){e.post.call(l,d,!0),s.delete(f),e.destroy.call(null,d)}))}e.post.call(l,d,!1),u=null,(a||p)&&(p=!1,s.delete(f),e.destroy.call(null,d))},f=c.apply(r,n),s.set(f,d),f},r[i]=function(t){if(u===t&&null!==t)p=!0;else if(s.has(t)){const n=s.get(t);s.delete(t),e.destroy.call(null,n)}l.apply(r,arguments)}}e.exports=function(){d(this._hooks,this._state,"setTimeout","clearTimeout",i,a,!0),d(this._hooks,this._state,"setInterval","clearInterval",o,c,!1),d(this._hooks,this._state,"setImmediate","clearImmediate",s,l,!0),global.setTimeout=r.setTimeout,global.setInterval=r.setInterval,global.setImmediate=r.setImmediate,global.clearTimeout=r.clearTimeout,global.clearInterval=r.clearInterval,global.clearImmediate=r.clearImmediate}},8286:e=>{"use strict";e.exports=(e,t)=>class extends e{constructor(e){var n,r;super((function(e,o){n=this,r=[function(n){return t(i,!1),e(n)},function(e){return t(i,!1),o(e)}]}));var i=this;try{e.apply(n,r)}catch(e){r[1](e)}return i}}},9090:(e,t,n)=>{var r,i,o=n(6372).wrap,s=[],a=0,c=!1,l=[];function u(e,t){var n=e.length,r=t.length,i=[];if(0===n&&0===r)return i;for(var o=0;o0&&(s=l.pop()),p=void 0,n&&!c},i=function(e,t,n){var r=[];c=!0;for(var i=0;i0&&t[i].before(this,r[t[i].uid]);c=!1;var o=e.apply(this,arguments);for(c=!0,i=0;i0&&t[i].after(this,r[t[i].uid]);return c=!1,s=l.pop(),p=void 0,o}},o(process,"_fatalException",(function(e){return function(t){return r(t)||e(t)}}))}else{var f=!1;r=function(e){if(f)throw e;for(var t=!1,n=s.length,r=0;r0&&t[d].before(this,i[t[d].uid]);c=!1;try{o=e.apply(this,arguments)}catch(e){a=!0;for(d=0;d0&&t[d].after(this,i[t[d].uid]);c=!1}s=l.pop()}return o}},process.addListener("uncaughtException",r)}function h(e,t){"function"==typeof e.create&&(this.create=e.create,this.flags|=1),"function"==typeof e.before&&(this.before=e.before,this.flags|=2),"function"==typeof e.after&&(this.after=e.after,this.flags|=4),"function"==typeof e.error&&(this.error=e.error,this.flags|=8),this.uid=++a,this.data=void 0===t?null:t}function m(e,t){if("object"!=typeof e||!e)throw new TypeError("callbacks argument must be an object");return e instanceof h?e:new h(e,t)}h.prototype.create=void 0,h.prototype.before=void 0,h.prototype.after=void 0,h.prototype.error=void 0,h.prototype.data=void 0,h.prototype.uid=0,h.prototype.flags=0,process.createAsyncListener=m,process.addAsyncListener=function(e,t){var n;n=e instanceof h?e:m(e,t);for(var r=!1,i=0;i0)return i(e,n,t);return function(e,t,n){c=!0;for(var r=0;r{"use strict";if(process.addAsyncListener)throw new Error("Don't require polyfill unless needed");var r=n(6372),i=n(1249),o=r.wrap,s=r.massWrap,a=n(9090),c=n(1669),l=i.gte(process.version,"6.0.0"),u=i.gte(process.version,"7.0.0"),p=i.gte(process.version,"8.0.0"),d=i.gte(process.version,"11.0.0"),f=n(1631);function h(e){return function(){this.on("connection",(function(e){e._handle&&(e._handle.onread=a(e._handle.onread))}));try{return e.apply(this,arguments)}finally{this._handle&&this._handle.onconnection&&(this._handle.onconnection=a(this._handle.onconnection))}}}function m(e){if(e&&e._handle){var t=e._handle;t._originalOnread||(t._originalOnread=t.onread),t.onread=a(t._originalOnread)}}u&&!f._normalizeArgs?f._normalizeArgs=function(e){if(0===e.length)return[{},null];var t,n,r=e[0],i={};"object"==typeof r&&null!==r?i=r:"string"==typeof(t=r)&&!1===(n=t,(n=Number(n))>=0&&n)?i.path=r:(i.port=r,e.length>1&&"string"==typeof e[1]&&(i.host=e[1]));var o=e[e.length-1];return"function"!=typeof o?[i,null]:[i,o]}:u||f._normalizeConnectArgs||(f._normalizeConnectArgs=function(e){var t,n={};"object"==typeof e[0]&&null!==e[0]?n=e[0]:"string"==typeof e[0]&&!1===(t=e[0],(t=Number(t))>=0&&t)?n.path=e[0]:(n.port=e[0],"string"==typeof e[1]&&(n.host=e[1]));var r=e[e.length-1];return"function"==typeof r?[n,r]:[n]}),"_setUpListenHandle"in f.Server.prototype?o(f.Server.prototype,"_setUpListenHandle",h):o(f.Server.prototype,"_listen2",h),o(f.Socket.prototype,"connect",(function(e){return function(){var t;(t=p&&Array.isArray(arguments[0])&&Object.getOwnPropertySymbols(arguments[0]).length>0?arguments[0]:u?f._normalizeArgs(arguments):f._normalizeConnectArgs(arguments))[1]&&(t[1]=a(t[1]));var n=e.apply(this,t);return m(this),n}}));var g=n(8605);o(g.Agent.prototype,"addRequest",(function(e){return function(t){var n=t.onSocket;return t.onSocket=a((function(e){return m(e),n.apply(this,arguments)})),e.apply(this,arguments)}}));var v=n(3129);function y(e){Array.isArray(e.stdio)&&e.stdio.forEach((function(e){e&&e._handle&&(e._handle.onread=a(e._handle.onread),o(e._handle,"close",L))})),e._handle&&(e._handle.onexit=a(e._handle.onexit))}v.ChildProcess?o(v.ChildProcess.prototype,"spawn",(function(e){return function(){var t=e.apply(this,arguments);return y(this),t}})):s(v,["execFile","fork","spawn"],(function(e){return function(){var t=e.apply(this,arguments);return y(t),t}})),process._fatalException||(process._originalNextTick=process.nextTick);var _=[];process._nextDomainTick&&_.push("_nextDomainTick"),process._tickDomainCallback&&_.push("_tickDomainCallback"),s(process,_,P),o(process,"nextTick",L);var E=["setTimeout","setInterval"];global.setImmediate&&E.push("setImmediate");var b=n(8213),w=global.setTimeout===b.setTimeout;s(b,E,L),w&&s(global,E,L);var S=n(881);s(S,["lookup","resolve","resolve4","resolve6","resolveCname","resolveMx","resolveNs","resolveTxt","resolveSrv","reverse"],P),S.resolveNaptr&&o(S,"resolveNaptr",P);var I,C,x=n(5747);s(x,["watch","rename","truncate","chown","fchown","chmod","fchmod","stat","lstat","fstat","link","symlink","readlink","realpath","unlink","rmdir","mkdir","readdir","close","open","utimes","futimes","fsync","write","read","readFile","writeFile","appendFile","watchFile","unwatchFile","exists"],P),x.lchown&&o(x,"lchown",P),x.lchmod&&o(x,"lchmod",P),x.ftruncate&&o(x,"ftruncate",P);try{I=n(8761)}catch(e){}if(I&&I.Deflate&&I.Deflate.prototype){var O=Object.getPrototypeOf(I.Deflate.prototype);O._transform?o(O,"_transform",P):O.write&&O.flush&&O.end&&s(O,["write","flush","end"],P)}try{C=n(6417)}catch(e){}if(C){var T=["pbkdf2","randomBytes"];d||T.push("pseudoRandomBytes"),s(C,T,P)}var A=!!global.Promise&&"function Promise() { [native code] }"===Promise.toString()&&"function toString() { [native code] }"===Promise.toString.toString();if(A){var N=process.addAsyncListener({create:function(){A=!1}});global.Promise.resolve(!0).then((function(){A=!1})),process.removeAsyncListener(N)}function P(e){var t=function(){var t,n=arguments.length-1;if("function"==typeof arguments[n]){t=Array(arguments.length);for(var r=0;r{"use strict";class n{constructor(e){this.tasks=[],this.count=e}sched(){if(this.count>0&&this.tasks.length>0){this.count--;let e=this.tasks.shift();if(void 0===e)throw"Unexpected undefined value in tasks list";e()}}acquire(){return new Promise(((e,t)=>{this.tasks.push((()=>{var t=!1;e((()=>{t||(t=!0,this.count++,this.sched())}))})),process&&process.nextTick?process.nextTick(this.sched.bind(this)):setImmediate(this.sched.bind(this))}))}use(e){return this.acquire().then((t=>e().then((e=>(t(),e))).catch((e=>{throw t(),e}))))}}t.Semaphore=n;t.Mutex=class extends n{constructor(){super(1)}}},5623:e=>{"use strict";function t(e,t,i){e instanceof RegExp&&(e=n(e,i)),t instanceof RegExp&&(t=n(t,i));var o=r(e,t,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+e.length,o[1]),post:i.slice(o[1]+t.length)}}function n(e,t){var n=t.match(e);return n?n[0]:null}function r(e,t,n){var r,i,o,s,a,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],o=n.length;u>=0&&!a;)u==c?(r.push(u),c=n.indexOf(e,u+1)):1==r.length?a=[r.pop(),l]:((i=r.pop())=0?c:l;r.length&&(a=[o,s])}return a}e.exports=t,t.range=r},3644:(e,t,n)=>{var r=n(1048),i=n(5623);e.exports=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return v(function(e){return e.split("\\\\").join(o).split("\\{").join(s).split("\\}").join(a).split("\\,").join(c).split("\\.").join(l)}(e),!0).map(p)};var o="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",c="\0COMMA"+Math.random()+"\0",l="\0PERIOD"+Math.random()+"\0";function u(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function p(e){return e.split(o).join("\\").split(s).join("{").split(a).join("}").split(c).join(",").split(l).join(".")}function d(e){if(!e)return[""];var t=[],n=i("{","}",e);if(!n)return e.split(",");var r=n.pre,o=n.body,s=n.post,a=r.split(",");a[a.length-1]+="{"+o+"}";var c=d(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),t.push.apply(t,a),t}function f(e){return"{"+e+"}"}function h(e){return/^-?0\d/.test(e)}function m(e,t){return e<=t}function g(e,t){return e>=t}function v(e,t){var n=[],o=i("{","}",e);if(!o||/\$$/.test(o.pre))return[e];var s,c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),p=c||l,y=o.body.indexOf(",")>=0;if(!p&&!y)return o.post.match(/,.*\}/)?v(e=o.pre+"{"+o.body+a+o.post):[e];if(p)s=o.body.split(/\.\./);else if(1===(s=d(o.body)).length&&1===(s=v(s[0],!1).map(f)).length)return(b=o.post.length?v(o.post,!1):[""]).map((function(e){return o.pre+s[0]+e}));var _,E=o.pre,b=o.post.length?v(o.post,!1):[""];if(p){var w=u(s[0]),S=u(s[1]),I=Math.max(s[0].length,s[1].length),C=3==s.length?Math.abs(u(s[2])):1,x=m;S0){var P=new Array(N+1).join("0");A=T<0?"-"+P+A.slice(1):P+A}}_.push(A)}}else _=r(s,(function(e){return v(e,!1)}));for(var L=0;L<_.length;L++)for(var R=0;R{var r=n(4293).Buffer,i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function o(e){if(r.isBuffer(e))return e;var t="function"==typeof r.alloc&&"function"==typeof r.from;if("number"==typeof e)return t?r.alloc(e):new r(e);if("string"==typeof e)return t?r.from(e):new r(e);throw new Error("input must be buffer, number, or string, received "+typeof e)}function s(e){var t=o(4);return t.writeInt32BE(e,0),t}function a(e,t){e=o(e),r.isBuffer(t)&&(t=t.readUInt32BE(0));for(var n=-1^~~t,s=0;s>>8;return-1^n}function c(){return s(a.apply(null,arguments))}"undefined"!=typeof Int32Array&&(i=new Int32Array(i)),c.signed=function(){return a.apply(null,arguments)},c.unsigned=function(){return a.apply(null,arguments)>>>0},e.exports=c},4046:(e,t,n)=>{"use strict";const r=n(1669),i=n(2357),o=n(9867),s=n(3223),a="error@context",c=[];for(let e in s.providers)c[s.providers[e]]=e;const l=process.env.DEBUG_CLS_HOOKED;let u=-1;function p(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map}function d(e){return process.namespaces[e]}function f(e){let t=d(e);i.ok(t,"can't delete nonexistent namespace! \""+e+'"'),i.ok(t.id,"don't assign to process.namespaces directly! "+r.inspect(t)),process.namespaces[e]=null}function h(e){process.env.DEBUG&&process._rawDebug(e)}function m(e){return e?"function"==typeof e?e.name?e.name:(e.toString().trim().match(/^function\s*([^\s(]+)/)||[])[1]:e.constructor&&e.constructor.name?e.constructor.name:void 0:e}if(e.exports={getNamespace:d,createNamespace:function(e){i.ok(e,"namespace must be given a name."),l&&h("CREATING NAMESPACE "+e);let t=new p(e);return t.id=u,s.addHooks({init(n,i,o,s,a){u=n,s?(t._contexts.set(n,t._contexts.get(s)),l&&h("PARENTID: "+e+" uid:"+n+" parent:"+s+" provider:"+o)):t._contexts.set(u,t.active),l&&h("INIT "+e+" uid:"+n+" parent:"+s+" provider:"+c[o]+" active:"+r.inspect(t.active,!0))},pre(n,i){u=n;let o=t._contexts.get(n);o?(l&&h(" PRE "+e+" uid:"+n+" handle:"+m(i)+" context:"+r.inspect(o)),t.enter(o)):l&&h(" PRE MISSING CONTEXT "+e+" uid:"+n+" handle:"+m(i))},post(n,i){u=n;let o=t._contexts.get(n);o?(l&&h(" POST "+e+" uid:"+n+" handle:"+m(i)+" context:"+r.inspect(o)),t.exit(o)):l&&h(" POST MISSING CONTEXT "+e+" uid:"+n+" handle:"+m(i))},destroy(n){u=n,l&&h("DESTROY "+e+" uid:"+n+" context:"+r.inspect(t._contexts.get(u))+" active:"+r.inspect(t.active,!0)),t._contexts.delete(n)}}),process.namespaces[e]=t,t},destroyNamespace:f,reset:function(){process.namespaces&&Object.keys(process.namespaces).forEach((function(e){f(e)}));process.namespaces=Object.create(null)},ERROR_SYMBOL:a},p.prototype.set=function(e,t){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");return l&&h(" SETTING KEY:"+e+"="+t+" in ns:"+this.name+" uid:"+u+" active:"+r.inspect(this.active,!0)),this.active[e]=t,t},p.prototype.get=function(e){if(this.active)return l&&h(" GETTING KEY:"+e+"="+this.active[e]+" "+this.name+" uid:"+u+" active:"+r.inspect(this.active,!0)),this.active[e];l&&h(" GETTING KEY:"+e+"=undefined "+this.name+" uid:"+u+" active:"+r.inspect(this.active,!0))},p.prototype.createContext=function(){l&&h(" CREATING Context: "+this.name+" uid:"+u+" len:"+this._set.length+" active:"+r.inspect(this.active,!0,2,!0));let e=Object.create(this.active?this.active:Object.prototype);return e._ns_name=this.name,e.id=u,l&&h(" CREATED Context: "+this.name+" uid:"+u+" len:"+this._set.length+" context:"+r.inspect(e,!0,2,!0)),e},p.prototype.run=function(e){let t=this.createContext();this.enter(t);try{return l&&h(" BEFORE RUN: "+this.name+" uid:"+u+" len:"+this._set.length+" "+r.inspect(t)),e(t),t}catch(e){throw e&&(e[a]=t),e}finally{l&&h(" AFTER RUN: "+this.name+" uid:"+u+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t)}},p.prototype.runAndReturn=function(e){var t;return this.run((function(n){t=e(n)})),t},p.prototype.runPromise=function(e){let t=this.createContext();this.enter(t);let n=e(t);if(!n||!n.then||!n.catch)throw new Error("fn must return a promise.");return l&&h(" BEFORE runPromise: "+this.name+" uid:"+u+" len:"+this._set.length+" "+r.inspect(t)),n.then((e=>(l&&h(" AFTER runPromise: "+this.name+" uid:"+u+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e))).catch((e=>{throw e[a]=t,l&&h(" AFTER runPromise: "+this.name+" uid:"+u+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e}))},p.prototype.bind=function(e,t){t||(t=this.active?this.active:this.createContext());let n=this;return function(){n.enter(t);try{return e.apply(this,arguments)}catch(e){throw e&&(e[a]=t),e}finally{n.exit(t)}}},p.prototype.enter=function(e){i.ok(e,"context must be provided for entering"),l&&h(" ENTER "+this.name+" uid:"+u+" len:"+this._set.length+" context: "+r.inspect(e)),this._set.push(this.active),this.active=e},p.prototype.exit=function(e){if(i.ok(e,"context must be provided for exiting"),l&&h(" EXIT "+this.name+" uid:"+u+" len:"+this._set.length+" context: "+r.inspect(e)),this.active===e)return i.ok(this._set.length,"can't remove top context"),void(this.active=this._set.pop());let t=this._set.lastIndexOf(e);t<0?(l&&h("??ERROR?? context exiting but not entered - ignoring: "+r.inspect(e)),i.ok(t>=0,"context not currently entered; can't exit. \n"+r.inspect(this)+"\n"+r.inspect(e))):(i.ok(t,"can't remove top context"),this._set.splice(t,1))},p.prototype.bindEmitter=function(e){i.ok(e.on&&e.addListener&&e.emit,"can only bind real EEs");let t=this,n="context@"+this.name;o(e,(function(e){e&&(e["cls@contexts"]||(e["cls@contexts"]=Object.create(null)),e["cls@contexts"][n]={namespace:t,context:t.active})}),(function(e){if(!e||!e["cls@contexts"])return e;let t=e,n=e["cls@contexts"];return Object.keys(n).forEach((function(e){let r=n[e];t=r.namespace.bind(t,r.context)})),t}))},p.prototype.fromException=function(e){return e[a]},process.namespaces={},s._state&&!s._state.enabled&&s.enable(),l){var g=n(2512);for(var v in g.filter._modifiers)g.filter.deattach(v)}},3964:(e,t,n)=>{"use strict";const r=n(1669),i=n(2357),o=n(9867),s=n(7303),a="error@context",c=process.env.DEBUG_CLS_HOOKED;let l=-1;function u(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map,this._indent=0}function p(e){return process.namespaces[e]}function d(e){let t=p(e);i.ok(t,"can't delete nonexistent namespace! \""+e+'"'),i.ok(t.id,"don't assign to process.namespaces directly! "+r.inspect(t)),process.namespaces[e]=null}function f(...e){c&&process._rawDebug(`${r.format(...e)}`)}e.exports={getNamespace:p,createNamespace:function(e){i.ok(e,"namespace must be given a name."),c&&f(`NS-CREATING NAMESPACE (${e})`);let t=new u(e);t.id=l;return s.createHook({init(n,i,o,a){l=s.executionAsyncId();if(t.active){t._contexts.set(n,t.active);if(c){const s=" ".repeat(t._indent<0?0:t._indent);f(`${s}INIT [${i}] (${e}) asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}}else if(l===0){const o=s.triggerAsyncId();const u=t._contexts.get(o);if(u){t._contexts.set(n,u);if(c){const s=" ".repeat(t._indent<0?0:t._indent);f(`${s}INIT USING CONTEXT FROM TRIGGERID [${i}] (${e}) asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}}else if(c){const s=" ".repeat(t._indent<0?0:t._indent);f(`${s}INIT MISSING CONTEXT [${i}] (${e}) asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}}if(c&&i==="PROMISE"){f(r.inspect(a,{showHidden:true}));const s=a.parentId;const c=" ".repeat(t._indent<0?0:t._indent);f(`${c}INIT RESOURCE-PROMISE [${i}] (${e}) parentId:${s} asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}},before(n){l=s.executionAsyncId();let i;i=t._contexts.get(n)||t._contexts.get(l);if(i){if(c){const o=s.triggerAsyncId();const a=" ".repeat(t._indent<0?0:t._indent);f(`${a}BEFORE (${e}) asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(i)}`);t._indent+=2}t.enter(i)}else if(c){const i=s.triggerAsyncId();const o=" ".repeat(t._indent<0?0:t._indent);f(`${o}BEFORE MISSING CONTEXT (${e}) asyncId:${n} currentUid:${l} triggerId:${i} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} namespace._contexts:${r.inspect(t._contexts,{showHidden:true,depth:2,colors:true})}`);t._indent+=2}},after(n){l=s.executionAsyncId();let i;i=t._contexts.get(n)||t._contexts.get(l);if(i){if(c){const o=s.triggerAsyncId();t._indent-=2;const a=" ".repeat(t._indent<0?0:t._indent);f(`${a}AFTER (${e}) asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(i)}`)}t.exit(i)}else if(c){const o=s.triggerAsyncId();t._indent-=2;const a=" ".repeat(t._indent<0?0:t._indent);f(`${a}AFTER MISSING CONTEXT (${e}) asyncId:${n} currentUid:${l} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(i)}`)}},destroy(n){l=s.executionAsyncId();if(c){const i=s.triggerAsyncId();const o=" ".repeat(t._indent<0?0:t._indent);f(`${o}DESTROY (${e}) currentUid:${l} asyncId:${n} triggerId:${i} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(t._contexts.get(l))}`)}t._contexts.delete(n)}}).enable(),process.namespaces[e]=t,t},destroyNamespace:d,reset:function(){process.namespaces&&Object.keys(process.namespaces).forEach((function(e){d(e)}));process.namespaces=Object.create(null)},ERROR_SYMBOL:a},u.prototype.set=function(e,t){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");if(this.active[e]=t,c){f(" ".repeat(this._indent<0?0:this._indent)+"CONTEXT-SET KEY:"+e+"="+t+" in ns:"+this.name+" currentUid:"+l+" active:"+r.inspect(this.active,{showHidden:!0,depth:2,colors:!0}))}return t},u.prototype.get=function(e){if(this.active){if(c){const t=s.executionAsyncId(),n=s.triggerAsyncId(),i=" ".repeat(this._indent<0?0:this._indent);f(i+"CONTEXT-GETTING KEY:"+e+"="+this.active[e]+" ("+this.name+") currentUid:"+l+" active:"+r.inspect(this.active,{showHidden:!0,depth:2,colors:!0})),f(`${i}CONTEXT-GETTING KEY: (${this.name}) ${e}=${this.active[e]} currentUid:${l} asyncHooksCurrentId:${t} triggerId:${n} len:${this._set.length} active:${r.inspect(this.active)}`)}return this.active[e]}if(c){const t=s.currentId(),n=s.triggerAsyncId();f(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-GETTING KEY NO ACTIVE NS: (${this.name}) ${e}=undefined currentUid:${l} asyncHooksCurrentId:${t} triggerId:${n} len:${this._set.length}`)}},u.prototype.createContext=function(){let e=Object.create(this.active?this.active:Object.prototype);if(e._ns_name=this.name,e.id=l,c){const t=s.executionAsyncId(),n=s.triggerAsyncId();f(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-CREATED Context: (${this.name}) currentUid:${l} asyncHooksCurrentId:${t} triggerId:${n} len:${this._set.length} context:${r.inspect(e,{showHidden:!0,depth:2,colors:!0})}`)}return e},u.prototype.run=function(e){let t=this.createContext();this.enter(t);try{if(c){const e=s.triggerAsyncId(),n=s.executionAsyncId();f(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-RUN BEGIN: (${this.name}) currentUid:${l} triggerId:${e} asyncHooksCurrentId:${n} len:${this._set.length} context:${r.inspect(t)}`)}return e(t),t}catch(e){throw e&&(e[a]=t),e}finally{if(c){const e=s.triggerAsyncId(),n=s.executionAsyncId();f(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-RUN END: (${this.name}) currentUid:${l} triggerId:${e} asyncHooksCurrentId:${n} len:${this._set.length} ${r.inspect(t)}`)}this.exit(t)}},u.prototype.runAndReturn=function(e){let t;return this.run((function(n){t=e(n)})),t},u.prototype.runPromise=function(e){let t=this.createContext();this.enter(t);let n=e(t);if(!n||!n.then||!n.catch)throw new Error("fn must return a promise.");return c&&f("CONTEXT-runPromise BEFORE: ("+this.name+") currentUid:"+l+" len:"+this._set.length+" "+r.inspect(t)),n.then((e=>(c&&f("CONTEXT-runPromise AFTER then: ("+this.name+") currentUid:"+l+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e))).catch((e=>{throw e[a]=t,c&&f("CONTEXT-runPromise AFTER catch: ("+this.name+") currentUid:"+l+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e}))},u.prototype.bind=function(e,t){t||(t=this.active?this.active:this.createContext());let n=this;return function(){n.enter(t);try{return e.apply(this,arguments)}catch(e){throw e&&(e[a]=t),e}finally{n.exit(t)}}},u.prototype.enter=function(e){if(i.ok(e,"context must be provided for entering"),c){const t=s.executionAsyncId(),n=s.triggerAsyncId();f(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-ENTER: (${this.name}) currentUid:${l} triggerId:${n} asyncHooksCurrentId:${t} len:${this._set.length} ${r.inspect(e)}`)}this._set.push(this.active),this.active=e},u.prototype.exit=function(e){if(i.ok(e,"context must be provided for exiting"),c){const t=s.executionAsyncId(),n=s.triggerAsyncId();f(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-EXIT: (${this.name}) currentUid:${l} triggerId:${n} asyncHooksCurrentId:${t} len:${this._set.length} ${r.inspect(e)}`)}if(this.active===e)return i.ok(this._set.length,"can't remove top context"),void(this.active=this._set.pop());let t=this._set.lastIndexOf(e);t<0?(c&&f("??ERROR?? context exiting but not entered - ignoring: "+r.inspect(e)),i.ok(t>=0,"context not currently entered; can't exit. \n"+r.inspect(this)+"\n"+r.inspect(e))):(i.ok(t,"can't remove top context"),this._set.splice(t,1))},u.prototype.bindEmitter=function(e){i.ok(e.on&&e.addListener&&e.emit,"can only bind real EEs");let t=this,n="context@"+this.name;o(e,(function(e){e&&(e["cls@contexts"]||(e["cls@contexts"]=Object.create(null)),e["cls@contexts"][n]={namespace:t,context:t.active})}),(function(e){if(!e||!e["cls@contexts"])return e;let t=e,n=e["cls@contexts"];return Object.keys(n).forEach((function(e){let r=n[e];t=r.namespace.bind(t,r.context)})),t}))},u.prototype.fromException=function(e){return e[a]},process.namespaces={}},9562:(e,t,n)=>{"use strict";const r=n(1249);process&&r.gte(process.versions.node,"8.0.0")?e.exports=n(3964):e.exports=n(4046)},1048:e=>{e.exports=function(e,n){for(var r=[],i=0;i{"use strict";var r=n(2357),i=n(9867),o="error@context";function s(e){this.name=e,this.active=null,this._set=[],this.id=null}function a(e){return process.namespaces[e]}function c(e){var t=a(e);r.ok(t,"can't delete nonexistent namespace!"),r.ok(t.id,"don't assign to process.namespaces directly!"),process.removeAsyncListener(t.id),process.namespaces[e]=null}function l(){process.namespaces&&Object.keys(process.namespaces).forEach((function(e){c(e)})),process.namespaces=Object.create(null)}process.addAsyncListener||n(7645),s.prototype.set=function(e,t){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");return this.active[e]=t,t},s.prototype.get=function(e){if(this.active)return this.active[e]},s.prototype.createContext=function(){return Object.create(this.active)},s.prototype.run=function(e){var t=this.createContext();this.enter(t);try{return e(t),t}catch(e){throw e&&(e[o]=t),e}finally{this.exit(t)}},s.prototype.runAndReturn=function(e){var t;return this.run((function(n){t=e(n)})),t},s.prototype.bind=function(e,t){t||(t=this.active?this.active:this.createContext());var n=this;return function(){n.enter(t);try{return e.apply(this,arguments)}catch(e){throw e&&(e[o]=t),e}finally{n.exit(t)}}},s.prototype.enter=function(e){r.ok(e,"context must be provided for entering"),this._set.push(this.active),this.active=e},s.prototype.exit=function(e){if(r.ok(e,"context must be provided for exiting"),this.active===e)return r.ok(this._set.length,"can't remove top context"),void(this.active=this._set.pop());var t=this._set.lastIndexOf(e);r.ok(t>=0,"context not currently entered; can't exit"),r.ok(t,"can't remove top context"),this._set.splice(t,1)},s.prototype.bindEmitter=function(e){r.ok(e.on&&e.addListener&&e.emit,"can only bind real EEs");var t=this,n="context@"+this.name;i(e,(function(e){e&&(e["cls@contexts"]||(e["cls@contexts"]=Object.create(null)),e["cls@contexts"][n]={namespace:t,context:t.active})}),(function(e){if(!e||!e["cls@contexts"])return e;var t=e,n=e["cls@contexts"];return Object.keys(n).forEach((function(e){var r=n[e];t=r.namespace.bind(t,r.context)})),t}))},s.prototype.fromException=function(e){return e[o]},process.namespaces||l(),e.exports={getNamespace:a,createNamespace:function(e){r.ok(e,"namespace must be given a name!");var t=new s(e);return t.id=process.addAsyncListener({create:function(){return t.active},before:function(e,n){n&&t.enter(n)},after:function(e,n){n&&t.exit(n)},error:function(e){e&&t.exit(e)}}),process.namespaces[e]=t,t},destroyNamespace:c,reset:l}},296:e=>{function t(e,t,n){var r,i,o,s,a;function c(){var l=Date.now()-s;l=0?r=setTimeout(c,t-l):(r=null,n||(a=e.apply(o,i),o=i=null))}null==t&&(t=100);var l=function(){o=this,i=arguments,s=Date.now();var l=n&&!r;return r||(r=setTimeout(c,t)),l&&(a=e.apply(o,i),o=i=null),a};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(a=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},l}t.debounce=t,e.exports=t},1227:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(2447)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},2447:(e,t,n)=>{e.exports=function(e){function t(e){let n,i=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=n(1227):e.exports=n(39)},39:(e,t,n)=>{const r=n(3867),i=n(1669);t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=n(2130);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=n(2447)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}},8604:function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n= 1.0.0 < 2.0.0",patch:function(e){try{var n=new(0,Object(function(){var e=new Error("Cannot find module '@opentelemetry/tracing'");throw e.code="MODULE_NOT_FOUND",e}()).BasicTracer)(i.channel.spanContextPropagator?{scopeManager:i.channel.spanContextPropagator}:void 0),s=n.startSpan;n.startSpan=function(e,t){if(!t||!t.parent){var i=n.getCurrentSpan();i&&i.operation&&i.operation.traceparent&&(t=r({},t,{parent:{traceId:i.operation.traceparent.traceId,spanId:i.operation.traceparent.spanId}}))}var o=s.call(this,e,t);return o.addEvent("Application Insights Integration enabled"),o},n.addSpanProcessor(new o),n[t.AzureMonitorSymbol]=!0,e.setTracer(n)}catch(e){}return e}},t.enable=function(){i.channel.registerMonkeyPatch("@azure/core-tracing",t.azureCoreTracing)}},8859:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.bunyan={versionSpecifier:">= 1.0.0 < 2.0.0",patch:function(e){var t=e.prototype._emit;return e.prototype._emit=function(e,n){var i=t.apply(this,arguments);if(!n){var o=i;o||(o=t.call(this,e,!0)),r.channel.publish("bunyan",{level:e.level,result:o})}return i},e}},t.enable=function(){r.channel.registerMonkeyPatch("bunyan",t.bunyan)}},2495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953),i=n(2413);t.console={versionSpecifier:">= 4.0.0",patch:function(e){var t=new i.Writable,n=new i.Writable;t.write=function(e){if(!e)return!0;var t=e.toString();return r.channel.publish("console",{message:t}),!0},n.write=function(e){if(!e)return!0;var t=e.toString();return r.channel.publish("console",{message:t,stderr:!0}),!0};for(var o=new e.Console(t,n),s=function(t){var n=e[t];n&&(e[t]=function(){if(o[t])try{o[t].apply(o,arguments)}catch(e){}return n.apply(e,arguments)})},a=0,c=["log","info","warn","error","dir","time","timeEnd","trace","assert"];a{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8604);t.azuresdk=r;var i=n(8859);t.bunyan=i;var o=n(2495);t.console=o;var s=n(2028);t.mongodbCore=s;var a=n(8436);t.mongodb=a;var c=n(8002);t.mysql=c;var l=n(9024);t.pgPool=l;var u=n(2080);t.pg=u;var p=n(4487);t.redis=p;var d=n(6661);t.tedious=d;var f=n(4650);t.winston=f,t.enable=function(){i.enable(),o.enable(),s.enable(),a.enable(),c.enable(),u.enable(),l.enable(),p.enable(),f.enable(),r.enable(),d.enable()}},2028:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.mongoCore={versionSpecifier:">= 2.0.0 < 4.0.0",patch:function(e){var t=e.Server.prototype.connect;return e.Server.prototype.connect=function(){var e=t.apply(this,arguments),n=this.s.pool.write;this.s.pool.write=function(){var e="function"==typeof arguments[1]?1:2;return"function"==typeof arguments[e]&&(arguments[e]=r.channel.bindToContext(arguments[e])),n.apply(this,arguments)};var i=this.s.pool.logout;return this.s.pool.logout=function(){return"function"==typeof arguments[1]&&(arguments[1]=r.channel.bindToContext(arguments[1])),i.apply(this,arguments)},e},e}},t.enable=function(){r.channel.registerMonkeyPatch("mongodb-core",t.mongoCore)}},8436:function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n= 2.0.0 <= 3.0.5",patch:function(e){var t=e.instrument({operationIdGenerator:{next:function(){return i.channel.bindToContext((function(e){return e()}))}}}),n={};return t.on("started",(function(e){n[e.requestId]||(n[e.requestId]=r({},e,{time:new Date}))})),t.on("succeeded",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"function"==typeof e.operationId?e.operationId((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})):i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})),t.on("failed",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"function"==typeof e.operationId?e.operationId((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})):i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})),e}},t.mongo3={versionSpecifier:"> 3.0.5 < 3.3.0",patch:function(e){var t=e.instrument(),n={},o={};return t.on("started",(function(e){n[e.requestId]||(o[e.requestId]=i.channel.bindToContext((function(e){return e()})),n[e.requestId]=r({},e,{time:new Date}))})),t.on("succeeded",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof o[e.requestId]&&(o[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})),delete o[e.requestId])})),t.on("failed",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof o[e.requestId]&&(o[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})),delete o[e.requestId])})),e}},t.mongo330={versionSpecifier:">= 3.3.0 < 4.0.0",patch:function(e){!function(e){var t=e.Server.prototype.connect;e.Server.prototype.connect=function(){var e=t.apply(this,arguments),n=this.s.coreTopology.s.pool.write;this.s.coreTopology.s.pool.write=function(){var e="function"==typeof arguments[1]?1:2;return"function"==typeof arguments[e]&&(arguments[e]=i.channel.bindToContext(arguments[e])),n.apply(this,arguments)};var r=this.s.coreTopology.s.pool.logout;return this.s.coreTopology.s.pool.logout=function(){return"function"==typeof arguments[1]&&(arguments[1]=i.channel.bindToContext(arguments[1])),r.apply(this,arguments)},e}}(e);var t=e.instrument(),n={},r={};return t.on("started",(function(e){n[e.requestId]||(r[e.requestId]=i.channel.bindToContext((function(e){return e()})),n[e.requestId]=e)})),t.on("succeeded",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof r[e.requestId]&&(r[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})),delete r[e.requestId])})),t.on("failed",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof r[e.requestId]&&(r[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})),delete r[e.requestId])})),e}},t.enable=function(){i.channel.registerMonkeyPatch("mongodb",t.mongo2),i.channel.registerMonkeyPatch("mongodb",t.mongo3),i.channel.registerMonkeyPatch("mongodb",t.mongo330)}},8002:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953),i=n(5622);t.mysql={versionSpecifier:">= 2.0.0 < 3.0.0",patch:function(e,t){var o=function(e,t){return function(t,n){var i=e[t];i&&(e[t]=function(){for(var e=arguments.length-1,t=arguments.length-1;t>=0;--t){if("function"==typeof arguments[t]){e=t;break}if(void 0!==arguments[t])break}var o=arguments[e],s={result:null,startTime:null,startDate:null};"function"==typeof o&&(n?(s.startTime=process.hrtime(),s.startDate=new Date,arguments[e]=r.channel.bindToContext(n(s,o))):arguments[e]=r.channel.bindToContext(o));var a=i.apply(this,arguments);return s.result=a,a})}},s=function(e,t){return o(e.prototype)},a=n(4694)(i.dirname(t)+"/lib/Connection");["connect","changeUser","ping","statistics","end"].forEach((function(e){return s(a)(e)})),o(a)("createQuery",(function(e,t){return function(n){var i=process.hrtime(e.startTime),o=1e3*i[0]+i[1]/1e6|0;r.channel.publish("mysql",{query:e.result,callbackArgs:arguments,err:n,duration:o,time:e.startDate}),t.apply(this,arguments)}}));var c=n(420)(i.dirname(t)+"/lib/Pool");return["_enqueueCallback"].forEach((function(e){return s(c)(e)})),e}},t.enable=function(){r.channel.registerMonkeyPatch("mysql",t.mysql)}},9024:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.postgresPool1={versionSpecifier:">= 1.0.0 < 3.0.0",patch:function(e){var t=e.prototype.connect;return e.prototype.connect=function(e){return e&&(arguments[0]=r.channel.bindToContext(e)),t.apply(this,arguments)},e}},t.enable=function(){r.channel.registerMonkeyPatch("pg-pool",t.postgresPool1)}},2080:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953),i=n(8614);t.postgres6={versionSpecifier:"6.*",patch:function(e,t){var n=e.Client.prototype.query,o="__diagnosticOriginalFunc";return e.Client.prototype.query=function(e,t,s){var a,c={query:{},database:{host:this.connectionParameters.host,port:this.connectionParameters.port},result:null,error:null,duration:0,time:new Date},l=process.hrtime();function u(e){e&&e[o]&&(e=e[o]);var t=r.channel.bindToContext((function(t,n){var o=process.hrtime(l);if(c.result=n&&{rowCount:n.rowCount,command:n.command},c.error=t,c.duration=Math.ceil(1e3*o[0]+o[1]/1e6),r.channel.publish("postgres",c),t){if(e)return e.apply(this,arguments);a&&a instanceof i.EventEmitter&&a.emit("error",t)}else e&&e.apply(this,arguments)}));try{return Object.defineProperty(t,o,{value:e}),t}catch(t){return e}}try{"string"==typeof e?t instanceof Array?(c.query.preparable={text:e,args:t},s=u(s)):(c.query.text=e,s?s=u(s):t=u(t)):("string"==typeof e.name?c.query.plan=e.name:e.values instanceof Array?c.query.preparable={text:e.text,args:e.values}:c.query.text=e.text,s?s=u(s):t?t=u(t):e.callback=u(e.callback))}catch(e){return n.apply(this,arguments)}return arguments[0]=e,arguments[1]=t,arguments[2]=s,arguments.length=arguments.length>3?arguments.length:3,a=n.apply(this,arguments)},e}},t.postgres7={versionSpecifier:">=7.* <=8.*",patch:function(e,t){var n=e.Client.prototype.query,o="__diagnosticOriginalFunc";return e.Client.prototype.query=function(e,t,s){var a,c=this,l=!!s,u={query:{},database:{host:this.connectionParameters.host,port:this.connectionParameters.port},result:null,error:null,duration:0,time:new Date},p=process.hrtime();function d(e){e&&e[o]&&(e=e[o]);var t=r.channel.bindToContext((function(t,n){var o=process.hrtime(p);if(u.result=n&&{rowCount:n.rowCount,command:n.command},u.error=t,u.duration=Math.ceil(1e3*o[0]+o[1]/1e6),r.channel.publish("postgres",u),t){if(e)return e.apply(this,arguments);a&&a instanceof i.EventEmitter&&a.emit("error",t)}else e&&e.apply(this,arguments)}));try{return Object.defineProperty(t,o,{value:e}),t}catch(t){return e}}try{"string"==typeof e?t instanceof Array?(u.query.preparable={text:e,args:t},s=(l="function"==typeof s)?d(s):s):(u.query.text=e,s?s=(l="function"==typeof s)?d(s):s:t=(l="function"==typeof t)?d(t):t):("string"==typeof e.name?u.query.plan=e.name:e.values instanceof Array?u.query.preparable={text:e.text,args:e.values}:u.query.text=e.text,s?(l="function"==typeof s,s=d(s)):t?t=(l="function"==typeof t)?d(t):t:(l="function"==typeof e.callback,e.callback=l?d(e.callback):e.callback))}catch(e){return n.apply(this,arguments)}return arguments[0]=e,arguments[1]=t,arguments[2]=s,arguments.length=arguments.length>3?arguments.length:3,a=n.apply(this,arguments),l?a:a.then((function(e){return d()(void 0,e),new c._Promise((function(t,n){t(e)}))})).catch((function(e){return d()(e,void 0),new c._Promise((function(t,n){n(e)}))}))},e}},t.enable=function(){r.channel.registerMonkeyPatch("pg",t.postgres6),r.channel.registerMonkeyPatch("pg",t.postgres7)}},4487:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.redis={versionSpecifier:">= 2.0.0 < 4.0.0",patch:function(e){var t=e.RedisClient.prototype.internal_send_command;return e.RedisClient.prototype.internal_send_command=function(e){if(e){var n=e.callback;if(!n||!n.pubsubBound){var i=this.address,o=process.hrtime(),s=new Date;e.callback=r.channel.bindToContext((function(t,a){var c=process.hrtime(o),l=1e3*c[0]+c[1]/1e6|0;r.channel.publish("redis",{duration:l,address:i,commandObj:e,err:t,result:a,time:s}),"function"==typeof n&&n.apply(this,arguments)})),e.callback.pubsubBound=!0}}return t.call(this,e)},e}},t.enable=function(){r.channel.registerMonkeyPatch("redis",t.redis)}},6661:function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n= 6.0.0 < 9.0.0",patch:function(e){var t=e.Connection.prototype.makeRequest;return e.Connection.prototype.makeRequest=function(){function e(e){var t=process.hrtime(),n={query:{},database:{host:null,port:null},result:null,error:null,duration:0};return i.channel.bindToContext((function(o,s,a){var c=process.hrtime(t);n=r({},n,{database:{host:this.connection.config.server,port:this.connection.config.options.port},result:!o&&{rowCount:s,rows:a},query:{text:this.parametersByName.statement.value},error:o,duration:Math.ceil(1e3*c[0]+c[1]/1e6)}),i.channel.publish("tedious",n),e.call(this,o,s,a)}))}var n=arguments[0];arguments[0].callback=e(n.callback),t.apply(this,arguments)},e}},t.enable=function(){i.channel.registerMonkeyPatch("tedious",t.tedious)}},4650:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);ir[n]?i:n);this.add(new t(e,{level:n}))}var r=e.createLogger;e.createLogger=function(){var i,o=arguments[0].levels||e.config.npm.levels;for(var s in o)o.hasOwnProperty(s)&&(i=void 0===i||o[s]>o[i]?s:i);var a=r.apply(this,arguments);a.add(new t(e,{level:i}));var c=a.configure;return a.configure=function(){c.apply(this,arguments),n.apply(this,arguments)},a};var a=e.createLogger;return e.configure=function(){a.apply(this,arguments),n.apply(this,arguments)},e.add(new t(e)),e}},t.winston2={versionSpecifier:"2.x",patch:function(e){var t,n=e.Logger.prototype.log,r=function(n,r,i){var o;return o=t===e.config.npm.levels?"npm":t===e.config.syslog.levels?"syslog":"unknown",s.channel.publish("winston",{level:n,message:r,meta:i,levelKind:o}),r};return e.Logger.prototype.log=function(){return t=this.levels,this.filters&&0!==this.filters.length?this.filters[this.filters.length-1]!==r&&(this.filters=this.filters.filter((function(e){return e!==r})),this.filters.push(r)):this.filters=[r],n.apply(this,arguments)},e}},t.enable=function(){s.channel.registerMonkeyPatch("winston",t.winston2),s.channel.registerMonkeyPatch("winston",t.winston3)}},4694:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=4694,e.exports=t},420:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=420,e.exports=t},4953:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7424),i=n(7424);t.makePatchingRequire=i.makePatchingRequire;var o=function(e){return!0},s=function(){function e(){this.version=n(5236).i8,this.subscribers={},this.contextPreservationFunction=function(e){return e},this.knownPatches={},this.currentlyPublishing=!1}return e.prototype.shouldPublish=function(e){var t=this.subscribers[e];return!!t&&t.some((function(e){var t=e.filter;return!t||t(!1)}))},e.prototype.publish=function(e,t){if(!this.currentlyPublishing){var n=this.subscribers[e];if(n){var r={timestamp:Date.now(),data:t};this.currentlyPublishing=!0,n.forEach((function(e){var t=e.listener,n=e.filter;try{n&&n(!0)&&t(r)}catch(e){}})),this.currentlyPublishing=!1}}},e.prototype.subscribe=function(e,t,n){void 0===n&&(n=o),this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push({listener:t,filter:n})},e.prototype.unsubscribe=function(e,t,n){void 0===n&&(n=o);var r=this.subscribers[e];if(r)for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5622),i=n(1249),o=n(2282),s=Object.keys(process.binding("natives")),a=o.prototype.require;t.makePatchingRequire=function(e){var t={};return function(n){var c=a.apply(this,arguments);if(e[n]){var l=o._resolveFilename(n,this);if(t.hasOwnProperty(l))return t[l];var u=void 0;if(s.indexOf(n)<0)try{u=a.call(this,r.join(n,"package.json")).version}catch(e){return c}else u=process.version.substring(1);var p=u.indexOf("-");p>=0&&(u=u.substring(0,p));for(var d=c,f=0,h=e[n];f{"use strict";e.exports={i8:"0.2.0"}},9867:(e,t,n)=>{"use strict";var r=n(6372),i=r.wrap,o=r.unwrap,s="wrap@before";function a(e,t,n){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function c(e,t){var n;return n=e._events&&e._events[t],Array.isArray(n)||(n=n?[n]:[]),n}function l(e,t,n){var r=c(e,t).filter((function(e){return-1===n.indexOf(e)}));r.length>0&&function(e,t){for(var n=t.length,r=0;r{var r=n(778),i=function(){},o=function(e,t,n){if("function"==typeof t)return o(e,null,t);t||(t={}),n=r(n||i);var s=e._writableState,a=e._readableState,c=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,u=!1,p=function(){e.writable||d()},d=function(){l=!1,c||n.call(e)},f=function(){c=!1,l||n.call(e)},h=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){n.call(e,t)},g=function(){process.nextTick(v)},v=function(){if(!u)return(!c||a&&a.ended&&!a.destroyed)&&(!l||s&&s.ended&&!s.destroyed)?void 0:n.call(e,new Error("premature close"))},y=function(){e.req.on("finish",d)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?l&&!s&&(e.on("end",p),e.on("close",p)):(e.on("complete",d),e.on("abort",g),e.req?y():e.on("request",y)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",h),e.on("end",f),e.on("finish",d),!1!==t.error&&e.on("error",m),e.on("close",g),function(){u=!0,e.removeListener("complete",d),e.removeListener("abort",g),e.removeListener("request",y),e.req&&e.req.removeListener("finish",d),e.removeListener("end",p),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("exit",h),e.removeListener("end",f),e.removeListener("error",m),e.removeListener("close",g)}};e.exports=o},2106:(e,t,n)=>{const r=n(5158)("extract-zip"),{createWriteStream:i,promises:o}=n(5747),s=n(31),a=n(5622),{promisify:c}=n(1669),l=n(2413),u=n(7766),p=c(u.open),d=c(l.pipeline);class f{constructor(e,t){this.zipPath=e,this.opts=t}async extract(){return r("opening",this.zipPath,"with opts",this.opts),this.zipfile=await p(this.zipPath,{lazyEntries:!0}),this.canceled=!1,new Promise(((e,t)=>{this.zipfile.on("error",(e=>{this.canceled=!0,t(e)})),this.zipfile.readEntry(),this.zipfile.on("close",(()=>{this.canceled||(r("zip extraction complete"),e())})),this.zipfile.on("entry",(async e=>{if(this.canceled)return void r("skipping entry",e.fileName,{cancelled:this.canceled});if(r("zipfile entry",e.fileName),e.fileName.startsWith("__MACOSX/"))return void this.zipfile.readEntry();const n=a.dirname(a.join(this.opts.dir,e.fileName));try{await o.mkdir(n,{recursive:!0});const t=await o.realpath(n);if(a.relative(this.opts.dir,t).split(a.sep).includes(".."))throw new Error(`Out of bound path "${t}" found while processing file ${e.fileName}`);await this.extractEntry(e),r("finished processing",e.fileName),this.zipfile.readEntry()}catch(e){this.canceled=!0,this.zipfile.close(),t(e)}}))}))}async extractEntry(e){if(this.canceled)return void r("skipping entry extraction",e.fileName,{cancelled:this.canceled});this.opts.onEntry&&this.opts.onEntry(e,this.zipfile);const t=a.join(this.opts.dir,e.fileName),n=e.externalFileAttributes>>16&65535,l=40960==(61440&n);let u=16384==(61440&n);!u&&e.fileName.endsWith("/")&&(u=!0);const p=e.versionMadeBy>>8;u||(u=0===p&&16===e.externalFileAttributes),r("extracting entry",{filename:e.fileName,isDir:u,isSymlink:l});const f=511&this.getExtractedMode(n,u),h=u?t:a.dirname(t),m={recursive:!0};if(u&&(m.mode=f),r("mkdir",{dir:h,...m}),await o.mkdir(h,m),u)return;r("opening read stream",t);const g=await c(this.zipfile.openReadStream.bind(this.zipfile))(e);if(l){const e=await s(g);r("creating symlink",e,t),await o.symlink(e,t)}else await d(g,i(t,{mode:f}))}getExtractedMode(e,t){let n=e;return 0===n&&(t?(this.opts.defaultDirMode&&(n=parseInt(this.opts.defaultDirMode,10)),n||(n=493)):(this.opts.defaultFileMode&&(n=parseInt(this.opts.defaultFileMode,10)),n||(n=420))),n}}e.exports=async function(e,t){if(r("creating target directory",t.dir),!a.isAbsolute(t.dir))throw new Error("Target directory is expected to be absolute");return await o.mkdir(t.dir,{recursive:!0}),t.dir=await o.realpath(t.dir),new f(e,t).extract()}},8913:(e,t,n)=>{var r=n(5747),i=n(1669),o=n(2413),s=o.Readable,a=o.Writable,c=o.PassThrough,l=n(9916),u=n(8614).EventEmitter;function p(e,t){t=t||{},u.call(this),this.fd=e,this.pend=new l,this.pend.max=1,this.refCount=0,this.autoClose=!!t.autoClose}function d(e,t){t=t||{},s.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start,this.destroyed=!1}function f(e,t){t=t||{},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=null==t.end?1/0:+t.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}function h(e,t){u.call(this),t=t||{},this.refCount=0,this.buffer=e,this.maxChunkSize=t.maxChunkSize||Number.MAX_SAFE_INTEGER}t.createFromBuffer=function(e,t){return new h(e,t)},t.createFromFd=function(e,t){return new p(e,t)},t.BufferSlicer=h,t.FdSlicer=p,i.inherits(p,u),p.prototype.read=function(e,t,n,i,o){var s=this;s.pend.go((function(a){r.read(s.fd,e,t,n,i,(function(e,t,n){a(),o(e,t,n)}))}))},p.prototype.write=function(e,t,n,i,o){var s=this;s.pend.go((function(a){r.write(s.fd,e,t,n,i,(function(e,t,n){a(),o(e,t,n)}))}))},p.prototype.createReadStream=function(e){return new d(this,e)},p.prototype.createWriteStream=function(e){return new f(this,e)},p.prototype.ref=function(){this.refCount+=1},p.prototype.unref=function(){var e=this;if(e.refCount-=1,!(e.refCount>0)){if(e.refCount<0)throw new Error("invalid unref");e.autoClose&&r.close(e.fd,(function(t){t?e.emit("error",t):e.emit("close")}))}},i.inherits(d,s),d.prototype._read=function(e){var t=this;if(!t.destroyed){var n=Math.min(t._readableState.highWaterMark,e);if(null!=t.endOffset&&(n=Math.min(n,t.endOffset-t.pos)),n<=0)return t.destroyed=!0,t.push(null),void t.context.unref();t.context.pend.go((function(e){if(t.destroyed)return e();var i=new Buffer(n);r.read(t.context.fd,i,0,n,t.pos,(function(n,r){n?t.destroy(n):0===r?(t.destroyed=!0,t.push(null),t.context.unref()):(t.pos+=r,t.push(i.slice(0,r))),e()}))}))}},d.prototype.destroy=function(e){this.destroyed||(e=e||new Error("stream destroyed"),this.destroyed=!0,this.emit("error",e),this.context.unref())},i.inherits(f,a),f.prototype._write=function(e,t,n){var i=this;if(!i.destroyed){if(i.pos+e.length>i.endOffset){var o=new Error("maximum file length exceeded");return o.code="ETOOBIG",i.destroy(),void n(o)}i.context.pend.go((function(t){if(i.destroyed)return t();r.write(i.context.fd,e,0,e.length,i.pos,(function(e,r){e?(i.destroy(),t(),n(e)):(i.bytesWritten+=r,i.pos+=r,i.emit("progress"),t(),n())}))}))}},f.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.context.unref())},i.inherits(h,u),h.prototype.read=function(e,t,n,r,i){var o=r+n,s=o-this.buffer.length,a=s>0?s:n;this.buffer.copy(e,t,r,o),setImmediate((function(){i(null,a)}))},h.prototype.write=function(e,t,n,r,i){e.copy(this.buffer,r,t,t+n),setImmediate((function(){i(null,n,e)}))},h.prototype.createReadStream=function(e){var t=new c(e=e||{});t.destroyed=!1,t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=0;;){var i=r+this.maxChunkSize;if(i>=n.length){rn.endOffset){var s=new Error("maximum file length exceeded");return s.code="ETOOBIG",n.destroyed=!0,void i(s)}e.copy(t.buffer,n.pos,0,e.length),n.bytesWritten+=e.length,n.pos=o,n.emit("progress"),i()}},n.destroy=function(){n.destroyed=!0},n},h.prototype.ref=function(){this.refCount+=1},h.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw new Error("invalid unref")}},7334:(e,t,n)=>{e.exports=u,u.realpath=u,u.sync=p,u.realpathSync=p,u.monkeypatch=function(){r.realpath=u,r.realpathSync=p},u.unmonkeypatch=function(){r.realpath=i,r.realpathSync=o};var r=n(5747),i=r.realpath,o=r.realpathSync,s=process.version,a=/^v[0-5]\./.test(s),c=n(7059);function l(e){return e&&"realpath"===e.syscall&&("ELOOP"===e.code||"ENOMEM"===e.code||"ENAMETOOLONG"===e.code)}function u(e,t,n){if(a)return i(e,t,n);"function"==typeof t&&(n=t,t=null),i(e,t,(function(r,i){l(r)?c.realpath(e,t,n):n(r,i)}))}function p(e,t){if(a)return o(e,t);try{return o(e,t)}catch(n){if(l(n))return c.realpathSync(e,t);throw n}}},7059:(e,t,n)=>{var r=n(5622),i="win32"===process.platform,o=n(5747),s=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function a(e){return"function"==typeof e?e:function(){var e;if(s){var t=new Error;e=function(e){e&&(t.message=e.message,n(e=t))}}else e=n;return e;function n(e){if(e){if(process.throwDeprecation)throw e;if(!process.noDeprecation){var t="fs: missing callback "+(e.stack||e.message);process.traceDeprecation?console.trace(t):console.error(t)}}}}()}r.normalize;if(i)var c=/(.*?)(?:[\/\\]+|$)/g;else c=/(.*?)(?:[\/]+|$)/g;if(i)var l=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else l=/^[\/]*/;t.realpathSync=function(e,t){if(e=r.resolve(e),t&&Object.prototype.hasOwnProperty.call(t,e))return t[e];var n,s,a,u,p=e,d={},f={};function h(){var t=l.exec(e);n=t[0].length,s=t[0],a=t[0],u="",i&&!f[a]&&(o.lstatSync(a),f[a]=!0)}for(h();n=e.length)return t&&(t[f]=e),n(null,e);c.lastIndex=s;var r=c.exec(e);return d=u,u+=r[0],p=d+r[1],s=c.lastIndex,m[p]||t&&t[p]===p?process.nextTick(v):t&&Object.prototype.hasOwnProperty.call(t,p)?E(t[p]):o.lstat(p,y)}function y(e,r){if(e)return n(e);if(!r.isSymbolicLink())return m[p]=!0,t&&(t[p]=p),process.nextTick(v);if(!i){var s=r.dev.toString(32)+":"+r.ino.toString(32);if(h.hasOwnProperty(s))return _(null,h[s],p)}o.stat(p,(function(e){if(e)return n(e);o.readlink(p,(function(e,t){i||(h[s]=t),_(e,t)}))}))}function _(e,i,o){if(e)return n(e);var s=r.resolve(d,i);t&&(t[o]=s),E(s)}function E(t){e=r.resolve(t,e.slice(s)),g()}g()}},5105:(e,t,n)=>{"use strict";const{PassThrough:r}=n(2413);e.exports=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const i="buffer"===n;let o=!1;t?o=!(n||i):n=n||"utf8",i&&(n=null);const s=new r({objectMode:o});n&&s.setEncoding(n);let a=0;const c=[];return s.on("data",(e=>{c.push(e),o?a=c.length:a+=e.length})),s.getBufferedValue=()=>t?c:i?Buffer.concat(c,a):c.join(""),s.getBufferedLength=()=>a,s}},31:(e,t,n)=>{"use strict";const{constants:r}=n(4293),i=n(4286),o=n(5105);class s extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function a(e,t){if(!e)return Promise.reject(new Error("Expected a stream"));t={maxBuffer:1/0,...t};const{maxBuffer:n}=t;let a;return await new Promise(((c,l)=>{const u=e=>{e&&a.getBufferedLength()<=r.MAX_LENGTH&&(e.bufferedData=a.getBufferedValue()),l(e)};a=i(e,o(t),(e=>{e?u(e):c()})),a.on("data",(()=>{a.getBufferedLength()>n&&u(new s)}))})),a.getBufferedValue()}e.exports=a,e.exports.default=a,e.exports.buffer=(e,t)=>a(e,{...t,encoding:"buffer"}),e.exports.array=(e,t)=>a(e,{...t,array:!0}),e.exports.MaxBufferError=s},6772:(e,t,n)=>{function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.alphasort=l,t.alphasorti=c,t.setopts=function(e,t,n){n||(n={});if(n.matchBase&&-1===t.indexOf("/")){if(n.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!n.silent,e.pattern=t,e.strict=!1!==n.strict,e.realpath=!!n.realpath,e.realpathCache=n.realpathCache||Object.create(null),e.follow=!!n.follow,e.dot=!!n.dot,e.mark=!!n.mark,e.nodir=!!n.nodir,e.nodir&&(e.mark=!0);e.sync=!!n.sync,e.nounique=!!n.nounique,e.nonull=!!n.nonull,e.nosort=!!n.nosort,e.nocase=!!n.nocase,e.stat=!!n.stat,e.noprocess=!!n.noprocess,e.absolute=!!n.absolute,e.maxLength=n.maxLength||1/0,e.cache=n.cache||Object.create(null),e.statCache=n.statCache||Object.create(null),e.symlinks=n.symlinks||Object.create(null),function(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]);e.ignore.length&&(e.ignore=e.ignore.map(u))}(e,n),e.changedCwd=!1;var o=process.cwd();r(n,"cwd")?(e.cwd=i.resolve(n.cwd),e.changedCwd=e.cwd!==o):e.cwd=o;e.root=n.root||i.resolve(e.cwd,"/"),e.root=i.resolve(e.root),"win32"===process.platform&&(e.root=e.root.replace(/\\/g,"/"));e.cwdAbs=s(e.cwd)?e.cwd:p(e,e.cwd),"win32"===process.platform&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,"/"));e.nomount=!!n.nomount,n.nonegate=!0,n.nocomment=!0,e.minimatch=new a(t,n),e.options=e.minimatch.options},t.ownProp=r,t.makeAbs=p,t.finish=function(e){for(var t=e.nounique,n=t?[]:Object.create(null),r=0,i=e.matches.length;r{e.exports=_;var r=n(5747),i=n(7334),o=n(1171),s=(o.Minimatch,n(4378)),a=n(8614).EventEmitter,c=n(5622),l=n(2357),u=n(4095),p=n(4751),d=n(6772),f=(d.alphasort,d.alphasorti,d.setopts),h=d.ownProp,m=n(7844),g=(n(1669),d.childrenIgnored),v=d.isIgnored,y=n(778);function _(e,t,n){if("function"==typeof t&&(n=t,t={}),t||(t={}),t.sync){if(n)throw new TypeError("callback provided to sync glob");return p(e,t)}return new b(e,t,n)}_.sync=p;var E=_.GlobSync=p.GlobSync;function b(e,t,n){if("function"==typeof t&&(n=t,t=null),t&&t.sync){if(n)throw new TypeError("callback provided to sync glob");return new E(e,t)}if(!(this instanceof b))return new b(e,t,n);f(this,e,t),this._didRealPath=!1;var r=this.minimatch.set.length;this.matches=new Array(r),"function"==typeof n&&(n=y(n),this.on("error",n),this.on("end",(function(e){n(null,e)})));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(0===r)return s();for(var o=0;o1)return!0;for(var i=0;ithis.maxLength)return t();if(!this.stat&&h(this.cache,n)){var o=this.cache[n];if(Array.isArray(o)&&(o="DIR"),!i||"DIR"===o)return t(null,o);if(i&&"FILE"===o)return t()}var s=this.statCache[n];if(void 0!==s){if(!1===s)return t(null,s);var a=s.isDirectory()?"DIR":"FILE";return i&&"FILE"===a?t():t(null,a,s)}var c=this,l=m("stat\0"+n,(function(i,o){if(o&&o.isSymbolicLink())return r.stat(n,(function(r,i){r?c._stat2(e,n,null,o,t):c._stat2(e,n,r,i,t)}));c._stat2(e,n,i,o,t)}));l&&r.lstat(n,l)},b.prototype._stat2=function(e,t,n,r,i){if(n&&("ENOENT"===n.code||"ENOTDIR"===n.code))return this.statCache[t]=!1,i();var o="/"===e.slice(-1);if(this.statCache[t]=r,"/"===t.slice(-1)&&r&&!r.isDirectory())return i(null,!1,r);var s=!0;return r&&(s=r.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||s,o&&"FILE"===s?i():i(null,s,r)}},4751:(e,t,n)=>{e.exports=h,h.GlobSync=m;var r=n(5747),i=n(7334),o=n(1171),s=(o.Minimatch,n(2884).Glob,n(1669),n(5622)),a=n(2357),c=n(4095),l=n(6772),u=(l.alphasort,l.alphasorti,l.setopts),p=l.ownProp,d=l.childrenIgnored,f=l.isIgnored;function h(e,t){if("function"==typeof t||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");return new m(e,t).found}function m(e,t){if(!e)throw new Error("must provide pattern");if("function"==typeof t||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof m))return new m(e,t);if(u(this,e,t),this.noprocess)return this;var n=this.minimatch.set.length;this.matches=new Array(n);for(var r=0;rthis.maxLength)return!1;if(!this.stat&&p(this.cache,t)){var i=this.cache[t];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return i;if(n&&"FILE"===i)return!1}var o=this.statCache[t];if(!o){var s;try{s=r.lstatSync(t)}catch(e){if(e&&("ENOENT"===e.code||"ENOTDIR"===e.code))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{o=r.statSync(t)}catch(e){o=s}else o=s}this.statCache[t]=o;i=!0;return o&&(i=o.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||i,(!n||"FILE"!==i)&&i},m.prototype._mark=function(e){return l.mark(this,e)},m.prototype._makeAbs=function(e){return l.makeAbs(this,e)}},6560:e=>{"use strict";e.exports=(e,t=process.argv)=>{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),i=t.indexOf("--");return-1!==r&&(-1===i||r{d("replaying proxy buffer for failed request"),c.default(e.listenerCount("data")>0),e.push(y),e.push(null)})),_}))}}function h(e){e.resume()}t.default=f},9829:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(5158)).default("https-proxy-agent:parse-proxy-response");t.default=function(e){return new Promise(((t,n)=>{let r=0;const o=[];function s(){const n=e.read();n?function(e){o.push(e),r+=e.length;const n=Buffer.concat(o,r);if(-1===n.indexOf("\r\n\r\n"))return i("have not received end of HTTP headers yet..."),void s();const a=n.toString("ascii",0,n.indexOf("\r\n")),c=+a.split(" ")[1];i("got proxy server response: %o",a),t({statusCode:c,buffered:n})}(n):e.once("readable",s)}function a(e){i("onclose had error %o",e)}function c(){i("onend")}function l(t){e.removeListener("end",c),e.removeListener("error",l),e.removeListener("close",a),e.removeListener("readable",s),i("onerror %o",t),n(t)}e.on("error",l),e.on("close",a),e.on("end",c),s()}))}},7844:(e,t,n)=>{var r=n(2479),i=Object.create(null),o=n(778);function s(e){for(var t=e.length,n=[],r=0;rr?(n.splice(0,r),process.nextTick((function(){t.apply(null,o)}))):delete i[e]}}))}(e))}))},4378:(e,t,n)=>{try{var r=n(1669);if("function"!=typeof r.inherits)throw"";e.exports=r.inherits}catch(t){e.exports=n(5717)}},5717: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}}},6486:function(e,t,n){var r; +(()=>{var e={8054:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(8614),o=r(n(5158)),s=r(n(6304)),a=o.default("agent-base");function c(){const{stack:e}=new Error;return"string"==typeof e&&e.split("\n").some((e=>-1!==e.indexOf("(https.js:")||-1!==e.indexOf("node:https:")))}function u(e,t){return new u.Agent(e,t)}!function(e){class t extends i.EventEmitter{constructor(e,t){super();let n=t;"function"==typeof e?this.callback=e:e&&(n=e),this.timeout=null,n&&"number"==typeof n.timeout&&(this.timeout=n.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return"number"==typeof this.explicitDefaultPort?this.explicitDefaultPort:c()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){return"string"==typeof this.explicitProtocol?this.explicitProtocol:c()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,n){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const n=Object.assign({},t);"boolean"!=typeof n.secureEndpoint&&(n.secureEndpoint=c()),null==n.host&&(n.host="localhost"),null==n.port&&(n.port=n.secureEndpoint?443:80),null==n.protocol&&(n.protocol=n.secureEndpoint?"https:":"http:"),n.host&&n.path&&delete n.path,delete n.agent,delete n.hostname,delete n._defaultAgent,delete n.defaultPort,delete n.createConnection,e._last=!0,e.shouldKeepAlive=!1;let r=!1,i=null;const o=n.timeout||this.timeout,u=t=>{e._hadError||(e.emit("error",t),e._hadError=!0)},l=()=>{i=null,r=!0;const e=new Error(`A "socket" was not created for HTTP request before ${o}ms`);e.code="ETIMEOUT",u(e)},p=e=>{r||(null!==i&&(clearTimeout(i),i=null),u(e))},f=t=>{if(r)return;if(null!=i&&(clearTimeout(i),i=null),o=t,Boolean(o)&&"function"==typeof o.addRequest)return a("Callback returned another Agent instance %o",t.constructor.name),void t.addRequest(e,n);var o;if(t)return t.once("free",(()=>{this.freeSocket(t,n)})),void e.onSocket(t);const s=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);u(s)};if("function"==typeof this.callback){this.promisifiedCallback||(this.callback.length>=3?(a("Converting legacy callback function to promise"),this.promisifiedCallback=s.default(this.callback)):this.promisifiedCallback=this.callback),"number"==typeof o&&o>0&&(i=setTimeout(l,o)),"port"in n&&"number"!=typeof n.port&&(n.port=Number(n.port));try{a("Resolving socket for %o request: %o",n.protocol,`${e.method} ${e.path}`),Promise.resolve(this.promisifiedCallback(e,n)).then(f,p)}catch(e){Promise.reject(e).catch(p)}}else u(new Error("`callback` is not defined"))}freeSocket(e,t){a("Freeing socket %o %o",e.constructor.name,t),e.destroy()}destroy(){a("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype}(u||(u={})),e.exports=u},6304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){return new Promise(((r,i)=>{e.call(this,t,n,((e,t)=>{e?i(e):r(t)}))}))}}},6281:(e,t,n)=>{"use strict";var r=n(7396),i=function(){function e(t){if(e.INSTANCE)throw new Error("Console logging adapter tracking should be configured from the applicationInsights object");this._client=t,e.INSTANCE=this}return e.prototype.enable=function(e,t){r.IsInitialized&&(n(4309).wp(e&&t,this._client),n(5823).wp(e,this._client),n(454).wp(e,this._client))},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1,!1)},e._methodNames=["debug","info","log","warn","error"],e}();e.exports=i},894:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5282),i=n(7396),o=function(){function e(){}return e.getCurrentContext=function(){if(!e.enabled)return null;var t=e.session.get(e.CONTEXT_NAME);return void 0===t?null:t},e.generateContextObject=function(e,t,n,r,i,o){return t=t||e,this.enabled?{operation:{name:n,id:e,parentId:t,traceparent:i,tracestate:o},customProperties:new s(r)}:null},e.runWithContext=function(t,n){return e.enabled?e.session.bind(n,((r={})[e.CONTEXT_NAME]=t,r))():n();var r},e.wrapEmitter=function(t){e.enabled&&e.session.bindEmitter(t)},e.wrapCallback=function(t){return e.enabled?e.session.bind(t):t},e.enable=function(t){this.enabled||(this.isNodeVersionCompatible()?(e.hasEverEnabled||(this.forceClsHooked=t,this.hasEverEnabled=!0,void 0===this.cls&&(!0===e.forceClsHooked||void 0===e.forceClsHooked&&e.shouldUseClsHooked()?this.cls=n(9562):this.cls=n(3057)),e.session=this.cls.createNamespace("AI-CLS-Session"),i.registerContextPreservation((function(t){return e.session.bind(t)}))),this.enabled=!0):this.enabled=!1)},e.disable=function(){this.enabled=!1},e.reset=function(){e.hasEverEnabled&&(e.session=null,e.session=this.cls.createNamespace("AI-CLS-Session"))},e.isNodeVersionCompatible=function(){var e=process.versions.node.split(".");return parseInt(e[0])>3||parseInt(e[0])>2&&parseInt(e[1])>2},e.shouldUseClsHooked=function(){var e=process.versions.node.split(".");return parseInt(e[0])>8||parseInt(e[0])>=8&&parseInt(e[1])>=2},e.canUseClsHooked=function(){var e=process.versions.node.split("."),t=parseInt(e[0])>8||parseInt(e[0])>=8&&parseInt(e[1])>=0,n=parseInt(e[0])<8||parseInt(e[0])<=8&&parseInt(e[1])<2,r=parseInt(e[0])>4||parseInt(e[0])>=4&&parseInt(e[1])>=7;return!(t&&n)&&r},e.enabled=!1,e.hasEverEnabled=!1,e.forceClsHooked=void 0,e.CONTEXT_NAME="ApplicationInsights-Context",e}();t.CorrelationContextManager=o;var s=function(){function e(e){this.props=[],this.addHeaderData(e)}return e.prototype.addHeaderData=function(e){var t=e?e.split(", "):[];this.props=t.map((function(e){var t=e.split("=");return{key:t[0],value:t[1]}})).concat(this.props)},e.prototype.serializeToHeader=function(){return this.props.map((function(e){return e.key+"="+e.value})).join(", ")},e.prototype.getProperty=function(e){for(var t=0;t0)for(var a=0,c=o;a{"use strict";var r=n(2087),i=n(3580),o=function(){function e(t,n,r){void 0===n&&(n=6e4),void 0===r&&(r=!1),this._lastIntervalRequestExecutionTime=0,this._lastIntervalDependencyExecutionTime=0,e.INSTANCE||(e.INSTANCE=this),this._isInitialized=!1,this._client=t,this._collectionInterval=n,this._enableLiveMetricsCounters=r}return e.prototype.enable=function(t,n){var i=this;this._isEnabled=t,this._isEnabled&&!this._isInitialized&&(this._isInitialized=!0),t?this._handle||(this._lastCpus=r.cpus(),this._lastRequests={totalRequestCount:e._totalRequestCount,totalFailedRequestCount:e._totalFailedRequestCount,time:+new Date},this._lastDependencies={totalDependencyCount:e._totalDependencyCount,totalFailedDependencyCount:e._totalFailedDependencyCount,time:+new Date},this._lastExceptions={totalExceptionCount:e._totalExceptionCount,time:+new Date},"function"==typeof process.cpuUsage&&(this._lastAppCpuUsage=process.cpuUsage()),this._lastHrtime=process.hrtime(),this._collectionInterval=n||this._collectionInterval,this._handle=setInterval((function(){return i.trackPerformance()}),this._collectionInterval),this._handle.unref()):this._handle&&(clearInterval(this._handle),this._handle=void 0)},e.countRequest=function(t,n){var r;if(e.isEnabled()){if("string"==typeof t)r=+new Date("1970-01-01T"+t+"Z");else{if("number"!=typeof t)return;r=t}e._intervalRequestExecutionTime+=r,!1===n&&e._totalFailedRequestCount++,e._totalRequestCount++}},e.countException=function(){e._totalExceptionCount++},e.countDependency=function(t,n){var r;if(e.isEnabled()){if("string"==typeof t)r=+new Date("1970-01-01T"+t+"Z");else{if("number"!=typeof t)return;r=t}e._intervalDependencyExecutionTime+=r,!1===n&&e._totalFailedDependencyCount++,e._totalDependencyCount++}},e.prototype.isInitialized=function(){return this._isInitialized},e.isEnabled=function(){return e.INSTANCE&&e.INSTANCE._isEnabled},e.prototype.trackPerformance=function(){this._trackCpu(),this._trackMemory(),this._trackNetwork(),this._trackDependencyRate(),this._trackExceptionRate()},e.prototype._trackCpu=function(){var e=r.cpus();if(e&&e.length&&this._lastCpus&&e.length===this._lastCpus.length){for(var t=0,n=0,o=0,s=0,a=0,c=0;e&&c0){var u=r/a,l=o/a;this._client.trackMetric({name:i.PerformanceCounter.REQUEST_RATE,value:u}),(!this._enableLiveMetricsCounters||r>0)&&this._client.trackMetric({name:i.PerformanceCounter.REQUEST_DURATION,value:c}),this._enableLiveMetricsCounters&&this._client.trackMetric({name:i.QuickPulseCounter.REQUEST_FAILURE_RATE,value:l})}this._lastRequests=n},e.prototype._trackDependencyRate=function(){if(this._enableLiveMetricsCounters){var t=this._lastDependencies,n={totalDependencyCount:e._totalDependencyCount,totalFailedDependencyCount:e._totalFailedDependencyCount,time:+new Date},r=n.totalDependencyCount-t.totalDependencyCount||0,o=n.totalFailedDependencyCount-t.totalFailedDependencyCount||0,s=n.time-t.time,a=s/1e3,c=(e._intervalDependencyExecutionTime-this._lastIntervalDependencyExecutionTime)/r||0;if(this._lastIntervalDependencyExecutionTime=e._intervalDependencyExecutionTime,s>0){var u=r/a,l=o/a;this._client.trackMetric({name:i.QuickPulseCounter.DEPENDENCY_RATE,value:u}),this._client.trackMetric({name:i.QuickPulseCounter.DEPENDENCY_FAILURE_RATE,value:l}),(!this._enableLiveMetricsCounters||r>0)&&this._client.trackMetric({name:i.QuickPulseCounter.DEPENDENCY_DURATION,value:c})}this._lastDependencies=n}},e.prototype._trackExceptionRate=function(){if(this._enableLiveMetricsCounters){var t=this._lastExceptions,n={totalExceptionCount:e._totalExceptionCount,time:+new Date},r=n.totalExceptionCount-t.totalExceptionCount||0,o=n.time-t.time;if(o>0){var s=r/(o/1e3);this._client.trackMetric({name:i.QuickPulseCounter.EXCEPTION_RATE,value:s})}this._lastExceptions=n}},e.prototype.dispose=function(){e.INSTANCE=null,this.enable(!1),this._isInitialized=!1},e._totalRequestCount=0,e._totalFailedRequestCount=0,e._lastRequestExecutionTime=0,e._totalDependencyCount=0,e._totalFailedDependencyCount=0,e._lastDependencyExecutionTime=0,e._totalExceptionCount=0,e._intervalDependencyExecutionTime=0,e._intervalRequestExecutionTime=0,e}();e.exports=o},3054:e=>{"use strict";var t=function(){function e(){}return e.prototype.getUrl=function(){return this.url},e.prototype.RequestParser=function(){this.startTime=+new Date},e.prototype._setStatus=function(e,t){var n=+new Date;this.duration=n-this.startTime,this.statusCode=e;var r=this.properties||{};if(t)if("string"==typeof t)r.error=t;else if(t instanceof Error)r.error=t.message;else if("object"==typeof t)for(var i in t)r[i]=t[i]&&t[i].toString&&t[i].toString();this.properties=r},e.prototype._isSuccess=function(){return 0{"use strict";var r=n(5290),i=n(4953),o=[],s={10:r.SeverityLevel.Verbose,20:r.SeverityLevel.Verbose,30:r.SeverityLevel.Information,40:r.SeverityLevel.Warning,50:r.SeverityLevel.Error,60:r.SeverityLevel.Critical},a=function(e){var t=e.data.result;o.forEach((function(n){var r=s[e.data.level];t instanceof Error?n.trackException({exception:t}):n.trackTrace({message:t,severity:r})}))};t.wp=function(e,t){e?(0===o.length&&i.channel.subscribe("bunyan",a),o.push(t)):0===(o=o.filter((function(e){return e!=t}))).length&&i.channel.unsubscribe("bunyan",a)}},4309:(e,t,n)=>{"use strict";var r=n(5290),i=n(4953),o=[],s=function(e){var t=e.data.message;o.forEach((function(n){t instanceof Error?n.trackException({exception:t}):(t.lastIndexOf("\n")==t.length-1&&(t=t.substring(0,t.length-1)),n.trackTrace({message:t,severity:e.data.stderr?r.SeverityLevel.Warning:r.SeverityLevel.Information}))}))};t.wp=function(e,t){e?(0===o.length&&i.channel.subscribe("console",s),o.push(t)):0===(o=o.filter((function(e){return e!=t}))).length&&i.channel.unsubscribe("console",s)}},7396:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5282);t.IsInitialized=!process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL;var i="DiagnosticChannel";if(t.IsInitialized){var o=n(4106),s=(process.env.APPLICATION_INSIGHTS_NO_PATCH_MODULES||"").split(","),a={bunyan:o.bunyan,console:o.console,mongodb:o.mongodb,mongodbCore:o.mongodbCore,mysql:o.mysql,redis:o.redis,pg:o.pg,pgPool:o.pgPool,winston:o.winston};for(var c in a)-1===s.indexOf(c)&&(a[c].enable(),r.info(i,"Subscribed to "+c+" events"));s.length>0&&r.info(i,"Some modules will not be patched",s)}else r.info(i,"Not subscribing to dependency autocollection because APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL was set");t.registerContextPreservation=function(e){t.IsInitialized&&n(4953).channel.addContextPreservation(e)}},7886:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){e.data.event.commandName,i.forEach((function(t){var n=e.data.startedData&&e.data.startedData.databaseName||"Unknown database";t.trackDependency({target:n,data:e.data.event.commandName,name:e.data.event.commandName,duration:e.data.event.duration,success:e.data.succeeded,resultCode:e.data.succeeded?"0":"1",dependencyTypeName:"mongodb"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("mongodb",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("mongodb",t.qP)}},4777:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){i.forEach((function(t){var n=e.data.query||{},r=n.sql||"Unknown query",i=!e.data.err,o=(n._connection||{}).config||{},s=o.socketPath?o.socketPath:(o.host||"localhost")+":"+o.port;t.trackDependency({target:s,data:r,name:r,duration:e.data.duration,success:i,resultCode:i?"0":"1",dependencyTypeName:"mysql"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("mysql",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("mysql",t.qP)}},9843:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){i.forEach((function(t){var n=e.data.query,r=n.preparable&&n.preparable.text||n.plan||n.text||"unknown query",i=!e.data.error,o=e.data.database.host+":"+e.data.database.port;t.trackDependency({target:o,data:r,name:r,duration:e.data.duration,success:i,resultCode:i?"0":"1",dependencyTypeName:"postgres"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("postgres",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("postgres",t.qP)}},5071:(e,t,n)=>{"use strict";var r=n(4953),i=[];t.qP=function(e){i.forEach((function(t){"info"!==e.data.commandObj.command&&t.trackDependency({target:e.data.address,name:e.data.commandObj.command,data:e.data.commandObj.command,duration:e.data.duration,success:!e.data.err,resultCode:e.data.err?"1":"0",dependencyTypeName:"redis"})}))},t.wp=function(e,n){e?(0===i.length&&r.channel.subscribe("redis",t.qP),i.push(n)):0===(i=i.filter((function(e){return e!=n}))).length&&r.channel.unsubscribe("redis",t.qP)}},454:(e,t,n)=>{"use strict";var r=n(5290),i=n(4953),o=[],s={syslog:function(e){var t={emerg:r.SeverityLevel.Critical,alert:r.SeverityLevel.Critical,crit:r.SeverityLevel.Critical,error:r.SeverityLevel.Error,warning:r.SeverityLevel.Warning,notice:r.SeverityLevel.Information,info:r.SeverityLevel.Information,debug:r.SeverityLevel.Verbose};return void 0===t[e]?r.SeverityLevel.Information:t[e]},npm:function(e){var t={error:r.SeverityLevel.Error,warn:r.SeverityLevel.Warning,info:r.SeverityLevel.Information,verbose:r.SeverityLevel.Verbose,debug:r.SeverityLevel.Verbose,silly:r.SeverityLevel.Verbose};return void 0===t[e]?r.SeverityLevel.Information:t[e]},unknown:function(e){return r.SeverityLevel.Information}},a=function(e){var t=e.data.message;o.forEach((function(n){if(t instanceof Error)n.trackException({exception:t,properties:e.data.meta});else{var r=s[e.data.levelKind](e.data.level);n.trackTrace({message:t,severity:r,properties:e.data.meta})}}))};t.wp=function(e,t){e?(0===o.length&&i.channel.subscribe("winston",a),o.push(t)):0===(o=o.filter((function(e){return e!=t}))).length&&i.channel.unsubscribe("winston",a)}},3580:(e,t)=>{"use strict";var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_BREEZE_ENDPOINT="https://dc.services.visualstudio.com",t.DEFAULT_LIVEMETRICS_ENDPOINT="https://rt.services.visualstudio.com",t.DEFAULT_LIVEMETRICS_HOST="rt.services.visualstudio.com",function(e){e.COMMITTED_BYTES="\\Memory\\Committed Bytes",e.PROCESSOR_TIME="\\Processor(_Total)\\% Processor Time",e.REQUEST_RATE="\\ApplicationInsights\\Requests/Sec",e.REQUEST_FAILURE_RATE="\\ApplicationInsights\\Requests Failed/Sec",e.REQUEST_DURATION="\\ApplicationInsights\\Request Duration",e.DEPENDENCY_RATE="\\ApplicationInsights\\Dependency Calls/Sec",e.DEPENDENCY_FAILURE_RATE="\\ApplicationInsights\\Dependency Calls Failed/Sec",e.DEPENDENCY_DURATION="\\ApplicationInsights\\Dependency Call Duration",e.EXCEPTION_RATE="\\ApplicationInsights\\Exceptions/Sec"}(n=t.QuickPulseCounter||(t.QuickPulseCounter={})),function(e){e.PRIVATE_BYTES="\\Process(??APP_WIN32_PROC??)\\Private Bytes",e.AVAILABLE_BYTES="\\Memory\\Available Bytes",e.PROCESSOR_TIME="\\Processor(_Total)\\% Processor Time",e.PROCESS_TIME="\\Process(??APP_WIN32_PROC??)\\% Processor Time",e.REQUEST_RATE="\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Requests/Sec",e.REQUEST_DURATION="\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Request Execution Time"}(r=t.PerformanceCounter||(t.PerformanceCounter={})),t.PerformanceToQuickPulseCounter=((i={})[r.PROCESSOR_TIME]=n.PROCESSOR_TIME,i[r.REQUEST_RATE]=n.REQUEST_RATE,i[r.REQUEST_DURATION]=n.REQUEST_DURATION,i[n.COMMITTED_BYTES]=n.COMMITTED_BYTES,i[n.REQUEST_FAILURE_RATE]=n.REQUEST_FAILURE_RATE,i[n.DEPENDENCY_RATE]=n.DEPENDENCY_RATE,i[n.DEPENDENCY_FAILURE_RATE]=n.DEPENDENCY_FAILURE_RATE,i[n.DEPENDENCY_DURATION]=n.DEPENDENCY_DURATION,i[n.EXCEPTION_RATE]=n.EXCEPTION_RATE,i),t.QuickPulseDocumentType={Event:"Event",Exception:"Exception",Trace:"Trace",Metric:"Metric",Request:"Request",Dependency:"RemoteDependency",Availability:"Availability"},t.QuickPulseType={Event:"EventTelemetryDocument",Exception:"ExceptionTelemetryDocument",Trace:"TraceTelemetryDocument",Metric:"MetricTelemetryDocument",Request:"RequestTelemetryDocument",Dependency:"DependencyTelemetryDocument",Availability:"AvailabilityTelemetryDocument"},t.TelemetryTypeStringToQuickPulseType={EventData:t.QuickPulseType.Event,ExceptionData:t.QuickPulseType.Exception,MessageData:t.QuickPulseType.Trace,MetricData:t.QuickPulseType.Metric,RequestData:t.QuickPulseType.Request,RemoteDependencyData:t.QuickPulseType.Dependency,AvailabilityData:t.QuickPulseType.Availability},t.TelemetryTypeStringToQuickPulseDocumentType={EventData:t.QuickPulseDocumentType.Event,ExceptionData:t.QuickPulseDocumentType.Exception,MessageData:t.QuickPulseDocumentType.Trace,MetricData:t.QuickPulseDocumentType.Metric,RequestData:t.QuickPulseDocumentType.Request,RemoteDependencyData:t.QuickPulseDocumentType.Dependency,AvailabilityData:t.QuickPulseDocumentType.Availability}},9382:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9958),i=function(){function e(){}return e.TYPE_HTTP="Http",e.TYPE_AI="Http (tracked component)",e}();t.RemoteDependencyDataConstants=i,t.domainSupportsProperties=function(e){return"properties"in e||e instanceof r.EventData||e instanceof r.ExceptionData||e instanceof r.MessageData||e instanceof r.MetricData||e instanceof r.PageViewData||e instanceof r.RemoteDependencyData||e instanceof r.RequestData}},7220:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},4101:e=>{"use strict";var t=function(){};e.exports=t},9871:e=>{"use strict";var t=function(){this.applicationVersion="ai.application.ver",this.deviceId="ai.device.id",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceOEMName="ai.device.oemName",this.deviceOSVersion="ai.device.osVersion",this.deviceType="ai.device.type",this.locationIp="ai.location.ip",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.userAccountId="ai.user.accountId",this.userId="ai.user.id",this.userAuthUserId="ai.user.authUserId",this.cloudRole="ai.cloud.role",this.cloudRoleInstance="ai.cloud.roleInstance",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion",this.internalNodeName="ai.internal.nodeName"};e.exports=t},320:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){return e.call(this)||this}return i(t,e),t}(n(4101));e.exports=o},8602:(e,t,n)=>{"use strict";var r=n(495),i=function(){this.kind=r.Measurement};e.exports=i},495:e=>{"use strict";var t;!function(e){e[e.Measurement=0]="Measurement",e[e.Aggregation=1]="Aggregation"}(t||(t={})),e.exports=t},8934:e=>{"use strict";var t=function(){};e.exports=t},7300:e=>{"use strict";var t=function(){this.ver=1,this.sampleRate=100,this.tags={}};e.exports=t},4526:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},935:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.exceptions=[],t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},8082:e=>{"use strict";var t=function(){this.hasFullStack=!0,this.parsedStack=[]};e.exports=t},901:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t}return i(t,e),t}(n(8934));e.exports=o},3092:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.metrics=[],t.properties={},t}return i(t,e),t}(n(8934));e.exports=o},6279:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(4526));e.exports=o},6290:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.success=!0,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},7339:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return i(t,e),t}(n(8934));e.exports=o},9697:e=>{"use strict";var t;!function(e){e[e.Verbose=0]="Verbose",e[e.Information=1]="Information",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Critical=4]="Critical"}(t||(t={})),e.exports=t},6781:e=>{"use strict";var t=function(){};e.exports=t},9958:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AvailabilityData=n(7220),t.Base=n(4101),t.ContextTagKeys=n(9871),t.Data=n(320),t.DataPoint=n(8602),t.DataPointType=n(495),t.Domain=n(8934),t.Envelope=n(7300),t.EventData=n(4526),t.ExceptionData=n(935),t.ExceptionDetails=n(8082),t.MessageData=n(901),t.MetricData=n(3092),t.PageViewData=n(6279),t.RemoteDependencyData=n(6290),t.RequestData=n(7339),t.SeverityLevel=n(9697),t.StackFrame=n(6781)},5481:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.telemetryTypeToBaseType=function(e){switch(e){case n.Event:return"EventData";case n.Exception:return"ExceptionData";case n.Trace:return"MessageData";case n.Metric:return"MetricData";case n.Request:return"RequestData";case n.Dependency:return"RemoteDependencyData";case n.Availability:return"AvailabilityData"}},t.baseTypeToTelemetryType=function(e){switch(e){case"EventData":return n.Event;case"ExceptionData":return n.Exception;case"MessageData":return n.Trace;case"MetricData":return n.Metric;case"RequestData":return n.Request;case"RemoteDependencyData":return n.Dependency;case"AvailabilityData":return n.Availability}},t.TelemetryTypeString={Event:"EventData",Exception:"ExceptionData",Trace:"MessageData",Metric:"MetricData",Request:"RequestData",Dependency:"RemoteDependencyData",Availability:"AvailabilityData"},function(e){e[e.Event=0]="Event",e[e.Exception=1]="Exception",e[e.Trace=2]="Trace",e[e.Metric=3]="Metric",e[e.Request=4]="Request",e[e.Dependency=5]="Dependency",e[e.Availability=6]="Availability"}(n=t.TelemetryType||(t.TelemetryType={}))},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(5481))},5290:(e,t,n)=>{"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(9382)),r(n(9958)),r(n(2626))},3504:(e,t,n)=>{"use strict";var r=n(5282),i=function(){function e(e,t,n,r){this._buffer=[],this._lastSend=0,this._isDisabled=e,this._getBatchSize=t,this._getBatchIntervalMs=n,this._sender=r}return e.prototype.setUseDiskRetryCaching=function(e,t,n){this._sender.setDiskRetryMode(e,t,n)},e.prototype.send=function(e){var t=this;if(!this._isDisabled())if(e){var n=this._stringify(e);"string"==typeof n&&(this._buffer.push(n),this._buffer.length>=this._getBatchSize()?this.triggerSend(!1):!this._timeoutHandle&&this._buffer.length>0&&(this._timeoutHandle=setTimeout((function(){t._timeoutHandle=null,t.triggerSend(!1)}),this._getBatchIntervalMs())))}else r.warn("Cannot send null/undefined telemetry")},e.prototype.triggerSend=function(e,t){var n=this._buffer.length<1;if(!n){var r=this._buffer.join("\n");e?(this._sender.saveOnCrash(r),"function"==typeof t&&t("data saved on crash")):this._sender.send(Buffer.from?Buffer.from(r):new Buffer(r),t)}this._lastSend=+new Date,this._buffer.length=0,clearTimeout(this._timeoutHandle),this._timeoutHandle=null,n&&"function"==typeof t&&t("no data to send")},e.prototype._stringify=function(e){try{return JSON.stringify(e)}catch(t){r.warn("Failed to serialize payload",t,e)}},e}();e.exports=i},9253:(e,t,n)=>{"use strict";var r=n(9962),i=n(640),o=n(3580),s=n(8835),a=function(){function e(t){var n=this;this.endpointBase=o.DEFAULT_BREEZE_ENDPOINT;var r=process.env[e.ENV_connectionString],a=i.parse(t),c=i.parse(r),u=!a.instrumentationkey&&Object.keys(a).length>0?null:t;this.instrumentationKey=a.instrumentationkey||u||c.instrumentationkey||e._getInstrumentationKey(),this.endpointUrl=(a.ingestionendpoint||c.ingestionendpoint||this.endpointBase)+"/v2/track",this.maxBatchSize=250,this.maxBatchIntervalMs=15e3,this.disableAppInsights=!1,this.samplingPercentage=100,this.correlationIdRetryIntervalMs=3e4,this.correlationHeaderExcludedDomains=["*.core.windows.net","*.core.chinacloudapi.cn","*.core.cloudapi.de","*.core.usgovcloudapi.net","*.core.microsoft.scloud","*.core.eaglex.ic.gov"],this.setCorrelationId=function(e){return n.correlationId=e},this.proxyHttpUrl=process.env[e.ENV_http_proxy]||void 0,this.proxyHttpsUrl=process.env[e.ENV_https_proxy]||void 0,this.httpAgent=void 0,this.httpsAgent=void 0,this.profileQueryEndpoint=a.ingestionendpoint||c.ingestionendpoint||process.env[e.ENV_profileQueryEndpoint]||this.endpointBase,this._quickPulseHost=a.liveendpoint||c.liveendpoint||process.env[e.ENV_quickPulseHost]||o.DEFAULT_LIVEMETRICS_HOST,this._quickPulseHost.match(/^https?:\/\//)&&(this._quickPulseHost=s.parse(this._quickPulseHost).host)}return Object.defineProperty(e.prototype,"profileQueryEndpoint",{get:function(){return this._profileQueryEndpoint},set:function(e){r.cancelCorrelationIdQuery(this,this.setCorrelationId),this._profileQueryEndpoint=e,this.correlationId=r.correlationIdPrefix,r.queryCorrelationId(this,this.setCorrelationId)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"quickPulseHost",{get:function(){return this._quickPulseHost},set:function(e){this._quickPulseHost=e},enumerable:!0,configurable:!0}),e._getInstrumentationKey=function(){var t=process.env[e.ENV_iKey]||process.env[e.ENV_azurePrefix+e.ENV_iKey]||process.env[e.legacy_ENV_iKey]||process.env[e.ENV_azurePrefix+e.legacy_ENV_iKey];if(!t||""==t)throw new Error("Instrumentation key not found, pass the key in the config to this method or set the key in the environment variable APPINSIGHTS_INSTRUMENTATIONKEY before starting the server");return t},e.ENV_azurePrefix="APPSETTING_",e.ENV_iKey="APPINSIGHTS_INSTRUMENTATIONKEY",e.legacy_ENV_iKey="APPINSIGHTS_INSTRUMENTATION_KEY",e.ENV_profileQueryEndpoint="APPINSIGHTS_PROFILE_QUERY_ENDPOINT",e.ENV_quickPulseHost="APPINSIGHTS_QUICKPULSE_HOST",e.ENV_connectionString="APPLICATIONINSIGHTS_CONNECTION_STRING",e.ENV_nativeMetricsDisablers="APPLICATION_INSIGHTS_DISABLE_EXTENDED_METRIC",e.ENV_nativeMetricsDisableAll="APPLICATION_INSIGHTS_DISABLE_ALL_EXTENDED_METRICS",e.ENV_http_proxy="http_proxy",e.ENV_https_proxy="https_proxy",e}();e.exports=a},640:(e,t,n)=>{"use strict";var r=n(3580),i=function(){function e(){}return e.parse=function(t){if(!t)return{};var n=t.split(e._FIELDS_SEPARATOR).reduce((function(t,n){var r=n.split(e._FIELD_KEY_VALUE_SEPARATOR);if(2===r.length){var i=r[0].toLowerCase(),o=r[1];t[i]=o}return t}),{});if(Object.keys(n).length>0){if(n.endpointsuffix){var i=n.location?n.location+".":"";n.ingestionendpoint=n.ingestionendpoint||"https://"+i+"dc."+n.endpointsuffix,n.liveendpoint=n.liveendpoint||"https://"+i+"live."+n.endpointsuffix}n.ingestionendpoint=n.ingestionendpoint||r.DEFAULT_BREEZE_ENDPOINT,n.liveendpoint=n.liveendpoint||r.DEFAULT_LIVEMETRICS_ENDPOINT}return n},e._FIELDS_SEPARATOR=";",e._FIELD_KEY_VALUE_SEPARATOR="=",e}();e.exports=i},4470:(e,t,n)=>{"use strict";var r=n(2087),i=n(5747),o=n(5622),s=n(5290),a=n(5282),c=function(){function e(e){this.keys=new s.ContextTagKeys,this.tags={},this._loadApplicationContext(),this._loadDeviceContext(),this._loadInternalContext()}return e.prototype._loadApplicationContext=function(t){if(t=t||o.resolve(__dirname,"../../../../package.json"),!e.appVersion[t]){e.appVersion[t]="unknown";try{var n=JSON.parse(i.readFileSync(t,"utf8"));n&&"string"==typeof n.version&&(e.appVersion[t]=n.version)}catch(e){a.info("unable to read app version: ",e)}}this.tags[this.keys.applicationVersion]=e.appVersion[t]},e.prototype._loadDeviceContext=function(){this.tags[this.keys.deviceId]="",this.tags[this.keys.cloudRoleInstance]=r&&r.hostname(),this.tags[this.keys.deviceOSVersion]=r&&r.type()+" "+r.release(),this.tags[this.keys.cloudRole]=e.DefaultRoleName,this.tags["ai.device.osArchitecture"]=r&&r.arch(),this.tags["ai.device.osPlatform"]=r&&r.platform()},e.prototype._loadInternalContext=function(){var t=o.resolve(__dirname,"../../package.json");if(!e.sdkVersion){e.sdkVersion="unknown";try{var n=JSON.parse(i.readFileSync(t,"utf8"));n&&"string"==typeof n.version&&(e.sdkVersion=n.version)}catch(e){a.info("unable to read app version: ",e)}}this.tags[this.keys.internalSdkVersion]="node:"+e.sdkVersion},e.DefaultRoleName="Web",e.appVersion={},e.sdkVersion=null,e}();e.exports=c},9962:(e,t,n)=>{"use strict";var r=n(5740),i=n(5282),o=function(){function e(){}return e.queryCorrelationId=function(t,n){var o=t.profileQueryEndpoint+"/api/profiles/"+t.instrumentationKey+"/appId";if(e.completedLookups.hasOwnProperty(o))n(e.completedLookups[o]);else if(e.pendingLookups[o])e.pendingLookups[o].push(n);else{e.pendingLookups[o]=[n];var s=function(){if(e.pendingLookups[o]){var n={method:"GET",disableAppInsightsAutoCollection:!0};i.info(e.TAG,n);var a=r.makeRequest(t,o,n,(function(n){if(200===n.statusCode){var r="";n.setEncoding("utf-8"),n.on("data",(function(e){r+=e})),n.on("end",(function(){i.info(e.TAG,r);var t=e.correlationIdPrefix+r;e.completedLookups[o]=t,e.pendingLookups[o]&&e.pendingLookups[o].forEach((function(e){return e(t)})),delete e.pendingLookups[o]}))}else n.statusCode>=400&&n.statusCode<500?(e.completedLookups[o]=void 0,delete e.pendingLookups[o]):setTimeout(s,t.correlationIdRetryIntervalMs)}));a&&(a.on("error",(function(t){i.warn(e.TAG,t)})),a.end())}};setTimeout(s,0)}},e.cancelCorrelationIdQuery=function(t,n){var r=t.profileQueryEndpoint+"/api/profiles/"+t.instrumentationKey+"/appId",i=e.pendingLookups[r];i&&(e.pendingLookups[r]=i.filter((function(e){return e!=n})),0==e.pendingLookups[r].length&&delete e.pendingLookups[r])},e.generateRequestId=function(t){if(t){"."!==(t="|"==t[0]?t:"|"+t)[t.length-1]&&(t+=".");var n=(e.currentRootId++).toString(16);return e.appendSuffix(t,n,"_")}return e.generateRootId()},e.getRootId=function(e){var t=e.indexOf(".");t<0&&(t=e.length);var n="|"===e[0]?1:0;return e.substring(n,t)},e.generateRootId=function(){return"|"+r.w3cTraceId()+"."},e.appendSuffix=function(t,n,i){if(t.length+n.lengtho)for(;o>1;--o){var s=t[o-1];if("."===s||"_"===s)break}if(o<=1)return e.generateRootId();for(n=r.randomu32().toString(16);n.length<8;)n="0"+n;return t.substring(0,o)+n+"#"},e.TAG="CorrelationIdManager",e.correlationIdPrefix="cid-v1:",e.w3cEnabled=!1,e.pendingLookups={},e.completedLookups={},e.requestIdMaxLength=1024,e.currentRootId=r.randomu32(),e}();e.exports=o},9813:(e,t,n)=>{"use strict";var r=n(5290),i=n(5740),o=n(894),s=function(){function e(){}return e.createEnvelope=function(t,n,o,s,a){var c=null;switch(n){case r.TelemetryType.Trace:c=e.createTraceData(t);break;case r.TelemetryType.Dependency:c=e.createDependencyData(t);break;case r.TelemetryType.Event:c=e.createEventData(t);break;case r.TelemetryType.Exception:c=e.createExceptionData(t);break;case r.TelemetryType.Request:c=e.createRequestData(t);break;case r.TelemetryType.Metric:c=e.createMetricData(t);break;case r.TelemetryType.Availability:c=e.createAvailabilityData(t)}if(o&&r.domainSupportsProperties(c.baseData)){if(c&&c.baseData)if(c.baseData.properties)for(var u in o)c.baseData.properties[u]||(c.baseData.properties[u]=o[u]);else c.baseData.properties=o;c.baseData.properties=i.validateStringMap(c.baseData.properties)}var l=a&&a.instrumentationKey||"",p=new r.Envelope;return p.data=c,p.iKey=l,p.name="Microsoft.ApplicationInsights."+l.replace(/-/g,"")+"."+c.baseType.substr(0,c.baseType.length-4),p.tags=this.getTags(s,t.tagOverrides),p.time=(new Date).toISOString(),p.ver=1,p.sampleRate=a?a.samplingPercentage:100,n===r.TelemetryType.Metric&&(p.sampleRate=100),p},e.createTraceData=function(e){var t=new r.MessageData;t.message=e.message,t.properties=e.properties,isNaN(e.severity)?t.severityLevel=r.SeverityLevel.Information:t.severityLevel=e.severity;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Trace),n.baseData=t,n},e.createDependencyData=function(e){var t=new r.RemoteDependencyData;"string"==typeof e.name&&(t.name=e.name.length>1024?e.name.slice(0,1021)+"...":e.name),t.data=e.data,t.target=e.target,t.duration=i.msToTimeSpan(e.duration),t.success=e.success,t.type=e.dependencyTypeName,t.properties=e.properties,t.resultCode=e.resultCode?e.resultCode+"":"",e.id?t.id=e.id:t.id=i.w3cTraceId();var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Dependency),n.baseData=t,n},e.createEventData=function(e){var t=new r.EventData;t.name=e.name,t.properties=e.properties,t.measurements=e.measurements;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Event),n.baseData=t,n},e.createExceptionData=function(e){var t=new r.ExceptionData;t.properties=e.properties,isNaN(e.severity)?t.severityLevel=r.SeverityLevel.Error:t.severityLevel=e.severity,t.measurements=e.measurements,t.exceptions=[];var n=e.exception.stack,o=new r.ExceptionDetails;o.message=e.exception.message,o.typeName=e.exception.name,o.parsedStack=this.parseStack(n),o.hasFullStack=i.isArray(o.parsedStack)&&o.parsedStack.length>0,t.exceptions.push(o);var s=new r.Data;return s.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Exception),s.baseData=t,s},e.createRequestData=function(e){var t=new r.RequestData;e.id?t.id=e.id:t.id=i.w3cTraceId(),t.name=e.name,t.url=e.url,t.source=e.source,t.duration=i.msToTimeSpan(e.duration),t.responseCode=e.resultCode?e.resultCode+"":"",t.success=e.success,t.properties=e.properties;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Request),n.baseData=t,n},e.createMetricData=function(e){var t=new r.MetricData;t.metrics=[];var n=new r.DataPoint;n.count=isNaN(e.count)?1:e.count,n.kind=r.DataPointType.Aggregation,n.max=isNaN(e.max)?e.value:e.max,n.min=isNaN(e.min)?e.value:e.min,n.name=e.name,n.stdDev=isNaN(e.stdDev)?0:e.stdDev,n.value=e.value,t.metrics.push(n),t.properties=e.properties;var i=new r.Data;return i.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Metric),i.baseData=t,i},e.createAvailabilityData=function(e){var t=new r.AvailabilityData;e.id?t.id=e.id:t.id=i.w3cTraceId(),t.name=e.name,t.duration=i.msToTimeSpan(e.duration),t.success=e.success,t.runLocation=e.runLocation,t.message=e.message,t.measurements=e.measurements,t.properties=e.properties;var n=new r.Data;return n.baseType=r.telemetryTypeToBaseType(r.TelemetryType.Availability),n.baseData=t,n},e.getTags=function(e,t){var n=o.CorrelationContextManager.getCurrentContext(),r={};if(e&&e.tags)for(var i in e.tags)r[i]=e.tags[i];if(t)for(var i in t)r[i]=t[i];return n&&(r[e.keys.operationId]=r[e.keys.operationId]||n.operation.id,r[e.keys.operationName]=r[e.keys.operationName]||n.operation.name,r[e.keys.operationParentId]=r[e.keys.operationParentId]||n.operation.parentId),r},e.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,o=0;o<=n.length;o++){var s=n[o];if(a.regex.test(s)){var c=new a(n[o],r++);i+=c.sizeInBytes,t.push(c)}}if(i>32768)for(var u=0,l=t.length-1,p=0,f=u,d=l;u32768){var h=d-f+1;t.splice(f,h);break}f=u,d=l,u++,l--}}return t},e}(),a=function(){function e(t,n){this.sizeInBytes=0,this.level=n,this.method="",this.assembly=i.trim(t);var r=t.match(e.regex);r&&r.length>=5&&(this.method=i.trim(r[2])||this.method,this.fileName=i.trim(r[4])||"",this.line=parseInt(r[5])||0),this.sizeInBytes+=this.method.length,this.sizeInBytes+=this.fileName.length,this.sizeInBytes+=this.assembly.length,this.sizeInBytes+=e.baseSize,this.sizeInBytes+=this.level.toString().length,this.sizeInBytes+=this.line.toString().length}return e.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,e.baseSize=58,e}();e.exports=s},5282:e=>{"use strict";var t=function(){function e(){}return e.info=function(t){for(var n=[],r=1;r0?t:null,InstrumentationKey:n.instrumentationKey||"",Metrics:e.length>0?e:null,InvariantVersion:1,Timestamp:"/Date("+Date.now()+")/",Version:r.tags[r.keys.internalSdkVersion],StreamId:u,MachineName:o,Instance:s}},e.createQuickPulseMetric=function(e){return{Name:e.name,Value:e.value,Weight:e.count||1}},e.telemetryEnvelopeToQuickPulseDocument=function(t){switch(t.data.baseType){case o.TelemetryTypeString.Event:return e.createQuickPulseEventDocument(t);case o.TelemetryTypeString.Exception:return e.createQuickPulseExceptionDocument(t);case o.TelemetryTypeString.Trace:return e.createQuickPulseTraceDocument(t);case o.TelemetryTypeString.Dependency:return e.createQuickPulseDependencyDocument(t);case o.TelemetryTypeString.Request:return e.createQuickPulseRequestDocument(t)}return null},e.createQuickPulseEventDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData.name;return r({},n,{Name:i})},e.createQuickPulseTraceDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData.severityLevel||0;return r({},n,{Message:t.data.baseData.message,SeverityLevel:o.SeverityLevel[i]})},e.createQuickPulseExceptionDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData.exceptions,o="",s="",a="";return i&&i.length>0&&(i[0].parsedStack&&i[0].parsedStack.length>0?i[0].parsedStack.forEach((function(e){o+=e.assembly+"\n"})):i[0].stack&&i[0].stack.length>0&&(o=i[0].stack),s=i[0].message,a=i[0].typeName),r({},n,{Exception:o,ExceptionMessage:s,ExceptionType:a})},e.createQuickPulseRequestDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData;return r({},n,{Name:i.name,Success:i.success,Duration:i.duration,ResponseCode:i.responseCode,OperationName:i.name})},e.createQuickPulseDependencyDocument=function(t){var n=e.createQuickPulseDocument(t),i=t.data.baseData;return r({},n,{Name:i.name,Target:i.target,Success:i.success,Duration:i.duration,ResultCode:i.resultCode,CommandName:i.data,OperationName:n.OperationId,DependencyTypeName:i.type})},e.createQuickPulseDocument=function(t){var n,r;return t.data.baseType?(r=s.TelemetryTypeStringToQuickPulseType[t.data.baseType],n=s.TelemetryTypeStringToQuickPulseDocumentType[t.data.baseType]):c.warn("Document type invalid; not sending live metric document",t.data.baseType),{DocumentType:n,__type:r,OperationId:t.tags[e.keys.operationId],Version:"1.0",Properties:e.aggregateProperties(t)}},e.aggregateProperties=function(e){var t=[],n=e.data.baseData.measurements||{};for(var r in n)if(n.hasOwnProperty(r)){var i={key:r,value:n[r]};t.push(i)}var o=e.data.baseData.properties||{};for(var r in o)if(o.hasOwnProperty(r)){i={key:r,value:o[r]};t.push(i)}return t},e.keys=new o.ContextTagKeys,e}();e.exports=l},9184:(e,t,n)=>{"use strict";var r=n(7211),i=n(8723),o=n(5282),s="POST",a="x-ms-qps-transmission-time",c="x-ms-qps-subscribed",u=function(){function e(e){this._config=e,this._consecutiveErrors=0}return e.prototype.ping=function(e,t){this._submitData(e,t,"ping")},e.prototype.post=function(e,t){this._submitData([e],t,"post")},e.prototype._submitData=function(t,n,u){var l,p,f=this,d=JSON.stringify(t),h=((l={})[i.disableCollectionRequestOption]=!0,l.host=this._config.quickPulseHost,l.method=s,l.path="/QuickPulseService.svc/"+u+"?ikey="+this._config.instrumentationKey,l.headers=((p={Expect:"100-continue"})[a]=1e4*Date.now(),p["Content-Type"]="application/json",p["Content-Length"]=Buffer.byteLength(d),p),l),m=r.request(h,(function(e){var t="true"===e.headers[c];f._consecutiveErrors=0,n(t,e)}));m.on("error",(function(t){f._consecutiveErrors++;var r="Transient error connecting to the Live Metrics endpoint. This packet will not appear in your Live Metrics Stream. Error:";f._consecutiveErrors%e.MAX_QPS_FAILURES_BEFORE_WARN==0?(r="Live Metrics endpoint could not be reached "+f._consecutiveErrors+" consecutive times. Most recent error:",o.warn(e.TAG,r,t)):o.info(e.TAG,r,t),n()})),m.write(d),m.end()},e.TAG="QuickPulseSender",e.MAX_QPS_FAILURES_BEFORE_WARN=25,e}();e.exports=u},3668:(e,t,n)=>{"use strict";var r=n(5282),i=n(9253),o=n(7148),s=n(9184),a=n(3580),c=n(4470),u=function(){function e(e,t){this._isCollectingData=!1,this._lastSuccessTime=Date.now(),this._lastSendSucceeded=!0,this._metrics={},this._documents=[],this._collectors=[],this.config=new i(e),this.context=t||new c,this._sender=new s(this.config),this._isEnabled=!1}return e.prototype.addCollector=function(e){this._collectors.push(e)},e.prototype.trackMetric=function(e){this._addMetric(e)},e.prototype.addDocument=function(e){var t=o.telemetryEnvelopeToQuickPulseDocument(e);t&&this._documents.push(t)},e.prototype.enable=function(e){e&&!this._isEnabled?(this._isEnabled=!0,this._goQuickPulse()):!e&&this._isEnabled&&(this._isEnabled=!1,clearTimeout(this._handle),this._handle=void 0)},e.prototype.enableCollectors=function(e){this._collectors.forEach((function(t){t.enable(e)}))},e.prototype._addMetric=function(e){var t=e.value,n=e.count||1,r=a.PerformanceToQuickPulseCounter[e.name];r&&(this._metrics[r]?(this._metrics[r].Value=(this._metrics[r].Value*this._metrics[r].Weight+t*n)/(this._metrics[r].Weight+n),this._metrics[r].Weight+=n):(this._metrics[r]=o.createQuickPulseMetric(e),this._metrics[r].Name=r,this._metrics[r].Weight=1))},e.prototype._resetQuickPulseBuffer=function(){delete this._metrics,this._metrics={},this._documents.length=0},e.prototype._goQuickPulse=function(){var t=this,n=Object.keys(this._metrics).map((function(e){return t._metrics[e]})),r=o.createQuickPulseEnvelope(n,this._documents.slice(),this.config,this.context);this._resetQuickPulseBuffer(),this._isCollectingData?this._post(r):this._ping(r);var i=this._isCollectingData?e.POST_INTERVAL:e.PING_INTERVAL;this._isCollectingData&&Date.now()-this._lastSuccessTime>=e.MAX_POST_WAIT_TIME&&!this._lastSendSucceeded?(this._isCollectingData=!1,i=e.FALLBACK_INTERVAL):!this._isCollectingData&&Date.now()-this._lastSuccessTime>=e.MAX_PING_WAIT_TIME&&!this._lastSendSucceeded&&(i=e.FALLBACK_INTERVAL),this._lastSendSucceeded=null,this._handle=setTimeout(this._goQuickPulse.bind(this),i),this._handle.unref()},e.prototype._ping=function(e){this._sender.ping(e,this._quickPulseDone.bind(this))},e.prototype._post=function(e){this._sender.post(e,this._quickPulseDone.bind(this))},e.prototype._quickPulseDone=function(e,t){null!=e?(this._isCollectingData!==e&&(r.info("Live Metrics sending data",e),this.enableCollectors(e)),this._isCollectingData=e,t&&t.statusCode<300&&t.statusCode>=200?(this._lastSuccessTime=Date.now(),this._lastSendSucceeded=!0):this._lastSendSucceeded=!1):this._lastSendSucceeded=!1},e.MAX_POST_WAIT_TIME=2e4,e.MAX_PING_WAIT_TIME=6e4,e.FALLBACK_INTERVAL=6e4,e.PING_INTERVAL=5e3,e.POST_INTERVAL=1e3,e}();e.exports=u},9036:e=>{"use strict";e.exports={requestContextHeader:"request-context",requestContextSourceKey:"appId",requestContextTargetKey:"appId",requestIdHeader:"request-id",parentIdHeader:"x-ms-request-id",rootIdHeader:"x-ms-request-root-id",correlationContextHeader:"correlation-context",traceparentHeader:"traceparent",traceStateHeader:"tracestate"}},2588:(e,t,n)=>{"use strict";var r=n(5747),i=n(2087),o=n(5622),s=n(8761),a=n(3129),c=n(5282),u=n(8723),l=n(5740),p=function(){function e(t,n,i){if(this._config=t,this._onSuccess=n,this._onError=i,this._enableDiskRetryMode=!1,this._resendInterval=e.WAIT_BETWEEN_RESEND,this._maxBytesOnDisk=e.MAX_BYTES_ON_DISK,this._numConsecutiveFailures=0,!e.OS_PROVIDES_FILE_PROTECTION)if(e.USE_ICACLS){try{e.OS_PROVIDES_FILE_PROTECTION=r.existsSync(e.ICACLS_PATH)}catch(e){}e.OS_PROVIDES_FILE_PROTECTION||c.warn(e.TAG,"Could not find ICACLS in expected location! This is necessary to use disk retry mode on Windows.")}else e.OS_PROVIDES_FILE_PROTECTION=!0}return e.prototype.setDiskRetryMode=function(t,n,r){this._enableDiskRetryMode=e.OS_PROVIDES_FILE_PROTECTION&&t,"number"==typeof n&&n>=0&&(this._resendInterval=Math.floor(n)),"number"==typeof r&&r>=0&&(this._maxBytesOnDisk=Math.floor(r)),t&&!e.OS_PROVIDES_FILE_PROTECTION&&(this._enableDiskRetryMode=!1,c.warn(e.TAG,"Ignoring request to enable disk retry mode. Sufficient file protection capabilities were not detected."))},e.prototype.send=function(t,n){var r=this,i=this._config.endpointUrl,o={method:"POST",withCredentials:!1,headers:{"Content-Type":"application/x-json-stream"}};s.gzip(t,(function(s,a){var p=a;s?(c.warn(s),p=t,o.headers["Content-Length"]=t.length.toString()):(o.headers["Content-Encoding"]="gzip",o.headers["Content-Length"]=a.length),c.info(e.TAG,o),o[u.disableCollectionRequestOption]=!0;var f=l.makeRequest(r._config,i,o,(function(i){i.setEncoding("utf-8");var o="";i.on("data",(function(e){o+=e})),i.on("end",(function(){r._numConsecutiveFailures=0,c.info(e.TAG,o),"function"==typeof r._onSuccess&&r._onSuccess(o),"function"==typeof n&&n(o),r._enableDiskRetryMode&&(200===i.statusCode?setTimeout((function(){return r._sendFirstFileOnDisk()}),r._resendInterval).unref():408!==i.statusCode&&429!==i.statusCode&&439!==i.statusCode&&500!==i.statusCode&&503!==i.statusCode||r._storeToDisk(t))}))}));f.on("error",(function(i){if(r._numConsecutiveFailures++,!r._enableDiskRetryMode||r._numConsecutiveFailures>0&&r._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN==0){var o="Ingestion endpoint could not be reached. This batch of telemetry items has been lost. Use Disk Retry Caching to enable resending of failed telemetry. Error:";r._enableDiskRetryMode&&(o="Ingestion endpoint could not be reached "+r._numConsecutiveFailures+" consecutive times. There may be resulting telemetry loss. Most recent error:"),c.warn(e.TAG,o,i)}else{o="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";c.info(e.TAG,o,i)}if(r._onErrorHelper(i),"function"==typeof n){var s="error sending telemetry";i&&"function"==typeof i.toString&&(s=i.toString()),n(s)}r._enableDiskRetryMode&&r._storeToDisk(t)})),f.write(p),f.end()}))},e.prototype.saveOnCrash=function(e){this._enableDiskRetryMode&&this._storeToDiskSync(e)},e.prototype._runICACLS=function(t,n){var r=a.spawn(e.ICACLS_PATH,t,{windowsHide:!0});r.on("error",(function(e){return n(e)})),r.on("close",(function(e,t){return n(0===e?null:new Error("Setting ACL restrictions did not succeed (ICACLS returned code "+e+")"))}))},e.prototype._runICACLSSync=function(t){if(!a.spawnSync)throw new Error("Could not synchronously call ICACLS under current version of Node.js");var n=a.spawnSync(e.ICACLS_PATH,t,{windowsHide:!0});if(n.error)throw n.error;if(0!==n.status)throw new Error("Setting ACL restrictions did not succeed (ICACLS returned code "+n.status+")")},e.prototype._getACLIdentity=function(t){if(e.ACL_IDENTITY)return t(null,e.ACL_IDENTITY);var n=a.spawn(e.POWERSHELL_PATH,["-Command","[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),r="";n.stdout.on("data",(function(e){return r+=e})),n.on("error",(function(e){return t(e,null)})),n.on("close",(function(n,i){return e.ACL_IDENTITY=r&&r.trim(),t(0===n?null:new Error("Getting ACL identity did not succeed (PS returned code "+n+")"),e.ACL_IDENTITY)}))},e.prototype._getACLIdentitySync=function(){if(e.ACL_IDENTITY)return e.ACL_IDENTITY;if(a.spawnSync){var t=a.spawnSync(e.POWERSHELL_PATH,["-Command","[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]});if(t.error)throw t.error;if(0!==t.status)throw new Error("Getting ACL identity did not succeed (PS returned code "+t.status+")");return e.ACL_IDENTITY=t.stdout&&t.stdout.toString().trim(),e.ACL_IDENTITY}throw new Error("Could not synchronously get ACL identity under current version of Node.js")},e.prototype._getACLArguments=function(e,t){return[e,"/grant","*S-1-5-32-544:(OI)(CI)F","/grant",t+":(OI)(CI)F","/inheritance:r"]},e.prototype._applyACLRules=function(t,n){var r=this;return e.USE_ICACLS?void 0!==e.ACLED_DIRECTORIES[t]?n(e.ACLED_DIRECTORIES[t]?null:new Error("Setting ACL restrictions did not succeed (cached result)")):(e.ACLED_DIRECTORIES[t]=!1,void this._getACLIdentity((function(i,o){if(i)return e.ACLED_DIRECTORIES[t]=!1,n(i);r._runICACLS(r._getACLArguments(t,o),(function(r){return e.ACLED_DIRECTORIES[t]=!r,n(r)}))}))):n(null)},e.prototype._applyACLRulesSync=function(t){if(e.USE_ICACLS){if(void 0===e.ACLED_DIRECTORIES[t])return this._runICACLSSync(this._getACLArguments(t,this._getACLIdentitySync())),void(e.ACLED_DIRECTORIES[t]=!0);if(!e.ACLED_DIRECTORIES[t])throw new Error("Setting ACL restrictions did not succeed (cached result)")}},e.prototype._confirmDirExists=function(e,t){var n=this;r.lstat(e,(function(i,o){i&&"ENOENT"===i.code?r.mkdir(e,(function(r){r&&"EEXIST"!==r.code?t(r):n._applyACLRules(e,t)})):!i&&o.isDirectory()?n._applyACLRules(e,t):t(i||new Error("Path existed but was not a directory"))}))},e.prototype._getShallowDirectorySize=function(e,t){r.readdir(e,(function(n,i){if(n)return t(n,-1);var s=null,a=0,c=0;if(0!==i.length)for(var u=0;un._maxBytesOnDisk)c.warn(e.TAG,"Not saving data due to max size limit being met. Directory size in bytes is: "+a);else{var u=(new Date).getTime()+".ai.json",l=o.join(s,u);c.info(e.TAG,"saving data to disk at: "+l),r.writeFile(l,t,{mode:384},(function(e){return n._onErrorHelper(e)}))}}))}))},e.prototype._storeToDiskSync=function(t){var n=o.join(i.tmpdir(),e.TEMPDIR_PREFIX+this._config.instrumentationKey);try{c.info(e.TAG,"Checking existance of data storage directory: "+n),r.existsSync(n)||r.mkdirSync(n),this._applyACLRulesSync(n);var s=this._getShallowDirectorySizeSync(n);if(s>this._maxBytesOnDisk)return void c.info(e.TAG,"Not saving data due to max size limit being met. Directory size in bytes is: "+s);var a=(new Date).getTime()+".ai.json",u=o.join(n,a);c.info(e.TAG,"saving data before crash to disk at: "+u),r.writeFileSync(u,t,{mode:384})}catch(t){c.warn(e.TAG,"Error while saving data to disk: "+(t&&t.message)),this._onErrorHelper(t)}},e.prototype._sendFirstFileOnDisk=function(){var t=this,n=o.join(i.tmpdir(),e.TEMPDIR_PREFIX+this._config.instrumentationKey);r.exists(n,(function(e){e&&r.readdir(n,(function(e,i){if(e)t._onErrorHelper(e);else if((i=i.filter((function(e){return o.basename(e).indexOf(".ai.json")>-1}))).length>0){var s=i[0],a=o.join(n,s);r.readFile(a,(function(e,n){e?t._onErrorHelper(e):r.unlink(a,(function(e){e?t._onErrorHelper(e):t.send(n)}))}))}}))}))},e.prototype._onErrorHelper=function(e){"function"==typeof this._onError&&this._onError(e)},e.TAG="Sender",e.ICACLS_PATH=process.env.systemdrive+"/windows/system32/icacls.exe",e.POWERSHELL_PATH=process.env.systemdrive+"/windows/system32/windowspowershell/v1.0/powershell.exe",e.ACLED_DIRECTORIES={},e.ACL_IDENTITY=null,e.WAIT_BETWEEN_RESEND=6e4,e.MAX_BYTES_ON_DISK=5e7,e.MAX_CONNECTION_FAILURES_BEFORE_WARN=5,e.TEMPDIR_PREFIX="appInsights-node",e.OS_PROVIDES_FILE_PROTECTION=!1,e.USE_ICACLS="Windows_NT"===i.type(),e}();e.exports=p},7625:(e,t,n)=>{"use strict";var r=n(8835),i=n(9253),o=n(4470),s=n(5290),a=n(3504),c=n(9428),u=n(894),l=n(2588),p=n(5740),f=n(5282),d=n(9813),h=function(){function e(e){this._telemetryProcessors=[];var t=new i(e);this.config=t,this.context=new o,this.commonProperties={};var n=new l(this.config);this.channel=new a((function(){return t.disableAppInsights}),(function(){return t.maxBatchSize}),(function(){return t.maxBatchIntervalMs}),n)}return e.prototype.trackAvailability=function(e){this.track(e,s.TelemetryType.Availability)},e.prototype.trackTrace=function(e){this.track(e,s.TelemetryType.Trace)},e.prototype.trackMetric=function(e){this.track(e,s.TelemetryType.Metric)},e.prototype.trackException=function(e){e&&e.exception&&!p.isError(e.exception)&&(e.exception=new Error(e.exception.toString())),this.track(e,s.TelemetryType.Exception)},e.prototype.trackEvent=function(e){this.track(e,s.TelemetryType.Event)},e.prototype.trackRequest=function(e){this.track(e,s.TelemetryType.Request)},e.prototype.trackDependency=function(e){e&&!e.target&&e.data&&(e.target=r.parse(e.data).host),this.track(e,s.TelemetryType.Dependency)},e.prototype.flush=function(e){this.channel.triggerSend(!!e&&!!e.isAppCrashing,e?e.callback:void 0)},e.prototype.track=function(e,t){if(e&&s.telemetryTypeToBaseType(t)){var n=d.createEnvelope(e,t,this.commonProperties,this.context,this.config);e.time&&(n.time=e.time.toISOString());var r=this.runTelemetryProcessors(n,e.contextObjects);r=r&&c.samplingTelemetryProcessor(n,{correlationContext:u.CorrelationContextManager.getCurrentContext()}),c.performanceMetricsTelemetryProcessor(n,this.quickPulseClient),r&&this.channel.send(n)}else f.warn("track() requires telemetry object and telemetryType to be specified.")},e.prototype.addTelemetryProcessor=function(e){this._telemetryProcessors.push(e)},e.prototype.clearTelemetryProcessors=function(){this._telemetryProcessors=[]},e.prototype.runTelemetryProcessors=function(e,t){var n=!0,r=this._telemetryProcessors.length;if(0===r)return n;(t=t||{}).correlationContext=u.CorrelationContextManager.getCurrentContext();for(var i=0;i{"use strict";var r=n(5740),i=n(9962),o=function(){function e(t,n){if(this.traceFlag=e.DEFAULT_TRACE_FLAG,this.version=e.DEFAULT_VERSION,t&&"string"==typeof t)if(t.split(",").length>1)this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16);else{var o=t.trim().split("-"),s=o.length;s>=4?(this.version=o[0],this.traceId=o[1],this.spanId=o[2],this.traceFlag=o[3]):(this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)),this.version.match(/^[0-9a-f]{2}$/g)||(this.version=e.DEFAULT_VERSION,this.traceId=r.w3cTraceId()),"00"===this.version&&4!==s&&(this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)),"ff"===this.version&&(this.version=e.DEFAULT_VERSION,this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)),this.version.match(/^0[0-9a-f]$/g)||(this.version=e.DEFAULT_VERSION),this.traceFlag.match(/^[0-9a-f]{2}$/g)||(this.traceFlag=e.DEFAULT_TRACE_FLAG,this.traceId=r.w3cTraceId()),e.isValidTraceId(this.traceId)||(this.traceId=r.w3cTraceId()),e.isValidSpanId(this.spanId)||(this.spanId=r.w3cTraceId().substr(0,16),this.traceId=r.w3cTraceId()),this.parentId=this.getBackCompatRequestId()}else if(n){this.parentId=n.slice();var a=i.getRootId(n);e.isValidTraceId(a)||(this.legacyRootId=a,a=r.w3cTraceId()),-1!==n.indexOf("|")&&(n=n.substring(1+n.substring(0,n.length-1).lastIndexOf("."),n.length-1)),this.traceId=a,this.spanId=n}else this.traceId=r.w3cTraceId(),this.spanId=r.w3cTraceId().substr(0,16)}return e.isValidTraceId=function(e){return e.match(/^[0-9a-f]{32}$/)&&"00000000000000000000000000000000"!==e},e.isValidSpanId=function(e){return e.match(/^[0-9a-f]{16}$/)&&"0000000000000000"!==e},e.prototype.getBackCompatRequestId=function(){return"|"+this.traceId+"."+this.spanId+"."},e.prototype.toString=function(){return this.version+"-"+this.traceId+"-"+this.spanId+"-"+this.traceFlag},e.prototype.updateSpanId=function(){this.spanId=r.w3cTraceId().substr(0,16)},e.DEFAULT_TRACE_FLAG="01",e.DEFAULT_VERSION="00",e}();e.exports=o},6333:e=>{"use strict";var t=function(){function e(e){this.fieldmap=[],e&&(this.fieldmap=this.parseHeader(e))}return e.prototype.toString=function(){var e=this.fieldmap;return e&&0!=e.length?e.join(", "):null},e.validateKeyChars=function(e){var t=e.split("@");if(2==t.length){var n=t[0].trim(),r=t[1].trim(),i=Boolean(n.match(/^[\ ]?[a-z0-9\*\-\_/]{1,241}$/)),o=Boolean(r.match(/^[\ ]?[a-z0-9\*\-\_/]{1,14}$/));return i&&o}return 1==t.length&&Boolean(e.match(/^[\ ]?[a-z0-9\*\-\_/]{1,256}$/))},e.prototype.parseHeader=function(t){var n=[],r={},i=t.split(",");if(i.length>32)return null;for(var o=0,s=i;o>t&255)},n=e.map((function(e){return t(e,24)+t(e,16)+t(e,8)+t(e,0)})).join(""),r=(Buffer.from?Buffer.from(n,"binary"):new Buffer(n,"binary")).toString("base64");return r.substr(0,r.indexOf("="))},e.random32=function(){return 4294967296*Math.random()|0},e.randomu32=function(){return e.random32()+2147483648},e.w3cTraceId=function(){for(var t,n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],r="",i=0;i<4;i++)r+=n[15&(t=e.random32())]+n[t>>4&15]+n[t>>8&15]+n[t>>12&15]+n[t>>16&15]+n[t>>20&15]+n[t>>24&15]+n[t>>28&15];var o=n[8+4*Math.random()|0];return r.substr(0,8)+r.substr(9,4)+"4"+r.substr(13,3)+o+r.substr(16,3)+r.substr(19,12)},e.isValidW3CId=function(e){return 32===e.length&&"00000000000000000000000000000000"!==e},e.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},e.isError=function(e){return e instanceof Error},e.isPrimitive=function(e){var t=typeof e;return"string"===t||"number"===t||"boolean"===t},e.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},e.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=(e/1e3%60).toFixed(7).replace(/0{0,4}$/,""),n=""+Math.floor(e/6e4)%60,r=""+Math.floor(e/36e5)%24,i=Math.floor(e/864e5);return t=t.indexOf(".")<2?"0"+t:t,n=n.length<2?"0"+n:n,(i>0?i+".":"")+(r=r.length<2?"0"+r:r)+":"+n+":"+t},e.extractError=function(e){var t=e;return{message:e.message,code:t.code||t.id||""}},e.extractObject=function(t){return t instanceof Error?e.extractError(t):"function"==typeof t.toJSON?t.toJSON():t},e.validateStringMap=function(t){if("object"==typeof t){var n={};for(var r in t){var i="",o=t[r],s=typeof o;if(e.isPrimitive(o))i=o.toString();else if(null===o||"undefined"===s)i="";else{if("function"===s){c.info("key: "+r+" was function; will not serialize");continue}var a=e.isArray(o)?o:e.extractObject(o);try{i=e.isPrimitive(a)?a:JSON.stringify(a)}catch(e){i=o.constructor.name.toString()+" (Error: "+e.message+")",c.info("key: "+r+", could not be serialized")}}n[r]=i.substring(0,e.MAX_PROPERTY_LENGTH)}return n}c.info("Invalid properties dropped from payload")},e.canIncludeCorrelationHeader=function(e,t){var n=e&&e.config&&e.config.correlationHeaderExcludedDomains;if(!n||0==n.length||!t)return!0;for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4350),i=n(5290);t.performanceMetricsTelemetryProcessor=function(e,t){switch(t&&t.addDocument(e),e.data.baseType){case i.TelemetryTypeString.Exception:r.countException();break;case i.TelemetryTypeString.Request:var n=e.data.baseData;r.countRequest(n.duration,n.success);break;case i.TelemetryTypeString.Dependency:var o=e.data.baseData;r.countDependency(o.duration,o.success)}return!0}},2037:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5290);function i(e){var t=2147483647,n=5381;if(!e)return 0;for(;e.length<8;)e+=e;for(var r=0;r=100||(!(!e.data||r.TelemetryType.Metric!==r.baseTypeToTelemetryType(e.data.baseType))||(t.correlationContext&&t.correlationContext.operation?i(t.correlationContext.operation.id){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2037)),r(n(4127))},9574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(894),o=n(6281),s=n(6639),a=n(4350),c=n(8723),u=n(731),l=n(9962),p=n(5282),f=n(3668),d=n(1629);t.TelemetryClient=n(1259),t.Contracts=n(5290),function(e){e[e.AI=0]="AI",e[e.AI_AND_W3C=1]="AI_AND_W3C"}(r=t.DistributedTracingModes||(t.DistributedTracingModes={}));var h,m,g,v,y,_,E,b,w,S=!0,I=!1,C=!0,x=!0,O=!0,T=!0,A=!0,N=!0,P=!1,L=!0,R=void 0,k=void 0,D=!1;function M(){return t.defaultClient?(D=!0,g.enable(S,I),v.enable(C),y.enable(x),_.enable(L,m),E.useAutoCorrelation(N,h),E.enable(O),b.enable(T),t.liveMetricsClient&&P&&t.liveMetricsClient.enable(P)):p.warn("Start cannot be called before setup"),V}t.setup=function(e){return t.defaultClient?p.info("The default client is already setup"):(t.defaultClient=new t.TelemetryClient(e),g=new o(t.defaultClient),v=new s(t.defaultClient),y=new a(t.defaultClient),E=new u(t.defaultClient),b=new c(t.defaultClient),_||(_=new d.AutoCollectNativePerformance(t.defaultClient))),t.defaultClient&&t.defaultClient.channel&&t.defaultClient.channel.setUseDiskRetryCaching(A,R,k),V},t.start=M,t.getCorrelationContext=function(){return N?i.CorrelationContextManager.getCurrentContext():null},t.wrapWithCorrelationContext=function(e){return i.CorrelationContextManager.wrapCallback(e)};var V=function(){function e(){}return e.setDistributedTracingMode=function(t){return l.w3cEnabled=t===r.AI_AND_W3C,e},e.setAutoCollectConsole=function(t,n){return void 0===n&&(n=!1),S=t,I=n,D&&g.enable(t,n),e},e.setAutoCollectExceptions=function(t){return C=t,D&&v.enable(t),e},e.setAutoCollectPerformance=function(t,n){void 0===n&&(n=!0),x=t;var r=d.AutoCollectNativePerformance.parseEnabled(n);return L=r.isEnabled,m=r.disabledMetrics,D&&(y.enable(t),_.enable(r.isEnabled,r.disabledMetrics)),e},e.setAutoCollectRequests=function(t){return O=t,D&&E.enable(t),e},e.setAutoCollectDependencies=function(t){return T=t,D&&b.enable(t),e},e.setAutoDependencyCorrelation=function(t,n){return N=t,h=n,D&&E.useAutoCorrelation(t,n),e},e.setUseDiskRetryCaching=function(n,r,i){return A=n,R=r,k=i,t.defaultClient&&t.defaultClient.channel&&t.defaultClient.channel.setUseDiskRetryCaching(n,r,i),e},e.setInternalLogging=function(t,n){return void 0===t&&(t=!1),void 0===n&&(n=!0),p.enableDebug=t,p.disableWarnings=!n,e},e.setSendLiveMetrics=function(n){return void 0===n&&(n=!1),t.defaultClient?(!t.liveMetricsClient&&n?(t.liveMetricsClient=new f(t.defaultClient.config.instrumentationKey),w=new a(t.liveMetricsClient,1e3,!0),t.liveMetricsClient.addCollector(w),t.defaultClient.quickPulseClient=t.liveMetricsClient):t.liveMetricsClient&&t.liveMetricsClient.enable(n),P=n,e):(p.warn("Live metrics client cannot be setup without the default client"),e)},e.start=M,e}();t.Configuration=V,t.dispose=function(){t.defaultClient=null,D=!1,g&&g.dispose(),v&&v.dispose(),y&&y.dispose(),_&&_.dispose(),E&&E.dispose(),b&&b.dispose(),t.liveMetricsClient&&(t.liveMetricsClient.enable(!1),P=!1,t.liveMetricsClient=void 0)}},9822:(e,t,n)=>{"use strict";const r=process.binding("async_wrap"),i=r.Providers.TIMERWRAP,o={nextTick:n(3269),promise:n(9565),timers:n(7190)},s=new Set;function a(){this.enabled=!1,this.counter=0}function c(){const e=this.initFns=[],t=this.preFns=[],n=this.postFns=[],r=this.destroyFns=[];this.init=function(t,n,r,o){if(n!==i)for(const i of e)i(t,this,n,r,o);else s.add(t)},this.pre=function(e){if(!s.has(e))for(const n of t)n(e,this)},this.post=function(e,t){if(!s.has(e))for(const r of n)r(e,this,t)},this.destroy=function(e){if(s.has(e))s.delete(e);else for(const t of r)t(e)}}function u(e,t){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}function l(){this._state=new a,this._hooks=new c,this.version=n(1910).i8,this.providers=r.Providers;for(const e of Object.keys(o))o[e].call(this);process.env.hasOwnProperty("NODE_ASYNC_HOOK_WARNING")&&console.warn("warning: you are using async-hook-jl which is unstable."),r.setupHooks({init:this._hooks.init,pre:this._hooks.pre,post:this._hooks.post,destroy:this._hooks.destroy})}c.prototype.add=function(e){e.init&&this.initFns.push(e.init),e.pre&&this.preFns.push(e.pre),e.post&&this.postFns.push(e.post),e.destroy&&this.destroyFns.push(e.destroy)},c.prototype.remove=function(e){e.init&&u(this.initFns,e.init),e.pre&&u(this.preFns,e.pre),e.post&&u(this.postFns,e.post),e.destroy&&u(this.destroyFns,e.destroy)},e.exports=l,l.prototype.addHooks=function(e){this._hooks.add(e)},l.prototype.removeHooks=function(e){this._hooks.remove(e)},l.prototype.enable=function(){this._state.enabled=!0,r.enable()},l.prototype.disable=function(){this._state.enabled=!1,r.disable()}},3223:(e,t,n)=>{"use strict";const r=n(9822);if(global._asyncHook){if(global._asyncHook.version!==n(1910).i8)throw new Error("Conflicting version of async-hook-jl found");e.exports=global._asyncHook}else{n(2512).filter.attach((function(e,t){return t.filter((function(e){const t=e.getFileName();return!(t&&t.slice(0,__dirname.length)===__dirname)}))})),e.exports=global._asyncHook=new r}},1910:e=>{"use strict";e.exports={i8:"1.7.6"}},3269:e=>{"use strict";function t(){}e.exports=function(){const e=this._hooks,n=this._state,r=process.nextTick;process.nextTick=function(){if(!n.enabled)return r.apply(process,arguments);const i=new Array(arguments.length);for(let e=0;e0&&process.once("uncaughtException",(function(){e.post.call(s,a,!0),e.destroy.call(null,a)}))}e.post.call(s,a,!1),e.destroy.call(null,a)},r.apply(process,i)}}},9565:e=>{"use strict";function t(){}e.exports=function(){const e=this._hooks,n=this._state,r=global.Promise,i=r.prototype.then;function o(t,n,r,i){return"function"!=typeof t?i?function(t){return function(n){return e.destroy.call(null,t),n}}(r):function(t){return function(n){throw e.destroy.call(null,t),n}}(r):function(){e.pre.call(n,r);try{return t.apply(this,arguments)}finally{e.post.call(n,r,!1),e.destroy.call(null,r)}}}r.prototype.then=function(r,s){if(!n.enabled)return i.call(this,r,s);const a=new t,c=--n.counter;return e.init.call(a,c,0,null,null),i.call(this,o(r,a,c,!0),o(s,a,c,!1))}}},7190:(e,t,n)=>{"use strict";const r=n(8213);function i(){}function o(){}function s(){}const a=new Map,c=new Map,u=new Map;let l=null,p=!1;function f(e,t,n,i,o,s,a){const c=r[n],u=r[i];r[n]=function(){if(!t.enabled)return c.apply(r,arguments);const n=new Array(arguments.length);for(let e=0;e0&&process.once("uncaughtException",(function(){e.post.call(u,f,!0),s.delete(d),e.destroy.call(null,f)}))}e.post.call(u,f,!1),l=null,(a||p)&&(p=!1,s.delete(d),e.destroy.call(null,f))},d=c.apply(r,n),s.set(d,f),d},r[i]=function(t){if(l===t&&null!==t)p=!0;else if(s.has(t)){const n=s.get(t);s.delete(t),e.destroy.call(null,n)}u.apply(r,arguments)}}e.exports=function(){f(this._hooks,this._state,"setTimeout","clearTimeout",i,a,!0),f(this._hooks,this._state,"setInterval","clearInterval",o,c,!1),f(this._hooks,this._state,"setImmediate","clearImmediate",s,u,!0),global.setTimeout=r.setTimeout,global.setInterval=r.setInterval,global.setImmediate=r.setImmediate,global.clearTimeout=r.clearTimeout,global.clearInterval=r.clearInterval,global.clearImmediate=r.clearImmediate}},8286:e=>{"use strict";e.exports=(e,t)=>class extends e{constructor(e){var n,r;super((function(e,o){n=this,r=[function(n){return t(i,!1),e(n)},function(e){return t(i,!1),o(e)}]}));var i=this;try{e.apply(n,r)}catch(e){r[1](e)}return i}}},9090:(e,t,n)=>{var r,i,o=n(6372).wrap,s=[],a=0,c=!1,u=[];function l(e,t){var n=e.length,r=t.length,i=[];if(0===n&&0===r)return i;for(var o=0;o0&&(s=u.pop()),p=void 0,n&&!c},i=function(e,t,n){var r=[];c=!0;for(var i=0;i0&&t[i].before(this,r[t[i].uid]);c=!1;var o=e.apply(this,arguments);for(c=!0,i=0;i0&&t[i].after(this,r[t[i].uid]);return c=!1,s=u.pop(),p=void 0,o}},o(process,"_fatalException",(function(e){return function(t){return r(t)||e(t)}}))}else{var d=!1;r=function(e){if(d)throw e;for(var t=!1,n=s.length,r=0;r0&&t[f].before(this,i[t[f].uid]);c=!1;try{o=e.apply(this,arguments)}catch(e){a=!0;for(f=0;f0&&t[f].after(this,i[t[f].uid]);c=!1}s=u.pop()}return o}},process.addListener("uncaughtException",r)}function h(e,t){"function"==typeof e.create&&(this.create=e.create,this.flags|=1),"function"==typeof e.before&&(this.before=e.before,this.flags|=2),"function"==typeof e.after&&(this.after=e.after,this.flags|=4),"function"==typeof e.error&&(this.error=e.error,this.flags|=8),this.uid=++a,this.data=void 0===t?null:t}function m(e,t){if("object"!=typeof e||!e)throw new TypeError("callbacks argument must be an object");return e instanceof h?e:new h(e,t)}h.prototype.create=void 0,h.prototype.before=void 0,h.prototype.after=void 0,h.prototype.error=void 0,h.prototype.data=void 0,h.prototype.uid=0,h.prototype.flags=0,process.createAsyncListener=m,process.addAsyncListener=function(e,t){var n;n=e instanceof h?e:m(e,t);for(var r=!1,i=0;i0)return i(e,n,t);return function(e,t,n){c=!0;for(var r=0;r{"use strict";if(process.addAsyncListener)throw new Error("Don't require polyfill unless needed");var r=n(6372),i=n(1249),o=r.wrap,s=r.massWrap,a=n(9090),c=n(1669),u=i.gte(process.version,"6.0.0"),l=i.gte(process.version,"7.0.0"),p=i.gte(process.version,"8.0.0"),f=i.gte(process.version,"11.0.0"),d=n(1631);function h(e){return function(){this.on("connection",(function(e){e._handle&&(e._handle.onread=a(e._handle.onread))}));try{return e.apply(this,arguments)}finally{this._handle&&this._handle.onconnection&&(this._handle.onconnection=a(this._handle.onconnection))}}}function m(e){if(e&&e._handle){var t=e._handle;t._originalOnread||(t._originalOnread=t.onread),t.onread=a(t._originalOnread)}}l&&!d._normalizeArgs?d._normalizeArgs=function(e){if(0===e.length)return[{},null];var t,n,r=e[0],i={};"object"==typeof r&&null!==r?i=r:"string"==typeof(t=r)&&!1===(n=t,(n=Number(n))>=0&&n)?i.path=r:(i.port=r,e.length>1&&"string"==typeof e[1]&&(i.host=e[1]));var o=e[e.length-1];return"function"!=typeof o?[i,null]:[i,o]}:l||d._normalizeConnectArgs||(d._normalizeConnectArgs=function(e){var t,n={};"object"==typeof e[0]&&null!==e[0]?n=e[0]:"string"==typeof e[0]&&!1===(t=e[0],(t=Number(t))>=0&&t)?n.path=e[0]:(n.port=e[0],"string"==typeof e[1]&&(n.host=e[1]));var r=e[e.length-1];return"function"==typeof r?[n,r]:[n]}),"_setUpListenHandle"in d.Server.prototype?o(d.Server.prototype,"_setUpListenHandle",h):o(d.Server.prototype,"_listen2",h),o(d.Socket.prototype,"connect",(function(e){return function(){var t;(t=p&&Array.isArray(arguments[0])&&Object.getOwnPropertySymbols(arguments[0]).length>0?arguments[0]:l?d._normalizeArgs(arguments):d._normalizeConnectArgs(arguments))[1]&&(t[1]=a(t[1]));var n=e.apply(this,t);return m(this),n}}));var g=n(8605);o(g.Agent.prototype,"addRequest",(function(e){return function(t){var n=t.onSocket;return t.onSocket=a((function(e){return m(e),n.apply(this,arguments)})),e.apply(this,arguments)}}));var v=n(3129);function y(e){Array.isArray(e.stdio)&&e.stdio.forEach((function(e){e&&e._handle&&(e._handle.onread=a(e._handle.onread),o(e._handle,"close",L))})),e._handle&&(e._handle.onexit=a(e._handle.onexit))}v.ChildProcess?o(v.ChildProcess.prototype,"spawn",(function(e){return function(){var t=e.apply(this,arguments);return y(this),t}})):s(v,["execFile","fork","spawn"],(function(e){return function(){var t=e.apply(this,arguments);return y(t),t}})),process._fatalException||(process._originalNextTick=process.nextTick);var _=[];process._nextDomainTick&&_.push("_nextDomainTick"),process._tickDomainCallback&&_.push("_tickDomainCallback"),s(process,_,P),o(process,"nextTick",L);var E=["setTimeout","setInterval"];global.setImmediate&&E.push("setImmediate");var b=n(8213),w=global.setTimeout===b.setTimeout;s(b,E,L),w&&s(global,E,L);var S=n(881);s(S,["lookup","resolve","resolve4","resolve6","resolveCname","resolveMx","resolveNs","resolveTxt","resolveSrv","reverse"],P),S.resolveNaptr&&o(S,"resolveNaptr",P);var I,C,x=n(5747);s(x,["watch","rename","truncate","chown","fchown","chmod","fchmod","stat","lstat","fstat","link","symlink","readlink","realpath","unlink","rmdir","mkdir","readdir","close","open","utimes","futimes","fsync","write","read","readFile","writeFile","appendFile","watchFile","unwatchFile","exists"],P),x.lchown&&o(x,"lchown",P),x.lchmod&&o(x,"lchmod",P),x.ftruncate&&o(x,"ftruncate",P);try{I=n(8761)}catch(e){}if(I&&I.Deflate&&I.Deflate.prototype){var O=Object.getPrototypeOf(I.Deflate.prototype);O._transform?o(O,"_transform",P):O.write&&O.flush&&O.end&&s(O,["write","flush","end"],P)}try{C=n(6417)}catch(e){}if(C){var T=["pbkdf2","randomBytes"];f||T.push("pseudoRandomBytes"),s(C,T,P)}var A=!!global.Promise&&"function Promise() { [native code] }"===Promise.toString()&&"function toString() { [native code] }"===Promise.toString.toString();if(A){var N=process.addAsyncListener({create:function(){A=!1}});global.Promise.resolve(!0).then((function(){A=!1})),process.removeAsyncListener(N)}function P(e){var t=function(){var t,n=arguments.length-1;if("function"==typeof arguments[n]){t=Array(arguments.length);for(var r=0;r{"use strict";class n{constructor(e){this.tasks=[],this.count=e}sched(){if(this.count>0&&this.tasks.length>0){this.count--;let e=this.tasks.shift();if(void 0===e)throw"Unexpected undefined value in tasks list";e()}}acquire(){return new Promise(((e,t)=>{this.tasks.push((()=>{var t=!1;e((()=>{t||(t=!0,this.count++,this.sched())}))})),process&&process.nextTick?process.nextTick(this.sched.bind(this)):setImmediate(this.sched.bind(this))}))}use(e){return this.acquire().then((t=>e().then((e=>(t(),e))).catch((e=>{throw t(),e}))))}}t.Semaphore=n;t.Mutex=class extends n{constructor(){super(1)}}},9669:(e,t,n)=>{e.exports=n(1609)},7970:(e,t,n)=>{"use strict";var r=n(4867),i=n(6026),o=n(4097),s=n(5327),a=n(8605),c=n(7211),u=n(2629).http,l=n(2629).https,p=n(8835),f=n(8761),d=n(1075),h=n(5061),m=n(481),g=/https:?/;function v(e,t,n){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=n,t.auth){var r=Buffer.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+r}e.beforeRedirect=function(e){e.headers.host=e.host,v(e,t,e.href)}}e.exports=function(e){return new Promise((function(t,n){var y=function(e){t(e)},_=function(e){n(e)},E=e.data,b=e.headers;if("User-Agent"in b||"user-agent"in b?b["User-Agent"]||b["user-agent"]||(delete b["User-Agent"],delete b["user-agent"]):b["User-Agent"]="axios/"+d.version,E&&!r.isStream(E)){if(Buffer.isBuffer(E));else if(r.isArrayBuffer(E))E=Buffer.from(new Uint8Array(E));else{if(!r.isString(E))return _(h("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));E=Buffer.from(E,"utf-8")}b["Content-Length"]=E.length}var w=void 0;e.auth&&(w=(e.auth.username||"")+":"+(e.auth.password||""));var S=o(e.baseURL,e.url),I=p.parse(S),C=I.protocol||"http:";if(!w&&I.auth){var x=I.auth.split(":");w=(x[0]||"")+":"+(x[1]||"")}w&&delete b.Authorization;var O=g.test(C),T=O?e.httpsAgent:e.httpAgent,A={path:s(I.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:b,agent:T,agents:{http:e.httpAgent,https:e.httpsAgent},auth:w};e.socketPath?A.socketPath=e.socketPath:(A.hostname=I.hostname,A.port=I.port);var N,P=e.proxy;if(!P&&!1!==P){var L=C.slice(0,-1)+"_proxy",R=process.env[L]||process.env[L.toUpperCase()];if(R){var k=p.parse(R),D=process.env.no_proxy||process.env.NO_PROXY,M=!0;if(D)M=!D.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&I.hostname.substr(I.hostname.length-e.length)===e||I.hostname===e))}));if(M&&(P={host:k.hostname,port:k.port,protocol:k.protocol},k.auth)){var V=k.auth.split(":");P.auth={username:V[0],password:V[1]}}}}P&&(A.headers.host=I.hostname+(I.port?":"+I.port:""),v(A,P,C+"//"+I.hostname+(I.port?":"+I.port:"")+A.path));var F=O&&(!P||g.test(P.protocol));e.transport?N=e.transport:0===e.maxRedirects?N=F?c:a:(e.maxRedirects&&(A.maxRedirects=e.maxRedirects),N=F?l:u),e.maxBodyLength>-1&&(A.maxBodyLength=e.maxBodyLength);var j=N.request(A,(function(t){if(!j.aborted){var n=t,o=t.req||j;if(204!==t.statusCode&&"HEAD"!==o.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":n=n.pipe(f.createUnzip()),delete t.headers["content-encoding"]}var s={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:o};if("stream"===e.responseType)s.data=n,i(y,_,s);else{var a=[],c=0;n.on("data",(function(t){a.push(t),c+=t.length,e.maxContentLength>-1&&c>e.maxContentLength&&(n.destroy(),_(h("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,o)))})),n.on("error",(function(t){j.aborted||_(m(t,e,null,o))})),n.on("end",(function(){var t=Buffer.concat(a);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=r.stripBOM(t))),s.data=t,i(y,_,s)}))}}}));if(j.on("error",(function(t){j.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||_(m(t,e,null,j))})),e.timeout){var B=parseInt(e.timeout,10);if(isNaN(B))return void _(h("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",j));j.setTimeout(B,(function(){j.abort(),_(h("timeout of "+B+"ms exceeded",e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",j))}))}e.cancelToken&&e.cancelToken.promise.then((function(e){j.aborted||(j.abort(),_(e))})),r.isStream(E)?E.on("error",(function(t){_(m(t,e,null,j))})).pipe(j):j.end(E)}))}},5448:(e,t,n)=>{"use strict";var r=n(4867),i=n(6026),o=n(3691),s=n(5327),a=n(4097),c=n(4109),u=n(7985),l=n(5061);e.exports=function(e){return new Promise((function(t,n){var p=e.data,f=e.headers,d=e.responseType;r.isFormData(p)&&delete f["Content-Type"];var h=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(m+":"+g)}var v=a(e.baseURL,e.url);function y(){if(h){var r="getAllResponseHeaders"in h?c(h.getAllResponseHeaders()):null,o={data:d&&"text"!==d&&"json"!==d?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h};i(t,n,o),h=null}}if(h.open(e.method.toUpperCase(),s(v,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,"onloadend"in h?h.onloadend=y:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(y)},h.onabort=function(){h&&(n(l("Request aborted",e,"ECONNABORTED",h)),h=null)},h.onerror=function(){n(l("Network Error",e,null,h)),h=null},h.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var _=(e.withCredentials||u(v))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;_&&(f[e.xsrfHeaderName]=_)}"setRequestHeader"in h&&r.forEach(f,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete f[t]:h.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(h.withCredentials=!!e.withCredentials),d&&"json"!==d&&(h.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){h&&(h.abort(),n(e),h=null)})),p||(p=null),h.send(p)}))}},1609:(e,t,n)=>{"use strict";var r=n(4867),i=n(1849),o=n(321),s=n(7185);function a(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var c=a(n(5655));c.Axios=o,c.create=function(e){return a(s(c.defaults,e))},c.Cancel=n(5263),c.CancelToken=n(4972),c.isCancel=n(6502),c.all=function(e){return Promise.all(e)},c.spread=n(8713),c.isAxiosError=n(6268),e.exports=c,e.exports.default=c},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,n)=>{"use strict";var r=n(5263);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,n)=>{"use strict";var r=n(4867),i=n(5327),o=n(782),s=n(3572),a=n(7185),c=n(4875),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!r){var l=[s,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var p=e;n.length;){var f=n.shift(),d=n.shift();try{p=f(p)}catch(e){d(e);break}}try{i=s(p)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},782:(e,t,n)=>{"use strict";var r=n(4867);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},4097:(e,t,n)=>{"use strict";var r=n(1793),i=n(9002);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},5061:(e,t,n)=>{"use strict";var r=n(481);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},3572:(e,t,n)=>{"use strict";var r=n(4867),i=n(8527),o=n(6502),s=n(5655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:(e,t,n)=>{"use strict";var r=n(4867);e.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function u(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=c(void 0,e[i])):n[i]=c(e[i],t[i])}r.forEach(i,(function(e){r.isUndefined(t[e])||(n[e]=c(void 0,t[e]))})),r.forEach(o,u),r.forEach(s,(function(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=c(void 0,e[i])):n[i]=c(void 0,t[i])})),r.forEach(a,(function(r){r in t?n[r]=c(e[r],t[r]):r in e&&(n[r]=c(void 0,e[r]))}));var l=i.concat(o).concat(s).concat(a),p=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return r.forEach(p,u),n}},6026:(e,t,n)=>{"use strict";var r=n(5061);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},8527:(e,t,n)=>{"use strict";var r=n(4867),i=n(5655);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},5655:(e,t,n)=>{"use strict";var r=n(4867),i=n(6016),o=n(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:("undefined"!=typeof XMLHttpRequest?c=n(5448):"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(c=n(7970)),c),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(s)})),e.exports=u},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r{"use strict";var r=n(4867);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},9002:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},3691:(e,t,n)=>{"use strict";var r=n(4867);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,n)=>{"use strict";var r=n(4867);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},6016:(e,t,n)=>{"use strict";var r=n(4867);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},4109:(e,t,n)=>{"use strict";var r=n(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,n)=>{"use strict";var r=n(1075),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={},s=r.version.split(".");function a(e,t){for(var n=t?t.split("."):s,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]0;){var o=r[i],s=t[o];if(s){var a=e[o],c=void 0===a||s(a,o,e);if(!0!==c)throw new TypeError("option "+o+" must be "+c)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},4867:(e,t,n)=>{"use strict";var r=n(1849),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===i.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,r=e.length;n{var r;e.exports=function(){if(!r){try{r=n(5158)("follow-redirects")}catch(e){}"function"!=typeof r&&(r=function(){})}r.apply(null,arguments)}},2629:(e,t,n)=>{var r=n(8835),i=r.URL,o=n(8605),s=n(7211),a=n(2413).Writable,c=n(2357),u=n(7109),l=["abort","aborted","connect","error","socket","timeout"],p=Object.create(null);l.forEach((function(e){p[e]=function(t,n,r){this._redirectable.emit(e,t,n,r)}}));var f=b("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),d=b("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),h=b("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),m=b("ERR_STREAM_WRITE_AFTER_END","write after end");function g(e,t){a.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var n=this;this._onNativeResponse=function(e){n._processResponse(e)},this._performRequest()}function v(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach((function(o){var s=o+":",a=n[s]=e[o],l=t[o]=Object.create(a);Object.defineProperties(l,{request:{value:function(e,o,a){if("string"==typeof e){var l=e;try{e=_(new i(l))}catch(t){e=r.parse(l)}}else i&&e instanceof i?e=_(e):(a=o,o=e,e={protocol:s});return"function"==typeof o&&(a=o,o=null),(o=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,o)).nativeProtocols=n,c.equal(o.protocol,s,"protocol mismatch"),u("options",o),new g(o,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,n){var r=l.request(e,t,n);return r.end(),r},configurable:!0,enumerable:!0,writable:!0}})})),t}function y(){}function _(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function E(e,t){var n;for(var r in t)e.test(r)&&(n=t[r],delete t[r]);return null==n?void 0:String(n).trim()}function b(e,t){function n(e){Error.captureStackTrace(this,this.constructor),e?(this.message=t+": "+e.message,this.cause=e):this.message=t}return n.prototype=new Error,n.prototype.constructor=n,n.prototype.name="Error ["+e+"]",n.prototype.code=e,n}function w(e){for(var t=0;t=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(w(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new d);else{((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],E(/^content-/i,this._options.headers));var i,o=E(/^host$/i,this._options.headers),s=r.parse(this._currentUrl),a=o||s.host,c=/^\w+:/.test(n)?this._currentUrl:r.format(Object.assign(s,{host:a}));try{i=r.resolve(c,n)}catch(e){return void this.emit("error",new f(e))}u("redirecting to",i),this._isRedirect=!0;var l=r.parse(i);if(Object.assign(this._options,l),(l.protocol!==s.protocol&&"https:"!==l.protocol||l.host!==a&&!function(e,t){const n=e.length-t.length-1;return n>0&&"."===e[n]&&e.endsWith(t)}(l.host,a))&&E(/^(?:authorization|cookie)$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var p={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,p)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new f(e))}}},e.exports=v({http:o,https:s}),e.exports.wrap=v},1075:e=>{"use strict";e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},5623:e=>{"use strict";function t(e,t,i){e instanceof RegExp&&(e=n(e,i)),t instanceof RegExp&&(t=n(t,i));var o=r(e,t,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+e.length,o[1]),post:i.slice(o[1]+t.length)}}function n(e,t){var n=t.match(e);return n?n[0]:null}function r(e,t,n){var r,i,o,s,a,c=n.indexOf(e),u=n.indexOf(t,c+1),l=c;if(c>=0&&u>0){if(e===t)return[c,u];for(r=[],o=n.length;l>=0&&!a;)l==c?(r.push(l),c=n.indexOf(e,l+1)):1==r.length?a=[r.pop(),u]:((i=r.pop())=0?c:u;r.length&&(a=[o,s])}return a}e.exports=t,t.range=r},3644:(e,t,n)=>{var r=n(1048),i=n(5623);e.exports=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return v(function(e){return e.split("\\\\").join(o).split("\\{").join(s).split("\\}").join(a).split("\\,").join(c).split("\\.").join(u)}(e),!0).map(p)};var o="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",c="\0COMMA"+Math.random()+"\0",u="\0PERIOD"+Math.random()+"\0";function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function p(e){return e.split(o).join("\\").split(s).join("{").split(a).join("}").split(c).join(",").split(u).join(".")}function f(e){if(!e)return[""];var t=[],n=i("{","}",e);if(!n)return e.split(",");var r=n.pre,o=n.body,s=n.post,a=r.split(",");a[a.length-1]+="{"+o+"}";var c=f(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),t.push.apply(t,a),t}function d(e){return"{"+e+"}"}function h(e){return/^-?0\d/.test(e)}function m(e,t){return e<=t}function g(e,t){return e>=t}function v(e,t){var n=[],o=i("{","}",e);if(!o||/\$$/.test(o.pre))return[e];var s,c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),p=c||u,y=o.body.indexOf(",")>=0;if(!p&&!y)return o.post.match(/,.*\}/)?v(e=o.pre+"{"+o.body+a+o.post):[e];if(p)s=o.body.split(/\.\./);else if(1===(s=f(o.body)).length&&1===(s=v(s[0],!1).map(d)).length)return(b=o.post.length?v(o.post,!1):[""]).map((function(e){return o.pre+s[0]+e}));var _,E=o.pre,b=o.post.length?v(o.post,!1):[""];if(p){var w=l(s[0]),S=l(s[1]),I=Math.max(s[0].length,s[1].length),C=3==s.length?Math.abs(l(s[2])):1,x=m;S0){var P=new Array(N+1).join("0");A=T<0?"-"+P+A.slice(1):P+A}}_.push(A)}}else _=r(s,(function(e){return v(e,!1)}));for(var L=0;L<_.length;L++)for(var R=0;R{var r=n(4293).Buffer,i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function o(e){if(r.isBuffer(e))return e;var t="function"==typeof r.alloc&&"function"==typeof r.from;if("number"==typeof e)return t?r.alloc(e):new r(e);if("string"==typeof e)return t?r.from(e):new r(e);throw new Error("input must be buffer, number, or string, received "+typeof e)}function s(e){var t=o(4);return t.writeInt32BE(e,0),t}function a(e,t){e=o(e),r.isBuffer(t)&&(t=t.readUInt32BE(0));for(var n=-1^~~t,s=0;s>>8;return-1^n}function c(){return s(a.apply(null,arguments))}"undefined"!=typeof Int32Array&&(i=new Int32Array(i)),c.signed=function(){return a.apply(null,arguments)},c.unsigned=function(){return a.apply(null,arguments)>>>0},e.exports=c},4046:(e,t,n)=>{"use strict";const r=n(1669),i=n(2357),o=n(9867),s=n(3223),a="error@context",c=[];for(let e in s.providers)c[s.providers[e]]=e;const u=process.env.DEBUG_CLS_HOOKED;let l=-1;function p(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map}function f(e){return process.namespaces[e]}function d(e){let t=f(e);i.ok(t,"can't delete nonexistent namespace! \""+e+'"'),i.ok(t.id,"don't assign to process.namespaces directly! "+r.inspect(t)),process.namespaces[e]=null}function h(e){process.env.DEBUG&&process._rawDebug(e)}function m(e){return e?"function"==typeof e?e.name?e.name:(e.toString().trim().match(/^function\s*([^\s(]+)/)||[])[1]:e.constructor&&e.constructor.name?e.constructor.name:void 0:e}if(e.exports={getNamespace:f,createNamespace:function(e){i.ok(e,"namespace must be given a name."),u&&h("CREATING NAMESPACE "+e);let t=new p(e);return t.id=l,s.addHooks({init(n,i,o,s,a){l=n,s?(t._contexts.set(n,t._contexts.get(s)),u&&h("PARENTID: "+e+" uid:"+n+" parent:"+s+" provider:"+o)):t._contexts.set(l,t.active),u&&h("INIT "+e+" uid:"+n+" parent:"+s+" provider:"+c[o]+" active:"+r.inspect(t.active,!0))},pre(n,i){l=n;let o=t._contexts.get(n);o?(u&&h(" PRE "+e+" uid:"+n+" handle:"+m(i)+" context:"+r.inspect(o)),t.enter(o)):u&&h(" PRE MISSING CONTEXT "+e+" uid:"+n+" handle:"+m(i))},post(n,i){l=n;let o=t._contexts.get(n);o?(u&&h(" POST "+e+" uid:"+n+" handle:"+m(i)+" context:"+r.inspect(o)),t.exit(o)):u&&h(" POST MISSING CONTEXT "+e+" uid:"+n+" handle:"+m(i))},destroy(n){l=n,u&&h("DESTROY "+e+" uid:"+n+" context:"+r.inspect(t._contexts.get(l))+" active:"+r.inspect(t.active,!0)),t._contexts.delete(n)}}),process.namespaces[e]=t,t},destroyNamespace:d,reset:function(){process.namespaces&&Object.keys(process.namespaces).forEach((function(e){d(e)}));process.namespaces=Object.create(null)},ERROR_SYMBOL:a},p.prototype.set=function(e,t){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");return u&&h(" SETTING KEY:"+e+"="+t+" in ns:"+this.name+" uid:"+l+" active:"+r.inspect(this.active,!0)),this.active[e]=t,t},p.prototype.get=function(e){if(this.active)return u&&h(" GETTING KEY:"+e+"="+this.active[e]+" "+this.name+" uid:"+l+" active:"+r.inspect(this.active,!0)),this.active[e];u&&h(" GETTING KEY:"+e+"=undefined "+this.name+" uid:"+l+" active:"+r.inspect(this.active,!0))},p.prototype.createContext=function(){u&&h(" CREATING Context: "+this.name+" uid:"+l+" len:"+this._set.length+" active:"+r.inspect(this.active,!0,2,!0));let e=Object.create(this.active?this.active:Object.prototype);return e._ns_name=this.name,e.id=l,u&&h(" CREATED Context: "+this.name+" uid:"+l+" len:"+this._set.length+" context:"+r.inspect(e,!0,2,!0)),e},p.prototype.run=function(e){let t=this.createContext();this.enter(t);try{return u&&h(" BEFORE RUN: "+this.name+" uid:"+l+" len:"+this._set.length+" "+r.inspect(t)),e(t),t}catch(e){throw e&&(e[a]=t),e}finally{u&&h(" AFTER RUN: "+this.name+" uid:"+l+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t)}},p.prototype.runAndReturn=function(e){var t;return this.run((function(n){t=e(n)})),t},p.prototype.runPromise=function(e){let t=this.createContext();this.enter(t);let n=e(t);if(!n||!n.then||!n.catch)throw new Error("fn must return a promise.");return u&&h(" BEFORE runPromise: "+this.name+" uid:"+l+" len:"+this._set.length+" "+r.inspect(t)),n.then((e=>(u&&h(" AFTER runPromise: "+this.name+" uid:"+l+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e))).catch((e=>{throw e[a]=t,u&&h(" AFTER runPromise: "+this.name+" uid:"+l+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e}))},p.prototype.bind=function(e,t){t||(t=this.active?this.active:this.createContext());let n=this;return function(){n.enter(t);try{return e.apply(this,arguments)}catch(e){throw e&&(e[a]=t),e}finally{n.exit(t)}}},p.prototype.enter=function(e){i.ok(e,"context must be provided for entering"),u&&h(" ENTER "+this.name+" uid:"+l+" len:"+this._set.length+" context: "+r.inspect(e)),this._set.push(this.active),this.active=e},p.prototype.exit=function(e){if(i.ok(e,"context must be provided for exiting"),u&&h(" EXIT "+this.name+" uid:"+l+" len:"+this._set.length+" context: "+r.inspect(e)),this.active===e)return i.ok(this._set.length,"can't remove top context"),void(this.active=this._set.pop());let t=this._set.lastIndexOf(e);t<0?(u&&h("??ERROR?? context exiting but not entered - ignoring: "+r.inspect(e)),i.ok(t>=0,"context not currently entered; can't exit. \n"+r.inspect(this)+"\n"+r.inspect(e))):(i.ok(t,"can't remove top context"),this._set.splice(t,1))},p.prototype.bindEmitter=function(e){i.ok(e.on&&e.addListener&&e.emit,"can only bind real EEs");let t=this,n="context@"+this.name;o(e,(function(e){e&&(e["cls@contexts"]||(e["cls@contexts"]=Object.create(null)),e["cls@contexts"][n]={namespace:t,context:t.active})}),(function(e){if(!e||!e["cls@contexts"])return e;let t=e,n=e["cls@contexts"];return Object.keys(n).forEach((function(e){let r=n[e];t=r.namespace.bind(t,r.context)})),t}))},p.prototype.fromException=function(e){return e[a]},process.namespaces={},s._state&&!s._state.enabled&&s.enable(),u){var g=n(2512);for(var v in g.filter._modifiers)g.filter.deattach(v)}},3964:(e,t,n)=>{"use strict";const r=n(1669),i=n(2357),o=n(9867),s=n(7303),a="error@context",c=process.env.DEBUG_CLS_HOOKED;let u=-1;function l(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map,this._indent=0}function p(e){return process.namespaces[e]}function f(e){let t=p(e);i.ok(t,"can't delete nonexistent namespace! \""+e+'"'),i.ok(t.id,"don't assign to process.namespaces directly! "+r.inspect(t)),process.namespaces[e]=null}function d(...e){c&&process._rawDebug(`${r.format(...e)}`)}e.exports={getNamespace:p,createNamespace:function(e){i.ok(e,"namespace must be given a name."),c&&d(`NS-CREATING NAMESPACE (${e})`);let t=new l(e);t.id=u;return s.createHook({init(n,i,o,a){u=s.executionAsyncId();if(t.active){t._contexts.set(n,t.active);if(c){const s=" ".repeat(t._indent<0?0:t._indent);d(`${s}INIT [${i}] (${e}) asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}}else if(u===0){const o=s.triggerAsyncId();const l=t._contexts.get(o);if(l){t._contexts.set(n,l);if(c){const s=" ".repeat(t._indent<0?0:t._indent);d(`${s}INIT USING CONTEXT FROM TRIGGERID [${i}] (${e}) asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}}else if(c){const s=" ".repeat(t._indent<0?0:t._indent);d(`${s}INIT MISSING CONTEXT [${i}] (${e}) asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}}if(c&&i==="PROMISE"){d(r.inspect(a,{showHidden:true}));const s=a.parentId;const c=" ".repeat(t._indent<0?0:t._indent);d(`${c}INIT RESOURCE-PROMISE [${i}] (${e}) parentId:${s} asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} resource:${a}`)}},before(n){u=s.executionAsyncId();let i;i=t._contexts.get(n)||t._contexts.get(u);if(i){if(c){const o=s.triggerAsyncId();const a=" ".repeat(t._indent<0?0:t._indent);d(`${a}BEFORE (${e}) asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(i)}`);t._indent+=2}t.enter(i)}else if(c){const i=s.triggerAsyncId();const o=" ".repeat(t._indent<0?0:t._indent);d(`${o}BEFORE MISSING CONTEXT (${e}) asyncId:${n} currentUid:${u} triggerId:${i} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} namespace._contexts:${r.inspect(t._contexts,{showHidden:true,depth:2,colors:true})}`);t._indent+=2}},after(n){u=s.executionAsyncId();let i;i=t._contexts.get(n)||t._contexts.get(u);if(i){if(c){const o=s.triggerAsyncId();t._indent-=2;const a=" ".repeat(t._indent<0?0:t._indent);d(`${a}AFTER (${e}) asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(i)}`)}t.exit(i)}else if(c){const o=s.triggerAsyncId();t._indent-=2;const a=" ".repeat(t._indent<0?0:t._indent);d(`${a}AFTER MISSING CONTEXT (${e}) asyncId:${n} currentUid:${u} triggerId:${o} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(i)}`)}},destroy(n){u=s.executionAsyncId();if(c){const i=s.triggerAsyncId();const o=" ".repeat(t._indent<0?0:t._indent);d(`${o}DESTROY (${e}) currentUid:${u} asyncId:${n} triggerId:${i} active:${r.inspect(t.active,{showHidden:true,depth:2,colors:true})} context:${r.inspect(t._contexts.get(u))}`)}t._contexts.delete(n)}}).enable(),process.namespaces[e]=t,t},destroyNamespace:f,reset:function(){process.namespaces&&Object.keys(process.namespaces).forEach((function(e){f(e)}));process.namespaces=Object.create(null)},ERROR_SYMBOL:a},l.prototype.set=function(e,t){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");if(this.active[e]=t,c){d(" ".repeat(this._indent<0?0:this._indent)+"CONTEXT-SET KEY:"+e+"="+t+" in ns:"+this.name+" currentUid:"+u+" active:"+r.inspect(this.active,{showHidden:!0,depth:2,colors:!0}))}return t},l.prototype.get=function(e){if(this.active){if(c){const t=s.executionAsyncId(),n=s.triggerAsyncId(),i=" ".repeat(this._indent<0?0:this._indent);d(i+"CONTEXT-GETTING KEY:"+e+"="+this.active[e]+" ("+this.name+") currentUid:"+u+" active:"+r.inspect(this.active,{showHidden:!0,depth:2,colors:!0})),d(`${i}CONTEXT-GETTING KEY: (${this.name}) ${e}=${this.active[e]} currentUid:${u} asyncHooksCurrentId:${t} triggerId:${n} len:${this._set.length} active:${r.inspect(this.active)}`)}return this.active[e]}if(c){const t=s.currentId(),n=s.triggerAsyncId();d(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-GETTING KEY NO ACTIVE NS: (${this.name}) ${e}=undefined currentUid:${u} asyncHooksCurrentId:${t} triggerId:${n} len:${this._set.length}`)}},l.prototype.createContext=function(){let e=Object.create(this.active?this.active:Object.prototype);if(e._ns_name=this.name,e.id=u,c){const t=s.executionAsyncId(),n=s.triggerAsyncId();d(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-CREATED Context: (${this.name}) currentUid:${u} asyncHooksCurrentId:${t} triggerId:${n} len:${this._set.length} context:${r.inspect(e,{showHidden:!0,depth:2,colors:!0})}`)}return e},l.prototype.run=function(e){let t=this.createContext();this.enter(t);try{if(c){const e=s.triggerAsyncId(),n=s.executionAsyncId();d(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-RUN BEGIN: (${this.name}) currentUid:${u} triggerId:${e} asyncHooksCurrentId:${n} len:${this._set.length} context:${r.inspect(t)}`)}return e(t),t}catch(e){throw e&&(e[a]=t),e}finally{if(c){const e=s.triggerAsyncId(),n=s.executionAsyncId();d(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-RUN END: (${this.name}) currentUid:${u} triggerId:${e} asyncHooksCurrentId:${n} len:${this._set.length} ${r.inspect(t)}`)}this.exit(t)}},l.prototype.runAndReturn=function(e){let t;return this.run((function(n){t=e(n)})),t},l.prototype.runPromise=function(e){let t=this.createContext();this.enter(t);let n=e(t);if(!n||!n.then||!n.catch)throw new Error("fn must return a promise.");return c&&d("CONTEXT-runPromise BEFORE: ("+this.name+") currentUid:"+u+" len:"+this._set.length+" "+r.inspect(t)),n.then((e=>(c&&d("CONTEXT-runPromise AFTER then: ("+this.name+") currentUid:"+u+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e))).catch((e=>{throw e[a]=t,c&&d("CONTEXT-runPromise AFTER catch: ("+this.name+") currentUid:"+u+" len:"+this._set.length+" "+r.inspect(t)),this.exit(t),e}))},l.prototype.bind=function(e,t){t||(t=this.active?this.active:this.createContext());let n=this;return function(){n.enter(t);try{return e.apply(this,arguments)}catch(e){throw e&&(e[a]=t),e}finally{n.exit(t)}}},l.prototype.enter=function(e){if(i.ok(e,"context must be provided for entering"),c){const t=s.executionAsyncId(),n=s.triggerAsyncId();d(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-ENTER: (${this.name}) currentUid:${u} triggerId:${n} asyncHooksCurrentId:${t} len:${this._set.length} ${r.inspect(e)}`)}this._set.push(this.active),this.active=e},l.prototype.exit=function(e){if(i.ok(e,"context must be provided for exiting"),c){const t=s.executionAsyncId(),n=s.triggerAsyncId();d(`${" ".repeat(this._indent<0?0:this._indent)}CONTEXT-EXIT: (${this.name}) currentUid:${u} triggerId:${n} asyncHooksCurrentId:${t} len:${this._set.length} ${r.inspect(e)}`)}if(this.active===e)return i.ok(this._set.length,"can't remove top context"),void(this.active=this._set.pop());let t=this._set.lastIndexOf(e);t<0?(c&&d("??ERROR?? context exiting but not entered - ignoring: "+r.inspect(e)),i.ok(t>=0,"context not currently entered; can't exit. \n"+r.inspect(this)+"\n"+r.inspect(e))):(i.ok(t,"can't remove top context"),this._set.splice(t,1))},l.prototype.bindEmitter=function(e){i.ok(e.on&&e.addListener&&e.emit,"can only bind real EEs");let t=this,n="context@"+this.name;o(e,(function(e){e&&(e["cls@contexts"]||(e["cls@contexts"]=Object.create(null)),e["cls@contexts"][n]={namespace:t,context:t.active})}),(function(e){if(!e||!e["cls@contexts"])return e;let t=e,n=e["cls@contexts"];return Object.keys(n).forEach((function(e){let r=n[e];t=r.namespace.bind(t,r.context)})),t}))},l.prototype.fromException=function(e){return e[a]},process.namespaces={}},9562:(e,t,n)=>{"use strict";const r=n(1249);process&&r.gte(process.versions.node,"8.0.0")?e.exports=n(3964):e.exports=n(4046)},1048:e=>{e.exports=function(e,n){for(var r=[],i=0;i{"use strict";var r=n(2357),i=n(9867),o="error@context";function s(e){this.name=e,this.active=null,this._set=[],this.id=null}function a(e){return process.namespaces[e]}function c(e){var t=a(e);r.ok(t,"can't delete nonexistent namespace!"),r.ok(t.id,"don't assign to process.namespaces directly!"),process.removeAsyncListener(t.id),process.namespaces[e]=null}function u(){process.namespaces&&Object.keys(process.namespaces).forEach((function(e){c(e)})),process.namespaces=Object.create(null)}process.addAsyncListener||n(7645),s.prototype.set=function(e,t){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");return this.active[e]=t,t},s.prototype.get=function(e){if(this.active)return this.active[e]},s.prototype.createContext=function(){return Object.create(this.active)},s.prototype.run=function(e){var t=this.createContext();this.enter(t);try{return e(t),t}catch(e){throw e&&(e[o]=t),e}finally{this.exit(t)}},s.prototype.runAndReturn=function(e){var t;return this.run((function(n){t=e(n)})),t},s.prototype.bind=function(e,t){t||(t=this.active?this.active:this.createContext());var n=this;return function(){n.enter(t);try{return e.apply(this,arguments)}catch(e){throw e&&(e[o]=t),e}finally{n.exit(t)}}},s.prototype.enter=function(e){r.ok(e,"context must be provided for entering"),this._set.push(this.active),this.active=e},s.prototype.exit=function(e){if(r.ok(e,"context must be provided for exiting"),this.active===e)return r.ok(this._set.length,"can't remove top context"),void(this.active=this._set.pop());var t=this._set.lastIndexOf(e);r.ok(t>=0,"context not currently entered; can't exit"),r.ok(t,"can't remove top context"),this._set.splice(t,1)},s.prototype.bindEmitter=function(e){r.ok(e.on&&e.addListener&&e.emit,"can only bind real EEs");var t=this,n="context@"+this.name;i(e,(function(e){e&&(e["cls@contexts"]||(e["cls@contexts"]=Object.create(null)),e["cls@contexts"][n]={namespace:t,context:t.active})}),(function(e){if(!e||!e["cls@contexts"])return e;var t=e,n=e["cls@contexts"];return Object.keys(n).forEach((function(e){var r=n[e];t=r.namespace.bind(t,r.context)})),t}))},s.prototype.fromException=function(e){return e[o]},process.namespaces||u(),e.exports={getNamespace:a,createNamespace:function(e){r.ok(e,"namespace must be given a name!");var t=new s(e);return t.id=process.addAsyncListener({create:function(){return t.active},before:function(e,n){n&&t.enter(n)},after:function(e,n){n&&t.exit(n)},error:function(e){e&&t.exit(e)}}),process.namespaces[e]=t,t},destroyNamespace:c,reset:u}},296:e=>{function t(e,t,n){var r,i,o,s,a;function c(){var u=Date.now()-s;u=0?r=setTimeout(c,t-u):(r=null,n||(a=e.apply(o,i),o=i=null))}null==t&&(t=100);var u=function(){o=this,i=arguments,s=Date.now();var u=n&&!r;return r||(r=setTimeout(c,t)),u&&(a=e.apply(o,i),o=i=null),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},u}t.debounce=t,e.exports=t},1227:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(2447)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},2447:(e,t,n)=>{e.exports=function(e){function t(e){let n,i=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=n(1227):e.exports=n(39)},39:(e,t,n)=>{const r=n(3867),i=n(1669);t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=n(2130);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=n(2447)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}},8604:function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n= 1.0.0 < 2.0.0",patch:function(e){try{var n=new(0,Object(function(){var e=new Error("Cannot find module '@opentelemetry/tracing'");throw e.code="MODULE_NOT_FOUND",e}()).BasicTracer)(i.channel.spanContextPropagator?{scopeManager:i.channel.spanContextPropagator}:void 0),s=n.startSpan;n.startSpan=function(e,t){if(!t||!t.parent){var i=n.getCurrentSpan();i&&i.operation&&i.operation.traceparent&&(t=r({},t,{parent:{traceId:i.operation.traceparent.traceId,spanId:i.operation.traceparent.spanId}}))}var o=s.call(this,e,t);return o.addEvent("Application Insights Integration enabled"),o},n.addSpanProcessor(new o),n[t.AzureMonitorSymbol]=!0,e.setTracer(n)}catch(e){}return e}},t.enable=function(){i.channel.registerMonkeyPatch("@azure/core-tracing",t.azureCoreTracing)}},8859:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.bunyan={versionSpecifier:">= 1.0.0 < 2.0.0",patch:function(e){var t=e.prototype._emit;return e.prototype._emit=function(e,n){var i=t.apply(this,arguments);if(!n){var o=i;o||(o=t.call(this,e,!0)),r.channel.publish("bunyan",{level:e.level,result:o})}return i},e}},t.enable=function(){r.channel.registerMonkeyPatch("bunyan",t.bunyan)}},2495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953),i=n(2413);t.console={versionSpecifier:">= 4.0.0",patch:function(e){var t=new i.Writable,n=new i.Writable;t.write=function(e){if(!e)return!0;var t=e.toString();return r.channel.publish("console",{message:t}),!0},n.write=function(e){if(!e)return!0;var t=e.toString();return r.channel.publish("console",{message:t,stderr:!0}),!0};for(var o=new e.Console(t,n),s=function(t){var n=e[t];n&&(e[t]=function(){if(o[t])try{o[t].apply(o,arguments)}catch(e){}return n.apply(e,arguments)})},a=0,c=["log","info","warn","error","dir","time","timeEnd","trace","assert"];a{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8604);t.azuresdk=r;var i=n(8859);t.bunyan=i;var o=n(2495);t.console=o;var s=n(2028);t.mongodbCore=s;var a=n(8436);t.mongodb=a;var c=n(8002);t.mysql=c;var u=n(9024);t.pgPool=u;var l=n(2080);t.pg=l;var p=n(4487);t.redis=p;var f=n(6661);t.tedious=f;var d=n(4650);t.winston=d,t.enable=function(){i.enable(),o.enable(),s.enable(),a.enable(),c.enable(),l.enable(),u.enable(),p.enable(),d.enable(),r.enable(),f.enable()}},2028:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.mongoCore={versionSpecifier:">= 2.0.0 < 4.0.0",patch:function(e){var t=e.Server.prototype.connect;return e.Server.prototype.connect=function(){var e=t.apply(this,arguments),n=this.s.pool.write;this.s.pool.write=function(){var e="function"==typeof arguments[1]?1:2;return"function"==typeof arguments[e]&&(arguments[e]=r.channel.bindToContext(arguments[e])),n.apply(this,arguments)};var i=this.s.pool.logout;return this.s.pool.logout=function(){return"function"==typeof arguments[1]&&(arguments[1]=r.channel.bindToContext(arguments[1])),i.apply(this,arguments)},e},e}},t.enable=function(){r.channel.registerMonkeyPatch("mongodb-core",t.mongoCore)}},8436:function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n= 2.0.0 <= 3.0.5",patch:function(e){var t=e.instrument({operationIdGenerator:{next:function(){return i.channel.bindToContext((function(e){return e()}))}}}),n={};return t.on("started",(function(e){n[e.requestId]||(n[e.requestId]=r({},e,{time:new Date}))})),t.on("succeeded",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"function"==typeof e.operationId?e.operationId((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})):i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})),t.on("failed",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"function"==typeof e.operationId?e.operationId((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})):i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})),e}},t.mongo3={versionSpecifier:"> 3.0.5 < 3.3.0",patch:function(e){var t=e.instrument(),n={},o={};return t.on("started",(function(e){n[e.requestId]||(o[e.requestId]=i.channel.bindToContext((function(e){return e()})),n[e.requestId]=r({},e,{time:new Date}))})),t.on("succeeded",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof o[e.requestId]&&(o[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})),delete o[e.requestId])})),t.on("failed",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof o[e.requestId]&&(o[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})),delete o[e.requestId])})),e}},t.mongo330={versionSpecifier:">= 3.3.0 < 4.0.0",patch:function(e){!function(e){var t=e.Server.prototype.connect;e.Server.prototype.connect=function(){var e=t.apply(this,arguments),n=this.s.coreTopology.s.pool.write;this.s.coreTopology.s.pool.write=function(){var e="function"==typeof arguments[1]?1:2;return"function"==typeof arguments[e]&&(arguments[e]=i.channel.bindToContext(arguments[e])),n.apply(this,arguments)};var r=this.s.coreTopology.s.pool.logout;return this.s.coreTopology.s.pool.logout=function(){return"function"==typeof arguments[1]&&(arguments[1]=i.channel.bindToContext(arguments[1])),r.apply(this,arguments)},e}}(e);var t=e.instrument(),n={},r={};return t.on("started",(function(e){n[e.requestId]||(r[e.requestId]=i.channel.bindToContext((function(e){return e()})),n[e.requestId]=e)})),t.on("succeeded",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof r[e.requestId]&&(r[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!0})})),delete r[e.requestId])})),t.on("failed",(function(e){var t=n[e.requestId];t&&delete n[e.requestId],"object"==typeof e&&"function"==typeof r[e.requestId]&&(r[e.requestId]((function(){return i.channel.publish("mongodb",{startedData:t,event:e,succeeded:!1})})),delete r[e.requestId])})),e}},t.enable=function(){i.channel.registerMonkeyPatch("mongodb",t.mongo2),i.channel.registerMonkeyPatch("mongodb",t.mongo3),i.channel.registerMonkeyPatch("mongodb",t.mongo330)}},8002:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953),i=n(5622);t.mysql={versionSpecifier:">= 2.0.0 < 3.0.0",patch:function(e,t){var o=function(e,t){return function(t,n){var i=e[t];i&&(e[t]=function(){for(var e=arguments.length-1,t=arguments.length-1;t>=0;--t){if("function"==typeof arguments[t]){e=t;break}if(void 0!==arguments[t])break}var o=arguments[e],s={result:null,startTime:null,startDate:null};"function"==typeof o&&(n?(s.startTime=process.hrtime(),s.startDate=new Date,arguments[e]=r.channel.bindToContext(n(s,o))):arguments[e]=r.channel.bindToContext(o));var a=i.apply(this,arguments);return s.result=a,a})}},s=function(e,t){return o(e.prototype)},a=n(4694)(i.dirname(t)+"/lib/Connection");["connect","changeUser","ping","statistics","end"].forEach((function(e){return s(a)(e)})),o(a)("createQuery",(function(e,t){return function(n){var i=process.hrtime(e.startTime),o=1e3*i[0]+i[1]/1e6|0;r.channel.publish("mysql",{query:e.result,callbackArgs:arguments,err:n,duration:o,time:e.startDate}),t.apply(this,arguments)}}));var c=n(420)(i.dirname(t)+"/lib/Pool");return["_enqueueCallback"].forEach((function(e){return s(c)(e)})),e}},t.enable=function(){r.channel.registerMonkeyPatch("mysql",t.mysql)}},9024:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.postgresPool1={versionSpecifier:">= 1.0.0 < 3.0.0",patch:function(e){var t=e.prototype.connect;return e.prototype.connect=function(e){return e&&(arguments[0]=r.channel.bindToContext(e)),t.apply(this,arguments)},e}},t.enable=function(){r.channel.registerMonkeyPatch("pg-pool",t.postgresPool1)}},2080:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953),i=n(8614);t.postgres6={versionSpecifier:"6.*",patch:function(e,t){var n=e.Client.prototype.query,o="__diagnosticOriginalFunc";return e.Client.prototype.query=function(e,t,s){var a,c={query:{},database:{host:this.connectionParameters.host,port:this.connectionParameters.port},result:null,error:null,duration:0,time:new Date},u=process.hrtime();function l(e){e&&e[o]&&(e=e[o]);var t=r.channel.bindToContext((function(t,n){var o=process.hrtime(u);if(c.result=n&&{rowCount:n.rowCount,command:n.command},c.error=t,c.duration=Math.ceil(1e3*o[0]+o[1]/1e6),r.channel.publish("postgres",c),t){if(e)return e.apply(this,arguments);a&&a instanceof i.EventEmitter&&a.emit("error",t)}else e&&e.apply(this,arguments)}));try{return Object.defineProperty(t,o,{value:e}),t}catch(t){return e}}try{"string"==typeof e?t instanceof Array?(c.query.preparable={text:e,args:t},s=l(s)):(c.query.text=e,s?s=l(s):t=l(t)):("string"==typeof e.name?c.query.plan=e.name:e.values instanceof Array?c.query.preparable={text:e.text,args:e.values}:c.query.text=e.text,s?s=l(s):t?t=l(t):e.callback=l(e.callback))}catch(e){return n.apply(this,arguments)}return arguments[0]=e,arguments[1]=t,arguments[2]=s,arguments.length=arguments.length>3?arguments.length:3,a=n.apply(this,arguments)},e}},t.postgres7={versionSpecifier:">=7.* <=8.*",patch:function(e,t){var n=e.Client.prototype.query,o="__diagnosticOriginalFunc";return e.Client.prototype.query=function(e,t,s){var a,c=this,u=!!s,l={query:{},database:{host:this.connectionParameters.host,port:this.connectionParameters.port},result:null,error:null,duration:0,time:new Date},p=process.hrtime();function f(e){e&&e[o]&&(e=e[o]);var t=r.channel.bindToContext((function(t,n){var o=process.hrtime(p);if(l.result=n&&{rowCount:n.rowCount,command:n.command},l.error=t,l.duration=Math.ceil(1e3*o[0]+o[1]/1e6),r.channel.publish("postgres",l),t){if(e)return e.apply(this,arguments);a&&a instanceof i.EventEmitter&&a.emit("error",t)}else e&&e.apply(this,arguments)}));try{return Object.defineProperty(t,o,{value:e}),t}catch(t){return e}}try{"string"==typeof e?t instanceof Array?(l.query.preparable={text:e,args:t},s=(u="function"==typeof s)?f(s):s):(l.query.text=e,s?s=(u="function"==typeof s)?f(s):s:t=(u="function"==typeof t)?f(t):t):("string"==typeof e.name?l.query.plan=e.name:e.values instanceof Array?l.query.preparable={text:e.text,args:e.values}:l.query.text=e.text,s?(u="function"==typeof s,s=f(s)):t?t=(u="function"==typeof t)?f(t):t:(u="function"==typeof e.callback,e.callback=u?f(e.callback):e.callback))}catch(e){return n.apply(this,arguments)}return arguments[0]=e,arguments[1]=t,arguments[2]=s,arguments.length=arguments.length>3?arguments.length:3,a=n.apply(this,arguments),u?a:a.then((function(e){return f()(void 0,e),new c._Promise((function(t,n){t(e)}))})).catch((function(e){return f()(e,void 0),new c._Promise((function(t,n){n(e)}))}))},e}},t.enable=function(){r.channel.registerMonkeyPatch("pg",t.postgres6),r.channel.registerMonkeyPatch("pg",t.postgres7)}},4487:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4953);t.redis={versionSpecifier:">= 2.0.0 < 4.0.0",patch:function(e){var t=e.RedisClient.prototype.internal_send_command;return e.RedisClient.prototype.internal_send_command=function(e){if(e){var n=e.callback;if(!n||!n.pubsubBound){var i=this.address,o=process.hrtime(),s=new Date;e.callback=r.channel.bindToContext((function(t,a){var c=process.hrtime(o),u=1e3*c[0]+c[1]/1e6|0;r.channel.publish("redis",{duration:u,address:i,commandObj:e,err:t,result:a,time:s}),"function"==typeof n&&n.apply(this,arguments)})),e.callback.pubsubBound=!0}}return t.call(this,e)},e}},t.enable=function(){r.channel.registerMonkeyPatch("redis",t.redis)}},6661:function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n= 6.0.0 < 9.0.0",patch:function(e){var t=e.Connection.prototype.makeRequest;return e.Connection.prototype.makeRequest=function(){function e(e){var t=process.hrtime(),n={query:{},database:{host:null,port:null},result:null,error:null,duration:0};return i.channel.bindToContext((function(o,s,a){var c=process.hrtime(t);n=r({},n,{database:{host:this.connection.config.server,port:this.connection.config.options.port},result:!o&&{rowCount:s,rows:a},query:{text:this.parametersByName.statement.value},error:o,duration:Math.ceil(1e3*c[0]+c[1]/1e6)}),i.channel.publish("tedious",n),e.call(this,o,s,a)}))}var n=arguments[0];arguments[0].callback=e(n.callback),t.apply(this,arguments)},e}},t.enable=function(){i.channel.registerMonkeyPatch("tedious",t.tedious)}},4650:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);ir[n]?i:n);this.add(new t(e,{level:n}))}var r=e.createLogger;e.createLogger=function(){var i,o=arguments[0].levels||e.config.npm.levels;for(var s in o)o.hasOwnProperty(s)&&(i=void 0===i||o[s]>o[i]?s:i);var a=r.apply(this,arguments);a.add(new t(e,{level:i}));var c=a.configure;return a.configure=function(){c.apply(this,arguments),n.apply(this,arguments)},a};var a=e.createLogger;return e.configure=function(){a.apply(this,arguments),n.apply(this,arguments)},e.add(new t(e)),e}},t.winston2={versionSpecifier:"2.x",patch:function(e){var t,n=e.Logger.prototype.log,r=function(n,r,i){var o;return o=t===e.config.npm.levels?"npm":t===e.config.syslog.levels?"syslog":"unknown",s.channel.publish("winston",{level:n,message:r,meta:i,levelKind:o}),r};return e.Logger.prototype.log=function(){return t=this.levels,this.filters&&0!==this.filters.length?this.filters[this.filters.length-1]!==r&&(this.filters=this.filters.filter((function(e){return e!==r})),this.filters.push(r)):this.filters=[r],n.apply(this,arguments)},e}},t.enable=function(){s.channel.registerMonkeyPatch("winston",t.winston2),s.channel.registerMonkeyPatch("winston",t.winston3)}},4694:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=4694,e.exports=t},420:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=420,e.exports=t},4953:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7424),i=n(7424);t.makePatchingRequire=i.makePatchingRequire;var o=function(e){return!0},s=function(){function e(){this.version=n(5236).i8,this.subscribers={},this.contextPreservationFunction=function(e){return e},this.knownPatches={},this.currentlyPublishing=!1}return e.prototype.shouldPublish=function(e){var t=this.subscribers[e];return!!t&&t.some((function(e){var t=e.filter;return!t||t(!1)}))},e.prototype.publish=function(e,t){if(!this.currentlyPublishing){var n=this.subscribers[e];if(n){var r={timestamp:Date.now(),data:t};this.currentlyPublishing=!0,n.forEach((function(e){var t=e.listener,n=e.filter;try{n&&n(!0)&&t(r)}catch(e){}})),this.currentlyPublishing=!1}}},e.prototype.subscribe=function(e,t,n){void 0===n&&(n=o),this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push({listener:t,filter:n})},e.prototype.unsubscribe=function(e,t,n){void 0===n&&(n=o);var r=this.subscribers[e];if(r)for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5622),i=n(1249),o=n(2282),s=Object.keys(process.binding("natives")),a=o.prototype.require;t.makePatchingRequire=function(e){var t={};return function(n){var c=a.apply(this,arguments);if(e[n]){var u=o._resolveFilename(n,this);if(t.hasOwnProperty(u))return t[u];var l=void 0;if(s.indexOf(n)<0)try{l=a.call(this,r.join(n,"package.json")).version}catch(e){return c}else l=process.version.substring(1);var p=l.indexOf("-");p>=0&&(l=l.substring(0,p));for(var f=c,d=0,h=e[n];d{"use strict";e.exports={i8:"0.2.0"}},696:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertChangesToDMP=function(e){for(var t,n,r=[],i=0;i{"use strict";function n(e){var t=e;return t=(t=(t=(t=t.replace(/&/g,"&")).replace(//g,">")).replace(/"/g,""")}Object.defineProperty(t,"__esModule",{value:!0}),t.convertChangesToXML=function(e){for(var t=[],r=0;r"):i.removed&&t.push(""),t.push(n(i.value)),i.added?t.push(""):i.removed&&t.push("")}return t.join("")}},6976:(e,t,n)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.diffArrays=function(e,t,n){return i.diff(e,t,n)},t.arrayDiff=void 0;var i=new(((r=n(5913))&&r.__esModule?r:{default:r}).default);t.arrayDiff=i,i.tokenize=function(e){return e.slice()},i.join=i.removeEmpty=function(e){return e}},5913:(e,t)=>{"use strict";function n(){}function r(e,t,n,r,i){for(var o=0,s=t.length,a=0,c=0;oe.length?n:e})),u.value=e.join(p)}else u.value=e.join(n.slice(a,a+u.count));a+=u.count,u.added||(c+=u.count)}}var f=t[s-1];return s>1&&"string"==typeof f.value&&(f.added||f.removed)&&e.equals("",f.value)&&(t[s-2].value+=f.value,t.pop()),t}function i(e){return{newPos:e.newPos,components:e.components.slice(0)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.prototype={diff:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.callback;"function"==typeof n&&(o=n,n={}),this.options=n;var s=this;function a(e){return o?(setTimeout((function(){o(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var c=(t=this.removeEmpty(this.tokenize(t))).length,u=e.length,l=1,p=c+u,f=[{newPos:-1,components:[]}],d=this.extractCommon(f[0],t,e,0);if(f[0].newPos+1>=c&&d+1>=u)return a([{value:this.join(t),count:t.length}]);function h(){for(var n=-1*l;n<=l;n+=2){var o=void 0,p=f[n-1],d=f[n+1],h=(d?d.newPos:0)-n;p&&(f[n-1]=void 0);var m=p&&p.newPos+1=c&&h+1>=u)return a(r(s,o.components,t,e,s.useLongestToken));f[n]=o}else f[n]=void 0}l++}if(o)!function e(){setTimeout((function(){if(l>p)return o();h()||e()}),0)}();else for(;l<=p;){var m=h();if(m)return m}},pushComponent:function(e,t,n){var r=e[e.length-1];r&&r.added===t&&r.removed===n?e[e.length-1]={count:r.count+1,added:t,removed:n}:e.push({count:1,added:t,removed:n})},extractCommon:function(e,t,n,r){for(var i=t.length,o=n.length,s=e.newPos,a=s-r,c=0;s+1{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.diffChars=function(e,t,n){return i.diff(e,t,n)},t.characterDiff=void 0;var i=new(((r=n(5913))&&r.__esModule?r:{default:r}).default);t.characterDiff=i},4852:(e,t,n)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.diffCss=function(e,t,n){return i.diff(e,t,n)},t.cssDiff=void 0;var i=new(((r=n(5913))&&r.__esModule?r:{default:r}).default);t.cssDiff=i,i.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)}},4276:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diffJson=function(e,t,n){return c.diff(e,t,n)},t.canonicalize=u,t.jsonDiff=void 0;var r,i=(r=n(5913))&&r.__esModule?r:{default:r},o=n(8187);function s(e){return(s="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})(e)}var a=Object.prototype.toString,c=new i.default;function u(e,t,n,r,i){var o,c;for(t=t||[],n=n||[],r&&(e=r(i,e)),o=0;o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diffLines=function(e,t,n){return s.diff(e,t,n)},t.diffTrimmedLines=function(e,t,n){var r=(0,o.generateOptions)(n,{ignoreWhitespace:!0});return s.diff(e,t,r)},t.lineDiff=void 0;var r,i=(r=n(5913))&&r.__esModule?r:{default:r},o=n(8009);var s=new i.default;t.lineDiff=s,s.tokenize=function(e){var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.diffSentences=function(e,t,n){return i.diff(e,t,n)},t.sentenceDiff=void 0;var i=new(((r=n(5913))&&r.__esModule?r:{default:r}).default);t.sentenceDiff=i,i.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)}},5303:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diffWords=function(e,t,n){return n=(0,o.generateOptions)(n,{ignoreWhitespace:!0}),c.diff(e,t,n)},t.diffWordsWithSpace=function(e,t,n){return c.diff(e,t,n)},t.wordDiff=void 0;var r,i=(r=n(5913))&&r.__esModule?r:{default:r},o=n(8009);var s=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,a=/\S/,c=new i.default;t.wordDiff=c,c.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!a.test(e)&&!a.test(t)},c.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Diff",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"diffChars",{enumerable:!0,get:function(){return o.diffChars}}),Object.defineProperty(t,"diffWords",{enumerable:!0,get:function(){return s.diffWords}}),Object.defineProperty(t,"diffWordsWithSpace",{enumerable:!0,get:function(){return s.diffWordsWithSpace}}),Object.defineProperty(t,"diffLines",{enumerable:!0,get:function(){return a.diffLines}}),Object.defineProperty(t,"diffTrimmedLines",{enumerable:!0,get:function(){return a.diffTrimmedLines}}),Object.defineProperty(t,"diffSentences",{enumerable:!0,get:function(){return c.diffSentences}}),Object.defineProperty(t,"diffCss",{enumerable:!0,get:function(){return u.diffCss}}),Object.defineProperty(t,"diffJson",{enumerable:!0,get:function(){return l.diffJson}}),Object.defineProperty(t,"canonicalize",{enumerable:!0,get:function(){return l.canonicalize}}),Object.defineProperty(t,"diffArrays",{enumerable:!0,get:function(){return p.diffArrays}}),Object.defineProperty(t,"applyPatch",{enumerable:!0,get:function(){return f.applyPatch}}),Object.defineProperty(t,"applyPatches",{enumerable:!0,get:function(){return f.applyPatches}}),Object.defineProperty(t,"parsePatch",{enumerable:!0,get:function(){return d.parsePatch}}),Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return h.merge}}),Object.defineProperty(t,"structuredPatch",{enumerable:!0,get:function(){return m.structuredPatch}}),Object.defineProperty(t,"createTwoFilesPatch",{enumerable:!0,get:function(){return m.createTwoFilesPatch}}),Object.defineProperty(t,"createPatch",{enumerable:!0,get:function(){return m.createPatch}}),Object.defineProperty(t,"convertChangesToDMP",{enumerable:!0,get:function(){return g.convertChangesToDMP}}),Object.defineProperty(t,"convertChangesToXML",{enumerable:!0,get:function(){return v.convertChangesToXML}});var r,i=(r=n(5913))&&r.__esModule?r:{default:r},o=n(7630),s=n(5303),a=n(8187),c=n(4146),u=n(4852),l=n(4276),p=n(6976),f=n(3690),d=n(3719),h=n(3051),m=n(1286),g=n(696),v=n(5826)},3690:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyPatch=s,t.applyPatches=function(e,t){"string"==typeof e&&(e=(0,i.parsePatch)(e));var n=0;!function r(){var i=e[n++];if(!i)return t.complete();t.loadFile(i,(function(e,n){if(e)return t.complete(e);var o=s(n,i,t);t.patched(i,o,(function(e){if(e)return t.complete(e);r()}))}))}()};var r,i=n(3719),o=(r=n(8169))&&r.__esModule?r:{default:r};function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof t&&(t=(0,i.parsePatch)(t)),Array.isArray(t)){if(t.length>1)throw new Error("applyPatch only works with a single input.");t=t[0]}var r,s,a=e.split(/\r\n|[\n\v\f\r\x85]/),c=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],u=t.hunks,l=n.compareLine||function(e,t,n,r){return t===r},p=0,f=n.fuzzFactor||0,d=0,h=0;function m(e,t){for(var n=0;n0?r[0]:" ",o=r.length>0?r.substr(1):r;if(" "===i||"-"===i){if(!l(t+1,a[t],i,o)&&++p>f)return!1;t++}}return!0}for(var g=0;g0?O[0]:" ",A=O.length>0?O.substr(1):O,N=I.linedelimiters[x];if(" "===T)C++;else if("-"===T)a.splice(C,1),c.splice(C,1);else if("+"===T)a.splice(C,0,A),c.splice(C,0,N),C++;else if("\\"===T){var P=I.lines[x-1]?I.lines[x-1][0]:null;"+"===P?r=!0:"-"===P&&(s=!0)}}}if(r)for(;!a[a.length-1];)a.pop(),c.pop();else s&&(a.push(""),c.push("\n"));for(var L=0;L{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.structuredPatch=s,t.formatPatch=a,t.createTwoFilesPatch=c,t.createPatch=function(e,t,n,r,i,o){return c(e,e,t,n,r,i,o)};var r=n(8187);function i(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?l(a.lines.slice(-c.context)):[],f-=h.length,d-=h.length)}(s=h).push.apply(s,i(r.map((function(e){return(t.added?"+":"-")+e})))),t.added?g+=r.length:m+=r.length}else{if(f)if(r.length<=2*c.context&&e=u.length-2&&r.length<=c.context){var b=/\n$/.test(n),w=/\n$/.test(o),S=0==r.length&&h.length>E.oldLines;!b&&S&&n.length>0&&h.splice(E.oldLines,0,"\\ No newline at end of file"),(b||S)&&w||h.push("\\ No newline at end of file")}p.push(E),f=0,d=0,h=[]}m+=r.length,g+=r.length}},y=0;y{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calcLineCount=c,t.merge=function(e,t,n){e=u(e,n),t=u(t,n);var r={};(e.index||t.index)&&(r.index=e.index||t.index);(e.newFileName||t.newFileName)&&(l(e)?l(t)?(r.oldFileName=p(r,e.oldFileName,t.oldFileName),r.newFileName=p(r,e.newFileName,t.newFileName),r.oldHeader=p(r,e.oldHeader,t.oldHeader),r.newHeader=p(r,e.newHeader,t.newHeader)):(r.oldFileName=e.oldFileName,r.newFileName=e.newFileName,r.oldHeader=e.oldHeader,r.newHeader=e.newHeader):(r.oldFileName=t.oldFileName||e.oldFileName,r.newFileName=t.newFileName||e.newFileName,r.oldHeader=t.oldHeader||e.oldHeader,r.newHeader=t.newHeader||e.newHeader));r.hunks=[];var i=0,o=0,s=0,a=0;for(;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parsePatch=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.split(/\r\n|[\n\v\f\r\x85]/),r=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],i=[],o=0;function s(){var e={};for(i.push(e);o{"use strict";function n(e,t){if(t.length>e.length)return!1;for(var n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var r=!0,i=!1,o=!1,s=1;return function a(){if(r&&!o){if(i?s++:r=!1,e+s<=n)return s;o=!0}if(!i)return o||(r=!0),t<=e-s?-s++:(i=!0,a())}}},8009:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateOptions=function(e,t){if("function"==typeof e)t.callback=e;else if(e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}},9867:(e,t,n)=>{"use strict";var r=n(6372),i=r.wrap,o=r.unwrap,s="wrap@before";function a(e,t,n){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function c(e,t){var n;return n=e._events&&e._events[t],Array.isArray(n)||(n=n?[n]:[]),n}function u(e,t,n){var r=c(e,t).filter((function(e){return-1===n.indexOf(e)}));r.length>0&&function(e,t){for(var n=t.length,r=0;r{var r=n(778),i=function(){},o=function(e,t,n){if("function"==typeof t)return o(e,null,t);t||(t={}),n=r(n||i);var s=e._writableState,a=e._readableState,c=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,l=!1,p=function(){e.writable||f()},f=function(){u=!1,c||n.call(e)},d=function(){c=!1,u||n.call(e)},h=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){n.call(e,t)},g=function(){process.nextTick(v)},v=function(){if(!l)return(!c||a&&a.ended&&!a.destroyed)&&(!u||s&&s.ended&&!s.destroyed)?void 0:n.call(e,new Error("premature close"))},y=function(){e.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!s&&(e.on("end",p),e.on("close",p)):(e.on("complete",f),e.on("abort",g),e.req?y():e.on("request",y)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",h),e.on("end",d),e.on("finish",f),!1!==t.error&&e.on("error",m),e.on("close",g),function(){l=!0,e.removeListener("complete",f),e.removeListener("abort",g),e.removeListener("request",y),e.req&&e.req.removeListener("finish",f),e.removeListener("end",p),e.removeListener("close",p),e.removeListener("finish",f),e.removeListener("exit",h),e.removeListener("end",d),e.removeListener("error",m),e.removeListener("close",g)}};e.exports=o},2106:(e,t,n)=>{const r=n(5158)("extract-zip"),{createWriteStream:i,promises:o}=n(5747),s=n(31),a=n(5622),{promisify:c}=n(1669),u=n(2413),l=n(7766),p=c(l.open),f=c(u.pipeline);class d{constructor(e,t){this.zipPath=e,this.opts=t}async extract(){return r("opening",this.zipPath,"with opts",this.opts),this.zipfile=await p(this.zipPath,{lazyEntries:!0}),this.canceled=!1,new Promise(((e,t)=>{this.zipfile.on("error",(e=>{this.canceled=!0,t(e)})),this.zipfile.readEntry(),this.zipfile.on("close",(()=>{this.canceled||(r("zip extraction complete"),e())})),this.zipfile.on("entry",(async e=>{if(this.canceled)return void r("skipping entry",e.fileName,{cancelled:this.canceled});if(r("zipfile entry",e.fileName),e.fileName.startsWith("__MACOSX/"))return void this.zipfile.readEntry();const n=a.dirname(a.join(this.opts.dir,e.fileName));try{await o.mkdir(n,{recursive:!0});const t=await o.realpath(n);if(a.relative(this.opts.dir,t).split(a.sep).includes(".."))throw new Error(`Out of bound path "${t}" found while processing file ${e.fileName}`);await this.extractEntry(e),r("finished processing",e.fileName),this.zipfile.readEntry()}catch(e){this.canceled=!0,this.zipfile.close(),t(e)}}))}))}async extractEntry(e){if(this.canceled)return void r("skipping entry extraction",e.fileName,{cancelled:this.canceled});this.opts.onEntry&&this.opts.onEntry(e,this.zipfile);const t=a.join(this.opts.dir,e.fileName),n=e.externalFileAttributes>>16&65535,u=40960==(61440&n);let l=16384==(61440&n);!l&&e.fileName.endsWith("/")&&(l=!0);const p=e.versionMadeBy>>8;l||(l=0===p&&16===e.externalFileAttributes),r("extracting entry",{filename:e.fileName,isDir:l,isSymlink:u});const d=511&this.getExtractedMode(n,l),h=l?t:a.dirname(t),m={recursive:!0};if(l&&(m.mode=d),r("mkdir",{dir:h,...m}),await o.mkdir(h,m),l)return;r("opening read stream",t);const g=await c(this.zipfile.openReadStream.bind(this.zipfile))(e);if(u){const e=await s(g);r("creating symlink",e,t),await o.symlink(e,t)}else await f(g,i(t,{mode:d}))}getExtractedMode(e,t){let n=e;return 0===n&&(t?(this.opts.defaultDirMode&&(n=parseInt(this.opts.defaultDirMode,10)),n||(n=493)):(this.opts.defaultFileMode&&(n=parseInt(this.opts.defaultFileMode,10)),n||(n=420))),n}}e.exports=async function(e,t){if(r("creating target directory",t.dir),!a.isAbsolute(t.dir))throw new Error("Target directory is expected to be absolute");return await o.mkdir(t.dir,{recursive:!0}),t.dir=await o.realpath(t.dir),new d(e,t).extract()}},8913:(e,t,n)=>{var r=n(5747),i=n(1669),o=n(2413),s=o.Readable,a=o.Writable,c=o.PassThrough,u=n(9916),l=n(8614).EventEmitter;function p(e,t){t=t||{},l.call(this),this.fd=e,this.pend=new u,this.pend.max=1,this.refCount=0,this.autoClose=!!t.autoClose}function f(e,t){t=t||{},s.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start,this.destroyed=!1}function d(e,t){t=t||{},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=null==t.end?1/0:+t.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}function h(e,t){l.call(this),t=t||{},this.refCount=0,this.buffer=e,this.maxChunkSize=t.maxChunkSize||Number.MAX_SAFE_INTEGER}t.createFromBuffer=function(e,t){return new h(e,t)},t.createFromFd=function(e,t){return new p(e,t)},t.BufferSlicer=h,t.FdSlicer=p,i.inherits(p,l),p.prototype.read=function(e,t,n,i,o){var s=this;s.pend.go((function(a){r.read(s.fd,e,t,n,i,(function(e,t,n){a(),o(e,t,n)}))}))},p.prototype.write=function(e,t,n,i,o){var s=this;s.pend.go((function(a){r.write(s.fd,e,t,n,i,(function(e,t,n){a(),o(e,t,n)}))}))},p.prototype.createReadStream=function(e){return new f(this,e)},p.prototype.createWriteStream=function(e){return new d(this,e)},p.prototype.ref=function(){this.refCount+=1},p.prototype.unref=function(){var e=this;if(e.refCount-=1,!(e.refCount>0)){if(e.refCount<0)throw new Error("invalid unref");e.autoClose&&r.close(e.fd,(function(t){t?e.emit("error",t):e.emit("close")}))}},i.inherits(f,s),f.prototype._read=function(e){var t=this;if(!t.destroyed){var n=Math.min(t._readableState.highWaterMark,e);if(null!=t.endOffset&&(n=Math.min(n,t.endOffset-t.pos)),n<=0)return t.destroyed=!0,t.push(null),void t.context.unref();t.context.pend.go((function(e){if(t.destroyed)return e();var i=new Buffer(n);r.read(t.context.fd,i,0,n,t.pos,(function(n,r){n?t.destroy(n):0===r?(t.destroyed=!0,t.push(null),t.context.unref()):(t.pos+=r,t.push(i.slice(0,r))),e()}))}))}},f.prototype.destroy=function(e){this.destroyed||(e=e||new Error("stream destroyed"),this.destroyed=!0,this.emit("error",e),this.context.unref())},i.inherits(d,a),d.prototype._write=function(e,t,n){var i=this;if(!i.destroyed){if(i.pos+e.length>i.endOffset){var o=new Error("maximum file length exceeded");return o.code="ETOOBIG",i.destroy(),void n(o)}i.context.pend.go((function(t){if(i.destroyed)return t();r.write(i.context.fd,e,0,e.length,i.pos,(function(e,r){e?(i.destroy(),t(),n(e)):(i.bytesWritten+=r,i.pos+=r,i.emit("progress"),t(),n())}))}))}},d.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.context.unref())},i.inherits(h,l),h.prototype.read=function(e,t,n,r,i){var o=r+n,s=o-this.buffer.length,a=s>0?s:n;this.buffer.copy(e,t,r,o),setImmediate((function(){i(null,a)}))},h.prototype.write=function(e,t,n,r,i){e.copy(this.buffer,r,t,t+n),setImmediate((function(){i(null,n,e)}))},h.prototype.createReadStream=function(e){var t=new c(e=e||{});t.destroyed=!1,t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=0;;){var i=r+this.maxChunkSize;if(i>=n.length){rn.endOffset){var s=new Error("maximum file length exceeded");return s.code="ETOOBIG",n.destroyed=!0,void i(s)}e.copy(t.buffer,n.pos,0,e.length),n.bytesWritten+=e.length,n.pos=o,n.emit("progress"),i()}},n.destroy=function(){n.destroyed=!0},n},h.prototype.ref=function(){this.refCount+=1},h.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw new Error("invalid unref")}},7334:(e,t,n)=>{e.exports=l,l.realpath=l,l.sync=p,l.realpathSync=p,l.monkeypatch=function(){r.realpath=l,r.realpathSync=p},l.unmonkeypatch=function(){r.realpath=i,r.realpathSync=o};var r=n(5747),i=r.realpath,o=r.realpathSync,s=process.version,a=/^v[0-5]\./.test(s),c=n(7059);function u(e){return e&&"realpath"===e.syscall&&("ELOOP"===e.code||"ENOMEM"===e.code||"ENAMETOOLONG"===e.code)}function l(e,t,n){if(a)return i(e,t,n);"function"==typeof t&&(n=t,t=null),i(e,t,(function(r,i){u(r)?c.realpath(e,t,n):n(r,i)}))}function p(e,t){if(a)return o(e,t);try{return o(e,t)}catch(n){if(u(n))return c.realpathSync(e,t);throw n}}},7059:(e,t,n)=>{var r=n(5622),i="win32"===process.platform,o=n(5747),s=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function a(e){return"function"==typeof e?e:function(){var e;if(s){var t=new Error;e=function(e){e&&(t.message=e.message,n(e=t))}}else e=n;return e;function n(e){if(e){if(process.throwDeprecation)throw e;if(!process.noDeprecation){var t="fs: missing callback "+(e.stack||e.message);process.traceDeprecation?console.trace(t):console.error(t)}}}}()}r.normalize;if(i)var c=/(.*?)(?:[\/\\]+|$)/g;else c=/(.*?)(?:[\/]+|$)/g;if(i)var u=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else u=/^[\/]*/;t.realpathSync=function(e,t){if(e=r.resolve(e),t&&Object.prototype.hasOwnProperty.call(t,e))return t[e];var n,s,a,l,p=e,f={},d={};function h(){var t=u.exec(e);n=t[0].length,s=t[0],a=t[0],l="",i&&!d[a]&&(o.lstatSync(a),d[a]=!0)}for(h();n=e.length)return t&&(t[d]=e),n(null,e);c.lastIndex=s;var r=c.exec(e);return f=l,l+=r[0],p=f+r[1],s=c.lastIndex,m[p]||t&&t[p]===p?process.nextTick(v):t&&Object.prototype.hasOwnProperty.call(t,p)?E(t[p]):o.lstat(p,y)}function y(e,r){if(e)return n(e);if(!r.isSymbolicLink())return m[p]=!0,t&&(t[p]=p),process.nextTick(v);if(!i){var s=r.dev.toString(32)+":"+r.ino.toString(32);if(h.hasOwnProperty(s))return _(null,h[s],p)}o.stat(p,(function(e){if(e)return n(e);o.readlink(p,(function(e,t){i||(h[s]=t),_(e,t)}))}))}function _(e,i,o){if(e)return n(e);var s=r.resolve(f,i);t&&(t[o]=s),E(s)}function E(t){e=r.resolve(t,e.slice(s)),g()}g()}},5105:(e,t,n)=>{"use strict";const{PassThrough:r}=n(2413);e.exports=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const i="buffer"===n;let o=!1;t?o=!(n||i):n=n||"utf8",i&&(n=null);const s=new r({objectMode:o});n&&s.setEncoding(n);let a=0;const c=[];return s.on("data",(e=>{c.push(e),o?a=c.length:a+=e.length})),s.getBufferedValue=()=>t?c:i?Buffer.concat(c,a):c.join(""),s.getBufferedLength=()=>a,s}},31:(e,t,n)=>{"use strict";const{constants:r}=n(4293),i=n(4286),o=n(5105);class s extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function a(e,t){if(!e)return Promise.reject(new Error("Expected a stream"));t={maxBuffer:1/0,...t};const{maxBuffer:n}=t;let a;return await new Promise(((c,u)=>{const l=e=>{e&&a.getBufferedLength()<=r.MAX_LENGTH&&(e.bufferedData=a.getBufferedValue()),u(e)};a=i(e,o(t),(e=>{e?l(e):c()})),a.on("data",(()=>{a.getBufferedLength()>n&&l(new s)}))})),a.getBufferedValue()}e.exports=a,e.exports.default=a,e.exports.buffer=(e,t)=>a(e,{...t,encoding:"buffer"}),e.exports.array=(e,t)=>a(e,{...t,array:!0}),e.exports.MaxBufferError=s},6772:(e,t,n)=>{function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.alphasort=u,t.alphasorti=c,t.setopts=function(e,t,n){n||(n={});if(n.matchBase&&-1===t.indexOf("/")){if(n.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!n.silent,e.pattern=t,e.strict=!1!==n.strict,e.realpath=!!n.realpath,e.realpathCache=n.realpathCache||Object.create(null),e.follow=!!n.follow,e.dot=!!n.dot,e.mark=!!n.mark,e.nodir=!!n.nodir,e.nodir&&(e.mark=!0);e.sync=!!n.sync,e.nounique=!!n.nounique,e.nonull=!!n.nonull,e.nosort=!!n.nosort,e.nocase=!!n.nocase,e.stat=!!n.stat,e.noprocess=!!n.noprocess,e.absolute=!!n.absolute,e.maxLength=n.maxLength||1/0,e.cache=n.cache||Object.create(null),e.statCache=n.statCache||Object.create(null),e.symlinks=n.symlinks||Object.create(null),function(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]);e.ignore.length&&(e.ignore=e.ignore.map(l))}(e,n),e.changedCwd=!1;var o=process.cwd();r(n,"cwd")?(e.cwd=i.resolve(n.cwd),e.changedCwd=e.cwd!==o):e.cwd=o;e.root=n.root||i.resolve(e.cwd,"/"),e.root=i.resolve(e.root),"win32"===process.platform&&(e.root=e.root.replace(/\\/g,"/"));e.cwdAbs=s(e.cwd)?e.cwd:p(e,e.cwd),"win32"===process.platform&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,"/"));e.nomount=!!n.nomount,n.nonegate=!0,n.nocomment=!0,e.minimatch=new a(t,n),e.options=e.minimatch.options},t.ownProp=r,t.makeAbs=p,t.finish=function(e){for(var t=e.nounique,n=t?[]:Object.create(null),r=0,i=e.matches.length;r{e.exports=_;var r=n(5747),i=n(7334),o=n(1171),s=(o.Minimatch,n(4378)),a=n(8614).EventEmitter,c=n(5622),u=n(2357),l=n(4095),p=n(4751),f=n(6772),d=(f.alphasort,f.alphasorti,f.setopts),h=f.ownProp,m=n(7844),g=(n(1669),f.childrenIgnored),v=f.isIgnored,y=n(778);function _(e,t,n){if("function"==typeof t&&(n=t,t={}),t||(t={}),t.sync){if(n)throw new TypeError("callback provided to sync glob");return p(e,t)}return new b(e,t,n)}_.sync=p;var E=_.GlobSync=p.GlobSync;function b(e,t,n){if("function"==typeof t&&(n=t,t=null),t&&t.sync){if(n)throw new TypeError("callback provided to sync glob");return new E(e,t)}if(!(this instanceof b))return new b(e,t,n);d(this,e,t),this._didRealPath=!1;var r=this.minimatch.set.length;this.matches=new Array(r),"function"==typeof n&&(n=y(n),this.on("error",n),this.on("end",(function(e){n(null,e)})));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(0===r)return s();for(var o=0;o1)return!0;for(var i=0;ithis.maxLength)return t();if(!this.stat&&h(this.cache,n)){var o=this.cache[n];if(Array.isArray(o)&&(o="DIR"),!i||"DIR"===o)return t(null,o);if(i&&"FILE"===o)return t()}var s=this.statCache[n];if(void 0!==s){if(!1===s)return t(null,s);var a=s.isDirectory()?"DIR":"FILE";return i&&"FILE"===a?t():t(null,a,s)}var c=this,u=m("stat\0"+n,(function(i,o){if(o&&o.isSymbolicLink())return r.stat(n,(function(r,i){r?c._stat2(e,n,null,o,t):c._stat2(e,n,r,i,t)}));c._stat2(e,n,i,o,t)}));u&&r.lstat(n,u)},b.prototype._stat2=function(e,t,n,r,i){if(n&&("ENOENT"===n.code||"ENOTDIR"===n.code))return this.statCache[t]=!1,i();var o="/"===e.slice(-1);if(this.statCache[t]=r,"/"===t.slice(-1)&&r&&!r.isDirectory())return i(null,!1,r);var s=!0;return r&&(s=r.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||s,o&&"FILE"===s?i():i(null,s,r)}},4751:(e,t,n)=>{e.exports=h,h.GlobSync=m;var r=n(5747),i=n(7334),o=n(1171),s=(o.Minimatch,n(2884).Glob,n(1669),n(5622)),a=n(2357),c=n(4095),u=n(6772),l=(u.alphasort,u.alphasorti,u.setopts),p=u.ownProp,f=u.childrenIgnored,d=u.isIgnored;function h(e,t){if("function"==typeof t||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");return new m(e,t).found}function m(e,t){if(!e)throw new Error("must provide pattern");if("function"==typeof t||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof m))return new m(e,t);if(l(this,e,t),this.noprocess)return this;var n=this.minimatch.set.length;this.matches=new Array(n);for(var r=0;rthis.maxLength)return!1;if(!this.stat&&p(this.cache,t)){var i=this.cache[t];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return i;if(n&&"FILE"===i)return!1}var o=this.statCache[t];if(!o){var s;try{s=r.lstatSync(t)}catch(e){if(e&&("ENOENT"===e.code||"ENOTDIR"===e.code))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{o=r.statSync(t)}catch(e){o=s}else o=s}this.statCache[t]=o;i=!0;return o&&(i=o.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||i,(!n||"FILE"!==i)&&i},m.prototype._mark=function(e){return u.mark(this,e)},m.prototype._makeAbs=function(e){return u.makeAbs(this,e)}},6560:e=>{"use strict";e.exports=(e,t=process.argv)=>{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),i=t.indexOf("--");return-1!==r&&(-1===i||r{f("replaying proxy buffer for failed request"),c.default(e.listenerCount("data")>0),e.push(y),e.push(null)})),_}))}}function h(e){e.resume()}t.default=d},9829:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(5158)).default("https-proxy-agent:parse-proxy-response");t.default=function(e){return new Promise(((t,n)=>{let r=0;const o=[];function s(){const n=e.read();n?function(e){o.push(e),r+=e.length;const n=Buffer.concat(o,r);if(-1===n.indexOf("\r\n\r\n"))return i("have not received end of HTTP headers yet..."),void s();const a=n.toString("ascii",0,n.indexOf("\r\n")),c=+a.split(" ")[1];i("got proxy server response: %o",a),t({statusCode:c,buffered:n})}(n):e.once("readable",s)}function a(e){i("onclose had error %o",e)}function c(){i("onend")}function u(t){e.removeListener("end",c),e.removeListener("error",u),e.removeListener("close",a),e.removeListener("readable",s),i("onerror %o",t),n(t)}e.on("error",u),e.on("close",a),e.on("end",c),s()}))}},7844:(e,t,n)=>{var r=n(2479),i=Object.create(null),o=n(778);function s(e){for(var t=e.length,n=[],r=0;rr?(n.splice(0,r),process.nextTick((function(){t.apply(null,o)}))):delete i[e]}}))}(e))}))},4378:(e,t,n)=>{try{var r=n(1669);if("function"!=typeof r.inherits)throw"";e.exports=r.inherits}catch(t){e.exports=n(5717)}},5717: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}}},6486:function(e,t,n){var r; /** * @license * Lodash @@ -6,7 +6,7 @@ * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */e=n.nmd(e),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=16,l=32,u=64,p=128,d=256,f=1/0,h=9007199254740991,m=NaN,g=4294967295,v=[["ary",p],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",l],["partialRight",u],["rearg",d]],y="[object Arguments]",_="[object Array]",E="[object Boolean]",b="[object Date]",w="[object Error]",S="[object Function]",I="[object GeneratorFunction]",C="[object Map]",x="[object Number]",O="[object Object]",T="[object Promise]",A="[object RegExp]",N="[object Set]",P="[object String]",L="[object Symbol]",R="[object WeakMap]",D="[object ArrayBuffer]",k="[object DataView]",M="[object Float32Array]",V="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",j="[object Int32Array]",U="[object Uint8Array]",$="[object Uint8ClampedArray]",H="[object Uint16Array]",q="[object Uint32Array]",G=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,z=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,K=RegExp(Y.source),Q=RegExp(X.source),J=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ie=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ie.source),se=/^\s+/,ae=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,le=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,pe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,de=/[()=,{}\[\]\/\s]/,fe=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,me=/\w*$/,ge=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,ye=/^\[object .+?Constructor\]$/,_e=/^0o[0-7]+$/i,Ee=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,we=/($^)/,Se=/['\n\r\u2028\u2029\\]/g,Ie="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="\\u2700-\\u27bf",xe="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ne="['’]",Pe="[\\ud800-\\udfff]",Le="["+Ae+"]",Re="["+Ie+"]",De="\\d+",ke="[\\u2700-\\u27bf]",Me="["+xe+"]",Ve="[^\\ud800-\\udfff"+Ae+De+Ce+xe+Oe+"]",Fe="\\ud83c[\\udffb-\\udfff]",Be="[^\\ud800-\\udfff]",je="(?:\\ud83c[\\udde6-\\uddff]){2}",Ue="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Oe+"]",He="(?:"+Me+"|"+Ve+")",qe="(?:"+$e+"|"+Ve+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",ze="(?:"+Re+"|"+Fe+")"+"?",Ye="[\\ufe0e\\ufe0f]?",Xe=Ye+ze+("(?:\\u200d(?:"+[Be,je,Ue].join("|")+")"+Ye+ze+")*"),Ke="(?:"+[ke,je,Ue].join("|")+")"+Xe,Qe="(?:"+[Be+Re+"?",Re,je,Ue,Pe].join("|")+")",Je=RegExp(Ne,"g"),Ze=RegExp(Re,"g"),et=RegExp(Fe+"(?="+Fe+")|"+Qe+Xe,"g"),tt=RegExp([$e+"?"+Me+"+"+Ge+"(?="+[Le,$e,"$"].join("|")+")",qe+"+"+We+"(?="+[Le,$e+He,"$"].join("|")+")",$e+"?"+He+"+"+Ge,$e+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",De,Ke].join("|"),"g"),nt=RegExp("[\\u200d\\ud800-\\udfff"+Ie+Te+"]"),rt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[M]=st[V]=st[F]=st[B]=st[j]=st[U]=st[$]=st[H]=st[q]=!0,st[y]=st[_]=st[D]=st[E]=st[k]=st[b]=st[w]=st[S]=st[C]=st[x]=st[O]=st[A]=st[N]=st[P]=st[R]=!1;var at={};at[y]=at[_]=at[D]=at[k]=at[E]=at[b]=at[M]=at[V]=at[F]=at[B]=at[j]=at[C]=at[x]=at[O]=at[A]=at[N]=at[P]=at[L]=at[U]=at[$]=at[H]=at[q]=!0,at[w]=at[S]=at[R]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,pt="object"==typeof global&&global&&global.Object===Object&&global,dt="object"==typeof self&&self&&self.Object===Object&&self,ft=pt||dt||Function("return this")(),ht=t&&!t.nodeType&&t,mt=ht&&e&&!e.nodeType&&e,gt=mt&&mt.exports===ht,vt=gt&&pt.process,yt=function(){try{var e=mt&&mt.require&&mt.require("util").types;return e||vt&&vt.binding&&vt.binding("util")}catch(e){}}(),_t=yt&&yt.isArrayBuffer,Et=yt&&yt.isDate,bt=yt&&yt.isMap,wt=yt&&yt.isRegExp,St=yt&&yt.isSet,It=yt&&yt.isTypedArray;function Ct(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Lt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function tn(e,t){for(var n=e.length;n--&&Ut(t,e[n],0)>-1;);return n}function nn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var rn=Wt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),on=Wt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+ct[e]}function an(e){return nt.test(e)}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function ln(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"});var vn=function e(t){var n,r=(t=null==t?ft:vn.defaults(ft.Object(),t,vn.pick(ft,it))).Array,ae=t.Date,Ie=t.Error,Ce=t.Function,xe=t.Math,Oe=t.Object,Te=t.RegExp,Ae=t.String,Ne=t.TypeError,Pe=r.prototype,Le=Ce.prototype,Re=Oe.prototype,De=t["__core-js_shared__"],ke=Le.toString,Me=Re.hasOwnProperty,Ve=0,Fe=(n=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Be=Re.toString,je=ke.call(Oe),Ue=ft._,$e=Te("^"+ke.call(Me).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=gt?t.Buffer:i,qe=t.Symbol,Ge=t.Uint8Array,We=He?He.allocUnsafe:i,ze=ln(Oe.getPrototypeOf,Oe),Ye=Oe.create,Xe=Re.propertyIsEnumerable,Ke=Pe.splice,Qe=qe?qe.isConcatSpreadable:i,et=qe?qe.iterator:i,nt=qe?qe.toStringTag:i,ct=function(){try{var e=ho(Oe,"defineProperty");return e({},"",{}),e}catch(e){}}(),pt=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,dt=ae&&ae.now!==ft.Date.now&&ae.now,ht=t.setTimeout!==ft.setTimeout&&t.setTimeout,mt=xe.ceil,vt=xe.floor,yt=Oe.getOwnPropertySymbols,Ft=He?He.isBuffer:i,Wt=t.isFinite,yn=Pe.join,_n=ln(Oe.keys,Oe),En=xe.max,bn=xe.min,wn=ae.now,Sn=t.parseInt,In=xe.random,Cn=Pe.reverse,xn=ho(t,"DataView"),On=ho(t,"Map"),Tn=ho(t,"Promise"),An=ho(t,"Set"),Nn=ho(t,"WeakMap"),Pn=ho(Oe,"create"),Ln=Nn&&new Nn,Rn={},Dn=Uo(xn),kn=Uo(On),Mn=Uo(Tn),Vn=Uo(An),Fn=Uo(Nn),Bn=qe?qe.prototype:i,jn=Bn?Bn.valueOf:i,Un=Bn?Bn.toString:i;function $n(e){if(ia(e)&&!zs(e)&&!(e instanceof Wn)){if(e instanceof Gn)return e;if(Me.call(e,"__wrapped__"))return $o(e)}return new Gn(e)}var Hn=function(){function e(){}return function(t){if(!ra(t))return{};if(Ye)return Ye(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function qn(){}function Gn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Wn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function zn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ur(e,t,n,r,o,s){var a,c=1&t,l=2&t,u=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!ra(e))return e;var p=zs(e);if(p){if(a=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Me.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Pi(e,a)}else{var d=vo(e),f=d==S||d==I;if(Qs(e))return Ci(e,c);if(d==O||d==y||f&&!o){if(a=l||f?{}:_o(e),!c)return l?function(e,t){return Li(e,go(e),t)}(e,function(e,t){return e&&Li(t,ka(t),e)}(a,e)):function(e,t){return Li(e,mo(e),t)}(e,sr(a,e))}else{if(!at[d])return o?e:{};a=function(e,t,n){var r=e.constructor;switch(t){case D:return xi(e);case E:case b:return new r(+e);case k:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case M:case V:case F:case B:case j:case U:case $:case H:case q:return Oi(e,n);case C:return new r;case x:case P:return new r(e);case A:return function(e){var t=new e.constructor(e.source,me.exec(e));return t.lastIndex=e.lastIndex,t}(e);case N:return new r;case L:return i=e,jn?Oe(jn.call(i)):{}}var i}(e,d,c)}}s||(s=new Qn);var h=s.get(e);if(h)return h;s.set(e,a),la(e)?e.forEach((function(r){a.add(ur(r,t,n,r,e,s))})):oa(e)&&e.forEach((function(r,i){a.set(i,ur(r,t,n,i,e,s))}));var m=p?i:(u?l?so:oo:l?ka:Da)(e);return Ot(m||e,(function(r,i){m&&(r=e[i=r]),rr(a,i,ur(r,t,n,i,e,s))})),a}function pr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Oe(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Ne(o);return Do((function(){e.apply(i,n)}),t)}function fr(e,t,n,r){var i=-1,o=Pt,s=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=Rt(t,Qt(n))),r?(o=Lt,s=!1):t.length>=200&&(o=Zt,s=!1,t=new Kn(t));e:for(;++i-1},Yn.prototype.set=function(e,t){var n=this.__data__,r=ir(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Xn.prototype.clear=function(){this.size=0,this.__data__={hash:new zn,map:new(On||Yn),string:new zn}},Xn.prototype.delete=function(e){var t=po(this,e).delete(e);return this.size-=t?1:0,t},Xn.prototype.get=function(e){return po(this,e).get(e)},Xn.prototype.has=function(e){return po(this,e).has(e)},Xn.prototype.set=function(e,t){var n=po(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Kn.prototype.add=Kn.prototype.push=function(e){return this.__data__.set(e,s),this},Kn.prototype.has=function(e){return this.__data__.has(e)},Qn.prototype.clear=function(){this.__data__=new Yn,this.size=0},Qn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Qn.prototype.get=function(e){return this.__data__.get(e)},Qn.prototype.has=function(e){return this.__data__.has(e)},Qn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Yn){var r=n.__data__;if(!On||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Xn(r)}return n.set(e,t),this.size=n.size,this};var hr=ki(wr),mr=ki(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function vr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?_r(a,t-1,n,r,i):Dt(i,a):r||(i[i.length]=a)}return i}var Er=Mi(),br=Mi(!0);function wr(e,t){return e&&Er(e,t,Da)}function Sr(e,t){return e&&br(e,t,Da)}function Ir(e,t){return Nt(t,(function(t){return ea(e[t])}))}function Cr(e,t){for(var n=0,r=(t=bi(t,e)).length;null!=e&&nt}function Ar(e,t){return null!=e&&Me.call(e,t)}function Nr(e,t){return null!=e&&t in Oe(e)}function Pr(e,t,n){for(var o=n?Lt:Pt,s=e[0].length,a=e.length,c=a,l=r(a),u=1/0,p=[];c--;){var d=e[c];c&&t&&(d=Rt(d,Qt(t))),u=bn(d.length,u),l[c]=!n&&(t||s>=120&&d.length>=120)?new Kn(c&&d):i}d=e[0];var f=-1,h=l[0];e:for(;++f=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function zr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)a!==e&&Ke.call(a,c,1),Ke.call(e,c,1);return e}function Xr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;bo(i)?Ke.call(e,i,1):fi(e,i)}}return e}function Kr(e,t){return e+vt(In()*(t-e+1))}function Qr(e,t){var n="";if(!e||t<1||t>h)return n;do{t%2&&(n+=e),(t=vt(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return ko(Ao(e,t,sc),e+"")}function Zr(e){return Zn(Ha(e))}function ei(e,t){var n=Ha(e);return Fo(n,lr(t,0,n.length))}function ti(e,t,n,r){if(!ra(e))return e;for(var o=-1,s=(t=bi(t,e)).length,a=s-1,c=e;null!=c&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i>>1,s=e[o];null!==s&&!pa(s)&&(n?s<=t:s=200){var l=t?null:Qi(e);if(l)return pn(l);s=!1,i=Zt,c=new Kn}else c=t?[]:a;e:for(;++r=r?e:oi(e,t,n)}var Ii=pt||function(e){return ft.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function Oi(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ti(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,s=pa(e),a=t!==i,c=null===t,l=t==t,u=pa(t);if(!c&&!u&&!s&&e>t||s&&a&&l&&!c&&!u||r&&a&&l||!n&&l||!o)return 1;if(!r&&!s&&!u&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&wo(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Oe(t);++r-1?o[s?t[a]:a]:i}}function Ui(e){return io((function(t){var n=t.length,r=n,s=Gn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Ne(o);if(s&&!c&&"wrapper"==co(a))var c=new Gn([],!0)}for(r=c?r:n;++r1&&_.reverse(),f&&uc))return!1;var u=s.get(e),p=s.get(t);if(u&&p)return u==t&&p==e;var d=-1,f=!0,h=2&n?new Kn:i;for(s.set(e,t),s.set(t,e);++d-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ot(v,(function(n){var r="_."+n[0];t&n[1]&&!Pt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(le);return t?t[1].split(ue):[]}(r),n)))}function Vo(e){var t=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Fo(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,cs(e,n)}));function ms(e){var t=$n(e);return t.__chain__=!0,t}function gs(e,t){return t(e)}var vs=io((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return cr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Wn&&bo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:gs,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)}));var ys=Ri((function(e,t,n){Me.call(e,n)?++e[n]:ar(e,n,1)}));var _s=ji(Wo),Es=ji(zo);function bs(e,t){return(zs(e)?Ot:hr)(e,uo(t,3))}function ws(e,t){return(zs(e)?Tt:mr)(e,uo(t,3))}var Ss=Ri((function(e,t,n){Me.call(e,n)?e[n].push(t):ar(e,n,[t])}));var Is=Jr((function(e,t,n){var i=-1,o="function"==typeof t,s=Xs(e)?r(e.length):[];return hr(e,(function(e){s[++i]=o?Ct(t,e,n):Lr(e,t,n)})),s})),Cs=Ri((function(e,t,n){ar(e,n,t)}));function xs(e,t){return(zs(e)?Rt:Ur)(e,uo(t,3))}var Os=Ri((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Ts=Jr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&wo(e,t[0],t[1])?t=[]:n>2&&wo(t[0],t[1],t[2])&&(t=[t[0]]),Wr(e,_r(t,1),[])})),As=dt||function(){return ft.Date.now()};function Ns(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Zi(e,p,i,i,i,i,t)}function Ps(e,t){var n;if("function"!=typeof t)throw new Ne(o);return e=va(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ls=Jr((function(e,t,n){var r=1;if(n.length){var i=un(n,lo(Ls));r|=l}return Zi(e,r,t,n,i)})),Rs=Jr((function(e,t,n){var r=3;if(n.length){var i=un(n,lo(Rs));r|=l}return Zi(t,r,e,n,i)}));function Ds(e,t,n){var r,s,a,c,l,u,p=0,d=!1,f=!1,h=!0;if("function"!=typeof e)throw new Ne(o);function m(t){var n=r,o=s;return r=s=i,p=t,c=e.apply(o,n)}function g(e){return p=e,l=Do(y,t),d?m(e):c}function v(e){var n=e-u;return u===i||n>=t||n<0||f&&e-p>=a}function y(){var e=As();if(v(e))return _(e);l=Do(y,function(e){var n=t-(e-u);return f?bn(n,a-(e-p)):n}(e))}function _(e){return l=i,h&&r?m(e):(r=s=i,c)}function E(){var e=As(),n=v(e);if(r=arguments,s=this,u=e,n){if(l===i)return g(u);if(f)return Ii(l),l=Do(y,t),m(u)}return l===i&&(l=Do(y,t)),c}return t=_a(t)||0,ra(n)&&(d=!!n.leading,a=(f="maxWait"in n)?En(_a(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),E.cancel=function(){l!==i&&Ii(l),p=0,r=u=s=l=i},E.flush=function(){return l===i?c:_(As())},E}var ks=Jr((function(e,t){return dr(e,1,t)})),Ms=Jr((function(e,t,n){return dr(e,_a(t)||0,n)}));function Vs(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ne(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Vs.Cache||Xn),n}function Fs(e){if("function"!=typeof e)throw new Ne(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Vs.Cache=Xn;var Bs=wi((function(e,t){var n=(t=1==t.length&&zs(t[0])?Rt(t[0],Qt(uo())):Rt(_r(t,1),Qt(uo()))).length;return Jr((function(r){for(var i=-1,o=bn(r.length,n);++i=t})),Ws=Rr(function(){return arguments}())?Rr:function(e){return ia(e)&&Me.call(e,"callee")&&!Xe.call(e,"callee")},zs=r.isArray,Ys=_t?Qt(_t):function(e){return ia(e)&&Or(e)==D};function Xs(e){return null!=e&&na(e.length)&&!ea(e)}function Ks(e){return ia(e)&&Xs(e)}var Qs=Ft||_c,Js=Et?Qt(Et):function(e){return ia(e)&&Or(e)==b};function Zs(e){if(!ia(e))return!1;var t=Or(e);return t==w||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!aa(e)}function ea(e){if(!ra(e))return!1;var t=Or(e);return t==S||t==I||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ta(e){return"number"==typeof e&&e==va(e)}function na(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function ra(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ia(e){return null!=e&&"object"==typeof e}var oa=bt?Qt(bt):function(e){return ia(e)&&vo(e)==C};function sa(e){return"number"==typeof e||ia(e)&&Or(e)==x}function aa(e){if(!ia(e)||Or(e)!=O)return!1;var t=ze(e);if(null===t)return!0;var n=Me.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==je}var ca=wt?Qt(wt):function(e){return ia(e)&&Or(e)==A};var la=St?Qt(St):function(e){return ia(e)&&vo(e)==N};function ua(e){return"string"==typeof e||!zs(e)&&ia(e)&&Or(e)==P}function pa(e){return"symbol"==typeof e||ia(e)&&Or(e)==L}var da=It?Qt(It):function(e){return ia(e)&&na(e.length)&&!!st[Or(e)]};var fa=Yi(jr),ha=Yi((function(e,t){return e<=t}));function ma(e){if(!e)return[];if(Xs(e))return ua(e)?hn(e):Pi(e);if(et&&e[et])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[et]());var t=vo(e);return(t==C?cn:t==N?pn:Ha)(e)}function ga(e){return e?(e=_a(e))===f||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function va(e){var t=ga(e),n=t%1;return t==t?n?t-n:t:0}function ya(e){return e?lr(va(e),0,g):0}function _a(e){if("number"==typeof e)return e;if(pa(e))return m;if(ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=ve.test(e);return n||_e.test(e)?ut(e.slice(2),n?2:8):ge.test(e)?m:+e}function Ea(e){return Li(e,ka(e))}function ba(e){return null==e?"":pi(e)}var wa=Di((function(e,t){if(xo(t)||Xs(t))Li(t,Da(t),e);else for(var n in t)Me.call(t,n)&&rr(e,n,t[n])})),Sa=Di((function(e,t){Li(t,ka(t),e)})),Ia=Di((function(e,t,n,r){Li(t,ka(t),e,r)})),Ca=Di((function(e,t,n,r){Li(t,Da(t),e,r)})),xa=io(cr);var Oa=Jr((function(e,t){e=Oe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&wo(t[0],t[1],o)&&(r=1);++n1),t})),Li(e,so(e),n),r&&(n=ur(n,7,no));for(var i=t.length;i--;)fi(n,t[i]);return n}));var Ba=io((function(e,t){return null==e?{}:function(e,t){return zr(e,t,(function(t,n){return Na(e,n)}))}(e,t)}));function ja(e,t){if(null==e)return{};var n=Rt(so(e),(function(e){return[e]}));return t=uo(t),zr(e,n,(function(e,n){return t(e,n[0])}))}var Ua=Ji(Da),$a=Ji(ka);function Ha(e){return null==e?[]:Jt(e,Da(e))}var qa=Fi((function(e,t,n){return t=t.toLowerCase(),e+(n?Ga(t):t)}));function Ga(e){return Za(ba(e).toLowerCase())}function Wa(e){return(e=ba(e))&&e.replace(be,rn).replace(Ze,"")}var za=Fi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ya=Fi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Xa=Vi("toLowerCase");var Ka=Fi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Qa=Fi((function(e,t,n){return e+(n?" ":"")+Za(t)}));var Ja=Fi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Za=Vi("toUpperCase");function ec(e,t,n){return e=ba(e),(t=n?i:t)===i?function(e){return rt.test(e)}(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.match(pe)||[]}(e):e.match(t)||[]}var tc=Jr((function(e,t){try{return Ct(e,i,t)}catch(e){return Zs(e)?e:new Ie(e)}})),nc=io((function(e,t){return Ot(t,(function(t){t=jo(t),ar(e,t,Ls(e[t],e))})),e}));function rc(e){return function(){return e}}var ic=Ui(),oc=Ui(!0);function sc(e){return e}function ac(e){return Vr("function"==typeof e?e:ur(e,1))}var cc=Jr((function(e,t){return function(n){return Lr(n,e,t)}})),lc=Jr((function(e,t){return function(n){return Lr(e,n,t)}}));function uc(e,t,n){var r=Da(t),i=Ir(t,r);null!=n||ra(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Ir(t,Da(t)));var o=!(ra(n)&&"chain"in n&&!n.chain),s=ea(e);return Ot(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Pi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Dt([this.value()],arguments))})})),e}function pc(){}var dc=Gi(Rt),fc=Gi(At),hc=Gi(Vt);function mc(e){return So(e)?Gt(jo(e)):function(e){return function(t){return Cr(t,e)}}(e)}var gc=zi(),vc=zi(!0);function yc(){return[]}function _c(){return!1}var Ec=qi((function(e,t){return e+t}),0),bc=Ki("ceil"),wc=qi((function(e,t){return e/t}),1),Sc=Ki("floor");var Ic,Cc=qi((function(e,t){return e*t}),1),xc=Ki("round"),Oc=qi((function(e,t){return e-t}),0);return $n.after=function(e,t){if("function"!=typeof t)throw new Ne(o);return e=va(e),function(){if(--e<1)return t.apply(this,arguments)}},$n.ary=Ns,$n.assign=wa,$n.assignIn=Sa,$n.assignInWith=Ia,$n.assignWith=Ca,$n.at=xa,$n.before=Ps,$n.bind=Ls,$n.bindAll=nc,$n.bindKey=Rs,$n.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return zs(e)?e:[e]},$n.chain=ms,$n.chunk=function(e,t,n){t=(n?wo(e,t,n):t===i)?1:En(va(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,c=r(mt(o/t));so?0:o+n),(r=r===i||r>o?o:va(r))<0&&(r+=o),r=n>r?0:ya(r);n>>0)?(e=ba(e))&&("string"==typeof t||null!=t&&!ca(t))&&!(t=pi(t))&&an(e)?Si(hn(e),0,n):e.split(t,n):[]},$n.spread=function(e,t){if("function"!=typeof e)throw new Ne(o);return t=null==t?0:En(va(t),0),Jr((function(n){var r=n[t],i=Si(n,0,t);return r&&Dt(i,r),Ct(e,this,i)}))},$n.tail=function(e){var t=null==e?0:e.length;return t?oi(e,1,t):[]},$n.take=function(e,t,n){return e&&e.length?oi(e,0,(t=n||t===i?1:va(t))<0?0:t):[]},$n.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oi(e,(t=r-(t=n||t===i?1:va(t)))<0?0:t,r):[]},$n.takeRightWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!1,!0):[]},$n.takeWhile=function(e,t){return e&&e.length?mi(e,uo(t,3)):[]},$n.tap=function(e,t){return t(e),e},$n.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ne(o);return ra(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ds(e,t,{leading:r,maxWait:t,trailing:i})},$n.thru=gs,$n.toArray=ma,$n.toPairs=Ua,$n.toPairsIn=$a,$n.toPath=function(e){return zs(e)?Rt(e,jo):pa(e)?[e]:Pi(Bo(ba(e)))},$n.toPlainObject=Ea,$n.transform=function(e,t,n){var r=zs(e),i=r||Qs(e)||da(e);if(t=uo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:ra(e)&&ea(o)?Hn(ze(e)):{}}return(i?Ot:wr)(e,(function(e,r,i){return t(n,e,r,i)})),n},$n.unary=function(e){return Ns(e,1)},$n.union=is,$n.unionBy=os,$n.unionWith=ss,$n.uniq=function(e){return e&&e.length?di(e):[]},$n.uniqBy=function(e,t){return e&&e.length?di(e,uo(t,2)):[]},$n.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?di(e,i,t):[]},$n.unset=function(e,t){return null==e||fi(e,t)},$n.unzip=as,$n.unzipWith=cs,$n.update=function(e,t,n){return null==e?e:hi(e,t,Ei(n))},$n.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:hi(e,t,Ei(n),r)},$n.values=Ha,$n.valuesIn=function(e){return null==e?[]:Jt(e,ka(e))},$n.without=ls,$n.words=ec,$n.wrap=function(e,t){return js(Ei(t),e)},$n.xor=us,$n.xorBy=ps,$n.xorWith=ds,$n.zip=fs,$n.zipObject=function(e,t){return yi(e||[],t||[],rr)},$n.zipObjectDeep=function(e,t){return yi(e||[],t||[],ti)},$n.zipWith=hs,$n.entries=Ua,$n.entriesIn=$a,$n.extend=Sa,$n.extendWith=Ia,uc($n,$n),$n.add=Ec,$n.attempt=tc,$n.camelCase=qa,$n.capitalize=Ga,$n.ceil=bc,$n.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=_a(n))==n?n:0),t!==i&&(t=(t=_a(t))==t?t:0),lr(_a(e),t,n)},$n.clone=function(e){return ur(e,4)},$n.cloneDeep=function(e){return ur(e,5)},$n.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:i)},$n.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:i)},$n.conformsTo=function(e,t){return null==t||pr(e,t,Da(t))},$n.deburr=Wa,$n.defaultTo=function(e,t){return null==e||e!=e?t:e},$n.divide=wc,$n.endsWith=function(e,t,n){e=ba(e),t=pi(t);var r=e.length,o=n=n===i?r:lr(va(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},$n.eq=Hs,$n.escape=function(e){return(e=ba(e))&&Q.test(e)?e.replace(X,on):e},$n.escapeRegExp=function(e){return(e=ba(e))&&oe.test(e)?e.replace(ie,"\\$&"):e},$n.every=function(e,t,n){var r=zs(e)?At:gr;return n&&wo(e,t,n)&&(t=i),r(e,uo(t,3))},$n.find=_s,$n.findIndex=Wo,$n.findKey=function(e,t){return Bt(e,uo(t,3),wr)},$n.findLast=Es,$n.findLastIndex=zo,$n.findLastKey=function(e,t){return Bt(e,uo(t,3),Sr)},$n.floor=Sc,$n.forEach=bs,$n.forEachRight=ws,$n.forIn=function(e,t){return null==e?e:Er(e,uo(t,3),ka)},$n.forInRight=function(e,t){return null==e?e:br(e,uo(t,3),ka)},$n.forOwn=function(e,t){return e&&wr(e,uo(t,3))},$n.forOwnRight=function(e,t){return e&&Sr(e,uo(t,3))},$n.get=Aa,$n.gt=qs,$n.gte=Gs,$n.has=function(e,t){return null!=e&&yo(e,t,Ar)},$n.hasIn=Na,$n.head=Xo,$n.identity=sc,$n.includes=function(e,t,n,r){e=Xs(e)?e:Ha(e),n=n&&!r?va(n):0;var i=e.length;return n<0&&(n=En(i+n,0)),ua(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ut(e,t,n)>-1},$n.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:va(n);return i<0&&(i=En(r+i,0)),Ut(e,t,i)},$n.inRange=function(e,t,n){return t=ga(t),n===i?(n=t,t=0):n=ga(n),function(e,t,n){return e>=bn(t,n)&&e=-9007199254740991&&e<=h},$n.isSet=la,$n.isString=ua,$n.isSymbol=pa,$n.isTypedArray=da,$n.isUndefined=function(e){return e===i},$n.isWeakMap=function(e){return ia(e)&&vo(e)==R},$n.isWeakSet=function(e){return ia(e)&&"[object WeakSet]"==Or(e)},$n.join=function(e,t){return null==e?"":yn.call(e,t)},$n.kebabCase=za,$n.last=Zo,$n.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=va(n))<0?En(r+o,0):bn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):jt(e,Ht,o,!0)},$n.lowerCase=Ya,$n.lowerFirst=Xa,$n.lt=fa,$n.lte=ha,$n.max=function(e){return e&&e.length?vr(e,sc,Tr):i},$n.maxBy=function(e,t){return e&&e.length?vr(e,uo(t,2),Tr):i},$n.mean=function(e){return qt(e,sc)},$n.meanBy=function(e,t){return qt(e,uo(t,2))},$n.min=function(e){return e&&e.length?vr(e,sc,jr):i},$n.minBy=function(e,t){return e&&e.length?vr(e,uo(t,2),jr):i},$n.stubArray=yc,$n.stubFalse=_c,$n.stubObject=function(){return{}},$n.stubString=function(){return""},$n.stubTrue=function(){return!0},$n.multiply=Cc,$n.nth=function(e,t){return e&&e.length?Gr(e,va(t)):i},$n.noConflict=function(){return ft._===this&&(ft._=Ue),this},$n.noop=pc,$n.now=As,$n.pad=function(e,t,n){e=ba(e);var r=(t=va(t))?fn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Wi(vt(i),n)+e+Wi(mt(i),n)},$n.padEnd=function(e,t,n){e=ba(e);var r=(t=va(t))?fn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=In();return bn(e+o*(t-e+lt("1e-"+((o+"").length-1))),t)}return Kr(e,t)},$n.reduce=function(e,t,n){var r=zs(e)?kt:zt,i=arguments.length<3;return r(e,uo(t,4),n,i,hr)},$n.reduceRight=function(e,t,n){var r=zs(e)?Mt:zt,i=arguments.length<3;return r(e,uo(t,4),n,i,mr)},$n.repeat=function(e,t,n){return t=(n?wo(e,t,n):t===i)?1:va(t),Qr(ba(e),t)},$n.replace=function(){var e=arguments,t=ba(e[0]);return e.length<3?t:t.replace(e[1],e[2])},$n.result=function(e,t,n){var r=-1,o=(t=bi(t,e)).length;for(o||(o=1,e=i);++rh)return[];var n=g,r=bn(e,g);t=uo(t),e-=g;for(var i=Xt(r,t);++n=s)return e;var c=n-fn(r);if(c<1)return r;var l=a?Si(a,0,c).join(""):e.slice(0,c);if(o===i)return l+r;if(a&&(c+=l.length-c),ca(o)){if(e.slice(c).search(o)){var u,p=l;for(o.global||(o=Te(o.source,ba(me.exec(o))+"g")),o.lastIndex=0;u=o.exec(p);)var d=u.index;l=l.slice(0,d===i?c:d)}}else if(e.indexOf(pi(o),c)!=c){var f=l.lastIndexOf(o);f>-1&&(l=l.slice(0,f))}return l+r},$n.unescape=function(e){return(e=ba(e))&&K.test(e)?e.replace(Y,gn):e},$n.uniqueId=function(e){var t=++Ve;return ba(e)+t},$n.upperCase=Ja,$n.upperFirst=Za,$n.each=bs,$n.eachRight=ws,$n.first=Xo,uc($n,(Ic={},wr($n,(function(e,t){Me.call($n.prototype,t)||(Ic[t]=e)})),Ic),{chain:!1}),$n.VERSION="4.17.21",Ot(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){$n[e].placeholder=$n})),Ot(["drop","take"],(function(e,t){Wn.prototype[e]=function(n){n=n===i?1:En(va(n),0);var r=this.__filtered__&&!t?new Wn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,g),type:e+(r.__dir__<0?"Right":"")}),r},Wn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ot(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Wn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ot(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Wn.prototype[e]=function(){return this[n](1).value()[0]}})),Ot(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Wn.prototype[e]=function(){return this.__filtered__?new Wn(this):this[n](1)}})),Wn.prototype.compact=function(){return this.filter(sc)},Wn.prototype.find=function(e){return this.filter(e).head()},Wn.prototype.findLast=function(e){return this.reverse().find(e)},Wn.prototype.invokeMap=Jr((function(e,t){return"function"==typeof e?new Wn(this):this.map((function(n){return Lr(n,e,t)}))})),Wn.prototype.reject=function(e){return this.filter(Fs(uo(e)))},Wn.prototype.slice=function(e,t){e=va(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Wn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=va(t))<0?n.dropRight(-t):n.take(t-e)),n)},Wn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Wn.prototype.toArray=function(){return this.take(g)},wr(Wn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=$n[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&($n.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,c=t instanceof Wn,l=a[0],u=c||zs(t),p=function(e){var t=o.apply($n,Dt([e],a));return r&&d?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(c=u=!1);var d=this.__chain__,f=!!this.__actions__.length,h=s&&!d,m=c&&!f;if(!s&&u){t=m?t:new Wn(this);var g=e.apply(t,a);return g.__actions__.push({func:gs,args:[p],thisArg:i}),new Gn(g,d)}return h&&m?e.apply(this,a):(g=this.thru(p),h?r?g.value()[0]:g.value():g)})})),Ot(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);$n.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(zs(i)?i:[],e)}return this[n]((function(n){return t.apply(zs(n)?n:[],e)}))}})),wr(Wn.prototype,(function(e,t){var n=$n[t];if(n){var r=n.name+"";Me.call(Rn,r)||(Rn[r]=[]),Rn[r].push({name:t,func:n})}})),Rn[$i(i,2).name]=[{name:"wrapper",func:i}],Wn.prototype.clone=function(){var e=new Wn(this.__wrapped__);return e.__actions__=Pi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Pi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Pi(this.__views__),e},Wn.prototype.reverse=function(){if(this.__filtered__){var e=new Wn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Wn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=zs(e),r=t<0,i=n?e.length:0,o=function(e,t,n){var r=-1,i=n.length;for(;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},$n.prototype.plant=function(e){for(var t,n=this;n instanceof qn;){var r=$o(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},$n.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Wn){var t=e;return this.__actions__.length&&(t=new Wn(this)),(t=t.reverse()).__actions__.push({func:gs,args:[rs],thisArg:i}),new Gn(t,this.__chain__)}return this.thru(rs)},$n.prototype.toJSON=$n.prototype.valueOf=$n.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},$n.prototype.first=$n.prototype.head,et&&($n.prototype[et]=function(){return this}),$n}();ft._=vn,(r=function(){return vn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},9593:(e,t,n)=>{"use strict";const r=n(4411),i=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),l=Symbol("dispose"),u=Symbol("noDisposeOnSet"),p=Symbol("lruList"),d=Symbol("cache"),f=Symbol("updateAgeOnGet"),h=()=>1;const m=(e,t,n)=>{const r=e[d].get(t);if(r){const t=r.value;if(g(e,t)){if(y(e,r),!e[a])return}else n&&(e[f]&&(r.value.now=Date.now()),e[p].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[c]&&n>e[c]},v=e=>{if(e[o]>e[i])for(let t=e[p].tail;e[o]>e[i]&&null!==t;){const n=t.prev;y(e,t),t=n}},y=(e,t)=>{if(t){const n=t.value;e[l]&&e[l](n.key,n.value),e[o]-=n.length,e[d].delete(n.key),e[p].removeNode(t)}};class _{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const E=(e,t,n,r)=>{let i=n.value;g(e,i)&&(y(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||h;if(this[s]="function"!=typeof t?h:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[l]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,v(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,v(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=h),e!==this[s]&&(this[s]=e,this[o]=0,this[p].forEach((e=>{e.length=this[s](e.value,e.key),this[o]+=e.length}))),v(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[p].length}rforEach(e,t){t=t||this;for(let n=this[p].tail;null!==n;){const r=n.prev;E(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[p].head;null!==n;){const r=n.next;E(this,e,n,t),n=r}}keys(){return this[p].toArray().map((e=>e.key))}values(){return this[p].toArray().map((e=>e.value))}reset(){this[l]&&this[p]&&this[p].length&&this[p].forEach((e=>this[l](e.key,e.value))),this[d]=new Map,this[p]=new r,this[o]=0}dump(){return this[p].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[p]}set(e,t,n){if((n=n||this[c])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[d].has(e)){if(a>this[i])return y(this,this[d].get(e)),!1;const s=this[d].get(e).value;return this[l]&&(this[u]||this[l](e,s.value)),s.now=r,s.maxAge=n,s.value=t,this[o]+=a-s.length,s.length=a,this.get(e),v(this),!0}const f=new _(e,t,a,r,n);return f.length>this[i]?(this[l]&&this[l](e,t),!1):(this[o]+=f.length,this[p].unshift(f),this[d].set(e,this[p].head),v(this),!0)}has(e){if(!this[d].has(e))return!1;const t=this[d].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[p].tail;return e?(y(this,e),e.value):null}del(e){y(this,this[d].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach(((e,t)=>m(this,t,!1)))}}},1171:(e,t,n)=>{e.exports=d,d.Minimatch=f;var r={sep:"/"};try{r=n(5622)}catch(e){}var i=d.GLOBSTAR=f.GLOBSTAR={},o=n(3644),s={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},a="[^/]",c="[^/]*?",l="().*{}+?[]^$\\!".split("").reduce((function(e,t){return e[t]=!0,e}),{});var u=/\/+/;function p(e,t){e=e||{},t=t||{};var n={};return Object.keys(t).forEach((function(e){n[e]=t[e]})),Object.keys(e).forEach((function(t){n[t]=e[t]})),n}function d(e,t,n){if("string"!=typeof t)throw new TypeError("glob pattern string required");return n||(n={}),!(!n.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new f(t,n).match(e))}function f(e,t){if(!(this instanceof f))return new f(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==r.sep&&(e=e.split(r.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function h(e,t){if(t||(t=this instanceof f?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:o(e)}d.filter=function(e,t){return t=t||{},function(n,r,i){return d(n,e,t)}},d.defaults=function(e){if(!e||!Object.keys(e).length)return d;var t=d,n=function(n,r,i){return t.minimatch(n,r,p(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,p(e,r))},n},f.defaults=function(e){return e&&Object.keys(e).length?d.defaults(e).Minimatch:f},f.prototype.debug=function(){},f.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,n),n=this.globParts=n.map((function(e){return e.split(u)})),this.debug(this.pattern,n),n=n.map((function(e,t,n){return e.map(this.parse,this)}),this),this.debug(this.pattern,n),n=n.filter((function(e){return-1===e.indexOf(!1)})),this.debug(this.pattern,n),this.set=n},f.prototype.parseNegate=function(){var e=this.pattern,t=!1,n=this.options,r=0;if(n.nonegate)return;for(var i=0,o=e.length;i65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return i;if(""===e)return"";var r,o="",u=!!n.nocase,p=!1,d=[],f=[],h=!1,g=-1,v=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",_=this;function E(){if(r){switch(r){case"*":o+=c,u=!0;break;case"?":o+=a,u=!0;break;default:o+="\\"+r}_.debug("clearStateChar %j %j",r,o),r=!1}}for(var b,w=0,S=e.length;w-1;N--){var P=f[N],L=o.slice(0,P.reStart),R=o.slice(P.reStart,P.reEnd-8),D=o.slice(P.reEnd-8,P.reEnd),k=o.slice(P.reEnd);D+=k;var M=L.split("(").length-1,V=k;for(w=0;w=0&&!(i=e[o]);o--);for(o=0;o>> no match, partial?",e,d,t,f),d!==a))}if("string"==typeof u?(l=r.nocase?p.toLowerCase()===u.toLowerCase():p===u,this.debug("string match",u,p,l)):(l=p.match(u),this.debug("pattern match",u,p,l)),!l)return!1}if(o===a&&s===c)return!0;if(o===a)return n;if(s===c)return o===a-1&&""===e[o];throw new Error("wtf?")}},7824:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i,s=365.25*i;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=r)return a(e,o,r,"hour");if(o>=n)return a(e,o,n,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=r)return Math.round(e/r)+"h";if(o>=n)return Math.round(e/n)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},778:(e,t,n)=>{var r=n(2479);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}e.exports=r(i),e.exports.strict=r(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},4095:e=>{"use strict";function t(e){return"/"===e.charAt(0)}function n(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(e),n=t[1]||"",r=Boolean(n&&":"!==n.charAt(1));return Boolean(t[2]||r)}e.exports="win32"===process.platform?n:t,e.exports.posix=t,e.exports.win32=n},9916:e=>{function t(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}function n(e){e.pending+=1;var t=!1;return function(i){if(t)throw new Error("callback called twice");if(t=!0,e.error=e.error||i,e.pending-=1,e.waiting.length>0&&e.pending{var r=n(778),i=n(2840),o=n(5747),s=function(){},a=/^v?\.0/.test(process.version),c=function(e){return"function"==typeof e},l=function(e,t,n,l){l=r(l);var u=!1;e.on("close",(function(){u=!0})),i(e,{readable:t,writable:n},(function(e){if(e)return l(e);u=!0,l()}));var p=!1;return function(t){if(!u&&!p)return p=!0,function(e){return!!a&&!!o&&(e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&c(e.close)}(e)?e.close(s):function(e){return e.setHeader&&c(e.abort)}(e)?e.abort():c(e.destroy)?e.destroy():void l(t||new Error("stream was destroyed"))}},u=function(e){e()},p=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),n=c(t[t.length-1]||s)&&t.pop()||s;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r=t.map((function(i,o){var s=o0,(function(t){e||(e=t),t&&r.forEach(u),s||(r.forEach(u),n(e))}))}));return t.reduce(p)}},984:(e,t,n)=>{const r=n(2357),i=n(5622),o=n(5747);let s;try{s=n(2884)}catch(e){}const a={nosort:!0,silent:!0};let c=0;const l="win32"===process.platform,u=e=>{if(["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||o[t],e[t+="Sync"]=e[t]||o[t]})),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,!1===e.glob&&(e.disableGlob=!0),!0!==e.disableGlob&&void 0===s)throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");e.disableGlob=e.disableGlob||!1,e.glob=e.glob||a},p=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),r(e,"rimraf: missing path"),r.equal(typeof e,"string","rimraf: path should be a string"),r.equal(typeof n,"function","rimraf: callback function required"),r(t,"rimraf: invalid options argument provided"),r.equal(typeof t,"object","rimraf: options should be object"),u(t);let i=0,o=null,a=0;const l=(e,r)=>e?n(e):(a=r.length,0===a?n():void r.forEach((e=>{const r=s=>{if(s){if(("EBUSY"===s.code||"ENOTEMPTY"===s.code||"EPERM"===s.code)&&id(e,t,r)),100*i);if("EMFILE"===s.code&&cd(e,t,r)),c++);"ENOENT"===s.code&&(s=null)}c=0,(e=>{o=o||e,0==--a&&n(o)})(s)};d(e,t,r)})));if(t.disableGlob||!s.hasMagic(e))return l(null,[e]);t.lstat(e,((n,r)=>{if(!n)return l(null,[e]);s(e,t.glob,l)}))},d=(e,t,n)=>{r(e),r(t),r("function"==typeof n),t.lstat(e,((r,i)=>r&&"ENOENT"===r.code?n(null):(r&&"EPERM"===r.code&&l&&f(e,t,r,n),i&&i.isDirectory()?m(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return l?f(e,t,r,n):m(e,t,r,n);if("EISDIR"===r.code)return m(e,t,r,n)}return n(r)})))))},f=(e,t,n,i)=>{r(e),r(t),r("function"==typeof i),t.chmod(e,438,(r=>{r?i("ENOENT"===r.code?null:n):t.stat(e,((r,o)=>{r?i("ENOENT"===r.code?null:n):o.isDirectory()?m(e,t,n,i):t.unlink(e,i)}))}))},h=(e,t,n)=>{r(e),r(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}let i;try{i=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}i.isDirectory()?y(e,t,n):t.unlinkSync(e)},m=(e,t,n,i)=>{r(e),r(t),r("function"==typeof i),t.rmdir(e,(r=>{!r||"ENOTEMPTY"!==r.code&&"EEXIST"!==r.code&&"EPERM"!==r.code?r&&"ENOTDIR"===r.code?i(n):i(r):g(e,t,i)}))},g=(e,t,n)=>{r(e),r(t),r("function"==typeof n),t.readdir(e,((r,o)=>{if(r)return n(r);let s,a=o.length;if(0===a)return t.rmdir(e,n);o.forEach((r=>{p(i.join(e,r),t,(r=>{if(!s)return r?n(s=r):void(0==--a&&t.rmdir(e,n))}))}))}))},v=(e,t)=>{let n;if(u(t=t||{}),r(e,"rimraf: missing path"),r.equal(typeof e,"string","rimraf: path should be a string"),r(t,"rimraf: missing options"),r.equal(typeof t,"object","rimraf: options should be object"),t.disableGlob||!s.hasMagic(e))n=[e];else try{t.lstatSync(e),n=[e]}catch(r){n=s.sync(e,t.glob)}if(n.length)for(let e=0;e{r(e),r(t);try{t.rmdirSync(e)}catch(r){if("ENOENT"===r.code)return;if("ENOTDIR"===r.code)throw n;"ENOTEMPTY"!==r.code&&"EEXIST"!==r.code&&"EPERM"!==r.code||_(e,t)}},_=(e,t)=>{r(e),r(t),t.readdirSync(e).forEach((n=>v(i.join(e,n),t)));const n=l?100:1;let o=0;for(;;){let r=!0;try{const i=t.rmdirSync(e,t);return r=!1,i}finally{if(++o{const r=Symbol("SemVer ANY");class i{static get ANY(){return r}constructor(e,t){if(t=o(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}l("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const t=this.options.loose?s[a.COMPARATORLOOSE]:s[a.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new u(n[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new p(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new p(this.value,t).test(e.semver);const n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),r=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),o=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=c(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),l=c(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||r||o&&s||a||l}}e.exports=i;const o=n(2893),{re:s,t:a}=n(5765),c=n(7539),l=n(4225),u=n(6376),p=n(6902)},6902:(e,t,n)=>{class r{constructor(e,t){if(t=o(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!h(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=i.get(t);if(n)return n;const r=this.options.loose,o=r?l[u.HYPHENRANGELOOSE]:l[u.HYPHENRANGE];e=e.replace(o,O(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(l[u.COMPARATORTRIM],p),a("comparator trim",e,l[u.COMPARATORTRIM]),e=(e=(e=e.replace(l[u.TILDETRIM],d)).replace(l[u.CARETTRIM],f)).split(/\s+/).join(" ");const c=r?l[u.COMPARATORLOOSE]:l[u.COMPARATOR],m=e.split(" ").map((e=>v(e,this.options))).join(" ").split(/\s+/).map((e=>x(e,this.options))).filter(this.options.loose?e=>!!e.match(c):()=>!0).map((e=>new s(e,this.options))),g=(m.length,new Map);for(const e of m){if(h(e))return[e];g.set(e.value,e)}g.size>1&&g.has("")&&g.delete("");const y=[...g.values()];return i.set(t,y),y}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some((n=>g(n,t)&&e.set.some((e=>g(e,t)&&n.every((n=>e.every((e=>n.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},v=(e,t)=>(a("comp",e,t),e=b(e,t),a("caret",e),e=_(e,t),a("tildes",e),e=S(e,t),a("xrange",e),e=C(e,t),a("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{const n=t.loose?l[u.TILDELOOSE]:l[u.TILDE];return e.replace(n,((t,n,r,i,o)=>{let s;return a("tilde",e,t,n,r,i,o),y(n)?s="":y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:o?(a("replaceTilde pr",o),s=`>=${n}.${r}.${i}-${o} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,a("tilde return",s),s}))},b=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{a("caret",e,t);const n=t.loose?l[u.CARETLOOSE]:l[u.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,i,o,s)=>{let c;return a("caret",e,t,n,i,o,s),y(n)?c="":y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(o)?c="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(a("replaceCaret pr",s),c="0"===n?"0"===i?`>=${n}.${i}.${o}-${s} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o}-${s} <${+n+1}.0.0-0`):(a("no pr"),c="0"===n?"0"===i?`>=${n}.${i}.${o}${r} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o} <${+n+1}.0.0-0`),a("caret return",c),c}))},S=(e,t)=>(a("replaceXRanges",e,t),e.split(/\s+/).map((e=>I(e,t))).join(" ")),I=(e,t)=>{e=e.trim();const n=t.loose?l[u.XRANGELOOSE]:l[u.XRANGE];return e.replace(n,((n,r,i,o,s,c)=>{a("xRange",e,n,r,i,o,s,c);const l=y(i),u=l||y(o),p=u||y(s),d=p;return"="===r&&d&&(r=""),c=t.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(u&&(o=0),s=0,">"===r?(r=">=",u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",u?i=+i+1:o=+o+1),"<"===r&&(c="-0"),n=`${r+i}.${o}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),a("xRange return",n),n}))},C=(e,t)=>(a("replaceStars",e,t),e.trim().replace(l[u.STAR],"")),x=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(l[t.includePrerelease?u.GTE0PRE:u.GTE0],"")),O=e=>(t,n,r,i,o,s,a,c,l,u,p,d,f)=>`${n=y(r)?"":y(i)?`>=${r}.0.0${e?"-0":""}`:y(o)?`>=${r}.${i}.0${e?"-0":""}`:s?`>=${n}`:`>=${n}${e?"-0":""}`} ${c=y(l)?"":y(u)?`<${+l+1}.0.0-0`:y(p)?`<${l}.${+u+1}.0-0`:d?`<=${l}.${u}.${p}-${d}`:e?`<${l}.${u}.${+p+1}-0`:`<=${c}`}`.trim(),T=(e,t,n)=>{for(let n=0;n0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}},6376:(e,t,n)=>{const r=n(4225),{MAX_LENGTH:i,MAX_SAFE_INTEGER:o}=n(3295),{re:s,t:a}=n(5765),c=n(2893),{compareIdentifiers:l}=n(6742);class u{constructor(e,t){if(t=c(t),e instanceof u){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?s[a.LOOSE]:s[a.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}e.exports=u},3507:(e,t,n)=>{const r=n(3959);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},7539:(e,t,n)=>{const r=n(8718),i=n(1194),o=n(1312),s=n(5903),a=n(1544),c=n(2056);e.exports=(e,t,n,l)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return r(e,n,l);case"!=":return i(e,n,l);case">":return o(e,n,l);case">=":return s(e,n,l);case"<":return a(e,n,l);case"<=":return c(e,n,l);default:throw new TypeError(`Invalid operator: ${t}`)}}},9038:(e,t,n)=>{const r=n(6376),i=n(3959),{re:o,t:s}=n(5765);e.exports=(e,t)=>{if(e instanceof r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){let t;for(;(t=o[s.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&t.index+t[0].length===n.index+n[0].length||(n=t),o[s.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;o[s.COERCERTL].lastIndex=-1}else n=e.match(o[s.COERCE]);return null===n?null:i(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)}},8880:(e,t,n)=>{const r=n(6376);e.exports=(e,t,n)=>{const i=new r(e,n),o=new r(t,n);return i.compare(o)||i.compareBuild(o)}},7880:(e,t,n)=>{const r=n(6269);e.exports=(e,t)=>r(e,t,!0)},6269:(e,t,n)=>{const r=n(6376);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},2378:(e,t,n)=>{const r=n(3959),i=n(8718);e.exports=(e,t)=>{if(i(e,t))return null;{const n=r(e),i=r(t),o=n.prerelease.length||i.prerelease.length,s=o?"pre":"",a=o?"prerelease":"";for(const e in n)if(("major"===e||"minor"===e||"patch"===e)&&n[e]!==i[e])return s+e;return a}}},8718:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>0===r(e,t,n)},1312:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)>0},5903:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)>=0},253:(e,t,n)=>{const r=n(6376);e.exports=(e,t,n,i)=>{"string"==typeof n&&(i=n,n=void 0);try{return new r(e,n).inc(t,i).version}catch(e){return null}}},1544:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)<0},2056:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)<=0},8679:(e,t,n)=>{const r=n(6376);e.exports=(e,t)=>new r(e,t).major},7789:(e,t,n)=>{const r=n(6376);e.exports=(e,t)=>new r(e,t).minor},1194:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>0!==r(e,t,n)},3959:(e,t,n)=>{const{MAX_LENGTH:r}=n(3295),{re:i,t:o}=n(5765),s=n(6376),a=n(2893);e.exports=(e,t)=>{if(t=a(t),e instanceof s)return e;if("string"!=typeof e)return null;if(e.length>r)return null;if(!(t.loose?i[o.LOOSE]:i[o.FULL]).test(e))return null;try{return new s(e,t)}catch(e){return null}}},2358:(e,t,n)=>{const r=n(6376);e.exports=(e,t)=>new r(e,t).patch},7559:(e,t,n)=>{const r=n(3959);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},9795:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(t,e,n)},3657:(e,t,n)=>{const r=n(8880);e.exports=(e,t)=>e.sort(((e,n)=>r(n,e,t)))},5712:(e,t,n)=>{const r=n(6902);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},1100:(e,t,n)=>{const r=n(8880);e.exports=(e,t)=>e.sort(((e,n)=>r(e,n,t)))},6397:(e,t,n)=>{const r=n(3959);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},1249:(e,t,n)=>{const r=n(5765);e.exports={re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n(3295).SEMVER_SPEC_VERSION,SemVer:n(6376),compareIdentifiers:n(6742).compareIdentifiers,rcompareIdentifiers:n(6742).rcompareIdentifiers,parse:n(3959),valid:n(6397),clean:n(3507),inc:n(253),diff:n(2378),major:n(8679),minor:n(7789),patch:n(2358),prerelease:n(7559),compare:n(6269),rcompare:n(9795),compareLoose:n(7880),compareBuild:n(8880),sort:n(1100),rsort:n(3657),gt:n(1312),lt:n(1544),eq:n(8718),neq:n(1194),gte:n(5903),lte:n(2056),cmp:n(7539),coerce:n(9038),Comparator:n(2257),Range:n(6902),satisfies:n(5712),toComparators:n(1042),maxSatisfying:n(5775),minSatisfying:n(1657),minVersion:n(5316),validRange:n(9042),outside:n(6826),gtr:n(7606),ltr:n(32),intersects:n(2937),simplifyRange:n(7908),subset:n(799)}},3295:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:t,MAX_SAFE_COMPONENT_LENGTH:16}},4225:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},6742:e=>{const t=/^[0-9]+$/,n=(e,n)=>{const r=t.test(e),i=t.test(n);return r&&i&&(e=+e,n=+n),e===n?0:r&&!i?-1:i&&!r?1:en(t,e)}},2893:e=>{const t=["includePrerelease","loose","rtl"];e.exports=e=>e?"object"!=typeof e?{loose:!0}:t.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{}},5765:(e,t,n)=>{const{MAX_SAFE_COMPONENT_LENGTH:r}=n(3295),i=n(4225),o=(t=e.exports={}).re=[],s=t.src=[],a=t.t={};let c=0;const l=(e,t,n)=>{const r=c++;i(r,t),a[e]=r,s[r]=t,o[r]=new RegExp(t,n?"g":void 0)};l("NUMERICIDENTIFIER","0|[1-9]\\d*"),l("NUMERICIDENTIFIERLOOSE","[0-9]+"),l("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),l("MAINVERSION",`(${s[a.NUMERICIDENTIFIER]})\\.(${s[a.NUMERICIDENTIFIER]})\\.(${s[a.NUMERICIDENTIFIER]})`),l("MAINVERSIONLOOSE",`(${s[a.NUMERICIDENTIFIERLOOSE]})\\.(${s[a.NUMERICIDENTIFIERLOOSE]})\\.(${s[a.NUMERICIDENTIFIERLOOSE]})`),l("PRERELEASEIDENTIFIER",`(?:${s[a.NUMERICIDENTIFIER]}|${s[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASEIDENTIFIERLOOSE",`(?:${s[a.NUMERICIDENTIFIERLOOSE]}|${s[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASE",`(?:-(${s[a.PRERELEASEIDENTIFIER]}(?:\\.${s[a.PRERELEASEIDENTIFIER]})*))`),l("PRERELEASELOOSE",`(?:-?(${s[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[a.PRERELEASEIDENTIFIERLOOSE]})*))`),l("BUILDIDENTIFIER","[0-9A-Za-z-]+"),l("BUILD",`(?:\\+(${s[a.BUILDIDENTIFIER]}(?:\\.${s[a.BUILDIDENTIFIER]})*))`),l("FULLPLAIN",`v?${s[a.MAINVERSION]}${s[a.PRERELEASE]}?${s[a.BUILD]}?`),l("FULL",`^${s[a.FULLPLAIN]}$`),l("LOOSEPLAIN",`[v=\\s]*${s[a.MAINVERSIONLOOSE]}${s[a.PRERELEASELOOSE]}?${s[a.BUILD]}?`),l("LOOSE",`^${s[a.LOOSEPLAIN]}$`),l("GTLT","((?:<|>)?=?)"),l("XRANGEIDENTIFIERLOOSE",`${s[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),l("XRANGEIDENTIFIER",`${s[a.NUMERICIDENTIFIER]}|x|X|\\*`),l("XRANGEPLAIN",`[v=\\s]*(${s[a.XRANGEIDENTIFIER]})(?:\\.(${s[a.XRANGEIDENTIFIER]})(?:\\.(${s[a.XRANGEIDENTIFIER]})(?:${s[a.PRERELEASE]})?${s[a.BUILD]}?)?)?`),l("XRANGEPLAINLOOSE",`[v=\\s]*(${s[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[a.XRANGEIDENTIFIERLOOSE]})(?:${s[a.PRERELEASELOOSE]})?${s[a.BUILD]}?)?)?`),l("XRANGE",`^${s[a.GTLT]}\\s*${s[a.XRANGEPLAIN]}$`),l("XRANGELOOSE",`^${s[a.GTLT]}\\s*${s[a.XRANGEPLAINLOOSE]}$`),l("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),l("COERCERTL",s[a.COERCE],!0),l("LONETILDE","(?:~>?)"),l("TILDETRIM",`(\\s*)${s[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",l("TILDE",`^${s[a.LONETILDE]}${s[a.XRANGEPLAIN]}$`),l("TILDELOOSE",`^${s[a.LONETILDE]}${s[a.XRANGEPLAINLOOSE]}$`),l("LONECARET","(?:\\^)"),l("CARETTRIM",`(\\s*)${s[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",l("CARET",`^${s[a.LONECARET]}${s[a.XRANGEPLAIN]}$`),l("CARETLOOSE",`^${s[a.LONECARET]}${s[a.XRANGEPLAINLOOSE]}$`),l("COMPARATORLOOSE",`^${s[a.GTLT]}\\s*(${s[a.LOOSEPLAIN]})$|^$`),l("COMPARATOR",`^${s[a.GTLT]}\\s*(${s[a.FULLPLAIN]})$|^$`),l("COMPARATORTRIM",`(\\s*)${s[a.GTLT]}\\s*(${s[a.LOOSEPLAIN]}|${s[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",l("HYPHENRANGE",`^\\s*(${s[a.XRANGEPLAIN]})\\s+-\\s+(${s[a.XRANGEPLAIN]})\\s*$`),l("HYPHENRANGELOOSE",`^\\s*(${s[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[a.XRANGEPLAINLOOSE]})\\s*$`),l("STAR","(<|>)?=?\\s*\\*"),l("GTE0","^\\s*>=\\s*0.0.0\\s*$"),l("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")},7606:(e,t,n)=>{const r=n(6826);e.exports=(e,t,n)=>r(e,t,">",n)},2937:(e,t,n)=>{const r=n(6902);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t))},32:(e,t,n)=>{const r=n(6826);e.exports=(e,t,n)=>r(e,t,"<",n)},5775:(e,t,n)=>{const r=n(6376),i=n(6902);e.exports=(e,t,n)=>{let o=null,s=null,a=null;try{a=new i(t,n)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(o&&-1!==s.compare(e)||(o=e,s=new r(o,n)))})),o}},1657:(e,t,n)=>{const r=n(6376),i=n(6902);e.exports=(e,t,n)=>{let o=null,s=null,a=null;try{a=new i(t,n)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(o&&1!==s.compare(e)||(o=e,s=new r(o,n)))})),o}},5316:(e,t,n)=>{const r=n(6376),i=n(6902),o=n(1312);e.exports=(e,t)=>{e=new i(e,t);let n=new r("0.0.0");if(e.test(n))return n;if(n=new r("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t{const t=new r(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!o(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!s||n&&!o(n,s)||(n=s)}return n&&e.test(n)?n:null}},6826:(e,t,n)=>{const r=n(6376),i=n(2257),{ANY:o}=i,s=n(6902),a=n(5712),c=n(1312),l=n(1544),u=n(2056),p=n(5903);e.exports=(e,t,n,d)=>{let f,h,m,g,v;switch(e=new r(e,d),t=new s(t,d),n){case">":f=c,h=u,m=l,g=">",v=">=";break;case"<":f=l,h=p,m=c,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,d))return!1;for(let n=0;n{e.semver===o&&(e=new i(">=0.0.0")),s=s||e,a=a||e,f(e.semver,s.semver,d)?s=e:m(e.semver,a.semver,d)&&(a=e)})),s.operator===g||s.operator===v)return!1;if((!a.operator||a.operator===g)&&h(e,a.semver))return!1;if(a.operator===v&&m(e,a.semver))return!1}return!0}},7908:(e,t,n)=>{const r=n(5712),i=n(6269);e.exports=(e,t,n)=>{const o=[];let s=null,a=null;const c=e.sort(((e,t)=>i(e,t,n)));for(const e of c){r(e,t,n)?(a=e,s||(s=e)):(a&&o.push([s,a]),a=null,s=null)}s&&o.push([s,null]);const l=[];for(const[e,t]of o)e===t?l.push(e):t||e!==c[0]?t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`):l.push("*");const u=l.join(" || "),p="string"==typeof t.raw?t.raw:String(t);return u.length{const r=n(6902),i=n(2257),{ANY:o}=i,s=n(5712),a=n(6269),c=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===o){if(1===t.length&&t[0].semver===o)return!0;e=n.includePrerelease?[new i(">=0.0.0-0")]:[new i(">=0.0.0")]}if(1===t.length&&t[0].semver===o){if(n.includePrerelease)return!0;t=[new i(">=0.0.0")]}const r=new Set;let c,p,d,f,h,m,g;for(const t of e)">"===t.operator||">="===t.operator?c=l(c,t,n):"<"===t.operator||"<="===t.operator?p=u(p,t,n):r.add(t.semver);if(r.size>1)return null;if(c&&p){if(d=a(c.semver,p.semver,n),d>0)return null;if(0===d&&(">="!==c.operator||"<="!==p.operator))return null}for(const e of r){if(c&&!s(e,String(c),n))return null;if(p&&!s(e,String(p),n))return null;for(const r of t)if(!s(e,String(r),n))return!1;return!0}let v=!(!p||n.includePrerelease||!p.semver.prerelease.length)&&p.semver,y=!(!c||n.includePrerelease||!c.semver.prerelease.length)&&c.semver;v&&1===v.prerelease.length&&"<"===p.operator&&0===v.prerelease[0]&&(v=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,c)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(f=l(c,e,n),f===e&&f!==c)return!1}else if(">="===c.operator&&!s(c.semver,String(e),n))return!1;if(p)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if(h=u(p,e,n),h===e&&h!==p)return!1}else if("<="===p.operator&&!s(p.semver,String(e),n))return!1;if(!e.operator&&(p||c)&&0!==d)return!1}return!(c&&m&&!p&&0!==d)&&(!(p&&g&&!c&&0!==d)&&(!y&&!v))},l=(e,t,n)=>{if(!e)return t;const r=a(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},u=(e,t,n)=>{if(!e)return t;const r=a(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new r(e,n),t=new r(t,n);let i=!1;e:for(const r of e.set){for(const e of t.set){const t=c(r,e,n);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},1042:(e,t,n)=>{const r=n(6902);e.exports=(e,t)=>new r(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},9042:(e,t,n)=>{const r=n(6902);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},6372:e=>{"use strict";function t(e){return"function"==typeof e}var n=console.error.bind(console);function r(e,t,n){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function i(e){e&&e.logger&&(t(e.logger)?n=e.logger:n("new logger isn't a function, not replacing"))}function o(e,i,o){if(e&&e[i]){if(!o)return n("no wrapper function"),void n((new Error).stack);if(t(e[i])&&t(o)){var s=e[i],a=o(s,i);return r(a,"__original",s),r(a,"__unwrap",(function(){e[i]===a&&r(e,i,s)})),r(a,"__wrapped",!0),r(e,i,a),a}n("original object and wrapper must be functions")}else n("no original function "+i+" to wrap")}function s(e,t){return e&&e[t]?e[t].__unwrap?e[t].__unwrap():void n("no original to unwrap to -- has "+t+" already been unwrapped?"):(n("no function to unwrap."),void n((new Error).stack))}i.wrap=o,i.massWrap=function(e,t,r){if(!e)return n("must provide one or more modules to patch"),void n((new Error).stack);Array.isArray(e)||(e=[e]),t&&Array.isArray(t)?e.forEach((function(e){t.forEach((function(t){o(e,t,r)}))})):n("must provide one or more functions to wrap on modules")},i.unwrap=s,i.massUnwrap=function(e,t){if(!e)return n("must provide one or more modules to patch"),void n((new Error).stack);Array.isArray(e)||(e=[e]),t&&Array.isArray(t)?e.forEach((function(e){t.forEach((function(t){s(e,t)}))})):n("must provide one or more functions to unwrap on modules")},e.exports=i},465:e=>{e.exports=function(e,t){var n=[];n.push(function(e){try{return Error.prototype.toString.call(e)}catch(e){try{return""}catch(e){return""}}}(e));for(var r=0;r"}catch(e){i=""}}n.push(" at "+i)}return n.join("\n")}},2512:(e,t,n)=>{if(global._stackChain){if(global._stackChain.version!==n(9414).i8)throw new Error("Conflicting version of stack-chain found");e.exports=global._stackChain}else e.exports=global._stackChain=n(7898)},9414:e=>{"use strict";e.exports={i8:"1.3.7"}},7898:(e,t,n)=>{var r=n(465);function i(){this.extend=new a,this.filter=new a,this.format=new c,this.version=n(9414).i8}var o=!1;i.prototype.callSite=function e(t){t||(t={}),o=!0;var n={};Error.captureStackTrace(n,e);var r=n.stack;return o=!1,r=r.slice(t.slice||0),t.extend&&(r=this.extend._modify(n,r)),t.filter&&(r=this.filter._modify(n,r)),r};var s=new i;function a(){this._modifiers=[]}function c(){this._formater=r,this._previous=void 0}a.prototype._modify=function(e,t){for(var n=0,r=this._modifiers.length;n{"use strict";const r=n(2087),i=n(3867),o=n(6560),{env:s}=process;let a;function c(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(0===a)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(e&&!t&&void 0===a)return 0;const n=a||0;if("dumb"===s.TERM)return n;if("win32"===process.platform){const e=r.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in s)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in s))||"codeship"===s.CI_NAME?1:n;if("TEAMCITY_VERSION"in s)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if("truecolor"===s.COLORTERM)return 3;if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:n}o("no-color")||o("no-colors")||o("color=false")||o("color=never")?a=0:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(a=1),"FORCE_COLOR"in s&&(a="true"===s.FORCE_COLOR?1:"false"===s.FORCE_COLOR?0:0===s.FORCE_COLOR.length?1:Math.min(parseInt(s.FORCE_COLOR,10),3)),e.exports={supportsColor:function(e){return c(l(e,e&&e.isTTY))},stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}},7250:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(3129).execSync,o=n(1453);let s=process.platform;const a="linux"===s,c="darwin"===s,l="win32"===s,u="freebsd"===s,p="openbsd"===s,d="netbsd"===s,f="sunos"===s;function h(e,t,n){let r="";return e.indexOf("speak")>=0&&(r="Speaker"),e.indexOf("laut")>=0&&(r="Speaker"),e.indexOf("loud")>=0&&(r="Speaker"),e.indexOf("head")>=0&&(r="Headset"),e.indexOf("mic")>=0&&(r="Microphone"),e.indexOf("mikr")>=0&&(r="Microphone"),e.indexOf("phone")>=0&&(r="Phone"),e.indexOf("controll")>=0&&(r="Controller"),e.indexOf("line o")>=0&&(r="Line Out"),e.indexOf("digital o")>=0&&(r="Digital Out"),!r&&n?r="Speaker":!r&&t&&(r="Microphone"),r}function m(e,t){const n={},r=o.getValue(e,"Slot"),i=t.filter((function(e){return e.slotId===r}));return n.id=r,n.name=o.getValue(e,"SDevice"),n.manufacturer=o.getValue(e,"SVendor"),n.revision=o.getValue(e,"Rev"),n.driver=i&&1===i.length&&i[0].driver?i[0].driver:"",n.default=null,n.channel="PCIe",n.type=h(n.name,null,null),n.in=null,n.out=null,n.status="online",n}function g(e,t){const n={},r=((e.coreaudio_device_transport||"")+" "+(e._name||"")).toLowerCase();return n.id=t,n.name=e._name,n.manufacturer=e.coreaudio_device_manufacturer,n.revision=null,n.driver=null,n.default=!!e.coreaudio_default_audio_input_device||!!e.coreaudio_default_audio_output_device,n.channel=function(e){let t="";return e.indexOf("builtin")>=0&&(t="Built-In"),e.indexOf("extern")>=0&&(t="Audio-Jack"),e.indexOf("hdmi")>=0&&(t="HDMI"),e.indexOf("displayport")>=0&&(t="Display-Port"),e.indexOf("usb")>=0&&(t="USB"),e.indexOf("pci")>=0&&(t="PCIe"),t}(r),n.type=h(n.name,!!e.coreaudio_device_input,!!e.coreaudio_device_output),n.in=!!e.coreaudio_device_input,n.out=!!e.coreaudio_device_output,n.status="online",n}function v(e){const t={},n=o.getValue(e,"StatusInfo","=");return t.id=o.getValue(e,"DeviceID","="),t.name=o.getValue(e,"name","="),t.manufacturer=o.getValue(e,"manufacturer","="),t.revision=null,t.driver=null,t.default=null,t.channel=null,t.type=h(t.name,null,null),t.in=null,t.out=null,t.status=n,t}t.audio=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(a||u||p||d){r("lspci -vmm 2>/dev/null",(function(r,s){if(!r){const e=function(){let e=[];try{const t=i("lspci -v 2>/dev/null").toString().split("\n\n");for(let n=0;n=0){const t={};t.slotId=r[0].split(" ")[0],t.driver=o.getValue(r,"Kernel driver in use",":",!0)||o.getValue(r,"Kernel modules",":",!0),e.push(t)}}return e}catch(t){return e}}(),t=s.toString().split("\n\n");for(let r=0;r=0){const t=m(i,e);n.push(t)}}}e&&e(n),t(n)}))}if(c){r("system_profiler SPAudioDataType -json",(function(r,i){if(!r)try{const e=JSON.parse(i.toString());if(e.SPAudioDataType&&e.SPAudioDataType.length&&e.SPAudioDataType[0]&&e.SPAudioDataType[0]._items&&e.SPAudioDataType[0]._items.length)for(let t=0;t{"use strict";const r=n(3129).exec,i=n(5747),o=n(1453);let s=process.platform;const a="linux"===s,c="darwin"===s,l="win32"===s,u="freebsd"===s,p="openbsd"===s,d="netbsd"===s,f="sunos"===s;e.exports=function(e){return new Promise((t=>{process.nextTick((()=>{let n={hasBattery:!1,cycleCount:0,isCharging:!1,designedCapacity:0,maxCapacity:0,currentCapacity:0,voltage:0,capacityUnit:"",percent:0,timeRemaining:null,acConnected:!0,type:"",model:"",manufacturer:"",serial:""};if(a){let r="";i.existsSync("/sys/class/power_supply/BAT1/uevent")?r="/sys/class/power_supply/BAT1/":i.existsSync("/sys/class/power_supply/BAT0/uevent")&&(r="/sys/class/power_supply/BAT0/"),r?i.readFile(r+"uevent",(function(r,i){if(r)e&&e(n),t(n);else{let r=i.toString().split("\n");n.isCharging="charging"===o.getValue(r,"POWER_SUPPLY_STATUS","=").toLowerCase(),n.acConnected=n.isCharging,n.voltage=parseInt("0"+o.getValue(r,"POWER_SUPPLY_VOLTAGE_NOW","="),10)/1e6,n.capacityUnit=n.voltage?"mWh":"mAh",n.cycleCount=parseInt("0"+o.getValue(r,"POWER_SUPPLY_CYCLE_COUNT","="),10),n.maxCapacity=Math.round(parseInt("0"+o.getValue(r,"POWER_SUPPLY_CHARGE_FULL","="),10)/1e3/(n.voltage||1)),n.designedCapacity=Math.round(parseInt("0"+o.getValue(r,"POWER_SUPPLY_CHARGE_FULL_DESIGN","="),10)/1e3/(n.voltage||1))|n.maxcapacity,n.currentCapacity=Math.round(parseInt("0"+o.getValue(r,"POWER_SUPPLY_CHARGE_NOW","="),10)/1e3/(n.voltage||1)),n.maxCapacity||(n.maxCapacity=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_FULL","="),10)/1e3,n.designCapacity=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_FULL_DESIGN","="),10)/1e3|n.maxCapacity,n.currentCapacity=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_NOW","="),10)/1e3);const s=o.getValue(r,"POWER_SUPPLY_CAPACITY","="),a=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_NOW","="),10),c=parseInt("0"+o.getValue(r,"POWER_SUPPLY_POWER_NOW","="),10),l=parseInt("0"+o.getValue(r,"POWER_SUPPLY_CURRENT_NOW","="),10);n.percent=parseInt("0"+s,10),n.maxCapacity&&n.currentCapacity&&(n.hasBattery=!0,s||(n.percent=100*n.currentCapacity/n.maxCapacity)),n.isCharging&&(n.hasBattery=!0),a&&c?n.timeRemaining=Math.floor(a/c*60):l&&n.currentCapacity&&(n.timeRemaining=Math.floor(n.currentCapacity/l*60)),n.type=o.getValue(r,"POWER_SUPPLY_TECHNOLOGY","="),n.model=o.getValue(r,"POWER_SUPPLY_MODEL_NAME","="),n.manufacturer=o.getValue(r,"POWER_SUPPLY_MANUFACTURER","="),n.serial=o.getValue(r,"POWER_SUPPLY_SERIAL_NUMBER","="),e&&e(n),t(n)}})):(e&&e(n),t(n))}if((u||p||d)&&r("sysctl hw.acpi.battery hw.acpi.acline",(function(r,i){let s=i.toString().split("\n");const a=parseInt("0"+o.getValue(s,"hw.acpi.battery.units"),10),c=parseInt("0"+o.getValue(s,"hw.acpi.battery.life"),10);n.hasBattery=a>0,n.cycleCount=null,n.isCharging="1"!==o.getValue(s,"hw.acpi.acline"),n.acConnected=n.isCharging,n.maxCapacity=null,n.currentCapacity=null,n.capacityUnit="unknown",n.percent=a?c:null,e&&e(n),t(n)})),c&&r('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %',(function(r,i){if(i){let e=i.toString().replace(/ +/g,"").replace(/"+/g,"").replace(/-/g,"").split("\n");n.cycleCount=parseInt("0"+o.getValue(e,"cyclecount","="),10),n.voltage=parseInt("0"+o.getValue(e,"voltage","="),10)/1e3,n.capacityUnit=n.voltage?"mWh":"mAh",n.maxCapacity=Math.round(parseInt("0"+o.getValue(e,"maxcapacity","="),10)*(n.voltage||1)),n.currentCapacity=Math.round(parseInt("0"+o.getValue(e,"currentcapacity","="),10)*(n.voltage||1)),n.designedCapacity=Math.round(parseInt("0"+o.getValue(e,"DesignCapacity","="),10)*(n.voltage||1)),n.manufacturer="Apple",n.serial=o.getValue(e,"BatterySerialNumber","=");let t=null;let r=o.getValue(e,"internal","Battery").split(";");if(r&&r[0]){let e=r[0].split("\t");e&&e[1]&&(t=parseFloat(e[1].trim().replace(/%/g,"")))}r&&r[1]?(n.isCharging="charging"===r[1].trim(),n.acConnected="discharging"!==r[1].trim()):(n.isCharging="yes"===o.getValue(e,"ischarging","=").toLowerCase(),n.acConnected=n.isCharging),n.maxCapacity&&n.currentCapacity&&(n.hasBattery=!0,n.type="Li-ion",n.percent=null!==t?t:Math.round(100*n.currentCapacity/n.maxCapacity),n.isCharging||(n.timeRemaining=parseInt("0"+o.getValue(e,"TimeRemaining","="),10)))}e&&e(n),t(n)})),f&&(e&&e(n),t(n)),l)try{o.wmic("Path Win32_Battery Get BatteryStatus, DesignCapacity, EstimatedChargeRemaining, DesignVoltage, FullChargeCapacity /value").then((r=>{if(r){let e=r.split("\r\n"),t=o.getValue(e,"BatteryStatus","=").trim();if(t&&"10"!=t){const r=parseInt(t);n.hasBattery=!0,n.maxCapacity=parseInt(o.getValue(e,"DesignCapacity","=")||0),n.designCapacity=parseInt(o.getValue(e,"DesignCapacity","=")||0),n.voltage=parseInt(o.getValue(e,"DesignVoltage","=")||0)/1e3,n.capacityUnit="mWh",n.percent=parseInt(o.getValue(e,"EstimatedChargeRemaining","=")||0),n.currentCapacity=parseInt(n.maxcapacity*n.percent/100),n.isCharging=r>=6&&r<=9||11===r||!(3===r)&&!(1===r)&&n.percent<100,n.acConnected=n.ischarging||2===r}}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}))}))}},7381:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(3129).execSync,o=n(5622),s=n(1453),a=n(5747);let c=process.platform;const l="linux"===c,u="darwin"===c,p="win32"===c,d="freebsd"===c,f="openbsd"===c,h="netbsd"===c,m="sunos"===c;function g(e){let t="";return e.indexOf("keyboard")>=0&&(t="Keyboard"),e.indexOf("mouse")>=0&&(t="Mouse"),e.indexOf("speaker")>=0&&(t="Speaker"),e.indexOf("headset")>=0&&(t="Headset"),e.indexOf("phone")>=0&&(t="Phone"),t}function v(e,t,n){const r={device:null};return r.name=s.getValue(e,"name","="),r.manufacturer=null,r.macDevice=t,r.macHost=n,r.batteryPercent=null,r.type=g(r.name.toLowerCase()),r.connected=!1,r}function y(e,t){const n={},r=((e.device_minorClassOfDevice_string||e.device_majorClassOfDevice_string||"")+(e.device_name||"")).toLowerCase();return n.device=e.device_services||"",n.name=e.device_name||"",n.manufacturer=e.device_manufacturer||"",n.macDevice=(e.device_addr||"").toLowerCase().replace(/-/g,":"),n.macHost=t,n.batteryPercent=e.device_batteryPercent||null,n.type=g(r),n.connected="attrib_Yes"===e.device_isconnected||!1,n}function _(e){const t={device:null};return t.name=s.getValue(e,"name","="),t.manufacturer=s.getValue(e,"manufacturer","="),t.macDevice=null,t.macHost=null,t.batteryPercent=null,t.type=g(t.name.toLowerCase()),t.connected=null,t}t.bluetoothDevices=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(l){const r=s.getFilesInPath("/var/lib/bluetooth/");for(let e=0;e=6?i[i.length-2]:null,c=i.length>=7?i[i.length-3]:null;if("info"===t){const t=a.readFileSync(r[e],{encoding:"utf8"}).split("\n");n.push(v(t,s,c))}}try{const e=i("hcitool con").toString().toLowerCase();for(let t=0;t10&&e.indexOf(n[t].macDevice.toLowerCase())>=0&&(n[t].connected=!0)}catch(e){s.noop()}e&&e(n),t(n)}if(u){r("system_profiler SPBluetoothDataType -json",(function(r,i){if(!r)try{const e=JSON.parse(i.toString());if(e.SPBluetoothDataType&&e.SPBluetoothDataType.length&&e.SPBluetoothDataType[0]&&e.SPBluetoothDataType[0].device_title&&e.SPBluetoothDataType[0].device_title.length){let t=null;e.SPBluetoothDataType[0].local_device_title&&e.SPBluetoothDataType[0].local_device_title.general_address&&(t=e.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g,":"));for(let r=0;r{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(5747),a=n(1453);let c=process.platform;const l="linux"===c,u="darwin"===c,p="win32"===c,d="freebsd"===c,f="openbsd"===c,h="netbsd"===c,m="sunos"===c;let g=0,v={user:0,nice:0,system:0,idle:0,irq:0,load:0,tick:0,ms:0,currentLoad:0,currentLoadUser:0,currentLoadSystem:0,currentLoadNice:0,currentLoadIdle:0,currentLoadIrq:0,rawCurrentLoad:0,rawCurrentLoadUser:0,rawCurrentLoadSystem:0,rawCurrentLoadNice:0,rawCurrentLoadIdle:0,rawCurrentLoadIrq:0},y=[],_=0;const E={8346:"1.8",8347:"1.9",8350:"2.0",8354:"2.2","8356|SE":"2.4",8356:"2.3",8360:"2.5",2372:"2.1",2373:"2.1",2374:"2.2",2376:"2.3",2377:"2.3",2378:"2.4",2379:"2.4",2380:"2.5",2381:"2.5",2382:"2.6",2384:"2.7",2386:"2.8",2387:"2.8",2389:"2.9",2393:"3.1",8374:"2.2",8376:"2.3",8378:"2.4",8379:"2.4",8380:"2.5",8381:"2.5",8382:"2.6",8384:"2.7",8386:"2.8",8387:"2.8",8389:"2.9",8393:"3.1","2419EE":"1.8","2423HE":"2.0","2425HE":"2.1",2427:"2.2",2431:"2.4",2435:"2.6","2439SE":"2.8","8425HE":"2.1",8431:"2.4",8435:"2.6","8439SE":"2.8",4122:"2.2",4130:"2.6","4162EE":"1.7","4164EE":"1.8","4170HE":"2.1","4174HE":"2.3","4176HE":"2.4",4180:"2.6",4184:"2.8","6124HE":"1.8","6128HE":"2.0","6132HE":"2.2",6128:"2.0",6134:"2.3",6136:"2.4",6140:"2.6","6164HE":"1.7","6166HE":"1.8",6168:"1.9",6172:"2.1",6174:"2.2",6176:"2.3","6176SE":"2.3","6180SE":"2.5",3250:"2.5",3260:"2.7",3280:"2.4",4226:"2.7",4228:"2.8",4230:"2.9",4234:"3.1",4238:"3.3",4240:"3.4",4256:"1.6",4274:"2.5",4276:"2.6",4280:"2.8",4284:"3.0",6204:"3.3",6212:"2.6",6220:"3.0",6234:"2.4",6238:"2.6","6262HE":"1.6",6272:"2.1",6274:"2.2",6276:"2.3",6278:"2.4","6282SE":"2.6","6284SE":"2.7",6308:"3.5",6320:"2.8",6328:"3.2","6338P":"2.3",6344:"2.6",6348:"2.8",6366:"1.8","6370P":"2.0",6376:"2.3",6378:"2.4",6380:"2.5",6386:"2.8","FX|4100":"3.6","FX|4120":"3.9","FX|4130":"3.8","FX|4150":"3.8","FX|4170":"4.2","FX|6100":"3.3","FX|6120":"3.6","FX|6130":"3.6","FX|6200":"3.8","FX|8100":"2.8","FX|8120":"3.1","FX|8140":"3.2","FX|8150":"3.6","FX|8170":"3.9","FX|4300":"3.8","FX|4320":"4.0","FX|4350":"4.2","FX|6300":"3.5","FX|6350":"3.9","FX|8300":"3.3","FX|8310":"3.4","FX|8320":"3.5","FX|8350":"4.0","FX|8370":"4.0","FX|9370":"4.4","FX|9590":"4.7","FX|8320E":"3.2","FX|8370E":"3.3",1200:"3.1","Pro 1200":"3.1","1300X":"3.5","Pro 1300":"3.5",1400:"3.2","1500X":"3.5","Pro 1500":"3.5",1600:"3.2","1600X":"3.6","Pro 1600":"3.2",1700:"3.0","Pro 1700":"3.0","1700X":"3.4","Pro 1700X":"3.4","1800X":"3.6","1900X":"3.8",1920:"3.2","1920X":"3.5","1950X":"3.4","200GE":"3.2","Pro 200GE":"3.2","220GE":"3.4","240GE":"3.5","3000G":"3.5","300GE":"3.4","3050GE":"3.4","2200G":"3.5","Pro 2200G":"3.5","2200GE":"3.2","Pro 2200GE":"3.2","2400G":"3.6","Pro 2400G":"3.6","2400GE":"3.2","Pro 2400GE":"3.2","Pro 200U":"2.3","300U":"2.4","2200U":"2.5","3200U":"2.6","2300U":"2.0","Pro 2300U":"2.0","2500U":"2.0","Pro 2500U":"2.2","2600H":"3.2","2700U":"2.0","Pro 2700U":"2.2","2800H":"3.3",7351:"2.4","7351P":"2.4",7401:"2.0","7401P":"2.0","7551P":"2.0",7551:"2.0",7251:"2.1",7261:"2.5",7281:"2.1",7301:"2.2",7371:"3.1",7451:"2.3",7501:"2.0",7571:"2.2",7601:"2.2",V1500B:"2.2",V1780B:"3.35",V1202B:"2.3",V1404I:"2.0",V1605B:"2.0",V1756B:"3.25",V1807B:"3.35",3101:"2.1",3151:"2.7",3201:"1.5",3251:"2.5",3255:"2.5",3301:"2.0",3351:"1.9",3401:"1.85",3451:"2.15","1200|AF":"3.1","2300X":"3.5","2500X":"3.6",2600:"3.4","2600E":"3.1","1600|AF":"3.2","2600X":"3.6",2700:"3.2","2700E":"2.8","Pro 2700":"3.2","2700X":"3.7","Pro 2700X":"3.6","2920X":"3.5","2950X":"3.5","2970WX":"3.0","2990WX":"3.0","Pro 300GE":"3.4","Pro 3125GE":"3.4","3150G":"3.5","Pro 3150G":"3.5","3150GE":"3.3","Pro 3150GE":"3.3","3200G":"3.6","Pro 3200G":"3.6","3200GE":"3.3","Pro 3200GE":"3.3","3350G":"3.6","Pro 3350G":"3.6","3350GE":"3.3","Pro 3350GE":"3.3","3400G":"3.7","Pro 3400G":"3.7","3400GE":"3.3","Pro 3400GE":"3.3","3300U":"2.1","PRO 3300U":"2.1","3450U":"2.1","3500U":"2.1","PRO 3500U":"2.1","3500C":"2.1","3550H":"2.1","3580U":"2.1","3700U":"2.3","PRO 3700U":"2.3","3700C":"2.3","3750H":"2.3","3780U":"2.3",3100:"3.6","3300X":"3.8",3500:"3.6","3500X":"3.6",3600:"3.6","Pro 3600":"3.6","3600X":"3.8","3600XT":"3.8","Pro 3700":"3.6","3700X":"3.6","3800X":"3.9","3800XT":"3.9",3900:"3.1","Pro 3900":"3.1","3900X":"3.8","3900XT":"3.8","3950X":"3.5","3960X":"3.8","3970X":"3.7","3990X":"2.9","3945WX":"4.0","3955WX":"3.9","3975WX":"3.5","3995WX":"2.7","4300GE":"3.5","Pro 4300GE":"3.5","4300G":"3.8","Pro 4300G":"3.8","4600GE":"3.3","Pro 4650GE":"3.3","4600G":"3.7","Pro 4650G":"3.7","4700GE":"3.1","Pro 4750GE":"3.1","4700G":"3.6","Pro 4750G":"3.6","4300U":"2.7","Pro 4450U":"2.5","4500U":"2.3","4600U":"2.1","PRO 4650U":"2.1","4600HS":"3.0","4600H":"3.0","4700U":"2.0","PRO 4750U":"1.7","4800U":"1.8","4800HS":"2.9","4800H":"2.9","4900HS":"3.0","4900H":"3.3","7232P":"3.1","7302P":"3.0","7402P":"2.8","7502P":"2.5","7702P":"2.0",7252:"3.1",7262:"3.2",7272:"2.9",7282:"2.8",7302:"3.0",7352:"2.3",7402:"2.8",7452:"2.35",7502:"2.5",7532:"2.4",7542:"2.9",7552:"2.2",7642:"2.3",7662:"2.0",7702:"2.0",7742:"2.25","7H12":"2.6","7F32":"3.7","7F52":"3.5","7F72":"3.2","5600X":"3.7","5800X":"3.8","5900X":"3.7","5950X":"3.4"},b={1:"Other",2:"Unknown",3:"Daughter Board",4:"ZIF Socket",5:"Replacement/Piggy Back",6:"None",7:"LIF Socket",8:"Slot 1",9:"Slot 2",10:"370 Pin Socket",11:"Slot A",12:"Slot M",13:"423",14:"A (Socket 462)",15:"478",16:"754",17:"940",18:"939",19:"mPGA604",20:"LGA771",21:"LGA775",22:"S1",23:"AM2",24:"F (1207)",25:"LGA1366",26:"G34",27:"AM3",28:"C32",29:"LGA1156",30:"LGA1567",31:"PGA988A",32:"BGA1288",33:"rPGA988B",34:"BGA1023",35:"BGA1224",36:"LGA1155",37:"LGA1356",38:"LGA2011",39:"FS1",40:"FS2",41:"FM1",42:"FM2",43:"LGA2011-3",44:"LGA1356-3",45:"LGA1150",46:"BGA1168",47:"BGA1234",48:"BGA1364",49:"AM4",50:"LGA1151",51:"BGA1356",52:"BGA1440",53:"BGA1515",54:"LGA3647-1",55:"SP3",56:"SP3r2",57:"LGA2066",58:"BGA1392",59:"BGA1510",60:"BGA1528",61:"LGA4189",62:"LGA1200"};function w(e){e.brand=e.brand.replace(/\(R\)+/g,"®").replace(/\s+/g," ").trim(),e.brand=e.brand.replace(/\(TM\)+/g,"™").replace(/\s+/g," ").trim(),e.brand=e.brand.replace(/\(C\)+/g,"©").replace(/\s+/g," ").trim(),e.brand=e.brand.replace(/CPU+/g,"").replace(/\s+/g," ").trim(),e.manufacturer=e.brand.split(" ")[0];let t=e.brand.split(" ");return t.shift(),e.brand=t.join(" "),e}function S(e){let t="0";for(let n in E)if({}.hasOwnProperty.call(E,n)){let r=n.split("|"),i=0;r.forEach((t=>{e.indexOf(t)>-1&&i++})),i===r.length&&(t=E[n])}return parseFloat(t)}function I(){let e=r.cpus(),t=999999999,n=0,i=0,o=[];if(e&&e.length){for(let r in e)if({}.hasOwnProperty.call(e,r)){let s=e[r].speed>100?(e[r].speed+1)/1e3:e[r].speed/10;i+=s,s>n&&(n=s),s{process.nextTick((()=>{let n="";if(p)try{i('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet',a.execOptsWin,(function(r,i){if(!r){let e=i.split("0x").pop().trim(),t=parseInt(e,16).toString(2),r="0".repeat(32-t.length)+t,o=["fpu","vme","de","pse","tsc","msr","pae","mce","cx8","apic","","sep","mtrr","pge","mca","cmov","pat","pse-36","psn","clfsh","","ds","acpi","mmx","fxsr","sse","sse2","ss","htt","tm","ia64","pbe"];for(let e=0;e/dev/null; unset LC_ALL",(function(r,i){let o=[];if(!r){let e=i.toString().split("\tFlags:");(e.length>1?e[1].split("\tVersion:")[0].split["\n"]:[]).forEach((function(e){let t=(e.indexOf("(")?e.split("(")[0].toLowerCase():"").trim().replace(/\t/g,"");t&&o.push(t)}))}n=o.join(" ").trim().toLowerCase(),e&&e(n),t(n)})),u&&i("sysctl machdep.cpu.features",(function(r,i){if(!r){let e=i.toString().split("\n");e.length>0&&-1!==e[0].indexOf("machdep.cpu.features:")&&(n=e[0].split(":")[1].trim().toLowerCase())}e&&e(n),t(n)})),m&&(e&&e(n),t(n))}))}))}function x(e){return new Promise((t=>{process.nextTick((()=>{let n={l1d:null,l1i:null,l2:null,l3:null};if(l)try{i("export LC_ALL=C; lscpu; unset LC_ALL",(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){let t=e.split(":");-1!==t[0].toUpperCase().indexOf("L1D CACHE")&&(n.l1d=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toUpperCase().indexOf("L1I CACHE")&&(n.l1i=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toUpperCase().indexOf("L2 CACHE")&&(n.l2=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toUpperCase().indexOf("L3 CACHE")&&(n.l3=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1))}))}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}if((d||f||h)&&i("export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL",(function(r,i){let o=[];if(!r){o=i.toString().split("Cache Information"),o.shift()}for(let e=0;e1?i[1]:"kb";s*="kb"===c?1024:"mb"===c?1048576:"gb"===c?1073741824:1,r&&("l1"===r?(n.cache[r+"d"]=s/2,n.cache[r+"i"]=s/2):n.cache[r]=s)}e&&e(n),t(n)})),u&&i("sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize",(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){let t=e.split(":");-1!==t[0].toLowerCase().indexOf("hw.l1icachesize")&&(n.l1d=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toLowerCase().indexOf("hw.l1dcachesize")&&(n.l1i=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toLowerCase().indexOf("hw.l2cachesize")&&(n.l2=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toLowerCase().indexOf("hw.l3cachesize")&&(n.l3=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1))}))}e&&e(n),t(n)})),m&&(e&&e(n),t(n)),p)try{a.wmic("cpu get l2cachesize, l3cachesize /value").then(((r,i)=>{if(!i){let e=r.split("\r\n");n.l1d=0,n.l1i=0,n.l2=a.getValue(e,"l2cachesize","="),n.l3=a.getValue(e,"l3cachesize","="),n.l2&&(n.l2=1024*parseInt(n.l2,10)),n.l3&&(n.l3=1024*parseInt(n.l3,10))}a.wmic("path Win32_CacheMemory get CacheType,InstalledSize,Purpose").then(((r,i)=>{if(!i){r.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(e){""!==e&&("L1 Cache"===(e=e.trim().split(/\s\s+/))[2]&&"3"===e[0]&&(n.l1i=parseInt(e[1],10)),"L1 Cache"===e[2]&&"4"===e[0]&&(n.l1d=parseInt(e[1],10)))}))}e&&e(n),t(n)}))}))}catch(r){e&&e(n),t(n)}}))}))}t.cpu=function(e){return new Promise((t=>{process.nextTick((()=>{new Promise((e=>{process.nextTick((()=>{const t="unknown";let n={manufacturer:t,brand:t,vendor:"",family:"",model:"",stepping:"",revision:"",voltage:"",speed:0,speedMin:0,speedMax:0,governor:"",cores:a.cores(),physicalCores:a.cores(),processors:1,socket:"",flags:"",virtualization:!1,cache:{}};C().then((t=>{if(n.flags=t,n.virtualization=t.indexOf("vmx")>-1||t.indexOf("svm")>-1,p)try{const e=o("systeminfo",a.execOptsWin).toString();n.virtualization=n.virtualization||-1!==e.indexOf("Virtualization Enabled In Firmware: Yes")||-1!==e.indexOf("Virtualisierung in Firmware aktiviert: Ja")||-1!==e.indexOf("Virtualisation activée dans le microprogramme : Qiu")}catch(e){a.noop()}if(u&&i("sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily",(function(t,i){let s=i.toString().split("\n");const c=a.getValue(s,"machdep.cpu.brand_string").split("@");n.brand=c[0].trim();const l=c[1]?c[1].trim():"0";n.speed=parseFloat(l.replace(/GHz+/g,""));let u=a.getValue(s,"hw.tbfrequency")/1e9;u=u<.1?100*u:u,n.speed=0===n.speed?u:n.speed,g=n.speed,n=w(n),n.speedMin=a.getValue(s,"hw.cpufrequency_min")?a.getValue(s,"hw.cpufrequency_min")/1e9:n.speed,n.speedMax=a.getValue(s,"hw.cpufrequency_max")?a.getValue(s,"hw.cpufrequency_max")/1e9:n.speed,n.vendor=a.getValue(s,"machdep.cpu.vendor")||"Apple",n.family=a.getValue(s,"machdep.cpu.family")||a.getValue(s,"hw.cpufamily"),n.model=a.getValue(s,"machdep.cpu.model"),n.stepping=a.getValue(s,"machdep.cpu.stepping")||a.getValue(s,"hw.cpusubfamily");const p=a.getValue(s,"hw.packages"),d=a.getValue(s,"hw.physicalcpu_max"),f=a.getValue(s,"hw.ncpu");if("arm64"===r.arch()){const e=o("ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type").toString().split("\n"),t=e.filter((e=>e.indexOf('"E"')>=0)).length,r=e.filter((e=>e.indexOf('"P"')>=0)).length;n.socket="SOC",n.efficiencyCores=t,n.performanceCores=r}p&&(n.processors=parseInt(p)||1),d&&f&&(n.cores=parseInt(f)||a.cores(),n.physicalCores=parseInt(d)||a.cores()),x().then((t=>{n.cache=t,e(n)}))})),l){let t="",o=[];r.cpus()[0]&&r.cpus()[0].model&&(t=r.cpus()[0].model),i('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL',(function(r,c){r||(o=c.toString().split("\n")),t=a.getValue(o,"model name")||t;const l=t.split("@");if(n.brand=l[0].trim(),n.speed=l[1]?parseFloat(l[1].trim()):0,0===n.speed&&(n.brand.indexOf("AMD")>-1||n.brand.toLowerCase().indexOf("ryzen")>-1)&&(n.speed=S(n.brand)),0===n.speed){const e=I();0!==e.avg&&(n.speed=e.avg)}g=n.speed,n.speedMin=Math.round(parseFloat(a.getValue(o,"cpu min mhz").replace(/,/g,"."))/10)/100,n.speedMax=Math.round(parseFloat(a.getValue(o,"cpu max mhz").replace(/,/g,"."))/10)/100,n=w(n),n.vendor=a.getValue(o,"vendor id"),n.family=a.getValue(o,"cpu family"),n.model=a.getValue(o,"model:"),n.stepping=a.getValue(o,"stepping"),n.revision=a.getValue(o,"cpu revision"),n.cache.l1d=a.getValue(o,"l1d cache"),n.cache.l1d&&(n.cache.l1d=parseInt(n.cache.l1d)*(-1!==n.cache.l1d.indexOf("K")?1024:1)),n.cache.l1i=a.getValue(o,"l1i cache"),n.cache.l1i&&(n.cache.l1i=parseInt(n.cache.l1i)*(-1!==n.cache.l1i.indexOf("K")?1024:1)),n.cache.l2=a.getValue(o,"l2 cache"),n.cache.l2&&(n.cache.l2=parseInt(n.cache.l2)*(-1!==n.cache.l2.indexOf("K")?1024:1)),n.cache.l3=a.getValue(o,"l3 cache"),n.cache.l3&&(n.cache.l3=parseInt(n.cache.l3)*(-1!==n.cache.l3.indexOf("K")?1024:1));const u=a.getValue(o,"thread(s) per core")||"1",p=a.getValue(o,"socket(s)")||"1";let d=parseInt(u,10),f=parseInt(p,10);if(n.physicalCores=n.cores/d,n.processors=f,n.governor=a.getValue(o,"governor")||"","ARM"===n.vendor){const e=s.readFileSync("/proc/cpuinfo").toString().split("\n"),t=a.decodePiCpuinfo(e);t.model.toLowerCase().indexOf("raspberry")>=0&&(n.family=n.manufacturer,n.manufacturer=t.manufacturer,n.brand=t.processor,n.revision=t.revisionCode,n.socket="SOC")}let h=[];i('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL',(function(t,r){h=r.toString().split("\n"),h&&h.length&&(n.socket=a.getValue(h,"Upgrade").replace("Socket","").trim()||n.socket),e(n)}))}))}if(d||f||h){let t="",o=[];r.cpus()[0]&&r.cpus()[0].model&&(t=r.cpus()[0].model),i("export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL",(function(r,i){let s=[];if(!r){const e=i.toString().split("# dmidecode"),t=e.length>1?e[1]:"";s=e.length>2?e[2].split("Cache Information"):[],o=t.split("\n")}if(n.brand=t.split("@")[0].trim(),n.speed=t.split("@")[1]?parseFloat(t.split("@")[1].trim()):0,0===n.speed&&(n.brand.indexOf("AMD")>-1||n.brand.toLowerCase().indexOf("ryzen")>-1)&&(n.speed=S(n.brand)),0===n.speed){const e=I();0!==e.avg&&(n.speed=e.avg)}g=n.speed,n.speedMin=n.speed,n.speedMax=Math.round(parseFloat(a.getValue(o,"max speed").replace(/Mhz/g,""))/10)/100,n=w(n),n.vendor=a.getValue(o,"manufacturer");let c=a.getValue(o,"signature");c=c.split(",");for(var l=0;l1?r[1]:"kb";i*="kb"===c?1024:"mb"===c?1048576:"gb"===c?1073741824:1,t&&("l1"===t?(n.cache[t+"d"]=i/2,n.cache[t+"i"]=i/2):n.cache[t]=i)}n.socket=a.getValue(o,"Upgrade").replace("Socket","").trim();const p=a.getValue(o,"thread count").trim(),d=a.getValue(o,"core count").trim();d&&p&&(n.cores=p,n.physicalCores=d),e(n)}))}if(m&&e(n),p)try{const t=[];t.push(a.wmic("cpu get /value")),t.push(a.wmic("path Win32_CacheMemory get CacheType,InstalledSize,Purpose")),Promise.all(t).then((t=>{let r=t[0].split("\r\n"),i=a.getValue(r,"name","=")||"";i.indexOf("@")>=0?(n.brand=i.split("@")[0].trim(),n.speed=i.split("@")[1]?parseFloat(i.split("@")[1].trim()):0,g=n.speed):(n.brand=i.trim(),n.speed=0),n=w(n),n.revision=a.getValue(r,"revision","="),n.cache.l1d=0,n.cache.l1i=0,n.cache.l2=a.getValue(r,"l2cachesize","="),n.cache.l3=a.getValue(r,"l3cachesize","="),n.cache.l2&&(n.cache.l2=1024*parseInt(n.cache.l2,10)),n.cache.l3&&(n.cache.l3=1024*parseInt(n.cache.l3,10)),n.vendor=a.getValue(r,"manufacturer","="),n.speedMax=Math.round(parseFloat(a.getValue(r,"maxclockspeed","=").replace(/,/g,"."))/10)/100,0===n.speed&&(n.brand.indexOf("AMD")>-1||n.brand.toLowerCase().indexOf("ryzen")>-1)&&(n.speed=S(n.brand)),0===n.speed&&(n.speed=n.speedMax),n.speedMin=n.speed;let o=a.getValue(r,"description","=").split(" ");for(let e=0;e1&&(n.cores=n.cores*c,n.physicalCores=n.physicalCores*c),r=t[1].split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)),r.forEach((function(e){""!==e&&("L1 Cache"===(e=e.trim().split(/\s\s+/))[2]&&"3"===e[0]&&(n.cache.l1i=parseInt(e[1],10)),"L1 Cache"===e[2]&&"4"===e[0]&&(n.cache.l1d=parseInt(e[1],10)))})),e(n)}))}catch(t){e(n)}}))}))})).then((n=>{e&&e(n),t(n)}))}))}))},t.cpuCurrentSpeed=function(e){return new Promise((t=>{process.nextTick((()=>{let n=I();if(0===n.avg&&0!==g){const e=parseFloat(g);n={min:e,max:e,avg:e,cores:[]}}e&&e(n),t(n)}))}))},t.cpuTemperature=function(e){return new Promise((t=>{process.nextTick((()=>{let r={main:null,cores:[],max:null,socket:[],chipset:null};if(l){try{const e=o('cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;').toString().split("-----\n");if(2===e.length){const t=e[0].split("\n"),n=e[1].split("\n");for(let e=0;e{const t=e.split("___"),n=t[0],i=t.length>1&&t[1]?t[1]:"0";i&&(void 0===n||n&&n.toLowerCase().startsWith("core"))?r.cores.push(Math.round(parseInt(i,10)/100)/10):i&&n&&null===r.main&&(r.main=Math.round(parseInt(i,10)/100)/10)})),r.cores.length>0){null===r.main&&(r.main=Math.round(r.cores.reduce(((e,t)=>e+t),0)/r.cores.length));let e=Math.max.apply(Math,r.cores);r.max=e>r.main?e:r.main}if(null!==r.main)return null===r.max&&(r.max=r.main),e&&e(r),void t(r);i("sensors",(function(n,o){if(!n){let n=o.toString().split("\n"),i=null,s=!0,a="";if(n.forEach((function(e){""===e.trim()?s=!0:s&&(e.trim().toLowerCase().startsWith("acpi")&&(a="acpi"),e.trim().toLowerCase().startsWith("pch")&&(a="pch"),e.trim().toLowerCase().startsWith("core")&&(a="core"),s=!1);let t=e.match(/[+-]([^°]*)/g),n=e.split(":")[0].toUpperCase();"acpi"===a?-1!==n.indexOf("TEMP")&&r.socket.push(parseFloat(t)):"pch"===a&&-1!==n.indexOf("TEMP")&&(r.chipset=parseFloat(t)),-1===n.indexOf("PHYSICAL")&&-1===n.indexOf("PACKAGE")||(r.main=parseFloat(t)),-1!==n.indexOf("CORE ")&&r.cores.push(parseFloat(t)),-1!==n.indexOf("TDIE")&&null===i&&(i=parseFloat(t))})),r.cores.length>0){null===r.main&&(r.main=Math.round(r.cores.reduce(((e,t)=>e+t),0)/r.cores.length));let e=Math.max.apply(Math,r.cores);r.max=e>r.main?e:r.main}else null===r.main&&null!==i&&(r.main=i,r.max=i);if(null!==r.main||null!==r.max)return e&&e(r),void t(r)}s.stat("/sys/class/thermal/thermal_zone0/temp",(function(n){null===n?s.readFile("/sys/class/thermal/thermal_zone0/temp",(function(n,i){if(!n){let e=i.toString().split("\n");e.length>0&&(r.main=parseFloat(e[0])/1e3,r.max=r.main)}e&&e(r),t(r)})):i("/opt/vc/bin/vcgencmd measure_temp",(function(n,i){if(!n){let e=i.toString().split("\n");e.length>0&&e[0].indexOf("=")&&(r.main=parseFloat(e[0].split("=")[1]),r.max=r.main)}e&&e(r),t(r)}))}))}))}))}catch(n){e&&e(r),t(r)}}if((d||f||h)&&i("sysctl dev.cpu | grep temp",(function(n,i){if(!n){let e=i.toString().split("\n"),t=0;e.forEach((function(e){const n=e.split(":");if(n.length>1){const e=parseFloat(n[1].replace(",","."));e>r.max&&(r.max=e),t+=e,r.cores.push(e)}})),r.cores.length&&(r.main=Math.round(t/r.cores.length*100)/100)}e&&e(r),t(r)})),u){let i=null;try{i=n(Object(function(){var e=new Error("Cannot find module 'osx-temperature-sensor'");throw e.code="MODULE_NOT_FOUND",e}()))}catch(e){i=null}i&&(r=i.cpuTemperature()),e&&e(r),t(r)}if(m&&(e&&e(r),t(r)),p)try{a.wmic("/namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature").then(((n,i)=>{if(!i){let e=0;n.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(t){let n=(parseInt(t,10)-2732)/10;e+=n,n>r.max&&(r.max=n),r.cores.push(n)})),r.cores.length&&(r.main=e/r.cores.length)}e&&e(r),t(r)}))}catch(n){e&&e(r),t(r)}}))}))},t.cpuFlags=C,t.cpuCache=x,t.currentLoad=function(e){return new Promise((t=>{process.nextTick((()=>{new Promise((e=>{process.nextTick((()=>{let t=r.loadavg().map((function(e){return e/a.cores()})),n=parseFloat(Math.max.apply(Math,t).toFixed(2)),i={};if(Date.now()-v.ms>=200){v.ms=Date.now();const e=r.cpus();let t=0,o=0,s=0,a=0,c=0,l=[];_=e&&e.length?e.length:0;for(let n=0;n<_;n++){const r=e[n].times;t+=r.user,o+=r.sys,s+=r.nice,c+=r.idle,a+=r.irq;let i=y&&y[n]&&y[n].totalTick?y[n].totalTick:0,u=y&&y[n]&&y[n].totalLoad?y[n].totalLoad:0,p=y&&y[n]&&y[n].user?y[n].user:0,d=y&&y[n]&&y[n].sys?y[n].sys:0,f=y&&y[n]&&y[n].nice?y[n].nice:0,h=y&&y[n]&&y[n].idle?y[n].idle:0,m=y&&y[n]&&y[n].irq?y[n].irq:0;y[n]=r,y[n].totalTick=y[n].user+y[n].sys+y[n].nice+y[n].irq+y[n].idle,y[n].totalLoad=y[n].user+y[n].sys+y[n].nice+y[n].irq,y[n].currentTick=y[n].totalTick-i,y[n].load=y[n].totalLoad-u,y[n].loadUser=y[n].user-p,y[n].loadSystem=y[n].sys-d,y[n].loadNice=y[n].nice-f,y[n].loadIdle=y[n].idle-h,y[n].loadIrq=y[n].irq-m,l[n]={},l[n].load=y[n].load/y[n].currentTick*100,l[n].loadUser=y[n].loadUser/y[n].currentTick*100,l[n].loadSystem=y[n].loadSystem/y[n].currentTick*100,l[n].loadNice=y[n].loadNice/y[n].currentTick*100,l[n].loadIdle=y[n].loadIdle/y[n].currentTick*100,l[n].loadIrq=y[n].loadIrq/y[n].currentTick*100,l[n].rawLoad=y[n].load,l[n].rawLoadUser=y[n].loadUser,l[n].rawLoadSystem=y[n].loadSystem,l[n].rawLoadNice=y[n].loadNice,l[n].rawLoadIdle=y[n].loadIdle,l[n].rawLoadIrq=y[n].loadIrq}let u=t+o+s+a+c,p=t+o+s+a,d=u-v.tick;i={avgLoad:n,currentLoad:(p-v.load)/d*100,currentLoadUser:(t-v.user)/d*100,currentLoadSystem:(o-v.system)/d*100,currentLoadNice:(s-v.nice)/d*100,currentLoadIdle:(c-v.idle)/d*100,currentLoadIrq:(a-v.irq)/d*100,rawCurrentLoad:p-v.load,rawCurrentLoadUser:t-v.user,rawCurrentLoadSystem:o-v.system,rawCurrentLoadNice:s-v.nice,rawCurrentLoadIdle:c-v.idle,rawCurrentLoadIrq:a-v.irq,cpus:l},v={user:t,nice:s,system:o,idle:c,irq:a,tick:u,load:p,ms:v.ms,currentLoad:i.currentLoad,currentLoadUser:i.currentLoadUser,currentLoadSystem:i.currentLoadSystem,currentLoadNice:i.currentLoadNice,currentLoadIdle:i.currentLoadIdle,currentLoadIrq:i.currentLoadIrq,rawCurrentLoad:i.rawCurrentLoad,rawCurrentLoadUser:i.rawCurrentLoadUser,rawCurrentLoadSystem:i.rawCurrentLoadSystem,rawCurrentLoadNice:i.rawCurrentLoadNice,rawCurrentLoadIdle:i.rawCurrentLoadIdle,rawCurrentLoadIrq:i.rawCurrentLoadIrq}}else{let e=[];for(let t=0;t<_;t++)e[t]={},e[t].load=y[t].load/y[t].currentTick*100,e[t].loadUser=y[t].loadUser/y[t].currentTick*100,e[t].loadSystem=y[t].loadSystem/y[t].currentTick*100,e[t].loadNice=y[t].loadNice/y[t].currentTick*100,e[t].loadIdle=y[t].loadIdle/y[t].currentTick*100,e[t].loadIrq=y[t].loadIrq/y[t].currentTick*100,e[t].rawLoad=y[t].load,e[t].rawLoadUser=y[t].loadUser,e[t].rawLoadSystem=y[t].loadSystem,e[t].rawLoadNice=y[t].loadNice,e[t].rawLoadIdle=y[t].loadIdle,e[t].rawLoadIrq=y[t].loadIrq;i={avgLoad:n,currentload:v.currentload,currentloadUser:v.currentloadUser,currentloadSystem:v.currentloadSystem,currentloadNice:v.currentloadNice,currentloadIdle:v.currentloadIdle,currentloadIrq:v.currentloadIrq,rawCurrentload:v.rawCurrentload,rawCurrentloadUser:v.rawCurrentloadUser,rawCurrentloadSystem:v.rawCurrentloadSystem,rawCurrentloadNice:v.rawCurrentloadNice,rawCurrentloadIdle:v.rawCurrentloadIdle,rawCurrentloadIrq:v.rawCurrentloadIrq,cpus:e}}e(i)}))})).then((n=>{e&&e(n),t(n)}))}))}))},t.fullLoad=function(e){return new Promise((t=>{process.nextTick((()=>{new Promise((e=>{process.nextTick((()=>{const t=r.cpus();let n=0,i=0,o=0,s=0,a=0,c=0;if(t&&t.length){for(let e=0,r=t.length;e{e&&e(n),t(n)}))}))}))}},8725:(e,t,n)=>{"use strict";const r=n(1453),i=n(3568);const o="win32"===process.platform;let s,a={},c=0;function l(e,t){function n(e,t){return e.filter((e=>e.Id&&e.Id===t)).length>0}r.isFunction(e)&&!t&&(t=e,e=!1),"string"==typeof e&&"true"===e&&(e=!0),"boolean"!=typeof e&&void 0!==e&&(e=!1),e=e||!1;let o=[];return new Promise((c=>{process.nextTick((()=>{s||(s=new i);const l=[];s.listContainers(e,(e=>{let u={};try{if(u=e,u&&"[object Array]"===Object.prototype.toString.call(u)&&u.length>0){for(let e in a)({}).hasOwnProperty.call(a,e)&&(n(u,e)||delete a[e]);u.forEach((function(e){var t,n;e.Names&&"[object Array]"===Object.prototype.toString.call(e.Names)&&e.Names.length>0&&(e.Name=e.Names[0].replace(/^\/|\/$/g,"")),l.push((t=e.Id.trim(),n=e,new Promise((e=>{process.nextTick((()=>{"string"!=typeof(t=t||"")&&e();const o=(r.isPrototypePolluted()?"":r.sanitizeShellString(t,!0)).trim();o?(s||(s=new i),s.getInspect(o.trim(),(t=>{try{e({id:n.Id,name:n.Name,image:n.Image,imageID:n.ImageID,command:n.Command,created:n.Created,started:t.State&&t.State.StartedAt?Math.round(new Date(t.State.StartedAt).getTime()/1e3):0,finished:t.State&&t.State.FinishedAt&&!t.State.FinishedAt.startsWith("0001-01-01")?Math.round(new Date(t.State.FinishedAt).getTime()/1e3):0,createdAt:t.Created?t.Created:"",startedAt:t.State&&t.State.StartedAt?t.State.StartedAt:"",finishedAt:t.State&&t.State.FinishedAt&&!t.State.FinishedAt.startsWith("0001-01-01")?t.State.FinishedAt:"",state:n.State,restartCount:t.RestartCount||0,platform:t.Platform||"",driver:t.Driver||"",ports:n.Ports,mounts:n.Mounts})}catch(t){e()}}))):e()}))}))))})),l.length?Promise.all(l).then((e=>{t&&t(e),c(e)})):(t&&t(o),c(o))}else t&&t(o),c(o)}catch(e){for(let e in a)({}).hasOwnProperty.call(a,e)&&(n(u,e)||delete a[e]);t&&t(o),c(o)}}))}))}))}function u(e,t){let n=[];return new Promise((i=>{process.nextTick((()=>{if(r.isFunction(e)&&!t)t=e,n=["*"];else{if("string"!=typeof(e=e||"*"))return t&&t([]),i([]);let o="";if(o.__proto__.toLowerCase=r.stringToLower,o.__proto__.replace=r.stringReplace,o.__proto__.trim=r.stringTrim,o=e,o=o.trim(),"*"!==o){o="";const t=(r.isPrototypePolluted()?"":r.sanitizeShellString(e,!0)).trim();for(let e=0;e<=r.mathMin(t.length,2e3);e++)if(void 0!==t[e]){t[e].__proto__.toLowerCase=r.stringToLower;const n=t[e].toLowerCase();n&&n[0]&&!n[1]&&(o+=n[0])}}o=o.trim().toLowerCase().replace(/,+/g,"|"),n=o.split("|")}const o=[],s=[];if(n.length&&"*"===n[0].trim())n=[],l().then((e=>{for(let t of e)n.push(t.id);n.length?u(n.join(",")).then((e=>{t&&t(e),i(e)})):(t&&t(o),i(o))}));else{for(let e of n)s.push(p(e.trim()));s.length?Promise.all(s).then((e=>{t&&t(e),i(e)})):(t&&t(o),i(o))}}))}))}function p(e){let t={id:e=e||"",memUsage:0,memLimit:0,memPercent:0,cpuPercent:0,pids:0,netIO:{rx:0,wx:0},blockIO:{r:0,w:0}};return new Promise((n=>{process.nextTick((()=>{e?(s||(s=new i),s.getInspect(e,(i=>{try{s.getStats(e,(e=>{try{let n=e;n.message||(t.memUsage=n.memory_stats&&n.memory_stats.usage?n.memory_stats.usage:0,t.memLimit=n.memory_stats&&n.memory_stats.limit?n.memory_stats.limit:0,t.memPercent=n.memory_stats&&n.memory_stats.usage&&n.memory_stats.limit?n.memory_stats.usage/n.memory_stats.limit*100:0,t.cpuPercent=n.cpu_stats&&n.precpu_stats?function(e,t){if(o){let n=r.nanoSeconds(),i=0;if(c>0){let r=n-c,o=e.cpu_usage.total_usage-t.cpu_usage.total_usage;r>0&&(i=100*o/r)}return c=n,i}{let n=0,r=e.cpu_usage.total_usage-t.cpu_usage.total_usage,i=e.system_cpu_usage-t.system_cpu_usage;return i>0&&r>0&&(n=r/i*e.cpu_usage.percpu_usage.length*100),n}}(n.cpu_stats,n.precpu_stats):0,t.pids=n.pids_stats&&n.pids_stats.current?n.pids_stats.current:0,t.restartCount=i.RestartCount?i.RestartCount:0,n.networks&&(t.netIO=function(e){let t,n;for(let r in e){if(!{}.hasOwnProperty.call(e,r))continue;let i=e[r];t=+i.rx_bytes,n=+i.tx_bytes}return{rx:t,wx:n}}(n.networks)),n.blkio_stats&&(t.blockIO=function(e){let t={r:0,w:0};return e&&e.io_service_bytes_recursive&&"[object Array]"===Object.prototype.toString.call(e.io_service_bytes_recursive)&&e.io_service_bytes_recursive.length>0&&e.io_service_bytes_recursive.forEach((function(e){e.op&&"read"===e.op.toLowerCase()&&e.value&&(t.r+=e.value),e.op&&"write"===e.op.toLowerCase()&&e.value&&(t.w+=e.value)})),t}(n.blkio_stats)),t.cpuStats=n.cpu_stats?n.cpu_stats:{},t.precpuStats=n.precpu_stats?n.precpu_stats:{},t.memoryStats=n.memory_stats?n.memory_stats:{},t.networks=n.networks?n.networks:{})}catch(e){r.noop()}n(t)}))}catch(e){r.noop()}}))):n(t)}))}))}function d(e,t){let n=[];return new Promise((o=>{process.nextTick((()=>{"string"!=typeof(e=e||"")&&o(n);const a=(r.isPrototypePolluted()?"":r.sanitizeShellString(e,!0)).trim();a?(s||(s=new i),s.getProcesses(a,(e=>{try{if(e&&e.Titles&&e.Processes){let t=e.Titles.map((function(e){return e.toUpperCase()})),r=t.indexOf("PID"),i=t.indexOf("PPID"),o=t.indexOf("PGID"),s=t.indexOf("VSZ"),a=t.indexOf("TIME"),c=t.indexOf("ELAPSED"),l=t.indexOf("NI"),u=t.indexOf("RUSER"),p=t.indexOf("USER"),d=t.indexOf("RGROUP"),f=t.indexOf("GROUP"),h=t.indexOf("STAT"),m=t.indexOf("RSS"),g=t.indexOf("COMMAND");e.Processes.forEach((e=>{n.push({pidHost:r>=0?e[r]:"",ppid:i>=0?e[i]:"",pgid:o>=0?e[o]:"",user:p>=0?e[p]:"",ruser:u>=0?e[u]:"",group:f>=0?e[f]:"",rgroup:d>=0?e[d]:"",stat:h>=0?e[h]:"",time:a>=0?e[a]:"",elapsed:c>=0?e[c]:"",nice:l>=0?e[l]:"",rss:m>=0?e[m]:"",vsz:s>=0?e[s]:"",command:g>=0?e[g]:""})}))}}catch(e){r.noop()}t&&t(n),o(n)}))):(t&&t(n),o(n))}))}))}t.dockerInfo=function(e){return new Promise((t=>{process.nextTick((()=>{s||(s=new i);const n={};s.getInfo((r=>{n.id=r.ID,n.containers=r.Containers,n.containersRunning=r.ContainersRunning,n.containersPaused=r.ContainersPaused,n.containersStopped=r.ContainersStopped,n.images=r.Images,n.driver=r.Driver,n.memoryLimit=r.MemoryLimit,n.swapLimit=r.SwapLimit,n.kernelMemory=r.KernelMemory,n.cpuCfsPeriod=r.CpuCfsPeriod,n.cpuCfsQuota=r.CpuCfsQuota,n.cpuShares=r.CPUShares,n.cpuSet=r.CPUSet,n.ipv4Forwarding=r.IPv4Forwarding,n.bridgeNfIptables=r.BridgeNfIptables,n.bridgeNfIp6tables=r.BridgeNfIp6tables,n.debug=r.Debug,n.nfd=r.NFd,n.oomKillDisable=r.OomKillDisable,n.ngoroutines=r.NGoroutines,n.systemTime=r.SystemTime,n.loggingDriver=r.LoggingDriver,n.cgroupDriver=r.CgroupDriver,n.nEventsListener=r.NEventsListener,n.kernelVersion=r.KernelVersion,n.operatingSystem=r.OperatingSystem,n.osType=r.OSType,n.architecture=r.Architecture,n.ncpu=r.NCPU,n.memTotal=r.MemTotal,n.dockerRootDir=r.DockerRootDir,n.httpProxy=r.HttpProxy,n.httpsProxy=r.HttpsProxy,n.noProxy=r.NoProxy,n.name=r.Name,n.labels=r.Labels,n.experimentalBuild=r.ExperimentalBuild,n.serverVersion=r.ServerVersion,n.clusterStore=r.ClusterStore,n.clusterAdvertise=r.ClusterAdvertise,n.defaultRuntime=r.DefaultRuntime,n.liveRestoreEnabled=r.LiveRestoreEnabled,n.isolation=r.Isolation,n.initBinary=r.InitBinary,n.productLicense=r.ProductLicense,e&&e(n),t(n)}))}))}))},t.dockerImages=function(e,t){r.isFunction(e)&&!t&&(t=e,e=!1),"string"==typeof e&&"true"===e&&(e=!0),"boolean"!=typeof e&&void 0!==e&&(e=!1),e=e||!1;let n=[];return new Promise((o=>{process.nextTick((()=>{s||(s=new i);const a=[];s.listImages(e,(e=>{let c={};try{c=e,c&&"[object Array]"===Object.prototype.toString.call(c)&&c.length>0?(c.forEach((function(e){var t,n;e.Names&&"[object Array]"===Object.prototype.toString.call(e.Names)&&e.Names.length>0&&(e.Name=e.Names[0].replace(/^\/|\/$/g,"")),a.push((t=e.Id.trim(),n=e,new Promise((e=>{process.nextTick((()=>{"string"!=typeof(t=t||"")&&e();const o=(r.isPrototypePolluted()?"":r.sanitizeShellString(t,!0)).trim();o?(s||(s=new i),s.inspectImage(o.trim(),(t=>{try{e({id:n.Id,container:t.Container,comment:t.Comment,os:t.Os,architecture:t.Architecture,parent:t.Parent,dockerVersion:t.DockerVersion,size:t.Size,sharedSize:n.SharedSize,virtualSize:t.VirtualSize,author:t.Author,created:t.Created?Math.round(new Date(t.Created).getTime()/1e3):0,containerConfig:t.ContainerConfig?t.ContainerConfig:{},graphDriver:t.GraphDriver?t.GraphDriver:{},repoDigests:t.RepoDigests?t.RepoDigests:{},repoTags:t.RepoTags?t.RepoTags:{},config:t.Config?t.Config:{},rootFS:t.RootFS?t.RootFS:{}})}catch(t){e()}}))):e()}))}))))})),a.length?Promise.all(a).then((e=>{t&&t(e),o(e)})):(t&&t(n),o(n))):(t&&t(n),o(n))}catch(e){t&&t(n),o(n)}}))}))}))},t.dockerContainers=l,t.dockerContainerStats=u,t.dockerContainerProcesses=d,t.dockerVolumes=function(e){let t=[];return new Promise((n=>{process.nextTick((()=>{s||(s=new i),s.listVolumes((r=>{let i={};try{i=r,i&&i.Volumes&&"[object Array]"===Object.prototype.toString.call(i.Volumes)&&i.Volumes.length>0?(i.Volumes.forEach((function(e){t.push({name:e.Name,driver:e.Driver,labels:e.Labels,mountpoint:e.Mountpoint,options:e.Options,scope:e.Scope,created:e.CreatedAt?Math.round(new Date(e.CreatedAt).getTime()/1e3):0})})),e&&e(t),n(t)):(e&&e(t),n(t))}catch(r){e&&e(t),n(t)}}))}))}))},t.dockerAll=function(e){return new Promise((t=>{process.nextTick((()=>{l(!0).then((n=>{if(n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0){let r=n.length;n.forEach((function(i){u(i.id).then((o=>{i.memUsage=o[0].memUsage,i.memLimit=o[0].memLimit,i.memPercent=o[0].memPercent,i.cpuPercent=o[0].cpuPercent,i.pids=o[0].pids,i.netIO=o[0].netIO,i.blockIO=o[0].blockIO,i.cpuStats=o[0].cpuStats,i.precpuStats=o[0].precpuStats,i.memoryStats=o[0].memoryStats,i.networks=o[0].networks,d(i.id).then((o=>{i.processes=o,r-=1,0===r&&(e&&e(n),t(n))}))}))}))}else e&&e(n),t(n)}))}))}))}},3568:(e,t,n)=>{"use strict";const r=n(1631),i="Windows_NT"===n(2087).type()?"//./pipe/docker_engine":"/var/run/docker.sock";e.exports=class{getInfo(e){try{let t,n=r.createConnection({path:i}),o="";n.on("connect",(()=>{n.write("GET http:/info HTTP/1.0\r\n\r\n")})),n.on("data",(e=>{o+=e.toString()})),n.on("error",(()=>{n=!1,e({})})),n.on("end",(()=>{let r=o.indexOf("\r\n\r\n");o=o.substring(r+4),n=!1;try{t=JSON.parse(o),e(t)}catch(t){e({})}}))}catch(t){e({})}}listImages(e,t){try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/images/json"+(e?"?all=1":"")+" HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}}inspectImage(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/images/"+e+"/json?stream=0 HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}listContainers(e,t){try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/json"+(e?"?all=1":"")+" HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}}getStats(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/"+e+"/stats?stream=0 HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}getInspect(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/"+e+"/json?stream=0 HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}getProcesses(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/"+e+"/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}listVolumes(e){try{let t,n=r.createConnection({path:i}),o="";n.on("connect",(()=>{n.write("GET http:/volumes HTTP/1.0\r\n\r\n")})),n.on("data",(e=>{o+=e.toString()})),n.on("error",(()=>{n=!1,e({})})),n.on("end",(()=>{let r=o.indexOf("\r\n\r\n");o=o.substring(r+4),n=!1;try{t=JSON.parse(o),e(t)}catch(t){e({})}}))}catch(t){e({})}}}},2683:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(3129).execSync,o=n(1453),s=n(5747);let a=process.platform;const c="linux"===a,l="darwin"===a,u="win32"===a,p="freebsd"===a,d="openbsd"===a,f="netbsd"===a,h="sunos"===a;let m={},g={};function v(e){let t=[],n=0;return e.forEach((e=>{if(e.length>0)if("*"===e[0])n++;else{let i=e.split(":");i.length>1&&(t[n]||(t[n]={name:"",identifier:"",type:"disk",fsType:"",mount:"",size:0,physical:"HDD",uuid:"",label:"",model:"",serial:"",removable:!1,protocol:""}),i[0]=i[0].trim().toUpperCase().replace(/ +/g,""),i[1]=i[1].trim(),"DEVICEIDENTIFIER"===i[0]&&(t[n].identifier=i[1]),"DEVICENODE"===i[0]&&(t[n].name=i[1]),"VOLUMENAME"===i[0]&&-1===i[1].indexOf("Not applicable")&&(t[n].label=i[1]),"PROTOCOL"===i[0]&&(t[n].protocol=i[1]),"DISKSIZE"===i[0]&&(t[n].size=(r=i[1],parseInt(r.substr(r.indexOf(" (")+2,r.indexOf(" Bytes)")-10)))),"FILESYSTEMPERSONALITY"===i[0]&&(t[n].fsType=i[1]),"MOUNTPOINT"===i[0]&&(t[n].mount=i[1]),"VOLUMEUUID"===i[0]&&(t[n].uuid=i[1]),"READ-ONLYMEDIA"===i[0]&&"Yes"===i[1]&&(t[n].physical="CD/DVD"),"SOLIDSTATE"===i[0]&&"Yes"===i[1]&&(t[n].physical="SSD"),"VIRTUAL"===i[0]&&(t[n].type="virtual"),"REMOVABLEMEDIA"===i[0]&&(t[n].removable="Removable"===i[1]),"PARTITIONTYPE"===i[0]&&(t[n].type="part"),"DEVICE/MEDIANAME"===i[0]&&(t[n].model=i[1]))}var r})),t}function y(e){let t=[];return e.filter((e=>""!==e)).forEach((e=>{try{e=(e=decodeURIComponent(e.replace(/\\x/g,"%"))).replace(/\\/g,"\\\\");let n=JSON.parse(e);t.push({name:n.name,type:n.type,fsType:n.fsType,mount:n.mountpoint,size:parseInt(n.size),physical:"disk"===n.type?"0"===n.rota?"SSD":"HDD":"rom"===n.type?"CD/DVD":"",uuid:n.uuid,label:n.label,model:n.model,serial:n.serial,removable:"1"===n.rm,protocol:n.tran,group:n.group})}catch(e){o.noop()}})),t=o.unique(t),t=o.sortByKey(t,["type","name"]),t}function _(e){return e.toString().replace(/NAME=/g,'{"name":').replace(/FSTYPE=/g,',"fsType":').replace(/TYPE=/g,',"type":').replace(/SIZE=/g,',"size":').replace(/MOUNTPOINT=/g,',"mountpoint":').replace(/UUID=/g,',"uuid":').replace(/ROTA=/g,',"rota":').replace(/RO=/g,',"ro":').replace(/RM=/g,',"rm":').replace(/TRAN=/g,',"tran":').replace(/SERIAL=/g,',"serial":').replace(/LABEL=/g,',"label":').replace(/MODEL=/g,',"model":').replace(/OWNER=/g,',"owner":').replace(/GROUP=/g,',"group":').replace(/\n/g,"}\n")}function E(e,t){let n={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0};return m&&m.ms?(n.rx=e,n.wx=t,n.tx=n.rx+n.wx,n.ms=Date.now()-m.ms,n.rx_sec=(n.rx-m.bytes_read)/(n.ms/1e3),n.wx_sec=(n.wx-m.bytes_write)/(n.ms/1e3),n.tx_sec=n.rx_sec+n.wx_sec,m.rx_sec=n.rx_sec,m.wx_sec=n.wx_sec,m.tx_sec=n.tx_sec,m.bytes_read=n.rx,m.bytes_write=n.wx,m.bytes_overall=n.rx+n.wx,m.ms=Date.now(),m.last_ms=n.ms):(n.rx=e,n.wx=t,n.tx=n.rx+n.wx,m.rx_sec=null,m.wx_sec=null,m.tx_sec=null,m.bytes_read=n.rx,m.bytes_write=n.wx,m.bytes_overall=n.rx+n.wx,m.ms=Date.now(),m.last_ms=0),n}function b(e,t){let n={rIO:0,wIO:0,tIO:0,rIO_sec:null,wIO_sec:null,tIO_sec:null,ms:0};return g&&g.ms?(n.rIO=e,n.wIO=t,n.tIO=e+t,n.ms=Date.now()-g.ms,n.rIO_sec=(n.rIO-g.rIO)/(n.ms/1e3),n.wIO_sec=(n.wIO-g.wIO)/(n.ms/1e3),n.tIO_sec=n.rIO_sec+n.wIO_sec,g.rIO=e,g.wIO=t,g.rIO_sec=n.rIO_sec,g.wIO_sec=n.wIO_sec,g.tIO_sec=n.tIO_sec,g.last_ms=n.ms,g.ms=Date.now()):(n.rIO=e,n.wIO=t,n.tIO=e+t,g.rIO=e,g.wIO=t,g.rIO_sec=null,g.wIO_sec=null,g.tIO_sec=null,g.last_ms=0,g.ms=Date.now()),n}t.fsSize=function(e){let t=[];function n(e){let n=[];return e.forEach((function(e){if(""!==e&&(e=e.replace(/ +/g," ").split(" "))&&(e[0].startsWith("/")||e[6]&&"/"===e[6]||e[0].indexOf("/")>0||1===e[0].indexOf(":"))){const r=e[0],i=c||p||d||f?e[1]:function(e){if(!e.startsWith("/"))return"NFS";const n=e.split("/"),r=n[n.length-1],i=t.filter((e=>e.indexOf(r)>=0));return 1===i.length&&i[0].indexOf("APFS")>=0?"APFS":"HFS"}(e[0]),o=1024*parseInt(c||p||d||f?e[2]:e[1]),s=1024*parseInt(c||p||d||f?e[3]:e[2]),a=1024*parseInt(c||p||d||f?e[4]:e[3]),l=parseFloat((s/(s+a)*100).toFixed(2));e.splice(0,c||p||d||f?6:5);const u=e.join(" ");n.find((e=>e.fs===r&&e.type===i))||n.push({fs:r,type:i,size:o,used:s,available:a,use:l,mount:u})}})),n}return new Promise((s=>{process.nextTick((()=>{let a=[];if(c||p||d||f||l){let o="";if(l){o="df -kP";try{t=i("diskutil list").toString().split("\n").filter((e=>!e.startsWith("/")&&e.indexOf(":")>0))}catch(e){t=[]}}c&&(o='df -lkPTx squashfs | grep -E "^/|^.\\:"'),(p||d||f)&&(o="df -lkPT"),r(o,(function(t,i){if(t)r("df -kPT",(function(t,r){if(!t){let e=r.toString().split("\n");a=n(e)}e&&e(a),s(a)}));else{let t=i.toString().split("\n");a=n(t),e&&e(a),s(a)}}))}if(h&&(e&&e(a),s(a)),u)try{o.wmic("logicaldisk get Caption,FileSystem,FreeSpace,Size").then((t=>{t.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(e){""!==e&&(e=e.trim().split(/\s\s+/)).length>=4&&parseInt(e[3],10)&&a.push({fs:e[0],type:e[1],size:parseInt(e[3],10),used:parseInt(e[3],10)-parseInt(e[2],10),available:parseInt(e[2],10),use:parseFloat((100*(parseInt(e[3])-parseInt(e[2]))/parseInt(e[3])).toFixed(2)),mount:e[0]})})),e&&e(a),s(a)}))}catch(t){e&&e(a),s(a)}}))}))},t.fsOpenFiles=function(e){return new Promise((t=>{process.nextTick((()=>{const n={max:null,allocated:null,available:null};if(p||d||f||l){r("sysctl -a | grep 'kern.*files'",(function(r,i){if(!r){let e=i.toString().split("\n");n.max=parseInt(o.getValue(e,"kern.maxfiles",":"),10),n.allocated=parseInt(o.getValue(e,"kern.num_files",":"),10),n.available=n.max-n.allocated}e&&e(n),t(n)}))}c&&s.readFile("/proc/sys/fs/file-nr",(function(r,i){if(r)s.readFile("/proc/sys/fs/file-max",(function(r,i){if(!r){let e=i.toString().split("\n");e[0]&&(n.max=parseInt(e[0],10))}e&&e(n),t(n)}));else{let r=i.toString().split("\n");if(r[0]){const e=r[0].replace(/\s+/g," ").split(" ");3===e.length&&(n.allocated=parseInt(e[0],10),n.available=parseInt(e[1],10),n.max=parseInt(e[2],10),n.available||(n.available=n.max-n.allocated))}e&&e(n),t(n)}})),h&&(e&&e(null),t(null)),u&&(e&&e(null),t(null))}))}))},t.blockDevices=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(c&&r("lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null",(function(i,o){if(i)r("lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null",(function(r,i){if(!r){let e=_(i).split("\n");n=y(e)}e&&e(n),t(n)}));else{let r=_(o).split("\n");n=y(r),e&&e(n),t(n)}})),l&&r("diskutil info -all",(function(r,i){if(!r){let e=i.toString().split("\n");n=v(e)}e&&e(n),t(n)})),h&&(e&&e(n),t(n)),u){let r=["Unknown","NoRoot","Removable","Local","Network","CD/DVD","RAM"];try{o.wmic("logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value").then(((i,s)=>{if(!s){i.toString().split(/\n\s*\n/).forEach((function(e){let t=e.split("\r\n"),i=o.getValue(t,"drivetype","=");i&&n.push({name:o.getValue(t,"name","="),identifier:o.getValue(t,"caption","="),type:"disk",fsType:o.getValue(t,"filesystem","=").toLowerCase(),mount:o.getValue(t,"caption","="),size:o.getValue(t,"size","="),physical:i>=0&&i<=6?r[i]:r[0],uuid:o.getValue(t,"volumeserialnumber","="),label:o.getValue(t,"volumename","="),model:"",serial:o.getValue(t,"volumeserialnumber","="),removable:"2"===i,protocol:""})}))}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}(p||d||f)&&(e&&e(null),t(null))}))}))},t.fsStats=function(e){return new Promise((t=>{process.nextTick((()=>{u&&t(null);let n={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0},i=0,o=0;m&&!m.ms||m&&m.ms&&Date.now()-m.ms>=500?(c&&r("lsblk -r 2>/dev/null | grep /",(function(s,a){if(s)e&&e(n),t(n);else{let s=a.toString().split("\n"),c=[];s.forEach((function(e){""!==e&&(e=e.trim().split(" "),-1===c.indexOf(e[0])&&c.push(e[0]))}));let l=c.join("|");r('cat /proc/diskstats | egrep "'+l+'"',(function(r,s){if(!r){s.toString().split("\n").forEach((function(e){""!==(e=e.trim())&&(e=e.replace(/ +/g," ").split(" "),i+=512*parseInt(e[5]),o+=512*parseInt(e[9]))})),n=E(i,o)}e&&e(n),t(n)}))}})),l&&r('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"',(function(r,s){if(!r){s.toString().split("\n").forEach((function(e){""!==(e=e.trim())&&(e=e.split(","),i+=parseInt(e[2]),o+=parseInt(e[9]))})),n=E(i,o)}e&&e(n),t(n)}))):(n.ms=m.last_ms,n.rx=m.bytes_read,n.wx=m.bytes_write,n.tx=m.bytes_read+m.bytes_write,n.rx_sec=m.rx_sec,n.wx_sec=m.wx_sec,n.tx_sec=m.tx_sec,e&&e(n),t(n))}))}))},t.disksIO=function(e){return new Promise((t=>{process.nextTick((()=>{u&&t(null),h&&t(null);let n={rIO:0,wIO:0,tIO:0,rIO_sec:null,wIO_sec:null,tIO_sec:null,ms:0},i=0,o=0;if(g&&!g.ms||g&&g.ms&&Date.now()-g.ms>=500){if(c||p||d||f){r('for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done',(function(r,s){if(r)e&&e(n),t(n);else{s.split("\n").forEach((function(e){if(!e)return;let t=e.split(";");i+=parseInt(t[0]),o+=parseInt(t[4])})),n=b(i,o),e&&e(n),t(n)}}))}l&&r('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"',(function(r,s){if(!r){s.toString().split("\n").forEach((function(e){""!==(e=e.trim())&&(e=e.split(","),i+=parseInt(e[10]),o+=parseInt(e[0]))})),n=b(i,o)}e&&e(n),t(n)}))}else n.rIO=g.rIO,n.wIO=g.wIO,n.tIO=g.rIO+g.wIO,n.ms=g.last_ms,n.rIO_sec=g.rIO_sec,n.wIO_sec=g.wIO_sec,n.tIO_sec=g.tIO_sec,e&&e(n),t(n)}))}))},t.diskLayout=function(e){function t(e){const t=[{pattern:"^WESTERN.+",manufacturer:"Western Digital"},{pattern:"^WDC.+",manufacturer:"Western Digital"},{pattern:"WD.+",manufacturer:"Western Digital"},{pattern:"^TOSHIBA.+",manufacturer:"Toshiba"},{pattern:"^HITACHI.+",manufacturer:"Hitachi"},{pattern:"^IC.+",manufacturer:"Hitachi"},{pattern:"^HTS.+",manufacturer:"Hitachi"},{pattern:"^SANDISK.+",manufacturer:"SanDisk"},{pattern:"^KINGSTON.+",manufacturer:"Kingston Technonogy"},{pattern:"^SONY.+",manufacturer:"Sony"},{pattern:"^TRANSCEND.+",manufacturer:"Transcend"},{pattern:"SAMSUNG.+",manufacturer:"Samsung"},{pattern:"^ST(?!I\\ ).+",manufacturer:"Seagate"},{pattern:"^STI\\ .+",manufacturer:"SimpleTech"},{pattern:"^D...-.+",manufacturer:"IBM"},{pattern:"^IBM.+",manufacturer:"IBM"},{pattern:"^FUJITSU.+",manufacturer:"Fujitsu"},{pattern:"^MP.+",manufacturer:"Fujitsu"},{pattern:"^MK.+",manufacturer:"Toshiba"},{pattern:"^MAXTOR.+",manufacturer:"Maxtor"},{pattern:"^Pioneer.+",manufacturer:"Pioneer"},{pattern:"^PHILIPS.+",manufacturer:"Philips"},{pattern:"^QUANTUM.+",manufacturer:"Quantum Technology"},{pattern:"FIREBALL.+",manufacturer:"Quantum Technology"},{pattern:"^VBOX.+",manufacturer:"VirtualBox"},{pattern:"CORSAIR.+",manufacturer:"Corsair Components"},{pattern:"CRUCIAL.+",manufacturer:"Crucial"},{pattern:"ECM.+",manufacturer:"ECM"},{pattern:"INTEL.+",manufacturer:"INTEL"},{pattern:".+EVO",manufacturer:"Samsung"},{pattern:"APPLE.+",manufacturer:"Apple"}];let n="";return e&&(e=e.toUpperCase(),t.forEach((t=>{RegExp(t.pattern).test(e)&&(n=t.manufacturer)}))),n}return new Promise((n=>{process.nextTick((()=>{const s=t=>{for(let e=0;e/dev/null; unset LC_ALL",(function(n,c){if(!n)try{const n=c.toString().trim();let r=[];try{const e=JSON.parse(n);e&&{}.hasOwnProperty.call(e,"blockdevices")&&(r=e.blockdevices.filter((e=>"disk"===e.type&&e.size>0&&(null!==e.model||null===e.mountpoint&&null===e.label&&null===e.fsType&&null===e.parttype))))}catch(e){let t=_(i("export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL").toString()).split("\n");r=y(t).filter((e=>"disk"===e.type&&e.size>0&&(null!==e.model&&""!==e.model||""===e.mount&&""===e.label&&""===e.fsType)))}r.forEach((n=>{let r="";const s="/dev/"+n.name,c=n.name;try{r=i("cat /sys/block/"+c+"/queue/rotational 2>/dev/null").toString().split("\n")[0]}catch(e){o.noop()}let l=n.tran?n.tran.toUpperCase().trim():"";"NVME"===l&&(r="2",l="PCIe"),a.push({device:s,type:"0"===r?"SSD":"1"===r?"HD":"2"===r?"NVMe":n.model&&n.model.indexOf("SSD")>-1?"SSD":n.model&&n.model.indexOf("NVM")>-1?"NVMe":"HD",name:n.model||"",vendor:t(n.model)||(n.vendor?n.vendor.trim():""),size:n.size||0,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:n.rev?n.rev.trim():"",serialNum:n.serial?n.serial.trim():"",interfaceType:l,smartStatus:"unknown",temperature:null,BSDName:s}),m+=`printf "\n${s}|"; smartctl -H ${s} | grep overall;`,e+=`${e?'printf ",";':""}smartctl -a -j ${s};`}))}catch(e){o.noop()}e?r(e,(function(e,t){try{JSON.parse(`[${t}]`).forEach((e=>{const t=e.smartctl.argv[e.smartctl.argv.length-1];for(let n=0;n{if(e){let t=e.split("|");if(2===t.length){let e=t[0];t[1]=t[1].trim();let n=t[1].split(":");if(2===n.length){n[1]=n[1].trim();let t=n[1].toLowerCase();for(let n=0;n{"NVMExpress:"===e?p="NVMe":"USB:"===e?p="USB":"SATA/SATA Express:"===e?p="SATA":"SATA"===p?c.push(e):"NVMe"===p?l.push(e):"USB"===p&&u.push(e)}));try{let e=c.join("\n").split(" Physical Interconnect: ");e.shift(),e.forEach((function(e){let n=(e="InterfaceType: "+e).split("\n");const r=o.getValue(n,"Medium Type",":",!0).trim(),i=o.getValue(n,"capacity",":",!0).trim(),s=o.getValue(n,"BSD Name",":",!0).trim();if(i){let e=0;if(i.indexOf("(")>=0&&(e=parseInt(i.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,""))),e||(e=parseInt(i)),e){const i=o.getValue(n,"S.M.A.R.T. status",":",!0).trim().toLowerCase();a.push({device:s,type:r.startsWith("Solid")?"SSD":"HD",name:o.getValue(n,"Model",":",!0).trim(),vendor:t(o.getValue(n,"Model",":",!0).trim())||o.getValue(n,"Manufacturer",":",!0),size:e,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:o.getValue(n,"Revision",":",!0).trim(),serialNum:o.getValue(n,"Serial Number",":",!0).trim(),interfaceType:o.getValue(n,"InterfaceType",":",!0).trim(),smartStatus:"verified"===i?"OK":i||"unknown",temperature:null,BSDName:s}),m=m+'printf "\n'+s+'|"; diskutil info /dev/'+s+" | grep SMART;"}}}))}catch(e){o.noop()}try{let e=l.join("\n").split("\n\n Capacity:");e.shift(),e.forEach((function(e){let n=(e="!Capacity: "+e).split("\n");const r=o.getValue(n,"link width",":",!0).trim(),i=o.getValue(n,"!capacity",":",!0).trim(),s=o.getValue(n,"BSD Name",":",!0).trim();if(i){let e=0;if(i.indexOf("(")>=0&&(e=parseInt(i.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,""))),e||(e=parseInt(i)),e){const i=o.getValue(n,"S.M.A.R.T. status",":",!0).trim().toLowerCase();a.push({device:s,type:"NVMe",name:o.getValue(n,"Model",":",!0).trim(),vendor:t(o.getValue(n,"Model",":",!0).trim()),size:e,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:o.getValue(n,"Revision",":",!0).trim(),serialNum:o.getValue(n,"Serial Number",":",!0).trim(),interfaceType:("PCIe "+r).trim(),smartStatus:"verified"===i?"OK":i||"unknown",temperature:null,BSDName:s}),m=m+'printf "\n'+s+'|"; diskutil info /dev/'+s+" | grep SMART;"}}}))}catch(e){o.noop()}try{let e=u.join("\n").replaceAll("Media:\n ","Model:").split("\n\n Product ID:");e.shift(),e.forEach((function(e){let n=e.split("\n");const r=o.getValue(n,"Capacity",":",!0).trim(),i=o.getValue(n,"BSD Name",":",!0).trim();if(r){let e=0;if(r.indexOf("(")>=0&&(e=parseInt(r.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,""))),e||(e=parseInt(r)),e){const r=o.getValue(n,"S.M.A.R.T. status",":",!0).trim().toLowerCase();a.push({device:i,type:"USB",name:o.getValue(n,"Model",":",!0).trim().replaceAll(":",""),vendor:t(o.getValue(n,"Model",":",!0).trim()),size:e,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:o.getValue(n,"Revision",":",!0).trim(),serialNum:o.getValue(n,"Serial Number",":",!0).trim(),interfaceType:"USB",smartStatus:"verified"===r?"OK":r||"unknown",temperature:null,BSDName:i}),m=m+'printf "\n'+i+'|"; diskutil info /dev/'+i+" | grep SMART;"}}}))}catch(e){o.noop()}if(m)m+='printf "\n"',r(m,(function(t,r){r.toString().split("\n").forEach((e=>{if(e){let t=e.split("|");if(2===t.length){let e=t[0];t[1]=t[1].trim();let n=t[1].split(":");if(2===n.length){n[1]=n[1].trim();let t=n[1].toLowerCase();for(let n=0;n{t.toString().split(/\n\s*\n/).forEach((function(e){let t=e.split("\r\n");const n=o.getValue(t,"Size","=").trim(),r=o.getValue(t,"Status","=").trim().toLowerCase();n&&a.push({device:o.getValue(t,"PNPDeviceId","="),type:e.indexOf("SSD")>-1?"SSD":"HD",name:o.getValue(t,"Caption","="),vendor:o.getValue(t,"Manufacturer","="),size:parseInt(n),bytesPerSector:parseInt(o.getValue(t,"BytesPerSector","=")),totalCylinders:parseInt(o.getValue(t,"TotalCylinders","=")),totalHeads:parseInt(o.getValue(t,"TotalHeads","=")),totalSectors:parseInt(o.getValue(t,"TotalSectors","=")),totalTracks:parseInt(o.getValue(t,"TotalTracks","=")),tracksPerCylinder:parseInt(o.getValue(t,"TracksPerCylinder","=")),sectorsPerTrack:parseInt(o.getValue(t,"SectorsPerTrack","=")),firmwareRevision:o.getValue(t,"FirmwareRevision","=").trim(),serialNum:o.getValue(t,"SerialNumber","=").trim(),interfaceType:o.getValue(t,"InterfaceType","=").trim(),smartStatus:"ok"===r?"Ok":"degraded"===r?"Degraded":"pred fail"===r?"Predicted Failure":"Unknown",temperature:null})})),o.powerShell("Get-PhysicalDisk | Format-List").then((t=>{t.split(/\n\s*\n/).forEach((function(e){let t=e.split("\r\n");const n=o.getValue(t,"SerialNumber",":").trim(),r=o.getValue(t,"FriendlyName",":").trim().replace("Msft ","Microsoft"),i=o.getValue(t,"Size",":").trim(),s=o.getValue(t,"Model",":").trim(),c=o.getValue(t,"BusType",":").trim();let l=o.getValue(t,"MediaType",":").trim();if("3"!==l&&"HDD"!==l||(l="HD"),"4"===l&&(l="SSD"),"5"===l&&(l="SCM"),"Unspecified"===l&&(s.toLowerCase().indexOf("virtual")>-1||s.toLowerCase().indexOf("vbox")>-1)&&(l="Virtual"),i){let e=o.findObjectByKey(a,"serialNum",n);-1!==e&&""!==n||(e=o.findObjectByKey(a,"name",r)),-1!=e&&(a[e].type=l,a[e].interfaceType=c)}})),e&&e(a),n(a)})).catch((()=>{e&&e(a),n(a)}))}))}catch(t){e&&e(a),n(a)}}))}))}},559:(e,t,n)=>{"use strict";const r=n(2087),i=n(5747),o=n(3129).exec,s=n(3129).execSync,a=n(1453);let c=process.platform,l="";const u="linux"===c,p="darwin"===c,d="win32"===c,f="freebsd"===c,h="openbsd"===c,m="netbsd"===c,g="sunos"===c;let v=0,y=0,_=0,E=0;const b={"-2":"UNINITIALIZED","-1":"OTHER",0:"HD15",1:"SVIDEO",2:"Composite video",3:"Component video",4:"DVI",5:"HDMI",6:"LVDS",8:"D_JPN",9:"SDI",10:"DP",11:"DP embedded",12:"UDI",13:"UDI embedded",14:"SDTVDONGLE",15:"MIRACAST",2147483648:"INTERNAL"};t.graphics=function(e){function t(e){const t=function(){if(l)return l;if(d)try{const e=a.WINDIR+"\\System32\\DriverStore\\FileRepository",t=i.readdirSync(e).filter((t=>i.readdirSync([e,t].join("/")).includes("nvidia-smi.exe"))).reduce(((t,n)=>{const r=i.statSync([e,t,"nvidia-smi.exe"].join("/")),o=i.statSync([e,n,"nvidia-smi.exe"].join("/"));return r.ctimeMs>o.ctimeMs?t:n}));t&&(l=[e,t,"nvidia-smi.exe"].join("/"))}catch(e){a.noop()}else u&&(l="nvidia-smi");return l}();if(e=e||a.execOptsWin,t){const n=t+" "+"--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits"+(u?" 2>/dev/null":"");try{return s(n,e).toString()}catch(e){a.noop()}}return""}function n(){function e(e){return[null,void 0].includes(e)?e:parseFloat(e)}const n=t();if(!n)return[];return n.split("\n").filter(Boolean).map((t=>{const n=t.split(", ").map((e=>e.includes("N/A")?void 0:e));if(16===n.length)return{driverVersion:n[0],subDeviceId:n[1],name:n[2],pciBus:n[3],fanSpeed:e(n[4]),memoryTotal:e(n[5]),memoryUsed:e(n[6]),memoryFree:e(n[7]),utilizationGpu:e(n[8]),utilizationMemory:e(n[9]),temperatureGpu:e(n[10]),temperatureMemory:e(n[11]),powerDraw:e(n[12]),powerLimit:e(n[13]),clockCore:e(n[14]),clockMemory:e(n[15])}}))}function c(e,t){return t.driverVersion&&(e.driverVersion=t.driverVersion),t.subDeviceId&&(e.subDeviceId=t.subDeviceId),t.name&&(e.name=t.name),t.pciBus&&(e.pciBus=t.pciBus),t.fanSpeed&&(e.fanSpeed=t.fanSpeed),t.memoryTotal&&(e.memoryTotal=t.memoryTotal,e.vram=t.memoryTotal,e.vramDynamic=!1),t.memoryUsed&&(e.memoryUsed=t.memoryUsed),t.memoryFree&&(e.memoryFree=t.memoryFree),t.utilizationGpu&&(e.utilizationGpu=t.utilizationGpu),t.utilizationMemory&&(e.utilizationMemory=t.utilizationMemory),t.temperatureGpu&&(e.temperatureGpu=t.temperatureGpu),t.temperatureMemory&&(e.temperatureMemory=t.temperatureMemory),t.powerDraw&&(e.powerDraw=t.powerDraw),t.powerLimit&&(e.powerLimit=t.powerLimit),t.clockCore&&(e.clockCore=t.clockCore),t.clockMemory&&(e.clockMemory=t.clockMemory),e}function w(e){let t={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null},n=108;if("000000"===e.substr(n,6)&&(n+=36),"000000"===e.substr(n,6)&&(n+=36),"000000"===e.substr(n,6)&&(n+=36),"000000"===e.substr(n,6)&&(n+=36),t.resolutionX=parseInt("0x0"+e.substr(n+8,1)+e.substr(n+4,2)),t.resolutionY=parseInt("0x0"+e.substr(n+14,1)+e.substr(n+10,2)),t.sizeX=parseInt("0x0"+e.substr(n+28,1)+e.substr(n+24,2)),t.sizeY=parseInt("0x0"+e.substr(n+29,1)+e.substr(n+26,2)),n=e.indexOf("000000fc00"),n>=0){let r=e.substr(n+10,26);-1!==r.indexOf("0a")&&(r=r.substr(0,r.indexOf("0a")));try{r.length>2&&(t.model=r.match(/.{1,2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""))}catch(e){a.noop()}}else t.model="";return t}return new Promise((t=>{process.nextTick((()=>{let i={controllers:[],displays:[]};if(p){o("system_profiler SPDisplaysDataType",(function(n,r){if(!n){let e=r.toString().split("\n");i=function(e){let t=[],n=-1,r=-1,i=[],o=[],s={vendor:"",model:"",bus:"",vram:null,vramDynamic:!1},a={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null};for(let c=0;c0&&(i.push(s),s={vendor:"",model:"",bus:"",vram:null,vramDynamic:!1}),Object.keys(a).length>0&&(o.push(a),a={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null})),r=n;let u=e[c].split(":");if(2===n&&(u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("chipsetmodel")&&(s.model=u[1].trim()),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("vendor")&&(s.vendor=u[1].split("(")[0].trim()),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("vram(total)")&&(s.vram=parseInt(u[1]),-1!==u[1].toLowerCase().indexOf("gb")&&(s.vram=1024*s.vram),s.vramDynamic=!1),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("vram(dynamic,max)")&&(s.vram=parseInt(u[1]),-1!==u[1].toLowerCase().indexOf("gb")&&(s.vram=1024*s.vram),s.vramDynamic=!0),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("bus")&&(s.bus=u[1].trim(),"built-in"===s.bus.toLowerCase()&&(s.vramDynamic=!0))),3===n&&u.length>1&&""===u[1]&&(a.vendor="",a.model=u[0].trim(),a.main=!1,a.builtin=!1,a.connection="",a.sizeX=null,a.sizeY=null,a.positionX=0,a.positionY=0,a.pixelDepth=null),4===n){if(u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("resolution")){let e=u[1].split("x");a.resolutionX=e.length>1?parseInt(e[0]):0,a.resolutionY=e.length>1?parseInt(e[1]):0,a.currentResX=a.resolutionX,a.currentResY=a.resolutionY}u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("pixeldepth")&&(a.pixelDepth=parseInt(u[1])),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("framebufferdepth")&&(a.pixelDepth=parseInt(u[1])),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("maindisplay")&&"yes"===u[1].replace(/ +/g,"").toLowerCase()&&(a.main=!0),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("built-in")&&"yes"===u[1].replace(/ +/g,"").toLowerCase()&&(a.vendor="Apple",a.builtin=!0,a.connection=""),u.length>1&&-1!==u[0].replace(/ +/g,"").toLowerCase().indexOf("connectiontype")&&(a.builtin=!1,a.connection=u[1].trim(),"Internal"===a.connection&&(a.vendor="Apple",a.builtin=!0))}}return Object.keys(s).length>0&&i.push(s),Object.keys(a).length>0&&o.push(a),{controllers:i,displays:o}}(e)}e&&e(i),t(i)}))}if(u)if(a.isRaspberry()&&a.isRaspbian()){o("fbset -s | grep 'mode \"'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;",(function(n,r){let o=r.toString().split("\n");if(o.length>3&&o[0].indexOf('mode "')>=-1&&o[2].indexOf("0x12000a")>-1){const e=o[0].replace("mode","").replace(/"/g,"").trim().split("x");2===e.length&&i.displays.push({vendor:"",model:a.getValue(o,"device_name","="),main:!0,builtin:!1,connection:"HDMI",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:parseInt(e[0],10),resolutionY:parseInt(e[1],10),currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null})}o.length>1&&r.toString().indexOf("gpu=")>=-1&&i.controllers.push({vendor:"Broadcom",model:"VideoCore IV",bus:"",vram:a.getValue(o,"gpu","=").replace("M",""),vramDynamic:!0}),e&&e(i),t(i)}))}else{o("lspci -vvv 2>/dev/null",(function(r,l){if(!r){let e=l.toString().split("\n");i.controllers=function(e){let t=[],n={vendor:"",model:"",bus:"",busAddress:"",vram:null,vramDynamic:!1,pciID:""},r=!1,i=[];try{i=s('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "').toString().split("\n");for(let e=0;e=0,a=e[o].toLowerCase().indexOf(" vga "),c=e[o].toLowerCase().indexOf("3d controller");if(-1!==a||-1!==c){-1!==c&&-1===a&&(a=c),(n.vendor||n.model||n.bus||null!==n.vram||n.vramDynamic)&&(t.push(n),n={vendor:"",model:"",bus:"",busAddress:"",vram:null,vramDynamic:!1});const l=e[o].split(" ")[0];/[\da-fA-F]{2}:[\da-fA-F]{2}\.[\da-fA-F]/.test(l)&&(n.busAddress=l),r=!0;let u=e[o].search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/),p=e[o].substr(a,u-a).split(":");n.busAddress=e[o].substr(0,a).trim(),p.length>1&&(p[1]=p[1].trim(),p[1].toLowerCase().indexOf("corporation")>=0?(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf("corporation")+11).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf("corporation")+11,200).trim().split("(")[0],n.bus=i.length>0&&s?"PCIe":"Onboard",n.vram=null,n.vramDynamic=!1):p[1].toLowerCase().indexOf(" inc.")>=0?((p[1].match(new RegExp("]","g"))||[]).length>1?(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf("]")+1).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf("]")+1,200).trim().split("(")[0].trim()):(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf(" inc.")+5).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf(" inc.")+5,200).trim().split("(")[0].trim()),n.bus=i.length>0&&s?"PCIe":"Onboard",n.vram=null,n.vramDynamic=!1):p[1].toLowerCase().indexOf(" ltd.")>=0&&((p[1].match(new RegExp("]","g"))||[]).length>1?(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf("]")+1).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf("]")+1,200).trim().split("(")[0].trim()):(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf(" ltd.")+5).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf(" ltd.")+5,200).trim().split("(")[0].trim())))}else r=!1}if(r){let t=e[o].split(":");if(t.length>1&&-1!==t[0].replace(/ +/g,"").toLowerCase().indexOf("devicename")&&-1!==t[1].toLowerCase().indexOf("onboard")&&(n.bus="Onboard"),t.length>1&&-1!==t[0].replace(/ +/g,"").toLowerCase().indexOf("region")&&-1!==t[1].toLowerCase().indexOf("memory")){let e=t[1].split("=");e.length>1&&(n.vram=parseInt(e[1]))}}}return(n.vendor||n.model||n.bus||n.busAddress||null!==n.vram||n.vramDynamic)&&t.push(n),t}(e);const t=n();i.controllers=i.controllers.map((e=>c(e,t.find((({pciBus:t})=>t.toLowerCase().endsWith(e.busAddress.toLowerCase())))||{})))}o("clinfo --raw",(function(n,r){if(!n){let e=r.toString().split("\n");i.controllers=function(e,t){const n=/\[([^\]]+)\]\s+(\w+)\s+(.*)/,r=t.reduce(((e,t)=>{const r=n.exec(t.trim());return r&&(e[r[1]]||(e[r[1]]={}),e[r[1]][r[2]]=r[3]),e}),{});for(let t in r){const n=r[t];if("CL_DEVICE_TYPE_GPU"===n.CL_DEVICE_TYPE){let t;if(n.CL_DEVICE_TOPOLOGY_AMD){const e=n.CL_DEVICE_TOPOLOGY_AMD.match(/[a-zA-Z0-9]+:\d+\.\d+/);e&&(t=e[0])}else if(n.CL_DEVICE_PCI_BUS_ID_NV&&n.CL_DEVICE_PCI_SLOT_ID_NV){const e=parseInt(n.CL_DEVICE_PCI_BUS_ID_NV),r=parseInt(n.CL_DEVICE_PCI_SLOT_ID_NV);if(!isNaN(e)&&!isNaN(r)){const n=r>>3&255,i=7&r;t=`${(255&e).toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}.${i}`}}if(t){let r=e.find((e=>e.busAddress===t));r||(r={vendor:"",model:"",bus:"",busAddress:t,vram:null,vramDynamic:!1},e.push(r)),r.vendor=n.CL_DEVICE_VENDOR,n.CL_DEVICE_BOARD_NAME_AMD?r.model=n.CL_DEVICE_BOARD_NAME_AMD:r.model=n.CL_DEVICE_NAME;const i=parseInt(n.CL_DEVICE_GLOBAL_MEM_SIZE);isNaN(i)||(r.vram=Math.round(i/1024/1024))}}}return e}(i.controllers,e)}o("xdpyinfo 2>/dev/null | grep 'depth of root window' | awk '{ print $5 }'",(function(n,r){let s=0;if(!n){let e=r.toString().split("\n");s=parseInt(e[0])||0}o("xrandr --verbose 2>/dev/null",(function(n,r){if(!n){let e=r.toString().split("\n");i.displays=function(e,t){let n=[],r={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null},i=!1,o=!1,s="",c=0;for(let l=1;l=0,r.builtin=t[0].toLowerCase().indexOf("edp")>=0}if(i)if(e[l].search(/\S|$/)>c)s+=e[l].toLowerCase().trim();else{let e=w(s);r.vendor=e.vendor,r.model=e.model,r.resolutionX=e.resolutionX,r.resolutionY=e.resolutionY,r.sizeX=e.sizeX,r.sizeY=e.sizeY,r.pixelDepth=t,i=!1}if(e[l].toLowerCase().indexOf("edid:")>=0&&(i=!0,c=e[l].search(/\S|$/)),e[l].toLowerCase().indexOf("*current")>=0){const t=e[l].split("(");if(t&&t.length>1&&t[0].indexOf("x")>=0){const e=t[0].trim().split("x");r.currentResX=a.toInt(e[0]),r.currentResY=a.toInt(e[1])}o=!0}if(o&&e[l].toLowerCase().indexOf("clock")>=0&&e[l].toLowerCase().indexOf("hz")>=0&&e[l].toLowerCase().indexOf("v: height")>=0){const t=e[l].split("clock");t&&t.length>1&&t[1].toLowerCase().indexOf("hz")>=0&&(r.currentRefreshRate=a.toInt(t[1])),o=!1}}return(r.model||r.main||r.builtin||r.connection||null!==r.sizeX||null!==r.pixelDepth||null!==r.resolutionX)&&n.push(r),n}(e,s)}e&&e(i),t(i)}))}))}))}))}if((f||h||m)&&(e&&e(null),t(null)),g&&(e&&e(null),t(null)),d)try{const o=[];o.push(a.wmic("path win32_VideoController get /value")),o.push(a.wmic("path win32_desktopmonitor get /value")),o.push(a.powerShell("Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl")),o.push(a.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens")),o.push(a.powerShell("Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl")),o.push(a.powerShell('gwmi WmiMonitorID -Namespace root\\wmi | ForEach-Object {(($_.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + $_.InstanceName}'));const s=n();Promise.all(o).then((n=>{let o=n[0].split(/\n\s*\n/);i.controllers=function(e){let t=[];for(let n in e)if({}.hasOwnProperty.call(e,n)&&""!==e[n].trim()){let r=e[n].trim().split("\r\n"),i=a.getValue(r,"PNPDeviceID","=").match(/SUBSYS_[a-fA-F\d]{8}/),o=null;i&&(o=i[0],o&&(o=o.split("_")[1])),t.push({vendor:a.getValue(r,"AdapterCompatibility","="),model:a.getValue(r,"name","="),bus:a.getValue(r,"PNPDeviceID","=").startsWith("PCI")?"PCI":"",vram:a.toInt(a.getValue(r,"AdapterRAM","="))/1024/1024,vramDynamic:"2"===a.getValue(r,"VideoMemoryType","="),subDeviceId:o}),v=a.toInt(a.getValue(r,"CurrentHorizontalResolution","="))||v,y=a.toInt(a.getValue(r,"CurrentVerticalResolution","="))||y,E=a.toInt(a.getValue(r,"CurrentRefreshRate","="))||E,_=a.toInt(a.getValue(r,"CurrentBitsPerPixel","="))||_}return t}(o),i.controllers=i.controllers.map((e=>"nvidia"===e.vendor.toLowerCase()?c(e,s.find((t=>{let n=e.subDeviceId.toLowerCase();const r=t.subDeviceId.split("x");let i=r.length>1?r[1].toLowerCase():r[0].toLowerCase();const o=Math.abs(n.length-i.length);if(n.length>i.length)for(let e=0;e{const t=e.split("|");5===t.length&&h.push({vendor:t[0],code:t[1],model:t[2],serial:t[3],instanceId:t[4]})})),i.displays=function(e,t,n,i,o){let s=[],c="",l="",u="",p=0,d=0;if(n&&n.length){let e=n[0].split(r.EOL);c=a.getValue(e,"MonitorManufacturer","="),l=a.getValue(e,"Name","="),u=a.getValue(e,"PNPDeviceID","=").replace(/&/g,"&").toLowerCase(),p=a.toInt(a.getValue(e,"ScreenWidth","=")),d=a.toInt(a.getValue(e,"ScreenHeight","="))}for(let n=0;n{e.instanceId.toLowerCase().startsWith(_)&&c.startsWith("(")&&l.startsWith("PnP")&&(S=e.vendor,I=e.model)})),s.push({vendor:_.startsWith(u)&&""===S?c:S,model:_.startsWith(u)&&""===I?l:I,deviceName:w,main:"true"===g.toLowerCase(),builtin:"2147483648"===E,connection:E&&b[E]?b[E]:"",resolutionX:a.toInt(a.getValue(m,"Width","=")),resolutionY:a.toInt(a.getValue(m,"Height","=")),sizeX:v?parseInt(v,10):null,sizeY:y?parseInt(y,10):null,pixelDepth:h,currentResX:a.toInt(a.getValue(m,"Width","=")),currentResY:a.toInt(a.getValue(m,"Height","=")),positionX:a.toInt(a.getValue(m,"X","=")),positionY:a.toInt(a.getValue(m,"Y","="))})}0===e.length&&s.push({vendor:c,model:l,main:!0,sizeX:null,sizeY:null,resolutionX:p,resolutionY:d,pixelDepth:null,currentResX:p,currentResY:d,positionX:0,positionY:0});return s}(p,u,l,d,h),1===i.displays.length&&(v&&(i.displays[0].resolutionX=v,i.displays[0].currentResX||(i.displays[0].currentResX=v)),y&&(i.displays[0].resolutionY=y,0===i.displays[0].currentResY&&(i.displays[0].currentResY=y)),_&&(i.displays[0].pixelDepth=_),E&&!i.displays[0].refreshRate&&(i.displays[0].currentRefreshRate=E)),e&&e(i),t(i)})).catch((()=>{e&&e(i),t(i)}))}catch(n){e&&e(i),t(i)}}))}))}},294:(e,t,n)=>{"use strict";const r=n(702).i8,i=n(1453),o=n(1617),s=n(6599),a=n(51),c=n(6144),l=n(5953),u=n(559),p=n(2683),d=n(6926),f=n(2023),h=n(1111),m=n(840),g=n(2795),v=n(8725),y=n(4869),_=n(8958),E=n(3932),b=n(7250),w=n(7381);let S=process.platform;const I="win32"===S,C="freebsd"===S,x="openbsd"===S,O="netbsd"===S,T="sunos"===S;function A(){return r}function N(e){return new Promise((t=>{process.nextTick((()=>{let n={};n.version=A(),Promise.all([o.system(),o.bios(),o.baseboard(),o.chassis(),s.osInfo(),s.uuid(),s.versions(),a.cpu(),a.cpuFlags(),u.graphics(),d.networkInterfaces(),c.memLayout(),p.diskLayout()]).then((r=>{n.system=r[0],n.bios=r[1],n.baseboard=r[2],n.chassis=r[3],n.os=r[4],n.uuid=r[5],n.versions=r[6],n.cpu=r[7],n.cpu.flags=r[8],n.graphics=r[9],n.net=r[10],n.memLayout=r[11],n.diskLayout=r[12],e&&e(n),t(n)}))}))}))}function P(e,t,n){return i.isFunction(t)&&(n=t,t=""),i.isFunction(e)&&(n=e,e=""),new Promise((r=>{process.nextTick((()=>{t=t||d.getDefaultNetworkInterface(),e=e||"";let i=function(){let e=15;return I&&(e=13),(C||x||O)&&(e=11),T&&(e=6),function(){0==--e&&(n&&n(o),r(o))}}(),o={};o.time=s.time(),o.node=process.versions.node,o.v8=process.versions.v8,a.cpuCurrentSpeed().then((e=>{o.cpuCurrentSpeed=e,i()})),m.users().then((e=>{o.users=e,i()})),h.processes().then((e=>{o.processes=e,i()})),a.currentLoad().then((e=>{o.currentLoad=e,i()})),T||a.cpuTemperature().then((e=>{o.temp=e,i()})),x||C||O||T||d.networkStats(t).then((e=>{o.networkStats=e,i()})),T||d.networkConnections().then((e=>{o.networkConnections=e,i()})),c.mem().then((e=>{o.mem=e,i()})),T||l().then((e=>{o.battery=e,i()})),T||h.services(e).then((e=>{o.services=e,i()})),T||p.fsSize().then((e=>{o.fsSize=e,i()})),I||x||C||O||T||p.fsStats().then((e=>{o.fsStats=e,i()})),I||x||C||O||T||p.disksIO().then((e=>{o.disksIO=e,i()})),x||C||O||T||f.wifiNetworks().then((e=>{o.wifiNetworks=e,i()})),g.inetLatency().then((e=>{o.inetLatency=e,i()}))}))}))}function L(e,n){return new Promise((r=>{process.nextTick((()=>{const i=Object.keys(e).filter((e=>({}.hasOwnProperty.call(t,e)))).map((n=>{const r=e[n].substring(e[n].lastIndexOf("(")+1,e[n].lastIndexOf(")"));let i=n.indexOf(")")>=0?n.split(")")[1].trim():n;return i=n.indexOf("|")>=0?n.split("|")[0].trim():i,r?t[i](r):t[i]("")}));Promise.all(i).then((i=>{const o={};let s=0;for(let n in e)if({}.hasOwnProperty.call(e,n)&&{}.hasOwnProperty.call(t,n)&&i.length>s){if("*"===e[n]||"all"===e[n])o[n]=i[s];else{let t=e[n],r="",a=[];if(t.indexOf(")")>=0&&(t=t.split(")")[1].trim()),t.indexOf("|")>=0&&(r=t.split("|")[1].trim(),a=r.split(":"),t=t.split("|")[0].trim()),t=t.replace(/,/g," ").replace(/ +/g," ").split(" "),i[s])if(Array.isArray(i[s])){const e=[];i[s].forEach((n=>{let i={};if(1!==t.length||"*"!==t[0]&&"all"!==t[0]?t.forEach((e=>{({}).hasOwnProperty.call(n,e)&&(i[e]=n[e])})):i=n,r&&2===a.length){if({}.hasOwnProperty.call(i,a[0].trim())){const t=i[a[0].trim()];"number"==typeof t?t===parseFloat(a[1].trim())&&e.push(i):"string"==typeof t&&t.toLowerCase()===a[1].trim().toLowerCase()&&e.push(i)}}else e.push(i)})),o[n]=e}else{const e={};t.forEach((t=>{({}).hasOwnProperty.call(i[s],t)&&(e[t]=i[s][t])})),o[n]=e}else o[n]={}}s++}n&&n(o),r(o)}))}))}))}I&&i.getCodepage(),t.version=A,t.system=o.system,t.bios=o.bios,t.baseboard=o.baseboard,t.chassis=o.chassis,t.time=s.time,t.osInfo=s.osInfo,t.versions=s.versions,t.shell=s.shell,t.uuid=s.uuid,t.cpu=a.cpu,t.cpuFlags=a.cpuFlags,t.cpuCache=a.cpuCache,t.cpuCurrentSpeed=a.cpuCurrentSpeed,t.cpuTemperature=a.cpuTemperature,t.currentLoad=a.currentLoad,t.fullLoad=a.fullLoad,t.mem=c.mem,t.memLayout=c.memLayout,t.battery=l,t.graphics=u.graphics,t.fsSize=p.fsSize,t.fsOpenFiles=p.fsOpenFiles,t.blockDevices=p.blockDevices,t.fsStats=p.fsStats,t.disksIO=p.disksIO,t.diskLayout=p.diskLayout,t.networkInterfaceDefault=d.networkInterfaceDefault,t.networkGatewayDefault=d.networkGatewayDefault,t.networkInterfaces=d.networkInterfaces,t.networkStats=d.networkStats,t.networkConnections=d.networkConnections,t.wifiNetworks=f.wifiNetworks,t.wifiInterfaces=f.wifiInterfaces,t.wifiConnections=f.wifiConnections,t.services=h.services,t.processes=h.processes,t.processLoad=h.processLoad,t.users=m.users,t.inetChecksite=g.inetChecksite,t.inetLatency=g.inetLatency,t.dockerInfo=v.dockerInfo,t.dockerImages=v.dockerImages,t.dockerContainers=v.dockerContainers,t.dockerContainerStats=v.dockerContainerStats,t.dockerContainerProcesses=v.dockerContainerProcesses,t.dockerVolumes=v.dockerVolumes,t.dockerAll=v.dockerAll,t.vboxInfo=y.vboxInfo,t.printer=_.printer,t.usb=E.usb,t.audio=b.audio,t.bluetoothDevices=w.bluetoothDevices,t.getStaticData=N,t.getDynamicData=P,t.getAllData=function(e,t,n){return new Promise((r=>{process.nextTick((()=>{let o={};t&&i.isFunction(t)&&!n&&(n=t,t=""),e&&i.isFunction(e)&&!t&&!n&&(n=e,e="",t=""),N().then((i=>{o=i,P(e,t).then((e=>{for(let t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t]);n&&n(o),r(o)}))}))}))}))},t.get=L,t.observe=function(e,t,n){let r=null;return setInterval((()=>{L(e).then((e=>{JSON.stringify(r)!==JSON.stringify(e)&&(r=Object.assign({},e),n(e))}))}),t)}},2795:(e,t,n)=>{"use strict";const r=n(1453);let i=process.platform;const o="linux"===i,s="darwin"===i,a="win32"===i,c="freebsd"===i,l="openbsd"===i,u="netbsd"===i,p="sunos"===i;t.inetChecksite=function(e,t){return new Promise((i=>{process.nextTick((()=>{let d={url:e,ok:!1,status:404,ms:null};if("string"!=typeof e)return t&&t(d),i(d);let f="";const h=r.sanitizeShellString(e,!0);for(let e=0;e<=r.mathMin(h.length,2e3);e++)if(void 0!==h[e]){h[e].__proto__.toLowerCase=r.stringToLower;const t=h[e].toLowerCase();t&&t[0]&&!t[1]&&1===t[0].length&&(f+=t[0])}d.url=f;try{if(f&&!r.isPrototypePolluted()){if(f.__proto__.startsWith=r.stringStartWith,f.startsWith("file:")||f.startsWith("gopher:")||f.startsWith("telnet:")||f.startsWith("mailto:")||f.startsWith("news:")||f.startsWith("nntp:"))return t&&t(d),i(d);let e=Date.now();if(o||c||l||u||s||p){let n=["-I","--connect-timeout","5","-m","5"];n.push(f);let o="curl";r.execSafe(o,n).then((n=>{const r=n.split("\n");let o=r[0]&&r[0].indexOf(" ")>=0?parseInt(r[0].split(" ")[1],10):404;d.status=o||404,d.ok=200===o||301===o||302===o||304===o,d.ms=d.ok?Date.now()-e:null,t&&t(d),i(d)}))}if(a){const r=f.startsWith("https:")?n(7211):n(8605);try{r.get(f,(n=>{const r=n.statusCode;d.status=r||404,d.ok=200===r||301===r||302===r||304===r,200!==r?(n.resume(),d.ms=d.ok?Date.now()-e:null,t&&t(d),i(d)):(n.on("data",(()=>{})),n.on("end",(()=>{d.ms=d.ok?Date.now()-e:null,t&&t(d),i(d)})))})).on("error",(()=>{t&&t(d),i(d)}))}catch(e){t&&t(d),i(d)}}}else t&&t(d),i(d)}catch(e){t&&t(d),i(d)}}))}))},t.inetLatency=function(e,t){return r.isFunction(e)&&!t&&(t=e,e=""),e=e||"8.8.8.8",new Promise((n=>{process.nextTick((()=>{if("string"!=typeof e)return t&&t(null),n(null);let i="";const d=(r.isPrototypePolluted()?"8.8.8.8":r.sanitizeShellString(e,!0)).trim();for(let e=0;e<=r.mathMin(d.length,2e3);e++)if(void 0!==d[e]){d[e].__proto__.toLowerCase=r.stringToLower;const t=d[e].toLowerCase();t&&t[0]&&!t[1]&&(i+=t[0])}if(i.__proto__.startsWith=r.stringStartWith,i.startsWith("file:")||i.startsWith("gopher:")||i.startsWith("telnet:")||i.startsWith("mailto:")||i.startsWith("news:")||i.startsWith("nntp:"))return t&&t(null),n(null);let f,h;if((o||c||l||u||s)&&(o&&(f=["-c","2","-w","3",i],h="rtt"),(c||l||u)&&(f=["-c","2","-t","3",i],h="round-trip"),s&&(f=["-c2","-t3",i],h="avg"),r.execSafe("ping",f).then((e=>{let r=null;if(e){const t=e.split("\n").filter((e=>e.indexOf(h)>=0)).join("\n").split("=");if(t.length>1){const e=t[1].split("/");e.length>1&&(r=parseFloat(e[1]))}}t&&t(r),n(r)}))),p){const e=["-s","-a",i,"56","2"],o="avg";r.execSafe("ping",e,{timeout:3e3}).then((e=>{let r=null;if(e){const t=e.split("\n").filter((e=>e.indexOf(o)>=0)).join("\n").split("=");if(t.length>1){const e=t[1].split("/");e.length>1&&(r=parseFloat(e[1].replace(",",".")))}}t&&t(r),n(r)}))}if(a){let e=null;try{const o=[i,"-n","1"];r.execSafe("ping",o,r.execOptsWin).then((r=>{if(r){let t=r.split("\r\n");t.shift(),t.forEach((function(t){if(3===(t.toLowerCase().match(/ms/g)||[]).length){let n=t.replace(/ +/g," ").split(" ");n.length>6&&(e=parseFloat(n[n.length-1]))}}))}t&&t(e),n(e)}))}catch(r){t&&t(e),n(e)}}}))}))}},6144:(e,t,n)=>{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(1453),a=n(5747);let c=process.platform;const l="linux"===c,u="darwin"===c,p="win32"===c,d="freebsd"===c,f="openbsd"===c,h="netbsd"===c,m="sunos"===c,g={"0x014F":"Transcend Information","0x2C00":"Micron Technology Inc.","0x802C":"Micron Technology Inc.","0x80AD":"Hynix Semiconductor Inc.","0x80CE":"Samsung Electronics Inc.","0xAD00":"Hynix Semiconductor Inc.","0xCE00":"Samsung Electronics Inc.","0x02FE":"Elpida","0x5105":"Qimonda AG i. In.","0x8551":"Qimonda AG i. In.","0x859B":"Crucial","0x04CD":"G-Skill"},v={"017A":"Apacer","0198":"HyperX","029E":"Corsair","04CB":"A-DATA","04CD":"G-Skill","059B":"Crucial","00CE":"Samsung",1315:"Crutial","014F":"Transcend Information","2C00":"Micron Technology Inc.","802C":"Micron Technology Inc.","80AD":"Hynix Semiconductor Inc.","80CE":"Samsung Electronics Inc.",AD00:"Hynix Semiconductor Inc.",CE00:"Samsung Electronics Inc.","02FE":"Elpida",5105:"Qimonda AG i. In.",8551:"Qimonda AG i. In.","859B":"Crucial"};t.mem=function(e){return new Promise((t=>{process.nextTick((()=>{let n={total:r.totalmem(),free:r.freemem(),used:r.totalmem()-r.freemem(),active:r.totalmem()-r.freemem(),available:r.freemem(),buffers:0,cached:0,slab:0,buffcache:0,swaptotal:0,swapused:0,swapfree:0};if(l&&a.readFile("/proc/meminfo",(function(i,o){if(!i){const e=o.toString().split("\n");n.total=parseInt(s.getValue(e,"memtotal"),10),n.total=n.total?1024*n.total:r.totalmem(),n.free=parseInt(s.getValue(e,"memfree"),10),n.free=n.free?1024*n.free:r.freemem(),n.used=n.total-n.free,n.buffers=parseInt(s.getValue(e,"buffers"),10),n.buffers=n.buffers?1024*n.buffers:0,n.cached=parseInt(s.getValue(e,"cached"),10),n.cached=n.cached?1024*n.cached:0,n.slab=parseInt(s.getValue(e,"slab"),10),n.slab=n.slab?1024*n.slab:0,n.buffcache=n.buffers+n.cached+n.slab;let t=parseInt(s.getValue(e,"memavailable"),10);n.available=t?1024*t:n.free+n.buffcache,n.active=n.total-n.available,n.swaptotal=parseInt(s.getValue(e,"swaptotal"),10),n.swaptotal=n.swaptotal?1024*n.swaptotal:0,n.swapfree=parseInt(s.getValue(e,"swapfree"),10),n.swapfree=n.swapfree?1024*n.swapfree:0,n.swapused=n.swaptotal-n.swapfree}e&&e(n),t(n)})),(d||f||h)&&i('/sbin/sysctl -a 2>/dev/null | grep -E "hw.realmem|hw.physmem|vm.stats.vm.v_page_count|vm.stats.vm.v_wire_count|vm.stats.vm.v_active_count|vm.stats.vm.v_inactive_count|vm.stats.vm.v_cache_count|vm.stats.vm.v_free_count|vm.stats.vm.v_page_size"',(function(r,i){if(!r){let e=i.toString().split("\n");const t=parseInt(s.getValue(e,"vm.stats.vm.v_page_size"),10),r=parseInt(s.getValue(e,"vm.stats.vm.v_inactive_count"),10)*t,o=parseInt(s.getValue(e,"vm.stats.vm.v_cache_count"),10)*t;n.total=parseInt(s.getValue(e,"hw.realmem"),10),isNaN(n.total)&&(n.total=parseInt(s.getValue(e,"hw.physmem"),10)),n.free=parseInt(s.getValue(e,"vm.stats.vm.v_free_count"),10)*t,n.buffcache=r+o,n.available=n.buffcache+n.free,n.active=n.total-n.free-n.buffcache,n.swaptotal=0,n.swapfree=0,n.swapused=0}e&&e(n),t(n)})),m&&(e&&e(n),t(n)),u&&i('vm_stat 2>/dev/null | grep "Pages active"',(function(r,o){if(!r){let e=o.toString().split("\n");n.active=4096*parseInt(e[0].split(":")[1],10),n.buffcache=n.used-n.active,n.available=n.free+n.buffcache}i("sysctl -n vm.swapusage 2>/dev/null",(function(r,i){if(!r){let e=i.toString().split("\n");if(e.length>0){let t=e[0].replace(/,/g,".").replace(/M/g,"");t=t.trim().split(" ");for(let e=0;e{if(!s){o.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(e){""!==e&&(e=e.trim().split(/\s\s+/),r+=parseInt(e[0],10),i+=parseInt(e[1],10))}))}n.swaptotal=1024*r*1024,n.swapused=1024*i*1024,n.swapfree=n.swaptotal-n.swapused,e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}}))}))},t.memLayout=function(e){function t(e){const t=e.replace("0x","").toUpperCase();return 4===t.length&&{}.hasOwnProperty.call(v,t)?v[t]:e}return new Promise((n=>{process.nextTick((()=>{let a=[];if((l||d||f||h)&&i('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL',(function(i,c){if(!i){let e=c.toString().split("Memory Device");e.shift(),e.forEach((function(e){let n=e.split("\n");const r=s.getValue(n,"Size"),i=r.indexOf("GB")>=0?1024*parseInt(r,10)*1024*1024:1024*parseInt(r,10)*1024;if(parseInt(s.getValue(n,"Size"),10)>0){const e=s.toInt(s.getValue(n,"Total Width")),r=s.toInt(s.getValue(n,"Data Width"));a.push({size:i,bank:s.getValue(n,"Bank Locator"),type:s.getValue(n,"Type:"),ecc:!(!r||!e)&&e>r,clockSpeed:s.getValue(n,"Configured Clock Speed:")?parseInt(s.getValue(n,"Configured Clock Speed:"),10):s.getValue(n,"Speed:")?parseInt(s.getValue(n,"Speed:"),10):null,formFactor:s.getValue(n,"Form Factor:"),manufacturer:t(s.getValue(n,"Manufacturer:")),partNum:s.getValue(n,"Part Number:"),serialNum:s.getValue(n,"Serial Number:"),voltageConfigured:parseFloat(s.getValue(n,"Configured Voltage:")||null),voltageMin:parseFloat(s.getValue(n,"Minimum Voltage:")||null),voltageMax:parseFloat(s.getValue(n,"Maximum Voltage:")||null)})}else a.push({size:0,bank:s.getValue(n,"Bank Locator"),type:"Empty",ecc:null,clockSpeed:0,formFactor:s.getValue(n,"Form Factor:"),partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}))}if(!a.length){a.push({size:r.totalmem(),bank:"",type:"",ecc:null,clockSpeed:0,formFactor:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null});try{let e=o("cat /proc/cpuinfo 2>/dev/null"),t=e.toString().split("\n"),n=s.getValue(t,"hardware",":",!0).toUpperCase(),r=s.getValue(t,"revision",":",!0).toLowerCase();if("BCM2835"===n||"BCM2708"===n||"BCM2709"===n||"BCM2835"===n||"BCM2837"===n){const n={0:400,1:450,2:450,3:3200};a[0].type="LPDDR2",a[0].type=r&&r[2]&&"3"===r[2]?"LPDDR4":a[0].type,a[0].ecc=!1,a[0].clockSpeed=r&&r[2]&&n[r[2]]||400,a[0].clockSpeed=r&&r[4]&&"d"===r[4]?"500":a[0].clockSpeed,a[0].formFactor="SoC",e=o("vcgencmd get_config sdram_freq 2>/dev/null"),t=e.toString().split("\n");let i=parseInt(s.getValue(t,"sdram_freq","=",!0),10)||0;i&&(a.clockSpeed=i),e=o("vcgencmd measure_volts sdram_p 2>/dev/null"),t=e.toString().split("\n");let c=parseFloat(s.getValue(t,"volt","=",!0))||0;c&&(a[0].voltageConfigured=c,a[0].voltageMin=c,a[0].voltageMax=c)}}catch(e){s.noop()}}e&&e(a),n(a)})),u&&i("system_profiler SPMemoryDataType",(function(t,r){if(!t){const e=r.toString().split("\n"),t=s.getValue(e,"ecc",":",!0).toLowerCase();let n=r.toString().split(" BANK "),i=!0;1===n.length&&(n=r.toString().split(" DIMM"),i=!1),n.shift(),n.forEach((function(e){let n=e.split("\n");const r=(i?"BANK ":"DIMM")+n[0].trim().split("/")[0],o=parseInt(s.getValue(n," Size"));var c;o?a.push({size:1024*o*1024*1024,bank:r,type:s.getValue(n," Type:"),ecc:t?"enabled"===t:null,clockSpeed:parseInt(s.getValue(n," Speed:"),10),formFactor:"",manufacturer:(c=s.getValue(n," Manufacturer:"),{}.hasOwnProperty.call(g,c)?g[c]:c),partNum:s.getValue(n," Part Number:"),serialNum:s.getValue(n," Serial Number:"),voltageConfigured:null,voltageMin:null,voltageMax:null}):a.push({size:0,bank:r,type:"Empty",ecc:null,clockSpeed:0,formFactor:"",manufacturer:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}))}if(!a.length){const e=r.toString().split("\n"),t=parseInt(s.getValue(e," Memory:")),n=s.getValue(e," Type:");t&&n&&a.push({size:1024*t*1024*1024,bank:0,type:n,ecc:!1,clockSpeed:0,formFactor:"",manufacturer:"Apple",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}e&&e(a),n(a)})),m&&(e&&e(a),n(a)),p){const t="Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4".split("|"),r="Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA".split("|");try{s.wmic("memorychip get /value").then(((i,o)=>{if(!o){let e=i.toString().split("BankL");e.shift(),e.forEach((function(e){let n=e.split("\r\n");const i=s.toInt(s.getValue(n,"DataWidth","=")),o=s.toInt(s.getValue(n,"TotalWidth","="));a.push({size:parseInt(s.getValue(n,"Capacity","="),10)||0,bank:s.getValue(n,"abel","="),type:t[parseInt(s.getValue(n,"MemoryType","="),10)],ecc:!(!i||!o)&&o>i,clockSpeed:parseInt(s.getValue(n,"ConfiguredClockSpeed","="),10)||0,formFactor:r[parseInt(s.getValue(n,"FormFactor","="),10)||0],manufacturer:s.getValue(n,"Manufacturer","="),partNum:s.getValue(n,"PartNumber","="),serialNum:s.getValue(n,"SerialNumber","="),voltageConfigured:(parseInt(s.getValue(n,"ConfiguredVoltage","="),10)||0)/1e3,voltageMin:(parseInt(s.getValue(n,"MinVoltage","="),10)||0)/1e3,voltageMax:(parseInt(s.getValue(n,"MaxVoltage","="),10)||0)/1e3})}))}e&&e(a),n(a)}))}catch(t){e&&e(a),n(a)}}}))}))}},6926:(e,t,n)=>{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(5747),a=n(1453);let c=process.platform;const l="linux"===c,u="darwin"===c,p="win32"===c,d="freebsd"===c,f="openbsd"===c,h="netbsd"===c,m="sunos"===c;let g,v={},y="",_={},E=[],b=[],w={};function S(){let e=r.networkInterfaces(),t="",n="",i=9999;for(let r in e)({}).hasOwnProperty.call(e,r)&&e[r].forEach((function(e){e&&!1===e.internal&&(n=n||r,e.scopeid&&e.scopeid{if((e=e.replace(/\s+/g," ").trim()).indexOf("0.0.0.0 0.0.0.0")>-1&&!/[a-zA-Z]/.test(e)){const t=e.split(" ");t.length>=5&&(n=t[t.length-2])}})),n)for(let r in e)({}).hasOwnProperty.call(e,r)&&e[r].forEach((function(e){e&&e.address&&e.address===n&&(t=r)}))}if(l){let e=o("ip route 2> /dev/null | grep default").toString().split("\n")[0].split(/\s+/);"none"===e[0]&&e[5]?t=e[5]:e[4]&&(t=e[4]),t.indexOf(":")>-1&&(t=t.split(":")[1].trim())}if(u||d||f||h||m){let e="";l&&(e="ip route 2> /dev/null | grep default | awk '{print $5}'"),u&&(e="route -n get default 2>/dev/null | grep interface: | awk '{print $2}'"),(d||f||h||m)&&(e="route get 0.0.0.0 | grep interface:");let n=o(e);t=n.toString().split("\n")[0],t.indexOf(":")>-1&&(t=t.split(":")[1].trim())}}catch(e){a.noop()}return t&&(y=t),y}function I(){let e="",t="",n={};if(l||d||f||h){if(void 0===g)try{const e=o("which ip").toString().split("\n");g=e.length&&-1===e[0].indexOf(":")&&0===e[0].indexOf("/")?e[0]:""}catch(e){g=""}try{const r=o("export LC_ALL=C; "+(g?g+" link show up":"/sbin/ifconfig")+"; unset LC_ALL").toString().split("\n");for(let i=0;i0?e=r[i].split(":")[0]:0===r[i].indexOf("\tether ")&&(t=r[i].split("\tether ")[1],e&&t&&(n[e]=t.trim(),e="",t=""))}catch(e){a.noop()}return n}function C(){const e=a.getWmic()+" nic get MACAddress, name, NetConnectionId, NetEnabled, Speed, NetConnectionStatus, AdapterTypeId /value",t=a.getWmic()+" nicconfig get dhcpEnabled /value";try{const n=o(e,a.execOptsWin).split(/\n\s*\n/);return function(e,t){let n=[];for(let r in e)if({}.hasOwnProperty.call(e,r)&&""!==e[r].trim()){let i=e[r].trim().split("\r\n"),o=t[r].trim().split("\r\n"),s=a.getValue(i,"NetEnabled","="),c="9"===a.getValue(i,"AdapterTypeID","=")?"wireless":"wired",l=a.getValue(i,"Name","=").replace(/\]/g,")").replace(/\[/g,"("),u=a.getValue(i,"NetConnectionID","=").replace(/\]/g,")").replace(/\[/g,"(");if((l.toLowerCase().indexOf("wi-fi")>=0||l.toLowerCase().indexOf("wireless")>=0)&&(c="wireless"),""!==s){const e=parseInt(a.getValue(i,"speed","=").trim(),10)/1e6;n.push({mac:a.getValue(i,"MACAddress","=").toLowerCase(),dhcp:a.getValue(o,"dhcpEnabled","=").toLowerCase(),name:l,iface:u,netEnabled:"TRUE"===s,speed:isNaN(e)?null:e,operstate:"2"===a.getValue(i,"NetConnectionStatus","=")?"up":"down",type:c})}}return n}(n,o(t,a.execOptsWin).split(/\n\s*\n/))}catch(e){return[]}}function x(e,t){let n="";const r=t+".";try{const t=e.filter((e=>r.includes(e.name+"."))).map((e=>e.dnsSuffix));return t[0]&&(n=t[0]),n||(n=""),n}catch(e){return"Unknown"}}function O(e,t,n){let r={state:"Unknown",protocol:"Unknown"};if("Disabled"===n)return r.state="Disabled",r.protocol="Not defined",r;if("wired"==e&&n.length>0)try{const e=n.find((e=>e.includes(t+"\r\n"))).split("\r\n"),i=e.find((e=>e.includes("802.1x")));if(i.includes("Disabled"))r.state="Disabled",r.protocol="Not defined";else if(i.includes("Enabled")){const t=e.find((e=>e.includes("EAP")));r.protocol=t.split(":").pop(),r.state="Enabled"}}catch(e){return r}else if("wireless"==e){let e="",n="";try{const i=function(e){try{return o(`netsh wlan show interface name="${e}" | findstr "SSID"`,a.execOptsWin).split("\r\n").shift().split(":").pop()}catch(e){return"Unknown"}}(t);"Unknown"!==i&&(e=o(`netsh wlan show profiles "${i}" | findstr "802.1X"`,a.execOptsWin),n=o(`netsh wlan show profiles "${i}" | findstr "EAP"`,a.execOptsWin)),e.includes(":")&&n.includes(":")&&(r.state=e.split(":").pop(),r.protocol=n.split(":").pop())}catch(e){return 1===e.status&&e.stdout.includes("AutoConfig")&&(r.state="Disabled",r.protocol="Not defined"),r}}return r}function T(e){const t=[];let n=[];return e.forEach((function(e){e.startsWith("\t")||e.startsWith(" ")||n.length&&(t.push(n),n=[]),n.push(e)})),n.length&&t.push(n),t}function A(){try{const e=o("/sbin/ifconfig -v",{maxBuffer:2048e4}).toString().split("\n");return function(e){let t=[];return e.forEach((e=>{let n={iface:"",mtu:null,mac:"",ip6:"",ip4:"",speed:null,type:"",operstate:"",duplex:"",internal:!1};const r=e[0];n.iface=r.split(":")[0].trim();let i=r.split("> mtu");n.mtu=i.length>1?parseInt(i[1],10):null,isNaN(n.mtu)&&(n.mtu=null),n.internal=i[0].toLowerCase().indexOf("loopback")>-1,e.forEach((e=>{e.trim().startsWith("ether ")&&(n.mac=e.split("ether ")[1].toLowerCase().trim()),e.trim().startsWith("inet6 ")&&!n.ip6&&(n.ip6=e.split("inet6 ")[1].toLowerCase().split("%")[0].split(" ")[0]),e.trim().startsWith("inet ")&&!n.ip4&&(n.ip4=e.split("inet ")[1].toLowerCase().split(" ")[0])}));let o=a.getValue(e,"link rate");n.speed=o?parseFloat(o):null,null===n.speed?(o=a.getValue(e,"uplink rate"),n.speed=o?parseFloat(o):null,null!==n.speed&&o.toLowerCase().indexOf("gbps")>=0&&(n.speed=1e3*n.speed)):o.toLowerCase().indexOf("gbps")>=0&&(n.speed=1e3*n.speed),n.type=a.getValue(e,"type").toLowerCase().indexOf("wi-fi")>-1?"wireless":"wired",n.operstate=a.getValue(e,"status").toLowerCase().indexOf("active")>-1?"up":"down",n.duplex=a.getValue(e,"media").toLowerCase().indexOf("half-duplex")>-1?"half":"full",(n.ip6||n.ip4||n.mac)&&t.push(n)})),t}(T(e))}catch(e){return[]}}function N(e){const t=`nmcli device status 2>/dev/null | grep ${e}`;try{const e=o(t).toString().replace(/\s+/g," ").trim(),n=e.split(" ").slice(3).join(" ");return"--"!=n?n:""}catch(e){return""}}function P(e){let t=[];try{let n=`cat ${e} 2> /dev/null | grep 'iface\\|source'`;o(n,{maxBuffer:2048e4}).toString().split("\n").forEach((e=>{const n=e.replace(/\s+/g," ").trim().split(" ");if(n.length>=4&&e.toLowerCase().indexOf(" inet ")>=0&&e.toLowerCase().indexOf("dhcp")>=0&&t.push(n[1]),e.toLowerCase().includes("source")){let n=e.split(" ")[1];t=t.concat(P(n))}}))}catch(e){a.noop()}return t}function L(){let e=[];try{const t=o("ip a 2> /dev/null",{maxBuffer:2048e4}).toString().split("\n");e=function(e){const t=[];e&&e.length&&e.forEach((e=>{if(e&&e.length){if(e[0].split(":").length>2)for(let n of e)if(n.indexOf(" inet ")>=0&&n.indexOf(" dynamic ")>=0){const e=n.split(" "),r=e[e.length-1].trim();t.push(r);break}}}));return t}(T(t))}catch(e){a.noop()}try{e=P("/etc/network/interfaces")}catch(e){a.noop()}return e}function R(e,t,n){let r=!1;if(!t)return n.indexOf(e)>=0;{const i=`nmcli connection show "${t}" 2>/dev/null | grep ipv4.method;`;try{const e=o(i).toString();switch(e.replace(/\s+/g," ").trim().split(" ").slice(1).toString()){case"auto":r=!0;break;default:r=!1}return r}catch(t){return n.indexOf(e)>=0}}}function D(e){let t=!1;const n=`ipconfig getpacket "${e}" 2>/dev/null | grep lease_time;`;try{const e=o(n).toString().split("\n");e.length&&e[0].startsWith("lease_time")&&(t=!0)}catch(e){a.noop()}return t}function k(e){if(!e)return"Unknown";{const t=`nmcli connection show "${e}" 2>/dev/null | grep ipv4.dns-search;`;try{const e=o(t).toString(),n=e.replace(/\s+/g," ").trim().split(" ").slice(1).toString();return"--"==n?"Not defined":n}catch(e){return"Unknown"}}}function M(e){if(!e)return"Not defined";{const t=`nmcli connection show "${e}" 2>/dev/null | grep 802-1x.eap;`;try{const e=o(t).toString(),n=e.replace(/\s+/g," ").trim().split(" ").slice(1).toString();return"--"==n?"":n}catch(e){return"Not defined"}}}function V(e,t,n){return!!n&&(["00:00:00:00:00:00","00:03:FF","00:05:69","00:0C:29","00:0F:4B","00:0F:4B","00:13:07","00:13:BE","00:15:5d","00:16:3E","00:1C:42","00:21:F6","00:21:F6","00:24:0B","00:24:0B","00:50:56","00:A0:B1","00:E0:C8","08:00:27","0A:00:27","18:92:2C","16:DF:49","3C:F3:92","54:52:00","FC:15:97"].filter((e=>n.toUpperCase().toUpperCase().startsWith(e.substr(0,n.length)))).length>0||e.toLowerCase().indexOf(" virtual ")>-1||t.toLowerCase().indexOf(" virtual ")>-1||e.toLowerCase().indexOf("vethernet ")>-1||t.toLowerCase().indexOf("vethernet ")>-1||e.toLowerCase().startsWith("veth")||t.toLowerCase().startsWith("veth")||e.toLowerCase().startsWith("vboxnet")||t.toLowerCase().startsWith("vboxnet"))}function F(e,t=!0){return"boolean"==typeof e&&(t=e,e=null),new Promise((n=>{process.nextTick((()=>{let i=r.networkInterfaces(),s=[],c=[],m=[],g=[];if(u||d||f||h)c=A(),c.forEach((e=>{({}).hasOwnProperty.call(i,e.iface)&&i[e.iface].forEach((function(t){"IPv4"===t.family&&(e.ip4subnet=t.netmask),"IPv6"===t.family&&(e.ip6subnet=t.netmask)})),s.push({iface:e.iface,ifaceName:e.iface,ip4:e.ip4,ip4subnet:e.ip4subnet||"",ip6:e.ip6,ip6subnet:e.ip6subnet||"",mac:e.mac,internal:e.internal,virtual:!e.internal&&V(e.iface,e.iface,e.mac),operstate:e.operstate,type:e.type,duplex:e.duplex,mtu:e.mtu,speed:e.speed,dhcp:D(e.iface),dnsSuffix:"",ieee8021xAuth:"",ieee8021xState:"",carrierChanges:0})})),b=s,e&&e(s),n(s);else if(JSON.stringify(i)!==JSON.stringify(_)||t){_=Object.assign({},i),p&&(c=C(),c.forEach((e=>{let t=!1;Object.keys(i).forEach((n=>{t||i[n].forEach((n=>{Object.keys(n).indexOf("mac")>=0&&(t=n.mac===e.mac)}))})),t||(i[e.name]=[{mac:e.mac}])})),g=function(){try{return o("netsh lan show profiles",a.execOptsWin).split("\r\nProfile on interface")}catch(e){return 1===e.status&&e.stdout.includes("AutoConfig")?"Disabled":[]}}(),m=function(){let e={},t={primaryDNS:"",exitCode:0,ifaces:[]};try{return o("ipconfig /all",a.execOptsWin).split("\r\n\r\n").forEach(((n,r)=>{if(1==r){const e=n.split("\r\n").filter((e=>e.toUpperCase().includes("DNS"))),r=e[0].substring(e[0].lastIndexOf(":")+1);t.primaryDNS=r.trim(),t.primaryDNS||(t.primaryDNS="Not defined")}if(r>1)if(r%2==0){const t=n.substring(n.lastIndexOf(" ")+1).replace(":","");e.name=t}else{const r=n.split("\r\n").filter((e=>e.toUpperCase().includes("DNS"))),i=r[0].substring(r[0].lastIndexOf(":")+1);e.dnsSuffix=i.trim(),t.ifaces.push(e),e={}}})),t}catch(e){return{primaryDNS:"",exitCode:0,ifaces:[]}}}()),l&&(E=L());for(let e in i){let t=e,n="",r="",d="",f="",h="",y="",_="",b=null,S=0,C="down",T=!1,A="",P="",L="",D="";if({}.hasOwnProperty.call(i,e)){let F=e;if(i[e].forEach((function(t){"IPv4"===t.family&&(n=t.address,r=t.netmask),"IPv6"===t.family&&(d&&!d.match(/^fe80::/i)||(d=t.address,f=t.netmask)),h=t.mac;const i=parseInt(process.versions.node.split("."),10);h.indexOf("00:00:0")>-1&&(l||u)&&!t.internal&&i>=8&&i<=11&&(0===Object.keys(w).length&&(w=I()),h=w[e]||"")})),l){let t=e.split(":")[0].trim().toLowerCase();const n=`echo -n "addr_assign_type: "; cat /sys/class/net/${t}/addr_assign_type 2>/dev/null; echo;\n echo -n "address: "; cat /sys/class/net/${t}/address 2>/dev/null; echo;\n echo -n "addr_len: "; cat /sys/class/net/${t}/addr_len 2>/dev/null; echo;\n echo -n "broadcast: "; cat /sys/class/net/${t}/broadcast 2>/dev/null; echo;\n echo -n "carrier: "; cat /sys/class/net/${t}/carrier 2>/dev/null; echo;\n echo -n "carrier_changes: "; cat /sys/class/net/${t}/carrier_changes 2>/dev/null; echo;\n echo -n "dev_id: "; cat /sys/class/net/${t}/dev_id 2>/dev/null; echo;\n echo -n "dev_port: "; cat /sys/class/net/${t}/dev_port 2>/dev/null; echo;\n echo -n "dormant: "; cat /sys/class/net/${t}/dormant 2>/dev/null; echo;\n echo -n "duplex: "; cat /sys/class/net/${t}/duplex 2>/dev/null; echo;\n echo -n "flags: "; cat /sys/class/net/${t}/flags 2>/dev/null; echo;\n echo -n "gro_flush_timeout: "; cat /sys/class/net/${t}/gro_flush_timeout 2>/dev/null; echo;\n echo -n "ifalias: "; cat /sys/class/net/${t}/ifalias 2>/dev/null; echo;\n echo -n "ifindex: "; cat /sys/class/net/${t}/ifindex 2>/dev/null; echo;\n echo -n "iflink: "; cat /sys/class/net/${t}/iflink 2>/dev/null; echo;\n echo -n "link_mode: "; cat /sys/class/net/${t}/link_mode 2>/dev/null; echo;\n echo -n "mtu: "; cat /sys/class/net/${t}/mtu 2>/dev/null; echo;\n echo -n "netdev_group: "; cat /sys/class/net/${t}/netdev_group 2>/dev/null; echo;\n echo -n "operstate: "; cat /sys/class/net/${t}/operstate 2>/dev/null; echo;\n echo -n "proto_down: "; cat /sys/class/net/${t}/proto_down 2>/dev/null; echo;\n echo -n "speed: "; cat /sys/class/net/${t}/speed 2>/dev/null; echo;\n echo -n "tx_queue_len: "; cat /sys/class/net/${t}/tx_queue_len 2>/dev/null; echo;\n echo -n "type: "; cat /sys/class/net/${t}/type 2>/dev/null; echo;\n echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${t}; echo;\n echo -n "wirelessspeed: "; iw dev ${t} link 2>&1 | grep bitrate; echo;`;let r=[];try{r=o(n).toString().split("\n");const e=N(t);T=R(t,e,E),A=k(e),P=M(e),L=(v=P)?"Not defined"==v?"Disabled":"Enabled":"Unknown"}catch(e){a.noop()}y=a.getValue(r,"duplex"),y=y.startsWith("cat")?"":y,_=parseInt(a.getValue(r,"mtu"),10);let i=parseInt(a.getValue(r,"speed"),10);b=isNaN(i)?null:i;let s=a.getValue(r,"wirelessspeed").split("tx bitrate: ");null===b&&2===s.length&&(i=parseFloat(s[1]),b=isNaN(i)?null:i),S=parseInt(a.getValue(r,"carrier_changes"),10),C=a.getValue(r,"operstate"),D="up"===C?a.getValue(r,"wireless").trim()?"wireless":"wired":"unknown",("lo"===t||t.startsWith("bond"))&&(D="virtual")}if(p){A=x(m.ifaces,e);let n=!1;c.forEach((e=>{e.mac!==h||n||(t=e.iface||t,F=e.name,T=e.dhcp,C=e.operstate,b=e.speed,D=e.type,n=!0)})),(e.toLowerCase().indexOf("wlan")>=0||F.toLowerCase().indexOf("wlan")>=0||F.toLowerCase().indexOf("802.11n")>=0||F.toLowerCase().indexOf("wireless")>=0||F.toLowerCase().indexOf("wi-fi")>=0||F.toLowerCase().indexOf("wifi")>=0)&&(D="wireless");const r=O(D,e,g);P=r.protocol,L=r.state}let B=!(!i[e]||!i[e][0])&&i[e][0].internal;(e.toLowerCase().indexOf("loopback")>-1||F.toLowerCase().indexOf("loopback")>-1)&&(B=!0);const j=!B&&V(e,F,h);s.push({iface:t,ifaceName:F,ip4:n,ip4subnet:r,ip6:d,ip6subnet:f,mac:h,internal:B,virtual:j,operstate:C,type:D,duplex:y,mtu:_,speed:b,dhcp:T,dnsSuffix:A,ieee8021xAuth:P,ieee8021xState:L,carrierChanges:S})}}b=s,e&&e(s),n(s)}else s=b,e&&e(s),n(s);var v}))}))}function B(e,t,n,r,i,o,s,a){let c={iface:e,operstate:r,rx_bytes:t,rx_dropped:i,rx_errors:o,tx_bytes:n,tx_dropped:s,tx_errors:a,rx_sec:null,tx_sec:null,ms:0};return v[e]&&v[e].ms?(c.ms=Date.now()-v[e].ms,c.rx_sec=t-v[e].rx_bytes>=0?(t-v[e].rx_bytes)/(c.ms/1e3):0,c.tx_sec=n-v[e].tx_bytes>=0?(n-v[e].tx_bytes)/(c.ms/1e3):0,v[e].rx_bytes=t,v[e].tx_bytes=n,v[e].rx_sec=c.rx_sec,v[e].tx_sec=c.tx_sec,v[e].ms=Date.now(),v[e].last_ms=c.ms,v[e].operstate=r):(v[e]||(v[e]={}),v[e].rx_bytes=t,v[e].tx_bytes=n,v[e].rx_sec=null,v[e].tx_sec=null,v[e].ms=Date.now(),v[e].last_ms=0,v[e].operstate=r),c}function j(e){return new Promise((t=>{process.nextTick((()=>{let n="";const r=a.isPrototypePolluted()?"---":a.sanitizeShellString(e);for(let e=0;e<=a.mathMin(r.length,2e3);e++)void 0!==r[e]&&(n+=r[e]);let o,c,m,g={iface:n,operstate:"unknown",rx_bytes:0,rx_dropped:0,rx_errors:0,tx_bytes:0,tx_dropped:0,tx_errors:0,rx_sec:null,tx_sec:null,ms:0},y="unknown",_=0,E=0,b=0,w=0,S=0,I=0;if(!v[n]||v[n]&&!v[n].ms||v[n]&&v[n].ms&&Date.now()-v[n].ms>=500){if(l&&(s.existsSync("/sys/class/net/"+n)?(o="cat /sys/class/net/"+n+"/operstate; cat /sys/class/net/"+n+"/statistics/rx_bytes; cat /sys/class/net/"+n+"/statistics/tx_bytes; cat /sys/class/net/"+n+"/statistics/rx_dropped; cat /sys/class/net/"+n+"/statistics/rx_errors; cat /sys/class/net/"+n+"/statistics/tx_dropped; cat /sys/class/net/"+n+"/statistics/tx_errors; ",i(o,(function(e,r){e||(c=r.toString().split("\n"),y=c[0].trim(),_=parseInt(c[1],10),E=parseInt(c[2],10),b=parseInt(c[3],10),w=parseInt(c[4],10),S=parseInt(c[5],10),I=parseInt(c[6],10),g=B(n,_,E,y,b,w,S,I)),t(g)}))):t(g)),(d||f||h)&&(o="netstat -ibndI "+n,i(o,(function(e,r){if(!e){c=r.toString().split("\n");for(let e=1;e1&&""!==c[1].trim())){m=c[1].replace(/ +/g," ").split(" ");const e=m.length>11?1:0;_=parseInt(m[e+5]),b=parseInt(m[e+10]),w=parseInt(m[e+4]),E=parseInt(m[e+8]),S=parseInt(m[e+10]),I=parseInt(m[e+7]),g=B(n,_,E,g.operstate,b,w,S,I)}t(g)}))}))),p){let e=[],r=n;a.wmic("path Win32_PerfRawData_Tcpip_NetworkInterface Get name,BytesReceivedPersec,BytesSentPersec,BytesTotalPersec,PacketsOutboundDiscarded,PacketsOutboundErrors,PacketsReceivedDiscarded,PacketsReceivedErrors /value").then(((i,o)=>{if(!o){const t=i.toString().split(/\n\s*\n/);e=function(e){let t=[];for(let n in e)if({}.hasOwnProperty.call(e,n)&&""!==e[n].trim()){let r=e[n].trim().split("\r\n");t.push({name:a.getValue(r,"Name","=").replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase(),rx_bytes:parseInt(a.getValue(r,"BytesReceivedPersec","="),10),rx_errors:parseInt(a.getValue(r,"PacketsReceivedErrors","="),10),rx_dropped:parseInt(a.getValue(r,"PacketsReceivedDiscarded","="),10),tx_bytes:parseInt(a.getValue(r,"BytesSentPersec","="),10),tx_errors:parseInt(a.getValue(r,"PacketsOutboundErrors","="),10),tx_dropped:parseInt(a.getValue(r,"PacketsOutboundDiscarded","="),10)})}return t}(t)}F(!1).then((i=>{_=0,E=0,e.forEach((e=>{i.forEach((t=>{t.iface.toLowerCase()!==n.toLowerCase()&&t.mac.toLowerCase()!==n.toLowerCase()&&t.ip4.toLowerCase()!==n.toLowerCase()&&t.ip6.toLowerCase()!==n.toLowerCase()&&t.ifaceName.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase()!==n.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase()||t.ifaceName.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase()!==e.name||(r=t.iface,_=e.rx_bytes,b=e.rx_dropped,w=e.rx_errors,E=e.tx_bytes,S=e.tx_dropped,I=e.tx_errors,y=t.operstate)}))})),_&&E&&(g=B(r,parseInt(_),parseInt(E),y,b,w,S,I)),t(g)}))}))}}else g.rx_bytes=v[n].rx_bytes,g.tx_bytes=v[n].tx_bytes,g.rx_sec=v[n].rx_sec,g.tx_sec=v[n].tx_sec,g.ms=v[n].last_ms,g.operstate=v[n].operstate,t(g)}))}))}t.getDefaultNetworkInterface=S,t.networkInterfaceDefault=function(e){return new Promise((t=>{process.nextTick((()=>{let n=S();e&&e(n),t(n)}))}))},t.networkInterfaces=F,t.networkStats=function e(t,n){let r=[];return new Promise((i=>{process.nextTick((()=>{if(a.isFunction(t)&&!n)n=t,r=[S()];else{if("string"!=typeof t&&void 0!==t)return n&&n([]),i([]);(t=t||S()).__proto__.toLowerCase=a.stringToLower,t.__proto__.replace=a.stringReplace,t.__proto__.trim=a.stringTrim,t=t.trim().toLowerCase().replace(/,+/g,"|"),r=t.split("|")}const o=[],s=[];if(r.length&&"*"===r[0].trim())r=[],F(!1).then((t=>{for(let e of t)r.push(e.iface);e(r.join(",")).then((e=>{n&&n(e),i(e)}))}));else{for(let e of r)s.push(j(e.trim()));s.length?Promise.all(s).then((e=>{n&&n(e),i(e)})):(n&&n(o),i(o))}}))}))},t.networkConnections=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(l||d||f||h){let r='export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';(d||f||h)&&(r='export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'),i(r,{maxBuffer:2048e4},(function(o,s){let a=s.toString().split("\n");!o&&(a.length>1||""!=a[0])?(a.forEach((function(e){if((e=e.replace(/ +/g," ").split(" ")).length>=7){let t=e[3],r="",i=e[3].split(":");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join(":"));let o=e[4],s="",a=e[4].split(":");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join(":"));let c=e[5],l=e[6].split("/");c&&n.push({protocol:e[0],localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:c,pid:l[0]&&"-"!==l[0]?parseInt(l[0],10):null,process:l[1]?l[1].split(" ")[0]:""})}})),e&&e(n),t(n)):(r='ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"',i(r,{maxBuffer:2048e4},(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){if((e=e.replace(/ +/g," ").split(" ")).length>=6){let t=e[4],r="",i=e[4].split(":");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join(":"));let o=e[5],s="",a=e[5].split(":");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join(":"));let c=e[1];"ESTAB"===c&&(c="ESTABLISHED"),"TIME-WAIT"===c&&(c="TIME_WAIT");let l=null,u="";if(e.length>=7&&e[6].indexOf("users:")>-1){let t=e[6].replace('users:(("',"").replace(/"/g,"").split(",");t.length>2&&(u=t[0].split(" ")[0],l=parseInt(t[1],10))}c&&n.push({protocol:e[0],localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:c,pid:l,process:u})}}))}e&&e(n),t(n)})))}))}if(u){i('netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"',{maxBuffer:2048e4},(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){if((e=e.replace(/ +/g," ").split(" ")).length>=8){let t=e[3],r="",i=e[3].split(".");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join("."));let o=e[4],s="",a=e[4].split(".");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join("."));let c=e[5],l=parseInt(e[8],10);c&&n.push({protocol:e[0],localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:c,pid:l,process:""})}})),e&&e(n),t(n)}}))}if(p){let r="netstat -nao";try{i(r,a.execOptsWin,(function(r,i){if(!r){i.toString().split("\r\n").forEach((function(e){if((e=e.trim().replace(/ +/g," ").split(" ")).length>=4){let t=e[1],r="",i=e[1].split(":");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join(":"));let o=e[2],s="",a=e[2].split(":");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join(":"));let c=e[4],l=e[3];"HERGESTELLT"===l&&(l="ESTABLISHED"),l.startsWith("ABH")&&(l="LISTEN"),"SCHLIESSEN_WARTEN"===l&&(l="CLOSE_WAIT"),"WARTEND"===l&&(l="TIME_WAIT"),"SYN_GESENDET"===l&&(l="SYN_SENT"),"LISTENING"===l&&(l="LISTEN"),"SYN_RECEIVED"===l&&(l="SYN_RECV"),"FIN_WAIT_1"===l&&(l="FIN_WAIT1"),"FIN_WAIT_2"===l&&(l="FIN_WAIT2"),l&&n.push({protocol:e[0].toLowerCase(),localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:l,pid:c,process:""})}})),e&&e(n),t(n)}}))}catch(r){e&&e(n),t(n)}}}))}))},t.networkGatewayDefault=function(e){return new Promise((t=>{process.nextTick((()=>{let n="";if(l||d||f||h){let r="ip route get 1";try{i(r,{maxBuffer:2048e4},(function(r,i){if(r)e&&e(n),t(n);else{let r=i.toString().split("\n");let o=(r&&r[0]?r[0]:"").split(" via ");o&&o[1]&&(o=o[1].split(" "),n=o[0]),e&&e(n),t(n)}}))}catch(r){e&&e(n),t(n)}}if(u){let r="route -n get default";try{i(r,{maxBuffer:2048e4},(function(r,i){if(r)e&&e(n),t(n);else{let r=i.toString().split("\n").map((e=>e.trim()));n=a.getValue(r,"gateway"),e&&e(n),t(n)}}))}catch(r){e&&e(n),t(n)}}if(p)try{i("netstat -r",a.execOptsWin,(function(i,o){o.toString().split(r.EOL).forEach((e=>{if((e=e.replace(/\s+/g," ").trim()).indexOf("0.0.0.0 0.0.0.0")>-1&&!/[a-zA-Z]/.test(e)){const t=e.split(" ");t.length>=5&&t[t.length-3].indexOf(".")>-1&&(n=t[t.length-3])}})),n?(e&&e(n),t(n)):a.powerShell("Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq '0.0.0.0' -and $_.Mask -eq '0.0.0.0' }").then((r=>{let i=r.toString().split("\r\n");i.length>1&&!n&&(n=a.getValue(i,"NextHop"),e&&e(n),t(n))}))}))}catch(r){e&&e(n),t(n)}}))}))}},6599:(e,t,n)=>{"use strict";const r=n(2087),i=n(5747),o=n(1453),s=n(3129).exec,a=n(3129).execSync,c=o.promisify(n(3129).exec);let l=process.platform;const u="linux"===l,p="darwin"===l,d="win32"===l,f="freebsd"===l,h="openbsd"===l,m="netbsd"===l,g="sunos"===l;function v(e){e=(e=e||"").toLowerCase();let t=l;return d?t="windows":-1!==e.indexOf("mac os")?t="apple":-1!==e.indexOf("arch")?t="arch":-1!==e.indexOf("centos")?t="centos":-1!==e.indexOf("coreos")?t="coreos":-1!==e.indexOf("debian")?t="debian":-1!==e.indexOf("deepin")?t="deepin":-1!==e.indexOf("elementary")?t="elementary":-1!==e.indexOf("fedora")?t="fedora":-1!==e.indexOf("gentoo")?t="gentoo":-1!==e.indexOf("mageia")?t="mageia":-1!==e.indexOf("mandriva")?t="mandriva":-1!==e.indexOf("manjaro")?t="manjaro":-1!==e.indexOf("mint")?t="mint":-1!==e.indexOf("mx")?t="mx":-1!==e.indexOf("openbsd")?t="openbsd":-1!==e.indexOf("freebsd")?t="freebsd":-1!==e.indexOf("opensuse")?t="opensuse":-1!==e.indexOf("pclinuxos")?t="pclinuxos":-1!==e.indexOf("puppy")?t="puppy":-1!==e.indexOf("raspbian")?t="raspbian":-1!==e.indexOf("reactos")?t="reactos":-1!==e.indexOf("redhat")?t="redhat":-1!==e.indexOf("slackware")?t="slackware":-1!==e.indexOf("sugar")?t="sugar":-1!==e.indexOf("steam")?t="steam":-1!==e.indexOf("suse")?t="suse":-1!==e.indexOf("mate")?t="ubuntu-mate":-1!==e.indexOf("lubuntu")?t="lubuntu":-1!==e.indexOf("xubuntu")?t="xubuntu":-1!==e.indexOf("ubuntu")?t="ubuntu":-1!==e.indexOf("solaris")?t="solaris":-1!==e.indexOf("tails")?t="tails":-1!==e.indexOf("feren")?t="ferenos":-1!==e.indexOf("robolinux")?t="robolinux":u&&e&&(t=e.toLowerCase().trim().replace(/\s+/g,"-")),t}function y(){let e=r.hostname;if(u||p||f||h||m)try{e=a("hostname -f").toString().split(r.EOL)[0]}catch(e){o.noop()}if(d)try{e=a("echo %COMPUTERNAME%.%USERDNSDOMAIN%",o.execOptsWin).toString().replace(".%USERDNSDOMAIN%","").split(r.EOL)[0]}catch(e){o.noop()}return e}function _(){const e=r.networkInterfaces();let t=[];for(let n in e)({}).hasOwnProperty.call(e,n)&&e[n].forEach((function(e){if(e&&e.mac&&"00:00:00:00:00:00"!==e.mac){const n=e.mac.toLowerCase();-1===t.indexOf(n)&&t.push(n)}}));return t=t.sort((function(e,t){return et?1:0})),t}function E(e){return new Promise((t=>{process.nextTick((()=>{let n,r={os:"",hardware:"",macs:_()};if(p&&s("system_profiler SPHardwareDataType -json",(function(n,i){if(!n)try{const e=JSON.parse(i.toString());if(e.SPHardwareDataType&&e.SPHardwareDataType.length>0){const t=e.SPHardwareDataType[0];r.os=t.platform_UUID.toLowerCase(),r.hardware=t.serial_number}}catch(e){o.noop()}e&&e(r),t(r)})),u){s('echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null; echo;\necho -n "os: "; cat /etc/machine-id 2> /dev/null; echo;\necho -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;',(function(n,s){const a=s.toString().split("\n");if(r.os=o.getValue(a,"os").toLowerCase(),r.hardware=o.getValue(a,"hardware").toLowerCase(),!r.hardware){const e=i.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split("\n"),t=o.getValue(e,"serial");r.hardware=t||""}e&&e(r),t(r)}))}if(f||h||m){s('echo -n "os: "; sysctl -n kern.hostid; echo;\necho -n "hardware: "; sysctl -n kern.hostuuid; echo;',(function(n,i){const s=i.toString().split("\n");r.os=o.getValue(s,"os").toLowerCase(),r.hardware=o.getValue(s,"hardware").toLowerCase(),r.os.indexOf("unknown")>=0&&(r.os=""),r.hardware.indexOf("unknown")>=0&&(r.hardware=""),e&&e(r),t(r)}))}d&&s('%windir%\\System32\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid',o.execOptsWin,(function(i,s){n=s.toString().split("\n\r")[0].split("REG_SZ"),r.os=n.length>1?n[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase():"",o.wmic("csproduct get /value").then((n=>{let i=n.split("\r\n");r.hardware=o.getValue(i,"uuid","=").toLowerCase(),e&&e(r),t(r)}))}))}))}))}t.time=function(){let e=(new Date).toString().split(" ");return{current:Date.now(),uptime:r.uptime(),timezone:e.length>=7?e[5]:"",timezoneName:e.length>=7?e.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}},t.osInfo=function(e){return new Promise((t=>{process.nextTick((()=>{let n={platform:"Windows_NT"===l?"Windows":l,distro:"unknown",release:"unknown",codename:"",kernel:r.release(),arch:r.arch(),hostname:r.hostname(),fqdn:y(),codepage:"",logofile:"",serial:"",build:"",servicepack:"",uefi:!1};if(u&&s("cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release",(function(r,a){let c={};a.toString().split("\n").forEach((function(e){-1!==e.indexOf("=")&&(c[e.split("=")[0].trim().toUpperCase()]=e.split("=")[1].trim())}));let l=(c.VERSION||"").replace(/"/g,""),u=(c.DISTRIB_CODENAME||c.VERSION_CODENAME||"").replace(/"/g,"");l.indexOf("(")>=0&&(u=l.split("(")[1].replace(/[()]/g,"").trim(),l=l.split("(")[0].trim()),n.distro=(c.DISTRIB_ID||c.NAME||"unknown").replace(/"/g,""),n.logofile=v(n.distro),n.release=(l||c.DISTRIB_RELEASE||c.VERSION_ID||"unknown").replace(/"/g,""),n.codename=u,n.codepage=o.getCodepage(),n.build=(c.BUILD_ID||"").replace(/"/g,"").trim(),new Promise((e=>{process.nextTick((()=>{i.stat("/sys/firmware/efi",(function(t){t?s('dmesg | grep -E "EFI v"',(function(t,n){if(!t){const t=n.toString().split("\n");e(t.length>0)}e(!1)})):e(!0)}))}))})).then((r=>{n.uefi=r,E().then((r=>{n.serial=r.os,e&&e(n),t(n)}))}))})),(f||h||m)&&s("sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod",(function(r,i){if(!r){let e=i.toString().split("\n");n.distro=o.getValue(e,"kern.ostype"),n.logofile=v(n.distro),n.release=o.getValue(e,"kern.osrelease").split("-")[0],n.serial=o.getValue(e,"kern.uuid"),n.codename="",n.codepage=o.getCodepage(),n.uefi=o.getValue(e,"machdep.bootmethod").toLowerCase().indexOf("uefi")>=0}e&&e(n),t(n)})),p&&s("sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid",(function(r,i){let s=i.toString().split("\n");n.serial=o.getValue(s,"kern.uuid"),n.distro=o.getValue(s,"ProductName"),n.release=o.getValue(s,"ProductVersion"),n.build=o.getValue(s,"BuildVersion"),n.logofile=v(n.distro),n.codename="macOS",n.codename=n.release.indexOf("10.4")>-1?"Mac OS X Tiger":n.codename,n.codename=n.release.indexOf("10.4")>-1?"Mac OS X Tiger":n.codename,n.codename=n.release.indexOf("10.4")>-1?"Mac OS X Tiger":n.codename,n.codename=n.release.indexOf("10.5")>-1?"Mac OS X Leopard":n.codename,n.codename=n.release.indexOf("10.6")>-1?"Mac OS X Snow Leopard":n.codename,n.codename=n.release.indexOf("10.7")>-1?"Mac OS X Lion":n.codename,n.codename=n.release.indexOf("10.8")>-1?"OS X Mountain Lion":n.codename,n.codename=n.release.indexOf("10.9")>-1?"OS X Mavericks":n.codename,n.codename=n.release.indexOf("10.10")>-1?"OS X Yosemite":n.codename,n.codename=n.release.indexOf("10.11")>-1?"OS X El Capitan":n.codename,n.codename=n.release.indexOf("10.12")>-1?"macOS Sierra":n.codename,n.codename=n.release.indexOf("10.13")>-1?"macOS High Sierra":n.codename,n.codename=n.release.indexOf("10.14")>-1?"macOS Mojave":n.codename,n.codename=n.release.indexOf("10.15")>-1?"macOS Catalina":n.codename,n.codename=n.release.startsWith("11.")?"macOS Big Sur":n.codename,n.uefi=!0,n.codepage=o.getCodepage(),e&&e(n),t(n)})),g&&(n.release=n.kernel,s("uname -o",(function(r,i){let o=i.toString().split("\n");n.distro=o[0],n.logofile=v(n.distro),e&&e(n),t(n)}))),d){n.logofile=v(),n.release=n.kernel;try{const r=[];r.push(o.wmic("os get /value")),r.push(c("systeminfo",o.execOptsWin)),r.push(o.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession")),o.promiseAll(r).then((r=>{let i=r.results[0]?r.results[0].toString().split("\r\n"):[""];n.distro=o.getValue(i,"Caption","=").trim(),n.serial=o.getValue(i,"SerialNumber","=").trim(),n.build=o.getValue(i,"BuildNumber","=").trim(),n.servicepack=o.getValue(i,"ServicePackMajorVersion","=").trim()+"."+o.getValue(i,"ServicePackMinorVersion","=").trim(),n.codepage=o.getCodepage();const a=r.results[1]?r.results[1].toString():"";n.hypervisor=-1!==a.indexOf("hypervisor has been detected")||-1!==a.indexOf("Es wurde ein Hypervisor erkannt")||-1!==a.indexOf("Un hyperviseur a ");const c=r.results[2]?r.results[2].toString():"";n.remoteSession=c.toString().toLowerCase().indexOf("true")>=0,new Promise((e=>{process.nextTick((()=>{try{s('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"',o.execOptsWin,(function(t,n){if(t)s("$env:firmware_type",o.execOptsWin,(function(t,n){if(!t){const t=n.toString()||"";e(t.toLowerCase().indexOf("uefi")>=0)}e(!1)})),e(!1);else{const t=n.toString().split("\n\r")[0];e(t.toLowerCase().indexOf("uefi")>=0)}}))}catch(t){e(!1)}}))})).then((r=>{n.uefi=r,e&&e(n),t(n)}))}))}catch(r){e&&e(n),t(n)}}}))}))},t.versions=function(e,t){let n={kernel:r.release(),openssl:"",systemOpenssl:"",systemOpensslLib:"",node:process.versions.node,v8:process.versions.v8,npm:"",yarn:"",pm2:"",gulp:"",grunt:"",git:"",tsc:"",mysql:"",redis:"",mongodb:"",apache:"",nginx:"",php:"",docker:"",postfix:"",postgresql:"",perl:"",python:"",python3:"",pip:"",pip3:"",java:"",gcc:"",virtualbox:"",bash:"",zsh:"",fish:"",powershell:"",dotnet:""};return new Promise((r=>{process.nextTick((()=>{if(o.isFunction(e)&&!t)t=e,e="*";else if("string"!=typeof(e=e||"*"))return t&&t({}),r({});const a=function(e){if("*"===e)return{versions:n,counter:30};if(!Array.isArray(e)){e=(e=e.trim().toLowerCase().replace(/,+/g,"|").replace(/ /g,"|")).split("|");const t={versions:{},counter:0};return e.forEach((e=>{if(e)for(let r in n)({}).hasOwnProperty.call(n,r)&&(r.toLowerCase()!==e.toLowerCase()||{}.hasOwnProperty.call(t.versions,r)||(t.versions[r]=n[r],"openssl"===r&&(t.versions.systemOpenssl="",t.versions.systemOpensslLib=""),t.versions[r]||t.counter++))})),t}}(e);let c=a.counter,l=function(){0==--c&&(t&&t(a.versions),r(a.versions))},f="";try{if({}.hasOwnProperty.call(a.versions,"openssl")&&(a.versions.openssl=process.versions.openssl,s("openssl version",(function(e,t){if(!e){let e=t.toString().split("\n")[0].trim().split(" ");a.versions.systemOpenssl=e.length>0?e[1]:e[0],a.versions.systemOpensslLib=e.length>0?e[0]:"openssl"}l()}))),{}.hasOwnProperty.call(a.versions,"npm")&&s("npm -v",(function(e,t){e||(a.versions.npm=t.toString().split("\n")[0]),l()})),{}.hasOwnProperty.call(a.versions,"pm2")&&(f="pm2",d&&(f+=".cmd"),s(`${f} -v`,(function(e,t){if(!e){let e=t.toString().split("\n")[0].trim();e.startsWith("[PM2]")||(a.versions.pm2=e)}l()}))),{}.hasOwnProperty.call(a.versions,"yarn")&&s("yarn --version",(function(e,t){e||(a.versions.yarn=t.toString().split("\n")[0]),l()})),{}.hasOwnProperty.call(a.versions,"gulp")&&(f="gulp",d&&(f+=".cmd"),s(`${f} --version`,(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.gulp=(e.toLowerCase().split("version")[1]||"").trim()}l()}))),{}.hasOwnProperty.call(a.versions,"tsc")&&(f="tsc",d&&(f+=".cmd"),s(`${f} --version`,(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.tsc=(e.toLowerCase().split("version")[1]||"").trim()}l()}))),{}.hasOwnProperty.call(a.versions,"grunt")&&(f="grunt",d&&(f+=".cmd"),s(`${f} --version`,(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.grunt=(e.toLowerCase().split("cli v")[1]||"").trim()}l()}))),{}.hasOwnProperty.call(a.versions,"git"))if(p){const e=i.existsSync("/usr/local/Cellar/git");o.darwinXcodeExists()||e?s("git --version",(function(e,t){if(!e){let e=t.toString().split("\n")[0]||"";e=(e.toLowerCase().split("version")[1]||"").trim(),a.versions.git=(e.split(" ")[0]||"").trim()}l()})):l()}else s("git --version",(function(e,t){if(!e){let e=t.toString().split("\n")[0]||"";e=(e.toLowerCase().split("version")[1]||"").trim(),a.versions.git=(e.split(" ")[0]||"").trim()}l()}));if({}.hasOwnProperty.call(a.versions,"apache")&&s("apachectl -v 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(":");a.versions.apache=e.length>1?e[1].replace("Apache","").replace("/","").split("(")[0].trim():""}l()})),{}.hasOwnProperty.call(a.versions,"nginx")&&s("nginx -v 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.nginx=(e.toLowerCase().split("/")[1]||"").trim()}l()})),{}.hasOwnProperty.call(a.versions,"mysql")&&s("mysql -V",(function(e,t){if(!e){let e=t.toString().split("\n")[0]||"";if(e=e.toLowerCase(),e.indexOf(",")>-1){e=(e.split(",")[0]||"").trim();const t=e.split(" ");a.versions.mysql=(t[t.length-1]||"").trim()}else e.indexOf(" ver ")>-1&&(e=e.split(" ver ")[1],a.versions.mysql=e.split(" ")[0])}l()})),{}.hasOwnProperty.call(a.versions,"php")&&s("php -v",(function(e,t){if(!e){let e=(t.toString().split("\n")[0]||"").split("(");e[0].indexOf("-")&&(e=e[0].split("-")),a.versions.php=e[0].replace(/[^0-9.]/g,"")}l()})),{}.hasOwnProperty.call(a.versions,"redis")&&s("redis-server --version",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.redis=o.getValue(e,"v","=",!0)}l()})),{}.hasOwnProperty.call(a.versions,"docker")&&s("docker --version",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.docker=e.length>2&&e[2].endsWith(",")?e[2].slice(0,-1):""}l()})),{}.hasOwnProperty.call(a.versions,"postfix")&&s("postconf -d | grep mail_version",(function(e,t){if(!e){const e=t.toString().split("\n")||[];a.versions.postfix=o.getValue(e,"mail_version","=",!0)}l()})),{}.hasOwnProperty.call(a.versions,"mongodb")&&s("mongod --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.mongodb=(e.toLowerCase().split(",")[0]||"").replace(/[^0-9.]/g,"")}l()})),{}.hasOwnProperty.call(a.versions,"postgresql")&&(u?s("locate bin/postgres",(function(e,t){if(e)s("psql -V",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" ")||[];a.versions.postgresql=e.length?e[e.length-1]:"",a.versions.postgresql=a.versions.postgresql.split("-")[0]}l()})),l();else{const e=t.toString().split("\n").sort();e.length?s(e[e.length-1]+" -V",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" ")||[];a.versions.postgresql=e.length?e[e.length-1]:""}l()})):l()}})):d?o.wmic("service get /value").then((e=>{let t=e.split(/\n\s*\n/);for(let e=0;e-1){const e=r.split(" server ");e.length>1&&(a.versions.postgresql=e[1])}}l()})):s("postgres -V",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" ")||[];a.versions.postgresql=e.length?e[e.length-1]:""}l()}))),{}.hasOwnProperty.call(a.versions,"perl")&&s("perl -v",(function(e,t){if(!e){const e=t.toString().split("\n")||"";for(;e.length>0&&""===e[0].trim();)e.shift();e.length>0&&(a.versions.perl=e[0].split("(").pop().split(")")[0].replace("v",""))}l()})),{}.hasOwnProperty.call(a.versions,"python"))if(p){const e=i.existsSync("/usr/local/Cellar/python");o.darwinXcodeExists()||e?s("python -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python=e.toLowerCase().replace("python","").trim()}l()})):l()}else s("python -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python=e.toLowerCase().replace("python","").trim()}l()}));if({}.hasOwnProperty.call(a.versions,"python3"))if(p){const e=i.existsSync("/usr/local/Cellar/python3");o.darwinXcodeExists()||e?s("python3 -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python3=e.toLowerCase().replace("python","").trim()}l()})):l()}else s("python3 -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python3=e.toLowerCase().replace("python","").trim()}l()}));if({}.hasOwnProperty.call(a.versions,"pip"))if(p){const e=i.existsSync("/usr/local/Cellar/pip");o.darwinXcodeExists()||e?s("pip -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip=e.length>=2?e[1]:""}l()})):l()}else s("pip -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip=e.length>=2?e[1]:""}l()}));if({}.hasOwnProperty.call(a.versions,"pip3"))if(p){const e=i.existsSync("/usr/local/Cellar/pip3");o.darwinXcodeExists()||e?s("pip3 -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip3=e.length>=2?e[1]:""}l()})):l()}else s("pip3 -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip3=e.length>=2?e[1]:""}l()}));({}).hasOwnProperty.call(a.versions,"java")&&(p?s("/usr/libexec/java_home -V 2>&1",(function(e,t){e||-1!==t.toString().toLowerCase().indexOf("no java runtime")?l():s("java -version 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split('"');a.versions.java=3===e.length?e[1].trim():""}l()}))})):s("java -version 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split('"');a.versions.java=3===e.length?e[1].trim():""}l()}))),{}.hasOwnProperty.call(a.versions,"gcc")&&(p&&o.darwinXcodeExists()||!p?s("gcc -dumpversion",(function(e,t){e||(a.versions.gcc=t.toString().split("\n")[0].trim()||""),a.versions.gcc.indexOf(".")>-1?l():s("gcc --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].trim();if(e.indexOf("gcc")>-1&&e.indexOf(")")>-1){const t=e.split(")");a.versions.gcc=t[1].trim()||a.versions.gcc}}l()}))})):l()),{}.hasOwnProperty.call(a.versions,"virtualbox")&&s(o.getVboxmanage()+" -v 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split("r");a.versions.virtualbox=e[0]}l()})),{}.hasOwnProperty.call(a.versions,"bash")&&s("bash --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" version ");e.length>1&&(a.versions.bash=e[1].split(" ")[0].split("(")[0])}l()})),{}.hasOwnProperty.call(a.versions,"zsh")&&s("zsh --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split("zsh ");e.length>1&&(a.versions.zsh=e[1].split(" ")[0])}l()})),{}.hasOwnProperty.call(a.versions,"fish")&&s("fish --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" version ");e.length>1&&(a.versions.fish=e[1].split(" ")[0])}l()})),{}.hasOwnProperty.call(a.versions,"powershell")&&(d?o.powerShell("$PSVersionTable").then((e=>{const t=e.toString().split("\n").map((e=>e.replace(/ +/g," ").replace(/ +/g,":")));a.versions.powershell=o.getValue(t,"psversion"),l()})):l()),{}.hasOwnProperty.call(a.versions,"dotnet")&&o.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then((e=>{const t=e.toString().split("\r\n");let n="";t.forEach((e=>{const t=(e=e.replace(/ +/g," ")).split(" ");n=n||(t[0].toLowerCase().startsWith("client")&&t.length>2||t[0].toLowerCase().startsWith("full")&&t.length>2?t[1].trim():"")})),a.versions.dotnet=n.trim(),l()}))}catch(e){t&&t(a.versions),r(a.versions)}}))}))},t.shell=function(e){return new Promise((t=>{process.nextTick((()=>{d&&t("cmd");let n="";s("echo $SHELL",(function(r,i){r||(n=i.toString().split("\n")[0]),e&&e(n),t(n)}))}))}))},t.uuid=E},8958:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(1453);let o=process.platform;const s="linux"===o,a="darwin"===o,c="win32"===o,l="freebsd"===o,u="openbsd"===o,p="netbsd"===o,d="sunos"===o,f={1:"Other",2:"Unknown",3:"Idle",4:"Printing",5:"Warmup",6:"Stopped Printing",7:"Offline"};function h(e){const t={},n=i.getValue(e,"PrinterId"," ");return t.id=n?parseInt(n,10):null,t.name=i.getValue(e,"Info"," "),t.model=e.length>0&&e[0]?e[0].split(" ")[0]:"",t.uri=i.getValue(e,"DeviceURI"," "),t.uuid=i.getValue(e,"UUID"," "),t.status=i.getValue(e,"State"," "),t.local=i.getValue(e,"Location"," ").toLowerCase().startsWith("local"),t.default=null,t.shared=i.getValue(e,"Shared"," ").toLowerCase().startsWith("yes"),t}function m(e,t){const n={};return n.id=t,n.name=i.getValue(e,"Description",":",!0),n.model=e.length>0&&e[0]?e[0].split(" ")[0]:"",n.uri=null,n.uuid=null,n.status=e.length>0&&e[0]?e[0].indexOf(" idle")>0?"idle":e[0].indexOf(" printing")>0?"printing":"unknown":null,n.local=i.getValue(e,"Location",":",!0).toLowerCase().startsWith("local"),n.default=null,n.shared=i.getValue(e,"Shared"," ").toLowerCase().startsWith("yes"),n}function g(e,t){const n={},r=e.uri.split("/");return n.id=t,n.name=e._name,n.model=r.length?r[r.length-1]:"",n.uri=e.uri,n.uuid=null,n.status=e.status,n.local="local"===e.printserver,n.default="yes"===e.default,n.shared="yes"===e.shared,n}function v(e,t){const n={},r=parseInt(i.getValue(e,"PrinterStatus","="),10);return n.id=t,n.name=i.getValue(e,"name","="),n.model=i.getValue(e,"DriverName","="),n.uri=null,n.uuid=null,n.status=f[r]?f[r]:null,n.local="TRUE"===i.getValue(e,"Local","="),n.default="TRUE"===i.getValue(e,"Default","="),n.shared="TRUE"===i.getValue(e,"Shared","="),n}t.printer=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(s||l||u||p){let i="cat /etc/cups/printers.conf 2>/dev/null";r(i,(function(o,a){if(!o){const e=a.toString().split("0){const n=e[0].split(" CUPS v");t.cupsVersion=n[1]}return t}(e[0]);for(let r=1;r/dev/null; unset LC_ALL",r(i,(function(e,t){const r=("\n"+t.toString()).split("\nprinter ");for(let e=1;e{"use strict";const r=n(2087),i=n(5747),o=n(5622),s=n(3129).exec,a=n(3129).execSync,c=n(1453);let l=process.platform;const u="linux"===l,p="darwin"===l,d="win32"===l,f="freebsd"===l,h="openbsd"===l,m="netbsd"===l,g="sunos"===l,v={all:0,list:{},ms:0,result:{}},y={all:0,list:{},ms:0,result:{}},_={all:0,list:{},ms:0,result:{}},E={0:"unknown",1:"other",2:"ready",3:"running",4:"blocked",5:"suspended blocked",6:"suspended ready",7:"terminated",8:"stopped",9:"growing"};function b(e){let t=e.replace(/ +/g," ").split(" ");return(t.length>=2?parseInt(t[1]):0)+(t.length>=3?parseInt(t[2]):0)+(t.length>=4?parseInt(t[3]):0)+(t.length>=5?parseInt(t[4]):0)+(t.length>=6?parseInt(t[5]):0)+(t.length>=7?parseInt(t[6]):0)+(t.length>=8?parseInt(t[7]):0)+(t.length>=9?parseInt(t[8]):0)+(t.length>=10?parseInt(t[9]):0)+(t.length>=11?parseInt(t[10]):0)}function w(e,t,n){let r=e.replace(/ +/g," ").split(")");if(r.length>=2){let e=r[1].split(" ");if(e.length>=16){let i=parseInt(r[0].split(" ")[0]),o=parseInt(e[12]),s=parseInt(e[13]),a=parseInt(e[14]),c=parseInt(e[15]),l=0,u=0;return n.all>0&&n.list[i]?(l=(o+a-n.list[i].utime-n.list[i].cutime)/(t-n.all)*100,u=(s+c-n.list[i].stime-n.list[i].cstime)/(t-n.all)*100):(l=(o+a)/t*100,u=(s+c)/t*100),{pid:i,utime:o,stime:s,cutime:a,cstime:c,cpuu:l,cpus:u}}return{pid:0,utime:0,stime:0,cutime:0,cstime:0,cpuu:0,cpus:0}}return{pid:0,utime:0,stime:0,cutime:0,cstime:0,cpuu:0,cpus:0}}function S(e,t,n){let r=0,i=0;return n.all>0&&n.list[e.pid]?(r=(e.utime-n.list[e.pid].utime)/(t-n.all)*100,i=(e.stime-n.list[e.pid].stime)/(t-n.all)*100):(r=e.utime/t*100,i=e.stime/t*100),{pid:e.pid,utime:e.utime,stime:e.stime,cpuu:r,cpus:i}}t.services=function(e,t){return c.isFunction(e)&&!t&&(t=e,e=""),new Promise((n=>{process.nextTick((()=>{if("string"!=typeof e)return t&&t([]),n([]);if(e){let r="";r.__proto__.toLowerCase=c.stringToLower,r.__proto__.replace=c.stringReplace,r.__proto__.trim=c.stringTrim;const i=c.sanitizeShellString(e);for(let e=0;e<=c.mathMin(i.length,2e3);e++)void 0!==i[e]&&(r+=i[e]);r=r.trim().toLowerCase().replace(/, /g,"|").replace(/,+/g,"|"),""===r&&(r="*"),c.isPrototypePolluted()&&"*"!==r&&(r="------");let o=r.split("|"),l=[],g=[];if(u||f||h||m||p){if((u||f||h||m)&&"*"===r)try{r="";const e=a("service --status-all 2> /dev/null").toString().split("\n");for(const t of e){const e=t.split("]");2===e.length&&(r+=(""!==r?"|":"")+e[1].trim())}o=r.split("|")}catch(e){try{const e=a("ls /etc/init.d/ -m 2> /dev/null").toString().split("\n").join("");if(r="",e){const t=e.split(",");for(const e of t){const t=e.trim();t&&(r+=(""!==r?"|":"")+t)}o=r.split("|")}}catch(e){r="",o=[]}}p&&"*"===r&&(t&&t(l),n(l));let e=p?["-caxo","pcpu,pmem,pid,command"]:["-axo","pcpu,pmem,pid,command"];""!==r&&o.length>0?c.execSafe("ps",e).then((r=>{if(r){let e=r.replace(/ +/g," ").replace(/,+/g,".").split("\n");if(o.forEach((function(t){let n;n=p?e.filter((function(e){return-1!==e.toLowerCase().indexOf(t)})):e.filter((function(e){return-1!==e.toLowerCase().indexOf(" "+t+":")||-1!==e.toLowerCase().indexOf("/"+t)}));const r=[];for(const e of n){const t=e.trim().split(" ")[2];t&&r.push(parseInt(t,10))}l.push({name:t,running:n.length>0,startmode:"",pids:r,cpu:parseFloat(n.reduce((function(e,t){return e+parseFloat(t.trim().split(" ")[0])}),0).toFixed(2)),mem:parseFloat(n.reduce((function(e,t){return e+parseFloat(t.trim().split(" ")[1])}),0).toFixed(2))})})),u){let e='cat /proc/stat | grep "cpu "';for(let t in l)for(let n in l[t].pids)e+=";cat /proc/"+l[t].pids[n]+"/stat";s(e,{maxBuffer:2048e4},(function(e,r){let i=r.toString().split("\n"),o=b(i.shift()),s={},a={};for(let e=0;e=0&&(l[e].cpu+=a.cpuu+a.cpus),s[a.pid]={cpuu:a.cpuu,cpus:a.cpus,utime:a.utime,stime:a.stime,cutime:a.cutime,cstime:a.cstime}}y.all=o,y.list=Object.assign({},s),y.ms=Date.now()-y.ms,y.result=Object.assign({},l),t&&t(l),n(l)}))}else t&&t(l),n(l)}else e=["-o","comm"],c.execSafe("ps",e).then((e=>{if(e){let r=e.replace(/ +/g," ").replace(/,+/g,".").split("\n");o.forEach((function(e){let t=r.filter((function(t){return-1!==t.indexOf(e)}));l.push({name:e,running:t.length>0,startmode:"",cpu:0,mem:0})})),t&&t(l),n(l)}else o.forEach((function(e){l.push({name:e,running:!1,startmode:"",cpu:0,mem:0})})),t&&t(l),n(l)}))})):(t&&t(l),n(l))}if(d)try{c.wmic("service get /value").then(((e,i)=>{if(i)o.forEach((function(e){l.push({name:e,running:!1,startmode:"",cpu:0,mem:0})})),t&&t(l),n(l);else{let i=e.split(/\n\s*\n/);for(let e=0;e=0||o.indexOf(s)>=0)&&(l.push({name:n,running:"TRUE"===a,startmode:u,pids:[p],cpu:0,mem:0}),g.push(n),g.push(s))}if("*"!==r){o.filter((function(e){return-1===g.indexOf(e)})).forEach((function(e){l.push({name:e,running:!1,startmode:"",pids:[],cpu:0,mem:0})}))}t&&t(l),n(l)}}))}catch(e){t&&t(l),n(l)}}else t&&t([]),n([])}))}))},t.processes=function(e){let t=[];function n(e){let t=(e=e||"").split(" ")[0];if(":"===t.substr(-1)&&(t=t.substr(0,t.length-1)),"["!==t.substr(0,1)){let e=t.split("/");t=isNaN(parseInt(e[e.length-1]))?e[e.length-1]:e[0]}return t}function a(e){let r=[];if(e.length>1){let s=e[0];t=c.parseHead(s,8),e.shift(),e.forEach((function(e){""!==e.trim()&&r.push(function(e){let r=0,s=0;function a(n){r=s,s=t[n]?e.substring(t[n].to+r,1e4).indexOf(" "):1e4}a(0);const c=parseInt(e.substring(t[0].from+r,t[0].to+s));a(1);const l=parseInt(e.substring(t[1].from+r,t[1].to+s));a(2);const p=parseFloat(e.substring(t[2].from+r,t[2].to+s).replace(/,/g,"."));a(3);const d=parseFloat(e.substring(t[3].from+r,t[3].to+s).replace(/,/g,"."));a(4);const f=parseInt(e.substring(t[4].from+r,t[4].to+s));a(5);const h=parseInt(e.substring(t[5].from+r,t[5].to+s));a(6);const m=parseInt(e.substring(t[6].from+r,t[6].to+s));a(7);const g=parseInt(e.substring(t[7].from+r,t[7].to+s))||0;a(8);const v=function(e){let t=e,n=e.replace(/ +/g," ").split(" ");return 5===n.length&&(t=n[4]+"-"+("0"+("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".indexOf(n[1].toUpperCase())/3+1)).slice(-2)+"-"+("0"+n[2]).slice(-2)+" "+n[3]),t}(e.substring(t[8].from+r,t[8].to+s).trim());a(9);let y=e.substring(t[9].from+r,t[9].to+s).trim();y="R"===y[0]?"running":"S"===y[0]?"sleeping":"T"===y[0]?"stopped":"W"===y[0]?"paging":"X"===y[0]?"dead":"Z"===y[0]?"zombie":"D"===y[0]||"U"===y[0]?"blocked":"unknown",a(10);let _=e.substring(t[10].from+r,t[10].to+s).trim();"?"!==_&&"??"!==_||(_=""),a(11);const E=e.substring(t[11].from+r,t[11].to+s).trim();a(12);let b="",w="",S="",I=e.substring(t[12].from+r,t[12].to+s).trim();if("]"===I.substr(I.length-1)&&(I=I.slice(0,-1)),"["===I.substr(0,1))w=I.substring(1);else{let e=I.indexOf(" -"),t=I.indexOf(" /");e=e>=0?e:1e4,t=t>=0?t:1e4;const n=Math.min(e,t);let r=I.substr(0,n);const s=I.substr(n),a=r.lastIndexOf("/");if(a>=0&&(b=r.substr(0,a),r=r.substr(a+1)),1e4===n&&r.indexOf(" ")>-1){const e=r.split(" ");i.existsSync(o.join(b,e[0]))?(w=e.shift(),S=(e.join(" ")+" "+s).trim()):(w=r.trim(),S=s.trim())}else w=r.trim(),S=s.trim()}return{pid:c,parentPid:l,name:u?n(w):w,cpu:p,cpuu:0,cpus:0,mem:d,priority:f,memVsz:h,memRss:m,nice:g,started:v,state:y,tty:_,user:E,command:w,params:S,path:b}}(e))}))}return r}return new Promise((t=>{process.nextTick((()=>{let i={all:0,running:0,blocked:0,sleeping:0,unknown:0,list:[]},o="";if(v.ms&&Date.now()-v.ms>=500||0===v.ms)if(u||f||h||m||p||g)u&&(o="export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,lstart:30,state:5,tty:15,user:20,command; unset LC_ALL"),(f||h||m)&&(o="export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL"),p&&(o="export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,nice,lstart,state,tty,user,command -r; unset LC_ALL"),g&&(o="ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm"),s(o,{maxBuffer:2048e4},(function(c,l){if(c)o="ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm",g&&(o="ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm"),s(o,{maxBuffer:2048e4},(function(o,s){if(o)e&&e(i),t(i);else{let o=s.toString().split("\n");o.shift(),i.list=function(e){let t=[];return e.forEach((function(e){if(""!==e.trim()){const i=(e=e.trim().replace(/ +/g," ").replace(/,+/g,".")).split(" "),o=i.slice(9).join(" "),s=parseFloat((1*parseInt(i[3])*1024/r.totalmem()).toFixed(1)),a=i[5].split(":"),c=function(e){const t=("0"+(e.getMonth()+1).toString()).substr(-2);return e.getFullYear().toString()+"-"+t+"-"+("0"+e.getDay().toString()).substr(-2)+" "+e.getHours().toString()+":"+e.getMinutes().toString()+":"+("0"+e.getSeconds().toString()).substr(-2)}(new Date(Date.now()-(a.length>1?1e3*(60*a[0]+a[1]):1e3*a[0])));t.push({pid:parseInt(i[0]),parentPid:parseInt(i[1]),name:n(o),cpu:0,cpuu:0,cpus:0,mem:s,priority:0,memVsz:parseInt(i[2]),memRss:parseInt(i[3]),nice:parseInt(i[4]),started:c,state:"R"===i[6]?"running":"S"===i[6]?"sleeping":"T"===i[6]?"stopped":"W"===i[6]?"paging":"X"===i[6]?"dead":"Z"===i[6]?"zombie":"D"===i[6]||"U"===i[6]?"blocked":"unknown",tty:i[7],user:i[8],command:o})}})),t}(o).slice(),i.all=i.list.length,i.running=i.list.filter((function(e){return"running"===e.state})).length,i.blocked=i.list.filter((function(e){return"blocked"===e.state})).length,i.sleeping=i.list.filter((function(e){return"sleeping"===e.state})).length,e&&e(i),t(i)}}));else if(i.list=a(l.toString().split("\n")).slice(),i.all=i.list.length,i.running=i.list.filter((function(e){return"running"===e.state})).length,i.blocked=i.list.filter((function(e){return"blocked"===e.state})).length,i.sleeping=i.list.filter((function(e){return"sleeping"===e.state})).length,u){o='cat /proc/stat | grep "cpu "';for(let e=0;e=0&&(i.list[e].cpu=c.cpuu+c.cpus,i.list[e].cpuu=c.cpuu,i.list[e].cpus=c.cpus),a[c.pid]={cpuu:c.cpuu,cpus:c.cpus,utime:c.utime,stime:c.stime,cutime:c.cutime,cstime:c.cstime}}v.all=s,v.list=Object.assign({},a),v.ms=Date.now()-v.ms,v.result=Object.assign({},i),e&&e(i),t(i)}))}else e&&e(i),t(i)}));else if(d)try{c.wmic("process get /value").then(((n,o)=>{if(!o){let e=n.split(/\n\s*\n/),t=[],o=[],a={},l=0,u=0;for(let n=0;n=0&&(i.list[n].cpu=t.cpuu+t.cpus,i.list[n].cpuu=t.cpuu,i.list[n].cpus=t.cpus),a[t.pid]={cpuu:t.cpuu,cpus:t.cpus,utime:t.utime,stime:t.stime}}v.all=l+u,v.list=Object.assign({},a),v.ms=Date.now()-v.ms,v.result=Object.assign({},i)}var s;e&&e(i),t(i)}))}catch(n){e&&e(i),t(i)}else e&&e(i),t(i);else e&&e(v.result),t(v.result)}))}))},t.processLoad=function(e,t){return c.isFunction(e)&&!t&&(t=e,e=""),new Promise((n=>{process.nextTick((()=>{if("string"!=typeof(e=e||""))return t&&t([]),n([]);let i="";i.__proto__.toLowerCase=c.stringToLower,i.__proto__.replace=c.stringReplace,i.__proto__.trim=c.stringTrim;const o=c.sanitizeShellString(e);for(let e=0;e<=c.mathMin(o.length,2e3);e++)void 0!==o[e]&&(i+=o[e]);i=i.trim().toLowerCase().replace(/, /g,"|").replace(/,+/g,"|"),""===i&&(i="*"),c.isPrototypePolluted()&&"*"!==i&&(i="------");let a=i.split("|"),l=[];if((c.isPrototypePolluted()?"":c.sanitizeShellString(e))&&a.length&&"------"!==a[0]){if(d)try{c.wmic("process get /value").then(((e,o)=>{if(!o){let o=e.split(/\n\s*\n/),s=[],u={},p=0,d=0;for(let e=0;e=0&&!v&&(v=!0,g=e)})),"*"===i||v){let e=!1;l.forEach((function(t){t.proc.toLowerCase()===g.toLowerCase()&&(t.pids.push(n),t.mem+=m/r.totalmem()*100,e=!0)})),e||l.push({proc:g,pid:n,pids:[n],cpu:0,mem:m/r.totalmem()*100})}}if("*"!==i){a.filter((function(e){return 0===s.filter((function(t){return t.name.toLowerCase().indexOf(e)>=0})).length})).forEach((function(e){l.push({proc:e,pid:null,pids:[],cpu:0,mem:0})}))}for(let e=0;e=0)&&(n=e);n>=0&&(l[n].cpu+=t.cpuu+t.cpus),u[t.pid]={cpuu:t.cpuu,cpus:t.cpus,utime:t.utime,stime:t.stime}}_.all=p+d,_.list=Object.assign({},u),_.ms=Date.now()-_.ms,_.result=JSON.parse(JSON.stringify(l)),t&&t(l),n(l)}}))}catch(e){t&&t(l),n(l)}if(p||u||f||h||m){const e=["-axo","pid,pcpu,pmem,comm"];c.execSafe("ps",e).then((e=>{if(e){let r=[];if(e.toString().split("\n").filter((function(e){if("*"===i)return!0;if(-1!==e.toLowerCase().indexOf("grep"))return!1;let t=!1;return a.forEach((function(n){t=t||e.toLowerCase().indexOf(n.toLowerCase())>=0})),t})).forEach((function(e){let t=e.trim().replace(/ +/g," ").split(" ");t.length>3&&r.push({name:t[3].substring(t[3].lastIndexOf("/")+1),pid:parseInt(t[0])||0,cpu:parseFloat(t[1].replace(",",".")),mem:parseFloat(t[2].replace(",","."))})})),r.forEach((function(e){let t=-1,n=!1,r="";for(let n=0;n=0&&(t=n);a.forEach((function(t){e.name.toLowerCase().indexOf(t.toLowerCase())>=0&&!n&&(n=!0,r=t)})),("*"===i||n)&&(t<0?l.push({proc:r,pid:e.pid,pids:[e.pid],cpu:e.cpu,mem:e.mem}):(l[t].pids.push(e.pid),l[t].cpu+=e.cpu,l[t].mem+=e.mem))})),"*"!==i){a.filter((function(e){return 0===r.filter((function(t){return t.name.toLowerCase().indexOf(e)>=0})).length})).forEach((function(e){l.push({proc:e,pid:null,pids:[],cpu:0,mem:0})}))}if(u){l.forEach((function(e){e.cpu=0}));let e='cat /proc/stat | grep "cpu "';for(let t in l)for(let n in l[t].pids)e+=";cat /proc/"+l[t].pids[n]+"/stat";s(e,{maxBuffer:2048e4},(function(e,r){let i=r.toString().split("\n"),o=b(i.shift()),s={},a={};for(let e=0;e=0&&(e=t);e>=0&&(l[e].cpu+=a.cpuu+a.cpus),s[a.pid]={cpuu:a.cpuu,cpus:a.cpus,utime:a.utime,stime:a.stime,cutime:a.cutime,cstime:a.cstime}}l.forEach((function(e){e.cpu=Math.round(100*e.cpu)/100})),_.all=o,_.list=Object.assign({},s),_.ms=Date.now()-_.ms,_.result=Object.assign({},l),t&&t(l),n(l)}))}else t&&t(l),n(l)}else t&&t(l),n(l)}))}}}))}))}},1617:(e,t,n)=>{"use strict";const r=n(5747),i=n(2087),o=n(1453),s=n(3129).exec,a=n(3129).execSync,c=o.promisify(n(3129).exec);let l=process.platform;const u="linux"===l,p="darwin"===l,d="win32"===l,f="freebsd"===l,h="openbsd"===l,m="netbsd"===l,g="sunos"===l;t.system=function(e){return new Promise((t=>{process.nextTick((()=>{let n={manufacturer:"",model:"Computer",version:"",serial:"-",uuid:"-",sku:"-",virtual:!1};if((u||f||h||m)&&s("export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL",(function(i,s){let c=s.toString().split("\n");n.manufacturer=o.getValue(c,"manufacturer"),n.model=o.getValue(c,"product name"),n.version=o.getValue(c,"version"),n.serial=o.getValue(c,"serial number"),n.uuid=o.getValue(c,"uuid").toLowerCase(),n.sku=o.getValue(c,"sku number");try{c=a('echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;\n echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;\n echo -n "product_uuid: "; cat /sys/devices/virtual/dmi/id/product_uuid 2>/dev/null; echo;\n echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo;\n echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;').toString().split("\n"),n.manufacturer=""===n.manufacturer?o.getValue(c,"sys_vendor"):n.manufacturer,n.model=""===n.model?o.getValue(c,"product_name"):n.model,n.version=""===n.version?o.getValue(c,"product_version"):n.version,n.serial=""===n.serial?o.getValue(c,"product_serial"):n.serial,n.uuid=""===n.uuid?o.getValue(c,"product_uuid").toLowerCase():n.uuid}catch(e){o.noop()}if(n.serial&&-1===n.serial.toLowerCase().indexOf("o.e.m.")||(n.serial="-"),n.manufacturer&&-1===n.manufacturer.toLowerCase().indexOf("o.e.m.")||(n.manufacturer=""),n.model&&-1===n.model.toLowerCase().indexOf("o.e.m.")||(n.model="Computer"),n.version&&-1===n.version.toLowerCase().indexOf("o.e.m.")||(n.version=""),n.sku&&-1===n.sku.toLowerCase().indexOf("o.e.m.")||(n.sku="-"),"virtualbox"===n.model.toLowerCase()||"kvm"===n.model.toLowerCase()||"virtual machine"===n.model.toLowerCase()||"bochs"===n.model.toLowerCase()||n.model.toLowerCase().startsWith("vmware")||n.model.toLowerCase().startsWith("droplet"))switch(n.virtual=!0,n.model.toLowerCase()){case"virtualbox":n.virtualHost="VirtualBox";break;case"vmware":n.virtualHost="VMware";break;case"kvm":n.virtualHost="KVM";break;case"bochs":n.virtualHost="bochs"}if(n.manufacturer.toLowerCase().startsWith("vmware")||"xen"===n.manufacturer.toLowerCase())switch(n.virtual=!0,n.manufacturer.toLowerCase()){case"vmware":n.virtualHost="VMware";break;case"xen":n.virtualHost="Xen"}if(!n.virtual)try{const e=a("ls -1 /dev/disk/by-id/ 2>/dev/null").toString();e.indexOf("_QEMU_")>=0&&(n.virtual=!0,n.virtualHost="QEMU"),e.indexOf("_VBOX_")>=0&&(n.virtual=!0,n.virtualHost="VirtualBox")}catch(e){o.noop()}if(!n.virtual&&o.linuxVersion().toLowerCase().indexOf("microsoft")>=0){let e=o.linuxVersion().toLowerCase();e=e.split("-")[0].replace("#","");const t=parseInt(e,10)||null;n.virtual=!0,n.manufacturer="Microsoft",n.model="WSL",n.version=t}if((f||h||m)&&!n.virtualHost)try{const e=a("dmidecode -t 4").toString().split("\n");switch(o.getValue(e,"manufacturer",":",!0).toLowerCase()){case"virtualbox":n.virtualHost="VirtualBox";break;case"vmware":n.virtualHost="VMware";break;case"kvm":n.virtualHost="KVM";break;case"bochs":n.virtualHost="bochs"}}catch(e){o.noop()}(r.existsSync("/.dockerenv")||r.existsSync("/.dockerinit"))&&(n.model="Docker Container");try{const e=a('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen"');e.toString().split("\n").length>0&&("Computer"===n.model&&(n.model="Virtual machine"),n.virtual=!0,e.toString().toLowerCase().indexOf("vmware")&&!n.virtualHost&&(n.virtualHost="VMware"),e.toString().toLowerCase().indexOf("qemu")&&!n.virtualHost&&(n.virtualHost="QEMU"),e.toString().toLowerCase().indexOf("xen")&&!n.virtualHost&&(n.virtualHost="Xen"),e.toString().toLowerCase().indexOf("kvm")&&!n.virtualHost&&(n.virtualHost="KVM"))}catch(e){o.noop()}""===n.manufacturer&&"Computer"===n.model&&""===n.version?r.readFile("/proc/cpuinfo",(function(r,i){if(!r){let e=i.toString().split("\n");n.model=o.getValue(e,"hardware",":",!0).toUpperCase(),n.version=o.getValue(e,"revision",":",!0).toLowerCase(),n.serial=o.getValue(e,"serial",":",!0);const t=o.getValue(e,"model:",":",!0);if(("BCM2835"===n.model||"BCM2708"===n.model||"BCM2709"===n.model||"BCM2710"===n.model||"BCM2711"===n.model||"BCM2836"===n.model||"BCM2837"===n.model)&&t.toLowerCase().indexOf("raspberry")>=0){const t=o.decodePiCpuinfo(e);n.model=t.model,n.version=t.revisionCode,n.manufacturer="Raspberry Pi Foundation",n.raspberry={manufacturer:t.manufacturer,processor:t.processor,type:t.type,revision:t.revision}}}e&&e(n),t(n)})):(e&&e(n),t(n))})),p&&s("ioreg -c IOPlatformExpertDevice -d 2",(function(r,i){if(!r){let e=i.toString().replace(/[<>"]/g,"").split("\n");n.manufacturer=o.getValue(e,"manufacturer","=",!0),n.model=o.getValue(e,"model","=",!0),n.version=o.getValue(e,"version","=",!0),n.serial=o.getValue(e,"ioplatformserialnumber","=",!0),n.uuid=o.getValue(e,"ioplatformuuid","=",!0).toLowerCase(),n.sku=o.getValue(e,"board-id","=",!0)}e&&e(n),t(n)})),g&&(e&&e(n),t(n)),d)try{o.wmic("csproduct get /value").then(((r,i)=>{if(i)e&&e(n),t(n);else{let i=r.split("\r\n");if(n.manufacturer=o.getValue(i,"vendor","="),n.model=o.getValue(i,"name","="),n.version=o.getValue(i,"version","="),n.serial=o.getValue(i,"identifyingnumber","="),n.uuid=o.getValue(i,"uuid","=").toLowerCase(),"virtualbox"===n.model.toLowerCase()||"kvm"===n.model.toLowerCase()||"virtual machine"===n.model.toLowerCase()||"bochs"===n.model.toLowerCase()||n.model.toLowerCase().startsWith("vmware"))switch(n.virtual=!0,n.model.toLowerCase()){case"virtualbox":n.virtualHost="VirtualBox";break;case"vmware":n.virtualHost="VMware";break;case"kvm":n.virtualHost="KVM";break;case"bochs":n.virtualHost="bochs"}if(n.manufacturer.toLowerCase().startsWith("vmware")||"xen"===n.manufacturer.toLowerCase())switch(n.virtual=!0,n.manufacturer.toLowerCase()){case"vmware":n.virtualHost="VMware";break;case"xen":n.virtualHost="Xen"}o.wmic("/namespace:\\\\root\\wmi path MS_SystemInformation get /value").then(((r,i)=>{if(!i){let e=r.split("\r\n");n.sku=o.getValue(e,"systemsku","=")}n.virtual?(e&&e(n),t(n)):o.wmic("bios get Version, SerialNumber, SMBIOSBIOSVersion").then(((r,i)=>{if(i)e&&e(n),t(n);else{let i=r.toString();(i.indexOf("VRTUAL")>=0||i.indexOf("A M I ")>=0||i.indexOf("VirtualBox")>=0||i.indexOf("VMWare")>=0||i.indexOf("Xen")>=0)&&(n.virtual=!0,i.indexOf("VirtualBox")>=0&&!n.virtualHost&&(n.virtualHost="VirtualBox"),i.indexOf("VMware")>=0&&!n.virtualHost&&(n.virtualHost="VMware"),i.indexOf("Xen")>=0&&!n.virtualHost&&(n.virtualHost="Xen"),i.indexOf("VRTUAL")>=0&&!n.virtualHost&&(n.virtualHost="Hyper-V"),i.indexOf("A M I")>=0&&!n.virtualHost&&(n.virtualHost="Virtual PC")),e&&e(n),t(n)}}))}))}}))}catch(r){e&&e(n),t(n)}}))}))},t.bios=function(e){return new Promise((t=>{process.nextTick((()=>{let n={vendor:"",version:"",releaseDate:"",revision:""},r="";if((u||f||h||m)&&(r="arm"===process.arch?"cat /proc/cpuinfo | grep Serial":"export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL",s(r,(function(r,i){let s=i.toString().split("\n");n.vendor=o.getValue(s,"Vendor"),n.version=o.getValue(s,"Version");let c=o.getValue(s,"Release Date");n.releaseDate=o.parseDateTime(c).date,n.revision=o.getValue(s,"BIOS Revision");let l=o.getValue(s,"Currently Installed Language").split("|")[0];if(l&&(n.language=l),s.length&&i.toString().indexOf("Characteristics:")>=0){const e=[];s.forEach((t=>{if(t.indexOf(" is supported")>=0){const n=t.split(" is supported")[0].trim();e.push(n)}})),n.features=e}try{s=a('echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo;\n echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo;\n echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;').toString().split("\n"),n.vendor=n.vendor?n.vendor:o.getValue(s,"bios_vendor"),n.version=n.version?n.version:o.getValue(s,"bios_version"),c=o.getValue(s,"bios_date"),n.releaseDate=n.releaseDate?n.releaseDate:o.parseDateTime(c).date}catch(e){o.noop()}e&&e(n),t(n)}))),p&&(n.vendor="Apple Inc.",s("system_profiler SPHardwareDataType -json",(function(r,i){try{const e=JSON.parse(i.toString());if(e&&e.SPHardwareDataType&&e.SPHardwareDataType.length){let t=e.SPHardwareDataType[0].boot_rom_version;t=t?t.split("(")[0].trim():null,n.version=t}}catch(e){o.noop()}e&&e(n),t(n)}))),g&&(n.vendor="Sun Microsystems",e&&e(n),t(n)),d)try{o.wmic("bios get /value").then(((r,i)=>{if(!i){let e=r.toString().split("\r\n");const t=o.getValue(e,"description","=");-1!==t.indexOf(" Version ")?(n.vendor=t.split(" Version ")[0].trim(),n.version=t.split(" Version ")[1].trim()):-1!==t.indexOf(" Ver: ")?(n.vendor=o.getValue(e,"manufacturer","="),n.version=t.split(" Ver: ")[1].trim()):(n.vendor=o.getValue(e,"manufacturer","="),n.version=o.getValue(e,"version","=")),n.releaseDate=o.getValue(e,"releasedate","="),n.releaseDate.length>=10&&(n.releaseDate=n.releaseDate.substr(0,4)+"-"+n.releaseDate.substr(4,2)+"-"+n.releaseDate.substr(6,2)),n.revision=o.getValue(e,"buildnumber","=")}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}))}))},t.baseboard=function(e){return new Promise((t=>{process.nextTick((()=>{let n={manufacturer:"",model:"",version:"",serial:"-",assetTag:"-",memMax:null,memSlots:null},s="";if(u||f||h||m){s="arm"===process.arch?"cat /proc/cpuinfo | grep Serial":"export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL";const l=[];l.push(c(s)),l.push(c("export LC_ALL=C; dmidecode -t memory 2>/dev/null")),o.promiseAll(l).then((s=>{let c=s.results[0]?s.results[0].toString().split("\n"):[""];n.manufacturer=o.getValue(c,"Manufacturer"),n.model=o.getValue(c,"Product Name"),n.version=o.getValue(c,"Version"),n.serial=o.getValue(c,"Serial Number"),n.assetTag=o.getValue(c,"Asset Tag");try{c=a('echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo;\n echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo;\n echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo;\n echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo;\n echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;').toString().split("\n"),n.manufacturer=n.manufacturer?n.manufacturer:o.getValue(c,"board_vendor"),n.model=n.model?n.model:o.getValue(c,"board_name"),n.version=n.version?n.version:o.getValue(c,"board_version"),n.serial=n.serial?n.serial:o.getValue(c,"board_serial"),n.assetTag=n.assetTag?n.assetTag:o.getValue(c,"board_asset_tag")}catch(e){o.noop()}-1!==n.serial.toLowerCase().indexOf("o.e.m.")&&(n.serial="-"),-1!==n.assetTag.toLowerCase().indexOf("o.e.m.")&&(n.assetTag="-"),c=s.results[1]?s.results[1].toString().split("\n"):[""],n.memMax=1024*o.toInt(o.getValue(c,"Maximum Capacity"))*1024*1024||null,n.memSlots=o.toInt(o.getValue(c,"Number Of Devices"))||null;const l=r.readFileSync("/proc/cpuinfo").toString().split("\n");if(o.getValue(l,"hardware").startsWith("BCM")){const e=o.decodePiCpuinfo(l);n.manufacturer=e.manufacturer,n.model="Raspberry Pi",n.serial=e.serial,n.version=e.type+" - "+e.revision,n.memMax=i.totalmem(),n.memSlots=0}e&&e(n),t(n)}))}if(p){const r=[];r.push(c("ioreg -c IOPlatformExpertDevice -d 2")),r.push(c("system_profiler SPMemoryDataType")),o.promiseAll(r).then((r=>{let s=r.results[0]?r.results[0].toString().replace(/[<>"]/g,"").split("\n"):[""];n.manufacturer=o.getValue(s,"manufacturer","=",!0),n.model=o.getValue(s,"model","=",!0),n.version=o.getValue(s,"version","=",!0),n.serial=o.getValue(s,"ioplatformserialnumber","=",!0),n.assetTag=o.getValue(s,"board-id","=",!0);let a=r.results[1]?r.results[1].toString().split(" BANK "):[""];1===a.length&&(a=r.results[1]?r.results[1].toString().split(" DIMM"):[""]),a.shift(),n.memSlots=a.length,"arm64"===i.arch()&&(n.memSlots=0,n.memMax=i.totalmem()),e&&e(n),t(n)}))}if(g&&(e&&e(n),t(n)),d)try{const r=[];r.push(o.wmic("baseboard get /value")),r.push(o.wmic("memphysical get MaxCapacity, MemoryDevices\t/value")),o.promiseAll(r).then((r=>{let i=r.results[0]?r.results[0].toString().split("\r\n"):[""];n.manufacturer=o.getValue(i,"manufacturer","="),n.model=o.getValue(i,"model","="),n.model||(n.model=o.getValue(i,"product","=")),n.version=o.getValue(i,"version","="),n.serial=o.getValue(i,"serialnumber","="),n.assetTag=o.getValue(i,"partnumber","="),n.assetTag||(n.assetTag=o.getValue(i,"sku","=")),i=r.results[1]?r.results[1].toString().split("\r\n"):[""],n.memMax=o.toInt(o.getValue(i,"MaxCapacity","="))||null,n.memSlots=o.toInt(o.getValue(i,"MemoryDevices","="))||null,e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}))}))},t.chassis=function(e){const t=["Other","Unknown","Desktop","Low Profile Desktop","Pizza Box","Mini Tower","Tower","Portable","Laptop","Notebook","Hand Held","Docking Station","All in One","Sub Notebook","Space-Saving","Lunch Box","Main System Chassis","Expansion Chassis","SubChassis","Bus Expansion Chassis","Peripheral Chassis","Storage Chassis","Rack Mount Chassis","Sealed-Case PC","Multi-System Chassis","Compact PCI","Advanced TCA","Blade","Blade Enclosure","Tablet","Concertible","Detachable","IoT Gateway ","Embedded PC","Mini PC","Stick PC"];return new Promise((n=>{process.nextTick((()=>{let r={manufacturer:"",model:"",type:"",version:"",serial:"-",assetTag:"-",sku:""};if(u||f||h||m){s('echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;\n echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;\n echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;\n echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo;\n echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;',(function(i,s){let a=s.toString().split("\n");r.manufacturer=o.getValue(a,"chassis_vendor");const c=parseInt(o.getValue(a,"chassis_type").replace(/\D/g,""));r.type=c&&!isNaN(c)&&c"]/g,"").split("\n");r.manufacturer=o.getValue(e,"manufacturer","=",!0),r.model=o.getValue(e,"model","=",!0),r.version=o.getValue(e,"version","=",!0),r.serial=o.getValue(e,"ioplatformserialnumber","=",!0),r.assetTag=o.getValue(e,"board-id","=",!0)}e&&e(r),n(r)})),g&&(e&&e(r),n(r)),d)try{o.wmic("path Win32_SystemEnclosure get /value").then(((i,s)=>{if(!s){let e=i.toString().split("\r\n");r.manufacturer=o.getValue(e,"manufacturer","="),r.model=o.getValue(e,"model","=");const n=parseInt(o.getValue(e,"ChassisTypes","=").replace(/\D/g,""));r.type=n&&!isNaN(n)&&n{"use strict";const r=n(3129).exec,i=n(1453);let o=process.platform;const s="linux"===o,a="darwin"===o,c="win32"===o,l="freebsd"===o,u="openbsd"===o,p="netbsd"===o,d="sunos"===o;function f(e){const t={},n=e.split("\n");if(n&&n.length&&n[0].indexOf("Device")>=0){const e=n[0].split(" ");t.bus=parseInt(e[0],10),e[2]?t.deviceId=parseInt(e[2],10):t.deviceId=null}else t.bus=null,t.deviceId=null;const r=i.getValue(n,"idVendor"," ",!0).trim();let o=r.split(" ");o.shift();const s=o.join(" "),a=i.getValue(n,"idProduct"," ",!0).trim();let c=a.split(" ");c.shift();const l=c.join(" ");let u=i.getValue(n,"bInterfaceClass"," ",!0).trim().split(" ");u.shift();const p=u.join(" ");let d=i.getValue(n,"iManufacturer"," ",!0).trim().split(" ");d.shift();const f=d.join(" ");return t.id=(r.startsWith("0x")?r.split(" ")[0].substr(2,10):"")+":"+(a.startsWith("0x")?a.split(" ")[0].substr(2,10):""),t.name=l,t.type=function(e,t){let n=e;const r=(t+" "+e).toLowerCase();return r.indexOf("camera")>=0?n="Camera":r.indexOf("hub")>=0?n="Hub":r.indexOf("keybrd")>=0||r.indexOf("keyboard")>=0?n="Keyboard":r.indexOf("mouse")>=0?n="Mouse":r.indexOf("stora")>=0?n="Storage":r.indexOf("mic")>=0?n="Microphone":(r.indexOf("headset")>=0||r.indexOf("audio")>=0)&&(n="Audio"),n}(p,l),t.removable=null,t.vendor=s,t.manufacturer=f,t.maxPower=i.getValue(n,"MaxPower"," ",!0),t.serialNumber=null,t}function h(e,t){const n={};n.id=t;let r=(e=(e=e.replace(/ \|/g,"")).trim()).split("\n");r.shift();try{for(let e=0;e=0?t="Camera":e.indexOf("touch bar")>=0?t="Touch Bar":e.indexOf("controller")>=0?t="Controller":e.indexOf("headset")>=0?t="Audio":e.indexOf("keyboard")>=0?t="Keyboard":e.indexOf("trackpad")>=0?t="Trackpad":e.indexOf("sensor")>=0?t="Sensor":e.indexOf("bthusb")>=0||e.indexOf("bth")>=0||e.indexOf("rfcomm")>=0?t="Bluetooth":e.indexOf("usbhub")>=0||e.indexOf(" hub")>=0?t="Hub":e.indexOf("mouse")>=0?t="Mouse":e.indexOf("mic")>=0?t="Microphone":e.indexOf("removable")>=0&&(t="Storage"),t}((e.kUSBProductString||e["USB Product Name"]||"").toLowerCase()+(t?" removable":"")),n.removable="no"===e["non-removable"].toLowerCase(),n.vendor=e.kUSBVendorString||e["USB Vendor Name"]||null,n.manufacturer=e.kUSBVendorString||e["USB Vendor Name"]||null,n.maxPower=null,n.serialNumber=e.kUSBSerialNumberString||null,n.name?n:null}catch(e){return null}}function m(e,t){const n=function(e,t){let n="";return t.indexOf("storage")>=0||t.indexOf("speicher")>=0?n="Storage":e.indexOf("usbhub")>=0?n="Hub":e.indexOf("storage")>=0?n="Storage":e.indexOf("usbcontroller")>=0?n="Controller":e.indexOf("keyboard")>=0?n="Keyboard":e.indexOf("pointing")>=0?n="Mouse":e.indexOf("disk")>=0&&(n="Storage"),n}(i.getValue(e,"CreationClassName","=").toLowerCase(),i.getValue(e,"name","=").toLowerCase());if(n){const r={bus:null};return r.deviceId=i.getValue(e,"deviceid","="),r.id=t,r.name=i.getValue(e,"name","="),r.type=n,r.removable=null,r.vendor=null,r.manufacturer=i.getValue(e,"Manufacturer","="),r.maxPower=null,r.serialNumber=null,r}return null}t.usb=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(s){r("export LC_ALL=C; lsusb -v 2>/dev/null; unset LC_ALL",{maxBuffer:134217728},(function(r,i){if(!r){const e=("\n\n"+i.toString()).split("\n\nBus ");for(let t=1;t{"use strict";const r=n(3129).exec,i=n(1453);let o=process.platform;const s="linux"===o,a="darwin"===o,c="win32"===o,l="freebsd"===o,u="openbsd"===o,p="netbsd"===o,d="sunos"===o;let f={dateFormat:"",dateSeperator:"",timeFormat:"",timeSeperator:"",amDesignator:"",pmDesignator:""};function h(e,t){let n=[],r=[],i={},o=!0,s=[],a=[],c={},l=!0;return e.forEach((function(e){if("---"===e)l=!1;else{let t=e.replace(/ +/g," ").split(" ");l?r.push({user:t[0],tty:t[1],date:t[2],time:t[3],ip:t&&t.length>4?t[4].replace(/\(/g,"").replace(/\)/g,""):""}):o?(s=t,s.forEach((function(t){a.push(e.indexOf(t))})),o=!1):(i.user=e.substring(a[0],a[1]-1).trim(),i.tty=e.substring(a[1],a[2]-1).trim(),i.ip=e.substring(a[2],a[3]-1).replace(/\(/g,"").replace(/\)/g,"").trim(),i.command=e.substring(a[7],1e3).trim(),c=r.filter((function(e){return e.user.substring(0,8).trim()===i.user&&e.tty===i.tty})),1===c.length&&n.push({user:c[0].user,tty:c[0].tty,date:c[0].date,time:c[0].time,ip:c[0].ip,command:i.command}))}})),0===n.length&&2===t?r:n}function m(e){let t=[],n=[],r={},i={},o=!0;return e.forEach((function(e){if("---"===e)o=!1;else{let s=e.replace(/ +/g," ").split(" ");o?n.push({user:s[0],tty:s[1],date:(new Date).getFullYear()+"-"+("0"+("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".indexOf(s[2].toUpperCase())/3+1)).slice(-2)+"-"+("0"+s[3]).slice(-2),time:s[4]}):(r.user=s[0],r.tty=s[1],r.ip="-"!==s[2]?s[2]:"",r.command=s.slice(5,1e3).join(" "),i=n.filter((function(e){return e.user===r.user&&(e.tty.substring(3,1e3)===r.tty||e.tty===r.tty)})),1===i.length&&t.push({user:i[0].user,tty:i[0].tty,date:i[0].date,time:i[0].time,ip:r.ip,command:r.command}))}})),t}t.users=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(s&&r('who --ips; echo "---"; w | tail -n +2',(function(i,o){if(i)e&&e(n),t(n);else{let i=o.toString().split("\n");n=h(i,1),0===n.length?r('who; echo "---"; w | tail -n +2',(function(r,o){r||(i=o.toString().split("\n"),n=h(i,2)),e&&e(n),t(n)})):(e&&e(n),t(n))}})),(l||u||p)&&r('who; echo "---"; w -ih',(function(r,i){if(!r){let e=i.toString().split("\n");n=m(e)}e&&e(n),t(n)})),d&&r('who; echo "---"; w -h',(function(r,i){if(!r){let e=i.toString().split("\n");n=m(e)}e&&e(n),t(n)})),a&&r('who; echo "---"; w -ih',(function(r,i){if(!r){let e=i.toString().split("\n");n=m(e)}e&&e(n),t(n)})),c)try{r("query user",i.execOptsWin,(function(r,o){if(o){let r=o.toString().split("\r\n");new Promise((e=>{process.nextTick((()=>{f.dateFormat?e(f):i.powerShell("(get-culture).DateTimeFormat").then((t=>{let n=t.toString().split("\r\n");f.dateFormat=i.getValue(n,"ShortDatePattern",":"),f.dateSeperator=i.getValue(n,"DateSeparator",":"),f.timeFormat=i.getValue(n,"ShortTimePattern",":"),f.timeSeperator=i.getValue(n,"TimeSeparator",":"),f.amDesignator=i.getValue(n,"AMDesignator",":"),f.pmDesignator=i.getValue(n,"PMDesignator",":"),e(f)})).catch((()=>{e(f)}))}))})).then((o=>{n=function(e,t){let n=[];const r=e[0],o=[];if(r){const s=" "===r[0]?1:0;o.push(s-1);let a=0;for(let e=s+1;e{"use strict";const r=n(2087),i=n(5747),o=n(5622),s=n(3129).spawn,a=n(3129).exec,c=n(3129).execSync,l=n(1669);let u=process.platform;const p="linux"===u,d="darwin"===u,f="win32"===u,h="freebsd"===u,m="openbsd"===u,g="netbsd"===u;let v=0,y="",_="";const E=process.env.WINDIR||"C:\\Windows",b={windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:l._extend({},process.env,{LANG:"en_US.UTF-8"})};const w=(new String).replace,S=(new String).toLowerCase,I=(new String).toString,C=(new String).substr,x=(new String).trim,O=(new String).startsWith,T=Math.min;function A(e,t,n,r){n=n||":",t=t.toLowerCase(),r=r||!1;for(let i=0;i=2?(t.shift(),t.join(n).trim()):""}}return""}function N(){if("Windows_NT"===r.type()&&!y&&(y=E+"\\system32\\wbem\\wmic.exe",!i.existsSync(y)))try{const e=c("WHERE WMIC",b).toString().split("\r\n");y=e&&e.length?e[0]:"wmic"}catch(e){y="wmic"}return y}t.toInt=function(e){let t=parseInt(e,10);return isNaN(t)&&(t=0),t},t.execOptsWin=b,t.getCodepage=function(){if(f){if(!_)try{const e=c("chcp",b),t=e.toString().split("\r\n")[0].split(":");_=t.length>1?t[1].replace(".",""):""}catch(e){_="437"}return _}if(p||d||h||m||g){if(!_)try{const e=c("echo $LANG"),t=e.toString().split("\r\n")[0].split(".");_=t.length>1?t[1].trim():"",_||(_="UTF-8")}catch(e){_="UTF-8"}return _}},t.execWin=function(e,t,n){n||(n=t,t=b),a("chcp 65001 > nul && cmd /C "+e+" && chcp "+_+" > nul",t,(function(e,t){n(e,t)}))},t.isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)},t.unique=function(e){let t=[],n={};for(let r=0;ri?1:0}))},t.cores=function(){return 0===v&&(v=r.cpus().length),v},t.getValue=A,t.decodeEscapeSequence=function(e,t){return t=t||16,e.replace(/\\x([0-9A-Fa-f]{2})/g,(function(){return String.fromCharCode(parseInt(arguments[1],t))}))},t.parseDateTime=function(e,t){const n={date:"",time:""};let r=((t=t||{}).dateFormat||"").toLowerCase(),i=t.pmDesignator||"";const o=e.split(" ");if(o[0]){if(o[0].indexOf("/")>=0){const t=o[0].split("/");if(3===t.length)if(4===t[0].length)n.date=t[0]+"-"+("0"+t[1]).substr(-2)+"-"+("0"+t[2]).substr(-2);else if(2===t[2].length)r.indexOf("/d/")>-1||r.indexOf("/dd/"),n.date="20"+t[2]+"-"+("0"+t[1]).substr(-2)+"-"+("0"+t[0]).substr(-2);else{(e.toLowerCase().indexOf("pm")>-1||e.toLowerCase().indexOf("p.m.")>-1||e.toLowerCase().indexOf("p. m.")>-1||e.toLowerCase().indexOf("am")>-1||e.toLowerCase().indexOf("a.m.")>-1||e.toLowerCase().indexOf("a. m.")>-1||r.indexOf("/d/")>-1||r.indexOf("/dd/")>-1)&&0!==r.indexOf("dd/")?n.date=t[2]+"-"+("0"+t[0]).substr(-2)+"-"+("0"+t[1]).substr(-2):n.date=t[2]+"-"+("0"+t[1]).substr(-2)+"-"+("0"+t[0]).substr(-2)}}if(o[0].indexOf(".")>=0){const e=o[0].split(".");3===e.length&&(r.indexOf(".d.")>-1||r.indexOf(".dd.")>-1?n.date=e[2]+"-"+("0"+e[0]).substr(-2)+"-"+("0"+e[1]).substr(-2):n.date=e[2]+"-"+("0"+e[1]).substr(-2)+"-"+("0"+e[0]).substr(-2))}if(o[0].indexOf("-")>=0){const e=o[0].split("-");3===e.length&&(n.date=e[0]+"-"+("0"+e[1]).substr(-2)+"-"+("0"+e[2]).substr(-2))}}if(o[1]){o.shift();let e=o.join(" ");n.time=function(e,t){t=t||"";let n=0,r=0,i=function(e){let t="",n=0;return e.split("").forEach((e=>{e>="0"&&e<="9"?1===n&&n++:(0===n&&n++,1===n&&(t+=e))})),t}(e=e.toUpperCase()),o=e.split(i);if(o.length>=2){o[2]&&(o[1]+=o[2]);let e=o[1]&&o[1].toLowerCase().indexOf("pm")>-1||o[1].toLowerCase().indexOf("p.m.")>-1||o[1].toLowerCase().indexOf("p. m.")>-1||o[1].toLowerCase().indexOf("n")>-1||o[1].toLowerCase().indexOf("ch")>-1||o[1].toLowerCase().indexOf("ös")>-1||t&&o[1].toLowerCase().indexOf(t)>-1;return n=parseInt(o[0],10),r=parseInt(o[1],10),n=e&&n<12?n+12:n,("0"+n).substr(-2)+":"+("0"+r).substr(-2)}}(e,i)}return n},t.parseHead=function(e,t){let n=t>0,r=1,i=0,o=0,s=[];for(let a=0;a{process.nextTick((()=>{try{a(E+"\\system32\\chcp.com 65001 | "+N()+" "+e,t,(function(e,t){n(t,e)})).stdin.end()}catch(e){n("",e)}}))}))},t.darwinXcodeExists=function(){const e=i.existsSync("/Library/Developer/CommandLineTools/usr/bin/"),t=i.existsSync("/Applications/Xcode.app/Contents/Developer/Tools"),n=i.existsSync("/Library/Developer/Xcode/");return e||n||t},t.getVboxmanage=function(){return f?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"},t.powerShell=function(e){let t="";return new Promise((n=>{process.nextTick((()=>{try{const i=s("powershell.exe",["-NoLogo","-InputFormat","Text","-NoExit","-ExecutionPolicy","Unrestricted","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:l._extend({},process.env,{LANG:"en_US.UTF-8"})});if(i&&!i.pid&&i.on("error",(function(){n(t)})),i&&i.pid){i.stdout.on("data",(function(e){t+=e.toString("utf8")})),i.stderr.on("data",(function(){i.kill(),n(t)})),i.on("close",(function(){i.kill(),n(t)})),i.on("error",(function(){i.kill(),n(t)}));try{i.stdin.write(e+r.EOL),i.stdin.write("exit"+r.EOL),i.stdin.end()}catch(e){i.kill(),n(t)}}else n(t)}catch(e){n(t)}}))}))},t.execSafe=function(e,t,n){let r="";return n=n||{},new Promise((i=>{process.nextTick((()=>{try{const o=s(e,t,n);o&&!o.pid&&o.on("error",(function(){i(r)})),o&&o.pid?(o.stdout.on("data",(function(e){r+=e.toString()})),o.on("close",(function(){o.kill(),i(r)})),o.on("error",(function(){o.kill(),i(r)}))):i(r)}catch(e){i(r)}}))}))},t.nanoSeconds=function(){const e=process.hrtime();return Array.isArray(e)&&2===e.length?1e9*+e[0]+ +e[1]:0},t.countUniqueLines=function(e,t){t=t||"";const n=[];return e.forEach((e=>{e.startsWith(t)&&-1===n.indexOf(e)&&n.push(e)})),n.length},t.countLines=function(e,t){t=t||"";const n=[];return e.forEach((e=>{e.startsWith(t)&&n.push(e)})),n.length},t.noop=function(){},t.isRaspberry=function(){let e=[];try{e=i.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split("\n")}catch(e){return!1}const t=A(e,"hardware");return t&&["BCM2708","BCM2709","BCM2710","BCM2711","BCM2835","BCM2836","BCM2837","BCM2837B0"].indexOf(t)>-1},t.isRaspbian=function(){let e=[];try{e=i.readFileSync("/etc/os-release",{encoding:"utf8"}).toString().split("\n")}catch(e){return!1}const t=A(e,"id","=");return t&&t.indexOf("raspbian")>-1},t.sanitizeShellString=function(e,t=!1){const n=e||"";let r="";for(let e=0;e<=T(n.length,2e3);e++)void 0===n[e]||">"===n[e]||"<"===n[e]||"*"===n[e]||"?"===n[e]||"["===n[e]||"]"===n[e]||"|"===n[e]||"˚"===n[e]||"$"===n[e]||";"===n[e]||"&"===n[e]||"("===n[e]||")"===n[e]||"]"===n[e]||"#"===n[e]||"\\"===n[e]||"\t"===n[e]||"\n"===n[e]||"'"===n[e]||"`"===n[e]||'"'===n[e]||n[e].length>1||t&&"@"===n[e]||t&&" "===n[e]||t&&"{"==n[e]||t&&")"==n[e]||(r+=n[e]);return r},t.isPrototypePolluted=function(){const e="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let t=!0,n="";n.__proto__.replace=w,n.__proto__.toLowerCase=S,n.__proto__.toString=I,n.__proto__.substr=C,t=t||!(62===e.length);const r=Date.now();if("number"==typeof r&&r>16e11){const i=r%100+15;for(let r=0;r{"use strict";const r=n(2087),i=n(3129).exec,o=n(1453);t.vboxInfo=function(e){let t=[];return new Promise((n=>{process.nextTick((()=>{try{i(o.getVboxmanage()+" list vms --long",(function(i,s){let a=(r.EOL+s.toString()).split(r.EOL+"Name:");a.shift(),a.forEach((e=>{const n=("Name:"+e).split(r.EOL),i=o.getValue(n,"State"),s=i.startsWith("running"),a=s?i.replace("running (since ","").replace(")","").trim():"";let c=0;try{if(s){const e=new Date(a),t=e.getTimezoneOffset();c=Math.round((Date.now()-Date.parse(e))/1e3)+60*t}}catch(e){o.noop()}const l=s?"":i.replace("powered off (since","").replace(")","").trim();let u=0;try{if(!s){const e=new Date(l),t=e.getTimezoneOffset();u=Math.round((Date.now()-Date.parse(e))/1e3)+60*t}}catch(e){o.noop()}t.push({id:o.getValue(n,"UUID"),name:o.getValue(n,"Name"),running:s,started:a,runningSince:c,stopped:l,stoppedSince:u,guestOS:o.getValue(n,"Guest OS"),hardwareUUID:o.getValue(n,"Hardware UUID"),memory:parseInt(o.getValue(n,"Memory size"," "),10),vram:parseInt(o.getValue(n,"VRAM size"),10),cpus:parseInt(o.getValue(n,"Number of CPUs"),10),cpuExepCap:o.getValue(n,"CPU exec cap"),cpuProfile:o.getValue(n,"CPUProfile"),chipset:o.getValue(n,"Chipset"),firmware:o.getValue(n,"Firmware"),pageFusion:"enabled"===o.getValue(n,"Page Fusion"),configFile:o.getValue(n,"Config file"),snapshotFolder:o.getValue(n,"Snapshot folder"),logFolder:o.getValue(n,"Log folder"),hpet:"enabled"===o.getValue(n,"HPET"),pae:"enabled"===o.getValue(n,"PAE"),longMode:"enabled"===o.getValue(n,"Long Mode"),tripleFaultReset:"enabled"===o.getValue(n,"Triple Fault Reset"),apic:"enabled"===o.getValue(n,"APIC"),x2Apic:"enabled"===o.getValue(n,"X2APIC"),acpi:"enabled"===o.getValue(n,"ACPI"),ioApic:"enabled"===o.getValue(n,"IOAPIC"),biosApicMode:o.getValue(n,"BIOS APIC mode"),bootMenuMode:o.getValue(n,"Boot menu mode"),bootDevice1:o.getValue(n,"Boot Device 1"),bootDevice2:o.getValue(n,"Boot Device 2"),bootDevice3:o.getValue(n,"Boot Device 3"),bootDevice4:o.getValue(n,"Boot Device 4"),timeOffset:o.getValue(n,"Time offset"),rtc:o.getValue(n,"RTC")})})),e&&e(t),n(t)}))}catch(r){e&&e(t),n(t)}}))}))}},2023:(e,t,n)=>{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(1453);let a=process.platform;const c="linux"===a,l="darwin"===a,u="win32"===a;function p(e){return parseFloat(e)/2-100}function d(e){const t=2*(parseFloat(e)+100);return t<=100?t:100}const f={1:2412,2:2417,3:2422,4:2427,5:2432,6:2437,7:2442,8:2447,9:2452,10:2457,11:2462,12:2467,13:2472,14:2484,32:5160,34:5170,36:5180,38:5190,40:5200,42:5210,44:5220,46:5230,48:5240,50:5250,52:5260,54:5270,56:5280,58:5290,60:5300,62:5310,64:5320,68:5340,96:5480,100:5500,102:5510,104:5520,106:5530,108:5540,110:5550,112:5560,114:5570,116:5580,118:5590,120:5600,122:5610,124:5620,126:5630,128:5640,132:5660,134:5670,136:5680,138:5690,140:5700,142:5710,144:5720,149:5745,151:5755,153:5765,155:5775,157:5785,159:5795,161:5805,165:5825,169:5845,173:5865,183:4915,184:4920,185:4925,187:4935,188:4940,189:4945,192:4960,196:4980};function h(e){return{}.hasOwnProperty.call(f,e)?f[e]:null}function m(e){let t=0;for(let n in f)({}).hasOwnProperty.call(f,n)&&f[n]===e&&(t=s.toInt(n));return t}function g(){const e=[];try{const t=o("iw dev").toString().split("\n").map((e=>e.trim())).join("\n").split("\nInterface ");return t.shift(),t.forEach((t=>{const n=t.split("\n"),r=n[0],i=s.toInt(s.getValue(n,"ifindex"," ")),o=s.getValue(n,"addr"," "),a=s.toInt(s.getValue(n,"channel"," "));e.push({id:i,iface:r,mac:o,channel:a})})),e}catch(e){return[]}}function v(e){const t=`nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${e} 2>/dev/null`;try{const n=o(t).toString().split("\n"),r=s.getValue(n,"GENERAL.CONNECTION");return{iface:e,type:s.getValue(n,"GENERAL.TYPE"),vendor:s.getValue(n,"GENERAL.VENDOR"),product:s.getValue(n,"GENERAL.PRODUCT"),mac:s.getValue(n,"GENERAL.HWADDR").toLowerCase(),ssid:"--"!==r?r:null}}catch(e){return{}}}function y(){const e=[];try{const t=o("nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null",{maxBuffer:2048e4}).toString().split("ACTIVE:");return t.shift(),t.forEach((t=>{const n=(t="ACTIVE:"+t).split(r.EOL),i=s.getValue(n,"CHAN"),o=s.getValue(n,"FREQ").toLowerCase().replace("mhz","").trim(),a=s.getValue(n,"SECURITY").replace("(","").replace(")",""),c=s.getValue(n,"WPA-FLAGS").replace("(","").replace(")",""),l=s.getValue(n,"RSN-FLAGS").replace("(","").replace(")","");e.push({ssid:s.getValue(n,"SSID"),bssid:s.getValue(n,"BSSID").toLowerCase(),mode:s.getValue(n,"MODE"),channel:i?parseInt(i,10):null,frequency:o?parseInt(o,10):null,signalLevel:p(s.getValue(n,"SIGNAL")),quality:parseFloat(s.getValue(n,"SIGNAL")),security:a&&"none"!==a?a.split(" "):[],wpaFlags:c&&"none"!==c?c.split(" "):[],rsnFlags:l&&"none"!==l?l.split(" "):[]})})),e}catch(e){return[]}}function _(e){const t=[];try{let n=o(`export LC_ALL=C; iwlist ${e} scan 2>&1; unset LC_ALL`).toString().split(" Cell ");if(n[0].indexOf("resource busy")>=0)return-1;if(n.length>1){n.shift();for(let e=0;e=0?r[0].split("Address:")[1].trim().toLowerCase():"",a=s.getValue(r,"mode",":",!0),c=s.getValue(r,"frequency",":",!0),l=s.getValue(r,"Quality","=",!0).toLowerCase().split("signal level="),u=l.length>1?s.toInt(l[1]):0,p=u?d(u):0,f=s.getValue(r,"essid",":",!0),h=n[e].indexOf(" WPA ")>=0,m=n[e].indexOf("WPA2 ")>=0,g=[];h&&g.push("WPA"),m&&g.push("WPA2");const v=[];let y="";r.forEach((function(e){const t=e.trim().toLowerCase();if(t.indexOf("group cipher")>=0){y&&v.push(y);const e=t.split(":");e.length>1&&(y=e[1].trim().toUpperCase())}if(t.indexOf("pairwise cipher")>=0){const e=t.split(":");e.length>1&&(e[1].indexOf("tkip")?y=y?"TKIP/"+y:"TKIP":e[1].indexOf("ccmp")?y=y?"CCMP/"+y:"CCMP":e[1].indexOf("proprietary")&&(y=y?"PROP/"+y:"PROP"))}if(t.indexOf("authentication suites")>=0){const e=t.split(":");e.length>1&&(e[1].indexOf("802.1x")?y=y?"802.1x/"+y:"802.1x":e[1].indexOf("psk")&&(y=y?"PSK/"+y:"PSK"))}})),y&&v.push(y),t.push({ssid:f,bssid:o,mode:a,channel:i?s.toInt(i):null,frequency:c?s.toInt(c.replace(".","")):null,signalLevel:u,quality:p,security:g,wpaFlags:v,rsnFlags:[]})}}return t}catch(e){return-1}}t.wifiNetworks=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(c)if(n=y(),0===n.length)try{const r=o("export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL").toString().split("\n\n");let i="";for(let e=0;e1){const e=s.parseHead(a[0],1);e.length>=7&&(a.shift(),a.forEach((t=>{if(t.trim()){const r=t.substring(e[3].from,e[3].to).trim(),i=r?parseInt(r,10):null,o=t.substring(e[2].from,e[2].to).trim(),s=t.substring(e[6].from,1e3).trim().split(" ");let a=[],c=[];s.forEach((e=>{if(e.indexOf("(")>0){const t=e.split("(");a.push(t[0]),c=c.concat(t[1].replace(")","").split(","))}})),c=Array.from(new Set(c)),n.push({ssid:t.substring(e[0].from,e[0].to).trim(),bssid:t.substring(e[1].from,e[1].to).trim().toLowerCase(),mode:"",channel:i,frequency:h(i),signalLevel:o?parseInt(o,10):null,quality:d(o),security:a,wpaFlags:c,rsnFlags:[]})}})))}e&&e(n),t(n)}))}else if(u){i("chcp 65001 && netsh wlan show networks mode=Bssid",s.execOptsWin,(function(i,o){const s=o.toString("utf8").split(r.EOL+r.EOL+"SSID ");s.shift(),s.forEach((e=>{const t=e.split(r.EOL);if(t&&t.length>=8&&t[0].indexOf(":")>=0){let e=t[4].split(":");e.shift(),e=e.join(":").trim().toLowerCase();const r=t[7].split(":").pop().trim(),i=t[5].split(":").pop().trim();n.push({ssid:t[0].split(":").pop().trim(),bssid:e,mode:"",channel:r?parseInt(r,10):null,frequency:h(r),signalLevel:p(i),quality:i?parseInt(i,10):null,security:[t[2].split(":").pop().trim()],wpaFlags:[t[3].split(":").pop().trim()],rsnFlags:[]})}})),e&&e(n),t(n)}))}else e&&e(n),t(n)}))}))},t.wifiConnections=function(e){return new Promise((t=>{process.nextTick((()=>{const n=[];if(c){const r=g(),i=y();r.forEach((e=>{const t=v(e.iface),r=function(e){const t=`wpa_cli -i ${e} status 2>&1`;try{const e=o(t).toString().split("\n"),n=s.toInt(s.getValue(e,"freq","="));return{ssid:s.getValue(e,"ssid","="),uuid:s.getValue(e,"uuid","="),security:s.getValue(e,"key_mgmt","="),freq:n,channel:m(n),bssid:s.getValue(e,"bssid","=").toLowerCase()}}catch(e){return{}}}(e.iface),a=t.ssid||r.ssid,c=i.filter((e=>e.ssid===a)),l=function(e){const t=`nmcli -t --show-secrets connection show ${e} 2>/dev/null`;try{const n=o(t).toString().split("\n"),r=s.getValue(n,"802-11-wireless.seen-bssids").toLowerCase();return{ssid:"--"!==e?e:null,uuid:s.getValue(n,"connection.uuid"),type:s.getValue(n,"connection.type"),autoconnect:"yes"===s.getValue(n,"connection.autoconnect"),security:s.getValue(n,"802-11-wireless-security.key-mgmt"),bssid:"--"!==r?r:null}}catch(e){return{}}}(a),u=c&&c.length&&c[0].channel?c[0].channel:r.channel?r.channel:null,p=c&&c.length&&c[0].bssid?c[0].bssid:r.bssid?r.bssid:null;a&&p&&n.push({id:e.id,iface:e.iface,model:t.product,ssid:a,bssid:c&&c.length&&c[0].bssid?c[0].bssid:r.bssid?r.bssid:null,channel:u,frequency:u?h(u):null,type:l.type?l.type:"802.11",security:l.security?l.security:r.security?r.security:null,signalLevel:c&&c.length&&c[0].signalLevel?c[0].signalLevel:null,txRate:null})})),e&&e(n),t(n)}else if(l){let r="system_profiler SPNetworkDataType";i(r,(function(o,a){const c=a.toString().split("\n\n Wi-Fi:\n\n");if(c.length>1){const o=c[1].split("\n\n")[0].split("\n"),a=s.getValue(o,"BSD Device Name",":",!0),l=s.getValue(o,"hardware",":",!0);r="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I",i(r,(function(r,i){const c=i.toString().split("\n");if(o.length>10){const e=s.getValue(c,"ssid",":",!0),t=s.getValue(c,"bssid",":",!0),r=s.getValue(c,"link auth",":",!0),i=s.getValue(c,"lastTxRate",":",!0),o=s.getValue(c,"channel",":",!0).split(",")[0],u="802.11",p=s.toInt(s.getValue(c,"agrCtlRSSI",":",!0))-s.toInt(s.getValue(c,"agrCtlNoise",":",!0));e&&t&&n.push({id:"Wi-Fi",iface:a,model:l,ssid:e,bssid:t,channel:s.toInt(o),frequency:o?h(o):null,type:u,security:r,signalLevel:p,txRate:i})}e&&e(n),t(n)}))}}))}else if(u){i("netsh wlan show interfaces",s.execOptsWin,(function(r,i){const o=i.toString().split(":\r\n\r\n");o.shift(),o.forEach((e=>{const t=e.split("\r\n");if(t.length>=5){const e=t[0].indexOf(":")>=0?t[0].split(":")[1].trim():"",r=t[1].indexOf(":")>=0?t[1].split(":")[1].trim():"",i=t[2].indexOf(":")>=0?t[2].split(":")[1].trim():"",o=s.getValue(t,"SSID",":",!0),a=s.getValue(t,"BSSID",":",!0),c=s.getValue(t,"Signal",":",!0),l=s.getValue(t,"Radio type",":",!0)||s.getValue(t,"Type de radio",":",!0)||s.getValue(t,"Funktyp",":",!0)||null,u=s.getValue(t,"authentication",":",!0)||s.getValue(t,"Authentification",":",!0)||s.getValue(t,"Authentifizierung",":",!0)||null,p=s.getValue(t,"Channel",":",!0)||s.getValue(t,"Canal",":",!0)||s.getValue(t,"Kanal",":",!0)||null,d=s.getValue(t,"Transmit rate (mbps)",":",!0)||s.getValue(t,"Transmission (mbit/s)",":",!0)||s.getValue(t,"Empfangsrate (MBit/s)",":",!0)||null;r&&i&&o&&a&&n.push({id:i,iface:e,model:r,ssid:o,bssid:a,channel:s.toInt(p),frequency:p?h(p):null,type:l,security:u,signalLevel:c,txRate:s.toInt(d)||null})}})),e&&e(n),t(n)}))}else e&&e(n),t(n)}))}))},t.wifiInterfaces=function(e){return new Promise((t=>{process.nextTick((()=>{const n=[];if(c){g().forEach((e=>{const t=v(e.iface);n.push({id:e.id,iface:e.iface,model:t.product?t.product:null,vendor:t.vendor?t.vendor:null,mac:e.mac})})),e&&e(n),t(n)}else if(l){i("system_profiler SPNetworkDataType",(function(r,i){const o=i.toString().split("\n\n Wi-Fi:\n\n");if(o.length>1){const e=o[1].split("\n\n")[0].split("\n"),t=s.getValue(e,"BSD Device Name",":",!0),r=s.getValue(e,"MAC Address",":",!0),i=s.getValue(e,"hardware",":",!0);n.push({id:"Wi-Fi",iface:t,model:i,vendor:"",mac:r})}e&&e(n),t(n)}))}else if(u){i("netsh wlan show interfaces",s.execOptsWin,(function(r,i){const o=i.toString().split(":\r\n\r\n");o.shift(),o.forEach((e=>{const t=e.split("\r\n");if(t.length>=5){const e=t[0].indexOf(":")>=0?t[0].split(":")[1].trim():"",r=t[1].indexOf(":")>=0?t[1].split(":")[1].trim():"",i=t[2].indexOf(":")>=0?t[2].split(":")[1].trim():"",o=t[3].indexOf(":")>=0?t[3].split(":"):[];o.shift();const s=o.join(":").trim(),a=function(e){let t="";return(e=e.toLowerCase()).indexOf("intel")>=0?t="Intel":e.indexOf("realtek")>=0?t="Realtek":e.indexOf("qualcom")>=0?t="Qualcom":e.indexOf("broadcom")>=0?t="Broadcom":e.indexOf("cavium")>=0?t="Cavium":e.indexOf("cisco")>=0?t="Cisco":e.indexOf("marvel")>=0?t="Marvel":e.indexOf("zyxel")>=0?t="Zyxel":e.indexOf("melanox")>=0?t="Melanox":e.indexOf("d-link")>=0?t="D-Link":e.indexOf("tp-link")>=0?t="TP-Link":e.indexOf("asus")>=0?t="Asus":e.indexOf("linksys")>=0&&(t="Linksys"),t}(r);e&&r&&i&&s&&n.push({id:i,iface:e,model:r,vendor:a,mac:s})}})),e&&e(n),t(n)}))}else e&&e(n),t(n)}))}))}},702:e=>{"use strict";e.exports={i8:"5.6.12"}},6276:(e,t,n)=>{ + */e=n.nmd(e),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=16,u=32,l=64,p=128,f=256,d=1/0,h=9007199254740991,m=NaN,g=4294967295,v=[["ary",p],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",l],["rearg",f]],y="[object Arguments]",_="[object Array]",E="[object Boolean]",b="[object Date]",w="[object Error]",S="[object Function]",I="[object GeneratorFunction]",C="[object Map]",x="[object Number]",O="[object Object]",T="[object Promise]",A="[object RegExp]",N="[object Set]",P="[object String]",L="[object Symbol]",R="[object WeakMap]",k="[object ArrayBuffer]",D="[object DataView]",M="[object Float32Array]",V="[object Float64Array]",F="[object Int8Array]",j="[object Int16Array]",B="[object Int32Array]",U="[object Uint8Array]",$="[object Uint8ClampedArray]",H="[object Uint16Array]",q="[object Uint32Array]",G=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,K=RegExp(Y.source),Q=RegExp(X.source),J=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ie=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ie.source),se=/^\s+/,ae=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,pe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,de=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,me=/\w*$/,ge=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,ye=/^\[object .+?Constructor\]$/,_e=/^0o[0-7]+$/i,Ee=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,we=/($^)/,Se=/['\n\r\u2028\u2029\\]/g,Ie="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="\\u2700-\\u27bf",xe="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ne="['’]",Pe="[\\ud800-\\udfff]",Le="["+Ae+"]",Re="["+Ie+"]",ke="\\d+",De="[\\u2700-\\u27bf]",Me="["+xe+"]",Ve="[^\\ud800-\\udfff"+Ae+ke+Ce+xe+Oe+"]",Fe="\\ud83c[\\udffb-\\udfff]",je="[^\\ud800-\\udfff]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Ue="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Oe+"]",He="(?:"+Me+"|"+Ve+")",qe="(?:"+$e+"|"+Ve+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",ze="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Re+"|"+Fe+")"+"?",Ye="[\\ufe0e\\ufe0f]?",Xe=Ye+We+("(?:\\u200d(?:"+[je,Be,Ue].join("|")+")"+Ye+We+")*"),Ke="(?:"+[De,Be,Ue].join("|")+")"+Xe,Qe="(?:"+[je+Re+"?",Re,Be,Ue,Pe].join("|")+")",Je=RegExp(Ne,"g"),Ze=RegExp(Re,"g"),et=RegExp(Fe+"(?="+Fe+")|"+Qe+Xe,"g"),tt=RegExp([$e+"?"+Me+"+"+Ge+"(?="+[Le,$e,"$"].join("|")+")",qe+"+"+ze+"(?="+[Le,$e+He,"$"].join("|")+")",$e+"?"+He+"+"+Ge,$e+"+"+ze,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ke,Ke].join("|"),"g"),nt=RegExp("[\\u200d\\ud800-\\udfff"+Ie+Te+"]"),rt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[M]=st[V]=st[F]=st[j]=st[B]=st[U]=st[$]=st[H]=st[q]=!0,st[y]=st[_]=st[k]=st[E]=st[D]=st[b]=st[w]=st[S]=st[C]=st[x]=st[O]=st[A]=st[N]=st[P]=st[R]=!1;var at={};at[y]=at[_]=at[k]=at[D]=at[E]=at[b]=at[M]=at[V]=at[F]=at[j]=at[B]=at[C]=at[x]=at[O]=at[A]=at[N]=at[P]=at[L]=at[U]=at[$]=at[H]=at[q]=!0,at[w]=at[S]=at[R]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,pt="object"==typeof global&&global&&global.Object===Object&&global,ft="object"==typeof self&&self&&self.Object===Object&&self,dt=pt||ft||Function("return this")(),ht=t&&!t.nodeType&&t,mt=ht&&e&&!e.nodeType&&e,gt=mt&&mt.exports===ht,vt=gt&&pt.process,yt=function(){try{var e=mt&&mt.require&&mt.require("util").types;return e||vt&&vt.binding&&vt.binding("util")}catch(e){}}(),_t=yt&&yt.isArrayBuffer,Et=yt&&yt.isDate,bt=yt&&yt.isMap,wt=yt&&yt.isRegExp,St=yt&&yt.isSet,It=yt&&yt.isTypedArray;function Ct(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Lt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function tn(e,t){for(var n=e.length;n--&&Ut(t,e[n],0)>-1;);return n}function nn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var rn=zt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),on=zt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+ct[e]}function an(e){return nt.test(e)}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function ln(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"});var vn=function e(t){var n,r=(t=null==t?dt:vn.defaults(dt.Object(),t,vn.pick(dt,it))).Array,ae=t.Date,Ie=t.Error,Ce=t.Function,xe=t.Math,Oe=t.Object,Te=t.RegExp,Ae=t.String,Ne=t.TypeError,Pe=r.prototype,Le=Ce.prototype,Re=Oe.prototype,ke=t["__core-js_shared__"],De=Le.toString,Me=Re.hasOwnProperty,Ve=0,Fe=(n=/[^.]+$/.exec(ke&&ke.keys&&ke.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",je=Re.toString,Be=De.call(Oe),Ue=dt._,$e=Te("^"+De.call(Me).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=gt?t.Buffer:i,qe=t.Symbol,Ge=t.Uint8Array,ze=He?He.allocUnsafe:i,We=un(Oe.getPrototypeOf,Oe),Ye=Oe.create,Xe=Re.propertyIsEnumerable,Ke=Pe.splice,Qe=qe?qe.isConcatSpreadable:i,et=qe?qe.iterator:i,nt=qe?qe.toStringTag:i,ct=function(){try{var e=ho(Oe,"defineProperty");return e({},"",{}),e}catch(e){}}(),pt=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ft=ae&&ae.now!==dt.Date.now&&ae.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,mt=xe.ceil,vt=xe.floor,yt=Oe.getOwnPropertySymbols,Ft=He?He.isBuffer:i,zt=t.isFinite,yn=Pe.join,_n=un(Oe.keys,Oe),En=xe.max,bn=xe.min,wn=ae.now,Sn=t.parseInt,In=xe.random,Cn=Pe.reverse,xn=ho(t,"DataView"),On=ho(t,"Map"),Tn=ho(t,"Promise"),An=ho(t,"Set"),Nn=ho(t,"WeakMap"),Pn=ho(Oe,"create"),Ln=Nn&&new Nn,Rn={},kn=Uo(xn),Dn=Uo(On),Mn=Uo(Tn),Vn=Uo(An),Fn=Uo(Nn),jn=qe?qe.prototype:i,Bn=jn?jn.valueOf:i,Un=jn?jn.toString:i;function $n(e){if(ia(e)&&!Ws(e)&&!(e instanceof zn)){if(e instanceof Gn)return e;if(Me.call(e,"__wrapped__"))return $o(e)}return new Gn(e)}var Hn=function(){function e(){}return function(t){if(!ra(t))return{};if(Ye)return Ye(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function qn(){}function Gn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function zn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function lr(e,t,n,r,o,s){var a,c=1&t,u=2&t,l=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!ra(e))return e;var p=Ws(e);if(p){if(a=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Me.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Pi(e,a)}else{var f=vo(e),d=f==S||f==I;if(Qs(e))return Ci(e,c);if(f==O||f==y||d&&!o){if(a=u||d?{}:_o(e),!c)return u?function(e,t){return Li(e,go(e),t)}(e,function(e,t){return e&&Li(t,Da(t),e)}(a,e)):function(e,t){return Li(e,mo(e),t)}(e,sr(a,e))}else{if(!at[f])return o?e:{};a=function(e,t,n){var r=e.constructor;switch(t){case k:return xi(e);case E:case b:return new r(+e);case D:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case M:case V:case F:case j:case B:case U:case $:case H:case q:return Oi(e,n);case C:return new r;case x:case P:return new r(e);case A:return function(e){var t=new e.constructor(e.source,me.exec(e));return t.lastIndex=e.lastIndex,t}(e);case N:return new r;case L:return i=e,Bn?Oe(Bn.call(i)):{}}var i}(e,f,c)}}s||(s=new Qn);var h=s.get(e);if(h)return h;s.set(e,a),ua(e)?e.forEach((function(r){a.add(lr(r,t,n,r,e,s))})):oa(e)&&e.forEach((function(r,i){a.set(i,lr(r,t,n,i,e,s))}));var m=p?i:(l?u?so:oo:u?Da:ka)(e);return Ot(m||e,(function(r,i){m&&(r=e[i=r]),rr(a,i,lr(r,t,n,i,e,s))})),a}function pr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Oe(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function fr(e,t,n){if("function"!=typeof e)throw new Ne(o);return ko((function(){e.apply(i,n)}),t)}function dr(e,t,n,r){var i=-1,o=Pt,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;n&&(t=Rt(t,Qt(n))),r?(o=Lt,s=!1):t.length>=200&&(o=Zt,s=!1,t=new Kn(t));e:for(;++i-1},Yn.prototype.set=function(e,t){var n=this.__data__,r=ir(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Xn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(On||Yn),string:new Wn}},Xn.prototype.delete=function(e){var t=po(this,e).delete(e);return this.size-=t?1:0,t},Xn.prototype.get=function(e){return po(this,e).get(e)},Xn.prototype.has=function(e){return po(this,e).has(e)},Xn.prototype.set=function(e,t){var n=po(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Kn.prototype.add=Kn.prototype.push=function(e){return this.__data__.set(e,s),this},Kn.prototype.has=function(e){return this.__data__.has(e)},Qn.prototype.clear=function(){this.__data__=new Yn,this.size=0},Qn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Qn.prototype.get=function(e){return this.__data__.get(e)},Qn.prototype.has=function(e){return this.__data__.has(e)},Qn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Yn){var r=n.__data__;if(!On||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Xn(r)}return n.set(e,t),this.size=n.size,this};var hr=Di(wr),mr=Di(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function vr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?_r(a,t-1,n,r,i):kt(i,a):r||(i[i.length]=a)}return i}var Er=Mi(),br=Mi(!0);function wr(e,t){return e&&Er(e,t,ka)}function Sr(e,t){return e&&br(e,t,ka)}function Ir(e,t){return Nt(t,(function(t){return ea(e[t])}))}function Cr(e,t){for(var n=0,r=(t=bi(t,e)).length;null!=e&&nt}function Ar(e,t){return null!=e&&Me.call(e,t)}function Nr(e,t){return null!=e&&t in Oe(e)}function Pr(e,t,n){for(var o=n?Lt:Pt,s=e[0].length,a=e.length,c=a,u=r(a),l=1/0,p=[];c--;){var f=e[c];c&&t&&(f=Rt(f,Qt(t))),l=bn(f.length,l),u[c]=!n&&(t||s>=120&&f.length>=120)?new Kn(c&&f):i}f=e[0];var d=-1,h=u[0];e:for(;++d=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Wr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)a!==e&&Ke.call(a,c,1),Ke.call(e,c,1);return e}function Xr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;bo(i)?Ke.call(e,i,1):di(e,i)}}return e}function Kr(e,t){return e+vt(In()*(t-e+1))}function Qr(e,t){var n="";if(!e||t<1||t>h)return n;do{t%2&&(n+=e),(t=vt(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return Do(Ao(e,t,sc),e+"")}function Zr(e){return Zn(Ha(e))}function ei(e,t){var n=Ha(e);return Fo(n,ur(t,0,n.length))}function ti(e,t,n,r){if(!ra(e))return e;for(var o=-1,s=(t=bi(t,e)).length,a=s-1,c=e;null!=c&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i>>1,s=e[o];null!==s&&!pa(s)&&(n?s<=t:s=200){var u=t?null:Qi(e);if(u)return pn(u);s=!1,i=Zt,c=new Kn}else c=t?[]:a;e:for(;++r=r?e:oi(e,t,n)}var Ii=pt||function(e){return dt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var n=e.length,r=ze?ze(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function Oi(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ti(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,s=pa(e),a=t!==i,c=null===t,u=t==t,l=pa(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!l&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&wo(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Oe(t);++r-1?o[s?t[a]:a]:i}}function Ui(e){return io((function(t){var n=t.length,r=n,s=Gn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Ne(o);if(s&&!c&&"wrapper"==co(a))var c=new Gn([],!0)}for(r=c?r:n;++r1&&_.reverse(),d&&lc))return!1;var l=s.get(e),p=s.get(t);if(l&&p)return l==t&&p==e;var f=-1,d=!0,h=2&n?new Kn:i;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ot(v,(function(n){var r="_."+n[0];t&n[1]&&!Pt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Vo(e){var t=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Fo(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,cs(e,n)}));function ms(e){var t=$n(e);return t.__chain__=!0,t}function gs(e,t){return t(e)}var vs=io((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return cr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:gs,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)}));var ys=Ri((function(e,t,n){Me.call(e,n)?++e[n]:ar(e,n,1)}));var _s=Bi(zo),Es=Bi(Wo);function bs(e,t){return(Ws(e)?Ot:hr)(e,lo(t,3))}function ws(e,t){return(Ws(e)?Tt:mr)(e,lo(t,3))}var Ss=Ri((function(e,t,n){Me.call(e,n)?e[n].push(t):ar(e,n,[t])}));var Is=Jr((function(e,t,n){var i=-1,o="function"==typeof t,s=Xs(e)?r(e.length):[];return hr(e,(function(e){s[++i]=o?Ct(t,e,n):Lr(e,t,n)})),s})),Cs=Ri((function(e,t,n){ar(e,n,t)}));function xs(e,t){return(Ws(e)?Rt:Ur)(e,lo(t,3))}var Os=Ri((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Ts=Jr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&wo(e,t[0],t[1])?t=[]:n>2&&wo(t[0],t[1],t[2])&&(t=[t[0]]),zr(e,_r(t,1),[])})),As=ft||function(){return dt.Date.now()};function Ns(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Zi(e,p,i,i,i,i,t)}function Ps(e,t){var n;if("function"!=typeof t)throw new Ne(o);return e=va(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ls=Jr((function(e,t,n){var r=1;if(n.length){var i=ln(n,uo(Ls));r|=u}return Zi(e,r,t,n,i)})),Rs=Jr((function(e,t,n){var r=3;if(n.length){var i=ln(n,uo(Rs));r|=u}return Zi(t,r,e,n,i)}));function ks(e,t,n){var r,s,a,c,u,l,p=0,f=!1,d=!1,h=!0;if("function"!=typeof e)throw new Ne(o);function m(t){var n=r,o=s;return r=s=i,p=t,c=e.apply(o,n)}function g(e){return p=e,u=ko(y,t),f?m(e):c}function v(e){var n=e-l;return l===i||n>=t||n<0||d&&e-p>=a}function y(){var e=As();if(v(e))return _(e);u=ko(y,function(e){var n=t-(e-l);return d?bn(n,a-(e-p)):n}(e))}function _(e){return u=i,h&&r?m(e):(r=s=i,c)}function E(){var e=As(),n=v(e);if(r=arguments,s=this,l=e,n){if(u===i)return g(l);if(d)return Ii(u),u=ko(y,t),m(l)}return u===i&&(u=ko(y,t)),c}return t=_a(t)||0,ra(n)&&(f=!!n.leading,a=(d="maxWait"in n)?En(_a(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),E.cancel=function(){u!==i&&Ii(u),p=0,r=l=s=u=i},E.flush=function(){return u===i?c:_(As())},E}var Ds=Jr((function(e,t){return fr(e,1,t)})),Ms=Jr((function(e,t,n){return fr(e,_a(t)||0,n)}));function Vs(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ne(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Vs.Cache||Xn),n}function Fs(e){if("function"!=typeof e)throw new Ne(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Vs.Cache=Xn;var js=wi((function(e,t){var n=(t=1==t.length&&Ws(t[0])?Rt(t[0],Qt(lo())):Rt(_r(t,1),Qt(lo()))).length;return Jr((function(r){for(var i=-1,o=bn(r.length,n);++i=t})),zs=Rr(function(){return arguments}())?Rr:function(e){return ia(e)&&Me.call(e,"callee")&&!Xe.call(e,"callee")},Ws=r.isArray,Ys=_t?Qt(_t):function(e){return ia(e)&&Or(e)==k};function Xs(e){return null!=e&&na(e.length)&&!ea(e)}function Ks(e){return ia(e)&&Xs(e)}var Qs=Ft||_c,Js=Et?Qt(Et):function(e){return ia(e)&&Or(e)==b};function Zs(e){if(!ia(e))return!1;var t=Or(e);return t==w||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!aa(e)}function ea(e){if(!ra(e))return!1;var t=Or(e);return t==S||t==I||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ta(e){return"number"==typeof e&&e==va(e)}function na(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function ra(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ia(e){return null!=e&&"object"==typeof e}var oa=bt?Qt(bt):function(e){return ia(e)&&vo(e)==C};function sa(e){return"number"==typeof e||ia(e)&&Or(e)==x}function aa(e){if(!ia(e)||Or(e)!=O)return!1;var t=We(e);if(null===t)return!0;var n=Me.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==Be}var ca=wt?Qt(wt):function(e){return ia(e)&&Or(e)==A};var ua=St?Qt(St):function(e){return ia(e)&&vo(e)==N};function la(e){return"string"==typeof e||!Ws(e)&&ia(e)&&Or(e)==P}function pa(e){return"symbol"==typeof e||ia(e)&&Or(e)==L}var fa=It?Qt(It):function(e){return ia(e)&&na(e.length)&&!!st[Or(e)]};var da=Yi(Br),ha=Yi((function(e,t){return e<=t}));function ma(e){if(!e)return[];if(Xs(e))return la(e)?hn(e):Pi(e);if(et&&e[et])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[et]());var t=vo(e);return(t==C?cn:t==N?pn:Ha)(e)}function ga(e){return e?(e=_a(e))===d||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function va(e){var t=ga(e),n=t%1;return t==t?n?t-n:t:0}function ya(e){return e?ur(va(e),0,g):0}function _a(e){if("number"==typeof e)return e;if(pa(e))return m;if(ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=ve.test(e);return n||_e.test(e)?lt(e.slice(2),n?2:8):ge.test(e)?m:+e}function Ea(e){return Li(e,Da(e))}function ba(e){return null==e?"":pi(e)}var wa=ki((function(e,t){if(xo(t)||Xs(t))Li(t,ka(t),e);else for(var n in t)Me.call(t,n)&&rr(e,n,t[n])})),Sa=ki((function(e,t){Li(t,Da(t),e)})),Ia=ki((function(e,t,n,r){Li(t,Da(t),e,r)})),Ca=ki((function(e,t,n,r){Li(t,ka(t),e,r)})),xa=io(cr);var Oa=Jr((function(e,t){e=Oe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&wo(t[0],t[1],o)&&(r=1);++n1),t})),Li(e,so(e),n),r&&(n=lr(n,7,no));for(var i=t.length;i--;)di(n,t[i]);return n}));var ja=io((function(e,t){return null==e?{}:function(e,t){return Wr(e,t,(function(t,n){return Na(e,n)}))}(e,t)}));function Ba(e,t){if(null==e)return{};var n=Rt(so(e),(function(e){return[e]}));return t=lo(t),Wr(e,n,(function(e,n){return t(e,n[0])}))}var Ua=Ji(ka),$a=Ji(Da);function Ha(e){return null==e?[]:Jt(e,ka(e))}var qa=Fi((function(e,t,n){return t=t.toLowerCase(),e+(n?Ga(t):t)}));function Ga(e){return Za(ba(e).toLowerCase())}function za(e){return(e=ba(e))&&e.replace(be,rn).replace(Ze,"")}var Wa=Fi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ya=Fi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Xa=Vi("toLowerCase");var Ka=Fi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Qa=Fi((function(e,t,n){return e+(n?" ":"")+Za(t)}));var Ja=Fi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Za=Vi("toUpperCase");function ec(e,t,n){return e=ba(e),(t=n?i:t)===i?function(e){return rt.test(e)}(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.match(pe)||[]}(e):e.match(t)||[]}var tc=Jr((function(e,t){try{return Ct(e,i,t)}catch(e){return Zs(e)?e:new Ie(e)}})),nc=io((function(e,t){return Ot(t,(function(t){t=Bo(t),ar(e,t,Ls(e[t],e))})),e}));function rc(e){return function(){return e}}var ic=Ui(),oc=Ui(!0);function sc(e){return e}function ac(e){return Vr("function"==typeof e?e:lr(e,1))}var cc=Jr((function(e,t){return function(n){return Lr(n,e,t)}})),uc=Jr((function(e,t){return function(n){return Lr(e,n,t)}}));function lc(e,t,n){var r=ka(t),i=Ir(t,r);null!=n||ra(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Ir(t,ka(t)));var o=!(ra(n)&&"chain"in n&&!n.chain),s=ea(e);return Ot(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Pi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function pc(){}var fc=Gi(Rt),dc=Gi(At),hc=Gi(Vt);function mc(e){return So(e)?Gt(Bo(e)):function(e){return function(t){return Cr(t,e)}}(e)}var gc=Wi(),vc=Wi(!0);function yc(){return[]}function _c(){return!1}var Ec=qi((function(e,t){return e+t}),0),bc=Ki("ceil"),wc=qi((function(e,t){return e/t}),1),Sc=Ki("floor");var Ic,Cc=qi((function(e,t){return e*t}),1),xc=Ki("round"),Oc=qi((function(e,t){return e-t}),0);return $n.after=function(e,t){if("function"!=typeof t)throw new Ne(o);return e=va(e),function(){if(--e<1)return t.apply(this,arguments)}},$n.ary=Ns,$n.assign=wa,$n.assignIn=Sa,$n.assignInWith=Ia,$n.assignWith=Ca,$n.at=xa,$n.before=Ps,$n.bind=Ls,$n.bindAll=nc,$n.bindKey=Rs,$n.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ws(e)?e:[e]},$n.chain=ms,$n.chunk=function(e,t,n){t=(n?wo(e,t,n):t===i)?1:En(va(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,c=r(mt(o/t));so?0:o+n),(r=r===i||r>o?o:va(r))<0&&(r+=o),r=n>r?0:ya(r);n>>0)?(e=ba(e))&&("string"==typeof t||null!=t&&!ca(t))&&!(t=pi(t))&&an(e)?Si(hn(e),0,n):e.split(t,n):[]},$n.spread=function(e,t){if("function"!=typeof e)throw new Ne(o);return t=null==t?0:En(va(t),0),Jr((function(n){var r=n[t],i=Si(n,0,t);return r&&kt(i,r),Ct(e,this,i)}))},$n.tail=function(e){var t=null==e?0:e.length;return t?oi(e,1,t):[]},$n.take=function(e,t,n){return e&&e.length?oi(e,0,(t=n||t===i?1:va(t))<0?0:t):[]},$n.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oi(e,(t=r-(t=n||t===i?1:va(t)))<0?0:t,r):[]},$n.takeRightWhile=function(e,t){return e&&e.length?mi(e,lo(t,3),!1,!0):[]},$n.takeWhile=function(e,t){return e&&e.length?mi(e,lo(t,3)):[]},$n.tap=function(e,t){return t(e),e},$n.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ne(o);return ra(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ks(e,t,{leading:r,maxWait:t,trailing:i})},$n.thru=gs,$n.toArray=ma,$n.toPairs=Ua,$n.toPairsIn=$a,$n.toPath=function(e){return Ws(e)?Rt(e,Bo):pa(e)?[e]:Pi(jo(ba(e)))},$n.toPlainObject=Ea,$n.transform=function(e,t,n){var r=Ws(e),i=r||Qs(e)||fa(e);if(t=lo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:ra(e)&&ea(o)?Hn(We(e)):{}}return(i?Ot:wr)(e,(function(e,r,i){return t(n,e,r,i)})),n},$n.unary=function(e){return Ns(e,1)},$n.union=is,$n.unionBy=os,$n.unionWith=ss,$n.uniq=function(e){return e&&e.length?fi(e):[]},$n.uniqBy=function(e,t){return e&&e.length?fi(e,lo(t,2)):[]},$n.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?fi(e,i,t):[]},$n.unset=function(e,t){return null==e||di(e,t)},$n.unzip=as,$n.unzipWith=cs,$n.update=function(e,t,n){return null==e?e:hi(e,t,Ei(n))},$n.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:hi(e,t,Ei(n),r)},$n.values=Ha,$n.valuesIn=function(e){return null==e?[]:Jt(e,Da(e))},$n.without=us,$n.words=ec,$n.wrap=function(e,t){return Bs(Ei(t),e)},$n.xor=ls,$n.xorBy=ps,$n.xorWith=fs,$n.zip=ds,$n.zipObject=function(e,t){return yi(e||[],t||[],rr)},$n.zipObjectDeep=function(e,t){return yi(e||[],t||[],ti)},$n.zipWith=hs,$n.entries=Ua,$n.entriesIn=$a,$n.extend=Sa,$n.extendWith=Ia,lc($n,$n),$n.add=Ec,$n.attempt=tc,$n.camelCase=qa,$n.capitalize=Ga,$n.ceil=bc,$n.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=_a(n))==n?n:0),t!==i&&(t=(t=_a(t))==t?t:0),ur(_a(e),t,n)},$n.clone=function(e){return lr(e,4)},$n.cloneDeep=function(e){return lr(e,5)},$n.cloneDeepWith=function(e,t){return lr(e,5,t="function"==typeof t?t:i)},$n.cloneWith=function(e,t){return lr(e,4,t="function"==typeof t?t:i)},$n.conformsTo=function(e,t){return null==t||pr(e,t,ka(t))},$n.deburr=za,$n.defaultTo=function(e,t){return null==e||e!=e?t:e},$n.divide=wc,$n.endsWith=function(e,t,n){e=ba(e),t=pi(t);var r=e.length,o=n=n===i?r:ur(va(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},$n.eq=Hs,$n.escape=function(e){return(e=ba(e))&&Q.test(e)?e.replace(X,on):e},$n.escapeRegExp=function(e){return(e=ba(e))&&oe.test(e)?e.replace(ie,"\\$&"):e},$n.every=function(e,t,n){var r=Ws(e)?At:gr;return n&&wo(e,t,n)&&(t=i),r(e,lo(t,3))},$n.find=_s,$n.findIndex=zo,$n.findKey=function(e,t){return jt(e,lo(t,3),wr)},$n.findLast=Es,$n.findLastIndex=Wo,$n.findLastKey=function(e,t){return jt(e,lo(t,3),Sr)},$n.floor=Sc,$n.forEach=bs,$n.forEachRight=ws,$n.forIn=function(e,t){return null==e?e:Er(e,lo(t,3),Da)},$n.forInRight=function(e,t){return null==e?e:br(e,lo(t,3),Da)},$n.forOwn=function(e,t){return e&&wr(e,lo(t,3))},$n.forOwnRight=function(e,t){return e&&Sr(e,lo(t,3))},$n.get=Aa,$n.gt=qs,$n.gte=Gs,$n.has=function(e,t){return null!=e&&yo(e,t,Ar)},$n.hasIn=Na,$n.head=Xo,$n.identity=sc,$n.includes=function(e,t,n,r){e=Xs(e)?e:Ha(e),n=n&&!r?va(n):0;var i=e.length;return n<0&&(n=En(i+n,0)),la(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ut(e,t,n)>-1},$n.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:va(n);return i<0&&(i=En(r+i,0)),Ut(e,t,i)},$n.inRange=function(e,t,n){return t=ga(t),n===i?(n=t,t=0):n=ga(n),function(e,t,n){return e>=bn(t,n)&&e=-9007199254740991&&e<=h},$n.isSet=ua,$n.isString=la,$n.isSymbol=pa,$n.isTypedArray=fa,$n.isUndefined=function(e){return e===i},$n.isWeakMap=function(e){return ia(e)&&vo(e)==R},$n.isWeakSet=function(e){return ia(e)&&"[object WeakSet]"==Or(e)},$n.join=function(e,t){return null==e?"":yn.call(e,t)},$n.kebabCase=Wa,$n.last=Zo,$n.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=va(n))<0?En(r+o,0):bn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Bt(e,Ht,o,!0)},$n.lowerCase=Ya,$n.lowerFirst=Xa,$n.lt=da,$n.lte=ha,$n.max=function(e){return e&&e.length?vr(e,sc,Tr):i},$n.maxBy=function(e,t){return e&&e.length?vr(e,lo(t,2),Tr):i},$n.mean=function(e){return qt(e,sc)},$n.meanBy=function(e,t){return qt(e,lo(t,2))},$n.min=function(e){return e&&e.length?vr(e,sc,Br):i},$n.minBy=function(e,t){return e&&e.length?vr(e,lo(t,2),Br):i},$n.stubArray=yc,$n.stubFalse=_c,$n.stubObject=function(){return{}},$n.stubString=function(){return""},$n.stubTrue=function(){return!0},$n.multiply=Cc,$n.nth=function(e,t){return e&&e.length?Gr(e,va(t)):i},$n.noConflict=function(){return dt._===this&&(dt._=Ue),this},$n.noop=pc,$n.now=As,$n.pad=function(e,t,n){e=ba(e);var r=(t=va(t))?dn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return zi(vt(i),n)+e+zi(mt(i),n)},$n.padEnd=function(e,t,n){e=ba(e);var r=(t=va(t))?dn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=In();return bn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Kr(e,t)},$n.reduce=function(e,t,n){var r=Ws(e)?Dt:Wt,i=arguments.length<3;return r(e,lo(t,4),n,i,hr)},$n.reduceRight=function(e,t,n){var r=Ws(e)?Mt:Wt,i=arguments.length<3;return r(e,lo(t,4),n,i,mr)},$n.repeat=function(e,t,n){return t=(n?wo(e,t,n):t===i)?1:va(t),Qr(ba(e),t)},$n.replace=function(){var e=arguments,t=ba(e[0]);return e.length<3?t:t.replace(e[1],e[2])},$n.result=function(e,t,n){var r=-1,o=(t=bi(t,e)).length;for(o||(o=1,e=i);++rh)return[];var n=g,r=bn(e,g);t=lo(t),e-=g;for(var i=Xt(r,t);++n=s)return e;var c=n-dn(r);if(c<1)return r;var u=a?Si(a,0,c).join(""):e.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),ca(o)){if(e.slice(c).search(o)){var l,p=u;for(o.global||(o=Te(o.source,ba(me.exec(o))+"g")),o.lastIndex=0;l=o.exec(p);)var f=l.index;u=u.slice(0,f===i?c:f)}}else if(e.indexOf(pi(o),c)!=c){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+r},$n.unescape=function(e){return(e=ba(e))&&K.test(e)?e.replace(Y,gn):e},$n.uniqueId=function(e){var t=++Ve;return ba(e)+t},$n.upperCase=Ja,$n.upperFirst=Za,$n.each=bs,$n.eachRight=ws,$n.first=Xo,lc($n,(Ic={},wr($n,(function(e,t){Me.call($n.prototype,t)||(Ic[t]=e)})),Ic),{chain:!1}),$n.VERSION="4.17.21",Ot(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){$n[e].placeholder=$n})),Ot(["drop","take"],(function(e,t){zn.prototype[e]=function(n){n=n===i?1:En(va(n),0);var r=this.__filtered__&&!t?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,g),type:e+(r.__dir__<0?"Right":"")}),r},zn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ot(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;zn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:lo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ot(["head","last"],(function(e,t){var n="take"+(t?"Right":"");zn.prototype[e]=function(){return this[n](1).value()[0]}})),Ot(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");zn.prototype[e]=function(){return this.__filtered__?new zn(this):this[n](1)}})),zn.prototype.compact=function(){return this.filter(sc)},zn.prototype.find=function(e){return this.filter(e).head()},zn.prototype.findLast=function(e){return this.reverse().find(e)},zn.prototype.invokeMap=Jr((function(e,t){return"function"==typeof e?new zn(this):this.map((function(n){return Lr(n,e,t)}))})),zn.prototype.reject=function(e){return this.filter(Fs(lo(e)))},zn.prototype.slice=function(e,t){e=va(e);var n=this;return n.__filtered__&&(e>0||t<0)?new zn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=va(t))<0?n.dropRight(-t):n.take(t-e)),n)},zn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},zn.prototype.toArray=function(){return this.take(g)},wr(zn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=$n[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&($n.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,c=t instanceof zn,u=a[0],l=c||Ws(t),p=function(e){var t=o.apply($n,kt([e],a));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,d=!!this.__actions__.length,h=s&&!f,m=c&&!d;if(!s&&l){t=m?t:new zn(this);var g=e.apply(t,a);return g.__actions__.push({func:gs,args:[p],thisArg:i}),new Gn(g,f)}return h&&m?e.apply(this,a):(g=this.thru(p),h?r?g.value()[0]:g.value():g)})})),Ot(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);$n.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ws(i)?i:[],e)}return this[n]((function(n){return t.apply(Ws(n)?n:[],e)}))}})),wr(zn.prototype,(function(e,t){var n=$n[t];if(n){var r=n.name+"";Me.call(Rn,r)||(Rn[r]=[]),Rn[r].push({name:t,func:n})}})),Rn[$i(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var e=new zn(this.__wrapped__);return e.__actions__=Pi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Pi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Pi(this.__views__),e},zn.prototype.reverse=function(){if(this.__filtered__){var e=new zn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},zn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ws(e),r=t<0,i=n?e.length:0,o=function(e,t,n){var r=-1,i=n.length;for(;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},$n.prototype.plant=function(e){for(var t,n=this;n instanceof qn;){var r=$o(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},$n.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof zn){var t=e;return this.__actions__.length&&(t=new zn(this)),(t=t.reverse()).__actions__.push({func:gs,args:[rs],thisArg:i}),new Gn(t,this.__chain__)}return this.thru(rs)},$n.prototype.toJSON=$n.prototype.valueOf=$n.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},$n.prototype.first=$n.prototype.head,et&&($n.prototype[et]=function(){return this}),$n}();dt._=vn,(r=function(){return vn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},9593:(e,t,n)=>{"use strict";const r=n(4411),i=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),p=Symbol("lruList"),f=Symbol("cache"),d=Symbol("updateAgeOnGet"),h=()=>1;const m=(e,t,n)=>{const r=e[f].get(t);if(r){const t=r.value;if(g(e,t)){if(y(e,r),!e[a])return}else n&&(e[d]&&(r.value.now=Date.now()),e[p].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[c]&&n>e[c]},v=e=>{if(e[o]>e[i])for(let t=e[p].tail;e[o]>e[i]&&null!==t;){const n=t.prev;y(e,t),t=n}},y=(e,t)=>{if(t){const n=t.value;e[u]&&e[u](n.key,n.value),e[o]-=n.length,e[f].delete(n.key),e[p].removeNode(t)}};class _{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const E=(e,t,n,r)=>{let i=n.value;g(e,i)&&(y(e,n),e[a]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||h;if(this[s]="function"!=typeof t?h:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[d]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,v(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,v(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=h),e!==this[s]&&(this[s]=e,this[o]=0,this[p].forEach((e=>{e.length=this[s](e.value,e.key),this[o]+=e.length}))),v(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[p].length}rforEach(e,t){t=t||this;for(let n=this[p].tail;null!==n;){const r=n.prev;E(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[p].head;null!==n;){const r=n.next;E(this,e,n,t),n=r}}keys(){return this[p].toArray().map((e=>e.key))}values(){return this[p].toArray().map((e=>e.value))}reset(){this[u]&&this[p]&&this[p].length&&this[p].forEach((e=>this[u](e.key,e.value))),this[f]=new Map,this[p]=new r,this[o]=0}dump(){return this[p].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[p]}set(e,t,n){if((n=n||this[c])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,a=this[s](t,e);if(this[f].has(e)){if(a>this[i])return y(this,this[f].get(e)),!1;const s=this[f].get(e).value;return this[u]&&(this[l]||this[u](e,s.value)),s.now=r,s.maxAge=n,s.value=t,this[o]+=a-s.length,s.length=a,this.get(e),v(this),!0}const d=new _(e,t,a,r,n);return d.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=d.length,this[p].unshift(d),this[f].set(e,this[p].head),v(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[p].tail;return e?(y(this,e),e.value):null}del(e){y(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[f].forEach(((e,t)=>m(this,t,!1)))}}},1171:(e,t,n)=>{e.exports=f,f.Minimatch=d;var r={sep:"/"};try{r=n(5622)}catch(e){}var i=f.GLOBSTAR=d.GLOBSTAR={},o=n(3644),s={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},a="[^/]",c="[^/]*?",u="().*{}+?[]^$\\!".split("").reduce((function(e,t){return e[t]=!0,e}),{});var l=/\/+/;function p(e,t){e=e||{},t=t||{};var n={};return Object.keys(t).forEach((function(e){n[e]=t[e]})),Object.keys(e).forEach((function(t){n[t]=e[t]})),n}function f(e,t,n){if("string"!=typeof t)throw new TypeError("glob pattern string required");return n||(n={}),!(!n.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new d(t,n).match(e))}function d(e,t){if(!(this instanceof d))return new d(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==r.sep&&(e=e.split(r.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function h(e,t){if(t||(t=this instanceof d?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:o(e)}f.filter=function(e,t){return t=t||{},function(n,r,i){return f(n,e,t)}},f.defaults=function(e){if(!e||!Object.keys(e).length)return f;var t=f,n=function(n,r,i){return t.minimatch(n,r,p(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,p(e,r))},n},d.defaults=function(e){return e&&Object.keys(e).length?f.defaults(e).Minimatch:d},d.prototype.debug=function(){},d.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,n),n=this.globParts=n.map((function(e){return e.split(l)})),this.debug(this.pattern,n),n=n.map((function(e,t,n){return e.map(this.parse,this)}),this),this.debug(this.pattern,n),n=n.filter((function(e){return-1===e.indexOf(!1)})),this.debug(this.pattern,n),this.set=n},d.prototype.parseNegate=function(){var e=this.pattern,t=!1,n=this.options,r=0;if(n.nonegate)return;for(var i=0,o=e.length;i65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return i;if(""===e)return"";var r,o="",l=!!n.nocase,p=!1,f=[],d=[],h=!1,g=-1,v=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",_=this;function E(){if(r){switch(r){case"*":o+=c,l=!0;break;case"?":o+=a,l=!0;break;default:o+="\\"+r}_.debug("clearStateChar %j %j",r,o),r=!1}}for(var b,w=0,S=e.length;w-1;N--){var P=d[N],L=o.slice(0,P.reStart),R=o.slice(P.reStart,P.reEnd-8),k=o.slice(P.reEnd-8,P.reEnd),D=o.slice(P.reEnd);k+=D;var M=L.split("(").length-1,V=D;for(w=0;w=0&&!(i=e[o]);o--);for(o=0;o>> no match, partial?",e,f,t,d),f!==a))}if("string"==typeof l?(u=r.nocase?p.toLowerCase()===l.toLowerCase():p===l,this.debug("string match",l,p,u)):(u=p.match(l),this.debug("pattern match",l,p,u)),!u)return!1}if(o===a&&s===c)return!0;if(o===a)return n;if(s===c)return o===a-1&&""===e[o];throw new Error("wtf?")}},7824:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i,s=365.25*i;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=r)return a(e,o,r,"hour");if(o>=n)return a(e,o,n,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=r)return Math.round(e/r)+"h";if(o>=n)return Math.round(e/n)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},778:(e,t,n)=>{var r=n(2479);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}e.exports=r(i),e.exports.strict=r(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},4095:e=>{"use strict";function t(e){return"/"===e.charAt(0)}function n(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(e),n=t[1]||"",r=Boolean(n&&":"!==n.charAt(1));return Boolean(t[2]||r)}e.exports="win32"===process.platform?n:t,e.exports.posix=t,e.exports.win32=n},9916:e=>{function t(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}function n(e){e.pending+=1;var t=!1;return function(i){if(t)throw new Error("callback called twice");if(t=!0,e.error=e.error||i,e.pending-=1,e.waiting.length>0&&e.pending{var r=n(778),i=n(2840),o=n(5747),s=function(){},a=/^v?\.0/.test(process.version),c=function(e){return"function"==typeof e},u=function(e,t,n,u){u=r(u);var l=!1;e.on("close",(function(){l=!0})),i(e,{readable:t,writable:n},(function(e){if(e)return u(e);l=!0,u()}));var p=!1;return function(t){if(!l&&!p)return p=!0,function(e){return!!a&&!!o&&(e instanceof(o.ReadStream||s)||e instanceof(o.WriteStream||s))&&c(e.close)}(e)?e.close(s):function(e){return e.setHeader&&c(e.abort)}(e)?e.abort():c(e.destroy)?e.destroy():void u(t||new Error("stream was destroyed"))}},l=function(e){e()},p=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),n=c(t[t.length-1]||s)&&t.pop()||s;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r=t.map((function(i,o){var s=o0,(function(t){e||(e=t),t&&r.forEach(l),s||(r.forEach(l),n(e))}))}));return t.reduce(p)}},984:(e,t,n)=>{const r=n(2357),i=n(5622),o=n(5747);let s;try{s=n(2884)}catch(e){}const a={nosort:!0,silent:!0};let c=0;const u="win32"===process.platform,l=e=>{if(["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||o[t],e[t+="Sync"]=e[t]||o[t]})),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,!1===e.glob&&(e.disableGlob=!0),!0!==e.disableGlob&&void 0===s)throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");e.disableGlob=e.disableGlob||!1,e.glob=e.glob||a},p=(e,t,n)=>{"function"==typeof t&&(n=t,t={}),r(e,"rimraf: missing path"),r.equal(typeof e,"string","rimraf: path should be a string"),r.equal(typeof n,"function","rimraf: callback function required"),r(t,"rimraf: invalid options argument provided"),r.equal(typeof t,"object","rimraf: options should be object"),l(t);let i=0,o=null,a=0;const u=(e,r)=>e?n(e):(a=r.length,0===a?n():void r.forEach((e=>{const r=s=>{if(s){if(("EBUSY"===s.code||"ENOTEMPTY"===s.code||"EPERM"===s.code)&&if(e,t,r)),100*i);if("EMFILE"===s.code&&cf(e,t,r)),c++);"ENOENT"===s.code&&(s=null)}c=0,(e=>{o=o||e,0==--a&&n(o)})(s)};f(e,t,r)})));if(t.disableGlob||!s.hasMagic(e))return u(null,[e]);t.lstat(e,((n,r)=>{if(!n)return u(null,[e]);s(e,t.glob,u)}))},f=(e,t,n)=>{r(e),r(t),r("function"==typeof n),t.lstat(e,((r,i)=>r&&"ENOENT"===r.code?n(null):(r&&"EPERM"===r.code&&u&&d(e,t,r,n),i&&i.isDirectory()?m(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return u?d(e,t,r,n):m(e,t,r,n);if("EISDIR"===r.code)return m(e,t,r,n)}return n(r)})))))},d=(e,t,n,i)=>{r(e),r(t),r("function"==typeof i),t.chmod(e,438,(r=>{r?i("ENOENT"===r.code?null:n):t.stat(e,((r,o)=>{r?i("ENOENT"===r.code?null:n):o.isDirectory()?m(e,t,n,i):t.unlink(e,i)}))}))},h=(e,t,n)=>{r(e),r(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}let i;try{i=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}i.isDirectory()?y(e,t,n):t.unlinkSync(e)},m=(e,t,n,i)=>{r(e),r(t),r("function"==typeof i),t.rmdir(e,(r=>{!r||"ENOTEMPTY"!==r.code&&"EEXIST"!==r.code&&"EPERM"!==r.code?r&&"ENOTDIR"===r.code?i(n):i(r):g(e,t,i)}))},g=(e,t,n)=>{r(e),r(t),r("function"==typeof n),t.readdir(e,((r,o)=>{if(r)return n(r);let s,a=o.length;if(0===a)return t.rmdir(e,n);o.forEach((r=>{p(i.join(e,r),t,(r=>{if(!s)return r?n(s=r):void(0==--a&&t.rmdir(e,n))}))}))}))},v=(e,t)=>{let n;if(l(t=t||{}),r(e,"rimraf: missing path"),r.equal(typeof e,"string","rimraf: path should be a string"),r(t,"rimraf: missing options"),r.equal(typeof t,"object","rimraf: options should be object"),t.disableGlob||!s.hasMagic(e))n=[e];else try{t.lstatSync(e),n=[e]}catch(r){n=s.sync(e,t.glob)}if(n.length)for(let e=0;e{r(e),r(t);try{t.rmdirSync(e)}catch(r){if("ENOENT"===r.code)return;if("ENOTDIR"===r.code)throw n;"ENOTEMPTY"!==r.code&&"EEXIST"!==r.code&&"EPERM"!==r.code||_(e,t)}},_=(e,t)=>{r(e),r(t),t.readdirSync(e).forEach((n=>v(i.join(e,n),t)));const n=u?100:1;let o=0;for(;;){let r=!0;try{const i=t.rmdirSync(e,t);return r=!1,i}finally{if(++o{const r=Symbol("SemVer ANY");class i{static get ANY(){return r}constructor(e,t){if(t=o(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?s[a.COMPARATORLOOSE]:s[a.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new l(n[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new p(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new p(this.value,t).test(e.semver);const n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),r=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),o=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=c(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),u=c(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||r||o&&s||a||u}}e.exports=i;const o=n(2893),{re:s,t:a}=n(5765),c=n(7539),u=n(4225),l=n(6376),p=n(6902)},6902:(e,t,n)=>{class r{constructor(e,t){if(t=o(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!h(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=i.get(t);if(n)return n;const r=this.options.loose,o=r?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];e=e.replace(o,O(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(u[l.COMPARATORTRIM],p),a("comparator trim",e,u[l.COMPARATORTRIM]),e=(e=(e=e.replace(u[l.TILDETRIM],f)).replace(u[l.CARETTRIM],d)).split(/\s+/).join(" ");const c=r?u[l.COMPARATORLOOSE]:u[l.COMPARATOR],m=e.split(" ").map((e=>v(e,this.options))).join(" ").split(/\s+/).map((e=>x(e,this.options))).filter(this.options.loose?e=>!!e.match(c):()=>!0).map((e=>new s(e,this.options))),g=(m.length,new Map);for(const e of m){if(h(e))return[e];g.set(e.value,e)}g.size>1&&g.has("")&&g.delete("");const y=[...g.values()];return i.set(t,y),y}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some((n=>g(n,t)&&e.set.some((e=>g(e,t)&&n.every((n=>e.every((e=>n.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},v=(e,t)=>(a("comp",e,t),e=b(e,t),a("caret",e),e=_(e,t),a("tildes",e),e=S(e,t),a("xrange",e),e=C(e,t),a("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{const n=t.loose?u[l.TILDELOOSE]:u[l.TILDE];return e.replace(n,((t,n,r,i,o)=>{let s;return a("tilde",e,t,n,r,i,o),y(n)?s="":y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:o?(a("replaceTilde pr",o),s=`>=${n}.${r}.${i}-${o} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,a("tilde return",s),s}))},b=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{a("caret",e,t);const n=t.loose?u[l.CARETLOOSE]:u[l.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,i,o,s)=>{let c;return a("caret",e,t,n,i,o,s),y(n)?c="":y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(o)?c="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(a("replaceCaret pr",s),c="0"===n?"0"===i?`>=${n}.${i}.${o}-${s} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o}-${s} <${+n+1}.0.0-0`):(a("no pr"),c="0"===n?"0"===i?`>=${n}.${i}.${o}${r} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o} <${+n+1}.0.0-0`),a("caret return",c),c}))},S=(e,t)=>(a("replaceXRanges",e,t),e.split(/\s+/).map((e=>I(e,t))).join(" ")),I=(e,t)=>{e=e.trim();const n=t.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return e.replace(n,((n,r,i,o,s,c)=>{a("xRange",e,n,r,i,o,s,c);const u=y(i),l=u||y(o),p=l||y(s),f=p;return"="===r&&f&&(r=""),c=t.includePrerelease?"-0":"",u?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(l&&(o=0),s=0,">"===r?(r=">=",l?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",l?i=+i+1:o=+o+1),"<"===r&&(c="-0"),n=`${r+i}.${o}.${s}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),a("xRange return",n),n}))},C=(e,t)=>(a("replaceStars",e,t),e.trim().replace(u[l.STAR],"")),x=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),O=e=>(t,n,r,i,o,s,a,c,u,l,p,f,d)=>`${n=y(r)?"":y(i)?`>=${r}.0.0${e?"-0":""}`:y(o)?`>=${r}.${i}.0${e?"-0":""}`:s?`>=${n}`:`>=${n}${e?"-0":""}`} ${c=y(u)?"":y(l)?`<${+u+1}.0.0-0`:y(p)?`<${u}.${+l+1}.0-0`:f?`<=${u}.${l}.${p}-${f}`:e?`<${u}.${l}.${+p+1}-0`:`<=${c}`}`.trim(),T=(e,t,n)=>{for(let n=0;n0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}},6376:(e,t,n)=>{const r=n(4225),{MAX_LENGTH:i,MAX_SAFE_INTEGER:o}=n(3295),{re:s,t:a}=n(5765),c=n(2893),{compareIdentifiers:u}=n(6742);class l{constructor(e,t){if(t=c(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?s[a.LOOSE]:s[a.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}e.exports=l},3507:(e,t,n)=>{const r=n(3959);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},7539:(e,t,n)=>{const r=n(8718),i=n(1194),o=n(1312),s=n(5903),a=n(1544),c=n(2056);e.exports=(e,t,n,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return r(e,n,u);case"!=":return i(e,n,u);case">":return o(e,n,u);case">=":return s(e,n,u);case"<":return a(e,n,u);case"<=":return c(e,n,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},9038:(e,t,n)=>{const r=n(6376),i=n(3959),{re:o,t:s}=n(5765);e.exports=(e,t)=>{if(e instanceof r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){let t;for(;(t=o[s.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&t.index+t[0].length===n.index+n[0].length||(n=t),o[s.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;o[s.COERCERTL].lastIndex=-1}else n=e.match(o[s.COERCE]);return null===n?null:i(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)}},8880:(e,t,n)=>{const r=n(6376);e.exports=(e,t,n)=>{const i=new r(e,n),o=new r(t,n);return i.compare(o)||i.compareBuild(o)}},7880:(e,t,n)=>{const r=n(6269);e.exports=(e,t)=>r(e,t,!0)},6269:(e,t,n)=>{const r=n(6376);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},2378:(e,t,n)=>{const r=n(3959),i=n(8718);e.exports=(e,t)=>{if(i(e,t))return null;{const n=r(e),i=r(t),o=n.prerelease.length||i.prerelease.length,s=o?"pre":"",a=o?"prerelease":"";for(const e in n)if(("major"===e||"minor"===e||"patch"===e)&&n[e]!==i[e])return s+e;return a}}},8718:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>0===r(e,t,n)},1312:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)>0},5903:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)>=0},253:(e,t,n)=>{const r=n(6376);e.exports=(e,t,n,i)=>{"string"==typeof n&&(i=n,n=void 0);try{return new r(e,n).inc(t,i).version}catch(e){return null}}},1544:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)<0},2056:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(e,t,n)<=0},8679:(e,t,n)=>{const r=n(6376);e.exports=(e,t)=>new r(e,t).major},7789:(e,t,n)=>{const r=n(6376);e.exports=(e,t)=>new r(e,t).minor},1194:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>0!==r(e,t,n)},3959:(e,t,n)=>{const{MAX_LENGTH:r}=n(3295),{re:i,t:o}=n(5765),s=n(6376),a=n(2893);e.exports=(e,t)=>{if(t=a(t),e instanceof s)return e;if("string"!=typeof e)return null;if(e.length>r)return null;if(!(t.loose?i[o.LOOSE]:i[o.FULL]).test(e))return null;try{return new s(e,t)}catch(e){return null}}},2358:(e,t,n)=>{const r=n(6376);e.exports=(e,t)=>new r(e,t).patch},7559:(e,t,n)=>{const r=n(3959);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},9795:(e,t,n)=>{const r=n(6269);e.exports=(e,t,n)=>r(t,e,n)},3657:(e,t,n)=>{const r=n(8880);e.exports=(e,t)=>e.sort(((e,n)=>r(n,e,t)))},5712:(e,t,n)=>{const r=n(6902);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},1100:(e,t,n)=>{const r=n(8880);e.exports=(e,t)=>e.sort(((e,n)=>r(e,n,t)))},6397:(e,t,n)=>{const r=n(3959);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},1249:(e,t,n)=>{const r=n(5765);e.exports={re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n(3295).SEMVER_SPEC_VERSION,SemVer:n(6376),compareIdentifiers:n(6742).compareIdentifiers,rcompareIdentifiers:n(6742).rcompareIdentifiers,parse:n(3959),valid:n(6397),clean:n(3507),inc:n(253),diff:n(2378),major:n(8679),minor:n(7789),patch:n(2358),prerelease:n(7559),compare:n(6269),rcompare:n(9795),compareLoose:n(7880),compareBuild:n(8880),sort:n(1100),rsort:n(3657),gt:n(1312),lt:n(1544),eq:n(8718),neq:n(1194),gte:n(5903),lte:n(2056),cmp:n(7539),coerce:n(9038),Comparator:n(2257),Range:n(6902),satisfies:n(5712),toComparators:n(1042),maxSatisfying:n(5775),minSatisfying:n(1657),minVersion:n(5316),validRange:n(9042),outside:n(6826),gtr:n(7606),ltr:n(32),intersects:n(2937),simplifyRange:n(7908),subset:n(799)}},3295:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:t,MAX_SAFE_COMPONENT_LENGTH:16}},4225:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},6742:e=>{const t=/^[0-9]+$/,n=(e,n)=>{const r=t.test(e),i=t.test(n);return r&&i&&(e=+e,n=+n),e===n?0:r&&!i?-1:i&&!r?1:en(t,e)}},2893:e=>{const t=["includePrerelease","loose","rtl"];e.exports=e=>e?"object"!=typeof e?{loose:!0}:t.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{}},5765:(e,t,n)=>{const{MAX_SAFE_COMPONENT_LENGTH:r}=n(3295),i=n(4225),o=(t=e.exports={}).re=[],s=t.src=[],a=t.t={};let c=0;const u=(e,t,n)=>{const r=c++;i(r,t),a[e]=r,s[r]=t,o[r]=new RegExp(t,n?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","[0-9]+"),u("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),u("MAINVERSION",`(${s[a.NUMERICIDENTIFIER]})\\.(${s[a.NUMERICIDENTIFIER]})\\.(${s[a.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${s[a.NUMERICIDENTIFIERLOOSE]})\\.(${s[a.NUMERICIDENTIFIERLOOSE]})\\.(${s[a.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${s[a.NUMERICIDENTIFIER]}|${s[a.NONNUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${s[a.NUMERICIDENTIFIERLOOSE]}|${s[a.NONNUMERICIDENTIFIER]})`),u("PRERELEASE",`(?:-(${s[a.PRERELEASEIDENTIFIER]}(?:\\.${s[a.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${s[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[a.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER","[0-9A-Za-z-]+"),u("BUILD",`(?:\\+(${s[a.BUILDIDENTIFIER]}(?:\\.${s[a.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${s[a.MAINVERSION]}${s[a.PRERELEASE]}?${s[a.BUILD]}?`),u("FULL",`^${s[a.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${s[a.MAINVERSIONLOOSE]}${s[a.PRERELEASELOOSE]}?${s[a.BUILD]}?`),u("LOOSE",`^${s[a.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${s[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${s[a.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${s[a.XRANGEIDENTIFIER]})(?:\\.(${s[a.XRANGEIDENTIFIER]})(?:\\.(${s[a.XRANGEIDENTIFIER]})(?:${s[a.PRERELEASE]})?${s[a.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${s[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[a.XRANGEIDENTIFIERLOOSE]})(?:${s[a.PRERELEASELOOSE]})?${s[a.BUILD]}?)?)?`),u("XRANGE",`^${s[a.GTLT]}\\s*${s[a.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${s[a.GTLT]}\\s*${s[a.XRANGEPLAINLOOSE]}$`),u("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),u("COERCERTL",s[a.COERCE],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${s[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${s[a.LONETILDE]}${s[a.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${s[a.LONETILDE]}${s[a.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${s[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${s[a.LONECARET]}${s[a.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${s[a.LONECARET]}${s[a.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${s[a.GTLT]}\\s*(${s[a.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${s[a.GTLT]}\\s*(${s[a.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${s[a.GTLT]}\\s*(${s[a.LOOSEPLAIN]}|${s[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${s[a.XRANGEPLAIN]})\\s+-\\s+(${s[a.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${s[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[a.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0.0.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")},7606:(e,t,n)=>{const r=n(6826);e.exports=(e,t,n)=>r(e,t,">",n)},2937:(e,t,n)=>{const r=n(6902);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t))},32:(e,t,n)=>{const r=n(6826);e.exports=(e,t,n)=>r(e,t,"<",n)},5775:(e,t,n)=>{const r=n(6376),i=n(6902);e.exports=(e,t,n)=>{let o=null,s=null,a=null;try{a=new i(t,n)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(o&&-1!==s.compare(e)||(o=e,s=new r(o,n)))})),o}},1657:(e,t,n)=>{const r=n(6376),i=n(6902);e.exports=(e,t,n)=>{let o=null,s=null,a=null;try{a=new i(t,n)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(o&&1!==s.compare(e)||(o=e,s=new r(o,n)))})),o}},5316:(e,t,n)=>{const r=n(6376),i=n(6902),o=n(1312);e.exports=(e,t)=>{e=new i(e,t);let n=new r("0.0.0");if(e.test(n))return n;if(n=new r("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t{const t=new r(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!o(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!s||n&&!o(n,s)||(n=s)}return n&&e.test(n)?n:null}},6826:(e,t,n)=>{const r=n(6376),i=n(2257),{ANY:o}=i,s=n(6902),a=n(5712),c=n(1312),u=n(1544),l=n(2056),p=n(5903);e.exports=(e,t,n,f)=>{let d,h,m,g,v;switch(e=new r(e,f),t=new s(t,f),n){case">":d=c,h=l,m=u,g=">",v=">=";break;case"<":d=u,h=p,m=c,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,f))return!1;for(let n=0;n{e.semver===o&&(e=new i(">=0.0.0")),s=s||e,a=a||e,d(e.semver,s.semver,f)?s=e:m(e.semver,a.semver,f)&&(a=e)})),s.operator===g||s.operator===v)return!1;if((!a.operator||a.operator===g)&&h(e,a.semver))return!1;if(a.operator===v&&m(e,a.semver))return!1}return!0}},7908:(e,t,n)=>{const r=n(5712),i=n(6269);e.exports=(e,t,n)=>{const o=[];let s=null,a=null;const c=e.sort(((e,t)=>i(e,t,n)));for(const e of c){r(e,t,n)?(a=e,s||(s=e)):(a&&o.push([s,a]),a=null,s=null)}s&&o.push([s,null]);const u=[];for(const[e,t]of o)e===t?u.push(e):t||e!==c[0]?t?e===c[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),p="string"==typeof t.raw?t.raw:String(t);return l.length{const r=n(6902),i=n(2257),{ANY:o}=i,s=n(5712),a=n(6269),c=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===o){if(1===t.length&&t[0].semver===o)return!0;e=n.includePrerelease?[new i(">=0.0.0-0")]:[new i(">=0.0.0")]}if(1===t.length&&t[0].semver===o){if(n.includePrerelease)return!0;t=[new i(">=0.0.0")]}const r=new Set;let c,p,f,d,h,m,g;for(const t of e)">"===t.operator||">="===t.operator?c=u(c,t,n):"<"===t.operator||"<="===t.operator?p=l(p,t,n):r.add(t.semver);if(r.size>1)return null;if(c&&p){if(f=a(c.semver,p.semver,n),f>0)return null;if(0===f&&(">="!==c.operator||"<="!==p.operator))return null}for(const e of r){if(c&&!s(e,String(c),n))return null;if(p&&!s(e,String(p),n))return null;for(const r of t)if(!s(e,String(r),n))return!1;return!0}let v=!(!p||n.includePrerelease||!p.semver.prerelease.length)&&p.semver,y=!(!c||n.includePrerelease||!c.semver.prerelease.length)&&c.semver;v&&1===v.prerelease.length&&"<"===p.operator&&0===v.prerelease[0]&&(v=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,c)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(d=u(c,e,n),d===e&&d!==c)return!1}else if(">="===c.operator&&!s(c.semver,String(e),n))return!1;if(p)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if(h=l(p,e,n),h===e&&h!==p)return!1}else if("<="===p.operator&&!s(p.semver,String(e),n))return!1;if(!e.operator&&(p||c)&&0!==f)return!1}return!(c&&m&&!p&&0!==f)&&(!(p&&g&&!c&&0!==f)&&(!y&&!v))},u=(e,t,n)=>{if(!e)return t;const r=a(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},l=(e,t,n)=>{if(!e)return t;const r=a(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new r(e,n),t=new r(t,n);let i=!1;e:for(const r of e.set){for(const e of t.set){const t=c(r,e,n);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},1042:(e,t,n)=>{const r=n(6902);e.exports=(e,t)=>new r(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},9042:(e,t,n)=>{const r=n(6902);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},6372:e=>{"use strict";function t(e){return"function"==typeof e}var n=console.error.bind(console);function r(e,t,n){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function i(e){e&&e.logger&&(t(e.logger)?n=e.logger:n("new logger isn't a function, not replacing"))}function o(e,i,o){if(e&&e[i]){if(!o)return n("no wrapper function"),void n((new Error).stack);if(t(e[i])&&t(o)){var s=e[i],a=o(s,i);return r(a,"__original",s),r(a,"__unwrap",(function(){e[i]===a&&r(e,i,s)})),r(a,"__wrapped",!0),r(e,i,a),a}n("original object and wrapper must be functions")}else n("no original function "+i+" to wrap")}function s(e,t){return e&&e[t]?e[t].__unwrap?e[t].__unwrap():void n("no original to unwrap to -- has "+t+" already been unwrapped?"):(n("no function to unwrap."),void n((new Error).stack))}i.wrap=o,i.massWrap=function(e,t,r){if(!e)return n("must provide one or more modules to patch"),void n((new Error).stack);Array.isArray(e)||(e=[e]),t&&Array.isArray(t)?e.forEach((function(e){t.forEach((function(t){o(e,t,r)}))})):n("must provide one or more functions to wrap on modules")},i.unwrap=s,i.massUnwrap=function(e,t){if(!e)return n("must provide one or more modules to patch"),void n((new Error).stack);Array.isArray(e)||(e=[e]),t&&Array.isArray(t)?e.forEach((function(e){t.forEach((function(t){s(e,t)}))})):n("must provide one or more functions to unwrap on modules")},e.exports=i},465:e=>{e.exports=function(e,t){var n=[];n.push(function(e){try{return Error.prototype.toString.call(e)}catch(e){try{return""}catch(e){return""}}}(e));for(var r=0;r"}catch(e){i=""}}n.push(" at "+i)}return n.join("\n")}},2512:(e,t,n)=>{if(global._stackChain){if(global._stackChain.version!==n(9414).i8)throw new Error("Conflicting version of stack-chain found");e.exports=global._stackChain}else e.exports=global._stackChain=n(7898)},9414:e=>{"use strict";e.exports={i8:"1.3.7"}},7898:(e,t,n)=>{var r=n(465);function i(){this.extend=new a,this.filter=new a,this.format=new c,this.version=n(9414).i8}var o=!1;i.prototype.callSite=function e(t){t||(t={}),o=!0;var n={};Error.captureStackTrace(n,e);var r=n.stack;return o=!1,r=r.slice(t.slice||0),t.extend&&(r=this.extend._modify(n,r)),t.filter&&(r=this.filter._modify(n,r)),r};var s=new i;function a(){this._modifiers=[]}function c(){this._formater=r,this._previous=void 0}a.prototype._modify=function(e,t){for(var n=0,r=this._modifiers.length;n{"use strict";const r=n(2087),i=n(3867),o=n(6560),{env:s}=process;let a;function c(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function u(e,t){if(0===a)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(e&&!t&&void 0===a)return 0;const n=a||0;if("dumb"===s.TERM)return n;if("win32"===process.platform){const e=r.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in s)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in s))||"codeship"===s.CI_NAME?1:n;if("TEAMCITY_VERSION"in s)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if("truecolor"===s.COLORTERM)return 3;if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:n}o("no-color")||o("no-colors")||o("color=false")||o("color=never")?a=0:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(a=1),"FORCE_COLOR"in s&&(a="true"===s.FORCE_COLOR?1:"false"===s.FORCE_COLOR?0:0===s.FORCE_COLOR.length?1:Math.min(parseInt(s.FORCE_COLOR,10),3)),e.exports={supportsColor:function(e){return c(u(e,e&&e.isTTY))},stdout:c(u(!0,i.isatty(1))),stderr:c(u(!0,i.isatty(2)))}},7250:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(3129).execSync,o=n(1453);let s=process.platform;const a="linux"===s,c="darwin"===s,u="win32"===s,l="freebsd"===s,p="openbsd"===s,f="netbsd"===s,d="sunos"===s;function h(e,t,n){let r="";return e.indexOf("speak")>=0&&(r="Speaker"),e.indexOf("laut")>=0&&(r="Speaker"),e.indexOf("loud")>=0&&(r="Speaker"),e.indexOf("head")>=0&&(r="Headset"),e.indexOf("mic")>=0&&(r="Microphone"),e.indexOf("mikr")>=0&&(r="Microphone"),e.indexOf("phone")>=0&&(r="Phone"),e.indexOf("controll")>=0&&(r="Controller"),e.indexOf("line o")>=0&&(r="Line Out"),e.indexOf("digital o")>=0&&(r="Digital Out"),!r&&n?r="Speaker":!r&&t&&(r="Microphone"),r}function m(e,t){const n={},r=o.getValue(e,"Slot"),i=t.filter((function(e){return e.slotId===r}));return n.id=r,n.name=o.getValue(e,"SDevice"),n.manufacturer=o.getValue(e,"SVendor"),n.revision=o.getValue(e,"Rev"),n.driver=i&&1===i.length&&i[0].driver?i[0].driver:"",n.default=null,n.channel="PCIe",n.type=h(n.name,null,null),n.in=null,n.out=null,n.status="online",n}function g(e,t){const n={},r=((e.coreaudio_device_transport||"")+" "+(e._name||"")).toLowerCase();return n.id=t,n.name=e._name,n.manufacturer=e.coreaudio_device_manufacturer,n.revision=null,n.driver=null,n.default=!!e.coreaudio_default_audio_input_device||!!e.coreaudio_default_audio_output_device,n.channel=function(e){let t="";return e.indexOf("builtin")>=0&&(t="Built-In"),e.indexOf("extern")>=0&&(t="Audio-Jack"),e.indexOf("hdmi")>=0&&(t="HDMI"),e.indexOf("displayport")>=0&&(t="Display-Port"),e.indexOf("usb")>=0&&(t="USB"),e.indexOf("pci")>=0&&(t="PCIe"),t}(r),n.type=h(n.name,!!e.coreaudio_device_input,!!e.coreaudio_device_output),n.in=!!e.coreaudio_device_input,n.out=!!e.coreaudio_device_output,n.status="online",n}function v(e){const t={},n=o.getValue(e,"StatusInfo","=");return t.id=o.getValue(e,"DeviceID","="),t.name=o.getValue(e,"name","="),t.manufacturer=o.getValue(e,"manufacturer","="),t.revision=null,t.driver=null,t.default=null,t.channel=null,t.type=h(t.name,null,null),t.in=null,t.out=null,t.status=n,t}t.audio=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(a||l||p||f){r("lspci -vmm 2>/dev/null",(function(r,s){if(!r){const e=function(){let e=[];try{const t=i("lspci -v 2>/dev/null").toString().split("\n\n");for(let n=0;n=0){const t={};t.slotId=r[0].split(" ")[0],t.driver=o.getValue(r,"Kernel driver in use",":",!0)||o.getValue(r,"Kernel modules",":",!0),e.push(t)}}return e}catch(t){return e}}(),t=s.toString().split("\n\n");for(let r=0;r=0){const t=m(i,e);n.push(t)}}}e&&e(n),t(n)}))}if(c){r("system_profiler SPAudioDataType -json",(function(r,i){if(!r)try{const e=JSON.parse(i.toString());if(e.SPAudioDataType&&e.SPAudioDataType.length&&e.SPAudioDataType[0]&&e.SPAudioDataType[0]._items&&e.SPAudioDataType[0]._items.length)for(let t=0;t{"use strict";const r=n(3129).exec,i=n(5747),o=n(1453);let s=process.platform;const a="linux"===s,c="darwin"===s,u="win32"===s,l="freebsd"===s,p="openbsd"===s,f="netbsd"===s,d="sunos"===s;e.exports=function(e){return new Promise((t=>{process.nextTick((()=>{let n={hasBattery:!1,cycleCount:0,isCharging:!1,designedCapacity:0,maxCapacity:0,currentCapacity:0,voltage:0,capacityUnit:"",percent:0,timeRemaining:null,acConnected:!0,type:"",model:"",manufacturer:"",serial:""};if(a){let r="";i.existsSync("/sys/class/power_supply/BAT1/uevent")?r="/sys/class/power_supply/BAT1/":i.existsSync("/sys/class/power_supply/BAT0/uevent")&&(r="/sys/class/power_supply/BAT0/"),r?i.readFile(r+"uevent",(function(r,i){if(r)e&&e(n),t(n);else{let r=i.toString().split("\n");n.isCharging="charging"===o.getValue(r,"POWER_SUPPLY_STATUS","=").toLowerCase(),n.acConnected=n.isCharging,n.voltage=parseInt("0"+o.getValue(r,"POWER_SUPPLY_VOLTAGE_NOW","="),10)/1e6,n.capacityUnit=n.voltage?"mWh":"mAh",n.cycleCount=parseInt("0"+o.getValue(r,"POWER_SUPPLY_CYCLE_COUNT","="),10),n.maxCapacity=Math.round(parseInt("0"+o.getValue(r,"POWER_SUPPLY_CHARGE_FULL","="),10)/1e3/(n.voltage||1)),n.designedCapacity=Math.round(parseInt("0"+o.getValue(r,"POWER_SUPPLY_CHARGE_FULL_DESIGN","="),10)/1e3/(n.voltage||1))|n.maxcapacity,n.currentCapacity=Math.round(parseInt("0"+o.getValue(r,"POWER_SUPPLY_CHARGE_NOW","="),10)/1e3/(n.voltage||1)),n.maxCapacity||(n.maxCapacity=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_FULL","="),10)/1e3,n.designCapacity=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_FULL_DESIGN","="),10)/1e3|n.maxCapacity,n.currentCapacity=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_NOW","="),10)/1e3);const s=o.getValue(r,"POWER_SUPPLY_CAPACITY","="),a=parseInt("0"+o.getValue(r,"POWER_SUPPLY_ENERGY_NOW","="),10),c=parseInt("0"+o.getValue(r,"POWER_SUPPLY_POWER_NOW","="),10),u=parseInt("0"+o.getValue(r,"POWER_SUPPLY_CURRENT_NOW","="),10);n.percent=parseInt("0"+s,10),n.maxCapacity&&n.currentCapacity&&(n.hasBattery=!0,s||(n.percent=100*n.currentCapacity/n.maxCapacity)),n.isCharging&&(n.hasBattery=!0),a&&c?n.timeRemaining=Math.floor(a/c*60):u&&n.currentCapacity&&(n.timeRemaining=Math.floor(n.currentCapacity/u*60)),n.type=o.getValue(r,"POWER_SUPPLY_TECHNOLOGY","="),n.model=o.getValue(r,"POWER_SUPPLY_MODEL_NAME","="),n.manufacturer=o.getValue(r,"POWER_SUPPLY_MANUFACTURER","="),n.serial=o.getValue(r,"POWER_SUPPLY_SERIAL_NUMBER","="),e&&e(n),t(n)}})):(e&&e(n),t(n))}if((l||p||f)&&r("sysctl hw.acpi.battery hw.acpi.acline",(function(r,i){let s=i.toString().split("\n");const a=parseInt("0"+o.getValue(s,"hw.acpi.battery.units"),10),c=parseInt("0"+o.getValue(s,"hw.acpi.battery.life"),10);n.hasBattery=a>0,n.cycleCount=null,n.isCharging="1"!==o.getValue(s,"hw.acpi.acline"),n.acConnected=n.isCharging,n.maxCapacity=null,n.currentCapacity=null,n.capacityUnit="unknown",n.percent=a?c:null,e&&e(n),t(n)})),c&&r('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %',(function(r,i){if(i){let e=i.toString().replace(/ +/g,"").replace(/"+/g,"").replace(/-/g,"").split("\n");n.cycleCount=parseInt("0"+o.getValue(e,"cyclecount","="),10),n.voltage=parseInt("0"+o.getValue(e,"voltage","="),10)/1e3,n.capacityUnit=n.voltage?"mWh":"mAh",n.maxCapacity=Math.round(parseInt("0"+o.getValue(e,"maxcapacity","="),10)*(n.voltage||1)),n.currentCapacity=Math.round(parseInt("0"+o.getValue(e,"currentcapacity","="),10)*(n.voltage||1)),n.designedCapacity=Math.round(parseInt("0"+o.getValue(e,"DesignCapacity","="),10)*(n.voltage||1)),n.manufacturer="Apple",n.serial=o.getValue(e,"BatterySerialNumber","=");let t=null;let r=o.getValue(e,"internal","Battery").split(";");if(r&&r[0]){let e=r[0].split("\t");e&&e[1]&&(t=parseFloat(e[1].trim().replace(/%/g,"")))}r&&r[1]?(n.isCharging="charging"===r[1].trim(),n.acConnected="discharging"!==r[1].trim()):(n.isCharging="yes"===o.getValue(e,"ischarging","=").toLowerCase(),n.acConnected=n.isCharging),n.maxCapacity&&n.currentCapacity&&(n.hasBattery=!0,n.type="Li-ion",n.percent=null!==t?t:Math.round(100*n.currentCapacity/n.maxCapacity),n.isCharging||(n.timeRemaining=parseInt("0"+o.getValue(e,"TimeRemaining","="),10)))}e&&e(n),t(n)})),d&&(e&&e(n),t(n)),u)try{o.wmic("Path Win32_Battery Get BatteryStatus, DesignCapacity, EstimatedChargeRemaining, DesignVoltage, FullChargeCapacity /value").then((r=>{if(r){let e=r.split("\r\n"),t=o.getValue(e,"BatteryStatus","=").trim();if(t&&"10"!=t){const r=parseInt(t);n.hasBattery=!0,n.maxCapacity=parseInt(o.getValue(e,"DesignCapacity","=")||0),n.designCapacity=parseInt(o.getValue(e,"DesignCapacity","=")||0),n.voltage=parseInt(o.getValue(e,"DesignVoltage","=")||0)/1e3,n.capacityUnit="mWh",n.percent=parseInt(o.getValue(e,"EstimatedChargeRemaining","=")||0),n.currentCapacity=parseInt(n.maxcapacity*n.percent/100),n.isCharging=r>=6&&r<=9||11===r||!(3===r)&&!(1===r)&&n.percent<100,n.acConnected=n.ischarging||2===r}}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}))}))}},7381:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(3129).execSync,o=n(5622),s=n(1453),a=n(5747);let c=process.platform;const u="linux"===c,l="darwin"===c,p="win32"===c,f="freebsd"===c,d="openbsd"===c,h="netbsd"===c,m="sunos"===c;function g(e){let t="";return e.indexOf("keyboard")>=0&&(t="Keyboard"),e.indexOf("mouse")>=0&&(t="Mouse"),e.indexOf("speaker")>=0&&(t="Speaker"),e.indexOf("headset")>=0&&(t="Headset"),e.indexOf("phone")>=0&&(t="Phone"),t}function v(e,t,n){const r={device:null};return r.name=s.getValue(e,"name","="),r.manufacturer=null,r.macDevice=t,r.macHost=n,r.batteryPercent=null,r.type=g(r.name.toLowerCase()),r.connected=!1,r}function y(e,t){const n={},r=((e.device_minorClassOfDevice_string||e.device_majorClassOfDevice_string||"")+(e.device_name||"")).toLowerCase();return n.device=e.device_services||"",n.name=e.device_name||"",n.manufacturer=e.device_manufacturer||"",n.macDevice=(e.device_addr||"").toLowerCase().replace(/-/g,":"),n.macHost=t,n.batteryPercent=e.device_batteryPercent||null,n.type=g(r),n.connected="attrib_Yes"===e.device_isconnected||!1,n}function _(e){const t={device:null};return t.name=s.getValue(e,"name","="),t.manufacturer=s.getValue(e,"manufacturer","="),t.macDevice=null,t.macHost=null,t.batteryPercent=null,t.type=g(t.name.toLowerCase()),t.connected=null,t}t.bluetoothDevices=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(u){const r=s.getFilesInPath("/var/lib/bluetooth/");for(let e=0;e=6?i[i.length-2]:null,c=i.length>=7?i[i.length-3]:null;if("info"===t){const t=a.readFileSync(r[e],{encoding:"utf8"}).split("\n");n.push(v(t,s,c))}}try{const e=i("hcitool con").toString().toLowerCase();for(let t=0;t10&&e.indexOf(n[t].macDevice.toLowerCase())>=0&&(n[t].connected=!0)}catch(e){s.noop()}e&&e(n),t(n)}if(l){r("system_profiler SPBluetoothDataType -json",(function(r,i){if(!r)try{const e=JSON.parse(i.toString());if(e.SPBluetoothDataType&&e.SPBluetoothDataType.length&&e.SPBluetoothDataType[0]&&e.SPBluetoothDataType[0].device_title&&e.SPBluetoothDataType[0].device_title.length){let t=null;e.SPBluetoothDataType[0].local_device_title&&e.SPBluetoothDataType[0].local_device_title.general_address&&(t=e.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g,":"));for(let r=0;r{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(5747),a=n(1453);let c=process.platform;const u="linux"===c,l="darwin"===c,p="win32"===c,f="freebsd"===c,d="openbsd"===c,h="netbsd"===c,m="sunos"===c;let g=0,v={user:0,nice:0,system:0,idle:0,irq:0,load:0,tick:0,ms:0,currentLoad:0,currentLoadUser:0,currentLoadSystem:0,currentLoadNice:0,currentLoadIdle:0,currentLoadIrq:0,rawCurrentLoad:0,rawCurrentLoadUser:0,rawCurrentLoadSystem:0,rawCurrentLoadNice:0,rawCurrentLoadIdle:0,rawCurrentLoadIrq:0},y=[],_=0;const E={8346:"1.8",8347:"1.9",8350:"2.0",8354:"2.2","8356|SE":"2.4",8356:"2.3",8360:"2.5",2372:"2.1",2373:"2.1",2374:"2.2",2376:"2.3",2377:"2.3",2378:"2.4",2379:"2.4",2380:"2.5",2381:"2.5",2382:"2.6",2384:"2.7",2386:"2.8",2387:"2.8",2389:"2.9",2393:"3.1",8374:"2.2",8376:"2.3",8378:"2.4",8379:"2.4",8380:"2.5",8381:"2.5",8382:"2.6",8384:"2.7",8386:"2.8",8387:"2.8",8389:"2.9",8393:"3.1","2419EE":"1.8","2423HE":"2.0","2425HE":"2.1",2427:"2.2",2431:"2.4",2435:"2.6","2439SE":"2.8","8425HE":"2.1",8431:"2.4",8435:"2.6","8439SE":"2.8",4122:"2.2",4130:"2.6","4162EE":"1.7","4164EE":"1.8","4170HE":"2.1","4174HE":"2.3","4176HE":"2.4",4180:"2.6",4184:"2.8","6124HE":"1.8","6128HE":"2.0","6132HE":"2.2",6128:"2.0",6134:"2.3",6136:"2.4",6140:"2.6","6164HE":"1.7","6166HE":"1.8",6168:"1.9",6172:"2.1",6174:"2.2",6176:"2.3","6176SE":"2.3","6180SE":"2.5",3250:"2.5",3260:"2.7",3280:"2.4",4226:"2.7",4228:"2.8",4230:"2.9",4234:"3.1",4238:"3.3",4240:"3.4",4256:"1.6",4274:"2.5",4276:"2.6",4280:"2.8",4284:"3.0",6204:"3.3",6212:"2.6",6220:"3.0",6234:"2.4",6238:"2.6","6262HE":"1.6",6272:"2.1",6274:"2.2",6276:"2.3",6278:"2.4","6282SE":"2.6","6284SE":"2.7",6308:"3.5",6320:"2.8",6328:"3.2","6338P":"2.3",6344:"2.6",6348:"2.8",6366:"1.8","6370P":"2.0",6376:"2.3",6378:"2.4",6380:"2.5",6386:"2.8","FX|4100":"3.6","FX|4120":"3.9","FX|4130":"3.8","FX|4150":"3.8","FX|4170":"4.2","FX|6100":"3.3","FX|6120":"3.6","FX|6130":"3.6","FX|6200":"3.8","FX|8100":"2.8","FX|8120":"3.1","FX|8140":"3.2","FX|8150":"3.6","FX|8170":"3.9","FX|4300":"3.8","FX|4320":"4.0","FX|4350":"4.2","FX|6300":"3.5","FX|6350":"3.9","FX|8300":"3.3","FX|8310":"3.4","FX|8320":"3.5","FX|8350":"4.0","FX|8370":"4.0","FX|9370":"4.4","FX|9590":"4.7","FX|8320E":"3.2","FX|8370E":"3.3",1200:"3.1","Pro 1200":"3.1","1300X":"3.5","Pro 1300":"3.5",1400:"3.2","1500X":"3.5","Pro 1500":"3.5",1600:"3.2","1600X":"3.6","Pro 1600":"3.2",1700:"3.0","Pro 1700":"3.0","1700X":"3.4","Pro 1700X":"3.4","1800X":"3.6","1900X":"3.8",1920:"3.2","1920X":"3.5","1950X":"3.4","200GE":"3.2","Pro 200GE":"3.2","220GE":"3.4","240GE":"3.5","3000G":"3.5","300GE":"3.4","3050GE":"3.4","2200G":"3.5","Pro 2200G":"3.5","2200GE":"3.2","Pro 2200GE":"3.2","2400G":"3.6","Pro 2400G":"3.6","2400GE":"3.2","Pro 2400GE":"3.2","Pro 200U":"2.3","300U":"2.4","2200U":"2.5","3200U":"2.6","2300U":"2.0","Pro 2300U":"2.0","2500U":"2.0","Pro 2500U":"2.2","2600H":"3.2","2700U":"2.0","Pro 2700U":"2.2","2800H":"3.3",7351:"2.4","7351P":"2.4",7401:"2.0","7401P":"2.0","7551P":"2.0",7551:"2.0",7251:"2.1",7261:"2.5",7281:"2.1",7301:"2.2",7371:"3.1",7451:"2.3",7501:"2.0",7571:"2.2",7601:"2.2",V1500B:"2.2",V1780B:"3.35",V1202B:"2.3",V1404I:"2.0",V1605B:"2.0",V1756B:"3.25",V1807B:"3.35",3101:"2.1",3151:"2.7",3201:"1.5",3251:"2.5",3255:"2.5",3301:"2.0",3351:"1.9",3401:"1.85",3451:"2.15","1200|AF":"3.1","2300X":"3.5","2500X":"3.6",2600:"3.4","2600E":"3.1","1600|AF":"3.2","2600X":"3.6",2700:"3.2","2700E":"2.8","Pro 2700":"3.2","2700X":"3.7","Pro 2700X":"3.6","2920X":"3.5","2950X":"3.5","2970WX":"3.0","2990WX":"3.0","Pro 300GE":"3.4","Pro 3125GE":"3.4","3150G":"3.5","Pro 3150G":"3.5","3150GE":"3.3","Pro 3150GE":"3.3","3200G":"3.6","Pro 3200G":"3.6","3200GE":"3.3","Pro 3200GE":"3.3","3350G":"3.6","Pro 3350G":"3.6","3350GE":"3.3","Pro 3350GE":"3.3","3400G":"3.7","Pro 3400G":"3.7","3400GE":"3.3","Pro 3400GE":"3.3","3300U":"2.1","PRO 3300U":"2.1","3450U":"2.1","3500U":"2.1","PRO 3500U":"2.1","3500C":"2.1","3550H":"2.1","3580U":"2.1","3700U":"2.3","PRO 3700U":"2.3","3700C":"2.3","3750H":"2.3","3780U":"2.3",3100:"3.6","3300X":"3.8",3500:"3.6","3500X":"3.6",3600:"3.6","Pro 3600":"3.6","3600X":"3.8","3600XT":"3.8","Pro 3700":"3.6","3700X":"3.6","3800X":"3.9","3800XT":"3.9",3900:"3.1","Pro 3900":"3.1","3900X":"3.8","3900XT":"3.8","3950X":"3.5","3960X":"3.8","3970X":"3.7","3990X":"2.9","3945WX":"4.0","3955WX":"3.9","3975WX":"3.5","3995WX":"2.7","4300GE":"3.5","Pro 4300GE":"3.5","4300G":"3.8","Pro 4300G":"3.8","4600GE":"3.3","Pro 4650GE":"3.3","4600G":"3.7","Pro 4650G":"3.7","4700GE":"3.1","Pro 4750GE":"3.1","4700G":"3.6","Pro 4750G":"3.6","4300U":"2.7","Pro 4450U":"2.5","4500U":"2.3","4600U":"2.1","PRO 4650U":"2.1","4600HS":"3.0","4600H":"3.0","4700U":"2.0","PRO 4750U":"1.7","4800U":"1.8","4800HS":"2.9","4800H":"2.9","4900HS":"3.0","4900H":"3.3","7232P":"3.1","7302P":"3.0","7402P":"2.8","7502P":"2.5","7702P":"2.0",7252:"3.1",7262:"3.2",7272:"2.9",7282:"2.8",7302:"3.0",7352:"2.3",7402:"2.8",7452:"2.35",7502:"2.5",7532:"2.4",7542:"2.9",7552:"2.2",7642:"2.3",7662:"2.0",7702:"2.0",7742:"2.25","7H12":"2.6","7F32":"3.7","7F52":"3.5","7F72":"3.2","5600X":"3.7","5800X":"3.8","5900X":"3.7","5950X":"3.4"},b={1:"Other",2:"Unknown",3:"Daughter Board",4:"ZIF Socket",5:"Replacement/Piggy Back",6:"None",7:"LIF Socket",8:"Slot 1",9:"Slot 2",10:"370 Pin Socket",11:"Slot A",12:"Slot M",13:"423",14:"A (Socket 462)",15:"478",16:"754",17:"940",18:"939",19:"mPGA604",20:"LGA771",21:"LGA775",22:"S1",23:"AM2",24:"F (1207)",25:"LGA1366",26:"G34",27:"AM3",28:"C32",29:"LGA1156",30:"LGA1567",31:"PGA988A",32:"BGA1288",33:"rPGA988B",34:"BGA1023",35:"BGA1224",36:"LGA1155",37:"LGA1356",38:"LGA2011",39:"FS1",40:"FS2",41:"FM1",42:"FM2",43:"LGA2011-3",44:"LGA1356-3",45:"LGA1150",46:"BGA1168",47:"BGA1234",48:"BGA1364",49:"AM4",50:"LGA1151",51:"BGA1356",52:"BGA1440",53:"BGA1515",54:"LGA3647-1",55:"SP3",56:"SP3r2",57:"LGA2066",58:"BGA1392",59:"BGA1510",60:"BGA1528",61:"LGA4189",62:"LGA1200"};function w(e){e.brand=e.brand.replace(/\(R\)+/g,"®").replace(/\s+/g," ").trim(),e.brand=e.brand.replace(/\(TM\)+/g,"™").replace(/\s+/g," ").trim(),e.brand=e.brand.replace(/\(C\)+/g,"©").replace(/\s+/g," ").trim(),e.brand=e.brand.replace(/CPU+/g,"").replace(/\s+/g," ").trim(),e.manufacturer=e.brand.split(" ")[0];let t=e.brand.split(" ");return t.shift(),e.brand=t.join(" "),e}function S(e){let t="0";for(let n in E)if({}.hasOwnProperty.call(E,n)){let r=n.split("|"),i=0;r.forEach((t=>{e.indexOf(t)>-1&&i++})),i===r.length&&(t=E[n])}return parseFloat(t)}function I(){let e=r.cpus(),t=999999999,n=0,i=0,o=[];if(e&&e.length){for(let r in e)if({}.hasOwnProperty.call(e,r)){let s=e[r].speed>100?(e[r].speed+1)/1e3:e[r].speed/10;i+=s,s>n&&(n=s),s{process.nextTick((()=>{let n="";if(p)try{i('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet',a.execOptsWin,(function(r,i){if(!r){let e=i.split("0x").pop().trim(),t=parseInt(e,16).toString(2),r="0".repeat(32-t.length)+t,o=["fpu","vme","de","pse","tsc","msr","pae","mce","cx8","apic","","sep","mtrr","pge","mca","cmov","pat","pse-36","psn","clfsh","","ds","acpi","mmx","fxsr","sse","sse2","ss","htt","tm","ia64","pbe"];for(let e=0;e/dev/null; unset LC_ALL",(function(r,i){let o=[];if(!r){let e=i.toString().split("\tFlags:");(e.length>1?e[1].split("\tVersion:")[0].split["\n"]:[]).forEach((function(e){let t=(e.indexOf("(")?e.split("(")[0].toLowerCase():"").trim().replace(/\t/g,"");t&&o.push(t)}))}n=o.join(" ").trim().toLowerCase(),e&&e(n),t(n)})),l&&i("sysctl machdep.cpu.features",(function(r,i){if(!r){let e=i.toString().split("\n");e.length>0&&-1!==e[0].indexOf("machdep.cpu.features:")&&(n=e[0].split(":")[1].trim().toLowerCase())}e&&e(n),t(n)})),m&&(e&&e(n),t(n))}))}))}function x(e){return new Promise((t=>{process.nextTick((()=>{let n={l1d:null,l1i:null,l2:null,l3:null};if(u)try{i("export LC_ALL=C; lscpu; unset LC_ALL",(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){let t=e.split(":");-1!==t[0].toUpperCase().indexOf("L1D CACHE")&&(n.l1d=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toUpperCase().indexOf("L1I CACHE")&&(n.l1i=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toUpperCase().indexOf("L2 CACHE")&&(n.l2=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toUpperCase().indexOf("L3 CACHE")&&(n.l3=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1))}))}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}if((f||d||h)&&i("export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL",(function(r,i){let o=[];if(!r){o=i.toString().split("Cache Information"),o.shift()}for(let e=0;e1?i[1]:"kb";s*="kb"===c?1024:"mb"===c?1048576:"gb"===c?1073741824:1,r&&("l1"===r?(n.cache[r+"d"]=s/2,n.cache[r+"i"]=s/2):n.cache[r]=s)}e&&e(n),t(n)})),l&&i("sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize",(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){let t=e.split(":");-1!==t[0].toLowerCase().indexOf("hw.l1icachesize")&&(n.l1d=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toLowerCase().indexOf("hw.l1dcachesize")&&(n.l1i=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toLowerCase().indexOf("hw.l2cachesize")&&(n.l2=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1)),-1!==t[0].toLowerCase().indexOf("hw.l3cachesize")&&(n.l3=parseInt(t[1].trim())*(-1!==t[1].indexOf("K")?1024:1))}))}e&&e(n),t(n)})),m&&(e&&e(n),t(n)),p)try{a.wmic("cpu get l2cachesize, l3cachesize /value").then(((r,i)=>{if(!i){let e=r.split("\r\n");n.l1d=0,n.l1i=0,n.l2=a.getValue(e,"l2cachesize","="),n.l3=a.getValue(e,"l3cachesize","="),n.l2&&(n.l2=1024*parseInt(n.l2,10)),n.l3&&(n.l3=1024*parseInt(n.l3,10))}a.wmic("path Win32_CacheMemory get CacheType,InstalledSize,Purpose").then(((r,i)=>{if(!i){r.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(e){""!==e&&("L1 Cache"===(e=e.trim().split(/\s\s+/))[2]&&"3"===e[0]&&(n.l1i=parseInt(e[1],10)),"L1 Cache"===e[2]&&"4"===e[0]&&(n.l1d=parseInt(e[1],10)))}))}e&&e(n),t(n)}))}))}catch(r){e&&e(n),t(n)}}))}))}t.cpu=function(e){return new Promise((t=>{process.nextTick((()=>{new Promise((e=>{process.nextTick((()=>{const t="unknown";let n={manufacturer:t,brand:t,vendor:"",family:"",model:"",stepping:"",revision:"",voltage:"",speed:0,speedMin:0,speedMax:0,governor:"",cores:a.cores(),physicalCores:a.cores(),processors:1,socket:"",flags:"",virtualization:!1,cache:{}};C().then((t=>{if(n.flags=t,n.virtualization=t.indexOf("vmx")>-1||t.indexOf("svm")>-1,p)try{const e=o("systeminfo",a.execOptsWin).toString();n.virtualization=n.virtualization||-1!==e.indexOf("Virtualization Enabled In Firmware: Yes")||-1!==e.indexOf("Virtualisierung in Firmware aktiviert: Ja")||-1!==e.indexOf("Virtualisation activée dans le microprogramme : Qiu")}catch(e){a.noop()}if(l&&i("sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily",(function(t,i){let s=i.toString().split("\n");const c=a.getValue(s,"machdep.cpu.brand_string").split("@");n.brand=c[0].trim();const u=c[1]?c[1].trim():"0";n.speed=parseFloat(u.replace(/GHz+/g,""));let l=a.getValue(s,"hw.tbfrequency")/1e9;l=l<.1?100*l:l,n.speed=0===n.speed?l:n.speed,g=n.speed,n=w(n),n.speedMin=a.getValue(s,"hw.cpufrequency_min")?a.getValue(s,"hw.cpufrequency_min")/1e9:n.speed,n.speedMax=a.getValue(s,"hw.cpufrequency_max")?a.getValue(s,"hw.cpufrequency_max")/1e9:n.speed,n.vendor=a.getValue(s,"machdep.cpu.vendor")||"Apple",n.family=a.getValue(s,"machdep.cpu.family")||a.getValue(s,"hw.cpufamily"),n.model=a.getValue(s,"machdep.cpu.model"),n.stepping=a.getValue(s,"machdep.cpu.stepping")||a.getValue(s,"hw.cpusubfamily");const p=a.getValue(s,"hw.packages"),f=a.getValue(s,"hw.physicalcpu_max"),d=a.getValue(s,"hw.ncpu");if("arm64"===r.arch()){const e=o("ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type").toString().split("\n"),t=e.filter((e=>e.indexOf('"E"')>=0)).length,r=e.filter((e=>e.indexOf('"P"')>=0)).length;n.socket="SOC",n.efficiencyCores=t,n.performanceCores=r}p&&(n.processors=parseInt(p)||1),f&&d&&(n.cores=parseInt(d)||a.cores(),n.physicalCores=parseInt(f)||a.cores()),x().then((t=>{n.cache=t,e(n)}))})),u){let t="",o=[];r.cpus()[0]&&r.cpus()[0].model&&(t=r.cpus()[0].model),i('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL',(function(r,c){r||(o=c.toString().split("\n")),t=a.getValue(o,"model name")||t;const u=t.split("@");if(n.brand=u[0].trim(),n.speed=u[1]?parseFloat(u[1].trim()):0,0===n.speed&&(n.brand.indexOf("AMD")>-1||n.brand.toLowerCase().indexOf("ryzen")>-1)&&(n.speed=S(n.brand)),0===n.speed){const e=I();0!==e.avg&&(n.speed=e.avg)}g=n.speed,n.speedMin=Math.round(parseFloat(a.getValue(o,"cpu min mhz").replace(/,/g,"."))/10)/100,n.speedMax=Math.round(parseFloat(a.getValue(o,"cpu max mhz").replace(/,/g,"."))/10)/100,n=w(n),n.vendor=a.getValue(o,"vendor id"),n.family=a.getValue(o,"cpu family"),n.model=a.getValue(o,"model:"),n.stepping=a.getValue(o,"stepping"),n.revision=a.getValue(o,"cpu revision"),n.cache.l1d=a.getValue(o,"l1d cache"),n.cache.l1d&&(n.cache.l1d=parseInt(n.cache.l1d)*(-1!==n.cache.l1d.indexOf("K")?1024:1)),n.cache.l1i=a.getValue(o,"l1i cache"),n.cache.l1i&&(n.cache.l1i=parseInt(n.cache.l1i)*(-1!==n.cache.l1i.indexOf("K")?1024:1)),n.cache.l2=a.getValue(o,"l2 cache"),n.cache.l2&&(n.cache.l2=parseInt(n.cache.l2)*(-1!==n.cache.l2.indexOf("K")?1024:1)),n.cache.l3=a.getValue(o,"l3 cache"),n.cache.l3&&(n.cache.l3=parseInt(n.cache.l3)*(-1!==n.cache.l3.indexOf("K")?1024:1));const l=a.getValue(o,"thread(s) per core")||"1",p=a.getValue(o,"socket(s)")||"1";let f=parseInt(l,10),d=parseInt(p,10);if(n.physicalCores=n.cores/f,n.processors=d,n.governor=a.getValue(o,"governor")||"","ARM"===n.vendor){const e=s.readFileSync("/proc/cpuinfo").toString().split("\n"),t=a.decodePiCpuinfo(e);t.model.toLowerCase().indexOf("raspberry")>=0&&(n.family=n.manufacturer,n.manufacturer=t.manufacturer,n.brand=t.processor,n.revision=t.revisionCode,n.socket="SOC")}let h=[];i('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL',(function(t,r){h=r.toString().split("\n"),h&&h.length&&(n.socket=a.getValue(h,"Upgrade").replace("Socket","").trim()||n.socket),e(n)}))}))}if(f||d||h){let t="",o=[];r.cpus()[0]&&r.cpus()[0].model&&(t=r.cpus()[0].model),i("export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL",(function(r,i){let s=[];if(!r){const e=i.toString().split("# dmidecode"),t=e.length>1?e[1]:"";s=e.length>2?e[2].split("Cache Information"):[],o=t.split("\n")}if(n.brand=t.split("@")[0].trim(),n.speed=t.split("@")[1]?parseFloat(t.split("@")[1].trim()):0,0===n.speed&&(n.brand.indexOf("AMD")>-1||n.brand.toLowerCase().indexOf("ryzen")>-1)&&(n.speed=S(n.brand)),0===n.speed){const e=I();0!==e.avg&&(n.speed=e.avg)}g=n.speed,n.speedMin=n.speed,n.speedMax=Math.round(parseFloat(a.getValue(o,"max speed").replace(/Mhz/g,""))/10)/100,n=w(n),n.vendor=a.getValue(o,"manufacturer");let c=a.getValue(o,"signature");c=c.split(",");for(var u=0;u1?r[1]:"kb";i*="kb"===c?1024:"mb"===c?1048576:"gb"===c?1073741824:1,t&&("l1"===t?(n.cache[t+"d"]=i/2,n.cache[t+"i"]=i/2):n.cache[t]=i)}n.socket=a.getValue(o,"Upgrade").replace("Socket","").trim();const p=a.getValue(o,"thread count").trim(),f=a.getValue(o,"core count").trim();f&&p&&(n.cores=p,n.physicalCores=f),e(n)}))}if(m&&e(n),p)try{const t=[];t.push(a.wmic("cpu get /value")),t.push(a.wmic("path Win32_CacheMemory get CacheType,InstalledSize,Purpose")),Promise.all(t).then((t=>{let r=t[0].split("\r\n"),i=a.getValue(r,"name","=")||"";i.indexOf("@")>=0?(n.brand=i.split("@")[0].trim(),n.speed=i.split("@")[1]?parseFloat(i.split("@")[1].trim()):0,g=n.speed):(n.brand=i.trim(),n.speed=0),n=w(n),n.revision=a.getValue(r,"revision","="),n.cache.l1d=0,n.cache.l1i=0,n.cache.l2=a.getValue(r,"l2cachesize","="),n.cache.l3=a.getValue(r,"l3cachesize","="),n.cache.l2&&(n.cache.l2=1024*parseInt(n.cache.l2,10)),n.cache.l3&&(n.cache.l3=1024*parseInt(n.cache.l3,10)),n.vendor=a.getValue(r,"manufacturer","="),n.speedMax=Math.round(parseFloat(a.getValue(r,"maxclockspeed","=").replace(/,/g,"."))/10)/100,0===n.speed&&(n.brand.indexOf("AMD")>-1||n.brand.toLowerCase().indexOf("ryzen")>-1)&&(n.speed=S(n.brand)),0===n.speed&&(n.speed=n.speedMax),n.speedMin=n.speed;let o=a.getValue(r,"description","=").split(" ");for(let e=0;e1&&(n.cores=n.cores*c,n.physicalCores=n.physicalCores*c),r=t[1].split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)),r.forEach((function(e){""!==e&&("L1 Cache"===(e=e.trim().split(/\s\s+/))[2]&&"3"===e[0]&&(n.cache.l1i=parseInt(e[1],10)),"L1 Cache"===e[2]&&"4"===e[0]&&(n.cache.l1d=parseInt(e[1],10)))})),e(n)}))}catch(t){e(n)}}))}))})).then((n=>{e&&e(n),t(n)}))}))}))},t.cpuCurrentSpeed=function(e){return new Promise((t=>{process.nextTick((()=>{let n=I();if(0===n.avg&&0!==g){const e=parseFloat(g);n={min:e,max:e,avg:e,cores:[]}}e&&e(n),t(n)}))}))},t.cpuTemperature=function(e){return new Promise((t=>{process.nextTick((()=>{let r={main:null,cores:[],max:null,socket:[],chipset:null};if(u){try{const e=o('cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;').toString().split("-----\n");if(2===e.length){const t=e[0].split("\n"),n=e[1].split("\n");for(let e=0;e{const t=e.split("___"),n=t[0],i=t.length>1&&t[1]?t[1]:"0";i&&(void 0===n||n&&n.toLowerCase().startsWith("core"))?r.cores.push(Math.round(parseInt(i,10)/100)/10):i&&n&&null===r.main&&(r.main=Math.round(parseInt(i,10)/100)/10)})),r.cores.length>0){null===r.main&&(r.main=Math.round(r.cores.reduce(((e,t)=>e+t),0)/r.cores.length));let e=Math.max.apply(Math,r.cores);r.max=e>r.main?e:r.main}if(null!==r.main)return null===r.max&&(r.max=r.main),e&&e(r),void t(r);i("sensors",(function(n,o){if(!n){let n=o.toString().split("\n"),i=null,s=!0,a="";if(n.forEach((function(e){""===e.trim()?s=!0:s&&(e.trim().toLowerCase().startsWith("acpi")&&(a="acpi"),e.trim().toLowerCase().startsWith("pch")&&(a="pch"),e.trim().toLowerCase().startsWith("core")&&(a="core"),s=!1);let t=e.match(/[+-]([^°]*)/g),n=e.split(":")[0].toUpperCase();"acpi"===a?-1!==n.indexOf("TEMP")&&r.socket.push(parseFloat(t)):"pch"===a&&-1!==n.indexOf("TEMP")&&(r.chipset=parseFloat(t)),-1===n.indexOf("PHYSICAL")&&-1===n.indexOf("PACKAGE")||(r.main=parseFloat(t)),-1!==n.indexOf("CORE ")&&r.cores.push(parseFloat(t)),-1!==n.indexOf("TDIE")&&null===i&&(i=parseFloat(t))})),r.cores.length>0){null===r.main&&(r.main=Math.round(r.cores.reduce(((e,t)=>e+t),0)/r.cores.length));let e=Math.max.apply(Math,r.cores);r.max=e>r.main?e:r.main}else null===r.main&&null!==i&&(r.main=i,r.max=i);if(null!==r.main||null!==r.max)return e&&e(r),void t(r)}s.stat("/sys/class/thermal/thermal_zone0/temp",(function(n){null===n?s.readFile("/sys/class/thermal/thermal_zone0/temp",(function(n,i){if(!n){let e=i.toString().split("\n");e.length>0&&(r.main=parseFloat(e[0])/1e3,r.max=r.main)}e&&e(r),t(r)})):i("/opt/vc/bin/vcgencmd measure_temp",(function(n,i){if(!n){let e=i.toString().split("\n");e.length>0&&e[0].indexOf("=")&&(r.main=parseFloat(e[0].split("=")[1]),r.max=r.main)}e&&e(r),t(r)}))}))}))}))}catch(n){e&&e(r),t(r)}}if((f||d||h)&&i("sysctl dev.cpu | grep temp",(function(n,i){if(!n){let e=i.toString().split("\n"),t=0;e.forEach((function(e){const n=e.split(":");if(n.length>1){const e=parseFloat(n[1].replace(",","."));e>r.max&&(r.max=e),t+=e,r.cores.push(e)}})),r.cores.length&&(r.main=Math.round(t/r.cores.length*100)/100)}e&&e(r),t(r)})),l){let i=null;try{i=n(Object(function(){var e=new Error("Cannot find module 'osx-temperature-sensor'");throw e.code="MODULE_NOT_FOUND",e}()))}catch(e){i=null}i&&(r=i.cpuTemperature()),e&&e(r),t(r)}if(m&&(e&&e(r),t(r)),p)try{a.wmic("/namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature").then(((n,i)=>{if(!i){let e=0;n.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(t){let n=(parseInt(t,10)-2732)/10;e+=n,n>r.max&&(r.max=n),r.cores.push(n)})),r.cores.length&&(r.main=e/r.cores.length)}e&&e(r),t(r)}))}catch(n){e&&e(r),t(r)}}))}))},t.cpuFlags=C,t.cpuCache=x,t.currentLoad=function(e){return new Promise((t=>{process.nextTick((()=>{new Promise((e=>{process.nextTick((()=>{let t=r.loadavg().map((function(e){return e/a.cores()})),n=parseFloat(Math.max.apply(Math,t).toFixed(2)),i={};if(Date.now()-v.ms>=200){v.ms=Date.now();const e=r.cpus();let t=0,o=0,s=0,a=0,c=0,u=[];_=e&&e.length?e.length:0;for(let n=0;n<_;n++){const r=e[n].times;t+=r.user,o+=r.sys,s+=r.nice,c+=r.idle,a+=r.irq;let i=y&&y[n]&&y[n].totalTick?y[n].totalTick:0,l=y&&y[n]&&y[n].totalLoad?y[n].totalLoad:0,p=y&&y[n]&&y[n].user?y[n].user:0,f=y&&y[n]&&y[n].sys?y[n].sys:0,d=y&&y[n]&&y[n].nice?y[n].nice:0,h=y&&y[n]&&y[n].idle?y[n].idle:0,m=y&&y[n]&&y[n].irq?y[n].irq:0;y[n]=r,y[n].totalTick=y[n].user+y[n].sys+y[n].nice+y[n].irq+y[n].idle,y[n].totalLoad=y[n].user+y[n].sys+y[n].nice+y[n].irq,y[n].currentTick=y[n].totalTick-i,y[n].load=y[n].totalLoad-l,y[n].loadUser=y[n].user-p,y[n].loadSystem=y[n].sys-f,y[n].loadNice=y[n].nice-d,y[n].loadIdle=y[n].idle-h,y[n].loadIrq=y[n].irq-m,u[n]={},u[n].load=y[n].load/y[n].currentTick*100,u[n].loadUser=y[n].loadUser/y[n].currentTick*100,u[n].loadSystem=y[n].loadSystem/y[n].currentTick*100,u[n].loadNice=y[n].loadNice/y[n].currentTick*100,u[n].loadIdle=y[n].loadIdle/y[n].currentTick*100,u[n].loadIrq=y[n].loadIrq/y[n].currentTick*100,u[n].rawLoad=y[n].load,u[n].rawLoadUser=y[n].loadUser,u[n].rawLoadSystem=y[n].loadSystem,u[n].rawLoadNice=y[n].loadNice,u[n].rawLoadIdle=y[n].loadIdle,u[n].rawLoadIrq=y[n].loadIrq}let l=t+o+s+a+c,p=t+o+s+a,f=l-v.tick;i={avgLoad:n,currentLoad:(p-v.load)/f*100,currentLoadUser:(t-v.user)/f*100,currentLoadSystem:(o-v.system)/f*100,currentLoadNice:(s-v.nice)/f*100,currentLoadIdle:(c-v.idle)/f*100,currentLoadIrq:(a-v.irq)/f*100,rawCurrentLoad:p-v.load,rawCurrentLoadUser:t-v.user,rawCurrentLoadSystem:o-v.system,rawCurrentLoadNice:s-v.nice,rawCurrentLoadIdle:c-v.idle,rawCurrentLoadIrq:a-v.irq,cpus:u},v={user:t,nice:s,system:o,idle:c,irq:a,tick:l,load:p,ms:v.ms,currentLoad:i.currentLoad,currentLoadUser:i.currentLoadUser,currentLoadSystem:i.currentLoadSystem,currentLoadNice:i.currentLoadNice,currentLoadIdle:i.currentLoadIdle,currentLoadIrq:i.currentLoadIrq,rawCurrentLoad:i.rawCurrentLoad,rawCurrentLoadUser:i.rawCurrentLoadUser,rawCurrentLoadSystem:i.rawCurrentLoadSystem,rawCurrentLoadNice:i.rawCurrentLoadNice,rawCurrentLoadIdle:i.rawCurrentLoadIdle,rawCurrentLoadIrq:i.rawCurrentLoadIrq}}else{let e=[];for(let t=0;t<_;t++)e[t]={},e[t].load=y[t].load/y[t].currentTick*100,e[t].loadUser=y[t].loadUser/y[t].currentTick*100,e[t].loadSystem=y[t].loadSystem/y[t].currentTick*100,e[t].loadNice=y[t].loadNice/y[t].currentTick*100,e[t].loadIdle=y[t].loadIdle/y[t].currentTick*100,e[t].loadIrq=y[t].loadIrq/y[t].currentTick*100,e[t].rawLoad=y[t].load,e[t].rawLoadUser=y[t].loadUser,e[t].rawLoadSystem=y[t].loadSystem,e[t].rawLoadNice=y[t].loadNice,e[t].rawLoadIdle=y[t].loadIdle,e[t].rawLoadIrq=y[t].loadIrq;i={avgLoad:n,currentload:v.currentload,currentloadUser:v.currentloadUser,currentloadSystem:v.currentloadSystem,currentloadNice:v.currentloadNice,currentloadIdle:v.currentloadIdle,currentloadIrq:v.currentloadIrq,rawCurrentload:v.rawCurrentload,rawCurrentloadUser:v.rawCurrentloadUser,rawCurrentloadSystem:v.rawCurrentloadSystem,rawCurrentloadNice:v.rawCurrentloadNice,rawCurrentloadIdle:v.rawCurrentloadIdle,rawCurrentloadIrq:v.rawCurrentloadIrq,cpus:e}}e(i)}))})).then((n=>{e&&e(n),t(n)}))}))}))},t.fullLoad=function(e){return new Promise((t=>{process.nextTick((()=>{new Promise((e=>{process.nextTick((()=>{const t=r.cpus();let n=0,i=0,o=0,s=0,a=0,c=0;if(t&&t.length){for(let e=0,r=t.length;e{e&&e(n),t(n)}))}))}))}},8725:(e,t,n)=>{"use strict";const r=n(1453),i=n(3568);const o="win32"===process.platform;let s,a={},c=0;function u(e,t){function n(e,t){return e.filter((e=>e.Id&&e.Id===t)).length>0}r.isFunction(e)&&!t&&(t=e,e=!1),"string"==typeof e&&"true"===e&&(e=!0),"boolean"!=typeof e&&void 0!==e&&(e=!1),e=e||!1;let o=[];return new Promise((c=>{process.nextTick((()=>{s||(s=new i);const u=[];s.listContainers(e,(e=>{let l={};try{if(l=e,l&&"[object Array]"===Object.prototype.toString.call(l)&&l.length>0){for(let e in a)({}).hasOwnProperty.call(a,e)&&(n(l,e)||delete a[e]);l.forEach((function(e){var t,n;e.Names&&"[object Array]"===Object.prototype.toString.call(e.Names)&&e.Names.length>0&&(e.Name=e.Names[0].replace(/^\/|\/$/g,"")),u.push((t=e.Id.trim(),n=e,new Promise((e=>{process.nextTick((()=>{"string"!=typeof(t=t||"")&&e();const o=(r.isPrototypePolluted()?"":r.sanitizeShellString(t,!0)).trim();o?(s||(s=new i),s.getInspect(o.trim(),(t=>{try{e({id:n.Id,name:n.Name,image:n.Image,imageID:n.ImageID,command:n.Command,created:n.Created,started:t.State&&t.State.StartedAt?Math.round(new Date(t.State.StartedAt).getTime()/1e3):0,finished:t.State&&t.State.FinishedAt&&!t.State.FinishedAt.startsWith("0001-01-01")?Math.round(new Date(t.State.FinishedAt).getTime()/1e3):0,createdAt:t.Created?t.Created:"",startedAt:t.State&&t.State.StartedAt?t.State.StartedAt:"",finishedAt:t.State&&t.State.FinishedAt&&!t.State.FinishedAt.startsWith("0001-01-01")?t.State.FinishedAt:"",state:n.State,restartCount:t.RestartCount||0,platform:t.Platform||"",driver:t.Driver||"",ports:n.Ports,mounts:n.Mounts})}catch(t){e()}}))):e()}))}))))})),u.length?Promise.all(u).then((e=>{t&&t(e),c(e)})):(t&&t(o),c(o))}else t&&t(o),c(o)}catch(e){for(let e in a)({}).hasOwnProperty.call(a,e)&&(n(l,e)||delete a[e]);t&&t(o),c(o)}}))}))}))}function l(e,t){let n=[];return new Promise((i=>{process.nextTick((()=>{if(r.isFunction(e)&&!t)t=e,n=["*"];else{if("string"!=typeof(e=e||"*"))return t&&t([]),i([]);let o="";if(o.__proto__.toLowerCase=r.stringToLower,o.__proto__.replace=r.stringReplace,o.__proto__.trim=r.stringTrim,o=e,o=o.trim(),"*"!==o){o="";const t=(r.isPrototypePolluted()?"":r.sanitizeShellString(e,!0)).trim();for(let e=0;e<=r.mathMin(t.length,2e3);e++)if(void 0!==t[e]){t[e].__proto__.toLowerCase=r.stringToLower;const n=t[e].toLowerCase();n&&n[0]&&!n[1]&&(o+=n[0])}}o=o.trim().toLowerCase().replace(/,+/g,"|"),n=o.split("|")}const o=[],s=[];if(n.length&&"*"===n[0].trim())n=[],u().then((e=>{for(let t of e)n.push(t.id);n.length?l(n.join(",")).then((e=>{t&&t(e),i(e)})):(t&&t(o),i(o))}));else{for(let e of n)s.push(p(e.trim()));s.length?Promise.all(s).then((e=>{t&&t(e),i(e)})):(t&&t(o),i(o))}}))}))}function p(e){let t={id:e=e||"",memUsage:0,memLimit:0,memPercent:0,cpuPercent:0,pids:0,netIO:{rx:0,wx:0},blockIO:{r:0,w:0}};return new Promise((n=>{process.nextTick((()=>{e?(s||(s=new i),s.getInspect(e,(i=>{try{s.getStats(e,(e=>{try{let n=e;n.message||(t.memUsage=n.memory_stats&&n.memory_stats.usage?n.memory_stats.usage:0,t.memLimit=n.memory_stats&&n.memory_stats.limit?n.memory_stats.limit:0,t.memPercent=n.memory_stats&&n.memory_stats.usage&&n.memory_stats.limit?n.memory_stats.usage/n.memory_stats.limit*100:0,t.cpuPercent=n.cpu_stats&&n.precpu_stats?function(e,t){if(o){let n=r.nanoSeconds(),i=0;if(c>0){let r=n-c,o=e.cpu_usage.total_usage-t.cpu_usage.total_usage;r>0&&(i=100*o/r)}return c=n,i}{let n=0,r=e.cpu_usage.total_usage-t.cpu_usage.total_usage,i=e.system_cpu_usage-t.system_cpu_usage;return i>0&&r>0&&(n=r/i*e.cpu_usage.percpu_usage.length*100),n}}(n.cpu_stats,n.precpu_stats):0,t.pids=n.pids_stats&&n.pids_stats.current?n.pids_stats.current:0,t.restartCount=i.RestartCount?i.RestartCount:0,n.networks&&(t.netIO=function(e){let t,n;for(let r in e){if(!{}.hasOwnProperty.call(e,r))continue;let i=e[r];t=+i.rx_bytes,n=+i.tx_bytes}return{rx:t,wx:n}}(n.networks)),n.blkio_stats&&(t.blockIO=function(e){let t={r:0,w:0};return e&&e.io_service_bytes_recursive&&"[object Array]"===Object.prototype.toString.call(e.io_service_bytes_recursive)&&e.io_service_bytes_recursive.length>0&&e.io_service_bytes_recursive.forEach((function(e){e.op&&"read"===e.op.toLowerCase()&&e.value&&(t.r+=e.value),e.op&&"write"===e.op.toLowerCase()&&e.value&&(t.w+=e.value)})),t}(n.blkio_stats)),t.cpuStats=n.cpu_stats?n.cpu_stats:{},t.precpuStats=n.precpu_stats?n.precpu_stats:{},t.memoryStats=n.memory_stats?n.memory_stats:{},t.networks=n.networks?n.networks:{})}catch(e){r.noop()}n(t)}))}catch(e){r.noop()}}))):n(t)}))}))}function f(e,t){let n=[];return new Promise((o=>{process.nextTick((()=>{"string"!=typeof(e=e||"")&&o(n);const a=(r.isPrototypePolluted()?"":r.sanitizeShellString(e,!0)).trim();a?(s||(s=new i),s.getProcesses(a,(e=>{try{if(e&&e.Titles&&e.Processes){let t=e.Titles.map((function(e){return e.toUpperCase()})),r=t.indexOf("PID"),i=t.indexOf("PPID"),o=t.indexOf("PGID"),s=t.indexOf("VSZ"),a=t.indexOf("TIME"),c=t.indexOf("ELAPSED"),u=t.indexOf("NI"),l=t.indexOf("RUSER"),p=t.indexOf("USER"),f=t.indexOf("RGROUP"),d=t.indexOf("GROUP"),h=t.indexOf("STAT"),m=t.indexOf("RSS"),g=t.indexOf("COMMAND");e.Processes.forEach((e=>{n.push({pidHost:r>=0?e[r]:"",ppid:i>=0?e[i]:"",pgid:o>=0?e[o]:"",user:p>=0?e[p]:"",ruser:l>=0?e[l]:"",group:d>=0?e[d]:"",rgroup:f>=0?e[f]:"",stat:h>=0?e[h]:"",time:a>=0?e[a]:"",elapsed:c>=0?e[c]:"",nice:u>=0?e[u]:"",rss:m>=0?e[m]:"",vsz:s>=0?e[s]:"",command:g>=0?e[g]:""})}))}}catch(e){r.noop()}t&&t(n),o(n)}))):(t&&t(n),o(n))}))}))}t.dockerInfo=function(e){return new Promise((t=>{process.nextTick((()=>{s||(s=new i);const n={};s.getInfo((r=>{n.id=r.ID,n.containers=r.Containers,n.containersRunning=r.ContainersRunning,n.containersPaused=r.ContainersPaused,n.containersStopped=r.ContainersStopped,n.images=r.Images,n.driver=r.Driver,n.memoryLimit=r.MemoryLimit,n.swapLimit=r.SwapLimit,n.kernelMemory=r.KernelMemory,n.cpuCfsPeriod=r.CpuCfsPeriod,n.cpuCfsQuota=r.CpuCfsQuota,n.cpuShares=r.CPUShares,n.cpuSet=r.CPUSet,n.ipv4Forwarding=r.IPv4Forwarding,n.bridgeNfIptables=r.BridgeNfIptables,n.bridgeNfIp6tables=r.BridgeNfIp6tables,n.debug=r.Debug,n.nfd=r.NFd,n.oomKillDisable=r.OomKillDisable,n.ngoroutines=r.NGoroutines,n.systemTime=r.SystemTime,n.loggingDriver=r.LoggingDriver,n.cgroupDriver=r.CgroupDriver,n.nEventsListener=r.NEventsListener,n.kernelVersion=r.KernelVersion,n.operatingSystem=r.OperatingSystem,n.osType=r.OSType,n.architecture=r.Architecture,n.ncpu=r.NCPU,n.memTotal=r.MemTotal,n.dockerRootDir=r.DockerRootDir,n.httpProxy=r.HttpProxy,n.httpsProxy=r.HttpsProxy,n.noProxy=r.NoProxy,n.name=r.Name,n.labels=r.Labels,n.experimentalBuild=r.ExperimentalBuild,n.serverVersion=r.ServerVersion,n.clusterStore=r.ClusterStore,n.clusterAdvertise=r.ClusterAdvertise,n.defaultRuntime=r.DefaultRuntime,n.liveRestoreEnabled=r.LiveRestoreEnabled,n.isolation=r.Isolation,n.initBinary=r.InitBinary,n.productLicense=r.ProductLicense,e&&e(n),t(n)}))}))}))},t.dockerImages=function(e,t){r.isFunction(e)&&!t&&(t=e,e=!1),"string"==typeof e&&"true"===e&&(e=!0),"boolean"!=typeof e&&void 0!==e&&(e=!1),e=e||!1;let n=[];return new Promise((o=>{process.nextTick((()=>{s||(s=new i);const a=[];s.listImages(e,(e=>{let c={};try{c=e,c&&"[object Array]"===Object.prototype.toString.call(c)&&c.length>0?(c.forEach((function(e){var t,n;e.Names&&"[object Array]"===Object.prototype.toString.call(e.Names)&&e.Names.length>0&&(e.Name=e.Names[0].replace(/^\/|\/$/g,"")),a.push((t=e.Id.trim(),n=e,new Promise((e=>{process.nextTick((()=>{"string"!=typeof(t=t||"")&&e();const o=(r.isPrototypePolluted()?"":r.sanitizeShellString(t,!0)).trim();o?(s||(s=new i),s.inspectImage(o.trim(),(t=>{try{e({id:n.Id,container:t.Container,comment:t.Comment,os:t.Os,architecture:t.Architecture,parent:t.Parent,dockerVersion:t.DockerVersion,size:t.Size,sharedSize:n.SharedSize,virtualSize:t.VirtualSize,author:t.Author,created:t.Created?Math.round(new Date(t.Created).getTime()/1e3):0,containerConfig:t.ContainerConfig?t.ContainerConfig:{},graphDriver:t.GraphDriver?t.GraphDriver:{},repoDigests:t.RepoDigests?t.RepoDigests:{},repoTags:t.RepoTags?t.RepoTags:{},config:t.Config?t.Config:{},rootFS:t.RootFS?t.RootFS:{}})}catch(t){e()}}))):e()}))}))))})),a.length?Promise.all(a).then((e=>{t&&t(e),o(e)})):(t&&t(n),o(n))):(t&&t(n),o(n))}catch(e){t&&t(n),o(n)}}))}))}))},t.dockerContainers=u,t.dockerContainerStats=l,t.dockerContainerProcesses=f,t.dockerVolumes=function(e){let t=[];return new Promise((n=>{process.nextTick((()=>{s||(s=new i),s.listVolumes((r=>{let i={};try{i=r,i&&i.Volumes&&"[object Array]"===Object.prototype.toString.call(i.Volumes)&&i.Volumes.length>0?(i.Volumes.forEach((function(e){t.push({name:e.Name,driver:e.Driver,labels:e.Labels,mountpoint:e.Mountpoint,options:e.Options,scope:e.Scope,created:e.CreatedAt?Math.round(new Date(e.CreatedAt).getTime()/1e3):0})})),e&&e(t),n(t)):(e&&e(t),n(t))}catch(r){e&&e(t),n(t)}}))}))}))},t.dockerAll=function(e){return new Promise((t=>{process.nextTick((()=>{u(!0).then((n=>{if(n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0){let r=n.length;n.forEach((function(i){l(i.id).then((o=>{i.memUsage=o[0].memUsage,i.memLimit=o[0].memLimit,i.memPercent=o[0].memPercent,i.cpuPercent=o[0].cpuPercent,i.pids=o[0].pids,i.netIO=o[0].netIO,i.blockIO=o[0].blockIO,i.cpuStats=o[0].cpuStats,i.precpuStats=o[0].precpuStats,i.memoryStats=o[0].memoryStats,i.networks=o[0].networks,f(i.id).then((o=>{i.processes=o,r-=1,0===r&&(e&&e(n),t(n))}))}))}))}else e&&e(n),t(n)}))}))}))}},3568:(e,t,n)=>{"use strict";const r=n(1631),i="Windows_NT"===n(2087).type()?"//./pipe/docker_engine":"/var/run/docker.sock";e.exports=class{getInfo(e){try{let t,n=r.createConnection({path:i}),o="";n.on("connect",(()=>{n.write("GET http:/info HTTP/1.0\r\n\r\n")})),n.on("data",(e=>{o+=e.toString()})),n.on("error",(()=>{n=!1,e({})})),n.on("end",(()=>{let r=o.indexOf("\r\n\r\n");o=o.substring(r+4),n=!1;try{t=JSON.parse(o),e(t)}catch(t){e({})}}))}catch(t){e({})}}listImages(e,t){try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/images/json"+(e?"?all=1":"")+" HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}}inspectImage(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/images/"+e+"/json?stream=0 HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}listContainers(e,t){try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/json"+(e?"?all=1":"")+" HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}}getStats(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/"+e+"/stats?stream=0 HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}getInspect(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/"+e+"/json?stream=0 HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}getProcesses(e,t){if(e=e||"")try{let n,o=r.createConnection({path:i}),s="";o.on("connect",(()=>{o.write("GET http:/containers/"+e+"/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n")})),o.on("data",(e=>{s+=e.toString()})),o.on("error",(()=>{o=!1,t({})})),o.on("end",(()=>{let e=s.indexOf("\r\n\r\n");s=s.substring(e+4),o=!1;try{n=JSON.parse(s),t(n)}catch(e){t({})}}))}catch(e){t({})}else t({})}listVolumes(e){try{let t,n=r.createConnection({path:i}),o="";n.on("connect",(()=>{n.write("GET http:/volumes HTTP/1.0\r\n\r\n")})),n.on("data",(e=>{o+=e.toString()})),n.on("error",(()=>{n=!1,e({})})),n.on("end",(()=>{let r=o.indexOf("\r\n\r\n");o=o.substring(r+4),n=!1;try{t=JSON.parse(o),e(t)}catch(t){e({})}}))}catch(t){e({})}}}},2683:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(3129).execSync,o=n(1453),s=n(5747);let a=process.platform;const c="linux"===a,u="darwin"===a,l="win32"===a,p="freebsd"===a,f="openbsd"===a,d="netbsd"===a,h="sunos"===a;let m={},g={};function v(e){let t=[],n=0;return e.forEach((e=>{if(e.length>0)if("*"===e[0])n++;else{let i=e.split(":");i.length>1&&(t[n]||(t[n]={name:"",identifier:"",type:"disk",fsType:"",mount:"",size:0,physical:"HDD",uuid:"",label:"",model:"",serial:"",removable:!1,protocol:""}),i[0]=i[0].trim().toUpperCase().replace(/ +/g,""),i[1]=i[1].trim(),"DEVICEIDENTIFIER"===i[0]&&(t[n].identifier=i[1]),"DEVICENODE"===i[0]&&(t[n].name=i[1]),"VOLUMENAME"===i[0]&&-1===i[1].indexOf("Not applicable")&&(t[n].label=i[1]),"PROTOCOL"===i[0]&&(t[n].protocol=i[1]),"DISKSIZE"===i[0]&&(t[n].size=(r=i[1],parseInt(r.substr(r.indexOf(" (")+2,r.indexOf(" Bytes)")-10)))),"FILESYSTEMPERSONALITY"===i[0]&&(t[n].fsType=i[1]),"MOUNTPOINT"===i[0]&&(t[n].mount=i[1]),"VOLUMEUUID"===i[0]&&(t[n].uuid=i[1]),"READ-ONLYMEDIA"===i[0]&&"Yes"===i[1]&&(t[n].physical="CD/DVD"),"SOLIDSTATE"===i[0]&&"Yes"===i[1]&&(t[n].physical="SSD"),"VIRTUAL"===i[0]&&(t[n].type="virtual"),"REMOVABLEMEDIA"===i[0]&&(t[n].removable="Removable"===i[1]),"PARTITIONTYPE"===i[0]&&(t[n].type="part"),"DEVICE/MEDIANAME"===i[0]&&(t[n].model=i[1]))}var r})),t}function y(e){let t=[];return e.filter((e=>""!==e)).forEach((e=>{try{e=(e=decodeURIComponent(e.replace(/\\x/g,"%"))).replace(/\\/g,"\\\\");let n=JSON.parse(e);t.push({name:n.name,type:n.type,fsType:n.fsType,mount:n.mountpoint,size:parseInt(n.size),physical:"disk"===n.type?"0"===n.rota?"SSD":"HDD":"rom"===n.type?"CD/DVD":"",uuid:n.uuid,label:n.label,model:n.model,serial:n.serial,removable:"1"===n.rm,protocol:n.tran,group:n.group})}catch(e){o.noop()}})),t=o.unique(t),t=o.sortByKey(t,["type","name"]),t}function _(e){return e.toString().replace(/NAME=/g,'{"name":').replace(/FSTYPE=/g,',"fsType":').replace(/TYPE=/g,',"type":').replace(/SIZE=/g,',"size":').replace(/MOUNTPOINT=/g,',"mountpoint":').replace(/UUID=/g,',"uuid":').replace(/ROTA=/g,',"rota":').replace(/RO=/g,',"ro":').replace(/RM=/g,',"rm":').replace(/TRAN=/g,',"tran":').replace(/SERIAL=/g,',"serial":').replace(/LABEL=/g,',"label":').replace(/MODEL=/g,',"model":').replace(/OWNER=/g,',"owner":').replace(/GROUP=/g,',"group":').replace(/\n/g,"}\n")}function E(e,t){let n={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0};return m&&m.ms?(n.rx=e,n.wx=t,n.tx=n.rx+n.wx,n.ms=Date.now()-m.ms,n.rx_sec=(n.rx-m.bytes_read)/(n.ms/1e3),n.wx_sec=(n.wx-m.bytes_write)/(n.ms/1e3),n.tx_sec=n.rx_sec+n.wx_sec,m.rx_sec=n.rx_sec,m.wx_sec=n.wx_sec,m.tx_sec=n.tx_sec,m.bytes_read=n.rx,m.bytes_write=n.wx,m.bytes_overall=n.rx+n.wx,m.ms=Date.now(),m.last_ms=n.ms):(n.rx=e,n.wx=t,n.tx=n.rx+n.wx,m.rx_sec=null,m.wx_sec=null,m.tx_sec=null,m.bytes_read=n.rx,m.bytes_write=n.wx,m.bytes_overall=n.rx+n.wx,m.ms=Date.now(),m.last_ms=0),n}function b(e,t){let n={rIO:0,wIO:0,tIO:0,rIO_sec:null,wIO_sec:null,tIO_sec:null,ms:0};return g&&g.ms?(n.rIO=e,n.wIO=t,n.tIO=e+t,n.ms=Date.now()-g.ms,n.rIO_sec=(n.rIO-g.rIO)/(n.ms/1e3),n.wIO_sec=(n.wIO-g.wIO)/(n.ms/1e3),n.tIO_sec=n.rIO_sec+n.wIO_sec,g.rIO=e,g.wIO=t,g.rIO_sec=n.rIO_sec,g.wIO_sec=n.wIO_sec,g.tIO_sec=n.tIO_sec,g.last_ms=n.ms,g.ms=Date.now()):(n.rIO=e,n.wIO=t,n.tIO=e+t,g.rIO=e,g.wIO=t,g.rIO_sec=null,g.wIO_sec=null,g.tIO_sec=null,g.last_ms=0,g.ms=Date.now()),n}t.fsSize=function(e){let t=[];function n(e){let n=[];return e.forEach((function(e){if(""!==e&&(e=e.replace(/ +/g," ").split(" "))&&(e[0].startsWith("/")||e[6]&&"/"===e[6]||e[0].indexOf("/")>0||1===e[0].indexOf(":"))){const r=e[0],i=c||p||f||d?e[1]:function(e){if(!e.startsWith("/"))return"NFS";const n=e.split("/"),r=n[n.length-1],i=t.filter((e=>e.indexOf(r)>=0));return 1===i.length&&i[0].indexOf("APFS")>=0?"APFS":"HFS"}(e[0]),o=1024*parseInt(c||p||f||d?e[2]:e[1]),s=1024*parseInt(c||p||f||d?e[3]:e[2]),a=1024*parseInt(c||p||f||d?e[4]:e[3]),u=parseFloat((s/(s+a)*100).toFixed(2));e.splice(0,c||p||f||d?6:5);const l=e.join(" ");n.find((e=>e.fs===r&&e.type===i))||n.push({fs:r,type:i,size:o,used:s,available:a,use:u,mount:l})}})),n}return new Promise((s=>{process.nextTick((()=>{let a=[];if(c||p||f||d||u){let o="";if(u){o="df -kP";try{t=i("diskutil list").toString().split("\n").filter((e=>!e.startsWith("/")&&e.indexOf(":")>0))}catch(e){t=[]}}c&&(o='df -lkPTx squashfs | grep -E "^/|^.\\:"'),(p||f||d)&&(o="df -lkPT"),r(o,(function(t,i){if(t)r("df -kPT",(function(t,r){if(!t){let e=r.toString().split("\n");a=n(e)}e&&e(a),s(a)}));else{let t=i.toString().split("\n");a=n(t),e&&e(a),s(a)}}))}if(h&&(e&&e(a),s(a)),l)try{o.wmic("logicaldisk get Caption,FileSystem,FreeSpace,Size").then((t=>{t.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(e){""!==e&&(e=e.trim().split(/\s\s+/)).length>=4&&parseInt(e[3],10)&&a.push({fs:e[0],type:e[1],size:parseInt(e[3],10),used:parseInt(e[3],10)-parseInt(e[2],10),available:parseInt(e[2],10),use:parseFloat((100*(parseInt(e[3])-parseInt(e[2]))/parseInt(e[3])).toFixed(2)),mount:e[0]})})),e&&e(a),s(a)}))}catch(t){e&&e(a),s(a)}}))}))},t.fsOpenFiles=function(e){return new Promise((t=>{process.nextTick((()=>{const n={max:null,allocated:null,available:null};if(p||f||d||u){r("sysctl -a | grep 'kern.*files'",(function(r,i){if(!r){let e=i.toString().split("\n");n.max=parseInt(o.getValue(e,"kern.maxfiles",":"),10),n.allocated=parseInt(o.getValue(e,"kern.num_files",":"),10),n.available=n.max-n.allocated}e&&e(n),t(n)}))}c&&s.readFile("/proc/sys/fs/file-nr",(function(r,i){if(r)s.readFile("/proc/sys/fs/file-max",(function(r,i){if(!r){let e=i.toString().split("\n");e[0]&&(n.max=parseInt(e[0],10))}e&&e(n),t(n)}));else{let r=i.toString().split("\n");if(r[0]){const e=r[0].replace(/\s+/g," ").split(" ");3===e.length&&(n.allocated=parseInt(e[0],10),n.available=parseInt(e[1],10),n.max=parseInt(e[2],10),n.available||(n.available=n.max-n.allocated))}e&&e(n),t(n)}})),h&&(e&&e(null),t(null)),l&&(e&&e(null),t(null))}))}))},t.blockDevices=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(c&&r("lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null",(function(i,o){if(i)r("lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null",(function(r,i){if(!r){let e=_(i).split("\n");n=y(e)}e&&e(n),t(n)}));else{let r=_(o).split("\n");n=y(r),e&&e(n),t(n)}})),u&&r("diskutil info -all",(function(r,i){if(!r){let e=i.toString().split("\n");n=v(e)}e&&e(n),t(n)})),h&&(e&&e(n),t(n)),l){let r=["Unknown","NoRoot","Removable","Local","Network","CD/DVD","RAM"];try{o.wmic("logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value").then(((i,s)=>{if(!s){i.toString().split(/\n\s*\n/).forEach((function(e){let t=e.split("\r\n"),i=o.getValue(t,"drivetype","=");i&&n.push({name:o.getValue(t,"name","="),identifier:o.getValue(t,"caption","="),type:"disk",fsType:o.getValue(t,"filesystem","=").toLowerCase(),mount:o.getValue(t,"caption","="),size:o.getValue(t,"size","="),physical:i>=0&&i<=6?r[i]:r[0],uuid:o.getValue(t,"volumeserialnumber","="),label:o.getValue(t,"volumename","="),model:"",serial:o.getValue(t,"volumeserialnumber","="),removable:"2"===i,protocol:""})}))}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}(p||f||d)&&(e&&e(null),t(null))}))}))},t.fsStats=function(e){return new Promise((t=>{process.nextTick((()=>{l&&t(null);let n={rx:0,wx:0,tx:0,rx_sec:null,wx_sec:null,tx_sec:null,ms:0},i=0,o=0;m&&!m.ms||m&&m.ms&&Date.now()-m.ms>=500?(c&&r("lsblk -r 2>/dev/null | grep /",(function(s,a){if(s)e&&e(n),t(n);else{let s=a.toString().split("\n"),c=[];s.forEach((function(e){""!==e&&(e=e.trim().split(" "),-1===c.indexOf(e[0])&&c.push(e[0]))}));let u=c.join("|");r('cat /proc/diskstats | egrep "'+u+'"',(function(r,s){if(!r){s.toString().split("\n").forEach((function(e){""!==(e=e.trim())&&(e=e.replace(/ +/g," ").split(" "),i+=512*parseInt(e[5]),o+=512*parseInt(e[9]))})),n=E(i,o)}e&&e(n),t(n)}))}})),u&&r('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"',(function(r,s){if(!r){s.toString().split("\n").forEach((function(e){""!==(e=e.trim())&&(e=e.split(","),i+=parseInt(e[2]),o+=parseInt(e[9]))})),n=E(i,o)}e&&e(n),t(n)}))):(n.ms=m.last_ms,n.rx=m.bytes_read,n.wx=m.bytes_write,n.tx=m.bytes_read+m.bytes_write,n.rx_sec=m.rx_sec,n.wx_sec=m.wx_sec,n.tx_sec=m.tx_sec,e&&e(n),t(n))}))}))},t.disksIO=function(e){return new Promise((t=>{process.nextTick((()=>{l&&t(null),h&&t(null);let n={rIO:0,wIO:0,tIO:0,rIO_sec:null,wIO_sec:null,tIO_sec:null,ms:0},i=0,o=0;if(g&&!g.ms||g&&g.ms&&Date.now()-g.ms>=500){if(c||p||f||d){r('for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done',(function(r,s){if(r)e&&e(n),t(n);else{s.split("\n").forEach((function(e){if(!e)return;let t=e.split(";");i+=parseInt(t[0]),o+=parseInt(t[4])})),n=b(i,o),e&&e(n),t(n)}}))}u&&r('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"',(function(r,s){if(!r){s.toString().split("\n").forEach((function(e){""!==(e=e.trim())&&(e=e.split(","),i+=parseInt(e[10]),o+=parseInt(e[0]))})),n=b(i,o)}e&&e(n),t(n)}))}else n.rIO=g.rIO,n.wIO=g.wIO,n.tIO=g.rIO+g.wIO,n.ms=g.last_ms,n.rIO_sec=g.rIO_sec,n.wIO_sec=g.wIO_sec,n.tIO_sec=g.tIO_sec,e&&e(n),t(n)}))}))},t.diskLayout=function(e){function t(e){const t=[{pattern:"^WESTERN.+",manufacturer:"Western Digital"},{pattern:"^WDC.+",manufacturer:"Western Digital"},{pattern:"WD.+",manufacturer:"Western Digital"},{pattern:"^TOSHIBA.+",manufacturer:"Toshiba"},{pattern:"^HITACHI.+",manufacturer:"Hitachi"},{pattern:"^IC.+",manufacturer:"Hitachi"},{pattern:"^HTS.+",manufacturer:"Hitachi"},{pattern:"^SANDISK.+",manufacturer:"SanDisk"},{pattern:"^KINGSTON.+",manufacturer:"Kingston Technonogy"},{pattern:"^SONY.+",manufacturer:"Sony"},{pattern:"^TRANSCEND.+",manufacturer:"Transcend"},{pattern:"SAMSUNG.+",manufacturer:"Samsung"},{pattern:"^ST(?!I\\ ).+",manufacturer:"Seagate"},{pattern:"^STI\\ .+",manufacturer:"SimpleTech"},{pattern:"^D...-.+",manufacturer:"IBM"},{pattern:"^IBM.+",manufacturer:"IBM"},{pattern:"^FUJITSU.+",manufacturer:"Fujitsu"},{pattern:"^MP.+",manufacturer:"Fujitsu"},{pattern:"^MK.+",manufacturer:"Toshiba"},{pattern:"^MAXTOR.+",manufacturer:"Maxtor"},{pattern:"^Pioneer.+",manufacturer:"Pioneer"},{pattern:"^PHILIPS.+",manufacturer:"Philips"},{pattern:"^QUANTUM.+",manufacturer:"Quantum Technology"},{pattern:"FIREBALL.+",manufacturer:"Quantum Technology"},{pattern:"^VBOX.+",manufacturer:"VirtualBox"},{pattern:"CORSAIR.+",manufacturer:"Corsair Components"},{pattern:"CRUCIAL.+",manufacturer:"Crucial"},{pattern:"ECM.+",manufacturer:"ECM"},{pattern:"INTEL.+",manufacturer:"INTEL"},{pattern:".+EVO",manufacturer:"Samsung"},{pattern:"APPLE.+",manufacturer:"Apple"}];let n="";return e&&(e=e.toUpperCase(),t.forEach((t=>{RegExp(t.pattern).test(e)&&(n=t.manufacturer)}))),n}return new Promise((n=>{process.nextTick((()=>{const s=t=>{for(let e=0;e/dev/null; unset LC_ALL",(function(n,c){if(!n)try{const n=c.toString().trim();let r=[];try{const e=JSON.parse(n);e&&{}.hasOwnProperty.call(e,"blockdevices")&&(r=e.blockdevices.filter((e=>"disk"===e.type&&e.size>0&&(null!==e.model||null===e.mountpoint&&null===e.label&&null===e.fsType&&null===e.parttype))))}catch(e){let t=_(i("export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL").toString()).split("\n");r=y(t).filter((e=>"disk"===e.type&&e.size>0&&(null!==e.model&&""!==e.model||""===e.mount&&""===e.label&&""===e.fsType)))}r.forEach((n=>{let r="";const s="/dev/"+n.name,c=n.name;try{r=i("cat /sys/block/"+c+"/queue/rotational 2>/dev/null").toString().split("\n")[0]}catch(e){o.noop()}let u=n.tran?n.tran.toUpperCase().trim():"";"NVME"===u&&(r="2",u="PCIe"),a.push({device:s,type:"0"===r?"SSD":"1"===r?"HD":"2"===r?"NVMe":n.model&&n.model.indexOf("SSD")>-1?"SSD":n.model&&n.model.indexOf("NVM")>-1?"NVMe":"HD",name:n.model||"",vendor:t(n.model)||(n.vendor?n.vendor.trim():""),size:n.size||0,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:n.rev?n.rev.trim():"",serialNum:n.serial?n.serial.trim():"",interfaceType:u,smartStatus:"unknown",temperature:null,BSDName:s}),m+=`printf "\n${s}|"; smartctl -H ${s} | grep overall;`,e+=`${e?'printf ",";':""}smartctl -a -j ${s};`}))}catch(e){o.noop()}e?r(e,(function(e,t){try{JSON.parse(`[${t}]`).forEach((e=>{const t=e.smartctl.argv[e.smartctl.argv.length-1];for(let n=0;n{if(e){let t=e.split("|");if(2===t.length){let e=t[0];t[1]=t[1].trim();let n=t[1].split(":");if(2===n.length){n[1]=n[1].trim();let t=n[1].toLowerCase();for(let n=0;n{"NVMExpress:"===e?p="NVMe":"USB:"===e?p="USB":"SATA/SATA Express:"===e?p="SATA":"SATA"===p?c.push(e):"NVMe"===p?u.push(e):"USB"===p&&l.push(e)}));try{let e=c.join("\n").split(" Physical Interconnect: ");e.shift(),e.forEach((function(e){let n=(e="InterfaceType: "+e).split("\n");const r=o.getValue(n,"Medium Type",":",!0).trim(),i=o.getValue(n,"capacity",":",!0).trim(),s=o.getValue(n,"BSD Name",":",!0).trim();if(i){let e=0;if(i.indexOf("(")>=0&&(e=parseInt(i.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,""))),e||(e=parseInt(i)),e){const i=o.getValue(n,"S.M.A.R.T. status",":",!0).trim().toLowerCase();a.push({device:s,type:r.startsWith("Solid")?"SSD":"HD",name:o.getValue(n,"Model",":",!0).trim(),vendor:t(o.getValue(n,"Model",":",!0).trim())||o.getValue(n,"Manufacturer",":",!0),size:e,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:o.getValue(n,"Revision",":",!0).trim(),serialNum:o.getValue(n,"Serial Number",":",!0).trim(),interfaceType:o.getValue(n,"InterfaceType",":",!0).trim(),smartStatus:"verified"===i?"OK":i||"unknown",temperature:null,BSDName:s}),m=m+'printf "\n'+s+'|"; diskutil info /dev/'+s+" | grep SMART;"}}}))}catch(e){o.noop()}try{let e=u.join("\n").split("\n\n Capacity:");e.shift(),e.forEach((function(e){let n=(e="!Capacity: "+e).split("\n");const r=o.getValue(n,"link width",":",!0).trim(),i=o.getValue(n,"!capacity",":",!0).trim(),s=o.getValue(n,"BSD Name",":",!0).trim();if(i){let e=0;if(i.indexOf("(")>=0&&(e=parseInt(i.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,""))),e||(e=parseInt(i)),e){const i=o.getValue(n,"S.M.A.R.T. status",":",!0).trim().toLowerCase();a.push({device:s,type:"NVMe",name:o.getValue(n,"Model",":",!0).trim(),vendor:t(o.getValue(n,"Model",":",!0).trim()),size:e,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:o.getValue(n,"Revision",":",!0).trim(),serialNum:o.getValue(n,"Serial Number",":",!0).trim(),interfaceType:("PCIe "+r).trim(),smartStatus:"verified"===i?"OK":i||"unknown",temperature:null,BSDName:s}),m=m+'printf "\n'+s+'|"; diskutil info /dev/'+s+" | grep SMART;"}}}))}catch(e){o.noop()}try{let e=l.join("\n").replaceAll("Media:\n ","Model:").split("\n\n Product ID:");e.shift(),e.forEach((function(e){let n=e.split("\n");const r=o.getValue(n,"Capacity",":",!0).trim(),i=o.getValue(n,"BSD Name",":",!0).trim();if(r){let e=0;if(r.indexOf("(")>=0&&(e=parseInt(r.match(/\(([^)]+)\)/)[1].replace(/\./g,"").replace(/,/g,""))),e||(e=parseInt(r)),e){const r=o.getValue(n,"S.M.A.R.T. status",":",!0).trim().toLowerCase();a.push({device:i,type:"USB",name:o.getValue(n,"Model",":",!0).trim().replaceAll(":",""),vendor:t(o.getValue(n,"Model",":",!0).trim()),size:e,bytesPerSector:null,totalCylinders:null,totalHeads:null,totalSectors:null,totalTracks:null,tracksPerCylinder:null,sectorsPerTrack:null,firmwareRevision:o.getValue(n,"Revision",":",!0).trim(),serialNum:o.getValue(n,"Serial Number",":",!0).trim(),interfaceType:"USB",smartStatus:"verified"===r?"OK":r||"unknown",temperature:null,BSDName:i}),m=m+'printf "\n'+i+'|"; diskutil info /dev/'+i+" | grep SMART;"}}}))}catch(e){o.noop()}if(m)m+='printf "\n"',r(m,(function(t,r){r.toString().split("\n").forEach((e=>{if(e){let t=e.split("|");if(2===t.length){let e=t[0];t[1]=t[1].trim();let n=t[1].split(":");if(2===n.length){n[1]=n[1].trim();let t=n[1].toLowerCase();for(let n=0;n{t.toString().split(/\n\s*\n/).forEach((function(e){let t=e.split("\r\n");const n=o.getValue(t,"Size","=").trim(),r=o.getValue(t,"Status","=").trim().toLowerCase();n&&a.push({device:o.getValue(t,"PNPDeviceId","="),type:e.indexOf("SSD")>-1?"SSD":"HD",name:o.getValue(t,"Caption","="),vendor:o.getValue(t,"Manufacturer","="),size:parseInt(n),bytesPerSector:parseInt(o.getValue(t,"BytesPerSector","=")),totalCylinders:parseInt(o.getValue(t,"TotalCylinders","=")),totalHeads:parseInt(o.getValue(t,"TotalHeads","=")),totalSectors:parseInt(o.getValue(t,"TotalSectors","=")),totalTracks:parseInt(o.getValue(t,"TotalTracks","=")),tracksPerCylinder:parseInt(o.getValue(t,"TracksPerCylinder","=")),sectorsPerTrack:parseInt(o.getValue(t,"SectorsPerTrack","=")),firmwareRevision:o.getValue(t,"FirmwareRevision","=").trim(),serialNum:o.getValue(t,"SerialNumber","=").trim(),interfaceType:o.getValue(t,"InterfaceType","=").trim(),smartStatus:"ok"===r?"Ok":"degraded"===r?"Degraded":"pred fail"===r?"Predicted Failure":"Unknown",temperature:null})})),o.powerShell("Get-PhysicalDisk | Format-List").then((t=>{t.split(/\n\s*\n/).forEach((function(e){let t=e.split("\r\n");const n=o.getValue(t,"SerialNumber",":").trim(),r=o.getValue(t,"FriendlyName",":").trim().replace("Msft ","Microsoft"),i=o.getValue(t,"Size",":").trim(),s=o.getValue(t,"Model",":").trim(),c=o.getValue(t,"BusType",":").trim();let u=o.getValue(t,"MediaType",":").trim();if("3"!==u&&"HDD"!==u||(u="HD"),"4"===u&&(u="SSD"),"5"===u&&(u="SCM"),"Unspecified"===u&&(s.toLowerCase().indexOf("virtual")>-1||s.toLowerCase().indexOf("vbox")>-1)&&(u="Virtual"),i){let e=o.findObjectByKey(a,"serialNum",n);-1!==e&&""!==n||(e=o.findObjectByKey(a,"name",r)),-1!=e&&(a[e].type=u,a[e].interfaceType=c)}})),e&&e(a),n(a)})).catch((()=>{e&&e(a),n(a)}))}))}catch(t){e&&e(a),n(a)}}))}))}},559:(e,t,n)=>{"use strict";const r=n(2087),i=n(5747),o=n(3129).exec,s=n(3129).execSync,a=n(1453);let c=process.platform,u="";const l="linux"===c,p="darwin"===c,f="win32"===c,d="freebsd"===c,h="openbsd"===c,m="netbsd"===c,g="sunos"===c;let v=0,y=0,_=0,E=0;const b={"-2":"UNINITIALIZED","-1":"OTHER",0:"HD15",1:"SVIDEO",2:"Composite video",3:"Component video",4:"DVI",5:"HDMI",6:"LVDS",8:"D_JPN",9:"SDI",10:"DP",11:"DP embedded",12:"UDI",13:"UDI embedded",14:"SDTVDONGLE",15:"MIRACAST",2147483648:"INTERNAL"};t.graphics=function(e){function t(e){const t=function(){if(u)return u;if(f)try{const e=a.WINDIR+"\\System32\\DriverStore\\FileRepository",t=i.readdirSync(e).filter((t=>i.readdirSync([e,t].join("/")).includes("nvidia-smi.exe"))).reduce(((t,n)=>{const r=i.statSync([e,t,"nvidia-smi.exe"].join("/")),o=i.statSync([e,n,"nvidia-smi.exe"].join("/"));return r.ctimeMs>o.ctimeMs?t:n}));t&&(u=[e,t,"nvidia-smi.exe"].join("/"))}catch(e){a.noop()}else l&&(u="nvidia-smi");return u}();if(e=e||a.execOptsWin,t){const n=t+" "+"--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits"+(l?" 2>/dev/null":"");try{return s(n,e).toString()}catch(e){a.noop()}}return""}function n(){function e(e){return[null,void 0].includes(e)?e:parseFloat(e)}const n=t();if(!n)return[];return n.split("\n").filter(Boolean).map((t=>{const n=t.split(", ").map((e=>e.includes("N/A")?void 0:e));if(16===n.length)return{driverVersion:n[0],subDeviceId:n[1],name:n[2],pciBus:n[3],fanSpeed:e(n[4]),memoryTotal:e(n[5]),memoryUsed:e(n[6]),memoryFree:e(n[7]),utilizationGpu:e(n[8]),utilizationMemory:e(n[9]),temperatureGpu:e(n[10]),temperatureMemory:e(n[11]),powerDraw:e(n[12]),powerLimit:e(n[13]),clockCore:e(n[14]),clockMemory:e(n[15])}}))}function c(e,t){return t.driverVersion&&(e.driverVersion=t.driverVersion),t.subDeviceId&&(e.subDeviceId=t.subDeviceId),t.name&&(e.name=t.name),t.pciBus&&(e.pciBus=t.pciBus),t.fanSpeed&&(e.fanSpeed=t.fanSpeed),t.memoryTotal&&(e.memoryTotal=t.memoryTotal,e.vram=t.memoryTotal,e.vramDynamic=!1),t.memoryUsed&&(e.memoryUsed=t.memoryUsed),t.memoryFree&&(e.memoryFree=t.memoryFree),t.utilizationGpu&&(e.utilizationGpu=t.utilizationGpu),t.utilizationMemory&&(e.utilizationMemory=t.utilizationMemory),t.temperatureGpu&&(e.temperatureGpu=t.temperatureGpu),t.temperatureMemory&&(e.temperatureMemory=t.temperatureMemory),t.powerDraw&&(e.powerDraw=t.powerDraw),t.powerLimit&&(e.powerLimit=t.powerLimit),t.clockCore&&(e.clockCore=t.clockCore),t.clockMemory&&(e.clockMemory=t.clockMemory),e}function w(e){let t={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null},n=108;if("000000"===e.substr(n,6)&&(n+=36),"000000"===e.substr(n,6)&&(n+=36),"000000"===e.substr(n,6)&&(n+=36),"000000"===e.substr(n,6)&&(n+=36),t.resolutionX=parseInt("0x0"+e.substr(n+8,1)+e.substr(n+4,2)),t.resolutionY=parseInt("0x0"+e.substr(n+14,1)+e.substr(n+10,2)),t.sizeX=parseInt("0x0"+e.substr(n+28,1)+e.substr(n+24,2)),t.sizeY=parseInt("0x0"+e.substr(n+29,1)+e.substr(n+26,2)),n=e.indexOf("000000fc00"),n>=0){let r=e.substr(n+10,26);-1!==r.indexOf("0a")&&(r=r.substr(0,r.indexOf("0a")));try{r.length>2&&(t.model=r.match(/.{1,2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""))}catch(e){a.noop()}}else t.model="";return t}return new Promise((t=>{process.nextTick((()=>{let i={controllers:[],displays:[]};if(p){o("system_profiler SPDisplaysDataType",(function(n,r){if(!n){let e=r.toString().split("\n");i=function(e){let t=[],n=-1,r=-1,i=[],o=[],s={vendor:"",model:"",bus:"",vram:null,vramDynamic:!1},a={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null};for(let c=0;c0&&(i.push(s),s={vendor:"",model:"",bus:"",vram:null,vramDynamic:!1}),Object.keys(a).length>0&&(o.push(a),a={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null})),r=n;let l=e[c].split(":");if(2===n&&(l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("chipsetmodel")&&(s.model=l[1].trim()),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("vendor")&&(s.vendor=l[1].split("(")[0].trim()),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("vram(total)")&&(s.vram=parseInt(l[1]),-1!==l[1].toLowerCase().indexOf("gb")&&(s.vram=1024*s.vram),s.vramDynamic=!1),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("vram(dynamic,max)")&&(s.vram=parseInt(l[1]),-1!==l[1].toLowerCase().indexOf("gb")&&(s.vram=1024*s.vram),s.vramDynamic=!0),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("bus")&&(s.bus=l[1].trim(),"built-in"===s.bus.toLowerCase()&&(s.vramDynamic=!0))),3===n&&l.length>1&&""===l[1]&&(a.vendor="",a.model=l[0].trim(),a.main=!1,a.builtin=!1,a.connection="",a.sizeX=null,a.sizeY=null,a.positionX=0,a.positionY=0,a.pixelDepth=null),4===n){if(l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("resolution")){let e=l[1].split("x");a.resolutionX=e.length>1?parseInt(e[0]):0,a.resolutionY=e.length>1?parseInt(e[1]):0,a.currentResX=a.resolutionX,a.currentResY=a.resolutionY}l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("pixeldepth")&&(a.pixelDepth=parseInt(l[1])),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("framebufferdepth")&&(a.pixelDepth=parseInt(l[1])),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("maindisplay")&&"yes"===l[1].replace(/ +/g,"").toLowerCase()&&(a.main=!0),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("built-in")&&"yes"===l[1].replace(/ +/g,"").toLowerCase()&&(a.vendor="Apple",a.builtin=!0,a.connection=""),l.length>1&&-1!==l[0].replace(/ +/g,"").toLowerCase().indexOf("connectiontype")&&(a.builtin=!1,a.connection=l[1].trim(),"Internal"===a.connection&&(a.vendor="Apple",a.builtin=!0))}}return Object.keys(s).length>0&&i.push(s),Object.keys(a).length>0&&o.push(a),{controllers:i,displays:o}}(e)}e&&e(i),t(i)}))}if(l)if(a.isRaspberry()&&a.isRaspbian()){o("fbset -s | grep 'mode \"'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;",(function(n,r){let o=r.toString().split("\n");if(o.length>3&&o[0].indexOf('mode "')>=-1&&o[2].indexOf("0x12000a")>-1){const e=o[0].replace("mode","").replace(/"/g,"").trim().split("x");2===e.length&&i.displays.push({vendor:"",model:a.getValue(o,"device_name","="),main:!0,builtin:!1,connection:"HDMI",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:parseInt(e[0],10),resolutionY:parseInt(e[1],10),currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null})}o.length>1&&r.toString().indexOf("gpu=")>=-1&&i.controllers.push({vendor:"Broadcom",model:"VideoCore IV",bus:"",vram:a.getValue(o,"gpu","=").replace("M",""),vramDynamic:!0}),e&&e(i),t(i)}))}else{o("lspci -vvv 2>/dev/null",(function(r,u){if(!r){let e=u.toString().split("\n");i.controllers=function(e){let t=[],n={vendor:"",model:"",bus:"",busAddress:"",vram:null,vramDynamic:!1,pciID:""},r=!1,i=[];try{i=s('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "').toString().split("\n");for(let e=0;e=0,a=e[o].toLowerCase().indexOf(" vga "),c=e[o].toLowerCase().indexOf("3d controller");if(-1!==a||-1!==c){-1!==c&&-1===a&&(a=c),(n.vendor||n.model||n.bus||null!==n.vram||n.vramDynamic)&&(t.push(n),n={vendor:"",model:"",bus:"",busAddress:"",vram:null,vramDynamic:!1});const u=e[o].split(" ")[0];/[\da-fA-F]{2}:[\da-fA-F]{2}\.[\da-fA-F]/.test(u)&&(n.busAddress=u),r=!0;let l=e[o].search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/),p=e[o].substr(a,l-a).split(":");n.busAddress=e[o].substr(0,a).trim(),p.length>1&&(p[1]=p[1].trim(),p[1].toLowerCase().indexOf("corporation")>=0?(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf("corporation")+11).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf("corporation")+11,200).trim().split("(")[0],n.bus=i.length>0&&s?"PCIe":"Onboard",n.vram=null,n.vramDynamic=!1):p[1].toLowerCase().indexOf(" inc.")>=0?((p[1].match(new RegExp("]","g"))||[]).length>1?(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf("]")+1).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf("]")+1,200).trim().split("(")[0].trim()):(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf(" inc.")+5).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf(" inc.")+5,200).trim().split("(")[0].trim()),n.bus=i.length>0&&s?"PCIe":"Onboard",n.vram=null,n.vramDynamic=!1):p[1].toLowerCase().indexOf(" ltd.")>=0&&((p[1].match(new RegExp("]","g"))||[]).length>1?(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf("]")+1).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf("]")+1,200).trim().split("(")[0].trim()):(n.vendor=p[1].substr(0,p[1].toLowerCase().indexOf(" ltd.")+5).trim(),n.model=p[1].substr(p[1].toLowerCase().indexOf(" ltd.")+5,200).trim().split("(")[0].trim())))}else r=!1}if(r){let t=e[o].split(":");if(t.length>1&&-1!==t[0].replace(/ +/g,"").toLowerCase().indexOf("devicename")&&-1!==t[1].toLowerCase().indexOf("onboard")&&(n.bus="Onboard"),t.length>1&&-1!==t[0].replace(/ +/g,"").toLowerCase().indexOf("region")&&-1!==t[1].toLowerCase().indexOf("memory")){let e=t[1].split("=");e.length>1&&(n.vram=parseInt(e[1]))}}}return(n.vendor||n.model||n.bus||n.busAddress||null!==n.vram||n.vramDynamic)&&t.push(n),t}(e);const t=n();i.controllers=i.controllers.map((e=>c(e,t.find((({pciBus:t})=>t.toLowerCase().endsWith(e.busAddress.toLowerCase())))||{})))}o("clinfo --raw",(function(n,r){if(!n){let e=r.toString().split("\n");i.controllers=function(e,t){const n=/\[([^\]]+)\]\s+(\w+)\s+(.*)/,r=t.reduce(((e,t)=>{const r=n.exec(t.trim());return r&&(e[r[1]]||(e[r[1]]={}),e[r[1]][r[2]]=r[3]),e}),{});for(let t in r){const n=r[t];if("CL_DEVICE_TYPE_GPU"===n.CL_DEVICE_TYPE){let t;if(n.CL_DEVICE_TOPOLOGY_AMD){const e=n.CL_DEVICE_TOPOLOGY_AMD.match(/[a-zA-Z0-9]+:\d+\.\d+/);e&&(t=e[0])}else if(n.CL_DEVICE_PCI_BUS_ID_NV&&n.CL_DEVICE_PCI_SLOT_ID_NV){const e=parseInt(n.CL_DEVICE_PCI_BUS_ID_NV),r=parseInt(n.CL_DEVICE_PCI_SLOT_ID_NV);if(!isNaN(e)&&!isNaN(r)){const n=r>>3&255,i=7&r;t=`${(255&e).toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}.${i}`}}if(t){let r=e.find((e=>e.busAddress===t));r||(r={vendor:"",model:"",bus:"",busAddress:t,vram:null,vramDynamic:!1},e.push(r)),r.vendor=n.CL_DEVICE_VENDOR,n.CL_DEVICE_BOARD_NAME_AMD?r.model=n.CL_DEVICE_BOARD_NAME_AMD:r.model=n.CL_DEVICE_NAME;const i=parseInt(n.CL_DEVICE_GLOBAL_MEM_SIZE);isNaN(i)||(r.vram=Math.round(i/1024/1024))}}}return e}(i.controllers,e)}o("xdpyinfo 2>/dev/null | grep 'depth of root window' | awk '{ print $5 }'",(function(n,r){let s=0;if(!n){let e=r.toString().split("\n");s=parseInt(e[0])||0}o("xrandr --verbose 2>/dev/null",(function(n,r){if(!n){let e=r.toString().split("\n");i.displays=function(e,t){let n=[],r={vendor:"",model:"",deviceName:"",main:!1,builtin:!1,connection:"",sizeX:null,sizeY:null,pixelDepth:null,resolutionX:null,resolutionY:null,currentResX:null,currentResY:null,positionX:0,positionY:0,currentRefreshRate:null},i=!1,o=!1,s="",c=0;for(let u=1;u=0,r.builtin=t[0].toLowerCase().indexOf("edp")>=0}if(i)if(e[u].search(/\S|$/)>c)s+=e[u].toLowerCase().trim();else{let e=w(s);r.vendor=e.vendor,r.model=e.model,r.resolutionX=e.resolutionX,r.resolutionY=e.resolutionY,r.sizeX=e.sizeX,r.sizeY=e.sizeY,r.pixelDepth=t,i=!1}if(e[u].toLowerCase().indexOf("edid:")>=0&&(i=!0,c=e[u].search(/\S|$/)),e[u].toLowerCase().indexOf("*current")>=0){const t=e[u].split("(");if(t&&t.length>1&&t[0].indexOf("x")>=0){const e=t[0].trim().split("x");r.currentResX=a.toInt(e[0]),r.currentResY=a.toInt(e[1])}o=!0}if(o&&e[u].toLowerCase().indexOf("clock")>=0&&e[u].toLowerCase().indexOf("hz")>=0&&e[u].toLowerCase().indexOf("v: height")>=0){const t=e[u].split("clock");t&&t.length>1&&t[1].toLowerCase().indexOf("hz")>=0&&(r.currentRefreshRate=a.toInt(t[1])),o=!1}}return(r.model||r.main||r.builtin||r.connection||null!==r.sizeX||null!==r.pixelDepth||null!==r.resolutionX)&&n.push(r),n}(e,s)}e&&e(i),t(i)}))}))}))}))}if((d||h||m)&&(e&&e(null),t(null)),g&&(e&&e(null),t(null)),f)try{const o=[];o.push(a.wmic("path win32_VideoController get /value")),o.push(a.wmic("path win32_desktopmonitor get /value")),o.push(a.powerShell("Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl")),o.push(a.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens")),o.push(a.powerShell("Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl")),o.push(a.powerShell('gwmi WmiMonitorID -Namespace root\\wmi | ForEach-Object {(($_.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + $_.InstanceName}'));const s=n();Promise.all(o).then((n=>{let o=n[0].split(/\n\s*\n/);i.controllers=function(e){let t=[];for(let n in e)if({}.hasOwnProperty.call(e,n)&&""!==e[n].trim()){let r=e[n].trim().split("\r\n"),i=a.getValue(r,"PNPDeviceID","=").match(/SUBSYS_[a-fA-F\d]{8}/),o=null;i&&(o=i[0],o&&(o=o.split("_")[1])),t.push({vendor:a.getValue(r,"AdapterCompatibility","="),model:a.getValue(r,"name","="),bus:a.getValue(r,"PNPDeviceID","=").startsWith("PCI")?"PCI":"",vram:a.toInt(a.getValue(r,"AdapterRAM","="))/1024/1024,vramDynamic:"2"===a.getValue(r,"VideoMemoryType","="),subDeviceId:o}),v=a.toInt(a.getValue(r,"CurrentHorizontalResolution","="))||v,y=a.toInt(a.getValue(r,"CurrentVerticalResolution","="))||y,E=a.toInt(a.getValue(r,"CurrentRefreshRate","="))||E,_=a.toInt(a.getValue(r,"CurrentBitsPerPixel","="))||_}return t}(o),i.controllers=i.controllers.map((e=>"nvidia"===e.vendor.toLowerCase()?c(e,s.find((t=>{let n=e.subDeviceId.toLowerCase();const r=t.subDeviceId.split("x");let i=r.length>1?r[1].toLowerCase():r[0].toLowerCase();const o=Math.abs(n.length-i.length);if(n.length>i.length)for(let e=0;e{const t=e.split("|");5===t.length&&h.push({vendor:t[0],code:t[1],model:t[2],serial:t[3],instanceId:t[4]})})),i.displays=function(e,t,n,i,o){let s=[],c="",u="",l="",p=0,f=0;if(n&&n.length){let e=n[0].split(r.EOL);c=a.getValue(e,"MonitorManufacturer","="),u=a.getValue(e,"Name","="),l=a.getValue(e,"PNPDeviceID","=").replace(/&/g,"&").toLowerCase(),p=a.toInt(a.getValue(e,"ScreenWidth","=")),f=a.toInt(a.getValue(e,"ScreenHeight","="))}for(let n=0;n{e.instanceId.toLowerCase().startsWith(_)&&c.startsWith("(")&&u.startsWith("PnP")&&(S=e.vendor,I=e.model)})),s.push({vendor:_.startsWith(l)&&""===S?c:S,model:_.startsWith(l)&&""===I?u:I,deviceName:w,main:"true"===g.toLowerCase(),builtin:"2147483648"===E,connection:E&&b[E]?b[E]:"",resolutionX:a.toInt(a.getValue(m,"Width","=")),resolutionY:a.toInt(a.getValue(m,"Height","=")),sizeX:v?parseInt(v,10):null,sizeY:y?parseInt(y,10):null,pixelDepth:h,currentResX:a.toInt(a.getValue(m,"Width","=")),currentResY:a.toInt(a.getValue(m,"Height","=")),positionX:a.toInt(a.getValue(m,"X","=")),positionY:a.toInt(a.getValue(m,"Y","="))})}0===e.length&&s.push({vendor:c,model:u,main:!0,sizeX:null,sizeY:null,resolutionX:p,resolutionY:f,pixelDepth:null,currentResX:p,currentResY:f,positionX:0,positionY:0});return s}(p,l,u,f,h),1===i.displays.length&&(v&&(i.displays[0].resolutionX=v,i.displays[0].currentResX||(i.displays[0].currentResX=v)),y&&(i.displays[0].resolutionY=y,0===i.displays[0].currentResY&&(i.displays[0].currentResY=y)),_&&(i.displays[0].pixelDepth=_),E&&!i.displays[0].refreshRate&&(i.displays[0].currentRefreshRate=E)),e&&e(i),t(i)})).catch((()=>{e&&e(i),t(i)}))}catch(n){e&&e(i),t(i)}}))}))}},294:(e,t,n)=>{"use strict";const r=n(702).i8,i=n(1453),o=n(1617),s=n(6599),a=n(51),c=n(6144),u=n(5953),l=n(559),p=n(2683),f=n(6926),d=n(2023),h=n(1111),m=n(840),g=n(2795),v=n(8725),y=n(4869),_=n(8958),E=n(3932),b=n(7250),w=n(7381);let S=process.platform;const I="win32"===S,C="freebsd"===S,x="openbsd"===S,O="netbsd"===S,T="sunos"===S;function A(){return r}function N(e){return new Promise((t=>{process.nextTick((()=>{let n={};n.version=A(),Promise.all([o.system(),o.bios(),o.baseboard(),o.chassis(),s.osInfo(),s.uuid(),s.versions(),a.cpu(),a.cpuFlags(),l.graphics(),f.networkInterfaces(),c.memLayout(),p.diskLayout()]).then((r=>{n.system=r[0],n.bios=r[1],n.baseboard=r[2],n.chassis=r[3],n.os=r[4],n.uuid=r[5],n.versions=r[6],n.cpu=r[7],n.cpu.flags=r[8],n.graphics=r[9],n.net=r[10],n.memLayout=r[11],n.diskLayout=r[12],e&&e(n),t(n)}))}))}))}function P(e,t,n){return i.isFunction(t)&&(n=t,t=""),i.isFunction(e)&&(n=e,e=""),new Promise((r=>{process.nextTick((()=>{t=t||f.getDefaultNetworkInterface(),e=e||"";let i=function(){let e=15;return I&&(e=13),(C||x||O)&&(e=11),T&&(e=6),function(){0==--e&&(n&&n(o),r(o))}}(),o={};o.time=s.time(),o.node=process.versions.node,o.v8=process.versions.v8,a.cpuCurrentSpeed().then((e=>{o.cpuCurrentSpeed=e,i()})),m.users().then((e=>{o.users=e,i()})),h.processes().then((e=>{o.processes=e,i()})),a.currentLoad().then((e=>{o.currentLoad=e,i()})),T||a.cpuTemperature().then((e=>{o.temp=e,i()})),x||C||O||T||f.networkStats(t).then((e=>{o.networkStats=e,i()})),T||f.networkConnections().then((e=>{o.networkConnections=e,i()})),c.mem().then((e=>{o.mem=e,i()})),T||u().then((e=>{o.battery=e,i()})),T||h.services(e).then((e=>{o.services=e,i()})),T||p.fsSize().then((e=>{o.fsSize=e,i()})),I||x||C||O||T||p.fsStats().then((e=>{o.fsStats=e,i()})),I||x||C||O||T||p.disksIO().then((e=>{o.disksIO=e,i()})),x||C||O||T||d.wifiNetworks().then((e=>{o.wifiNetworks=e,i()})),g.inetLatency().then((e=>{o.inetLatency=e,i()}))}))}))}function L(e,n){return new Promise((r=>{process.nextTick((()=>{const i=Object.keys(e).filter((e=>({}.hasOwnProperty.call(t,e)))).map((n=>{const r=e[n].substring(e[n].lastIndexOf("(")+1,e[n].lastIndexOf(")"));let i=n.indexOf(")")>=0?n.split(")")[1].trim():n;return i=n.indexOf("|")>=0?n.split("|")[0].trim():i,r?t[i](r):t[i]("")}));Promise.all(i).then((i=>{const o={};let s=0;for(let n in e)if({}.hasOwnProperty.call(e,n)&&{}.hasOwnProperty.call(t,n)&&i.length>s){if("*"===e[n]||"all"===e[n])o[n]=i[s];else{let t=e[n],r="",a=[];if(t.indexOf(")")>=0&&(t=t.split(")")[1].trim()),t.indexOf("|")>=0&&(r=t.split("|")[1].trim(),a=r.split(":"),t=t.split("|")[0].trim()),t=t.replace(/,/g," ").replace(/ +/g," ").split(" "),i[s])if(Array.isArray(i[s])){const e=[];i[s].forEach((n=>{let i={};if(1!==t.length||"*"!==t[0]&&"all"!==t[0]?t.forEach((e=>{({}).hasOwnProperty.call(n,e)&&(i[e]=n[e])})):i=n,r&&2===a.length){if({}.hasOwnProperty.call(i,a[0].trim())){const t=i[a[0].trim()];"number"==typeof t?t===parseFloat(a[1].trim())&&e.push(i):"string"==typeof t&&t.toLowerCase()===a[1].trim().toLowerCase()&&e.push(i)}}else e.push(i)})),o[n]=e}else{const e={};t.forEach((t=>{({}).hasOwnProperty.call(i[s],t)&&(e[t]=i[s][t])})),o[n]=e}else o[n]={}}s++}n&&n(o),r(o)}))}))}))}I&&i.getCodepage(),t.version=A,t.system=o.system,t.bios=o.bios,t.baseboard=o.baseboard,t.chassis=o.chassis,t.time=s.time,t.osInfo=s.osInfo,t.versions=s.versions,t.shell=s.shell,t.uuid=s.uuid,t.cpu=a.cpu,t.cpuFlags=a.cpuFlags,t.cpuCache=a.cpuCache,t.cpuCurrentSpeed=a.cpuCurrentSpeed,t.cpuTemperature=a.cpuTemperature,t.currentLoad=a.currentLoad,t.fullLoad=a.fullLoad,t.mem=c.mem,t.memLayout=c.memLayout,t.battery=u,t.graphics=l.graphics,t.fsSize=p.fsSize,t.fsOpenFiles=p.fsOpenFiles,t.blockDevices=p.blockDevices,t.fsStats=p.fsStats,t.disksIO=p.disksIO,t.diskLayout=p.diskLayout,t.networkInterfaceDefault=f.networkInterfaceDefault,t.networkGatewayDefault=f.networkGatewayDefault,t.networkInterfaces=f.networkInterfaces,t.networkStats=f.networkStats,t.networkConnections=f.networkConnections,t.wifiNetworks=d.wifiNetworks,t.wifiInterfaces=d.wifiInterfaces,t.wifiConnections=d.wifiConnections,t.services=h.services,t.processes=h.processes,t.processLoad=h.processLoad,t.users=m.users,t.inetChecksite=g.inetChecksite,t.inetLatency=g.inetLatency,t.dockerInfo=v.dockerInfo,t.dockerImages=v.dockerImages,t.dockerContainers=v.dockerContainers,t.dockerContainerStats=v.dockerContainerStats,t.dockerContainerProcesses=v.dockerContainerProcesses,t.dockerVolumes=v.dockerVolumes,t.dockerAll=v.dockerAll,t.vboxInfo=y.vboxInfo,t.printer=_.printer,t.usb=E.usb,t.audio=b.audio,t.bluetoothDevices=w.bluetoothDevices,t.getStaticData=N,t.getDynamicData=P,t.getAllData=function(e,t,n){return new Promise((r=>{process.nextTick((()=>{let o={};t&&i.isFunction(t)&&!n&&(n=t,t=""),e&&i.isFunction(e)&&!t&&!n&&(n=e,e="",t=""),N().then((i=>{o=i,P(e,t).then((e=>{for(let t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t]);n&&n(o),r(o)}))}))}))}))},t.get=L,t.observe=function(e,t,n){let r=null;return setInterval((()=>{L(e).then((e=>{JSON.stringify(r)!==JSON.stringify(e)&&(r=Object.assign({},e),n(e))}))}),t)}},2795:(e,t,n)=>{"use strict";const r=n(1453);let i=process.platform;const o="linux"===i,s="darwin"===i,a="win32"===i,c="freebsd"===i,u="openbsd"===i,l="netbsd"===i,p="sunos"===i;t.inetChecksite=function(e,t){return new Promise((i=>{process.nextTick((()=>{let f={url:e,ok:!1,status:404,ms:null};if("string"!=typeof e)return t&&t(f),i(f);let d="";const h=r.sanitizeShellString(e,!0);for(let e=0;e<=r.mathMin(h.length,2e3);e++)if(void 0!==h[e]){h[e].__proto__.toLowerCase=r.stringToLower;const t=h[e].toLowerCase();t&&t[0]&&!t[1]&&1===t[0].length&&(d+=t[0])}f.url=d;try{if(d&&!r.isPrototypePolluted()){if(d.__proto__.startsWith=r.stringStartWith,d.startsWith("file:")||d.startsWith("gopher:")||d.startsWith("telnet:")||d.startsWith("mailto:")||d.startsWith("news:")||d.startsWith("nntp:"))return t&&t(f),i(f);let e=Date.now();if(o||c||u||l||s||p){let n=["-I","--connect-timeout","5","-m","5"];n.push(d);let o="curl";r.execSafe(o,n).then((n=>{const r=n.split("\n");let o=r[0]&&r[0].indexOf(" ")>=0?parseInt(r[0].split(" ")[1],10):404;f.status=o||404,f.ok=200===o||301===o||302===o||304===o,f.ms=f.ok?Date.now()-e:null,t&&t(f),i(f)}))}if(a){const r=d.startsWith("https:")?n(7211):n(8605);try{r.get(d,(n=>{const r=n.statusCode;f.status=r||404,f.ok=200===r||301===r||302===r||304===r,200!==r?(n.resume(),f.ms=f.ok?Date.now()-e:null,t&&t(f),i(f)):(n.on("data",(()=>{})),n.on("end",(()=>{f.ms=f.ok?Date.now()-e:null,t&&t(f),i(f)})))})).on("error",(()=>{t&&t(f),i(f)}))}catch(e){t&&t(f),i(f)}}}else t&&t(f),i(f)}catch(e){t&&t(f),i(f)}}))}))},t.inetLatency=function(e,t){return r.isFunction(e)&&!t&&(t=e,e=""),e=e||"8.8.8.8",new Promise((n=>{process.nextTick((()=>{if("string"!=typeof e)return t&&t(null),n(null);let i="";const f=(r.isPrototypePolluted()?"8.8.8.8":r.sanitizeShellString(e,!0)).trim();for(let e=0;e<=r.mathMin(f.length,2e3);e++)if(void 0!==f[e]){f[e].__proto__.toLowerCase=r.stringToLower;const t=f[e].toLowerCase();t&&t[0]&&!t[1]&&(i+=t[0])}if(i.__proto__.startsWith=r.stringStartWith,i.startsWith("file:")||i.startsWith("gopher:")||i.startsWith("telnet:")||i.startsWith("mailto:")||i.startsWith("news:")||i.startsWith("nntp:"))return t&&t(null),n(null);let d,h;if((o||c||u||l||s)&&(o&&(d=["-c","2","-w","3",i],h="rtt"),(c||u||l)&&(d=["-c","2","-t","3",i],h="round-trip"),s&&(d=["-c2","-t3",i],h="avg"),r.execSafe("ping",d).then((e=>{let r=null;if(e){const t=e.split("\n").filter((e=>e.indexOf(h)>=0)).join("\n").split("=");if(t.length>1){const e=t[1].split("/");e.length>1&&(r=parseFloat(e[1]))}}t&&t(r),n(r)}))),p){const e=["-s","-a",i,"56","2"],o="avg";r.execSafe("ping",e,{timeout:3e3}).then((e=>{let r=null;if(e){const t=e.split("\n").filter((e=>e.indexOf(o)>=0)).join("\n").split("=");if(t.length>1){const e=t[1].split("/");e.length>1&&(r=parseFloat(e[1].replace(",",".")))}}t&&t(r),n(r)}))}if(a){let e=null;try{const o=[i,"-n","1"];r.execSafe("ping",o,r.execOptsWin).then((r=>{if(r){let t=r.split("\r\n");t.shift(),t.forEach((function(t){if(3===(t.toLowerCase().match(/ms/g)||[]).length){let n=t.replace(/ +/g," ").split(" ");n.length>6&&(e=parseFloat(n[n.length-1]))}}))}t&&t(e),n(e)}))}catch(r){t&&t(e),n(e)}}}))}))}},6144:(e,t,n)=>{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(1453),a=n(5747);let c=process.platform;const u="linux"===c,l="darwin"===c,p="win32"===c,f="freebsd"===c,d="openbsd"===c,h="netbsd"===c,m="sunos"===c,g={"0x014F":"Transcend Information","0x2C00":"Micron Technology Inc.","0x802C":"Micron Technology Inc.","0x80AD":"Hynix Semiconductor Inc.","0x80CE":"Samsung Electronics Inc.","0xAD00":"Hynix Semiconductor Inc.","0xCE00":"Samsung Electronics Inc.","0x02FE":"Elpida","0x5105":"Qimonda AG i. In.","0x8551":"Qimonda AG i. In.","0x859B":"Crucial","0x04CD":"G-Skill"},v={"017A":"Apacer","0198":"HyperX","029E":"Corsair","04CB":"A-DATA","04CD":"G-Skill","059B":"Crucial","00CE":"Samsung",1315:"Crutial","014F":"Transcend Information","2C00":"Micron Technology Inc.","802C":"Micron Technology Inc.","80AD":"Hynix Semiconductor Inc.","80CE":"Samsung Electronics Inc.",AD00:"Hynix Semiconductor Inc.",CE00:"Samsung Electronics Inc.","02FE":"Elpida",5105:"Qimonda AG i. In.",8551:"Qimonda AG i. In.","859B":"Crucial"};t.mem=function(e){return new Promise((t=>{process.nextTick((()=>{let n={total:r.totalmem(),free:r.freemem(),used:r.totalmem()-r.freemem(),active:r.totalmem()-r.freemem(),available:r.freemem(),buffers:0,cached:0,slab:0,buffcache:0,swaptotal:0,swapused:0,swapfree:0};if(u&&a.readFile("/proc/meminfo",(function(i,o){if(!i){const e=o.toString().split("\n");n.total=parseInt(s.getValue(e,"memtotal"),10),n.total=n.total?1024*n.total:r.totalmem(),n.free=parseInt(s.getValue(e,"memfree"),10),n.free=n.free?1024*n.free:r.freemem(),n.used=n.total-n.free,n.buffers=parseInt(s.getValue(e,"buffers"),10),n.buffers=n.buffers?1024*n.buffers:0,n.cached=parseInt(s.getValue(e,"cached"),10),n.cached=n.cached?1024*n.cached:0,n.slab=parseInt(s.getValue(e,"slab"),10),n.slab=n.slab?1024*n.slab:0,n.buffcache=n.buffers+n.cached+n.slab;let t=parseInt(s.getValue(e,"memavailable"),10);n.available=t?1024*t:n.free+n.buffcache,n.active=n.total-n.available,n.swaptotal=parseInt(s.getValue(e,"swaptotal"),10),n.swaptotal=n.swaptotal?1024*n.swaptotal:0,n.swapfree=parseInt(s.getValue(e,"swapfree"),10),n.swapfree=n.swapfree?1024*n.swapfree:0,n.swapused=n.swaptotal-n.swapfree}e&&e(n),t(n)})),(f||d||h)&&i('/sbin/sysctl -a 2>/dev/null | grep -E "hw.realmem|hw.physmem|vm.stats.vm.v_page_count|vm.stats.vm.v_wire_count|vm.stats.vm.v_active_count|vm.stats.vm.v_inactive_count|vm.stats.vm.v_cache_count|vm.stats.vm.v_free_count|vm.stats.vm.v_page_size"',(function(r,i){if(!r){let e=i.toString().split("\n");const t=parseInt(s.getValue(e,"vm.stats.vm.v_page_size"),10),r=parseInt(s.getValue(e,"vm.stats.vm.v_inactive_count"),10)*t,o=parseInt(s.getValue(e,"vm.stats.vm.v_cache_count"),10)*t;n.total=parseInt(s.getValue(e,"hw.realmem"),10),isNaN(n.total)&&(n.total=parseInt(s.getValue(e,"hw.physmem"),10)),n.free=parseInt(s.getValue(e,"vm.stats.vm.v_free_count"),10)*t,n.buffcache=r+o,n.available=n.buffcache+n.free,n.active=n.total-n.free-n.buffcache,n.swaptotal=0,n.swapfree=0,n.swapused=0}e&&e(n),t(n)})),m&&(e&&e(n),t(n)),l&&i('vm_stat 2>/dev/null | grep "Pages active"',(function(r,o){if(!r){let e=o.toString().split("\n");n.active=4096*parseInt(e[0].split(":")[1],10),n.buffcache=n.used-n.active,n.available=n.free+n.buffcache}i("sysctl -n vm.swapusage 2>/dev/null",(function(r,i){if(!r){let e=i.toString().split("\n");if(e.length>0){let t=e[0].replace(/,/g,".").replace(/M/g,"");t=t.trim().split(" ");for(let e=0;e{if(!s){o.split("\r\n").filter((e=>""!==e.trim())).filter(((e,t)=>t>0)).forEach((function(e){""!==e&&(e=e.trim().split(/\s\s+/),r+=parseInt(e[0],10),i+=parseInt(e[1],10))}))}n.swaptotal=1024*r*1024,n.swapused=1024*i*1024,n.swapfree=n.swaptotal-n.swapused,e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}}))}))},t.memLayout=function(e){function t(e){const t=e.replace("0x","").toUpperCase();return 4===t.length&&{}.hasOwnProperty.call(v,t)?v[t]:e}return new Promise((n=>{process.nextTick((()=>{let a=[];if((u||f||d||h)&&i('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL',(function(i,c){if(!i){let e=c.toString().split("Memory Device");e.shift(),e.forEach((function(e){let n=e.split("\n");const r=s.getValue(n,"Size"),i=r.indexOf("GB")>=0?1024*parseInt(r,10)*1024*1024:1024*parseInt(r,10)*1024;if(parseInt(s.getValue(n,"Size"),10)>0){const e=s.toInt(s.getValue(n,"Total Width")),r=s.toInt(s.getValue(n,"Data Width"));a.push({size:i,bank:s.getValue(n,"Bank Locator"),type:s.getValue(n,"Type:"),ecc:!(!r||!e)&&e>r,clockSpeed:s.getValue(n,"Configured Clock Speed:")?parseInt(s.getValue(n,"Configured Clock Speed:"),10):s.getValue(n,"Speed:")?parseInt(s.getValue(n,"Speed:"),10):null,formFactor:s.getValue(n,"Form Factor:"),manufacturer:t(s.getValue(n,"Manufacturer:")),partNum:s.getValue(n,"Part Number:"),serialNum:s.getValue(n,"Serial Number:"),voltageConfigured:parseFloat(s.getValue(n,"Configured Voltage:")||null),voltageMin:parseFloat(s.getValue(n,"Minimum Voltage:")||null),voltageMax:parseFloat(s.getValue(n,"Maximum Voltage:")||null)})}else a.push({size:0,bank:s.getValue(n,"Bank Locator"),type:"Empty",ecc:null,clockSpeed:0,formFactor:s.getValue(n,"Form Factor:"),partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}))}if(!a.length){a.push({size:r.totalmem(),bank:"",type:"",ecc:null,clockSpeed:0,formFactor:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null});try{let e=o("cat /proc/cpuinfo 2>/dev/null"),t=e.toString().split("\n"),n=s.getValue(t,"hardware",":",!0).toUpperCase(),r=s.getValue(t,"revision",":",!0).toLowerCase();if("BCM2835"===n||"BCM2708"===n||"BCM2709"===n||"BCM2835"===n||"BCM2837"===n){const n={0:400,1:450,2:450,3:3200};a[0].type="LPDDR2",a[0].type=r&&r[2]&&"3"===r[2]?"LPDDR4":a[0].type,a[0].ecc=!1,a[0].clockSpeed=r&&r[2]&&n[r[2]]||400,a[0].clockSpeed=r&&r[4]&&"d"===r[4]?"500":a[0].clockSpeed,a[0].formFactor="SoC",e=o("vcgencmd get_config sdram_freq 2>/dev/null"),t=e.toString().split("\n");let i=parseInt(s.getValue(t,"sdram_freq","=",!0),10)||0;i&&(a.clockSpeed=i),e=o("vcgencmd measure_volts sdram_p 2>/dev/null"),t=e.toString().split("\n");let c=parseFloat(s.getValue(t,"volt","=",!0))||0;c&&(a[0].voltageConfigured=c,a[0].voltageMin=c,a[0].voltageMax=c)}}catch(e){s.noop()}}e&&e(a),n(a)})),l&&i("system_profiler SPMemoryDataType",(function(t,r){if(!t){const e=r.toString().split("\n"),t=s.getValue(e,"ecc",":",!0).toLowerCase();let n=r.toString().split(" BANK "),i=!0;1===n.length&&(n=r.toString().split(" DIMM"),i=!1),n.shift(),n.forEach((function(e){let n=e.split("\n");const r=(i?"BANK ":"DIMM")+n[0].trim().split("/")[0],o=parseInt(s.getValue(n," Size"));var c;o?a.push({size:1024*o*1024*1024,bank:r,type:s.getValue(n," Type:"),ecc:t?"enabled"===t:null,clockSpeed:parseInt(s.getValue(n," Speed:"),10),formFactor:"",manufacturer:(c=s.getValue(n," Manufacturer:"),{}.hasOwnProperty.call(g,c)?g[c]:c),partNum:s.getValue(n," Part Number:"),serialNum:s.getValue(n," Serial Number:"),voltageConfigured:null,voltageMin:null,voltageMax:null}):a.push({size:0,bank:r,type:"Empty",ecc:null,clockSpeed:0,formFactor:"",manufacturer:"",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}))}if(!a.length){const e=r.toString().split("\n"),t=parseInt(s.getValue(e," Memory:")),n=s.getValue(e," Type:");t&&n&&a.push({size:1024*t*1024*1024,bank:0,type:n,ecc:!1,clockSpeed:0,formFactor:"",manufacturer:"Apple",partNum:"",serialNum:"",voltageConfigured:null,voltageMin:null,voltageMax:null})}e&&e(a),n(a)})),m&&(e&&e(a),n(a)),p){const t="Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4".split("|"),r="Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA".split("|");try{s.wmic("memorychip get /value").then(((i,o)=>{if(!o){let e=i.toString().split("BankL");e.shift(),e.forEach((function(e){let n=e.split("\r\n");const i=s.toInt(s.getValue(n,"DataWidth","=")),o=s.toInt(s.getValue(n,"TotalWidth","="));a.push({size:parseInt(s.getValue(n,"Capacity","="),10)||0,bank:s.getValue(n,"abel","="),type:t[parseInt(s.getValue(n,"MemoryType","="),10)],ecc:!(!i||!o)&&o>i,clockSpeed:parseInt(s.getValue(n,"ConfiguredClockSpeed","="),10)||0,formFactor:r[parseInt(s.getValue(n,"FormFactor","="),10)||0],manufacturer:s.getValue(n,"Manufacturer","="),partNum:s.getValue(n,"PartNumber","="),serialNum:s.getValue(n,"SerialNumber","="),voltageConfigured:(parseInt(s.getValue(n,"ConfiguredVoltage","="),10)||0)/1e3,voltageMin:(parseInt(s.getValue(n,"MinVoltage","="),10)||0)/1e3,voltageMax:(parseInt(s.getValue(n,"MaxVoltage","="),10)||0)/1e3})}))}e&&e(a),n(a)}))}catch(t){e&&e(a),n(a)}}}))}))}},6926:(e,t,n)=>{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(5747),a=n(1453);let c=process.platform;const u="linux"===c,l="darwin"===c,p="win32"===c,f="freebsd"===c,d="openbsd"===c,h="netbsd"===c,m="sunos"===c;let g,v={},y="",_={},E=[],b=[],w={};function S(){let e=r.networkInterfaces(),t="",n="",i=9999;for(let r in e)({}).hasOwnProperty.call(e,r)&&e[r].forEach((function(e){e&&!1===e.internal&&(n=n||r,e.scopeid&&e.scopeid{if((e=e.replace(/\s+/g," ").trim()).indexOf("0.0.0.0 0.0.0.0")>-1&&!/[a-zA-Z]/.test(e)){const t=e.split(" ");t.length>=5&&(n=t[t.length-2])}})),n)for(let r in e)({}).hasOwnProperty.call(e,r)&&e[r].forEach((function(e){e&&e.address&&e.address===n&&(t=r)}))}if(u){let e=o("ip route 2> /dev/null | grep default").toString().split("\n")[0].split(/\s+/);"none"===e[0]&&e[5]?t=e[5]:e[4]&&(t=e[4]),t.indexOf(":")>-1&&(t=t.split(":")[1].trim())}if(l||f||d||h||m){let e="";u&&(e="ip route 2> /dev/null | grep default | awk '{print $5}'"),l&&(e="route -n get default 2>/dev/null | grep interface: | awk '{print $2}'"),(f||d||h||m)&&(e="route get 0.0.0.0 | grep interface:");let n=o(e);t=n.toString().split("\n")[0],t.indexOf(":")>-1&&(t=t.split(":")[1].trim())}}catch(e){a.noop()}return t&&(y=t),y}function I(){let e="",t="",n={};if(u||f||d||h){if(void 0===g)try{const e=o("which ip").toString().split("\n");g=e.length&&-1===e[0].indexOf(":")&&0===e[0].indexOf("/")?e[0]:""}catch(e){g=""}try{const r=o("export LC_ALL=C; "+(g?g+" link show up":"/sbin/ifconfig")+"; unset LC_ALL").toString().split("\n");for(let i=0;i0?e=r[i].split(":")[0]:0===r[i].indexOf("\tether ")&&(t=r[i].split("\tether ")[1],e&&t&&(n[e]=t.trim(),e="",t=""))}catch(e){a.noop()}return n}function C(){const e=a.getWmic()+" nic get MACAddress, name, NetConnectionId, NetEnabled, Speed, NetConnectionStatus, AdapterTypeId /value",t=a.getWmic()+" nicconfig get dhcpEnabled /value";try{const n=o(e,a.execOptsWin).split(/\n\s*\n/);return function(e,t){let n=[];for(let r in e)if({}.hasOwnProperty.call(e,r)&&""!==e[r].trim()){let i=e[r].trim().split("\r\n"),o=t[r].trim().split("\r\n"),s=a.getValue(i,"NetEnabled","="),c="9"===a.getValue(i,"AdapterTypeID","=")?"wireless":"wired",u=a.getValue(i,"Name","=").replace(/\]/g,")").replace(/\[/g,"("),l=a.getValue(i,"NetConnectionID","=").replace(/\]/g,")").replace(/\[/g,"(");if((u.toLowerCase().indexOf("wi-fi")>=0||u.toLowerCase().indexOf("wireless")>=0)&&(c="wireless"),""!==s){const e=parseInt(a.getValue(i,"speed","=").trim(),10)/1e6;n.push({mac:a.getValue(i,"MACAddress","=").toLowerCase(),dhcp:a.getValue(o,"dhcpEnabled","=").toLowerCase(),name:u,iface:l,netEnabled:"TRUE"===s,speed:isNaN(e)?null:e,operstate:"2"===a.getValue(i,"NetConnectionStatus","=")?"up":"down",type:c})}}return n}(n,o(t,a.execOptsWin).split(/\n\s*\n/))}catch(e){return[]}}function x(e,t){let n="";const r=t+".";try{const t=e.filter((e=>r.includes(e.name+"."))).map((e=>e.dnsSuffix));return t[0]&&(n=t[0]),n||(n=""),n}catch(e){return"Unknown"}}function O(e,t,n){let r={state:"Unknown",protocol:"Unknown"};if("Disabled"===n)return r.state="Disabled",r.protocol="Not defined",r;if("wired"==e&&n.length>0)try{const e=n.find((e=>e.includes(t+"\r\n"))).split("\r\n"),i=e.find((e=>e.includes("802.1x")));if(i.includes("Disabled"))r.state="Disabled",r.protocol="Not defined";else if(i.includes("Enabled")){const t=e.find((e=>e.includes("EAP")));r.protocol=t.split(":").pop(),r.state="Enabled"}}catch(e){return r}else if("wireless"==e){let e="",n="";try{const i=function(e){try{return o(`netsh wlan show interface name="${e}" | findstr "SSID"`,a.execOptsWin).split("\r\n").shift().split(":").pop()}catch(e){return"Unknown"}}(t);"Unknown"!==i&&(e=o(`netsh wlan show profiles "${i}" | findstr "802.1X"`,a.execOptsWin),n=o(`netsh wlan show profiles "${i}" | findstr "EAP"`,a.execOptsWin)),e.includes(":")&&n.includes(":")&&(r.state=e.split(":").pop(),r.protocol=n.split(":").pop())}catch(e){return 1===e.status&&e.stdout.includes("AutoConfig")&&(r.state="Disabled",r.protocol="Not defined"),r}}return r}function T(e){const t=[];let n=[];return e.forEach((function(e){e.startsWith("\t")||e.startsWith(" ")||n.length&&(t.push(n),n=[]),n.push(e)})),n.length&&t.push(n),t}function A(){try{const e=o("/sbin/ifconfig -v",{maxBuffer:2048e4}).toString().split("\n");return function(e){let t=[];return e.forEach((e=>{let n={iface:"",mtu:null,mac:"",ip6:"",ip4:"",speed:null,type:"",operstate:"",duplex:"",internal:!1};const r=e[0];n.iface=r.split(":")[0].trim();let i=r.split("> mtu");n.mtu=i.length>1?parseInt(i[1],10):null,isNaN(n.mtu)&&(n.mtu=null),n.internal=i[0].toLowerCase().indexOf("loopback")>-1,e.forEach((e=>{e.trim().startsWith("ether ")&&(n.mac=e.split("ether ")[1].toLowerCase().trim()),e.trim().startsWith("inet6 ")&&!n.ip6&&(n.ip6=e.split("inet6 ")[1].toLowerCase().split("%")[0].split(" ")[0]),e.trim().startsWith("inet ")&&!n.ip4&&(n.ip4=e.split("inet ")[1].toLowerCase().split(" ")[0])}));let o=a.getValue(e,"link rate");n.speed=o?parseFloat(o):null,null===n.speed?(o=a.getValue(e,"uplink rate"),n.speed=o?parseFloat(o):null,null!==n.speed&&o.toLowerCase().indexOf("gbps")>=0&&(n.speed=1e3*n.speed)):o.toLowerCase().indexOf("gbps")>=0&&(n.speed=1e3*n.speed),n.type=a.getValue(e,"type").toLowerCase().indexOf("wi-fi")>-1?"wireless":"wired",n.operstate=a.getValue(e,"status").toLowerCase().indexOf("active")>-1?"up":"down",n.duplex=a.getValue(e,"media").toLowerCase().indexOf("half-duplex")>-1?"half":"full",(n.ip6||n.ip4||n.mac)&&t.push(n)})),t}(T(e))}catch(e){return[]}}function N(e){const t=`nmcli device status 2>/dev/null | grep ${e}`;try{const e=o(t).toString().replace(/\s+/g," ").trim(),n=e.split(" ").slice(3).join(" ");return"--"!=n?n:""}catch(e){return""}}function P(e){let t=[];try{let n=`cat ${e} 2> /dev/null | grep 'iface\\|source'`;o(n,{maxBuffer:2048e4}).toString().split("\n").forEach((e=>{const n=e.replace(/\s+/g," ").trim().split(" ");if(n.length>=4&&e.toLowerCase().indexOf(" inet ")>=0&&e.toLowerCase().indexOf("dhcp")>=0&&t.push(n[1]),e.toLowerCase().includes("source")){let n=e.split(" ")[1];t=t.concat(P(n))}}))}catch(e){a.noop()}return t}function L(){let e=[];try{const t=o("ip a 2> /dev/null",{maxBuffer:2048e4}).toString().split("\n");e=function(e){const t=[];e&&e.length&&e.forEach((e=>{if(e&&e.length){if(e[0].split(":").length>2)for(let n of e)if(n.indexOf(" inet ")>=0&&n.indexOf(" dynamic ")>=0){const e=n.split(" "),r=e[e.length-1].trim();t.push(r);break}}}));return t}(T(t))}catch(e){a.noop()}try{e=P("/etc/network/interfaces")}catch(e){a.noop()}return e}function R(e,t,n){let r=!1;if(!t)return n.indexOf(e)>=0;{const i=`nmcli connection show "${t}" 2>/dev/null | grep ipv4.method;`;try{const e=o(i).toString();switch(e.replace(/\s+/g," ").trim().split(" ").slice(1).toString()){case"auto":r=!0;break;default:r=!1}return r}catch(t){return n.indexOf(e)>=0}}}function k(e){let t=!1;const n=`ipconfig getpacket "${e}" 2>/dev/null | grep lease_time;`;try{const e=o(n).toString().split("\n");e.length&&e[0].startsWith("lease_time")&&(t=!0)}catch(e){a.noop()}return t}function D(e){if(!e)return"Unknown";{const t=`nmcli connection show "${e}" 2>/dev/null | grep ipv4.dns-search;`;try{const e=o(t).toString(),n=e.replace(/\s+/g," ").trim().split(" ").slice(1).toString();return"--"==n?"Not defined":n}catch(e){return"Unknown"}}}function M(e){if(!e)return"Not defined";{const t=`nmcli connection show "${e}" 2>/dev/null | grep 802-1x.eap;`;try{const e=o(t).toString(),n=e.replace(/\s+/g," ").trim().split(" ").slice(1).toString();return"--"==n?"":n}catch(e){return"Not defined"}}}function V(e,t,n){return!!n&&(["00:00:00:00:00:00","00:03:FF","00:05:69","00:0C:29","00:0F:4B","00:0F:4B","00:13:07","00:13:BE","00:15:5d","00:16:3E","00:1C:42","00:21:F6","00:21:F6","00:24:0B","00:24:0B","00:50:56","00:A0:B1","00:E0:C8","08:00:27","0A:00:27","18:92:2C","16:DF:49","3C:F3:92","54:52:00","FC:15:97"].filter((e=>n.toUpperCase().toUpperCase().startsWith(e.substr(0,n.length)))).length>0||e.toLowerCase().indexOf(" virtual ")>-1||t.toLowerCase().indexOf(" virtual ")>-1||e.toLowerCase().indexOf("vethernet ")>-1||t.toLowerCase().indexOf("vethernet ")>-1||e.toLowerCase().startsWith("veth")||t.toLowerCase().startsWith("veth")||e.toLowerCase().startsWith("vboxnet")||t.toLowerCase().startsWith("vboxnet"))}function F(e,t=!0){return"boolean"==typeof e&&(t=e,e=null),new Promise((n=>{process.nextTick((()=>{let i=r.networkInterfaces(),s=[],c=[],m=[],g=[];if(l||f||d||h)c=A(),c.forEach((e=>{({}).hasOwnProperty.call(i,e.iface)&&i[e.iface].forEach((function(t){"IPv4"===t.family&&(e.ip4subnet=t.netmask),"IPv6"===t.family&&(e.ip6subnet=t.netmask)})),s.push({iface:e.iface,ifaceName:e.iface,ip4:e.ip4,ip4subnet:e.ip4subnet||"",ip6:e.ip6,ip6subnet:e.ip6subnet||"",mac:e.mac,internal:e.internal,virtual:!e.internal&&V(e.iface,e.iface,e.mac),operstate:e.operstate,type:e.type,duplex:e.duplex,mtu:e.mtu,speed:e.speed,dhcp:k(e.iface),dnsSuffix:"",ieee8021xAuth:"",ieee8021xState:"",carrierChanges:0})})),b=s,e&&e(s),n(s);else if(JSON.stringify(i)!==JSON.stringify(_)||t){_=Object.assign({},i),p&&(c=C(),c.forEach((e=>{let t=!1;Object.keys(i).forEach((n=>{t||i[n].forEach((n=>{Object.keys(n).indexOf("mac")>=0&&(t=n.mac===e.mac)}))})),t||(i[e.name]=[{mac:e.mac}])})),g=function(){try{return o("netsh lan show profiles",a.execOptsWin).split("\r\nProfile on interface")}catch(e){return 1===e.status&&e.stdout.includes("AutoConfig")?"Disabled":[]}}(),m=function(){let e={},t={primaryDNS:"",exitCode:0,ifaces:[]};try{return o("ipconfig /all",a.execOptsWin).split("\r\n\r\n").forEach(((n,r)=>{if(1==r){const e=n.split("\r\n").filter((e=>e.toUpperCase().includes("DNS"))),r=e[0].substring(e[0].lastIndexOf(":")+1);t.primaryDNS=r.trim(),t.primaryDNS||(t.primaryDNS="Not defined")}if(r>1)if(r%2==0){const t=n.substring(n.lastIndexOf(" ")+1).replace(":","");e.name=t}else{const r=n.split("\r\n").filter((e=>e.toUpperCase().includes("DNS"))),i=r[0].substring(r[0].lastIndexOf(":")+1);e.dnsSuffix=i.trim(),t.ifaces.push(e),e={}}})),t}catch(e){return{primaryDNS:"",exitCode:0,ifaces:[]}}}()),u&&(E=L());for(let e in i){let t=e,n="",r="",f="",d="",h="",y="",_="",b=null,S=0,C="down",T=!1,A="",P="",L="",k="";if({}.hasOwnProperty.call(i,e)){let F=e;if(i[e].forEach((function(t){"IPv4"===t.family&&(n=t.address,r=t.netmask),"IPv6"===t.family&&(f&&!f.match(/^fe80::/i)||(f=t.address,d=t.netmask)),h=t.mac;const i=parseInt(process.versions.node.split("."),10);h.indexOf("00:00:0")>-1&&(u||l)&&!t.internal&&i>=8&&i<=11&&(0===Object.keys(w).length&&(w=I()),h=w[e]||"")})),u){let t=e.split(":")[0].trim().toLowerCase();const n=`echo -n "addr_assign_type: "; cat /sys/class/net/${t}/addr_assign_type 2>/dev/null; echo;\n echo -n "address: "; cat /sys/class/net/${t}/address 2>/dev/null; echo;\n echo -n "addr_len: "; cat /sys/class/net/${t}/addr_len 2>/dev/null; echo;\n echo -n "broadcast: "; cat /sys/class/net/${t}/broadcast 2>/dev/null; echo;\n echo -n "carrier: "; cat /sys/class/net/${t}/carrier 2>/dev/null; echo;\n echo -n "carrier_changes: "; cat /sys/class/net/${t}/carrier_changes 2>/dev/null; echo;\n echo -n "dev_id: "; cat /sys/class/net/${t}/dev_id 2>/dev/null; echo;\n echo -n "dev_port: "; cat /sys/class/net/${t}/dev_port 2>/dev/null; echo;\n echo -n "dormant: "; cat /sys/class/net/${t}/dormant 2>/dev/null; echo;\n echo -n "duplex: "; cat /sys/class/net/${t}/duplex 2>/dev/null; echo;\n echo -n "flags: "; cat /sys/class/net/${t}/flags 2>/dev/null; echo;\n echo -n "gro_flush_timeout: "; cat /sys/class/net/${t}/gro_flush_timeout 2>/dev/null; echo;\n echo -n "ifalias: "; cat /sys/class/net/${t}/ifalias 2>/dev/null; echo;\n echo -n "ifindex: "; cat /sys/class/net/${t}/ifindex 2>/dev/null; echo;\n echo -n "iflink: "; cat /sys/class/net/${t}/iflink 2>/dev/null; echo;\n echo -n "link_mode: "; cat /sys/class/net/${t}/link_mode 2>/dev/null; echo;\n echo -n "mtu: "; cat /sys/class/net/${t}/mtu 2>/dev/null; echo;\n echo -n "netdev_group: "; cat /sys/class/net/${t}/netdev_group 2>/dev/null; echo;\n echo -n "operstate: "; cat /sys/class/net/${t}/operstate 2>/dev/null; echo;\n echo -n "proto_down: "; cat /sys/class/net/${t}/proto_down 2>/dev/null; echo;\n echo -n "speed: "; cat /sys/class/net/${t}/speed 2>/dev/null; echo;\n echo -n "tx_queue_len: "; cat /sys/class/net/${t}/tx_queue_len 2>/dev/null; echo;\n echo -n "type: "; cat /sys/class/net/${t}/type 2>/dev/null; echo;\n echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${t}; echo;\n echo -n "wirelessspeed: "; iw dev ${t} link 2>&1 | grep bitrate; echo;`;let r=[];try{r=o(n).toString().split("\n");const e=N(t);T=R(t,e,E),A=D(e),P=M(e),L=(v=P)?"Not defined"==v?"Disabled":"Enabled":"Unknown"}catch(e){a.noop()}y=a.getValue(r,"duplex"),y=y.startsWith("cat")?"":y,_=parseInt(a.getValue(r,"mtu"),10);let i=parseInt(a.getValue(r,"speed"),10);b=isNaN(i)?null:i;let s=a.getValue(r,"wirelessspeed").split("tx bitrate: ");null===b&&2===s.length&&(i=parseFloat(s[1]),b=isNaN(i)?null:i),S=parseInt(a.getValue(r,"carrier_changes"),10),C=a.getValue(r,"operstate"),k="up"===C?a.getValue(r,"wireless").trim()?"wireless":"wired":"unknown",("lo"===t||t.startsWith("bond"))&&(k="virtual")}if(p){A=x(m.ifaces,e);let n=!1;c.forEach((e=>{e.mac!==h||n||(t=e.iface||t,F=e.name,T=e.dhcp,C=e.operstate,b=e.speed,k=e.type,n=!0)})),(e.toLowerCase().indexOf("wlan")>=0||F.toLowerCase().indexOf("wlan")>=0||F.toLowerCase().indexOf("802.11n")>=0||F.toLowerCase().indexOf("wireless")>=0||F.toLowerCase().indexOf("wi-fi")>=0||F.toLowerCase().indexOf("wifi")>=0)&&(k="wireless");const r=O(k,e,g);P=r.protocol,L=r.state}let j=!(!i[e]||!i[e][0])&&i[e][0].internal;(e.toLowerCase().indexOf("loopback")>-1||F.toLowerCase().indexOf("loopback")>-1)&&(j=!0);const B=!j&&V(e,F,h);s.push({iface:t,ifaceName:F,ip4:n,ip4subnet:r,ip6:f,ip6subnet:d,mac:h,internal:j,virtual:B,operstate:C,type:k,duplex:y,mtu:_,speed:b,dhcp:T,dnsSuffix:A,ieee8021xAuth:P,ieee8021xState:L,carrierChanges:S})}}b=s,e&&e(s),n(s)}else s=b,e&&e(s),n(s);var v}))}))}function j(e,t,n,r,i,o,s,a){let c={iface:e,operstate:r,rx_bytes:t,rx_dropped:i,rx_errors:o,tx_bytes:n,tx_dropped:s,tx_errors:a,rx_sec:null,tx_sec:null,ms:0};return v[e]&&v[e].ms?(c.ms=Date.now()-v[e].ms,c.rx_sec=t-v[e].rx_bytes>=0?(t-v[e].rx_bytes)/(c.ms/1e3):0,c.tx_sec=n-v[e].tx_bytes>=0?(n-v[e].tx_bytes)/(c.ms/1e3):0,v[e].rx_bytes=t,v[e].tx_bytes=n,v[e].rx_sec=c.rx_sec,v[e].tx_sec=c.tx_sec,v[e].ms=Date.now(),v[e].last_ms=c.ms,v[e].operstate=r):(v[e]||(v[e]={}),v[e].rx_bytes=t,v[e].tx_bytes=n,v[e].rx_sec=null,v[e].tx_sec=null,v[e].ms=Date.now(),v[e].last_ms=0,v[e].operstate=r),c}function B(e){return new Promise((t=>{process.nextTick((()=>{let n="";const r=a.isPrototypePolluted()?"---":a.sanitizeShellString(e);for(let e=0;e<=a.mathMin(r.length,2e3);e++)void 0!==r[e]&&(n+=r[e]);let o,c,m,g={iface:n,operstate:"unknown",rx_bytes:0,rx_dropped:0,rx_errors:0,tx_bytes:0,tx_dropped:0,tx_errors:0,rx_sec:null,tx_sec:null,ms:0},y="unknown",_=0,E=0,b=0,w=0,S=0,I=0;if(!v[n]||v[n]&&!v[n].ms||v[n]&&v[n].ms&&Date.now()-v[n].ms>=500){if(u&&(s.existsSync("/sys/class/net/"+n)?(o="cat /sys/class/net/"+n+"/operstate; cat /sys/class/net/"+n+"/statistics/rx_bytes; cat /sys/class/net/"+n+"/statistics/tx_bytes; cat /sys/class/net/"+n+"/statistics/rx_dropped; cat /sys/class/net/"+n+"/statistics/rx_errors; cat /sys/class/net/"+n+"/statistics/tx_dropped; cat /sys/class/net/"+n+"/statistics/tx_errors; ",i(o,(function(e,r){e||(c=r.toString().split("\n"),y=c[0].trim(),_=parseInt(c[1],10),E=parseInt(c[2],10),b=parseInt(c[3],10),w=parseInt(c[4],10),S=parseInt(c[5],10),I=parseInt(c[6],10),g=j(n,_,E,y,b,w,S,I)),t(g)}))):t(g)),(f||d||h)&&(o="netstat -ibndI "+n,i(o,(function(e,r){if(!e){c=r.toString().split("\n");for(let e=1;e1&&""!==c[1].trim())){m=c[1].replace(/ +/g," ").split(" ");const e=m.length>11?1:0;_=parseInt(m[e+5]),b=parseInt(m[e+10]),w=parseInt(m[e+4]),E=parseInt(m[e+8]),S=parseInt(m[e+10]),I=parseInt(m[e+7]),g=j(n,_,E,g.operstate,b,w,S,I)}t(g)}))}))),p){let e=[],r=n;a.wmic("path Win32_PerfRawData_Tcpip_NetworkInterface Get name,BytesReceivedPersec,BytesSentPersec,BytesTotalPersec,PacketsOutboundDiscarded,PacketsOutboundErrors,PacketsReceivedDiscarded,PacketsReceivedErrors /value").then(((i,o)=>{if(!o){const t=i.toString().split(/\n\s*\n/);e=function(e){let t=[];for(let n in e)if({}.hasOwnProperty.call(e,n)&&""!==e[n].trim()){let r=e[n].trim().split("\r\n");t.push({name:a.getValue(r,"Name","=").replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase(),rx_bytes:parseInt(a.getValue(r,"BytesReceivedPersec","="),10),rx_errors:parseInt(a.getValue(r,"PacketsReceivedErrors","="),10),rx_dropped:parseInt(a.getValue(r,"PacketsReceivedDiscarded","="),10),tx_bytes:parseInt(a.getValue(r,"BytesSentPersec","="),10),tx_errors:parseInt(a.getValue(r,"PacketsOutboundErrors","="),10),tx_dropped:parseInt(a.getValue(r,"PacketsOutboundDiscarded","="),10)})}return t}(t)}F(!1).then((i=>{_=0,E=0,e.forEach((e=>{i.forEach((t=>{t.iface.toLowerCase()!==n.toLowerCase()&&t.mac.toLowerCase()!==n.toLowerCase()&&t.ip4.toLowerCase()!==n.toLowerCase()&&t.ip6.toLowerCase()!==n.toLowerCase()&&t.ifaceName.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase()!==n.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase()||t.ifaceName.replace(/[()[\] ]+/g,"").replace("#","_").toLowerCase()!==e.name||(r=t.iface,_=e.rx_bytes,b=e.rx_dropped,w=e.rx_errors,E=e.tx_bytes,S=e.tx_dropped,I=e.tx_errors,y=t.operstate)}))})),_&&E&&(g=j(r,parseInt(_),parseInt(E),y,b,w,S,I)),t(g)}))}))}}else g.rx_bytes=v[n].rx_bytes,g.tx_bytes=v[n].tx_bytes,g.rx_sec=v[n].rx_sec,g.tx_sec=v[n].tx_sec,g.ms=v[n].last_ms,g.operstate=v[n].operstate,t(g)}))}))}t.getDefaultNetworkInterface=S,t.networkInterfaceDefault=function(e){return new Promise((t=>{process.nextTick((()=>{let n=S();e&&e(n),t(n)}))}))},t.networkInterfaces=F,t.networkStats=function e(t,n){let r=[];return new Promise((i=>{process.nextTick((()=>{if(a.isFunction(t)&&!n)n=t,r=[S()];else{if("string"!=typeof t&&void 0!==t)return n&&n([]),i([]);(t=t||S()).__proto__.toLowerCase=a.stringToLower,t.__proto__.replace=a.stringReplace,t.__proto__.trim=a.stringTrim,t=t.trim().toLowerCase().replace(/,+/g,"|"),r=t.split("|")}const o=[],s=[];if(r.length&&"*"===r[0].trim())r=[],F(!1).then((t=>{for(let e of t)r.push(e.iface);e(r.join(",")).then((e=>{n&&n(e),i(e)}))}));else{for(let e of r)s.push(B(e.trim()));s.length?Promise.all(s).then((e=>{n&&n(e),i(e)})):(n&&n(o),i(o))}}))}))},t.networkConnections=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(u||f||d||h){let r='export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';(f||d||h)&&(r='export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'),i(r,{maxBuffer:2048e4},(function(o,s){let a=s.toString().split("\n");!o&&(a.length>1||""!=a[0])?(a.forEach((function(e){if((e=e.replace(/ +/g," ").split(" ")).length>=7){let t=e[3],r="",i=e[3].split(":");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join(":"));let o=e[4],s="",a=e[4].split(":");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join(":"));let c=e[5],u=e[6].split("/");c&&n.push({protocol:e[0],localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:c,pid:u[0]&&"-"!==u[0]?parseInt(u[0],10):null,process:u[1]?u[1].split(" ")[0]:""})}})),e&&e(n),t(n)):(r='ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"',i(r,{maxBuffer:2048e4},(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){if((e=e.replace(/ +/g," ").split(" ")).length>=6){let t=e[4],r="",i=e[4].split(":");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join(":"));let o=e[5],s="",a=e[5].split(":");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join(":"));let c=e[1];"ESTAB"===c&&(c="ESTABLISHED"),"TIME-WAIT"===c&&(c="TIME_WAIT");let u=null,l="";if(e.length>=7&&e[6].indexOf("users:")>-1){let t=e[6].replace('users:(("',"").replace(/"/g,"").split(",");t.length>2&&(l=t[0].split(" ")[0],u=parseInt(t[1],10))}c&&n.push({protocol:e[0],localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:c,pid:u,process:l})}}))}e&&e(n),t(n)})))}))}if(l){i('netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"',{maxBuffer:2048e4},(function(r,i){if(!r){i.toString().split("\n").forEach((function(e){if((e=e.replace(/ +/g," ").split(" ")).length>=8){let t=e[3],r="",i=e[3].split(".");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join("."));let o=e[4],s="",a=e[4].split(".");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join("."));let c=e[5],u=parseInt(e[8],10);c&&n.push({protocol:e[0],localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:c,pid:u,process:""})}})),e&&e(n),t(n)}}))}if(p){let r="netstat -nao";try{i(r,a.execOptsWin,(function(r,i){if(!r){i.toString().split("\r\n").forEach((function(e){if((e=e.trim().replace(/ +/g," ").split(" ")).length>=4){let t=e[1],r="",i=e[1].split(":");i.length>1&&(r=i[i.length-1],i.pop(),t=i.join(":"));let o=e[2],s="",a=e[2].split(":");a.length>1&&(s=a[a.length-1],a.pop(),o=a.join(":"));let c=e[4],u=e[3];"HERGESTELLT"===u&&(u="ESTABLISHED"),u.startsWith("ABH")&&(u="LISTEN"),"SCHLIESSEN_WARTEN"===u&&(u="CLOSE_WAIT"),"WARTEND"===u&&(u="TIME_WAIT"),"SYN_GESENDET"===u&&(u="SYN_SENT"),"LISTENING"===u&&(u="LISTEN"),"SYN_RECEIVED"===u&&(u="SYN_RECV"),"FIN_WAIT_1"===u&&(u="FIN_WAIT1"),"FIN_WAIT_2"===u&&(u="FIN_WAIT2"),u&&n.push({protocol:e[0].toLowerCase(),localAddress:t,localPort:r,peerAddress:o,peerPort:s,state:u,pid:c,process:""})}})),e&&e(n),t(n)}}))}catch(r){e&&e(n),t(n)}}}))}))},t.networkGatewayDefault=function(e){return new Promise((t=>{process.nextTick((()=>{let n="";if(u||f||d||h){let r="ip route get 1";try{i(r,{maxBuffer:2048e4},(function(r,i){if(r)e&&e(n),t(n);else{let r=i.toString().split("\n");let o=(r&&r[0]?r[0]:"").split(" via ");o&&o[1]&&(o=o[1].split(" "),n=o[0]),e&&e(n),t(n)}}))}catch(r){e&&e(n),t(n)}}if(l){let r="route -n get default";try{i(r,{maxBuffer:2048e4},(function(r,i){if(r)e&&e(n),t(n);else{let r=i.toString().split("\n").map((e=>e.trim()));n=a.getValue(r,"gateway"),e&&e(n),t(n)}}))}catch(r){e&&e(n),t(n)}}if(p)try{i("netstat -r",a.execOptsWin,(function(i,o){o.toString().split(r.EOL).forEach((e=>{if((e=e.replace(/\s+/g," ").trim()).indexOf("0.0.0.0 0.0.0.0")>-1&&!/[a-zA-Z]/.test(e)){const t=e.split(" ");t.length>=5&&t[t.length-3].indexOf(".")>-1&&(n=t[t.length-3])}})),n?(e&&e(n),t(n)):a.powerShell("Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq '0.0.0.0' -and $_.Mask -eq '0.0.0.0' }").then((r=>{let i=r.toString().split("\r\n");i.length>1&&!n&&(n=a.getValue(i,"NextHop"),e&&e(n),t(n))}))}))}catch(r){e&&e(n),t(n)}}))}))}},6599:(e,t,n)=>{"use strict";const r=n(2087),i=n(5747),o=n(1453),s=n(3129).exec,a=n(3129).execSync,c=o.promisify(n(3129).exec);let u=process.platform;const l="linux"===u,p="darwin"===u,f="win32"===u,d="freebsd"===u,h="openbsd"===u,m="netbsd"===u,g="sunos"===u;function v(e){e=(e=e||"").toLowerCase();let t=u;return f?t="windows":-1!==e.indexOf("mac os")?t="apple":-1!==e.indexOf("arch")?t="arch":-1!==e.indexOf("centos")?t="centos":-1!==e.indexOf("coreos")?t="coreos":-1!==e.indexOf("debian")?t="debian":-1!==e.indexOf("deepin")?t="deepin":-1!==e.indexOf("elementary")?t="elementary":-1!==e.indexOf("fedora")?t="fedora":-1!==e.indexOf("gentoo")?t="gentoo":-1!==e.indexOf("mageia")?t="mageia":-1!==e.indexOf("mandriva")?t="mandriva":-1!==e.indexOf("manjaro")?t="manjaro":-1!==e.indexOf("mint")?t="mint":-1!==e.indexOf("mx")?t="mx":-1!==e.indexOf("openbsd")?t="openbsd":-1!==e.indexOf("freebsd")?t="freebsd":-1!==e.indexOf("opensuse")?t="opensuse":-1!==e.indexOf("pclinuxos")?t="pclinuxos":-1!==e.indexOf("puppy")?t="puppy":-1!==e.indexOf("raspbian")?t="raspbian":-1!==e.indexOf("reactos")?t="reactos":-1!==e.indexOf("redhat")?t="redhat":-1!==e.indexOf("slackware")?t="slackware":-1!==e.indexOf("sugar")?t="sugar":-1!==e.indexOf("steam")?t="steam":-1!==e.indexOf("suse")?t="suse":-1!==e.indexOf("mate")?t="ubuntu-mate":-1!==e.indexOf("lubuntu")?t="lubuntu":-1!==e.indexOf("xubuntu")?t="xubuntu":-1!==e.indexOf("ubuntu")?t="ubuntu":-1!==e.indexOf("solaris")?t="solaris":-1!==e.indexOf("tails")?t="tails":-1!==e.indexOf("feren")?t="ferenos":-1!==e.indexOf("robolinux")?t="robolinux":l&&e&&(t=e.toLowerCase().trim().replace(/\s+/g,"-")),t}function y(){let e=r.hostname;if(l||p||d||h||m)try{e=a("hostname -f").toString().split(r.EOL)[0]}catch(e){o.noop()}if(f)try{e=a("echo %COMPUTERNAME%.%USERDNSDOMAIN%",o.execOptsWin).toString().replace(".%USERDNSDOMAIN%","").split(r.EOL)[0]}catch(e){o.noop()}return e}function _(){const e=r.networkInterfaces();let t=[];for(let n in e)({}).hasOwnProperty.call(e,n)&&e[n].forEach((function(e){if(e&&e.mac&&"00:00:00:00:00:00"!==e.mac){const n=e.mac.toLowerCase();-1===t.indexOf(n)&&t.push(n)}}));return t=t.sort((function(e,t){return et?1:0})),t}function E(e){return new Promise((t=>{process.nextTick((()=>{let n,r={os:"",hardware:"",macs:_()};if(p&&s("system_profiler SPHardwareDataType -json",(function(n,i){if(!n)try{const e=JSON.parse(i.toString());if(e.SPHardwareDataType&&e.SPHardwareDataType.length>0){const t=e.SPHardwareDataType[0];r.os=t.platform_UUID.toLowerCase(),r.hardware=t.serial_number}}catch(e){o.noop()}e&&e(r),t(r)})),l){s('echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null; echo;\necho -n "os: "; cat /etc/machine-id 2> /dev/null; echo;\necho -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;',(function(n,s){const a=s.toString().split("\n");if(r.os=o.getValue(a,"os").toLowerCase(),r.hardware=o.getValue(a,"hardware").toLowerCase(),!r.hardware){const e=i.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split("\n"),t=o.getValue(e,"serial");r.hardware=t||""}e&&e(r),t(r)}))}if(d||h||m){s('echo -n "os: "; sysctl -n kern.hostid; echo;\necho -n "hardware: "; sysctl -n kern.hostuuid; echo;',(function(n,i){const s=i.toString().split("\n");r.os=o.getValue(s,"os").toLowerCase(),r.hardware=o.getValue(s,"hardware").toLowerCase(),r.os.indexOf("unknown")>=0&&(r.os=""),r.hardware.indexOf("unknown")>=0&&(r.hardware=""),e&&e(r),t(r)}))}f&&s('%windir%\\System32\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid',o.execOptsWin,(function(i,s){n=s.toString().split("\n\r")[0].split("REG_SZ"),r.os=n.length>1?n[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase():"",o.wmic("csproduct get /value").then((n=>{let i=n.split("\r\n");r.hardware=o.getValue(i,"uuid","=").toLowerCase(),e&&e(r),t(r)}))}))}))}))}t.time=function(){let e=(new Date).toString().split(" ");return{current:Date.now(),uptime:r.uptime(),timezone:e.length>=7?e[5]:"",timezoneName:e.length>=7?e.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}},t.osInfo=function(e){return new Promise((t=>{process.nextTick((()=>{let n={platform:"Windows_NT"===u?"Windows":u,distro:"unknown",release:"unknown",codename:"",kernel:r.release(),arch:r.arch(),hostname:r.hostname(),fqdn:y(),codepage:"",logofile:"",serial:"",build:"",servicepack:"",uefi:!1};if(l&&s("cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release",(function(r,a){let c={};a.toString().split("\n").forEach((function(e){-1!==e.indexOf("=")&&(c[e.split("=")[0].trim().toUpperCase()]=e.split("=")[1].trim())}));let u=(c.VERSION||"").replace(/"/g,""),l=(c.DISTRIB_CODENAME||c.VERSION_CODENAME||"").replace(/"/g,"");u.indexOf("(")>=0&&(l=u.split("(")[1].replace(/[()]/g,"").trim(),u=u.split("(")[0].trim()),n.distro=(c.DISTRIB_ID||c.NAME||"unknown").replace(/"/g,""),n.logofile=v(n.distro),n.release=(u||c.DISTRIB_RELEASE||c.VERSION_ID||"unknown").replace(/"/g,""),n.codename=l,n.codepage=o.getCodepage(),n.build=(c.BUILD_ID||"").replace(/"/g,"").trim(),new Promise((e=>{process.nextTick((()=>{i.stat("/sys/firmware/efi",(function(t){t?s('dmesg | grep -E "EFI v"',(function(t,n){if(!t){const t=n.toString().split("\n");e(t.length>0)}e(!1)})):e(!0)}))}))})).then((r=>{n.uefi=r,E().then((r=>{n.serial=r.os,e&&e(n),t(n)}))}))})),(d||h||m)&&s("sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod",(function(r,i){if(!r){let e=i.toString().split("\n");n.distro=o.getValue(e,"kern.ostype"),n.logofile=v(n.distro),n.release=o.getValue(e,"kern.osrelease").split("-")[0],n.serial=o.getValue(e,"kern.uuid"),n.codename="",n.codepage=o.getCodepage(),n.uefi=o.getValue(e,"machdep.bootmethod").toLowerCase().indexOf("uefi")>=0}e&&e(n),t(n)})),p&&s("sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid",(function(r,i){let s=i.toString().split("\n");n.serial=o.getValue(s,"kern.uuid"),n.distro=o.getValue(s,"ProductName"),n.release=o.getValue(s,"ProductVersion"),n.build=o.getValue(s,"BuildVersion"),n.logofile=v(n.distro),n.codename="macOS",n.codename=n.release.indexOf("10.4")>-1?"Mac OS X Tiger":n.codename,n.codename=n.release.indexOf("10.4")>-1?"Mac OS X Tiger":n.codename,n.codename=n.release.indexOf("10.4")>-1?"Mac OS X Tiger":n.codename,n.codename=n.release.indexOf("10.5")>-1?"Mac OS X Leopard":n.codename,n.codename=n.release.indexOf("10.6")>-1?"Mac OS X Snow Leopard":n.codename,n.codename=n.release.indexOf("10.7")>-1?"Mac OS X Lion":n.codename,n.codename=n.release.indexOf("10.8")>-1?"OS X Mountain Lion":n.codename,n.codename=n.release.indexOf("10.9")>-1?"OS X Mavericks":n.codename,n.codename=n.release.indexOf("10.10")>-1?"OS X Yosemite":n.codename,n.codename=n.release.indexOf("10.11")>-1?"OS X El Capitan":n.codename,n.codename=n.release.indexOf("10.12")>-1?"macOS Sierra":n.codename,n.codename=n.release.indexOf("10.13")>-1?"macOS High Sierra":n.codename,n.codename=n.release.indexOf("10.14")>-1?"macOS Mojave":n.codename,n.codename=n.release.indexOf("10.15")>-1?"macOS Catalina":n.codename,n.codename=n.release.startsWith("11.")?"macOS Big Sur":n.codename,n.uefi=!0,n.codepage=o.getCodepage(),e&&e(n),t(n)})),g&&(n.release=n.kernel,s("uname -o",(function(r,i){let o=i.toString().split("\n");n.distro=o[0],n.logofile=v(n.distro),e&&e(n),t(n)}))),f){n.logofile=v(),n.release=n.kernel;try{const r=[];r.push(o.wmic("os get /value")),r.push(c("systeminfo",o.execOptsWin)),r.push(o.powerShell("Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession")),o.promiseAll(r).then((r=>{let i=r.results[0]?r.results[0].toString().split("\r\n"):[""];n.distro=o.getValue(i,"Caption","=").trim(),n.serial=o.getValue(i,"SerialNumber","=").trim(),n.build=o.getValue(i,"BuildNumber","=").trim(),n.servicepack=o.getValue(i,"ServicePackMajorVersion","=").trim()+"."+o.getValue(i,"ServicePackMinorVersion","=").trim(),n.codepage=o.getCodepage();const a=r.results[1]?r.results[1].toString():"";n.hypervisor=-1!==a.indexOf("hypervisor has been detected")||-1!==a.indexOf("Es wurde ein Hypervisor erkannt")||-1!==a.indexOf("Un hyperviseur a ");const c=r.results[2]?r.results[2].toString():"";n.remoteSession=c.toString().toLowerCase().indexOf("true")>=0,new Promise((e=>{process.nextTick((()=>{try{s('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"',o.execOptsWin,(function(t,n){if(t)s("$env:firmware_type",o.execOptsWin,(function(t,n){if(!t){const t=n.toString()||"";e(t.toLowerCase().indexOf("uefi")>=0)}e(!1)})),e(!1);else{const t=n.toString().split("\n\r")[0];e(t.toLowerCase().indexOf("uefi")>=0)}}))}catch(t){e(!1)}}))})).then((r=>{n.uefi=r,e&&e(n),t(n)}))}))}catch(r){e&&e(n),t(n)}}}))}))},t.versions=function(e,t){let n={kernel:r.release(),openssl:"",systemOpenssl:"",systemOpensslLib:"",node:process.versions.node,v8:process.versions.v8,npm:"",yarn:"",pm2:"",gulp:"",grunt:"",git:"",tsc:"",mysql:"",redis:"",mongodb:"",apache:"",nginx:"",php:"",docker:"",postfix:"",postgresql:"",perl:"",python:"",python3:"",pip:"",pip3:"",java:"",gcc:"",virtualbox:"",bash:"",zsh:"",fish:"",powershell:"",dotnet:""};return new Promise((r=>{process.nextTick((()=>{if(o.isFunction(e)&&!t)t=e,e="*";else if("string"!=typeof(e=e||"*"))return t&&t({}),r({});const a=function(e){if("*"===e)return{versions:n,counter:30};if(!Array.isArray(e)){e=(e=e.trim().toLowerCase().replace(/,+/g,"|").replace(/ /g,"|")).split("|");const t={versions:{},counter:0};return e.forEach((e=>{if(e)for(let r in n)({}).hasOwnProperty.call(n,r)&&(r.toLowerCase()!==e.toLowerCase()||{}.hasOwnProperty.call(t.versions,r)||(t.versions[r]=n[r],"openssl"===r&&(t.versions.systemOpenssl="",t.versions.systemOpensslLib=""),t.versions[r]||t.counter++))})),t}}(e);let c=a.counter,u=function(){0==--c&&(t&&t(a.versions),r(a.versions))},d="";try{if({}.hasOwnProperty.call(a.versions,"openssl")&&(a.versions.openssl=process.versions.openssl,s("openssl version",(function(e,t){if(!e){let e=t.toString().split("\n")[0].trim().split(" ");a.versions.systemOpenssl=e.length>0?e[1]:e[0],a.versions.systemOpensslLib=e.length>0?e[0]:"openssl"}u()}))),{}.hasOwnProperty.call(a.versions,"npm")&&s("npm -v",(function(e,t){e||(a.versions.npm=t.toString().split("\n")[0]),u()})),{}.hasOwnProperty.call(a.versions,"pm2")&&(d="pm2",f&&(d+=".cmd"),s(`${d} -v`,(function(e,t){if(!e){let e=t.toString().split("\n")[0].trim();e.startsWith("[PM2]")||(a.versions.pm2=e)}u()}))),{}.hasOwnProperty.call(a.versions,"yarn")&&s("yarn --version",(function(e,t){e||(a.versions.yarn=t.toString().split("\n")[0]),u()})),{}.hasOwnProperty.call(a.versions,"gulp")&&(d="gulp",f&&(d+=".cmd"),s(`${d} --version`,(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.gulp=(e.toLowerCase().split("version")[1]||"").trim()}u()}))),{}.hasOwnProperty.call(a.versions,"tsc")&&(d="tsc",f&&(d+=".cmd"),s(`${d} --version`,(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.tsc=(e.toLowerCase().split("version")[1]||"").trim()}u()}))),{}.hasOwnProperty.call(a.versions,"grunt")&&(d="grunt",f&&(d+=".cmd"),s(`${d} --version`,(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.grunt=(e.toLowerCase().split("cli v")[1]||"").trim()}u()}))),{}.hasOwnProperty.call(a.versions,"git"))if(p){const e=i.existsSync("/usr/local/Cellar/git");o.darwinXcodeExists()||e?s("git --version",(function(e,t){if(!e){let e=t.toString().split("\n")[0]||"";e=(e.toLowerCase().split("version")[1]||"").trim(),a.versions.git=(e.split(" ")[0]||"").trim()}u()})):u()}else s("git --version",(function(e,t){if(!e){let e=t.toString().split("\n")[0]||"";e=(e.toLowerCase().split("version")[1]||"").trim(),a.versions.git=(e.split(" ")[0]||"").trim()}u()}));if({}.hasOwnProperty.call(a.versions,"apache")&&s("apachectl -v 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(":");a.versions.apache=e.length>1?e[1].replace("Apache","").replace("/","").split("(")[0].trim():""}u()})),{}.hasOwnProperty.call(a.versions,"nginx")&&s("nginx -v 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.nginx=(e.toLowerCase().split("/")[1]||"").trim()}u()})),{}.hasOwnProperty.call(a.versions,"mysql")&&s("mysql -V",(function(e,t){if(!e){let e=t.toString().split("\n")[0]||"";if(e=e.toLowerCase(),e.indexOf(",")>-1){e=(e.split(",")[0]||"").trim();const t=e.split(" ");a.versions.mysql=(t[t.length-1]||"").trim()}else e.indexOf(" ver ")>-1&&(e=e.split(" ver ")[1],a.versions.mysql=e.split(" ")[0])}u()})),{}.hasOwnProperty.call(a.versions,"php")&&s("php -v",(function(e,t){if(!e){let e=(t.toString().split("\n")[0]||"").split("(");e[0].indexOf("-")&&(e=e[0].split("-")),a.versions.php=e[0].replace(/[^0-9.]/g,"")}u()})),{}.hasOwnProperty.call(a.versions,"redis")&&s("redis-server --version",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.redis=o.getValue(e,"v","=",!0)}u()})),{}.hasOwnProperty.call(a.versions,"docker")&&s("docker --version",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.docker=e.length>2&&e[2].endsWith(",")?e[2].slice(0,-1):""}u()})),{}.hasOwnProperty.call(a.versions,"postfix")&&s("postconf -d | grep mail_version",(function(e,t){if(!e){const e=t.toString().split("\n")||[];a.versions.postfix=o.getValue(e,"mail_version","=",!0)}u()})),{}.hasOwnProperty.call(a.versions,"mongodb")&&s("mongod --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.mongodb=(e.toLowerCase().split(",")[0]||"").replace(/[^0-9.]/g,"")}u()})),{}.hasOwnProperty.call(a.versions,"postgresql")&&(l?s("locate bin/postgres",(function(e,t){if(e)s("psql -V",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" ")||[];a.versions.postgresql=e.length?e[e.length-1]:"",a.versions.postgresql=a.versions.postgresql.split("-")[0]}u()})),u();else{const e=t.toString().split("\n").sort();e.length?s(e[e.length-1]+" -V",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" ")||[];a.versions.postgresql=e.length?e[e.length-1]:""}u()})):u()}})):f?o.wmic("service get /value").then((e=>{let t=e.split(/\n\s*\n/);for(let e=0;e-1){const e=r.split(" server ");e.length>1&&(a.versions.postgresql=e[1])}}u()})):s("postgres -V",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" ")||[];a.versions.postgresql=e.length?e[e.length-1]:""}u()}))),{}.hasOwnProperty.call(a.versions,"perl")&&s("perl -v",(function(e,t){if(!e){const e=t.toString().split("\n")||"";for(;e.length>0&&""===e[0].trim();)e.shift();e.length>0&&(a.versions.perl=e[0].split("(").pop().split(")")[0].replace("v",""))}u()})),{}.hasOwnProperty.call(a.versions,"python"))if(p){const e=i.existsSync("/usr/local/Cellar/python");o.darwinXcodeExists()||e?s("python -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python=e.toLowerCase().replace("python","").trim()}u()})):u()}else s("python -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python=e.toLowerCase().replace("python","").trim()}u()}));if({}.hasOwnProperty.call(a.versions,"python3"))if(p){const e=i.existsSync("/usr/local/Cellar/python3");o.darwinXcodeExists()||e?s("python3 -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python3=e.toLowerCase().replace("python","").trim()}u()})):u()}else s("python3 -V 2>&1",(function(e,t){if(!e){const e=t.toString().split("\n")[0]||"";a.versions.python3=e.toLowerCase().replace("python","").trim()}u()}));if({}.hasOwnProperty.call(a.versions,"pip"))if(p){const e=i.existsSync("/usr/local/Cellar/pip");o.darwinXcodeExists()||e?s("pip -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip=e.length>=2?e[1]:""}u()})):u()}else s("pip -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip=e.length>=2?e[1]:""}u()}));if({}.hasOwnProperty.call(a.versions,"pip3"))if(p){const e=i.existsSync("/usr/local/Cellar/pip3");o.darwinXcodeExists()||e?s("pip3 -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip3=e.length>=2?e[1]:""}u()})):u()}else s("pip3 -V 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split(" ");a.versions.pip3=e.length>=2?e[1]:""}u()}));({}).hasOwnProperty.call(a.versions,"java")&&(p?s("/usr/libexec/java_home -V 2>&1",(function(e,t){e||-1!==t.toString().toLowerCase().indexOf("no java runtime")?u():s("java -version 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split('"');a.versions.java=3===e.length?e[1].trim():""}u()}))})):s("java -version 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split('"');a.versions.java=3===e.length?e[1].trim():""}u()}))),{}.hasOwnProperty.call(a.versions,"gcc")&&(p&&o.darwinXcodeExists()||!p?s("gcc -dumpversion",(function(e,t){e||(a.versions.gcc=t.toString().split("\n")[0].trim()||""),a.versions.gcc.indexOf(".")>-1?u():s("gcc --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].trim();if(e.indexOf("gcc")>-1&&e.indexOf(")")>-1){const t=e.split(")");a.versions.gcc=t[1].trim()||a.versions.gcc}}u()}))})):u()),{}.hasOwnProperty.call(a.versions,"virtualbox")&&s(o.getVboxmanage()+" -v 2>&1",(function(e,t){if(!e){const e=(t.toString().split("\n")[0]||"").split("r");a.versions.virtualbox=e[0]}u()})),{}.hasOwnProperty.call(a.versions,"bash")&&s("bash --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" version ");e.length>1&&(a.versions.bash=e[1].split(" ")[0].split("(")[0])}u()})),{}.hasOwnProperty.call(a.versions,"zsh")&&s("zsh --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split("zsh ");e.length>1&&(a.versions.zsh=e[1].split(" ")[0])}u()})),{}.hasOwnProperty.call(a.versions,"fish")&&s("fish --version",(function(e,t){if(!e){const e=t.toString().split("\n")[0].split(" version ");e.length>1&&(a.versions.fish=e[1].split(" ")[0])}u()})),{}.hasOwnProperty.call(a.versions,"powershell")&&(f?o.powerShell("$PSVersionTable").then((e=>{const t=e.toString().split("\n").map((e=>e.replace(/ +/g," ").replace(/ +/g,":")));a.versions.powershell=o.getValue(t,"psversion"),u()})):u()),{}.hasOwnProperty.call(a.versions,"dotnet")&&o.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then((e=>{const t=e.toString().split("\r\n");let n="";t.forEach((e=>{const t=(e=e.replace(/ +/g," ")).split(" ");n=n||(t[0].toLowerCase().startsWith("client")&&t.length>2||t[0].toLowerCase().startsWith("full")&&t.length>2?t[1].trim():"")})),a.versions.dotnet=n.trim(),u()}))}catch(e){t&&t(a.versions),r(a.versions)}}))}))},t.shell=function(e){return new Promise((t=>{process.nextTick((()=>{f&&t("cmd");let n="";s("echo $SHELL",(function(r,i){r||(n=i.toString().split("\n")[0]),e&&e(n),t(n)}))}))}))},t.uuid=E},8958:(e,t,n)=>{"use strict";const r=n(3129).exec,i=n(1453);let o=process.platform;const s="linux"===o,a="darwin"===o,c="win32"===o,u="freebsd"===o,l="openbsd"===o,p="netbsd"===o,f="sunos"===o,d={1:"Other",2:"Unknown",3:"Idle",4:"Printing",5:"Warmup",6:"Stopped Printing",7:"Offline"};function h(e){const t={},n=i.getValue(e,"PrinterId"," ");return t.id=n?parseInt(n,10):null,t.name=i.getValue(e,"Info"," "),t.model=e.length>0&&e[0]?e[0].split(" ")[0]:"",t.uri=i.getValue(e,"DeviceURI"," "),t.uuid=i.getValue(e,"UUID"," "),t.status=i.getValue(e,"State"," "),t.local=i.getValue(e,"Location"," ").toLowerCase().startsWith("local"),t.default=null,t.shared=i.getValue(e,"Shared"," ").toLowerCase().startsWith("yes"),t}function m(e,t){const n={};return n.id=t,n.name=i.getValue(e,"Description",":",!0),n.model=e.length>0&&e[0]?e[0].split(" ")[0]:"",n.uri=null,n.uuid=null,n.status=e.length>0&&e[0]?e[0].indexOf(" idle")>0?"idle":e[0].indexOf(" printing")>0?"printing":"unknown":null,n.local=i.getValue(e,"Location",":",!0).toLowerCase().startsWith("local"),n.default=null,n.shared=i.getValue(e,"Shared"," ").toLowerCase().startsWith("yes"),n}function g(e,t){const n={},r=e.uri.split("/");return n.id=t,n.name=e._name,n.model=r.length?r[r.length-1]:"",n.uri=e.uri,n.uuid=null,n.status=e.status,n.local="local"===e.printserver,n.default="yes"===e.default,n.shared="yes"===e.shared,n}function v(e,t){const n={},r=parseInt(i.getValue(e,"PrinterStatus","="),10);return n.id=t,n.name=i.getValue(e,"name","="),n.model=i.getValue(e,"DriverName","="),n.uri=null,n.uuid=null,n.status=d[r]?d[r]:null,n.local="TRUE"===i.getValue(e,"Local","="),n.default="TRUE"===i.getValue(e,"Default","="),n.shared="TRUE"===i.getValue(e,"Shared","="),n}t.printer=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(s||u||l||p){let i="cat /etc/cups/printers.conf 2>/dev/null";r(i,(function(o,a){if(!o){const e=a.toString().split("0){const n=e[0].split(" CUPS v");t.cupsVersion=n[1]}return t}(e[0]);for(let r=1;r/dev/null; unset LC_ALL",r(i,(function(e,t){const r=("\n"+t.toString()).split("\nprinter ");for(let e=1;e{"use strict";const r=n(2087),i=n(5747),o=n(5622),s=n(3129).exec,a=n(3129).execSync,c=n(1453);let u=process.platform;const l="linux"===u,p="darwin"===u,f="win32"===u,d="freebsd"===u,h="openbsd"===u,m="netbsd"===u,g="sunos"===u,v={all:0,list:{},ms:0,result:{}},y={all:0,list:{},ms:0,result:{}},_={all:0,list:{},ms:0,result:{}},E={0:"unknown",1:"other",2:"ready",3:"running",4:"blocked",5:"suspended blocked",6:"suspended ready",7:"terminated",8:"stopped",9:"growing"};function b(e){let t=e.replace(/ +/g," ").split(" ");return(t.length>=2?parseInt(t[1]):0)+(t.length>=3?parseInt(t[2]):0)+(t.length>=4?parseInt(t[3]):0)+(t.length>=5?parseInt(t[4]):0)+(t.length>=6?parseInt(t[5]):0)+(t.length>=7?parseInt(t[6]):0)+(t.length>=8?parseInt(t[7]):0)+(t.length>=9?parseInt(t[8]):0)+(t.length>=10?parseInt(t[9]):0)+(t.length>=11?parseInt(t[10]):0)}function w(e,t,n){let r=e.replace(/ +/g," ").split(")");if(r.length>=2){let e=r[1].split(" ");if(e.length>=16){let i=parseInt(r[0].split(" ")[0]),o=parseInt(e[12]),s=parseInt(e[13]),a=parseInt(e[14]),c=parseInt(e[15]),u=0,l=0;return n.all>0&&n.list[i]?(u=(o+a-n.list[i].utime-n.list[i].cutime)/(t-n.all)*100,l=(s+c-n.list[i].stime-n.list[i].cstime)/(t-n.all)*100):(u=(o+a)/t*100,l=(s+c)/t*100),{pid:i,utime:o,stime:s,cutime:a,cstime:c,cpuu:u,cpus:l}}return{pid:0,utime:0,stime:0,cutime:0,cstime:0,cpuu:0,cpus:0}}return{pid:0,utime:0,stime:0,cutime:0,cstime:0,cpuu:0,cpus:0}}function S(e,t,n){let r=0,i=0;return n.all>0&&n.list[e.pid]?(r=(e.utime-n.list[e.pid].utime)/(t-n.all)*100,i=(e.stime-n.list[e.pid].stime)/(t-n.all)*100):(r=e.utime/t*100,i=e.stime/t*100),{pid:e.pid,utime:e.utime,stime:e.stime,cpuu:r,cpus:i}}t.services=function(e,t){return c.isFunction(e)&&!t&&(t=e,e=""),new Promise((n=>{process.nextTick((()=>{if("string"!=typeof e)return t&&t([]),n([]);if(e){let r="";r.__proto__.toLowerCase=c.stringToLower,r.__proto__.replace=c.stringReplace,r.__proto__.trim=c.stringTrim;const i=c.sanitizeShellString(e);for(let e=0;e<=c.mathMin(i.length,2e3);e++)void 0!==i[e]&&(r+=i[e]);r=r.trim().toLowerCase().replace(/, /g,"|").replace(/,+/g,"|"),""===r&&(r="*"),c.isPrototypePolluted()&&"*"!==r&&(r="------");let o=r.split("|"),u=[],g=[];if(l||d||h||m||p){if((l||d||h||m)&&"*"===r)try{r="";const e=a("service --status-all 2> /dev/null").toString().split("\n");for(const t of e){const e=t.split("]");2===e.length&&(r+=(""!==r?"|":"")+e[1].trim())}o=r.split("|")}catch(e){try{const e=a("ls /etc/init.d/ -m 2> /dev/null").toString().split("\n").join("");if(r="",e){const t=e.split(",");for(const e of t){const t=e.trim();t&&(r+=(""!==r?"|":"")+t)}o=r.split("|")}}catch(e){r="",o=[]}}p&&"*"===r&&(t&&t(u),n(u));let e=p?["-caxo","pcpu,pmem,pid,command"]:["-axo","pcpu,pmem,pid,command"];""!==r&&o.length>0?c.execSafe("ps",e).then((r=>{if(r){let e=r.replace(/ +/g," ").replace(/,+/g,".").split("\n");if(o.forEach((function(t){let n;n=p?e.filter((function(e){return-1!==e.toLowerCase().indexOf(t)})):e.filter((function(e){return-1!==e.toLowerCase().indexOf(" "+t+":")||-1!==e.toLowerCase().indexOf("/"+t)}));const r=[];for(const e of n){const t=e.trim().split(" ")[2];t&&r.push(parseInt(t,10))}u.push({name:t,running:n.length>0,startmode:"",pids:r,cpu:parseFloat(n.reduce((function(e,t){return e+parseFloat(t.trim().split(" ")[0])}),0).toFixed(2)),mem:parseFloat(n.reduce((function(e,t){return e+parseFloat(t.trim().split(" ")[1])}),0).toFixed(2))})})),l){let e='cat /proc/stat | grep "cpu "';for(let t in u)for(let n in u[t].pids)e+=";cat /proc/"+u[t].pids[n]+"/stat";s(e,{maxBuffer:2048e4},(function(e,r){let i=r.toString().split("\n"),o=b(i.shift()),s={},a={};for(let e=0;e=0&&(u[e].cpu+=a.cpuu+a.cpus),s[a.pid]={cpuu:a.cpuu,cpus:a.cpus,utime:a.utime,stime:a.stime,cutime:a.cutime,cstime:a.cstime}}y.all=o,y.list=Object.assign({},s),y.ms=Date.now()-y.ms,y.result=Object.assign({},u),t&&t(u),n(u)}))}else t&&t(u),n(u)}else e=["-o","comm"],c.execSafe("ps",e).then((e=>{if(e){let r=e.replace(/ +/g," ").replace(/,+/g,".").split("\n");o.forEach((function(e){let t=r.filter((function(t){return-1!==t.indexOf(e)}));u.push({name:e,running:t.length>0,startmode:"",cpu:0,mem:0})})),t&&t(u),n(u)}else o.forEach((function(e){u.push({name:e,running:!1,startmode:"",cpu:0,mem:0})})),t&&t(u),n(u)}))})):(t&&t(u),n(u))}if(f)try{c.wmic("service get /value").then(((e,i)=>{if(i)o.forEach((function(e){u.push({name:e,running:!1,startmode:"",cpu:0,mem:0})})),t&&t(u),n(u);else{let i=e.split(/\n\s*\n/);for(let e=0;e=0||o.indexOf(s)>=0)&&(u.push({name:n,running:"TRUE"===a,startmode:l,pids:[p],cpu:0,mem:0}),g.push(n),g.push(s))}if("*"!==r){o.filter((function(e){return-1===g.indexOf(e)})).forEach((function(e){u.push({name:e,running:!1,startmode:"",pids:[],cpu:0,mem:0})}))}t&&t(u),n(u)}}))}catch(e){t&&t(u),n(u)}}else t&&t([]),n([])}))}))},t.processes=function(e){let t=[];function n(e){let t=(e=e||"").split(" ")[0];if(":"===t.substr(-1)&&(t=t.substr(0,t.length-1)),"["!==t.substr(0,1)){let e=t.split("/");t=isNaN(parseInt(e[e.length-1]))?e[e.length-1]:e[0]}return t}function a(e){let r=[];if(e.length>1){let s=e[0];t=c.parseHead(s,8),e.shift(),e.forEach((function(e){""!==e.trim()&&r.push(function(e){let r=0,s=0;function a(n){r=s,s=t[n]?e.substring(t[n].to+r,1e4).indexOf(" "):1e4}a(0);const c=parseInt(e.substring(t[0].from+r,t[0].to+s));a(1);const u=parseInt(e.substring(t[1].from+r,t[1].to+s));a(2);const p=parseFloat(e.substring(t[2].from+r,t[2].to+s).replace(/,/g,"."));a(3);const f=parseFloat(e.substring(t[3].from+r,t[3].to+s).replace(/,/g,"."));a(4);const d=parseInt(e.substring(t[4].from+r,t[4].to+s));a(5);const h=parseInt(e.substring(t[5].from+r,t[5].to+s));a(6);const m=parseInt(e.substring(t[6].from+r,t[6].to+s));a(7);const g=parseInt(e.substring(t[7].from+r,t[7].to+s))||0;a(8);const v=function(e){let t=e,n=e.replace(/ +/g," ").split(" ");return 5===n.length&&(t=n[4]+"-"+("0"+("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".indexOf(n[1].toUpperCase())/3+1)).slice(-2)+"-"+("0"+n[2]).slice(-2)+" "+n[3]),t}(e.substring(t[8].from+r,t[8].to+s).trim());a(9);let y=e.substring(t[9].from+r,t[9].to+s).trim();y="R"===y[0]?"running":"S"===y[0]?"sleeping":"T"===y[0]?"stopped":"W"===y[0]?"paging":"X"===y[0]?"dead":"Z"===y[0]?"zombie":"D"===y[0]||"U"===y[0]?"blocked":"unknown",a(10);let _=e.substring(t[10].from+r,t[10].to+s).trim();"?"!==_&&"??"!==_||(_=""),a(11);const E=e.substring(t[11].from+r,t[11].to+s).trim();a(12);let b="",w="",S="",I=e.substring(t[12].from+r,t[12].to+s).trim();if("]"===I.substr(I.length-1)&&(I=I.slice(0,-1)),"["===I.substr(0,1))w=I.substring(1);else{let e=I.indexOf(" -"),t=I.indexOf(" /");e=e>=0?e:1e4,t=t>=0?t:1e4;const n=Math.min(e,t);let r=I.substr(0,n);const s=I.substr(n),a=r.lastIndexOf("/");if(a>=0&&(b=r.substr(0,a),r=r.substr(a+1)),1e4===n&&r.indexOf(" ")>-1){const e=r.split(" ");i.existsSync(o.join(b,e[0]))?(w=e.shift(),S=(e.join(" ")+" "+s).trim()):(w=r.trim(),S=s.trim())}else w=r.trim(),S=s.trim()}return{pid:c,parentPid:u,name:l?n(w):w,cpu:p,cpuu:0,cpus:0,mem:f,priority:d,memVsz:h,memRss:m,nice:g,started:v,state:y,tty:_,user:E,command:w,params:S,path:b}}(e))}))}return r}return new Promise((t=>{process.nextTick((()=>{let i={all:0,running:0,blocked:0,sleeping:0,unknown:0,list:[]},o="";if(v.ms&&Date.now()-v.ms>=500||0===v.ms)if(l||d||h||m||p||g)l&&(o="export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,lstart:30,state:5,tty:15,user:20,command; unset LC_ALL"),(d||h||m)&&(o="export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL"),p&&(o="export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,nice,lstart,state,tty,user,command -r; unset LC_ALL"),g&&(o="ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm"),s(o,{maxBuffer:2048e4},(function(c,u){if(c)o="ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm",g&&(o="ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm"),s(o,{maxBuffer:2048e4},(function(o,s){if(o)e&&e(i),t(i);else{let o=s.toString().split("\n");o.shift(),i.list=function(e){let t=[];return e.forEach((function(e){if(""!==e.trim()){const i=(e=e.trim().replace(/ +/g," ").replace(/,+/g,".")).split(" "),o=i.slice(9).join(" "),s=parseFloat((1*parseInt(i[3])*1024/r.totalmem()).toFixed(1)),a=i[5].split(":"),c=function(e){const t=("0"+(e.getMonth()+1).toString()).substr(-2);return e.getFullYear().toString()+"-"+t+"-"+("0"+e.getDay().toString()).substr(-2)+" "+e.getHours().toString()+":"+e.getMinutes().toString()+":"+("0"+e.getSeconds().toString()).substr(-2)}(new Date(Date.now()-(a.length>1?1e3*(60*a[0]+a[1]):1e3*a[0])));t.push({pid:parseInt(i[0]),parentPid:parseInt(i[1]),name:n(o),cpu:0,cpuu:0,cpus:0,mem:s,priority:0,memVsz:parseInt(i[2]),memRss:parseInt(i[3]),nice:parseInt(i[4]),started:c,state:"R"===i[6]?"running":"S"===i[6]?"sleeping":"T"===i[6]?"stopped":"W"===i[6]?"paging":"X"===i[6]?"dead":"Z"===i[6]?"zombie":"D"===i[6]||"U"===i[6]?"blocked":"unknown",tty:i[7],user:i[8],command:o})}})),t}(o).slice(),i.all=i.list.length,i.running=i.list.filter((function(e){return"running"===e.state})).length,i.blocked=i.list.filter((function(e){return"blocked"===e.state})).length,i.sleeping=i.list.filter((function(e){return"sleeping"===e.state})).length,e&&e(i),t(i)}}));else if(i.list=a(u.toString().split("\n")).slice(),i.all=i.list.length,i.running=i.list.filter((function(e){return"running"===e.state})).length,i.blocked=i.list.filter((function(e){return"blocked"===e.state})).length,i.sleeping=i.list.filter((function(e){return"sleeping"===e.state})).length,l){o='cat /proc/stat | grep "cpu "';for(let e=0;e=0&&(i.list[e].cpu=c.cpuu+c.cpus,i.list[e].cpuu=c.cpuu,i.list[e].cpus=c.cpus),a[c.pid]={cpuu:c.cpuu,cpus:c.cpus,utime:c.utime,stime:c.stime,cutime:c.cutime,cstime:c.cstime}}v.all=s,v.list=Object.assign({},a),v.ms=Date.now()-v.ms,v.result=Object.assign({},i),e&&e(i),t(i)}))}else e&&e(i),t(i)}));else if(f)try{c.wmic("process get /value").then(((n,o)=>{if(!o){let e=n.split(/\n\s*\n/),t=[],o=[],a={},u=0,l=0;for(let n=0;n=0&&(i.list[n].cpu=t.cpuu+t.cpus,i.list[n].cpuu=t.cpuu,i.list[n].cpus=t.cpus),a[t.pid]={cpuu:t.cpuu,cpus:t.cpus,utime:t.utime,stime:t.stime}}v.all=u+l,v.list=Object.assign({},a),v.ms=Date.now()-v.ms,v.result=Object.assign({},i)}var s;e&&e(i),t(i)}))}catch(n){e&&e(i),t(i)}else e&&e(i),t(i);else e&&e(v.result),t(v.result)}))}))},t.processLoad=function(e,t){return c.isFunction(e)&&!t&&(t=e,e=""),new Promise((n=>{process.nextTick((()=>{if("string"!=typeof(e=e||""))return t&&t([]),n([]);let i="";i.__proto__.toLowerCase=c.stringToLower,i.__proto__.replace=c.stringReplace,i.__proto__.trim=c.stringTrim;const o=c.sanitizeShellString(e);for(let e=0;e<=c.mathMin(o.length,2e3);e++)void 0!==o[e]&&(i+=o[e]);i=i.trim().toLowerCase().replace(/, /g,"|").replace(/,+/g,"|"),""===i&&(i="*"),c.isPrototypePolluted()&&"*"!==i&&(i="------");let a=i.split("|"),u=[];if((c.isPrototypePolluted()?"":c.sanitizeShellString(e))&&a.length&&"------"!==a[0]){if(f)try{c.wmic("process get /value").then(((e,o)=>{if(!o){let o=e.split(/\n\s*\n/),s=[],l={},p=0,f=0;for(let e=0;e=0&&!v&&(v=!0,g=e)})),"*"===i||v){let e=!1;u.forEach((function(t){t.proc.toLowerCase()===g.toLowerCase()&&(t.pids.push(n),t.mem+=m/r.totalmem()*100,e=!0)})),e||u.push({proc:g,pid:n,pids:[n],cpu:0,mem:m/r.totalmem()*100})}}if("*"!==i){a.filter((function(e){return 0===s.filter((function(t){return t.name.toLowerCase().indexOf(e)>=0})).length})).forEach((function(e){u.push({proc:e,pid:null,pids:[],cpu:0,mem:0})}))}for(let e=0;e=0)&&(n=e);n>=0&&(u[n].cpu+=t.cpuu+t.cpus),l[t.pid]={cpuu:t.cpuu,cpus:t.cpus,utime:t.utime,stime:t.stime}}_.all=p+f,_.list=Object.assign({},l),_.ms=Date.now()-_.ms,_.result=JSON.parse(JSON.stringify(u)),t&&t(u),n(u)}}))}catch(e){t&&t(u),n(u)}if(p||l||d||h||m){const e=["-axo","pid,pcpu,pmem,comm"];c.execSafe("ps",e).then((e=>{if(e){let r=[];if(e.toString().split("\n").filter((function(e){if("*"===i)return!0;if(-1!==e.toLowerCase().indexOf("grep"))return!1;let t=!1;return a.forEach((function(n){t=t||e.toLowerCase().indexOf(n.toLowerCase())>=0})),t})).forEach((function(e){let t=e.trim().replace(/ +/g," ").split(" ");t.length>3&&r.push({name:t[3].substring(t[3].lastIndexOf("/")+1),pid:parseInt(t[0])||0,cpu:parseFloat(t[1].replace(",",".")),mem:parseFloat(t[2].replace(",","."))})})),r.forEach((function(e){let t=-1,n=!1,r="";for(let n=0;n=0&&(t=n);a.forEach((function(t){e.name.toLowerCase().indexOf(t.toLowerCase())>=0&&!n&&(n=!0,r=t)})),("*"===i||n)&&(t<0?u.push({proc:r,pid:e.pid,pids:[e.pid],cpu:e.cpu,mem:e.mem}):(u[t].pids.push(e.pid),u[t].cpu+=e.cpu,u[t].mem+=e.mem))})),"*"!==i){a.filter((function(e){return 0===r.filter((function(t){return t.name.toLowerCase().indexOf(e)>=0})).length})).forEach((function(e){u.push({proc:e,pid:null,pids:[],cpu:0,mem:0})}))}if(l){u.forEach((function(e){e.cpu=0}));let e='cat /proc/stat | grep "cpu "';for(let t in u)for(let n in u[t].pids)e+=";cat /proc/"+u[t].pids[n]+"/stat";s(e,{maxBuffer:2048e4},(function(e,r){let i=r.toString().split("\n"),o=b(i.shift()),s={},a={};for(let e=0;e=0&&(e=t);e>=0&&(u[e].cpu+=a.cpuu+a.cpus),s[a.pid]={cpuu:a.cpuu,cpus:a.cpus,utime:a.utime,stime:a.stime,cutime:a.cutime,cstime:a.cstime}}u.forEach((function(e){e.cpu=Math.round(100*e.cpu)/100})),_.all=o,_.list=Object.assign({},s),_.ms=Date.now()-_.ms,_.result=Object.assign({},u),t&&t(u),n(u)}))}else t&&t(u),n(u)}else t&&t(u),n(u)}))}}}))}))}},1617:(e,t,n)=>{"use strict";const r=n(5747),i=n(2087),o=n(1453),s=n(3129).exec,a=n(3129).execSync,c=o.promisify(n(3129).exec);let u=process.platform;const l="linux"===u,p="darwin"===u,f="win32"===u,d="freebsd"===u,h="openbsd"===u,m="netbsd"===u,g="sunos"===u;t.system=function(e){return new Promise((t=>{process.nextTick((()=>{let n={manufacturer:"",model:"Computer",version:"",serial:"-",uuid:"-",sku:"-",virtual:!1};if((l||d||h||m)&&s("export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL",(function(i,s){let c=s.toString().split("\n");n.manufacturer=o.getValue(c,"manufacturer"),n.model=o.getValue(c,"product name"),n.version=o.getValue(c,"version"),n.serial=o.getValue(c,"serial number"),n.uuid=o.getValue(c,"uuid").toLowerCase(),n.sku=o.getValue(c,"sku number");try{c=a('echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;\n echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;\n echo -n "product_uuid: "; cat /sys/devices/virtual/dmi/id/product_uuid 2>/dev/null; echo;\n echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo;\n echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;').toString().split("\n"),n.manufacturer=""===n.manufacturer?o.getValue(c,"sys_vendor"):n.manufacturer,n.model=""===n.model?o.getValue(c,"product_name"):n.model,n.version=""===n.version?o.getValue(c,"product_version"):n.version,n.serial=""===n.serial?o.getValue(c,"product_serial"):n.serial,n.uuid=""===n.uuid?o.getValue(c,"product_uuid").toLowerCase():n.uuid}catch(e){o.noop()}if(n.serial&&-1===n.serial.toLowerCase().indexOf("o.e.m.")||(n.serial="-"),n.manufacturer&&-1===n.manufacturer.toLowerCase().indexOf("o.e.m.")||(n.manufacturer=""),n.model&&-1===n.model.toLowerCase().indexOf("o.e.m.")||(n.model="Computer"),n.version&&-1===n.version.toLowerCase().indexOf("o.e.m.")||(n.version=""),n.sku&&-1===n.sku.toLowerCase().indexOf("o.e.m.")||(n.sku="-"),"virtualbox"===n.model.toLowerCase()||"kvm"===n.model.toLowerCase()||"virtual machine"===n.model.toLowerCase()||"bochs"===n.model.toLowerCase()||n.model.toLowerCase().startsWith("vmware")||n.model.toLowerCase().startsWith("droplet"))switch(n.virtual=!0,n.model.toLowerCase()){case"virtualbox":n.virtualHost="VirtualBox";break;case"vmware":n.virtualHost="VMware";break;case"kvm":n.virtualHost="KVM";break;case"bochs":n.virtualHost="bochs"}if(n.manufacturer.toLowerCase().startsWith("vmware")||"xen"===n.manufacturer.toLowerCase())switch(n.virtual=!0,n.manufacturer.toLowerCase()){case"vmware":n.virtualHost="VMware";break;case"xen":n.virtualHost="Xen"}if(!n.virtual)try{const e=a("ls -1 /dev/disk/by-id/ 2>/dev/null").toString();e.indexOf("_QEMU_")>=0&&(n.virtual=!0,n.virtualHost="QEMU"),e.indexOf("_VBOX_")>=0&&(n.virtual=!0,n.virtualHost="VirtualBox")}catch(e){o.noop()}if(!n.virtual&&o.linuxVersion().toLowerCase().indexOf("microsoft")>=0){let e=o.linuxVersion().toLowerCase();e=e.split("-")[0].replace("#","");const t=parseInt(e,10)||null;n.virtual=!0,n.manufacturer="Microsoft",n.model="WSL",n.version=t}if((d||h||m)&&!n.virtualHost)try{const e=a("dmidecode -t 4").toString().split("\n");switch(o.getValue(e,"manufacturer",":",!0).toLowerCase()){case"virtualbox":n.virtualHost="VirtualBox";break;case"vmware":n.virtualHost="VMware";break;case"kvm":n.virtualHost="KVM";break;case"bochs":n.virtualHost="bochs"}}catch(e){o.noop()}(r.existsSync("/.dockerenv")||r.existsSync("/.dockerinit"))&&(n.model="Docker Container");try{const e=a('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen"');e.toString().split("\n").length>0&&("Computer"===n.model&&(n.model="Virtual machine"),n.virtual=!0,e.toString().toLowerCase().indexOf("vmware")&&!n.virtualHost&&(n.virtualHost="VMware"),e.toString().toLowerCase().indexOf("qemu")&&!n.virtualHost&&(n.virtualHost="QEMU"),e.toString().toLowerCase().indexOf("xen")&&!n.virtualHost&&(n.virtualHost="Xen"),e.toString().toLowerCase().indexOf("kvm")&&!n.virtualHost&&(n.virtualHost="KVM"))}catch(e){o.noop()}""===n.manufacturer&&"Computer"===n.model&&""===n.version?r.readFile("/proc/cpuinfo",(function(r,i){if(!r){let e=i.toString().split("\n");n.model=o.getValue(e,"hardware",":",!0).toUpperCase(),n.version=o.getValue(e,"revision",":",!0).toLowerCase(),n.serial=o.getValue(e,"serial",":",!0);const t=o.getValue(e,"model:",":",!0);if(("BCM2835"===n.model||"BCM2708"===n.model||"BCM2709"===n.model||"BCM2710"===n.model||"BCM2711"===n.model||"BCM2836"===n.model||"BCM2837"===n.model)&&t.toLowerCase().indexOf("raspberry")>=0){const t=o.decodePiCpuinfo(e);n.model=t.model,n.version=t.revisionCode,n.manufacturer="Raspberry Pi Foundation",n.raspberry={manufacturer:t.manufacturer,processor:t.processor,type:t.type,revision:t.revision}}}e&&e(n),t(n)})):(e&&e(n),t(n))})),p&&s("ioreg -c IOPlatformExpertDevice -d 2",(function(r,i){if(!r){let e=i.toString().replace(/[<>"]/g,"").split("\n");n.manufacturer=o.getValue(e,"manufacturer","=",!0),n.model=o.getValue(e,"model","=",!0),n.version=o.getValue(e,"version","=",!0),n.serial=o.getValue(e,"ioplatformserialnumber","=",!0),n.uuid=o.getValue(e,"ioplatformuuid","=",!0).toLowerCase(),n.sku=o.getValue(e,"board-id","=",!0)}e&&e(n),t(n)})),g&&(e&&e(n),t(n)),f)try{o.wmic("csproduct get /value").then(((r,i)=>{if(i)e&&e(n),t(n);else{let i=r.split("\r\n");if(n.manufacturer=o.getValue(i,"vendor","="),n.model=o.getValue(i,"name","="),n.version=o.getValue(i,"version","="),n.serial=o.getValue(i,"identifyingnumber","="),n.uuid=o.getValue(i,"uuid","=").toLowerCase(),"virtualbox"===n.model.toLowerCase()||"kvm"===n.model.toLowerCase()||"virtual machine"===n.model.toLowerCase()||"bochs"===n.model.toLowerCase()||n.model.toLowerCase().startsWith("vmware"))switch(n.virtual=!0,n.model.toLowerCase()){case"virtualbox":n.virtualHost="VirtualBox";break;case"vmware":n.virtualHost="VMware";break;case"kvm":n.virtualHost="KVM";break;case"bochs":n.virtualHost="bochs"}if(n.manufacturer.toLowerCase().startsWith("vmware")||"xen"===n.manufacturer.toLowerCase())switch(n.virtual=!0,n.manufacturer.toLowerCase()){case"vmware":n.virtualHost="VMware";break;case"xen":n.virtualHost="Xen"}o.wmic("/namespace:\\\\root\\wmi path MS_SystemInformation get /value").then(((r,i)=>{if(!i){let e=r.split("\r\n");n.sku=o.getValue(e,"systemsku","=")}n.virtual?(e&&e(n),t(n)):o.wmic("bios get Version, SerialNumber, SMBIOSBIOSVersion").then(((r,i)=>{if(i)e&&e(n),t(n);else{let i=r.toString();(i.indexOf("VRTUAL")>=0||i.indexOf("A M I ")>=0||i.indexOf("VirtualBox")>=0||i.indexOf("VMWare")>=0||i.indexOf("Xen")>=0)&&(n.virtual=!0,i.indexOf("VirtualBox")>=0&&!n.virtualHost&&(n.virtualHost="VirtualBox"),i.indexOf("VMware")>=0&&!n.virtualHost&&(n.virtualHost="VMware"),i.indexOf("Xen")>=0&&!n.virtualHost&&(n.virtualHost="Xen"),i.indexOf("VRTUAL")>=0&&!n.virtualHost&&(n.virtualHost="Hyper-V"),i.indexOf("A M I")>=0&&!n.virtualHost&&(n.virtualHost="Virtual PC")),e&&e(n),t(n)}}))}))}}))}catch(r){e&&e(n),t(n)}}))}))},t.bios=function(e){return new Promise((t=>{process.nextTick((()=>{let n={vendor:"",version:"",releaseDate:"",revision:""},r="";if((l||d||h||m)&&(r="arm"===process.arch?"cat /proc/cpuinfo | grep Serial":"export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL",s(r,(function(r,i){let s=i.toString().split("\n");n.vendor=o.getValue(s,"Vendor"),n.version=o.getValue(s,"Version");let c=o.getValue(s,"Release Date");n.releaseDate=o.parseDateTime(c).date,n.revision=o.getValue(s,"BIOS Revision");let u=o.getValue(s,"Currently Installed Language").split("|")[0];if(u&&(n.language=u),s.length&&i.toString().indexOf("Characteristics:")>=0){const e=[];s.forEach((t=>{if(t.indexOf(" is supported")>=0){const n=t.split(" is supported")[0].trim();e.push(n)}})),n.features=e}try{s=a('echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo;\n echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo;\n echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;').toString().split("\n"),n.vendor=n.vendor?n.vendor:o.getValue(s,"bios_vendor"),n.version=n.version?n.version:o.getValue(s,"bios_version"),c=o.getValue(s,"bios_date"),n.releaseDate=n.releaseDate?n.releaseDate:o.parseDateTime(c).date}catch(e){o.noop()}e&&e(n),t(n)}))),p&&(n.vendor="Apple Inc.",s("system_profiler SPHardwareDataType -json",(function(r,i){try{const e=JSON.parse(i.toString());if(e&&e.SPHardwareDataType&&e.SPHardwareDataType.length){let t=e.SPHardwareDataType[0].boot_rom_version;t=t?t.split("(")[0].trim():null,n.version=t}}catch(e){o.noop()}e&&e(n),t(n)}))),g&&(n.vendor="Sun Microsystems",e&&e(n),t(n)),f)try{o.wmic("bios get /value").then(((r,i)=>{if(!i){let e=r.toString().split("\r\n");const t=o.getValue(e,"description","=");-1!==t.indexOf(" Version ")?(n.vendor=t.split(" Version ")[0].trim(),n.version=t.split(" Version ")[1].trim()):-1!==t.indexOf(" Ver: ")?(n.vendor=o.getValue(e,"manufacturer","="),n.version=t.split(" Ver: ")[1].trim()):(n.vendor=o.getValue(e,"manufacturer","="),n.version=o.getValue(e,"version","=")),n.releaseDate=o.getValue(e,"releasedate","="),n.releaseDate.length>=10&&(n.releaseDate=n.releaseDate.substr(0,4)+"-"+n.releaseDate.substr(4,2)+"-"+n.releaseDate.substr(6,2)),n.revision=o.getValue(e,"buildnumber","=")}e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}))}))},t.baseboard=function(e){return new Promise((t=>{process.nextTick((()=>{let n={manufacturer:"",model:"",version:"",serial:"-",assetTag:"-",memMax:null,memSlots:null},s="";if(l||d||h||m){s="arm"===process.arch?"cat /proc/cpuinfo | grep Serial":"export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL";const u=[];u.push(c(s)),u.push(c("export LC_ALL=C; dmidecode -t memory 2>/dev/null")),o.promiseAll(u).then((s=>{let c=s.results[0]?s.results[0].toString().split("\n"):[""];n.manufacturer=o.getValue(c,"Manufacturer"),n.model=o.getValue(c,"Product Name"),n.version=o.getValue(c,"Version"),n.serial=o.getValue(c,"Serial Number"),n.assetTag=o.getValue(c,"Asset Tag");try{c=a('echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo;\n echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo;\n echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo;\n echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo;\n echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;').toString().split("\n"),n.manufacturer=n.manufacturer?n.manufacturer:o.getValue(c,"board_vendor"),n.model=n.model?n.model:o.getValue(c,"board_name"),n.version=n.version?n.version:o.getValue(c,"board_version"),n.serial=n.serial?n.serial:o.getValue(c,"board_serial"),n.assetTag=n.assetTag?n.assetTag:o.getValue(c,"board_asset_tag")}catch(e){o.noop()}-1!==n.serial.toLowerCase().indexOf("o.e.m.")&&(n.serial="-"),-1!==n.assetTag.toLowerCase().indexOf("o.e.m.")&&(n.assetTag="-"),c=s.results[1]?s.results[1].toString().split("\n"):[""],n.memMax=1024*o.toInt(o.getValue(c,"Maximum Capacity"))*1024*1024||null,n.memSlots=o.toInt(o.getValue(c,"Number Of Devices"))||null;const u=r.readFileSync("/proc/cpuinfo").toString().split("\n");if(o.getValue(u,"hardware").startsWith("BCM")){const e=o.decodePiCpuinfo(u);n.manufacturer=e.manufacturer,n.model="Raspberry Pi",n.serial=e.serial,n.version=e.type+" - "+e.revision,n.memMax=i.totalmem(),n.memSlots=0}e&&e(n),t(n)}))}if(p){const r=[];r.push(c("ioreg -c IOPlatformExpertDevice -d 2")),r.push(c("system_profiler SPMemoryDataType")),o.promiseAll(r).then((r=>{let s=r.results[0]?r.results[0].toString().replace(/[<>"]/g,"").split("\n"):[""];n.manufacturer=o.getValue(s,"manufacturer","=",!0),n.model=o.getValue(s,"model","=",!0),n.version=o.getValue(s,"version","=",!0),n.serial=o.getValue(s,"ioplatformserialnumber","=",!0),n.assetTag=o.getValue(s,"board-id","=",!0);let a=r.results[1]?r.results[1].toString().split(" BANK "):[""];1===a.length&&(a=r.results[1]?r.results[1].toString().split(" DIMM"):[""]),a.shift(),n.memSlots=a.length,"arm64"===i.arch()&&(n.memSlots=0,n.memMax=i.totalmem()),e&&e(n),t(n)}))}if(g&&(e&&e(n),t(n)),f)try{const r=[];r.push(o.wmic("baseboard get /value")),r.push(o.wmic("memphysical get MaxCapacity, MemoryDevices\t/value")),o.promiseAll(r).then((r=>{let i=r.results[0]?r.results[0].toString().split("\r\n"):[""];n.manufacturer=o.getValue(i,"manufacturer","="),n.model=o.getValue(i,"model","="),n.model||(n.model=o.getValue(i,"product","=")),n.version=o.getValue(i,"version","="),n.serial=o.getValue(i,"serialnumber","="),n.assetTag=o.getValue(i,"partnumber","="),n.assetTag||(n.assetTag=o.getValue(i,"sku","=")),i=r.results[1]?r.results[1].toString().split("\r\n"):[""],n.memMax=o.toInt(o.getValue(i,"MaxCapacity","="))||null,n.memSlots=o.toInt(o.getValue(i,"MemoryDevices","="))||null,e&&e(n),t(n)}))}catch(r){e&&e(n),t(n)}}))}))},t.chassis=function(e){const t=["Other","Unknown","Desktop","Low Profile Desktop","Pizza Box","Mini Tower","Tower","Portable","Laptop","Notebook","Hand Held","Docking Station","All in One","Sub Notebook","Space-Saving","Lunch Box","Main System Chassis","Expansion Chassis","SubChassis","Bus Expansion Chassis","Peripheral Chassis","Storage Chassis","Rack Mount Chassis","Sealed-Case PC","Multi-System Chassis","Compact PCI","Advanced TCA","Blade","Blade Enclosure","Tablet","Concertible","Detachable","IoT Gateway ","Embedded PC","Mini PC","Stick PC"];return new Promise((n=>{process.nextTick((()=>{let r={manufacturer:"",model:"",type:"",version:"",serial:"-",assetTag:"-",sku:""};if(l||d||h||m){s('echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;\n echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;\n echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;\n echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo;\n echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;',(function(i,s){let a=s.toString().split("\n");r.manufacturer=o.getValue(a,"chassis_vendor");const c=parseInt(o.getValue(a,"chassis_type").replace(/\D/g,""));r.type=c&&!isNaN(c)&&c"]/g,"").split("\n");r.manufacturer=o.getValue(e,"manufacturer","=",!0),r.model=o.getValue(e,"model","=",!0),r.version=o.getValue(e,"version","=",!0),r.serial=o.getValue(e,"ioplatformserialnumber","=",!0),r.assetTag=o.getValue(e,"board-id","=",!0)}e&&e(r),n(r)})),g&&(e&&e(r),n(r)),f)try{o.wmic("path Win32_SystemEnclosure get /value").then(((i,s)=>{if(!s){let e=i.toString().split("\r\n");r.manufacturer=o.getValue(e,"manufacturer","="),r.model=o.getValue(e,"model","=");const n=parseInt(o.getValue(e,"ChassisTypes","=").replace(/\D/g,""));r.type=n&&!isNaN(n)&&n{"use strict";const r=n(3129).exec,i=n(1453);let o=process.platform;const s="linux"===o,a="darwin"===o,c="win32"===o,u="freebsd"===o,l="openbsd"===o,p="netbsd"===o,f="sunos"===o;function d(e){const t={},n=e.split("\n");if(n&&n.length&&n[0].indexOf("Device")>=0){const e=n[0].split(" ");t.bus=parseInt(e[0],10),e[2]?t.deviceId=parseInt(e[2],10):t.deviceId=null}else t.bus=null,t.deviceId=null;const r=i.getValue(n,"idVendor"," ",!0).trim();let o=r.split(" ");o.shift();const s=o.join(" "),a=i.getValue(n,"idProduct"," ",!0).trim();let c=a.split(" ");c.shift();const u=c.join(" ");let l=i.getValue(n,"bInterfaceClass"," ",!0).trim().split(" ");l.shift();const p=l.join(" ");let f=i.getValue(n,"iManufacturer"," ",!0).trim().split(" ");f.shift();const d=f.join(" ");return t.id=(r.startsWith("0x")?r.split(" ")[0].substr(2,10):"")+":"+(a.startsWith("0x")?a.split(" ")[0].substr(2,10):""),t.name=u,t.type=function(e,t){let n=e;const r=(t+" "+e).toLowerCase();return r.indexOf("camera")>=0?n="Camera":r.indexOf("hub")>=0?n="Hub":r.indexOf("keybrd")>=0||r.indexOf("keyboard")>=0?n="Keyboard":r.indexOf("mouse")>=0?n="Mouse":r.indexOf("stora")>=0?n="Storage":r.indexOf("mic")>=0?n="Microphone":(r.indexOf("headset")>=0||r.indexOf("audio")>=0)&&(n="Audio"),n}(p,u),t.removable=null,t.vendor=s,t.manufacturer=d,t.maxPower=i.getValue(n,"MaxPower"," ",!0),t.serialNumber=null,t}function h(e,t){const n={};n.id=t;let r=(e=(e=e.replace(/ \|/g,"")).trim()).split("\n");r.shift();try{for(let e=0;e=0?t="Camera":e.indexOf("touch bar")>=0?t="Touch Bar":e.indexOf("controller")>=0?t="Controller":e.indexOf("headset")>=0?t="Audio":e.indexOf("keyboard")>=0?t="Keyboard":e.indexOf("trackpad")>=0?t="Trackpad":e.indexOf("sensor")>=0?t="Sensor":e.indexOf("bthusb")>=0||e.indexOf("bth")>=0||e.indexOf("rfcomm")>=0?t="Bluetooth":e.indexOf("usbhub")>=0||e.indexOf(" hub")>=0?t="Hub":e.indexOf("mouse")>=0?t="Mouse":e.indexOf("mic")>=0?t="Microphone":e.indexOf("removable")>=0&&(t="Storage"),t}((e.kUSBProductString||e["USB Product Name"]||"").toLowerCase()+(t?" removable":"")),n.removable="no"===e["non-removable"].toLowerCase(),n.vendor=e.kUSBVendorString||e["USB Vendor Name"]||null,n.manufacturer=e.kUSBVendorString||e["USB Vendor Name"]||null,n.maxPower=null,n.serialNumber=e.kUSBSerialNumberString||null,n.name?n:null}catch(e){return null}}function m(e,t){const n=function(e,t){let n="";return t.indexOf("storage")>=0||t.indexOf("speicher")>=0?n="Storage":e.indexOf("usbhub")>=0?n="Hub":e.indexOf("storage")>=0?n="Storage":e.indexOf("usbcontroller")>=0?n="Controller":e.indexOf("keyboard")>=0?n="Keyboard":e.indexOf("pointing")>=0?n="Mouse":e.indexOf("disk")>=0&&(n="Storage"),n}(i.getValue(e,"CreationClassName","=").toLowerCase(),i.getValue(e,"name","=").toLowerCase());if(n){const r={bus:null};return r.deviceId=i.getValue(e,"deviceid","="),r.id=t,r.name=i.getValue(e,"name","="),r.type=n,r.removable=null,r.vendor=null,r.manufacturer=i.getValue(e,"Manufacturer","="),r.maxPower=null,r.serialNumber=null,r}return null}t.usb=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(s){r("export LC_ALL=C; lsusb -v 2>/dev/null; unset LC_ALL",{maxBuffer:134217728},(function(r,i){if(!r){const e=("\n\n"+i.toString()).split("\n\nBus ");for(let t=1;t{"use strict";const r=n(3129).exec,i=n(1453);let o=process.platform;const s="linux"===o,a="darwin"===o,c="win32"===o,u="freebsd"===o,l="openbsd"===o,p="netbsd"===o,f="sunos"===o;let d={dateFormat:"",dateSeperator:"",timeFormat:"",timeSeperator:"",amDesignator:"",pmDesignator:""};function h(e,t){let n=[],r=[],i={},o=!0,s=[],a=[],c={},u=!0;return e.forEach((function(e){if("---"===e)u=!1;else{let t=e.replace(/ +/g," ").split(" ");u?r.push({user:t[0],tty:t[1],date:t[2],time:t[3],ip:t&&t.length>4?t[4].replace(/\(/g,"").replace(/\)/g,""):""}):o?(s=t,s.forEach((function(t){a.push(e.indexOf(t))})),o=!1):(i.user=e.substring(a[0],a[1]-1).trim(),i.tty=e.substring(a[1],a[2]-1).trim(),i.ip=e.substring(a[2],a[3]-1).replace(/\(/g,"").replace(/\)/g,"").trim(),i.command=e.substring(a[7],1e3).trim(),c=r.filter((function(e){return e.user.substring(0,8).trim()===i.user&&e.tty===i.tty})),1===c.length&&n.push({user:c[0].user,tty:c[0].tty,date:c[0].date,time:c[0].time,ip:c[0].ip,command:i.command}))}})),0===n.length&&2===t?r:n}function m(e){let t=[],n=[],r={},i={},o=!0;return e.forEach((function(e){if("---"===e)o=!1;else{let s=e.replace(/ +/g," ").split(" ");o?n.push({user:s[0],tty:s[1],date:(new Date).getFullYear()+"-"+("0"+("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".indexOf(s[2].toUpperCase())/3+1)).slice(-2)+"-"+("0"+s[3]).slice(-2),time:s[4]}):(r.user=s[0],r.tty=s[1],r.ip="-"!==s[2]?s[2]:"",r.command=s.slice(5,1e3).join(" "),i=n.filter((function(e){return e.user===r.user&&(e.tty.substring(3,1e3)===r.tty||e.tty===r.tty)})),1===i.length&&t.push({user:i[0].user,tty:i[0].tty,date:i[0].date,time:i[0].time,ip:r.ip,command:r.command}))}})),t}t.users=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(s&&r('who --ips; echo "---"; w | tail -n +2',(function(i,o){if(i)e&&e(n),t(n);else{let i=o.toString().split("\n");n=h(i,1),0===n.length?r('who; echo "---"; w | tail -n +2',(function(r,o){r||(i=o.toString().split("\n"),n=h(i,2)),e&&e(n),t(n)})):(e&&e(n),t(n))}})),(u||l||p)&&r('who; echo "---"; w -ih',(function(r,i){if(!r){let e=i.toString().split("\n");n=m(e)}e&&e(n),t(n)})),f&&r('who; echo "---"; w -h',(function(r,i){if(!r){let e=i.toString().split("\n");n=m(e)}e&&e(n),t(n)})),a&&r('who; echo "---"; w -ih',(function(r,i){if(!r){let e=i.toString().split("\n");n=m(e)}e&&e(n),t(n)})),c)try{r("query user",i.execOptsWin,(function(r,o){if(o){let r=o.toString().split("\r\n");new Promise((e=>{process.nextTick((()=>{d.dateFormat?e(d):i.powerShell("(get-culture).DateTimeFormat").then((t=>{let n=t.toString().split("\r\n");d.dateFormat=i.getValue(n,"ShortDatePattern",":"),d.dateSeperator=i.getValue(n,"DateSeparator",":"),d.timeFormat=i.getValue(n,"ShortTimePattern",":"),d.timeSeperator=i.getValue(n,"TimeSeparator",":"),d.amDesignator=i.getValue(n,"AMDesignator",":"),d.pmDesignator=i.getValue(n,"PMDesignator",":"),e(d)})).catch((()=>{e(d)}))}))})).then((o=>{n=function(e,t){let n=[];const r=e[0],o=[];if(r){const s=" "===r[0]?1:0;o.push(s-1);let a=0;for(let e=s+1;e{"use strict";const r=n(2087),i=n(5747),o=n(5622),s=n(3129).spawn,a=n(3129).exec,c=n(3129).execSync,u=n(1669);let l=process.platform;const p="linux"===l,f="darwin"===l,d="win32"===l,h="freebsd"===l,m="openbsd"===l,g="netbsd"===l;let v=0,y="",_="";const E=process.env.WINDIR||"C:\\Windows",b={windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:u._extend({},process.env,{LANG:"en_US.UTF-8"})};const w=(new String).replace,S=(new String).toLowerCase,I=(new String).toString,C=(new String).substr,x=(new String).trim,O=(new String).startsWith,T=Math.min;function A(e,t,n,r){n=n||":",t=t.toLowerCase(),r=r||!1;for(let i=0;i=2?(t.shift(),t.join(n).trim()):""}}return""}function N(){if("Windows_NT"===r.type()&&!y&&(y=E+"\\system32\\wbem\\wmic.exe",!i.existsSync(y)))try{const e=c("WHERE WMIC",b).toString().split("\r\n");y=e&&e.length?e[0]:"wmic"}catch(e){y="wmic"}return y}t.toInt=function(e){let t=parseInt(e,10);return isNaN(t)&&(t=0),t},t.execOptsWin=b,t.getCodepage=function(){if(d){if(!_)try{const e=c("chcp",b),t=e.toString().split("\r\n")[0].split(":");_=t.length>1?t[1].replace(".",""):""}catch(e){_="437"}return _}if(p||f||h||m||g){if(!_)try{const e=c("echo $LANG"),t=e.toString().split("\r\n")[0].split(".");_=t.length>1?t[1].trim():"",_||(_="UTF-8")}catch(e){_="UTF-8"}return _}},t.execWin=function(e,t,n){n||(n=t,t=b),a("chcp 65001 > nul && cmd /C "+e+" && chcp "+_+" > nul",t,(function(e,t){n(e,t)}))},t.isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)},t.unique=function(e){let t=[],n={};for(let r=0;ri?1:0}))},t.cores=function(){return 0===v&&(v=r.cpus().length),v},t.getValue=A,t.decodeEscapeSequence=function(e,t){return t=t||16,e.replace(/\\x([0-9A-Fa-f]{2})/g,(function(){return String.fromCharCode(parseInt(arguments[1],t))}))},t.parseDateTime=function(e,t){const n={date:"",time:""};let r=((t=t||{}).dateFormat||"").toLowerCase(),i=t.pmDesignator||"";const o=e.split(" ");if(o[0]){if(o[0].indexOf("/")>=0){const t=o[0].split("/");if(3===t.length)if(4===t[0].length)n.date=t[0]+"-"+("0"+t[1]).substr(-2)+"-"+("0"+t[2]).substr(-2);else if(2===t[2].length)r.indexOf("/d/")>-1||r.indexOf("/dd/"),n.date="20"+t[2]+"-"+("0"+t[1]).substr(-2)+"-"+("0"+t[0]).substr(-2);else{(e.toLowerCase().indexOf("pm")>-1||e.toLowerCase().indexOf("p.m.")>-1||e.toLowerCase().indexOf("p. m.")>-1||e.toLowerCase().indexOf("am")>-1||e.toLowerCase().indexOf("a.m.")>-1||e.toLowerCase().indexOf("a. m.")>-1||r.indexOf("/d/")>-1||r.indexOf("/dd/")>-1)&&0!==r.indexOf("dd/")?n.date=t[2]+"-"+("0"+t[0]).substr(-2)+"-"+("0"+t[1]).substr(-2):n.date=t[2]+"-"+("0"+t[1]).substr(-2)+"-"+("0"+t[0]).substr(-2)}}if(o[0].indexOf(".")>=0){const e=o[0].split(".");3===e.length&&(r.indexOf(".d.")>-1||r.indexOf(".dd.")>-1?n.date=e[2]+"-"+("0"+e[0]).substr(-2)+"-"+("0"+e[1]).substr(-2):n.date=e[2]+"-"+("0"+e[1]).substr(-2)+"-"+("0"+e[0]).substr(-2))}if(o[0].indexOf("-")>=0){const e=o[0].split("-");3===e.length&&(n.date=e[0]+"-"+("0"+e[1]).substr(-2)+"-"+("0"+e[2]).substr(-2))}}if(o[1]){o.shift();let e=o.join(" ");n.time=function(e,t){t=t||"";let n=0,r=0,i=function(e){let t="",n=0;return e.split("").forEach((e=>{e>="0"&&e<="9"?1===n&&n++:(0===n&&n++,1===n&&(t+=e))})),t}(e=e.toUpperCase()),o=e.split(i);if(o.length>=2){o[2]&&(o[1]+=o[2]);let e=o[1]&&o[1].toLowerCase().indexOf("pm")>-1||o[1].toLowerCase().indexOf("p.m.")>-1||o[1].toLowerCase().indexOf("p. m.")>-1||o[1].toLowerCase().indexOf("n")>-1||o[1].toLowerCase().indexOf("ch")>-1||o[1].toLowerCase().indexOf("ös")>-1||t&&o[1].toLowerCase().indexOf(t)>-1;return n=parseInt(o[0],10),r=parseInt(o[1],10),n=e&&n<12?n+12:n,("0"+n).substr(-2)+":"+("0"+r).substr(-2)}}(e,i)}return n},t.parseHead=function(e,t){let n=t>0,r=1,i=0,o=0,s=[];for(let a=0;a{process.nextTick((()=>{try{a(E+"\\system32\\chcp.com 65001 | "+N()+" "+e,t,(function(e,t){n(t,e)})).stdin.end()}catch(e){n("",e)}}))}))},t.darwinXcodeExists=function(){const e=i.existsSync("/Library/Developer/CommandLineTools/usr/bin/"),t=i.existsSync("/Applications/Xcode.app/Contents/Developer/Tools"),n=i.existsSync("/Library/Developer/Xcode/");return e||n||t},t.getVboxmanage=function(){return d?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"},t.powerShell=function(e){let t="";return new Promise((n=>{process.nextTick((()=>{try{const i=s("powershell.exe",["-NoLogo","-InputFormat","Text","-NoExit","-ExecutionPolicy","Unrestricted","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:u._extend({},process.env,{LANG:"en_US.UTF-8"})});if(i&&!i.pid&&i.on("error",(function(){n(t)})),i&&i.pid){i.stdout.on("data",(function(e){t+=e.toString("utf8")})),i.stderr.on("data",(function(){i.kill(),n(t)})),i.on("close",(function(){i.kill(),n(t)})),i.on("error",(function(){i.kill(),n(t)}));try{i.stdin.write(e+r.EOL),i.stdin.write("exit"+r.EOL),i.stdin.end()}catch(e){i.kill(),n(t)}}else n(t)}catch(e){n(t)}}))}))},t.execSafe=function(e,t,n){let r="";return n=n||{},new Promise((i=>{process.nextTick((()=>{try{const o=s(e,t,n);o&&!o.pid&&o.on("error",(function(){i(r)})),o&&o.pid?(o.stdout.on("data",(function(e){r+=e.toString()})),o.on("close",(function(){o.kill(),i(r)})),o.on("error",(function(){o.kill(),i(r)}))):i(r)}catch(e){i(r)}}))}))},t.nanoSeconds=function(){const e=process.hrtime();return Array.isArray(e)&&2===e.length?1e9*+e[0]+ +e[1]:0},t.countUniqueLines=function(e,t){t=t||"";const n=[];return e.forEach((e=>{e.startsWith(t)&&-1===n.indexOf(e)&&n.push(e)})),n.length},t.countLines=function(e,t){t=t||"";const n=[];return e.forEach((e=>{e.startsWith(t)&&n.push(e)})),n.length},t.noop=function(){},t.isRaspberry=function(){let e=[];try{e=i.readFileSync("/proc/cpuinfo",{encoding:"utf8"}).toString().split("\n")}catch(e){return!1}const t=A(e,"hardware");return t&&["BCM2708","BCM2709","BCM2710","BCM2711","BCM2835","BCM2836","BCM2837","BCM2837B0"].indexOf(t)>-1},t.isRaspbian=function(){let e=[];try{e=i.readFileSync("/etc/os-release",{encoding:"utf8"}).toString().split("\n")}catch(e){return!1}const t=A(e,"id","=");return t&&t.indexOf("raspbian")>-1},t.sanitizeShellString=function(e,t=!1){const n=e||"";let r="";for(let e=0;e<=T(n.length,2e3);e++)void 0===n[e]||">"===n[e]||"<"===n[e]||"*"===n[e]||"?"===n[e]||"["===n[e]||"]"===n[e]||"|"===n[e]||"˚"===n[e]||"$"===n[e]||";"===n[e]||"&"===n[e]||"("===n[e]||")"===n[e]||"]"===n[e]||"#"===n[e]||"\\"===n[e]||"\t"===n[e]||"\n"===n[e]||"'"===n[e]||"`"===n[e]||'"'===n[e]||n[e].length>1||t&&"@"===n[e]||t&&" "===n[e]||t&&"{"==n[e]||t&&")"==n[e]||(r+=n[e]);return r},t.isPrototypePolluted=function(){const e="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let t=!0,n="";n.__proto__.replace=w,n.__proto__.toLowerCase=S,n.__proto__.toString=I,n.__proto__.substr=C,t=t||!(62===e.length);const r=Date.now();if("number"==typeof r&&r>16e11){const i=r%100+15;for(let r=0;r{"use strict";const r=n(2087),i=n(3129).exec,o=n(1453);t.vboxInfo=function(e){let t=[];return new Promise((n=>{process.nextTick((()=>{try{i(o.getVboxmanage()+" list vms --long",(function(i,s){let a=(r.EOL+s.toString()).split(r.EOL+"Name:");a.shift(),a.forEach((e=>{const n=("Name:"+e).split(r.EOL),i=o.getValue(n,"State"),s=i.startsWith("running"),a=s?i.replace("running (since ","").replace(")","").trim():"";let c=0;try{if(s){const e=new Date(a),t=e.getTimezoneOffset();c=Math.round((Date.now()-Date.parse(e))/1e3)+60*t}}catch(e){o.noop()}const u=s?"":i.replace("powered off (since","").replace(")","").trim();let l=0;try{if(!s){const e=new Date(u),t=e.getTimezoneOffset();l=Math.round((Date.now()-Date.parse(e))/1e3)+60*t}}catch(e){o.noop()}t.push({id:o.getValue(n,"UUID"),name:o.getValue(n,"Name"),running:s,started:a,runningSince:c,stopped:u,stoppedSince:l,guestOS:o.getValue(n,"Guest OS"),hardwareUUID:o.getValue(n,"Hardware UUID"),memory:parseInt(o.getValue(n,"Memory size"," "),10),vram:parseInt(o.getValue(n,"VRAM size"),10),cpus:parseInt(o.getValue(n,"Number of CPUs"),10),cpuExepCap:o.getValue(n,"CPU exec cap"),cpuProfile:o.getValue(n,"CPUProfile"),chipset:o.getValue(n,"Chipset"),firmware:o.getValue(n,"Firmware"),pageFusion:"enabled"===o.getValue(n,"Page Fusion"),configFile:o.getValue(n,"Config file"),snapshotFolder:o.getValue(n,"Snapshot folder"),logFolder:o.getValue(n,"Log folder"),hpet:"enabled"===o.getValue(n,"HPET"),pae:"enabled"===o.getValue(n,"PAE"),longMode:"enabled"===o.getValue(n,"Long Mode"),tripleFaultReset:"enabled"===o.getValue(n,"Triple Fault Reset"),apic:"enabled"===o.getValue(n,"APIC"),x2Apic:"enabled"===o.getValue(n,"X2APIC"),acpi:"enabled"===o.getValue(n,"ACPI"),ioApic:"enabled"===o.getValue(n,"IOAPIC"),biosApicMode:o.getValue(n,"BIOS APIC mode"),bootMenuMode:o.getValue(n,"Boot menu mode"),bootDevice1:o.getValue(n,"Boot Device 1"),bootDevice2:o.getValue(n,"Boot Device 2"),bootDevice3:o.getValue(n,"Boot Device 3"),bootDevice4:o.getValue(n,"Boot Device 4"),timeOffset:o.getValue(n,"Time offset"),rtc:o.getValue(n,"RTC")})})),e&&e(t),n(t)}))}catch(r){e&&e(t),n(t)}}))}))}},2023:(e,t,n)=>{"use strict";const r=n(2087),i=n(3129).exec,o=n(3129).execSync,s=n(1453);let a=process.platform;const c="linux"===a,u="darwin"===a,l="win32"===a;function p(e){return parseFloat(e)/2-100}function f(e){const t=2*(parseFloat(e)+100);return t<=100?t:100}const d={1:2412,2:2417,3:2422,4:2427,5:2432,6:2437,7:2442,8:2447,9:2452,10:2457,11:2462,12:2467,13:2472,14:2484,32:5160,34:5170,36:5180,38:5190,40:5200,42:5210,44:5220,46:5230,48:5240,50:5250,52:5260,54:5270,56:5280,58:5290,60:5300,62:5310,64:5320,68:5340,96:5480,100:5500,102:5510,104:5520,106:5530,108:5540,110:5550,112:5560,114:5570,116:5580,118:5590,120:5600,122:5610,124:5620,126:5630,128:5640,132:5660,134:5670,136:5680,138:5690,140:5700,142:5710,144:5720,149:5745,151:5755,153:5765,155:5775,157:5785,159:5795,161:5805,165:5825,169:5845,173:5865,183:4915,184:4920,185:4925,187:4935,188:4940,189:4945,192:4960,196:4980};function h(e){return{}.hasOwnProperty.call(d,e)?d[e]:null}function m(e){let t=0;for(let n in d)({}).hasOwnProperty.call(d,n)&&d[n]===e&&(t=s.toInt(n));return t}function g(){const e=[];try{const t=o("iw dev").toString().split("\n").map((e=>e.trim())).join("\n").split("\nInterface ");return t.shift(),t.forEach((t=>{const n=t.split("\n"),r=n[0],i=s.toInt(s.getValue(n,"ifindex"," ")),o=s.getValue(n,"addr"," "),a=s.toInt(s.getValue(n,"channel"," "));e.push({id:i,iface:r,mac:o,channel:a})})),e}catch(e){return[]}}function v(e){const t=`nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${e} 2>/dev/null`;try{const n=o(t).toString().split("\n"),r=s.getValue(n,"GENERAL.CONNECTION");return{iface:e,type:s.getValue(n,"GENERAL.TYPE"),vendor:s.getValue(n,"GENERAL.VENDOR"),product:s.getValue(n,"GENERAL.PRODUCT"),mac:s.getValue(n,"GENERAL.HWADDR").toLowerCase(),ssid:"--"!==r?r:null}}catch(e){return{}}}function y(){const e=[];try{const t=o("nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null",{maxBuffer:2048e4}).toString().split("ACTIVE:");return t.shift(),t.forEach((t=>{const n=(t="ACTIVE:"+t).split(r.EOL),i=s.getValue(n,"CHAN"),o=s.getValue(n,"FREQ").toLowerCase().replace("mhz","").trim(),a=s.getValue(n,"SECURITY").replace("(","").replace(")",""),c=s.getValue(n,"WPA-FLAGS").replace("(","").replace(")",""),u=s.getValue(n,"RSN-FLAGS").replace("(","").replace(")","");e.push({ssid:s.getValue(n,"SSID"),bssid:s.getValue(n,"BSSID").toLowerCase(),mode:s.getValue(n,"MODE"),channel:i?parseInt(i,10):null,frequency:o?parseInt(o,10):null,signalLevel:p(s.getValue(n,"SIGNAL")),quality:parseFloat(s.getValue(n,"SIGNAL")),security:a&&"none"!==a?a.split(" "):[],wpaFlags:c&&"none"!==c?c.split(" "):[],rsnFlags:u&&"none"!==u?u.split(" "):[]})})),e}catch(e){return[]}}function _(e){const t=[];try{let n=o(`export LC_ALL=C; iwlist ${e} scan 2>&1; unset LC_ALL`).toString().split(" Cell ");if(n[0].indexOf("resource busy")>=0)return-1;if(n.length>1){n.shift();for(let e=0;e=0?r[0].split("Address:")[1].trim().toLowerCase():"",a=s.getValue(r,"mode",":",!0),c=s.getValue(r,"frequency",":",!0),u=s.getValue(r,"Quality","=",!0).toLowerCase().split("signal level="),l=u.length>1?s.toInt(u[1]):0,p=l?f(l):0,d=s.getValue(r,"essid",":",!0),h=n[e].indexOf(" WPA ")>=0,m=n[e].indexOf("WPA2 ")>=0,g=[];h&&g.push("WPA"),m&&g.push("WPA2");const v=[];let y="";r.forEach((function(e){const t=e.trim().toLowerCase();if(t.indexOf("group cipher")>=0){y&&v.push(y);const e=t.split(":");e.length>1&&(y=e[1].trim().toUpperCase())}if(t.indexOf("pairwise cipher")>=0){const e=t.split(":");e.length>1&&(e[1].indexOf("tkip")?y=y?"TKIP/"+y:"TKIP":e[1].indexOf("ccmp")?y=y?"CCMP/"+y:"CCMP":e[1].indexOf("proprietary")&&(y=y?"PROP/"+y:"PROP"))}if(t.indexOf("authentication suites")>=0){const e=t.split(":");e.length>1&&(e[1].indexOf("802.1x")?y=y?"802.1x/"+y:"802.1x":e[1].indexOf("psk")&&(y=y?"PSK/"+y:"PSK"))}})),y&&v.push(y),t.push({ssid:d,bssid:o,mode:a,channel:i?s.toInt(i):null,frequency:c?s.toInt(c.replace(".","")):null,signalLevel:l,quality:p,security:g,wpaFlags:v,rsnFlags:[]})}}return t}catch(e){return-1}}t.wifiNetworks=function(e){return new Promise((t=>{process.nextTick((()=>{let n=[];if(c)if(n=y(),0===n.length)try{const r=o("export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL").toString().split("\n\n");let i="";for(let e=0;e1){const e=s.parseHead(a[0],1);e.length>=7&&(a.shift(),a.forEach((t=>{if(t.trim()){const r=t.substring(e[3].from,e[3].to).trim(),i=r?parseInt(r,10):null,o=t.substring(e[2].from,e[2].to).trim(),s=t.substring(e[6].from,1e3).trim().split(" ");let a=[],c=[];s.forEach((e=>{if(e.indexOf("(")>0){const t=e.split("(");a.push(t[0]),c=c.concat(t[1].replace(")","").split(","))}})),c=Array.from(new Set(c)),n.push({ssid:t.substring(e[0].from,e[0].to).trim(),bssid:t.substring(e[1].from,e[1].to).trim().toLowerCase(),mode:"",channel:i,frequency:h(i),signalLevel:o?parseInt(o,10):null,quality:f(o),security:a,wpaFlags:c,rsnFlags:[]})}})))}e&&e(n),t(n)}))}else if(l){i("chcp 65001 && netsh wlan show networks mode=Bssid",s.execOptsWin,(function(i,o){const s=o.toString("utf8").split(r.EOL+r.EOL+"SSID ");s.shift(),s.forEach((e=>{const t=e.split(r.EOL);if(t&&t.length>=8&&t[0].indexOf(":")>=0){let e=t[4].split(":");e.shift(),e=e.join(":").trim().toLowerCase();const r=t[7].split(":").pop().trim(),i=t[5].split(":").pop().trim();n.push({ssid:t[0].split(":").pop().trim(),bssid:e,mode:"",channel:r?parseInt(r,10):null,frequency:h(r),signalLevel:p(i),quality:i?parseInt(i,10):null,security:[t[2].split(":").pop().trim()],wpaFlags:[t[3].split(":").pop().trim()],rsnFlags:[]})}})),e&&e(n),t(n)}))}else e&&e(n),t(n)}))}))},t.wifiConnections=function(e){return new Promise((t=>{process.nextTick((()=>{const n=[];if(c){const r=g(),i=y();r.forEach((e=>{const t=v(e.iface),r=function(e){const t=`wpa_cli -i ${e} status 2>&1`;try{const e=o(t).toString().split("\n"),n=s.toInt(s.getValue(e,"freq","="));return{ssid:s.getValue(e,"ssid","="),uuid:s.getValue(e,"uuid","="),security:s.getValue(e,"key_mgmt","="),freq:n,channel:m(n),bssid:s.getValue(e,"bssid","=").toLowerCase()}}catch(e){return{}}}(e.iface),a=t.ssid||r.ssid,c=i.filter((e=>e.ssid===a)),u=function(e){const t=`nmcli -t --show-secrets connection show ${e} 2>/dev/null`;try{const n=o(t).toString().split("\n"),r=s.getValue(n,"802-11-wireless.seen-bssids").toLowerCase();return{ssid:"--"!==e?e:null,uuid:s.getValue(n,"connection.uuid"),type:s.getValue(n,"connection.type"),autoconnect:"yes"===s.getValue(n,"connection.autoconnect"),security:s.getValue(n,"802-11-wireless-security.key-mgmt"),bssid:"--"!==r?r:null}}catch(e){return{}}}(a),l=c&&c.length&&c[0].channel?c[0].channel:r.channel?r.channel:null,p=c&&c.length&&c[0].bssid?c[0].bssid:r.bssid?r.bssid:null;a&&p&&n.push({id:e.id,iface:e.iface,model:t.product,ssid:a,bssid:c&&c.length&&c[0].bssid?c[0].bssid:r.bssid?r.bssid:null,channel:l,frequency:l?h(l):null,type:u.type?u.type:"802.11",security:u.security?u.security:r.security?r.security:null,signalLevel:c&&c.length&&c[0].signalLevel?c[0].signalLevel:null,txRate:null})})),e&&e(n),t(n)}else if(u){let r="system_profiler SPNetworkDataType";i(r,(function(o,a){const c=a.toString().split("\n\n Wi-Fi:\n\n");if(c.length>1){const o=c[1].split("\n\n")[0].split("\n"),a=s.getValue(o,"BSD Device Name",":",!0),u=s.getValue(o,"hardware",":",!0);r="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I",i(r,(function(r,i){const c=i.toString().split("\n");if(o.length>10){const e=s.getValue(c,"ssid",":",!0),t=s.getValue(c,"bssid",":",!0),r=s.getValue(c,"link auth",":",!0),i=s.getValue(c,"lastTxRate",":",!0),o=s.getValue(c,"channel",":",!0).split(",")[0],l="802.11",p=s.toInt(s.getValue(c,"agrCtlRSSI",":",!0))-s.toInt(s.getValue(c,"agrCtlNoise",":",!0));e&&t&&n.push({id:"Wi-Fi",iface:a,model:u,ssid:e,bssid:t,channel:s.toInt(o),frequency:o?h(o):null,type:l,security:r,signalLevel:p,txRate:i})}e&&e(n),t(n)}))}}))}else if(l){i("netsh wlan show interfaces",s.execOptsWin,(function(r,i){const o=i.toString().split(":\r\n\r\n");o.shift(),o.forEach((e=>{const t=e.split("\r\n");if(t.length>=5){const e=t[0].indexOf(":")>=0?t[0].split(":")[1].trim():"",r=t[1].indexOf(":")>=0?t[1].split(":")[1].trim():"",i=t[2].indexOf(":")>=0?t[2].split(":")[1].trim():"",o=s.getValue(t,"SSID",":",!0),a=s.getValue(t,"BSSID",":",!0),c=s.getValue(t,"Signal",":",!0),u=s.getValue(t,"Radio type",":",!0)||s.getValue(t,"Type de radio",":",!0)||s.getValue(t,"Funktyp",":",!0)||null,l=s.getValue(t,"authentication",":",!0)||s.getValue(t,"Authentification",":",!0)||s.getValue(t,"Authentifizierung",":",!0)||null,p=s.getValue(t,"Channel",":",!0)||s.getValue(t,"Canal",":",!0)||s.getValue(t,"Kanal",":",!0)||null,f=s.getValue(t,"Transmit rate (mbps)",":",!0)||s.getValue(t,"Transmission (mbit/s)",":",!0)||s.getValue(t,"Empfangsrate (MBit/s)",":",!0)||null;r&&i&&o&&a&&n.push({id:i,iface:e,model:r,ssid:o,bssid:a,channel:s.toInt(p),frequency:p?h(p):null,type:u,security:l,signalLevel:c,txRate:s.toInt(f)||null})}})),e&&e(n),t(n)}))}else e&&e(n),t(n)}))}))},t.wifiInterfaces=function(e){return new Promise((t=>{process.nextTick((()=>{const n=[];if(c){g().forEach((e=>{const t=v(e.iface);n.push({id:e.id,iface:e.iface,model:t.product?t.product:null,vendor:t.vendor?t.vendor:null,mac:e.mac})})),e&&e(n),t(n)}else if(u){i("system_profiler SPNetworkDataType",(function(r,i){const o=i.toString().split("\n\n Wi-Fi:\n\n");if(o.length>1){const e=o[1].split("\n\n")[0].split("\n"),t=s.getValue(e,"BSD Device Name",":",!0),r=s.getValue(e,"MAC Address",":",!0),i=s.getValue(e,"hardware",":",!0);n.push({id:"Wi-Fi",iface:t,model:i,vendor:"",mac:r})}e&&e(n),t(n)}))}else if(l){i("netsh wlan show interfaces",s.execOptsWin,(function(r,i){const o=i.toString().split(":\r\n\r\n");o.shift(),o.forEach((e=>{const t=e.split("\r\n");if(t.length>=5){const e=t[0].indexOf(":")>=0?t[0].split(":")[1].trim():"",r=t[1].indexOf(":")>=0?t[1].split(":")[1].trim():"",i=t[2].indexOf(":")>=0?t[2].split(":")[1].trim():"",o=t[3].indexOf(":")>=0?t[3].split(":"):[];o.shift();const s=o.join(":").trim(),a=function(e){let t="";return(e=e.toLowerCase()).indexOf("intel")>=0?t="Intel":e.indexOf("realtek")>=0?t="Realtek":e.indexOf("qualcom")>=0?t="Qualcom":e.indexOf("broadcom")>=0?t="Broadcom":e.indexOf("cavium")>=0?t="Cavium":e.indexOf("cisco")>=0?t="Cisco":e.indexOf("marvel")>=0?t="Marvel":e.indexOf("zyxel")>=0?t="Zyxel":e.indexOf("melanox")>=0?t="Melanox":e.indexOf("d-link")>=0?t="D-Link":e.indexOf("tp-link")>=0?t="TP-Link":e.indexOf("asus")>=0?t="Asus":e.indexOf("linksys")>=0&&(t="Linksys"),t}(r);e&&r&&i&&s&&n.push({id:i,iface:e,model:r,vendor:a,mac:s})}})),e&&e(n),t(n)}))}else e&&e(n),t(n)}))}))}},702:e=>{"use strict";e.exports={i8:"5.6.12"}},6276:(e,t,n)=>{ /*! * Tmp * @@ -14,5 +14,5 @@ * * MIT Licensed */ -const r=n(5747),i=n(2087),o=n(5622),s=n(6417),a={fs:r.constants,os:i.constants},c=n(984),l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",u=/XXXXXX/,p=(a.O_CREAT||a.fs.O_CREAT)|(a.O_EXCL||a.fs.O_EXCL)|(a.O_RDWR||a.fs.O_RDWR),d="win32"===i.platform(),f=a.EBADF||a.os.errno.EBADF,h=a.ENOENT||a.os.errno.ENOENT,m=[],g=r.rmdirSync.bind(r),v=c.sync;let y=!1;function _(e,t){const n=A(e,t),i=n[0],o=n[1];try{P(i)}catch(e){return o(e)}let s=i.tries;!function e(){try{const t=N(i);r.stat(t,(function(n){if(!n)return s-- >0?e():o(new Error("Could not get a unique tmp filename, max tries reached "+t));o(null,t)}))}catch(e){o(e)}}()}function E(e){const t=A(e)[0];P(t);let n=t.tries;do{const e=N(t);try{r.statSync(e)}catch(t){return e}}while(n-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function b(e,t){const n=function(e){if(e&&!k(e))return t(e);t()};0<=e[0]?r.close(e[0],(function(){r.unlink(e[1],n)})):r.unlink(e[1],n)}function w(e){let t=null;try{0<=e[0]&&r.closeSync(e[0])}catch(e){if(!(n=e,M(n,-f,"EBADF")||k(e)))throw e}finally{try{r.unlinkSync(e[1])}catch(e){k(e)||(t=e)}}var n;if(null!==t)throw t}function S(e,t,n,r){const i=C(w,[t,e],r),o=C(b,[t,e],r,i);return n.keep||m.unshift(i),r?i:o}function I(e,t,n){const i=t.unsafeCleanup?c:r.rmdir.bind(r),o=C(t.unsafeCleanup?v:g,e,n),s=C(i,e,n,o);return t.keep||m.unshift(o),n?o:s}function C(e,t,n,r){let i=!1;return function o(s){if(!i){const a=r||o,c=m.indexOf(a);return c>=0&&m.splice(c,1),i=!0,n||e===g||e===v?e(t):e(t,s||function(){})}}}function x(e){let t=[],n=null;try{n=s.randomBytes(e)}catch(t){n=s.pseudoRandomBytes(e)}for(var r=0;r{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LOCAL="LOCAL",e.CLOUD="CLOUD",e.VANILLA="VANILLA",e.VANILLA_KEYWORD="VANILLA_KEYWORD",e.LSP="LSP",e.UNKNOWN="UNKNOWN"}(n||(n={})),t.default=n},6817:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(5104),o=n(7054),s=n(2478),a=n(7498),c=n(8083),l=n(4372),u=n(6136),p=n(4365);t.default=async function(e,t){await r.commands.executeCommand("setContext",p.CAPABILITY_KEY,!0),u.setAssistantMode(u.AssistantMode.Background);let n=!0;o.isCapabilityEnabled(o.Capability.ASSISTANT_BACKGROUND_CAPABILITY)||o.isCapabilityEnabled(o.Capability.ASSISTANT_PASTE_CAPABILITY)&&(n=!1,u.setAssistantMode(u.AssistantMode.Paste)),await r.commands.executeCommand("setContext",p.BACKGROUND_KEY,n);let d=e.globalState.get(p.ACTIVE_STATE_KEY,n);if(null==d&&(d=!0),function(e,t){e.subscriptions.push(r.commands.registerCommand(p.ASSISTANT_TOGGLE_COMMAND,(async()=>{const n=t?"Off":"On",o=`Please reload Visual Studio Code to turn Assistant ${n}.`;await r.window.showInformationMessage(o,"Reload Now")&&(i.default({[s.StatePayload.STATE]:{state_type:c.StateType.toggle,state:n}}),await e.globalState.update(p.ACTIVE_STATE_KEY,!t),r.commands.executeCommand("workbench.action.reloadWindow"))})))}(e,d),d){await c.downloadAssistantBinary()&&(t.dispose(),await a.default(e,t),e.subscriptions.push(r.commands.registerTextEditorCommand(p.ASSISTANT_SELECTION_COMMAND,((e,t,n)=>{l.assistantSelectionHandler(e,t,n)}))),e.subscriptions.push(r.commands.registerTextEditorCommand(p.ASSISTANT_IGNORE_COMMAND,((e,t,n)=>{l.assistantIgnoreHandler(e,t,n)}))),n&&e.subscriptions.push(r.commands.registerCommand(p.ASSISTANT_CLEAR_CACHE_COMMAND,l.assistantClearCacheHandler)),await r.commands.executeCommand("setContext",p.ENABLED_KEY,!0))}}},6167:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(6136),o=n(4365);class s{provideCodeActions(e,t,n){const s=[];return n.diagnostics.filter((e=>e.code===o.TABNINE_DIAGNOSTIC_CODE)).forEach((t=>{t.choices.forEach((n=>{s.push(function(e,t,n){const{range:s}=t,a=`${n.message} '${n.value}'`,c=new r.CodeAction(a,r.CodeActionKind.QuickFix);c.edit=new r.WorkspaceEdit,c.edit.replace(e.uri,new r.Range(s.start,s.end),n.value),i.getAssistantMode()===i.AssistantMode.Paste&&t.references.forEach((t=>{var r;return null===(r=c.edit)||void 0===r?void 0:r.replace(e.uri,t,n.value)}));return c.diagnostics=[t],c.command={arguments:[{currentSuggestion:n,allSuggestions:t.choices,reference:t.reference,threshold:t.threshold}],command:o.ASSISTANT_SELECTION_COMMAND,title:"accept replacement"},c}(e,t,n))}));const n=new r.CodeAction("Ignore TabNine Assistant suggestions at this spot",r.CodeActionKind.QuickFix);n.command={arguments:[{allSuggestions:t.choices,reference:t.reference,threshold:t.threshold,responseId:t.responseId}],command:o.ASSISTANT_IGNORE_COMMAND,title:"ignore replacement"},s.push(n)})),s}}t.default=s,s.providedCodeActionKinds=[r.CodeActionKind.QuickFix]},4372:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assistantIgnoreHandler=t.assistantSelectionHandler=t.assistantClearCacheHandler=void 0;const r=n(7549),i=n(5104),o=n(6291),s=n(2478),a=n(8083),c=n(6835),l=n(7007),u=n(3934),p=n(4365),d=n(7498);function f(e,t,n,r,i,s=!1,a){let c=n.findIndex((e=>e===t));-1===c&&(c=n.length);const l=n.map((e=>({length:e.value.length,strength:h(e),origin:o.default.CLOUD}))),{length:u}=t.value,p=t.value,d=h(t),f=o.default.CLOUD;return{AssistantSelection:{language:e.document.fileName.split(".").pop()||"",length:u,strength:d,origin:f,index:c,threshold:i,num_of_suggestions:n.length,suggestions:l,selected_suggestion:p,reference:r,reference_length:r.length,is_ignore:s,assistant_version:a}}}function h(e){return`${e.score}%`}t.assistantClearCacheHandler=async function(){await c.default(),i.default({[s.StatePayload.STATE]:{state_type:a.StateType.clearCache}})},t.assistantSelectionHandler=async function(e,t,{currentSuggestion:n,allSuggestions:o,reference:s,threshold:a}){try{d.setDecorators([]),await r.commands.executeCommand(p.ASSISTANT_IGNORE_REFRESH_COMMAND);const t=f(e,n,o,s,a,!1,await u.getAssistantVersion());i.default(t)}catch(e){console.error(e)}},t.assistantIgnoreHandler=async function(e,t,{allSuggestions:n,reference:o,threshold:s,responseId:a}){try{await l.default(a),d.setDecorators([]);const t=await u.getAssistantVersion();r.commands.executeCommand(p.ASSISTANT_IGNORE_REFRESH_COMMAND);const c=f(e,{value:"__IGNORE__",score:0,message:""},n,o,s,!0,t);i.default(c)}catch(e){console.error(e)}}},6136:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.getAssistantMode=t.setAssistantMode=t.AssistantMode=void 0,function(e){e[e.Background=0]="Background",e[e.Paste=1]="Paste"}(n=t.AssistantMode||(t.AssistantMode={}));let r=n.Background;t.setAssistantMode=function(e){r=e},t.getAssistantMode=function(){return r}},9158:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4017),i=n(1058),o=n(9688);t.default=class{constructor(){this.numRestarts=0,this.childDead=!1,this.mutex=new r.Mutex,this.resolveMap=new Map,this.isShutdown=!1,this.restartChild()}async post(e,t,n=1e4){var r,i;const o=await this.mutex.acquire();try{this.isChildAlive()||this.restartChild();const s=`${JSON.stringify(e)}\n`;return null===(i=null===(r=this.proc)||void 0===r?void 0:r.stdin)||void 0===i||i.write(s,"utf8"),await new Promise(((e,r)=>{this.resolveMap.set(t,e),setTimeout((()=>{this.resolveMap.delete(t),r(new Error("Timeout"))}),n)}))}catch(e){return void console.log(`interacting with tabnine assistant: ${e}`)}finally{o()}}get shutdowned(){return this.isShutdown}set shutdowned(e){this.isShutdown=e}isChildAlive(){return!!this.proc&&!this.childDead}onChildDeath(){this.childDead=!0,setTimeout((()=>{this.isChildAlive()||this.restartChild()}),1e4)}restartChild(){var e,t;this.numRestarts>=10||(this.numRestarts+=1,this.proc&&this.proc.kill(),this.proc=o.default(),this.childDead=!1,this.proc.on("exit",(()=>{this.shutdowned||this.onChildDeath()})),null===(e=this.proc.stdin)||void 0===e||e.on("error",(e=>{console.log("assistant binary stdin error: ",e),this.onChildDeath()})),null===(t=this.proc.stdout)||void 0===t||t.on("error",(e=>{console.log("assistant binary stdout error:",e),this.onChildDeath()})),this.proc.unref(),this.rl=i.createInterface({input:this.proc.stdout,output:this.proc.stdin}),this.rl.on("line",(e=>{const t=JSON.parse(e),{id:n}=t,{body:r}=t,i=this.resolveMap.get(n);i&&(i(r),this.resolveMap.delete(n))})))}}},3847:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.cancelled=!1,this.callbacks=[]}isCancelled(){return this.cancelled}cancel(){this.isCancelled()||(this.cancelled=!0,this.callbacks.forEach((([e,t])=>e(t))))}reset(){this.cancelled=!1,this.callbacks=[]}registerCallback(e,...t){this.isCancelled()?e(...t):this.callbacks.push([e,t])}}},9064:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentValidator=void 0;const r=n(6151),i=n(6394);class o{constructor(e,t){this.validLanguages=e,this.validExtensions=t}isValid(e){var t,n;const{fileName:r}=e,i=`.${(null==r?void 0:r.split(".").pop())||""}`;return(null===(t=this.validExtensions)||void 0===t?void 0:t.includes(i))&&(null===(n=this.validLanguages)||void 0===n?void 0:n.includes(e.languageId))}}t.DocumentValidator=o,t.default=async function(){const e=await i.default(),t=await r.default();return new o(e,t)}},6680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549);class i extends r.Diagnostic{constructor(e,t,n,r,i,o,s,a,c){super(e,t,c),this.choices=[],this.references=[],this.choices=n,this.reference=r,this.references=i,this.assistantRange=o,this.responseId=s,this.threshold=a}}t.default=i},7498:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setDecorators=void 0;const r=n(7549),i=n(4017),o=n(3847),s=n(6136),a=n(8083),c=n(5104),l=n(9064),u=n(8967),p=n(1785),d=n(6167),f=n(6394),h=n(6680),m=n(4365),g=n(3226),v=r.window.createTextEditorDecorationType({border:"#3794FF 2px",borderStyle:"none none solid none"}),y=new Map;function _(e){const t=r.window.activeTextEditor,n=(null==e?void 0:e.map((({range:e})=>({range:e}))))||[];t&&t.setDecorations(v,n)}function E(e,t=3e4){(null==e?void 0:e.length)&&r.window.setStatusBarMessage(`${e}`,t)}t.setDecorators=_;const b=new i.Mutex,w=new o.default;async function S(e,t,n){var i;w.cancel();const o=await b.acquire();w.reset(),w.registerCallback(E);try{let l=0;const p=function(e,t){const n=y.get(e.uri),i=t.reduce(((e,t)=>e.union(t)));return n&&i.intersection(new r.Range(n,i.end))}(e,n);if(!p)return;const d=e.offsetAt(p.start),f=e.offsetAt(p.end),v=s.getAssistantMode()===s.AssistantMode.Background?g.getBackgroundThreshold():m.PASTE_THRESHOLD,b=e.getText(),S=await a.getAPIKey();if(w.isCancelled())return;const I=await u.default(b,e.fileName,{start:d,end:f},v,m.EDIT_DISTANCE,S,w);if(w.isCancelled())return;const C=[];null==I||I.forEach((t=>{const n=t.completionList.filter((e=>e.value!==t.reference)),i=n.map((e=>`${e.message} '${e.value}'\t${e.score}%`));if(n.length>0){const o=t.references.filter((e=>e.starto.includes(e.assistantRange)));if(s.getAssistantMode()===s.AssistantMode.Background||0===o.length||o.length>0&&a.length>0){const o=new r.Range(e.positionAt(t.range.start),e.positionAt(t.range.end)),s=t.references.map((t=>new r.Range(e.positionAt(t.start),e.positionAt(t.end)))),a=new h.default(o,`${i.join("\n")}`,n,t.reference,s,t.range,t.responseId,v,r.DiagnosticSeverity.Information);a.code=m.TABNINE_DIAGNOSTIC_CODE,C.push(a),l+=1}}})),C.length>0&&c.default({ValidatorState:{num_of_diagnostics:C.length,num_of_locations:(null==I?void 0:I.length)||0}}),(null===(i=t.get(e.uri))||void 0===i?void 0:i.length)!==C.length&&(_(C),t.set(e.uri,C));const x=l?`${l}`:"";console.log(x),E("$(pass)")}catch(e){E(),console.error("tabnine assistant: error: ",e)}finally{o()}}const I=a.debounce(S);let C=null,x=!1;t.default=async function(e,t){const n=r.languages.createDiagnosticCollection("tabnine");e.subscriptions.push(n);const i=await l.default();var o,a;g.initAssistantThreshold(e),function(e,t,n){e.subscriptions.push(r.commands.registerCommand(m.ASSISTANT_IGNORE_REFRESH_COMMAND,(()=>{const e=r.window.activeTextEditor;if(e){const{document:r,visibleRanges:i}=e;t.isValid(r)&&(s.getAssistantMode()===s.AssistantMode.Paste?C&&S(r,n,[null==C?void 0:C.range]):S(r,n,i))}})))}(e,i,n),o=n,a=i,r.commands.registerCommand(m.ASSISTANT_MODE_TOGGLE_COMMAND,(()=>{w.cancel(),r.window.activeTextEditor&&o.delete(r.window.activeTextEditor.document.uri),_([]);const e=s.getAssistantMode()===s.AssistantMode.Background?s.AssistantMode.Paste:s.AssistantMode.Background;s.setAssistantMode(e),s.getAssistantMode()===s.AssistantMode.Paste?(r.window.showInformationMessage("tabnine assistant paste mode"),console.log("paste validation mode")):(r.window.showInformationMessage("tabnine assistant background mode"),console.log("background validation mode")),r.window.activeTextEditor&&a.isValid(r.window.activeTextEditor.document)&&function(e,t){s.getAssistantMode()===s.AssistantMode.Background?r.window.activeTextEditor&&S(e,t,r.window.activeTextEditor.visibleRanges):p.default(e.getText(),e.fileName)}(r.window.activeTextEditor.document,o)})),function(e,t,n){e.subscriptions.push(r.window.onDidChangeTextEditorVisibleRanges((e=>{s.getAssistantMode()===s.AssistantMode.Background&&t.isValid(e.textEditor.document)&&I(e.textEditor.document,n,e.textEditor.visibleRanges)})))}(e,i,n),t.dispose(),function(e,t,n){e.subscriptions.push(r.commands.registerCommand(m.PASTE_COMMAND,(async e=>{x=!0;const{start:i}=e.selection;await r.commands.executeCommand("editor.action.clipboardPasteAction");const{end:o}=e.selection;if(r.window.activeTextEditor){const{document:e}=r.window.activeTextEditor;if(!t.isValid(e)||s.getAssistantMode()===s.AssistantMode.Background)return void(x=!1);C={range:new r.Range(i,o),length:e.offsetAt(o)-e.offsetAt(i)},x=!1,n.delete(e.uri),_([]),S(e,n,[C.range])}})))}(e,i,n),function(e,t,n){e.subscriptions.push(r.workspace.onDidChangeTextDocument((e=>{var i;if(s.getAssistantMode()===s.AssistantMode.Paste&&!x&&n.isValid(e.document)){let n=null,o=0;if(e.contentChanges.forEach((e=>{(null===n||e.range.start.isBefore(n))&&(n=e.range.start),null!==C&&(!e.range.start.isAfterOrEqual(C.range.start)||!e.range.end.isBefore(C.range.end)||e.range.start.isEqual(C.range.start)&&e.range.end.isEqual(C.range.end)?C=null:o+=-e.rangeLength+(e.text.length||0))})),null!==n&&null!==C){const s=null===(i=t.get(e.document.uri))||void 0===i?void 0:i.filter((e=>e.range.end.isBefore(n)));if(t.set(e.document.uri,s),_(s),0!==o){const t=C.length+o,n=e.document.positionAt(e.document.offsetAt(C.range.start)+t);C={range:new r.Range(C.range.start,n),length:t}}I(e.document,t,[C.range])}else t.delete(e.document.uri),_([])}})))}(e,n,i),function(e,t,n){e.subscriptions.push(r.workspace.onDidChangeTextDocument((e=>{var i,o;if(s.getAssistantMode()===s.AssistantMode.Background&&n.isValid(e.document)&&e.contentChanges.length){const n=e.contentChanges.map((e=>e.range.start)).reduce(((e,t)=>null===e||t.isBefore(e)?t:e),null);if(null!==n){const r=null===(i=t.get(e.document.uri))||void 0===i?void 0:i.filter((e=>e.range.end.isBefore(n)));t.set(e.document.uri,r),(null===(o=t.get(e.document.uri))||void 0===o?void 0:o.length)!==(null==r?void 0:r.length)&&_(r),y.has(e.document.uri)||y.set(e.document.uri,n)}else t.delete(e.document.uri),_([]);r.window.activeTextEditor&&I(r.window.activeTextEditor.document,t,r.window.activeTextEditor.visibleRanges)}})))}(e,n,i),async function(e){const t=await f.default();e.subscriptions.push(r.languages.registerCodeActionsProvider(t,new d.default,{providedCodeActionKinds:d.default.providedCodeActionKinds}))}(e)}},4703:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7054);t.default=function(){return r.isCapabilityEnabled(r.Capability.ASSISTANT_MODE_A_CAPABILITY_KEY)?"A":r.isCapabilityEnabled(r.Capability.ASSISTANT_MODE_B_CAPABILITY_KEY)?"B":"A"}},4365:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASSISTANT_TOGGLE_COMMAND=t.ASSISTANT_SET_THRESHOLD_COMMAND=t.ASSISTANT_CLEAR_CACHE_COMMAND=t.PASTE_COMMAND=t.ASSISTANT_MODE_TOGGLE_COMMAND=t.ASSISTANT_IGNORE_REFRESH_COMMAND=t.ASSISTANT_IGNORE_COMMAND=t.ASSISTANT_SELECTION_COMMAND=t.EDIT_DISTANCE=t.PASTE_THRESHOLD=t.THRESHOLD_STATE_KEY=t.CAPABILITY_KEY=t.BACKGROUND_KEY=t.ENABLED_KEY=t.ACTIVE_STATE_KEY=t.TABNINE_DIAGNOSTIC_CODE=t.ASSISTANT_API_VERSION=void 0,t.ASSISTANT_API_VERSION="1.0.0",t.TABNINE_DIAGNOSTIC_CODE="tabnine",t.ACTIVE_STATE_KEY="tabnine-assistant-active",t.ENABLED_KEY="tabnine-assistant:enabled",t.BACKGROUND_KEY="tabnine-assistant:background",t.CAPABILITY_KEY="tabnine-assistant:capability",t.THRESHOLD_STATE_KEY="tabnine-assistant-threshold",t.PASTE_THRESHOLD="Paste",t.EDIT_DISTANCE=2,t.ASSISTANT_SELECTION_COMMAND="tabnine-assistant-select",t.ASSISTANT_IGNORE_COMMAND="tabnine-assistant-ignore",t.ASSISTANT_IGNORE_REFRESH_COMMAND="tabnine-assistant-ignore-refresh",t.ASSISTANT_MODE_TOGGLE_COMMAND="TabNine::assistantModeToggle",t.PASTE_COMMAND="TabNine::paste",t.ASSISTANT_CLEAR_CACHE_COMMAND="TabNine::assistantClearCache",t.ASSISTANT_SET_THRESHOLD_COMMAND="TabNine::assistantSetThreshold",t.ASSISTANT_TOGGLE_COMMAND="TabNine::assistantToggle"},3226:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBackgroundThreshold=t.initAssistantThreshold=void 0;const r=n(7549),i=n(6136),o=n(8083),s=n(5104),a=n(2478),c=n(4365);let l="Medium";t.initAssistantThreshold=function(e){l=e.workspaceState.get(c.THRESHOLD_STATE_KEY,l)||l,function(e){i.getAssistantMode()===i.AssistantMode.Background&&e.subscriptions.push(r.commands.registerCommand(c.ASSISTANT_SET_THRESHOLD_COMMAND,(async()=>{const t=l,n={canPickMany:!1,placeHolder:`Pick threshold (Currently: ${l})`},i=["Low","Medium","High"],u=await r.window.showQuickPick(i,n);u&&i.includes(u)&&(l=u,await e.workspaceState.update(c.THRESHOLD_STATE_KEY,l),s.default({[a.StatePayload.STATE]:{state_type:o.StateType.threshold,state:JSON.stringify({from:t,to:l})}}),r.commands.executeCommand(c.ASSISTANT_IGNORE_REFRESH_COMMAND))})))}(e)},t.getBackgroundThreshold=function(){return l}},6835:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3934);t.default=function(){const e={method:"clear_cache",params:{}};return r.request(e)}},8967:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4703),i=n(3934);t.default=function(e,t,n,o,s,a,c){const l={method:"get_assistant_diagnostics",params:{code:e,fileName:t,visibleRange:n,mode:r.default(),threshold:o,editDistance:s,apiKey:a}};return i.request(l,c)}},1785:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3934);t.default=function(e,t){const n={method:"get_compiler_diagnostics",params:{code:e,fileName:t}};return r.request(n)}},6151:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3934);t.default=function(){const e={method:"get_valid_extensions",params:{}};return r.request(e)}},6394:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3934);t.default=function(){const e={method:"get_valid_languages",params:{}};return r.request(e)}},3934:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeAssistant=t.request=t.getAssistantVersion=void 0;const r=n(9158),i=n(4365),o=n(8083);let s,a=null;async function c(e,t){if(null===a&&(a=new r.default),!a.shutdowned)return new Promise(((n,r)=>{const s=o.getNanoSecTime();null==t||t.registerCallback(n,void 0),null==a||a.post({...e,id:s,version:i.ASSISTANT_API_VERSION},s).then(n,r)}))}t.getAssistantVersion=async function(){return s||(s=await c({method:"get_version",params:{}})),s},t.request=c,t.closeAssistant=function(){if(console.log("assistant is closing"),a){const e={method:"shutdown",params:{}};return a.shutdowned=!0,c(e)}return Promise.resolve()}},7007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3934);t.default=function(e){const t={method:"set_ignore",params:{responseId:e}};return r.request(t)}},9688:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3129),i=n(8083);t.default=function(e=[],t=!1){const n=[...e],o=i.getFullPathToAssistantBinary();return r.spawn(o,n,{stdio:t?"inherit":"pipe"})}},8083:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=t.getNanoSecTime=t.getFullPathToAssistantBinary=t.downloadAssistantBinary=t.getAPIKey=t.StateType=void 0;const r=n(5747),i=n(7211),o=n(7549),s=n(4381),a=n(9973),c=n(1357),l=n(7225),u=r.promises,p="update.tabnine.com",d="tabnine-assistant",f=o.window.createStatusBarItem(o.StatusBarAlignment.Right);t.StateType={threshold:"assistant-set-threshold-from-to",toggle:"assistant-toggle",clearCache:"validtor-clear-cache"};let h=null;function m(e){const t=function(){if("x64"===process.arch)return"x86_64";if("arm64"===process.arch)return"arm64";throw new Error(`Architecture "${process.arch}" is not supported by tabnine assistant`)}(),{target:n,filename:i}=function(){if("win32"===process.platform)return{target:"pc-windows-gnu",filename:"tabnine-assistant.exe"};if("darwin"===process.platform)return{target:"apple-darwin",filename:d};if("linux"===process.platform)return{target:"unknown-linux-musl",filename:d};throw new Error(`Platform "${process.platform}" is not supported by TabNine Assistant`)}(),o=s.getAssistantRootPath();if(void 0===e){const e=l.default(r.readdirSync(o)),s=e.map((e=>`${o}/${e}/${t}-${n}/${i}`)).find((e=>r.existsSync(e)));if(!s)throw new Error(`Couldn't find a TabNine Assistant binary (tried the following local versions: ${e.join(", ")})`);return s}return`${o}/${e}/${t}-${n}/${i}`}t.getAPIKey=async function(){return null===h&&(h=await a.getState()),(null==h?void 0:h.api_key)||""},t.downloadAssistantBinary=async function(){if(null===h&&(h=await a.getState()),!(null==h?void 0:h.cloud_enabled))return!1;let e;try{e=await async function(){return new Promise(((e,t)=>{const n=i.get({timeout:1e4,hostname:p,path:"/assistant/version"},(n=>{let r="";n.on("data",(e=>{r+=e})),n.on("end",(()=>e(r.trim()))),n.on("error",(e=>t(e)))}));n.on("timeout",(()=>t(new Error("Request to assistant version timed out")))),n.on("error",(e=>t(e)))}))}()}catch(e){try{return m(),!0}catch(e){return!1}}return!!await c.asyncExists(m(e))||o.window.withProgress({location:o.ProgressLocation.Notification,cancellable:!0,title:"downloading tabnine assistant..."},((t,n)=>new Promise(((s,a)=>{try{const c=m(e),l=c.slice(0,c.lastIndexOf("/"));u.mkdir(l,{recursive:!0}).then((()=>{let l;const d=i.get({timeout:1e4,hostname:p,path:`/assistant/${c.slice(c.indexOf(e))}`},(i=>{const u=r.createWriteStream(c,{mode:493});u.on("error",(e=>a(e)));let p=0,d=0;i.on("data",(e=>{if(!l)return;p+=e.length;const n=Number((100*p/Number.parseInt(l,10)).toFixed());0===d?t.report({increment:0}):n>d&&t.report({increment:1}),d=n})).on("error",(e=>a(e))).on("end",(()=>{n.isCancellationRequested||(t.report({increment:100}),o.window.showInformationMessage(`TabNine Assistant ${e} binary is successfully downloaded`),s(!0))})).pipe(u).on("error",(e=>a(e))),n.onCancellationRequested((()=>{i.destroy(),u.destroy()}))}));d.on("response",(t=>{f.text="tabnine assistant: $(sync~spin)",f.tooltip=`downloading tabnine assistant ${e} binary`,l=t.headers["content-length"]})),d.on("timeout",(()=>a(new Error("Request to assistant timed out")))),d.on("error",(e=>a(e))),n.onCancellationRequested((()=>{u.unlink(c).catch((e=>a(e))),d.destroy(new Error("Canceled")),a(new Error("Download of tabnine assistant binary has been cancelled"))}))}))}catch(e){a(e)}}))))},t.getFullPathToAssistantBinary=m,t.getNanoSecTime=function(){const[e,t]=process.hrtime();return 1e9*e+t},t.debounce=function(e,t=500){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}}},4533:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(8614),o=n(9973),s=n(2478),a=n(974),c=n(7332),l=n(3926),u="loginHappened";t.default=class{constructor(){this.id=s.BRAND_NAME,this.label=s.BRAND_NAME,this.onDidLogin=new i.EventEmitter,this.myOnDidChangeSessions=new r.EventEmitter,this.initializedDisposable=r.Disposable.from(this.handleSessionChange(),this.pollState())}get onDidChangeSessions(){return this.myOnDidChangeSessions.event}async getSessions(){const e=await this.lastState;return(null==e?void 0:e.is_logged_in)?[new l.default(null==e?void 0:e.user_name)]:[]}async createSession(){await c.callForLogin();const e=await this.waitForLogin();return new l.default(null==e?void 0:e.user_name)}async removeSession(){await c.callForLogout(),this.myOnDidChangeSessions.fire({removed:[(await this.getSessions())[0]]}),await a.sleep(5e3)}dispose(){var e;null===(e=this.initializedDisposable)||void 0===e||e.dispose()}async waitForLogin(){return(await i.once(this.onDidLogin,u))[0]}handleSessionChange(){return r.authentication.onDidChangeSessions((e=>{e.provider.id===s.BRAND_NAME&&this.checkForUpdates()}))}pollState(){const e=setInterval((()=>{this.checkForUpdates()}),1e4);return new r.Disposable((()=>{clearInterval(e)}))}async checkForUpdates(){const e=[],t=[],n=o.getState(),{lastState:r}=this;this.lastState=n;const i=await this.lastState,s=await r;if((null==i?void 0:i.is_logged_in)&&this.onDidLogin.emit(u,i),!(null==s?void 0:s.is_logged_in)&&(null==i?void 0:i.is_logged_in))e.push((await this.getSessions())[0]);else{if(!i||i.is_logged_in||!(null==s?void 0:s.is_logged_in))return;t.push((await this.getSessions())[0])}this.myOnDidChangeSessions.fire({added:e,removed:t})}}},3926:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2478);t.default=class{constructor(e="Tabnine Authentication"){this.id=r.BRAND_NAME,this.scopes=[],this.accessToken="",this.account={id:e,label:e}}}},7332:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callForLogout=t.callForLogin=void 0;const r=n(9973),i=n(9549),o=n(8675);t.callForLogin=function(){return o.default?i.default():r.tabNineProcess.request({Login:{}})},t.callForLogout=async function(){return r.tabNineProcess.request({Logout:{}})}},9342:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4017),i=n(545),o=n(5220),s=n(2478),a=n(974);t.default=class{constructor(){this.mutex=new r.Mutex,this.innerBinary=new i.default,this.consecutiveRestarts=0,this.requestFailures=0,this.isRestarting=!1}init(){return this.startChild()}async request(e,t=1e3){const n=await this.mutex.acquire();try{if(this.isRestarting)return null;if(this.isBinaryDead())return console.warn("Binary died. It is being restarted."),await this.restartChild(),null;const r=await this.innerBinary.request(e,t);return this.consecutiveRestarts=0,this.requestFailures=0,r}catch(e){console.error(e),this.requestFailures+=1,this.requestFailures>s.REQUEST_FAILURES_THRESHOLD&&(console.warn("Binary not returning results, it is being restarted."),await this.restartChild())}finally{n()}return null}isBinaryDead(){var e,t;return null!==(t=null===(e=this.proc)||void 0===e?void 0:e.killed)&&void 0!==t&&t}async resetBinaryForTesting(){const{proc:e,readLine:t}=await o.default([]);this.proc=e,this.innerBinary.init(e,t)}async restartChild(){var e,t;null===(e=this.proc)||void 0===e||e.removeAllListeners(),null===(t=this.proc)||void 0===t||t.kill(),this.isRestarting=!0,this.consecutiveRestarts+=1,this.consecutiveRestarts>=s.CONSECUTIVE_RESTART_THRESHOLD||(await a.sleep(s.restartBackoff(this.consecutiveRestarts)),await this.startChild())}async startChild(){var e,t;const{proc:n,readLine:r}=await o.default([`ide-restart-counter=${this.consecutiveRestarts}`]);this.proc=n,this.proc.unref(),this.proc.on("exit",((e,t)=>{console.warn(`Binary child process exited with code ${null!=e?e:"unknown"} signal ${null!=t?t:"unknown"}`),this.restartChild()})),this.proc.on("error",(e=>{console.warn(`Binary child process error: ${e.message}`),this.restartChild()})),null===(e=this.proc.stdin)||void 0===e||e.on("error",(e=>{console.warn(`Binary child process stdin error: ${e.message}`),this.restartChild()})),null===(t=this.proc.stdout)||void 0===t||t.on("error",(e=>{console.warn(`Binary child process stdout error: ${e.message}`),this.restartChild()})),this.innerBinary.init(n,r),this.isRestarting=!1}}},545:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2478),i=n(8060);t.default=class{init(e,t){this.proc=e,this.onceReader=new i.default(t)}async request(e,t=1e3){const n=await this.requestWithTimeout(e,t);return JSON.parse(n.toString())}requestWithTimeout(e,t){return new Promise(((n,i)=>{var o,s,a;setTimeout((()=>{i(new Error(`Binary request timed out. ${JSON.stringify(e)}`))}),t),null===(o=this.onceReader)||void 0===o||o.onLineRead(n),null===(a=null===(s=this.proc)||void 0===s?void 0:s.stdin)||void 0===a||a.write(`${JSON.stringify({version:r.API_VERSION,request:e})}\n`,"utf8")}))}}},8060:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){this.callbackQueue=[],e.on("line",(e=>{const t=this.callbackQueue.shift();if(!t)throw new Error("Read a response from the engine before a request was written.");t(e)}))}onLineRead(e){this.callbackQueue.push(e)}}},1713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5747),i=n(4381),o=n(4256);t.default=function(){try{const e=i.getActivePath();if(r.existsSync(e)){const t=r.readFileSync(e,"utf-8").trim();if(t===o.BAD_VERSION)return null;const n=i.versionPath(t);if(r.existsSync(n))return n}}catch(e){console.error("Error handling .active file. Falling back to semver sorting",e)}return null}},4256:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BAD_VERSION=void 0;const r=n(1249),i=n(1357),o=n(8638);t.BAD_VERSION="4.0.47";t.default=async function(e){if(e===t.BAD_VERSION||!await i.asyncExists(e))return!1;const{proc:n,readLine:s}=o.runProcess(e,["--print-version"]);return new Promise((t=>{setTimeout((()=>{console.error(`validating ${e} timeout`),t(!1)}),2e3),n.on("exit",((e,n)=>{n&&t(!1)})),n.on("error",(()=>{t(!1)})),s.once("line",(e=>{r.valid(e)?t(!0):t(!1)}))}))}},8022:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5747),i=n(5622),o=n(2106),s=n(1249),a=n(2497),c=n(4381),l=n(9142);async function u(e){try{await r.promises.unlink(e)}catch(e){}}t.default=async function(){const{bundlePath:e,bundleDownloadUrl:t,bundleDirectory:n,executablePath:p}=await async function(){const e=await async function(){const e=c.getUpdateVersionFileUrl(),t=await a.downloadFileToStr(e);return function(e){if(!s.valid(e))throw new Error(`invalid version: ${e}`)}(t),t}(),t=c.getBundlePath(e),n=c.getDownloadVersionUrl(e),r=i.dirname(t),o=c.versionPath(e);return{bundlePath:t,bundleDownloadUrl:n,bundleDirectory:r,executablePath:o}}();try{return await function(e){return r.promises.mkdir(e,{recursive:!0})}(n),await a.downloadFileToDestination(t,e),await async function(e,t){return o(e,{dir:t})}(e,n),await u(e),await async function(e){if(c.isWindows())return Promise.resolve([]);const t=await r.promises.readdir(e);return Promise.all(t.map((t=>r.promises.chmod(i.join(e,t),493))))}(n),l.report(l.EventName.BUNDLE_DOWNLOAD_SUCCESS),p}finally{await u(e)}}},6123:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5747),i=n(7225),o=n(974),s=n(4256),a=n(4381);t.default=async function(){try{const e=await r.promises.readdir(a.getRootPath()),t=i.default(e).map(a.versionPath);return await o.asyncFind(t,s.default)}catch(e){console.error("Error handling existing version. Falling back to downloading",e)}return null}},507:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(2478),o=n(9142),s=n(1713),a=n(8022),c=n(6123);t.default=async function(){const e=s.default();if(e)return e;const t=await c.default();return t||async function(){try{return await async function(){return r.window.withProgress({location:r.ProgressLocation.Notification,title:"Initializing Tabnine"},a.default)}()}catch(e){const t=await c.default();return t||async function(e){return o.reportErrorEvent(o.EventName.BUNDLE_DOWNLOAD_FAILURE,e),o.reportException(e),new Promise(((t,n)=>{r.window.showErrorMessage(i.BUNDLE_DOWNLOAD_FAILURE_MESSAGE,i.RELOAD_BUTTON,i.OPEN_NETWORK_SETUP_HELP).then((t=>{t===i.OPEN_NETWORK_SETUP_HELP?(r.env.openExternal(r.Uri.parse("https://code.visualstudio.com/docs/setup/network")),n(e)):t===i.RELOAD_BUTTON?(r.commands.executeCommand("workbench.action.reloadWindow"),n(e)):n(e)}),n)}))}(e)}}()}},7719:(e,t,n)=>{"use strict";t.mC=t.Lv=t.$m=t.EM=t.eL=void 0;const r=n(4351),i=n(974),o=n(7054);t.eL=r.mock(),t.EM=r.mock(),t.$m=r.mock(),t.Lv=r.mock();let s=()=>{};const a=new Promise((e=>{s=e}));t.mC=[],t.ZP=function(){return r.when(t.eL.killed).thenReturn(!1),r.when(t.eL.stdin).thenReturn(r.instance(t.$m)),r.when(t.eL.stdout).thenReturn(r.instance(t.Lv)),r.when(t.EM.once("line",r.anyFunction())).thenCall(((e,t)=>{t("1.2.3")})),function(){let e=null;r.when(t.EM.on("line",r.anyFunction())).thenCall(((t,n)=>{e=n})),r.when(t.$m.write(r.anyString(),"utf8")).thenCall((n=>{const r=t.mC.find((({isQualified:e})=>e(n)));return null==e||e(r?function(e,t){return JSON.stringify(i.isFunction(t)?t(e):t)}(n,r.result):"null"),!0}))}(),t.mC.push({isQualified:e=>{var t;const n=JSON.parse(e);return!!(null===(t=null==n?void 0:n.request)||void 0===t?void 0:t.Features)},result:{enabled_features:[o.Capability.ALPHA_CAPABILITY,o.Capability.SAVE_SNIPPETS]}}),s(),{proc:r.instance(t.eL),readLine:r.instance(t.EM)}}},4381:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isWindows=t.getUpdateVersionFileUrl=t.getActivePath=t.getAssistantRootPath=t.getRootPath=t.getDownloadVersionUrl=t.getBundlePath=t.versionPath=t.setBinaryRootPath=void 0;const r=n(5747),i=n(5622),o=n(7549),s=n(2478);let a;const c=function(){if("darwin"===process.platform&&"arm64"===process.arch)return"aarch64";if("x32"===process.arch||"ia32"===process.arch)return"i686";if("x64"===process.arch)return"x86_64";throw new Error(`Sorry, the architecture '${process.arch}' is not supported by TabNine.`)}(),l=function(){switch(process.platform){case"win32":return"pc-windows-gnu/TabNine.exe";case"darwin":return"apple-darwin/TabNine";case"linux":return"unknown-linux-musl/TabNine";default:throw new Error(`Sorry, the platform '${process.platform}' is not supported by TabNine.`)}}(),u=`${l.replace(".exe","")}.zip`;t.setBinaryRootPath=async function(e){a=e.extensionMode===o.ExtensionMode.Test?i.join(__dirname,"..","..","binaries"):i.join(e.globalStorageUri.fsPath,"binaries");try{await r.promises.mkdir(a,{recursive:!0})}catch(e){}},t.versionPath=function(e){if(!a)throw new Error("Binary root path not set");return i.join(a,e,`${c}-${l}`)},t.getBundlePath=function(e){if(!a)throw new Error("Binary root path not set");return i.join(a,e,`${c}-${u}`)},t.getDownloadVersionUrl=function(e){return`${s.BINARY_UPDATE_URL}/${e}/${c}-${u}`},t.getRootPath=function(){if(!a)throw new Error("Binary root path not set");return a},t.getAssistantRootPath=function(){if(!a)throw new Error("Binary root path not set");return i.join(a,"..","assistant-binaries")},t.getActivePath=function(){if(!a)throw new Error("Binary root path not set");return i.join(a,".active")},t.getUpdateVersionFileUrl=function(){return s.BINARY_UPDATE_VERSION_FILE_URL},t.isWindows=function(){return"win32"===process.platform}},9838:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9973),i=n(5104),o=n(2478),s=n(7962),a=n(974),c=n(8433),l=1500;function u(e){return Math.floor(e/1024/1024)}t.default=function(){a.withPolling((e=>{r.getState().then((t=>{var n,a;!function(e){var t,n,r;return!(null==e?void 0:e.local_enabled)||(null==e?void 0:e.local_enabled)&&!(null==e?void 0:e.is_cpu_supported)&&!(null==e?void 0:e.cloud_enabled)||(null===(t=null==e?void 0:e.download_state)||void 0===t?void 0:t.status)===c.DownloadStatus.FINISHED||(null===(n=null==e?void 0:e.download_state)||void 0===n?void 0:n.status)===c.DownloadStatus.NOT_STARTED&&!!(null===(r=null==e?void 0:e.download_state)||void 0===r?void 0:r.last_failure)}(t)?(null===(n=null==t?void 0:t.download_state)||void 0===n?void 0:n.status)===c.DownloadStatus.IN_PROGRESS&&(null===(a=null==t?void 0:t.download_state)||void 0===a?void 0:a.kind)===c.DownloadProgress.DOWNLOADING&&(e(),function(){i.default({[o.StatePayload.MESSAGE]:{message_type:o.StateType.PROGRESS}}),s.setLoadingStatus("Initializing... 0%");const e=setInterval((()=>{r.getState().then((t=>{(null==t?void 0:t.download_state.status)===c.DownloadStatus.FINISHED||(null==t?void 0:t.download_state.last_failure)?(s.setDefaultStatus(),clearInterval(e)):s.setLoadingStatus(`Initializing... ${function(e){if(!e)return"0";return(null==e?void 0:e.kind)===c.DownloadProgress.DOWNLOADING?Math.round(u(e.crnt_bytes||0)/u(e.total_bytes||1)*100).toString():"100"}(null==t?void 0:t.download_state)}%`)}))}),l)}()):(e(),s.setDefaultStatus())}))}),l,6e4)}},1666:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendHoverAction=t.getHover=t.HoverActions=void 0;const r=n(9973);!function(e){e[e.NONE=0]="NONE"}(t.HoverActions||(t.HoverActions={})),t.getHover=function(){return r.tabNineProcess.request({Hover:{}})},t.sendHoverAction=async function(e,t,n,i,o){return r.tabNineProcess.request({HoverAction:{id:e,actions:n,notification_type:i,state:o,selected:t}})}},2189:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendNotificationAction=t.getNotifications=void 0;const r=n(9973);t.getNotifications=function(){return r.tabNineProcess.request({Notifications:{}})},t.sendNotificationAction=async function(e,t,n,i,o,s){return r.tabNineProcess.request({NotificationAction:{id:e,selected:n,message:t,notification_type:i,actions:o,state:s}})}},5157:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9973);t.default=function(e){return r.tabNineProcess.request({NotifyWorkspaceChanged:{workspace_folders:e}},5e3).catch(console.error)}},5103:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9973);t.default=function(e){return r.tabNineProcess.request({OpenUrl:{url:e}})}},9973:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.saveSnippet=t.getCapabilities=t.uninstalling=t.deactivate=t.fireEvent=t.getState=t.configuration=t.autocomplete=t.SnippetRequestTrigger=t.resetBinaryForTesting=t.initBinary=t.UserIntent=t.CompletionKind=t.tabNineProcess=void 0;const r=n(9342);t.tabNineProcess=new r.default,function(e){e.Classic="Classic",e.Line="Line",e.Snippet="Snippet"}(t.CompletionKind||(t.CompletionKind={})),function(e){e[e.Comment=0]="Comment",e[e.Block=1]="Block",e[e.FunctionDeclaration=2]="FunctionDeclaration",e[e.NoScope=3]="NoScope",e[e.NewLine=4]="NewLine"}(t.UserIntent||(t.UserIntent={})),t.initBinary=function(){return t.tabNineProcess.init()},t.resetBinaryForTesting=function(){t.tabNineProcess.resetBinaryForTesting()},function(e){e.Auto="Auto",e.User="User"}(t.SnippetRequestTrigger||(t.SnippetRequestTrigger={})),t.autocomplete=function(e,n){return t.tabNineProcess.request({Autocomplete:e},n)},t.configuration=function(e){return t.tabNineProcess.request({Configuration:e},5e3)},t.getState=function(e={}){return t.tabNineProcess.request({State:e})},t.fireEvent=function(e){return t.tabNineProcess.request({Event:e})},t.deactivate=function(){return t.tabNineProcess?t.tabNineProcess.request({Deactivate:{}}):(console.error("No TabNine process"),Promise.resolve(null))},t.uninstalling=function(){return t.tabNineProcess.request({Uninstalling:{}})},t.getCapabilities=async function(){try{const e=await t.tabNineProcess.request({Features:{}},7e3);if(!Array.isArray(null==e?void 0:e.enabled_features))throw new Error("Could not get enabled capabilities");return e}catch(e){return console.error(e),{enabled_features:[]}}},t.saveSnippet=async function(e){return t.tabNineProcess.request({SaveSnippet:e})}},5104:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9973);t.default=function(e){return r.tabNineProcess.request({SetState:{state_type:e}})}},9014:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getStartupActions=void 0;const r=n(9973);t.getStartupActions=function(){return r.tabNineProcess.request({StartupActions:{}})}},9851:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendStatusBarAction=t.getStatus=void 0;const r=n(9973);t.getStatus=function(){return r.tabNineProcess.request({StatusBar:{}})},t.sendStatusBarAction=async function(e,t,n,i,o){return r.tabNineProcess.request({StatusBarAction:{id:e,selected:t,notification_type:n,actions:i,state:o}})}},5220:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(7348),o=n(507),s=n(8638);t.default=async function(e=[],t=!1){var n,a,c,l,u;const p=await o.default(),d=["--client=vscode","--no-lsp=true",i.default.logFilePath?`--log-file-path=${i.default.logFilePath}`:null,"--client-metadata",`clientVersion=${i.default.vscodeVersion}`,`pluginVersion=${null!==(n=i.default.version)&&void 0!==n?n:"unknown"}`,`t9-vscode-AutoImportEnabled=${i.default.isTabNineAutoImportEnabled}`,`t9-vscode-TSAutoImportEnabled=${null!==(a=i.default.isTypeScriptAutoImports)&&void 0!==a?a:"unknown"}`,`t9-vscode-JSAutoImportEnabled=${null!==(c=i.default.isJavaScriptAutoImports)&&void 0!==c?c:"unknown"}`,`vscode-telemetry-enabled=${i.default.isVscodeTelemetryEnabled}`,`vscode-remote=${i.default.isRemote}`,`vscode-remote-name=${i.default.remoteName}`,`vscode-extension-kind=${i.default.extensionKind}`,`vscode-theme-name=${null!==(l=i.default.themeName)&&void 0!==l?l:"unknown"}`,`vscode-theme-kind=${i.default.themeKind}`,`vscode-machine-id=${r.env.machineId}`,`vscode-is-new-app-install=${r.env.isNewAppInstall}`,`vscode-session-id=${r.env.sessionId}`,`vscode-language=${r.env.language}`,`vscode-app-name=${r.env.appName}`,`vscode-beta-channel-enabled=${i.default.isExtentionBetaChannelEnabled}`,`vscode-status-customization=${null!==(u=i.default.statusBarColorCustomizations)&&void 0!==u?u:"unknown"}`,...e].filter((e=>null!==e));return s.runProcess(p,d,{stdio:t?"inherit":"pipe"})}},8638:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.runProcess=void 0;const r=n(3129),i=n(1058),o=n(7549),s=n(6096),a=n(9142);t.runProcess=function(e,t,c={}){var l;if((null===(l=s.getTabnineExtensionContext())||void 0===l?void 0:l.extensionMode)===o.ExtensionMode.Test)return n(7719).ZP();a.report(a.EventName.START_BINARY);const u=t?r.spawn(e,t,c):r.spawn(e,c),p=u.stdout;return{proc:u,readLine:i.createInterface({input:p,output:u.stdin})}}},4905:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2478),i=n(9913),o=n(9014),s=n(974);t.default=async function(){await s.sleep(r.BINARY_STARTUP_GRACE);const e=await o.getStartupActions();return(null==e?void 0:e.actions.includes(r.MessageActions.OPEN_HUB))?i.openConfigWithSource(r.StateType.STARTUP)():Promise.resolve()}},8433:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmuMode=t.Mode=t.OSArchTarget=t.DownloadProgress=t.DownloadStatus=void 0,function(e){e.FINISHED="Finished",e.NOT_STARTED="NotStarted",e.IN_PROGRESS="InProgress"}(t.DownloadStatus||(t.DownloadStatus={})),function(e){e.DOWNLOADING="Downloading",e.RETRIEVING_METADATA="RetrievingMetadata",e.VERIFYING_CHECKSUM="VerifyingChecksum"}(t.DownloadProgress||(t.DownloadProgress={})),function(e){e.APPLE_64="x86_64-apple-darwin"}(t.OSArchTarget||(t.OSArchTarget={})),function(e){e.RELEASE="Release"}(t.Mode||(t.Mode={})),function(e){e.NATIVE="Native"}(t.EmuMode||(t.EmuMode={}))},7054:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fetchCapabilitiesOnFocus=t.isCapabilityEnabled=t.Capability=void 0;const r=n(7549),i=n(9973);!function(e){e.ON_BOARDING_CAPABILITY="vscode.onboarding",e.ASSISTANT_CAPABILITY="vscode.assistant",e.ASSISTANT_MODE_A_CAPABILITY_KEY="vscode.assistant.mode.A",e.ASSISTANT_MODE_B_CAPABILITY_KEY="vscode.assistant.mode.B",e.ASSISTANT_BACKGROUND_CAPABILITY="vscode.assistant.background",e.ASSISTANT_PASTE_CAPABILITY="vscode.assistant.paste",e.SUGGESTIONS_SINGLE="suggestions-single",e.SUGGESTIONS_TWO="suggestions-two",e.SUGGESTIONS_ORIGINAL="suggestions-original",e.ALPHA_CAPABILITY="vscode.validator",e.SHOW_AGRESSIVE_STATUS_BAR_UNTIL_CLICKED="promoteHub1",e.INLINE_SUGGESTIONS="inline_suggestions_mode",e.SNIPPET_SUGGESTIONS="snippet_suggestions",e.SNIPPET_AUTO_TRIGGER="snippet_auto_trigger",e.LEFT_TREE_VIEW="vscode.left_tree_view",e.EMPTY_LINE_SUGGESTIONS="empty_line_suggestions",e.AUTHENTICATION="vscode.authentication",e.NOTIFICATIONS_WIDGET="vscode.notifications-widget",e.TABNINE_TODAY_WIDGET="vscode.tabnine-today-widget",e.SAVE_SNIPPETS="save_snippets",e.BETA_CAPABILITY="beta"}(t.Capability||(t.Capability={}));const o={};function s(e){i.getCapabilities().then((t=>{null==t||t.enabled_features.forEach((e=>{o[e]=!0})),e()}))}t.isCapabilityEnabled=function(e){return o[e]},t.fetchCapabilitiesOnFocus=function(){return new Promise((e=>{if(r.window.state.focused)console.log("capabilities resolved immediately"),s(e);else{const t=r.window.onDidChangeWindowState((({focused:n})=>{t.dispose(),console.log(`capabilities resolved on focus ${n}`),s(e)}))}}))}},1988:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SuggestionsMode=void 0;const r=n(7054);var i;!function(e){e[e.INLINE=0]="INLINE",e[e.AUTOCOMPLETE=1]="AUTOCOMPLETE"}(i=t.SuggestionsMode||(t.SuggestionsMode={})),t.default=function(){return r.isCapabilityEnabled(r.Capability.INLINE_SUGGESTIONS)?i.INLINE:i.AUTOCOMPLETE}},2617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TABNINE_CONFIG_CONTEXT_KEY=t.TABNINE_TOKEN_CONTEXT_KEY=t.TABNINE_CONFIG_FILE_PATH=t.TABNINE_CONFIG_FILE_NAME=t.TABNINE_TOKEN_FILE_PATH=t.TABNINE_TOKEN_FILE_NAME=t.TABNINE_CONFIG_DIR=void 0;const r=n(5622),i=n(2087);t.TABNINE_CONFIG_DIR=r.join(i.homedir(),".config","TabNine"),t.TABNINE_TOKEN_FILE_NAME=".refresh_token_v2",t.TABNINE_TOKEN_FILE_PATH=r.join(t.TABNINE_CONFIG_DIR,t.TABNINE_TOKEN_FILE_NAME),t.TABNINE_CONFIG_FILE_NAME="tabnine_config.json",t.TABNINE_CONFIG_FILE_PATH=r.join(t.TABNINE_CONFIG_DIR,t.TABNINE_CONFIG_FILE_NAME),t.TABNINE_TOKEN_CONTEXT_KEY="TABNINE_TOKEN",t.TABNINE_CONFIG_CONTEXT_KEY="TABNINE_CONFIG"},8675:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=!!process.env.GITPOD_REPO_ROOT||!!process.env.CODESPACES},9549:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(9973),o=n(2478),s=n(9980);t.default=async function(){const e=await i.configuration({quiet:!0,source:o.StateType.AUTH});if(e&&e.message){const t=await r.env.asExternalUri(r.Uri.parse(e.message)),n=`https://app.tabnine.com/auth/sign-in?tabnineUrl=${t.toString()}&sync=false`;await s.default(t),r.env.openExternal(r.Uri.parse(n))}}},9191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5747),i=n(2617),o=n(1357);t.default=async function(e){await o.ensureExists(i.TABNINE_CONFIG_DIR),e.globalState.setKeysForSync([i.TABNINE_TOKEN_CONTEXT_KEY,i.TABNINE_CONFIG_CONTEXT_KEY]),await async function(e){const t=e.globalState.get(i.TABNINE_TOKEN_CONTEXT_KEY),n=e.globalState.get(i.TABNINE_CONFIG_CONTEXT_KEY);t&&await r.promises.writeFile(i.TABNINE_TOKEN_FILE_PATH,t).catch((e=>{console.error("Error occurred while trying to load Tabnine token",e)}));n&&await r.promises.writeFile(i.TABNINE_CONFIG_FILE_PATH,n).catch((e=>{console.error("Error occurred while trying to load Tabnine config",e)}))}(e),function(e){r.watch(i.TABNINE_CONFIG_DIR,((t,n)=>{switch(n){case i.TABNINE_TOKEN_FILE_NAME:"rename"===t?e.globalState.update(i.TABNINE_TOKEN_CONTEXT_KEY,null):r.promises.readFile(i.TABNINE_TOKEN_FILE_PATH,"utf8").then((t=>e.globalState.update(i.TABNINE_TOKEN_CONTEXT_KEY,t))).catch((e=>{console.error("Error occurred while trying to persist Tabnine token",e)}));break;case i.TABNINE_CONFIG_FILE_NAME:r.promises.readFile(i.TABNINE_CONFIG_FILE_PATH,"utf8").then((t=>e.globalState.update(i.TABNINE_CONFIG_CONTEXT_KEY,t))).catch((e=>{console.error("Error occurred while trying to persist Tabnine config",e)}))}}))}(e)}},9913:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.openConfigWithSource=t.registerCommands=t.SAVE_SNIPPET_COMMAND=t.STATUS_BAR_COMMAND=t.CONFIG_COMMAND=void 0;const r=n(7549),i=n(9980),o=n(2478),s=n(9973),a=n(5104),c=n(7054),l=n(663);function u(e){return async(t=null)=>{const n=await s.configuration({quiet:!0,source:e});if(n&&n.message){const e=await r.env.asExternalUri(r.Uri.parse(n.message));i.default(e)}a.default({[o.StatePayload.STATE]:{state_type:(null==t?void 0:t.join("-"))||e}})}}t.CONFIG_COMMAND="TabNine::config",t.STATUS_BAR_COMMAND="TabNine.statusBar",t.SAVE_SNIPPET_COMMAND="Tabnine.saveSnippet",t.registerCommands=async function(e){e.subscriptions.push(r.commands.registerCommand(t.CONFIG_COMMAND,u(o.StateType.PALLETTE))),e.subscriptions.push(r.commands.registerCommand(t.STATUS_BAR_COMMAND,function(e){const t=u(o.StateType.STATUS);return async(n=null)=>{await t(n),c.isCapabilityEnabled(c.Capability.SHOW_AGRESSIVE_STATUS_BAR_UNTIL_CLICKED)&&await e.globalState.update(o.STATUS_BAR_FIRST_TIME_CLICKED,!0)}}(e))),c.isCapabilityEnabled(c.Capability.SAVE_SNIPPETS)&&(await l.enableSaveSnippetContext(),e.subscriptions.push(r.commands.registerCommand(t.SAVE_SNIPPET_COMMAND,l.default)))},t.openConfigWithSource=u},1880:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=[/Import ([\S]*) from module [\S]*/,/Add ([\S]*) to existing import declaration from [\S]*/,/Import default ([\S]*) from module [\S]*/,/Add default import ([\S]*) to existing import declaration from [\S]*/];function r({title:e}){const t=n.map((t=>t.exec(e))).find(Boolean);return t&&t[1]}t.default=function(e=[]){const t=e.filter((({title:e})=>n.some((t=>t.test(e))))),i=t.map(r);return t.filter((e=>i.filter((t=>t===r(e))).length<=1))}},2478:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TABNINE_APP_URL=t.TABNINE_OPEN_APP_COMMAND=t.SNIPPET_COMMAND=t.TABNINE_TREE_NAVIGATION_COMMAND=t.PREV_INLINE_COMMAND=t.NEXT_INLINE_COMMAND=t.ESCAPE_INLINE_COMMAND=t.ACCEPT_INLINE_COMMAND=t.SLEEP_TIME_BEFORE_OPEN_HUB=t.IS_OSX=t.restartBackoff=t.MessageActions=t.StatePayload=t.StateType=t.COMPLETION_TRIGGERS=t.PROGRESS_KEY=t.DEFAULT_DETAIL=t.BETA_CHANNEL_MESSAGE_SHOWN_KEY=t.ALPHA_VERSION_KEY=t.MINIMAL_SUPPORTED_VSCODE_API=t.LATEST_RELEASE_URL=t.INSTALL_COMMAND=t.OPEN_LP_FROM_STATUS_BAR=t.STATUS_BAR_FIRST_TIME_CLICKED=t.STATUS_BAR_NOTIFICATION_PERIOD=t.BINARY_STATUS_BAR_FIRST_MESSAGE_POLLING_INTERVAL=t.BINARY_STATUS_BAR_POLLING_INTERVAL=t.BINARY_NOTIFICATION_POLLING_INTERVAL=t.BINARY_STARTUP_GRACE=t.DELAY_FOR_CODE_ACTION_PROVIDER=t.WAIT_BEFORE_RESTART_MILLIS=t.REQUEST_FAILURES_THRESHOLD=t.CONSECUTIVE_RESTART_THRESHOLD=t.MAX_NUM_RESULTS=t.CHAR_LIMIT=t.INSTRUMENTATION_KEY=t.STATUS_NAME=t.OPEN_ISSUE_LINK=t.RELOAD_BUTTON=t.DOWNLOAD_RETRY=t.OPEN_NETWORK_SETUP_HELP=t.OPEN_ISSUE_BUTTON=t.BUNDLE_DOWNLOAD_FAILURE_MESSAGE=t.FULL_BRAND_REPRESENTATION=t.LIMITATION_SYMBOL=t.BRAND_NAME=t.ATTRIBUTION_BRAND=t.BINARY_UPDATE_VERSION_FILE_URL=t.BINARY_UPDATE_URL=t.API_VERSION=void 0,t.URI_SCHEME_FILE=void 0;const r=n(8675);t.API_VERSION="4.1.21",t.BINARY_UPDATE_URL="https://update.tabnine.com/bundles",t.BINARY_UPDATE_VERSION_FILE_URL=`${t.BINARY_UPDATE_URL}/version`,t.ATTRIBUTION_BRAND="⌬ ",t.BRAND_NAME="tabnine",t.LIMITATION_SYMBOL="🔒",t.FULL_BRAND_REPRESENTATION=t.ATTRIBUTION_BRAND+t.BRAND_NAME,t.BUNDLE_DOWNLOAD_FAILURE_MESSAGE="Tabnine Extension was unable to download its dependencies. Please check your internet connection. If you use a proxy server, please visit https://code.visualstudio.com/docs/setup/network",t.OPEN_ISSUE_BUTTON="Open issue",t.OPEN_NETWORK_SETUP_HELP="Help",t.DOWNLOAD_RETRY="Retry",t.RELOAD_BUTTON="Reload",t.OPEN_ISSUE_LINK="https://github.com/codota/tabnine-vscode/issues/new",t.STATUS_NAME="Tabnine",t.INSTRUMENTATION_KEY="38efe475-3afd-4e03-8af2-bbcfdeee3b7a",t.CHAR_LIMIT=1e5,t.MAX_NUM_RESULTS=5,t.CONSECUTIVE_RESTART_THRESHOLD=100,t.REQUEST_FAILURES_THRESHOLD=20,t.WAIT_BEFORE_RESTART_MILLIS=1e3,t.DELAY_FOR_CODE_ACTION_PROVIDER=800,t.BINARY_STARTUP_GRACE=+(process.env.BINARY_NOTIFICATION_POLLING_INTERVAL||9e3),t.BINARY_NOTIFICATION_POLLING_INTERVAL=+(process.env.BINARY_NOTIFICATION_POLLING_INTERVAL||1e4),t.BINARY_STATUS_BAR_POLLING_INTERVAL=+(process.env.BINARY_STATUS_BAR_POLLING_INTERVAL||36e5),t.BINARY_STATUS_BAR_FIRST_MESSAGE_POLLING_INTERVAL=+(process.env.BINARY_NOTIFICATION_POLLING_INTERVAL||1e4),t.STATUS_BAR_NOTIFICATION_PERIOD=+(process.env.STATUS_BAR_NOTIFICATION_PERIOD||12e4),t.STATUS_BAR_FIRST_TIME_CLICKED="status-bar-first-time-clicked",t.OPEN_LP_FROM_STATUS_BAR="tabnine:open_lp",t.INSTALL_COMMAND="workbench.extensions.installExtension",t.LATEST_RELEASE_URL="https://api.github.com/repos/codota/tabnine-vscode/releases",t.MINIMAL_SUPPORTED_VSCODE_API="1.35.0",t.ALPHA_VERSION_KEY="tabnine.alpha.version",t.BETA_CHANNEL_MESSAGE_SHOWN_KEY="tabnine.joinBetaChannelMessageShown",t.DEFAULT_DETAIL=t.BRAND_NAME,t.PROGRESS_KEY="tabnine.hide.progress",t.COMPLETION_TRIGGERS=[" ",".","(",")","{","}","[","]",",",":","'",'"',"=","<",">","/","\\","+","-","|","&","*","%","=","$","#","@","!"],function(e){e.ERROR="error",e.INFO="info",e.PROGRESS="progress",e.STATUS="status",e.PALLETTE="pallette",e.NOTIFICATION="notification",e.STARTUP="startup",e.TREE_VIEW="treeView",e.NOTIFICATIONS_WIDGET_WEBVIEW="notificationsWidgetWebview",e.TABNINE_TODAY_WIDGET_WEBVIEW="tabnineTodayWidgetWebview",e.AUTH="auth"}(t.StateType||(t.StateType={})),function(e){e.MESSAGE="Message",e.STATE="State",e.NOTIFICATION_SHOWN="NotificationShown",e.STATUS_SHOWN="StatusShown",e.HOVER_SHOWN="HoverShown",e.HINT_SHOWN="HintShown",e.SNIPPET_SHOWN="SnippetShown"}(t.StatePayload||(t.StatePayload={})),function(e){e.NONE="None",e.OPEN_HUB="OpenHub",e.OPEN_LP="OpenLp",e.OPEN_BUY="OpenBuy",e.OPEN_SIGNUP="OpenSignup"}(t.MessageActions||(t.MessageActions={}));t.restartBackoff=function(e){return Math.min(1e3*2**Math.min(e,10),36e5)},t.IS_OSX="darwin"===process.platform,t.SLEEP_TIME_BEFORE_OPEN_HUB=r.default?1e4:0,t.ACCEPT_INLINE_COMMAND="tabnine.accept-inline-suggestion",t.ESCAPE_INLINE_COMMAND="tabnine.escape-inline-suggestion",t.NEXT_INLINE_COMMAND="tabnine.next-inline-suggestion",t.PREV_INLINE_COMMAND="tabnine.prev-inline-suggestion",t.TABNINE_TREE_NAVIGATION_COMMAND="tabnine:navigation",t.SNIPPET_COMMAND="tabnine.snippet-suggestion",t.TABNINE_OPEN_APP_COMMAND="tabnine:open-app",t.TABNINE_APP_URL="https://app.tabnine.com",t.URI_SCHEME_FILE="file"},4401:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5747),i=n(7549),o=n(5622),s=n(2087),a=n(9030),c="TabNine.tabnine-vscode",l="argv.json",u=o.join(i.env.appRoot,"product.json"),p=["",`\t"enable-proposed-api": ["${c}"]`,"}"];t.default=async function(){return async function(){const e=await async function(){const e=await r.promises.readFile(u),t=JSON.parse(e.toString("utf8"));return null==t?void 0:t.dataFolderName}();if(e){const t=function(e){const t=process.env.VSCODE_PORTABLE;if(t)return o.join(t,l);return o.join(s.homedir(),e,l)}(e),n=(await r.promises.readFile(t)).toString();if(n.includes(`${c}`))return!0;const u=function(e){return e.substring(0,e.length-2).concat(",\n",p.join("\n"))}(n);await r.promises.writeFile(t,Buffer.from(u)),a.default({messageId:"inline-update",messageText:"Please reload the window for the Tabnine inline completions to take effect.",buttonText:"Reload",action:()=>{i.commands.executeCommand("workbench.action.reloadWindow")}})}return!1}().catch((e=>(console.error("failed to enable proposedAPI",e),!1)))}},6096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTabnineExtensionContext=t.setTabnineExtensionContext=void 0;let n=null;t.setTabnineExtensionContext=function(e){n=e},t.getTabnineExtensionContext=function(){return n}},7348:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i="tabnine-vscode";function o(){return r.workspace.getConfiguration("workbench")}const s=function(){const e=r.extensions.all.find((e=>e.id.includes(i))),t=r.workspace.getConfiguration(),n=t.get("javascript.suggest.autoImports"),s=t.get("typescript.suggest.autoImports"),a="tabnine.experimentalAutoImports",c=t.get("tabnine.logFilePath");let l=t.get(a);const{remoteName:u}=r.env,{extensionKind:p}=e,d=!!u&&2===p,f=null===l;!1!==l&&(l=!0,t.update(a,l,!0));const h=t.get("tabnine.receiveBetaChannelUpdates")||!1,m=r.env.appName.toLocaleLowerCase().includes("insider");return{get extensionPath(){return null==e?void 0:e.extensionPath},get version(){return(null==e?void 0:e.packageJSON).version},get id(){return null==e?void 0:e.id},get name(){var e;return`tabnine-vscode-${null!==(e=this.version)&&void 0!==e?e:"unknown"}`},get vscodeVersion(){return r.version},get isTabNineAutoImportEnabled(){return!!l},get isJavaScriptAutoImports(){return n},get isTypeScriptAutoImports(){return s},get logFilePath(){return c?`${c}-${process.pid}`:""},get isRemote(){return d},get remoteName(){return u},get extensionKind(){return p},get themeKind(){return r.ColorThemeKind[r.window.activeColorTheme.kind]},get themeName(){return o().get("colorTheme")},get statusBarColorCustomizations(){const e=o().get("colorCustomizations");return null==e?void 0:e["statusBar.background"]},get isInstalled(){return f},get isVscodeTelemetryEnabled(){return r.workspace.getConfiguration("telemetry").get("enableTelemetry",!0)},get isExtentionBetaChannelEnabled(){return h},get isVscodeInsiders(){return m}}}();t.default=s},5011:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInlineSuggestionApiSupported=void 0;const r=n(1249),i=n(7348);t.default=function(){return r.gte(i.default.vscodeVersion,"1.54.0")},t.isInlineSuggestionApiSupported=function(){return r.gte(i.default.vscodeVersion,"1.58.0")}},3329:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5747),i=n(5622),o=n(7348);t.default=function(e){var t;try{const n=i.dirname(null!==(t=o.default.extensionPath)&&void 0!==t?t:""),s=i.join(n,".obsolete"),a=e=>0!==e.size,c=(e,t)=>new Date(e.mtimeMs)>=new Date(t.atimeMs),l=e=>1!==e.filter((e=>!!o.default.id&&e.toLowerCase().includes(o.default.id.toLowerCase()))).length,u=(t,i)=>{a(t)&&c(t,i)&&r.readFile(s,((t,i)=>{if(t)throw console.error("failed to read .obsolete file:",t),t;r.readdir(n,((t,a)=>{if(t)throw console.error(`failed to read ${n} directory:`,t),t;!l(a)&&i.includes(o.default.name)&&e().then((()=>{r.unwatchFile(s,u)})).catch((e=>{console.error("failed to report uninstall:",e)}))}))}))};r.watchFile(s,u)}catch(e){console.error("failed to invoke uninstall:",e)}}},5784:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDecorationContains=void 0;const r=n(7549),i=n(5104),o=n(2478),s=n(678),a=r.window.createTextEditorDecorationType({after:{margin:"0 0 0 1rem"}});let c,l;function u(e,t){var n;const i=s.getLogoPath(e),o=null===(n=t.options[0])||void 0===n?void 0:n.key,a=o?`command:${o}`:"https://www.tabnine.com",c=t.message?`[![tabnine](${i}|width=100)](${a}) \n${t.message}`:"",l=new r.MarkdownString(c,!0);return l.isTrusted=!0,l}t.default=function(e,t,n){c={renderOptions:{after:{contentText:n.title,color:"gray"}},range:new r.Range(new r.Position(e.line,e.character),new r.Position(e.line,1024)),hoverMessage:u(t,n)},function(e=10){l&&clearTimeout(l);l=setTimeout((()=>{var e;return c&&(null===(e=r.window.activeTextEditor)||void 0===e?void 0:e.setDecorations(a,[c]))}),e)}(),i.default({[o.StatePayload.HINT_SHOWN]:{id:n.id,text:n.title,notification_type:n.notification_type,state:null}})},t.isDecorationContains=function(e){return!!(null==c?void 0:c.range.contains(e))},r.workspace.onDidChangeTextDocument((()=>{return null===(e=r.window.activeTextEditor)||void 0===e||e.setDecorations(a,[]),void(c=null);var e}))},5955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7549),i=n(1666);let o=[];t.default=function(e,t){o.forEach((e=>!!e.dispose())),o=[],e.options.forEach((n=>{const s=r.commands.registerCommand(n.key,(()=>{i.sendHoverAction(e.id,n.key,n.actions,e.notification_type,e.state)}));o.push(s),t.subscriptions.push(s)}))}},8806:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.provideHover=void 0;const r=n(1666),i=n(2478),o=n(5104),s=n(5955),a=n(5784);let c=null;t.provideHover=function(e,t){return function(e){c&&a.isDecorationContains(e)&&o.default({[i.StatePayload.HOVER_SHOWN]:{id:c.id,text:c.message,notification_type:c.notification_type,state:c.state}})}(t),null},t.default=async function(e,t){c=await r.getHover(),(null==c?void 0:c.title)&&(s.default(c,e),a.default(t,e,c))}},9136:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2478),i=n(1264);t.default=function(){return{setLoading:function(){return i.default('\n Loading ...\n \n ')},setUrl:function(e){return i.default(`\n \n