@design.estate/dees-catalog 7.0.0 → 8.0.0

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.
@@ -6687,9 +6687,9 @@ var init_property2 = __esm({
6687
6687
  }
6688
6688
  });
6689
6689
 
6690
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.colors.js
6690
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.colors.js
6691
6691
  var init_domtools_colors = __esm({
6692
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.colors.js"() {
6692
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.colors.js"() {
6693
6693
  }
6694
6694
  });
6695
6695
 
@@ -6754,17 +6754,10 @@ var init_dist_ts3 = __esm({
6754
6754
  }
6755
6755
  });
6756
6756
 
6757
- // node_modules/.pnpm/@api.global+typedrequest-interfaces@3.0.19/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js
6757
+ // node_modules/.pnpm/@api.global+typedrequest-interfaces@7.1.0/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js
6758
6758
  var dist_ts_exports4 = {};
6759
6759
  var init_dist_ts4 = __esm({
6760
- "node_modules/.pnpm/@api.global+typedrequest-interfaces@3.0.19/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js"() {
6761
- }
6762
- });
6763
-
6764
- // node_modules/.pnpm/@api.global+typedrequest-interfaces@4.0.0/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js
6765
- var dist_ts_exports5 = {};
6766
- var init_dist_ts5 = __esm({
6767
- "node_modules/.pnpm/@api.global+typedrequest-interfaces@4.0.0/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js"() {
6760
+ "node_modules/.pnpm/@api.global+typedrequest-interfaces@7.1.0/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js"() {
6768
6761
  }
6769
6762
  });
6770
6763
 
@@ -6883,12 +6876,12 @@ var init_smartmatch_plugins = __esm({
6883
6876
  });
6884
6877
 
6885
6878
  // node_modules/.pnpm/@push.rocks+smartmatch@2.0.0/node_modules/@push.rocks/smartmatch/dist_ts/index.js
6886
- var dist_ts_exports6 = {};
6887
- __export(dist_ts_exports6, {
6879
+ var dist_ts_exports5 = {};
6880
+ __export(dist_ts_exports5, {
6888
6881
  SmartMatch: () => SmartMatch
6889
6882
  });
6890
6883
  var SmartMatch;
6891
- var init_dist_ts6 = __esm({
6884
+ var init_dist_ts5 = __esm({
6892
6885
  "node_modules/.pnpm/@push.rocks+smartmatch@2.0.0/node_modules/@push.rocks/smartmatch/dist_ts/index.js"() {
6893
6886
  init_smartmatch_plugins();
6894
6887
  SmartMatch = class {
@@ -17120,7 +17113,7 @@ var init_pretty_ms = __esm({
17120
17113
  var import_dayjs, import_isToday;
17121
17114
  var init_smarttime_plugins = __esm({
17122
17115
  "node_modules/.pnpm/@push.rocks+smarttime@4.2.3/node_modules/@push.rocks/smarttime/dist_ts/smarttime.plugins.js"() {
17123
- init_dist_ts8();
17116
+ init_dist_ts7();
17124
17117
  init_dist_ts3();
17125
17118
  init_dist_ts();
17126
17119
  init_croner();
@@ -17199,7 +17192,7 @@ var init_smarttime_classes_cronmanager = __esm({
17199
17192
  }
17200
17193
  constructor() {
17201
17194
  this.status = "stopped";
17202
- this.cronjobs = new dist_ts_exports7.ObjectMap();
17195
+ this.cronjobs = new dist_ts_exports6.ObjectMap();
17203
17196
  this.cycleWakeDeferred = null;
17204
17197
  }
17205
17198
  /**
@@ -17701,8 +17694,8 @@ var init_smarttime_classes_timer = __esm({
17701
17694
  });
17702
17695
 
17703
17696
  // node_modules/.pnpm/@push.rocks+smarttime@4.2.3/node_modules/@push.rocks/smarttime/dist_ts/index.js
17704
- var dist_ts_exports8 = {};
17705
- __export(dist_ts_exports8, {
17697
+ var dist_ts_exports7 = {};
17698
+ __export(dist_ts_exports7, {
17706
17699
  CronJob: () => CronJob,
17707
17700
  CronManager: () => CronManager,
17708
17701
  ExtendedDate: () => ExtendedDate,
@@ -17715,7 +17708,7 @@ __export(dist_ts_exports8, {
17715
17708
  getMilliSecondsFromUnits: () => getMilliSecondsFromUnits,
17716
17709
  units: () => units
17717
17710
  });
17718
- var init_dist_ts7 = __esm({
17711
+ var init_dist_ts6 = __esm({
17719
17712
  "node_modules/.pnpm/@push.rocks+smarttime@4.2.3/node_modules/@push.rocks/smarttime/dist_ts/index.js"() {
17720
17713
  init_smarttime_classes_cronmanager();
17721
17714
  init_smarttime_classes_cronjob();
@@ -18561,23 +18554,23 @@ var require_SymbolTree = __commonJS({
18561
18554
  }
18562
18555
  });
18563
18556
 
18564
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.plugins.js
18557
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.plugins.js
18565
18558
  var import_symbol_tree;
18566
18559
  var init_classes_plugins = __esm({
18567
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.plugins.js"() {
18560
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.plugins.js"() {
18568
18561
  init_dist_ts3();
18569
- init_dist_ts6();
18562
+ init_dist_ts5();
18570
18563
  init_dist_ts();
18571
18564
  init_dist_ts2();
18572
- init_dist_ts7();
18565
+ init_dist_ts6();
18573
18566
  import_symbol_tree = __toESM(require_SymbolTree(), 1);
18574
18567
  }
18575
18568
  });
18576
18569
 
18577
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.asyncexecutionstack.js
18570
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.asyncexecutionstack.js
18578
18571
  var AsyncExecutionStack;
18579
18572
  var init_classes_asyncexecutionstack = __esm({
18580
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.asyncexecutionstack.js"() {
18573
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.asyncexecutionstack.js"() {
18581
18574
  init_classes_plugins();
18582
18575
  AsyncExecutionStack = class {
18583
18576
  static {
@@ -18740,10 +18733,10 @@ var init_classes_asyncexecutionstack = __esm({
18740
18733
  }
18741
18734
  });
18742
18735
 
18743
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.backpressuredarray.js
18736
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.backpressuredarray.js
18744
18737
  var BackpressuredArray;
18745
18738
  var init_classes_backpressuredarray = __esm({
18746
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.backpressuredarray.js"() {
18739
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.backpressuredarray.js"() {
18747
18740
  init_classes_plugins();
18748
18741
  BackpressuredArray = class {
18749
18742
  static {
@@ -18841,10 +18834,10 @@ var init_classes_backpressuredarray = __esm({
18841
18834
  }
18842
18835
  });
18843
18836
 
18844
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.fastmap.js
18837
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.fastmap.js
18845
18838
  var FastMap;
18846
18839
  var init_classes_fastmap = __esm({
18847
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.fastmap.js"() {
18840
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.fastmap.js"() {
18848
18841
  init_classes_plugins();
18849
18842
  FastMap = class _FastMap {
18850
18843
  static {
@@ -18931,10 +18924,10 @@ var init_classes_fastmap = __esm({
18931
18924
  }
18932
18925
  });
18933
18926
 
18934
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.objectmap.js
18927
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.objectmap.js
18935
18928
  var uni, ObjectMap;
18936
18929
  var init_classes_objectmap = __esm({
18937
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.objectmap.js"() {
18930
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.objectmap.js"() {
18938
18931
  init_classes_plugins();
18939
18932
  init_classes_fastmap();
18940
18933
  uni = /* @__PURE__ */ __name((prefix = "uni") => {
@@ -19175,10 +19168,10 @@ var init_classes_objectmap = __esm({
19175
19168
  }
19176
19169
  });
19177
19170
 
19178
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.interest.js
19171
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.interest.js
19179
19172
  var Interest;
19180
19173
  var init_classes_interestmap_interest = __esm({
19181
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.interest.js"() {
19174
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.interest.js"() {
19182
19175
  init_classes_plugins();
19183
19176
  init_classes_interestmap();
19184
19177
  Interest = class {
@@ -19189,7 +19182,7 @@ var init_classes_interestmap_interest = __esm({
19189
19182
  interestMapRef;
19190
19183
  originalInterest;
19191
19184
  comparisonFunc;
19192
- destructionTimer = new dist_ts_exports8.Timer(1e4);
19185
+ destructionTimer = new dist_ts_exports7.Timer(1e4);
19193
19186
  isFullfilled = false;
19194
19187
  isDestroyed = false;
19195
19188
  /**
@@ -19275,10 +19268,10 @@ var init_classes_interestmap_interest = __esm({
19275
19268
  }
19276
19269
  });
19277
19270
 
19278
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.js
19271
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.js
19279
19272
  var InterestMap;
19280
19273
  var init_classes_interestmap = __esm({
19281
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.js"() {
19274
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.interestmap.js"() {
19282
19275
  init_classes_plugins();
19283
19276
  init_classes_objectmap();
19284
19277
  init_classes_interestmap_interest();
@@ -19295,6 +19288,10 @@ var init_classes_interestmap = __esm({
19295
19288
  * O(1) lookup of interests by their comparison string
19296
19289
  */
19297
19290
  interestsByComparisonString = /* @__PURE__ */ new Map();
19291
+ /**
19292
+ * preserves the comparison string used when an interest was inserted
19293
+ */
19294
+ comparisonStringsByInterest = /* @__PURE__ */ new WeakMap();
19298
19295
  /**
19299
19296
  * a function to compare interests
19300
19297
  */
@@ -19320,6 +19317,7 @@ var init_classes_interestmap = __esm({
19320
19317
  defaultFullfillment: defaultFullfillmentArg
19321
19318
  });
19322
19319
  this.interestObjectMap.add(returnInterest);
19320
+ this.comparisonStringsByInterest.set(returnInterest, comparisonString);
19323
19321
  this.interestsByComparisonString.set(comparisonString, returnInterest);
19324
19322
  }
19325
19323
  this.interestObservable.push(returnInterest);
@@ -19330,10 +19328,14 @@ var init_classes_interestmap = __esm({
19330
19328
  * removes an interest from the interest map
19331
19329
  */
19332
19330
  removeInterest(interestArg) {
19333
- this.interestObjectMap.findOneAndRemoveSync((interestArg2) => {
19334
- return interestArg.comparisonString === interestArg2.comparisonString;
19335
- });
19336
- this.interestsByComparisonString.delete(interestArg.comparisonString);
19331
+ if (!this.comparisonStringsByInterest.has(interestArg))
19332
+ return;
19333
+ const comparisonString = this.comparisonStringsByInterest.get(interestArg);
19334
+ this.interestObjectMap.remove(interestArg);
19335
+ this.comparisonStringsByInterest.delete(interestArg);
19336
+ if (this.interestsByComparisonString.get(comparisonString) === interestArg) {
19337
+ this.interestsByComparisonString.delete(comparisonString);
19338
+ }
19337
19339
  }
19338
19340
  /**
19339
19341
  * check interest
@@ -19383,10 +19385,10 @@ var init_classes_interestmap = __esm({
19383
19385
  }
19384
19386
  });
19385
19387
 
19386
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.limitedarray.js
19388
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.limitedarray.js
19387
19389
  var LimitedArray;
19388
19390
  var init_classes_limitedarray = __esm({
19389
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.limitedarray.js"() {
19391
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.limitedarray.js"() {
19390
19392
  init_classes_plugins();
19391
19393
  LimitedArray = class {
19392
19394
  static {
@@ -19453,10 +19455,10 @@ var init_classes_limitedarray = __esm({
19453
19455
  }
19454
19456
  });
19455
19457
 
19456
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.looptracker.js
19458
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.looptracker.js
19457
19459
  var LoopTracker;
19458
19460
  var init_classes_looptracker = __esm({
19459
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.looptracker.js"() {
19461
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.looptracker.js"() {
19460
19462
  init_classes_plugins();
19461
19463
  init_classes_objectmap();
19462
19464
  LoopTracker = class {
@@ -19494,10 +19496,10 @@ var init_classes_looptracker = __esm({
19494
19496
  }
19495
19497
  });
19496
19498
 
19497
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.stringmap.js
19499
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.stringmap.js
19498
19500
  var Stringmap;
19499
19501
  var init_classes_stringmap = __esm({
19500
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.stringmap.js"() {
19502
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.stringmap.js"() {
19501
19503
  init_classes_plugins();
19502
19504
  Stringmap = class {
19503
19505
  static {
@@ -19546,7 +19548,7 @@ var init_classes_stringmap = __esm({
19546
19548
  * checks stringPresence with minimatch
19547
19549
  */
19548
19550
  checkMinimatch(miniMatchStringArg) {
19549
- const smartMatchInstance = new dist_ts_exports6.SmartMatch(miniMatchStringArg);
19551
+ const smartMatchInstance = new dist_ts_exports5.SmartMatch(miniMatchStringArg);
19550
19552
  let foundMatch = false;
19551
19553
  for (const stringItem of this._stringArray) {
19552
19554
  if (smartMatchInstance.match(stringItem)) {
@@ -19610,10 +19612,10 @@ var init_classes_stringmap = __esm({
19610
19612
  }
19611
19613
  });
19612
19614
 
19613
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.timedaggregator.js
19615
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.timedaggregator.js
19614
19616
  var TimedAggregtor;
19615
19617
  var init_classes_timedaggregator = __esm({
19616
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.timedaggregator.js"() {
19618
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.timedaggregator.js"() {
19617
19619
  init_classes_plugins();
19618
19620
  TimedAggregtor = class {
19619
19621
  static {
@@ -19631,7 +19633,7 @@ var init_classes_timedaggregator = __esm({
19631
19633
  return;
19632
19634
  }
19633
19635
  const addAggregationTimer = /* @__PURE__ */ __name(() => {
19634
- this.aggregationTimer = new dist_ts_exports8.Timer(this.options.aggregationIntervalInMillis);
19636
+ this.aggregationTimer = new dist_ts_exports7.Timer(this.options.aggregationIntervalInMillis);
19635
19637
  this.aggregationTimer.completed.then(() => {
19636
19638
  if (this.isStopped) {
19637
19639
  this.aggregationTimer = null;
@@ -19684,10 +19686,10 @@ var init_classes_timedaggregator = __esm({
19684
19686
  }
19685
19687
  });
19686
19688
 
19687
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.tree.js
19689
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.tree.js
19688
19690
  var Tree;
19689
19691
  var init_classes_tree = __esm({
19690
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/classes.tree.js"() {
19692
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/classes.tree.js"() {
19691
19693
  init_classes_plugins();
19692
19694
  Tree = class {
19693
19695
  static {
@@ -19824,9 +19826,9 @@ var init_classes_tree = __esm({
19824
19826
  }
19825
19827
  });
19826
19828
 
19827
- // node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/index.js
19828
- var dist_ts_exports7 = {};
19829
- __export(dist_ts_exports7, {
19829
+ // node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/index.js
19830
+ var dist_ts_exports6 = {};
19831
+ __export(dist_ts_exports6, {
19830
19832
  AsyncExecutionStack: () => AsyncExecutionStack,
19831
19833
  BackpressuredArray: () => BackpressuredArray,
19832
19834
  FastMap: () => FastMap,
@@ -19841,8 +19843,8 @@ __export(dist_ts_exports7, {
19841
19843
  Tree: () => Tree,
19842
19844
  uni: () => uni
19843
19845
  });
19844
- var init_dist_ts8 = __esm({
19845
- "node_modules/.pnpm/@push.rocks+lik@6.4.1/node_modules/@push.rocks/lik/dist_ts/index.js"() {
19846
+ var init_dist_ts7 = __esm({
19847
+ "node_modules/.pnpm/@push.rocks+lik@6.4.2/node_modules/@push.rocks/lik/dist_ts/index.js"() {
19846
19848
  init_classes_asyncexecutionstack();
19847
19849
  init_classes_backpressuredarray();
19848
19850
  init_classes_fastmap();
@@ -20146,8 +20148,8 @@ var init_smartbuffer_plugins = __esm({
20146
20148
  });
20147
20149
 
20148
20150
  // node_modules/.pnpm/@push.rocks+smartbuffer@3.0.6/node_modules/@push.rocks/smartbuffer/dist_ts/index.js
20149
- var dist_ts_exports9 = {};
20150
- __export(dist_ts_exports9, {
20151
+ var dist_ts_exports8 = {};
20152
+ __export(dist_ts_exports8, {
20151
20153
  base64ToUint8Array: () => base64ToUint8Array2,
20152
20154
  ensurePureUint8Array: () => ensurePureUint8Array,
20153
20155
  isBufferLike: () => isBufferLike,
@@ -20176,7 +20178,7 @@ function ensurePureUint8Array(bufferArg) {
20176
20178
  return uint8Array;
20177
20179
  }
20178
20180
  var uInt8ArrayExtras, isUint8Array2;
20179
- var init_dist_ts9 = __esm({
20181
+ var init_dist_ts8 = __esm({
20180
20182
  "node_modules/.pnpm/@push.rocks+smartbuffer@3.0.6/node_modules/@push.rocks/smartbuffer/dist_ts/index.js"() {
20181
20183
  init_smartbuffer_plugins();
20182
20184
  uInt8ArrayExtras = uint8array_extras_exports;
@@ -20327,15 +20329,15 @@ var init_classes_guardset = __esm({
20327
20329
  });
20328
20330
 
20329
20331
  // node_modules/.pnpm/@push.rocks+smartguard@3.1.2/node_modules/@push.rocks/smartguard/dist_ts/index.js
20330
- var dist_ts_exports10 = {};
20331
- __export(dist_ts_exports10, {
20332
+ var dist_ts_exports9 = {};
20333
+ __export(dist_ts_exports9, {
20332
20334
  Guard: () => Guard,
20333
20335
  GuardError: () => GuardError,
20334
20336
  GuardSet: () => GuardSet,
20335
20337
  passGuardsOrReject: () => passGuardsOrReject
20336
20338
  });
20337
20339
  var passGuardsOrReject;
20338
- var init_dist_ts10 = __esm({
20340
+ var init_dist_ts9 = __esm({
20339
20341
  "node_modules/.pnpm/@push.rocks+smartguard@3.1.2/node_modules/@push.rocks/smartguard/dist_ts/index.js"() {
20340
20342
  init_smartguard_plugins();
20341
20343
  init_classes_guard();
@@ -20358,10 +20360,10 @@ ${failedHint}
20358
20360
  }
20359
20361
  });
20360
20362
 
20361
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/interceptors/interceptor.manager.js
20363
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/interceptors/interceptor.manager.js
20362
20364
  var InterceptorManager;
20363
20365
  var init_interceptor_manager = __esm({
20364
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/interceptors/interceptor.manager.js"() {
20366
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/interceptors/interceptor.manager.js"() {
20365
20367
  InterceptorManager = class {
20366
20368
  static {
20367
20369
  __name(this, "InterceptorManager");
@@ -20700,11 +20702,11 @@ var init_smartenv_classes_smartenv = __esm({
20700
20702
  });
20701
20703
 
20702
20704
  // node_modules/.pnpm/@push.rocks+smartenv@6.1.0/node_modules/@push.rocks/smartenv/dist_ts/index.js
20703
- var dist_ts_exports11 = {};
20704
- __export(dist_ts_exports11, {
20705
+ var dist_ts_exports10 = {};
20706
+ __export(dist_ts_exports10, {
20705
20707
  Smartenv: () => Smartenv
20706
20708
  });
20707
- var init_dist_ts11 = __esm({
20709
+ var init_dist_ts10 = __esm({
20708
20710
  "node_modules/.pnpm/@push.rocks+smartenv@6.1.0/node_modules/@push.rocks/smartenv/dist_ts/index.js"() {
20709
20711
  init_smartenv_classes_smartenv();
20710
20712
  }
@@ -21227,8 +21229,8 @@ var init_smartstring_git = __esm({
21227
21229
  });
21228
21230
 
21229
21231
  // node_modules/.pnpm/@push.rocks+smartstring@4.1.1/node_modules/@push.rocks/smartstring/dist_ts/index.js
21230
- var dist_ts_exports12 = {};
21231
- __export(dist_ts_exports12, {
21232
+ var dist_ts_exports11 = {};
21233
+ __export(dist_ts_exports11, {
21232
21234
  Base64: () => Base64,
21233
21235
  Domain: () => Domain,
21234
21236
  GitRepo: () => GitRepo,
@@ -21239,7 +21241,7 @@ __export(dist_ts_exports12, {
21239
21241
  normalize: () => smartstring_normalize_exports,
21240
21242
  type: () => smartstring_type_exports
21241
21243
  });
21242
- var init_dist_ts12 = __esm({
21244
+ var init_dist_ts11 = __esm({
21243
21245
  "node_modules/.pnpm/@push.rocks+smartstring@4.1.1/node_modules/@push.rocks/smartstring/dist_ts/index.js"() {
21244
21246
  init_smartstring_create();
21245
21247
  init_smartstring_docker();
@@ -21312,8 +21314,8 @@ var require_fast_json_stable_stringify = __commonJS({
21312
21314
  var import_fast_json_stable_stringify, stableJson;
21313
21315
  var init_smartjson_plugins = __esm({
21314
21316
  "node_modules/.pnpm/@push.rocks+smartjson@6.0.1/node_modules/@push.rocks/smartjson/dist_ts/smartjson.plugins.js"() {
21317
+ init_dist_ts10();
21315
21318
  init_dist_ts11();
21316
- init_dist_ts12();
21317
21319
  import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify(), 1);
21318
21320
  stableJson = import_fast_json_stable_stringify.default;
21319
21321
  }
@@ -21404,8 +21406,8 @@ var init_bufferhandling = __esm({
21404
21406
  });
21405
21407
 
21406
21408
  // node_modules/.pnpm/@push.rocks+smartjson@6.0.1/node_modules/@push.rocks/smartjson/dist_ts/index.js
21407
- var dist_ts_exports13 = {};
21408
- __export(dist_ts_exports13, {
21409
+ var dist_ts_exports12 = {};
21410
+ __export(dist_ts_exports12, {
21409
21411
  Smartjson: () => Smartjson,
21410
21412
  deepEqualJsonLStrings: () => deepEqualJsonLStrings,
21411
21413
  deepEqualObjects: () => deepEqualObjects,
@@ -21420,7 +21422,7 @@ __export(dist_ts_exports13, {
21420
21422
  stringifyPretty: () => stringifyPretty
21421
21423
  });
21422
21424
  var parse3, parseJsonL, stringifyJsonL, stableOneWayStringify, stringify2, stringifyPretty, stringifyBase64, parseBase64, Smartjson, foldDec, deepEqualObjects, deepEqualJsonLStrings;
21423
- var init_dist_ts13 = __esm({
21425
+ var init_dist_ts12 = __esm({
21424
21426
  "node_modules/.pnpm/@push.rocks+smartjson@6.0.1/node_modules/@push.rocks/smartjson/dist_ts/index.js"() {
21425
21427
  init_smartjson_plugins();
21426
21428
  init_bufferhandling();
@@ -21509,10 +21511,10 @@ var init_dist_ts13 = __esm({
21509
21511
  }, "stringifyPretty");
21510
21512
  stringifyBase64 = /* @__PURE__ */ __name((...args) => {
21511
21513
  const stringifiedResult = stringify2(...args);
21512
- return dist_ts_exports12.base64.encodeUri(stringifiedResult);
21514
+ return dist_ts_exports11.base64.encodeUri(stringifiedResult);
21513
21515
  }, "stringifyBase64");
21514
21516
  parseBase64 = /* @__PURE__ */ __name((base64JsonStringArg) => {
21515
- const base642 = dist_ts_exports12.base64;
21517
+ const base642 = dist_ts_exports11.base64;
21516
21518
  const decodeFn = base642.decodeUri || base642.decode;
21517
21519
  const simpleStringified = decodeFn(base64JsonStringArg);
21518
21520
  return parse3(simpleStringified);
@@ -21609,15 +21611,22 @@ var init_dist_ts13 = __esm({
21609
21611
  }
21610
21612
  });
21611
21613
 
21614
+ // node_modules/.pnpm/@api.global+typedrequest-interfaces@3.0.19/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js
21615
+ var dist_ts_exports13 = {};
21616
+ var init_dist_ts13 = __esm({
21617
+ "node_modules/.pnpm/@api.global+typedrequest-interfaces@3.0.19/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js"() {
21618
+ }
21619
+ });
21620
+
21612
21621
  // node_modules/.pnpm/@push.rocks+webstore@2.2.0/node_modules/@push.rocks/webstore/dist_ts/webstore.plugins.js
21613
21622
  var init_webstore_plugins = __esm({
21614
21623
  "node_modules/.pnpm/@push.rocks+webstore@2.2.0/node_modules/@push.rocks/webstore/dist_ts/webstore.plugins.js"() {
21615
- init_dist_ts8();
21616
- init_dist_ts11();
21617
- init_dist_ts13();
21624
+ init_dist_ts7();
21625
+ init_dist_ts10();
21626
+ init_dist_ts12();
21618
21627
  init_dist_ts();
21619
21628
  init_dist_ts2();
21620
- init_dist_ts4();
21629
+ init_dist_ts13();
21621
21630
  }
21622
21631
  });
21623
21632
 
@@ -21830,7 +21839,7 @@ var init_webstore_classes_webstore = __esm({
21830
21839
  return awaitWithSignal(this.initPromise, signalArg);
21831
21840
  }
21832
21841
  async runInit() {
21833
- const smartenv = new dist_ts_exports11.Smartenv();
21842
+ const smartenv = new dist_ts_exports10.Smartenv();
21834
21843
  if (!smartenv.isBrowser && !globalThis.indexedDB) {
21835
21844
  await smartenv.getSafeNodeModule("fake-indexeddb/auto");
21836
21845
  if (!globalThis.indexedDB) {
@@ -21939,7 +21948,7 @@ var init_webstore_classes_typedrequestcache = __esm({
21939
21948
  });
21940
21949
  }
21941
21950
  buildKey(requestArg) {
21942
- return dist_ts_exports13.stringify({
21951
+ return dist_ts_exports12.stringify({
21943
21952
  method: requestArg.method,
21944
21953
  request: requestArg.request
21945
21954
  });
@@ -21979,21 +21988,21 @@ var init_dist_ts14 = __esm({
21979
21988
  }
21980
21989
  });
21981
21990
 
21982
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/webrequest.plugins.js
21991
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/webrequest.plugins.js
21983
21992
  var init_webrequest_plugins = __esm({
21984
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/webrequest.plugins.js"() {
21993
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/webrequest.plugins.js"() {
21985
21994
  init_dist_ts3();
21986
- init_dist_ts11();
21987
- init_dist_ts13();
21995
+ init_dist_ts10();
21996
+ init_dist_ts12();
21988
21997
  init_dist_ts();
21989
21998
  init_dist_ts14();
21990
21999
  }
21991
22000
  });
21992
22001
 
21993
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.store.js
22002
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.store.js
21994
22003
  var defaultCacheMaxEntries, CacheStore, awaitWithSignal2;
21995
22004
  var init_cache_store = __esm({
21996
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.store.js"() {
22005
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.store.js"() {
21997
22006
  init_webrequest_plugins();
21998
22007
  defaultCacheMaxEntries = 256;
21999
22008
  CacheStore = class {
@@ -22391,7 +22400,7 @@ var init_cache_store = __esm({
22391
22400
  }
22392
22401
  });
22393
22402
 
22394
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.headers.js
22403
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.headers.js
22395
22404
  function parseCacheControl(cacheControlHeader) {
22396
22405
  const metadata = {
22397
22406
  maxAge: 0,
@@ -22497,7 +22506,7 @@ function objectToHeaders(obj) {
22497
22506
  return headers;
22498
22507
  }
22499
22508
  var init_cache_headers = __esm({
22500
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.headers.js"() {
22509
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.headers.js"() {
22501
22510
  __name(parseCacheControl, "parseCacheControl");
22502
22511
  __name(parseExpires, "parseExpires");
22503
22512
  __name(extractCacheMetadata, "extractCacheMetadata");
@@ -22509,7 +22518,7 @@ var init_cache_headers = __esm({
22509
22518
  }
22510
22519
  });
22511
22520
 
22512
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/utils/timeout.js
22521
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/utils/timeout.js
22513
22522
  function createTimeoutController(timeoutMs) {
22514
22523
  const controller = new AbortController();
22515
22524
  let timeoutTriggered = false;
@@ -22645,7 +22654,7 @@ async function consumeJsonWithTimeout(response, options2) {
22645
22654
  }
22646
22655
  var timeoutErrorMarker, createTimeoutError, isWebrequestTimeoutError, normalizeAbortReason;
22647
22656
  var init_timeout2 = __esm({
22648
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/utils/timeout.js"() {
22657
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/utils/timeout.js"() {
22649
22658
  init_webrequest_plugins();
22650
22659
  __name(createTimeoutController, "createTimeoutController");
22651
22660
  timeoutErrorMarker = /* @__PURE__ */ Symbol("webrequestTimeoutError");
@@ -22673,7 +22682,7 @@ var init_timeout2 = __esm({
22673
22682
  }
22674
22683
  });
22675
22684
 
22676
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.strategies.js
22685
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.strategies.js
22677
22686
  function getStrategyHandler(strategy) {
22678
22687
  switch (strategy) {
22679
22688
  case "network-first":
@@ -22692,7 +22701,7 @@ function getStrategyHandler(strategy) {
22692
22701
  }
22693
22702
  var NetworkFirstStrategy, CacheFirstStrategy, StaleWhileRevalidateStrategy, NetworkOnlyStrategy, CacheOnlyStrategy, resolveEffectiveMaxAge, isFreshForContext, cancelDiscardedResponse;
22694
22703
  var init_cache_strategies = __esm({
22695
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.strategies.js"() {
22704
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.strategies.js"() {
22696
22705
  init_cache_store();
22697
22706
  init_cache_headers();
22698
22707
  init_timeout2();
@@ -23013,10 +23022,10 @@ var init_cache_strategies = __esm({
23013
23022
  }
23014
23023
  });
23015
23024
 
23016
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.manager.js
23025
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.manager.js
23017
23026
  var CacheManager;
23018
23027
  var init_cache_manager = __esm({
23019
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.manager.js"() {
23028
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/cache/cache.manager.js"() {
23020
23029
  init_cache_store();
23021
23030
  init_cache_strategies();
23022
23031
  init_cache_store();
@@ -23202,7 +23211,7 @@ var init_cache_manager = __esm({
23202
23211
  }
23203
23212
  });
23204
23213
 
23205
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.strategies.js
23214
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.strategies.js
23206
23215
  function getBackoffCalculator(strategy) {
23207
23216
  switch (strategy) {
23208
23217
  case "exponential":
@@ -23221,7 +23230,7 @@ function addJitter(delay3, jitterFactor = 0.1) {
23221
23230
  }
23222
23231
  var ExponentialBackoff, LinearBackoff, ConstantBackoff;
23223
23232
  var init_retry_strategies = __esm({
23224
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.strategies.js"() {
23233
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.strategies.js"() {
23225
23234
  ExponentialBackoff = class {
23226
23235
  static {
23227
23236
  __name(this, "ExponentialBackoff");
@@ -23253,10 +23262,10 @@ var init_retry_strategies = __esm({
23253
23262
  }
23254
23263
  });
23255
23264
 
23256
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.manager.js
23265
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.manager.js
23257
23266
  var RetryManager;
23258
23267
  var init_retry_manager = __esm({
23259
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.manager.js"() {
23268
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/retry/retry.manager.js"() {
23260
23269
  init_webrequest_plugins();
23261
23270
  init_retry_strategies();
23262
23271
  RetryManager = class {
@@ -23435,10 +23444,10 @@ var init_retry_manager = __esm({
23435
23444
  }
23436
23445
  });
23437
23446
 
23438
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/utils/deduplicator.js
23447
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/utils/deduplicator.js
23439
23448
  var RequestDeduplicator;
23440
23449
  var init_deduplicator = __esm({
23441
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/utils/deduplicator.js"() {
23450
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/utils/deduplicator.js"() {
23442
23451
  init_webrequest_plugins();
23443
23452
  RequestDeduplicator = class {
23444
23453
  static {
@@ -23466,7 +23475,7 @@ var init_deduplicator = __esm({
23466
23475
  if (existingDeferred) {
23467
23476
  const response = await existingDeferred.promise;
23468
23477
  return {
23469
- response: response.clone(),
23478
+ response: this.cloneValue(response),
23470
23479
  wasDeduplicated: true
23471
23480
  };
23472
23481
  }
@@ -23504,14 +23513,23 @@ var init_deduplicator = __esm({
23504
23513
  clear() {
23505
23514
  this.inFlightRequests.clear();
23506
23515
  }
23516
+ cloneValue(valueArg) {
23517
+ if (valueArg instanceof Response) {
23518
+ return valueArg.clone();
23519
+ }
23520
+ return {
23521
+ ...valueArg,
23522
+ response: valueArg.response.clone()
23523
+ };
23524
+ }
23507
23525
  };
23508
23526
  }
23509
23527
  });
23510
23528
 
23511
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/webrequest.client.js
23512
- var WebrequestClient;
23529
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/webrequest.client.js
23530
+ var WebrequestClient, createResponseResult;
23513
23531
  var init_webrequest_client = __esm({
23514
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/webrequest.client.js"() {
23532
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/webrequest.client.js"() {
23515
23533
  init_interceptor_manager();
23516
23534
  init_cache_manager();
23517
23535
  init_retry_manager();
@@ -23587,6 +23605,13 @@ var init_webrequest_client = __esm({
23587
23605
  * Execute a request with all configured features
23588
23606
  */
23589
23607
  async request(url, options2 = {}) {
23608
+ return (await this.requestWithMetadata(url, options2)).response;
23609
+ }
23610
+ /**
23611
+ * Execute a request and return trusted cache-origin metadata separately from
23612
+ * the response headers.
23613
+ */
23614
+ async requestWithMetadata(url, options2 = {}) {
23590
23615
  if (this.disposed) {
23591
23616
  throw this.closeReason;
23592
23617
  }
@@ -23624,50 +23649,56 @@ var init_webrequest_client = __esm({
23624
23649
  const retryOptions = typeof options2.retry === "object" ? options2.retry : options2.retry ? {} : void 0;
23625
23650
  const fetchFnForRequest = /* @__PURE__ */ __name(async (req) => {
23626
23651
  const timeout2 = options2.timeout ?? 6e4;
23627
- const requestInit = {
23628
- ...options2,
23629
- method: req.method,
23630
- headers: req.headers,
23631
- signal: req.signal
23632
- };
23633
- if (req.body) {
23634
- requestInit.body = req.body;
23635
- requestInit.duplex = "half";
23636
- }
23637
- return await fetchWithTimeout(req.url, requestInit, timeout2);
23652
+ const requestInit = { ...options2 };
23653
+ delete requestInit.body;
23654
+ delete requestInit.headers;
23655
+ delete requestInit.method;
23656
+ delete requestInit.signal;
23657
+ return await fetchWithTimeout(req, { ...requestInit, signal: req.signal }, timeout2);
23638
23658
  }, "fetchFnForRequest");
23639
23659
  const fetchFnForFallbacks = /* @__PURE__ */ __name(async (url, init2) => {
23640
23660
  const timeout2 = options2.timeout ?? 6e4;
23641
23661
  return await fetchWithTimeout(url, init2, timeout2);
23642
23662
  }, "fetchFnForFallbacks");
23643
- let response;
23663
+ let strategyResult;
23644
23664
  if (retryOptions) {
23645
23665
  const retryManager = new RetryManager(retryOptions, options2.signal);
23646
23666
  if (options2.fallbackUrls && options2.fallbackUrls.length > 0) {
23647
23667
  const allUrls = [request.url, ...options2.fallbackUrls];
23648
- response = await retryManager.executeWithFallbacks(allUrls, {
23668
+ const response2 = await retryManager.executeWithFallbacks(allUrls, {
23649
23669
  method: request.method,
23650
23670
  headers: request.headers,
23651
23671
  body: request.body,
23652
23672
  ...options2
23653
23673
  }, fetchFnForFallbacks);
23674
+ strategyResult = {
23675
+ response: response2,
23676
+ fromCache: false,
23677
+ revalidated: false
23678
+ };
23654
23679
  } else {
23655
- response = await retryManager.execute(async () => {
23680
+ let latestResult;
23681
+ const response2 = await retryManager.execute(async () => {
23656
23682
  const result = await this.cacheManager.execute(request, options2, fetchFnForRequest);
23683
+ latestResult = result;
23657
23684
  return result.response;
23658
23685
  });
23686
+ strategyResult = latestResult?.response === response2 ? latestResult : {
23687
+ response: response2,
23688
+ fromCache: false,
23689
+ revalidated: false
23690
+ };
23659
23691
  }
23660
23692
  } else {
23661
- const result = await this.cacheManager.execute(request, options2, fetchFnForRequest);
23662
- response = result.response;
23693
+ strategyResult = await this.cacheManager.execute(request, options2, fetchFnForRequest);
23663
23694
  }
23664
- response = await this.interceptorManager.processResponse(response);
23695
+ let response = await this.interceptorManager.processResponse(strategyResult.response);
23665
23696
  if (options2.interceptors?.response) {
23666
23697
  for (const interceptor of options2.interceptors.response) {
23667
23698
  response = await interceptor(response);
23668
23699
  }
23669
23700
  }
23670
- return response;
23701
+ return createResponseResult(response, strategyResult);
23671
23702
  } catch (error) {
23672
23703
  const processedError = await this.interceptorManager.processError(error instanceof Error ? error : new Error(String(error)));
23673
23704
  throw processedError;
@@ -23689,7 +23720,7 @@ var init_webrequest_client = __esm({
23689
23720
  * deadline across headers and body. Retry-enabled requests preserve the
23690
23721
  * existing per-attempt timeout and apply the same budget to the final body.
23691
23722
  */
23692
- async requestJson(url, options2) {
23723
+ async requestJsonWithMetadata(url, options2) {
23693
23724
  const effectiveOptions = {
23694
23725
  ...this.defaultOptions,
23695
23726
  ...options2
@@ -23705,10 +23736,11 @@ var init_webrequest_client = __esm({
23705
23736
  callWideController.abort(createTimeoutError(url, timeoutMs));
23706
23737
  }, Math.max(0, timeoutMs));
23707
23738
  try {
23708
- const response = await this.request(url, {
23739
+ const result = await this.requestWithMetadata(url, {
23709
23740
  ...options2,
23710
23741
  signal: requestSignal
23711
23742
  });
23743
+ const response = result.response;
23712
23744
  if (requestSignal?.aborted) {
23713
23745
  await response.body?.cancel(requestSignal.reason).catch(() => void 0);
23714
23746
  throw requestSignal.reason instanceof Error ? requestSignal.reason : new Error("The request was aborted");
@@ -23718,12 +23750,17 @@ var init_webrequest_client = __esm({
23718
23750
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
23719
23751
  }
23720
23752
  const bodyTimeoutMs = callWideDeadline === void 0 ? timeoutMs : callWideDeadline - performance.now();
23721
- return await consumeJsonWithTimeout(response, {
23753
+ const data = await consumeJsonWithTimeout(response, {
23722
23754
  bodyTimeoutMs,
23723
23755
  reportedTimeoutMs: timeoutMs,
23724
23756
  signal: requestSignal,
23725
23757
  url
23726
23758
  });
23759
+ return Object.freeze({
23760
+ data,
23761
+ response,
23762
+ metadata: result.metadata
23763
+ });
23727
23764
  } catch (error) {
23728
23765
  if (requestSignal?.aborted && requestSignal.reason instanceof Error) {
23729
23766
  throw requestSignal.reason;
@@ -23739,7 +23776,13 @@ var init_webrequest_client = __esm({
23739
23776
  * Convenience method: GET request returning JSON
23740
23777
  */
23741
23778
  async getJson(url, options2 = {}) {
23742
- return await this.requestJson(url, {
23779
+ return (await this.getJsonWithMetadata(url, options2)).data;
23780
+ }
23781
+ /**
23782
+ * Convenience method: GET request returning JSON and response metadata
23783
+ */
23784
+ async getJsonWithMetadata(url, options2 = {}) {
23785
+ return await this.requestJsonWithMetadata(url, {
23743
23786
  ...options2,
23744
23787
  method: "GET",
23745
23788
  headers: {
@@ -23752,7 +23795,13 @@ var init_webrequest_client = __esm({
23752
23795
  * Convenience method: POST request with JSON body
23753
23796
  */
23754
23797
  async postJson(url, data, options2 = {}) {
23755
- return await this.requestJson(url, {
23798
+ return (await this.postJsonWithMetadata(url, data, options2)).data;
23799
+ }
23800
+ /**
23801
+ * Convenience method: POST request with JSON body and response metadata
23802
+ */
23803
+ async postJsonWithMetadata(url, data, options2 = {}) {
23804
+ return await this.requestJsonWithMetadata(url, {
23756
23805
  ...options2,
23757
23806
  method: "POST",
23758
23807
  headers: {
@@ -23767,7 +23816,13 @@ var init_webrequest_client = __esm({
23767
23816
  * Convenience method: PUT request with JSON body
23768
23817
  */
23769
23818
  async putJson(url, data, options2 = {}) {
23770
- return await this.requestJson(url, {
23819
+ return (await this.putJsonWithMetadata(url, data, options2)).data;
23820
+ }
23821
+ /**
23822
+ * Convenience method: PUT request with JSON body and response metadata
23823
+ */
23824
+ async putJsonWithMetadata(url, data, options2 = {}) {
23825
+ return await this.requestJsonWithMetadata(url, {
23771
23826
  ...options2,
23772
23827
  method: "PUT",
23773
23828
  headers: {
@@ -23782,7 +23837,13 @@ var init_webrequest_client = __esm({
23782
23837
  * Convenience method: DELETE request
23783
23838
  */
23784
23839
  async deleteJson(url, options2 = {}) {
23785
- return await this.requestJson(url, {
23840
+ return (await this.deleteJsonWithMetadata(url, options2)).data;
23841
+ }
23842
+ /**
23843
+ * Convenience method: DELETE request returning JSON and response metadata
23844
+ */
23845
+ async deleteJsonWithMetadata(url, options2 = {}) {
23846
+ return await this.requestJsonWithMetadata(url, {
23786
23847
  ...options2,
23787
23848
  method: "DELETE",
23788
23849
  headers: {
@@ -23792,10 +23853,20 @@ var init_webrequest_client = __esm({
23792
23853
  });
23793
23854
  }
23794
23855
  };
23856
+ createResponseResult = /* @__PURE__ */ __name((responseArg, strategyResultArg) => {
23857
+ const metadata = Object.freeze({
23858
+ fromCache: strategyResultArg.fromCache,
23859
+ revalidated: strategyResultArg.revalidated
23860
+ });
23861
+ return Object.freeze({
23862
+ response: responseArg,
23863
+ metadata
23864
+ });
23865
+ }, "createResponseResult");
23795
23866
  }
23796
23867
  });
23797
23868
 
23798
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/webrequest.function.js
23869
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/webrequest.function.js
23799
23870
  async function webrequest(input, init2) {
23800
23871
  const url = input instanceof Request ? input.url : String(input);
23801
23872
  const request = input instanceof Request ? input : new Request(url, init2);
@@ -23803,22 +23874,39 @@ async function webrequest(input, init2) {
23803
23874
  }
23804
23875
  var defaultClient;
23805
23876
  var init_webrequest_function = __esm({
23806
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/webrequest.function.js"() {
23877
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/webrequest.function.js"() {
23807
23878
  init_webrequest_client();
23808
23879
  defaultClient = new WebrequestClient();
23809
23880
  __name(webrequest, "webrequest");
23881
+ webrequest.requestWithMetadata = async function(input, init2) {
23882
+ const url = input instanceof Request ? input.url : String(input);
23883
+ const request = input instanceof Request ? input : new Request(url, init2);
23884
+ return await defaultClient.requestWithMetadata(request, init2);
23885
+ };
23810
23886
  webrequest.getJson = async function(url, options2) {
23811
23887
  return await defaultClient.getJson(url, options2);
23812
23888
  };
23889
+ webrequest.getJsonWithMetadata = async function(url, options2) {
23890
+ return await defaultClient.getJsonWithMetadata(url, options2);
23891
+ };
23813
23892
  webrequest.postJson = async function(url, data, options2) {
23814
23893
  return await defaultClient.postJson(url, data, options2);
23815
23894
  };
23895
+ webrequest.postJsonWithMetadata = async function(url, data, options2) {
23896
+ return await defaultClient.postJsonWithMetadata(url, data, options2);
23897
+ };
23816
23898
  webrequest.putJson = async function(url, data, options2) {
23817
23899
  return await defaultClient.putJson(url, data, options2);
23818
23900
  };
23901
+ webrequest.putJsonWithMetadata = async function(url, data, options2) {
23902
+ return await defaultClient.putJsonWithMetadata(url, data, options2);
23903
+ };
23819
23904
  webrequest.deleteJson = async function(url, options2) {
23820
23905
  return await defaultClient.deleteJson(url, options2);
23821
23906
  };
23907
+ webrequest.deleteJsonWithMetadata = async function(url, options2) {
23908
+ return await defaultClient.deleteJsonWithMetadata(url, options2);
23909
+ };
23822
23910
  webrequest.addRequestInterceptor = function(interceptor) {
23823
23911
  defaultClient.addRequestInterceptor(interceptor);
23824
23912
  };
@@ -23843,7 +23931,7 @@ var init_webrequest_function = __esm({
23843
23931
  }
23844
23932
  });
23845
23933
 
23846
- // node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/index.js
23934
+ // node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/index.js
23847
23935
  var dist_ts_exports15 = {};
23848
23936
  __export(dist_ts_exports15, {
23849
23937
  CacheManager: () => CacheManager,
@@ -23863,7 +23951,7 @@ __export(dist_ts_exports15, {
23863
23951
  webrequest: () => webrequest
23864
23952
  });
23865
23953
  var init_dist_ts15 = __esm({
23866
- "node_modules/.pnpm/@push.rocks+webrequest@4.2.0/node_modules/@push.rocks/webrequest/dist_ts/index.js"() {
23954
+ "node_modules/.pnpm/@push.rocks+webrequest@4.3.1/node_modules/@push.rocks/webrequest/dist_ts/index.js"() {
23867
23955
  init_webrequest_function();
23868
23956
  init_webrequest_client();
23869
23957
  init_cache_manager();
@@ -23876,133 +23964,876 @@ var init_dist_ts15 = __esm({
23876
23964
  }
23877
23965
  });
23878
23966
 
23879
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/plugins.js
23967
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/plugins.js
23880
23968
  var isounique2;
23881
23969
  var init_plugins = __esm({
23882
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/plugins.js"() {
23883
- init_dist_ts5();
23970
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/plugins.js"() {
23971
+ init_dist_ts4();
23884
23972
  isounique2 = __toESM(require_dist_ts(), 1);
23973
+ init_dist_ts7();
23885
23974
  init_dist_ts8();
23886
- init_dist_ts9();
23887
23975
  init_dist_ts3();
23888
- init_dist_ts10();
23889
- init_dist_ts();
23976
+ init_dist_ts9();
23890
23977
  init_dist_ts15();
23891
23978
  }
23892
23979
  });
23893
23980
 
23894
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedresponseerror.js
23895
- var TypedResponseError;
23896
- var init_classes_typedresponseerror = __esm({
23897
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedresponseerror.js"() {
23898
- TypedResponseError = class extends Error {
23981
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.virtualstream.js
23982
+ var maximumVirtualStreamOpenTimeoutMs, applicationAuthorizedStreams, activationScopeOwners, authorizeVirtualStreamApplicationUse, VirtualStreamClosedError, VirtualStreamOpenTimeoutError, VirtualStreamLifecycleContractError, VirtualStreamActivationScope, VirtualStream;
23983
+ var init_classes_virtualstream = __esm({
23984
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.virtualstream.js"() {
23985
+ init_plugins();
23986
+ maximumVirtualStreamOpenTimeoutMs = 1e4;
23987
+ applicationAuthorizedStreams = /* @__PURE__ */ new WeakSet();
23988
+ activationScopeOwners = /* @__PURE__ */ new WeakMap();
23989
+ authorizeVirtualStreamApplicationUse = /* @__PURE__ */ __name((streamArg) => {
23990
+ applicationAuthorizedStreams.add(streamArg);
23991
+ }, "authorizeVirtualStreamApplicationUse");
23992
+ VirtualStreamClosedError = class extends Error {
23899
23993
  static {
23900
- __name(this, "TypedResponseError");
23994
+ __name(this, "VirtualStreamClosedError");
23901
23995
  }
23902
- constructor(errorTextArg, errorDataArg) {
23903
- super(errorTextArg);
23904
- this.name = "TypedResponseError";
23905
- this.errorText = errorTextArg;
23906
- this.errorData = errorDataArg ?? {};
23996
+ constructor(messageArg = "VirtualStream is closed", optionsArg) {
23997
+ super(messageArg, optionsArg);
23998
+ this.name = "VirtualStreamClosedError";
23907
23999
  }
23908
24000
  };
23909
- }
23910
- });
23911
-
23912
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedtools.js
23913
- var TypedTools;
23914
- var init_classes_typedtools = __esm({
23915
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedtools.js"() {
23916
- init_classes_typedresponseerror();
23917
- init_plugins();
23918
- TypedTools = class {
24001
+ VirtualStreamOpenTimeoutError = class extends Error {
23919
24002
  static {
23920
- __name(this, "TypedTools");
24003
+ __name(this, "VirtualStreamOpenTimeoutError");
24004
+ }
24005
+ constructor(timeoutMs, deadlineAt) {
24006
+ super(timeoutMs > 0 ? `VirtualStream transport staging timed out after ${timeoutMs}ms` : "VirtualStream transport staging deadline is exhausted");
24007
+ this.timeoutMs = timeoutMs;
24008
+ this.deadlineAt = deadlineAt;
24009
+ this.name = "VirtualStreamOpenTimeoutError";
24010
+ }
24011
+ };
24012
+ VirtualStreamLifecycleContractError = class extends Error {
24013
+ static {
24014
+ __name(this, "VirtualStreamLifecycleContractError");
24015
+ }
24016
+ constructor(terminalKindArg) {
24017
+ super(`VirtualStream endpoint closed before terminal ${terminalKindArg} produced a receipt`);
24018
+ this.name = "VirtualStreamLifecycleContractError";
24019
+ }
24020
+ };
24021
+ VirtualStreamActivationScope = class {
24022
+ static {
24023
+ __name(this, "VirtualStreamActivationScope");
23921
24024
  }
23922
24025
  constructor() {
23923
- this.localData = {};
24026
+ this.trackedStreams = /* @__PURE__ */ new Set();
24027
+ this.hasAuthorizedTrackedStreams = false;
24028
+ this.published = false;
24029
+ this.settled = false;
23924
24030
  }
23925
- async passGuards(guardsArg, dataArg) {
23926
- const guardSet = new dist_ts_exports10.GuardSet(guardsArg);
23927
- const guardResult = await guardSet.allGuardsPass(dataArg);
23928
- if (!guardResult) {
23929
- const failedHint = await guardSet.getFailedHint(dataArg);
23930
- throw new TypedResponseError(`guard failed: ${failedHint}`, { failedHint });
24031
+ track(streamArg) {
24032
+ if (this.settled) {
24033
+ throw new Error("Cannot track a VirtualStream in a settled activation scope");
23931
24034
  }
24035
+ const existingOwner = activationScopeOwners.get(streamArg);
24036
+ if (existingOwner && existingOwner !== this) {
24037
+ throw new Error("VirtualStream is already owned by another activation scope");
24038
+ }
24039
+ if (!existingOwner)
24040
+ activationScopeOwners.set(streamArg, this);
24041
+ this.trackedStreams.add(streamArg);
24042
+ if (this.hasAuthorizedTrackedStreams) {
24043
+ authorizeVirtualStreamApplicationUse(streamArg);
24044
+ }
24045
+ if (this.published)
24046
+ streamArg.publishActivation();
24047
+ }
24048
+ authorizeApplicationUse() {
24049
+ if (this.settled || this.hasAuthorizedTrackedStreams)
24050
+ return;
24051
+ this.hasAuthorizedTrackedStreams = true;
24052
+ for (const stream of this.trackedStreams) {
24053
+ authorizeVirtualStreamApplicationUse(stream);
24054
+ }
24055
+ }
24056
+ publish() {
24057
+ if (this.settled || this.published)
24058
+ return;
24059
+ this.published = true;
24060
+ for (const stream of this.trackedStreams)
24061
+ stream.publishActivation();
24062
+ }
24063
+ commit() {
24064
+ this.publish();
24065
+ this.settled = true;
24066
+ this.trackedStreams.clear();
24067
+ }
24068
+ async rollback(reasonArg) {
24069
+ if (this.settled)
24070
+ return;
24071
+ this.settled = true;
24072
+ const streams = [...this.trackedStreams];
24073
+ this.trackedStreams.clear();
24074
+ await Promise.allSettled(streams.map((streamArg) => streamArg.rollbackActivation(reasonArg)));
23932
24075
  }
23933
24076
  };
23934
- }
23935
- });
23936
-
23937
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedhandler.js
23938
- var TypedHandler;
23939
- var init_classes_typedhandler = __esm({
23940
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedhandler.js"() {
23941
- init_plugins();
23942
- init_classes_typedresponseerror();
23943
- init_classes_typedtools();
23944
- TypedHandler = class _TypedHandler {
24077
+ VirtualStream = class _VirtualStream {
23945
24078
  static {
23946
- __name(this, "TypedHandler");
24079
+ __name(this, "VirtualStream");
23947
24080
  }
23948
24081
  static {
23949
- this.internalErrorMessage = "Internal server error";
24082
+ this.maximumStreamIdLength = 256;
24083
+ }
24084
+ static fromRegistration(optionsArg) {
24085
+ let dispose = optionsArg.registration?.dispose;
24086
+ const disposeOnce = /* @__PURE__ */ __name(() => {
24087
+ const disposeNow = dispose;
24088
+ dispose = void 0;
24089
+ disposeNow?.();
24090
+ }, "disposeOnce");
24091
+ try {
24092
+ _VirtualStream.validateTransport(optionsArg.transport);
24093
+ if (typeof optionsArg.registration?.dispose !== "function") {
24094
+ throw new TypeError("VirtualStream registration requires a synchronous disposer");
24095
+ }
24096
+ _VirtualStream.validateNetworkDescriptor(optionsArg.registration.descriptor);
24097
+ _VirtualStream.validateEndpoint(optionsArg.registration.endpoint, optionsArg.registration.descriptor, optionsArg.registration.descriptor.creatorDirection);
24098
+ return new _VirtualStream({
24099
+ transport: optionsArg.transport,
24100
+ descriptor: optionsArg.registration.descriptor,
24101
+ endpoint: optionsArg.registration.endpoint,
24102
+ registrationDispose: disposeOnce,
24103
+ explicitRegistration: true
24104
+ });
24105
+ } catch (error) {
24106
+ disposeOnce();
24107
+ throw error;
24108
+ }
23950
24109
  }
23951
- constructor(methodArg, handlerFunctionArg) {
23952
- this.method = methodArg;
23953
- this.handlerFunction = handlerFunctionArg;
24110
+ static encodePayloadForNetwork(objectPayloadArg, commFunctionsArg) {
24111
+ const isResponseEnvelope = objectPayloadArg?.correlation?.phase === "response";
24112
+ return _VirtualStream.encodePayloadValue(objectPayloadArg, commFunctionsArg, isResponseEnvelope, false, true, {
24113
+ standard: /* @__PURE__ */ new WeakMap(),
24114
+ omittingResponseRequestStreams: /* @__PURE__ */ new WeakMap()
24115
+ });
23954
24116
  }
23955
- /**
23956
- * adds a response to the typedRequest
23957
- * @param typedRequestArg
23958
- */
23959
- async addResponse(typedRequestArg) {
23960
- if (typedRequestArg.method !== this.method) {
23961
- throw new Error("this handler has been given a wrong method to answer to. Please use a TypedRouter to filter requests");
24117
+ /** @internal */
24118
+ static encodePayloadForNetworkWithMetadata(objectPayloadArg, commFunctionsArg) {
24119
+ const isResponseEnvelope = objectPayloadArg?.correlation?.phase === "response";
24120
+ const encodedPayloadState = {
24121
+ standard: /* @__PURE__ */ new WeakMap(),
24122
+ omittingResponseRequestStreams: /* @__PURE__ */ new WeakMap(),
24123
+ containsNetworkDescriptor: false,
24124
+ requiresNetworkDescriptorScan: false
24125
+ };
24126
+ const payload = _VirtualStream.encodePayloadValue(objectPayloadArg, commFunctionsArg, isResponseEnvelope, false, true, encodedPayloadState);
24127
+ const requiresNetworkDescriptorScan = encodedPayloadState.requiresNetworkDescriptorScan || _VirtualStream.encodedContainerPrototypesMayExposeNetworkDescriptor();
24128
+ return {
24129
+ payload,
24130
+ containsNetworkDescriptor: requiresNetworkDescriptorScan ? _VirtualStream.containsNetworkDescriptor(payload) : encodedPayloadState.containsNetworkDescriptor
24131
+ };
24132
+ }
24133
+ static encodePayloadValue(objectPayloadArg, commFunctionsArg, isResponseEnvelopeArg, omitResponseRequestStreamsArg, isPayloadRootArg, encodedPayloadStateArg) {
24134
+ if (!objectPayloadArg)
24135
+ return objectPayloadArg;
24136
+ if (dist_ts_exports8.isBufferLike(objectPayloadArg))
24137
+ return objectPayloadArg;
24138
+ if (objectPayloadArg instanceof _VirtualStream) {
24139
+ if (omitResponseRequestStreamsArg) {
24140
+ return {
24141
+ _OMITTED_VIRTUAL_STREAM: true,
24142
+ reason: "Streams beneath an echoed response.request are omitted."
24143
+ };
24144
+ }
24145
+ if (encodedPayloadStateArg.containsNetworkDescriptor !== void 0) {
24146
+ encodedPayloadStateArg.containsNetworkDescriptor = true;
24147
+ }
24148
+ return objectPayloadArg.activateForEncoding(commFunctionsArg);
23962
24149
  }
23963
- let typedResponseError;
23964
- const typedtoolsInstance = new TypedTools();
23965
- if (typedRequestArg.localData) {
23966
- typedtoolsInstance.localData = typedRequestArg.localData;
24150
+ const isPassThroughValue = objectPayloadArg instanceof Set || objectPayloadArg instanceof Map || objectPayloadArg instanceof Date || objectPayloadArg instanceof RegExp || objectPayloadArg instanceof Error || objectPayloadArg instanceof Promise || typeof objectPayloadArg.then === "function";
24151
+ if (isPassThroughValue) {
24152
+ if (encodedPayloadStateArg.containsNetworkDescriptor !== void 0 && typeof objectPayloadArg === "object") {
24153
+ encodedPayloadStateArg.requiresNetworkDescriptorScan = true;
24154
+ }
24155
+ return objectPayloadArg;
23967
24156
  }
23968
- const response = await this.handlerFunction(typedRequestArg.request, typedtoolsInstance).catch((e10) => {
23969
- if (e10 instanceof TypedResponseError) {
23970
- typedResponseError = e10;
23971
- } else {
23972
- console.error(`TypedRequest handler '${this.method}' failed`);
23973
- typedResponseError = new TypedResponseError(_TypedHandler.internalErrorMessage);
24157
+ if (typeof objectPayloadArg !== "object")
24158
+ return objectPayloadArg;
24159
+ const encodedObjects = omitResponseRequestStreamsArg ? encodedPayloadStateArg.omittingResponseRequestStreams : encodedPayloadStateArg.standard;
24160
+ const existingEncodedObject = encodedObjects.get(objectPayloadArg);
24161
+ if (existingEncodedObject)
24162
+ return existingEncodedObject;
24163
+ if (Array.isArray(objectPayloadArg)) {
24164
+ const encodedArray = [];
24165
+ encodedObjects.set(objectPayloadArg, encodedArray);
24166
+ for (let index3 = 0; index3 < objectPayloadArg.length; index3++) {
24167
+ encodedArray.push(_VirtualStream.encodePayloadValue(objectPayloadArg[index3], commFunctionsArg, isResponseEnvelopeArg, omitResponseRequestStreamsArg, false, encodedPayloadStateArg));
23974
24168
  }
24169
+ if (encodedPayloadStateArg.containsNetworkDescriptor !== void 0 && Object.getPrototypeOf(encodedArray) !== Array.prototype) {
24170
+ encodedPayloadStateArg.requiresNetworkDescriptorScan = true;
24171
+ }
24172
+ return encodedArray;
24173
+ }
24174
+ const encodedObject = {};
24175
+ encodedObjects.set(objectPayloadArg, encodedObject);
24176
+ for (const key2 of Object.keys(objectPayloadArg)) {
24177
+ const omitNestedResponseRequestStreams = omitResponseRequestStreamsArg || isResponseEnvelopeArg && isPayloadRootArg && key2 === "request";
24178
+ encodedObject[key2] = _VirtualStream.encodePayloadValue(objectPayloadArg[key2], commFunctionsArg, isResponseEnvelopeArg, omitNestedResponseRequestStreams, false, encodedPayloadStateArg);
24179
+ }
24180
+ if (encodedPayloadStateArg.containsNetworkDescriptor !== void 0 && Object.getPrototypeOf(encodedObject) !== Object.prototype) {
24181
+ encodedPayloadStateArg.requiresNetworkDescriptorScan = true;
24182
+ }
24183
+ if (encodedPayloadStateArg.containsNetworkDescriptor !== void 0 && Object.hasOwn(encodedObject, "_isVirtualStream") && encodedObject._isVirtualStream === true) {
24184
+ encodedPayloadStateArg.containsNetworkDescriptor = true;
24185
+ }
24186
+ return encodedObject;
24187
+ }
24188
+ static async decodePayloadFromNetworkAsync(objectPayloadArg, commFunctionsArg) {
24189
+ const decodedStreams = /* @__PURE__ */ new Map();
24190
+ const streamsToOpen = [];
24191
+ const createdStreams = [];
24192
+ const activationScope = commFunctionsArg.activationScope ?? new VirtualStreamActivationScope();
24193
+ const ownsActivationScope = !commFunctionsArg.activationScope;
24194
+ const openDeadlineAt = _VirtualStream.resolveOpenDeadlineAt(commFunctionsArg.openDeadlineAt);
24195
+ try {
24196
+ const decodedPayload = _VirtualStream.preparePayloadFromNetwork(objectPayloadArg, { ...commFunctionsArg, activationScope }, decodedStreams, streamsToOpen, createdStreams, /* @__PURE__ */ new WeakMap());
24197
+ if (streamsToOpen.length > 0) {
24198
+ const transport = commFunctionsArg.virtualStreamTransport;
24199
+ if (!transport) {
24200
+ throw new Error("VirtualStream descriptor requires a virtual stream transport");
24201
+ }
24202
+ _VirtualStream.validateTransport(transport);
24203
+ for (const streamToOpen of streamsToOpen) {
24204
+ const openTimeoutMs = _VirtualStream.getRemainingOpenTimeoutMs(openDeadlineAt);
24205
+ const endpoint = await _VirtualStream.openVirtualStreamWithTimeout(transport, streamToOpen.descriptor, openTimeoutMs, openDeadlineAt, commFunctionsArg.abortSignal);
24206
+ streamToOpen.stream.bindOpenedEndpoint(endpoint);
24207
+ }
24208
+ }
24209
+ if (ownsActivationScope) {
24210
+ activationScope.authorizeApplicationUse();
24211
+ activationScope.commit();
24212
+ }
24213
+ return decodedPayload;
24214
+ } catch (error) {
24215
+ await Promise.allSettled(createdStreams.map((streamArg) => streamArg.rollbackActivation(error)));
24216
+ throw error;
24217
+ }
24218
+ }
24219
+ static containsNetworkDescriptor(objectPayloadArg, checkedObjectsArg = /* @__PURE__ */ new WeakSet()) {
24220
+ if (!objectPayloadArg || dist_ts_exports8.isBufferLike(objectPayloadArg) || typeof objectPayloadArg !== "object") {
24221
+ return false;
24222
+ }
24223
+ if (objectPayloadArg._isVirtualStream === true)
24224
+ return true;
24225
+ if (checkedObjectsArg.has(objectPayloadArg))
24226
+ return false;
24227
+ checkedObjectsArg.add(objectPayloadArg);
24228
+ if (Array.isArray(objectPayloadArg)) {
24229
+ return objectPayloadArg.some((itemArg) => _VirtualStream.containsNetworkDescriptor(itemArg, checkedObjectsArg));
24230
+ }
24231
+ if (objectPayloadArg instanceof Set || objectPayloadArg instanceof Map || objectPayloadArg instanceof Date || objectPayloadArg instanceof RegExp || objectPayloadArg instanceof Error || objectPayloadArg instanceof Promise || typeof objectPayloadArg.then === "function") {
24232
+ return false;
24233
+ }
24234
+ return Object.values(objectPayloadArg).some((valueArg) => _VirtualStream.containsNetworkDescriptor(valueArg, checkedObjectsArg));
24235
+ }
24236
+ static encodedContainerPrototypesMayExposeNetworkDescriptor() {
24237
+ return Object.getPrototypeOf(Object.prototype) !== null || Object.getPrototypeOf(Array.prototype) !== Object.prototype || Object.getOwnPropertyDescriptor(Object.prototype, "_isVirtualStream") !== void 0 || Object.getOwnPropertyDescriptor(Array.prototype, "_isVirtualStream") !== void 0;
24238
+ }
24239
+ static preparePayloadFromNetwork(objectPayloadArg, commFunctionsArg, decodedStreamsArg, streamsToOpenArg, createdStreamsArg, decodedObjectsArg) {
24240
+ if (dist_ts_exports8.isBufferLike(objectPayloadArg) || objectPayloadArg === null || typeof objectPayloadArg !== "object") {
24241
+ return objectPayloadArg;
24242
+ }
24243
+ if (objectPayloadArg instanceof Set || objectPayloadArg instanceof Map || objectPayloadArg instanceof Date || objectPayloadArg instanceof RegExp || objectPayloadArg instanceof Error || objectPayloadArg instanceof Promise || typeof objectPayloadArg.then === "function") {
24244
+ return objectPayloadArg;
24245
+ }
24246
+ if (objectPayloadArg._isVirtualStream === true) {
24247
+ _VirtualStream.validateNetworkDescriptor(objectPayloadArg);
24248
+ const descriptor = objectPayloadArg;
24249
+ const decodedStream = decodedStreamsArg.get(descriptor.streamId);
24250
+ if (decodedStream) {
24251
+ if (!_VirtualStream.descriptorMetadataMatches(decodedStream.descriptor, descriptor)) {
24252
+ throw new TypeError(`Conflicting VirtualStream metadata for streamId "${descriptor.streamId}"`);
24253
+ }
24254
+ return decodedStream.stream;
24255
+ }
24256
+ const transport = commFunctionsArg.virtualStreamTransport;
24257
+ const virtualStream = new _VirtualStream({
24258
+ transport,
24259
+ descriptor,
24260
+ explicitRegistration: false
24261
+ });
24262
+ decodedStreamsArg.set(descriptor.streamId, {
24263
+ stream: virtualStream,
24264
+ descriptor
24265
+ });
24266
+ streamsToOpenArg.push({ stream: virtualStream, descriptor });
24267
+ createdStreamsArg.push(virtualStream);
24268
+ commFunctionsArg.activationScope?.track(virtualStream);
24269
+ return virtualStream;
24270
+ }
24271
+ const existingDecodedObject = decodedObjectsArg.get(objectPayloadArg);
24272
+ if (existingDecodedObject)
24273
+ return existingDecodedObject;
24274
+ if (Array.isArray(objectPayloadArg)) {
24275
+ const decodedArray = [];
24276
+ decodedObjectsArg.set(objectPayloadArg, decodedArray);
24277
+ for (const item of objectPayloadArg) {
24278
+ decodedArray.push(_VirtualStream.preparePayloadFromNetwork(item, commFunctionsArg, decodedStreamsArg, streamsToOpenArg, createdStreamsArg, decodedObjectsArg));
24279
+ }
24280
+ return decodedArray;
24281
+ }
24282
+ const decodedObject = {};
24283
+ decodedObjectsArg.set(objectPayloadArg, decodedObject);
24284
+ for (const key2 of Object.keys(objectPayloadArg)) {
24285
+ Object.defineProperty(decodedObject, key2, {
24286
+ value: _VirtualStream.preparePayloadFromNetwork(objectPayloadArg[key2], commFunctionsArg, decodedStreamsArg, streamsToOpenArg, createdStreamsArg, decodedObjectsArg),
24287
+ configurable: true,
24288
+ enumerable: true,
24289
+ writable: true
24290
+ });
24291
+ }
24292
+ return decodedObject;
24293
+ }
24294
+ static resolveOpenDeadlineAt(deadlineAtArg) {
24295
+ const packageDeadlineAt = performance.now() + maximumVirtualStreamOpenTimeoutMs;
24296
+ if (deadlineAtArg === void 0)
24297
+ return packageDeadlineAt;
24298
+ if (!Number.isFinite(deadlineAtArg) || deadlineAtArg < 0) {
24299
+ throw new RangeError("VirtualStream openDeadlineAt must be a non-negative finite number");
24300
+ }
24301
+ return Math.min(deadlineAtArg, packageDeadlineAt);
24302
+ }
24303
+ static getRemainingOpenTimeoutMs(deadlineAtArg) {
24304
+ const timeoutMs = Math.ceil(deadlineAtArg - performance.now());
24305
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {
24306
+ throw new VirtualStreamOpenTimeoutError(0, deadlineAtArg);
24307
+ }
24308
+ return timeoutMs;
24309
+ }
24310
+ static async openVirtualStreamWithTimeout(transportArg, descriptorArg, timeoutMsArg, deadlineAtArg, parentAbortSignalArg) {
24311
+ const timeoutError = new VirtualStreamOpenTimeoutError(timeoutMsArg, deadlineAtArg);
24312
+ const abortController = new AbortController();
24313
+ let terminalReason;
24314
+ let timeout2;
24315
+ let parentAbortListener;
24316
+ const openPromise = Promise.resolve().then(() => transportArg.openVirtualStream(descriptorArg, {
24317
+ abortSignal: abortController.signal,
24318
+ timeoutMs: timeoutMsArg
24319
+ }));
24320
+ void openPromise.then(async (endpointArg) => {
24321
+ if (terminalReason !== void 0) {
24322
+ await _VirtualStream.abortLateOpenedEndpoint(endpointArg, terminalReason);
24323
+ }
24324
+ }, () => {
23975
24325
  });
23976
- if (typedResponseError) {
23977
- typedRequestArg.error = {
23978
- text: typedResponseError.errorText,
23979
- data: typedResponseError.errorData
23980
- };
24326
+ const interruptionPromise = new Promise((_resolve, reject) => {
24327
+ timeout2 = setTimeout(() => {
24328
+ terminalReason = timeoutError;
24329
+ abortController.abort(timeoutError);
24330
+ reject(timeoutError);
24331
+ }, timeoutMsArg);
24332
+ if (parentAbortSignalArg) {
24333
+ parentAbortListener = /* @__PURE__ */ __name(() => {
24334
+ const reason = parentAbortSignalArg.reason ?? new DOMException("The operation was aborted", "AbortError");
24335
+ terminalReason = reason;
24336
+ abortController.abort(reason);
24337
+ reject(reason);
24338
+ }, "parentAbortListener");
24339
+ parentAbortSignalArg.addEventListener("abort", parentAbortListener, { once: true });
24340
+ if (parentAbortSignalArg.aborted)
24341
+ parentAbortListener();
24342
+ }
24343
+ });
24344
+ try {
24345
+ return await Promise.race([openPromise, interruptionPromise]);
24346
+ } finally {
24347
+ if (timeout2)
24348
+ clearTimeout(timeout2);
24349
+ if (parentAbortSignalArg && parentAbortListener) {
24350
+ parentAbortSignalArg.removeEventListener("abort", parentAbortListener);
24351
+ }
23981
24352
  }
23982
- if (response) {
23983
- typedRequestArg.response = response;
24353
+ }
24354
+ static async abortLateOpenedEndpoint(endpointArg, reasonArg) {
24355
+ let abortPromise;
24356
+ try {
24357
+ abortPromise = Promise.resolve(endpointArg.abort(reasonArg));
24358
+ } catch {
23984
24359
  }
23985
- typedRequestArg?.correlation?.phase ? typedRequestArg.correlation.phase = "response" : null;
23986
- return typedRequestArg;
24360
+ void abortPromise?.catch(() => {
24361
+ });
24362
+ try {
24363
+ await endpointArg.closed;
24364
+ } catch {
24365
+ }
24366
+ }
24367
+ static validateTransport(transportArg) {
24368
+ if (!transportArg || typeof transportArg !== "object" || typeof transportArg.openVirtualStream !== "function") {
24369
+ throw new TypeError("VirtualStream transport is invalid");
24370
+ }
24371
+ }
24372
+ static validateNetworkDescriptor(descriptorArg) {
24373
+ if (!_VirtualStream.isPlainObject(descriptorArg)) {
24374
+ throw new TypeError("VirtualStream descriptor must be a plain object");
24375
+ }
24376
+ const marker = _VirtualStream.getOwnDataProperty(descriptorArg, "_isVirtualStream");
24377
+ const protocol = _VirtualStream.getOwnDataProperty(descriptorArg, "protocol");
24378
+ const streamId = _VirtualStream.getOwnDataProperty(descriptorArg, "streamId");
24379
+ const creatorDirection = _VirtualStream.getOwnDataProperty(descriptorArg, "creatorDirection");
24380
+ if (marker !== true || protocol !== "virtual-stream-v1") {
24381
+ throw new TypeError("VirtualStream descriptor requires protocol virtual-stream-v1");
24382
+ }
24383
+ if (typeof streamId !== "string" || streamId.length === 0 || streamId.length > _VirtualStream.maximumStreamIdLength) {
24384
+ throw new TypeError(`VirtualStream descriptor streamId must contain 1-${_VirtualStream.maximumStreamIdLength} characters`);
24385
+ }
24386
+ if (creatorDirection !== "send" && creatorDirection !== "receive") {
24387
+ throw new TypeError("VirtualStream descriptor creatorDirection must be send or receive");
24388
+ }
24389
+ const contentTypeProperty = Object.getOwnPropertyDescriptor(descriptorArg, "contentType");
24390
+ if (contentTypeProperty) {
24391
+ if (!("value" in contentTypeProperty) || typeof contentTypeProperty.value !== "string" || contentTypeProperty.value.length === 0) {
24392
+ throw new TypeError("VirtualStream descriptor contentType must be a non-empty string");
24393
+ }
24394
+ }
24395
+ const integrityProperty = Object.getOwnPropertyDescriptor(descriptorArg, "integrity");
24396
+ if (integrityProperty) {
24397
+ if (!("value" in integrityProperty)) {
24398
+ throw new TypeError("VirtualStream descriptor integrity must be data");
24399
+ }
24400
+ _VirtualStream.validateIntegrity(integrityProperty.value);
24401
+ }
24402
+ const transportProperty = Object.getOwnPropertyDescriptor(descriptorArg, "transport");
24403
+ if (!transportProperty || !("value" in transportProperty)) {
24404
+ throw new TypeError("VirtualStream descriptor requires an own transport property");
24405
+ }
24406
+ if (!_VirtualStream.isJsonCompatible(transportProperty.value, /* @__PURE__ */ new WeakSet())) {
24407
+ throw new TypeError("VirtualStream descriptor transport must be JSON-compatible");
24408
+ }
24409
+ }
24410
+ static validateIntegrity(integrityArg) {
24411
+ if (!_VirtualStream.isPlainObject(integrityArg)) {
24412
+ throw new TypeError("VirtualStream integrity must be a plain object");
24413
+ }
24414
+ const algorithm = _VirtualStream.getOwnDataProperty(integrityArg, "algorithm");
24415
+ const byteLength = _VirtualStream.getOwnDataProperty(integrityArg, "byteLength");
24416
+ const digest = _VirtualStream.getOwnDataProperty(integrityArg, "digest");
24417
+ if (algorithm !== "sha256") {
24418
+ throw new TypeError("VirtualStream integrity algorithm must be sha256");
24419
+ }
24420
+ if (!Number.isSafeInteger(byteLength) || byteLength < 0) {
24421
+ throw new TypeError("VirtualStream integrity byteLength must be a non-negative safe integer");
24422
+ }
24423
+ if (typeof digest !== "string" || !/^sha256:[0-9a-f]{64}$/.test(digest)) {
24424
+ throw new TypeError("VirtualStream integrity digest is invalid");
24425
+ }
24426
+ }
24427
+ static validateEndpoint(endpointArg, descriptorArg, expectedDirectionArg) {
24428
+ if (!endpointArg || typeof endpointArg !== "object") {
24429
+ throw new TypeError("VirtualStream transport returned an invalid endpoint");
24430
+ }
24431
+ const endpoint = endpointArg;
24432
+ if (endpoint.protocol !== "virtual-stream-v1" || endpoint.direction !== expectedDirectionArg || endpoint.streamId !== descriptorArg.streamId || endpoint.contentType !== descriptorArg.contentType || !_VirtualStream.integrityMatches(endpoint.integrity, descriptorArg.integrity)) {
24433
+ throw new TypeError("VirtualStream endpoint direction or metadata does not match its descriptor");
24434
+ }
24435
+ if (!("opened" in endpoint) || !("completion" in endpoint) || !endpoint.closed || typeof endpoint.closed.then !== "function" || typeof endpoint.abort !== "function") {
24436
+ throw new TypeError("VirtualStream endpoint lacks lifecycle contracts");
24437
+ }
24438
+ if (expectedDirectionArg === "send") {
24439
+ if (typeof endpoint.send !== "function" || typeof endpoint.close !== "function" || !("writable" in endpoint)) {
24440
+ throw new TypeError("VirtualStream sender endpoint is invalid");
24441
+ }
24442
+ } else if (typeof endpoint.receive !== "function" || typeof endpoint.accept !== "function" || typeof endpoint.reject !== "function" || !("readable" in endpoint)) {
24443
+ throw new TypeError("VirtualStream receiver endpoint is invalid");
24444
+ }
24445
+ }
24446
+ static descriptorMetadataMatches(firstArg, secondArg) {
24447
+ return firstArg.creatorDirection === secondArg.creatorDirection && firstArg.contentType === secondArg.contentType && _VirtualStream.integrityMatches(firstArg.integrity, secondArg.integrity);
24448
+ }
24449
+ static integrityMatches(firstArg, secondArg) {
24450
+ if (!firstArg || !secondArg)
24451
+ return firstArg === secondArg;
24452
+ return firstArg.algorithm === secondArg.algorithm && firstArg.byteLength === secondArg.byteLength && firstArg.digest === secondArg.digest;
24453
+ }
24454
+ static getOwnDataProperty(objectArg, keyArg) {
24455
+ const property2 = Object.getOwnPropertyDescriptor(objectArg, keyArg);
24456
+ if (!property2 || !("value" in property2))
24457
+ return void 0;
24458
+ return property2.value;
24459
+ }
24460
+ static isPlainObject(valueArg) {
24461
+ if (!valueArg || typeof valueArg !== "object" || Array.isArray(valueArg)) {
24462
+ return false;
24463
+ }
24464
+ const prototype = Object.getPrototypeOf(valueArg);
24465
+ return prototype === Object.prototype || prototype === null;
24466
+ }
24467
+ static isJsonCompatible(valueArg, ancestorsArg) {
24468
+ if (valueArg === null || typeof valueArg === "string" || typeof valueArg === "boolean") {
24469
+ return true;
24470
+ }
24471
+ if (typeof valueArg === "number")
24472
+ return Number.isFinite(valueArg);
24473
+ if (!valueArg || typeof valueArg !== "object")
24474
+ return false;
24475
+ if (ancestorsArg.has(valueArg))
24476
+ return false;
24477
+ ancestorsArg.add(valueArg);
24478
+ try {
24479
+ if (Array.isArray(valueArg)) {
24480
+ for (let index3 = 0; index3 < valueArg.length; index3++) {
24481
+ const itemProperty = Object.getOwnPropertyDescriptor(valueArg, String(index3));
24482
+ if (!itemProperty || !("value" in itemProperty) || !_VirtualStream.isJsonCompatible(itemProperty.value, ancestorsArg)) {
24483
+ return false;
24484
+ }
24485
+ }
24486
+ return Reflect.ownKeys(valueArg).every((keyArg) => keyArg === "length" || typeof keyArg === "string" && /^(0|[1-9][0-9]*)$/.test(keyArg) && Number(keyArg) < valueArg.length);
24487
+ }
24488
+ if (!_VirtualStream.isPlainObject(valueArg))
24489
+ return false;
24490
+ for (const key2 of Reflect.ownKeys(valueArg)) {
24491
+ if (typeof key2 !== "string")
24492
+ return false;
24493
+ const property2 = Object.getOwnPropertyDescriptor(valueArg, key2);
24494
+ if (!property2.enumerable || !("value" in property2) || !_VirtualStream.isJsonCompatible(property2.value, ancestorsArg)) {
24495
+ return false;
24496
+ }
24497
+ }
24498
+ return true;
24499
+ } finally {
24500
+ ancestorsArg.delete(valueArg);
24501
+ }
24502
+ }
24503
+ constructor(optionsArg) {
24504
+ this.activationPublished = false;
24505
+ this.endpointUseStarted = false;
24506
+ this.endpointClosed = false;
24507
+ this.locallyDisposed = false;
24508
+ this.transport = optionsArg.transport;
24509
+ this.descriptor = optionsArg.descriptor;
24510
+ this.endpoint = optionsArg.endpoint;
24511
+ this.registrationDispose = optionsArg.registrationDispose;
24512
+ this.explicitRegistration = optionsArg.explicitRegistration;
24513
+ if (this.explicitRegistration)
24514
+ authorizeVirtualStreamApplicationUse(this);
24515
+ if (this.endpoint)
24516
+ this.observeEndpoint(this.endpoint);
24517
+ }
24518
+ get protocol() {
24519
+ return "virtual-stream-v1";
24520
+ }
24521
+ get direction() {
24522
+ if (this.endpoint)
24523
+ return this.endpoint.direction;
24524
+ return this.descriptor.creatorDirection === "send" ? "receive" : "send";
24525
+ }
24526
+ get streamId() {
24527
+ return this.descriptor.streamId;
24528
+ }
24529
+ get contentType() {
24530
+ return this.descriptor.contentType;
24531
+ }
24532
+ get integrity() {
24533
+ return this.descriptor.integrity;
24534
+ }
24535
+ get opened() {
24536
+ try {
24537
+ this.assertApplicationOperationsAllowed();
24538
+ this.assertNotClosed();
24539
+ this.endpointUseStarted = true;
24540
+ const opened = this.requireEndpoint().opened;
24541
+ if (!opened || typeof opened.then !== "function") {
24542
+ throw new TypeError("VirtualStream endpoint opened contract is invalid");
24543
+ }
24544
+ return opened;
24545
+ } catch (error) {
24546
+ return Promise.reject(error);
24547
+ }
24548
+ }
24549
+ get completion() {
24550
+ const completion = this.requireEndpoint().completion;
24551
+ if (!completion || typeof completion.then !== "function") {
24552
+ throw new TypeError("VirtualStream endpoint completion contract is invalid");
24553
+ }
24554
+ return completion;
24555
+ }
24556
+ get closed() {
24557
+ return this.requireEndpoint().closed;
24558
+ }
24559
+ get writable() {
24560
+ this.assertApplicationOperation("send");
24561
+ this.endpointUseStarted = true;
24562
+ return this.requireEndpoint().writable;
24563
+ }
24564
+ get readable() {
24565
+ this.assertApplicationOperation("receive");
24566
+ this.endpointUseStarted = true;
24567
+ return this.requireEndpoint().readable;
24568
+ }
24569
+ publishActivation() {
24570
+ if (this.explicitRegistration && !this.locallyDisposed) {
24571
+ this.activationPublished = true;
24572
+ }
24573
+ }
24574
+ async rollbackActivation(reasonArg) {
24575
+ if (this.locallyDisposed)
24576
+ return;
24577
+ if (this.explicitRegistration && !this.activationPublished && !this.endpointUseStarted) {
24578
+ this.disposeUnpublishedRegistration();
24579
+ return;
24580
+ }
24581
+ if (!this.endpoint)
24582
+ return;
24583
+ await this.abort(reasonArg);
24584
+ }
24585
+ async send(chunkArg) {
24586
+ this.assertApplicationOperation("send");
24587
+ if (!(chunkArg instanceof Uint8Array)) {
24588
+ throw new TypeError("VirtualStream.send accepts only Uint8Array chunks");
24589
+ }
24590
+ this.endpointUseStarted = true;
24591
+ await this.requireEndpoint().send(chunkArg);
24592
+ }
24593
+ async receive() {
24594
+ this.assertApplicationOperation("receive");
24595
+ this.endpointUseStarted = true;
24596
+ return this.requireEndpoint().receive();
24597
+ }
24598
+ close() {
24599
+ if (this.terminalPromise) {
24600
+ return this.followTerminal("close");
24601
+ }
24602
+ try {
24603
+ this.assertApplicationOperation("send");
24604
+ this.endpointUseStarted = true;
24605
+ const endpoint = this.requireEndpoint();
24606
+ return this.terminateEndpoint(() => endpoint.close(), "close");
24607
+ } catch (error) {
24608
+ return Promise.reject(error);
24609
+ }
24610
+ }
24611
+ accept() {
24612
+ if (this.terminalPromise) {
24613
+ return this.followTerminal("accept");
24614
+ }
24615
+ try {
24616
+ this.assertApplicationOperation("receive");
24617
+ this.endpointUseStarted = true;
24618
+ const endpoint = this.requireEndpoint();
24619
+ return this.terminateEndpoint(() => endpoint.accept(), "accept");
24620
+ } catch (error) {
24621
+ return Promise.reject(error);
24622
+ }
24623
+ }
24624
+ reject(reasonArg) {
24625
+ if (this.terminalPromise)
24626
+ return this.followTerminal("reject");
24627
+ try {
24628
+ this.assertApplicationOperation("receive");
24629
+ this.endpointUseStarted = true;
24630
+ const endpoint = this.requireEndpoint();
24631
+ return this.terminateEndpoint(() => endpoint.reject(reasonArg), "reject");
24632
+ } catch (error) {
24633
+ return Promise.reject(error);
24634
+ }
24635
+ }
24636
+ abort(reasonArg) {
24637
+ if (this.terminalPromise)
24638
+ return this.followTerminal("abort");
24639
+ if (this.locallyDisposed || this.endpointClosed)
24640
+ return Promise.resolve();
24641
+ const endpoint = this.endpoint;
24642
+ if (!endpoint)
24643
+ return Promise.resolve();
24644
+ this.endpointUseStarted = true;
24645
+ return this.terminateEndpoint(() => endpoint.abort(reasonArg), "abort");
24646
+ }
24647
+ activateForEncoding(commFunctionsArg) {
24648
+ commFunctionsArg.activationScope?.track(this);
24649
+ try {
24650
+ if (!commFunctionsArg.virtualStreamTransport) {
24651
+ throw new Error("VirtualStream requires a virtual stream transport");
24652
+ }
24653
+ if (this.transport !== commFunctionsArg.virtualStreamTransport) {
24654
+ throw new Error("VirtualStream cannot be encoded through a different virtual stream transport");
24655
+ }
24656
+ this.assertNotClosed();
24657
+ if (this.terminalPromise) {
24658
+ throw new VirtualStreamClosedError("VirtualStream has a terminal operation");
24659
+ }
24660
+ if (!commFunctionsArg.activationScope)
24661
+ this.publishActivation();
24662
+ return this.descriptor;
24663
+ } catch (error) {
24664
+ if (!commFunctionsArg.activationScope) {
24665
+ void this.rollbackActivation(error).catch(() => {
24666
+ });
24667
+ }
24668
+ throw error;
24669
+ }
24670
+ }
24671
+ bindOpenedEndpoint(endpointArg) {
24672
+ this.endpoint = endpointArg;
24673
+ const expectedDirection = this.descriptor.creatorDirection === "send" ? "receive" : "send";
24674
+ _VirtualStream.validateEndpoint(endpointArg, this.descriptor, expectedDirection);
24675
+ this.observeEndpoint(endpointArg);
24676
+ }
24677
+ observeEndpoint(endpointArg) {
24678
+ const completion = endpointArg.completion;
24679
+ if (!completion || typeof completion.then !== "function") {
24680
+ throw new TypeError("VirtualStream endpoint completion contract is invalid");
24681
+ }
24682
+ void completion.then((valueArg) => {
24683
+ this.completionOutcome = { status: "fulfilled", value: valueArg };
24684
+ }, (errorArg) => {
24685
+ this.completionOutcome = { status: "rejected", error: errorArg };
24686
+ });
24687
+ void endpointArg.closed.then(() => this.markEndpointClosed(), (errorArg) => this.markEndpointClosed(errorArg));
24688
+ }
24689
+ markEndpointClosed(reasonArg) {
24690
+ if (reasonArg !== void 0)
24691
+ this.getCloseError(reasonArg);
24692
+ this.endpointClosed = true;
24693
+ this.disposeRegistration();
24694
+ }
24695
+ disposeRegistration() {
24696
+ const dispose = this.registrationDispose;
24697
+ this.registrationDispose = void 0;
24698
+ dispose?.();
24699
+ }
24700
+ disposeUnpublishedRegistration() {
24701
+ if (this.locallyDisposed)
24702
+ return;
24703
+ this.locallyDisposed = true;
24704
+ this.disposeRegistration();
24705
+ }
24706
+ requireEndpoint() {
24707
+ if (!this.endpoint)
24708
+ throw new Error("VirtualStream endpoint is not staged");
24709
+ return this.endpoint;
24710
+ }
24711
+ assertApplicationOperationsAllowed() {
24712
+ if (!applicationAuthorizedStreams.has(this)) {
24713
+ throw new Error("VirtualStream application use is not authorized");
24714
+ }
24715
+ }
24716
+ assertApplicationOperation(expectedDirectionArg) {
24717
+ this.assertApplicationOperationsAllowed();
24718
+ this.assertNotClosed();
24719
+ if (this.terminalPromise) {
24720
+ throw new VirtualStreamClosedError("VirtualStream has a terminal operation");
24721
+ }
24722
+ if (this.direction !== expectedDirectionArg) {
24723
+ throw new TypeError(`${this.direction} VirtualStreams cannot perform ${expectedDirectionArg} operations`);
24724
+ }
24725
+ }
24726
+ assertNotClosed() {
24727
+ if (this.endpointClosed || this.locallyDisposed)
24728
+ throw this.getCloseError();
24729
+ }
24730
+ getCloseError(reasonArg) {
24731
+ if (!this.closeError) {
24732
+ this.closeError = new VirtualStreamClosedError("VirtualStream is closed", reasonArg === void 0 ? void 0 : { cause: reasonArg });
24733
+ }
24734
+ return this.closeError;
24735
+ }
24736
+ followTerminal(kindArg) {
24737
+ const terminalPromise = this.terminalPromise;
24738
+ if (this.terminalKind === kindArg)
24739
+ return terminalPromise;
24740
+ const conflictError = new VirtualStreamClosedError(`VirtualStream terminal ${this.terminalKind} already completed`);
24741
+ return terminalPromise.then(() => Promise.reject(conflictError), () => Promise.reject(conflictError));
24742
+ }
24743
+ terminateEndpoint(operationArg, kindArg) {
24744
+ if (this.terminalPromise)
24745
+ return this.followTerminal(kindArg);
24746
+ const endpoint = this.requireEndpoint();
24747
+ this.terminalKind = kindArg;
24748
+ let operation = operationArg;
24749
+ const operationPromise = Promise.resolve().then(() => {
24750
+ const currentOperation = operation;
24751
+ operation = void 0;
24752
+ return currentOperation();
24753
+ });
24754
+ void operationPromise.catch(() => {
24755
+ });
24756
+ const operationOutcome = operationPromise.then((valueArg) => ({ status: "fulfilled", value: valueArg }), (errorArg) => ({ status: "rejected", error: errorArg }));
24757
+ let observedOperationOutcome;
24758
+ void operationOutcome.then((outcomeArg) => {
24759
+ observedOperationOutcome = outcomeArg;
24760
+ });
24761
+ const closedOutcome = endpoint.closed.then(() => ({ status: "closed" }), (errorArg) => ({ status: "closedError", error: errorArg }));
24762
+ const terminalPromise = (async () => {
24763
+ const firstOutcome = await Promise.race([operationOutcome, closedOutcome]);
24764
+ if (firstOutcome.status === "fulfilled" || firstOutcome.status === "rejected") {
24765
+ const finalClosedOutcome = await closedOutcome;
24766
+ this.endpointClosed = true;
24767
+ this.disposeRegistration();
24768
+ if (firstOutcome.status === "rejected")
24769
+ throw firstOutcome.error;
24770
+ if (finalClosedOutcome.status === "closedError") {
24771
+ throw finalClosedOutcome.error;
24772
+ }
24773
+ return firstOutcome.value;
24774
+ }
24775
+ this.endpointClosed = true;
24776
+ this.disposeRegistration();
24777
+ if (firstOutcome.status === "closedError")
24778
+ throw firstOutcome.error;
24779
+ await Promise.resolve();
24780
+ await Promise.resolve();
24781
+ if (observedOperationOutcome?.status === "rejected") {
24782
+ throw observedOperationOutcome.error;
24783
+ }
24784
+ if (observedOperationOutcome?.status === "fulfilled") {
24785
+ return observedOperationOutcome.value;
24786
+ }
24787
+ if (kindArg === "close" || kindArg === "accept") {
24788
+ if (this.completionOutcome?.status === "fulfilled") {
24789
+ return this.completionOutcome.value;
24790
+ }
24791
+ if (this.completionOutcome?.status === "rejected") {
24792
+ throw this.completionOutcome.error;
24793
+ }
24794
+ throw new VirtualStreamLifecycleContractError(kindArg);
24795
+ }
24796
+ return void 0;
24797
+ })();
24798
+ this.terminalPromise = terminalPromise;
24799
+ return terminalPromise;
24800
+ }
24801
+ };
24802
+ }
24803
+ });
24804
+
24805
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedresponseerror.js
24806
+ var TypedResponseError;
24807
+ var init_classes_typedresponseerror = __esm({
24808
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedresponseerror.js"() {
24809
+ TypedResponseError = class extends Error {
24810
+ static {
24811
+ __name(this, "TypedResponseError");
24812
+ }
24813
+ constructor(errorTextArg, errorDataArg) {
24814
+ super(errorTextArg);
24815
+ this.name = "TypedResponseError";
24816
+ this.errorText = errorTextArg;
24817
+ this.errorData = errorDataArg ?? {};
23987
24818
  }
23988
24819
  };
23989
24820
  }
23990
24821
  });
23991
24822
 
23992
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/interfaces.hooks.js
24823
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/interfaces.hooks.js
23993
24824
  var TYPED_REQUEST_REDACTED_PAYLOAD;
23994
24825
  var init_interfaces_hooks = __esm({
23995
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/interfaces.hooks.js"() {
24826
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/interfaces.hooks.js"() {
23996
24827
  TYPED_REQUEST_REDACTED_PAYLOAD = Object.freeze({
23997
24828
  redacted: true
23998
24829
  });
23999
24830
  }
24000
24831
  });
24001
24832
 
24002
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/internal.hooks.js
24833
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/internal.hooks.js
24003
24834
  var hookNames, realmGlobalHookStateSlot, copyProjectionOptions, createTypedRouterHookRegistrationState, getSuppliedHookEntries, mergeTypedRouterHookRegistrations, replaceTypedRouterHookRegistrations, getRealmGlobalHookState, getLegacyGlobalHooks, replaceLegacyGlobalHooks, mergeLegacyGlobalHooks, addGlobalHookSubscriber, clearGlobalHookRegistrations, logProjectionFailure, logCallbackFailure, createMetadata, isSharedArrayBuffer, assertNoSharedArrayBuffer, snapshotPayload, snapshotError, projectLogEntry, snapshotDispatchRecipient, dispatchToRecipient, dispatchTypedRequestHook;
24004
24835
  var init_internal_hooks = __esm({
24005
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/internal.hooks.js"() {
24836
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/internal.hooks.js"() {
24006
24837
  init_interfaces_hooks();
24007
24838
  hookNames = Object.freeze([
24008
24839
  "onOutgoingRequest",
@@ -24275,6 +25106,19 @@ var init_internal_hooks = __esm({
24275
25106
  }, "dispatchToRecipient");
24276
25107
  dispatchTypedRequestHook = /* @__PURE__ */ __name((hookNameArg, sourceArg, instanceRegistrationStateArg) => {
24277
25108
  const globalState = getRealmGlobalHookState();
25109
+ if (globalState.subscribers.size === 0) {
25110
+ const legacyRecipient = snapshotDispatchRecipient(globalState.legacy, hookNameArg);
25111
+ const instanceRecipient = instanceRegistrationStateArg ? snapshotDispatchRecipient(instanceRegistrationStateArg, hookNameArg) : void 0;
25112
+ if (!legacyRecipient && !instanceRecipient)
25113
+ return;
25114
+ if (legacyRecipient) {
25115
+ dispatchToRecipient(legacyRecipient, hookNameArg, sourceArg);
25116
+ }
25117
+ if (instanceRecipient) {
25118
+ dispatchToRecipient(instanceRecipient, hookNameArg, sourceArg);
25119
+ }
25120
+ return;
25121
+ }
24278
25122
  const registrationStates = [
24279
25123
  globalState.legacy,
24280
25124
  ...Array.from(globalState.subscribers.values()),
@@ -24288,10 +25132,99 @@ var init_internal_hooks = __esm({
24288
25132
  }
24289
25133
  });
24290
25134
 
24291
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedrouter.js
25135
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedtools.js
25136
+ var TypedTools;
25137
+ var init_classes_typedtools = __esm({
25138
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedtools.js"() {
25139
+ init_classes_typedresponseerror();
25140
+ init_plugins();
25141
+ TypedTools = class {
25142
+ static {
25143
+ __name(this, "TypedTools");
25144
+ }
25145
+ constructor(abortSignalArg) {
25146
+ this.localData = {};
25147
+ this.abortSignal = abortSignalArg ?? new AbortController().signal;
25148
+ }
25149
+ async passGuards(guardsArg, dataArg) {
25150
+ const guardSet = new dist_ts_exports9.GuardSet(guardsArg);
25151
+ const guardResult = await guardSet.allGuardsPass(dataArg);
25152
+ if (!guardResult) {
25153
+ const failedHint = await guardSet.getFailedHint(dataArg);
25154
+ throw new TypedResponseError(`guard failed: ${failedHint}`, { failedHint });
25155
+ }
25156
+ }
25157
+ };
25158
+ }
25159
+ });
25160
+
25161
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedhandler.js
25162
+ var TypedHandler;
25163
+ var init_classes_typedhandler = __esm({
25164
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedhandler.js"() {
25165
+ init_plugins();
25166
+ init_classes_typedresponseerror();
25167
+ init_classes_typedtools();
25168
+ TypedHandler = class _TypedHandler {
25169
+ static {
25170
+ __name(this, "TypedHandler");
25171
+ }
25172
+ static {
25173
+ this.internalErrorMessage = "Internal server error";
25174
+ }
25175
+ constructor(methodArg, handlerFunctionArg) {
25176
+ this.method = methodArg;
25177
+ this.handlerFunction = handlerFunctionArg;
25178
+ }
25179
+ /**
25180
+ * adds a response to the typedRequest
25181
+ * @param typedRequestArg
25182
+ */
25183
+ async addResponse(typedRequestArg, abortSignalArg) {
25184
+ if (typedRequestArg.method !== this.method) {
25185
+ throw new Error("this handler has been given a wrong method to answer to. Please use a TypedRouter to filter requests");
25186
+ }
25187
+ let typedResponseError;
25188
+ const typedtoolsInstance = new TypedTools(abortSignalArg);
25189
+ if (typedRequestArg.localData) {
25190
+ typedtoolsInstance.localData = typedRequestArg.localData;
25191
+ }
25192
+ const response = await this.handlerFunction(typedRequestArg.request, typedtoolsInstance).catch((e10) => {
25193
+ if (e10 instanceof TypedResponseError) {
25194
+ typedResponseError = e10;
25195
+ } else {
25196
+ console.error(`TypedRequest handler '${this.method}' failed`);
25197
+ typedResponseError = new TypedResponseError(_TypedHandler.internalErrorMessage);
25198
+ }
25199
+ });
25200
+ if (typedResponseError) {
25201
+ typedRequestArg.error = {
25202
+ text: typedResponseError.errorText,
25203
+ data: typedResponseError.errorData
25204
+ };
25205
+ }
25206
+ if (response) {
25207
+ typedRequestArg.response = response;
25208
+ }
25209
+ typedRequestArg?.correlation?.phase ? typedRequestArg.correlation.phase = "response" : null;
25210
+ return typedRequestArg;
25211
+ }
25212
+ };
25213
+ }
25214
+ });
25215
+
25216
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedrouter.js
25217
+ function getTypedRequestResponseInterestKey(typedRequestArg) {
25218
+ const method = typedRequestArg?.method;
25219
+ const correlationId = typedRequestArg?.correlation?.id;
25220
+ const requestInstanceId = typedRequestArg?.requestInstanceId;
25221
+ if (typeof method !== "string" || method.length === 0 || typeof correlationId !== "string" || correlationId.length === 0 || typeof requestInstanceId !== "string" || requestInstanceId.length === 0)
25222
+ return void 0;
25223
+ return JSON.stringify([method, correlationId, requestInstanceId]);
25224
+ }
24292
25225
  var TypedRouter;
24293
25226
  var init_classes_typedrouter = __esm({
24294
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedrouter.js"() {
25227
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedrouter.js"() {
24295
25228
  init_plugins();
24296
25229
  init_classes_virtualstream();
24297
25230
  init_classes_typedhandler();
@@ -24299,23 +25232,102 @@ var init_classes_typedrouter = __esm({
24299
25232
  init_classes_typedresponseerror();
24300
25233
  init_internal_hooks();
24301
25234
  init_interfaces_hooks();
25235
+ __name(getTypedRequestResponseInterestKey, "getTypedRequestResponseInterestKey");
24302
25236
  TypedRouter = class _TypedRouter {
24303
25237
  static {
24304
25238
  __name(this, "TypedRouter");
24305
25239
  }
24306
25240
  constructor() {
24307
25241
  this.hookRegistrationState = createTypedRouterHookRegistrationState();
24308
- this.routerMap = new dist_ts_exports7.ObjectMap();
24309
- this.fallbackRouterMap = new dist_ts_exports7.ObjectMap();
25242
+ this.routerMap = new dist_ts_exports6.ObjectMap();
25243
+ this.fallbackRouterMap = new dist_ts_exports6.ObjectMap();
24310
25244
  this.fallbackParentRouters = /* @__PURE__ */ new Set();
24311
- this.handlerMap = new dist_ts_exports7.ObjectMap();
24312
- this.registeredVirtualStreams = new dist_ts_exports7.ObjectMap();
25245
+ this.handlerMap = new dist_ts_exports6.ObjectMap();
24313
25246
  this.middlewares = [];
24314
- this.fireEventInterestMap = new dist_ts_exports7.InterestMap((correlationId) => correlationId);
25247
+ this.fireEventInterestMap = new dist_ts_exports6.InterestMap((correlationId) => correlationId);
24315
25248
  }
24316
25249
  static {
24317
25250
  this.internalErrorMessage = "Internal server error";
24318
25251
  }
25252
+ /**
25253
+ * Installs one scoped owner for per-route VirtualStream transport resolution.
25254
+ * The resolver receives only trusted local transport data.
25255
+ */
25256
+ registerVirtualStreamTransportResolver(resolverArg) {
25257
+ if (typeof resolverArg !== "function") {
25258
+ throw new TypeError("TypedRouter virtual stream transport resolver must be a function");
25259
+ }
25260
+ if (this.virtualStreamTransportResolver) {
25261
+ throw new Error("TypedRouter already has a virtual stream transport resolver owner");
25262
+ }
25263
+ this.virtualStreamTransportResolver = resolverArg;
25264
+ let detached = false;
25265
+ return () => {
25266
+ if (detached)
25267
+ return;
25268
+ detached = true;
25269
+ if (this.virtualStreamTransportResolver === resolverArg) {
25270
+ this.virtualStreamTransportResolver = void 0;
25271
+ }
25272
+ };
25273
+ }
25274
+ /** Installs one transport-owned guard for incoming requests. */
25275
+ registerIncomingRequestAuthorityGuard(guardArg) {
25276
+ if (typeof guardArg !== "function") {
25277
+ throw new TypeError("TypedRouter incoming request authority guard must be a function");
25278
+ }
25279
+ if (this.incomingRequestAuthorityGuard) {
25280
+ throw new Error("TypedRouter already has an incoming request authority guard owner");
25281
+ }
25282
+ this.incomingRequestAuthorityGuard = guardArg;
25283
+ let detached = false;
25284
+ return () => {
25285
+ if (detached)
25286
+ return;
25287
+ detached = true;
25288
+ if (this.incomingRequestAuthorityGuard === guardArg) {
25289
+ this.incomingRequestAuthorityGuard = void 0;
25290
+ }
25291
+ };
25292
+ }
25293
+ /** Installs one transport owner for trusted request-scoped cancellation. */
25294
+ registerIncomingRequestSignalResolver(resolverArg) {
25295
+ if (typeof resolverArg !== "function") {
25296
+ throw new TypeError("TypedRouter incoming request signal resolver must be a function");
25297
+ }
25298
+ if (this.incomingRequestSignalResolver) {
25299
+ throw new Error("TypedRouter already has an incoming request signal resolver owner");
25300
+ }
25301
+ this.incomingRequestSignalResolver = resolverArg;
25302
+ let detached = false;
25303
+ return () => {
25304
+ if (detached)
25305
+ return;
25306
+ detached = true;
25307
+ if (this.incomingRequestSignalResolver === resolverArg) {
25308
+ this.incomingRequestSignalResolver = void 0;
25309
+ }
25310
+ };
25311
+ }
25312
+ /** Installs one transport-owned guard for separately routed responses. */
25313
+ registerIncomingResponseAuthorityGuard(guardArg) {
25314
+ if (typeof guardArg !== "function") {
25315
+ throw new TypeError("TypedRouter incoming response authority guard must be a function");
25316
+ }
25317
+ if (this.incomingResponseAuthorityGuard) {
25318
+ throw new Error("TypedRouter already has an incoming response authority guard owner");
25319
+ }
25320
+ this.incomingResponseAuthorityGuard = guardArg;
25321
+ let detached = false;
25322
+ return () => {
25323
+ if (detached)
25324
+ return;
25325
+ detached = true;
25326
+ if (this.incomingResponseAuthorityGuard === guardArg) {
25327
+ this.incomingResponseAuthorityGuard = void 0;
25328
+ }
25329
+ };
25330
+ }
24319
25331
  static get globalHooks() {
24320
25332
  return getLegacyGlobalHooks();
24321
25333
  }
@@ -24367,20 +25379,6 @@ var init_classes_typedrouter = __esm({
24367
25379
  console.error(`TypedRequest ${contextArg} failed`);
24368
25380
  typedRequestArg.error = { text: _TypedRouter.internalErrorMessage, data: {} };
24369
25381
  }
24370
- getRegisteredVirtualStreamById(streamIdArg) {
24371
- return this.registeredVirtualStreams.findSync((virtualStreamArg) => virtualStreamArg.streamId === streamIdArg);
24372
- }
24373
- registerVirtualStream(virtualStreamArg) {
24374
- const existingStream = this.getRegisteredVirtualStreamById(virtualStreamArg.streamId);
24375
- if (existingStream) {
24376
- return existingStream;
24377
- }
24378
- this.registeredVirtualStreams.add(virtualStreamArg);
24379
- return virtualStreamArg;
24380
- }
24381
- unregisterVirtualStream(virtualStreamArg) {
24382
- this.registeredVirtualStreams.remove(virtualStreamArg);
24383
- }
24384
25382
  /**
24385
25383
  * Adds a middleware function that runs before the handler on this router.
24386
25384
  * Throw TypedResponseError to reject the request.
@@ -24406,30 +25404,41 @@ var init_classes_typedrouter = __esm({
24406
25404
  }
24407
25405
  }
24408
25406
  /**
24409
- * adds another sub typedRouter
24410
- * @param typedRequest
25407
+ * Adds another router through a bidirectional edge.
25408
+ * Returns an idempotent disposer for the edge created by this call.
24411
25409
  */
24412
25410
  addTypedRouter(typedRouterArg) {
24413
25411
  if (typedRouterArg === this) {
24414
25412
  throw new Error("A TypedRouter cannot be composed with itself.");
24415
25413
  }
24416
25414
  const routerExists = this.routerMap.findSync((routerArg) => routerArg === typedRouterArg);
24417
- if (!routerExists) {
24418
- const thisCanReachOther = this.canReachRouter(typedRouterArg);
24419
- const otherCanReachThis = typedRouterArg.canReachRouter(this);
24420
- if (thisCanReachOther !== otherCanReachThis) {
24421
- throw new Error("Cannot add a bidirectional TypedRouter edge across an existing composition boundary.");
24422
- }
24423
- this.routerMap.add(typedRouterArg);
24424
- typedRouterArg.routerMap.add(this);
24425
- try {
24426
- this.validateAffectedCompositionRoots();
24427
- } catch (error) {
24428
- this.routerMap.remove(typedRouterArg);
24429
- typedRouterArg.routerMap.remove(this);
24430
- throw error;
24431
- }
25415
+ if (routerExists) {
25416
+ return () => {
25417
+ };
25418
+ }
25419
+ const thisCanReachOther = this.canReachRouter(typedRouterArg);
25420
+ const otherCanReachThis = typedRouterArg.canReachRouter(this);
25421
+ if (thisCanReachOther !== otherCanReachThis) {
25422
+ throw new Error("Cannot add a bidirectional TypedRouter edge across an existing composition boundary.");
25423
+ }
25424
+ this.routerMap.add(typedRouterArg);
25425
+ typedRouterArg.routerMap.add(this);
25426
+ try {
25427
+ this.validateAffectedCompositionRoots();
25428
+ } catch (error) {
25429
+ this.routerMap.remove(typedRouterArg);
25430
+ typedRouterArg.routerMap.remove(this);
25431
+ throw error;
24432
25432
  }
25433
+ let detached = false;
25434
+ return () => {
25435
+ if (detached) {
25436
+ return;
25437
+ }
25438
+ detached = true;
25439
+ this.routerMap.remove(typedRouterArg);
25440
+ typedRouterArg.routerMap.remove(this);
25441
+ };
24433
25442
  }
24434
25443
  /**
24435
25444
  * Adds a router as a one-way fallback.
@@ -24606,105 +25615,43 @@ var init_classes_typedrouter = __esm({
24606
25615
  * - skipHooks: skip calling hooks for this routing (default: false, use for broadcast-received messages)
24607
25616
  */
24608
25617
  async routeAndAddResponse(typedRequestArg, optionsArg = {}) {
25618
+ if (!typedRequestArg || typeof typedRequestArg !== "object") {
25619
+ return null;
25620
+ }
25621
+ let wireLocalDataPresent;
25622
+ try {
25623
+ wireLocalDataPresent = Object.prototype.propertyIsEnumerable.call(typedRequestArg, "localData");
25624
+ } catch {
25625
+ return null;
25626
+ }
24609
25627
  const options2 = { ..._TypedRouter.defaultRouteOptions, ...optionsArg };
24610
- typedRequestArg = VirtualStream.decodePayloadFromNetwork(typedRequestArg, {
24611
- typedrouter: this
24612
- });
24613
- typedRequestArg.localData = options2.trustedLocalData ? { ...options2.trustedLocalData } : typedRequestArg.localData || {};
24614
- typedRequestArg.localData.firstTypedrouter = this;
24615
- if (typedRequestArg.method === "##VirtualStream##") {
24616
- const result = await this.handleStreamTypedRequest(typedRequestArg);
24617
- result.localData = null;
24618
- return result;
25628
+ if (!this.sanitizeIncomingLocalData(typedRequestArg)) {
25629
+ return null;
24619
25630
  }
24620
- if (typedRequestArg?.correlation?.phase === "request" || options2.localRequest) {
24621
- const requestStartTime = Date.now();
24622
- if (!options2.skipHooks) {
24623
- this.callHook("onIncomingRequest", {
24624
- correlationId: typedRequestArg.correlation?.id || "unknown",
24625
- method: typedRequestArg.method,
24626
- direction: "incoming",
24627
- phase: "request",
24628
- timestamp: requestStartTime,
24629
- payload: typedRequestArg.request
24630
- });
24631
- }
24632
- const result = this.getTypedHandlerAndRouter(typedRequestArg.method);
24633
- if (!result) {
24634
- console.log(`Cannot find handler for methodname ${typedRequestArg.method}`);
24635
- typedRequestArg.error = {
24636
- text: "There is no available method for this call on the server side",
24637
- data: {}
24638
- };
24639
- typedRequestArg.correlation.phase = "response";
24640
- typedRequestArg.localData = void 0;
24641
- typedRequestArg = VirtualStream.encodePayloadForNetwork(typedRequestArg, {
24642
- typedrouter: this
25631
+ const trustedRouteLocalData = Object.freeze({
25632
+ ...options2.trustedLocalData ?? {}
25633
+ });
25634
+ if (typedRequestArg?.correlation?.phase === "response") {
25635
+ const responseInterestKey = getTypedRequestResponseInterestKey(typedRequestArg);
25636
+ if (!responseInterestKey)
25637
+ return null;
25638
+ if (this.incomingResponseAuthorityGuard) {
25639
+ const authorityContext = Object.freeze({
25640
+ typedRouter: this,
25641
+ trustedLocalData: trustedRouteLocalData,
25642
+ wireLocalDataPresent
24643
25643
  });
24644
- if (!options2.skipHooks) {
24645
- this.callHook("onOutgoingResponse", {
24646
- correlationId: typedRequestArg.correlation?.id || "unknown",
24647
- method: typedRequestArg.method,
24648
- direction: "outgoing",
24649
- phase: "response",
24650
- timestamp: Date.now(),
24651
- durationMs: Date.now() - requestStartTime,
24652
- payload: typedRequestArg.response,
24653
- errorText: typedRequestArg.error?.text
24654
- });
24655
- }
24656
- return typedRequestArg;
24657
- }
24658
- const { handler: typedHandler, router: owningRouter } = result;
24659
- if (owningRouter.middlewares.length > 0) {
25644
+ let authorized = false;
24660
25645
  try {
24661
- for (const mw of owningRouter.middlewares) {
24662
- await mw(typedRequestArg);
24663
- }
24664
- } catch (e10) {
24665
- this.setErrorFromCaughtError(typedRequestArg, e10, `middleware for method '${typedRequestArg.method}'`);
24666
- typedRequestArg.correlation.phase = "response";
24667
- typedRequestArg.localData = void 0;
24668
- typedRequestArg = VirtualStream.encodePayloadForNetwork(typedRequestArg, {
24669
- typedrouter: this
24670
- });
24671
- if (!options2.skipHooks) {
24672
- this.callHook("onOutgoingResponse", {
24673
- correlationId: typedRequestArg.correlation?.id || "unknown",
24674
- method: typedRequestArg.method,
24675
- direction: "outgoing",
24676
- phase: "response",
24677
- timestamp: Date.now(),
24678
- durationMs: Date.now() - requestStartTime,
24679
- payload: typedRequestArg.response,
24680
- errorText: typedRequestArg.error?.text
24681
- });
24682
- }
24683
- return typedRequestArg;
25646
+ authorized = this.incomingResponseAuthorityGuard(typedRequestArg, authorityContext) === true;
25647
+ } catch {
24684
25648
  }
25649
+ if (!authorized)
25650
+ return null;
24685
25651
  }
24686
- typedRequestArg = await typedHandler.addResponse(typedRequestArg);
24687
- typedRequestArg.localData = void 0;
24688
- typedRequestArg = VirtualStream.encodePayloadForNetwork(typedRequestArg, {
24689
- typedrouter: this
24690
- });
24691
- if (!options2.skipHooks) {
24692
- this.callHook("onOutgoingResponse", {
24693
- correlationId: typedRequestArg.correlation?.id || "unknown",
24694
- method: typedRequestArg.method,
24695
- direction: "outgoing",
24696
- phase: "response",
24697
- timestamp: Date.now(),
24698
- durationMs: Date.now() - requestStartTime,
24699
- payload: typedRequestArg.response,
24700
- errorText: typedRequestArg.error?.text
24701
- });
24702
- }
24703
- return typedRequestArg;
24704
- } else if (typedRequestArg?.correlation?.phase === "response") {
24705
25652
  if (!options2.skipHooks) {
24706
25653
  this.callHook("onIncomingResponse", {
24707
- correlationId: typedRequestArg.correlation?.id || "unknown",
25654
+ correlationId: typedRequestArg.correlation.id,
24708
25655
  method: typedRequestArg.method,
24709
25656
  direction: "incoming",
24710
25657
  phase: "response",
@@ -24713,685 +25660,239 @@ var init_classes_typedrouter = __esm({
24713
25660
  errorText: typedRequestArg.error?.text
24714
25661
  });
24715
25662
  }
24716
- this.fireEventInterestMap.findInterest(typedRequestArg.correlation.id)?.fullfillInterest(typedRequestArg);
25663
+ this.fireEventInterestMap.findInterest(responseInterestKey)?.fullfillInterest(typedRequestArg);
24717
25664
  return null;
24718
- } else {
25665
+ }
25666
+ if (typedRequestArg?.correlation?.phase !== "request" || typeof typedRequestArg.correlation.id !== "string" || typedRequestArg.correlation.id.length === 0 || typeof typedRequestArg.method !== "string" || typedRequestArg.method.length === 0 || !typedRequestArg.request || typeof typedRequestArg.request !== "object") {
24719
25667
  console.log("TypedRouter received a malformed request DTO");
24720
25668
  return null;
24721
25669
  }
24722
- }
24723
- /**
24724
- * handle streaming
24725
- * @param streamTrArg
24726
- */
24727
- async handleStreamTypedRequest(streamTrArg) {
24728
- const relevantVirtualStream = this.getRegisteredVirtualStreamById(streamTrArg.request.streamId);
24729
- if (!relevantVirtualStream) {
24730
- streamTrArg.response = {
24731
- streamId: streamTrArg.request.streamId,
24732
- cycleId: streamTrArg.request.cycleId,
24733
- cycle: "response",
24734
- mainPurpose: "end",
24735
- keepAlive: false,
24736
- next: false,
24737
- backpressure: false
24738
- };
24739
- return streamTrArg;
24740
- }
24741
- return relevantVirtualStream.handleStreamTr(streamTrArg);
24742
- }
24743
- };
24744
- }
24745
- });
24746
-
24747
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.virtualstream.js
24748
- var closingBit, VirtualStreamClosedError, VirtualStreamActivationScope, VirtualStream;
24749
- var init_classes_virtualstream = __esm({
24750
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.virtualstream.js"() {
24751
- init_plugins();
24752
- init_classes_typedrouter();
24753
- closingBit = "#############CLOSING BIT#############";
24754
- VirtualStreamClosedError = class extends Error {
24755
- static {
24756
- __name(this, "VirtualStreamClosedError");
24757
- }
24758
- constructor(messageArg = "VirtualStream is closed", optionsArg) {
24759
- super(messageArg, optionsArg);
24760
- this.name = "VirtualStreamClosedError";
24761
- }
24762
- };
24763
- VirtualStreamActivationScope = class {
24764
- static {
24765
- __name(this, "VirtualStreamActivationScope");
24766
- }
24767
- constructor() {
24768
- this.trackedStreams = /* @__PURE__ */ new Set();
24769
- this.settled = false;
24770
- }
24771
- track(streamArg) {
24772
- if (!this.settled) {
24773
- this.trackedStreams.add(streamArg);
24774
- }
24775
- }
24776
- commit() {
24777
- const streams = [...this.trackedStreams];
24778
- this.settled = true;
24779
- this.trackedStreams.clear();
24780
- for (const stream of streams) {
24781
- stream.commitActivation();
24782
- }
24783
- }
24784
- async rollback(reasonArg) {
24785
- if (this.settled) {
24786
- return;
24787
- }
24788
- this.settled = true;
24789
- const streams = [...this.trackedStreams];
24790
- this.trackedStreams.clear();
24791
- await Promise.all(streams.map((streamArg) => streamArg.abort(reasonArg)));
24792
- }
24793
- };
24794
- VirtualStream = class _VirtualStream {
24795
- static {
24796
- __name(this, "VirtualStream");
24797
- }
24798
- constructor() {
24799
- this.streamId = isounique2.uni();
24800
- this.lifecycleStateInternal = "idle";
24801
- this.keepAlive = true;
24802
- this.sendAdmissionTail = Promise.resolve();
24803
- this.frameAdmissionTail = Promise.resolve();
24804
- this.closeStarted = false;
24805
- this.activationCommitted = false;
24806
- this.activationResolvers = /* @__PURE__ */ new Set();
24807
- this.respondingDrainResolvers = /* @__PURE__ */ new Set();
24808
- this.sendBackpressuredArray = new dist_ts_exports7.BackpressuredArray(16);
24809
- this.receiveBackpressuredArray = new dist_ts_exports7.BackpressuredArray(16);
24810
- }
24811
- static {
24812
- this.respondingRegistrationIdleTimeoutMs = 15e3;
24813
- }
24814
- static {
24815
- this.gracefulCloseTimeoutMs = 1e4;
24816
- }
24817
- static encodePayloadForNetwork(objectPayload, commFunctions, originalPayload, path2 = []) {
24818
- if (!objectPayload) {
24819
- return objectPayload;
24820
- }
24821
- if (dist_ts_exports9.isBufferLike(objectPayload)) {
24822
- return objectPayload;
24823
- }
24824
- if (objectPayload instanceof _VirtualStream) {
24825
- objectPayload.activate(commFunctions);
24826
- if (!originalPayload?.response || path2.includes("response")) {
24827
- return {
24828
- _isVirtualStream: true,
24829
- streamId: objectPayload.streamId
24830
- };
24831
- }
24832
- return {
24833
- _OBMITTED_VIRTUAL_STREAM: true,
24834
- reason: "path is under .request: omitted for deduplication reasons in response cycle."
24835
- };
24836
- }
24837
- if (Array.isArray(objectPayload)) {
24838
- return objectPayload.map((item, index3) => _VirtualStream.encodePayloadForNetwork(item, commFunctions, originalPayload || objectPayload, path2.concat(String(index3))));
24839
- }
24840
- if (objectPayload !== null && typeof objectPayload === "object") {
24841
- if (objectPayload instanceof Set || objectPayload instanceof Map || objectPayload instanceof Date || objectPayload instanceof RegExp || objectPayload instanceof Error || objectPayload instanceof Promise || typeof objectPayload.then === "function") {
24842
- return objectPayload;
24843
- }
24844
- return Object.entries(objectPayload).reduce((accumulatorArg, [key2, value2]) => {
24845
- accumulatorArg[key2] = _VirtualStream.encodePayloadForNetwork(value2, commFunctions, originalPayload || objectPayload, path2.concat(key2));
24846
- return accumulatorArg;
24847
- }, {});
24848
- }
24849
- return objectPayload;
24850
- }
24851
- static decodePayloadFromNetwork(objectPayload, commFunctions) {
24852
- return _VirtualStream.decodePayloadFromNetworkInternal(objectPayload, commFunctions, /* @__PURE__ */ new Map());
24853
- }
24854
- static containsNetworkDescriptor(objectPayload) {
24855
- if (!objectPayload || dist_ts_exports9.isBufferLike(objectPayload) || typeof objectPayload !== "object") {
24856
- return false;
24857
- }
24858
- if (objectPayload._isVirtualStream === true) {
24859
- return true;
24860
- }
24861
- if (Array.isArray(objectPayload)) {
24862
- return objectPayload.some((itemArg) => _VirtualStream.containsNetworkDescriptor(itemArg));
24863
- }
24864
- return Object.values(objectPayload).some((valueArg) => _VirtualStream.containsNetworkDescriptor(valueArg));
24865
- }
24866
- static decodePayloadFromNetworkInternal(objectPayload, commFunctions, decodedStreamsArg) {
24867
- if (dist_ts_exports9.isBufferLike(objectPayload) || objectPayload instanceof TypedRouter) {
24868
- return objectPayload;
24869
- }
24870
- if (objectPayload === null || typeof objectPayload !== "object") {
24871
- return objectPayload;
24872
- }
24873
- if (objectPayload instanceof Set || objectPayload instanceof Map || objectPayload instanceof Date || objectPayload instanceof RegExp || objectPayload instanceof Error || objectPayload instanceof Promise || typeof objectPayload.then === "function") {
24874
- return objectPayload;
24875
- }
24876
- if (objectPayload._isVirtualStream === true) {
24877
- if (typeof objectPayload.streamId !== "string" || objectPayload.streamId.length === 0) {
24878
- throw new TypeError("VirtualStream network descriptor requires a non-empty streamId");
25670
+ if (this.incomingRequestAuthorityGuard) {
25671
+ const authorityContext = Object.freeze({
25672
+ typedRouter: this,
25673
+ trustedLocalData: trustedRouteLocalData,
25674
+ wireLocalDataPresent
25675
+ });
25676
+ let authorized = false;
25677
+ try {
25678
+ authorized = this.incomingRequestAuthorityGuard(typedRequestArg, authorityContext) === true;
25679
+ } catch {
24879
25680
  }
24880
- const decodedStream = decodedStreamsArg.get(objectPayload.streamId);
24881
- if (decodedStream) {
24882
- return decodedStream;
24883
- }
24884
- const registeredStream = commFunctions.typedrouter?.getRegisteredVirtualStreamById(objectPayload.streamId);
24885
- if (registeredStream) {
24886
- registeredStream.refreshRespondingRegistration();
24887
- decodedStreamsArg.set(objectPayload.streamId, registeredStream);
24888
- return registeredStream;
24889
- }
24890
- const virtualStream = new _VirtualStream();
24891
- virtualStream.streamId = objectPayload.streamId;
24892
- virtualStream.activate(commFunctions);
24893
- decodedStreamsArg.set(objectPayload.streamId, virtualStream);
24894
- return virtualStream;
24895
- }
24896
- if (Array.isArray(objectPayload)) {
24897
- return objectPayload.map((itemArg) => _VirtualStream.decodePayloadFromNetworkInternal(itemArg, commFunctions, decodedStreamsArg));
24898
- }
24899
- return Object.keys(objectPayload).reduce((accumulatorArg, keyArg) => {
24900
- accumulatorArg[keyArg] = _VirtualStream.decodePayloadFromNetworkInternal(objectPayload[keyArg], commFunctions, decodedStreamsArg);
24901
- return accumulatorArg;
24902
- }, {});
24903
- }
24904
- get lifecycleState() {
24905
- return this.lifecycleStateInternal;
24906
- }
24907
- activate(commFunctionsArg) {
24908
- if (this.lifecycleStateInternal === "closed") {
24909
- throw this.getCloseError();
24910
- }
24911
- const requestedSide = commFunctionsArg.sendMethod ? "requesting" : commFunctionsArg.typedrouter ? "responding" : void 0;
24912
- if (!requestedSide) {
24913
- throw new Error("VirtualStream requires a send method or TypedRouter");
25681
+ if (!authorized)
25682
+ return null;
24914
25683
  }
24915
- if (this.lifecycleStateInternal === "active" && this.side !== requestedSide) {
24916
- throw new Error(`VirtualStream ${this.streamId} is already active on the ${this.side} side`);
25684
+ let requestSignalRegistration;
25685
+ let trustedAbortSignal = options2.trustedAbortSignal;
25686
+ if (trustedAbortSignal !== void 0 && !this.isAbortSignal(trustedAbortSignal)) {
25687
+ throw new TypeError("TypedRouter trustedAbortSignal must be an AbortSignal");
24917
25688
  }
24918
- const newlyActivated = this.lifecycleStateInternal === "idle";
24919
- this.lifecycleStateInternal = "active";
24920
- this.keepAlive = true;
24921
- this.side = requestedSide;
24922
- if (requestedSide === "requesting") {
24923
- this.sendMethod = commFunctionsArg.sendMethod;
24924
- } else {
24925
- this.typedrouter = commFunctionsArg.typedrouter;
24926
- const registeredStream = this.typedrouter.registerVirtualStream(this);
24927
- if (registeredStream !== this) {
24928
- this.lifecycleStateInternal = "idle";
24929
- this.typedrouter = void 0;
24930
- throw new Error(`VirtualStream ${this.streamId} is already registered on this router`);
24931
- }
24932
- this.refreshRespondingRegistration();
24933
- }
24934
- if (newlyActivated) {
24935
- if (commFunctionsArg.activationScope) {
24936
- commFunctionsArg.activationScope.track(this);
24937
- } else {
24938
- this.commitActivation();
25689
+ if (!trustedAbortSignal && this.incomingRequestSignalResolver) {
25690
+ if (typeof typedRequestArg.requestInstanceId !== "string" || typedRequestArg.requestInstanceId.length === 0) {
25691
+ return null;
24939
25692
  }
24940
- }
24941
- }
24942
- commitActivation() {
24943
- if (this.lifecycleStateInternal === "active" && this.side === "requesting") {
24944
- this.activationCommitted = true;
24945
- const activationResolvers = [...this.activationResolvers];
24946
- this.activationResolvers.clear();
24947
- for (const resolve2 of activationResolvers) {
24948
- resolve2();
25693
+ const signalContext = Object.freeze({
25694
+ typedRouter: this,
25695
+ trustedLocalData: trustedRouteLocalData,
25696
+ wireLocalDataPresent
25697
+ });
25698
+ try {
25699
+ requestSignalRegistration = this.incomingRequestSignalResolver(typedRequestArg, signalContext);
25700
+ } catch {
25701
+ return null;
24949
25702
  }
24950
- this.startKeepAliveLoop();
24951
- this.ensureQueueWork();
24952
- }
24953
- }
24954
- getCloseError(reasonArg) {
24955
- if (!this.closeError) {
24956
- this.closeError = new VirtualStreamClosedError("VirtualStream is closed", reasonArg === void 0 ? void 0 : { cause: reasonArg });
24957
- }
24958
- return this.closeError;
24959
- }
24960
- assertNotClosed() {
24961
- if (this.lifecycleStateInternal === "closed") {
24962
- throw this.getCloseError();
24963
- }
24964
- }
24965
- assertCanSend() {
24966
- this.assertNotClosed();
24967
- if (this.closeStarted) {
24968
- throw new VirtualStreamClosedError("VirtualStream is closing");
24969
- }
24970
- }
24971
- async acquireSendAdmission() {
24972
- const previousAdmission = this.sendAdmissionTail;
24973
- let releaseAdmission;
24974
- this.sendAdmissionTail = new Promise((resolve2) => {
24975
- releaseAdmission = resolve2;
24976
- });
24977
- await previousAdmission;
24978
- return releaseAdmission;
24979
- }
24980
- async acquireFrameAdmission() {
24981
- const previousAdmission = this.frameAdmissionTail;
24982
- let releaseAdmission;
24983
- this.frameAdmissionTail = new Promise((resolve2) => {
24984
- releaseAdmission = resolve2;
24985
- });
24986
- await previousAdmission;
24987
- return releaseAdmission;
24988
- }
24989
- async waitForOutboundDrain() {
24990
- while (this.sendBackpressuredArray.data.length > 0 || this.queueWorkPromise) {
24991
- this.assertNotClosed();
24992
- this.ensureQueueWork();
24993
- const currentQueueWork = this.queueWorkPromise;
24994
- if (currentQueueWork) {
24995
- await currentQueueWork;
24996
- } else if (!this.activationCommitted) {
24997
- await new Promise((resolve2) => {
24998
- this.activationResolvers.add(resolve2);
24999
- });
25703
+ if (requestSignalRegistration && (!this.isAbortSignal(requestSignalRegistration.abortSignal) || typeof requestSignalRegistration.complete !== "function")) {
25704
+ try {
25705
+ requestSignalRegistration.complete?.();
25706
+ } catch {
25707
+ }
25708
+ return null;
25000
25709
  }
25710
+ trustedAbortSignal = requestSignalRegistration?.abortSignal;
25001
25711
  }
25002
- this.assertNotClosed();
25003
- }
25004
- async waitWithinGracefulCloseDeadline(promiseArg) {
25005
- let timeout2;
25006
- const timeoutPromise = new Promise((_resolve, reject) => {
25007
- timeout2 = setTimeout(() => {
25008
- reject(new VirtualStreamClosedError("VirtualStream graceful close timed out"));
25009
- }, _VirtualStream.gracefulCloseTimeoutMs);
25010
- timeout2.unref?.();
25011
- });
25712
+ let virtualStreamTransport;
25012
25713
  try {
25013
- await Promise.race([promiseArg, timeoutPromise]);
25014
- } finally {
25015
- if (timeout2) {
25016
- clearTimeout(timeout2);
25714
+ virtualStreamTransport = this.virtualStreamTransportResolver?.(trustedRouteLocalData);
25715
+ } catch (error) {
25716
+ try {
25717
+ requestSignalRegistration?.complete();
25718
+ } catch {
25017
25719
  }
25720
+ throw error;
25018
25721
  }
25019
- }
25020
- async waitForRespondingDrain() {
25021
- if (this.sendBackpressuredArray.data.length === 0) {
25022
- return;
25023
- }
25024
- await new Promise((resolve2) => {
25025
- this.respondingDrainResolvers.add(resolve2);
25026
- });
25027
- }
25028
- resolveRespondingDrain() {
25029
- if (this.sendBackpressuredArray.data.length > 0) {
25030
- return;
25031
- }
25032
- const drainResolvers = [...this.respondingDrainResolvers];
25033
- this.respondingDrainResolvers.clear();
25034
- for (const resolve2 of drainResolvers) {
25035
- resolve2();
25036
- }
25037
- }
25038
- static reconstituteBinaryData(data) {
25039
- if (data == null || data instanceof Uint8Array || typeof Buffer !== "undefined" && Buffer.isBuffer(data)) {
25040
- return data;
25041
- }
25042
- if (typeof data === "object") {
25043
- if (data.type === "EncodedBuffer" && typeof data.data === "string" && data.data.startsWith("base64:")) {
25044
- const base64Data = data.data.slice("base64:".length);
25045
- if (typeof Buffer !== "undefined") {
25046
- const buffer2 = Buffer.from(base64Data, "base64");
25047
- return new Uint8Array(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength);
25722
+ const requestActivationScope = new VirtualStreamActivationScope();
25723
+ const responseActivationScope = new VirtualStreamActivationScope();
25724
+ const rollbackRouteActivations = /* @__PURE__ */ __name(async (reasonArg) => {
25725
+ await Promise.allSettled([
25726
+ requestActivationScope.rollback(reasonArg),
25727
+ responseActivationScope.rollback(reasonArg)
25728
+ ]);
25729
+ }, "rollbackRouteActivations");
25730
+ const commitRouteActivations = /* @__PURE__ */ __name(() => {
25731
+ requestActivationScope.commit();
25732
+ responseActivationScope.commit();
25733
+ }, "commitRouteActivations");
25734
+ const encodeResponse = /* @__PURE__ */ __name(async () => {
25735
+ delete typedRequestArg.localData;
25736
+ return VirtualStream.encodePayloadForNetwork(typedRequestArg, {
25737
+ side: "responding",
25738
+ virtualStreamTransport,
25739
+ activationScope: responseActivationScope
25740
+ });
25741
+ }, "encodeResponse");
25742
+ try {
25743
+ typedRequestArg = await VirtualStream.decodePayloadFromNetworkAsync(typedRequestArg, {
25744
+ side: "responding",
25745
+ virtualStreamTransport,
25746
+ activationScope: requestActivationScope,
25747
+ abortSignal: trustedAbortSignal
25748
+ });
25749
+ typedRequestArg.localData = { ...trustedRouteLocalData };
25750
+ typedRequestArg.localData.firstTypedrouter = this;
25751
+ if (typedRequestArg?.correlation?.phase === "request") {
25752
+ const requestStartTime = Date.now();
25753
+ if (!options2.skipHooks) {
25754
+ this.callHook("onIncomingRequest", {
25755
+ correlationId: typedRequestArg.correlation?.id || "unknown",
25756
+ method: typedRequestArg.method,
25757
+ direction: "incoming",
25758
+ phase: "request",
25759
+ timestamp: requestStartTime,
25760
+ payload: typedRequestArg.request
25761
+ });
25048
25762
  }
25049
- return new Uint8Array(Array.from(atob(base64Data)).map((characterArg) => characterArg.charCodeAt(0)));
25050
- }
25051
- if (data.type === "Buffer" && Array.isArray(data.data)) {
25052
- return new Uint8Array(data.data);
25053
- }
25054
- const keys3 = Object.keys(data);
25055
- if (keys3.length > 0 && keys3.every((keyArg) => /^\d+$/.test(keyArg))) {
25056
- const array = new Array(keys3.length);
25057
- for (const keyArg of keys3) {
25058
- array[Number(keyArg)] = data[keyArg];
25763
+ const result = this.getTypedHandlerAndRouter(typedRequestArg.method);
25764
+ if (!result) {
25765
+ console.log(`Cannot find handler for methodname ${typedRequestArg.method}`);
25766
+ typedRequestArg.error = {
25767
+ text: "There is no available method for this call on the server side",
25768
+ data: {}
25769
+ };
25770
+ typedRequestArg.correlation.phase = "response";
25771
+ typedRequestArg = await encodeResponse();
25772
+ await rollbackRouteActivations(typedRequestArg.error);
25773
+ if (!options2.skipHooks) {
25774
+ this.callHook("onOutgoingResponse", {
25775
+ correlationId: typedRequestArg.correlation?.id || "unknown",
25776
+ method: typedRequestArg.method,
25777
+ direction: "outgoing",
25778
+ phase: "response",
25779
+ timestamp: Date.now(),
25780
+ durationMs: Date.now() - requestStartTime,
25781
+ payload: typedRequestArg.response,
25782
+ errorText: typedRequestArg.error?.text
25783
+ });
25784
+ }
25785
+ this.assertTrustedAbortSignalActive(trustedAbortSignal);
25786
+ return typedRequestArg;
25059
25787
  }
25060
- if (array.every((valueArg) => typeof valueArg === "number")) {
25061
- return new Uint8Array(array);
25788
+ const { handler: typedHandler, router: owningRouter } = result;
25789
+ if (owningRouter.middlewares.length > 0) {
25790
+ try {
25791
+ for (const mw of owningRouter.middlewares) {
25792
+ await mw(typedRequestArg);
25793
+ }
25794
+ } catch (e10) {
25795
+ this.setErrorFromCaughtError(typedRequestArg, e10, `middleware for method '${typedRequestArg.method}'`);
25796
+ typedRequestArg.correlation.phase = "response";
25797
+ typedRequestArg = await encodeResponse();
25798
+ await rollbackRouteActivations(e10);
25799
+ if (!options2.skipHooks) {
25800
+ this.callHook("onOutgoingResponse", {
25801
+ correlationId: typedRequestArg.correlation?.id || "unknown",
25802
+ method: typedRequestArg.method,
25803
+ direction: "outgoing",
25804
+ phase: "response",
25805
+ timestamp: Date.now(),
25806
+ durationMs: Date.now() - requestStartTime,
25807
+ payload: typedRequestArg.response,
25808
+ errorText: typedRequestArg.error?.text
25809
+ });
25810
+ }
25811
+ this.assertTrustedAbortSignalActive(trustedAbortSignal);
25812
+ return typedRequestArg;
25813
+ }
25062
25814
  }
25815
+ requestActivationScope.authorizeApplicationUse();
25816
+ typedRequestArg = await typedHandler.addResponse(typedRequestArg, trustedAbortSignal);
25817
+ const handlerFailed = Boolean(typedRequestArg.error);
25818
+ typedRequestArg = await encodeResponse();
25819
+ if (handlerFailed) {
25820
+ await rollbackRouteActivations(typedRequestArg.error);
25821
+ }
25822
+ if (!options2.skipHooks) {
25823
+ this.callHook("onOutgoingResponse", {
25824
+ correlationId: typedRequestArg.correlation?.id || "unknown",
25825
+ method: typedRequestArg.method,
25826
+ direction: "outgoing",
25827
+ phase: "response",
25828
+ timestamp: Date.now(),
25829
+ durationMs: Date.now() - requestStartTime,
25830
+ payload: typedRequestArg.response,
25831
+ errorText: typedRequestArg.error?.text
25832
+ });
25833
+ }
25834
+ if (!handlerFailed) {
25835
+ this.assertTrustedAbortSignalActive(trustedAbortSignal);
25836
+ commitRouteActivations();
25837
+ }
25838
+ this.assertTrustedAbortSignalActive(trustedAbortSignal);
25839
+ return typedRequestArg;
25063
25840
  }
25064
- }
25065
- return data;
25066
- }
25067
- ensureQueueWork() {
25068
- if (this.lifecycleStateInternal === "closed" || this.side !== "requesting" || !this.activationCommitted || this.queueWorkPromise) {
25069
- return;
25070
- }
25071
- this.queueWorkPromise = this.workOnQueue().catch(async (errorArg) => {
25072
- await this.abort(errorArg);
25073
- }).finally(() => {
25074
- this.queueWorkPromise = void 0;
25075
- if (this.lifecycleStateInternal === "active" && this.side === "requesting" && this.sendBackpressuredArray.data.length > 0) {
25076
- this.ensureQueueWork();
25077
- }
25078
- });
25079
- }
25080
- async workOnQueue() {
25081
- this.assertNotClosed();
25082
- let thisSideIsBackpressured = !this.receiveBackpressuredArray.checkSpaceAvailable();
25083
- let otherSideHasNext = false;
25084
- let otherSideIsBackpressured = false;
25085
- const getFeedback = /* @__PURE__ */ __name(async () => {
25086
- const streamTr = await this.sendStreamRequest({
25087
- streamId: this.streamId,
25088
- cycleId: isounique2.uni(),
25089
- cycle: "request",
25090
- mainPurpose: "feedback",
25091
- next: this.sendBackpressuredArray.data.length > 0,
25092
- backpressure: !this.receiveBackpressuredArray.checkSpaceAvailable()
25093
- });
25094
- if (!this.acceptRemoteResponse(streamTr)) {
25095
- return;
25096
- }
25097
- otherSideIsBackpressured = Boolean(streamTr.response?.backpressure);
25098
- otherSideHasNext = Boolean(streamTr.response?.next);
25099
- }, "getFeedback");
25100
- await getFeedback();
25101
- while (this.sendBackpressuredArray.data.length > 0 || otherSideHasNext) {
25102
- this.assertNotClosed();
25103
- if (otherSideHasNext && this.sendBackpressuredArray.data.length === 0 && !this.receiveBackpressuredArray.checkSpaceAvailable()) {
25104
- await this.receiveBackpressuredArray.waitForSpace();
25105
- this.assertNotClosed();
25106
- thisSideIsBackpressured = !this.receiveBackpressuredArray.checkSpaceAvailable();
25107
- }
25108
- while (otherSideIsBackpressured) {
25109
- await dist_ts_exports3.delayFor(50);
25110
- this.assertNotClosed();
25111
- await getFeedback();
25112
- }
25113
- const dataArg = this.sendBackpressuredArray.data.length > 0 ? this.sendBackpressuredArray.shift() : void 0;
25114
- const streamTr = await this.sendStreamRequest({
25115
- streamId: this.streamId,
25116
- cycleId: isounique2.uni(),
25117
- cycle: "request",
25118
- mainPurpose: dataArg === void 0 ? "read" : "chunk",
25119
- backpressure: thisSideIsBackpressured,
25120
- next: this.sendBackpressuredArray.data.length > 0,
25121
- ...dataArg === void 0 ? {} : { chunkData: dataArg }
25122
- });
25123
- if (!this.acceptRemoteResponse(streamTr)) {
25124
- return;
25125
- }
25126
- otherSideIsBackpressured = Boolean(streamTr.response?.backpressure);
25127
- thisSideIsBackpressured = !this.receiveBackpressuredArray.checkSpaceAvailable();
25128
- otherSideHasNext = Boolean(streamTr.response?.next);
25129
- }
25130
- }
25131
- async sendStreamRequest(requestArg) {
25132
- const releaseAdmission = await this.acquireFrameAdmission();
25133
- try {
25134
- this.assertNotClosed();
25135
- if (!this.sendMethod) {
25136
- throw new Error("VirtualStream is missing a send method");
25137
- }
25138
- return await this.sendMethod({
25139
- method: "##VirtualStream##",
25140
- request: requestArg,
25141
- response: null
25142
- });
25841
+ await rollbackRouteActivations(new Error("TypedRouter received an unroutable request DTO"));
25842
+ this.assertTrustedAbortSignalActive(trustedAbortSignal);
25843
+ return null;
25844
+ } catch (error) {
25845
+ await rollbackRouteActivations(error);
25846
+ throw error;
25143
25847
  } finally {
25144
- releaseAdmission();
25145
- }
25146
- }
25147
- acceptRemoteResponse(streamTrArg) {
25148
- if (this.lifecycleStateInternal === "closed") {
25149
- return false;
25150
- }
25151
- const responseChunk = streamTrArg.response?.chunkData;
25152
- if (responseChunk !== void 0) {
25153
- this.receiveBackpressuredArray.push(_VirtualStream.reconstituteBinaryData(responseChunk));
25154
- }
25155
- if (streamTrArg.response?.keepAlive === false || streamTrArg.response?.mainPurpose === "end") {
25156
- this.terminate(new VirtualStreamClosedError("Remote VirtualStream is closed"), responseChunk === closingBit);
25157
- return false;
25158
- }
25159
- return true;
25160
- }
25161
- async handleStreamTr(streamTrArg) {
25162
- if (this.lifecycleStateInternal === "closed") {
25163
- streamTrArg.response = this.createClosedResponse(streamTrArg);
25164
- return streamTrArg;
25165
- }
25166
- this.refreshRespondingRegistration();
25167
- if (streamTrArg.request.keepAlive === false || streamTrArg.request.mainPurpose === "end") {
25168
- streamTrArg.response = this.createClosedResponse(streamTrArg);
25169
- await this.abort();
25170
- return streamTrArg;
25171
- }
25172
- const receivedClosingBit = streamTrArg.request.chunkData === closingBit;
25173
- if (streamTrArg.request.chunkData !== void 0) {
25174
- this.receiveBackpressuredArray.push(_VirtualStream.reconstituteBinaryData(streamTrArg.request.chunkData));
25175
- }
25176
- const requesterIsBackpressured = Boolean(streamTrArg.request.backpressure);
25177
- const responseChunk = !receivedClosingBit && !requesterIsBackpressured && this.sendBackpressuredArray.data.length > 0 ? this.sendBackpressuredArray.shift() : void 0;
25178
- this.resolveRespondingDrain();
25179
- const sentClosingBit = responseChunk === closingBit;
25180
- streamTrArg.response = {
25181
- streamId: this.streamId,
25182
- cycleId: streamTrArg.request.cycleId,
25183
- cycle: "response",
25184
- mainPurpose: sentClosingBit ? "end" : responseChunk !== void 0 ? "chunk" : streamTrArg.request.mainPurpose === "keepAlive" ? "keepAlive" : "feedback",
25185
- keepAlive: !sentClosingBit,
25186
- next: this.sendBackpressuredArray.data.length > 0,
25187
- backpressure: !this.receiveBackpressuredArray.checkSpaceAvailable(),
25188
- ...responseChunk === void 0 ? {} : { chunkData: responseChunk }
25189
- };
25190
- if (receivedClosingBit || sentClosingBit) {
25191
- streamTrArg.response.mainPurpose = "end";
25192
- streamTrArg.response.keepAlive = false;
25193
- this.terminate(void 0, receivedClosingBit);
25194
- }
25195
- return streamTrArg;
25196
- }
25197
- createClosedResponse(streamTrArg) {
25198
- return {
25199
- streamId: streamTrArg.request.streamId,
25200
- cycleId: streamTrArg.request.cycleId,
25201
- cycle: "response",
25202
- mainPurpose: "end",
25203
- keepAlive: false,
25204
- next: false,
25205
- backpressure: false
25206
- };
25207
- }
25208
- refreshRespondingRegistration() {
25209
- if (this.side !== "responding" || this.lifecycleStateInternal !== "active") {
25210
- return;
25211
- }
25212
- if (this.respondingExpiryTimer) {
25213
- clearTimeout(this.respondingExpiryTimer);
25214
- }
25215
- this.respondingExpiryTimer = setTimeout(() => {
25216
- void this.abort(new VirtualStreamClosedError("Responding VirtualStream registration expired"));
25217
- }, _VirtualStream.respondingRegistrationIdleTimeoutMs);
25218
- this.respondingExpiryTimer.unref?.();
25219
- }
25220
- async cleanup() {
25221
- await this.abort();
25222
- }
25223
- cleanupRegistration() {
25224
- if (this.respondingExpiryTimer) {
25225
- clearTimeout(this.respondingExpiryTimer);
25226
- this.respondingExpiryTimer = void 0;
25227
- }
25228
- if (this.typedrouter) {
25229
- const typedrouter = this.typedrouter;
25230
- this.typedrouter = void 0;
25231
- typedrouter.unregisterVirtualStream(this);
25232
- }
25233
- }
25234
- startKeepAliveLoop() {
25235
- if (this.side !== "requesting" || this.lifecycleStateInternal === "closed" || this.keepAliveLoopPromise) {
25236
- return;
25237
- }
25238
- this.keepAliveLoopPromise = this.runKeepAliveLoop().catch(async (errorArg) => {
25239
- await this.abort(errorArg);
25240
- }).finally(() => {
25241
- this.keepAliveLoopPromise = void 0;
25242
- });
25243
- }
25244
- async runKeepAliveLoop() {
25245
- await dist_ts_exports3.delayFor(0);
25246
- while (this.keepAlive && this.lifecycleStateInternal === "active") {
25247
- await this.triggerKeepAlive();
25248
- if (this.keepAlive && this.lifecycleStateInternal === "active") {
25249
- await dist_ts_exports3.delayFor(1e3);
25848
+ try {
25849
+ requestSignalRegistration?.complete();
25850
+ } catch {
25250
25851
  }
25251
25852
  }
25252
25853
  }
25253
- async triggerKeepAlive() {
25254
- const streamTr = await this.sendStreamRequest({
25255
- streamId: this.streamId,
25256
- cycleId: isounique2.uni(),
25257
- cycle: "request",
25258
- mainPurpose: "keepAlive",
25259
- keepAlive: true,
25260
- backpressure: !this.receiveBackpressuredArray.checkSpaceAvailable()
25261
- });
25262
- if (!this.acceptRemoteResponse(streamTr)) {
25263
- return;
25264
- }
25265
- if (streamTr.response?.next) {
25266
- this.ensureQueueWork();
25267
- }
25268
- }
25269
- async sendData(dataArg) {
25270
- const releaseAdmission = await this.acquireSendAdmission();
25271
- try {
25272
- this.assertCanSend();
25273
- await this.sendBackpressuredArray.waitForSpace();
25274
- this.assertCanSend();
25275
- this.sendBackpressuredArray.push(dataArg);
25276
- this.ensureQueueWork();
25277
- await this.sendBackpressuredArray.waitForSpace();
25278
- this.assertCanSend();
25279
- } finally {
25280
- releaseAdmission();
25281
- }
25282
- }
25283
- async fetchData() {
25284
- if (this.receiveBackpressuredArray.checkHasItems()) {
25285
- return this.receiveBackpressuredArray.shift();
25286
- }
25287
- this.assertNotClosed();
25288
- await this.receiveBackpressuredArray.waitForItems();
25289
- if (!this.receiveBackpressuredArray.checkHasItems()) {
25290
- throw this.getCloseError();
25291
- }
25292
- return this.receiveBackpressuredArray.shift();
25293
- }
25294
- async readFromWebstream(readableStreamArg, closeAfterReading = true) {
25295
- const reader = readableStreamArg.getReader();
25854
+ sanitizeIncomingLocalData(typedRequestArg) {
25296
25855
  try {
25297
- let streamIsDone = false;
25298
- while (!streamIsDone) {
25299
- const { value: value2, done } = await reader.read();
25300
- if (value2 !== void 0) {
25301
- await this.sendData(value2);
25302
- }
25303
- streamIsDone = done;
25856
+ const ownProperty = Reflect.getOwnPropertyDescriptor(typedRequestArg, "localData");
25857
+ if (ownProperty && (ownProperty.configurable !== true || !Reflect.deleteProperty(typedRequestArg, "localData"))) {
25858
+ return false;
25304
25859
  }
25305
- if (closeAfterReading) {
25306
- await this.close(true);
25860
+ if (!Reflect.has(typedRequestArg, "localData")) {
25861
+ return true;
25307
25862
  }
25308
- } finally {
25309
- reader.releaseLock();
25310
- }
25311
- }
25312
- async writeToWebstream(writableStreamArg) {
25313
- const writer = writableStreamArg.getWriter();
25314
- try {
25315
- while (this.lifecycleStateInternal !== "closed" || this.receiveBackpressuredArray.checkHasItems()) {
25316
- const value2 = await this.fetchData();
25317
- if (value2 === closingBit) {
25318
- break;
25319
- }
25320
- await writer.write(value2);
25863
+ if (!Reflect.isExtensible(typedRequestArg)) {
25864
+ return false;
25321
25865
  }
25322
- await writer.close();
25323
- } finally {
25324
- writer.releaseLock();
25325
- }
25326
- }
25327
- async close(sendClosingBitArg = false) {
25328
- if (this.lifecycleStateInternal === "closed") {
25329
- return;
25330
- }
25331
- this.closeStarted = true;
25332
- if (sendClosingBitArg) {
25333
- if (this.side === "requesting" && this.sendMethod) {
25334
- try {
25335
- await this.waitWithinGracefulCloseDeadline(this.waitForOutboundDrain());
25336
- await this.sendStreamRequest({
25337
- streamId: this.streamId,
25338
- cycleId: isounique2.uni(),
25339
- cycle: "request",
25340
- mainPurpose: "chunk",
25341
- chunkData: closingBit,
25342
- next: false,
25343
- backpressure: false
25344
- });
25345
- } catch {
25346
- }
25347
- } else if (this.side === "responding") {
25348
- this.sendBackpressuredArray.push(closingBit);
25349
- try {
25350
- await this.waitWithinGracefulCloseDeadline(this.waitForRespondingDrain());
25351
- } catch {
25352
- }
25866
+ if (!Reflect.defineProperty(typedRequestArg, "localData", {
25867
+ configurable: true,
25868
+ enumerable: false,
25869
+ value: void 0,
25870
+ writable: true
25871
+ })) {
25872
+ return false;
25353
25873
  }
25874
+ const maskProperty = Reflect.getOwnPropertyDescriptor(typedRequestArg, "localData");
25875
+ return Boolean(maskProperty && maskProperty.configurable === true && maskProperty.enumerable === false && maskProperty.value === void 0 && maskProperty.writable === true);
25876
+ } catch {
25877
+ return false;
25354
25878
  }
25355
- await this.abort();
25356
25879
  }
25357
- async abort(reasonArg) {
25358
- this.terminate(reasonArg);
25880
+ isAbortSignal(valueArg) {
25881
+ return Boolean(valueArg && typeof valueArg === "object" && typeof Reflect.get(valueArg, "aborted") === "boolean" && typeof Reflect.get(valueArg, "addEventListener") === "function" && typeof Reflect.get(valueArg, "removeEventListener") === "function");
25359
25882
  }
25360
- terminate(reasonArg, preserveReceivedDataArg = false) {
25361
- if (this.lifecycleStateInternal === "closed") {
25883
+ assertTrustedAbortSignalActive(signalArg) {
25884
+ if (!signalArg?.aborted)
25362
25885
  return;
25363
- }
25364
- this.getCloseError(reasonArg);
25365
- this.lifecycleStateInternal = "closed";
25366
- this.keepAlive = false;
25367
- this.activationCommitted = false;
25368
- this.sendMethod = void 0;
25369
- this.sendBackpressuredArray.data.length = 0;
25370
- if (!preserveReceivedDataArg) {
25371
- this.receiveBackpressuredArray.data.length = 0;
25372
- }
25373
- this.sendBackpressuredArray.destroy();
25374
- this.receiveBackpressuredArray.destroy();
25375
- const activationResolvers = [...this.activationResolvers];
25376
- this.activationResolvers.clear();
25377
- for (const resolve2 of activationResolvers) {
25378
- resolve2();
25379
- }
25380
- const drainResolvers = [...this.respondingDrainResolvers];
25381
- this.respondingDrainResolvers.clear();
25382
- for (const resolve2 of drainResolvers) {
25383
- resolve2();
25384
- }
25385
- this.cleanupRegistration();
25886
+ throw signalArg.reason ?? new DOMException("The operation was aborted", "AbortError");
25386
25887
  }
25387
25888
  };
25388
25889
  }
25389
25890
  });
25390
25891
 
25391
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedtarget.js
25892
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedtarget.js
25392
25893
  var TypedTarget;
25393
25894
  var init_classes_typedtarget = __esm({
25394
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedtarget.js"() {
25895
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedtarget.js"() {
25395
25896
  init_classes_typedrouter();
25396
25897
  init_plugins();
25397
25898
  TypedTarget = class {
@@ -25420,7 +25921,11 @@ var init_classes_typedtarget = __esm({
25420
25921
  }
25421
25922
  let responseInterest;
25422
25923
  if (this.options.typedRouterRef) {
25423
- responseInterest = await this.options.typedRouterRef.fireEventInterestMap.addInterest(payloadArg.correlation.id, payloadArg);
25924
+ const responseInterestKey = getTypedRequestResponseInterestKey(payloadArg);
25925
+ if (!responseInterestKey) {
25926
+ throw new TypeError("TypedTarget request response identity is malformed");
25927
+ }
25928
+ responseInterest = await this.options.typedRouterRef.fireEventInterestMap.addInterest(responseInterestKey, payloadArg);
25424
25929
  }
25425
25930
  const signal = optionsArg.signal;
25426
25931
  if (signal?.aborted) {
@@ -25471,10 +25976,10 @@ var init_classes_typedtarget = __esm({
25471
25976
  }
25472
25977
  });
25473
25978
 
25474
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedrequest.js
25475
- var webrequestInstance, maxTimeoutMs, virtualStreamFrameTimeoutMs, TypedRequestTimeoutError, TypedRequestRetryLimitError, TypedRequest;
25979
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedrequest.js
25980
+ var webrequestInstance, maxTimeoutMs, TypedRequestTimeoutError, TypedRequestRetryLimitError, TypedRequest;
25476
25981
  var init_classes_typedrequest = __esm({
25477
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/classes.typedrequest.js"() {
25982
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/classes.typedrequest.js"() {
25478
25983
  init_plugins();
25479
25984
  init_classes_virtualstream();
25480
25985
  init_classes_typedresponseerror();
@@ -25482,7 +25987,6 @@ var init_classes_typedrequest = __esm({
25482
25987
  init_classes_typedtarget();
25483
25988
  webrequestInstance = new dist_ts_exports15.WebrequestClient();
25484
25989
  maxTimeoutMs = 2147483647;
25485
- virtualStreamFrameTimeoutMs = 1e4;
25486
25990
  TypedRequestTimeoutError = class extends Error {
25487
25991
  static {
25488
25992
  __name(this, "TypedRequestTimeoutError");
@@ -25528,32 +26032,38 @@ var init_classes_typedrequest = __esm({
25528
26032
  async fire(fireArg, fireOptionsArg = false) {
25529
26033
  const requestStartTime = Date.now();
25530
26034
  const fireOptions = this.resolveFireOptions(fireOptionsArg);
26035
+ const abortContext = this.createAbortContext(fireOptions);
26036
+ fireOptions.abortSignal = abortContext.signal;
25531
26037
  const activationScope = new VirtualStreamActivationScope();
25532
26038
  let payloadSending = {
25533
26039
  method: this.method,
25534
26040
  request: fireArg,
25535
26041
  response: null,
26042
+ requestInstanceId: isounique2.uni(),
25536
26043
  correlation: {
25537
26044
  id: isounique2.uni(),
25538
26045
  phase: "request"
25539
26046
  }
25540
26047
  };
25541
26048
  try {
25542
- payloadSending = VirtualStream.encodePayloadForNetwork(payloadSending, {
25543
- sendMethod: /* @__PURE__ */ __name((payloadArg) => this.postStreamTrObject(payloadArg), "sendMethod"),
25544
- activationScope
26049
+ this.assertActive(fireOptions);
26050
+ const encodedPayload = VirtualStream.encodePayloadForNetworkWithMetadata(payloadSending, {
26051
+ side: "requesting",
26052
+ activationScope,
26053
+ virtualStreamTransport: this.typedTarget?.options.virtualStreamTransport
25545
26054
  });
25546
- const payloadContainsVirtualStream = VirtualStream.containsNetworkDescriptor(payloadSending);
26055
+ payloadSending = encodedPayload.payload;
26056
+ const payloadContainsVirtualStream = encodedPayload.containsNetworkDescriptor;
25547
26057
  if (payloadContainsVirtualStream && !this.urlEndPoint && this.typedTarget.options.supportsAbortSignal !== true) {
25548
26058
  throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");
25549
26059
  }
25550
26060
  if (fireOptions.useCache && payloadContainsVirtualStream) {
25551
26061
  throw new Error("TypedRequest response caching is not supported for requests containing VirtualStreams");
25552
26062
  }
25553
- this.assertDeadline(fireOptions);
26063
+ this.assertActive(fireOptions);
25554
26064
  if (fireOptions.useCache) {
25555
26065
  fireOptions.cacheKey = await this.createCacheKey(payloadSending);
25556
- this.assertDeadline(fireOptions);
26066
+ this.assertActive(fireOptions);
25557
26067
  }
25558
26068
  if (!this.skipHooks) {
25559
26069
  dispatchTypedRequestHook("onOutgoingRequest", {
@@ -25565,9 +26075,11 @@ var init_classes_typedrequest = __esm({
25565
26075
  payload: fireArg
25566
26076
  });
25567
26077
  }
26078
+ activationScope.publish();
25568
26079
  let payloadReceiving = await this.postTrObject(payloadSending, fireOptions);
26080
+ delete payloadReceiving.localData;
25569
26081
  const finalResponseError = payloadReceiving.error;
25570
- this.assertDeadline(fireOptions);
26082
+ this.assertActive(fireOptions);
25571
26083
  if (finalResponseError) {
25572
26084
  if (!this.skipHooks) {
25573
26085
  dispatchTypedRequestHook("onIncomingResponse", {
@@ -25581,22 +26093,29 @@ var init_classes_typedrequest = __esm({
25581
26093
  errorText: finalResponseError.text
25582
26094
  });
25583
26095
  }
25584
- this.assertDeadline(fireOptions);
26096
+ this.assertActive(fireOptions);
25585
26097
  throw new TypedResponseError(finalResponseError.text, finalResponseError.data);
25586
26098
  }
25587
- const responseContainsVirtualStream = VirtualStream.containsNetworkDescriptor(payloadReceiving);
25588
- if (responseContainsVirtualStream && !this.urlEndPoint && this.typedTarget.options.supportsAbortSignal !== true) {
26099
+ let response = payloadReceiving.response;
26100
+ if (!this.urlEndPoint && this.typedTarget.options.supportsAbortSignal !== true && VirtualStream.containsNetworkDescriptor(response)) {
25589
26101
  throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");
25590
26102
  }
25591
- if (fireOptions.useCache && fireOptions.cacheKey && responseContainsVirtualStream) {
25592
- await webrequestInstance.deleteCache(fireOptions.cacheKey);
25593
- this.assertDeadline(fireOptions);
26103
+ try {
26104
+ response = await VirtualStream.decodePayloadFromNetworkAsync(response, {
26105
+ side: "requesting",
26106
+ activationScope,
26107
+ virtualStreamTransport: this.typedTarget?.options.virtualStreamTransport,
26108
+ openDeadlineAt: fireOptions.deadlineAt,
26109
+ abortSignal: fireOptions.abortSignal
26110
+ });
26111
+ } catch (error) {
26112
+ if (error instanceof VirtualStreamOpenTimeoutError && fireOptions.deadlineAt !== void 0 && error.deadlineAt === fireOptions.deadlineAt) {
26113
+ throw this.createTimeoutError(fireOptions);
26114
+ }
26115
+ throw error;
25594
26116
  }
25595
- payloadReceiving = VirtualStream.decodePayloadFromNetwork(payloadReceiving, {
25596
- sendMethod: /* @__PURE__ */ __name((payloadArg) => this.postStreamTrObject(payloadArg), "sendMethod"),
25597
- activationScope
25598
- });
25599
- this.assertDeadline(fireOptions);
26117
+ this.assertActive(fireOptions);
26118
+ activationScope.authorizeApplicationUse();
25600
26119
  if (!this.skipHooks) {
25601
26120
  dispatchTypedRequestHook("onIncomingResponse", {
25602
26121
  correlationId: payloadSending.correlation.id,
@@ -25605,15 +26124,17 @@ var init_classes_typedrequest = __esm({
25605
26124
  phase: "response",
25606
26125
  timestamp: Date.now(),
25607
26126
  durationMs: Date.now() - requestStartTime,
25608
- payload: payloadReceiving?.response
26127
+ payload: response
25609
26128
  });
25610
26129
  }
25611
- this.assertDeadline(fireOptions);
26130
+ this.assertActive(fireOptions);
25612
26131
  activationScope.commit();
25613
- return payloadReceiving.response;
26132
+ return response;
25614
26133
  } catch (error) {
25615
26134
  await activationScope.rollback(error);
25616
26135
  throw error;
26136
+ } finally {
26137
+ abortContext.cleanup();
25617
26138
  }
25618
26139
  }
25619
26140
  async postTrObject(payloadSendingArg, fireOptionsArg = {
@@ -25622,26 +26143,51 @@ var init_classes_typedrequest = __esm({
25622
26143
  }) {
25623
26144
  let retryCount = 0;
25624
26145
  while (true) {
25625
- this.assertDeadline(fireOptionsArg);
26146
+ this.assertActive(fireOptionsArg);
26147
+ const requestIdentity = this.createRequestIdentitySnapshot(payloadSendingArg);
25626
26148
  let payloadReceiving;
25627
26149
  if (this.urlEndPoint) {
26150
+ let responseResult;
25628
26151
  try {
25629
- const response = await webrequestInstance.postJson(this.urlEndPoint, payloadSendingArg, {
25630
- cacheKey: fireOptionsArg.cacheKey,
26152
+ responseResult = await webrequestInstance.postJsonWithMetadata(this.urlEndPoint, payloadSendingArg, {
25631
26153
  cacheStrategy: fireOptionsArg.useCache ? "cache-first" : "network-only",
25632
- timeout: this.getRemainingTimeout(fireOptionsArg)
26154
+ cacheKey: fireOptionsArg.cacheKey,
26155
+ timeout: this.getRemainingTimeout(fireOptionsArg),
26156
+ signal: fireOptionsArg.abortSignal
25633
26157
  });
25634
- payloadReceiving = response;
25635
26158
  } catch (error) {
26159
+ if (fireOptionsArg.cacheKey && error instanceof SyntaxError) {
26160
+ await webrequestInstance.deleteCache(fireOptionsArg.cacheKey);
26161
+ }
26162
+ if (fireOptionsArg.abortSignal?.aborted) {
26163
+ throw this.getAbortReason(fireOptionsArg);
26164
+ }
25636
26165
  if (fireOptionsArg.timeoutMs !== void 0 && (this.hasDeadlineExpired(fireOptionsArg) || dist_ts_exports15.isWebrequestTimeoutError(error))) {
25637
26166
  throw this.createTimeoutError(fireOptionsArg);
25638
26167
  }
25639
26168
  throw error;
25640
26169
  }
26170
+ payloadReceiving = responseResult.data;
26171
+ try {
26172
+ if (responseResult.metadata.fromCache) {
26173
+ payloadReceiving = this.reconstructCachedHttpResponse(payloadReceiving, payloadSendingArg, requestIdentity);
26174
+ } else {
26175
+ this.assertResponseEnvelope(payloadReceiving, requestIdentity);
26176
+ }
26177
+ } catch (error) {
26178
+ if (fireOptionsArg.cacheKey) {
26179
+ await webrequestInstance.deleteCache(fireOptionsArg.cacheKey);
26180
+ }
26181
+ throw error;
26182
+ }
26183
+ if (fireOptionsArg.cacheKey && !this.isReusableCachedHttpEnvelope(payloadReceiving)) {
26184
+ await webrequestInstance.deleteCache(fireOptionsArg.cacheKey);
26185
+ }
25641
26186
  } else {
25642
26187
  payloadReceiving = await this.postTypedTarget(payloadSendingArg, fireOptionsArg);
25643
26188
  }
25644
- this.assertDeadline(fireOptionsArg);
26189
+ this.assertResponseEnvelope(payloadReceiving, requestIdentity);
26190
+ this.assertActive(fireOptionsArg);
25645
26191
  if (payloadReceiving.error) {
25646
26192
  if (!payloadReceiving.retry) {
25647
26193
  return payloadReceiving;
@@ -25656,38 +26202,32 @@ var init_classes_typedrequest = __esm({
25656
26202
  }
25657
26203
  retryCount += 1;
25658
26204
  await this.waitForRetry(payloadReceiving.retry.waitForMs, fireOptionsArg);
26205
+ payloadSendingArg.requestInstanceId = isounique2.uni();
26206
+ payloadSendingArg.correlation.phase = "request";
26207
+ payloadSendingArg.response = null;
26208
+ delete payloadSendingArg.error;
26209
+ delete payloadSendingArg.retry;
25659
26210
  }
25660
26211
  }
25661
- async postStreamTrObject(payloadSendingArg) {
25662
- const streamFrameOptions = {
25663
- useCache: false,
25664
- maxRetries: 3,
25665
- timeoutMs: virtualStreamFrameTimeoutMs,
25666
- deadlineAt: performance.now() + virtualStreamFrameTimeoutMs
25667
- };
25668
- return this.postTrObject(payloadSendingArg, streamFrameOptions);
26212
+ assertResponseEnvelope(payloadReceivingArg, requestIdentityArg) {
26213
+ const responseError = payloadReceivingArg?.error;
26214
+ const requestInstanceId = payloadReceivingArg?.requestInstanceId;
26215
+ const expectedRequestInstanceId = requestIdentityArg.requestInstanceId;
26216
+ if (!payloadReceivingArg || typeof payloadReceivingArg !== "object" || payloadReceivingArg.method !== requestIdentityArg.method || payloadReceivingArg.correlation?.phase !== "response" || typeof payloadReceivingArg.correlation.id !== "string" || payloadReceivingArg.correlation.id.length === 0 || !Object.hasOwn(payloadReceivingArg, "response") || typeof requestInstanceId !== "string" || requestInstanceId.length === 0 || typeof expectedRequestInstanceId !== "string" || expectedRequestInstanceId.length === 0 || requestInstanceId !== expectedRequestInstanceId || responseError !== void 0 && (!responseError || typeof responseError !== "object" || typeof responseError.text !== "string") || payloadReceivingArg.correlation.id !== requestIdentityArg.correlationId) {
26217
+ throw new TypeError("TypedRequest received an invalid response envelope");
26218
+ }
25669
26219
  }
25670
26220
  async postTypedTarget(payloadSendingArg, fireOptionsArg) {
25671
- const remainingTimeout = this.getRemainingTimeout(fireOptionsArg);
25672
- if (remainingTimeout === void 0) {
25673
- return this.typedTarget.post(payloadSendingArg);
25674
- }
25675
- const abortController = new AbortController();
25676
- const timeout2 = setTimeout(() => {
25677
- abortController.abort(this.createTimeoutError(fireOptionsArg));
25678
- }, remainingTimeout);
25679
- timeout2.unref?.();
26221
+ this.assertActive(fireOptionsArg);
25680
26222
  try {
25681
26223
  return await this.typedTarget.post(payloadSendingArg, {
25682
- signal: abortController.signal
26224
+ signal: fireOptionsArg.abortSignal
25683
26225
  });
25684
26226
  } catch (error) {
25685
- if (abortController.signal.aborted) {
25686
- throw this.createTimeoutError(fireOptionsArg);
26227
+ if (fireOptionsArg.abortSignal?.aborted) {
26228
+ throw this.getAbortReason(fireOptionsArg);
25687
26229
  }
25688
26230
  throw error;
25689
- } finally {
25690
- clearTimeout(timeout2);
25691
26231
  }
25692
26232
  }
25693
26233
  resolveFireOptions(fireOptionsArg) {
@@ -25701,16 +26241,20 @@ var init_classes_typedrequest = __esm({
25701
26241
  if (fireOptions.timeoutMs !== void 0 && (!Number.isSafeInteger(fireOptions.timeoutMs) || fireOptions.timeoutMs <= 0 || fireOptions.timeoutMs > maxTimeoutMs)) {
25702
26242
  throw new RangeError(`TypedRequest timeoutMs must be a positive safe integer no greater than ${maxTimeoutMs}`);
25703
26243
  }
26244
+ if (fireOptions.abortSignal !== void 0 && !this.isAbortSignal(fireOptions.abortSignal)) {
26245
+ throw new TypeError("TypedRequest abortSignal must be an AbortSignal");
26246
+ }
25704
26247
  if (fireOptions.maxRetries !== void 0 && (!Number.isSafeInteger(fireOptions.maxRetries) || fireOptions.maxRetries < 0 || fireOptions.maxRetries > 1e3)) {
25705
26248
  throw new RangeError("TypedRequest maxRetries must be a safe integer between 0 and 1000");
25706
26249
  }
25707
- if (fireOptions.timeoutMs !== void 0 && !this.urlEndPoint && this.typedTarget.options.supportsAbortSignal !== true) {
25708
- throw new Error("TypedRequest timeoutMs requires an HTTP URL or a TypedTarget with AbortSignal support");
26250
+ if ((fireOptions.timeoutMs !== void 0 || fireOptions.abortSignal !== void 0) && !this.urlEndPoint && this.typedTarget.options.supportsAbortSignal !== true) {
26251
+ throw new Error(fireOptions.abortSignal ? "TypedRequest cancellation requires an HTTP URL or a TypedTarget with AbortSignal support" : "TypedRequest timeoutMs requires an HTTP URL or a TypedTarget with AbortSignal support");
25709
26252
  }
25710
26253
  return {
25711
26254
  useCache: fireOptions.useCache ?? false,
25712
26255
  timeoutMs: fireOptions.timeoutMs,
25713
26256
  maxRetries: fireOptions.maxRetries ?? 3,
26257
+ abortSignal: fireOptions.abortSignal,
25714
26258
  deadlineAt: fireOptions.timeoutMs === void 0 ? void 0 : performance.now() + fireOptions.timeoutMs
25715
26259
  };
25716
26260
  }
@@ -25727,6 +26271,12 @@ var init_classes_typedrequest = __esm({
25727
26271
  assertDeadline(fireOptionsArg) {
25728
26272
  this.getRemainingTimeout(fireOptionsArg);
25729
26273
  }
26274
+ assertActive(fireOptionsArg) {
26275
+ if (fireOptionsArg.abortSignal?.aborted) {
26276
+ throw this.getAbortReason(fireOptionsArg);
26277
+ }
26278
+ this.assertDeadline(fireOptionsArg);
26279
+ }
25730
26280
  hasDeadlineExpired(fireOptionsArg) {
25731
26281
  return fireOptionsArg.deadlineAt !== void 0 && performance.now() >= fireOptionsArg.deadlineAt;
25732
26282
  }
@@ -25737,17 +26287,98 @@ var init_classes_typedrequest = __esm({
25737
26287
  if (!Number.isSafeInteger(waitForMsArg) || waitForMsArg <= 0 || waitForMsArg > maxTimeoutMs) {
25738
26288
  throw new RangeError(`TypedRequest retry waitForMs must be a positive safe integer no greater than ${maxTimeoutMs}`);
25739
26289
  }
26290
+ this.assertActive(fireOptionsArg);
25740
26291
  const remainingMs = this.getRemainingTimeout(fireOptionsArg);
25741
26292
  if (remainingMs === void 0) {
25742
- await dist_ts_exports3.delayFor(waitForMsArg);
26293
+ await this.delayWithAbort(waitForMsArg, fireOptionsArg);
25743
26294
  return;
25744
26295
  }
25745
26296
  if (waitForMsArg >= remainingMs) {
25746
- await dist_ts_exports3.delayFor(remainingMs);
26297
+ await this.delayWithAbort(remainingMs, fireOptionsArg);
25747
26298
  throw this.createTimeoutError(fireOptionsArg);
25748
26299
  }
25749
- await dist_ts_exports3.delayFor(waitForMsArg);
25750
- this.assertDeadline(fireOptionsArg);
26300
+ await this.delayWithAbort(waitForMsArg, fireOptionsArg);
26301
+ this.assertActive(fireOptionsArg);
26302
+ }
26303
+ async delayWithAbort(delayMsArg, fireOptionsArg) {
26304
+ const signal = fireOptionsArg.abortSignal;
26305
+ if (!signal) {
26306
+ await dist_ts_exports3.delayFor(delayMsArg);
26307
+ return;
26308
+ }
26309
+ await new Promise((resolve2, reject) => {
26310
+ const timeout2 = setTimeout(() => {
26311
+ signal.removeEventListener("abort", onAbort);
26312
+ resolve2();
26313
+ }, delayMsArg);
26314
+ const onAbort = /* @__PURE__ */ __name(() => {
26315
+ clearTimeout(timeout2);
26316
+ signal.removeEventListener("abort", onAbort);
26317
+ reject(this.getAbortReason(fireOptionsArg));
26318
+ }, "onAbort");
26319
+ signal.addEventListener("abort", onAbort, { once: true });
26320
+ if (signal.aborted)
26321
+ onAbort();
26322
+ });
26323
+ }
26324
+ createAbortContext(fireOptionsArg) {
26325
+ const callerSignal = fireOptionsArg.abortSignal;
26326
+ if (fireOptionsArg.timeoutMs === void 0) {
26327
+ return { signal: callerSignal, cleanup: /* @__PURE__ */ __name(() => {
26328
+ }, "cleanup") };
26329
+ }
26330
+ const abortController = new AbortController();
26331
+ const onCallerAbort = /* @__PURE__ */ __name(() => {
26332
+ abortController.abort(callerSignal?.reason ?? new DOMException("The operation was aborted", "AbortError"));
26333
+ }, "onCallerAbort");
26334
+ if (callerSignal?.aborted) {
26335
+ onCallerAbort();
26336
+ } else {
26337
+ callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
26338
+ }
26339
+ const remainingTimeoutMs = Math.max(0, Math.ceil(fireOptionsArg.deadlineAt - performance.now()));
26340
+ const timeout2 = setTimeout(() => {
26341
+ abortController.abort(this.createTimeoutError(fireOptionsArg));
26342
+ }, remainingTimeoutMs);
26343
+ timeout2.unref?.();
26344
+ return {
26345
+ signal: abortController.signal,
26346
+ cleanup: /* @__PURE__ */ __name(() => {
26347
+ clearTimeout(timeout2);
26348
+ callerSignal?.removeEventListener("abort", onCallerAbort);
26349
+ }, "cleanup")
26350
+ };
26351
+ }
26352
+ getAbortReason(fireOptionsArg) {
26353
+ return fireOptionsArg.abortSignal?.reason ?? new DOMException("The operation was aborted", "AbortError");
26354
+ }
26355
+ reconstructCachedHttpResponse(cachedEnvelopeArg, payloadSendingArg, requestIdentityArg) {
26356
+ if (!cachedEnvelopeArg || typeof cachedEnvelopeArg !== "object" || Array.isArray(cachedEnvelopeArg) || cachedEnvelopeArg.method !== requestIdentityArg.method || !Object.hasOwn(cachedEnvelopeArg, "response") || !cachedEnvelopeArg.response || typeof cachedEnvelopeArg.response !== "object" || !this.isReusableCachedHttpEnvelope(cachedEnvelopeArg)) {
26357
+ throw new TypeError("TypedRequest received an invalid cached response envelope");
26358
+ }
26359
+ return {
26360
+ method: requestIdentityArg.method,
26361
+ request: payloadSendingArg.request,
26362
+ response: cachedEnvelopeArg.response,
26363
+ requestInstanceId: requestIdentityArg.requestInstanceId,
26364
+ correlation: {
26365
+ id: requestIdentityArg.correlationId,
26366
+ phase: "response"
26367
+ }
26368
+ };
26369
+ }
26370
+ createRequestIdentitySnapshot(payloadSendingArg) {
26371
+ return Object.freeze({
26372
+ method: payloadSendingArg.method,
26373
+ correlationId: payloadSendingArg.correlation?.id,
26374
+ requestInstanceId: payloadSendingArg.requestInstanceId
26375
+ });
26376
+ }
26377
+ isReusableCachedHttpEnvelope(payloadReceivingArg) {
26378
+ return !Object.hasOwn(payloadReceivingArg, "error") && !Object.hasOwn(payloadReceivingArg, "retry") && !VirtualStream.containsNetworkDescriptor(payloadReceivingArg);
26379
+ }
26380
+ isAbortSignal(valueArg) {
26381
+ return Boolean(valueArg && typeof valueArg === "object" && typeof Reflect.get(valueArg, "aborted") === "boolean" && typeof Reflect.get(valueArg, "addEventListener") === "function" && typeof Reflect.get(valueArg, "removeEventListener") === "function");
25751
26382
  }
25752
26383
  async createCacheKey(payloadSendingArg) {
25753
26384
  const cacheIdentity = JSON.stringify({
@@ -25763,7 +26394,7 @@ var init_classes_typedrequest = __esm({
25763
26394
  }
25764
26395
  });
25765
26396
 
25766
- // node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/index.js
26397
+ // node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/index.js
25767
26398
  var dist_ts_exports16 = {};
25768
26399
  __export(dist_ts_exports16, {
25769
26400
  TYPED_REQUEST_REDACTED_PAYLOAD: () => TYPED_REQUEST_REDACTED_PAYLOAD,
@@ -25776,10 +26407,13 @@ __export(dist_ts_exports16, {
25776
26407
  TypedTarget: () => TypedTarget,
25777
26408
  VirtualStream: () => VirtualStream,
25778
26409
  VirtualStreamActivationScope: () => VirtualStreamActivationScope,
25779
- VirtualStreamClosedError: () => VirtualStreamClosedError
26410
+ VirtualStreamClosedError: () => VirtualStreamClosedError,
26411
+ VirtualStreamLifecycleContractError: () => VirtualStreamLifecycleContractError,
26412
+ VirtualStreamOpenTimeoutError: () => VirtualStreamOpenTimeoutError,
26413
+ getTypedRequestResponseInterestKey: () => getTypedRequestResponseInterestKey
25780
26414
  });
25781
26415
  var init_dist_ts16 = __esm({
25782
- "node_modules/.pnpm/@api.global+typedrequest@3.8.0/node_modules/@api.global/typedrequest/dist_ts/index.js"() {
26416
+ "node_modules/.pnpm/@api.global+typedrequest@8.0.3/node_modules/@api.global/typedrequest/dist_ts/index.js"() {
25783
26417
  init_classes_typedrequest();
25784
26418
  init_classes_typedhandler();
25785
26419
  init_classes_typedrouter();
@@ -27220,9 +27854,9 @@ var init_esbrowser = __esm({
27220
27854
  }
27221
27855
  });
27222
27856
 
27223
- // node_modules/.pnpm/@design.estate+dees-comms@1.0.30/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.plugins.js
27857
+ // node_modules/.pnpm/@design.estate+dees-comms@1.0.32/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.plugins.js
27224
27858
  var init_dees_comms_plugins = __esm({
27225
- "node_modules/.pnpm/@design.estate+dees-comms@1.0.30/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.plugins.js"() {
27859
+ "node_modules/.pnpm/@design.estate+dees-comms@1.0.32/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.plugins.js"() {
27226
27860
  init_dist_ts3();
27227
27861
  init_dist_ts4();
27228
27862
  init_dist_ts16();
@@ -27230,10 +27864,10 @@ var init_dees_comms_plugins = __esm({
27230
27864
  }
27231
27865
  });
27232
27866
 
27233
- // node_modules/.pnpm/@design.estate+dees-comms@1.0.30/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.classes.deescomms.js
27867
+ // node_modules/.pnpm/@design.estate+dees-comms@1.0.32/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.classes.deescomms.js
27234
27868
  var BroadcastChannel4, DeesComms;
27235
27869
  var init_dees_comms_classes_deescomms = __esm({
27236
- "node_modules/.pnpm/@design.estate+dees-comms@1.0.30/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.classes.deescomms.js"() {
27870
+ "node_modules/.pnpm/@design.estate+dees-comms@1.0.32/node_modules/@design.estate/dees-comms/dist_ts/dees-comms.classes.deescomms.js"() {
27237
27871
  init_dees_comms_plugins();
27238
27872
  BroadcastChannel4 = globalThis.BroadcastChannel;
27239
27873
  if (!BroadcastChannel4) {
@@ -27255,11 +27889,11 @@ var init_dees_comms_classes_deescomms = __esm({
27255
27889
  });
27256
27890
  this.broadcastChannel.onmessage = async (eventArg) => {
27257
27891
  const message2 = eventArg.method ? eventArg : eventArg.data;
27258
- console.log(JSON.stringify(message2));
27259
- const response = await this.typedrouter.routeAndAddResponse(message2, { skipHooks: true });
27892
+ const response = await this.typedrouter.routeAndAddResponse(message2, {
27893
+ skipHooks: true
27894
+ });
27260
27895
  if (response && !response.error) {
27261
27896
  this.postMessage(response);
27262
- } else {
27263
27897
  }
27264
27898
  };
27265
27899
  }
@@ -27286,13 +27920,13 @@ var init_dees_comms_classes_deescomms = __esm({
27286
27920
  }
27287
27921
  });
27288
27922
 
27289
- // node_modules/.pnpm/@design.estate+dees-comms@1.0.30/node_modules/@design.estate/dees-comms/dist_ts/index.js
27923
+ // node_modules/.pnpm/@design.estate+dees-comms@1.0.32/node_modules/@design.estate/dees-comms/dist_ts/index.js
27290
27924
  var dist_ts_exports17 = {};
27291
27925
  __export(dist_ts_exports17, {
27292
27926
  DeesComms: () => DeesComms
27293
27927
  });
27294
27928
  var init_dist_ts17 = __esm({
27295
- "node_modules/.pnpm/@design.estate+dees-comms@1.0.30/node_modules/@design.estate/dees-comms/dist_ts/index.js"() {
27929
+ "node_modules/.pnpm/@design.estate+dees-comms@1.0.32/node_modules/@design.estate/dees-comms/dist_ts/index.js"() {
27296
27930
  init_dees_comms_classes_deescomms();
27297
27931
  }
27298
27932
  });
@@ -54283,7 +54917,7 @@ var require_dist = __commonJS({
54283
54917
  var pathToRegExp;
54284
54918
  var init_smartrouter_plugins = __esm({
54285
54919
  "node_modules/.pnpm/@push.rocks+smartrouter@1.3.3/node_modules/@push.rocks/smartrouter/dist_ts/smartrouter.plugins.js"() {
54286
- init_dist_ts8();
54920
+ init_dist_ts7();
54287
54921
  init_dist_ts2();
54288
54922
  pathToRegExp = __toESM(require_dist(), 1);
54289
54923
  }
@@ -54435,8 +55069,8 @@ var init_dist_ts20 = __esm({
54435
55069
  // node_modules/.pnpm/@push.rocks+smarthash@3.3.0/node_modules/@push.rocks/smarthash/dist_ts_web/plugins.js
54436
55070
  var init_plugins2 = __esm({
54437
55071
  "node_modules/.pnpm/@push.rocks+smarthash@3.3.0/node_modules/@push.rocks/smarthash/dist_ts_web/plugins.js"() {
54438
- init_dist_ts11();
54439
- init_dist_ts13();
55072
+ init_dist_ts10();
55073
+ init_dist_ts12();
54440
55074
  }
54441
55075
  });
54442
55076
 
@@ -54719,7 +55353,7 @@ var init_dist_ts_web = __esm({
54719
55353
  }
54720
55354
  }, "sha256FromBuffer");
54721
55355
  sha265FromObject = /* @__PURE__ */ __name(async (objectArg) => {
54722
- const stringifiedObject = dist_ts_exports13.stringify(objectArg);
55356
+ const stringifiedObject = dist_ts_exports12.stringify(objectArg);
54723
55357
  const hashResult = await sha256FromString(stringifiedObject);
54724
55358
  return hashResult;
54725
55359
  }, "sha265FromObject");
@@ -54764,7 +55398,7 @@ var init_dist_ts_web = __esm({
54764
55398
  var init_smartstate_plugins = __esm({
54765
55399
  "node_modules/.pnpm/@push.rocks+smartstate@2.3.1/node_modules/@push.rocks/smartstate/dist_ts/smartstate.plugins.js"() {
54766
55400
  init_dist_ts_web();
54767
- init_dist_ts13();
55401
+ init_dist_ts12();
54768
55402
  init_dist_ts();
54769
55403
  init_dist_ts2();
54770
55404
  init_dist_ts14();
@@ -55051,7 +55685,7 @@ var init_smartstate_classes_statepart = __esm({
55051
55685
  return;
55052
55686
  }
55053
55687
  const createStateHash = /* @__PURE__ */ __name(async (stateArg) => {
55054
- return await dist_ts_web_exports.sha256FromString(dist_ts_exports13.stableOneWayStringify(stateArg));
55688
+ return await dist_ts_web_exports.sha256FromString(dist_ts_exports12.stableOneWayStringify(stateArg));
55055
55689
  }, "createStateHash");
55056
55690
  try {
55057
55691
  const currentHash = await createStateHash(snapshot);
@@ -58281,20 +58915,20 @@ var require_sweet_scroll = __commonJS({
58281
58915
  }
58282
58916
  });
58283
58917
 
58284
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.plugins.js
58918
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.plugins.js
58285
58919
  var import_sweet_scroll, lik;
58286
58920
  var init_domtools_plugins = __esm({
58287
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.plugins.js"() {
58921
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.plugins.js"() {
58288
58922
  init_dist_ts17();
58289
58923
  init_dist_ts16();
58290
58924
  init_dist_ts3();
58291
- init_dist_ts13();
58925
+ init_dist_ts12();
58292
58926
  init_dist_ts19();
58293
58927
  init_dist_ts();
58294
58928
  init_dist_ts20();
58295
58929
  init_dist_ts2();
58296
58930
  init_dist_ts21();
58297
- init_dist_ts12();
58931
+ init_dist_ts11();
58298
58932
  init_dist_ts22();
58299
58933
  init_dist_ts15();
58300
58934
  init_dist_ts24();
@@ -58312,7 +58946,7 @@ var init_domtools_plugins = __esm({
58312
58946
  }
58313
58947
  });
58314
58948
 
58315
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.breakpoints.js
58949
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.breakpoints.js
58316
58950
  var domtools_css_breakpoints_exports = {};
58317
58951
  __export(domtools_css_breakpoints_exports, {
58318
58952
  containerContextStyles: () => containerContextStyles,
@@ -58333,7 +58967,7 @@ __export(domtools_css_breakpoints_exports, {
58333
58967
  });
58334
58968
  var desktop, notebook, tablet, phablet, phone, buildCondition, cssForViewport, cssForContainer, cssForConstraint, cssForConstraintContainer, containerContextStyles, cssForDesktop, cssForNotebook, cssForTablet, cssForPhablet, cssForPhone;
58335
58969
  var init_domtools_css_breakpoints = __esm({
58336
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.breakpoints.js"() {
58970
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.breakpoints.js"() {
58337
58971
  init_domtools_classes_domtools();
58338
58972
  init_lit();
58339
58973
  desktop = 1600;
@@ -58392,10 +59026,10 @@ var init_domtools_css_breakpoints = __esm({
58392
59026
  }
58393
59027
  });
58394
59028
 
58395
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.scroller.js
59029
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.scroller.js
58396
59030
  var Scroller;
58397
59031
  var init_domtools_classes_scroller = __esm({
58398
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.scroller.js"() {
59032
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.scroller.js"() {
58399
59033
  init_domtools_plugins();
58400
59034
  Scroller = class {
58401
59035
  static {
@@ -58589,10 +59223,10 @@ var init_domtools_classes_scroller = __esm({
58589
59223
  }
58590
59224
  });
58591
59225
 
58592
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.thememanager.js
59226
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.thememanager.js
58593
59227
  var ThemeManager;
58594
59228
  var init_domtools_classes_thememanager = __esm({
58595
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.thememanager.js"() {
59229
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.thememanager.js"() {
58596
59230
  init_domtools_classes_domtools();
58597
59231
  init_domtools_plugins();
58598
59232
  ThemeManager = class {
@@ -58661,10 +59295,10 @@ var init_domtools_classes_thememanager = __esm({
58661
59295
  }
58662
59296
  });
58663
59297
 
58664
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.keyboard.js
59298
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.keyboard.js
58665
59299
  var Key, Keyboard;
58666
59300
  var init_domtools_classes_keyboard = __esm({
58667
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.keyboard.js"() {
59301
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.keyboard.js"() {
58668
59302
  init_domtools_plugins();
58669
59303
  (function(Key3) {
58670
59304
  Key3[Key3["Backspace"] = 8] = "Backspace";
@@ -59190,10 +59824,10 @@ var init_domtools_classes_keyboard = __esm({
59190
59824
  }
59191
59825
  });
59192
59826
 
59193
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.domtools.js
59827
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.domtools.js
59194
59828
  var DomTools;
59195
59829
  var init_domtools_classes_domtools = __esm({
59196
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.domtools.js"() {
59830
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.classes.domtools.js"() {
59197
59831
  init_domtools_plugins();
59198
59832
  init_domtools_css_breakpoints();
59199
59833
  init_domtools_classes_scroller();
@@ -59268,7 +59902,7 @@ var init_domtools_classes_domtools = __esm({
59268
59902
  convenience = {
59269
59903
  typedrequest: dist_ts_exports16,
59270
59904
  smartdelay: dist_ts_exports3,
59271
- smartjson: dist_ts_exports13,
59905
+ smartjson: dist_ts_exports12,
59272
59906
  smarturl: dist_ts_exports22
59273
59907
  };
59274
59908
  deesComms = new dist_ts_exports17.DeesComms();
@@ -59423,10 +60057,10 @@ var init_domtools_classes_domtools = __esm({
59423
60057
  }
59424
60058
  });
59425
60059
 
59426
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.basestyles.js
60060
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.basestyles.js
59427
60061
  var scrollBarStyles, globalBaseStyles;
59428
60062
  var init_domtools_css_basestyles = __esm({
59429
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.basestyles.js"() {
60063
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.basestyles.js"() {
59430
60064
  init_domtools_classes_domtools();
59431
60065
  init_lit();
59432
60066
  scrollBarStyles = (() => {
@@ -59465,7 +60099,7 @@ var init_domtools_css_basestyles = __esm({
59465
60099
  }
59466
60100
  });
59467
60101
 
59468
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.elementbasic.js
60102
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.elementbasic.js
59469
60103
  var domtools_elementbasic_exports = {};
59470
60104
  __export(domtools_elementbasic_exports, {
59471
60105
  setup: () => setup,
@@ -59474,7 +60108,7 @@ __export(domtools_elementbasic_exports, {
59474
60108
  });
59475
60109
  var staticStyles, styles, setup;
59476
60110
  var init_domtools_elementbasic = __esm({
59477
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.elementbasic.js"() {
60111
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.elementbasic.js"() {
59478
60112
  init_domtools_classes_domtools();
59479
60113
  init_domtools_css_basestyles();
59480
60114
  init_lit();
@@ -59521,14 +60155,14 @@ var init_domtools_elementbasic = __esm({
59521
60155
  }
59522
60156
  });
59523
60157
 
59524
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.js
60158
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.js
59525
60159
  var domtools_css_exports = {};
59526
60160
  __export(domtools_css_exports, {
59527
60161
  cssGridColumns: () => cssGridColumns
59528
60162
  });
59529
60163
  var cssGridColumns;
59530
60164
  var init_domtools_css = __esm({
59531
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.js"() {
60165
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.css.js"() {
59532
60166
  cssGridColumns = /* @__PURE__ */ __name((amountOfColumnsArg, gapSizeArg) => {
59533
60167
  let returnString = ``;
59534
60168
  for (let i11 = 0; i11 < amountOfColumnsArg; i11++) {
@@ -59539,7 +60173,7 @@ var init_domtools_css = __esm({
59539
60173
  }
59540
60174
  });
59541
60175
 
59542
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.pluginexports.js
60176
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.pluginexports.js
59543
60177
  var domtools_pluginexports_exports = {};
59544
60178
  __export(domtools_pluginexports_exports, {
59545
60179
  SweetScroll: () => import_sweet_scroll.default,
@@ -59549,17 +60183,17 @@ __export(domtools_pluginexports_exports, {
59549
60183
  smartrouter: () => dist_ts_exports20,
59550
60184
  smartrx: () => dist_ts_exports2,
59551
60185
  smartstate: () => dist_ts_exports21,
59552
- smartstring: () => dist_ts_exports12,
60186
+ smartstring: () => dist_ts_exports11,
59553
60187
  smarturl: () => dist_ts_exports22,
59554
60188
  typedrequest: () => dist_ts_exports16
59555
60189
  });
59556
60190
  var init_domtools_pluginexports = __esm({
59557
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/domtools.pluginexports.js"() {
60191
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/domtools.pluginexports.js"() {
59558
60192
  init_domtools_plugins();
59559
60193
  }
59560
60194
  });
59561
60195
 
59562
- // node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/index.js
60196
+ // node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/index.js
59563
60197
  var dist_ts_exports25 = {};
59564
60198
  __export(dist_ts_exports25, {
59565
60199
  DomTools: () => DomTools,
@@ -59570,7 +60204,7 @@ __export(dist_ts_exports25, {
59570
60204
  plugins: () => domtools_pluginexports_exports
59571
60205
  });
59572
60206
  var init_dist_ts25 = __esm({
59573
- "node_modules/.pnpm/@design.estate+dees-domtools@2.5.6/node_modules/@design.estate/dees-domtools/dist_ts/index.js"() {
60207
+ "node_modules/.pnpm/@design.estate+dees-domtools@3.0.0/node_modules/@design.estate/dees-domtools/dist_ts/index.js"() {
59574
60208
  init_domtools_colors();
59575
60209
  init_domtools_elementbasic();
59576
60210
  init_domtools_css_breakpoints();
@@ -59582,10 +60216,10 @@ var init_dist_ts25 = __esm({
59582
60216
  }
59583
60217
  });
59584
60218
 
59585
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/plugins.js
60219
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/plugins.js
59586
60220
  var isounique3, lit;
59587
60221
  var init_plugins3 = __esm({
59588
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/plugins.js"() {
60222
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/plugins.js"() {
59589
60223
  isounique3 = __toESM(require_dist_ts(), 1);
59590
60224
  init_dist_ts2();
59591
60225
  init_lit();
@@ -59600,10 +60234,10 @@ var init_plugins3 = __esm({
59600
60234
  }
59601
60235
  });
59602
60236
 
59603
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/classes.cssmanager.js
60237
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/classes.cssmanager.js
59604
60238
  var CssManager;
59605
60239
  var init_classes_cssmanager = __esm({
59606
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/classes.cssmanager.js"() {
60240
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/classes.cssmanager.js"() {
59607
60241
  init_lit();
59608
60242
  init_plugins3();
59609
60243
  init_dist_ts25();
@@ -59830,7 +60464,7 @@ var init_custom_element2 = __esm({
59830
60464
  }
59831
60465
  });
59832
60466
 
59833
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/decorators.customelement.js
60467
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/decorators.customelement.js
59834
60468
  function customElement(tagName) {
59835
60469
  return (classOrTarget, context2) => {
59836
60470
  classOrTarget.is = tagName;
@@ -59845,7 +60479,7 @@ function customElement(tagName) {
59845
60479
  }
59846
60480
  var camelToKebab;
59847
60481
  var init_decorators_customelement = __esm({
59848
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/decorators.customelement.js"() {
60482
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/decorators.customelement.js"() {
59849
60483
  init_custom_element2();
59850
60484
  camelToKebab = /* @__PURE__ */ __name((name) => name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), "camelToKebab");
59851
60485
  __name(customElement, "customElement");
@@ -59990,10 +60624,10 @@ var init_decorators = __esm({
59990
60624
  }
59991
60625
  });
59992
60626
 
59993
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/classes.dees-element.js
60627
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/classes.dees-element.js
59994
60628
  var __esDecorate2, __runInitializers3, DeesElement;
59995
60629
  var init_classes_dees_element = __esm({
59996
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/classes.dees-element.js"() {
60630
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/classes.dees-element.js"() {
59997
60631
  init_plugins3();
59998
60632
  init_lit();
59999
60633
  __esDecorate2 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
@@ -60142,7 +60776,7 @@ var init_classes_dees_element = __esm({
60142
60776
  }
60143
60777
  });
60144
60778
 
60145
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/decorators.containerresponsive.js
60779
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/decorators.containerresponsive.js
60146
60780
  function containerResponsive() {
60147
60781
  return function(target) {
60148
60782
  const tagName = target.is || target.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
@@ -60175,7 +60809,7 @@ function containerResponsive() {
60175
60809
  }
60176
60810
  var camelToKebab2;
60177
60811
  var init_decorators_containerresponsive = __esm({
60178
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/decorators.containerresponsive.js"() {
60812
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/decorators.containerresponsive.js"() {
60179
60813
  init_lit();
60180
60814
  init_dist_ts25();
60181
60815
  camelToKebab2 = /* @__PURE__ */ __name((name) => name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), "camelToKebab");
@@ -60291,10 +60925,10 @@ var init_async_directive2 = __esm({
60291
60925
  }
60292
60926
  });
60293
60927
 
60294
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.resolvedirective.js
60928
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.resolvedirective.js
60295
60929
  var ResolveDirective, resolve, resolveExec;
60296
60930
  var init_classes_resolvedirective = __esm({
60297
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.resolvedirective.js"() {
60931
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.resolvedirective.js"() {
60298
60932
  init_lit();
60299
60933
  init_async_directive2();
60300
60934
  ResolveDirective = class extends f5 {
@@ -60342,10 +60976,10 @@ var init_classes_resolvedirective = __esm({
60342
60976
  }
60343
60977
  });
60344
60978
 
60345
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribedirective.js
60979
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribedirective.js
60346
60980
  var SubscribeDirective, subscribe;
60347
60981
  var init_classes_subscribedirective = __esm({
60348
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribedirective.js"() {
60982
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribedirective.js"() {
60349
60983
  init_lit();
60350
60984
  init_async_directive2();
60351
60985
  init_dist_ts2();
@@ -60381,10 +61015,10 @@ var init_classes_subscribedirective = __esm({
60381
61015
  }
60382
61016
  });
60383
61017
 
60384
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribewithtemplate.js
61018
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribewithtemplate.js
60385
61019
  var SubscribeWithTemplateDirective, subscribeWithTemplate;
60386
61020
  var init_classes_subscribewithtemplate = __esm({
60387
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribewithtemplate.js"() {
61021
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/classes.subscribewithtemplate.js"() {
60388
61022
  init_lit();
60389
61023
  init_async_directive2();
60390
61024
  init_dist_ts2();
@@ -60698,7 +61332,7 @@ var init_repeat3 = __esm({
60698
61332
  }
60699
61333
  });
60700
61334
 
60701
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/index.js
61335
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/index.js
60702
61336
  var directives_exports = {};
60703
61337
  __export(directives_exports, {
60704
61338
  asyncAppend: () => c8,
@@ -60711,7 +61345,7 @@ __export(directives_exports, {
60711
61345
  until: () => m4
60712
61346
  });
60713
61347
  var init_directives2 = __esm({
60714
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/directives/index.js"() {
61348
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/directives/index.js"() {
60715
61349
  init_classes_resolvedirective();
60716
61350
  init_classes_subscribedirective();
60717
61351
  init_classes_subscribewithtemplate();
@@ -60722,10 +61356,10 @@ var init_directives2 = __esm({
60722
61356
  }
60723
61357
  });
60724
61358
 
60725
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/index.js
61359
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/index.js
60726
61360
  var cssManager;
60727
61361
  var init_dist_ts26 = __esm({
60728
- "node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts/index.js"() {
61362
+ "node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts/index.js"() {
60729
61363
  init_classes_cssmanager();
60730
61364
  init_lit();
60731
61365
  init_static_html();
@@ -94903,6 +95537,7 @@ var init_dees_icon = __esm({
94903
95537
  }
94904
95538
  })], _icon_dec = [n5({
94905
95539
  type: String,
95540
+ reflect: true,
94906
95541
  converter: {
94907
95542
  fromAttribute: /* @__PURE__ */ __name((value2) => value2, "fromAttribute"),
94908
95543
  toAttribute: /* @__PURE__ */ __name((value2) => value2, "toAttribute")
@@ -122209,7 +122844,7 @@ var init_dees_workspace_terminal = __esm({
122209
122844
  }
122210
122845
  });
122211
122846
 
122212
- // node_modules/.pnpm/@design.estate+dees-element@2.4.0/node_modules/@design.estate/dees-element/dist_ts_demotools/demotools.js
122847
+ // node_modules/.pnpm/@design.estate+dees-element@3.0.0/node_modules/@design.estate/dees-element/dist_ts_demotools/demotools.js
122213
122848
  init_dist_ts26();
122214
122849
  var __esDecorate3 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
122215
122850
  function accept(f6) {
@@ -155107,7 +155742,7 @@ var demoFunc31 = /* @__PURE__ */ __name(() => b2`
155107
155742
  init_dist_ts26();
155108
155743
  init_dist_ts25();
155109
155744
  init_theme();
155110
- var _iconPosition_dec2, _icon_dec3, _fullWidth_dec2, _insideForm_dec, _shape_dec, _status_dec2, _size_dec3, _type_dec4, _isHidden_dec, _disabled_dec4, _eventDetailData_dec, _text_dec2, _a44, _DeesButton_decorators, _init41, _text2, _eventDetailData, _disabled4, _isHidden, _type4, _size3, _status2, _shape, _insideForm, _fullWidth2, _icon3, _iconPosition2;
155745
+ var _adoptedIconPosition_dec, _adoptedIcon_dec, _adoptedText_dec, _iconPosition_dec2, _icon_dec3, _fullWidth_dec2, _insideForm_dec, _shape_dec, _status_dec2, _size_dec3, _type_dec4, _isHidden_dec, _disabled_dec4, _eventDetailData_dec, _text_dec2, _a44, _DeesButton_decorators, _init41, _text2, _eventDetailData, _disabled4, _isHidden, _type4, _size3, _status2, _shape, _insideForm, _fullWidth2, _icon3, _iconPosition2, _adoptedText, _adoptedIcon, _adoptedIconPosition;
155111
155746
  _DeesButton_decorators = [customElement("dees-button")];
155112
155747
  var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n5({
155113
155748
  reflect: true,
@@ -155130,7 +155765,7 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155130
155765
  })], _insideForm_dec = [n5({
155131
155766
  type: Boolean,
155132
155767
  reflect: true
155133
- })], _fullWidth_dec2 = [n5({ type: Boolean, reflect: true, attribute: "full-width" })], _icon_dec3 = [n5({ type: String, reflect: true })], _iconPosition_dec2 = [n5({ type: String, reflect: true })], _a44) {
155768
+ })], _fullWidth_dec2 = [n5({ type: Boolean, reflect: true, attribute: "full-width" })], _icon_dec3 = [n5({ type: String, reflect: true })], _iconPosition_dec2 = [n5({ type: String, reflect: true })], _adoptedText_dec = [r5()], _adoptedIcon_dec = [r5()], _adoptedIconPosition_dec = [r5()], _a44) {
155134
155769
  constructor() {
155135
155770
  super();
155136
155771
  __privateAdd(this, _text2, __runInitializers(_init41, 8, this, "")), __runInitializers(_init41, 11, this);
@@ -155145,6 +155780,10 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155145
155780
  __privateAdd(this, _fullWidth2, __runInitializers(_init41, 44, this, false)), __runInitializers(_init41, 47, this);
155146
155781
  __privateAdd(this, _icon3, __runInitializers(_init41, 48, this)), __runInitializers(_init41, 51, this);
155147
155782
  __privateAdd(this, _iconPosition2, __runInitializers(_init41, 52, this, "left")), __runInitializers(_init41, 55, this);
155783
+ __privateAdd(this, _adoptedText, __runInitializers(_init41, 56, this, "")), __runInitializers(_init41, 59, this);
155784
+ __privateAdd(this, _adoptedIcon, __runInitializers(_init41, 60, this, "")), __runInitializers(_init41, 63, this);
155785
+ __privateAdd(this, _adoptedIconPosition, __runInitializers(_init41, 64, this, "left")), __runInitializers(_init41, 67, this);
155786
+ __publicField(this, "lightDomObserver");
155148
155787
  __publicField(this, "handleKeydown", /* @__PURE__ */ __name((eventArg) => {
155149
155788
  if (eventArg.key === " " || eventArg.key === "Spacebar") {
155150
155789
  eventArg.preventDefault();
@@ -155163,37 +155802,69 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155163
155802
  }, "handleKeyup"));
155164
155803
  }
155165
155804
  async connectedCallback() {
155166
- await super.connectedCallback();
155805
+ const superConnected = super.connectedCallback();
155806
+ this.observeLightDom();
155807
+ await superConnected;
155167
155808
  if (!this.insideForm && this.closest("dees-form")) {
155168
155809
  this.insideForm = true;
155169
155810
  }
155170
155811
  }
155171
- /**
155172
- * Extracts icon and text from light DOM and sets properties
155173
- */
155174
- extractLightDom() {
155175
- const iconElement = this.querySelector("dees-icon");
155176
- const textContent = Array.from(this.childNodes).filter((node2) => node2.nodeType === Node.TEXT_NODE).map((node2) => node2.textContent?.trim()).filter(Boolean).join(" ");
155177
- if (textContent && !this.text) {
155178
- this.text = textContent;
155179
- }
155180
- if (iconElement) {
155181
- const iconValue = iconElement.icon || iconElement.getAttribute("icon") || null;
155182
- if (iconValue) {
155183
- const children2 = Array.from(this.childNodes);
155184
- const iconIndex = children2.indexOf(iconElement);
155185
- const textNodes = children2.filter(
155186
- (node2) => node2.nodeType === Node.TEXT_NODE && node2.textContent?.trim()
155187
- );
155188
- if (textNodes.length > 0) {
155189
- const firstTextIndex = children2.indexOf(textNodes[0]);
155190
- this.iconPosition = iconIndex < firstTextIndex ? "left" : "right";
155812
+ async disconnectedCallback() {
155813
+ this.lightDomObserver?.disconnect();
155814
+ await super.disconnectedCallback();
155815
+ }
155816
+ observeLightDom() {
155817
+ this.lightDomObserver ??= new MutationObserver((mutationsArg) => {
155818
+ const supportedContentChanged = mutationsArg.some((mutationArg) => {
155819
+ if (mutationArg.type === "childList") {
155820
+ return mutationArg.target === this;
155191
155821
  }
155192
- this.icon = iconValue;
155822
+ if (mutationArg.type === "characterData") {
155823
+ return mutationArg.target.parentNode === this;
155824
+ }
155825
+ return mutationArg.target.parentNode === this && mutationArg.target.localName === "dees-icon";
155826
+ });
155827
+ if (supportedContentChanged) {
155828
+ this.adoptLightDom();
155193
155829
  }
155194
- iconElement.remove();
155830
+ });
155831
+ this.lightDomObserver.observe(this, {
155832
+ attributes: true,
155833
+ attributeFilter: ["icon"],
155834
+ characterData: true,
155835
+ childList: true,
155836
+ subtree: true
155837
+ });
155838
+ this.adoptLightDom();
155839
+ }
155840
+ /** Mirrors supported direct light content without taking ownership of consumer nodes. */
155841
+ adoptLightDom() {
155842
+ const children2 = Array.from(this.childNodes);
155843
+ const textNodes = children2.filter(
155844
+ (nodeArg) => nodeArg.nodeType === Node.TEXT_NODE && nodeArg.textContent?.trim()
155845
+ );
155846
+ const iconElement = children2.find(
155847
+ (nodeArg) => nodeArg instanceof HTMLElement && nodeArg.localName === "dees-icon"
155848
+ );
155849
+ const nextAdoptedText = textNodes.map((nodeArg) => nodeArg.textContent.trim()).join(" ");
155850
+ const nextAdoptedIcon = iconElement?.icon || iconElement?.getAttribute("icon") || "";
155851
+ const nextAdoptedIconPosition = iconElement && textNodes.length > 0 ? children2.indexOf(iconElement) < children2.indexOf(textNodes[0]) ? "left" : "right" : "left";
155852
+ const textFollowsLightDom = this.text === this.adoptedText;
155853
+ const iconFollowsLightDom = (this.icon || "") === this.adoptedIcon;
155854
+ const iconPositionFollowsLightDom = this.iconPosition === this.adoptedIconPosition;
155855
+ const previousAdoptedIcon = this.adoptedIcon;
155856
+ this.adoptedText = nextAdoptedText;
155857
+ this.adoptedIcon = nextAdoptedIcon;
155858
+ this.adoptedIconPosition = nextAdoptedIconPosition;
155859
+ if (textFollowsLightDom && this.text !== nextAdoptedText) {
155860
+ this.text = nextAdoptedText;
155861
+ }
155862
+ if (iconFollowsLightDom && this.icon !== nextAdoptedIcon && Boolean(nextAdoptedIcon || previousAdoptedIcon)) {
155863
+ this.icon = nextAdoptedIcon;
155864
+ }
155865
+ if (iconPositionFollowsLightDom && this.iconPosition !== nextAdoptedIconPosition) {
155866
+ this.iconPosition = nextAdoptedIconPosition;
155195
155867
  }
155196
- this.innerHTML = "";
155197
155868
  }
155198
155869
  render() {
155199
155870
  const typeMap = {
@@ -155205,9 +155876,12 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155205
155876
  };
155206
155877
  const actualType = typeMap[this.type] || this.type;
155207
155878
  const actualSize = this.type === "big" ? "lg" : this.size;
155208
- const leftIcon = this.iconPosition === "left" && this.icon ? b2`<dees-icon .icon=${this.icon}></dees-icon>` : "";
155209
- const rightIcon = this.iconPosition === "right" && this.icon ? b2`<dees-icon .icon=${this.icon}></dees-icon>` : "";
155210
- const showText = Boolean(this.text) && !(actualSize === "icon" && this.icon);
155879
+ const effectiveText = this.text;
155880
+ const effectiveIcon = this.icon;
155881
+ const effectiveIconPosition = this.iconPosition;
155882
+ const leftIcon = effectiveIconPosition === "left" && effectiveIcon ? b2`<dees-icon .icon=${effectiveIcon}></dees-icon>` : "";
155883
+ const rightIcon = effectiveIconPosition === "right" && effectiveIcon ? b2`<dees-icon .icon=${effectiveIcon}></dees-icon>` : "";
155884
+ const showText = Boolean(effectiveText) && !(actualSize === "icon" && effectiveIcon);
155211
155885
  return b2`
155212
155886
  <div
155213
155887
  class="button ${this.isHidden ? "hidden" : ""} ${actualType} size-${actualSize} shape-${this.shape} ${this.status} ${this.disabled ? "disabled" : ""}"
@@ -155215,7 +155889,7 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155215
155889
  tabindex=${this.disabled ? -1 : 0}
155216
155890
  aria-disabled=${this.disabled ? "true" : "false"}
155217
155891
  aria-busy=${this.status === "pending" ? "true" : "false"}
155218
- .ariaLabel=${showText ? null : this.text || null}
155892
+ .ariaLabel=${showText ? null : effectiveText || null}
155219
155893
  @click="${this.dispatchClick}"
155220
155894
  @keydown=${this.handleKeydown}
155221
155895
  @keyup=${this.handleKeyup}
@@ -155228,7 +155902,7 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155228
155902
  ></dees-spinner>
155229
155903
  `}
155230
155904
  ${leftIcon}
155231
- ${showText ? b2`<div class="textbox">${this.text}</div>` : ""}
155905
+ ${showText ? b2`<div class="textbox">${effectiveText}</div>` : ""}
155232
155906
  ${rightIcon}
155233
155907
  </div>
155234
155908
  `;
@@ -155291,9 +155965,6 @@ var _DeesButton = class _DeesButton extends (_a44 = DeesElement, _text_dec2 = [n
155291
155965
  }
155292
155966
  this.faceElement?.click();
155293
155967
  }
155294
- async firstUpdated() {
155295
- this.extractLightDom();
155296
- }
155297
155968
  };
155298
155969
  _init41 = __decoratorStart(_a44);
155299
155970
  _text2 = new WeakMap();
@@ -155308,6 +155979,9 @@ _insideForm = new WeakMap();
155308
155979
  _fullWidth2 = new WeakMap();
155309
155980
  _icon3 = new WeakMap();
155310
155981
  _iconPosition2 = new WeakMap();
155982
+ _adoptedText = new WeakMap();
155983
+ _adoptedIcon = new WeakMap();
155984
+ _adoptedIconPosition = new WeakMap();
155311
155985
  __decorateElement(_init41, 4, "text", _text_dec2, _DeesButton, _text2);
155312
155986
  __decorateElement(_init41, 4, "eventDetailData", _eventDetailData_dec, _DeesButton, _eventDetailData);
155313
155987
  __decorateElement(_init41, 4, "disabled", _disabled_dec4, _DeesButton, _disabled4);
@@ -155320,6 +155994,9 @@ __decorateElement(_init41, 4, "insideForm", _insideForm_dec, _DeesButton, _insid
155320
155994
  __decorateElement(_init41, 4, "fullWidth", _fullWidth_dec2, _DeesButton, _fullWidth2);
155321
155995
  __decorateElement(_init41, 4, "icon", _icon_dec3, _DeesButton, _icon3);
155322
155996
  __decorateElement(_init41, 4, "iconPosition", _iconPosition_dec2, _DeesButton, _iconPosition2);
155997
+ __decorateElement(_init41, 4, "adoptedText", _adoptedText_dec, _DeesButton, _adoptedText);
155998
+ __decorateElement(_init41, 4, "adoptedIcon", _adoptedIcon_dec, _DeesButton, _adoptedIcon);
155999
+ __decorateElement(_init41, 4, "adoptedIconPosition", _adoptedIconPosition_dec, _DeesButton, _adoptedIconPosition);
155323
156000
  _DeesButton = __decorateElement(_init41, 0, "DeesButton", _DeesButton_decorators, _DeesButton);
155324
156001
  __name(_DeesButton, "DeesButton");
155325
156002
  __publicField(_DeesButton, "demo", demoFunc31);
@@ -166589,7 +167266,7 @@ var toUnifiedDiff = /* @__PURE__ */ __name((rows, options2 = {}) => {
166589
167266
  // ts_web/elements/00group-dataview/dees-dataview-codebox/dees-dataview-codebox.ts
166590
167267
  init_dist_ts26();
166591
167268
  init_theme();
166592
- init_dist_ts12();
167269
+ init_dist_ts11();
166593
167270
  init_dees_contextmenu();
166594
167271
  init_services();
166595
167272
  init_dees_tile();
@@ -231013,7 +231690,7 @@ init_group_runtime();
231013
231690
  // ts_web/00_commitinfo_data.ts
231014
231691
  var commitinfo = {
231015
231692
  name: "@design.estate/dees-catalog",
231016
- version: "7.0.0",
231693
+ version: "8.0.0",
231017
231694
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
231018
231695
  };
231019
231696