voicebot-react-native-expo
Version:
This is a voicebot-react-native package of Kipps AI voice bot for React Native Expo
1,053 lines (1,052 loc) • 47 kB
JavaScript
import * as e from "react";
import { useState as A, useRef as I, useEffect as P, useMemo as ge } from "react";
import { u as ve, a as K, b as pe, c as Ee, d as we, e as ke, f as ee, g as ye, h as Me, i as Re, j as be, k as Se, l as te, m as Ce, n as Ie, o as Pe, p as Te, q as xe, r as Ae, s as ae, t as Ne, v as Le } from "./hooks-C6T19zG6.mjs";
import { RoomEvent as Ve, Track as y, ConnectionQuality as z, RemoteTrackPublication as H, RemoteAudioTrack as ze, ConnectionState as F } from "livekit-client";
import { a9 as O, aa as ne, l as T, w as Fe, f as re, c as Ze, ab as He, X as Be, Y as je, a1 as V, ac as ce, ad as L, ae as Oe, i as N, B as _e, af as le, ag as _, j as $e, ah as qe, m as We, p as oe, ai as De, aj as Ue, ak as Ge, al as Qe, am as Xe } from "./contexts-BggYqn0S.mjs";
import { m as Ye, c as Je } from "./room-BeQGUa5w.mjs";
const na = /* @__PURE__ */ e.forwardRef(
function(a, n) {
const { buttonProps: r } = ve(a);
return /* @__PURE__ */ e.createElement("button", { ref: n, ...r }, a.children);
}
), ra = /* @__PURE__ */ e.forwardRef(
function({ room: a, ...n }, r) {
const c = K(a);
return /* @__PURE__ */ e.createElement("div", { ref: r, ...n }, c);
}
), ca = /* @__PURE__ */ e.forwardRef(
function(a, n) {
const { mergedProps: r } = pe({ props: a });
return /* @__PURE__ */ e.createElement("button", { ref: n, ...r }, a.children);
}
), la = /* @__PURE__ */ e.forwardRef(
function(a, n) {
const { buttonProps: r } = Ee(a);
return /* @__PURE__ */ e.createElement("button", { ref: n, ...r }, a.children);
}
), Ke = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentColor", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M1.354.646a.5.5 0 1 0-.708.708l14 14a.5.5 0 0 0 .708-.708L11 10.293V4.5A1.5 1.5 0 0 0 9.5 3H3.707zM0 4.5a1.5 1.5 0 0 1 .943-1.393l9.532 9.533c-.262.224-.603.36-.975.36h-8A1.5 1.5 0 0 1 0 11.5z" }), /* @__PURE__ */ e.createElement("path", { d: "m15.2 3.6-2.8 2.1a1 1 0 0 0-.4.8v3a1 1 0 0 0 .4.8l2.8 2.1a.5.5 0 0 0 .8-.4V4a.5.5 0 0 0-.8-.4z" })), et = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentColor", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M0 4.5A1.5 1.5 0 0 1 1.5 3h8A1.5 1.5 0 0 1 11 4.5v7A1.5 1.5 0 0 1 9.5 13h-8A1.5 1.5 0 0 1 0 11.5zM15.2 3.6l-2.8 2.1a1 1 0 0 0-.4.8v3a1 1 0 0 0 .4.8l2.8 2.1a.5.5 0 0 0 .8-.4V4a.5.5 0 0 0-.8-.4z" })), oa = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "#FFF",
d: "M4.99 3.99a1 1 0 0 0-.697 1.717L10.586 12l-6.293 6.293a1 1 0 1 0 1.414 1.414L12 13.414l6.293 6.293a1 1 0 1 0 1.414-1.414L13.414 12l6.293-6.293a1 1 0 0 0-.727-1.717 1 1 0 0 0-.687.303L12 10.586 5.707 4.293a1 1 0 0 0-.717-.303z"
}
)), sa = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 18, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M0 2.75A2.75 2.75 0 0 1 2.75 0h10.5A2.75 2.75 0 0 1 16 2.75v13.594a.75.75 0 0 1-1.234.572l-3.691-3.12a1.25 1.25 0 0 0-.807-.296H2.75A2.75 2.75 0 0 1 0 10.75v-8ZM2.75 1.5c-.69 0-1.25.56-1.25 1.25v8c0 .69.56 1.25 1.25 1.25h7.518c.65 0 1.279.23 1.775.65l2.457 2.077V2.75c0-.69-.56-1.25-1.25-1.25H2.75Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M3 4.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Z",
clipRule: "evenodd"
}
)), D = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentcolor",
fillRule: "evenodd",
d: "M5.293 2.293a1 1 0 0 1 1.414 0l4.823 4.823a1.25 1.25 0 0 1 0 1.768l-4.823 4.823a1 1 0 0 1-1.414-1.414L9.586 8 5.293 3.707a1 1 0 0 1 0-1.414z",
clipRule: "evenodd"
}
)), tt = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement("g", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5 }, /* @__PURE__ */ e.createElement("path", { d: "M10 1.75h4.25m0 0V6m0-4.25L9 7M6 14.25H1.75m0 0V10m0 4.25L7 9" }))), ia = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentcolor",
fillRule: "evenodd",
d: "M8.961.894C8.875-.298 7.125-.298 7.04.894c-.066.912-1.246 1.228-1.76.472-.67-.99-2.186-.115-1.664.96.399.824-.465 1.688-1.288 1.289-1.076-.522-1.95.994-.961 1.665.756.513.44 1.693-.472 1.759-1.192.086-1.192 1.836 0 1.922.912.066 1.228 1.246.472 1.76-.99.67-.115 2.186.96 1.664.824-.399 1.688.465 1.289 1.288-.522 1.076.994 1.95 1.665.961.513-.756 1.693-.44 1.759.472.086 1.192 1.836 1.192 1.922 0 .066-.912 1.246-1.228 1.76-.472.67.99 2.186.115 1.664-.96-.399-.824.465-1.688 1.288-1.289 1.076.522 1.95-.994.961-1.665-.756-.513-.44-1.693.472-1.759 1.192-.086 1.192-1.836 0-1.922-.912-.066-1.228-1.246-.472-1.76.99-.67.115-2.186-.96-1.664-.824.399-1.688-.465-1.289-1.288.522-1.076-.994-1.95-1.665-.961-.513.756-1.693.44-1.759-.472ZM8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10Z",
clipRule: "evenodd"
}
)), ua = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M2 2.75A2.75 2.75 0 0 1 4.75 0h6.5A2.75 2.75 0 0 1 14 2.75v10.5A2.75 2.75 0 0 1 11.25 16h-6.5A2.75 2.75 0 0 1 2 13.25v-.5a.75.75 0 0 1 1.5 0v.5c0 .69.56 1.25 1.25 1.25h6.5c.69 0 1.25-.56 1.25-1.25V2.75c0-.69-.56-1.25-1.25-1.25h-6.5c-.69 0-1.25.56-1.25 1.25v.5a.75.75 0 0 1-1.5 0v-.5Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M8.78 7.47a.75.75 0 0 1 0 1.06l-2.25 2.25a.75.75 0 1 1-1.06-1.06l.97-.97H1.75a.75.75 0 0 1 0-1.5h4.69l-.97-.97a.75.75 0 0 1 1.06-1.06l2.25 2.25Z",
clipRule: "evenodd"
}
)), at = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentcolor",
fillRule: "evenodd",
d: "M4 6.104V4a4 4 0 1 1 8 0v2.104c1.154.326 2 1.387 2 2.646v4.5A2.75 2.75 0 0 1 11.25 16h-6.5A2.75 2.75 0 0 1 2 13.25v-4.5c0-1.259.846-2.32 2-2.646ZM5.5 4a2.5 2.5 0 0 1 5 0v2h-5V4Z",
clipRule: "evenodd"
}
)), nt = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentColor", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M12.227 11.52a5.477 5.477 0 0 0 1.246-2.97.5.5 0 0 0-.995-.1 4.478 4.478 0 0 1-.962 2.359l-1.07-1.07C10.794 9.247 11 8.647 11 8V3a3 3 0 0 0-6 0v1.293L1.354.646a.5.5 0 1 0-.708.708l14 14a.5.5 0 0 0 .708-.708zM8 12.5c.683 0 1.33-.152 1.911-.425l.743.743c-.649.359-1.378.59-2.154.66V15h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2v-1.522a5.502 5.502 0 0 1-4.973-4.929.5.5 0 0 1 .995-.098A4.5 4.5 0 0 0 8 12.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M8.743 10.907 5 7.164V8a3 3 0 0 0 3.743 2.907z" })), rt = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentColor", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fillRule: "evenodd",
d: "M2.975 8.002a.5.5 0 0 1 .547.449 4.5 4.5 0 0 0 8.956 0 .5.5 0 1 1 .995.098A5.502 5.502 0 0 1 8.5 13.478V15h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2v-1.522a5.502 5.502 0 0 1-4.973-4.929.5.5 0 0 1 .448-.547z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement("path", { d: "M5 3a3 3 0 1 1 6 0v5a3 3 0 0 1-6 0z" })), ct = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentcolor", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-6a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-6a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" })), lt = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentcolor", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("g", { opacity: 0.25 }, /* @__PURE__ */ e.createElement("path", { d: "M12 .5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M12 .5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }))), ot = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentcolor", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("g", { opacity: 0.25 }, /* @__PURE__ */ e.createElement("path", { d: "M6 6.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M6 6.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5zm6-6a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }), /* @__PURE__ */ e.createElement("path", { d: "M12 .5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5z" }))), st = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "currentColor", ...t }, /* @__PURE__ */ e.createElement("g", { opacity: 0.25 }, /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-4Zm6-5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-9Zm6-6a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5V.5Z" }), /* @__PURE__ */ e.createElement("path", { d: "M0 11.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-4Zm6-5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-9Zm6-6a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5V.5Z" }))), se = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 20, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M0 2.75A2.75 2.75 0 0 1 2.75 0h14.5A2.75 2.75 0 0 1 20 2.75v10.5A2.75 2.75 0 0 1 17.25 16H2.75A2.75 2.75 0 0 1 0 13.25V2.75ZM2.75 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h14.5c.69 0 1.25-.56 1.25-1.25V2.75c0-.69-.56-1.25-1.25-1.25H2.75Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M9.47 4.22a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1-1.06 1.06l-.97-.97v4.69a.75.75 0 0 1-1.5 0V6.56l-.97.97a.75.75 0 0 1-1.06-1.06l2.25-2.25Z",
clipRule: "evenodd"
}
)), it = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 20, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement("g", { fill: "currentColor" }, /* @__PURE__ */ e.createElement("path", { d: "M7.28 4.22a.75.75 0 0 0-1.06 1.06L8.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L10 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L10 6.94z" }), /* @__PURE__ */ e.createElement(
"path",
{
fillRule: "evenodd",
d: "M2.75 0A2.75 2.75 0 0 0 0 2.75v10.5A2.75 2.75 0 0 0 2.75 16h14.5A2.75 2.75 0 0 0 20 13.25V2.75A2.75 2.75 0 0 0 17.25 0zM1.5 2.75c0-.69.56-1.25 1.25-1.25h14.5c.69 0 1.25.56 1.25 1.25v10.5c0 .69-.56 1.25-1.25 1.25H2.75c-.69 0-1.25-.56-1.25-1.25z",
clipRule: "evenodd"
}
))), U = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M8 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 8 0Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M8 12a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5A.75.75 0 0 1 8 12Z",
clipRule: "evenodd",
opacity: 0.7
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M12 1.072a.75.75 0 0 1 .274 1.024l-1.25 2.165a.75.75 0 0 1-1.299-.75l1.25-2.165A.75.75 0 0 1 12 1.072Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M6 11.464a.75.75 0 0 1 .274 1.025l-1.25 2.165a.75.75 0 0 1-1.299-.75l1.25-2.165A.75.75 0 0 1 6 11.464Z",
clipRule: "evenodd",
opacity: 0.6
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M14.928 4a.75.75 0 0 1-.274 1.025l-2.165 1.25a.75.75 0 1 1-.75-1.3l2.165-1.25A.75.75 0 0 1 14.928 4Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M4.536 10a.75.75 0 0 1-.275 1.024l-2.165 1.25a.75.75 0 0 1-.75-1.298l2.165-1.25A.75.75 0 0 1 4.536 10Z",
clipRule: "evenodd",
opacity: 0.5
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M16 8a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 16 8Z",
clipRule: "evenodd"
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M4 8a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 4 8Z",
clipRule: "evenodd",
opacity: 0.4
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M14.928 12a.75.75 0 0 1-1.024.274l-2.165-1.25a.75.75 0 0 1 .75-1.299l2.165 1.25A.75.75 0 0 1 14.928 12Z",
clipRule: "evenodd",
opacity: 0.9
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M4.536 6a.75.75 0 0 1-1.025.275l-2.165-1.25a.75.75 0 1 1 .75-1.3l2.165 1.25A.75.75 0 0 1 4.536 6Z",
clipRule: "evenodd",
opacity: 0.3
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M12 14.928a.75.75 0 0 1-1.024-.274l-1.25-2.165a.75.75 0 0 1 1.298-.75l1.25 2.165A.75.75 0 0 1 12 14.928Z",
clipRule: "evenodd",
opacity: 0.8
}
), /* @__PURE__ */ e.createElement(
"path",
{
fill: "currentColor",
fillRule: "evenodd",
d: "M6 4.536a.75.75 0 0 1-1.024-.275l-1.25-2.165a.75.75 0 1 1 1.299-.75l1.25 2.165A.75.75 0 0 1 6 4.536Z",
clipRule: "evenodd",
opacity: 0.2
}
)), ut = (t) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...t }, /* @__PURE__ */ e.createElement("g", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5 }, /* @__PURE__ */ e.createElement("path", { d: "M13.25 7H9m0 0V2.75M9 7l5.25-5.25M2.75 9H7m0 0v4.25M7 9l-5.25 5.25" }))), dt = /* @__PURE__ */ e.forwardRef(
function({ trackRef: a, ...n }, r) {
const c = O(), { mergedProps: s, inFocus: i } = we({
trackRef: a ?? c,
props: n
});
return /* @__PURE__ */ e.createElement(ne.Consumer, null, (l) => l !== void 0 && /* @__PURE__ */ e.createElement("button", { ref: r, ...s }, n.children ? n.children : i ? /* @__PURE__ */ e.createElement(ut, null) : /* @__PURE__ */ e.createElement(tt, null)));
}
);
function mt(t) {
return t !== void 0;
}
function R(...t) {
return Ye(...t.filter(mt));
}
function $(t, a, n) {
return e.Children.map(t, (r) => e.isValidElement(r) && e.Children.only(t) ? (r.props.class && (a ?? (a = {}), a.class = Je(r.props.class, a.class), a.style = { ...r.props.style, ...a.style }), e.cloneElement(r, { ...a, key: n })) : r);
}
function da(t) {
var a, n;
if (typeof window < "u" && typeof process < "u" && // eslint-disable-next-line turbo/no-undeclared-env-vars
(((a = process == null ? void 0 : process.env) == null ? void 0 : a.NODE_ENV) === "dev" || // eslint-disable-next-line turbo/no-undeclared-env-vars
((n = process == null ? void 0 : process.env) == null ? void 0 : n.NODE_ENV) === "development")) {
const r = document.querySelector(".lk-room-container");
r && !getComputedStyle(r).getPropertyValue("--lk-has-imported-styles") && T.warn(
"It looks like you're not using the `@livekit/components-styles package`. To render the UI with the default styling, please import it in your layout or page."
);
}
}
const ma = /* @__PURE__ */ e.forwardRef(
function({
kind: a,
initialSelection: n,
onActiveDeviceChange: r,
onDeviceListChange: c,
onDeviceSelectError: s,
exactMatch: i,
track: l,
requestPermissions: o,
onError: u,
...d
}, f) {
const m = Fe(), p = e.useCallback(
(w) => {
m && m.emit(Ve.MediaDevicesError, w), u == null || u(w);
},
[m, u]
), { devices: E, activeDeviceId: h, setActiveMediaDevice: g, className: k } = ke({
kind: a,
room: m,
track: l,
requestPermissions: o,
onError: p
});
e.useEffect(() => {
n !== void 0 && g(n);
}, [g]), e.useEffect(() => {
typeof c == "function" && c(E);
}, [c, E]), e.useEffect(() => {
h && h !== "" && (r == null || r(h));
}, [h]);
const C = async (w) => {
try {
await g(w, { exact: i });
} catch (v) {
if (v instanceof Error)
s == null || s(v);
else
throw v;
}
}, b = e.useMemo(
() => R(d, { className: k }, { className: "lk-list" }),
[k, d]
);
function S(w, v, M) {
return w === v || M === 0 && v === "default";
}
return /* @__PURE__ */ e.createElement("ul", { ref: f, ...b }, E.map((w, v) => /* @__PURE__ */ e.createElement(
"li",
{
key: w.deviceId,
id: w.deviceId,
"data-lk-active": S(w.deviceId, h, v),
"aria-selected": S(w.deviceId, h, v),
role: "option"
},
/* @__PURE__ */ e.createElement("button", { className: "lk-button", onClick: () => C(w.deviceId) }, w.label)
)));
}
), fa = /* @__PURE__ */ e.forwardRef(
function({ label: a = "Allow Audio", ...n }, r) {
const c = re(), { mergedProps: s } = ee({ room: c, props: n });
return /* @__PURE__ */ e.createElement("button", { ref: r, ...s }, a);
}
), ha = /* @__PURE__ */ e.forwardRef(
function({ label: a, ...n }, r) {
const c = re(), { mergedProps: s, canPlayAudio: i } = ee({ room: c, props: n }), { mergedProps: l, canPlayVideo: o } = ye({ room: c, props: s }), { style: u, ...d } = l;
return u.display = i && o ? "none" : "block", /* @__PURE__ */ e.createElement("button", { ref: r, style: u, ...d }, a ?? `Start ${i ? "Video" : "Audio"}`);
}
);
function ie(t, a) {
switch (t) {
case y.Source.Microphone:
return a ? /* @__PURE__ */ e.createElement(rt, null) : /* @__PURE__ */ e.createElement(nt, null);
case y.Source.Camera:
return a ? /* @__PURE__ */ e.createElement(et, null) : /* @__PURE__ */ e.createElement(Ke, null);
case y.Source.ScreenShare:
return a ? /* @__PURE__ */ e.createElement(it, null) : /* @__PURE__ */ e.createElement(se, null);
default:
return;
}
}
function ft(t) {
switch (t) {
case z.Excellent:
return /* @__PURE__ */ e.createElement(ct, null);
case z.Good:
return /* @__PURE__ */ e.createElement(lt, null);
case z.Poor:
return /* @__PURE__ */ e.createElement(ot, null);
default:
return /* @__PURE__ */ e.createElement(st, null);
}
}
const ga = /* @__PURE__ */ e.forwardRef(function({ showIcon: a, ...n }, r) {
const { buttonProps: c, enabled: s } = Me(n);
return /* @__PURE__ */ e.createElement("button", { ref: r, ...c }, (a ?? !0) && ie(n.source, s), n.children);
}), ue = /* @__PURE__ */ e.forwardRef(function(a, n) {
const { className: r, quality: c } = Re(a), s = e.useMemo(() => ({ ...R(a, { className: r }), "data-lk-quality": c }), [c, a, r]);
return /* @__PURE__ */ e.createElement("div", { ref: n, ...s }, a.children ?? ft(c));
}), B = /* @__PURE__ */ e.forwardRef(
function({ participant: a, ...n }, r) {
const c = Ze(a), { className: s, infoObserver: i } = e.useMemo(() => He(c), [c]), { identity: l, name: o } = be(i, {
name: c.name,
identity: c.identity,
metadata: c.metadata
}), u = e.useMemo(() => R(n, { className: s, "data-lk-participant-name": o }), [n, s, o]);
return /* @__PURE__ */ e.createElement("span", { ref: r, ...u }, o !== "" ? o : l, n.children);
}
), de = /* @__PURE__ */ e.forwardRef(
function({ trackRef: a, show: n = "always", ...r }, c) {
const { className: s, isMuted: i } = Se(a), l = n === "always" || n === "muted" && i || n === "unmuted" && !i, o = e.useMemo(
() => R(r, {
className: s
}),
[s, r]
);
return l ? /* @__PURE__ */ e.createElement("div", { ref: c, ...o, "data-lk-muted": i }, r.children ?? ie(a.source, !i)) : null;
}
), ht = (t) => /* @__PURE__ */ e.createElement(
"svg",
{
width: 320,
height: 320,
viewBox: "0 0 320 320",
preserveAspectRatio: "xMidYMid meet",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
...t
},
/* @__PURE__ */ e.createElement(
"path",
{
d: "M160 180C204.182 180 240 144.183 240 100C240 55.8172 204.182 20 160 20C115.817 20 79.9997 55.8172 79.9997 100C79.9997 144.183 115.817 180 160 180Z",
fill: "white",
fillOpacity: 0.25
}
),
/* @__PURE__ */ e.createElement(
"path",
{
d: "M97.6542 194.614C103.267 191.818 109.841 192.481 115.519 195.141C129.025 201.466 144.1 205 159.999 205C175.899 205 190.973 201.466 204.48 195.141C210.158 192.481 216.732 191.818 222.345 194.614C262.703 214.719 291.985 253.736 298.591 300.062C300.15 310.997 291.045 320 280 320H39.9997C28.954 320 19.8495 310.997 21.4087 300.062C28.014 253.736 57.2966 214.72 97.6542 194.614Z",
fill: "white",
fillOpacity: 0.25
}
)
);
function me(t, a = {}) {
const [n, r] = e.useState(Be(t)), [c, s] = e.useState(n == null ? void 0 : n.isMuted), [i, l] = e.useState(n == null ? void 0 : n.isSubscribed), [o, u] = e.useState(n == null ? void 0 : n.track), [d, f] = e.useState("landscape"), m = e.useRef(), { className: p, trackObserver: E } = e.useMemo(() => je(t), [
t.participant.sid ?? t.participant.identity,
t.source,
V(t) && t.publication.trackSid
]);
return e.useEffect(() => {
const h = E.subscribe((g) => {
T.debug("update track", g), r(g), s(g == null ? void 0 : g.isMuted), l(g == null ? void 0 : g.isSubscribed), u(g == null ? void 0 : g.track);
});
return () => h == null ? void 0 : h.unsubscribe();
}, [E]), e.useEffect(() => {
var h, g;
return o && (m.current && o.detach(m.current), (h = a.element) != null && h.current && !(ce(t.participant) && (o == null ? void 0 : o.kind) === "audio") && o.attach(a.element.current)), m.current = (g = a.element) == null ? void 0 : g.current, () => {
m.current && (o == null || o.detach(m.current));
};
}, [o, a.element]), e.useEffect(() => {
var h, g;
if (typeof ((h = n == null ? void 0 : n.dimensions) == null ? void 0 : h.width) == "number" && typeof ((g = n == null ? void 0 : n.dimensions) == null ? void 0 : g.height) == "number") {
const k = n.dimensions.width > n.dimensions.height ? "landscape" : "portrait";
f(k);
}
}, [n]), {
publication: n,
isMuted: c,
isSubscribed: i,
track: o,
elementProps: R(a.props, {
className: p,
"data-lk-local-participant": t.participant.isLocal,
"data-lk-source": n == null ? void 0 : n.source,
...(n == null ? void 0 : n.kind) === "video" && { "data-lk-orientation": d }
})
};
}
var gt = "Expected a function", G = NaN, vt = "[object Symbol]", pt = /^\s+|\s+$/g, Et = /^[-+]0x[0-9a-f]+$/i, wt = /^0b[01]+$/i, kt = /^0o[0-7]+$/i, yt = parseInt, Mt = typeof L == "object" && L && L.Object === Object && L, Rt = typeof self == "object" && self && self.Object === Object && self, bt = Mt || Rt || Function("return this")(), St = Object.prototype, Ct = St.toString, It = Math.max, Pt = Math.min, Z = function() {
return bt.Date.now();
};
function Tt(t, a, n) {
var r, c, s, i, l, o, u = 0, d = !1, f = !1, m = !0;
if (typeof t != "function")
throw new TypeError(gt);
a = Q(a) || 0, j(n) && (d = !!n.leading, f = "maxWait" in n, s = f ? It(Q(n.maxWait) || 0, a) : s, m = "trailing" in n ? !!n.trailing : m);
function p(v) {
var M = r, x = c;
return r = c = void 0, u = v, i = t.apply(x, M), i;
}
function E(v) {
return u = v, l = setTimeout(k, a), d ? p(v) : i;
}
function h(v) {
var M = v - o, x = v - u, W = a - M;
return f ? Pt(W, s - x) : W;
}
function g(v) {
var M = v - o, x = v - u;
return o === void 0 || M >= a || M < 0 || f && x >= s;
}
function k() {
var v = Z();
if (g(v))
return C(v);
l = setTimeout(k, h(v));
}
function C(v) {
return l = void 0, m && r ? p(v) : (r = c = void 0, i);
}
function b() {
l !== void 0 && clearTimeout(l), u = 0, r = o = c = l = void 0;
}
function S() {
return l === void 0 ? i : C(Z());
}
function w() {
var v = Z(), M = g(v);
if (r = arguments, c = this, o = v, M) {
if (l === void 0)
return E(o);
if (f)
return l = setTimeout(k, a), p(o);
}
return l === void 0 && (l = setTimeout(k, a)), i;
}
return w.cancel = b, w.flush = S, w;
}
function j(t) {
var a = typeof t;
return !!t && (a == "object" || a == "function");
}
function xt(t) {
return !!t && typeof t == "object";
}
function At(t) {
return typeof t == "symbol" || xt(t) && Ct.call(t) == vt;
}
function Q(t) {
if (typeof t == "number")
return t;
if (At(t))
return G;
if (j(t)) {
var a = typeof t.valueOf == "function" ? t.valueOf() : t;
t = j(a) ? a + "" : a;
}
if (typeof t != "string")
return t === 0 ? t : +t;
t = t.replace(pt, "");
var n = wt.test(t);
return n || kt.test(t) ? yt(t.slice(2), n ? 2 : 8) : Et.test(t) ? G : +t;
}
var Nt = Tt;
const X = /* @__PURE__ */ Oe(Nt);
function Lt(t) {
const a = I(t);
a.current = t, P(
() => () => {
a.current();
},
[]
);
}
function Vt(t, a = 500, n) {
const r = I();
Lt(() => {
r.current && r.current.cancel();
});
const c = ge(() => {
const s = X(t, a, n), i = (...l) => s(...l);
return i.cancel = () => {
s.cancel();
}, i.isPending = () => !!r.current, i.flush = () => s.flush(), i;
}, [t, a, n]);
return P(() => {
r.current = X(t, a, n);
}, [t, a, n]), c;
}
function zt(t, a, n) {
const r = (u, d) => u === d, c = t instanceof Function ? t() : t, [s, i] = A(c), l = I(c), o = Vt(
i,
a,
n
);
return r(l.current, c) || (o(c), l.current = c), [s, o];
}
function Ft({
threshold: t = 0,
root: a = null,
rootMargin: n = "0%",
freezeOnceVisible: r = !1,
initialIsIntersecting: c = !1,
onChange: s
} = {}) {
var i;
const [l, o] = A(null), [u, d] = A(() => ({
isIntersecting: c,
entry: void 0
})), f = I();
f.current = s;
const m = ((i = u.entry) == null ? void 0 : i.isIntersecting) && r;
P(() => {
if (!l || !("IntersectionObserver" in window) || m)
return;
let h;
const g = new IntersectionObserver(
(k) => {
const C = Array.isArray(g.thresholds) ? g.thresholds : [g.thresholds];
k.forEach((b) => {
const S = b.isIntersecting && C.some((w) => b.intersectionRatio >= w);
d({ isIntersecting: S, entry: b }), f.current && f.current(S, b), S && r && h && (h(), h = void 0);
});
},
{ threshold: t, root: a, rootMargin: n }
);
return g.observe(l), () => {
g.disconnect();
};
}, [
l,
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(t),
a,
n,
m,
r
]);
const p = I(null);
P(() => {
var h;
!l && ((h = u.entry) != null && h.target) && !r && !m && p.current !== u.entry.target && (p.current = u.entry.target, d({ isIntersecting: c, entry: void 0 }));
}, [l, u.entry, r, m, c]);
const E = [
o,
!!u.isIntersecting,
u.entry
];
return E.ref = E[0], E.isIntersecting = E[1], E.entry = E[2], E;
}
const Zt = /* @__PURE__ */ e.forwardRef(
function({
onTrackClick: a,
onClick: n,
onSubscriptionStatusChanged: r,
trackRef: c,
manageSubscription: s,
...i
}, l) {
const o = N(c), u = e.useRef(null);
e.useImperativeHandle(l, () => u.current);
const d = Ft({ root: u.current }), [f] = zt(d, 3e3);
e.useEffect(() => {
s && o.publication instanceof H && (f == null ? void 0 : f.isIntersecting) === !1 && (d == null ? void 0 : d.isIntersecting) === !1 && o.publication.setSubscribed(!1);
}, [f, o, s]), e.useEffect(() => {
s && o.publication instanceof H && (d == null ? void 0 : d.isIntersecting) === !0 && o.publication.setSubscribed(!0);
}, [d, o, s]);
const {
elementProps: m,
publication: p,
isSubscribed: E
} = me(o, {
element: u,
props: i
});
e.useEffect(() => {
r == null || r(!!E);
}, [E, r]);
const h = (g) => {
n == null || n(g), a == null || a({ participant: o == null ? void 0 : o.participant, track: p });
};
return /* @__PURE__ */ e.createElement("video", { ref: u, ...m, muted: !0, onClick: h });
}
), q = /* @__PURE__ */ e.forwardRef(
function({ trackRef: a, onSubscriptionStatusChanged: n, volume: r, muted: c, ...s }, i) {
const l = N(a), o = e.useRef(null);
e.useImperativeHandle(i, () => o.current);
const {
elementProps: u,
isSubscribed: d,
track: f,
publication: m
} = me(l, {
element: o,
props: s
});
return e.useEffect(() => {
n == null || n(!!d);
}, [d, n]), e.useEffect(() => {
f === void 0 || r === void 0 || (f instanceof ze ? f.setVolume(r) : T.warn("Volume can only be set on remote audio tracks."));
}, [r, f]), e.useEffect(() => {
m === void 0 || c === void 0 || (m instanceof H ? m.setEnabled(!c) : T.warn("Can only call setEnabled on remote track publications."));
}, [c, m, f]), /* @__PURE__ */ e.createElement("audio", { ref: o, ...u });
}
);
function Ht(t) {
const a = !!_e();
return t.participant && !a ? /* @__PURE__ */ e.createElement(le.Provider, { value: t.participant }, t.children) : /* @__PURE__ */ e.createElement(e.Fragment, null, t.children);
}
function Bt(t) {
const a = !!O();
return t.trackRef && !a ? /* @__PURE__ */ e.createElement(_.Provider, { value: t.trackRef }, t.children) : /* @__PURE__ */ e.createElement(e.Fragment, null, t.children);
}
const jt = /* @__PURE__ */ e.forwardRef(
function({
trackRef: a,
children: n,
onParticipantClick: r,
disableSpeakingIndicator: c,
...s
}, i) {
var p, E;
const l = N(a), { elementProps: o } = te({
htmlProps: s,
disableSpeakingIndicator: c,
onParticipantClick: r,
trackRef: l
}), u = Ce(l.participant), d = $e(), f = (p = qe()) == null ? void 0 : p.autoSubscription, m = e.useCallback(
(h) => {
l.source && !h && d && d.pin.dispatch && We(l, d.pin.state) && d.pin.dispatch({ msg: "clear_pin" });
},
[l, d]
);
return /* @__PURE__ */ e.createElement("div", { ref: i, style: { position: "relative" }, ...o }, /* @__PURE__ */ e.createElement(Bt, { trackRef: l }, /* @__PURE__ */ e.createElement(Ht, { participant: l.participant }, n ?? /* @__PURE__ */ e.createElement(e.Fragment, null, V(l) && (((E = l.publication) == null ? void 0 : E.kind) === "video" || l.source === y.Source.Camera || l.source === y.Source.ScreenShare) ? /* @__PURE__ */ e.createElement(
Zt,
{
trackRef: l,
onSubscriptionStatusChanged: m,
manageSubscription: f
}
) : V(l) && /* @__PURE__ */ e.createElement(
q,
{
trackRef: l,
onSubscriptionStatusChanged: m
}
), /* @__PURE__ */ e.createElement("div", { className: "lk-participant-placeholder" }, /* @__PURE__ */ e.createElement(ht, null)), /* @__PURE__ */ e.createElement("div", { className: "lk-participant-metadata" }, /* @__PURE__ */ e.createElement("div", { className: "lk-participant-metadata-item" }, l.source === y.Source.Camera ? /* @__PURE__ */ e.createElement(e.Fragment, null, u && /* @__PURE__ */ e.createElement(at, { style: { marginRight: "0.25rem" } }), /* @__PURE__ */ e.createElement(
de,
{
trackRef: {
participant: l.participant,
source: y.Source.Microphone
},
show: "muted"
}
), /* @__PURE__ */ e.createElement(B, null)) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(se, { style: { marginRight: "0.25rem" } }), /* @__PURE__ */ e.createElement(B, null, "'s screen"))), /* @__PURE__ */ e.createElement(ue, { className: "lk-participant-metadata-item" }))), /* @__PURE__ */ e.createElement(dt, { trackRef: l }))));
}
);
function va(t) {
const a = R(t, { className: "lk-focus-layout" });
return /* @__PURE__ */ e.createElement("div", { ...a }, t.children);
}
function pa({ trackRef: t, ...a }) {
return /* @__PURE__ */ e.createElement(jt, { trackRef: t, ...a });
}
function fe({ tracks: t, ...a }) {
return /* @__PURE__ */ e.createElement(e.Fragment, null, t.map((n) => /* @__PURE__ */ e.createElement(
_.Provider,
{
value: n,
key: oe(n)
},
$(a.children)
)));
}
function Ot({
totalPageCount: t,
nextPage: a,
prevPage: n,
currentPage: r,
pagesContainer: c
}) {
const [s, i] = e.useState(!1);
return e.useEffect(() => {
let l;
return c && (l = De(c.current, 2e3).subscribe(
i
)), () => {
l && l.unsubscribe();
};
}, [c]), /* @__PURE__ */ e.createElement("div", { className: "lk-pagination-control", "data-lk-user-interaction": s }, /* @__PURE__ */ e.createElement("button", { className: "lk-button", onClick: n }, /* @__PURE__ */ e.createElement(D, null)), /* @__PURE__ */ e.createElement("span", { className: "lk-pagination-count" }, `${r} of ${t}`), /* @__PURE__ */ e.createElement("button", { className: "lk-button", onClick: a }, /* @__PURE__ */ e.createElement(D, null)));
}
const _t = /* @__PURE__ */ e.forwardRef(
function({ totalPageCount: a, currentPage: n }, r) {
const c = new Array(a).fill("").map((s, i) => i + 1 === n ? /* @__PURE__ */ e.createElement("span", { "data-lk-active": !0, key: i }) : /* @__PURE__ */ e.createElement("span", { key: i }));
return /* @__PURE__ */ e.createElement("div", { ref: r, className: "lk-pagination-indicator" }, c);
}
);
function Ea({ tracks: t, ...a }) {
const n = e.createRef(), r = e.useMemo(
() => R(a, { className: "lk-grid-layout" }),
[a]
), { layout: c } = Ie(n, t.length), s = Pe(c.maxTiles, t);
return Te(n, {
onLeftSwipe: s.nextPage,
onRightSwipe: s.prevPage
}), /* @__PURE__ */ e.createElement("div", { ref: n, "data-lk-pagination": s.totalPageCount > 1, ...r }, /* @__PURE__ */ e.createElement(fe, { tracks: s.tracks }, a.children), t.length > c.maxTiles && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
_t,
{
totalPageCount: s.totalPageCount,
currentPage: s.currentPage
}
), /* @__PURE__ */ e.createElement(Ot, { pagesContainer: n, ...s })));
}
const $t = 130, qt = 140, Y = 1, he = 16 / 10, Wt = (1 - he) * -1;
function wa({ tracks: t, orientation: a, ...n }) {
const r = e.useRef(null), [c, s] = e.useState(0), { width: i, height: l } = xe(r), o = a || (l >= i ? "vertical" : "horizontal"), u = o === "vertical" ? Math.max(i * Wt, $t) : Math.max(l * he, qt), d = Ue(), f = Math.max(o === "vertical" ? (l - d) / u : (i - d) / u, Y);
let m = Math.round(f);
Math.abs(f - c) < 0.5 ? m = Math.round(c) : c !== f && s(f);
const p = Ae(t, m);
return e.useLayoutEffect(() => {
r.current && (r.current.dataset.lkOrientation = o, r.current.style.setProperty("--lk-max-visible-tiles", m.toString()));
}, [m, o]), /* @__PURE__ */ e.createElement("aside", { key: o, className: "lk-carousel", ref: r, ...n }, /* @__PURE__ */ e.createElement(fe, { tracks: p }, n.children));
}
function ka({
value: t,
onPinChange: a,
onWidgetChange: n,
children: r
}) {
const c = Ge(t);
return e.useEffect(() => {
T.debug("PinState Updated", { state: c.pin.state }), a && c.pin.state && a(c.pin.state);
}, [c.pin.state, a]), e.useEffect(() => {
T.debug("Widget Updated", { widgetState: c.widget.state }), n && c.widget.state && n(c.widget.state);
}, [n, c.widget.state]), /* @__PURE__ */ e.createElement(ne.Provider, { value: c }, r);
}
const ya = /* @__PURE__ */ e.forwardRef(
function({ trackRef: a, ...n }, r) {
const d = N(a), f = ae(d, { bands: 7, loPass: 300 });
return /* @__PURE__ */ e.createElement(
"svg",
{
ref: r,
width: "100%",
height: "100%",
viewBox: "0 0 200 90",
...n,
className: "lk-audio-visualizer"
},
/* @__PURE__ */ e.createElement("rect", { x: "0", y: "0", width: "100%", height: "100%" }),
/* @__PURE__ */ e.createElement(
"g",
{
style: {
transform: `translate(${(200 - 7 * 10) / 2}px, 0)`
}
},
f.map((m, p) => /* @__PURE__ */ e.createElement(
"rect",
{
key: p,
x: p * 10,
y: 90 / 2 - m * 50 / 2,
width: 6,
height: m * 50
}
))
)
);
}
);
function Ma({ participants: t, ...a }) {
return /* @__PURE__ */ e.createElement(e.Fragment, null, t.map((n) => /* @__PURE__ */ e.createElement(le.Provider, { value: n, key: n.identity }, $(a.children))));
}
function Ra({ volume: t, muted: a }) {
const n = Ne(
[y.Source.Microphone, y.Source.ScreenShareAudio, y.Source.Unknown],
{
updateOnlyOn: [],
onlySubscribed: !0
}
).filter((r) => !ce(r.participant) && r.publication.kind === y.Kind.Audio);
return /* @__PURE__ */ e.createElement("div", { style: { display: "none" } }, n.map((r) => /* @__PURE__ */ e.createElement(
q,
{
key: oe(r),
trackRef: r,
volume: t,
muted: a
}
)));
}
const ba = /* @__PURE__ */ e.forwardRef(function({ childrenPosition: a = "before", children: n, ...r }, c) {
const { name: s } = Le();
return /* @__PURE__ */ e.createElement("span", { ref: c, ...r }, a === "before" && n, s, a === "after" && n);
});
function Dt(t) {
const a = e.useMemo(() => R(t, { className: "lk-toast" }), [t]);
return /* @__PURE__ */ e.createElement("div", { ...a }, t.children);
}
const Ut = (t) => {
const a = [];
for (let n = 0; n < t; n++)
a.push([n, t - 1 - n]);
return a;
}, J = (t) => [[Math.floor(t / 2)], [-1]], Gt = (t, a, n) => {
const [r, c] = A(0), [s, i] = A([[]]);
P(() => {
if (t === "thinking")
i(J(a));
else if (t === "connecting" || t === "initializing") {
const o = [...Ut(a)];
i(o);
} else i(t === "listening" ? J(a) : t === void 0 ? [new Array(a).fill(0).map((o, u) => u)] : [[]]);
c(0);
}, [t, a]);
const l = I(null);
return P(() => {
let o = performance.now();
const u = (d) => {
d - o >= n && (c((m) => m + 1), o = d), l.current = requestAnimationFrame(u);
};
return l.current = requestAnimationFrame(u), () => {
l.current !== null && cancelAnimationFrame(l.current);
};
}, [n, a, t, s.length]), s[r % s.length];
}, Qt = /* @__PURE__ */ new Map([
["connecting", 2e3],
["initializing", 2e3],
["listening", 500],
["thinking", 150]
]), Xt = (t, a) => {
if (t === void 0)
return 1e3;
let n = Qt.get(t);
if (n)
switch (t) {
case "connecting":
n /= a;
break;
}
return n;
}, Yt = /* @__PURE__ */ e.forwardRef(
function({ state: a, options: n, barCount: r = 15, trackRef: c, children: s, ...i }, l) {
const o = R(i, { className: "lk-audio-bar-visualizer" });
let u = O();
c && (u = c);
const d = ae(u, {
bands: r,
loPass: 100,
hiPass: 200
}), f = (n == null ? void 0 : n.minHeight) ?? 20, m = (n == null ? void 0 : n.maxHeight) ?? 100, p = Gt(
a,
r,
Xt(a, r) ?? 100
);
return /* @__PURE__ */ e.createElement("div", { ref: l, ...o, "data-lk-va-state": a }, d.map(
(E, h) => s ? $(s, {
"data-lk-highlighted": p.includes(h),
"data-lk-bar-index": h,
class: "lk-audio-bar",
style: { height: `${Math.min(m, Math.max(f, E * 100 + 5))}%` }
}) : /* @__PURE__ */ e.createElement(
"span",
{
key: h,
"data-lk-highlighted": p.includes(h),
"data-lk-bar-index": h,
className: `lk-audio-bar ${p.includes(h) && "lk-highlighted"}`,
style: {
// TODO transform animations would be more performant, however the border-radius gets distorted when using scale transforms. a 9-slice approach (or 3 in this case) could work
// transform: `scale(1, ${Math.min(maxHeight, Math.max(minHeight, volume))}`,
height: `${Math.min(m, Math.max(f, E * 100 + 5))}%`
}
}
)
));
}
), Sa = /* @__PURE__ */ e.forwardRef(
function({
children: a,
disableSpeakingIndicator: n,
onParticipantClick: r,
trackRef: c,
...s
}, i) {
const l = N(c), { elementProps: o } = te({
trackRef: l,
htmlProps: s,
disableSpeakingIndicator: n,
onParticipantClick: r
});
return /* @__PURE__ */ e.createElement("div", { ref: i, style: { position: "relative", minHeight: "160px" }, ...o }, /* @__PURE__ */ e.createElement(_.Provider, { value: l }, a ?? /* @__PURE__ */ e.createElement(e.Fragment, null, V(l) && /* @__PURE__ */ e.createElement(q, { trackRef: l }), /* @__PURE__ */ e.createElement(Yt, { barCount: 7, options: { minHeight: 8 } }), /* @__PURE__ */ e.createElement("div", { className: "lk-participant-metadata" }, /* @__PURE__ */ e.createElement("div", { className: "lk-participant-metadata-item" }, /* @__PURE__ */ e.createElement(de, { trackRef: l }), /* @__PURE__ */ e.createElement(B, null)), /* @__PURE__ */ e.createElement(ue, { className: "lk-participant-metadata-item" })))));
}
);
function Ca(t) {
const [a, n] = e.useState(void 0), r = K(t.room);
return e.useEffect(() => {
switch (r) {
case F.Reconnecting:
n(
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(U, { className: "lk-spinner" }), " Reconnecting")
);
break;
case F.Connecting:
n(
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(U, { className: "lk-spinner" }), " Connecting")
);
break;
case F.Disconnected:
n(/* @__PURE__ */ e.createElement(e.Fragment, null, "Disconnected"));
break;
default:
n(void 0);
break;
}
}, [r]), a ? /* @__PURE__ */ e.createElement(Dt, { className: "lk-toast-connection-state" }, a) : /* @__PURE__ */ e.createElement(e.Fragment, null);
}
const Ia = /* @__PURE__ */ e.forwardRef(
function({ entry: a, hideName: n = !1, hideTimestamp: r = !1, messageFormatter: c, ...s }, i) {
var f, m, p;
const l = e.useMemo(() => c ? c(a.message) : a.message, [a.message, c]), o = !!a.editTimestamp, u = new Date(a.timestamp), d = navigator ? navigator.language : "en-US";
return /* @__PURE__ */ e.createElement(
"li",
{
ref: i,
className: "lk-chat-entry",
title: u.toLocaleTimeString(d, { timeStyle: "full" }),
"data-lk-message-origin": (f = a.from) != null && f.isLocal ? "local" : "remote",
...s
},
(!r || !n || o) && /* @__PURE__ */ e.createElement("span", { className: "lk-meta-data" }, !n && /* @__PURE__ */ e.createElement("strong", { className: "lk-participant-name" }, ((m = a.from) == null ? void 0 : m.name) ?? ((p = a.from) == null ? void 0 : p.identity)), (!r || o) && /* @__PURE__ */ e.createElement("span", { className: "lk-timestamp" }, o && "edited ", u.toLocaleTimeString(d, { timeStyle: "short" }))),
/* @__PURE__ */ e.createElement("span", { className: "lk-message-body" }, l)
);
}
);
function Pa(t) {
return Qe(t, Xe()).map((a, n) => {
if (typeof a == "string")
return a;
{
const r = a.content.toString(), c = a.type === "url" ? /^http(s?):\/\//.test(r) ? r : `https://${r}` : `mailto:${r}`;
return /* @__PURE__ */ e.createElement("a", { className: "lk-chat-link", key: n, href: c, target: "_blank", rel: "noreferrer" }, r);
}
});
}
export {
it as $,
ya as A,
Yt as B,
ca as C,
la as D,
Ht as E,
va as F,
Ea as G,
Bt as H,
Ke as I,
et as J,
D as K,
ka as L,
ma as M,
tt as N,
at as O,
jt as P,
nt as Q,
Ra as R,
oa as S,
ga as T,
rt as U,
Zt as V,
ct as W,
lt as X,
ot as Y,
st as Z,
se as _,
Ia as a,
U as a0,
ut as a1,
ht as b,
$ as c,
sa as d,
ia as e,
ua as f,
ha as g,
wa as h,
pa as i,
Ca as j,
fe as k,
Sa as l,
R as m,
Dt as n,
Pa as o,
na as p,
ra as q,
dt as r,
fa as s,
ue as t,
q as u,
B as v,
da as w,
de as x,
Ma as y,
ba as z
};
//# sourceMappingURL=components-Y1IPllFz.mjs.map