@nsshunt/stsobservability 1.0.73 → 1.0.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("lodash.clonedeep"), require("detect-node"), require("@nsshunt/stsutils"), require("tiny-emitter"), require("node:https"), require("axios"), require("vue"), require("socket.io-client")) : typeof define === "function" && define.amd ? define(["exports", "lodash.clonedeep", "detect-node", "@nsshunt/stsutils", "tiny-emitter", "node:https", "axios", "vue", "socket.io-client"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsobservability"] = {}, global2.lodash, global2["detect-node"], global2.stsutils, global2["tiny-emitter"], global2.https, global2.axios, global2.vue, global2.socket["io-client"]));
3
- })(this, function(exports2, _cloneDeep, isNode, stsutils, tinyEmitter, https, axios, vue, socket_ioClient) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("lodash.clonedeep"), require("detect-node"), require("@nsshunt/stsutils"), require("tiny-emitter"), require("axios"), require("node:https"), require("vue"), require("socket.io-client")) : typeof define === "function" && define.amd ? define(["exports", "lodash.clonedeep", "detect-node", "@nsshunt/stsutils", "tiny-emitter", "axios", "node:https", "vue", "socket.io-client"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsobservability"] = {}, global2.lodash, global2["detect-node"], global2.stsutils, global2["tiny-emitter"], global2.axios, global2.https, global2.vue, global2.socket["io-client"]));
3
+ })(this, function(exports2, _cloneDeep, isNode, stsutils, tinyEmitter, axios, https, vue, socket_ioClient) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __typeError = (msg) => {
6
6
  throw TypeError(msg);
@@ -21,7 +21,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
21
21
  }
22
22
  });
23
23
 
24
- var _a, _label, _options, _data, _val, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _httpsAgent, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _publisher, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn, _socketIoServerHelperOptions, _namespace, _SetupStandardEvents, _SetupConnectionMiddleware, _SetupMessageMiddleware;
24
+ var _a, _label, _options2, _data2, _val, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _agentManager2, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _publisher, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options3, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options4, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options5, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options6, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options7, _sockets, _httpsAgent2, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn, _socketIoServerHelperOptions, _namespace, _SetupStandardEvents, _SetupConnectionMiddleware, _SetupMessageMiddleware;
25
25
  var Gauge = /* @__PURE__ */ ((Gauge2) => {
26
26
  Gauge2["ACTIVE_REQUEST_GAUGE"] = "a";
27
27
  Gauge2["AUTHENTICATION_COUNT_GAUGE"] = "b";
@@ -78,15 +78,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
78
78
  //protected _data: Record<string, any> = { };
79
79
  constructor(options = {}) {
80
80
  __privateAdd(this, _label, "");
81
- __privateAdd(this, _options, null);
82
- __privateAdd(this, _data, {});
81
+ __privateAdd(this, _options2, null);
82
+ __privateAdd(this, _data2, {});
83
83
  __publicField(this, _a, GaugeTypes.INSTRUMENT_OBJECT);
84
84
  // Default Gauge type
85
85
  __publicField(this, "val");
86
86
  if (typeof options === "string" || options instanceof String) {
87
87
  throw new Error("Instrument parameter must be an options object.");
88
88
  }
89
- __privateSet(this, _options, options);
89
+ __privateSet(this, _options2, options);
90
90
  if (options.label) {
91
91
  __privateSet(this, _label, options.label);
92
92
  } else {
@@ -101,12 +101,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
101
101
  propertyNames.forEach((propertyName) => {
102
102
  Object.defineProperty(this, propertyName, {
103
103
  enumerable: true,
104
- get: () => __privateGet(this, _data)[propertyName],
104
+ get: () => __privateGet(this, _data2)[propertyName],
105
105
  set: (value) => {
106
106
  if (value === void 0) {
107
107
  return;
108
108
  }
109
- __privateGet(this, _data)[propertyName] = value;
109
+ __privateGet(this, _data2)[propertyName] = value;
110
110
  }
111
111
  });
112
112
  });
@@ -119,10 +119,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
119
119
  }
120
120
  }
121
121
  get options() {
122
- return __privateGet(this, _options);
122
+ return __privateGet(this, _options2);
123
123
  }
124
124
  set options(optionsValue) {
125
- __privateSet(this, _options, optionsValue);
125
+ __privateSet(this, _options2, optionsValue);
126
126
  }
127
127
  get label() {
128
128
  return __privateGet(this, _label);
@@ -162,8 +162,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
162
162
  */
163
163
  }
164
164
  _label = new WeakMap();
165
- _options = new WeakMap();
166
- _data = new WeakMap();
165
+ _options2 = new WeakMap();
166
+ _data2 = new WeakMap();
167
167
  class InstrumentVelocityOptions extends InstrumentBaseOptions {
168
168
  constructor() {
169
169
  super(...arguments);
@@ -1199,6 +1199,30 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1199
1199
  function getDefaultExportFromCjs(x) {
1200
1200
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1201
1201
  }
1202
+ function getAugmentedNamespace(n) {
1203
+ if (n.__esModule) return n;
1204
+ var f = n.default;
1205
+ if (typeof f == "function") {
1206
+ var a = function a2() {
1207
+ if (this instanceof a2) {
1208
+ return Reflect.construct(f, arguments, this.constructor);
1209
+ }
1210
+ return f.apply(this, arguments);
1211
+ };
1212
+ a.prototype = f.prototype;
1213
+ } else a = {};
1214
+ Object.defineProperty(a, "__esModule", { value: true });
1215
+ Object.keys(n).forEach(function(k) {
1216
+ var d = Object.getOwnPropertyDescriptor(n, k);
1217
+ Object.defineProperty(a, k, d.get ? d : {
1218
+ enumerable: true,
1219
+ get: function() {
1220
+ return n[k];
1221
+ }
1222
+ });
1223
+ });
1224
+ return a;
1225
+ }
1202
1226
  var timsort$1 = {};
1203
1227
  (function(exports3) {
1204
1228
  (function(global2, factory) {
@@ -2470,13 +2494,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
2470
2494
  }
2471
2495
  _tinyEmitter = new WeakMap();
2472
2496
  _RequestCompleted = new WeakMap();
2473
- var ansiStyles$1 = { exports: {} };
2474
- var colorName;
2475
- var hasRequiredColorName;
2476
- function requireColorName() {
2477
- if (hasRequiredColorName) return colorName;
2478
- hasRequiredColorName = 1;
2479
- colorName = {
2497
+ var ansiStyles$3 = { exports: {} };
2498
+ var colorName$1;
2499
+ var hasRequiredColorName$1;
2500
+ function requireColorName$1() {
2501
+ if (hasRequiredColorName$1) return colorName$1;
2502
+ hasRequiredColorName$1 = 1;
2503
+ colorName$1 = {
2480
2504
  "aliceblue": [240, 248, 255],
2481
2505
  "antiquewhite": [250, 235, 215],
2482
2506
  "aqua": [0, 255, 255],
@@ -2626,14 +2650,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
2626
2650
  "yellow": [255, 255, 0],
2627
2651
  "yellowgreen": [154, 205, 50]
2628
2652
  };
2629
- return colorName;
2653
+ return colorName$1;
2630
2654
  }
2631
- var conversions;
2632
- var hasRequiredConversions;
2633
- function requireConversions() {
2634
- if (hasRequiredConversions) return conversions;
2635
- hasRequiredConversions = 1;
2636
- const cssKeywords = requireColorName();
2655
+ var conversions$1;
2656
+ var hasRequiredConversions$1;
2657
+ function requireConversions$1() {
2658
+ if (hasRequiredConversions$1) return conversions$1;
2659
+ hasRequiredConversions$1 = 1;
2660
+ const cssKeywords = requireColorName$1();
2637
2661
  const reverseKeywords = {};
2638
2662
  for (const key of Object.keys(cssKeywords)) {
2639
2663
  reverseKeywords[cssKeywords[key]] = key;
@@ -2655,7 +2679,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
2655
2679
  apple: { channels: 3, labels: ["r16", "g16", "b16"] },
2656
2680
  gray: { channels: 1, labels: ["gray"] }
2657
2681
  };
2658
- conversions = convert;
2682
+ conversions$1 = convert;
2659
2683
  for (const model of Object.keys(convert)) {
2660
2684
  if (!("channels" in convert[model])) {
2661
2685
  throw new Error("missing channels property: " + model);
@@ -3298,14 +3322,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3298
3322
  const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
3299
3323
  return [val / 255 * 100];
3300
3324
  };
3301
- return conversions;
3325
+ return conversions$1;
3302
3326
  }
3303
- var route;
3304
- var hasRequiredRoute;
3305
- function requireRoute() {
3306
- if (hasRequiredRoute) return route;
3307
- hasRequiredRoute = 1;
3308
- const conversions2 = requireConversions();
3327
+ var route$1;
3328
+ var hasRequiredRoute$1;
3329
+ function requireRoute$1() {
3330
+ if (hasRequiredRoute$1) return route$1;
3331
+ hasRequiredRoute$1 = 1;
3332
+ const conversions2 = requireConversions$1();
3309
3333
  function buildGraph() {
3310
3334
  const graph = {};
3311
3335
  const models = Object.keys(conversions2);
@@ -3344,18 +3368,18 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3344
3368
  };
3345
3369
  }
3346
3370
  function wrapConversion(toModel, graph) {
3347
- const path = [graph[toModel].parent, toModel];
3371
+ const path2 = [graph[toModel].parent, toModel];
3348
3372
  let fn = conversions2[graph[toModel].parent][toModel];
3349
3373
  let cur = graph[toModel].parent;
3350
3374
  while (graph[cur].parent) {
3351
- path.unshift(graph[cur].parent);
3375
+ path2.unshift(graph[cur].parent);
3352
3376
  fn = link(conversions2[graph[cur].parent][cur], fn);
3353
3377
  cur = graph[cur].parent;
3354
3378
  }
3355
- fn.conversion = path;
3379
+ fn.conversion = path2;
3356
3380
  return fn;
3357
3381
  }
3358
- route = function(fromModel) {
3382
+ route$1 = function(fromModel) {
3359
3383
  const graph = deriveBFS(fromModel);
3360
3384
  const conversion = {};
3361
3385
  const models = Object.keys(graph);
@@ -3369,15 +3393,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3369
3393
  }
3370
3394
  return conversion;
3371
3395
  };
3372
- return route;
3396
+ return route$1;
3373
3397
  }
3374
- var colorConvert;
3375
- var hasRequiredColorConvert;
3376
- function requireColorConvert() {
3377
- if (hasRequiredColorConvert) return colorConvert;
3378
- hasRequiredColorConvert = 1;
3379
- const conversions2 = requireConversions();
3380
- const route2 = requireRoute();
3398
+ var colorConvert$1;
3399
+ var hasRequiredColorConvert$1;
3400
+ function requireColorConvert$1() {
3401
+ if (hasRequiredColorConvert$1) return colorConvert$1;
3402
+ hasRequiredColorConvert$1 = 1;
3403
+ const conversions2 = requireConversions$1();
3404
+ const route2 = requireRoute$1();
3381
3405
  const convert = {};
3382
3406
  const models = Object.keys(conversions2);
3383
3407
  function wrapRaw(fn) {
@@ -3430,10 +3454,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3430
3454
  convert[fromModel][toModel].raw = wrapRaw(fn);
3431
3455
  });
3432
3456
  });
3433
- colorConvert = convert;
3434
- return colorConvert;
3457
+ colorConvert$1 = convert;
3458
+ return colorConvert$1;
3435
3459
  }
3436
- ansiStyles$1.exports;
3460
+ ansiStyles$3.exports;
3437
3461
  (function(module2) {
3438
3462
  const wrapAnsi16 = (fn, offset) => (...args) => {
3439
3463
  const code = fn(...args);
@@ -3467,16 +3491,16 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3467
3491
  let colorConvert2;
3468
3492
  const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
3469
3493
  if (colorConvert2 === void 0) {
3470
- colorConvert2 = requireColorConvert();
3494
+ colorConvert2 = requireColorConvert$1();
3471
3495
  }
3472
3496
  const offset = isBackground ? 10 : 0;
3473
3497
  const styles2 = {};
3474
3498
  for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
3475
- const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
3499
+ const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
3476
3500
  if (sourceSpace === targetSpace) {
3477
- styles2[name] = wrap(identity, offset);
3501
+ styles2[name2] = wrap(identity, offset);
3478
3502
  } else if (typeof suite === "object") {
3479
- styles2[name] = wrap(suite[targetSpace], offset);
3503
+ styles2[name2] = wrap(suite[targetSpace], offset);
3480
3504
  }
3481
3505
  }
3482
3506
  return styles2;
@@ -3570,13 +3594,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3570
3594
  enumerable: true,
3571
3595
  get: assembleStyles
3572
3596
  });
3573
- })(ansiStyles$1);
3574
- var ansiStylesExports = ansiStyles$1.exports;
3575
- var browser = {
3597
+ })(ansiStyles$3);
3598
+ var ansiStylesExports$1 = ansiStyles$3.exports;
3599
+ var browser$2 = {
3576
3600
  stdout: false,
3577
3601
  stderr: false
3578
3602
  };
3579
- const stringReplaceAll$1 = (string, substring, replacer) => {
3603
+ const stringReplaceAll$3 = (string, substring, replacer) => {
3580
3604
  let index = string.indexOf(substring);
3581
3605
  if (index === -1) {
3582
3606
  return string;
@@ -3592,7 +3616,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3592
3616
  returnValue += string.substr(endIndex);
3593
3617
  return returnValue;
3594
3618
  };
3595
- const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
3619
+ const stringEncaseCRLFWithFirstIndex$3 = (string, prefix, postfix, index) => {
3596
3620
  let endIndex = 0;
3597
3621
  let returnValue = "";
3598
3622
  do {
@@ -3604,15 +3628,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3604
3628
  returnValue += string.substr(endIndex);
3605
3629
  return returnValue;
3606
3630
  };
3607
- var util = {
3608
- stringReplaceAll: stringReplaceAll$1,
3609
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
3631
+ var util$1 = {
3632
+ stringReplaceAll: stringReplaceAll$3,
3633
+ stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$3
3610
3634
  };
3611
- var templates;
3612
- var hasRequiredTemplates;
3613
- function requireTemplates() {
3614
- if (hasRequiredTemplates) return templates;
3615
- hasRequiredTemplates = 1;
3635
+ var templates$1;
3636
+ var hasRequiredTemplates$1;
3637
+ function requireTemplates$1() {
3638
+ if (hasRequiredTemplates$1) return templates$1;
3639
+ hasRequiredTemplates$1 = 1;
3616
3640
  const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
3617
3641
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
3618
3642
  const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
@@ -3640,7 +3664,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3640
3664
  }
3641
3665
  return ESCAPES.get(c) || c;
3642
3666
  }
3643
- function parseArguments(name, arguments_) {
3667
+ function parseArguments(name2, arguments_) {
3644
3668
  const results = [];
3645
3669
  const chunks = arguments_.trim().split(/\s*,\s*/g);
3646
3670
  let matches;
@@ -3651,7 +3675,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3651
3675
  } else if (matches = chunk.match(STRING_REGEX)) {
3652
3676
  results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
3653
3677
  } else {
3654
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
3678
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
3655
3679
  }
3656
3680
  }
3657
3681
  return results;
@@ -3661,12 +3685,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3661
3685
  const results = [];
3662
3686
  let matches;
3663
3687
  while ((matches = STYLE_REGEX.exec(style)) !== null) {
3664
- const name = matches[1];
3688
+ const name2 = matches[1];
3665
3689
  if (matches[2]) {
3666
- const args = parseArguments(name, matches[2]);
3667
- results.push([name].concat(args));
3690
+ const args = parseArguments(name2, matches[2]);
3691
+ results.push([name2].concat(args));
3668
3692
  } else {
3669
- results.push([name]);
3693
+ results.push([name2]);
3670
3694
  }
3671
3695
  }
3672
3696
  return results;
@@ -3690,7 +3714,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3690
3714
  }
3691
3715
  return current;
3692
3716
  }
3693
- templates = (chalk2, temporary) => {
3717
+ templates$1 = (chalk2, temporary) => {
3694
3718
  const styles2 = [];
3695
3719
  const chunks = [];
3696
3720
  let chunk = [];
@@ -3720,92 +3744,92 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3720
3744
  }
3721
3745
  return chunks.join("");
3722
3746
  };
3723
- return templates;
3747
+ return templates$1;
3724
3748
  }
3725
- const ansiStyles = ansiStylesExports;
3726
- const { stdout: stdoutColor, stderr: stderrColor } = browser;
3749
+ const ansiStyles$2 = ansiStylesExports$1;
3750
+ const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$2;
3727
3751
  const {
3728
- stringReplaceAll,
3729
- stringEncaseCRLFWithFirstIndex
3730
- } = util;
3731
- const { isArray } = Array;
3732
- const levelMapping = [
3752
+ stringReplaceAll: stringReplaceAll$2,
3753
+ stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
3754
+ } = util$1;
3755
+ const { isArray: isArray$1 } = Array;
3756
+ const levelMapping$1 = [
3733
3757
  "ansi",
3734
3758
  "ansi",
3735
3759
  "ansi256",
3736
3760
  "ansi16m"
3737
3761
  ];
3738
- const styles = /* @__PURE__ */ Object.create(null);
3739
- const applyOptions = (object, options = {}) => {
3762
+ const styles$1 = /* @__PURE__ */ Object.create(null);
3763
+ const applyOptions$1 = (object, options = {}) => {
3740
3764
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
3741
3765
  throw new Error("The `level` option should be an integer from 0 to 3");
3742
3766
  }
3743
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
3767
+ const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
3744
3768
  object.level = options.level === void 0 ? colorLevel : options.level;
3745
3769
  };
3746
- class ChalkClass {
3770
+ let ChalkClass$1 = class ChalkClass {
3747
3771
  constructor(options) {
3748
- return chalkFactory(options);
3772
+ return chalkFactory$1(options);
3749
3773
  }
3750
- }
3751
- const chalkFactory = (options) => {
3774
+ };
3775
+ const chalkFactory$1 = (options) => {
3752
3776
  const chalk2 = {};
3753
- applyOptions(chalk2, options);
3754
- chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
3755
- Object.setPrototypeOf(chalk2, Chalk.prototype);
3777
+ applyOptions$1(chalk2, options);
3778
+ chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
3779
+ Object.setPrototypeOf(chalk2, Chalk$1.prototype);
3756
3780
  Object.setPrototypeOf(chalk2.template, chalk2);
3757
3781
  chalk2.template.constructor = () => {
3758
3782
  throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
3759
3783
  };
3760
- chalk2.template.Instance = ChalkClass;
3784
+ chalk2.template.Instance = ChalkClass$1;
3761
3785
  return chalk2.template;
3762
3786
  };
3763
- function Chalk(options) {
3764
- return chalkFactory(options);
3787
+ function Chalk$1(options) {
3788
+ return chalkFactory$1(options);
3765
3789
  }
3766
- for (const [styleName, style] of Object.entries(ansiStyles)) {
3767
- styles[styleName] = {
3790
+ for (const [styleName, style] of Object.entries(ansiStyles$2)) {
3791
+ styles$1[styleName] = {
3768
3792
  get() {
3769
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
3793
+ const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
3770
3794
  Object.defineProperty(this, styleName, { value: builder });
3771
3795
  return builder;
3772
3796
  }
3773
3797
  };
3774
3798
  }
3775
- styles.visible = {
3799
+ styles$1.visible = {
3776
3800
  get() {
3777
- const builder = createBuilder(this, this._styler, true);
3801
+ const builder = createBuilder$1(this, this._styler, true);
3778
3802
  Object.defineProperty(this, "visible", { value: builder });
3779
3803
  return builder;
3780
3804
  }
3781
3805
  };
3782
- const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
3783
- for (const model of usedModels) {
3784
- styles[model] = {
3806
+ const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
3807
+ for (const model of usedModels$1) {
3808
+ styles$1[model] = {
3785
3809
  get() {
3786
3810
  const { level } = this;
3787
3811
  return function(...arguments_) {
3788
- const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
3789
- return createBuilder(this, styler, this._isEmpty);
3812
+ const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
3813
+ return createBuilder$1(this, styler, this._isEmpty);
3790
3814
  };
3791
3815
  }
3792
3816
  };
3793
3817
  }
3794
- for (const model of usedModels) {
3818
+ for (const model of usedModels$1) {
3795
3819
  const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
3796
- styles[bgModel] = {
3820
+ styles$1[bgModel] = {
3797
3821
  get() {
3798
3822
  const { level } = this;
3799
3823
  return function(...arguments_) {
3800
- const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
3801
- return createBuilder(this, styler, this._isEmpty);
3824
+ const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
3825
+ return createBuilder$1(this, styler, this._isEmpty);
3802
3826
  };
3803
3827
  }
3804
3828
  };
3805
3829
  }
3806
- const proto = Object.defineProperties(() => {
3830
+ const proto$1 = Object.defineProperties(() => {
3807
3831
  }, {
3808
- ...styles,
3832
+ ...styles$1,
3809
3833
  level: {
3810
3834
  enumerable: true,
3811
3835
  get() {
@@ -3816,7 +3840,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3816
3840
  }
3817
3841
  }
3818
3842
  });
3819
- const createStyler = (open, close, parent) => {
3843
+ const createStyler$1 = (open, close, parent) => {
3820
3844
  let openAll;
3821
3845
  let closeAll;
3822
3846
  if (parent === void 0) {
@@ -3834,20 +3858,20 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3834
3858
  parent
3835
3859
  };
3836
3860
  };
3837
- const createBuilder = (self2, _styler, _isEmpty) => {
3861
+ const createBuilder$1 = (self2, _styler, _isEmpty) => {
3838
3862
  const builder = (...arguments_) => {
3839
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
3840
- return applyStyle(builder, chalkTag(builder, ...arguments_));
3863
+ if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
3864
+ return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
3841
3865
  }
3842
- return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
3866
+ return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
3843
3867
  };
3844
- Object.setPrototypeOf(builder, proto);
3868
+ Object.setPrototypeOf(builder, proto$1);
3845
3869
  builder._generator = self2;
3846
3870
  builder._styler = _styler;
3847
3871
  builder._isEmpty = _isEmpty;
3848
3872
  return builder;
3849
3873
  };
3850
- const applyStyle = (self2, string) => {
3874
+ const applyStyle$1 = (self2, string) => {
3851
3875
  if (self2.level <= 0 || !string) {
3852
3876
  return self2._isEmpty ? "" : string;
3853
3877
  }
@@ -3858,20 +3882,20 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3858
3882
  const { openAll, closeAll } = styler;
3859
3883
  if (string.indexOf("\x1B") !== -1) {
3860
3884
  while (styler !== void 0) {
3861
- string = stringReplaceAll(string, styler.close, styler.open);
3885
+ string = stringReplaceAll$2(string, styler.close, styler.open);
3862
3886
  styler = styler.parent;
3863
3887
  }
3864
3888
  }
3865
3889
  const lfIndex = string.indexOf("\n");
3866
3890
  if (lfIndex !== -1) {
3867
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
3891
+ string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
3868
3892
  }
3869
3893
  return openAll + string + closeAll;
3870
3894
  };
3871
- let template;
3872
- const chalkTag = (chalk2, ...strings) => {
3895
+ let template$1;
3896
+ const chalkTag$1 = (chalk2, ...strings) => {
3873
3897
  const [firstString] = strings;
3874
- if (!isArray(firstString) || !isArray(firstString.raw)) {
3898
+ if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
3875
3899
  return strings.join(" ");
3876
3900
  }
3877
3901
  const arguments_ = strings.slice(1);
@@ -3882,18 +3906,18 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3882
3906
  String(firstString.raw[i2])
3883
3907
  );
3884
3908
  }
3885
- if (template === void 0) {
3886
- template = requireTemplates();
3909
+ if (template$1 === void 0) {
3910
+ template$1 = requireTemplates$1();
3887
3911
  }
3888
- return template(chalk2, parts.join(""));
3912
+ return template$1(chalk2, parts.join(""));
3889
3913
  };
3890
- Object.defineProperties(Chalk.prototype, styles);
3891
- const chalk = Chalk();
3892
- chalk.supportsColor = stdoutColor;
3893
- chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
3894
- chalk.stderr.supportsColor = stderrColor;
3895
- var source = chalk;
3896
- const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
3914
+ Object.defineProperties(Chalk$1.prototype, styles$1);
3915
+ const chalk$1 = Chalk$1();
3916
+ chalk$1.supportsColor = stdoutColor$1;
3917
+ chalk$1.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
3918
+ chalk$1.stderr.supportsColor = stderrColor$1;
3919
+ var source = chalk$1;
3920
+ const chalk$2 = /* @__PURE__ */ getDefaultExportFromCjs(source);
3897
3921
  function utf8Count(str) {
3898
3922
  var strLength = str.length;
3899
3923
  var byteLength = 0;
@@ -4532,160 +4556,2309 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4532
4556
  var encoder = new Encoder(options);
4533
4557
  return encoder.encodeSharedRef(value);
4534
4558
  }
4535
- class PublishTransportRESTServer extends stsutils.STSOptionsBase {
4536
- constructor(options) {
4537
- super(options);
4538
- __privateAdd(this, _httpsAgent);
4539
- // Returns true for success or false for failure.
4540
- __publicField(this, "Publish", async (payload) => {
4541
- try {
4542
- if (this.options.showPublishPayload) {
4543
- console.log(chalk$1.grey(`PublishTransportRESTServer::Publish() url: [${this.options.url}]`));
4544
- console.log(payload);
4545
- }
4546
- const encodedData = encode(payload, { ignoreUndefined: true });
4547
- const headers = { "Content-Type": "application/octet-stream" };
4548
- let retVal = null;
4549
- if (this.options.socketPath) {
4550
- retVal = await axios({
4551
- method: "post",
4552
- //data: payload,
4553
- data: Buffer.from(encodedData),
4554
- headers,
4555
- httpsAgent: __privateGet(this, _httpsAgent),
4556
- socketPath: this.options.socketPath
4557
- });
4558
- } else {
4559
- if (isNode) {
4560
- retVal = await axios({
4561
- //url: `${goptions.imendpoint}:${goptions.import}${goptions.imapiroot}/publishmessage`,
4562
- url: this.options.url,
4563
- method: "post",
4564
- data: Buffer.from(encodedData),
4565
- // payload,
4566
- headers,
4567
- httpsAgent: __privateGet(this, _httpsAgent)
4568
- });
4569
- } else {
4570
- const blob = new Blob([encodedData], { type: "application/octet-stream" });
4571
- retVal = await axios({
4572
- //url: `${goptions.imendpoint}:${goptions.import}${goptions.imapiroot}/publishmessage`,
4573
- url: this.options.url,
4574
- method: "post",
4575
- data: blob,
4576
- //payload,
4577
- headers
4578
- });
4579
- }
4580
- }
4581
- if (retVal.status !== 200) {
4582
- if (this.options.showPublishPayload) {
4583
- console.log(chalk$1.red(`PublishTransportRESTServer::Publish() Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
4584
- }
4585
- this.options.logger.debug(chalk$1.red(`Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
4586
- return false;
4587
- } else {
4588
- if (this.options.showPublishPayload) {
4589
- console.log(chalk$1.grey(`PublishTransportRESTServer::Publish() _PerformPublishRESTAPI:_PerformPublish:#publishmessage: [${this.options.url}] - Valid response from server: [${retVal.status}]`));
4590
- }
4591
- }
4592
- return true;
4593
- } catch (error) {
4594
- if (this.options.showPublishPayload) {
4595
- console.log(chalk$1.red(`PublishTransportRESTServer::Publish() Error (PublishRESTServer:_PerformPublishRESTAPI:Error: [${error}]`));
4596
- }
4597
- return false;
4559
+ const http = {};
4560
+ const fs$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4561
+ __proto__: null,
4562
+ default: http
4563
+ }, Symbol.toStringTag, { value: "Module" }));
4564
+ var main$1 = { exports: {} };
4565
+ const require$$3 = /* @__PURE__ */ getAugmentedNamespace(fs$1);
4566
+ const name = "dotenv";
4567
+ const version$1 = "16.4.5";
4568
+ const description = "Loads environment variables from .env file";
4569
+ const main = "lib/main.js";
4570
+ const types = "lib/main.d.ts";
4571
+ const exports$1 = {
4572
+ ".": {
4573
+ types: "./lib/main.d.ts",
4574
+ require: "./lib/main.js",
4575
+ "default": "./lib/main.js"
4576
+ },
4577
+ "./config": "./config.js",
4578
+ "./config.js": "./config.js",
4579
+ "./lib/env-options": "./lib/env-options.js",
4580
+ "./lib/env-options.js": "./lib/env-options.js",
4581
+ "./lib/cli-options": "./lib/cli-options.js",
4582
+ "./lib/cli-options.js": "./lib/cli-options.js",
4583
+ "./package.json": "./package.json"
4584
+ };
4585
+ const scripts = {
4586
+ "dts-check": "tsc --project tests/types/tsconfig.json",
4587
+ lint: "standard",
4588
+ "lint-readme": "standard-markdown",
4589
+ pretest: "npm run lint && npm run dts-check",
4590
+ test: "tap tests/*.js --100 -Rspec",
4591
+ "test:coverage": "tap --coverage-report=lcov",
4592
+ prerelease: "npm test",
4593
+ release: "standard-version"
4594
+ };
4595
+ const repository = {
4596
+ type: "git",
4597
+ url: "git://github.com/motdotla/dotenv.git"
4598
+ };
4599
+ const funding = "https://dotenvx.com";
4600
+ const keywords = [
4601
+ "dotenv",
4602
+ "env",
4603
+ ".env",
4604
+ "environment",
4605
+ "variables",
4606
+ "config",
4607
+ "settings"
4608
+ ];
4609
+ const readmeFilename = "README.md";
4610
+ const license = "BSD-2-Clause";
4611
+ const devDependencies = {
4612
+ "@definitelytyped/dtslint": "^0.0.133",
4613
+ "@types/node": "^18.11.3",
4614
+ decache: "^4.6.1",
4615
+ sinon: "^14.0.1",
4616
+ standard: "^17.0.0",
4617
+ "standard-markdown": "^7.1.0",
4618
+ "standard-version": "^9.5.0",
4619
+ tap: "^16.3.0",
4620
+ tar: "^6.1.11",
4621
+ typescript: "^4.8.4"
4622
+ };
4623
+ const engines = {
4624
+ node: ">=12"
4625
+ };
4626
+ const browser$1 = {
4627
+ fs: false
4628
+ };
4629
+ const require$$4 = {
4630
+ name,
4631
+ version: version$1,
4632
+ description,
4633
+ main,
4634
+ types,
4635
+ exports: exports$1,
4636
+ scripts,
4637
+ repository,
4638
+ funding,
4639
+ keywords,
4640
+ readmeFilename,
4641
+ license,
4642
+ devDependencies,
4643
+ engines,
4644
+ browser: browser$1
4645
+ };
4646
+ const fs = require$$3;
4647
+ const path = require$$3;
4648
+ const os = require$$3;
4649
+ const crypto$1 = require$$3;
4650
+ const packageJson = require$$4;
4651
+ const version = packageJson.version;
4652
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
4653
+ function parse(src) {
4654
+ const obj = {};
4655
+ let lines = src.toString();
4656
+ lines = lines.replace(/\r\n?/mg, "\n");
4657
+ let match;
4658
+ while ((match = LINE.exec(lines)) != null) {
4659
+ const key = match[1];
4660
+ let value = match[2] || "";
4661
+ value = value.trim();
4662
+ const maybeQuote = value[0];
4663
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
4664
+ if (maybeQuote === '"') {
4665
+ value = value.replace(/\\n/g, "\n");
4666
+ value = value.replace(/\\r/g, "\r");
4667
+ }
4668
+ obj[key] = value;
4669
+ }
4670
+ return obj;
4671
+ }
4672
+ function _parseVault(options) {
4673
+ const vaultPath = _vaultPath(options);
4674
+ const result = DotenvModule.configDotenv({ path: vaultPath });
4675
+ if (!result.parsed) {
4676
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
4677
+ err.code = "MISSING_DATA";
4678
+ throw err;
4679
+ }
4680
+ const keys = _dotenvKey(options).split(",");
4681
+ const length = keys.length;
4682
+ let decrypted;
4683
+ for (let i2 = 0; i2 < length; i2++) {
4684
+ try {
4685
+ const key = keys[i2].trim();
4686
+ const attrs = _instructions(result, key);
4687
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
4688
+ break;
4689
+ } catch (error) {
4690
+ if (i2 + 1 >= length) {
4691
+ throw error;
4598
4692
  }
4599
- });
4600
- if (isNode) {
4601
- const agentOptions = this.options.agentOptions;
4602
- __privateSet(this, _httpsAgent, new https.Agent({
4603
- keepAlive: agentOptions == null ? void 0 : agentOptions.keepAlive,
4604
- maxSockets: agentOptions == null ? void 0 : agentOptions.maxSockets,
4605
- maxTotalSockets: agentOptions == null ? void 0 : agentOptions.maxTotalSockets,
4606
- maxFreeSockets: agentOptions == null ? void 0 : agentOptions.maxFreeSockets,
4607
- timeout: agentOptions == null ? void 0 : agentOptions.timeout,
4608
- rejectUnauthorized: agentOptions == null ? void 0 : agentOptions.rejectUnauthorized
4609
- // Allows self signed certs in non production mode(s)
4610
- }));
4611
4693
  }
4612
4694
  }
4613
- get options() {
4614
- return super.options;
4615
- }
4616
- async Close() {
4617
- if (__privateGet(this, _httpsAgent)) {
4618
- __privateGet(this, _httpsAgent).destroy();
4619
- }
4620
- return true;
4621
- }
4695
+ return DotenvModule.parse(decrypted);
4622
4696
  }
4623
- _httpsAgent = new WeakMap();
4624
- class PublishInstruments extends stsutils.STSOptionsBase {
4625
- constructor(options) {
4626
- super(options);
4627
- __privateAdd(this, _PublishInstruments_instances);
4628
- __privateAdd(this, _inPublish, false);
4629
- __privateAdd(this, _observer2, null);
4630
- __privateAdd(this, _publishState, 0);
4631
- __privateAdd(this, _publisherTransport, null);
4632
- __privateSet(this, _publisherTransport, null);
4633
- switch (options.publishTransportBaseOptions.transportType) {
4634
- case TransportType.RESTAPI:
4635
- __privateSet(this, _publisherTransport, new PublishTransportRESTServer(options.publishTransportBaseOptions));
4636
- break;
4637
- }
4638
- __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "constructor()");
4697
+ function _log(message) {
4698
+ console.log(`[dotenv@${version}][INFO] ${message}`);
4699
+ }
4700
+ function _warn(message) {
4701
+ console.log(`[dotenv@${version}][WARN] ${message}`);
4702
+ }
4703
+ function _debug(message) {
4704
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
4705
+ }
4706
+ function _dotenvKey(options) {
4707
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
4708
+ return options.DOTENV_KEY;
4639
4709
  }
4640
- get options() {
4641
- return super.options;
4710
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
4711
+ return process.env.DOTENV_KEY;
4642
4712
  }
4643
- async Publish() {
4644
- if (__privateGet(this, _inPublish)) {
4645
- return false;
4646
- }
4647
- if (__privateGet(this, _publisherTransport)) {
4648
- try {
4649
- __privateSet(this, _inPublish, true);
4650
- if (this.options.publishInstrumentController) {
4651
- const instrumentPayload = this.options.publishInstrumentController.GetPayloadData();
4652
- return await __privateGet(this, _publisherTransport).Publish(instrumentPayload);
4713
+ return "";
4714
+ }
4715
+ function _instructions(result, dotenvKey) {
4716
+ let uri;
4717
+ try {
4718
+ uri = new URL(dotenvKey);
4719
+ } catch (error) {
4720
+ if (error.code === "ERR_INVALID_URL") {
4721
+ const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
4722
+ err.code = "INVALID_DOTENV_KEY";
4723
+ throw err;
4724
+ }
4725
+ throw error;
4726
+ }
4727
+ const key = uri.password;
4728
+ if (!key) {
4729
+ const err = new Error("INVALID_DOTENV_KEY: Missing key part");
4730
+ err.code = "INVALID_DOTENV_KEY";
4731
+ throw err;
4732
+ }
4733
+ const environment = uri.searchParams.get("environment");
4734
+ if (!environment) {
4735
+ const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
4736
+ err.code = "INVALID_DOTENV_KEY";
4737
+ throw err;
4738
+ }
4739
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
4740
+ const ciphertext = result.parsed[environmentKey];
4741
+ if (!ciphertext) {
4742
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
4743
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
4744
+ throw err;
4745
+ }
4746
+ return { ciphertext, key };
4747
+ }
4748
+ function _vaultPath(options) {
4749
+ let possibleVaultPath = null;
4750
+ if (options && options.path && options.path.length > 0) {
4751
+ if (Array.isArray(options.path)) {
4752
+ for (const filepath of options.path) {
4753
+ if (fs.existsSync(filepath)) {
4754
+ possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
4653
4755
  }
4654
- return false;
4655
- } catch (error) {
4656
- return false;
4657
- } finally {
4658
- __privateSet(this, _inPublish, false);
4659
4756
  }
4660
4757
  } else {
4661
- return false;
4758
+ possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
4662
4759
  }
4760
+ } else {
4761
+ possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
4663
4762
  }
4664
- async StartPublish() {
4665
- if (__privateGet(this, _publishState) !== 0) {
4666
- this.options.logger.debug(chalk$1.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state. Current State: [${__privateGet(this, _publishState)}]`));
4667
- return false;
4668
- }
4669
- __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 1, "StartPublish()");
4670
- __privateMethod(this, _PublishInstruments_instances, PublishTimeoutLoop_fn).call(this, this.options.publishInterval);
4671
- return true;
4763
+ if (fs.existsSync(possibleVaultPath)) {
4764
+ return possibleVaultPath;
4672
4765
  }
4673
- async EndPublish() {
4674
- if (__privateGet(this, _publishState) !== 1) {
4675
- this.options.logger.debug(chalk$1.yellow(`EndPublish:${this.options.processContext.nid}: EndPublish called when not within the started state. Current State: [${__privateGet(this, _publishState)}]`));
4676
- return false;
4766
+ return null;
4767
+ }
4768
+ function _resolveHome(envPath) {
4769
+ return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
4770
+ }
4771
+ function _configVault(options) {
4772
+ _log("Loading env from encrypted .env.vault");
4773
+ const parsed = DotenvModule._parseVault(options);
4774
+ let processEnv = process.env;
4775
+ if (options && options.processEnv != null) {
4776
+ processEnv = options.processEnv;
4777
+ }
4778
+ DotenvModule.populate(processEnv, parsed, options);
4779
+ return { parsed };
4780
+ }
4781
+ function configDotenv(options) {
4782
+ const dotenvPath = path.resolve(process.cwd(), ".env");
4783
+ let encoding = "utf8";
4784
+ const debug = Boolean(options && options.debug);
4785
+ if (options && options.encoding) {
4786
+ encoding = options.encoding;
4787
+ } else {
4788
+ if (debug) {
4789
+ _debug("No encoding is specified. UTF-8 is used by default");
4677
4790
  }
4678
- __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 2, "EndPublish() (1)");
4679
- if (__privateGet(this, _observer2) !== null) {
4680
- clearTimeout(__privateGet(this, _observer2));
4681
- __privateSet(this, _observer2, null);
4682
- await this.Publish();
4791
+ }
4792
+ let optionPaths = [dotenvPath];
4793
+ if (options && options.path) {
4794
+ if (!Array.isArray(options.path)) {
4795
+ optionPaths = [_resolveHome(options.path)];
4796
+ } else {
4797
+ optionPaths = [];
4798
+ for (const filepath of options.path) {
4799
+ optionPaths.push(_resolveHome(filepath));
4800
+ }
4683
4801
  }
4684
- if (__privateGet(this, _publisherTransport)) {
4685
- await __privateGet(this, _publisherTransport).Close();
4802
+ }
4803
+ let lastError;
4804
+ const parsedAll = {};
4805
+ for (const path2 of optionPaths) {
4806
+ try {
4807
+ const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
4808
+ DotenvModule.populate(parsedAll, parsed, options);
4809
+ } catch (e) {
4810
+ if (debug) {
4811
+ _debug(`Failed to load ${path2} ${e.message}`);
4812
+ }
4813
+ lastError = e;
4686
4814
  }
4687
- __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "EndPublish() (2)");
4688
- return true;
4815
+ }
4816
+ let processEnv = process.env;
4817
+ if (options && options.processEnv != null) {
4818
+ processEnv = options.processEnv;
4819
+ }
4820
+ DotenvModule.populate(processEnv, parsedAll, options);
4821
+ if (lastError) {
4822
+ return { parsed: parsedAll, error: lastError };
4823
+ } else {
4824
+ return { parsed: parsedAll };
4825
+ }
4826
+ }
4827
+ function config(options) {
4828
+ if (_dotenvKey(options).length === 0) {
4829
+ return DotenvModule.configDotenv(options);
4830
+ }
4831
+ const vaultPath = _vaultPath(options);
4832
+ if (!vaultPath) {
4833
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
4834
+ return DotenvModule.configDotenv(options);
4835
+ }
4836
+ return DotenvModule._configVault(options);
4837
+ }
4838
+ function decrypt(encrypted, keyStr) {
4839
+ const key = Buffer.from(keyStr.slice(-64), "hex");
4840
+ let ciphertext = Buffer.from(encrypted, "base64");
4841
+ const nonce = ciphertext.subarray(0, 12);
4842
+ const authTag = ciphertext.subarray(-16);
4843
+ ciphertext = ciphertext.subarray(12, -16);
4844
+ try {
4845
+ const aesgcm = crypto$1.createDecipheriv("aes-256-gcm", key, nonce);
4846
+ aesgcm.setAuthTag(authTag);
4847
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
4848
+ } catch (error) {
4849
+ const isRange = error instanceof RangeError;
4850
+ const invalidKeyLength = error.message === "Invalid key length";
4851
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
4852
+ if (isRange || invalidKeyLength) {
4853
+ const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
4854
+ err.code = "INVALID_DOTENV_KEY";
4855
+ throw err;
4856
+ } else if (decryptionFailed) {
4857
+ const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
4858
+ err.code = "DECRYPTION_FAILED";
4859
+ throw err;
4860
+ } else {
4861
+ throw error;
4862
+ }
4863
+ }
4864
+ }
4865
+ function populate(processEnv, parsed, options = {}) {
4866
+ const debug = Boolean(options && options.debug);
4867
+ const override = Boolean(options && options.override);
4868
+ if (typeof parsed !== "object") {
4869
+ const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
4870
+ err.code = "OBJECT_REQUIRED";
4871
+ throw err;
4872
+ }
4873
+ for (const key of Object.keys(parsed)) {
4874
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
4875
+ if (override === true) {
4876
+ processEnv[key] = parsed[key];
4877
+ }
4878
+ if (debug) {
4879
+ if (override === true) {
4880
+ _debug(`"${key}" is already defined and WAS overwritten`);
4881
+ } else {
4882
+ _debug(`"${key}" is already defined and was NOT overwritten`);
4883
+ }
4884
+ }
4885
+ } else {
4886
+ processEnv[key] = parsed[key];
4887
+ }
4888
+ }
4889
+ }
4890
+ const DotenvModule = {
4891
+ configDotenv,
4892
+ _configVault,
4893
+ _parseVault,
4894
+ config,
4895
+ decrypt,
4896
+ parse,
4897
+ populate
4898
+ };
4899
+ main$1.exports.configDotenv = DotenvModule.configDotenv;
4900
+ main$1.exports._configVault = DotenvModule._configVault;
4901
+ main$1.exports._parseVault = DotenvModule._parseVault;
4902
+ var config_1 = main$1.exports.config = DotenvModule.config;
4903
+ main$1.exports.decrypt = DotenvModule.decrypt;
4904
+ main$1.exports.parse = DotenvModule.parse;
4905
+ main$1.exports.populate = DotenvModule.populate;
4906
+ main$1.exports = DotenvModule;
4907
+ var __typeError2 = (msg) => {
4908
+ throw TypeError(msg);
4909
+ };
4910
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
4911
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
4912
+ var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4913
+ var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
4914
+ var __privateWrapper2 = (obj, member, setter, getter) => ({
4915
+ set _(value) {
4916
+ __privateSet2(obj, member, value);
4917
+ },
4918
+ get _() {
4919
+ return __privateGet2(obj, member, getter);
4920
+ }
4921
+ });
4922
+ var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout;
4923
+ var ansiStyles$1 = { exports: {} };
4924
+ var colorName;
4925
+ var hasRequiredColorName;
4926
+ function requireColorName() {
4927
+ if (hasRequiredColorName) return colorName;
4928
+ hasRequiredColorName = 1;
4929
+ colorName = {
4930
+ "aliceblue": [240, 248, 255],
4931
+ "antiquewhite": [250, 235, 215],
4932
+ "aqua": [0, 255, 255],
4933
+ "aquamarine": [127, 255, 212],
4934
+ "azure": [240, 255, 255],
4935
+ "beige": [245, 245, 220],
4936
+ "bisque": [255, 228, 196],
4937
+ "black": [0, 0, 0],
4938
+ "blanchedalmond": [255, 235, 205],
4939
+ "blue": [0, 0, 255],
4940
+ "blueviolet": [138, 43, 226],
4941
+ "brown": [165, 42, 42],
4942
+ "burlywood": [222, 184, 135],
4943
+ "cadetblue": [95, 158, 160],
4944
+ "chartreuse": [127, 255, 0],
4945
+ "chocolate": [210, 105, 30],
4946
+ "coral": [255, 127, 80],
4947
+ "cornflowerblue": [100, 149, 237],
4948
+ "cornsilk": [255, 248, 220],
4949
+ "crimson": [220, 20, 60],
4950
+ "cyan": [0, 255, 255],
4951
+ "darkblue": [0, 0, 139],
4952
+ "darkcyan": [0, 139, 139],
4953
+ "darkgoldenrod": [184, 134, 11],
4954
+ "darkgray": [169, 169, 169],
4955
+ "darkgreen": [0, 100, 0],
4956
+ "darkgrey": [169, 169, 169],
4957
+ "darkkhaki": [189, 183, 107],
4958
+ "darkmagenta": [139, 0, 139],
4959
+ "darkolivegreen": [85, 107, 47],
4960
+ "darkorange": [255, 140, 0],
4961
+ "darkorchid": [153, 50, 204],
4962
+ "darkred": [139, 0, 0],
4963
+ "darksalmon": [233, 150, 122],
4964
+ "darkseagreen": [143, 188, 143],
4965
+ "darkslateblue": [72, 61, 139],
4966
+ "darkslategray": [47, 79, 79],
4967
+ "darkslategrey": [47, 79, 79],
4968
+ "darkturquoise": [0, 206, 209],
4969
+ "darkviolet": [148, 0, 211],
4970
+ "deeppink": [255, 20, 147],
4971
+ "deepskyblue": [0, 191, 255],
4972
+ "dimgray": [105, 105, 105],
4973
+ "dimgrey": [105, 105, 105],
4974
+ "dodgerblue": [30, 144, 255],
4975
+ "firebrick": [178, 34, 34],
4976
+ "floralwhite": [255, 250, 240],
4977
+ "forestgreen": [34, 139, 34],
4978
+ "fuchsia": [255, 0, 255],
4979
+ "gainsboro": [220, 220, 220],
4980
+ "ghostwhite": [248, 248, 255],
4981
+ "gold": [255, 215, 0],
4982
+ "goldenrod": [218, 165, 32],
4983
+ "gray": [128, 128, 128],
4984
+ "green": [0, 128, 0],
4985
+ "greenyellow": [173, 255, 47],
4986
+ "grey": [128, 128, 128],
4987
+ "honeydew": [240, 255, 240],
4988
+ "hotpink": [255, 105, 180],
4989
+ "indianred": [205, 92, 92],
4990
+ "indigo": [75, 0, 130],
4991
+ "ivory": [255, 255, 240],
4992
+ "khaki": [240, 230, 140],
4993
+ "lavender": [230, 230, 250],
4994
+ "lavenderblush": [255, 240, 245],
4995
+ "lawngreen": [124, 252, 0],
4996
+ "lemonchiffon": [255, 250, 205],
4997
+ "lightblue": [173, 216, 230],
4998
+ "lightcoral": [240, 128, 128],
4999
+ "lightcyan": [224, 255, 255],
5000
+ "lightgoldenrodyellow": [250, 250, 210],
5001
+ "lightgray": [211, 211, 211],
5002
+ "lightgreen": [144, 238, 144],
5003
+ "lightgrey": [211, 211, 211],
5004
+ "lightpink": [255, 182, 193],
5005
+ "lightsalmon": [255, 160, 122],
5006
+ "lightseagreen": [32, 178, 170],
5007
+ "lightskyblue": [135, 206, 250],
5008
+ "lightslategray": [119, 136, 153],
5009
+ "lightslategrey": [119, 136, 153],
5010
+ "lightsteelblue": [176, 196, 222],
5011
+ "lightyellow": [255, 255, 224],
5012
+ "lime": [0, 255, 0],
5013
+ "limegreen": [50, 205, 50],
5014
+ "linen": [250, 240, 230],
5015
+ "magenta": [255, 0, 255],
5016
+ "maroon": [128, 0, 0],
5017
+ "mediumaquamarine": [102, 205, 170],
5018
+ "mediumblue": [0, 0, 205],
5019
+ "mediumorchid": [186, 85, 211],
5020
+ "mediumpurple": [147, 112, 219],
5021
+ "mediumseagreen": [60, 179, 113],
5022
+ "mediumslateblue": [123, 104, 238],
5023
+ "mediumspringgreen": [0, 250, 154],
5024
+ "mediumturquoise": [72, 209, 204],
5025
+ "mediumvioletred": [199, 21, 133],
5026
+ "midnightblue": [25, 25, 112],
5027
+ "mintcream": [245, 255, 250],
5028
+ "mistyrose": [255, 228, 225],
5029
+ "moccasin": [255, 228, 181],
5030
+ "navajowhite": [255, 222, 173],
5031
+ "navy": [0, 0, 128],
5032
+ "oldlace": [253, 245, 230],
5033
+ "olive": [128, 128, 0],
5034
+ "olivedrab": [107, 142, 35],
5035
+ "orange": [255, 165, 0],
5036
+ "orangered": [255, 69, 0],
5037
+ "orchid": [218, 112, 214],
5038
+ "palegoldenrod": [238, 232, 170],
5039
+ "palegreen": [152, 251, 152],
5040
+ "paleturquoise": [175, 238, 238],
5041
+ "palevioletred": [219, 112, 147],
5042
+ "papayawhip": [255, 239, 213],
5043
+ "peachpuff": [255, 218, 185],
5044
+ "peru": [205, 133, 63],
5045
+ "pink": [255, 192, 203],
5046
+ "plum": [221, 160, 221],
5047
+ "powderblue": [176, 224, 230],
5048
+ "purple": [128, 0, 128],
5049
+ "rebeccapurple": [102, 51, 153],
5050
+ "red": [255, 0, 0],
5051
+ "rosybrown": [188, 143, 143],
5052
+ "royalblue": [65, 105, 225],
5053
+ "saddlebrown": [139, 69, 19],
5054
+ "salmon": [250, 128, 114],
5055
+ "sandybrown": [244, 164, 96],
5056
+ "seagreen": [46, 139, 87],
5057
+ "seashell": [255, 245, 238],
5058
+ "sienna": [160, 82, 45],
5059
+ "silver": [192, 192, 192],
5060
+ "skyblue": [135, 206, 235],
5061
+ "slateblue": [106, 90, 205],
5062
+ "slategray": [112, 128, 144],
5063
+ "slategrey": [112, 128, 144],
5064
+ "snow": [255, 250, 250],
5065
+ "springgreen": [0, 255, 127],
5066
+ "steelblue": [70, 130, 180],
5067
+ "tan": [210, 180, 140],
5068
+ "teal": [0, 128, 128],
5069
+ "thistle": [216, 191, 216],
5070
+ "tomato": [255, 99, 71],
5071
+ "turquoise": [64, 224, 208],
5072
+ "violet": [238, 130, 238],
5073
+ "wheat": [245, 222, 179],
5074
+ "white": [255, 255, 255],
5075
+ "whitesmoke": [245, 245, 245],
5076
+ "yellow": [255, 255, 0],
5077
+ "yellowgreen": [154, 205, 50]
5078
+ };
5079
+ return colorName;
5080
+ }
5081
+ var conversions;
5082
+ var hasRequiredConversions;
5083
+ function requireConversions() {
5084
+ if (hasRequiredConversions) return conversions;
5085
+ hasRequiredConversions = 1;
5086
+ const cssKeywords = requireColorName();
5087
+ const reverseKeywords = {};
5088
+ for (const key of Object.keys(cssKeywords)) {
5089
+ reverseKeywords[cssKeywords[key]] = key;
5090
+ }
5091
+ const convert = {
5092
+ rgb: { channels: 3, labels: "rgb" },
5093
+ hsl: { channels: 3, labels: "hsl" },
5094
+ hsv: { channels: 3, labels: "hsv" },
5095
+ hwb: { channels: 3, labels: "hwb" },
5096
+ cmyk: { channels: 4, labels: "cmyk" },
5097
+ xyz: { channels: 3, labels: "xyz" },
5098
+ lab: { channels: 3, labels: "lab" },
5099
+ lch: { channels: 3, labels: "lch" },
5100
+ hex: { channels: 1, labels: ["hex"] },
5101
+ keyword: { channels: 1, labels: ["keyword"] },
5102
+ ansi16: { channels: 1, labels: ["ansi16"] },
5103
+ ansi256: { channels: 1, labels: ["ansi256"] },
5104
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
5105
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
5106
+ gray: { channels: 1, labels: ["gray"] }
5107
+ };
5108
+ conversions = convert;
5109
+ for (const model of Object.keys(convert)) {
5110
+ if (!("channels" in convert[model])) {
5111
+ throw new Error("missing channels property: " + model);
5112
+ }
5113
+ if (!("labels" in convert[model])) {
5114
+ throw new Error("missing channel labels property: " + model);
5115
+ }
5116
+ if (convert[model].labels.length !== convert[model].channels) {
5117
+ throw new Error("channel and label counts mismatch: " + model);
5118
+ }
5119
+ const { channels, labels } = convert[model];
5120
+ delete convert[model].channels;
5121
+ delete convert[model].labels;
5122
+ Object.defineProperty(convert[model], "channels", { value: channels });
5123
+ Object.defineProperty(convert[model], "labels", { value: labels });
5124
+ }
5125
+ convert.rgb.hsl = function(rgb) {
5126
+ const r = rgb[0] / 255;
5127
+ const g = rgb[1] / 255;
5128
+ const b = rgb[2] / 255;
5129
+ const min = Math.min(r, g, b);
5130
+ const max = Math.max(r, g, b);
5131
+ const delta = max - min;
5132
+ let h;
5133
+ let s;
5134
+ if (max === min) {
5135
+ h = 0;
5136
+ } else if (r === max) {
5137
+ h = (g - b) / delta;
5138
+ } else if (g === max) {
5139
+ h = 2 + (b - r) / delta;
5140
+ } else if (b === max) {
5141
+ h = 4 + (r - g) / delta;
5142
+ }
5143
+ h = Math.min(h * 60, 360);
5144
+ if (h < 0) {
5145
+ h += 360;
5146
+ }
5147
+ const l = (min + max) / 2;
5148
+ if (max === min) {
5149
+ s = 0;
5150
+ } else if (l <= 0.5) {
5151
+ s = delta / (max + min);
5152
+ } else {
5153
+ s = delta / (2 - max - min);
5154
+ }
5155
+ return [h, s * 100, l * 100];
5156
+ };
5157
+ convert.rgb.hsv = function(rgb) {
5158
+ let rdif;
5159
+ let gdif;
5160
+ let bdif;
5161
+ let h;
5162
+ let s;
5163
+ const r = rgb[0] / 255;
5164
+ const g = rgb[1] / 255;
5165
+ const b = rgb[2] / 255;
5166
+ const v = Math.max(r, g, b);
5167
+ const diff = v - Math.min(r, g, b);
5168
+ const diffc = function(c) {
5169
+ return (v - c) / 6 / diff + 1 / 2;
5170
+ };
5171
+ if (diff === 0) {
5172
+ h = 0;
5173
+ s = 0;
5174
+ } else {
5175
+ s = diff / v;
5176
+ rdif = diffc(r);
5177
+ gdif = diffc(g);
5178
+ bdif = diffc(b);
5179
+ if (r === v) {
5180
+ h = bdif - gdif;
5181
+ } else if (g === v) {
5182
+ h = 1 / 3 + rdif - bdif;
5183
+ } else if (b === v) {
5184
+ h = 2 / 3 + gdif - rdif;
5185
+ }
5186
+ if (h < 0) {
5187
+ h += 1;
5188
+ } else if (h > 1) {
5189
+ h -= 1;
5190
+ }
5191
+ }
5192
+ return [
5193
+ h * 360,
5194
+ s * 100,
5195
+ v * 100
5196
+ ];
5197
+ };
5198
+ convert.rgb.hwb = function(rgb) {
5199
+ const r = rgb[0];
5200
+ const g = rgb[1];
5201
+ let b = rgb[2];
5202
+ const h = convert.rgb.hsl(rgb)[0];
5203
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
5204
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
5205
+ return [h, w * 100, b * 100];
5206
+ };
5207
+ convert.rgb.cmyk = function(rgb) {
5208
+ const r = rgb[0] / 255;
5209
+ const g = rgb[1] / 255;
5210
+ const b = rgb[2] / 255;
5211
+ const k = Math.min(1 - r, 1 - g, 1 - b);
5212
+ const c = (1 - r - k) / (1 - k) || 0;
5213
+ const m = (1 - g - k) / (1 - k) || 0;
5214
+ const y = (1 - b - k) / (1 - k) || 0;
5215
+ return [c * 100, m * 100, y * 100, k * 100];
5216
+ };
5217
+ function comparativeDistance(x, y) {
5218
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
5219
+ }
5220
+ convert.rgb.keyword = function(rgb) {
5221
+ const reversed = reverseKeywords[rgb];
5222
+ if (reversed) {
5223
+ return reversed;
5224
+ }
5225
+ let currentClosestDistance = Infinity;
5226
+ let currentClosestKeyword;
5227
+ for (const keyword of Object.keys(cssKeywords)) {
5228
+ const value = cssKeywords[keyword];
5229
+ const distance = comparativeDistance(rgb, value);
5230
+ if (distance < currentClosestDistance) {
5231
+ currentClosestDistance = distance;
5232
+ currentClosestKeyword = keyword;
5233
+ }
5234
+ }
5235
+ return currentClosestKeyword;
5236
+ };
5237
+ convert.keyword.rgb = function(keyword) {
5238
+ return cssKeywords[keyword];
5239
+ };
5240
+ convert.rgb.xyz = function(rgb) {
5241
+ let r = rgb[0] / 255;
5242
+ let g = rgb[1] / 255;
5243
+ let b = rgb[2] / 255;
5244
+ r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
5245
+ g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
5246
+ b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
5247
+ const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
5248
+ const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
5249
+ const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
5250
+ return [x * 100, y * 100, z * 100];
5251
+ };
5252
+ convert.rgb.lab = function(rgb) {
5253
+ const xyz = convert.rgb.xyz(rgb);
5254
+ let x = xyz[0];
5255
+ let y = xyz[1];
5256
+ let z = xyz[2];
5257
+ x /= 95.047;
5258
+ y /= 100;
5259
+ z /= 108.883;
5260
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
5261
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
5262
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
5263
+ const l = 116 * y - 16;
5264
+ const a = 500 * (x - y);
5265
+ const b = 200 * (y - z);
5266
+ return [l, a, b];
5267
+ };
5268
+ convert.hsl.rgb = function(hsl) {
5269
+ const h = hsl[0] / 360;
5270
+ const s = hsl[1] / 100;
5271
+ const l = hsl[2] / 100;
5272
+ let t2;
5273
+ let t3;
5274
+ let val;
5275
+ if (s === 0) {
5276
+ val = l * 255;
5277
+ return [val, val, val];
5278
+ }
5279
+ if (l < 0.5) {
5280
+ t2 = l * (1 + s);
5281
+ } else {
5282
+ t2 = l + s - l * s;
5283
+ }
5284
+ const t1 = 2 * l - t2;
5285
+ const rgb = [0, 0, 0];
5286
+ for (let i2 = 0; i2 < 3; i2++) {
5287
+ t3 = h + 1 / 3 * -(i2 - 1);
5288
+ if (t3 < 0) {
5289
+ t3++;
5290
+ }
5291
+ if (t3 > 1) {
5292
+ t3--;
5293
+ }
5294
+ if (6 * t3 < 1) {
5295
+ val = t1 + (t2 - t1) * 6 * t3;
5296
+ } else if (2 * t3 < 1) {
5297
+ val = t2;
5298
+ } else if (3 * t3 < 2) {
5299
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
5300
+ } else {
5301
+ val = t1;
5302
+ }
5303
+ rgb[i2] = val * 255;
5304
+ }
5305
+ return rgb;
5306
+ };
5307
+ convert.hsl.hsv = function(hsl) {
5308
+ const h = hsl[0];
5309
+ let s = hsl[1] / 100;
5310
+ let l = hsl[2] / 100;
5311
+ let smin = s;
5312
+ const lmin = Math.max(l, 0.01);
5313
+ l *= 2;
5314
+ s *= l <= 1 ? l : 2 - l;
5315
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
5316
+ const v = (l + s) / 2;
5317
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
5318
+ return [h, sv * 100, v * 100];
5319
+ };
5320
+ convert.hsv.rgb = function(hsv) {
5321
+ const h = hsv[0] / 60;
5322
+ const s = hsv[1] / 100;
5323
+ let v = hsv[2] / 100;
5324
+ const hi = Math.floor(h) % 6;
5325
+ const f = h - Math.floor(h);
5326
+ const p = 255 * v * (1 - s);
5327
+ const q = 255 * v * (1 - s * f);
5328
+ const t = 255 * v * (1 - s * (1 - f));
5329
+ v *= 255;
5330
+ switch (hi) {
5331
+ case 0:
5332
+ return [v, t, p];
5333
+ case 1:
5334
+ return [q, v, p];
5335
+ case 2:
5336
+ return [p, v, t];
5337
+ case 3:
5338
+ return [p, q, v];
5339
+ case 4:
5340
+ return [t, p, v];
5341
+ case 5:
5342
+ return [v, p, q];
5343
+ }
5344
+ };
5345
+ convert.hsv.hsl = function(hsv) {
5346
+ const h = hsv[0];
5347
+ const s = hsv[1] / 100;
5348
+ const v = hsv[2] / 100;
5349
+ const vmin = Math.max(v, 0.01);
5350
+ let sl;
5351
+ let l;
5352
+ l = (2 - s) * v;
5353
+ const lmin = (2 - s) * vmin;
5354
+ sl = s * vmin;
5355
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
5356
+ sl = sl || 0;
5357
+ l /= 2;
5358
+ return [h, sl * 100, l * 100];
5359
+ };
5360
+ convert.hwb.rgb = function(hwb) {
5361
+ const h = hwb[0] / 360;
5362
+ let wh = hwb[1] / 100;
5363
+ let bl = hwb[2] / 100;
5364
+ const ratio = wh + bl;
5365
+ let f;
5366
+ if (ratio > 1) {
5367
+ wh /= ratio;
5368
+ bl /= ratio;
5369
+ }
5370
+ const i2 = Math.floor(6 * h);
5371
+ const v = 1 - bl;
5372
+ f = 6 * h - i2;
5373
+ if ((i2 & 1) !== 0) {
5374
+ f = 1 - f;
5375
+ }
5376
+ const n = wh + f * (v - wh);
5377
+ let r;
5378
+ let g;
5379
+ let b;
5380
+ switch (i2) {
5381
+ default:
5382
+ case 6:
5383
+ case 0:
5384
+ r = v;
5385
+ g = n;
5386
+ b = wh;
5387
+ break;
5388
+ case 1:
5389
+ r = n;
5390
+ g = v;
5391
+ b = wh;
5392
+ break;
5393
+ case 2:
5394
+ r = wh;
5395
+ g = v;
5396
+ b = n;
5397
+ break;
5398
+ case 3:
5399
+ r = wh;
5400
+ g = n;
5401
+ b = v;
5402
+ break;
5403
+ case 4:
5404
+ r = n;
5405
+ g = wh;
5406
+ b = v;
5407
+ break;
5408
+ case 5:
5409
+ r = v;
5410
+ g = wh;
5411
+ b = n;
5412
+ break;
5413
+ }
5414
+ return [r * 255, g * 255, b * 255];
5415
+ };
5416
+ convert.cmyk.rgb = function(cmyk) {
5417
+ const c = cmyk[0] / 100;
5418
+ const m = cmyk[1] / 100;
5419
+ const y = cmyk[2] / 100;
5420
+ const k = cmyk[3] / 100;
5421
+ const r = 1 - Math.min(1, c * (1 - k) + k);
5422
+ const g = 1 - Math.min(1, m * (1 - k) + k);
5423
+ const b = 1 - Math.min(1, y * (1 - k) + k);
5424
+ return [r * 255, g * 255, b * 255];
5425
+ };
5426
+ convert.xyz.rgb = function(xyz) {
5427
+ const x = xyz[0] / 100;
5428
+ const y = xyz[1] / 100;
5429
+ const z = xyz[2] / 100;
5430
+ let r;
5431
+ let g;
5432
+ let b;
5433
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
5434
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
5435
+ b = x * 0.0557 + y * -0.204 + z * 1.057;
5436
+ r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
5437
+ g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
5438
+ b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
5439
+ r = Math.min(Math.max(0, r), 1);
5440
+ g = Math.min(Math.max(0, g), 1);
5441
+ b = Math.min(Math.max(0, b), 1);
5442
+ return [r * 255, g * 255, b * 255];
5443
+ };
5444
+ convert.xyz.lab = function(xyz) {
5445
+ let x = xyz[0];
5446
+ let y = xyz[1];
5447
+ let z = xyz[2];
5448
+ x /= 95.047;
5449
+ y /= 100;
5450
+ z /= 108.883;
5451
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
5452
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
5453
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
5454
+ const l = 116 * y - 16;
5455
+ const a = 500 * (x - y);
5456
+ const b = 200 * (y - z);
5457
+ return [l, a, b];
5458
+ };
5459
+ convert.lab.xyz = function(lab) {
5460
+ const l = lab[0];
5461
+ const a = lab[1];
5462
+ const b = lab[2];
5463
+ let x;
5464
+ let y;
5465
+ let z;
5466
+ y = (l + 16) / 116;
5467
+ x = a / 500 + y;
5468
+ z = y - b / 200;
5469
+ const y2 = y ** 3;
5470
+ const x2 = x ** 3;
5471
+ const z2 = z ** 3;
5472
+ y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
5473
+ x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
5474
+ z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
5475
+ x *= 95.047;
5476
+ y *= 100;
5477
+ z *= 108.883;
5478
+ return [x, y, z];
5479
+ };
5480
+ convert.lab.lch = function(lab) {
5481
+ const l = lab[0];
5482
+ const a = lab[1];
5483
+ const b = lab[2];
5484
+ let h;
5485
+ const hr = Math.atan2(b, a);
5486
+ h = hr * 360 / 2 / Math.PI;
5487
+ if (h < 0) {
5488
+ h += 360;
5489
+ }
5490
+ const c = Math.sqrt(a * a + b * b);
5491
+ return [l, c, h];
5492
+ };
5493
+ convert.lch.lab = function(lch) {
5494
+ const l = lch[0];
5495
+ const c = lch[1];
5496
+ const h = lch[2];
5497
+ const hr = h / 360 * 2 * Math.PI;
5498
+ const a = c * Math.cos(hr);
5499
+ const b = c * Math.sin(hr);
5500
+ return [l, a, b];
5501
+ };
5502
+ convert.rgb.ansi16 = function(args, saturation = null) {
5503
+ const [r, g, b] = args;
5504
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
5505
+ value = Math.round(value / 50);
5506
+ if (value === 0) {
5507
+ return 30;
5508
+ }
5509
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
5510
+ if (value === 2) {
5511
+ ansi += 60;
5512
+ }
5513
+ return ansi;
5514
+ };
5515
+ convert.hsv.ansi16 = function(args) {
5516
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
5517
+ };
5518
+ convert.rgb.ansi256 = function(args) {
5519
+ const r = args[0];
5520
+ const g = args[1];
5521
+ const b = args[2];
5522
+ if (r === g && g === b) {
5523
+ if (r < 8) {
5524
+ return 16;
5525
+ }
5526
+ if (r > 248) {
5527
+ return 231;
5528
+ }
5529
+ return Math.round((r - 8) / 247 * 24) + 232;
5530
+ }
5531
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
5532
+ return ansi;
5533
+ };
5534
+ convert.ansi16.rgb = function(args) {
5535
+ let color = args % 10;
5536
+ if (color === 0 || color === 7) {
5537
+ if (args > 50) {
5538
+ color += 3.5;
5539
+ }
5540
+ color = color / 10.5 * 255;
5541
+ return [color, color, color];
5542
+ }
5543
+ const mult = (~~(args > 50) + 1) * 0.5;
5544
+ const r = (color & 1) * mult * 255;
5545
+ const g = (color >> 1 & 1) * mult * 255;
5546
+ const b = (color >> 2 & 1) * mult * 255;
5547
+ return [r, g, b];
5548
+ };
5549
+ convert.ansi256.rgb = function(args) {
5550
+ if (args >= 232) {
5551
+ const c = (args - 232) * 10 + 8;
5552
+ return [c, c, c];
5553
+ }
5554
+ args -= 16;
5555
+ let rem;
5556
+ const r = Math.floor(args / 36) / 5 * 255;
5557
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
5558
+ const b = rem % 6 / 5 * 255;
5559
+ return [r, g, b];
5560
+ };
5561
+ convert.rgb.hex = function(args) {
5562
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
5563
+ const string = integer.toString(16).toUpperCase();
5564
+ return "000000".substring(string.length) + string;
5565
+ };
5566
+ convert.hex.rgb = function(args) {
5567
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
5568
+ if (!match) {
5569
+ return [0, 0, 0];
5570
+ }
5571
+ let colorString = match[0];
5572
+ if (match[0].length === 3) {
5573
+ colorString = colorString.split("").map((char) => {
5574
+ return char + char;
5575
+ }).join("");
5576
+ }
5577
+ const integer = parseInt(colorString, 16);
5578
+ const r = integer >> 16 & 255;
5579
+ const g = integer >> 8 & 255;
5580
+ const b = integer & 255;
5581
+ return [r, g, b];
5582
+ };
5583
+ convert.rgb.hcg = function(rgb) {
5584
+ const r = rgb[0] / 255;
5585
+ const g = rgb[1] / 255;
5586
+ const b = rgb[2] / 255;
5587
+ const max = Math.max(Math.max(r, g), b);
5588
+ const min = Math.min(Math.min(r, g), b);
5589
+ const chroma = max - min;
5590
+ let grayscale;
5591
+ let hue;
5592
+ if (chroma < 1) {
5593
+ grayscale = min / (1 - chroma);
5594
+ } else {
5595
+ grayscale = 0;
5596
+ }
5597
+ if (chroma <= 0) {
5598
+ hue = 0;
5599
+ } else if (max === r) {
5600
+ hue = (g - b) / chroma % 6;
5601
+ } else if (max === g) {
5602
+ hue = 2 + (b - r) / chroma;
5603
+ } else {
5604
+ hue = 4 + (r - g) / chroma;
5605
+ }
5606
+ hue /= 6;
5607
+ hue %= 1;
5608
+ return [hue * 360, chroma * 100, grayscale * 100];
5609
+ };
5610
+ convert.hsl.hcg = function(hsl) {
5611
+ const s = hsl[1] / 100;
5612
+ const l = hsl[2] / 100;
5613
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
5614
+ let f = 0;
5615
+ if (c < 1) {
5616
+ f = (l - 0.5 * c) / (1 - c);
5617
+ }
5618
+ return [hsl[0], c * 100, f * 100];
5619
+ };
5620
+ convert.hsv.hcg = function(hsv) {
5621
+ const s = hsv[1] / 100;
5622
+ const v = hsv[2] / 100;
5623
+ const c = s * v;
5624
+ let f = 0;
5625
+ if (c < 1) {
5626
+ f = (v - c) / (1 - c);
5627
+ }
5628
+ return [hsv[0], c * 100, f * 100];
5629
+ };
5630
+ convert.hcg.rgb = function(hcg) {
5631
+ const h = hcg[0] / 360;
5632
+ const c = hcg[1] / 100;
5633
+ const g = hcg[2] / 100;
5634
+ if (c === 0) {
5635
+ return [g * 255, g * 255, g * 255];
5636
+ }
5637
+ const pure = [0, 0, 0];
5638
+ const hi = h % 1 * 6;
5639
+ const v = hi % 1;
5640
+ const w = 1 - v;
5641
+ let mg = 0;
5642
+ switch (Math.floor(hi)) {
5643
+ case 0:
5644
+ pure[0] = 1;
5645
+ pure[1] = v;
5646
+ pure[2] = 0;
5647
+ break;
5648
+ case 1:
5649
+ pure[0] = w;
5650
+ pure[1] = 1;
5651
+ pure[2] = 0;
5652
+ break;
5653
+ case 2:
5654
+ pure[0] = 0;
5655
+ pure[1] = 1;
5656
+ pure[2] = v;
5657
+ break;
5658
+ case 3:
5659
+ pure[0] = 0;
5660
+ pure[1] = w;
5661
+ pure[2] = 1;
5662
+ break;
5663
+ case 4:
5664
+ pure[0] = v;
5665
+ pure[1] = 0;
5666
+ pure[2] = 1;
5667
+ break;
5668
+ default:
5669
+ pure[0] = 1;
5670
+ pure[1] = 0;
5671
+ pure[2] = w;
5672
+ }
5673
+ mg = (1 - c) * g;
5674
+ return [
5675
+ (c * pure[0] + mg) * 255,
5676
+ (c * pure[1] + mg) * 255,
5677
+ (c * pure[2] + mg) * 255
5678
+ ];
5679
+ };
5680
+ convert.hcg.hsv = function(hcg) {
5681
+ const c = hcg[1] / 100;
5682
+ const g = hcg[2] / 100;
5683
+ const v = c + g * (1 - c);
5684
+ let f = 0;
5685
+ if (v > 0) {
5686
+ f = c / v;
5687
+ }
5688
+ return [hcg[0], f * 100, v * 100];
5689
+ };
5690
+ convert.hcg.hsl = function(hcg) {
5691
+ const c = hcg[1] / 100;
5692
+ const g = hcg[2] / 100;
5693
+ const l = g * (1 - c) + 0.5 * c;
5694
+ let s = 0;
5695
+ if (l > 0 && l < 0.5) {
5696
+ s = c / (2 * l);
5697
+ } else if (l >= 0.5 && l < 1) {
5698
+ s = c / (2 * (1 - l));
5699
+ }
5700
+ return [hcg[0], s * 100, l * 100];
5701
+ };
5702
+ convert.hcg.hwb = function(hcg) {
5703
+ const c = hcg[1] / 100;
5704
+ const g = hcg[2] / 100;
5705
+ const v = c + g * (1 - c);
5706
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
5707
+ };
5708
+ convert.hwb.hcg = function(hwb) {
5709
+ const w = hwb[1] / 100;
5710
+ const b = hwb[2] / 100;
5711
+ const v = 1 - b;
5712
+ const c = v - w;
5713
+ let g = 0;
5714
+ if (c < 1) {
5715
+ g = (v - c) / (1 - c);
5716
+ }
5717
+ return [hwb[0], c * 100, g * 100];
5718
+ };
5719
+ convert.apple.rgb = function(apple) {
5720
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
5721
+ };
5722
+ convert.rgb.apple = function(rgb) {
5723
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
5724
+ };
5725
+ convert.gray.rgb = function(args) {
5726
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
5727
+ };
5728
+ convert.gray.hsl = function(args) {
5729
+ return [0, 0, args[0]];
5730
+ };
5731
+ convert.gray.hsv = convert.gray.hsl;
5732
+ convert.gray.hwb = function(gray) {
5733
+ return [0, 100, gray[0]];
5734
+ };
5735
+ convert.gray.cmyk = function(gray) {
5736
+ return [0, 0, 0, gray[0]];
5737
+ };
5738
+ convert.gray.lab = function(gray) {
5739
+ return [gray[0], 0, 0];
5740
+ };
5741
+ convert.gray.hex = function(gray) {
5742
+ const val = Math.round(gray[0] / 100 * 255) & 255;
5743
+ const integer = (val << 16) + (val << 8) + val;
5744
+ const string = integer.toString(16).toUpperCase();
5745
+ return "000000".substring(string.length) + string;
5746
+ };
5747
+ convert.rgb.gray = function(rgb) {
5748
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
5749
+ return [val / 255 * 100];
5750
+ };
5751
+ return conversions;
5752
+ }
5753
+ var route;
5754
+ var hasRequiredRoute;
5755
+ function requireRoute() {
5756
+ if (hasRequiredRoute) return route;
5757
+ hasRequiredRoute = 1;
5758
+ const conversions2 = requireConversions();
5759
+ function buildGraph() {
5760
+ const graph = {};
5761
+ const models = Object.keys(conversions2);
5762
+ for (let len = models.length, i2 = 0; i2 < len; i2++) {
5763
+ graph[models[i2]] = {
5764
+ // http://jsperf.com/1-vs-infinity
5765
+ // micro-opt, but this is simple.
5766
+ distance: -1,
5767
+ parent: null
5768
+ };
5769
+ }
5770
+ return graph;
5771
+ }
5772
+ function deriveBFS(fromModel) {
5773
+ const graph = buildGraph();
5774
+ const queue = [fromModel];
5775
+ graph[fromModel].distance = 0;
5776
+ while (queue.length) {
5777
+ const current = queue.pop();
5778
+ const adjacents = Object.keys(conversions2[current]);
5779
+ for (let len = adjacents.length, i2 = 0; i2 < len; i2++) {
5780
+ const adjacent = adjacents[i2];
5781
+ const node = graph[adjacent];
5782
+ if (node.distance === -1) {
5783
+ node.distance = graph[current].distance + 1;
5784
+ node.parent = current;
5785
+ queue.unshift(adjacent);
5786
+ }
5787
+ }
5788
+ }
5789
+ return graph;
5790
+ }
5791
+ function link(from, to) {
5792
+ return function(args) {
5793
+ return to(from(args));
5794
+ };
5795
+ }
5796
+ function wrapConversion(toModel, graph) {
5797
+ const path2 = [graph[toModel].parent, toModel];
5798
+ let fn = conversions2[graph[toModel].parent][toModel];
5799
+ let cur = graph[toModel].parent;
5800
+ while (graph[cur].parent) {
5801
+ path2.unshift(graph[cur].parent);
5802
+ fn = link(conversions2[graph[cur].parent][cur], fn);
5803
+ cur = graph[cur].parent;
5804
+ }
5805
+ fn.conversion = path2;
5806
+ return fn;
5807
+ }
5808
+ route = function(fromModel) {
5809
+ const graph = deriveBFS(fromModel);
5810
+ const conversion = {};
5811
+ const models = Object.keys(graph);
5812
+ for (let len = models.length, i2 = 0; i2 < len; i2++) {
5813
+ const toModel = models[i2];
5814
+ const node = graph[toModel];
5815
+ if (node.parent === null) {
5816
+ continue;
5817
+ }
5818
+ conversion[toModel] = wrapConversion(toModel, graph);
5819
+ }
5820
+ return conversion;
5821
+ };
5822
+ return route;
5823
+ }
5824
+ var colorConvert;
5825
+ var hasRequiredColorConvert;
5826
+ function requireColorConvert() {
5827
+ if (hasRequiredColorConvert) return colorConvert;
5828
+ hasRequiredColorConvert = 1;
5829
+ const conversions2 = requireConversions();
5830
+ const route2 = requireRoute();
5831
+ const convert = {};
5832
+ const models = Object.keys(conversions2);
5833
+ function wrapRaw(fn) {
5834
+ const wrappedFn = function(...args) {
5835
+ const arg0 = args[0];
5836
+ if (arg0 === void 0 || arg0 === null) {
5837
+ return arg0;
5838
+ }
5839
+ if (arg0.length > 1) {
5840
+ args = arg0;
5841
+ }
5842
+ return fn(args);
5843
+ };
5844
+ if ("conversion" in fn) {
5845
+ wrappedFn.conversion = fn.conversion;
5846
+ }
5847
+ return wrappedFn;
5848
+ }
5849
+ function wrapRounded(fn) {
5850
+ const wrappedFn = function(...args) {
5851
+ const arg0 = args[0];
5852
+ if (arg0 === void 0 || arg0 === null) {
5853
+ return arg0;
5854
+ }
5855
+ if (arg0.length > 1) {
5856
+ args = arg0;
5857
+ }
5858
+ const result = fn(args);
5859
+ if (typeof result === "object") {
5860
+ for (let len = result.length, i2 = 0; i2 < len; i2++) {
5861
+ result[i2] = Math.round(result[i2]);
5862
+ }
5863
+ }
5864
+ return result;
5865
+ };
5866
+ if ("conversion" in fn) {
5867
+ wrappedFn.conversion = fn.conversion;
5868
+ }
5869
+ return wrappedFn;
5870
+ }
5871
+ models.forEach((fromModel) => {
5872
+ convert[fromModel] = {};
5873
+ Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
5874
+ Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
5875
+ const routes = route2(fromModel);
5876
+ const routeModels = Object.keys(routes);
5877
+ routeModels.forEach((toModel) => {
5878
+ const fn = routes[toModel];
5879
+ convert[fromModel][toModel] = wrapRounded(fn);
5880
+ convert[fromModel][toModel].raw = wrapRaw(fn);
5881
+ });
5882
+ });
5883
+ colorConvert = convert;
5884
+ return colorConvert;
5885
+ }
5886
+ ansiStyles$1.exports;
5887
+ (function(module2) {
5888
+ const wrapAnsi16 = (fn, offset) => (...args) => {
5889
+ const code = fn(...args);
5890
+ return `\x1B[${code + offset}m`;
5891
+ };
5892
+ const wrapAnsi256 = (fn, offset) => (...args) => {
5893
+ const code = fn(...args);
5894
+ return `\x1B[${38 + offset};5;${code}m`;
5895
+ };
5896
+ const wrapAnsi16m = (fn, offset) => (...args) => {
5897
+ const rgb = fn(...args);
5898
+ return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
5899
+ };
5900
+ const ansi2ansi = (n) => n;
5901
+ const rgb2rgb = (r, g, b) => [r, g, b];
5902
+ const setLazyProperty = (object, property, get) => {
5903
+ Object.defineProperty(object, property, {
5904
+ get: () => {
5905
+ const value = get();
5906
+ Object.defineProperty(object, property, {
5907
+ value,
5908
+ enumerable: true,
5909
+ configurable: true
5910
+ });
5911
+ return value;
5912
+ },
5913
+ enumerable: true,
5914
+ configurable: true
5915
+ });
5916
+ };
5917
+ let colorConvert2;
5918
+ const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
5919
+ if (colorConvert2 === void 0) {
5920
+ colorConvert2 = requireColorConvert();
5921
+ }
5922
+ const offset = isBackground ? 10 : 0;
5923
+ const styles2 = {};
5924
+ for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
5925
+ const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
5926
+ if (sourceSpace === targetSpace) {
5927
+ styles2[name2] = wrap(identity, offset);
5928
+ } else if (typeof suite === "object") {
5929
+ styles2[name2] = wrap(suite[targetSpace], offset);
5930
+ }
5931
+ }
5932
+ return styles2;
5933
+ };
5934
+ function assembleStyles() {
5935
+ const codes = /* @__PURE__ */ new Map();
5936
+ const styles2 = {
5937
+ modifier: {
5938
+ reset: [0, 0],
5939
+ // 21 isn't widely supported and 22 does the same thing
5940
+ bold: [1, 22],
5941
+ dim: [2, 22],
5942
+ italic: [3, 23],
5943
+ underline: [4, 24],
5944
+ inverse: [7, 27],
5945
+ hidden: [8, 28],
5946
+ strikethrough: [9, 29]
5947
+ },
5948
+ color: {
5949
+ black: [30, 39],
5950
+ red: [31, 39],
5951
+ green: [32, 39],
5952
+ yellow: [33, 39],
5953
+ blue: [34, 39],
5954
+ magenta: [35, 39],
5955
+ cyan: [36, 39],
5956
+ white: [37, 39],
5957
+ // Bright color
5958
+ blackBright: [90, 39],
5959
+ redBright: [91, 39],
5960
+ greenBright: [92, 39],
5961
+ yellowBright: [93, 39],
5962
+ blueBright: [94, 39],
5963
+ magentaBright: [95, 39],
5964
+ cyanBright: [96, 39],
5965
+ whiteBright: [97, 39]
5966
+ },
5967
+ bgColor: {
5968
+ bgBlack: [40, 49],
5969
+ bgRed: [41, 49],
5970
+ bgGreen: [42, 49],
5971
+ bgYellow: [43, 49],
5972
+ bgBlue: [44, 49],
5973
+ bgMagenta: [45, 49],
5974
+ bgCyan: [46, 49],
5975
+ bgWhite: [47, 49],
5976
+ // Bright color
5977
+ bgBlackBright: [100, 49],
5978
+ bgRedBright: [101, 49],
5979
+ bgGreenBright: [102, 49],
5980
+ bgYellowBright: [103, 49],
5981
+ bgBlueBright: [104, 49],
5982
+ bgMagentaBright: [105, 49],
5983
+ bgCyanBright: [106, 49],
5984
+ bgWhiteBright: [107, 49]
5985
+ }
5986
+ };
5987
+ styles2.color.gray = styles2.color.blackBright;
5988
+ styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
5989
+ styles2.color.grey = styles2.color.blackBright;
5990
+ styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
5991
+ for (const [groupName, group] of Object.entries(styles2)) {
5992
+ for (const [styleName, style] of Object.entries(group)) {
5993
+ styles2[styleName] = {
5994
+ open: `\x1B[${style[0]}m`,
5995
+ close: `\x1B[${style[1]}m`
5996
+ };
5997
+ group[styleName] = styles2[styleName];
5998
+ codes.set(style[0], style[1]);
5999
+ }
6000
+ Object.defineProperty(styles2, groupName, {
6001
+ value: group,
6002
+ enumerable: false
6003
+ });
6004
+ }
6005
+ Object.defineProperty(styles2, "codes", {
6006
+ value: codes,
6007
+ enumerable: false
6008
+ });
6009
+ styles2.color.close = "\x1B[39m";
6010
+ styles2.bgColor.close = "\x1B[49m";
6011
+ setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
6012
+ setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
6013
+ setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
6014
+ setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
6015
+ setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
6016
+ setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
6017
+ return styles2;
6018
+ }
6019
+ Object.defineProperty(module2, "exports", {
6020
+ enumerable: true,
6021
+ get: assembleStyles
6022
+ });
6023
+ })(ansiStyles$1);
6024
+ var ansiStylesExports = ansiStyles$1.exports;
6025
+ var browser = {
6026
+ stdout: false,
6027
+ stderr: false
6028
+ };
6029
+ const stringReplaceAll$1 = (string, substring, replacer) => {
6030
+ let index = string.indexOf(substring);
6031
+ if (index === -1) {
6032
+ return string;
6033
+ }
6034
+ const substringLength = substring.length;
6035
+ let endIndex = 0;
6036
+ let returnValue = "";
6037
+ do {
6038
+ returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
6039
+ endIndex = index + substringLength;
6040
+ index = string.indexOf(substring, endIndex);
6041
+ } while (index !== -1);
6042
+ returnValue += string.substr(endIndex);
6043
+ return returnValue;
6044
+ };
6045
+ const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
6046
+ let endIndex = 0;
6047
+ let returnValue = "";
6048
+ do {
6049
+ const gotCR = string[index - 1] === "\r";
6050
+ returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
6051
+ endIndex = index + 1;
6052
+ index = string.indexOf("\n", endIndex);
6053
+ } while (index !== -1);
6054
+ returnValue += string.substr(endIndex);
6055
+ return returnValue;
6056
+ };
6057
+ var util = {
6058
+ stringReplaceAll: stringReplaceAll$1,
6059
+ stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
6060
+ };
6061
+ var templates;
6062
+ var hasRequiredTemplates;
6063
+ function requireTemplates() {
6064
+ if (hasRequiredTemplates) return templates;
6065
+ hasRequiredTemplates = 1;
6066
+ const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
6067
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
6068
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
6069
+ const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
6070
+ const ESCAPES = /* @__PURE__ */ new Map([
6071
+ ["n", "\n"],
6072
+ ["r", "\r"],
6073
+ ["t", " "],
6074
+ ["b", "\b"],
6075
+ ["f", "\f"],
6076
+ ["v", "\v"],
6077
+ ["0", "\0"],
6078
+ ["\\", "\\"],
6079
+ ["e", "\x1B"],
6080
+ ["a", "\x07"]
6081
+ ]);
6082
+ function unescape(c) {
6083
+ const u = c[0] === "u";
6084
+ const bracket = c[1] === "{";
6085
+ if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
6086
+ return String.fromCharCode(parseInt(c.slice(1), 16));
6087
+ }
6088
+ if (u && bracket) {
6089
+ return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
6090
+ }
6091
+ return ESCAPES.get(c) || c;
6092
+ }
6093
+ function parseArguments(name2, arguments_) {
6094
+ const results = [];
6095
+ const chunks = arguments_.trim().split(/\s*,\s*/g);
6096
+ let matches;
6097
+ for (const chunk of chunks) {
6098
+ const number = Number(chunk);
6099
+ if (!Number.isNaN(number)) {
6100
+ results.push(number);
6101
+ } else if (matches = chunk.match(STRING_REGEX)) {
6102
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
6103
+ } else {
6104
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
6105
+ }
6106
+ }
6107
+ return results;
6108
+ }
6109
+ function parseStyle(style) {
6110
+ STYLE_REGEX.lastIndex = 0;
6111
+ const results = [];
6112
+ let matches;
6113
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
6114
+ const name2 = matches[1];
6115
+ if (matches[2]) {
6116
+ const args = parseArguments(name2, matches[2]);
6117
+ results.push([name2].concat(args));
6118
+ } else {
6119
+ results.push([name2]);
6120
+ }
6121
+ }
6122
+ return results;
6123
+ }
6124
+ function buildStyle(chalk2, styles2) {
6125
+ const enabled = {};
6126
+ for (const layer of styles2) {
6127
+ for (const style of layer.styles) {
6128
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
6129
+ }
6130
+ }
6131
+ let current = chalk2;
6132
+ for (const [styleName, styles3] of Object.entries(enabled)) {
6133
+ if (!Array.isArray(styles3)) {
6134
+ continue;
6135
+ }
6136
+ if (!(styleName in current)) {
6137
+ throw new Error(`Unknown Chalk style: ${styleName}`);
6138
+ }
6139
+ current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
6140
+ }
6141
+ return current;
6142
+ }
6143
+ templates = (chalk2, temporary) => {
6144
+ const styles2 = [];
6145
+ const chunks = [];
6146
+ let chunk = [];
6147
+ temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
6148
+ if (escapeCharacter) {
6149
+ chunk.push(unescape(escapeCharacter));
6150
+ } else if (style) {
6151
+ const string = chunk.join("");
6152
+ chunk = [];
6153
+ chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
6154
+ styles2.push({ inverse, styles: parseStyle(style) });
6155
+ } else if (close) {
6156
+ if (styles2.length === 0) {
6157
+ throw new Error("Found extraneous } in Chalk template literal");
6158
+ }
6159
+ chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
6160
+ chunk = [];
6161
+ styles2.pop();
6162
+ } else {
6163
+ chunk.push(character);
6164
+ }
6165
+ });
6166
+ chunks.push(chunk.join(""));
6167
+ if (styles2.length > 0) {
6168
+ const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
6169
+ throw new Error(errMessage);
6170
+ }
6171
+ return chunks.join("");
6172
+ };
6173
+ return templates;
6174
+ }
6175
+ const ansiStyles = ansiStylesExports;
6176
+ const { stdout: stdoutColor, stderr: stderrColor } = browser;
6177
+ const {
6178
+ stringReplaceAll,
6179
+ stringEncaseCRLFWithFirstIndex
6180
+ } = util;
6181
+ const { isArray } = Array;
6182
+ const levelMapping = [
6183
+ "ansi",
6184
+ "ansi",
6185
+ "ansi256",
6186
+ "ansi16m"
6187
+ ];
6188
+ const styles = /* @__PURE__ */ Object.create(null);
6189
+ const applyOptions = (object, options = {}) => {
6190
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
6191
+ throw new Error("The `level` option should be an integer from 0 to 3");
6192
+ }
6193
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
6194
+ object.level = options.level === void 0 ? colorLevel : options.level;
6195
+ };
6196
+ class ChalkClass {
6197
+ constructor(options) {
6198
+ return chalkFactory(options);
6199
+ }
6200
+ }
6201
+ const chalkFactory = (options) => {
6202
+ const chalk2 = {};
6203
+ applyOptions(chalk2, options);
6204
+ chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
6205
+ Object.setPrototypeOf(chalk2, Chalk.prototype);
6206
+ Object.setPrototypeOf(chalk2.template, chalk2);
6207
+ chalk2.template.constructor = () => {
6208
+ throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
6209
+ };
6210
+ chalk2.template.Instance = ChalkClass;
6211
+ return chalk2.template;
6212
+ };
6213
+ function Chalk(options) {
6214
+ return chalkFactory(options);
6215
+ }
6216
+ for (const [styleName, style] of Object.entries(ansiStyles)) {
6217
+ styles[styleName] = {
6218
+ get() {
6219
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
6220
+ Object.defineProperty(this, styleName, { value: builder });
6221
+ return builder;
6222
+ }
6223
+ };
6224
+ }
6225
+ styles.visible = {
6226
+ get() {
6227
+ const builder = createBuilder(this, this._styler, true);
6228
+ Object.defineProperty(this, "visible", { value: builder });
6229
+ return builder;
6230
+ }
6231
+ };
6232
+ const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
6233
+ for (const model of usedModels) {
6234
+ styles[model] = {
6235
+ get() {
6236
+ const { level } = this;
6237
+ return function(...arguments_) {
6238
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
6239
+ return createBuilder(this, styler, this._isEmpty);
6240
+ };
6241
+ }
6242
+ };
6243
+ }
6244
+ for (const model of usedModels) {
6245
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
6246
+ styles[bgModel] = {
6247
+ get() {
6248
+ const { level } = this;
6249
+ return function(...arguments_) {
6250
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
6251
+ return createBuilder(this, styler, this._isEmpty);
6252
+ };
6253
+ }
6254
+ };
6255
+ }
6256
+ const proto = Object.defineProperties(() => {
6257
+ }, {
6258
+ ...styles,
6259
+ level: {
6260
+ enumerable: true,
6261
+ get() {
6262
+ return this._generator.level;
6263
+ },
6264
+ set(level) {
6265
+ this._generator.level = level;
6266
+ }
6267
+ }
6268
+ });
6269
+ const createStyler = (open, close, parent) => {
6270
+ let openAll;
6271
+ let closeAll;
6272
+ if (parent === void 0) {
6273
+ openAll = open;
6274
+ closeAll = close;
6275
+ } else {
6276
+ openAll = parent.openAll + open;
6277
+ closeAll = close + parent.closeAll;
6278
+ }
6279
+ return {
6280
+ open,
6281
+ close,
6282
+ openAll,
6283
+ closeAll,
6284
+ parent
6285
+ };
6286
+ };
6287
+ const createBuilder = (self2, _styler, _isEmpty) => {
6288
+ const builder = (...arguments_) => {
6289
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
6290
+ return applyStyle(builder, chalkTag(builder, ...arguments_));
6291
+ }
6292
+ return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
6293
+ };
6294
+ Object.setPrototypeOf(builder, proto);
6295
+ builder._generator = self2;
6296
+ builder._styler = _styler;
6297
+ builder._isEmpty = _isEmpty;
6298
+ return builder;
6299
+ };
6300
+ const applyStyle = (self2, string) => {
6301
+ if (self2.level <= 0 || !string) {
6302
+ return self2._isEmpty ? "" : string;
6303
+ }
6304
+ let styler = self2._styler;
6305
+ if (styler === void 0) {
6306
+ return string;
6307
+ }
6308
+ const { openAll, closeAll } = styler;
6309
+ if (string.indexOf("\x1B") !== -1) {
6310
+ while (styler !== void 0) {
6311
+ string = stringReplaceAll(string, styler.close, styler.open);
6312
+ styler = styler.parent;
6313
+ }
6314
+ }
6315
+ const lfIndex = string.indexOf("\n");
6316
+ if (lfIndex !== -1) {
6317
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
6318
+ }
6319
+ return openAll + string + closeAll;
6320
+ };
6321
+ let template;
6322
+ const chalkTag = (chalk2, ...strings) => {
6323
+ const [firstString] = strings;
6324
+ if (!isArray(firstString) || !isArray(firstString.raw)) {
6325
+ return strings.join(" ");
6326
+ }
6327
+ const arguments_ = strings.slice(1);
6328
+ const parts = [firstString.raw[0]];
6329
+ for (let i2 = 1; i2 < firstString.length; i2++) {
6330
+ parts.push(
6331
+ String(arguments_[i2 - 1]).replace(/[{}\\]/g, "\\$&"),
6332
+ String(firstString.raw[i2])
6333
+ );
6334
+ }
6335
+ if (template === void 0) {
6336
+ template = requireTemplates();
6337
+ }
6338
+ return template(chalk2, parts.join(""));
6339
+ };
6340
+ Object.defineProperties(Chalk.prototype, styles);
6341
+ const chalk = Chalk();
6342
+ chalk.supportsColor = stdoutColor;
6343
+ chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
6344
+ chalk.stderr.supportsColor = stderrColor;
6345
+ const { accessSync, constants, readFileSync } = fs$1;
6346
+ const envOptions = {};
6347
+ function SetupConfig(envOptions2, logger) {
6348
+ const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
6349
+ config_1({ path: envfile });
6350
+ const defconfig = {
6351
+ // Node runtime environment
6352
+ isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
6353
+ isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
6354
+ dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
6355
+ dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
6356
+ dbpasswordfile: process.env.DB_PASSWORD_FILE,
6357
+ dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
6358
+ database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
6359
+ databaseUrl: process.env.DATABASE_URL,
6360
+ connectionString: "",
6361
+ defaultDatabaseConnectionString: "",
6362
+ STSServerType: process.env.STS_SERVER_TYPE === void 0 ? "EXPRESS_TLS" : process.env.STS_SERVER_TYPE,
6363
+ logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
6364
+ logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
6365
+ logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
6366
+ poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
6367
+ useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
6368
+ respawnOnFail: process.env.RESPAWN === void 0 ? true : process.env.RESPAWN === "true" ? true : false,
6369
+ defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
6370
+ useRedisDatabaseCache: process.env.USE_REDIS_DATABASE_CACHE === void 0 ? false : process.env.USE_REDIS_DATABASE_CACHE === "true" ? true : false,
6371
+ useSocketIoRedisAdaptor: process.env.USE_SOCKET_IO_REDIS_ADAPTOR === void 0 ? false : process.env.USE_SOCKET_IO_REDIS_ADAPTOR === "true" ? true : false,
6372
+ socketIoRedisAdaptorUrl: process.env.SOCKET_IO_REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.SOCKET_IO_REDIS_ADAPTOR_URL,
6373
+ useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
6374
+ redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
6375
+ redisDatabaseCacheEndFlush: process.env.REDIS_DATABASE_CACHE_END_FLUSH === void 0 ? false : process.env.REDIS_DATABASE_CACHE_END_FLUSH === "true" ? true : false,
6376
+ redisDatabaseCacheUrl: process.env.REDIS_DATABASE_CACHE_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_DATABASE_CACHE_URL,
6377
+ defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
6378
+ defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
6379
+ rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
6380
+ rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
6381
+ rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
6382
+ rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
6383
+ rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
6384
+ rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
6385
+ rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
6386
+ rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
6387
+ stsfhirendpoint: process.env.STSFHIR_ENDPOINT === void 0 ? "https://localhost" : process.env.STSFHIR_ENDPOINT,
6388
+ stsfhirhostport: process.env.STSFHIR_HOST_PORT === void 0 ? "3005" : process.env.STSFHIR_HOST_PORT,
6389
+ stsfhirport: process.env.STSFHIR_PORT === void 0 ? "3005" : process.env.STSFHIR_PORT,
6390
+ stsfhirapiroot: process.env.STSFHIR_APIROOT === void 0 ? "/stsfhir/r5" : process.env.STSFHIR_APIROOT,
6391
+ stsfhirprometheussupport: process.env.STSFHIR_PROM_SUPPORT === void 0 ? true : process.env.STSFHIR_PROM_SUPPORT === "true" ? true : false,
6392
+ stsfhirprometheusclusterport: process.env.STSFHIR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.STSFHIR_PROM_CLUSTER_PORT,
6393
+ stsfhirservicename: process.env.STSFHIR_SERVICE_NAME === void 0 ? "STSFHIR" : process.env.STSFHIR_SERVICE_NAME,
6394
+ stsfhirserviceversion: process.env.STSFHIR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.STSFHIR_SERVICE_VERSION,
6395
+ imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
6396
+ imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
6397
+ import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
6398
+ imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
6399
+ imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
6400
+ imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
6401
+ imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
6402
+ imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
6403
+ imRedisKeepAliveProcessorUrl: process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL,
6404
+ imRedisMessageProcessorUrl: process.env.IM_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_MESSAGE_PROCESSOR_URL,
6405
+ asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
6406
+ ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
6407
+ asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
6408
+ asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
6409
+ asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
6410
+ asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
6411
+ asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
6412
+ asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
6413
+ asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
6414
+ asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
6415
+ asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
6416
+ asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
6417
+ asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
6418
+ asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
6419
+ asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
6420
+ authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
6421
+ authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
6422
+ authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
6423
+ authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
6424
+ brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
6425
+ brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
6426
+ brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
6427
+ brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
6428
+ brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
6429
+ brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
6430
+ brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
6431
+ brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
6432
+ trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
6433
+ trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
6434
+ trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
6435
+ trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
6436
+ trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
6437
+ trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
6438
+ trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
6439
+ trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
6440
+ trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
6441
+ trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
6442
+ trnRedisMessageProcessorUrl: process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL,
6443
+ lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
6444
+ lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
6445
+ lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
6446
+ lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
6447
+ lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
6448
+ lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
6449
+ lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
6450
+ lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
6451
+ publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
6452
+ publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
6453
+ transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
6454
+ useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
6455
+ keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
6456
+ maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
6457
+ maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
6458
+ maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
6459
+ timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
6460
+ maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
6461
+ instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
6462
+ instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
6463
+ authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
6464
+ authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
6465
+ authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
6466
+ masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
6467
+ childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
6468
+ systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
6469
+ ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
6470
+ httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
6471
+ httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
6472
+ tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
6473
+ jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
6474
+ jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
6475
+ jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
6476
+ jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
6477
+ jwksAuthConfigRateLimitRequestsPerMinute: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE === void 0 ? 10 : parseInt(process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE),
6478
+ jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
6479
+ influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
6480
+ influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
6481
+ influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
6482
+ influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
6483
+ influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
6484
+ influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
6485
+ influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
6486
+ influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
6487
+ influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
6488
+ influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
6489
+ influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
6490
+ influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
6491
+ kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
6492
+ kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
6493
+ kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
6494
+ kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
6495
+ kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
6496
+ kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
6497
+ kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
6498
+ kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
6499
+ kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
6500
+ kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
6501
+ kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
6502
+ kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
6503
+ kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
6504
+ observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
6505
+ stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
6506
+ };
6507
+ const ReadFile = (passwordFile) => {
6508
+ try {
6509
+ accessSync(passwordFile, constants.R_OK);
6510
+ const data = readFileSync(passwordFile, "utf8");
6511
+ if (logger) ;
6512
+ return data;
6513
+ } catch (err) {
6514
+ return "";
6515
+ }
6516
+ };
6517
+ const fileconfig = [
6518
+ { fileprop: "dbpasswordfile", prop: "dbpassword" },
6519
+ // JWKS secret file processing
6520
+ { fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
6521
+ // InfluxDB file processing
6522
+ { fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
6523
+ ];
6524
+ fileconfig.forEach((v) => {
6525
+ if (defconfig[v.fileprop] !== void 0) {
6526
+ defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
6527
+ }
6528
+ });
6529
+ for (const [key, val] of Object.entries(defconfig)) {
6530
+ envOptions2[key] = val;
6531
+ }
6532
+ }
6533
+ function $SetupOptions(envOptions2) {
6534
+ SetupConfig(envOptions2);
6535
+ const options = envOptions2;
6536
+ if (options.dbhost) {
6537
+ const hosts = options.dbhost.split(",");
6538
+ envOptions2.connectionString = hosts.map((host) => {
6539
+ return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
6540
+ }).join(",");
6541
+ envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
6542
+ return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
6543
+ }).join(",");
6544
+ }
6545
+ }
6546
+ const envOptionsHandler = {
6547
+ get(target, prop, receiver) {
6548
+ if (Object.keys(target).length === 0) {
6549
+ $SetupOptions(target);
6550
+ }
6551
+ return Reflect.get(target, prop, receiver);
6552
+ }
6553
+ };
6554
+ const goptions = new Proxy(envOptions, envOptionsHandler);
6555
+ class AgentManager {
6556
+ constructor(agentManagerOptions) {
6557
+ __privateAdd2(this, _options);
6558
+ __privateAdd2(this, _httpAgent, null);
6559
+ __privateAdd2(this, _httpsAgent, null);
6560
+ __privateAdd2(this, _agentResetInterval, null);
6561
+ __privateAdd2(this, _requestCount, 0);
6562
+ __privateAdd2(this, _SetupResetInterval, () => {
6563
+ __privateSet2(this, _agentResetInterval, setTimeout(() => {
6564
+ this.ResetAgent();
6565
+ __privateGet2(this, _SetupResetInterval).call(this);
6566
+ }, __privateGet2(this, _options).agentResetInterval).unref());
6567
+ });
6568
+ __privateAdd2(this, _GetAgentOptions, (https2) => {
6569
+ let options;
6570
+ if (__privateGet2(this, _options).agentOptions) {
6571
+ options = {
6572
+ keepAlive: __privateGet2(this, _options).agentOptions.keepAlive,
6573
+ maxSockets: __privateGet2(this, _options).agentOptions.maxSockets,
6574
+ maxTotalSockets: __privateGet2(this, _options).agentOptions.maxTotalSockets,
6575
+ maxFreeSockets: __privateGet2(this, _options).agentOptions.maxFreeSockets,
6576
+ timeout: __privateGet2(this, _options).agentOptions.timeout
6577
+ //@@ config
6578
+ };
6579
+ if (https2 === true) {
6580
+ options.rejectUnauthorized = __privateGet2(this, _options).agentOptions.rejectUnauthorized;
6581
+ }
6582
+ } else {
6583
+ options = {
6584
+ keepAlive: process.env.NODE_ENV === "test" ? false : goptions.keepAlive,
6585
+ maxSockets: goptions.maxSockets,
6586
+ maxTotalSockets: goptions.maxTotalSockets,
6587
+ maxFreeSockets: goptions.maxFreeSockets,
6588
+ timeout: 3e4
6589
+ //@@ config
6590
+ };
6591
+ if (https2 === true) {
6592
+ options.rejectUnauthorized = goptions.isProduction;
6593
+ }
6594
+ }
6595
+ return options;
6596
+ });
6597
+ __privateSet2(this, _options, agentManagerOptions);
6598
+ if (__privateGet2(this, _options).agentResetInterval) {
6599
+ __privateGet2(this, _SetupResetInterval).call(this);
6600
+ }
6601
+ }
6602
+ IncRequestCount() {
6603
+ __privateWrapper2(this, _requestCount)._++;
6604
+ if (__privateGet2(this, _options).agentResetCount) {
6605
+ if (__privateGet2(this, _requestCount) % __privateGet2(this, _options).agentResetCount === 0) {
6606
+ this.ResetAgent();
6607
+ }
6608
+ }
6609
+ }
6610
+ IsHttps(protocol) {
6611
+ if (protocol.toLowerCase().startsWith("https:")) {
6612
+ return true;
6613
+ }
6614
+ return false;
6615
+ }
6616
+ GetAgent(protocol) {
6617
+ if (protocol.toLowerCase().startsWith("https:")) {
6618
+ if (__privateGet2(this, _httpsAgent) === null) {
6619
+ __privateSet2(this, _httpsAgent, new https.Agent(__privateGet2(this, _GetAgentOptions).call(this, true)));
6620
+ }
6621
+ return __privateGet2(this, _httpsAgent);
6622
+ } else if (protocol.toLowerCase().startsWith("http:")) {
6623
+ if (__privateGet2(this, _httpAgent) === null) {
6624
+ __privateSet2(this, _httpAgent, new http.Agent(__privateGet2(this, _GetAgentOptions).call(this, false)));
6625
+ }
6626
+ return __privateGet2(this, _httpAgent);
6627
+ } else {
6628
+ return null;
6629
+ }
6630
+ }
6631
+ ResetAgent() {
6632
+ __privateSet2(this, _httpAgent, null);
6633
+ __privateSet2(this, _httpsAgent, null);
6634
+ }
6635
+ /*
6636
+ url
6637
+ ,method: 'post'
6638
+ ,data: payload
6639
+ ,headers: headers
6640
+ ,httpsAgent: this.#agentManager.GetAgent(url)
6641
+ */
6642
+ /*
6643
+ postgresContainer = await new GenericContainer("postgres")
6644
+ .withExposedPorts(5432)
6645
+ .withEnvironment({
6646
+ POSTGRES_PASSWORD: "postgres",
6647
+ //UV_THREADPOOL_SIZE: "64"
6648
+ })
6649
+ .withCommand(['-c', 'max_connections=20'])
6650
+ .start();
6651
+ */
6652
+ Terminate() {
6653
+ if (__privateGet2(this, _agentResetInterval)) {
6654
+ clearTimeout(__privateGet2(this, _agentResetInterval));
6655
+ __privateSet2(this, _agentResetInterval, null);
6656
+ }
6657
+ if (__privateGet2(this, _httpAgent)) {
6658
+ __privateGet2(this, _httpAgent).destroy();
6659
+ __privateSet2(this, _httpAgent, null);
6660
+ }
6661
+ if (__privateGet2(this, _httpsAgent)) {
6662
+ __privateGet2(this, _httpsAgent).destroy();
6663
+ __privateSet2(this, _httpsAgent, null);
6664
+ }
6665
+ }
6666
+ }
6667
+ _options = /* @__PURE__ */ new WeakMap();
6668
+ _httpAgent = /* @__PURE__ */ new WeakMap();
6669
+ _httpsAgent = /* @__PURE__ */ new WeakMap();
6670
+ _agentResetInterval = /* @__PURE__ */ new WeakMap();
6671
+ _requestCount = /* @__PURE__ */ new WeakMap();
6672
+ _SetupResetInterval = /* @__PURE__ */ new WeakMap();
6673
+ _GetAgentOptions = /* @__PURE__ */ new WeakMap();
6674
+ class STSAxiosConfig {
6675
+ constructor(url, method, headers, timeout) {
6676
+ __privateAdd2(this, _url);
6677
+ __privateAdd2(this, _method);
6678
+ __privateAdd2(this, _headers);
6679
+ __privateAdd2(this, _data);
6680
+ __privateAdd2(this, _agentManager);
6681
+ __privateAdd2(this, _timeout);
6682
+ __privateSet2(this, _url, url);
6683
+ __privateSet2(this, _method, method);
6684
+ __privateSet2(this, _headers, headers);
6685
+ if (timeout !== void 0) {
6686
+ __privateSet2(this, _timeout, timeout);
6687
+ }
6688
+ }
6689
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6690
+ withData(data) {
6691
+ __privateSet2(this, _data, data);
6692
+ return this;
6693
+ }
6694
+ withTimeout(timeout) {
6695
+ __privateSet2(this, _timeout, timeout);
6696
+ return this;
6697
+ }
6698
+ withAgentManager(agentManager) {
6699
+ __privateSet2(this, _agentManager, agentManager);
6700
+ return this;
6701
+ }
6702
+ get config() {
6703
+ const retVal = {
6704
+ url: __privateGet2(this, _url),
6705
+ method: __privateGet2(this, _method),
6706
+ headers: __privateGet2(this, _headers)
6707
+ };
6708
+ if (__privateGet2(this, _agentManager) !== void 0) {
6709
+ if (__privateGet2(this, _agentManager).IsHttps(__privateGet2(this, _url))) {
6710
+ retVal.httpsAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
6711
+ } else {
6712
+ retVal.httpAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
6713
+ }
6714
+ }
6715
+ if (__privateGet2(this, _data) !== void 0) {
6716
+ retVal.data = __privateGet2(this, _data);
6717
+ }
6718
+ if (__privateGet2(this, _timeout) !== void 0) {
6719
+ retVal.timeout = __privateGet2(this, _timeout);
6720
+ }
6721
+ return retVal;
6722
+ }
6723
+ }
6724
+ _url = /* @__PURE__ */ new WeakMap();
6725
+ _method = /* @__PURE__ */ new WeakMap();
6726
+ _headers = /* @__PURE__ */ new WeakMap();
6727
+ _data = /* @__PURE__ */ new WeakMap();
6728
+ _agentManager = /* @__PURE__ */ new WeakMap();
6729
+ _timeout = /* @__PURE__ */ new WeakMap();
6730
+ class PublishTransportRESTServer extends stsutils.STSOptionsBase {
6731
+ constructor(options) {
6732
+ super(options);
6733
+ __privateAdd(this, _agentManager2, null);
6734
+ // Returns true for success or false for failure.
6735
+ __publicField(this, "Publish", async (payload) => {
6736
+ try {
6737
+ if (this.options.showPublishPayload) {
6738
+ console.log(chalk$2.grey(`PublishTransportRESTServer::Publish() url: [${this.options.url}]`));
6739
+ console.log(payload);
6740
+ }
6741
+ const encodedData = encode(payload, { ignoreUndefined: true });
6742
+ const headers = { "Content-Type": "application/octet-stream" };
6743
+ let retVal = null;
6744
+ if (this.options.socketPath) {
6745
+ retVal = await axios({
6746
+ method: "post",
6747
+ //data: payload,
6748
+ data: Buffer.from(encodedData),
6749
+ headers,
6750
+ //httpsAgent: this.#httpsAgent,
6751
+ socketPath: this.options.socketPath
6752
+ });
6753
+ } else {
6754
+ if (isNode && __privateGet(this, _agentManager2)) {
6755
+ retVal = await axios(new STSAxiosConfig(this.options.url, "post", headers).withData(Buffer.from(encodedData)).withAgentManager(__privateGet(this, _agentManager2)).config);
6756
+ } else {
6757
+ const blob = new Blob([encodedData], { type: "application/octet-stream" });
6758
+ retVal = await axios(new STSAxiosConfig(this.options.url, "post", headers).withData(blob).config);
6759
+ }
6760
+ }
6761
+ if (retVal.status !== 200) {
6762
+ if (this.options.showPublishPayload) {
6763
+ console.log(chalk$2.red(`PublishTransportRESTServer::Publish() Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
6764
+ }
6765
+ this.options.logger.debug(chalk$2.red(`Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
6766
+ return false;
6767
+ } else {
6768
+ if (this.options.showPublishPayload) {
6769
+ console.log(chalk$2.grey(`PublishTransportRESTServer::Publish() _PerformPublishRESTAPI:_PerformPublish:#publishmessage: [${this.options.url}] - Valid response from server: [${retVal.status}]`));
6770
+ }
6771
+ }
6772
+ return true;
6773
+ } catch (error) {
6774
+ if (this.options.showPublishPayload) {
6775
+ console.log(chalk$2.red(`PublishTransportRESTServer::Publish() Error (PublishRESTServer:_PerformPublishRESTAPI:Error: [${error}]`));
6776
+ }
6777
+ return false;
6778
+ }
6779
+ });
6780
+ if (isNode) {
6781
+ __privateSet(this, _agentManager2, new AgentManager({
6782
+ agentOptions: this.options.agentOptions
6783
+ }));
6784
+ }
6785
+ }
6786
+ get options() {
6787
+ return super.options;
6788
+ }
6789
+ async Close() {
6790
+ if (__privateGet(this, _agentManager2)) {
6791
+ __privateGet(this, _agentManager2).Terminate();
6792
+ }
6793
+ return true;
6794
+ }
6795
+ }
6796
+ _agentManager2 = new WeakMap();
6797
+ class PublishInstruments extends stsutils.STSOptionsBase {
6798
+ constructor(options) {
6799
+ super(options);
6800
+ __privateAdd(this, _PublishInstruments_instances);
6801
+ __privateAdd(this, _inPublish, false);
6802
+ __privateAdd(this, _observer2, null);
6803
+ __privateAdd(this, _publishState, 0);
6804
+ __privateAdd(this, _publisherTransport, null);
6805
+ __privateSet(this, _publisherTransport, null);
6806
+ switch (options.publishTransportBaseOptions.transportType) {
6807
+ case TransportType.RESTAPI:
6808
+ __privateSet(this, _publisherTransport, new PublishTransportRESTServer(options.publishTransportBaseOptions));
6809
+ break;
6810
+ }
6811
+ __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "constructor()");
6812
+ }
6813
+ get options() {
6814
+ return super.options;
6815
+ }
6816
+ async Publish() {
6817
+ if (__privateGet(this, _inPublish)) {
6818
+ return false;
6819
+ }
6820
+ if (__privateGet(this, _publisherTransport)) {
6821
+ try {
6822
+ __privateSet(this, _inPublish, true);
6823
+ if (this.options.publishInstrumentController) {
6824
+ const instrumentPayload = this.options.publishInstrumentController.GetPayloadData();
6825
+ return await __privateGet(this, _publisherTransport).Publish(instrumentPayload);
6826
+ }
6827
+ return false;
6828
+ } catch (error) {
6829
+ return false;
6830
+ } finally {
6831
+ __privateSet(this, _inPublish, false);
6832
+ }
6833
+ } else {
6834
+ return false;
6835
+ }
6836
+ }
6837
+ async StartPublish() {
6838
+ if (__privateGet(this, _publishState) !== 0) {
6839
+ this.options.logger.debug(chalk$2.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state. Current State: [${__privateGet(this, _publishState)}]`));
6840
+ return false;
6841
+ }
6842
+ __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 1, "StartPublish()");
6843
+ __privateMethod(this, _PublishInstruments_instances, PublishTimeoutLoop_fn).call(this, this.options.publishInterval);
6844
+ return true;
6845
+ }
6846
+ async EndPublish() {
6847
+ if (__privateGet(this, _publishState) !== 1) {
6848
+ this.options.logger.debug(chalk$2.yellow(`EndPublish:${this.options.processContext.nid}: EndPublish called when not within the started state. Current State: [${__privateGet(this, _publishState)}]`));
6849
+ return false;
6850
+ }
6851
+ __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 2, "EndPublish() (1)");
6852
+ if (__privateGet(this, _observer2) !== null) {
6853
+ clearTimeout(__privateGet(this, _observer2));
6854
+ __privateSet(this, _observer2, null);
6855
+ await this.Publish();
6856
+ }
6857
+ if (__privateGet(this, _publisherTransport)) {
6858
+ await __privateGet(this, _publisherTransport).Close();
6859
+ }
6860
+ __privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "EndPublish() (2)");
6861
+ return true;
4689
6862
  }
4690
6863
  }
4691
6864
  _inPublish = new WeakMap();
@@ -4712,7 +6885,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4712
6885
  UpdateState_fn = function(newState, comment) {
4713
6886
  const previousState = __privateGet(this, _publishState);
4714
6887
  __privateSet(this, _publishState, newState);
4715
- this.options.logger.debug(chalk$1.yellow(`#UpdateState:${this.options.processContext.nid}: Previous State: [${previousState}]. Current State: [${__privateGet(this, _publishState)}]. Comment: [${comment}]`));
6888
+ this.options.logger.debug(chalk$2.yellow(`#UpdateState:${this.options.processContext.nid}: Previous State: [${previousState}]. Current State: [${__privateGet(this, _publishState)}]. Comment: [${comment}]`));
4716
6889
  };
4717
6890
  var ePublishState = /* @__PURE__ */ ((ePublishState2) => {
4718
6891
  ePublishState2[ePublishState2["init"] = 0] = "init";
@@ -4775,11 +6948,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4775
6948
  }
4776
6949
  SetupInstrumentation() {
4777
6950
  if (!this.options.instrumentDefinitions) {
4778
- this.options.logger.debug(chalk$1.yellow(`SetupInstrumentation:${this.options.processContext.nid}: No instrument(s) defined within supplied options.`));
6951
+ this.options.logger.debug(chalk$2.yellow(`SetupInstrumentation:${this.options.processContext.nid}: No instrument(s) defined within supplied options.`));
4779
6952
  return;
4780
6953
  }
4781
6954
  if (!this.options.processContext) {
4782
- this.options.logger.debug(chalk$1.yellow(`SetupInstrumentation: No context defined within supplied options.`));
6955
+ this.options.logger.debug(chalk$2.yellow(`SetupInstrumentation: No context defined within supplied options.`));
4783
6956
  return;
4784
6957
  }
4785
6958
  __privateMethod(this, _PublishInstrumentController_instances, CreateInstruments_fn).call(this, this.options.instrumentDefinitions);
@@ -4804,7 +6977,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4804
6977
  if (__privateGet(this, _instruments)[instrumentName]) {
4805
6978
  __privateMethod(this, _PublishInstrumentController_instances, ProcessTelemetryCommand_fn).call(this, instrumentName, telemetry);
4806
6979
  } else {
4807
- this.options.logger.debug(chalk$1.red(`UpdateInstrument:${this.options.processContext.nid}: Attempted to UpdateInstrument before initialised.`));
6980
+ this.options.logger.debug(chalk$2.red(`UpdateInstrument:${this.options.processContext.nid}: Attempted to UpdateInstrument before initialised.`));
4808
6981
  }
4809
6982
  }
4810
6983
  /**
@@ -4877,21 +7050,21 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4877
7050
  const STSInstrumentControllerPlugin = {
4878
7051
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4879
7052
  install: (app, options) => {
4880
- options.logger.debug(chalk$1.yellow(`STSInstrumentControllerPlugin:install:Start`));
7053
+ options.logger.debug(chalk$2.yellow(`STSInstrumentControllerPlugin:install:Start`));
4881
7054
  const aic = new PublishInstrumentController(options);
4882
7055
  if (!app.config.globalProperties.$sts) {
4883
- options.logger.debug(chalk$1.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] does not exist.`));
7056
+ options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] does not exist.`));
4884
7057
  app.config.globalProperties.$sts = {};
4885
- options.logger.debug(chalk$1.cyan(`STSInstrumentControllerPlugin:install: created empty [app.config.globalProperties.$sts].`));
7058
+ options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: created empty [app.config.globalProperties.$sts].`));
4886
7059
  } else {
4887
- options.logger.debug(chalk$1.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] already exists.`));
7060
+ options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] already exists.`));
4888
7061
  }
4889
7062
  app.config.globalProperties.$sts.aic = aic;
4890
7063
  app.config.globalProperties.$sts[STSInstrumentControllerPluginKey] = aic;
4891
- options.logger.debug(chalk$1.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into [app.config.globalProperties.$sts] using: [${String(STSInstrumentControllerPluginKey)}].`));
7064
+ options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into [app.config.globalProperties.$sts] using: [${String(STSInstrumentControllerPluginKey)}].`));
4892
7065
  app.provide(STSInstrumentControllerPluginKey, aic);
4893
- options.logger.debug(chalk$1.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into 'provide' using: [${String(STSInstrumentControllerPluginKey)}].`));
4894
- options.logger.debug(chalk$1.green(`STSInstrumentControllerPlugin:install:End`));
7066
+ options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into 'provide' using: [${String(STSInstrumentControllerPluginKey)}].`));
7067
+ options.logger.debug(chalk$2.green(`STSInstrumentControllerPlugin:install:End`));
4895
7068
  }
4896
7069
  };
4897
7070
  var SubscriptionTopic = /* @__PURE__ */ ((SubscriptionTopic2) => {
@@ -5486,7 +7659,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5486
7659
  constructor(options) {
5487
7660
  __privateAdd(this, _ObservabilityRESTAPISubscriber_instances);
5488
7661
  __privateAdd(this, _socketSubscribeKeepAlive, {});
5489
- __privateAdd(this, _options2);
7662
+ __privateAdd(this, _options3);
5490
7663
  // This is required becuase each call to .bind create a new replica bound function - so we need the same instance for on/off event bindings.
5491
7664
  __publicField(this, "KeepAliveAckBoundFunction");
5492
7665
  __privateAdd(this, _GetData, async (subscription) => {
@@ -5500,11 +7673,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5500
7673
  subscription.cb(payload);
5501
7674
  }
5502
7675
  } catch (error) {
5503
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$1.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
7676
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$2.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
5504
7677
  __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subscription);
5505
7678
  }
5506
7679
  });
5507
- __privateSet(this, _options2, options);
7680
+ __privateSet(this, _options3, options);
5508
7681
  }
5509
7682
  SubscribeOne(subscription) {
5510
7683
  this.Subscribe([subscription]);
@@ -5512,11 +7685,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5512
7685
  async Subscribe(subscriptions) {
5513
7686
  subscriptions.map(async (subId) => {
5514
7687
  __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subId);
5515
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`ObservabilityRESTAPISubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
7688
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`ObservabilityRESTAPISubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
5516
7689
  try {
5517
7690
  __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, AddKeepAlive_fn).call(this, subId);
5518
7691
  } catch (error) {
5519
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$1.red(`ObservabilityRESTAPISubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
7692
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$2.red(`ObservabilityRESTAPISubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
5520
7693
  __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subId);
5521
7694
  }
5522
7695
  });
@@ -5527,18 +7700,18 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5527
7700
  UnSubscribe(subscriptions) {
5528
7701
  subscriptions.map(async (subId) => {
5529
7702
  __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subId);
5530
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`ObservabilityRESTAPISubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
7703
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`ObservabilityRESTAPISubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
5531
7704
  });
5532
7705
  }
5533
7706
  }
5534
7707
  _socketSubscribeKeepAlive = new WeakMap();
5535
- _options2 = new WeakMap();
7708
+ _options3 = new WeakMap();
5536
7709
  _ObservabilityRESTAPISubscriber_instances = new WeakSet();
5537
7710
  LogDebugMessage_fn = function(message) {
5538
- __privateGet(this, _options2).logger.debug(message);
7711
+ __privateGet(this, _options3).logger.debug(message);
5539
7712
  };
5540
7713
  LogErrorMessage_fn = function(message) {
5541
- __privateGet(this, _options2).logger.error(message);
7714
+ __privateGet(this, _options3).logger.error(message);
5542
7715
  };
5543
7716
  InvokeRESTAPI_fn = async function(subscription) {
5544
7717
  const { subscriptionKey } = subscription;
@@ -5608,19 +7781,19 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5608
7781
  }
5609
7782
  }
5610
7783
  if (url.localeCompare("") !== 0) {
5611
- const endPointUrl = `${__privateGet(this, _options2).urlBase}${url}`;
7784
+ const endPointUrl = `${__privateGet(this, _options3).urlBase}${url}`;
5612
7785
  const headers = {
5613
7786
  "Content-Type": "application/json"
5614
7787
  };
5615
7788
  let retVal;
5616
7789
  const start = performance.now();
5617
7790
  try {
5618
- if (isNode && __privateGet(this, _options2).agent) {
7791
+ if (isNode && __privateGet(this, _options3).agent) {
5619
7792
  retVal = await axios({
5620
7793
  url: endPointUrl,
5621
7794
  method: "get",
5622
7795
  headers,
5623
- httpsAgent: __privateGet(this, _options2).agent
7796
+ httpsAgent: __privateGet(this, _options3).agent
5624
7797
  });
5625
7798
  } else {
5626
7799
  retVal = await axios({
@@ -5657,16 +7830,16 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5657
7830
  if (socketSubscribeKeepAlive.timeout) {
5658
7831
  const end = performance.now();
5659
7832
  const diff = end - start;
5660
- let timeoutDuration = __privateGet(this, _options2).keepAlive - diff;
7833
+ let timeoutDuration = __privateGet(this, _options3).keepAlive - diff;
5661
7834
  if (timeoutDuration < 500) {
5662
7835
  timeoutDuration = 500;
5663
7836
  }
5664
7837
  socketSubscribeKeepAlive.timeout = __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, timeoutDuration);
5665
7838
  } else {
5666
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`Subscription removed: [${socketSubscribeKeepAlive.id}]. Processing terminate.`));
7839
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`Subscription removed: [${socketSubscribeKeepAlive.id}]. Processing terminate.`));
5667
7840
  }
5668
7841
  } catch (error) {
5669
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$1.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
7842
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$2.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
5670
7843
  __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subscription);
5671
7844
  }
5672
7845
  }, timeout);
@@ -5676,13 +7849,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5676
7849
  const socketSubscribeKeepAlive = {
5677
7850
  id: subscription.subscriptionKey.id
5678
7851
  };
5679
- socketSubscribeKeepAlive.timeout = __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, __privateGet(this, _options2).keepAlive);
7852
+ socketSubscribeKeepAlive.timeout = __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, __privateGet(this, _options3).keepAlive);
5680
7853
  __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id] = socketSubscribeKeepAlive;
5681
7854
  __privateGet(this, _GetData).call(this, subscription);
5682
7855
  };
5683
7856
  RemoveKeepAlive_fn = function(subscription) {
5684
7857
  if (__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id]) {
5685
- __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$1.gray(`ObservabilityRESTAPISubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
7858
+ __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.gray(`ObservabilityRESTAPISubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
5686
7859
  clearTimeout(__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id].timeout);
5687
7860
  delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id].timeout;
5688
7861
  delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id];
@@ -5744,15 +7917,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5744
7917
  //@@
5745
7918
  __privateAdd(this, _timeoutValue, 5e3);
5746
7919
  //@@
5747
- __privateAdd(this, _options3);
5748
- __privateSet(this, _options3, options);
7920
+ __privateAdd(this, _options4);
7921
+ __privateSet(this, _options4, options);
5749
7922
  __privateSet(this, _socket, options.socket);
5750
7923
  }
5751
7924
  get socket() {
5752
7925
  return __privateGet(this, _socket);
5753
7926
  }
5754
7927
  set socket(socket) {
5755
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.cyan(`SocketIoMessageSender:set socket(): new socket assigned`));
7928
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.cyan(`SocketIoMessageSender:set socket(): new socket assigned`));
5756
7929
  __privateSet(this, _socket, socket);
5757
7930
  }
5758
7931
  AckListener(message, payload) {
@@ -5765,25 +7938,25 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5765
7938
  message.status = "SUCCESS";
5766
7939
  message.subscriptionKeyResponse = payload;
5767
7940
  delete __privateGet(this, _messageWithAckPayloadRecords)[message.id];
5768
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.grey(`SocketIoMessageSender:AckListener(): ack received, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
7941
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.grey(`SocketIoMessageSender:AckListener(): ack received, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
5769
7942
  message.resolve(message);
5770
7943
  }
5771
7944
  }
5772
7945
  ResponseTimout(message) {
5773
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached: [${__privateGet(this, _timeoutValue)}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
7946
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached: [${__privateGet(this, _timeoutValue)}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
5774
7947
  delete message.timeoutId;
5775
7948
  __privateGet(this, _socket).off(__privateMethod(this, _SocketIoMessageSender_instances, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
5776
7949
  message.endTime = performance.now();
5777
7950
  if (message.retryCount >= __privateGet(this, _maxReties)) {
5778
7951
  message.status = "FAIL";
5779
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.red(`SocketIoMessageSender:ResponseTimout(): timeout reached after ${__privateGet(this, _maxReties)} retries, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
7952
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.red(`SocketIoMessageSender:ResponseTimout(): timeout reached after ${__privateGet(this, _maxReties)} retries, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
5780
7953
  delete __privateGet(this, _messageWithAckPayloadRecords)[message.id];
5781
7954
  message.reject(message);
5782
7955
  return;
5783
7956
  }
5784
7957
  message.status = "INRETRY";
5785
7958
  message.retryCount++;
5786
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached, retrying. Retries: [${message.retryCount}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
7959
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached, retrying. Retries: [${message.retryCount}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
5787
7960
  this.SendMessage(message);
5788
7961
  }
5789
7962
  SendMessage(message) {
@@ -5796,7 +7969,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5796
7969
  };
5797
7970
  message.BoundAckListenerCallback = AckListenerCallback.bind(this);
5798
7971
  __privateGet(this, _socket).on(__privateMethod(this, _SocketIoMessageSender_instances, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
5799
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.gray(`SocketIoMessageSender:SendMessage(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
7972
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.gray(`SocketIoMessageSender:SendMessage(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
5800
7973
  __privateGet(this, _socket).emit(message.eventName, message.subscriptionKey);
5801
7974
  }
5802
7975
  SendMessageWithAck(eventName, subscriptionKey) {
@@ -5820,7 +7993,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5820
7993
  const killIds = [];
5821
7994
  for (const [, message] of Object.entries(__privateGet(this, _messageWithAckPayloadRecords))) {
5822
7995
  if (message.subscriptionKey.id.localeCompare(subscriptionKey.id) === 0) {
5823
- __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$1.blue(`SocketIoMessageSender:KillMessageInFlight(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
7996
+ __privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.blue(`SocketIoMessageSender:KillMessageInFlight(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
5824
7997
  clearTimeout(message.timeoutId);
5825
7998
  delete message.timeoutId;
5826
7999
  __privateGet(this, _socket).off(__privateMethod(this, _SocketIoMessageSender_instances, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
@@ -5838,10 +8011,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5838
8011
  _socket = new WeakMap();
5839
8012
  _maxReties = new WeakMap();
5840
8013
  _timeoutValue = new WeakMap();
5841
- _options3 = new WeakMap();
8014
+ _options4 = new WeakMap();
5842
8015
  _SocketIoMessageSender_instances = new WeakSet();
5843
8016
  LogDebugMessage_fn2 = function(message) {
5844
- __privateGet(this, _options3).logger.debug(message);
8017
+ __privateGet(this, _options4).logger.debug(message);
5845
8018
  };
5846
8019
  GetSubscribeKeepAliveAckEventName_fn = function(eventName, subscriptionKey) {
5847
8020
  return `${eventName}Ack_${subscriptionKey.id}`;
@@ -5851,22 +8024,22 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5851
8024
  __privateAdd(this, _ObservabilitySocketIOSubscriber_instances);
5852
8025
  __privateAdd(this, _socketSubscribeKeepAlive2, {});
5853
8026
  __privateAdd(this, _socket2);
5854
- __privateAdd(this, _options4);
8027
+ __privateAdd(this, _options5);
5855
8028
  __privateAdd(this, _socketIoMessageSender);
5856
8029
  // This is required becuase each call to .bind create a new replica bound function - so we need the same instance for on/off event bindings.
5857
8030
  __publicField(this, "KeepAliveAckBoundFunction");
5858
- __privateSet(this, _options4, options);
8031
+ __privateSet(this, _options5, options);
5859
8032
  __privateSet(this, _socket2, options.socket);
5860
8033
  __privateSet(this, _socketIoMessageSender, new SocketIoMessageSender({
5861
8034
  socket: __privateGet(this, _socket2),
5862
- logger: __privateGet(this, _options4).logger
8035
+ logger: __privateGet(this, _options5).logger
5863
8036
  }));
5864
8037
  }
5865
8038
  get socket() {
5866
8039
  return __privateGet(this, _socket2);
5867
8040
  }
5868
8041
  set socket(socket) {
5869
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.cyan(`ObservabilitySocketIOSubscriber:set socket(): new socket assigned`));
8042
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.cyan(`ObservabilitySocketIOSubscriber:set socket(): new socket assigned`));
5870
8043
  __privateSet(this, _socket2, socket);
5871
8044
  __privateGet(this, _socketIoMessageSender).socket = socket;
5872
8045
  }
@@ -5877,14 +8050,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5877
8050
  const socket = __privateGet(this, _socket2);
5878
8051
  subscriptions.map(async (subId) => {
5879
8052
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subId);
5880
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.yellow(`ObservabilitySocketIOSubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
8053
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.yellow(`ObservabilitySocketIOSubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
5881
8054
  try {
5882
8055
  const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("subscribe", subId.subscriptionKey);
5883
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.green(`ObservabilitySocketIOSubscriber:Subscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
8056
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.green(`ObservabilitySocketIOSubscriber:Subscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
5884
8057
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, AddKeepAlive_fn2).call(this, socket, subId);
5885
8058
  socket.on(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
5886
8059
  } catch (error) {
5887
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`ObservabilitySocketIOSubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
8060
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`ObservabilitySocketIOSubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
5888
8061
  socket.off(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
5889
8062
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subId);
5890
8063
  }
@@ -5899,12 +8072,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5899
8072
  socket.off(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
5900
8073
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subId);
5901
8074
  __privateGet(this, _socketIoMessageSender).KillMessageInFlight(subId.subscriptionKey);
5902
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.yellow(`ObservabilitySocketIOSubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
8075
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.yellow(`ObservabilitySocketIOSubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
5903
8076
  try {
5904
8077
  const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("unsubscribe", subId.subscriptionKey);
5905
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.green(`ObservabilitySocketIOSubscriber:UnSubscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
8078
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.green(`ObservabilitySocketIOSubscriber:UnSubscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
5906
8079
  } catch (error) {
5907
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`ObservabilitySocketIOSubscriber:UnSubscribe(): Error response: [${JSON.stringify(error)}]`));
8080
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`ObservabilitySocketIOSubscriber:UnSubscribe(): Error response: [${JSON.stringify(error)}]`));
5908
8081
  }
5909
8082
  });
5910
8083
  }
@@ -5924,36 +8097,36 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5924
8097
  }
5925
8098
  _socketSubscribeKeepAlive2 = new WeakMap();
5926
8099
  _socket2 = new WeakMap();
5927
- _options4 = new WeakMap();
8100
+ _options5 = new WeakMap();
5928
8101
  _socketIoMessageSender = new WeakMap();
5929
8102
  _ObservabilitySocketIOSubscriber_instances = new WeakSet();
5930
8103
  LogDebugMessage_fn3 = function(message) {
5931
- __privateGet(this, _options4).logger.debug(message);
8104
+ __privateGet(this, _options5).logger.debug(message);
5932
8105
  };
5933
8106
  LogErrorMessage_fn2 = function(message) {
5934
- __privateGet(this, _options4).logger.error(message);
8107
+ __privateGet(this, _options5).logger.error(message);
5935
8108
  };
5936
8109
  AddKeepAlive_fn2 = function(socket, subscription) {
5937
8110
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subscription);
5938
8111
  __privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id] = {
5939
8112
  id: subscription.subscriptionKey.id,
5940
8113
  timeout: setTimeout(async () => {
5941
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.yellow(`ObservabilitySocketIOSubscriber:#AddKeepAlive:timeoutCheck(): Sending keepAlive: subscriptionKey: [${subscription.subscriptionKey.id}]`));
8114
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.yellow(`ObservabilitySocketIOSubscriber:#AddKeepAlive:timeoutCheck(): Sending keepAlive: subscriptionKey: [${subscription.subscriptionKey.id}]`));
5942
8115
  try {
5943
8116
  const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("subscribeKeepAlive", subscription.subscriptionKey);
5944
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.green(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
8117
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.green(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
5945
8118
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, AddKeepAlive_fn2).call(this, socket, subscription);
5946
8119
  } catch (error) {
5947
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
8120
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
5948
8121
  socket.off(GetSocketIOSubscriptionKey(subscription.subscriptionKey), subscription.cb);
5949
8122
  __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subscription);
5950
8123
  }
5951
- }, __privateGet(this, _options4).keepAlive)
8124
+ }, __privateGet(this, _options5).keepAlive)
5952
8125
  };
5953
8126
  };
5954
8127
  RemoveKeepAlive_fn2 = function(subscription) {
5955
8128
  if (__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id]) {
5956
- __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$1.gray(`ObservabilitySocketIOSubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
8129
+ __privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.gray(`ObservabilitySocketIOSubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
5957
8130
  clearTimeout(__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id].timeout);
5958
8131
  delete __privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id];
5959
8132
  }
@@ -5967,10 +8140,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
5967
8140
  __privateAdd(this, _serviceModel, {});
5968
8141
  __privateAdd(this, _agentModel, {});
5969
8142
  __privateAdd(this, _lambdaModel, {});
5970
- __privateAdd(this, _options5);
5971
- __privateSet(this, _options5, options);
8143
+ __privateAdd(this, _options6);
8144
+ __privateSet(this, _options6, options);
5972
8145
  __privateSet(this, _kafkaHelper, new KafkaHelper({
5973
- maxLogLength: __privateGet(this, _options5).maxLogLength
8146
+ maxLogLength: __privateGet(this, _options6).maxLogLength
5974
8147
  }));
5975
8148
  }
5976
8149
  get observabilitySocketIOSubscriber() {
@@ -6000,7 +8173,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6000
8173
  subscriptions.map((subscription) => {
6001
8174
  const retVal = this.subscriptions.find((v) => v.subscriptionKey.id.localeCompare(subscription.subscriptionKey.id) === 0);
6002
8175
  if (retVal) {
6003
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.magenta(`AddSubscription(): Subscription: [${retVal.subscriptionKey.id}] already exists - ignoring.`));
8176
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.magenta(`AddSubscription(): Subscription: [${retVal.subscriptionKey.id}] already exists - ignoring.`));
6004
8177
  } else {
6005
8178
  subscriptionsToAdd.push(subscription);
6006
8179
  }
@@ -6009,7 +8182,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6009
8182
  subscriptionsToAdd.map((s) => this.subscriptions.push(s));
6010
8183
  (_a2 = __privateGet(this, _observabilitySocketIOSubscriber)) == null ? void 0 : _a2.Subscribe(subscriptionsToAdd);
6011
8184
  } else {
6012
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.magenta(`AddSubscription(): No valid subscriptions to subscribe.`));
8185
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.magenta(`AddSubscription(): No valid subscriptions to subscribe.`));
6013
8186
  }
6014
8187
  }
6015
8188
  RemoveSubscriptionsByKey(keyToFind) {
@@ -6102,9 +8275,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6102
8275
  try {
6103
8276
  __privateSet(this, _serviceModel, {});
6104
8277
  if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllServicesCombined.toString()) === 0) {
6105
- __privateGet(this, _serviceModel)["STS-Service"] = ObservabilityModelUtils.GetModelForService("STS-Service", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options5).logger);
8278
+ __privateGet(this, _serviceModel)["STS-Service"] = ObservabilityModelUtils.GetModelForService("STS-Service", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options6).logger);
6106
8279
  if (__privateGet(this, _serviceModel)["STS-Service"] === null) {
6107
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelAllServicesCombined():Error: GetModelForService() returned null`));
8280
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAllServicesCombined():Error: GetModelForService() returned null`));
6108
8281
  }
6109
8282
  }
6110
8283
  } catch (error) {
@@ -6117,9 +8290,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6117
8290
  try {
6118
8291
  __privateSet(this, _serviceModel, {});
6119
8292
  for (const [serviceId, serviceTelemetry] of Object.entries(subscriptionPayload.data)) {
6120
- __privateGet(this, _serviceModel)[serviceId] = ObservabilityModelUtils.GetModelForService(serviceId, serviceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8293
+ __privateGet(this, _serviceModel)[serviceId] = ObservabilityModelUtils.GetModelForService(serviceId, serviceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6121
8294
  if (__privateGet(this, _serviceModel)[serviceId] === null) {
6122
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelServices():Error: GetModelForService() returned null`));
8295
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelServices():Error: GetModelForService() returned null`));
6123
8296
  }
6124
8297
  }
6125
8298
  } catch (error) {
@@ -6134,7 +8307,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6134
8307
  for (const [serviceInstanceId, serviceInstanceTelemetry] of Object.entries(service)) {
6135
8308
  const kafkaTopic = `${KAFKA_PREFIX}_${serviceInstanceId}`.replace(/@/g, "_").replace(/\|/g, "_");
6136
8309
  if (serviceInstanceTelemetry.cpu && serviceInstanceTelemetry.cpu > 0) {
6137
- __privateGet(this, _serviceModel)[serviceInstanceId] = ObservabilityModelUtils.GetModelForService(serviceInstanceId, serviceInstanceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8310
+ __privateGet(this, _serviceModel)[serviceInstanceId] = ObservabilityModelUtils.GetModelForService(serviceInstanceId, serviceInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6138
8311
  if (__privateGet(this, _serviceModel)[serviceInstanceId] !== null) {
6139
8312
  __privateGet(this, _serviceModel)[serviceInstanceId].options = { serviceId };
6140
8313
  if (subscribeToKafka) {
@@ -6153,7 +8326,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6153
8326
  }
6154
8327
  }
6155
8328
  } else {
6156
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelServiceInstances():Error: GetModelForService() returned null`));
8329
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelServiceInstances():Error: GetModelForService() returned null`));
6157
8330
  }
6158
8331
  } else {
6159
8332
  if (subscribeToKafka) {
@@ -6177,7 +8350,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6177
8350
  for (const [serviceInstanceProcessId, serviceInstanceProcessTelemetry] of Object.entries(serviceInstance)) {
6178
8351
  const kafkaTopic = `${KAFKA_PREFIX}_${serviceInstanceId}_${serviceInstanceProcessId}`.replace(/@/g, "_").replace(/\|/g, "_");
6179
8352
  if (serviceInstanceProcessTelemetry.cpu && serviceInstanceProcessTelemetry.cpu > 0) {
6180
- __privateGet(this, _serviceModel)[serviceInstanceProcessId] = ObservabilityModelUtils.GetModelForService(serviceInstanceProcessId, serviceInstanceProcessTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8353
+ __privateGet(this, _serviceModel)[serviceInstanceProcessId] = ObservabilityModelUtils.GetModelForService(serviceInstanceProcessId, serviceInstanceProcessTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6181
8354
  if (__privateGet(this, _serviceModel)[serviceInstanceProcessId] !== null) {
6182
8355
  __privateGet(this, _serviceModel)[serviceInstanceProcessId].options = { serviceId, serviceInstanceId };
6183
8356
  if (subscribeToKafka) {
@@ -6196,7 +8369,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6196
8369
  }
6197
8370
  }
6198
8371
  } else {
6199
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelServiceInstance():Error: GetModelForService() returned null`));
8372
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelServiceInstance():Error: GetModelForService() returned null`));
6200
8373
  }
6201
8374
  } else {
6202
8375
  if (subscribeToKafka) {
@@ -6219,9 +8392,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6219
8392
  __privateSet(this, _agentModel, {});
6220
8393
  if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllAgentsCombined.toString()) === 0) {
6221
8394
  if (Object.keys(subscriptionPayload.data).length !== 0) {
6222
- __privateGet(this, _agentModel)["STS-Agent"] = ObservabilityModelUtils.GetModelForAgent("STS-Agent", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options5).logger);
8395
+ __privateGet(this, _agentModel)["STS-Agent"] = ObservabilityModelUtils.GetModelForAgent("STS-Agent", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options6).logger);
6223
8396
  if (__privateGet(this, _agentModel)["STS-Agent"] === null) {
6224
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelAllAgentsCombined():Error: GetModelForAgent() returned null`));
8397
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAllAgentsCombined():Error: GetModelForAgent() returned null`));
6225
8398
  }
6226
8399
  }
6227
8400
  }
@@ -6237,7 +8410,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6237
8410
  for (const [agentId, agentInstanceTelemetry] of Object.entries(subscriptionPayload.data)) {
6238
8411
  const kafkaTopic = `${KAFKA_PREFIX}_${agentId}`.replace(/@/g, "_").replace(/\|/g, "_");
6239
8412
  if (agentInstanceTelemetry.timer) {
6240
- __privateGet(this, _agentModel)[agentId] = ObservabilityModelUtils.GetModelForAgent(agentId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8413
+ __privateGet(this, _agentModel)[agentId] = ObservabilityModelUtils.GetModelForAgent(agentId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6241
8414
  if (__privateGet(this, _agentModel)[agentId] !== null) {
6242
8415
  if (subscribeToKafka) {
6243
8416
  __privateGet(this, _kafkaHelper).GetKafkaLogData(kafkaTopic, __privateGet(this, _agentModel)[agentId]);
@@ -6255,7 +8428,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6255
8428
  }
6256
8429
  }
6257
8430
  } else {
6258
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelAgents():Error: GetModelForAgent() returned null`));
8431
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAgents():Error: GetModelForAgent() returned null`));
6259
8432
  }
6260
8433
  } else {
6261
8434
  if (subscribeToKafka) {
@@ -6266,7 +8439,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6266
8439
  }
6267
8440
  }
6268
8441
  } catch (error) {
6269
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$1.red(`UIControllerAgent:CreateModel(): Error: [${error}]`));
8442
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$2.red(`UIControllerAgent:CreateModel(): Error: [${error}]`));
6270
8443
  }
6271
8444
  }
6272
8445
  // /agentId/agentWorkerId
@@ -6278,7 +8451,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6278
8451
  const kafkaTopic = `${KAFKA_PREFIX}_${agentId}_${agentWorkerId}`.replace(/@/g, "_").replace(/\|/g, "_");
6279
8452
  if (agentInstanceTelemetry.timer) {
6280
8453
  const threadKey = `${agentWorkerId}`;
6281
- __privateGet(this, _agentModel)[threadKey] = ObservabilityModelUtils.GetModelForAgent(threadKey, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8454
+ __privateGet(this, _agentModel)[threadKey] = ObservabilityModelUtils.GetModelForAgent(threadKey, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6282
8455
  if (__privateGet(this, _agentModel)[threadKey] !== null) {
6283
8456
  const coreCount = __privateGet(this, _agentModel)[threadKey].instruments[Gauge.CORE_COUNT_GAUGE].val;
6284
8457
  __privateGet(this, _agentModel)[threadKey].canNavigate = coreCount > 0;
@@ -6299,7 +8472,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6299
8472
  }
6300
8473
  }
6301
8474
  } else {
6302
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelAgentWorkers():Error: GetModelForAgent() returned null`));
8475
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAgentWorkers():Error: GetModelForAgent() returned null`));
6303
8476
  }
6304
8477
  } else {
6305
8478
  if (subscribeToKafka) {
@@ -6311,7 +8484,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6311
8484
  }
6312
8485
  }
6313
8486
  } catch (error) {
6314
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$1.red(`UIControllerAgentThreads:CreateModel(): Error: [${error}]`));
8487
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$2.red(`UIControllerAgentThreads:CreateModel(): Error: [${error}]`));
6315
8488
  }
6316
8489
  }
6317
8490
  // /agentId/agentWorkerId/asyncRunnerId
@@ -6323,7 +8496,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6323
8496
  for (const [asyncRunnerId, agentInstanceTelemetry] of Object.entries(asyncRunnerData)) {
6324
8497
  const kafkaTopic = `${KAFKA_PREFIX}_${agentId}_${agentWorkerId}_${asyncRunnerId}`.replace(/@/g, "_").replace(/\|/g, "_");
6325
8498
  if (agentInstanceTelemetry.timer) {
6326
- __privateGet(this, _agentModel)[asyncRunnerId] = ObservabilityModelUtils.GetModelForAgent(asyncRunnerId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8499
+ __privateGet(this, _agentModel)[asyncRunnerId] = ObservabilityModelUtils.GetModelForAgent(asyncRunnerId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6327
8500
  if (__privateGet(this, _agentModel)[asyncRunnerId] !== null) {
6328
8501
  if (subscribeToKafka) {
6329
8502
  __privateGet(this, _kafkaHelper).GetKafkaLogData(kafkaTopic, __privateGet(this, _agentModel)[asyncRunnerId]);
@@ -6341,7 +8514,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6341
8514
  }
6342
8515
  }
6343
8516
  } else {
6344
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelAgentWorker():Error: GetModelForAgent() returned null`));
8517
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAgentWorker():Error: GetModelForAgent() returned null`));
6345
8518
  }
6346
8519
  } else {
6347
8520
  if (subscribeToKafka) {
@@ -6354,7 +8527,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6354
8527
  }
6355
8528
  }
6356
8529
  } catch (error) {
6357
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$1.red(`UIControllerAgentThread:CreateModel(): Error: [${error}]`));
8530
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$2.red(`UIControllerAgentThread:CreateModel(): Error: [${error}]`));
6358
8531
  }
6359
8532
  }
6360
8533
  // --- [ Lambdas ] ------------------------------------------------------------------------------------------------------------------------------------------------
@@ -6363,9 +8536,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6363
8536
  try {
6364
8537
  __privateSet(this, _lambdaModel, {});
6365
8538
  if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllLambdasCombined.toString()) === 0) {
6366
- __privateGet(this, _lambdaModel)["STS-Lambda"] = ObservabilityModelUtils.GetModelForLambda("STS-Lambda", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options5).logger);
8539
+ __privateGet(this, _lambdaModel)["STS-Lambda"] = ObservabilityModelUtils.GetModelForLambda("STS-Lambda", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options6).logger);
6367
8540
  if (__privateGet(this, _lambdaModel)["STS-Lambda"] === null) {
6368
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelAllLambdasCombined():Error: GetModelForLambda() returned null`));
8541
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAllLambdasCombined():Error: GetModelForLambda() returned null`));
6369
8542
  }
6370
8543
  }
6371
8544
  } catch (error) {
@@ -6378,9 +8551,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6378
8551
  try {
6379
8552
  __privateSet(this, _lambdaModel, {});
6380
8553
  for (const [technologyId, technologyTelemetry] of Object.entries(subscriptionPayload.data)) {
6381
- __privateGet(this, _lambdaModel)[technologyId] = ObservabilityModelUtils.GetModelForLambda(technologyId, technologyTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8554
+ __privateGet(this, _lambdaModel)[technologyId] = ObservabilityModelUtils.GetModelForLambda(technologyId, technologyTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6382
8555
  if (__privateGet(this, _lambdaModel)[technologyId] === null) {
6383
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelLambdaTechnologies():Error: GetModelForLambda() returned null`));
8556
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelLambdaTechnologies():Error: GetModelForLambda() returned null`));
6384
8557
  }
6385
8558
  }
6386
8559
  } catch (error) {
@@ -6395,7 +8568,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6395
8568
  for (const [subTechnologyId, subTechnologyTelemetry] of Object.entries(technologyTelemetry)) {
6396
8569
  const kafkaTopic = `${KAFKA_PREFIX}_${subTechnologyId}`.replace(/@/g, "_").replace(/\|/g, "_");
6397
8570
  if (subTechnologyTelemetry.cpu && subTechnologyTelemetry.cpu > 0) {
6398
- __privateGet(this, _lambdaModel)[subTechnologyId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyId, subTechnologyTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8571
+ __privateGet(this, _lambdaModel)[subTechnologyId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyId, subTechnologyTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6399
8572
  if (__privateGet(this, _lambdaModel)[subTechnologyId] !== null) {
6400
8573
  __privateGet(this, _lambdaModel)[subTechnologyId].options = { technologyId };
6401
8574
  if (subscribeToKafka) {
@@ -6414,7 +8587,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6414
8587
  }
6415
8588
  }
6416
8589
  } else {
6417
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelLambdaSubTechnologies():Error: GetModelForLambda() returned null`));
8590
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelLambdaSubTechnologies():Error: GetModelForLambda() returned null`));
6418
8591
  }
6419
8592
  } else {
6420
8593
  if (subscribeToKafka) {
@@ -6438,7 +8611,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6438
8611
  for (const [subTechnologyInstanceId, subTechnologyInstanceTelemetry] of Object.entries(subTechnologyTelemetry)) {
6439
8612
  const kafkaTopic = `${KAFKA_PREFIX}_${subTechnologyId}_${subTechnologyInstanceId}`.replace(/@/g, "_").replace(/\|/g, "_");
6440
8613
  if (subTechnologyInstanceTelemetry.cpu && subTechnologyInstanceTelemetry.cpu > 0) {
6441
- __privateGet(this, _lambdaModel)[subTechnologyInstanceId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyInstanceId, subTechnologyInstanceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
8614
+ __privateGet(this, _lambdaModel)[subTechnologyInstanceId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyInstanceId, subTechnologyInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
6442
8615
  if (__privateGet(this, _lambdaModel)[subTechnologyInstanceId] !== null) {
6443
8616
  __privateGet(this, _lambdaModel)[subTechnologyInstanceId].options = { technologyId, subTechnologyId };
6444
8617
  if (subscribeToKafka) {
@@ -6457,7 +8630,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6457
8630
  }
6458
8631
  }
6459
8632
  } else {
6460
- __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$1.red(`CreateModelLambdaSubTechnologiesInstance():Error: GetModelForLambda() returned null`));
8633
+ __privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelLambdaSubTechnologiesInstance():Error: GetModelForLambda() returned null`));
6461
8634
  }
6462
8635
  } else {
6463
8636
  if (subscribeToKafka) {
@@ -6480,23 +8653,23 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6480
8653
  _serviceModel = new WeakMap();
6481
8654
  _agentModel = new WeakMap();
6482
8655
  _lambdaModel = new WeakMap();
6483
- _options5 = new WeakMap();
8656
+ _options6 = new WeakMap();
6484
8657
  _ObservabilitySubscriptionManager_instances = new WeakSet();
6485
8658
  LogDebugMessage_fn4 = function(message) {
6486
- __privateGet(this, _options5).logger.debug(message);
8659
+ __privateGet(this, _options6).logger.debug(message);
6487
8660
  };
6488
8661
  LogErrorMessage_fn3 = function(message) {
6489
- __privateGet(this, _options5).logger.error(message);
8662
+ __privateGet(this, _options6).logger.error(message);
6490
8663
  };
6491
8664
  class SocketIoClientHelper {
6492
8665
  constructor(options) {
6493
8666
  __privateAdd(this, _SocketIoClientHelper_instances);
6494
- __privateAdd(this, _options6);
8667
+ __privateAdd(this, _options7);
6495
8668
  __privateAdd(this, _sockets, {});
6496
8669
  __privateAdd(this, _httpsAgent2, null);
6497
- __privateSet(this, _options6, options);
8670
+ __privateSet(this, _options7, options);
6498
8671
  if (isNode) {
6499
- const agentOptions = __privateGet(this, _options6).agentOptions;
8672
+ const agentOptions = __privateGet(this, _options7).agentOptions;
6500
8673
  __privateSet(this, _httpsAgent2, new https.Agent({
6501
8674
  keepAlive: agentOptions == null ? void 0 : agentOptions.keepAlive,
6502
8675
  maxSockets: agentOptions == null ? void 0 : agentOptions.maxSockets,
@@ -6511,46 +8684,46 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6511
8684
  get sockets() {
6512
8685
  return __privateGet(this, _sockets);
6513
8686
  }
6514
- SetupClientSideSocket(name, address, onConnectCallBack, socketEventsCallBack, errorCallBack) {
6515
- this.sockets[name] = {
6516
- name,
8687
+ SetupClientSideSocket(name2, address, onConnectCallBack, socketEventsCallBack, errorCallBack) {
8688
+ this.sockets[name2] = {
8689
+ name: name2,
6517
8690
  address,
6518
8691
  socket: null,
6519
8692
  errorCallBack
6520
8693
  };
6521
- __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack);
6522
- return this.sockets[name].socket;
8694
+ __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack);
8695
+ return this.sockets[name2].socket;
6523
8696
  }
6524
- GetSocket(name) {
6525
- return this.sockets[name].socket;
8697
+ GetSocket(name2) {
8698
+ return this.sockets[name2].socket;
6526
8699
  }
6527
- GetSocketDetail(name) {
6528
- return this.sockets[name];
8700
+ GetSocketDetail(name2) {
8701
+ return this.sockets[name2];
6529
8702
  }
6530
8703
  }
6531
- _options6 = new WeakMap();
8704
+ _options7 = new WeakMap();
6532
8705
  _sockets = new WeakMap();
6533
8706
  _httpsAgent2 = new WeakMap();
6534
8707
  _SocketIoClientHelper_instances = new WeakSet();
6535
8708
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6536
8709
  LogDebugMessage_fn5 = function(message) {
6537
- if (__privateGet(this, _options6).logger) __privateGet(this, _options6).logger.debug(message);
8710
+ if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.debug(message);
6538
8711
  };
6539
8712
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6540
8713
  LogErrorMessage_fn4 = function(message) {
6541
- if (__privateGet(this, _options6).logger) __privateGet(this, _options6).logger.error(message);
8714
+ if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.error(message);
6542
8715
  };
6543
- EstablishSocketConnect_fn = function(name, onConnectCallBack, socketEventsCallBack) {
6544
- const socketDetail = this.sockets[name];
8716
+ EstablishSocketConnect_fn = function(name2, onConnectCallBack, socketEventsCallBack) {
8717
+ const socketDetail = this.sockets[name2];
6545
8718
  if (socketDetail.socket !== null) {
6546
8719
  if (socketDetail.socket.connected === true) {
6547
8720
  socketDetail.socket.disconnect();
6548
8721
  }
6549
8722
  socketDetail.socket = null;
6550
8723
  if (isNode) {
6551
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack), 100).unref();
8724
+ setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
6552
8725
  } else {
6553
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack), 100);
8726
+ setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
6554
8727
  }
6555
8728
  return;
6556
8729
  }
@@ -6592,12 +8765,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6592
8765
  {
6593
8766
  __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
6594
8767
  __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
6595
- const socketDetail2 = this.sockets[name];
8768
+ const socketDetail2 = this.sockets[name2];
6596
8769
  socketDetail2.socket = null;
6597
8770
  if (isNode) {
6598
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack), 100).unref();
8771
+ setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
6599
8772
  } else {
6600
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack), 100);
8773
+ setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
6601
8774
  }
6602
8775
  }
6603
8776
  break;
@@ -6611,15 +8784,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6611
8784
  {
6612
8785
  __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, `Server unexpectedly disconnected. Reason: [${reason}]`);
6613
8786
  __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
6614
- const socketDetail2 = this.sockets[name];
8787
+ const socketDetail2 = this.sockets[name2];
6615
8788
  if (socketDetail2.socket) {
6616
8789
  socketDetail2.socket.disconnect();
6617
8790
  }
6618
8791
  socketDetail2.socket = null;
6619
8792
  if (isNode) {
6620
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack), 100).unref();
8793
+ setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
6621
8794
  } else {
6622
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name, onConnectCallBack, socketEventsCallBack), 100);
8795
+ setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
6623
8796
  }
6624
8797
  }
6625
8798
  break;