@nethesis/chat-island 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -277,7 +277,7 @@ 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) => {
280
+ })), k = /* @__PURE__ */ y(((e, t) => {
281
281
  var n = O();
282
282
  function r(e, t) {
283
283
  if (Array.isArray(t)) {
@@ -296,7 +296,7 @@ var D = /* @__PURE__ */ y(((e) => {
296
296
  return a;
297
297
  }
298
298
  t.exports = i;
299
- })), te = /* @__PURE__ */ y(((e, t) => {
299
+ })), A = /* @__PURE__ */ y(((e, t) => {
300
300
  var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
301
301
  return Function.prototype.apply.call(e, t, n);
302
302
  }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
@@ -471,8 +471,8 @@ var D = /* @__PURE__ */ y(((e) => {
471
471
  });
472
472
  else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
473
473
  }
474
- })), ne = /* @__PURE__ */ y(((e, t) => {
475
- var n = te(), r = D(), i = 0, a = 1, o = 2, s = 3, c = 4, l = 5, u = 6, d = 7, f = 8, p = 9, m = 10;
474
+ })), ee = /* @__PURE__ */ y(((e, t) => {
475
+ var n = A(), r = D(), 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
- })), k = D(), A = /* @__PURE__ */ x(O(), 1), re = /* @__PURE__ */ x(ee(), 1), j = te(), ie = /* @__PURE__ */ x(ne(), 1), ae = class extends Error {
568
+ })), j = D(), M = /* @__PURE__ */ x(O(), 1), N = /* @__PURE__ */ x(k(), 1), P = A(), te = /* @__PURE__ */ x(ee(), 1), ne = 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 oe(e) {
575
+ function re(e) {
576
576
  let t, n = new Promise((n) => {
577
577
  t = setTimeout(n, e);
578
578
  });
@@ -580,32 +580,32 @@ function oe(e) {
580
580
  }
581
581
  //#endregion
582
582
  //#region node_modules/@xmpp/events/lib/timeout.js
583
- function se(e, t) {
584
- let n = oe(t);
583
+ function ie(e, t) {
584
+ let n = re(t);
585
585
  function r() {
586
586
  clearTimeout(n.timeout);
587
587
  }
588
- let i = new ae();
588
+ let i = new ne();
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 ce = /* @__PURE__ */ new WeakMap();
596
- function le(e) {
597
- let t = ce.get(e);
595
+ var ae = /* @__PURE__ */ new WeakMap();
596
+ function oe(e) {
597
+ let t = ae.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
- }, ce.set(e, t)), t;
602
+ }, ae.set(e, t)), t;
603
603
  }
604
604
  //#endregion
605
605
  //#region node_modules/@xmpp/events/lib/promise.js
606
- function M(e, t, n = "error", r) {
606
+ function F(e, t, n = "error", r) {
607
607
  return new Promise((i, a) => {
608
- let o, { off: s, once: c } = le(e), l = () => {
608
+ let o, { off: s, once: c } = oe(e), l = () => {
609
609
  clearTimeout(o), s(t, d), s(n, u);
610
610
  };
611
611
  function u(e) {
@@ -615,7 +615,7 @@ function M(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 ae();
618
+ let e = new ne();
619
619
  o = setTimeout(() => {
620
620
  l(), a(e);
621
621
  }, r);
@@ -624,14 +624,14 @@ function M(e, t, n = "error", r) {
624
624
  }
625
625
  //#endregion
626
626
  //#region node_modules/@xmpp/events/lib/Deferred.js
627
- function ue() {
627
+ function se() {
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 de(e, t = null, n) {
634
+ function ce(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,38 +651,38 @@ function de(e, t = null, n) {
651
651
  }
652
652
  //#endregion
653
653
  //#region node_modules/@xmpp/events/lib/listeners.js
654
- function fe(e) {
654
+ function le(e) {
655
655
  return {
656
656
  subscribe(t) {
657
- let { on: n } = le(t);
657
+ let { on: n } = oe(t);
658
658
  for (let [t, r] of Object.entries(e)) n(t, r);
659
659
  },
660
660
  unsubscribe(t) {
661
- let { off: n } = le(t);
661
+ let { off: n } = oe(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 N = class extends Error {
668
+ var ue = class extends Error {
669
669
  constructor(...e) {
670
670
  super(...e), this.name = "XMLError";
671
671
  }
672
- }, pe = class extends j.EventEmitter {
672
+ }, de = class extends P.EventEmitter {
673
673
  constructor() {
674
674
  super();
675
- let e = new ie.default();
675
+ let e = new te.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) {
679
- let n = new A.default(e, t), { root: r, cursor: i } = this;
679
+ let n = new M.default(e, t), { root: r, cursor: i } = this;
680
680
  r ? i !== r && i.append(n) : (this.root = n, this.emit("start", n)), this.cursor = n;
681
681
  }
682
682
  onEndElement(e) {
683
683
  let { root: t, cursor: n } = this;
684
684
  if (e !== n.name) {
685
- this.emit("error", new N(`${n.name} must be closed.`));
685
+ this.emit("error", new ue(`${n.name} must be closed.`));
686
686
  return;
687
687
  }
688
688
  if (n === t) {
@@ -698,7 +698,7 @@ var N = class extends Error {
698
698
  onText(e) {
699
699
  let { cursor: t } = this;
700
700
  if (!t) {
701
- this.emit("error", new N(`${e} must be a child.`));
701
+ this.emit("error", new ue(`${e} must be a child.`));
702
702
  return;
703
703
  }
704
704
  t.t(e);
@@ -710,37 +710,37 @@ var N = class extends Error {
710
710
  e && this.parser.write(e);
711
711
  }
712
712
  };
713
- pe.XMLError = N;
713
+ de.XMLError = ue;
714
714
  //#endregion
715
715
  //#region node_modules/@xmpp/xml/index.js
716
- function P(...e) {
717
- return (0, re.default)(...e);
716
+ function I(...e) {
717
+ return (0, N.default)(...e);
718
718
  }
719
- Object.assign(P, {
720
- Element: A.default,
721
- createElement: re.default,
722
- Parser: pe,
723
- escapeXML: k.escapeXML,
724
- unescapeXML: k.unescapeXML,
725
- escapeXMLText: k.escapeXMLText,
726
- unescapeXMLText: k.unescapeXMLText,
727
- XMLError: N,
728
- xml: P
719
+ Object.assign(I, {
720
+ Element: M.default,
721
+ createElement: N.default,
722
+ Parser: de,
723
+ escapeXML: j.escapeXML,
724
+ unescapeXML: j.unescapeXML,
725
+ escapeXMLText: j.escapeXMLText,
726
+ unescapeXMLText: j.unescapeXMLText,
727
+ XMLError: ue,
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 be = 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 be = 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
- }, xe = class extends be {
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 Se(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 Se(e) {
833
833
  protocol: r
834
834
  };
835
835
  }
836
- function Ce(e) {
837
- let { port: t, hostname: n } = Se(`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 we(e) {
844
- return e.includes("://") ? Se(e) : Ce(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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "http://etherx.jabber.org/streams", De = class extends j.EventEmitter {
848
+ var Ce = "urn:ietf:params:xml:ns:xmpp-streams", we = "http://etherx.jabber.org/streams", Te = class extends P.EventEmitter {
849
849
  #e = null;
850
850
  #t = null;
851
851
  constructor(e = {}) {
@@ -856,7 +856,7 @@ var Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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: Te }, 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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "http://etherx.jabber.org/s
880
880
  });
881
881
  }
882
882
  _attachSocket(e) {
883
- this.socket = e, this.#e ??= fe({
883
+ this.socket = e, this.#e ??= le({
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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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", Ee);
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 = xe.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 } = we(this.options.service), n = e.element.getChildText("see-other-host"), { port: r } = Ce(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 M(this, "disconnect");
906
+ await F(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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "http://etherx.jabber.org/s
914
914
  }
915
915
  }
916
916
  _attachParser(e) {
917
- this.parser = e, this.#t ??= fe({
917
+ this.parser = e, this.#t ??= le({
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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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 = M(this, "online");
954
+ let r = F(this, "online");
955
955
  return await this.open({
956
956
  domain: t,
957
957
  lang: n
@@ -960,15 +960,15 @@ var Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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)), M(t, "connect");
963
+ return this._attachSocket(t), t.connect(this.socketParameters(e)), F(t, "connect");
964
964
  }
965
965
  async _closeSocket(e = this.timeout) {
966
- this._status("disconnecting"), this.socket.end(), await M(this.socket, "close", "error", e);
966
+ this._status("disconnecting"), this.socket.end(), await F(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)), M(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)), F(this, "open", "error", this.timeout);
972
972
  }
973
973
  async stop() {
974
974
  let e = await this.disconnect();
@@ -977,7 +977,7 @@ var Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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"), M(this.parser, "end", "error", e);
980
+ return await this.write(t), this._status("closing"), F(this.parser, "end", "error", e);
981
981
  }
982
982
  async restart() {
983
983
  this._detachParser();
@@ -991,7 +991,7 @@ var Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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), M(this, "element", "error", t)]).then(([, e]) => e);
994
+ return Promise.all([this.send(e), F(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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "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 Te = "urn:ietf:params:xml:ns:xmpp-streams", Ee = "http://etherx.jabber.org/s
1045
1045
  }));
1046
1046
  }
1047
1047
  };
1048
- De.prototype.NS = "", De.prototype.Socket = null, De.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 Oe = class extends De {
1051
+ var Ee = class extends Te {
1052
1052
  constructor(e) {
1053
1053
  super(e), this.transports = [];
1054
1054
  }
@@ -1089,10 +1089,10 @@ var Oe = class extends De {
1089
1089
  return this.Transport.prototype.footerElement(...e);
1090
1090
  }
1091
1091
  };
1092
- Oe.prototype.NS = "jabber:client";
1092
+ Ee.prototype.NS = "jabber:client";
1093
1093
  //#endregion
1094
1094
  //#region node_modules/@xmpp/reconnect/index.js
1095
- var ke = class extends j.EventEmitter {
1095
+ var De = class extends P.EventEmitter {
1096
1096
  constructor(e) {
1097
1097
  super(), this.delay = 1e3, this.entity = e, this._timeout = null;
1098
1098
  }
@@ -1125,36 +1125,36 @@ var ke = class extends j.EventEmitter {
1125
1125
  e.removeListener("disconnect", this.#e), clearTimeout(t);
1126
1126
  }
1127
1127
  };
1128
- function Ae({ entity: e }) {
1129
- let t = new ke(e);
1128
+ function Oe({ entity: e }) {
1129
+ let t = new De(e);
1130
1130
  return t.start(), t;
1131
1131
  }
1132
1132
  //#endregion
1133
1133
  //#region node_modules/@xmpp/websocket/lib/Socket.js
1134
- var je = "ECONNERROR";
1135
- function Me(e) {
1136
- let t = Se(e);
1134
+ var ke = "ECONNERROR";
1135
+ function Ae(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 Ne = class extends j.EventEmitter {
1143
+ var je = class extends P.EventEmitter {
1144
1144
  #e = null;
1145
1145
  socket = null;
1146
1146
  url = null;
1147
1147
  secure = !1;
1148
1148
  connect(e) {
1149
- this.url = e, this.secure = Me(e), this._attachSocket(new WebSocket(e, ["xmpp"]));
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 ??= fe({
1152
+ this.socket = e, this.#e ??= le({
1153
1153
  open: () => this.emit("connect"),
1154
1154
  message: ({ data: e }) => this.emit("data", e),
1155
1155
  error: (e) => {
1156
1156
  let { url: t } = this, { error: n } = e;
1157
- n || (n = Error(e.message || `WebSocket ${je} ${t}`), n.errno = je, n.code = je), n.event = e, n.url = t, this.emit("error", n);
1157
+ n || (n = Error(e.message || `WebSocket ${ke} ${t}`), n.errno = ke, n.code = ke), n.event = e, n.url = t, this.emit("error", n);
1158
1158
  },
1159
1159
  close: (e) => {
1160
1160
  this._detachSocket(), this.emit("close", !e.wasClean, e);
@@ -1179,15 +1179,15 @@ var Ne = class extends j.EventEmitter {
1179
1179
  }
1180
1180
  n();
1181
1181
  }
1182
- }, Pe = class extends pe {
1182
+ }, Me = class extends de {
1183
1183
  onStartElement(e, t) {
1184
- let n = new A.default(e, t), { cursor: r } = this;
1184
+ let n = new M.default(e, t), { cursor: r } = this;
1185
1185
  r && r.append(n), this.cursor = n;
1186
1186
  }
1187
1187
  onEndElement(e) {
1188
1188
  let { cursor: t } = this;
1189
1189
  if (e !== t.name) {
1190
- this.emit("error", new N(`${t.name} must be closed.`));
1190
+ this.emit("error", new ue(`${t.name} must be closed.`));
1191
1191
  return;
1192
1192
  }
1193
1193
  if (t.parent) {
@@ -1196,7 +1196,7 @@ var Ne = class extends j.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
- }, Fe = "urn:ietf:params:xml:ns:xmpp-framing", Ie = class extends De {
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,27 +1204,27 @@ var Ne = class extends j.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: Fe });
1207
+ return new I.Element("close", { xmlns: Ne });
1208
1208
  }
1209
1209
  headerElement() {
1210
1210
  let e = super.headerElement();
1211
- return e.name = "open", e.attrs.xmlns = Fe, e;
1211
+ return e.name = "open", e.attrs.xmlns = Ne, e;
1212
1212
  }
1213
1213
  socketParameters(e) {
1214
1214
  return /^wss?:\/\//.test(e) ? e : void 0;
1215
1215
  }
1216
1216
  };
1217
- Ie.prototype.Socket = Ne, Ie.prototype.NS = "jabber:client", Ie.prototype.Parser = Pe;
1217
+ Pe.prototype.Socket = je, Pe.prototype.NS = "jabber:client", Pe.prototype.Parser = Me;
1218
1218
  //#endregion
1219
1219
  //#region node_modules/@xmpp/websocket/index.js
1220
- function Le({ entity: e }) {
1221
- e.transports.push(Ie);
1220
+ function Fe({ entity: e }) {
1221
+ e.transports.push(Pe);
1222
1222
  }
1223
1223
  //#endregion
1224
1224
  //#region __vite-browser-external
1225
- var Re = /* @__PURE__ */ y(((e, t) => {
1225
+ var Ie = /* @__PURE__ */ y(((e, t) => {
1226
1226
  t.exports = {};
1227
- })), ze = /* @__PURE__ */ y(((e, t) => {
1227
+ })), Le = /* @__PURE__ */ y(((e, t) => {
1228
1228
  t.exports = n;
1229
1229
  function n(e) {
1230
1230
  if (!Array.isArray(e)) throw TypeError("Middleware stack must be an array!");
@@ -1245,40 +1245,40 @@ var Re = /* @__PURE__ */ y(((e, t) => {
1245
1245
  }
1246
1246
  };
1247
1247
  }
1248
- })), L = /* @__PURE__ */ x(Re(), 1), Be = /* @__PURE__ */ x(ze(), 1), Ve = class {
1248
+ })), z = /* @__PURE__ */ x(Ie(), 1), Re = /* @__PURE__ */ x(Le(), 1), ze = class {
1249
1249
  constructor(e, t) {
1250
1250
  this.stanza = t, this.entity = e;
1251
1251
  let { name: n, attrs: r } = t, { type: i, id: a } = r;
1252
1252
  this.name = n, this.id = a || "", this.type = n === "message" ? i || "normal" : n === "presence" ? i || "available" : i || "", this.from = null, this.to = null, this.local = "", this.domain = "", this.resource = "";
1253
1253
  }
1254
- }, He = class extends Ve {
1254
+ }, Be = class extends ze {
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
- }, Ue = class extends Ve {
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
1268
1268
  //#region node_modules/@xmpp/middleware/index.js
1269
- function We(e, t, n) {
1269
+ function He(e, t, n) {
1270
1270
  return (r) => {
1271
1271
  let i = new n(e, r);
1272
- return (0, Be.default)(t)(i);
1272
+ return (0, Re.default)(t)(i);
1273
1273
  };
1274
1274
  }
1275
- function Ge(e) {
1275
+ function Ue(e) {
1276
1276
  return (t, n) => {
1277
1277
  n().then((t) => t && e.send(t)).catch((t) => e.emit("error", t));
1278
1278
  };
1279
1279
  }
1280
- function Ke({ entity: e }) {
1281
- let t = [Ge(e)], n = [], r = We(e, t, He), i = We(e, n, Ue);
1280
+ function We({ entity: e }) {
1281
+ let t = [Ue(e)], n = [], r = He(e, t, Be), i = He(e, n, Ve);
1282
1282
  return e.on("element", r), e.on("send", i), {
1283
1283
  use(e) {
1284
1284
  return t.push(e), e;
@@ -1290,7 +1290,7 @@ function Ke({ entity: e }) {
1290
1290
  }
1291
1291
  //#endregion
1292
1292
  //#region node_modules/@xmpp/stream-features/index.js
1293
- function qe({ middleware: e }) {
1293
+ function Ge({ middleware: e }) {
1294
1294
  function t(t, n, r) {
1295
1295
  return e.use((e, i) => {
1296
1296
  let { stanza: a } = e;
@@ -1303,14 +1303,14 @@ function qe({ middleware: e }) {
1303
1303
  }
1304
1304
  //#endregion
1305
1305
  //#region node_modules/@xmpp/id/index.js
1306
- function Je() {
1306
+ function Ke() {
1307
1307
  let e;
1308
1308
  for (; !e;) e = Math.random().toString(36).slice(2, 12);
1309
1309
  return e;
1310
1310
  }
1311
1311
  //#endregion
1312
1312
  //#region node_modules/@xmpp/middleware/lib/StanzaError.js
1313
- var Ye = class extends be {
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
  }
@@ -1321,10 +1321,10 @@ var Ye = class extends be {
1321
1321
  };
1322
1322
  //#endregion
1323
1323
  //#region node_modules/@xmpp/iq/caller.js
1324
- function Xe({ name: e, type: t }) {
1324
+ function Je({ name: e, type: t }) {
1325
1325
  return !(e !== "iq" || t !== "error" && t !== "result");
1326
1326
  }
1327
- var Ze = class {
1327
+ var Ye = class {
1328
1328
  constructor({ entity: e, middleware: t }) {
1329
1329
  this.handlers = /* @__PURE__ */ new Map(), this.entity = e, this.middleware = t;
1330
1330
  }
@@ -1332,20 +1332,20 @@ var Ze = class {
1332
1332
  this.middleware.use(this._route.bind(this));
1333
1333
  }
1334
1334
  _route({ type: e, name: t, id: n, stanza: r }, i) {
1335
- if (!Xe({
1335
+ if (!Je({
1336
1336
  name: t,
1337
1337
  type: e
1338
1338
  })) return i();
1339
1339
  let a = this.handlers.get(n);
1340
1340
  if (!a) return i();
1341
- e === "error" ? a.reject(Ye.fromElement(r.getChild("error"))) : a.resolve(r), this.handlers.delete(n);
1341
+ e === "error" ? a.reject(qe.fromElement(r.getChild("error"))) : a.resolve(r), this.handlers.delete(n);
1342
1342
  }
1343
1343
  async request(e, t = 3e4) {
1344
- e.attrs.id || (e.attrs.id = Je());
1345
- let n = new ue();
1344
+ e.attrs.id || (e.attrs.id = Ke());
1345
+ let n = new se();
1346
1346
  this.handlers.set(e.attrs.id, n);
1347
1347
  try {
1348
- await this.entity.send(e), await se(n.promise, t);
1348
+ await this.entity.send(e), await ie(n.promise, t);
1349
1349
  } catch (t) {
1350
1350
  throw this.handlers.delete(e.attrs.id), t;
1351
1351
  }
@@ -1353,7 +1353,7 @@ var Ze = 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));
@@ -1365,71 +1365,71 @@ var Ze = class {
1365
1365
  return this._childRequest("set", ...e);
1366
1366
  }
1367
1367
  };
1368
- function Qe(...e) {
1369
- let t = new Ze(...e);
1368
+ function Xe(...e) {
1369
+ let t = new Ye(...e);
1370
1370
  return t.start(), t;
1371
1371
  }
1372
1372
  //#endregion
1373
1373
  //#region node_modules/@xmpp/iq/callee.js
1374
- var $e = "urn:ietf:params:xml:ns:xmpp-stanzas";
1375
- function et({ name: e, type: t }) {
1374
+ var Ze = "urn:ietf:params:xml:ns:xmpp-stanzas";
1375
+ function Qe({ name: e, type: t }) {
1376
1376
  return e === "iq" && t !== "error" && t !== "result";
1377
1377
  }
1378
- function tt({ type: e }, t, n) {
1378
+ function $e({ type: e }, t, n) {
1379
1379
  return !(e !== "get" && e !== "set" || t.length !== 1 || !n);
1380
1380
  }
1381
- function nt({ stanza: e }) {
1382
- return P("iq", {
1381
+ function et({ stanza: e }) {
1382
+ return I("iq", {
1383
1383
  to: e.attrs.from,
1384
1384
  from: e.attrs.to,
1385
1385
  id: e.attrs.id
1386
1386
  });
1387
1387
  }
1388
- function rt(e, t) {
1389
- let n = nt(e);
1388
+ function tt(e, t) {
1389
+ let n = et(e);
1390
1390
  return n.attrs.type = "result", t && n.append(t), n;
1391
1391
  }
1392
- function it(e, t, n) {
1393
- let r = nt(e);
1392
+ function nt(e, t, n) {
1393
+ let r = et(e);
1394
1394
  return r.attrs.type = "error", n && r.append(n), r.append(t), r;
1395
1395
  }
1396
- function at(e, t) {
1397
- return P("error", { type: e }, P(t, $e));
1396
+ function rt(e, t) {
1397
+ return I("error", { type: e }, I(t, Ze));
1398
1398
  }
1399
- function ot(e) {
1399
+ function it(e) {
1400
1400
  return async function(t, n) {
1401
- if (!et(t)) return n();
1401
+ if (!Qe(t)) return n();
1402
1402
  let { stanza: r } = t, i = r.getChildElements(), [a] = i;
1403
- if (!tt(t, i, a)) return it(t, at("modify", "bad-request"), a);
1403
+ if (!$e(t, i, a)) return nt(t, rt("modify", "bad-request"), a);
1404
1404
  t.element = a;
1405
1405
  let o;
1406
1406
  try {
1407
1407
  o = await n();
1408
1408
  } catch (t) {
1409
- e.emit("error", t), o = at("cancel", "internal-server-error");
1409
+ e.emit("error", t), o = rt("cancel", "internal-server-error");
1410
1410
  }
1411
- return o ||= at("cancel", "service-unavailable"), o instanceof P.Element && o.is("error") ? it(t, o, a) : rt(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
- function st(e, t, n, r) {
1414
+ function at(e, t, n, r) {
1415
1415
  return (i, a) => i.type !== e | !i.element || !i.element.is(n, t) ? a() : r(i, a);
1416
1416
  }
1417
- function ct({ middleware: e, entity: t }) {
1418
- return e.use(ot(t)), {
1417
+ function ot({ middleware: e, entity: t }) {
1418
+ return e.use(it(t)), {
1419
1419
  get(t, n, r) {
1420
- e.use(st("get", t, n, r));
1420
+ e.use(at("get", t, n, r));
1421
1421
  },
1422
1422
  set(t, n, r) {
1423
- e.use(st("set", t, n, r));
1423
+ e.use(at("set", t, n, r));
1424
1424
  }
1425
1425
  };
1426
1426
  }
1427
1427
  //#endregion
1428
1428
  //#region node_modules/@xmpp/resolve/lib/dns.js
1429
- var lt = ["ENOTFOUND", "ENODATA"];
1430
- function ut(e, t = {}) {
1429
+ var st = ["ENOTFOUND", "ENODATA"];
1430
+ function ct(e, t = {}) {
1431
1431
  return t.all = !0, new Promise((n, r) => {
1432
- L.default.lookup(e, t, (e, t) => {
1432
+ z.default.lookup(e, t, (e, t) => {
1433
1433
  if (e) return r(e);
1434
1434
  let i = [];
1435
1435
  for (let { family: e, address: n } of t) {
@@ -1448,17 +1448,17 @@ function ut(e, t = {}) {
1448
1448
  });
1449
1449
  });
1450
1450
  }
1451
- function dt(e, { service: t, protocol: n }) {
1451
+ function lt(e, { service: t, protocol: n }) {
1452
1452
  return new Promise((r, i) => {
1453
- L.default.resolveSrv(`_${t}._${n}.${e}`, (e, a) => {
1454
- e && lt.includes(e.code) ? r([]) : e ? i(e) : r(a.map((e) => Object.assign(e, {
1453
+ z.default.resolveSrv(`_${t}._${n}.${e}`, (e, a) => {
1454
+ e && st.includes(e.code) ? r([]) : e ? i(e) : r(a.map((e) => Object.assign(e, {
1455
1455
  service: t,
1456
1456
  protocol: n
1457
1457
  })));
1458
1458
  });
1459
1459
  });
1460
1460
  }
1461
- function ft(e) {
1461
+ function ut(e) {
1462
1462
  return e.toSorted((e, t) => {
1463
1463
  let n = e.priority - t.priority;
1464
1464
  if (n !== 0) return n;
@@ -1466,10 +1466,10 @@ function ft(e) {
1466
1466
  return r === 0 ? 0 : r;
1467
1467
  });
1468
1468
  }
1469
- function pt(e, t) {
1469
+ function dt(e, t) {
1470
1470
  let n = [];
1471
1471
  return Promise.all(e.map(async (e) => {
1472
- let r = await ut(e.name, t);
1472
+ let r = await ct(e.name, t);
1473
1473
  for (let t of r) {
1474
1474
  let { port: r, service: i } = e, a = t.address;
1475
1475
  n.push({
@@ -1480,7 +1480,7 @@ function pt(e, t) {
1480
1480
  }
1481
1481
  })).then(() => n);
1482
1482
  }
1483
- function mt(e, t = {}) {
1483
+ function ft(e, t = {}) {
1484
1484
  t.srv ||= [
1485
1485
  {
1486
1486
  service: "xmpps-client",
@@ -1524,15 +1524,15 @@ function mt(e, t = {}) {
1524
1524
  }
1525
1525
  ];
1526
1526
  let n = { options: t };
1527
- return ut(e, t).then((r) => Promise.all(t.srv.map((r) => dt(e, {
1527
+ return ct(e, t).then((r) => Promise.all(t.srv.map((r) => lt(e, {
1528
1528
  ...r,
1529
1529
  family: n
1530
- }).then((e) => pt(e, t)))).then((e) => [...ft(e.flat()), ...r]));
1530
+ }).then((e) => dt(e, t)))).then((e) => [...ut(e.flat()), ...r]));
1531
1531
  }
1532
1532
  //#endregion
1533
1533
  //#region node_modules/@xmpp/xml/lib/parse.js
1534
- function ht(e) {
1535
- let t = new pe(), n = null, r = null;
1534
+ function pt(e) {
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) => {
@@ -1544,19 +1544,19 @@ function ht(e) {
1544
1544
  }
1545
1545
  //#endregion
1546
1546
  //#region node_modules/@xmpp/resolve/lib/alt-connections.js
1547
- function gt(e) {
1547
+ function mt(e) {
1548
1548
  return e.startsWith("https") || e.startsWith("wss");
1549
1549
  }
1550
- function _t(e, t) {
1550
+ function ht(e, t) {
1551
1551
  let n;
1552
- if (n = gt(e.uri) && !gt(t.uri) ? -1 : !gt(e.uri) && gt(t.uri) ? 1 : 0, n !== 0) return n;
1552
+ if (n = mt(e.uri) && !mt(t.uri) ? -1 : !mt(e.uri) && mt(t.uri) ? 1 : 0, n !== 0) return n;
1553
1553
  let r;
1554
1554
  return r = e.method === t.method ? 0 : e.method === "websocket" ? -1 : t.method === "websocket" ? 1 : e.method === "xbosh" ? -1 : t.method === "xbosh" ? 1 : e.method === "httppoll" ? -1 : +(t.method === "httppoll"), r === 0 ? 0 : r;
1555
1555
  }
1556
1556
  //#endregion
1557
1557
  //#region node_modules/@xmpp/resolve/lib/http.js
1558
- function vt(e) {
1559
- return fetch(`https://${e}/.well-known/host-meta`).then((e) => e.text()).then((e) => ht(e).getChildren("Link").filter((e) => [
1558
+ function gt(e) {
1559
+ return fetch(`https://${e}/.well-known/host-meta`).then((e) => e.text()).then((e) => pt(e).getChildren("Link").filter((e) => [
1560
1560
  "urn:xmpp:alt-connections:websocket",
1561
1561
  "urn:xmpp:alt-connections:httppoll",
1562
1562
  "urn:xmpp:alt-connections:xbosh"
@@ -1565,17 +1565,17 @@ function vt(e) {
1565
1565
  href: e.href,
1566
1566
  method: e.rel.split(":").pop(),
1567
1567
  uri: e.href
1568
- })).toSorted(_t)).catch(() => []);
1568
+ })).toSorted(ht)).catch(() => []);
1569
1569
  }
1570
1570
  //#endregion
1571
1571
  //#region node_modules/@xmpp/resolve/resolve.js
1572
- function yt(...e) {
1573
- return Promise.all([mt ? mt(...e) : Promise.resolve([]), vt(...e)]).then(([e, t]) => [...e, ...t]);
1572
+ function _t(...e) {
1573
+ return Promise.all([ft ? ft(...e) : Promise.resolve([]), gt(...e)]).then(([e, t]) => [...e, ...t]);
1574
1574
  }
1575
1575
  //#endregion
1576
1576
  //#region node_modules/@xmpp/resolve/index.js
1577
- async function bt(e) {
1578
- let t = await yt(e, { srv: [{
1577
+ async function vt(e) {
1578
+ let t = await _t(e, { srv: [{
1579
1579
  service: "xmpps-client",
1580
1580
  protocol: "tcp"
1581
1581
  }, {
@@ -1584,30 +1584,30 @@ async function bt(e) {
1584
1584
  }] });
1585
1585
  return [...new Set(t.map((e) => e.uri))];
1586
1586
  }
1587
- function xt(e, t) {
1587
+ function yt(e, t) {
1588
1588
  return t.filter((t) => e._findTransport(t));
1589
1589
  }
1590
- async function St(e, t) {
1590
+ async function bt(e, t) {
1591
1591
  if (t.length === 0) throw Error("Couldn't connect");
1592
1592
  let n = t.shift(), r = e._findTransport(n);
1593
- if (!r) return St(e, t);
1593
+ if (!r) return 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 M(a, "connect");
1597
+ a.connect(i), await F(a, "connect");
1598
1598
  } catch {
1599
- return St(e, t);
1599
+ return bt(e, t);
1600
1600
  }
1601
1601
  e._attachSocket(a), a.emit("connect"), e.Transport = r, e.Socket = r.prototype.Socket, e.Parser = r.prototype.Parser;
1602
1602
  }
1603
- function Ct({ entity: e }) {
1603
+ function xt({ entity: e }) {
1604
1604
  let t = e.connect;
1605
1605
  e.connect = async function(n) {
1606
1606
  if (!n || /:\/\//.test(n)) return t.call(this, n);
1607
- let r = xt(e, await bt(n));
1607
+ let r = yt(e, await vt(n));
1608
1608
  if (r.length === 0) throw Error("No compatible transport found.");
1609
1609
  try {
1610
- await St(e, r);
1610
+ await bt(e, r);
1611
1611
  } catch (t) {
1612
1612
  throw await e.disconnect(), e._status("disconnect"), t;
1613
1613
  }
@@ -1615,19 +1615,19 @@ function Ct({ entity: e }) {
1615
1615
  }
1616
1616
  //#endregion
1617
1617
  //#region node_modules/@xmpp/base64/index.js
1618
- function wt(e) {
1618
+ function St(e) {
1619
1619
  return globalThis.btoa(e);
1620
1620
  }
1621
- function Tt(e) {
1621
+ function Ct(e) {
1622
1622
  return globalThis.atob(e);
1623
1623
  }
1624
1624
  //#endregion
1625
1625
  //#region node_modules/@xmpp/sasl/lib/SASLError.js
1626
- var R = class extends be {
1626
+ var wt = class extends ve {
1627
1627
  constructor(...e) {
1628
1628
  super(...e), this.name = "SASLError";
1629
1629
  }
1630
- }, z = "urn:ietf:params:xml:ns:xmpp-sasl";
1630
+ }, Tt = "urn:ietf:params:xml:ns:xmpp-sasl";
1631
1631
  function Et(e, t, n) {
1632
1632
  let r = new Set(e.getChildren("mechanism", t).map((e) => e.text()));
1633
1633
  return n._mechs.map(({ name: e }) => e).filter((e) => r.has(e));
@@ -1645,29 +1645,29 @@ async function Dt({ saslFactory: e, entity: t, mechanism: n, credentials: r }) {
1645
1645
  serviceName: a,
1646
1646
  ...r
1647
1647
  };
1648
- await de(t, i.clientFirst && P("auth", {
1649
- xmlns: z,
1648
+ await ce(t, i.clientFirst && I("auth", {
1649
+ xmlns: Tt,
1650
1650
  mechanism: i.name
1651
- }, wt(await i.response(o))), async (e, n) => {
1652
- if (e.getNS() === z) {
1651
+ }, St(await i.response(o))), async (e, n) => {
1652
+ if (e.getNS() === Tt) {
1653
1653
  if (e.name === "challenge") {
1654
- await i.challenge(Tt(e.text()));
1654
+ await i.challenge(Ct(e.text()));
1655
1655
  let n = await i.response(o);
1656
- await t.send(P("response", {
1657
- xmlns: z,
1656
+ await t.send(I("response", {
1657
+ xmlns: Tt,
1658
1658
  mechanism: i.name
1659
- }, typeof n == "string" ? wt(n) : ""));
1659
+ }, typeof n == "string" ? St(n) : ""));
1660
1660
  return;
1661
1661
  }
1662
- if (e.name === "failure") throw R.fromElement(e);
1662
+ if (e.name === "failure") throw wt.fromElement(e);
1663
1663
  if (e.name === "success") return n();
1664
1664
  }
1665
1665
  });
1666
1666
  }
1667
1667
  function Ot({ streamFeatures: e, saslFactory: t }, n) {
1668
- e.use("mechanisms", z, async ({ entity: e }, r, i) => {
1669
- let a = Et(i, z, t);
1670
- if (a.length === 0) throw new R("SASL: No compatible mechanism available.");
1668
+ e.use("mechanisms", Tt, async ({ entity: e }, r, i) => {
1669
+ let a = Et(i, Tt, t);
1670
+ if (a.length === 0) throw new wt("SASL: No compatible mechanism available.");
1671
1671
  async function o(n, r) {
1672
1672
  await Dt({
1673
1673
  saslFactory: t,
@@ -1695,29 +1695,29 @@ async function At({ saslFactory: e, entity: t, mechanism: n, credentials: r, use
1695
1695
  serviceName: c,
1696
1696
  ...r
1697
1697
  };
1698
- await de(t, P("authenticate", {
1698
+ await ce(t, I("authenticate", {
1699
1699
  xmlns: kt,
1700
1700
  mechanism: s.name
1701
1701
  }, [
1702
- s.clientFirst && P("initial-response", {}, wt(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) => {
1706
1706
  if (e.getNS() === kt) {
1707
1707
  if (e.name === "challenge") {
1708
- await s.challenge(Tt(e.text()));
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
- }, typeof n == "string" ? wt(n) : ""));
1713
+ }, typeof n == "string" ? St(n) : ""));
1714
1714
  return;
1715
1715
  }
1716
- if (e.name === "failure") throw R.fromElement(e);
1716
+ if (e.name === "failure") throw wt.fromElement(e);
1717
1717
  if (e.name === "continue") throw Error("SASL continue is not supported yet");
1718
1718
  if (e.name === "success") {
1719
1719
  let r = e.getChild("additional-data")?.text();
1720
- r && s.final && await s.final(Tt(r));
1720
+ r && s.final && await s.final(Ct(r));
1721
1721
  let i = e.getChildText("authorization-identifier");
1722
1722
  i && t._jid(i);
1723
1723
  for (let t of e.getChildElements()) o.get(t.getNS())?.[1]?.(t);
@@ -1733,7 +1733,7 @@ function jt({ streamFeatures: e, saslFactory: t }, n) {
1733
1733
  element: o,
1734
1734
  features: r
1735
1735
  }), l = !!i?.mechanism;
1736
- if (s.length === 0 && !l) throw new R("SASL: No compatible mechanism available.");
1736
+ if (s.length === 0 && !l) throw new wt("SASL: No compatible mechanism available.");
1737
1737
  await n(u, s, l ? i : null, e);
1738
1738
  async function u(n, a, o) {
1739
1739
  await i.auth({
@@ -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 de(e, Wt({ sm: t }), (e, t) => {
1835
+ return ce(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 be.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 de(e, Gt({ sm: t }), (e, t) => {
1841
+ return ce(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 be.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 j.EventEmitter();
1864
+ let a = null, o = null, s = null, c = new P.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 j.EventEmitter();
2037
+ let n = new Qt.default(), r, i = new P.EventEmitter();
2038
2038
  Object.assign(i, {
2039
2039
  mechanism: null,
2040
2040
  mechanisms: [],
@@ -2081,13 +2081,13 @@ 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
2088
2088
  }), !0;
2089
2089
  } catch (e) {
2090
- return e instanceof R && ["not-authorized", "credentials-expired"].includes(e.condition) ? l() : (t.emit("error", e), !1);
2090
+ return e instanceof wt && ["not-authorized", "credentials-expired"].includes(e.condition) ? l() : (t.emit("error", e), !1);
2091
2091
  }
2092
2092
  async function l() {
2093
2093
  return await i.delete(), a(o), !1;
@@ -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
  }));
@@ -2220,21 +2220,21 @@ function pn(e) {
2220
2220
  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
- let l = new Oe(o);
2224
- r && o.domain && (l.jid = I(r, o.domain));
2225
- let u = Ae({ entity: l }), d = Le({ entity: l }), f = hn(L.default, { entity: l }), p = hn(L.default, { entity: l }), m = Ke({ entity: l }), h = qe({ middleware: m }), g = Qe({
2223
+ let l = new Ee(o);
2224
+ r && o.domain && (l.jid = R(r, o.domain));
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
2228
- }), _ = ct({
2228
+ }), _ = ot({
2229
2229
  middleware: m,
2230
2230
  entity: l
2231
- }), v = Ct({ entity: l }), y = new Qt.default(), b = Object.entries({
2232
- ...typeof L.default == "function" && { scramsha1: L.default },
2231
+ }), v = xt({ entity: l }), y = new Qt.default(), b = Object.entries({
2232
+ ...typeof z.default == "function" && { scramsha1: z.default },
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() });
2237
- let x = hn(L.default, { streamFeatures: h }), S = jt({
2236
+ a ??= I("user-agent", { id: globalThis.crypto.randomUUID() });
2237
+ let x = hn(z.default, { streamFeatures: h }), S = jt({
2238
2238
  streamFeatures: h,
2239
2239
  saslFactory: y
2240
2240
  }, dn(n ?? {
@@ -2360,10 +2360,10 @@ var U = {
2360
2360
  }
2361
2361
  this.attempt = 0, this.connected = !0;
2362
2362
  try {
2363
- await this.xmpp.send(P("iq", {
2363
+ await this.xmpp.send(I("iq", {
2364
2364
  type: "set",
2365
2365
  id: "carbons"
2366
- }, P("enable", { xmlns: U.carbons }))), await this.xmpp.send(P("presence"));
2366
+ }, I("enable", { xmlns: U.carbons }))), await this.xmpp.send(I("presence"));
2367
2367
  } catch {
2368
2368
  return;
2369
2369
  }
@@ -2389,10 +2389,10 @@ var U = {
2389
2389
  document.visibilityState === "visible" && this.wake();
2390
2390
  };
2391
2391
  ping() {
2392
- this.connected && this.xmpp.iqCaller.request(P("iq", {
2392
+ this.connected && this.xmpp.iqCaller.request(I("iq", {
2393
2393
  type: "get",
2394
2394
  to: this.domain
2395
- }, P("ping", { xmlns: U.ping })), 1e4).catch((e) => {
2395
+ }, I("ping", { xmlns: U.ping })), 1e4).catch((e) => {
2396
2396
  !this.stopped && this.connected && e.name !== "StanzaError" && this.xmpp.disconnect().catch(() => {});
2397
2397
  });
2398
2398
  }
@@ -2424,14 +2424,14 @@ var U = {
2424
2424
  }
2425
2425
  async send(e, t, n) {
2426
2426
  let r = crypto.randomUUID(), i = [
2427
- P("body", {}, t),
2428
- P("origin-id", {
2427
+ I("body", {}, t),
2428
+ I("origin-id", {
2429
2429
  xmlns: U.sid,
2430
2430
  id: r
2431
2431
  }),
2432
- P("store", { xmlns: U.hints })
2432
+ I("store", { xmlns: U.hints })
2433
2433
  ];
2434
- return n && i.push(P("x", { xmlns: U.oob }, P("url", {}, n))), this.isGroup(e) ? (await this.xmpp.send(P("message", {
2434
+ return n && i.push(I("x", { xmlns: U.oob }, I("url", {}, n))), this.isGroup(e) ? (await this.xmpp.send(I("message", {
2435
2435
  to: e,
2436
2436
  type: "groupchat",
2437
2437
  id: r
@@ -2446,7 +2446,7 @@ var U = {
2446
2446
  oob: n,
2447
2447
  room: e,
2448
2448
  nick: this.cfg.username
2449
- }) : (i.push(P("active", { xmlns: U.chatstates })), await this.xmpp.send(P("message", {
2449
+ }) : (i.push(I("active", { xmlns: U.chatstates })), await this.xmpp.send(I("message", {
2450
2450
  to: `${e}@${this.domain}`,
2451
2451
  type: "chat",
2452
2452
  id: r
@@ -2462,34 +2462,34 @@ var U = {
2462
2462
  });
2463
2463
  }
2464
2464
  async react(e, t, n) {
2465
- let r = this.isGroup(e), i = P("reactions", {
2465
+ let r = this.isGroup(e), i = I("reactions", {
2466
2466
  xmlns: U.reactions,
2467
2467
  id: t
2468
- }, ...n.map((e) => P("reaction", {}, e)));
2469
- await this.xmpp.send(P("message", {
2468
+ }, ...n.map((e) => I("reaction", {}, e)));
2469
+ await this.xmpp.send(I("message", {
2470
2470
  to: r ? e : `${e}@${this.domain}`,
2471
2471
  type: r ? "groupchat" : "chat",
2472
2472
  id: crypto.randomUUID()
2473
- }, i, P("store", { xmlns: U.hints })));
2473
+ }, i, I("store", { xmlns: U.hints })));
2474
2474
  }
2475
2475
  async announce(e) {
2476
- for (let t of e) await this.xmpp.send(P("presence", { to: `${t}@${this.domain}` }, P("x", { xmlns: U.hello }))).catch(() => {});
2476
+ for (let t of e) await this.xmpp.send(I("presence", { to: `${t}@${this.domain}` }, I("x", { xmlns: U.hello }))).catch(() => {});
2477
2477
  }
2478
2478
  typing(e, t) {
2479
- return this.isGroup(e) ? Promise.resolve() : this.xmpp.send(P("message", {
2479
+ return this.isGroup(e) ? Promise.resolve() : this.xmpp.send(I("message", {
2480
2480
  to: `${e}@${this.domain}`,
2481
2481
  type: "chat"
2482
- }, P(t ? "composing" : "paused", { xmlns: U.chatstates })));
2482
+ }, I(t ? "composing" : "paused", { xmlns: U.chatstates })));
2483
2483
  }
2484
2484
  enablePush(e, t) {
2485
- return this.xmpp.iqCaller.request(P("iq", { type: "set" }, P("enable", {
2485
+ return this.xmpp.iqCaller.request(I("iq", { type: "set" }, I("enable", {
2486
2486
  xmlns: U.push,
2487
2487
  jid: e,
2488
2488
  node: t
2489
2489
  })), 15e3);
2490
2490
  }
2491
2491
  disablePush(e, t) {
2492
- return this.xmpp.iqCaller.request(P("iq", { type: "set" }, P("disable", {
2492
+ return this.xmpp.iqCaller.request(I("iq", { type: "set" }, I("disable", {
2493
2493
  xmlns: U.push,
2494
2494
  jid: e,
2495
2495
  node: t
@@ -2504,20 +2504,20 @@ var U = {
2504
2504
  async mam(e, t, n) {
2505
2505
  let r = crypto.randomUUID();
2506
2506
  this.mamQueries.set(r, []), this.mamReactions.set(r, []);
2507
- let i = P("set", { xmlns: U.rsm }, P("max", {}, String(n)), P("before", {}, t ?? "")), a = [P("field", {
2507
+ let i = I("set", { xmlns: U.rsm }, I("max", {}, String(n)), I("before", {}, t ?? "")), a = [I("field", {
2508
2508
  var: "FORM_TYPE",
2509
2509
  type: "hidden"
2510
- }, P("value", {}, U.mam))];
2511
- e && a.push(P("field", { var: "with" }, P("value", {}, this.isGroup(e) ? e : `${e}@${this.domain}`)));
2512
- let o = P("x", {
2510
+ }, I("value", {}, U.mam))];
2511
+ e && a.push(I("field", { var: "with" }, I("value", {}, this.isGroup(e) ? e : `${e}@${this.domain}`)));
2512
+ let o = I("x", {
2513
2513
  xmlns: U.data,
2514
2514
  type: "submit"
2515
2515
  }, ...a), s, c, l;
2516
2516
  try {
2517
- s = await this.xmpp.iqCaller.request(P("iq", {
2517
+ s = await this.xmpp.iqCaller.request(I("iq", {
2518
2518
  type: "set",
2519
2519
  id: r
2520
- }, P("query", {
2520
+ }, I("query", {
2521
2521
  xmlns: U.mam,
2522
2522
  queryid: r
2523
2523
  }, o, i)), 3e4);
@@ -2534,42 +2534,42 @@ var U = {
2534
2534
  }
2535
2535
  async createGroup(e, t, n) {
2536
2536
  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);
2537
- await this.xmpp.send(P("presence", { to: `${r}/${i}` }, P("x", { xmlns: U.muc }))), await a;
2538
- let o = (e, t) => P("field", { var: e }, P("value", {}, t));
2539
- await this.xmpp.iqCaller.request(P("iq", {
2537
+ await this.xmpp.send(I("presence", { to: `${r}/${i}` }, I("x", { xmlns: U.muc }))), await a;
2538
+ let o = (e, t) => I("field", { var: e }, I("value", {}, t));
2539
+ await this.xmpp.iqCaller.request(I("iq", {
2540
2540
  type: "set",
2541
2541
  to: r
2542
- }, P("query", { xmlns: U.mucOwner }, P("x", {
2542
+ }, I("query", { xmlns: U.mucOwner }, I("x", {
2543
2543
  xmlns: U.data,
2544
2544
  type: "submit"
2545
2545
  }, 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(() => {});
2546
2546
  let s = t.filter((e) => e && e !== this.cfg.username);
2547
- await this.xmpp.iqCaller.request(P("iq", {
2547
+ await this.xmpp.iqCaller.request(I("iq", {
2548
2548
  type: "set",
2549
2549
  to: r
2550
- }, P("query", { xmlns: U.mucAdmin }, ...s.map((e) => P("item", {
2550
+ }, I("query", { xmlns: U.mucAdmin }, ...s.map((e) => I("item", {
2551
2551
  affiliation: "member",
2552
2552
  jid: `${e}@${this.domain}`
2553
2553
  })))), 15e3);
2554
- for (let e of s) await this.xmpp.iqCaller.request(P("iq", {
2554
+ for (let e of s) await this.xmpp.iqCaller.request(I("iq", {
2555
2555
  type: "set",
2556
2556
  to: r
2557
- }, P("subscribe", {
2557
+ }, I("subscribe", {
2558
2558
  xmlns: U.mucsub,
2559
2559
  jid: `${e}@${this.domain}`,
2560
2560
  nick: e
2561
- }, P("event", { node: U.mucsubMessages }))), 15e3).catch(() => {});
2562
- await this.xmpp.iqCaller.request(P("iq", {
2561
+ }, I("event", { node: U.mucsubMessages }))), 15e3).catch(() => {});
2562
+ await this.xmpp.iqCaller.request(I("iq", {
2563
2563
  type: "set",
2564
2564
  to: r
2565
- }, P("subscribe", {
2565
+ }, I("subscribe", {
2566
2566
  xmlns: U.mucsub,
2567
2567
  nick: i
2568
- }, P("event", { node: U.mucsubMessages }))), 15e3), await this.xmpp.send(P("presence", {
2568
+ }, I("event", { node: U.mucsubMessages }))), 15e3), await this.xmpp.send(I("presence", {
2569
2569
  to: `${r}/${i}`,
2570
2570
  type: "unavailable"
2571
2571
  }));
2572
- for (let t of s) await this.xmpp.send(P("message", { to: `${t}@${this.domain}` }, P("x", {
2572
+ for (let t of s) await this.xmpp.send(I("message", { to: `${t}@${this.domain}` }, I("x", {
2573
2573
  xmlns: U.conference,
2574
2574
  jid: r,
2575
2575
  reason: e
@@ -2577,58 +2577,58 @@ var U = {
2577
2577
  return r;
2578
2578
  }
2579
2579
  async leaveGroup(e, t) {
2580
- t ? await this.xmpp.iqCaller.request(P("iq", {
2580
+ t ? await this.xmpp.iqCaller.request(I("iq", {
2581
2581
  type: "set",
2582
2582
  to: e
2583
- }, P("query", { xmlns: U.mucOwner }, P("destroy", {}))), 1e4) : await this.xmpp.iqCaller.request(P("iq", {
2583
+ }, I("query", { xmlns: U.mucOwner }, I("destroy", {}))), 1e4) : await this.xmpp.iqCaller.request(I("iq", {
2584
2584
  type: "set",
2585
2585
  to: e
2586
- }, P("unsubscribe", { xmlns: U.mucsub })), 1e4);
2586
+ }, I("unsubscribe", { xmlns: U.mucsub })), 1e4);
2587
2587
  }
2588
2588
  async setGroupAvatar(e, t) {
2589
2589
  let n = /^data:(image\/[a-z+]+);base64,(.+)$/i.exec(t);
2590
- n && await this.xmpp.iqCaller.request(P("iq", {
2590
+ n && await this.xmpp.iqCaller.request(I("iq", {
2591
2591
  type: "set",
2592
2592
  to: e
2593
- }, P("vCard", { xmlns: U.vcard }, P("PHOTO", {}, P("TYPE", {}, n[1]), P("BINVAL", {}, n[2])))), 15e3);
2593
+ }, I("vCard", { xmlns: U.vcard }, I("PHOTO", {}, I("TYPE", {}, n[1]), I("BINVAL", {}, n[2])))), 15e3);
2594
2594
  }
2595
2595
  async groupAvatar(e) {
2596
- let t = (await this.xmpp.iqCaller.request(P("iq", {
2596
+ let t = (await this.xmpp.iqCaller.request(I("iq", {
2597
2597
  type: "get",
2598
2598
  to: e
2599
- }, P("vCard", { xmlns: U.vcard })), 1e4)).getChild("vCard", U.vcard)?.getChild("PHOTO"), n = t?.getChildText("BINVAL");
2599
+ }, I("vCard", { xmlns: U.vcard })), 1e4)).getChild("vCard", U.vcard)?.getChild("PHOTO"), n = t?.getChildText("BINVAL");
2600
2600
  return n ? `data:${t?.getChildText("TYPE") || "image/jpeg"};base64,${n.replace(/\s+/g, "")}` : void 0;
2601
2601
  }
2602
2602
  async listGroups() {
2603
- let e = ((await this.xmpp.iqCaller.request(P("iq", {
2603
+ let e = ((await this.xmpp.iqCaller.request(I("iq", {
2604
2604
  type: "get",
2605
2605
  to: this.mucHost
2606
- }, P("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).map((e) => e.attrs.jid);
2606
+ }, I("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).map((e) => e.attrs.jid);
2607
2607
  return Promise.all(e.map((e) => this.groupInfo(e)));
2608
2608
  }
2609
2609
  async subscribed(e) {
2610
- return ((await this.xmpp.iqCaller.request(P("iq", {
2610
+ return ((await this.xmpp.iqCaller.request(I("iq", {
2611
2611
  type: "get",
2612
2612
  to: this.mucHost
2613
- }, P("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).some((t) => W(t.attrs.jid) === e);
2613
+ }, I("subscriptions", { xmlns: U.mucsub })), 15e3)).getChild("subscriptions", U.mucsub)?.getChildren("subscription") ?? []).some((t) => W(t.attrs.jid) === e);
2614
2614
  }
2615
2615
  async groupInfo(e) {
2616
2616
  let t = e.split("@")[0], n = [], r = !1;
2617
2617
  try {
2618
- t = (await this.xmpp.iqCaller.request(P("iq", {
2618
+ t = (await this.xmpp.iqCaller.request(I("iq", {
2619
2619
  type: "get",
2620
2620
  to: e
2621
- }, P("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChild("identity")?.attrs.name || t;
2621
+ }, I("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChild("identity")?.attrs.name || t;
2622
2622
  } catch {}
2623
2623
  try {
2624
- n = ((await this.xmpp.iqCaller.request(P("iq", {
2624
+ n = ((await this.xmpp.iqCaller.request(I("iq", {
2625
2625
  type: "get",
2626
2626
  to: e
2627
- }, P("query", { xmlns: U.mucAdmin }, P("item", { affiliation: "member" }))), 1e4)).getChild("query", U.mucAdmin)?.getChildren("item") ?? []).map((e) => G(e.attrs.jid));
2628
- let t = await this.xmpp.iqCaller.request(P("iq", {
2627
+ }, I("query", { xmlns: U.mucAdmin }, I("item", { affiliation: "member" }))), 1e4)).getChild("query", U.mucAdmin)?.getChildren("item") ?? []).map((e) => G(e.attrs.jid));
2628
+ let t = await this.xmpp.iqCaller.request(I("iq", {
2629
2629
  type: "get",
2630
2630
  to: e
2631
- }, P("query", { xmlns: U.mucAdmin }, P("item", { affiliation: "owner" }))), 1e4);
2631
+ }, I("query", { xmlns: U.mucAdmin }, I("item", { affiliation: "owner" }))), 1e4);
2632
2632
  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);
2633
2633
  } catch {}
2634
2634
  let i = await this.groupAvatar(e).catch(() => void 0);
@@ -2641,10 +2641,10 @@ var U = {
2641
2641
  };
2642
2642
  }
2643
2643
  async upload(e) {
2644
- let t = await this.findUploadService(), n = (await this.xmpp.iqCaller.request(P("iq", {
2644
+ let t = await this.findUploadService(), n = (await this.xmpp.iqCaller.request(I("iq", {
2645
2645
  type: "get",
2646
2646
  to: t
2647
- }, P("request", {
2647
+ }, I("request", {
2648
2648
  xmlns: U.upload,
2649
2649
  filename: e.name,
2650
2650
  size: String(e.size),
@@ -2665,19 +2665,19 @@ var U = {
2665
2665
  if (this.uploadService) return this.uploadService;
2666
2666
  let e = async (e) => {
2667
2667
  try {
2668
- return (await this.xmpp.iqCaller.request(P("iq", {
2668
+ return (await this.xmpp.iqCaller.request(I("iq", {
2669
2669
  type: "get",
2670
2670
  to: e
2671
- }, P("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChildren("feature").some((e) => e.attrs.var === U.upload) ?? !1;
2671
+ }, I("query", { xmlns: U.discoInfo })), 1e4)).getChild("query", U.discoInfo)?.getChildren("feature").some((e) => e.attrs.var === U.upload) ?? !1;
2672
2672
  } catch {
2673
2673
  return !1;
2674
2674
  }
2675
2675
  }, t = [`upload.${this.domain}`];
2676
2676
  try {
2677
- let e = await this.xmpp.iqCaller.request(P("iq", {
2677
+ let e = await this.xmpp.iqCaller.request(I("iq", {
2678
2678
  type: "get",
2679
2679
  to: this.domain
2680
- }, P("query", { xmlns: U.disco })), 1e4);
2680
+ }, I("query", { xmlns: U.disco })), 1e4);
2681
2681
  for (let n of e.getChild("query", U.disco)?.getChildren("item") ?? []) t.includes(n.attrs.jid) || t.push(n.attrs.jid);
2682
2682
  } catch {}
2683
2683
  for (let n of t) if (await e(n)) return this.uploadService = n, n;
@@ -2704,7 +2704,7 @@ var U = {
2704
2704
  let r = G(n), i = this.online.get(r) ?? /* @__PURE__ */ new Set();
2705
2705
  e.attrs.type === "unavailable" ? i.delete(t) : i.add(t), this.online.set(r, i), this.h.presence(r, i.size > 0);
2706
2706
  let a = e.getChild("x", U.hello);
2707
- a && !a.attrs.reply && e.attrs.type !== "unavailable" && this.xmpp.send(P("presence", { to: n }, P("x", {
2707
+ a && !a.attrs.reply && e.attrs.type !== "unavailable" && this.xmpp.send(I("presence", { to: n }, I("x", {
2708
2708
  xmlns: U.hello,
2709
2709
  reply: "1"
2710
2710
  }))).catch(() => {});
@@ -3385,7 +3385,7 @@ function Kn({ onDragStart: e, pushButton: t = !0 }) {
3385
3385
  newChatButton: e.newChatButton
3386
3386
  })));
3387
3387
  return /* @__PURE__ */ f("div", {
3388
- className: "ci-flex ci-flex-col-reverse ci-items-center ci-gap-3 ci-mb-3 ci-cursor-grab active:ci-cursor-grabbing ci-touch-none",
3388
+ className: `ci-flex ci-flex-col-reverse ci-items-center ci-gap-3 ci-mb-3 ${e ? "ci-cursor-grab active:ci-cursor-grabbing ci-touch-none" : ""}`,
3389
3389
  onPointerDown: e,
3390
3390
  children: [
3391
3391
  n.map((e) => {
@@ -4157,15 +4157,15 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4157
4157
  a(() => {
4158
4158
  m.current !== null && (g.current?.setSelectionRange(m.current, m.current), m.current = null);
4159
4159
  }, [o]);
4160
- let ee = (e) => {
4160
+ let k = (e) => {
4161
4161
  let t = g.current, n = t?.selectionStart ?? o.length, r = t?.selectionEnd ?? n;
4162
4162
  O(o.slice(0, n) + e + o.slice(r)), requestAnimationFrame(() => {
4163
4163
  t?.focus(), t?.setSelectionRange(n + e.length, n + e.length);
4164
4164
  });
4165
- }, te = () => {
4165
+ }, A = () => {
4166
4166
  let t = o.trim();
4167
4167
  t && (l(""), Promise.resolve(e(t)).catch(() => l((e) => e || t)), window.clearTimeout(_.current), v.current = !1);
4168
- }, ne = async () => {
4168
+ }, ee = async () => {
4169
4169
  if (w.current || y) return;
4170
4170
  w.current = !0;
4171
4171
  let e;
@@ -4191,7 +4191,7 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4191
4191
  } finally {
4192
4192
  w.current = !1;
4193
4193
  }
4194
- }, k = (e) => {
4194
+ }, j = (e) => {
4195
4195
  C.current = e, y?.r.stop();
4196
4196
  };
4197
4197
  return y ? /* @__PURE__ */ f("div", {
@@ -4201,7 +4201,7 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4201
4201
  variant: "transparent",
4202
4202
  title: "Discard",
4203
4203
  "aria-label": "Discard",
4204
- onClick: () => k(!0),
4204
+ onClick: () => j(!0),
4205
4205
  className: "ci-h-10 ci-w-10",
4206
4206
  children: Q.close
4207
4207
  }),
@@ -4213,7 +4213,7 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4213
4213
  variant: "green",
4214
4214
  title: "Send voice note",
4215
4215
  "aria-label": "Send voice note",
4216
- onClick: () => k(!1),
4216
+ onClick: () => j(!1),
4217
4217
  className: "ci-h-10 ci-w-10",
4218
4218
  children: Q.send
4219
4219
  })
@@ -4223,7 +4223,7 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4223
4223
  children: [
4224
4224
  u && /* @__PURE__ */ d($n, {
4225
4225
  className: "ci-absolute ci-bottom-full ci-left-3 ci-mb-1",
4226
- onPick: ee,
4226
+ onPick: k,
4227
4227
  onClose: () => p(!1)
4228
4228
  }),
4229
4229
  /* @__PURE__ */ d("input", {
@@ -4260,7 +4260,7 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4260
4260
  onChange: (e) => O(e.target.value),
4261
4261
  onKeyDown: (e) => {
4262
4262
  let t = (o.match(/```/g) ?? []).length % 2 == 1;
4263
- e.key === "Enter" && !e.shiftKey && !t && (e.preventDefault(), te());
4263
+ e.key === "Enter" && !e.shiftKey && !t && (e.preventDefault(), A());
4264
4264
  },
4265
4265
  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",
4266
4266
  style: { height: Math.min(128, 40 + 20 * (o.split("\n").length - 1)) }
@@ -4269,14 +4269,14 @@ function kr({ onSend: e, onTyping: t, onFile: n, disabled: r }) {
4269
4269
  o.trim() ? /* @__PURE__ */ d(Z, {
4270
4270
  variant: "default",
4271
4271
  disabled: r,
4272
- onClick: te,
4272
+ onClick: A,
4273
4273
  title: "Send",
4274
4274
  className: "ci-h-10 ci-w-10",
4275
4275
  children: Q.send
4276
4276
  }) : /* @__PURE__ */ d(Z, {
4277
4277
  variant: "default",
4278
4278
  disabled: r || typeof MediaRecorder > "u",
4279
- onClick: ne,
4279
+ onClick: ee,
4280
4280
  title: "Record a voice note",
4281
4281
  "aria-label": "Record a voice note",
4282
4282
  className: "ci-h-10 ci-w-10",
@@ -4325,7 +4325,7 @@ function jr({ peer: e, actions: t, onDragStart: n }) {
4325
4325
  "aria-hidden": "true"
4326
4326
  }),
4327
4327
  /* @__PURE__ */ f("div", {
4328
- className: "ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-3 ci-cursor-grab active:ci-cursor-grabbing ci-touch-none ci-rounded-t-3xl",
4328
+ 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" : ""}`,
4329
4329
  onPointerDown: n,
4330
4330
  children: [
4331
4331
  r.kind === "group" ? /* @__PURE__ */ d(Un, {
@@ -4685,30 +4685,30 @@ function zr(e) {
4685
4685
  }
4686
4686
  }
4687
4687
  var Br = (e) => (sr(e) ? "Attachment" : $(e)).replace(/```[^\n]*\n?/g, "").replace(/(\*\*|__|~~|`)/g, "").replace(/(^|\s)[*_](\S[^*_]*)[*_]/g, "$1$2").replace(/\s+/g, " ").trim();
4688
- function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWorker: r, maxHeads: a = 5, newChatButton: l = !0, notifications: u = "click", sound: p = !0 }) {
4689
- let m = o(() => zr(e), [e]), h = Ir(n), g = s(m), _ = s(p), v = s(u);
4688
+ function Vr({ 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 }) {
4689
+ let h = o(() => zr(e), [e]), g = Ir(n), _ = s(h), v = s(p), y = s(u);
4690
4690
  i(() => {
4691
- g.current = m, _.current = p, v.current = u;
4691
+ _.current = h, v.current = p, y.current = u;
4692
4692
  }, [
4693
- m,
4693
+ h,
4694
4694
  p,
4695
4695
  u
4696
4696
  ]), i(() => J.setState({
4697
4697
  maxHeads: a,
4698
4698
  newChatButton: l
4699
4699
  }), [a, l]);
4700
- let [y, b] = c(0);
4700
+ let [b, x] = c(0);
4701
4701
  i(() => {
4702
- let e = (e) => e.persisted && b((e) => e + 1);
4702
+ let e = (e) => e.persisted && x((e) => e + 1);
4703
4703
  return window.addEventListener("pageshow", e), () => window.removeEventListener("pageshow", e);
4704
4704
  }, []);
4705
- let x = s(null), S = s(/* @__PURE__ */ new Set()), C = s(!1), T = s(null), D = s(null), O = E(D, `chat-island-pos:${m?.host ?? ""}:${m?.username ?? ""}`), { open: ee, picker: te, status: ne } = J(w((e) => ({
4705
+ let S = s(null), C = s(/* @__PURE__ */ new Set()), T = s(!1), D = s(null), O = s(null), k = E(O, `chat-island-pos:${h?.host ?? ""}:${h?.username ?? ""}`), { open: A, picker: ee, status: j } = J(w((e) => ({
4706
4706
  open: e.open,
4707
4707
  picker: e.picker,
4708
4708
  status: e.status
4709
- }))), k = o(() => ({
4709
+ }))), M = o(() => ({
4710
4710
  send: async (e, t) => {
4711
- let n = x.current;
4711
+ let n = S.current;
4712
4712
  if (!n) throw Error("not connected");
4713
4713
  try {
4714
4714
  J.getState().addMessage(e, await n.send(e, $(t)));
@@ -4719,9 +4719,9 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4719
4719
  }), e;
4720
4720
  }
4721
4721
  },
4722
- typing: (e, t) => J.getState().online[e] && x.current?.typing(e, t).catch(() => {}),
4722
+ typing: (e, t) => J.getState().online[e] && S.current?.typing(e, t).catch(() => {}),
4723
4723
  upload: async (e, t) => {
4724
- let n = x.current;
4724
+ let n = S.current;
4725
4725
  if (n) try {
4726
4726
  let r = await n.upload(t);
4727
4727
  J.getState().addMessage(e, await n.send(e, t.name, r));
@@ -4733,7 +4733,7 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4733
4733
  }
4734
4734
  },
4735
4735
  createGroup: async (e, t, n) => {
4736
- let r = x.current, i = g.current;
4736
+ let r = S.current, i = _.current;
4737
4737
  if (r && i) try {
4738
4738
  let a = await r.createGroup(e, t, n), o = J.getState();
4739
4739
  o.setGroup(a, e, [...t, i.username], n), o.openChat(a);
@@ -4745,7 +4745,7 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4745
4745
  }
4746
4746
  },
4747
4747
  remove: async (e) => {
4748
- let t = x.current, n = g.current;
4748
+ let t = S.current, n = _.current;
4749
4749
  if (!t || !n) return;
4750
4750
  let r = J.getState().conversations[e];
4751
4751
  try {
@@ -4758,7 +4758,7 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4758
4758
  }
4759
4759
  },
4760
4760
  react: async (e, t, n) => {
4761
- let r = x.current, i = g.current?.username;
4761
+ let r = S.current, i = _.current?.username;
4762
4762
  if (!r || !i) return;
4763
4763
  let a = (J.getState().conversations[e]?.reactions?.[t]?.[i] ?? []).includes(n) ? [] : [n];
4764
4764
  try {
@@ -4776,9 +4776,9 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4776
4776
  }
4777
4777
  },
4778
4778
  loadOlder: async (e) => {
4779
- let t = x.current, n = J.getState().ensure(e);
4780
- if (!(!t || n.complete || S.current.has(e))) {
4781
- S.current.add(e);
4779
+ let t = S.current, n = J.getState().ensure(e);
4780
+ if (!(!t || n.complete || C.current.has(e))) {
4781
+ C.current.add(e);
4782
4782
  try {
4783
4783
  let r = await t.history(e, n.oldest);
4784
4784
  J.getState().prependHistory(e, r.messages, r.complete, r.first), J.getState().applyReactions(r.reactions);
@@ -4788,31 +4788,31 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4788
4788
  message: e.message
4789
4789
  });
4790
4790
  } finally {
4791
- S.current.delete(e);
4791
+ C.current.delete(e);
4792
4792
  }
4793
4793
  }
4794
4794
  }
4795
4795
  }), []);
4796
4796
  i(() => {
4797
- if (!m) return;
4797
+ if (!h) return;
4798
4798
  let e = J.getState();
4799
4799
  e.reset(), J.setState({
4800
- me: m.username,
4801
- mucHost: `conference.${m.host}`,
4800
+ me: h.username,
4801
+ mucHost: `conference.${h.host}`,
4802
4802
  maxHeads: a,
4803
4803
  newChatButton: l
4804
4804
  });
4805
- let t = new _n(m, {
4805
+ let t = new _n(h, {
4806
4806
  status: (n, a) => {
4807
4807
  if (e.setStatus(n, a), Y("chat-island-status", {
4808
4808
  status: n,
4809
4809
  error: a
4810
- }), n === "online" && r && !C.current && typeof Notification < "u") {
4810
+ }), n === "online" && r && !T.current && typeof Notification < "u") {
4811
4811
  let e = Notification.permission;
4812
- (e === "granted" || v.current === "auto" && e === "default") && i();
4812
+ (e === "granted" || y.current === "auto" && e === "default") && i();
4813
4813
  }
4814
4814
  n === "online" && t.listGroups().then((t) => t.forEach((t) => e.setGroup(t.peer, t.name, t.members, t.avatar, t.owner))).catch(() => {}).then(() => t.recent()).then((e) => {
4815
- e && (J.getState().seed(e.messages, m.username), J.getState().applyReactions(e.reactions));
4815
+ e && (J.getState().seed(e.messages, h.username), J.getState().applyReactions(e.reactions));
4816
4816
  }).catch(() => {});
4817
4817
  },
4818
4818
  typing: (t, n) => e.setTyping(t, n),
@@ -4836,7 +4836,7 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4836
4836
  let n = J.getState(), r = document.visibilityState === "visible";
4837
4837
  if (r && n.open === e) return;
4838
4838
  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" && t.nick ? `${n.contacts[t.nick]?.name ?? t.nick}: ${o}` : o;
4839
- if (_.current && xn(), Y("chat-island-notify", {
4839
+ if (v.current && xn(), Y("chat-island-notify", {
4840
4840
  peer: e,
4841
4841
  name: a,
4842
4842
  body: s
@@ -4850,18 +4850,18 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4850
4850
  };
4851
4851
  } catch {}
4852
4852
  };
4853
- x.current = t;
4853
+ S.current = t;
4854
4854
  let i = () => {
4855
- r && !C.current && (C.current = !0, zn(m, r).then((e) => {
4855
+ r && !T.current && (T.current = !0, zn(h, r).then((e) => {
4856
4856
  if (!e) {
4857
- C.current = !1, J.setState({ push: Notification.permission === "denied" ? "denied" : "ask" });
4857
+ T.current = !1, J.setState({ push: Notification.permission === "denied" ? "denied" : "ask" });
4858
4858
  return;
4859
4859
  }
4860
4860
  return t.enablePush(e.service, e.node).then(() => {
4861
- T.current = e, J.setState({ push: "enabled" }), Y("chat-island-push", { enabled: !0 });
4861
+ D.current = e, J.setState({ push: "enabled" }), Y("chat-island-push", { enabled: !0 });
4862
4862
  });
4863
4863
  }).catch((e) => {
4864
- C.current = !1, Y("chat-island-error", {
4864
+ T.current = !1, Y("chat-island-error", {
4865
4865
  scope: "push",
4866
4866
  message: e.message
4867
4867
  });
@@ -4873,52 +4873,52 @@ function Vr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
4873
4873
  });
4874
4874
  let s = () => t.stop();
4875
4875
  window.addEventListener("pagehide", s), t.start();
4876
- let c = () => Pn(m.host, m.token).then(e.setMobile).catch(() => {});
4876
+ let c = () => Pn(h.host, h.token).then(e.setMobile).catch(() => {});
4877
4877
  c();
4878
4878
  let u = window.setInterval(c, 12e4);
4879
- Nn(m.host, m.token, m.username).then(e.setContacts).catch((e) => Y("chat-island-error", {
4879
+ Nn(h.host, h.token, h.username).then(e.setContacts).catch((e) => Y("chat-island-error", {
4880
4880
  scope: "contacts",
4881
4881
  message: e.message
4882
4882
  }));
4883
- 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)), h = X("chat-island-delete", ({ username: e }) => e && k.remove(e)), g = X("chat-island-contacts", ({ contacts: t }) => t && e.setContacts(t)), y = X("chat-island-conversations-request", () => Y("chat-island-conversations", { conversations: Lr() }));
4883
+ 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)), g = X("chat-island-contacts", ({ contacts: t }) => t && e.setContacts(t)), _ = X("chat-island-conversations-request", () => Y("chat-island-conversations", { conversations: Lr() }));
4884
4884
  return () => {
4885
- window.removeEventListener("pagehide", s), window.clearInterval(u), y(), p(), h(), d(), f(), g(), T.current && t.disablePush(T.current.service, T.current.node).catch(() => {}), T.current = null, t.stop(), x.current = null, C.current = !1;
4885
+ window.removeEventListener("pagehide", s), window.clearInterval(u), _(), p(), m(), d(), f(), g(), D.current && t.disablePush(D.current.service, D.current.node).catch(() => {}), D.current = null, t.stop(), S.current = null, T.current = !1;
4886
4886
  };
4887
4887
  }, [
4888
- m,
4888
+ h,
4889
4889
  r,
4890
- y
4890
+ b
4891
4891
  ]);
4892
- let A = J((e) => Object.keys(e.contacts).join(","));
4892
+ let N = J((e) => Object.keys(e.contacts).join(","));
4893
4893
  i(() => {
4894
- ne === "online" && A && x.current?.announce(A.split(","));
4895
- }, [ne, A]);
4896
- 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);
4897
- i(() => Y("chat-island-conversations", { conversations: Lr() }), [re]);
4898
- let j = J((e) => Object.values(e.conversations).reduce((e, t) => e + t.unread, 0));
4899
- if (i(() => Y("chat-island-unread", { total: j }), [j]), !m) return null;
4900
- let ie = O.anchor ? {
4901
- right: O.anchor.right,
4902
- bottom: O.anchor.bottom
4903
- } : void 0, ae = ie ? "" : t === "bottom-left" ? "ci-left-4 ci-bottom-5" : "ci-right-4 ci-bottom-5";
4894
+ j === "online" && N && S.current?.announce(N.split(","));
4895
+ }, [j, N]);
4896
+ let P = 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);
4897
+ i(() => Y("chat-island-conversations", { conversations: Lr() }), [P]);
4898
+ let te = J((e) => Object.values(e.conversations).reduce((e, t) => e + t.unread, 0));
4899
+ if (i(() => Y("chat-island-unread", { total: te }), [te]), !h) return null;
4900
+ let ne = m && k.anchor ? {
4901
+ right: k.anchor.right,
4902
+ bottom: k.anchor.bottom
4903
+ } : void 0, re = ne ? "" : t === "bottom-left" ? "ci-left-4 ci-bottom-5" : "ci-right-4 ci-bottom-5";
4904
4904
  return /* @__PURE__ */ d("div", {
4905
- ref: D,
4906
- style: ie,
4907
- onClickCapture: O.onClickCapture,
4908
- className: `chat-island-root ${h ? "ci-dark" : ""} ci-fixed ${ae} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,
4909
- "data-status": ne,
4905
+ ref: O,
4906
+ style: ne,
4907
+ onClickCapture: k.onClickCapture,
4908
+ className: `chat-island-root ${g ? "ci-dark" : ""} ci-fixed ${re} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,
4909
+ "data-status": j,
4910
4910
  children: /* @__PURE__ */ f(Rr, { children: [
4911
- ee && /* @__PURE__ */ d(jr, {
4912
- peer: ee,
4913
- actions: k,
4914
- onDragStart: O.start
4911
+ A && /* @__PURE__ */ d(jr, {
4912
+ peer: A,
4913
+ actions: M,
4914
+ onDragStart: m ? k.start : void 0
4915
4915
  }),
4916
- te && /* @__PURE__ */ d(Nr, {
4916
+ ee && /* @__PURE__ */ d(Nr, {
4917
4917
  onOpen: (e) => J.getState().openChat(e),
4918
- onCreateGroup: k.createGroup
4918
+ onCreateGroup: M.createGroup
4919
4919
  }),
4920
4920
  /* @__PURE__ */ d(Kn, {
4921
- onDragStart: O.start,
4921
+ onDragStart: m ? k.start : void 0,
4922
4922
  pushButton: u !== "auto"
4923
4923
  })
4924
4924
  ] })