@nethesis/chat-island 0.1.7 → 0.1.9

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.
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ function w(e) {
43
43
  //#endregion
44
44
  //#region src/drag.ts
45
45
  var T = 8;
46
- function E(e, t) {
46
+ function ee(e, t) {
47
47
  let [n, a] = c(() => {
48
48
  try {
49
49
  let e = localStorage.getItem(t);
@@ -103,7 +103,7 @@ function E(e, t) {
103
103
  }
104
104
  //#endregion
105
105
  //#region node_modules/ltx/lib/escape.js
106
- var D = /* @__PURE__ */ y(((e) => {
106
+ var E = /* @__PURE__ */ y(((e) => {
107
107
  var t = {
108
108
  "&": "&",
109
109
  "<": "&lt;",
@@ -145,8 +145,8 @@ var D = /* @__PURE__ */ y(((e) => {
145
145
  return e.replace(/&(amp|#38|lt|#60|gt|#62);/g, i);
146
146
  }
147
147
  e.escapeXML = a, e.escapeXMLText = s, e.unescapeXML = o, e.unescapeXMLText = c;
148
- })), O = /* @__PURE__ */ y(((e, t) => {
149
- var n = D(), r = class e {
148
+ })), D = /* @__PURE__ */ y(((e, t) => {
149
+ var n = E(), r = class e {
150
150
  constructor(e, t) {
151
151
  this.name = e, this.parent = null, this.children = [], this.attrs = {}, this.setAttrs(t);
152
152
  }
@@ -277,8 +277,8 @@ var D = /* @__PURE__ */ y(((e) => {
277
277
  }
278
278
  };
279
279
  r.prototype.tree = r.prototype.root, t.exports = r;
280
- })), ee = /* @__PURE__ */ y(((e, t) => {
281
- var n = O();
280
+ })), O = /* @__PURE__ */ y(((e, t) => {
281
+ var n = D();
282
282
  function r(e, t) {
283
283
  if (Array.isArray(t)) {
284
284
  for (let n of t) r(e, n);
@@ -472,7 +472,7 @@ var D = /* @__PURE__ */ y(((e) => {
472
472
  else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
473
473
  }
474
474
  })), te = /* @__PURE__ */ y(((e, t) => {
475
- var n = k(), r = D(), i = 0, a = 1, o = 2, s = 3, c = 4, l = 5, u = 6, d = 7, f = 8, p = 9, m = 10;
475
+ var n = k(), r = E(), i = 0, a = 1, o = 2, s = 3, c = 4, l = 5, u = 6, d = 7, f = 8, p = 9, m = 10;
476
476
  t.exports = class extends n.EventEmitter {
477
477
  constructor() {
478
478
  super();
@@ -565,14 +565,14 @@ var D = /* @__PURE__ */ y(((e) => {
565
565
  e && this.write(e), this.write = function() {};
566
566
  }
567
567
  };
568
- })), A = D(), j = /* @__PURE__ */ x(O(), 1), ne = /* @__PURE__ */ x(ee(), 1), M = k(), re = /* @__PURE__ */ x(te(), 1), ie = class extends Error {
568
+ })), A = E(), j = /* @__PURE__ */ x(D(), 1), M = /* @__PURE__ */ x(O(), 1), N = k(), ne = /* @__PURE__ */ x(te(), 1), re = class extends Error {
569
569
  constructor(e) {
570
570
  super(e), this.name = "TimeoutError";
571
571
  }
572
572
  };
573
573
  //#endregion
574
574
  //#region node_modules/@xmpp/events/lib/delay.js
575
- function ae(e) {
575
+ function ie(e) {
576
576
  let t, n = new Promise((n) => {
577
577
  t = setTimeout(n, e);
578
578
  });
@@ -580,32 +580,32 @@ function ae(e) {
580
580
  }
581
581
  //#endregion
582
582
  //#region node_modules/@xmpp/events/lib/timeout.js
583
- function oe(e, t) {
584
- let n = ae(t);
583
+ function ae(e, t) {
584
+ let n = ie(t);
585
585
  function r() {
586
586
  clearTimeout(n.timeout);
587
587
  }
588
- let i = new ie();
588
+ let i = new re();
589
589
  return Promise.race([e.finally(r), n.then(() => {
590
590
  throw i;
591
591
  })]);
592
592
  }
593
593
  //#endregion
594
594
  //#region node_modules/@xmpp/events/lib/onoff.js
595
- var se = /* @__PURE__ */ new WeakMap();
596
- function ce(e) {
597
- let t = se.get(e);
595
+ var oe = /* @__PURE__ */ new WeakMap();
596
+ function se(e) {
597
+ let t = oe.get(e);
598
598
  return t || (t = {
599
599
  on: (e.addEventListener ?? e.addListener).bind(e),
600
600
  off: (e.removeEventListener ?? e.removeListener).bind(e),
601
601
  once: (e.once ?? ((t, n) => e.addEventListener(t, n, { once: !0 }))).bind(e)
602
- }, se.set(e, t)), t;
602
+ }, oe.set(e, t)), t;
603
603
  }
604
604
  //#endregion
605
605
  //#region node_modules/@xmpp/events/lib/promise.js
606
- function N(e, t, n = "error", r) {
606
+ function P(e, t, n = "error", r) {
607
607
  return new Promise((i, a) => {
608
- let o, { off: s, once: c } = ce(e), l = () => {
608
+ let o, { off: s, once: c } = se(e), l = () => {
609
609
  clearTimeout(o), s(t, d), s(n, u);
610
610
  };
611
611
  function u(e) {
@@ -615,7 +615,7 @@ function N(e, t, n = "error", r) {
615
615
  i(e), l();
616
616
  }
617
617
  if (c(t, d), n && c(n, u), r) {
618
- let e = new ie();
618
+ let e = new re();
619
619
  o = setTimeout(() => {
620
620
  l(), a(e);
621
621
  }, r);
@@ -624,14 +624,14 @@ function N(e, t, n = "error", r) {
624
624
  }
625
625
  //#endregion
626
626
  //#region node_modules/@xmpp/events/lib/Deferred.js
627
- function le() {
627
+ function ce() {
628
628
  this.promise = new Promise((e, t) => {
629
629
  this.resolve = e, this.reject = t;
630
630
  });
631
631
  }
632
632
  //#endregion
633
633
  //#region node_modules/@xmpp/events/lib/procedure.js
634
- function ue(e, t = null, n) {
634
+ function le(e, t = null, n) {
635
635
  return new Promise((r, i) => {
636
636
  function a(t) {
637
637
  e.removeListener("nonza", s), i(t);
@@ -651,28 +651,28 @@ function ue(e, t = null, n) {
651
651
  }
652
652
  //#endregion
653
653
  //#region node_modules/@xmpp/events/lib/listeners.js
654
- function de(e) {
654
+ function ue(e) {
655
655
  return {
656
656
  subscribe(t) {
657
- let { on: n } = ce(t);
657
+ let { on: n } = se(t);
658
658
  for (let [t, r] of Object.entries(e)) n(t, r);
659
659
  },
660
660
  unsubscribe(t) {
661
- let { off: n } = ce(t);
661
+ let { off: n } = se(t);
662
662
  for (let [t, r] of Object.entries(e)) n(t, r);
663
663
  }
664
664
  };
665
665
  }
666
666
  //#endregion
667
667
  //#region node_modules/@xmpp/xml/lib/XMLError.js
668
- var fe = class extends Error {
668
+ var F = class extends Error {
669
669
  constructor(...e) {
670
670
  super(...e), this.name = "XMLError";
671
671
  }
672
- }, pe = class extends M.EventEmitter {
672
+ }, de = class extends N.EventEmitter {
673
673
  constructor() {
674
674
  super();
675
- let e = new re.default();
675
+ let e = new ne.default();
676
676
  this.root = null, this.cursor = null, e.on("startElement", this.onStartElement.bind(this)), e.on("endElement", this.onEndElement.bind(this)), e.on("text", this.onText.bind(this)), this.parser = e;
677
677
  }
678
678
  onStartElement(e, t) {
@@ -682,7 +682,7 @@ var fe = class extends Error {
682
682
  onEndElement(e) {
683
683
  let { root: t, cursor: n } = this;
684
684
  if (e !== n.name) {
685
- this.emit("error", new fe(`${n.name} must be closed.`));
685
+ this.emit("error", new F(`${n.name} must be closed.`));
686
686
  return;
687
687
  }
688
688
  if (n === t) {
@@ -698,7 +698,7 @@ var fe = class extends Error {
698
698
  onText(e) {
699
699
  let { cursor: t } = this;
700
700
  if (!t) {
701
- this.emit("error", new fe(`${e} must be a child.`));
701
+ this.emit("error", new F(`${e} must be a child.`));
702
702
  return;
703
703
  }
704
704
  t.t(e);
@@ -710,37 +710,37 @@ var fe = class extends Error {
710
710
  e && this.parser.write(e);
711
711
  }
712
712
  };
713
- pe.XMLError = fe;
713
+ de.XMLError = F;
714
714
  //#endregion
715
715
  //#region node_modules/@xmpp/xml/index.js
716
- function P(...e) {
717
- return (0, ne.default)(...e);
716
+ function I(...e) {
717
+ return (0, M.default)(...e);
718
718
  }
719
- Object.assign(P, {
719
+ Object.assign(I, {
720
720
  Element: j.default,
721
- createElement: ne.default,
722
- Parser: pe,
721
+ createElement: M.default,
722
+ Parser: de,
723
723
  escapeXML: A.escapeXML,
724
724
  unescapeXML: A.unescapeXML,
725
725
  escapeXMLText: A.escapeXMLText,
726
726
  unescapeXMLText: A.unescapeXMLText,
727
- XMLError: fe,
728
- xml: P
727
+ XMLError: F,
728
+ xml: I
729
729
  });
730
730
  //#endregion
731
731
  //#region node_modules/@xmpp/jid/lib/escaping.js
732
- function me(e) {
732
+ function fe(e) {
733
733
  return !(!e || e.replaceAll(String.raw`\20`, "").replaceAll(String.raw`\22`, "").replaceAll(String.raw`\26`, "").replaceAll(String.raw`\27`, "").replaceAll(String.raw`\2f`, "").replaceAll(String.raw`\3a`, "").replaceAll(String.raw`\3c`, "").replaceAll(String.raw`\3e`, "").replaceAll(String.raw`\40`, "").replaceAll(String.raw`\5c`, "").search(/[ "&'/:<>@\\]/g) === -1);
734
734
  }
735
- function he(e) {
735
+ function pe(e) {
736
736
  return e === null ? null : e.replaceAll(/^\s+|\s+$/g, "").replaceAll("\\", String.raw`\5c`).replaceAll(" ", String.raw`\20`).replaceAll("\"", String.raw`\22`).replaceAll("&", String.raw`\26`).replaceAll("'", String.raw`\27`).replaceAll("/", String.raw`\2f`).replaceAll(":", String.raw`\3a`).replaceAll("<", String.raw`\3c`).replaceAll(">", String.raw`\3e`).replaceAll("@", String.raw`\40`);
737
737
  }
738
- function ge(e) {
738
+ function me(e) {
739
739
  return e === null ? null : e.replaceAll(String.raw`\20`, " ").replaceAll(String.raw`\22`, "\"").replaceAll(String.raw`\26`, "&").replaceAll(String.raw`\27`, "'").replaceAll(String.raw`\2f`, "/").replaceAll(String.raw`\3a`, ":").replaceAll(String.raw`\3c`, "<").replaceAll(String.raw`\3e`, ">").replaceAll(String.raw`\40`, "@").replaceAll(String.raw`\5c`, "\\");
740
740
  }
741
741
  //#endregion
742
742
  //#region node_modules/@xmpp/jid/lib/JID.js
743
- var F = class e {
743
+ var L = class e {
744
744
  constructor(e, t, n) {
745
745
  if (typeof t != "string" || !t) throw TypeError("Invalid domain.");
746
746
  this.setDomain(t), this.setLocal(typeof e == "string" ? e : ""), this.setResource(typeof n == "string" ? n : "");
@@ -759,11 +759,11 @@ var F = class e {
759
759
  return this._local === e._local && this._domain === e._domain && this._resource === e._resource;
760
760
  }
761
761
  setLocal(e, t) {
762
- return t ||= me(e), t && (e = he(e)), this._local = e && e.toLowerCase(), this;
762
+ return t ||= fe(e), t && (e = pe(e)), this._local = e && e.toLowerCase(), this;
763
763
  }
764
764
  getLocal(e = !1) {
765
765
  let t = null;
766
- return t = e ? ge(this._local) : this._local, t;
766
+ return t = e ? me(this._local) : this._local, t;
767
767
  }
768
768
  setDomain(e) {
769
769
  return this._domain = e.toLowerCase(), this;
@@ -778,37 +778,37 @@ var F = class e {
778
778
  return this._resource;
779
779
  }
780
780
  };
781
- Object.defineProperty(F.prototype, "local", {
782
- get: F.prototype.getLocal,
783
- set: F.prototype.setLocal
784
- }), Object.defineProperty(F.prototype, "domain", {
785
- get: F.prototype.getDomain,
786
- set: F.prototype.setDomain
787
- }), Object.defineProperty(F.prototype, "resource", {
788
- get: F.prototype.getResource,
789
- set: F.prototype.setResource
781
+ Object.defineProperty(L.prototype, "local", {
782
+ get: L.prototype.getLocal,
783
+ set: L.prototype.setLocal
784
+ }), Object.defineProperty(L.prototype, "domain", {
785
+ get: L.prototype.getDomain,
786
+ set: L.prototype.setDomain
787
+ }), Object.defineProperty(L.prototype, "resource", {
788
+ get: L.prototype.getResource,
789
+ set: L.prototype.setResource
790
790
  });
791
791
  //#endregion
792
792
  //#region node_modules/@xmpp/jid/lib/parse.js
793
- function _e(e) {
793
+ function he(e) {
794
794
  let t, n, r = e.indexOf("/");
795
795
  r !== -1 && (n = e.slice(r + 1), e = e.slice(0, r));
796
796
  let i = e.indexOf("@");
797
- return i !== -1 && (t = e.slice(0, i), e = e.slice(i + 1)), new F(t, e, n);
797
+ return i !== -1 && (t = e.slice(0, i), e = e.slice(i + 1)), new L(t, e, n);
798
798
  }
799
799
  //#endregion
800
800
  //#region node_modules/@xmpp/jid/index.js
801
- function ve(e, t) {
801
+ function ge(e, t) {
802
802
  return e.equals(t);
803
803
  }
804
- function ye(...e) {
805
- return !e[1] && !e[2] ? _e(...e) : new F(...e);
804
+ function _e(...e) {
805
+ return !e[1] && !e[2] ? he(...e) : new L(...e);
806
806
  }
807
- var I = ye.bind();
808
- I.jid = ye, I.JID = F, I.parse = _e, I.equal = ve, I.detectEscape = me, I.escapeLocal = he, I.unescapeLocal = ge;
807
+ var R = _e.bind();
808
+ R.jid = _e, R.JID = L, R.parse = he, R.equal = ge, R.detectEscape = fe, R.escapeLocal = pe, R.unescapeLocal = me;
809
809
  //#endregion
810
810
  //#region node_modules/@xmpp/error/index.js
811
- var L = class extends Error {
811
+ var ve = class extends Error {
812
812
  constructor(e, t, n) {
813
813
  super(e + (t ? ` - ${t}` : "")), this.name = "XMPPError", this.condition = e, this.text = t, this.application = n;
814
814
  }
@@ -818,14 +818,14 @@ var L = class extends Error {
818
818
  let o = new this(t.name, i ? i.text() : "", a);
819
819
  return o.element = e, o;
820
820
  }
821
- }, be = class extends L {
821
+ }, ye = class extends ve {
822
822
  constructor(...e) {
823
823
  super(...e), this.name = "StreamError";
824
824
  }
825
825
  };
826
826
  //#endregion
827
827
  //#region node_modules/@xmpp/connection/lib/util.js
828
- function xe(e) {
828
+ function be(e) {
829
829
  let { port: t, hostname: n, protocol: r } = new URL(e);
830
830
  return n === "[::1]" && (n = "::1"), {
831
831
  port: t,
@@ -833,19 +833,19 @@ function xe(e) {
833
833
  protocol: r
834
834
  };
835
835
  }
836
- function Se(e) {
837
- let { port: t, hostname: n } = xe(`http://${e}`);
836
+ function xe(e) {
837
+ let { port: t, hostname: n } = be(`http://${e}`);
838
838
  return {
839
839
  port: t,
840
840
  hostname: n
841
841
  };
842
842
  }
843
- function Ce(e) {
844
- return e.includes("://") ? xe(e) : Se(e);
843
+ function Se(e) {
844
+ return e.includes("://") ? be(e) : xe(e);
845
845
  }
846
846
  //#endregion
847
847
  //#region node_modules/@xmpp/connection/index.js
848
- var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/streams", R = class extends M.EventEmitter {
848
+ var Ce = "urn:ietf:params:xml:ns:xmpp-streams", we = "http://etherx.jabber.org/streams", Te = class extends N.EventEmitter {
849
849
  #e = null;
850
850
  #t = null;
851
851
  constructor(e = {}) {
@@ -856,7 +856,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
856
856
  }
857
857
  async _streamError(e, t) {
858
858
  try {
859
- await this.send(P("stream:error", {}, [P(e, { xmlns: we }, t)]));
859
+ await this.send(I("stream:error", {}, [I(e, { xmlns: Ce }, t)]));
860
860
  } catch {}
861
861
  return this.disconnect();
862
862
  }
@@ -880,7 +880,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
880
880
  });
881
881
  }
882
882
  _attachSocket(e) {
883
- this.socket = e, this.#e ??= de({
883
+ this.socket = e, this.#e ??= ue({
884
884
  data: this._onData.bind(this),
885
885
  close: this.#r.bind(this),
886
886
  connect: () => this._status("connect"),
@@ -891,19 +891,19 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
891
891
  this.socket && this.#e?.unsubscribe(this.socket), this.socket = null;
892
892
  }
893
893
  _onElement(e) {
894
- let t = e.is("error", Te);
894
+ let t = e.is("error", we);
895
895
  t && this._onStreamError(e), this.emit("element", e), this.emit(this.isStanza(e) ? "stanza" : "nonza", e), t && this.disconnect();
896
896
  }
897
897
  _onStreamError(e) {
898
- let t = be.fromElement(e);
898
+ let t = ye.fromElement(e);
899
899
  if (t.condition === "see-other-host") return this._onSeeOtherHost(t);
900
900
  this.emit("error", t);
901
901
  }
902
902
  async _onSeeOtherHost(e) {
903
- let { protocol: t } = Ce(this.options.service), n = e.element.getChildText("see-other-host"), { port: r } = Se(n), i;
903
+ let { protocol: t } = Se(this.options.service), n = e.element.getChildText("see-other-host"), { port: r } = xe(n), i;
904
904
  i = r ? `${t || "xmpp:"}//${n}` : (t ? `${t}//` : "") + n;
905
905
  try {
906
- await N(this, "disconnect");
906
+ await P(this, "disconnect");
907
907
  let { domain: e, lang: t } = this.options;
908
908
  await this.connect(i), await this.open({
909
909
  domain: e,
@@ -914,7 +914,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
914
914
  }
915
915
  }
916
916
  _attachParser(e) {
917
- this.parser = e, this.#t ??= de({
917
+ this.parser = e, this.#t ??= ue({
918
918
  element: this._onElement.bind(this),
919
919
  error: this.#n.bind(this),
920
920
  end: this.#i.bind(this),
@@ -925,7 +925,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
925
925
  this.parser && this.#t?.unsubscribe(this.parser), this.parser = null, this.root = null;
926
926
  }
927
927
  _jid(e) {
928
- return this.jid = I(e), this.jid;
928
+ return this.jid = R(e), this.jid;
929
929
  }
930
930
  _status(e, ...t) {
931
931
  this.status !== e && (this.status = e, this.emit("status", e, ...t), this.emit(e, ...t));
@@ -951,7 +951,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
951
951
  if (this.status !== "offline") throw Error("Connection is not offline");
952
952
  let { service: e, domain: t, lang: n } = this.options;
953
953
  await this.connect(e);
954
- let r = N(this, "online");
954
+ let r = P(this, "online");
955
955
  return await this.open({
956
956
  domain: t,
957
957
  lang: n
@@ -960,15 +960,15 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
960
960
  async connect(e) {
961
961
  this._status("connecting", e);
962
962
  let t = new this.Socket();
963
- return this._attachSocket(t), t.connect(this.socketParameters(e)), N(t, "connect");
963
+ return this._attachSocket(t), t.connect(this.socketParameters(e)), P(t, "connect");
964
964
  }
965
965
  async _closeSocket(e = this.timeout) {
966
- this._status("disconnecting"), this.socket.end(), await N(this.socket, "close", "error", e);
966
+ this._status("disconnecting"), this.socket.end(), await P(this.socket, "close", "error", e);
967
967
  }
968
968
  async open(e) {
969
969
  this._status("opening");
970
970
  let { domain: t, lang: n } = e, r = this.headerElement();
971
- return r.attrs.to = t, r.attrs["xml:lang"] = n, this.root = r, this._attachParser(new this.Parser()), await this.write(this.header(r)), N(this, "open", "error", this.timeout);
971
+ return r.attrs.to = t, r.attrs["xml:lang"] = n, this.root = r, this._attachParser(new this.Parser()), await this.write(this.header(r)), P(this, "open", "error", this.timeout);
972
972
  }
973
973
  async stop() {
974
974
  let e = await this.disconnect();
@@ -977,7 +977,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
977
977
  async _closeStream(e = this.timeout) {
978
978
  await this.#c("close");
979
979
  let t = this.footer(this.footerElement());
980
- return await this.write(t), this._status("closing"), N(this.parser, "end", "error", e);
980
+ return await this.write(t), this._status("closing"), P(this.parser, "end", "error", e);
981
981
  }
982
982
  async restart() {
983
983
  this._detachParser();
@@ -991,7 +991,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
991
991
  e.parent = this.root, await this.write(e.toString()), this.emit("send", e);
992
992
  }
993
993
  sendReceive(e, t = this.timeout) {
994
- return Promise.all([this.send(e), N(this, "element", "error", t)]).then(([, e]) => e);
994
+ return Promise.all([this.send(e), P(this, "element", "error", t)]).then(([, e]) => e);
995
995
  }
996
996
  async write(e) {
997
997
  if (this.status === "closing") throw Error("Connection is closing");
@@ -1010,7 +1010,7 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
1010
1010
  return e.toString();
1011
1011
  }
1012
1012
  headerElement() {
1013
- return new P.Element("", {
1013
+ return new I.Element("", {
1014
1014
  version: "1.0",
1015
1015
  xmlns: this.NS
1016
1016
  });
@@ -1045,10 +1045,10 @@ var we = "urn:ietf:params:xml:ns:xmpp-streams", Te = "http://etherx.jabber.org/s
1045
1045
  }));
1046
1046
  }
1047
1047
  };
1048
- R.prototype.NS = "", R.prototype.Socket = null, R.prototype.Parser = null;
1048
+ Te.prototype.NS = "", Te.prototype.Socket = null, Te.prototype.Parser = null;
1049
1049
  //#endregion
1050
1050
  //#region node_modules/@xmpp/client-core/lib/Client.js
1051
- var Ee = class extends R {
1051
+ var Ee = class extends Te {
1052
1052
  constructor(e) {
1053
1053
  super(e), this.transports = [];
1054
1054
  }
@@ -1092,7 +1092,7 @@ var Ee = class extends R {
1092
1092
  Ee.prototype.NS = "jabber:client";
1093
1093
  //#endregion
1094
1094
  //#region node_modules/@xmpp/reconnect/index.js
1095
- var De = class extends M.EventEmitter {
1095
+ var De = class extends N.EventEmitter {
1096
1096
  constructor(e) {
1097
1097
  super(), this.delay = 1e3, this.entity = e, this._timeout = null;
1098
1098
  }
@@ -1133,14 +1133,14 @@ function Oe({ entity: e }) {
1133
1133
  //#region node_modules/@xmpp/websocket/lib/Socket.js
1134
1134
  var ke = "ECONNERROR";
1135
1135
  function Ae(e) {
1136
- let t = xe(e);
1136
+ let t = be(e);
1137
1137
  return !!(t.protocol === "wss:" || [
1138
1138
  "localhost",
1139
1139
  "127.0.0.1",
1140
1140
  "::1"
1141
1141
  ].includes(t.hostname));
1142
1142
  }
1143
- var je = class extends M.EventEmitter {
1143
+ var je = class extends N.EventEmitter {
1144
1144
  #e = null;
1145
1145
  socket = null;
1146
1146
  url = null;
@@ -1149,7 +1149,7 @@ var je = class extends M.EventEmitter {
1149
1149
  this.url = e, this.secure = Ae(e), this._attachSocket(new WebSocket(e, ["xmpp"]));
1150
1150
  }
1151
1151
  _attachSocket(e) {
1152
- this.socket = e, this.#e ??= de({
1152
+ this.socket = e, this.#e ??= ue({
1153
1153
  open: () => this.emit("connect"),
1154
1154
  message: ({ data: e }) => this.emit("data", e),
1155
1155
  error: (e) => {
@@ -1179,7 +1179,7 @@ var je = class extends M.EventEmitter {
1179
1179
  }
1180
1180
  n();
1181
1181
  }
1182
- }, Me = class extends pe {
1182
+ }, Me = class extends de {
1183
1183
  onStartElement(e, t) {
1184
1184
  let n = new j.default(e, t), { cursor: r } = this;
1185
1185
  r && r.append(n), this.cursor = n;
@@ -1187,7 +1187,7 @@ var je = class extends M.EventEmitter {
1187
1187
  onEndElement(e) {
1188
1188
  let { cursor: t } = this;
1189
1189
  if (e !== t.name) {
1190
- this.emit("error", new fe(`${t.name} must be closed.`));
1190
+ this.emit("error", new F(`${t.name} must be closed.`));
1191
1191
  return;
1192
1192
  }
1193
1193
  if (t.parent) {
@@ -1196,7 +1196,7 @@ var je = class extends M.EventEmitter {
1196
1196
  }
1197
1197
  t.is("open", "urn:ietf:params:xml:ns:xmpp-framing") ? this.emit("start", t) : t.is("close", "urn:ietf:params:xml:ns:xmpp-framing") ? this.emit("end", t) : this.emit("element", t), this.cursor = null;
1198
1198
  }
1199
- }, Ne = "urn:ietf:params:xml:ns:xmpp-framing", Pe = class extends R {
1199
+ }, Ne = "urn:ietf:params:xml:ns:xmpp-framing", Pe = class extends Te {
1200
1200
  send(e, ...t) {
1201
1201
  return e.attrs.xmlns ??= this.NS, super.send(e, ...t);
1202
1202
  }
@@ -1204,7 +1204,7 @@ var je = class extends M.EventEmitter {
1204
1204
  for (let t of e) t.attrs.xmlns ??= this.NS, t.parent = this.root, this.socket.write(t.toString()), this.emit("send", t);
1205
1205
  }
1206
1206
  footerElement() {
1207
- return new P.Element("close", { xmlns: Ne });
1207
+ return new I.Element("close", { xmlns: Ne });
1208
1208
  }
1209
1209
  headerElement() {
1210
1210
  let e = super.headerElement();
@@ -1255,13 +1255,13 @@ var Ie = /* @__PURE__ */ y(((e, t) => {
1255
1255
  constructor(e, t) {
1256
1256
  super(e, t);
1257
1257
  let { jid: n } = e, { domain: r } = e.options ?? {}, i = t.attrs.to || n?.toString(), a = t.attrs.from || r;
1258
- i && (this.to = new I(i)), a && (this.from = new I(a), this.local = this.from.local, this.domain = this.from.domain, this.resource = this.from.resource);
1258
+ i && (this.to = new R(i)), a && (this.from = new R(a), this.local = this.from.local, this.domain = this.from.domain, this.resource = this.from.resource);
1259
1259
  }
1260
1260
  }, Ve = class extends ze {
1261
1261
  constructor(e, t) {
1262
1262
  super(e, t);
1263
1263
  let { jid: n } = e, { domain: r } = e.options ?? {}, i = t.attrs.from || n?.toString(), a = t.attrs.to || r;
1264
- i && (this.from = new I(i)), a && (this.to = new I(a), this.local = this.to.local, this.domain = this.to.domain, this.resource = this.to.resource);
1264
+ i && (this.from = new R(i)), a && (this.to = new R(a), this.local = this.to.local, this.domain = this.to.domain, this.resource = this.to.resource);
1265
1265
  }
1266
1266
  };
1267
1267
  //#endregion
@@ -1310,7 +1310,7 @@ function Ke() {
1310
1310
  }
1311
1311
  //#endregion
1312
1312
  //#region node_modules/@xmpp/middleware/lib/StanzaError.js
1313
- var qe = class extends L {
1313
+ var qe = class extends ve {
1314
1314
  constructor(e, t, n, r) {
1315
1315
  super(e, t, n), this.type = r, this.name = "StanzaError";
1316
1316
  }
@@ -1342,10 +1342,10 @@ var Ye = class {
1342
1342
  }
1343
1343
  async request(e, t = 3e4) {
1344
1344
  e.attrs.id || (e.attrs.id = Ke());
1345
- let n = new le();
1345
+ let n = new ce();
1346
1346
  this.handlers.set(e.attrs.id, n);
1347
1347
  try {
1348
- await this.entity.send(e), await oe(n.promise, t);
1348
+ await this.entity.send(e), await ae(n.promise, t);
1349
1349
  } catch (t) {
1350
1350
  throw this.handlers.delete(e.attrs.id), t;
1351
1351
  }
@@ -1353,7 +1353,7 @@ var Ye = class {
1353
1353
  }
1354
1354
  _childRequest(e, t, n, ...r) {
1355
1355
  let { name: i, attrs: { xmlns: a } } = t;
1356
- return this.request(P("iq", {
1356
+ return this.request(I("iq", {
1357
1357
  type: e,
1358
1358
  to: n
1359
1359
  }, t), ...r).then((e) => e.getChild(i, a));
@@ -1379,7 +1379,7 @@ function $e({ type: e }, t, n) {
1379
1379
  return !(e !== "get" && e !== "set" || t.length !== 1 || !n);
1380
1380
  }
1381
1381
  function et({ stanza: e }) {
1382
- return P("iq", {
1382
+ return I("iq", {
1383
1383
  to: e.attrs.from,
1384
1384
  from: e.attrs.to,
1385
1385
  id: e.attrs.id
@@ -1394,7 +1394,7 @@ function nt(e, t, n) {
1394
1394
  return r.attrs.type = "error", n && r.append(n), r.append(t), r;
1395
1395
  }
1396
1396
  function rt(e, t) {
1397
- return P("error", { type: e }, P(t, Ze));
1397
+ return I("error", { type: e }, I(t, Ze));
1398
1398
  }
1399
1399
  function it(e) {
1400
1400
  return async function(t, n) {
@@ -1408,7 +1408,7 @@ function it(e) {
1408
1408
  } catch (t) {
1409
1409
  e.emit("error", t), o = rt("cancel", "internal-server-error");
1410
1410
  }
1411
- return o ||= rt("cancel", "service-unavailable"), o instanceof P.Element && o.is("error") ? nt(t, o, a) : tt(t, o instanceof P.Element ? o : void 0);
1411
+ return o ||= rt("cancel", "service-unavailable"), o instanceof I.Element && o.is("error") ? nt(t, o, a) : tt(t, o instanceof I.Element ? o : void 0);
1412
1412
  };
1413
1413
  }
1414
1414
  function at(e, t, n, r) {
@@ -1532,7 +1532,7 @@ function ft(e, t = {}) {
1532
1532
  //#endregion
1533
1533
  //#region node_modules/@xmpp/xml/lib/parse.js
1534
1534
  function pt(e) {
1535
- let t = new pe(), n = null, r = null;
1535
+ let t = new de(), n = null, r = null;
1536
1536
  if (t.on("start", (e) => {
1537
1537
  n = e;
1538
1538
  }), t.on("element", (e) => {
@@ -1594,7 +1594,7 @@ async function bt(e, t) {
1594
1594
  e._status("connecting", n);
1595
1595
  let i = r.prototype.socketParameters(n), a = new r.prototype.Socket();
1596
1596
  try {
1597
- a.connect(i), await N(a, "connect");
1597
+ a.connect(i), await P(a, "connect");
1598
1598
  } catch {
1599
1599
  return bt(e, t);
1600
1600
  }
@@ -1623,7 +1623,7 @@ function Ct(e) {
1623
1623
  }
1624
1624
  //#endregion
1625
1625
  //#region node_modules/@xmpp/sasl/lib/SASLError.js
1626
- var wt = class extends L {
1626
+ var wt = class extends ve {
1627
1627
  constructor(...e) {
1628
1628
  super(...e), this.name = "SASLError";
1629
1629
  }
@@ -1645,7 +1645,7 @@ async function Dt({ saslFactory: e, entity: t, mechanism: n, credentials: r }) {
1645
1645
  serviceName: a,
1646
1646
  ...r
1647
1647
  };
1648
- await ue(t, i.clientFirst && P("auth", {
1648
+ await le(t, i.clientFirst && I("auth", {
1649
1649
  xmlns: Tt,
1650
1650
  mechanism: i.name
1651
1651
  }, St(await i.response(o))), async (e, n) => {
@@ -1653,7 +1653,7 @@ async function Dt({ saslFactory: e, entity: t, mechanism: n, credentials: r }) {
1653
1653
  if (e.name === "challenge") {
1654
1654
  await i.challenge(Ct(e.text()));
1655
1655
  let n = await i.response(o);
1656
- await t.send(P("response", {
1656
+ await t.send(I("response", {
1657
1657
  xmlns: Tt,
1658
1658
  mechanism: i.name
1659
1659
  }, typeof n == "string" ? St(n) : ""));
@@ -1695,11 +1695,11 @@ async function At({ saslFactory: e, entity: t, mechanism: n, credentials: r, use
1695
1695
  serviceName: c,
1696
1696
  ...r
1697
1697
  };
1698
- await ue(t, P("authenticate", {
1698
+ await le(t, I("authenticate", {
1699
1699
  xmlns: kt,
1700
1700
  mechanism: s.name
1701
1701
  }, [
1702
- s.clientFirst && P("initial-response", {}, St(await s.response(l))),
1702
+ s.clientFirst && I("initial-response", {}, St(await s.response(l))),
1703
1703
  i,
1704
1704
  ...a
1705
1705
  ]), async (e, n) => {
@@ -1707,7 +1707,7 @@ async function At({ saslFactory: e, entity: t, mechanism: n, credentials: r, use
1707
1707
  if (e.name === "challenge") {
1708
1708
  await s.challenge(Ct(e.text()));
1709
1709
  let n = await s.response(l);
1710
- await t.send(P("response", {
1710
+ await t.send(I("response", {
1711
1711
  xmlns: kt,
1712
1712
  mechanism: s.name
1713
1713
  }, typeof n == "string" ? St(n) : ""));
@@ -1775,7 +1775,7 @@ async function Mt({ element: e, features: t }) {
1775
1775
  //#region node_modules/@xmpp/resource-binding/index.js
1776
1776
  var Nt = "urn:ietf:params:xml:ns:xmpp-bind";
1777
1777
  function Pt(e) {
1778
- return P("bind", { xmlns: Nt }, e && P("resource", {}, e));
1778
+ return I("bind", { xmlns: Nt }, e && I("resource", {}, e));
1779
1779
  }
1780
1780
  async function Ft(e, t, n) {
1781
1781
  let r = (await t.set(Pt(n))).getChildText("jid");
@@ -1832,36 +1832,36 @@ function Vt({ streamFeatures: e, sm: t, entity: n, resumed: r, failed: i, enable
1832
1832
  });
1833
1833
  }
1834
1834
  function Ht(e, t) {
1835
- return ue(e, Wt({ sm: t }), (e, t) => {
1835
+ return le(e, Wt({ sm: t }), (e, t) => {
1836
1836
  if (e.is("enabled", "urn:xmpp:sm:3")) return t(e);
1837
- if (e.is("failed", "urn:xmpp:sm:3")) throw L.fromElement(e);
1837
+ if (e.is("failed", "urn:xmpp:sm:3")) throw ve.fromElement(e);
1838
1838
  });
1839
1839
  }
1840
1840
  async function Ut(e, t) {
1841
- return ue(e, Gt({ sm: t }), (e, t) => {
1841
+ return le(e, Gt({ sm: t }), (e, t) => {
1842
1842
  if (e.is("resumed", "urn:xmpp:sm:3")) return t(e);
1843
- if (e.is("failed", "urn:xmpp:sm:3")) throw L.fromElement(e);
1843
+ if (e.is("failed", "urn:xmpp:sm:3")) throw ve.fromElement(e);
1844
1844
  });
1845
1845
  }
1846
1846
  //#endregion
1847
1847
  //#region node_modules/@xmpp/stream-management/index.js
1848
1848
  var B = "urn:xmpp:sm:3";
1849
1849
  function Wt({ sm: e }) {
1850
- return P("enable", {
1850
+ return I("enable", {
1851
1851
  xmlns: B,
1852
1852
  max: e.preferredMaximum,
1853
1853
  resume: "true"
1854
1854
  });
1855
1855
  }
1856
1856
  function Gt({ sm: e }) {
1857
- return P("resume", {
1857
+ return I("resume", {
1858
1858
  xmlns: B,
1859
1859
  h: e.inbound,
1860
1860
  previd: e.id
1861
1861
  });
1862
1862
  }
1863
1863
  function Kt({ streamFeatures: e, entity: t, middleware: n, bind2: r, sasl2: i }) {
1864
- let a = null, o = null, s = null, c = new M.EventEmitter();
1864
+ let a = null, o = null, s = null, c = new N.EventEmitter();
1865
1865
  Object.assign(c, {
1866
1866
  preferredMaximum: null,
1867
1867
  enabled: !1,
@@ -1877,7 +1877,7 @@ function Kt({ streamFeatures: e, entity: t, middleware: n, bind2: r, sasl2: i })
1877
1877
  });
1878
1878
  async function l() {
1879
1879
  try {
1880
- await t.send(P("a", {
1880
+ await t.send(I("a", {
1881
1881
  xmlns: B,
1882
1882
  h: c.inbound
1883
1883
  }));
@@ -1940,7 +1940,7 @@ function Kt({ streamFeatures: e, entity: t, middleware: n, bind2: r, sasl2: i })
1940
1940
  function g() {
1941
1941
  clearTimeout(o), clearTimeout(s), c.enabled && (c.timeout && !a && (a = setTimeout(() => {
1942
1942
  clearTimeout(o), t.disconnect().catch(() => {});
1943
- }, c.timeout)), t.send(P("r", { xmlns: B })).catch(() => {}), h());
1943
+ }, c.timeout)), t.send(I("r", { xmlns: B })).catch(() => {}), h());
1944
1944
  }
1945
1945
  return n.filter((e, t) => {
1946
1946
  let { stanza: n } = e;
@@ -1963,7 +1963,7 @@ function Kt({ streamFeatures: e, entity: t, middleware: n, bind2: r, sasl2: i })
1963
1963
  }
1964
1964
  function qt({ entity: e, item: t }) {
1965
1965
  let { stanza: n, stamp: r } = t;
1966
- return n.name === "message" && !n.getChild("delay", "urn:xmpp:delay") && n.append(P("delay", {
1966
+ return n.name === "message" && !n.getChild("delay", "urn:xmpp:delay") && n.append(I("delay", {
1967
1967
  xmlns: "urn:xmpp:delay",
1968
1968
  from: e.jid.toString(),
1969
1969
  stamp: r
@@ -1981,7 +1981,7 @@ function Yt({ sasl2: e, entity: t }, n) {
1981
1981
  element: e,
1982
1982
  features: r
1983
1983
  });
1984
- return P("bind", { xmlns: "urn:xmpp:bind:0" }, n && P("tag", null, n), ...t);
1984
+ return I("bind", { xmlns: "urn:xmpp:bind:0" }, n && I("tag", null, n), ...t);
1985
1985
  }, (e) => {
1986
1986
  if (e.is("bound")) {
1987
1987
  t._ready(!1);
@@ -2034,7 +2034,7 @@ var Zt = /* @__PURE__ */ y(((e, t) => {
2034
2034
  });
2035
2035
  })))(), 1), V = "urn:xmpp:fast:0";
2036
2036
  function $t({ sasl2: e, entity: t }) {
2037
- let n = new Qt.default(), r, i = new M.EventEmitter();
2037
+ let n = new Qt.default(), r, i = new N.EventEmitter();
2038
2038
  Object.assign(i, {
2039
2039
  mechanism: null,
2040
2040
  mechanisms: [],
@@ -2081,7 +2081,7 @@ function $t({ sasl2: e, entity: t }) {
2081
2081
  ...r,
2082
2082
  password: c.token
2083
2083
  },
2084
- streamFeatures: [...o, P("fast", { xmlns: V })],
2084
+ streamFeatures: [...o, I("fast", { xmlns: V })],
2085
2085
  entity: t,
2086
2086
  userAgent: n,
2087
2087
  features: s
@@ -2095,7 +2095,7 @@ function $t({ sasl2: e, entity: t }) {
2095
2095
  }
2096
2096
  });
2097
2097
  function a(e) {
2098
- e.push(P("request-token", {
2098
+ e.push(I("request-token", {
2099
2099
  xmlns: V,
2100
2100
  mechanism: i.mechanism
2101
2101
  }));
@@ -2221,7 +2221,7 @@ function mn(e = {}) {
2221
2221
  let { resource: t, credentials: n, username: r, password: i, userAgent: a, ...o } = e, { domain: s, service: c } = o;
2222
2222
  !s && c && (o.domain = pn(c));
2223
2223
  let l = new Ee(o);
2224
- r && o.domain && (l.jid = I(r, o.domain));
2224
+ r && o.domain && (l.jid = R(r, o.domain));
2225
2225
  let u = Oe({ entity: l }), d = Fe({ entity: l }), f = hn(z.default, { entity: l }), p = hn(z.default, { entity: l }), m = We({ entity: l }), h = Ge({ middleware: m }), g = Xe({
2226
2226
  middleware: m,
2227
2227
  entity: l
@@ -2233,7 +2233,7 @@ function mn(e = {}) {
2233
2233
  plain: rn,
2234
2234
  anonymous: sn
2235
2235
  }).map(([e, t]) => ({ [e]: t(y) }));
2236
- a ??= P("user-agent", { id: globalThis.crypto.randomUUID() });
2236
+ a ??= I("user-agent", { id: globalThis.crypto.randomUUID() });
2237
2237
  let x = hn(z.default, { streamFeatures: h }), S = jt({
2238
2238
  streamFeatures: h,
2239
2239
  saslFactory: y
@@ -2256,13 +2256,13 @@ function mn(e = {}) {
2256
2256
  }, dn(n ?? {
2257
2257
  username: r,
2258
2258
  password: i
2259
- }, a)), E = Kt({
2259
+ }, a)), ee = Kt({
2260
2260
  streamFeatures: h,
2261
2261
  entity: l,
2262
2262
  middleware: m,
2263
2263
  bind2: w,
2264
2264
  sasl2: S
2265
- }), D = Lt({
2265
+ }), E = Lt({
2266
2266
  iqCaller: g,
2267
2267
  streamFeatures: h
2268
2268
  }, t);
@@ -2281,8 +2281,8 @@ function mn(e = {}) {
2281
2281
  saslFactory: y,
2282
2282
  sasl2: S,
2283
2283
  sasl: T,
2284
- resourceBinding: D,
2285
- streamManagement: E,
2284
+ resourceBinding: E,
2285
+ streamManagement: ee,
2286
2286
  mechanisms: b,
2287
2287
  bind2: w,
2288
2288
  fast: C
@@ -2320,7 +2320,9 @@ var U = {
2320
2320
  conference: "jabber:x:conference",
2321
2321
  vcard: "vcard-temp",
2322
2322
  ping: "urn:xmpp:ping",
2323
- reactions: "urn:xmpp:reactions:0"
2323
+ reactions: "urn:xmpp:reactions:0",
2324
+ reply: "urn:xmpp:reply:0",
2325
+ fallback: "urn:xmpp:fallback:0"
2324
2326
  }, gn = 3e4, _n = class {
2325
2327
  xmpp;
2326
2328
  me;
@@ -2349,7 +2351,7 @@ var U = {
2349
2351
  this.stopped || this.unauthorized || ((e === "connecting" || e === "opening" || e === "connect") && this.h.status("connecting"), (e === "disconnect" || e === "close") && (this.connected = !1, window.clearInterval(this.pingTimer), this.forgetPresence(), this.h.status("offline")), e === "disconnect" && this.scheduleRetry());
2350
2352
  }), this.xmpp.on("error", (e) => {
2351
2353
  if (!this.stopped) {
2352
- if (vn(e)) {
2354
+ if (yn(e)) {
2353
2355
  this.unauthorized = !0, window.clearTimeout(this.retryTimer), this.h.status("unauthorized", e.message);
2354
2356
  return;
2355
2357
  }
@@ -2362,10 +2364,10 @@ var U = {
2362
2364
  }
2363
2365
  this.attempt = 0, this.connected = !0;
2364
2366
  try {
2365
- await this.xmpp.send(P("iq", {
2367
+ await this.xmpp.send(I("iq", {
2366
2368
  type: "set",
2367
2369
  id: "carbons"
2368
- }, P("enable", { xmlns: U.carbons }))), await this.xmpp.send(P("presence"));
2370
+ }, I("enable", { xmlns: U.carbons }))), await this.xmpp.send(I("presence"));
2369
2371
  } catch {
2370
2372
  return;
2371
2373
  }
@@ -2391,10 +2393,10 @@ var U = {
2391
2393
  document.visibilityState === "visible" && this.wake();
2392
2394
  };
2393
2395
  ping() {
2394
- this.connected && this.xmpp.iqCaller.request(P("iq", {
2396
+ this.connected && this.xmpp.iqCaller.request(I("iq", {
2395
2397
  type: "get",
2396
2398
  to: this.domain
2397
- }, P("ping", { xmlns: U.ping })), 1e4).catch((e) => {
2399
+ }, I("ping", { xmlns: U.ping })), 1e4).catch((e) => {
2398
2400
  !this.stopped && this.connected && e.name !== "StanzaError" && this.xmpp.disconnect().catch(() => {});
2399
2401
  });
2400
2402
  }
@@ -2408,7 +2410,7 @@ var U = {
2408
2410
  let e = this.xmpp;
2409
2411
  (e.status === "offline" ? this.xmpp.start() : e.connect(e.options.service).then(() => e.open({ domain: e.options.domain }))).catch((e) => {
2410
2412
  if (!this.stopped) {
2411
- if (vn(e)) {
2413
+ if (yn(e)) {
2412
2414
  this.unauthorized = !0, this.h.status("unauthorized", e.message);
2413
2415
  return;
2414
2416
  }
@@ -2424,22 +2426,32 @@ var U = {
2424
2426
  isGroup(e) {
2425
2427
  return e.endsWith("@" + this.mucHost);
2426
2428
  }
2427
- async send(e, t, n) {
2428
- let r = crypto.randomUUID(), i = [
2429
- P("body", {}, t),
2430
- P("origin-id", {
2429
+ async send(e, t, n, r) {
2430
+ let i = crypto.randomUUID(), a = this.isGroup(e), o = r ? `> ${r.quote ?? ""}\n` : "", s = [
2431
+ I("body", {}, o + t),
2432
+ I("origin-id", {
2431
2433
  xmlns: U.sid,
2432
- id: r
2434
+ id: i
2433
2435
  }),
2434
- P("store", { xmlns: U.hints })
2436
+ I("store", { xmlns: U.hints })
2435
2437
  ];
2436
- return n && i.push(P("x", { xmlns: U.oob }, P("url", {}, n))), this.isGroup(e) ? (await this.xmpp.send(P("message", {
2438
+ return n && s.push(I("x", { xmlns: U.oob }, I("url", {}, n))), r && (s.push(I("reply", {
2439
+ xmlns: U.reply,
2440
+ id: r.id,
2441
+ to: a ? `${e}/${r.author}` : `${r.author}@${this.domain}`
2442
+ })), s.push(I("fallback", {
2443
+ xmlns: U.fallback,
2444
+ for: U.reply
2445
+ }, I("body", {
2446
+ start: "0",
2447
+ end: String([...o].length)
2448
+ })))), a ? (await this.xmpp.send(I("message", {
2437
2449
  to: e,
2438
2450
  type: "groupchat",
2439
- id: r
2440
- }, ...i)), {
2441
- id: r,
2442
- oid: r,
2451
+ id: i
2452
+ }, ...s)), {
2453
+ id: i,
2454
+ oid: i,
2443
2455
  from: e,
2444
2456
  to: this.cfg.username,
2445
2457
  body: t,
@@ -2447,51 +2459,53 @@ var U = {
2447
2459
  mine: !0,
2448
2460
  oob: n,
2449
2461
  room: e,
2450
- nick: this.cfg.username
2451
- }) : (i.push(P("active", { xmlns: U.chatstates })), await this.xmpp.send(P("message", {
2462
+ nick: this.cfg.username,
2463
+ reply: r
2464
+ }) : (s.push(I("active", { xmlns: U.chatstates })), await this.xmpp.send(I("message", {
2452
2465
  to: `${e}@${this.domain}`,
2453
2466
  type: "chat",
2454
- id: r
2455
- }, ...i)), {
2456
- id: r,
2457
- oid: r,
2467
+ id: i
2468
+ }, ...s)), {
2469
+ id: i,
2470
+ oid: i,
2458
2471
  from: this.cfg.username,
2459
2472
  to: e,
2460
2473
  body: t,
2461
2474
  ts: Date.now(),
2462
2475
  mine: !0,
2463
- oob: n
2476
+ oob: n,
2477
+ reply: r
2464
2478
  });
2465
2479
  }
2466
2480
  async react(e, t, n) {
2467
- let r = this.isGroup(e), i = P("reactions", {
2481
+ let r = this.isGroup(e), i = I("reactions", {
2468
2482
  xmlns: U.reactions,
2469
2483
  id: t
2470
- }, ...n.map((e) => P("reaction", {}, e)));
2471
- await this.xmpp.send(P("message", {
2484
+ }, ...n.map((e) => I("reaction", {}, e)));
2485
+ await this.xmpp.send(I("message", {
2472
2486
  to: r ? e : `${e}@${this.domain}`,
2473
2487
  type: r ? "groupchat" : "chat",
2474
2488
  id: crypto.randomUUID()
2475
- }, i, P("store", { xmlns: U.hints })));
2489
+ }, i, I("store", { xmlns: U.hints })));
2476
2490
  }
2477
2491
  async announce(e) {
2478
- for (let t of e) await this.xmpp.send(P("presence", { to: `${t}@${this.domain}` }, P("x", { xmlns: U.hello }))).catch(() => {});
2492
+ for (let t of e) await this.xmpp.send(I("presence", { to: `${t}@${this.domain}` }, I("x", { xmlns: U.hello }))).catch(() => {});
2479
2493
  }
2480
2494
  typing(e, t) {
2481
- return this.isGroup(e) ? Promise.resolve() : this.xmpp.send(P("message", {
2495
+ return this.isGroup(e) ? Promise.resolve() : this.xmpp.send(I("message", {
2482
2496
  to: `${e}@${this.domain}`,
2483
2497
  type: "chat"
2484
- }, P(t ? "composing" : "paused", { xmlns: U.chatstates })));
2498
+ }, I(t ? "composing" : "paused", { xmlns: U.chatstates })));
2485
2499
  }
2486
2500
  enablePush(e, t) {
2487
- return this.xmpp.iqCaller.request(P("iq", { type: "set" }, P("enable", {
2501
+ return this.xmpp.iqCaller.request(I("iq", { type: "set" }, I("enable", {
2488
2502
  xmlns: U.push,
2489
2503
  jid: e,
2490
2504
  node: t
2491
2505
  })), 15e3);
2492
2506
  }
2493
2507
  disablePush(e, t) {
2494
- return this.xmpp.iqCaller.request(P("iq", { type: "set" }, P("disable", {
2508
+ return this.xmpp.iqCaller.request(I("iq", { type: "set" }, I("disable", {
2495
2509
  xmlns: U.push,
2496
2510
  jid: e,
2497
2511
  node: t
@@ -2506,20 +2520,20 @@ var U = {
2506
2520
  async mam(e, t, n) {
2507
2521
  let r = crypto.randomUUID();
2508
2522
  this.mamQueries.set(r, []), this.mamReactions.set(r, []);
2509
- let i = P("set", { xmlns: U.rsm }, P("max", {}, String(n)), P("before", {}, t ?? "")), a = [P("field", {
2523
+ let i = I("set", { xmlns: U.rsm }, I("max", {}, String(n)), I("before", {}, t ?? "")), a = [I("field", {
2510
2524
  var: "FORM_TYPE",
2511
2525
  type: "hidden"
2512
- }, P("value", {}, U.mam))];
2513
- e && a.push(P("field", { var: "with" }, P("value", {}, this.isGroup(e) ? e : `${e}@${this.domain}`)));
2514
- let o = P("x", {
2526
+ }, I("value", {}, U.mam))];
2527
+ e && a.push(I("field", { var: "with" }, I("value", {}, this.isGroup(e) ? e : `${e}@${this.domain}`)));
2528
+ let o = I("x", {
2515
2529
  xmlns: U.data,
2516
2530
  type: "submit"
2517
2531
  }, ...a), s, c, l;
2518
2532
  try {
2519
- s = await this.xmpp.iqCaller.request(P("iq", {
2533
+ s = await this.xmpp.iqCaller.request(I("iq", {
2520
2534
  type: "set",
2521
2535
  id: r
2522
- }, P("query", {
2536
+ }, I("query", {
2523
2537
  xmlns: U.mam,
2524
2538
  queryid: r
2525
2539
  }, o, i)), 3e4);
@@ -2536,42 +2550,42 @@ var U = {
2536
2550
  }
2537
2551
  async createGroup(e, t, n) {
2538
2552
  let r = `g-${Math.random().toString(36).slice(2, 10)}@${this.mucHost}`, i = this.cfg.username, a = this.waitFor((e) => e.is("presence") && W(e.attrs.from) === r, 1e4);
2539
- await this.xmpp.send(P("presence", { to: `${r}/${i}` }, P("x", { xmlns: U.muc }))), await a;
2540
- let o = (e, t) => P("field", { var: e }, P("value", {}, t));
2541
- await this.xmpp.iqCaller.request(P("iq", {
2553
+ await this.xmpp.send(I("presence", { to: `${r}/${i}` }, I("x", { xmlns: U.muc }))), await a;
2554
+ let o = (e, t) => I("field", { var: e }, I("value", {}, t));
2555
+ await this.xmpp.iqCaller.request(I("iq", {
2542
2556
  type: "set",
2543
2557
  to: r
2544
- }, P("query", { xmlns: U.mucOwner }, P("x", {
2558
+ }, I("query", { xmlns: U.mucOwner }, I("x", {
2545
2559
  xmlns: U.data,
2546
2560
  type: "submit"
2547
2561
  }, o("FORM_TYPE", "http://jabber.org/protocol/muc#roomconfig"), o("muc#roomconfig_roomname", e), o("muc#roomconfig_persistentroom", "1"), o("muc#roomconfig_membersonly", "1"), o("muc#roomconfig_publicroom", "0"), o("muc#roomconfig_whois", "anyone"), o("allow_subscription", "1"), o("mam", "1")))), 15e3), n && await this.setGroupAvatar(r, n).catch(() => {});
2548
2562
  let s = t.filter((e) => e && e !== this.cfg.username);
2549
- await this.xmpp.iqCaller.request(P("iq", {
2563
+ await this.xmpp.iqCaller.request(I("iq", {
2550
2564
  type: "set",
2551
2565
  to: r
2552
- }, P("query", { xmlns: U.mucAdmin }, ...s.map((e) => P("item", {
2566
+ }, I("query", { xmlns: U.mucAdmin }, ...s.map((e) => I("item", {
2553
2567
  affiliation: "member",
2554
2568
  jid: `${e}@${this.domain}`
2555
2569
  })))), 15e3);
2556
- for (let e of s) await this.xmpp.iqCaller.request(P("iq", {
2570
+ for (let e of s) await this.xmpp.iqCaller.request(I("iq", {
2557
2571
  type: "set",
2558
2572
  to: r
2559
- }, P("subscribe", {
2573
+ }, I("subscribe", {
2560
2574
  xmlns: U.mucsub,
2561
2575
  jid: `${e}@${this.domain}`,
2562
2576
  nick: e
2563
- }, P("event", { node: U.mucsubMessages }), P("event", { node: U.mucsubConfig }))), 15e3).catch(() => {});
2564
- await this.xmpp.iqCaller.request(P("iq", {
2577
+ }, I("event", { node: U.mucsubMessages }), I("event", { node: U.mucsubConfig }))), 15e3).catch(() => {});
2578
+ await this.xmpp.iqCaller.request(I("iq", {
2565
2579
  type: "set",
2566
2580
  to: r
2567
- }, P("subscribe", {
2581
+ }, I("subscribe", {
2568
2582
  xmlns: U.mucsub,
2569
2583
  nick: i
2570
- }, P("event", { node: U.mucsubMessages }), P("event", { node: U.mucsubConfig }))), 15e3), await this.xmpp.send(P("presence", {
2584
+ }, I("event", { node: U.mucsubMessages }), I("event", { node: U.mucsubConfig }))), 15e3), await this.xmpp.send(I("presence", {
2571
2585
  to: `${r}/${i}`,
2572
2586
  type: "unavailable"
2573
2587
  }));
2574
- for (let t of s) await this.xmpp.send(P("message", { to: `${t}@${this.domain}` }, P("x", {
2588
+ for (let t of s) await this.xmpp.send(I("message", { to: `${t}@${this.domain}` }, I("x", {
2575
2589
  xmlns: U.conference,
2576
2590
  jid: r,
2577
2591
  reason: e
@@ -2579,58 +2593,58 @@ var U = {
2579
2593
  return r;
2580
2594
  }
2581
2595
  async leaveGroup(e, t) {
2582
- t ? await this.xmpp.iqCaller.request(P("iq", {
2596
+ t ? await this.xmpp.iqCaller.request(I("iq", {
2583
2597
  type: "set",
2584
2598
  to: e
2585
- }, P("query", { xmlns: U.mucOwner }, P("destroy", {}))), 1e4) : await this.xmpp.iqCaller.request(P("iq", {
2599
+ }, I("query", { xmlns: U.mucOwner }, I("destroy", {}))), 1e4) : await this.xmpp.iqCaller.request(I("iq", {
2586
2600
  type: "set",
2587
2601
  to: e
2588
- }, P("unsubscribe", { xmlns: U.mucsub })), 1e4);
2602
+ }, I("unsubscribe", { xmlns: U.mucsub })), 1e4);
2589
2603
  }
2590
2604
  async setGroupAvatar(e, t) {
2591
2605
  let n = /^data:(image\/[a-z+]+);base64,(.+)$/i.exec(t);
2592
- n && await this.xmpp.iqCaller.request(P("iq", {
2606
+ n && await this.xmpp.iqCaller.request(I("iq", {
2593
2607
  type: "set",
2594
2608
  to: e
2595
- }, P("vCard", { xmlns: U.vcard }, P("PHOTO", {}, P("TYPE", {}, n[1]), P("BINVAL", {}, n[2])))), 15e3);
2609
+ }, I("vCard", { xmlns: U.vcard }, I("PHOTO", {}, I("TYPE", {}, n[1]), I("BINVAL", {}, n[2])))), 15e3);
2596
2610
  }
2597
2611
  async groupAvatar(e) {
2598
- let t = (await this.xmpp.iqCaller.request(P("iq", {
2612
+ let t = (await this.xmpp.iqCaller.request(I("iq", {
2599
2613
  type: "get",
2600
2614
  to: e
2601
- }, P("vCard", { xmlns: U.vcard })), 1e4)).getChild("vCard", U.vcard)?.getChild("PHOTO"), n = t?.getChildText("BINVAL");
2615
+ }, I("vCard", { xmlns: U.vcard })), 1e4)).getChild("vCard", U.vcard)?.getChild("PHOTO"), n = t?.getChildText("BINVAL");
2602
2616
  return n ? `data:${t?.getChildText("TYPE") || "image/jpeg"};base64,${n.replace(/\s+/g, "")}` : void 0;
2603
2617
  }
2604
2618
  async listGroups() {
2605
- let e = ((await this.xmpp.iqCaller.request(P("iq", {
2619
+ let e = ((await this.xmpp.iqCaller.request(I("iq", {
2606
2620
  type: "get",
2607
2621
  to: this.mucHost
2608
- }, P("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).map((e) => e.attrs.jid);
2622
+ }, I("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).map((e) => e.attrs.jid);
2609
2623
  return Promise.all(e.map((e) => this.groupInfo(e)));
2610
2624
  }
2611
2625
  async subscribed(e) {
2612
- return ((await this.xmpp.iqCaller.request(P("iq", {
2626
+ return ((await this.xmpp.iqCaller.request(I("iq", {
2613
2627
  type: "get",
2614
2628
  to: this.mucHost
2615
- }, P("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).some((t) => W(t.attrs.jid) === e);
2629
+ }, I("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).some((t) => W(t.attrs.jid) === e);
2616
2630
  }
2617
2631
  async groupInfo(e) {
2618
2632
  let t = e.split("@")[0], n = [], r = !1;
2619
2633
  try {
2620
- t = (await this.xmpp.iqCaller.request(P("iq", {
2634
+ t = (await this.xmpp.iqCaller.request(I("iq", {
2621
2635
  type: "get",
2622
2636
  to: e
2623
- }, P("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChild("identity")?.attrs.name || t;
2637
+ }, I("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChild("identity")?.attrs.name || t;
2624
2638
  } catch {}
2625
2639
  try {
2626
- n = ((await this.xmpp.iqCaller.request(P("iq", {
2640
+ n = ((await this.xmpp.iqCaller.request(I("iq", {
2627
2641
  type: "get",
2628
2642
  to: e
2629
- }, P("query", { xmlns: U.mucAdmin }, P("item", { affiliation: "member" }))), 1e4)).getChild("query", U.mucAdmin)?.getChildren("item") ?? []).map((e) => G(e.attrs.jid));
2630
- let t = await this.xmpp.iqCaller.request(P("iq", {
2643
+ }, I("query", { xmlns: U.mucAdmin }, I("item", { affiliation: "member" }))), 1e4)).getChild("query", U.mucAdmin)?.getChildren("item") ?? []).map((e) => G(e.attrs.jid));
2644
+ let t = await this.xmpp.iqCaller.request(I("iq", {
2631
2645
  type: "get",
2632
2646
  to: e
2633
- }, P("query", { xmlns: U.mucAdmin }, P("item", { affiliation: "owner" }))), 1e4);
2647
+ }, I("query", { xmlns: U.mucAdmin }, I("item", { affiliation: "owner" }))), 1e4);
2634
2648
  for (let e of t.getChild("query", U.mucAdmin)?.getChildren("item") ?? []) n.push(G(e.attrs.jid)), G(e.attrs.jid) === this.cfg.username && (r = !0);
2635
2649
  } catch {}
2636
2650
  let i = await this.groupAvatar(e).catch(() => void 0);
@@ -2643,10 +2657,10 @@ var U = {
2643
2657
  };
2644
2658
  }
2645
2659
  async upload(e) {
2646
- let t = await this.findUploadService(), n = (await this.xmpp.iqCaller.request(P("iq", {
2660
+ let t = await this.findUploadService(), n = (await this.xmpp.iqCaller.request(I("iq", {
2647
2661
  type: "get",
2648
2662
  to: t
2649
- }, P("request", {
2663
+ }, I("request", {
2650
2664
  xmlns: U.upload,
2651
2665
  filename: e.name,
2652
2666
  size: String(e.size),
@@ -2667,19 +2681,19 @@ var U = {
2667
2681
  if (this.uploadService) return this.uploadService;
2668
2682
  let e = async (e) => {
2669
2683
  try {
2670
- return (await this.xmpp.iqCaller.request(P("iq", {
2684
+ return (await this.xmpp.iqCaller.request(I("iq", {
2671
2685
  type: "get",
2672
2686
  to: e
2673
- }, P("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChildren("feature").some((e) => e.attrs.var === U.upload) ?? !1;
2687
+ }, I("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChildren("feature").some((e) => e.attrs.var === U.upload) ?? !1;
2674
2688
  } catch {
2675
2689
  return !1;
2676
2690
  }
2677
2691
  }, t = [`upload.${this.domain}`];
2678
2692
  try {
2679
- let e = await this.xmpp.iqCaller.request(P("iq", {
2693
+ let e = await this.xmpp.iqCaller.request(I("iq", {
2680
2694
  type: "get",
2681
2695
  to: this.domain
2682
- }, P("query", { xmlns: U.disco })), 1e4);
2696
+ }, I("query", { xmlns: U.disco })), 1e4);
2683
2697
  for (let n of e.getChild("query", U.disco)?.getChildren("item") ?? []) t.includes(n.attrs.jid) || t.push(n.attrs.jid);
2684
2698
  } catch {}
2685
2699
  for (let n of t) if (await e(n)) return this.uploadService = n, n;
@@ -2706,7 +2720,7 @@ var U = {
2706
2720
  let r = G(n), i = this.online.get(r) ?? /* @__PURE__ */ new Set();
2707
2721
  e.attrs.type === "unavailable" ? i.delete(t) : i.add(t), this.online.set(r, i), this.h.presence(r, i.size > 0);
2708
2722
  let a = e.getChild("x", U.hello);
2709
- a && !a.attrs.reply && e.attrs.type !== "unavailable" && this.xmpp.send(P("presence", { to: n }, P("x", {
2723
+ a && !a.attrs.reply && e.attrs.type !== "unavailable" && this.xmpp.send(I("presence", { to: n }, I("x", {
2710
2724
  xmlns: U.hello,
2711
2725
  reply: "1"
2712
2726
  }))).catch(() => {});
@@ -2720,7 +2734,7 @@ var U = {
2720
2734
  if (e && r) {
2721
2735
  let t = this.reactionOf(e);
2722
2736
  t && this.mamReactions.get(n.attrs.queryid)?.push(t);
2723
- let i = t ? void 0 : this.toMessage(e, n.attrs.id, yn(n.getChild("forwarded", U.forward)));
2737
+ let i = t ? void 0 : this.toMessage(e, n.attrs.id, bn(n.getChild("forwarded", U.forward)));
2724
2738
  i && r.push(i);
2725
2739
  }
2726
2740
  return;
@@ -2735,7 +2749,7 @@ var U = {
2735
2749
  let i = e.getChild("event", U.pubsubEvent);
2736
2750
  if (i?.getChild("items")?.attrs.node === U.mucsubConfig) {
2737
2751
  let t = W(e.attrs.from);
2738
- this.isGroup(t) && bn(i, "presence")?.getChild("x", U.mucUser)?.getChild("destroy") && this.h.groupDestroyed(t);
2752
+ this.isGroup(t) && xn(i, "presence")?.getChild("x", U.mucUser)?.getChild("destroy") && this.h.groupDestroyed(t);
2739
2753
  return;
2740
2754
  }
2741
2755
  let a = e.getChild("x", U.conference);
@@ -2752,7 +2766,7 @@ var U = {
2752
2766
  this.h.reaction(t);
2753
2767
  return;
2754
2768
  }
2755
- let n = this.toMessage(e, e.getChild("stanza-id", U.sid)?.attrs.id, yn(e));
2769
+ let n = this.toMessage(e, e.getChild("stanza-id", U.sid)?.attrs.id, bn(e));
2756
2770
  if (n) {
2757
2771
  this.h.message(n);
2758
2772
  return;
@@ -2765,7 +2779,7 @@ var U = {
2765
2779
  let t = e.getChild("event", U.pubsubEvent), n = e, r;
2766
2780
  if (t && t.getChild("items")?.attrs.node === U.mucsubMessages) {
2767
2781
  r = W(e.attrs.from);
2768
- let i = xn(t);
2782
+ let i = Sn(t);
2769
2783
  if (!this.isGroup(r) || !i || W(i.attrs.from) !== r) return;
2770
2784
  n = i;
2771
2785
  } else if (e.attrs.type === "groupchat" && (r = W(e.attrs.from), !this.isGroup(r))) return;
@@ -2791,11 +2805,15 @@ var U = {
2791
2805
  } : void 0;
2792
2806
  }
2793
2807
  toMessage(e, t, n) {
2808
+ let r = this.parseMessage(e, t, n);
2809
+ return r && vn(r, xn(e, "reply") ? e.getChild("event", U.pubsubEvent) ? Sn(e.getChild("event", U.pubsubEvent)) : e : void 0);
2810
+ }
2811
+ parseMessage(e, t, n) {
2794
2812
  let r = e.getChild("event", U.pubsubEvent);
2795
2813
  if (r && r.getChild("items")?.attrs.node === U.mucsubMessages) {
2796
2814
  let i = W(e.attrs.from);
2797
2815
  if (!this.isGroup(i)) return;
2798
- let a = xn(r);
2816
+ let a = Sn(r);
2799
2817
  if (!a || W(a.attrs.from) !== i) return;
2800
2818
  let o = (a.attrs.from ?? "").split("/")[1] ?? "", s = a.getChildText("body");
2801
2819
  return s == null ? void 0 : {
@@ -2804,7 +2822,7 @@ var U = {
2804
2822
  from: i,
2805
2823
  to: this.cfg.username,
2806
2824
  body: s,
2807
- ts: yn(a) !== n && a.getChild("delay", U.delay) ? yn(a) : n,
2825
+ ts: bn(a) !== n && a.getChild("delay", U.delay) ? bn(a) : n,
2808
2826
  mine: o === this.cfg.username,
2809
2827
  oob: a.getChild("x", U.oob)?.getChildText("url") ?? void 0,
2810
2828
  room: i,
@@ -2843,20 +2861,43 @@ var U = {
2843
2861
  oob: e.getChild("x", U.oob)?.getChildText("url") ?? void 0
2844
2862
  };
2845
2863
  }
2846
- }, W = (e = "") => e.split("/")[0], vn = (e) => e.name === "SASLError" || e.condition === "not-authorized", G = (e = "") => e.split("@")[0], yn = (e) => {
2864
+ }, W = (e = "") => e.split("/")[0];
2865
+ function vn(e, t) {
2866
+ let n = t?.getChild("reply", U.reply);
2867
+ if (!n?.attrs.id) return e;
2868
+ let r = n.attrs.to ?? "", i = e.room ? r.split("/")[1] ?? "" : G(W(r)), a = t.getChildren("fallback", U.fallback).find((e) => e.attrs.for === U.reply)?.getChild("body"), o = [...e.body], s = Number(a?.attrs.start ?? 0), c = Number(a?.attrs.end ?? 0);
2869
+ if (!a || !(c > s) || c > o.length) return {
2870
+ ...e,
2871
+ reply: {
2872
+ id: n.attrs.id,
2873
+ author: i
2874
+ }
2875
+ };
2876
+ let l = o.slice(s, c).join("").replace(/^> ?/gm, "").trim();
2877
+ return {
2878
+ ...e,
2879
+ body: (o.slice(0, s).join("") + o.slice(c).join("")).trim(),
2880
+ reply: {
2881
+ id: n.attrs.id,
2882
+ author: i,
2883
+ quote: l
2884
+ }
2885
+ };
2886
+ }
2887
+ var yn = (e) => e.name === "SASLError" || e.condition === "not-authorized", G = (e = "") => e.split("@")[0], bn = (e) => {
2847
2888
  let t = e?.getChild("delay", U.delay)?.attrs.stamp;
2848
2889
  return t ? Date.parse(t) : Date.now();
2849
2890
  };
2850
- function bn(e, t) {
2891
+ function xn(e, t) {
2851
2892
  for (let n of e.children) {
2852
2893
  if (typeof n == "string") continue;
2853
2894
  if (n.name === t) return n;
2854
- let e = bn(n, t);
2895
+ let e = xn(n, t);
2855
2896
  if (e) return e;
2856
2897
  }
2857
2898
  }
2858
- var xn = (e) => bn(e, "message"), K;
2859
- function Sn() {
2899
+ var Sn = (e) => xn(e, "message"), K;
2900
+ function Cn() {
2860
2901
  try {
2861
2902
  K ??= new AudioContext(), K.state === "suspended" && K.resume();
2862
2903
  let e = K.currentTime;
@@ -2876,7 +2917,7 @@ function Sn() {
2876
2917
  }
2877
2918
  //#endregion
2878
2919
  //#region node_modules/zustand/esm/vanilla.mjs
2879
- var Cn = (e) => {
2920
+ var wn = (e) => {
2880
2921
  let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
2881
2922
  let i = typeof e == "function" ? e(t) : e;
2882
2923
  if (!Object.is(i, t)) {
@@ -2893,15 +2934,15 @@ var Cn = (e) => {
2893
2934
  }
2894
2935
  }, o = t = e(r, i, a);
2895
2936
  return a;
2896
- }, wn = (e) => e ? Cn(e) : Cn, { useDebugValue: Tn } = e, { useSyncExternalStoreWithSelector: En } = l, Dn = (e) => e;
2897
- function On(e, t = Dn, n) {
2898
- let r = En(e.subscribe, e.getState, e.getServerState || e.getInitialState, t, n);
2899
- return Tn(r), r;
2937
+ }, Tn = (e) => e ? wn(e) : wn, { useDebugValue: En } = e, { useSyncExternalStoreWithSelector: Dn } = l, On = (e) => e;
2938
+ function kn(e, t = On, n) {
2939
+ let r = Dn(e.subscribe, e.getState, e.getServerState || e.getInitialState, t, n);
2940
+ return En(r), r;
2900
2941
  }
2901
- var kn = (e) => {
2902
- let t = typeof e == "function" ? wn(e) : e, n = (e, n) => On(t, e, n);
2942
+ var An = (e) => {
2943
+ let t = typeof e == "function" ? Tn(e) : e, n = (e, n) => kn(t, e, n);
2903
2944
  return Object.assign(n, t), n;
2904
- }, An = (e) => e ? kn(e) : kn, jn = (e) => e.room ?? (e.mine ? e.to : e.from), q = (e, t) => ({
2945
+ }, jn = (e) => e ? An(e) : An, Mn = (e) => e.room ?? (e.mine ? e.to : e.from), q = (e, t) => ({
2905
2946
  peer: e,
2906
2947
  kind: t && e.endsWith("@" + t) ? "group" : "chat",
2907
2948
  messages: [],
@@ -2909,14 +2950,15 @@ var kn = (e) => {
2909
2950
  typing: !1,
2910
2951
  loaded: !1,
2911
2952
  complete: !1
2912
- }), Mn = (e, t, n, r) => {
2953
+ }), Nn = (e, t, n, r) => {
2913
2954
  if (e.includes(t)) return e;
2914
2955
  let i = [t, ...e];
2915
2956
  if (i.length <= n) return i;
2916
2957
  let a = [...i].reverse().find((e) => e !== r);
2917
2958
  return i.filter((e) => e !== a);
2918
- }, J = An((e, t) => ({
2959
+ }, J = jn((e, t) => ({
2919
2960
  me: "",
2961
+ myName: "",
2920
2962
  mucHost: "",
2921
2963
  status: "connecting",
2922
2964
  contacts: {},
@@ -2980,7 +3022,7 @@ var kn = (e) => {
2980
3022
  seed: (t, n) => e((e) => {
2981
3023
  let r = { ...e.conversations };
2982
3024
  for (let i of t) {
2983
- let t = jn(i);
3025
+ let t = Mn(i);
2984
3026
  if (!t || t === n) continue;
2985
3027
  let a = r[t] ?? q(t, e.mucHost);
2986
3028
  if (a.messages.some((e) => e.id === i.id)) continue;
@@ -3003,7 +3045,7 @@ var kn = (e) => {
3003
3045
  let i = e.conversations[t] ?? q(t, e.mucHost), a = i.messages.filter((e) => e.id !== n.id && !(e.pending && n.mine && e.body === n.body && e.oob === n.oob)), o = a.length;
3004
3046
  for (; o > 0 && a[o - 1].ts > n.ts;) o--;
3005
3047
  a.splice(o, 0, n);
3006
- let s = e.open === t, c = r?.live && !n.mine && !s ? i.unread + 1 : i.unread, l = Mn(e.order, t, e.maxHeads, e.open);
3048
+ let s = e.open === t, c = r?.live && !n.mine && !s ? i.unread + 1 : i.unread, l = Nn(e.order, t, e.maxHeads, e.open);
3007
3049
  return {
3008
3050
  conversations: {
3009
3051
  ...e.conversations,
@@ -3054,7 +3096,7 @@ var kn = (e) => {
3054
3096
  ...e.conversations,
3055
3097
  [t]: q(t, e.mucHost)
3056
3098
  },
3057
- order: Mn(e.order, t, e.maxHeads, e.open),
3099
+ order: Nn(e.order, t, e.maxHeads, e.open),
3058
3100
  open: t,
3059
3101
  picker: !1
3060
3102
  })),
@@ -3082,30 +3124,37 @@ var kn = (e) => {
3082
3124
  totalUnread: () => Object.values(t().conversations).reduce((e, t) => e + t.unread, 0)
3083
3125
  }));
3084
3126
  //#endregion
3127
+ //#region src/contacts.ts
3128
+ function Pn(e, t, n) {
3129
+ return Object.values(e ?? {}).filter((e) => e?.username && e.username !== n).map((e) => ({
3130
+ username: e.username,
3131
+ name: e.name || e.username,
3132
+ avatar: t?.[e.username],
3133
+ presence: e.mainPresence,
3134
+ number: e.endpoints?.mainextension?.[0]?.id
3135
+ }));
3136
+ }
3137
+ //#endregion
3085
3138
  //#region src/api.ts
3086
- async function Nn(e, t, n) {
3139
+ async function Fn(e, t, n) {
3087
3140
  let r = await fetch(`https://${e}/api${n}`, { headers: { Authorization: `Bearer ${t}` } });
3088
3141
  if (!r.ok) throw Error(`${n}: HTTP ${r.status}`);
3089
3142
  return await r.json();
3090
3143
  }
3091
- async function Pn(e, t, n) {
3092
- let r = await Nn(e, t, "/user/endpoints/all"), i = {};
3144
+ async function In(e, t, n, r) {
3145
+ let i = await Fn(e, t, "/user/endpoints/all"), a = {};
3093
3146
  try {
3094
- i = await Nn(e, t, "/user/all_avatars");
3147
+ a = await Fn(e, t, "/user/all_avatars");
3095
3148
  } catch {}
3096
- return Object.values(r).filter((e) => e.username && e.username !== n).map((e) => ({
3097
- username: e.username,
3098
- name: e.name || e.username,
3099
- avatar: i[e.username],
3100
- presence: e.mainPresence
3101
- })).sort((e, t) => e.name.localeCompare(t.name));
3149
+ let o = Object.values(i).find((e) => e.username === n)?.name;
3150
+ return o && r?.(o), Pn(i, a, n).sort((e, t) => e.name.localeCompare(t.name));
3102
3151
  }
3103
- async function Fn(e, t) {
3152
+ async function Ln(e, t) {
3104
3153
  let n = await fetch(`https://${e}/chat-gw/push/mobile`, { headers: { Authorization: `Bearer ${t}` } });
3105
3154
  if (!n.ok) throw Error(`push/mobile: HTTP ${n.status}`);
3106
3155
  return (await n.json()).users;
3107
3156
  }
3108
- async function In(e, t, n) {
3157
+ async function Rn(e, t, n) {
3109
3158
  let r = await fetch(`https://${e}/chat-gw/conversations/${encodeURIComponent(n)}`, {
3110
3159
  method: "DELETE",
3111
3160
  headers: { Authorization: `Bearer ${t}` }
@@ -3114,16 +3163,16 @@ async function In(e, t, n) {
3114
3163
  }
3115
3164
  //#endregion
3116
3165
  //#region src/push.ts
3117
- var Ln = (e) => {
3166
+ var zn = (e) => {
3118
3167
  let t = atob((e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"));
3119
3168
  return Uint8Array.from(t, (e) => e.charCodeAt(0));
3120
- }, Rn = !1;
3121
- function zn() {
3122
- Rn || (Rn = !0, navigator.serviceWorker.addEventListener("message", (e) => {
3169
+ }, Bn = !1;
3170
+ function Vn() {
3171
+ Bn || (Bn = !0, navigator.serviceWorker.addEventListener("message", (e) => {
3123
3172
  e.data?.type === "chat-island-open" && typeof e.data.username == "string" && window.dispatchEvent(new CustomEvent("chat-island-open", { detail: { username: e.data.username } }));
3124
3173
  }));
3125
3174
  }
3126
- async function Bn(e, t) {
3175
+ async function Hn(e, t) {
3127
3176
  if (!("serviceWorker" in navigator) || !("PushManager" in window)) throw Error("push not supported by this browser");
3128
3177
  if (Notification.permission === "denied" || Notification.permission !== "granted" && await Notification.requestPermission() !== "granted") return null;
3129
3178
  let n = `https://${e.host}/chat-gw`, r = await fetch(`${n}/push/vapid`);
@@ -3132,7 +3181,7 @@ async function Bn(e, t) {
3132
3181
  await navigator.serviceWorker.ready;
3133
3182
  let o = await a.pushManager.getSubscription() ?? await a.pushManager.subscribe({
3134
3183
  userVisibleOnly: !0,
3135
- applicationServerKey: Ln(i.publicKey)
3184
+ applicationServerKey: zn(i.publicKey)
3136
3185
  }), s = await fetch(`${n}/push/web`, {
3137
3186
  method: "POST",
3138
3187
  headers: {
@@ -3143,7 +3192,7 @@ async function Bn(e, t) {
3143
3192
  });
3144
3193
  if (!s.ok) throw Error(`push/web: HTTP ${s.status} ${(await s.text()).slice(0, 120)}`);
3145
3194
  let c = await s.json();
3146
- return zn(), {
3195
+ return Vn(), {
3147
3196
  node: c.node,
3148
3197
  service: c.service
3149
3198
  };
@@ -3159,8 +3208,8 @@ function X(e, t) {
3159
3208
  }
3160
3209
  //#endregion
3161
3210
  //#region src/components/Avatar.tsx
3162
- var Vn = (e) => e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
3163
- function Hn({ contact: e, username: t, size: n = 40 }) {
3211
+ var Un = (e) => e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
3212
+ function Wn({ contact: e, username: t, size: n = 40 }) {
3164
3213
  let r = e?.name || t, i = {
3165
3214
  width: n,
3166
3215
  height: n,
@@ -3175,13 +3224,13 @@ function Hn({ contact: e, username: t, size: n = 40 }) {
3175
3224
  }) : /* @__PURE__ */ d("div", {
3176
3225
  style: i,
3177
3226
  className: "ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900",
3178
- children: Vn(r)
3227
+ children: Un(r)
3179
3228
  });
3180
3229
  }
3181
- function Un({ online: e, presence: t, mobile: n }) {
3230
+ function Gn({ online: e, presence: t, mobile: n }) {
3182
3231
  return /* @__PURE__ */ d("span", { className: `ci-absolute ci-bottom-0 ci-right-0 ci-w-3 ci-h-3 ci-rounded-full ci-ring-2 ci-ring-gray-50 dark:ci-ring-gray-950 ${t === "dnd" || t === "busy" ? "ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark" : e || n ? "ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark" : "ci-bg-gray-400 dark:ci-bg-gray-600"}` });
3183
3232
  }
3184
- function Wn({ name: e, size: t = 40, avatar: n }) {
3233
+ function Kn({ name: e, size: t = 40, avatar: n }) {
3185
3234
  let r = {
3186
3235
  width: t,
3187
3236
  height: t,
@@ -3196,12 +3245,12 @@ function Wn({ name: e, size: t = 40, avatar: n }) {
3196
3245
  }) : /* @__PURE__ */ d("div", {
3197
3246
  style: r,
3198
3247
  className: "ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-iconSecondary dark:ci-bg-iconSecondaryDark ci-text-white",
3199
- children: Vn(e || "G")
3248
+ children: Un(e || "G")
3200
3249
  });
3201
3250
  }
3202
3251
  //#endregion
3203
3252
  //#region src/components/Button.tsx
3204
- var Gn = "ci-flex ci-content-center ci-items-center ci-justify-center ci-tracking-wide ci-duration-200 ci-transform ci-outline-none focus:ci-ring-2 focus:ci-z-20 focus:ci-ring-offset-2 disabled:ci-opacity-40 disabled:ci-cursor-not-allowed ci-border ci-border-transparent focus:ci-ring-offset-white dark:focus:ci-ring-offset-black ci-text-sm ci-leading-4 ci-transition-colors ci-shrink-0 ci-font-light", Kn = {
3253
+ var qn = "ci-flex ci-content-center ci-items-center ci-justify-center ci-tracking-wide ci-duration-200 ci-transform ci-outline-none focus:ci-ring-2 focus:ci-z-20 focus:ci-ring-offset-2 disabled:ci-opacity-40 disabled:ci-cursor-not-allowed ci-border ci-border-transparent focus:ci-ring-offset-white dark:focus:ci-ring-offset-black ci-text-sm ci-leading-4 ci-transition-colors ci-shrink-0 ci-font-light", Jn = {
3205
3254
  default: "ci-bg-phoneIslandActive dark:ci-bg-phoneIslandActiveDark hover:ci-bg-gray-500 dark:hover:ci-bg-gray-50 focus:ci-ring-emerald-500 dark:focus:ci-ring-emerald-300 ci-text-primaryInvert dark:ci-text-primaryInvertDark ci-h-12 ci-w-12 ci-rounded-full",
3206
3255
  green: "ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark hover:ci-bg-phoneIslandCallHover dark:hover:ci-bg-phoneIslandCallHoverDark focus:ci-ring-green-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full",
3207
3256
  red: "ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark hover:ci-bg-phoneIslandCloseHover dark:hover:ci-bg-phoneIslandCloseHoverDark focus:ci-ring-emerald-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full",
@@ -3214,7 +3263,7 @@ function Z({ variant: e, className: t = "", children: n, ...r }) {
3214
3263
  return /* @__PURE__ */ d("button", {
3215
3264
  type: "button",
3216
3265
  "aria-label": r["aria-label"] ?? r.title,
3217
- className: `${Gn} ${Kn[e]} ${t}`,
3266
+ className: `${qn} ${Jn[e]} ${t}`,
3218
3267
  ...r,
3219
3268
  children: n
3220
3269
  });
@@ -3308,6 +3357,17 @@ var Q = {
3308
3357
  strokeLinejoin: "round",
3309
3358
  children: /* @__PURE__ */ d("path", { d: "M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6" })
3310
3359
  }),
3360
+ reply: /* @__PURE__ */ f("svg", {
3361
+ width: "16",
3362
+ height: "16",
3363
+ viewBox: "0 0 24 24",
3364
+ fill: "none",
3365
+ stroke: "currentColor",
3366
+ strokeWidth: "2",
3367
+ strokeLinecap: "round",
3368
+ strokeLinejoin: "round",
3369
+ children: [/* @__PURE__ */ d("path", { d: "M9 17l-5-5 5-5" }), /* @__PURE__ */ d("path", { d: "M20 18v-2a4 4 0 0 0-4-4H4" })]
3370
+ }),
3311
3371
  minus: /* @__PURE__ */ d("svg", {
3312
3372
  width: "16",
3313
3373
  height: "16",
@@ -3371,7 +3431,7 @@ var Q = {
3371
3431
  };
3372
3432
  //#endregion
3373
3433
  //#region src/components/Dock.tsx
3374
- function qn({ onDragStart: e, pushButton: t = !0 }) {
3434
+ function Yn({ onDragStart: e, pushButton: t = !0 }) {
3375
3435
  let { order: n, open: r, conversations: i, contacts: a, online: o, mobile: s, openChat: c, removeHead: l, picker: p, setPicker: m, status: h, push: g, enablePush: _, newChatButton: v } = J(w((e) => ({
3376
3436
  order: e.order,
3377
3437
  open: e.open,
@@ -3401,15 +3461,15 @@ function qn({ onDragStart: e, pushButton: t = !0 }) {
3401
3461
  title: t?.kind === "group" ? t.name ?? e : a[e]?.name ?? e,
3402
3462
  onClick: () => n ? J.getState().closeChat() : c(e),
3403
3463
  className: `ci-relative ci-rounded-full ci-shadow-lg ci-transition-transform hover:ci-scale-105 ci-ring-2 ci-border-0 ci-p-0 ci-bg-transparent ${n ? "ci-ring-iconSecondary dark:ci-ring-iconSecondaryDark" : "ci-ring-gray-50 dark:ci-ring-gray-950"}`,
3404
- children: [t?.kind === "group" ? /* @__PURE__ */ d(Wn, {
3464
+ children: [t?.kind === "group" ? /* @__PURE__ */ d(Kn, {
3405
3465
  name: t.name ?? e,
3406
3466
  size: 48,
3407
3467
  avatar: t.avatar
3408
- }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(Hn, {
3468
+ }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(Wn, {
3409
3469
  contact: a[e],
3410
3470
  username: e,
3411
3471
  size: 48
3412
- }), /* @__PURE__ */ d(Un, {
3472
+ }), /* @__PURE__ */ d(Gn, {
3413
3473
  online: o[e],
3414
3474
  presence: a[e]?.presence,
3415
3475
  mobile: s[e]
@@ -3445,7 +3505,7 @@ function qn({ onDragStart: e, pushButton: t = !0 }) {
3445
3505
  }
3446
3506
  //#endregion
3447
3507
  //#region src/shortcodes.ts
3448
- var Jn = {
3508
+ var Xn = {
3449
3509
  "+1": "👍",
3450
3510
  thumbsup: "👍",
3451
3511
  "-1": "👎",
@@ -3639,13 +3699,13 @@ var Jn = {
3639
3699
  zzz: "💤",
3640
3700
  sweat_drops: "💦",
3641
3701
  dash: "💨"
3642
- }, Yn = /(```[\s\S]*?(?:```|$)|`[^`\n]*`?)/g, Xn = /:([a-z0-9_+-]+):/g, Zn = (e) => e.replace(Xn, (e, t) => Jn[t] ?? e);
3702
+ }, Zn = /(```[\s\S]*?(?:```|$)|`[^`\n]*`?)/g, Qn = /:([a-z0-9_+-]+):/g, $n = (e) => e.replace(Qn, (e, t) => Xn[t] ?? e);
3643
3703
  function $(e) {
3644
- return e.includes(":") ? e.split(Yn).map((e, t) => t % 2 ? e : Zn(e)).join("") : e;
3704
+ return e.includes(":") ? e.split(Zn).map((e, t) => t % 2 ? e : $n(e)).join("") : e;
3645
3705
  }
3646
3706
  //#endregion
3647
3707
  //#region src/components/EmojiPicker.tsx
3648
- var Qn = [
3708
+ var er = [
3649
3709
  {
3650
3710
  label: "Smileys",
3651
3711
  icon: "😀",
@@ -3676,7 +3736,7 @@ var Qn = [
3676
3736
  icon: "☕",
3677
3737
  emojis: "☕ 🍵 🥤 🍕 🍔 🍟 🌭 🥪 🌮 🍝 🍣 🍩 🍪 🍫 🍎 🍌 🍓 🥐 🚗 🚕 🚌 🚆 ✈️ 🚀 🏠 🏢 🏖️ 🌍 ☀️ 🌤️ 🌧️ ⛈️ ❄️ ⚡ 🌈 🌙"
3678
3738
  }
3679
- ], $n = [
3739
+ ], tr = [
3680
3740
  "👍",
3681
3741
  "❤️",
3682
3742
  "😂",
@@ -3684,7 +3744,7 @@ var Qn = [
3684
3744
  "😢",
3685
3745
  "🙏"
3686
3746
  ];
3687
- function er({ onPick: e, onClose: t, className: n = "" }) {
3747
+ function nr({ onPick: e, onClose: t, className: n = "" }) {
3688
3748
  let [r, a] = c(0), o = s(null);
3689
3749
  return i(() => {
3690
3750
  let e = (e) => o.current && !o.current.contains(e.target) && t(), n = (e) => {
@@ -3700,7 +3760,7 @@ function er({ onPick: e, onClose: t, className: n = "" }) {
3700
3760
  className: `ci-z-30 ci-w-[21rem] ci-max-w-full ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-select-none ${n}`,
3701
3761
  children: [/* @__PURE__ */ d("div", {
3702
3762
  className: "ci-flex ci-gap-1 ci-px-2 ci-pt-2 ci-border-b ci-border-gray-300 dark:ci-border-gray-700",
3703
- children: Qn.map((e, t) => /* @__PURE__ */ d("button", {
3763
+ children: er.map((e, t) => /* @__PURE__ */ d("button", {
3704
3764
  type: "button",
3705
3765
  title: e.label,
3706
3766
  "aria-label": e.label,
@@ -3714,7 +3774,7 @@ function er({ onPick: e, onClose: t, className: n = "" }) {
3714
3774
  }, e.label))
3715
3775
  }), /* @__PURE__ */ d("div", {
3716
3776
  className: "ci-grid ci-grid-cols-7 ci-gap-1 ci-p-2 ci-h-64 ci-overflow-y-auto",
3717
- children: Qn[r].emojis.split(" ").map((t) => /* @__PURE__ */ d("button", {
3777
+ children: er[r].emojis.split(" ").map((t) => /* @__PURE__ */ d("button", {
3718
3778
  type: "button",
3719
3779
  onClick: () => e(t),
3720
3780
  style: {
@@ -3729,27 +3789,27 @@ function er({ onPick: e, onClose: t, className: n = "" }) {
3729
3789
  }
3730
3790
  //#endregion
3731
3791
  //#region src/components/MessageList.tsx
3732
- var tr = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), nr = (e) => /\.(webm|ogg|oga|opus|mp3|m4a|wav)(\?|$)/i.test(e), rr = (e) => {
3792
+ var rr = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), ir = (e) => /\.(webm|ogg|oga|opus|mp3|m4a|wav)(\?|$)/i.test(e), ar = (e) => {
3733
3793
  let t = e.split("/").pop() || "file";
3734
3794
  try {
3735
3795
  return decodeURIComponent(t);
3736
3796
  } catch {
3737
3797
  return t;
3738
3798
  }
3739
- }, ir = (e) => {
3799
+ }, or = (e) => {
3740
3800
  try {
3741
3801
  return new URL(e).protocol === "https:";
3742
3802
  } catch {
3743
3803
  return !1;
3744
3804
  }
3745
- }, ar = (e) => new Date(e).toLocaleTimeString([], {
3805
+ }, sr = (e) => new Date(e).toLocaleTimeString([], {
3746
3806
  hour: "2-digit",
3747
3807
  minute: "2-digit"
3748
- }), or = (e) => new Date(e).toLocaleDateString([], {
3808
+ }), cr = (e) => new Date(e).toLocaleDateString([], {
3749
3809
  weekday: "short",
3750
3810
  day: "numeric",
3751
3811
  month: "short"
3752
- }), sr = (e, t) => new Date(e).toDateString() === new Date(t).toDateString(), cr = (e) => {
3812
+ }), lr = (e, t) => new Date(e).toDateString() === new Date(t).toDateString(), ur = (e) => {
3753
3813
  if (!e.startsWith("{\"")) return null;
3754
3814
  try {
3755
3815
  let t = JSON.parse(e);
@@ -3760,17 +3820,17 @@ var tr = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), nr = (e) => /\
3760
3820
  } catch {
3761
3821
  return null;
3762
3822
  }
3763
- }, lr = n(function({ url: e }) {
3764
- return ir(e) ? tr(e) ? /* @__PURE__ */ d("a", {
3823
+ }, dr = n(function({ url: e }) {
3824
+ return or(e) ? rr(e) ? /* @__PURE__ */ d("a", {
3765
3825
  href: e,
3766
3826
  target: "_blank",
3767
3827
  rel: "noreferrer",
3768
3828
  children: /* @__PURE__ */ d("img", {
3769
3829
  src: e,
3770
- alt: rr(e),
3830
+ alt: ar(e),
3771
3831
  className: "ci-max-w-full ci-max-h-60 ci-rounded-2xl ci-block"
3772
3832
  })
3773
- }) : nr(e) ? /* @__PURE__ */ d("audio", {
3833
+ }) : ir(e) ? /* @__PURE__ */ d("audio", {
3774
3834
  controls: !0,
3775
3835
  src: e,
3776
3836
  className: "ci-max-w-full"
@@ -3787,15 +3847,15 @@ var tr = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), nr = (e) => /\
3787
3847
  stroke: "currentColor",
3788
3848
  strokeWidth: "2",
3789
3849
  children: /* @__PURE__ */ d("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
3790
- }), rr(e)]
3850
+ }), ar(e)]
3791
3851
  }) : /* @__PURE__ */ d("span", {
3792
3852
  className: "ci-break-all",
3793
3853
  children: e
3794
3854
  });
3795
- }), ur = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*|__[^_\n]+__)|(~~[^~\n]+~~)|(\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_)|\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<]+)/g;
3796
- function dr({ text: e }) {
3855
+ }), fr = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*|__[^_\n]+__)|(~~[^~\n]+~~)|(\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_)|\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<]+)/g;
3856
+ function pr({ text: e }) {
3797
3857
  let t = [], n = 0;
3798
- for (let r of e.matchAll(ur)) {
3858
+ for (let r of e.matchAll(fr)) {
3799
3859
  let i = r[0], a = r.index ?? 0;
3800
3860
  a > n && t.push($(e.slice(n, a))), r[1] ? t.push(/* @__PURE__ */ d("code", {
3801
3861
  className: "ci-px-1 ci-py-0.5 ci-rounded ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-[0.85em]",
@@ -3816,17 +3876,17 @@ function dr({ text: e }) {
3816
3876
  }
3817
3877
  return n < e.length && t.push($(e.slice(n))), /* @__PURE__ */ d(u, { children: t });
3818
3878
  }
3819
- var fr = n(function({ text: e }) {
3879
+ var mr = n(function({ text: e }) {
3820
3880
  let t = e.split(/```[^\n]*\n?([\s\S]*?)```/g);
3821
3881
  return /* @__PURE__ */ d("span", {
3822
3882
  className: "ci-whitespace-pre-wrap ci-break-words",
3823
3883
  children: t.map((e, t) => t % 2 ? /* @__PURE__ */ d("pre", {
3824
3884
  className: "ci-my-1 ci-p-2 ci-rounded-xl ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-xs ci-overflow-x-auto ci-whitespace-pre",
3825
3885
  children: e.replace(/\n$/, "")
3826
- }, t) : /* @__PURE__ */ d(dr, { text: e.replace(/^(\s*)[-*] (?=\S)/gm, "$1• ") }, t))
3886
+ }, t) : /* @__PURE__ */ d(pr, { text: e.replace(/^(\s*)[-*] (?=\S)/gm, "$1• ") }, t))
3827
3887
  });
3828
3888
  });
3829
- function pr({ text: e, count: t }) {
3889
+ function hr({ text: e, count: t }) {
3830
3890
  return /* @__PURE__ */ f("span", {
3831
3891
  className: "ci-italic ci-opacity-80",
3832
3892
  children: [
@@ -3839,7 +3899,7 @@ function pr({ text: e, count: t }) {
3839
3899
  ]
3840
3900
  });
3841
3901
  }
3842
- function mr({ forMsg: e, me: t, onReact: n, nameOf: r, mine: i }) {
3902
+ function gr({ forMsg: e, me: t, onReact: n, nameOf: r, mine: i }) {
3843
3903
  if (!e) return null;
3844
3904
  let a = /* @__PURE__ */ new Map();
3845
3905
  for (let [t, n] of Object.entries(e)) for (let e of n) a.set(e, [...a.get(e) ?? [], t]);
@@ -3864,33 +3924,57 @@ function mr({ forMsg: e, me: t, onReact: n, nameOf: r, mine: i }) {
3864
3924
  })
3865
3925
  }) : null;
3866
3926
  }
3867
- function hr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, reactions: o, me: l = "", onReact: u }) {
3868
- let p = J((e) => e.contacts), m = s(null), h = s(!0), [g, _] = c(null), [v, y] = c(null), b = (e) => p[e]?.name ?? e;
3927
+ function _r({ reply: e, messages: t, mine: n, name: r }) {
3928
+ let i = t.find((t) => t.oid === e.id), a = i ? i.oob ? "Attachment" : i.body : e.quote?.replace(/^[^:]*: /, "") ?? "", o = (t) => {
3929
+ t.stopPropagation();
3930
+ let n = document.querySelector(`.chat-island-root [data-oid="${CSS.escape(e.id)}"]`);
3931
+ n && (n.scrollIntoView({
3932
+ block: "center",
3933
+ behavior: "smooth"
3934
+ }), n.animate([{ opacity: .4 }, { opacity: 1 }], { duration: 900 }));
3935
+ };
3936
+ return /* @__PURE__ */ f("div", {
3937
+ role: "button",
3938
+ tabIndex: 0,
3939
+ onClick: o,
3940
+ onKeyDown: (e) => e.key === "Enter" && o(e),
3941
+ className: `ci-mb-1.5 ci-px-2.5 ci-py-1 ci-rounded-xl ci-cursor-pointer ci-border-0 ci-border-l-4 ci-border-solid ci-text-xs ${n ? "ci-bg-black/20 dark:ci-bg-black/10 ci-border-gray-400 dark:ci-border-gray-600" : "ci-bg-black/5 dark:ci-bg-white/10 ci-border-iconSecondary dark:ci-border-iconSecondaryDark"}`,
3942
+ children: [/* @__PURE__ */ d("div", {
3943
+ className: "ci-font-medium",
3944
+ children: r(e.author)
3945
+ }), /* @__PURE__ */ d("div", {
3946
+ className: "ci-line-clamp-2 ci-break-words ci-opacity-80",
3947
+ children: a
3948
+ })]
3949
+ });
3950
+ }
3951
+ function vr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, reactions: o, me: l = "", onReact: u, onReply: p }) {
3952
+ let m = J((e) => e.contacts), h = s(null), g = s(!0), [_, v] = c(null), [y, b] = c(null), x = (e) => m[e]?.name ?? e;
3869
3953
  i(() => {
3870
- let e = m.current;
3871
- e && h.current && (e.scrollTop = e.scrollHeight);
3954
+ let e = h.current;
3955
+ e && g.current && (e.scrollTop = e.scrollHeight);
3872
3956
  }, [
3873
3957
  e.length,
3874
3958
  t,
3875
3959
  o
3876
3960
  ]), i(() => {
3877
- if (!g) return;
3878
- let e = () => _(null), t = window.setTimeout(() => document.addEventListener("click", e, { once: !0 }), 0);
3961
+ if (!_) return;
3962
+ let e = () => v(null), t = window.setTimeout(() => document.addEventListener("click", e, { once: !0 }), 0);
3879
3963
  return () => {
3880
3964
  window.clearTimeout(t), document.removeEventListener("click", e);
3881
3965
  };
3882
- }, [g]);
3883
- let x = () => {
3884
- let e = m.current;
3885
- e && (h.current = e.scrollHeight - e.scrollTop - e.clientHeight < 40, e.scrollTop < 30 && r && n());
3886
- }, S = (e, t) => {
3887
- _(null), y(null), u?.(e, t);
3966
+ }, [_]);
3967
+ let S = () => {
3968
+ let e = h.current;
3969
+ e && (g.current = e.scrollHeight - e.scrollTop - e.clientHeight < 40, e.scrollTop < 30 && r && n());
3970
+ }, C = (e, t) => {
3971
+ v(null), b(null), u?.(e, t);
3888
3972
  };
3889
3973
  return /* @__PURE__ */ f("div", {
3890
3974
  className: "ci-relative ci-flex-1 ci-min-h-0 ci-flex ci-flex-col",
3891
3975
  children: [/* @__PURE__ */ f("div", {
3892
- ref: m,
3893
- onScroll: x,
3976
+ ref: h,
3977
+ onScroll: S,
3894
3978
  className: "ci-flex-1 ci-overflow-y-auto ci-px-4 ci-py-2 ci-space-y-1",
3895
3979
  children: [
3896
3980
  r && /* @__PURE__ */ d("div", {
@@ -3898,90 +3982,110 @@ function hr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
3898
3982
  children: "Scroll up for older messages"
3899
3983
  }),
3900
3984
  e.map((t, n) => {
3901
- let r = e[n - 1], i = !r || !sr(r.ts, t.ts), s = r && !i && r.mine === t.mine && r.nick === t.nick && t.ts - r.ts < 12e4, c = a && !t.mine && t.nick ? b(t.nick) : null, m = t.oid, h = !!u && !!m && !t.pending, v = h && /* @__PURE__ */ d("button", {
3985
+ let r = e[n - 1], i = !r || !lr(r.ts, t.ts), s = r && !i && r.mine === t.mine && r.nick === t.nick && t.ts - r.ts < 12e4, c = a && !t.mine && t.nick ? x(t.nick) : null, h = t.oid, g = !!u && !!h && !t.pending, y = g && /* @__PURE__ */ d("button", {
3902
3986
  type: "button",
3903
3987
  title: "React",
3904
3988
  "aria-label": "React to this message",
3905
3989
  onClick: (e) => {
3906
- e.stopPropagation(), _(g === m ? null : m);
3990
+ e.stopPropagation(), v(_ === h ? null : h);
3907
3991
  },
3908
- className: `ci-self-center ci-h-7 ci-w-7 ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-gray-500 dark:ci-text-gray-400 hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800 focus:ci-opacity-100 ${g === m ? "ci-opacity-100" : "ci-opacity-0 group-hover:ci-opacity-100"}`,
3992
+ className: `ci-self-center ci-h-7 ci-w-7 ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-gray-500 dark:ci-text-gray-400 hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800 focus:ci-opacity-100 ${_ === h ? "ci-opacity-100" : "ci-opacity-0 group-hover:ci-opacity-100"}`,
3909
3993
  children: Q.react
3994
+ }), S = !!p && !!h && !t.pending && /* @__PURE__ */ d("button", {
3995
+ type: "button",
3996
+ title: "Reply",
3997
+ "aria-label": "Reply to this message",
3998
+ onClick: (e) => {
3999
+ e.stopPropagation(), p(t);
4000
+ },
4001
+ className: "ci-self-center ci-h-7 ci-w-7 ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-gray-500 dark:ci-text-gray-400 hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800 focus:ci-opacity-100 ci-opacity-0 group-hover:ci-opacity-100",
4002
+ children: Q.reply
3910
4003
  });
3911
- return /* @__PURE__ */ f("div", { children: [i && /* @__PURE__ */ d("div", {
3912
- className: "ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-2",
3913
- children: or(t.ts)
3914
- }), /* @__PURE__ */ f("div", {
3915
- className: `ci-group ci-flex ci-items-start ci-gap-1.5 ${t.mine ? "ci-justify-end" : "ci-justify-start"} ${s ? "ci-mt-0.5" : "ci-mt-2"}`,
3916
- children: [
3917
- c && /* @__PURE__ */ d("span", {
3918
- className: "ci-w-7 ci-shrink-0",
3919
- title: c,
3920
- children: !s && /* @__PURE__ */ d(Hn, {
3921
- contact: p[t.nick],
3922
- username: t.nick,
3923
- size: 28
3924
- })
3925
- }),
3926
- t.mine && v,
3927
- /* @__PURE__ */ f("div", {
3928
- className: `ci-relative ci-flex ci-flex-col ci-max-w-[80%] ${t.mine ? "ci-items-end" : "ci-items-start"}`,
3929
- children: [
3930
- g === m && m && /* @__PURE__ */ f("div", {
3931
- role: "menu",
3932
- onClick: (e) => e.stopPropagation(),
3933
- className: `ci-absolute ci-bottom-full ci-mb-1 ci-z-20 ci-flex ci-items-center ci-gap-0.5 ci-p-1 ci-rounded-full ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ${t.mine ? "ci-right-0" : "ci-left-0"}`,
3934
- children: [$n.map((e) => /* @__PURE__ */ d("button", {
3935
- type: "button",
3936
- role: "menuitem",
3937
- "aria-label": e,
3938
- onClick: () => S(m, e),
3939
- style: {
3940
- fontSize: 22,
3941
- lineHeight: "32px"
3942
- },
3943
- className: `ci-h-9 ci-w-9 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 hover:ci-scale-125 ci-transition-transform ${o?.[m]?.[l]?.includes(e) ? "ci-bg-gray-200 dark:ci-bg-gray-800" : "ci-bg-transparent"}`,
3944
- children: e
3945
- }, e)), /* @__PURE__ */ d("button", {
3946
- type: "button",
3947
- role: "menuitem",
3948
- title: "More emojis",
3949
- "aria-label": "More emojis",
3950
- onClick: () => {
3951
- _(null), y(m);
3952
- },
3953
- className: "ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-gray-200 dark:ci-bg-gray-800 ci-text-gray-700 dark:ci-text-gray-200 ci-text-lg",
3954
- children: "+"
3955
- })]
3956
- }),
3957
- /* @__PURE__ */ f("div", {
3958
- title: ar(t.ts),
3959
- onDoubleClick: () => h && S(m, $n[0]),
3960
- className: `ci-px-3.5 ci-py-2 ci-rounded-3xl ci-text-sm ci-select-text ci-cursor-text ${t.mine ? "ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-rounded-br-lg" : "ci-bg-elevationL2 ci-text-gray-900 dark:ci-bg-elevationL2Dark dark:ci-text-white ci-rounded-bl-lg"} ${t.pending ? "ci-opacity-60" : ""}`,
3961
- children: [
3962
- t.oob ? /* @__PURE__ */ d(lr, { url: t.oob }) : cr(t.body) ? /* @__PURE__ */ d(pr, { ...cr(t.body) }) : /* @__PURE__ */ d(fr, { text: t.body }),
3963
- t.oob && t.body && t.body !== t.oob && t.body !== rr(t.oob) && /* @__PURE__ */ d("div", {
3964
- className: "ci-text-xs ci-opacity-80 ci-mt-1",
3965
- children: t.body
3966
- }),
3967
- /* @__PURE__ */ d("span", {
3968
- className: "ci-block ci-text-right ci-text-[10px] ci-leading-none ci-opacity-60 ci-mt-1",
3969
- children: ar(t.ts)
3970
- })
3971
- ]
3972
- }),
3973
- m && /* @__PURE__ */ d(mr, {
3974
- forMsg: o?.[m],
3975
- me: l,
3976
- mine: t.mine,
3977
- nameOf: b,
3978
- onReact: (e) => h && S(m, e)
4004
+ return /* @__PURE__ */ f("div", {
4005
+ "data-oid": t.oid,
4006
+ children: [i && /* @__PURE__ */ d("div", {
4007
+ className: "ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-2",
4008
+ children: cr(t.ts)
4009
+ }), /* @__PURE__ */ f("div", {
4010
+ className: `ci-group ci-flex ci-items-start ci-gap-1.5 ${t.mine ? "ci-justify-end" : "ci-justify-start"} ${s ? "ci-mt-0.5" : "ci-mt-2"}`,
4011
+ children: [
4012
+ c && /* @__PURE__ */ d("span", {
4013
+ className: "ci-w-7 ci-shrink-0",
4014
+ title: c,
4015
+ children: !s && /* @__PURE__ */ d(Wn, {
4016
+ contact: m[t.nick],
4017
+ username: t.nick,
4018
+ size: 28
3979
4019
  })
3980
- ]
3981
- }),
3982
- !t.mine && v
3983
- ]
3984
- })] }, t.id);
4020
+ }),
4021
+ t.mine && S,
4022
+ t.mine && y,
4023
+ /* @__PURE__ */ f("div", {
4024
+ className: `ci-relative ci-flex ci-flex-col ci-max-w-[80%] ${t.mine ? "ci-items-end" : "ci-items-start"}`,
4025
+ children: [
4026
+ _ === h && h && /* @__PURE__ */ f("div", {
4027
+ role: "menu",
4028
+ onClick: (e) => e.stopPropagation(),
4029
+ className: `ci-absolute ci-bottom-full ci-mb-1 ci-z-20 ci-flex ci-items-center ci-gap-0.5 ci-p-1 ci-rounded-full ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ${t.mine ? "ci-right-0" : "ci-left-0"}`,
4030
+ children: [tr.map((e) => /* @__PURE__ */ d("button", {
4031
+ type: "button",
4032
+ role: "menuitem",
4033
+ "aria-label": e,
4034
+ onClick: () => C(h, e),
4035
+ style: {
4036
+ fontSize: 22,
4037
+ lineHeight: "32px"
4038
+ },
4039
+ className: `ci-h-9 ci-w-9 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 hover:ci-scale-125 ci-transition-transform ${o?.[h]?.[l]?.includes(e) ? "ci-bg-gray-200 dark:ci-bg-gray-800" : "ci-bg-transparent"}`,
4040
+ children: e
4041
+ }, e)), /* @__PURE__ */ d("button", {
4042
+ type: "button",
4043
+ role: "menuitem",
4044
+ title: "More emojis",
4045
+ "aria-label": "More emojis",
4046
+ onClick: () => {
4047
+ v(null), b(h);
4048
+ },
4049
+ className: "ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-gray-200 dark:ci-bg-gray-800 ci-text-gray-700 dark:ci-text-gray-200 ci-text-lg",
4050
+ children: "+"
4051
+ })]
4052
+ }),
4053
+ /* @__PURE__ */ f("div", {
4054
+ title: sr(t.ts),
4055
+ onDoubleClick: () => g && C(h, tr[0]),
4056
+ className: `ci-px-3.5 ci-py-2 ci-rounded-3xl ci-text-sm ci-select-text ci-cursor-text ${t.mine ? "ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-rounded-br-lg" : "ci-bg-elevationL2 ci-text-gray-900 dark:ci-bg-elevationL2Dark dark:ci-text-white ci-rounded-bl-lg"} ${t.pending ? "ci-opacity-60" : ""}`,
4057
+ children: [
4058
+ t.reply && /* @__PURE__ */ d(_r, {
4059
+ reply: t.reply,
4060
+ messages: e,
4061
+ mine: t.mine,
4062
+ name: (e) => e === l ? "You" : x(e)
4063
+ }),
4064
+ t.oob ? /* @__PURE__ */ d(dr, { url: t.oob }) : ur(t.body) ? /* @__PURE__ */ d(hr, { ...ur(t.body) }) : /* @__PURE__ */ d(mr, { text: t.body }),
4065
+ t.oob && t.body && t.body !== t.oob && t.body !== ar(t.oob) && /* @__PURE__ */ d("div", {
4066
+ className: "ci-text-xs ci-opacity-80 ci-mt-1",
4067
+ children: t.body
4068
+ }),
4069
+ /* @__PURE__ */ d("span", {
4070
+ className: "ci-block ci-text-right ci-text-[10px] ci-leading-none ci-opacity-60 ci-mt-1",
4071
+ children: sr(t.ts)
4072
+ })
4073
+ ]
4074
+ }),
4075
+ h && /* @__PURE__ */ d(gr, {
4076
+ forMsg: o?.[h],
4077
+ me: l,
4078
+ mine: t.mine,
4079
+ nameOf: x,
4080
+ onReact: (e) => g && C(h, e)
4081
+ })
4082
+ ]
4083
+ }),
4084
+ !t.mine && y,
4085
+ !t.mine && S
4086
+ ]
4087
+ })]
4088
+ }, t.id);
3985
4089
  }),
3986
4090
  t && /* @__PURE__ */ d("div", {
3987
4091
  className: "ci-flex ci-justify-start ci-mt-2",
@@ -3991,16 +4095,16 @@ function hr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
3991
4095
  })
3992
4096
  })
3993
4097
  ]
3994
- }), v && /* @__PURE__ */ d(er, {
4098
+ }), y && /* @__PURE__ */ d(nr, {
3995
4099
  className: "ci-absolute ci-bottom-2 ci-left-1/2 ci--translate-x-1/2",
3996
- onPick: (e) => S(v, e),
3997
- onClose: () => y(null)
4100
+ onPick: (e) => C(y, e),
4101
+ onClose: () => b(null)
3998
4102
  })]
3999
4103
  });
4000
4104
  }
4001
4105
  //#endregion
4002
4106
  //#region src/ogg.ts
4003
- function gr(e, t, n) {
4107
+ function yr(e, t, n) {
4004
4108
  let r = e[t];
4005
4109
  if (r === void 0) return null;
4006
4110
  let i = 1;
@@ -4014,7 +4118,7 @@ function gr(e, t, n) {
4014
4118
  unknown: !n && o
4015
4119
  };
4016
4120
  }
4017
- var _r = /* @__PURE__ */ new Set([
4121
+ var br = /* @__PURE__ */ new Set([
4018
4122
  408125543,
4019
4123
  524531317,
4020
4124
  374648427,
@@ -4022,18 +4126,18 @@ var _r = /* @__PURE__ */ new Set([
4022
4126
  225,
4023
4127
  160
4024
4128
  ]);
4025
- function vr(e) {
4129
+ function xr(e) {
4026
4130
  let t = {
4027
4131
  channels: 1,
4028
4132
  packets: []
4029
4133
  }, n = 0;
4030
4134
  for (; n < e.length;) {
4031
- let r = gr(e, n, !0);
4135
+ let r = yr(e, n, !0);
4032
4136
  if (!r) break;
4033
- let i = gr(e, n + r.len, !1);
4137
+ let i = yr(e, n + r.len, !1);
4034
4138
  if (!i) break;
4035
4139
  let a = n + r.len + i.len;
4036
- if (_r.has(r.value)) {
4140
+ if (br.has(r.value)) {
4037
4141
  n = a;
4038
4142
  continue;
4039
4143
  }
@@ -4042,14 +4146,14 @@ function vr(e) {
4042
4146
  if (r.value === 25506) t.head = e.slice(a, o);
4043
4147
  else if (r.value === 159) t.channels = e[a] || 1;
4044
4148
  else if (r.value === 163 || r.value === 161) {
4045
- let n = gr(e, a, !1);
4149
+ let n = yr(e, a, !1);
4046
4150
  n && (e[a + n.len + 2] >> 1 & 3 || t.packets.push(e.slice(a + n.len + 3, o)));
4047
4151
  }
4048
4152
  n = o;
4049
4153
  }
4050
4154
  return t;
4051
4155
  }
4052
- function yr(e) {
4156
+ function Sr(e) {
4053
4157
  if (!e.length) return 0;
4054
4158
  let t = e[0], n = t >> 3, r;
4055
4159
  r = n < 12 ? [
@@ -4066,7 +4170,7 @@ function yr(e) {
4066
4170
  let i = t & 3, a = i === 0 ? 1 : i === 3 ? (e[1] ?? 0) & 63 : 2;
4067
4171
  return Math.round(a * r * 48);
4068
4172
  }
4069
- var br = (() => {
4173
+ var Cr = (() => {
4070
4174
  let e = /* @__PURE__ */ new Uint32Array(256);
4071
4175
  for (let t = 0; t < 256; t++) {
4072
4176
  let n = t << 24;
@@ -4075,12 +4179,12 @@ var br = (() => {
4075
4179
  }
4076
4180
  return e;
4077
4181
  })();
4078
- function xr(e) {
4182
+ function wr(e) {
4079
4183
  let t = 0;
4080
- for (let n = 0; n < e.length; n++) t = (t << 8 ^ br[(t >>> 24 ^ e[n]) & 255]) >>> 0;
4184
+ for (let n = 0; n < e.length; n++) t = (t << 8 ^ Cr[(t >>> 24 ^ e[n]) & 255]) >>> 0;
4081
4185
  return t;
4082
4186
  }
4083
- function Sr(e, t, n, r, i) {
4187
+ function Tr(e, t, n, r, i) {
4084
4188
  let a = [];
4085
4189
  for (let t of e) {
4086
4190
  let e = t.length;
@@ -4096,29 +4200,29 @@ function Sr(e, t, n, r, i) {
4096
4200
  ], 0), s[5] = i, c.setUint32(6, t % 4294967296, !0), c.setUint32(10, Math.floor(t / 4294967296), !0), c.setUint32(14, n, !0), c.setUint32(18, r, !0), s[26] = a.length, s.set(a, 27);
4097
4201
  let l = 27 + a.length;
4098
4202
  for (let t of e) s.set(t, l), l += t.length;
4099
- return c.setUint32(22, xr(s), !0), s;
4203
+ return c.setUint32(22, wr(s), !0), s;
4100
4204
  }
4101
- function Cr(e) {
4205
+ function Er(e) {
4102
4206
  let t = /* @__PURE__ */ new Uint8Array(19), n = new DataView(t.buffer);
4103
4207
  return t.set(new TextEncoder().encode("OpusHead"), 0), t[8] = 1, t[9] = e, n.setUint16(10, 312, !0), n.setUint32(12, 48e3, !0), t;
4104
4208
  }
4105
- function wr() {
4209
+ function Dr() {
4106
4210
  let e = new TextEncoder().encode("chat-island"), t = new Uint8Array(12 + e.length + 4);
4107
4211
  return t.set(new TextEncoder().encode("OpusTags"), 0), new DataView(t.buffer).setUint32(8, e.length, !0), t.set(e, 12), t;
4108
4212
  }
4109
- function Tr(e) {
4110
- let { head: t, channels: n, packets: r } = vr(e);
4213
+ function Or(e) {
4214
+ let { head: t, channels: n, packets: r } = xr(e);
4111
4215
  if (!r.length) return null;
4112
- let i = t && t.length >= 19 && new TextDecoder().decode(t.slice(0, 8)) === "OpusHead", a = Math.random() * 4294967295 >>> 0, o = [Sr([i ? t : Cr(n)], 0, a, 0, 2), Sr([wr()], 0, a, 1, 0)], s = 0, c = 2;
4216
+ let i = t && t.length >= 19 && new TextDecoder().decode(t.slice(0, 8)) === "OpusHead", a = Math.random() * 4294967295 >>> 0, o = [Tr([i ? t : Er(n)], 0, a, 0, 2), Tr([Dr()], 0, a, 1, 0)], s = 0, c = 2;
4113
4217
  for (let e = 0; e < r.length;) {
4114
4218
  let t = [], n = 0;
4115
4219
  for (; e < r.length && t.length < 50;) {
4116
4220
  let i = Math.floor(r[e].length / 255) + 1;
4117
4221
  if (n + i > 255) break;
4118
- t.push(r[e]), n += i, s += yr(r[e]), e++;
4222
+ t.push(r[e]), n += i, s += Sr(r[e]), e++;
4119
4223
  }
4120
4224
  if (!t.length) return null;
4121
- o.push(Sr(t, s, a, c++, e >= r.length ? 4 : 0));
4225
+ o.push(Tr(t, s, a, c++, e >= r.length ? 4 : 0));
4122
4226
  }
4123
4227
  let l = o.reduce((e, t) => e + t.length, 0), u = new Uint8Array(l), d = 0;
4124
4228
  for (let e of o) u.set(e, d), d += e.length;
@@ -4126,98 +4230,100 @@ function Tr(e) {
4126
4230
  }
4127
4231
  //#endregion
4128
4232
  //#region src/components/Composer.tsx
4129
- var Er = [
4233
+ var kr = [
4130
4234
  "audio/ogg;codecs=opus",
4131
4235
  "audio/webm;codecs=opus",
4132
4236
  "audio/mp4",
4133
4237
  "audio/webm"
4134
4238
  ];
4135
- async function Dr(e, t) {
4239
+ async function Ar(e, t) {
4136
4240
  let n = Date.now();
4137
4241
  if (/webm/.test(t) && /opus/.test(t)) try {
4138
- let t = Tr(new Uint8Array(await new Blob(e).arrayBuffer()));
4242
+ let t = Or(new Uint8Array(await new Blob(e).arrayBuffer()));
4139
4243
  if (t) return new File([t], `voice-${n}.ogg`, { type: "audio/ogg" });
4140
4244
  } catch {}
4141
- return new File(e, `voice-${n}.${Or(t)}`, { type: t.split(";")[0] });
4245
+ return new File(e, `voice-${n}.${jr(t)}`, { type: t.split(";")[0] });
4142
4246
  }
4143
- var Or = (e) => /mp4/.test(e) ? "m4a" : /ogg/.test(e) ? "ogg" : "webm", kr = (e) => `${Math.floor(e / 6e4)}:${String(Math.floor(e % 6e4 / 1e3)).padStart(2, "0")}`;
4144
- function Ar({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4145
- let [o, l] = c(""), [u, p] = c(!1), m = s(null), h = s(null), g = s(null), _ = s(), v = s(!1), [y, b] = c(null), [x, S] = c(0), C = s(!1), w = s(!1), T = s(!1), E = s({});
4146
- i(() => g.current?.focus(), []), i(() => () => {
4147
- T.current = !0, C.current = !0, window.clearTimeout(_.current);
4247
+ var jr = (e) => /mp4/.test(e) ? "m4a" : /ogg/.test(e) ? "ogg" : "webm", Mr = (e) => `${Math.floor(e / 6e4)}:${String(Math.floor(e % 6e4 / 1e3)).padStart(2, "0")}`;
4248
+ function Nr({ onSend: e, onTyping: t, onFile: n, disabled: r, focusKey: o }) {
4249
+ let [l, u] = c(""), [p, m] = c(!1), h = s(null), g = s(null), _ = s(null), v = s(), y = s(!1), [b, x] = c(null), [S, C] = c(0), w = s(!1), T = s(!1), ee = s(!1), E = s({});
4250
+ i(() => _.current?.focus(), []), i(() => () => {
4251
+ ee.current = !0, w.current = !0, window.clearTimeout(v.current);
4148
4252
  let { r: e, stream: t } = E.current;
4149
4253
  e && e.state !== "inactive" && e.stop(), t?.getTracks().forEach((e) => e.stop()), E.current = {};
4150
4254
  }, []), i(() => {
4151
- if (!y) return;
4152
- let e = window.setInterval(() => S(Date.now() - y.since), 250);
4255
+ if (!b) return;
4256
+ let e = window.setInterval(() => C(Date.now() - b.since), 250);
4153
4257
  return () => window.clearInterval(e);
4154
- }, [y]);
4258
+ }, [b]), i(() => {
4259
+ o && _.current?.focus();
4260
+ }, [o]);
4155
4261
  let D = (e) => {
4156
- v.current !== e && (v.current = e, t(e));
4262
+ y.current !== e && (y.current = e, t(e));
4157
4263
  }, O = (e) => {
4158
4264
  let t = e.includes(":") ? $(e) : e;
4159
- t !== e && (m.current = Math.max(0, (g.current?.selectionStart ?? e.length) - (e.length - t.length))), l(t), t ? (D(!0), window.clearTimeout(_.current), _.current = window.setTimeout(() => D(!1), 4e3)) : D(!1);
4265
+ t !== e && (h.current = Math.max(0, (_.current?.selectionStart ?? e.length) - (e.length - t.length))), u(t), t ? (D(!0), window.clearTimeout(v.current), v.current = window.setTimeout(() => D(!1), 4e3)) : D(!1);
4160
4266
  };
4161
4267
  a(() => {
4162
- m.current !== null && (g.current?.setSelectionRange(m.current, m.current), m.current = null);
4163
- }, [o]);
4164
- let ee = (e) => {
4165
- let t = g.current, n = t?.selectionStart ?? o.length, r = t?.selectionEnd ?? n;
4166
- O(o.slice(0, n) + e + o.slice(r)), requestAnimationFrame(() => {
4268
+ h.current !== null && (_.current?.setSelectionRange(h.current, h.current), h.current = null);
4269
+ }, [l]);
4270
+ let k = (e) => {
4271
+ let t = _.current, n = t?.selectionStart ?? l.length, r = t?.selectionEnd ?? n;
4272
+ O(l.slice(0, n) + e + l.slice(r)), requestAnimationFrame(() => {
4167
4273
  t?.focus(), t?.setSelectionRange(n + e.length, n + e.length);
4168
4274
  });
4169
- }, k = () => {
4170
- let t = o.trim();
4171
- t && (l(""), Promise.resolve(e(t)).catch(() => l((e) => e || t)), window.clearTimeout(_.current), v.current = !1);
4172
- }, te = async () => {
4173
- if (w.current || y) return;
4174
- w.current = !0;
4275
+ }, te = () => {
4276
+ let t = l.trim();
4277
+ t && (u(""), Promise.resolve(e(t)).catch(() => u((e) => e || t)), window.clearTimeout(v.current), y.current = !1);
4278
+ }, A = async () => {
4279
+ if (T.current || b) return;
4280
+ T.current = !0;
4175
4281
  let e;
4176
4282
  try {
4177
4283
  e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
4178
4284
  let t = e;
4179
- if (T.current) {
4285
+ if (ee.current) {
4180
4286
  t.getTracks().forEach((e) => e.stop());
4181
4287
  return;
4182
4288
  }
4183
- let r = Er.find((e) => MediaRecorder.isTypeSupported(e)), i = new MediaRecorder(e, r ? { mimeType: r } : void 0), a = [];
4289
+ let r = kr.find((e) => MediaRecorder.isTypeSupported(e)), i = new MediaRecorder(e, r ? { mimeType: r } : void 0), a = [];
4184
4290
  i.ondataavailable = (e) => e.data.size && a.push(e.data), i.onstop = () => {
4185
- t.getTracks().forEach((e) => e.stop()), E.current = {}, b(null), !C.current && a.length && Dr(a, i.mimeType || r || "").then(n);
4186
- }, C.current = !1, i.start(), E.current = {
4291
+ t.getTracks().forEach((e) => e.stop()), E.current = {}, x(null), !w.current && a.length && Ar(a, i.mimeType || r || "").then(n);
4292
+ }, w.current = !1, i.start(), E.current = {
4187
4293
  r: i,
4188
4294
  stream: t
4189
- }, S(0), b({
4295
+ }, C(0), x({
4190
4296
  r: i,
4191
4297
  since: Date.now()
4192
4298
  });
4193
4299
  } catch {
4194
4300
  e?.getTracks().forEach((e) => e.stop());
4195
4301
  } finally {
4196
- w.current = !1;
4302
+ T.current = !1;
4197
4303
  }
4198
- }, A = (e) => {
4199
- C.current = e, y?.r.stop();
4304
+ }, j = (e) => {
4305
+ w.current = e, b?.r.stop();
4200
4306
  };
4201
- return y ? /* @__PURE__ */ f("div", {
4307
+ return b ? /* @__PURE__ */ f("div", {
4202
4308
  className: "ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3",
4203
4309
  children: [
4204
4310
  /* @__PURE__ */ d(Z, {
4205
4311
  variant: "transparent",
4206
4312
  title: "Discard",
4207
4313
  "aria-label": "Discard",
4208
- onClick: () => A(!0),
4314
+ onClick: () => j(!0),
4209
4315
  className: "ci-h-10 ci-w-10",
4210
4316
  children: Q.close
4211
4317
  }),
4212
4318
  /* @__PURE__ */ f("div", {
4213
4319
  className: "ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2.5 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm",
4214
- children: [/* @__PURE__ */ d("span", { className: "ci-w-2.5 ci-h-2.5 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-animate-pulse" }), /* @__PURE__ */ f("span", { children: ["Recording ", kr(x)] })]
4320
+ children: [/* @__PURE__ */ d("span", { className: "ci-w-2.5 ci-h-2.5 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-animate-pulse" }), /* @__PURE__ */ f("span", { children: ["Recording ", Mr(S)] })]
4215
4321
  }),
4216
4322
  /* @__PURE__ */ d(Z, {
4217
4323
  variant: "green",
4218
4324
  title: "Send voice note",
4219
4325
  "aria-label": "Send voice note",
4220
- onClick: () => A(!1),
4326
+ onClick: () => j(!1),
4221
4327
  className: "ci-h-10 ci-w-10",
4222
4328
  children: Q.send
4223
4329
  })
@@ -4225,13 +4331,13 @@ function Ar({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4225
4331
  }) : /* @__PURE__ */ f("div", {
4226
4332
  className: "ci-relative ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3",
4227
4333
  children: [
4228
- u && /* @__PURE__ */ d(er, {
4334
+ p && /* @__PURE__ */ d(nr, {
4229
4335
  className: "ci-absolute ci-bottom-full ci-left-3 ci-mb-1",
4230
- onPick: ee,
4231
- onClose: () => p(!1)
4336
+ onPick: k,
4337
+ onClose: () => m(!1)
4232
4338
  }),
4233
4339
  /* @__PURE__ */ d("input", {
4234
- ref: h,
4340
+ ref: g,
4235
4341
  type: "file",
4236
4342
  hidden: !0,
4237
4343
  onChange: (e) => e.target.files?.[0] && (n(e.target.files[0]), e.target.value = "")
@@ -4240,7 +4346,7 @@ function Ar({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4240
4346
  variant: "transparent",
4241
4347
  disabled: r,
4242
4348
  title: "Attach a file",
4243
- onClick: () => h.current?.click(),
4349
+ onClick: () => g.current?.click(),
4244
4350
  className: "ci-h-10 ci-w-10",
4245
4351
  children: Q.clip
4246
4352
  }),
@@ -4251,36 +4357,36 @@ function Ar({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4251
4357
  disabled: r,
4252
4358
  title: "Emoji",
4253
4359
  "aria-label": "Emoji",
4254
- "aria-expanded": u,
4255
- onClick: () => p((e) => !e),
4360
+ "aria-expanded": p,
4361
+ onClick: () => m((e) => !e),
4256
4362
  className: "ci-absolute ci-left-2 ci-bottom-1 ci-z-10 ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark hover:ci-bg-gray-300/70 dark:hover:ci-bg-gray-700/30 disabled:ci-opacity-40",
4257
4363
  children: Q.smile
4258
4364
  }), /* @__PURE__ */ d("textarea", {
4259
- ref: g,
4260
- value: o,
4365
+ ref: _,
4366
+ value: l,
4261
4367
  disabled: r,
4262
4368
  rows: 1,
4263
4369
  placeholder: r ? "Connecting…" : "Write a message",
4264
4370
  onChange: (e) => O(e.target.value),
4265
4371
  onKeyDown: (e) => {
4266
- let t = (o.match(/```/g) ?? []).length % 2 == 1;
4267
- e.key === "Enter" && !e.shiftKey && !t && (e.preventDefault(), k());
4372
+ let t = (l.match(/```/g) ?? []).length % 2 == 1;
4373
+ e.key === "Enter" && !e.shiftKey && !t && (e.preventDefault(), te());
4268
4374
  },
4269
4375
  className: "ci-block ci-w-full ci-resize-none ci-max-h-32 ci-pl-11 ci-pr-4 ci-py-2.5 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-sm",
4270
- style: { height: Math.min(128, 40 + 20 * (o.split("\n").length - 1)) }
4376
+ style: { height: Math.min(128, 40 + 20 * (l.split("\n").length - 1)) }
4271
4377
  })]
4272
4378
  }),
4273
- o.trim() ? /* @__PURE__ */ d(Z, {
4379
+ l.trim() ? /* @__PURE__ */ d(Z, {
4274
4380
  variant: "default",
4275
4381
  disabled: r,
4276
- onClick: k,
4382
+ onClick: te,
4277
4383
  title: "Send",
4278
4384
  className: "ci-h-10 ci-w-10",
4279
4385
  children: Q.send
4280
4386
  }) : /* @__PURE__ */ d(Z, {
4281
4387
  variant: "default",
4282
4388
  disabled: r || typeof MediaRecorder > "u",
4283
- onClick: te,
4389
+ onClick: A,
4284
4390
  title: "Record a voice note",
4285
4391
  "aria-label": "Record a voice note",
4286
4392
  className: "ci-h-10 ci-w-10",
@@ -4291,14 +4397,14 @@ function Ar({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4291
4397
  }
4292
4398
  //#endregion
4293
4399
  //#region src/components/ChatWindow.tsx
4294
- var jr = (e) => !!e && ![
4400
+ var Pr = (e) => !!e && ![
4295
4401
  "offline",
4296
4402
  "dnd",
4297
4403
  "busy",
4298
4404
  "ringing",
4299
4405
  "onhold"
4300
4406
  ].includes(e);
4301
- function Mr({ peer: e, actions: t, onDragStart: n }) {
4407
+ function Fr({ peer: e, actions: t, onDragStart: n }) {
4302
4408
  let { c: r, contacts: a, online: o, mobile: s, status: l, closeChat: p, openChat: m, markRead: h, order: g, me: _ } = J(w((t) => ({
4303
4409
  c: t.conversations[e],
4304
4410
  contacts: t.contacts,
@@ -4310,16 +4416,28 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4310
4416
  markRead: t.markRead,
4311
4417
  order: t.order,
4312
4418
  me: t.me
4313
- }))), v = Math.max(0, g.indexOf(e)), y = a[e], [b, x] = c(!1), S = (e) => e === _ ? "You" : a[e]?.name ?? e, C = [...r?.members ?? []].sort((e, t) => Number(e === _) - Number(t === _));
4314
- return i(() => {
4419
+ }))), v = Math.max(0, g.indexOf(e)), y = a[e], [b, x] = c(!1), [S, C] = c(null), [T, ee] = c(0), E = (e) => e === _ ? "You" : a[e]?.name ?? e, D = [...r?.members ?? []].sort((e, t) => Number(e === _) - Number(t === _));
4420
+ i(() => {
4315
4421
  r && !r.loaded && t.loadOlder(e);
4316
4422
  }, [e, r?.loaded]), i(() => {
4317
4423
  h(e);
4318
- }, [e, r?.messages.length]), i(() => x(!1), [e]), r ? /* @__PURE__ */ f("div", {
4424
+ }, [e, r?.messages.length]), i(() => {
4425
+ x(!1), C(null);
4426
+ }, [e]);
4427
+ let O = (t) => {
4428
+ if (!t.oid) return;
4429
+ let n = r?.kind === "group" ? t.nick ?? "" : t.mine ? _ : e, i = t.oob ? "Attachment" : t.body.replace(/```/g, "").replace(/\s+/g, " ").trim().slice(0, 100), o = n === _ ? J.getState().myName || _ : a[n]?.name ?? n;
4430
+ C({
4431
+ id: t.oid,
4432
+ author: n,
4433
+ quote: `${o}: ${i}`
4434
+ }), ee((e) => e + 1);
4435
+ };
4436
+ return r ? /* @__PURE__ */ f("div", {
4319
4437
  role: "dialog",
4320
4438
  "aria-label": r.kind === "group" ? r.name ?? e : y?.name ?? e,
4321
4439
  onKeyDown: (e) => {
4322
- e.key === "Escape" && (e.stopPropagation(), b ? x(!1) : p());
4440
+ e.key === "Escape" && (e.stopPropagation(), S ? C(null) : b ? x(!1) : p());
4323
4441
  },
4324
4442
  className: "ci-relative ci-w-[22rem] ci-h-[30rem] ci-flex ci-flex-col ci-rounded-3xl ci-shadow-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-text-gray-900 dark:ci-text-white",
4325
4443
  children: [
@@ -4332,17 +4450,17 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4332
4450
  className: `ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-3 ci-rounded-t-3xl ${n ? "ci-cursor-grab active:ci-cursor-grabbing ci-touch-none" : ""}`,
4333
4451
  onPointerDown: n,
4334
4452
  children: [
4335
- r.kind === "group" ? /* @__PURE__ */ d(Wn, {
4453
+ r.kind === "group" ? /* @__PURE__ */ d(Kn, {
4336
4454
  name: r.name ?? e,
4337
4455
  size: 36,
4338
4456
  avatar: r.avatar
4339
4457
  }) : /* @__PURE__ */ f("span", {
4340
4458
  className: "ci-relative",
4341
- children: [/* @__PURE__ */ d(Hn, {
4459
+ children: [/* @__PURE__ */ d(Wn, {
4342
4460
  contact: y,
4343
4461
  username: e,
4344
4462
  size: 36
4345
- }), /* @__PURE__ */ d(Un, {
4463
+ }), /* @__PURE__ */ d(Gn, {
4346
4464
  online: o[e],
4347
4465
  presence: y?.presence,
4348
4466
  mobile: s[e]
@@ -4362,10 +4480,10 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4362
4480
  children: r.kind === "group" ? r.name ?? e : y?.name ?? e
4363
4481
  }), /* @__PURE__ */ d("div", {
4364
4482
  className: "ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-truncate",
4365
- children: l === "online" ? r.kind === "group" ? C.map(S).join(", ") : r.typing ? "typing…" : o[e] ? "online" : s[e] ? "Mobile" : "offline" : l
4483
+ children: l === "online" ? r.kind === "group" ? D.map(E).join(", ") : r.typing ? "typing…" : o[e] ? "online" : s[e] ? "Mobile" : "offline" : l
4366
4484
  })]
4367
4485
  }),
4368
- r.kind !== "group" && y?.number && jr(y.presence) && /* @__PURE__ */ d(Z, {
4486
+ r.kind !== "group" && y?.number && Pr(y.presence) && /* @__PURE__ */ d(Z, {
4369
4487
  variant: "call",
4370
4488
  title: `Call ${y.number}`,
4371
4489
  "aria-label": "Call",
@@ -4387,16 +4505,16 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4387
4505
  /* @__PURE__ */ d("div", { className: "ci-border-t ci-border-gray-300 dark:ci-border-gray-700" }),
4388
4506
  b && r.kind === "group" && /* @__PURE__ */ d("div", {
4389
4507
  className: "ci-absolute ci-left-3 ci-right-3 ci-top-16 ci-z-10 ci-max-h-64 ci-overflow-y-auto ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-p-2",
4390
- children: C.map((e) => /* @__PURE__ */ f("div", {
4508
+ children: D.map((e) => /* @__PURE__ */ f("div", {
4391
4509
  className: "ci-flex ci-items-center ci-gap-3 ci-px-2 ci-py-1.5 ci-text-sm",
4392
4510
  children: [
4393
4511
  /* @__PURE__ */ f("span", {
4394
4512
  className: "ci-relative",
4395
- children: [/* @__PURE__ */ d(Hn, {
4513
+ children: [/* @__PURE__ */ d(Wn, {
4396
4514
  contact: a[e],
4397
4515
  username: e,
4398
4516
  size: 28
4399
- }), e !== _ && /* @__PURE__ */ d(Un, {
4517
+ }), e !== _ && /* @__PURE__ */ d(Gn, {
4400
4518
  online: o[e],
4401
4519
  presence: a[e]?.presence,
4402
4520
  mobile: s[e]
@@ -4404,7 +4522,7 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4404
4522
  }),
4405
4523
  /* @__PURE__ */ d("span", {
4406
4524
  className: "ci-truncate ci-flex-1",
4407
- children: S(e)
4525
+ children: E(e)
4408
4526
  }),
4409
4527
  e !== _ && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(Z, {
4410
4528
  variant: "small",
@@ -4412,7 +4530,7 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4412
4530
  "aria-label": "Chat",
4413
4531
  onClick: () => m(e),
4414
4532
  children: Q.chat
4415
- }), a[e]?.number && jr(a[e]?.presence) && /* @__PURE__ */ d(Z, {
4533
+ }), a[e]?.number && Pr(a[e]?.presence) && /* @__PURE__ */ d(Z, {
4416
4534
  variant: "call",
4417
4535
  title: `Call ${a[e]?.number}`,
4418
4536
  "aria-label": "Call",
@@ -4427,32 +4545,56 @@ function Mr({ peer: e, actions: t, onDragStart: n }) {
4427
4545
  }),
4428
4546
  /* @__PURE__ */ f("div", {
4429
4547
  className: "ci-flex-1 ci-min-h-0 ci-flex ci-flex-col ci-overflow-hidden ci-rounded-b-3xl",
4430
- children: [/* @__PURE__ */ d(hr, {
4431
- messages: r.messages,
4432
- typing: r.typing,
4433
- group: r.kind === "group",
4434
- hasOlder: r.loaded && !r.complete,
4435
- onLoadOlder: () => t.loadOlder(e),
4436
- reactions: r.reactions,
4437
- me: _,
4438
- onReact: (n, r) => t.react(e, n, r)
4439
- }), /* @__PURE__ */ d(Ar, {
4440
- disabled: l !== "online",
4441
- onSend: (n) => t.send(e, n),
4442
- onTyping: (n) => t.typing(e, n),
4443
- onFile: (n) => t.upload(e, n)
4444
- }, e)]
4548
+ children: [
4549
+ /* @__PURE__ */ d(vr, {
4550
+ messages: r.messages,
4551
+ typing: r.typing,
4552
+ group: r.kind === "group",
4553
+ hasOlder: r.loaded && !r.complete,
4554
+ onLoadOlder: () => t.loadOlder(e),
4555
+ reactions: r.reactions,
4556
+ me: _,
4557
+ onReact: (n, r) => t.react(e, n, r),
4558
+ onReply: O
4559
+ }),
4560
+ S && /* @__PURE__ */ f("div", {
4561
+ className: "ci-mx-3 ci-mt-1 ci-flex ci-items-center ci-gap-2 ci-pl-3 ci-pr-1 ci-py-1.5 ci-rounded-2xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-border-0 ci-border-l-4 ci-border-solid ci-border-iconSecondary dark:ci-border-iconSecondaryDark",
4562
+ children: [/* @__PURE__ */ f("div", {
4563
+ className: "ci-flex-1 ci-min-w-0 ci-text-xs",
4564
+ children: [/* @__PURE__ */ d("div", {
4565
+ className: "ci-font-medium ci-text-gray-900 dark:ci-text-white",
4566
+ children: S.author === _ ? "You" : a[S.author]?.name ?? S.author
4567
+ }), /* @__PURE__ */ d("div", {
4568
+ className: "ci-truncate ci-text-gray-500 dark:ci-text-gray-400",
4569
+ children: S.quote?.replace(/^[^:]*: /, "")
4570
+ })]
4571
+ }), /* @__PURE__ */ d(Z, {
4572
+ variant: "small",
4573
+ onClick: () => C(null),
4574
+ "aria-label": "Cancel reply",
4575
+ title: "Cancel reply",
4576
+ children: Q.close
4577
+ })]
4578
+ }),
4579
+ /* @__PURE__ */ d(Nr, {
4580
+ focusKey: T,
4581
+ disabled: l !== "online",
4582
+ onSend: (n) => t.send(e, n, S ?? void 0).then(() => C(null)),
4583
+ onTyping: (n) => t.typing(e, n),
4584
+ onFile: (n) => t.upload(e, n)
4585
+ }, e)
4586
+ ]
4445
4587
  })
4446
4588
  ]
4447
4589
  }) : null;
4448
4590
  }
4449
4591
  //#endregion
4450
4592
  //#region src/components/NewChat.tsx
4451
- async function Nr(e) {
4593
+ async function Ir(e) {
4452
4594
  let t = await createImageBitmap(e), n = Math.min(t.width, t.height), r = document.createElement("canvas");
4453
4595
  return r.width = r.height = 128, r.getContext("2d")?.drawImage(t, (t.width - n) / 2, (t.height - n) / 2, n, n, 0, 0, 128, 128), r.toDataURL("image/jpeg", .8);
4454
4596
  }
4455
- function Pr({ onOpen: e, onCreateGroup: t }) {
4597
+ function Lr({ onOpen: e, onCreateGroup: t }) {
4456
4598
  let { contacts: n, online: r, mobile: i, setPicker: a } = J(), [l, p] = c(""), [m, h] = c([]), [g, _] = c(""), [v, y] = c(!1), [b, x] = c(), S = s(null), C = o(() => {
4457
4599
  let e = Object.values(n), t = l.trim().toLowerCase();
4458
4600
  return t ? e.filter((e) => (e.name ?? "").toLowerCase().includes(t) || e.username.includes(t)) : e;
@@ -4509,11 +4651,11 @@ function Pr({ onOpen: e, onCreateGroup: t }) {
4509
4651
  children: [
4510
4652
  /* @__PURE__ */ f("span", {
4511
4653
  className: "ci-relative",
4512
- children: [/* @__PURE__ */ d(Hn, {
4654
+ children: [/* @__PURE__ */ d(Wn, {
4513
4655
  contact: e,
4514
4656
  username: e.username,
4515
4657
  size: 36
4516
- }), /* @__PURE__ */ d(Un, {
4658
+ }), /* @__PURE__ */ d(Gn, {
4517
4659
  online: r[e.username],
4518
4660
  presence: e.presence,
4519
4661
  mobile: i[e.username]
@@ -4560,7 +4702,7 @@ function Pr({ onOpen: e, onCreateGroup: t }) {
4560
4702
  type: "file",
4561
4703
  accept: "image/*",
4562
4704
  hidden: !0,
4563
- onChange: (e) => e.target.files?.[0] && Nr(e.target.files[0]).then(x).catch(() => {})
4705
+ onChange: (e) => e.target.files?.[0] && Ir(e.target.files[0]).then(x).catch(() => {})
4564
4706
  }),
4565
4707
  /* @__PURE__ */ d("button", {
4566
4708
  type: "button",
@@ -4595,22 +4737,22 @@ function Pr({ onOpen: e, onCreateGroup: t }) {
4595
4737
  }
4596
4738
  //#endregion
4597
4739
  //#region src/theme.ts
4598
- var Fr = "chat-island-theme", Ir = () => {
4740
+ var Rr = "chat-island-theme", zr = () => {
4599
4741
  try {
4600
- let e = localStorage.getItem(Fr);
4742
+ let e = localStorage.getItem(Rr);
4601
4743
  return e === "light" || e === "dark" || e === "system" ? e : void 0;
4602
4744
  } catch {
4603
4745
  return;
4604
4746
  }
4605
4747
  };
4606
- function Lr(e) {
4607
- let [t, n] = c(() => e ?? Ir()), [r, a] = c(!1);
4608
- return i(() => n(e ?? Ir()), [e]), i(() => {
4748
+ function Br(e) {
4749
+ let [t, n] = c(() => e ?? zr()), [r, a] = c(!1);
4750
+ return i(() => n(e ?? zr()), [e]), i(() => {
4609
4751
  let e = (e) => {
4610
4752
  let t = e.detail?.theme;
4611
4753
  if (t === "light" || t === "dark" || t === "system") {
4612
4754
  try {
4613
- localStorage.setItem(Fr, t);
4755
+ localStorage.setItem(Rr, t);
4614
4756
  } catch {}
4615
4757
  n(t);
4616
4758
  }
@@ -4636,7 +4778,7 @@ function Lr(e) {
4636
4778
  }
4637
4779
  //#endregion
4638
4780
  //#region src/ChatIsland.tsx
4639
- function Rr() {
4781
+ function Vr() {
4640
4782
  let e = J.getState();
4641
4783
  return Object.values(e.conversations).map((t) => {
4642
4784
  let n = t.messages[t.messages.length - 1], r = e.contacts[t.peer];
@@ -4651,7 +4793,7 @@ function Rr() {
4651
4793
  unread: t.unread,
4652
4794
  members: t.members,
4653
4795
  last: n ? {
4654
- body: Vr(n.body),
4796
+ body: Wr(n.body),
4655
4797
  ts: n.ts,
4656
4798
  mine: n.mine,
4657
4799
  oob: n.oob,
@@ -4660,7 +4802,7 @@ function Rr() {
4660
4802
  };
4661
4803
  }).filter((e) => e.last || e.kind === "group").sort((e, t) => (t.last?.ts ?? 0) - (e.last?.ts ?? 0));
4662
4804
  }
4663
- var zr = class extends t {
4805
+ var Hr = class extends t {
4664
4806
  state = { failed: !1 };
4665
4807
  failures = [];
4666
4808
  static getDerivedStateFromError() {
@@ -4678,7 +4820,7 @@ var zr = class extends t {
4678
4820
  return this.state.failed ? null : this.props.children;
4679
4821
  }
4680
4822
  };
4681
- function Br(e) {
4823
+ function Ur(e) {
4682
4824
  try {
4683
4825
  let [t, n, r] = atob(e).split(":");
4684
4826
  return t && n && r ? {
@@ -4690,9 +4832,9 @@ function Br(e) {
4690
4832
  return null;
4691
4833
  }
4692
4834
  }
4693
- var Vr = (e) => (cr(e) ? "Attachment" : $(e)).replace(/```[^\n]*\n?/g, "").replace(/(\*\*|__|~~|`)/g, "").replace(/(^|\s)[*_](\S[^*_]*)[*_]/g, "$1$2").replace(/\s+/g, " ").trim();
4694
- function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWorker: r, maxHeads: a = 5, newChatButton: l = !0, notifications: u = "click", sound: p = !0, drag: m = !0, onDragStart: h }) {
4695
- let g = o(() => Br(e), [e]), _ = Lr(n), v = s(g), y = s(p), b = s(u);
4835
+ var Wr = (e) => (ur(e) ? "Attachment" : $(e)).replace(/```[^\n]*\n?/g, "").replace(/(\*\*|__|~~|`)/g, "").replace(/(^|\s)[*_](\S[^*_]*)[*_]/g, "$1$2").replace(/\s+/g, " ").trim();
4836
+ function Gr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWorker: r, maxHeads: a = 5, newChatButton: l = !0, notifications: u = "click", sound: p = !0, drag: m = !0, onDragStart: h }) {
4837
+ let g = o(() => Ur(e), [e]), _ = Br(n), v = s(g), y = s(p), b = s(u);
4696
4838
  i(() => {
4697
4839
  v.current = g, y.current = p, b.current = u;
4698
4840
  }, [
@@ -4708,16 +4850,16 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4708
4850
  let e = (e) => e.persisted && S((e) => e + 1);
4709
4851
  return window.addEventListener("pageshow", e), () => window.removeEventListener("pageshow", e);
4710
4852
  }, []);
4711
- let C = s(null), T = s(/* @__PURE__ */ new Set()), D = s(!1), O = s(null), ee = s(null), k = E(ee, `chat-island-pos:${g?.host ?? ""}:${g?.username ?? ""}`), { open: te, picker: A, status: j } = J(w((e) => ({
4853
+ let C = s(null), T = s(/* @__PURE__ */ new Set()), E = s(!1), D = s(null), O = s(null), k = ee(O, `chat-island-pos:${g?.host ?? ""}:${g?.username ?? ""}`), { open: te, picker: A, status: j } = J(w((e) => ({
4712
4854
  open: e.open,
4713
4855
  picker: e.picker,
4714
4856
  status: e.status
4715
- }))), ne = o(() => ({
4716
- send: async (e, t) => {
4717
- let n = C.current;
4718
- if (!n) throw Error("not connected");
4857
+ }))), M = o(() => ({
4858
+ send: async (e, t, n) => {
4859
+ let r = C.current;
4860
+ if (!r) throw Error("not connected");
4719
4861
  try {
4720
- J.getState().addMessage(e, await n.send(e, $(t)));
4862
+ J.getState().addMessage(e, await r.send(e, $(t), void 0, n));
4721
4863
  } catch (e) {
4722
4864
  throw Y("chat-island-error", {
4723
4865
  scope: "send",
@@ -4755,7 +4897,7 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4755
4897
  if (!t || !n) return;
4756
4898
  let r = J.getState().conversations[e];
4757
4899
  try {
4758
- r?.kind === "group" && await t.leaveGroup(e, !!r.owner).catch(() => {}), await In(n.host, n.token, e), J.getState().removeConversation(e);
4900
+ r?.kind === "group" && await t.leaveGroup(e, !!r.owner).catch(() => {}), await Rn(n.host, n.token, e), J.getState().removeConversation(e);
4759
4901
  } catch (e) {
4760
4902
  Y("chat-island-error", {
4761
4903
  scope: "delete",
@@ -4813,7 +4955,7 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4813
4955
  if (e.setStatus(n, a), Y("chat-island-status", {
4814
4956
  status: n,
4815
4957
  error: a
4816
- }), n === "online" && r && !D.current && typeof Notification < "u") {
4958
+ }), n === "online" && r && !E.current && typeof Notification < "u") {
4817
4959
  let e = Notification.permission;
4818
4960
  (e === "granted" || b.current === "auto" && e === "default") && i();
4819
4961
  }
@@ -4833,7 +4975,7 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4833
4975
  }).catch(() => {});
4834
4976
  },
4835
4977
  message: (r) => {
4836
- let i = jn(r);
4978
+ let i = Mn(r);
4837
4979
  r.room && !J.getState().conversations[r.room]?.name && t.groupInfo(r.room).then((t) => e.setGroup(t.peer, t.name, t.members, t.avatar, t.owner)).catch(() => {}), e.addMessage(i, r, { live: !0 }), Y("chat-island-message", {
4838
4980
  ...r,
4839
4981
  peer: i
@@ -4843,7 +4985,7 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4843
4985
  let n = J.getState(), r = document.visibilityState === "visible";
4844
4986
  if (r && n.open === e) return;
4845
4987
  let i = n.conversations[e], a = i?.kind === "group" ? i.name ?? e : n.contacts[e]?.name ?? e, o = t.oob ? "Attachment" : $(t.body), s = i?.kind === "group", c = s && t.nick ? n.contacts[t.nick]?.name ?? t.nick : a, l = s && t.nick ? `${c}: ${o}` : o;
4846
- y.current && Sn();
4988
+ y.current && Cn();
4847
4989
  let u = s ? i?.avatar : n.contacts[e]?.avatar;
4848
4990
  if (Y("chat-island-notify", {
4849
4991
  peer: e,
@@ -4867,16 +5009,16 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4867
5009
  };
4868
5010
  C.current = t;
4869
5011
  let i = () => {
4870
- r && !D.current && (D.current = !0, Bn(g, r).then((e) => {
5012
+ r && !E.current && (E.current = !0, Hn(g, r).then((e) => {
4871
5013
  if (!e) {
4872
- D.current = !1, J.setState({ push: Notification.permission === "denied" ? "denied" : "ask" });
5014
+ E.current = !1, J.setState({ push: Notification.permission === "denied" ? "denied" : "ask" });
4873
5015
  return;
4874
5016
  }
4875
5017
  return t.enablePush(e.service, e.node).then(() => {
4876
- O.current = e, J.setState({ push: "enabled" }), Y("chat-island-push", { enabled: !0 });
5018
+ D.current = e, J.setState({ push: "enabled" }), Y("chat-island-push", { enabled: !0 });
4877
5019
  });
4878
5020
  }).catch((e) => {
4879
- D.current = !1, Y("chat-island-error", {
5021
+ E.current = !1, Y("chat-island-error", {
4880
5022
  scope: "push",
4881
5023
  message: e.message
4882
5024
  });
@@ -4888,51 +5030,51 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4888
5030
  });
4889
5031
  let s = () => t.stop();
4890
5032
  window.addEventListener("pagehide", s), t.start();
4891
- let c = () => Fn(g.host, g.token).then(e.setMobile).catch(() => {});
5033
+ let c = () => Ln(g.host, g.token).then(e.setMobile).catch(() => {});
4892
5034
  c();
4893
5035
  let u = window.setInterval(c, 12e4);
4894
- Pn(g.host, g.token, g.username).then(e.setContacts).catch((e) => Y("chat-island-error", {
5036
+ In(g.host, g.token, g.username, (e) => J.setState({ myName: e })).then(e.setContacts).catch((e) => Y("chat-island-error", {
4895
5037
  scope: "contacts",
4896
5038
  message: e.message
4897
5039
  }));
4898
- let d = X("chat-island-open", ({ username: t }) => t && e.openChat(t)), f = X("chat-island-close", () => e.closeChat()), p = X("chat-island-new", () => e.setPicker(!0)), m = X("chat-island-delete", ({ username: e }) => e && ne.remove(e)), h = X("chat-island-contacts", ({ contacts: t }) => t && e.setContacts(t)), _ = X("chat-island-conversations-request", () => Y("chat-island-conversations", { conversations: Rr() }));
5040
+ let d = X("chat-island-open", ({ username: t }) => t && e.openChat(t)), f = X("chat-island-close", () => e.closeChat()), p = X("chat-island-new", () => e.setPicker(!0)), m = X("chat-island-delete", ({ username: e }) => e && M.remove(e)), h = X("chat-island-contacts", ({ contacts: t }) => t && e.setContacts(t)), _ = X("chat-island-conversations-request", () => Y("chat-island-conversations", { conversations: Vr() }));
4899
5041
  return () => {
4900
- window.removeEventListener("pagehide", s), window.clearInterval(u), _(), p(), m(), d(), f(), h(), O.current && t.disablePush(O.current.service, O.current.node).catch(() => {}), O.current = null, t.stop(), C.current = null, D.current = !1;
5042
+ window.removeEventListener("pagehide", s), window.clearInterval(u), _(), p(), m(), d(), f(), h(), D.current && t.disablePush(D.current.service, D.current.node).catch(() => {}), D.current = null, t.stop(), C.current = null, E.current = !1;
4901
5043
  };
4902
5044
  }, [
4903
5045
  g,
4904
5046
  r,
4905
5047
  x
4906
5048
  ]);
4907
- let M = J((e) => Object.keys(e.contacts).join(","));
5049
+ let N = J((e) => Object.keys(e.contacts).join(","));
4908
5050
  i(() => {
4909
- j === "online" && M && C.current?.announce(M.split(","));
4910
- }, [j, M]);
4911
- let re = J((e) => Object.values(e.conversations).map((e) => `${e.peer}:${e.kind}:${e.name ?? ""}:${(e.members ?? []).length}:${e.unread}:${e.messages[e.messages.length - 1]?.id ?? ""}`).join("|") + "#" + Object.keys(e.contacts).length + "#" + Object.values(e.online).filter(Boolean).length);
4912
- i(() => Y("chat-island-conversations", { conversations: Rr() }), [re]);
4913
- let ie = J((e) => Object.values(e.conversations).reduce((e, t) => e + t.unread, 0));
4914
- if (i(() => Y("chat-island-unread", { total: ie }), [ie]), !g) return null;
4915
- let ae = m && !h && k.anchor ? {
5051
+ j === "online" && N && C.current?.announce(N.split(","));
5052
+ }, [j, N]);
5053
+ let ne = J((e) => Object.values(e.conversations).map((e) => `${e.peer}:${e.kind}:${e.name ?? ""}:${(e.members ?? []).length}:${e.unread}:${e.messages[e.messages.length - 1]?.id ?? ""}`).join("|") + "#" + Object.keys(e.contacts).length + "#" + Object.values(e.online).filter(Boolean).length);
5054
+ i(() => Y("chat-island-conversations", { conversations: Vr() }), [ne]);
5055
+ let re = J((e) => Object.values(e.conversations).reduce((e, t) => e + t.unread, 0));
5056
+ if (i(() => Y("chat-island-unread", { total: re }), [re]), !g) return null;
5057
+ let ie = m && !h && k.anchor ? {
4916
5058
  right: k.anchor.right,
4917
5059
  bottom: k.anchor.bottom
4918
- } : void 0, oe = ae ? "" : t === "bottom-left" ? "ci-left-4 ci-bottom-5" : "ci-right-4 ci-bottom-5";
5060
+ } : void 0, ae = ie ? "" : t === "bottom-left" ? "ci-left-4 ci-bottom-5" : "ci-right-4 ci-bottom-5";
4919
5061
  return /* @__PURE__ */ d("div", {
4920
- ref: ee,
4921
- style: ae,
5062
+ ref: O,
5063
+ style: ie,
4922
5064
  onClickCapture: k.onClickCapture,
4923
- className: `chat-island-root ${_ ? "ci-dark" : ""} ci-fixed ${oe} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,
5065
+ className: `chat-island-root ${_ ? "ci-dark" : ""} ci-fixed ${ae} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,
4924
5066
  "data-status": j,
4925
- children: /* @__PURE__ */ f(zr, { children: [
4926
- te && /* @__PURE__ */ d(Mr, {
5067
+ children: /* @__PURE__ */ f(Hr, { children: [
5068
+ te && /* @__PURE__ */ d(Fr, {
4927
5069
  peer: te,
4928
- actions: ne,
5070
+ actions: M,
4929
5071
  onDragStart: h ?? (m ? k.start : void 0)
4930
5072
  }),
4931
- A && /* @__PURE__ */ d(Pr, {
5073
+ A && /* @__PURE__ */ d(Lr, {
4932
5074
  onOpen: (e) => J.getState().openChat(e),
4933
- onCreateGroup: ne.createGroup
5075
+ onCreateGroup: M.createGroup
4934
5076
  }),
4935
- /* @__PURE__ */ d(qn, {
5077
+ /* @__PURE__ */ d(Yn, {
4936
5078
  onDragStart: h ?? (m ? k.start : void 0),
4937
5079
  pushButton: u !== "auto"
4938
5080
  })
@@ -4940,4 +5082,4 @@ function Hr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4940
5082
  });
4941
5083
  }
4942
5084
  //#endregion
4943
- export { Hr as ChatIsland };
5085
+ export { Gr as ChatIsland, Pn as contactsFromOperators };