liveroom-client-element 0.4.0 → 0.4.1

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
- import { c as e, l as t, u as n } from "./constants-BTUkeFrO.js";
1
+ import { c as e, l as t, u as n } from "./constants-BHu66KgI.js";
2
2
  // ../packages/core/src/protocol.ts
3
3
  var r = {
4
4
  mouseDown: 1,
@@ -28,7 +28,7 @@ var r = {
28
28
  }, _ = {
29
29
  longpoll: "longpoll",
30
30
  websocket: "websocket"
31
- }, v = { complete: 4 }, y = "base64url.bearer.phx.", b = class {
31
+ }, ee = { complete: 4 }, v = "base64url.bearer.phx.", y = class {
32
32
  constructor(e, t, n, r) {
33
33
  this.channel = e, this.event = t, this.payload = n || function() {
34
34
  return {};
@@ -80,7 +80,7 @@ var r = {
80
80
  response: t
81
81
  });
82
82
  }
83
- }, x = class {
83
+ }, b = class {
84
84
  constructor(e, t) {
85
85
  this.callback = e, this.timerCalc = t, this.timer = null, this.tries = 0;
86
86
  }
@@ -92,9 +92,9 @@ var r = {
92
92
  this.tries += 1, this.callback();
93
93
  }, this.timerCalc(this.tries + 1));
94
94
  }
95
- }, ee = class {
95
+ }, x = class {
96
96
  constructor(e, t, n) {
97
- this.state = h.closed, this.topic = e, this.params = o(t || {}), this.socket = n, this.bindings = [], this.bindingRef = 0, this.timeout = this.socket.timeout, this.joinedOnce = !1, this.joinPush = new b(this, g.join, this.params, this.timeout), this.pushBuffer = [], this.stateChangeRefs = [], this.rejoinTimer = new x(() => {
97
+ this.state = h.closed, this.topic = e, this.params = o(t || {}), this.socket = n, this.bindings = [], this.bindingRef = 0, this.timeout = this.socket.timeout, this.joinedOnce = !1, this.joinPush = new y(this, g.join, this.params, this.timeout), this.pushBuffer = [], this.stateChangeRefs = [], this.rejoinTimer = new b(() => {
98
98
  this.socket.isConnected() && this.rejoin();
99
99
  }, this.socket.rejoinAfterMs), this.stateChangeRefs.push(this.socket.onError(() => this.rejoinTimer.reset())), this.stateChangeRefs.push(this.socket.onOpen(() => {
100
100
  this.rejoinTimer.reset(), this.isErrored() && this.rejoin();
@@ -107,7 +107,7 @@ var r = {
107
107
  }), this.onError((e) => {
108
108
  this.socket.hasLogger() && this.socket.log("channel", `error ${this.topic}`, e), this.isJoining() && this.joinPush.reset(), this.state = h.errored, this.socket.isConnected() && this.rejoinTimer.scheduleTimeout();
109
109
  }), this.joinPush.receive("timeout", () => {
110
- this.socket.hasLogger() && this.socket.log("channel", `timeout ${this.topic} (${this.joinRef()})`, this.joinPush.timeout), new b(this, g.leave, o({}), this.timeout).send(), this.state = h.errored, this.joinPush.reset(), this.socket.isConnected() && this.rejoinTimer.scheduleTimeout();
110
+ this.socket.hasLogger() && this.socket.log("channel", `timeout ${this.topic} (${this.joinRef()})`, this.joinPush.timeout), new y(this, g.leave, o({}), this.timeout).send(), this.state = h.errored, this.joinPush.reset(), this.socket.isConnected() && this.rejoinTimer.scheduleTimeout();
111
111
  }), this.on(g.reply, (e, t) => {
112
112
  this.trigger(this.replyEventName(t), e);
113
113
  });
@@ -138,7 +138,7 @@ var r = {
138
138
  }
139
139
  push(e, t, n = this.timeout) {
140
140
  if (t ||= {}, !this.joinedOnce) throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);
141
- let r = new b(this, e, function() {
141
+ let r = new y(this, e, function() {
142
142
  return t;
143
143
  }, n);
144
144
  return this.canPush() ? r.send() : (r.startTimeout(), this.pushBuffer.push(r)), r;
@@ -147,7 +147,7 @@ var r = {
147
147
  this.rejoinTimer.reset(), this.joinPush.cancelTimeout(), this.state = h.leaving;
148
148
  let t = () => {
149
149
  this.socket.hasLogger() && this.socket.log("channel", `leave ${this.topic}`), this.trigger(g.close, "leave");
150
- }, n = new b(this, g.leave, o({}), e);
150
+ }, n = new y(this, g.leave, o({}), e);
151
151
  return n.receive("ok", () => t()).receive("timeout", () => t()), n.send(), this.canPush() || n.trigger("ok", {}), n;
152
152
  }
153
153
  onMessage(e, t, n) {
@@ -226,7 +226,7 @@ var r = {
226
226
  e.open(t, n, !0), e.timeout = a;
227
227
  for (let [t, n] of Object.entries(r)) e.setRequestHeader(t, n);
228
228
  return e.onerror = () => s && s(null), e.onreadystatechange = () => {
229
- e.readyState === v.complete && s && s(this.parseJSON(e.responseText));
229
+ e.readyState === ee.complete && s && s(this.parseJSON(e.responseText));
230
230
  }, o && (e.ontimeout = o), e.send(i), e;
231
231
  }
232
232
  static parseJSON(e) {
@@ -253,9 +253,13 @@ var r = {
253
253
  let t = "", n = new Uint8Array(e), r = n.byteLength;
254
254
  for (let e = 0; e < r; e++) t += String.fromCharCode(n[e]);
255
255
  return btoa(t);
256
- }, C = class {
256
+ }, ne = (e) => {
257
+ let t = atob(e), n = new Uint8Array(t.length);
258
+ for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
259
+ return n.buffer;
260
+ }, C = (e) => typeof e == "string" ? e : ne(e.binary), w = class {
257
261
  constructor(e, t) {
258
- t && t.length === 2 && t[1].startsWith(y) && (this.authToken = atob(t[1].slice(y.length))), this.endPoint = null, this.token = null, this.skipHeartbeat = !0, this.reqs = /* @__PURE__ */ new Set(), this.messageTimers = /* @__PURE__ */ new Set(), this.awaitingBatchAck = !1, this.currentBatch = null, this.currentBatchTimer = null, this.batchBuffer = [], this.onopen = function() {}, this.onerror = function() {}, this.onmessage = function() {}, this.onclose = function() {}, this.pollEndpoint = this.normalizeEndpoint(e), this.readyState = d.connecting, setTimeout(() => this.poll(), 0);
262
+ t && t.length === 2 && t[1].startsWith(v) && (this.authToken = atob(t[1].slice(v.length))), this.endPoint = null, this.token = null, this.skipHeartbeat = !0, this.reqs = /* @__PURE__ */ new Set(), this.messageTimers = /* @__PURE__ */ new Set(), this.awaitingBatchAck = !1, this.currentBatch = null, this.currentBatchTimer = null, this.batchBuffer = [], this.onopen = function() {}, this.onerror = function() {}, this.onmessage = function() {}, this.onclose = function() {}, this.pollEndpoint = this.normalizeEndpoint(e), this.readyState = d.connecting, setTimeout(() => this.poll(), 0);
259
263
  }
260
264
  normalizeEndpoint(e) {
261
265
  return e.replace("ws://", "http://").replace("wss://", "https://").replace(RegExp("(.*)/" + _.websocket), "$1/" + _.longpoll);
@@ -288,7 +292,7 @@ var r = {
288
292
  case 200:
289
293
  r.forEach((e) => {
290
294
  let t = setTimeout(() => {
291
- this.messageTimers.delete(t), this.onmessage({ data: e });
295
+ this.messageTimers.delete(t), this.onmessage({ data: C(e) });
292
296
  }, 0);
293
297
  this.messageTimers.add(t);
294
298
  }), this.poll();
@@ -349,7 +353,7 @@ var r = {
349
353
  this.reqs.delete(a) && i(e);
350
354
  });
351
355
  }
352
- }, w = {
356
+ }, T = {
353
357
  HEADER_LENGTH: 1,
354
358
  META_LENGTH: 4,
355
359
  KINDS: {
@@ -449,7 +453,7 @@ var r = {
449
453
  payload: e.slice(a, e.byteLength)
450
454
  };
451
455
  }
452
- }, T = class {
456
+ }, re = class {
453
457
  constructor(e, t) {
454
458
  this.socket = e, this.transport = t, this.joins = /* @__PURE__ */ new WeakMap(), this.pings = /* @__PURE__ */ new Map(), this.closing = !1, this.ended = !1, this.channelsErrored = !1, this.closeHandled = !1, t.onopen = () => {
455
459
  this.isCurrent() && e.onConnOpen();
@@ -476,14 +480,14 @@ var r = {
476
480
  close(e, t) {
477
481
  this.closing = !0, this.transport.onerror = function() {}, e ? this.transport.close(e, t || "") : this.transport.close();
478
482
  }
479
- }, E = class {
483
+ }, ie = class {
480
484
  constructor(e, t = {}) {
481
485
  this.stateChangeCallbacks = {
482
486
  open: [],
483
487
  close: [],
484
488
  error: [],
485
489
  message: []
486
- }, this.channels = [], this.sendBuffer = [], this.ref = 0, this.fallbackRef = null, this.fallbackErrorRef = null, this.timeout = t.timeout || p, this.transport = t.transport || l.WebSocket || C, this.primaryPassedHealthCheck = !1, this.longPollFallbackMs = t.longPollFallbackMs, this.fallbackTimer = null, this.sessionStore = t.sessionStorage || l && l.sessionStorage, this.establishedConnections = 0, this.defaultEncoder = w.encode.bind(w), this.defaultDecoder = w.decode.bind(w), this.closeWasClean = !0, this.binaryType = t.binaryType || "arraybuffer", this.connection = null, this.connectClock = 1, this.visibilityConnection = null, this.transport === C ? (this.encode = this.defaultEncoder, this.decode = this.defaultDecoder) : (this.encode = t.encode || this.defaultEncoder, this.decode = t.decode || this.defaultDecoder);
490
+ }, this.channels = [], this.sendBuffer = [], this.ref = 0, this.fallbackRef = null, this.fallbackErrorRef = null, this.fallbackHealthCheck = null, this.timeout = t.timeout || p, this.transport = t.transport || l.WebSocket || w, this.primaryPassedHealthCheck = !1, this.longPollFallbackMs = t.longPollFallbackMs, this.fallbackTimer = null, this.sessionStore = t.sessionStorage || l && l.sessionStorage, this.establishedConnections = 0, this.defaultEncoder = T.encode.bind(T), this.defaultDecoder = T.decode.bind(T), this.closeWasClean = !0, this.binaryType = t.binaryType || "arraybuffer", this.connection = null, this.connectClock = 1, this.visibilityConnection = null, this.transport === w ? (this.encode = this.defaultEncoder, this.decode = this.defaultDecoder) : (this.encode = t.encode || this.defaultEncoder, this.decode = t.decode || this.defaultDecoder);
487
491
  let n = null;
488
492
  c && c.addEventListener && (c.addEventListener("pagehide", (e) => {
489
493
  this.connection && !this.connection.ended && (this.disconnect(), n = this.connectClock);
@@ -507,10 +511,10 @@ var r = {
507
511
  500,
508
512
  1e3,
509
513
  2e3
510
- ][e - 1] || 5e3, this.logger = t.logger || null, !this.logger && t.debug && (this.logger = (e, t, n) => {
514
+ ][e - 1] || 5e3, this.reconnectWhenHidden = t.reconnectWhenHidden || !1, this.logger = t.logger || null, !this.logger && t.debug && (this.logger = (e, t, n) => {
511
515
  console.log(`${e}: ${t}`, n);
512
- }), this.longpollerTimeout = t.longpollerTimeout || 2e4, this.params = o(t.params || {}), this.endPoint = `${e}/${_.websocket}`, this.vsn = t.vsn || u, this.heartbeatTimeoutTimer = null, this.heartbeatTimer = null, this.pendingHeartbeatRef = null, this.reconnectTimer = new x(() => {
513
- this.pageHidden ? (this.log("Not reconnecting as page is hidden!"), this.teardown()) : this.teardownAndReconnect(() => this.connect());
516
+ }), this.longpollerTimeout = t.longpollerTimeout || 2e4, this.params = o(t.params || {}), this.endPoint = `${e}/${_.websocket}`, this.vsn = t.vsn || u, this.heartbeatTimeoutTimer = null, this.heartbeatTimer = null, this.pendingHeartbeatRef = null, this.reconnectTimer = new b(() => {
517
+ this.pageHidden && !this.reconnectWhenHidden ? (this.log("Not reconnecting as page is hidden!"), this.teardown()) : this.teardownAndReconnect(() => this.connect());
514
518
  }, this.reconnectAfterMs), this.authToken = t.authToken && o(t.authToken);
515
519
  }
516
520
  get conn() {
@@ -530,7 +534,7 @@ var r = {
530
534
  }));
531
535
  }
532
536
  getLongPollTransport() {
533
- return C;
537
+ return w;
534
538
  }
535
539
  replaceTransport(e) {
536
540
  let t = ++this.connectClock;
@@ -553,7 +557,7 @@ var r = {
553
557
  this.connectClock++, this.closeWasClean = !0, clearTimeout(this.fallbackTimer), this.reconnectTimer.reset(), this.connection && (this.connection.ended = !0), this.teardown(e, t, n);
554
558
  }
555
559
  connect(e) {
556
- e && (console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"), this.params = o(e)), (!this.connection || this.connection.ended) && (this.longPollFallbackMs && this.transport !== C ? this.connectWithFallback(C, this.longPollFallbackMs) : this.transportConnect());
560
+ e && (console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"), this.params = o(e)), (!this.connection || this.connection.ended) && (this.longPollFallbackMs && this.transport !== w ? this.connectWithFallback(w, this.longPollFallbackMs) : this.transportConnect());
557
561
  }
558
562
  log(e, t, n) {
559
563
  this.logger && this.logger(e, t, n);
@@ -589,7 +593,7 @@ var r = {
589
593
  }
590
594
  transportName(e) {
591
595
  switch (e) {
592
- case C: return "LongPoll";
596
+ case w: return "LongPoll";
593
597
  default: return e.name;
594
598
  }
595
599
  }
@@ -597,9 +601,9 @@ var r = {
597
601
  let e = this.connection;
598
602
  this.connectClock++, this.closeWasClean = !1, clearTimeout(this.reconnectTimer.timer);
599
603
  let t;
600
- this.authToken && (t = ["phoenix", `${y}${btoa(this.authToken()).replace(/=/g, "")}`]);
604
+ this.authToken && (t = ["phoenix", `${v}${btoa(this.authToken()).replace(/=/g, "")}`]);
601
605
  let n = new this.transport(this.endPointURL(), t);
602
- n.binaryType = this.binaryType, n.timeout = this.longpollerTimeout, this.connection = new T(this, n), e && e.isOpen() && this.triggerChanError("connection_closed", e);
606
+ n.binaryType = this.binaryType, n.timeout = this.longpollerTimeout, this.connection = new re(this, n), e && e.isOpen() && this.triggerChanError("connection_closed", e);
603
607
  }
604
608
  getSession(e) {
605
609
  return this.sessionStore && this.sessionStore.getItem(e);
@@ -621,19 +625,21 @@ var r = {
621
625
  let t = this.transportName(e);
622
626
  return this.primaryPassedHealthCheck || this.storeSession(`phx:fallback:${t}`, "true"), this.log("transport", `established ${t} fallback`);
623
627
  }
624
- o() && (n = !0, clearTimeout(this.fallbackTimer), this.fallbackTimer = setTimeout(c, t), this.ping((e) => {
628
+ o() && (n = !0, clearTimeout(this.fallbackTimer), this.fallbackTimer = setTimeout(c, t));
629
+ }), this.fallbackHealthCheck = () => {
630
+ o() && this.ping((e) => {
625
631
  this.log("transport", "connected to primary after", e), this.primaryPassedHealthCheck = !0, clearTimeout(this.fallbackTimer);
626
- }));
627
- }), this.transportConnect(), a = this.connectClock;
632
+ });
633
+ }, this.transportConnect(), a = this.connectClock;
628
634
  }
629
635
  cancelFallback() {
630
- clearTimeout(this.fallbackTimer), this.off([this.fallbackRef, this.fallbackErrorRef]);
636
+ clearTimeout(this.fallbackTimer), this.off([this.fallbackRef, this.fallbackErrorRef]), this.fallbackHealthCheck = null;
631
637
  }
632
638
  clearHeartbeats() {
633
639
  clearTimeout(this.heartbeatTimer), clearTimeout(this.heartbeatTimeoutTimer), this.pendingHeartbeatRef = null;
634
640
  }
635
641
  onConnOpen() {
636
- this.hasLogger() && this.log("transport", `${this.transportName(this.transport)} connected to ${this.endPointURL()}`), this.closeWasClean = !1, this.establishedConnections++, this.flushSendBuffer(), this.reconnectTimer.reset(), this.resetHeartbeat(), this.stateChangeCallbacks.open.forEach(([, e]) => e());
642
+ this.hasLogger() && this.log("transport", `${this.transportName(this.transport)} connected to ${this.endPointURL()}`), this.closeWasClean = !1, this.establishedConnections++, this.fallbackHealthCheck && this.fallbackHealthCheck(), this.flushSendBuffer(), this.reconnectTimer.reset(), this.resetHeartbeat(), this.stateChangeCallbacks.open.forEach(([, e]) => e());
637
643
  }
638
644
  heartbeatTimeout() {
639
645
  if (this.pendingHeartbeatRef) {
@@ -718,7 +724,7 @@ var r = {
718
724
  for (let t in this.stateChangeCallbacks) this.stateChangeCallbacks[t] = this.stateChangeCallbacks[t].filter(([t]) => e.indexOf(t) === -1);
719
725
  }
720
726
  channel(e, t = {}) {
721
- let n = new ee(e, t, this);
727
+ let n = new x(e, t, this);
722
728
  return this.channels.push(n), n;
723
729
  }
724
730
  push(e, t) {
@@ -778,7 +784,7 @@ var r = {
778
784
  let t = this.channels.find((t) => t.topic === e && (t.isJoined() || t.isJoining()));
779
785
  t && (this.hasLogger() && this.log("transport", `leaving duplicate topic "${e}"`), t.leave());
780
786
  }
781
- }, ne = 1e3, re = 1e3, D = 150, ie = 2, ae = 3e4, oe = 1e4, se = 60, ce = class {
787
+ }, ae = 1e3, oe = 1e3, E = 150, se = 2, ce = 3e4, le = 1e4, ue = 60, de = class {
782
788
  probe;
783
789
  onChange;
784
790
  now;
@@ -814,8 +820,8 @@ var r = {
814
820
  let e = this.now(), t = e - this.lastTick;
815
821
  this.lastTick = e, this.quality === "unstable" && (this.unstableMs += t), this.quality === "offline" && (this.offlineMs += t);
816
822
  let n = this.probe.online();
817
- n && !this.wasOnline && (this.everOnline && this.reconnects++, this.everOnline = !0), !n && this.wasOnline && this.endStall(e), this.wasOnline = n, n ? (this.pingSentAt !== null && this.stallSince === null && e - this.pingSentAt >= re && (this.stallSince = this.pingSentAt), this.pingSentAt === null && e - this.lastPingAt >= ne && this.sendPing(e)) : this.pingSentAt = null;
818
- let r = n ? this.stallSince !== null || e - this.lastIssueAt < oe || this.recentSlow(e) >= ie ? "unstable" : "good" : this.everOnline ? "offline" : "good";
823
+ n && !this.wasOnline && (this.everOnline && this.reconnects++, this.everOnline = !0), !n && this.wasOnline && this.endStall(e), this.wasOnline = n, n ? (this.pingSentAt !== null && this.stallSince === null && e - this.pingSentAt >= oe && (this.stallSince = this.pingSentAt), this.pingSentAt === null && e - this.lastPingAt >= ae && this.sendPing(e)) : this.pingSentAt = null;
824
+ let r = n ? this.stallSince !== null || e - this.lastIssueAt < le || this.recentSlow(e) >= se ? "unstable" : "good" : this.everOnline ? "offline" : "good";
819
825
  r !== this.quality && (this.quality = r, this.onChange(r));
820
826
  }
821
827
  report() {
@@ -840,13 +846,13 @@ var r = {
840
846
  this.lastPingAt = e, this.probe.ping((t) => {
841
847
  if (this.pingSentAt !== e) return;
842
848
  let n = this.now();
843
- this.pingSentAt = null, this.pings++, this.rtt = t, this.rtts.push(t), this.rtts.length > se && this.rtts.shift();
849
+ this.pingSentAt = null, this.pings++, this.rtt = t, this.rtts.push(t), this.rtts.length > ue && this.rtts.shift();
844
850
  let [r, i, a] = this.rtts.slice(-3);
845
- a !== void 0 && i >= r + D && i >= a + D && this.slowAt.push(n), this.endStall(n), this.tick();
851
+ a !== void 0 && i >= r + E && i >= a + E && this.slowAt.push(n), this.endStall(n), this.tick();
846
852
  }) && (this.pingSentAt = e);
847
853
  }
848
854
  recentSlow(e) {
849
- for (; this.slowAt.length && e - this.slowAt[0] >= ae;) this.slowAt.shift();
855
+ for (; this.slowAt.length && e - this.slowAt[0] >= ce;) this.slowAt.shift();
850
856
  return this.slowAt.length;
851
857
  }
852
858
  endStall(e) {
@@ -854,19 +860,19 @@ var r = {
854
860
  let t = e - this.stallSince;
855
861
  this.stalls++, this.stallMs += t, this.maxStallMs = Math.max(this.maxStallMs, t), this.stallSince = null, this.lastIssueAt = e;
856
862
  }
857
- }, O = [
863
+ }, D = [
858
864
  80,
859
865
  160,
860
866
  320,
861
867
  640,
862
868
  1e3
863
869
  ];
864
- function le(e, t = Math.random) {
865
- let n = O[Math.min(Math.max(e, 1), O.length) - 1], r = Math.round(n * .2), i = Math.min(Math.max(t(), 0), .999999);
870
+ function O(e, t = Math.random) {
871
+ let n = D[Math.min(Math.max(e, 1), D.length) - 1], r = Math.round(n * .2), i = Math.min(Math.max(t(), 0), .999999);
866
872
  return n - r + Math.floor(i * (r * 2 + 1));
867
873
  }
868
874
  // ../packages/core/src/room-client.ts
869
- var ue = class {
875
+ var k = class {
870
876
  options;
871
877
  participants = /* @__PURE__ */ new Map();
872
878
  status = "connecting";
@@ -909,10 +915,11 @@ var ue = class {
909
915
  }
910
916
  connect() {
911
917
  let e = this.options, t = () => this.reportNet();
912
- window.addEventListener("pagehide", t), this.offPageHide = () => window.removeEventListener("pagehide", t), this.socket = new E(e.url, {
918
+ window.addEventListener("pagehide", t), this.offPageHide = () => window.removeEventListener("pagehide", t), this.socket = new ie(e.url, {
913
919
  params: e.apiToken ? { api_token: e.apiToken } : {},
914
920
  heartbeatIntervalMs: e.heartbeatMs ?? 5e3,
915
- reconnectAfterMs: (e) => le(e),
921
+ reconnectAfterMs: (e) => O(e),
922
+ reconnectWhenHidden: !0,
916
923
  rejoinAfterMs: (e) => [
917
924
  100,
918
925
  500,
@@ -922,7 +929,7 @@ var ue = class {
922
929
  logger: e.logger
923
930
  }), this.socket.onClose(() => this.setStatus("disconnected")), this.socket.connect();
924
931
  let n = this.socket;
925
- this.monitor = new ce({
932
+ this.monitor = new de({
926
933
  ping: (e) => n.ping(e),
927
934
  online: () => n.isConnected() && this.status === "joined"
928
935
  }, (e) => {
@@ -987,7 +994,7 @@ var ue = class {
987
994
  }
988
995
  joinParams() {
989
996
  let e = this.options;
990
- return j({
997
+ return M({
991
998
  v: 2,
992
999
  room_token: e.roomToken,
993
1000
  type: e.type,
@@ -1079,7 +1086,7 @@ var ue = class {
1079
1086
  setState(e) {
1080
1087
  e.url && (e = {
1081
1088
  ...e,
1082
- url: A(e.url)
1089
+ url: j(e.url)
1083
1090
  }), Object.assign(this.localState, e), this.push("s", e);
1084
1091
  }
1085
1092
  stop() {
@@ -1136,19 +1143,19 @@ var ue = class {
1136
1143
  setFollow(e) {
1137
1144
  e === this.follow || Array.isArray(e) && Array.isArray(this.follow) && e.length === this.follow.length && e.every((e, t) => e === this.follow[t]) || (this.follow = e, this.push("follow", e));
1138
1145
  }
1139
- }, k = 2048;
1140
- function A(e) {
1141
- return e.length > 2048 ? e.slice(0, k) : e;
1142
- }
1146
+ }, A = 2048;
1143
1147
  function j(e) {
1144
- return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? A(t) : t]));
1148
+ return e.length > 2048 ? e.slice(0, A) : e;
1149
+ }
1150
+ function M(e) {
1151
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? j(t) : t]));
1145
1152
  }
1146
1153
  // ../packages/core/src/cursor-layer.ts
1147
- var M = "\n.lr-cursors { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2147483646; }\n.lr-user { position: absolute; top: 0; left: 0; user-select: none; will-change: transform; transform-origin: 0 0; }\n.lr-user[data-hidden=\"true\"] { display: none; }\n.lr-cursor { position: absolute; top: 0; left: 0; color: var(--color); transform-origin: top left; rotate: 6deg;\n transition: rotate 200ms cubic-bezier(0.22, 1, 0.36, 1);\n filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.2)); overflow: visible; }\n.lr-user[data-flip=\"true\"]:not([data-live=\"true\"]):not([data-focus=\"true\"]):not([data-focus-motion=\"true\"]) .lr-cursor { rotate: 88deg; }\n/* Guests are light pastels: the dark contour keeps the arrow visible on white pages.\n Hosts are deep fills: a white ring keeps the arrow visible on dark pages and Meet.\n Role is the participant type already on the wire. The path touches the viewBox's\n top edge, hence the svg's visible overflow. */\n.lr-cursor path { stroke: rgb(0 0 0 / 0.6); stroke-width: 3; stroke-linejoin: round; paint-order: stroke fill; }\n.lr-user[data-type=\"admin\"] .lr-cursor path { stroke: rgb(255 255 255/.92); }\n.lr-label { position: absolute; top: 18px; left: 0; translate: 14px 0;\n transition: translate 200ms cubic-bezier(0.22, 1, 0.36, 1);\n font: 600 12px/1.6 \"Geist\", system-ui, sans-serif; color: black;\n background: var(--color); border-radius: 9999px; padding: 0 8px; white-space: nowrap;\n box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12), 0 1px 2px rgb(0 0 0 / 0.08);\n display: flex; flex-direction: column; align-items: center; overflow: hidden; max-width: 200px; text-overflow: ellipsis; }\n.lr-user[data-flip=\"true\"]:not([data-live=\"true\"]):not([data-focus=\"true\"]):not([data-focus-motion=\"true\"]) .lr-label {\n translate: calc(-100% - 14px) 0; }\n.lr-user[data-type=\"admin\"] .lr-label { color: white; }\n.lr-user[data-type=\"admin\"]:not([data-live=\"true\"]):not([data-focus-motion=\"true\"]) .lr-label {\n box-shadow: 0 0 0 1.5px rgb(255 255 255/.92), 0 1px 3px rgb(0 0 0/.2); }\n.lr-user[data-type=\"admin\"][data-live=\"true\"] .lr-label > span,\n.lr-user[data-type=\"admin\"][data-focus-motion=\"true\"] .lr-label > span {\n box-shadow: 0 0 0 1.5px rgb(255 255 255/.92), 0 1px 3px rgb(0 0 0/.2); }\n.lr-label video { display: none; width: 170.6667px; height: 96px; object-fit: cover; margin: 0; }\n/* Keep the same 16:9 video surface. The small bubble is a circular crop. */\n.lr-user[data-live=\"true\"] .lr-label, .lr-user[data-focus-motion=\"true\"] .lr-label {\n padding: 0; border-radius: 0; top: 10px; left: -31.3333px; translate: none; transition: none; width: 170.6667px; height: 96px;\n background: transparent; box-shadow: none; overflow: visible;\n}\n.lr-user[data-live=\"true\"] .lr-label video, .lr-user[data-focus-motion=\"true\"] .lr-label video {\n display: block; clip-path: inset(0 37.3333px round 48px);\n transition: clip-path 250ms cubic-bezier(0.77, 0, 0.175, 1);\n}\n.lr-user[data-live=\"true\"] .lr-label > span, .lr-user[data-focus-motion=\"true\"] .lr-label > span {\n position: absolute; top: calc(100% + 2px); left: 50%; padding: 2px 8px; border-radius: 9999px;\n background: var(--color); opacity: 0; visibility: hidden;\n transform: translateX(-50%) scale(calc(1 / var(--focus-scale, 1))); transform-origin: top center;\n transition: opacity 200ms ease, visibility 200ms ease;\n}\n.lr-ripple { position: absolute; top: -12px; left: -12px; width: 24px; height: 24px; border-radius: 9999px;\n background: var(--color); opacity: 0; z-index: -1; pointer-events: none; }\n/* Two identical keyframes let us restart the animation by alternating data-anim\n between \"a\" and \"b\" without forcing a synchronous reflow. */\n.lr-ripple[data-anim=\"a\"] { animation: lr-click-a 450ms ease-out; }\n.lr-ripple[data-anim=\"b\"] { animation: lr-click-b 450ms ease-out; }\n@keyframes lr-click-a { 0% { opacity: 0.55; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.65); } }\n@keyframes lr-click-b { 0% { opacity: 0.55; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.65); } }\n.lr-halo { position: absolute; top: -60px; left: -60px; width: 120px; height: 120px; border-radius: 9999px; z-index: -1;\n border: 1px solid color-mix(in srgb, var(--color) 75%, transparent); background: color-mix(in srgb, var(--color) 25%, transparent);\n transform: scale(0); transition: transform 200ms ease-in-out; }\n.lr-user[data-halo=\"true\"] .lr-halo { transform: scale(1); }\n.lr-user[data-self=\"true\"] .lr-cursor, .lr-user[data-self=\"true\"] .lr-label, .lr-user[data-self=\"true\"] .lr-ripple { display: none; }\n.lr-cursors::before { content: \"\"; position: absolute; inset: 0; background: rgb(39 39 42 / 25%); backdrop-filter: blur(6px); opacity: 0; transition: opacity 200ms ease; }\n.lr-cursors[data-focus=\"true\"]::before { opacity: 1; }\n.lr-user[data-focus-motion=\"true\"] { transition: transform 250ms cubic-bezier(0.77, 0, 0.175, 1); }\n.lr-user[data-focus=\"true\"] { transform: translate3d(calc(50vw - 54px * var(--focus-scale)), calc(50vh - 58px * var(--focus-scale)), 0) scale(var(--focus-scale)) !important; z-index: 1; }\n.lr-user[data-focus=\"true\"] .lr-label video { clip-path: inset(0 round 4px); }\n.lr-user[data-focus=\"true\"] .lr-label > span { opacity: 1; visibility: visible; }\n.lr-user[data-focus=\"true\"]:not([data-live=\"true\"]) .lr-label { background: #18181b; border-radius: 4px; }\n.lr-user[data-focus=\"true\"] .lr-cursor, .lr-user[data-focus=\"true\"] .lr-halo, .lr-user[data-focus=\"true\"] .lr-ripple { opacity: 0; }\n@media (prefers-reduced-motion: reduce) {\n .lr-user[data-focus-motion=\"true\"], .lr-label video { transition: none !important; }\n .lr-cursor, .lr-label { transition: none !important; }\n .lr-ripple { animation: none !important; }\n .lr-cursors::before, .lr-label > span { transition-duration: 100ms; }\n .lr-user[data-net] .lr-label span::before { animation: none; }\n .lr-halo { transition: none !important; }\n}\n.lr-user[data-blocked=\"true\"] { opacity: 0.4; }\n/* On a bad network: a pulsing dot before the name (its cursor may freeze). */\n.lr-user[data-net=\"unstable\"] .lr-label span::before { content: \"\"; display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0;\n border-radius: 50%; background: #d97706; box-shadow: 0 0 0 1px rgb(255 255 255 / 70%); animation: lr-pulse 1.2s ease-in-out infinite; }\n@keyframes lr-pulse { 50% { opacity: 0.3; } }\n", N = "<svg width=\"23\" viewBox=\"0 0 27 24\" fill=\"currentColor\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.27 0.06L25.43 8.06C25.66 8.13 25.83 8.26 25.95 8.43C26.07 8.59 26.14 8.79 26.14 8.99C26.14 9.2 26.07 9.4 25.95 9.56C25.83 9.73 25.66 9.86 25.46 9.93L15.35 13.77L11.31 23.37C11.23 23.56 11.1 23.72 10.92 23.83C10.75 23.94 10.54 24 10.33 24C10.12 24 9.91 23.94 9.73 23.82C9.55 23.7 9.42 23.53 9.34 23.34L0.92 1.34C0.86 1.16 0.84 0.97 0.89 0.78C0.93 0.6 1.03 0.43 1.17 0.29C1.31 0.16 1.49 0.07 1.68 0.02C1.88 -0.02 2.08 -0.01 2.27 0.06Z\"/></svg>", P = 120, F = 600, I = 22, L = 24, R = 64, z = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i, B = (e) => z.test(e) ? e : "#a3a3a3";
1148
- function V(e, t, n) {
1154
+ var N = "\n.lr-cursors { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2147483646; }\n.lr-user { position: absolute; top: 0; left: 0; user-select: none; will-change: transform; transform-origin: 0 0; }\n.lr-user[data-hidden=\"true\"] { display: none; }\n.lr-cursor { position: absolute; top: 0; left: 0; color: var(--color); transform-origin: top left; rotate: 6deg;\n transition: rotate 200ms cubic-bezier(0.22, 1, 0.36, 1);\n filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.2)); overflow: visible; }\n.lr-user[data-flip=\"true\"]:not([data-live=\"true\"]):not([data-focus=\"true\"]):not([data-focus-motion=\"true\"]) .lr-cursor { rotate: 88deg; }\n/* Guests are light pastels: the dark contour keeps the arrow visible on white pages.\n Hosts are deep fills: a white ring keeps the arrow visible on dark pages and Meet.\n Role is the participant type already on the wire. The path touches the viewBox's\n top edge, hence the svg's visible overflow. */\n.lr-cursor path { stroke: rgb(0 0 0 / 0.6); stroke-width: 3; stroke-linejoin: round; paint-order: stroke fill; }\n.lr-user[data-type=\"admin\"] .lr-cursor path { stroke: rgb(255 255 255/.92); }\n.lr-label { position: absolute; top: 18px; left: 0; translate: 14px 0;\n transition: translate 200ms cubic-bezier(0.22, 1, 0.36, 1);\n font: 600 12px/1.6 \"Geist\", system-ui, sans-serif; color: black;\n background: var(--color); border-radius: 9999px; padding: 0 8px; white-space: nowrap;\n box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12), 0 1px 2px rgb(0 0 0 / 0.08);\n display: flex; flex-direction: column; align-items: center; overflow: hidden; max-width: 200px; text-overflow: ellipsis; }\n.lr-user[data-flip=\"true\"]:not([data-live=\"true\"]):not([data-focus=\"true\"]):not([data-focus-motion=\"true\"]) .lr-label {\n translate: calc(-100% - 14px) 0; }\n.lr-user[data-type=\"admin\"] .lr-label { color: white; }\n.lr-user[data-type=\"admin\"]:not([data-live=\"true\"]):not([data-focus-motion=\"true\"]) .lr-label {\n box-shadow: 0 0 0 1.5px rgb(255 255 255/.92), 0 1px 3px rgb(0 0 0/.2); }\n.lr-user[data-type=\"admin\"][data-live=\"true\"] .lr-label > span,\n.lr-user[data-type=\"admin\"][data-focus-motion=\"true\"] .lr-label > span {\n box-shadow: 0 0 0 1.5px rgb(255 255 255/.92), 0 1px 3px rgb(0 0 0/.2); }\n.lr-label video { display: none; width: 170.6667px; height: 96px; object-fit: cover; margin: 0; }\n/* Keep the same 16:9 video surface. The small bubble is a circular crop. */\n.lr-user[data-live=\"true\"] .lr-label, .lr-user[data-focus-motion=\"true\"] .lr-label {\n padding: 0; border-radius: 0; top: 10px; left: -31.3333px; translate: none; transition: none; width: 170.6667px; height: 96px;\n background: transparent; box-shadow: none; overflow: visible;\n}\n.lr-user[data-live=\"true\"] .lr-label video, .lr-user[data-focus-motion=\"true\"] .lr-label video {\n display: block; clip-path: inset(0 37.3333px round 48px);\n transition: clip-path 250ms cubic-bezier(0.77, 0, 0.175, 1);\n}\n.lr-user[data-live=\"true\"] .lr-label > span, .lr-user[data-focus-motion=\"true\"] .lr-label > span {\n position: absolute; top: calc(100% + 2px); left: 50%; padding: 2px 8px; border-radius: 9999px;\n background: var(--color); opacity: 0; visibility: hidden;\n transform: translateX(-50%) scale(calc(1 / var(--focus-scale, 1))); transform-origin: top center;\n transition: opacity 200ms ease, visibility 200ms ease;\n}\n.lr-ripple { position: absolute; top: -12px; left: -12px; width: 24px; height: 24px; border-radius: 9999px;\n background: var(--color); opacity: 0; z-index: -1; pointer-events: none; }\n/* Two identical keyframes let us restart the animation by alternating data-anim\n between \"a\" and \"b\" without forcing a synchronous reflow. */\n.lr-ripple[data-anim=\"a\"] { animation: lr-click-a 450ms ease-out; }\n.lr-ripple[data-anim=\"b\"] { animation: lr-click-b 450ms ease-out; }\n@keyframes lr-click-a { 0% { opacity: 0.55; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.65); } }\n@keyframes lr-click-b { 0% { opacity: 0.55; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.65); } }\n.lr-halo { position: absolute; top: -60px; left: -60px; width: 120px; height: 120px; border-radius: 9999px; z-index: -1;\n border: 1px solid color-mix(in srgb, var(--color) 75%, transparent); background: color-mix(in srgb, var(--color) 25%, transparent);\n transform: scale(0); transition: transform 200ms ease-in-out; }\n.lr-user[data-halo=\"true\"] .lr-halo { transform: scale(1); }\n.lr-user[data-self=\"true\"] .lr-cursor, .lr-user[data-self=\"true\"] .lr-label, .lr-user[data-self=\"true\"] .lr-ripple { display: none; }\n.lr-cursors::before { content: \"\"; position: absolute; inset: 0; background: rgb(39 39 42 / 25%); backdrop-filter: blur(6px); opacity: 0; transition: opacity 200ms ease; }\n.lr-cursors[data-focus=\"true\"]::before { opacity: 1; }\n.lr-user[data-focus-motion=\"true\"] { transition: transform 250ms cubic-bezier(0.77, 0, 0.175, 1); }\n.lr-user[data-focus=\"true\"] { transform: translate3d(calc(50vw - 54px * var(--focus-scale)), calc(50vh - 58px * var(--focus-scale)), 0) scale(var(--focus-scale)) !important; z-index: 1; }\n.lr-user[data-focus=\"true\"] .lr-label video { clip-path: inset(0 round 4px); }\n.lr-user[data-focus=\"true\"] .lr-label > span { opacity: 1; visibility: visible; }\n.lr-user[data-focus=\"true\"]:not([data-live=\"true\"]) .lr-label { background: #18181b; border-radius: 4px; }\n.lr-user[data-focus=\"true\"] .lr-cursor, .lr-user[data-focus=\"true\"] .lr-halo, .lr-user[data-focus=\"true\"] .lr-ripple { opacity: 0; }\n@media (prefers-reduced-motion: reduce) {\n .lr-user[data-focus-motion=\"true\"], .lr-label video { transition: none !important; }\n .lr-cursor, .lr-label { transition: none !important; }\n .lr-ripple { animation: none !important; }\n .lr-cursors::before, .lr-label > span { transition-duration: 100ms; }\n .lr-user[data-net] .lr-label span::before { animation: none; }\n .lr-halo { transition: none !important; }\n}\n.lr-user[data-blocked=\"true\"] { opacity: 0.4; }\n/* On a bad network: a pulsing dot before the name (its cursor may freeze). */\n.lr-user[data-net=\"unstable\"] .lr-label span::before { content: \"\"; display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0;\n border-radius: 50%; background: #d97706; box-shadow: 0 0 0 1px rgb(255 255 255 / 70%); animation: lr-pulse 1.2s ease-in-out infinite; }\n@keyframes lr-pulse { 50% { opacity: 0.3; } }\n", P = "<svg width=\"23\" viewBox=\"0 0 27 24\" fill=\"currentColor\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.27 0.06L25.43 8.06C25.66 8.13 25.83 8.26 25.95 8.43C26.07 8.59 26.14 8.79 26.14 8.99C26.14 9.2 26.07 9.4 25.95 9.56C25.83 9.73 25.66 9.86 25.46 9.93L15.35 13.77L11.31 23.37C11.23 23.56 11.1 23.72 10.92 23.83C10.75 23.94 10.54 24 10.33 24C10.12 24 9.91 23.94 9.73 23.82C9.55 23.7 9.42 23.53 9.34 23.34L0.92 1.34C0.86 1.16 0.84 0.97 0.89 0.78C0.93 0.6 1.03 0.43 1.17 0.29C1.31 0.16 1.49 0.07 1.68 0.02C1.88 -0.02 2.08 -0.01 2.27 0.06Z\"/></svg>", F = 120, I = 600, L = 22, R = 24, z = 64, B = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i, V = (e) => B.test(e) ? e : "#a3a3a3";
1155
+ function H(e, t, n) {
1149
1156
  e.dataset[t] !== n && (e.dataset[t] = n);
1150
1157
  }
1151
- var H = class {
1158
+ var fe = class {
1152
1159
  root;
1153
1160
  options;
1154
1161
  nodes = /* @__PURE__ */ new Map();
@@ -1163,7 +1170,7 @@ var H = class {
1163
1170
  ...e
1164
1171
  };
1165
1172
  let t = e.container.ownerDocument;
1166
- this.style = t.createElement("style"), this.style.textContent = M, (e.styleRoot.nodeType === 9 ? e.styleRoot.head : e.styleRoot).appendChild(this.style), this.trace = t.documentElement.hasAttribute("data-liveroom-trace"), this.root = t.createElement("div"), this.root.className = "lr-cursors", e.container.appendChild(this.root);
1173
+ this.style = t.createElement("style"), this.style.textContent = N, (e.styleRoot.nodeType === 9 ? e.styleRoot.head : e.styleRoot).appendChild(this.style), this.trace = t.documentElement.hasAttribute("data-liveroom-trace"), this.root = t.createElement("div"), this.root.className = "lr-cursors", e.container.appendChild(this.root);
1167
1174
  }
1168
1175
  destroy() {
1169
1176
  cancelAnimationFrame(this.frame), this.root.remove(), this.style.remove();
@@ -1177,7 +1184,7 @@ var H = class {
1177
1184
  let n = this.nodes.get(e);
1178
1185
  if (!n || n.el.dataset.self === "true") return;
1179
1186
  let r = performance.now();
1180
- t?.fromClick && (n.mouseDown || r - n.lastMouseDownAt < F) || r - n.lastPulseAt < P || (n.lastPulseAt = r, n.ripple.dataset.anim = n.ripple.dataset.anim === "a" ? "b" : "a");
1187
+ t?.fromClick && (n.mouseDown || r - n.lastMouseDownAt < I) || r - n.lastPulseAt < F || (n.lastPulseAt = r, n.ripple.dataset.anim = n.ripple.dataset.anim === "a" ? "b" : "a");
1181
1188
  }
1182
1189
  sync(e) {
1183
1190
  let t = /* @__PURE__ */ new Set();
@@ -1190,21 +1197,21 @@ var H = class {
1190
1197
  e.style.setProperty("--focus-scale", String(n));
1191
1198
  }
1192
1199
  updateFocus() {
1193
- V(this.root, "focus", String(!!this.root.querySelector("[data-focus=\"true\"]")));
1200
+ H(this.root, "focus", String(!!this.root.querySelector("[data-focus=\"true\"]")));
1194
1201
  }
1195
1202
  update(e) {
1196
- let t = this.nodes.get(e.id) ?? this.create(e), n = t.el, i = B(e.color);
1197
- n.style.getPropertyValue("--color") !== i && n.style.setProperty("--color", i), t.label.firstChild.textContent !== e.name && (t.label.firstChild.textContent = e.name, t.labelDirty = !0), t.video.getAttribute("aria-label") !== e.name && t.video.setAttribute("aria-label", e.name), V(n, "type", e.type === "admin" ? "admin" : "client"), V(n, "self", String(!!e.self));
1203
+ let t = this.nodes.get(e.id) ?? this.create(e), n = t.el, i = V(e.color);
1204
+ n.style.getPropertyValue("--color") !== i && n.style.setProperty("--color", i), t.label.firstChild.textContent !== e.name && (t.label.firstChild.textContent = e.name, t.labelDirty = !0), t.video.getAttribute("aria-label") !== e.name && t.video.setAttribute("aria-label", e.name), H(n, "type", e.type === "admin" ? "admin" : "client"), H(n, "self", String(!!e.self));
1198
1205
  let a = String((e.camera || e.type === "admin" && (e.flags & r.focus) !== 0) && !e.self);
1199
- n.dataset.camera !== a && (V(n, "camera", a), t.labelDirty = !0);
1206
+ n.dataset.camera !== a && (H(n, "camera", a), t.labelDirty = !0);
1200
1207
  let o = String(e.type === "admin" && !e.self && (e.flags & r.focus) !== 0);
1201
- n.dataset.focus !== o && (clearTimeout(t.focusExitTimer), (n.dataset.focus !== void 0 || o === "true") && V(n, "focusMotion", "true"), this.setFocusScale(n), V(n, "focus", o), o === "false" && n.dataset.focusMotion === "true" && (t.focusExitTimer = setTimeout(() => {
1202
- V(n, "focusMotion", "false"), t.labelDirty = !0;
1203
- }, 300)), this.updateFocus()), V(n, "blocked", String(!!e.blocked));
1208
+ n.dataset.focus !== o && (clearTimeout(t.focusExitTimer), (n.dataset.focus !== void 0 || o === "true") && H(n, "focusMotion", "true"), this.setFocusScale(n), H(n, "focus", o), o === "false" && n.dataset.focusMotion === "true" && (t.focusExitTimer = setTimeout(() => {
1209
+ H(n, "focusMotion", "false"), t.labelDirty = !0;
1210
+ }, 300)), this.updateFocus()), H(n, "blocked", String(!!e.blocked));
1204
1211
  let s = e.net ?? "good";
1205
- n.dataset.net !== s && (V(n, "net", s), t.labelDirty = !0);
1212
+ n.dataset.net !== s && (H(n, "net", s), t.labelDirty = !0);
1206
1213
  let c = !e.self && (e.flags & r.mouseDown) !== 0;
1207
- c && !t.mouseDown && (t.lastMouseDownAt = performance.now(), this.pulse(e.id)), t.mouseDown = c, V(n, "halo", String((e.flags & r.shift) !== 0 || c)), this.setTarget(e.id, e.x, e.y);
1214
+ c && !t.mouseDown && (t.lastMouseDownAt = performance.now(), this.pulse(e.id)), t.mouseDown = c, H(n, "halo", String((e.flags & r.shift) !== 0 || c)), this.setTarget(e.id, e.x, e.y);
1208
1215
  }
1209
1216
  setTarget(e, t, n, r = !1) {
1210
1217
  let i = this.nodes.get(e);
@@ -1220,12 +1227,12 @@ var H = class {
1220
1227
  return this.options.rightEdge ? this.options.rightEdge() : this.root.clientWidth || this.root.ownerDocument.defaultView?.innerWidth || 0;
1221
1228
  }
1222
1229
  measureLabelWidth(e) {
1223
- return e.labelDirty && (e.labelDirty = !1, e.labelWidth = e.label.offsetWidth), e.labelWidth || R;
1230
+ return e.labelDirty && (e.labelDirty = !1, e.labelWidth = e.label.offsetWidth), e.labelWidth || z;
1224
1231
  }
1225
1232
  updateFlip(e, t, n, r) {
1226
1233
  if (r <= 0) return;
1227
- let i = (this.measureLabelWidth(e) + I) * n, a = L * n;
1228
- !e.flipped && r - t < i ? e.flipped = !0 : e.flipped && r - t > i + a && (e.flipped = !1), V(e.el, "flip", String(e.flipped));
1234
+ let i = (this.measureLabelWidth(e) + L) * n, a = R * n;
1235
+ !e.flipped && r - t < i ? e.flipped = !0 : e.flipped && r - t > i + a && (e.flipped = !1), H(e.el, "flip", String(e.flipped));
1229
1236
  }
1230
1237
  place(e, t, n, r, i = this.options.scale?.() ?? 1, a = this.rightEdge()) {
1231
1238
  e.x = t, e.y = n, e.el.style.transform = `translate3d(${t}px, ${n}px, 0) scale(${i})`, this.updateFlip(e, t, i, a), r && (e.arrived = !0, this.trace && (e.el.dataset.x = e.target[0].toFixed(2), e.el.dataset.y = e.target[1].toFixed(2)));
@@ -1240,7 +1247,7 @@ var H = class {
1240
1247
  }
1241
1248
  create(e) {
1242
1249
  let t = this.root.ownerDocument.createElement("div");
1243
- t.className = "lr-user", t.id = `user-${e.id}`, t.innerHTML = `<div class="lr-ripple"></div>${N.replace("<svg", "<svg class=\"lr-cursor\"")}<div class="lr-label"><span></span><video autoplay muted playsinline></video></div><div class="lr-halo"></div>`;
1250
+ t.className = "lr-user", t.id = `user-${e.id}`, t.innerHTML = `<div class="lr-ripple"></div>${P.replace("<svg", "<svg class=\"lr-cursor\"")}<div class="lr-label"><span></span><video autoplay muted playsinline></video></div><div class="lr-halo"></div>`;
1244
1251
  let n = t.querySelector(".lr-label"), r = t.querySelector(".lr-ripple");
1245
1252
  n.firstElementChild.textContent = e.name, this.root.appendChild(t);
1246
1253
  let i = {
@@ -1289,7 +1296,7 @@ function U(e, t) {
1289
1296
  let n = e?.closest(".lr-user");
1290
1297
  n && (n.dataset.live = String(t));
1291
1298
  }
1292
- var W = (e, t) => e.type === "admin" && ((e.id === t.you ? t.ownFlags : e.flags) & r.focus) !== 0, G = (e, t) => e.camera || W(e, t), de = class {
1299
+ var W = (e, t) => e.type === "admin" && ((e.id === t.you ? t.ownFlags : e.flags) & r.focus) !== 0, G = (e, t) => e.camera || W(e, t), pe = class {
1293
1300
  options;
1294
1301
  room = null;
1295
1302
  connecting = null;
@@ -1320,7 +1327,7 @@ var W = (e, t) => e.type === "admin" && ((e.id === t.you ? t.ownFlags : e.flags)
1320
1327
  }
1321
1328
  }
1322
1329
  async stop() {
1323
- this.stopped = !0, this.focusExitTimer && clearTimeout(this.focusExitTimer), this.focusExitTimer = null, this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = null, await this.room?.disconnect(), this.room = null, this.clearTracks();
1330
+ this.stopped = !0, this.focusExitTimer && clearTimeout(this.focusExitTimer), this.focusExitTimer = null, this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = null, await this.room?.dispose(), this.room = null, this.clearTracks();
1324
1331
  }
1325
1332
  warm() {
1326
1333
  return !!this.options.preconnect && [...this.options.client.participants.values()].some((e) => e.type === "admin");
@@ -1342,7 +1349,7 @@ var W = (e, t) => e.type === "admin" && ((e.id === t.you ? t.ownFlags : e.flags)
1342
1349
  if ((this.warm() || [...e.participants.values()].some((t) => G(t, e))) && !this.room && !this.connecting && e.livekit && (this.connecting = this.connect().finally(() => this.connecting = null)), this.connecting && await this.connecting, !this.stopped) {
1343
1350
  if (!this.warm() && ![...e.participants.values()].some((t) => G(t, e)) && this.room) {
1344
1351
  let e = this.room;
1345
- this.room = null, this.clearTracks(), await e.disconnect();
1352
+ this.room = null, this.clearTracks(), await e.dispose();
1346
1353
  } else {
1347
1354
  if (this.room && this.options.publish) {
1348
1355
  let t = e.me ? G(e.me, e) : !1;
@@ -1353,7 +1360,7 @@ var W = (e, t) => e.type === "admin" && ((e.id === t.you ? t.ownFlags : e.flags)
1353
1360
  }
1354
1361
  }
1355
1362
  async connect() {
1356
- let { client: e } = this.options, { Room: t, RoomEvent: n, Track: r } = await import("./livekit-client.esm-B1rknK61.js"), i = new t({
1363
+ let { client: e } = this.options, { Room: t, RoomEvent: n, Track: r } = await import("./livekit-client.esm-BSy03agG.js"), i = new t({
1357
1364
  dynacast: !0,
1358
1365
  adaptiveStream: !0
1359
1366
  });
@@ -1362,35 +1369,35 @@ var W = (e, t) => e.type === "admin" && ((e.id === t.you ? t.ownFlags : e.flags)
1362
1369
  }), i.on(n.TrackUnsubscribed, (e, t, n) => {
1363
1370
  this.tracks.delete(n.identity), U(this.options.videoFor(n.identity), !1);
1364
1371
  }), i.on(n.Disconnected, () => {
1365
- this.room === i && (this.room = null, this.clearTracks(), this.scheduleRetry());
1372
+ this.room === i && (this.room = null, this.clearTracks(), i.dispose(), this.scheduleRetry());
1366
1373
  });
1367
1374
  try {
1368
- if (await i.connect(e.livekit.url, e.livekit.token, { autoSubscribe: !0 }), this.stopped) return void i.disconnect();
1375
+ if (await i.connect(e.livekit.url, e.livekit.token, { autoSubscribe: !0 }), this.stopped) return void i.dispose();
1369
1376
  this.room = i, this.failures = 0;
1370
1377
  } catch (e) {
1371
- this.options.log?.("livekit connect failed", e), this.scheduleRetry();
1378
+ this.options.log?.("livekit connect failed", e), i.dispose(), this.scheduleRetry();
1372
1379
  }
1373
1380
  }
1374
- }, fe = "16px/1.5 system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
1375
- function pe(e) {
1376
- return `:host { all: initial !important; display: block !important; font: ${fe} !important; color: #0f172a !important; text-align: left !important; direction: ltr !important; ${e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => `${e.replace(/\s*!important$/, "")} !important;`).join(" ")} }`;
1381
+ }, me = "16px/1.5 system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
1382
+ function he(e) {
1383
+ return `:host { all: initial !important; display: block !important; font: ${me} !important; color: #0f172a !important; text-align: left !important; direction: ltr !important; ${e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => `${e.replace(/\s*!important$/, "")} !important;`).join(" ")} }`;
1377
1384
  }
1378
1385
  // src/pill.ts
1379
- var me = "#94A3B8", he = "#F59E0B", ge = "#EF4444", _e = 3e3, ve = 600, ye = 1e3, be = 4, xe = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i, K = (e) => xe.test(e) ? e : "#a3a3a3";
1380
- function Se(e, t) {
1386
+ var ge = "#94A3B8", _e = "#F59E0B", ve = "#EF4444", ye = 3e3, be = 600, xe = 1e3, Se = 4, Ce = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i, K = (e) => Ce.test(e) ? e : "#a3a3a3";
1387
+ function we(e, t) {
1381
1388
  let n = [];
1382
1389
  for (let r of e) r.type === "admin" && r.id !== t && n.push({
1383
1390
  id: r.id,
1384
1391
  name: r.name,
1385
1392
  color: K(r.color),
1386
- clicks: (r.flags & be) !== 0,
1393
+ clicks: (r.flags & Se) !== 0,
1387
1394
  pointed: r.cursorAt > 0,
1388
1395
  movedAt: r.cursorAt
1389
1396
  });
1390
1397
  return n;
1391
1398
  }
1392
1399
  function q(e) {
1393
- let t = we(e.people), n = t.filter((e) => e.pointed), r = n.some((e) => e.clicks), i = e.stopped && t.length > 0, a = n.length > 0 && !e.stopped, o = e.quality !== "good";
1400
+ let t = Ee(e.people), n = t.filter((e) => e.pointed), r = n.some((e) => e.clicks), i = e.stopped && t.length > 0, a = n.length > 0 && !e.stopped, o = e.quality !== "good";
1394
1401
  if (!i && !a && !o) return {
1395
1402
  visible: !1,
1396
1403
  label: "",
@@ -1399,12 +1406,12 @@ function q(e) {
1399
1406
  dotKind: "host",
1400
1407
  quality: null
1401
1408
  };
1402
- let s = i && e.sinceStopMs !== null && e.sinceStopMs < _e, c = i ? Oe(t, e.sinceStopMs !== null && e.sinceStopMs < ve) : a ? De(n, r) : null, l = o ? e.quality === "offline" ? "Reconnecting…" : "Unstable connection" : i ? Ee(t, s) : Te(n, r), u = o || i;
1409
+ let s = i && e.sinceStopMs !== null && e.sinceStopMs < ye, c = i ? Ae(t, e.sinceStopMs !== null && e.sinceStopMs < be) : a ? ke(n, r) : null, l = o ? e.quality === "offline" ? "Reconnecting…" : "Unstable connection" : i ? Oe(t, s) : De(n, r), u = o || i;
1403
1410
  return {
1404
1411
  visible: !0,
1405
1412
  label: l,
1406
1413
  button: c,
1407
- dots: o ? [e.quality === "offline" ? ge : he] : i ? [me] : Ce(Y(n), e.dotIds).map((e) => K(e.color)),
1414
+ dots: o ? [e.quality === "offline" ? ve : _e] : i ? [ge] : Te(Y(n), e.dotIds).map((e) => K(e.color)),
1408
1415
  dotKind: u ? "status" : "host",
1409
1416
  quality: e.quality === "good" ? null : e.quality
1410
1417
  };
@@ -1428,7 +1435,7 @@ function J(e, t, n) {
1428
1435
  function Y(e) {
1429
1436
  return [...e].sort((e, t) => t.movedAt - e.movedAt || e.name.localeCompare(t.name) || e.id.localeCompare(t.id));
1430
1437
  }
1431
- function Ce(e, t) {
1438
+ function Te(e, t) {
1432
1439
  if (!t) return e.slice(0, 3);
1433
1440
  let n = new Map(e.map((e) => [e.id, e])), r = [];
1434
1441
  for (let e of t) {
@@ -1437,10 +1444,10 @@ function Ce(e, t) {
1437
1444
  }
1438
1445
  return r;
1439
1446
  }
1440
- function we(e) {
1447
+ function Ee(e) {
1441
1448
  return [...e].sort((e, t) => e.name.localeCompare(t.name) || e.id.localeCompare(t.id));
1442
1449
  }
1443
- function Te(e, t) {
1450
+ function De(e, t) {
1444
1451
  if (e.length === 1) return t ? `${e[0].name} can point and click` : `${e[0].name} is pointing`;
1445
1452
  if (e.length === 2) {
1446
1453
  let n = `${e[0].name} and ${e[1].name}`;
@@ -1448,10 +1455,10 @@ function Te(e, t) {
1448
1455
  }
1449
1456
  return t ? `${e.length} people can point and click` : `${e.length} people are pointing`;
1450
1457
  }
1451
- function Ee(e, t) {
1458
+ function Oe(e, t) {
1452
1459
  return t ? e.length === 1 ? `You stopped ${e[0].name}'s cursor` : `You stopped ${e.length} cursors` : e.length === 1 ? `${e[0].name}'s cursor is off` : `${e.length} cursors are off`;
1453
1460
  }
1454
- function De(e, t) {
1461
+ function ke(e, t) {
1455
1462
  return {
1456
1463
  text: "Stop",
1457
1464
  ariaLabel: e.length === 1 ? t ? `Stop ${e[0].name}'s cursor and clicks` : `Stop ${e[0].name}'s cursor` : e.length === 2 ? `Stop ${e[0].name}'s and ${e[1].name}'s cursors` : `Stop all ${e.length} cursors`,
@@ -1459,7 +1466,7 @@ function De(e, t) {
1459
1466
  action: "stop"
1460
1467
  };
1461
1468
  }
1462
- function Oe(e, t) {
1469
+ function Ae(e, t) {
1463
1470
  if (e.length === 1) {
1464
1471
  let n = `Let ${e[0].name} point again`;
1465
1472
  return {
@@ -1476,7 +1483,7 @@ function Oe(e, t) {
1476
1483
  action: "resume"
1477
1484
  };
1478
1485
  }
1479
- var ke = "\n.lr-pill { position: fixed; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px;\n padding: 4px 4px 4px 6px; border-radius: 9999px; background: rgb(14 15 21 / 90%);\n backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);\n box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%), 0 6px 18px -6px rgb(0 0 0 / 38%);\n color: #F5F6FB; font: 500 12px/1.5 \"Geist\", system-ui, -apple-system, sans-serif; pointer-events: auto; user-select: none;\n cursor: grab; opacity: 0; transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), transform 200ms cubic-bezier(0.22, 1, 0.36, 1); z-index: 2; }\n.lr-pill[data-shown=\"true\"] { opacity: 1; }\n.lr-pill[hidden] { display: none !important; }\n.lr-pill[data-button=\"false\"] { padding: 4px 10px 4px 6px; }\n.lr-grip { width: 6px; height: 10px; flex: none; background: radial-gradient(circle, rgb(255 255 255 / 55%) 1px, transparent 1.2px) 0 0 / 4px 4px; }\n.lr-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; position: relative; background: var(--lr-host-color, #94A3B8); box-shadow: 0 0 0 1.5px rgb(255 255 255 / 92%); }\n.lr-dot[data-kind=\"status\"] { box-shadow: 0 0 0 1px rgb(255 255 255 / 25%); }\n.lr-dots { display: flex; flex: none; }\n.lr-dots .lr-dot:nth-child(1) { z-index: 3; }\n.lr-dots .lr-dot:nth-child(2) { z-index: 2; }\n.lr-dots .lr-dot:nth-child(3) { z-index: 1; }\n.lr-dots .lr-dot + .lr-dot { margin-left: -3px; }\n.lr-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lr-btn { height: 24px; min-width: 44px; max-width: 200px; padding: 0 10px; margin-left: 2px; border: 0; border-radius: 9999px;\n background: rgb(255 255 255 / 14%); color: #fff; font: 600 12px/24px system-ui, sans-serif; cursor: pointer;\n overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lr-btn:hover { background: rgb(255 255 255 / 22%); }\n.lr-btn:active { background: rgb(255 255 255 / 28%); }\n.lr-btn[aria-disabled=\"true\"] { color: rgb(255 255 255 / 55%); cursor: default; }\n.lr-btn:focus-visible { outline: 2px solid #818CF8; outline-offset: 2px; }\n.lr-pill.dragging { cursor: grabbing; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%), 0 6px 16px -4px rgb(0 0 0 / 35%); }\n.lr-pill.snapping { transition: left 160ms cubic-bezier(.2,.8,.2,1), top 160ms cubic-bezier(.2,.8,.2,1), opacity 200ms ease-out; }\n.lr-target { position: fixed; border: 1.5px dashed rgb(129 140 248 / 70%); border-radius: 12px; pointer-events: none; box-sizing: border-box; }\n.lr-target[data-near=\"true\"] { background: rgb(129 140 248 / 15%); }\n@media (prefers-reduced-motion: reduce) {\n .lr-pill, .lr-pill.snapping { animation: none; transition: none; transform: none !important; }\n}\n", Ae = class {
1486
+ var X = "\n.lr-pill { position: fixed; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px;\n padding: 4px 4px 4px 6px; border-radius: 9999px; background: rgb(14 15 21 / 90%);\n backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);\n box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%), 0 6px 18px -6px rgb(0 0 0 / 38%);\n color: #F5F6FB; font: 500 12px/1.5 \"Geist\", system-ui, -apple-system, sans-serif; pointer-events: auto; user-select: none;\n cursor: grab; opacity: 0; transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), transform 200ms cubic-bezier(0.22, 1, 0.36, 1); z-index: 2; }\n.lr-pill[data-shown=\"true\"] { opacity: 1; }\n.lr-pill[hidden] { display: none !important; }\n.lr-pill[data-button=\"false\"] { padding: 4px 10px 4px 6px; }\n.lr-grip { width: 6px; height: 10px; flex: none; background: radial-gradient(circle, rgb(255 255 255 / 55%) 1px, transparent 1.2px) 0 0 / 4px 4px; }\n.lr-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; position: relative; background: var(--lr-host-color, #94A3B8); box-shadow: 0 0 0 1.5px rgb(255 255 255 / 92%); }\n.lr-dot[data-kind=\"status\"] { box-shadow: 0 0 0 1px rgb(255 255 255 / 25%); }\n.lr-dots { display: flex; flex: none; }\n.lr-dots .lr-dot:nth-child(1) { z-index: 3; }\n.lr-dots .lr-dot:nth-child(2) { z-index: 2; }\n.lr-dots .lr-dot:nth-child(3) { z-index: 1; }\n.lr-dots .lr-dot + .lr-dot { margin-left: -3px; }\n.lr-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lr-btn { height: 24px; min-width: 44px; max-width: 200px; padding: 0 10px; margin-left: 2px; border: 0; border-radius: 9999px;\n background: rgb(255 255 255 / 14%); color: #fff; font: 600 12px/24px system-ui, sans-serif; cursor: pointer;\n overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lr-btn:hover { background: rgb(255 255 255 / 22%); }\n.lr-btn:active { background: rgb(255 255 255 / 28%); }\n.lr-btn[aria-disabled=\"true\"] { color: rgb(255 255 255 / 55%); cursor: default; }\n.lr-btn:focus-visible { outline: 2px solid #818CF8; outline-offset: 2px; }\n.lr-pill.dragging { cursor: grabbing; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%), 0 6px 16px -4px rgb(0 0 0 / 35%); }\n.lr-pill.snapping { transition: left 160ms cubic-bezier(.2,.8,.2,1), top 160ms cubic-bezier(.2,.8,.2,1), opacity 200ms ease-out; }\n.lr-target { position: fixed; border: 1.5px dashed rgb(129 140 248 / 70%); border-radius: 12px; pointer-events: none; box-sizing: border-box; }\n.lr-target[data-near=\"true\"] { background: rgb(129 140 248 / 15%); }\n@media (prefers-reduced-motion: reduce) {\n .lr-pill, .lr-pill.snapping { animation: none; transition: none; transform: none !important; }\n}\n", je = class {
1480
1487
  root;
1481
1488
  label;
1482
1489
  dots;
@@ -1502,7 +1509,7 @@ var ke = "\n.lr-pill { position: fixed; left: 12px; bottom: 12px; display: flex;
1502
1509
  drag = null;
1503
1510
  handlers;
1504
1511
  constructor(e, t) {
1505
- this.handlers = t, this.style = document.createElement("style"), this.style.textContent = ke, this.root = document.createElement("div"), this.root.className = "lr-pill", this.root.role = "group", this.root.setAttribute("aria-label", "Liveroom"), this.root.hidden = !0, this.root.dataset.shown = "false";
1512
+ this.handlers = t, this.style = document.createElement("style"), this.style.textContent = X, this.root = document.createElement("div"), this.root.className = "lr-pill", this.root.role = "group", this.root.setAttribute("aria-label", "Liveroom"), this.root.hidden = !0, this.root.dataset.shown = "false";
1506
1513
  let n = document.createElement("span");
1507
1514
  n.className = "lr-grip", n.ariaHidden = "true", this.dots = document.createElement("span"), this.dots.className = "lr-dots", this.dots.ariaHidden = "true", this.label = document.createElement("span"), this.label.className = "lr-label", this.label.role = "status", this.label.ariaLive = "polite", this.button = document.createElement("button"), this.button.type = "button", this.button.className = "lr-btn", this.button.addEventListener("click", (e) => {
1508
1515
  this.button.getAttribute("aria-disabled") === "true" ? (e.preventDefault(), e.stopPropagation()) : this.view.button?.action === "resume" ? this.handlers.onResume() : this.view.button?.action === "stop" && this.handlers.onStop();
@@ -1529,7 +1536,7 @@ var ke = "\n.lr-pill { position: fixed; left: 12px; bottom: 12px; display: flex;
1529
1536
  dotIds: t.ids
1530
1537
  });
1531
1538
  if (this.view = n, this.armOrder(t, e, n), !n.visible) {
1532
- this.dotOrder = null, this.fadeOut();
1539
+ this.dotOrder = null, delete this.root.dataset.quality, this.label.textContent !== "" && (this.label.textContent = ""), this.fadeOut();
1533
1540
  return;
1534
1541
  }
1535
1542
  this.label.textContent !== n.label && (this.label.textContent = n.label);
@@ -1543,7 +1550,7 @@ var ke = "\n.lr-pill { position: fixed; left: 12px; bottom: 12px; display: flex;
1543
1550
  if (window.clearTimeout(this.orderTimer), !n.visible || n.dotKind !== "host") return;
1544
1551
  let r = J(this.model.people, t, null).ids, i = e.ids;
1545
1552
  if (r.length === i.length && r.every((e, t) => e === i[t])) return;
1546
- let a = Math.max(0, e.at + ye - t);
1553
+ let a = Math.max(0, e.at + xe - t);
1547
1554
  this.orderTimer = window.setTimeout(() => this.paint(), a);
1548
1555
  }
1549
1556
  fadeIn() {
@@ -1646,28 +1653,28 @@ var ke = "\n.lr-pill { position: fixed; left: 12px; bottom: 12px; display: flex;
1646
1653
  }
1647
1654
  };
1648
1655
  // src/stylesheets.ts
1649
- function X() {
1656
+ function Me() {
1650
1657
  let e = document.createElement("style");
1651
1658
  return e.textContent = "\n * {\n cursor: crosshair !important;\n }\n ", e;
1652
1659
  }
1653
- function je() {
1660
+ function Ne() {
1654
1661
  let e = document.createElement("style");
1655
1662
  return e.textContent = "\n * {\n pointer-events: none !important;\n user-select: none !important;\n }\n ", e;
1656
1663
  }
1657
- function Me() {
1664
+ function Pe() {
1658
1665
  let e = document.createElement("style");
1659
1666
  return e.textContent = "\n html { overflow: hidden !important; scrollbar-gutter: stable !important; }\n * { touch-action: none !important; overscroll-behavior: none !important; }\n ", e;
1660
1667
  }
1661
1668
  // src/element.ts
1662
- var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 2147483646; width: auto; height: auto"), Z = class extends HTMLElement {
1669
+ var Fe = he("position: fixed; inset: 0; pointer-events: none; z-index: 2147483646; width: auto; height: auto"), Z = class extends HTMLElement {
1663
1670
  client;
1664
1671
  layer;
1665
1672
  cameras;
1666
1673
  cleanup = [];
1667
- blockMouseStyle = X();
1668
- blockPointerStyle = je();
1674
+ blockMouseStyle = Me();
1675
+ blockPointerStyle = Ne();
1669
1676
  blocked = !1;
1670
- blockScrollStyle = Me();
1677
+ blockScrollStyle = Pe();
1671
1678
  pointer = [50, 50];
1672
1679
  shift = !1;
1673
1680
  pill;
@@ -1687,10 +1694,10 @@ var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 214748364
1687
1694
  let o = this.shadowRoot ?? this.attachShadow({ mode: "open" });
1688
1695
  o.replaceChildren();
1689
1696
  let s = document.createElement("style");
1690
- s.textContent = Ne, o.appendChild(s);
1697
+ s.textContent = Fe, o.appendChild(s);
1691
1698
  let c = document.createElement("div");
1692
1699
  c.id = "liveroom-client-element", c.style.cssText = "position: fixed; inset: 0; pointer-events: none;", o.appendChild(c);
1693
- let l = this.client = new ue({
1700
+ let l = this.client = new k({
1694
1701
  url: a,
1695
1702
  roomId: r,
1696
1703
  roomToken: i,
@@ -1705,7 +1712,7 @@ var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 214748364
1705
1712
  user_agent: navigator.userAgent
1706
1713
  }
1707
1714
  });
1708
- this.layer = new H({
1715
+ this.layer = new fe({
1709
1716
  container: c,
1710
1717
  styleRoot: o,
1711
1718
  map: (e, t) => ({
@@ -1713,7 +1720,7 @@ var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 214748364
1713
1720
  top: t / 100 * innerHeight
1714
1721
  }),
1715
1722
  rightEdge: () => innerWidth
1716
- }), this.cameras = new de({
1723
+ }), this.cameras = new pe({
1717
1724
  preconnect: !0,
1718
1725
  client: l,
1719
1726
  publish: !1,
@@ -1738,7 +1745,7 @@ var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 214748364
1738
1745
  this.stopped() || (this.layer?.pulse(e, { fromClick: !0 }), this.replayClick(t / 100, n / 100));
1739
1746
  }), l.on("wheel", ({ x: e, y: t, dx: n, dy: r }) => {
1740
1747
  this.stopped() || this.replayWheel(e / 100, t / 100, n, r);
1741
- }), l.on("refused", (e) => console.error(`[Liveroom] Refused: ${e}`)), this.pill = new Ae(o, {
1748
+ }), l.on("refused", (e) => console.error(`[Liveroom] Refused: ${e}`)), this.pill = new je(o, {
1742
1749
  onStop: () => this.stopHosts(),
1743
1750
  onResume: () => this.resumeHosts()
1744
1751
  }), this.cleanup.push(l.on("quality", (e) => this.pill?.setQuality(e)), () => this.pill?.destroy()), l.connect();
@@ -1795,7 +1802,7 @@ var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 214748364
1795
1802
  this.holdUntilCursor ? e || (this.wantStop = !1) : e ? (this.wantStop = !0, this.stopAcked = !0) : (this.stopAcked || this.stopClickedAt === null) && (this.wantStop = !1, this.stopAcked = !1, this.stopClickedAt = null);
1796
1803
  }
1797
1804
  people() {
1798
- return Se(this.client?.participants.values() ?? [], this.client?.you ?? null);
1805
+ return we(this.client?.participants.values() ?? [], this.client?.you ?? null);
1799
1806
  }
1800
1807
  syncPill() {
1801
1808
  let e = this.stopClickedAt === null ? null : performance.now() - this.stopClickedAt;
@@ -1878,7 +1885,7 @@ var Ne = pe("position: fixed; inset: 0; pointer-events: none; z-index: 214748364
1878
1885
  replayWheel(e, t, n, r) {
1879
1886
  let i = this.elementAt(innerWidth * e / 100, innerHeight * t / 100);
1880
1887
  if (!(i instanceof HTMLElement || i instanceof SVGElement)) return;
1881
- let a = Math.abs(r) >= Math.abs(n), o = Pe(i, a ? "vertical" : "horizontal");
1888
+ let a = Math.abs(r) >= Math.abs(n), o = Ie(i, a ? "vertical" : "horizontal");
1882
1889
  $(o) ? o.scrollByPoint(a ? 0 : n, a ? r : 0, 0) : o.scrollBy({
1883
1890
  top: a ? r : 0,
1884
1891
  left: a ? 0 : n,
@@ -1897,7 +1904,7 @@ function Q() {
1897
1904
  function $(e) {
1898
1905
  return e instanceof HTMLElement && e.tagName === "ION-CONTENT" && "scrollByPoint" in e;
1899
1906
  }
1900
- function Pe(e, t) {
1907
+ function Ie(e, t) {
1901
1908
  for (let n = e; n && n !== document.body; n = n.parentElement) {
1902
1909
  if ($(n)) return n;
1903
1910
  let { overflowY: e, overflowX: r } = getComputedStyle(n);