mftsccs-browser 2.1.4-beta → 2.1.6-beta

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.
@@ -4580,6 +4580,10 @@ class BinaryTypeTree {
4580
4580
  return __awaiter(this, void 0, void 0, function* () {
4581
4581
  if (this.root == null) {
4582
4582
  this.root = node;
4583
+ let event = new CustomEvent(`${node.key}`, { detail: node.value[0] });
4584
+ // console.log("this is the fired event", event);
4585
+ // dispatchEvent(event);
4586
+ (0,_app__WEBPACK_IMPORTED_MODULE_0__.dispatchIdEvent)(node.key, { detail: node.value[0] });
4583
4587
  return this.root;
4584
4588
  }
4585
4589
  else {
@@ -5264,6 +5268,7 @@ class ConceptsData {
5264
5268
  // }
5265
5269
  //UpdateToDatabase("concept",concept);
5266
5270
  //IndexDbUpdate.UpdateConceptIndexDb(concept);
5271
+ console.log("this is the adding type concept", concept);
5267
5272
  _BinaryTree__WEBPACK_IMPORTED_MODULE_1__.BinaryTree.addConceptToTree(concept);
5268
5273
  _BinaryTypeTree__WEBPACK_IMPORTED_MODULE_3__.BinaryTypeTree.addConceptToTree(concept);
5269
5274
  //BinaryCharacterTree.addConceptToTree(concept);
@@ -18134,9 +18139,6 @@ function FormatFunctionDataForData(connections_1, compositionData_1) {
18134
18139
  myConcepts.push(connections[i].ofTheConceptId);
18135
18140
  myConcepts.push(connections[i].typeId);
18136
18141
  }
18137
- connections.sort(function (x, y) {
18138
- return y.id - x.id;
18139
- });
18140
18142
  for (let i = 0; i < connections.length; i++) {
18141
18143
  let reverseFlag = false;
18142
18144
  let ofTheConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].ofTheConceptId);
@@ -18259,7 +18261,7 @@ function FormatFunctionDataForData(connections_1, compositionData_1) {
18259
18261
  * @returns
18260
18262
  */
18261
18263
  function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionData_1, newCompositionData_1, mainComposition_1) {
18262
- return __awaiter(this, arguments, void 0, function* (connections, compositionData, newCompositionData, mainComposition, reverse = []) {
18264
+ return __awaiter(this, arguments, void 0, function* (connections, compositionData, newCompositionData, mainComposition, reverse = [], CountDictionary) {
18263
18265
  var _a, _b, _c, _d, _e, _f, _g;
18264
18266
  let startTime = new Date().getTime();
18265
18267
  let mainData = [];
@@ -18269,9 +18271,6 @@ function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionDat
18269
18271
  myConcepts.push(connections[i].ofTheConceptId);
18270
18272
  myConcepts.push(connections[i].typeId);
18271
18273
  }
18272
- connections.sort(function (x, y) {
18273
- return y.id - x.id;
18274
- });
18275
18274
  for (let i = 0; i < connections.length; i++) {
18276
18275
  let reverseFlag = false;
18277
18276
  let ofTheConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].ofTheConceptId);
@@ -18306,7 +18305,8 @@ function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionDat
18306
18305
  if (isComp) {
18307
18306
  let data = {
18308
18307
  "id": ofTheConcept.id,
18309
- "data": compositionData[connections[i].ofTheConceptId]
18308
+ "data": compositionData[connections[i].ofTheConceptId],
18309
+ "created_on": connections[i].entryTimeStamp
18310
18310
  };
18311
18311
  let reverseCharater = linkerConcept.characterValue + "_reverse";
18312
18312
  if (Array.isArray(newData[key][reverseCharater])) {
@@ -18366,7 +18366,8 @@ function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionDat
18366
18366
  if (myData) {
18367
18367
  let data = {
18368
18368
  "id": toTheConcept.id,
18369
- "data": compositionData[connections[i].toTheConceptId]
18369
+ "data": compositionData[connections[i].toTheConceptId],
18370
+ "created_on": connections[i].entryTimeStamp
18370
18371
  };
18371
18372
  if (Array.isArray(newData[key])) {
18372
18373
  if (isComp) {
@@ -18426,9 +18427,6 @@ function FormatFunctionData(connections_1, compositionData_1) {
18426
18427
  myConcepts.push(connections[i].ofTheConceptId);
18427
18428
  myConcepts.push(connections[i].typeId);
18428
18429
  }
18429
- connections.sort(function (x, y) {
18430
- return y.id - x.id;
18431
- });
18432
18430
  for (let i = 0; i < connections.length; i++) {
18433
18431
  let reverseFlag = false;
18434
18432
  let ofTheConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].ofTheConceptId);
@@ -18685,8 +18683,8 @@ function FormatConceptsAndConnectionsNormalList(connections_1, compositionData_1
18685
18683
  * This function takes in the connections and then converts the connections to the single level objects for further processing
18686
18684
  * This function is the builder of the arrays/ objects from the connections.
18687
18685
  */
18688
- function formatFunction(connections_1, compositionData_1, reverse_1) {
18689
- return __awaiter(this, arguments, void 0, function* (connections, compositionData, reverse, order = "DESC") {
18686
+ function formatFunction(connections, compositionData, reverse) {
18687
+ return __awaiter(this, void 0, void 0, function* () {
18690
18688
  var _a, _b, _c, _d, _e, _f, _g, _h;
18691
18689
  let myConcepts = [];
18692
18690
  for (let i = 0; i < connections.length; i++) {
@@ -18694,16 +18692,6 @@ function formatFunction(connections_1, compositionData_1, reverse_1) {
18694
18692
  myConcepts.push(connections[i].ofTheConceptId);
18695
18693
  myConcepts.push(connections[i].typeId);
18696
18694
  }
18697
- if (order == "DESC") {
18698
- connections.sort(function (x, y) {
18699
- return x.id - y.id;
18700
- });
18701
- }
18702
- else {
18703
- connections.sort(function (x, y) {
18704
- return y.id - x.id;
18705
- });
18706
- }
18707
18695
  for (let i = 0; i < connections.length; i++) {
18708
18696
  let reverseFlag = false;
18709
18697
  if (reverse.includes(connections[i].id)) {
@@ -19032,7 +19020,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
19032
19020
  * @returns
19033
19021
  */
19034
19022
  function FormatFunctionDataForDataJustId(connections_1, compositionData_1) {
19035
- return __awaiter(this, arguments, void 0, function* (connections, compositionData, reverse = [], order = "DESC") {
19023
+ return __awaiter(this, arguments, void 0, function* (connections, compositionData, reverse = []) {
19036
19024
  var _a, _b, _c, _d, _e, _f, _g, _h;
19037
19025
  let myConcepts = [];
19038
19026
  for (let i = 0; i < connections.length; i++) {
@@ -19040,16 +19028,6 @@ function FormatFunctionDataForDataJustId(connections_1, compositionData_1) {
19040
19028
  myConcepts.push(connections[i].ofTheConceptId);
19041
19029
  myConcepts.push(connections[i].typeId);
19042
19030
  }
19043
- if (order == "DESC") {
19044
- connections.sort(function (x, y) {
19045
- return x.id - y.id;
19046
- });
19047
- }
19048
- else {
19049
- connections.sort(function (x, y) {
19050
- return y.id - x.id;
19051
- });
19052
- }
19053
19031
  for (let i = 0; i < connections.length; i++) {
19054
19032
  let reverseFlag = false;
19055
19033
  let ofTheConcept = yield (0,_GetTheConcept__WEBPACK_IMPORTED_MODULE_1__["default"])(connections[i].ofTheConceptId);
@@ -19179,7 +19157,7 @@ function FormatFunctionDataForDataJustId(connections_1, compositionData_1) {
19179
19157
  * @returns
19180
19158
  */
19181
19159
  function FormatFromConnectionsAlteredArrayExternalJustId(connections_1, compositionData_1, mainComposition_1) {
19182
- return __awaiter(this, arguments, void 0, function* (connections, compositionData, mainComposition, reverse = [], CountDictionary, order = "DESC") {
19160
+ return __awaiter(this, arguments, void 0, function* (connections, compositionData, mainComposition, reverse = [], CountDictionary) {
19183
19161
  var _a, _b, _c, _d, _e, _f, _g;
19184
19162
  let startTime = new Date().getTime();
19185
19163
  let mainData = [];
@@ -19189,16 +19167,6 @@ function FormatFromConnectionsAlteredArrayExternalJustId(connections_1, composit
19189
19167
  myConcepts.push(connections[i].ofTheConceptId);
19190
19168
  myConcepts.push(connections[i].typeId);
19191
19169
  }
19192
- if (order == "DESC") {
19193
- connections.sort(function (x, y) {
19194
- return x.id - y.id;
19195
- });
19196
- }
19197
- else {
19198
- connections.sort(function (x, y) {
19199
- return y.id - x.id;
19200
- });
19201
- }
19202
19170
  for (let i = 0; i < connections.length; i++) {
19203
19171
  let reverseFlag = false;
19204
19172
  let ofTheConcept = yield (0,_GetTheConcept__WEBPACK_IMPORTED_MODULE_1__["default"])(connections[i].ofTheConceptId);
@@ -19934,6 +19902,7 @@ __webpack_require__.r(__webpack_exports__);
19934
19902
  /* harmony import */ var _JustIdFormat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./JustIdFormat */ "./src/Services/Search/JustIdFormat.ts");
19935
19903
  /* harmony import */ var _DataIdFormat__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DataIdFormat */ "./src/Services/Search/DataIdFormat.ts");
19936
19904
  /* harmony import */ var _Common_DecodeCountInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Common/DecodeCountInfo */ "./src/Services/Common/DecodeCountInfo.ts");
19905
+ /* harmony import */ var _orderingConnections__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./orderingConnections */ "./src/Services/Search/orderingConnections.ts");
19937
19906
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
19938
19907
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19939
19908
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -19950,6 +19919,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
19950
19919
 
19951
19920
 
19952
19921
 
19922
+
19953
19923
  /**
19954
19924
  * This function will help you search a concept by their type and also to query inside of it.
19955
19925
  * Put the number of compositions you want to get in the searchStructure which can be set by inpage and page
@@ -20056,10 +20026,11 @@ function formatLinkersNormal(linkers, conceptIds, connections, mainCompositionId
20056
20026
  function formatConnections(linkers, conceptIds, mainCompositionIds, reverse, countInfos) {
20057
20027
  return __awaiter(this, void 0, void 0, function* () {
20058
20028
  let prefetchConnections = yield (0,_GetCompositionBulk__WEBPACK_IMPORTED_MODULE_1__.GetConnectionDataPrefetch)(linkers);
20059
- let CountDictionary = yield (0,_Common_DecodeCountInfo__WEBPACK_IMPORTED_MODULE_6__.GetConnectionTypeForCount)(countInfos);
20029
+ //let CountDictionary:any = await GetConnectionTypeForCount(countInfos);
20030
+ prefetchConnections = (0,_orderingConnections__WEBPACK_IMPORTED_MODULE_7__.orderTheConnections)(prefetchConnections);
20060
20031
  let compositionData = [];
20061
20032
  let newCompositionData = [];
20062
- compositionData = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.formatFunction)(prefetchConnections, compositionData, reverse, CountDictionary);
20033
+ compositionData = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.formatFunction)(prefetchConnections, compositionData, reverse);
20063
20034
  compositionData = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.formatFunctionForData)(prefetchConnections, compositionData, reverse);
20064
20035
  let output = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.FormatConceptsAndConnectionsNormalList)(prefetchConnections, compositionData, mainCompositionIds, newCompositionData, reverse);
20065
20036
  return output;
@@ -20079,11 +20050,12 @@ function formatConnectionsJustId(linkers_1, conceptIds_1, mainCompositionIds_1,
20079
20050
  return __awaiter(this, arguments, void 0, function* (linkers, conceptIds, mainCompositionIds, reverse, countInfos, order = "DESC") {
20080
20051
  let prefetchConnections = yield (0,_GetCompositionBulk__WEBPACK_IMPORTED_MODULE_1__.GetConnectionDataPrefetch)(linkers);
20081
20052
  let CountDictionary = yield (0,_Common_DecodeCountInfo__WEBPACK_IMPORTED_MODULE_6__.GetConnectionTypeForCount)(countInfos);
20053
+ prefetchConnections = (0,_orderingConnections__WEBPACK_IMPORTED_MODULE_7__.orderTheConnections)(prefetchConnections);
20082
20054
  let compositionData = [];
20083
20055
  let newCompositionData = [];
20084
- compositionData = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.formatFunction)(prefetchConnections, compositionData, reverse, order);
20085
- compositionData = yield (0,_JustIdFormat__WEBPACK_IMPORTED_MODULE_4__.FormatFunctionDataForDataJustId)(prefetchConnections, compositionData, reverse, order);
20086
- let output = yield (0,_JustIdFormat__WEBPACK_IMPORTED_MODULE_4__.FormatFromConnectionsAlteredArrayExternalJustId)(prefetchConnections, compositionData, mainCompositionIds, reverse, CountDictionary, order);
20056
+ compositionData = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.formatFunction)(prefetchConnections, compositionData, reverse);
20057
+ compositionData = yield (0,_JustIdFormat__WEBPACK_IMPORTED_MODULE_4__.FormatFunctionDataForDataJustId)(prefetchConnections, compositionData, reverse);
20058
+ let output = yield (0,_JustIdFormat__WEBPACK_IMPORTED_MODULE_4__.FormatFromConnectionsAlteredArrayExternalJustId)(prefetchConnections, compositionData, mainCompositionIds, reverse, CountDictionary);
20087
20059
  return output;
20088
20060
  });
20089
20061
  }
@@ -20097,20 +20069,48 @@ function formatConnectionsJustId(linkers_1, conceptIds_1, mainCompositionIds_1,
20097
20069
  * @param reverse
20098
20070
  * @returns
20099
20071
  */
20100
- function formatConnectionsDataId(linkers, conceptIds, mainCompositionIds, reverse) {
20101
- return __awaiter(this, void 0, void 0, function* () {
20072
+ function formatConnectionsDataId(linkers_1, conceptIds_1, mainCompositionIds_1, reverse_1, countInfos_1) {
20073
+ return __awaiter(this, arguments, void 0, function* (linkers, conceptIds, mainCompositionIds, reverse, countInfos, order = "DESC") {
20102
20074
  let prefetchConnections = yield (0,_GetCompositionBulk__WEBPACK_IMPORTED_MODULE_1__.GetConnectionDataPrefetch)(linkers);
20075
+ let CountDictionary = yield (0,_Common_DecodeCountInfo__WEBPACK_IMPORTED_MODULE_6__.GetConnectionTypeForCount)(countInfos);
20076
+ prefetchConnections = (0,_orderingConnections__WEBPACK_IMPORTED_MODULE_7__.orderTheConnections)(prefetchConnections);
20103
20077
  let compositionData = [];
20104
20078
  let newCompositionData = [];
20105
20079
  compositionData = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFunctionData)(prefetchConnections, compositionData, reverse);
20106
20080
  compositionData = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFunctionDataForData)(prefetchConnections, compositionData, reverse);
20107
- console.log("this is the composition data", compositionData);
20108
- let output = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFromConnectionsAlteredArrayExternal)(prefetchConnections, compositionData, newCompositionData, mainCompositionIds, reverse);
20081
+ let output = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFromConnectionsAlteredArrayExternal)(prefetchConnections, compositionData, newCompositionData, mainCompositionIds, reverse, CountDictionary);
20109
20082
  return output;
20110
20083
  });
20111
20084
  }
20112
20085
 
20113
20086
 
20087
+ /***/ }),
20088
+
20089
+ /***/ "./src/Services/Search/orderingConnections.ts":
20090
+ /*!****************************************************!*\
20091
+ !*** ./src/Services/Search/orderingConnections.ts ***!
20092
+ \****************************************************/
20093
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20094
+
20095
+ __webpack_require__.r(__webpack_exports__);
20096
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20097
+ /* harmony export */ orderTheConnections: () => (/* binding */ orderTheConnections)
20098
+ /* harmony export */ });
20099
+ function orderTheConnections(connections, order = "DESC") {
20100
+ if (order == "ASC") {
20101
+ connections.sort(function (x, y) {
20102
+ return x.id - y.id;
20103
+ });
20104
+ }
20105
+ else {
20106
+ connections.sort(function (x, y) {
20107
+ return y.id - x.id;
20108
+ });
20109
+ }
20110
+ return connections;
20111
+ }
20112
+
20113
+
20114
20114
  /***/ }),
20115
20115
 
20116
20116
  /***/ "./src/Services/Security/GetRequestHeader.ts":
@@ -21134,6 +21134,7 @@ class BaseObserver {
21134
21134
  * This is called by any data change. So that any data change will notify all the callback functions to execute.
21135
21135
  */
21136
21136
  notify() {
21137
+ console.log("this is the subscribers", this.subscribers);
21137
21138
  this.subscribers.map((subscriber) => {
21138
21139
  subscriber(this.data);
21139
21140
  });
@@ -21979,6 +21980,7 @@ class StatefulWidget extends _BaseWidget__WEBPACK_IMPORTED_MODULE_0__.BaseWidget
21979
21980
  }
21980
21981
  //console.log("added-widget-container",this.childWidgetElement);
21981
21982
  // addEvents is called after the element has been mounted.
21983
+ console.log("this is the rendering", this);
21982
21984
  this.after_render();
21983
21985
  // then after the child widgets are again loaded.
21984
21986
  if (this.widgetMounted) {
@@ -22046,6 +22048,7 @@ class StatefulWidget extends _BaseWidget__WEBPACK_IMPORTED_MODULE_0__.BaseWidget
22046
22048
  * for the widget and its html element. User can add any logic here.
22047
22049
  */
22048
22050
  after_render() {
22051
+ console.log("this is calling the after render", this);
22049
22052
  }
22050
22053
  /**
22051
22054
  * render child widgets
@@ -22177,13 +22180,16 @@ class DependencyObserver {
22177
22180
  * @param id this is the type id which needs to be tracked
22178
22181
  */
22179
22182
  listenToEventType(id) {
22183
+ console.log("this is the type listen before", id);
22180
22184
  window.addEventListener(`${id}`, (event) => {
22185
+ console.log("this is the window event", id, event);
22181
22186
  if (!this.isUpdating) {
22182
22187
  this.isUpdating = true;
22183
22188
  let that = this;
22184
22189
  setTimeout(function () {
22185
22190
  return __awaiter(this, void 0, void 0, function* () {
22186
22191
  let myEvent = event;
22192
+ console.log("this is the event", myEvent);
22187
22193
  if (!that.compositionIds.includes(myEvent === null || myEvent === void 0 ? void 0 : myEvent.detail)) {
22188
22194
  that.compositionIds.unshift(myEvent === null || myEvent === void 0 ? void 0 : myEvent.detail);
22189
22195
  that.listenToEvent(myEvent === null || myEvent === void 0 ? void 0 : myEvent.detail);
@@ -22403,13 +22409,14 @@ class GetCompositionListObservable extends _DepenedencyObserver__WEBPACK_IMPORTE
22403
22409
  this.listenToEvent(this.compositionIds[i]);
22404
22410
  }
22405
22411
  }
22406
- return yield this.build();
22412
+ let mydata = yield this.build();
22413
+ return mydata;
22407
22414
  });
22408
22415
  }
22409
22416
  build() {
22410
22417
  return __awaiter(this, void 0, void 0, function* () {
22411
22418
  this.data = [];
22412
- console.log("this is building the data list");
22419
+ console.log("this is building the data list", this.startPage, this.inpage);
22413
22420
  if (this.format == _app__WEBPACK_IMPORTED_MODULE_1__.JUSTDATA) {
22414
22421
  for (let i = this.startPage; i < this.startPage + this.inpage; i++) {
22415
22422
  if (this.compositionIds[i]) {
@@ -22450,8 +22457,7 @@ class GetCompositionListObservable extends _DepenedencyObserver__WEBPACK_IMPORTE
22450
22457
  * This function will give you the list of the concepts by composition name with a listener to any data change.
22451
22458
  */
22452
22459
  function GetCompositionListListener(compositionName, userId, inpage, page, format = _app__WEBPACK_IMPORTED_MODULE_1__.JUSTDATA) {
22453
- let startTime = performance.now();
22454
- const compositionResult = new GetCompositionListObservable(compositionName, userId, inpage, page, format);
22460
+ return new GetCompositionListObservable(compositionName, userId, inpage, page, format);
22455
22461
  // Add Log
22456
22462
  // Logger.logInfo(
22457
22463
  // startTime,
@@ -22466,7 +22472,6 @@ function GetCompositionListListener(compositionName, userId, inpage, page, forma
22466
22472
  // "UnknownUserAgent",
22467
22473
  // []
22468
22474
  // );
22469
- return compositionResult;
22470
22475
  }
22471
22476
 
22472
22477
 
@@ -23067,7 +23072,7 @@ class SearchLinkMultipleAllObservable extends _DepenedencyObserver__WEBPACK_IMPO
23067
23072
  return __awaiter(this, void 0, void 0, function* () {
23068
23073
  let countInfos = (0,_Services_Common_DecodeCountInfo__WEBPACK_IMPORTED_MODULE_2__.DecodeCountInfo)(this.countInfoStrings);
23069
23074
  if (this.format == _Constants_FormatConstants__WEBPACK_IMPORTED_MODULE_1__.DATAID) {
23070
- this.data = yield (0,_Services_Search_SearchWithTypeAndLinker__WEBPACK_IMPORTED_MODULE_3__.formatConnectionsDataId)(this.linkers, this.conceptIds, this.mainCompositionIds, this.reverse);
23075
+ this.data = yield (0,_Services_Search_SearchWithTypeAndLinker__WEBPACK_IMPORTED_MODULE_3__.formatConnectionsDataId)(this.linkers, this.conceptIds, this.mainCompositionIds, this.reverse, countInfos, this.order);
23071
23076
  }
23072
23077
  else if (this.format == _Constants_FormatConstants__WEBPACK_IMPORTED_MODULE_1__.JUSTDATA) {
23073
23078
  this.data = yield (0,_Services_Search_SearchWithTypeAndLinker__WEBPACK_IMPORTED_MODULE_3__.formatConnectionsJustId)(this.linkers, this.conceptIds, this.mainCompositionIds, this.reverse, countInfos, this.order);
@@ -23767,7 +23772,7 @@ function init() {
23767
23772
  console.log("new worker", newWorker);
23768
23773
  if (newWorker) {
23769
23774
  newWorker.onstatechange = () => __awaiter(this, void 0, void 0, function* () {
23770
- console.warn("on state change triggered", (newWorker.state === "installed" || newWorker.state === "activated" || newWorker.state === 'redundant'), navigator.serviceWorker.controller);
23775
+ console.warn("on state change triggered", newWorker.state, navigator.serviceWorker.controller);
23771
23776
  if (newWorker.state === "installing") {
23772
23777
  console.log("Service Worker installing");
23773
23778
  serviceWorker = undefined;
@@ -23781,6 +23786,10 @@ function init() {
23781
23786
  console.log("This is a flag after sw init : ", flags);
23782
23787
  // serviceWorker = registration.active;
23783
23788
  // Send init message now that it's active
23789
+ setTimeout(() => {
23790
+ console.log('Message Processed after some time');
23791
+ processMessageQueue();
23792
+ }, 5000);
23784
23793
  yield sendMessage("init", {
23785
23794
  url,
23786
23795
  aiurl,
@@ -23906,6 +23915,8 @@ function sendMessage(type, payload) {
23906
23915
  return new Promise((resolve, reject) => {
23907
23916
  // navigator.serviceWorker.ready
23908
23917
  // .then((registration) => {
23918
+ if (!((navigator.serviceWorker.controller || serviceWorker) && (serviceWorkerReady || type == 'init')))
23919
+ console.log('will go to queue', navigator.serviceWorker.controller, serviceWorker, serviceWorkerReady, type == 'init');
23909
23920
  if ((navigator.serviceWorker.controller || serviceWorker) && (serviceWorkerReady || type == 'init')) {
23910
23921
  const responseHandler = (event) => {
23911
23922
  var _a, _b, _c, _d, _e, _f;
@@ -24201,7 +24212,7 @@ function initConceptConnection() {
24201
24212
  */
24202
24213
  function dispatchIdEvent(id, data = {}) {
24203
24214
  // console.log('id event dispatched', id)
24204
- if (serviceWorker) {
24215
+ if (serviceWorker || typeof window != undefined) {
24205
24216
  // let event = new Event(`${id}`);
24206
24217
  let event = new CustomEvent(`${id}`, data);
24207
24218
  dispatchEvent(event);