@shenyin/embedded-call-widget 2.6.4 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const Ct = "0.21.1";
1
+ const Tt = "0.21.1";
2
2
  class le extends Error {
3
3
  constructor(e) {
4
4
  super(e), Object.setPrototypeOf(this, new.target.prototype);
@@ -15,7 +15,7 @@ class ye extends le {
15
15
  super(e || "Request pending.");
16
16
  }
17
17
  }
18
- class Et extends le {
18
+ class Ct extends le {
19
19
  constructor(e) {
20
20
  super(e || "Unspecified session description handler error.");
21
21
  }
@@ -30,7 +30,7 @@ class pe extends le {
30
30
  super(e || "An error occurred during state transition.");
31
31
  }
32
32
  }
33
- class xt {
33
+ class Et {
34
34
  /** @internal */
35
35
  constructor(e) {
36
36
  this.incomingAckRequest = e;
@@ -40,7 +40,7 @@ class xt {
40
40
  return this.incomingAckRequest.message;
41
41
  }
42
42
  }
43
- class Rt {
43
+ class xt {
44
44
  /** @internal */
45
45
  constructor(e) {
46
46
  this.incomingByeRequest = e;
@@ -58,7 +58,7 @@ class Rt {
58
58
  return this.incomingByeRequest.reject(e), Promise.resolve();
59
59
  }
60
60
  }
61
- class It {
61
+ class Rt {
62
62
  /** @internal */
63
63
  constructor(e) {
64
64
  this.incomingCancelRequest = e;
@@ -130,7 +130,7 @@ class be {
130
130
  return this.addListener(e, { once: !0 });
131
131
  }
132
132
  }
133
- class _t {
133
+ class It {
134
134
  /** @internal */
135
135
  constructor(e) {
136
136
  this.incomingInfoRequest = e;
@@ -430,7 +430,7 @@ class he extends Error {
430
430
  return t;
431
431
  }
432
432
  }
433
- function At(a, e) {
433
+ function _t(a, e) {
434
434
  e = e !== void 0 ? e : {};
435
435
  const t = {}, i = e.grammarSource, s = { Contact: 119, Name_Addr_Header: 156, Record_Route: 176, Request_Response: 81, SIP_URI: 45, Subscription_State: 186, Supported: 191, Require: 182, Via: 194, absoluteURI: 84, Call_ID: 118, Content_Disposition: 130, Content_Length: 135, Content_Type: 136, CSeq: 146, displayName: 122, Event: 149, From: 151, host: 52, Max_Forwards: 154, Min_SE: 213, Proxy_Authenticate: 157, quoted_string: 40, Refer_To: 178, Replaces: 179, Session_Expires: 210, stun_URI: 217, To: 192, turn_URI: 223, uuid: 226, WWW_Authenticate: 209, challenge: 158, sipfrag: 230, Referred_By: 231 };
436
436
  let r = 119;
@@ -943,7 +943,7 @@ function At(a, e) {
943
943
  return y;
944
944
  },
945
945
  function(l, y) {
946
- return St(l, y);
946
+ return vt(l, y);
947
947
  },
948
948
  function(l) {
949
949
  e = e || { data: {} }, e.startRule === "Require" && (e.data = l || []);
@@ -1374,7 +1374,7 @@ function At(a, e) {
1374
1374
  function Ke(l) {
1375
1375
  d < w || (d > w && (w = d, S = []), S.push(l));
1376
1376
  }
1377
- function vt(l, y, h) {
1377
+ function bt(l, y, h) {
1378
1378
  return new he(he.buildMessage(l, y), l, y, h);
1379
1379
  }
1380
1380
  function c(l) {
@@ -1469,8 +1469,8 @@ function At(a, e) {
1469
1469
  p = d, h++;
1470
1470
  break;
1471
1471
  case 26:
1472
- Ye = y.slice(h + 4, h + 4 + y[h + 3]).map(function(Tt) {
1473
- return C[C.length - 1 - Tt];
1472
+ Ye = y.slice(h + 4, h + 4 + y[h + 3]).map(function(St) {
1473
+ return C[C.length - 1 - St];
1474
1474
  }), C.splice(C.length - y[h + 2], y[h + 2], n[y[h + 1]].apply(null, Ye)), h += 4 + y[h + 3];
1475
1475
  break;
1476
1476
  case 27:
@@ -1493,20 +1493,20 @@ function At(a, e) {
1493
1493
  return C[0];
1494
1494
  }
1495
1495
  e.data = {};
1496
- function St(l, y) {
1496
+ function vt(l, y) {
1497
1497
  return [l].concat(y);
1498
1498
  }
1499
1499
  if (_ = ze(r), _ !== t && d === a.length)
1500
1500
  return _;
1501
- throw _ !== t && d < a.length && Ke(ke()), vt(S, w < a.length ? a.charAt(w) : null, w < a.length ? Pe(w, w + 1) : Pe(w, w));
1501
+ throw _ !== t && d < a.length && Ke(ke()), bt(S, w < a.length ? a.charAt(w) : null, w < a.length ? Pe(w, w + 1) : Pe(w, w));
1502
1502
  }
1503
- const $t = At;
1503
+ const At = _t;
1504
1504
  var k;
1505
1505
  (function(a) {
1506
1506
  function e(s, r) {
1507
1507
  const n = { startRule: r };
1508
1508
  try {
1509
- $t(s, n);
1509
+ At(s, n);
1510
1510
  } catch {
1511
1511
  n.data = -1;
1512
1512
  }
@@ -1524,7 +1524,7 @@ var k;
1524
1524
  }
1525
1525
  a.URIParse = i;
1526
1526
  })(k = k || (k = {}));
1527
- const Dt = {
1527
+ const $t = {
1528
1528
  100: "Trying",
1529
1529
  180: "Ringing",
1530
1530
  181: "Call Is Being Forwarded",
@@ -1606,7 +1606,7 @@ function oe(a, e = 32) {
1606
1606
  return t;
1607
1607
  }
1608
1608
  function _e(a) {
1609
- return Dt[a] || "";
1609
+ return $t[a] || "";
1610
1610
  }
1611
1611
  function Ae() {
1612
1612
  return oe(10);
@@ -1920,9 +1920,9 @@ var b;
1920
1920
  (function(a) {
1921
1921
  a.Initial = "Initial", a.HaveLocalOffer = "HaveLocalOffer", a.HaveRemoteOffer = "HaveRemoteOffer", a.Stable = "Stable", a.Closed = "Closed";
1922
1922
  })(b = b || (b = {}));
1923
- const Z = 500, kt = 4e3, Ze = 5e3, M = {
1923
+ const Z = 500, Dt = 4e3, Ze = 5e3, M = {
1924
1924
  T1: Z,
1925
- T2: kt,
1925
+ T2: Dt,
1926
1926
  TIMER_B: 64 * Z,
1927
1927
  TIMER_D: 0 * Z,
1928
1928
  TIMER_F: 64 * Z,
@@ -1995,7 +1995,7 @@ class je {
1995
1995
  return this.incomingNotifyRequest.reject(e), Promise.resolve();
1996
1996
  }
1997
1997
  }
1998
- class Pt {
1998
+ class kt {
1999
1999
  /** @internal */
2000
2000
  constructor(e, t) {
2001
2001
  this.incomingReferRequest = e, this.session = t;
@@ -2454,7 +2454,7 @@ class ge {
2454
2454
  sessionDescriptionHandlerModifiers: this.pendingReinviteAck ? this._sessionDescriptionHandlerModifiersReInvite : this._sessionDescriptionHandlerModifiers
2455
2455
  };
2456
2456
  if (this.delegate && this.delegate.onAck) {
2457
- const s = new xt(e);
2457
+ const s = new Et(e);
2458
2458
  this.delegate.onAck(s);
2459
2459
  }
2460
2460
  switch (this.pendingReinviteAck = !1, t.signalingState) {
@@ -2497,7 +2497,7 @@ class ge {
2497
2497
  return;
2498
2498
  }
2499
2499
  if (this.delegate && this.delegate.onBye) {
2500
- const t = new Rt(e);
2500
+ const t = new xt(e);
2501
2501
  this.delegate.onBye(t);
2502
2502
  } else
2503
2503
  e.accept();
@@ -2513,7 +2513,7 @@ class ge {
2513
2513
  return;
2514
2514
  }
2515
2515
  if (this.delegate && this.delegate.onInfo) {
2516
- const t = new _t(e);
2516
+ const t = new It(e);
2517
2517
  this.delegate.onInfo(t);
2518
2518
  } else
2519
2519
  e.accept();
@@ -2626,7 +2626,7 @@ class ge {
2626
2626
  this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."), e.reject();
2627
2627
  return;
2628
2628
  }
2629
- const t = new Pt(e, this);
2629
+ const t = new kt(e, this);
2630
2630
  this.delegate && this.delegate.onRefer ? this.delegate.onRefer(t) : (this.logger.log("No delegate available to handle REFER, automatically accepting and following."), t.accept().then(() => t.makeInviter(this._referralInviterOptions).invite()).catch((i) => {
2631
2631
  this.logger.error(i.message);
2632
2632
  }));
@@ -2843,7 +2843,7 @@ var G;
2843
2843
  (function(a) {
2844
2844
  a.Required = "Required", a.Supported = "Supported", a.Unsupported = "Unsupported";
2845
2845
  })(G = G || (G = {}));
2846
- const Ht = {
2846
+ const Pt = {
2847
2847
  "100rel": !0,
2848
2848
  199: !0,
2849
2849
  answermode: !0,
@@ -3049,7 +3049,7 @@ class ce extends ge {
3049
3049
  return;
3050
3050
  }
3051
3051
  if (this.delegate && this.delegate.onCancel) {
3052
- const t = new It(e);
3052
+ const t = new Rt(e);
3053
3053
  this.delegate.onCancel(t);
3054
3054
  }
3055
3055
  this.isCanceled = !0, this.incomingInviteRequest.reject({ statusCode: 487 }), this.stateTransition(m.Terminated);
@@ -3092,7 +3092,7 @@ class ce extends ge {
3092
3092
  */
3093
3093
  handleResponseError(e) {
3094
3094
  let t = 480;
3095
- if (e instanceof Error ? this.logger.error(e.message) : this.logger.error(e), e instanceof Be ? (this.logger.error("A session description handler occurred while sending response (content type unsupported"), t = 415) : e instanceof Et ? this.logger.error("A session description handler occurred while sending response") : e instanceof He ? this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)") : e instanceof ie && this.logger.error("Session changed state before response could be formulated and sent"), this.state === m.Initial || this.state === m.Establishing)
3095
+ if (e instanceof Error ? this.logger.error(e.message) : this.logger.error(e), e instanceof Be ? (this.logger.error("A session description handler occurred while sending response (content type unsupported"), t = 415) : e instanceof Ct ? this.logger.error("A session description handler occurred while sending response") : e instanceof He ? this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)") : e instanceof ie && this.logger.error("Session changed state before response could be formulated and sent"), this.state === m.Initial || this.state === m.Establishing)
3096
3096
  try {
3097
3097
  this.incomingInviteRequest.reject({ statusCode: t }), this.stateTransition(m.Terminated);
3098
3098
  } catch (i) {
@@ -3716,7 +3716,7 @@ class Ce extends ge {
3716
3716
  }
3717
3717
  }
3718
3718
  }
3719
- class Mt {
3719
+ class Ht {
3720
3720
  /**
3721
3721
  * Constructs a new instance of the `Messager` class.
3722
3722
  * @param userAgent - User agent. See {@link UserAgent} for details.
@@ -4208,7 +4208,7 @@ P.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592" && console.error("Md5
4208
4208
  function ee(a) {
4209
4209
  return P.hashStr(a);
4210
4210
  }
4211
- class qt {
4211
+ class Mt {
4212
4212
  /**
4213
4213
  * Constructor.
4214
4214
  * @param loggerFactory - LoggerFactory.
@@ -4301,7 +4301,7 @@ class Xe {
4301
4301
  this.logger.level = e;
4302
4302
  }
4303
4303
  }
4304
- class Ot {
4304
+ class qt {
4305
4305
  constructor() {
4306
4306
  this.builtinEnabled = !0, this._level = H.log, this.loggers = {}, this.logger = this.getLogger("sip:loggerfactory");
4307
4307
  }
@@ -5653,7 +5653,7 @@ class q {
5653
5653
  this.core.userAgentClients.set(i, this);
5654
5654
  }
5655
5655
  }
5656
- class Ft extends q {
5656
+ class Ot extends q {
5657
5657
  constructor(e, t, i) {
5658
5658
  const s = e.createOutgoingRequestMessage(v.BYE, i);
5659
5659
  super(L, e.userAgentCore, s, t), e.dispose();
@@ -5942,18 +5942,18 @@ class J {
5942
5942
  this.core.userAgentServers.set(t.id, this);
5943
5943
  }
5944
5944
  }
5945
- class Nt extends J {
5945
+ class Ft extends J {
5946
5946
  constructor(e, t, i) {
5947
5947
  super(U, e.userAgentCore, t, i);
5948
5948
  }
5949
5949
  }
5950
- class Ut extends q {
5950
+ class Nt extends q {
5951
5951
  constructor(e, t, i) {
5952
5952
  const s = e.createOutgoingRequestMessage(v.INFO, i);
5953
5953
  super(L, e.userAgentCore, s, t);
5954
5954
  }
5955
5955
  }
5956
- class Lt extends J {
5956
+ class Ut extends J {
5957
5957
  constructor(e, t, i) {
5958
5958
  super(U, e.userAgentCore, t, i);
5959
5959
  }
@@ -5968,13 +5968,13 @@ class ft extends J {
5968
5968
  super(U, e, t, i);
5969
5969
  }
5970
5970
  }
5971
- class Bt extends q {
5971
+ class Lt extends q {
5972
5972
  constructor(e, t, i) {
5973
5973
  const s = e.createOutgoingRequestMessage(v.NOTIFY, i);
5974
5974
  super(L, e.userAgentCore, s, t);
5975
5975
  }
5976
5976
  }
5977
- function jt(a) {
5977
+ function Bt(a) {
5978
5978
  return a.userAgentCore !== void 0;
5979
5979
  }
5980
5980
  class Re extends J {
@@ -5984,17 +5984,17 @@ class Re extends J {
5984
5984
  * @param message - Incoming NOTIFY request message.
5985
5985
  */
5986
5986
  constructor(e, t, i) {
5987
- const s = jt(e) ? e.userAgentCore : e;
5987
+ const s = Bt(e) ? e.userAgentCore : e;
5988
5988
  super(U, s, t, i);
5989
5989
  }
5990
5990
  }
5991
- class Vt extends q {
5991
+ class jt extends q {
5992
5992
  constructor(e, t, i) {
5993
5993
  const s = e.createOutgoingRequestMessage(v.PRACK, i);
5994
5994
  super(L, e.userAgentCore, s, t), e.signalingStateTransition(s);
5995
5995
  }
5996
5996
  }
5997
- class Gt extends J {
5997
+ class Vt extends J {
5998
5998
  constructor(e, t, i) {
5999
5999
  super(U, e.userAgentCore, t, i), e.signalingStateTransition(t), this.dialog = e;
6000
6000
  }
@@ -6006,7 +6006,7 @@ class Gt extends J {
6006
6006
  return e.body && this.dialog.signalingStateTransition(e.body), super.accept(e);
6007
6007
  }
6008
6008
  }
6009
- class Wt extends q {
6009
+ class Gt extends q {
6010
6010
  constructor(e, t, i) {
6011
6011
  const s = e.createOutgoingRequestMessage(v.INVITE, i);
6012
6012
  super(re, e.userAgentCore, s, t), this.delegate = t, e.signalingStateTransition(s), e.reinviteUserAgentClient = this, this.dialog = e;
@@ -6049,7 +6049,7 @@ class Wt extends q {
6049
6049
  }
6050
6050
  }
6051
6051
  }
6052
- class Kt extends J {
6052
+ class Wt extends J {
6053
6053
  constructor(e, t, i) {
6054
6054
  super(N, e.userAgentCore, t, i), e.reinviteUserAgentServer = this, this.dialog = e;
6055
6055
  }
@@ -6091,13 +6091,13 @@ class Kt extends J {
6091
6091
  return this.dialog.signalingStateRollback(), this.dialog.reinviteUserAgentServer = void 0, super.reject(e);
6092
6092
  }
6093
6093
  }
6094
- class zt extends q {
6094
+ class Kt extends q {
6095
6095
  constructor(e, t, i) {
6096
6096
  const s = e.createOutgoingRequestMessage(v.REFER, i);
6097
6097
  super(L, e.userAgentCore, s, t);
6098
6098
  }
6099
6099
  }
6100
- function Yt(a) {
6100
+ function zt(a) {
6101
6101
  return a.userAgentCore !== void 0;
6102
6102
  }
6103
6103
  class pt extends J {
@@ -6107,7 +6107,7 @@ class pt extends J {
6107
6107
  * @param message - Incoming REFER request message.
6108
6108
  */
6109
6109
  constructor(e, t, i) {
6110
- const s = Yt(e) ? e.userAgentCore : e;
6110
+ const s = zt(e) ? e.userAgentCore : e;
6111
6111
  super(U, s, t, i);
6112
6112
  }
6113
6113
  }
@@ -6220,7 +6220,7 @@ class Ie extends fe {
6220
6220
  if (this.ackWait && this.initialTransaction.state !== g.Terminated)
6221
6221
  throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.");
6222
6222
  }
6223
- return new Ft(this, e, t);
6223
+ return new Ot(this, e, t);
6224
6224
  }
6225
6225
  /**
6226
6226
  * An INFO request can be associated with an Info Package (see
@@ -6235,7 +6235,7 @@ class Ie extends fe {
6235
6235
  info(e, t) {
6236
6236
  if (this.logger.log(`INVITE dialog ${this.id} sending INFO request`), this.early)
6237
6237
  throw new Error("Dialog not confirmed.");
6238
- return new Ut(this, e, t);
6238
+ return new Nt(this, e, t);
6239
6239
  }
6240
6240
  /**
6241
6241
  * Modifying an Existing Session
@@ -6265,7 +6265,7 @@ class Ie extends fe {
6265
6265
  throw new Error("There is an ongoing re-INVITE client transaction.");
6266
6266
  if (this.reinviteUserAgentServer)
6267
6267
  throw new Error("There is an ongoing re-INVITE server transaction.");
6268
- return new Wt(this, e, t);
6268
+ return new Gt(this, e, t);
6269
6269
  }
6270
6270
  /**
6271
6271
  * A UAC MAY associate a MESSAGE request with an existing dialog. If a
@@ -6289,7 +6289,7 @@ class Ie extends fe {
6289
6289
  notify(e, t) {
6290
6290
  if (this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`), this.early)
6291
6291
  throw new Error("Dialog not confirmed.");
6292
- return new Bt(this, e, t);
6292
+ return new Lt(this, e, t);
6293
6293
  }
6294
6294
  /**
6295
6295
  * Assuming the response is to be transmitted reliably, the UAC MUST
@@ -6302,7 +6302,7 @@ class Ie extends fe {
6302
6302
  * @param options - Options bucket.
6303
6303
  */
6304
6304
  prack(e, t) {
6305
- return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`), new Vt(this, e, t);
6305
+ return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`), new jt(this, e, t);
6306
6306
  }
6307
6307
  /**
6308
6308
  * REFER is a SIP request and is constructed as defined in [1]. A REFER
@@ -6313,7 +6313,7 @@ class Ie extends fe {
6313
6313
  refer(e, t) {
6314
6314
  if (this.logger.log(`INVITE dialog ${this.id} sending REFER request`), this.early)
6315
6315
  throw new Error("Dialog not confirmed.");
6316
- return new zt(this, e, t);
6316
+ return new Kt(this, e, t);
6317
6317
  }
6318
6318
  /**
6319
6319
  * Requests sent within a dialog, as any other requests, are atomic. If
@@ -6391,13 +6391,13 @@ class Ie extends fe {
6391
6391
  switch (e.method) {
6392
6392
  case v.BYE:
6393
6393
  {
6394
- const t = new Nt(this, e);
6394
+ const t = new Ft(this, e);
6395
6395
  this.delegate && this.delegate.onBye ? this.delegate.onBye(t) : t.accept(), this.dispose();
6396
6396
  }
6397
6397
  break;
6398
6398
  case v.INFO:
6399
6399
  {
6400
- const t = new Lt(this, e);
6400
+ const t = new Ut(this, e);
6401
6401
  this.delegate && this.delegate.onInfo ? this.delegate.onInfo(t) : t.reject({
6402
6402
  statusCode: 469,
6403
6403
  extraHeaders: ["Recv-Info:"]
@@ -6406,7 +6406,7 @@ class Ie extends fe {
6406
6406
  break;
6407
6407
  case v.INVITE:
6408
6408
  {
6409
- const t = new Kt(this, e);
6409
+ const t = new Wt(this, e);
6410
6410
  this.signalingStateTransition(e), this.delegate && this.delegate.onInvite ? this.delegate.onInvite(t) : t.reject({ statusCode: 488 });
6411
6411
  }
6412
6412
  break;
@@ -6424,7 +6424,7 @@ class Ie extends fe {
6424
6424
  break;
6425
6425
  case v.PRACK:
6426
6426
  {
6427
- const t = new Gt(this, e);
6427
+ const t = new Vt(this, e);
6428
6428
  this.delegate && this.delegate.onPrack ? this.delegate.onPrack(t) : t.accept();
6429
6429
  }
6430
6430
  break;
@@ -6575,7 +6575,7 @@ class Ie extends fe {
6575
6575
  }
6576
6576
  }
6577
6577
  }
6578
- class Jt extends q {
6578
+ class Yt extends q {
6579
6579
  constructor(e, t, i) {
6580
6580
  super(re, e, t, i), this.confirmedDialogAcks = /* @__PURE__ */ new Map(), this.confirmedDialogs = /* @__PURE__ */ new Map(), this.earlyDialogs = /* @__PURE__ */ new Map(), this.delegate = i;
6581
6581
  }
@@ -6799,22 +6799,22 @@ class Oe extends J {
6799
6799
  return super.reject(e);
6800
6800
  }
6801
6801
  }
6802
- class Zt extends q {
6802
+ class Jt extends q {
6803
6803
  constructor(e, t, i) {
6804
6804
  super(L, e, t, i);
6805
6805
  }
6806
6806
  }
6807
- class Xt extends q {
6807
+ class Zt extends q {
6808
6808
  constructor(e, t, i) {
6809
6809
  super(L, e, t, i);
6810
6810
  }
6811
6811
  }
6812
- class Qt extends J {
6812
+ class Xt extends J {
6813
6813
  constructor(e, t, i) {
6814
6814
  super(U, e, t, i), this.core = e;
6815
6815
  }
6816
6816
  }
6817
- class ei extends q {
6817
+ class Qt extends q {
6818
6818
  constructor(e, t, i) {
6819
6819
  const s = e.createOutgoingRequestMessage(v.SUBSCRIBE, i);
6820
6820
  super(L, e.userAgentCore, s, t), this.dialog = e;
@@ -6951,7 +6951,7 @@ class Qe extends fe {
6951
6951
  if (this.subscriptionState !== R.Pending && this.subscriptionState !== R.Active)
6952
6952
  throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);
6953
6953
  this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);
6954
- const s = new ei(this, e, t);
6954
+ const s = new Qt(this, e, t);
6955
6955
  return this.N && (clearTimeout(this.N), this.N = void 0), !((i = t.extraHeaders) === null || i === void 0) && i.includes("Expires: 0") || (this.N = setTimeout(() => this.timerN(), M.TIMER_N)), s;
6956
6956
  }
6957
6957
  /**
@@ -7074,7 +7074,7 @@ class Qe extends fe {
7074
7074
  this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."), this.subscriptionState !== R.Terminated && (this.stateTransition(R.Terminated), this.onTerminated());
7075
7075
  }
7076
7076
  }
7077
- class ti extends q {
7077
+ class ei extends q {
7078
7078
  constructor(e, t, i) {
7079
7079
  const s = t.getHeader("Event");
7080
7080
  if (!s)
@@ -7191,13 +7191,13 @@ class ti extends q {
7191
7191
  this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."), this.waitNotifyStop(), this.delegate && this.delegate.onNotifyTimeout && this.delegate.onNotifyTimeout();
7192
7192
  }
7193
7193
  }
7194
- class ii extends J {
7194
+ class ti extends J {
7195
7195
  constructor(e, t, i) {
7196
7196
  super(U, e, t, i), this.core = e;
7197
7197
  }
7198
7198
  }
7199
7199
  const et = ["application/sdp", "application/dtmf-relay"];
7200
- class si {
7200
+ class ii {
7201
7201
  /**
7202
7202
  * Constructor.
7203
7203
  * @param configuration - Configuration.
@@ -7231,7 +7231,7 @@ class si {
7231
7231
  * @param delegate - Request delegate.
7232
7232
  */
7233
7233
  invite(e, t) {
7234
- return new Jt(this, e, t);
7234
+ return new Yt(this, e, t);
7235
7235
  }
7236
7236
  /**
7237
7237
  * Send MESSAGE.
@@ -7247,7 +7247,7 @@ class si {
7247
7247
  * @param delegate - Request delegate.
7248
7248
  */
7249
7249
  publish(e, t) {
7250
- return new Zt(this, e, t);
7250
+ return new Jt(this, e, t);
7251
7251
  }
7252
7252
  /**
7253
7253
  * Send REGISTER.
@@ -7255,7 +7255,7 @@ class si {
7255
7255
  * @param delegate - Request delegate.
7256
7256
  */
7257
7257
  register(e, t) {
7258
- return new Xt(this, e, t);
7258
+ return new Zt(this, e, t);
7259
7259
  }
7260
7260
  /**
7261
7261
  * Send SUBSCRIBE.
@@ -7263,7 +7263,7 @@ class si {
7263
7263
  * @param delegate - Request delegate.
7264
7264
  */
7265
7265
  subscribe(e, t) {
7266
- return new ti(this, e, t);
7266
+ return new ei(this, e, t);
7267
7267
  }
7268
7268
  /**
7269
7269
  * Send a request.
@@ -7501,13 +7501,13 @@ class si {
7501
7501
  break;
7502
7502
  case v.REGISTER:
7503
7503
  {
7504
- const t = new Qt(this, e);
7504
+ const t = new Xt(this, e);
7505
7505
  this.delegate.onRegister ? this.delegate.onRegister(t) : t.reject({ statusCode: 405 });
7506
7506
  }
7507
7507
  break;
7508
7508
  case v.SUBSCRIBE:
7509
7509
  {
7510
- const t = new ii(this, e);
7510
+ const t = new ti(this, e);
7511
7511
  this.delegate.onSubscribe ? this.delegate.onSubscribe(t) : t.reject({ statusCode: 480 });
7512
7512
  }
7513
7513
  break;
@@ -7533,10 +7533,10 @@ class si {
7533
7533
  i ? i.transaction.receiveResponse(e) : this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`);
7534
7534
  }
7535
7535
  }
7536
- function ri() {
7536
+ function si() {
7537
7537
  return (a) => !a.audio && !a.video ? Promise.resolve(new MediaStream()) : navigator.mediaDevices === void 0 ? Promise.reject(new Error("Media devices not available in insecure contexts.")) : navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices, a);
7538
7538
  }
7539
- function ni() {
7539
+ function ri() {
7540
7540
  return {
7541
7541
  bundlePolicy: "balanced",
7542
7542
  certificates: void 0,
@@ -8078,12 +8078,12 @@ class O {
8078
8078
  };
8079
8079
  }
8080
8080
  }
8081
- function ai(a) {
8081
+ function ni(a) {
8082
8082
  return (e, t) => {
8083
- a === void 0 && (a = ri());
8083
+ a === void 0 && (a = si());
8084
8084
  const s = {
8085
8085
  iceGatheringTimeout: t?.iceGatheringTimeout !== void 0 ? t?.iceGatheringTimeout : 5e3,
8086
- peerConnectionConfiguration: Object.assign(Object.assign({}, ni()), t?.peerConnectionConfiguration)
8086
+ peerConnectionConfiguration: Object.assign(Object.assign({}, ri()), t?.peerConnectionConfiguration)
8087
8087
  }, r = e.userAgent.getLogger("sip.SessionDescriptionHandler");
8088
8088
  return new O(r, a, s);
8089
8089
  };
@@ -8501,7 +8501,7 @@ class V {
8501
8501
  const s = Math.floor(Math.random() * 254 + 1);
8502
8502
  this.options.viaHost = "192.0.2." + s;
8503
8503
  } else this.options.hackIpInContact && (this.options.viaHost = this.options.hackIpInContact);
8504
- switch (this.loggerFactory = new Ot(), this.logger = this.loggerFactory.getLogger("sip.UserAgent"), this.loggerFactory.builtinEnabled = this.options.logBuiltinEnabled, this.loggerFactory.connector = this.options.logConnector, this.options.logLevel) {
8504
+ switch (this.loggerFactory = new qt(), this.logger = this.loggerFactory.getLogger("sip.UserAgent"), this.loggerFactory.builtinEnabled = this.options.logBuiltinEnabled, this.loggerFactory.connector = this.options.logConnector, this.options.logLevel) {
8505
8505
  case "error":
8506
8506
  this.loggerFactory.level = H.error;
8507
8507
  break;
@@ -8585,7 +8585,7 @@ class V {
8585
8585
  reconnectionAttempts: 0,
8586
8586
  reconnectionDelay: 4,
8587
8587
  sendInitialProvisionalResponse: !0,
8588
- sessionDescriptionHandlerFactory: ai(),
8588
+ sessionDescriptionHandlerFactory: ni(),
8589
8589
  sessionDescriptionHandlerFactoryOptions: {},
8590
8590
  sipExtension100rel: G.Unsupported,
8591
8591
  sipExtensionReplaces: G.Unsupported,
@@ -8594,7 +8594,7 @@ class V {
8594
8594
  transportConstructor: Se,
8595
8595
  transportOptions: {},
8596
8596
  uri: new Y("sip", "anonymous", "anonymous.invalid"),
8597
- userAgentString: "SIP.js/" + Ct,
8597
+ userAgentString: "SIP.js/" + Tt,
8598
8598
  viaHost: ""
8599
8599
  };
8600
8600
  }
@@ -8810,7 +8810,7 @@ class V {
8810
8810
  */
8811
8811
  initCore() {
8812
8812
  let e = [];
8813
- e.push("outbound"), this.options.sipExtension100rel === G.Supported && e.push("100rel"), this.options.sipExtensionReplaces === G.Supported && e.push("replaces"), this.options.sipExtensionExtraSupported && e.push(...this.options.sipExtensionExtraSupported), this.options.hackAllowUnregisteredOptionTags || (e = e.filter((r) => Ht[r])), e = Array.from(new Set(e));
8813
+ e.push("outbound"), this.options.sipExtension100rel === G.Supported && e.push("100rel"), this.options.sipExtensionReplaces === G.Supported && e.push("replaces"), this.options.sipExtensionExtraSupported && e.push(...this.options.sipExtensionExtraSupported), this.options.hackAllowUnregisteredOptionTags || (e = e.filter((r) => Pt[r])), e = Array.from(new Set(e));
8814
8814
  const t = e.slice();
8815
8815
  (this.contact.pubGruu || this.contact.tempGruu) && t.push("gruu");
8816
8816
  const i = {
@@ -8828,7 +8828,7 @@ class V {
8828
8828
  viaHost: this.options.viaHost,
8829
8829
  authenticationFactory: () => {
8830
8830
  const r = this.options.authorizationUsername ? this.options.authorizationUsername : this.options.uri.user, n = this.options.authorizationPassword ? this.options.authorizationPassword : void 0, o = this.options.authorizationHa1 ? this.options.authorizationHa1 : void 0;
8831
- return new qt(this.getLoggerFactory(), o, r, n);
8831
+ return new Mt(this.getLoggerFactory(), o, r, n);
8832
8832
  },
8833
8833
  transportAccessor: () => this.transport
8834
8834
  }, s = {
@@ -8909,7 +8909,7 @@ class V {
8909
8909
  this.logger.warn("Received an out of dialog SUBSCRIBE request"), this.delegate && this.delegate.onSubscribeRequest ? this.delegate.onSubscribeRequest(r) : r.reject({ statusCode: 405 });
8910
8910
  }
8911
8911
  };
8912
- return new si(i, s);
8912
+ return new ii(i, s);
8913
8913
  }
8914
8914
  initTransportCallbacks() {
8915
8915
  this.transport.onConnect = () => this.onTransportConnect(), this.transport.onDisconnect = (e) => this.onTransportDisconnect(e), this.transport.onMessage = (e) => this.onTransportMessage(e);
@@ -9002,7 +9002,7 @@ class V {
9002
9002
  this.logger.log(`Transitioned from ${this._state} to ${e}`), this._state = e, this._stateEventEmitter.emit(this._state);
9003
9003
  }
9004
9004
  }
9005
- function oi() {
9005
+ function ai() {
9006
9006
  return (a, e) => ({ session: e, held: !1, muted: !1 });
9007
9007
  }
9008
9008
  class Ge {
@@ -9017,7 +9017,7 @@ class Ge {
9017
9017
  autoStop: !0,
9018
9018
  delegate: {},
9019
9019
  iceStopWaitingOnServerReflexive: !1,
9020
- managedSessionFactory: oi(),
9020
+ managedSessionFactory: ai(),
9021
9021
  maxSimultaneousSessions: 2,
9022
9022
  media: {},
9023
9023
  optionsPingInterval: -1,
@@ -9419,7 +9419,7 @@ Duration=` + 2e3
9419
9419
  async message(e, t) {
9420
9420
  this.logger.log("Sending message...");
9421
9421
  const i = V.makeURI(e);
9422
- return i ? new Mt(this.userAgent, i, t).message() : Promise.reject(new Error(`Failed to create a valid URI from "${e}"`));
9422
+ return i ? new Ht(this.userAgent, i, t).message() : Promise.reject(new Error(`Failed to create a valid URI from "${e}"`));
9423
9423
  }
9424
9424
  /** Media constraints. */
9425
9425
  get constraints() {
@@ -9782,7 +9782,7 @@ Duration=` + 2e3
9782
9782
  return this.logger.log(`[${e.id}] Terminating in state ${e.state}, no action taken`), Promise.resolve();
9783
9783
  }
9784
9784
  }
9785
- class ci {
9785
+ class oi {
9786
9786
  /**
9787
9787
  * Constructs a new instance of the `SimpleUser` class.
9788
9788
  * @param server - SIP WebSocket Server URL.
@@ -10051,7 +10051,7 @@ class ci {
10051
10051
  return this.logger.log(`[${this.id}] sending message...`), this.sessionManager.message(e, t);
10052
10052
  }
10053
10053
  }
10054
- const di = 15e3, li = 15e3, Fe = (a, e, t) => {
10054
+ const ci = 15e3, di = 15e3, Fe = (a, e, t) => {
10055
10055
  const i = String(a?.name || a?.code || "").trim(), s = new Error(e);
10056
10056
  return s.name = i || "MediaAccessError", s.code = t, s.cause = a, s;
10057
10057
  }, Ne = (a) => {
@@ -10081,7 +10081,7 @@ const di = 15e3, li = 15e3, Fe = (a, e, t) => {
10081
10081
  "麦克风当前被系统或其他应用占用,无法建立语音通话。请关闭占用麦克风的程序后重试。",
10082
10082
  "media_device_unavailable"
10083
10083
  ) : a;
10084
- }, hi = async (a = "call") => {
10084
+ }, li = async (a = "call") => {
10085
10085
  if (typeof navigator > "u" || !navigator.mediaDevices?.getUserMedia)
10086
10086
  return null;
10087
10087
  let e = null;
@@ -10091,7 +10091,7 @@ const di = 15e3, li = 15e3, Fe = (a, e, t) => {
10091
10091
  throw await Ve(t, a);
10092
10092
  }
10093
10093
  };
10094
- class ui {
10094
+ class hi {
10095
10095
  constructor(e, t = {}) {
10096
10096
  this.account = { ...e }, this.remoteAudioElementId = t.remoteAudioElementId || "sipRemoteAudio", this.remoteAudioElement = t.remoteAudioElement || null, this.onStateChange = t.onStateChange, this.onError = t.onError, this.onAudioLevel = t.onAudioLevel, this.onAudioFrame = t.onAudioFrame, this.simpleUser = null, this.connected = !1, this.registered = !1, this.active = !1, this.lastFailureMeta = null, this.audioContext = null, this.audioMonitors = {
10097
10097
  local: null,
@@ -10099,7 +10099,7 @@ class ui {
10099
10099
  }, this.audioTrackMeta = {
10100
10100
  local: null,
10101
10101
  remote: null
10102
- }, this.ringbackAudio = null, this.ringbackPlaying = !1, this.incomingAudio = null, this.incomingPlaying = !1, this.hangupInitiatedByLocal = !1, this.ringbackToneUrl = this._resolveToneUrl(t.ringbackTone || "ringback1.wav"), this.incomingToneUrl = this._resolveToneUrl(t.incomingTone || "ring1.wav"), this.pendingPlaybackTasks = /* @__PURE__ */ new Map(), this.audioUnlockHandler = null, this.lastSessionMeta = null, this.ensureReadyPromise = null, this.connectionWaiters = /* @__PURE__ */ new Set(), this.registrationWaiters = /* @__PURE__ */ new Set(), this.connectionConfirmTimeoutMs = Number.isFinite(Number(t.connectionConfirmTimeoutMs)) ? Number(t.connectionConfirmTimeoutMs) : di, this.registrationConfirmTimeoutMs = Number.isFinite(Number(t.registrationConfirmTimeoutMs)) ? Number(t.registrationConfirmTimeoutMs) : li, this.peerConnectionDebug = {
10102
+ }, this.ringbackAudio = null, this.ringbackPlaying = !1, this.incomingAudio = null, this.incomingPlaying = !1, this.hangupInitiatedByLocal = !1, this.ringbackToneUrl = this._resolveToneUrl(t.ringbackTone || "ringback1.wav"), this.incomingToneUrl = this._resolveToneUrl(t.incomingTone || "ring1.wav"), this.pendingPlaybackTasks = /* @__PURE__ */ new Map(), this.audioUnlockHandler = null, this.lastSessionMeta = null, this.ensureReadyPromise = null, this.connectionWaiters = /* @__PURE__ */ new Set(), this.registrationWaiters = /* @__PURE__ */ new Set(), this.connectionConfirmTimeoutMs = Number.isFinite(Number(t.connectionConfirmTimeoutMs)) ? Number(t.connectionConfirmTimeoutMs) : ci, this.registrationConfirmTimeoutMs = Number.isFinite(Number(t.registrationConfirmTimeoutMs)) ? Number(t.registrationConfirmTimeoutMs) : di, this.peerConnectionDebug = {
10103
10103
  attached: !1,
10104
10104
  events: [],
10105
10105
  iceCandidates: [],
@@ -10323,7 +10323,7 @@ class ui {
10323
10323
  registererOptions: {
10324
10324
  expires: 1800
10325
10325
  }
10326
- }, w = new ci(d, u);
10326
+ }, w = new oi(d, u);
10327
10327
  return w.delegate = {
10328
10328
  onServerConnect: () => {
10329
10329
  this.connected = !0, this._resolveConnectionWaiters(), this.onStateChange && this.onStateChange("connected", this.getConnectionSnapshot());
@@ -10599,7 +10599,7 @@ class ui {
10599
10599
  async _preflightAudioAccess(e = "call") {
10600
10600
  let t = null;
10601
10601
  try {
10602
- t = await hi(e);
10602
+ t = await li(e);
10603
10603
  } catch (i) {
10604
10604
  const s = await Ve(i, e);
10605
10605
  throw this.onError && this.onError(s), this.lastFailureMeta = {
@@ -11052,15 +11052,15 @@ class ui {
11052
11052
  this.audioContext = null;
11053
11053
  }
11054
11054
  }
11055
- const gi = /^[a-z][a-z0-9+.-]*:\/\//i;
11056
- function fi(a, e = "") {
11055
+ const ui = /^[a-z][a-z0-9+.-]*:\/\//i;
11056
+ function gi(a, e = "") {
11057
11057
  const t = String(a || e || "").trim();
11058
11058
  if (!t)
11059
11059
  throw new Error("缺少统一服务基址");
11060
11060
  return t;
11061
11061
  }
11062
11062
  function mt(a, e = "https://") {
11063
- return gi.test(a) ? a : `${e}${a.replace(/^\/+/, "")}`;
11063
+ return ui.test(a) ? a : `${e}${a.replace(/^\/+/, "")}`;
11064
11064
  }
11065
11065
  function wt(a = "/") {
11066
11066
  return a.endsWith("/") ? a : `${a}/`;
@@ -11070,10 +11070,10 @@ function yt(a = "/", e = "") {
11070
11070
  return i ? `${t}${i}` : t;
11071
11071
  }
11072
11072
  function De(a, e = "") {
11073
- const t = mt(fi(a, e)), i = new URL(t);
11073
+ const t = mt(gi(a, e)), i = new URL(t);
11074
11074
  return i.search = "", i.hash = "", i.pathname = wt(i.pathname || "/"), i;
11075
11075
  }
11076
- function pi(a, e = "") {
11076
+ function fi(a, e = "") {
11077
11077
  return De(a, e).pathname !== "/";
11078
11078
  }
11079
11079
  function X(a, e, t = "") {
@@ -11097,9 +11097,9 @@ function it({
11097
11097
  fallbackPath: i = "ws"
11098
11098
  }) {
11099
11099
  const s = String(e || "").trim();
11100
- return s ? Ue(s, tt(t, i)) : pi(a) ? Ue(a, tt(t, i)) : String(t || "").trim() ? String(t).trim() : Ue(a, i);
11100
+ return s ? Ue(s, tt(t, i)) : fi(a) ? Ue(a, tt(t, i)) : String(t || "").trim() ? String(t).trim() : Ue(a, i);
11101
11101
  }
11102
- const mi = `
11102
+ const pi = `
11103
11103
  :host { all: initial; }
11104
11104
  .widget { font-family: "Noto Sans SC", "PingFang SC", sans-serif; color: #16302b; }
11105
11105
  .panel { width: min(360px, 92vw); border-radius: 24px; overflow: hidden; background: linear-gradient(180deg, #fffdf6, #f4efe4); box-shadow: 0 22px 54px rgba(17, 30, 28, 0.22); border: 1px solid rgba(28, 78, 67, 0.12); }
@@ -11147,27 +11147,27 @@ const mi = `
11147
11147
  rejected: "本次来电已拒接,widget 仍保持待机。",
11148
11148
  missed: "本次来电未接听,widget 仍保持待机。",
11149
11149
  failed: "本次呼叫失败,请先看下方日志。"
11150
- }, wi = "手机网页首次接入时,请允许麦克风权限;若切到后台后再回来,先确认页面仍保持前台活跃。", bt = 15e3, yi = 15e3, st = 2, bi = 2, me = bt * bi, vi = 1200, Si = 3e4, Ti = 4e3, Te = {
11150
+ }, mi = "手机网页首次接入时,请允许麦克风权限;若切到后台后再回来,先确认页面仍保持前台活跃。", wi = 5e3, yi = 15e3, st = 2, me = 3e4, bi = 1200, vi = 3e4, Si = 4e3, Te = {
11151
11151
  ready: "线路可用",
11152
11152
  preparing: "正在准备",
11153
11153
  working: "正在呼叫",
11154
11154
  recovering: "正在恢复",
11155
11155
  offline: "当前离线"
11156
11156
  };
11157
- function Ci(a, e) {
11157
+ function Ti(a, e) {
11158
11158
  return e ? `${a}
11159
11159
  ${JSON.stringify(e, null, 2)}` : a;
11160
11160
  }
11161
- function Ei(a) {
11161
+ function Ci(a) {
11162
11162
  return a === "outbound" ? "outbound" : "terminal";
11163
11163
  }
11164
- function xi(a) {
11164
+ function Ei(a) {
11165
11165
  return typeof a == "function";
11166
11166
  }
11167
- function Ri() {
11167
+ function xi() {
11168
11168
  return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).get("embeddedCallWidgetE2E") === "1";
11169
11169
  }
11170
- function Ii() {
11170
+ function Ri() {
11171
11171
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `widget-${Date.now()}-${Math.random().toString(16).slice(2, 10)}`;
11172
11172
  }
11173
11173
  function Le(a) {
@@ -11181,20 +11181,20 @@ function te(a = {}, e = null) {
11181
11181
  const s = String(a?.businessKey ?? "").trim();
11182
11182
  return s || String(e?.default_business_key ?? "").trim();
11183
11183
  }
11184
- function _i(a) {
11184
+ function Ii(a) {
11185
11185
  const e = new Error(a);
11186
11186
  return e.name = "EmbeddedCallWidgetLifecycleCancelledError", e.code = "widget_runtime_run_stale", e;
11187
11187
  }
11188
11188
  function rt(a) {
11189
11189
  return a?.code === "sip_client_replaced" || a?.code === "widget_runtime_run_stale";
11190
11190
  }
11191
- class Ai {
11191
+ class _i {
11192
11192
  constructor({ mount: e, shadowRoot: t, options: i }) {
11193
- this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode = Ei(i.mode), this.legacyOutboundOnly = this.mode === "outbound", this.apiBaseUrl = De(i.apiBaseUrl || window.location.origin).href, this.client = null, this.issuedSession = null, this.bootstrap = null, this.turnIceServers = [], this.state = "idle", this.finalizing = !1, this.isMobileViewport = !1, this.pendingIncomingCall = null, this.visibilityHandler = null, this.sessionTouchTimer = null, this.sessionRecoveryInFlight = null, this.transportDisconnectTimer = null, this.transportDisconnectContext = null, this.e2eBridgeEnabled = Ri(), this.terminalFailureOverride = "", this.presenceId = Ii(), this.presenceTouchTimer = null, this.presenceFailureCount = 0, this.availabilityState = "preparing", this.availabilityDetail = "正在连接后台并准备网页电话待机。", this.connectivityRecoveryInFlight = null, this.lifecycleRunId = 0, this.pendingLifecycleMode = null, this.expectedClientTeardown = null, this.expectedTermination = null, this.autoStandbyRecoveryTimer = null, this.recentlyReleasedSessions = /* @__PURE__ */ new Map(), this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible", this.onlineHandler = null, this.offlineHandler = null, this.refs = {};
11193
+ this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode = Ci(i.mode), this.legacyOutboundOnly = this.mode === "outbound", this.apiBaseUrl = De(i.apiBaseUrl || window.location.origin).href, this.client = null, this.issuedSession = null, this.bootstrap = null, this.turnIceServers = [], this.state = "idle", this.finalizing = !1, this.isMobileViewport = !1, this.pendingIncomingCall = null, this.visibilityHandler = null, this.sessionTouchTimer = null, this.sessionRecoveryInFlight = null, this.transportDisconnectTimer = null, this.transportDisconnectContext = null, this.e2eBridgeEnabled = xi(), this.terminalFailureOverride = "", this.presenceId = Ri(), this.presenceTouchTimer = null, this.presenceFailureCount = 0, this.availabilityState = "preparing", this.availabilityDetail = "正在连接后台并准备网页电话待机。", this.connectivityRecoveryInFlight = null, this.lifecycleRunId = 0, this.pendingLifecycleMode = null, this.expectedClientTeardown = null, this.expectedTermination = null, this.autoStandbyRecoveryTimer = null, this.recentlyReleasedSessions = /* @__PURE__ */ new Map(), this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible", this.onlineHandler = null, this.offlineHandler = null, this.refs = {};
11194
11194
  }
11195
11195
  async mount() {
11196
11196
  this.isMobileViewport = typeof window < "u" && window.matchMedia("(max-width: 480px)").matches, this.shadowRoot.innerHTML = `
11197
- <style>${mi}</style>
11197
+ <style>${pi}</style>
11198
11198
  <section class="widget">
11199
11199
  <div class="panel">
11200
11200
  <div class="hero">
@@ -11255,11 +11255,11 @@ class Ai {
11255
11255
  }
11256
11256
  assertLifecycleRunCurrent(e) {
11257
11257
  if (e !== this.lifecycleRunId)
11258
- throw _i("网页电话已切换到新的连接流程,旧流程不再继续。");
11258
+ throw Ii("网页电话已切换到新的连接流程,旧流程不再继续。");
11259
11259
  }
11260
11260
  emitHostCallback(e, t) {
11261
11261
  const i = this.options?.[e];
11262
- if (xi(i))
11262
+ if (Ei(i))
11263
11263
  try {
11264
11264
  i(t);
11265
11265
  } catch (s) {
@@ -11422,7 +11422,7 @@ class Ai {
11422
11422
  webrtc_url: e.transport,
11423
11423
  ice_servers: this.turnIceServers
11424
11424
  };
11425
- this.client?.matchesAccount(t) || (this.client && await this.client.destroy(), this.client = new ui(t, {
11425
+ this.client?.matchesAccount(t) || (this.client && await this.client.destroy(), this.client = new hi(t, {
11426
11426
  remoteAudioElement: this.refs.audio,
11427
11427
  onStateChange: (i, s) => {
11428
11428
  this.handleClientState(i, s);
@@ -11761,7 +11761,7 @@ class Ai {
11761
11761
  setAvailabilityState(e, t = "") {
11762
11762
  this.availabilityState = e, this.availabilityDetail = t || this.availabilityDetail, this.refs.availability && (this.refs.availability.textContent = t ? `${Te[e] || Te.recovering} · ${t}` : Te[e] || Te.recovering, this.refs.availability.className = `availability availability--${e}`), this.render();
11763
11763
  }
11764
- suppressExpectedClientTeardown(e, t = Ti) {
11764
+ suppressExpectedClientTeardown(e, t = Si) {
11765
11765
  this.expectedClientTeardown = {
11766
11766
  reason: e,
11767
11767
  expiresAt: Date.now() + t
@@ -11787,7 +11787,7 @@ class Ai {
11787
11787
  clearAutoStandbyRecovery() {
11788
11788
  this.autoStandbyRecoveryTimer && (window.clearTimeout(this.autoStandbyRecoveryTimer), this.autoStandbyRecoveryTimer = null);
11789
11789
  }
11790
- scheduleAutoStandbyRecovery(e, t = vi) {
11790
+ scheduleAutoStandbyRecovery(e, t = bi) {
11791
11791
  this.legacyOutboundOnly || this.networkOnline === !1 || this.autoStandbyRecoveryTimer || this.client || this.issuedSession?.session_id || this.finalizing || this.pendingLifecycleMode === "outbound" || this.sessionRecoveryInFlight || this.connectivityRecoveryInFlight || ["requesting", "standbyRequesting", "registering", "calling", "incoming", "connected"].includes(this.state) || (this.autoStandbyRecoveryTimer = window.setTimeout(() => {
11792
11792
  this.autoStandbyRecoveryTimer = null, !(this.legacyOutboundOnly || this.networkOnline === !1) && (this.client || this.issuedSession?.session_id || this.finalizing || this.pendingLifecycleMode === "outbound" || (this.appendLog("检测到页面当前不在通话中,开始自动恢复待机。", { reason: e }), this.startStandby({ force: !0 })));
11793
11793
  }, t));
@@ -11800,7 +11800,7 @@ class Ai {
11800
11800
  markRecentlyReleasedSession(e, t) {
11801
11801
  e && (this.pruneRecentlyReleasedSessions(), this.recentlyReleasedSessions.set(e, {
11802
11802
  reason: t,
11803
- expiresAt: Date.now() + Si
11803
+ expiresAt: Date.now() + vi
11804
11804
  }));
11805
11805
  }
11806
11806
  wasSessionRecentlyReleased(e) {
@@ -12028,14 +12028,14 @@ class Ai {
12028
12028
  }
12029
12029
  this.touchIssuedSession(e), this.sessionTouchTimer || (this.sessionTouchTimer = window.setInterval(() => {
12030
12030
  this.touchIssuedSession(this.state);
12031
- }, bt));
12031
+ }, wi));
12032
12032
  }
12033
12033
  setState(e, t = "") {
12034
12034
  this.state = e, this.refs.status.textContent = t || Q[e] || Q.idle, this.syncAvailabilityState(), this.render(), this.emitHostCallback("onStateChange", this.getSnapshot());
12035
12035
  }
12036
12036
  appendLog(e, t) {
12037
12037
  const i = document.createElement("div");
12038
- for (i.className = "log", i.textContent = Ci(e, t), this.refs.logs.prepend(i); this.refs.logs.children.length > 8; )
12038
+ for (i.className = "log", i.textContent = Ti(e, t), this.refs.logs.prepend(i); this.refs.logs.children.length > 8; )
12039
12039
  this.refs.logs.lastElementChild?.remove();
12040
12040
  }
12041
12041
  render() {
@@ -12045,18 +12045,18 @@ class Ai {
12045
12045
  this.availabilityState === "offline" ? "status--offline" : this.availabilityState === "recovering" ? "status--recovering" : ""
12046
12046
  ].filter(Boolean).join(" ")), this.legacyOutboundOnly ? (this.refs.primary.disabled = e, this.refs.primary.textContent = t ? "通话进行中" : "连接并呼叫", this.refs.secondary.disabled = !t && !i, this.refs.secondary.textContent = t ? "挂断并清理" : "断开并清理") : (this.refs.primary.disabled = e || s || this.state === "connected", this.state === "incoming" ? this.refs.primary.textContent = "接听来电" : this.state === "connected" ? this.refs.primary.textContent = "通话进行中" : e || s ? this.availabilityState === "working" ? this.refs.primary.textContent = "正在建立呼叫" : this.availabilityState === "preparing" ? this.refs.primary.textContent = "正在准备网页电话" : this.refs.primary.textContent = this.state === "calling" ? "通话进行中" : "正在恢复网页电话" : this.availabilityState === "offline" ? this.refs.primary.textContent = "网络恢复后再试" : !i || ["idle", "failed", "ended"].includes(this.state) ? this.refs.primary.textContent = "恢复网页电话待机" : this.refs.primary.textContent = "呼叫管理员", this.refs.secondary.disabled = !i, this.refs.secondary.textContent = this.state === "incoming" ? "拒接来电" : this.state === "connected" ? "挂断并恢复待机" : "断开电话");
12047
12047
  const r = this.options.siteKey || this.bootstrap?.default_site_key || "等待服务端返回", n = this.issuedSession?.resolved_business_key || te(this.options, this.bootstrap) || "等待服务端返回";
12048
- this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${n};站点键:${r}` : this.refs.meta.textContent = `站点键:${r};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${n}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.refs.hint.textContent = this.isMobileViewport ? wi : "桌面网页可直接使用;若宿主站点启用了来源白名单或接入令牌,请按站点配置提供对应参数。";
12048
+ this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${n};站点键:${r}` : this.refs.meta.textContent = `站点键:${r};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${n}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.refs.hint.textContent = this.isMobileViewport ? mi : "桌面网页可直接使用;若宿主站点启用了来源白名单或接入令牌,请按站点配置提供对应参数。";
12049
12049
  }
12050
12050
  async destroy() {
12051
12051
  await this.disconnectAndCleanup("destroy-widget"), typeof document < "u" && this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), this.pendingIncomingCall = null, typeof window < "u" && (this.onlineHandler && (window.removeEventListener("online", this.onlineHandler), this.onlineHandler = null), this.offlineHandler && (window.removeEventListener("offline", this.offlineHandler), this.offlineHandler = null)), this.e2eBridgeEnabled && typeof window < "u" && window.__embeddedCallWidgetE2E__ && delete window.__embeddedCallWidgetE2E__, this.shadowRoot.innerHTML = "";
12052
12052
  }
12053
12053
  }
12054
- function $i(a) {
12055
- return new Ai(a);
12054
+ function Ai(a) {
12055
+ return new _i(a);
12056
12056
  }
12057
12057
  typeof window < "u" && (window.__EmbeddedCallWidgetRuntime__ = {
12058
- createEmbeddedCallWidgetRuntime: $i
12058
+ createEmbeddedCallWidgetRuntime: Ai
12059
12059
  });
12060
12060
  export {
12061
- $i as createEmbeddedCallWidgetRuntime
12061
+ Ai as createEmbeddedCallWidgetRuntime
12062
12062
  };