@nsshunt/stsuxvue 1.0.52 → 1.0.54

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.
package/dist/stsuxvue.mjs CHANGED
@@ -4,6 +4,11 @@ import { defineComponent, defineAsyncComponent, ref, createElementBlock, openBlo
4
4
  import { Gauge, ObservabilitySocketIOSubscriber, ObservabilityRESTAPISubscriber, ObservabilitySubscriptionManager, SubscriptionTopic } from "@nsshunt/stsobservability";
5
5
  import { defaultLogger } from "@nsshunt/stsutils";
6
6
  import { io } from "socket.io-client";
7
+ import "socket.io";
8
+ import "ioredis";
9
+ import require$$0$2 from "node:cluster";
10
+ import require$$1$2 from "socket.io-adapter";
11
+ import "@socket.io/redis-streams-adapter";
7
12
  var _estate = /* @__PURE__ */ ((_estate2) => {
8
13
  _estate2["IDLE"] = "idle";
9
14
  _estate2["STARTING"] = "starting";
@@ -6009,9 +6014,9 @@ function createDOMPurify() {
6009
6014
  return DOMPurify;
6010
6015
  }
6011
6016
  let {
6012
- document
6017
+ document: document2
6013
6018
  } = window2;
6014
- const originalDocument = document;
6019
+ const originalDocument = document2;
6015
6020
  const currentScript = originalDocument.currentScript;
6016
6021
  const {
6017
6022
  DocumentFragment,
@@ -6031,9 +6036,9 @@ function createDOMPurify() {
6031
6036
  const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
6032
6037
  const getParentNode = lookupGetter(ElementPrototype, "parentNode");
6033
6038
  if (typeof HTMLTemplateElement === "function") {
6034
- const template = document.createElement("template");
6039
+ const template = document2.createElement("template");
6035
6040
  if (template.content && template.content.ownerDocument) {
6036
- document = template.content.ownerDocument;
6041
+ document2 = template.content.ownerDocument;
6037
6042
  }
6038
6043
  }
6039
6044
  let trustedTypesPolicy;
@@ -6043,7 +6048,7 @@ function createDOMPurify() {
6043
6048
  createNodeIterator,
6044
6049
  createDocumentFragment,
6045
6050
  getElementsByTagName
6046
- } = document;
6051
+ } = document2;
6047
6052
  const {
6048
6053
  importNode
6049
6054
  } = originalDocument;
@@ -6141,7 +6146,7 @@ function createDOMPurify() {
6141
6146
  const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
6142
6147
  let transformCaseFunc = null;
6143
6148
  let CONFIG = null;
6144
- const formElement = document.createElement("form");
6149
+ const formElement = document2.createElement("form");
6145
6150
  const isRegexOrFunction = function isRegexOrFunction2(testValue) {
6146
6151
  return testValue instanceof RegExp || testValue instanceof Function;
6147
6152
  };
@@ -6403,7 +6408,7 @@ function createDOMPurify() {
6403
6408
  }
6404
6409
  const body = doc.body || doc.documentElement;
6405
6410
  if (dirty && leadingWhitespace) {
6406
- body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
6411
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
6407
6412
  }
6408
6413
  if (NAMESPACE === HTML_NAMESPACE) {
6409
6414
  return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
@@ -6502,7 +6507,7 @@ function createDOMPurify() {
6502
6507
  return false;
6503
6508
  };
6504
6509
  const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
6505
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
6510
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
6506
6511
  return false;
6507
6512
  }
6508
6513
  if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
@@ -6891,8 +6896,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
6891
6896
  return retVal;
6892
6897
  }, "") + "]";
6893
6898
  };
6894
- const convertMS = function(ms) {
6895
- let s = Math.floor(ms / 1e3);
6899
+ const convertMS = function(ms2) {
6900
+ let s = Math.floor(ms2 / 1e3);
6896
6901
  let m = Math.floor(s / 60);
6897
6902
  s = s % 60;
6898
6903
  let h = Math.floor(m / 60);
@@ -8338,16 +8343,16 @@ function requireAnsiStyles() {
8338
8343
  })(ansiStyles);
8339
8344
  return ansiStyles.exports;
8340
8345
  }
8341
- var browser;
8342
- var hasRequiredBrowser;
8343
- function requireBrowser() {
8344
- if (hasRequiredBrowser) return browser;
8345
- hasRequiredBrowser = 1;
8346
- browser = {
8346
+ var browser$1;
8347
+ var hasRequiredBrowser$1;
8348
+ function requireBrowser$1() {
8349
+ if (hasRequiredBrowser$1) return browser$1;
8350
+ hasRequiredBrowser$1 = 1;
8351
+ browser$1 = {
8347
8352
  stdout: false,
8348
8353
  stderr: false
8349
8354
  };
8350
- return browser;
8355
+ return browser$1;
8351
8356
  }
8352
8357
  var util;
8353
8358
  var hasRequiredUtil;
@@ -8508,7 +8513,7 @@ function requireSource() {
8508
8513
  if (hasRequiredSource) return source;
8509
8514
  hasRequiredSource = 1;
8510
8515
  const ansiStyles2 = requireAnsiStyles();
8511
- const { stdout: stdoutColor, stderr: stderrColor } = requireBrowser();
8516
+ const { stdout: stdoutColor, stderr: stderrColor } = requireBrowser$1();
8512
8517
  const {
8513
8518
  stringReplaceAll,
8514
8519
  stringEncaseCRLFWithFirstIndex
@@ -8819,8 +8824,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
8819
8824
  return "";
8820
8825
  }
8821
8826
  };
8822
- const convertMS = function(ms) {
8823
- let s = Math.floor(ms / 1e3);
8827
+ const convertMS = function(ms2) {
8828
+ let s = Math.floor(ms2 / 1e3);
8824
8829
  let m = Math.floor(s / 60);
8825
8830
  s = s % 60;
8826
8831
  let h = Math.floor(m / 60);
@@ -9992,50 +9997,99 @@ function v4(options, buf, offset) {
9992
9997
  return _v4(options);
9993
9998
  }
9994
9999
  const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
9995
- class SocketIoClientHelper {
9996
- #options;
9997
- #sockets = {};
9998
- constructor(options) {
9999
- this.#options = options;
10000
+ class SocketIoClient {
10001
+ #agentManager;
10002
+ #logger;
10003
+ #name;
10004
+ #address;
10005
+ #socketIoCustomPath;
10006
+ #authToken;
10007
+ #socket;
10008
+ constructor(name) {
10009
+ this.#name = name;
10000
10010
  }
10001
10011
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10002
- #LogDebugMessage(message) {
10003
- if (this.#options.logger) this.#options.logger.debug(message);
10012
+ LogDebugMessage(message) {
10013
+ if (this.#logger) this.#logger.debug(message);
10004
10014
  }
10005
10015
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10006
- #LogErrorMessage(message) {
10007
- if (this.#options.logger) this.#options.logger.error(message);
10016
+ LogErrorMessage(message) {
10017
+ if (this.#logger) this.#logger.error(message);
10008
10018
  }
10009
- get sockets() {
10010
- return this.#sockets;
10019
+ get name() {
10020
+ return this.#name;
10011
10021
  }
10012
- SetupClientSideSocket(name, address, socketIoCustomPath, onConnectCallBack, socketEventsCallBack, errorCallBack) {
10013
- this.sockets[name] = {
10014
- name,
10015
- address,
10016
- socket: null,
10017
- errorCallBack
10018
- };
10019
- this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack);
10020
- return this.sockets[name].socket;
10022
+ get agentManager() {
10023
+ return this.#agentManager;
10024
+ }
10025
+ get logger() {
10026
+ return this.#logger;
10027
+ }
10028
+ get address() {
10029
+ return this.#address;
10030
+ }
10031
+ get authToken() {
10032
+ return this.#authToken;
10033
+ }
10034
+ get socketIoCustomPath() {
10035
+ return this.#socketIoCustomPath;
10036
+ }
10037
+ get socket() {
10038
+ return this.#socket;
10039
+ }
10040
+ WithAddress(address) {
10041
+ this.#address = address;
10042
+ return this;
10043
+ }
10044
+ WithAuthToken(authToken) {
10045
+ this.#authToken = authToken;
10046
+ return this;
10047
+ }
10048
+ WithSocketIoCustomPath(socketIoCustomPath) {
10049
+ this.#socketIoCustomPath = socketIoCustomPath;
10050
+ return this;
10051
+ }
10052
+ WithLogger(logger) {
10053
+ this.#logger = logger;
10054
+ return this;
10055
+ }
10056
+ WithAgentManager(agentManager) {
10057
+ this.#agentManager = agentManager;
10058
+ return this;
10059
+ }
10060
+ SetupSocket() {
10061
+ if (!this.#address) {
10062
+ throw new Error(`SocketIoClientHelper:SetupSocket(): Error: [address not provided]`);
10063
+ }
10064
+ this.#EstablishSocketConnect();
10065
+ return this;
10066
+ }
10067
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10068
+ ConnectCallBack(socket) {
10021
10069
  }
10022
- GetSocket(name) {
10023
- return this.sockets[name].socket;
10070
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10071
+ SocketEventsCallBack(socket) {
10024
10072
  }
10025
- GetSocketDetail(name) {
10026
- return this.sockets[name];
10073
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10074
+ ErrorCallBack(error) {
10027
10075
  }
10028
- #EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack) {
10029
- const socketDetail = this.sockets[name];
10030
- if (socketDetail.socket !== null) {
10031
- if (socketDetail.socket.connected === true) {
10032
- socketDetail.socket.disconnect();
10076
+ emit(ev, ...args) {
10077
+ if (this.#socket) {
10078
+ return this.#socket.emit(ev, ...args);
10079
+ } else {
10080
+ throw new Error("SocketIoClient:emit(): Error: [socket instance not defined.]");
10081
+ }
10082
+ }
10083
+ #EstablishSocketConnect() {
10084
+ if (this.#socket !== void 0) {
10085
+ if (this.#socket.connected === true) {
10086
+ this.#socket.disconnect();
10033
10087
  }
10034
- socketDetail.socket = null;
10088
+ this.#socket = void 0;
10035
10089
  if (isNode) {
10036
- setTimeout(() => this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack), 100).unref();
10090
+ setTimeout(() => this.#EstablishSocketConnect(), 100).unref();
10037
10091
  } else {
10038
- setTimeout(() => this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack), 100);
10092
+ setTimeout(() => this.#EstablishSocketConnect(), 100);
10039
10093
  }
10040
10094
  return;
10041
10095
  }
@@ -10044,98 +10098,656 @@ class SocketIoClientHelper {
10044
10098
  socketOptions = {
10045
10099
  transports: ["websocket"]
10046
10100
  };
10047
- if (this.#options.agentManager) {
10048
- socketOptions.agent = this.#options.agentManager.GetAgent(socketDetail.address);
10101
+ if (this.#agentManager) {
10102
+ if (!this.#address) {
10103
+ throw new Error(`SocketIoClientHelper:SetupSocket(): Error: [address not provided when using agentManager]`);
10104
+ }
10105
+ socketOptions.agent = this.#agentManager.GetAgent(this.#address);
10049
10106
  }
10050
10107
  } else {
10051
10108
  socketOptions = {
10052
10109
  transports: ["websocket"]
10053
10110
  };
10054
10111
  }
10055
- if (socketIoCustomPath && socketIoCustomPath.localeCompare("") !== 0) {
10056
- socketOptions.path = socketIoCustomPath;
10112
+ if (this.#authToken) {
10113
+ socketOptions.auth = (cb) => {
10114
+ cb({
10115
+ token: this.#authToken
10116
+ });
10117
+ };
10057
10118
  }
10058
- socketDetail.socket = io(socketDetail.address, socketOptions);
10059
- socketDetail.socket.io.on("error", (err) => {
10060
- this.#LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.io.on('error'): [${err}] Address: [${socketDetail.address}]`);
10061
- });
10062
- socketDetail.socket.io.on("reconnect_error", (err) => {
10063
- this.#LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.io.on('reconnect_error'): [${err}] Address: [${socketDetail.address}]`);
10119
+ if (this.#socketIoCustomPath && this.#socketIoCustomPath.localeCompare("") !== 0) {
10120
+ socketOptions.path = this.#socketIoCustomPath;
10121
+ }
10122
+ this.#socket = io(this.#address, socketOptions);
10123
+ this.#socket.io.on("error", (err) => {
10124
+ this.LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.io.on('error'): [${err}] Address: [${this.#address}]`);
10064
10125
  });
10065
- socketDetail.socket.io.on("reconnect", (attempt) => {
10066
- this.#LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.io.on('reconnect'): Number: [${attempt}] Address: [${socketDetail.address}]`);
10126
+ this.#socket.io.on("reconnect_error", (err) => {
10127
+ this.LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.io.on('reconnect_error'): [${err}] Address: [${this.#address}]`);
10067
10128
  });
10068
- socketDetail.socket.on("connect_error", (err) => {
10069
- this.#LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.on('connect_error'): [${err}] Address: [${socketDetail.address}]`);
10129
+ this.#socket.on("connect_error", (err) => {
10130
+ this.LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.on('connect_error'): [${err}] Address: [${this.#address}]`);
10070
10131
  });
10071
- socketDetail.socket.on("connect_timeout", () => {
10072
- this.#LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.on('connect_timeout') Address: [${socketDetail.address}]`);
10132
+ this.#socket.io.on("reconnect", (attempt) => {
10133
+ this.LogErrorMessage(`SocketIoClientHelper(): socketDetail.socket.io.on('reconnect'): Number: [${attempt}] Address: [${this.#address}]`);
10073
10134
  });
10074
- socketDetail.socket.on("connect", () => {
10075
- if (socketDetail.socket) {
10076
- this.#LogDebugMessage(`SocketIoClientHelper(): Socket: [${socketDetail.socket.id}]: connected, Address: [${socketDetail.address}]`);
10077
- if (onConnectCallBack) {
10078
- setTimeout(() => {
10079
- onConnectCallBack(socketDetail.socket);
10080
- }, 0);
10081
- }
10082
- if (socketEventsCallBack) {
10083
- socketEventsCallBack(socketDetail.socket);
10084
- }
10135
+ this.#socket.on("connect", () => {
10136
+ if (this.#socket) {
10137
+ this.LogDebugMessage(`SocketIoClientHelper(): Socket: [${this.#socket.id}]: connected, Address: [${this.#address}]`);
10138
+ setTimeout(() => {
10139
+ this.ConnectCallBack(this.#socket);
10140
+ }, 0);
10141
+ this.SocketEventsCallBack(this.#socket);
10085
10142
  } else {
10086
10143
  const errorMessage = "SocketIoClientHelper(): Could not get socket object from socket.io, Address: [${socketDetail.address}]";
10087
- this.#LogErrorMessage(errorMessage);
10088
- socketDetail.errorCallBack(new Error(errorMessage));
10144
+ this.LogErrorMessage(errorMessage);
10145
+ this.ErrorCallBack(new Error(errorMessage));
10089
10146
  }
10090
10147
  });
10091
- socketDetail.socket.on("disconnect", (reason) => {
10092
- this.#LogDebugMessage("SocketIoClientHelper(): socket disconnect: " + reason);
10148
+ this.#socket.on("disconnect", (reason) => {
10149
+ this.LogDebugMessage("SocketIoClientHelper(): socket disconnect: " + reason);
10093
10150
  switch (reason) {
10094
10151
  case "io server disconnect":
10095
10152
  {
10096
- this.#LogDebugMessage("SocketIoClientHelper(): The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
10097
- this.#LogDebugMessage("SocketIoClientHelper(): The connection will be re-established when the server becomes available.");
10098
- const socketDetail2 = this.sockets[name];
10099
- socketDetail2.socket = null;
10153
+ this.LogDebugMessage("SocketIoClientHelper(): The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
10154
+ this.LogDebugMessage("SocketIoClientHelper(): The connection will be re-established when the server becomes available.");
10155
+ this.#socket = void 0;
10100
10156
  if (isNode) {
10101
- if (this.#options.agentManager) {
10102
- this.#options.agentManager.ResetAgent();
10157
+ if (this.#agentManager) {
10158
+ this.#agentManager.ResetAgent();
10103
10159
  }
10104
- setTimeout(() => this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack), 100).unref();
10160
+ setTimeout(() => this.#EstablishSocketConnect(), 100).unref();
10105
10161
  } else {
10106
- setTimeout(() => this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack), 100);
10162
+ setTimeout(() => this.#EstablishSocketConnect(), 100);
10107
10163
  }
10108
10164
  }
10109
10165
  break;
10110
10166
  case "io client disconnect":
10111
- this.#LogDebugMessage("SocketIoClientHelper(): The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
10112
- this.#LogDebugMessage("SocketIoClientHelper(): The connection will not be re-established automatically.");
10167
+ this.LogDebugMessage("SocketIoClientHelper(): The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
10168
+ this.LogDebugMessage("SocketIoClientHelper(): The connection will not be re-established automatically.");
10113
10169
  break;
10114
10170
  case "transport close":
10115
10171
  case "ping timeout":
10116
10172
  case "transport error":
10117
10173
  {
10118
- this.#LogDebugMessage(`SocketIoClientHelper(): Server unexpectedly disconnected. Reason: [${reason}]`);
10119
- this.#LogDebugMessage("SocketIoClientHelper(): The connection will be re-established when the server becomes available.");
10120
- const socketDetail2 = this.sockets[name];
10121
- if (socketDetail2.socket) {
10122
- socketDetail2.socket.disconnect();
10174
+ this.LogDebugMessage(`SocketIoClientHelper(): Server unexpectedly disconnected. Reason: [${reason}]`);
10175
+ this.LogDebugMessage("SocketIoClientHelper(): The connection will be re-established when the server becomes available.");
10176
+ if (this.#socket) {
10177
+ this.#socket.disconnect();
10123
10178
  }
10124
- socketDetail2.socket = null;
10179
+ this.#socket = void 0;
10125
10180
  if (isNode) {
10126
- if (this.#options.agentManager) {
10127
- this.#options.agentManager?.ResetAgent();
10181
+ if (this.#agentManager) {
10182
+ this.#agentManager?.ResetAgent();
10128
10183
  }
10129
- setTimeout(() => this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack), 100).unref();
10184
+ setTimeout(() => this.#EstablishSocketConnect(), 100).unref();
10130
10185
  } else {
10131
- setTimeout(() => this.#EstablishSocketConnect(name, socketIoCustomPath, onConnectCallBack, socketEventsCallBack), 100);
10186
+ setTimeout(() => this.#EstablishSocketConnect(), 100);
10187
+ }
10188
+ }
10189
+ break;
10190
+ }
10191
+ });
10192
+ }
10193
+ }
10194
+ var dist = {};
10195
+ var browser = { exports: {} };
10196
+ var ms;
10197
+ var hasRequiredMs;
10198
+ function requireMs() {
10199
+ if (hasRequiredMs) return ms;
10200
+ hasRequiredMs = 1;
10201
+ var s = 1e3;
10202
+ var m = s * 60;
10203
+ var h = m * 60;
10204
+ var d = h * 24;
10205
+ var w = d * 7;
10206
+ var y = d * 365.25;
10207
+ ms = function(val, options) {
10208
+ options = options || {};
10209
+ var type = typeof val;
10210
+ if (type === "string" && val.length > 0) {
10211
+ return parse(val);
10212
+ } else if (type === "number" && isFinite(val)) {
10213
+ return options.long ? fmtLong(val) : fmtShort(val);
10214
+ }
10215
+ throw new Error(
10216
+ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
10217
+ );
10218
+ };
10219
+ function parse(str) {
10220
+ str = String(str);
10221
+ if (str.length > 100) {
10222
+ return;
10223
+ }
10224
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
10225
+ str
10226
+ );
10227
+ if (!match) {
10228
+ return;
10229
+ }
10230
+ var n = parseFloat(match[1]);
10231
+ var type = (match[2] || "ms").toLowerCase();
10232
+ switch (type) {
10233
+ case "years":
10234
+ case "year":
10235
+ case "yrs":
10236
+ case "yr":
10237
+ case "y":
10238
+ return n * y;
10239
+ case "weeks":
10240
+ case "week":
10241
+ case "w":
10242
+ return n * w;
10243
+ case "days":
10244
+ case "day":
10245
+ case "d":
10246
+ return n * d;
10247
+ case "hours":
10248
+ case "hour":
10249
+ case "hrs":
10250
+ case "hr":
10251
+ case "h":
10252
+ return n * h;
10253
+ case "minutes":
10254
+ case "minute":
10255
+ case "mins":
10256
+ case "min":
10257
+ case "m":
10258
+ return n * m;
10259
+ case "seconds":
10260
+ case "second":
10261
+ case "secs":
10262
+ case "sec":
10263
+ case "s":
10264
+ return n * s;
10265
+ case "milliseconds":
10266
+ case "millisecond":
10267
+ case "msecs":
10268
+ case "msec":
10269
+ case "ms":
10270
+ return n;
10271
+ default:
10272
+ return void 0;
10273
+ }
10274
+ }
10275
+ function fmtShort(ms2) {
10276
+ var msAbs = Math.abs(ms2);
10277
+ if (msAbs >= d) {
10278
+ return Math.round(ms2 / d) + "d";
10279
+ }
10280
+ if (msAbs >= h) {
10281
+ return Math.round(ms2 / h) + "h";
10282
+ }
10283
+ if (msAbs >= m) {
10284
+ return Math.round(ms2 / m) + "m";
10285
+ }
10286
+ if (msAbs >= s) {
10287
+ return Math.round(ms2 / s) + "s";
10288
+ }
10289
+ return ms2 + "ms";
10290
+ }
10291
+ function fmtLong(ms2) {
10292
+ var msAbs = Math.abs(ms2);
10293
+ if (msAbs >= d) {
10294
+ return plural(ms2, msAbs, d, "day");
10295
+ }
10296
+ if (msAbs >= h) {
10297
+ return plural(ms2, msAbs, h, "hour");
10298
+ }
10299
+ if (msAbs >= m) {
10300
+ return plural(ms2, msAbs, m, "minute");
10301
+ }
10302
+ if (msAbs >= s) {
10303
+ return plural(ms2, msAbs, s, "second");
10304
+ }
10305
+ return ms2 + " ms";
10306
+ }
10307
+ function plural(ms2, msAbs, n, name) {
10308
+ var isPlural = msAbs >= n * 1.5;
10309
+ return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : "");
10310
+ }
10311
+ return ms;
10312
+ }
10313
+ var common;
10314
+ var hasRequiredCommon;
10315
+ function requireCommon() {
10316
+ if (hasRequiredCommon) return common;
10317
+ hasRequiredCommon = 1;
10318
+ function setup(env) {
10319
+ createDebug.debug = createDebug;
10320
+ createDebug.default = createDebug;
10321
+ createDebug.coerce = coerce;
10322
+ createDebug.disable = disable;
10323
+ createDebug.enable = enable;
10324
+ createDebug.enabled = enabled;
10325
+ createDebug.humanize = requireMs();
10326
+ createDebug.destroy = destroy;
10327
+ Object.keys(env).forEach((key) => {
10328
+ createDebug[key] = env[key];
10329
+ });
10330
+ createDebug.names = [];
10331
+ createDebug.skips = [];
10332
+ createDebug.formatters = {};
10333
+ function selectColor(namespace) {
10334
+ let hash = 0;
10335
+ for (let i = 0; i < namespace.length; i++) {
10336
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
10337
+ hash |= 0;
10338
+ }
10339
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
10340
+ }
10341
+ createDebug.selectColor = selectColor;
10342
+ function createDebug(namespace) {
10343
+ let prevTime;
10344
+ let enableOverride = null;
10345
+ let namespacesCache;
10346
+ let enabledCache;
10347
+ function debug(...args) {
10348
+ if (!debug.enabled) {
10349
+ return;
10350
+ }
10351
+ const self = debug;
10352
+ const curr = Number(/* @__PURE__ */ new Date());
10353
+ const ms2 = curr - (prevTime || curr);
10354
+ self.diff = ms2;
10355
+ self.prev = prevTime;
10356
+ self.curr = curr;
10357
+ prevTime = curr;
10358
+ args[0] = createDebug.coerce(args[0]);
10359
+ if (typeof args[0] !== "string") {
10360
+ args.unshift("%O");
10361
+ }
10362
+ let index = 0;
10363
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
10364
+ if (match === "%%") {
10365
+ return "%";
10366
+ }
10367
+ index++;
10368
+ const formatter = createDebug.formatters[format];
10369
+ if (typeof formatter === "function") {
10370
+ const val = args[index];
10371
+ match = formatter.call(self, val);
10372
+ args.splice(index, 1);
10373
+ index--;
10374
+ }
10375
+ return match;
10376
+ });
10377
+ createDebug.formatArgs.call(self, args);
10378
+ const logFn = self.log || createDebug.log;
10379
+ logFn.apply(self, args);
10380
+ }
10381
+ debug.namespace = namespace;
10382
+ debug.useColors = createDebug.useColors();
10383
+ debug.color = createDebug.selectColor(namespace);
10384
+ debug.extend = extend;
10385
+ debug.destroy = createDebug.destroy;
10386
+ Object.defineProperty(debug, "enabled", {
10387
+ enumerable: true,
10388
+ configurable: false,
10389
+ get: () => {
10390
+ if (enableOverride !== null) {
10391
+ return enableOverride;
10392
+ }
10393
+ if (namespacesCache !== createDebug.namespaces) {
10394
+ namespacesCache = createDebug.namespaces;
10395
+ enabledCache = createDebug.enabled(namespace);
10396
+ }
10397
+ return enabledCache;
10398
+ },
10399
+ set: (v) => {
10400
+ enableOverride = v;
10401
+ }
10402
+ });
10403
+ if (typeof createDebug.init === "function") {
10404
+ createDebug.init(debug);
10405
+ }
10406
+ return debug;
10407
+ }
10408
+ function extend(namespace, delimiter) {
10409
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
10410
+ newDebug.log = this.log;
10411
+ return newDebug;
10412
+ }
10413
+ function enable(namespaces) {
10414
+ createDebug.save(namespaces);
10415
+ createDebug.namespaces = namespaces;
10416
+ createDebug.names = [];
10417
+ createDebug.skips = [];
10418
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
10419
+ for (const ns of split) {
10420
+ if (ns[0] === "-") {
10421
+ createDebug.skips.push(ns.slice(1));
10422
+ } else {
10423
+ createDebug.names.push(ns);
10424
+ }
10425
+ }
10426
+ }
10427
+ function matchesTemplate(search, template) {
10428
+ let searchIndex = 0;
10429
+ let templateIndex = 0;
10430
+ let starIndex = -1;
10431
+ let matchIndex = 0;
10432
+ while (searchIndex < search.length) {
10433
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
10434
+ if (template[templateIndex] === "*") {
10435
+ starIndex = templateIndex;
10436
+ matchIndex = searchIndex;
10437
+ templateIndex++;
10438
+ } else {
10439
+ searchIndex++;
10440
+ templateIndex++;
10441
+ }
10442
+ } else if (starIndex !== -1) {
10443
+ templateIndex = starIndex + 1;
10444
+ matchIndex++;
10445
+ searchIndex = matchIndex;
10446
+ } else {
10447
+ return false;
10448
+ }
10449
+ }
10450
+ while (templateIndex < template.length && template[templateIndex] === "*") {
10451
+ templateIndex++;
10452
+ }
10453
+ return templateIndex === template.length;
10454
+ }
10455
+ function disable() {
10456
+ const namespaces = [
10457
+ ...createDebug.names,
10458
+ ...createDebug.skips.map((namespace) => "-" + namespace)
10459
+ ].join(",");
10460
+ createDebug.enable("");
10461
+ return namespaces;
10462
+ }
10463
+ function enabled(name) {
10464
+ for (const skip of createDebug.skips) {
10465
+ if (matchesTemplate(name, skip)) {
10466
+ return false;
10467
+ }
10468
+ }
10469
+ for (const ns of createDebug.names) {
10470
+ if (matchesTemplate(name, ns)) {
10471
+ return true;
10472
+ }
10473
+ }
10474
+ return false;
10475
+ }
10476
+ function coerce(val) {
10477
+ if (val instanceof Error) {
10478
+ return val.stack || val.message;
10479
+ }
10480
+ return val;
10481
+ }
10482
+ function destroy() {
10483
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
10484
+ }
10485
+ createDebug.enable(createDebug.load());
10486
+ return createDebug;
10487
+ }
10488
+ common = setup;
10489
+ return common;
10490
+ }
10491
+ var hasRequiredBrowser;
10492
+ function requireBrowser() {
10493
+ if (hasRequiredBrowser) return browser.exports;
10494
+ hasRequiredBrowser = 1;
10495
+ (function(module, exports) {
10496
+ exports.formatArgs = formatArgs;
10497
+ exports.save = save;
10498
+ exports.load = load;
10499
+ exports.useColors = useColors;
10500
+ exports.storage = localstorage();
10501
+ exports.destroy = /* @__PURE__ */ (() => {
10502
+ let warned = false;
10503
+ return () => {
10504
+ if (!warned) {
10505
+ warned = true;
10506
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
10507
+ }
10508
+ };
10509
+ })();
10510
+ exports.colors = [
10511
+ "#0000CC",
10512
+ "#0000FF",
10513
+ "#0033CC",
10514
+ "#0033FF",
10515
+ "#0066CC",
10516
+ "#0066FF",
10517
+ "#0099CC",
10518
+ "#0099FF",
10519
+ "#00CC00",
10520
+ "#00CC33",
10521
+ "#00CC66",
10522
+ "#00CC99",
10523
+ "#00CCCC",
10524
+ "#00CCFF",
10525
+ "#3300CC",
10526
+ "#3300FF",
10527
+ "#3333CC",
10528
+ "#3333FF",
10529
+ "#3366CC",
10530
+ "#3366FF",
10531
+ "#3399CC",
10532
+ "#3399FF",
10533
+ "#33CC00",
10534
+ "#33CC33",
10535
+ "#33CC66",
10536
+ "#33CC99",
10537
+ "#33CCCC",
10538
+ "#33CCFF",
10539
+ "#6600CC",
10540
+ "#6600FF",
10541
+ "#6633CC",
10542
+ "#6633FF",
10543
+ "#66CC00",
10544
+ "#66CC33",
10545
+ "#9900CC",
10546
+ "#9900FF",
10547
+ "#9933CC",
10548
+ "#9933FF",
10549
+ "#99CC00",
10550
+ "#99CC33",
10551
+ "#CC0000",
10552
+ "#CC0033",
10553
+ "#CC0066",
10554
+ "#CC0099",
10555
+ "#CC00CC",
10556
+ "#CC00FF",
10557
+ "#CC3300",
10558
+ "#CC3333",
10559
+ "#CC3366",
10560
+ "#CC3399",
10561
+ "#CC33CC",
10562
+ "#CC33FF",
10563
+ "#CC6600",
10564
+ "#CC6633",
10565
+ "#CC9900",
10566
+ "#CC9933",
10567
+ "#CCCC00",
10568
+ "#CCCC33",
10569
+ "#FF0000",
10570
+ "#FF0033",
10571
+ "#FF0066",
10572
+ "#FF0099",
10573
+ "#FF00CC",
10574
+ "#FF00FF",
10575
+ "#FF3300",
10576
+ "#FF3333",
10577
+ "#FF3366",
10578
+ "#FF3399",
10579
+ "#FF33CC",
10580
+ "#FF33FF",
10581
+ "#FF6600",
10582
+ "#FF6633",
10583
+ "#FF9900",
10584
+ "#FF9933",
10585
+ "#FFCC00",
10586
+ "#FFCC33"
10587
+ ];
10588
+ function useColors() {
10589
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
10590
+ return true;
10591
+ }
10592
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
10593
+ return false;
10594
+ }
10595
+ let m;
10596
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
10597
+ typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
10598
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
10599
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
10600
+ typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
10601
+ }
10602
+ function formatArgs(args) {
10603
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
10604
+ if (!this.useColors) {
10605
+ return;
10606
+ }
10607
+ const c = "color: " + this.color;
10608
+ args.splice(1, 0, c, "color: inherit");
10609
+ let index = 0;
10610
+ let lastC = 0;
10611
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
10612
+ if (match === "%%") {
10613
+ return;
10614
+ }
10615
+ index++;
10616
+ if (match === "%c") {
10617
+ lastC = index;
10618
+ }
10619
+ });
10620
+ args.splice(lastC, 0, c);
10621
+ }
10622
+ exports.log = console.debug || console.log || (() => {
10623
+ });
10624
+ function save(namespaces) {
10625
+ try {
10626
+ if (namespaces) {
10627
+ exports.storage.setItem("debug", namespaces);
10628
+ } else {
10629
+ exports.storage.removeItem("debug");
10630
+ }
10631
+ } catch (error) {
10632
+ }
10633
+ }
10634
+ function load() {
10635
+ let r;
10636
+ try {
10637
+ r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
10638
+ } catch (error) {
10639
+ }
10640
+ if (!r && typeof process !== "undefined" && "env" in process) {
10641
+ r = process.env.DEBUG;
10642
+ }
10643
+ return r;
10644
+ }
10645
+ function localstorage() {
10646
+ try {
10647
+ return localStorage;
10648
+ } catch (error) {
10649
+ }
10650
+ }
10651
+ module.exports = requireCommon()(exports);
10652
+ const { formatters } = module.exports;
10653
+ formatters.j = function(v) {
10654
+ try {
10655
+ return JSON.stringify(v);
10656
+ } catch (error) {
10657
+ return "[UnexpectedJSONParseError]: " + error.message;
10658
+ }
10659
+ };
10660
+ })(browser, browser.exports);
10661
+ return browser.exports;
10662
+ }
10663
+ var hasRequiredDist;
10664
+ function requireDist() {
10665
+ if (hasRequiredDist) return dist;
10666
+ hasRequiredDist = 1;
10667
+ var __importDefault = dist && dist.__importDefault || function(mod) {
10668
+ return mod && mod.__esModule ? mod : { "default": mod };
10669
+ };
10670
+ Object.defineProperty(dist, "__esModule", { value: true });
10671
+ dist.NodeClusterAdapter = void 0;
10672
+ dist.createAdapter = createAdapter2;
10673
+ dist.setupPrimary = setupPrimary;
10674
+ const node_cluster_1 = __importDefault(require$$0$2);
10675
+ const socket_io_adapter_1 = require$$1$2;
10676
+ const debug_1 = __importDefault(requireBrowser());
10677
+ const debug = (0, debug_1.default)("socket.io-cluster-adapter");
10678
+ const MESSAGE_SOURCE = "_sio_adapter";
10679
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
10680
+ function ignoreError() {
10681
+ }
10682
+ function createAdapter2(opts = {}) {
10683
+ return function(nsp) {
10684
+ return new NodeClusterAdapter(nsp, opts);
10685
+ };
10686
+ }
10687
+ class NodeClusterAdapter extends socket_io_adapter_1.ClusterAdapterWithHeartbeat {
10688
+ constructor(nsp, opts = {}) {
10689
+ super(nsp, opts);
10690
+ process.on("message", (message) => {
10691
+ const isValidSource = (message === null || message === void 0 ? void 0 : message.source) === MESSAGE_SOURCE;
10692
+ if (!isValidSource) {
10693
+ debug("[%s] ignore unknown source", this.uid);
10694
+ return;
10695
+ }
10696
+ if (message.nsp !== this.nsp.name) {
10697
+ debug("[%s] ignore other namespace", this.uid);
10698
+ return;
10699
+ }
10700
+ this.onMessage(message);
10701
+ });
10702
+ this.init();
10703
+ }
10704
+ doPublish(message) {
10705
+ message.source = MESSAGE_SOURCE;
10706
+ process.send(message, null, {}, ignoreError);
10707
+ return Promise.resolve("");
10708
+ }
10709
+ doPublishResponse(requesterUid, response) {
10710
+ response.source = MESSAGE_SOURCE;
10711
+ response.requesterUid = requesterUid;
10712
+ process.send(response, null, {}, ignoreError);
10713
+ return Promise.resolve();
10714
+ }
10715
+ }
10716
+ dist.NodeClusterAdapter = NodeClusterAdapter;
10717
+ const UIDS = /* @__PURE__ */ Symbol("uids");
10718
+ function setupPrimary() {
10719
+ node_cluster_1.default.on("message", (worker, message) => {
10720
+ var _a;
10721
+ const isValidSource = (message === null || message === void 0 ? void 0 : message.source) === MESSAGE_SOURCE;
10722
+ if (!isValidSource) {
10723
+ return;
10724
+ }
10725
+ worker[UIDS] = worker[UIDS] || /* @__PURE__ */ new Set();
10726
+ worker[UIDS].add(message.uid);
10727
+ switch (message.type) {
10728
+ case socket_io_adapter_1.MessageType.FETCH_SOCKETS_RESPONSE:
10729
+ case socket_io_adapter_1.MessageType.SERVER_SIDE_EMIT_RESPONSE:
10730
+ const requesterUid = message.requesterUid;
10731
+ for (const workerId in node_cluster_1.default.workers) {
10732
+ if (hasOwnProperty.call(node_cluster_1.default.workers, workerId) && ((_a = node_cluster_1.default.workers[workerId][UIDS]) === null || _a === void 0 ? void 0 : _a.has(requesterUid))) {
10733
+ node_cluster_1.default.workers[workerId].send(message, null, ignoreError);
10734
+ break;
10132
10735
  }
10133
10736
  }
10134
10737
  break;
10738
+ default:
10739
+ const emitterIdAsString = String(worker.id);
10740
+ for (const workerId in node_cluster_1.default.workers) {
10741
+ if (hasOwnProperty.call(node_cluster_1.default.workers, workerId) && workerId !== emitterIdAsString) {
10742
+ node_cluster_1.default.workers[workerId].send(message, null, ignoreError);
10743
+ }
10744
+ }
10135
10745
  }
10136
10746
  });
10137
10747
  }
10748
+ return dist;
10138
10749
  }
10750
+ requireDist();
10139
10751
  var tinyEmitter = { exports: {} };
10140
10752
  var hasRequiredTinyEmitter;
10141
10753
  function requireTinyEmitter() {
@@ -10191,7 +10803,7 @@ function requireTinyEmitter() {
10191
10803
  }
10192
10804
  var tinyEmitterExports = requireTinyEmitter();
10193
10805
  const SOCKET_NAMESPACE = "stsinstrumentmanager/stsmonitor";
10194
- class ObservabilitySubscriberManager {
10806
+ class ObservabilitySubscriberManager extends SocketIoClient {
10195
10807
  #socket = null;
10196
10808
  #observabilitySocketIOSubscriber = null;
10197
10809
  #logger;
@@ -10203,6 +10815,7 @@ class ObservabilitySubscriberManager {
10203
10815
  #tinyEmitter;
10204
10816
  #id;
10205
10817
  constructor(options) {
10818
+ super("STSVueTilsTester");
10206
10819
  this.#id = v4();
10207
10820
  this.#options = options;
10208
10821
  this.#modelId = options.modelId;
@@ -10350,40 +10963,54 @@ class ObservabilitySubscriberManager {
10350
10963
  resolve(true);
10351
10964
  };
10352
10965
  this.#tinyEmitter.on("connected", onConnected);
10353
- this.#SetupSocketIO();
10966
+ this.WithAddress(`${this.#options.instrumentManagerEndpoint}:${this.#options.instrumentManagerPort}/${SOCKET_NAMESPACE}/`).WithLogger(this.#logger).SetupSocket();
10354
10967
  } else {
10355
10968
  this.#SetupObservabilitySubscriber();
10356
10969
  resolve(true);
10357
10970
  }
10358
10971
  });
10359
10972
  };
10360
- #SetupSocketIO = () => {
10361
- const socketUtils = new SocketIoClientHelper({});
10362
- this.#socket = socketUtils.SetupClientSideSocket(
10363
- "STSVueTilsTester",
10364
- `${this.#options.instrumentManagerEndpoint}:${this.#options.instrumentManagerPort}/${SOCKET_NAMESPACE}/`,
10365
- "",
10366
- // use default /socket.io/ path
10367
- this.#SocketConnect,
10368
- // Connected call back
10369
- this.#ProcessSocketEvents,
10370
- // Custom Events
10371
- this.#ProcessSocketError
10372
- // Handle socket errors
10373
- );
10374
- };
10375
- #SocketConnect = (socket) => {
10973
+ ConnectCallBack(socket) {
10376
10974
  defaultLogger.debug(chalk.magenta(`SocketIOConnect(): Socket ID: [${socket.id}]`));
10377
10975
  if (this.#observabilitySubscriptionManager === null) {
10378
10976
  this.#SetupObservabilitySubscriber();
10379
10977
  }
10380
10978
  this.#SocketIOConnect(socket);
10381
- };
10382
- #ProcessSocketError = (error) => {
10979
+ }
10980
+ ErrorCallBack(error) {
10383
10981
  defaultLogger.error(chalk.red(`SetupClientSideSocket error callback: [${error}]`));
10384
- };
10385
- #ProcessSocketEvents = (socket) => {
10386
- };
10982
+ }
10983
+ SocketEventsCallBack(socket) {
10984
+ }
10985
+ /*
10986
+ #SetupSocketIO = () => {
10987
+ const socketUtils = new SocketIoClientHelper({});
10988
+
10989
+ this.#socket = socketUtils.SetupClientSideSocket('STSVueTilsTester',
10990
+ `${this.#options.instrumentManagerEndpoint}:${this.#options.instrumentManagerPort}/${SOCKET_NAMESPACE}/`,
10991
+ '', // use default /socket.io/ path
10992
+ this.#SocketConnect as any, // Connected call back
10993
+ this.#ProcessSocketEvents as any, // Custom Events
10994
+ this.#ProcessSocketError // Handle socket errors
10995
+ ) as any;
10996
+ }
10997
+
10998
+ #SocketConnect = (socket: Socket) => {
10999
+ defaultLogger.debug(chalk.magenta(`SocketIOConnect(): Socket ID: [${socket.id}]`));
11000
+ if (this.#observabilitySubscriptionManager === null) {
11001
+ this.#SetupObservabilitySubscriber();
11002
+ }
11003
+ this.#SocketIOConnect(socket);
11004
+ }
11005
+
11006
+ #ProcessSocketError = (error: any) => {
11007
+ defaultLogger.error(chalk.red(`SetupClientSideSocket error callback: [${error}]`))
11008
+ }
11009
+
11010
+ #ProcessSocketEvents = (socket: Socket) => {
11011
+
11012
+ }
11013
+ */
10387
11014
  }
10388
11015
  const _hoisted_1$1 = { class: "d-flex flex-wrap justify-space-between" };
10389
11016
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({