@signalwire/js 4.0.0-beta.0 → 4.0.0-beta.2

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.
@@ -6689,7 +6689,7 @@ var require_share = /* @__PURE__ */ __commonJSMin(((exports) => {
6689
6689
  var Subject_1$6 = require_Subject();
6690
6690
  var Subscriber_1$1 = require_Subscriber();
6691
6691
  var lift_1$19 = require_lift();
6692
- function share$1(options) {
6692
+ function share$3(options) {
6693
6693
  if (options === void 0) options = {};
6694
6694
  var _a = options.connector, connector = _a === void 0 ? function() {
6695
6695
  return new Subject_1$6.Subject();
@@ -6747,7 +6747,7 @@ var require_share = /* @__PURE__ */ __commonJSMin(((exports) => {
6747
6747
  })(wrapperSource);
6748
6748
  };
6749
6749
  }
6750
- exports.share = share$1;
6750
+ exports.share = share$3;
6751
6751
  function handleReset(reset, on) {
6752
6752
  var args = [];
6753
6753
  for (var _i = 2; _i < arguments.length; _i++) args[_i - 2] = arguments[_i];
@@ -8945,11 +8945,21 @@ var Destroyable = class {
8945
8945
  this._destroyed$ = new import_cjs$22.Subject();
8946
8946
  }
8947
8947
  destroy() {
8948
+ this._observableCache?.clear();
8948
8949
  this.subscriptions.forEach((sub) => sub.unsubscribe());
8949
8950
  this.subjects.forEach((subject) => subject.complete());
8950
8951
  this._destroyed$.next();
8951
8952
  this._destroyed$.complete();
8952
8953
  }
8954
+ cachedObservable(key, factory) {
8955
+ this._observableCache ??= /* @__PURE__ */ new Map();
8956
+ let cached = this._observableCache.get(key);
8957
+ if (!cached) {
8958
+ cached = factory();
8959
+ this._observableCache.set(key, cached);
8960
+ }
8961
+ return cached;
8962
+ }
8953
8963
  subscribeTo(observable, observerOrNext) {
8954
8964
  const subscription = observable.subscribe(observerOrNext);
8955
8965
  this.subscriptions.push(subscription);
@@ -8970,7 +8980,7 @@ var Destroyable = class {
8970
8980
  return subject;
8971
8981
  }
8972
8982
  get $() {
8973
- return (0, import_cjs$22.merge)(...this.subjects.map((s) => s instanceof import_cjs$22.BehaviorSubject ? s.pipe((0, import_cjs$22.skip)(1)) : s)).pipe((0, import_cjs$22.map)((_) => this));
8983
+ return this.cachedObservable("$", () => (0, import_cjs$22.merge)(...this.subjects.map((s) => s instanceof import_cjs$22.BehaviorSubject ? s.pipe((0, import_cjs$22.skip)(1)) : s)).pipe((0, import_cjs$22.map)((_) => this)));
8974
8984
  }
8975
8985
  /**
8976
8986
  * Observable that emits when the instance is destroyed
@@ -9983,25 +9993,25 @@ var NavigatorDeviceController = class extends Destroyable {
9983
9993
  return {};
9984
9994
  }
9985
9995
  get errors$() {
9986
- return this._errors$.asObservable().pipe((0, import_cjs$20.takeUntil)(this.destroyed$));
9996
+ return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, import_cjs$20.takeUntil)(this.destroyed$)));
9987
9997
  }
9988
9998
  get audioInputDevices$() {
9989
- return this._devicesState$.pipe((0, import_cjs$20.map)((state) => state.audioinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$));
9999
+ return this.cachedObservable("audioInputDevices$", () => this._devicesState$.pipe((0, import_cjs$20.map)((state) => state.audioinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$)));
9990
10000
  }
9991
10001
  get audioOutputDevices$() {
9992
- return this._devicesState$.pipe((0, import_cjs$20.map)((state) => state.audiooutput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$));
10002
+ return this.cachedObservable("audioOutputDevices$", () => this._devicesState$.pipe((0, import_cjs$20.map)((state) => state.audiooutput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$)));
9993
10003
  }
9994
10004
  get videoInputDevices$() {
9995
- return this._devicesState$.pipe((0, import_cjs$20.map)((state) => state.videoinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$));
10005
+ return this.cachedObservable("videoInputDevices$", () => this._devicesState$.pipe((0, import_cjs$20.map)((state) => state.videoinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$)));
9996
10006
  }
9997
10007
  get selectedAudioInputDevice$() {
9998
- return this._selectedDevicesState$.asObservable().pipe((0, import_cjs$20.map)((state) => state.audioinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$), (0, import_cjs$20.tap)((info) => logger$19.debug("[DeviceController] Selected audio input device changed:", info)));
10008
+ return this.cachedObservable("selectedAudioInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$20.map)((state) => state.audioinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$), (0, import_cjs$20.tap)((info) => logger$19.debug("[DeviceController] Selected audio input device changed:", info))));
9999
10009
  }
10000
10010
  get selectedAudioOutputDevice$() {
10001
- return this._selectedDevicesState$.asObservable().pipe((0, import_cjs$20.map)((state) => state.audiooutput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$), (0, import_cjs$20.tap)((info) => logger$19.debug("[DeviceController] Selected audio output device changed:", info)));
10011
+ return this.cachedObservable("selectedAudioOutputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$20.map)((state) => state.audiooutput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$), (0, import_cjs$20.tap)((info) => logger$19.debug("[DeviceController] Selected audio output device changed:", info))));
10002
10012
  }
10003
10013
  get selectedVideoInputDevice$() {
10004
- return this._selectedDevicesState$.asObservable().pipe((0, import_cjs$20.map)((state) => state.videoinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$), (0, import_cjs$20.tap)((info) => logger$19.debug("[DeviceController] Selected video input device changed:", info)));
10014
+ return this.cachedObservable("selectedVideoInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, import_cjs$20.map)((state) => state.videoinput), (0, import_cjs$20.distinctUntilChanged)(), (0, import_cjs$20.takeUntil)(this.destroyed$), (0, import_cjs$20.tap)((info) => logger$19.debug("[DeviceController] Selected video input device changed:", info))));
10005
10015
  }
10006
10016
  get selectedAudioInputDevice() {
10007
10017
  return this._selectedDevicesState$.value.audioinput;
@@ -11662,7 +11672,7 @@ var SelfCapabilities = class extends Destroyable {
11662
11672
  }
11663
11673
  /** Observable for self member capabilities */
11664
11674
  get self$() {
11665
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.self), (0, import_cjs$17.distinctUntilChanged)());
11675
+ return this.cachedObservable("self$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.self), (0, import_cjs$17.distinctUntilChanged)()));
11666
11676
  }
11667
11677
  /** Current self member capabilities */
11668
11678
  get self() {
@@ -11670,7 +11680,7 @@ var SelfCapabilities = class extends Destroyable {
11670
11680
  }
11671
11681
  /** Observable for other member capabilities */
11672
11682
  get member$() {
11673
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.member), (0, import_cjs$17.distinctUntilChanged)());
11683
+ return this.cachedObservable("member$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.member), (0, import_cjs$17.distinctUntilChanged)()));
11674
11684
  }
11675
11685
  /** Current other member capabilities */
11676
11686
  get member() {
@@ -11678,7 +11688,7 @@ var SelfCapabilities = class extends Destroyable {
11678
11688
  }
11679
11689
  /** Observable for end call capability */
11680
11690
  get end$() {
11681
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.end), (0, import_cjs$17.distinctUntilChanged)());
11691
+ return this.cachedObservable("end$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.end), (0, import_cjs$17.distinctUntilChanged)()));
11682
11692
  }
11683
11693
  /** Current end call capability */
11684
11694
  get end() {
@@ -11686,7 +11696,7 @@ var SelfCapabilities = class extends Destroyable {
11686
11696
  }
11687
11697
  /** Observable for set layout capability */
11688
11698
  get setLayout$() {
11689
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.setLayout), (0, import_cjs$17.distinctUntilChanged)());
11699
+ return this.cachedObservable("setLayout$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.setLayout), (0, import_cjs$17.distinctUntilChanged)()));
11690
11700
  }
11691
11701
  /** Current set layout capability */
11692
11702
  get setLayout() {
@@ -11694,7 +11704,7 @@ var SelfCapabilities = class extends Destroyable {
11694
11704
  }
11695
11705
  /** Observable for send digit capability */
11696
11706
  get sendDigit$() {
11697
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.sendDigit), (0, import_cjs$17.distinctUntilChanged)());
11707
+ return this.cachedObservable("sendDigit$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.sendDigit), (0, import_cjs$17.distinctUntilChanged)()));
11698
11708
  }
11699
11709
  /** Current send digit capability */
11700
11710
  get sendDigit() {
@@ -11702,7 +11712,7 @@ var SelfCapabilities = class extends Destroyable {
11702
11712
  }
11703
11713
  /** Observable for vmuted hide capability */
11704
11714
  get vmutedHide$() {
11705
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.vmutedHide), (0, import_cjs$17.distinctUntilChanged)());
11715
+ return this.cachedObservable("vmutedHide$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.vmutedHide), (0, import_cjs$17.distinctUntilChanged)()));
11706
11716
  }
11707
11717
  /** Current vmuted hide capability */
11708
11718
  get vmutedHide() {
@@ -11710,7 +11720,7 @@ var SelfCapabilities = class extends Destroyable {
11710
11720
  }
11711
11721
  /** Observable for lock capability */
11712
11722
  get lock$() {
11713
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.lock), (0, import_cjs$17.distinctUntilChanged)());
11723
+ return this.cachedObservable("lock$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.lock), (0, import_cjs$17.distinctUntilChanged)()));
11714
11724
  }
11715
11725
  /** Current lock capability */
11716
11726
  get lock() {
@@ -11718,7 +11728,7 @@ var SelfCapabilities = class extends Destroyable {
11718
11728
  }
11719
11729
  /** Observable for device capability */
11720
11730
  get device$() {
11721
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.device), (0, import_cjs$17.distinctUntilChanged)());
11731
+ return this.cachedObservable("device$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.device), (0, import_cjs$17.distinctUntilChanged)()));
11722
11732
  }
11723
11733
  /** Current device capability */
11724
11734
  get device() {
@@ -11726,7 +11736,7 @@ var SelfCapabilities = class extends Destroyable {
11726
11736
  }
11727
11737
  /** Observable for screenshare capability */
11728
11738
  get screenshare$() {
11729
- return this._state$.pipe((0, import_cjs$17.map)((state) => state.screenshare), (0, import_cjs$17.distinctUntilChanged)());
11739
+ return this.cachedObservable("screenshare$", () => this._state$.pipe((0, import_cjs$17.map)((state) => state.screenshare), (0, import_cjs$17.distinctUntilChanged)()));
11730
11740
  }
11731
11741
  /** Current screenshare capability */
11732
11742
  get screenshare() {
@@ -11779,83 +11789,83 @@ var Participant = class extends Destroyable {
11779
11789
  }
11780
11790
  /** Observable of the participant's display name. */
11781
11791
  get name$() {
11782
- return this._state$.pipe((0, import_operators$1.map)((state) => state.name), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11792
+ return this.cachedObservable("name$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.name), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11783
11793
  }
11784
11794
  /** Observable of the participant type (e.g. `'member'`, `'screen'`). */
11785
11795
  get type$() {
11786
- return this._state$.pipe((0, import_operators$1.map)((state) => state.type), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11796
+ return this.cachedObservable("type$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.type), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11787
11797
  }
11788
11798
  /** Observable indicating whether the participant has raised their hand. */
11789
11799
  get handraised$() {
11790
- return this._state$.pipe((0, import_operators$1.map)((state) => state.handraised), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11800
+ return this.cachedObservable("handraised$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.handraised), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11791
11801
  }
11792
11802
  /** Observable indicating whether the participant is visible in the layout. */
11793
11803
  get visible$() {
11794
- return this._state$.pipe((0, import_operators$1.map)((state) => state.visible), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11804
+ return this.cachedObservable("visible$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.visible), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11795
11805
  }
11796
11806
  /** Observable indicating whether the participant's audio is muted. */
11797
11807
  get audioMuted$() {
11798
- return this._state$.pipe((0, import_operators$1.map)((state) => state.audio_muted), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11808
+ return this.cachedObservable("audioMuted$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.audio_muted), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11799
11809
  }
11800
11810
  /** Observable indicating whether the participant's video is muted. */
11801
11811
  get videoMuted$() {
11802
- return this._state$.pipe((0, import_operators$1.map)((state) => state.video_muted), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11812
+ return this.cachedObservable("videoMuted$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.video_muted), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11803
11813
  }
11804
11814
  /** Observable indicating whether the participant is deafened. */
11805
11815
  get deaf$() {
11806
- return this._state$.pipe((0, import_operators$1.map)((state) => state.deaf), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11816
+ return this.cachedObservable("deaf$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.deaf), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11807
11817
  }
11808
11818
  /** Observable of the participant's microphone input volume. */
11809
11819
  get inputVolume$() {
11810
- return this._state$.pipe((0, import_operators$1.map)((state) => state.input_volume), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11820
+ return this.cachedObservable("inputVolume$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.input_volume), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11811
11821
  }
11812
11822
  /** Observable of the participant's speaker output volume. */
11813
11823
  get outputVolume$() {
11814
- return this._state$.pipe((0, import_operators$1.map)((state) => state.output_volume), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11824
+ return this.cachedObservable("outputVolume$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.output_volume), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11815
11825
  }
11816
11826
  /** Observable of the microphone input sensitivity level. */
11817
11827
  get inputSensitivity$() {
11818
- return this._state$.pipe((0, import_operators$1.map)((state) => state.input_sensitivity), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11828
+ return this.cachedObservable("inputSensitivity$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.input_sensitivity), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11819
11829
  }
11820
11830
  /** Observable indicating whether echo cancellation is enabled. */
11821
11831
  get echoCancellation$() {
11822
- return this._state$.pipe((0, import_operators$1.map)((state) => state.echo_cancellation), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11832
+ return this.cachedObservable("echoCancellation$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.echo_cancellation), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11823
11833
  }
11824
11834
  /** Observable indicating whether auto-gain control is enabled. */
11825
11835
  get autoGain$() {
11826
- return this._state$.pipe((0, import_operators$1.map)((state) => state.auto_gain), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11836
+ return this.cachedObservable("autoGain$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.auto_gain), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11827
11837
  }
11828
11838
  /** Observable indicating whether noise suppression is enabled. */
11829
11839
  get noiseSuppression$() {
11830
- return this._state$.pipe((0, import_operators$1.map)((state) => state.noise_suppression), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11840
+ return this.cachedObservable("noiseSuppression$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.noise_suppression), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11831
11841
  }
11832
11842
  /** Observable indicating whether low-bitrate mode is active. */
11833
11843
  get lowbitrate$() {
11834
- return this._state$.pipe((0, import_operators$1.map)((state) => state.lowbitrate), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11844
+ return this.cachedObservable("lowbitrate$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.lowbitrate), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11835
11845
  }
11836
11846
  /** Observable indicating whether noise reduction is active. */
11837
11847
  get denoise$() {
11838
- return this._state$.pipe((0, import_operators$1.map)((state) => state.denoise), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11848
+ return this.cachedObservable("denoise$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.denoise), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11839
11849
  }
11840
11850
  /** Observable of custom metadata for this participant. */
11841
11851
  get meta$() {
11842
- return this._state$.pipe((0, import_operators$1.map)((state) => state.meta), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11852
+ return this.cachedObservable("meta$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.meta), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11843
11853
  }
11844
11854
  /** Observable of the participant's subscriber ID. */
11845
11855
  get subscriberId$() {
11846
- return this._state$.pipe((0, import_operators$1.map)((state) => state.subscriber_id), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11856
+ return this.cachedObservable("subscriberId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.subscriber_id), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11847
11857
  }
11848
11858
  /** Observable of the participant's address ID. */
11849
11859
  get addressId$() {
11850
- return this._state$.pipe((0, import_operators$1.map)((state) => state.address_id), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11860
+ return this.cachedObservable("addressId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.address_id), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11851
11861
  }
11852
11862
  /** Observable of the server node ID for this participant. */
11853
11863
  get nodeId$() {
11854
- return this._state$.pipe((0, import_operators$1.map)((state) => state.node_id), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11864
+ return this.cachedObservable("nodeId$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.node_id), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11855
11865
  }
11856
11866
  /** Observable indicating whether the participant is currently speaking. */
11857
11867
  get isTalking$() {
11858
- return this._state$.pipe((0, import_operators$1.map)((state) => state.talking), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11868
+ return this.cachedObservable("isTalking$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.talking), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11859
11869
  }
11860
11870
  /** Whether the participant is currently speaking. */
11861
11871
  get isTalking() {
@@ -11863,7 +11873,7 @@ var Participant = class extends Destroyable {
11863
11873
  }
11864
11874
  /** Observable of the participant's layout position. */
11865
11875
  get position$() {
11866
- return this._state$.pipe((0, import_operators$1.map)((state) => state.position), (0, import_operators$1.distinctUntilChanged)(), filterNull());
11876
+ return this.cachedObservable("position$", () => this._state$.pipe((0, import_operators$1.map)((state) => state.position), (0, import_operators$1.distinctUntilChanged)(), filterNull()));
11867
11877
  }
11868
11878
  /** Current layout position. */
11869
11879
  get position() {
@@ -12380,10 +12390,10 @@ var CallEventsManager = class extends Destroyable {
12380
12390
  this.initSubscriptions();
12381
12391
  }
12382
12392
  get participants$() {
12383
- return this._participants$.asObservable().pipe((0, import_cjs$14.map)((participantsRecord) => Object.values(participantsRecord)));
12393
+ return this.cachedObservable("participants$", () => this._participants$.asObservable().pipe((0, import_cjs$14.map)((participantsRecord) => Object.values(participantsRecord))));
12384
12394
  }
12385
12395
  get self$() {
12386
- return this._self$.asObservable().pipe(filterNull());
12396
+ return this.cachedObservable("self$", () => this._self$.asObservable().pipe(filterNull()));
12387
12397
  }
12388
12398
  get status$() {
12389
12399
  return this._status$.asObservable();
@@ -12401,40 +12411,40 @@ var CallEventsManager = class extends Destroyable {
12401
12411
  return this.callIds.has(callId);
12402
12412
  }
12403
12413
  get recording$() {
12404
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.recording), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12414
+ return this.cachedObservable("recording$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.recording), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12405
12415
  }
12406
12416
  get recordings$() {
12407
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.recordings), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12417
+ return this.cachedObservable("recordings$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.recordings), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12408
12418
  }
12409
12419
  get streaming$() {
12410
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.streaming), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12420
+ return this.cachedObservable("streaming$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.streaming), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12411
12421
  }
12412
12422
  get streams$() {
12413
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.streams), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12423
+ return this.cachedObservable("streams$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.streams), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12414
12424
  }
12415
12425
  get playbacks$() {
12416
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.playbacks), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12426
+ return this.cachedObservable("playbacks$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.playbacks), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12417
12427
  }
12418
12428
  get raiseHandPriority$() {
12419
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.prioritize_handraise), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12429
+ return this.cachedObservable("raiseHandPriority$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.prioritize_handraise), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12420
12430
  }
12421
12431
  get locked$() {
12422
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.locked), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12432
+ return this.cachedObservable("locked$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.locked), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12423
12433
  }
12424
12434
  get meta$() {
12425
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.meta), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12435
+ return this.cachedObservable("meta$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.meta), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12426
12436
  }
12427
12437
  get capabilities$() {
12428
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.capabilities), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12438
+ return this.cachedObservable("capabilities$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.capabilities), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12429
12439
  }
12430
12440
  get layout$() {
12431
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.layout_name), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12441
+ return this.cachedObservable("layout$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.layout_name), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12432
12442
  }
12433
12443
  get layouts$() {
12434
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.layouts), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12444
+ return this.cachedObservable("layouts$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.layouts), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12435
12445
  }
12436
12446
  get layoutLayers$() {
12437
- return this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.layout_layers), (0, import_cjs$14.distinctUntilChanged)(), filterNull());
12447
+ return this.cachedObservable("layoutLayers$", () => this._sessionState$.pipe((0, import_cjs$14.map)((state) => state.layout_layers), (0, import_cjs$14.distinctUntilChanged)(), filterNull()));
12438
12448
  }
12439
12449
  get self() {
12440
12450
  return this._self$.value;
@@ -12570,19 +12580,19 @@ var CallEventsManager = class extends Destroyable {
12570
12580
  this._participants$.next(this._participants$.value);
12571
12581
  }
12572
12582
  get callJoinedEvent$() {
12573
- return this.webRtcCallSession.callEvent$.pipe((0, import_cjs$14.filter)(isCallJoinedPayload), (0, import_cjs$14.tap)((event) => {
12583
+ return this.cachedObservable("callJoinedEvent$", () => this.webRtcCallSession.callEvent$.pipe((0, import_cjs$14.filter)(isCallJoinedPayload), (0, import_cjs$14.tap)((event) => {
12574
12584
  logger$15.debug("[CallEventsManager] Call joined event:", event);
12575
- }));
12585
+ })));
12576
12586
  }
12577
12587
  get layoutChangedEvent$() {
12578
- return this.webRtcCallSession.callEvent$.pipe(filterAs(isLayoutChangedPayload, "layout"), (0, import_cjs$14.tap)((event) => {
12588
+ return this.cachedObservable("layoutChangedEvent$", () => this.webRtcCallSession.callEvent$.pipe(filterAs(isLayoutChangedPayload, "layout"), (0, import_cjs$14.tap)((event) => {
12579
12589
  logger$15.debug("[CallEventsManager] Layout changed event:", event);
12580
- }));
12590
+ })));
12581
12591
  }
12582
12592
  get memberUpdates$() {
12583
- return (0, import_cjs$14.merge)(this.webRtcCallSession.memberJoined$, this.webRtcCallSession.memberUpdated$, this.webRtcCallSession.memberTalking$).pipe((0, import_cjs$14.map)((event) => event.member), (0, import_cjs$14.tap)((event) => {
12593
+ return this.cachedObservable("memberUpdates$", () => (0, import_cjs$14.merge)(this.webRtcCallSession.memberJoined$, this.webRtcCallSession.memberUpdated$, this.webRtcCallSession.memberTalking$).pipe((0, import_cjs$14.map)((event) => event.member), (0, import_cjs$14.tap)((event) => {
12584
12594
  logger$15.debug("[CallEventsManager] Member update event:", event);
12585
- }));
12595
+ })));
12586
12596
  }
12587
12597
  destroy() {
12588
12598
  Object.values(this._participants$.value).forEach((participant) => {
@@ -13313,43 +13323,43 @@ var RTCPeerConnectionController = class extends Destroyable {
13313
13323
  };
13314
13324
  }
13315
13325
  get iceGatheringState$() {
13316
- return this._iceGatheringState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13326
+ return this.cachedObservable("iceGatheringState$", () => this._iceGatheringState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13317
13327
  }
13318
13328
  get mediaTrackEnded$() {
13319
- return this.localStreamController.mediaTrackEnded$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13329
+ return this.cachedObservable("mediaTrackEnded$", () => this.localStreamController.mediaTrackEnded$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13320
13330
  }
13321
13331
  get errors$() {
13322
- return this._errors$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13332
+ return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13323
13333
  }
13324
13334
  get iceCandidates$() {
13325
- return this._iceCandidates$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13335
+ return this.cachedObservable("iceCandidates$", () => this._iceCandidates$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13326
13336
  }
13327
13337
  get initialized$() {
13328
- return this._initialized$.asObservable().pipe((0, import_cjs$11.filter)((initialized) => initialized), (0, import_cjs$11.takeUntil)(this.destroyed$));
13338
+ return this.cachedObservable("initialized$", () => this._initialized$.asObservable().pipe((0, import_cjs$11.filter)((initialized) => initialized), (0, import_cjs$11.takeUntil)(this.destroyed$)));
13329
13339
  }
13330
13340
  get remoteDescription$() {
13331
- return this._remoteDescription$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13341
+ return this.cachedObservable("remoteDescription$", () => this._remoteDescription$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13332
13342
  }
13333
13343
  get localStream$() {
13334
- return this.localStreamController.localStream$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13344
+ return this.cachedObservable("localStream$", () => this.localStreamController.localStream$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13335
13345
  }
13336
13346
  get remoteStream$() {
13337
- return this._remoteStream$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13347
+ return this.cachedObservable("remoteStream$", () => this._remoteStream$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13338
13348
  }
13339
13349
  get localAudioTracks$() {
13340
- return this.localStreamController.localAudioTracks$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13350
+ return this.cachedObservable("localAudioTracks$", () => this.localStreamController.localAudioTracks$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13341
13351
  }
13342
13352
  get localVideoTracks$() {
13343
- return this.localStreamController.localVideoTracks$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13353
+ return this.cachedObservable("localVideoTracks$", () => this.localStreamController.localVideoTracks$.pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13344
13354
  }
13345
13355
  get iceConnectionState$() {
13346
- return this._iceConnectionState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13356
+ return this.cachedObservable("iceConnectionState$", () => this._iceConnectionState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13347
13357
  }
13348
13358
  get connectionState$() {
13349
- return this._connectionState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13359
+ return this.cachedObservable("connectionState$", () => this._connectionState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13350
13360
  }
13351
13361
  get signalingState$() {
13352
- return this._signalingState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$));
13362
+ return this.cachedObservable("signalingState$", () => this._signalingState$.asObservable().pipe((0, import_cjs$11.takeUntil)(this.destroyed$)));
13353
13363
  }
13354
13364
  get type() {
13355
13365
  return this._type;
@@ -13928,11 +13938,11 @@ var WebRTCVertoManager = class extends VertoManager {
13928
13938
  return rtcPeerConnection;
13929
13939
  }
13930
13940
  get signalingStatus$() {
13931
- return (0, import_cjs$10.merge)(this._signalingStatus$.pipe(filterNull()), this.mainPeerConnection.connectionState$.pipe((0, import_cjs$10.filter)((connectionState) => [
13941
+ return this.cachedObservable("signalingStatus$", () => (0, import_cjs$10.merge)(this._signalingStatus$.pipe(filterNull()), this.mainPeerConnection.connectionState$.pipe((0, import_cjs$10.filter)((connectionState) => [
13932
13942
  "connected",
13933
13943
  "disconnected",
13934
13944
  "failed"
13935
- ].includes(connectionState))));
13945
+ ].includes(connectionState)))));
13936
13946
  }
13937
13947
  initSubscriptions() {
13938
13948
  this.subscribeTo(this.vertoAnswer$, (event) => {
@@ -13980,19 +13990,19 @@ var WebRTCVertoManager = class extends VertoManager {
13980
13990
  return this._selfId$.value;
13981
13991
  }
13982
13992
  get vertoAnswer$() {
13983
- return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAnswerInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
13993
+ return this.cachedObservable("vertoAnswer$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAnswerInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$)));
13984
13994
  }
13985
13995
  get vertoMediaParams$() {
13986
- return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaParamsInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
13996
+ return this.cachedObservable("vertoMediaParams$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaParamsInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$)));
13987
13997
  }
13988
13998
  get vertoBye$() {
13989
- return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoByeMessage, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
13999
+ return this.cachedObservable("vertoBye$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoByeMessage, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$)));
13990
14000
  }
13991
14001
  get vertoAttach$() {
13992
- return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAttachMessage, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
14002
+ return this.cachedObservable("vertoAttach$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoAttachMessage, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$)));
13993
14003
  }
13994
14004
  get vertoPing$() {
13995
- return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoPingInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
14005
+ return this.cachedObservable("vertoPing$", () => this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoPingInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$)));
13996
14006
  }
13997
14007
  async executeVerto(message, optionals = {}) {
13998
14008
  const webrtcVertoMessage = WebrtcVerto({
@@ -14554,7 +14564,7 @@ var WebRTCCall = class extends Destroyable {
14554
14564
  }
14555
14565
  /** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
14556
14566
  get status$() {
14557
- return (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$);
14567
+ return this.cachedObservable("status$", () => (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$));
14558
14568
  }
14559
14569
  /** Observable of the participants list, emits on join/leave/update. */
14560
14570
  get participants$() {
@@ -14658,7 +14668,7 @@ var WebRTCCall = class extends Destroyable {
14658
14668
  return this.vertoManager.mediaDirections;
14659
14669
  }
14660
14670
  get participantsId$() {
14661
- return this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id)));
14671
+ return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id))));
14662
14672
  }
14663
14673
  /** Executes a raw JSON-RPC request on the client session. */
14664
14674
  async execute(request, options) {
@@ -14693,35 +14703,35 @@ var WebRTCCall = class extends Destroyable {
14693
14703
  }
14694
14704
  }
14695
14705
  get callSessionEvents$() {
14696
- return this.clientSession.signalingEvent$.pipe((0, import_cjs$9.filter)((event) => this.isCallSessionEvent(event)), (0, import_cjs$9.tap)((event) => logger$9.debug("[Call] Received call session event:", event)), (0, import_cjs$9.takeUntil)(this.destroyed$));
14706
+ return this.cachedObservable("callSessionEvents$", () => this.clientSession.signalingEvent$.pipe((0, import_cjs$9.filter)((event) => this.isCallSessionEvent(event)), (0, import_cjs$9.tap)((event) => logger$9.debug("[Call] Received call session event:", event)), (0, import_cjs$9.takeUntil)(this.destroyed$), (0, import_cjs$9.share)()));
14697
14707
  }
14698
14708
  /** Observable of call-updated events. */
14699
14709
  get callUpdated$() {
14700
- return this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14710
+ return this.cachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14701
14711
  }
14702
14712
  /** Observable of member-joined events. */
14703
14713
  get memberJoined$() {
14704
- return this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14714
+ return this.cachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14705
14715
  }
14706
14716
  /** Observable of member-left events. */
14707
14717
  get memberLeft$() {
14708
- return this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14718
+ return this.cachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14709
14719
  }
14710
14720
  /** Observable of member-updated events (mute, volume, etc.). */
14711
14721
  get memberUpdated$() {
14712
- return this.callSessionEvents$.pipe(filterAs(isMemberUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14722
+ return this.cachedObservable("memberUpdated$", () => this.callSessionEvents$.pipe(filterAs(isMemberUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14713
14723
  }
14714
14724
  /** Observable of member-talking events (speech start/stop). */
14715
14725
  get memberTalking$() {
14716
- return this.callSessionEvents$.pipe(filterAs(isMemberTalkingMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14726
+ return this.cachedObservable("memberTalking$", () => this.callSessionEvents$.pipe(filterAs(isMemberTalkingMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14717
14727
  }
14718
14728
  /** Observable of call state-change events. */
14719
14729
  get callStates$() {
14720
- return this.callSessionEvents$.pipe(filterAs(isCallStateMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14730
+ return this.cachedObservable("callStates$", () => this.callSessionEvents$.pipe(filterAs(isCallStateMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14721
14731
  }
14722
14732
  /** Observable of layout-changed events. */
14723
14733
  get layoutUpdates$() {
14724
- return this.callSessionEvents$.pipe(filterAs(isLayoutChangedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$));
14734
+ return this.cachedObservable("layoutUpdates$", () => this.callSessionEvents$.pipe(filterAs(isLayoutChangedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
14725
14735
  }
14726
14736
  /** Underlying `RTCPeerConnection`, for advanced use cases. */
14727
14737
  get rtcPeerConnection() {
@@ -14729,19 +14739,19 @@ var WebRTCCall = class extends Destroyable {
14729
14739
  }
14730
14740
  /** Observable of raw signaling events as plain objects. */
14731
14741
  get signalingEvent$() {
14732
- return this.callEvent$.pipe((0, import_cjs$9.map)((event) => JSON.parse(JSON.stringify(event))));
14742
+ return this.cachedObservable("signalingEvent$", () => this.callEvent$.pipe((0, import_cjs$9.map)((event) => JSON.parse(JSON.stringify(event)))));
14733
14743
  }
14734
14744
  /** Observable of WebRTC-specific signaling messages. */
14735
14745
  get webrtcMessages$() {
14736
- return this.callSessionEvents$.pipe(filterAs(isWebrtcMessageMetadata, "params"), (0, import_cjs$9.tap)((event) => logger$9.debug("[Call] Event is a WebRTC message event:", event)), (0, import_cjs$9.takeUntil)(this.destroyed$));
14746
+ return this.cachedObservable("webrtcMessages$", () => this.callSessionEvents$.pipe(filterAs(isWebrtcMessageMetadata, "params"), (0, import_cjs$9.tap)((event) => logger$9.debug("[Call] Event is a WebRTC message event:", event)), (0, import_cjs$9.takeUntil)(this.destroyed$), (0, import_cjs$9.share)()));
14737
14747
  }
14738
14748
  /** Observable of call-level signaling events. */
14739
14749
  get callEvent$() {
14740
- return this.callSessionEvents$.pipe(filterAs(isSignalwireCallMetadata, "params"), (0, import_cjs$9.tap)((event) => logger$9.debug("[Call] Event is a call event:", event)), (0, import_cjs$9.takeUntil)(this.destroyed$));
14750
+ return this.cachedObservable("callEvent$", () => this.callSessionEvents$.pipe(filterAs(isSignalwireCallMetadata, "params"), (0, import_cjs$9.tap)((event) => logger$9.debug("[Call] Event is a call event:", event)), (0, import_cjs$9.takeUntil)(this.destroyed$), (0, import_cjs$9.share)()));
14741
14751
  }
14742
14752
  /** Observable of layout-changed signaling events. */
14743
14753
  get layoutEvent$() {
14744
- return this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params"));
14754
+ return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
14745
14755
  }
14746
14756
  /** Hangs up the call and releases all resources. */
14747
14757
  async hangup() {
@@ -14894,7 +14904,7 @@ var EntityCollection = class extends Destroyable {
14894
14904
  return this.fetchController.hasMore ?? true;
14895
14905
  }
14896
14906
  get updated$() {
14897
- return this.loading$.pipe((0, import_cjs$8.distinctUntilChanged)(), (0, import_cjs$8.skip)(1), (0, import_cjs$8.filter)((loading) => !loading), (0, import_cjs$8.map)(() => void 0), (0, import_cjs$8.takeUntil)(this._destroy$));
14907
+ return this.cachedObservable("updated$", () => this.loading$.pipe((0, import_cjs$8.distinctUntilChanged)(), (0, import_cjs$8.skip)(1), (0, import_cjs$8.filter)((loading) => !loading), (0, import_cjs$8.map)(() => void 0), (0, import_cjs$8.takeUntil)(this._destroy$)));
14898
14908
  }
14899
14909
  get values() {
14900
14910
  return Array.from(this.collectionData.values());
@@ -14974,7 +14984,7 @@ var EntityCollectionTransformed = class {
14974
14984
  return this.originalCollection.values.filter(this.filter).map(this.mapper);
14975
14985
  }
14976
14986
  get values$() {
14977
- return this.originalCollection.values$.pipe((0, import_cjs$8.map)((values) => values.filter(this.filter).map(this.mapper)));
14987
+ return this._values$ ??= this.originalCollection.values$.pipe((0, import_cjs$8.map)((values) => values.filter(this.filter).map(this.mapper)));
14978
14988
  }
14979
14989
  get$(id) {
14980
14990
  const original$ = this.originalCollection.get$(id);
@@ -15048,7 +15058,7 @@ var Address = class extends Destroyable {
15048
15058
  }
15049
15059
  /** Observable of the human-readable display name. */
15050
15060
  get displayName$() {
15051
- return this._state$.pipe(filterNull(), (0, import_cjs$7.map)((state) => state.display_name), (0, import_cjs$7.takeUntil)(this.destroyed$));
15061
+ return this.cachedObservable("displayName$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.map)((state) => state.display_name), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15052
15062
  }
15053
15063
  /** Human-readable display name. */
15054
15064
  get displayName() {
@@ -15057,7 +15067,7 @@ var Address = class extends Destroyable {
15057
15067
  }
15058
15068
  /** Observable of the preview image URL. */
15059
15069
  get previewUrl$() {
15060
- return this._state$.pipe(filterNull(), (0, import_cjs$7.map)((state) => state.preview_url), (0, import_cjs$7.takeUntil)(this.destroyed$));
15070
+ return this.cachedObservable("previewUrl$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.map)((state) => state.preview_url), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15061
15071
  }
15062
15072
  /** Preview image URL. */
15063
15073
  get previewUrl() {
@@ -15066,7 +15076,7 @@ var Address = class extends Destroyable {
15066
15076
  }
15067
15077
  /** Observable of the cover image URL. */
15068
15078
  get coverUrl$() {
15069
- return this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.cover_url), (0, import_cjs$7.takeUntil)(this.destroyed$));
15079
+ return this.cachedObservable("coverUrl$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.cover_url), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15070
15080
  }
15071
15081
  /** Cover image URL. */
15072
15082
  get coverUrl() {
@@ -15075,7 +15085,7 @@ var Address = class extends Destroyable {
15075
15085
  }
15076
15086
  /** Observable of the underlying resource ID. */
15077
15087
  get resourceId$() {
15078
- return this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.resource_id), (0, import_cjs$7.takeUntil)(this.destroyed$));
15088
+ return this.cachedObservable("resourceId$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.resource_id), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15079
15089
  }
15080
15090
  /** Underlying resource ID. */
15081
15091
  get resourceId() {
@@ -15084,7 +15094,7 @@ var Address = class extends Destroyable {
15084
15094
  }
15085
15095
  /** Observable of the resource type (e.g. `'room'`, `'subscriber'`). */
15086
15096
  get type$() {
15087
- return this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.type), (0, import_cjs$7.takeUntil)(this.destroyed$));
15097
+ return this.cachedObservable("type$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.type), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15088
15098
  }
15089
15099
  /** Resource type (e.g. `'room'`, `'subscriber'`). */
15090
15100
  get type() {
@@ -15093,7 +15103,7 @@ var Address = class extends Destroyable {
15093
15103
  }
15094
15104
  /** Observable of available communication channels (audio, video, messaging). */
15095
15105
  get channels$() {
15096
- return this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.channels), (0, import_cjs$7.takeUntil)(this.destroyed$));
15106
+ return this.cachedObservable("channels$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.channels), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15097
15107
  }
15098
15108
  /** Available communication channels. */
15099
15109
  get channels() {
@@ -15107,7 +15117,7 @@ var Address = class extends Destroyable {
15107
15117
  }
15108
15118
  /** Observable indicating whether the address (room) is locked. */
15109
15119
  get locked$() {
15110
- return this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.locked), (0, import_cjs$7.takeUntil)(this.destroyed$));
15120
+ return this.cachedObservable("locked$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.locked), (0, import_cjs$7.takeUntil)(this.destroyed$)));
15111
15121
  }
15112
15122
  /** Sends a text message to this address. */
15113
15123
  async sendText(text) {
@@ -15257,7 +15267,7 @@ var ClientSessionManager = class extends Destroyable {
15257
15267
  this.initialized$ = (0, import_cjs$5.defer)(() => (0, import_cjs$5.from)(this.init())).pipe((0, import_cjs$5.shareReplay)(1), (0, import_cjs$5.takeUntil)(this.destroyed$));
15258
15268
  }
15259
15269
  get incomingCalls$() {
15260
- return this.calls$.pipe((0, import_cjs$5.map)((calls) => calls.filter((call) => call.direction === "inbound")));
15270
+ return this.cachedObservable("incomingCalls$", () => this.calls$.pipe((0, import_cjs$5.map)((calls) => calls.filter((call) => call.direction === "inbound"))));
15261
15271
  }
15262
15272
  get incomingCalls() {
15263
15273
  return Object.values(this._calls$.value).filter((call) => call.direction === "inbound");
@@ -15269,7 +15279,7 @@ var ClientSessionManager = class extends Destroyable {
15269
15279
  return this._subscriberInfo$.value;
15270
15280
  }
15271
15281
  get calls$() {
15272
- return this._calls$.pipe((0, import_cjs$5.map)((calls) => Object.values(calls)));
15282
+ return this.cachedObservable("calls$", () => this._calls$.pipe((0, import_cjs$5.map)((calls) => Object.values(calls))));
15273
15283
  }
15274
15284
  get calls() {
15275
15285
  return Object.values(this._calls$.value);
@@ -15372,20 +15382,20 @@ var ClientSessionManager = class extends Destroyable {
15372
15382
  }
15373
15383
  }
15374
15384
  get authStateEvent$() {
15375
- return this.signalingEvent$.pipe((0, import_cjs$5.tap)((msg) => {
15385
+ return this.cachedObservable("authStateEvent$", () => this.signalingEvent$.pipe((0, import_cjs$5.tap)((msg) => {
15376
15386
  logger$6.debug("[Session] Received incoming message:", msg);
15377
15387
  }), filterAs(isSignalwireAuthorizationStateMetadata, "params"), (0, import_cjs$5.tap)((event) => {
15378
15388
  logger$6.debug("[Session] Authorization state event received:", event.authorization_state);
15379
- }));
15389
+ })));
15380
15390
  }
15381
15391
  get signalingEvent$() {
15382
- return this.transport.incomingEvent$.pipe(filterAs(isSignalwireRequest, "params"));
15392
+ return this.cachedObservable("signalingEvent$", () => this.transport.incomingEvent$.pipe(filterAs(isSignalwireRequest, "params"), (0, import_cjs$5.share)()));
15383
15393
  }
15384
15394
  get vertoInvite$() {
15385
- return this.signalingEvent$.pipe((0, import_cjs$5.filter)(isWebrtcMessageMetadata), (0, import_cjs$5.filter)((event) => isVertoInviteMessage(event.params)), (0, import_cjs$5.map)((event) => ({
15395
+ return this.cachedObservable("vertoInvite$", () => this.signalingEvent$.pipe((0, import_cjs$5.filter)(isWebrtcMessageMetadata), (0, import_cjs$5.filter)((event) => isVertoInviteMessage(event.params)), (0, import_cjs$5.map)((event) => ({
15386
15396
  node_id: event.node_id,
15387
15397
  ...event.params.params
15388
- })));
15398
+ }))));
15389
15399
  }
15390
15400
  get contexts() {
15391
15401
  return [];
@@ -15512,12 +15522,15 @@ var ClientSessionManager = class extends Destroyable {
15512
15522
  }
15513
15523
  async createCall(options = {}) {
15514
15524
  try {
15515
- if (!this._directory) throw new DependencyError("Directory not initialized");
15516
15525
  const addressURI = getAddressSearchURI(options);
15517
- const addressId = await this._directory.findAddressIdByURI(addressURI);
15518
- if (!addressId) throw new DependencyError(`Address name: ${addressURI} not found`);
15519
- const address = this._directory.get(addressId);
15520
- if (!address) throw new DependencyError(`Address ID: ${addressId} not found`);
15526
+ let address;
15527
+ if (!addressURI.startsWith("+")) {
15528
+ if (!this._directory) throw new DependencyError("Directory not initialized");
15529
+ const addressId = await this._directory.findAddressIdByURI(addressURI);
15530
+ if (!addressId) throw new DependencyError(`Address name: ${addressURI} not found`);
15531
+ address = this._directory.get(addressId);
15532
+ if (!address) throw new DependencyError(`Address ID: ${addressId} not found`);
15533
+ }
15521
15534
  const callSession = this.callFactory.createCall(address, { ...options });
15522
15535
  callSession.status$.pipe((0, import_cjs$5.filter)((status) => status === "destroyed"), (0, import_cjs$5.take)(1)).subscribe(() => {
15523
15536
  const { [`${callSession.id}`]: _, ...remainingCalls } = this._calls$.value;
@@ -15547,6 +15560,9 @@ var ClientSessionWrapper = class {
15547
15560
  get signalingEvent$() {
15548
15561
  return this.clientSessionManager.signalingEvent$;
15549
15562
  }
15563
+ get iceServers() {
15564
+ return this.clientSessionManager.iceServers;
15565
+ }
15550
15566
  async execute(request, options) {
15551
15567
  return this.clientSessionManager.execute(request, options);
15552
15568
  }
@@ -16194,7 +16210,7 @@ var SignalWire = class extends Destroyable {
16194
16210
  async init() {
16195
16211
  this._subscriber$.next(new Subscriber(this._deps.http));
16196
16212
  if (!this._options.skipConnection) await this.connect();
16197
- if (this._options.skipReconnect && this._attachManager) await this._attachManager.flush();
16213
+ if (!this._options.reconnectAttachedCalls && this._attachManager) await this._attachManager.flush();
16198
16214
  if (!this._options.skipRegister) this.register();
16199
16215
  this.handleAttachments();
16200
16216
  }
@@ -16333,7 +16349,7 @@ var SignalWire = class extends Destroyable {
16333
16349
  }
16334
16350
  /** Observable that emits `true` when the client is both connected and authenticated. */
16335
16351
  get ready$() {
16336
- return this._isConnected$.pipe((0, import_cjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, import_cjs.of)(false)));
16352
+ return this.cachedObservable("ready$", () => this._isConnected$.pipe((0, import_cjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, import_cjs.of)(false))));
16337
16353
  }
16338
16354
  /** Observable stream of errors from transport, authentication, and devices. */
16339
16355
  get errors$() {
@@ -16629,13 +16645,16 @@ exports.Address = Address;
16629
16645
  exports.CallCreateError = CallCreateError;
16630
16646
  exports.ClientPreferences = ClientPreferences;
16631
16647
  exports.CollectionFetchError = CollectionFetchError;
16648
+ exports.InvalidCredentialsError = InvalidCredentialsError;
16632
16649
  exports.MediaTrackError = MediaTrackError;
16633
16650
  exports.MessageParseError = MessageParseError;
16634
16651
  exports.Participant = Participant;
16652
+ exports.SelfCapabilities = SelfCapabilities;
16635
16653
  exports.SelfParticipant = SelfParticipant;
16636
16654
  exports.SignalWire = SignalWire;
16637
16655
  exports.StaticCredentialProvider = StaticCredentialProvider;
16638
16656
  exports.Subscriber = Subscriber;
16657
+ exports.UnexpectedError = UnexpectedError;
16639
16658
  exports.VertoPongError = VertoPongError;
16640
16659
  exports.WebRTCCall = WebRTCCall;
16641
16660
  exports.embeddableCall = embeddableCall;