@werxt/livekit-components-react 2.9.20 → 2.9.21-werxt.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";const S=require("livekit-client"),V=require("react"),b=require("./shared-BDr0qLg4.js"),f=require("./shared-CjI_UuOX.js");function ct(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const e=ct(V);function lt(t){const a=o=>typeof window<"u"?window.matchMedia(o).matches:!1,[n,r]=e.useState(a(t));function c(){r(a(t))}return e.useEffect(()=>{const o=window.matchMedia(t);return c(),o.addListener?o.addListener(c):o.addEventListener("change",c),()=>{o.removeListener?o.removeListener(c):o.removeEventListener("change",c)}},[t]),n}const Ce=e.createContext(void 0);function Me(t){const a=e.useContext(Ce);if(t===!0){if(a)return a;throw Error("tried to access feature context, but none is present")}return a}const le=e.forwardRef(function(a,n){const{mergedProps:r}=f.useChatToggle({props:a});return e.createElement("button",{ref:n,...r},a.children)}),ie=e.forwardRef(function(a,n){const{buttonProps:r}=f.useDisconnectButton(a);return e.createElement("button",{ref:n,...r},a.children)}),Te=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"}),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"})),ye=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"})),Re=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",...t},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"})),Ie=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:18,fill:"none",...t},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"}),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"})),re=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"})),Pe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},e.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5},e.createElement("path",{d:"M10 1.75h4.25m0 0V6m0-4.25L9 7M6 14.25H1.75m0 0V10m0 4.25L7 9"}))),Ae=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"})),Ne=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"}),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"})),Le=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"})),xe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"}),e.createElement("path",{d:"M8.743 10.907 5 7.164V8a3 3 0 0 0 3.743 2.907z"})),Ve=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"}),e.createElement("path",{d:"M5 3a3 3 0 1 1 6 0v5a3 3 0 0 1-6 0z"})),Fe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentcolor",...t},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"}),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"})),De=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentcolor",...t},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"}),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"}),e.createElement("g",{opacity:.25},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"}),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"}))),ze=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentcolor",...t},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"}),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"}),e.createElement("g",{opacity:.25},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"}),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"}),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"}))),Oe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},e.createElement("g",{opacity:.25},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"}),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"}))),oe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:16,fill:"none",...t},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"}),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"})),$e=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:16,fill:"none",...t},e.createElement("g",{fill:"currentColor"},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"}),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"}))),ce=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"}),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:.7}),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"}),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:.6}),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"}),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:.5}),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"}),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:.4}),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:.9}),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:.3}),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:.8}),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:.2})),Ze=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},e.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5},e.createElement("path",{d:"M13.25 7H9m0 0V2.75M9 7l5.25-5.25M2.75 9H7m0 0v4.25M7 9l-5.25 5.25"}))),_e=e.forwardRef(function({trackRef:a,...n},r){const c=f.useMaybeTrackRefContext(),{mergedProps:o,inFocus:u}=f.useFocusToggle({trackRef:a??c,props:n});return e.createElement(f.LayoutContext.Consumer,null,i=>i!==void 0&&e.createElement("button",{ref:r,...o},n.children?n.children:u?e.createElement(Ze,null):e.createElement(Pe,null)))}),G=e.forwardRef(function({kind:a,initialSelection:n,onActiveDeviceChange:r,onDeviceListChange:c,onDeviceSelectError:o,exactMatch:u,track:i,requestPermissions:l,onError:h,...s},p){const m=b.useMaybeRoomContext(),E=e.useRef("default"),g=e.useCallback(M=>{m&&m.emit(S.RoomEvent.MediaDevicesError,M),h==null||h(M)},[m,h]),{devices:v,activeDeviceId:d,setActiveMediaDevice:w,className:k}=f.useMediaDeviceSelect({kind:a,room:m,track:i,requestPermissions:l,onError:g});e.useEffect(()=>{n!==void 0&&w(n)},[w]),e.useEffect(()=>{typeof c=="function"&&c(v)},[c,v]),e.useEffect(()=>{d!==E.current&&(r==null||r(d)),E.current=d},[d]);const P=async M=>{try{await w(M,{exact:u??!0})}catch(R){if(R instanceof Error)o==null||o(R);else throw R}},I=e.useMemo(()=>f.mergeProps$1(s,{className:k},{className:"lk-list"}),[k,s]),C=!!v.find(M=>M.label.toLowerCase().startsWith("default"));function T(M,R,D){return M===R||!C&&D===0&&R==="default"}return e.createElement("ul",{ref:p,...I},v.map((M,R)=>e.createElement("li",{key:M.deviceId,id:M.deviceId,"data-lk-active":T(M.deviceId,d,R),"aria-selected":T(M.deviceId,d,R),role:"option"},e.createElement("button",{className:"lk-button",onClick:()=>P(M.deviceId)},M.label))))}),se=e.forwardRef(function({label:a,...n},r){const c=b.useRoomContext(),{mergedProps:o,canPlayAudio:u}=f.useStartAudio({room:c,props:n}),{mergedProps:i,canPlayVideo:l}=f.useStartVideo({room:c,props:o}),{style:h,...s}=i;return h.display=u&&l?"none":"block",e.createElement("button",{ref:r,style:h,...s},a??`Start ${u?"Video":"Audio"}`)});function je(t,a){switch(t){case S.Track.Source.Microphone:return a?e.createElement(Ve,null):e.createElement(xe,null);case S.Track.Source.Camera:return a?e.createElement(ye,null):e.createElement(Te,null);case S.Track.Source.ScreenShare:return a?e.createElement($e,null):e.createElement(oe,null);default:return}}function it(t){switch(t){case S.ConnectionQuality.Excellent:return e.createElement(Fe,null);case S.ConnectionQuality.Good:return e.createElement(De,null);case S.ConnectionQuality.Poor:return e.createElement(ze,null);default:return e.createElement(Oe,null)}}const Z=e.forwardRef(function({showIcon:a,...n},r){const{buttonProps:c,enabled:o}=f.useTrackToggle(n),[u,i]=e.useState(!1);return e.useEffect(()=>{i(!0)},[]),u&&e.createElement("button",{ref:r,...c},(a??!0)&&je(n.source,o),n.children)}),ue=e.forwardRef(function(a,n){const{className:r,quality:c}=f.useConnectionQualityIndicator(a),o=e.useMemo(()=>({...f.mergeProps$1(a,{className:r}),"data-lk-quality":c}),[c,a,r]);return e.createElement("div",{ref:n,...o},a.children??it(c))}),K=e.forwardRef(function({participant:a,...n},r){const c=f.useEnsureParticipant(a),{className:o,infoObserver:u}=e.useMemo(()=>b.setupParticipantName(c),[c]),{identity:i,name:l}=f.useObservableState(u,{name:c.name,identity:c.identity,metadata:c.metadata}),h=e.useMemo(()=>f.mergeProps$1(n,{className:o,"data-lk-participant-name":l}),[n,o,l]);return e.createElement("span",{ref:r,...h},l!==""?l:i,n.children)}),de=e.forwardRef(function({trackRef:a,show:n="always",...r},c){const{className:o,isMuted:u}=f.useTrackMutedIndicator(a),i=n==="always"||n==="muted"&&u||n==="unmuted"&&!u,l=e.useMemo(()=>f.mergeProps$1(r,{className:o}),[o,r]);return i?e.createElement("div",{ref:c,...l,"data-lk-muted":u},r.children??je(a.source,!u)):null}),me=t=>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},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:.25}),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:.25}));function Be(t,a={}){const[n,r]=e.useState(b.getTrackByIdentifier(t)),[c,o]=e.useState(n==null?void 0:n.isMuted),[u,i]=e.useState(n==null?void 0:n.isSubscribed),[l,h]=e.useState(n==null?void 0:n.track),[s,p]=e.useState("landscape"),m=e.useRef(),{className:E,trackObserver:g}=e.useMemo(()=>b.setupMediaTrack(t),[t.participant.sid??t.participant.identity,t.source,b.isTrackReference(t)&&t.publication.trackSid]);return e.useEffect(()=>{const v=g.subscribe(d=>{b.log.debug("update track",d),r(d),o(d==null?void 0:d.isMuted),i(d==null?void 0:d.isSubscribed),h(d==null?void 0:d.track)});return()=>v==null?void 0:v.unsubscribe()},[g]),e.useEffect(()=>{var v,d;return l&&(m.current&&l.detach(m.current),(v=a.element)!=null&&v.current&&!(t.participant.isLocal&&(l==null?void 0:l.kind)==="audio")&&l.attach(a.element.current)),m.current=(d=a.element)==null?void 0:d.current,()=>{m.current&&(l==null||l.detach(m.current))}},[l,a.element]),e.useEffect(()=>{var v,d;if(typeof((v=n==null?void 0:n.dimensions)==null?void 0:v.width)=="number"&&typeof((d=n==null?void 0:n.dimensions)==null?void 0:d.height)=="number"){const w=n.dimensions.width>n.dimensions.height?"landscape":"portrait";p(w)}},[n]),{publication:n,isMuted:c,isSubscribed:u,track:l,elementProps:f.mergeProps$1(a.props,{className:E,"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":s}})}}var ae,ke;function ot(){if(ke)return ae;ke=1;var t="Expected a function",a=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,u=/^0o[0-7]+$/i,i=parseInt,l=typeof b.commonjsGlobal=="object"&&b.commonjsGlobal&&b.commonjsGlobal.Object===Object&&b.commonjsGlobal,h=typeof self=="object"&&self&&self.Object===Object&&self,s=l||h||Function("return this")(),p=Object.prototype,m=p.toString,E=Math.max,g=Math.min,v=function(){return s.Date.now()};function d(C,T,M){var R,D,y,N,F,O,z=0,_=!1,L=!1,q=!0;if(typeof C!="function")throw new TypeError(t);T=I(T)||0,w(M)&&(_=!!M.leading,L="maxWait"in M,y=L?E(I(M.maxWait)||0,T):y,q="trailing"in M?!!M.trailing:q);function j(x){var $=R,Q=D;return R=D=void 0,z=x,N=C.apply(Q,$),N}function ee(x){return z=x,F=setTimeout(H,T),_?j(x):N}function te(x){var $=x-O,Q=x-z,Ee=T-$;return L?g(Ee,y-Q):Ee}function B(x){var $=x-O,Q=x-z;return O===void 0||$>=T||$<0||L&&Q>=y}function H(){var x=v();if(B(x))return A(x);F=setTimeout(H,te(x))}function A(x){return F=void 0,q&&R?j(x):(R=D=void 0,N)}function W(){F!==void 0&&clearTimeout(F),z=0,R=O=D=F=void 0}function rt(){return F===void 0?N:A(v())}function ne(){var x=v(),$=B(x);if(R=arguments,D=this,O=x,$){if(F===void 0)return ee(O);if(L)return F=setTimeout(H,T),j(O)}return F===void 0&&(F=setTimeout(H,T)),N}return ne.cancel=W,ne.flush=rt,ne}function w(C){var T=typeof C;return!!C&&(T=="object"||T=="function")}function k(C){return!!C&&typeof C=="object"}function P(C){return typeof C=="symbol"||k(C)&&m.call(C)==n}function I(C){if(typeof C=="number")return C;if(P(C))return a;if(w(C)){var T=typeof C.valueOf=="function"?C.valueOf():C;C=w(T)?T+"":T}if(typeof C!="string")return C===0?C:+C;C=C.replace(r,"");var M=o.test(C);return M||u.test(C)?i(C.slice(2),M?2:8):c.test(C)?a:+C}return ae=d,ae}var st=ot();const Se=b.getDefaultExportFromCjs(st);function ut(t){const a=V.useRef(t);a.current=t,V.useEffect(()=>()=>{a.current()},[])}function dt(t,a=500,n){const r=V.useRef();ut(()=>{r.current&&r.current.cancel()});const c=V.useMemo(()=>{const o=Se(t,a,n),u=(...i)=>o(...i);return u.cancel=()=>{o.cancel()},u.isPending=()=>!!r.current,u.flush=()=>o.flush(),u},[t,a,n]);return V.useEffect(()=>{r.current=Se(t,a,n)},[t,a,n]),c}function mt(t,a,n){const r=((h,s)=>h===s),c=t instanceof Function?t():t,[o,u]=V.useState(c),i=V.useRef(c),l=dt(u,a,n);return r(i.current,c)||(l(c),i.current=c),[o,l]}function ft({threshold:t=0,root:a=null,rootMargin:n="0%",freezeOnceVisible:r=!1,initialIsIntersecting:c=!1,onChange:o}={}){var u;const[i,l]=V.useState(null),[h,s]=V.useState(()=>({isIntersecting:c,entry:void 0})),p=V.useRef();p.current=o;const m=((u=h.entry)==null?void 0:u.isIntersecting)&&r;V.useEffect(()=>{if(!i||!("IntersectionObserver"in window)||m)return;const v=new IntersectionObserver(d=>{const w=Array.isArray(v.thresholds)?v.thresholds:[v.thresholds];d.forEach(k=>{const P=k.isIntersecting&&w.some(I=>k.intersectionRatio>=I);s({isIntersecting:P,entry:k}),p.current&&p.current(P,k)})},{threshold:t,root:a,rootMargin:n});return v.observe(i),()=>{v.disconnect()}},[i,JSON.stringify(t),a,n,m,r]);const E=V.useRef(null);V.useEffect(()=>{var v;!i&&((v=h.entry)!=null&&v.target)&&!r&&!m&&E.current!==h.entry.target&&(E.current=h.entry.target,s({isIntersecting:c,entry:void 0}))},[i,h.entry,r,m,c]);const g=[l,!!h.isIntersecting,h.entry];return g.ref=g[0],g.isIntersecting=g[1],g.entry=g[2],g}const He=e.forwardRef(function({onTrackClick:a,onClick:n,onSubscriptionStatusChanged:r,trackRef:c,manageSubscription:o,...u},i){const l=f.useEnsureTrackRef(c),h=e.useRef(null);e.useImperativeHandle(i,()=>h.current);const s=ft({root:h.current}),[p]=mt(s,3e3);e.useEffect(()=>{o&&l.publication instanceof S.RemoteTrackPublication&&(p==null?void 0:p.isIntersecting)===!1&&(s==null?void 0:s.isIntersecting)===!1&&l.publication.setSubscribed(!1)},[p,l,o]),e.useEffect(()=>{o&&l.publication instanceof S.RemoteTrackPublication&&(s==null?void 0:s.isIntersecting)===!0&&l.publication.setSubscribed(!0)},[s,l,o]);const{elementProps:m,publication:E,isSubscribed:g}=Be(l,{element:h,props:u});e.useEffect(()=>{r==null||r(!!g)},[g,r]);const v=d=>{n==null||n(d),a==null||a({participant:l==null?void 0:l.participant,track:E})};return e.createElement("video",{ref:h,...m,muted:!0,onClick:v})}),X=e.forwardRef(function({trackRef:a,onSubscriptionStatusChanged:n,volume:r,...c},o){const u=f.useEnsureTrackRef(a),i=e.useRef(null);e.useImperativeHandle(o,()=>i.current);const{elementProps:l,isSubscribed:h,track:s,publication:p}=Be(u,{element:i,props:c});return e.useEffect(()=>{n==null||n(!!h)},[h,n]),e.useEffect(()=>{s===void 0||r===void 0||(s instanceof S.RemoteAudioTrack?s.setVolume(r):b.log.warn("Volume can only be set on remote audio tracks."))},[r,s]),e.useEffect(()=>{p===void 0||c.muted===void 0||(p instanceof S.RemoteTrackPublication?p.setEnabled(!c.muted):b.log.warn("Can only call setEnabled on remote track publications."))},[c.muted,p,s]),e.createElement("audio",{ref:i,...l})});function Ue(t){const a=!!f.useMaybeParticipantContext();return t.participant&&!a?e.createElement(f.ParticipantContext.Provider,{value:t.participant},t.children):e.createElement(e.Fragment,null,t.children)}function qe(t){const a=!!f.useMaybeTrackRefContext();return t.trackRef&&!a?e.createElement(f.TrackRefContext.Provider,{value:t.trackRef},t.children):e.createElement(e.Fragment,null,t.children)}const J=e.forwardRef(function({trackRef:a,children:n,onParticipantClick:r,disableSpeakingIndicator:c,...o},u){var E,g;const i=f.useEnsureTrackRef(a),{elementProps:l}=f.useParticipantTile({htmlProps:o,disableSpeakingIndicator:c,onParticipantClick:r,trackRef:i}),h=f.useIsEncrypted(i.participant),s=f.useMaybeLayoutContext(),p=(E=Me())==null?void 0:E.autoSubscription,m=e.useCallback(v=>{i.source&&!v&&s&&s.pin.dispatch&&b.isTrackReferencePinned(i,s.pin.state)&&s.pin.dispatch({msg:"clear_pin"})},[i,s]);return e.createElement("div",{ref:u,style:{position:"relative"},...l},e.createElement(qe,{trackRef:i},e.createElement(Ue,{participant:i.participant},n??e.createElement(e.Fragment,null,b.isTrackReference(i)&&(((g=i.publication)==null?void 0:g.kind)==="video"||i.source===S.Track.Source.Camera||i.source===S.Track.Source.ScreenShare)?e.createElement(He,{trackRef:i,onSubscriptionStatusChanged:m,manageSubscription:p}):b.isTrackReference(i)&&e.createElement(X,{trackRef:i,onSubscriptionStatusChanged:m}),e.createElement("div",{className:"lk-participant-placeholder"},e.createElement(me,null)),e.createElement("div",{className:"lk-participant-metadata"},e.createElement("div",{className:"lk-participant-metadata-item"},i.source===S.Track.Source.Camera?e.createElement(e.Fragment,null,h&&e.createElement(Le,{style:{marginRight:"0.25rem"}}),e.createElement(de,{trackRef:{participant:i.participant,source:S.Track.Source.Microphone},show:"muted"}),e.createElement(K,null)):e.createElement(e.Fragment,null,e.createElement(oe,{style:{marginRight:"0.25rem"}}),e.createElement(K,null,"'s screen"))),e.createElement(ue,{className:"lk-participant-metadata-item"}))),e.createElement(_e,{trackRef:i}))))});function We(t){const a=f.mergeProps$1(t,{className:"lk-focus-layout"});return e.createElement("div",{...a},t.children)}function Qe({trackRef:t,...a}){return e.createElement(J,{trackRef:t,...a})}function Y({tracks:t,...a}){return e.createElement(e.Fragment,null,t.map(n=>e.createElement(f.TrackRefContext.Provider,{value:n,key:b.getTrackReferenceId(n)},f.cloneSingleChild(a.children))))}function ht({totalPageCount:t,nextPage:a,prevPage:n,currentPage:r,pagesContainer:c}){const[o,u]=e.useState(!1);return e.useEffect(()=>{let i;return c&&(i=b.createInteractingObservable(c.current,2e3).subscribe(u)),()=>{i&&i.unsubscribe()}},[c]),e.createElement("div",{className:"lk-pagination-control","data-lk-user-interaction":o},e.createElement("button",{className:"lk-button",onClick:n},e.createElement(re,null)),e.createElement("span",{className:"lk-pagination-count"},`${r} of ${t}`),e.createElement("button",{className:"lk-button",onClick:a},e.createElement(re,null)))}const gt=e.forwardRef(function({totalPageCount:a,currentPage:n},r){const c=new Array(a).fill("").map((o,u)=>u+1===n?e.createElement("span",{"data-lk-active":!0,key:u}):e.createElement("span",{key:u}));return e.createElement("div",{ref:r,className:"lk-pagination-indicator"},c)});function Ge({tracks:t,...a}){const n=e.createRef(),r=e.useMemo(()=>f.mergeProps$1(a,{className:"lk-grid-layout"}),[a]),{layout:c}=f.useGridLayout(n,t.length),o=f.usePagination(c.maxTiles,t);return f.useSwipe(n,{onLeftSwipe:o.nextPage,onRightSwipe:o.prevPage}),e.createElement("div",{ref:n,"data-lk-pagination":o.totalPageCount>1,...r},e.createElement(Y,{tracks:o.tracks},a.children),t.length>c.maxTiles&&e.createElement(e.Fragment,null,e.createElement(gt,{totalPageCount:o.totalPageCount,currentPage:o.currentPage}),e.createElement(ht,{pagesContainer:n,...o})))}const vt=130,pt=140,we=1,Ke=16/10,Et=(1-Ke)*-1;function Je({tracks:t,orientation:a,...n}){const r=e.useRef(null),[c,o]=e.useState(0),{width:u,height:i}=f.useSize(r),l=a||(i>=u?"vertical":"horizontal"),h=l==="vertical"?Math.max(u*Et,vt):Math.max(i*Ke,pt),s=b.getScrollBarWidth(),p=Math.max(l==="vertical"?(i-s)/h:(u-s)/h,we);let m=Math.round(p);Math.abs(p-c)<.5?m=Math.round(c):c!==p&&o(p);const E=f.useVisualStableUpdate(t,m);return e.useLayoutEffect(()=>{r.current&&(r.current.dataset.lkOrientation=l,r.current.style.setProperty("--lk-max-visible-tiles",m.toString()))},[m,l]),e.createElement("aside",{key:l,className:"lk-carousel",ref:r,...n},e.createElement(Y,{tracks:E},n.children))}function fe({value:t,onPinChange:a,onWidgetChange:n,children:r}){const c=f.useEnsureCreateLayoutContext(t);return e.useEffect(()=>{b.log.debug("PinState Updated",{state:c.pin.state}),a&&c.pin.state&&a(c.pin.state)},[c.pin.state,a]),e.useEffect(()=>{b.log.debug("Widget Updated",{widgetState:c.widget.state}),n&&c.widget.state&&n(c.widget.state)},[n,c.widget.state]),e.createElement(f.LayoutContext.Provider,{value:c},r)}function Xe({room:t,volume:a,muted:n}){const r=f.useTracks([S.Track.Source.Microphone,S.Track.Source.ScreenShareAudio,S.Track.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0,room:t}).filter(c=>!c.participant.isLocal&&c.publication.kind===S.Track.Kind.Audio);return e.createElement("div",{style:{display:"none"}},r.map(c=>e.createElement(X,{key:b.getTrackReferenceId(c),trackRef:c,volume:a,muted:n})))}function Ye(t){const a=e.useMemo(()=>f.mergeProps$1(t,{className:"lk-toast"}),[t]);return e.createElement("div",{...a},t.children)}const kt=t=>{const a=[];for(let n=0;n<t;n++)a.push([n,t-1-n]);return a},be=t=>[[Math.floor(t/2)],[-1]],St=(t,a,n)=>{const[r,c]=V.useState(0),[o,u]=V.useState([[]]);V.useEffect(()=>{if(t==="thinking")u(be(a));else if(t==="connecting"||t==="initializing"){const l=[...kt(a)];u(l)}else u(t==="listening"?be(a):t===void 0||t==="speaking"?[new Array(a).fill(0).map((l,h)=>h)]:[[]]);c(0)},[t,a]);const i=V.useRef(null);return V.useEffect(()=>{let l=performance.now();const h=s=>{s-l>=n&&(c(m=>m+1),l=s),i.current=requestAnimationFrame(h)};return i.current=requestAnimationFrame(h),()=>{i.current!==null&&cancelAnimationFrame(i.current)}},[n,a,t,o.length]),o[r%o.length]},wt=new Map([["connecting",2e3],["initializing",2e3],["listening",500],["thinking",150]]),bt=(t,a)=>{if(t===void 0)return 1e3;let n=wt.get(t);if(n)switch(t){case"connecting":n/=a;break}return n},he=e.forwardRef(function({state:a,options:n,barCount:r=15,trackRef:c,track:o,children:u,...i},l){const h=f.mergeProps$1(i,{className:"lk-audio-bar-visualizer"});let s=f.useMaybeTrackRefContext();(c||o)&&(s=c||o);const p=f.useMultibandTrackVolume(s,{bands:r,loPass:100,hiPass:200}),m=(n==null?void 0:n.minHeight)??20,E=(n==null?void 0:n.maxHeight)??100,g=St(a,r,bt(a,r)??100);return e.createElement("div",{ref:l,...h,"data-lk-va-state":a},p.map((v,d)=>u?f.cloneSingleChild(u,{"data-lk-highlighted":g.includes(d),"data-lk-bar-index":d,className:"lk-audio-bar",style:{height:`${Math.min(E,Math.max(m,v*100+5))}%`}}):e.createElement("span",{key:d,"data-lk-highlighted":g.includes(d),"data-lk-bar-index":d,className:`lk-audio-bar ${g.includes(d)&&"lk-highlighted"}`,style:{height:`${Math.min(E,Math.max(m,v*100+5))}%`}})))}),et=e.forwardRef(function({children:a,disableSpeakingIndicator:n,onParticipantClick:r,trackRef:c,...o},u){const i=f.useEnsureTrackRef(c),{elementProps:l}=f.useParticipantTile({trackRef:i,htmlProps:o,disableSpeakingIndicator:n,onParticipantClick:r});return e.createElement("div",{ref:u,style:{position:"relative",minHeight:"160px"},...l},e.createElement(f.TrackRefContext.Provider,{value:i},a??e.createElement(e.Fragment,null,b.isTrackReference(i)&&e.createElement(X,{trackRef:i}),e.createElement(he,{barCount:7,options:{minHeight:8}}),e.createElement("div",{className:"lk-participant-metadata"},e.createElement("div",{className:"lk-participant-metadata-item"},e.createElement(de,{trackRef:i}),e.createElement(K,null)),e.createElement(ue,{className:"lk-participant-metadata-item"})))))});function tt(t){const[a,n]=e.useState(void 0),r=f.useConnectionState(t.room);return e.useEffect(()=>{switch(r){case S.ConnectionState.Reconnecting:n(e.createElement(e.Fragment,null,e.createElement(ce,{className:"lk-spinner"})," Reconnecting"));break;case S.ConnectionState.Connecting:n(e.createElement(e.Fragment,null,e.createElement(ce,{className:"lk-spinner"})," Connecting"));break;case S.ConnectionState.Disconnected:n(e.createElement(e.Fragment,null,"Disconnected"));break;default:n(void 0);break}},[r]),a?e.createElement(Ye,{className:"lk-toast-connection-state"},a):e.createElement(e.Fragment,null)}const nt=e.forwardRef(function({entry:a,hideName:n=!1,hideTimestamp:r=!1,messageFormatter:c,...o},u){var m,E,g,v;const i=e.useMemo(()=>c?c(a.message):a.message,[a.message,c]),l=!!a.editTimestamp,h=new Date(a.timestamp),s=typeof navigator<"u"?navigator.language:"en-US",p=((m=a.from)==null?void 0:m.name)??((E=a.from)==null?void 0:E.identity);return e.createElement("li",{ref:u,className:"lk-chat-entry",title:h.toLocaleTimeString(s,{timeStyle:"full"}),"data-lk-message-origin":(g=a.from)!=null&&g.isLocal?"local":"remote",...o},(!r||!n||l)&&e.createElement("span",{className:"lk-meta-data"},!n&&e.createElement("strong",{className:"lk-participant-name"},p),(!r||l)&&e.createElement("span",{className:"lk-timestamp"},l&&"edited ",h.toLocaleTimeString(s,{timeStyle:"short"}))),e.createElement("span",{className:"lk-message-body"},i),e.createElement("span",{className:"lk-message-attachements"},(v=a.attachedFiles)==null?void 0:v.map(d=>d.type.startsWith("image/")&&e.createElement("img",{style:{maxWidth:"300px",maxHeight:"300px"},key:d.name,src:URL.createObjectURL(d),alt:d.name}))))});function Ct(t){return b.tokenize(t,b.createDefaultGrammar()).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 e.createElement("a",{className:"lk-chat-link",key:n,href:c,target:"_blank",rel:"noreferrer"},r)}})}function ge({messageFormatter:t,messageDecoder:a,messageEncoder:n,channelTopic:r,...c}){const o=e.useRef(null),u=e.useRef(null),i=e.useMemo(()=>({messageDecoder:a,messageEncoder:n,channelTopic:r}),[a,n,r]),{chatMessages:l,send:h,isSending:s}=f.useChat(i),p=f.useMaybeLayoutContext(),m=e.useRef(0);async function E(g){g.preventDefault(),u.current&&u.current.value.trim()!==""&&(await h(u.current.value),u.current.value="",u.current.focus())}return e.useEffect(()=>{var g;o&&((g=o.current)==null||g.scrollTo({top:o.current.scrollHeight}))},[o,l]),e.useEffect(()=>{var d,w,k,P,I;if(!p||l.length===0)return;if((d=p.widget.state)!=null&&d.showChat&&l.length>0&&m.current!==((w=l[l.length-1])==null?void 0:w.timestamp)){m.current=(k=l[l.length-1])==null?void 0:k.timestamp;return}const g=l.filter(C=>!m.current||C.timestamp>m.current).length,{widget:v}=p;g>0&&((P=v.state)==null?void 0:P.unreadMessages)!==g&&((I=v.dispatch)==null||I.call(v,{msg:"unread_msg",count:g}))},[l,p==null?void 0:p.widget]),e.createElement("div",{...c,className:"lk-chat"},e.createElement("div",{className:"lk-chat-header"},"Messages",p&&e.createElement(le,{className:"lk-close-button"},e.createElement(Re,null))),e.createElement("ul",{className:"lk-list lk-chat-messages",ref:o},c.children?l.map((g,v)=>f.cloneSingleChild(c.children,{entry:g,key:g.id??v,messageFormatter:t})):l.map((g,v,d)=>{const w=v>=1&&d[v-1].from===g.from,k=v>=1&&g.timestamp-d[v-1].timestamp<6e4;return e.createElement(nt,{key:g.id??v,hideName:w,hideTimestamp:w===!1?!1:k,entry:g,messageFormatter:t})})),e.createElement("form",{className:"lk-chat-form",onSubmit:E},e.createElement("input",{className:"lk-form-control lk-chat-form-input",disabled:s,ref:u,type:"text",placeholder:"Enter a message...",onInput:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),onKeyUp:g=>g.stopPropagation()}),e.createElement("button",{type:"submit",className:"lk-button lk-chat-form-button",disabled:s},"Send")))}function U({kind:t,initialSelection:a,onActiveDeviceChange:n,tracks:r,requestPermissions:c=!1,...o}){const[u,i]=e.useState(!1),[l,h]=e.useState([]),[s,p]=e.useState(!0),[m,E]=e.useState(c),g=(k,P)=>{b.log.debug("handle device change"),i(!1),n==null||n(k,P)},v=e.useRef(null),d=e.useRef(null);e.useLayoutEffect(()=>{u&&E(!0)},[u]),e.useLayoutEffect(()=>{let k;return v.current&&d.current&&(l||s)&&(k=b.computeMenuPosition(v.current,d.current,(P,I)=>{d.current&&Object.assign(d.current.style,{left:`${P}px`,top:`${I}px`})})),p(!1),()=>{k==null||k()}},[v,d,l,s]);const w=e.useCallback(k=>{d.current&&k.target!==v.current&&u&&b.wasClickOutside(d.current,k)&&i(!1)},[u,d,v]);return e.useEffect(()=>(document.addEventListener("click",w),()=>{document.removeEventListener("click",w)}),[w]),e.createElement(e.Fragment,null,e.createElement("button",{className:"lk-button lk-button-menu","aria-pressed":u,...o,onClick:()=>i(!u),ref:v},o.children),!o.disabled&&e.createElement("div",{className:"lk-device-menu",ref:d,style:{visibility:u?"visible":"hidden"}},t?e.createElement(G,{initialSelection:a,onActiveDeviceChange:k=>g(t,k),onDeviceListChange:h,kind:t,track:r==null?void 0:r[t],requestPermissions:m}):e.createElement(e.Fragment,null,e.createElement("div",{className:"lk-device-menu-heading"},"Audio inputs"),e.createElement(G,{kind:"audioinput",onActiveDeviceChange:k=>g("audioinput",k),onDeviceListChange:h,track:r==null?void 0:r.audioinput,requestPermissions:m}),e.createElement("div",{className:"lk-device-menu-heading"},"Video inputs"),e.createElement(G,{kind:"videoinput",onActiveDeviceChange:k=>g("videoinput",k),onDeviceListChange:h,track:r==null?void 0:r.videoinput,requestPermissions:m}))))}function ve(){e.useEffect(()=>{f.warnAboutMissingStyles()},[])}function at(t,a){const[n,r]=e.useState(),c=e.useMemo(()=>new S.Mutex,[]);return e.useEffect(()=>{let o=!1,u=[];return c.lock().then(async i=>{try{(t.audio||t.video)&&(u=await S.createLocalTracks(t),o?u.forEach(l=>l.stop()):r(u))}catch(l){a&&l instanceof Error?a(l):b.log.error(l)}finally{i()}}),()=>{o=!0,u.forEach(i=>{i.stop()})}},[JSON.stringify(t,f.roomOptionsStringifyReplacer),a,c]),n}function Mt(t,a,n){const[r,c]=e.useState(null),[o,u]=e.useState(!1),i=f.useMediaDevices({kind:n}),[l,h]=e.useState(void 0),[s,p]=e.useState(),[m,E]=e.useState(a);e.useEffect(()=>{E(a)},[a]);const g=async(w,k)=>{try{const P=k==="videoinput"?await S.createLocalVideoTrack({deviceId:w,resolution:S.VideoPresets.h720.resolution}):await S.createLocalAudioTrack({deviceId:w}),I=await P.getDeviceId(!1);I&&w!==I&&(d.current=I,E(I)),p(P)}catch(P){P instanceof Error&&c(P)}},v=async(w,k)=>{await w.setDeviceId(k),d.current=k},d=e.useRef(m);return e.useEffect(()=>{t&&!s&&!r&&!o&&(b.log.debug("creating track",n),u(!0),g(m,n).finally(()=>{u(!1)}))},[t,s,r,o]),e.useEffect(()=>{s&&(t?l!=null&&l.deviceId&&d.current!==(l==null?void 0:l.deviceId)?(b.log.debug(`switching ${n} device from`,d.current,l.deviceId),v(s,l.deviceId)):(b.log.debug(`unmuting local ${n} track`),s.unmute()):(b.log.debug(`muting ${n} track`),s.mute().then(()=>b.log.debug(s.mediaStreamTrack))))},[s,l,t,n]),e.useEffect(()=>()=>{s&&(b.log.debug(`stopping local ${n} track`),s.stop(),s.mute())},[]),e.useEffect(()=>{h(i==null?void 0:i.find(w=>w.deviceId===m))},[m,i]),{selectedDevice:l,localTrack:s,deviceError:r}}function Tt({defaults:t={},onValidate:a,onSubmit:n,onError:r,debug:c,joinLabel:o="Join Room",micLabel:u="Microphone",camLabel:i="Camera",userLabel:l="Username",persistUserChoices:h=!0,videoProcessor:s,...p}){const{userChoices:m,saveAudioInputDeviceId:E,saveAudioInputEnabled:g,saveVideoInputDeviceId:v,saveVideoInputEnabled:d,saveUsername:w}=f.usePersistentUserChoices({defaults:t,preventSave:!h,preventLoad:!h}),[k,P]=e.useState(m),[I,C]=e.useState(k.audioEnabled),[T,M]=e.useState(k.videoEnabled),[R,D]=e.useState(k.audioDeviceId),[y,N]=e.useState(k.videoDeviceId),[F,O]=e.useState(k.username);e.useEffect(()=>{g(I)},[I,g]),e.useEffect(()=>{d(T)},[T,d]),e.useEffect(()=>{E(R)},[R,E]),e.useEffect(()=>{v(y)},[y,v]),e.useEffect(()=>{w(F)},[F,w]);const z=at({audio:I?{deviceId:m.audioDeviceId}:!1,video:T?{deviceId:m.videoDeviceId,processor:s}:!1},r),_=e.useRef(null),L=e.useMemo(()=>z==null?void 0:z.filter(A=>A.kind===S.Track.Kind.Video)[0],[z]),q=e.useMemo(()=>{if(L){const{facingMode:A}=S.facingModeFromLocalTrack(L);return A}else return"undefined"},[L]),j=e.useMemo(()=>z==null?void 0:z.filter(A=>A.kind===S.Track.Kind.Audio)[0],[z]);e.useEffect(()=>(_.current&&L&&(L.unmute(),L.attach(_.current)),()=>{L==null||L.detach()}),[L]);const[ee,te]=e.useState(),B=e.useCallback(A=>typeof a=="function"?a(A):A.username!=="",[a]);e.useEffect(()=>{const A={username:F,videoEnabled:T,videoDeviceId:y,audioEnabled:I,audioDeviceId:R};P(A),te(B(A))},[F,T,B,I,R,y]);function H(A){A.preventDefault(),B(k)?typeof n=="function"&&n(k):b.log.warn("Validation failed with: ",k)}return ve(),e.createElement("div",{className:"lk-prejoin",...p},e.createElement("div",{className:"lk-video-container"},L&&e.createElement("video",{ref:_,width:"1280",height:"720","data-lk-facing-mode":q}),(!L||!T)&&e.createElement("div",{className:"lk-camera-off-note"},e.createElement(me,null))),e.createElement("div",{className:"lk-button-group-container"},e.createElement("div",{className:"lk-button-group audio"},e.createElement(Z,{initialState:I,source:S.Track.Source.Microphone,onChange:A=>C(A)},u),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{initialSelection:R,kind:"audioinput",disabled:!j,tracks:{audioinput:j},onActiveDeviceChange:(A,W)=>D(W)}))),e.createElement("div",{className:"lk-button-group video"},e.createElement(Z,{initialState:T,source:S.Track.Source.Camera,onChange:A=>M(A)},i),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{initialSelection:y,kind:"videoinput",disabled:!L,tracks:{videoinput:L},onActiveDeviceChange:(A,W)=>N(W)})))),e.createElement("form",{className:"lk-username-container"},e.createElement("input",{className:"lk-form-control",id:"username",name:"username",type:"text",defaultValue:F,placeholder:l,onChange:A=>O(A.target.value),autoComplete:"off"}),e.createElement("button",{className:"lk-button lk-join-button",type:"submit",onClick:H,disabled:!ee},o)),c&&e.createElement(e.Fragment,null,e.createElement("strong",null,"User Choices:"),e.createElement("ul",{className:"lk-list",style:{overflow:"hidden",maxWidth:"15rem"}},e.createElement("li",null,"Username: ",`${k.username}`),e.createElement("li",null,"Video Enabled: ",`${k.videoEnabled}`),e.createElement("li",null,"Audio Enabled: ",`${k.audioEnabled}`),e.createElement("li",null,"Video Device: ",`${k.videoDeviceId}`),e.createElement("li",null,"Audio Device: ",`${k.audioDeviceId}`))))}function yt({props:t}){const{dispatch:a,state:n}=f.useLayoutContext().widget,r="lk-button lk-settings-toggle";return{mergedProps:e.useMemo(()=>f.mergeProps(t,{className:r,onClick:()=>{a&&a({msg:"toggle_settings"})},"aria-pressed":n!=null&&n.showSettings?"true":"false"}),[t,r,a,n])}}const Rt=e.forwardRef(function(a,n){const{mergedProps:r}=yt({props:a});return e.createElement("button",{ref:n,...r},a.children)}),It=t=>{switch(t){case S.Track.Source.Camera:return 1;case S.Track.Source.Microphone:return 2;case S.Track.Source.ScreenShare:return 3;default:return 0}};function pe({variation:t,controls:a,saveUserChoices:n=!0,onDeviceError:r,...c}){var D;const[o,u]=e.useState(!1),i=f.useMaybeLayoutContext();e.useEffect(()=>{var y,N;((y=i==null?void 0:i.widget.state)==null?void 0:y.showChat)!==void 0&&u((N=i==null?void 0:i.widget.state)==null?void 0:N.showChat)},[(D=i==null?void 0:i.widget.state)==null?void 0:D.showChat]);const h=lt(`(max-width: ${o?1e3:760}px)`)?"minimal":"verbose";t??(t=h);const s={leave:!0,...a},p=f.useLocalParticipantPermissions();if(!p)s.camera=!1,s.chat=!1,s.microphone=!1,s.screenShare=!1;else{const y=N=>p.canPublish&&(p.canPublishSources.length===0||p.canPublishSources.includes(It(N)));s.camera??(s.camera=y(S.Track.Source.Camera)),s.microphone??(s.microphone=y(S.Track.Source.Microphone)),s.screenShare??(s.screenShare=y(S.Track.Source.ScreenShare)),s.chat??(s.chat=p.canPublishData&&(a==null?void 0:a.chat))}const m=e.useMemo(()=>t==="minimal"||t==="verbose",[t]),E=e.useMemo(()=>t==="textOnly"||t==="verbose",[t]),g=b.supportsScreenSharing(),[v,d]=e.useState(!1),w=e.useCallback(y=>{d(y)},[d]),k=f.mergeProps$1({className:"lk-control-bar"},c),{saveAudioInputEnabled:P,saveVideoInputEnabled:I,saveAudioInputDeviceId:C,saveVideoInputDeviceId:T}=f.usePersistentUserChoices({preventSave:!n}),M=e.useCallback((y,N)=>N?P(y):null,[P]),R=e.useCallback((y,N)=>N?I(y):null,[I]);return e.createElement("div",{...k},s.microphone&&e.createElement("div",{className:"lk-button-group"},e.createElement(Z,{source:S.Track.Source.Microphone,showIcon:m,onChange:M,onDeviceError:y=>r==null?void 0:r({source:S.Track.Source.Microphone,error:y})},E&&"Microphone"),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{kind:"audioinput",onActiveDeviceChange:(y,N)=>C(N??"default")}))),s.camera&&e.createElement("div",{className:"lk-button-group"},e.createElement(Z,{source:S.Track.Source.Camera,showIcon:m,onChange:R,onDeviceError:y=>r==null?void 0:r({source:S.Track.Source.Camera,error:y})},E&&"Camera"),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{kind:"videoinput",onActiveDeviceChange:(y,N)=>T(N??"default")}))),s.screenShare&&g&&e.createElement(Z,{source:S.Track.Source.ScreenShare,captureOptions:{audio:!0,selfBrowserSurface:"include"},showIcon:m,onChange:w,onDeviceError:y=>r==null?void 0:r({source:S.Track.Source.ScreenShare,error:y})},E&&(v?"Stop screen share":"Share screen")),s.chat&&e.createElement(le,null,m&&e.createElement(Ie,null),E&&"Chat"),s.settings&&e.createElement(Rt,null,m&&e.createElement(Ae,null),E&&"Settings"),s.leave&&e.createElement(ie,null,m&&e.createElement(Ne,null),E&&"Leave"),e.createElement(se,null))}function Pt({chatMessageFormatter:t,chatMessageDecoder:a,chatMessageEncoder:n,SettingsComponent:r,controlBarProops:c={},...o}){var v,d;const[u,i]=e.useState({showChat:!1,unreadMessages:0,showSettings:!1}),l=e.useRef(null),h=f.useTracks([{source:S.Track.Source.Camera,withPlaceholder:!0},{source:S.Track.Source.ScreenShare,withPlaceholder:!1}],{updateOnlyOn:[S.RoomEvent.ActiveSpeakersChanged],onlySubscribed:!1}),s=w=>{b.log.debug("updating widget state",w),i(w)},p=f.useCreateLayoutContext(),m=h.filter(b.isTrackReference).filter(w=>w.publication.source===S.Track.Source.ScreenShare),E=(v=f.usePinnedTracks(p))==null?void 0:v[0],g=h.filter(w=>!b.isEqualTrackRef(w,E));return e.useEffect(()=>{var w,k,P,I,C,T;if(m.some(M=>M.publication.isSubscribed)&&l.current===null?(b.log.debug("Auto set screen share focus:",{newScreenShareTrack:m[0]}),(k=(w=p.pin).dispatch)==null||k.call(w,{msg:"set_pin",trackReference:m[0]}),l.current=m[0]):l.current&&!m.some(M=>{var R,D;return M.publication.trackSid===((D=(R=l.current)==null?void 0:R.publication)==null?void 0:D.trackSid)})&&(b.log.debug("Auto clearing screen share focus."),(I=(P=p.pin).dispatch)==null||I.call(P,{msg:"clear_pin"}),l.current=null),E&&!b.isTrackReference(E)){const M=h.find(R=>R.participant.identity===E.participant.identity&&R.source===E.source);M!==E&&b.isTrackReference(M)&&((T=(C=p.pin).dispatch)==null||T.call(C,{msg:"set_pin",trackReference:M}))}},[m.map(w=>`${w.publication.trackSid}_${w.publication.isSubscribed}`).join(),(d=E==null?void 0:E.publication)==null?void 0:d.trackSid,h]),ve(),e.createElement("div",{className:"lk-video-conference",...o},b.isWeb()&&e.createElement(fe,{value:p,onWidgetChange:s},e.createElement("div",{className:"lk-video-conference-inner"},E?e.createElement("div",{className:"lk-focus-layout-wrapper"},e.createElement(We,null,e.createElement(Je,{tracks:g},e.createElement(J,null)),E&&e.createElement(Qe,{trackRef:E}))):e.createElement("div",{className:"lk-grid-layout-wrapper"},e.createElement(Ge,{tracks:h},e.createElement(J,null))),e.createElement(pe,{controls:{chat:!0,settings:!!r,...c}})),e.createElement(ge,{style:{display:u.showChat?"grid":"none"},messageFormatter:t,messageEncoder:n,messageDecoder:a}),r&&e.createElement("div",{className:"lk-settings-menu-modal",style:{display:u.showSettings?"block":"none"}},e.createElement(r,null))),e.createElement(Xe,null),e.createElement(tt,null))}function At({...t}){const[a,n]=e.useState({showChat:!1,unreadMessages:0}),r=f.useTracks([S.Track.Source.Microphone]);return ve(),e.createElement(fe,{onWidgetChange:n},e.createElement("div",{className:"lk-audio-conference",...t},e.createElement("div",{className:"lk-audio-conference-stage"},e.createElement(Y,{tracks:r},e.createElement(et,null))),e.createElement(pe,{controls:{microphone:!0,screenShare:!1,camera:!1,chat:!0}}),a.showChat&&e.createElement(ge,null)))}function Nt({controls:t,saveUserChoices:a=!0,onDeviceError:n,...r}){const c={leave:!0,microphone:!0,...t},o=f.useLocalParticipantPermissions(),{microphoneTrack:u,localParticipant:i}=b.useLocalParticipant(),l=e.useMemo(()=>({participant:i,source:S.Track.Source.Microphone,publication:u}),[i,u]);o?c.microphone??(c.microphone=o.canPublish):c.microphone=!1;const h=f.mergeProps$1({className:"lk-agent-control-bar"},r),{saveAudioInputEnabled:s,saveAudioInputDeviceId:p}=f.usePersistentUserChoices({preventSave:!a}),m=e.useCallback((E,g)=>{g&&s(E)},[s]);return e.createElement("div",{...h},c.microphone&&e.createElement("div",{className:"lk-button-group"},e.createElement(Z,{source:S.Track.Source.Microphone,showIcon:!0,onChange:m,onDeviceError:E=>n==null?void 0:n({source:S.Track.Source.Microphone,error:E})},e.createElement(he,{trackRef:l,barCount:7,options:{minHeight:5}})),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{kind:"audioinput",onActiveDeviceChange:(E,g)=>p(g??"default")}))),c.leave&&e.createElement(ie,null,"Disconnect"),e.createElement(se,null))}exports.AudioConference=At;exports.AudioTrack=X;exports.BarVisualizer=he;exports.CarouselLayout=Je;exports.Chat=ge;exports.ChatEntry=nt;exports.ChatToggle=le;exports.ConnectionQualityIndicator=ue;exports.ConnectionStateToast=tt;exports.ControlBar=pe;exports.DisconnectButton=ie;exports.FocusLayout=Qe;exports.FocusLayoutContainer=We;exports.FocusToggle=_e;exports.GridLayout=Ge;exports.LKFeatureContext=Ce;exports.LayoutContextProvider=fe;exports.MediaDeviceMenu=U;exports.MediaDeviceSelect=G;exports.ParticipantAudioTile=et;exports.ParticipantContextIfNeeded=Ue;exports.ParticipantName=K;exports.ParticipantTile=J;exports.PreJoin=Tt;exports.RoomAudioRenderer=Xe;exports.StartMediaButton=se;exports.SvgCameraDisabledIcon=Te;exports.SvgCameraIcon=ye;exports.SvgChatCloseIcon=Re;exports.SvgChatIcon=Ie;exports.SvgChevron=re;exports.SvgFocusToggleIcon=Pe;exports.SvgGearIcon=Ae;exports.SvgLeaveIcon=Ne;exports.SvgLockLockedIcon=Le;exports.SvgMicDisabledIcon=xe;exports.SvgMicIcon=Ve;exports.SvgParticipantPlaceholder=me;exports.SvgQualityExcellentIcon=Fe;exports.SvgQualityGoodIcon=De;exports.SvgQualityPoorIcon=ze;exports.SvgQualityUnknownIcon=Oe;exports.SvgScreenShareIcon=oe;exports.SvgScreenShareStopIcon=$e;exports.SvgSpinnerIcon=ce;exports.SvgUnfocusToggleIcon=Ze;exports.Toast=Ye;exports.TrackLoop=Y;exports.TrackMutedIndicator=de;exports.TrackRefContextIfNeeded=qe;exports.TrackToggle=Z;exports.VideoConference=Pt;exports.VideoTrack=He;exports.VoiceAssistantControlBar=Nt;exports.formatChatMessageLinks=Ct;exports.useFeatureContext=Me;exports.usePreviewDevice=Mt;exports.usePreviewTracks=at;
2
- //# sourceMappingURL=shared-DTHOl3uJ.js.map
1
+ "use strict";const S=require("livekit-client"),V=require("react"),b=require("./shared-BDr0qLg4.js"),f=require("./shared-CjI_UuOX.js");function ct(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const e=ct(V);function lt(t){const a=o=>typeof window<"u"?window.matchMedia(o).matches:!1,[n,r]=e.useState(a(t));function c(){r(a(t))}return e.useEffect(()=>{const o=window.matchMedia(t);return c(),o.addListener?o.addListener(c):o.addEventListener("change",c),()=>{o.removeListener?o.removeListener(c):o.removeEventListener("change",c)}},[t]),n}const Ce=e.createContext(void 0);function Me(t){const a=e.useContext(Ce);if(t===!0){if(a)return a;throw Error("tried to access feature context, but none is present")}return a}const le=e.forwardRef(function(a,n){const{mergedProps:r}=f.useChatToggle({props:a});return e.createElement("button",{ref:n,...r},a.children)}),ie=e.forwardRef(function(a,n){const{buttonProps:r}=f.useDisconnectButton(a);return e.createElement("button",{ref:n,...r},a.children)}),Te=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"}),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"})),ye=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"})),Re=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",...t},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"})),Ie=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:18,fill:"none",...t},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"}),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"})),re=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"})),Pe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},e.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5},e.createElement("path",{d:"M10 1.75h4.25m0 0V6m0-4.25L9 7M6 14.25H1.75m0 0V10m0 4.25L7 9"}))),Ae=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"})),Ne=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"}),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"})),Le=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"})),xe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"}),e.createElement("path",{d:"M8.743 10.907 5 7.164V8a3 3 0 0 0 3.743 2.907z"})),Ve=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},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"}),e.createElement("path",{d:"M5 3a3 3 0 1 1 6 0v5a3 3 0 0 1-6 0z"})),Fe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentcolor",...t},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"}),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"})),De=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentcolor",...t},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"}),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"}),e.createElement("g",{opacity:.25},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"}),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"}))),ze=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentcolor",...t},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"}),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"}),e.createElement("g",{opacity:.25},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"}),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"}),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"}))),Oe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",...t},e.createElement("g",{opacity:.25},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"}),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"}))),oe=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:16,fill:"none",...t},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"}),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"})),$e=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:16,fill:"none",...t},e.createElement("g",{fill:"currentColor"},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"}),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"}))),ce=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},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"}),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:.7}),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"}),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:.6}),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"}),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:.5}),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"}),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:.4}),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:.9}),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:.3}),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:.8}),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:.2})),Ze=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",...t},e.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5},e.createElement("path",{d:"M13.25 7H9m0 0V2.75M9 7l5.25-5.25M2.75 9H7m0 0v4.25M7 9l-5.25 5.25"}))),_e=e.forwardRef(function({trackRef:a,...n},r){const c=f.useMaybeTrackRefContext(),{mergedProps:o,inFocus:u}=f.useFocusToggle({trackRef:a??c,props:n});return e.createElement(f.LayoutContext.Consumer,null,i=>i!==void 0&&e.createElement("button",{ref:r,...o},n.children?n.children:u?e.createElement(Ze,null):e.createElement(Pe,null)))}),G=e.forwardRef(function({kind:a,initialSelection:n,onActiveDeviceChange:r,onDeviceListChange:c,onDeviceSelectError:o,exactMatch:u,track:i,requestPermissions:l,onError:h,...s},p){const m=b.useMaybeRoomContext(),E=e.useRef("default"),g=e.useCallback(M=>{m&&m.emit(S.RoomEvent.MediaDevicesError,M),h==null||h(M)},[m,h]),{devices:v,activeDeviceId:d,setActiveMediaDevice:w,className:k}=f.useMediaDeviceSelect({kind:a,room:m,track:i,requestPermissions:l,onError:g});e.useEffect(()=>{n!==void 0&&w(n)},[w]),e.useEffect(()=>{typeof c=="function"&&c(v)},[c,v]),e.useEffect(()=>{d!==E.current&&(r==null||r(d)),E.current=d},[d]);const P=async M=>{try{await w(M,{exact:u??!0})}catch(R){if(R instanceof Error)o==null||o(R);else throw R}},I=e.useMemo(()=>f.mergeProps$1(s,{className:k},{className:"lk-list"}),[k,s]),C=!!v.find(M=>M.label.toLowerCase().startsWith("default"));function T(M,R,D){return M===R||!C&&D===0&&R==="default"}return e.createElement("ul",{ref:p,...I},v.map((M,R)=>e.createElement("li",{key:M.deviceId,id:M.deviceId,"data-lk-active":T(M.deviceId,d,R),"aria-selected":T(M.deviceId,d,R),role:"option"},e.createElement("button",{className:"lk-button",onClick:()=>P(M.deviceId)},M.label))))}),se=e.forwardRef(function({label:a,...n},r){const c=b.useRoomContext(),{mergedProps:o,canPlayAudio:u}=f.useStartAudio({room:c,props:n}),{mergedProps:i,canPlayVideo:l}=f.useStartVideo({room:c,props:o}),{style:h,...s}=i;return h.display=u&&l?"none":"block",e.createElement("button",{ref:r,style:h,...s},a??`Start ${u?"Video":"Audio"}`)});function je(t,a){switch(t){case S.Track.Source.Microphone:return a?e.createElement(Ve,null):e.createElement(xe,null);case S.Track.Source.Camera:return a?e.createElement(ye,null):e.createElement(Te,null);case S.Track.Source.ScreenShare:return a?e.createElement($e,null):e.createElement(oe,null);default:return}}function it(t){switch(t){case S.ConnectionQuality.Excellent:return e.createElement(Fe,null);case S.ConnectionQuality.Good:return e.createElement(De,null);case S.ConnectionQuality.Poor:return e.createElement(ze,null);default:return e.createElement(Oe,null)}}const Z=e.forwardRef(function({showIcon:a,...n},r){const{buttonProps:c,enabled:o}=f.useTrackToggle(n),[u,i]=e.useState(!1);return e.useEffect(()=>{i(!0)},[]),u&&e.createElement("button",{ref:r,...c},(a??!0)&&je(n.source,o),n.children)}),ue=e.forwardRef(function(a,n){const{className:r,quality:c}=f.useConnectionQualityIndicator(a),o=e.useMemo(()=>({...f.mergeProps$1(a,{className:r}),"data-lk-quality":c}),[c,a,r]);return e.createElement("div",{ref:n,...o},a.children??it(c))}),K=e.forwardRef(function({participant:a,...n},r){const c=f.useEnsureParticipant(a),{className:o,infoObserver:u}=e.useMemo(()=>b.setupParticipantName(c),[c]),{identity:i,name:l}=f.useObservableState(u,{name:c.name,identity:c.identity,metadata:c.metadata}),h=e.useMemo(()=>f.mergeProps$1(n,{className:o,"data-lk-participant-name":l}),[n,o,l]);return e.createElement("span",{ref:r,...h},l!==""?l:i,n.children)}),de=e.forwardRef(function({trackRef:a,show:n="always",...r},c){const{className:o,isMuted:u}=f.useTrackMutedIndicator(a),i=n==="always"||n==="muted"&&u||n==="unmuted"&&!u,l=e.useMemo(()=>f.mergeProps$1(r,{className:o}),[o,r]);return i?e.createElement("div",{ref:c,...l,"data-lk-muted":u},r.children??je(a.source,!u)):null}),me=t=>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},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:.25}),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:.25}));function Be(t,a={}){const[n,r]=e.useState(b.getTrackByIdentifier(t)),[c,o]=e.useState(n==null?void 0:n.isMuted),[u,i]=e.useState(n==null?void 0:n.isSubscribed),[l,h]=e.useState(n==null?void 0:n.track),[s,p]=e.useState("landscape"),m=e.useRef(),{className:E,trackObserver:g}=e.useMemo(()=>b.setupMediaTrack(t),[t.participant.sid??t.participant.identity,t.source,b.isTrackReference(t)&&t.publication.trackSid]);return e.useEffect(()=>{const v=g.subscribe(d=>{b.log.debug("update track",d),r(d),o(d==null?void 0:d.isMuted),i(d==null?void 0:d.isSubscribed),h(d==null?void 0:d.track)});return()=>v==null?void 0:v.unsubscribe()},[g]),e.useEffect(()=>{var v,d;return l&&(m.current&&l.detach(m.current),(v=a.element)!=null&&v.current&&!(t.participant.isLocal&&(l==null?void 0:l.kind)==="audio")&&l.attach(a.element.current)),m.current=(d=a.element)==null?void 0:d.current,()=>{m.current&&(l==null||l.detach(m.current))}},[l,a.element]),e.useEffect(()=>{var v,d;if(typeof((v=n==null?void 0:n.dimensions)==null?void 0:v.width)=="number"&&typeof((d=n==null?void 0:n.dimensions)==null?void 0:d.height)=="number"){const w=n.dimensions.width>n.dimensions.height?"landscape":"portrait";p(w)}},[n]),{publication:n,isMuted:c,isSubscribed:u,track:l,elementProps:f.mergeProps$1(a.props,{className:E,"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":s}})}}var ae,ke;function ot(){if(ke)return ae;ke=1;var t="Expected a function",a=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,u=/^0o[0-7]+$/i,i=parseInt,l=typeof b.commonjsGlobal=="object"&&b.commonjsGlobal&&b.commonjsGlobal.Object===Object&&b.commonjsGlobal,h=typeof self=="object"&&self&&self.Object===Object&&self,s=l||h||Function("return this")(),p=Object.prototype,m=p.toString,E=Math.max,g=Math.min,v=function(){return s.Date.now()};function d(C,T,M){var R,D,y,N,F,O,z=0,_=!1,L=!1,q=!0;if(typeof C!="function")throw new TypeError(t);T=I(T)||0,w(M)&&(_=!!M.leading,L="maxWait"in M,y=L?E(I(M.maxWait)||0,T):y,q="trailing"in M?!!M.trailing:q);function j(x){var $=R,Q=D;return R=D=void 0,z=x,N=C.apply(Q,$),N}function ee(x){return z=x,F=setTimeout(H,T),_?j(x):N}function te(x){var $=x-O,Q=x-z,Ee=T-$;return L?g(Ee,y-Q):Ee}function B(x){var $=x-O,Q=x-z;return O===void 0||$>=T||$<0||L&&Q>=y}function H(){var x=v();if(B(x))return A(x);F=setTimeout(H,te(x))}function A(x){return F=void 0,q&&R?j(x):(R=D=void 0,N)}function W(){F!==void 0&&clearTimeout(F),z=0,R=O=D=F=void 0}function rt(){return F===void 0?N:A(v())}function ne(){var x=v(),$=B(x);if(R=arguments,D=this,O=x,$){if(F===void 0)return ee(O);if(L)return F=setTimeout(H,T),j(O)}return F===void 0&&(F=setTimeout(H,T)),N}return ne.cancel=W,ne.flush=rt,ne}function w(C){var T=typeof C;return!!C&&(T=="object"||T=="function")}function k(C){return!!C&&typeof C=="object"}function P(C){return typeof C=="symbol"||k(C)&&m.call(C)==n}function I(C){if(typeof C=="number")return C;if(P(C))return a;if(w(C)){var T=typeof C.valueOf=="function"?C.valueOf():C;C=w(T)?T+"":T}if(typeof C!="string")return C===0?C:+C;C=C.replace(r,"");var M=o.test(C);return M||u.test(C)?i(C.slice(2),M?2:8):c.test(C)?a:+C}return ae=d,ae}var st=ot();const Se=b.getDefaultExportFromCjs(st);function ut(t){const a=V.useRef(t);a.current=t,V.useEffect(()=>()=>{a.current()},[])}function dt(t,a=500,n){const r=V.useRef();ut(()=>{r.current&&r.current.cancel()});const c=V.useMemo(()=>{const o=Se(t,a,n),u=(...i)=>o(...i);return u.cancel=()=>{o.cancel()},u.isPending=()=>!!r.current,u.flush=()=>o.flush(),u},[t,a,n]);return V.useEffect(()=>{r.current=Se(t,a,n)},[t,a,n]),c}function mt(t,a,n){const r=((h,s)=>h===s),c=t instanceof Function?t():t,[o,u]=V.useState(c),i=V.useRef(c),l=dt(u,a,n);return r(i.current,c)||(l(c),i.current=c),[o,l]}function ft({threshold:t=0,root:a=null,rootMargin:n="0%",freezeOnceVisible:r=!1,initialIsIntersecting:c=!1,onChange:o}={}){var u;const[i,l]=V.useState(null),[h,s]=V.useState(()=>({isIntersecting:c,entry:void 0})),p=V.useRef();p.current=o;const m=((u=h.entry)==null?void 0:u.isIntersecting)&&r;V.useEffect(()=>{if(!i||!("IntersectionObserver"in window)||m)return;const v=new IntersectionObserver(d=>{const w=Array.isArray(v.thresholds)?v.thresholds:[v.thresholds];d.forEach(k=>{const P=k.isIntersecting&&w.some(I=>k.intersectionRatio>=I);s({isIntersecting:P,entry:k}),p.current&&p.current(P,k)})},{threshold:t,root:a,rootMargin:n});return v.observe(i),()=>{v.disconnect()}},[i,JSON.stringify(t),a,n,m,r]);const E=V.useRef(null);V.useEffect(()=>{var v;!i&&((v=h.entry)!=null&&v.target)&&!r&&!m&&E.current!==h.entry.target&&(E.current=h.entry.target,s({isIntersecting:c,entry:void 0}))},[i,h.entry,r,m,c]);const g=[l,!!h.isIntersecting,h.entry];return g.ref=g[0],g.isIntersecting=g[1],g.entry=g[2],g}const He=e.forwardRef(function({onTrackClick:a,onClick:n,onSubscriptionStatusChanged:r,trackRef:c,manageSubscription:o,...u},i){const l=f.useEnsureTrackRef(c),h=e.useRef(null);e.useImperativeHandle(i,()=>h.current);const s=ft({root:h.current}),[p]=mt(s,3e3);e.useEffect(()=>{o&&l.publication instanceof S.RemoteTrackPublication&&(p==null?void 0:p.isIntersecting)===!1&&(s==null?void 0:s.isIntersecting)===!1&&l.publication.setSubscribed(!1)},[p,l,o]),e.useEffect(()=>{o&&l.publication instanceof S.RemoteTrackPublication&&(s==null?void 0:s.isIntersecting)===!0&&l.publication.setSubscribed(!0)},[s,l,o]);const{elementProps:m,publication:E,isSubscribed:g}=Be(l,{element:h,props:u});e.useEffect(()=>{r==null||r(!!g)},[g,r]);const v=d=>{n==null||n(d),a==null||a({participant:l==null?void 0:l.participant,track:E})};return e.createElement("video",{ref:h,...m,muted:!0,onClick:v})}),X=e.forwardRef(function({trackRef:a,onSubscriptionStatusChanged:n,volume:r,...c},o){const u=f.useEnsureTrackRef(a),i=e.useRef(null);e.useImperativeHandle(o,()=>i.current);const{elementProps:l,isSubscribed:h,track:s,publication:p}=Be(u,{element:i,props:c});return e.useEffect(()=>{n==null||n(!!h)},[h,n]),e.useEffect(()=>{s===void 0||r===void 0||(s instanceof S.RemoteAudioTrack?s.setVolume(r):b.log.warn("Volume can only be set on remote audio tracks."))},[r,s]),e.useEffect(()=>{p===void 0||c.muted===void 0||(p instanceof S.RemoteTrackPublication?p.setEnabled(!c.muted):b.log.warn("Can only call setEnabled on remote track publications."))},[c.muted,p,s]),e.createElement("audio",{ref:i,...l})});function Ue(t){const a=!!f.useMaybeParticipantContext();return t.participant&&!a?e.createElement(f.ParticipantContext.Provider,{value:t.participant},t.children):e.createElement(e.Fragment,null,t.children)}function qe(t){const a=!!f.useMaybeTrackRefContext();return t.trackRef&&!a?e.createElement(f.TrackRefContext.Provider,{value:t.trackRef},t.children):e.createElement(e.Fragment,null,t.children)}const J=e.forwardRef(function({trackRef:a,children:n,onParticipantClick:r,disableSpeakingIndicator:c,...o},u){var E,g;const i=f.useEnsureTrackRef(a),{elementProps:l}=f.useParticipantTile({htmlProps:o,disableSpeakingIndicator:c,onParticipantClick:r,trackRef:i}),h=f.useIsEncrypted(i.participant),s=f.useMaybeLayoutContext(),p=(E=Me())==null?void 0:E.autoSubscription,m=e.useCallback(v=>{i.source&&!v&&s&&s.pin.dispatch&&b.isTrackReferencePinned(i,s.pin.state)&&s.pin.dispatch({msg:"clear_pin"})},[i,s]);return e.createElement("div",{ref:u,style:{position:"relative"},...l},e.createElement(qe,{trackRef:i},e.createElement(Ue,{participant:i.participant},n??e.createElement(e.Fragment,null,b.isTrackReference(i)&&(((g=i.publication)==null?void 0:g.kind)==="video"||i.source===S.Track.Source.Camera||i.source===S.Track.Source.ScreenShare)?e.createElement(He,{trackRef:i,onSubscriptionStatusChanged:m,manageSubscription:p}):b.isTrackReference(i)&&e.createElement(X,{trackRef:i,onSubscriptionStatusChanged:m}),e.createElement("div",{className:"lk-participant-placeholder"},e.createElement(me,null)),e.createElement("div",{className:"lk-participant-metadata"},e.createElement("div",{className:"lk-participant-metadata-item"},i.source===S.Track.Source.Camera?e.createElement(e.Fragment,null,h&&e.createElement(Le,{style:{marginRight:"0.25rem"}}),e.createElement(de,{trackRef:{participant:i.participant,source:S.Track.Source.Microphone},show:"muted"}),e.createElement(K,null)):e.createElement(e.Fragment,null,e.createElement(oe,{style:{marginRight:"0.25rem"}}),e.createElement(K,null,"'s screen"))),e.createElement(ue,{className:"lk-participant-metadata-item"}))),e.createElement(_e,{trackRef:i}))))});function We(t){const a=f.mergeProps$1(t,{className:"lk-focus-layout"});return e.createElement("div",{...a},t.children)}function Qe({trackRef:t,...a}){return e.createElement(J,{trackRef:t,...a})}function Y({tracks:t,...a}){return e.createElement(e.Fragment,null,t.map(n=>e.createElement(f.TrackRefContext.Provider,{value:n,key:b.getTrackReferenceId(n)},f.cloneSingleChild(a.children))))}function ht({totalPageCount:t,nextPage:a,prevPage:n,currentPage:r,pagesContainer:c}){const[o,u]=e.useState(!1);return e.useEffect(()=>{let i;return c&&(i=b.createInteractingObservable(c.current,2e3).subscribe(u)),()=>{i&&i.unsubscribe()}},[c]),e.createElement("div",{className:"lk-pagination-control","data-lk-user-interaction":o},e.createElement("button",{className:"lk-button",onClick:n},e.createElement(re,null)),e.createElement("span",{className:"lk-pagination-count"},`${r} of ${t}`),e.createElement("button",{className:"lk-button",onClick:a},e.createElement(re,null)))}const gt=e.forwardRef(function({totalPageCount:a,currentPage:n},r){const c=new Array(a).fill("").map((o,u)=>u+1===n?e.createElement("span",{"data-lk-active":!0,key:u}):e.createElement("span",{key:u}));return e.createElement("div",{ref:r,className:"lk-pagination-indicator"},c)});function Ge({tracks:t,...a}){const n=e.createRef(),r=e.useMemo(()=>f.mergeProps$1(a,{className:"lk-grid-layout"}),[a]),{layout:c}=f.useGridLayout(n,t.length),o=f.usePagination(c.maxTiles,t);return f.useSwipe(n,{onLeftSwipe:o.nextPage,onRightSwipe:o.prevPage}),e.createElement("div",{ref:n,"data-lk-pagination":o.totalPageCount>1,...r},e.createElement(Y,{tracks:o.tracks},a.children),t.length>c.maxTiles&&e.createElement(e.Fragment,null,e.createElement(gt,{totalPageCount:o.totalPageCount,currentPage:o.currentPage}),e.createElement(ht,{pagesContainer:n,...o})))}const vt=130,pt=140,we=1,Ke=16/10,Et=(1-Ke)*-1;function Je({tracks:t,orientation:a,...n}){const r=e.useRef(null),[c,o]=e.useState(0),{width:u,height:i}=f.useSize(r),l=a||(i>=u?"vertical":"horizontal"),h=l==="vertical"?Math.max(u*Et,vt):Math.max(i*Ke,pt),s=b.getScrollBarWidth(),p=Math.max(l==="vertical"?(i-s)/h:(u-s)/h,we);let m=Math.round(p);Math.abs(p-c)<.5?m=Math.round(c):c!==p&&o(p);const E=f.useVisualStableUpdate(t,m);return e.useLayoutEffect(()=>{r.current&&(r.current.dataset.lkOrientation=l,r.current.style.setProperty("--lk-max-visible-tiles",m.toString()))},[m,l]),e.createElement("aside",{key:l,className:"lk-carousel",ref:r,...n},e.createElement(Y,{tracks:E},n.children))}function fe({value:t,onPinChange:a,onWidgetChange:n,children:r}){const c=f.useEnsureCreateLayoutContext(t);return e.useEffect(()=>{b.log.debug("PinState Updated",{state:c.pin.state}),a&&c.pin.state&&a(c.pin.state)},[c.pin.state,a]),e.useEffect(()=>{b.log.debug("Widget Updated",{widgetState:c.widget.state}),n&&c.widget.state&&n(c.widget.state)},[n,c.widget.state]),e.createElement(f.LayoutContext.Provider,{value:c},r)}function Xe({room:t,volume:a,muted:n}){const r=f.useTracks([S.Track.Source.Microphone,S.Track.Source.ScreenShareAudio,S.Track.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0,room:t}).filter(c=>!c.participant.isLocal&&c.publication.kind===S.Track.Kind.Audio);return e.createElement("div",{style:{display:"none"}},r.map(c=>e.createElement(X,{key:b.getTrackReferenceId(c),trackRef:c,volume:a,muted:n})))}function Ye(t){const a=e.useMemo(()=>f.mergeProps$1(t,{className:"lk-toast"}),[t]);return e.createElement("div",{...a},t.children)}const kt=t=>{const a=[];for(let n=0;n<t;n++)a.push([n,t-1-n]);return a},be=t=>[[Math.floor(t/2)],[-1]],St=(t,a,n)=>{const[r,c]=V.useState(0),[o,u]=V.useState([[]]);V.useEffect(()=>{if(t==="thinking")u(be(a));else if(t==="connecting"||t==="initializing"){const l=[...kt(a)];u(l)}else u(t==="listening"?be(a):t===void 0||t==="speaking"?[new Array(a).fill(0).map((l,h)=>h)]:[[]]);c(0)},[t,a]);const i=V.useRef(null);return V.useEffect(()=>{let l=performance.now();const h=s=>{s-l>=n&&(c(m=>m+1),l=s),i.current=requestAnimationFrame(h)};return i.current=requestAnimationFrame(h),()=>{i.current!==null&&cancelAnimationFrame(i.current)}},[n,a,t,o.length]),o[r%o.length]},wt=new Map([["connecting",2e3],["initializing",2e3],["listening",500],["thinking",150]]),bt=(t,a)=>{if(t===void 0)return 1e3;let n=wt.get(t);if(n)switch(t){case"connecting":n/=a;break}return n},he=e.forwardRef(function({state:a,options:n,barCount:r=15,trackRef:c,track:o,children:u,...i},l){const h=f.mergeProps$1(i,{className:"lk-audio-bar-visualizer"});let s=f.useMaybeTrackRefContext();(c||o)&&(s=c||o);const p=f.useMultibandTrackVolume(s,{bands:r,loPass:100,hiPass:200}),m=(n==null?void 0:n.minHeight)??20,E=(n==null?void 0:n.maxHeight)??100,g=St(a,r,bt(a,r)??100);return e.createElement("div",{ref:l,...h,"data-lk-va-state":a},p.map((v,d)=>u?f.cloneSingleChild(u,{"data-lk-highlighted":g.includes(d),"data-lk-bar-index":d,className:"lk-audio-bar",style:{height:`${Math.min(E,Math.max(m,v*100+5))}%`}}):e.createElement("span",{key:d,"data-lk-highlighted":g.includes(d),"data-lk-bar-index":d,className:`lk-audio-bar ${g.includes(d)&&"lk-highlighted"}`,style:{height:`${Math.min(E,Math.max(m,v*100+5))}%`}})))}),et=e.forwardRef(function({children:a,disableSpeakingIndicator:n,onParticipantClick:r,trackRef:c,...o},u){const i=f.useEnsureTrackRef(c),{elementProps:l}=f.useParticipantTile({trackRef:i,htmlProps:o,disableSpeakingIndicator:n,onParticipantClick:r});return e.createElement("div",{ref:u,style:{position:"relative",minHeight:"160px"},...l},e.createElement(f.TrackRefContext.Provider,{value:i},a??e.createElement(e.Fragment,null,b.isTrackReference(i)&&e.createElement(X,{trackRef:i}),e.createElement(he,{barCount:7,options:{minHeight:8}}),e.createElement("div",{className:"lk-participant-metadata"},e.createElement("div",{className:"lk-participant-metadata-item"},e.createElement(de,{trackRef:i}),e.createElement(K,null)),e.createElement(ue,{className:"lk-participant-metadata-item"})))))});function tt(t){const[a,n]=e.useState(void 0),r=f.useConnectionState(t.room);return e.useEffect(()=>{switch(r){case S.ConnectionState.Reconnecting:n(e.createElement(e.Fragment,null,e.createElement(ce,{className:"lk-spinner"})," Reconnecting"));break;case S.ConnectionState.Connecting:n(e.createElement(e.Fragment,null,e.createElement(ce,{className:"lk-spinner"})," Connecting"));break;case S.ConnectionState.Disconnected:n(e.createElement(e.Fragment,null,"Disconnected"));break;default:n(void 0);break}},[r]),a?e.createElement(Ye,{className:"lk-toast-connection-state"},a):e.createElement(e.Fragment,null)}const nt=e.forwardRef(function({entry:a,hideName:n=!1,hideTimestamp:r=!1,messageFormatter:c,...o},u){var m,E,g,v;const i=e.useMemo(()=>c?c(a.message):a.message,[a.message,c]),l=!!a.editTimestamp,h=new Date(a.timestamp),s=typeof navigator<"u"?navigator.language:"en-US",p=((m=a.from)==null?void 0:m.name)??((E=a.from)==null?void 0:E.identity);return e.createElement("li",{ref:u,className:"lk-chat-entry",title:h.toLocaleTimeString(s,{timeStyle:"full"}),"data-lk-message-origin":(g=a.from)!=null&&g.isLocal?"local":"remote",...o},(!r||!n||l)&&e.createElement("span",{className:"lk-meta-data"},!n&&e.createElement("strong",{className:"lk-participant-name"},p),(!r||l)&&e.createElement("span",{className:"lk-timestamp"},l&&"edited ",h.toLocaleTimeString(s,{timeStyle:"short"}))),e.createElement("span",{className:"lk-message-body"},i),e.createElement("span",{className:"lk-message-attachements"},(v=a.attachedFiles)==null?void 0:v.map(d=>d.type.startsWith("image/")&&e.createElement("img",{style:{maxWidth:"300px",maxHeight:"300px"},key:d.name,src:URL.createObjectURL(d),alt:d.name}))))});function Ct(t){return b.tokenize(t,b.createDefaultGrammar()).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 e.createElement("a",{className:"lk-chat-link",key:n,href:c,target:"_blank",rel:"noreferrer"},r)}})}function ge({messageFormatter:t,messageDecoder:a,messageEncoder:n,channelTopic:r,...c}){const o=e.useRef(null),u=e.useRef(null),i=e.useMemo(()=>({messageDecoder:a,messageEncoder:n,channelTopic:r}),[a,n,r]),{chatMessages:l,send:h,isSending:s}=f.useChat(i),p=f.useMaybeLayoutContext(),m=e.useRef(0);async function E(g){g.preventDefault(),u.current&&u.current.value.trim()!==""&&(await h(u.current.value),u.current.value="",u.current.focus())}return e.useEffect(()=>{var g;o&&((g=o.current)==null||g.scrollTo({top:o.current.scrollHeight}))},[o,l]),e.useEffect(()=>{var d,w,k,P,I;if(!p||l.length===0)return;if((d=p.widget.state)!=null&&d.showChat&&l.length>0&&m.current!==((w=l[l.length-1])==null?void 0:w.timestamp)){m.current=(k=l[l.length-1])==null?void 0:k.timestamp;return}const g=l.filter(C=>!m.current||C.timestamp>m.current).length,{widget:v}=p;g>0&&((P=v.state)==null?void 0:P.unreadMessages)!==g&&((I=v.dispatch)==null||I.call(v,{msg:"unread_msg",count:g}))},[l,p==null?void 0:p.widget]),e.createElement("div",{...c,className:"lk-chat"},e.createElement("div",{className:"lk-chat-header"},"Messages",p&&e.createElement(le,{className:"lk-close-button"},e.createElement(Re,null))),e.createElement("ul",{className:"lk-list lk-chat-messages",ref:o},c.children?l.map((g,v)=>f.cloneSingleChild(c.children,{entry:g,key:g.id??v,messageFormatter:t})):l.map((g,v,d)=>{const w=v>=1&&d[v-1].from===g.from,k=v>=1&&g.timestamp-d[v-1].timestamp<6e4;return e.createElement(nt,{key:g.id??v,hideName:w,hideTimestamp:w===!1?!1:k,entry:g,messageFormatter:t})})),e.createElement("form",{className:"lk-chat-form",onSubmit:E},e.createElement("input",{className:"lk-form-control lk-chat-form-input",disabled:s,ref:u,type:"text",placeholder:"Enter a message...",onInput:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),onKeyUp:g=>g.stopPropagation()}),e.createElement("button",{type:"submit",className:"lk-button lk-chat-form-button",disabled:s},"Send")))}function U({kind:t,initialSelection:a,onActiveDeviceChange:n,tracks:r,requestPermissions:c=!1,...o}){const[u,i]=e.useState(!1),[l,h]=e.useState([]),[s,p]=e.useState(!0),[m,E]=e.useState(c),g=(k,P)=>{b.log.debug("handle device change"),i(!1),n==null||n(k,P)},v=e.useRef(null),d=e.useRef(null);e.useLayoutEffect(()=>{u&&E(!0)},[u]),e.useLayoutEffect(()=>{let k;return v.current&&d.current&&(l||s)&&(k=b.computeMenuPosition(v.current,d.current,(P,I)=>{d.current&&Object.assign(d.current.style,{left:`${P}px`,top:`${I}px`})})),p(!1),()=>{k==null||k()}},[v,d,l,s]);const w=e.useCallback(k=>{d.current&&k.target!==v.current&&u&&b.wasClickOutside(d.current,k)&&i(!1)},[u,d,v]);return e.useEffect(()=>(document.addEventListener("click",w),()=>{document.removeEventListener("click",w)}),[w]),e.createElement(e.Fragment,null,e.createElement("button",{className:"lk-button lk-button-menu","aria-pressed":u,...o,onClick:()=>i(!u),ref:v},o.children),!o.disabled&&e.createElement("div",{className:"lk-device-menu",ref:d,style:{visibility:u?"visible":"hidden"}},t?e.createElement(G,{initialSelection:a,onActiveDeviceChange:k=>g(t,k),onDeviceListChange:h,kind:t,track:r==null?void 0:r[t],requestPermissions:m}):e.createElement(e.Fragment,null,e.createElement("div",{className:"lk-device-menu-heading"},"Audio inputs"),e.createElement(G,{kind:"audioinput",onActiveDeviceChange:k=>g("audioinput",k),onDeviceListChange:h,track:r==null?void 0:r.audioinput,requestPermissions:m}),e.createElement("div",{className:"lk-device-menu-heading"},"Video inputs"),e.createElement(G,{kind:"videoinput",onActiveDeviceChange:k=>g("videoinput",k),onDeviceListChange:h,track:r==null?void 0:r.videoinput,requestPermissions:m}))))}function ve(){e.useEffect(()=>{f.warnAboutMissingStyles()},[])}function at(t,a){const[n,r]=e.useState(),c=e.useMemo(()=>new S.Mutex,[]);return e.useEffect(()=>{let o=!1,u=[];return c.lock().then(async i=>{try{(t.audio||t.video)&&(u=await S.createLocalTracks(t),o?u.forEach(l=>l.stop()):r(u))}catch(l){a&&l instanceof Error?a(l):b.log.error(l)}finally{i()}}),()=>{o=!0,u.forEach(i=>{i.stop()})}},[JSON.stringify(t,f.roomOptionsStringifyReplacer),a,c]),n}function Mt(t,a,n){const[r,c]=e.useState(null),[o,u]=e.useState(!1),i=f.useMediaDevices({kind:n}),[l,h]=e.useState(void 0),[s,p]=e.useState(),[m,E]=e.useState(a);e.useEffect(()=>{E(a)},[a]);const g=async(w,k)=>{try{const P=k==="videoinput"?await S.createLocalVideoTrack({deviceId:w,resolution:S.VideoPresets.h720.resolution}):await S.createLocalAudioTrack({deviceId:w}),I=await P.getDeviceId(!1);I&&w!==I&&(d.current=I,E(I)),p(P)}catch(P){P instanceof Error&&c(P)}},v=async(w,k)=>{await w.setDeviceId(k),d.current=k},d=e.useRef(m);return e.useEffect(()=>{t&&!s&&!r&&!o&&(b.log.debug("creating track",n),u(!0),g(m,n).finally(()=>{u(!1)}))},[t,s,r,o]),e.useEffect(()=>{s&&(t?l!=null&&l.deviceId&&d.current!==(l==null?void 0:l.deviceId)?(b.log.debug(`switching ${n} device from`,d.current,l.deviceId),v(s,l.deviceId)):(b.log.debug(`unmuting local ${n} track`),s.unmute()):(b.log.debug(`muting ${n} track`),s.mute().then(()=>b.log.debug(s.mediaStreamTrack))))},[s,l,t,n]),e.useEffect(()=>()=>{s&&(b.log.debug(`stopping local ${n} track`),s.stop(),s.mute())},[]),e.useEffect(()=>{h(i==null?void 0:i.find(w=>w.deviceId===m))},[m,i]),{selectedDevice:l,localTrack:s,deviceError:r}}function Tt({defaults:t={},onValidate:a,onSubmit:n,onError:r,debug:c,joinLabel:o="Join Room",micLabel:u="Microphone",camLabel:i="Camera",userLabel:l="Username",persistUserChoices:h=!0,videoProcessor:s,...p}){const{userChoices:m,saveAudioInputDeviceId:E,saveAudioInputEnabled:g,saveVideoInputDeviceId:v,saveVideoInputEnabled:d,saveUsername:w}=f.usePersistentUserChoices({defaults:t,preventSave:!h,preventLoad:!h}),[k,P]=e.useState(m),[I,C]=e.useState(k.audioEnabled),[T,M]=e.useState(k.videoEnabled),[R,D]=e.useState(k.audioDeviceId),[y,N]=e.useState(k.videoDeviceId),[F,O]=e.useState(k.username);e.useEffect(()=>{g(I)},[I,g]),e.useEffect(()=>{d(T)},[T,d]),e.useEffect(()=>{E(R)},[R,E]),e.useEffect(()=>{v(y)},[y,v]),e.useEffect(()=>{w(F)},[F,w]);const z=at({audio:I?{deviceId:m.audioDeviceId}:!1,video:T?{deviceId:m.videoDeviceId,processor:s}:!1},r),_=e.useRef(null),L=e.useMemo(()=>z==null?void 0:z.filter(A=>A.kind===S.Track.Kind.Video)[0],[z]),q=e.useMemo(()=>{if(L){const{facingMode:A}=S.facingModeFromLocalTrack(L);return A}else return"undefined"},[L]),j=e.useMemo(()=>z==null?void 0:z.filter(A=>A.kind===S.Track.Kind.Audio)[0],[z]);e.useEffect(()=>(_.current&&L&&(L.unmute(),L.attach(_.current)),()=>{L==null||L.detach()}),[L]);const[ee,te]=e.useState(),B=e.useCallback(A=>typeof a=="function"?a(A):A.username!=="",[a]);e.useEffect(()=>{const A={username:F,videoEnabled:T,videoDeviceId:y,audioEnabled:I,audioDeviceId:R};P(A),te(B(A))},[F,T,B,I,R,y]);function H(A){A.preventDefault(),B(k)?typeof n=="function"&&n(k):b.log.warn("Validation failed with: ",k)}return ve(),e.createElement("div",{className:"lk-prejoin",...p},e.createElement("div",{className:"lk-video-container"},L&&e.createElement("video",{ref:_,width:"1280",height:"720","data-lk-facing-mode":q}),(!L||!T)&&e.createElement("div",{className:"lk-camera-off-note"},e.createElement(me,null))),e.createElement("div",{className:"lk-button-group-container"},e.createElement("div",{className:"lk-button-group audio"},e.createElement(Z,{initialState:I,source:S.Track.Source.Microphone,onChange:A=>C(A)},u),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{initialSelection:R,kind:"audioinput",disabled:!j,tracks:{audioinput:j},onActiveDeviceChange:(A,W)=>D(W)}))),e.createElement("div",{className:"lk-button-group video"},e.createElement(Z,{initialState:T,source:S.Track.Source.Camera,onChange:A=>M(A)},i),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{initialSelection:y,kind:"videoinput",disabled:!L,tracks:{videoinput:L},onActiveDeviceChange:(A,W)=>N(W)})))),e.createElement("form",{className:"lk-username-container"},e.createElement("input",{className:"lk-form-control",id:"username",name:"username",type:"text",defaultValue:F,placeholder:l,onChange:A=>O(A.target.value),autoComplete:"off"}),e.createElement("button",{className:"lk-button lk-join-button",type:"submit",onClick:H,disabled:!ee},o)),c&&e.createElement(e.Fragment,null,e.createElement("strong",null,"User Choices:"),e.createElement("ul",{className:"lk-list",style:{overflow:"hidden",maxWidth:"15rem"}},e.createElement("li",null,"Username: ",`${k.username}`),e.createElement("li",null,"Video Enabled: ",`${k.videoEnabled}`),e.createElement("li",null,"Audio Enabled: ",`${k.audioEnabled}`),e.createElement("li",null,"Video Device: ",`${k.videoDeviceId}`),e.createElement("li",null,"Audio Device: ",`${k.audioDeviceId}`))))}function yt({props:t}){const{dispatch:a,state:n}=f.useLayoutContext().widget,r="lk-button lk-settings-toggle";return{mergedProps:e.useMemo(()=>f.mergeProps(t,{className:r,onClick:()=>{a&&a({msg:"toggle_settings"})},"aria-pressed":n!=null&&n.showSettings?"true":"false"}),[t,r,a,n])}}const Rt=e.forwardRef(function(a,n){const{mergedProps:r}=yt({props:a});return e.createElement("button",{ref:n,...r},a.children)}),It=t=>{switch(t){case S.Track.Source.Camera:return 1;case S.Track.Source.Microphone:return 2;case S.Track.Source.ScreenShare:return 3;default:return 0}};function pe({variation:t,controls:a,saveUserChoices:n=!0,onDeviceError:r,...c}){var D;const[o,u]=e.useState(!1),i=f.useMaybeLayoutContext();e.useEffect(()=>{var y,N;((y=i==null?void 0:i.widget.state)==null?void 0:y.showChat)!==void 0&&u((N=i==null?void 0:i.widget.state)==null?void 0:N.showChat)},[(D=i==null?void 0:i.widget.state)==null?void 0:D.showChat]);const h=lt(`(max-width: ${o?1e3:760}px)`)?"minimal":"verbose";t??(t=h);const s={leave:!0,...a},p=f.useLocalParticipantPermissions();if(!p)s.camera=!1,s.chat=!1,s.microphone=!1,s.screenShare=!1;else{const y=N=>p.canPublish&&(p.canPublishSources.length===0||p.canPublishSources.includes(It(N)));s.camera??(s.camera=y(S.Track.Source.Camera)),s.microphone??(s.microphone=y(S.Track.Source.Microphone)),s.screenShare??(s.screenShare=y(S.Track.Source.ScreenShare)),s.chat??(s.chat=p.canPublishData&&(a==null?void 0:a.chat))}const m=e.useMemo(()=>t==="minimal"||t==="verbose",[t]),E=e.useMemo(()=>t==="textOnly"||t==="verbose",[t]),g=b.supportsScreenSharing(),[v,d]=e.useState(!1),w=e.useCallback(y=>{d(y)},[d]),k=f.mergeProps$1({className:"lk-control-bar"},c),{saveAudioInputEnabled:P,saveVideoInputEnabled:I,saveAudioInputDeviceId:C,saveVideoInputDeviceId:T}=f.usePersistentUserChoices({preventSave:!n}),M=e.useCallback((y,N)=>N?P(y):null,[P]),R=e.useCallback((y,N)=>N?I(y):null,[I]);return e.createElement("div",{...k},s.microphone&&e.createElement("div",{className:"lk-button-group"},e.createElement(Z,{source:S.Track.Source.Microphone,showIcon:m,onChange:M,onDeviceError:y=>r==null?void 0:r({source:S.Track.Source.Microphone,error:y})},E&&"Microphone"),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{kind:"audioinput",onActiveDeviceChange:(y,N)=>C(N??"default")}))),s.camera&&e.createElement("div",{className:"lk-button-group"},e.createElement(Z,{source:S.Track.Source.Camera,showIcon:m,onChange:R,onDeviceError:y=>r==null?void 0:r({source:S.Track.Source.Camera,error:y})},E&&"Camera"),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{kind:"videoinput",onActiveDeviceChange:(y,N)=>T(N??"default")}))),s.screenShare&&g&&e.createElement(Z,{source:S.Track.Source.ScreenShare,captureOptions:{audio:!0,selfBrowserSurface:"include"},showIcon:m,onChange:w,onDeviceError:y=>r==null?void 0:r({source:S.Track.Source.ScreenShare,error:y})},E&&(v?"Stop screen share":"Share screen")),s.chat&&e.createElement(le,null,m&&e.createElement(Ie,null),E&&"Chat"),s.settings&&e.createElement(Rt,null,m&&e.createElement(Ae,null),E&&"Settings"),s.leave&&e.createElement(ie,null,m&&e.createElement(Ne,null),E&&"Leave"),e.createElement(se,null))}function Pt({chatMessageFormatter:t,chatMessageDecoder:a,chatMessageEncoder:n,SettingsComponent:r,controlBarProps:c={},...o}){var v,d;const[u,i]=e.useState({showChat:!1,unreadMessages:0,showSettings:!1}),l=e.useRef(null),h=f.useTracks([{source:S.Track.Source.Camera,withPlaceholder:!0},{source:S.Track.Source.ScreenShare,withPlaceholder:!1}],{updateOnlyOn:[S.RoomEvent.ActiveSpeakersChanged],onlySubscribed:!1}),s=w=>{b.log.debug("updating widget state",w),i(w)},p=f.useCreateLayoutContext(),m=h.filter(b.isTrackReference).filter(w=>w.publication.source===S.Track.Source.ScreenShare),E=(v=f.usePinnedTracks(p))==null?void 0:v[0],g=h.filter(w=>!b.isEqualTrackRef(w,E));return e.useEffect(()=>{var w,k,P,I,C,T;if(m.some(M=>M.publication.isSubscribed)&&l.current===null?(b.log.debug("Auto set screen share focus:",{newScreenShareTrack:m[0]}),(k=(w=p.pin).dispatch)==null||k.call(w,{msg:"set_pin",trackReference:m[0]}),l.current=m[0]):l.current&&!m.some(M=>{var R,D;return M.publication.trackSid===((D=(R=l.current)==null?void 0:R.publication)==null?void 0:D.trackSid)})&&(b.log.debug("Auto clearing screen share focus."),(I=(P=p.pin).dispatch)==null||I.call(P,{msg:"clear_pin"}),l.current=null),E&&!b.isTrackReference(E)){const M=h.find(R=>R.participant.identity===E.participant.identity&&R.source===E.source);M!==E&&b.isTrackReference(M)&&((T=(C=p.pin).dispatch)==null||T.call(C,{msg:"set_pin",trackReference:M}))}},[m.map(w=>`${w.publication.trackSid}_${w.publication.isSubscribed}`).join(),(d=E==null?void 0:E.publication)==null?void 0:d.trackSid,h]),ve(),e.createElement("div",{className:"lk-video-conference",...o},b.isWeb()&&e.createElement(fe,{value:p,onWidgetChange:s},e.createElement("div",{className:"lk-video-conference-inner"},E?e.createElement("div",{className:"lk-focus-layout-wrapper"},e.createElement(We,null,e.createElement(Je,{tracks:g},e.createElement(J,null)),E&&e.createElement(Qe,{trackRef:E}))):e.createElement("div",{className:"lk-grid-layout-wrapper"},e.createElement(Ge,{tracks:h},e.createElement(J,null))),e.createElement(pe,{controls:{chat:!0,settings:!!r},...c})),e.createElement(ge,{style:{display:u.showChat?"grid":"none"},messageFormatter:t,messageEncoder:n,messageDecoder:a}),r&&e.createElement("div",{className:"lk-settings-menu-modal",style:{display:u.showSettings?"block":"none"}},e.createElement(r,null))),e.createElement(Xe,null),e.createElement(tt,null))}function At({...t}){const[a,n]=e.useState({showChat:!1,unreadMessages:0}),r=f.useTracks([S.Track.Source.Microphone]);return ve(),e.createElement(fe,{onWidgetChange:n},e.createElement("div",{className:"lk-audio-conference",...t},e.createElement("div",{className:"lk-audio-conference-stage"},e.createElement(Y,{tracks:r},e.createElement(et,null))),e.createElement(pe,{controls:{microphone:!0,screenShare:!1,camera:!1,chat:!0}}),a.showChat&&e.createElement(ge,null)))}function Nt({controls:t,saveUserChoices:a=!0,onDeviceError:n,...r}){const c={leave:!0,microphone:!0,...t},o=f.useLocalParticipantPermissions(),{microphoneTrack:u,localParticipant:i}=b.useLocalParticipant(),l=e.useMemo(()=>({participant:i,source:S.Track.Source.Microphone,publication:u}),[i,u]);o?c.microphone??(c.microphone=o.canPublish):c.microphone=!1;const h=f.mergeProps$1({className:"lk-agent-control-bar"},r),{saveAudioInputEnabled:s,saveAudioInputDeviceId:p}=f.usePersistentUserChoices({preventSave:!a}),m=e.useCallback((E,g)=>{g&&s(E)},[s]);return e.createElement("div",{...h},c.microphone&&e.createElement("div",{className:"lk-button-group"},e.createElement(Z,{source:S.Track.Source.Microphone,showIcon:!0,onChange:m,onDeviceError:E=>n==null?void 0:n({source:S.Track.Source.Microphone,error:E})},e.createElement(he,{trackRef:l,barCount:7,options:{minHeight:5}})),e.createElement("div",{className:"lk-button-group-menu"},e.createElement(U,{kind:"audioinput",onActiveDeviceChange:(E,g)=>p(g??"default")}))),c.leave&&e.createElement(ie,null,"Disconnect"),e.createElement(se,null))}exports.AudioConference=At;exports.AudioTrack=X;exports.BarVisualizer=he;exports.CarouselLayout=Je;exports.Chat=ge;exports.ChatEntry=nt;exports.ChatToggle=le;exports.ConnectionQualityIndicator=ue;exports.ConnectionStateToast=tt;exports.ControlBar=pe;exports.DisconnectButton=ie;exports.FocusLayout=Qe;exports.FocusLayoutContainer=We;exports.FocusToggle=_e;exports.GridLayout=Ge;exports.LKFeatureContext=Ce;exports.LayoutContextProvider=fe;exports.MediaDeviceMenu=U;exports.MediaDeviceSelect=G;exports.ParticipantAudioTile=et;exports.ParticipantContextIfNeeded=Ue;exports.ParticipantName=K;exports.ParticipantTile=J;exports.PreJoin=Tt;exports.RoomAudioRenderer=Xe;exports.StartMediaButton=se;exports.SvgCameraDisabledIcon=Te;exports.SvgCameraIcon=ye;exports.SvgChatCloseIcon=Re;exports.SvgChatIcon=Ie;exports.SvgChevron=re;exports.SvgFocusToggleIcon=Pe;exports.SvgGearIcon=Ae;exports.SvgLeaveIcon=Ne;exports.SvgLockLockedIcon=Le;exports.SvgMicDisabledIcon=xe;exports.SvgMicIcon=Ve;exports.SvgParticipantPlaceholder=me;exports.SvgQualityExcellentIcon=Fe;exports.SvgQualityGoodIcon=De;exports.SvgQualityPoorIcon=ze;exports.SvgQualityUnknownIcon=Oe;exports.SvgScreenShareIcon=oe;exports.SvgScreenShareStopIcon=$e;exports.SvgSpinnerIcon=ce;exports.SvgUnfocusToggleIcon=Ze;exports.Toast=Ye;exports.TrackLoop=Y;exports.TrackMutedIndicator=de;exports.TrackRefContextIfNeeded=qe;exports.TrackToggle=Z;exports.VideoConference=Pt;exports.VideoTrack=He;exports.VoiceAssistantControlBar=Nt;exports.formatChatMessageLinks=Ct;exports.useFeatureContext=Me;exports.usePreviewDevice=Mt;exports.usePreviewTracks=at;
2
+ //# sourceMappingURL=shared-D2Tkgmsq.js.map