@voxket-ai/voxket-live 1.0.46 → 1.0.47

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.
Files changed (3) hide show
  1. package/dist/index.cjs +186 -74
  2. package/dist/index.js +37031 -13862
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Nf=Object.defineProperty;var Rf=(e,t,n)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Rf(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("react"),J=require("livekit-client"),ke=require("@livekit/components-react"),yo=require("react-dom"),Ds=require("class-variance-authority"),Vf=require("clsx"),gt=require("@mui/icons-material");function Rl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const f=Rl(E),Ls=Rl(yo);var ns={exports:{}},Mn={};/**
1
+ "use strict";var Vw=Object.defineProperty;var Fw=(t,e,n)=>e in t?Vw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var at=(t,e,n)=>Fw(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react"),xu=require("react-dom");function I0(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const v=I0(R),Wa=I0(xu);function Uw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var So={exports:{}},vs={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ti;function If(){if(Ti)return Mn;Ti=1;var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,d){var u,h={},m=null,g=null;d!==void 0&&(m=""+d),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(g=l.ref);for(u in l)s.call(l,u)&&!i.hasOwnProperty(u)&&(h[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)h[u]===void 0&&(h[u]=l[u]);return{$$typeof:t,type:a,key:m,ref:g,props:h,_owner:r.current}}return Mn.Fragment=n,Mn.jsx=o,Mn.jsxs=o,Mn}var Nn={};/**
9
+ */var vh;function Bw(){if(vh)return vs;vh=1;var t=R,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,l){var d,u={},f=null,p=null;l!==void 0&&(f=""+l),c.key!==void 0&&(f=""+c.key),c.ref!==void 0&&(p=c.ref);for(d in c)i.call(c,d)&&!s.hasOwnProperty(d)&&(u[d]=c[d]);if(a&&a.defaultProps)for(d in c=a.defaultProps,c)u[d]===void 0&&(u[d]=c[d]);return{$$typeof:e,type:a,key:f,ref:p,props:u,_owner:r.current}}return vs.Fragment=n,vs.jsx=o,vs.jsxs=o,vs}var ys={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,196 +14,308 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ji;function Df(){return ji||(ji=1,process.env.NODE_ENV!=="production"&&function(){var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),x=Symbol.iterator,p="@@iterator";function v(C){if(C===null||typeof C!="object")return null;var R=x&&C[x]||C[p];return typeof R=="function"?R:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(C){{for(var R=arguments.length,z=new Array(R>1?R-1:0),ie=1;ie<R;ie++)z[ie-1]=arguments[ie];w("error",C,z)}}function w(C,R,z){{var ie=b.ReactDebugCurrentFrame,he=ie.getStackAddendum();he!==""&&(R+="%s",z=z.concat([he]));var ge=z.map(function(fe){return String(fe)});ge.unshift("Warning: "+R),Function.prototype.apply.call(console[C],console,ge)}}var S=!1,k=!1,T=!1,A=!1,j=!1,V;V=Symbol.for("react.module.reference");function I(C){return!!(typeof C=="string"||typeof C=="function"||C===s||C===i||j||C===r||C===d||C===u||A||C===g||S||k||T||typeof C=="object"&&C!==null&&(C.$$typeof===m||C.$$typeof===h||C.$$typeof===o||C.$$typeof===a||C.$$typeof===l||C.$$typeof===V||C.getModuleId!==void 0))}function $(C,R,z){var ie=C.displayName;if(ie)return ie;var he=R.displayName||R.name||"";return he!==""?z+"("+he+")":z}function F(C){return C.displayName||"Context"}function se(C){if(C==null)return null;if(typeof C.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof C=="function")return C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case s:return"Fragment";case n:return"Portal";case i:return"Profiler";case r:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof C=="object")switch(C.$$typeof){case a:var R=C;return F(R)+".Consumer";case o:var z=C;return F(z._context)+".Provider";case l:return $(C,C.render,"ForwardRef");case h:var ie=C.displayName||null;return ie!==null?ie:se(C.type)||"Memo";case m:{var he=C,ge=he._payload,fe=he._init;try{return se(fe(ge))}catch{return null}}}return null}var Z=Object.assign,ee=0,G,O,P,B,X,_,re;function M(){}M.__reactDisabledLog=!0;function H(){{if(ee===0){G=console.log,O=console.info,P=console.warn,B=console.error,X=console.group,_=console.groupCollapsed,re=console.groupEnd;var C={configurable:!0,enumerable:!0,value:M,writable:!0};Object.defineProperties(console,{info:C,log:C,warn:C,error:C,group:C,groupCollapsed:C,groupEnd:C})}ee++}}function q(){{if(ee--,ee===0){var C={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Z({},C,{value:G}),info:Z({},C,{value:O}),warn:Z({},C,{value:P}),error:Z({},C,{value:B}),group:Z({},C,{value:X}),groupCollapsed:Z({},C,{value:_}),groupEnd:Z({},C,{value:re})})}ee<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var U=b.ReactCurrentDispatcher,N;function L(C,R,z){{if(N===void 0)try{throw Error()}catch(he){var ie=he.stack.trim().match(/\n( *(at )?)/);N=ie&&ie[1]||""}return`
18
- `+N+C}}var W=!1,D;{var ne=typeof WeakMap=="function"?WeakMap:Map;D=new ne}function te(C,R){if(!C||W)return"";{var z=D.get(C);if(z!==void 0)return z}var ie;W=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=U.current,U.current=null,H();try{if(R){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(Be){ie=Be}Reflect.construct(C,[],fe)}else{try{fe.call()}catch(Be){ie=Be}C.call(fe.prototype)}}else{try{throw Error()}catch(Be){ie=Be}C()}}catch(Be){if(Be&&ie&&typeof Be.stack=="string"){for(var ue=Be.stack.split(`
19
- `),Oe=ie.stack.split(`
20
- `),Se=ue.length-1,Te=Oe.length-1;Se>=1&&Te>=0&&ue[Se]!==Oe[Te];)Te--;for(;Se>=1&&Te>=0;Se--,Te--)if(ue[Se]!==Oe[Te]){if(Se!==1||Te!==1)do if(Se--,Te--,Te<0||ue[Se]!==Oe[Te]){var We=`
21
- `+ue[Se].replace(" at new "," at ");return C.displayName&&We.includes("<anonymous>")&&(We=We.replace("<anonymous>",C.displayName)),typeof C=="function"&&D.set(C,We),We}while(Se>=1&&Te>=0);break}}}finally{W=!1,U.current=ge,q(),Error.prepareStackTrace=he}var Xt=C?C.displayName||C.name:"",It=Xt?L(Xt):"";return typeof C=="function"&&D.set(C,It),It}function de(C,R,z){return te(C,!1)}function me(C){var R=C.prototype;return!!(R&&R.isReactComponent)}function Ae(C,R,z){if(C==null)return"";if(typeof C=="function")return te(C,me(C));if(typeof C=="string")return L(C);switch(C){case d:return L("Suspense");case u:return L("SuspenseList")}if(typeof C=="object")switch(C.$$typeof){case l:return de(C.render);case h:return Ae(C.type,R,z);case m:{var ie=C,he=ie._payload,ge=ie._init;try{return Ae(ge(he),R,z)}catch{}}}return""}var De=Object.prototype.hasOwnProperty,rt={},ot=b.ReactDebugCurrentFrame;function Fe(C){if(C){var R=C._owner,z=Ae(C.type,C._source,R?R.type:null);ot.setExtraStackFrame(z)}else ot.setExtraStackFrame(null)}function Gs(C,R,z,ie,he){{var ge=Function.call.bind(De);for(var fe in C)if(ge(C,fe)){var ue=void 0;try{if(typeof C[fe]!="function"){var Oe=Error((ie||"React class")+": "+z+" type `"+fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof C[fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Oe.name="Invariant Violation",Oe}ue=C[fe](R,fe,ie,z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ue=Se}ue&&!(ue instanceof Error)&&(Fe(he),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ie||"React class",z,fe,typeof ue),Fe(null)),ue instanceof Error&&!(ue.message in rt)&&(rt[ue.message]=!0,Fe(he),y("Failed %s type: %s",z,ue.message),Fe(null))}}}var Xs=Array.isArray;function Rt(C){return Xs(C)}function Tn(C){{var R=typeof Symbol=="function"&&Symbol.toStringTag,z=R&&C[Symbol.toStringTag]||C.constructor.name||"Object";return z}}function jn(C){try{return Yt(C),!1}catch{return!0}}function Yt(C){return""+C}function Vt(C){if(jn(C))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Tn(C)),Yt(C)}var Pn=b.ReactCurrentOwner,ae={key:!0,ref:!0,__self:!0,__source:!0},qe,$e;function xe(C){if(De.call(C,"ref")){var R=Object.getOwnPropertyDescriptor(C,"ref").get;if(R&&R.isReactWarning)return!1}return C.ref!==void 0}function qs(C){if(De.call(C,"key")){var R=Object.getOwnPropertyDescriptor(C,"key").get;if(R&&R.isReactWarning)return!1}return C.key!==void 0}function gf(C,R){typeof C.ref=="string"&&Pn.current}function xf(C,R){{var z=function(){qe||(qe=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};z.isReactWarning=!0,Object.defineProperty(C,"key",{get:z,configurable:!0})}}function yf(C,R){{var z=function(){$e||($e=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};z.isReactWarning=!0,Object.defineProperty(C,"ref",{get:z,configurable:!0})}}var vf=function(C,R,z,ie,he,ge,fe){var ue={$$typeof:t,type:C,key:R,ref:z,props:fe,_owner:ge};return ue._store={},Object.defineProperty(ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.defineProperty(ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ue.props),Object.freeze(ue)),ue};function bf(C,R,z,ie,he){{var ge,fe={},ue=null,Oe=null;z!==void 0&&(Vt(z),ue=""+z),qs(R)&&(Vt(R.key),ue=""+R.key),xe(R)&&(Oe=R.ref,gf(R,he));for(ge in R)De.call(R,ge)&&!ae.hasOwnProperty(ge)&&(fe[ge]=R[ge]);if(C&&C.defaultProps){var Se=C.defaultProps;for(ge in Se)fe[ge]===void 0&&(fe[ge]=Se[ge])}if(ue||Oe){var Te=typeof C=="function"?C.displayName||C.name||"Unknown":C;ue&&xf(fe,Te),Oe&&yf(fe,Te)}return vf(C,ue,Oe,he,ie,Pn.current,fe)}}var Js=b.ReactCurrentOwner,bi=b.ReactDebugCurrentFrame;function Gt(C){if(C){var R=C._owner,z=Ae(C.type,C._source,R?R.type:null);bi.setExtraStackFrame(z)}else bi.setExtraStackFrame(null)}var Qs;Qs=!1;function er(C){return typeof C=="object"&&C!==null&&C.$$typeof===t}function wi(){{if(Js.current){var C=se(Js.current.type);if(C)return`
17
+ */var yh;function $w(){return yh||(yh=1,process.env.NODE_ENV!=="production"&&function(){var t=R,e=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,h="@@iterator";function y(M){if(M===null||typeof M!="object")return null;var ne=g&&M[g]||M[h];return typeof ne=="function"?ne:null}var b=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(M){{for(var ne=arguments.length,le=new Array(ne>1?ne-1:0),pe=1;pe<ne;pe++)le[pe-1]=arguments[pe];C("error",M,le)}}function C(M,ne,le){{var pe=b.ReactDebugCurrentFrame,Ie=pe.getStackAddendum();Ie!==""&&(ne+="%s",le=le.concat([Ie]));var Le=le.map(function(ke){return String(ke)});Le.unshift("Warning: "+ne),Function.prototype.apply.call(console[M],console,Le)}}var S=!1,x=!1,T=!1,E=!1,P=!1,_;_=Symbol.for("react.module.reference");function k(M){return!!(typeof M=="string"||typeof M=="function"||M===i||M===s||P||M===r||M===l||M===d||E||M===p||S||x||T||typeof M=="object"&&M!==null&&(M.$$typeof===f||M.$$typeof===u||M.$$typeof===o||M.$$typeof===a||M.$$typeof===c||M.$$typeof===_||M.getModuleId!==void 0))}function I(M,ne,le){var pe=M.displayName;if(pe)return pe;var Ie=ne.displayName||ne.name||"";return Ie!==""?le+"("+Ie+")":le}function N(M){return M.displayName||"Context"}function K(M){if(M==null)return null;if(typeof M.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof M=="function")return M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case i:return"Fragment";case n:return"Portal";case s:return"Profiler";case r:return"StrictMode";case l:return"Suspense";case d:return"SuspenseList"}if(typeof M=="object")switch(M.$$typeof){case a:var ne=M;return N(ne)+".Consumer";case o:var le=M;return N(le._context)+".Provider";case c:return I(M,M.render,"ForwardRef");case u:var pe=M.displayName||null;return pe!==null?pe:K(M.type)||"Memo";case f:{var Ie=M,Le=Ie._payload,ke=Ie._init;try{return K(ke(Le))}catch{return null}}}return null}var J=Object.assign,se=0,ie,X,O,oe,L,F,te;function j(){}j.__reactDisabledLog=!0;function q(){{if(se===0){ie=console.log,X=console.info,O=console.warn,oe=console.error,L=console.group,F=console.groupCollapsed,te=console.groupEnd;var M={configurable:!0,enumerable:!0,value:j,writable:!0};Object.defineProperties(console,{info:M,log:M,warn:M,error:M,group:M,groupCollapsed:M,groupEnd:M})}se++}}function ee(){{if(se--,se===0){var M={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},M,{value:ie}),info:J({},M,{value:X}),warn:J({},M,{value:O}),error:J({},M,{value:oe}),group:J({},M,{value:L}),groupCollapsed:J({},M,{value:F}),groupEnd:J({},M,{value:te})})}se<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=b.ReactCurrentDispatcher,D;function $(M,ne,le){{if(D===void 0)try{throw Error()}catch(Ie){var pe=Ie.stack.trim().match(/\n( *(at )?)/);D=pe&&pe[1]||""}return`
18
+ `+D+M}}var Q=!1,W;{var ce=typeof WeakMap=="function"?WeakMap:Map;W=new ce}function z(M,ne){if(!M||Q)return"";{var le=W.get(M);if(le!==void 0)return le}var pe;Q=!0;var Ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Le;Le=G.current,G.current=null,q();try{if(ne){var ke=function(){throw Error()};if(Object.defineProperty(ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ke,[])}catch(It){pe=It}Reflect.construct(M,[],ke)}else{try{ke.call()}catch(It){pe=It}M.call(ke.prototype)}}else{try{throw Error()}catch(It){pe=It}M()}}catch(It){if(It&&pe&&typeof It.stack=="string"){for(var Se=It.stack.split(`
19
+ `),Pt=pe.stack.split(`
20
+ `),tt=Se.length-1,ot=Pt.length-1;tt>=1&&ot>=0&&Se[tt]!==Pt[ot];)ot--;for(;tt>=1&&ot>=0;tt--,ot--)if(Se[tt]!==Pt[ot]){if(tt!==1||ot!==1)do if(tt--,ot--,ot<0||Se[tt]!==Pt[ot]){var qt=`
21
+ `+Se[tt].replace(" at new "," at ");return M.displayName&&qt.includes("<anonymous>")&&(qt=qt.replace("<anonymous>",M.displayName)),typeof M=="function"&&W.set(M,qt),qt}while(tt>=1&&ot>=0);break}}}finally{Q=!1,G.current=Le,ee(),Error.prepareStackTrace=Ie}var cr=M?M.displayName||M.name:"",Oi=cr?$(cr):"";return typeof M=="function"&&W.set(M,Oi),Oi}function me(M,ne,le){return z(M,!1)}function Ee(M){var ne=M.prototype;return!!(ne&&ne.isReactComponent)}function qe(M,ne,le){if(M==null)return"";if(typeof M=="function")return z(M,Ee(M));if(typeof M=="string")return $(M);switch(M){case l:return $("Suspense");case d:return $("SuspenseList")}if(typeof M=="object")switch(M.$$typeof){case c:return me(M.render);case u:return qe(M.type,ne,le);case f:{var pe=M,Ie=pe._payload,Le=pe._init;try{return qe(Le(Ie),ne,le)}catch{}}}return""}var Ct=Object.prototype.hasOwnProperty,gn={},vn=b.ReactDebugCurrentFrame;function Et(M){if(M){var ne=M._owner,le=qe(M.type,M._source,ne?ne.type:null);vn.setExtraStackFrame(le)}else vn.setExtraStackFrame(null)}function Pc(M,ne,le,pe,Ie){{var Le=Function.call.bind(Ct);for(var ke in M)if(Le(M,ke)){var Se=void 0;try{if(typeof M[ke]!="function"){var Pt=Error((pe||"React class")+": "+le+" type `"+ke+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof M[ke]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Pt.name="Invariant Violation",Pt}Se=M[ke](ne,ke,pe,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(tt){Se=tt}Se&&!(Se instanceof Error)&&(Et(Ie),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",pe||"React class",le,ke,typeof Se),Et(null)),Se instanceof Error&&!(Se.message in gn)&&(gn[Se.message]=!0,Et(Ie),w("Failed %s type: %s",le,Se.message),Et(null))}}}var Rc=Array.isArray;function _i(M){return Rc(M)}function ms(M){{var ne=typeof Symbol=="function"&&Symbol.toStringTag,le=ne&&M[Symbol.toStringTag]||M.constructor.name||"Object";return le}}function ps(M){try{return or(M),!1}catch{return!0}}function or(M){return""+M}function Ni(M){if(ps(M))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ms(M)),or(M)}var gs=b.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},tn,At;function $e(M){if(Ct.call(M,"ref")){var ne=Object.getOwnPropertyDescriptor(M,"ref").get;if(ne&&ne.isReactWarning)return!1}return M.ref!==void 0}function Ac(M){if(Ct.call(M,"key")){var ne=Object.getOwnPropertyDescriptor(M,"key").get;if(ne&&ne.isReactWarning)return!1}return M.key!==void 0}function Cw(M,ne){typeof M.ref=="string"&&gs.current}function kw(M,ne){{var le=function(){tn||(tn=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ne))};le.isReactWarning=!0,Object.defineProperty(M,"key",{get:le,configurable:!0})}}function Tw(M,ne){{var le=function(){At||(At=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ne))};le.isReactWarning=!0,Object.defineProperty(M,"ref",{get:le,configurable:!0})}}var Ew=function(M,ne,le,pe,Ie,Le,ke){var Se={$$typeof:e,type:M,key:ne,ref:le,props:ke,_owner:Le};return Se._store={},Object.defineProperty(Se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:pe}),Object.defineProperty(Se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ie}),Object.freeze&&(Object.freeze(Se.props),Object.freeze(Se)),Se};function Pw(M,ne,le,pe,Ie){{var Le,ke={},Se=null,Pt=null;le!==void 0&&(Ni(le),Se=""+le),Ac(ne)&&(Ni(ne.key),Se=""+ne.key),$e(ne)&&(Pt=ne.ref,Cw(ne,Ie));for(Le in ne)Ct.call(ne,Le)&&!ve.hasOwnProperty(Le)&&(ke[Le]=ne[Le]);if(M&&M.defaultProps){var tt=M.defaultProps;for(Le in tt)ke[Le]===void 0&&(ke[Le]=tt[Le])}if(Se||Pt){var ot=typeof M=="function"?M.displayName||M.name||"Unknown":M;Se&&kw(ke,ot),Pt&&Tw(ke,ot)}return Ew(M,Se,Pt,Ie,pe,gs.current,ke)}}var Ic=b.ReactCurrentOwner,dh=b.ReactDebugCurrentFrame;function ar(M){if(M){var ne=M._owner,le=qe(M.type,M._source,ne?ne.type:null);dh.setExtraStackFrame(le)}else dh.setExtraStackFrame(null)}var Mc;Mc=!1;function _c(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function uh(){{if(Ic.current){var M=K(Ic.current.type);if(M)return`
22
22
 
23
- Check the render method of \``+C+"`."}return""}}function wf(C){return""}var Si={};function Sf(C){{var R=wi();if(!R){var z=typeof C=="string"?C:C.displayName||C.name;z&&(R=`
23
+ Check the render method of \``+M+"`."}return""}}function Rw(M){return""}var fh={};function Aw(M){{var ne=uh();if(!ne){var le=typeof M=="string"?M:M.displayName||M.name;le&&(ne=`
24
24
 
25
- Check the top-level render call using <`+z+">.")}return R}}function Ci(C,R){{if(!C._store||C._store.validated||C.key!=null)return;C._store.validated=!0;var z=Sf(R);if(Si[z])return;Si[z]=!0;var ie="";C&&C._owner&&C._owner!==Js.current&&(ie=" It was passed a child from "+se(C._owner.type)+"."),Gt(C),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',z,ie),Gt(null)}}function Ei(C,R){{if(typeof C!="object")return;if(Rt(C))for(var z=0;z<C.length;z++){var ie=C[z];er(ie)&&Ci(ie,R)}else if(er(C))C._store&&(C._store.validated=!0);else if(C){var he=v(C);if(typeof he=="function"&&he!==C.entries)for(var ge=he.call(C),fe;!(fe=ge.next()).done;)er(fe.value)&&Ci(fe.value,R)}}}function Cf(C){{var R=C.type;if(R==null||typeof R=="string")return;var z;if(typeof R=="function")z=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===l||R.$$typeof===h))z=R.propTypes;else return;if(z){var ie=se(R);Gs(z,C.props,"prop",ie,C)}else if(R.PropTypes!==void 0&&!Qs){Qs=!0;var he=se(R);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ef(C){{for(var R=Object.keys(C.props),z=0;z<R.length;z++){var ie=R[z];if(ie!=="children"&&ie!=="key"){Gt(C),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ie),Gt(null);break}}C.ref!==null&&(Gt(C),y("Invalid attribute `ref` supplied to `React.Fragment`."),Gt(null))}}var ki={};function Ai(C,R,z,ie,he,ge){{var fe=I(C);if(!fe){var ue="";(C===void 0||typeof C=="object"&&C!==null&&Object.keys(C).length===0)&&(ue+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Oe=wf();Oe?ue+=Oe:ue+=wi();var Se;C===null?Se="null":Rt(C)?Se="array":C!==void 0&&C.$$typeof===t?(Se="<"+(se(C.type)||"Unknown")+" />",ue=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof C,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ue)}var Te=bf(C,R,z,he,ge);if(Te==null)return Te;if(fe){var We=R.children;if(We!==void 0)if(ie)if(Rt(We)){for(var Xt=0;Xt<We.length;Xt++)Ei(We[Xt],C);Object.freeze&&Object.freeze(We)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ei(We,C)}if(De.call(R,"key")){var It=se(C),Be=Object.keys(R).filter(function(Mf){return Mf!=="key"}),tr=Be.length>0?"{key: someKey, "+Be.join(": ..., ")+": ...}":"{key: someKey}";if(!ki[It+tr]){var Pf=Be.length>0?"{"+Be.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+le+">.")}return ne}}function hh(M,ne){{if(!M._store||M._store.validated||M.key!=null)return;M._store.validated=!0;var le=Aw(ne);if(fh[le])return;fh[le]=!0;var pe="";M&&M._owner&&M._owner!==Ic.current&&(pe=" It was passed a child from "+K(M._owner.type)+"."),ar(M),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,pe),ar(null)}}function mh(M,ne){{if(typeof M!="object")return;if(_i(M))for(var le=0;le<M.length;le++){var pe=M[le];_c(pe)&&hh(pe,ne)}else if(_c(M))M._store&&(M._store.validated=!0);else if(M){var Ie=y(M);if(typeof Ie=="function"&&Ie!==M.entries)for(var Le=Ie.call(M),ke;!(ke=Le.next()).done;)_c(ke.value)&&hh(ke.value,ne)}}}function Iw(M){{var ne=M.type;if(ne==null||typeof ne=="string")return;var le;if(typeof ne=="function")le=ne.propTypes;else if(typeof ne=="object"&&(ne.$$typeof===c||ne.$$typeof===u))le=ne.propTypes;else return;if(le){var pe=K(ne);Pc(le,M.props,"prop",pe,M)}else if(ne.PropTypes!==void 0&&!Mc){Mc=!0;var Ie=K(ne);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ie||"Unknown")}typeof ne.getDefaultProps=="function"&&!ne.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mw(M){{for(var ne=Object.keys(M.props),le=0;le<ne.length;le++){var pe=ne[le];if(pe!=="children"&&pe!=="key"){ar(M),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",pe),ar(null);break}}M.ref!==null&&(ar(M),w("Invalid attribute `ref` supplied to `React.Fragment`."),ar(null))}}var ph={};function gh(M,ne,le,pe,Ie,Le){{var ke=k(M);if(!ke){var Se="";(M===void 0||typeof M=="object"&&M!==null&&Object.keys(M).length===0)&&(Se+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Pt=Rw();Pt?Se+=Pt:Se+=uh();var tt;M===null?tt="null":_i(M)?tt="array":M!==void 0&&M.$$typeof===e?(tt="<"+(K(M.type)||"Unknown")+" />",Se=" Did you accidentally export a JSX literal instead of a component?"):tt=typeof M,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",tt,Se)}var ot=Pw(M,ne,le,Ie,Le);if(ot==null)return ot;if(ke){var qt=ne.children;if(qt!==void 0)if(pe)if(_i(qt)){for(var cr=0;cr<qt.length;cr++)mh(qt[cr],M);Object.freeze&&Object.freeze(qt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else mh(qt,M)}if(Ct.call(ne,"key")){var Oi=K(M),It=Object.keys(ne).filter(function(Lw){return Lw!=="key"}),Nc=It.length>0?"{key: someKey, "+It.join(": ..., ")+": ...}":"{key: someKey}";if(!ph[Oi+Nc]){var jw=It.length>0?"{"+It.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,tr,It,Pf,It),ki[It+tr]=!0}}return C===s?Ef(Te):Cf(Te),Te}}function kf(C,R,z){return Ai(C,R,z,!0)}function Af(C,R,z){return Ai(C,R,z,!1)}var Tf=Af,jf=kf;Nn.Fragment=s,Nn.jsx=Tf,Nn.jsxs=jf}()),Nn}var Pi;function Lf(){return Pi||(Pi=1,process.env.NODE_ENV==="production"?ns.exports=If():ns.exports=Df()),ns.exports}var c=Lf();const vo=E.createContext({});function bo(e){const t=E.useRef(null);return t.current===null&&(t.current=e()),t.current}const wo=typeof window<"u",Vl=wo?E.useLayoutEffect:E.useEffect,Fs=E.createContext(null);function So(e,t){e.indexOf(t)===-1&&e.push(t)}function Co(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const xt=(e,t,n)=>n>t?t:n<e?e:n;function Rr(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let yn=()=>{},yt=()=>{};process.env.NODE_ENV!=="production"&&(yn=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(Rr(t,n))},yt=(e,t,n)=>{if(!e)throw new Error(Rr(t,n))});const vt={},Il=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Dl(e){return typeof e=="object"&&e!==null}const Ll=e=>/^0[^.\s]+$/u.test(e);function Eo(e){let t;return()=>(t===void 0&&(t=e()),t)}const Xe=e=>e,Ff=(e,t)=>n=>t(e(n)),Gn=(...e)=>e.reduce(Ff),$n=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class ko{constructor(){this.subscriptions=[]}add(t){return So(this.subscriptions,t),()=>Co(this.subscriptions,t)}notify(t,n,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,s);else for(let i=0;i<r;i++){const o=this.subscriptions[i];o&&o(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const et=e=>e*1e3,lt=e=>e/1e3;function Fl(e,t){return t?e*(1e3/t):0}const Mi=new Set;function Ao(e,t,n){e||Mi.has(t)||(console.warn(Rr(t,n)),Mi.add(t))}const Ol=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Of=1e-7,_f=12;function $f(e,t,n,s,r){let i,o,a=0;do o=t+(n-t)/2,i=Ol(o,s,r)-e,i>0?n=o:t=o;while(Math.abs(i)>Of&&++a<_f);return o}function Xn(e,t,n,s){if(e===t&&n===s)return Xe;const r=i=>$f(i,0,1,e,n);return i=>i===0||i===1?i:Ol(r(i),t,s)}const _l=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$l=e=>t=>1-e(1-t),Bl=Xn(.33,1.53,.69,.99),To=$l(Bl),Hl=_l(To),Ul=e=>(e*=2)<1?.5*To(e):.5*(2-Math.pow(2,-10*(e-1))),jo=e=>1-Math.sin(Math.acos(e)),zl=$l(jo),Zl=_l(jo),Bf=Xn(.42,0,1,1),Hf=Xn(0,0,.58,1),Wl=Xn(.42,0,.58,1),Uf=e=>Array.isArray(e)&&typeof e[0]!="number",Kl=e=>Array.isArray(e)&&typeof e[0]=="number",Ni={linear:Xe,easeIn:Bf,easeInOut:Wl,easeOut:Hf,circIn:jo,circInOut:Zl,circOut:zl,backIn:To,backInOut:Hl,backOut:Bl,anticipate:Ul},zf=e=>typeof e=="string",Ri=e=>{if(Kl(e)){yt(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,s,r]=e;return Xn(t,n,s,r)}else if(zf(e))return yt(Ni[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),Ni[e];return e},ss=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Zf(e,t){let n=new Set,s=new Set,r=!1,i=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){o.has(u)&&(d.schedule(u),e()),u(a)}const d={schedule:(u,h=!1,m=!1)=>{const x=m&&r?n:s;return h&&o.add(u),x.has(u)||x.add(u),u},cancel:u=>{s.delete(u),o.delete(u)},process:u=>{if(a=u,r){i=!0;return}r=!0,[n,s]=[s,n],n.forEach(l),n.clear(),r=!1,i&&(i=!1,d.process(u))}};return d}const Wf=40;function Yl(e,t){let n=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=ss.reduce((w,S)=>(w[S]=Zf(i),w),{}),{setup:a,read:l,resolveKeyframes:d,preUpdate:u,update:h,preRender:m,render:g,postRender:x}=o,p=()=>{const w=vt.useManualTiming?r.timestamp:performance.now();n=!1,vt.useManualTiming||(r.delta=s?1e3/60:Math.max(Math.min(w-r.timestamp,Wf),1)),r.timestamp=w,r.isProcessing=!0,a.process(r),l.process(r),d.process(r),u.process(r),h.process(r),m.process(r),g.process(r),x.process(r),r.isProcessing=!1,n&&t&&(s=!1,e(p))},v=()=>{n=!0,s=!0,r.isProcessing||e(p)};return{schedule:ss.reduce((w,S)=>{const k=o[S];return w[S]=(T,A=!1,j=!1)=>(n||v(),k.schedule(T,A,j)),w},{}),cancel:w=>{for(let S=0;S<ss.length;S++)o[ss[S]].cancel(w)},state:r,steps:o}}const{schedule:ye,cancel:kt,state:Ne,steps:nr}=Yl(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xe,!0);let gs;function Kf(){gs=void 0}const He={now:()=>(gs===void 0&&He.set(Ne.isProcessing||vt.useManualTiming?Ne.timestamp:performance.now()),gs),set:e=>{gs=e,queueMicrotask(Kf)}},Gl=e=>t=>typeof t=="string"&&t.startsWith(e),Po=Gl("--"),Yf=Gl("var(--"),Mo=e=>Yf(e)?Gf.test(e.split("/*")[0].trim()):!1,Gf=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Bn={...vn,transform:e=>xt(0,1,e)},rs={...vn,default:1},Ln=e=>Math.round(e*1e5)/1e5,No=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Xf(e){return e==null}const qf=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ro=(e,t)=>n=>!!(typeof n=="string"&&qf.test(n)&&n.startsWith(e)||t&&!Xf(n)&&Object.prototype.hasOwnProperty.call(n,t)),Xl=(e,t,n)=>s=>{if(typeof s!="string")return s;const[r,i,o,a]=s.match(No);return{[e]:parseFloat(r),[t]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Jf=e=>xt(0,255,e),sr={...vn,transform:e=>Math.round(Jf(e))},Ot={test:Ro("rgb","red"),parse:Xl("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+sr.transform(e)+", "+sr.transform(t)+", "+sr.transform(n)+", "+Ln(Bn.transform(s))+")"};function Qf(e){let t="",n="",s="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,s+=s,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Vr={test:Ro("#"),parse:Qf,transform:Ot.transform},qn=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ct=qn("deg"),ct=qn("%"),oe=qn("px"),eh=qn("vh"),th=qn("vw"),Vi={...ct,parse:e=>ct.parse(e)/100,transform:e=>ct.transform(e*100)},sn={test:Ro("hsl","hue"),parse:Xl("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+ct.transform(Ln(t))+", "+ct.transform(Ln(n))+", "+Ln(Bn.transform(s))+")"},Pe={test:e=>Ot.test(e)||Vr.test(e)||sn.test(e),parse:e=>Ot.test(e)?Ot.parse(e):sn.test(e)?sn.parse(e):Vr.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ot.transform(e):sn.transform(e),getAnimatableNone:e=>{const t=Pe.parse(e);return t.alpha=0,Pe.transform(t)}},nh=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function sh(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(No))==null?void 0:t.length)||0)+(((n=e.match(nh))==null?void 0:n.length)||0)>0}const ql="number",Jl="color",rh="var",oh="var(",Ii="${}",ih=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Hn(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},r=[];let i=0;const a=t.replace(ih,l=>(Pe.test(l)?(s.color.push(i),r.push(Jl),n.push(Pe.parse(l))):l.startsWith(oh)?(s.var.push(i),r.push(rh),n.push(l)):(s.number.push(i),r.push(ql),n.push(parseFloat(l))),++i,Ii)).split(Ii);return{values:n,split:a,indexes:s,types:r}}function Ql(e){return Hn(e).values}function ec(e){const{split:t,types:n}=Hn(e),s=t.length;return r=>{let i="";for(let o=0;o<s;o++)if(i+=t[o],r[o]!==void 0){const a=n[o];a===ql?i+=Ln(r[o]):a===Jl?i+=Pe.transform(r[o]):i+=r[o]}return i}}const ah=e=>typeof e=="number"?0:Pe.test(e)?Pe.getAnimatableNone(e):e;function lh(e){const t=Ql(e);return ec(e)(t.map(ah))}const At={test:sh,parse:Ql,createTransformer:ec,getAnimatableNone:lh};function rr(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function ch({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let r=0,i=0,o=0;if(!t)r=i=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=rr(l,a,e+1/3),i=rr(l,a,e),o=rr(l,a,e-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:s}}function ks(e,t){return n=>n>0?t:e}const be=(e,t,n)=>e+(t-e)*n,or=(e,t,n)=>{const s=e*e,r=n*(t*t-s)+s;return r<0?0:Math.sqrt(r)},dh=[Vr,Ot,sn],uh=e=>dh.find(t=>t.test(e));function Di(e){const t=uh(e);if(yn(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===sn&&(n=ch(n)),n}const Li=(e,t)=>{const n=Di(e),s=Di(t);if(!n||!s)return ks(e,t);const r={...n};return i=>(r.red=or(n.red,s.red,i),r.green=or(n.green,s.green,i),r.blue=or(n.blue,s.blue,i),r.alpha=be(n.alpha,s.alpha,i),Ot.transform(r))},Ir=new Set(["none","hidden"]);function fh(e,t){return Ir.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function hh(e,t){return n=>be(e,t,n)}function Vo(e){return typeof e=="number"?hh:typeof e=="string"?Mo(e)?ks:Pe.test(e)?Li:gh:Array.isArray(e)?tc:typeof e=="object"?Pe.test(e)?Li:mh:ks}function tc(e,t){const n=[...e],s=n.length,r=e.map((i,o)=>Vo(i)(i,t[o]));return i=>{for(let o=0;o<s;o++)n[o]=r[o](i);return n}}function mh(e,t){const n={...e,...t},s={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(s[r]=Vo(e[r])(e[r],t[r]));return r=>{for(const i in s)n[i]=s[i](r);return n}}function ph(e,t){const n=[],s={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const i=t.types[r],o=e.indexes[i][s[i]],a=e.values[o]??0;n[r]=a,s[i]++}return n}const gh=(e,t)=>{const n=At.createTransformer(t),s=Hn(e),r=Hn(t);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?Ir.has(e)&&!r.values.length||Ir.has(t)&&!s.values.length?fh(e,t):Gn(tc(ph(s,r),r.values),n):(yn(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),ks(e,t))};function nc(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?be(e,t,n):Vo(e)(e,t)}const xh=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ye.update(t,n),stop:()=>kt(t),now:()=>Ne.isProcessing?Ne.timestamp:He.now()}},sc=(e,t,n=10)=>{let s="";const r=Math.max(Math.round(t/n),2);for(let i=0;i<r;i++)s+=Math.round(e(i/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},As=2e4;function Io(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<As;)t+=n,s=e.next(t);return t>=As?1/0:t}function yh(e,t=100,n){const s=n({...e,keyframes:[0,t]}),r=Math.min(Io(s),As);return{type:"keyframes",ease:i=>s.next(r*i).value/t,duration:lt(r)}}const vh=5;function rc(e,t,n){const s=Math.max(t-vh,0);return Fl(n-e(s),t-s)}const ve={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ir=.001;function bh({duration:e=ve.duration,bounce:t=ve.bounce,velocity:n=ve.velocity,mass:s=ve.mass}){let r,i;yn(e<=et(ve.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-t;o=xt(ve.minDamping,ve.maxDamping,o),e=xt(ve.minDuration,ve.maxDuration,lt(e)),o<1?(r=d=>{const u=d*o,h=u*e,m=u-n,g=Dr(d,o),x=Math.exp(-h);return ir-m/g*x},i=d=>{const h=d*o*e,m=h*n+n,g=Math.pow(o,2)*Math.pow(d,2)*e,x=Math.exp(-h),p=Dr(Math.pow(d,2),o);return(-r(d)+ir>0?-1:1)*((m-g)*x)/p}):(r=d=>{const u=Math.exp(-d*e),h=(d-n)*e+1;return-ir+u*h},i=d=>{const u=Math.exp(-d*e),h=(n-d)*(e*e);return u*h});const a=5/e,l=Sh(r,i,a);if(e=et(e),isNaN(l))return{stiffness:ve.stiffness,damping:ve.damping,duration:e};{const d=Math.pow(l,2)*s;return{stiffness:d,damping:o*2*Math.sqrt(s*d),duration:e}}}const wh=12;function Sh(e,t,n){let s=n;for(let r=1;r<wh;r++)s=s-e(s)/t(s);return s}function Dr(e,t){return e*Math.sqrt(1-t*t)}const Ch=["duration","bounce"],Eh=["stiffness","damping","mass"];function Fi(e,t){return t.some(n=>e[n]!==void 0)}function kh(e){let t={velocity:ve.velocity,stiffness:ve.stiffness,damping:ve.damping,mass:ve.mass,isResolvedFromDuration:!1,...e};if(!Fi(e,Eh)&&Fi(e,Ch))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),r=s*s,i=2*xt(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:ve.mass,stiffness:r,damping:i}}else{const n=bh(e);t={...t,...n,mass:ve.mass},t.isResolvedFromDuration=!0}return t}function Ts(e=ve.visualDuration,t=ve.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:r}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:d,mass:u,duration:h,velocity:m,isResolvedFromDuration:g}=kh({...n,velocity:-lt(n.velocity||0)}),x=m||0,p=d/(2*Math.sqrt(l*u)),v=o-i,b=lt(Math.sqrt(l/u)),y=Math.abs(v)<5;s||(s=y?ve.restSpeed.granular:ve.restSpeed.default),r||(r=y?ve.restDelta.granular:ve.restDelta.default);let w;if(p<1){const k=Dr(b,p);w=T=>{const A=Math.exp(-p*b*T);return o-A*((x+p*b*v)/k*Math.sin(k*T)+v*Math.cos(k*T))}}else if(p===1)w=k=>o-Math.exp(-b*k)*(v+(x+b*v)*k);else{const k=b*Math.sqrt(p*p-1);w=T=>{const A=Math.exp(-p*b*T),j=Math.min(k*T,300);return o-A*((x+p*b*v)*Math.sinh(j)+k*v*Math.cosh(j))/k}}const S={calculatedDuration:g&&h||null,next:k=>{const T=w(k);if(g)a.done=k>=h;else{let A=k===0?x:0;p<1&&(A=k===0?et(x):rc(w,k,T));const j=Math.abs(A)<=s,V=Math.abs(o-T)<=r;a.done=j&&V}return a.value=a.done?o:T,a},toString:()=>{const k=Math.min(Io(S),As),T=sc(A=>S.next(k*A).value,k,30);return k+"ms "+T},toTransition:()=>{}};return S}Ts.applyToOptions=e=>{const t=yh(e,100,Ts);return e.ease=t.ease,e.duration=et(t.duration),e.type="keyframes",e};function Lr({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:d=.5,restSpeed:u}){const h=e[0],m={done:!1,value:h},g=j=>a!==void 0&&j<a||l!==void 0&&j>l,x=j=>a===void 0?l:l===void 0||Math.abs(a-j)<Math.abs(l-j)?a:l;let p=n*t;const v=h+p,b=o===void 0?v:o(v);b!==v&&(p=b-h);const y=j=>-p*Math.exp(-j/s),w=j=>b+y(j),S=j=>{const V=y(j),I=w(j);m.done=Math.abs(V)<=d,m.value=m.done?b:I};let k,T;const A=j=>{g(m.value)&&(k=j,T=Ts({keyframes:[m.value,x(m.value)],velocity:rc(w,j,m.value),damping:r,stiffness:i,restDelta:d,restSpeed:u}))};return A(0),{calculatedDuration:null,next:j=>{let V=!1;return!T&&k===void 0&&(V=!0,S(j),A(j)),k!==void 0&&j>=k?T.next(j-k):(!V&&S(j),m)}}}function Ah(e,t,n){const s=[],r=n||vt.mix||nc,i=e.length-1;for(let o=0;o<i;o++){let a=r(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||Xe:t;a=Gn(l,a)}s.push(a)}return s}function Th(e,t,{clamp:n=!0,ease:s,mixer:r}={}){const i=e.length;if(yt(i===t.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Ah(t,s,r),l=a.length,d=u=>{if(o&&u<e[0])return t[0];let h=0;if(l>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const m=$n(e[h],e[h+1],u);return a[h](m)};return n?u=>d(xt(e[0],e[i-1],u)):d}function jh(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const r=$n(0,t,s);e.push(be(n,1,r))}}function Ph(e){const t=[0];return jh(t,e.length-1),t}function Mh(e,t){return e.map(n=>n*t)}function Nh(e,t){return e.map(()=>t||Wl).splice(0,e.length-1)}function rn({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const r=Uf(s)?s.map(Ri):Ri(s),i={done:!1,value:t[0]},o=Mh(n&&n.length===t.length?n:Ph(t),e),a=Th(o,t,{ease:Array.isArray(r)?r:Nh(t,r)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}const Rh=e=>e!==null;function Do(e,{repeat:t,repeatType:n="loop"},s,r=1){const i=e.filter(Rh),a=r<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!a||s===void 0?i[a]:s}const Vh={decay:Lr,inertia:Lr,tween:rn,keyframes:rn,spring:Ts};function oc(e){typeof e.type=="string"&&(e.type=Vh[e.type])}class Lo{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Ih=e=>e/100;class Fo extends Lo{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,r;const{motionValue:n}=this.options;n&&n.updatedAt!==He.now()&&this.tick(He.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;oc(t);const{type:n=rn,repeat:s=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=t;let{keyframes:a}=t;const l=n||rn;process.env.NODE_ENV!=="production"&&l!==rn&&yt(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),l!==rn&&typeof a[0]!="number"&&(this.mixKeyframes=Gn(Ih,nc(a[0],a[1])),a=[0,100]);const d=l({...t,keyframes:a});i==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=Io(d));const{calculatedDuration:u}=d;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:r,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return s.next(0);const{delay:d=0,keyframes:u,repeat:h,repeatType:m,repeatDelay:g,type:x,onUpdate:p,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const b=this.currentTime-d*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?b<0:b>r;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let w=this.currentTime,S=s;if(h){const j=Math.min(this.currentTime,r)/a;let V=Math.floor(j),I=j%1;!I&&j>=1&&(I=1),I===1&&V--,V=Math.min(V,h+1),!!(V%2)&&(m==="reverse"?(I=1-I,g&&(I-=g/a)):m==="mirror"&&(S=o)),w=xt(0,1,I)*a}const k=y?{done:!1,value:u[0]}:S.next(w);i&&(k.value=i(k.value));let{done:T}=k;!y&&l!==null&&(T=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return A&&x!==Lr&&(k.value=Do(u,this.options,v,this.speed)),p&&p(k.value),A&&this.finish(),k}then(t,n){return this.finished.then(t,n)}get duration(){return lt(this.calculatedDuration)}get time(){return lt(this.currentTime)}set time(t){var n;t=et(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(He.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=lt(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:t=xh,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(i=(r=this.options).onPlay)==null||i.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(He.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Dh(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const _t=e=>e*180/Math.PI,Fr=e=>{const t=_t(Math.atan2(e[1],e[0]));return Or(t)},Lh={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Fr,rotateZ:Fr,skewX:e=>_t(Math.atan(e[1])),skewY:e=>_t(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Or=e=>(e=e%360,e<0&&(e+=360),e),Oi=Fr,_i=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),$i=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Fh={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:_i,scaleY:$i,scale:e=>(_i(e)+$i(e))/2,rotateX:e=>Or(_t(Math.atan2(e[6],e[5]))),rotateY:e=>Or(_t(Math.atan2(-e[2],e[0]))),rotateZ:Oi,rotate:Oi,skewX:e=>_t(Math.atan(e[4])),skewY:e=>_t(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes("scale")?1:0}function $r(e,t){if(!e||e==="none")return _r(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=Fh,r=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Lh,r=a}if(!r)return _r(t);const i=s[t],o=r[1].split(",").map(_h);return typeof i=="function"?i(o):o[i]}const Oh=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return $r(n,t)};function _h(e){return parseFloat(e.trim())}const bn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wn=new Set(bn),Bi=e=>e===vn||e===oe,$h=new Set(["x","y","z"]),Bh=bn.filter(e=>!$h.has(e));function Hh(e){const t=[];return Bh.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const $t={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>$r(t,"x"),y:(e,{transform:t})=>$r(t,"y")};$t.translateX=$t.x;$t.translateY=$t.y;const Bt=new Set;let Br=!1,Hr=!1,Ur=!1;function ic(){if(Hr){const e=Array.from(Bt).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const r=Hh(s);r.length&&(n.set(s,r),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const r=n.get(s);r&&r.forEach(([i,o])=>{var a;(a=s.getValue(i))==null||a.set(o)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Hr=!1,Br=!1,Bt.forEach(e=>e.complete(Ur)),Bt.clear()}function ac(){Bt.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Hr=!0)})}function Uh(){Ur=!0,ac(),ic(),Ur=!1}class Oo{constructor(t,n,s,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Bt.add(this),Br||(Br=!0,ye.read(ac),ye.resolveKeyframes(ic))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:r}=this;if(t[0]===null){const i=r==null?void 0:r.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(s&&n){const a=s.readValue(n,o);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=o),r&&i===void 0&&r.set(t[0])}Dh(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Bt.delete(this)}cancel(){this.state==="scheduled"&&(Bt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const zh=e=>e.startsWith("--");function Zh(e,t,n){zh(t)?e.style.setProperty(t,n):e.style[t]=n}const Wh=Eo(()=>window.ScrollTimeline!==void 0),Kh={};function Yh(e,t){const n=Eo(e);return()=>Kh[t]??n()}const lc=Yh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),In=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,Hi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:In([0,.65,.55,1]),circOut:In([.55,0,1,.45]),backIn:In([.31,.01,.66,-.59]),backOut:In([.33,1.53,.69,.99])};function cc(e,t){if(e)return typeof e=="function"?lc()?sc(e,t):"ease-out":Kl(e)?In(e):Array.isArray(e)?e.map(n=>cc(n,t)||Hi.easeOut):Hi[e]}function Gh(e,t,n,{delay:s=0,duration:r=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},d=void 0){const u={[t]:n};l&&(u.offset=l);const h=cc(a,r);Array.isArray(h)&&(u.easing=h);const m={delay:s,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return d&&(m.pseudoElement=d),e.animate(u,m)}function dc(e){return typeof e=="function"&&"applyToOptions"in e}function Xh({type:e,...t}){return dc(e)&&lc()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class qh extends Lo{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,yt(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=Xh(t);this.animation=Gh(n,s,r,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=Do(r,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(u):Zh(n,s,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return lt(Number(t))}get time(){return lt(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=et(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Wh()?(this.animation.timeline=t,Xe):n(this)}}const uc={anticipate:Ul,backInOut:Hl,circInOut:Zl};function Jh(e){return e in uc}function Qh(e){typeof e.ease=="string"&&Jh(e.ease)&&(e.ease=uc[e.ease])}const Ui=10;class em extends qh{constructor(t){Qh(t),oc(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:r,element:i,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new Fo({...o,autoplay:!1}),l=et(this.finishedTime??this.time);n.setWithVelocity(a.sample(l-Ui).value,a.sample(l).value,Ui),a.stop()}}const zi=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(At.test(e)||e==="0")&&!e.startsWith("url("));function tm(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function nm(e,t,n,s){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=zi(r,t),a=zi(i,t);return yn(o===a,`You are trying to animate ${t} from "${r}" to "${i}". "${o?i:r}" is not an animatable value.`,"value-not-animatable"),!o||!a?!1:tm(e)||(n==="spring"||dc(n))&&s}function zr(e){e.duration=0,e.type}const sm=new Set(["opacity","clipPath","filter","transform"]),rm=Eo(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function om(e){var u;const{motionValue:t,name:n,repeatDelay:s,repeatType:r,damping:i,type:o}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:d}=t.owner.getProps();return rm()&&n&&sm.has(n)&&(n!=="transform"||!d)&&!l&&!s&&r!=="mirror"&&i!==0&&o!=="inertia"}const im=40;class am extends Lo{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",keyframes:a,name:l,motionValue:d,element:u,...h}){var x;super(),this.stop=()=>{var p,v;this._animation&&(this._animation.stop(),(p=this.stopTimeline)==null||p.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=He.now();const m={autoplay:t,delay:n,type:s,repeat:r,repeatDelay:i,repeatType:o,name:l,motionValue:d,element:u,...h},g=(u==null?void 0:u.KeyframeResolver)||Oo;this.keyframeResolver=new g(a,(p,v,b)=>this.onKeyframesResolved(p,v,m,!b),l,d,u),(x=this.keyframeResolver)==null||x.scheduleResolve()}onKeyframesResolved(t,n,s,r){this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:l,isHandoff:d,onUpdate:u}=s;this.resolvedAt=He.now(),nm(t,i,o,a)||((vt.instantAnimations||!l)&&(u==null||u(Do(t,s,n))),t[0]=t[t.length-1],zr(s),s.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>im?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},g=!d&&om(m)?new em({...m,element:m.motionValue.owner.current}):new Fo(m);g.finished.then(()=>this.notifyFinished()).catch(Xe),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Uh()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const lm=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cm(e){const t=lm.exec(e);if(!t)return[,];const[,n,s,r]=t;return[`--${n??s}`,r]}const dm=4;function fc(e,t,n=1){yt(n<=dm,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=cm(e);if(!s)return;const i=window.getComputedStyle(t).getPropertyValue(s);if(i){const o=i.trim();return Il(o)?parseFloat(o):o}return Mo(r)?fc(r,t,n+1):r}function _o(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const hc=new Set(["width","height","top","left","right","bottom",...bn]),um={test:e=>e==="auto",parse:e=>e},mc=e=>t=>t.test(e),pc=[vn,oe,ct,Ct,th,eh,um],Zi=e=>pc.find(mc(e));function fm(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ll(e):!0}const hm=new Set(["brightness","contrast","saturate","opacity"]);function mm(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(No)||[];if(!s)return e;const r=n.replace(s,"");let i=hm.has(t)?1:0;return s!==n&&(i*=100),t+"("+i+r+")"}const pm=/\b([a-z-]*)\(.*?\)/gu,Zr={...At,getAnimatableNone:e=>{const t=e.match(pm);return t?t.map(mm).join(" "):e}},Wi={...vn,transform:Math.round},gm={rotate:Ct,rotateX:Ct,rotateY:Ct,rotateZ:Ct,scale:rs,scaleX:rs,scaleY:rs,scaleZ:rs,skew:Ct,skewX:Ct,skewY:Ct,distance:oe,translateX:oe,translateY:oe,translateZ:oe,x:oe,y:oe,z:oe,perspective:oe,transformPerspective:oe,opacity:Bn,originX:Vi,originY:Vi,originZ:oe},$o={borderWidth:oe,borderTopWidth:oe,borderRightWidth:oe,borderBottomWidth:oe,borderLeftWidth:oe,borderRadius:oe,radius:oe,borderTopLeftRadius:oe,borderTopRightRadius:oe,borderBottomRightRadius:oe,borderBottomLeftRadius:oe,width:oe,maxWidth:oe,height:oe,maxHeight:oe,top:oe,right:oe,bottom:oe,left:oe,padding:oe,paddingTop:oe,paddingRight:oe,paddingBottom:oe,paddingLeft:oe,margin:oe,marginTop:oe,marginRight:oe,marginBottom:oe,marginLeft:oe,backgroundPositionX:oe,backgroundPositionY:oe,...gm,zIndex:Wi,fillOpacity:Bn,strokeOpacity:Bn,numOctaves:Wi},xm={...$o,color:Pe,backgroundColor:Pe,outlineColor:Pe,fill:Pe,stroke:Pe,borderColor:Pe,borderTopColor:Pe,borderRightColor:Pe,borderBottomColor:Pe,borderLeftColor:Pe,filter:Zr,WebkitFilter:Zr},gc=e=>xm[e];function xc(e,t){let n=gc(e);return n!==Zr&&(n=At),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ym=new Set(["auto","none","0"]);function vm(e,t,n){let s=0,r;for(;s<e.length&&!r;){const i=e[s];typeof i=="string"&&!ym.has(i)&&Hn(i).values.length&&(r=e[s]),s++}if(r&&n)for(const i of t)e[i]=xc(n,r)}class bm extends Oo{constructor(t,n,s,r,i){super(t,n,s,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let d=t[l];if(typeof d=="string"&&(d=d.trim(),Mo(d))){const u=fc(d,n.current);u!==void 0&&(t[l]=u),l===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!hc.has(s)||t.length!==2)return;const[r,i]=t,o=Zi(r),a=Zi(i);if(o!==a)if(Bi(o)&&Bi(a))for(let l=0;l<t.length;l++){const d=t[l];typeof d=="string"&&(t[l]=parseFloat(d))}else $t[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let r=0;r<t.length;r++)(t[r]===null||fm(t[r]))&&s.push(r);s.length&&vm(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$t[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(s,r).jump(r,!1)}measureEndState(){var a;const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const i=s.length-1,o=s[i];s[i]=$t[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,d])=>{t.getValue(l).set(d)}),this.resolveNoneKeyframes()}}function wm(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const r=(n==null?void 0:n[e])??s.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}const yc=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function vc(e){return Dl(e)&&"offsetHeight"in e}const Ki=30,Sm=e=>!isNaN(parseFloat(e));class Cm{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var i;const r=He.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=He.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Sm(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&Ao(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new ko);const s=this.events[t].add(n);return t==="change"?()=>{s(),ye.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=He.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Ki)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Ki);return Fl(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mn(e,t){return new Cm(e,t)}const{schedule:Bo}=Yl(queueMicrotask,!1),Je={x:!1,y:!1};function bc(){return Je.x||Je.y}function Em(e){return e==="x"||e==="y"?Je[e]?null:(Je[e]=!0,()=>{Je[e]=!1}):Je.x||Je.y?null:(Je.x=Je.y=!0,()=>{Je.x=Je.y=!1})}function wc(e,t){const n=wm(e),s=new AbortController,r={passive:!0,...t,signal:s.signal};return[n,r,()=>s.abort()]}function Yi(e){return!(e.pointerType==="touch"||bc())}function km(e,t,n={}){const[s,r,i]=wc(e,n),o=a=>{if(!Yi(a))return;const{target:l}=a,d=t(l,a);if(typeof d!="function"||!l)return;const u=h=>{Yi(h)&&(d(h),l.removeEventListener("pointerleave",u))};l.addEventListener("pointerleave",u,r)};return s.forEach(a=>{a.addEventListener("pointerenter",o,r)}),i}const Sc=(e,t)=>t?e===t?!0:Sc(e,t.parentElement):!1,Ho=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Am=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Tm(e){return Am.has(e.tagName)||e.tabIndex!==-1}const xs=new WeakSet;function Gi(e){return t=>{t.key==="Enter"&&e(t)}}function ar(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const jm=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=Gi(()=>{if(xs.has(n))return;ar(n,"down");const r=Gi(()=>{ar(n,"up")}),i=()=>ar(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function Xi(e){return Ho(e)&&!bc()}function Pm(e,t,n={}){const[s,r,i]=wc(e,n),o=a=>{const l=a.currentTarget;if(!Xi(a))return;xs.add(l);const d=t(l,a),u=(g,x)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),xs.has(l)&&xs.delete(l),Xi(g)&&typeof d=="function"&&d(g,{success:x})},h=g=>{u(g,l===window||l===document||n.useGlobalTarget||Sc(l,g.target))},m=g=>{u(g,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",m,r)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),vc(a)&&(a.addEventListener("focus",d=>jm(d,r)),!Tm(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}function Cc(e){return Dl(e)&&"ownerSVGElement"in e}function Mm(e){return Cc(e)&&e.tagName==="svg"}const Le=e=>!!(e&&e.getVelocity),Nm=[...pc,Pe,At],Rm=e=>Nm.find(mc(e)),Uo=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Vm extends f.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=n.offsetParent,r=vc(s)&&s.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=r-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Im({children:e,isPresent:t,anchorX:n,root:s}){const r=E.useId(),i=E.useRef(null),o=E.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=E.useContext(Uo);return E.useInsertionEffect(()=>{const{width:l,height:d,top:u,left:h,right:m}=o.current;if(t||!i.current||!l||!d)return;const g=n==="left"?`left: ${h}`:`right: ${m}`;i.current.dataset.motionPopId=r;const x=document.createElement("style");a&&(x.nonce=a);const p=s??document.head;return p.appendChild(x),x.sheet&&x.sheet.insertRule(`
30
+ <%s key={someKey} {...props} />`,Nc,Oi,jw,Oi),ph[Oi+Nc]=!0}}return M===i?Mw(ot):Iw(ot),ot}}function _w(M,ne,le){return gh(M,ne,le,!0)}function Nw(M,ne,le){return gh(M,ne,le,!1)}var Ow=Nw,Dw=_w;ys.Fragment=i,ys.jsx=Ow,ys.jsxs=Dw}()),ys}var bh;function Hw(){return bh||(bh=1,process.env.NODE_ENV==="production"?So.exports=Bw():So.exports=$w()),So.exports}var m=Hw();function zw(t,e){return e.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(t)}var Ww=Object.defineProperty,qw=(t,e,n)=>e in t?Ww(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xh=(t,e,n)=>qw(t,typeof e!="symbol"?e+"":e,n);let Nt=class{constructor(){xh(this,"_locking"),xh(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const n=new Promise(r=>e=()=>{this._locks-=1,r()}),i=this._locking.then(()=>e);return this._locking=this._locking.then(()=>n),i}};function Xe(t,e){if(!t)throw new Error(e)}const Kw=34028234663852886e22,Gw=-34028234663852886e22,Zw=4294967295,Yw=2147483647,Jw=-2147483648;function qo(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>Yw||t<Jw)throw new Error("invalid int 32: "+t)}function Hl(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>Zw||t<0)throw new Error("invalid uint 32: "+t)}function M0(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>Kw||t<Gw))throw new Error("invalid float 32: "+t)}const _0=Symbol("@bufbuild/protobuf/enum-type");function Xw(t){const e=t[_0];return Xe(e,"missing enum type on enum object"),e}function N0(t,e,n,i){t[_0]=O0(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function O0(t,e,n){const i=Object.create(null),r=Object.create(null),s=[];for(const o of e){const a=D0(o);s.push(a),i[o.name]=a,r[o.no]=a}return{typeName:t,values:s,findName(o){return i[o]},findNumber(o){return r[o]}}}function Qw(t,e,n){const i={};for(const r of e){const s=D0(r);i[s.localName]=s.no,i[s.no]=s.localName}return N0(i,t,e),i}function D0(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Su{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const i=this.getType(),r=i.runtime.bin,s=r.makeReadOptions(n);return r.readMessage(this,s.readerFactory(e),e.byteLength,s),this}fromJson(e,n){const i=this.getType(),r=i.runtime.json,s=r.makeReadOptions(n);return r.readMessage(i,e,s,this),this}fromJsonString(e,n){let i;try{i=JSON.parse(e)}catch(r){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(r instanceof Error?r.message:String(r)))}return this.fromJson(i,n)}toBinary(e){const n=this.getType(),i=n.runtime.bin,r=i.makeWriteOptions(e),s=r.writerFactory();return i.writeMessage(this,s,r),s.finish()}toJson(e){const n=this.getType(),i=n.runtime.json,r=i.makeWriteOptions(e);return i.writeMessage(this,r)}toJsonString(e){var n;const i=this.toJson(e);return JSON.stringify(i,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function eC(t,e,n,i){var r;const s=(r=i==null?void 0:i.localName)!==null&&r!==void 0?r:e.substring(e.lastIndexOf(".")+1),o={[s]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[s];return Object.setPrototypeOf(o.prototype,new Su),Object.assign(o,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(a,c){return new o().fromBinary(a,c)},fromJson(a,c){return new o().fromJson(a,c)},fromJsonString(a,c){return new o().fromJsonString(a,c)},equals(a,c){return t.util.equals(o,a,c)}}),o}function tC(){let t=0,e=0;for(let i=0;i<28;i+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<i,(r&128)==0)return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,(n&128)==0)return this.assertBounds(),[t,e];for(let i=3;i<=31;i+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<i,(r&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Oc(t,e,n){for(let s=0;s<28;s=s+7){const o=t>>>s,a=!(!(o>>>7)&&e==0),c=(a?o|128:o)&255;if(n.push(c),!a)return}const i=t>>>28&15|(e&7)<<4,r=e>>3!=0;if(n.push((r?i|128:i)&255),!!r){for(let s=3;s<31;s=s+7){const o=e>>>s,a=!!(o>>>7),c=(a?o|128:o)&255;if(n.push(c),!a)return}n.push(e>>>31&1)}}const Ko=4294967296;function Sh(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let i=0,r=0;function s(o,a){const c=Number(t.slice(o,a));r*=n,i=i*n+c,i>=Ko&&(r=r+(i/Ko|0),i=i%Ko)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?L0(i,r):wu(i,r)}function nC(t,e){let n=wu(t,e);const i=n.hi&2147483648;i&&(n=L0(n.lo,n.hi));const r=j0(n.lo,n.hi);return i?"-"+r:r}function j0(t,e){if({lo:t,hi:e}=iC(t,e),e<=2097151)return String(Ko*e+t);const n=t&16777215,i=(t>>>24|e<<8)&16777215,r=e>>16&65535;let s=n+i*6777216+r*6710656,o=i+r*8147497,a=r*2;const c=1e7;return s>=c&&(o+=Math.floor(s/c),s%=c),o>=c&&(a+=Math.floor(o/c),o%=c),a.toString()+wh(o)+wh(s)}function iC(t,e){return{lo:t>>>0,hi:e>>>0}}function wu(t,e){return{lo:t|0,hi:e|0}}function L0(t,e){return e=~e,t?t=~t+1:e+=1,wu(t,e)}const wh=t=>{const e=String(t);return"0000000".slice(e.length)+e};function Ch(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function rC(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;(t&128)!==0&&n<10;n++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function sC(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const r=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(c){const l=typeof c=="bigint"?c:BigInt(c);if(l>s||l<r)throw new Error("int64 invalid: ".concat(c));return l},uParse(c){const l=typeof c=="bigint"?c:BigInt(c);if(l>a||l<o)throw new Error("uint64 invalid: ".concat(c));return l},enc(c){return t.setBigInt64(0,this.parse(c),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(c){return t.setBigInt64(0,this.uParse(c),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(c,l){return t.setInt32(0,c,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)},uDec(c,l){return t.setInt32(0,c,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0)}}}const n=r=>Xe(/^-?[0-9]+$/.test(r),"int64 invalid: ".concat(r)),i=r=>Xe(/^[0-9]+$/.test(r),"uint64 invalid: ".concat(r));return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),n(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),i(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),n(r),Sh(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),i(r),Sh(r)},dec(r,s){return nC(r,s)},uDec(r,s){return j0(r,s)}}}const ze=sC();var Y;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(Y||(Y={}));var hi;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(hi||(hi={}));function ni(t,e,n){if(e===n)return!0;if(t==Y.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}switch(t){case Y.UINT64:case Y.FIXED64:case Y.INT64:case Y.SFIXED64:case Y.SINT64:return e==n}return!1}function Wr(t,e){switch(t){case Y.BOOL:return!1;case Y.UINT64:case Y.FIXED64:case Y.INT64:case Y.SFIXED64:case Y.SINT64:return e==0?ze.zero:"0";case Y.DOUBLE:case Y.FLOAT:return 0;case Y.BYTES:return new Uint8Array(0);case Y.STRING:return"";default:return 0}}function V0(t,e){switch(t){case Y.BOOL:return e===!1;case Y.STRING:return e==="";case Y.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var rt;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(rt||(rt={}));class oC{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),i=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],i),i+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Hl(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return qo(e),Ch(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){M0(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){Hl(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){qo(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return qo(e),e=(e<<1^e>>31)>>>0,Ch(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),i=new DataView(n.buffer),r=ze.enc(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),i=new DataView(n.buffer),r=ze.uEnc(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=ze.enc(e);return Oc(n.lo,n.hi,this.buf),this}sint64(e){let n=ze.enc(e),i=n.hi>>31,r=n.lo<<1^i,s=(n.hi<<1|n.lo>>>31)^i;return Oc(r,s,this.buf),this}uint64(e){let n=ze.uEnc(e);return Oc(n.lo,n.hi,this.buf),this}}class aC{constructor(e,n){this.varint64=tC,this.uint32=rC,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,i=e&7;if(n<=0||i<0||i>5)throw new Error("illegal tag: field no "+n+" wire type "+i);return[n,i]}skip(e,n){let i=this.pos;switch(e){case rt.Varint:for(;this.buf[this.pos++]&128;);break;case rt.Bit64:this.pos+=4;case rt.Bit32:this.pos+=4;break;case rt.LengthDelimited:let r=this.uint32();this.pos+=r;break;case rt.StartGroup:for(;;){const[s,o]=this.tag();if(o===rt.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(o,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return ze.dec(...this.varint64())}uint64(){return ze.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),i=-(e&1);return e=(e>>>1|(n&1)<<31)^i,n=n>>>1^i,ze.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return ze.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return ze.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function cC(t,e,n,i){let r;return{typeName:e,extendee:n,get field(){if(!r){const s=typeof i=="function"?i():i;s.name=e.split(".").pop(),s.jsonName="[".concat(e,"]"),r=t.util.newFieldList([s]).list()[0]}return r},runtime:t}}function F0(t){const e=t.field.localName,n=Object.create(null);return n[e]=lC(t),[n,()=>n[e]]}function lC(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return Wr(e.T,e.L);case"message":const n=e.T,i=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}function dC(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.no)return[t[n]];return[]}return t.filter(n=>n.no===e.no)}let $n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),qa=[];for(let t=0;t<$n.length;t++)qa[$n[t].charCodeAt(0)]=t;qa[45]=$n.indexOf("+");qa[95]=$n.indexOf("/");const U0={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),i=0,r=0,s,o=0;for(let a=0;a<t.length;a++){if(s=qa[t.charCodeAt(a)],s===void 0)switch(t[a]){case"=":r=0;case`
31
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=s,r=1;break;case 1:n[i++]=o<<2|(s&48)>>4,o=s,r=2;break;case 2:n[i++]=(o&15)<<4|(s&60)>>2,o=s,r=3;break;case 3:n[i++]=(o&3)<<6|s,r=0;break}}if(r==1)throw Error("invalid base64 string.");return n.subarray(0,i)},enc(t){let e="",n=0,i,r=0;for(let s=0;s<t.length;s++)switch(i=t[s],n){case 0:e+=$n[i>>2],r=(i&3)<<4,n=1;break;case 1:e+=$n[r|i>>4],r=(i&15)<<2,n=2;break;case 2:e+=$n[r|i>>6],e+=$n[i&63],n=0;break}return n&&(e+=$n[r],e+="=",n==1&&(e+="=")),e}};function uC(t,e,n){$0(e,t);const i=e.runtime.bin.makeReadOptions(n),r=dC(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,o]=F0(e);for(const a of r)e.runtime.bin.readField(s,i.readerFactory(a.data),e.field,a.wireType,i);return o()}function fC(t,e,n,i){$0(e,t);const r=e.runtime.bin.makeReadOptions(i),s=e.runtime.bin.makeWriteOptions(i);if(B0(t,e)){const l=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of l)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const o=s.writerFactory();let a=e.field;!a.opt&&!a.repeated&&(a.kind=="enum"||a.kind=="scalar")&&(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,o,s);const c=r.readerFactory(o.finish());for(;c.pos<c.len;){const[l,d]=c.tag(),u=c.skip(d,l);t.getType().runtime.bin.onUnknownField(t,l,d,u)}}function B0(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(i=>i.no==e.field.no)}function $0(t,e){Xe(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function H0(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!V0(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function kh(t,e){const n=t.localName,i=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=i?t.T.values[0].no:void 0;break;case"scalar":e[n]=i?Wr(t.T,t.L):void 0;break;case"message":e[n]=void 0;break}}function Hn(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Su.prototype).every(i=>i in t&&typeof t[i]=="function"))return!1;const n=t.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:e===void 0?!0:n.typeName==e.typeName}function z0(t,e){return Hn(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}Y.DOUBLE,Y.FLOAT,Y.INT64,Y.UINT64,Y.INT32,Y.UINT32,Y.BOOL,Y.STRING,Y.BYTES;const Th={ignoreUnknownFields:!1},Eh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function hC(t){return t?Object.assign(Object.assign({},Th),t):Th}function mC(t){return t?Object.assign(Object.assign({},Eh),t):Eh}const xa=Symbol(),Go=Symbol();function pC(){return{makeReadOptions:hC,makeWriteOptions:mC,readMessage(t,e,n,i){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(xn(e)));i=i??new t;const r=new Map,s=n.typeRegistry;for(const[o,a]of Object.entries(e)){const c=t.fields.findJsonName(o);if(c){if(c.oneof){if(a===null&&c.kind=="scalar")continue;const l=r.get(c.oneof);if(l!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(c.oneof.name,'" present: "').concat(l,'", "').concat(o,'"'));r.set(c.oneof,o)}Ph(i,a,c,n,t)}else{let l=!1;if(s!=null&&s.findExtension&&o.startsWith("[")&&o.endsWith("]")){const d=s.findExtension(o.substring(1,o.length-1));if(d&&d.extendee.typeName==t.typeName){l=!0;const[u,f]=F0(d);Ph(u,a,d.field,n,d),fC(i,d,f(),n)}}if(!l&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return i},writeMessage(t,e){const n=t.getType(),i={};let r;try{for(r of n.fields.byNumber()){if(!H0(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!vC(r))continue}const o=r.oneof?t[r.oneof.localName].value:t[r.localName],a=Rh(r,o,e);a!==void 0&&(i[e.useProtoFieldName?r.name:r.jsonName]=a)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const o of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,o.no);if(a&&B0(t,a)){const c=uC(t,a,e),l=Rh(a.field,c,e);l!==void 0&&(i[a.field.jsonName]=l)}}}catch(s){const o=r?"cannot encode field ".concat(n.typeName,".").concat(r.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),a=s instanceof Error?s.message:String(s);throw new Error(o+(a.length>0?": ".concat(a):""))}return i},readScalar(t,e,n){return Ds(t,e,n??hi.BIGINT,!0)},writeScalar(t,e,n){if(e!==void 0&&(n||V0(t,e)))return Zo(t,e)},debug:xn}}function xn(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function Ph(t,e,n,i,r){let s=n.localName;if(n.repeated){if(Xe(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(e)));const o=t[s];for(const a of e){if(a===null)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(a)));switch(n.kind){case"message":o.push(n.T.fromJson(a,i));break;case"enum":const c=Dc(n.T,a,i.ignoreUnknownFields,!0);c!==Go&&o.push(c);break;case"scalar":try{o.push(Ds(n.T,a,n.L,!0))}catch(l){let d="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(a));throw l instanceof Error&&l.message.length>0&&(d+=": ".concat(l.message)),new Error(d)}break}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(e)));const o=t[s];for(const[a,c]of Object.entries(e)){if(c===null)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: map value null"));let l;try{l=gC(n.K,a)}catch(d){let u="cannot decode map key for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(e));throw d instanceof Error&&d.message.length>0&&(u+=": ".concat(d.message)),new Error(u)}switch(n.V.kind){case"message":o[l]=n.V.T.fromJson(c,i);break;case"enum":const d=Dc(n.V.T,c,i.ignoreUnknownFields,!0);d!==Go&&(o[l]=d);break;case"scalar":try{o[l]=Ds(n.V.T,c,hi.BIGINT,!0)}catch(u){let f="cannot decode map value for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(e));throw u instanceof Error&&u.message.length>0&&(f+=": ".concat(u.message)),new Error(f)}break}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const o=n.T;if(e===null&&o.typeName!="google.protobuf.Value")return;let a=t[s];Hn(a)?a.fromJson(e,i):(t[s]=a=o.fromJson(e,i),o.fieldWrapper&&!n.oneof&&(t[s]=o.fieldWrapper.unwrapField(a)));break;case"enum":const c=Dc(n.T,e,i.ignoreUnknownFields,!1);switch(c){case xa:kh(n,t);break;case Go:break;default:t[s]=c;break}break;case"scalar":try{const l=Ds(n.T,e,n.L,!1);switch(l){case xa:kh(n,t);break;default:t[s]=l;break}}catch(l){let d="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(xn(e));throw l instanceof Error&&l.message.length>0&&(d+=": ".concat(l.message)),new Error(d)}break}}function gC(t,e){if(t===Y.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return Ds(t,e,hi.BIGINT,!0).toString()}function Ds(t,e,n,i){if(e===null)return i?Wr(t,n):xa;switch(t){case Y.DOUBLE:case Y.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==Y.FLOAT&&M0(r),r;case Y.INT32:case Y.FIXED32:case Y.SFIXED32:case Y.SINT32:case Y.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==Y.UINT32||t==Y.FIXED32?Hl(s):qo(s),s;case Y.INT64:case Y.SFIXED64:case Y.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=ze.parse(e);return n?o.toString():o;case Y.FIXED64:case Y.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=ze.uParse(e);return n?a.toString():a;case Y.BOOL:if(typeof e!="boolean")break;return e;case Y.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case Y.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return U0.dec(e)}throw new Error}function Dc(t,e,n,i){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:i?t.values[0].no:xa;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Go;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(xn(e)))}function vC(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function Rh(t,e,n){if(t.kind=="map"){Xe(typeof e=="object"&&e!=null);const i={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[o,a]of r)i[o.toString()]=Zo(t.V.T,a);break;case"message":for(const[o,a]of r)i[o.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[o,a]of r)i[o.toString()]=jc(s,a,n.enumAsInteger);break}return n.emitDefaultValues||r.length>0?i:void 0}if(t.repeated){Xe(Array.isArray(e));const i=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)i.push(Zo(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)i.push(jc(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)i.push(e[r].toJson(n));break}return n.emitDefaultValues||i.length>0?i:void 0}switch(t.kind){case"scalar":return Zo(t.T,e);case"enum":return jc(t.T,e,n.enumAsInteger);case"message":return z0(t.T,e).toJson(n)}}function jc(t,e,n){var i;if(Xe(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(i=r==null?void 0:r.name)!==null&&i!==void 0?i:e}function Zo(t,e){switch(t){case Y.INT32:case Y.SFIXED32:case Y.SINT32:case Y.FIXED32:case Y.UINT32:return Xe(typeof e=="number"),e;case Y.FLOAT:case Y.DOUBLE:return Xe(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case Y.STRING:return Xe(typeof e=="string"),e;case Y.BOOL:return Xe(typeof e=="boolean"),e;case Y.UINT64:case Y.FIXED64:case Y.INT64:case Y.SFIXED64:case Y.SINT64:return Xe(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case Y.BYTES:return Xe(e instanceof Uint8Array),U0.enc(e)}}const lr=Symbol("@bufbuild/protobuf/unknown-fields"),Ah={readUnknownFields:!0,readerFactory:t=>new aC(t)},Ih={writeUnknownFields:!0,writerFactory:()=>new oC};function yC(t){return t?Object.assign(Object.assign({},Ah),t):Ah}function bC(t){return t?Object.assign(Object.assign({},Ih),t):Ih}function xC(){return{makeReadOptions:yC,makeWriteOptions:bC,listUnknownFields(t){var e;return(e=t[lr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[lr]},writeUnknownFields(t,e){const i=t[lr];if(i)for(const r of i)e.tag(r.no,r.wireType).raw(r.data)},onUnknownField(t,e,n,i){const r=t;Array.isArray(r[lr])||(r[lr]=[]),r[lr].push({no:e,wireType:n,data:i})},readMessage(t,e,n,i,r){const s=t.getType(),o=r?e.len:e.pos+n;let a,c;for(;e.pos<o&&([a,c]=e.tag(),!(r===!0&&c==rt.EndGroup));){const l=s.fields.find(a);if(!l){const d=e.skip(c,a);i.readUnknownFields&&this.onUnknownField(t,a,c,d);continue}Mh(t,e,l,c,i)}if(r&&(c!=rt.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:Mh,writeMessage(t,e,n){const i=t.getType();for(const r of i.fields.byNumber()){if(!H0(r,t)){if(r.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(r.name," to binary: required field not set"));continue}const s=r.oneof?t[r.oneof.localName].value:t[r.localName];_h(r,s,e,n)}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,i){e!==void 0&&_h(t,e,n,i)}}}function Mh(t,e,n,i,r){let{repeated:s,localName:o}=n;switch(n.oneof&&(t=t[n.oneof.localName],t.case!=o&&delete t.value,t.case=o,o="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?Y.INT32:n.T;let c=Sa;if(n.kind=="scalar"&&n.L>0&&(c=wC),s){let f=t[o];if(i==rt.LengthDelimited&&a!=Y.STRING&&a!=Y.BYTES){let g=e.uint32()+e.pos;for(;e.pos<g;)f.push(c(e,a))}else f.push(c(e,a))}else t[o]=c(e,a);break;case"message":const l=n.T;s?t[o].push(Yo(e,new l,r,n)):Hn(t[o])?Yo(e,t[o],r,n):(t[o]=Yo(e,new l,r,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(t[o]=l.fieldWrapper.unwrapField(t[o])));break;case"map":let[d,u]=SC(n,e,r);t[o][d]=u;break}}function Yo(t,e,n,i){const r=e.getType().runtime.bin,s=i==null?void 0:i.delimited;return r.readMessage(e,t,s?i.no:t.uint32(),n,s),e}function SC(t,e,n){const i=e.uint32(),r=e.pos+i;let s,o;for(;e.pos<r;){const[a]=e.tag();switch(a){case 1:s=Sa(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=Sa(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=Yo(e,new t.V.T,n,void 0);break}break}}if(s===void 0&&(s=Wr(t.K,hi.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),o===void 0)switch(t.V.kind){case"scalar":o=Wr(t.V.T,hi.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[s,o]}function wC(t,e){const n=Sa(t,e);return typeof n=="bigint"?n.toString():n}function Sa(t,e){switch(e){case Y.STRING:return t.string();case Y.BOOL:return t.bool();case Y.DOUBLE:return t.double();case Y.FLOAT:return t.float();case Y.INT32:return t.int32();case Y.INT64:return t.int64();case Y.UINT64:return t.uint64();case Y.FIXED64:return t.fixed64();case Y.BYTES:return t.bytes();case Y.FIXED32:return t.fixed32();case Y.SFIXED32:return t.sfixed32();case Y.SFIXED64:return t.sfixed64();case Y.SINT64:return t.sint64();case Y.UINT32:return t.uint32();case Y.SINT32:return t.sint32()}}function _h(t,e,n,i){Xe(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?Y.INT32:t.T;if(r)if(Xe(Array.isArray(e)),t.packed)kC(n,s,t.no,e);else for(const o of e)js(n,s,t.no,o);else js(n,s,t.no,e);break;case"message":if(r){Xe(Array.isArray(e));for(const o of e)Nh(n,i,t,o)}else Nh(n,i,t,e);break;case"map":Xe(typeof e=="object"&&e!=null);for(const[o,a]of Object.entries(e))CC(n,i,t,o,a);break}}function CC(t,e,n,i,r){t.tag(n.no,rt.LengthDelimited),t.fork();let s=i;switch(n.K){case Y.INT32:case Y.FIXED32:case Y.UINT32:case Y.SFIXED32:case Y.SINT32:s=Number.parseInt(i);break;case Y.BOOL:Xe(i=="true"||i=="false"),s=i=="true";break}switch(js(t,n.K,1,s),n.V.kind){case"scalar":js(t,n.V.T,2,r);break;case"enum":js(t,Y.INT32,2,r);break;case"message":Xe(r!==void 0),t.tag(2,rt.LengthDelimited).bytes(r.toBinary(e));break}t.join()}function Nh(t,e,n,i){const r=z0(n.T,i);n.delimited?t.tag(n.no,rt.StartGroup).raw(r.toBinary(e)).tag(n.no,rt.EndGroup):t.tag(n.no,rt.LengthDelimited).bytes(r.toBinary(e))}function js(t,e,n,i){Xe(i!==void 0);let[r,s]=W0(e);t.tag(n,r)[s](i)}function kC(t,e,n,i){if(!i.length)return;t.tag(n,rt.LengthDelimited).fork();let[,r]=W0(e);for(let s=0;s<i.length;s++)t[r](i[s]);t.join()}function W0(t){let e=rt.Varint;switch(t){case Y.BYTES:case Y.STRING:e=rt.LengthDelimited;break;case Y.DOUBLE:case Y.FIXED64:case Y.SFIXED64:e=rt.Bit64;break;case Y.FIXED32:case Y.SFIXED32:case Y.FLOAT:e=rt.Bit32;break}const n=Y[t].toLowerCase();return[e,n]}function TC(){return{setEnumType:N0,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const i of n.fields.byMember()){const r=i.localName,s=e,o=t;if(o[r]!=null)switch(i.kind){case"oneof":const a=o[r].case;if(a===void 0)continue;const c=i.findField(a);let l=o[r].value;c&&c.kind=="message"&&!Hn(l,c.T)?l=new c.T(l):c&&c.kind==="scalar"&&c.T===Y.BYTES&&(l=bs(l)),s[r]={case:a,value:l};break;case"scalar":case"enum":let d=o[r];i.T===Y.BYTES&&(d=i.repeated?d.map(bs):bs(d)),s[r]=d;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===Y.BYTES)for(const[p,g]of Object.entries(o[r]))s[r][p]=bs(g);else Object.assign(s[r],o[r]);break;case"message":const f=i.V.T;for(const p of Object.keys(o[r])){let g=o[r][p];f.fieldWrapper||(g=new f(g)),s[r][p]=g}break}break;case"message":const u=i.T;if(i.repeated)s[r]=o[r].map(f=>Hn(f,u)?f:new u(f));else{const f=o[r];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?s[r]=bs(f):s[r]=f:s[r]=Hn(f,u)?f:new u(f)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(i=>{const r=e[i.localName],s=n[i.localName];if(i.repeated){if(r.length!==s.length)return!1;switch(i.kind){case"message":return r.every((o,a)=>i.T.equals(o,s[a]));case"scalar":return r.every((o,a)=>ni(i.T,o,s[a]));case"enum":return r.every((o,a)=>ni(Y.INT32,o,s[a]))}throw new Error("repeated cannot contain ".concat(i.kind))}switch(i.kind){case"message":let o=r,a=s;return i.T.fieldWrapper&&(o!==void 0&&!Hn(o)&&(o=i.T.fieldWrapper.wrapField(o)),a!==void 0&&!Hn(a)&&(a=i.T.fieldWrapper.wrapField(a))),i.T.equals(o,a);case"enum":return ni(Y.INT32,r,s);case"scalar":return ni(i.T,r,s);case"oneof":if(r.case!==s.case)return!1;const c=i.findField(r.case);if(c===void 0)return!0;switch(c.kind){case"message":return c.T.equals(r.value,s.value);case"enum":return ni(Y.INT32,r.value,s.value);case"scalar":return ni(c.T,r.value,s.value)}throw new Error("oneof cannot contain ".concat(c.kind));case"map":const l=Object.keys(r).concat(Object.keys(s));switch(i.V.kind){case"message":const d=i.V.T;return l.every(f=>d.equals(r[f],s[f]));case"enum":return l.every(f=>ni(Y.INT32,r[f],s[f]));case"scalar":const u=i.V.T;return l.every(f=>ni(u,r[f],s[f]))}break}})},clone(t){const e=t.getType(),n=new e,i=n;for(const r of e.fields.byMember()){const s=t[r.localName];let o;if(r.repeated)o=s.map(wo);else if(r.kind=="map"){o=i[r.localName];for(const[a,c]of Object.entries(s))o[a]=wo(c)}else r.kind=="oneof"?o=r.findField(s.case)?{case:s.case,value:wo(s.value)}:{case:void 0}:o=wo(s);i[r.localName]=o}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(i,r.no,r.wireType,r.data);return n}}}function wo(t){if(t===void 0)return t;if(Hn(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function bs(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function EC(t,e,n){return{syntax:t,json:pC(),bin:xC(),util:Object.assign(Object.assign({},TC()),{newFieldList:e,initFields:n}),makeMessageType(i,r,s){return eC(this,i,r,s)},makeEnum:Qw,makeEnumType:O0,getEnumType:Xw,makeExtension(i,r,s){return cC(this,i,r,s)}}}class PC{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const i of this.list())n[i.jsonName]=n[i.name]=i;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const i of this.list())n[i.no]=i;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const i of this.list())i.oneof?i.oneof!==n&&(n=i.oneof,e.push(n)):e.push(i)}return this.members}}function q0(t,e){const n=K0(t);return e?n:NC(_C(n))}function RC(t){return q0(t,!1)}const AC=K0;function K0(t){let e=!1;const n=[];for(let i=0;i<t.length;i++){let r=t.charAt(i);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r);break}}return n.join("")}const IC=new Set(["constructor","toString","toJSON","valueOf"]),MC=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),G0=t=>"".concat(t,"$"),_C=t=>MC.has(t)?G0(t):t,NC=t=>IC.has(t)?G0(t):t;class OC{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=RC(e)}addField(e){Xe(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}function DC(t,e){var n,i,r,s,o,a;const c=[];let l;for(const d of typeof t=="function"?t():t){const u=d;if(u.localName=q0(d.name,d.oneof!==void 0),u.jsonName=(n=d.jsonName)!==null&&n!==void 0?n:AC(d.name),u.repeated=(i=d.repeated)!==null&&i!==void 0?i:!1,d.kind=="scalar"&&(u.L=(r=d.L)!==null&&r!==void 0?r:hi.BIGINT),u.delimited=(s=d.delimited)!==null&&s!==void 0?s:!1,u.req=(o=d.req)!==null&&o!==void 0?o:!1,u.opt=(a=d.opt)!==null&&a!==void 0?a:!1,d.packed===void 0&&(u.packed=d.kind=="enum"||d.kind=="scalar"&&d.T!=Y.BYTES&&d.T!=Y.STRING),d.oneof!==void 0){const f=typeof d.oneof=="string"?d.oneof:d.oneof.name;(!l||l.name!=f)&&(l=new OC(f)),u.oneof=l,l.addField(u)}c.push(u)}return c}const B=EC("proto3",t=>new PC(t,e=>DC(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,i=t;if(e.repeated){i[n]=[];continue}switch(e.kind){case"oneof":i[n]={case:void 0};break;case"enum":i[n]=0;break;case"map":i[n]={};break;case"scalar":i[n]=Wr(e.T,e.L);break}}});class _t extends Su{constructor(e){super(),this.seconds=ze.zero,this.nanos=0,B.util.initPartial(e,this)}fromJson(e,n){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(B.json.debug(e)));const i=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const r=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(r))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=ze.parse(r/1e3),this.nanos=0,i[7]&&(this.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),this}toJson(e){const n=Number(this.seconds)*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let i="Z";if(this.nanos>0){const r=(this.nanos+1e9).toString().substring(1);r.substring(3)==="000000"?i="."+r.substring(0,3)+"Z":r.substring(6)==="000"?i="."+r.substring(0,6)+"Z":i="."+r+"Z"}return new Date(n).toISOString().replace(".000Z",i)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return _t.fromDate(new Date)}static fromDate(e){const n=e.getTime();return new _t({seconds:ze.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(e,n){return new _t().fromBinary(e,n)}static fromJson(e,n){return new _t().fromJson(e,n)}static fromJsonString(e,n){return new _t().fromJsonString(e,n)}static equals(e,n){return B.util.equals(_t,e,n)}}_t.runtime=B;_t.typeName="google.protobuf.Timestamp";_t.fields=B.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const jC=B.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:_t},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:LC,repeated:!0},{no:5,name:"events",kind:"message",T:FC,repeated:!0}]),LC=B.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:VC,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),VC=B.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:_t},{no:3,name:"value",kind:"scalar",T:2}]),FC=B.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:_t},{no:7,name:"normalized_end_timestamp",kind:"message",T:_t,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),Z0=B.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),cn=B.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),lt=B.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Cu=B.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),As=B.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Hs=B.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),dn=B.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"}]),dr=B.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),UC=B.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),pt=B.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),Ka=B.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:wa,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:cv}]),wa=B.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),BC=B.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:B.getEnumType(lt),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),Zi=B.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:B.getEnumType(_r)},{no:4,name:"tracks",kind:"message",T:Cr,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:BC},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:B.getEnumType(Yi)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:B.getEnumType(dn)},{no:18,name:"kind_details",kind:"enum",T:B.getEnumType($C),repeated:!0}]),_r=B.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Yi=B.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),$C=B.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),Ft=B.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),HC=B.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Hi,repeated:!0}]),Cr=B.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:B.getEnumType(cn)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:B.getEnumType(lt)},{no:10,name:"layers",kind:"message",T:Hi,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:HC,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:B.getEnumType(Ft)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:cv},{no:19,name:"audio_features",kind:"enum",T:B.getEnumType(pt),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:B.getEnumType(Z0)}]),Hi=B.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:B.getEnumType(Cu)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),Mt=B.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:B.getEnumType(be)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:J0,oneof:"value"},{no:3,name:"speaker",kind:"message",T:zC,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:X0,oneof:"value"},{no:7,name:"transcription",kind:"message",T:WC,oneof:"value"},{no:8,name:"metrics",kind:"message",T:jC,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:zl,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:Q0,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:ev,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:tv,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:ql,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Kl,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Gl,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),be=B.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),zC=B.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:Y0,repeated:!0}]),Y0=B.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),J0=B.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),X0=B.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),WC=B.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:qC,repeated:!0}]),qC=B.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),zl=B.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),Q0=B.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),ev=B.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),tv=B.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:nv,oneof:"value"}]),nv=B.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),iv=B.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),rv=B.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:B.getEnumType(sv)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),sv=B.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),KC=B.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:B.getEnumType(ov)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),ov=B.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"}]),av=B.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:Oh},{no:2,name:"screen",kind:"message",T:Oh},{no:3,name:"resume_connection",kind:"enum",T:B.getEnumType(Hs)},{no:4,name:"disabled_codecs",kind:"message",T:GC},{no:5,name:"force_relay",kind:"enum",T:B.getEnumType(Hs)}]),Oh=B.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:B.getEnumType(Hs)}]),GC=B.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:wa,repeated:!0},{no:2,name:"publish",kind:"message",T:wa,repeated:!0}]),cv=B.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),Wl=B.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),lv=B.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:B.getEnumType(Wl)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),dv=B.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),ql=B.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:B.getEnumType(Ft)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:lv,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:dv,oneof:"content_header"}],{localName:"DataStream_Header"}),Kl=B.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Gl=B.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),ln=B.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Zl=B.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),ZC=B.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),YC=B.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:Ji,oneof:"message"},{no:2,name:"answer",kind:"message",T:Ji,oneof:"message"},{no:3,name:"trickle",kind:"message",T:ku,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Jl,oneof:"message"},{no:5,name:"mute",kind:"message",T:Tu,oneof:"message"},{no:6,name:"subscription",kind:"message",T:Ga,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:uv,oneof:"message"},{no:8,name:"leave",kind:"message",T:Za,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:hv,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:vv,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:yv,oneof:"message"},{no:13,name:"simulate",kind:"message",T:bn,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:mv,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Sv,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:fv,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:tk,oneof:"message"}]),Dh=B.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:JC,oneof:"message"},{no:2,name:"answer",kind:"message",T:Ji,oneof:"message"},{no:3,name:"offer",kind:"message",T:Ji,oneof:"message"},{no:4,name:"trickle",kind:"message",T:ku,oneof:"message"},{no:5,name:"update",kind:"message",T:ek,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Eu,oneof:"message"},{no:8,name:"leave",kind:"message",T:Za,oneof:"message"},{no:9,name:"mute",kind:"message",T:Tu,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:nk,oneof:"message"},{no:11,name:"room_update",kind:"message",T:ik,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:sk,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:ak,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:lk,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:dk,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:QC,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:XC,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:fk,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:pk,oneof:"message"},{no:22,name:"request_response",kind:"message",T:gk,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:vk,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:uk,oneof:"message"}]),Yl=B.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),Jl=B.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:B.getEnumType(cn)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:B.getEnumType(lt)},{no:9,name:"layers",kind:"message",T:Hi,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Yl,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:B.getEnumType(Ft)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:B.getEnumType(Z0)},{no:17,name:"audio_features",kind:"enum",T:B.getEnumType(pt),repeated:!0}]),ku=B.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:B.getEnumType(ln)},{no:3,name:"final",kind:"scalar",T:8}]),Tu=B.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),JC=B.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:Ka},{no:2,name:"participant",kind:"message",T:Zi},{no:3,name:"other_participants",kind:"message",T:Zi,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:pv,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:av},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:rv},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:wa,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),XC=B.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:pv,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:av},{no:3,name:"server_info",kind:"message",T:rv},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),Eu=B.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Cr}]),QC=B.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Ji=B.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13}]),ek=B.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:Zi,repeated:!0}]),Ga=B.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:iv,repeated:!0}]),uv=B.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:B.getEnumType(Cu)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),fv=B.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:B.getEnumType(pt),repeated:!0}]),tk=B.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),Za=B.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:B.getEnumType(dn)},{no:3,name:"action",kind:"enum",T:B.getEnumType(Nr)},{no:4,name:"regions",kind:"message",T:hk}]),Nr=B.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),hv=B.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Hi,repeated:!0}]),mv=B.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),pv=B.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),nk=B.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:Y0,repeated:!0}]),ik=B.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:Ka}]),rk=B.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:B.getEnumType(As)},{no:3,name:"score",kind:"scalar",T:2}]),sk=B.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:rk,repeated:!0}]),ok=B.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:B.getEnumType(Zl)}]),ak=B.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:ok,repeated:!0}]),Pu=B.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:B.getEnumType(Cu)},{no:2,name:"enabled",kind:"scalar",T:8}]),ck=B.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Pu,repeated:!0}]),lk=B.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Pu,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:ck,repeated:!0}]),gv=B.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),vv=B.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:gv,repeated:!0}]),dk=B.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),uk=B.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:Ka},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:Zi},{no:4,name:"other_participants",kind:"message",T:Zi,repeated:!0}]),yv=B.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:Ji},{no:2,name:"subscription",kind:"message",T:Ga},{no:3,name:"publish_tracks",kind:"message",T:Eu,repeated:!0},{no:4,name:"data_channels",kind:"message",T:xv,repeated:!0},{no:5,name:"offer",kind:"message",T:Ji},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:bv,repeated:!0}]),bv=B.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),xv=B.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:B.getEnumType(ln)}]),bn=B.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:B.getEnumType(ZC),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),Sv=B.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),fk=B.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),hk=B.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:mk,repeated:!0}]),mk=B.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),pk=B.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:B.getEnumType(UC)}]),gk=B.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:B.getEnumType(Ru)},{no:3,name:"message",kind:"scalar",T:9}]),Ru=B.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),vk=B.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function yk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jo={exports:{}},bk=Jo.exports,jh;function xk(){return jh||(jh=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(bk,function(){var e=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(h,y){var b=h[y];if(typeof b.bind=="function")return b.bind(h);try{return Function.prototype.bind.call(b,h)}catch{return function(){return Function.prototype.apply.apply(b,[h,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(h){return h==="debug"&&(h="log"),typeof console===n?!1:h==="trace"&&i?c:console[h]!==void 0?a(console,h):console.log!==void 0?a(console,"log"):e}function d(){for(var h=this.getLevel(),y=0;y<r.length;y++){var b=r[y];this[b]=y<h?e:this.methodFactory(b,h,this.name)}if(this.log=this.debug,typeof console===n&&h<this.levels.SILENT)return"No console available for logging"}function u(h){return function(){typeof console!==n&&(d.call(this),this[h].apply(this,arguments))}}function f(h,y,b){return l(h)||u.apply(this,arguments)}function p(h,y){var b=this,w,C,S,x="loglevel";typeof h=="string"?x+=":"+h:typeof h=="symbol"&&(x=void 0);function T(I){var N=(r[I]||"silent").toUpperCase();if(!(typeof window===n||!x)){try{window.localStorage[x]=N;return}catch{}try{window.document.cookie=encodeURIComponent(x)+"="+N+";"}catch{}}}function E(){var I;if(!(typeof window===n||!x)){try{I=window.localStorage[x]}catch{}if(typeof I===n)try{var N=window.document.cookie,K=encodeURIComponent(x),J=N.indexOf(K+"=");J!==-1&&(I=/^([^;]+)/.exec(N.slice(J+K.length+1))[1])}catch{}return b.levels[I]===void 0&&(I=void 0),I}}function P(){if(!(typeof window===n||!x)){try{window.localStorage.removeItem(x)}catch{}try{window.document.cookie=encodeURIComponent(x)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function _(I){var N=I;if(typeof N=="string"&&b.levels[N.toUpperCase()]!==void 0&&(N=b.levels[N.toUpperCase()]),typeof N=="number"&&N>=0&&N<=b.levels.SILENT)return N;throw new TypeError("log.setLevel() called with invalid level: "+I)}b.name=h,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=y||f,b.getLevel=function(){return S??C??w},b.setLevel=function(I,N){return S=_(I),N!==!1&&T(S),d.call(b)},b.setDefaultLevel=function(I){C=_(I),E()||b.setLevel(I,!1)},b.resetLevel=function(){S=null,P(),d.call(b)},b.enableAll=function(I){b.setLevel(b.levels.TRACE,I)},b.disableAll=function(I){b.setLevel(b.levels.SILENT,I)},b.rebuild=function(){if(o!==b&&(w=_(o.getLevel())),d.call(b),o===b)for(var I in s)s[I].rebuild()},w=_(o?o.getLevel():"WARN");var k=E();k!=null&&(S=_(k)),d.call(b)}o=new p,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var b=s[y];return b||(b=s[y]=new p(y,o.methodFactory)),b};var g=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=g),o},o.getLoggers=function(){return s},o.default=o,o})}(Jo)),Jo.exports}var Ya=xk(),Xl;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(Xl||(Xl={}));var fn;(function(t){t.Default="livekit",t.Room="livekit-room",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(fn||(fn={}));let Ce=Ya.getLogger("livekit");const Sk=Object.values(fn).map(t=>Ya.getLogger(t));Ce.setDefaultLevel(Xl.info);function Gn(t){const e=Ya.getLogger(t);return e.setDefaultLevel(Ce.getLevel()),e}function wk(t,e){for(const n of Sk)n.setLevel(t)}const Ck=Ya.getLogger("lk-e2ee"),xs=7e3,kk=[0,300,4*300,9*300,16*300,xs,xs,xs,xs,xs];class Tk{constructor(e){this._retryDelays=e!==void 0?[...e]:kk}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const n=this._retryDelays[e.retryCount];return e.retryCount<=1?n:n+Math.random()*1e3}}function Ek(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function A(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{l(i.next(d))}catch(u){o(u)}}function c(d){try{l(i.throw(d))}catch(u){o(u)}}function l(d){d.done?s(d.value):r(d.value).then(a,c)}l((i=i.apply(t,e||[])).next())})}function Lh(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function zn(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Lh=="function"?Lh(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),r(a,c,o.done,o.value)})}}function r(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var Co={exports:{}},Vh;function Pk(){if(Vh)return Co.exports;Vh=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(x,T,E){return Function.prototype.apply.call(x,T,E)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:n=function(x){return Object.getOwnPropertyNames(x)};function i(S){console&&console.warn&&console.warn(S)}var r=Number.isNaN||function(x){return x!==x};function s(){s.init.call(this)}Co.exports=s,Co.exports.once=b,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(S){if(typeof S!="number"||S<0||r(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");o=S}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||r(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function c(S){return S._maxListeners===void 0?s.defaultMaxListeners:S._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(x){for(var T=[],E=1;E<arguments.length;E++)T.push(arguments[E]);var P=x==="error",_=this._events;if(_!==void 0)P=P&&_.error===void 0;else if(!P)return!1;if(P){var k;if(T.length>0&&(k=T[0]),k instanceof Error)throw k;var I=new Error("Unhandled error."+(k?" ("+k.message+")":""));throw I.context=k,I}var N=_[x];if(N===void 0)return!1;if(typeof N=="function")e(N,this,T);else for(var K=N.length,J=g(N,K),E=0;E<K;++E)e(J[E],this,T);return!0};function l(S,x,T,E){var P,_,k;if(a(T),_=S._events,_===void 0?(_=S._events=Object.create(null),S._eventsCount=0):(_.newListener!==void 0&&(S.emit("newListener",x,T.listener?T.listener:T),_=S._events),k=_[x]),k===void 0)k=_[x]=T,++S._eventsCount;else if(typeof k=="function"?k=_[x]=E?[T,k]:[k,T]:E?k.unshift(T):k.push(T),P=c(S),P>0&&k.length>P&&!k.warned){k.warned=!0;var I=new Error("Possible EventEmitter memory leak detected. "+k.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");I.name="MaxListenersExceededWarning",I.emitter=S,I.type=x,I.count=k.length,i(I)}return S}s.prototype.addListener=function(x,T){return l(this,x,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(x,T){return l(this,x,T,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(S,x,T){var E={fired:!1,wrapFn:void 0,target:S,type:x,listener:T},P=d.bind(E);return P.listener=T,E.wrapFn=P,P}s.prototype.once=function(x,T){return a(T),this.on(x,u(this,x,T)),this},s.prototype.prependOnceListener=function(x,T){return a(T),this.prependListener(x,u(this,x,T)),this},s.prototype.removeListener=function(x,T){var E,P,_,k,I;if(a(T),P=this._events,P===void 0)return this;if(E=P[x],E===void 0)return this;if(E===T||E.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete P[x],P.removeListener&&this.emit("removeListener",x,E.listener||T));else if(typeof E!="function"){for(_=-1,k=E.length-1;k>=0;k--)if(E[k]===T||E[k].listener===T){I=E[k].listener,_=k;break}if(_<0)return this;_===0?E.shift():h(E,_),E.length===1&&(P[x]=E[0]),P.removeListener!==void 0&&this.emit("removeListener",x,I||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(x){var T,E,P;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[x]),this;if(arguments.length===0){var _=Object.keys(E),k;for(P=0;P<_.length;++P)k=_[P],k!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=E[x],typeof T=="function")this.removeListener(x,T);else if(T!==void 0)for(P=T.length-1;P>=0;P--)this.removeListener(x,T[P]);return this};function f(S,x,T){var E=S._events;if(E===void 0)return[];var P=E[x];return P===void 0?[]:typeof P=="function"?T?[P.listener||P]:[P]:T?y(P):g(P,P.length)}s.prototype.listeners=function(x){return f(this,x,!0)},s.prototype.rawListeners=function(x){return f(this,x,!1)},s.listenerCount=function(S,x){return typeof S.listenerCount=="function"?S.listenerCount(x):p.call(S,x)},s.prototype.listenerCount=p;function p(S){var x=this._events;if(x!==void 0){var T=x[S];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function g(S,x){for(var T=new Array(x),E=0;E<x;++E)T[E]=S[E];return T}function h(S,x){for(;x+1<S.length;x++)S[x]=S[x+1];S.pop()}function y(S){for(var x=new Array(S.length),T=0;T<x.length;++T)x[T]=S[T].listener||S[T];return x}function b(S,x){return new Promise(function(T,E){function P(k){S.removeListener(x,_),E(k)}function _(){typeof S.removeListener=="function"&&S.removeListener("error",P),T([].slice.call(arguments))}C(S,x,_,{once:!0}),x!=="error"&&w(S,P,{once:!0})})}function w(S,x,T){typeof S.on=="function"&&C(S,"error",x,T)}function C(S,x,T,E){if(typeof S.on=="function")E.once?S.once(x,T):S.on(x,T);else if(typeof S.addEventListener=="function")S.addEventListener(x,function P(_){E.once&&S.removeEventListener(x,P),T(_)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}return Co.exports}var Nn=Pk();let wv=!0,Cv=!0;function Is(t,e,n){const i=t.match(e);return i&&i.length>=n&&parseFloat(i[n],10)}function rr(t,e,n){if(!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(o,a){if(o!==e)return r.apply(this,arguments);const c=l=>{const d=n(l);d&&(a.handleEvent?a.handleEvent(d):a(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),r.apply(this,[o,c])};const s=i.removeEventListener;i.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);const c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Rk(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(wv=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Ak(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(Cv=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function kv(){if(typeof window=="object"){if(wv)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Au(t,e){Cv&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Ik(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.userAgentData&&n.userAgentData.brands){const i=n.userAgentData.brands.find(r=>r.brand==="Chromium");if(i)return{browser:"chrome",version:parseInt(i.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=parseInt(Is(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(Is(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(Is(n.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=Is(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function Fh(t){return Object.prototype.toString.call(t)==="[object Object]"}function Tv(t){return Fh(t)?Object.keys(t).reduce(function(e,n){const i=Fh(t[n]),r=i?Tv(t[n]):t[n],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[n]:r})},{}):t}function Ql(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Ql(t,t.get(e[i]),n):i.endsWith("Ids")&&e[i].forEach(r=>{Ql(t,t.get(r),n)})}))}function Uh(t,e,n){const i=n?"outbound-rtp":"inbound-rtp",r=new Map;if(e===null)return r;const s=[];return t.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{t.forEach(a=>{a.type===i&&a.trackId===o.id&&Ql(t,a,r)})}),r}const Bh=kv;function Ev(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const i=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const c={};return Object.keys(a).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const d=typeof a[l]=="object"?a[l]:{ideal:a[l]};d.exact!==void 0&&typeof d.exact=="number"&&(d.min=d.max=d.exact);const u=function(f,p){return f?f+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){c.optional=c.optional||[];let f={};typeof d.ideal=="number"?(f[u("min",l)]=d.ideal,c.optional.push(f),f={},f[u("max",l)]=d.ideal,c.optional.push(f)):(f[u("",l)]=d.ideal,c.optional.push(f))}d.exact!==void 0&&typeof d.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[u("",l)]=d.exact):["min","max"].forEach(f=>{d[f]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[u(f,l)]=d[f])})}),a.advanced&&(c.optional=(c.optional||[]).concat(a.advanced)),c},r=function(a,c){if(e.version>=61)return c(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const l=function(d,u,f){u in d&&!(f in d)&&(d[f]=d[u],delete d[u])};a=JSON.parse(JSON.stringify(a)),l(a.audio,"autoGainControl","googAutoGainControl"),l(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=i(a.audio)}if(a&&typeof a.video=="object"){let l=a.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const d=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!d)){delete a.video.facingMode;let u;if(l.exact==="environment"||l.ideal==="environment"?u=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(u=["front"]),u)return n.mediaDevices.enumerateDevices().then(f=>{f=f.filter(g=>g.kind==="videoinput");let p=f.find(g=>u.some(h=>g.label.toLowerCase().includes(h)));return!p&&f.length&&u.includes("back")&&(p=f[f.length-1]),p&&(a.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),a.video=i(a.video),Bh("chrome: "+JSON.stringify(a)),c(a)})}a.video=i(a.video)}return Bh("chrome: "+JSON.stringify(a)),c(a)},s=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(a,c,l){r(a,d=>{n.webkitGetUserMedia(d,c,u=>{l&&l(s(u))})})};if(n.getUserMedia=o.bind(n),n.mediaDevices.getUserMedia){const a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(c){return r(c,l=>a(l).then(d=>{if(l.audio&&!d.getAudioTracks().length||l.video&&!d.getVideoTracks().length)throw d.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return d},d=>Promise.reject(s(d))))}}}function Pv(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Rv(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(n){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=n)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",r=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===r.track.id):s={track:r.track};const o=new Event("track");o.track=r.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[i.stream],this.dispatchEvent(o)}),i.stream.getTracks().forEach(r=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===r.id):s={track:r};const o=new Event("track");o.track=r,o.receiver=s,o.transceiver={receiver:s},o.streams=[i.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else rr(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Av(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,c){let l=r.apply(this,arguments);return l||(l=e(this,a),this._senders.push(l)),l};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){s.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],n.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(c=>c.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Iv(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const n=t.RTCPeerConnection.prototype.getSenders;n&&(t.RTCPeerConnection.prototype.getSenders=function(){const s=n.apply(this,[]);return s.forEach(o=>o._pc=this),s});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function(){const s=i.apply(this,arguments);return s._pc=this,s}),t.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>Uh(o,s.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const n=t.RTCPeerConnection.prototype.getReceivers;n&&(t.RTCPeerConnection.prototype.getReceivers=function(){const r=n.apply(this,[]);return r.forEach(s=>s._pc=this),r}),rr(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>Uh(s,r.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const i=arguments[0];let r,s,o;return this.getSenders().forEach(a=>{a.track===i&&(r?o=!0:r=a)}),this.getReceivers().forEach(a=>(a.track===i&&(s?o=!0:s=a),a.track===i)),o||r&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Mv(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(l=>{if(this.getSenders().find(u=>u.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();n.apply(this,arguments);const c=this.getSenders().filter(l=>a.indexOf(l)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],i.apply(this,arguments)};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(o);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),r.apply(this,arguments)}}function _v(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Mv(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const d=n.apply(this);return this._reverseStreams=this._reverseStreams||{},d.map(u=>this._reverseStreams[u.id])};const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(d){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},d.getTracks().forEach(u=>{if(this.getSenders().find(p=>p.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[d.id]){const u=new t.MediaStream(d.getTracks());this._streams[d.id]=u,this._reverseStreams[u.id]=d,d=u}i.apply(this,[d])};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(d){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[d.id]||d]),delete this._reverseStreams[this._streams[d.id]?this._streams[d.id].id:d.id],delete this._streams[d.id]},t.RTCPeerConnection.prototype.addTrack=function(d,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const f=[].slice.call(arguments,1);if(f.length!==1||!f[0].getTracks().find(h=>h===d))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const g=this._streams[u.id];if(g)g.addTrack(d),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const h=new t.MediaStream([d]);this._streams[u.id]=h,this._reverseStreams[h.id]=u,this.addStream(h)}return this.getSenders().find(h=>h.track===d)};function s(l,d){let u=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(f=>{const p=l._reverseStreams[f],g=l._streams[p.id];u=u.replace(new RegExp(g.id,"g"),p.id)}),new RTCSessionDescription({type:d.type,sdp:u})}function o(l,d){let u=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(f=>{const p=l._reverseStreams[f],g=l._streams[p.id];u=u.replace(new RegExp(p.id,"g"),g.id)}),new RTCSessionDescription({type:d.type,sdp:u})}["createOffer","createAnswer"].forEach(function(l){const d=t.RTCPeerConnection.prototype[l],u={[l](){const f=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[g=>{const h=s(this,g);f[0].apply(null,[h])},g=>{f[1]&&f[1].apply(null,g)},arguments[2]]):d.apply(this,arguments).then(g=>s(this,g))}};t.RTCPeerConnection.prototype[l]=u[l]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=o(this,arguments[0]),a.apply(this,arguments))};const c=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const l=c.get.apply(this);return l.type===""?l:s(this,l)}}),t.RTCPeerConnection.prototype.removeTrack=function(d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!d._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(d._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let f;Object.keys(this._streams).forEach(p=>{this._streams[p].getTracks().find(h=>d.track===h)&&(f=this._streams[p])}),f&&(f.getTracks().length===1?this.removeStream(this._reverseStreams[f.id]):f.removeTrack(d.track),this.dispatchEvent(new Event("negotiationneeded")))}}function ed(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const i=t.RTCPeerConnection.prototype[n],r={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=r[n]})}function Nv(t,e){rr(t,"negotiationneeded",n=>{const i=n.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return n})}var $h=Object.freeze({__proto__:null,fixNegotiationNeeded:Nv,shimAddTrackRemoveTrack:_v,shimAddTrackRemoveTrackWithNative:Mv,shimGetSendersWithDtmf:Av,shimGetUserMedia:Ev,shimMediaStream:Pv,shimOnTrack:Rv,shimPeerConnection:ed,shimSenderReceiverGetStats:Iv});function Ov(t,e){const n=t&&t.navigator,i=t&&t.MediaStreamTrack;if(n.getUserMedia=function(r,s,o){Au("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(r).then(s,o)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const r=function(o,a,c){a in o&&!(c in o)&&(o[c]=o[a],delete o[a])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(o){return typeof o=="object"&&typeof o.audio=="object"&&(o=JSON.parse(JSON.stringify(o)),r(o.audio,"autoGainControl","mozAutoGainControl"),r(o.audio,"noiseSuppression","mozNoiseSuppression")),s(o)},i&&i.prototype.getSettings){const o=i.prototype.getSettings;i.prototype.getSettings=function(){const a=o.apply(this,arguments);return r(a,"mozAutoGainControl","autoGainControl"),r(a,"mozNoiseSuppression","noiseSuppression"),a}}if(i&&i.prototype.applyConstraints){const o=i.prototype.applyConstraints;i.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),r(a,"autoGainControl","mozAutoGainControl"),r(a,"noiseSuppression","mozNoiseSuppression")),o.apply(this,[a])}}}}function Mk(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(i){if(!(i&&i.video)){const r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return i.video===!0?i.video={mediaSource:e}:i.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(i)})}function Dv(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function td(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){const s=t.RTCPeerConnection.prototype[r],o={[r](){return arguments[0]=new(r==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),s.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=o[r]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[s,o,a]=arguments;return i.apply(this,[s||null]).then(c=>{if(e.version<53&&!o)try{c.forEach(l=>{l.type=n[l.type]||l.type})}catch(l){if(l.name!=="TypeError")throw l;c.forEach((d,u)=>{c.set(u,Object.assign({},d,{type:n[d.type]||d.type}))})}return c}).then(o,a)}}function jv(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Lv(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i}),rr(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Vv(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){Au("removeStream","removeTrack"),this.getSenders().forEach(i=>{i.track&&n.getTracks().includes(i.track)&&this.removeTrack(i)})})}function Fv(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Uv(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let i=arguments[1]&&arguments[1].sendEncodings;i===void 0&&(i=[]),i=[...i];const r=i.length>0;r&&i.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const s=e.apply(this,arguments);if(r){const{sender:o}=s,a=o.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=i,o.sendEncodings=i,this.setParametersPromises.push(o.setParameters(a).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return s})}function Bv(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const i=e.apply(this,arguments);return"encodings"in i||(i.encodings=[].concat(this.sendEncodings||[{}])),i})}function $v(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function Hv(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var Hh=Object.freeze({__proto__:null,shimAddTransceiver:Uv,shimCreateAnswer:Hv,shimCreateOffer:$v,shimGetDisplayMedia:Mk,shimGetParameters:Bv,shimGetUserMedia:Ov,shimOnTrack:Dv,shimPeerConnection:td,shimRTCDataChannel:Fv,shimReceiverGetStats:Lv,shimRemoveStream:Vv,shimSenderGetStats:jv});function zv(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(i){this._localStreams||(this._localStreams=[]),this._localStreams.includes(i)||this._localStreams.push(i),i.getAudioTracks().forEach(r=>e.call(this,r,i)),i.getVideoTracks().forEach(r=>e.call(this,r,i))},t.RTCPeerConnection.prototype.addTrack=function(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s&&s.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const i=this._localStreams.indexOf(n);if(i===-1)return;this._localStreams.splice(i,1);const r=n.getTracks();this.getSenders().forEach(s=>{r.includes(s.track)&&this.removeTrack(s)})})}}function Wv(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=i=>{i.streams.forEach(r=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(r))return;this._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,this.dispatchEvent(s)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const i=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(s=>{if(i._remoteStreams||(i._remoteStreams=[]),i._remoteStreams.indexOf(s)>=0)return;i._remoteStreams.push(s);const o=new Event("addstream");o.stream=s,i.dispatchEvent(o)})}),e.apply(i,arguments)}}}function qv(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,i=e.createAnswer,r=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,d){const u=arguments.length>=2?arguments[2]:arguments[0],f=n.apply(this,[u]);return d?(f.then(l,d),Promise.resolve()):f},e.createAnswer=function(l,d){const u=arguments.length>=2?arguments[2]:arguments[0],f=i.apply(this,[u]);return d?(f.then(l,d),Promise.resolve()):f};let a=function(c,l,d){const u=r.apply(this,[c]);return d?(u.then(l,d),Promise.resolve()):u};e.setLocalDescription=a,a=function(c,l,d){const u=s.apply(this,[c]);return d?(u.then(l,d),Promise.resolve()):u},e.setRemoteDescription=a,a=function(c,l,d){const u=o.apply(this,[c]);return d?(u.then(l,d),Promise.resolve()):u},e.addIceCandidate=a}function Kv(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,i=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=r=>i(Gv(r))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(i,r,s){e.mediaDevices.getUserMedia(i).then(r,s)}).bind(e))}function Gv(t){return t&&t.video!==void 0?Object.assign({},t,{video:Tv(t.video)}):t}function Zv(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(i,r){if(i&&i.iceServers){const s=[];for(let o=0;o<i.iceServers.length;o++){let a=i.iceServers[o];a.urls===void 0&&a.url?(Au("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,s.push(a)):s.push(i.iceServers[o])}i.iceServers=s}return new e(i,r)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function Yv(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Jv(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(i){if(i){typeof i.offerToReceiveAudio<"u"&&(i.offerToReceiveAudio=!!i.offerToReceiveAudio);const r=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");i.offerToReceiveAudio===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):i.offerToReceiveAudio===!0&&!r&&this.addTransceiver("audio",{direction:"recvonly"}),typeof i.offerToReceiveVideo<"u"&&(i.offerToReceiveVideo=!!i.offerToReceiveVideo);const s=this.getTransceivers().find(o=>o.receiver.track.kind==="video");i.offerToReceiveVideo===!1&&s?s.direction==="sendrecv"?s.setDirection?s.setDirection("sendonly"):s.direction="sendonly":s.direction==="recvonly"&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive"):i.offerToReceiveVideo===!0&&!s&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Xv(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var zh=Object.freeze({__proto__:null,shimAudioContext:Xv,shimCallbacksAPI:qv,shimConstraints:Gv,shimCreateOfferLegacy:Jv,shimGetUserMedia:Kv,shimLocalStreamsAPI:zv,shimRTCIceServerUrls:Zv,shimRemoteStreamsAPI:Wv,shimTrackEventTransceiver:Yv}),Lc={exports:{}},Wh;function _k(){return Wh||(Wh=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(n){return n.trim().split(`
32
+ `).map(i=>i.trim())},e.splitSections=function(n){return n.split(`
33
+ m=`).map((r,s)=>(s>0?"m="+r:r).trim()+`\r
34
+ `)},e.getDescription=function(n){const i=e.splitSections(n);return i&&i[0]},e.getMediaSections=function(n){const i=e.splitSections(n);return i.shift(),i},e.matchPrefix=function(n,i){return e.splitLines(n).filter(r=>r.indexOf(i)===0)},e.parseCandidate=function(n){let i;n.indexOf("a=candidate:")===0?i=n.substring(12).split(" "):i=n.substring(10).split(" ");const r={foundation:i[0],component:{1:"rtp",2:"rtcp"}[i[1]]||i[1],protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]};for(let s=8;s<i.length;s+=2)switch(i[s]){case"raddr":r.relatedAddress=i[s+1];break;case"rport":r.relatedPort=parseInt(i[s+1],10);break;case"tcptype":r.tcpType=i[s+1];break;case"ufrag":r.ufrag=i[s+1],r.usernameFragment=i[s+1];break;default:r[i[s]]===void 0&&(r[i[s]]=i[s+1]);break}return r},e.writeCandidate=function(n){const i=[];i.push(n.foundation);const r=n.component;r==="rtp"?i.push(1):r==="rtcp"?i.push(2):i.push(r),i.push(n.protocol.toUpperCase()),i.push(n.priority),i.push(n.address||n.ip),i.push(n.port);const s=n.type;return i.push("typ"),i.push(s),s!=="host"&&n.relatedAddress&&n.relatedPort&&(i.push("raddr"),i.push(n.relatedAddress),i.push("rport"),i.push(n.relatedPort)),n.tcpType&&n.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(n.tcpType)),(n.usernameFragment||n.ufrag)&&(i.push("ufrag"),i.push(n.usernameFragment||n.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(n){return n.substring(14).split(" ")},e.parseRtpMap=function(n){let i=n.substring(9).split(" ");const r={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),r.name=i[0],r.clockRate=parseInt(i[1],10),r.channels=i.length===3?parseInt(i[2],10):1,r.numChannels=r.channels,r},e.writeRtpMap=function(n){let i=n.payloadType;n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType);const r=n.channels||n.numChannels||1;return"a=rtpmap:"+i+" "+n.name+"/"+n.clockRate+(r!==1?"/"+r:"")+`\r
35
+ `},e.parseExtmap=function(n){const i=n.substring(9).split(" ");return{id:parseInt(i[0],10),direction:i[0].indexOf("/")>0?i[0].split("/")[1]:"sendrecv",uri:i[1],attributes:i.slice(2).join(" ")}},e.writeExtmap=function(n){return"a=extmap:"+(n.id||n.preferredId)+(n.direction&&n.direction!=="sendrecv"?"/"+n.direction:"")+" "+n.uri+(n.attributes?" "+n.attributes:"")+`\r
36
+ `},e.parseFmtp=function(n){const i={};let r;const s=n.substring(n.indexOf(" ")+1).split(";");for(let o=0;o<s.length;o++)r=s[o].trim().split("="),i[r[0].trim()]=r[1];return i},e.writeFmtp=function(n){let i="",r=n.payloadType;if(n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType),n.parameters&&Object.keys(n.parameters).length){const s=[];Object.keys(n.parameters).forEach(o=>{n.parameters[o]!==void 0?s.push(o+"="+n.parameters[o]):s.push(o)}),i+="a=fmtp:"+r+" "+s.join(";")+`\r
37
+ `}return i},e.parseRtcpFb=function(n){const i=n.substring(n.indexOf(" ")+1).split(" ");return{type:i.shift(),parameter:i.join(" ")}},e.writeRtcpFb=function(n){let i="",r=n.payloadType;return n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType),n.rtcpFeedback&&n.rtcpFeedback.length&&n.rtcpFeedback.forEach(s=>{i+="a=rtcp-fb:"+r+" "+s.type+(s.parameter&&s.parameter.length?" "+s.parameter:"")+`\r
38
+ `}),i},e.parseSsrcMedia=function(n){const i=n.indexOf(" "),r={ssrc:parseInt(n.substring(7,i),10)},s=n.indexOf(":",i);return s>-1?(r.attribute=n.substring(i+1,s),r.value=n.substring(s+1)):r.attribute=n.substring(i+1),r},e.parseSsrcGroup=function(n){const i=n.substring(13).split(" ");return{semantics:i.shift(),ssrcs:i.map(r=>parseInt(r,10))}},e.getMid=function(n){const i=e.matchPrefix(n,"a=mid:")[0];if(i)return i.substring(6)},e.parseFingerprint=function(n){const i=n.substring(14).split(" ");return{algorithm:i[0].toLowerCase(),value:i[1].toUpperCase()}},e.getDtlsParameters=function(n,i){return{role:"auto",fingerprints:e.matchPrefix(n+i,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(n,i){let r="a=setup:"+i+`\r
39
+ `;return n.fingerprints.forEach(s=>{r+="a=fingerprint:"+s.algorithm+" "+s.value+`\r
40
+ `}),r},e.parseCryptoLine=function(n){const i=n.substring(9).split(" ");return{tag:parseInt(i[0],10),cryptoSuite:i[1],keyParams:i[2],sessionParams:i.slice(3)}},e.writeCryptoLine=function(n){return"a=crypto:"+n.tag+" "+n.cryptoSuite+" "+(typeof n.keyParams=="object"?e.writeCryptoKeyParams(n.keyParams):n.keyParams)+(n.sessionParams?" "+n.sessionParams.join(" "):"")+`\r
41
+ `},e.parseCryptoKeyParams=function(n){if(n.indexOf("inline:")!==0)return null;const i=n.substring(7).split("|");return{keyMethod:"inline",keySalt:i[0],lifeTime:i[1],mkiValue:i[2]?i[2].split(":")[0]:void 0,mkiLength:i[2]?i[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(n){return n.keyMethod+":"+n.keySalt+(n.lifeTime?"|"+n.lifeTime:"")+(n.mkiValue&&n.mkiLength?"|"+n.mkiValue+":"+n.mkiLength:"")},e.getCryptoParameters=function(n,i){return e.matchPrefix(n+i,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(n,i){const r=e.matchPrefix(n+i,"a=ice-ufrag:")[0],s=e.matchPrefix(n+i,"a=ice-pwd:")[0];return r&&s?{usernameFragment:r.substring(12),password:s.substring(10)}:null},e.writeIceParameters=function(n){let i="a=ice-ufrag:"+n.usernameFragment+`\r
42
+ a=ice-pwd:`+n.password+`\r
43
+ `;return n.iceLite&&(i+=`a=ice-lite\r
44
+ `),i},e.parseRtpParameters=function(n){const i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},s=e.splitLines(n)[0].split(" ");i.profile=s[2];for(let a=3;a<s.length;a++){const c=s[a],l=e.matchPrefix(n,"a=rtpmap:"+c+" ")[0];if(l){const d=e.parseRtpMap(l),u=e.matchPrefix(n,"a=fmtp:"+c+" ");switch(d.parameters=u.length?e.parseFmtp(u[0]):{},d.rtcpFeedback=e.matchPrefix(n,"a=rtcp-fb:"+c+" ").map(e.parseRtcpFb),i.codecs.push(d),d.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(d.name.toUpperCase());break}}}e.matchPrefix(n,"a=extmap:").forEach(a=>{i.headerExtensions.push(e.parseExtmap(a))});const o=e.matchPrefix(n,"a=rtcp-fb:* ").map(e.parseRtcpFb);return i.codecs.forEach(a=>{o.forEach(c=>{a.rtcpFeedback.find(d=>d.type===c.type&&d.parameter===c.parameter)||a.rtcpFeedback.push(c)})}),i},e.writeRtpDescription=function(n,i){let r="";r+="m="+n+" ",r+=i.codecs.length>0?"9":"0",r+=" "+(i.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=i.codecs.map(o=>o.preferredPayloadType!==void 0?o.preferredPayloadType:o.payloadType).join(" ")+`\r
45
+ `,r+=`c=IN IP4 0.0.0.0\r
46
+ `,r+=`a=rtcp:9 IN IP4 0.0.0.0\r
47
+ `,i.codecs.forEach(o=>{r+=e.writeRtpMap(o),r+=e.writeFmtp(o),r+=e.writeRtcpFb(o)});let s=0;return i.codecs.forEach(o=>{o.maxptime>s&&(s=o.maxptime)}),s>0&&(r+="a=maxptime:"+s+`\r
48
+ `),i.headerExtensions&&i.headerExtensions.forEach(o=>{r+=e.writeExtmap(o)}),r},e.parseRtpEncodingParameters=function(n){const i=[],r=e.parseRtpParameters(n),s=r.fecMechanisms.indexOf("RED")!==-1,o=r.fecMechanisms.indexOf("ULPFEC")!==-1,a=e.matchPrefix(n,"a=ssrc:").map(f=>e.parseSsrcMedia(f)).filter(f=>f.attribute==="cname"),c=a.length>0&&a[0].ssrc;let l;const d=e.matchPrefix(n,"a=ssrc-group:FID").map(f=>f.substring(17).split(" ").map(g=>parseInt(g,10)));d.length>0&&d[0].length>1&&d[0][0]===c&&(l=d[0][1]),r.codecs.forEach(f=>{if(f.name.toUpperCase()==="RTX"&&f.parameters.apt){let p={ssrc:c,codecPayloadType:parseInt(f.parameters.apt,10)};c&&l&&(p.rtx={ssrc:l}),i.push(p),s&&(p=JSON.parse(JSON.stringify(p)),p.fec={ssrc:c,mechanism:o?"red+ulpfec":"red"},i.push(p))}}),i.length===0&&c&&i.push({ssrc:c});let u=e.matchPrefix(n,"b=");return u.length&&(u[0].indexOf("b=TIAS:")===0?u=parseInt(u[0].substring(7),10):u[0].indexOf("b=AS:")===0?u=parseInt(u[0].substring(5),10)*1e3*.95-2e3*8:u=void 0,i.forEach(f=>{f.maxBitrate=u})),i},e.parseRtcpParameters=function(n){const i={},r=e.matchPrefix(n,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="cname")[0];r&&(i.cname=r.value,i.ssrc=r.ssrc);const s=e.matchPrefix(n,"a=rtcp-rsize");i.reducedSize=s.length>0,i.compound=s.length===0;const o=e.matchPrefix(n,"a=rtcp-mux");return i.mux=o.length>0,i},e.writeRtcpParameters=function(n){let i="";return n.reducedSize&&(i+=`a=rtcp-rsize\r
49
+ `),n.mux&&(i+=`a=rtcp-mux\r
50
+ `),n.ssrc!==void 0&&n.cname&&(i+="a=ssrc:"+n.ssrc+" cname:"+n.cname+`\r
51
+ `),i},e.parseMsid=function(n){let i;const r=e.matchPrefix(n,"a=msid:");if(r.length===1)return i=r[0].substring(7).split(" "),{stream:i[0],track:i[1]};const s=e.matchPrefix(n,"a=ssrc:").map(o=>e.parseSsrcMedia(o)).filter(o=>o.attribute==="msid");if(s.length>0)return i=s[0].value.split(" "),{stream:i[0],track:i[1]}},e.parseSctpDescription=function(n){const i=e.parseMLine(n),r=e.matchPrefix(n,"a=max-message-size:");let s;r.length>0&&(s=parseInt(r[0].substring(19),10)),isNaN(s)&&(s=65536);const o=e.matchPrefix(n,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:i.fmt,maxMessageSize:s};const a=e.matchPrefix(n,"a=sctpmap:");if(a.length>0){const c=a[0].substring(10).split(" ");return{port:parseInt(c[0],10),protocol:c[1],maxMessageSize:s}}},e.writeSctpDescription=function(n,i){let r=[];return n.protocol!=="DTLS/SCTP"?r=["m="+n.kind+" 9 "+n.protocol+" "+i.protocol+`\r
52
+ `,`c=IN IP4 0.0.0.0\r
53
+ `,"a=sctp-port:"+i.port+`\r
54
+ `]:r=["m="+n.kind+" 9 "+n.protocol+" "+i.port+`\r
55
+ `,`c=IN IP4 0.0.0.0\r
56
+ `,"a=sctpmap:"+i.port+" "+i.protocol+` 65535\r
57
+ `],i.maxMessageSize!==void 0&&r.push("a=max-message-size:"+i.maxMessageSize+`\r
58
+ `),r.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(n,i,r){let s;const o=i!==void 0?i:2;return n?s=n:s=e.generateSessionId(),`v=0\r
59
+ o=`+(r||"thisisadapterortc")+" "+s+" "+o+` IN IP4 127.0.0.1\r
60
+ s=-\r
61
+ t=0 0\r
62
+ `},e.getDirection=function(n,i){const r=e.splitLines(n);for(let s=0;s<r.length;s++)switch(r[s]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[s].substring(2)}return i?e.getDirection(i):"sendrecv"},e.getKind=function(n){return e.splitLines(n)[0].split(" ")[0].substring(2)},e.isRejected=function(n){return n.split(" ",2)[1]==="0"},e.parseMLine=function(n){const r=e.splitLines(n)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},e.parseOLine=function(n){const r=e.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},e.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;const i=e.splitLines(n);for(let r=0;r<i.length;r++)if(i[r].length<2||i[r].charAt(1)!=="=")return!1;return!0},t.exports=e}(Lc)),Lc.exports}var Qv=_k(),Or=yk(Qv),Nk=zw({__proto__:null,default:Or},[Qv]);function Xo(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(i){if(typeof i=="object"&&i.candidate&&i.candidate.indexOf("a=")===0&&(i=JSON.parse(JSON.stringify(i)),i.candidate=i.candidate.substring(2)),i.candidate&&i.candidate.length){const r=new e(i),s=Or.parseCandidate(i.candidate);for(const o in s)o in r||Object.defineProperty(r,o,{value:s[o]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new e(i)},t.RTCIceCandidate.prototype=e.prototype,rr(t,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new t.RTCIceCandidate(n.candidate),writable:"false"}),n))}function nd(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||rr(t,"icecandidate",e=>{if(e.candidate){const n=Or.parseCandidate(e.candidate.candidate);n.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function Qo(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(a){if(!a||!a.sdp)return!1;const c=Or.splitSections(a.sdp);return c.shift(),c.some(l=>{const d=Or.parseMLine(l);return d&&d.kind==="application"&&d.protocol.indexOf("SCTP")!==-1})},i=function(a){const c=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(c===null||c.length<2)return-1;const l=parseInt(c[1],10);return l!==l?-1:l},r=function(a){let c=65536;return e.browser==="firefox"&&(e.version<57?a===-1?c=16384:c=2147483637:e.version<60?c=e.version===57?65535:65536:c=2147483637),c},s=function(a,c){let l=65536;e.browser==="firefox"&&e.version===57&&(l=65535);const d=Or.matchPrefix(a.sdp,"a=max-message-size:");return d.length>0?l=parseInt(d[0].substring(19),10):e.browser==="firefox"&&c!==-1&&(l=2147483637),l},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:c}=this.getConfiguration();c==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const c=i(arguments[0]),l=r(c),d=s(arguments[0],c);let u;l===0&&d===0?u=Number.POSITIVE_INFINITY:l===0||d===0?u=Math.max(l,d):u=Math.min(l,d);const f={};Object.defineProperty(f,"maxMessageSize",{get(){return u}}),this._sctp=f}return o.apply(this,arguments)}}function ea(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(i,r){const s=i.send;i.send=function(){const a=arguments[0],c=a.length||a.size||a.byteLength;if(i.readyState==="open"&&r.sctp&&c>r.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+r.sctp.maxMessageSize+" bytes)");return s.apply(i,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const r=n.apply(this,arguments);return e(r,this),r},rr(t,"datachannel",i=>(e(i.channel,i.target),i))}function id(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const i=e[n];e[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=r=>{const s=r.target;if(s._lastConnectionState!==s.connectionState){s._lastConnectionState=s.connectionState;const o=new Event("connectionstatechange",r);s.dispatchEvent(o)}return r},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})}function rd(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e._safariVersion>=13.1)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(r){if(r&&r.sdp&&r.sdp.indexOf(`
63
+ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
64
+ `).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
65
+ `);t.RTCSessionDescription&&r instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:r.type,sdp:s}):r.sdp=s}return n.apply(this,arguments)}}function ta(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function na(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let r=arguments[0]||{};if(typeof r!="object"||r.type&&r.sdp)return n.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer";break}return r.sdp||r.type!=="offer"&&r.type!=="answer"?n.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>n.apply(this,[o]))})}var Ok=Object.freeze({__proto__:null,removeExtmapAllowMixed:rd,shimAddIceCandidateNullOrEmpty:ta,shimConnectionState:id,shimMaxMessageSize:Qo,shimParameterlessSetLocalDescription:na,shimRTCIceCandidate:Xo,shimRTCIceCandidateRelayProtocol:nd,shimSendThrowTypeError:ea});function Dk(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=kv,i=Ik(t),r={browserDetails:i,commonShim:Ok,extractVersion:Is,disableLog:Rk,disableWarnings:Ak,sdp:Nk};switch(i.browser){case"chrome":if(!$h||!ed||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),r;if(i.version===null)return n("Chrome shim can not determine version, not shimming."),r;n("adapter.js shimming chrome."),r.browserShim=$h,ta(t,i),na(t),Ev(t,i),Pv(t),ed(t,i),Rv(t),_v(t,i),Av(t),Iv(t),Nv(t,i),Xo(t),nd(t),id(t),Qo(t,i),ea(t),rd(t,i);break;case"firefox":if(!Hh||!td||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),r;n("adapter.js shimming firefox."),r.browserShim=Hh,ta(t,i),na(t),Ov(t,i),td(t,i),Dv(t),Vv(t),jv(t),Lv(t),Fv(t),Uv(t),Bv(t),$v(t),Hv(t),Xo(t),id(t),Qo(t,i),ea(t);break;case"safari":if(!zh||!e.shimSafari)return n("Safari shim is not included in this adapter release."),r;n("adapter.js shimming safari."),r.browserShim=zh,ta(t,i),na(t),Zv(t),Jv(t),qv(t),zv(t),Wv(t),Yv(t),Kv(t),Xv(t),Xo(t),nd(t),Qo(t,i),ea(t),rd(t,i);break;default:n("Unsupported browser!");break}return r}Dk({window:typeof window>"u"?void 0:window});const jk=10,Ss="lk_e2ee",Lk="LKFrameEncryptionKey",Vk={sharedKey:!1,ratchetSalt:Lk,ratchetWindowSize:8,failureTolerance:jk,keyringSize:16};var ui;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(ui||(ui={}));var qh;(function(t){t.KeyRatcheted="keyRatcheted"})(qh||(qh={}));var di;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(di||(di={}));var Kh;(function(t){t.Error="cryptorError"})(Kh||(Kh={}));function Fk(){return Uk()||sd()}function sd(){return typeof window.RTCRtpScriptTransform<"u"}function Uk(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class DL extends Nn.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(n,i,r)=>{Ce.debug("key ratcheted event received",{ratchetResult:n,participantId:i,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Vk),e),this.on(ui.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,n,i){const r={key:e,participantIdentity:n,keyIndex:i};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(i??0),r),this.emit(ui.SetKey,r)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,n){this.emit(ui.RatchetRequest,e,n)}}class ki extends Error{constructor(e,n){super(n||"an error has occured"),this.name="LiveKitError",this.code=e}}var Te;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest",t[t.Timeout=5]="Timeout"})(Te||(Te={}));class Ue extends ki{constructor(e,n,i,r){super(1,e),this.name="ConnectionError",this.status=i,this.reason=n,this.context=r,this.reasonName=Te[n]}}class Iu extends ki{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Wn extends ki{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Bk extends ki{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class ht extends ki{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class od extends ki{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class Gh extends ki{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class Zh extends ki{constructor(e,n){super(15,e),this.reason=n,this.reasonName=typeof n=="string"?n:Ru[n]}}var Ca;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(Ca||(Ca={}));(function(t){function e(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?t.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?t.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e})(Ca||(Ca={}));var Yh;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(Yh||(Yh={}));var U;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(U||(U={}));var Z;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(Z||(Z={}));var ae;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(ae||(ae={}));var re;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate",t.PreConnectBufferFlushed="preConnectBufferFlushed"})(re||(re={}));function $k(t){return typeof t>"u"?t:typeof structuredClone=="function"?typeof t=="object"&&t!==null?structuredClone(Object.assign({},t)):structuredClone(t):JSON.parse(JSON.stringify(t))}const Hk=/version\/(\d+(\.?_?\d+)+)/i;let Vc;function $t(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(Vc===void 0||e){const i=zk.find(r=>{let{test:s}=r;return s.test(n)});Vc=i==null?void 0:i.describe(n)}return Vc}const zk=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:ia(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:Fc(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:ia(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:Fc(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:ia(Hk,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:Fc(t)}}}];function ia(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const i=e.match(t);return i&&i.length>=n&&i[n]||""}function Fc(t){return t.includes("mac os")?ia(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var Wk="2.13.8";const qk=Wk,Kk=16;class bt{}bt.setTimeout=function(){return setTimeout(...arguments)};bt.setInterval=function(){return setInterval(...arguments)};bt.clearTimeout=function(){return clearTimeout(...arguments)};bt.clearInterval=function(){return clearInterval(...arguments)};const Gk=5e3,ws=[];var Jt;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Jt||(Jt={}));class V extends Nn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=V.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=Ce,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Gk):this.handleAppVisibilityChanged()},this.log=Gn((r=i.loggerName)!==null&&r!==void 0?r:fn.Track),this.loggerContextCb=i.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=V.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),we(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===V.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===V.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(ws.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&ws.splice(ws.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),kr(this.mediaStreamTrack,e);const i=e.srcObject.getTracks(),r=i.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(r?re.AudioPlaybackStarted:re.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(r?re.AudioPlaybackFailed:re.VideoPlaybackFailed,s):s.name==="AbortError"?Ce.debug("".concat(r?"audio":"video"," playback aborted, likely due to new play request")):Ce.warn("could not playback ".concat(r?"audio":"video"),s),r&&e&&i.some(o=>o.kind==="video")&&s.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(re.ElementAttached,e),e}detach(e){try{if(e){Dr(this.mediaStreamTrack,e);const i=this.attachedElements.indexOf(e);return i>=0&&(this.attachedElements.splice(i,1),this.recycleElement(e),this.emit(re.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(i=>{Dr(this.mediaStreamTrack,i),n.push(i),this.recycleElement(i),this.emit(re.ElementDetached,i)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=Gn(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),ws.forEach(i=>{i.parentElement||(n=!1)}),n&&ws.push(e)}}handleAppVisibilityChanged(){return A(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===V.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Ot()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Ot()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function kr(t,e){let n;e.srcObject instanceof MediaStream?n=e.srcObject:n=new MediaStream;let i;t.kind==="audio"?i=n.getAudioTracks():i=n.getVideoTracks(),i.includes(t)||(i.forEach(r=>{n.removeTrack(r)}),n.addTrack(t)),(!Xi()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(Xi()||qr())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function Dr(t,e){if(e.srcObject instanceof MediaStream){const n=e.srcObject;n.removeTrack(t),n.getTracks().length>0?e.srcObject=n:e.srcObject=null}}(function(t){let e;(function(l){l.Audio="audio",l.Video="video",l.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let n;(function(l){l.Camera="camera",l.Microphone="microphone",l.ScreenShare="screen_share",l.ScreenShareAudio="screen_share_audio",l.Unknown="unknown"})(n=t.Source||(t.Source={}));let i;(function(l){l.Active="active",l.Paused="paused",l.Unknown="unknown"})(i=t.StreamState||(t.StreamState={}));function r(l){switch(l){case e.Audio:return cn.AUDIO;case e.Video:return cn.VIDEO;default:return cn.DATA}}t.kindToProto=r;function s(l){switch(l){case cn.AUDIO:return e.Audio;case cn.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function o(l){switch(l){case n.Camera:return lt.CAMERA;case n.Microphone:return lt.MICROPHONE;case n.ScreenShare:return lt.SCREEN_SHARE;case n.ScreenShareAudio:return lt.SCREEN_SHARE_AUDIO;default:return lt.UNKNOWN}}t.sourceToProto=o;function a(l){switch(l){case lt.CAMERA:return n.Camera;case lt.MICROPHONE:return n.Microphone;case lt.SCREEN_SHARE:return n.ScreenShare;case lt.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=a;function c(l){switch(l){case Zl.ACTIVE:return i.Active;case Zl.PAUSED:return i.Paused;default:return i.Unknown}}t.streamStateFromProto=c})(V||(V={}));class je{constructor(e,n,i,r,s){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(n!==void 0&&i!==void 0)this.width=e,this.height=n,this.aspectRatio=e/n,this.encoding={maxBitrate:i,maxFramerate:r,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Zk=["vp8","h264"],Yk=["vp8","h264","vp9","av1"];function Jk(t){return!!Zk.find(e=>e===t)}var Jh;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(Jh||(Jh={}));var ad;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(ad||(ad={}));const zs={h90:new je(160,90,9e4,20),h180:new je(320,180,16e4,20),h216:new je(384,216,18e4,20),h360:new je(640,360,45e4,20),h540:new je(960,540,8e5,25),h720:new je(1280,720,17e5,30),h1080:new je(1920,1080,3e6,30),h1440:new je(2560,1440,5e6,30),h2160:new je(3840,2160,8e6,30)},cd={h120:new je(160,120,7e4,20),h180:new je(240,180,125e3,20),h240:new je(320,240,14e4,20),h360:new je(480,360,33e4,20),h480:new je(640,480,5e5,20),h540:new je(720,540,6e5,25),h720:new je(960,720,13e5,30),h1080:new je(1440,1080,23e5,30),h1440:new je(1920,1440,38e5,30)},Mu={h360fps3:new je(640,360,2e5,3,"medium"),h360fps15:new je(640,360,4e5,15,"medium"),h720fps5:new je(1280,720,8e5,5,"medium"),h720fps15:new je(1280,720,15e5,15,"medium"),h720fps30:new je(1280,720,2e6,30,"medium"),h1080fps15:new je(1920,1080,25e5,15,"medium"),h1080fps30:new je(1920,1080,5e6,30,"medium"),original:new je(0,0,7e6,30,"medium")},Xk="|",Xh="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function Qk(t){const e=t.split(Xk);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function jt(t){return A(this,void 0,void 0,function*(){return new Promise(e=>bt.setTimeout(e,t))})}function ld(){return"addTransceiver"in RTCPeerConnection.prototype}function dd(){return"addTrack"in RTCPeerConnection.prototype}function eT(){if(!("getCapabilities"in RTCRtpSender)||Xi())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/AV1"){e=!0;break}}return e}function tT(){if(!("getCapabilities"in RTCRtpSender)||qr())return!1;if(Xi()){const n=$t();if(n!=null&&n.version&&mi(n.version,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/VP9"){e=!0;break}}return e}function Kn(t){return t==="av1"||t==="vp9"}function ud(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function nT(){return typeof RTCPeerConnection>"u"?!1:ld()||dd()}function qr(){var t;return((t=$t())===null||t===void 0?void 0:t.name)==="Firefox"}function Xi(){var t;return((t=$t())===null||t===void 0?void 0:t.name)==="Safari"}function Qh(){const t=$t();return(t==null?void 0:t.name)==="Safari"||(t==null?void 0:t.os)==="iOS"}function iT(){const t=$t();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function rT(t){return t||(t=$t()),(t==null?void 0:t.name)==="Safari"&&mi(t.version,"18.3")>0}function ey(){var t,e;return Ot()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function sT(){const t=$t(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&mi(e,t.osVersion)>=0?!0:t.name==="Safari"&&mi(e,t.version)>=0}function Ot(){return typeof document<"u"}function In(){return navigator.product=="ReactNative"}function fd(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function ty(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function ny(){if(!In())return;let t=ty();if(t)return t.platform}function em(){if(Ot())return window.devicePixelRatio;if(In()){let t=ty();if(t)return t.devicePixelRatio}return 1}function mi(t,e){const n=t.split("."),i=e.split("."),r=Math.min(n.length,i.length);for(let s=0;s<r;++s){const o=parseInt(n[s],10),a=parseInt(i[s],10);if(o>a)return 1;if(o<a)return-1;if(s===r-1&&o===a)return 0}return t===""&&e!==""?-1:e===""?1:n.length==i.length?0:n.length<i.length?-1:1}function oT(t){for(const e of t)e.target.handleResize(e)}function aT(t){for(const e of t)e.target.handleVisibilityChanged(e)}let Uc=null;const tm=()=>(Uc||(Uc=new ResizeObserver(oT)),Uc);let Bc=null;const nm=()=>(Bc||(Bc=new IntersectionObserver(aT,{root:null,rootMargin:"0px"})),Bc);function cT(){var t;const e=new KC({sdk:ov.JS,protocol:Kk,version:qk});return In()&&(e.os=(t=ny())!==null&&t!==void 0?t:""),e}function im(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const r=document.createElement("canvas");r.width=t,r.height=e;const s=r.getContext("2d");s==null||s.fillRect(0,0,r.width,r.height),i&&s&&(s.beginPath(),s.arc(t/2,e/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const o=r.captureStream(),[a]=o.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=n,a}let Cs;function $c(){if(!Cs){const t=new AudioContext,e=t.createOscillator(),n=t.createGain();n.gain.setValueAtTime(0,0);const i=t.createMediaStreamDestination();if(e.connect(n),n.connect(i),e.start(),[Cs]=i.stream.getAudioTracks(),!Cs)throw Error("Could not get empty media stream audio track");Cs.enabled=!1}return Cs.clone()}class Tr{constructor(e,n){this.onFinally=n,this.promise=new Promise((i,r)=>A(this,void 0,void 0,function*(){this.resolve=i,this.reject=r,e&&(yield e(i,r))})).finally(()=>{var i;return(i=this.onFinally)===null||i===void 0?void 0:i.call(this)})}}function lT(t,e){const n=Object.assign({cloneTrack:!1,fftSize:2048,smoothingTimeConstant:.8,minDecibels:-100,maxDecibels:-80},e),i=Nu();if(!i)throw new Error("Audio Context not supported on this browser");const r=n.cloneTrack?t.mediaStreamTrack.clone():t.mediaStreamTrack,s=i.createMediaStreamSource(new MediaStream([r])),o=i.createAnalyser();o.minDecibels=n.minDecibels,o.maxDecibels=n.maxDecibels,o.fftSize=n.fftSize,o.smoothingTimeConstant=n.smoothingTimeConstant,s.connect(o);const a=new Uint8Array(o.frequencyBinCount);return{calculateVolume:()=>{o.getByteFrequencyData(a);let d=0;for(const f of a)d+=Math.pow(f/255,2);return Math.sqrt(d/a.length)},analyser:o,cleanup:()=>A(this,void 0,void 0,function*(){yield i.close(),n.cloneTrack&&r.stop()})}}function dT(t){return Yk.includes(t)}function fi(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function uT(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function hd(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function fT(t,e){return t.segments.map(n=>{let{id:i,text:r,language:s,startTime:o,endTime:a,final:c}=n;var l;const d=(l=e.get(i))!==null&&l!==void 0?l:Date.now(),u=Date.now();return c?e.delete(i):e.set(i,d),{id:i,text:r,startTime:Number.parseInt(o.toString()),endTime:Number.parseInt(a.toString()),final:c,language:s,firstReceivedTime:d,lastReceivedTime:u}})}function hT(t){const{id:e,timestamp:n,message:i,editTimestamp:r}=t;return{id:e,timestamp:Number.parseInt(n.toString()),editTimestamp:r?Number.parseInt(r.toString()):void 0,message:i}}function rm(t){switch(t.reason){case Te.LeaveRequest:return t.context;case Te.Cancelled:return dn.CLIENT_INITIATED;case Te.NotAllowed:return dn.USER_REJECTED;case Te.ServerUnreachable:return dn.JOIN_FAILURE;default:return dn.UNKNOWN_REASON}}function ra(t){return t!==void 0?Number(t):void 0}function Li(t){return t!==void 0?BigInt(t):void 0}function jr(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function Tn(t){return!!t&&t.kind==V.Kind.Audio}function ns(t){return!!t&&t.kind==V.Kind.Video}function ii(t){return jr(t)&&ns(t)}function Un(t){return jr(t)&&Tn(t)}function md(t){return!!t&&!t.isLocal}function mT(t){return!!t&&!t.isLocal}function Hc(t){return md(t)&&ns(t)}function pT(t){return t.isLocal}function gT(t,e){const n=[];let i=new TextEncoder().encode(t);for(;i.length>e;){let r=e;for(;r>0;){const s=i[r];if(s!==void 0&&(s&192)!==128)break;r--}n.push(i.slice(0,r)),i=i.slice(r)}return i.length>0&&n.push(i),n}function iy(t,e,n){var i,r,s,o;const{optionsWithoutProcessor:a,audioProcessor:c,videoProcessor:l}=sy(t??{}),d=e==null?void 0:e.processor,u=n==null?void 0:n.processor,f=a??{};return f.audio===!0&&(f.audio={}),f.video===!0&&(f.video={}),f.audio&&(pd(f.audio,e),(i=(s=f.audio).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||d)&&(f.audio.processor=c??d)),f.video&&(pd(f.video,n),(r=(o=f.video).deviceId)!==null&&r!==void 0||(o.deviceId={ideal:"default"}),(l||u)&&(f.video.processor=l??u)),f}function pd(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function _u(t){var e,n,i,r;const s={};if(t.video)if(typeof t.video=="object"){const o={},a=o,c=t.video;Object.keys(c).forEach(l=>{switch(l){case"resolution":pd(a,c.resolution);break;default:a[l]=c[l]}}),s.video=o,(e=(i=s.video).deviceId)!==null&&e!==void 0||(i.deviceId={ideal:"default"})}else s.video=t.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return t.audio?typeof t.audio=="object"?(s.audio=t.audio,(n=(r=s.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function ry(t){return A(this,arguments,void 0,function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const i=Nu();if(i){const r=i.createAnalyser();r.fftSize=2048;const s=r.frequencyBinCount,o=new Uint8Array(s);i.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(r),yield jt(n),r.getByteTimeDomainData(o);const c=o.some(l=>l!==128&&l!==0);return i.close(),!c}return!1}()})}function Nu(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const n=new e({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const i=()=>A(this,void 0,void 0,function*(){var r;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}(r=window.document.body)===null||r===void 0||r.removeEventListener("click",i)});window.document.body.addEventListener("click",i)}return n}}function vT(t){return t==="audioinput"?V.Source.Microphone:t==="videoinput"?V.Source.Camera:V.Source.Unknown}function gd(t){return t===V.Source.Microphone?"audioinput":t===V.Source.Camera?"videoinput":void 0}function yT(t){var e,n;let i=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(i=typeof i=="boolean"?{}:i,Xi()?i=Object.assign(Object.assign({},i),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):i=Object.assign(Object.assign({},i),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(n=t.audio)!==null&&n!==void 0?n:!1,video:i,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function sa(t){return t.split("/")[1].toLowerCase()}function bT(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new Eu({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function we(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?we(t.track):{})}}function xT(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function ST(t,e){var n;t===void 0&&(t={}),e===void 0&&(e={});const i=[...Object.keys(e),...Object.keys(t)],r={};for(const s of i)t[s]!==e[s]&&(r[s]=(n=e[s])!==null&&n!==void 0?n:"");return r}function sy(t){const e=Object.assign({},t);let n,i;return typeof e.audio=="object"&&e.audio.processor&&(n=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(i=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:$k(e)}}function wT(t){switch(t){case lt.CAMERA:return V.Source.Camera;case lt.MICROPHONE:return V.Source.Microphone;case lt.SCREEN_SHARE:return V.Source.ScreenShare;case lt.SCREEN_SHARE_AUDIO:return V.Source.ScreenShareAudio;default:return V.Source.Unknown}}class CT extends Nn.EventEmitter{constructor(e){super(),this.onWorkerMessage=n=>{var i,r;const{kind:s,data:o}=n.data;switch(s){case"error":Ce.error(o.error.message),this.emit(di.EncryptionError,o.error);break;case"initAck":o.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)});break;case"enable":if(o.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)}),this.encryptionEnabled!==o.enabled&&o.participantIdentity===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity))this.emit(di.ParticipantEncryptionStatusChanged,o.enabled,this.room.localParticipant),this.encryptionEnabled=o.enabled;else if(o.participantIdentity){const a=(r=this.room)===null||r===void 0?void 0:r.getParticipantByIdentity(o.participantIdentity);if(!a)throw TypeError("couldn't set encryption status, participant not found".concat(o.participantIdentity));this.emit(di.ParticipantEncryptionStatusChanged,o.enabled,a)}break;case"ratchetKey":this.keyProvider.emit(ui.KeyRatcheted,o.ratchetResult,o.participantIdentity,o.keyIndex);break}},this.onWorkerError=n=>{Ce.error("e2ee worker encountered an error:",{error:n.error}),this.emit(di.EncryptionError,n.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!Fk())throw new Iu("tried to setup end-to-end encryption on an unsupported browser");if(Ce.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ck.getLevel()}};this.worker&&(Ce.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){Ce.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?Ce.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(ae.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(U.TrackPublished,(i,r)=>this.setParticipantCryptorEnabled(i.trackInfo.encryption!==Ft.NONE,r.identity)),e.on(U.ConnectionStateChanged,i=>{i===ge.Connected&&e.remoteParticipants.forEach(r=>{r.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==Ft.NONE,r.identity)})})}).on(U.TrackUnsubscribed,(i,r,s)=>{var o;const a={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:i.mediaStreamID}};(o=this.worker)===null||o===void 0||o.postMessage(a)}).on(U.TrackSubscribed,(i,r,s)=>{this.setupE2EEReceiver(i,s.identity,r.trackInfo)}).on(U.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");n.getKeys().forEach(i=>{this.postKey(i)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(Z.LocalTrackPublished,i=>A(this,void 0,void 0,function*(){this.setupE2EESender(i.track,i.track.sender)})),n.on(ui.SetKey,i=>this.postKey(i)).on(ui.RatchetRequest,(i,r)=>this.postRatchetRequest(i,r))}postRatchetRequest(e,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const i={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:n}};this.worker.postMessage(i)}postKey(e){let{key:n,participantIdentity:i,keyIndex:r}=e;var s;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:i,isPublisher:i===((s=this.room)===null||s===void 0?void 0:s.localParticipant.identity),key:n,keyIndex:r}};this.worker.postMessage(o)}postEnable(e,n){if(this.worker){const i={kind:"enable",data:{enabled:e,participantIdentity:n}};this.worker.postMessage(i)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const i={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(n)}setupE2EEReceiver(e,n,i){if(e.receiver){if(!(i!=null&&i.mimeType)||i.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,n,e.kind==="video"?sa(i.mimeType):void 0)}}setupE2EESender(e,n){if(!jr(e)||!n){n||Ce.warn("early return because sender is not ready");return}this.handleSender(n,e.mediaStreamID,void 0)}handleReceiver(e,n,i,r){return A(this,void 0,void 0,function*(){if(this.worker){if(sd()){const s={kind:"decode",participantIdentity:i,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(Ss in e&&r){const c={kind:"updateCodec",data:{trackId:n,codec:r,participantIdentity:i}};this.worker.postMessage(c);return}let s=e.writableStream,o=e.readableStream;if(!s||!o){const c=e.createEncodedStreams();e.writableStream=c.writable,s=c.writable,e.readableStream=c.readable,o=c.readable}const a={kind:"decode",data:{readableStream:o,writableStream:s,trackId:n,codec:r,participantIdentity:i,isReuse:Ss in e}};this.worker.postMessage(a,[o,s])}e[Ss]=!0}})}handleSender(e,n,i){var r;if(!(Ss in e||!this.worker)){if(!(!((r=this.room)===null||r===void 0)&&r.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(sd()){Ce.info("initialize script transform");const s={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{Ce.info("initialize encoded streams");const s=e.createEncodedStreams(),o={kind:"encode",data:{readableStream:s.readable,writableStream:s.writable,codec:i,trackId:n,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(o,[s.readable,s.writable])}e[Ss]=!0}}}const zc="default";class gt{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new gt),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return A(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;if(((s=gt.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){Ce.debug("awaiting getUserMedia promise");try{n?yield gt.userMediaPromiseMap.get(n):yield Promise.all(gt.userMediaPromiseMap.values())}catch{Ce.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(r&&!(Xi()&&i.hasDeviceInUse(n))&&(o.filter(c=>c.kind===n).length===0||o.some(c=>{const l=c.label==="",d=n?c.kind===n:!0;return l&&d}))){const c={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},l=yield navigator.mediaDevices.getUserMedia(c);o=yield navigator.mediaDevices.enumerateDevices(),l.getTracks().forEach(d=>{d.stop()})}return i._previousDevices=o,n&&(o=o.filter(a=>a.kind===n)),o}()})}normalizeDeviceId(e,n,i){return A(this,void 0,void 0,function*(){if(n!==zc)return n;const r=yield this.getDevices(e),s=r.find(a=>a.deviceId===zc);if(!s){Ce.warn("could not reliably determine default device");return}const o=r.find(a=>a.deviceId!==zc&&a.groupId===(i??s.groupId));if(!o){Ce.warn("could not reliably determine default device");return}return o==null?void 0:o.deviceId})}hasDeviceInUse(e){return e?gt.userMediaPromiseMap.has(e):gt.userMediaPromiseMap.size>0}}gt.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];gt.userMediaPromiseMap=new Map;var Ls;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(Ls||(Ls={}));class kT{constructor(){this.pendingTasks=new Map,this.taskMutex=new Nt,this.nextTaskIndex=0}run(e){return A(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:Ls.WAITING};this.pendingTasks.set(n.id,n);const i=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=Ls.RUNNING,yield e()}finally{n.status=Ls.COMPLETED,this.pendingTasks.delete(n.id),i()}})}flush(){return A(this,void 0,void 0,function*(){return this.run(()=>A(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function TT(t,e){const n=new URL(uT(t));return e.forEach((i,r)=>{n.searchParams.set(r,i)}),oy(n,"rtc")}function ET(t){const e=new URL(hd(t));return oy(e,"validate")}function PT(t){return t.endsWith("/")?t:"".concat(t,"/")}function oy(t,e){return t.pathname="".concat(PT(t.pathname)).concat(e),t.toString()}const RT=["syncState","trickle","offer","answer","simulate","leave"];function AT(t){const e=RT.indexOf(t.case)>=0;return Ce.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var Be;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(Be||(Be={}));class Ou{get currentState(){return this.state}get isDisconnected(){return this.state===Be.DISCONNECTING||this.state===Be.DISCONNECTED}get isEstablishingConnection(){return this.state===Be.CONNECTING||this.state===Be.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;this.rtt=0,this.state=Be.DISCONNECTED,this.log=Ce,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=Gn((i=n.loggerName)!==null&&i!==void 0?i:fn.Signal),this.loggerContextCb=n.loggerContextCb,this.useJSON=e,this.requestQueue=new kT,this.queuedRequests=[],this.closingLock=new Nt,this.connectionLock=new Nt,this.state=Be.DISCONNECTED}get logContext(){var e,n;return(n=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:{}}join(e,n,i,r){return A(this,void 0,void 0,function*(){return this.state=Be.CONNECTING,this.options=i,yield this.connect(e,n,i,r)})}reconnect(e,n,i,r){return A(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=Be.RECONNECTING,this.clearPingInterval(),yield this.connect(e,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:i,reconnectReason:r}))})}connect(e,n,i,r){this.connectOptions=i;const s=cT(),o=IT(n,s,i),a=TT(e,o),c=ET(a);return new Promise((l,d)=>A(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const f=()=>A(this,void 0,void 0,function*(){this.close(),clearTimeout(p),d(new Ue("room connection has been cancelled (signal)",Te.Cancelled))}),p=setTimeout(()=>{this.close(),d(new Ue("room connection has timed out (signal)",Te.ServerUnreachable))},i.websocketTimeout);r!=null&&r.aborted&&f(),r==null||r.addEventListener("abort",f);const g=new URL(a);g.searchParams.has("access_token")&&g.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(g),Object.assign({reconnect:i.reconnect,reconnectReason:i.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(p)},this.ws.onerror=h=>A(this,void 0,void 0,function*(){if(this.state!==Be.CONNECTED){this.state=Be.DISCONNECTED,clearTimeout(p);try{const y=yield fetch(c);if(y.status.toFixed(0).startsWith("4")){const b=yield y.text();d(new Ue(b,Te.NotAllowed,y.status))}else d(new Ue("Encountered unknown websocket error during connection: ".concat(h.toString()),Te.InternalError,y.status))}catch(y){d(new Ue(y instanceof Error?y.message:"server was not reachable",Te.ServerUnreachable))}return}this.handleWSError(h)}),this.ws.onmessage=h=>A(this,void 0,void 0,function*(){var y,b,w;let C;if(typeof h.data=="string"){const S=JSON.parse(h.data);C=Dh.fromJson(S,{ignoreUnknownFields:!0})}else if(h.data instanceof ArrayBuffer)C=Dh.fromBinary(new Uint8Array(h.data));else{this.log.error("could not decode websocket message: ".concat(typeof h.data),this.logContext);return}if(this.state!==Be.CONNECTED){let S=!1;if(((y=C.message)===null||y===void 0?void 0:y.case)==="join"?(this.state=Be.CONNECTED,r==null||r.removeEventListener("abort",f),this.pingTimeoutDuration=C.message.value.pingTimeout,this.pingIntervalDuration=C.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),l(C.message.value)):this.state===Be.RECONNECTING&&C.message.case!=="leave"?(this.state=Be.CONNECTED,r==null||r.removeEventListener("abort",f),this.startPingInterval(),((b=C.message)===null||b===void 0?void 0:b.case)==="reconnect"?l(C.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),l(void 0),S=!0)):this.isEstablishingConnection&&C.message.case==="leave"?d(new Ue("Received leave request while trying to (re)connect",Te.LeaveRequest,void 0,C.message.value.reason)):i.reconnect||d(new Ue("did not receive join response, got ".concat((w=C.message)===null||w===void 0?void 0:w.case," instead"),Te.InternalError)),!S)return}this.signalLatency&&(yield jt(this.signalLatency)),this.handleSignalResponse(C)}),this.ws.onclose=h=>{this.isEstablishingConnection&&d(new Ue("Websocket got closed during a (re)connection attempt",Te.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:h.reason,code:h.code,wasClean:h.wasClean,state:this.state})),this.handleOnClose(h.reason)}}finally{u()}}))}close(){return A(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const i=yield e.closingLock.lock();try{if(e.clearPingInterval(),n&&(e.state=Be.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const r=new Promise(s=>{e.ws?e.ws.onclose=()=>{s()}:s()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([r,jt(250)])),e.ws=void 0}}finally{n&&(e.state=Be.DISCONNECTED),i()}}()})}sendOffer(e,n){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:ka(e,n)})}sendAnswer(e,n){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:ka(e,n)})}sendIceCandidate(e,n){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new ku({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new Tu({sid:e,muted:n})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,n){return A(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const a=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new mv({requestId:a,metadata:i,name:r,attributes:o})}),a}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,n){return this.sendRequest({case:"updateLayers",value:new hv({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new vv({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:ze.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Sv({timestamp:ze.parse(Date.now()),rtt:ze.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new fv({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new Za({reason:dn.CLIENT_INITIATED,action:Nr.DISCONNECT})})}sendRequest(e){return A(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!r&&!AT(n)&&i.state===Be.RECONNECTING){i.queuedRequests.push(()=>A(i,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(r||(yield i.requestQueue.flush()),i.signalLatency&&(yield jt(i.signalLatency)),!i.ws||i.ws.readyState!==i.ws.OPEN){i.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case),i.logContext);return}const o=new YC({message:n});try{i.useJSON?i.ws.send(o.toJsonString()):i.ws.send(o.toBinary())}catch(a){i.log.error("error sending signal message",Object.assign(Object.assign({},i.logContext),{error:a}))}}()})}handleSignalResponse(e){var n,i;const r=e.message;if(r==null){this.log.debug("received unsupported message",this.logContext);return}let s=!1;if(r.case==="answer"){const o=sm(r.value);this.onAnswer&&this.onAnswer(o,r.value.id)}else if(r.case==="offer"){const o=sm(r.value);this.onOffer&&this.onOffer(o,r.value.id)}else if(r.case==="trickle"){const o=JSON.parse(r.value.candidateInit);this.onTrickle&&this.onTrickle(o,r.value.target)}else r.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=r.value.participants)!==null&&n!==void 0?n:[]):r.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(r.value):r.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((i=r.value.speakers)!==null&&i!==void 0?i:[]):r.case==="leave"?this.onLeave&&this.onLeave(r.value):r.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(r.value.sid,r.value.muted):r.case==="roomUpdate"?this.onRoomUpdate&&r.value.room&&this.onRoomUpdate(r.value.room):r.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(r.value):r.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(r.value):r.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(r.value):r.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(r.value):r.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(r.value):r.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(r.value):r.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(r.value):r.case==="pong"||(r.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(r.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):r.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(r.value):r.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(r.value.trackSid):r.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(r.value.token),this.onRoomMoved&&this.onRoomMoved(r.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:r.case})));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return A(this,void 0,void 0,function*(){if(this.state===Be.DISCONNECTED)return;const n=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),n&&n(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=bt.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&bt.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=bt.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&bt.clearInterval(this.pingInterval)}}function sm(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function ka(t,e){return new Ji({sdp:t.sdp,type:t.type,id:e})}function IT(t,e,n){var i;const r=new URLSearchParams;return r.set("access_token",t),n.reconnect&&(r.set("reconnect","1"),n.sid&&r.set("sid",n.sid)),r.set("auto_subscribe",n.autoSubscribe?"1":"0"),r.set("sdk",In()?"reactnative":"js"),r.set("version",e.version),r.set("protocol",e.protocol.toString()),e.deviceModel&&r.set("device_model",e.deviceModel),e.os&&r.set("os",e.os),e.osVersion&&r.set("os_version",e.osVersion),e.browser&&r.set("browser",e.browser),e.browserVersion&&r.set("browser_version",e.browserVersion),n.adaptiveStream&&r.set("adaptive_stream","1"),n.reconnectReason&&r.set("reconnect_reason",n.reconnectReason.toString()),!((i=navigator.connection)===null||i===void 0)&&i.type&&r.set("network",navigator.connection.type),r}class om{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const n=this.buffer[0];if(this._totalSize-n.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class MT{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,n){const i=Date.now();i-this._lastCleanup>this.ttl/2&&this.cleanup();const r=i+this.ttl;return this._map.set(e,{value:n,expiresAt:r}),this}get(e){const n=this._map.get(e);if(n){if(n.expiresAt<Date.now()){this._map.delete(e);return}return n.value}}has(e){const n=this._map.get(e);return n?n.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[n,i]of this._map.entries())i.expiresAt<e&&this._map.delete(n);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[n,i]of this._map.entries())i.expiresAt>=Date.now()&&e(i.value,n,this.asValueMap())}map(e){this.cleanup();const n=[],i=this.asValueMap();for(const[r,s]of i.entries())n.push(e(s,r,i));return n}asValueMap(){const e=new Map;for(const[n,i]of this._map.entries())i.expiresAt>=Date.now()&&e.set(n,i.value);return e}}var nn={},Wc={},qc={exports:{}},am;function Du(){if(am)return qc.exports;am=1;var t=qc.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var n="candidate:%s %d %s %d %s %d typ %s";return n+=e.raddr!=null?" raddr %s rport %d":"%v%v",n+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(n+=" generation %d"),n+=e["network-id"]!=null?" network-id %d":"%v",n+=e["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var n="ssrc:%d";return e.attribute!=null&&(n+=" %s",e.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var n="mediaclk:";return n+=e.id!=null?"id=%s %s":"%v%s",n+=e.mediaClockValue!=null?"=%s":"",n+=e.rateNumerator!=null?" rate=%s":"",n+=e.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var n=t[e];n.forEach(function(i){i.reg||(i.reg=/(.*)/),i.format||(i.format="%s")})}),qc.exports}var cm;function _T(){return cm||(cm=1,function(t){var e=function(a){return String(Number(a))===a?Number(a):a},n=function(a,c,l,d){if(d&&!l)c[d]=e(a[1]);else for(var u=0;u<l.length;u+=1)a[u+1]!=null&&(c[l[u]]=e(a[u+1]))},i=function(a,c,l){var d=a.name&&a.names;a.push&&!c[a.push]?c[a.push]=[]:d&&!c[a.name]&&(c[a.name]={});var u=a.push?{}:d?c[a.name]:c;n(l.match(a.reg),u,a.names,a.name),a.push&&c[a.push].push(u)},r=Du(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(a){var c={},l=[],d=c;return a.split(/(\r\n|\r|\n)/).filter(s).forEach(function(u){var f=u[0],p=u.slice(2);f==="m"&&(l.push({rtp:[],fmtp:[]}),d=l[l.length-1]);for(var g=0;g<(r[f]||[]).length;g+=1){var h=r[f][g];if(h.reg.test(p))return i(h,d,p)}}),c.media=l,c};var o=function(a,c){var l=c.split(/=(.+)/,2);return l.length===2?a[l[0]]=e(l[1]):l.length===1&&c.length>1&&(a[l[0]]=void 0),a};t.parseParams=function(a){return a.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(a){return a.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(a){for(var c=[],l=a.split(" ").map(e),d=0;d<l.length;d+=3)c.push({component:l[d],ip:l[d+1],port:l[d+2]});return c},t.parseImageAttributes=function(a){return a.split(" ").map(function(c){return c.substring(1,c.length-1).split(",").reduce(o,{})})},t.parseSimulcastStreamList=function(a){return a.split(";").map(function(c){return c.split(",").map(function(l){var d,u=!1;return l[0]!=="~"?d=e(l):(d=e(l.substring(1,l.length)),u=!0),{scid:d,paused:u}})})}}(Wc)),Wc}var Kc,lm;function NT(){if(lm)return Kc;lm=1;var t=Du(),e=/%[sdv%]/g,n=function(o){var a=1,c=arguments,l=c.length;return o.replace(e,function(d){if(a>=l)return d;var u=c[a];switch(a+=1,d){case"%%":return"%";case"%s":return String(u);case"%d":return Number(u);case"%v":return""}})},i=function(o,a,c){var l=a.format instanceof Function?a.format(a.push?c:c[a.name]):a.format,d=[o+"="+l];if(a.names)for(var u=0;u<a.names.length;u+=1){var f=a.names[u];a.name?d.push(c[a.name][f]):d.push(c[a.names[u]])}else d.push(c[a.name]);return n.apply(null,d)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return Kc=function(o,a){a=a||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEach(function(u){u.payloads==null&&(u.payloads="")});var c=a.outerOrder||r,l=a.innerOrder||s,d=[];return c.forEach(function(u){t[u].forEach(function(f){f.name in o&&o[f.name]!=null?d.push(i(u,f,o)):f.push in o&&o[f.push]!=null&&o[f.push].forEach(function(p){d.push(i(u,f,p))})})}),o.media.forEach(function(u){d.push(i("m",t.m[0],u)),l.forEach(function(f){t[f].forEach(function(p){p.name in u&&u[p.name]!=null?d.push(i(f,p,u)):p.push in u&&u[p.push]!=null&&u[p.push].forEach(function(g){d.push(i(f,p,g))})})})}),d.join(`\r
66
+ `)+`\r
67
+ `},Kc}var dm;function OT(){if(dm)return nn;dm=1;var t=_T(),e=NT(),n=Du();return nn.grammar=n,nn.write=e,nn.parse=t.parse,nn.parseParams=t.parseParams,nn.parseFmtpConfig=t.parseFmtpConfig,nn.parsePayloads=t.parsePayloads,nn.parseRemoteCandidates=t.parseRemoteCandidates,nn.parseImageAttributes=t.parseImageAttributes,nn.parseSimulcastStreamList=t.parseSimulcastStreamList,nn}var si=OT();function ju(t,e,n){var i,r,s;e===void 0&&(e=50),n===void 0&&(n={});var o=(i=n.isImmediate)!=null&&i,a=(r=n.callback)!=null&&r,c=n.maxWait,l=Date.now(),d=[];function u(){if(c!==void 0){var p=Date.now()-l;if(p+e>=c)return c-p}return e}var f=function(){var p=[].slice.call(arguments),g=this;return new Promise(function(h,y){var b=o&&s===void 0;if(s!==void 0&&clearTimeout(s),s=setTimeout(function(){if(s=void 0,l=Date.now(),!o){var C=t.apply(g,p);a&&a(C),d.forEach(function(S){return(0,S.resolve)(C)}),d=[]}},u()),b){var w=t.apply(g,p);return a&&a(w),h(w)}d.push({resolve:h,reject:y})})};return f.cancel=function(p){s!==void 0&&clearTimeout(s),d.forEach(function(g){return(0,g.reject)(p)}),d=[]},f}const DT=.7,jT=20,Lr={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class um extends Nn.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;super(),this.log=Ce,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=ju(r=>A(this,void 0,void 0,function*(){this.emit(Lr.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(r)r(s);else throw s}}),jT),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=Gn((i=n.loggerName)!==null&&i!==void 0?i:fn.PCTransport),this.loggerOptions=n,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=n=>{var i;n.candidate&&((i=this.onIceCandidate)===null||i===void 0||i.call(this,n.candidate))},e.onicecandidateerror=n=>{var i;(i=this.onIceCandidateError)===null||i===void 0||i.call(this,n)},e.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,e.connectionState)},e.ondatachannel=n=>{var i;(i=this.onDataChannel)===null||i===void 0||i.call(this,n)},e.ontrack=n=>{var i;(i=this.onTrack)===null||i===void 0||i.call(this,n)},e}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return A(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,n){return A(this,void 0,void 0,function*(){var i;if(e.type==="answer"&&this.latestOfferId>0&&n>0&&n!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:n,latestOfferId:this.latestOfferId})),!1;let r;if(e.type==="offer"){let{stereoMids:s,nackMids:o}=LT(e);this.remoteStereoMids=s,this.remoteNackMids=o}else if(e.type==="answer"){const s=si.parse((i=e.sdp)!==null&&i!==void 0?i:"");s.media.forEach(o=>{o.type==="audio"&&this.trackBitrates.some(a=>{if(!a.transceiver||o.mid!=a.transceiver.mid)return!1;let c=0;if(o.rtp.some(d=>d.codec.toUpperCase()===a.codec.toUpperCase()?(c=d.payload,!0):!1),c===0)return!0;let l=!1;for(const d of o.fmtp)if(d.payload===c){d.config=d.config.split(";").filter(u=>!u.includes("maxaveragebitrate")).join(";"),a.maxbr>0&&(d.config+=";maxaveragebitrate=".concat(a.maxbr*1e3)),l=!0;break}return l||a.maxbr>0&&o.fmtp.push({payload:c,config:"maxaveragebitrate=".concat(a.maxbr*1e3)}),!0})}),r=si.write(s)}return yield this.setMungedSDP(e,r,!0),this.pendingCandidates.forEach(s=>{this.pc.addIceCandidate(s)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Lr.NegotiationComplete),e.sdp&&si.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(Lr.RTPVideoPayloadTypes,o.rtp)})),!0})}createAndSendOffer(e){return A(this,void 0,void 0,function*(){var n;const i=this.latestOfferId+1;if(this.latestOfferId=i,this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const o=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&o)yield this._pc.setRemoteDescription(o);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const r=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:r.sdp},this.logContext));const s=si.parse((n=r.sdp)!==null&&n!==void 0?n:"");if(s.media.forEach(o=>{hm(o),o.type==="audio"?fm(o,[],[]):o.type==="video"&&this.trackBitrates.some(a=>{if(!o.msid||!a.cid||!o.msid.includes(a.cid))return!1;let c=0;if(o.rtp.some(d=>d.codec.toUpperCase()===a.codec.toUpperCase()?(c=d.payload,!0):!1),c===0||(Kn(a.codec)&&this.ensureVideoDDExtensionForSVC(o,s),a.codec!=="av1"))return!0;const l=Math.round(a.maxbr*DT);for(const d of o.fmtp)if(d.payload===c){d.config.includes("x-google-start-bitrate")||(d.config+=";x-google-start-bitrate=".concat(l));break}return!0})}),this.latestOfferId>i){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:i}));return}yield this.setMungedSDP(r,si.write(s)),this.onOffer(r,this.latestOfferId)})}createAndSetAnswer(){return A(this,void 0,void 0,function*(){var e;const n=yield this.pc.createAnswer(),i=si.parse((e=n.sdp)!==null&&e!==void 0?e:"");return i.media.forEach(r=>{hm(r),r.type==="audio"&&fm(r,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,si.write(i)),n})}createDataChannel(e,n){return this.pc.createDataChannel(e,n)}addTransceiver(e,n){return this.pc.addTransceiver(e,n)}addTrack(e){if(!this._pc)throw new ht("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var n;if(!this._pc)throw new ht("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(e)}getConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return A(this,void 0,void 0,function*(){var e;if(!this._pc)return;let n="";const i=new Map,r=new Map;if((yield this._pc.getStats()).forEach(a=>{switch(a.type){case"transport":n=a.selectedCandidatePairId;break;case"candidate-pair":n===""&&a.selected&&(n=a.id),i.set(a.id,a);break;case"remote-candidate":r.set(a.id,"".concat(a.address,":").concat(a.port));break}}),n==="")return;const o=(e=i.get(n))===null||e===void 0?void 0:e.remoteCandidateId;if(o!==void 0)return r.get(o)})}setMungedSDP(e,n,i){return A(this,void 0,void 0,function*(){if(n){const r=e.sdp;e.sdp=n;try{this.log.debug("setting munged ".concat(i?"remote":"local"," description"),this.logContext),i?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(s){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:s,sdp:n})),e.sdp=r}}try{i?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(r){let s="unknown error";r instanceof Error?s=r.message:typeof r=="string"&&(s=r);const o={error:s,sdp:e.sdp};throw!i&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:o})),new od(s)}})}ensureVideoDDExtensionForSVC(e,n){var i,r;if(!((i=e.ext)===null||i===void 0?void 0:i.some(o=>o.uri===Xh))){if(this.ddExtID===0){let o=0;n.media.forEach(a=>{var c;a.type==="video"&&((c=a.ext)===null||c===void 0||c.forEach(l=>{l.value>o&&(o=l.value)}))}),this.ddExtID=o+1}(r=e.ext)===null||r===void 0||r.push({value:this.ddExtID,uri:Xh})}}}function fm(t,e,n){let i=0;t.rtp.some(r=>r.codec==="opus"?(i=r.payload,!0):!1),i>0&&(t.rtcpFb||(t.rtcpFb=[]),n.includes(t.mid)&&!t.rtcpFb.some(r=>r.payload===i&&r.type==="nack")&&t.rtcpFb.push({payload:i,type:"nack"}),e.includes(t.mid)&&t.fmtp.some(r=>r.payload===i?(r.config.includes("stereo=1")||(r.config+=";stereo=1"),!0):!1))}function LT(t){var e;const n=[],i=[],r=si.parse((e=t.sdp)!==null&&e!==void 0?e:"");let s=0;return r.media.forEach(o=>{var a;o.type==="audio"&&(o.rtp.some(c=>c.codec==="opus"?(s=c.payload,!0):!1),!((a=o.rtcpFb)===null||a===void 0)&&a.some(c=>c.payload===s&&c.type==="nack")&&i.push(o.mid),o.fmtp.some(c=>c.payload===s?(c.config.includes("sprop-stereo=1")&&n.push(o.mid),!0):!1))}),{stereoMids:n,nackMids:i}}function hm(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}const vd="vp8",VT={audioPreset:ad.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:Mu.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:vd,backupCodec:!0,preConnectBuffer:!1},ay={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},cy={deviceId:{ideal:"default"},resolution:zs.h720.resolution},FT={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new Tk,disconnectOnPageLeave:!0,webAudioMix:!1},Lu={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Je;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Je||(Je={}));class UT{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,n,i){var r;this.peerConnectionTimeout=Lu.peerConnectionTimeout,this.log=Ce,this.updateState=()=>{var s;const o=this.state,a=this.requiredTransports.map(c=>c.getConnectionState());a.every(c=>c==="connected")?this.state=Je.CONNECTED:a.some(c=>c==="failed")?this.state=Je.FAILED:a.some(c=>c==="connecting")?this.state=Je.CONNECTING:a.every(c=>c==="closed")?this.state=Je.CLOSED:a.some(c=>c==="closed")?this.state=Je.CLOSING:a.every(c=>c==="new")&&(this.state=Je.NEW),o!==this.state&&(this.log.debug("pc state change: from ".concat(Je[o]," to ").concat(Je[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=Gn((r=i.loggerName)!==null&&r!==void 0?r:fn.PCManager),this.loggerOptions=i,this.isPublisherConnectionRequired=!n,this.isSubscriberConnectionRequired=n,this.publisher=new um(e,i),this.subscriber=new um(e,i),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,ln.PUBLISHER)},this.subscriber.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,ln.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var o;(o=this.onDataChannel)===null||o===void 0||o.call(this,s)},this.subscriber.onTrack=s=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,s)},this.publisher.onOffer=(s,o)=>{var a;(a=this.onPublisherOffer)===null||a===void 0||a.call(this,s,o)},this.state=Je.NEW,this.connectionLock=new Nt,this.remoteOfferLock=new Nt}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,n){return this.publisher.setRemoteDescription(e,n)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return A(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const n of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(n)}catch(i){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:i}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return A(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,n){return A(this,void 0,void 0,function*(){n===ln.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,n){return A(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const i=yield this.remoteOfferLock.lock();try{return(yield this.subscriber.setRemoteDescription(e,n))?yield this.subscriber.createAndSetAnswer():void 0}finally{i()}})}updateConfiguration(e,n){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),n&&this.triggerIceRestart()}ensurePCTransportConnection(e,n){return A(this,void 0,void 0,function*(){var i;const r=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((i=this.requiredTransports)===null||i===void 0?void 0:i.map(s=>this.ensureTransportConnected(s,e,n)))}finally{r()}})}negotiate(e){return A(this,void 0,void 0,function*(){return new Promise((n,i)=>A(this,void 0,void 0,function*(){const r=setTimeout(()=>{i("negotiation timed out")},this.peerConnectionTimeout),s=()=>{clearTimeout(r),i("negotiation aborted")};e.signal.addEventListener("abort",s),this.publisher.once(Lr.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Lr.NegotiationComplete,()=>{clearTimeout(r),n()})}),yield this.publisher.negotiate(o=>{clearTimeout(r),i(o)})}))})}addPublisherTransceiver(e,n){return this.publisher.addTransceiver(e,n)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,n){return this.publisher.createDataChannel(e,n)}getConnectedAddress(e){return e===ln.PUBLISHER?this.publisher.getConnectedAddress():e===ln.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,n){return A(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(i.getConnectionState()!=="connected")return new Promise((c,l)=>A(s,void 0,void 0,function*(){const d=()=>{this.log.warn("abort transport connection",this.logContext),bt.clearTimeout(u),l(new Ue("room connection has been cancelled",Te.Cancelled))};r!=null&&r.signal.aborted&&d(),r==null||r.signal.addEventListener("abort",d);const u=bt.setTimeout(()=>{r==null||r.signal.removeEventListener("abort",d),l(new Ue("could not establish pc connection",Te.InternalError))},o);for(;this.state!==Je.CONNECTED;)if(yield jt(50),r!=null&&r.signal.aborted){l(new Ue("room connection has been cancelled",Te.Cancelled));return}bt.clearTimeout(u),r==null||r.signal.removeEventListener("abort",d),c()}))}()})}}class Qe extends Error{constructor(e,n,i){super(n),this.code=e,this.message=mm(n,Qe.MAX_MESSAGE_BYTES),this.data=i?mm(i,Qe.MAX_DATA_BYTES):void 0}static fromProto(e){return new Qe(e.code,e.message,e.data)}toProto(){return new nv({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new Qe(Qe.ErrorCode[e],Qe.ErrorMessage[e],n)}}Qe.MAX_MESSAGE_BYTES=256;Qe.MAX_DATA_BYTES=15360;Qe.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};Qe.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const ly=15360;function Vu(t){return new TextEncoder().encode(t).length}function mm(t,e){if(Vu(t)<=e)return t;let n=0,i=t.length;const r=new TextEncoder;for(;n<i;){const s=Math.floor((n+i+1)/2);r.encode(t.slice(0,s)).length<=e?n=s:i=s-1}return t.slice(0,n)}const Fu=2e3;function Ja(t,e){if(!e)return 0;let n,i;return"bytesReceived"in t?(n=t.bytesReceived,i=e.bytesReceived):"bytesSent"in t&&(n=t.bytesSent,i=e.bytesSent),n===void 0||i===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(n-i)*8*1e3/(t.timestamp-e.timestamp)}const Uu=typeof MediaRecorder<"u";class BT{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const $T=Uu?MediaRecorder:BT;class HT extends $T{constructor(e,n){if(!Uu)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([e.mediaStreamTrack]),n);let i,r;const s=()=>r===void 0,o=()=>{this.removeEventListener("dataavailable",i),this.removeEventListener("stop",o),this.removeEventListener("error",a),r==null||r.close(),r=void 0},a=c=>{r==null||r.error(c),this.removeEventListener("dataavailable",i),this.removeEventListener("stop",o),this.removeEventListener("error",a),r=void 0};this.byteStream=new ReadableStream({start:c=>{r=c,i=l=>A(this,void 0,void 0,function*(){const d=yield l.data.arrayBuffer();s()||c.enqueue(new Uint8Array(d))}),this.addEventListener("dataavailable",i)},cancel:()=>{o()}}),this.addEventListener("stop",o),this.addEventListener("error",a)}}function zT(){return Uu}const WT=1e3,qT=1e4;class dy extends V{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,n,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(e,n,s),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=ju(()=>A(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>A(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(re.Ended,this)},this.reacquireTrack=!1,this.providedByUser=r,this.muteLock=new Nt,this.pauseUpstreamLock=new Nt,this.processorLock=new Nt,this.restartLock=new Nt,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),i&&(this._constraints=i)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==V.Kind.Video)return;const{width:e,height:n}=this._mediaStreamTrack.getSettings();if(e&&n)return{width:e,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,n;return(n=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,n){return A(this,void 0,void 0,function*(){var i;if(e===this._mediaStreamTrack&&!n)return;this._mediaStreamTrack&&(this.attachedElements.forEach(s=>{Dr(this._mediaStreamTrack,s)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let r;if(this.processor&&e){const s=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(kr(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),r=this.processor.processedTrack}finally{s()}}this.sender&&((i=this.sender.transport)===null||i===void 0?void 0:i.state)!=="closed"&&(yield this.sender.replaceTrack(r??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(s=>{kr(r??e,s)}))})}waitForDimensions(){return A(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:WT;return function*(){var i;if(e.kind===V.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((i=$t())===null||i===void 0?void 0:i.os)==="iOS"&&(yield jt(10));const r=Date.now();for(;Date.now()-r<n;){const s=e.dimensions;if(s)return s;yield jt(50)}throw new Wn("unable to get track dimensions after timeout")}()})}setDeviceId(e){return A(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===fi(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),fi(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return A(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===V.Source.ScreenShare)return;const{deviceId:i,groupId:r}=e._mediaStreamTrack.getSettings(),s=e.kind===V.Kind.Audio?"audioinput":"videoinput";return n?gt.getInstance().normalizeDeviceId(s,i,r):i}()})}mute(){return A(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return A(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,n){return A(this,void 0,void 0,function*(){if(!this.sender)throw new Wn("unable to replace an unpublished track");let i,r;return typeof n=="boolean"?i=n:n!==void 0&&(i=n.userProvidedTrack,r=n.stopProcessor),this.providedByUser=i??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),r&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return A(this,void 0,void 0,function*(){this.manuallyStopped=!1;const n=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:i,facingMode:r}=e,s=Ek(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===V.Kind.Video?o.video=i||r?{deviceId:i,facingMode:r}:!0:o.audio=i?{deviceId:i}:!0,this.attachedElements.forEach(l=>{Dr(this.mediaStreamTrack,l)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const c=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return yield c.applyConstraints(s),c.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(c),this._constraints=e,this.emit(re.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{n()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?re.Muted:re.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return A(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),ey()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return A(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(re.UpstreamPaused,this);const i=$t();if((i==null?void 0:i.name)==="Safari"&&mi(i.version,"12.0")<0)throw new Iu("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return A(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(re.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return A(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return A(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;const o=yield i.processorLock.lock();try{i.log.debug("setting up processor",i.logContext);const a=document.createElement(i.kind),c={kind:i.kind,track:i._mediaStreamTrack,element:a,audioContext:i.audioContext};if(yield n.init(c),i.log.debug("processor initialized",i.logContext),i.processor&&(yield i.stopProcessor()),i.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(kr(i._mediaStreamTrack,a),a.muted=!0,a.play().catch(l=>i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{error:l}))),i.processor=n,i.processorElement=a,i.processor.processedTrack){for(const l of i.attachedElements)l!==i.processorElement&&r&&(Dr(i._mediaStreamTrack,l),kr(i.processor.processedTrack,l));yield(s=i.sender)===null||s===void 0?void 0:s.replaceTrack(i.processor.processedTrack)}i.emit(re.TrackProcessorUpdate,i.processor)}finally{o()}}()})}getProcessor(){return this.processor}stopProcessor(){return A(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var i,r;e.processor&&(e.log.debug("stopping processor",e.logContext),(i=e.processor.processedTrack)===null||i===void 0||i.stop(),yield e.processor.destroy(),e.processor=void 0,n||((r=e.processorElement)===null||r===void 0||r.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(re.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!zT()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(!this.localTrackRecorder)this.localTrackRecorder=new HT(this,{mimeType:"audio/webm;codecs=opus"});else{this.log.warn("preconnect buffer already started");return}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},qT)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.byteStream}}class Ta extends dy{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(e,V.Kind.Audio,n,i,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>A(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let o;try{o=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}o&&this.prevStats&&(this._currentBitrate=Ja(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(re.AudioTrackFeatureUpdate,this,pt.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(re.AudioTrackFeatureUpdate,this,pt.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=r,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return A(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===V.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return A(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const i=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==fi(this._constraints.deviceId);return this.source===V.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||i)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{n()}})}restartTrack(e){return A(this,void 0,void 0,function*(){let n;if(e){const i=_u({audio:e});typeof i.audio!="boolean"&&(n=i.audio)}yield this.restart(n)})}restart(e){const n=Object.create(null,{restart:{get:()=>super.restart}});return A(this,void 0,void 0,function*(){const i=yield n.restart.call(this,e);return this.checkForSilence(),i})}startMonitor(){Ot()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Fu)))}setProcessor(e){return A(this,void 0,void 0,function*(){var n;const i=yield this.processorLock.lock();try{if(!In()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const r={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(r),this.processor=e,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(re.TrackProcessorUpdate,this.processor)}finally{i()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return A(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const n=yield this.sender.getStats();let i;return n.forEach(r=>{r.type==="outbound-rtp"&&(i={type:"audio",streamId:r.id,packetsSent:r.packetsSent,packetsLost:r.packetsLost,bytesSent:r.bytesSent,timestamp:r.timestamp,roundTripTime:r.roundTripTime,jitter:r.jitter})}),i})}checkForSilence(){return A(this,void 0,void 0,function*(){const e=yield ry(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(re.AudioSilenceDetected)),e})}}function KT(t,e,n){switch(t.kind){case"audio":return new Ta(t,e,!1,void 0,n);case"video":return new Ea(t,e,!1,n);default:throw new Wn("unsupported track type: ".concat(t.kind))}}const GT=Object.values(zs),ZT=Object.values(cd),YT=Object.values(Mu),JT=[zs.h180,zs.h360],XT=[cd.h180,cd.h360],QT=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var i,r;return new je(Math.floor(t.width/n.scaleResolutionDownBy),Math.floor(t.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((i=t.encoding.maxFramerate)!==null&&i!==void 0?i:30)/((r=n.fps)!==null&&r!==void 0?r:30))))),n.fps,t.encoding.priority)}),yd=["q","h","f"];function bd(t,e,n,i){var r,s;let o=i==null?void 0:i.videoEncoding;t&&(o=i==null?void 0:i.screenShareEncoding);const a=i==null?void 0:i.simulcast,c=i==null?void 0:i.scalabilityMode,l=i==null?void 0:i.videoCodec;if(!o&&!a&&!c||!e||!n)return[{}];o||(o=t2(t,e,n,l),Ce.debug("using video encoding",o));const d=o.maxFramerate,u=new je(e,n,o.maxBitrate,o.maxFramerate,o.priority);if(c&&Kn(l)){const g=new uy(c),h=[];if(g.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(c));const y=$t();if(Xi()||In()||(y==null?void 0:y.name)==="Chrome"&&mi(y==null?void 0:y.version,"113")<0){const b=g.suffix=="h"?2:3,w=rT(y);for(let C=0;C<g.spatial;C+=1)h.push({rid:yd[2-C],maxBitrate:o.maxBitrate/Math.pow(b,C),maxFramerate:u.encoding.maxFramerate,scaleResolutionDownBy:w?Math.pow(2,C):void 0});h[0].scalabilityMode=c}else h.push({maxBitrate:o.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:c});return u.encoding.priority&&(h[0].priority=u.encoding.priority,h[0].networkPriority=u.encoding.priority),Ce.debug("using svc encoding",{encodings:h}),h}if(!a)return[o];let f=[];t?f=(r=gm(i==null?void 0:i.screenShareSimulcastLayers))!==null&&r!==void 0?r:pm(t,u):f=(s=gm(i==null?void 0:i.videoSimulcastLayers))!==null&&s!==void 0?s:pm(t,u);let p;if(f.length>0){const g=f[0];f.length>1&&([,p]=f);const h=Math.max(e,n);if(h>=960&&p)return Gc(e,n,[g,p,u],d);if(h>=480)return Gc(e,n,[g,u],d)}return Gc(e,n,[u])}function e2(t,e,n){var i,r,s,o;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&Ce.warn("requested a different codec than specified as backup",{serverRequested:e,backup:n.backupCodec.codec}),n.videoCodec=e,n.videoEncoding=n.backupCodec.encoding;const a=t.mediaStreamTrack.getSettings(),c=(i=a.width)!==null&&i!==void 0?i:(r=t.dimensions)===null||r===void 0?void 0:r.width,l=(s=a.height)!==null&&s!==void 0?s:(o=t.dimensions)===null||o===void 0?void 0:o.height;return t.source===V.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),bd(t.source===V.Source.ScreenShare,c,l,n)}function t2(t,e,n,i){const r=n2(t,e,n);let{encoding:s}=r[0];const o=Math.max(e,n);for(let a=0;a<r.length;a+=1){const c=r[a];if(s=c.encoding,c.width>=o)break}if(i)switch(i){case"av1":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function n2(t,e,n){if(t)return YT;const i=e>n?e/n:n/e;return Math.abs(i-16/9)<Math.abs(i-4/3)?GT:ZT}function pm(t,e){if(t)return QT(e);const{width:n,height:i}=e,r=n>i?n/i:i/n;return Math.abs(r-16/9)<Math.abs(r-4/3)?JT:XT}function Gc(t,e,n,i){const r=[];if(n.forEach((s,o)=>{if(o>=yd.length)return;const a=Math.min(t,e),l={rid:yd[o],scaleResolutionDownBy:Math.max(1,a/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},d=i&&s.encoding.maxFramerate?Math.min(i,s.encoding.maxFramerate):s.encoding.maxFramerate;d&&(l.maxFramerate=d);const u=qr()||o===0;s.encoding.priority&&u&&(l.priority=s.encoding.priority,l.networkPriority=s.encoding.priority),r.push(l)}),In()&&ny()==="ios"){let s;r.forEach(a=>{s?a.maxFramerate&&a.maxFramerate>s&&(s=a.maxFramerate):s=a.maxFramerate});let o=!0;r.forEach(a=>{var c;a.maxFramerate!=s&&(o&&(o=!1,Ce.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),Ce.info('Setting framerate of encoding "'.concat((c=a.rid)!==null&&c!==void 0?c:"",'" to ').concat(s)),a.maxFramerate=s)})}return r}function gm(t){if(t)return t.sort((e,n)=>{const{encoding:i}=e,{encoding:r}=n;return i.maxBitrate>r.maxBitrate?1:i.maxBitrate<r.maxBitrate?-1:i.maxBitrate===r.maxBitrate&&i.maxFramerate&&r.maxFramerate?i.maxFramerate>r.maxFramerate?1:-1:0})}class uy{constructor(e){const n=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function i2(t){return t.source===V.Source.ScreenShare||t.constraints.height&&fi(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const r2=5e3;class Ea extends dy{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0;super(e,V.Kind.Video,n,i,r),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>A(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}const o=new Map(s.map(a=>[a.rid,a]));if(this.prevStats){let a=0;o.forEach((c,l)=>{var d;const u=(d=this.prevStats)===null||d===void 0?void 0:d.get(l);a+=Ja(c,u)}),this._currentBitrate=a}this.prevStats=o}),this.senderLock=new Nt}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!Ot())return;const i=(n=this.sender)===null||n===void 0?void 0:n.getParameters();i&&(this.encodings=i.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},Fu))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return A(this,void 0,void 0,function*(){var n,i,r,s,o;yield e.pauseUpstream.call(this);try{for(var a=!0,c=zn(this.simulcastCodecs.values()),l;l=yield c.next(),n=l.done,!n;a=!0)s=l.value,a=!1,yield(o=s.sender)===null||o===void 0?void 0:o.replaceTrack(null)}catch(d){i={error:d}}finally{try{!a&&!n&&(r=c.return)&&(yield r.call(c))}finally{if(i)throw i.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return A(this,void 0,void 0,function*(){var n,i,r,s,o;yield e.resumeUpstream.call(this);try{for(var a=!0,c=zn(this.simulcastCodecs.values()),l;l=yield c.next(),n=l.done,!n;a=!0){s=l.value,a=!1;const d=s;yield(o=d.sender)===null||o===void 0?void 0:o.replaceTrack(d.mediaStreamTrack)}}catch(d){i={error:d}}finally{try{!a&&!n&&(r=c.return)&&(yield r.call(c))}finally{if(i)throw i.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return A(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===V.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return A(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===V.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(e){super.setTrackMuted(e);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!e}getSenderStats(){return A(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const n=[],i=yield this.sender.getStats();return i.forEach(r=>{var s;if(r.type==="outbound-rtp"){const o={type:"video",streamId:r.id,frameHeight:r.frameHeight,frameWidth:r.frameWidth,framesPerSecond:r.framesPerSecond,framesSent:r.framesSent,firCount:r.firCount,pliCount:r.pliCount,nackCount:r.nackCount,packetsSent:r.packetsSent,bytesSent:r.bytesSent,qualityLimitationReason:r.qualityLimitationReason,qualityLimitationDurations:r.qualityLimitationDurations,qualityLimitationResolutionChanges:r.qualityLimitationResolutionChanges,rid:(s=r.rid)!==null&&s!==void 0?s:r.id,retransmittedPacketsSent:r.retransmittedPacketsSent,targetBitrate:r.targetBitrate,timestamp:r.timestamp},a=i.get(r.remoteId);a&&(o.jitter=a.jitter,o.packetsLost=a.packetsLost,o.roundTripTime=a.roundTripTime),n.push(o)}}),n.sort((r,s)=>{var o,a;return((o=s.frameWidth)!==null&&o!==void 0?o:0)-((a=r.frameWidth)!==null&&a!==void 0?a:0)}),n})}setPublishingQuality(e){const n=[];for(let i=Jt.LOW;i<=Jt.HIGH;i+=1)n.push(new Pu({quality:i,enabled:i<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(Kn(this.codec),n)}restartTrack(e){return A(this,void 0,void 0,function*(){var n,i,r,s,o;let a;if(e){const u=_u({video:e});typeof u.video!="boolean"&&(a=u.video)}yield this.restart(a);try{for(var c=!0,l=zn(this.simulcastCodecs.values()),d;d=yield l.next(),n=d.done,!n;c=!0){s=d.value,c=!1;const u=s;u.sender&&((o=u.sender.transport)===null||o===void 0?void 0:o.state)!=="closed"&&(u.mediaStreamTrack=this.mediaStreamTrack.clone(),yield u.sender.replaceTrack(u.mediaStreamTrack))}}catch(u){i={error:u}}finally{try{!c&&!n&&(r=l.return)&&(yield r.call(l))}finally{if(i)throw i.error}}})}setProcessor(e){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return A(this,arguments,void 0,function(i){var r=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var o,a,c,l,d,u;if(yield n.setProcessor.call(r,i,s),!((d=r.processor)===null||d===void 0)&&d.processedTrack)try{for(var f=!0,p=zn(r.simulcastCodecs.values()),g;g=yield p.next(),o=g.done,!o;f=!0)l=g.value,f=!1,yield(u=l.sender)===null||u===void 0?void 0:u.replaceTrack(r.processor.processedTrack)}catch(h){a={error:h}}finally{try{!f&&!o&&(c=p.return)&&(yield c.call(p))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return A(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const n=this.sender.getParameters();n.degradationPreference=e,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(e,n){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const i={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(e,i),i}setSimulcastTrackSender(e,n){const i=this.simulcastCodecs.get(e);i&&(i.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},r2))}setPublishingCodecs(e){return A(this,void 0,void 0,function*(){var n,i,r,s,o,a,c;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(Kn(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const l=[];try{for(n=!0,i=zn(e);r=yield i.next(),s=r.done,!s;n=!0){c=r.value,n=!1;const d=c;if(!this.codec||this.codec===d.codec)yield this.setPublishingLayers(Kn(d.codec),d.qualities);else{const u=this.simulcastCodecs.get(d.codec);if(this.log.debug("try setPublishingCodec for ".concat(d.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:u})),!u||!u.sender){for(const f of d.qualities)if(f.enabled){l.push(d.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(d.codec),this.logContext),yield vm(u.sender,u.encodings,d.qualities,this.senderLock,Kn(d.codec),this.log,this.logContext))}}}catch(d){o={error:d}}finally{try{!n&&!s&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return l})}setPublishingLayers(e,n){return A(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:n})),!(!this.sender||!this.encodings)&&(yield vm(this.sender,this.encodings,n,this.senderLock,e,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return A(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),ey()&&this.isInBackground&&this.source===V.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function vm(t,e,n,i,r,s,o){return A(this,void 0,void 0,function*(){const a=yield i.lock();s.debug("setPublishingLayersForSender",Object.assign(Object.assign({},o),{sender:t,qualities:n,senderEncodings:e}));try{const c=t.getParameters(),{encodings:l}=c;if(!l)return;if(l.length!==e.length){s.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},o),{encodings:l,senderEncodings:e}));return}let d=!1;!1&&l[0].scalabilityMode||(r&&n.some(p=>p.enabled)&&n.forEach(p=>p.enabled=!0),l.forEach((f,p)=>{var g;let h=(g=f.rid)!==null&&g!==void 0?g:"";h===""&&(h="q");const y=fy(h),b=n.find(w=>w.quality===y);b&&f.active!==b.enabled&&(d=!0,f.active=b.enabled,s.debug("setting layer ".concat(b.quality," to ").concat(f.active?"enabled":"disabled"),o),qr()&&(b.enabled?(f.scaleResolutionDownBy=e[p].scaleResolutionDownBy,f.maxBitrate=e[p].maxBitrate,f.maxFrameRate=e[p].maxFrameRate):(f.scaleResolutionDownBy=4,f.maxBitrate=10,f.maxFrameRate=2)))})),d&&(c.encodings=l,s.debug("setting encodings",Object.assign(Object.assign({},o),{encodings:c.encodings})),yield t.setParameters(c))}finally{a()}})}function fy(t){switch(t){case"f":return Jt.HIGH;case"h":return Jt.MEDIUM;case"q":return Jt.LOW;default:return Jt.HIGH}}function ym(t,e,n,i){if(!n)return[new Hi({quality:Jt.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(i){const r=n[0].scalabilityMode,s=new uy(r),o=[],a=s.suffix=="h"?1.5:2,c=s.suffix=="h"?2:3;for(let l=0;l<s.spatial;l+=1)o.push(new Hi({quality:Math.min(Jt.HIGH,s.spatial-1)-l,width:Math.ceil(t/Math.pow(a,l)),height:Math.ceil(e/Math.pow(a,l)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(c,l)):0,ssrc:0}));return o}return n.map(r=>{var s,o,a;const c=(s=r.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let l=fy((o=r.rid)!==null&&o!==void 0?o:"");return new Hi({quality:l,width:Math.ceil(t/c),height:Math.ceil(e/c),bitrate:(a=r.maxBitrate)!==null&&a!==void 0?a:0,ssrc:0})})}const bm="_lossy",xm="_reliable",s2=2*1e3,Zc="leave-reconnect",o2=3e4;var rn;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(rn||(rn={}));class a2 extends Nn.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Lu.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=rn.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=Ce,this.reliableDataSequence=1,this.reliableMessageBuffer=new om,this.reliableReceivedState=new MT(o2),this.handleDataChannel=i=>A(this,[i],void 0,function(r){var s=this;let{channel:o}=r;return function*(){if(o){if(o.label===xm)s.reliableDCSub=o;else if(o.label===bm)s.lossyDCSub=o;else return;s.log.debug("on data channel ".concat(o.id,", ").concat(o.label),s.logContext),o.onmessage=s.handleDataMessage}}()}),this.handleDataMessage=i=>A(this,void 0,void 0,function*(){var r,s;const o=yield this.dataProcessLock.lock();try{let a;if(i.data instanceof ArrayBuffer)a=i.data;else if(i.data instanceof Blob)a=yield i.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:i.data}));return}const c=Mt.fromBinary(new Uint8Array(a));if(c.sequence>0&&c.participantSid!==""){const l=this.reliableReceivedState.get(c.participantSid);if(l&&c.sequence<=l)return;this.reliableReceivedState.set(c.participantSid,c.sequence)}((r=c.value)===null||r===void 0?void 0:r.case)==="speaker"?this.emit(ae.ActiveSpeakersUpdate,c.value.value.speakers):(((s=c.value)===null||s===void 0?void 0:s.case)==="user"&&l2(c,c.value.value),this.emit(ae.DataPacketReceived,c))}finally{o()}}),this.handleDataError=i=>{const s=i.currentTarget.maxRetransmits===0?"lossy":"reliable";if(i instanceof ErrorEvent&&i.error){const{error:o}=i.error;this.log.error("DataChannel error on ".concat(s,": ").concat(i.message),Object.assign(Object.assign({},this.logContext),{error:o}))}else this.log.error("Unknown DataChannel error on ".concat(s),Object.assign(Object.assign({},this.logContext),{event:i}))},this.handleBufferedAmountLow=i=>{const s=i.currentTarget.maxRetransmits===0?be.LOSSY:be.RELIABLE;this.updateAndEmitDCBufferStatus(s)},this.handleDisconnect=(i,r)=>{if(this._isClosed)return;this.log.warn("".concat(i," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=c=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(c,"ms. giving up"),this.logContext),this.emit(ae.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(a===null){s(o);return}i===Zc&&(a=0),this.log.debug("reconnecting in ".concat(a,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=bt.setTimeout(()=>this.attemptReconnect(r).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((i,r)=>{this.pcState===rn.Connected&&i();const s=()=>{this.off(ae.Disconnected,o),i()},o=()=>{this.off(ae.Restarted,s),r()};this.once(ae.Restarted,s),this.once(ae.Disconnected,o)}),this.updateAndEmitDCBufferStatus=i=>{const r=this.isBufferStatusLow(i);typeof r<"u"&&r!==this.dcBufferStatus.get(i)&&(this.dcBufferStatus.set(i,r),this.emit(ae.DCBufferStatusChanged,r,i))},this.isBufferStatusLow=i=>{const r=this.dataChannelForKind(i);if(r)return i===be.RELIABLE&&this.reliableMessageBuffer.alignBufferedAmount(r.bufferedAmount),r.bufferedAmount<=r.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===Be.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(dr.RR_SIGNAL_DISCONNECTED))},this.log=Gn((n=e.loggerName)!==null&&n!==void 0?n:fn.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new Ou(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new Nt,this.dataProcessLock=new Nt,this.dcBufferStatus=new Map([[be.LOSSY,!0],[be.RELIABLE,!0]]),this.client.onParticipantUpdate=i=>this.emit(ae.ParticipantUpdate,i),this.client.onConnectionQuality=i=>this.emit(ae.ConnectionQualityUpdate,i),this.client.onRoomUpdate=i=>this.emit(ae.RoomUpdate,i),this.client.onSubscriptionError=i=>this.emit(ae.SubscriptionError,i),this.client.onSubscriptionPermissionUpdate=i=>this.emit(ae.SubscriptionPermissionUpdate,i),this.client.onSpeakersChanged=i=>this.emit(ae.SpeakersChanged,i),this.client.onStreamStateUpdate=i=>this.emit(ae.StreamStateChanged,i),this.client.onRequestResponse=i=>this.emit(ae.SignalRequestResponse,i)}get logContext(){var e,n,i,r,s,o;return{room:(n=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||n===void 0?void 0:n.name,roomID:(r=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.room)===null||r===void 0?void 0:r.sid,participant:(o=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||o===void 0?void 0:o.identity,pID:this.participantSid}}join(e,n,i,r){return A(this,void 0,void 0,function*(){this.url=e,this.token=n,this.signalOpts=i,this.maxJoinAttempts=i.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const s=yield this.client.join(e,n,i,r);return this._isClosed=!1,this.latestJoinResponse=s,this.subscriberPrimary=s.subscriberPrimary,this.pcManager||(yield this.configure(s)),(!this.subscriberPrimary||s.fastPublish)&&this.negotiate(),this.clientConfiguration=s.clientConfiguration,this.emit(ae.SignalConnected,s),s}catch(s){if(s instanceof Ue&&s.reason===Te.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,n,i,r);throw s}})}close(){return A(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(ae.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return A(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const n=i=>{i&&(i.close(),i.onbufferedamountlow=null,i.onclose=null,i.onclosing=null,i.onerror=null,i.onmessage=null,i.onopen=null)};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new om,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupClient(){return A(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Wn("a track with the same ID has already been published");return new Promise((n,i)=>{const r=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],i(new Ue("publication of local track timed out, no response from server",Te.Timeout))},1e4);this.pendingTrackResolvers[e.cid]={resolve:s=>{clearTimeout(r),n(s)},reject:()=>{clearTimeout(r),i(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:n}=this.pendingTrackResolvers[e.track.id];n&&n(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(n){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:n}))}return!1}updateMuteStatus(e,n){this.client.sendMuteTrack(e,n)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return A(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return A(this,void 0,void 0,function*(){var n,i;if(this.pcManager&&this.pcManager.currentState!==Je.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const r=this.makeRTCConfiguration(e);this.pcManager=new UT(r,e.subscriberPrimary,this.loggerOptions),this.emit(ae.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(s,o)=>{this.client.sendIceCandidate(s,o)},this.pcManager.onPublisherOffer=(s,o)=>{this.client.sendOffer(s,o)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(s,o,a)=>A(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(s),this.logContext),["closed","disconnected","failed"].includes(o)&&(this.publisherConnectionPromise=void 0),s===Je.CONNECTED){const d=this.pcState===rn.New;this.pcState=rn.Connected,d&&this.emit(ae.Connected,e)}else s===Je.FAILED&&this.pcState===rn.Connected&&(this.pcState=rn.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?dr.RR_SUBSCRIBER_FAILED:dr.RR_PUBLISHER_FAILED));const c=this.client.isDisconnected||this.client.currentState===Be.RECONNECTING,l=[Je.FAILED,Je.CLOSING,Je.CLOSED].includes(s);c&&l&&!this._isClosed&&this.emit(ae.Offline)}),this.pcManager.onTrack=s=>{this.emit(ae.MediaTrackAdded,s.track,s.streams[0],s.receiver)},c2((i=e.serverInfo)===null||i===void 0?void 0:i.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,n)=>A(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e,n))}),this.client.onTrickle=(e,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:n})),this.pcManager.addIceCandidate(e,n))},this.client.onOffer=(e,n)=>A(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=n,!this.pcManager)return;const i=yield this.pcManager.createSubscriberAnswerFromOffer(e,n);i&&this.client.sendAnswer(i,n)}),this.client.onLocalTrackPublished=e=>{var n;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(n=e.track)===null||n===void 0?void 0:n.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:i}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],i(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(ae.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(ae.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(ae.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(ae.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var n;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(ae.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",dr.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Nr.DISCONNECT:this.emit(ae.Disconnected,e==null?void 0:e.reason),this.close();break;case Nr.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Zc);break;case Nr.RESUME:this.handleDisconnect(Zc)}}}makeRTCConfiguration(e){var n;const i=Object.assign({},this.rtcConfig);if(!((n=this.signalOpts)===null||n===void 0)&&n.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),i.encodedInsertableStreams=!0),e.iceServers&&!i.iceServers){const r=[];e.iceServers.forEach(s=>{const o={urls:s.urls};s.username&&(o.username=s.username),s.credential&&(o.credential=s.credential),r.push(o)}),i.iceServers=r}return e.clientConfiguration&&e.clientConfiguration.forceRelay===Hs.ENABLED&&(i.iceTransportPolicy="relay"),i.sdpSemantics="unified-plan",i.continualGatheringPolicy="gather_continually",i}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(bm,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(xm,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,n,i){return A(this,void 0,void 0,function*(){if(ld())return yield this.createTransceiverRTCRtpSender(e,n,i);if(dd())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new ht("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,i,r){return A(this,void 0,void 0,function*(){if(ld())return this.createSimulcastTransceiverSender(e,n,i,r);if(dd())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new ht("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,i){return A(this,void 0,void 0,function*(){if(!this.pcManager)throw new ht("publisher is closed");const r=[];e.mediaStream&&r.push(e.mediaStream),ns(e)&&(e.codec=n.videoCodec);const s={direction:"sendonly",streams:r};return i&&(s.sendEncodings=i),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(e,n,i,r){return A(this,void 0,void 0,function*(){if(!this.pcManager)throw new ht("publisher is closed");const s={direction:"sendonly"};r&&(s.sendEncodings=r);const o=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(i.videoCodec)return e.setSimulcastTrackSender(i.videoCodec,o.sender),o.sender})}createRTCRtpSender(e){return A(this,void 0,void 0,function*(){if(!this.pcManager)throw new ht("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return A(this,void 0,void 0,function*(){var n,i,r;if(!this._isClosed){if(this.attemptingReconnect){Ce.warn("already attempting reconnect, returning early",this.logContext);return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===Hs.DISABLED||((r=(i=this.pcManager)===null||i===void 0?void 0:i.currentState)!==null&&r!==void 0?r:Je.NEW)===Je.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let o=!0;s instanceof ht?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:s})),o=!1):s instanceof ur||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",dr.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(ae.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(n){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:n}))}return null}restartConnection(e){return A(this,void 0,void 0,function*(){var n,i,r;try{if(!this.url||!this.token)throw new ht("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(ae.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new ur;s=yield this.join(e??this.url,this.token,this.signalOpts)}catch(o){throw o instanceof Ue&&o.reason===Te.NotAllowed?new ht("could not reconnect, token might be expired"):new ur}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(ae.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==Be.CONNECTED)throw new ur("Signal connection got severed during reconnect");(n=this.regionUrlProvider)===null||n===void 0||n.resetAttempts(),this.emit(ae.Restarted)}catch(s){const o=yield(i=this.regionUrlProvider)===null||i===void 0?void 0:i.getNextBestRegionUrl();if(o){yield this.restartConnection(o);return}else throw(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),s}})}resumeConnection(e){return A(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new ht("could not reconnect, url or token not saved");if(!this.pcManager)throw new ht("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(ae.Resuming);let i;try{this.setupSignalClientCallbacks(),i=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(r){let s="";throw r instanceof Error&&(s=r.message,this.log.error(r.message,Object.assign(Object.assign({},this.logContext),{error:r}))),r instanceof Ue&&r.reason===Te.NotAllowed?new ht("could not reconnect, token might be expired"):r instanceof Ue&&r.reason===Te.LeaveRequest?r:new ur(s)}if(this.emit(ae.SignalResumed),i){const r=this.makeRTCConfiguration(i);this.pcManager.updateConfiguration(r),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=i.serverInfo)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==Be.CONNECTED)throw new ur("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),i!=null&&i.lastMessageSeq&&this.resendReliableMessagesForResume(i.lastMessageSeq),this.emit(ae.Resumed)})}waitForPCInitialConnection(e,n){return A(this,void 0,void 0,function*(){if(!this.pcManager)throw new ht("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return A(this,void 0,void 0,function*(){this.pcState=rn.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield jt(s2),!this.pcManager)throw new ht("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=rn.Connected}catch(e){throw this.pcState=rn.Disconnected,new Ue("could not establish PC connection, ".concat(e.message),Te.InternalError)}})}publishRpcResponse(e,n,i,r){return A(this,void 0,void 0,function*(){const s=new Mt({destinationIdentities:[e],kind:be.RELIABLE,value:{case:"rpcResponse",value:new tv({requestId:n,value:r?{case:"error",value:r.toProto()}:{case:"payload",value:i??""}})}});yield this.sendDataPacket(s,be.RELIABLE)})}publishRpcAck(e,n){return A(this,void 0,void 0,function*(){const i=new Mt({destinationIdentities:[e],kind:be.RELIABLE,value:{case:"rpcAck",value:new ev({requestId:n})}});yield this.sendDataPacket(i,be.RELIABLE)})}sendDataPacket(e,n){return A(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(n),n===be.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const i=e.toBinary(),r=this.dataChannelForKind(n);if(r){if(n===be.RELIABLE&&this.reliableMessageBuffer.push({data:i,sequence:e.sequence}),this.attemptingReconnect)return;r.send(i)}this.updateAndEmitDCBufferStatus(n)})}resendReliableMessagesForResume(e){return A(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(be.RELIABLE);const n=this.dataChannelForKind(be.RELIABLE);n&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(i=>{n.send(i.data)})),this.updateAndEmitDCBufferStatus(be.RELIABLE)})}waitForBufferStatusLow(e){return new Promise((n,i)=>A(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))n();else{const r=()=>i("Engine closed");for(this.once(ae.Closing,r);!this.dcBufferStatus.get(e);)yield jt(10);this.off(ae.Closing,r),n()}}))}ensureDataTransportConnected(e){return A(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var s;if(!i.pcManager)throw new ht("PC manager is closed");const o=r?i.pcManager.subscriber:i.pcManager.publisher,a=r?"Subscriber":"Publisher";if(!o)throw new Ue("".concat(a," connection not set"),Te.InternalError);let c=!1;!r&&!i.dataChannelForKind(n,r)&&(i.createDataChannels(),c=!0),!c&&!r&&!i.pcManager.publisher.isICEConnected&&i.pcManager.publisher.getICEConnectionState()!=="checking"&&(c=!0),c&&i.negotiate();const l=i.dataChannelForKind(n,r);if((l==null?void 0:l.readyState)==="open")return;const d=new Date().getTime()+i.peerConnectionTimeout;for(;new Date().getTime()<d;){if(o.isICEConnected&&((s=i.dataChannelForKind(n,r))===null||s===void 0?void 0:s.readyState)==="open")return;yield jt(50)}throw new Ue("could not establish ".concat(a," connection, state: ").concat(o.getICEConnectionState()),Te.InternalError)}()})}ensurePublisherConnected(e){return A(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Je.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return A(this,void 0,void 0,function*(){return new Promise((e,n)=>A(this,void 0,void 0,function*(){if(!this.pcManager){n(new od("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const i=new AbortController,r=()=>{i.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&n("cannot negotiate on closed engine"),this.on(ae.Closing,r),this.pcManager.publisher.once(Lr.RTPVideoPayloadTypes,s=>{const o=new Map;s.forEach(a=>{const c=a.codec.toLowerCase();dT(c)&&o.set(a.payload,c)}),this.emit(ae.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(i),e()}catch(s){s instanceof od&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",dr.RR_UNKNOWN),n(s)}finally{this.off(ae.Closing,r)}}))})}dataChannelForKind(e,n){if(n){if(e===be.LOSSY)return this.lossyDCSub;if(e===be.RELIABLE)return this.reliableDCSub}else{if(e===be.LOSSY)return this.lossyDC;if(e===be.RELIABLE)return this.reliableDC}}sendSyncState(e,n){var i,r;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const s=this.pcManager.subscriber.getLocalDescription(),o=this.pcManager.subscriber.getRemoteDescription(),a=(r=(i=this.signalOpts)===null||i===void 0?void 0:i.autoSubscribe)!==null&&r!==void 0?r:!0,c=new Array,l=new Array;e.forEach(d=>{d.isDesired!==a&&c.push(d.trackSid),d.isEnabled||l.push(d.trackSid)}),this.client.sendSyncState(new yv({answer:s?ka({sdp:s.sdp,type:s.type}):void 0,offer:o?ka({sdp:o.sdp,type:o.type}):void 0,subscription:new Ga({trackSids:c,subscribe:!a,participantTracks:[]}),publishTracks:bT(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:l,datachannelReceiveStates:this.reliableReceivedState.map((d,u)=>new bv({publisherSid:u,lastSeq:d}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],n=(i,r)=>{(i==null?void 0:i.id)!==void 0&&i.id!==null&&e.push(new xv({label:i.label,id:i.id,target:r}))};return n(this.dataChannelForKind(be.LOSSY),ln.PUBLISHER),n(this.dataChannelForKind(be.RELIABLE),ln.PUBLISHER),n(this.dataChannelForKind(be.LOSSY,!0),ln.SUBSCRIBER),n(this.dataChannelForKind(be.RELIABLE,!0),ln.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&bt.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Ot()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Ot()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class ur extends Error{}function c2(t){return t!==void 0&&t>13}function l2(t,e){const n=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=n,e.participantIdentity=n;const i=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=i,e.destinationIdentities=i}class xd{constructor(e,n){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=n}updateToken(e){this.token=e}isCloud(){return fd(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return A(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const n=this.regionSettings.regions.filter(i=>!this.attemptedRegions.find(r=>r.url===i.url));if(n.length>0){const i=n[0];return this.attemptedRegions.push(i),Ce.debug("next region: ".concat(i.region)),i.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return A(this,void 0,void 0,function*(){const n=yield fetch("".concat(d2(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(n.ok){const i=yield n.json();return this.lastUpdateAt=Date.now(),i}else throw new Ue("Could not fetch region settings: ".concat(n.statusText),n.status===401?Te.NotAllowed:Te.InternalError,n.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function d2(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class hy{get info(){return this._info}constructor(e,n,i){this.reader=n,this.totalByteSize=i,this._info=e,this.bytesReceived=0}}class u2 extends hy{handleChunkReceived(e){var n;this.bytesReceived+=e.content.byteLength;const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,i)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>A(this,void 0,void 0,function*(){try{const{done:n,value:i}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:i.content})}catch{return{done:!0,value:void 0}}}),return(){return A(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return A(this,void 0,void 0,function*(){var e,n,i,r;let s=new Set;try{for(var o=!0,a=zn(this),c;c=yield a.next(),e=c.done,!e;o=!0){r=c.value,o=!1;const l=r;s.add(l)}}catch(l){n={error:l}}finally{try{!o&&!e&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}return Array.from(s)})}}class f2 extends hy{constructor(e,n,i){super(e,n,i),this.receivedChunks=new Map}handleChunkReceived(e){var n;const i=ra(e.chunkIndex),r=this.receivedChunks.get(i);if(r&&r.version>e.version)return;this.receivedChunks.set(i,e),this.bytesReceived+=e.content.byteLength;const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const e=this.reader.getReader(),n=new TextDecoder;return{next:()=>A(this,void 0,void 0,function*(){try{const{done:i,value:r}=yield e.read();return i?{done:!0,value:void 0}:(this.handleChunkReceived(r),{done:!1,value:n.decode(r.content)})}catch{return{done:!0,value:void 0}}}),return(){return A(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return A(this,void 0,void 0,function*(){var e,n,i,r;let s="";try{for(var o=!0,a=zn(this),c;c=yield a.next(),e=c.done,!e;o=!0)r=c.value,o=!1,s+=r}catch(l){n={error:l}}finally{try{!o&&!e&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}return s})}}class my{constructor(e,n,i){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=i,this.info=n}write(e){return this.defaultWriter.write(e)}close(){return A(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class h2 extends my{}class m2 extends my{}class py extends V{constructor(e,n,i,r,s){super(e,i,s),this.sid=n,this.receiver=r}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?re.Muted:re.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const n=i=>{i.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(re.Ended,this))};e.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return A(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),Fu)),xT()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>e());const i=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(i){const{timestamp:r,rtpTimestamp:s}=i;s&&this.rtpTimestamp!==s&&(this.emit(re.TimeSyncUpdate,{timestamp:r,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class gy extends py{constructor(e,n,i,r,s,o){super(e,n,V.Kind.Audio,i,o),this.monitorReceiver=()=>A(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=Ja(a,this.prevStats)),this.prevStats=a}),this.audioContext=r,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(e){var n;for(const i of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(e,0,.1):i.volume=e;In()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(In())return 1;let e=0;return this.attachedElements.forEach(n=>{n.volume>e&&(e=n.volume)}),e}setSinkId(e){return A(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(n=>{if(ud(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&ud(e)&&e.setSinkId(this.sinkId).catch(i=>{this.log.error("Failed to set sink id on remote audio track",i,this.logContext)}),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let n;return e?(n=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,n){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(n.srcObject);let i=this.sourceNode;this.webAudioPluginNodes.forEach(r=>{i.connect(r),i=r}),this.gainNode=e.createGain(),i.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(re.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(r=>{this.emit(re.AudioPlaybackFailed,r)})}disconnectWebAudio(){var e,n;(e=this.gainNode)===null||e===void 0||e.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return A(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n;return e.forEach(i=>{i.type==="inbound-rtp"&&(n={type:"audio",streamId:i.id,timestamp:i.timestamp,jitter:i.jitter,bytesReceived:i.bytesReceived,concealedSamples:i.concealedSamples,concealmentEvents:i.concealmentEvents,silentConcealedSamples:i.silentConcealedSamples,silentConcealmentEvents:i.silentConcealmentEvents,totalAudioEnergy:i.totalAudioEnergy,totalSamplesDuration:i.totalSamplesDuration})}),n})}}const Yc=100;class p2 extends py{constructor(e,n,i,r,s){super(e,n,V.Kind.Video,i,s),this.elementInfos=[],this.monitorReceiver=()=>A(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=Ja(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=ju(()=>{this.updateDimensions()},Yc),this.adaptiveStreamSettings=r}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(n=>{e?Dr(this._mediaStreamTrack,n):kr(this._mediaStreamTrack,n)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===e)===void 0){const n=new g2(e);this.observeElementInfo(n)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(i=>i===e);for(const i of n)i.stopObserving();this.elementInfos=this.elementInfos.filter(i=>i!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let n=[];if(e)return this.stopObservingElement(e),super.detach(e);n=super.detach();for(const i of n)this.stopObservingElement(i);return n}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return A(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n,i="",r=new Map;return e.forEach(s=>{s.type==="inbound-rtp"?(i=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&r.set(s.id,s)}),n&&i!==""&&r.get(i)&&(n.mimeType=r.get(i).mimeType),n})}stopObservingElement(e){const n=this.elementInfos.filter(i=>i.element===e);for(const i of n)this.stopObservingElementInfo(i)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return A(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,n;const i=this.elementInfos.reduce((a,c)=>Math.max(a,c.visibilityChangedAt||0),0),r=!((n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&n!==void 0)||n?this.isInBackground:!1,s=this.elementInfos.some(a=>a.pictureInPicture),o=this.elementInfos.some(a=>a.visible)&&!r||s;if(this.lastVisible!==o){if(!o&&Date.now()-i<Yc){bt.setTimeout(()=>{this.updateVisibility()},Yc);return}this.lastVisible=o,this.emit(re.VisibilityChanged,o,this)}}updateDimensions(){var e,n;let i=0,r=0;const s=this.getPixelDensity();for(const o of this.elementInfos){const a=o.width()*s,c=o.height()*s;a+c>i+r&&(i=a,r=c)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===i&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===r||(this.lastDimensions={width:i,height:r},this.emit(re.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?em():n||(em()>2?2:1)}}class g2{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,n){this.onVisibilityChanged=i=>{var r;const{target:s,isIntersecting:o}=i;s===this.element&&(this.isIntersecting=o,this.isPiP=ks(this.element),this.visibilityChangedAt=Date.now(),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this))},this.onEnterPiP=()=>{var i,r,s;(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP),this.isPiP=ks(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)},this.onLeavePiP=()=>{var i;this.isPiP=ks(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.element=e,this.isIntersecting=n??Sd(e),this.isPiP=Ot()&&ks(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,i;this.isIntersecting=Sd(this.element),this.isPiP=ks(this.element),this.element.handleResize=()=>{var r;(r=this.handleResize)===null||r===void 0||r.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,nm().observe(this.element),tm().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,n,i,r,s;(e=nm())===null||e===void 0||e.unobserve(this.element),(n=tm())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(i=window.documentPictureInPicture)===null||i===void 0||i.removeEventListener("enter",this.onEnterPiP),(s=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function ks(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?Sd(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function Sd(t,e){const n=e||window;let i=t.offsetTop,r=t.offsetLeft;const s=t.offsetWidth,o=t.offsetHeight,{hidden:a}=t,{display:c}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,i+=t.offsetTop,r+=t.offsetLeft;return i<n.pageYOffset+n.innerHeight&&r<n.pageXOffset+n.innerWidth&&i+o>n.pageYOffset&&r+s>n.pageXOffset&&!a&&c!=="none"}class Bn extends Nn.EventEmitter{constructor(e,n,i,r){var s;super(),this.metadataMuted=!1,this.encryption=Ft.NONE,this.log=Ce,this.handleMuted=()=>{this.emit(re.Muted)},this.handleUnmuted=()=>{this.emit(re.Unmuted)},this.log=Gn((s=r==null?void 0:r.loggerName)!==null&&s!==void 0?s:fn.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=i,this.source=V.Source.Unknown}setTrack(e){this.track&&(this.track.off(re.Muted,this.handleMuted),this.track.off(re.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(re.Muted,this.handleMuted),e.on(re.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),we(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==Ft.NONE}get audioTrack(){if(Tn(this.track))return this.track}get videoTrack(){if(ns(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=V.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===V.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(Bn||(Bn={}));class wd extends Bn{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,n,i,r){super(e,n.sid,n.name,r),this.track=void 0,this.handleTrackEnded=()=>{this.emit(re.Ended)},this.updateInfo(n),this.setTrack(i)}setTrack(e){this.track&&this.track.off(re.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(re.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return A(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return A(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return A(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return A(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(Tn(this.track)){const n=this.track.getSourceTrackSettings(),i=new Set;return n.autoGainControl&&i.add(pt.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&i.add(pt.TF_ECHO_CANCELLATION),n.noiseSuppression&&i.add(pt.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&i.add(pt.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||i.add(pt.TF_NO_DTX),this.track.enhancedNoiseCancellation&&i.add(pt.TF_ENHANCED_NOISE_CANCELLATION),Array.from(i.values())}else return[]}}function Xa(t,e){return A(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:i,videoProcessor:r,optionsWithoutProcessor:s}=sy(t);let o=s.audio,a=s.video;if(i&&typeof s.audio=="object"&&(s.audio.processor=i),r&&typeof s.video=="object"&&(s.video.processor=r),t.audio&&typeof s.audio=="object"&&typeof s.audio.deviceId=="string"){const u=s.audio.deviceId;s.audio.deviceId={exact:u},n=!0,o=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:u}})}if(s.video&&typeof s.video=="object"&&typeof s.video.deviceId=="string"){const u=s.video.deviceId;s.video.deviceId={exact:u},n=!0,a=Object.assign(Object.assign({},s.video),{deviceId:{ideal:u}})}(s.audio===!0||typeof s.audio=="object"&&!s.audio.deviceId)&&(s.audio={deviceId:"default"}),s.video===!0?s.video={deviceId:"default"}:typeof s.video=="object"&&!s.video.deviceId&&(s.video.deviceId="default");const c=iy(s,ay,cy),l=_u(c),d=navigator.mediaDevices.getUserMedia(l);s.audio&&(gt.userMediaPromiseMap.set("audioinput",d),d.catch(()=>gt.userMediaPromiseMap.delete("audioinput"))),s.video&&(gt.userMediaPromiseMap.set("videoinput",d),d.catch(()=>gt.userMediaPromiseMap.delete("videoinput")));try{const u=yield d;return yield Promise.all(u.getTracks().map(f=>A(this,void 0,void 0,function*(){const p=f.kind==="audio";let g=p?c.audio:c.video;(typeof g=="boolean"||!g)&&(g={});let h;const y=p?l.audio:l.video;typeof y!="boolean"&&(h=y);const b=f.getSettings().deviceId;h!=null&&h.deviceId&&fi(h.deviceId)!==b?h.deviceId=b:h||(h={deviceId:b});const w=KT(f,h,e);return w.kind===V.Kind.Video?w.source=V.Source.Camera:w.kind===V.Kind.Audio&&(w.source=V.Source.Microphone),w.mediaStream=u,Tn(w)&&i?yield w.setProcessor(i):ns(w)&&r&&(yield w.setProcessor(r)),w})))}catch(u){if(!n)throw u;return Xa(Object.assign(Object.assign({},t),{audio:o,video:a}),e)}})}function v2(t){return A(this,void 0,void 0,function*(){return(yield Xa({audio:!1,video:!0}))[0]})}function y2(t){return A(this,void 0,void 0,function*(){return(yield Xa({audio:!0,video:!1}))[0]})}var ci;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(ci||(ci={}));function b2(t){switch(t){case As.EXCELLENT:return ci.Excellent;case As.GOOD:return ci.Good;case As.POOR:return ci.Poor;case As.LOST:return ci.Lost;default:return ci.Unknown}}class vy extends Nn.EventEmitter{get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Yi.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===_r.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,n,i,r,s,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Yi.STANDARD;var c;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=ci.Unknown,this.log=Ce,this.log=Gn((c=o==null?void 0:o.loggerName)!==null&&c!==void 0?c:fn.Participant),this.loggerOptions=o,this.setMaxListeners(100),this.sid=e,this.identity=n,this.name=i,this.metadata=r,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,n]of this.trackPublications)if(n.source===e)return n}getTrackPublicationByName(e){for(const[,n]of this.trackPublications)if(n.trackName===e)return n}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new Tr,this.once(Z.Active,()=>{var e,n;(n=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||n===void 0||n.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const n=this.getTrackPublication(V.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(V.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(V.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var n;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===_r.ACTIVE&&((n=this.participantInfo)===null||n===void 0?void 0:n.state)!==_r.ACTIVE&&this.emit(Z.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const n=this.metadata!==e,i=this.metadata;this.metadata=e,n&&this.emit(Z.ParticipantMetadataChanged,i)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(Z.ParticipantNameChanged,e)}_setAttributes(e){const n=ST(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(Z.AttributesChanged,n)}setPermissions(e){var n,i,r,s,o,a;const c=this.permissions,l=e.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||e.canSubscribe!==((i=this.permissions)===null||i===void 0?void 0:i.canSubscribe)||e.canPublishData!==((r=this.permissions)===null||r===void 0?void 0:r.canPublishData)||e.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||e.recorder!==((o=this.permissions)===null||o===void 0?void 0:o.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((d,u)=>{var f;return d!==((f=this.permissions)===null||f===void 0?void 0:f.canPublishSources[u])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,l&&this.emit(Z.ParticipantPermissionsChanged,c),l}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(Z.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=b2(e),n!==this._connectionQuality&&this.emit(Z.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,n;this.activeFuture&&((n=(e=this.activeFuture).reject)===null||n===void 0||n.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(n=>Tn(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on(re.Muted,()=>{this.emit(Z.TrackMuted,e)}),e.on(re.Unmuted,()=>{this.emit(Z.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case V.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case V.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function x2(t){var e,n,i;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new gv({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(n=t.participantSid)!==null&&n!==void 0?n:"",allTracks:(i=t.allowAll)!==null&&i!==void 0?i:!1,trackSids:t.allowedTrackSids||[]})}const Sm=15e3;class S2 extends vy{constructor(e,n,i,r,s){super(e,n,void 0,void 0,void 0,{loggerName:r.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=Ft.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Tr)},this.handleReconnected=()=>{var o,a;(a=(o=this.reconnectFuture)===null||o===void 0?void 0:o.resolve)===null||a===void 0||a.call(o),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var o,a,c,l,d,u;this.reconnectFuture&&(this.reconnectFuture.promise.catch(f=>this.log.warn(f.message,this.logContext)),(a=(o=this.reconnectFuture)===null||o===void 0?void 0:o.reject)===null||a===void 0||a.call(o,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0),this.signalConnectedFuture&&((l=(c=this.signalConnectedFuture).reject)===null||l===void 0||l.call(c,"Got disconnected without signal connected"),this.signalConnectedFuture=void 0),(u=(d=this.activeAgentFuture)===null||d===void 0?void 0:d.reject)===null||u===void 0||u.call(d,"Got disconnected without active agent present"),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=o=>{var a,c;o.participant&&this.updateInfo(o.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new Tr),(c=(a=this.signalConnectedFuture).resolve)===null||c===void 0||c.call(a)},this.handleSignalRequestResponse=o=>{const{requestId:a,reason:c,message:l}=o,d=this.pendingSignalRequests.get(a);d&&(c!==Ru.OK&&d.reject(new Zh(l,c)),this.pendingSignalRequests.delete(a))},this.handleDataPacket=o=>{switch(o.value.case){case"rpcResponse":let a=o.value.value,c=null,l=null;a.value.case==="payload"?c=a.value.value:a.value.case==="error"&&(l=Qe.fromProto(a.value.value)),this.handleIncomingRpcResponse(a.requestId,c,l);break;case"rpcAck":let d=o.value.value;this.handleIncomingRpcAck(d.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(o=>x2(o)))},this.onTrackUnmuted=o=>{this.onTrackMuted(o,o.isUpstreamPaused)},this.onTrackMuted=(o,a)=>{if(a===void 0&&(a=!0),!o.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),we(o)));return}this.engine.updateMuteStatus(o.sid,a)},this.onTrackUpstreamPaused=o=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),we(o))),this.onTrackMuted(o,!0)},this.onTrackUpstreamResumed=o=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),we(o))),this.onTrackMuted(o,o.isMuted)},this.onTrackFeatureUpdate=o=>{const a=this.audioTrackPublications.get(o.sid);if(!a){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(o.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(a.trackSid,a.getTrackFeatures())},this.handleSubscribedQualityUpdate=o=>A(this,void 0,void 0,function*(){var a,c,l,d,u;if(!(!((u=this.roomOptions)===null||u===void 0)&&u.dynacast))return;const f=this.videoTrackPublications.get(o.trackSid);if(!f){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}if(!f.videoTrack)return;const p=yield f.videoTrack.setPublishingCodecs(o.subscribedCodecs);try{for(var g=!0,h=zn(p),y;y=yield h.next(),a=y.done,!a;g=!0){d=y.value,g=!1;const b=d;Jk(b)&&(this.log.debug("publish ".concat(b," for ").concat(f.videoTrack.sid),Object.assign(Object.assign({},this.logContext),we(f))),yield this.publishAdditionalCodecForTrack(f.videoTrack,b,f.options))}}catch(b){c={error:b}}finally{try{!g&&!a&&(l=h.return)&&(yield l.call(h))}finally{if(c)throw c.error}}}),this.handleLocalTrackUnpublished=o=>{const a=this.trackPublications.get(o.trackSid);if(!a){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}this.unpublishTrack(a.track)},this.handleTrackEnded=o=>A(this,void 0,void 0,function*(){if(o.source===V.Source.ScreenShare||o.source===V.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),we(o))),this.unpublishTrack(o);else if(o.isUserProvided)yield o.mute();else if(Un(o)||ii(o))try{if(Ot())try{const a=yield navigator==null?void 0:navigator.permissions.query({name:o.source===V.Source.Camera?"camera":"microphone"});if(a&&a.state==="denied")throw this.log.warn("user has revoked access to ".concat(o.source),Object.assign(Object.assign({},this.logContext),we(o))),a.onchange=()=>{a.state!=="denied"&&(o.isMuted||o.restartTrack(),a.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}o.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),we(o))),Un(o)?yield o.restartTrack({deviceId:"default"}):yield o.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),we(o))),yield o.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=i,this.roomOptions=r,this.setupEngine(i),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=s}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==Ft.NONE}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setupEngine(e){this.engine=e,this.engine.on(ae.RemoteMute,(n,i)=>{const r=this.trackPublications.get(n);!r||!r.track||(i?r.mute():r.unmute())}),this.engine.on(ae.Connected,this.handleReconnected).on(ae.SignalConnected,this.handleSignalConnected).on(ae.SignalRestarted,this.handleReconnected).on(ae.SignalResumed,this.handleReconnected).on(ae.Restarting,this.handleReconnecting).on(ae.Resuming,this.handleReconnecting).on(ae.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(ae.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(ae.Disconnected,this.handleDisconnected).on(ae.SignalRequestResponse,this.handleSignalRequestResponse).on(ae.DataPacketReceived,this.handleDataPacket),this.signalConnectedFuture=void 0}setMetadata(e){return A(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return A(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return A(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return A(this,arguments,void 0,function(n){var i=this;let{metadata:r,name:s,attributes:o}=n;return function*(){return new Promise((a,c)=>A(i,void 0,void 0,function*(){var l,d;try{let u=!1;const f=yield this.engine.client.sendUpdateLocalMetadata((l=r??this.metadata)!==null&&l!==void 0?l:"",(d=s??this.name)!==null&&d!==void 0?d:"",o),p=performance.now();for(this.pendingSignalRequests.set(f,{resolve:a,reject:g=>{c(g),u=!0},values:{name:s,metadata:r,attributes:o}});performance.now()-p<5e3&&!u;){if((!s||this.name===s)&&(!r||this.metadata===r)&&(!o||Object.entries(o).every(g=>{let[h,y]=g;return this.attributes[h]===y||y===""&&!this.attributes[h]}))){this.pendingSignalRequests.delete(f),a();return}yield jt(50)}c(new Zh("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&c(u)}}))}()})}setCameraEnabled(e,n,i){return this.setTrackEnabled(V.Source.Camera,e,n,i)}setMicrophoneEnabled(e,n,i){return this.setTrackEnabled(V.Source.Microphone,e,n,i)}setScreenShareEnabled(e,n,i){return this.setTrackEnabled(V.Source.ScreenShare,e,n,i)}setPermissions(e){const n=this.permissions,i=super.setPermissions(e);return i&&n&&this.emit(Z.ParticipantPermissionsChanged,n),i}setE2EEEnabled(e){return A(this,void 0,void 0,function*(){this.encryptionType=e?Ft.GCM:Ft.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,n,i,r){return A(this,void 0,void 0,function*(){var s,o;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:n})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(n)if(a)yield a.unmute();else{let c;if(this.pendingPublishing.has(e)){const l=yield this.waitForPendingPublicationOfSource(e);return l||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield l==null?void 0:l.unmute(),l}this.pendingPublishing.add(e);try{switch(e){case V.Source.Camera:c=yield this.createTracks({video:(s=i)!==null&&s!==void 0?s:!0});break;case V.Source.Microphone:c=yield this.createTracks({audio:(o=i)!==null&&o!==void 0?o:!0});break;case V.Source.ScreenShare:c=yield this.createScreenTracks(Object.assign({},i));break;default:throw new Wn(e)}}catch(l){throw c==null||c.forEach(d=>{d.stop()}),l instanceof Error&&this.emit(Z.MediaDevicesError,l,gd(e)),this.pendingPublishing.delete(e),l}for(const l of c)e===V.Source.Microphone&&Tn(l)&&(r!=null&&r.preConnectBuffer)&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),l.startPreConnectBuffer());try{const l=[];for(const u of c)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),we(u))),l.push(this.publishTrack(u,r));[a]=yield Promise.all(l)}catch(l){throw c==null||c.forEach(d=>{d.stop()}),l}finally{this.pendingPublishing.delete(e)}}else if(!(a!=null&&a.track)&&this.pendingPublishing.has(e)&&(a=yield this.waitForPendingPublicationOfSource(e),a||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),a&&a.track)if(e===V.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const c=this.getTrackPublication(V.Source.ScreenShareAudio);c&&c.track&&this.unpublishTrack(c.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return A(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(V.Source.Camera)||this.pendingPublishing.has(V.Source.Microphone))){this.pendingPublishing.add(V.Source.Camera),this.pendingPublishing.add(V.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(V.Source.Camera),this.pendingPublishing.delete(V.Source.Microphone)}}})}createTracks(e){return A(this,void 0,void 0,function*(){var n,i;e??(e={});const r=iy(e,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(i=this.roomOptions)===null||i===void 0?void 0:i.videoCaptureDefaults);try{return(yield Xa(r,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(Tn(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=V.Source.Microphone,this.emit(Z.AudioStreamAcquired)),ns(a)&&(this.cameraError=void 0,a.source=V.Source.Camera),a))}catch(s){throw s instanceof Error&&(e.audio&&(this.microphoneError=s),e.video&&(this.cameraError=s)),s}})}createScreenTracks(e){return A(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new Iu("getDisplayMedia not supported");e.resolution===void 0&&!iT()&&(e.resolution=Mu.h1080fps30.resolution);const n=yT(e),i=yield navigator.mediaDevices.getDisplayMedia(n),r=i.getVideoTracks();if(r.length===0)throw new Wn("no video track found");const s=new Ea(r[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=V.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const o=[s];if(i.getAudioTracks().length>0){this.emit(Z.AudioStreamAcquired);const a=new Ta(i.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=V.Source.ScreenShareAudio,o.push(a)}return o})}publishTrack(e,n){return A(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,n)})}publishOrRepublishTrack(e,n){return A(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var a,c,l,d;Un(i)&&i.setAudioContext(s.audioContext),yield(a=s.reconnectFuture)===null||a===void 0?void 0:a.promise,s.republishPromise&&!o&&(yield s.republishPromise),jr(i)&&s.pendingPublishPromises.has(i)&&(yield s.pendingPublishPromises.get(i));let u;if(i instanceof MediaStreamTrack)u=i.getConstraints();else{u=i.constraints;let b;switch(i.source){case V.Source.Microphone:b="audioinput";break;case V.Source.Camera:b="videoinput"}b&&s.activeDeviceMap.has(b)&&(u=Object.assign(Object.assign({},u),{deviceId:s.activeDeviceMap.get(b)}))}if(i instanceof MediaStreamTrack)switch(i.kind){case"audio":i=new Ta(i,u,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":i=new Ea(i,u,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new Wn("unsupported MediaStreamTrack kind ".concat(i.kind))}else i.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let f;if(s.trackPublications.forEach(b=>{b.track&&b.track===i&&(f=b)}),f)return s.log.warn("track has already been published, skipping",Object.assign(Object.assign({},s.logContext),we(f))),f;const p="channelCount"in i.mediaStreamTrack.getSettings()&&i.mediaStreamTrack.getSettings().channelCount===2||i.mediaStreamTrack.getConstraints().channelCount===2,g=(c=r==null?void 0:r.forceStereo)!==null&&c!==void 0?c:p;g&&(r||(r={}),r.dtx===void 0&&s.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},s.logContext),we(i))),r.red===void 0&&s.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(l=r.dtx)!==null&&l!==void 0||(r.dtx=!1),(d=r.red)!==null&&d!==void 0||(r.red=!1));const h=Object.assign(Object.assign({},s.roomOptions.publishDefaults),r);!sT()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},s.logContext)),h.simulcast=!1),h.source&&(i.source=h.source);const y=new Promise((b,w)=>A(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==Be.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:we(i)}));const C=setTimeout(()=>{w(new Gh("publishing rejected as engine not connected within timeout",408))},15e3);yield this.waitUntilEngineConnected(),clearTimeout(C);const S=yield this.publish(i,h,g);b(S)}else try{const C=yield this.publish(i,h,g);b(C)}catch(C){w(C)}}catch(C){w(C)}}));s.pendingPublishPromises.set(i,y);try{return yield y}catch(b){throw b}finally{s.pendingPublishPromises.delete(i)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new Tr),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),we(e))),!1;const{canPublish:n,canPublishSources:i}=this.permissions;return n&&(i.length===0||i.map(r=>wT(r)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),we(e))),!1)}publish(e,n,i){return A(this,void 0,void 0,function*(){var r,s,o,a,c,l,d,u,f,p;if(!this.hasPermissionsToPublish(e))throw new Gh("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(_=>jr(e)&&_.source===e.source)&&e.source!==V.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),we(e))),n.stopMicTrackOnMute&&Tn(e)&&(e.stopOnMute=!0),e.source===V.Source.ScreenShare&&qr()&&(n.simulcast=!1),n.videoCodec==="av1"&&!eT()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!tT()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=vd),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(_=>n.videoCodec===sa(_.mime))||(n.videoCodec=sa(this.enabledPublishVideoCodecs[0].mime)));const h=n.videoCodec;e.on(re.Muted,this.onTrackMuted),e.on(re.Unmuted,this.onTrackUnmuted),e.on(re.Ended,this.handleTrackEnded),e.on(re.UpstreamPaused,this.onTrackUpstreamPaused),e.on(re.UpstreamResumed,this.onTrackUpstreamResumed),e.on(re.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const y=[],b=!(!((r=n.dtx)!==null&&r!==void 0)||r),w=e.getSourceTrackSettings();w.autoGainControl&&y.push(pt.TF_AUTO_GAIN_CONTROL),w.echoCancellation&&y.push(pt.TF_ECHO_CANCELLATION),w.noiseSuppression&&y.push(pt.TF_NOISE_SUPPRESSION),w.channelCount&&w.channelCount>1&&y.push(pt.TF_STEREO),b&&y.push(pt.TF_NO_DTX),Un(e)&&e.hasPreConnectBuffer&&y.push(pt.TF_PRECONNECT_BUFFER);const C=new Jl({cid:e.mediaStreamTrack.id,name:n.name,type:V.kindToProto(e.kind),muted:e.isMuted,source:V.sourceToProto(e.source),disableDtx:b,encryption:this.encryptionType,stereo:i,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy,audioFeatures:y});let S;if(e.kind===V.Kind.Video){let _={width:0,height:0};try{_=yield e.waitForDimensions()}catch{const I=(a=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&a!==void 0?a:zs.h720.resolution;_={width:I.width,height:I.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),we(e)),{dims:_}))}C.width=_.width,C.height=_.height,ii(e)&&(Kn(h)&&(e.source===V.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),we(e))))),n.scalabilityMode=(c=n.scalabilityMode)!==null&&c!==void 0?c:"L3T3_KEY"),C.simulcastCodecs=[new Yl({codec:h,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:vd}),n.backupCodec&&h!==n.backupCodec.codec&&C.encryption===Ft.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),C.simulcastCodecs.push(new Yl({codec:n.backupCodec.codec,cid:""})))),S=bd(e.source===V.Source.ScreenShare,C.width,C.height,n),C.layers=ym(C.width,C.height,S,Kn(n.videoCodec))}else e.kind===V.Kind.Audio&&(S=[{maxBitrate:(l=n.audioPreset)===null||l===void 0?void 0:l.maxBitrate,priority:(u=(d=n.audioPreset)===null||d===void 0?void 0:d.priority)!==null&&u!==void 0?u:"high",networkPriority:(p=(f=n.audioPreset)===null||f===void 0?void 0:f.priority)!==null&&p!==void 0?p:"high"}]);if(!this.engine||this.engine.isClosed)throw new ht("cannot publish track when not connected");const x=()=>A(this,void 0,void 0,function*(){var _,k,I;if(!this.engine.pcManager)throw new ht("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,S),ii(e)&&((_=n.degradationPreference)!==null&&_!==void 0||(n.degradationPreference=i2(e)),e.setDegradationPreference(n.degradationPreference)),S)if(qr()&&e.kind===V.Kind.Audio){let N;for(const K of this.engine.pcManager.publisher.getTransceivers())if(K.sender===e.sender){N=K;break}N&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:N,codec:"opus",maxbr:!((k=S[0])===null||k===void 0)&&k.maxBitrate?S[0].maxBitrate/1e3:0})}else e.codec&&Kn(e.codec)&&(!((I=S[0])===null||I===void 0)&&I.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:C.cid,codec:e.codec,maxbr:S[0].maxBitrate/1e3});yield this.engine.negotiate()});let T;const E=new Promise((_,k)=>A(this,void 0,void 0,function*(){var I;try{T=yield this.engine.addTrack(C),_(T)}catch(N){e.sender&&(!((I=this.engine.pcManager)===null||I===void 0)&&I.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(K=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),we(e)),{error:K}))})),k(N)}}));if(this.enabledPublishVideoCodecs.length>0)T=(yield Promise.all([E,x()]))[0];else{T=yield E;let _;if(T.codecs.forEach(k=>{_===void 0&&(_=k.mimeType)}),_&&e.kind===V.Kind.Video){const k=sa(_);k!==h&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),we(e)),{codec:k})),n.videoCodec=k,S=bd(e.source===V.Source.ScreenShare,C.width,C.height,n))}yield x()}const P=new wd(e.kind,T,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(P.options=n,e.sid=T.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:S,trackInfo:T})),ii(e)?e.startMonitor(this.engine.client):Un(e)&&e.startMonitor(),this.addTrackPublication(P),this.emit(Z.LocalTrackPublished,P),Un(e)&&T.audioFeatures.includes(pt.TF_PRECONNECT_BUFFER)){const _=e.getPreConnectBuffer();this.on(Z.LocalTrackSubscribed,k=>{if(k.trackSid===T.sid){if(!e.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed",this.logContext);return}this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),we(e))),e.stopPreConnectBuffer()}}),_&&new Promise((I,N)=>A(this,void 0,void 0,function*(){var K,J,se,ie,X,O;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),we(e)));const te=setTimeout(()=>{N(new Error("agent not active within 10 seconds"))},1e4),j=yield this.waitUntilActiveAgentPresent();clearTimeout(te),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),we(e)));const q=yield this.streamBytes({name:"preconnect-buffer",mimeType:"audio/opus",topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[j.identity],attributes:{trackId:P.trackSid,sampleRate:String((X=w.sampleRate)!==null&&X!==void 0?X:"48000"),channels:String((O=w.channelCount)!==null&&O!==void 0?O:"1")}});try{for(var oe=!0,L=zn(_),F;F=yield L.next(),K=F.done,!K;oe=!0){ie=F.value,oe=!1;const ee=ie;yield q.write(ee)}}catch(ee){J={error:ee}}finally{try{!oe&&!K&&(se=L.return)&&(yield se.call(L))}finally{if(J)throw J.error}}yield q.close(),I()}catch(te){N(te)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),we(e)))}).catch(I=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),we(e)),{error:I}))})}return P})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,n,i){return A(this,void 0,void 0,function*(){var r;if(this.encryptionType!==Ft.NONE)return;let s;if(this.trackPublications.forEach(p=>{p.track&&p.track===e&&(s=p)}),!s)throw new Wn("track is not published");if(!ii(e))throw new Wn("track is not a video track");const o=Object.assign(Object.assign({},(r=this.roomOptions)===null||r===void 0?void 0:r.publishDefaults),i),a=e2(e,n,o);if(!a){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),we(e)));return}const c=e.addSimulcastTrack(n,a);if(!c)return;const l=new Jl({cid:c.mediaStreamTrack.id,type:V.kindToProto(e.kind),muted:e.isMuted,source:V.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:c.mediaStreamTrack.id}]});if(l.layers=ym(l.width,l.height,a),!this.engine||this.engine.isClosed)throw new ht("cannot publish track when not connected");const d=()=>A(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,c,o,a),yield this.engine.negotiate()}),f=(yield Promise.all([this.engine.addTrack(l),d()]))[0];this.log.debug("published ".concat(n," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:f}))})}unpublishTrack(e,n){return A(this,void 0,void 0,function*(){var i,r;if(jr(e)){const l=this.pendingPublishPromises.get(e);l&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),we(e))),yield l)}const s=this.getPublicationForTrack(e),o=s?we(s):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),o)),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),o));return}e=s.track,e.off(re.Muted,this.onTrackMuted),e.off(re.Unmuted,this.onTrackUnmuted),e.off(re.Ended,this.handleTrackEnded),e.off(re.UpstreamPaused,this.onTrackUpstreamPaused),e.off(re.UpstreamResumed,this.onTrackUpstreamResumed),e.off(re.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(r=(i=this.roomOptions)===null||i===void 0?void 0:i.stopLocalTrackOnUnpublish)!==null&&r!==void 0?r:!0),n?e.stop():e.stopMonitor();let a=!1;const c=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Je.FAILED&&c)try{for(const l of this.engine.pcManager.publisher.getTransceivers())l.sender===c&&(l.direction="inactive",a=!0);if(this.engine.removeTrack(c)&&(a=!0),ii(e)){for(const[,l]of e.simulcastCodecs)l.sender&&(this.engine.removeTrack(l.sender)&&(a=!0),l.sender=void 0);e.simulcastCodecs.clear()}}catch(l){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),o),{error:l}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case V.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case V.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}return this.emit(Z.LocalTrackUnpublished,s),s.setTrack(void 0),a&&(yield this.engine.negotiate()),s})}unpublishTracks(e){return A(this,void 0,void 0,function*(){return(yield Promise.all(e.map(i=>this.unpublishTrack(i)))).filter(i=>!!i)})}republishAllTracks(e){return A(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){i.republishPromise&&(yield i.republishPromise),i.republishPromise=new Promise((s,o)=>A(i,void 0,void 0,function*(){try{const a=[];this.trackPublications.forEach(c=>{c.track&&(n&&(c.options=Object.assign(Object.assign({},c.options),n)),a.push(c))}),yield Promise.all(a.map(c=>A(this,void 0,void 0,function*(){const l=c.track;yield this.unpublishTrack(l,!1),r&&!l.isMuted&&l.source!==V.Source.ScreenShare&&l.source!==V.Source.ScreenShareAudio&&(Un(l)||ii(l))&&!l.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:c.trackSid})),yield l.restartTrack()),yield this.publishOrRepublishTrack(l,c.options,!0)}))),s()}catch(a){o(a)}finally{this.republishPromise=void 0}})),yield i.republishPromise}()})}publishData(e){return A(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const s=r.reliable?be.RELIABLE:be.LOSSY,o=r.destinationIdentities,a=r.topic,c=new Mt({kind:s,value:{case:"user",value:new J0({participantIdentity:i.identity,payload:n,destinationIdentities:o,topic:a})}});yield i.engine.sendDataPacket(c,s)}()})}publishDtmf(e,n){return A(this,void 0,void 0,function*(){const i=new Mt({kind:be.RELIABLE,value:{case:"sipDtmf",value:new X0({code:e,digit:n})}});yield this.engine.sendDataPacket(i,be.RELIABLE)})}sendChatMessage(e,n){return A(this,void 0,void 0,function*(){const i={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},r=new Mt({value:{case:"chatMessage",value:new zl(Object.assign(Object.assign({},i),{timestamp:ze.parse(i.timestamp)}))}});return yield this.engine.sendDataPacket(r,be.RELIABLE),this.emit(Z.ChatMessage,i),i})}editChatMessage(e,n){return A(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},n),{message:e,editTimestamp:Date.now()}),r=new Mt({value:{case:"chatMessage",value:new zl(Object.assign(Object.assign({},i),{timestamp:ze.parse(i.timestamp),editTimestamp:ze.parse(i.editTimestamp)}))}});return yield this.engine.sendDataPacket(r,be.RELIABLE),this.emit(Z.ChatMessage,i),i})}sendText(e,n){return A(this,void 0,void 0,function*(){var i;const r=crypto.randomUUID(),o=new TextEncoder().encode(e).byteLength,a=(i=n==null?void 0:n.attachments)===null||i===void 0?void 0:i.map(()=>crypto.randomUUID()),c=new Array(a?a.length+1:1).fill(0),l=(u,f)=>{var p;c[f]=u;const g=c.reduce((h,y)=>h+y,0);(p=n==null?void 0:n.onProgress)===null||p===void 0||p.call(n,g)},d=yield this.streamText({streamId:r,totalSize:o,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:a,attributes:n==null?void 0:n.attributes});return yield d.write(e),l(1,0),yield d.close(),n!=null&&n.attachments&&a&&(yield Promise.all(n.attachments.map((u,f)=>A(this,void 0,void 0,function*(){return this._sendFile(a[f],u,{topic:n.topic,mimeType:u.type,onProgress:p=>{l(p,f+1)}})})))),d.info})}streamText(e){return A(this,void 0,void 0,function*(){var n,i;const r=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),s={id:r,mimeType:"text/plain",timestamp:Date.now(),topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},o=new ql({streamId:r,mimeType:s.mimeType,topic:s.topic,timestamp:Li(s.timestamp),totalLength:Li(e==null?void 0:e.totalSize),attributes:s.attributes,contentHeader:{case:"textHeader",value:new lv({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?Wl.UPDATE:Wl.CREATE})}}),a=e==null?void 0:e.destinationIdentities,c=new Mt({destinationIdentities:a,value:{case:"streamHeader",value:o}});yield this.engine.sendDataPacket(c,be.RELIABLE);let l=0;const d=this,u=new WritableStream({write(g){return A(this,void 0,void 0,function*(){for(const h of gT(g,Sm)){yield d.engine.waitForBufferStatusLow(be.RELIABLE);const y=new Kl({content:h,streamId:r,chunkIndex:Li(l)}),b=new Mt({destinationIdentities:a,value:{case:"streamChunk",value:y}});yield d.engine.sendDataPacket(b,be.RELIABLE),l+=1}})},close(){return A(this,void 0,void 0,function*(){const g=new Gl({streamId:r}),h=new Mt({destinationIdentities:a,value:{case:"streamTrailer",value:g}});yield d.engine.sendDataPacket(h,be.RELIABLE)})},abort(g){console.log("Sink error:",g)}});let f=()=>A(this,void 0,void 0,function*(){yield p.close()});d.engine.once(ae.Closing,f);const p=new h2(u,s,()=>this.engine.off(ae.Closing,f));return p})}sendFile(e,n){return A(this,void 0,void 0,function*(){const i=crypto.randomUUID();return yield this._sendFile(i,e,n),{id:i}})}_sendFile(e,n,i){return A(this,void 0,void 0,function*(){var r;const s=yield this.streamBytes({streamId:e,totalSize:n.size,name:n.name,mimeType:(r=i==null?void 0:i.mimeType)!==null&&r!==void 0?r:n.type,topic:i==null?void 0:i.topic,destinationIdentities:i==null?void 0:i.destinationIdentities}),o=n.stream().getReader();for(;;){const{done:a,value:c}=yield o.read();if(a)break;yield s.write(c)}return yield s.close(),s.info})}streamBytes(e){return A(this,void 0,void 0,function*(){var n,i,r,s,o;const a=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),c=e==null?void 0:e.destinationIdentities,l={id:a,mimeType:(i=e==null?void 0:e.mimeType)!==null&&i!==void 0?i:"application/octet-stream",topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(s=e==null?void 0:e.name)!==null&&s!==void 0?s:"unknown"},d=new ql({totalLength:Li((o=l.size)!==null&&o!==void 0?o:0),mimeType:l.mimeType,streamId:a,topic:l.topic,timestamp:Li(Date.now()),attributes:l.attributes,contentHeader:{case:"byteHeader",value:new dv({name:l.name})}}),u=new Mt({destinationIdentities:c,value:{case:"streamHeader",value:d}});yield this.engine.sendDataPacket(u,be.RELIABLE);let f=0;const p=new Nt,g=this.engine,h=this.log,y=new WritableStream({write(w){return A(this,void 0,void 0,function*(){const C=yield p.lock();let S=0;try{for(;S<w.byteLength;){const x=w.slice(S,S+Sm);yield g.waitForBufferStatusLow(be.RELIABLE);const T=new Mt({destinationIdentities:c,value:{case:"streamChunk",value:new Kl({content:x,streamId:a,chunkIndex:Li(f)})}});yield g.sendDataPacket(T,be.RELIABLE),f+=1,S+=x.byteLength}}finally{C()}})},close(){return A(this,void 0,void 0,function*(){const w=new Gl({streamId:a}),C=new Mt({destinationIdentities:c,value:{case:"streamTrailer",value:w}});yield g.sendDataPacket(C,be.RELIABLE)})},abort(w){h.error("Sink error:",w)}});return new m2(y,l)})}performRpc(e){return A(this,arguments,void 0,function(n){var i=this;let{destinationIdentity:r,method:s,payload:o,responseTimeout:a=1e4}=n;return function*(){return new Promise((l,d)=>A(i,void 0,void 0,function*(){var u,f,p,g;if(Vu(o)>ly){d(Qe.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((f=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||f===void 0)&&f.version&&mi((g=(p=this.engine.latestJoinResponse)===null||p===void 0?void 0:p.serverInfo)===null||g===void 0?void 0:g.version,"1.8.0")<0){d(Qe.builtIn("UNSUPPORTED_SERVER"));return}const h=crypto.randomUUID();yield this.publishRpcRequest(r,h,s,o,a-2e3);const y=setTimeout(()=>{this.pendingAcks.delete(h),d(Qe.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(h),clearTimeout(b)},2e3);this.pendingAcks.set(h,{resolve:()=>{clearTimeout(y)},participantIdentity:r});const b=setTimeout(()=>{this.pendingResponses.delete(h),d(Qe.builtIn("RESPONSE_TIMEOUT"))},a);this.pendingResponses.set(h,{resolve:(w,C)=>{clearTimeout(b),this.pendingAcks.has(h)&&(console.warn("RPC response received before ack",h),this.pendingAcks.delete(h),clearTimeout(y)),C?d(C):l(w??"")},participantIdentity:r})}))}()})}registerRpcMethod(e,n){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const n=this.pendingAcks.get(e);n?(n.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,n,i){const r=this.pendingResponses.get(e);r?(r.resolve(n,i),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,n,i,r,s){return A(this,void 0,void 0,function*(){const o=new Mt({destinationIdentities:[e],kind:be.RELIABLE,value:{case:"rpcRequest",value:new Q0({id:n,method:i,payload:r,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(o,be.RELIABLE)})}handleParticipantDisconnected(e){for(const[n,{participantIdentity:i}]of this.pendingAcks)i===e&&this.pendingAcks.delete(n);for(const[n,{participantIdentity:i,resolve:r}]of this.pendingResponses)i===e&&(r(null,Qe.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(n))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(n=>{var i,r;const s=this.trackPublications.get(n.sid);if(s){const o=s.isMuted||((r=(i=s.track)===null||i===void 0?void 0:i.isUpstreamPaused)!==null&&r!==void 0?r:!1);o!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),we(s)),{mutedOnServer:o})),this.engine.client.sendMuteTrack(n.sid,o))}}),!0):!1}setActiveAgent(e){var n,i,r,s;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(i=(n=this.activeAgentFuture)===null||n===void 0?void 0:n.resolve)===null||i===void 0||i.call(n,e):(s=(r=this.activeAgentFuture)===null||r===void 0?void 0:r.reject)===null||s===void 0||s.call(r,"Agent disconnected"),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new Tr),this.activeAgentFuture.promise)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(i=>{const r=i.track;r&&(e instanceof MediaStreamTrack?(Un(r)||ii(r))&&r.mediaStreamTrack===e&&(n=i):e===r&&(n=i))}),n}waitForPendingPublicationOfSource(e){return A(this,void 0,void 0,function*(){const i=Date.now();for(;Date.now()<i+1e4;){const r=Array.from(this.pendingPublishPromises.entries()).find(s=>{let[o]=s;return o.source===e});if(r)return r[1];yield jt(20)}})}}class Pa extends Bn{constructor(e,n,i,r){super(e,n.sid,n.name,r),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=Jt.HIGH,this.handleEnded=s=>{this.setTrack(void 0),this.emit(re.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.disabled=!s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensions=s,this.emitTrackUpdate()},this.subscribed=i,this.updateInfo(n)}setSubscribed(e){const n=this.subscriptionStatus,i=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const r=new Ga({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new iv({participantSid:"",trackSids:[this.trackSid]})]});this.emit(re.UpdateSubscription,r),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(i)}get subscriptionStatus(){return this.subscribed===!1?Bn.SubscriptionStatus.Unsubscribed:super.isSubscribed?Bn.SubscriptionStatus.Subscribed:Bn.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Bn.PermissionStatus.Allowed:Bn.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var n,i;this.isManualOperationAllowed()&&(((n=this.videoDimensions)===null||n===void 0?void 0:n.width)===e.width&&((i=this.videoDimensions)===null||i===void 0?void 0:i.height)===e.height||(Hc(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Hc(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const n=this.subscriptionStatus,i=this.permissionStatus,r=this.track;r!==e&&(r&&(r.off(re.VideoDimensionsChanged,this.handleVideoDimensionsChange),r.off(re.VisibilityChanged,this.handleVisibilityChange),r.off(re.Ended,this.handleEnded),r.detach(),r.stopMonitor(),this.emit(re.Unsubscribed,r)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(re.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(re.VisibilityChanged,this.handleVisibilityChange),e.on(re.Ended,this.handleEnded),this.emit(re.Subscribed,e)),this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(e){const n=this.subscriptionStatus,i=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(e){this.emit(re.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const n=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):n!==e.muted&&this.emit(e.muted?re.Muted:re.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit(re.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(re.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===V.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Hc(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new uv({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=Jt.HIGH,this.emit(re.UpdateSettings,e)}}class Ra extends vy{static fromParticipantInfo(e,n,i){return new Ra(e,n.sid,n.identity,n.name,n.metadata,n.attributes,i,n.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,n,i,r,s,o,a){let c=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Yi.STANDARD;super(n,i||"",r,s,o,a,c),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(re.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),we(e))),this.signalClient.sendUpdateTrackSettings(n)}),e.on(re.UpdateSubscription,n=>{n.participantTracks.forEach(i=>{i.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on(re.SubscriptionPermissionChanged,n=>{this.emit(Z.TrackSubscriptionPermissionChanged,e,n)}),e.on(re.SubscriptionStatusChanged,n=>{this.emit(Z.TrackSubscriptionStatusChanged,e,n)}),e.on(re.Subscribed,n=>{this.emit(Z.TrackSubscribed,n,e)}),e.on(re.Unsubscribed,n=>{this.emit(Z.TrackUnsubscribed,n,e)}),e.on(re.SubscriptionFailed,n=>{this.emit(Z.TrackSubscriptionFailed,e.trackSid,n)})}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setVolume(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.Source.Microphone;this.volumeMap.set(n,e);const i=this.getTrackPublication(n);i&&i.track&&i.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V.Source.Microphone;const n=this.getTrackPublication(e);return n&&n.track?n.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,n,i,r,s,o){let a=this.getTrackPublicationBySid(n);if(a||n.startsWith("TR")||this.trackPublications.forEach(d=>{!a&&e.kind===d.kind.toString()&&(a=d)}),!a){if(o===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n})),this.emit(Z.TrackSubscriptionFailed,n);return}o===void 0&&(o=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,n,i,r,s,o-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),we(a))),this.emit(Z.TrackSubscriptionFailed,n);return}const c=e.kind==="video";let l;return c?l=new p2(e,n,r,s):l=new gy(e,n,r,this.audioContext,this.audioOutput),l.source=a.source,l.isMuted=a.isMuted,l.setMediaStream(i),l.start(),a.setTrack(l),this.volumeMap.has(a.source)&&md(l)&&Tn(l)&&l.setVolume(this.volumeMap.get(a.source)),a}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const n=new Map,i=new Map;return e.tracks.forEach(r=>{var s,o;let a=this.getTrackPublicationBySid(r.sid);if(a)a.updateInfo(r);else{const c=V.kindFromProto(r.type);if(!c)return;a=new Pa(c,r,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(o=this.loggerOptions)===null||o===void 0?void 0:o.loggerName}),a.updateInfo(r),i.set(r.sid,a);const l=Array.from(this.trackPublications.values()).find(d=>d.source===(a==null?void 0:a.source));l&&a.source!==V.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(a.source),Object.assign(Object.assign({},this.logContext),{oldTrack:we(l),newTrack:we(a)})),this.addTrackPublication(a)}n.set(r.sid,a)}),this.trackPublications.forEach(r=>{n.has(r.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),we(r))),this.unpublishTrack(r.trackSid,!0))}),i.forEach(r=>{this.emit(Z.TrackPublished,r)}),!0}unpublishTrack(e,n){const i=this.trackPublications.get(e);if(!i)return;const{track:r}=i;switch(r&&(r.stop(),i.setTrack(void 0)),this.trackPublications.delete(e),i.kind){case V.Kind.Audio:this.audioTrackPublications.delete(e);break;case V.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(Z.TrackUnpublished,i)}setAudioOutput(e){return A(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(i=>{var r;Tn(i.track)&&md(i.track)&&n.push(i.track.setSinkId((r=e.deviceId)!==null&&r!==void 0?r:"default"))}),yield Promise.all(n)})}emit(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:i})),super.emit(e,...i)}}var ge;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(ge||(ge={}));const w2=4*1e3;class pi extends Nn.EventEmitter{constructor(e){var n,i,r,s;if(super(),n=this,this.state=ge.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=Ce,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(o,a,c)=>A(this,void 0,void 0,function*(){var l;if(!nT())throw In()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const d=yield this.disconnectLock.lock();if(this.state===ge.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),d(),Promise.resolve();if(this.connectFuture)return d(),this.connectFuture.promise;this.setAndEmitConnectionState(ge.Connecting),((l=this.regionUrlProvider)===null||l===void 0?void 0:l.getServerUrl().toString())!==o&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),fd(new URL(o))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new xd(o,a):this.regionUrlProvider.updateToken(a),this.regionUrlProvider.fetchRegionSettings().then(p=>{var g;(g=this.regionUrlProvider)===null||g===void 0||g.setServerReportedRegions(p)}).catch(p=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:p}))}));const u=(p,g,h)=>A(this,void 0,void 0,function*(){var y,b;this.abortController&&this.abortController.abort();const w=new AbortController;this.abortController=w,d==null||d();try{yield this.attemptConnection(h??o,a,c,w),this.abortController=void 0,p()}catch(C){if(this.regionUrlProvider&&C instanceof Ue&&C.reason!==Te.Cancelled&&C.reason!==Te.NotAllowed){let S=null;try{S=yield this.regionUrlProvider.getNextBestRegionUrl((y=this.abortController)===null||y===void 0?void 0:y.signal)}catch(x){if(x instanceof Ue&&(x.status===401||x.reason===Te.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),g(x);return}}S&&!(!((b=this.abortController)===null||b===void 0)&&b.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(C.message,". Retrying with another region: ").concat(S),this.logContext),this.recreateEngine(),yield u(p,g,S)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,rm(C)),g(C))}else{let S=dn.UNKNOWN_REASON;C instanceof Ue&&(S=rm(C)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,S),g(C)}}}),f=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Tr((p,g)=>{u(p,g,f)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(o,a,c,l,d,u)=>A(this,void 0,void 0,function*(){var f,p,g;const h=yield c.join(o,a,{autoSubscribe:l.autoSubscribe,adaptiveStream:typeof d.adaptiveStream=="object"?!0:d.adaptiveStream,maxRetries:l.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:l.websocketTimeout},u.signal);let y=h.serverInfo;if(y||(y={version:h.serverVersion,region:h.serverRegion}),this.serverInfo=y,this.log.debug("connected to Livekit Server ".concat(Object.entries(y).map(b=>{let[w,C]=b;return"".concat(w,": ").concat(C)}).join(", ")),{room:(f=h.room)===null||f===void 0?void 0:f.name,roomSid:(p=h.room)===null||p===void 0?void 0:p.sid,identity:(g=h.participant)===null||g===void 0?void 0:g.identity}),!y.version)throw new Bk("unknown server version");return y.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),d.dynacast=!1),h}),this.applyJoinResponse=o=>{const a=o.participant;if(this.localParticipant.sid=a.sid,this.localParticipant.identity=a.identity,this.localParticipant.setEnabledPublishCodecs(o.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(o.sifTrailer)}catch(c){this.log.error(c instanceof Error?c.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:c}))}this.handleParticipantUpdates([a,...o.otherParticipants]),o.room&&this.handleRoomUpdate(o.room)},this.attemptConnection=(o,a,c,l)=>A(this,void 0,void 0,function*(){var d,u;this.state===ge.Reconnecting||this.isResuming||!((d=this.engine)===null||d===void 0)&&d.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((u=this.regionUrlProvider)===null||u===void 0)&&u.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Lu),c),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const f=yield this.connectSignal(o,a,this.engine,this.connOptions,this.options,l);this.applyJoinResponse(f),this.setupLocalParticipantEvents(),this.emit(U.SignalConnected)}catch(f){yield this.engine.close(),this.recreateEngine();const p=new Ue("could not establish signal connection",Te.ServerUnreachable);throw f instanceof Error&&(p.message="".concat(p.message,": ").concat(f.message)),f instanceof Ue&&(p.reason=f.reason,p.status=f.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:f})),p}if(l.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ue("Connection attempt aborted",Te.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,l)}catch(f){throw yield this.engine.close(),this.recreateEngine(),f}Ot()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Ot()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(ge.Connected),this.emit(U.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];return A(n,[...a],void 0,function(){var l=this;let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var u,f,p,g;const h=yield l.disconnectLock.lock();try{if(l.state===ge.Disconnected){l.log.debug("already disconnected",l.logContext);return}l.log.info("disconnect from room",Object.assign({},l.logContext)),(l.state===ge.Connecting||l.state===ge.Reconnecting||l.isResuming)&&(l.log.warn("abort connection attempt",l.logContext),(u=l.abortController)===null||u===void 0||u.abort(),(p=(f=l.connectFuture)===null||f===void 0?void 0:f.reject)===null||p===void 0||p.call(f,new Ue("Client initiated disconnect",Te.Cancelled)),l.connectFuture=void 0),!((g=l.engine)===null||g===void 0)&&g.client.isDisconnected||(yield l.engine.client.sendLeave()),l.engine&&(yield l.engine.close()),l.handleDisconnect(d,dn.CLIENT_INITIATED),l.engine=void 0}finally{h()}}()})},this.onPageLeave=()=>A(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>A(this,void 0,void 0,function*(){const o=[],a=$t();if(a&&a.os==="iOS"){const c="livekit-dummy-audio-el";let l=document.getElementById(c);if(!l){l=document.createElement("audio"),l.id=c,l.autoplay=!0,l.hidden=!0;const d=$c();d.enabled=!0;const u=new MediaStream([d]);l.srcObject=u,document.addEventListener("visibilitychange",()=>{l&&(l.srcObject=document.hidden?null:u,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(l),this.once(U.Disconnected,()=>{l==null||l.remove(),l=null})}o.push(l)}this.remoteParticipants.forEach(c=>{c.audioTrackPublications.forEach(l=>{l.track&&l.track.attachedElements.forEach(d=>{o.push(d)})})});try{yield Promise.all([this.acquireAudioContext(),...o.map(c=>(c.muted=!1,c.play()))]),this.handleAudioPlaybackStarted()}catch(c){throw this.handleAudioPlaybackFailed(c),c}}),this.startVideo=()=>A(this,void 0,void 0,function*(){const o=[];for(const a of this.remoteParticipants.values())a.videoTrackPublications.forEach(c=>{var l;(l=c.track)===null||l===void 0||l.attachedElements.forEach(d=>{o.includes(d)||o.push(d)})});yield Promise.all(o.map(a=>a.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(a=>{a.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const o of this.remoteParticipants.values())this.handleParticipantDisconnected(o.identity,o);this.setAndEmitConnectionState(ge.Reconnecting)&&this.emit(U.Reconnecting)},this.handleSignalRestarted=o=>A(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(o.serverRegion),Object.assign(Object.assign({},this.logContext),{region:o.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(o);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(a){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:a}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:o.serverRegion}))}catch{return}this.setAndEmitConnectionState(ge.Connected),this.emit(U.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=o=>{o.forEach(a=>{var c;if(a.identity===this.localParticipant.identity){this.localParticipant.updateInfo(a);return}a.identity===""&&(a.identity=(c=this.sidToIdentity.get(a.sid))!==null&&c!==void 0?c:"");let l=this.remoteParticipants.get(a.identity);a.state===_r.DISCONNECTED?this.handleParticipantDisconnected(a.identity,l):l=this.getOrCreateParticipant(a.identity,a)})},this.handleActiveSpeakersUpdate=o=>{const a=[],c={};o.forEach(l=>{if(c[l.sid]=!0,l.sid===this.localParticipant.sid)this.localParticipant.audioLevel=l.level,this.localParticipant.setIsSpeaking(!0),a.push(this.localParticipant);else{const d=this.getRemoteParticipantBySid(l.sid);d&&(d.audioLevel=l.level,d.setIsSpeaking(!0),a.push(d))}}),c[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(l=>{c[l.sid]||(l.audioLevel=0,l.setIsSpeaking(!1))}),this.activeSpeakers=a,this.emitWhenConnected(U.ActiveSpeakersChanged,a)},this.handleSpeakersChanged=o=>{const a=new Map;this.activeSpeakers.forEach(l=>{const d=this.remoteParticipants.get(l.identity);d&&d.sid!==l.sid||a.set(l.sid,l)}),o.forEach(l=>{let d=this.getRemoteParticipantBySid(l.sid);l.sid===this.localParticipant.sid&&(d=this.localParticipant),d&&(d.audioLevel=l.level,d.setIsSpeaking(l.active),l.active?a.set(l.sid,d):a.delete(l.sid))});const c=Array.from(a.values());c.sort((l,d)=>d.audioLevel-l.audioLevel),this.activeSpeakers=c,this.emitWhenConnected(U.ActiveSpeakersChanged,c)},this.handleStreamStateUpdate=o=>{o.streamStates.forEach(a=>{const c=this.getRemoteParticipantBySid(a.participantSid);if(!c)return;const l=c.getTrackPublicationBySid(a.trackSid);if(!l||!l.track)return;const d=V.streamStateFromProto(a.state);d!==l.track.streamState&&(l.track.streamState=d,c.emit(Z.TrackStreamStateChanged,l,l.track.streamState),this.emitWhenConnected(U.TrackStreamStateChanged,l,l.track.streamState,c))})},this.handleSubscriptionPermissionUpdate=o=>{const a=this.getRemoteParticipantBySid(o.participantSid);if(!a)return;const c=a.getTrackPublicationBySid(o.trackSid);c&&c.setAllowed(o.allowed)},this.handleSubscriptionError=o=>{const a=Array.from(this.remoteParticipants.values()).find(l=>l.trackPublications.has(o.trackSid));if(!a)return;const c=a.getTrackPublicationBySid(o.trackSid);c&&c.setSubscriptionError(o.err)},this.handleDataPacket=o=>{const a=this.remoteParticipants.get(o.participantIdentity);if(o.value.case==="user")this.handleUserPacket(a,o.value.value,o.kind);else if(o.value.case==="transcription")this.handleTranscription(a,o.value.value);else if(o.value.case==="sipDtmf")this.handleSipDtmf(a,o.value.value);else if(o.value.case==="chatMessage")this.handleChatMessage(a,o.value.value);else if(o.value.case==="metrics")this.handleMetrics(o.value.value,a);else if(o.value.case==="streamHeader")this.handleStreamHeader(o.value.value,o.participantIdentity);else if(o.value.case==="streamChunk")this.handleStreamChunk(o.value.value);else if(o.value.case==="streamTrailer")this.handleStreamTrailer(o.value.value);else if(o.value.case==="rpcRequest"){const c=o.value.value;this.handleIncomingRpcRequest(o.participantIdentity,c.id,c.method,c.payload,c.responseTimeoutMs,c.version)}},this.handleUserPacket=(o,a,c)=>{this.emit(U.DataReceived,a.payload,o,c,a.topic),o==null||o.emit(Z.DataReceived,a.payload,c)},this.handleSipDtmf=(o,a)=>{this.emit(U.SipDTMFReceived,a,o),o==null||o.emit(Z.SipDTMFReceived,a)},this.bufferedSegments=new Map,this.handleTranscription=(o,a)=>{const c=a.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(a.transcribedParticipantIdentity),l=c==null?void 0:c.trackPublications.get(a.trackId),d=fT(a,this.transcriptionReceivedTimes);l==null||l.emit(re.TranscriptionReceived,d),c==null||c.emit(Z.TranscriptionReceived,d,l),this.emit(U.TranscriptionReceived,d,c,l)},this.handleChatMessage=(o,a)=>{const c=hT(a);this.emit(U.ChatMessage,c,o)},this.handleMetrics=(o,a)=>{this.emit(U.MetricsReceived,o,a)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(U.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=o=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:o})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(U.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(U.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(U.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>A(this,void 0,void 0,function*(){var o;((o=$t())===null||o===void 0?void 0:o.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(U.MediaDevicesChanged)}),this.handleRoomUpdate=o=>{const a=this.roomInfo;this.roomInfo=o,a&&a.metadata!==o.metadata&&this.emitWhenConnected(U.RoomMetadataChanged,o.metadata),(a==null?void 0:a.activeRecording)!==o.activeRecording&&this.emitWhenConnected(U.RecordingStatusChanged,o.activeRecording)},this.handleConnectionQualityUpdate=o=>{o.updates.forEach(a=>{if(a.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(a.quality);return}const c=this.getRemoteParticipantBySid(a.participantSid);c&&c.setConnectionQuality(a.quality)})},this.onLocalParticipantMetadataChanged=o=>{this.emit(U.ParticipantMetadataChanged,o,this.localParticipant)},this.onLocalParticipantNameChanged=o=>{this.emit(U.ParticipantNameChanged,o,this.localParticipant)},this.onLocalAttributesChanged=o=>{this.emit(U.ParticipantAttributesChanged,o,this.localParticipant)},this.onLocalTrackMuted=o=>{this.emit(U.TrackMuted,o,this.localParticipant)},this.onLocalTrackUnmuted=o=>{this.emit(U.TrackUnmuted,o,this.localParticipant)},this.onTrackProcessorUpdate=o=>{var a;(a=o==null?void 0:o.onPublish)===null||a===void 0||a.call(o,this)},this.onLocalTrackPublished=o=>A(this,void 0,void 0,function*(){var a,c,l,d,u,f;(a=o.track)===null||a===void 0||a.on(re.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=o.track)===null||c===void 0||c.on(re.Restarted,this.onLocalTrackRestarted),(u=(d=(l=o.track)===null||l===void 0?void 0:l.getProcessor())===null||d===void 0?void 0:d.onPublish)===null||u===void 0||u.call(d,this),this.emit(U.LocalTrackPublished,o,this.localParticipant),Un(o.track)&&(yield o.track.checkForSilence())&&this.emit(U.LocalAudioSilenceDetected,o);const p=yield(f=o.track)===null||f===void 0?void 0:f.getDeviceId(!1),g=gd(o.source);g&&p&&p!==this.localParticipant.activeDeviceMap.get(g)&&(this.localParticipant.activeDeviceMap.set(g,p),this.emit(U.ActiveDeviceChanged,g,p))}),this.onLocalTrackUnpublished=o=>{var a,c;(a=o.track)===null||a===void 0||a.off(re.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=o.track)===null||c===void 0||c.off(re.Restarted,this.onLocalTrackRestarted),this.emit(U.LocalTrackUnpublished,o,this.localParticipant)},this.onLocalTrackRestarted=o=>A(this,void 0,void 0,function*(){const a=yield o.getDeviceId(!1),c=gd(o.source);c&&a&&a!==this.localParticipant.activeDeviceMap.get(c)&&(this.log.debug("local track restarted, setting ".concat(c," ").concat(a," active"),this.logContext),this.localParticipant.activeDeviceMap.set(c,a),this.emit(U.ActiveDeviceChanged,c,a))}),this.onLocalConnectionQualityChanged=o=>{this.emit(U.ConnectionQualityChanged,o,this.localParticipant)},this.onMediaDevicesError=(o,a)=>{this.emit(U.MediaDevicesError,o,a)},this.onLocalParticipantPermissionsChanged=o=>{this.emit(U.ParticipantPermissionsChanged,o,this.localParticipant)},this.onLocalChatMessageSent=o=>{this.emit(U.ChatMessage,o,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},FT),e),this.log=Gn((i=this.options.loggerName)!==null&&i!==void 0?i:fn.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},ay),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},cy),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},VT),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new Nt,this.localParticipant=new S2("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",fi(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",fi(this.options.audioCaptureDefaults.deviceId)),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&this.switchActiveDevice("audiooutput",fi(this.options.audioOutput.deviceId)).catch(o=>this.log.warn("Could not set audio output: ".concat(o.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),Ot()){const o=new AbortController;(s=navigator.mediaDevices)===null||s===void 0||s.addEventListener("devicechange",this.handleDeviceChange,{signal:o.signal}),pi.cleanupRegistry&&pi.cleanupRegistry.register(this,()=>{o.abort()})}}registerTextStreamHandler(e,n){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,n)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,n){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,n)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,n){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,n,i,r,s,o){return A(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,n),o!==1){yield this.engine.publishRpcResponse(e,n,null,Qe.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(i);if(!a){yield this.engine.publishRpcResponse(e,n,null,Qe.builtIn("UNSUPPORTED_METHOD"));return}let c=null,l=null;try{const d=yield a({requestId:n,callerIdentity:e,payload:r,responseTimeout:s});Vu(d)>ly?(c=Qe.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(i))):l=d}catch(d){d instanceof Qe?c=d:(console.warn("Uncaught error returned by RPC handler for ".concat(i,". Returning APPLICATION_ERROR instead."),d),c=Qe.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,n,l,c)})}setE2EEEnabled(e){return A(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new CT(this.options.e2ee),this.e2eeManager.on(di.ParticipantEncryptionStatusChanged,(n,i)=>{pT(i)&&(this.isE2EEEnabled=n),this.emit(U.ParticipantEncryptionStatusChanged,n,i)}),this.e2eeManager.on(di.EncryptionError,n=>this.emit(U.EncryptionError,n)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return A(this,void 0,void 0,function*(){return this.state===ge.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,n)=>{const i=r=>{r.sid!==""&&(this.engine.off(ae.RoomUpdate,i),e(r.sid))};this.engine.on(ae.RoomUpdate,i),this.once(U.Disconnected,()=>{this.engine.off(ae.RoomUpdate,i),n("Room disconnected before room server id was available")})})})}get name(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new a2(this.options),this.engine.on(ae.ParticipantUpdate,this.handleParticipantUpdates).on(ae.RoomUpdate,this.handleRoomUpdate).on(ae.SpeakersChanged,this.handleSpeakersChanged).on(ae.StreamStateChanged,this.handleStreamStateUpdate).on(ae.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(ae.SubscriptionError,this.handleSubscriptionError).on(ae.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(ae.MediaTrackAdded,(e,n,i)=>{this.onTrackAdded(e,n,i)}).on(ae.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(ae.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(ae.DataPacketReceived,this.handleDataPacket).on(ae.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(ge.SignalReconnecting)&&this.emit(U.SignalReconnecting)}).on(ae.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(ge.Connected)&&this.emit(U.Reconnected)}).on(ae.SignalResumed,()=>{this.bufferedEvents=[],(this.state===ge.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(ae.Restarting,this.handleRestarting).on(ae.SignalRestarted,this.handleSignalRestarted).on(ae.Offline,()=>{this.setAndEmitConnectionState(ge.Reconnecting)&&this.emit(U.Reconnecting)}).on(ae.DCBufferStatusChanged,(e,n)=>{this.emit(U.DCBufferStatusChanged,e,n)}).on(ae.LocalTrackSubscribed,e=>{const n=this.localParticipant.getTrackPublications().find(i=>{let{trackSid:r}=i;return r===e});if(!n){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(Z.LocalTrackSubscribed,n),this.emitWhenConnected(U.LocalTrackSubscribed,n,this.localParticipant)}).on(ae.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((n,i)=>{this.handleParticipantDisconnected(i,n)}),this.emit(U.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return gt.getInstance().getDevices(e,n)}prepareConnection(e,n){return A(this,void 0,void 0,function*(){if(this.state===ge.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(fd(new URL(e))&&n){this.regionUrlProvider=new xd(e,n);const i=yield this.regionUrlProvider.getNextBestRegionUrl();i&&this.state===ge.Disconnected&&(this.regionUrl=i,yield fetch(hd(i),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(i),this.logContext))}else yield fetch(hd(e),{method:"HEAD"})}catch(i){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:i}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,n){return A(this,void 0,void 0,function*(){let i=()=>{},r;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":r=new bn({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":r=new bn({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":r=new bn({scenario:{case:"serverLeave",value:!0}});break;case"migration":r=new bn({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":i=()=>A(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new bn({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>A(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new bn({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":r=new bn({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),i=()=>A(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new Za({reason:dn.CLIENT_INITIATED,action:Nr.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");r=new bn({scenario:{case:"subscriberBandwidth",value:Li(n)}});break;case"leave-full-reconnect":r=new bn({scenario:{case:"leaveRequestFullReconnect",value:!0}})}r&&(yield this.engine.client.sendSimulateScenario(r),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,n){return A(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var a,c,l,d,u,f,p;let g=!0,h=!1;const y=o?{exact:r}:r;if(i==="audioinput"){h=s.localParticipant.audioTrackPublications.size===0;const b=(a=s.getActiveDevice(i))!==null&&a!==void 0?a:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=y;const w=Array.from(s.localParticipant.audioTrackPublications.values()).filter(S=>S.source===V.Source.Microphone);try{g=(yield Promise.all(w.map(S=>{var x;return(x=S.audioTrack)===null||x===void 0?void 0:x.setDeviceId(y)}))).every(S=>S===!0)}catch(S){throw s.options.audioCaptureDefaults.deviceId=b,S}const C=w.some(S=>{var x,T;return(T=(x=S.track)===null||x===void 0?void 0:x.isMuted)!==null&&T!==void 0?T:!1});g&&C&&(h=!0)}else if(i==="videoinput"){h=s.localParticipant.videoTrackPublications.size===0;const b=(c=s.getActiveDevice(i))!==null&&c!==void 0?c:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=y;const w=Array.from(s.localParticipant.videoTrackPublications.values()).filter(C=>C.source===V.Source.Camera);try{g=(yield Promise.all(w.map(C=>{var S;return(S=C.videoTrack)===null||S===void 0?void 0:S.setDeviceId(y)}))).every(C=>C===!0)}catch(C){throw s.options.videoCaptureDefaults.deviceId=b,C}}else if(i==="audiooutput"){if(h=!0,!ud()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");s.options.webAudioMix&&(r=(l=yield gt.getInstance().normalizeDeviceId("audiooutput",r))!==null&&l!==void 0?l:""),(d=(p=s.options).audioOutput)!==null&&d!==void 0||(p.audioOutput={});const b=(u=s.getActiveDevice(i))!==null&&u!==void 0?u:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=r;try{s.options.webAudioMix&&((f=s.audioContext)===null||f===void 0||f.setSinkId(r)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(w=>w.setAudioOutput({deviceId:r})))}catch(w){throw s.options.audioOutput.deviceId=b,w}}return h&&(s.localParticipant.activeDeviceMap.set(i,r),s.emit(U.ActiveDeviceChanged,i,r)),g}()})}setupLocalParticipantEvents(){this.localParticipant.on(Z.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(Z.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(Z.AttributesChanged,this.onLocalAttributesChanged).on(Z.TrackMuted,this.onLocalTrackMuted).on(Z.TrackUnmuted,this.onLocalTrackUnmuted).on(Z.LocalTrackPublished,this.onLocalTrackPublished).on(Z.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(Z.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(Z.MediaDevicesError,this.onMediaDevicesError).on(Z.AudioStreamAcquired,this.startAudio).on(Z.ChatMessage,this.onLocalChatMessageSent).on(Z.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,n,i){if(this.state===ge.Connecting||this.state===ge.Reconnecting){const d=()=>{this.onTrackAdded(e,n,i),u()},u=()=>{this.off(U.Reconnected,d),this.off(U.Connected,d),this.off(U.Disconnected,u)};this.once(U.Reconnected,d),this.once(U.Connected,d),this.once(U.Disconnected,u);return}if(this.state===ge.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const r=Qk(n.id),s=r[0];let o=r[1],a=e.id;if(o&&o.startsWith("TR")&&(a=o),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const c=Array.from(this.remoteParticipants.values()).find(d=>d.sid===s);if(!c){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s),this.logContext);return}let l;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?l=this.options.adaptiveStream:l={}),c.addSubscribedMediaTrack(e,a,n,i,l)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var i;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==ge.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(r=>{r.trackPublications.forEach(s=>{r.unpublishTrack(s.trackSid)})}),this.localParticipant.trackPublications.forEach(r=>{var s,o,a;r.track&&this.localParticipant.unpublishTrack(r.track,e),e?((s=r.track)===null||s===void 0||s.detach(),(o=r.track)===null||o===void 0||o.stop()):(a=r.track)===null||a===void 0||a.stopMonitor()}),this.localParticipant.off(Z.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(Z.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(Z.AttributesChanged,this.onLocalAttributesChanged).off(Z.TrackMuted,this.onLocalTrackMuted).off(Z.TrackUnmuted,this.onLocalTrackUnmuted).off(Z.LocalTrackPublished,this.onLocalTrackPublished).off(Z.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(Z.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(Z.MediaDevicesError,this.onMediaDevicesError).off(Z.AudioStreamAcquired,this.startAudio).off(Z.ChatMessage,this.onLocalChatMessageSent).off(Z.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Ot()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(i=navigator.mediaDevices)===null||i===void 0||i.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(ge.Disconnected),this.emit(U.Disconnected,n)}}}handleParticipantDisconnected(e,n){var i;this.remoteParticipants.delete(e),n&&(n.trackPublications.forEach(r=>{n.unpublishTrack(r.trackSid,!0)}),this.emit(U.ParticipantDisconnected,n),n.setDisconnected(),(i=this.localParticipant)===null||i===void 0||i.handleParticipantDisconnected(n.identity))}handleStreamHeader(e,n){return A(this,void 0,void 0,function*(){var i;if(e.contentHeader.case==="byteHeader"){const r=this.byteStreamHandlers.get(e.topic);if(!r){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let s;const o={id:e.streamId,name:(i=e.contentHeader.value.name)!==null&&i!==void 0?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:ra(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:c=>{s=c,this.byteStreamControllers.set(e.streamId,{info:o,controller:s,startTime:Date.now()})}});r(new u2(o,a,ra(e.totalLength)),{identity:n})}else if(e.contentHeader.case==="textHeader"){const r=this.textStreamHandlers.get(e.topic);if(!r){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let s;const o={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:c=>{s=c,this.textStreamControllers.set(e.streamId,{info:o,controller:s,startTime:Date.now()})}});r(new f2(o,a,ra(e.totalLength)),{identity:n})}})}handleStreamChunk(e){const n=this.byteStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e);const i=this.textStreamControllers.get(e.streamId);i&&e.content.length>0&&i.controller.enqueue(e)}handleStreamTrailer(e){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close(),this.byteStreamControllers.delete(e.streamId))}selectDefaultDevices(){return A(this,void 0,void 0,function*(){var e,n,i;const r=gt.getInstance().previousDevices,s=yield gt.getInstance().getDevices(void 0,!1),o=$t();if((o==null?void 0:o.name)==="Chrome"&&o.os!=="iOS")for(let c of s){const l=r.find(d=>d.deviceId===c.deviceId);l&&l.label!==""&&l.kind===c.kind&&l.label!==c.label&&this.getActiveDevice(c.kind)==="default"&&this.emit(U.ActiveDeviceChanged,c.kind,c.deviceId)}const a=["audiooutput","audioinput","videoinput"];for(let c of a){const l=vT(c),d=this.localParticipant.getTrackPublication(l);if(d&&(!((e=d.track)===null||e===void 0)&&e.isUserProvided))continue;const u=s.filter(p=>p.kind===c),f=this.getActiveDevice(c);if(f===((n=r.filter(p=>p.kind===c)[0])===null||n===void 0?void 0:n.deviceId)&&u.length>0&&((i=u[0])===null||i===void 0?void 0:i.deviceId)!==f){yield this.switchActiveDevice(c,u[0].deviceId);continue}c==="audioinput"&&!Qh()||c==="videoinput"||u.length>0&&!u.find(p=>p.deviceId===this.getActiveDevice(c))&&(c!=="audiooutput"||!Qh())&&(yield this.switchActiveDevice(c,u[0].deviceId))}})}acquireAudioContext(){return A(this,void 0,void 0,function*(){var e,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=Nu())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(r=>r.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),jt(200)])}catch(r){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:r}))}const i=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";i!==this.canPlaybackAudio&&(this.audioEnabled=i,this.emit(U.AudioPlaybackStatusChanged,i))})}createParticipant(e,n){var i;let r;return n?r=Ra.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):r=new Ra(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&r.setAudioContext(this.audioContext),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&r.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),r}getOrCreateParticipant(e,n){if(this.remoteParticipants.has(e)){const r=this.remoteParticipants.get(e);return n&&r.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),r}const i=this.createParticipant(e,n);return this.remoteParticipants.set(e,i),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(U.ParticipantConnected,i),i.on(Z.TrackPublished,r=>{this.emitWhenConnected(U.TrackPublished,r,i)}).on(Z.TrackSubscribed,(r,s)=>{r.kind===V.Kind.Audio?(r.on(re.AudioPlaybackStarted,this.handleAudioPlaybackStarted),r.on(re.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):r.kind===V.Kind.Video&&(r.on(re.VideoPlaybackFailed,this.handleVideoPlaybackFailed),r.on(re.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(U.TrackSubscribed,r,s,i)}).on(Z.TrackUnpublished,r=>{this.emit(U.TrackUnpublished,r,i)}).on(Z.TrackUnsubscribed,(r,s)=>{this.emit(U.TrackUnsubscribed,r,s,i)}).on(Z.TrackMuted,r=>{this.emitWhenConnected(U.TrackMuted,r,i)}).on(Z.TrackUnmuted,r=>{this.emitWhenConnected(U.TrackUnmuted,r,i)}).on(Z.ParticipantMetadataChanged,r=>{this.emitWhenConnected(U.ParticipantMetadataChanged,r,i)}).on(Z.ParticipantNameChanged,r=>{this.emitWhenConnected(U.ParticipantNameChanged,r,i)}).on(Z.AttributesChanged,r=>{this.emitWhenConnected(U.ParticipantAttributesChanged,r,i)}).on(Z.ConnectionQualityChanged,r=>{this.emitWhenConnected(U.ConnectionQualityChanged,r,i)}).on(Z.ParticipantPermissionsChanged,r=>{this.emitWhenConnected(U.ParticipantPermissionsChanged,r,i)}).on(Z.TrackSubscriptionStatusChanged,(r,s)=>{this.emitWhenConnected(U.TrackSubscriptionStatusChanged,r,s,i)}).on(Z.TrackSubscriptionFailed,(r,s)=>{this.emit(U.TrackSubscriptionFailed,r,i,s)}).on(Z.TrackSubscriptionPermissionChanged,(r,s)=>{this.emitWhenConnected(U.TrackSubscriptionPermissionChanged,r,s,i)}).on(Z.Active,()=>{this.emitWhenConnected(U.ParticipantActive,i),i.kind===Yi.AGENT&&this.localParticipant.setActiveAgent(i)}),n&&i.updateInfo(n),i}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((i,r)=>(i.push(...r.getTrackPublications()),i),[]),n=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,n)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const n of e.videoTrackPublications.values())n.isSubscribed&&mT(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(e){const n=this.sidToIdentity.get(e);if(n)return this.remoteParticipants.get(n)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=bt.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,dn.STATE_MISMATCH))):e=0},w2)}clearConnectionReconcile(){this.connectionReconcileInterval&&bt.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(U.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[n,i]=e;this.emit(n,...i)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(this.state===ge.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,i]);else if(this.state===ge.Connected)return this.emit(e,...i);return!1}simulateParticipants(e){return A(this,void 0,void 0,function*(){var n,i;const r=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),s=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new Ka({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:ze.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new Zi({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(U.SignalConnected),this.emit(U.Connected),this.setAndEmitConnectionState(ge.Connected),r.video){const o=new wd(V.Kind.Video,new Cr({source:lt.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:cn.AUDIO,name:"video-dummy"}),new Ea(r.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:im(160*((n=s.aspectRatios[0])!==null&&n!==void 0?n:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(o),this.localParticipant.emit(Z.LocalTrackPublished,o)}if(r.audio){const o=new wd(V.Kind.Audio,new Cr({source:lt.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:cn.AUDIO}),new Ta(r.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:$c(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(o),this.localParticipant.emit(Z.LocalTrackPublished,o)}for(let o=0;o<s.count-1;o+=1){let a=new Zi({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(o),state:_r.ACTIVE,tracks:[],joinedAt:ze.parse(Date.now())});const c=this.getOrCreateParticipant(a.identity,a);if(s.video){const l=im(160*((i=s.aspectRatios[o%s.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),d=new Cr({source:lt.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:cn.AUDIO});c.addSubscribedMediaTrack(l,d.sid,new MediaStream([l]),new RTCRtpReceiver),a.tracks=[...a.tracks,d]}if(s.audio){const l=$c(),d=new Cr({source:lt.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:cn.AUDIO});c.addSubscribedMediaTrack(l,d.sid,new MediaStream([l]),new RTCRtpReceiver),a.tracks=[...a.tracks,d]}c.updateInfo(a)}})}emit(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(e!==U.ActiveSpeakersChanged&&e!==U.TranscriptionReceived){const s=yy(i).filter(o=>o!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:s}))}return super.emit(e,...i)}}pi.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function yy(t){return t.map(e=>{if(e)return Array.isArray(e)?yy(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var an;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(an||(an={}));class Ti extends Nn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=an.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new pi(i.roomOptions),this.connectOptions=i.connectOptions,this.options=i}run(e){return A(this,void 0,void 0,function*(){if(this.status!==an.IDLE)throw Error("check is running already");this.setStatus(an.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==an.SKIPPED&&this.setStatus(this.isSuccess()?an.SUCCESS:an.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return A(this,void 0,void 0,function*(){return this.room.state===ge.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return A(this,void 0,void 0,function*(){this.room&&this.room.state!==ge.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(an.SKIPPED)}switchProtocol(e){return A(this,void 0,void 0,function*(){let n=!1,i=!1;if(this.room.on(U.Reconnecting,()=>{n=!0}),this.room.once(U.Reconnected,()=>{i=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const r=Date.now()+1e4;for(;Date.now()<r;){if(i)return;yield jt(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class C2 extends Ti{get description(){return"Cloud regions"}perform(){return A(this,void 0,void 0,function*(){const e=new xd(this.url,this.token);if(!e.isCloud()){this.skip();return}const n=[],i=new Set;for(let s=0;s<3;s++){const o=yield e.getNextBestRegionUrl();if(!o)break;if(i.has(o))continue;i.add(o);const a=yield this.checkCloudRegion(o);this.appendMessage("".concat(a.region," RTT: ").concat(a.rtt,"ms, duration: ").concat(a.duration,"ms")),n.push(a)}n.sort((s,o)=>(s.duration-o.duration)*.5+(s.rtt-o.rtt)*.5);const r=n[0];this.bestStats=r,this.appendMessage("best Cloud region: ".concat(r.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return A(this,void 0,void 0,function*(){var n,i;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const r=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!r)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),o=1e3,c=1e6/o,l="A".repeat(o),d=Date.now();for(let g=0;g<c;g++)yield s.write(l);yield s.close();const u=Date.now(),f=yield(i=this.room.engine.pcManager)===null||i===void 0?void 0:i.publisher.getStats(),p={region:r,rtt:1e4,duration:u-d};return f==null||f.forEach(g=>{g.type==="candidate-pair"&&g.nominated&&(p.rtt=g.currentRoundTripTime*1e3)}),yield this.disconnect(),p})}}const Jc=1e4;class k2 extends Ti{get description(){return"Connection via UDP vs TCP"}perform(){return A(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-n.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const i=this.bestStats;this.appendMessage("upstream bitrate: ".concat((i.bitrateTotal/i.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((i.rttTotal/i.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((i.jitterTotal/i.count*1e3).toFixed(2)," ms")),i.packetsLost>0&&this.appendWarning("packets lost: ".concat((i.packetsLost/i.packetsSent*100).toFixed(2),"%")),i.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((i.qualityLimitationDurations.bandwidth/(Jc/1e3)*100).toFixed(2),"%")),i.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((i.qualityLimitationDurations.cpu/(Jc/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return A(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const i=n.getContext("2d");if(!i)throw new Error("Could not get canvas context");let r=0;const s=()=>{r=(r+1)%360,i.fillStyle="hsl(".concat(r,", 100%, 50%)"),i.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const a=n.captureStream(30).getVideoTracks()[0],l=(yield this.room.localParticipant.publishTrack(a,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,d={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},u=setInterval(()=>A(this,void 0,void 0,function*(){const f=yield l.getRTCStatsReport();f==null||f.forEach(p=>{p.type==="outbound-rtp"?(d.packetsSent=p.packetsSent,d.qualityLimitationDurations=p.qualityLimitationDurations,d.bitrateTotal+=p.targetBitrate,d.count++):p.type==="remote-inbound-rtp"&&(d.packetsLost=p.packetsLost,d.rttTotal+=p.roundTripTime,d.jitterTotal+=p.jitter)})}),1e3);return yield new Promise(f=>setTimeout(f,Jc)),clearInterval(u),a.stop(),n.remove(),yield this.disconnect(),d})}}class T2 extends Ti{get description(){return"Can publish audio"}perform(){return A(this,void 0,void 0,function*(){var e;const n=yield this.connect(),i=yield y2();if(yield ry(i,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(i),yield new Promise(a=>setTimeout(a,3e3));const s=yield(e=i.sender)===null||e===void 0?void 0:e.getStats();if(!s)throw new Error("Could not get RTCStats");let o=0;if(s.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="audio"||!a.kind&&a.mediaType==="audio")&&(o=a.packetsSent)}),o===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(o," audio packets"))})}}class E2 extends Ti{get description(){return"Can publish video"}perform(){return A(this,void 0,void 0,function*(){var e;const n=yield this.connect(),i=yield v2();yield this.checkForVideo(i.mediaStreamTrack),n.localParticipant.publishTrack(i),yield new Promise(o=>setTimeout(o,5e3));const r=yield(e=i.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="video"||!o.kind&&o.mediaType==="video")&&(s+=o.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(e){return A(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(e.clone());const i=document.createElement("video");i.srcObject=n,i.muted=!0,yield new Promise(r=>{i.onplay=()=>{setTimeout(()=>{var s,o,a,c;const l=document.createElement("canvas"),d=e.getSettings(),u=(o=(s=d.width)!==null&&s!==void 0?s:i.videoWidth)!==null&&o!==void 0?o:1280,f=(c=(a=d.height)!==null&&a!==void 0?a:i.videoHeight)!==null&&c!==void 0?c:720;l.width=u,l.height=f;const p=l.getContext("2d");p.drawImage(i,0,0);const h=p.getImageData(0,0,l.width,l.height).data;let y=!0;for(let b=0;b<h.length;b+=4)if(h[b]!==0||h[b+1]!==0||h[b+2]!==0){y=!1;break}y?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),r()},1e3)},i.play()}),n.getTracks().forEach(r=>r.stop()),i.remove()})}}class P2 extends Ti{get description(){return"Resuming connection after interruption"}perform(){return A(this,void 0,void 0,function*(){var e;const n=yield this.connect();let i=!1,r=!1,s;const o=new Promise(l=>{setTimeout(l,5e3),s=l}),a=()=>{i=!0};n.on(U.SignalReconnecting,a).on(U.Reconnecting,a).on(U.Reconnected,()=>{r=!0,s(!0)}),(e=n.engine.client.ws)===null||e===void 0||e.close();const c=n.engine.client.onClose;if(c&&c(""),yield o,i){if(!r||n.state!==ge.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class R2 extends Ti{get description(){return"Can connect via TURN"}perform(){return A(this,void 0,void 0,function*(){var e,n;const i=new Ou,r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let s=!1,o=!1,a=!1;for(let c of r.iceServers)for(let l of c.urls)l.startsWith("turn:")?(o=!0,a=!0):l.startsWith("turns:")&&(o=!0,a=!0,s=!0),l.startsWith("stun:")&&(a=!0);a?o&&!s&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield i.close(),!((n=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||n===void 0)&&n.iceServers||o?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(c=>setTimeout(c,0)))})}}class A2 extends Ti{get description(){return"Establishing WebRTC connection"}perform(){return A(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(U.SignalConnected,()=>{const i=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(r,s)=>{if(r.candidate){const o=new RTCIceCandidate(r);let a="".concat(o.protocol," ").concat(o.address,":").concat(o.port," ").concat(o.type);o.address&&(I2(o.address)?a+=" (private)":o.protocol==="tcp"&&o.tcpType==="passive"?(e=!0,a+=" (passive)"):o.protocol==="udp"&&(n=!0)),this.appendMessage(a)}i&&i(r,s)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=r=>{r instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(r.errorCode," ").concat(r.errorText," ").concat(r.url))})});try{yield this.connect(),Ce.info("now the room is connected")}catch(i){throw this.appendWarning("ports need to be open on firewall in order to connect."),i}e||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function I2(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const n=parseInt(e[1],10);if(n>=16&&n<=31)return!0}}return!1}class M2 extends Ti{get description(){return"Connecting to signal connection via WebSocket"}perform(){return A(this,void 0,void 0,function*(){var e,n,i;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let r=new Ou;const s=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((e=s.serverInfo)===null||e===void 0?void 0:e.edition)===sv.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((i=s.serverInfo)===null||i===void 0?void 0:i.region)),yield r.close()})}}class jL extends Nn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=n,this.options=i}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:an.IDLE,name:"",description:""}),e}updateCheck(e,n){this.checkResults.set(e,n),this.emit("checkUpdate",e,n)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==an.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return A(this,void 0,void 0,function*(){const n=this.getNextCheckId(),i=new e(this.url,this.token,this.options),r=o=>{this.updateCheck(n,o)};i.on("update",r);const s=yield i.run();return i.off("update",r),s})}checkWebsocket(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(M2)})}checkWebRTC(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(A2)})}checkTURN(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(R2)})}checkReconnect(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(P2)})}checkPublishAudio(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(T2)})}checkPublishVideo(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(E2)})}checkConnectionProtocol(){return A(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(k2);if(e.data&&"protocol"in e.data){const n=e.data;this.options.protocol=n.protocol}return e})}checkCloudRegion(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(C2)})}}const Bu=R.createContext({});function $u(t){const e=R.useRef(null);return e.current===null&&(e.current=t()),e.current}const Hu=typeof window<"u",by=Hu?R.useLayoutEffect:R.useEffect,Qa=R.createContext(null);function zu(t,e){t.indexOf(e)===-1&&t.push(e)}function Wu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Zn=(t,e,n)=>n>e?e:n<t?t:n;function Cd(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let is=()=>{},Yn=()=>{};process.env.NODE_ENV!=="production"&&(is=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(Cd(e,n))},Yn=(t,e,n)=>{if(!t)throw new Error(Cd(e,n))});const Jn={},xy=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Sy(t){return typeof t=="object"&&t!==null}const wy=t=>/^0[^.\s]+$/u.test(t);function qu(t){let e;return()=>(e===void 0&&(e=t()),e)}const Xt=t=>t,_2=(t,e)=>n=>e(t(n)),ao=(...t)=>t.reduce(_2),Ws=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class Ku{constructor(){this.subscriptions=[]}add(e){return zu(this.subscriptions,e),()=>Wu(this.subscriptions,e)}notify(e,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,i);else for(let s=0;s<r;s++){const o=this.subscriptions[s];o&&o(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const un=t=>t*1e3,En=t=>t/1e3;function Cy(t,e){return e?t*(1e3/e):0}const wm=new Set;function Gu(t,e,n){t||wm.has(e)||(console.warn(Cd(e,n)),wm.add(e))}const ky=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,N2=1e-7,O2=12;function D2(t,e,n,i,r){let s,o,a=0;do o=e+(n-e)/2,s=ky(o,i,r)-t,s>0?n=o:e=o;while(Math.abs(s)>N2&&++a<O2);return o}function co(t,e,n,i){if(t===e&&n===i)return Xt;const r=s=>D2(s,0,1,t,n);return s=>s===0||s===1?s:ky(r(s),e,i)}const Ty=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ey=t=>e=>1-t(1-e),Py=co(.33,1.53,.69,.99),Zu=Ey(Py),Ry=Ty(Zu),Ay=t=>(t*=2)<1?.5*Zu(t):.5*(2-Math.pow(2,-10*(t-1))),Yu=t=>1-Math.sin(Math.acos(t)),Iy=Ey(Yu),My=Ty(Yu),j2=co(.42,0,1,1),L2=co(0,0,.58,1),_y=co(.42,0,.58,1),V2=t=>Array.isArray(t)&&typeof t[0]!="number",Ny=t=>Array.isArray(t)&&typeof t[0]=="number",Cm={linear:Xt,easeIn:j2,easeInOut:_y,easeOut:L2,circIn:Yu,circInOut:My,circOut:Iy,backIn:Zu,backInOut:Ry,backOut:Py,anticipate:Ay},F2=t=>typeof t=="string",km=t=>{if(Ny(t)){Yn(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,i,r]=t;return co(e,n,i,r)}else if(F2(t))return Yn(Cm[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Cm[t];return t},ko=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function U2(t,e){let n=new Set,i=new Set,r=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(l.schedule(d),t()),d(a)}const l={schedule:(d,u=!1,f=!1)=>{const g=f&&r?n:i;return u&&o.add(d),g.has(d)||g.add(d),d},cancel:d=>{i.delete(d),o.delete(d)},process:d=>{if(a=d,r){s=!0;return}r=!0,[n,i]=[i,n],n.forEach(c),n.clear(),r=!1,s&&(s=!1,l.process(d))}};return l}const B2=40;function Oy(t,e){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=ko.reduce((C,S)=>(C[S]=U2(s),C),{}),{setup:a,read:c,resolveKeyframes:l,preUpdate:d,update:u,preRender:f,render:p,postRender:g}=o,h=()=>{const C=Jn.useManualTiming?r.timestamp:performance.now();n=!1,Jn.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(C-r.timestamp,B2),1)),r.timestamp=C,r.isProcessing=!0,a.process(r),c.process(r),l.process(r),d.process(r),u.process(r),f.process(r),p.process(r),g.process(r),r.isProcessing=!1,n&&e&&(i=!1,t(h))},y=()=>{n=!0,i=!0,r.isProcessing||t(h)};return{schedule:ko.reduce((C,S)=>{const x=o[S];return C[S]=(T,E=!1,P=!1)=>(n||y(),x.schedule(T,E,P)),C},{}),cancel:C=>{for(let S=0;S<ko.length;S++)o[ko[S]].cancel(C)},state:r,steps:o}}const{schedule:We,cancel:gi,state:vt,steps:Xc}=Oy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xt,!0);let oa;function $2(){oa=void 0}const Dt={now:()=>(oa===void 0&&Dt.set(vt.isProcessing||Jn.useManualTiming?vt.timestamp:performance.now()),oa),set:t=>{oa=t,queueMicrotask($2)}},Dy=t=>e=>typeof e=="string"&&e.startsWith(t),Ju=Dy("--"),H2=Dy("var(--"),Xu=t=>H2(t)?z2.test(t.split("/*")[0].trim()):!1,z2=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,rs={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},qs={...rs,transform:t=>Zn(0,1,t)},To={...rs,default:1},Vs=t=>Math.round(t*1e5)/1e5,Qu=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function W2(t){return t==null}const q2=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ef=(t,e)=>n=>!!(typeof n=="string"&&q2.test(n)&&n.startsWith(t)||e&&!W2(n)&&Object.prototype.hasOwnProperty.call(n,e)),jy=(t,e,n)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(Qu);return{[t]:parseFloat(r),[e]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},K2=t=>Zn(0,255,t),Qc={...rs,transform:t=>Math.round(K2(t))},Ui={test:ef("rgb","red"),parse:jy("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Qc.transform(t)+", "+Qc.transform(e)+", "+Qc.transform(n)+", "+Vs(qs.transform(i))+")"};function G2(t){let e="",n="",i="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const kd={test:ef("#"),parse:G2,transform:Ui.transform},lo=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),oi=lo("deg"),Pn=lo("%"),he=lo("px"),Z2=lo("vh"),Y2=lo("vw"),Tm={...Pn,parse:t=>Pn.parse(t)/100,transform:t=>Pn.transform(t*100)},Er={test:ef("hsl","hue"),parse:jy("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+Pn.transform(Vs(e))+", "+Pn.transform(Vs(n))+", "+Vs(qs.transform(i))+")"},ct={test:t=>Ui.test(t)||kd.test(t)||Er.test(t),parse:t=>Ui.test(t)?Ui.parse(t):Er.test(t)?Er.parse(t):kd.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ui.transform(t):Er.transform(t),getAnimatableNone:t=>{const e=ct.parse(t);return e.alpha=0,ct.transform(e)}},J2=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function X2(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Qu))==null?void 0:e.length)||0)+(((n=t.match(J2))==null?void 0:n.length)||0)>0}const Ly="number",Vy="color",Q2="var",eE="var(",Em="${}",tE=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ks(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(tE,c=>(ct.test(c)?(i.color.push(s),r.push(Vy),n.push(ct.parse(c))):c.startsWith(eE)?(i.var.push(s),r.push(Q2),n.push(c)):(i.number.push(s),r.push(Ly),n.push(parseFloat(c))),++s,Em)).split(Em);return{values:n,split:a,indexes:i,types:r}}function Fy(t){return Ks(t).values}function Uy(t){const{split:e,types:n}=Ks(t),i=e.length;return r=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],r[o]!==void 0){const a=n[o];a===Ly?s+=Vs(r[o]):a===Vy?s+=ct.transform(r[o]):s+=r[o]}return s}}const nE=t=>typeof t=="number"?0:ct.test(t)?ct.getAnimatableNone(t):t;function iE(t){const e=Fy(t);return Uy(t)(e.map(nE))}const vi={test:X2,parse:Fy,createTransformer:Uy,getAnimatableNone:iE};function el(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function rE({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let r=0,s=0,o=0;if(!e)r=s=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;r=el(c,a,t+1/3),s=el(c,a,t),o=el(c,a,t-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function Aa(t,e){return n=>n>0?e:t}const Ge=(t,e,n)=>t+(e-t)*n,tl=(t,e,n)=>{const i=t*t,r=n*(e*e-i)+i;return r<0?0:Math.sqrt(r)},sE=[kd,Ui,Er],oE=t=>sE.find(e=>e.test(t));function Pm(t){const e=oE(t);if(is(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===Er&&(n=rE(n)),n}const Rm=(t,e)=>{const n=Pm(t),i=Pm(e);if(!n||!i)return Aa(t,e);const r={...n};return s=>(r.red=tl(n.red,i.red,s),r.green=tl(n.green,i.green,s),r.blue=tl(n.blue,i.blue,s),r.alpha=Ge(n.alpha,i.alpha,s),Ui.transform(r))},Td=new Set(["none","hidden"]);function aE(t,e){return Td.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function cE(t,e){return n=>Ge(t,e,n)}function tf(t){return typeof t=="number"?cE:typeof t=="string"?Xu(t)?Aa:ct.test(t)?Rm:uE:Array.isArray(t)?By:typeof t=="object"?ct.test(t)?Rm:lE:Aa}function By(t,e){const n=[...t],i=n.length,r=t.map((s,o)=>tf(s)(s,e[o]));return s=>{for(let o=0;o<i;o++)n[o]=r[o](s);return n}}function lE(t,e){const n={...t,...e},i={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(i[r]=tf(t[r])(t[r],e[r]));return r=>{for(const s in i)n[s]=i[s](r);return n}}function dE(t,e){const n=[],i={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const s=e.types[r],o=t.indexes[s][i[s]],a=t.values[o]??0;n[r]=a,i[s]++}return n}const uE=(t,e)=>{const n=vi.createTransformer(e),i=Ks(t),r=Ks(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Td.has(t)&&!r.values.length||Td.has(e)&&!i.values.length?aE(t,e):ao(By(dE(i,r),r.values),n):(is(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Aa(t,e))};function $y(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ge(t,e,n):tf(t)(t,e)}const fE=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>We.update(e,n),stop:()=>gi(e),now:()=>vt.isProcessing?vt.timestamp:Dt.now()}},Hy=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let s=0;s<r;s++)i+=Math.round(t(s/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Ia=2e4;function nf(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<Ia;)e+=n,i=t.next(e);return e>=Ia?1/0:e}function hE(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(nf(i),Ia);return{type:"keyframes",ease:s=>i.next(r*s).value/e,duration:En(r)}}const mE=5;function zy(t,e,n){const i=Math.max(e-mE,0);return Cy(n-t(i),e-i)}const Ke={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},nl=.001;function pE({duration:t=Ke.duration,bounce:e=Ke.bounce,velocity:n=Ke.velocity,mass:i=Ke.mass}){let r,s;is(t<=un(Ke.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=Zn(Ke.minDamping,Ke.maxDamping,o),t=Zn(Ke.minDuration,Ke.maxDuration,En(t)),o<1?(r=l=>{const d=l*o,u=d*t,f=d-n,p=Ed(l,o),g=Math.exp(-u);return nl-f/p*g},s=l=>{const u=l*o*t,f=u*n+n,p=Math.pow(o,2)*Math.pow(l,2)*t,g=Math.exp(-u),h=Ed(Math.pow(l,2),o);return(-r(l)+nl>0?-1:1)*((f-p)*g)/h}):(r=l=>{const d=Math.exp(-l*t),u=(l-n)*t+1;return-nl+d*u},s=l=>{const d=Math.exp(-l*t),u=(n-l)*(t*t);return d*u});const a=5/t,c=vE(r,s,a);if(t=un(t),isNaN(c))return{stiffness:Ke.stiffness,damping:Ke.damping,duration:t};{const l=Math.pow(c,2)*i;return{stiffness:l,damping:o*2*Math.sqrt(i*l),duration:t}}}const gE=12;function vE(t,e,n){let i=n;for(let r=1;r<gE;r++)i=i-t(i)/e(i);return i}function Ed(t,e){return t*Math.sqrt(1-e*e)}const yE=["duration","bounce"],bE=["stiffness","damping","mass"];function Am(t,e){return e.some(n=>t[n]!==void 0)}function xE(t){let e={velocity:Ke.velocity,stiffness:Ke.stiffness,damping:Ke.damping,mass:Ke.mass,isResolvedFromDuration:!1,...t};if(!Am(t,bE)&&Am(t,yE))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*Zn(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Ke.mass,stiffness:r,damping:s}}else{const n=pE(t);e={...e,...n,mass:Ke.mass},e.isResolvedFromDuration=!0}return e}function Ma(t=Ke.visualDuration,e=Ke.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:s},{stiffness:c,damping:l,mass:d,duration:u,velocity:f,isResolvedFromDuration:p}=xE({...n,velocity:-En(n.velocity||0)}),g=f||0,h=l/(2*Math.sqrt(c*d)),y=o-s,b=En(Math.sqrt(c/d)),w=Math.abs(y)<5;i||(i=w?Ke.restSpeed.granular:Ke.restSpeed.default),r||(r=w?Ke.restDelta.granular:Ke.restDelta.default);let C;if(h<1){const x=Ed(b,h);C=T=>{const E=Math.exp(-h*b*T);return o-E*((g+h*b*y)/x*Math.sin(x*T)+y*Math.cos(x*T))}}else if(h===1)C=x=>o-Math.exp(-b*x)*(y+(g+b*y)*x);else{const x=b*Math.sqrt(h*h-1);C=T=>{const E=Math.exp(-h*b*T),P=Math.min(x*T,300);return o-E*((g+h*b*y)*Math.sinh(P)+x*y*Math.cosh(P))/x}}const S={calculatedDuration:p&&u||null,next:x=>{const T=C(x);if(p)a.done=x>=u;else{let E=x===0?g:0;h<1&&(E=x===0?un(g):zy(C,x,T));const P=Math.abs(E)<=i,_=Math.abs(o-T)<=r;a.done=P&&_}return a.value=a.done?o:T,a},toString:()=>{const x=Math.min(nf(S),Ia),T=Hy(E=>S.next(x*E).value,x,30);return x+"ms "+T},toTransition:()=>{}};return S}Ma.applyToOptions=t=>{const e=hE(t,100,Ma);return t.ease=e.ease,t.duration=un(e.duration),t.type="keyframes",t};function Pd({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:c,restDelta:l=.5,restSpeed:d}){const u=t[0],f={done:!1,value:u},p=P=>a!==void 0&&P<a||c!==void 0&&P>c,g=P=>a===void 0?c:c===void 0||Math.abs(a-P)<Math.abs(c-P)?a:c;let h=n*e;const y=u+h,b=o===void 0?y:o(y);b!==y&&(h=b-u);const w=P=>-h*Math.exp(-P/i),C=P=>b+w(P),S=P=>{const _=w(P),k=C(P);f.done=Math.abs(_)<=l,f.value=f.done?b:k};let x,T;const E=P=>{p(f.value)&&(x=P,T=Ma({keyframes:[f.value,g(f.value)],velocity:zy(C,P,f.value),damping:r,stiffness:s,restDelta:l,restSpeed:d}))};return E(0),{calculatedDuration:null,next:P=>{let _=!1;return!T&&x===void 0&&(_=!0,S(P),E(P)),x!==void 0&&P>=x?T.next(P-x):(!_&&S(P),f)}}}function SE(t,e,n){const i=[],r=n||Jn.mix||$y,s=t.length-1;for(let o=0;o<s;o++){let a=r(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||Xt:e;a=ao(c,a)}i.push(a)}return i}function wE(t,e,{clamp:n=!0,ease:i,mixer:r}={}){const s=t.length;if(Yn(s===e.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=SE(e,i,r),c=a.length,l=d=>{if(o&&d<t[0])return e[0];let u=0;if(c>1)for(;u<t.length-2&&!(d<t[u+1]);u++);const f=Ws(t[u],t[u+1],d);return a[u](f)};return n?d=>l(Zn(t[0],t[s-1],d)):l}function CE(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=Ws(0,e,i);t.push(Ge(n,1,r))}}function kE(t){const e=[0];return CE(e,t.length-1),e}function TE(t,e){return t.map(n=>n*e)}function EE(t,e){return t.map(()=>e||_y).splice(0,t.length-1)}function Pr({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const r=V2(i)?i.map(km):km(i),s={done:!1,value:e[0]},o=TE(n&&n.length===e.length?n:kE(e),t),a=wE(o,e,{ease:Array.isArray(r)?r:EE(e,r)});return{calculatedDuration:t,next:c=>(s.value=a(c),s.done=c>=t,s)}}const PE=t=>t!==null;function rf(t,{repeat:e,repeatType:n="loop"},i,r=1){const s=t.filter(PE),a=r<0||e&&n!=="loop"&&e%2===1?0:s.length-1;return!a||i===void 0?s[a]:i}const RE={decay:Pd,inertia:Pd,tween:Pr,keyframes:Pr,spring:Ma};function Wy(t){typeof t.type=="string"&&(t.type=RE[t.type])}class sf{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const AE=t=>t/100;class of extends sf{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var i,r;const{motionValue:n}=this.options;n&&n.updatedAt!==Dt.now()&&this.tick(Dt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(i=this.options).onStop)==null||r.call(i))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;Wy(e);const{type:n=Pr,repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=e;let{keyframes:a}=e;const c=n||Pr;process.env.NODE_ENV!=="production"&&c!==Pr&&Yn(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),c!==Pr&&typeof a[0]!="number"&&(this.mixKeyframes=ao(AE,$y(a[0],a[1])),a=[0,100]);const l=c({...e,keyframes:a});s==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...a].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=nf(l));const{calculatedDuration:d}=l;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=l}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:i,totalDuration:r,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return i.next(0);const{delay:l=0,keyframes:d,repeat:u,repeatType:f,repeatDelay:p,type:g,onUpdate:h,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-l*(this.playbackSpeed>=0?1:-1),w=this.playbackSpeed>=0?b<0:b>r;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let C=this.currentTime,S=i;if(u){const P=Math.min(this.currentTime,r)/a;let _=Math.floor(P),k=P%1;!k&&P>=1&&(k=1),k===1&&_--,_=Math.min(_,u+1),!!(_%2)&&(f==="reverse"?(k=1-k,p&&(k-=p/a)):f==="mirror"&&(S=o)),C=Zn(0,1,k)*a}const x=w?{done:!1,value:d[0]}:S.next(C);s&&(x.value=s(x.value));let{done:T}=x;!w&&c!==null&&(T=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return E&&g!==Pd&&(x.value=rf(d,this.options,y,this.speed)),h&&h(x.value),E&&this.finish(),x}then(e,n){return this.finished.then(e,n)}get duration(){return En(this.calculatedDuration)}get time(){return En(this.currentTime)}set time(e){var n;e=un(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Dt.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=En(this.currentTime))}play(){var r,s;if(this.isStopped)return;const{driver:e=fE,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(s=(r=this.options).onPlay)==null||s.call(r);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Dt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function IE(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Bi=t=>t*180/Math.PI,Rd=t=>{const e=Bi(Math.atan2(t[1],t[0]));return Ad(e)},ME={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Rd,rotateZ:Rd,skewX:t=>Bi(Math.atan(t[1])),skewY:t=>Bi(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ad=t=>(t=t%360,t<0&&(t+=360),t),Im=Rd,Mm=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),_m=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),_E={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Mm,scaleY:_m,scale:t=>(Mm(t)+_m(t))/2,rotateX:t=>Ad(Bi(Math.atan2(t[6],t[5]))),rotateY:t=>Ad(Bi(Math.atan2(-t[2],t[0]))),rotateZ:Im,rotate:Im,skewX:t=>Bi(Math.atan(t[4])),skewY:t=>Bi(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Id(t){return t.includes("scale")?1:0}function Md(t,e){if(!t||t==="none")return Id(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(n)i=_E,r=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=ME,r=a}if(!r)return Id(e);const s=i[e],o=r[1].split(",").map(OE);return typeof s=="function"?s(o):o[s]}const NE=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Md(n,e)};function OE(t){return parseFloat(t.trim())}const ss=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],os=new Set(ss),Nm=t=>t===rs||t===he,DE=new Set(["x","y","z"]),jE=ss.filter(t=>!DE.has(t));function LE(t){const e=[];return jE.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const zi={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Md(e,"x"),y:(t,{transform:e})=>Md(e,"y")};zi.translateX=zi.x;zi.translateY=zi.y;const Wi=new Set;let _d=!1,Nd=!1,Od=!1;function qy(){if(Nd){const t=Array.from(Wi).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const r=LE(i);r.length&&(n.set(i,r),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,o])=>{var a;(a=i.getValue(s))==null||a.set(o)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Nd=!1,_d=!1,Wi.forEach(t=>t.complete(Od)),Wi.clear()}function Ky(){Wi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Nd=!0)})}function VE(){Od=!0,Ky(),qy(),Od=!1}class af{constructor(e,n,i,r,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Wi.add(this),_d||(_d=!0,We.read(Ky),We.resolveKeyframes(qy))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:r}=this;if(e[0]===null){const s=r==null?void 0:r.get(),o=e[e.length-1];if(s!==void 0)e[0]=s;else if(i&&n){const a=i.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),r&&s===void 0&&r.set(e[0])}IE(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Wi.delete(this)}cancel(){this.state==="scheduled"&&(Wi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const FE=t=>t.startsWith("--");function UE(t,e,n){FE(e)?t.style.setProperty(e,n):t.style[e]=n}const BE=qu(()=>window.ScrollTimeline!==void 0),$E={};function HE(t,e){const n=qu(t);return()=>$E[e]??n()}const Gy=HE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ms=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Om={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ms([0,.65,.55,1]),circOut:Ms([.55,0,1,.45]),backIn:Ms([.31,.01,.66,-.59]),backOut:Ms([.33,1.53,.69,.99])};function Zy(t,e){if(t)return typeof t=="function"?Gy()?Hy(t,e):"ease-out":Ny(t)?Ms(t):Array.isArray(t)?t.map(n=>Zy(n,e)||Om.easeOut):Om[t]}function zE(t,e,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:c}={},l=void 0){const d={[e]:n};c&&(d.offset=c);const u=Zy(a,r);Array.isArray(u)&&(d.easing=u);const f={delay:i,duration:r,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return l&&(f.pseudoElement=l),t.animate(d,f)}function Yy(t){return typeof t=="function"&&"applyToOptions"in t}function WE({type:t,...e}){return Yy(t)&&Gy()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class qE extends sf{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:i,keyframes:r,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:a,onComplete:c}=e;this.isPseudoElement=!!s,this.allowFlatten=o,this.options=e,Yn(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=WE(e);this.animation=zE(n,i,r,l,s),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const d=rf(r,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(d):UE(n,i,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,i;const e=((i=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:i.call(n).duration)||0;return En(Number(e))}get time(){return En(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=un(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&BE()?(this.animation.timeline=e,Xt):n(this)}}const Jy={anticipate:Ay,backInOut:Ry,circInOut:My};function KE(t){return t in Jy}function GE(t){typeof t.ease=="string"&&KE(t.ease)&&(t.ease=Jy[t.ease])}const Dm=10;class ZE extends qE{constructor(e){GE(e),Wy(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:i,onComplete:r,element:s,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new of({...o,autoplay:!1}),c=un(this.finishedTime??this.time);n.setWithVelocity(a.sample(c-Dm).value,a.sample(c).value,Dm),a.stop()}}const jm=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(vi.test(t)||t==="0")&&!t.startsWith("url("));function YE(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function JE(t,e,n,i){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const s=t[t.length-1],o=jm(r,e),a=jm(s,e);return is(o===a,`You are trying to animate ${e} from "${r}" to "${s}". "${o?s:r}" is not an animatable value.`,"value-not-animatable"),!o||!a?!1:YE(t)||(n==="spring"||Yy(n))&&i}function Dd(t){t.duration=0,t.type}const XE=new Set(["opacity","clipPath","filter","transform"]),QE=qu(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function eP(t){var d;const{motionValue:e,name:n,repeatDelay:i,repeatType:r,damping:s,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:l}=e.owner.getProps();return QE()&&n&&XE.has(n)&&(n!=="transform"||!l)&&!c&&!i&&r!=="mirror"&&s!==0&&o!=="inertia"}const tP=40;class nP extends sf{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:o="loop",keyframes:a,name:c,motionValue:l,element:d,...u}){var g;super(),this.stop=()=>{var h,y;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=Dt.now();const f={autoplay:e,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:o,name:c,motionValue:l,element:d,...u},p=(d==null?void 0:d.KeyframeResolver)||af;this.keyframeResolver=new p(a,(h,y,b)=>this.onKeyframesResolved(h,y,f,!b),c,l,d),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,n,i,r){this.keyframeResolver=void 0;const{name:s,type:o,velocity:a,delay:c,isHandoff:l,onUpdate:d}=i;this.resolvedAt=Dt.now(),JE(e,s,o,a)||((Jn.instantAnimations||!c)&&(d==null||d(rf(e,i,n))),e[0]=e[e.length-1],Dd(i),i.repeat=0);const f={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>tP?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},p=!l&&eP(f)?new ZE({...f,element:f.motionValue.owner.current}):new of(f);p.finished.then(()=>this.notifyFinished()).catch(Xt),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),VE()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const iP=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function rP(t){const e=iP.exec(t);if(!e)return[,];const[,n,i,r]=e;return[`--${n??i}`,r]}const sP=4;function Xy(t,e,n=1){Yn(n<=sP,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=rP(t);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return xy(o)?parseFloat(o):o}return Xu(r)?Xy(r,e,n+1):r}function cf(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const Qy=new Set(["width","height","top","left","right","bottom",...ss]),oP={test:t=>t==="auto",parse:t=>t},eb=t=>e=>e.test(t),tb=[rs,he,Pn,oi,Y2,Z2,oP],Lm=t=>tb.find(eb(t));function aP(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||wy(t):!0}const cP=new Set(["brightness","contrast","saturate","opacity"]);function lP(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Qu)||[];if(!i)return t;const r=n.replace(i,"");let s=cP.has(e)?1:0;return i!==n&&(s*=100),e+"("+s+r+")"}const dP=/\b([a-z-]*)\(.*?\)/gu,jd={...vi,getAnimatableNone:t=>{const e=t.match(dP);return e?e.map(lP).join(" "):t}},Vm={...rs,transform:Math.round},uP={rotate:oi,rotateX:oi,rotateY:oi,rotateZ:oi,scale:To,scaleX:To,scaleY:To,scaleZ:To,skew:oi,skewX:oi,skewY:oi,distance:he,translateX:he,translateY:he,translateZ:he,x:he,y:he,z:he,perspective:he,transformPerspective:he,opacity:qs,originX:Tm,originY:Tm,originZ:he},lf={borderWidth:he,borderTopWidth:he,borderRightWidth:he,borderBottomWidth:he,borderLeftWidth:he,borderRadius:he,radius:he,borderTopLeftRadius:he,borderTopRightRadius:he,borderBottomRightRadius:he,borderBottomLeftRadius:he,width:he,maxWidth:he,height:he,maxHeight:he,top:he,right:he,bottom:he,left:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,backgroundPositionX:he,backgroundPositionY:he,...uP,zIndex:Vm,fillOpacity:qs,strokeOpacity:qs,numOctaves:Vm},fP={...lf,color:ct,backgroundColor:ct,outlineColor:ct,fill:ct,stroke:ct,borderColor:ct,borderTopColor:ct,borderRightColor:ct,borderBottomColor:ct,borderLeftColor:ct,filter:jd,WebkitFilter:jd},nb=t=>fP[t];function ib(t,e){let n=nb(t);return n!==jd&&(n=vi),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const hP=new Set(["auto","none","0"]);function mP(t,e,n){let i=0,r;for(;i<t.length&&!r;){const s=t[i];typeof s=="string"&&!hP.has(s)&&Ks(s).values.length&&(r=t[i]),i++}if(r&&n)for(const s of e)t[s]=ib(n,r)}class pP extends af{constructor(e,n,i,r,s){super(e,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let l=e[c];if(typeof l=="string"&&(l=l.trim(),Xu(l))){const d=Xy(l,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!Qy.has(i)||e.length!==2)return;const[r,s]=e,o=Lm(r),a=Lm(s);if(o!==a)if(Nm(o)&&Nm(a))for(let c=0;c<e.length;c++){const l=e[c];typeof l=="string"&&(e[c]=parseFloat(l))}else zi[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let r=0;r<e.length;r++)(e[r]===null||aP(e[r]))&&i.push(r);i.length&&mP(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=zi[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&e.getValue(i,r).jump(r,!1)}measureEndState(){var a;const{element:e,name:n,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const r=e.getValue(n);r&&r.jump(this.measuredOrigin,!1);const s=i.length-1,o=i[s];i[s]=zi[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([c,l])=>{e.getValue(c).set(l)}),this.resolveNoneKeyframes()}}function gP(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;const r=(n==null?void 0:n[t])??i.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}const rb=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function sb(t){return Sy(t)&&"offsetHeight"in t}const Fm=30,vP=t=>!isNaN(parseFloat(t));class yP{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var s;const r=Dt.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Dt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=vP(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&Gu(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Ku);const i=this.events[e].add(n);return e==="change"?()=>{i(),We.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Dt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Fm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Fm);return Cy(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Kr(t,e){return new yP(t,e)}const{schedule:df}=Oy(queueMicrotask,!1),sn={x:!1,y:!1};function ob(){return sn.x||sn.y}function bP(t){return t==="x"||t==="y"?sn[t]?null:(sn[t]=!0,()=>{sn[t]=!1}):sn.x||sn.y?null:(sn.x=sn.y=!0,()=>{sn.x=sn.y=!1})}function ab(t,e){const n=gP(t),i=new AbortController,r={passive:!0,...e,signal:i.signal};return[n,r,()=>i.abort()]}function Um(t){return!(t.pointerType==="touch"||ob())}function xP(t,e,n={}){const[i,r,s]=ab(t,n),o=a=>{if(!Um(a))return;const{target:c}=a,l=e(c,a);if(typeof l!="function"||!c)return;const d=u=>{Um(u)&&(l(u),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,r)};return i.forEach(a=>{a.addEventListener("pointerenter",o,r)}),s}const cb=(t,e)=>e?t===e?!0:cb(t,e.parentElement):!1,uf=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,SP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function wP(t){return SP.has(t.tagName)||t.tabIndex!==-1}const aa=new WeakSet;function Bm(t){return e=>{e.key==="Enter"&&t(e)}}function il(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const CP=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=Bm(()=>{if(aa.has(n))return;il(n,"down");const r=Bm(()=>{il(n,"up")}),s=()=>il(n,"cancel");n.addEventListener("keyup",r,e),n.addEventListener("blur",s,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function $m(t){return uf(t)&&!ob()}function kP(t,e,n={}){const[i,r,s]=ab(t,n),o=a=>{const c=a.currentTarget;if(!$m(a))return;aa.add(c);const l=e(c,a),d=(p,g)=>{window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",f),aa.has(c)&&aa.delete(c),$m(p)&&typeof l=="function"&&l(p,{success:g})},u=p=>{d(p,c===window||c===document||n.useGlobalTarget||cb(c,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",u,r),window.addEventListener("pointercancel",f,r)};return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),sb(a)&&(a.addEventListener("focus",l=>CP(l,r)),!wP(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function lb(t){return Sy(t)&&"ownerSVGElement"in t}function TP(t){return lb(t)&&t.tagName==="svg"}const Tt=t=>!!(t&&t.getVelocity),EP=[...tb,ct,vi],PP=t=>EP.find(eb(t)),ff=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class RP extends v.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=n.offsetParent,r=sb(i)&&i.offsetWidth||0,s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft,s.right=r-s.width-s.left}return null}componentDidUpdate(){}render(){return this.props.children}}function AP({children:t,isPresent:e,anchorX:n,root:i}){const r=R.useId(),s=R.useRef(null),o=R.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=R.useContext(ff);return R.useInsertionEffect(()=>{const{width:c,height:l,top:d,left:u,right:f}=o.current;if(e||!s.current||!c||!l)return;const p=n==="left"?`left: ${u}`:`right: ${f}`;s.current.dataset.motionPopId=r;const g=document.createElement("style");a&&(g.nonce=a);const h=i??document.head;return h.appendChild(g),g.sheet&&g.sheet.insertRule(`
31
68
  [data-motion-pop-id="${r}"] {
32
69
  position: absolute !important;
33
- width: ${l}px !important;
34
- height: ${d}px !important;
35
- ${g}px !important;
36
- top: ${u}px !important;
70
+ width: ${c}px !important;
71
+ height: ${l}px !important;
72
+ ${p}px !important;
73
+ top: ${d}px !important;
37
74
  }
38
- `),()=>{p.contains(x)&&p.removeChild(x)}},[t]),c.jsx(Vm,{isPresent:t,childRef:i,sizeRef:o,children:f.cloneElement(e,{ref:i})})}const Dm=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:i,mode:o,anchorX:a,root:l})=>{const d=bo(Lm),u=E.useId();let h=!0,m=E.useMemo(()=>(h=!1,{id:u,initial:t,isPresent:n,custom:r,onExitComplete:g=>{d.set(g,!0);for(const x of d.values())if(!x)return;s&&s()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,s]);return i&&h&&(m={...m}),E.useMemo(()=>{d.forEach((g,x)=>d.set(x,!1))},[n]),f.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),o==="popLayout"&&(e=c.jsx(Im,{isPresent:n,anchorX:a,root:l,children:e})),c.jsx(Fs.Provider,{value:m,children:e})};function Lm(){return new Map}function Ec(e=!0){const t=E.useContext(Fs);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,i=E.useId();E.useEffect(()=>{if(e)return r(i)},[e]);const o=E.useCallback(()=>e&&s&&s(i),[i,s,e]);return!n&&s?[!1,o]:[!0]}const os=e=>e.key||"";function qi(e){const t=[];return E.Children.forEach(e,n=>{E.isValidElement(n)&&t.push(n)}),t}const dn=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",root:l})=>{const[d,u]=Ec(o),h=E.useMemo(()=>qi(e),[e]),m=o&&!d?[]:h.map(os),g=E.useRef(!0),x=E.useRef(h),p=bo(()=>new Map),[v,b]=E.useState(h),[y,w]=E.useState(h);Vl(()=>{g.current=!1,x.current=h;for(let T=0;T<y.length;T++){const A=os(y[T]);m.includes(A)?p.delete(A):p.get(A)!==!0&&p.set(A,!1)}},[y,m.length,m.join("-")]);const S=[];if(h!==v){let T=[...h];for(let A=0;A<y.length;A++){const j=y[A],V=os(j);m.includes(V)||(T.splice(A,0,j),S.push(j))}return i==="wait"&&S.length&&(T=S),w(qi(T)),b(h),null}process.env.NODE_ENV!=="production"&&i==="wait"&&y.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=E.useContext(vo);return c.jsx(c.Fragment,{children:y.map(T=>{const A=os(T),j=o&&!d?!1:h===y||m.includes(A),V=()=>{if(p.has(A))p.set(A,!0);else return;let I=!0;p.forEach($=>{$||(I=!1)}),I&&(k==null||k(),w(x.current),o&&(u==null||u()),s&&s())};return c.jsx(Dm,{isPresent:j,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:i,root:l,onExitComplete:j?void 0:V,anchorX:a,children:T},A)})})},kc=E.createContext({strict:!1}),Ji={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},pn={};for(const e in Ji)pn[e]={isEnabled:t=>Ji[e].some(n=>!!t[n])};function Fm(e){for(const t in e)pn[t]={...pn[t],...e[t]}}const Om=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function js(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Om.has(e)}let Ac=e=>!js(e);function _m(e){typeof e=="function"&&(Ac=t=>t.startsWith("on")?!js(t):e(t))}try{_m(require("@emotion/is-prop-valid").default)}catch{}function $m(e,t,n){const s={};for(const r in e)r==="values"&&typeof e.values=="object"||(Ac(r)||n===!0&&js(r)||!t&&!js(r)||e.draggable&&r.startsWith("onDrag"))&&(s[r]=e[r]);return s}const Os=E.createContext({});function _s(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Un(e){return typeof e=="string"||Array.isArray(e)}const zo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Zo=["initial",...zo];function $s(e){return _s(e.animate)||Zo.some(t=>Un(e[t]))}function Tc(e){return!!($s(e)||e.variants)}function Bm(e,t){if($s(e)){const{initial:n,animate:s}=e;return{initial:n===!1||Un(n)?n:void 0,animate:Un(s)?s:void 0}}return e.inherit!==!1?t:{}}function Hm(e){const{initial:t,animate:n}=Bm(e,E.useContext(Os));return E.useMemo(()=>({initial:t,animate:n}),[Qi(t),Qi(n)])}function Qi(e){return Array.isArray(e)?e.join(" "):e}const zn={};function Um(e){for(const t in e)zn[t]=e[t],Po(t)&&(zn[t].isCSSVariable=!0)}function jc(e,{layout:t,layoutId:n}){return wn.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!zn[e]||e==="opacity")}const zm={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Zm=bn.length;function Wm(e,t,n){let s="",r=!0;for(let i=0;i<Zm;i++){const o=bn[i],a=e[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||n){const d=yc(a,$o[o]);if(!l){r=!1;const u=zm[o]||o;s+=`${u}(${d}) `}n&&(t[o]=d)}}return s=s.trim(),n?s=n(t,r?"":s):r&&(s="none"),s}function Wo(e,t,n){const{style:s,vars:r,transformOrigin:i}=e;let o=!1,a=!1;for(const l in t){const d=t[l];if(wn.has(l)){o=!0;continue}else if(Po(l)){r[l]=d;continue}else{const u=yc(d,$o[l]);l.startsWith("origin")?(a=!0,i[l]=u):s[l]=u}}if(t.transform||(o||n?s.transform=Wm(t,e.transform,n):s.transform&&(s.transform="none")),a){const{originX:l="50%",originY:d="50%",originZ:u=0}=i;s.transformOrigin=`${l} ${d} ${u}`}}const Ko=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Pc(e,t,n){for(const s in t)!Le(t[s])&&!jc(s,n)&&(e[s]=t[s])}function Km({transformTemplate:e},t){return E.useMemo(()=>{const n=Ko();return Wo(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ym(e,t){const n=e.style||{},s={};return Pc(s,n,e),Object.assign(s,Km(e,t)),s}function Gm(e,t){const n={},s=Ym(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const Xm={offset:"stroke-dashoffset",array:"stroke-dasharray"},qm={offset:"strokeDashoffset",array:"strokeDasharray"};function Jm(e,t,n=1,s=0,r=!0){e.pathLength=1;const i=r?Xm:qm;e[i.offset]=oe.transform(-s);const o=oe.transform(t),a=oe.transform(n);e[i.array]=`${o} ${a}`}function Mc(e,{attrX:t,attrY:n,attrScale:s,pathLength:r,pathSpacing:i=1,pathOffset:o=0,...a},l,d,u){if(Wo(e,a,d),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:m}=e;h.transform&&(m.transform=h.transform,delete h.transform),(m.transform||h.transformOrigin)&&(m.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),m.transform&&(m.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete h.transformBox),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),s!==void 0&&(h.scale=s),r!==void 0&&Jm(h,r,i,o,!1)}const Nc=()=>({...Ko(),attrs:{}}),Rc=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Qm(e,t,n,s){const r=E.useMemo(()=>{const i=Nc();return Mc(i,t,Rc(s),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Pc(i,e.style,e),r.style={...i,...r.style}}return r}const ep=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Yo(e){return typeof e!="string"||e.includes("-")?!1:!!(ep.indexOf(e)>-1||/[A-Z]/u.test(e))}function tp(e,t,n,{latestValues:s},r,i=!1){const a=(Yo(e)?Qm:Gm)(t,s,r,e),l=$m(t,typeof e=="string",i),d=e!==E.Fragment?{...l,...a,ref:n}:{},{children:u}=t,h=E.useMemo(()=>Le(u)?u.get():u,[u]);return E.createElement(e,{...d,children:h})}function ea(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Go(e,t,n,s){if(typeof t=="function"){const[r,i]=ea(s);t=t(n!==void 0?n:e.custom,r,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,i]=ea(s);t=t(n!==void 0?n:e.custom,r,i)}return t}function ys(e){return Le(e)?e.get():e}function np({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:sp(n,s,r,e),renderState:t()}}function sp(e,t,n,s){const r={},i=s(e,{});for(const m in i)r[m]=ys(i[m]);let{initial:o,animate:a}=e;const l=$s(e),d=Tc(e);t&&d&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!_s(h)){const m=Array.isArray(h)?h:[h];for(let g=0;g<m.length;g++){const x=Go(e,m[g]);if(x){const{transitionEnd:p,transition:v,...b}=x;for(const y in b){let w=b[y];if(Array.isArray(w)){const S=u?w.length-1:0;w=w[S]}w!==null&&(r[y]=w)}for(const y in p)r[y]=p[y]}}}return r}const Vc=e=>(t,n)=>{const s=E.useContext(Os),r=E.useContext(Fs),i=()=>np(e,t,s,r);return n?i():bo(i)};function Xo(e,t,n){var i;const{style:s}=e,r={};for(const o in s)(Le(s[o])||t.style&&Le(t.style[o])||jc(o,e)||((i=n==null?void 0:n.getValue(o))==null?void 0:i.liveStyle)!==void 0)&&(r[o]=s[o]);return r}const rp=Vc({scrapeMotionValuesFromProps:Xo,createRenderState:Ko});function Ic(e,t,n){const s=Xo(e,t,n);for(const r in e)if(Le(e[r])||Le(t[r])){const i=bn.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[i]=e[r]}return s}const op=Vc({scrapeMotionValuesFromProps:Ic,createRenderState:Nc}),ip=Symbol.for("motionComponentSymbol");function on(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ap(e,t,n){return E.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):on(n)&&(n.current=s))},[t])}const qo=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lp="framerAppearId",Dc="data-"+qo(lp),Lc=E.createContext({});function cp(e,t,n,s,r){var p,v;const{visualElement:i}=E.useContext(Os),o=E.useContext(kc),a=E.useContext(Fs),l=E.useContext(Uo).reducedMotion,d=E.useRef(null);s=s||o.renderer,!d.current&&s&&(d.current=s(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=d.current,h=E.useContext(Lc);u&&!u.projection&&r&&(u.type==="html"||u.type==="svg")&&dp(d.current,n,r,h);const m=E.useRef(!1);E.useInsertionEffect(()=>{u&&m.current&&u.update(n,a)});const g=n[Dc],x=E.useRef(!!g&&!((p=window.MotionHandoffIsComplete)!=null&&p.call(window,g))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,g)));return Vl(()=>{u&&(m.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),x.current&&u.animationState&&u.animationState.animateChanges())}),E.useEffect(()=>{u&&(!x.current&&u.animationState&&u.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var b;(b=window.MotionHandoffMarkAsComplete)==null||b.call(window,g)}),x.current=!1),u.enteringChildren=void 0)}),u}function dp(e,t,n,s){const{layoutId:r,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Fc(e.parent)),e.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!o||a&&on(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:l,layoutRoot:d})}function Fc(e){if(e)return e.options.allowProjection!==!1?e.projection:Fc(e.parent)}function lr(e,{forwardMotionProps:t=!1}={},n,s){n&&Fm(n);const r=Yo(e)?op:rp;function i(a,l){let d;const u={...E.useContext(Uo),...a,layoutId:up(a)},{isStatic:h}=u,m=Hm(a),g=r(a,h);if(!h&&wo){fp(u,n);const x=hp(u);d=x.MeasureLayout,m.visualElement=cp(e,g,u,s,x.ProjectionNode)}return c.jsxs(Os.Provider,{value:m,children:[d&&m.visualElement?c.jsx(d,{visualElement:m.visualElement,...u}):null,tp(e,a,ap(g,m.visualElement,l),g,h,t)]})}i.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const o=E.forwardRef(i);return o[ip]=e,o}function up({layoutId:e}){const t=E.useContext(vo).id;return t&&e!==void 0?t+"-"+e:e}function fp(e,t){const n=E.useContext(kc).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?yn(!1,s,"lazy-strict-mode"):yt(!1,s,"lazy-strict-mode")}}function hp(e){const{drag:t,layout:n}=pn;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function mp(e,t){if(typeof Proxy>"u")return lr;const n=new Map,s=(i,o)=>lr(i,o,e,t),r=(i,o)=>(process.env.NODE_ENV!=="production"&&Ao(!1,"motion() is deprecated. Use motion.create() instead."),s(i,o));return new Proxy(r,{get:(i,o)=>o==="create"?s:(n.has(o)||n.set(o,lr(o,void 0,e,t)),n.get(o))})}function Oc({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function pp({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function gp(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function cr(e){return e===void 0||e===1}function Wr({scale:e,scaleX:t,scaleY:n}){return!cr(e)||!cr(t)||!cr(n)}function Ft(e){return Wr(e)||_c(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function _c(e){return ta(e.x)||ta(e.y)}function ta(e){return e&&e!=="0%"}function Ps(e,t,n){const s=e-n,r=t*s;return n+r}function na(e,t,n,s,r){return r!==void 0&&(e=Ps(e,r,s)),Ps(e,n,s)+t}function Kr(e,t=0,n=1,s,r){e.min=na(e.min,t,n,s,r),e.max=na(e.max,t,n,s,r)}function $c(e,{x:t,y:n}){Kr(e.x,t.translate,t.scale,t.originPoint),Kr(e.y,n.translate,n.scale,n.originPoint)}const sa=.999999999999,ra=1.0000000000001;function xp(e,t,n,s=!1){const r=n.length;if(!r)return;t.x=t.y=1;let i,o;for(let a=0;a<r;a++){i=n[a],o=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&ln(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,$c(e,o)),s&&Ft(i.latestValues)&&ln(e,i.latestValues))}t.x<ra&&t.x>sa&&(t.x=1),t.y<ra&&t.y>sa&&(t.y=1)}function an(e,t){e.min=e.min+t,e.max=e.max+t}function oa(e,t,n,s,r=.5){const i=be(e.min,e.max,r);Kr(e,t,n,i,s)}function ln(e,t){oa(e.x,t.x,t.scaleX,t.scale,t.originX),oa(e.y,t.y,t.scaleY,t.scale,t.originY)}function Bc(e,t){return Oc(gp(e.getBoundingClientRect(),t))}function yp(e,t,n){const s=Bc(e,n),{scroll:r}=t;return r&&(an(s.x,r.offset.x),an(s.y,r.offset.y)),s}const ia=()=>({translate:0,scale:1,origin:0,originPoint:0}),cn=()=>({x:ia(),y:ia()}),aa=()=>({min:0,max:0}),Ce=()=>({x:aa(),y:aa()}),Yr={current:null},Hc={current:!1};function vp(){if(Hc.current=!0,!!wo)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Yr.current=e.matches;e.addEventListener("change",t),t()}else Yr.current=!1}const bp=new WeakMap;function wp(e,t,n){for(const s in t){const r=t[s],i=n[s];if(Le(r))e.addValue(s,r);else if(Le(i))e.addValue(s,mn(r,{owner:e}));else if(i!==r)if(e.hasValue(s)){const o=e.getValue(s);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=e.getStaticValue(s);e.addValue(s,mn(o!==void 0?o:r,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const la=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Sp{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Oo,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=He.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,ye.render(this.render,!1,!0))};const{latestValues:l,renderState:d}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=$s(n),this.isVariantNode=Tc(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in h){const g=h[m];l[m]!==void 0&&Le(g)&&g.set(l[m])}}mount(t){var n;this.current=t,bp.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),Hc.current||vp(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Yr.current,process.env.NODE_ENV!=="production"&&Ao(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),kt(this.notifyUpdate),kt(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=wn.has(t);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&ye.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in pn){const n=pn[t];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[t]&&r&&s(this.props)&&(this.features[t]=new r(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ce()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<la.length;s++){const r=la[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,o=t[i];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=wp(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=mn(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(Il(s)||Ll(s))?s=parseFloat(s):!Rm(s)&&At.test(n)&&(s=xc(t,n)),this.setBaseTarget(t,Le(s)?s.get():s)),Le(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var i;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const o=Go(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(s=o[t])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Le(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new ko),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Bo.render(this.render)}}class Uc extends Sp{constructor(){super(...arguments),this.KeyframeResolver=bm}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Le(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function zc(e,{style:t,vars:n},s,r){const i=e.style;let o;for(o in t)i[o]=t[o];r==null||r.applyProjectionStyles(i,s);for(o in n)i.setProperty(o,n[o])}function Cp(e){return window.getComputedStyle(e)}class Ep extends Uc{constructor(){super(...arguments),this.type="html",this.renderInstance=zc}readValueFromInstance(t,n){var s;if(wn.has(n))return(s=this.projection)!=null&&s.isProjecting?_r(n):Oh(t,n);{const r=Cp(t),i=(Po(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Bc(t,n)}build(t,n,s){Wo(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Xo(t,n,s)}}const Zc=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function kp(e,t,n,s){zc(e,t,void 0,s);for(const r in t.attrs)e.setAttribute(Zc.has(r)?r:qo(r),t.attrs[r])}class Ap extends Uc{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ce}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(wn.has(n)){const s=gc(n);return s&&s.default||0}return n=Zc.has(n)?n:qo(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Ic(t,n,s)}build(t,n,s){Mc(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,r){kp(t,n,s,r)}mount(t){this.isSVGTag=Rc(t.tagName),super.mount(t)}}const Tp=(e,t)=>Yo(e)?new Ap(t):new Ep(t,{allowProjection:e!==E.Fragment});function un(e,t,n){const s=e.getProps();return Go(s,t,n!==void 0?n:s.custom,e)}const Gr=e=>Array.isArray(e);function jp(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,mn(n))}function Pp(e){return Gr(e)?e[e.length-1]||0:e}function Mp(e,t){const n=un(e,t);let{transitionEnd:s={},transition:r={},...i}=n||{};i={...i,...s};for(const o in i){const a=Pp(i[o]);jp(e,o,a)}}function Np(e){return!!(Le(e)&&e.add)}function Xr(e,t){const n=e.getValue("willChange");if(Np(n))return n.add(t);if(!n&&vt.WillChange){const s=new vt.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function Wc(e){return e.props[Dc]}const Rp=e=>e!==null;function Vp(e,{repeat:t,repeatType:n="loop"},s){const r=e.filter(Rp),i=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[i]}const Ip={type:"spring",stiffness:500,damping:25,restSpeed:10},Dp=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Lp={type:"keyframes",duration:.8},Fp={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Op=(e,{keyframes:t})=>t.length>2?Lp:wn.has(e)?e.startsWith("scale")?Dp(t[1]):Ip:Fp;function _p({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:d,...u}){return!!Object.keys(u).length}const Jo=(e,t,n,s={},r,i)=>o=>{const a=_o(s,e)||{},l=a.delay||s.delay||0;let{elapsed:d=0}=s;d=d-et(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-d,onUpdate:m=>{t.set(m),a.onUpdate&&a.onUpdate(m)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:r};_p(a)||Object.assign(u,Op(e,u)),u.duration&&(u.duration=et(u.duration)),u.repeatDelay&&(u.repeatDelay=et(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(zr(u),u.delay===0&&(h=!0)),(vt.instantAnimations||vt.skipAnimations)&&(h=!0,zr(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!i&&t.get()!==void 0){const m=Vp(u.keyframes,a);if(m!==void 0){ye.update(()=>{u.onUpdate(m),u.onComplete()});return}}return a.isSync?new Fo(u):new am(u)};function $p({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function Kc(e,t,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:i=e.getDefaultTransition(),transitionEnd:o,...a}=t;s&&(i=s);const l=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const u in a){const h=e.getValue(u,e.latestValues[u]??null),m=a[u];if(m===void 0||d&&$p(d,u))continue;const g={delay:n,..._o(i||{},u)},x=h.get();if(x!==void 0&&!h.isAnimating&&!Array.isArray(m)&&m===x&&!g.velocity)continue;let p=!1;if(window.MotionHandoffAnimation){const b=Wc(e);if(b){const y=window.MotionHandoffAnimation(b,u,ye);y!==null&&(g.startTime=y,p=!0)}}Xr(e,u),h.start(Jo(u,h,m,e.shouldReduceMotion&&hc.has(u)?{type:!1}:g,e,p));const v=h.animation;v&&l.push(v)}return o&&Promise.all(l).then(()=>{ye.update(()=>{o&&Mp(e,o)})}),l}function Yc(e,t,n,s=0,r=1){const i=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),o=e.size,a=(o-1)*s;return typeof n=="function"?n(i,o):r===1?i*s:a-i*s}function qr(e,t,n={}){var l;const s=un(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const i=s?()=>Promise.all(Kc(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:m}=r;return Bp(e,t,d,u,h,m,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[d,u]=a==="beforeChildren"?[i,o]:[o,i];return d().then(()=>u())}else return Promise.all([i(),o(n.delay)])}function Bp(e,t,n=0,s=0,r=0,i=1,o){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(qr(l,t,{...o,delay:n+(typeof s=="function"?0:s)+Yc(e.variantChildren,l,s,r,i)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function Hp(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const r=t.map(i=>qr(e,i,n));s=Promise.all(r)}else if(typeof t=="string")s=qr(e,t,n);else{const r=typeof t=="function"?un(e,t,n.custom):t;s=Promise.all(Kc(e,r,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function Gc(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const Up=Zo.length;function Xc(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Xc(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Up;n++){const s=Zo[n],r=e.props[s];(Un(r)||r===!1)&&(t[s]=r)}return t}const zp=[...zo].reverse(),Zp=zo.length;function Wp(e){return t=>Promise.all(t.map(({animation:n,options:s})=>Hp(e,n,s)))}function Kp(e){let t=Wp(e),n=ca(),s=!0;const r=l=>(d,u)=>{var m;const h=un(e,u,l==="exit"?(m=e.presenceContext)==null?void 0:m.custom:void 0);if(h){const{transition:g,transitionEnd:x,...p}=h;d={...d,...p,...x}}return d};function i(l){t=l(e)}function o(l){const{props:d}=e,u=Xc(e.parent)||{},h=[],m=new Set;let g={},x=1/0;for(let v=0;v<Zp;v++){const b=zp[v],y=n[b],w=d[b]!==void 0?d[b]:u[b],S=Un(w),k=b===l?y.isActive:null;k===!1&&(x=v);let T=w===u[b]&&w!==d[b]&&S;if(T&&s&&e.manuallyAnimateOnMount&&(T=!1),y.protectedKeys={...g},!y.isActive&&k===null||!w&&!y.prevProp||_s(w)||typeof w=="boolean")continue;const A=Yp(y.prevProp,w);let j=A||b===l&&y.isActive&&!T&&S||v>x&&S,V=!1;const I=Array.isArray(w)?w:[w];let $=I.reduce(r(b),{});k===!1&&($={});const{prevResolvedValues:F={}}=y,se={...F,...$},Z=O=>{j=!0,m.has(O)&&(V=!0,m.delete(O)),y.needsAnimating[O]=!0;const P=e.getValue(O);P&&(P.liveStyle=!1)};for(const O in se){const P=$[O],B=F[O];if(g.hasOwnProperty(O))continue;let X=!1;Gr(P)&&Gr(B)?X=!Gc(P,B):X=P!==B,X?P!=null?Z(O):m.add(O):P!==void 0&&m.has(O)?Z(O):y.protectedKeys[O]=!0}y.prevProp=w,y.prevResolvedValues=$,y.isActive&&(g={...g,...$}),s&&e.blockInitialAnimation&&(j=!1);const ee=T&&A;j&&(!ee||V)&&h.push(...I.map(O=>{const P={type:b};if(typeof O=="string"&&s&&!ee&&e.manuallyAnimateOnMount&&e.parent){const{parent:B}=e,X=un(B,O);if(B.enteringChildren&&X){const{delayChildren:_}=X.transition||{};P.delay=Yc(B.enteringChildren,e,_)}}return{animation:O,options:P}}))}if(m.size){const v={};if(typeof d.initial!="boolean"){const b=un(e,Array.isArray(d.initial)?d.initial[0]:d.initial);b&&b.transition&&(v.transition=b.transition)}m.forEach(b=>{const y=e.getBaseTarget(b),w=e.getValue(b);w&&(w.liveStyle=!0),v[b]=y??null}),h.push({animation:v})}let p=!!h.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(p=!1),s=!1,p?t(h):Promise.resolve()}function a(l,d){var h;if(n[l].isActive===d)return Promise.resolve();(h=e.variantChildren)==null||h.forEach(m=>{var g;return(g=m.animationState)==null?void 0:g.setActive(l,d)}),n[l].isActive=d;const u=o(l);for(const m in n)n[m].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=ca(),s=!0}}}function Yp(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Gc(t,e):!1}function Dt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ca(){return{animate:Dt(!0),whileInView:Dt(),whileHover:Dt(),whileTap:Dt(),whileDrag:Dt(),whileFocus:Dt(),exit:Dt()}}class Pt{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Gp extends Pt{constructor(t){super(t),t.animationState||(t.animationState=Kp(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();_s(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Xp=0;class qp extends Pt{constructor(){super(...arguments),this.id=Xp++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Jp={animation:{Feature:Gp},exit:{Feature:qp}};function Zn(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function Jn(e){return{point:{x:e.pageX,y:e.pageY}}}const Qp=e=>t=>Ho(t)&&e(t,Jn(t));function Fn(e,t,n,s){return Zn(e,t,Qp(n),s)}const qc=1e-4,e0=1-qc,t0=1+qc,Jc=.01,n0=0-Jc,s0=0+Jc;function _e(e){return e.max-e.min}function r0(e,t,n){return Math.abs(e-t)<=n}function da(e,t,n,s=.5){e.origin=s,e.originPoint=be(t.min,t.max,e.origin),e.scale=_e(n)/_e(t),e.translate=be(n.min,n.max,e.origin)-e.originPoint,(e.scale>=e0&&e.scale<=t0||isNaN(e.scale))&&(e.scale=1),(e.translate>=n0&&e.translate<=s0||isNaN(e.translate))&&(e.translate=0)}function On(e,t,n,s){da(e.x,t.x,n.x,s?s.originX:void 0),da(e.y,t.y,n.y,s?s.originY:void 0)}function ua(e,t,n){e.min=n.min+t.min,e.max=e.min+_e(t)}function o0(e,t,n){ua(e.x,t.x,n.x),ua(e.y,t.y,n.y)}function fa(e,t,n){e.min=t.min-n.min,e.max=e.min+_e(t)}function _n(e,t,n){fa(e.x,t.x,n.x),fa(e.y,t.y,n.y)}function Ye(e){return[e("x"),e("y")]}const Qc=({current:e})=>e?e.ownerDocument.defaultView:null,ha=(e,t)=>Math.abs(e-t);function i0(e,t){const n=ha(e.x,t.x),s=ha(e.y,t.y);return Math.sqrt(n**2+s**2)}class ed{constructor(t,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=ur(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=i0(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:p}=m,{timestamp:v}=Ne;this.history.push({...p,timestamp:v});const{onStart:b,onMove:y}=this.handlers;g||(b&&b(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,m)},this.handlePointerMove=(m,g)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=dr(g,this.transformPagePoint),ye.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:x,onSessionEnd:p,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=ur(m.type==="pointercancel"?this.lastMoveEventInfo:dr(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(m,b),p&&p(m,b)},!Ho(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=r||window;const a=Jn(t),l=dr(a,this.transformPagePoint),{point:d}=l,{timestamp:u}=Ne;this.history=[{...d,timestamp:u}];const{onSessionStart:h}=n;h&&h(t,ur(l,this.history)),this.removeListeners=Gn(Fn(this.contextWindow,"pointermove",this.handlePointerMove),Fn(this.contextWindow,"pointerup",this.handlePointerUp),Fn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),kt(this.updatePoint)}}function dr(e,t){return t?{point:t(e.point)}:e}function ma(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ur({point:e},t){return{point:e,delta:ma(e,td(t)),offset:ma(e,a0(t)),velocity:l0(t,.1)}}function a0(e){return e[0]}function td(e){return e[e.length-1]}function l0(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const r=td(e);for(;n>=0&&(s=e[n],!(r.timestamp-s.timestamp>et(t)));)n--;if(!s)return{x:0,y:0};const i=lt(r.timestamp-s.timestamp);if(i===0)return{x:0,y:0};const o={x:(r.x-s.x)/i,y:(r.y-s.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function c0(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?be(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?be(n,e,s.max):Math.min(e,n)),e}function pa(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function d0(e,{top:t,left:n,bottom:s,right:r}){return{x:pa(e.x,n,r),y:pa(e.y,t,s)}}function ga(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function u0(e,t){return{x:ga(e.x,t.x),y:ga(e.y,t.y)}}function f0(e,t){let n=.5;const s=_e(e),r=_e(t);return r>s?n=$n(t.min,t.max-s,e.min):s>r&&(n=$n(e.min,e.max-r,t.min)),xt(0,1,n)}function h0(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Jr=.35;function m0(e=Jr){return e===!1?e=0:e===!0&&(e=Jr),{x:xa(e,"left","right"),y:xa(e,"top","bottom")}}function xa(e,t,n){return{min:ya(e,t),max:ya(e,n)}}function ya(e,t){return typeof e=="number"?e:e[t]||0}const p0=new WeakMap;class g0{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ce(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Jn(h).point)},o=(h,m)=>{const{drag:g,dragPropagation:x,onDragStart:p}=this.getProps();if(g&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Em(g),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ye(b=>{let y=this.getAxisMotionValue(b).get()||0;if(ct.test(y)){const{projection:w}=this.visualElement;if(w&&w.layout){const S=w.layout.layoutBox[b];S&&(y=_e(S)*(parseFloat(y)/100))}}this.originPoint[b]=y}),p&&ye.postRender(()=>p(h,m)),Xr(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},a=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m;const{dragPropagation:g,dragDirectionLock:x,onDirectionLock:p,onDrag:v}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:b}=m;if(x&&this.currentDirection===null){this.currentDirection=x0(b),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),v&&v(h,m)},l=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m,this.stop(h,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>Ye(h=>{var m;return this.getAnimationState(h)==="paused"&&((m=this.getAxisMotionValue(h).animation)==null?void 0:m.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new ed(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:Qc(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,r=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!s)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&ye.postRender(()=>a(s,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:r}=this.getProps();if(!s||!is(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=c0(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,r=this.constraints;t&&on(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=d0(s.layoutBox,t):this.constraints=!1,this.elastic=m0(n),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ye(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=h0(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!on(t))return!1;const s=t.current;yt(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=yp(s,r.root,this.visualElement.getTransformPagePoint());let o=u0(r.layout.layoutBox,i);if(n){const a=n(pp(o));this.hasMutatedConstraints=!!a,a&&(o=Oc(a))}return o}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},d=Ye(u=>{if(!is(u,n,this.currentDirection))return;let h=l&&l[u]||{};o&&(h={min:0,max:0});const m=r?200:1e6,g=r?40:1e7,x={type:"inertia",velocity:s?t[u]:0,bounceStiffness:m,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(u,x)});return Promise.all(d).then(a)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return Xr(this.visualElement,t),s.start(Jo(t,s,0,n,this.visualElement,!1))}stopAnimation(){Ye(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ye(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),r=s[n];return r||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Ye(n=>{const{drag:s}=this.getProps();if(!is(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[n];i.set(t[n]-be(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!on(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Ye(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=f0({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Ye(o=>{if(!is(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:d}=this.constraints[o];a.set(be(l,d,r[o]))})}addListeners(){if(!this.visualElement.current)return;p0.set(this.visualElement,this);const t=this.visualElement.current,n=Fn(t,"pointerdown",l=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(l)}),s=()=>{const{dragConstraints:l}=this.getProps();on(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),ye.read(s);const o=Zn(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:d})=>{this.isDragging&&d&&(Ye(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=l[u].translate,h.set(h.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=Jr,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function is(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function x0(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class y0 extends Pt{constructor(t){super(t),this.removeGroupControls=Xe,this.removeListeners=Xe,this.controls=new g0(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xe}unmount(){this.removeGroupControls(),this.removeListeners()}}const va=e=>(t,n)=>{e&&ye.postRender(()=>e(t,n))};class v0 extends Pt{constructor(){super(...arguments),this.removePointerDownListener=Xe}onPointerDown(t){this.session=new ed(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qc(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:va(t),onStart:va(n),onMove:s,onEnd:(i,o)=>{delete this.session,r&&ye.postRender(()=>r(i,o))}}}mount(){this.removePointerDownListener=Fn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const vs={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ba(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Rn={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(oe.test(e))e=parseFloat(e);else return e;const n=ba(e,t.target.x),s=ba(e,t.target.y);return`${n}% ${s}%`}},b0={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,r=At.parse(e);if(r.length>5)return s;const i=At.createTransformer(e),o=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;r[0+o]/=a,r[1+o]/=l;const d=be(a,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=d),typeof r[3+o]=="number"&&(r[3+o]/=d),i(r)}};let fr=!1;class w0 extends E.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:i}=t;Um(S0),i&&(n.group&&n.group.add(i),s&&s.register&&r&&s.register(i),fr&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),vs.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:r,isPresent:i}=this.props,{projection:o}=s;return o&&(o.isPresent=i,fr=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||ye.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Bo.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=t;fr=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function nd(e){const[t,n]=Ec(),s=E.useContext(vo);return c.jsx(w0,{...e,layoutGroup:s,switchLayoutGroup:E.useContext(Lc),isPresent:t,safeToRemove:n})}const S0={borderRadius:{...Rn,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Rn,borderTopRightRadius:Rn,borderBottomLeftRadius:Rn,borderBottomRightRadius:Rn,boxShadow:b0};function C0(e,t,n){const s=Le(e)?e:mn(e);return s.start(Jo("",s,t,n)),s.animation}const E0=(e,t)=>e.depth-t.depth;class k0{constructor(){this.children=[],this.isDirty=!1}add(t){So(this.children,t),this.isDirty=!0}remove(t){Co(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(E0),this.isDirty=!1,this.children.forEach(t)}}function A0(e,t){const n=He.now(),s=({timestamp:r})=>{const i=r-n;i>=t&&(kt(s),e(i-t))};return ye.setup(s,!0),()=>kt(s)}const sd=["TopLeft","TopRight","BottomLeft","BottomRight"],T0=sd.length,wa=e=>typeof e=="string"?parseFloat(e):e,Sa=e=>typeof e=="number"||oe.test(e);function j0(e,t,n,s,r,i){r?(e.opacity=be(0,n.opacity??1,P0(s)),e.opacityExit=be(t.opacity??1,0,M0(s))):i&&(e.opacity=be(t.opacity??1,n.opacity??1,s));for(let o=0;o<T0;o++){const a=`border${sd[o]}Radius`;let l=Ca(t,a),d=Ca(n,a);if(l===void 0&&d===void 0)continue;l||(l=0),d||(d=0),l===0||d===0||Sa(l)===Sa(d)?(e[a]=Math.max(be(wa(l),wa(d),s),0),(ct.test(d)||ct.test(l))&&(e[a]+="%")):e[a]=d}(t.rotate||n.rotate)&&(e.rotate=be(t.rotate||0,n.rotate||0,s))}function Ca(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const P0=rd(0,.5,zl),M0=rd(.5,.95,Xe);function rd(e,t,n){return s=>s<e?0:s>t?1:n($n(e,t,s))}function Ea(e,t){e.min=t.min,e.max=t.max}function Ke(e,t){Ea(e.x,t.x),Ea(e.y,t.y)}function ka(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Aa(e,t,n,s,r){return e-=t,e=Ps(e,1/n,s),r!==void 0&&(e=Ps(e,1/r,s)),e}function N0(e,t=0,n=1,s=.5,r,i=e,o=e){if(ct.test(t)&&(t=parseFloat(t),t=be(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=be(i.min,i.max,s);e===i&&(a-=t),e.min=Aa(e.min,t,n,a,r),e.max=Aa(e.max,t,n,a,r)}function Ta(e,t,[n,s,r],i,o){N0(e,t[n],t[s],t[r],t.scale,i,o)}const R0=["x","scaleX","originX"],V0=["y","scaleY","originY"];function ja(e,t,n,s){Ta(e.x,t,R0,n?n.x:void 0,s?s.x:void 0),Ta(e.y,t,V0,n?n.y:void 0,s?s.y:void 0)}function Pa(e){return e.translate===0&&e.scale===1}function od(e){return Pa(e.x)&&Pa(e.y)}function Ma(e,t){return e.min===t.min&&e.max===t.max}function I0(e,t){return Ma(e.x,t.x)&&Ma(e.y,t.y)}function Na(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function id(e,t){return Na(e.x,t.x)&&Na(e.y,t.y)}function Ra(e){return _e(e.x)/_e(e.y)}function Va(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class D0{constructor(){this.members=[]}add(t){So(this.members,t),t.scheduleRender()}remove(t){if(Co(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let s;for(let r=n;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1){s=i;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function L0(e,t,n){let s="";const r=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((r||i||o)&&(s=`translate3d(${r}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:h,rotateY:m,skewX:g,skewY:x}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),h&&(s+=`rotateX(${h}deg) `),m&&(s+=`rotateY(${m}deg) `),g&&(s+=`skewX(${g}deg) `),x&&(s+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(s+=`scale(${a}, ${l})`),s||"none"}const hr=["","X","Y","Z"],F0=1e3;let O0=0;function mr(e,t,n,s){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),s&&(s[e]=0))}function ad(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Wc(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ye,!(r||i))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&ad(s)}function ld({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(o={},a=t==null?void 0:t()){this.id=O0++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(B0),this.nodes.forEach(Z0),this.nodes.forEach(W0),this.nodes.forEach(H0)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new k0)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new ko),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Cc(o)&&!Mm(o),this.instance=o;const{layoutId:a,layout:l,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,h=0;const m=()=>this.root.updateBlockedByResize=!1;ye.read(()=>{h=window.innerWidth}),e(o,()=>{const g=window.innerWidth;g!==h&&(h=g,this.root.updateBlockedByResize=!0,u&&u(),u=A0(m,250),vs.hasAnimatedSinceResize&&(vs.hasAnimatedSinceResize=!1,this.nodes.forEach(La)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&d&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||q0,{onLayoutAnimationStart:p,onLayoutAnimationComplete:v}=d.getProps(),b=!this.targetLayout||!id(this.targetLayout,g),y=!h&&m;if(this.options.layoutRoot||this.resumeFrom||y||h&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={..._o(x,"layout"),onPlay:p,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,y)}else h||La(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),kt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(K0),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ad(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ia);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Da);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(z0),this.nodes.forEach(_0),this.nodes.forEach($0)):this.nodes.forEach(Da),this.clearAllSnapshots();const a=He.now();Ne.delta=xt(0,1e3/60,a-Ne.timestamp),Ne.timestamp=a,Ne.isProcessing=!0,nr.update.process(Ne),nr.preRender.process(Ne),nr.render.process(Ne),Ne.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Bo.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(U0),this.sharedNodes.forEach(Y0)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ye.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ye.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!_e(this.snapshot.measuredBox.x)&&!_e(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ce(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!od(this.projectionDelta),l=this.getTransformTemplate(),d=l?l(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;o&&this.instance&&(a||Ft(this.latestValues)||u)&&(r(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),J0(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:o}=this.options;if(!o)return Ce();const a=o.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(Q0))){const{scroll:u}=this.root;u&&(an(a.x,u.offset.x),an(a.y,u.offset.y))}return a}removeElementScroll(o){var l;const a=Ce();if(Ke(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:h,options:m}=u;u!==this.root&&h&&m.layoutScroll&&(h.wasRoot&&Ke(a,o),an(a.x,h.offset.x),an(a.y,h.offset.y))}return a}applyTransform(o,a=!1){const l=Ce();Ke(l,o);for(let d=0;d<this.path.length;d++){const u=this.path[d];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&ln(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Ft(u.latestValues)&&ln(l,u.latestValues)}return Ft(this.latestValues)&&ln(l,this.latestValues),l}removeTransform(o){const a=Ce();Ke(a,o);for(let l=0;l<this.path.length;l++){const d=this.path[l];if(!d.instance||!Ft(d.latestValues))continue;Wr(d.latestValues)&&d.updateSnapshot();const u=Ce(),h=d.measurePageBox();Ke(u,h),ja(a,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return Ft(this.latestValues)&&ja(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ne.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var m;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!(!this.layout||!(u||h))){if(this.resolvedRelativeTargetAt=Ne.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ce(),this.relativeTargetOrigin=Ce(),_n(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ce(),this.targetWithTransforms=Ce()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),o0(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ke(this.target,this.layout.layoutBox),$c(this.target,this.targetDelta)):Ke(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ce(),this.relativeTargetOrigin=Ce(),_n(this.relativeTargetOrigin,this.target,g.target),Ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Wr(this.parent.latestValues)||_c(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var x;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ne.timestamp&&(l=!1),l)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;Ke(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,m=this.treeScale.y;xp(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Ce());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ka(this.prevProjectionDelta.x,this.projectionDelta.x),ka(this.prevProjectionDelta.y,this.projectionDelta.y)),On(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==m||!Va(this.projectionDelta.x,this.prevProjectionDelta.x)||!Va(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cn(),this.projectionDelta=cn(),this.projectionDeltaWithTransform=cn()}setAnimationOrigin(o,a=!1){const l=this.snapshot,d=l?l.latestValues:{},u={...this.latestValues},h=cn();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const m=Ce(),g=l?l.source:void 0,x=this.layout?this.layout.source:void 0,p=g!==x,v=this.getStack(),b=!v||v.members.length<=1,y=!!(p&&!b&&this.options.crossfade===!0&&!this.path.some(X0));this.animationProgress=0;let w;this.mixTargetDelta=S=>{const k=S/1e3;Fa(h.x,o.x,k),Fa(h.y,o.y,k),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_n(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),G0(this.relativeTarget,this.relativeTargetOrigin,m,k),w&&I0(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Ce()),Ke(w,this.relativeTarget)),p&&(this.animationValues=u,j0(u,d,this.latestValues,k,y,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,d;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(d=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||d.stop(),this.pendingAnimation&&(kt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ye.update(()=>{vs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mn(0)),this.currentAnimation=C0(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),o.onUpdate&&o.onUpdate(u)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(F0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:d,latestValues:u}=o;if(!(!a||!l||!d)){if(this!==o&&this.layout&&d&&cd(this.options.animationType,this.layout.layoutBox,d.layoutBox)){l=this.target||Ce();const h=_e(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const m=_e(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+m}Ke(a,l),ln(a,u),On(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new D0),this.sharedNodes.get(o).add(a);const d=a.options.initialPromotionConfig;a.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const d=this.getStack();d&&d.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const d={};l.z&&mr("z",o,d,this.animationValues);for(let u=0;u<hr.length;u++)mr(`rotate${hr[u]}`,o,d,this.animationValues),mr(`skew${hr[u]}`,o,d,this.animationValues);o.render();for(const u in d)o.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=ys(a==null?void 0:a.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=ys(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Ft(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=L0(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),o.transform=h;const{x:m,y:g}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${g.origin*100}% 0`,d.animationValues?o.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const x in zn){if(u[x]===void 0)continue;const{correct:p,applyTo:v,isCSSVariable:b}=zn[x],y=h==="none"?u[x]:p(u[x],d);if(v){const w=v.length;for(let S=0;S<w;S++)o[v[S]]=y}else b?this.options.visualElement.renderState.vars[x]=y:o[x]=y}this.options.layoutId&&(o.pointerEvents=d===this?ys(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(Ia),this.root.sharedNodes.clear()}}}function _0(e){e.updateLayout()}function $0(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;i==="size"?Ye(h=>{const m=o?t.measuredBox[h]:t.layoutBox[h],g=_e(m);m.min=s[h].min,m.max=m.min+g}):cd(i,t.layoutBox,s)&&Ye(h=>{const m=o?t.measuredBox[h]:t.layoutBox[h],g=_e(s[h]);m.max=m.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+g)});const a=cn();On(a,s,t.layoutBox);const l=cn();o?On(l,e.applyTransform(r,!0),t.measuredBox):On(l,s,t.layoutBox);const d=!od(a);let u=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:m,layout:g}=h;if(m&&g){const x=Ce();_n(x,t.layoutBox,m.layoutBox);const p=Ce();_n(p,s,g.layoutBox),id(x,p)||(u=!0),h.options.layoutRoot&&(e.relativeTarget=p,e.relativeTargetOrigin=x,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function B0(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function H0(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function U0(e){e.clearSnapshot()}function Ia(e){e.clearMeasurements()}function Da(e){e.isLayoutDirty=!1}function z0(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function La(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Z0(e){e.resolveTargetDelta()}function W0(e){e.calcProjection()}function K0(e){e.resetSkewAndRotation()}function Y0(e){e.removeLeadSnapshot()}function Fa(e,t,n){e.translate=be(t.translate,0,n),e.scale=be(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Oa(e,t,n,s){e.min=be(t.min,n.min,s),e.max=be(t.max,n.max,s)}function G0(e,t,n,s){Oa(e.x,t.x,n.x,s),Oa(e.y,t.y,n.y,s)}function X0(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const q0={duration:.45,ease:[.4,0,.1,1]},_a=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$a=_a("applewebkit/")&&!_a("chrome/")?Math.round:Xe;function Ba(e){e.min=$a(e.min),e.max=$a(e.max)}function J0(e){Ba(e.x),Ba(e.y)}function cd(e,t,n){return e==="position"||e==="preserve-aspect"&&!r0(Ra(t),Ra(n),.2)}function Q0(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const eg=ld({attachResizeListener:(e,t)=>Zn(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),pr={current:void 0},dd=ld({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!pr.current){const e=new eg({});e.mount(window),e.setOptions({layoutScroll:!0}),pr.current=e}return pr.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),tg={pan:{Feature:v0},drag:{Feature:y0,ProjectionNode:dd,MeasureLayout:nd}};function Ha(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=s[r];i&&ye.postRender(()=>i(t,Jn(t)))}class ng extends Pt{mount(){const{current:t}=this.node;t&&(this.unmount=km(t,(n,s)=>(Ha(this.node,s,"Start"),r=>Ha(this.node,r,"End"))))}unmount(){}}class sg extends Pt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Gn(Zn(this.node.current,"focus",()=>this.onFocus()),Zn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ua(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=s[r];i&&ye.postRender(()=>i(t,Jn(t)))}class rg extends Pt{mount(){const{current:t}=this.node;t&&(this.unmount=Pm(t,(n,s)=>(Ua(this.node,s,"Start"),(r,{success:i})=>Ua(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Qr=new WeakMap,gr=new WeakMap,og=e=>{const t=Qr.get(e.target);t&&t(e)},ig=e=>{e.forEach(og)};function ag({root:e,...t}){const n=e||document;gr.has(n)||gr.set(n,{});const s=gr.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(ig,{root:e,...t})),s[r]}function lg(e,t,n){const s=ag(t);return Qr.set(e,n),s.observe(e),()=>{Qr.delete(e),s.unobserve(e)}}const cg={some:0,all:1};class dg extends Pt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:cg[r]},a=l=>{const{isIntersecting:d}=l;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),m=d?u:h;m&&m(l)};return lg(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(ug(t,n))&&this.startObserver()}unmount(){}}function ug({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const fg={inView:{Feature:dg},tap:{Feature:rg},focus:{Feature:sg},hover:{Feature:ng}},hg={layout:{ProjectionNode:dd,MeasureLayout:nd}},mg={...Jp,...fg,...tg,...hg},ce=mp(mg,Tp);function pg(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);let eo=1;class gg{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:s,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:eo++,o=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:s}),{...l,...t,id:i,dismissible:a,title:s}):l):this.addToast({title:s,...r,dismissible:a,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(t instanceof Function?t():t);let i=s!==void 0,o;const a=r.then(async d=>{if(o=["resolve",d],E.isValidElement(d))i=!1,this.create({id:s,type:"default",message:d});else if(yg(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,m=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,x=typeof h=="object"&&!E.isValidElement(h)?h:{message:h};this.create({id:s,type:"error",description:m,...x})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,m=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!E.isValidElement(h)?h:{message:h};this.create({id:s,type:"error",description:m,...x})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,m=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!E.isValidElement(h)?h:{message:h};this.create({id:s,type:"success",description:m,...x})}}).catch(async d=>{if(o=["reject",d],n.error!==void 0){i=!1;const u=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,g=typeof u=="object"&&!E.isValidElement(u)?u:{message:u};this.create({id:s,type:"error",description:h,...g})}}).finally(()=>{i&&(this.dismiss(s),s=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((d,u)=>a.then(()=>o[0]==="reject"?u(o[1]):d(o[1])).catch(u));return typeof s!="string"&&typeof s!="number"?{unwrap:l}:Object.assign(s,{unwrap:l})},this.custom=(t,n)=>{const s=(n==null?void 0:n.id)||eo++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ge=new gg,xg=(e,t)=>{const n=(t==null?void 0:t.id)||eo++;return Ge.addToast({title:e,...t,id:n}),n},yg=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",vg=xg,bg=()=>Ge.toasts,wg=()=>Ge.getActiveToasts(),ud=Object.assign(vg,{success:Ge.success,info:Ge.info,warning:Ge.warning,error:Ge.error,custom:Ge.custom,message:Ge.message,promise:Ge.promise,dismiss:Ge.dismiss,loading:Ge.loading},{getHistory:bg,getToasts:wg});pg("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const st=f.forwardRef((e,t)=>{const{alt:n,color:s="currentColor",size:r="1em",weight:i="regular",mirrored:o=!1,children:a,weights:l,...d}=e;return f.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 256 256",transform:o?"scale(-1, 1)":void 0,...d},!!n&&f.createElement("title",null,n),a,l.get(i))});st.displayName="SSRBase";const Sg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),f.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Qo=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Sg}));Qo.displayName="CaretDownIcon";const Cg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),f.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),fd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Cg}));fd.displayName="CaretUpIcon";const Eg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),f.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),hd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Eg}));hd.displayName="ChatTextIcon";const kg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),f.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),md=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:kg}));md.displayName="CheckIcon";const Ag=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),f.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),pd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Ag}));pd.displayName="MicrophoneIcon";const Tg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),f.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),gd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Tg}));gd.displayName="MicrophoneSlashIcon";const jg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),f.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),xd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:jg}));xd.displayName="MonitorArrowUpIcon";const Pg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),f.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),ei=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Pg}));ei.displayName="SpinnerIcon";const Mg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),yd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Mg}));yd.displayName="VideoCameraIcon";const Ng=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),vd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Ng}));vd.displayName="VideoCameraSlashIcon";const Rg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),f.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),Vg=E.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),bd=f.forwardRef((e,t)=>{const{alt:n,color:s,size:r,weight:i,mirrored:o,children:a,weights:l,...d}=e,{color:u="currentColor",size:h,weight:m="regular",mirrored:g=!1,...x}=f.useContext(Vg);return f.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:r??h,height:r??h,fill:s??u,viewBox:"0 0 256 256",transform:o||g?"scale(-1, 1)":void 0,...x,...d},!!n&&f.createElement("title",null,n),a,l.get(i??m))});bd.displayName="IconBase";const wd=f.forwardRef((e,t)=>f.createElement(bd,{ref:t,...e,weights:Rg}));wd.displayName="WarningIcon";const ti="-",Ig=e=>{const t=Lg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const a=o.split(ti);return a[0]===""&&a.length!==1&&a.shift(),Sd(a,t)||Dg(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&s[o]?[...l,...s[o]]:l}}},Sd=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),r=s?Sd(e.slice(1),s):void 0;if(r)return r;if(t.validators.length===0)return;const i=e.join(ti);return(o=t.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},za=/^\[(.+)\]$/,Dg=e=>{if(za.test(e)){const t=za.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Lg=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const r in n)to(n[r],s,r,t);return s},to=(e,t,n,s)=>{e.forEach(r=>{if(typeof r=="string"){const i=r===""?t:Za(t,r);i.classGroupId=n;return}if(typeof r=="function"){if(Fg(r)){to(r(s),t,n,s);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,o])=>{to(o,Za(t,i),n,s)})})},Za=(e,t)=>{let n=e;return t.split(ti).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Fg=e=>e.isThemeGetter,Og=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const r=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return r(i,o),o},set(i,o){n.has(i)?n.set(i,o):r(i,o)}}},no="!",so=":",_g=so.length,$g=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,a=0,l=0,d;for(let x=0;x<r.length;x++){let p=r[x];if(o===0&&a===0){if(p===so){i.push(r.slice(l,x)),l=x+_g;continue}if(p==="/"){d=x;continue}}p==="["?o++:p==="]"?o--:p==="("?a++:p===")"&&a--}const u=i.length===0?r:r.substring(l),h=Bg(u),m=h!==u,g=d&&d>l?d-l:void 0;return{modifiers:i,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:g}};if(t){const r=t+so,i=s;s=o=>o.startsWith(r)?i(o.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},Bg=e=>e.endsWith(no)?e.substring(0,e.length-1):e.startsWith(no)?e.substring(1):e,Hg=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const r=[];let i=[];return s.forEach(o=>{o[0]==="["||t[o]?(r.push(...i.sort(),o),i=[]):i.push(o)}),r.push(...i.sort()),r}},Ug=e=>({cache:Og(e.cacheSize),parseClassName:$g(e),sortModifiers:Hg(e),...Ig(e)}),zg=/\s+/,Zg=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i}=t,o=[],a=e.trim().split(zg);let l="";for(let d=a.length-1;d>=0;d-=1){const u=a[d],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:p}=n(u);if(h){l=u+(l.length>0?" "+l:l);continue}let v=!!p,b=s(v?x.substring(0,p):x);if(!b){if(!v){l=u+(l.length>0?" "+l:l);continue}if(b=s(x),!b){l=u+(l.length>0?" "+l:l);continue}v=!1}const y=i(m).join(":"),w=g?y+no:y,S=w+b;if(o.includes(S))continue;o.push(S);const k=r(b,v);for(let T=0;T<k.length;++T){const A=k[T];o.push(w+A)}l=u+(l.length>0?" "+l:l)}return l};function Wg(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Cd(t))&&(s&&(s+=" "),s+=n);return s}const Cd=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Cd(e[s]))&&(n&&(n+=" "),n+=t);return n};function Kg(e,...t){let n,s,r,i=o;function o(l){const d=t.reduce((u,h)=>h(u),e());return n=Ug(d),s=n.cache.get,r=n.cache.set,i=a,a(l)}function a(l){const d=s(l);if(d)return d;const u=Zg(l,n);return r(l,u),u}return function(){return i(Wg.apply(null,arguments))}}const Me=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ed=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Yg=/^\d+\/\d+$/,Gg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qt=e=>Yg.test(e),le=e=>!!e&&!Number.isNaN(Number(e)),St=e=>!!e&&Number.isInteger(Number(e)),xr=e=>e.endsWith("%")&&le(e.slice(0,-1)),mt=e=>Gg.test(e),e1=()=>!0,t1=e=>Xg.test(e)&&!qg.test(e),Ad=()=>!1,n1=e=>Jg.test(e),s1=e=>Qg.test(e),r1=e=>!K(e)&&!Y(e),o1=e=>Sn(e,Pd,Ad),K=e=>Ed.test(e),Lt=e=>Sn(e,Md,t1),yr=e=>Sn(e,d1,le),Wa=e=>Sn(e,Td,Ad),i1=e=>Sn(e,jd,s1),as=e=>Sn(e,Nd,n1),Y=e=>kd.test(e),Vn=e=>Cn(e,Md),a1=e=>Cn(e,u1),Ka=e=>Cn(e,Td),l1=e=>Cn(e,Pd),c1=e=>Cn(e,jd),ls=e=>Cn(e,Nd,!0),Sn=(e,t,n)=>{const s=Ed.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Cn=(e,t,n=!1)=>{const s=kd.exec(e);return s?s[1]?t(s[1]):n:!1},Td=e=>e==="position"||e==="percentage",jd=e=>e==="image"||e==="url",Pd=e=>e==="length"||e==="size"||e==="bg-size",Md=e=>e==="length",d1=e=>e==="number",u1=e=>e==="family-name",Nd=e=>e==="shadow",f1=()=>{const e=Me("color"),t=Me("font"),n=Me("text"),s=Me("font-weight"),r=Me("tracking"),i=Me("leading"),o=Me("breakpoint"),a=Me("container"),l=Me("spacing"),d=Me("radius"),u=Me("shadow"),h=Me("inset-shadow"),m=Me("text-shadow"),g=Me("drop-shadow"),x=Me("blur"),p=Me("perspective"),v=Me("aspect"),b=Me("ease"),y=Me("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...S(),Y,K],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],j=()=>[Y,K,l],V=()=>[qt,"full","auto",...j()],I=()=>[St,"none","subgrid",Y,K],$=()=>["auto",{span:["full",St,Y,K]},St,Y,K],F=()=>[St,"auto",Y,K],se=()=>["auto","min","max","fr",Y,K],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...j()],O=()=>[qt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],P=()=>[e,Y,K],B=()=>[...S(),Ka,Wa,{position:[Y,K]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",l1,o1,{size:[Y,K]}],re=()=>[xr,Vn,Lt],M=()=>["","none","full",d,Y,K],H=()=>["",le,Vn,Lt],q=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>[le,xr,Ka,Wa],L=()=>["","none",x,Y,K],W=()=>["none",le,Y,K],D=()=>["none",le,Y,K],ne=()=>[le,Y,K],te=()=>[qt,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[mt],breakpoint:[mt],color:[e1],container:[mt],"drop-shadow":[mt],ease:["in","out","in-out"],font:[r1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[mt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[mt],shadow:[mt],spacing:["px",le],text:[mt],"text-shadow":[mt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qt,K,Y,v]}],container:["container"],columns:[{columns:[le,K,Y,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[St,"auto",Y,K]}],basis:[{basis:[qt,"full","auto",a,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[le,qt,"auto","initial","none",K]}],grow:[{grow:["",le,Y,K]}],shrink:[{shrink:["",le,Y,K]}],order:[{order:[St,"first","last","none",Y,K]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],w:[{w:[a,"screen",...O()]}],"min-w":[{"min-w":[a,"screen","none",...O()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,Vn,Lt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Y,yr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xr,K]}],"font-family":[{font:[a1,K,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Y,K]}],"line-clamp":[{"line-clamp":[le,"none",Y,yr]}],leading:[{leading:[i,...j()]}],"list-image":[{"list-image":["none",Y,K]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Y,K]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[le,"from-font","auto",Y,Lt]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[le,"auto",Y,K]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Y,K]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Y,K]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},St,Y,K],radial:["",Y,K],conic:[St,Y,K]},c1,i1]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[le,Y,K]}],"outline-w":[{outline:["",le,Vn,Lt]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",u,ls,as]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",h,ls,as]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[le,Lt]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",m,ls,as]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[le,Y,K]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[le]}],"mask-image-linear-from-pos":[{"mask-linear-from":N()}],"mask-image-linear-to-pos":[{"mask-linear-to":N()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":N()}],"mask-image-t-to-pos":[{"mask-t-to":N()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":N()}],"mask-image-r-to-pos":[{"mask-r-to":N()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":N()}],"mask-image-b-to-pos":[{"mask-b-to":N()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":N()}],"mask-image-l-to-pos":[{"mask-l-to":N()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":N()}],"mask-image-x-to-pos":[{"mask-x-to":N()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":N()}],"mask-image-y-to-pos":[{"mask-y-to":N()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":N()}],"mask-image-radial-to-pos":[{"mask-radial-to":N()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[le]}],"mask-image-conic-from-pos":[{"mask-conic-from":N()}],"mask-image-conic-to-pos":[{"mask-conic-to":N()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Y,K]}],filter:[{filter:["","none",Y,K]}],blur:[{blur:L()}],brightness:[{brightness:[le,Y,K]}],contrast:[{contrast:[le,Y,K]}],"drop-shadow":[{"drop-shadow":["","none",g,ls,as]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",le,Y,K]}],"hue-rotate":[{"hue-rotate":[le,Y,K]}],invert:[{invert:["",le,Y,K]}],saturate:[{saturate:[le,Y,K]}],sepia:[{sepia:["",le,Y,K]}],"backdrop-filter":[{"backdrop-filter":["","none",Y,K]}],"backdrop-blur":[{"backdrop-blur":L()}],"backdrop-brightness":[{"backdrop-brightness":[le,Y,K]}],"backdrop-contrast":[{"backdrop-contrast":[le,Y,K]}],"backdrop-grayscale":[{"backdrop-grayscale":["",le,Y,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[le,Y,K]}],"backdrop-invert":[{"backdrop-invert":["",le,Y,K]}],"backdrop-opacity":[{"backdrop-opacity":[le,Y,K]}],"backdrop-saturate":[{"backdrop-saturate":[le,Y,K]}],"backdrop-sepia":[{"backdrop-sepia":["",le,Y,K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Y,K]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[le,"initial",Y,K]}],ease:[{ease:["linear","initial",b,Y,K]}],delay:[{delay:[le,Y,K]}],animate:[{animate:["none",y,Y,K]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Y,K]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:D()}],"scale-x":[{"scale-x":D()}],"scale-y":[{"scale-y":D()}],"scale-z":[{"scale-z":D()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[Y,K,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Y,K]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Y,K]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[le,Vn,Lt,yr]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},h1=Kg(f1);function Q(...e){return h1(Vf.clsx(e))}function m1(e,t){return{id:e.streamInfo.id,timestamp:e.streamInfo.timestamp,message:e.text,from:e.participantInfo.identity===t.localParticipant.identity?t.localParticipant:Array.from(t.remoteParticipants.values()).find(n=>n.identity===e.participantInfo.identity)}}const p1=Ds.cva(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function g1({className:e,variant:t,...n}){return c.jsx("div",{"data-slot":"alert",role:"alert",className:Q(p1({variant:t}),e),...n})}function x1({className:e,...t}){return c.jsx("div",{"data-slot":"alert-title",className:Q("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function y1({className:e,...t}){return c.jsx("div",{"data-slot":"alert-description",className:Q("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function cs(e){return ud.custom(t=>c.jsx(v1,{id:t,title:e.title,description:e.description}),{duration:1e4})}function v1(e){const{title:t,id:n,description:s}=e;return c.jsxs(g1,{onClick:()=>ud.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[c.jsx(wd,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx(x1,{className:"text-base font-semibold text-white mb-1",children:t}),c.jsx(y1,{className:"text-sm text-gray-300 leading-snug",children:s})]})]})}function Ya(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rd(...e){return t=>{let n=!1;const s=e.map(r=>{const i=Ya(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():Ya(e[r],null)}}}}function Re(...e){return f.useCallback(Rd(...e),e)}function Wn(e){const t=w1(e),n=f.forwardRef((s,r)=>{const{children:i,...o}=s,a=f.Children.toArray(i),l=a.find(C1);if(l){const d=l.props.children,u=a.map(h=>h===l?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:h);return c.jsx(t,{...o,ref:r,children:f.isValidElement(d)?f.cloneElement(d,void 0,u):null})}return c.jsx(t,{...o,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var b1=Wn("Slot");function w1(e){const t=f.forwardRef((n,s)=>{const{children:r,...i}=n;if(f.isValidElement(r)){const o=k1(r),a=E1(i,r.props);return r.type!==f.Fragment&&(a.ref=s?Rd(s,o):o),f.cloneElement(r,a)}return f.Children.count(r)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S1=Symbol("radix.slottable");function C1(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S1}function E1(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function k1(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const A1=Ds.cva(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function T1({className:e,variant:t,size:n,asChild:s=!1,...r}){const i=s?b1:"button";return c.jsx(i,{"data-slot":"button",className:Q(A1({variant:t,size:n,className:e})),...r})}function j1({onSend:e,className:t,disabled:n,...s}){const r=E.useRef(null),[i,o]=E.useState(""),a=d=>{var u,h;d.preventDefault(),(u=s.onSubmit)==null||u.call(s,d),e==null||e(i),o(""),(h=r.current)==null||h.focus({preventScroll:!0})},l=n||i.trim().length===0;return c.jsxs("form",{...s,onSubmit:a,className:Q("flex items-center rounded-md pl-1 text-sm",t),children:[c.jsx("input",{ref:r,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:i,onChange:d=>o(d.target.value),disabled:n}),c.jsx(T1,{size:"sm",type:"submit",variant:l?"secondary":"primary",disabled:l,className:"font-mono",children:"SEND"})]})}function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}var Ue=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},P1=f[" useInsertionEffect ".trim().toString()]||Ue;function ro({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=M1({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r;{const u=f.useRef(e!==void 0);f.useEffect(()=>{const h=u.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,s])}const d=f.useCallback(u=>{var h;if(a){const m=N1(u)?u(e):u;m!==e&&((h=o.current)==null||h.call(o,m))}else i(u)},[a,e,i,o]);return[l,d]}function M1({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),r=f.useRef(n),i=f.useRef(t);return P1(()=>{i.current=t},[t]),f.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function N1(e){return typeof e=="function"}var R1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=R1.reduce((e,t)=>{const n=Wn(`Primitive.${t}`),s=f.forwardRef((r,i)=>{const{asChild:o,...a}=r,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function V1(e,t){e&&Ls.flushSync(()=>e.dispatchEvent(t))}var Vd="Toggle",Id=f.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,a]=ro({prop:n,onChange:r,defaultProp:s??!1,caller:Vd});return c.jsx(we.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:Ee(e.onClick,()=>{e.disabled||a(!o)})})});Id.displayName=Vd;var I1=Id;const D1=Ds.cva(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function Dd({className:e,variant:t,size:n,...s}){return c.jsx(I1,{"data-slot":"toggle",className:Q(D1({variant:t,size:n,className:e})),...s})}function L1(e){const[t,n]=E.useState(()=>e.getPublishPermissions());return E.useEffect(()=>{const s=()=>{n(e.getPublishPermissions())},r=()=>{s()};return e.on("connection.connected",r),e.on("connection.disconnected",r),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r)}},[e]),t}function F1(e){const[t,n]=E.useState(()=>e.getLocalParticipant()),[s,r]=E.useState(()=>e.getMicrophoneTrack());return E.useEffect(()=>{const i=()=>{const a=e.getLocalParticipant(),l=e.getMicrophoneTrack();console.log("🎤 useVoxketLocalParticipant: Updating state:",{hasParticipant:!!a,hasMicTrack:!!l,isMicEnabled:e.isMicrophoneEnabled,trackPublications:a?a.trackPublications.size:0}),n(a),r(l)};i(),e.on("connection.connected",i),e.on("connection.disconnected",i),e.on("track.muted",i),e.on("track.unmuted",i);const o=e.getRoom();if(o){const a=()=>{console.log("🎤 Track published, updating participant state"),i()},l=()=>{console.log("🎤 Track unpublished, updating participant state"),i()};return o.on("localTrackPublished",a),o.on("localTrackUnpublished",l),()=>{e.off("connection.connected",i),e.off("connection.disconnected",i),e.off("track.muted",i),e.off("track.unmuted",i),o.off("localTrackPublished",a),o.off("localTrackUnpublished",l)}}else return()=>{e.off("connection.connected",i),e.off("connection.disconnected",i),e.off("track.muted",i),e.off("track.unmuted",i)}},[e]),{localParticipant:t,microphoneTrack:s}}function vr(e,t,n){const[s,r]=E.useState(!1),[i,o]=E.useState(!1);return E.useEffect(()=>{const l=()=>{let d=!1;switch(t){case"microphone":d=e.isMicrophoneEnabled;break;case"camera":d=e.isCameraEnabled;break;case"screenShare":d=e.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${t} enabled state updated to:`,d),r(d)};return l(),e.on("track.muted",l),e.on("track.unmuted",l),e.on("connection.connected",l),()=>{e.off("track.muted",l),e.off("track.unmuted",l),e.off("connection.connected",l)}},[e,t]),{enabled:s,pending:i,toggle:async l=>{var d;try{o(!0);const u=l!==void 0?l:!s;switch(t){case"microphone":await e.toggleMicrophone(u);break;case"camera":await e.toggleCamera(u);break;case"screenShare":u?await e.startScreenShare():await e.stopScreenShare();break}}catch(u){(d=n==null?void 0:n.onDeviceError)==null||d.call(n,u)}finally{o(!1)}}}}function O1(e){const[t,n]=E.useState(()=>e.getRoom()),[s,r]=E.useState(()=>e.getConnectionState());return E.useEffect(()=>{const i=()=>{n(e.getRoom()),r(e.getConnectionState())};return e.on("connection.connected",i),e.on("connection.disconnected",i),e.on("connection.connecting",i),()=>{e.off("connection.connected",i),e.off("connection.disconnected",i),e.off("connection.connecting",i)}},[e]),t}function _1(e,t){const[n,s]=E.useState([]),[r,i]=E.useState("");return E.useEffect(()=>{var d;const a=async()=>{try{const u=t==="audioinput"?await e.getAudioInputDevices():await e.getVideoInputDevices();s(u)}catch(u){console.error("Failed to load devices:",u)}};a();const l=()=>{a()};return(d=navigator.mediaDevices)==null||d.addEventListener("devicechange",l),()=>{var u;(u=navigator.mediaDevices)==null||u.removeEventListener("devicechange",l)}},[e,t]),{devices:n,activeDeviceId:r,setActiveMediaDevice:async a=>{try{t==="audioinput"?await e.setAudioInputDevice(a):await e.setVideoInputDevice(a),i(a)}catch(l){console.error("Failed to set device:",l)}}}}function $1(e){const{preventSave:t=!1}=e||{};return{saveAudioInputEnabled:o=>{t||localStorage.setItem("voxket-audio-input-enabled",o.toString())},saveAudioInputDeviceId:o=>{t||localStorage.setItem("voxket-audio-input-device-id",o)},saveVideoInputEnabled:o=>{t||localStorage.setItem("voxket-video-input-enabled",o.toString())},saveVideoInputDeviceId:o=>{t||localStorage.setItem("voxket-video-input-device-id",o)}}}function Ga(e,[t,n]){return Math.min(n,Math.max(t,e))}function ni(e,t=[]){let n=[];function s(i,o){const a=f.createContext(o),l=n.length;n=[...n,o];const d=h=>{var b;const{scope:m,children:g,...x}=h,p=((b=m==null?void 0:m[e])==null?void 0:b[l])||a,v=f.useMemo(()=>x,Object.values(x));return c.jsx(p.Provider,{value:v,children:g})};d.displayName=i+"Provider";function u(h,m){var p;const g=((p=m==null?void 0:m[e])==null?void 0:p[l])||a,x=f.useContext(g);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[d,u]}const r=()=>{const i=n.map(o=>f.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[s,B1(r,...t)]}function B1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:l,scopeName:d})=>{const h=l(i)[`__scope${d}`];return{...a,...h}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function H1(e){const t=e+"CollectionProvider",[n,s]=ni(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:v,children:b}=p,y=E.useRef(null),w=E.useRef(new Map).current;return c.jsx(r,{scope:v,itemMap:w,collectionRef:y,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=Wn(a),d=E.forwardRef((p,v)=>{const{scope:b,children:y}=p,w=i(a,b),S=Re(v,w.collectionRef);return c.jsx(l,{ref:S,children:y})});d.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",m=Wn(u),g=E.forwardRef((p,v)=>{const{scope:b,children:y,...w}=p,S=E.useRef(null),k=Re(v,S),T=i(u,b);return E.useEffect(()=>(T.itemMap.set(S,{ref:S,...w}),()=>void T.itemMap.delete(S))),c.jsx(m,{[h]:"",ref:k,children:y})});g.displayName=u;function x(p){const v=i(e+"CollectionConsumer",p);return E.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((T,A)=>w.indexOf(T.ref.current)-w.indexOf(A.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:d,ItemSlot:g},x,s]}var U1=f.createContext(void 0);function z1(e){const t=f.useContext(U1);return e||t||"ltr"}function Ut(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function Z1(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e);f.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var W1="DismissableLayer",oo="dismissableLayer.update",K1="dismissableLayer.pointerDownOutside",Y1="dismissableLayer.focusOutside",Xa,Ld=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fd=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:o,onDismiss:a,...l}=e,d=f.useContext(Ld),[u,h]=f.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=f.useState({}),x=Re(t,A=>h(A)),p=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=p.indexOf(v),y=u?p.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,S=y>=b,k=q1(A=>{const j=A.target,V=[...d.branches].some(I=>I.contains(j));!S||V||(r==null||r(A),o==null||o(A),A.defaultPrevented||a==null||a())},m),T=J1(A=>{const j=A.target;[...d.branches].some(I=>I.contains(j))||(i==null||i(A),o==null||o(A),A.defaultPrevented||a==null||a())},m);return Z1(A=>{y===d.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&a&&(A.preventDefault(),a()))},m),f.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Xa=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),qa(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Xa)}},[u,m,n,d]),f.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),qa())},[u,d]),f.useEffect(()=>{const A=()=>g({});return document.addEventListener(oo,A),()=>document.removeEventListener(oo,A)},[]),c.jsx(we.div,{...l,ref:x,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,k.onPointerDownCapture)})});Fd.displayName=W1;var G1="DismissableLayerBranch",X1=f.forwardRef((e,t)=>{const n=f.useContext(Ld),s=f.useRef(null),r=Re(t,s);return f.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(we.div,{...e,ref:r})});X1.displayName=G1;function q1(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),s=f.useRef(!1),r=f.useRef(()=>{});return f.useEffect(()=>{const i=a=>{if(a.target&&!s.current){let l=function(){Od(K1,n,d,{discrete:!0})};const d={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function J1(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),s=f.useRef(!1);return f.useEffect(()=>{const r=i=>{i.target&&!s.current&&Od(Y1,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function qa(){const e=new CustomEvent(oo);document.dispatchEvent(e)}function Od(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?V1(r,i):r.dispatchEvent(i)}var br=0;function Q1(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ja()),document.body.insertAdjacentElement("beforeend",e[1]??Ja()),br++,()=>{br===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),br--}},[])}function Ja(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var wr="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",Qa={bubbles:!1,cancelable:!0},ex="FocusScope",_d=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,l]=f.useState(null),d=Ut(r),u=Ut(i),h=f.useRef(null),m=Re(t,p=>l(p)),g=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let p=function(w){if(g.paused||!a)return;const S=w.target;a.contains(S)?h.current=S:Et(h.current,{select:!0})},v=function(w){if(g.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||Et(h.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const k of w)k.removedNodes.length>0&&Et(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const y=new MutationObserver(b);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),y.disconnect()}}},[s,a,g.paused]),f.useEffect(()=>{if(a){tl.add(g);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(wr,Qa);a.addEventListener(wr,d),a.dispatchEvent(b),b.defaultPrevented||(tx(ix($d(a)),{select:!0}),document.activeElement===p&&Et(a))}return()=>{a.removeEventListener(wr,d),setTimeout(()=>{const b=new CustomEvent(Sr,Qa);a.addEventListener(Sr,u),a.dispatchEvent(b),b.defaultPrevented||Et(p??document.body,{select:!0}),a.removeEventListener(Sr,u),tl.remove(g)},0)}}},[a,d,u,g]);const x=f.useCallback(p=>{if(!n&&!s||g.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(v&&b){const y=p.currentTarget,[w,S]=nx(y);w&&S?!p.shiftKey&&b===S?(p.preventDefault(),n&&Et(w,{select:!0})):p.shiftKey&&b===w&&(p.preventDefault(),n&&Et(S,{select:!0})):b===y&&p.preventDefault()}},[n,s,g.paused]);return c.jsx(we.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});_d.displayName=ex;function tx(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Et(s,{select:t}),document.activeElement!==n)return}function nx(e){const t=$d(e),n=el(t,e),s=el(t.reverse(),e);return[n,s]}function $d(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function el(e,t){for(const n of e)if(!sx(n,{upTo:t}))return n}function sx(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rx(e){return e instanceof HTMLInputElement&&"select"in e}function Et(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rx(e)&&t&&e.select()}}var tl=ox();function ox(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=nl(e,t),e.unshift(t)},remove(t){var n;e=nl(e,t),(n=e[0])==null||n.resume()}}}function nl(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function ix(e){return e.filter(t=>t.tagName!=="A")}var ax=f[" useId ".trim().toString()]||(()=>{}),lx=0;function si(e){const[t,n]=f.useState(ax());return Ue(()=>{n(s=>s??String(lx++))},[e]),e||(t?`radix-${t}`:"")}const cx=["top","right","bottom","left"],Tt=Math.min,ze=Math.max,Ms=Math.round,ds=Math.floor,dt=e=>({x:e,y:e}),dx={left:"right",right:"left",bottom:"top",top:"bottom"},ux={start:"end",end:"start"};function io(e,t,n){return ze(e,Tt(t,n))}function bt(e,t){return typeof e=="function"?e(t):e}function wt(e){return e.split("-")[0]}function En(e){return e.split("-")[1]}function ri(e){return e==="x"?"y":"x"}function oi(e){return e==="y"?"height":"width"}const fx=new Set(["top","bottom"]);function at(e){return fx.has(wt(e))?"y":"x"}function ii(e){return ri(at(e))}function hx(e,t,n){n===void 0&&(n=!1);const s=En(e),r=ii(e),i=oi(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Ns(o)),[o,Ns(o)]}function mx(e){const t=Ns(e);return[ao(e),t,ao(t)]}function ao(e){return e.replace(/start|end/g,t=>ux[t])}const sl=["left","right"],rl=["right","left"],px=["top","bottom"],gx=["bottom","top"];function xx(e,t,n){switch(e){case"top":case"bottom":return n?t?rl:sl:t?sl:rl;case"left":case"right":return t?px:gx;default:return[]}}function yx(e,t,n,s){const r=En(e);let i=xx(wt(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(ao)))),i}function Ns(e){return e.replace(/left|right|bottom|top/g,t=>dx[t])}function vx(e){return{top:0,right:0,bottom:0,left:0,...e}}function Bd(e){return typeof e!="number"?vx(e):{top:e,right:e,bottom:e,left:e}}function Rs(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function ol(e,t,n){let{reference:s,floating:r}=e;const i=at(t),o=ii(t),a=oi(o),l=wt(t),d=i==="y",u=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,m=s[a]/2-r[a]/2;let g;switch(l){case"top":g={x:u,y:s.y-r.height};break;case"bottom":g={x:u,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:h};break;case"left":g={x:s.x-r.width,y:h};break;default:g={x:s.x,y:s.y}}switch(En(t)){case"start":g[o]-=m*(n&&d?-1:1);break;case"end":g[o]+=m*(n&&d?-1:1);break}return g}const bx=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:h}=ol(d,s,l),m=s,g={},x=0;for(let p=0;p<a.length;p++){const{name:v,fn:b}=a[p],{x:y,y:w,data:S,reset:k}=await b({x:u,y:h,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:d,platform:o,elements:{reference:e,floating:t}});u=y??u,h=w??h,g={...g,[v]:{...g[v],...S}},k&&x<=50&&(x++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:u,y:h}=ol(d,m,l)),p=-1)}return{x:u,y:h,placement:m,strategy:r,middlewareData:g}};async function Kn(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:g=0}=bt(t,e),x=Bd(g),v=a[m?h==="floating"?"reference":"floating":h],b=Rs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),y=h==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},k=Rs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(b.top-k.top+x.top)/S.y,bottom:(k.bottom-b.bottom+x.bottom)/S.y,left:(b.left-k.left+x.left)/S.x,right:(k.right-b.right+x.right)/S.x}}const wx=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:u=0}=bt(e,t)||{};if(d==null)return{};const h=Bd(u),m={x:n,y:s},g=ii(r),x=oi(g),p=await o.getDimensions(d),v=g==="y",b=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[g]-m[g]-i.floating[x],k=m[g]-i.reference[g],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let A=T?T[w]:0;(!A||!await(o.isElement==null?void 0:o.isElement(T)))&&(A=a.floating[w]||i.floating[x]);const j=S/2-k/2,V=A/2-p[x]/2-1,I=Tt(h[b],V),$=Tt(h[y],V),F=I,se=A-p[x]-$,Z=A/2-p[x]/2+j,ee=io(F,Z,se),G=!l.arrow&&En(r)!=null&&Z!==ee&&i.reference[x]/2-(Z<F?I:$)-p[x]/2<0,O=G?Z<F?Z-F:Z-se:0;return{[g]:m[g]+O,data:{[g]:ee,centerOffset:Z-ee-O,...G&&{alignmentOffset:O}},reset:G}}}),Sx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:p=!0,...v}=bt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=wt(r),y=at(a),w=wt(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),k=m||(w||!p?[Ns(a)]:mx(a)),T=x!=="none";!m&&T&&k.push(...yx(a,p,x,S));const A=[a,...k],j=await Kn(t,v),V=[];let I=((s=i.flip)==null?void 0:s.overflows)||[];if(u&&V.push(j[b]),h){const Z=hx(r,o,S);V.push(j[Z[0]],j[Z[1]])}if(I=[...I,{placement:r,overflows:V}],!V.every(Z=>Z<=0)){var $,F;const Z=((($=i.flip)==null?void 0:$.index)||0)+1,ee=A[Z];if(ee&&(!(h==="alignment"?y!==at(ee):!1)||I.every(P=>P.overflows[0]>0&&at(P.placement)===y)))return{data:{index:Z,overflows:I},reset:{placement:ee}};let G=(F=I.filter(O=>O.overflows[0]<=0).sort((O,P)=>O.overflows[1]-P.overflows[1])[0])==null?void 0:F.placement;if(!G)switch(g){case"bestFit":{var se;const O=(se=I.filter(P=>{if(T){const B=at(P.placement);return B===y||B==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(B=>B>0).reduce((B,X)=>B+X,0)]).sort((P,B)=>P[1]-B[1])[0])==null?void 0:se[0];O&&(G=O);break}case"initialPlacement":G=a;break}if(r!==G)return{reset:{placement:G}}}return{}}}};function il(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function al(e){return cx.some(t=>e[t]>=0)}const Cx=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...r}=bt(e,t);switch(s){case"referenceHidden":{const i=await Kn(t,{...r,elementContext:"reference"}),o=il(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:al(o)}}}case"escaped":{const i=await Kn(t,{...r,altBoundary:!0}),o=il(i,n.floating);return{data:{escapedOffsets:o,escaped:al(o)}}}default:return{}}}}},Hd=new Set(["left","top"]);async function Ex(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=wt(n),a=En(n),l=at(n)==="y",d=Hd.has(o)?-1:1,u=i&&l?-1:1,h=bt(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof x=="number"&&(g=a==="end"?x*-1:x),l?{x:g*u,y:m*d}:{x:m*d,y:g*u}}const kx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=t,l=await Ex(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:o}}}}},Ax=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x:b,y}=v;return{x:b,y}}},...l}=bt(e,t),d={x:n,y:s},u=await Kn(t,l),h=at(wt(r)),m=ri(h);let g=d[m],x=d[h];if(i){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",y=g+u[v],w=g-u[b];g=io(y,g,w)}if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=x+u[v],w=x-u[b];x=io(y,x,w)}const p=a.fn({...t,[m]:g,[h]:x});return{...p,data:{x:p.x-n,y:p.y-s,enabled:{[m]:i,[h]:o}}}}}},Tx=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=bt(e,t),u={x:n,y:s},h=at(r),m=ri(h);let g=u[m],x=u[h];const p=bt(a,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const w=m==="y"?"height":"width",S=i.reference[m]-i.floating[w]+v.mainAxis,k=i.reference[m]+i.reference[w]-v.mainAxis;g<S?g=S:g>k&&(g=k)}if(d){var b,y;const w=m==="y"?"width":"height",S=Hd.has(wt(r)),k=i.reference[h]-i.floating[w]+(S&&((b=o.offset)==null?void 0:b[h])||0)+(S?0:v.crossAxis),T=i.reference[h]+i.reference[w]+(S?0:((y=o.offset)==null?void 0:y[h])||0)-(S?v.crossAxis:0);x<k?x=k:x>T&&(x=T)}return{[m]:g,[h]:x}}}},jx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:r,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=bt(e,t),u=await Kn(t,d),h=wt(r),m=En(r),g=at(r)==="y",{width:x,height:p}=i.floating;let v,b;h==="top"||h==="bottom"?(v=h,b=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=h,v=m==="end"?"top":"bottom");const y=p-u.top-u.bottom,w=x-u.left-u.right,S=Tt(p-u[v],y),k=Tt(x-u[b],w),T=!t.middlewareData.shift;let A=S,j=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(A=y),T&&!m){const I=ze(u.left,0),$=ze(u.right,0),F=ze(u.top,0),se=ze(u.bottom,0);g?j=x-2*(I!==0||$!==0?I+$:ze(u.left,u.right)):A=p-2*(F!==0||se!==0?F+se:ze(u.top,u.bottom))}await l({...t,availableWidth:j,availableHeight:A});const V=await o.getDimensions(a.floating);return x!==V.width||p!==V.height?{reset:{rects:!0}}:{}}}};function Bs(){return typeof window<"u"}function kn(e){return Ud(e)?(e.nodeName||"").toLowerCase():"#document"}function Ze(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ft(e){var t;return(t=(Ud(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ud(e){return Bs()?e instanceof Node||e instanceof Ze(e).Node:!1}function tt(e){return Bs()?e instanceof Element||e instanceof Ze(e).Element:!1}function ut(e){return Bs()?e instanceof HTMLElement||e instanceof Ze(e).HTMLElement:!1}function ll(e){return!Bs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ze(e).ShadowRoot}const Px=new Set(["inline","contents"]);function Qn(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=nt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!Px.has(r)}const Mx=new Set(["table","td","th"]);function Nx(e){return Mx.has(kn(e))}const Rx=[":popover-open",":modal"];function Hs(e){return Rx.some(t=>{try{return e.matches(t)}catch{return!1}})}const Vx=["transform","translate","scale","rotate","perspective"],Ix=["transform","translate","scale","rotate","perspective","filter"],Dx=["paint","layout","strict","content"];function ai(e){const t=li(),n=tt(e)?nt(e):e;return Vx.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Ix.some(s=>(n.willChange||"").includes(s))||Dx.some(s=>(n.contain||"").includes(s))}function Lx(e){let t=jt(e);for(;ut(t)&&!gn(t);){if(ai(t))return t;if(Hs(t))return null;t=jt(t)}return null}function li(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Fx=new Set(["html","body","#document"]);function gn(e){return Fx.has(kn(e))}function nt(e){return Ze(e).getComputedStyle(e)}function Us(e){return tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jt(e){if(kn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ll(e)&&e.host||ft(e);return ll(t)?t.host:t}function zd(e){const t=jt(e);return gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:ut(t)&&Qn(t)?t:zd(t)}function Yn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=zd(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=Ze(r);if(i){const a=lo(o);return t.concat(o,o.visualViewport||[],Qn(r)?r:[],a&&n?Yn(a):[])}return t.concat(r,Yn(r,[],n))}function lo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zd(e){const t=nt(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=ut(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=Ms(n)!==i||Ms(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function ci(e){return tt(e)?e:e.contextElement}function fn(e){const t=ci(e);if(!ut(t))return dt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=Zd(t);let o=(i?Ms(n.width):n.width)/s,a=(i?Ms(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ox=dt(0);function Wd(e){const t=Ze(e);return!li()||!t.visualViewport?Ox:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _x(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ze(e)?!1:t}function zt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=ci(e);let o=dt(1);t&&(s?tt(s)&&(o=fn(s)):o=fn(e));const a=_x(i,n,s)?Wd(i):dt(0);let l=(r.left+a.x)/o.x,d=(r.top+a.y)/o.y,u=r.width/o.x,h=r.height/o.y;if(i){const m=Ze(i),g=s&&tt(s)?Ze(s):s;let x=m,p=lo(x);for(;p&&s&&g!==x;){const v=fn(p),b=p.getBoundingClientRect(),y=nt(p),w=b.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,S=b.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,d*=v.y,u*=v.x,h*=v.y,l+=w,d+=S,x=Ze(p),p=lo(x)}}return Rs({width:u,height:h,x:l,y:d})}function di(e,t){const n=Us(e).scrollLeft;return t?t.left+n:zt(ft(e)).left+n}function Kd(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:di(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function $x(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=ft(s),a=t?Hs(t.floating):!1;if(s===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=dt(1);const u=dt(0),h=ut(s);if((h||!h&&!i)&&((kn(s)!=="body"||Qn(o))&&(l=Us(s)),ut(s))){const g=zt(s);d=fn(s),u.x=g.x+s.clientLeft,u.y=g.y+s.clientTop}const m=o&&!h&&!i?Kd(o,l,!0):dt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-l.scrollTop*d.y+u.y+m.y}}function Bx(e){return Array.from(e.getClientRects())}function Hx(e){const t=ft(e),n=Us(e),s=e.ownerDocument.body,r=ze(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=ze(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+di(e);const a=-n.scrollTop;return nt(s).direction==="rtl"&&(o+=ze(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:o,y:a}}function Ux(e,t){const n=Ze(e),s=ft(e),r=n.visualViewport;let i=s.clientWidth,o=s.clientHeight,a=0,l=0;if(r){i=r.width,o=r.height;const d=li();(!d||d&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:i,height:o,x:a,y:l}}const zx=new Set(["absolute","fixed"]);function Zx(e,t){const n=zt(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=ut(e)?fn(e):dt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=r*i.x,d=s*i.y;return{width:o,height:a,x:l,y:d}}function cl(e,t,n){let s;if(t==="viewport")s=Ux(e,n);else if(t==="document")s=Hx(ft(e));else if(tt(t))s=Zx(t,n);else{const r=Wd(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Rs(s)}function Yd(e,t){const n=jt(e);return n===t||!tt(n)||gn(n)?!1:nt(n).position==="fixed"||Yd(n,t)}function Wx(e,t){const n=t.get(e);if(n)return n;let s=Yn(e,[],!1).filter(a=>tt(a)&&kn(a)!=="body"),r=null;const i=nt(e).position==="fixed";let o=i?jt(e):e;for(;tt(o)&&!gn(o);){const a=nt(o),l=ai(o);!l&&a.position==="fixed"&&(r=null),(i?!l&&!r:!l&&a.position==="static"&&!!r&&zx.has(r.position)||Qn(o)&&!l&&Yd(e,o))?s=s.filter(u=>u!==o):r=a,o=jt(o)}return t.set(e,s),s}function Kx(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?Hs(t)?[]:Wx(t,this._c):[].concat(n),s],a=o[0],l=o.reduce((d,u)=>{const h=cl(t,u,r);return d.top=ze(h.top,d.top),d.right=Tt(h.right,d.right),d.bottom=Tt(h.bottom,d.bottom),d.left=ze(h.left,d.left),d},cl(t,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Yx(e){const{width:t,height:n}=Zd(e);return{width:t,height:n}}function Gx(e,t,n){const s=ut(t),r=ft(t),i=n==="fixed",o=zt(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=dt(0);function d(){l.x=di(r)}if(s||!s&&!i)if((kn(t)!=="body"||Qn(r))&&(a=Us(t)),s){const g=zt(t,!0,i,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}else r&&d();i&&!s&&r&&d();const u=r&&!s&&!i?Kd(r,a):dt(0),h=o.left+a.scrollLeft-l.x-u.x,m=o.top+a.scrollTop-l.y-u.y;return{x:h,y:m,width:o.width,height:o.height}}function Cr(e){return nt(e).position==="static"}function dl(e,t){if(!ut(e)||nt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ft(e)===n&&(n=n.ownerDocument.body),n}function Gd(e,t){const n=Ze(e);if(Hs(e))return n;if(!ut(e)){let r=jt(e);for(;r&&!gn(r);){if(tt(r)&&!Cr(r))return r;r=jt(r)}return n}let s=dl(e,t);for(;s&&Nx(s)&&Cr(s);)s=dl(s,t);return s&&gn(s)&&Cr(s)&&!ai(s)?n:s||Lx(e)||n}const Xx=async function(e){const t=this.getOffsetParent||Gd,n=this.getDimensions,s=await n(e.floating);return{reference:Gx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function qx(e){return nt(e).direction==="rtl"}const Jx={convertOffsetParentRelativeRectToViewportRelativeRect:$x,getDocumentElement:ft,getClippingRect:Kx,getOffsetParent:Gd,getElementRects:Xx,getClientRects:Bx,getDimensions:Yx,getScale:fn,isElement:tt,isRTL:qx};function Xd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qx(e,t){let n=null,s;const r=ft(e);function i(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const d=e.getBoundingClientRect(),{left:u,top:h,width:m,height:g}=d;if(a||t(),!m||!g)return;const x=ds(h),p=ds(r.clientWidth-(u+m)),v=ds(r.clientHeight-(h+g)),b=ds(u),w={rootMargin:-x+"px "+-p+"px "+-v+"px "+-b+"px",threshold:ze(0,Tt(1,l))||1};let S=!0;function k(T){const A=T[0].intersectionRatio;if(A!==l){if(!S)return o();A?o(!1,A):s=setTimeout(()=>{o(!1,1e-7)},1e3)}A===1&&!Xd(d,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(k,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return o(!0),i}function ey(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,d=ci(e),u=r||i?[...d?Yn(d):[],...Yn(t)]:[];u.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=d&&a?Qx(d,n):null;let m=-1,g=null;o&&(g=new ResizeObserver(b=>{let[y]=b;y&&y.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(t)})),n()}),d&&!l&&g.observe(d),g.observe(t));let x,p=l?zt(e):null;l&&v();function v(){const b=zt(e);p&&!Xd(p,b)&&n(),p=b,x=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(y=>{r&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),h==null||h(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(x)}}const ty=kx,ny=Ax,sy=Sx,ry=jx,oy=Cx,ul=wx,iy=Tx,ay=(e,t,n)=>{const s=new Map,r={platform:Jx,...n},i={...r.platform,_c:s};return bx(e,t,{...r,platform:i})};var ly=typeof document<"u",cy=function(){},bs=ly?E.useLayoutEffect:cy;function Vs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Vs(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!Vs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function qd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fl(e,t){const n=qd(e);return Math.round(t*n)/n}function Er(e){const t=f.useRef(e);return bs(()=>{t.current=e}),t}function dy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[u,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=f.useState(s);Vs(m,s)||g(s);const[x,p]=f.useState(null),[v,b]=f.useState(null),y=f.useCallback(P=>{P!==T.current&&(T.current=P,p(P))},[]),w=f.useCallback(P=>{P!==A.current&&(A.current=P,b(P))},[]),S=i||x,k=o||v,T=f.useRef(null),A=f.useRef(null),j=f.useRef(u),V=l!=null,I=Er(l),$=Er(r),F=Er(d),se=f.useCallback(()=>{if(!T.current||!A.current)return;const P={placement:t,strategy:n,middleware:m};$.current&&(P.platform=$.current),ay(T.current,A.current,P).then(B=>{const X={...B,isPositioned:F.current!==!1};Z.current&&!Vs(j.current,X)&&(j.current=X,Ls.flushSync(()=>{h(X)}))})},[m,t,n,$,F]);bs(()=>{d===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,h(P=>({...P,isPositioned:!1})))},[d]);const Z=f.useRef(!1);bs(()=>(Z.current=!0,()=>{Z.current=!1}),[]),bs(()=>{if(S&&(T.current=S),k&&(A.current=k),S&&k){if(I.current)return I.current(S,k,se);se()}},[S,k,se,I,V]);const ee=f.useMemo(()=>({reference:T,floating:A,setReference:y,setFloating:w}),[y,w]),G=f.useMemo(()=>({reference:S,floating:k}),[S,k]),O=f.useMemo(()=>{const P={position:n,left:0,top:0};if(!G.floating)return P;const B=fl(G.floating,u.x),X=fl(G.floating,u.y);return a?{...P,transform:"translate("+B+"px, "+X+"px)",...qd(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:X}},[n,a,G.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:se,refs:ee,elements:G,floatingStyles:O}),[u,se,ee,G,O])}const uy=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:r}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ul({element:s.current,padding:r}).fn(n):{}:s?ul({element:s,padding:r}).fn(n):{}}}},fy=(e,t)=>({...ty(e),options:[e,t]}),hy=(e,t)=>({...ny(e),options:[e,t]}),my=(e,t)=>({...iy(e),options:[e,t]}),py=(e,t)=>({...sy(e),options:[e,t]}),gy=(e,t)=>({...ry(e),options:[e,t]}),xy=(e,t)=>({...oy(e),options:[e,t]}),yy=(e,t)=>({...uy(e),options:[e,t]});var vy="Arrow",Jd=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return c.jsx(we.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jd.displayName=vy;var by=Jd;function wy(e){const[t,n]=f.useState(void 0);return Ue(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,d=Array.isArray(l)?l[0]:l;o=d.inlineSize,a=d.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var ui="Popper",[Qd,eu]=ni(ui),[Sy,tu]=Qd(ui),nu=e=>{const{__scopePopper:t,children:n}=e,[s,r]=f.useState(null);return c.jsx(Sy,{scope:t,anchor:s,onAnchorChange:r,children:n})};nu.displayName=ui;var su="PopperAnchor",ru=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=tu(su,n),o=f.useRef(null),a=Re(t,o);return f.useEffect(()=>{i.onAnchorChange((s==null?void 0:s.current)||o.current)}),s?null:c.jsx(we.div,{...r,ref:a})});ru.displayName=su;var fi="PopperContent",[Cy,Ey]=Qd(fi),ou=f.forwardRef((e,t)=>{var N,L,W,D,ne,te;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:x,...p}=e,v=tu(fi,n),[b,y]=f.useState(null),w=Re(t,de=>y(de)),[S,k]=f.useState(null),T=wy(S),A=(T==null?void 0:T.width)??0,j=(T==null?void 0:T.height)??0,V=s+(i!=="center"?"-"+i:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},$=Array.isArray(d)?d:[d],F=$.length>0,se={padding:I,boundary:$.filter(Ay),altBoundary:F},{refs:Z,floatingStyles:ee,placement:G,isPositioned:O,middlewareData:P}=dy({strategy:"fixed",placement:V,whileElementsMounted:(...de)=>ey(...de,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[fy({mainAxis:r+j,alignmentAxis:o}),l&&hy({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?my():void 0,...se}),l&&py({...se}),gy({...se,apply:({elements:de,rects:me,availableWidth:Ae,availableHeight:De})=>{const{width:rt,height:ot}=me.reference,Fe=de.floating.style;Fe.setProperty("--radix-popper-available-width",`${Ae}px`),Fe.setProperty("--radix-popper-available-height",`${De}px`),Fe.setProperty("--radix-popper-anchor-width",`${rt}px`),Fe.setProperty("--radix-popper-anchor-height",`${ot}px`)}}),S&&yy({element:S,padding:a}),Ty({arrowWidth:A,arrowHeight:j}),m&&xy({strategy:"referenceHidden",...se})]}),[B,X]=lu(G),_=Ut(x);Ue(()=>{O&&(_==null||_())},[O,_]);const re=(N=P.arrow)==null?void 0:N.x,M=(L=P.arrow)==null?void 0:L.y,H=((W=P.arrow)==null?void 0:W.centerOffset)!==0,[q,U]=f.useState();return Ue(()=>{b&&U(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:O?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(D=P.transformOrigin)==null?void 0:D.x,(ne=P.transformOrigin)==null?void 0:ne.y].join(" "),...((te=P.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Cy,{scope:n,placedSide:B,onArrowChange:k,arrowX:re,arrowY:M,shouldHideArrow:H,children:c.jsx(we.div,{"data-side":B,"data-align":X,...p,ref:w,style:{...p.style,animation:O?void 0:"none"}})})})});ou.displayName=fi;var iu="PopperArrow",ky={top:"bottom",right:"left",bottom:"top",left:"right"},au=f.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=Ey(iu,s),o=ky[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(by,{...r,ref:n,style:{...r.style,display:"block"}})})});au.displayName=iu;function Ay(e){return e!==null}var Ty=e=>({name:"transformOrigin",options:e,fn(t){var v,b,y;const{placement:n,rects:s,middlewareData:r}=t,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,u]=lu(n),h={start:"0%",center:"50%",end:"100%"}[u],m=(((b=r.arrow)==null?void 0:b.x)??0)+a/2,g=(((y=r.arrow)==null?void 0:y.y)??0)+l/2;let x="",p="";return d==="bottom"?(x=o?h:`${m}px`,p=`${-l}px`):d==="top"?(x=o?h:`${m}px`,p=`${s.floating.height+l}px`):d==="right"?(x=`${-l}px`,p=o?h:`${g}px`):d==="left"&&(x=`${s.floating.width+l}px`,p=o?h:`${g}px`),{data:{x,y:p}}}});function lu(e){const[t,n="center"]=e.split("-");return[t,n]}var jy=nu,Py=ru,My=ou,Ny=au,Ry="Portal",cu=f.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=f.useState(!1);Ue(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?yo.createPortal(c.jsx(we.div,{...s,ref:t}),o):null});cu.displayName=Ry;function Vy(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var du=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Iy="VisuallyHidden",Dy=f.forwardRef((e,t)=>c.jsx(we.span,{...e,ref:t,style:{...du,...e.style}}));Dy.displayName=Iy;var Ly=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Jt=new WeakMap,us=new WeakMap,fs={},kr=0,uu=function(e){return e&&(e.host||uu(e.parentNode))},Fy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=uu(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Oy=function(e,t,n,s){var r=Fy(t,Array.isArray(e)?e:[e]);fs[n]||(fs[n]=new WeakMap);var i=fs[n],o=[],a=new Set,l=new Set(r),d=function(h){!h||a.has(h)||(a.add(h),d(h.parentNode))};r.forEach(d);var u=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))u(m);else try{var g=m.getAttribute(s),x=g!==null&&g!=="false",p=(Jt.get(m)||0)+1,v=(i.get(m)||0)+1;Jt.set(m,p),i.set(m,v),o.push(m),p===1&&x&&us.set(m,!0),v===1&&m.setAttribute(n,"true"),x||m.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),a.clear(),kr++,function(){o.forEach(function(h){var m=Jt.get(h)-1,g=i.get(h)-1;Jt.set(h,m),i.set(h,g),m||(us.has(h)||h.removeAttribute(s),us.delete(h)),g||h.removeAttribute(n)}),kr--,kr||(Jt=new WeakMap,Jt=new WeakMap,us=new WeakMap,fs={})}},_y=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=Ly(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),Oy(s,r,n,"aria-hidden")):function(){return null}},it=function(){return it=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},it.apply(this,arguments)};function fu(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function $y(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var ws="right-scroll-bar-position",Ss="width-before-scroll-bar",By="with-scroll-bars-hidden",Hy="--removed-body-scroll-bar-size";function Ar(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Uy(e,t){var n=E.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var zy=typeof window<"u"?f.useLayoutEffect:f.useEffect,hl=new WeakMap;function Zy(e,t){var n=Uy(null,function(s){return e.forEach(function(r){return Ar(r,s)})});return zy(function(){var s=hl.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||Ar(a,null)}),i.forEach(function(a){r.has(a)||Ar(a,o)})}hl.set(n,e)},[e]),n}function Wy(e){return e}function Ky(e,t){t===void 0&&(t=Wy);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return r}function Yy(e){e===void 0&&(e={});var t=Ky(null);return t.options=it({async:!0,ssr:!1},e),t}var hu=function(e){var t=e.sideCar,n=fu(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return f.createElement(s,it({},n))};hu.isSideCarExport=!0;function Gy(e,t){return e.useMedium(t),hu}var mu=Yy(),Tr=function(){},zs=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Tr,onWheelCapture:Tr,onTouchMoveCapture:Tr}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,h=e.shards,m=e.sideCar,g=e.noRelative,x=e.noIsolation,p=e.inert,v=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,w=e.gapMode,S=fu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=m,T=Zy([n,t]),A=it(it({},S),r);return f.createElement(f.Fragment,null,u&&f.createElement(k,{sideCar:mu,removeScrollBar:d,shards:h,noRelative:g,noIsolation:x,inert:p,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(a),it(it({},A),{ref:T})):f.createElement(y,it({},A,{className:l,ref:T}),a))});zs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zs.classNames={fullWidth:Ss,zeroRight:ws};var Xy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qy(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Xy();return t&&e.setAttribute("nonce",t),e}function Jy(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Qy(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ev=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qy())&&(Jy(t,n),Qy(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tv=function(){var e=ev();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pu=function(){var e=tv(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},nv={left:0,top:0,right:0,gap:0},jr=function(e){return parseInt(e||"",10)||0},sv=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[jr(n),jr(s),jr(r)]},rv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nv;var t=sv(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},ov=pu(),hn="data-scroll-locked",iv=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
39
- .`.concat(By,` {
40
- overflow: hidden `).concat(s,`;
41
- padding-right: `).concat(a,"px ").concat(s,`;
75
+ `),()=>{h.contains(g)&&h.removeChild(g)}},[e]),m.jsx(RP,{isPresent:e,childRef:s,sizeRef:o,children:v.cloneElement(t,{ref:s})})}const IP=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o,anchorX:a,root:c})=>{const l=$u(MP),d=R.useId();let u=!0,f=R.useMemo(()=>(u=!1,{id:d,initial:e,isPresent:n,custom:r,onExitComplete:p=>{l.set(p,!0);for(const g of l.values())if(!g)return;i&&i()},register:p=>(l.set(p,!1),()=>l.delete(p))}),[n,l,i]);return s&&u&&(f={...f}),R.useMemo(()=>{l.forEach((p,g)=>l.set(g,!1))},[n]),v.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),o==="popLayout"&&(t=m.jsx(AP,{isPresent:n,anchorX:a,root:c,children:t})),m.jsx(Qa.Provider,{value:f,children:t})};function MP(){return new Map}function db(t=!0){const e=R.useContext(Qa);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=e,s=R.useId();R.useEffect(()=>{if(t)return r(s)},[t]);const o=R.useCallback(()=>t&&i&&i(s),[s,i,t]);return!n&&i?[!1,o]:[!0]}const Eo=t=>t.key||"";function Hm(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const Vr=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:o=!1,anchorX:a="left",root:c})=>{const[l,d]=db(o),u=R.useMemo(()=>Hm(t),[t]),f=o&&!l?[]:u.map(Eo),p=R.useRef(!0),g=R.useRef(u),h=$u(()=>new Map),[y,b]=R.useState(u),[w,C]=R.useState(u);by(()=>{p.current=!1,g.current=u;for(let T=0;T<w.length;T++){const E=Eo(w[T]);f.includes(E)?h.delete(E):h.get(E)!==!0&&h.set(E,!1)}},[w,f.length,f.join("-")]);const S=[];if(u!==y){let T=[...u];for(let E=0;E<w.length;E++){const P=w[E],_=Eo(P);f.includes(_)||(T.splice(E,0,P),S.push(P))}return s==="wait"&&S.length&&(T=S),C(Hm(T)),b(u),null}process.env.NODE_ENV!=="production"&&s==="wait"&&w.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:x}=R.useContext(Bu);return m.jsx(m.Fragment,{children:w.map(T=>{const E=Eo(T),P=o&&!l?!1:u===w||f.includes(E),_=()=>{if(h.has(E))h.set(E,!0);else return;let k=!0;h.forEach(I=>{I||(k=!1)}),k&&(x==null||x(),C(g.current),o&&(d==null||d()),i&&i())};return m.jsx(IP,{isPresent:P,initial:!p.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:c,onExitComplete:P?void 0:_,anchorX:a,children:T},E)})})},ub=R.createContext({strict:!1}),zm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Gr={};for(const t in zm)Gr[t]={isEnabled:e=>zm[t].some(n=>!!e[n])};function _P(t){for(const e in t)Gr[e]={...Gr[e],...t[e]}}const NP=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function _a(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||NP.has(t)}let fb=t=>!_a(t);function OP(t){typeof t=="function"&&(fb=e=>e.startsWith("on")?!_a(e):t(e))}try{OP(require("@emotion/is-prop-valid").default)}catch{}function DP(t,e,n){const i={};for(const r in t)r==="values"&&typeof t.values=="object"||(fb(r)||n===!0&&_a(r)||!e&&!_a(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}const ec=R.createContext({});function tc(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Gs(t){return typeof t=="string"||Array.isArray(t)}const hf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],mf=["initial",...hf];function nc(t){return tc(t.animate)||mf.some(e=>Gs(t[e]))}function hb(t){return!!(nc(t)||t.variants)}function jP(t,e){if(nc(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Gs(n)?n:void 0,animate:Gs(i)?i:void 0}}return t.inherit!==!1?e:{}}function LP(t){const{initial:e,animate:n}=jP(t,R.useContext(ec));return R.useMemo(()=>({initial:e,animate:n}),[Wm(e),Wm(n)])}function Wm(t){return Array.isArray(t)?t.join(" "):t}const Zs={};function VP(t){for(const e in t)Zs[e]=t[e],Ju(e)&&(Zs[e].isCSSVariable=!0)}function mb(t,{layout:e,layoutId:n}){return os.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Zs[t]||t==="opacity")}const FP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UP=ss.length;function BP(t,e,n){let i="",r=!0;for(let s=0;s<UP;s++){const o=ss[s],a=t[o];if(a===void 0)continue;let c=!0;if(typeof a=="number"?c=a===(o.startsWith("scale")?1:0):c=parseFloat(a)===0,!c||n){const l=rb(a,lf[o]);if(!c){r=!1;const d=FP[o]||o;i+=`${d}(${l}) `}n&&(e[o]=l)}}return i=i.trim(),n?i=n(e,r?"":i):r&&(i="none"),i}function pf(t,e,n){const{style:i,vars:r,transformOrigin:s}=t;let o=!1,a=!1;for(const c in e){const l=e[c];if(os.has(c)){o=!0;continue}else if(Ju(c)){r[c]=l;continue}else{const d=rb(l,lf[c]);c.startsWith("origin")?(a=!0,s[c]=d):i[c]=d}}if(e.transform||(o||n?i.transform=BP(e,t.transform,n):i.transform&&(i.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:d=0}=s;i.transformOrigin=`${c} ${l} ${d}`}}const gf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function pb(t,e,n){for(const i in e)!Tt(e[i])&&!mb(i,n)&&(t[i]=e[i])}function $P({transformTemplate:t},e){return R.useMemo(()=>{const n=gf();return pf(n,e,t),Object.assign({},n.vars,n.style)},[e])}function HP(t,e){const n=t.style||{},i={};return pb(i,n,t),Object.assign(i,$P(t,e)),i}function zP(t,e){const n={},i=HP(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const WP={offset:"stroke-dashoffset",array:"stroke-dasharray"},qP={offset:"strokeDashoffset",array:"strokeDasharray"};function KP(t,e,n=1,i=0,r=!0){t.pathLength=1;const s=r?WP:qP;t[s.offset]=he.transform(-i);const o=he.transform(e),a=he.transform(n);t[s.array]=`${o} ${a}`}function gb(t,{attrX:e,attrY:n,attrScale:i,pathLength:r,pathSpacing:s=1,pathOffset:o=0,...a},c,l,d){if(pf(t,a,l),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:u,style:f}=t;u.transform&&(f.transform=u.transform,delete u.transform),(f.transform||u.transformOrigin)&&(f.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete u.transformBox),e!==void 0&&(u.x=e),n!==void 0&&(u.y=n),i!==void 0&&(u.scale=i),r!==void 0&&KP(u,r,s,o,!1)}const vb=()=>({...gf(),attrs:{}}),yb=t=>typeof t=="string"&&t.toLowerCase()==="svg";function GP(t,e,n,i){const r=R.useMemo(()=>{const s=vb();return gb(s,e,yb(i),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};pb(s,t.style,t),r.style={...s,...r.style}}return r}const ZP=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function vf(t){return typeof t!="string"||t.includes("-")?!1:!!(ZP.indexOf(t)>-1||/[A-Z]/u.test(t))}function YP(t,e,n,{latestValues:i},r,s=!1){const a=(vf(t)?GP:zP)(e,i,r,t),c=DP(e,typeof t=="string",s),l=t!==R.Fragment?{...c,...a,ref:n}:{},{children:d}=e,u=R.useMemo(()=>Tt(d)?d.get():d,[d]);return R.createElement(t,{...l,children:u})}function qm(t){const e=[{},{}];return t==null||t.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function yf(t,e,n,i){if(typeof e=="function"){const[r,s]=qm(i);e=e(n!==void 0?n:t.custom,r,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,s]=qm(i);e=e(n!==void 0?n:t.custom,r,s)}return e}function ca(t){return Tt(t)?t.get():t}function JP({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,r){return{latestValues:XP(n,i,r,t),renderState:e()}}function XP(t,e,n,i){const r={},s=i(t,{});for(const f in s)r[f]=ca(s[f]);let{initial:o,animate:a}=t;const c=nc(t),l=hb(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const u=d?a:o;if(u&&typeof u!="boolean"&&!tc(u)){const f=Array.isArray(u)?u:[u];for(let p=0;p<f.length;p++){const g=yf(t,f[p]);if(g){const{transitionEnd:h,transition:y,...b}=g;for(const w in b){let C=b[w];if(Array.isArray(C)){const S=d?C.length-1:0;C=C[S]}C!==null&&(r[w]=C)}for(const w in h)r[w]=h[w]}}}return r}const bb=t=>(e,n)=>{const i=R.useContext(ec),r=R.useContext(Qa),s=()=>JP(t,e,i,r);return n?s():$u(s)};function bf(t,e,n){var s;const{style:i}=t,r={};for(const o in i)(Tt(i[o])||e.style&&Tt(e.style[o])||mb(o,t)||((s=n==null?void 0:n.getValue(o))==null?void 0:s.liveStyle)!==void 0)&&(r[o]=i[o]);return r}const QP=bb({scrapeMotionValuesFromProps:bf,createRenderState:gf});function xb(t,e,n){const i=bf(t,e,n);for(const r in t)if(Tt(t[r])||Tt(e[r])){const s=ss.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=t[r]}return i}const eR=bb({scrapeMotionValuesFromProps:xb,createRenderState:vb}),tR=Symbol.for("motionComponentSymbol");function Rr(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function nR(t,e,n){return R.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):Rr(n)&&(n.current=i))},[e])}const xf=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),iR="framerAppearId",Sb="data-"+xf(iR),wb=R.createContext({});function rR(t,e,n,i,r){var h,y;const{visualElement:s}=R.useContext(ec),o=R.useContext(ub),a=R.useContext(Qa),c=R.useContext(ff).reducedMotion,l=R.useRef(null);i=i||o.renderer,!l.current&&i&&(l.current=i(t,{visualState:e,parent:s,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:c}));const d=l.current,u=R.useContext(wb);d&&!d.projection&&r&&(d.type==="html"||d.type==="svg")&&sR(l.current,n,r,u);const f=R.useRef(!1);R.useInsertionEffect(()=>{d&&f.current&&d.update(n,a)});const p=n[Sb],g=R.useRef(!!p&&!((h=window.MotionHandoffIsComplete)!=null&&h.call(window,p))&&((y=window.MotionHasOptimisedAnimation)==null?void 0:y.call(window,p)));return by(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),g.current&&d.animationState&&d.animationState.animateChanges())}),R.useEffect(()=>{d&&(!g.current&&d.animationState&&d.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var b;(b=window.MotionHandoffMarkAsComplete)==null||b.call(window,p)}),g.current=!1),d.enteringChildren=void 0)}),d}function sR(t,e,n,i){const{layoutId:r,layout:s,drag:o,dragConstraints:a,layoutScroll:c,layoutRoot:l,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Cb(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&Rr(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:d,layoutScroll:c,layoutRoot:l})}function Cb(t){if(t)return t.options.allowProjection!==!1?t.projection:Cb(t.parent)}function rl(t,{forwardMotionProps:e=!1}={},n,i){n&&_P(n);const r=vf(t)?eR:QP;function s(a,c){let l;const d={...R.useContext(ff),...a,layoutId:oR(a)},{isStatic:u}=d,f=LP(a),p=r(a,u);if(!u&&Hu){aR(d,n);const g=cR(d);l=g.MeasureLayout,f.visualElement=rR(t,p,d,i,g.ProjectionNode)}return m.jsxs(ec.Provider,{value:f,children:[l&&f.visualElement?m.jsx(l,{visualElement:f.visualElement,...d}):null,YP(t,a,nR(p,f.visualElement,c),p,u,e)]})}s.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=R.forwardRef(s);return o[tR]=t,o}function oR({layoutId:t}){const e=R.useContext(Bu).id;return e&&t!==void 0?e+"-"+t:t}function aR(t,e){const n=R.useContext(ub).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const i="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?is(!1,i,"lazy-strict-mode"):Yn(!1,i,"lazy-strict-mode")}}function cR(t){const{drag:e,layout:n}=Gr;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function lR(t,e){if(typeof Proxy>"u")return rl;const n=new Map,i=(s,o)=>rl(s,o,t,e),r=(s,o)=>(process.env.NODE_ENV!=="production"&&Gu(!1,"motion() is deprecated. Use motion.create() instead."),i(s,o));return new Proxy(r,{get:(s,o)=>o==="create"?i:(n.has(o)||n.set(o,rl(o,void 0,t,e)),n.get(o))})}function kb({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function dR({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function uR(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function sl(t){return t===void 0||t===1}function Ld({scale:t,scaleX:e,scaleY:n}){return!sl(t)||!sl(e)||!sl(n)}function Vi(t){return Ld(t)||Tb(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Tb(t){return Km(t.x)||Km(t.y)}function Km(t){return t&&t!=="0%"}function Na(t,e,n){const i=t-n,r=e*i;return n+r}function Gm(t,e,n,i,r){return r!==void 0&&(t=Na(t,r,i)),Na(t,n,i)+e}function Vd(t,e=0,n=1,i,r){t.min=Gm(t.min,e,n,i,r),t.max=Gm(t.max,e,n,i,r)}function Eb(t,{x:e,y:n}){Vd(t.x,e.translate,e.scale,e.originPoint),Vd(t.y,n.translate,n.scale,n.originPoint)}const Zm=.999999999999,Ym=1.0000000000001;function fR(t,e,n,i=!1){const r=n.length;if(!r)return;e.x=e.y=1;let s,o;for(let a=0;a<r;a++){s=n[a],o=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(i&&s.options.layoutScroll&&s.scroll&&s!==s.root&&Ir(t,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Eb(t,o)),i&&Vi(s.latestValues)&&Ir(t,s.latestValues))}e.x<Ym&&e.x>Zm&&(e.x=1),e.y<Ym&&e.y>Zm&&(e.y=1)}function Ar(t,e){t.min=t.min+e,t.max=t.max+e}function Jm(t,e,n,i,r=.5){const s=Ge(t.min,t.max,r);Vd(t,e,n,s,i)}function Ir(t,e){Jm(t.x,e.x,e.scaleX,e.scale,e.originX),Jm(t.y,e.y,e.scaleY,e.scale,e.originY)}function Pb(t,e){return kb(uR(t.getBoundingClientRect(),e))}function hR(t,e,n){const i=Pb(t,n),{scroll:r}=e;return r&&(Ar(i.x,r.offset.x),Ar(i.y,r.offset.y)),i}const Xm=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mr=()=>({x:Xm(),y:Xm()}),Qm=()=>({min:0,max:0}),nt=()=>({x:Qm(),y:Qm()}),Fd={current:null},Rb={current:!1};function mR(){if(Rb.current=!0,!!Hu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Fd.current=t.matches;t.addEventListener("change",e),e()}else Fd.current=!1}const pR=new WeakMap;function gR(t,e,n){for(const i in e){const r=e[i],s=n[i];if(Tt(r))t.addValue(i,r);else if(Tt(s))t.addValue(i,Kr(r,{owner:t}));else if(s!==r)if(t.hasValue(i)){const o=t.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=t.getStaticValue(i);t.addValue(i,Kr(o!==void 0?o:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const ep=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class vR{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=af,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=Dt.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,We.render(this.render,!1,!0))};const{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=nc(n),this.isVariantNode=hb(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in u){const p=u[f];c[f]!==void 0&&Tt(p)&&p.set(c[f])}}mount(e){var n;this.current=e,pR.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,r)=>this.bindToMotionValue(r,i)),Rb.current||mR(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Fd.current,process.env.NODE_ENV!=="production"&&Gu(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),gi(this.notifyUpdate),gi(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const i=this.features[n];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=os.has(e);i&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&We.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),s&&s(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Gr){const n=Gr[e];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):nt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<ep.length;i++){const r=ep[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s="on"+r,o=e[s];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=gR(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=Kr(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(xy(i)||wy(i))?i=parseFloat(i):!PP(i)&&vi.test(n)&&(i=ib(e,n)),this.setBaseTarget(e,Tt(i)?i.get():i)),Tt(i)?i.get():i}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var s;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=yf(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Tt(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Ku),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){df.render(this.render)}}class Ab extends vR{constructor(){super(...arguments),this.KeyframeResolver=pP}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Tt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Ib(t,{style:e,vars:n},i,r){const s=t.style;let o;for(o in e)s[o]=e[o];r==null||r.applyProjectionStyles(s,i);for(o in n)s.setProperty(o,n[o])}function yR(t){return window.getComputedStyle(t)}class bR extends Ab{constructor(){super(...arguments),this.type="html",this.renderInstance=Ib}readValueFromInstance(e,n){var i;if(os.has(n))return(i=this.projection)!=null&&i.isProjecting?Id(n):NE(e,n);{const r=yR(e),s=(Ju(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Pb(e,n)}build(e,n,i){pf(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return bf(e,n,i)}}const Mb=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function xR(t,e,n,i){Ib(t,e,void 0,i);for(const r in e.attrs)t.setAttribute(Mb.has(r)?r:xf(r),e.attrs[r])}class SR extends Ab{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=nt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(os.has(n)){const i=nb(n);return i&&i.default||0}return n=Mb.has(n)?n:xf(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return xb(e,n,i)}build(e,n,i){gb(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,r){xR(e,n,i,r)}mount(e){this.isSVGTag=yb(e.tagName),super.mount(e)}}const wR=(t,e)=>vf(t)?new SR(e):new bR(e,{allowProjection:t!==R.Fragment});function Fr(t,e,n){const i=t.getProps();return yf(i,e,n!==void 0?n:i.custom,t)}const Ud=t=>Array.isArray(t);function CR(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Kr(n))}function kR(t){return Ud(t)?t[t.length-1]||0:t}function TR(t,e){const n=Fr(t,e);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const o in s){const a=kR(s[o]);CR(t,o,a)}}function ER(t){return!!(Tt(t)&&t.add)}function Bd(t,e){const n=t.getValue("willChange");if(ER(n))return n.add(e);if(!n&&Jn.WillChange){const i=new Jn.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function _b(t){return t.props[Sb]}const PR=t=>t!==null;function RR(t,{repeat:e,repeatType:n="loop"},i){const r=t.filter(PR),s=e&&n!=="loop"&&e%2===1?0:r.length-1;return r[s]}const AR={type:"spring",stiffness:500,damping:25,restSpeed:10},IR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),MR={type:"keyframes",duration:.8},_R={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},NR=(t,{keyframes:e})=>e.length>2?MR:os.has(t)?t.startsWith("scale")?IR(e[1]):AR:_R;function OR({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:o,repeatDelay:a,from:c,elapsed:l,...d}){return!!Object.keys(d).length}const Sf=(t,e,n,i={},r,s)=>o=>{const a=cf(i,t)||{},c=a.delay||i.delay||0;let{elapsed:l=0}=i;l=l-un(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:f=>{e.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:r};OR(a)||Object.assign(d,NR(t,d)),d.duration&&(d.duration=un(d.duration)),d.repeatDelay&&(d.repeatDelay=un(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let u=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Dd(d),d.delay===0&&(u=!0)),(Jn.instantAnimations||Jn.skipAnimations)&&(u=!0,Dd(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,u&&!s&&e.get()!==void 0){const f=RR(d.keyframes,a);if(f!==void 0){We.update(()=>{d.onUpdate(f),d.onComplete()});return}}return a.isSync?new of(d):new nP(d)};function DR({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function Nb(t,e,{delay:n=0,transitionOverride:i,type:r}={}){let{transition:s=t.getDefaultTransition(),transitionEnd:o,...a}=e;i&&(s=i);const c=[],l=r&&t.animationState&&t.animationState.getState()[r];for(const d in a){const u=t.getValue(d,t.latestValues[d]??null),f=a[d];if(f===void 0||l&&DR(l,d))continue;const p={delay:n,...cf(s||{},d)},g=u.get();if(g!==void 0&&!u.isAnimating&&!Array.isArray(f)&&f===g&&!p.velocity)continue;let h=!1;if(window.MotionHandoffAnimation){const b=_b(t);if(b){const w=window.MotionHandoffAnimation(b,d,We);w!==null&&(p.startTime=w,h=!0)}}Bd(t,d),u.start(Sf(d,u,f,t.shouldReduceMotion&&Qy.has(d)?{type:!1}:p,t,h));const y=u.animation;y&&c.push(y)}return o&&Promise.all(c).then(()=>{We.update(()=>{o&&TR(t,o)})}),c}function Ob(t,e,n,i=0,r=1){const s=Array.from(t).sort((l,d)=>l.sortNodePosition(d)).indexOf(e),o=t.size,a=(o-1)*i;return typeof n=="function"?n(s,o):r===1?s*i:a-s*i}function $d(t,e,n={}){var c;const i=Fr(t,e,n.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const s=i?()=>Promise.all(Nb(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:u,staggerDirection:f}=r;return jR(t,e,l,d,u,f,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[l,d]=a==="beforeChildren"?[s,o]:[o,s];return l().then(()=>d())}else return Promise.all([s(),o(n.delay)])}function jR(t,e,n=0,i=0,r=0,s=1,o){const a=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),a.push($d(c,e,{...o,delay:n+(typeof i=="function"?0:i)+Ob(t.variantChildren,c,i,r,s)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(a)}function LR(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>$d(t,s,n));i=Promise.all(r)}else if(typeof e=="string")i=$d(t,e,n);else{const r=typeof e=="function"?Fr(t,e,n.custom):e;i=Promise.all(Nb(t,r,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}function Db(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const VR=mf.length;function jb(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?jb(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<VR;n++){const i=mf[n],r=t.props[i];(Gs(r)||r===!1)&&(e[i]=r)}return e}const FR=[...hf].reverse(),UR=hf.length;function BR(t){return e=>Promise.all(e.map(({animation:n,options:i})=>LR(t,n,i)))}function $R(t){let e=BR(t),n=tp(),i=!0;const r=c=>(l,d)=>{var f;const u=Fr(t,d,c==="exit"?(f=t.presenceContext)==null?void 0:f.custom:void 0);if(u){const{transition:p,transitionEnd:g,...h}=u;l={...l,...h,...g}}return l};function s(c){e=c(t)}function o(c){const{props:l}=t,d=jb(t.parent)||{},u=[],f=new Set;let p={},g=1/0;for(let y=0;y<UR;y++){const b=FR[y],w=n[b],C=l[b]!==void 0?l[b]:d[b],S=Gs(C),x=b===c?w.isActive:null;x===!1&&(g=y);let T=C===d[b]&&C!==l[b]&&S;if(T&&i&&t.manuallyAnimateOnMount&&(T=!1),w.protectedKeys={...p},!w.isActive&&x===null||!C&&!w.prevProp||tc(C)||typeof C=="boolean")continue;const E=HR(w.prevProp,C);let P=E||b===c&&w.isActive&&!T&&S||y>g&&S,_=!1;const k=Array.isArray(C)?C:[C];let I=k.reduce(r(b),{});x===!1&&(I={});const{prevResolvedValues:N={}}=w,K={...N,...I},J=X=>{P=!0,f.has(X)&&(_=!0,f.delete(X)),w.needsAnimating[X]=!0;const O=t.getValue(X);O&&(O.liveStyle=!1)};for(const X in K){const O=I[X],oe=N[X];if(p.hasOwnProperty(X))continue;let L=!1;Ud(O)&&Ud(oe)?L=!Db(O,oe):L=O!==oe,L?O!=null?J(X):f.add(X):O!==void 0&&f.has(X)?J(X):w.protectedKeys[X]=!0}w.prevProp=C,w.prevResolvedValues=I,w.isActive&&(p={...p,...I}),i&&t.blockInitialAnimation&&(P=!1);const se=T&&E;P&&(!se||_)&&u.push(...k.map(X=>{const O={type:b};if(typeof X=="string"&&i&&!se&&t.manuallyAnimateOnMount&&t.parent){const{parent:oe}=t,L=Fr(oe,X);if(oe.enteringChildren&&L){const{delayChildren:F}=L.transition||{};O.delay=Ob(oe.enteringChildren,t,F)}}return{animation:X,options:O}}))}if(f.size){const y={};if(typeof l.initial!="boolean"){const b=Fr(t,Array.isArray(l.initial)?l.initial[0]:l.initial);b&&b.transition&&(y.transition=b.transition)}f.forEach(b=>{const w=t.getBaseTarget(b),C=t.getValue(b);C&&(C.liveStyle=!0),y[b]=w??null}),u.push({animation:y})}let h=!!u.length;return i&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(h=!1),i=!1,h?e(u):Promise.resolve()}function a(c,l){var u;if(n[c].isActive===l)return Promise.resolve();(u=t.variantChildren)==null||u.forEach(f=>{var p;return(p=f.animationState)==null?void 0:p.setActive(c,l)}),n[c].isActive=l;const d=o(c);for(const f in n)n[f].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=tp(),i=!0}}}function HR(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Db(e,t):!1}function Di(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function tp(){return{animate:Di(!0),whileInView:Di(),whileHover:Di(),whileTap:Di(),whileDrag:Di(),whileFocus:Di(),exit:Di()}}class Ei{constructor(e){this.isMounted=!1,this.node=e}update(){}}class zR extends Ei{constructor(e){super(e),e.animationState||(e.animationState=$R(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();tc(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let WR=0;class qR extends Ei{constructor(){super(...arguments),this.id=WR++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const KR={animation:{Feature:zR},exit:{Feature:qR}};function Ys(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function uo(t){return{point:{x:t.pageX,y:t.pageY}}}const GR=t=>e=>uf(e)&&t(e,uo(e));function Fs(t,e,n,i){return Ys(t,e,GR(n),i)}const Lb=1e-4,ZR=1-Lb,YR=1+Lb,Vb=.01,JR=0-Vb,XR=0+Vb;function Rt(t){return t.max-t.min}function QR(t,e,n){return Math.abs(t-e)<=n}function np(t,e,n,i=.5){t.origin=i,t.originPoint=Ge(e.min,e.max,t.origin),t.scale=Rt(n)/Rt(e),t.translate=Ge(n.min,n.max,t.origin)-t.originPoint,(t.scale>=ZR&&t.scale<=YR||isNaN(t.scale))&&(t.scale=1),(t.translate>=JR&&t.translate<=XR||isNaN(t.translate))&&(t.translate=0)}function Us(t,e,n,i){np(t.x,e.x,n.x,i?i.originX:void 0),np(t.y,e.y,n.y,i?i.originY:void 0)}function ip(t,e,n){t.min=n.min+e.min,t.max=t.min+Rt(e)}function eA(t,e,n){ip(t.x,e.x,n.x),ip(t.y,e.y,n.y)}function rp(t,e,n){t.min=e.min-n.min,t.max=t.min+Rt(e)}function Bs(t,e,n){rp(t.x,e.x,n.x),rp(t.y,e.y,n.y)}function Gt(t){return[t("x"),t("y")]}const Fb=({current:t})=>t?t.ownerDocument.defaultView:null,sp=(t,e)=>Math.abs(t-e);function tA(t,e){const n=sp(t.x,e.x),i=sp(t.y,e.y);return Math.sqrt(n**2+i**2)}class Ub{constructor(e,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=al(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=tA(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:h}=f,{timestamp:y}=vt;this.history.push({...h,timestamp:y});const{onStart:b,onMove:w}=this.handlers;p||(b&&b(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=ol(p,this.transformPagePoint),We.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:g,onSessionEnd:h,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=al(f.type==="pointercancel"?this.lastMoveEventInfo:ol(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,b),h&&h(f,b)},!uf(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=r||window;const a=uo(e),c=ol(a,this.transformPagePoint),{point:l}=c,{timestamp:d}=vt;this.history=[{...l,timestamp:d}];const{onSessionStart:u}=n;u&&u(e,al(c,this.history)),this.removeListeners=ao(Fs(this.contextWindow,"pointermove",this.handlePointerMove),Fs(this.contextWindow,"pointerup",this.handlePointerUp),Fs(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),gi(this.updatePoint)}}function ol(t,e){return e?{point:e(t.point)}:t}function op(t,e){return{x:t.x-e.x,y:t.y-e.y}}function al({point:t},e){return{point:t,delta:op(t,Bb(e)),offset:op(t,nA(e)),velocity:iA(e,.1)}}function nA(t){return t[0]}function Bb(t){return t[t.length-1]}function iA(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const r=Bb(t);for(;n>=0&&(i=t[n],!(r.timestamp-i.timestamp>un(e)));)n--;if(!i)return{x:0,y:0};const s=En(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function rA(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Ge(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Ge(n,t,i.max):Math.min(t,n)),t}function ap(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function sA(t,{top:e,left:n,bottom:i,right:r}){return{x:ap(t.x,n,r),y:ap(t.y,e,i)}}function cp(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function oA(t,e){return{x:cp(t.x,e.x),y:cp(t.y,e.y)}}function aA(t,e){let n=.5;const i=Rt(t),r=Rt(e);return r>i?n=Ws(e.min,e.max-i,t.min):i>r&&(n=Ws(t.min,t.max-r,e.min)),Zn(0,1,n)}function cA(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Hd=.35;function lA(t=Hd){return t===!1?t=0:t===!0&&(t=Hd),{x:lp(t,"left","right"),y:lp(t,"top","bottom")}}function lp(t,e,n){return{min:dp(t,e),max:dp(t,n)}}function dp(t,e){return typeof t=="number"?t:t[e]||0}const dA=new WeakMap;class uA{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=nt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=u=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(uo(u).point)},o=(u,f)=>{const{drag:p,dragPropagation:g,onDragStart:h}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=bP(p),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Gt(b=>{let w=this.getAxisMotionValue(b).get()||0;if(Pn.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const S=C.layout.layoutBox[b];S&&(w=Rt(S)*(parseFloat(w)/100))}}this.originPoint[b]=w}),h&&We.postRender(()=>h(u,f)),Bd(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(u,f)=>{this.latestPointerEvent=u,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:h,onDrag:y}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=f;if(g&&this.currentDirection===null){this.currentDirection=fA(b),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",f.point,b),this.updateAxis("y",f.point,b),this.visualElement.render(),y&&y(u,f)},c=(u,f)=>{this.latestPointerEvent=u,this.latestPanInfo=f,this.stop(u,f),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>Gt(u=>{var f;return this.getAnimationState(u)==="paused"&&((f=this.getAxisMotionValue(u).animation)==null?void 0:f.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new Ub(e,{onSessionStart:s,onStart:o,onMove:a,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:i,contextWindow:Fb(this.visualElement)})}stop(e,n){const i=e||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!i)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&We.postRender(()=>a(i,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:r}=this.getProps();if(!i||!Po(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=rA(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var s;const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,r=this.constraints;e&&Rr(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=sA(i.layoutBox,e):this.constraints=!1,this.elastic=lA(n),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Gt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=cA(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Rr(e))return!1;const i=e.current;Yn(i!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=hR(i,r.root,this.visualElement.getTransformPagePoint());let o=oA(r.layout.layoutBox,s);if(n){const a=n(dR(o));this.hasMutatedConstraints=!!a,a&&(o=kb(a))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=Gt(d=>{if(!Po(d,n,this.currentDirection))return;let u=c&&c[d]||{};o&&(u={min:0,max:0});const f=r?200:1e6,p=r?40:1e7,g={type:"inertia",velocity:i?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(d,g)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return Bd(this.visualElement,e),i.start(Sf(e,i,0,n,this.visualElement,!1))}stopAnimation(){Gt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Gt(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Gt(n=>{const{drag:i}=this.getProps();if(!Po(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[n];s.set(e[n]-Ge(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Rr(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Gt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const c=a.get();r[o]=aA({min:c,max:c},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Gt(o=>{if(!Po(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(Ge(c,l,r[o]))})}addListeners(){if(!this.visualElement.current)return;dA.set(this.visualElement,this);const e=this.visualElement.current,n=Fs(e,"pointerdown",c=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();Rr(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),We.read(i);const o=Ys(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(Gt(d=>{const u=this.getAxisMotionValue(d);u&&(this.originPoint[d]+=c[d].translate,u.set(u.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=Hd,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function Po(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function fA(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class hA extends Ei{constructor(e){super(e),this.removeGroupControls=Xt,this.removeListeners=Xt,this.controls=new uA(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xt}unmount(){this.removeGroupControls(),this.removeListeners()}}const up=t=>(e,n)=>{t&&We.postRender(()=>t(e,n))};class mA extends Ei{constructor(){super(...arguments),this.removePointerDownListener=Xt}onPointerDown(e){this.session=new Ub(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Fb(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:up(e),onStart:up(n),onMove:i,onEnd:(s,o)=>{delete this.session,r&&We.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=Fs(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const la={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function fp(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ts={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(he.test(t))t=parseFloat(t);else return t;const n=fp(t,e.target.x),i=fp(t,e.target.y);return`${n}% ${i}%`}},pA={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,r=vi.parse(t);if(r.length>5)return i;const s=vi.createTransformer(t),o=typeof r[0]!="number"?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;r[0+o]/=a,r[1+o]/=c;const l=Ge(a,c,.5);return typeof r[2+o]=="number"&&(r[2+o]/=l),typeof r[3+o]=="number"&&(r[3+o]/=l),s(r)}};let cl=!1;class gA extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;VP(vA),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),cl&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),la.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,{projection:o}=i;return o&&(o.isPresent=s,cl=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||We.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),df.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=e;cl=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function $b(t){const[e,n]=db(),i=R.useContext(Bu);return m.jsx(gA,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(wb),isPresent:e,safeToRemove:n})}const vA={borderRadius:{...Ts,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ts,borderTopRightRadius:Ts,borderBottomLeftRadius:Ts,borderBottomRightRadius:Ts,boxShadow:pA};function yA(t,e,n){const i=Tt(t)?t:Kr(t);return i.start(Sf("",i,e,n)),i.animation}const bA=(t,e)=>t.depth-e.depth;class xA{constructor(){this.children=[],this.isDirty=!1}add(e){zu(this.children,e),this.isDirty=!0}remove(e){Wu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(bA),this.isDirty=!1,this.children.forEach(e)}}function SA(t,e){const n=Dt.now(),i=({timestamp:r})=>{const s=r-n;s>=e&&(gi(i),t(s-e))};return We.setup(i,!0),()=>gi(i)}const Hb=["TopLeft","TopRight","BottomLeft","BottomRight"],wA=Hb.length,hp=t=>typeof t=="string"?parseFloat(t):t,mp=t=>typeof t=="number"||he.test(t);function CA(t,e,n,i,r,s){r?(t.opacity=Ge(0,n.opacity??1,kA(i)),t.opacityExit=Ge(e.opacity??1,0,TA(i))):s&&(t.opacity=Ge(e.opacity??1,n.opacity??1,i));for(let o=0;o<wA;o++){const a=`border${Hb[o]}Radius`;let c=pp(e,a),l=pp(n,a);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||mp(c)===mp(l)?(t[a]=Math.max(Ge(hp(c),hp(l),i),0),(Pn.test(l)||Pn.test(c))&&(t[a]+="%")):t[a]=l}(e.rotate||n.rotate)&&(t.rotate=Ge(e.rotate||0,n.rotate||0,i))}function pp(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const kA=zb(0,.5,Iy),TA=zb(.5,.95,Xt);function zb(t,e,n){return i=>i<t?0:i>e?1:n(Ws(t,e,i))}function gp(t,e){t.min=e.min,t.max=e.max}function Kt(t,e){gp(t.x,e.x),gp(t.y,e.y)}function vp(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function yp(t,e,n,i,r){return t-=e,t=Na(t,1/n,i),r!==void 0&&(t=Na(t,1/r,i)),t}function EA(t,e=0,n=1,i=.5,r,s=t,o=t){if(Pn.test(e)&&(e=parseFloat(e),e=Ge(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Ge(s.min,s.max,i);t===s&&(a-=e),t.min=yp(t.min,e,n,a,r),t.max=yp(t.max,e,n,a,r)}function bp(t,e,[n,i,r],s,o){EA(t,e[n],e[i],e[r],e.scale,s,o)}const PA=["x","scaleX","originX"],RA=["y","scaleY","originY"];function xp(t,e,n,i){bp(t.x,e,PA,n?n.x:void 0,i?i.x:void 0),bp(t.y,e,RA,n?n.y:void 0,i?i.y:void 0)}function Sp(t){return t.translate===0&&t.scale===1}function Wb(t){return Sp(t.x)&&Sp(t.y)}function wp(t,e){return t.min===e.min&&t.max===e.max}function AA(t,e){return wp(t.x,e.x)&&wp(t.y,e.y)}function Cp(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function qb(t,e){return Cp(t.x,e.x)&&Cp(t.y,e.y)}function kp(t){return Rt(t.x)/Rt(t.y)}function Tp(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class IA{constructor(){this.members=[]}add(e){zu(this.members,e),e.scheduleRender()}remove(e){if(Wu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(r=>e===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function MA(t,e,n){let i="";const r=t.x.translate/e.x,s=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((r||s||o)&&(i=`translate3d(${r}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:l,rotate:d,rotateX:u,rotateY:f,skewX:p,skewY:g}=n;l&&(i=`perspective(${l}px) ${i}`),d&&(i+=`rotate(${d}deg) `),u&&(i+=`rotateX(${u}deg) `),f&&(i+=`rotateY(${f}deg) `),p&&(i+=`skewX(${p}deg) `),g&&(i+=`skewY(${g}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return(a!==1||c!==1)&&(i+=`scale(${a}, ${c})`),i||"none"}const ll=["","X","Y","Z"],_A=1e3;let NA=0;function dl(t,e,n,i){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),i&&(i[t]=0))}function Kb(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=_b(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",We,!(r||s))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&Kb(i)}function Gb({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=NA++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(jA),this.nodes.forEach(UA),this.nodes.forEach(BA),this.nodes.forEach(LA)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new xA)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Ku),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const c=this.eventHandlers.get(o);c&&c.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=lb(o)&&!TP(o),this.instance=o;const{layoutId:a,layout:c,visualElement:l}=this.options;if(l&&!l.current&&l.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),t){let d,u=0;const f=()=>this.root.updateBlockedByResize=!1;We.read(()=>{u=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==u&&(u=p,this.root.updateBlockedByResize=!0,d&&d(),d=SA(f,250),la.hasAnimatedSinceResize&&(la.hasAnimatedSinceResize=!1,this.nodes.forEach(Rp)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&l&&(a||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:u,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||l.getDefaultTransition()||qA,{onLayoutAnimationStart:h,onLayoutAnimationComplete:y}=l.getProps(),b=!this.targetLayout||!qb(this.targetLayout,p),w=!u&&f;if(this.options.layoutRoot||this.resumeFrom||w||u&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...cf(g,"layout"),onPlay:h,onComplete:y};(l.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(d,w)}else u||Rp(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),gi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach($A),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Kb(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const u=this.path[d];u.shouldResetTransform=!0,u.updateScroll("snapshot"),u.options.layoutRoot&&u.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ep);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Pp);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(FA),this.nodes.forEach(OA),this.nodes.forEach(DA)):this.nodes.forEach(Pp),this.clearAllSnapshots();const a=Dt.now();vt.delta=Zn(0,1e3/60,a-vt.timestamp),vt.timestamp=a,vt.isProcessing=!0,Xc.update.process(vt),Xc.preRender.process(vt),Xc.render.process(vt),vt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,df.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(VA),this.sharedNodes.forEach(HA)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,We.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){We.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Rt(this.snapshot.measuredBox.x)&&!Rt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=nt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const c=i(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!Wb(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,d=l!==this.prevTransformTemplateValue;o&&this.instance&&(a||Vi(this.latestValues)||d)&&(r(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return o&&(c=this.removeTransform(c)),KA(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var l;const{visualElement:o}=this.options;if(!o)return nt();const a=o.measureViewportBox();if(!(((l=this.scroll)==null?void 0:l.wasRoot)||this.path.some(GA))){const{scroll:d}=this.root;d&&(Ar(a.x,d.offset.x),Ar(a.y,d.offset.y))}return a}removeElementScroll(o){var c;const a=nt();if(Kt(a,o),(c=this.scroll)!=null&&c.wasRoot)return a;for(let l=0;l<this.path.length;l++){const d=this.path[l],{scroll:u,options:f}=d;d!==this.root&&u&&f.layoutScroll&&(u.wasRoot&&Kt(a,o),Ar(a.x,u.offset.x),Ar(a.y,u.offset.y))}return a}applyTransform(o,a=!1){const c=nt();Kt(c,o);for(let l=0;l<this.path.length;l++){const d=this.path[l];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Ir(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Vi(d.latestValues)&&Ir(c,d.latestValues)}return Vi(this.latestValues)&&Ir(c,this.latestValues),c}removeTransform(o){const a=nt();Kt(a,o);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!Vi(l.latestValues))continue;Ld(l.latestValues)&&l.updateSnapshot();const d=nt(),u=l.measurePageBox();Kt(d,u),xp(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,d)}return Vi(this.latestValues)&&xp(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==vt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var f;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:u}=this.options;if(!(!this.layout||!(d||u))){if(this.resolvedRelativeTargetAt=vt.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=nt(),this.relativeTargetOrigin=nt(),Bs(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Kt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=nt(),this.targetWithTransforms=nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),eA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Kt(this.target,this.layout.layoutBox),Eb(this.target,this.targetDelta)):Kt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=nt(),this.relativeTargetOrigin=nt(),Bs(this.relativeTargetOrigin,this.target,p.target),Kt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Ld(this.parent.latestValues)||Tb(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var g;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===vt.timestamp&&(c=!1),c)return;const{layout:l,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||d))return;Kt(this.layoutCorrected,this.layout.layoutBox);const u=this.treeScale.x,f=this.treeScale.y;fR(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=nt());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(vp(this.prevProjectionDelta.x,this.projectionDelta.x),vp(this.prevProjectionDelta.y,this.projectionDelta.y)),Us(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==u||this.treeScale.y!==f||!Tp(this.projectionDelta.x,this.prevProjectionDelta.x)||!Tp(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Mr(),this.projectionDelta=Mr(),this.projectionDeltaWithTransform=Mr()}setAnimationOrigin(o,a=!1){const c=this.snapshot,l=c?c.latestValues:{},d={...this.latestValues},u=Mr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=nt(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,h=p!==g,y=this.getStack(),b=!y||y.members.length<=1,w=!!(h&&!b&&this.options.crossfade===!0&&!this.path.some(WA));this.animationProgress=0;let C;this.mixTargetDelta=S=>{const x=S/1e3;Ap(u.x,o.x,x),Ap(u.y,o.y,x),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Bs(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),zA(this.relativeTarget,this.relativeTargetOrigin,f,x),C&&AA(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=nt()),Kt(C,this.relativeTarget)),h&&(this.animationValues=d,CA(d,l,this.latestValues,x,w,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=x},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,c,l;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(l=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||l.stop(),this.pendingAnimation&&(gi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=We.update(()=>{la.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Kr(0)),this.currentAnimation=yA(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(_A),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:d}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Zb(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||nt();const u=Rt(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+u;const f=Rt(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}Kt(a,c),Ir(a,d),Us(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new IA),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&dl("z",o,l,this.animationValues);for(let d=0;d<ll.length;d++)dl(`rotate${ll[d]}`,o,l,this.animationValues),dl(`skew${ll[d]}`,o,l,this.animationValues);o.render();for(const d in l)o.setStaticValue(d,l[d]),this.animationValues&&(this.animationValues[d]=l[d]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=ca(a==null?void 0:a.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=ca(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Vi(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=l.animationValues||l.latestValues;this.applyTransformsToTarget();let u=MA(this.projectionDeltaWithTransform,this.treeScale,d);c&&(u=c(d,u)),o.transform=u;const{x:f,y:p}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,l.animationValues?o.opacity=l===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=l===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in Zs){if(d[g]===void 0)continue;const{correct:h,applyTo:y,isCSSVariable:b}=Zs[g],w=u==="none"?d[g]:h(d[g],l);if(y){const C=y.length;for(let S=0;S<C;S++)o[y[S]]=w}else b?this.options.visualElement.renderState.vars[g]=w:o[g]=w}this.options.layoutId&&(o.pointerEvents=l===this?ca(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(Ep),this.root.sharedNodes.clear()}}}function OA(t){t.updateLayout()}function DA(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=t.layout,{animationType:s}=t.options,o=e.source!==t.layout.source;s==="size"?Gt(u=>{const f=o?e.measuredBox[u]:e.layoutBox[u],p=Rt(f);f.min=i[u].min,f.max=f.min+p}):Zb(s,e.layoutBox,i)&&Gt(u=>{const f=o?e.measuredBox[u]:e.layoutBox[u],p=Rt(i[u]);f.max=f.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+p)});const a=Mr();Us(a,i,e.layoutBox);const c=Mr();o?Us(c,t.applyTransform(r,!0),e.measuredBox):Us(c,i,e.layoutBox);const l=!Wb(a);let d=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:f,layout:p}=u;if(f&&p){const g=nt();Bs(g,e.layoutBox,f.layoutBox);const h=nt();Bs(h,i,p.layoutBox),qb(g,h)||(d=!0),u.options.layoutRoot&&(t.relativeTarget=h,t.relativeTargetOrigin=g,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function jA(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function LA(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function VA(t){t.clearSnapshot()}function Ep(t){t.clearMeasurements()}function Pp(t){t.isLayoutDirty=!1}function FA(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Rp(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function UA(t){t.resolveTargetDelta()}function BA(t){t.calcProjection()}function $A(t){t.resetSkewAndRotation()}function HA(t){t.removeLeadSnapshot()}function Ap(t,e,n){t.translate=Ge(e.translate,0,n),t.scale=Ge(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Ip(t,e,n,i){t.min=Ge(e.min,n.min,i),t.max=Ge(e.max,n.max,i)}function zA(t,e,n,i){Ip(t.x,e.x,n.x,i),Ip(t.y,e.y,n.y,i)}function WA(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const qA={duration:.45,ease:[.4,0,.1,1]},Mp=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),_p=Mp("applewebkit/")&&!Mp("chrome/")?Math.round:Xt;function Np(t){t.min=_p(t.min),t.max=_p(t.max)}function KA(t){Np(t.x),Np(t.y)}function Zb(t,e,n){return t==="position"||t==="preserve-aspect"&&!QR(kp(e),kp(n),.2)}function GA(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const ZA=Gb({attachResizeListener:(t,e)=>Ys(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ul={current:void 0},Yb=Gb({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ul.current){const t=new ZA({});t.mount(window),t.setOptions({layoutScroll:!0}),ul.current=t}return ul.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),YA={pan:{Feature:mA},drag:{Feature:hA,ProjectionNode:Yb,MeasureLayout:$b}};function Op(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&We.postRender(()=>s(e,uo(e)))}class JA extends Ei{mount(){const{current:e}=this.node;e&&(this.unmount=xP(e,(n,i)=>(Op(this.node,i,"Start"),r=>Op(this.node,r,"End"))))}unmount(){}}class XA extends Ei{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ao(Ys(this.node.current,"focus",()=>this.onFocus()),Ys(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Dp(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&We.postRender(()=>s(e,uo(e)))}class QA extends Ei{mount(){const{current:e}=this.node;e&&(this.unmount=kP(e,(n,i)=>(Dp(this.node,i,"Start"),(r,{success:s})=>Dp(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const zd=new WeakMap,fl=new WeakMap,eI=t=>{const e=zd.get(t.target);e&&e(t)},tI=t=>{t.forEach(eI)};function nI({root:t,...e}){const n=t||document;fl.has(n)||fl.set(n,{});const i=fl.get(n),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(tI,{root:t,...e})),i[r]}function iI(t,e,n){const i=nI(e);return zd.set(t,n),i.observe(t),()=>{zd.delete(t),i.unobserve(t)}}const rI={some:0,all:1};class sI extends Ei{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=e,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:rI[r]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:u}=this.node.getProps(),f=l?d:u;f&&f(c)};return iI(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(oI(e,n))&&this.startObserver()}unmount(){}}function oI({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const aI={inView:{Feature:sI},tap:{Feature:QA},focus:{Feature:XA},hover:{Feature:JA}},cI={layout:{ProjectionNode:Yb,MeasureLayout:$b}},lI={...KR,...aI,...YA,...cI},xe=lR(lI,wR);var Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Wd={exports:{}},dI=Wd.exports,jp;function uI(){return jp||(jp=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(dI,function(){var e=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(h,y){var b=h[y];if(typeof b.bind=="function")return b.bind(h);try{return Function.prototype.bind.call(b,h)}catch{return function(){return Function.prototype.apply.apply(b,[h,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(h){return h==="debug"&&(h="log"),typeof console===n?!1:h==="trace"&&i?c:console[h]!==void 0?a(console,h):console.log!==void 0?a(console,"log"):e}function d(){for(var h=this.getLevel(),y=0;y<r.length;y++){var b=r[y];this[b]=y<h?e:this.methodFactory(b,h,this.name)}if(this.log=this.debug,typeof console===n&&h<this.levels.SILENT)return"No console available for logging"}function u(h){return function(){typeof console!==n&&(d.call(this),this[h].apply(this,arguments))}}function f(h,y,b){return l(h)||u.apply(this,arguments)}function p(h,y){var b=this,w,C,S,x="loglevel";typeof h=="string"?x+=":"+h:typeof h=="symbol"&&(x=void 0);function T(I){var N=(r[I]||"silent").toUpperCase();if(!(typeof window===n||!x)){try{window.localStorage[x]=N;return}catch{}try{window.document.cookie=encodeURIComponent(x)+"="+N+";"}catch{}}}function E(){var I;if(!(typeof window===n||!x)){try{I=window.localStorage[x]}catch{}if(typeof I===n)try{var N=window.document.cookie,K=encodeURIComponent(x),J=N.indexOf(K+"=");J!==-1&&(I=/^([^;]+)/.exec(N.slice(J+K.length+1))[1])}catch{}return b.levels[I]===void 0&&(I=void 0),I}}function P(){if(!(typeof window===n||!x)){try{window.localStorage.removeItem(x)}catch{}try{window.document.cookie=encodeURIComponent(x)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function _(I){var N=I;if(typeof N=="string"&&b.levels[N.toUpperCase()]!==void 0&&(N=b.levels[N.toUpperCase()]),typeof N=="number"&&N>=0&&N<=b.levels.SILENT)return N;throw new TypeError("log.setLevel() called with invalid level: "+I)}b.name=h,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=y||f,b.getLevel=function(){return S??C??w},b.setLevel=function(I,N){return S=_(I),N!==!1&&T(S),d.call(b)},b.setDefaultLevel=function(I){C=_(I),E()||b.setLevel(I,!1)},b.resetLevel=function(){S=null,P(),d.call(b)},b.enableAll=function(I){b.setLevel(b.levels.TRACE,I)},b.disableAll=function(I){b.setLevel(b.levels.SILENT,I)},b.rebuild=function(){if(o!==b&&(w=_(o.getLevel())),d.call(b),o===b)for(var I in s)s[I].rebuild()},w=_(o?o.getLevel():"WARN");var k=E();k!=null&&(S=_(k)),d.call(b)}o=new p,o.getLogger=function(h){if(typeof h!="symbol"&&typeof h!="string"||h==="")throw new TypeError("You must supply a name when creating a logger.");var y=s[h];return y||(y=s[h]=new p(h,o.methodFactory)),y};var g=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=g),o},o.getLoggers=function(){return s},o.default=o,o})}(Wd)),Wd.exports}var fI=uI();const hI=Jb(fI);var qd=function(t,e){return qd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])},qd(t,e)};function ti(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");qd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function mI(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{l(i.next(d))}catch(u){o(u)}}function c(d){try{l(i.throw(d))}catch(u){o(u)}}function l(d){d.done?s(d.value):r(d.value).then(a,c)}l((i=i.apply(t,[])).next())})}function Xb(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return c([l,d])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(n=0)),n;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,r=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}s[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(d){l=[6,d],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Zr(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Js(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function Xs(t,e,n){if(arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function Ur(t){return this instanceof Ur?(this.v=t,this):new Ur(t)}function pI(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),r,s=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),r[Symbol.asyncIterator]=function(){return this},r;function o(p){return function(g){return Promise.resolve(g).then(p,u)}}function a(p,g){i[p]&&(r[p]=function(h){return new Promise(function(y,b){s.push([p,h,y,b])>1||c(p,h)})},g&&(r[p]=g(r[p])))}function c(p,g){try{l(i[p](g))}catch(h){f(s[0][3],h)}}function l(p){p.value instanceof Ur?Promise.resolve(p.value.v).then(d,u):f(s[0][2],p)}function d(p){c("next",p)}function u(p){c("throw",p)}function f(p,g){p(g),s.shift(),s.length&&c(s[0][0],s[0][1])}}function gI(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Zr=="function"?Zr(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),r(a,c,o.done,o.value)})}}function r(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}function ut(t){return typeof t=="function"}function wf(t){var e=function(i){Error.call(i),i.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var hl=wf(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
76
+ `+e.map(function(n,i){return i+1+") "+n.toString()}).join(`
77
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function Oa(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var fo=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,i,r,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Zr(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(ut(d))try{d()}catch(h){s=h instanceof hl?h.errors:[h]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var f=Zr(u),p=f.next();!p.done;p=f.next()){var g=p.value;try{Lp(g)}catch(h){s=s??[],h instanceof hl?s=Xs(Xs([],Js(s)),Js(h.errors)):s.push(h)}}}catch(h){i={error:h}}finally{try{p&&!p.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}}if(s)throw new hl(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Lp(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Oa(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Oa(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Qb=fo.EMPTY;function e1(t){return t instanceof fo||t&&"closed"in t&&ut(t.remove)&&ut(t.add)&&ut(t.unsubscribe)}function Lp(t){ut(t)?t():t.unsubscribe()}var vI={Promise:void 0},yI={setTimeout:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,Xs([t,e],Js(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function t1(t){yI.setTimeout(function(){throw t})}function Kd(){}function da(t){t()}var Cf=function(t){ti(e,t);function e(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,e1(n)&&n.add(i)):i.destination=SI,i}return e.create=function(n,i,r){return new Qs(n,i,r)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(fo),bI=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(i){Ao(i)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(i){Ao(i)}else Ao(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Ao(n)}},t}(),Qs=function(t){ti(e,t);function e(n,i,r){var s=t.call(this)||this,o;return ut(n)||!n?o={next:n??void 0,error:i??void 0,complete:r??void 0}:o=n,s.destination=new bI(o),s}return e}(Cf);function Ao(t){t1(t)}function xI(t){throw t}var SI={closed:!0,next:Kd,error:xI,complete:Kd},kf=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Tf(t){return t}function wI(t){return t.length===0?Tf:t.length===1?t[0]:function(e){return t.reduce(function(n,i){return i(n)},e)}}var mt=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,i){var r=this,s=kI(e)?e:new Qs(e,n,i);return da(function(){var o=r,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?r._subscribe(s):r._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var i=this;return n=Vp(n),new n(function(r,s){var o=new Qs({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:r});i.subscribe(o)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[kf]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return wI(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Vp(e),new e(function(i,r){var s;n.subscribe(function(o){return s=o},function(o){return r(o)},function(){return i(s)})})},t.create=function(e){return new t(e)},t}();function Vp(t){var e;return(e=t??vI.Promise)!==null&&e!==void 0?e:Promise}function CI(t){return t&&ut(t.next)&&ut(t.error)&&ut(t.complete)}function kI(t){return t&&t instanceof Cf||CI(t)&&e1(t)}function TI(t){return ut(t==null?void 0:t.lift)}function On(t){return function(e){if(TI(e))return e.lift(function(n){try{return t(n,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}function yi(t,e,n,i,r){return new EI(t,e,n,i,r)}var EI=function(t){ti(e,t);function e(n,i,r,s,o,a){var c=t.call(this,n)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=i?function(l){try{i(l)}catch(d){n.error(d)}}:t.prototype._next,c._error=s?function(l){try{s(l)}catch(d){n.error(d)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=r?function(){try{r()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;t.prototype.unsubscribe.call(this),!i&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Cf),PI=wf(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Yr=function(t){ti(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var i=new Fp(this,this);return i.operator=n,i},e.prototype._throwIfClosed=function(){if(this.closed)throw new PI},e.prototype.next=function(n){var i=this;da(function(){var r,s;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var o=Zr(i.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(n)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}}})},e.prototype.error=function(n){var i=this;da(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var r=i.observers;r.length;)r.shift().error(n)}})},e.prototype.complete=function(){var n=this;da(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var i=this,r=this,s=r.hasError,o=r.isStopped,a=r.observers;return s||o?Qb:(this.currentObservers=null,a.push(n),new fo(function(){i.currentObservers=null,Oa(a,n)}))},e.prototype._checkFinalizedStatuses=function(n){var i=this,r=i.hasError,s=i.thrownError,o=i.isStopped;r?n.error(s):o&&n.complete()},e.prototype.asObservable=function(){var n=new mt;return n.source=this,n},e.create=function(n,i){return new Fp(n,i)},e}(mt),Fp=function(t){ti(e,t);function e(n,i){var r=t.call(this)||this;return r.destination=n,r.source=i,r}return e.prototype.next=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.next)===null||r===void 0||r.call(i,n)},e.prototype.error=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.error)===null||r===void 0||r.call(i,n)},e.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},e.prototype._subscribe=function(n){var i,r;return(r=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&r!==void 0?r:Qb},e}(Yr),RI=function(t){ti(e,t);function e(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},e.prototype.getValue=function(){var n=this,i=n.hasError,r=n.thrownError,s=n._value;if(i)throw r;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(Yr),AI={now:function(){return Date.now()}},II=function(t){ti(e,t);function e(n,i){return t.call(this)||this}return e.prototype.schedule=function(n,i){return this},e}(fo),Up={setInterval:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setInterval.apply(void 0,Xs([t,e],Js(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},MI=function(t){ti(e,t);function e(n,i){var r=t.call(this,n,i)||this;return r.scheduler=n,r.work=i,r.pending=!1,r}return e.prototype.schedule=function(n,i){var r;if(i===void 0&&(i=0),this.closed)return this;this.state=n;var s=this.id,o=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(o,s,i)),this.pending=!0,this.delay=i,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(o,this.id,i),this},e.prototype.requestAsyncId=function(n,i,r){return r===void 0&&(r=0),Up.setInterval(n.flush.bind(n,this),r)},e.prototype.recycleAsyncId=function(n,i,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return i;i!=null&&Up.clearInterval(i)},e.prototype.execute=function(n,i){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,i);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,i){var r=!1,s;try{this.work(n)}catch(o){r=!0,s=o||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,i=n.id,r=n.scheduler,s=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Oa(s,this),i!=null&&(this.id=this.recycleAsyncId(r,i,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(II),Bp=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,i){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(i,n)},t.now=AI.now,t}(),_I=function(t){ti(e,t);function e(n,i){i===void 0&&(i=Bp.now);var r=t.call(this,n,i)||this;return r.actions=[],r._active=!1,r}return e.prototype.flush=function(n){var i=this.actions;if(this._active){i.push(n);return}var r;this._active=!0;do if(r=n.execute(n.state,n.delay))break;while(n=i.shift());if(this._active=!1,r){for(;n=i.shift();)n.unsubscribe();throw r}},e}(Bp);new _I(MI);function NI(t){return t&&ut(t.schedule)}function OI(t){return t[t.length-1]}function n1(t){return NI(OI(t))?t.pop():void 0}var i1=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function r1(t){return ut(t==null?void 0:t.then)}function s1(t){return ut(t[kf])}function o1(t){return Symbol.asyncIterator&&ut(t==null?void 0:t[Symbol.asyncIterator])}function a1(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function DI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var c1=DI();function l1(t){return ut(t==null?void 0:t[c1])}function d1(t){return pI(this,arguments,function(){var e,n,i,r;return Xb(this,function(s){switch(s.label){case 0:e=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ur(e.read())];case 3:return n=s.sent(),i=n.value,r=n.done,r?[4,Ur(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ur(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function u1(t){return ut(t==null?void 0:t.getReader)}function Pi(t){if(t instanceof mt)return t;if(t!=null){if(s1(t))return jI(t);if(i1(t))return LI(t);if(r1(t))return VI(t);if(o1(t))return f1(t);if(l1(t))return FI(t);if(u1(t))return UI(t)}throw a1(t)}function jI(t){return new mt(function(e){var n=t[kf]();if(ut(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function LI(t){return new mt(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function VI(t){return new mt(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,t1)})}function FI(t){return new mt(function(e){var n,i;try{for(var r=Zr(t),s=r.next();!s.done;s=r.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}e.complete()})}function f1(t){return new mt(function(e){BI(t,e).catch(function(n){return e.error(n)})})}function UI(t){return f1(d1(t))}function BI(t,e){var n,i,r,s;return mI(this,void 0,void 0,function(){var o,a;return Xb(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=gI(t),c.label=1;case 1:return[4,n.next()];case 2:if(i=c.sent(),!!i.done)return[3,4];if(o=i.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),r={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),i&&!i.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function qi(t,e,n,i,r){i===void 0&&(i=0),r===void 0&&(r=!1);var s=e.schedule(function(){n(),r?t.add(this.schedule(null,i)):this.unsubscribe()},i);if(t.add(s),!r)return s}function h1(t,e){return e===void 0&&(e=0),On(function(n,i){n.subscribe(yi(i,function(r){return qi(i,t,function(){return i.next(r)},e)},function(){return qi(i,t,function(){return i.complete()},e)},function(r){return qi(i,t,function(){return i.error(r)},e)}))})}function m1(t,e){return e===void 0&&(e=0),On(function(n,i){i.add(t.schedule(function(){return n.subscribe(i)},e))})}function $I(t,e){return Pi(t).pipe(m1(e),h1(e))}function HI(t,e){return Pi(t).pipe(m1(e),h1(e))}function zI(t,e){return new mt(function(n){var i=0;return e.schedule(function(){i===t.length?n.complete():(n.next(t[i++]),n.closed||this.schedule())})})}function WI(t,e){return new mt(function(n){var i;return qi(n,e,function(){i=t[c1](),qi(n,e,function(){var r,s,o;try{r=i.next(),s=r.value,o=r.done}catch(a){n.error(a);return}o?n.complete():n.next(s)},0,!0)}),function(){return ut(i==null?void 0:i.return)&&i.return()}})}function p1(t,e){if(!t)throw new Error("Iterable cannot be null");return new mt(function(n){qi(n,e,function(){var i=t[Symbol.asyncIterator]();qi(n,e,function(){i.next().then(function(r){r.done?n.complete():n.next(r.value)})},0,!0)})})}function qI(t,e){return p1(d1(t),e)}function KI(t,e){if(t!=null){if(s1(t))return $I(t,e);if(i1(t))return zI(t,e);if(r1(t))return HI(t,e);if(o1(t))return p1(t,e);if(l1(t))return WI(t,e);if(u1(t))return qI(t,e)}throw a1(t)}function Ef(t,e){return e?KI(t,e):Pi(t)}wf(function(t){return function(e){e===void 0&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}});function Qt(t,e){return On(function(n,i){var r=0;n.subscribe(yi(i,function(s){i.next(t.call(e,s,r++))}))})}function GI(t,e,n,i,r,s,o,a){var c=[],l=0,d=0,u=!1,f=function(){u&&!c.length&&!l&&e.complete()},p=function(h){return l<i?g(h):c.push(h)},g=function(h){l++;var y=!1;Pi(n(h,d++)).subscribe(yi(e,function(b){e.next(b)},function(){y=!0},void 0,function(){if(y)try{l--;for(var b=function(){var w=c.shift();o||g(w)};c.length&&l<i;)b();f()}catch(w){e.error(w)}}))};return t.subscribe(yi(e,p,function(){u=!0,f()})),function(){}}function g1(t,e,n){return n===void 0&&(n=1/0),ut(e)?g1(function(i,r){return Qt(function(s,o){return e(i,s,r,o)})(Pi(t(i,r)))},n):(typeof e=="number"&&(n=e),On(function(i,r){return GI(i,r,t,n)}))}function ZI(t){return g1(Tf,t)}function YI(){return ZI(1)}function $p(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return YI()(Ef(t,n1(t)))}function v1(t,e){return On(function(n,i){var r=0;n.subscribe(yi(i,function(s){return t.call(e,s,r++)&&i.next(s)}))})}function JI(t,e,n,i,r){return function(s,o){var a=n,c=e,l=0;s.subscribe(yi(o,function(d){var u=l++;c=a?t(c,d,u):(a=!0,d),o.next(c)},r))}}function Gd(t,e){return On(JI(t,e,arguments.length>=2,!0))}function XI(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new Yr}:e,i=t.resetOnError,r=i===void 0?!0:i,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(l){var d,u,f,p=0,g=!1,h=!1,y=function(){u==null||u.unsubscribe(),u=void 0},b=function(){y(),d=f=void 0,g=h=!1},w=function(){var C=d;b(),C==null||C.unsubscribe()};return On(function(C,S){p++,!h&&!g&&y();var x=f=f??n();S.add(function(){p--,p===0&&!h&&!g&&(u=ml(w,c))}),x.subscribe(S),!d&&p>0&&(d=new Qs({next:function(T){return x.next(T)},error:function(T){h=!0,y(),u=ml(b,r,T),x.error(T)},complete:function(){g=!0,y(),u=ml(b,o),x.complete()}}),Pi(C).subscribe(d))})(l)}}function ml(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(e===!0){t();return}if(e!==!1){var r=new Qs({next:function(){r.unsubscribe(),t()}});return Pi(e.apply(void 0,Xs([],Js(n)))).subscribe(r)}}function Ri(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=n1(t);return On(function(i,r){(n?$p(t,i,n):$p(t,i)).subscribe(r)})}function Hp(t){return On(function(e,n){Pi(t).subscribe(yi(n,function(){return n.complete()},Kd)),!n.closed&&e.subscribe(n)})}function QI(t,e,n){var i=ut(t)||e||n?{next:t,error:e,complete:n}:t;return i?On(function(r,s){var o;(o=i.subscribe)===null||o===void 0||o.call(i);var a=!0;r.subscribe(yi(s,function(c){var l;(l=i.next)===null||l===void 0||l.call(i,c),s.next(c)},function(){var c;a=!1,(c=i.complete)===null||c===void 0||c.call(i),s.complete()},function(c){var l;a=!1,(l=i.error)===null||l===void 0||l.call(i,c),s.error(c)},function(){var c,l;a&&((c=i.unsubscribe)===null||c===void 0||c.call(i)),(l=i.finalize)===null||l===void 0||l.call(i)}))}):Tf}var eM=Object.defineProperty,tM=Object.defineProperties,nM=Object.getOwnPropertyDescriptors,zp=Object.getOwnPropertySymbols,iM=Object.prototype.hasOwnProperty,rM=Object.prototype.propertyIsEnumerable,Wp=(t,e,n)=>e in t?eM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,li=(t,e)=>{for(var n in e||(e={}))iM.call(e,n)&&Wp(t,n,e[n]);if(zp)for(var n of zp(e))rM.call(e,n)&&Wp(t,n,e[n]);return t},Fi=(t,e)=>tM(t,nM(e)),Jr=(t,e,n)=>new Promise((i,r)=>{var s=c=>{try{a(n.next(c))}catch(l){r(l)}},o=c=>{try{a(n.throw(c))}catch(l){r(l)}},a=c=>c.done?i(c.value):Promise.resolve(c.value).then(s,o);a((n=n.apply(t,e)).next())}),sM="lk";function Pf(t){return typeof t>"u"?!1:oM(t)||aM(t)}function oM(t){var e;return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("track")&&typeof((e=t.publication)==null?void 0:e.track)<"u":!1}function aM(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("publication")&&typeof t.publication<"u":!1}function cM(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&typeof t.publication>"u":!1}function y1(t){if(typeof t=="string"||typeof t=="number")return`${t}`;if(cM(t))return`${t.participant.identity}_${t.source}_placeholder`;if(Pf(t))return`${t.participant.identity}_${t.publication.source}_${t.publication.trackSid}`;throw new Error(`Can't generate a id for the given track reference: ${t}`)}var lM=[U.ConnectionStateChanged,U.RoomMetadataChanged,U.ActiveSpeakersChanged,U.ConnectionQualityChanged,U.ParticipantConnected,U.ParticipantDisconnected,U.ParticipantPermissionsChanged,U.ParticipantMetadataChanged,U.ParticipantNameChanged,U.ParticipantAttributesChanged,U.TrackMuted,U.TrackUnmuted,U.TrackPublished,U.TrackUnpublished,U.TrackStreamStateChanged,U.TrackSubscriptionFailed,U.TrackSubscriptionPermissionChanged,U.TrackSubscriptionStatusChanged],b1=[...lM,U.LocalTrackPublished,U.LocalTrackUnpublished],dM=[Z.TrackPublished,Z.TrackUnpublished,Z.TrackMuted,Z.TrackUnmuted,Z.TrackStreamStateChanged,Z.TrackSubscribed,Z.TrackUnsubscribed,Z.TrackSubscriptionPermissionChanged,Z.TrackSubscriptionFailed,Z.LocalTrackPublished,Z.LocalTrackUnpublished],uM=[Z.ConnectionQualityChanged,Z.IsSpeakingChanged,Z.ParticipantMetadataChanged,Z.ParticipantPermissionsChanged,Z.TrackMuted,Z.TrackUnmuted,Z.TrackPublished,Z.TrackUnpublished,Z.TrackStreamStateChanged,Z.TrackSubscriptionFailed,Z.TrackSubscriptionPermissionChanged,Z.TrackSubscriptionStatusChanged];[...uM,Z.LocalTrackPublished,Z.LocalTrackUnpublished];var Mn=hI.getLogger("lk-components-js");Mn.setDefaultLevel("WARN");function fM(t,e){var n;return Fi(li({},t),{receivedAtMediaTimestamp:(n=e.rtpTimestamp)!=null?n:0,receivedAt:e.timestamp})}function hM(t,e,n){return[...t,...e].reduceRight((i,r)=>(i.find(s=>s.id===r.id)||i.unshift(r),i),[]).slice(0-n)}function x1(t){return typeof t=="object"}function S1(t){return Array.isArray(t)&&t.filter(x1).length>0}function w1(t){return`${sM}-${t}`}function mM(t){const e=Zd(t),n=T1(t.participant).pipe(Qt(()=>Zd(t)),Ri(e));return{className:w1(t.source===V.Source.Camera||t.source===V.Source.ScreenShare?"participant-media-video":"participant-media-audio"),trackObserver:n}}function Zd(t){if(Pf(t))return t.publication;{const{source:e,name:n,participant:i}=t;if(e&&n)return i.getTrackPublications().find(r=>r.source===e&&r.trackName===n);if(n)return i.getTrackPublicationByName(n);if(e)return i.getTrackPublication(e);throw new Error("At least one of source and name needs to be defined")}}function Rf(t,...e){return new mt(n=>{const i=()=>{n.next(t)};return e.forEach(r=>{t.on(r,i)}),()=>{e.forEach(r=>{t.off(r,i)})}}).pipe(Ri(t))}function C1(t,e){return new mt(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function pM(t){return C1(t,U.ConnectionStateChanged).pipe(Qt(([e])=>e),Ri(t.state))}function gM(t){return C1(t,U.DataReceived)}function vM(t){return Rf(t,U.AudioPlaybackStatusChanged).pipe(Qt(e=>({canPlayAudio:e.canPlaybackAudio})))}function k1(t,...e){return new mt(n=>{const i=()=>{n.next(t)};return e.forEach(r=>{t.on(r,i)}),()=>{e.forEach(r=>{t.off(r,i)})}}).pipe(Ri(t))}function T1(t){return k1(t,Z.TrackMuted,Z.TrackUnmuted,Z.ParticipantPermissionsChanged,Z.TrackPublished,Z.TrackUnpublished,Z.LocalTrackPublished,Z.LocalTrackUnpublished,Z.MediaDevicesError,Z.TrackSubscriptionStatusChanged).pipe(Qt(e=>{const{isMicrophoneEnabled:n,isCameraEnabled:i,isScreenShareEnabled:r}=e,s=e.getTrackPublication(V.Source.Microphone),o=e.getTrackPublication(V.Source.Camera);return{isCameraEnabled:i,isMicrophoneEnabled:n,isScreenShareEnabled:r,cameraTrack:o,microphoneTrack:s,participant:e}}))}function yM(t,e){return new mt(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function bM(t,e={}){var n;let i;const r=new mt(c=>(i=c,()=>a.unsubscribe())).pipe(Ri(Array.from(t.remoteParticipants.values()))),s=(n=e.additionalRoomEvents)!=null?n:b1,o=Array.from(new Set([U.ParticipantConnected,U.ParticipantDisconnected,U.ConnectionStateChanged,...s])),a=Rf(t,...o).subscribe(c=>i==null?void 0:i.next(Array.from(c.remoteParticipants.values())));return t.remoteParticipants.size>0&&(i==null||i.next(Array.from(t.remoteParticipants.values()))),r}function qp(t){return typeof t>"u"?new mt:yM(t,Z.AttributesChanged).pipe(Qt(([e])=>({changed:e,attributes:t.attributes})),Ri({changed:t.attributes,attributes:t.attributes}))}var E1={CHAT:"lk.chat",TRANSCRIPTION:"lk.transcription"},xM={CHAT:"lk-chat-topic"};function P1(t,e){return Jr(this,arguments,function*(n,i,r={}){const{reliable:s,destinationIdentities:o,topic:a}=r;yield n.publishData(i,{destinationIdentities:o,topic:a,reliable:s})})}function SM(t,e,n){const i=Array.isArray(e)?e:[e],r=gM(t).pipe(v1(([,,,a])=>e===void 0||a!==void 0&&i.includes(a)),Qt(([a,c,,l])=>({payload:a,topic:l,from:c})));let s;const o=new mt(a=>{s=a});return{messageObservable:r,isSendingObservable:o,send:(a,...c)=>Jr(this,[a,...c],function*(l,d={}){s.next(!0);try{yield P1(t.localParticipant,l,li({topic:i[0]},d))}finally{s.next(!1)}})}}var Io=new WeakMap;function wM(t){return t.ignoreLegacy==!0}var CM=t=>JSON.parse(new TextDecoder().decode(t)),kM=t=>new TextEncoder().encode(JSON.stringify(t));function TM(t,e){var n,i,r,s,o,a;const c=()=>{var x,T,E;return((x=t.serverInfo)==null?void 0:x.edition)===1||!!((T=t.serverInfo)!=null&&T.version)&&mi((E=t.serverInfo)==null?void 0:E.version,"1.8.2")>0},l=new Yr,d=(n=void 0)!=null?n:E1.CHAT,u=(i=void 0)!=null?i:xM.CHAT;let f=!1;Io.has(t)||(f=!0);const p=(r=Io.get(t))!=null?r:new Map,g=(s=p.get(d))!=null?s:new Yr;p.set(d,g),Io.set(t,p);const h=(o=void 0)!=null?o:CM;if(f){t.registerTextStreamHandler(d,(T,E)=>Jr(this,null,function*(){const{id:P,timestamp:_}=T.info;Ef(T).pipe(Gd((k,I)=>k+I),Qt(k=>({id:P,timestamp:_,message:k,from:t.getParticipantByIdentity(E.identity)}))).subscribe({next:k=>g.next(k)})}));const{messageObservable:x}=SM(t,[u]);x.pipe(Qt(T=>{const E=h(T.payload);return wM(E)?void 0:Fi(li({},E),{from:T.from})}),v1(T=>!!T),Hp(l)).subscribe(g)}const y=g.pipe(Gd((x,T)=>{if("id"in T&&x.find(E=>{var P,_;return((P=E.from)==null?void 0:P.identity)===((_=T.from)==null?void 0:_.identity)&&E.id===T.id})){const E=x.findIndex(P=>P.id===T.id);if(E>-1){const P=x[E];x[E]=Fi(li({},T),{timestamp:P.timestamp,editTimestamp:T.timestamp})}return[...x]}return[...x,T]},[]),Hp(l)),b=new RI(!1),w=(a=void 0)!=null?a:kM,C=(x,T)=>Jr(this,null,function*(){T||(T={}),T.topic!=null||(T.topic=d),b.next(!0);try{const E={id:(yield t.localParticipant.sendText(x,T)).id,timestamp:Date.now(),message:x},P=Fi(li({},E),{attachedFiles:T.attachments}),_=Fi(li({},P),{from:t.localParticipant,attributes:T.attributes});g.next(_);const k=w(Fi(li({},E),{ignoreLegacy:c()}));try{yield P1(t.localParticipant,k,{reliable:!0,topic:u})}catch(I){Mn.info("could not send message in legacy chat format",I)}return _}finally{b.next(!1)}});function S(){l.next(),l.complete(),g.complete(),Io.delete(t),t.unregisterTextStreamHandler(d)}return t.once(U.Disconnected,S),{messageObservable:y,isSendingObservable:b,send:C}}function EM(){const t=e=>Jr(this,null,function*(){Mn.info("Start Audio for room: ",e),yield e.startAudio()});return{className:w1("start-audio-button"),roomAudioPlaybackAllowedObservable:vM,handleStartAudioPlayback:t}}function Kp(t,e,n=!0){const i=[t.localParticipant,...Array.from(t.remoteParticipants.values())],r=[];return i.forEach(s=>{e.forEach(o=>{const a=Array.from(s.trackPublications.values()).filter(c=>c.source===o&&(!n||c.track)).map(c=>({participant:s,publication:c,source:c.source}));r.push(...a)})}),{trackReferences:r,participants:i}}function Gp(t,e,n=!1){const{sources:i,kind:r,name:s}=e;return Array.from(t.trackPublications.values()).filter(o=>(!i||i.includes(o.source))&&(!r||o.kind===r)&&(!s||o.trackName===s)&&(!n||o.track)).map(o=>({participant:t,publication:o,source:o.source}))}function PM(t,e,n){var i,r;const s=(i=n.additionalRoomEvents)!=null?i:b1,o=(r=n.onlySubscribed)!=null?r:!0,a=Array.from(new Set([U.ParticipantConnected,U.ParticipantDisconnected,U.ConnectionStateChanged,U.LocalTrackPublished,U.LocalTrackUnpublished,U.TrackPublished,U.TrackUnpublished,U.TrackSubscriptionStatusChanged,...s]).values());return Rf(t,...a).pipe(Qt(c=>{const l=Kp(c,e,o);return Mn.debug(`TrackReference[] was updated. (length ${l.trackReferences.length})`,l),l}),Ri(Kp(t,e,o)))}function RM(t,e){return k1(t,...dM).pipe(Qt(n=>{const i=Gp(n,e);return Mn.debug(`TrackReference[] was updated. (length ${i.length})`,i),i}),Ri(Gp(t,e)))}function R1(t,e){return new mt(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function AM(t){return R1(t,re.TranscriptionReceived)}function IM(t){return R1(t,re.TimeSyncUpdate).pipe(Qt(([e])=>e))}var pl=null,gl=null,MM=0;function Zp(){return pl||(pl=new Map),pl}function _M(){return gl||(gl=new WeakMap),gl}function NM(t,e){const n=_M();let i=n.get(t);return i||(i=`room_${MM++}`,n.set(t,i)),`${i}:${e}`}function OM(t,e){const n=NM(t,e),i=Zp(),r=i.get(n);if(r)return r;const s=new Yr;let o=[];const a="lk.segment_id",c=s.pipe(QI({subscribe:()=>{t.registerTextStreamHandler(e,(l,d)=>Jr(this,null,function*(){var u;const f=Ef(l).pipe(Gd((g,h)=>g+h,"")),p=!!((u=l.info.attributes)!=null&&u[a]);f.subscribe(g=>{const h=o.findIndex(y=>{var b,w;return y.streamInfo.id===l.info.id||p&&((b=y.streamInfo.attributes)==null?void 0:b[a])===((w=l.info.attributes)==null?void 0:w[a])});h!==-1?(o[h]=Fi(li({},o[h]),{text:g}),s.next([...o])):(o.push({text:g,participantInfo:d,streamInfo:l.info}),s.next([...o]))})}))},finalize:()=>{t.unregisterTextStreamHandler(e)}}),XI());return i.set(n,c),t.on(U.Disconnected,()=>{Zp().delete(n),o=[],s.next([])}),c}v.createContext(void 0);const DM=v.createContext(void 0);function A1(){return v.useContext(DM)}function I1(t){const e=A1(),n=t??e;if(!n)throw new Error("No TrackRef, make sure you are inside a TrackRefContext or pass the TrackRef explicitly");return n}const jM=v.createContext(void 0);function M1(){return v.useContext(jM)}const Da=v.createContext(void 0);function ho(){const t=v.useContext(Da);if(!t)throw Error("tried to access room context outside of livekit room component");return t}function _1(){return v.useContext(Da)}function mo(t){const e=_1(),n=t??e;if(!n)throw new Error("No room provided, make sure you are inside a Room context or pass the room explicitly");return n}v.createContext(void 0);function N1(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=N1(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function O1(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=N1(t))&&(i&&(i+=" "),i+=e);return i}function LM(...t){return(...e)=>{for(const n of t)if(typeof n=="function")try{n(...e)}catch(i){console.error(i)}}}function D1(...t){const e={...t[0]};for(let n=1;n<t.length;n++){const i=t[n];for(const r in i){const s=e[r],o=i[r];typeof s=="function"&&typeof o=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?e[r]=LM(s,o):(r==="className"||r==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[r]=O1(s,o):e[r]=o!==void 0?o:s}}return e}function VM(t){return t!==void 0}function j1(...t){return D1(...t.filter(VM))}function FM(t,e,n){return v.Children.map(t,i=>v.isValidElement(i)&&v.Children.only(t)?(i.props.className&&(e??(e={}),e.className=O1(i.props.className,e.className),e.style={...i.props.style,...e.style}),v.cloneElement(i,{...e,key:n})):i)}function bi(t,e,n=!0){const[i,r]=v.useState(e);return v.useEffect(()=>{if(n&&r(e),typeof window>"u"||!t)return;const s=t.subscribe(r);return()=>s.unsubscribe()},[t,n]),i}function Af(t){const e=mo(t),n=v.useMemo(()=>pM(e),[e]);return bi(n,e.state)}function UM(t={}){const e=mo(t.room),[n,i]=v.useState(e.localParticipant),[r,s]=v.useState(n.isMicrophoneEnabled),[o,a]=v.useState(n.isCameraEnabled),[c,l]=v.useState(n.isScreenShareEnabled),[d,u]=v.useState(n.lastMicrophoneError),[f,p]=v.useState(n.lastCameraError),[g,h]=v.useState(void 0),[y,b]=v.useState(void 0),w=C=>{a(C.isCameraEnabled),s(C.isMicrophoneEnabled),l(C.isScreenShareEnabled),b(C.cameraTrack),h(C.microphoneTrack),u(C.participant.lastMicrophoneError),p(C.participant.lastCameraError),i(C.participant)};return v.useEffect(()=>{const C=T1(e.localParticipant).subscribe(w);return()=>C.unsubscribe()},[e]),{isMicrophoneEnabled:r,isScreenShareEnabled:c,isCameraEnabled:o,microphoneTrack:g,cameraTrack:y,lastMicrophoneError:d,lastCameraError:f,localParticipant:n}}function L1(t={}){const e=mo(t.room),[n,i]=v.useState([]);return v.useEffect(()=>{const r=bM(e,{additionalRoomEvents:t.updateOnlyOn}).subscribe(i);return()=>r.unsubscribe()},[e,JSON.stringify(t.updateOnlyOn)]),n}function BM({room:t,props:e}){const n=mo(t),{className:i,roomAudioPlaybackAllowedObservable:r,handleStartAudioPlayback:s}=v.useMemo(()=>EM(),[]),o=v.useMemo(()=>r(n),[n,r]),{canPlayAudio:a}=bi(o,{canPlayAudio:n.canPlaybackAudio});return{mergedProps:v.useMemo(()=>D1(e,{className:i,onClick:()=>{s(n)},style:{display:a?"none":"block"}}),[e,i,a,s,n]),canPlayAudio:a}}function If(t=[V.Source.Camera,V.Source.Microphone,V.Source.ScreenShare,V.Source.ScreenShareAudio,V.Source.Unknown],e={}){const n=mo(e.room),[i,r]=v.useState([]),[s,o]=v.useState([]),a=v.useMemo(()=>t.map(c=>x1(c)?c.source:c),[JSON.stringify(t)]);return v.useEffect(()=>{const c=PM(n,a,{additionalRoomEvents:e.updateOnlyOn,onlySubscribed:e.onlySubscribed}).subscribe(({trackReferences:l,participants:d})=>{Mn.debug("setting track bundles",l,d),r(l),o(d)});return()=>c.unsubscribe()},[n,JSON.stringify(e.onlySubscribed),JSON.stringify(e.updateOnlyOn),JSON.stringify(t)]),v.useMemo(()=>{if(S1(t)){const c=HM(t,s),l=Array.from(i);return s.forEach(d=>{c.has(d.identity)&&(c.get(d.identity)??[]).forEach(u=>{if(i.find(({participant:p,publication:g})=>d.identity===p.identity&&g.source===u))return;Mn.debug(`Add ${u} placeholder for participant ${d.identity}.`);const f={participant:d,source:u};l.push(f)})}),l}else return i},[i,s,t])}function $M(t,e){const n=new Set(t);for(const i of e)n.delete(i);return n}function HM(t,e){const n=new Map;if(S1(t)){const i=t.filter(r=>r.withPlaceholder).map(r=>r.source);e.forEach(r=>{const s=r.getTrackPublications().map(a=>{var c;return(c=a.track)==null?void 0:c.source}).filter(a=>a!==void 0),o=Array.from($M(new Set(i),new Set(s)));o.length>0&&n.set(r.identity,o)})}return n}function zM(t){const e=ho(),n=Af(e),i=v.useMemo(()=>n===ge.Disconnected,[n]),r=v.useMemo(()=>TM(e),[e,t,i]),s=bi(r.isSendingObservable,!1),o=bi(r.messageObservable,[]);return{send:r.send,chatMessages:o,isSending:s}}const WM=t=>{const e=n=>{let i=1-Math.max(-100,Math.min(-10,n))*-1/100;return i=Math.sqrt(i),i};return t.map(n=>n===-1/0?0:e(n))},qM={bands:5,loPass:100,hiPass:600,updateInterval:32,analyserOptions:{fftSize:2048}};function KM(t,e={}){var n;const i=t instanceof V?t:(n=t==null?void 0:t.publication)==null?void 0:n.track,r={...qM,...e},[s,o]=v.useState(new Array(r.bands).fill(0));return v.useEffect(()=>{if(!i||!(i!=null&&i.mediaStream))return;const{analyser:a,cleanup:c}=lT(i,r.analyserOptions),l=a.frequencyBinCount,d=new Float32Array(l),u=setInterval(()=>{a.getFloatFrequencyData(d);let f=new Float32Array(d.length);for(let y=0;y<d.length;y++)f[y]=d[y];f=f.slice(e.loPass,e.hiPass);const p=WM(f),g=Math.ceil(p.length/r.bands),h=[];for(let y=0;y<r.bands;y++){const b=p.slice(y*g,(y+1)*g).reduce((w,C)=>w+=C,0);h.push(b/g)}o(h)},r.updateInterval);return()=>{c(),clearInterval(u)}},[i,i==null?void 0:i.mediaStream,JSON.stringify(e)]),s}function Yp(t,e){const n=M1(),i=L1({updateOnlyOn:[]}),r=v.useMemo(()=>e?i.find(o=>o.identity===e):n,[e,i,n]),s=v.useMemo(()=>{if(r)return RM(r,{sources:t})},[r,JSON.stringify(t)]);return bi(s,[])}function GM(t){var e,n,i;const r=v.useMemo(()=>{var s;return(s=t==null?void 0:t.publication)!=null&&s.track?IM(t==null?void 0:t.publication.track):void 0},[(e=t==null?void 0:t.publication)==null?void 0:e.track]);return bi(r,{timestamp:Date.now(),rtpTimestamp:(i=(n=t==null?void 0:t.publication)==null?void 0:n.track)==null?void 0:i.rtpTimestamp})}const ZM={bufferSize:100};function YM(t,e){const n={...ZM,...e},[i,r]=v.useState([]),s=GM(t),o=a=>{var c;(c=n.onTranscription)==null||c.call(n,a),r(l=>hM(l,a.map(d=>fM(d,s)),n.bufferSize))};return v.useEffect(()=>{if(!(t!=null&&t.publication))return;const a=AM(t.publication).subscribe(c=>{o(...c)});return()=>{a.unsubscribe()}},[t&&y1(t),o]),{segments:i}}function JM(t={}){const e=M1(),n=t.participant??e,i=v.useMemo(()=>qp(n),[n]);return bi(i,{attributes:n==null?void 0:n.attributes})}const Jp="lk.agent.state";function V1(){const t=L1(),e=t.find(u=>u.kind===Yi.AGENT&&!("lk.publish_on_behalf"in u.attributes)),n=t.find(u=>u.kind===Yi.AGENT&&u.attributes["lk.publish_on_behalf"]===(e==null?void 0:e.identity)),i=Yp([V.Source.Microphone,V.Source.Camera],e==null?void 0:e.identity),r=Yp([V.Source.Microphone,V.Source.Camera],n==null?void 0:n.identity),s=i.find(u=>u.source===V.Source.Microphone)??r.find(u=>u.source===V.Source.Microphone),o=i.find(u=>u.source===V.Source.Camera)??r.find(u=>u.source===V.Source.Camera),{segments:a}=YM(s),c=Af(),{attributes:l}=JM({participant:e}),d=v.useMemo(()=>c===ge.Disconnected?"disconnected":c===ge.Connecting||!e||!(l!=null&&l[Jp])?"connecting":l[Jp],[l,e,c]);return{agent:e,state:d,audioTrack:s,videoTrack:o,agentTranscriptions:a,agentAttributes:l}}function XM(t){const e=ho(),n=Af(e)===ge.Disconnected,i=v.useMemo(()=>OM(e,t),[e,t]);return{textStreams:bi(n?void 0:i,[])}}function QM(t){const{participantIdentities:e,trackSids:n}={},{textStreams:i}=XM(E1.TRANSCRIPTION);return v.useMemo(()=>i.filter(r=>e?e.includes(r.participantInfo.identity):!0).filter(r=>{var s;return n?n.includes(((s=r.streamInfo.attributes)==null?void 0:s["lk.transcribed_track_id"])??""):!0}),[i,e,n])}const Xp=v.forwardRef(function({label:t="Allow Audio",...e},n){const i=ho(),{mergedProps:r}=BM({room:i,props:e});return v.createElement("button",{ref:n,...r},t)});function F1(t,e={}){const[n,i]=v.useState(Zd(t)),[r,s]=v.useState(n==null?void 0:n.isMuted),[o,a]=v.useState(n==null?void 0:n.isSubscribed),[c,l]=v.useState(n==null?void 0:n.track),[d,u]=v.useState("landscape"),f=v.useRef(),{className:p,trackObserver:g}=v.useMemo(()=>mM(t),[t.participant.sid??t.participant.identity,t.source,Pf(t)&&t.publication.trackSid]);return v.useEffect(()=>{const h=g.subscribe(y=>{Mn.debug("update track",y),i(y),s(y==null?void 0:y.isMuted),a(y==null?void 0:y.isSubscribed),l(y==null?void 0:y.track)});return()=>h==null?void 0:h.unsubscribe()},[g]),v.useEffect(()=>{var h,y;return c&&(f.current&&c.detach(f.current),(h=e.element)!=null&&h.current&&!(t.participant.isLocal&&(c==null?void 0:c.kind)==="audio")&&c.attach(e.element.current)),f.current=(y=e.element)==null?void 0:y.current,()=>{f.current&&(c==null||c.detach(f.current))}},[c,e.element]),v.useEffect(()=>{var h,y;if(typeof((h=n==null?void 0:n.dimensions)==null?void 0:h.width)=="number"&&typeof((y=n==null?void 0:n.dimensions)==null?void 0:y.height)=="number"){const b=n.dimensions.width>n.dimensions.height?"landscape":"portrait";u(b)}},[n]),{publication:n,isMuted:r,isSubscribed:o,track:c,elementProps:j1(e.props,{className:p,"data-lk-local-participant":t.participant.isLocal,"data-lk-source":n==null?void 0:n.source,...(n==null?void 0:n.kind)==="video"&&{"data-lk-orientation":d}})}}var vl,Qp;function e4(){if(Qp)return vl;Qp=1;var t="Expected a function",e=NaN,n="[object Symbol]",i=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,c=typeof Ro=="object"&&Ro&&Ro.Object===Object&&Ro,l=typeof self=="object"&&self&&self.Object===Object&&self,d=c||l||Function("return this")(),u=Object.prototype,f=u.toString,p=Math.max,g=Math.min,h=function(){return d.Date.now()};function y(x,T,E){var P,_,k,I,N,K,J=0,se=!1,ie=!1,X=!0;if(typeof x!="function")throw new TypeError(t);T=S(T)||0,b(E)&&(se=!!E.leading,ie="maxWait"in E,k=ie?p(S(E.maxWait)||0,T):k,X="trailing"in E?!!E.trailing:X);function O(D){var $=P,Q=_;return P=_=void 0,J=D,I=x.apply(Q,$),I}function oe(D){return J=D,N=setTimeout(te,T),se?O(D):I}function L(D){var $=D-K,Q=D-J,W=T-$;return ie?g(W,k-Q):W}function F(D){var $=D-K,Q=D-J;return K===void 0||$>=T||$<0||ie&&Q>=k}function te(){var D=h();if(F(D))return j(D);N=setTimeout(te,L(D))}function j(D){return N=void 0,X&&P?O(D):(P=_=void 0,I)}function q(){N!==void 0&&clearTimeout(N),J=0,P=K=_=N=void 0}function ee(){return N===void 0?I:j(h())}function G(){var D=h(),$=F(D);if(P=arguments,_=this,K=D,$){if(N===void 0)return oe(K);if(ie)return N=setTimeout(te,T),O(K)}return N===void 0&&(N=setTimeout(te,T)),I}return G.cancel=q,G.flush=ee,G}function b(x){var T=typeof x;return!!x&&(T=="object"||T=="function")}function w(x){return!!x&&typeof x=="object"}function C(x){return typeof x=="symbol"||w(x)&&f.call(x)==n}function S(x){if(typeof x=="number")return x;if(C(x))return e;if(b(x)){var T=typeof x.valueOf=="function"?x.valueOf():x;x=b(T)?T+"":T}if(typeof x!="string")return x===0?x:+x;x=x.replace(i,"");var E=s.test(x);return E||o.test(x)?a(x.slice(2),E?2:8):r.test(x)?e:+x}return vl=y,vl}var t4=e4();const eg=Jb(t4);function n4(t){const e=R.useRef(t);e.current=t,R.useEffect(()=>()=>{e.current()},[])}function i4(t,e=500,n){const i=R.useRef();n4(()=>{i.current&&i.current.cancel()});const r=R.useMemo(()=>{const s=eg(t,e,n),o=(...a)=>s(...a);return o.cancel=()=>{s.cancel()},o.isPending=()=>!!i.current,o.flush=()=>s.flush(),o},[t,e,n]);return R.useEffect(()=>{i.current=eg(t,e,n)},[t,e,n]),r}function r4(t,e,n){const i=(l,d)=>l===d,r=t instanceof Function?t():t,[s,o]=R.useState(r),a=R.useRef(r),c=i4(o,e,n);return i(a.current,r)||(c(r),a.current=r),[s,c]}function s4({threshold:t=0,root:e=null,rootMargin:n="0%",freezeOnceVisible:i=!1,initialIsIntersecting:r=!1,onChange:s}={}){var o;const[a,c]=R.useState(null),[l,d]=R.useState(()=>({isIntersecting:r,entry:void 0})),u=R.useRef();u.current=s;const f=((o=l.entry)==null?void 0:o.isIntersecting)&&i;R.useEffect(()=>{if(!a||!("IntersectionObserver"in window)||f)return;const h=new IntersectionObserver(y=>{const b=Array.isArray(h.thresholds)?h.thresholds:[h.thresholds];y.forEach(w=>{const C=w.isIntersecting&&b.some(S=>w.intersectionRatio>=S);d({isIntersecting:C,entry:w}),u.current&&u.current(C,w)})},{threshold:t,root:e,rootMargin:n});return h.observe(a),()=>{h.disconnect()}},[a,JSON.stringify(t),e,n,f,i]);const p=R.useRef(null);R.useEffect(()=>{var h;!a&&(h=l.entry)!=null&&h.target&&!i&&!f&&p.current!==l.entry.target&&(p.current=l.entry.target,d({isIntersecting:r,entry:void 0}))},[a,l.entry,i,f,r]);const g=[c,!!l.isIntersecting,l.entry];return g.ref=g[0],g.isIntersecting=g[1],g.entry=g[2],g}const Mf=v.forwardRef(function({onTrackClick:t,onClick:e,onSubscriptionStatusChanged:n,trackRef:i,manageSubscription:r,...s},o){const a=I1(i),c=v.useRef(null);v.useImperativeHandle(o,()=>c.current);const l=s4({root:c.current}),[d]=r4(l,3e3);v.useEffect(()=>{r&&a.publication instanceof Pa&&(d==null?void 0:d.isIntersecting)===!1&&(l==null?void 0:l.isIntersecting)===!1&&a.publication.setSubscribed(!1)},[d,a,r]),v.useEffect(()=>{r&&a.publication instanceof Pa&&(l==null?void 0:l.isIntersecting)===!0&&a.publication.setSubscribed(!0)},[l,a,r]);const{elementProps:u,publication:f,isSubscribed:p}=F1(a,{element:c,props:s});v.useEffect(()=>{n==null||n(!!p)},[p,n]);const g=h=>{e==null||e(h),t==null||t({participant:a==null?void 0:a.participant,track:f})};return v.createElement("video",{ref:c,...u,muted:!0,onClick:g})}),o4=v.forwardRef(function({trackRef:t,onSubscriptionStatusChanged:e,volume:n,...i},r){const s=I1(t),o=v.useRef(null);v.useImperativeHandle(r,()=>o.current);const{elementProps:a,isSubscribed:c,track:l,publication:d}=F1(s,{element:o,props:i});return v.useEffect(()=>{e==null||e(!!c)},[c,e]),v.useEffect(()=>{l===void 0||n===void 0||(l instanceof gy?l.setVolume(n):Mn.warn("Volume can only be set on remote audio tracks."))},[n,l]),v.useEffect(()=>{d===void 0||i.muted===void 0||(d instanceof Pa?d.setEnabled(!i.muted):Mn.warn("Can only call setEnabled on remote track publications."))},[i.muted,d,l]),v.createElement("audio",{ref:o,...a})});function tg({volume:t,muted:e}){const n=If([V.Source.Microphone,V.Source.ScreenShareAudio,V.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0}).filter(i=>!i.participant.isLocal&&i.publication.kind===V.Kind.Audio);return v.createElement("div",{style:{display:"none"}},n.map(i=>v.createElement(o4,{key:y1(i),trackRef:i,volume:t,muted:e})))}const a4=t=>{const e=[];for(let n=0;n<t;n++)e.push([n,t-1-n]);return e},ng=t=>[[Math.floor(t/2)],[-1]],c4=(t,e,n)=>{const[i,r]=R.useState(0),[s,o]=R.useState([[]]);R.useEffect(()=>{if(t==="thinking")o(ng(e));else if(t==="connecting"||t==="initializing"){const c=[...a4(e)];o(c)}else o(t==="listening"?ng(e):t===void 0||t==="speaking"?[new Array(e).fill(0).map((c,l)=>l)]:[[]]);r(0)},[t,e]);const a=R.useRef(null);return R.useEffect(()=>{let c=performance.now();const l=d=>{d-c>=n&&(r(u=>u+1),c=d),a.current=requestAnimationFrame(l)};return a.current=requestAnimationFrame(l),()=>{a.current!==null&&cancelAnimationFrame(a.current)}},[n,e,t,s.length]),s[i%s.length]},l4=new Map([["connecting",2e3],["initializing",2e3],["listening",500],["thinking",150]]),d4=(t,e)=>{if(t===void 0)return 1e3;let n=l4.get(t);if(n)switch(t){case"connecting":n/=e;break}return n},U1=v.forwardRef(function({state:t,options:e,barCount:n=15,trackRef:i,children:r,...s},o){const a=j1(s,{className:"lk-audio-bar-visualizer"});let c=A1();i&&(c=i);const l=KM(c,{bands:n,loPass:100,hiPass:200}),d=(e==null?void 0:e.minHeight)??20,u=(e==null?void 0:e.maxHeight)??100,f=c4(t,n,d4(t,n)??100);return v.createElement("div",{ref:o,...a,"data-lk-va-state":t},l.map((p,g)=>r?FM(r,{"data-lk-highlighted":f.includes(g),"data-lk-bar-index":g,className:"lk-audio-bar",style:{height:`${Math.min(u,Math.max(d,p*100+5))}%`}}):v.createElement("span",{key:g,"data-lk-highlighted":f.includes(g),"data-lk-bar-index":g,className:`lk-audio-bar ${f.includes(g)&&"lk-highlighted"}`,style:{height:`${Math.min(u,Math.max(d,p*100+5))}%`}})))});function u4(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}Array(12).fill(0);let Yd=1;class f4{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:i,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Yd++,o=this.toasts.find(c=>c.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...e,id:s,title:i}),{...c,...e,id:s,dismissible:a,title:i}):c):this.addToast({title:i,...r,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(i=>i({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let i;n.loading!==void 0&&(i=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let s=i!==void 0,o;const a=r.then(async l=>{if(o=["resolve",l],R.isValidElement(l))s=!1,this.create({id:i,type:"default",message:l});else if(m4(l)&&!l.ok){s=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${l.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${l.status}`):n.description,g=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:i,type:"error",description:f,...g})}else if(l instanceof Error){s=!1;const u=typeof n.error=="function"?await n.error(l):n.error,f=typeof n.description=="function"?await n.description(l):n.description,g=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:i,type:"error",description:f,...g})}else if(n.success!==void 0){s=!1;const u=typeof n.success=="function"?await n.success(l):n.success,f=typeof n.description=="function"?await n.description(l):n.description,g=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:i,type:"success",description:f,...g})}}).catch(async l=>{if(o=["reject",l],n.error!==void 0){s=!1;const d=typeof n.error=="function"?await n.error(l):n.error,u=typeof n.description=="function"?await n.description(l):n.description,p=typeof d=="object"&&!R.isValidElement(d)?d:{message:d};this.create({id:i,type:"error",description:u,...p})}}).finally(()=>{s&&(this.dismiss(i),i=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((l,d)=>a.then(()=>o[0]==="reject"?d(o[1]):l(o[1])).catch(d));return typeof i!="string"&&typeof i!="number"?{unwrap:c}:Object.assign(i,{unwrap:c})},this.custom=(e,n)=>{const i=(n==null?void 0:n.id)||Yd++;return this.create({jsx:e(i),id:i,...n}),i},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Zt=new f4,h4=(t,e)=>{const n=(e==null?void 0:e.id)||Yd++;return Zt.addToast({title:t,...e,id:n}),n},m4=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",p4=h4,g4=()=>Zt.toasts,v4=()=>Zt.getActiveToasts(),B1=Object.assign(p4,{success:Zt.success,info:Zt.info,warning:Zt.warning,error:Zt.error,custom:Zt.custom,message:Zt.message,promise:Zt.promise,dismiss:Zt.dismiss,loading:Zt.loading},{getHistory:g4,getToasts:v4});u4("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const pn=v.forwardRef((t,e)=>{const{alt:n,color:i="currentColor",size:r="1em",weight:s="regular",mirrored:o=!1,children:a,weights:c,...l}=t;return v.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:i,viewBox:"0 0 256 256",transform:o?"scale(-1, 1)":void 0,...l},!!n&&v.createElement("title",null,n),a,c.get(s))});pn.displayName="SSRBase";const y4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),v.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),_f=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:y4}));_f.displayName="CaretDownIcon";const b4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),v.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),$1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:b4}));$1.displayName="CaretUpIcon";const x4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),v.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),H1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:x4}));H1.displayName="ChatTextIcon";const S4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),v.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),z1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:S4}));z1.displayName="CheckIcon";const w4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),v.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),W1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:w4}));W1.displayName="MicrophoneIcon";const C4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),v.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),q1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:C4}));q1.displayName="MicrophoneSlashIcon";const k4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),v.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),K1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:k4}));K1.displayName="MonitorArrowUpIcon";const T4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),v.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),Nf=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:T4}));Nf.displayName="SpinnerIcon";const E4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),v.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),G1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:E4}));G1.displayName="VideoCameraIcon";const P4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),v.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),Z1=v.forwardRef((t,e)=>v.createElement(pn,{ref:e,...t,weights:P4}));Z1.displayName="VideoCameraSlashIcon";const R4=new Map([["bold",v.createElement(v.Fragment,null,v.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",v.createElement(v.Fragment,null,v.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),v.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",v.createElement(v.Fragment,null,v.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",v.createElement(v.Fragment,null,v.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",v.createElement(v.Fragment,null,v.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",v.createElement(v.Fragment,null,v.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),A4=R.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),Y1=v.forwardRef((t,e)=>{const{alt:n,color:i,size:r,weight:s,mirrored:o,children:a,weights:c,...l}=t,{color:d="currentColor",size:u,weight:f="regular",mirrored:p=!1,...g}=v.useContext(A4);return v.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:r??u,height:r??u,fill:i??d,viewBox:"0 0 256 256",transform:o||p?"scale(-1, 1)":void 0,...g,...l},!!n&&v.createElement("title",null,n),a,c.get(s??f))});Y1.displayName="IconBase";const J1=v.forwardRef((t,e)=>v.createElement(Y1,{ref:e,...t,weights:R4}));J1.displayName="WarningIcon";function X1(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=X1(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function ic(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=X1(t))&&(i&&(i+=" "),i+=e);return i}const ig=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rg=ic,rc=(t,e)=>n=>{var i;if((e==null?void 0:e.variants)==null)return rg(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=e,o=Object.keys(r).map(l=>{const d=n==null?void 0:n[l],u=s==null?void 0:s[l];if(d===null)return null;const f=ig(d)||ig(u);return r[l][f]}),a=n&&Object.entries(n).reduce((l,d)=>{let[u,f]=d;return f===void 0||(l[u]=f),l},{}),c=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((l,d)=>{let{class:u,className:f,...p}=d;return Object.entries(p).every(g=>{let[h,y]=g;return Array.isArray(y)?y.includes({...s,...a}[h]):{...s,...a}[h]===y})?[...l,u,f]:l},[]);return rg(t,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Of="-",I4=t=>{const e=_4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o=>{const a=o.split(Of);return a[0]===""&&a.length!==1&&a.shift(),Q1(a,e)||M4(o)},getConflictingClassGroupIds:(o,a)=>{const c=n[o]||[];return a&&i[o]?[...c,...i[o]]:c}}},Q1=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],i=e.nextPart.get(n),r=i?Q1(t.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=t.join(Of);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},sg=/^\[(.+)\]$/,M4=t=>{if(sg.test(t)){const e=sg.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},_4=t=>{const{theme:e,classGroups:n}=t,i={nextPart:new Map,validators:[]};for(const r in n)Jd(n[r],i,r,e);return i},Jd=(t,e,n,i)=>{t.forEach(r=>{if(typeof r=="string"){const s=r===""?e:og(e,r);s.classGroupId=n;return}if(typeof r=="function"){if(N4(r)){Jd(r(i),e,n,i);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,o])=>{Jd(o,og(e,s),n,i)})})},og=(t,e)=>{let n=t;return e.split(Of).forEach(i=>{n.nextPart.has(i)||n.nextPart.set(i,{nextPart:new Map,validators:[]}),n=n.nextPart.get(i)}),n},N4=t=>t.isThemeGetter,O4=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,i=new Map;const r=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,i=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=i.get(s))!==void 0)return r(s,o),o},set(s,o){n.has(s)?n.set(s,o):r(s,o)}}},Xd="!",Qd=":",D4=Qd.length,j4=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=r=>{const s=[];let o=0,a=0,c=0,l;for(let g=0;g<r.length;g++){let h=r[g];if(o===0&&a===0){if(h===Qd){s.push(r.slice(c,g)),c=g+D4;continue}if(h==="/"){l=g;continue}}h==="["?o++:h==="]"?o--:h==="("?a++:h===")"&&a--}const d=s.length===0?r:r.substring(c),u=L4(d),f=u!==d,p=l&&l>c?l-c:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:u,maybePostfixModifierPosition:p}};if(e){const r=e+Qd,s=i;i=o=>o.startsWith(r)?s(o.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const r=i;i=s=>n({className:s,parseClassName:r})}return i},L4=t=>t.endsWith(Xd)?t.substring(0,t.length-1):t.startsWith(Xd)?t.substring(1):t,V4=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(i=>[i,!0]));return i=>{if(i.length<=1)return i;const r=[];let s=[];return i.forEach(o=>{o[0]==="["||e[o]?(r.push(...s.sort(),o),s=[]):s.push(o)}),r.push(...s.sort()),r}},F4=t=>({cache:O4(t.cacheSize),parseClassName:j4(t),sortModifiers:V4(t),...I4(t)}),U4=/\s+/,B4=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:s}=e,o=[],a=t.trim().split(U4);let c="";for(let l=a.length-1;l>=0;l-=1){const d=a[l],{isExternal:u,modifiers:f,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:h}=n(d);if(u){c=d+(c.length>0?" "+c:c);continue}let y=!!h,b=i(y?g.substring(0,h):g);if(!b){if(!y){c=d+(c.length>0?" "+c:c);continue}if(b=i(g),!b){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=s(f).join(":"),C=p?w+Xd:w,S=C+b;if(o.includes(S))continue;o.push(S);const x=r(b,y);for(let T=0;T<x.length;++T){const E=x[T];o.push(C+E)}c=d+(c.length>0?" "+c:c)}return c};function $4(){let t=0,e,n,i="";for(;t<arguments.length;)(e=arguments[t++])&&(n=ex(e))&&(i&&(i+=" "),i+=n);return i}const ex=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=ex(t[i]))&&(n&&(n+=" "),n+=e);return n};function H4(t,...e){let n,i,r,s=o;function o(c){const l=e.reduce((d,u)=>u(d),t());return n=F4(l),i=n.cache.get,r=n.cache.set,s=a,a(c)}function a(c){const l=i(c);if(l)return l;const d=B4(c,n);return r(c,d),d}return function(){return s($4.apply(null,arguments))}}const ft=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},tx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z4=/^\d+\/\d+$/,W4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,q4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,K4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,G4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Z4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fr=t=>z4.test(t),ye=t=>!!t&&!Number.isNaN(Number(t)),ri=t=>!!t&&Number.isInteger(Number(t)),yl=t=>t.endsWith("%")&&ye(t.slice(0,-1)),Ln=t=>W4.test(t),Y4=()=>!0,J4=t=>q4.test(t)&&!K4.test(t),ix=()=>!1,X4=t=>G4.test(t),Q4=t=>Z4.test(t),e_=t=>!de(t)&&!ue(t),t_=t=>as(t,ox,ix),de=t=>tx.test(t),ji=t=>as(t,ax,J4),bl=t=>as(t,o_,ye),ag=t=>as(t,rx,ix),n_=t=>as(t,sx,Q4),Mo=t=>as(t,cx,X4),ue=t=>nx.test(t),Es=t=>cs(t,ax),i_=t=>cs(t,a_),cg=t=>cs(t,rx),r_=t=>cs(t,ox),s_=t=>cs(t,sx),_o=t=>cs(t,cx,!0),as=(t,e,n)=>{const i=tx.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},cs=(t,e,n=!1)=>{const i=nx.exec(t);return i?i[1]?e(i[1]):n:!1},rx=t=>t==="position"||t==="percentage",sx=t=>t==="image"||t==="url",ox=t=>t==="length"||t==="size"||t==="bg-size",ax=t=>t==="length",o_=t=>t==="number",a_=t=>t==="family-name",cx=t=>t==="shadow",c_=()=>{const t=ft("color"),e=ft("font"),n=ft("text"),i=ft("font-weight"),r=ft("tracking"),s=ft("leading"),o=ft("breakpoint"),a=ft("container"),c=ft("spacing"),l=ft("radius"),d=ft("shadow"),u=ft("inset-shadow"),f=ft("text-shadow"),p=ft("drop-shadow"),g=ft("blur"),h=ft("perspective"),y=ft("aspect"),b=ft("ease"),w=ft("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],x=()=>[...S(),ue,de],T=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],P=()=>[ue,de,c],_=()=>[fr,"full","auto",...P()],k=()=>[ri,"none","subgrid",ue,de],I=()=>["auto",{span:["full",ri,ue,de]},ri,ue,de],N=()=>[ri,"auto",ue,de],K=()=>["auto","min","max","fr",ue,de],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],se=()=>["start","end","center","stretch","center-safe","end-safe"],ie=()=>["auto",...P()],X=()=>[fr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],O=()=>[t,ue,de],oe=()=>[...S(),cg,ag,{position:[ue,de]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",r_,t_,{size:[ue,de]}],te=()=>[yl,Es,ji],j=()=>["","none","full",l,ue,de],q=()=>["",ye,Es,ji],ee=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>[ye,yl,cg,ag],$=()=>["","none",g,ue,de],Q=()=>["none",ye,ue,de],W=()=>["none",ye,ue,de],ce=()=>[ye,ue,de],z=()=>[fr,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ln],breakpoint:[Ln],color:[Y4],container:[Ln],"drop-shadow":[Ln],ease:["in","out","in-out"],font:[e_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ln],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ln],shadow:[Ln],spacing:["px",ye],text:[Ln],"text-shadow":[Ln],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fr,de,ue,y]}],container:["container"],columns:[{columns:[ye,de,ue,a]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:x()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[ri,"auto",ue,de]}],basis:[{basis:[fr,"full","auto",a,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ye,fr,"auto","initial","none",de]}],grow:[{grow:["",ye,ue,de]}],shrink:[{shrink:["",ye,ue,de]}],order:[{order:[ri,"first","last","none",ue,de]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...se(),"normal"]}],"justify-self":[{"justify-self":["auto",...se()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...se(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...se(),"baseline"]}],"place-self":[{"place-self":["auto",...se()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[a,"screen",...X()]}],"min-w":[{"min-w":[a,"screen","none",...X()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Es,ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ue,bl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yl,de]}],"font-family":[{font:[i_,de,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ue,de]}],"line-clamp":[{"line-clamp":[ye,"none",ue,bl]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",ue,de]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ue,de]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[ye,"from-font","auto",ue,ji]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[ye,"auto",ue,de]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ue,de]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ue,de]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ri,ue,de],radial:["",ue,de],conic:[ri,ue,de]},s_,n_]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ye,ue,de]}],"outline-w":[{outline:["",ye,Es,ji]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",d,_o,Mo]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",u,_o,Mo]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[ye,ji]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",f,_o,Mo]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[ye,ue,de]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[ue,de]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ue,de]}],filter:[{filter:["","none",ue,de]}],blur:[{blur:$()}],brightness:[{brightness:[ye,ue,de]}],contrast:[{contrast:[ye,ue,de]}],"drop-shadow":[{"drop-shadow":["","none",p,_o,Mo]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",ye,ue,de]}],"hue-rotate":[{"hue-rotate":[ye,ue,de]}],invert:[{invert:["",ye,ue,de]}],saturate:[{saturate:[ye,ue,de]}],sepia:[{sepia:["",ye,ue,de]}],"backdrop-filter":[{"backdrop-filter":["","none",ue,de]}],"backdrop-blur":[{"backdrop-blur":$()}],"backdrop-brightness":[{"backdrop-brightness":[ye,ue,de]}],"backdrop-contrast":[{"backdrop-contrast":[ye,ue,de]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ye,ue,de]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ye,ue,de]}],"backdrop-invert":[{"backdrop-invert":["",ye,ue,de]}],"backdrop-opacity":[{"backdrop-opacity":[ye,ue,de]}],"backdrop-saturate":[{"backdrop-saturate":[ye,ue,de]}],"backdrop-sepia":[{"backdrop-sepia":["",ye,ue,de]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ue,de]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ye,"initial",ue,de]}],ease:[{ease:["linear","initial",b,ue,de]}],delay:[{delay:[ye,ue,de]}],animate:[{animate:["none",w,ue,de]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,ue,de]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[ue,de,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ue,de]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ue,de]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[ye,Es,ji,bl]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},l_=H4(c_);function fe(...t){return l_(ic(t))}function d_(t,e){return{id:t.streamInfo.id,timestamp:t.streamInfo.timestamp,message:t.text,from:t.participantInfo.identity===e.localParticipant.identity?e.localParticipant:Array.from(e.remoteParticipants.values()).find(n=>n.identity===t.participantInfo.identity)}}const u_=rc(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function f_({className:t,variant:e,...n}){return m.jsx("div",{"data-slot":"alert",role:"alert",className:fe(u_({variant:e}),t),...n})}function h_({className:t,...e}){return m.jsx("div",{"data-slot":"alert-title",className:fe("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...e})}function m_({className:t,...e}){return m.jsx("div",{"data-slot":"alert-description",className:fe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...e})}function No(t){return B1.custom(e=>m.jsx(p_,{id:e,title:t.title,description:t.description}),{duration:1e4})}function p_(t){const{title:e,id:n,description:i}=t;return m.jsxs(f_,{onClick:()=>B1.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[m.jsx(J1,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),m.jsxs("div",{className:"flex flex-col",children:[m.jsx(h_,{className:"text-base font-semibold text-white mb-1",children:e}),m.jsx(m_,{className:"text-sm text-gray-300 leading-snug",children:i})]})]})}function lg(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function lx(...t){return e=>{let n=!1;const i=t.map(r=>{const s=lg(r,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():lg(t[r],null)}}}}function xt(...t){return v.useCallback(lx(...t),t)}function eo(t){const e=v_(t),n=v.forwardRef((i,r)=>{const{children:s,...o}=i,a=v.Children.toArray(s),c=a.find(b_);if(c){const l=c.props.children,d=a.map(u=>u===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:u);return m.jsx(e,{...o,ref:r,children:v.isValidElement(l)?v.cloneElement(l,void 0,d):null})}return m.jsx(e,{...o,ref:r,children:s})});return n.displayName=`${t}.Slot`,n}var g_=eo("Slot");function v_(t){const e=v.forwardRef((n,i)=>{const{children:r,...s}=n;if(v.isValidElement(r)){const o=S_(r),a=x_(s,r.props);return r.type!==v.Fragment&&(a.ref=i?lx(i,o):o),v.cloneElement(r,a)}return v.Children.count(r)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var y_=Symbol("radix.slottable");function b_(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===y_}function x_(t,e){const n={...e};for(const i in e){const r=t[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...a)=>{const c=s(...a);return r(...a),c}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...t,...n}}function S_(t){var i,r;let e=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const w_=rc(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C_({className:t,variant:e,size:n,asChild:i=!1,...r}){const s=i?g_:"button";return m.jsx(s,{"data-slot":"button",className:fe(w_({variant:e,size:n,className:t})),...r})}function k_({onSend:t,className:e,disabled:n,...i}){const r=R.useRef(null),[s,o]=R.useState(""),a=l=>{var d,u;l.preventDefault(),(d=i.onSubmit)==null||d.call(i,l),t==null||t(s),o(""),(u=r.current)==null||u.focus({preventScroll:!0})},c=n||s.trim().length===0;return m.jsxs("form",{...i,onSubmit:a,className:fe("flex items-center rounded-md pl-1 text-sm",e),children:[m.jsx("input",{ref:r,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:s,onChange:l=>o(l.target.value),disabled:n}),m.jsx(C_,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}function it(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t==null||t(r),n===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}var Lt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},T_=v[" useInsertionEffect ".trim().toString()]||Lt;function eu({prop:t,defaultProp:e,onChange:n=()=>{},caller:i}){const[r,s,o]=E_({defaultProp:e,onChange:n}),a=t!==void 0,c=a?t:r;{const d=v.useRef(t!==void 0);v.useEffect(()=>{const u=d.current;u!==a&&console.warn(`${i} is changing from ${u?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,i])}const l=v.useCallback(d=>{var u;if(a){const f=P_(d)?d(t):d;f!==t&&((u=o.current)==null||u.call(o,f))}else s(d)},[a,t,s,o]);return[c,l]}function E_({defaultProp:t,onChange:e}){const[n,i]=v.useState(t),r=v.useRef(n),s=v.useRef(e);return T_(()=>{s.current=e},[e]),v.useEffect(()=>{var o;r.current!==n&&((o=s.current)==null||o.call(s,n),r.current=n)},[n,r]),[n,i,s]}function P_(t){return typeof t=="function"}var R_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],et=R_.reduce((t,e)=>{const n=eo(`Primitive.${e}`),i=v.forwardRef((r,s)=>{const{asChild:o,...a}=r,c=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(c,{...a,ref:s})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function A_(t,e){t&&Wa.flushSync(()=>t.dispatchEvent(e))}var dx="Toggle",ux=v.forwardRef((t,e)=>{const{pressed:n,defaultPressed:i,onPressedChange:r,...s}=t,[o,a]=eu({prop:n,onChange:r,defaultProp:i??!1,caller:dx});return m.jsx(et.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:it(t.onClick,()=>{t.disabled||a(!o)})})});ux.displayName=dx;var I_=ux;const M_=rc(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function fx({className:t,variant:e,size:n,...i}){return m.jsx(I_,{"data-slot":"toggle",className:fe(M_({variant:e,size:n,className:t})),...i})}function __(t){const[e,n]=R.useState(()=>t.getPublishPermissions());return R.useEffect(()=>{const i=()=>{n(t.getPublishPermissions())},r=()=>{i()};return t.on("connection.connected",r),t.on("connection.disconnected",r),()=>{t.off("connection.connected",r),t.off("connection.disconnected",r)}},[t]),e}function N_(t){const[e,n]=R.useState(()=>t.getLocalParticipant()),[i,r]=R.useState(()=>t.getMicrophoneTrack());return R.useEffect(()=>{const s=()=>{const a=t.getLocalParticipant(),c=t.getMicrophoneTrack();console.log("🎤 useVoxketLocalParticipant: Updating state:",{hasParticipant:!!a,hasMicTrack:!!c,isMicEnabled:t.isMicrophoneEnabled,trackPublications:a?a.trackPublications.size:0}),n(a),r(c)};s(),t.on("connection.connected",s),t.on("connection.disconnected",s),t.on("track.muted",s),t.on("track.unmuted",s);const o=t.getRoom();if(o){const a=()=>{console.log("🎤 Track published, updating participant state"),s()},c=()=>{console.log("🎤 Track unpublished, updating participant state"),s()};return o.on("localTrackPublished",a),o.on("localTrackUnpublished",c),()=>{t.off("connection.connected",s),t.off("connection.disconnected",s),t.off("track.muted",s),t.off("track.unmuted",s),o.off("localTrackPublished",a),o.off("localTrackUnpublished",c)}}else return()=>{t.off("connection.connected",s),t.off("connection.disconnected",s),t.off("track.muted",s),t.off("track.unmuted",s)}},[t]),{localParticipant:e,microphoneTrack:i}}function xl(t,e,n){const[i,r]=R.useState(!1),[s,o]=R.useState(!1);return R.useEffect(()=>{const c=()=>{let l=!1;switch(e){case"microphone":l=t.isMicrophoneEnabled;break;case"camera":l=t.isCameraEnabled;break;case"screenShare":l=t.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${e} enabled state updated to:`,l),r(l)};return c(),t.on("track.muted",c),t.on("track.unmuted",c),t.on("connection.connected",c),()=>{t.off("track.muted",c),t.off("track.unmuted",c),t.off("connection.connected",c)}},[t,e]),{enabled:i,pending:s,toggle:async c=>{var l;try{o(!0);const d=c!==void 0?c:!i;switch(e){case"microphone":await t.toggleMicrophone(d);break;case"camera":await t.toggleCamera(d);break;case"screenShare":d?await t.startScreenShare():await t.stopScreenShare();break}}catch(d){(l=n==null?void 0:n.onDeviceError)==null||l.call(n,d)}finally{o(!1)}}}}function O_(t){const[e,n]=R.useState(()=>t.getRoom()),[i,r]=R.useState(()=>t.getConnectionState());return R.useEffect(()=>{const s=()=>{n(t.getRoom()),r(t.getConnectionState())};return t.on("connection.connected",s),t.on("connection.disconnected",s),t.on("connection.connecting",s),()=>{t.off("connection.connected",s),t.off("connection.disconnected",s),t.off("connection.connecting",s)}},[t]),e}function D_(t,e){const[n,i]=R.useState([]),[r,s]=R.useState("");return R.useEffect(()=>{var l;const a=async()=>{try{const d=e==="audioinput"?await t.getAudioInputDevices():await t.getVideoInputDevices();i(d)}catch(d){console.error("Failed to load devices:",d)}};a();const c=()=>{a()};return(l=navigator.mediaDevices)==null||l.addEventListener("devicechange",c),()=>{var d;(d=navigator.mediaDevices)==null||d.removeEventListener("devicechange",c)}},[t,e]),{devices:n,activeDeviceId:r,setActiveMediaDevice:async a=>{try{e==="audioinput"?await t.setAudioInputDevice(a):await t.setVideoInputDevice(a),s(a)}catch(c){console.error("Failed to set device:",c)}}}}function j_(t){const{preventSave:e=!1}=t||{};return{saveAudioInputEnabled:o=>{e||localStorage.setItem("voxket-audio-input-enabled",o.toString())},saveAudioInputDeviceId:o=>{e||localStorage.setItem("voxket-audio-input-device-id",o)},saveVideoInputEnabled:o=>{e||localStorage.setItem("voxket-video-input-enabled",o.toString())},saveVideoInputDeviceId:o=>{e||localStorage.setItem("voxket-video-input-device-id",o)}}}function dg(t,[e,n]){return Math.min(n,Math.max(e,t))}function Df(t,e=[]){let n=[];function i(s,o){const a=v.createContext(o),c=n.length;n=[...n,o];const l=u=>{var b;const{scope:f,children:p,...g}=u,h=((b=f==null?void 0:f[t])==null?void 0:b[c])||a,y=v.useMemo(()=>g,Object.values(g));return m.jsx(h.Provider,{value:y,children:p})};l.displayName=s+"Provider";function d(u,f){var h;const p=((h=f==null?void 0:f[t])==null?void 0:h[c])||a,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[l,d]}const r=()=>{const s=n.map(o=>v.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return v.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return r.scopeName=t,[i,L_(r,...e)]}function L_(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const i=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function V_(t){const e=t+"CollectionProvider",[n,i]=Df(e),[r,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:y,children:b}=h,w=R.useRef(null),C=R.useRef(new Map).current;return m.jsx(r,{scope:y,itemMap:C,collectionRef:w,children:b})};o.displayName=e;const a=t+"CollectionSlot",c=eo(a),l=R.forwardRef((h,y)=>{const{scope:b,children:w}=h,C=s(a,b),S=xt(y,C.collectionRef);return m.jsx(c,{ref:S,children:w})});l.displayName=a;const d=t+"CollectionItemSlot",u="data-radix-collection-item",f=eo(d),p=R.forwardRef((h,y)=>{const{scope:b,children:w,...C}=h,S=R.useRef(null),x=xt(y,S),T=s(d,b);return R.useEffect(()=>(T.itemMap.set(S,{ref:S,...C}),()=>void T.itemMap.delete(S))),m.jsx(f,{[u]:"",ref:x,children:w})});p.displayName=d;function g(h){const y=s(t+"CollectionConsumer",h);return R.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,E)=>C.indexOf(T.ref.current)-C.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},g,i]}var F_=v.createContext(void 0);function U_(t){const e=v.useContext(F_);return t||e||"ltr"}function Qi(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var i;return(i=e.current)==null?void 0:i.call(e,...n)},[])}function B_(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t);v.useEffect(()=>{const i=r=>{r.key==="Escape"&&n(r)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[n,e])}var $_="DismissableLayer",tu="dismissableLayer.update",H_="dismissableLayer.pointerDownOutside",z_="dismissableLayer.focusOutside",ug,hx=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mx=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=v.useContext(hx),[d,u]=v.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=xt(e,E=>u(E)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(y),w=d?h.indexOf(d):-1,C=l.layersWithOutsidePointerEventsDisabled.size>0,S=w>=b,x=K_(E=>{const P=E.target,_=[...l.branches].some(k=>k.contains(P));!S||_||(r==null||r(E),o==null||o(E),E.defaultPrevented||a==null||a())},f),T=G_(E=>{const P=E.target;[...l.branches].some(k=>k.contains(P))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},f);return B_(E=>{w===l.layers.size-1&&(i==null||i(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},f),v.useEffect(()=>{if(d)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(ug=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),fg(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=ug)}},[d,f,n,l]),v.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),fg())},[d,l]),v.useEffect(()=>{const E=()=>p({});return document.addEventListener(tu,E),()=>document.removeEventListener(tu,E)},[]),m.jsx(et.div,{...c,ref:g,style:{pointerEvents:C?S?"auto":"none":void 0,...t.style},onFocusCapture:it(t.onFocusCapture,T.onFocusCapture),onBlurCapture:it(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:it(t.onPointerDownCapture,x.onPointerDownCapture)})});mx.displayName=$_;var W_="DismissableLayerBranch",q_=v.forwardRef((t,e)=>{const n=v.useContext(hx),i=v.useRef(null),r=xt(e,i);return v.useEffect(()=>{const s=i.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(et.div,{...t,ref:r})});q_.displayName=W_;function K_(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t),i=v.useRef(!1),r=v.useRef(()=>{});return v.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let c=function(){px(H_,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=c,e.addEventListener("click",r.current,{once:!0})):c()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,n]),{onPointerDownCapture:()=>i.current=!0}}function G_(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t),i=v.useRef(!1);return v.useEffect(()=>{const r=s=>{s.target&&!i.current&&px(z_,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function fg(){const t=new CustomEvent(tu);document.dispatchEvent(t)}function px(t,e,n,{discrete:i}){const r=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),i?A_(r,s):r.dispatchEvent(s)}var Sl=0;function Z_(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??hg()),document.body.insertAdjacentElement("beforeend",t[1]??hg()),Sl++,()=>{Sl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Sl--}},[])}function hg(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var wl="focusScope.autoFocusOnMount",Cl="focusScope.autoFocusOnUnmount",mg={bubbles:!1,cancelable:!0},Y_="FocusScope",gx=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=t,[a,c]=v.useState(null),l=Qi(r),d=Qi(s),u=v.useRef(null),f=xt(e,h=>c(h)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(i){let h=function(C){if(p.paused||!a)return;const S=C.target;a.contains(S)?u.current=S:ai(u.current,{select:!0})},y=function(C){if(p.paused||!a)return;const S=C.relatedTarget;S!==null&&(a.contains(S)||ai(u.current,{select:!0}))},b=function(C){if(document.activeElement===document.body)for(const x of C)x.removedNodes.length>0&&ai(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),w.disconnect()}}},[i,a,p.paused]),v.useEffect(()=>{if(a){gg.add(p);const h=document.activeElement;if(!a.contains(h)){const b=new CustomEvent(wl,mg);a.addEventListener(wl,l),a.dispatchEvent(b),b.defaultPrevented||(J_(nN(vx(a)),{select:!0}),document.activeElement===h&&ai(a))}return()=>{a.removeEventListener(wl,l),setTimeout(()=>{const b=new CustomEvent(Cl,mg);a.addEventListener(Cl,d),a.dispatchEvent(b),b.defaultPrevented||ai(h??document.body,{select:!0}),a.removeEventListener(Cl,d),gg.remove(p)},0)}}},[a,l,d,p]);const g=v.useCallback(h=>{if(!n&&!i||p.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(y&&b){const w=h.currentTarget,[C,S]=X_(w);C&&S?!h.shiftKey&&b===S?(h.preventDefault(),n&&ai(C,{select:!0})):h.shiftKey&&b===C&&(h.preventDefault(),n&&ai(S,{select:!0})):b===w&&h.preventDefault()}},[n,i,p.paused]);return m.jsx(et.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});gx.displayName=Y_;function J_(t,{select:e=!1}={}){const n=document.activeElement;for(const i of t)if(ai(i,{select:e}),document.activeElement!==n)return}function X_(t){const e=vx(t),n=pg(e,t),i=pg(e.reverse(),t);return[n,i]}function vx(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function pg(t,e){for(const n of t)if(!Q_(n,{upTo:e}))return n}function Q_(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function eN(t){return t instanceof HTMLInputElement&&"select"in t}function ai(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&eN(t)&&e&&t.select()}}var gg=tN();function tN(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=vg(t,e),t.unshift(e)},remove(e){var n;t=vg(t,e),(n=t[0])==null||n.resume()}}}function vg(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}function nN(t){return t.filter(e=>e.tagName!=="A")}var iN=v[" useId ".trim().toString()]||(()=>{}),rN=0;function jf(t){const[e,n]=v.useState(iN());return Lt(()=>{n(i=>i??String(rN++))},[t]),t||(e?`radix-${e}`:"")}const sN=["top","right","bottom","left"],xi=Math.min,Ut=Math.max,ja=Math.round,Oo=Math.floor,Rn=t=>({x:t,y:t}),oN={left:"right",right:"left",bottom:"top",top:"bottom"},aN={start:"end",end:"start"};function nu(t,e,n){return Ut(t,xi(e,n))}function Xn(t,e){return typeof t=="function"?t(e):t}function Qn(t){return t.split("-")[0]}function ls(t){return t.split("-")[1]}function Lf(t){return t==="x"?"y":"x"}function Vf(t){return t==="y"?"height":"width"}const cN=new Set(["top","bottom"]);function kn(t){return cN.has(Qn(t))?"y":"x"}function Ff(t){return Lf(kn(t))}function lN(t,e,n){n===void 0&&(n=!1);const i=ls(t),r=Ff(t),s=Vf(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=La(o)),[o,La(o)]}function dN(t){const e=La(t);return[iu(t),e,iu(e)]}function iu(t){return t.replace(/start|end/g,e=>aN[e])}const yg=["left","right"],bg=["right","left"],uN=["top","bottom"],fN=["bottom","top"];function hN(t,e,n){switch(t){case"top":case"bottom":return n?e?bg:yg:e?yg:bg;case"left":case"right":return e?uN:fN;default:return[]}}function mN(t,e,n,i){const r=ls(t);let s=hN(Qn(t),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(iu)))),s}function La(t){return t.replace(/left|right|bottom|top/g,e=>oN[e])}function pN(t){return{top:0,right:0,bottom:0,left:0,...t}}function yx(t){return typeof t!="number"?pN(t):{top:t,right:t,bottom:t,left:t}}function Va(t){const{x:e,y:n,width:i,height:r}=t;return{width:i,height:r,top:n,left:e,right:e+i,bottom:n+r,x:e,y:n}}function xg(t,e,n){let{reference:i,floating:r}=t;const s=kn(e),o=Ff(e),a=Vf(o),c=Qn(e),l=s==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,f=i[a]/2-r[a]/2;let p;switch(c){case"top":p={x:d,y:i.y-r.height};break;case"bottom":p={x:d,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:u};break;case"left":p={x:i.x-r.width,y:u};break;default:p={x:i.x,y:i.y}}switch(ls(e)){case"start":p[o]-=f*(n&&l?-1:1);break;case"end":p[o]+=f*(n&&l?-1:1);break}return p}const gN=async(t,e,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:u}=xg(l,i,c),f=i,p={},g=0;for(let h=0;h<a.length;h++){const{name:y,fn:b}=a[h],{x:w,y:C,data:S,reset:x}=await b({x:d,y:u,initialPlacement:i,placement:f,strategy:r,middlewareData:p,rects:l,platform:o,elements:{reference:t,floating:e}});d=w??d,u=C??u,p={...p,[y]:{...p[y],...S}},x&&g<=50&&(g++,typeof x=="object"&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:r}):x.rects),{x:d,y:u}=xg(l,f,c)),h=-1)}return{x:d,y:u,placement:f,strategy:r,middlewareData:p}};async function to(t,e){var n;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:o,elements:a,strategy:c}=t,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Xn(e,t),g=yx(p),y=a[f?u==="floating"?"reference":"floating":u],b=Va(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),w=u==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},x=Va(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:C,strategy:c}):w);return{top:(b.top-x.top+g.top)/S.y,bottom:(x.bottom-b.bottom+g.bottom)/S.y,left:(b.left-x.left+g.left)/S.x,right:(x.right-b.right+g.right)/S.x}}const vN=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:d=0}=Xn(t,e)||{};if(l==null)return{};const u=yx(d),f={x:n,y:i},p=Ff(r),g=Vf(p),h=await o.getDimensions(l),y=p==="y",b=y?"top":"left",w=y?"bottom":"right",C=y?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-f[p]-s.floating[g],x=f[p]-s.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let E=T?T[C]:0;(!E||!await(o.isElement==null?void 0:o.isElement(T)))&&(E=a.floating[C]||s.floating[g]);const P=S/2-x/2,_=E/2-h[g]/2-1,k=xi(u[b],_),I=xi(u[w],_),N=k,K=E-h[g]-I,J=E/2-h[g]/2+P,se=nu(N,J,K),ie=!c.arrow&&ls(r)!=null&&J!==se&&s.reference[g]/2-(J<N?k:I)-h[g]/2<0,X=ie?J<N?J-N:J-K:0;return{[p]:f[p]+X,data:{[p]:se,centerOffset:J-se-X,...ie&&{alignmentOffset:X}},reset:ie}}}),yN=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:l}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...y}=Xn(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Qn(r),w=kn(a),C=Qn(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=f||(C||!h?[La(a)]:dN(a)),T=g!=="none";!f&&T&&x.push(...mN(a,h,g,S));const E=[a,...x],P=await to(e,y),_=[];let k=((i=s.flip)==null?void 0:i.overflows)||[];if(d&&_.push(P[b]),u){const J=lN(r,o,S);_.push(P[J[0]],P[J[1]])}if(k=[...k,{placement:r,overflows:_}],!_.every(J=>J<=0)){var I,N;const J=(((I=s.flip)==null?void 0:I.index)||0)+1,se=E[J];if(se&&(!(u==="alignment"?w!==kn(se):!1)||k.every(O=>O.overflows[0]>0&&kn(O.placement)===w)))return{data:{index:J,overflows:k},reset:{placement:se}};let ie=(N=k.filter(X=>X.overflows[0]<=0).sort((X,O)=>X.overflows[1]-O.overflows[1])[0])==null?void 0:N.placement;if(!ie)switch(p){case"bestFit":{var K;const X=(K=k.filter(O=>{if(T){const oe=kn(O.placement);return oe===w||oe==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(oe=>oe>0).reduce((oe,L)=>oe+L,0)]).sort((O,oe)=>O[1]-oe[1])[0])==null?void 0:K[0];X&&(ie=X);break}case"initialPlacement":ie=a;break}if(r!==ie)return{reset:{placement:ie}}}return{}}}};function Sg(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function wg(t){return sN.some(e=>t[e]>=0)}const bN=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:i="referenceHidden",...r}=Xn(t,e);switch(i){case"referenceHidden":{const s=await to(e,{...r,elementContext:"reference"}),o=Sg(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:wg(o)}}}case"escaped":{const s=await to(e,{...r,altBoundary:!0}),o=Sg(s,n.floating);return{data:{escapedOffsets:o,escaped:wg(o)}}}default:return{}}}}},bx=new Set(["left","top"]);async function xN(t,e){const{placement:n,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Qn(n),a=ls(n),c=kn(n)==="y",l=bx.has(o)?-1:1,d=s&&c?-1:1,u=Xn(e,t);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}const SN=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:r,y:s,placement:o,middlewareData:a}=e,c=await xN(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:o}}}}},wN=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...c}=Xn(t,e),l={x:n,y:i},d=await to(e,c),u=kn(Qn(r)),f=Lf(u);let p=l[f],g=l[u];if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=p+d[y],C=p-d[b];p=nu(w,p,C)}if(o){const y=u==="y"?"top":"left",b=u==="y"?"bottom":"right",w=g+d[y],C=g-d[b];g=nu(w,g,C)}const h=a.fn({...e,[f]:p,[u]:g});return{...h,data:{x:h.x-n,y:h.y-i,enabled:{[f]:s,[u]:o}}}}}},CN=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=Xn(t,e),d={x:n,y:i},u=kn(r),f=Lf(u);let p=d[f],g=d[u];const h=Xn(a,e),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const C=f==="y"?"height":"width",S=s.reference[f]-s.floating[C]+y.mainAxis,x=s.reference[f]+s.reference[C]-y.mainAxis;p<S?p=S:p>x&&(p=x)}if(l){var b,w;const C=f==="y"?"width":"height",S=bx.has(Qn(r)),x=s.reference[u]-s.floating[C]+(S&&((b=o.offset)==null?void 0:b[u])||0)+(S?0:y.crossAxis),T=s.reference[u]+s.reference[C]+(S?0:((w=o.offset)==null?void 0:w[u])||0)-(S?y.crossAxis:0);g<x?g=x:g>T&&(g=T)}return{[f]:p,[u]:g}}}},kN=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:r,rects:s,platform:o,elements:a}=e,{apply:c=()=>{},...l}=Xn(t,e),d=await to(e,l),u=Qn(r),f=ls(r),p=kn(r)==="y",{width:g,height:h}=s.floating;let y,b;u==="top"||u==="bottom"?(y=u,b=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,y=f==="end"?"top":"bottom");const w=h-d.top-d.bottom,C=g-d.left-d.right,S=xi(h-d[y],w),x=xi(g-d[b],C),T=!e.middlewareData.shift;let E=S,P=x;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=C),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(E=w),T&&!f){const k=Ut(d.left,0),I=Ut(d.right,0),N=Ut(d.top,0),K=Ut(d.bottom,0);p?P=g-2*(k!==0||I!==0?k+I:Ut(d.left,d.right)):E=h-2*(N!==0||K!==0?N+K:Ut(d.top,d.bottom))}await c({...e,availableWidth:P,availableHeight:E});const _=await o.getDimensions(a.floating);return g!==_.width||h!==_.height?{reset:{rects:!0}}:{}}}};function sc(){return typeof window<"u"}function ds(t){return xx(t)?(t.nodeName||"").toLowerCase():"#document"}function Ht(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Dn(t){var e;return(e=(xx(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function xx(t){return sc()?t instanceof Node||t instanceof Ht(t).Node:!1}function hn(t){return sc()?t instanceof Element||t instanceof Ht(t).Element:!1}function _n(t){return sc()?t instanceof HTMLElement||t instanceof Ht(t).HTMLElement:!1}function Cg(t){return!sc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ht(t).ShadowRoot}const TN=new Set(["inline","contents"]);function po(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=mn(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!TN.has(r)}const EN=new Set(["table","td","th"]);function PN(t){return EN.has(ds(t))}const RN=[":popover-open",":modal"];function oc(t){return RN.some(e=>{try{return t.matches(e)}catch{return!1}})}const AN=["transform","translate","scale","rotate","perspective"],IN=["transform","translate","scale","rotate","perspective","filter"],MN=["paint","layout","strict","content"];function Uf(t){const e=Bf(),n=hn(t)?mn(t):t;return AN.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||IN.some(i=>(n.willChange||"").includes(i))||MN.some(i=>(n.contain||"").includes(i))}function _N(t){let e=Si(t);for(;_n(e)&&!Xr(e);){if(Uf(e))return e;if(oc(e))return null;e=Si(e)}return null}function Bf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const NN=new Set(["html","body","#document"]);function Xr(t){return NN.has(ds(t))}function mn(t){return Ht(t).getComputedStyle(t)}function ac(t){return hn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Si(t){if(ds(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Cg(t)&&t.host||Dn(t);return Cg(e)?e.host:e}function Sx(t){const e=Si(t);return Xr(e)?t.ownerDocument?t.ownerDocument.body:t.body:_n(e)&&po(e)?e:Sx(e)}function no(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Sx(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),o=Ht(r);if(s){const a=ru(o);return e.concat(o,o.visualViewport||[],po(r)?r:[],a&&n?no(a):[])}return e.concat(r,no(r,[],n))}function ru(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function wx(t){const e=mn(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=_n(t),s=r?t.offsetWidth:n,o=r?t.offsetHeight:i,a=ja(n)!==s||ja(i)!==o;return a&&(n=s,i=o),{width:n,height:i,$:a}}function $f(t){return hn(t)?t:t.contextElement}function Br(t){const e=$f(t);if(!_n(e))return Rn(1);const n=e.getBoundingClientRect(),{width:i,height:r,$:s}=wx(e);let o=(s?ja(n.width):n.width)/i,a=(s?ja(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const ON=Rn(0);function Cx(t){const e=Ht(t);return!Bf()||!e.visualViewport?ON:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function DN(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ht(t)?!1:e}function er(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=$f(t);let o=Rn(1);e&&(i?hn(i)&&(o=Br(i)):o=Br(t));const a=DN(s,n,i)?Cx(s):Rn(0);let c=(r.left+a.x)/o.x,l=(r.top+a.y)/o.y,d=r.width/o.x,u=r.height/o.y;if(s){const f=Ht(s),p=i&&hn(i)?Ht(i):i;let g=f,h=ru(g);for(;h&&i&&p!==g;){const y=Br(h),b=h.getBoundingClientRect(),w=mn(h),C=b.left+(h.clientLeft+parseFloat(w.paddingLeft))*y.x,S=b.top+(h.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,l*=y.y,d*=y.x,u*=y.y,c+=C,l+=S,g=Ht(h),h=ru(g)}}return Va({width:d,height:u,x:c,y:l})}function Hf(t,e){const n=ac(t).scrollLeft;return e?e.left+n:er(Dn(t)).left+n}function kx(t,e,n){n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=i.left+e.scrollLeft-(n?0:Hf(t,i)),s=i.top+e.scrollTop;return{x:r,y:s}}function jN(t){let{elements:e,rect:n,offsetParent:i,strategy:r}=t;const s=r==="fixed",o=Dn(i),a=e?oc(e.floating):!1;if(i===o||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=Rn(1);const d=Rn(0),u=_n(i);if((u||!u&&!s)&&((ds(i)!=="body"||po(o))&&(c=ac(i)),_n(i))){const p=er(i);l=Br(i),d.x=p.x+i.clientLeft,d.y=p.y+i.clientTop}const f=o&&!u&&!s?kx(o,c,!0):Rn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:n.y*l.y-c.scrollTop*l.y+d.y+f.y}}function LN(t){return Array.from(t.getClientRects())}function VN(t){const e=Dn(t),n=ac(t),i=t.ownerDocument.body,r=Ut(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Ut(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-n.scrollLeft+Hf(t);const a=-n.scrollTop;return mn(i).direction==="rtl"&&(o+=Ut(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function FN(t,e){const n=Ht(t),i=Dn(t),r=n.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,c=0;if(r){s=r.width,o=r.height;const l=Bf();(!l||l&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}return{width:s,height:o,x:a,y:c}}const UN=new Set(["absolute","fixed"]);function BN(t,e){const n=er(t,!0,e==="fixed"),i=n.top+t.clientTop,r=n.left+t.clientLeft,s=_n(t)?Br(t):Rn(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,c=r*s.x,l=i*s.y;return{width:o,height:a,x:c,y:l}}function kg(t,e,n){let i;if(e==="viewport")i=FN(t,n);else if(e==="document")i=VN(Dn(t));else if(hn(e))i=BN(e,n);else{const r=Cx(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Va(i)}function Tx(t,e){const n=Si(t);return n===e||!hn(n)||Xr(n)?!1:mn(n).position==="fixed"||Tx(n,e)}function $N(t,e){const n=e.get(t);if(n)return n;let i=no(t,[],!1).filter(a=>hn(a)&&ds(a)!=="body"),r=null;const s=mn(t).position==="fixed";let o=s?Si(t):t;for(;hn(o)&&!Xr(o);){const a=mn(o),c=Uf(o);!c&&a.position==="fixed"&&(r=null),(s?!c&&!r:!c&&a.position==="static"&&!!r&&UN.has(r.position)||po(o)&&!c&&Tx(t,o))?i=i.filter(d=>d!==o):r=a,o=Si(o)}return e.set(t,i),i}function HN(t){let{element:e,boundary:n,rootBoundary:i,strategy:r}=t;const o=[...n==="clippingAncestors"?oc(e)?[]:$N(e,this._c):[].concat(n),i],a=o[0],c=o.reduce((l,d)=>{const u=kg(e,d,r);return l.top=Ut(u.top,l.top),l.right=xi(u.right,l.right),l.bottom=xi(u.bottom,l.bottom),l.left=Ut(u.left,l.left),l},kg(e,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function zN(t){const{width:e,height:n}=wx(t);return{width:e,height:n}}function WN(t,e,n){const i=_n(e),r=Dn(e),s=n==="fixed",o=er(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=Rn(0);function l(){c.x=Hf(r)}if(i||!i&&!s)if((ds(e)!=="body"||po(r))&&(a=ac(e)),i){const p=er(e,!0,s,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else r&&l();s&&!i&&r&&l();const d=r&&!i&&!s?kx(r,a):Rn(0),u=o.left+a.scrollLeft-c.x-d.x,f=o.top+a.scrollTop-c.y-d.y;return{x:u,y:f,width:o.width,height:o.height}}function kl(t){return mn(t).position==="static"}function Tg(t,e){if(!_n(t)||mn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Dn(t)===n&&(n=n.ownerDocument.body),n}function Ex(t,e){const n=Ht(t);if(oc(t))return n;if(!_n(t)){let r=Si(t);for(;r&&!Xr(r);){if(hn(r)&&!kl(r))return r;r=Si(r)}return n}let i=Tg(t,e);for(;i&&PN(i)&&kl(i);)i=Tg(i,e);return i&&Xr(i)&&kl(i)&&!Uf(i)?n:i||_N(t)||n}const qN=async function(t){const e=this.getOffsetParent||Ex,n=this.getDimensions,i=await n(t.floating);return{reference:WN(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function KN(t){return mn(t).direction==="rtl"}const GN={convertOffsetParentRelativeRectToViewportRelativeRect:jN,getDocumentElement:Dn,getClippingRect:HN,getOffsetParent:Ex,getElementRects:qN,getClientRects:LN,getDimensions:zN,getScale:Br,isElement:hn,isRTL:KN};function Px(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ZN(t,e){let n=null,i;const r=Dn(t);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=t.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(a||e(),!f||!p)return;const g=Oo(u),h=Oo(r.clientWidth-(d+f)),y=Oo(r.clientHeight-(u+p)),b=Oo(d),C={rootMargin:-g+"px "+-h+"px "+-y+"px "+-b+"px",threshold:Ut(0,xi(1,c))||1};let S=!0;function x(T){const E=T[0].intersectionRatio;if(E!==c){if(!S)return o();E?o(!1,E):i=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!Px(l,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(x,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(x,C)}n.observe(t)}return o(!0),s}function YN(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=$f(t),d=r||s?[...l?no(l):[],...no(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const u=l&&a?ZN(l,n):null;let f=-1,p=null;o&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(e)})),n()}),l&&!c&&p.observe(l),p.observe(e));let g,h=c?er(t):null;c&&y();function y(){const b=er(t);h&&!Px(h,b)&&n(),h=b,g=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(w=>{r&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),u==null||u(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const JN=SN,XN=wN,QN=yN,eO=kN,tO=bN,Eg=vN,nO=CN,iO=(t,e,n)=>{const i=new Map,r={platform:GN,...n},s={...r.platform,_c:i};return gN(t,e,{...r,platform:s})};var rO=typeof document<"u",sO=function(){},ua=rO?R.useLayoutEffect:sO;function Fa(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!Fa(t[i],e[i]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!(s==="_owner"&&t.$$typeof)&&!Fa(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Rx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Pg(t,e){const n=Rx(t);return Math.round(e*n)/n}function Tl(t){const e=v.useRef(t);return ua(()=>{e.current=t}),e}function oO(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[d,u]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(i);Fa(f,i)||p(i);const[g,h]=v.useState(null),[y,b]=v.useState(null),w=v.useCallback(O=>{O!==T.current&&(T.current=O,h(O))},[]),C=v.useCallback(O=>{O!==E.current&&(E.current=O,b(O))},[]),S=s||g,x=o||y,T=v.useRef(null),E=v.useRef(null),P=v.useRef(d),_=c!=null,k=Tl(c),I=Tl(r),N=Tl(l),K=v.useCallback(()=>{if(!T.current||!E.current)return;const O={placement:e,strategy:n,middleware:f};I.current&&(O.platform=I.current),iO(T.current,E.current,O).then(oe=>{const L={...oe,isPositioned:N.current!==!1};J.current&&!Fa(P.current,L)&&(P.current=L,Wa.flushSync(()=>{u(L)}))})},[f,e,n,I,N]);ua(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[l]);const J=v.useRef(!1);ua(()=>(J.current=!0,()=>{J.current=!1}),[]),ua(()=>{if(S&&(T.current=S),x&&(E.current=x),S&&x){if(k.current)return k.current(S,x,K);K()}},[S,x,K,k,_]);const se=v.useMemo(()=>({reference:T,floating:E,setReference:w,setFloating:C}),[w,C]),ie=v.useMemo(()=>({reference:S,floating:x}),[S,x]),X=v.useMemo(()=>{const O={position:n,left:0,top:0};if(!ie.floating)return O;const oe=Pg(ie.floating,d.x),L=Pg(ie.floating,d.y);return a?{...O,transform:"translate("+oe+"px, "+L+"px)",...Rx(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:oe,top:L}},[n,a,ie.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:K,refs:se,elements:ie,floatingStyles:X}),[d,K,se,ie,X])}const aO=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:r}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?Eg({element:i.current,padding:r}).fn(n):{}:i?Eg({element:i,padding:r}).fn(n):{}}}},cO=(t,e)=>({...JN(t),options:[t,e]}),lO=(t,e)=>({...XN(t),options:[t,e]}),dO=(t,e)=>({...nO(t),options:[t,e]}),uO=(t,e)=>({...QN(t),options:[t,e]}),fO=(t,e)=>({...eO(t),options:[t,e]}),hO=(t,e)=>({...tO(t),options:[t,e]}),mO=(t,e)=>({...aO(t),options:[t,e]});var pO="Arrow",Ax=v.forwardRef((t,e)=>{const{children:n,width:i=10,height:r=5,...s}=t;return m.jsx(et.svg,{...s,ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ax.displayName=pO;var gO=Ax;function vO(t){const[e,n]=v.useState(void 0);return Lt(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}var zf="Popper",[Ix,Mx]=Df(zf),[yO,_x]=Ix(zf),Nx=t=>{const{__scopePopper:e,children:n}=t,[i,r]=v.useState(null);return m.jsx(yO,{scope:e,anchor:i,onAnchorChange:r,children:n})};Nx.displayName=zf;var Ox="PopperAnchor",Dx=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...r}=t,s=_x(Ox,n),o=v.useRef(null),a=xt(e,o);return v.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:m.jsx(et.div,{...r,ref:a})});Dx.displayName=Ox;var Wf="PopperContent",[bO,xO]=Ix(Wf),jx=v.forwardRef((t,e)=>{var D,$,Q,W,ce,z;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:g,...h}=t,y=_x(Wf,n),[b,w]=v.useState(null),C=xt(e,me=>w(me)),[S,x]=v.useState(null),T=vO(S),E=(T==null?void 0:T.width)??0,P=(T==null?void 0:T.height)??0,_=i+(s!=="center"?"-"+s:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(l)?l:[l],N=I.length>0,K={padding:k,boundary:I.filter(wO),altBoundary:N},{refs:J,floatingStyles:se,placement:ie,isPositioned:X,middlewareData:O}=oO({strategy:"fixed",placement:_,whileElementsMounted:(...me)=>YN(...me,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[cO({mainAxis:r+P,alignmentAxis:o}),c&&lO({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?dO():void 0,...K}),c&&uO({...K}),fO({...K,apply:({elements:me,rects:Ee,availableWidth:qe,availableHeight:Ct})=>{const{width:gn,height:vn}=Ee.reference,Et=me.floating.style;Et.setProperty("--radix-popper-available-width",`${qe}px`),Et.setProperty("--radix-popper-available-height",`${Ct}px`),Et.setProperty("--radix-popper-anchor-width",`${gn}px`),Et.setProperty("--radix-popper-anchor-height",`${vn}px`)}}),S&&mO({element:S,padding:a}),CO({arrowWidth:E,arrowHeight:P}),f&&hO({strategy:"referenceHidden",...K})]}),[oe,L]=Fx(ie),F=Qi(g);Lt(()=>{X&&(F==null||F())},[X,F]);const te=(D=O.arrow)==null?void 0:D.x,j=($=O.arrow)==null?void 0:$.y,q=((Q=O.arrow)==null?void 0:Q.centerOffset)!==0,[ee,G]=v.useState();return Lt(()=>{b&&G(window.getComputedStyle(b).zIndex)},[b]),m.jsx("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:X?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(W=O.transformOrigin)==null?void 0:W.x,(ce=O.transformOrigin)==null?void 0:ce.y].join(" "),...((z=O.hide)==null?void 0:z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:m.jsx(bO,{scope:n,placedSide:oe,onArrowChange:x,arrowX:te,arrowY:j,shouldHideArrow:q,children:m.jsx(et.div,{"data-side":oe,"data-align":L,...h,ref:C,style:{...h.style,animation:X?void 0:"none"}})})})});jx.displayName=Wf;var Lx="PopperArrow",SO={top:"bottom",right:"left",bottom:"top",left:"right"},Vx=v.forwardRef(function(e,n){const{__scopePopper:i,...r}=e,s=xO(Lx,i),o=SO[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(gO,{...r,ref:n,style:{...r.style,display:"block"}})})});Vx.displayName=Lx;function wO(t){return t!==null}var CO=t=>({name:"transformOrigin",options:t,fn(e){var y,b,w;const{placement:n,rects:i,middlewareData:r}=e,o=((y=r.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[l,d]=Fx(n),u={start:"0%",center:"50%",end:"100%"}[d],f=(((b=r.arrow)==null?void 0:b.x)??0)+a/2,p=(((w=r.arrow)==null?void 0:w.y)??0)+c/2;let g="",h="";return l==="bottom"?(g=o?u:`${f}px`,h=`${-c}px`):l==="top"?(g=o?u:`${f}px`,h=`${i.floating.height+c}px`):l==="right"?(g=`${-c}px`,h=o?u:`${p}px`):l==="left"&&(g=`${i.floating.width+c}px`,h=o?u:`${p}px`),{data:{x:g,y:h}}}});function Fx(t){const[e,n="center"]=t.split("-");return[e,n]}var kO=Nx,TO=Dx,EO=jx,PO=Vx,RO="Portal",Ux=v.forwardRef((t,e)=>{var a;const{container:n,...i}=t,[r,s]=v.useState(!1);Lt(()=>s(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?xu.createPortal(m.jsx(et.div,{...i,ref:e}),o):null});Ux.displayName=RO;function AO(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Bx=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IO="VisuallyHidden",MO=v.forwardRef((t,e)=>m.jsx(et.span,{...t,ref:e,style:{...Bx,...t.style}}));MO.displayName=IO;var _O=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},hr=new WeakMap,Do=new WeakMap,jo={},El=0,$x=function(t){return t&&(t.host||$x(t.parentNode))},NO=function(t,e){return e.map(function(n){if(t.contains(n))return n;var i=$x(n);return i&&t.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},OO=function(t,e,n,i){var r=NO(e,Array.isArray(t)?t:[t]);jo[n]||(jo[n]=new WeakMap);var s=jo[n],o=[],a=new Set,c=new Set(r),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};r.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(f){if(a.has(f))d(f);else try{var p=f.getAttribute(i),g=p!==null&&p!=="false",h=(hr.get(f)||0)+1,y=(s.get(f)||0)+1;hr.set(f,h),s.set(f,y),o.push(f),h===1&&g&&Do.set(f,!0),y===1&&f.setAttribute(n,"true"),g||f.setAttribute(i,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return d(e),a.clear(),El++,function(){o.forEach(function(u){var f=hr.get(u)-1,p=s.get(u)-1;hr.set(u,f),s.set(u,p),f||(Do.has(u)||u.removeAttribute(i),Do.delete(u)),p||u.removeAttribute(n)}),El--,El||(hr=new WeakMap,hr=new WeakMap,Do=new WeakMap,jo={})}},DO=function(t,e,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),r=_O(t);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),OO(i,r,n,"aria-hidden")):function(){return null}},Cn=function(){return Cn=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Cn.apply(this,arguments)};function Hx(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function jO(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}var fa="right-scroll-bar-position",ha="width-before-scroll-bar",LO="with-scroll-bars-hidden",VO="--removed-body-scroll-bar-size";function Pl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function FO(t,e){var n=R.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(i){var r=n.value;r!==i&&(n.value=i,n.callback(i,r))}}}})[0];return n.callback=e,n.facade}var UO=typeof window<"u"?v.useLayoutEffect:v.useEffect,Rg=new WeakMap;function BO(t,e){var n=FO(null,function(i){return t.forEach(function(r){return Pl(r,i)})});return UO(function(){var i=Rg.get(n);if(i){var r=new Set(i),s=new Set(t),o=n.current;r.forEach(function(a){s.has(a)||Pl(a,null)}),s.forEach(function(a){r.has(a)||Pl(a,o)})}Rg.set(n,t)},[t]),n}function $O(t){return t}function HO(t,e){e===void 0&&(e=$O);var n=[],i=!1,r={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,i);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(i=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){i=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var c=function(){var d=o;o=[],d.forEach(s)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(d){o.push(d),l()},filter:function(d){return o=o.filter(d),n}}}};return r}function zO(t){t===void 0&&(t={});var e=HO(null);return e.options=Cn({async:!0,ssr:!1},t),e}var zx=function(t){var e=t.sideCar,n=Hx(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=e.read();if(!i)throw new Error("Sidecar medium not found");return v.createElement(i,Cn({},n))};zx.isSideCarExport=!0;function WO(t,e){return t.useMedium(e),zx}var Wx=zO(),Rl=function(){},cc=v.forwardRef(function(t,e){var n=v.useRef(null),i=v.useState({onScrollCapture:Rl,onWheelCapture:Rl,onTouchMoveCapture:Rl}),r=i[0],s=i[1],o=t.forwardProps,a=t.children,c=t.className,l=t.removeScrollBar,d=t.enabled,u=t.shards,f=t.sideCar,p=t.noRelative,g=t.noIsolation,h=t.inert,y=t.allowPinchZoom,b=t.as,w=b===void 0?"div":b,C=t.gapMode,S=Hx(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,T=BO([n,e]),E=Cn(Cn({},S),r);return v.createElement(v.Fragment,null,d&&v.createElement(x,{sideCar:Wx,removeScrollBar:l,shards:u,noRelative:p,noIsolation:g,inert:h,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:C}),o?v.cloneElement(v.Children.only(a),Cn(Cn({},E),{ref:T})):v.createElement(w,Cn({},E,{className:c,ref:T}),a))});cc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cc.classNames={fullWidth:ha,zeroRight:fa};var qO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function KO(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=qO();return e&&t.setAttribute("nonce",e),t}function GO(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ZO(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var YO=function(){var t=0,e=null;return{add:function(n){t==0&&(e=KO())&&(GO(e,n),ZO(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},JO=function(){var t=YO();return function(e,n){v.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},qx=function(){var t=JO(),e=function(n){var i=n.styles,r=n.dynamic;return t(i,r),null};return e},XO={left:0,top:0,right:0,gap:0},Al=function(t){return parseInt(t||"",10)||0},QO=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],i=e[t==="padding"?"paddingTop":"marginTop"],r=e[t==="padding"?"paddingRight":"marginRight"];return[Al(n),Al(i),Al(r)]},e8=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return XO;var e=QO(t),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-n+e[2]-e[0])}},t8=qx(),$r="data-scroll-locked",n8=function(t,e,n,i){var r=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
78
+ .`.concat(LO,` {
79
+ overflow: hidden `).concat(i,`;
80
+ padding-right: `).concat(a,"px ").concat(i,`;
42
81
  }
43
- body[`).concat(hn,`] {
44
- overflow: hidden `).concat(s,`;
82
+ body[`).concat($r,`] {
83
+ overflow: hidden `).concat(i,`;
45
84
  overscroll-behavior: contain;
46
- `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
85
+ `).concat([e&&"position: relative ".concat(i,";"),n==="margin"&&`
47
86
  padding-left: `.concat(r,`px;
48
- padding-top: `).concat(i,`px;
87
+ padding-top: `).concat(s,`px;
49
88
  padding-right: `).concat(o,`px;
50
89
  margin-left:0;
51
90
  margin-top:0;
52
- margin-right: `).concat(a,"px ").concat(s,`;
53
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
91
+ margin-right: `).concat(a,"px ").concat(i,`;
92
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(i,";")].filter(Boolean).join(""),`
54
93
  }
55
94
 
56
- .`).concat(ws,` {
57
- right: `).concat(a,"px ").concat(s,`;
95
+ .`).concat(fa,` {
96
+ right: `).concat(a,"px ").concat(i,`;
58
97
  }
59
98
 
60
- .`).concat(Ss,` {
61
- margin-right: `).concat(a,"px ").concat(s,`;
99
+ .`).concat(ha,` {
100
+ margin-right: `).concat(a,"px ").concat(i,`;
62
101
  }
63
102
 
64
- .`).concat(ws," .").concat(ws,` {
65
- right: 0 `).concat(s,`;
103
+ .`).concat(fa," .").concat(fa,` {
104
+ right: 0 `).concat(i,`;
66
105
  }
67
106
 
68
- .`).concat(Ss," .").concat(Ss,` {
69
- margin-right: 0 `).concat(s,`;
107
+ .`).concat(ha," .").concat(ha,` {
108
+ margin-right: 0 `).concat(i,`;
70
109
  }
71
110
 
72
- body[`).concat(hn,`] {
73
- `).concat(Hy,": ").concat(a,`px;
111
+ body[`).concat($r,`] {
112
+ `).concat(VO,": ").concat(a,`px;
74
113
  }
75
- `)},ml=function(){var e=parseInt(document.body.getAttribute(hn)||"0",10);return isFinite(e)?e:0},av=function(){f.useEffect(function(){return document.body.setAttribute(hn,(ml()+1).toString()),function(){var e=ml()-1;e<=0?document.body.removeAttribute(hn):document.body.setAttribute(hn,e.toString())}},[])},lv=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;av();var i=f.useMemo(function(){return rv(r)},[r]);return f.createElement(ov,{styles:iv(i,!t,r,n?"":"!important")})},co=!1;if(typeof window<"u")try{var hs=Object.defineProperty({},"passive",{get:function(){return co=!0,!0}});window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{co=!1}var Qt=co?{passive:!1}:!1,cv=function(e){return e.tagName==="TEXTAREA"},gu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cv(e)&&n[t]==="visible")},dv=function(e){return gu(e,"overflowY")},uv=function(e){return gu(e,"overflowX")},pl=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=xu(e,s);if(r){var i=yu(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},fv=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},hv=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},xu=function(e,t){return e==="v"?dv(t):uv(t)},yu=function(e,t){return e==="v"?fv(t):hv(t)},mv=function(e,t){return e==="h"&&t==="rtl"?-1:1},pv=function(e,t,n,s,r){var i=mv(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,l=t.contains(a),d=!1,u=o>0,h=0,m=0;do{if(!a)break;var g=yu(e,a),x=g[0],p=g[1],v=g[2],b=p-v-i*x;(x||b)&&xu(e,a)&&(h+=b,m+=x);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(h)<1||!u&&Math.abs(m)<1)&&(d=!0),d},ms=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gl=function(e){return[e.deltaX,e.deltaY]},xl=function(e){return e&&"current"in e?e.current:e},gv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},xv=function(e){return`
76
- .block-interactivity-`.concat(e,` {pointer-events: none;}
77
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
78
- `)},yv=0,en=[];function vv(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),r=f.useState(yv++)[0],i=f.useState(pu)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var p=$y([e.lockRef.current],(e.shards||[]).map(xl),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=ms(p),y=n.current,w="deltaX"in p?p.deltaX:y[0]-b[0],S="deltaY"in p?p.deltaY:y[1]-b[1],k,T=p.target,A=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in p&&A==="h"&&T.type==="range")return!1;var j=pl(A,T);if(!j)return!0;if(j?k=A:(k=A==="v"?"h":"v",j=pl(A,T)),!j)return!1;if(!s.current&&"changedTouches"in p&&(w||S)&&(s.current=k),!k)return!0;var V=s.current||k;return pv(V,v,p,V==="h"?w:S)},[]),l=f.useCallback(function(p){var v=p;if(!(!en.length||en[en.length-1]!==i)){var b="deltaY"in v?gl(v):ms(v),y=t.current.filter(function(k){return k.name===v.type&&(k.target===v.target||v.target===k.shadowParent)&&gv(k.delta,b)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(xl).filter(Boolean).filter(function(k){return k.contains(v.target)}),S=w.length>0?a(v,w[0]):!o.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),d=f.useCallback(function(p,v,b,y){var w={name:p,delta:v,target:b,should:y,shadowParent:bv(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),u=f.useCallback(function(p){n.current=ms(p),s.current=void 0},[]),h=f.useCallback(function(p){d(p.type,gl(p),p.target,a(p,e.lockRef.current))},[]),m=f.useCallback(function(p){d(p.type,ms(p),p.target,a(p,e.lockRef.current))},[]);f.useEffect(function(){return en.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Qt),document.addEventListener("touchmove",l,Qt),document.addEventListener("touchstart",u,Qt),function(){en=en.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Qt),document.removeEventListener("touchmove",l,Qt),document.removeEventListener("touchstart",u,Qt)}},[]);var g=e.removeScrollBar,x=e.inert;return f.createElement(f.Fragment,null,x?f.createElement(i,{styles:xv(r)}):null,g?f.createElement(lv,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wv=Gy(mu,vv);var vu=f.forwardRef(function(e,t){return f.createElement(zs,it({},e,{ref:t,sideCar:wv}))});vu.classNames=zs.classNames;var Sv=[" ","Enter","ArrowUp","ArrowDown"],Cv=[" ","Enter"],Zt="Select",[Zs,Ws,Ev]=H1(Zt),[An,gw]=ni(Zt,[Ev,eu]),Ks=eu(),[kv,Mt]=An(Zt),[Av,Tv]=An(Zt),bu=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:u,autoComplete:h,disabled:m,required:g,form:x}=e,p=Ks(t),[v,b]=f.useState(null),[y,w]=f.useState(null),[S,k]=f.useState(!1),T=z1(d),[A,j]=ro({prop:s,defaultProp:r??!1,onChange:i,caller:Zt}),[V,I]=ro({prop:o,defaultProp:a,onChange:l,caller:Zt}),$=f.useRef(null),F=v?x||!!v.closest("form"):!0,[se,Z]=f.useState(new Set),ee=Array.from(se).map(G=>G.props.value).join(";");return c.jsx(jy,{...p,children:c.jsxs(kv,{required:g,scope:t,trigger:v,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:si(),value:V,onValueChange:I,open:A,onOpenChange:j,dir:T,triggerPointerDownPosRef:$,disabled:m,children:[c.jsx(Zs.Provider,{scope:t,children:c.jsx(Av,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(G=>{Z(O=>new Set(O).add(G))},[]),onNativeOptionRemove:f.useCallback(G=>{Z(O=>{const P=new Set(O);return P.delete(G),P})},[]),children:n})}),F?c.jsxs(Hu,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:h,value:V,onChange:G=>I(G.target.value),disabled:m,form:x,children:[V===void 0?c.jsx("option",{value:""}):null,Array.from(se)]},ee):null]})})};bu.displayName=Zt;var wu="SelectTrigger",Su=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=Ks(n),o=Mt(wu,n),a=o.disabled||s,l=Re(t,o.onTriggerChange),d=Ws(n),u=f.useRef("touch"),[h,m,g]=zu(p=>{const v=d().filter(w=>!w.disabled),b=v.find(w=>w.value===o.value),y=Zu(v,p,b);y!==void 0&&o.onValueChange(y.value)}),x=p=>{a||(o.onOpenChange(!0),g()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return c.jsx(Py,{asChild:!0,...i,children:c.jsx(we.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Uu(o.value)?"":void 0,...r,ref:l,onClick:Ee(r.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&x(p)}),onPointerDown:Ee(r.onPointerDown,p=>{u.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:Ee(r.onKeyDown,p=>{const v=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(v&&p.key===" ")&&Sv.includes(p.key)&&(x(),p.preventDefault())})})})});Su.displayName=wu;var Cu="SelectValue",Eu=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,l=Mt(Cu,n),{onValueNodeHasChildrenChange:d}=l,u=i!==void 0,h=Re(t,l.onValueNodeChange);return Ue(()=>{d(u)},[d,u]),c.jsx(we.span,{...a,ref:h,style:{pointerEvents:"none"},children:Uu(l.value)?c.jsx(c.Fragment,{children:o}):i})});Eu.displayName=Cu;var jv="SelectIcon",ku=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return c.jsx(we.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});ku.displayName=jv;var Pv="SelectPortal",Au=e=>c.jsx(cu,{asChild:!0,...e});Au.displayName=Pv;var Wt="SelectContent",Tu=f.forwardRef((e,t)=>{const n=Mt(Wt,e.__scopeSelect),[s,r]=f.useState();if(Ue(()=>{r(new DocumentFragment)},[]),!n.open){const i=s;return i?Ls.createPortal(c.jsx(ju,{scope:e.__scopeSelect,children:c.jsx(Zs.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),i):null}return c.jsx(Pu,{...e,ref:t})});Tu.displayName=Wt;var Qe=10,[ju,Nt]=An(Wt),Mv="SelectContentImpl",Nv=Wn("SelectContent.RemoveScroll"),Pu=f.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:p,avoidCollisions:v,...b}=e,y=Mt(Wt,n),[w,S]=f.useState(null),[k,T]=f.useState(null),A=Re(t,N=>S(N)),[j,V]=f.useState(null),[I,$]=f.useState(null),F=Ws(n),[se,Z]=f.useState(!1),ee=f.useRef(!1);f.useEffect(()=>{if(w)return _y(w)},[w]),Q1();const G=f.useCallback(N=>{const[L,...W]=F().map(te=>te.ref.current),[D]=W.slice(-1),ne=document.activeElement;for(const te of N)if(te===ne||(te==null||te.scrollIntoView({block:"nearest"}),te===L&&k&&(k.scrollTop=0),te===D&&k&&(k.scrollTop=k.scrollHeight),te==null||te.focus(),document.activeElement!==ne))return},[F,k]),O=f.useCallback(()=>G([j,w]),[G,j,w]);f.useEffect(()=>{se&&O()},[se,O]);const{onOpenChange:P,triggerPointerDownPosRef:B}=y;f.useEffect(()=>{if(w){let N={x:0,y:0};const L=D=>{var ne,te;N={x:Math.abs(Math.round(D.pageX)-(((ne=B.current)==null?void 0:ne.x)??0)),y:Math.abs(Math.round(D.pageY)-(((te=B.current)==null?void 0:te.y)??0))}},W=D=>{N.x<=10&&N.y<=10?D.preventDefault():w.contains(D.target)||P(!1),document.removeEventListener("pointermove",L),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",L),document.addEventListener("pointerup",W,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",W,{capture:!0})}}},[w,P,B]),f.useEffect(()=>{const N=()=>P(!1);return window.addEventListener("blur",N),window.addEventListener("resize",N),()=>{window.removeEventListener("blur",N),window.removeEventListener("resize",N)}},[P]);const[X,_]=zu(N=>{const L=F().filter(ne=>!ne.disabled),W=L.find(ne=>ne.ref.current===document.activeElement),D=Zu(L,N,W);D&&setTimeout(()=>D.ref.current.focus())}),re=f.useCallback((N,L,W)=>{const D=!ee.current&&!W;(y.value!==void 0&&y.value===L||D)&&(V(N),D&&(ee.current=!0))},[y.value]),M=f.useCallback(()=>w==null?void 0:w.focus(),[w]),H=f.useCallback((N,L,W)=>{const D=!ee.current&&!W;(y.value!==void 0&&y.value===L||D)&&$(N)},[y.value]),q=s==="popper"?uo:Mu,U=q===uo?{side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:p,avoidCollisions:v}:{};return c.jsx(ju,{scope:n,content:w,viewport:k,onViewportChange:T,itemRefCallback:re,selectedItem:j,onItemLeave:M,itemTextRefCallback:H,focusSelectedItem:O,selectedItemText:I,position:s,isPositioned:se,searchRef:X,children:c.jsx(vu,{as:Nv,allowPinchZoom:!0,children:c.jsx(_d,{asChild:!0,trapped:y.open,onMountAutoFocus:N=>{N.preventDefault()},onUnmountAutoFocus:Ee(r,N=>{var L;(L=y.trigger)==null||L.focus({preventScroll:!0}),N.preventDefault()}),children:c.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:N=>N.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:c.jsx(q,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:N=>N.preventDefault(),...b,...U,onPlaced:()=>Z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ee(b.onKeyDown,N=>{const L=N.ctrlKey||N.altKey||N.metaKey;if(N.key==="Tab"&&N.preventDefault(),!L&&N.key.length===1&&_(N.key),["ArrowUp","ArrowDown","Home","End"].includes(N.key)){let D=F().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(N.key)&&(D=D.slice().reverse()),["ArrowUp","ArrowDown"].includes(N.key)){const ne=N.target,te=D.indexOf(ne);D=D.slice(te+1)}setTimeout(()=>G(D)),N.preventDefault()}})})})})})})});Pu.displayName=Mv;var Rv="SelectItemAlignedPosition",Mu=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=Mt(Wt,n),o=Nt(Wt,n),[a,l]=f.useState(null),[d,u]=f.useState(null),h=Re(t,A=>u(A)),m=Ws(n),g=f.useRef(!1),x=f.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:b,focusSelectedItem:y}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&v&&b){const A=i.trigger.getBoundingClientRect(),j=d.getBoundingClientRect(),V=i.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(i.dir!=="rtl"){const ne=I.left-j.left,te=V.left-ne,de=A.left-te,me=A.width+de,Ae=Math.max(me,j.width),De=window.innerWidth-Qe,rt=Ga(te,[Qe,Math.max(Qe,De-Ae)]);a.style.minWidth=me+"px",a.style.left=rt+"px"}else{const ne=j.right-I.right,te=window.innerWidth-V.right-ne,de=window.innerWidth-A.right-te,me=A.width+de,Ae=Math.max(me,j.width),De=window.innerWidth-Qe,rt=Ga(te,[Qe,Math.max(Qe,De-Ae)]);a.style.minWidth=me+"px",a.style.right=rt+"px"}const $=m(),F=window.innerHeight-Qe*2,se=p.scrollHeight,Z=window.getComputedStyle(d),ee=parseInt(Z.borderTopWidth,10),G=parseInt(Z.paddingTop,10),O=parseInt(Z.borderBottomWidth,10),P=parseInt(Z.paddingBottom,10),B=ee+G+se+P+O,X=Math.min(v.offsetHeight*5,B),_=window.getComputedStyle(p),re=parseInt(_.paddingTop,10),M=parseInt(_.paddingBottom,10),H=A.top+A.height/2-Qe,q=F-H,U=v.offsetHeight/2,N=v.offsetTop+U,L=ee+G+N,W=B-L;if(L<=H){const ne=$.length>0&&v===$[$.length-1].ref.current;a.style.bottom="0px";const te=d.clientHeight-p.offsetTop-p.offsetHeight,de=Math.max(q,U+(ne?M:0)+te+O),me=L+de;a.style.height=me+"px"}else{const ne=$.length>0&&v===$[0].ref.current;a.style.top="0px";const de=Math.max(H,ee+p.offsetTop+(ne?re:0)+U)+W;a.style.height=de+"px",p.scrollTop=L-H+p.offsetTop}a.style.margin=`${Qe}px 0`,a.style.minHeight=X+"px",a.style.maxHeight=F+"px",s==null||s(),requestAnimationFrame(()=>g.current=!0)}},[m,i.trigger,i.valueNode,a,d,p,v,b,i.dir,s]);Ue(()=>w(),[w]);const[S,k]=f.useState();Ue(()=>{d&&k(window.getComputedStyle(d).zIndex)},[d]);const T=f.useCallback(A=>{A&&x.current===!0&&(w(),y==null||y(),x.current=!1)},[w,y]);return c.jsx(Iv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:c.jsx(we.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Mu.displayName=Rv;var Vv="SelectPopperPosition",uo=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Qe,...i}=e,o=Ks(n);return c.jsx(My,{...o,...i,ref:t,align:s,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});uo.displayName=Vv;var[Iv,hi]=An(Wt,{}),fo="SelectViewport",Nu=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=Nt(fo,n),o=hi(fo,n),a=Re(t,i.onViewportChange),l=f.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),c.jsx(Zs.Slot,{scope:n,children:c.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Ee(r.onScroll,d=>{const u=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const g=Math.abs(l.current-u.scrollTop);if(g>0){const x=window.innerHeight-Qe*2,p=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),b=Math.max(p,v);if(b<x){const y=b+g,w=Math.min(x,y),S=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Nu.displayName=fo;var Ru="SelectGroup",[Dv,Lv]=An(Ru),Fv=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=si();return c.jsx(Dv,{scope:n,id:r,children:c.jsx(we.div,{role:"group","aria-labelledby":r,...s,ref:t})})});Fv.displayName=Ru;var Vu="SelectLabel",Ov=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=Lv(Vu,n);return c.jsx(we.div,{id:r.id,...s,ref:t})});Ov.displayName=Vu;var Is="SelectItem",[_v,Iu]=An(Is),Du=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=Mt(Is,n),l=Nt(Is,n),d=a.value===s,[u,h]=f.useState(i??""),[m,g]=f.useState(!1),x=Re(t,y=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,y,s,r)}),p=si(),v=f.useRef("touch"),b=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return c.jsx(_v,{scope:n,value:s,disabled:r,textId:p,isSelected:d,onItemTextChange:f.useCallback(y=>{h(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:c.jsx(Zs.ItemSlot,{scope:n,value:s,disabled:r,textValue:u,children:c.jsx(we.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:x,onFocus:Ee(o.onFocus,()=>g(!0)),onBlur:Ee(o.onBlur,()=>g(!1)),onClick:Ee(o.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Ee(o.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Ee(o.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:Ee(o.onPointerMove,y=>{var w;v.current=y.pointerType,r?(w=l.onItemLeave)==null||w.call(l):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ee(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Ee(o.onKeyDown,y=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&y.key===" "||(Cv.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Du.displayName=Is;var Dn="SelectItemText",Lu=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=Mt(Dn,n),a=Nt(Dn,n),l=Iu(Dn,n),d=Tv(Dn,n),[u,h]=f.useState(null),m=Re(t,b=>h(b),l.onItemTextChange,b=>{var y;return(y=a.itemTextRefCallback)==null?void 0:y.call(a,b,l.value,l.disabled)}),g=u==null?void 0:u.textContent,x=f.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=d;return Ue(()=>(p(x),()=>v(x)),[p,v,x]),c.jsxs(c.Fragment,{children:[c.jsx(we.span,{id:l.textId,...i,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ls.createPortal(i.children,o.valueNode):null]})});Lu.displayName=Dn;var Fu="SelectItemIndicator",Ou=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return Iu(Fu,n).isSelected?c.jsx(we.span,{"aria-hidden":!0,...s,ref:t}):null});Ou.displayName=Fu;var ho="SelectScrollUpButton",_u=f.forwardRef((e,t)=>{const n=Nt(ho,e.__scopeSelect),s=hi(ho,e.__scopeSelect),[r,i]=f.useState(!1),o=Re(t,s.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?c.jsx(Bu,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_u.displayName=ho;var mo="SelectScrollDownButton",$u=f.forwardRef((e,t)=>{const n=Nt(mo,e.__scopeSelect),s=hi(mo,e.__scopeSelect),[r,i]=f.useState(!1),o=Re(t,s.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<d;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?c.jsx(Bu,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});$u.displayName=mo;var Bu=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=Nt("SelectScrollButton",n),o=f.useRef(null),a=Ws(n),l=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>l(),[l]),Ue(()=>{var u;const d=a().find(h=>h.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),c.jsx(we.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:Ee(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Ee(r.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Ee(r.onPointerLeave,()=>{l()})})}),$v="SelectSeparator",Bv=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return c.jsx(we.div,{"aria-hidden":!0,...s,ref:t})});Bv.displayName=$v;var po="SelectArrow",Hv=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=Ks(n),i=Mt(po,n),o=Nt(po,n);return i.open&&o.position==="popper"?c.jsx(Ny,{...r,...s,ref:t}):null});Hv.displayName=po;var Uv="SelectBubbleInput",Hu=f.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const r=f.useRef(null),i=Re(s,r),o=Vy(t);return f.useEffect(()=>{const a=r.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const h=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(h)}},[o,t]),c.jsx(we.select,{...n,style:{...du,...n.style},ref:i,defaultValue:t})});Hu.displayName=Uv;function Uu(e){return e===""||e===void 0}function zu(e){const t=Ut(e),n=f.useRef(""),s=f.useRef(0),r=f.useCallback(o=>{const a=n.current+o;t(a),function l(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function Zu(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=zv(e,Math.max(i,0));r.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function zv(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Zv=bu,Wv=Su,Kv=Eu,Yv=ku,Gv=Au,Xv=Tu,qv=Nu,Jv=Du,Qv=Lu,eb=Ou,tb=_u,nb=$u;function yl({...e}){return c.jsx(Zv,{"data-slot":"select",...e})}function vl({...e}){return c.jsx(Kv,{"data-slot":"select-value",...e})}function bl({className:e,size:t="default",children:n,...s}){return c.jsxs(Wv,{"data-slot":"select-trigger","data-size":t,className:Q(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...s,children:[n,c.jsx(Yv,{asChild:!0,children:c.jsx(Qo,{weight:"bold",className:"size-4 transition-colors"})})]})}function wl({className:e,children:t,position:n="popper",...s}){return c.jsx(Gv,{children:c.jsxs(Xv,{"data-slot":"select-content",className:Q(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[c.jsx(sb,{}),c.jsx(qv,{className:Q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),c.jsx(rb,{})]})})}function Sl({className:e,children:t,...n}){return c.jsxs(Jv,{"data-slot":"select-item",className:Q(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...n,children:[c.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:c.jsx(eb,{children:c.jsx(md,{className:"size-4",weight:"bold"})})}),c.jsx(Qv,{children:t})]})}function sb({className:e,...t}){return c.jsx(tb,{"data-slot":"select-scroll-up-button",className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(fd,{className:"size-4",weight:"bold"})})}function rb({className:e,...t}){return c.jsx(nb,{"data-slot":"select-scroll-down-button",className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Qo,{className:"size-4",weight:"bold"})})}const Cl=Ds.cva(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function El({kind:e,track:t,requestPermissions:n,onError:s,client:r,...i}){const o=i.size||"default";if(!r)return c.jsxs(yl,{disabled:!0,children:[c.jsx(bl,{className:Q(Cl({size:o}),i.className),children:c.jsx(vl,{placeholder:`Select a ${e}`})}),c.jsx(wl,{children:c.jsx(Sl,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:l,setActiveMediaDevice:d}=_1(r,e==="audioinput"?"audioinput":"videoinput");return c.jsxs(yl,{value:l,onValueChange:d,children:[c.jsx(bl,{className:Q(Cl({size:o}),i.className,"hover:bg"),children:o!=="sm"&&c.jsx(vl,{className:"font-mono text-sm",placeholder:`Select a ${e}`})}),c.jsx(wl,{children:a.map(u=>c.jsx(Sl,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function ob(e,t,n=!1){if(n)return ei;switch(e){case J.Track.Source.Microphone:return t?pd:gd;case J.Track.Source.Camera:return t?yd:vd;case J.Track.Source.ScreenShare:return xd;default:return f.Fragment}}function Pr({source:e,pressed:t,pending:n,className:s,...r}){const i=ob(e,t??!1,n),o=e===J.Track.Source.Microphone&&!(t??!1)&&!n,a=e===J.Track.Source.Camera&&!(t??!1)&&!n;return f.useEffect(()=>{console.log(`TrackToggle for ${e} changed: pressed=${t}, pending=${n}, actualState=${t?"enabled":"disabled"}`)},[e,t,n]),c.jsxs(Dd,{pressed:t,"aria-label":`Toggle ${e}`,className:Q(s),...r,children:[c.jsx(i,{weight:"bold",className:Q(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}function ib(e){return e?L1(e):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function ab(e={}){const{controls:t,saveUserChoices:n=!0,client:s}=e,r={leave:!0,...t};if(!s)return{micTrackRef:{participant:void 0,source:J.Track.Source.Microphone,publication:void 0},visibleControls:r,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:i,localParticipant:o}=F1(s),a=ib(s);O1(s);const l=vr(s,"microphone",{onDeviceError:T=>{var A;return(A=e.onDeviceError)==null?void 0:A.call(e,{source:J.Track.Source.Microphone,error:T})}}),d=vr(s,"camera",{onDeviceError:T=>{var A;return(A=e.onDeviceError)==null?void 0:A.call(e,{source:J.Track.Source.Camera,error:T})}}),u=vr(s,"screenShare",{onDeviceError:T=>{var A;return(A=e.onDeviceError)==null?void 0:A.call(e,{source:J.Track.Source.ScreenShare,error:T})}}),h=f.useMemo(()=>{let T;if(o){for(const[,A]of o.trackPublications)if(A.source===J.Track.Source.Microphone){T=A;break}}return console.log("🎤 Creating micTrackRef:",{hasParticipant:!!o,hasPublication:!!T,isTrackSubscribed:T==null?void 0:T.isSubscribed,isMuted:T==null?void 0:T.isMuted,trackSid:T==null?void 0:T.trackSid}),{participant:o??void 0,source:J.Track.Source.Microphone,publication:T}},[o,i]);r.microphone??(r.microphone=a.microphone),r.screenShare??(r.screenShare=a.screenShare),r.camera??(r.camera=a.camera),r.chat??(r.chat=a.data);const{saveAudioInputEnabled:m,saveAudioInputDeviceId:g,saveVideoInputEnabled:x,saveVideoInputDeviceId:p}=$1({preventSave:!n}),v=f.useCallback(()=>{s&&s.disconnect()},[s]),b=f.useCallback(T=>{g(T??"default"),s&&s.setAudioInputDevice(T)},[g,s]),y=f.useCallback(T=>{p(T??"default"),s&&s.setVideoInputDevice(T)},[p,s]),w=f.useCallback(async T=>{u.enabled&&await u.toggle(!1),await d.toggle(T),x(!d.enabled)},[d,x,u]),S=f.useCallback(async T=>{await l.toggle(T),m(!l.enabled)},[l,m]),k=f.useCallback(async T=>{d.enabled&&await d.toggle(!1),await u.toggle(T)},[d,u]);return{micTrackRef:h,visibleControls:r,cameraToggle:{...d,toggle:w},microphoneToggle:{...l,toggle:S},screenShareToggle:{...u,toggle:k},handleDisconnect:v,handleAudioDeviceChange:b,handleVideoDeviceChange:y}}const lb={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},cb={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},db={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},kl={dark:lb,light:cb,vox:db};function Ve(e){return kl[e]||kl.vox}function ub({controls:e,saveUserChoices:t=!0,capabilities:n,className:s,onSendMessage:r,onChatOpenChange:i,onDisconnect:o,onDeviceError:a,theme:l="vox",client:d,...u}){const[h,m]=f.useState(!1),[g,x]=f.useState(!1),p=Ve(l),{micTrackRef:v,visibleControls:b,cameraToggle:y,microphoneToggle:w,screenShareToggle:S,handleAudioDeviceChange:k,handleVideoDeviceChange:T,handleDisconnect:A}=ab({controls:e,saveUserChoices:t,client:d}),j=async V=>{x(!0);try{await(r==null?void 0:r(V))}finally{x(!1)}};return f.useEffect(()=>{i==null||i(h)},[h,i]),f.useEffect(()=>{var V,I,$,F;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!v.participant,hasPublication:!!v.publication,source:v.source,isSubscribed:(V=v.publication)==null?void 0:V.isSubscribed,isMuted:(I=v.publication)==null?void 0:I.isMuted,trackSid:($=v.publication)==null?void 0:$.trackSid,hasTrack:!!((F=v.publication)!=null&&F.track)})},[v]),c.jsxs("div",{"aria-label":"Voice assistant controls",className:Q(p.controlBar,s),...u,children:[n.suportsChatInput&&c.jsxs("div",{inert:!h,className:Q("overflow-hidden transition-[height] relative duration-300 ease-in-out",h?"h-[64px] mb-3":"h-0"),children:[c.jsx("div",{className:"flex h-9 px-4 w-full",children:c.jsx(j1,{onSend:j,disabled:g,className:Q("w-full",p.chatInput)})}),c.jsx("hr",{className:"border-border my-2 mx-5"})]}),c.jsxs("div",{className:Q("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",l==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[c.jsxs("div",{className:"flex gap-y-2 justify-start",children:[b.microphone&&c.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[c.jsx(Pr,{variant:"primary",source:J.Track.Source.Microphone,pressed:w.enabled,disabled:w.pending,onPressedChange:w.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),c.jsx(ke.BarVisualizer,{barCount:3,trackRef:v,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:c.jsx("span",{className:Q(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),c.jsx(El,{size:"sm",kind:"audioinput",client:d,onError:a?V=>V instanceof Error?a({source:J.Track.Source.Microphone,error:V}):void 0:void 0,onActiveDeviceChange:k,className:Q(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&b.camera&&c.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[c.jsx(Pr,{variant:"primary",source:J.Track.Source.Camera,pressed:y.enabled,pending:y.pending,disabled:y.pending,onPressedChange:y.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),c.jsx(El,{size:"sm",kind:"videoinput",client:d,onError:a?V=>V instanceof Error?a({source:J.Track.Source.Camera,error:V}):void 0:void 0,onActiveDeviceChange:T,className:Q(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),n.suportsScreenShare&&b.screenShare&&c.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:c.jsx(Pr,{variant:"secondary",source:J.Track.Source.ScreenShare,pressed:S.enabled,disabled:S.pending,onPressedChange:S.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),b.chat&&c.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:c.jsx(Dd,{variant:"secondary","aria-label":"Toggle chat",pressed:h,onPressedChange:V=>{m(V)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:c.jsx(hd,{weight:"bold",className:"h-5 w-5"})})})]})]})}const fb=(e,t)=>{var a,l;const n=f.useMemo(()=>t?t(e.message):e.message,[e.message,t]),s=!!e.editTimestamp,r=new Date(e.timestamp),i=typeof navigator<"u"?navigator.language:"en-US",o=(a=e.from)!=null&&a.name&&e.from.name!==""?e.from.name:(l=e.from)==null?void 0:l.identity;return{message:n,hasBeenEdited:s,time:r,locale:i,name:o}},hb=({entry:e,messageFormatter:t,className:n,participantName:s,...r})=>{var u,h;const{message:i,time:o,locale:a}=fb(e,t),l=((u=e.from)==null?void 0:u.isLocal)??!1;Q("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",l?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const d=Q("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",l?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return c.jsx("li",{title:o.toLocaleTimeString(a,{timeStyle:"full"}),className:Q("group flex mb-2",l?"justify-end":"justify-start",n),...r,children:c.jsxs("div",{className:Q("flex w-fit max-w-full rounded-2xl border",l?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[c.jsx("span",{className:d,children:l?((h=s==null?void 0:s[0])==null?void 0:h.toUpperCase())||"U":"A"}),c.jsx("span",{className:Q("flex items-center text-xs break-words whitespace-pre-line",l?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:i})]})})};function mb(e){E.useEffect(()=>{function t(){const n=e.current;n&&(n.scrollTop=n.scrollHeight)}if(e.current){const n=new ResizeObserver(t);return n.observe(e.current),t(),()=>n.disconnect()}},[e])}const pb=({className:e,children:t,...n})=>{const s=E.useRef(null);return mb(s),c.jsx("div",{ref:s,className:Q("flex flex-col justify-end",e),...n,children:t})},gb=({state:e,audioTrack:t,className:n,ref:s})=>c.jsx("div",{ref:s,className:Q("",n),children:c.jsx(ke.BarVisualizer,{barCount:5,state:e,options:{minHeight:5},trackRef:t,className:Q("flex aspect-video w-40 items-center justify-center gap-1"),children:c.jsx("span",{className:Q(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})})}),xb=({videoTrack:e,className:t,ref:n})=>{var s,r;return c.jsx("div",{ref:n,className:Q(t),children:c.jsx(ke.VideoTrack,{trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e==null?void 0:e.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},yb=ce.create(ke.VideoTrack),vb=({trackRef:e,className:t,ref:n})=>{var s,r;return c.jsx("div",{className:Q("bg-muted overflow-hidden rounded-md",t),children:c.jsx(yb,{ref:n,trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e==null?void 0:e.publication.dimensions)==null?void 0:r.height)??0,className:Q("h-full w-auto")})})},Al=ce.create(vb),bb=ce.create(gb),wb=ce.create(xb),pt={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},tn={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function Sb(e){const{localParticipant:t}=ke.useLocalParticipant(),n=t.getTrackPublication(e);return E.useMemo(()=>n?{source:e,participant:t,publication:n}:void 0,[e,n,t])}function Cb({chatOpen:e}){const{state:t,audioTrack:n,videoTrack:s,agent:{isActive:r=!1}={}}=ke.useVoiceAssistant(),[i]=ke.useTracks([J.Track.Source.ScreenShare]),o=Sb(J.Track.Source.Camera),a=o&&!o.publication.isMuted,l=i&&!i.publication.isMuted,d=a||l,u={...pt.transition,delay:e?0:.15},h={...pt.animate,scale:e?1:3,transition:u},m={...pt.animate,transition:u},g=u,x=u,p=s!==void 0;return c.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:c.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:c.jsxs("div",{className:Q(tn.grid),children:[r&&c.jsx("div",{className:Q(["grid",!e&&tn.agentChatClosed,e&&d&&tn.agentChatOpenWithSecondTile,e&&!d&&tn.agentChatOpenWithoutSecondTile]),children:c.jsxs("div",{className:"h-full flex items-center justify-center",children:[!p&&c.jsx(bb,{layoutId:"agent",...pt,animate:h,transition:g,state:t,audioTrack:n,className:Q(e?"h-[90px]":"h-auto w-full")},"agent"),p&&c.jsx(wb,{layoutId:"avatar",...pt,animate:m,transition:x,videoTrack:s,className:Q(e?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),c.jsx("div",{className:Q(["grid",e&&tn.secondTileChatOpen,!e&&tn.secondTileChatClosed]),children:c.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&c.jsx(Al,{layout:"position",layoutId:"camera",...pt,trackRef:o,transition:{...pt.transition,delay:e?0:.15},className:"h-[60px] order-1"},"camera"),l&&c.jsx(Al,{layout:"position",layoutId:"screen",...pt,trackRef:i,transition:{...pt.transition,delay:e?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}/**
114
+ `)},Ag=function(){var t=parseInt(document.body.getAttribute($r)||"0",10);return isFinite(t)?t:0},i8=function(){v.useEffect(function(){return document.body.setAttribute($r,(Ag()+1).toString()),function(){var t=Ag()-1;t<=0?document.body.removeAttribute($r):document.body.setAttribute($r,t.toString())}},[])},r8=function(t){var e=t.noRelative,n=t.noImportant,i=t.gapMode,r=i===void 0?"margin":i;i8();var s=v.useMemo(function(){return e8(r)},[r]);return v.createElement(t8,{styles:n8(s,!e,r,n?"":"!important")})},su=!1;if(typeof window<"u")try{var Lo=Object.defineProperty({},"passive",{get:function(){return su=!0,!0}});window.addEventListener("test",Lo,Lo),window.removeEventListener("test",Lo,Lo)}catch{su=!1}var mr=su?{passive:!1}:!1,s8=function(t){return t.tagName==="TEXTAREA"},Kx=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!s8(t)&&n[e]==="visible")},o8=function(t){return Kx(t,"overflowY")},a8=function(t){return Kx(t,"overflowX")},Ig=function(t,e){var n=e.ownerDocument,i=e;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=Gx(t,i);if(r){var s=Zx(t,i),o=s[1],a=s[2];if(o>a)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},c8=function(t){var e=t.scrollTop,n=t.scrollHeight,i=t.clientHeight;return[e,n,i]},l8=function(t){var e=t.scrollLeft,n=t.scrollWidth,i=t.clientWidth;return[e,n,i]},Gx=function(t,e){return t==="v"?o8(e):a8(e)},Zx=function(t,e){return t==="v"?c8(e):l8(e)},d8=function(t,e){return t==="h"&&e==="rtl"?-1:1},u8=function(t,e,n,i,r){var s=d8(t,window.getComputedStyle(e).direction),o=s*i,a=n.target,c=e.contains(a),l=!1,d=o>0,u=0,f=0;do{if(!a)break;var p=Zx(t,a),g=p[0],h=p[1],y=p[2],b=h-y-s*g;(g||b)&&Gx(t,a)&&(u+=b,f+=g);var w=a.parentNode;a=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&a!==document.body||c&&(e.contains(a)||e===a));return(d&&Math.abs(u)<1||!d&&Math.abs(f)<1)&&(l=!0),l},Vo=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Mg=function(t){return[t.deltaX,t.deltaY]},_g=function(t){return t&&"current"in t?t.current:t},f8=function(t,e){return t[0]===e[0]&&t[1]===e[1]},h8=function(t){return`
115
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
116
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
117
+ `)},m8=0,pr=[];function p8(t){var e=v.useRef([]),n=v.useRef([0,0]),i=v.useRef(),r=v.useState(m8++)[0],s=v.useState(qx)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var h=jO([t.lockRef.current],(t.shards||[]).map(_g),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var a=v.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!o.current.allowPinchZoom;var b=Vo(h),w=n.current,C="deltaX"in h?h.deltaX:w[0]-b[0],S="deltaY"in h?h.deltaY:w[1]-b[1],x,T=h.target,E=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in h&&E==="h"&&T.type==="range")return!1;var P=Ig(E,T);if(!P)return!0;if(P?x=E:(x=E==="v"?"h":"v",P=Ig(E,T)),!P)return!1;if(!i.current&&"changedTouches"in h&&(C||S)&&(i.current=x),!x)return!0;var _=i.current||x;return u8(_,y,h,_==="h"?C:S)},[]),c=v.useCallback(function(h){var y=h;if(!(!pr.length||pr[pr.length-1]!==s)){var b="deltaY"in y?Mg(y):Vo(y),w=e.current.filter(function(x){return x.name===y.type&&(x.target===y.target||y.target===x.shadowParent)&&f8(x.delta,b)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var C=(o.current.shards||[]).map(_g).filter(Boolean).filter(function(x){return x.contains(y.target)}),S=C.length>0?a(y,C[0]):!o.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),l=v.useCallback(function(h,y,b,w){var C={name:h,delta:y,target:b,should:w,shadowParent:g8(b)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(S){return S!==C})},1)},[]),d=v.useCallback(function(h){n.current=Vo(h),i.current=void 0},[]),u=v.useCallback(function(h){l(h.type,Mg(h),h.target,a(h,t.lockRef.current))},[]),f=v.useCallback(function(h){l(h.type,Vo(h),h.target,a(h,t.lockRef.current))},[]);v.useEffect(function(){return pr.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",c,mr),document.addEventListener("touchmove",c,mr),document.addEventListener("touchstart",d,mr),function(){pr=pr.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,mr),document.removeEventListener("touchmove",c,mr),document.removeEventListener("touchstart",d,mr)}},[]);var p=t.removeScrollBar,g=t.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:h8(r)}):null,p?v.createElement(r8,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function g8(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const v8=WO(Wx,p8);var Yx=v.forwardRef(function(t,e){return v.createElement(cc,Cn({},t,{ref:e,sideCar:v8}))});Yx.classNames=cc.classNames;var y8=[" ","Enter","ArrowUp","ArrowDown"],b8=[" ","Enter"],tr="Select",[lc,dc,x8]=V_(tr),[us,VL]=Df(tr,[x8,Mx]),uc=Mx(),[S8,Ai]=us(tr),[w8,C8]=us(tr),Jx=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:c,dir:l,name:d,autoComplete:u,disabled:f,required:p,form:g}=t,h=uc(e),[y,b]=v.useState(null),[w,C]=v.useState(null),[S,x]=v.useState(!1),T=U_(l),[E,P]=eu({prop:i,defaultProp:r??!1,onChange:s,caller:tr}),[_,k]=eu({prop:o,defaultProp:a,onChange:c,caller:tr}),I=v.useRef(null),N=y?g||!!y.closest("form"):!0,[K,J]=v.useState(new Set),se=Array.from(K).map(ie=>ie.props.value).join(";");return m.jsx(kO,{...h,children:m.jsxs(S8,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:C,valueNodeHasChildren:S,onValueNodeHasChildrenChange:x,contentId:jf(),value:_,onValueChange:k,open:E,onOpenChange:P,dir:T,triggerPointerDownPosRef:I,disabled:f,children:[m.jsx(lc.Provider,{scope:e,children:m.jsx(w8,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(ie=>{J(X=>new Set(X).add(ie))},[]),onNativeOptionRemove:v.useCallback(ie=>{J(X=>{const O=new Set(X);return O.delete(ie),O})},[]),children:n})}),N?m.jsxs(bS,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:u,value:_,onChange:ie=>k(ie.target.value),disabled:f,form:g,children:[_===void 0?m.jsx("option",{value:""}):null,Array.from(K)]},se):null]})})};Jx.displayName=tr;var Xx="SelectTrigger",Qx=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...r}=t,s=uc(n),o=Ai(Xx,n),a=o.disabled||i,c=xt(e,o.onTriggerChange),l=dc(n),d=v.useRef("touch"),[u,f,p]=SS(h=>{const y=l().filter(C=>!C.disabled),b=y.find(C=>C.value===o.value),w=wS(y,h,b);w!==void 0&&o.onValueChange(w.value)}),g=h=>{a||(o.onOpenChange(!0),p()),h&&(o.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return m.jsx(TO,{asChild:!0,...s,children:m.jsx(et.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":xS(o.value)?"":void 0,...r,ref:c,onClick:it(r.onClick,h=>{h.currentTarget.focus(),d.current!=="mouse"&&g(h)}),onPointerDown:it(r.onPointerDown,h=>{d.current=h.pointerType;const y=h.target;y.hasPointerCapture(h.pointerId)&&y.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(g(h),h.preventDefault())}),onKeyDown:it(r.onKeyDown,h=>{const y=u.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(y&&h.key===" ")&&y8.includes(h.key)&&(g(),h.preventDefault())})})})});Qx.displayName=Xx;var eS="SelectValue",tS=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,children:s,placeholder:o="",...a}=t,c=Ai(eS,n),{onValueNodeHasChildrenChange:l}=c,d=s!==void 0,u=xt(e,c.onValueNodeChange);return Lt(()=>{l(d)},[l,d]),m.jsx(et.span,{...a,ref:u,style:{pointerEvents:"none"},children:xS(c.value)?m.jsx(m.Fragment,{children:o}):s})});tS.displayName=eS;var k8="SelectIcon",nS=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...r}=t;return m.jsx(et.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});nS.displayName=k8;var T8="SelectPortal",iS=t=>m.jsx(Ux,{asChild:!0,...t});iS.displayName=T8;var nr="SelectContent",rS=v.forwardRef((t,e)=>{const n=Ai(nr,t.__scopeSelect),[i,r]=v.useState();if(Lt(()=>{r(new DocumentFragment)},[]),!n.open){const s=i;return s?Wa.createPortal(m.jsx(sS,{scope:t.__scopeSelect,children:m.jsx(lc.Slot,{scope:t.__scopeSelect,children:m.jsx("div",{children:t.children})})}),s):null}return m.jsx(oS,{...t,ref:e})});rS.displayName=nr;var on=10,[sS,Ii]=us(nr),E8="SelectContentImpl",P8=eo("SelectContent.RemoveScroll"),oS=v.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:h,avoidCollisions:y,...b}=t,w=Ai(nr,n),[C,S]=v.useState(null),[x,T]=v.useState(null),E=xt(e,D=>S(D)),[P,_]=v.useState(null),[k,I]=v.useState(null),N=dc(n),[K,J]=v.useState(!1),se=v.useRef(!1);v.useEffect(()=>{if(C)return DO(C)},[C]),Z_();const ie=v.useCallback(D=>{const[$,...Q]=N().map(z=>z.ref.current),[W]=Q.slice(-1),ce=document.activeElement;for(const z of D)if(z===ce||(z==null||z.scrollIntoView({block:"nearest"}),z===$&&x&&(x.scrollTop=0),z===W&&x&&(x.scrollTop=x.scrollHeight),z==null||z.focus(),document.activeElement!==ce))return},[N,x]),X=v.useCallback(()=>ie([P,C]),[ie,P,C]);v.useEffect(()=>{K&&X()},[K,X]);const{onOpenChange:O,triggerPointerDownPosRef:oe}=w;v.useEffect(()=>{if(C){let D={x:0,y:0};const $=W=>{var ce,z;D={x:Math.abs(Math.round(W.pageX)-(((ce=oe.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(W.pageY)-(((z=oe.current)==null?void 0:z.y)??0))}},Q=W=>{D.x<=10&&D.y<=10?W.preventDefault():C.contains(W.target)||O(!1),document.removeEventListener("pointermove",$),oe.current=null};return oe.current!==null&&(document.addEventListener("pointermove",$),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",Q,{capture:!0})}}},[C,O,oe]),v.useEffect(()=>{const D=()=>O(!1);return window.addEventListener("blur",D),window.addEventListener("resize",D),()=>{window.removeEventListener("blur",D),window.removeEventListener("resize",D)}},[O]);const[L,F]=SS(D=>{const $=N().filter(ce=>!ce.disabled),Q=$.find(ce=>ce.ref.current===document.activeElement),W=wS($,D,Q);W&&setTimeout(()=>W.ref.current.focus())}),te=v.useCallback((D,$,Q)=>{const W=!se.current&&!Q;(w.value!==void 0&&w.value===$||W)&&(_(D),W&&(se.current=!0))},[w.value]),j=v.useCallback(()=>C==null?void 0:C.focus(),[C]),q=v.useCallback((D,$,Q)=>{const W=!se.current&&!Q;(w.value!==void 0&&w.value===$||W)&&I(D)},[w.value]),ee=i==="popper"?ou:aS,G=ee===ou?{side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:h,avoidCollisions:y}:{};return m.jsx(sS,{scope:n,content:C,viewport:x,onViewportChange:T,itemRefCallback:te,selectedItem:P,onItemLeave:j,itemTextRefCallback:q,focusSelectedItem:X,selectedItemText:k,position:i,isPositioned:K,searchRef:L,children:m.jsx(Yx,{as:P8,allowPinchZoom:!0,children:m.jsx(gx,{asChild:!0,trapped:w.open,onMountAutoFocus:D=>{D.preventDefault()},onUnmountAutoFocus:it(r,D=>{var $;($=w.trigger)==null||$.focus({preventScroll:!0}),D.preventDefault()}),children:m.jsx(mx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:D=>D.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:m.jsx(ee,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:D=>D.preventDefault(),...b,...G,onPlaced:()=>J(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:it(b.onKeyDown,D=>{const $=D.ctrlKey||D.altKey||D.metaKey;if(D.key==="Tab"&&D.preventDefault(),!$&&D.key.length===1&&F(D.key),["ArrowUp","ArrowDown","Home","End"].includes(D.key)){let W=N().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);if(["ArrowUp","End"].includes(D.key)&&(W=W.slice().reverse()),["ArrowUp","ArrowDown"].includes(D.key)){const ce=D.target,z=W.indexOf(ce);W=W.slice(z+1)}setTimeout(()=>ie(W)),D.preventDefault()}})})})})})})});oS.displayName=E8;var R8="SelectItemAlignedPosition",aS=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...r}=t,s=Ai(nr,n),o=Ii(nr,n),[a,c]=v.useState(null),[l,d]=v.useState(null),u=xt(e,E=>d(E)),f=dc(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:h,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=o,C=v.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&l&&h&&y&&b){const E=s.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),_=s.valueNode.getBoundingClientRect(),k=b.getBoundingClientRect();if(s.dir!=="rtl"){const ce=k.left-P.left,z=_.left-ce,me=E.left-z,Ee=E.width+me,qe=Math.max(Ee,P.width),Ct=window.innerWidth-on,gn=dg(z,[on,Math.max(on,Ct-qe)]);a.style.minWidth=Ee+"px",a.style.left=gn+"px"}else{const ce=P.right-k.right,z=window.innerWidth-_.right-ce,me=window.innerWidth-E.right-z,Ee=E.width+me,qe=Math.max(Ee,P.width),Ct=window.innerWidth-on,gn=dg(z,[on,Math.max(on,Ct-qe)]);a.style.minWidth=Ee+"px",a.style.right=gn+"px"}const I=f(),N=window.innerHeight-on*2,K=h.scrollHeight,J=window.getComputedStyle(l),se=parseInt(J.borderTopWidth,10),ie=parseInt(J.paddingTop,10),X=parseInt(J.borderBottomWidth,10),O=parseInt(J.paddingBottom,10),oe=se+ie+K+O+X,L=Math.min(y.offsetHeight*5,oe),F=window.getComputedStyle(h),te=parseInt(F.paddingTop,10),j=parseInt(F.paddingBottom,10),q=E.top+E.height/2-on,ee=N-q,G=y.offsetHeight/2,D=y.offsetTop+G,$=se+ie+D,Q=oe-$;if($<=q){const ce=I.length>0&&y===I[I.length-1].ref.current;a.style.bottom="0px";const z=l.clientHeight-h.offsetTop-h.offsetHeight,me=Math.max(ee,G+(ce?j:0)+z+X),Ee=$+me;a.style.height=Ee+"px"}else{const ce=I.length>0&&y===I[0].ref.current;a.style.top="0px";const me=Math.max(q,se+h.offsetTop+(ce?te:0)+G)+Q;a.style.height=me+"px",h.scrollTop=$-q+h.offsetTop}a.style.margin=`${on}px 0`,a.style.minHeight=L+"px",a.style.maxHeight=N+"px",i==null||i(),requestAnimationFrame(()=>p.current=!0)}},[f,s.trigger,s.valueNode,a,l,h,y,b,s.dir,i]);Lt(()=>C(),[C]);const[S,x]=v.useState();Lt(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);const T=v.useCallback(E=>{E&&g.current===!0&&(C(),w==null||w(),g.current=!1)},[C,w]);return m.jsx(I8,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:m.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:m.jsx(et.div,{...r,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});aS.displayName=R8;var A8="SelectPopperPosition",ou=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:r=on,...s}=t,o=uc(n);return m.jsx(EO,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ou.displayName=A8;var[I8,qf]=us(nr,{}),au="SelectViewport",cS=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...r}=t,s=Ii(au,n),o=qf(au,n),a=xt(e,s.onViewportChange),c=v.useRef(0);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),m.jsx(lc.Slot,{scope:n,children:m.jsx(et.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:it(r.onScroll,l=>{const d=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&u){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-on*2,h=parseFloat(u.style.minHeight),y=parseFloat(u.style.height),b=Math.max(h,y);if(b<g){const w=b+p,C=Math.min(g,w),S=w-C;u.style.height=C+"px",u.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,u.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});cS.displayName=au;var lS="SelectGroup",[M8,_8]=us(lS),N8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=jf();return m.jsx(M8,{scope:n,id:r,children:m.jsx(et.div,{role:"group","aria-labelledby":r,...i,ref:e})})});N8.displayName=lS;var dS="SelectLabel",O8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=_8(dS,n);return m.jsx(et.div,{id:r.id,...i,ref:e})});O8.displayName=dS;var Ua="SelectItem",[D8,uS]=us(Ua),fS=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:r=!1,textValue:s,...o}=t,a=Ai(Ua,n),c=Ii(Ua,n),l=a.value===i,[d,u]=v.useState(s??""),[f,p]=v.useState(!1),g=xt(e,w=>{var C;return(C=c.itemRefCallback)==null?void 0:C.call(c,w,i,r)}),h=jf(),y=v.useRef("touch"),b=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(D8,{scope:n,value:i,disabled:r,textId:h,isSelected:l,onItemTextChange:v.useCallback(w=>{u(C=>C||((w==null?void 0:w.textContent)??"").trim())},[]),children:m.jsx(lc.ItemSlot,{scope:n,value:i,disabled:r,textValue:d,children:m.jsx(et.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:g,onFocus:it(o.onFocus,()=>p(!0)),onBlur:it(o.onBlur,()=>p(!1)),onClick:it(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:it(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:it(o.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:it(o.onPointerMove,w=>{var C;y.current=w.pointerType,r?(C=c.onItemLeave)==null||C.call(c):y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:it(o.onPointerLeave,w=>{var C;w.currentTarget===document.activeElement&&((C=c.onItemLeave)==null||C.call(c))}),onKeyDown:it(o.onKeyDown,w=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&w.key===" "||(b8.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});fS.displayName=Ua;var _s="SelectItemText",hS=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,...s}=t,o=Ai(_s,n),a=Ii(_s,n),c=uS(_s,n),l=C8(_s,n),[d,u]=v.useState(null),f=xt(e,b=>u(b),c.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>m.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:y}=l;return Lt(()=>(h(g),()=>y(g)),[h,y,g]),m.jsxs(m.Fragment,{children:[m.jsx(et.span,{id:c.textId,...s,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Wa.createPortal(s.children,o.valueNode):null]})});hS.displayName=_s;var mS="SelectItemIndicator",pS=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return uS(mS,n).isSelected?m.jsx(et.span,{"aria-hidden":!0,...i,ref:e}):null});pS.displayName=mS;var cu="SelectScrollUpButton",gS=v.forwardRef((t,e)=>{const n=Ii(cu,t.__scopeSelect),i=qf(cu,t.__scopeSelect),[r,s]=v.useState(!1),o=xt(e,i.onScrollButtonChange);return Lt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollTop>0;s(l)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?m.jsx(yS,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});gS.displayName=cu;var lu="SelectScrollDownButton",vS=v.forwardRef((t,e)=>{const n=Ii(lu,t.__scopeSelect),i=qf(lu,t.__scopeSelect),[r,s]=v.useState(!1),o=xt(e,i.onScrollButtonChange);return Lt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<l;s(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?m.jsx(yS,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});vS.displayName=lu;var yS=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...r}=t,s=Ii("SelectScrollButton",n),o=v.useRef(null),a=dc(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Lt(()=>{var d;const l=a().find(u=>u.ref.current===document.activeElement);(d=l==null?void 0:l.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),m.jsx(et.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:it(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:it(r.onPointerMove,()=>{var l;(l=s.onItemLeave)==null||l.call(s),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:it(r.onPointerLeave,()=>{c()})})}),j8="SelectSeparator",L8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return m.jsx(et.div,{"aria-hidden":!0,...i,ref:e})});L8.displayName=j8;var du="SelectArrow",V8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=uc(n),s=Ai(du,n),o=Ii(du,n);return s.open&&o.position==="popper"?m.jsx(PO,{...r,...i,ref:e}):null});V8.displayName=du;var F8="SelectBubbleInput",bS=v.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const r=v.useRef(null),s=xt(i,r),o=AO(e);return v.useEffect(()=>{const a=r.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const u=new Event("change",{bubbles:!0});d.call(a,e),a.dispatchEvent(u)}},[o,e]),m.jsx(et.select,{...n,style:{...Bx,...n.style},ref:s,defaultValue:e})});bS.displayName=F8;function xS(t){return t===""||t===void 0}function SS(t){const e=Qi(t),n=v.useRef(""),i=v.useRef(0),r=v.useCallback(o=>{const a=n.current+o;e(a),function c(l){n.current=l,window.clearTimeout(i.current),l!==""&&(i.current=window.setTimeout(()=>c(""),1e3))}(a)},[e]),s=v.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,r,s]}function wS(t,e,n){const r=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=U8(t,Math.max(s,0));r.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function U8(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var B8=Jx,$8=Qx,H8=tS,z8=nS,W8=iS,q8=rS,K8=cS,G8=fS,Z8=hS,Y8=pS,J8=gS,X8=vS;function Ng({...t}){return m.jsx(B8,{"data-slot":"select",...t})}function Og({...t}){return m.jsx(H8,{"data-slot":"select-value",...t})}function Dg({className:t,size:e="default",children:n,...i}){return m.jsxs($8,{"data-slot":"select-trigger","data-size":e,className:fe(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...i,children:[n,m.jsx(z8,{asChild:!0,children:m.jsx(_f,{weight:"bold",className:"size-4 transition-colors"})})]})}function jg({className:t,children:e,position:n="popper",...i}){return m.jsx(W8,{children:m.jsxs(q8,{"data-slot":"select-content",className:fe(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[m.jsx(Q8,{}),m.jsx(K8,{className:fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),m.jsx(e6,{})]})})}function Lg({className:t,children:e,...n}){return m.jsxs(G8,{"data-slot":"select-item",className:fe(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...n,children:[m.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:m.jsx(Y8,{children:m.jsx(z1,{className:"size-4",weight:"bold"})})}),m.jsx(Z8,{children:e})]})}function Q8({className:t,...e}){return m.jsx(J8,{"data-slot":"select-scroll-up-button",className:fe("flex cursor-default items-center justify-center py-1",t),...e,children:m.jsx($1,{className:"size-4",weight:"bold"})})}function e6({className:t,...e}){return m.jsx(X8,{"data-slot":"select-scroll-down-button",className:fe("flex cursor-default items-center justify-center py-1",t),...e,children:m.jsx(_f,{className:"size-4",weight:"bold"})})}const Vg=rc(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function Fg({kind:t,track:e,requestPermissions:n,onError:i,client:r,...s}){const o=s.size||"default";if(!r)return m.jsxs(Ng,{disabled:!0,children:[m.jsx(Dg,{className:fe(Vg({size:o}),s.className),children:m.jsx(Og,{placeholder:`Select a ${t}`})}),m.jsx(jg,{children:m.jsx(Lg,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:c,setActiveMediaDevice:l}=D_(r,t==="audioinput"?"audioinput":"videoinput");return m.jsxs(Ng,{value:c,onValueChange:l,children:[m.jsx(Dg,{className:fe(Vg({size:o}),s.className,"hover:bg"),children:o!=="sm"&&m.jsx(Og,{className:"font-mono text-sm",placeholder:`Select a ${t}`})}),m.jsx(jg,{children:a.map(d=>m.jsx(Lg,{value:d.deviceId,className:"font-mono text-xs",children:d.label},d.deviceId))})]})}function t6(t,e,n=!1){if(n)return Nf;switch(t){case V.Source.Microphone:return e?W1:q1;case V.Source.Camera:return e?G1:Z1;case V.Source.ScreenShare:return K1;default:return v.Fragment}}function Il({source:t,pressed:e,pending:n,className:i,...r}){const s=t6(t,e??!1,n),o=t===V.Source.Microphone&&!(e??!1)&&!n,a=t===V.Source.Camera&&!(e??!1)&&!n;return v.useEffect(()=>{console.log(`TrackToggle for ${t} changed: pressed=${e}, pending=${n}, actualState=${e?"enabled":"disabled"}`)},[t,e,n]),m.jsxs(fx,{pressed:e,"aria-label":`Toggle ${t}`,className:fe(i),...r,children:[m.jsx(s,{weight:"bold",className:fe(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}function n6(t){return t?__(t):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function i6(t={}){const{controls:e,saveUserChoices:n=!0,client:i}=t,r={leave:!0,...e};if(!i)return{micTrackRef:{participant:void 0,source:V.Source.Microphone,publication:void 0},visibleControls:r,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:s,localParticipant:o}=N_(i),a=n6(i);O_(i);const c=xl(i,"microphone",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:V.Source.Microphone,error:T})}}),l=xl(i,"camera",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:V.Source.Camera,error:T})}}),d=xl(i,"screenShare",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:V.Source.ScreenShare,error:T})}}),u=v.useMemo(()=>{let T;if(o){for(const[,E]of o.trackPublications)if(E.source===V.Source.Microphone){T=E;break}}return console.log("🎤 Creating micTrackRef:",{hasParticipant:!!o,hasPublication:!!T,isTrackSubscribed:T==null?void 0:T.isSubscribed,isMuted:T==null?void 0:T.isMuted,trackSid:T==null?void 0:T.trackSid}),{participant:o??void 0,source:V.Source.Microphone,publication:T}},[o,s]);r.microphone??(r.microphone=a.microphone),r.screenShare??(r.screenShare=a.screenShare),r.camera??(r.camera=a.camera),r.chat??(r.chat=a.data);const{saveAudioInputEnabled:f,saveAudioInputDeviceId:p,saveVideoInputEnabled:g,saveVideoInputDeviceId:h}=j_({preventSave:!n}),y=v.useCallback(()=>{i&&i.disconnect()},[i]),b=v.useCallback(T=>{p(T??"default"),i&&i.setAudioInputDevice(T)},[p,i]),w=v.useCallback(T=>{h(T??"default"),i&&i.setVideoInputDevice(T)},[h,i]),C=v.useCallback(async T=>{d.enabled&&await d.toggle(!1),await l.toggle(T),g(!l.enabled)},[l,g,d]),S=v.useCallback(async T=>{await c.toggle(T),f(!c.enabled)},[c,f]),x=v.useCallback(async T=>{l.enabled&&await l.toggle(!1),await d.toggle(T)},[l,d]);return{micTrackRef:u,visibleControls:r,cameraToggle:{...l,toggle:C},microphoneToggle:{...c,toggle:S},screenShareToggle:{...d,toggle:x},handleDisconnect:y,handleAudioDeviceChange:b,handleVideoDeviceChange:w}}const r6={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},s6={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},o6={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Ug={dark:r6,light:s6,vox:o6};function St(t){return Ug[t]||Ug.vox}function a6({controls:t,saveUserChoices:e=!0,capabilities:n,className:i,onSendMessage:r,onChatOpenChange:s,onDisconnect:o,onDeviceError:a,theme:c="vox",client:l,...d}){const[u,f]=v.useState(!1),[p,g]=v.useState(!1),h=St(c),{micTrackRef:y,visibleControls:b,cameraToggle:w,microphoneToggle:C,screenShareToggle:S,handleAudioDeviceChange:x,handleVideoDeviceChange:T,handleDisconnect:E}=i6({controls:t,saveUserChoices:e,client:l}),P=async _=>{g(!0);try{await(r==null?void 0:r(_))}finally{g(!1)}};return v.useEffect(()=>{s==null||s(u)},[u,s]),v.useEffect(()=>{var _,k,I,N;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!y.participant,hasPublication:!!y.publication,source:y.source,isSubscribed:(_=y.publication)==null?void 0:_.isSubscribed,isMuted:(k=y.publication)==null?void 0:k.isMuted,trackSid:(I=y.publication)==null?void 0:I.trackSid,hasTrack:!!((N=y.publication)!=null&&N.track)})},[y]),m.jsxs("div",{"aria-label":"Voice assistant controls",className:fe(h.controlBar,i),...d,children:[n.suportsChatInput&&m.jsxs("div",{inert:!u,className:fe("overflow-hidden transition-[height] relative duration-300 ease-in-out",u?"h-[64px] mb-3":"h-0"),children:[m.jsx("div",{className:"flex h-9 px-4 w-full",children:m.jsx(k_,{onSend:P,disabled:p,className:fe("w-full",h.chatInput)})}),m.jsx("hr",{className:"border-border my-2 mx-5"})]}),m.jsxs("div",{className:fe("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",c==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[m.jsxs("div",{className:"flex gap-y-2 justify-start",children:[b.microphone&&m.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[m.jsx(Il,{variant:"primary",source:V.Source.Microphone,pressed:C.enabled,disabled:C.pending,onPressedChange:C.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),m.jsx(U1,{barCount:3,trackRef:y,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:m.jsx("span",{className:fe(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),m.jsx(Fg,{size:"sm",kind:"audioinput",client:l,onError:a?_=>_ instanceof Error?a({source:V.Source.Microphone,error:_}):void 0:void 0,onActiveDeviceChange:x,className:fe(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&b.camera&&m.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[m.jsx(Il,{variant:"primary",source:V.Source.Camera,pressed:w.enabled,pending:w.pending,disabled:w.pending,onPressedChange:w.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),m.jsx(Fg,{size:"sm",kind:"videoinput",client:l,onError:a?_=>_ instanceof Error?a({source:V.Source.Camera,error:_}):void 0:void 0,onActiveDeviceChange:T,className:fe(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),n.suportsScreenShare&&b.screenShare&&m.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:m.jsx(Il,{variant:"secondary",source:V.Source.ScreenShare,pressed:S.enabled,disabled:S.pending,onPressedChange:S.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),b.chat&&m.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:m.jsx(fx,{variant:"secondary","aria-label":"Toggle chat",pressed:u,onPressedChange:_=>{f(_)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:m.jsx(H1,{weight:"bold",className:"h-5 w-5"})})})]})]})}const c6=(t,e)=>{var a,c;const n=v.useMemo(()=>e?e(t.message):t.message,[t.message,e]),i=!!t.editTimestamp,r=new Date(t.timestamp),s=typeof navigator<"u"?navigator.language:"en-US",o=(a=t.from)!=null&&a.name&&t.from.name!==""?t.from.name:(c=t.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:i,time:r,locale:s,name:o}},l6=({entry:t,messageFormatter:e,className:n,participantName:i,...r})=>{var d,u;const{message:s,time:o,locale:a}=c6(t,e),c=((d=t.from)==null?void 0:d.isLocal)??!1;fe("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",c?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const l=fe("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",c?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return m.jsx("li",{title:o.toLocaleTimeString(a,{timeStyle:"full"}),className:fe("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:m.jsxs("div",{className:fe("flex w-fit max-w-full rounded-2xl border",c?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[m.jsx("span",{className:l,children:c?((u=i==null?void 0:i[0])==null?void 0:u.toUpperCase())||"U":"A"}),m.jsx("span",{className:fe("flex items-center text-xs break-words whitespace-pre-line",c?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:s})]})})};function d6(t){R.useEffect(()=>{function e(){const n=t.current;n&&(n.scrollTop=n.scrollHeight)}if(t.current){const n=new ResizeObserver(e);return n.observe(t.current),e(),()=>n.disconnect()}},[t])}const u6=({className:t,children:e,...n})=>{const i=R.useRef(null);return d6(i),m.jsx("div",{ref:i,className:fe("flex flex-col justify-end",t),...n,children:e})},f6=({state:t,audioTrack:e,className:n,ref:i})=>m.jsx("div",{ref:i,className:fe("",n),children:m.jsx(U1,{barCount:5,state:t,options:{minHeight:5},trackRef:e,className:fe("flex aspect-video w-40 items-center justify-center gap-1"),children:m.jsx("span",{className:fe(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})})}),h6=({videoTrack:t,className:e,ref:n})=>{var i,r;return m.jsx("div",{ref:n,className:fe(e),children:m.jsx(Mf,{trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},m6=xe.create(Mf),p6=({trackRef:t,className:e,ref:n})=>{var i,r;return m.jsx("div",{className:fe("bg-muted overflow-hidden rounded-md",e),children:m.jsx(m6,{ref:n,trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:fe("h-full w-auto")})})},Bg=xe.create(p6),g6=xe.create(f6),v6=xe.create(h6),Vn={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},gr={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function y6(t){const{localParticipant:e}=UM(),n=e.getTrackPublication(t);return R.useMemo(()=>n?{source:t,participant:e,publication:n}:void 0,[t,n,e])}function b6({chatOpen:t}){const{state:e,audioTrack:n,videoTrack:i,agent:{isActive:r=!1}={}}=V1(),[s]=If([V.Source.ScreenShare]),o=y6(V.Source.Camera),a=o&&!o.publication.isMuted,c=s&&!s.publication.isMuted,l=a||c,d={...Vn.transition,delay:t?0:.15},u={...Vn.animate,scale:t?1:3,transition:d},f={...Vn.animate,transition:d},p=d,g=d,h=i!==void 0;return m.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:m.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:m.jsxs("div",{className:fe(gr.grid),children:[r&&m.jsx("div",{className:fe(["grid",!t&&gr.agentChatClosed,t&&l&&gr.agentChatOpenWithSecondTile,t&&!l&&gr.agentChatOpenWithoutSecondTile]),children:m.jsxs("div",{className:"h-full flex items-center justify-center",children:[!h&&m.jsx(g6,{layoutId:"agent",...Vn,animate:u,transition:p,state:e,audioTrack:n,className:fe(t?"h-[90px]":"h-auto w-full")},"agent"),h&&m.jsx(v6,{layoutId:"avatar",...Vn,animate:f,transition:g,videoTrack:i,className:fe(t?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),m.jsx("div",{className:fe(["grid",t&&gr.secondTileChatOpen,!t&&gr.secondTileChatClosed]),children:m.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&m.jsx(Bg,{layout:"position",layoutId:"camera",...Vn,trackRef:o,transition:{...Vn.transition,delay:t?0:.15},className:"h-[60px] order-1"},"camera"),c&&m.jsx(Bg,{layout:"position",layoutId:"screen",...Vn,trackRef:s,transition:{...Vn.transition,delay:t?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}/**
79
118
  * @license lucide-react v0.522.0 - ISC
80
119
  *
81
120
  * This source code is licensed under the ISC license.
82
121
  * See the LICENSE file in the root directory of this source tree.
83
- */const Eb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),Tl=e=>{const t=kb(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wu=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),Ab=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
122
+ */const x6=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),S6=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),$g=t=>{const e=S6(t);return e.charAt(0).toUpperCase()+e.slice(1)},CS=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),w6=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
84
123
  * @license lucide-react v0.522.0 - ISC
85
124
  *
86
125
  * This source code is licensed under the ISC license.
87
126
  * See the LICENSE file in the root directory of this source tree.
88
- */var Tb={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
127
+ */var C6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
89
128
  * @license lucide-react v0.522.0 - ISC
90
129
  *
91
130
  * This source code is licensed under the ISC license.
92
131
  * See the LICENSE file in the root directory of this source tree.
93
- */const jb=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},l)=>E.createElement("svg",{ref:l,...Tb,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Wu("lucide",r),...!i&&!Ab(a)&&{"aria-hidden":"true"},...a},[...o.map(([d,u])=>E.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
132
+ */const k6=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...a},c)=>R.createElement("svg",{ref:c,...C6,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:CS("lucide",r),...!s&&!w6(a)&&{"aria-hidden":"true"},...a},[...o.map(([l,d])=>R.createElement(l,d)),...Array.isArray(s)?s:[s]]));/**
94
133
  * @license lucide-react v0.522.0 - ISC
95
134
  *
96
135
  * This source code is licensed under the ISC license.
97
136
  * See the LICENSE file in the root directory of this source tree.
98
- */const Ie=(e,t)=>{const n=E.forwardRef(({className:s,...r},i)=>E.createElement(jb,{ref:i,iconNode:t,className:Wu(`lucide-${Eb(Tl(e))}`,`lucide-${e}`,s),...r}));return n.displayName=Tl(e),n};/**
137
+ */const wt=(t,e)=>{const n=R.forwardRef(({className:i,...r},s)=>R.createElement(k6,{ref:s,iconNode:e,className:CS(`lucide-${x6($g(t))}`,`lucide-${t}`,i),...r}));return n.displayName=$g(t),n};/**
99
138
  * @license lucide-react v0.522.0 - ISC
100
139
  *
101
140
  * This source code is licensed under the ISC license.
102
141
  * See the LICENSE file in the root directory of this source tree.
103
- */const Pb=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Mb=Ie("archive",Pb);/**
142
+ */const T6=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],E6=wt("archive",T6);/**
104
143
  * @license lucide-react v0.522.0 - ISC
105
144
  *
106
145
  * This source code is licensed under the ISC license.
107
146
  * See the LICENSE file in the root directory of this source tree.
108
- */const Nb=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]],Ku=Ie("camera-off",Nb);/**
147
+ */const P6=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]],kS=wt("camera-off",P6);/**
109
148
  * @license lucide-react v0.522.0 - ISC
110
149
  *
111
150
  * This source code is licensed under the ISC license.
112
151
  * See the LICENSE file in the root directory of this source tree.
113
- */const Rb=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Yu=Ie("camera",Rb);/**
152
+ */const R6=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],TS=wt("camera",R6);/**
114
153
  * @license lucide-react v0.522.0 - ISC
115
154
  *
116
155
  * This source code is licensed under the ISC license.
117
156
  * See the LICENSE file in the root directory of this source tree.
118
- */const Vb=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ib=Ie("download",Vb);/**
157
+ */const A6=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],I6=wt("download",A6);/**
119
158
  * @license lucide-react v0.522.0 - ISC
120
159
  *
121
160
  * This source code is licensed under the ISC license.
122
161
  * See the LICENSE file in the root directory of this source tree.
123
- */const Db=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Lb=Ie("file-text",Db);/**
162
+ */const M6=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],_6=wt("file-text",M6);/**
124
163
  * @license lucide-react v0.522.0 - ISC
125
164
  *
126
165
  * This source code is licensed under the ISC license.
127
166
  * See the LICENSE file in the root directory of this source tree.
128
- */const Fb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ob=Ie("image",Fb);/**
167
+ */const N6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],O6=wt("image",N6);/**
129
168
  * @license lucide-react v0.522.0 - ISC
130
169
  *
131
170
  * This source code is licensed under the ISC license.
132
171
  * See the LICENSE file in the root directory of this source tree.
133
- */const _b=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],$b=Ie("layout-grid",_b);/**
172
+ */const D6=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],j6=wt("layout-grid",D6);/**
134
173
  * @license lucide-react v0.522.0 - ISC
135
174
  *
136
175
  * This source code is licensed under the ISC license.
137
176
  * See the LICENSE file in the root directory of this source tree.
138
- */const Bb=[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Hb=Ie("monitor-off",Bb);/**
177
+ */const L6=[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],V6=wt("monitor-off",L6);/**
139
178
  * @license lucide-react v0.522.0 - ISC
140
179
  *
141
180
  * This source code is licensed under the ISC license.
142
181
  * See the LICENSE file in the root directory of this source tree.
143
- */const Ub=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],zb=Ie("monitor",Ub);/**
182
+ */const F6=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],U6=wt("monitor",F6);/**
144
183
  * @license lucide-react v0.522.0 - ISC
145
184
  *
146
185
  * This source code is licensed under the ISC license.
147
186
  * See the LICENSE file in the root directory of this source tree.
148
- */const Zb=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Wb=Ie("music",Zb);/**
187
+ */const B6=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],$6=wt("music",B6);/**
149
188
  * @license lucide-react v0.522.0 - ISC
150
189
  *
151
190
  * This source code is licensed under the ISC license.
152
191
  * See the LICENSE file in the root directory of this source tree.
153
- */const Kb=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Yb=Ie("paperclip",Kb);/**
192
+ */const H6=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],z6=wt("paperclip",H6);/**
154
193
  * @license lucide-react v0.522.0 - ISC
155
194
  *
156
195
  * This source code is licensed under the ISC license.
157
196
  * See the LICENSE file in the root directory of this source tree.
158
- */const Gb=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],Gu=Ie("phone-off",Gb);/**
197
+ */const W6=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],ES=wt("phone-off",W6);/**
159
198
  * @license lucide-react v0.522.0 - ISC
160
199
  *
161
200
  * This source code is licensed under the ISC license.
162
201
  * See the LICENSE file in the root directory of this source tree.
163
- */const Xb=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],qb=Ie("send-horizontal",Xb);/**
202
+ */const q6=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],K6=wt("send-horizontal",q6);/**
164
203
  * @license lucide-react v0.522.0 - ISC
165
204
  *
166
205
  * This source code is licensed under the ISC license.
167
206
  * See the LICENSE file in the root directory of this source tree.
168
- */const Jb=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Qb=Ie("user",Jb);/**
207
+ */const G6=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Z6=wt("user",G6);/**
169
208
  * @license lucide-react v0.522.0 - ISC
170
209
  *
171
210
  * This source code is licensed under the ISC license.
172
211
  * See the LICENSE file in the root directory of this source tree.
173
- */const e2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],t2=Ie("users",e2);/**
212
+ */const Y6=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],J6=wt("users",Y6);/**
174
213
  * @license lucide-react v0.522.0 - ISC
175
214
  *
176
215
  * This source code is licensed under the ISC license.
177
216
  * See the LICENSE file in the root directory of this source tree.
178
- */const n2=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],s2=Ie("video",n2);/**
217
+ */const X6=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Q6=wt("video",X6);/**
179
218
  * @license lucide-react v0.522.0 - ISC
180
219
  *
181
220
  * This source code is licensed under the ISC license.
182
221
  * See the LICENSE file in the root directory of this source tree.
183
- */const r2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],o2=Ie("x",r2);function jl({timeout:e}){const[t,n]=E.useState(100),s=E.useRef(null),r=E.useRef(null);return E.useEffect(()=>{if(!e||e<=0)return;n(100),r.current=Date.now();const i=()=>{if(!e||r.current===null)return;const o=Date.now()-r.current,a=Math.max(0,100-o/e*100);n(a),a>0&&(s.current=requestAnimationFrame(i))};return s.current=requestAnimationFrame(i),()=>{s.current&&cancelAnimationFrame(s.current)}},[e]),!e||e<=0?null:c.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:c.jsx(ce.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(t,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function xn({interaction:e,theme:t,onDismiss:n,client:s,addLocalMessage:r}){var a;if(!e||!e.isVisible||!e.component)return null;const[i]=f.useState(()=>Date.now()),o=()=>e.component?f.createElement(e.component,{handler:e.handler||void 0,timeout:e.timeout,loadData:async d=>{console.log("InteractiveComponent: Loading data:",d)},presentationMode:e.presentationMode,data:e.data,client:s,addLocalMessage:r}):c.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(e.presentationMode){case"fullscreen":return c.jsx(dn,{children:c.jsxs(ce.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[c.jsxs("div",{className:"flex flex-col",children:[c.jsx(jl,{timeout:e.timeout}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[c.jsx("h3",{className:"text-lg font-semibold",children:e.methodName.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())}),c.jsx("button",{onClick:n||((a=e.handler)==null?void 0:a.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:c.jsx(o2,{className:"w-5 h-5"})})]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o()})]})});case"embedded":default:return c.jsx(dn,{children:c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:c.jsxs("div",{children:[c.jsx(jl,{timeout:e.timeout}),o()]})})})}}function i2(){const e=ke.useTranscriptions(),t=ke.useChat(),n=ke.useRoomContext();return{messages:E.useMemo(()=>[...e.map(i=>m1(i,n)),...t.chatMessages].sort((i,o)=>i.timestamp-o.timestamp),[e,t.chatMessages,n]),send:t.send}}const a2=({logLevel:e}={})=>{const t=ke.useRoomContext();f.useEffect(()=>(J.setLogLevel(e??"debug"),window.__lk_room=t,()=>{window.__lk_room=void 0}),[t,e])},l2=({disabled:e,capabilities:t,sessionStarted:n,ref:s,participantName:r="User",loadingText:i="Waiting for agent to connect...",theme:o="vox",client:a,displayType:l="widget",onBack:d})=>{var Z,ee,G,O,P,B,X;const[u,h]=E.useState(!1),[m,g]=E.useState(!1),[x,p]=E.useState(()=>{var re;const _=(re=a==null?void 0:a.getCurrentInteraction)==null?void 0:re.call(a);return console.log("SessionView: Initializing with existing interaction:",(_==null?void 0:_.methodName)||"none"),_||null}),{messages:v,send:b}=i2(),y=E.useRef(null),w=E.useRef(null),{agent:{isActive:S=!1}={}}=ke.useVoiceAssistant(),k=Ve(o),T=E.useMemo(()=>a&&typeof a.getCurrentSession=="function"?!!a.getCurrentSession():!1,[a]),A=S||T;E.useEffect(()=>{var _,re;console.log("🤖 SessionView agent state:",{isAgentActive:S,hasActiveSession:T,effectiveAgentActive:A,sessionStarted:n,clientSession:(re=(_=a==null?void 0:a.getCurrentSession)==null?void 0:_.call(a))==null?void 0:re.id})},[S,T,A,n,a]),E.useEffect(()=>{console.log("🤖 Agent active state changed:",S)},[S]),E.useEffect(()=>{console.log("📋 Session state changed:",{sessionStarted:n,disabled:e,participantName:r,effectiveAgentActive:A,chatOpen:u,currentInteraction:(x==null?void 0:x.methodName)||"none"})},[n,e,r,A,u,x]),E.useEffect(()=>{if(n&&!S){console.log("⏰ Starting agent timeout detection...");const _=setTimeout(()=>{console.log("⚠️ Agent timeout: Agent did not become active within 30 seconds"),g(!0)},3e4);return()=>{clearTimeout(_)}}else S&&(console.log("✅ Agent is active, clearing timeout"),g(!1))},[n,S]),E.useEffect(()=>{if(!a)return;const _=()=>{console.log("🔄 Client connection state changed:",a.connected)},re=M=>{console.log("🔴 Client disconnected:",M),p(null),h(!1),g(!1)};return a.on("connection.connected",_),a.on("connection.disconnected",re),()=>{a.off("connection.connected",_),a.off("connection.disconnected",re)}},[a]),E.useEffect(()=>{if(!a)return;const _=q=>{console.log("🎯 SessionView: RPC Interaction started:",q);const U=a.getCurrentInteraction();U&&(console.log("📱 SessionView: Setting current interaction:",U.methodName,"mode:",U.presentationMode),p(U))},re=q=>{console.log("✅ SessionView: RPC Interaction completed:",q),p(null)},M=async q=>{console.log("⏰ SessionView: RPC Interaction timeout:",q),p(null)},H=async q=>{console.log("❌ SessionView: RPC Interaction dismissed:",q),p(null)};return a.on("rpc.interaction.started",_),a.on("rpc.interaction.completed",re),a.on("rpc.interaction.timeout",M),a.on("rpc.interaction.dismissed",H),()=>{a.off("rpc.interaction.started",_),a.off("rpc.interaction.completed",re),a.off("rpc.interaction.timeout",M),a.off("rpc.interaction.dismissed",H)}},[a]),E.useEffect(()=>{if(!a)return;const _=a.getCurrentInteraction();_?(console.log("🔄 SessionView: Syncing with existing interaction:",_.methodName),p(_)):p(null)},[a]),E.useEffect(()=>{console.log("🎭 SessionView: Current interaction changed:",(x==null?void 0:x.methodName)||"none","mode:",(x==null?void 0:x.presentationMode)||"none")},[x]),E.useEffect(()=>{var _,re,M;console.log("📱 SessionView: Display type changed to:",l),console.log("📱 SessionView: Current session state during display change:",{sessionStarted:n,effectiveAgentActive:A,hasSession:!!((_=a==null?void 0:a.getCurrentSession)!=null&&_.call(a)),sessionId:(M=(re=a==null?void 0:a.getCurrentSession)==null?void 0:re.call(a))==null?void 0:M.id})},[l,n,A,a]),E.useEffect(()=>{console.log("💬 SessionView: Chat open state changed:",u)},[u]),E.useEffect(()=>{x&&u&&(console.log("🎭 SessionView: Interactive UI appeared, closing chat"),h(!1))},[x,u]),a2(),E.useEffect(()=>{y.current&&u&&v.length>0&&(console.log("📜 SessionView: Auto-scrolling to latest message, count:",v.length),setTimeout(()=>{if(y.current){let _=y.current.parentElement;for(;_&&_.scrollHeight<=_.clientHeight;)_=_.parentElement;_?(console.log("📜 SessionView: Scrolling container found, scrolling to bottom"),_.scrollTo({top:_.scrollHeight,behavior:"smooth"})):(console.log("📜 SessionView: Using fallback scroll method"),y.current.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}))}},100))},[v.length,u]),E.useEffect(()=>{var M,H;console.log("📝 SessionView: Messages updated, count:",v.length),v.length>0&&console.log("📝 SessionView: Latest messages:",v.slice(-3).map(q=>{var U,N,L,W,D,ne,te;return{id:q.id,message:q.message,timestamp:q.timestamp,from:((U=q.from)==null?void 0:U.name)||((N=q.from)==null?void 0:N.identity),fromType:q.from===void 0?"unknown":"participant",isLocal:((L=q.from)==null?void 0:L.identity)===((ne=(D=(W=a==null?void 0:a.getCurrentSession)==null?void 0:W.call(a))==null?void 0:D.localParticipant)==null?void 0:ne.identity),messageLength:((te=q.message)==null?void 0:te.length)||0}}));const _=((M=a==null?void 0:a.getTranscriptions)==null?void 0:M.call(a))||[],re=((H=a==null?void 0:a.getChatMessages)==null?void 0:H.call(a))||[];console.log("📝 SessionView: Raw transcriptions count:",_.length),console.log("📝 SessionView: Raw chat messages count:",re.length)},[v.length,v,a]),E.useEffect(()=>{console.log("💬 SessionView: Chat state changed:",{chatOpen:u,messagesCount:v.length,displayType:l,hasMessages:v.length>0})},[u,v.length,l]);async function j(_){await b(_)}const V=E.useCallback(_=>{console.log("📝 SessionView: Adding local message for voice session context:",_)},[]),I=E.useCallback(async _=>{try{a&&typeof a.sendAttachments=="function"&&(await a.sendAttachments(_),console.log("📎 SessionView: Attachments sent successfully:",_.map(re=>re.name)))}catch(re){console.error("❌ SessionView: Failed to send attachments:",re)}},[a]),$=E.useCallback(()=>{try{console.log("📞 SessionView: Ending call..."),console.log("📞 SessionView: Current state before ending:",{sessionStarted:n,effectiveAgentActive:A,chatOpen:u,currentInteraction:x==null?void 0:x.methodName,hasOnBack:!!d}),x&&(console.log("🎭 SessionView: Dismissing current interaction:",x.methodName),p(null),a&&typeof a.dismissCurrentInteraction=="function"&&a.dismissCurrentInteraction()),h(!1),g(!1),console.log("✅ SessionView: Local state reset"),a&&typeof a.endSession=="function"&&(a.endSession(),console.log("✅ SessionView: Session ended via client.endSession()")),a&&typeof a.disconnect=="function"&&(a.disconnect(),console.log("✅ SessionView: Client disconnected")),d?(console.log("🔄 SessionView: Calling onBack to return to welcome..."),setTimeout(()=>{d(),console.log("✅ SessionView: onBack called")},150)):console.warn("⚠️ SessionView: No onBack function provided - cannot return to welcome"),console.log("🏁 SessionView: Call ended and cleanup completed")}catch(_){console.error("❌ SessionView: Failed to end call:",_),p(null),h(!1),g(!1),d&&(console.log("🔄 SessionView: Error occurred, still calling onBack..."),d())}},[a,d,x,n,A,u]);E.useEffect(()=>(console.log("🔄 SessionView: Component mounted/props changed:",{sessionStarted:n,disabled:e,participantName:r,displayType:l,hasOnBack:!!d,hasClient:!!a}),()=>{console.log("🧹 SessionView: Component unmounting or props changing")}),[n,e,r,l,d,a]),E.useEffect(()=>{console.log("🔗 SessionView: onBack prop:",{hasOnBack:!!d,onBackType:typeof d})},[d]),E.useEffect(()=>{var re,M;const _=((M=(re=a==null?void 0:a.getCurrentSession)==null?void 0:re.call(a))==null?void 0:M.id)||null;w.current&&!_&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:w.current,currentSession:_,displayType:l,sessionStarted:n,effectiveAgentActive:A}),w.current=_},[a,l,n,A]);const F=Q("w-full flex flex-col items-center justify-center",l==="fullscreen"?"w-full max-w-none mx-0 h-full":"w-full mx-auto",k.main,l==="fullscreen"?"max-w-none":"","overflow-hidden","h-full"),se=d&&(l==="popup"||l==="fullscreen");return c.jsxs("main",{ref:s,inert:e,className:Q(F,"relative"),style:{minHeight:0},children:[se&&c.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((Z=k.chatHeader)==null?void 0:Z.container)||"border-gray-200"}`,children:c.jsx("div",{className:"flex items-center",children:c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold ${k.text.primary}`,children:"Voice Session"}),c.jsx("p",{className:`text-sm ${k.text.muted}`,children:r})]})})}),c.jsxs("div",{className:"w-full flex-1 flex flex-col items-center px-0 min-h-0 overflow-hidden",children:[!A&&c.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[c.jsx(ce.div,{animate:{rotate:360,scale:[1,1.1,1]},transition:{rotate:{duration:2,repeat:1/0,ease:"linear"},scale:{duration:1,repeat:1/0,ease:"easeInOut"}},className:"w-12 h-12 mb-4",children:c.jsx(ei,{className:k.spinner,weight:"bold"})}),c.jsx(ce.span,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`text-sm opacity-80 ${k.text.muted} text-center max-w-xs`,children:m?"Agent is taking longer than expected...":i}),c.jsx(ce.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${k.text.muted} mt-2 text-center opacity-60`,children:m?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),m&&d&&c.jsx(ce.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5},onClick:d,className:`mt-4 px-4 py-2 rounded-lg ${((ee=k.chatHeader)==null?void 0:ee.backButton)||"bg-gray-100 hover:bg-gray-200"} transition-colors`,children:"Go Back"})]}),A&&c.jsxs(c.Fragment,{children:[u&&c.jsxs("div",{className:Q("absolute inset-0 w-full h-full flex flex-col transition-[opacity,translate] duration-300 ease-out z-10",o==="light"?"bg-white":"bg-gray-900/95 backdrop-blur-sm",u?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:[c.jsxs("div",{className:Q("flex-shrink-0 px-4 py-3 border-b",l==="fullscreen"?"px-8":"px-5",((G=k.chatHeader)==null?void 0:G.container)||"border-gray-200 dark:border-gray-700"),children:[c.jsx("h3",{className:Q("font-semibold text-lg",((O=k.text)==null?void 0:O.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),c.jsxs("p",{className:Q("text-sm",((P=k.text)==null?void 0:P.muted)||"text-gray-600 dark:text-gray-400"),children:[v.length," messages"]})]}),c.jsx("div",{className:Q("flex-1 flex flex-col min-h-0",l==="fullscreen"?"px-8":"px-5"),children:c.jsx(pb,{className:"flex-1 flex flex-col min-h-0 h-full",children:c.jsxs("div",{className:`flex-1 flex flex-col h-full ${Q("overflow-y-auto scrollbar-hide py-4")}`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",paddingBottom:"120px"},children:[v.length===0&&c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx("p",{className:Q("text-lg font-medium mb-2",((B=k.text)==null?void 0:B.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),c.jsx("p",{className:Q("text-sm",((X=k.text)==null?void 0:X.muted)||"text-gray-600 dark:text-gray-400"),children:"Your conversation will appear here"})]})}),v.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex-1 min-h-4"}),c.jsx("div",{ref:y,className:"space-y-4 relative whitespace-pre-wrap z-0",children:c.jsx(dn,{mode:"popLayout",children:v.map((_,re)=>c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:re*.02},layout:!0,children:c.jsx(hb,{participantName:r,entry:_})},_.id||`message-${re}`))})})]})]})})})]}),!u&&c.jsxs("div",{className:Q("flex-1 flex flex-col items-center w-full h-full min-h-0",(x==null?void 0:x.presentationMode)==="embedded"?"justify-end":"justify-center"),children:[c.jsx(ce.div,{className:"w-full flex justify-center",animate:{y:(x==null?void 0:x.presentationMode)==="embedded"?-8:0},transition:{duration:.3,ease:"easeOut"},children:c.jsx(Cb,{chatOpen:u})}),c.jsx(dn,{mode:"wait",children:x&&x.presentationMode==="embedded"&&c.jsx(ce.div,{initial:{opacity:0,y:20,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:20,height:0},transition:{duration:.3,ease:"easeOut"},className:Q("w-full relative mt-4 flex justify-center",l==="fullscreen"?"max-w-4xl":"max-w-md"),children:c.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl border border-white/20 shadow-lg overflow-hidden",children:c.jsx(xn,{interaction:x,theme:o,onDismiss:()=>{var _;return(_=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:_.call(a)},client:a,addLocalMessage:V})})},`embedded-${x.methodName}`)})]})]})]}),c.jsx(dn,{mode:"wait",children:x&&x.presentationMode!=="embedded"&&!u&&c.jsx("div",{className:Q("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",l==="fullscreen"?"bg-black/70":"bg-black/50"),children:c.jsx(ce.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:Q("relative w-full overflow-hidden",l==="fullscreen"?"max-w-2xl mx-8 max-h-[85vh]":"max-w-lg mx-4 max-h-[80vh]","bg-white dark:bg-gray-900 rounded-2xl shadow-2xl","border border-gray-200 dark:border-gray-700"),children:c.jsx(xn,{interaction:x,theme:o,onDismiss:()=>{var _;return(_=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:_.call(a)},client:a,addLocalMessage:V})},`modal-${x.methodName}`)})}),c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"absolute bottom-0 left-0 right-0 flex-shrink-0 w-full z-20",children:c.jsx(c2,{capabilities:t,onSendMessage:j,onSendAttachments:I,onEndCall:$,onChatOpenChange:h,disabled:e,theme:o,client:a,sessionStarted:n})})]})};function c2({capabilities:e,onSendMessage:t,onSendAttachments:n,onEndCall:s,onChatOpenChange:r,disabled:i=!1,theme:o,client:a,sessionStarted:l=!1}){const[d,u]=E.useState(!1),h=E.useRef(null),m=E.useRef(null);E.useEffect(()=>{const y=()=>{const w=navigator.userAgent.toLowerCase(),k=["android","iphone","ipad","mobile","tablet"].some(j=>w.includes(j)),T="ontouchstart"in window||navigator.maxTouchPoints>0,A=window.innerWidth<=768;u(k||T&&A)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]);const g=y=>{const w=y.target.files;if(w&&w.length>0){const k=Array.from(w).filter(T=>T.type.startsWith("image/"));if(k.length===0){console.warn("No valid image files selected");return}n&&n(k),h.current&&(h.current.value="")}},x=y=>{const w=y.target.files;if(w&&w.length>0){const S=w[0];S.type.startsWith("image/")&&n&&n([S]),m.current&&(m.current.value="")}},p=()=>{!i&&h.current&&h.current.click()},v=()=>{!i&&d&&m.current&&m.current.click()},b=()=>{console.log("🔴 VoiceControlPanel: End call button clicked"),console.log("🔴 VoiceControlPanel: Current state:",{disabled:i,sessionStarted:l,hasOnEndCall:!!s}),s?s():console.warn("⚠️ VoiceControlPanel: No onEndCall function provided")};return c.jsx("div",{className:Q("px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg",o==="light"?"bg-white/95 border-t border-gray-200":"bg-gray-900/95 border-t border-gray-700"),children:c.jsxs("div",{className:"flex items-center justify-between !w-full mx-auto max-w-4xl",children:[c.jsx("input",{ref:h,type:"file",multiple:!0,onChange:g,className:"hidden",accept:"image/*"}),c.jsx("input",{ref:m,type:"file",onChange:x,className:"hidden",accept:"image/*",capture:"environment"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:p,disabled:i,className:Q("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",i?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Attach files",children:c.jsx(gt.AttachFile,{className:"w-5 h-5"})}),d&&c.jsx("button",{onClick:v,disabled:i,className:Q("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",i?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Take photo",children:c.jsx(gt.CameraAlt,{className:"w-5 h-5"})})]}),c.jsx("div",{className:"flex-1 flex justify-center px-4",children:c.jsx(ub,{capabilities:e,onChatOpenChange:r,onSendMessage:t,theme:o,client:a,className:"border-none py-1 rounded-xl max-w-md w-full"})}),c.jsx("div",{className:"flex items-center",children:c.jsx("button",{onClick:b,disabled:i||!l,className:Q("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",i||!l?"opacity-50 cursor-not-allowed":"hover:shadow-md","bg-red-500 hover:bg-red-600 text-white"),title:"End call",children:c.jsx(gt.CallEnd,{className:"w-5 h-5"})})})]})})}function d2({onSendMessage:e,onSendAttachments:t,disabled:n,theme:s,onEndChat:r}){const[i,o]=f.useState(""),[a,l]=f.useState(!1),d=f.useRef(null),u=f.useRef(null),[h,m]=f.useState(!1),g=Ve(s);f.useEffect(()=>{const S=()=>{const k=navigator.userAgent.toLowerCase(),A=["android","iphone","ipad","mobile","tablet"].some(I=>k.includes(I)),j="ontouchstart"in window||navigator.maxTouchPoints>0,V=window.innerWidth<=768;m(A||j&&V)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=S=>{S.preventDefault(),i.trim()&&!n&&(e(i.trim()),o(""))},p=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),x(S))},v=S=>{const k=S.target.files;if(k&&k.length>0){const T=Array.from(k),A=T.filter(j=>j.type.startsWith("image/"));if(A.length===0){console.warn("No valid image files selected");return}A.length!==T.length&&console.warn("Some non-image files were filtered out"),console.log("Selected image files:",A),t(A),d.current&&(d.current.value="")}},b=()=>{!n&&d.current&&d.current.click()},y=()=>{!n&&h&&u.current&&u.current.click()},w=S=>{const k=S.target.files;if(k&&k.length>0){const T=k[0];T.type.startsWith("image/")?t([T]):console.warn("Selected file is not an image"),u.current&&(u.current.value="")}};return c.jsx("div",{className:"px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg ",children:c.jsx("form",{onSubmit:x,className:"flex items-center !w-full mx-auto max-w-4xl",children:c.jsxs("div",{className:`flex items-center gap-2 !w-full backdrop-blur-md rounded-full px-3 py-2 shadow-sm hover:shadow-md focus-within:shadow-lg focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-500/50 transition-all duration-200 border ${s==="light"?"bg-white/90 border-gray-200":g.chatInput.container}`,children:[c.jsx(ce.button,{type:"button",onClick:b,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${g.chatInput.attachButton}`,disabled:n,"aria-label":"Attach file",children:c.jsx(Yb,{className:"w-4 h-4"})}),h&&c.jsx(ce.button,{type:"button",onClick:y,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${g.chatInput.attachButton}`,disabled:n,"aria-label":"Take photo",children:c.jsx(Yu,{className:"w-4 h-4"})}),c.jsx("input",{ref:d,type:"file",multiple:!0,onChange:v,className:"hidden",accept:"image/*"}),c.jsx("input",{ref:u,type:"file",onChange:w,className:"hidden",accept:"image/*",capture:"environment"}),c.jsx("textarea",{value:i,onChange:S=>o(S.target.value),onKeyDown:p,onFocus:()=>l(!0),onBlur:()=>l(!1),placeholder:"Type your message...",disabled:n,className:`flex-1 px-2 py-1 bg-transparent resize-none min-h-[32px] max-h-20 focus:outline-none text-sm border-0 ${g.chatInput.textarea}`,rows:1,style:{height:"auto",minHeight:"32px"},onInput:S=>{const k=S.target;k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,80)}px`}}),c.jsx(ce.button,{type:"submit",disabled:n||!i.trim(),whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${i.trim()&&!n?g.chatInput.sendButton:s==="light"?"bg-gray-200 text-gray-400 cursor-not-allowed opacity-70":"bg-gray-600/50 text-gray-500 cursor-not-allowed opacity-50"}`,"aria-label":"Send message",children:c.jsx(qb,{className:"w-4 h-4"})}),r&&c.jsx(ce.button,{type:"button",onClick:r,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${g.chatInput.endButton}`,"aria-label":"End chat",children:c.jsx(Gu,{className:"w-4 h-4"})})]})})})}function u2({text:e,isComplete:t,isRealTimeStream:n=!1,speed:s=50}){const[r,i]=f.useState(""),[o,a]=f.useState(0);return f.useEffect(()=>{if(n){i(e);return}if(t){i(e);return}if(o<e.length){const l=setTimeout(()=>{i(e.slice(0,o+1)),a(o+1)},s);return()=>clearTimeout(l)}},[e,o,t,s,n]),f.useEffect(()=>{n||(a(0),i(""))},[e,n]),c.jsxs("span",{className:"relative",children:[c.jsx("span",{className:"inline-block",children:r}),!t&&c.jsx("span",{className:"inline-flex items-center ml-1",children:[0,1,2].map(l=>c.jsx(ce.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:l*.2,ease:"easeInOut"}},l))})]})}function f2({message:e,theme:t,isOwn:n,isStreaming:s=!1}){var o,a;const r=Ve(t),i=e.sender.name?e.sender.name.split(" ").map(l=>l[0]).join("").toUpperCase().slice(0,2):"U";return c.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"} mb-4 px-1`,children:c.jsxs("div",{className:`relative group ${n?"flex-row-reverse":"flex-row"} flex items-end gap-3 max-w-[85%]`,children:[c.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${n?t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700":t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:i}),c.jsxs("div",{className:`
222
+ */const eD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tD=wt("x",eD);function Hg({timeout:t}){const[e,n]=R.useState(100),i=R.useRef(null),r=R.useRef(null);return R.useEffect(()=>{if(!t||t<=0)return;n(100),r.current=Date.now();const s=()=>{if(!t||r.current===null)return;const o=Date.now()-r.current,a=Math.max(0,100-o/t*100);n(a),a>0&&(i.current=requestAnimationFrame(s))};return i.current=requestAnimationFrame(s),()=>{i.current&&cancelAnimationFrame(i.current)}},[t]),!t||t<=0?null:m.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:m.jsx(xe.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(e,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function Qr({interaction:t,theme:e,onDismiss:n,client:i,addLocalMessage:r}){var a;if(!t||!t.isVisible||!t.component)return null;const[s]=v.useState(()=>Date.now()),o=()=>t.component?v.createElement(t.component,{handler:t.handler||void 0,timeout:t.timeout,loadData:async l=>{console.log("InteractiveComponent: Loading data:",l)},presentationMode:t.presentationMode,data:t.data,client:i,addLocalMessage:r}):m.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(t.presentationMode){case"fullscreen":return m.jsx(Vr,{children:m.jsxs(xe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[m.jsxs("div",{className:"flex flex-col",children:[m.jsx(Hg,{timeout:t.timeout}),m.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[m.jsx("h3",{className:"text-lg font-semibold",children:t.methodName.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}),m.jsx("button",{onClick:n||((a=t.handler)==null?void 0:a.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:m.jsx(tD,{className:"w-5 h-5"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o()})]})});case"embedded":default:return m.jsx(Vr,{children:m.jsx(xe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:m.jsxs("div",{children:[m.jsx(Hg,{timeout:t.timeout}),o()]})})})}}function nD(){const t=QM(),e=zM(),n=ho();return{messages:R.useMemo(()=>[...t.map(s=>d_(s,n)),...e.chatMessages].sort((s,o)=>s.timestamp-o.timestamp),[t,e.chatMessages,n]),send:e.send}}const iD=({logLevel:t}={})=>{const e=ho();v.useEffect(()=>(wk(t??"debug"),window.__lk_room=e,()=>{window.__lk_room=void 0}),[e,t])},zg=t=>t,rD=()=>{let t=zg;return{configure(e){t=e},generate(e){return t(e)},reset(){t=zg}}},sD=rD();function wi(t,...e){const n=new URL(`https://mui.com/production-error/?code=${t}`);return e.forEach(i=>n.searchParams.append("args[]",i)),`Minified MUI error #${t}; visit ${n} for the full message.`}function ir(t){if(typeof t!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":wi(7));return t.charAt(0).toUpperCase()+t.slice(1)}var Fo={exports:{}},Uo={exports:{}},Me={};/** @license React v16.13.1
223
+ * react-is.production.min.js
224
+ *
225
+ * Copyright (c) Facebook, Inc. and its affiliates.
226
+ *
227
+ * This source code is licensed under the MIT license found in the
228
+ * LICENSE file in the root directory of this source tree.
229
+ */var Wg;function oD(){if(Wg)return Me;Wg=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,r=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,a=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,l=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,u=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,g=t?Symbol.for("react.lazy"):60116,h=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,b=t?Symbol.for("react.responder"):60118,w=t?Symbol.for("react.scope"):60119;function C(x){if(typeof x=="object"&&x!==null){var T=x.$$typeof;switch(T){case e:switch(x=x.type,x){case c:case l:case i:case s:case r:case u:return x;default:switch(x=x&&x.$$typeof,x){case a:case d:case g:case p:case o:return x;default:return T}}case n:return T}}}function S(x){return C(x)===l}return Me.AsyncMode=c,Me.ConcurrentMode=l,Me.ContextConsumer=a,Me.ContextProvider=o,Me.Element=e,Me.ForwardRef=d,Me.Fragment=i,Me.Lazy=g,Me.Memo=p,Me.Portal=n,Me.Profiler=s,Me.StrictMode=r,Me.Suspense=u,Me.isAsyncMode=function(x){return S(x)||C(x)===c},Me.isConcurrentMode=S,Me.isContextConsumer=function(x){return C(x)===a},Me.isContextProvider=function(x){return C(x)===o},Me.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===e},Me.isForwardRef=function(x){return C(x)===d},Me.isFragment=function(x){return C(x)===i},Me.isLazy=function(x){return C(x)===g},Me.isMemo=function(x){return C(x)===p},Me.isPortal=function(x){return C(x)===n},Me.isProfiler=function(x){return C(x)===s},Me.isStrictMode=function(x){return C(x)===r},Me.isSuspense=function(x){return C(x)===u},Me.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===i||x===l||x===s||x===r||x===u||x===f||typeof x=="object"&&x!==null&&(x.$$typeof===g||x.$$typeof===p||x.$$typeof===o||x.$$typeof===a||x.$$typeof===d||x.$$typeof===y||x.$$typeof===b||x.$$typeof===w||x.$$typeof===h)},Me.typeOf=C,Me}var _e={};/** @license React v16.13.1
230
+ * react-is.development.js
231
+ *
232
+ * Copyright (c) Facebook, Inc. and its affiliates.
233
+ *
234
+ * This source code is licensed under the MIT license found in the
235
+ * LICENSE file in the root directory of this source tree.
236
+ */var qg;function aD(){return qg||(qg=1,process.env.NODE_ENV!=="production"&&function(){var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,r=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,a=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,l=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,u=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,g=t?Symbol.for("react.lazy"):60116,h=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,b=t?Symbol.for("react.responder"):60118,w=t?Symbol.for("react.scope"):60119;function C(z){return typeof z=="string"||typeof z=="function"||z===i||z===l||z===s||z===r||z===u||z===f||typeof z=="object"&&z!==null&&(z.$$typeof===g||z.$$typeof===p||z.$$typeof===o||z.$$typeof===a||z.$$typeof===d||z.$$typeof===y||z.$$typeof===b||z.$$typeof===w||z.$$typeof===h)}function S(z){if(typeof z=="object"&&z!==null){var me=z.$$typeof;switch(me){case e:var Ee=z.type;switch(Ee){case c:case l:case i:case s:case r:case u:return Ee;default:var qe=Ee&&Ee.$$typeof;switch(qe){case a:case d:case g:case p:case o:return qe;default:return me}}case n:return me}}}var x=c,T=l,E=a,P=o,_=e,k=d,I=i,N=g,K=p,J=n,se=s,ie=r,X=u,O=!1;function oe(z){return O||(O=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),L(z)||S(z)===c}function L(z){return S(z)===l}function F(z){return S(z)===a}function te(z){return S(z)===o}function j(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function q(z){return S(z)===d}function ee(z){return S(z)===i}function G(z){return S(z)===g}function D(z){return S(z)===p}function $(z){return S(z)===n}function Q(z){return S(z)===s}function W(z){return S(z)===r}function ce(z){return S(z)===u}_e.AsyncMode=x,_e.ConcurrentMode=T,_e.ContextConsumer=E,_e.ContextProvider=P,_e.Element=_,_e.ForwardRef=k,_e.Fragment=I,_e.Lazy=N,_e.Memo=K,_e.Portal=J,_e.Profiler=se,_e.StrictMode=ie,_e.Suspense=X,_e.isAsyncMode=oe,_e.isConcurrentMode=L,_e.isContextConsumer=F,_e.isContextProvider=te,_e.isElement=j,_e.isForwardRef=q,_e.isFragment=ee,_e.isLazy=G,_e.isMemo=D,_e.isPortal=$,_e.isProfiler=Q,_e.isStrictMode=W,_e.isSuspense=ce,_e.isValidElementType=C,_e.typeOf=S}()),_e}var Kg;function PS(){return Kg||(Kg=1,process.env.NODE_ENV==="production"?Uo.exports=oD():Uo.exports=aD()),Uo.exports}/*
237
+ object-assign
238
+ (c) Sindre Sorhus
239
+ @license MIT
240
+ */var Ml,Gg;function cD(){if(Gg)return Ml;Gg=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function r(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(o).map(function(d){return o[d]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ml=r()?Object.assign:function(s,o){for(var a,c=i(s),l,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var u in a)e.call(a,u)&&(c[u]=a[u]);if(t){l=t(a);for(var f=0;f<l.length;f++)n.call(a,l[f])&&(c[l[f]]=a[l[f]])}}return c},Ml}var _l,Zg;function Kf(){if(Zg)return _l;Zg=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _l=t,_l}var Nl,Yg;function RS(){return Yg||(Yg=1,Nl=Function.call.bind(Object.prototype.hasOwnProperty)),Nl}var Ol,Jg;function lD(){if(Jg)return Ol;Jg=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var e=Kf(),n={},i=RS();t=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function r(s,o,a,c,l){if(process.env.NODE_ENV!=="production"){for(var d in s)if(i(s,d)){var u;try{if(typeof s[d]!="function"){var f=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}u=s[d](o,d,c,a,null,e)}catch(g){u=g}if(u&&!(u instanceof Error)&&t((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in n)){n[u.message]=!0;var p=l?l():"";t("Failed "+a+" type: "+u.message+(p??""))}}}}return r.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ol=r,Ol}var Dl,Xg;function dD(){if(Xg)return Dl;Xg=1;var t=PS(),e=cD(),n=Kf(),i=RS(),r=lD(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function o(){return null}return Dl=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function u(L){var F=L&&(l&&L[l]||L[d]);if(typeof F=="function")return F}var f="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:w(),arrayOf:C,element:S(),elementType:x(),instanceOf:T,node:k(),objectOf:P,oneOf:E,oneOfType:_,shape:N,exact:K};function g(L,F){return L===F?L!==0||1/L===1/F:L!==L&&F!==F}function h(L,F){this.message=L,this.data=F&&typeof F=="object"?F:{},this.stack=""}h.prototype=Error.prototype;function y(L){if(process.env.NODE_ENV!=="production")var F={},te=0;function j(ee,G,D,$,Q,W,ce){if($=$||f,W=W||D,ce!==n){if(c){var z=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw z.name="Invariant Violation",z}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var me=$+":"+D;!F[me]&&te<3&&(s("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+$+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),F[me]=!0,te++)}}return G[D]==null?ee?G[D]===null?new h("The "+Q+" `"+W+"` is marked as required "+("in `"+$+"`, but its value is `null`.")):new h("The "+Q+" `"+W+"` is marked as required in "+("`"+$+"`, but its value is `undefined`.")):null:L(G,D,$,Q,W)}var q=j.bind(null,!1);return q.isRequired=j.bind(null,!0),q}function b(L){function F(te,j,q,ee,G,D){var $=te[j],Q=ie($);if(Q!==L){var W=X($);return new h("Invalid "+ee+" `"+G+"` of type "+("`"+W+"` supplied to `"+q+"`, expected ")+("`"+L+"`."),{expectedType:L})}return null}return y(F)}function w(){return y(o)}function C(L){function F(te,j,q,ee,G){if(typeof L!="function")return new h("Property `"+G+"` of component `"+q+"` has invalid PropType notation inside arrayOf.");var D=te[j];if(!Array.isArray(D)){var $=ie(D);return new h("Invalid "+ee+" `"+G+"` of type "+("`"+$+"` supplied to `"+q+"`, expected an array."))}for(var Q=0;Q<D.length;Q++){var W=L(D,Q,q,ee,G+"["+Q+"]",n);if(W instanceof Error)return W}return null}return y(F)}function S(){function L(F,te,j,q,ee){var G=F[te];if(!a(G)){var D=ie(G);return new h("Invalid "+q+" `"+ee+"` of type "+("`"+D+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return y(L)}function x(){function L(F,te,j,q,ee){var G=F[te];if(!t.isValidElementType(G)){var D=ie(G);return new h("Invalid "+q+" `"+ee+"` of type "+("`"+D+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return y(L)}function T(L){function F(te,j,q,ee,G){if(!(te[j]instanceof L)){var D=L.name||f,$=oe(te[j]);return new h("Invalid "+ee+" `"+G+"` of type "+("`"+$+"` supplied to `"+q+"`, expected ")+("instance of `"+D+"`."))}return null}return y(F)}function E(L){if(!Array.isArray(L))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function F(te,j,q,ee,G){for(var D=te[j],$=0;$<L.length;$++)if(g(D,L[$]))return null;var Q=JSON.stringify(L,function(ce,z){var me=X(z);return me==="symbol"?String(z):z});return new h("Invalid "+ee+" `"+G+"` of value `"+String(D)+"` "+("supplied to `"+q+"`, expected one of "+Q+"."))}return y(F)}function P(L){function F(te,j,q,ee,G){if(typeof L!="function")return new h("Property `"+G+"` of component `"+q+"` has invalid PropType notation inside objectOf.");var D=te[j],$=ie(D);if($!=="object")return new h("Invalid "+ee+" `"+G+"` of type "+("`"+$+"` supplied to `"+q+"`, expected an object."));for(var Q in D)if(i(D,Q)){var W=L(D,Q,q,ee,G+"."+Q,n);if(W instanceof Error)return W}return null}return y(F)}function _(L){if(!Array.isArray(L))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var F=0;F<L.length;F++){var te=L[F];if(typeof te!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+O(te)+" at index "+F+"."),o}function j(q,ee,G,D,$){for(var Q=[],W=0;W<L.length;W++){var ce=L[W],z=ce(q,ee,G,D,$,n);if(z==null)return null;z.data&&i(z.data,"expectedType")&&Q.push(z.data.expectedType)}var me=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new h("Invalid "+D+" `"+$+"` supplied to "+("`"+G+"`"+me+"."))}return y(j)}function k(){function L(F,te,j,q,ee){return J(F[te])?null:new h("Invalid "+q+" `"+ee+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return y(L)}function I(L,F,te,j,q){return new h((L||"React class")+": "+F+" type `"+te+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+q+"`.")}function N(L){function F(te,j,q,ee,G){var D=te[j],$=ie(D);if($!=="object")return new h("Invalid "+ee+" `"+G+"` of type `"+$+"` "+("supplied to `"+q+"`, expected `object`."));for(var Q in L){var W=L[Q];if(typeof W!="function")return I(q,ee,G,Q,X(W));var ce=W(D,Q,q,ee,G+"."+Q,n);if(ce)return ce}return null}return y(F)}function K(L){function F(te,j,q,ee,G){var D=te[j],$=ie(D);if($!=="object")return new h("Invalid "+ee+" `"+G+"` of type `"+$+"` "+("supplied to `"+q+"`, expected `object`."));var Q=e({},te[j],L);for(var W in Q){var ce=L[W];if(i(L,W)&&typeof ce!="function")return I(q,ee,G,W,X(ce));if(!ce)return new h("Invalid "+ee+" `"+G+"` key `"+W+"` supplied to `"+q+"`.\nBad object: "+JSON.stringify(te[j],null," ")+`
241
+ Valid keys: `+JSON.stringify(Object.keys(L),null," "));var z=ce(D,W,q,ee,G+"."+W,n);if(z)return z}return null}return y(F)}function J(L){switch(typeof L){case"number":case"string":case"undefined":return!0;case"boolean":return!L;case"object":if(Array.isArray(L))return L.every(J);if(L===null||a(L))return!0;var F=u(L);if(F){var te=F.call(L),j;if(F!==L.entries){for(;!(j=te.next()).done;)if(!J(j.value))return!1}else for(;!(j=te.next()).done;){var q=j.value;if(q&&!J(q[1]))return!1}}else return!1;return!0;default:return!1}}function se(L,F){return L==="symbol"?!0:F?F["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&F instanceof Symbol:!1}function ie(L){var F=typeof L;return Array.isArray(L)?"array":L instanceof RegExp?"object":se(F,L)?"symbol":F}function X(L){if(typeof L>"u"||L===null)return""+L;var F=ie(L);if(F==="object"){if(L instanceof Date)return"date";if(L instanceof RegExp)return"regexp"}return F}function O(L){var F=X(L);switch(F){case"array":case"object":return"an "+F;case"boolean":case"date":case"regexp":return"a "+F;default:return F}}function oe(L){return!L.constructor||!L.constructor.name?f:L.constructor.name}return p.checkPropTypes=r,p.resetWarningCache=r.resetWarningCache,p.PropTypes=p,p},Dl}var jl,Qg;function uD(){if(Qg)return jl;Qg=1;var t=Kf();function e(){}function n(){}return n.resetWarningCache=e,jl=function(){function i(o,a,c,l,d,u){if(u!==t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}i.isRequired=i;function r(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:r,element:i,elementType:i,instanceOf:r,node:i,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:e};return s.PropTypes=s,s},jl}var e0;function fD(){if(e0)return Fo.exports;if(e0=1,process.env.NODE_ENV!=="production"){var t=PS(),e=!0;Fo.exports=dD()(t.isElement,e)}else Fo.exports=uD()();return Fo.exports}var hD=fD();const Pe=Uw(hD);function mD(t,e,n=void 0){const i={};for(const r in t){const s=t[r];let o="",a=!0;for(let c=0;c<s.length;c+=1){const l=s[c];l&&(o+=(a===!0?"":" ")+e(l),a=!1,n&&n[l]&&(o+=" "+n[l]))}i[r]=o}return i}var Bo={exports:{}},Ne={};/**
242
+ * @license React
243
+ * react-is.production.js
244
+ *
245
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
246
+ *
247
+ * This source code is licensed under the MIT license found in the
248
+ * LICENSE file in the root directory of this source tree.
249
+ */var t0;function pD(){if(t0)return Ne;t0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),f=Symbol.for("react.view_transition"),p=Symbol.for("react.client.reference");function g(h){if(typeof h=="object"&&h!==null){var y=h.$$typeof;switch(y){case t:switch(h=h.type,h){case n:case r:case i:case c:case l:case f:return h;default:switch(h=h&&h.$$typeof,h){case o:case a:case u:case d:return h;case s:return h;default:return y}}case e:return y}}}return Ne.ContextConsumer=s,Ne.ContextProvider=o,Ne.Element=t,Ne.ForwardRef=a,Ne.Fragment=n,Ne.Lazy=u,Ne.Memo=d,Ne.Portal=e,Ne.Profiler=r,Ne.StrictMode=i,Ne.Suspense=c,Ne.SuspenseList=l,Ne.isContextConsumer=function(h){return g(h)===s},Ne.isContextProvider=function(h){return g(h)===o},Ne.isElement=function(h){return typeof h=="object"&&h!==null&&h.$$typeof===t},Ne.isForwardRef=function(h){return g(h)===a},Ne.isFragment=function(h){return g(h)===n},Ne.isLazy=function(h){return g(h)===u},Ne.isMemo=function(h){return g(h)===d},Ne.isPortal=function(h){return g(h)===e},Ne.isProfiler=function(h){return g(h)===r},Ne.isStrictMode=function(h){return g(h)===i},Ne.isSuspense=function(h){return g(h)===c},Ne.isSuspenseList=function(h){return g(h)===l},Ne.isValidElementType=function(h){return typeof h=="string"||typeof h=="function"||h===n||h===r||h===i||h===c||h===l||typeof h=="object"&&h!==null&&(h.$$typeof===u||h.$$typeof===d||h.$$typeof===o||h.$$typeof===s||h.$$typeof===a||h.$$typeof===p||h.getModuleId!==void 0)},Ne.typeOf=g,Ne}var Oe={};/**
250
+ * @license React
251
+ * react-is.development.js
252
+ *
253
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
254
+ *
255
+ * This source code is licensed under the MIT license found in the
256
+ * LICENSE file in the root directory of this source tree.
257
+ */var n0;function gD(){return n0||(n0=1,process.env.NODE_ENV!=="production"&&function(){function t(h){if(typeof h=="object"&&h!==null){var y=h.$$typeof;switch(y){case e:switch(h=h.type,h){case i:case s:case r:case l:case d:case p:return h;default:switch(h=h&&h.$$typeof,h){case a:case c:case f:case u:return h;case o:return h;default:return y}}case n:return y}}}var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.view_transition"),g=Symbol.for("react.client.reference");Oe.ContextConsumer=o,Oe.ContextProvider=a,Oe.Element=e,Oe.ForwardRef=c,Oe.Fragment=i,Oe.Lazy=f,Oe.Memo=u,Oe.Portal=n,Oe.Profiler=s,Oe.StrictMode=r,Oe.Suspense=l,Oe.SuspenseList=d,Oe.isContextConsumer=function(h){return t(h)===o},Oe.isContextProvider=function(h){return t(h)===a},Oe.isElement=function(h){return typeof h=="object"&&h!==null&&h.$$typeof===e},Oe.isForwardRef=function(h){return t(h)===c},Oe.isFragment=function(h){return t(h)===i},Oe.isLazy=function(h){return t(h)===f},Oe.isMemo=function(h){return t(h)===u},Oe.isPortal=function(h){return t(h)===n},Oe.isProfiler=function(h){return t(h)===s},Oe.isStrictMode=function(h){return t(h)===r},Oe.isSuspense=function(h){return t(h)===l},Oe.isSuspenseList=function(h){return t(h)===d},Oe.isValidElementType=function(h){return typeof h=="string"||typeof h=="function"||h===i||h===s||h===r||h===l||h===d||typeof h=="object"&&h!==null&&(h.$$typeof===f||h.$$typeof===u||h.$$typeof===a||h.$$typeof===o||h.$$typeof===c||h.$$typeof===g||h.getModuleId!==void 0)},Oe.typeOf=t}()),Oe}var i0;function vD(){return i0||(i0=1,process.env.NODE_ENV==="production"?Bo.exports=pD():Bo.exports=gD()),Bo.exports}var Ba=vD();function qn(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function AS(t){if(v.isValidElement(t)||Ba.isValidElementType(t)||!qn(t))return t;const e={};return Object.keys(t).forEach(n=>{e[n]=AS(t[n])}),e}function zt(t,e,n={clone:!0}){const i=n.clone?{...t}:t;return qn(t)&&qn(e)&&Object.keys(e).forEach(r=>{v.isValidElement(e[r])||Ba.isValidElementType(e[r])?i[r]=e[r]:qn(e[r])&&Object.prototype.hasOwnProperty.call(t,r)&&qn(t[r])?i[r]=zt(t[r],e[r],n):n.clone?i[r]=qn(e[r])?AS(e[r]):e[r]:i[r]=e[r]}),i}function $s(t,e){return e?zt(t,e,{clone:!1}):t}const Mi=process.env.NODE_ENV!=="production"?Pe.oneOfType([Pe.number,Pe.string,Pe.object,Pe.array]):{};function r0(t,e){if(!t.containerQueries)return e;const n=Object.keys(e).filter(i=>i.startsWith("@container")).sort((i,r)=>{var o,a;const s=/min-width:\s*([0-9.]+)/;return+(((o=i.match(s))==null?void 0:o[1])||0)-+(((a=r.match(s))==null?void 0:a[1])||0)});return n.length?n.reduce((i,r)=>{const s=e[r];return delete i[r],i[r]=s,i},{...e}):e}function yD(t,e){return e==="@"||e.startsWith("@")&&(t.some(n=>e.startsWith(`@${n}`))||!!e.match(/^@\d/))}function bD(t,e){const n=e.match(/^@([^/]+)?\/?(.+)?$/);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The provided shorthand ${`(${e})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
258
+ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:wi(18,`(${e})`));return null}const[,i,r]=n,s=Number.isNaN(+i)?i||0:+i;return t.containerQueries(r).up(s)}function xD(t){const e=(s,o)=>s.replace("@media",o?`@container ${o}`:"@container");function n(s,o){s.up=(...a)=>e(t.breakpoints.up(...a),o),s.down=(...a)=>e(t.breakpoints.down(...a),o),s.between=(...a)=>e(t.breakpoints.between(...a),o),s.only=(...a)=>e(t.breakpoints.only(...a),o),s.not=(...a)=>{const c=e(t.breakpoints.not(...a),o);return c.includes("not all and")?c.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):c}}const i={},r=s=>(n(i,s),i);return n(r),{...t,containerQueries:r}}const fc={xs:0,sm:600,md:900,lg:1200,xl:1536},s0={keys:["xs","sm","md","lg","xl"],up:t=>`@media (min-width:${fc[t]}px)`},SD={containerQueries:t=>({up:e=>{let n=typeof e=="number"?e:fc[e]||e;return typeof n=="number"&&(n=`${n}px`),t?`@container ${t} (min-width:${n})`:`@container (min-width:${n})`}})};function ei(t,e,n){const i=t.theme||{};if(Array.isArray(e)){const s=i.breakpoints||s0;return e.reduce((o,a,c)=>(o[s.up(s.keys[c])]=n(e[c]),o),{})}if(typeof e=="object"){const s=i.breakpoints||s0;return Object.keys(e).reduce((o,a)=>{if(yD(s.keys,a)){const c=bD(i.containerQueries?i:SD,a);c&&(o[c]=n(e[a],a))}else if(Object.keys(s.values||fc).includes(a)){const c=s.up(a);o[c]=n(e[a],a)}else{const c=a;o[c]=e[c]}return o},{})}return n(e)}function wD(t={}){var n;return((n=t.keys)==null?void 0:n.reduce((i,r)=>{const s=t.up(r);return i[s]={},i},{}))||{}}function o0(t,e){return t.reduce((n,i)=>{const r=n[i];return(!r||Object.keys(r).length===0)&&delete n[i],n},e)}function hc(t,e,n=!0){if(!e||typeof e!="string")return null;if(t&&t.vars&&n){const i=`vars.${e}`.split(".").reduce((r,s)=>r&&r[s]?r[s]:null,t);if(i!=null)return i}return e.split(".").reduce((i,r)=>i&&i[r]!=null?i[r]:null,t)}function $a(t,e,n,i=n){let r;return typeof t=="function"?r=t(n):Array.isArray(t)?r=t[n]||i:r=hc(t,n)||i,e&&(r=e(r,i,t)),r}function st(t){const{prop:e,cssProperty:n=t.prop,themeKey:i,transform:r}=t,s=o=>{if(o[e]==null)return null;const a=o[e],c=o.theme,l=hc(c,i)||{};return ei(o,a,u=>{let f=$a(l,r,u);return u===f&&typeof u=="string"&&(f=$a(l,r,`${e}${u==="default"?"":ir(u)}`,u)),n===!1?f:{[n]:f}})};return s.propTypes=process.env.NODE_ENV!=="production"?{[e]:Mi}:{},s.filterProps=[e],s}function CD(t){const e={};return n=>(e[n]===void 0&&(e[n]=t(n)),e[n])}const kD={m:"margin",p:"padding"},TD={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},a0={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},ED=CD(t=>{if(t.length>2)if(a0[t])t=a0[t];else return[t];const[e,n]=t.split(""),i=kD[e],r=TD[n]||"";return Array.isArray(r)?r.map(s=>i+s):[i+r]}),mc=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],pc=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],PD=[...mc,...pc];function go(t,e,n,i){const r=hc(t,e,!0)??n;return typeof r=="number"||typeof r=="string"?s=>typeof s=="string"?s:(process.env.NODE_ENV!=="production"&&typeof s!="number"&&console.error(`MUI: Expected ${i} argument to be a number or a string, got ${s}.`),typeof r=="string"?r.startsWith("var(")&&s===0?0:r.startsWith("var(")&&s===1?r:`calc(${s} * ${r})`:r*s):Array.isArray(r)?s=>{if(typeof s=="string")return s;const o=Math.abs(s);process.env.NODE_ENV!=="production"&&(Number.isInteger(o)?o>r.length-1&&console.error([`MUI: The value provided (${o}) overflows.`,`The supported values are: ${JSON.stringify(r)}.`,`${o} > ${r.length-1}, you need to add the missing values.`].join(`
259
+ `)):console.error([`MUI: The \`theme.${e}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${e}\` as a number.`].join(`
260
+ `)));const a=r[o];return s>=0?a:typeof a=="number"?-a:typeof a=="string"&&a.startsWith("var(")?`calc(-1 * ${a})`:`-${a}`}:typeof r=="function"?r:(process.env.NODE_ENV!=="production"&&console.error([`MUI: The \`theme.${e}\` value (${r}) is invalid.`,"It should be a number, an array or a function."].join(`
261
+ `)),()=>{})}function Gf(t){return go(t,"spacing",8,"spacing")}function vo(t,e){return typeof e=="string"||e==null?e:t(e)}function RD(t,e){return n=>t.reduce((i,r)=>(i[r]=vo(e,n),i),{})}function AD(t,e,n,i){if(!e.includes(n))return null;const r=ED(n),s=RD(r,i),o=t[n];return ei(t,o,s)}function IS(t,e){const n=Gf(t.theme);return Object.keys(t).map(i=>AD(t,e,i,n)).reduce($s,{})}function Ze(t){return IS(t,mc)}Ze.propTypes=process.env.NODE_ENV!=="production"?mc.reduce((t,e)=>(t[e]=Mi,t),{}):{};Ze.filterProps=mc;function Ye(t){return IS(t,pc)}Ye.propTypes=process.env.NODE_ENV!=="production"?pc.reduce((t,e)=>(t[e]=Mi,t),{}):{};Ye.filterProps=pc;process.env.NODE_ENV!=="production"&&PD.reduce((t,e)=>(t[e]=Mi,t),{});function gc(...t){const e=t.reduce((i,r)=>(r.filterProps.forEach(s=>{i[s]=r}),i),{}),n=i=>Object.keys(i).reduce((r,s)=>e[s]?$s(r,e[s](i)):r,{});return n.propTypes=process.env.NODE_ENV!=="production"?t.reduce((i,r)=>Object.assign(i,r.propTypes),{}):{},n.filterProps=t.reduce((i,r)=>i.concat(r.filterProps),[]),n}function Yt(t){return typeof t!="number"?t:`${t}px solid`}function en(t,e){return st({prop:t,themeKey:"borders",transform:e})}const ID=en("border",Yt),MD=en("borderTop",Yt),_D=en("borderRight",Yt),ND=en("borderBottom",Yt),OD=en("borderLeft",Yt),DD=en("borderColor"),jD=en("borderTopColor"),LD=en("borderRightColor"),VD=en("borderBottomColor"),FD=en("borderLeftColor"),UD=en("outline",Yt),BD=en("outlineColor"),vc=t=>{if(t.borderRadius!==void 0&&t.borderRadius!==null){const e=go(t.theme,"shape.borderRadius",4,"borderRadius"),n=i=>({borderRadius:vo(e,i)});return ei(t,t.borderRadius,n)}return null};vc.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:Mi}:{};vc.filterProps=["borderRadius"];gc(ID,MD,_D,ND,OD,DD,jD,LD,VD,FD,vc,UD,BD);const yc=t=>{if(t.gap!==void 0&&t.gap!==null){const e=go(t.theme,"spacing",8,"gap"),n=i=>({gap:vo(e,i)});return ei(t,t.gap,n)}return null};yc.propTypes=process.env.NODE_ENV!=="production"?{gap:Mi}:{};yc.filterProps=["gap"];const bc=t=>{if(t.columnGap!==void 0&&t.columnGap!==null){const e=go(t.theme,"spacing",8,"columnGap"),n=i=>({columnGap:vo(e,i)});return ei(t,t.columnGap,n)}return null};bc.propTypes=process.env.NODE_ENV!=="production"?{columnGap:Mi}:{};bc.filterProps=["columnGap"];const xc=t=>{if(t.rowGap!==void 0&&t.rowGap!==null){const e=go(t.theme,"spacing",8,"rowGap"),n=i=>({rowGap:vo(e,i)});return ei(t,t.rowGap,n)}return null};xc.propTypes=process.env.NODE_ENV!=="production"?{rowGap:Mi}:{};xc.filterProps=["rowGap"];const $D=st({prop:"gridColumn"}),HD=st({prop:"gridRow"}),zD=st({prop:"gridAutoFlow"}),WD=st({prop:"gridAutoColumns"}),qD=st({prop:"gridAutoRows"}),KD=st({prop:"gridTemplateColumns"}),GD=st({prop:"gridTemplateRows"}),ZD=st({prop:"gridTemplateAreas"}),YD=st({prop:"gridArea"});gc(yc,bc,xc,$D,HD,zD,WD,qD,KD,GD,ZD,YD);function Hr(t,e){return e==="grey"?e:t}const JD=st({prop:"color",themeKey:"palette",transform:Hr}),XD=st({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Hr}),QD=st({prop:"backgroundColor",themeKey:"palette",transform:Hr});gc(JD,XD,QD);function Bt(t){return t<=1&&t!==0?`${t*100}%`:t}const e3=st({prop:"width",transform:Bt}),Zf=t=>{if(t.maxWidth!==void 0&&t.maxWidth!==null){const e=n=>{var r,s,o,a,c;const i=((o=(s=(r=t.theme)==null?void 0:r.breakpoints)==null?void 0:s.values)==null?void 0:o[n])||fc[n];return i?((c=(a=t.theme)==null?void 0:a.breakpoints)==null?void 0:c.unit)!=="px"?{maxWidth:`${i}${t.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Bt(n)}};return ei(t,t.maxWidth,e)}return null};Zf.filterProps=["maxWidth"];const t3=st({prop:"minWidth",transform:Bt}),n3=st({prop:"height",transform:Bt}),i3=st({prop:"maxHeight",transform:Bt}),r3=st({prop:"minHeight",transform:Bt});st({prop:"size",cssProperty:"width",transform:Bt});st({prop:"size",cssProperty:"height",transform:Bt});const s3=st({prop:"boxSizing"});gc(e3,Zf,t3,n3,i3,r3,s3);const Sc={border:{themeKey:"borders",transform:Yt},borderTop:{themeKey:"borders",transform:Yt},borderRight:{themeKey:"borders",transform:Yt},borderBottom:{themeKey:"borders",transform:Yt},borderLeft:{themeKey:"borders",transform:Yt},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Yt},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:vc},color:{themeKey:"palette",transform:Hr},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Hr},backgroundColor:{themeKey:"palette",transform:Hr},p:{style:Ye},pt:{style:Ye},pr:{style:Ye},pb:{style:Ye},pl:{style:Ye},px:{style:Ye},py:{style:Ye},padding:{style:Ye},paddingTop:{style:Ye},paddingRight:{style:Ye},paddingBottom:{style:Ye},paddingLeft:{style:Ye},paddingX:{style:Ye},paddingY:{style:Ye},paddingInline:{style:Ye},paddingInlineStart:{style:Ye},paddingInlineEnd:{style:Ye},paddingBlock:{style:Ye},paddingBlockStart:{style:Ye},paddingBlockEnd:{style:Ye},m:{style:Ze},mt:{style:Ze},mr:{style:Ze},mb:{style:Ze},ml:{style:Ze},mx:{style:Ze},my:{style:Ze},margin:{style:Ze},marginTop:{style:Ze},marginRight:{style:Ze},marginBottom:{style:Ze},marginLeft:{style:Ze},marginX:{style:Ze},marginY:{style:Ze},marginInline:{style:Ze},marginInlineStart:{style:Ze},marginInlineEnd:{style:Ze},marginBlock:{style:Ze},marginBlockStart:{style:Ze},marginBlockEnd:{style:Ze},displayPrint:{cssProperty:!1,transform:t=>({"@media print":{display:t}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:yc},rowGap:{style:xc},columnGap:{style:bc},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Bt},maxWidth:{style:Zf},minWidth:{transform:Bt},height:{transform:Bt},maxHeight:{transform:Bt},minHeight:{transform:Bt},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function o3(...t){const e=t.reduce((i,r)=>i.concat(Object.keys(r)),[]),n=new Set(e);return t.every(i=>n.size===Object.keys(i).length)}function a3(t,e){return typeof t=="function"?t(e):t}function c3(){function t(n,i,r,s){const o={[n]:i,theme:r},a=s[n];if(!a)return{[n]:i};const{cssProperty:c=n,themeKey:l,transform:d,style:u}=a;if(i==null)return null;if(l==="typography"&&i==="inherit")return{[n]:i};const f=hc(r,l)||{};return u?u(o):ei(o,i,g=>{let h=$a(f,d,g);return g===h&&typeof g=="string"&&(h=$a(f,d,`${n}${g==="default"?"":ir(g)}`,g)),c===!1?h:{[c]:h}})}function e(n){const{sx:i,theme:r={},nested:s}=n||{};if(!i)return null;const o=r.unstable_sxConfig??Sc;function a(c){let l=c;if(typeof c=="function")l=c(r);else if(typeof c!="object")return c;if(!l)return null;const d=wD(r.breakpoints),u=Object.keys(d);let f=d;return Object.keys(l).forEach(p=>{const g=a3(l[p],r);if(g!=null)if(typeof g=="object")if(o[p])f=$s(f,t(p,g,r,o));else{const h=ei({theme:r},g,y=>({[p]:y}));o3(h,g)?f[p]=e({sx:g,theme:r,nested:!0}):f=$s(f,h)}else f=$s(f,t(p,g,r,o))}),!s&&r.modularCssLayers?{"@layer sx":r0(r,o0(u,f))}:r0(r,o0(u,f))}return Array.isArray(i)?i.map(a):a(i)}return e}const es=c3();es.filterProps=["sx"];function uu(){return uu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},uu.apply(null,arguments)}function l3(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function d3(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var u3=function(){function t(n){var i=this;this._insertTag=function(r){var s;i.tags.length===0?i.insertionPoint?s=i.insertionPoint.nextSibling:i.prepend?s=i.container.firstChild:s=i.before:s=i.tags[i.tags.length-1].nextSibling,i.container.insertBefore(r,s),i.tags.push(r)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(i){i.forEach(this._insertTag)},e.insert=function(i){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(d3(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var s=l3(r);try{s.insertRule(i,s.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(i));this.ctr++},e.flush=function(){this.tags.forEach(function(i){var r;return(r=i.parentNode)==null?void 0:r.removeChild(i)}),this.tags=[],this.ctr=0},t}(),kt="-ms-",Ha="-moz-",Re="-webkit-",MS="comm",Yf="rule",Jf="decl",f3="@import",_S="@keyframes",h3="@layer",m3=Math.abs,wc=String.fromCharCode,p3=Object.assign;function g3(t,e){return yt(t,0)^45?(((e<<2^yt(t,0))<<2^yt(t,1))<<2^yt(t,2))<<2^yt(t,3):0}function NS(t){return t.trim()}function v3(t,e){return(t=e.exec(t))?t[0]:t}function Ae(t,e,n){return t.replace(e,n)}function fu(t,e){return t.indexOf(e)}function yt(t,e){return t.charCodeAt(e)|0}function io(t,e,n){return t.slice(e,n)}function Sn(t){return t.length}function Xf(t){return t.length}function $o(t,e){return e.push(t),t}function y3(t,e){return t.map(e).join("")}var Cc=1,ts=1,OS=0,Vt=0,dt=0,fs="";function kc(t,e,n,i,r,s,o){return{value:t,root:e,parent:n,type:i,props:r,children:s,line:Cc,column:ts,length:o,return:""}}function Ps(t,e){return p3(kc("",null,null,"",null,null,0),t,{length:-t.length},e)}function b3(){return dt}function x3(){return dt=Vt>0?yt(fs,--Vt):0,ts--,dt===10&&(ts=1,Cc--),dt}function Wt(){return dt=Vt<OS?yt(fs,Vt++):0,ts++,dt===10&&(ts=1,Cc++),dt}function An(){return yt(fs,Vt)}function ma(){return Vt}function yo(t,e){return io(fs,t,e)}function ro(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function DS(t){return Cc=ts=1,OS=Sn(fs=t),Vt=0,[]}function jS(t){return fs="",t}function pa(t){return NS(yo(Vt-1,hu(t===91?t+2:t===40?t+1:t)))}function S3(t){for(;(dt=An())&&dt<33;)Wt();return ro(t)>2||ro(dt)>3?"":" "}function w3(t,e){for(;--e&&Wt()&&!(dt<48||dt>102||dt>57&&dt<65||dt>70&&dt<97););return yo(t,ma()+(e<6&&An()==32&&Wt()==32))}function hu(t){for(;Wt();)switch(dt){case t:return Vt;case 34:case 39:t!==34&&t!==39&&hu(dt);break;case 40:t===41&&hu(t);break;case 92:Wt();break}return Vt}function C3(t,e){for(;Wt()&&t+dt!==57;)if(t+dt===84&&An()===47)break;return"/*"+yo(e,Vt-1)+"*"+wc(t===47?t:Wt())}function k3(t){for(;!ro(An());)Wt();return yo(t,Vt)}function T3(t){return jS(ga("",null,null,null,[""],t=DS(t),0,[0],t))}function ga(t,e,n,i,r,s,o,a,c){for(var l=0,d=0,u=o,f=0,p=0,g=0,h=1,y=1,b=1,w=0,C="",S=r,x=s,T=i,E=C;y;)switch(g=w,w=Wt()){case 40:if(g!=108&&yt(E,u-1)==58){fu(E+=Ae(pa(w),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:E+=pa(w);break;case 9:case 10:case 13:case 32:E+=S3(g);break;case 92:E+=w3(ma()-1,7);continue;case 47:switch(An()){case 42:case 47:$o(E3(C3(Wt(),ma()),e,n),c);break;default:E+="/"}break;case 123*h:a[l++]=Sn(E)*b;case 125*h:case 59:case 0:switch(w){case 0:case 125:y=0;case 59+d:b==-1&&(E=Ae(E,/\f/g,"")),p>0&&Sn(E)-u&&$o(p>32?l0(E+";",i,n,u-1):l0(Ae(E," ","")+";",i,n,u-2),c);break;case 59:E+=";";default:if($o(T=c0(E,e,n,l,d,r,a,C,S=[],x=[],u),s),w===123)if(d===0)ga(E,e,T,T,S,s,u,a,x);else switch(f===99&&yt(E,3)===110?100:f){case 100:case 108:case 109:case 115:ga(t,T,T,i&&$o(c0(t,T,T,0,0,r,a,C,r,S=[],u),x),r,x,u,a,i?S:x);break;default:ga(E,T,T,T,[""],x,0,a,x)}}l=d=p=0,h=b=1,C=E="",u=o;break;case 58:u=1+Sn(E),p=g;default:if(h<1){if(w==123)--h;else if(w==125&&h++==0&&x3()==125)continue}switch(E+=wc(w),w*h){case 38:b=d>0?1:(E+="\f",-1);break;case 44:a[l++]=(Sn(E)-1)*b,b=1;break;case 64:An()===45&&(E+=pa(Wt())),f=An(),d=u=Sn(C=E+=k3(ma())),w++;break;case 45:g===45&&Sn(E)==2&&(h=0)}}return s}function c0(t,e,n,i,r,s,o,a,c,l,d){for(var u=r-1,f=r===0?s:[""],p=Xf(f),g=0,h=0,y=0;g<i;++g)for(var b=0,w=io(t,u+1,u=m3(h=o[g])),C=t;b<p;++b)(C=NS(h>0?f[b]+" "+w:Ae(w,/&\f/g,f[b])))&&(c[y++]=C);return kc(t,e,n,r===0?Yf:a,c,l,d)}function E3(t,e,n){return kc(t,e,n,MS,wc(b3()),io(t,2,-2),0)}function l0(t,e,n,i){return kc(t,e,n,Jf,io(t,0,i),io(t,i+1,-1),i)}function zr(t,e){for(var n="",i=Xf(t),r=0;r<i;r++)n+=e(t[r],r,t,e)||"";return n}function P3(t,e,n,i){switch(t.type){case h3:if(t.children.length)break;case f3:case Jf:return t.return=t.return||t.value;case MS:return"";case _S:return t.return=t.value+"{"+zr(t.children,i)+"}";case Yf:t.value=t.props.join(",")}return Sn(n=zr(t.children,i))?t.return=t.value+"{"+n+"}":""}function R3(t){var e=Xf(t);return function(n,i,r,s){for(var o="",a=0;a<e;a++)o+=t[a](n,i,r,s)||"";return o}}function A3(t){return function(e){e.root||(e=e.return)&&t(e)}}function LS(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var I3=function(e,n,i){for(var r=0,s=0;r=s,s=An(),r===38&&s===12&&(n[i]=1),!ro(s);)Wt();return yo(e,Vt)},M3=function(e,n){var i=-1,r=44;do switch(ro(r)){case 0:r===38&&An()===12&&(n[i]=1),e[i]+=I3(Vt-1,n,i);break;case 2:e[i]+=pa(r);break;case 4:if(r===44){e[++i]=An()===58?"&\f":"",n[i]=e[i].length;break}default:e[i]+=wc(r)}while(r=Wt());return e},_3=function(e,n){return jS(M3(DS(e),n))},d0=new WeakMap,N3=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,i=e.parent,r=e.column===i.column&&e.line===i.line;i.type!=="rule";)if(i=i.parent,!i)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!d0.get(i))&&!r){d0.set(e,!0);for(var s=[],o=_3(n,s),a=i.props,c=0,l=0;c<o.length;c++)for(var d=0;d<a.length;d++,l++)e.props[l]=s[c]?o[c].replace(/&\f/g,a[d]):a[d]+" "+o[c]}}},O3=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function VS(t,e){switch(g3(t,e)){case 5103:return Re+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Re+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Re+t+Ha+t+kt+t+t;case 6828:case 4268:return Re+t+kt+t+t;case 6165:return Re+t+kt+"flex-"+t+t;case 5187:return Re+t+Ae(t,/(\w+).+(:[^]+)/,Re+"box-$1$2"+kt+"flex-$1$2")+t;case 5443:return Re+t+kt+"flex-item-"+Ae(t,/flex-|-self/,"")+t;case 4675:return Re+t+kt+"flex-line-pack"+Ae(t,/align-content|flex-|-self/,"")+t;case 5548:return Re+t+kt+Ae(t,"shrink","negative")+t;case 5292:return Re+t+kt+Ae(t,"basis","preferred-size")+t;case 6060:return Re+"box-"+Ae(t,"-grow","")+Re+t+kt+Ae(t,"grow","positive")+t;case 4554:return Re+Ae(t,/([^-])(transform)/g,"$1"+Re+"$2")+t;case 6187:return Ae(Ae(Ae(t,/(zoom-|grab)/,Re+"$1"),/(image-set)/,Re+"$1"),t,"")+t;case 5495:case 3959:return Ae(t,/(image-set\([^]*)/,Re+"$1$`$1");case 4968:return Ae(Ae(t,/(.+:)(flex-)?(.*)/,Re+"box-pack:$3"+kt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Re+t+t;case 4095:case 3583:case 4068:case 2532:return Ae(t,/(.+)-inline(.+)/,Re+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Sn(t)-1-e>6)switch(yt(t,e+1)){case 109:if(yt(t,e+4)!==45)break;case 102:return Ae(t,/(.+:)(.+)-([^]+)/,"$1"+Re+"$2-$3$1"+Ha+(yt(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~fu(t,"stretch")?VS(Ae(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(yt(t,e+1)!==115)break;case 6444:switch(yt(t,Sn(t)-3-(~fu(t,"!important")&&10))){case 107:return Ae(t,":",":"+Re)+t;case 101:return Ae(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Re+(yt(t,14)===45?"inline-":"")+"box$3$1"+Re+"$2$3$1"+kt+"$2box$3")+t}break;case 5936:switch(yt(t,e+11)){case 114:return Re+t+kt+Ae(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Re+t+kt+Ae(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Re+t+kt+Ae(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Re+t+kt+t+t}return t}var D3=function(e,n,i,r){if(e.length>-1&&!e.return)switch(e.type){case Jf:e.return=VS(e.value,e.length);break;case _S:return zr([Ps(e,{value:Ae(e.value,"@","@"+Re)})],r);case Yf:if(e.length)return y3(e.props,function(s){switch(v3(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return zr([Ps(e,{props:[Ae(s,/:(read-\w+)/,":"+Ha+"$1")]})],r);case"::placeholder":return zr([Ps(e,{props:[Ae(s,/:(plac\w+)/,":"+Re+"input-$1")]}),Ps(e,{props:[Ae(s,/:(plac\w+)/,":"+Ha+"$1")]}),Ps(e,{props:[Ae(s,/:(plac\w+)/,kt+"input-$1")]})],r)}return""})}},j3=[D3],L3=function(e){var n=e.key;if(n==="css"){var i=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(i,function(h){var y=h.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var r=e.stylisPlugins||j3,s={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(h){for(var y=h.getAttribute("data-emotion").split(" "),b=1;b<y.length;b++)s[y[b]]=!0;a.push(h)});var c,l=[N3,O3];{var d,u=[P3,A3(function(h){d.insert(h)})],f=R3(l.concat(r,u)),p=function(y){return zr(T3(y),f)};c=function(y,b,w,C){d=w,p(y?y+"{"+b.styles+"}":b.styles),C&&(g.inserted[b.name]=!0)}}var g={key:n,sheet:new u3({key:n,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:c};return g.sheet.hydrate(a),g},V3=!0;function F3(t,e,n){var i="";return n.split(" ").forEach(function(r){t[r]!==void 0?e.push(t[r]+";"):r&&(i+=r+" ")}),i}var FS=function(e,n,i){var r=e.key+"-"+n.name;(i===!1||V3===!1)&&e.registered[r]===void 0&&(e.registered[r]=n.styles)},U3=function(e,n,i){FS(e,n,i);var r=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var s=n;do e.insert(n===s?"."+r:"",s,e.sheet,!0),s=s.next;while(s!==void 0)}};function B3(t){for(var e=0,n,i=0,r=t.length;r>=4;++i,r-=4)n=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(r){case 3:e^=(t.charCodeAt(i+2)&255)<<16;case 2:e^=(t.charCodeAt(i+1)&255)<<8;case 1:e^=t.charCodeAt(i)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var $3={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},H3=/[A-Z]|^ms/g,z3=/_EMO_([^_]+?)_([^]*?)_EMO_/g,US=function(e){return e.charCodeAt(1)===45},u0=function(e){return e!=null&&typeof e!="boolean"},Ll=LS(function(t){return US(t)?t:t.replace(H3,"-$&").toLowerCase()}),f0=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(z3,function(i,r,s){return wn={name:r,styles:s,next:wn},r})}return $3[e]!==1&&!US(e)&&typeof n=="number"&&n!==0?n+"px":n};function so(t,e,n){if(n==null)return"";var i=n;if(i.__emotion_styles!==void 0)return i;switch(typeof n){case"boolean":return"";case"object":{var r=n;if(r.anim===1)return wn={name:r.name,styles:r.styles,next:wn},r.name;var s=n;if(s.styles!==void 0){var o=s.next;if(o!==void 0)for(;o!==void 0;)wn={name:o.name,styles:o.styles,next:wn},o=o.next;var a=s.styles+";";return a}return W3(t,e,n)}case"function":{if(t!==void 0){var c=wn,l=n(t);return wn=c,so(t,e,l)}break}}var d=n;if(e==null)return d;var u=e[d];return u!==void 0?u:d}function W3(t,e,n){var i="";if(Array.isArray(n))for(var r=0;r<n.length;r++)i+=so(t,e,n[r])+";";else for(var s in n){var o=n[s];if(typeof o!="object"){var a=o;e!=null&&e[a]!==void 0?i+=s+"{"+e[a]+"}":u0(a)&&(i+=Ll(s)+":"+f0(s,a)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(e==null||e[o[0]]===void 0))for(var c=0;c<o.length;c++)u0(o[c])&&(i+=Ll(s)+":"+f0(s,o[c])+";");else{var l=so(t,e,o);switch(s){case"animation":case"animationName":{i+=Ll(s)+":"+l+";";break}default:i+=s+"{"+l+"}"}}}return i}var h0=/label:\s*([^\s;{]+)\s*(;|$)/g,wn;function BS(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var i=!0,r="";wn=void 0;var s=t[0];if(s==null||s.raw===void 0)i=!1,r+=so(n,e,s);else{var o=s;r+=o[0]}for(var a=1;a<t.length;a++)if(r+=so(n,e,t[a]),i){var c=s;r+=c[a]}h0.lastIndex=0;for(var l="",d;(d=h0.exec(r))!==null;)l+="-"+d[1];var u=B3(r)+l;return{name:u,styles:r,next:wn}}var q3=function(e){return e()},K3=v.useInsertionEffect?v.useInsertionEffect:!1,G3=K3||q3,$S=v.createContext(typeof HTMLElement<"u"?L3({key:"css"}):null);$S.Provider;var Z3=function(e){return R.forwardRef(function(n,i){var r=R.useContext($S);return e(n,r,i)})},Y3=v.createContext({}),J3=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,X3=LS(function(t){return J3.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),Q3=X3,e5=function(e){return e!=="theme"},m0=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?Q3:e5},p0=function(e,n,i){var r;if(n){var s=n.shouldForwardProp;r=e.__emotion_forwardProp&&s?function(o){return e.__emotion_forwardProp(o)&&s(o)}:s}return typeof r!="function"&&i&&(r=e.__emotion_forwardProp),r},t5=function(e){var n=e.cache,i=e.serialized,r=e.isStringTag;return FS(n,i,r),G3(function(){return U3(n,i,r)}),null},n5=function t(e,n){var i=e.__emotion_real===e,r=i&&e.__emotion_base||e,s,o;n!==void 0&&(s=n.label,o=n.target);var a=p0(e,n,i),c=a||m0(r),l=!c("as");return function(){var d=arguments,u=i&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(s!==void 0&&u.push("label:"+s+";"),d[0]==null||d[0].raw===void 0)u.push.apply(u,d);else{var f=d[0];u.push(f[0]);for(var p=d.length,g=1;g<p;g++)u.push(d[g],f[g])}var h=Z3(function(y,b,w){var C=l&&y.as||r,S="",x=[],T=y;if(y.theme==null){T={};for(var E in y)T[E]=y[E];T.theme=v.useContext(Y3)}typeof y.className=="string"?S=F3(b.registered,x,y.className):y.className!=null&&(S=y.className+" ");var P=BS(u.concat(x),b.registered,T);S+=b.key+"-"+P.name,o!==void 0&&(S+=" "+o);var _=l&&a===void 0?m0(C):c,k={};for(var I in y)l&&I==="as"||_(I)&&(k[I]=y[I]);return k.className=S,w&&(k.ref=w),v.createElement(v.Fragment,null,v.createElement(t5,{cache:b,serialized:P,isStringTag:typeof C=="string"}),v.createElement(C,k))});return h.displayName=s!==void 0?s:"Styled("+(typeof r=="string"?r:r.displayName||r.name||"Component")+")",h.defaultProps=e.defaultProps,h.__emotion_real=h,h.__emotion_base=r,h.__emotion_styles=u,h.__emotion_forwardProp=a,Object.defineProperty(h,"toString",{value:function(){return"."+o}}),h.withComponent=function(y,b){var w=t(y,uu({},n,b,{shouldForwardProp:p0(h,b,!0)}));return w.apply(void 0,u)},h}},i5=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],mu=n5.bind(null);i5.forEach(function(t){mu[t]=mu(t)});/**
262
+ * @mui/styled-engine v7.2.0
263
+ *
264
+ * @license MIT
265
+ * This source code is licensed under the MIT license found in the
266
+ * LICENSE file in the root directory of this source tree.
267
+ */function r5(t,e){const n=mu(t,e);return process.env.NODE_ENV!=="production"?(...i)=>{const r=typeof t=="string"?`"${t}"`:"component";return i.length===0?console.error([`MUI: Seems like you called \`styled(${r})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
268
+ `)):i.some(s=>s===void 0)&&console.error(`MUI: the styled(${r})(...args) API requires all its args to be defined.`),n(...i)}:n}function s5(t,e){Array.isArray(t.__emotion_styles)&&(t.__emotion_styles=e(t.__emotion_styles))}const g0=[];function Ki(t){return g0[0]=t,BS(g0)}const o5=t=>{const e=Object.keys(t).map(n=>({key:n,val:t[n]}))||[];return e.sort((n,i)=>n.val-i.val),e.reduce((n,i)=>({...n,[i.key]:i.val}),{})};function a5(t){const{values:e={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:i=5,...r}=t,s=o5(e),o=Object.keys(s);function a(f){return`@media (min-width:${typeof e[f]=="number"?e[f]:f}${n})`}function c(f){return`@media (max-width:${(typeof e[f]=="number"?e[f]:f)-i/100}${n})`}function l(f,p){const g=o.indexOf(p);return`@media (min-width:${typeof e[f]=="number"?e[f]:f}${n}) and (max-width:${(g!==-1&&typeof e[o[g]]=="number"?e[o[g]]:p)-i/100}${n})`}function d(f){return o.indexOf(f)+1<o.length?l(f,o[o.indexOf(f)+1]):a(f)}function u(f){const p=o.indexOf(f);return p===0?a(o[1]):p===o.length-1?c(o[p]):l(f,o[o.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:o,values:s,up:a,down:c,between:l,only:d,not:u,unit:n,...r}}const c5={borderRadius:4};function HS(t=8,e=Gf({spacing:t})){if(t.mui)return t;const n=(...i)=>(process.env.NODE_ENV!=="production"&&(i.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${i.length}`)),(i.length===0?[1]:i).map(s=>{const o=e(s);return typeof o=="number"?`${o}px`:o}).join(" "));return n.mui=!0,n}function l5(t,e){var i;const n=this;if(n.vars){if(!((i=n.colorSchemes)!=null&&i[t])||typeof n.getColorSchemeSelector!="function")return{};let r=n.getColorSchemeSelector(t);return r==="&"?e:((r.includes("data-")||r.includes("."))&&(r=`*:where(${r.replace(/\s*&$/,"")}) &`),{[r]:e})}return n.palette.mode===t?e:{}}function zS(t={},...e){const{breakpoints:n={},palette:i={},spacing:r,shape:s={},...o}=t,a=a5(n),c=HS(r);let l=zt({breakpoints:a,direction:"ltr",components:{},palette:{mode:"light",...i},spacing:c,shape:{...c5,...s}},o);return l=xD(l),l.applyStyles=l5,l=e.reduce((d,u)=>zt(d,u),l),l.unstable_sxConfig={...Sc,...o==null?void 0:o.unstable_sxConfig},l.unstable_sx=function(u){return es({sx:u,theme:this})},l}const d5={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Qf(t,e,n="Mui"){const i=d5[e];return i?`${n}-${i}`:`${sD.generate(t)}-${e}`}function u5(t,e,n="Mui"){const i={};return e.forEach(r=>{i[r]=Qf(t,r,n)}),i}function WS(t,e=""){return t.displayName||t.name||e}function v0(t,e,n){const i=WS(e);return t.displayName||(i!==""?`${n}(${i})`:n)}function f5(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="function")return WS(t,"Component");if(typeof t=="object")switch(t.$$typeof){case Ba.ForwardRef:return v0(t,t.render,"ForwardRef");case Ba.Memo:return v0(t,t.type,"memo");default:return}}}function qS(t){const{variants:e,...n}=t,i={variants:e,style:Ki(n),isProcessed:!0};return i.style===n||e&&e.forEach(r=>{typeof r.style!="function"&&(r.style=Ki(r.style))}),i}const h5=zS();function Vl(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}function $i(t,e){return e&&t&&typeof t=="object"&&t.styles&&!t.styles.startsWith("@layer")&&(t.styles=`@layer ${e}{${String(t.styles)}}`),t}function m5(t){return t?(e,n)=>n[t]:null}function p5(t,e,n){t.theme=b5(t.theme)?n:t.theme[e]||t.theme}function va(t,e,n){const i=typeof e=="function"?e(t):e;if(Array.isArray(i))return i.flatMap(r=>va(t,r,n));if(Array.isArray(i==null?void 0:i.variants)){let r;if(i.isProcessed)r=n?$i(i.style,n):i.style;else{const{variants:s,...o}=i;r=n?$i(Ki(o),n):o}return KS(t,i.variants,[r],n)}return i!=null&&i.isProcessed?n?$i(Ki(i.style),n):i.style:n?$i(Ki(i),n):i}function KS(t,e,n=[],i=void 0){var s;let r;e:for(let o=0;o<e.length;o+=1){const a=e[o];if(typeof a.props=="function"){if(r??(r={...t,...t.ownerState,ownerState:t.ownerState}),!a.props(r))continue}else for(const c in a.props)if(t[c]!==a.props[c]&&((s=t.ownerState)==null?void 0:s[c])!==a.props[c])continue e;typeof a.style=="function"?(r??(r={...t,...t.ownerState,ownerState:t.ownerState}),n.push(i?$i(Ki(a.style(r)),i):a.style(r))):n.push(i?$i(Ki(a.style),i):a.style)}return n}function g5(t={}){const{themeId:e,defaultTheme:n=h5,rootShouldForwardProp:i=Vl,slotShouldForwardProp:r=Vl}=t;function s(a){p5(a,e,n)}return(a,c={})=>{s5(a,T=>T.filter(E=>E!==es));const{name:l,slot:d,skipVariantsResolver:u,skipSx:f,overridesResolver:p=m5(GS(d)),...g}=c,h=l&&l.startsWith("Mui")||d?"components":"custom",y=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,b=f||!1;let w=Vl;d==="Root"||d==="root"?w=i:d?w=r:x5(a)&&(w=void 0);const C=r5(a,{shouldForwardProp:w,label:y5(l,d),...g}),S=T=>{if(T.__emotion_real===T)return T;if(typeof T=="function")return function(P){return va(P,T,P.theme.modularCssLayers?h:void 0)};if(qn(T)){const E=qS(T);return function(_){return E.variants?va(_,E,_.theme.modularCssLayers?h:void 0):_.theme.modularCssLayers?$i(E.style,h):E.style}}return T},x=(...T)=>{const E=[],P=T.map(S),_=[];if(E.push(s),l&&p&&_.push(function(K){var X,O;const se=(O=(X=K.theme.components)==null?void 0:X[l])==null?void 0:O.styleOverrides;if(!se)return null;const ie={};for(const oe in se)ie[oe]=va(K,se[oe],K.theme.modularCssLayers?"theme":void 0);return p(K,ie)}),l&&!y&&_.push(function(K){var ie,X;const J=K.theme,se=(X=(ie=J==null?void 0:J.components)==null?void 0:ie[l])==null?void 0:X.variants;return se?KS(K,se,[],K.theme.modularCssLayers?"theme":void 0):null}),b||_.push(es),Array.isArray(P[0])){const N=P.shift(),K=new Array(E.length).fill(""),J=new Array(_.length).fill("");let se;se=[...K,...N,...J],se.raw=[...K,...N.raw,...J],E.unshift(se)}const k=[...E,...P,..._],I=C(...k);return a.muiName&&(I.muiName=a.muiName),process.env.NODE_ENV!=="production"&&(I.displayName=v5(l,d,a)),I};return C.withConfig&&(x.withConfig=C.withConfig),x}}function v5(t,e,n){return t?`${t}${ir(e||"")}`:`Styled(${f5(n)})`}function y5(t,e){let n;return process.env.NODE_ENV!=="production"&&t&&(n=`${t}-${GS(e||"Root")}`),n}function b5(t){for(const e in t)return!1;return!0}function x5(t){return typeof t=="string"&&t.charCodeAt(0)>96}function GS(t){return t&&t.charAt(0).toLowerCase()+t.slice(1)}function pu(t,e,n=!1){const i={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const s=r;if(s==="components"||s==="slots")i[s]={...t[s],...i[s]};else if(s==="componentsProps"||s==="slotProps"){const o=t[s],a=e[s];if(!a)i[s]=o||{};else if(!o)i[s]=a;else{i[s]={...a};for(const c in o)if(Object.prototype.hasOwnProperty.call(o,c)){const l=c;i[s][l]=pu(o[l],a[l],n)}}}else s==="className"&&n&&e.className?i.className=ic(t==null?void 0:t.className,e==null?void 0:e.className):s==="style"&&n&&e.style?i.style={...t==null?void 0:t.style,...e==null?void 0:e.style}:i[s]===void 0&&(i[s]=t[s])}return i}function S5(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}function eh(t,e=0,n=1){return process.env.NODE_ENV!=="production"&&(t<e||t>n)&&console.error(`MUI: The value provided ${t} is out of range [${e}, ${n}].`),S5(t,e,n)}function w5(t){t=t.slice(1);const e=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let n=t.match(e);return n&&n[0].length===1&&(n=n.map(i=>i+i)),process.env.NODE_ENV!=="production"&&t.length!==t.trim().length&&console.error(`MUI: The color: "${t}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),n?`rgb${n.length===4?"a":""}(${n.map((i,r)=>r<3?parseInt(i,16):Math.round(parseInt(i,16)/255*1e3)/1e3).join(", ")})`:""}function Ci(t){if(t.type)return t;if(t.charAt(0)==="#")return Ci(w5(t));const e=t.indexOf("("),n=t.substring(0,e);if(!["rgb","rgba","hsl","hsla","color"].includes(n))throw new Error(process.env.NODE_ENV!=="production"?`MUI: Unsupported \`${t}\` color.
269
+ The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:wi(9,t));let i=t.substring(e+1,t.length-1),r;if(n==="color"){if(i=i.split(" "),r=i.shift(),i.length===4&&i[3].charAt(0)==="/"&&(i[3]=i[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(r))throw new Error(process.env.NODE_ENV!=="production"?`MUI: unsupported \`${r}\` color space.
270
+ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:wi(10,r))}else i=i.split(",");return i=i.map(s=>parseFloat(s)),{type:n,values:i,colorSpace:r}}const C5=t=>{const e=Ci(t);return e.values.slice(0,3).map((n,i)=>e.type.includes("hsl")&&i!==0?`${n}%`:n).join(" ")},Ns=(t,e)=>{try{return C5(t)}catch{return e&&process.env.NODE_ENV!=="production"&&console.warn(e),t}};function Tc(t){const{type:e,colorSpace:n}=t;let{values:i}=t;return e.includes("rgb")?i=i.map((r,s)=>s<3?parseInt(r,10):r):e.includes("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),e.includes("color")?i=`${n} ${i.join(" ")}`:i=`${i.join(", ")}`,`${e}(${i})`}function ZS(t){t=Ci(t);const{values:e}=t,n=e[0],i=e[1]/100,r=e[2]/100,s=i*Math.min(r,1-r),o=(l,d=(l+n/30)%12)=>r-s*Math.max(Math.min(d-3,9-d,1),-1);let a="rgb";const c=[Math.round(o(0)*255),Math.round(o(8)*255),Math.round(o(4)*255)];return t.type==="hsla"&&(a+="a",c.push(e[3])),Tc({type:a,values:c})}function gu(t){t=Ci(t);let e=t.type==="hsl"||t.type==="hsla"?Ci(ZS(t)).values:t.values;return e=e.map(n=>(t.type!=="color"&&(n/=255),n<=.03928?n/12.92:((n+.055)/1.055)**2.4)),Number((.2126*e[0]+.7152*e[1]+.0722*e[2]).toFixed(3))}function y0(t,e){const n=gu(t),i=gu(e);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}function k5(t,e){return t=Ci(t),e=eh(e),(t.type==="rgb"||t.type==="hsl")&&(t.type+="a"),t.type==="color"?t.values[3]=`/${e}`:t.values[3]=e,Tc(t)}function Ho(t,e,n){try{return k5(t,e)}catch{return t}}function th(t,e){if(t=Ci(t),e=eh(e),t.type.includes("hsl"))t.values[2]*=1-e;else if(t.type.includes("rgb")||t.type.includes("color"))for(let n=0;n<3;n+=1)t.values[n]*=1-e;return Tc(t)}function Ve(t,e,n){try{return th(t,e)}catch{return t}}function nh(t,e){if(t=Ci(t),e=eh(e),t.type.includes("hsl"))t.values[2]+=(100-t.values[2])*e;else if(t.type.includes("rgb"))for(let n=0;n<3;n+=1)t.values[n]+=(255-t.values[n])*e;else if(t.type.includes("color"))for(let n=0;n<3;n+=1)t.values[n]+=(1-t.values[n])*e;return Tc(t)}function Fe(t,e,n){try{return nh(t,e)}catch{return t}}function T5(t,e=.15){return gu(t)>.5?th(t,e):nh(t,e)}function zo(t,e,n){try{return T5(t,e)}catch{return t}}const E5=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(Pe.node,Pe.object);function P5(t){const{theme:e,name:n,props:i}=t;if(!e||!e.components||!e.components[n])return i;const r=e.components[n];return r.defaultProps?pu(r.defaultProps,i,e.components.mergeClassNameAndStyle):!r.styleOverrides&&!r.variants?pu(r,i,e.components.mergeClassNameAndStyle):i}function R5({props:t,name:e}){const n=v.useContext(E5);return P5({props:t,name:e,theme:{components:n}})}const b0={theme:void 0};function A5(t){let e,n;return function(r){let s=e;return(s===void 0||r.theme!==n)&&(b0.theme=r.theme,s=qS(t(b0)),e=s,n=r.theme),s}}function I5(t=""){function e(...i){if(!i.length)return"";const r=i[0];return typeof r=="string"&&!r.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${t?`${t}-`:""}${r}${e(...i.slice(1))})`:`, ${r}`}return(i,...r)=>`var(--${t?`${t}-`:""}${i}${e(...r)})`}const x0=(t,e,n,i=[])=>{let r=t;e.forEach((s,o)=>{o===e.length-1?Array.isArray(r)?r[Number(s)]=n:r&&typeof r=="object"&&(r[s]=n):r&&typeof r=="object"&&(r[s]||(r[s]=i.includes(s)?[]:{}),r=r[s])})},M5=(t,e,n)=>{function i(r,s=[],o=[]){Object.entries(r).forEach(([a,c])=>{(!n||n&&!n([...s,a]))&&c!=null&&(typeof c=="object"&&Object.keys(c).length>0?i(c,[...s,a],Array.isArray(c)?[...o,a]:o):e([...s,a],c,o))})}i(t)},_5=(t,e)=>typeof e=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>t.includes(i))||t[t.length-1].toLowerCase().includes("opacity")?e:`${e}px`:e;function Fl(t,e){const{prefix:n,shouldSkipGeneratingVar:i}=e||{},r={},s={},o={};return M5(t,(a,c,l)=>{if((typeof c=="string"||typeof c=="number")&&(!i||!i(a,c))){const d=`--${n?`${n}-`:""}${a.join("-")}`,u=_5(a,c);Object.assign(r,{[d]:u}),x0(s,a,`var(${d})`,l),x0(o,a,`var(${d}, ${u})`,l)}},a=>a[0]==="vars"),{css:r,vars:s,varsWithDefaults:o}}function N5(t,e={}){const{getSelector:n=y,disableCssColorScheme:i,colorSchemeSelector:r}=e,{colorSchemes:s={},components:o,defaultColorScheme:a="light",...c}=t,{vars:l,css:d,varsWithDefaults:u}=Fl(c,e);let f=u;const p={},{[a]:g,...h}=s;if(Object.entries(h||{}).forEach(([C,S])=>{const{vars:x,css:T,varsWithDefaults:E}=Fl(S,e);f=zt(f,E),p[C]={css:T,vars:x}}),g){const{css:C,vars:S,varsWithDefaults:x}=Fl(g,e);f=zt(f,x),p[a]={css:C,vars:S}}function y(C,S){var T,E;let x=r;if(r==="class"&&(x=".%s"),r==="data"&&(x="[data-%s]"),r!=null&&r.startsWith("data-")&&!r.includes("%s")&&(x=`[${r}="%s"]`),C){if(x==="media")return t.defaultColorScheme===C?":root":{[`@media (prefers-color-scheme: ${((E=(T=s[C])==null?void 0:T.palette)==null?void 0:E.mode)||C})`]:{":root":S}};if(x)return t.defaultColorScheme===C?`:root, ${x.replace("%s",String(C))}`:x.replace("%s",String(C))}return":root"}return{vars:f,generateThemeVars:()=>{let C={...l};return Object.entries(p).forEach(([,{vars:S}])=>{C=zt(C,S)}),C},generateStyleSheets:()=>{var P,_;const C=[],S=t.defaultColorScheme||"light";function x(k,I){Object.keys(I).length&&C.push(typeof k=="string"?{[k]:{...I}}:k)}x(n(void 0,{...d}),d);const{[S]:T,...E}=p;if(T){const{css:k}=T,I=(_=(P=s[S])==null?void 0:P.palette)==null?void 0:_.mode,N=!i&&I?{colorScheme:I,...k}:{...k};x(n(S,{...N}),N)}return Object.entries(E).forEach(([k,{css:I}])=>{var J,se;const N=(se=(J=s[k])==null?void 0:J.palette)==null?void 0:se.mode,K=!i&&N?{colorScheme:N,...I}:{...I};x(n(k,{...K}),K)}),C}}}function O5(t){return function(n){return t==="media"?(process.env.NODE_ENV!=="production"&&n!=="light"&&n!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${n}'.`),`@media (prefers-color-scheme: ${n})`):t?t.startsWith("data-")&&!t.includes("%s")?`[${t}="${n}"] &`:t==="class"?`.${n} &`:t==="data"?`[data-${n}] &`:`${t.replace("%s",n)} &`:"&"}}const oo={black:"#000",white:"#fff"},D5={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},vr={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},yr={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Rs={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},br={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},xr={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Sr={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function YS(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:oo.white,default:oo.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const j5=YS();function JS(){return{text:{primary:oo.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:oo.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const S0=JS();function w0(t,e,n,i){const r=i.light||i,s=i.dark||i*1.5;t[e]||(t.hasOwnProperty(n)?t[e]=t[n]:e==="light"?t.light=nh(t.main,r):e==="dark"&&(t.dark=th(t.main,s)))}function L5(t="light"){return t==="dark"?{main:br[200],light:br[50],dark:br[400]}:{main:br[700],light:br[400],dark:br[800]}}function V5(t="light"){return t==="dark"?{main:vr[200],light:vr[50],dark:vr[400]}:{main:vr[500],light:vr[300],dark:vr[700]}}function F5(t="light"){return t==="dark"?{main:yr[500],light:yr[300],dark:yr[700]}:{main:yr[700],light:yr[400],dark:yr[800]}}function U5(t="light"){return t==="dark"?{main:xr[400],light:xr[300],dark:xr[700]}:{main:xr[700],light:xr[500],dark:xr[900]}}function B5(t="light"){return t==="dark"?{main:Sr[400],light:Sr[300],dark:Sr[700]}:{main:Sr[800],light:Sr[500],dark:Sr[900]}}function $5(t="light"){return t==="dark"?{main:Rs[400],light:Rs[300],dark:Rs[700]}:{main:"#ed6c02",light:Rs[500],dark:Rs[900]}}function ih(t){const{mode:e="light",contrastThreshold:n=3,tonalOffset:i=.2,...r}=t,s=t.primary||L5(e),o=t.secondary||V5(e),a=t.error||F5(e),c=t.info||U5(e),l=t.success||B5(e),d=t.warning||$5(e);function u(h){const y=y0(h,S0.text.primary)>=n?S0.text.primary:j5.text.primary;if(process.env.NODE_ENV!=="production"){const b=y0(h,y);b<3&&console.error([`MUI: The contrast ratio of ${b}:1 for ${y} on ${h}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
271
+ `))}return y}const f=({color:h,name:y,mainShade:b=500,lightShade:w=300,darkShade:C=700})=>{if(h={...h},!h.main&&h[b]&&(h.main=h[b]),!h.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${y?` (${y})`:""} provided to augmentColor(color) is invalid.
272
+ The color object needs to have a \`main\` property or a \`${b}\` property.`:wi(11,y?` (${y})`:"",b));if(typeof h.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${y?` (${y})`:""} provided to augmentColor(color) is invalid.
273
+ \`color.main\` should be a string, but \`${JSON.stringify(h.main)}\` was provided instead.
274
+
275
+ Did you intend to use one of the following approaches?
276
+
277
+ import { green } from "@mui/material/colors";
278
+
279
+ const theme1 = createTheme({ palette: {
280
+ primary: green,
281
+ } });
282
+
283
+ const theme2 = createTheme({ palette: {
284
+ primary: { main: green[500] },
285
+ } });`:wi(12,y?` (${y})`:"",JSON.stringify(h.main)));return w0(h,"light",w,i),w0(h,"dark",C,i),h.contrastText||(h.contrastText=u(h.main)),h};let p;return e==="light"?p=YS():e==="dark"&&(p=JS()),process.env.NODE_ENV!=="production"&&(p||console.error(`MUI: The palette mode \`${e}\` is not supported.`)),zt({common:{...oo},mode:e,primary:f({color:s,name:"primary"}),secondary:f({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:f({color:a,name:"error"}),warning:f({color:d,name:"warning"}),info:f({color:c,name:"info"}),success:f({color:l,name:"success"}),grey:D5,contrastThreshold:n,getContrastText:u,augmentColor:f,tonalOffset:i,...p},r)}function H5(t){const e={};return Object.entries(t).forEach(i=>{const[r,s]=i;typeof s=="object"&&(e[r]=`${s.fontStyle?`${s.fontStyle} `:""}${s.fontVariant?`${s.fontVariant} `:""}${s.fontWeight?`${s.fontWeight} `:""}${s.fontStretch?`${s.fontStretch} `:""}${s.fontSize||""}${s.lineHeight?`/${s.lineHeight} `:""}${s.fontFamily||""}`)}),e}function z5(t,e){return{toolbar:{minHeight:56,[t.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[t.up("sm")]:{minHeight:64}},...e}}function W5(t){return Math.round(t*1e5)/1e5}const C0={textTransform:"uppercase"},k0='"Roboto", "Helvetica", "Arial", sans-serif';function q5(t,e){const{fontFamily:n=k0,fontSize:i=14,fontWeightLight:r=300,fontWeightRegular:s=400,fontWeightMedium:o=500,fontWeightBold:a=700,htmlFontSize:c=16,allVariants:l,pxToRem:d,...u}=typeof e=="function"?e(t):e;process.env.NODE_ENV!=="production"&&(typeof i!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof c!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const f=i/14,p=d||(y=>`${y/c*f}rem`),g=(y,b,w,C,S)=>({fontFamily:n,fontWeight:y,fontSize:p(b),lineHeight:w,...n===k0?{letterSpacing:`${W5(C/b)}em`}:{},...S,...l}),h={h1:g(r,96,1.167,-1.5),h2:g(r,60,1.2,-.5),h3:g(s,48,1.167,0),h4:g(s,34,1.235,.25),h5:g(s,24,1.334,0),h6:g(o,20,1.6,.15),subtitle1:g(s,16,1.75,.15),subtitle2:g(o,14,1.57,.1),body1:g(s,16,1.5,.15),body2:g(s,14,1.43,.15),button:g(o,14,1.75,.4,C0),caption:g(s,12,1.66,.4),overline:g(s,12,2.66,1,C0),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return zt({htmlFontSize:c,pxToRem:p,fontFamily:n,fontSize:i,fontWeightLight:r,fontWeightRegular:s,fontWeightMedium:o,fontWeightBold:a,...h},u,{clone:!1})}const K5=.2,G5=.14,Z5=.12;function He(...t){return[`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px rgba(0,0,0,${K5})`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px rgba(0,0,0,${G5})`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px rgba(0,0,0,${Z5})`].join(",")}const Y5=["none",He(0,2,1,-1,0,1,1,0,0,1,3,0),He(0,3,1,-2,0,2,2,0,0,1,5,0),He(0,3,3,-2,0,3,4,0,0,1,8,0),He(0,2,4,-1,0,4,5,0,0,1,10,0),He(0,3,5,-1,0,5,8,0,0,1,14,0),He(0,3,5,-1,0,6,10,0,0,1,18,0),He(0,4,5,-2,0,7,10,1,0,2,16,1),He(0,5,5,-3,0,8,10,1,0,3,14,2),He(0,5,6,-3,0,9,12,1,0,3,16,2),He(0,6,6,-3,0,10,14,1,0,4,18,3),He(0,6,7,-4,0,11,15,1,0,4,20,3),He(0,7,8,-4,0,12,17,2,0,5,22,4),He(0,7,8,-4,0,13,19,2,0,5,24,4),He(0,7,9,-4,0,14,21,2,0,5,26,4),He(0,8,9,-5,0,15,22,2,0,6,28,5),He(0,8,10,-5,0,16,24,2,0,6,30,5),He(0,8,11,-5,0,17,26,2,0,6,32,5),He(0,9,11,-5,0,18,28,2,0,7,34,6),He(0,9,12,-6,0,19,29,2,0,7,36,6),He(0,10,13,-6,0,20,31,3,0,8,38,7),He(0,10,13,-6,0,21,33,3,0,8,40,7),He(0,10,14,-6,0,22,35,3,0,8,42,7),He(0,11,14,-7,0,23,36,3,0,9,44,8),He(0,11,15,-7,0,24,38,3,0,9,46,8)],J5={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},X5={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function T0(t){return`${Math.round(t)}ms`}function Q5(t){if(!t)return 0;const e=t/36;return Math.min(Math.round((4+15*e**.25+e/5)*10),3e3)}function ej(t){const e={...J5,...t.easing},n={...X5,...t.duration};return{getAutoHeightDuration:Q5,create:(r=["all"],s={})=>{const{duration:o=n.standard,easing:a=e.easeInOut,delay:c=0,...l}=s;if(process.env.NODE_ENV!=="production"){const d=f=>typeof f=="string",u=f=>!Number.isNaN(parseFloat(f));!d(r)&&!Array.isArray(r)&&console.error('MUI: Argument "props" must be a string or Array.'),!u(o)&&!d(o)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${o}.`),d(a)||console.error('MUI: Argument "easing" must be a string.'),!u(c)&&!d(c)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof s!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
286
+ `)),Object.keys(l).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(l).join(",")}].`)}return(Array.isArray(r)?r:[r]).map(d=>`${d} ${typeof o=="string"?o:T0(o)} ${a} ${typeof c=="string"?c:T0(c)}`).join(",")},...t,easing:e,duration:n}}const tj={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function nj(t){return qn(t)||typeof t>"u"||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||Array.isArray(t)}function XS(t={}){const e={...t};function n(i){const r=Object.entries(i);for(let s=0;s<r.length;s++){const[o,a]=r[s];!nj(a)||o.startsWith("unstable_")?delete i[o]:qn(a)&&(i[o]={...a},n(i[o]))}}return n(e),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
287
+
288
+ const theme = ${JSON.stringify(e,null,2)};
289
+
290
+ theme.breakpoints = createBreakpoints(theme.breakpoints || {});
291
+ theme.transitions = createTransitions(theme.transitions || {});
292
+
293
+ export default theme;`}function vu(t={},...e){const{breakpoints:n,mixins:i={},spacing:r,palette:s={},transitions:o={},typography:a={},shape:c,...l}=t;if(t.vars&&t.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":wi(20));const d=ih(s),u=zS(t);let f=zt(u,{mixins:z5(u.breakpoints,i),palette:d,shadows:Y5.slice(),typography:q5(d,a),transitions:ej(o),zIndex:{...tj}});if(f=zt(f,l),f=e.reduce((p,g)=>zt(p,g),f),process.env.NODE_ENV!=="production"){const p=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],g=(h,y)=>{let b;for(b in h){const w=h[b];if(p.includes(b)&&Object.keys(w).length>0){if(process.env.NODE_ENV!=="production"){const C=Qf("",b);console.error([`MUI: The \`${y}\` component increases the CSS specificity of the \`${b}\` internal state.`,"You can not override it like this: ",JSON.stringify(h,null,2),"",`Instead, you need to use the '&.${C}' syntax:`,JSON.stringify({root:{[`&.${C}`]:w}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
294
+ `))}h[b]={}}}};Object.keys(f.components).forEach(h=>{const y=f.components[h].styleOverrides;y&&h.startsWith("Mui")&&g(y,h)})}return f.unstable_sxConfig={...Sc,...l==null?void 0:l.unstable_sxConfig},f.unstable_sx=function(g){return es({sx:g,theme:this})},f.toRuntimeSource=XS,f}function ij(t){let e;return t<1?e=5.11916*t**2:e=4.5*Math.log(t+1)+2,Math.round(e*10)/1e3}const rj=[...Array(25)].map((t,e)=>{if(e===0)return"none";const n=ij(e);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function QS(t){return{inputPlaceholder:t==="dark"?.5:.42,inputUnderline:t==="dark"?.7:.42,switchTrackDisabled:t==="dark"?.2:.12,switchTrack:t==="dark"?.3:.38}}function ew(t){return t==="dark"?rj:[]}function sj(t){const{palette:e={mode:"light"},opacity:n,overlays:i,...r}=t,s=ih(e);return{palette:s,opacity:{...QS(s.mode),...n},overlays:i||ew(s.mode),...r}}function oj(t){var e;return!!t[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!t[0].match(/sxConfig$/)||t[0]==="palette"&&!!((e=t[1])!=null&&e.match(/(mode|contrastThreshold|tonalOffset)/))}const aj=t=>[...[...Array(25)].map((e,n)=>`--${t?`${t}-`:""}overlays-${n}`),`--${t?`${t}-`:""}palette-AppBar-darkBg`,`--${t?`${t}-`:""}palette-AppBar-darkColor`],cj=t=>(e,n)=>{const i=t.rootSelector||":root",r=t.colorSchemeSelector;let s=r;if(r==="class"&&(s=".%s"),r==="data"&&(s="[data-%s]"),r!=null&&r.startsWith("data-")&&!r.includes("%s")&&(s=`[${r}="%s"]`),t.defaultColorScheme===e){if(e==="dark"){const o={};return aj(t.cssVarPrefix).forEach(a=>{o[a]=n[a],delete n[a]}),s==="media"?{[i]:n,"@media (prefers-color-scheme: dark)":{[i]:o}}:s?{[s.replace("%s",e)]:o,[`${i}, ${s.replace("%s",e)}`]:n}:{[i]:{...n,...o}}}if(s&&s!=="media")return`${i}, ${s.replace("%s",String(e))}`}else if(e){if(s==="media")return{[`@media (prefers-color-scheme: ${String(e)})`]:{[i]:n}};if(s)return s.replace("%s",String(e))}return i};function lj(t,e){e.forEach(n=>{t[n]||(t[n]={})})}function H(t,e,n){!t[e]&&n&&(t[e]=n)}function Os(t){return typeof t!="string"||!t.startsWith("hsl")?t:ZS(t)}function Fn(t,e){`${e}Channel`in t||(t[`${e}Channel`]=Ns(Os(t[e]),`MUI: Can't create \`palette.${e}Channel\` because \`palette.${e}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
295
+ To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function dj(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const yn=t=>{try{return t()}catch{}},uj=(t="mui")=>I5(t);function Ul(t,e,n,i){if(!e)return;e=e===!0?{}:e;const r=i==="dark"?"dark":"light";if(!n){t[i]=sj({...e,palette:{mode:r,...e==null?void 0:e.palette}});return}const{palette:s,...o}=vu({...n,palette:{mode:r,...e==null?void 0:e.palette}});return t[i]={...e,palette:s,opacity:{...QS(r),...e==null?void 0:e.opacity},overlays:(e==null?void 0:e.overlays)||ew(r)},o}function fj(t={},...e){const{colorSchemes:n={light:!0},defaultColorScheme:i,disableCssColorScheme:r=!1,cssVarPrefix:s="mui",shouldSkipGeneratingVar:o=oj,colorSchemeSelector:a=n.light&&n.dark?"media":void 0,rootSelector:c=":root",...l}=t,d=Object.keys(n)[0],u=i||(n.light&&d!=="light"?"light":d),f=uj(s),{[u]:p,light:g,dark:h,...y}=n,b={...y};let w=p;if((u==="dark"&&!("dark"in n)||u==="light"&&!("light"in n))&&(w=!0),!w)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${u}\` option is either missing or invalid.`:wi(21,u));const C=Ul(b,w,l,u);g&&!b.light&&Ul(b,g,void 0,"light"),h&&!b.dark&&Ul(b,h,void 0,"dark");let S={defaultColorScheme:u,...C,cssVarPrefix:s,colorSchemeSelector:a,rootSelector:c,getCssVar:f,colorSchemes:b,font:{...H5(C.typography),...C.font},spacing:dj(l.spacing)};Object.keys(S.colorSchemes).forEach(_=>{const k=S.colorSchemes[_].palette,I=N=>{const K=N.split("-"),J=K[1],se=K[2];return f(N,k[J][se])};if(k.mode==="light"&&(H(k.common,"background","#fff"),H(k.common,"onBackground","#000")),k.mode==="dark"&&(H(k.common,"background","#000"),H(k.common,"onBackground","#fff")),lj(k,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),k.mode==="light"){H(k.Alert,"errorColor",Ve(k.error.light,.6)),H(k.Alert,"infoColor",Ve(k.info.light,.6)),H(k.Alert,"successColor",Ve(k.success.light,.6)),H(k.Alert,"warningColor",Ve(k.warning.light,.6)),H(k.Alert,"errorFilledBg",I("palette-error-main")),H(k.Alert,"infoFilledBg",I("palette-info-main")),H(k.Alert,"successFilledBg",I("palette-success-main")),H(k.Alert,"warningFilledBg",I("palette-warning-main")),H(k.Alert,"errorFilledColor",yn(()=>k.getContrastText(k.error.main))),H(k.Alert,"infoFilledColor",yn(()=>k.getContrastText(k.info.main))),H(k.Alert,"successFilledColor",yn(()=>k.getContrastText(k.success.main))),H(k.Alert,"warningFilledColor",yn(()=>k.getContrastText(k.warning.main))),H(k.Alert,"errorStandardBg",Fe(k.error.light,.9)),H(k.Alert,"infoStandardBg",Fe(k.info.light,.9)),H(k.Alert,"successStandardBg",Fe(k.success.light,.9)),H(k.Alert,"warningStandardBg",Fe(k.warning.light,.9)),H(k.Alert,"errorIconColor",I("palette-error-main")),H(k.Alert,"infoIconColor",I("palette-info-main")),H(k.Alert,"successIconColor",I("palette-success-main")),H(k.Alert,"warningIconColor",I("palette-warning-main")),H(k.AppBar,"defaultBg",I("palette-grey-100")),H(k.Avatar,"defaultBg",I("palette-grey-400")),H(k.Button,"inheritContainedBg",I("palette-grey-300")),H(k.Button,"inheritContainedHoverBg",I("palette-grey-A100")),H(k.Chip,"defaultBorder",I("palette-grey-400")),H(k.Chip,"defaultAvatarColor",I("palette-grey-700")),H(k.Chip,"defaultIconColor",I("palette-grey-700")),H(k.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),H(k.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),H(k.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),H(k.LinearProgress,"primaryBg",Fe(k.primary.main,.62)),H(k.LinearProgress,"secondaryBg",Fe(k.secondary.main,.62)),H(k.LinearProgress,"errorBg",Fe(k.error.main,.62)),H(k.LinearProgress,"infoBg",Fe(k.info.main,.62)),H(k.LinearProgress,"successBg",Fe(k.success.main,.62)),H(k.LinearProgress,"warningBg",Fe(k.warning.main,.62)),H(k.Skeleton,"bg",`rgba(${I("palette-text-primaryChannel")} / 0.11)`),H(k.Slider,"primaryTrack",Fe(k.primary.main,.62)),H(k.Slider,"secondaryTrack",Fe(k.secondary.main,.62)),H(k.Slider,"errorTrack",Fe(k.error.main,.62)),H(k.Slider,"infoTrack",Fe(k.info.main,.62)),H(k.Slider,"successTrack",Fe(k.success.main,.62)),H(k.Slider,"warningTrack",Fe(k.warning.main,.62));const N=zo(k.background.default,.8);H(k.SnackbarContent,"bg",N),H(k.SnackbarContent,"color",yn(()=>k.getContrastText(N))),H(k.SpeedDialAction,"fabHoverBg",zo(k.background.paper,.15)),H(k.StepConnector,"border",I("palette-grey-400")),H(k.StepContent,"border",I("palette-grey-400")),H(k.Switch,"defaultColor",I("palette-common-white")),H(k.Switch,"defaultDisabledColor",I("palette-grey-100")),H(k.Switch,"primaryDisabledColor",Fe(k.primary.main,.62)),H(k.Switch,"secondaryDisabledColor",Fe(k.secondary.main,.62)),H(k.Switch,"errorDisabledColor",Fe(k.error.main,.62)),H(k.Switch,"infoDisabledColor",Fe(k.info.main,.62)),H(k.Switch,"successDisabledColor",Fe(k.success.main,.62)),H(k.Switch,"warningDisabledColor",Fe(k.warning.main,.62)),H(k.TableCell,"border",Fe(Ho(k.divider,1),.88)),H(k.Tooltip,"bg",Ho(k.grey[700],.92))}if(k.mode==="dark"){H(k.Alert,"errorColor",Fe(k.error.light,.6)),H(k.Alert,"infoColor",Fe(k.info.light,.6)),H(k.Alert,"successColor",Fe(k.success.light,.6)),H(k.Alert,"warningColor",Fe(k.warning.light,.6)),H(k.Alert,"errorFilledBg",I("palette-error-dark")),H(k.Alert,"infoFilledBg",I("palette-info-dark")),H(k.Alert,"successFilledBg",I("palette-success-dark")),H(k.Alert,"warningFilledBg",I("palette-warning-dark")),H(k.Alert,"errorFilledColor",yn(()=>k.getContrastText(k.error.dark))),H(k.Alert,"infoFilledColor",yn(()=>k.getContrastText(k.info.dark))),H(k.Alert,"successFilledColor",yn(()=>k.getContrastText(k.success.dark))),H(k.Alert,"warningFilledColor",yn(()=>k.getContrastText(k.warning.dark))),H(k.Alert,"errorStandardBg",Ve(k.error.light,.9)),H(k.Alert,"infoStandardBg",Ve(k.info.light,.9)),H(k.Alert,"successStandardBg",Ve(k.success.light,.9)),H(k.Alert,"warningStandardBg",Ve(k.warning.light,.9)),H(k.Alert,"errorIconColor",I("palette-error-main")),H(k.Alert,"infoIconColor",I("palette-info-main")),H(k.Alert,"successIconColor",I("palette-success-main")),H(k.Alert,"warningIconColor",I("palette-warning-main")),H(k.AppBar,"defaultBg",I("palette-grey-900")),H(k.AppBar,"darkBg",I("palette-background-paper")),H(k.AppBar,"darkColor",I("palette-text-primary")),H(k.Avatar,"defaultBg",I("palette-grey-600")),H(k.Button,"inheritContainedBg",I("palette-grey-800")),H(k.Button,"inheritContainedHoverBg",I("palette-grey-700")),H(k.Chip,"defaultBorder",I("palette-grey-700")),H(k.Chip,"defaultAvatarColor",I("palette-grey-300")),H(k.Chip,"defaultIconColor",I("palette-grey-300")),H(k.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),H(k.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),H(k.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),H(k.LinearProgress,"primaryBg",Ve(k.primary.main,.5)),H(k.LinearProgress,"secondaryBg",Ve(k.secondary.main,.5)),H(k.LinearProgress,"errorBg",Ve(k.error.main,.5)),H(k.LinearProgress,"infoBg",Ve(k.info.main,.5)),H(k.LinearProgress,"successBg",Ve(k.success.main,.5)),H(k.LinearProgress,"warningBg",Ve(k.warning.main,.5)),H(k.Skeleton,"bg",`rgba(${I("palette-text-primaryChannel")} / 0.13)`),H(k.Slider,"primaryTrack",Ve(k.primary.main,.5)),H(k.Slider,"secondaryTrack",Ve(k.secondary.main,.5)),H(k.Slider,"errorTrack",Ve(k.error.main,.5)),H(k.Slider,"infoTrack",Ve(k.info.main,.5)),H(k.Slider,"successTrack",Ve(k.success.main,.5)),H(k.Slider,"warningTrack",Ve(k.warning.main,.5));const N=zo(k.background.default,.98);H(k.SnackbarContent,"bg",N),H(k.SnackbarContent,"color",yn(()=>k.getContrastText(N))),H(k.SpeedDialAction,"fabHoverBg",zo(k.background.paper,.15)),H(k.StepConnector,"border",I("palette-grey-600")),H(k.StepContent,"border",I("palette-grey-600")),H(k.Switch,"defaultColor",I("palette-grey-300")),H(k.Switch,"defaultDisabledColor",I("palette-grey-600")),H(k.Switch,"primaryDisabledColor",Ve(k.primary.main,.55)),H(k.Switch,"secondaryDisabledColor",Ve(k.secondary.main,.55)),H(k.Switch,"errorDisabledColor",Ve(k.error.main,.55)),H(k.Switch,"infoDisabledColor",Ve(k.info.main,.55)),H(k.Switch,"successDisabledColor",Ve(k.success.main,.55)),H(k.Switch,"warningDisabledColor",Ve(k.warning.main,.55)),H(k.TableCell,"border",Ve(Ho(k.divider,1),.68)),H(k.Tooltip,"bg",Ho(k.grey[700],.92))}Fn(k.background,"default"),Fn(k.background,"paper"),Fn(k.common,"background"),Fn(k.common,"onBackground"),Fn(k,"divider"),Object.keys(k).forEach(N=>{const K=k[N];N!=="tonalOffset"&&K&&typeof K=="object"&&(K.main&&H(k[N],"mainChannel",Ns(Os(K.main))),K.light&&H(k[N],"lightChannel",Ns(Os(K.light))),K.dark&&H(k[N],"darkChannel",Ns(Os(K.dark))),K.contrastText&&H(k[N],"contrastTextChannel",Ns(Os(K.contrastText))),N==="text"&&(Fn(k[N],"primary"),Fn(k[N],"secondary")),N==="action"&&(K.active&&Fn(k[N],"active"),K.selected&&Fn(k[N],"selected")))})}),S=e.reduce((_,k)=>zt(_,k),S);const x={prefix:s,disableCssColorScheme:r,shouldSkipGeneratingVar:o,getSelector:cj(S)},{vars:T,generateThemeVars:E,generateStyleSheets:P}=N5(S,x);return S.vars=T,Object.entries(S.colorSchemes[S.defaultColorScheme]).forEach(([_,k])=>{S[_]=k}),S.generateThemeVars=E,S.generateStyleSheets=P,S.generateSpacing=function(){return HS(l.spacing,Gf(this))},S.getColorSchemeSelector=O5(a),S.spacing=S.generateSpacing(),S.shouldSkipGeneratingVar=o,S.unstable_sxConfig={...Sc,...l==null?void 0:l.unstable_sxConfig},S.unstable_sx=function(k){return es({sx:k,theme:this})},S.toRuntimeSource=XS,S}function E0(t,e,n){t.colorSchemes&&n&&(t.colorSchemes[e]={...n!==!0&&n,palette:ih({...n===!0?{}:n.palette,mode:e})})}function hj(t={},...e){const{palette:n,cssVariables:i=!1,colorSchemes:r=n?void 0:{light:!0},defaultColorScheme:s=n==null?void 0:n.mode,...o}=t,a=s||"light",c=r==null?void 0:r[a],l={...r,...n?{[a]:{...typeof c!="boolean"&&c,palette:n}}:void 0};if(i===!1){if(!("colorSchemes"in t))return vu(t,...e);let d=n;"palette"in t||l[a]&&(l[a]!==!0?d=l[a].palette:a==="dark"&&(d={mode:"dark"}));const u=vu({...t,palette:d},...e);return u.defaultColorScheme=a,u.colorSchemes=l,u.palette.mode==="light"&&(u.colorSchemes.light={...l.light!==!0&&l.light,palette:u.palette},E0(u,"dark",l.dark)),u.palette.mode==="dark"&&(u.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:u.palette},E0(u,"light",l.light)),u}return!n&&!("light"in l)&&a==="light"&&(l.light=!0),fj({...o,colorSchemes:l,defaultColorScheme:a,...typeof i!="boolean"&&i},...e)}const mj=hj(),pj="$$material";function gj(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const vj=t=>gj(t)&&t!=="classes",yj=g5({themeId:pj,defaultTheme:mj,rootShouldForwardProp:vj}),bj=A5;process.env.NODE_ENV!=="production"&&(Pe.node,Pe.object.isRequired);function xj(t){return R5(t)}function Sj(t){return Qf("MuiSvgIcon",t)}u5("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const wj=t=>{const{color:e,fontSize:n,classes:i}=t,r={root:["root",e!=="inherit"&&`color${ir(e)}`,`fontSize${ir(n)}`]};return mD(r,Sj,i)},Cj=yj("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color!=="inherit"&&e[`color${ir(n.color)}`],e[`fontSize${ir(n.fontSize)}`]]}})(bj(({theme:t})=>{var e,n,i,r,s,o,a,c,l,d,u,f,p,g;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(r=(e=t.transitions)==null?void 0:e.create)==null?void 0:r.call(e,"fill",{duration:(i=(n=(t.vars??t).transitions)==null?void 0:n.duration)==null?void 0:i.shorter}),variants:[{props:h=>!h.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((o=(s=t.typography)==null?void 0:s.pxToRem)==null?void 0:o.call(s,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((c=(a=t.typography)==null?void 0:a.pxToRem)==null?void 0:c.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((d=(l=t.typography)==null?void 0:l.pxToRem)==null?void 0:d.call(l,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,h])=>h&&h.main).map(([h])=>{var y,b;return{props:{color:h},style:{color:(b=(y=(t.vars??t).palette)==null?void 0:y[h])==null?void 0:b.main}}}),{props:{color:"action"},style:{color:(f=(u=(t.vars??t).palette)==null?void 0:u.action)==null?void 0:f.active}},{props:{color:"disabled"},style:{color:(g=(p=(t.vars??t).palette)==null?void 0:p.action)==null?void 0:g.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),za=v.forwardRef(function(e,n){const i=xj({props:e,name:"MuiSvgIcon"}),{children:r,className:s,color:o="inherit",component:a="svg",fontSize:c="medium",htmlColor:l,inheritViewBox:d=!1,titleAccess:u,viewBox:f="0 0 24 24",...p}=i,g=v.isValidElement(r)&&r.type==="svg",h={...i,color:o,component:a,fontSize:c,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:f,hasSvgAsChild:g},y={};d||(y.viewBox=f);const b=wj(h);return m.jsxs(Cj,{as:a,className:ic(b.root,s),focusable:"false",color:l,"aria-hidden":u?void 0:!0,role:u?"img":void 0,ref:n,...y,...p,...g&&r.props,ownerState:h,children:[g?r.props.children:r,u?m.jsx("title",{children:u}):null]})});process.env.NODE_ENV!=="production"&&(za.propTypes={children:Pe.node,classes:Pe.object,className:Pe.string,color:Pe.oneOfType([Pe.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),Pe.string]),component:Pe.elementType,fontSize:Pe.oneOfType([Pe.oneOf(["inherit","large","medium","small"]),Pe.string]),htmlColor:Pe.string,inheritViewBox:Pe.bool,shapeRendering:Pe.string,sx:Pe.oneOfType([Pe.arrayOf(Pe.oneOfType([Pe.func,Pe.object,Pe.bool])),Pe.func,Pe.object]),titleAccess:Pe.string,viewBox:Pe.string});za.muiName="SvgIcon";function hs(t,e){function n(i,r){return m.jsx(za,{"data-testid":process.env.NODE_ENV!=="production"?`${e}Icon`:void 0,ref:r,...i,children:t})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${e}Icon`),n.muiName=za.muiName,v.memo(v.forwardRef(n))}const kj=hs(m.jsx("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z"}),"AttachFile"),Tj=hs(m.jsx("path",{d:"M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08c-.18-.17-.29-.42-.29-.7s.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71s-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28-.79-.74-1.69-1.36-2.67-1.85-.33-.16-.56-.5-.56-.9v-3.1C15.15 9.25 13.6 9 12 9"}),"CallEnd"),Ej=hs([m.jsx("circle",{cx:"12",cy:"12",r:"3.2"},"0"),m.jsx("path",{d:"M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5"},"1")],"CameraAlt"),tw=hs(m.jsx("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M6 9h12v2H6zm8 5H6v-2h8zm4-6H6V6h12z"}),"Chat"),nw=hs(m.jsx("path",{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z"}),"Mic"),iw=hs(m.jsx("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11z"}),"Videocam"),Pj=({disabled:t,capabilities:e,sessionStarted:n,ref:i,participantName:r="User",loadingText:s="Waiting for agent to connect...",theme:o="vox",client:a,displayType:c="widget",onBack:l})=>{var J,se,ie,X,O,oe,L;const[d,u]=R.useState(!1),[f,p]=R.useState(!1),[g,h]=R.useState(()=>{var te;const F=(te=a==null?void 0:a.getCurrentInteraction)==null?void 0:te.call(a);return console.log("SessionView: Initializing with existing interaction:",(F==null?void 0:F.methodName)||"none"),F||null}),{messages:y,send:b}=nD(),w=R.useRef(null),C=R.useRef(null),{agent:{isActive:S=!1}={}}=V1(),x=St(o),T=R.useMemo(()=>a&&typeof a.getCurrentSession=="function"?!!a.getCurrentSession():!1,[a]),E=S||T;R.useEffect(()=>{var F,te;console.log("🤖 SessionView agent state:",{isAgentActive:S,hasActiveSession:T,effectiveAgentActive:E,sessionStarted:n,clientSession:(te=(F=a==null?void 0:a.getCurrentSession)==null?void 0:F.call(a))==null?void 0:te.id})},[S,T,E,n,a]),R.useEffect(()=>{console.log("🤖 Agent active state changed:",S)},[S]),R.useEffect(()=>{console.log("📋 Session state changed:",{sessionStarted:n,disabled:t,participantName:r,effectiveAgentActive:E,chatOpen:d,currentInteraction:(g==null?void 0:g.methodName)||"none"})},[n,t,r,E,d,g]),R.useEffect(()=>{if(n&&!S){console.log("⏰ Starting agent timeout detection...");const F=setTimeout(()=>{console.log("⚠️ Agent timeout: Agent did not become active within 30 seconds"),p(!0)},3e4);return()=>{clearTimeout(F)}}else S&&(console.log("✅ Agent is active, clearing timeout"),p(!1))},[n,S]),R.useEffect(()=>{if(!a)return;const F=()=>{console.log("🔄 Client connection state changed:",a.connected)},te=j=>{console.log("🔴 Client disconnected:",j),h(null),u(!1),p(!1)};return a.on("connection.connected",F),a.on("connection.disconnected",te),()=>{a.off("connection.connected",F),a.off("connection.disconnected",te)}},[a]),R.useEffect(()=>{if(!a)return;const F=ee=>{console.log("🎯 SessionView: RPC Interaction started:",ee);const G=a.getCurrentInteraction();G&&(console.log("📱 SessionView: Setting current interaction:",G.methodName,"mode:",G.presentationMode),h(G))},te=ee=>{console.log("✅ SessionView: RPC Interaction completed:",ee),h(null)},j=async ee=>{console.log("⏰ SessionView: RPC Interaction timeout:",ee),h(null)},q=async ee=>{console.log("❌ SessionView: RPC Interaction dismissed:",ee),h(null)};return a.on("rpc.interaction.started",F),a.on("rpc.interaction.completed",te),a.on("rpc.interaction.timeout",j),a.on("rpc.interaction.dismissed",q),()=>{a.off("rpc.interaction.started",F),a.off("rpc.interaction.completed",te),a.off("rpc.interaction.timeout",j),a.off("rpc.interaction.dismissed",q)}},[a]),R.useEffect(()=>{if(!a)return;const F=a.getCurrentInteraction();F?(console.log("🔄 SessionView: Syncing with existing interaction:",F.methodName),h(F)):h(null)},[a]),R.useEffect(()=>{console.log("🎭 SessionView: Current interaction changed:",(g==null?void 0:g.methodName)||"none","mode:",(g==null?void 0:g.presentationMode)||"none")},[g]),R.useEffect(()=>{var F,te,j;console.log("📱 SessionView: Display type changed to:",c),console.log("📱 SessionView: Current session state during display change:",{sessionStarted:n,effectiveAgentActive:E,hasSession:!!((F=a==null?void 0:a.getCurrentSession)!=null&&F.call(a)),sessionId:(j=(te=a==null?void 0:a.getCurrentSession)==null?void 0:te.call(a))==null?void 0:j.id})},[c,n,E,a]),R.useEffect(()=>{console.log("💬 SessionView: Chat open state changed:",d)},[d]),R.useEffect(()=>{g&&d&&(console.log("🎭 SessionView: Interactive UI appeared, closing chat"),u(!1))},[g,d]),iD(),R.useEffect(()=>{w.current&&d&&y.length>0&&(console.log("📜 SessionView: Auto-scrolling to latest message, count:",y.length),setTimeout(()=>{if(w.current){let F=w.current.parentElement;for(;F&&F.scrollHeight<=F.clientHeight;)F=F.parentElement;F?(console.log("📜 SessionView: Scrolling container found, scrolling to bottom"),F.scrollTo({top:F.scrollHeight,behavior:"smooth"})):(console.log("📜 SessionView: Using fallback scroll method"),w.current.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}))}},100))},[y.length,d]),R.useEffect(()=>{var j,q;console.log("📝 SessionView: Messages updated, count:",y.length),y.length>0&&console.log("📝 SessionView: Latest messages:",y.slice(-3).map(ee=>{var G,D,$,Q,W,ce,z;return{id:ee.id,message:ee.message,timestamp:ee.timestamp,from:((G=ee.from)==null?void 0:G.name)||((D=ee.from)==null?void 0:D.identity),fromType:ee.from===void 0?"unknown":"participant",isLocal:(($=ee.from)==null?void 0:$.identity)===((ce=(W=(Q=a==null?void 0:a.getCurrentSession)==null?void 0:Q.call(a))==null?void 0:W.localParticipant)==null?void 0:ce.identity),messageLength:((z=ee.message)==null?void 0:z.length)||0}}));const F=((j=a==null?void 0:a.getTranscriptions)==null?void 0:j.call(a))||[],te=((q=a==null?void 0:a.getChatMessages)==null?void 0:q.call(a))||[];console.log("📝 SessionView: Raw transcriptions count:",F.length),console.log("📝 SessionView: Raw chat messages count:",te.length)},[y.length,y,a]),R.useEffect(()=>{console.log("💬 SessionView: Chat state changed:",{chatOpen:d,messagesCount:y.length,displayType:c,hasMessages:y.length>0})},[d,y.length,c]);async function P(F){await b(F)}const _=R.useCallback(F=>{console.log("📝 SessionView: Adding local message for voice session context:",F)},[]),k=R.useCallback(async F=>{try{a&&typeof a.sendAttachments=="function"&&(await a.sendAttachments(F),console.log("📎 SessionView: Attachments sent successfully:",F.map(te=>te.name)))}catch(te){console.error("❌ SessionView: Failed to send attachments:",te)}},[a]),I=R.useCallback(()=>{try{console.log("📞 SessionView: Ending call..."),console.log("📞 SessionView: Current state before ending:",{sessionStarted:n,effectiveAgentActive:E,chatOpen:d,currentInteraction:g==null?void 0:g.methodName,hasOnBack:!!l}),g&&(console.log("🎭 SessionView: Dismissing current interaction:",g.methodName),h(null),a&&typeof a.dismissCurrentInteraction=="function"&&a.dismissCurrentInteraction()),u(!1),p(!1),console.log("✅ SessionView: Local state reset"),a&&typeof a.endSession=="function"&&(a.endSession(),console.log("✅ SessionView: Session ended via client.endSession()")),a&&typeof a.disconnect=="function"&&(a.disconnect(),console.log("✅ SessionView: Client disconnected")),l?(console.log("🔄 SessionView: Calling onBack to return to welcome..."),setTimeout(()=>{l(),console.log("✅ SessionView: onBack called")},150)):console.warn("⚠️ SessionView: No onBack function provided - cannot return to welcome"),console.log("🏁 SessionView: Call ended and cleanup completed")}catch(F){console.error("❌ SessionView: Failed to end call:",F),h(null),u(!1),p(!1),l&&(console.log("🔄 SessionView: Error occurred, still calling onBack..."),l())}},[a,l,g,n,E,d]);R.useEffect(()=>(console.log("🔄 SessionView: Component mounted/props changed:",{sessionStarted:n,disabled:t,participantName:r,displayType:c,hasOnBack:!!l,hasClient:!!a}),()=>{console.log("🧹 SessionView: Component unmounting or props changing")}),[n,t,r,c,l,a]),R.useEffect(()=>{console.log("🔗 SessionView: onBack prop:",{hasOnBack:!!l,onBackType:typeof l})},[l]),R.useEffect(()=>{var te,j;const F=((j=(te=a==null?void 0:a.getCurrentSession)==null?void 0:te.call(a))==null?void 0:j.id)||null;C.current&&!F&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:C.current,currentSession:F,displayType:c,sessionStarted:n,effectiveAgentActive:E}),C.current=F},[a,c,n,E]);const N=fe("w-full flex flex-col items-center justify-center",c==="fullscreen"?"w-full max-w-none mx-0 h-full":"w-full mx-auto",x.main,c==="fullscreen"?"max-w-none":"","overflow-hidden","h-full"),K=l&&(c==="popup"||c==="fullscreen");return m.jsxs("main",{ref:i,inert:t,className:fe(N,"relative"),style:{minHeight:0},children:[K&&m.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((J=x.chatHeader)==null?void 0:J.container)||"border-gray-200"}`,children:m.jsx("div",{className:"flex items-center",children:m.jsxs("div",{children:[m.jsx("h3",{className:`font-semibold ${x.text.primary}`,children:"Voice Session"}),m.jsx("p",{className:`text-sm ${x.text.muted}`,children:r})]})})}),m.jsxs("div",{className:"w-full flex-1 flex flex-col items-center px-0 min-h-0 overflow-hidden",children:[!E&&m.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[m.jsx(xe.div,{animate:{rotate:360,scale:[1,1.1,1]},transition:{rotate:{duration:2,repeat:1/0,ease:"linear"},scale:{duration:1,repeat:1/0,ease:"easeInOut"}},className:"w-12 h-12 mb-4",children:m.jsx(Nf,{className:x.spinner,weight:"bold"})}),m.jsx(xe.span,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`text-sm opacity-80 ${x.text.muted} text-center max-w-xs`,children:f?"Agent is taking longer than expected...":s}),m.jsx(xe.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${x.text.muted} mt-2 text-center opacity-60`,children:f?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),f&&l&&m.jsx(xe.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5},onClick:l,className:`mt-4 px-4 py-2 rounded-lg ${((se=x.chatHeader)==null?void 0:se.backButton)||"bg-gray-100 hover:bg-gray-200"} transition-colors`,children:"Go Back"})]}),E&&m.jsxs(m.Fragment,{children:[d&&m.jsxs("div",{className:fe("absolute inset-0 w-full h-full flex flex-col transition-[opacity,translate] duration-300 ease-out z-10",o==="light"?"bg-white":"bg-gray-900/95 backdrop-blur-sm",d?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:[m.jsxs("div",{className:fe("flex-shrink-0 px-4 py-3 border-b",c==="fullscreen"?"px-8":"px-5",((ie=x.chatHeader)==null?void 0:ie.container)||"border-gray-200 dark:border-gray-700"),children:[m.jsx("h3",{className:fe("font-semibold text-lg",((X=x.text)==null?void 0:X.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),m.jsxs("p",{className:fe("text-sm",((O=x.text)==null?void 0:O.muted)||"text-gray-600 dark:text-gray-400"),children:[y.length," messages"]})]}),m.jsx("div",{className:fe("flex-1 flex flex-col min-h-0",c==="fullscreen"?"px-8":"px-5"),children:m.jsx(u6,{className:"flex-1 flex flex-col min-h-0 h-full",children:m.jsxs("div",{className:`flex-1 flex flex-col h-full ${fe("overflow-y-auto scrollbar-hide py-4")}`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",paddingBottom:"120px"},children:[y.length===0&&m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsxs("div",{className:"text-center",children:[m.jsx("p",{className:fe("text-lg font-medium mb-2",((oe=x.text)==null?void 0:oe.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),m.jsx("p",{className:fe("text-sm",((L=x.text)==null?void 0:L.muted)||"text-gray-600 dark:text-gray-400"),children:"Your conversation will appear here"})]})}),y.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"flex-1 min-h-4"}),m.jsx("div",{ref:w,className:"space-y-4 relative whitespace-pre-wrap z-0",children:m.jsx(Vr,{mode:"popLayout",children:y.map((F,te)=>m.jsx(xe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:te*.02},layout:!0,children:m.jsx(l6,{participantName:r,entry:F})},F.id||`message-${te}`))})})]})]})})})]}),!d&&m.jsxs("div",{className:fe("flex-1 flex flex-col items-center w-full h-full min-h-0",(g==null?void 0:g.presentationMode)==="embedded"?"justify-end":"justify-center"),children:[m.jsx(xe.div,{className:"w-full flex justify-center",animate:{y:(g==null?void 0:g.presentationMode)==="embedded"?-8:0},transition:{duration:.3,ease:"easeOut"},children:m.jsx(b6,{chatOpen:d})}),m.jsx(Vr,{mode:"wait",children:g&&g.presentationMode==="embedded"&&m.jsx(xe.div,{initial:{opacity:0,y:20,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:20,height:0},transition:{duration:.3,ease:"easeOut"},className:fe("w-full relative mt-4 flex justify-center",c==="fullscreen"?"max-w-4xl":"max-w-md"),children:m.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl border border-white/20 shadow-lg overflow-hidden",children:m.jsx(Qr,{interaction:g,theme:o,onDismiss:()=>{var F;return(F=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:F.call(a)},client:a,addLocalMessage:_})})},`embedded-${g.methodName}`)})]})]})]}),m.jsx(Vr,{mode:"wait",children:g&&g.presentationMode!=="embedded"&&!d&&m.jsx("div",{className:fe("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",c==="fullscreen"?"bg-black/70":"bg-black/50"),children:m.jsx(xe.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:fe("relative w-full overflow-hidden",c==="fullscreen"?"max-w-2xl mx-8 max-h-[85vh]":"max-w-lg mx-4 max-h-[80vh]","bg-white dark:bg-gray-900 rounded-2xl shadow-2xl","border border-gray-200 dark:border-gray-700"),children:m.jsx(Qr,{interaction:g,theme:o,onDismiss:()=>{var F;return(F=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:F.call(a)},client:a,addLocalMessage:_})},`modal-${g.methodName}`)})}),m.jsx(xe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"absolute bottom-0 left-0 right-0 flex-shrink-0 w-full z-20",children:m.jsx(Rj,{capabilities:e,onSendMessage:P,onSendAttachments:k,onEndCall:I,onChatOpenChange:u,disabled:t,theme:o,client:a,sessionStarted:n})})]})};function Rj({capabilities:t,onSendMessage:e,onSendAttachments:n,onEndCall:i,onChatOpenChange:r,disabled:s=!1,theme:o,client:a,sessionStarted:c=!1}){const[l,d]=R.useState(!1),u=R.useRef(null),f=R.useRef(null);R.useEffect(()=>{const w=()=>{const C=navigator.userAgent.toLowerCase(),x=["android","iphone","ipad","mobile","tablet"].some(P=>C.includes(P)),T="ontouchstart"in window||navigator.maxTouchPoints>0,E=window.innerWidth<=768;d(x||T&&E)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const p=w=>{const C=w.target.files;if(C&&C.length>0){const x=Array.from(C).filter(T=>T.type.startsWith("image/"));if(x.length===0){console.warn("No valid image files selected");return}n&&n(x),u.current&&(u.current.value="")}},g=w=>{const C=w.target.files;if(C&&C.length>0){const S=C[0];S.type.startsWith("image/")&&n&&n([S]),f.current&&(f.current.value="")}},h=()=>{!s&&u.current&&u.current.click()},y=()=>{!s&&l&&f.current&&f.current.click()},b=()=>{console.log("🔴 VoiceControlPanel: End call button clicked"),console.log("🔴 VoiceControlPanel: Current state:",{disabled:s,sessionStarted:c,hasOnEndCall:!!i}),i?i():console.warn("⚠️ VoiceControlPanel: No onEndCall function provided")};return m.jsx("div",{className:fe("px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg",o==="light"?"bg-white/95 border-t border-gray-200":"bg-gray-900/95 border-t border-gray-700"),children:m.jsxs("div",{className:"flex items-center justify-between !w-full mx-auto max-w-4xl",children:[m.jsx("input",{ref:u,type:"file",multiple:!0,onChange:p,className:"hidden",accept:"image/*"}),m.jsx("input",{ref:f,type:"file",onChange:g,className:"hidden",accept:"image/*",capture:"environment"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:h,disabled:s,className:fe("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",s?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Attach files",children:m.jsx(kj,{className:"w-5 h-5"})}),l&&m.jsx("button",{onClick:y,disabled:s,className:fe("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",s?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Take photo",children:m.jsx(Ej,{className:"w-5 h-5"})})]}),m.jsx("div",{className:"flex-1 flex justify-center px-4",children:m.jsx(a6,{capabilities:t,onChatOpenChange:r,onSendMessage:e,theme:o,client:a,className:"border-none py-1 rounded-xl max-w-md w-full"})}),m.jsx("div",{className:"flex items-center",children:m.jsx("button",{onClick:b,disabled:s||!c,className:fe("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",s||!c?"opacity-50 cursor-not-allowed":"hover:shadow-md","bg-red-500 hover:bg-red-600 text-white"),title:"End call",children:m.jsx(Tj,{className:"w-5 h-5"})})})]})})}function Aj({onSendMessage:t,onSendAttachments:e,disabled:n,theme:i,onEndChat:r}){const[s,o]=v.useState(""),[a,c]=v.useState(!1),l=v.useRef(null),d=v.useRef(null),[u,f]=v.useState(!1),p=St(i);v.useEffect(()=>{const S=()=>{const x=navigator.userAgent.toLowerCase(),E=["android","iphone","ipad","mobile","tablet"].some(k=>x.includes(k)),P="ontouchstart"in window||navigator.maxTouchPoints>0,_=window.innerWidth<=768;f(E||P&&_)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const g=S=>{S.preventDefault(),s.trim()&&!n&&(t(s.trim()),o(""))},h=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),g(S))},y=S=>{const x=S.target.files;if(x&&x.length>0){const T=Array.from(x),E=T.filter(P=>P.type.startsWith("image/"));if(E.length===0){console.warn("No valid image files selected");return}E.length!==T.length&&console.warn("Some non-image files were filtered out"),console.log("Selected image files:",E),e(E),l.current&&(l.current.value="")}},b=()=>{!n&&l.current&&l.current.click()},w=()=>{!n&&u&&d.current&&d.current.click()},C=S=>{const x=S.target.files;if(x&&x.length>0){const T=x[0];T.type.startsWith("image/")?e([T]):console.warn("Selected file is not an image"),d.current&&(d.current.value="")}};return m.jsx("div",{className:"px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg ",children:m.jsx("form",{onSubmit:g,className:"flex items-center !w-full mx-auto max-w-4xl",children:m.jsxs("div",{className:`flex items-center gap-2 !w-full backdrop-blur-md rounded-full px-3 py-2 shadow-sm hover:shadow-md focus-within:shadow-lg focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-500/50 transition-all duration-200 border ${i==="light"?"bg-white/90 border-gray-200":p.chatInput.container}`,children:[m.jsx(xe.button,{type:"button",onClick:b,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${p.chatInput.attachButton}`,disabled:n,"aria-label":"Attach file",children:m.jsx(z6,{className:"w-4 h-4"})}),u&&m.jsx(xe.button,{type:"button",onClick:w,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${p.chatInput.attachButton}`,disabled:n,"aria-label":"Take photo",children:m.jsx(TS,{className:"w-4 h-4"})}),m.jsx("input",{ref:l,type:"file",multiple:!0,onChange:y,className:"hidden",accept:"image/*"}),m.jsx("input",{ref:d,type:"file",onChange:C,className:"hidden",accept:"image/*",capture:"environment"}),m.jsx("textarea",{value:s,onChange:S=>o(S.target.value),onKeyDown:h,onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:"Type your message...",disabled:n,className:`flex-1 px-2 py-1 bg-transparent resize-none min-h-[32px] max-h-20 focus:outline-none text-sm border-0 ${p.chatInput.textarea}`,rows:1,style:{height:"auto",minHeight:"32px"},onInput:S=>{const x=S.target;x.style.height="auto",x.style.height=`${Math.min(x.scrollHeight,80)}px`}}),m.jsx(xe.button,{type:"submit",disabled:n||!s.trim(),whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${s.trim()&&!n?p.chatInput.sendButton:i==="light"?"bg-gray-200 text-gray-400 cursor-not-allowed opacity-70":"bg-gray-600/50 text-gray-500 cursor-not-allowed opacity-50"}`,"aria-label":"Send message",children:m.jsx(K6,{className:"w-4 h-4"})}),r&&m.jsx(xe.button,{type:"button",onClick:r,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${p.chatInput.endButton}`,"aria-label":"End chat",children:m.jsx(ES,{className:"w-4 h-4"})})]})})})}function Ij({text:t,isComplete:e,isRealTimeStream:n=!1,speed:i=50}){const[r,s]=v.useState(""),[o,a]=v.useState(0);return v.useEffect(()=>{if(n){s(t);return}if(e){s(t);return}if(o<t.length){const c=setTimeout(()=>{s(t.slice(0,o+1)),a(o+1)},i);return()=>clearTimeout(c)}},[t,o,e,i,n]),v.useEffect(()=>{n||(a(0),s(""))},[t,n]),m.jsxs("span",{className:"relative",children:[m.jsx("span",{className:"inline-block",children:r}),!e&&m.jsx("span",{className:"inline-flex items-center ml-1",children:[0,1,2].map(c=>m.jsx(xe.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:c*.2,ease:"easeInOut"}},c))})]})}function Mj({message:t,theme:e,isOwn:n,isStreaming:i=!1}){var o,a;const r=St(e),s=t.sender.name?t.sender.name.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2):"U";return m.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"} mb-4 px-1`,children:m.jsxs("div",{className:`relative group ${n?"flex-row-reverse":"flex-row"} flex items-end gap-3 max-w-[85%]`,children:[m.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${n?e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700":e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:s}),m.jsxs("div",{className:`
184
296
  relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover
185
297
  ${n?`${r.chatMessage.own} rounded-br-md`:`${r.chatMessage.other} rounded-bl-md`}
186
- ${s?"shimmer":""}
298
+ ${i?"shimmer":""}
187
299
  transition-all duration-200 group-hover:scale-[1.02]
188
- `,style:{wordWrap:"break-word",overflowWrap:"break-word"},children:[c.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-sm",children:((o=e.metadata)==null?void 0:o.type)==="attachment"?c.jsx(p2,{message:e,theme:t,isOwn:n}):s&&!n?c.jsx(u2,{text:e.content,isComplete:!s,isRealTimeStream:((a=e.metadata)==null?void 0:a.streaming)===!0,speed:35}):e.content}),c.jsx("div",{className:"text-xs",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})})}function h2(e,t){return e.startsWith("image/")?Ob:e.startsWith("video/")?s2:e.startsWith("audio/")?Wb:e.includes("zip")||e.includes("rar")||e.includes("archive")?Mb:Lb}function m2(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]}function p2({message:e,theme:t,isOwn:n}){const s=Ve(t),r=e.metadata,i=(r==null?void 0:r.fileName)||"Unknown file",o=(r==null?void 0:r.fileSize)||0,a=(r==null?void 0:r.mimeType)||"application/octet-stream",l=r==null?void 0:r.downloading,d=r==null?void 0:r.uploading,u=(r==null?void 0:r.downloadProgress)||0,h=(r==null?void 0:r.uploadProgress)||0,m=r==null?void 0:r.downloadUrl,g=r==null?void 0:r.file,x=h2(a),p=l||d,v=l?u:h,b=l?"Downloading...":d?"Uploading...":"Complete",[y,w]=f.useState(null);f.useEffect(()=>{if(m)w(m);else if(g&&a.startsWith("image/")){const A=URL.createObjectURL(g);return w(A),()=>URL.revokeObjectURL(A)}else w(null)},[m,g,a]);const S=()=>{if(m){const A=document.createElement("a");A.href=m,A.download=i,A.click()}},T=a.startsWith("image/")&&y;return c.jsxs("div",{className:"flex flex-col gap-2 max-w-sm",children:[T&&c.jsxs("div",{className:"relative rounded-lg overflow-hidden",children:[c.jsx("img",{src:y,alt:i,className:"max-w-full h-auto max-h-48 object-cover rounded-lg cursor-pointer",onClick:S}),c.jsx("div",{className:"absolute inset-0 bg-black/0 hover:bg-black/10 transition-colors duration-200 cursor-pointer"})]}),c.jsxs("div",{className:`
300
+ `,style:{wordWrap:"break-word",overflowWrap:"break-word"},children:[m.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-sm",children:((o=t.metadata)==null?void 0:o.type)==="attachment"?m.jsx(Oj,{message:t,theme:e,isOwn:n}):i&&!n?m.jsx(Ij,{text:t.content,isComplete:!i,isRealTimeStream:((a=t.metadata)==null?void 0:a.streaming)===!0,speed:35}):t.content}),m.jsx("div",{className:"text-xs",children:t.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})})}function _j(t,e){return t.startsWith("image/")?O6:t.startsWith("video/")?Q6:t.startsWith("audio/")?$6:t.includes("zip")||t.includes("rar")||t.includes("archive")?E6:_6}function Nj(t){if(t===0)return"0 Bytes";const e=1024,n=["Bytes","KB","MB","GB"],i=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,i)).toFixed(2))+" "+n[i]}function Oj({message:t,theme:e,isOwn:n}){const i=St(e),r=t.metadata,s=(r==null?void 0:r.fileName)||"Unknown file",o=(r==null?void 0:r.fileSize)||0,a=(r==null?void 0:r.mimeType)||"application/octet-stream",c=r==null?void 0:r.downloading,l=r==null?void 0:r.uploading,d=(r==null?void 0:r.downloadProgress)||0,u=(r==null?void 0:r.uploadProgress)||0,f=r==null?void 0:r.downloadUrl,p=r==null?void 0:r.file,g=_j(a),h=c||l,y=c?d:u,b=c?"Downloading...":l?"Uploading...":"Complete",[w,C]=v.useState(null);v.useEffect(()=>{if(f)C(f);else if(p&&a.startsWith("image/")){const E=URL.createObjectURL(p);return C(E),()=>URL.revokeObjectURL(E)}else C(null)},[f,p,a]);const S=()=>{if(f){const E=document.createElement("a");E.href=f,E.download=s,E.click()}},T=a.startsWith("image/")&&w;return m.jsxs("div",{className:"flex flex-col gap-2 max-w-sm",children:[T&&m.jsxs("div",{className:"relative rounded-lg overflow-hidden",children:[m.jsx("img",{src:w,alt:s,className:"max-w-full h-auto max-h-48 object-cover rounded-lg cursor-pointer",onClick:S}),m.jsx("div",{className:"absolute inset-0 bg-black/0 hover:bg-black/10 transition-colors duration-200 cursor-pointer"})]}),m.jsxs("div",{className:`
189
301
  flex items-center gap-3 p-3 rounded-lg border transition-all duration-200
190
- ${t==="light"?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-gray-800/50 border-gray-700 hover:bg-gray-700/50"}
191
- `,children:[c.jsx("div",{className:`
302
+ ${e==="light"?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-gray-800/50 border-gray-700 hover:bg-gray-700/50"}
303
+ `,children:[m.jsx("div",{className:`
192
304
  p-2 rounded-lg flex-shrink-0
193
- ${t==="light"?"bg-blue-100 text-blue-600":"bg-blue-900/50 text-blue-400"}
194
- `,children:c.jsx(x,{className:"w-5 h-5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:`font-medium text-sm truncate ${s.text.primary}`,children:i}),c.jsxs("div",{className:`text-xs ${s.text.muted}`,children:[o>0&&m2(o),p&&c.jsxs(c.Fragment,{children:[o>0&&" • ",b," ",Math.round(v*100),"%"]})]}),p&&c.jsx("div",{className:`
305
+ ${e==="light"?"bg-blue-100 text-blue-600":"bg-blue-900/50 text-blue-400"}
306
+ `,children:m.jsx(g,{className:"w-5 h-5"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:`font-medium text-sm truncate ${i.text.primary}`,children:s}),m.jsxs("div",{className:`text-xs ${i.text.muted}`,children:[o>0&&Nj(o),h&&m.jsxs(m.Fragment,{children:[o>0&&" • ",b," ",Math.round(y*100),"%"]})]}),h&&m.jsx("div",{className:`
195
307
  w-full h-1 rounded-full mt-1 overflow-hidden
196
- ${t==="light"?"bg-gray-200":"bg-gray-700"}
197
- `,children:c.jsx(ce.div,{className:`h-full ${t==="light"?"bg-blue-500":"bg-blue-400"}`,initial:{width:0},animate:{width:`${v*100}%`},transition:{duration:.3}})})]}),m&&!p&&c.jsx(ce.button,{onClick:S,whileHover:{scale:1.05},whileTap:{scale:.95},className:`
308
+ ${e==="light"?"bg-gray-200":"bg-gray-700"}
309
+ `,children:m.jsx(xe.div,{className:`h-full ${e==="light"?"bg-blue-500":"bg-blue-400"}`,initial:{width:0},animate:{width:`${y*100}%`},transition:{duration:.3}})})]}),f&&!h&&m.jsx(xe.button,{onClick:S,whileHover:{scale:1.05},whileTap:{scale:.95},className:`
198
310
  p-2 rounded-lg transition-colors duration-200
199
- ${t==="light"?"hover:bg-gray-200 text-gray-600 hover:text-gray-800":"hover:bg-gray-600 text-gray-400 hover:text-gray-200"}
200
- `,"aria-label":"Download file",children:c.jsx(Ib,{className:"w-4 h-4"})})]})]})}function g2(){return c.jsxs("div",{className:"max-w-xs mx-auto bg-green-50 border border-green-200 rounded-lg shadow p-3 flex flex-col items-center",children:[c.jsx("div",{className:"text-2xl mb-2",children:"✅"}),c.jsx("div",{className:"text-green-700 font-semibold text-sm mb-1",children:"Success!"}),c.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"Your action was completed successfully."})]})}function x2(){return c.jsxs("div",{className:"max-w-xs mx-auto bg-yellow-50 border border-yellow-200 rounded-lg shadow p-3 flex flex-col items-center",children:[c.jsx("div",{className:"text-2xl mb-2",children:"⏰"}),c.jsx("div",{className:"text-yellow-700 font-semibold text-sm mb-1",children:"Interaction timed out"}),c.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"No response was provided in time."})]})}function y2({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:r="widget",onEndChat:i}){const[o,a]=f.useState(()=>{if(e&&typeof e.getChatMessages=="function"){const M=e.getChatMessages();return console.log("🔄 ChatView: Initializing with existing messages:",M.length),M}return[]}),[l,d]=f.useState(!0),[u,h]=f.useState(()=>{const M=e&&typeof e.getCurrentSession=="function"&&!!e.getCurrentSession(),H=e&&typeof e.getChatMessages=="function"&&e.getChatMessages().length>0;return!M&&!H}),[m,g]=f.useState(new Set),[x,p]=f.useState([]),[v,b]=f.useState(!1),[y,w]=f.useState(!1),[S,k]=f.useState(()=>{const M=e.getCurrentInteraction();return console.log("ChatView: Initializing with existing interaction:",(M==null?void 0:M.methodName)||"none"),M}),T=f.useRef(null),A=Ve(t);f.useEffect(()=>{const M=()=>{const H=navigator.userAgent.toLowerCase(),U=["android","iphone","ipad","mobile","tablet"].some(D=>H.includes(D)),N="ontouchstart"in window||navigator.maxTouchPoints>0,L=window.innerWidth<=768,W=U||N&&L;b(W),W&&r==="widget"&&w(!0)};return M(),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[r]),f.useEffect(()=>(y&&v&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(console.log)),()=>{y&&v&&(document.body.style.overflow="unset",document.body.style.position="unset",document.body.style.width="unset",document.body.style.height="unset",document.fullscreenElement&&document.exitFullscreen().catch(console.log))}),[y,v]);const j=e.getCurrentAgentInfo(),V=(j==null?void 0:j.name)||"AI Assistant",I=V.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2),$=f.useCallback(M=>{const H={id:`local_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:M,timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{isLocal:!0}};a(q=>(console.log("ChatView: Adding local message:",H.id),[...q,H]))},[]);f.useEffect(()=>{var M,H,q,U,N;console.log("💬 ChatView loading state:",{isLoading:u,hasActiveSession:!!((M=e==null?void 0:e.getCurrentSession)!=null&&M.call(e)),messagesCount:o.length,sessionId:(q=(H=e==null?void 0:e.getCurrentSession)==null?void 0:H.call(e))==null?void 0:q.id,hasStoredMessages:!!((N=(U=e==null?void 0:e.getChatMessages)==null?void 0:U.call(e))!=null&&N.length),isMobile:v,isFullscreen:y})},[u,o.length,e,v,y]);const F=f.useCallback((M=!1)=>{T.current&&(M?T.current.scrollIntoView({behavior:"auto"}):T.current.scrollIntoView({behavior:"smooth"}))},[]);f.useEffect(()=>{F(!0);const M=setTimeout(()=>{F(!1)},10);return()=>clearTimeout(M)},[o.length,F]),f.useEffect(()=>{if(S){F(!0);const M=setTimeout(()=>{F(!1)},50);return()=>clearTimeout(M)}},[S,F]),f.useEffect(()=>{const M=U=>{if(console.log("ChatView: Received message:",U),h(!1),S&&U.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",S.methodName),p(N=>[...N,U]);return}U.sender.type==="agent"&&d(!1),a(N=>{var W;if(N.some(D=>D.id===U.id))return console.log("ChatView: Message already exists, skipping:",U.id),N;if(console.log("ChatView: Adding new message:",U.id),U.sender.type==="agent"&&(g(D=>new Set(D).add(U.id)),!((W=U.metadata)!=null&&W.streaming))){const D=U.content.length*35+1e3;setTimeout(()=>{g(ne=>{const te=new Set(ne);return te.delete(U.id),te})},D)}return[...N,U]}),setTimeout(()=>F(!0),0)},H=U=>{var N;if(console.log("ChatView: Updated message:",U),S&&U.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",S.methodName),p(L=>{const W=L.findIndex(D=>D.id===U.id);if(W>=0){const D=[...L];return D[W]=U,D}else return[...L,U]});return}a(L=>L.map(W=>W.id===U.id?{...U}:W)),setTimeout(()=>F(!0),0),(N=U.metadata)!=null&&N.streaming||g(L=>{const W=new Set(L);return W.delete(U.id),W})},q=U=>{console.log("ChatView: Sent message:",U),h(!1),a(N=>N.some(W=>W.id===U.id)?(console.log("ChatView: Sent message already exists, skipping:",U.id),N):(console.log("ChatView: Adding sent message:",U.id),[...N,U])),setTimeout(()=>F(!0),0)};return e.on("chat.message.received",M),e.on("chat.message.updated",H),e.on("chat.message.sent",q),()=>{e.off("chat.message.received",M),e.off("chat.message.updated",H),e.off("chat.message.sent",q)}},[e,S]),f.useEffect(()=>{const M=N=>{console.log("ChatView: RPC interaction started:",N);const L=e.getCurrentInteraction();console.log("ChatView: Got interaction from client:",L==null?void 0:L.methodName),k(L),d(!1),F(!0),setTimeout(()=>{F(!1)},100)},H=N=>{if(console.log("ChatView: RPC interaction completed:",N),k(null),x.length>0&&(console.log("ChatView: Processing",x.length,"queued messages"),a(L=>{const W=[...L];return x.forEach(D=>{var te;if(!W.some(de=>de.id===D.id)&&(console.log("ChatView: Adding queued message:",D.id),W.push(D),D.sender.type==="agent"&&(g(de=>new Set(de).add(D.id)),!((te=D.metadata)!=null&&te.streaming)))){const de=D.content.length*35+1e3;setTimeout(()=>{g(me=>{const Ae=new Set(me);return Ae.delete(D.id),Ae})},de)}}),W}),p([]),setTimeout(()=>F(!0),0)),N&&N.response&&N.response.success){let L=null;N.response.successView?L=N.response.successView:N.successView&&(L=N.successView),a(W=>{const D=[...W].reverse().findIndex(me=>me.sender.type==="participant");let ne=W.length;D!==-1&&(ne=W.length-D);const te={id:`success_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{type:"successView",view:L||c.jsx(g2,{})}};e&&typeof e.addChatMessage=="function"&&e.addChatMessage(te);const de=[...W];return de.splice(ne,0,te),de})}},q=async N=>{S&&(console.log("ChatView: Dismissing active interaction due to timeout"),e.dismissCurrentInteraction()),k(null),x.length>0&&(console.log("ChatView: Processing",x.length,"queued messages after timeout"),a(W=>{const D=[...W];return x.forEach(ne=>{var de;if(!D.some(me=>me.id===ne.id)&&(D.push(ne),ne.sender.type==="agent"&&(g(me=>new Set(me).add(ne.id)),!((de=ne.metadata)!=null&&de.streaming)))){const me=ne.content.length*35+1e3;setTimeout(()=>{g(Ae=>{const De=new Set(Ae);return De.delete(ne.id),De})},me)}}),D}),p([]),setTimeout(()=>F(!0),0));let L=null;N&&N.response&&N.response.timeoutView?L=N.response.timeoutView:N&&N.timeoutView&&(L=N.timeoutView),a(W=>{const D={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:V,type:"agent"},metadata:{type:"timeoutView",view:L||c.jsx(x2,{})}};return e&&typeof e.addChatMessage=="function"&&e.addChatMessage(D),[...W,D]}),setTimeout(()=>{e.getCurrentInteraction()||k(null)},100)},U=async N=>{console.log("ChatView: RPC interaction dismissed:",N),console.log("ChatView: Current interaction before dismiss:",S==null?void 0:S.methodName),k(null),x.length>0&&(console.log("ChatView: Processing",x.length,"queued messages after dismissal"),a(L=>{const W=[...L];return x.forEach(D=>{var te;if(!W.some(de=>de.id===D.id)&&(W.push(D),D.sender.type==="agent"&&(g(de=>new Set(de).add(D.id)),!((te=D.metadata)!=null&&te.streaming)))){const de=D.content.length*35+1e3;setTimeout(()=>{g(me=>{const Ae=new Set(me);return Ae.delete(D.id),Ae})},de)}}),W}),p([]),setTimeout(()=>F(!0),0)),setTimeout(()=>{const L=e.getCurrentInteraction();console.log("ChatView: Latest interaction from client after dismiss:",(L==null?void 0:L.methodName)||"null"),L===null&&k(null)},50),console.log("ChatView: Set currentInteraction to null after dismiss")};return e.on("rpc.interaction.started",M),e.on("rpc.interaction.completed",H),e.on("rpc.interaction.timeout",q),e.on("rpc.interaction.dismissed",U),()=>{e.off("rpc.interaction.started",M),e.off("rpc.interaction.completed",H),e.off("rpc.interaction.timeout",q),e.off("rpc.interaction.dismissed",U)}},[e]),f.useEffect(()=>{const M=()=>{if(console.log("ChatView: Agent is thinking"),S){console.log("ChatView: Suppressing thinking indicator due to active interaction:",S.methodName);return}d(!0)},H=()=>{console.log("ChatView: Agent is speaking"),d(!1)};return e.on("agent.thinking",M),e.on("agent.speaking",H),()=>{e.off("agent.thinking",M),e.off("agent.speaking",H)}},[e,S]),f.useEffect(()=>{const M=e.getCurrentInteraction();M?(console.log("ChatView: Restoring interaction state on mount/client change:",M.methodName),k(M)):k(null)},[e]),f.useEffect(()=>{console.log("ChatView: Display type changed to:",r,"Current interaction:",(S==null?void 0:S.methodName)||"none")},[r,S]);const se=async M=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user message send"),e.dismissCurrentInteraction(),k(null)),await e.sendChatMessage(M)}catch(H){console.error("Failed to send message:",H)}},Z=async M=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user attachment send"),e.dismissCurrentInteraction(),k(null)),await e.sendAttachments(M),console.log("Attachments sent successfully:",M.map(H=>H.name))}catch(H){console.error("Failed to send attachments:",H)}},[ee,G]=f.useState([]);if(f.useEffect(()=>{const M=H=>{G(Array.isArray(H)?H:["tes","hello how are you","algebra make me learn that ","what is the meaning of life"])};return e.on("suggested.response",M),()=>{e.off("suggested.response",M)}},[e]),u){const M=y&&v?"fixed inset-0 z-[9999] flex flex-col items-center justify-center h-screen w-screen bg-black":"flex w-full flex-col items-center justify-center h-full p-8";return c.jsxs("div",{className:M,children:[c.jsx("div",{className:`${A.spinner} w-12 h-12 mb-6`}),c.jsxs("p",{className:`text-sm text-center ${y&&v?"text-white":""}`,children:["Connecting to ",V,"..."]})]})}const O=y&&v?"fullscreen":r,P=O==="fullscreen"?y&&v?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"flex flex-col h-full w-full max-w-none":"flex flex-col h-full w-full backdrop-blur-sm",B=O==="fullscreen"?y&&v?"flex items-center w-full justify-between px-4 pt-3 pb-3 bg-black/80 text-white border-b border-gray-700":`flex items-center w-full justify-between px-6 pt-5 pb-4 border-b ${A.chatHeader.container}`:`flex items-center w-full justify-between px-4 pt-5 pb-4 border-b ${A.chatHeader.container}`,X=O==="fullscreen"?y&&v?"flex-1 overflow-y-auto scrollbar-hide p-4 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide p-6 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide w-full p-4 chat-scrollable min-h-0",_="flex-shrink-0 !w-full",re=()=>{w(!1),n&&n()};return c.jsxs("div",{className:P,children:[c.jsx("div",{className:B,children:c.jsxs("div",{className:"flex items-center gap-2",children:[y&&v&&c.jsx(ce.button,{onClick:re,whileHover:{scale:1.05},whileTap:{scale:.95},className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors mr-2","aria-label":"Exit fullscreen",children:"✕"}),c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold text-base leading-tight ${y&&v?"text-white":A.text.primary}`,children:V}),c.jsxs("p",{className:`text-xs flex items-center gap-1.5 mt-0.5 ${y&&v?"text-gray-300":A.text.muted}`,children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"}),"Online"]})]})]})}),c.jsxs("div",{className:`${X} flex flex-col`,style:{scrollBehavior:"smooth",scrollbarWidth:"none"},children:[" ",o.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center py-12",children:[c.jsx(ce.div,{transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl mb-6 shadow-xl",children:I}),c.jsxs("p",{className:`text-base mb-2 ${y&&v?"text-white":A.text.secondary}`,children:[V," is joining..."]}),c.jsx("p",{className:`text-xs ${y&&v?"text-gray-300":A.text.muted}`,children:"Your conversation will begin shortly"})]}):c.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-3 py-4 flex-1 flex flex-col justify-end",children:c.jsxs("div",{className:"space-y-3",children:[o.map((M,H)=>{var q,U;return c.jsx("div",{children:((q=M.metadata)==null?void 0:q.type)==="successView"?c.jsx("div",{className:"flex w-full justify-end mb-4 px-1",children:c.jsxs("div",{className:"relative group flex-row-reverse flex items-end gap-3 max-w-[85%]",children:[c.jsx(ce.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:"Y"}),c.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-br-md message-hover border-gray-200 dark:border-gray-700 ${A.chatMessage.own}`,children:[M.metadata.view,c.jsx("div",{className:`text-xs ${A.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:M.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):((U=M.metadata)==null?void 0:U.type)==="timeoutView"?c.jsx("div",{className:"flex w-full justify-start mb-4 px-1",children:c.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[c.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:I}),c.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${A.chatMessage.other}`,children:[M.metadata.view,c.jsx("div",{className:`text-xs ${A.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:M.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):c.jsx(f2,{message:M,theme:t,isOwn:M.sender.type==="participant",isStreaming:m.has(M.id)})},M.id)}),l&&!S&&c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:o.length*.1},className:"flex w-full justify-start mb-4 px-1",children:c.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[c.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:I}),c.jsx("div",{className:`relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover ${A.chatMessage.other} rounded-bl-md transition-all duration-200 group-hover:scale-[1.02]`,style:{wordWrap:"break-word",overflowWrap:"break-word",minWidth:48},children:c.jsx("span",{className:"inline-flex items-center",children:[0,1,2].map(M=>c.jsx(ce.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:M*.2,ease:"easeInOut"}},M))})})]})}),S&&S.presentationMode==="embedded"&&c.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[c.jsx(ce.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:I}),c.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${A.chatMessage.other}`,children:[c.jsx(xn,{interaction:S,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:$},S.methodName),c.jsx(ce.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:`text-xs ${A.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),c.jsx("div",{ref:T})]})})]}),ee.length>0&&c.jsx("div",{className:"w-full flex overflow-x-auto gap-2 px-4 py-2 mb-1 scrollbar-hide",children:ee.map((M,H)=>{var q;return c.jsx("button",{className:`whitespace-nowrap px-3 py-1 rounded-full border shadow-sm flex-shrink-0 transition-all duration-150 font-medium text-sm focus:outline-none focus:ring-2 focus:ring-blue-400/40
201
- ${t==="light"?"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900":t==="dark"?"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white":((q=A.suggestedResponse)==null?void 0:q.container)||"bg-gradient-to-br from-blue-500 to-purple-600 text-white border-blue-400 hover:from-blue-600 hover:to-purple-700"}
202
- `,style:{boxShadow:t==="vox"?"0 2px 8px 0 rgba(80,60,200,0.10)":void 0,borderWidth:1},onClick:()=>{se(M),G([])},children:M},M+H)})}),S&&S.presentationMode!=="embedded"&&c.jsx(xn,{interaction:S,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:$},S.methodName),c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:_,children:c.jsx(d2,{onSendMessage:se,onSendAttachments:Z,disabled:s,theme:t,onEndChat:i})})]})}function v2({onToggleCamera:e,onToggleScreenShare:t,onEndCall:n,onBack:s,theme:r,cameraEnabled:i,screenShareEnabled:o,isCameraLoading:a,isScreenShareLoading:l,disabled:d}){const u=Ve(r);return c.jsxs("div",{className:`flex items-center justify-center gap-3 p-4 ${u.video.controlsBackground}`,children:[c.jsx("button",{onClick:e,disabled:d||a,className:`p-3 rounded-full transition-all duration-200 ${i?u.video.controlEnabled:u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:i?"Turn off camera":"Turn on camera",children:a?c.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i?c.jsx(Yu,{className:"w-5 h-5"}):c.jsx(Ku,{className:"w-5 h-5"})}),c.jsx("button",{onClick:t,disabled:d||l,className:`p-3 rounded-full transition-all duration-200 ${o?u.video.controlEnabled:u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:o?"Stop screen share":"Share screen",children:l?c.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):o?c.jsx(Hb,{className:"w-5 h-5"}):c.jsx(zb,{className:"w-5 h-5"})}),n&&c.jsx("button",{onClick:n,disabled:d,className:`p-3 rounded-full transition-all duration-200 ${u.video.endCall} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"End call",children:c.jsx(Gu,{className:"w-5 h-5"})}),s&&c.jsx("button",{onClick:s,disabled:d,className:`p-3 rounded-full transition-all duration-200 ${u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"Back",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})})]})}function Pl({trackRef:e,participant:t,isLocal:n=!1,className:s="",theme:r}){var l;const i=Ve(r),o=(t==null?void 0:t.name)||(t==null?void 0:t.identity)||(n?"You":"Participant"),a=(e==null?void 0:e.publication)&&!e.publication.isMuted;return c.jsxs("div",{className:`relative rounded-lg overflow-hidden ${i.video.tile} ${s}`,children:[a?c.jsx(ke.VideoTrack,{trackRef:e,className:"w-full h-full object-cover"}):c.jsx("div",{className:`w-full h-full flex items-center justify-center ${i.video.placeholder}`,children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:`w-16 h-16 mx-auto mb-2 rounded-full flex items-center justify-center ${i.video.avatar}`,children:c.jsx(Qb,{className:"w-8 h-8"})}),c.jsx("p",{className:"text-sm opacity-80",children:o}),c.jsx("p",{className:"text-xs opacity-60",children:"Camera off"})]})}),c.jsx("div",{className:`absolute bottom-2 left-2 px-2 py-1 rounded text-xs ${i.video.nameOverlay}`,children:o}),((l=e==null?void 0:e.publication)==null?void 0:l.isMuted)&&c.jsx("div",{className:`absolute top-2 right-2 p-1 rounded ${i.video.mutedIndicator}`,children:c.jsx(Ku,{className:"w-4 h-4"})})]})}function b2({trackRefs:e,participants:t,theme:n,localParticipant:s}){const r=e.find(u=>u.source===J.Track.Source.Camera&&u.participant===s),i=e.filter(u=>u.participant!==s),o=e.length,a=o<=1?1:o<=4?2:3,l="grid gap-2 h-full",d={gridTemplateColumns:`repeat(${a}, 1fr)`,gridAutoRows:"minmax(0, 1fr)"};return c.jsxs("div",{className:l,style:d,children:[r&&s&&c.jsx(Pl,{trackRef:r,participant:s,isLocal:!0,theme:n,className:"min-h-0"}),i.map((u,h)=>{var m;return c.jsx(Pl,{trackRef:u,participant:u.participant,isLocal:!1,theme:n,className:"min-h-0"},((m=u.publication)==null?void 0:m.trackSid)||h)}),o===0&&c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx(t2,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),c.jsx("p",{className:"text-lg opacity-70",children:"Waiting for participants..."}),c.jsx("p",{className:"text-sm opacity-50",children:"Turn on your camera to start the video call"})]})})]})}function w2({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:r,onEndCall:i}){const o=Ve(t),a=ke.useMaybeRoomContext(),[l,d]=f.useState(!1),[u,h]=f.useState(!1),[m,g]=f.useState(!1),[x,p]=f.useState(!1),[v,b]=f.useState(null),y=ke.useTracks([J.Track.Source.Camera,J.Track.Source.ScreenShare],{onlySubscribed:!1});y.filter(A=>A.source===J.Track.Source.Camera),y.filter(A=>A.source===J.Track.Source.ScreenShare);const w=f.useMemo(()=>a?Array.from(a.remoteParticipants.values()):[],[a]),S=f.useCallback(async()=>{if(!(!a||m)){g(!0);try{const A=a.localParticipant;l?(await A.setCameraEnabled(!1),d(!1)):(await A.setCameraEnabled(!0),d(!0))}catch(A){console.error("Failed to toggle camera:",A)}finally{g(!1)}}},[a,l,m]),k=f.useCallback(async()=>{if(!(!a||x)){p(!0);try{const A=a.localParticipant;u?(await A.setScreenShareEnabled(!1),h(!1)):(await A.setScreenShareEnabled(!0),h(!0))}catch(A){console.error("Failed to toggle screen share:",A)}finally{p(!1)}}},[a,u,x]),T=f.useCallback(()=>{i?i():n&&n()},[i,n]);return f.useEffect(()=>{if(!e)return;const A=j=>{console.log("📺 Video: Interactive UI state updated:",j),b(j)};return e.on("interactive.ui.update",A),e.on("interactive.ui.show",A),()=>{e.off("interactive.ui.update",A),e.off("interactive.ui.show",A)}},[e]),c.jsxs("div",{className:`flex flex-col h-full ${o.video.container}`,children:[c.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${o.video.header}`,children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:`w-3 h-3 rounded-full ${o.video.statusDot}`}),c.jsx("span",{className:"font-medium",children:"Video Call"}),c.jsxs("span",{className:"text-sm opacity-70",children:[w.length+1," participant",w.length!==0?"s":""]})]}),c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("button",{className:`p-2 rounded-lg transition-colors ${o.video.headerButton}`,title:"Layout options",children:c.jsx($b,{className:"w-4 h-4"})})})]}),c.jsx("div",{className:"flex-1 p-4 min-h-0",children:c.jsx(b2,{trackRefs:y,participants:w,localParticipant:a==null?void 0:a.localParticipant,theme:t})}),v&&c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},className:"absolute inset-4 z-10",children:c.jsx(xn,{interaction:v,onDismiss:()=>b(null),theme:t})}),c.jsx(v2,{onToggleCamera:S,onToggleScreenShare:k,onEndCall:T,onBack:n,theme:t,cameraEnabled:l,screenShareEnabled:u,isCameraLoading:m,isScreenShareLoading:x,disabled:s})]})}function ps({onClick:e,disabled:t,theme:n}){const s=Ve(n);return c.jsx("button",{className:s.micButton,onClick:e,disabled:t,"aria-label":"Start Voice Session",type:"button",children:c.jsx(gt.Mic,{})})}function Mr({onClick:e,disabled:t,theme:n}){const s=Ve(n);return c.jsx("button",{className:s.chatButton,onClick:e,disabled:t,"aria-label":"Start Chat Session",type:"button",children:c.jsx(gt.Chat,{})})}function Nr({onClick:e,disabled:t,theme:n}){const s=Ve(n);return c.jsx("button",{className:s.videoButton,onClick:e,disabled:t,"aria-label":"Start Video Session",type:"button",children:c.jsx(gt.Videocam,{})})}function S2({prompts:e,theme:t}){const n=Ve(t),[s,r]=E.useState(0);return E.useEffect(()=>{const i=setInterval(()=>{r(o=>(o+1)%e.length)},3e3);return()=>clearInterval(i)},[e.length]),c.jsx("div",{className:"w-96 min-h-[3rem] h-12 relative overflow-hidden flex items-center justify-center",children:e.map((i,o)=>c.jsx("div",{className:`
311
+ ${e==="light"?"hover:bg-gray-200 text-gray-600 hover:text-gray-800":"hover:bg-gray-600 text-gray-400 hover:text-gray-200"}
312
+ `,"aria-label":"Download file",children:m.jsx(I6,{className:"w-4 h-4"})})]})]})}function Dj(){return m.jsxs("div",{className:"max-w-xs mx-auto bg-green-50 border border-green-200 rounded-lg shadow p-3 flex flex-col items-center",children:[m.jsx("div",{className:"text-2xl mb-2",children:"✅"}),m.jsx("div",{className:"text-green-700 font-semibold text-sm mb-1",children:"Success!"}),m.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"Your action was completed successfully."})]})}function jj(){return m.jsxs("div",{className:"max-w-xs mx-auto bg-yellow-50 border border-yellow-200 rounded-lg shadow p-3 flex flex-col items-center",children:[m.jsx("div",{className:"text-2xl mb-2",children:"⏰"}),m.jsx("div",{className:"text-yellow-700 font-semibold text-sm mb-1",children:"Interaction timed out"}),m.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"No response was provided in time."})]})}function Lj({client:t,theme:e="vox",onBack:n,disabled:i=!1,displayType:r="widget",onEndChat:s}){const[o,a]=v.useState(()=>{if(t&&typeof t.getChatMessages=="function"){const j=t.getChatMessages();return console.log("🔄 ChatView: Initializing with existing messages:",j.length),j}return[]}),[c,l]=v.useState(!0),[d,u]=v.useState(()=>{const j=t&&typeof t.getCurrentSession=="function"&&!!t.getCurrentSession(),q=t&&typeof t.getChatMessages=="function"&&t.getChatMessages().length>0;return!j&&!q}),[f,p]=v.useState(new Set),[g,h]=v.useState([]),[y,b]=v.useState(!1),[w,C]=v.useState(!1),[S,x]=v.useState(()=>{const j=t.getCurrentInteraction();return console.log("ChatView: Initializing with existing interaction:",(j==null?void 0:j.methodName)||"none"),j}),T=v.useRef(null),E=St(e);v.useEffect(()=>{const j=()=>{const q=navigator.userAgent.toLowerCase(),G=["android","iphone","ipad","mobile","tablet"].some(W=>q.includes(W)),D="ontouchstart"in window||navigator.maxTouchPoints>0,$=window.innerWidth<=768,Q=G||D&&$;b(Q),Q&&r==="widget"&&C(!0)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[r]),v.useEffect(()=>(w&&y&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(console.log)),()=>{w&&y&&(document.body.style.overflow="unset",document.body.style.position="unset",document.body.style.width="unset",document.body.style.height="unset",document.fullscreenElement&&document.exitFullscreen().catch(console.log))}),[w,y]);const P=t.getCurrentAgentInfo(),_=(P==null?void 0:P.name)||"AI Assistant",k=_.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2),I=v.useCallback(j=>{const q={id:`local_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:j,timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{isLocal:!0}};a(ee=>(console.log("ChatView: Adding local message:",q.id),[...ee,q]))},[]);v.useEffect(()=>{var j,q,ee,G,D;console.log("💬 ChatView loading state:",{isLoading:d,hasActiveSession:!!((j=t==null?void 0:t.getCurrentSession)!=null&&j.call(t)),messagesCount:o.length,sessionId:(ee=(q=t==null?void 0:t.getCurrentSession)==null?void 0:q.call(t))==null?void 0:ee.id,hasStoredMessages:!!((D=(G=t==null?void 0:t.getChatMessages)==null?void 0:G.call(t))!=null&&D.length),isMobile:y,isFullscreen:w})},[d,o.length,t,y,w]);const N=v.useCallback((j=!1)=>{T.current&&(j?T.current.scrollIntoView({behavior:"auto"}):T.current.scrollIntoView({behavior:"smooth"}))},[]);v.useEffect(()=>{N(!0);const j=setTimeout(()=>{N(!1)},10);return()=>clearTimeout(j)},[o.length,N]),v.useEffect(()=>{if(S){N(!0);const j=setTimeout(()=>{N(!1)},50);return()=>clearTimeout(j)}},[S,N]),v.useEffect(()=>{const j=G=>{if(console.log("ChatView: Received message:",G),u(!1),S&&G.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",S.methodName),h(D=>[...D,G]);return}G.sender.type==="agent"&&l(!1),a(D=>{var Q;if(D.some(W=>W.id===G.id))return console.log("ChatView: Message already exists, skipping:",G.id),D;if(console.log("ChatView: Adding new message:",G.id),G.sender.type==="agent"&&(p(W=>new Set(W).add(G.id)),!((Q=G.metadata)!=null&&Q.streaming))){const W=G.content.length*35+1e3;setTimeout(()=>{p(ce=>{const z=new Set(ce);return z.delete(G.id),z})},W)}return[...D,G]}),setTimeout(()=>N(!0),0)},q=G=>{var D;if(console.log("ChatView: Updated message:",G),S&&G.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",S.methodName),h($=>{const Q=$.findIndex(W=>W.id===G.id);if(Q>=0){const W=[...$];return W[Q]=G,W}else return[...$,G]});return}a($=>$.map(Q=>Q.id===G.id?{...G}:Q)),setTimeout(()=>N(!0),0),(D=G.metadata)!=null&&D.streaming||p($=>{const Q=new Set($);return Q.delete(G.id),Q})},ee=G=>{console.log("ChatView: Sent message:",G),u(!1),a(D=>D.some(Q=>Q.id===G.id)?(console.log("ChatView: Sent message already exists, skipping:",G.id),D):(console.log("ChatView: Adding sent message:",G.id),[...D,G])),setTimeout(()=>N(!0),0)};return t.on("chat.message.received",j),t.on("chat.message.updated",q),t.on("chat.message.sent",ee),()=>{t.off("chat.message.received",j),t.off("chat.message.updated",q),t.off("chat.message.sent",ee)}},[t,S]),v.useEffect(()=>{const j=D=>{console.log("ChatView: RPC interaction started:",D);const $=t.getCurrentInteraction();console.log("ChatView: Got interaction from client:",$==null?void 0:$.methodName),x($),l(!1),N(!0),setTimeout(()=>{N(!1)},100)},q=D=>{if(console.log("ChatView: RPC interaction completed:",D),x(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages"),a($=>{const Q=[...$];return g.forEach(W=>{var z;if(!Q.some(me=>me.id===W.id)&&(console.log("ChatView: Adding queued message:",W.id),Q.push(W),W.sender.type==="agent"&&(p(me=>new Set(me).add(W.id)),!((z=W.metadata)!=null&&z.streaming)))){const me=W.content.length*35+1e3;setTimeout(()=>{p(Ee=>{const qe=new Set(Ee);return qe.delete(W.id),qe})},me)}}),Q}),h([]),setTimeout(()=>N(!0),0)),D&&D.response&&D.response.success){let $=null;D.response.successView?$=D.response.successView:D.successView&&($=D.successView),a(Q=>{const W=[...Q].reverse().findIndex(Ee=>Ee.sender.type==="participant");let ce=Q.length;W!==-1&&(ce=Q.length-W);const z={id:`success_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{type:"successView",view:$||m.jsx(Dj,{})}};t&&typeof t.addChatMessage=="function"&&t.addChatMessage(z);const me=[...Q];return me.splice(ce,0,z),me})}},ee=async D=>{S&&(console.log("ChatView: Dismissing active interaction due to timeout"),t.dismissCurrentInteraction()),x(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages after timeout"),a(Q=>{const W=[...Q];return g.forEach(ce=>{var me;if(!W.some(Ee=>Ee.id===ce.id)&&(W.push(ce),ce.sender.type==="agent"&&(p(Ee=>new Set(Ee).add(ce.id)),!((me=ce.metadata)!=null&&me.streaming)))){const Ee=ce.content.length*35+1e3;setTimeout(()=>{p(qe=>{const Ct=new Set(qe);return Ct.delete(ce.id),Ct})},Ee)}}),W}),h([]),setTimeout(()=>N(!0),0));let $=null;D&&D.response&&D.response.timeoutView?$=D.response.timeoutView:D&&D.timeoutView&&($=D.timeoutView),a(Q=>{const W={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:_,type:"agent"},metadata:{type:"timeoutView",view:$||m.jsx(jj,{})}};return t&&typeof t.addChatMessage=="function"&&t.addChatMessage(W),[...Q,W]}),setTimeout(()=>{t.getCurrentInteraction()||x(null)},100)},G=async D=>{console.log("ChatView: RPC interaction dismissed:",D),console.log("ChatView: Current interaction before dismiss:",S==null?void 0:S.methodName),x(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages after dismissal"),a($=>{const Q=[...$];return g.forEach(W=>{var z;if(!Q.some(me=>me.id===W.id)&&(Q.push(W),W.sender.type==="agent"&&(p(me=>new Set(me).add(W.id)),!((z=W.metadata)!=null&&z.streaming)))){const me=W.content.length*35+1e3;setTimeout(()=>{p(Ee=>{const qe=new Set(Ee);return qe.delete(W.id),qe})},me)}}),Q}),h([]),setTimeout(()=>N(!0),0)),setTimeout(()=>{const $=t.getCurrentInteraction();console.log("ChatView: Latest interaction from client after dismiss:",($==null?void 0:$.methodName)||"null"),$===null&&x(null)},50),console.log("ChatView: Set currentInteraction to null after dismiss")};return t.on("rpc.interaction.started",j),t.on("rpc.interaction.completed",q),t.on("rpc.interaction.timeout",ee),t.on("rpc.interaction.dismissed",G),()=>{t.off("rpc.interaction.started",j),t.off("rpc.interaction.completed",q),t.off("rpc.interaction.timeout",ee),t.off("rpc.interaction.dismissed",G)}},[t]),v.useEffect(()=>{const j=()=>{if(console.log("ChatView: Agent is thinking"),S){console.log("ChatView: Suppressing thinking indicator due to active interaction:",S.methodName);return}l(!0)},q=()=>{console.log("ChatView: Agent is speaking"),l(!1)};return t.on("agent.thinking",j),t.on("agent.speaking",q),()=>{t.off("agent.thinking",j),t.off("agent.speaking",q)}},[t,S]),v.useEffect(()=>{const j=t.getCurrentInteraction();j?(console.log("ChatView: Restoring interaction state on mount/client change:",j.methodName),x(j)):x(null)},[t]),v.useEffect(()=>{console.log("ChatView: Display type changed to:",r,"Current interaction:",(S==null?void 0:S.methodName)||"none")},[r,S]);const K=async j=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user message send"),t.dismissCurrentInteraction(),x(null)),await t.sendChatMessage(j)}catch(q){console.error("Failed to send message:",q)}},J=async j=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user attachment send"),t.dismissCurrentInteraction(),x(null)),await t.sendAttachments(j),console.log("Attachments sent successfully:",j.map(q=>q.name))}catch(q){console.error("Failed to send attachments:",q)}},[se,ie]=v.useState([]);if(v.useEffect(()=>{const j=q=>{ie(Array.isArray(q)?q:["tes","hello how are you","algebra make me learn that ","what is the meaning of life"])};return t.on("suggested.response",j),()=>{t.off("suggested.response",j)}},[t]),d){const j=w&&y?"fixed inset-0 z-[9999] flex flex-col items-center justify-center h-screen w-screen bg-black":"flex w-full flex-col items-center justify-center h-full p-8";return m.jsxs("div",{className:j,children:[m.jsx("div",{className:`${E.spinner} w-12 h-12 mb-6`}),m.jsxs("p",{className:`text-sm text-center ${w&&y?"text-white":""}`,children:["Connecting to ",_,"..."]})]})}const X=w&&y?"fullscreen":r,O=X==="fullscreen"?w&&y?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"flex flex-col h-full w-full max-w-none":"flex flex-col h-full w-full backdrop-blur-sm",oe=X==="fullscreen"?w&&y?"flex items-center w-full justify-between px-4 pt-3 pb-3 bg-black/80 text-white border-b border-gray-700":`flex items-center w-full justify-between px-6 pt-5 pb-4 border-b ${E.chatHeader.container}`:`flex items-center w-full justify-between px-4 pt-5 pb-4 border-b ${E.chatHeader.container}`,L=X==="fullscreen"?w&&y?"flex-1 overflow-y-auto scrollbar-hide p-4 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide p-6 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide w-full p-4 chat-scrollable min-h-0",F="flex-shrink-0 !w-full",te=()=>{C(!1),n&&n()};return m.jsxs("div",{className:O,children:[m.jsx("div",{className:oe,children:m.jsxs("div",{className:"flex items-center gap-2",children:[w&&y&&m.jsx(xe.button,{onClick:te,whileHover:{scale:1.05},whileTap:{scale:.95},className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors mr-2","aria-label":"Exit fullscreen",children:"✕"}),m.jsxs("div",{children:[m.jsx("h3",{className:`font-semibold text-base leading-tight ${w&&y?"text-white":E.text.primary}`,children:_}),m.jsxs("p",{className:`text-xs flex items-center gap-1.5 mt-0.5 ${w&&y?"text-gray-300":E.text.muted}`,children:[m.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"}),"Online"]})]})]})}),m.jsxs("div",{className:`${L} flex flex-col`,style:{scrollBehavior:"smooth",scrollbarWidth:"none"},children:[" ",o.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center py-12",children:[m.jsx(xe.div,{transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl mb-6 shadow-xl",children:k}),m.jsxs("p",{className:`text-base mb-2 ${w&&y?"text-white":E.text.secondary}`,children:[_," is joining..."]}),m.jsx("p",{className:`text-xs ${w&&y?"text-gray-300":E.text.muted}`,children:"Your conversation will begin shortly"})]}):m.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-3 py-4 flex-1 flex flex-col justify-end",children:m.jsxs("div",{className:"space-y-3",children:[o.map((j,q)=>{var ee,G;return m.jsx("div",{children:((ee=j.metadata)==null?void 0:ee.type)==="successView"?m.jsx("div",{className:"flex w-full justify-end mb-4 px-1",children:m.jsxs("div",{className:"relative group flex-row-reverse flex items-end gap-3 max-w-[85%]",children:[m.jsx(xe.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:"Y"}),m.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-br-md message-hover border-gray-200 dark:border-gray-700 ${E.chatMessage.own}`,children:[j.metadata.view,m.jsx("div",{className:`text-xs ${E.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:j.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):((G=j.metadata)==null?void 0:G.type)==="timeoutView"?m.jsx("div",{className:"flex w-full justify-start mb-4 px-1",children:m.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[m.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:k}),m.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${E.chatMessage.other}`,children:[j.metadata.view,m.jsx("div",{className:`text-xs ${E.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:j.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):m.jsx(Mj,{message:j,theme:e,isOwn:j.sender.type==="participant",isStreaming:f.has(j.id)})},j.id)}),c&&!S&&m.jsx(xe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:o.length*.1},className:"flex w-full justify-start mb-4 px-1",children:m.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[m.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:k}),m.jsx("div",{className:`relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover ${E.chatMessage.other} rounded-bl-md transition-all duration-200 group-hover:scale-[1.02]`,style:{wordWrap:"break-word",overflowWrap:"break-word",minWidth:48},children:m.jsx("span",{className:"inline-flex items-center",children:[0,1,2].map(j=>m.jsx(xe.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:j*.2,ease:"easeInOut"}},j))})})]})}),S&&S.presentationMode==="embedded"&&m.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[m.jsx(xe.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:k}),m.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${E.chatMessage.other}`,children:[m.jsx(Qr,{interaction:S,theme:e,onDismiss:()=>t.dismissCurrentInteraction(),client:t,addLocalMessage:I},S.methodName),m.jsx(xe.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:`text-xs ${E.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),m.jsx("div",{ref:T})]})})]}),se.length>0&&m.jsx("div",{className:"w-full flex overflow-x-auto gap-2 px-4 py-2 mb-1 scrollbar-hide",children:se.map((j,q)=>{var ee;return m.jsx("button",{className:`whitespace-nowrap px-3 py-1 rounded-full border shadow-sm flex-shrink-0 transition-all duration-150 font-medium text-sm focus:outline-none focus:ring-2 focus:ring-blue-400/40
313
+ ${e==="light"?"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900":e==="dark"?"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white":((ee=E.suggestedResponse)==null?void 0:ee.container)||"bg-gradient-to-br from-blue-500 to-purple-600 text-white border-blue-400 hover:from-blue-600 hover:to-purple-700"}
314
+ `,style:{boxShadow:e==="vox"?"0 2px 8px 0 rgba(80,60,200,0.10)":void 0,borderWidth:1},onClick:()=>{K(j),ie([])},children:j},j+q)})}),S&&S.presentationMode!=="embedded"&&m.jsx(Qr,{interaction:S,theme:e,onDismiss:()=>t.dismissCurrentInteraction(),client:t,addLocalMessage:I},S.methodName),m.jsx(xe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:F,children:m.jsx(Aj,{onSendMessage:K,onSendAttachments:J,disabled:i,theme:e,onEndChat:s})})]})}function Vj({onToggleCamera:t,onToggleScreenShare:e,onEndCall:n,onBack:i,theme:r,cameraEnabled:s,screenShareEnabled:o,isCameraLoading:a,isScreenShareLoading:c,disabled:l}){const d=St(r);return m.jsxs("div",{className:`flex items-center justify-center gap-3 p-4 ${d.video.controlsBackground}`,children:[m.jsx("button",{onClick:t,disabled:l||a,className:`p-3 rounded-full transition-all duration-200 ${s?d.video.controlEnabled:d.video.controlDisabled} ${l?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:s?"Turn off camera":"Turn on camera",children:a?m.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):s?m.jsx(TS,{className:"w-5 h-5"}):m.jsx(kS,{className:"w-5 h-5"})}),m.jsx("button",{onClick:e,disabled:l||c,className:`p-3 rounded-full transition-all duration-200 ${o?d.video.controlEnabled:d.video.controlDisabled} ${l?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:o?"Stop screen share":"Share screen",children:c?m.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):o?m.jsx(V6,{className:"w-5 h-5"}):m.jsx(U6,{className:"w-5 h-5"})}),n&&m.jsx("button",{onClick:n,disabled:l,className:`p-3 rounded-full transition-all duration-200 ${d.video.endCall} ${l?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"End call",children:m.jsx(ES,{className:"w-5 h-5"})}),i&&m.jsx("button",{onClick:i,disabled:l,className:`p-3 rounded-full transition-all duration-200 ${d.video.controlDisabled} ${l?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"Back",children:m.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})})]})}function P0({trackRef:t,participant:e,isLocal:n=!1,className:i="",theme:r}){var c;const s=St(r),o=(e==null?void 0:e.name)||(e==null?void 0:e.identity)||(n?"You":"Participant"),a=(t==null?void 0:t.publication)&&!t.publication.isMuted;return m.jsxs("div",{className:`relative rounded-lg overflow-hidden ${s.video.tile} ${i}`,children:[a?m.jsx(Mf,{trackRef:t,className:"w-full h-full object-cover"}):m.jsx("div",{className:`w-full h-full flex items-center justify-center ${s.video.placeholder}`,children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:`w-16 h-16 mx-auto mb-2 rounded-full flex items-center justify-center ${s.video.avatar}`,children:m.jsx(Z6,{className:"w-8 h-8"})}),m.jsx("p",{className:"text-sm opacity-80",children:o}),m.jsx("p",{className:"text-xs opacity-60",children:"Camera off"})]})}),m.jsx("div",{className:`absolute bottom-2 left-2 px-2 py-1 rounded text-xs ${s.video.nameOverlay}`,children:o}),((c=t==null?void 0:t.publication)==null?void 0:c.isMuted)&&m.jsx("div",{className:`absolute top-2 right-2 p-1 rounded ${s.video.mutedIndicator}`,children:m.jsx(kS,{className:"w-4 h-4"})})]})}function Fj({trackRefs:t,participants:e,theme:n,localParticipant:i}){const r=t.find(d=>d.source===V.Source.Camera&&d.participant===i),s=t.filter(d=>d.participant!==i),o=t.length,a=o<=1?1:o<=4?2:3,c="grid gap-2 h-full",l={gridTemplateColumns:`repeat(${a}, 1fr)`,gridAutoRows:"minmax(0, 1fr)"};return m.jsxs("div",{className:c,style:l,children:[r&&i&&m.jsx(P0,{trackRef:r,participant:i,isLocal:!0,theme:n,className:"min-h-0"}),s.map((d,u)=>{var f;return m.jsx(P0,{trackRef:d,participant:d.participant,isLocal:!1,theme:n,className:"min-h-0"},((f=d.publication)==null?void 0:f.trackSid)||u)}),o===0&&m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsxs("div",{className:"text-center",children:[m.jsx(J6,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),m.jsx("p",{className:"text-lg opacity-70",children:"Waiting for participants..."}),m.jsx("p",{className:"text-sm opacity-50",children:"Turn on your camera to start the video call"})]})})]})}function Uj({client:t,theme:e="vox",onBack:n,disabled:i=!1,displayType:r,onEndCall:s}){const o=St(e),a=_1(),[c,l]=v.useState(!1),[d,u]=v.useState(!1),[f,p]=v.useState(!1),[g,h]=v.useState(!1),[y,b]=v.useState(null),w=If([V.Source.Camera,V.Source.ScreenShare],{onlySubscribed:!1});w.filter(E=>E.source===V.Source.Camera),w.filter(E=>E.source===V.Source.ScreenShare);const C=v.useMemo(()=>a?Array.from(a.remoteParticipants.values()):[],[a]),S=v.useCallback(async()=>{if(!(!a||f)){p(!0);try{const E=a.localParticipant;c?(await E.setCameraEnabled(!1),l(!1)):(await E.setCameraEnabled(!0),l(!0))}catch(E){console.error("Failed to toggle camera:",E)}finally{p(!1)}}},[a,c,f]),x=v.useCallback(async()=>{if(!(!a||g)){h(!0);try{const E=a.localParticipant;d?(await E.setScreenShareEnabled(!1),u(!1)):(await E.setScreenShareEnabled(!0),u(!0))}catch(E){console.error("Failed to toggle screen share:",E)}finally{h(!1)}}},[a,d,g]),T=v.useCallback(()=>{s?s():n&&n()},[s,n]);return v.useEffect(()=>{if(!t)return;const E=P=>{console.log("📺 Video: Interactive UI state updated:",P),b(P)};return t.on("interactive.ui.update",E),t.on("interactive.ui.show",E),()=>{t.off("interactive.ui.update",E),t.off("interactive.ui.show",E)}},[t]),m.jsxs("div",{className:`flex flex-col h-full ${o.video.container}`,children:[m.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${o.video.header}`,children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("div",{className:`w-3 h-3 rounded-full ${o.video.statusDot}`}),m.jsx("span",{className:"font-medium",children:"Video Call"}),m.jsxs("span",{className:"text-sm opacity-70",children:[C.length+1," participant",C.length!==0?"s":""]})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsx("button",{className:`p-2 rounded-lg transition-colors ${o.video.headerButton}`,title:"Layout options",children:m.jsx(j6,{className:"w-4 h-4"})})})]}),m.jsx("div",{className:"flex-1 p-4 min-h-0",children:m.jsx(Fj,{trackRefs:w,participants:C,localParticipant:a==null?void 0:a.localParticipant,theme:e})}),y&&m.jsx(xe.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},className:"absolute inset-4 z-10",children:m.jsx(Qr,{interaction:y,onDismiss:()=>b(null),theme:e})}),m.jsx(Vj,{onToggleCamera:S,onToggleScreenShare:x,onEndCall:T,onBack:n,theme:e,cameraEnabled:c,screenShareEnabled:d,isCameraLoading:f,isScreenShareLoading:g,disabled:i})]})}function Wo({onClick:t,disabled:e,theme:n}){const i=St(n);return m.jsx("button",{className:i.micButton,onClick:t,disabled:e,"aria-label":"Start Voice Session",type:"button",children:m.jsx(nw,{})})}function Bl({onClick:t,disabled:e,theme:n}){const i=St(n);return m.jsx("button",{className:i.chatButton,onClick:t,disabled:e,"aria-label":"Start Chat Session",type:"button",children:m.jsx(tw,{})})}function $l({onClick:t,disabled:e,theme:n}){const i=St(n);return m.jsx("button",{className:i.videoButton,onClick:t,disabled:e,"aria-label":"Start Video Session",type:"button",children:m.jsx(iw,{})})}function Bj({prompts:t,theme:e}){const n=St(e),[i,r]=R.useState(0);return R.useEffect(()=>{const s=setInterval(()=>{r(o=>(o+1)%t.length)},3e3);return()=>clearInterval(s)},[t.length]),m.jsx("div",{className:"w-96 min-h-[3rem] h-12 relative overflow-hidden flex items-center justify-center",children:t.map((s,o)=>m.jsx("div",{className:`
203
315
  ${n.promptSlider}
204
- ${o===s?"opacity-100":"opacity-0"}
316
+ ${o===i?"opacity-100":"opacity-0"}
205
317
  whitespace-pre-line break-words
206
- `,style:{minHeight:"2.5rem",display:o===s?"block":"none"},children:i},o))})}function C2({statusMessage:e,theme:t}){const n=Ve(t);return c.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[c.jsx("div",{className:n.statusIndicator}),c.jsx("span",{className:`text-xs ${n.text.muted}`,children:e})]})}const E2=({disabled:e,onStartCall:t,onStartChat:n,onStartVideo:s,prompts:r=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:i="Agent is ready",title:o="Choose how to interact",subTitle:a="Ask me anything or give me a task to complete",theme:l="vox",modalities:d=["voice","chat","video"]})=>{const u=Ve(l),h=d.includes("voice"),m=d.includes("chat"),g=d.includes("video"),x=[h,m,g].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:d,hasVoice:h,hasChat:m,hasVideo:g,totalButtons:x,onStartVideo:!!s}),c.jsxs("div",{inert:e,className:"flex p-8 flex-col items-center h-full justify-center w-full",children:[c.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[c.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[c.jsx("div",{className:u.pulseRings.ring1}),c.jsx("div",{className:u.pulseRings.ring2,style:{animationDelay:"0.5s"}}),c.jsx("div",{className:u.pulseRings.ring3,style:{animationDelay:"1s"}})]}),c.jsx("div",{className:"relative z-10 flex items-center justify-center",children:h&&m&&g?c.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[c.jsx(ps,{onClick:t,disabled:e,theme:l}),c.jsx(Mr,{onClick:n,disabled:e,theme:l}),c.jsx(Nr,{onClick:s||t,disabled:e,theme:l})]}):x>1?c.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[h&&c.jsx(ps,{onClick:t,disabled:e,theme:l}),m&&c.jsx(Mr,{onClick:n,disabled:e,theme:l}),g&&s&&c.jsx(Nr,{onClick:s,disabled:e,theme:l})]}):c.jsx("div",{className:"flex items-center justify-center",children:h?c.jsx(ps,{onClick:t,disabled:e,theme:l}):m?c.jsx(Mr,{onClick:n,disabled:e,theme:l}):g&&s?c.jsx(Nr,{onClick:s,disabled:e,theme:l}):c.jsx(ps,{onClick:t,disabled:e,theme:l})})})]}),c.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[c.jsx("h3",{className:`text-xl font-semibold mb-2 ${u.text.accent}`,children:o}),c.jsx("p",{className:`text-sm leading-relaxed px-4 ${u.text.secondary}`,children:a}),x>1&&c.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[h&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx(gt.Mic,{className:"w-4 h-4"}),c.jsx("span",{className:u.text.muted,children:"Voice"})]}),m&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx(gt.Chat,{className:"w-4 h-4"}),c.jsx("span",{className:u.text.muted,children:"Chat"})]}),g&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx(gt.Videocam,{className:"w-4 h-4"}),c.jsx("span",{className:u.text.muted,children:"Video"})]})]})]}),c.jsx(S2,{prompts:r,theme:l}),c.jsx(C2,{statusMessage:i,theme:l})]})};function Xu({room:e,onSessionEnd:t,onSessionStart:n,enableConsoleLogging:s=!0,enableLocalStorage:r=!0,voxketSessionId:i}={}){const[o,a]=f.useState(null),[l,d]=f.useState([]),[u,h]=f.useState(null),[m,g]=f.useState([]),x=f.useCallback((y,w)=>{const S={timestamp:new Date,event:y,data:w,sessionId:o==null?void 0:o.sessionId,participantId:u==null?void 0:u.identity};if(d(k=>[...k,S]),r){const k=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");k.push(S),localStorage.setItem("voxket-session-logs",JSON.stringify(k))}return S},[o==null?void 0:o.sessionId,u==null?void 0:u.identity,s,r]);f.useEffect(()=>{if(!e)return;const y=()=>{const I=i||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,$=new Date,F={sessionId:I,startTime:$,totalMessages:0,connectionIssues:0,participantCount:m.length,events:[]};a(F),x("SESSION_STARTED",{sessionId:I,startTime:$}),n==null||n(I)},w=()=>{if(o){const I=new Date,$=I.getTime()-o.startTime.getTime(),F={...o,endTime:I,duration:$,events:l};x("SESSION_ENDED",{sessionId:o.sessionId,duration:`${Math.round($/1e3)}s`,totalMessages:o.totalMessages,connectionIssues:o.connectionIssues}),t==null||t(F),a(null),d([])}},S=I=>{x("CONNECTION_STATE_CHANGED",{state:I}),I===J.ConnectionState.Reconnecting&&o&&(a($=>$?{...$,connectionIssues:$.connectionIssues+1}:null),x("CONNECTION_ISSUE",{type:"reconnecting"}))},k=I=>{x("TRACK_PUBLISHED",{trackKind:I.kind,trackSource:I.source})},T=I=>{x("TRACK_UNPUBLISHED",{trackKind:I.kind,trackSource:I.source})},A=(I,$)=>{o&&a(F=>F?{...F,totalMessages:F.totalMessages+1}:null),x("DATA_RECEIVED",{participantId:$==null?void 0:$.identity,dataSize:I.length})},j=I=>{x("PARTICIPANT_CONNECTED",{participantId:I.identity,participantName:I.name}),g($=>[...$,I]),o&&a($=>$?{...$,participantCount:$.participantCount+1}:null)},V=I=>{x("PARTICIPANT_DISCONNECTED",{participantId:I.identity,participantName:I.name}),g($=>$.filter(F=>F.identity!==I.identity))};return e.localParticipant&&h(e.localParticipant),e.on(J.RoomEvent.Connected,y),e.on(J.RoomEvent.Disconnected,w),e.on(J.RoomEvent.ConnectionStateChanged,S),e.on(J.RoomEvent.TrackPublished,k),e.on(J.RoomEvent.TrackUnpublished,T),e.on(J.RoomEvent.DataReceived,A),e.on(J.RoomEvent.ParticipantConnected,j),e.on(J.RoomEvent.ParticipantDisconnected,V),()=>{e.off(J.RoomEvent.Connected,y),e.off(J.RoomEvent.Disconnected,w),e.off(J.RoomEvent.ConnectionStateChanged,S),e.off(J.RoomEvent.TrackPublished,k),e.off(J.RoomEvent.TrackUnpublished,T),e.off(J.RoomEvent.DataReceived,A),e.off(J.RoomEvent.ParticipantConnected,j),e.off(J.RoomEvent.ParticipantDisconnected,V)}},[e,o,l,m.length,x,t,n]);const p=f.useCallback(()=>r?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):l,[l,r]),v=f.useCallback(()=>{r&&localStorage.removeItem("voxket-session-logs"),d([])},[r]),b=f.useCallback(()=>{const y=p(),w=JSON.stringify(y,null,2),S="data:application/json;charset=utf-8,"+encodeURIComponent(w),k=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,T=document.createElement("a");T.setAttribute("href",S),T.setAttribute("download",k),T.click()},[p]);return{sessionMetrics:o,sessionLogs:l,logEvent:x,getSessionLogs:p,clearSessionLogs:v,exportSessionLogs:b}}var nn={},Ml;function k2(){if(Ml)return nn;Ml=1;var e=yo;if(process.env.NODE_ENV==="production")nn.createRoot=e.createRoot,nn.hydrateRoot=e.hydrateRoot;else{var t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;nn.createRoot=function(n,s){t.usingClientEntryPoint=!0;try{return e.createRoot(n,s)}finally{t.usingClientEntryPoint=!1}},nn.hydrateRoot=function(n,s,r){t.usingClientEntryPoint=!0;try{return e.hydrateRoot(n,s,r)}finally{t.usingClientEntryPoint=!1}}}return nn}var A2=k2();class mi{constructor(){je(this,"listeners",{})}on(t,n){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n),()=>this.off(t,n)}once(t,n){const s=(...r)=>{this.off(t,s),n(...r)};return this.on(t,s)}off(t,n){const s=this.listeners[t];if(!s)return;const r=s.indexOf(n);r>-1&&s.splice(r,1)}removeAllListeners(t){t?delete this.listeners[t]:this.listeners={}}emit(t,...n){const s=this.listeners[t];if(!s)return;const r=[...s];for(const i of r)try{i(...n)}catch(o){console.error(`Error in event listener for ${String(t)}:`,o)}}listenerCount(t){var n;return((n=this.listeners[t])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class qu{constructor(t){je(this,"plugins",new Map);je(this,"installedPlugins",new Set);je(this,"context");this.context={client:t,emit:t.emit.bind(t),on:t.on.bind(t),config:{}}}register(t){if(this.plugins.has(t.name))throw new Error(`Plugin '${t.name}' is already registered`);if(t.dependencies){for(const n of t.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${t.name}' depends on '${n}' which is not registered`)}this.plugins.set(t.name,t)}async install(t,n){const s=this.plugins.get(t);if(!s)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t))throw new Error(`Plugin '${t}' is already installed`);if(s.dependencies)for(const i of s.dependencies)this.installedPlugins.has(i)||await this.install(i);const r={...this.context,config:{...s.config,...n}};s.install&&await s.install(r),this.installedPlugins.add(t),this.setupPluginEvents(s,r)}async uninstall(t){var s;const n=this.plugins.get(t);if(!n)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t)){for(const[r,i]of this.plugins)if(this.installedPlugins.has(r)&&((s=i.dependencies)!=null&&s.includes(t)))throw new Error(`Cannot uninstall '${t}' because '${r}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(t)}}isInstalled(t){return this.installedPlugins.has(t)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(t){return this.plugins.get(t)}setupPluginEvents(t,n){t.onSessionStart&&n.on("session.started",s=>{t.onSessionStart(n,s.id)}),t.onSessionEnd&&n.on("session.ended",s=>{t.onSessionEnd(n,s.id)}),t.onAgentResponse&&n.on("agent.response",s=>{t.onAgentResponse(n,s)})}}function T2(e){return e}function pi(e,t,n){return{name:e,version:"1.0.0",description:`${t} modality plugin`,install:async s=>{n.onActivate&&await n.onActivate(s)},uninstall:async s=>{n.onDeactivate&&await n.onDeactivate(s)},onAgentResponse:n.onMessage}}const j2={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async e=>{console.log("Analytics plugin installed"),e.on("session.started",t=>{console.log("Analytics: Session started",t.id)}),e.on("session.ended",(t,n)=>{console.log("Analytics: Session ended",t.id,n)}),e.on("chat.message.sent",t=>{console.log("Analytics: User message sent",t.content.length)})}},P2={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async e=>{console.log("Debug plugin installed");const t=e.emit;e.emit=(n,...s)=>(console.log(`[Debug] Event: ${String(n)}`,s),t(n,...s))}},M2={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async e=>{console.log("Metrics plugin installed");const t=new Map;e.on("session.started",n=>{t.set(n.id,{startTime:Date.now(),events:[]})}),e.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},Ju=E.createContext(null);function Qu({config:e,children:t,autoConnect:n=!1}){const[s,r]=E.useState(null),[i,o]=E.useState(!1),[a,l]=E.useState(!1),[d,u]=E.useState(null),[h,m]=E.useState(null),[g,x]=E.useState("idle"),[p,v]=E.useState(null),[b,y]=E.useState([]),[w,S]=E.useState([]),[k,T]=E.useState([]);E.useEffect(()=>{const P=new es(e);return r(P),A(P),n&&j(P),()=>{P.disconnect().catch(console.error)}},[e,n]);const A=P=>{P.on("connection.connecting",()=>{l(!0),u(null)}),P.on("connection.connected",()=>{o(!0),l(!1),u(null)}),P.on("connection.disconnected",()=>{o(!1),l(!1),m(null),x("idle"),y([]),S([]),T([])}),P.on("connection.error",B=>{u(B),l(!1)}),P.on("session.created",B=>{m(B),x(B.state)}),P.on("session.state.changed",B=>{x(B),h&&m({...h,state:B})}),P.on("session.ended",(B,X)=>{m(null),x("idle"),v(X),y([]),S([]),T([])}),P.on("participant.joined",B=>{y(X=>[...X,B])}),P.on("participant.left",B=>{y(X=>X.filter(_=>_.id!==B.id))}),P.on("chat.message.received",B=>{S(X=>[...X,B])}),P.on("chat.message.sent",B=>{S(X=>[...X,B])}),P.on("transcription.received",B=>{T(X=>[...X,B])})},j=async P=>{const B=P||s;if(B)try{await B.connect()}catch(X){console.error("Failed to connect:",X)}},O={client:s,isConnected:i,isConnecting:a,connectionError:d,currentSession:h,sessionState:g,sessionMetrics:p,participants:b,chatMessages:w,transcriptions:k,connect:()=>j(),disconnect:async()=>{if(s)try{await s.disconnect()}catch(P){console.error("Failed to disconnect:",P)}},createSession:async(P,B={})=>{if(!s)throw new Error("Client not initialized");const X={agentId:P,participantName:B.participantName||"User",metadata:B.metadata,modalities:B.modalities||["voice"]};return await s.createSession(X)},endSession:async()=>s?await s.endSession():null,sendChatMessage:async P=>{if(!s)throw new Error("Client not initialized");await s.sendChatMessage(P)},setMicrophoneEnabled:async P=>{if(!s)throw new Error("Client not initialized");await s.setMicrophoneEnabled(P)},setCameraEnabled:async P=>{if(!s)throw new Error("Client not initialized");await s.setCameraEnabled(P)},startScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.startScreenShare()},stopScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.stopScreenShare()}};return c.jsx(Ju.Provider,{value:O,children:t})}function ht(){const e=E.useContext(Ju);if(!e)throw new Error("useVoxket must be used within a VoxketProvider");return e}class N2 extends mi{constructor(n){super();je(this,"room",null);je(this,"registeredMethods",new Map);je(this,"activeInteractions",new Map);je(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,s,r="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const i={methodName:n,component:s,presentationMode:r};this.registeredMethods.set(n,i);try{this.room.registerRpcMethod(n,async o=>{console.log(`RpcManager: RPC method '${n}' called by ${o.callerIdentity}`),console.log("RpcManager: Payload:",o.payload),this.emit("rpc.method.called",{methodName:n,data:o});let a;console.log(`RpcManager: Current registration for '${n}':`,i);let l=o.responseTimeout||30;try{a=JSON.parse(o.payload)}catch{a=o.payload}try{const d=await this.awaitUserInteraction(n,s,r,a,l);return JSON.stringify(d)}catch(d){throw console.error(`RpcManager: Error in RPC method '${n}':`,d),d}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(o){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,o),o}}async awaitUserInteraction(n,s,r,i,o){return new Promise((a,l)=>{const d=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${o} seconds`);const u={didSuccess:(m,g)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,m),this.clearInteraction(d),this.currentInteraction=null;const x={success:!0,message:"User interaction completed successfully",data:m,timestamp:new Date,...g?{successView:g}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:x}),a(x)},didFail:m=>{console.log(`RpcManager: User interaction failed for method: ${n}`,m),this.clearInteraction(d);const g={success:!1,message:"User interaction failed",error:m,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:g}),a(g)},dismissView:()=>{var g;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(g=this.currentInteraction)==null?void 0:g.methodName),this.clearInteraction(d),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const m={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:m}),this.emit("rpc.interaction.completed",{methodName:n,response:m}),setTimeout(()=>{var x;((x=this.currentInteraction)==null?void 0:x.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(m)},didTimeout:m=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(d),this.currentInteraction=null;const g={success:!0,message:`User interaction timed out after ${o} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...m?{timeoutView:m}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:g}),setTimeout(()=>{var x;((x=this.currentInteraction)==null?void 0:x.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(g)}},h=setTimeout(()=>{u.didTimeout&&u.didTimeout()},o);this.activeInteractions.set(d,{resolve:m=>a(JSON.parse(m)),reject:l,timeoutId:h}),this.currentInteraction={isVisible:!0,methodName:n,component:s,presentationMode:r,timeout:o,data:i,handler:u},this.emit("rpc.interaction.started",{methodName:n,presentationMode:r}),setTimeout(async()=>{var m;if((m=this.currentInteraction)!=null&&m.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,i)}catch(g){console.error("RpcManager: Error loading data into component:",g),u.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const s=this.activeInteractions.get(n);s&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(s.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,s]of this.activeInteractions)clearTimeout(s.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class pe extends Error{constructor(t,n,s){super(t),this.code=n,this.details=s,this.name="VoxketError"}}class es extends mi{constructor(n){super();je(this,"config");je(this,"room",null);je(this,"pluginManager");je(this,"rpcManager");je(this,"isConnected",!1);je(this,"currentSession",null);je(this,"connectionState",J.ConnectionState.Disconnected);je(this,"renderedComponents",new Map);je(this,"textStreamHandlersRegistered",!1);je(this,"currentAgentInfo",null);je(this,"chatMessages",[]);this.config=n,this.pluginManager=new qu(this),this.rpcManager=new N2,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,s;this.isConnected=!0,(s=(n=this.config).onConnected)==null||s.call(n)}),this.on("connection.disconnected",n=>{var s,r;this.isConnected=!1,(r=(s=this.config).onDisconnected)==null||r.call(s,n)}),this.on("connection.error",n=>{var s,r;(r=(s=this.config).onError)==null||r.call(s,n)}),this.on("chat.message.received",n=>{var s,r;this.addChatMessage(n),(r=(s=this.config).onMessageReceived)==null||r.call(s,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var s,r;(r=(s=this.config).onTranscriptionReceived)==null||r.call(s,n)}),this.on("session.state.changed",n=>{var s,r;(r=(s=this.config).onSessionStateChanged)==null||r.call(s,n)}),this.on("session.created",n=>{var s,r;(r=(s=this.config).onSessionStart)==null||r.call(s,n.id)}),this.on("session.ended",(n,s)=>{var r,i;(i=(r=this.config).onSessionEnd)==null||i.call(r,s)}),this.on("participant.joined",n=>{var s,r;(r=(s=this.config).onUserJoined)==null||r.call(s,n.id)}),this.on("participant.left",n=>{var s,r;(r=(s=this.config).onUserLeft)==null||r.call(s,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new J.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(J.RoomEvent.Connected,()=>{var n,s;this.connectionState=J.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(s=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&s.includes("voice")&&setTimeout(async()=>{var r;try{(r=this.room)!=null&&r.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(i){console.warn("VoxketClient: Failed to enable microphone after room connection:",i)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(J.RoomEvent.Disconnected,n=>{this.connectionState=J.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(J.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===J.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(J.RoomEvent.ParticipantConnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",s)}),this.room.on(J.RoomEvent.ParticipantDisconnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",s)}))}setupTextStreamHandlers(){if(this.room){try{this.room.registerTextStreamHandler("lk.chat",async(n,s)=>{try{const r=await n.readAll(),i={id:`msg_${Date.now()}_${s.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:r,timestamp:new Date,sender:{id:s.identity||"user",name:s.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",i)}catch(r){console.error("VoxketClient: Failed to process lk.chat message:",r)}})}catch(n){console.warn("VoxketClient: lk.chat handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("lk.transcription",async(n,s)=>{var r,i;try{const o=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let a="";const l=((r=this.currentAgentInfo)==null?void 0:r.name)||s.identity||"AI Assistant",d={id:o,content:"",timestamp:new Date,sender:{id:s.identity||"agent",name:l,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",d);for await(const m of n){a+=m;const g=this.convertMarkdownToText(a),x={...d,content:g,metadata:{...d.metadata,streaming:!0}};this.emit("chat.message.updated",x)}const u=this.convertMarkdownToText(a),h={...d,content:u,metadata:{...d.metadata,streaming:!1}};this.emit("chat.message.updated",h)}catch(o){console.error("VoxketClient: Failed to process lk.transcription message:",o);try{const a=await n.readAll(),l=((i=this.currentAgentInfo)==null?void 0:i.name)||s.identity||"AI Assistant",d={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:a,timestamp:new Date,sender:{id:s.identity||"agent",name:l,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",d)}catch(a){console.error("VoxketClient: Fallback failed for lk.transcription:",a)}}})}catch(n){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("suggested_response",async n=>{const s=await n.readAll();let r=[];try{r=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(i){console.warn("VoxketClient: Failed to parse suggested_response:",i,s)}this.emit("suggested.response",r)})}catch(n){console.warn("VoxketClient: suggested_response handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("agent_state_changed",async(n,s)=>{const r=await n.readAll();let i={};try{i=typeof r=="string"?JSON.parse(r.replace(/'/g,'"')):r}catch(o){console.warn("VoxketClient: Failed to parse agent_state_changed:",o,r)}i.new_state==="speaking"?this.emit("agent.speaking",i):i.new_state==="thinking"&&this.emit("agent.thinking",i)})}catch(n){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("images",async(n,s)=>{try{const r=await n.readAll()}catch(r){console.error("VoxketClient: Error processing images stream:",r)}})}catch(n){console.warn("VoxketClient: images handler already registered, skipping:",n)}try{this.room.registerByteStreamHandler("images",async(n,s)=>{var r,i;try{const o=n.info,a={id:`img_${Date.now()}_${s.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${o.name||"Image"}`,sender:{id:s.identity||"agent",name:s.identity||"Agent",type:s.identity===((i=(r=this.room)==null?void 0:r.localParticipant)==null?void 0:i.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.mimeType,streamId:o.id,downloading:!0}};this.emit("chat.message.received",a),n.onProgress&&(n.onProgress=m=>{const g={...a,metadata:{...a.metadata,downloadProgress:m||0}};this.emit("chat.message.updated",g)});const l=[];for await(const m of n)l.push(m);const d=new Blob(l,{type:o.mimeType||"application/octet-stream"}),u=URL.createObjectURL(d),h={...a,metadata:{...a.metadata,downloading:!1,downloadProgress:1,downloadUrl:u,blob:d}};this.emit("chat.message.updated",h)}catch(o){console.error("VoxketClient: Error processing image attachment:",o)}})}catch(n){console.warn("VoxketClient: image handler already registered, skipping:",n)}this.textStreamHandlersRegistered=!0}}async fetchConnectionDetails(n,s,r){const i=n||this.config.agentId||"default-agent",o=s||this.config.participantName||"User",a=r||this.config.modalities||["voice"];try{const l={agent_id:i,participant_name:o,participant_metadata:{user_id:""},modality:a[0]},d=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!d.ok){let m=`HTTP ${d.status}: Failed to fetch connection details`;try{const g=await d.json();g&&(g.error?m=`API Error: ${g.error}`:g.detail?m=`API Error: ${g.detail}`:g.message&&(m=`API Error: ${g.message}`))}catch{try{const x=await d.text();x&&(m=`API Error: ${x}`)}catch{}}throw new Error(m)}const u=await d.json();let h;return u.agent_info&&(h={id:u.agent_info.id||i,name:u.agent_info.name||"AI Assistant",avatar:u.agent_info.avatar,capabilities:u.agent_info.capabilities||["voice_interaction","text_chat"],metadata:u.agent_info.metadata||{}},this.currentAgentInfo=h),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:h}}catch(l){console.error("VoxketClient: fetchConnectionDetails failed:",l);const d=new pe(`Failed to fetch connection details: ${l instanceof Error?l.message:"Unknown error"}`,"CONNECTION_FAILED",l);throw this.emit("connection.error",d),d}}async connect(n,s,r){var i;try{this.emit("connection.connecting");const o=await this.fetchConnectionDetails(n,s,r);return await((i=this.room)==null?void 0:i.connect(o.serverUrl,o.participantToken)),this.isConnected=!0,o}catch(o){console.error("VoxketClient: Connection failed:",o);const a=new pe(`Failed to connect to Voxket services: ${o instanceof Error?o.message:"Unknown error"}`,"CONNECTION_FAILED",o);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new J.Room,this.setupRoomEventListeners()}catch(s){const r=new pe("Failed to disconnect properly","NETWORK_ERROR",s);throw this.emit("connection.error",r),r}}async createSession(n){var s,r;try{const i=await this.connect(n.agentId,n.participantName,n.modalities),o={id:i.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:i.agentInfo||this.currentAgentInfo};if(this.currentSession=o,this.emit("session.created",o),(s=n.modalities)!=null&&s.includes("voice"))try{await new Promise(a=>setTimeout(a,500)),(r=this.room)!=null&&r.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(a){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",a)}return setTimeout(()=>{this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state))},1e3),o}catch(i){throw console.error("VoxketClient: Failed to create session:",i),i instanceof pe?i:i instanceof TypeError&&i.message.includes("fetch")?new pe("Network connection failed","CONNECTION_FAILED",i):i instanceof Error&&i.message.includes("Failed to fetch connection details")?new pe(`API connection failed: ${i.message}`,"CONNECTION_FAILED",i):new pe(`Failed to create session: ${i instanceof Error?i.message:"Unknown error"}`,"SESSION_NOT_FOUND",i)}}async startSession(n,s){const r={agentId:n||this.config.agentId||"default-agent",participantName:(s==null?void 0:s.participantName)||this.config.participantName||"User",modalities:(s==null?void 0:s.modalities)||this.config.modalities||["voice","chat"],metadata:s==null?void 0:s.metadata};return this.createSession(r)}async endSession(){var n,s;if(!this.currentSession)return null;try{const r={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,r),await this.disconnect(),r}catch(r){throw new pe("Failed to end session","SESSION_NOT_FOUND",r)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(r=>r.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const s=this.chatMessages.findIndex(r=>r.id===n.id);s!==-1&&(this.chatMessages[s]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var l,d,u;const s=this.resolveTarget(n.target||"body"),r=this.getTargetKey(s),i=this.renderedComponents.get(r);i&&i.target===s||this.removeUI(s);const o=(i==null?void 0:i.root)||A2.createRoot(s),a={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((l=n.modality)==null?void 0:l.includes("chat"))!==!1,suportsVideoInput:((d=n.modality)==null?void 0:d.includes("video"))===!0,suportsScreenShare:((u=n.modality)==null?void 0:u.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};o.render(E.createElement(Qu,{config:this.config,autoConnect:n.autoStart||!1,children:E.createElement(ef,a)})),this.renderedComponents.set(r,{root:o,target:s})}removeUI(n){const s=n?this.resolveTarget(n):null;if(s){const r=this.getTargetKey(s),i=this.renderedComponents.get(r);i&&(i.root.unmount(),this.renderedComponents.delete(r),s.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(a=>{try{a.remove()}catch(l){console.warn("Failed to remove element:",l)}}),s===document.body&&s.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(l=>{if(l.classList.contains("bg-black")&&l.classList.contains("backdrop-blur-sm"))try{l.remove()}catch(d){console.warn("Failed to remove fixed element:",d)}}))}}removeAllUI(){for(const[n,s]of this.renderedComponents)s.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(s=>{if(s.classList.contains("bg-black")&&(s.classList.contains("backdrop-blur-sm")||s.classList.contains("bg-opacity-30")))try{s.remove()}catch(r){console.warn("Failed to remove overlay:",r)}})}resolveTarget(n){if(typeof n=="string"){const s=document.querySelector(n);if(!s)throw new Error(`Target element not found: ${n}`);return s}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,s){var r;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new pe("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new pe("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new pe("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const i={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:s||{}},o=await((r=this.room)==null?void 0:r.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",i)}catch(i){throw console.error("VoxketClient: Failed to send chat message:",i),new pe("Failed to send message","NETWORK_ERROR",i)}}async sendChatMessage(n,s){return this.sendMessage(n,s)}async sendAttachments(n,s){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new pe("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new pe("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new pe("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new pe("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(i=>i.type.startsWith("image/"));if(r.length===0)throw new pe("Only image files are allowed","INVALID_PARAMETER");r.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const i=r.map(async(o,a)=>{const d={id:`att_${Date.now()}_${a}`,content:`📎 ${o.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...s,type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.type,uploading:!0}};this.emit("chat.message.sent",d);const u=await this.room.localParticipant.sendFile(o,{mimeType:o.type,topic:"images",onProgress:m=>{const g={...d,metadata:{...d.metadata,uploadProgress:m}};this.emit("chat.message.updated",g)}});try{const m=new FileReader,g=new Promise((v,b)=>{m.onload=()=>{typeof m.result=="string"?v(m.result):b(new Error("Failed to convert to base64"))},m.onerror=b});m.readAsDataURL(o);const p={type:"image",data:await g,filename:o.name,mimeType:o.type,size:o.size};await this.room.localParticipant.sendText(JSON.stringify(p),{topic:"images",destinationIdentities:[]})}catch(m){console.warn("VoxketClient: Failed to send image data to agent:",m);try{const g=`I've shared an image: ${o.name}`;await this.room.localParticipant.sendText(g,{topic:"lk.chat",destinationIdentities:[]})}catch(g){console.warn("VoxketClient: Failed to send image notification to agent:",g)}}const h={...d,metadata:{...d.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",h),u});await Promise.all(i)}catch(i){throw console.error("VoxketClient: Failed to send attachments:",i),new pe("Failed to send attachments","NETWORK_ERROR",i)}}async sendAttachment(n,s){return this.sendAttachments([n],s)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var s,r;try{const i=(s=this.room)==null?void 0:s.localParticipant.isMicrophoneEnabled,o=n??!i;await((r=this.room)==null?void 0:r.localParticipant.setMicrophoneEnabled(o)),o?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(i){throw console.error("VoxketClient: Failed to toggle microphone:",i),new pe("Failed to toggle microphone","PERMISSION_DENIED",i)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var s,r;try{const i=(s=this.room)==null?void 0:s.localParticipant.isCameraEnabled,o=n??!i;await((r=this.room)==null?void 0:r.localParticipant.setCameraEnabled(o)),o?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(i){throw console.error("VoxketClient: Failed to toggle camera:",i),new pe("Failed to toggle camera","PERMISSION_DENIED",i)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(s){throw new pe("Failed to start screen share","PERMISSION_DENIED",s)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(s){throw new pe("Failed to stop screen share","PERMISSION_DENIED",s)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="audioinput")}catch(n){throw new pe("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput")}catch(n){throw new pe("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new pe("Failed to set audio input device","DEVICE_ERROR",r)}}async setVideoInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new pe("Failed to set video input device","DEVICE_ERROR",r)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const s=n.permissions;if(!s)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const r=i=>!!s.canPublish&&(s.canPublishSources.length===0||s.canPublishSources.includes(i));return{camera:r(1),microphone:r(2),screenShare:r(3),data:s.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===J.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===J.Track.Source.Microphone)return s.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===J.Track.Source.Camera)return s.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===J.Track.Source.ScreenShare)return s.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(s=>{n.push({id:s.identity,name:s.name||s.identity,isLocal:!1})}),n}getSessionMetrics(){var n,s;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new pe("Failed to start recording","RECORDING_ERROR",s)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new pe("Failed to stop recording","RECORDING_ERROR",s)}}async registerFrontendRPC(n,s,r="embedded"){return this.rpcManager.registerFrontendRPC(n,s,r)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,s){return this.on(n,s)}registerEventEmitter(n,s){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async r=>{try{const i=await r.readAll();s(i)}catch(i){console.error(`Error processing event for topic '${n}':`,i)}})}catch(r){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,r)}}convertMarkdownToText(n){if(!n)return"";let s=n;return s=s.replace(/\*\*(.*?)\*\*/g,"$1"),s=s.replace(/__(.*?)__/g,"$1"),s=s.replace(/\*(.*?)\*/g,"$1"),s=s.replace(/_(.*?)_/g,"$1"),s=s.replace(/~~(.*?)~~/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/```[\s\S]*?```/g,""),s=s.replace(/^#{1,6}\s+/gm,""),s=s.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),s.trim()}}const R2=ce.create(l2),V2=ce.create(y2),I2=ce.create(w2),D2=ce.create(E2);function L2({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:s}){const r={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},i=Ve(s);return c.jsx(ce.button,{onClick:e,className:`fixed ${r[n]} z-50 px-4 py-2 rounded-full shadow-lg ${i.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:t})}function Nl({children:e,theme:t,displayType:n="widget",onClose:s,popupPosition:r="bottom-right",onExpand:i}){const o=Ve(t);if(n==="fullscreen")return c.jsx("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",children:c.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",children:[s&&c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),s()},className:"absolute top-4 cursor-pointer right-4 z-[100] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),c.jsxs("div",{id:"voice-card",className:`${o.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[c.jsx("div",{className:o.cardTopGradient}),c.jsx("div",{className:o.cardPurpleBlur}),c.jsx("div",{className:o.cardPinkBlur}),c.jsx("div",{className:" flex flex-col h-full",children:e}),c.jsx("div",{className:o.cardPulse1}),c.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return c.jsx("div",{className:"fixed rounded-2xl inset-0 z-50 pointer-events-none",children:c.jsxs("div",{className:`fixed rounded-2xl ${a[r]} pointer-events-auto`,children:[s&&c.jsx("button",{onClick:s,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),c.jsxs("div",{id:"voice-card",className:`${o.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[c.jsx("div",{className:o.cardPurpleBlur}),c.jsx("div",{className:o.cardPinkBlur}),c.jsx("div",{className:" flex flex-col h-full",children:e}),c.jsx("div",{className:o.cardPulse1}),c.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return c.jsxs("div",{id:"voice-card",className:`${o.card}`,children:[i&&c.jsx("button",{onClick:i,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),c.jsx("div",{className:o.cardTopGradient}),c.jsx("div",{className:o.cardPurpleBlur}),c.jsx("div",{className:o.cardPinkBlur}),e,c.jsx("div",{className:o.cardPulse1}),c.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})}function ef(e){if(typeof window>"u")return null;console.log("🎯 Widget component rendering with props:",{displayType:e.displayType,popupPosition:e.popupPosition,theme:e.theme});const{agentId:t,participantName:n,baseUrl:s,appSecret:r,appId:i,prompts:o,statusMessage:a,welcomeTitle:l,welcomeSubTitle:d,className:u,width:h,height:m,loadingText:g,suportsChatInput:x=!0,suportsVideoInput:p=!0,suportsScreenShare:v=!0,theme:b="vox",onSessionStart:y,onSessionEnd:w,enableSessionLogging:S=!0,onSessionLogsUpdate:k,onSessionMetricsUpdate:T,modalities:A=["voice"],displayType:j="widget",popupPosition:V="bottom-right",popupTriggerText:I="Open Chat",onPopupToggle:$,voxketClient:F,onDisplayTypeChange:se}=e,[Z,ee]=f.useState(()=>F?!!F.getCurrentSession():!1),[G,O]=f.useState(!1),[P,B]=f.useState(t||""),[X,_]=f.useState(n||"User"),[re,M]=f.useState(()=>F?F.getCurrentSession():null),[H,q]=f.useState(()=>{var ae,qe,$e;if(F){const xe=F.getCurrentSession();if((ae=xe==null?void 0:xe.activeModalities)!=null&&ae.includes("chat"))return"chat";if((qe=xe==null?void 0:xe.activeModalities)!=null&&qe.includes("voice"))return"voice";if(($e=xe==null?void 0:xe.activeModalities)!=null&&$e.includes("video"))return"video"}return"welcome"}),[U,N]=f.useState(!1);f.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",j)},[j]),f.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:H,sessionStarted:Z,loading:G,currentSession:re==null?void 0:re.id,isPopupOpen:U})},[H,Z,G,re,U]);const L=f.useMemo(()=>{if(F)return console.log("🔄 Using passed VoxketClient to preserve session state"),F;console.log("🆕 Creating new VoxketClient instance");const ae={appId:i,appSecret:r,baseUrl:s,agentId:P,participantName:X||"User",modalities:A};return new es(ae)},[F,i,r,s,P,X,A]),W=A,D=f.useMemo(()=>L.getRoom()||new J.Room,[L]),ne={suportsChatInput:x,suportsVideoInput:p,suportsScreenShare:v},{sessionMetrics:te,sessionLogs:de,logEvent:me}=Xu({room:D,onSessionStart:y,onSessionEnd:w,enableConsoleLogging:S,enableLocalStorage:S,voxketSessionId:re==null?void 0:re.id});f.useEffect(()=>{k&&k(de)},[de,k]),f.useEffect(()=>{T&&te&&T(te)},[te,T]),f.useEffect(()=>{const ae=$e=>{console.log("🔴 Room disconnected:",$e),O(!1),ee(!1),M(null),q("welcome")},qe=$e=>{console.log("📹 Media devices error:",$e),cs({title:"Allow access to your microphone/camera",description:`${$e.name}: ${$e.message}`})};return D.on(J.RoomEvent.MediaDevicesError,qe),D.on(J.RoomEvent.Disconnected,ae),()=>{D.off(J.RoomEvent.Disconnected,ae),D.off(J.RoomEvent.MediaDevicesError,qe)}},[D]);const Ae=async()=>{try{console.log("🎤 Starting voice session...",{agentId:P,participantName:X}),console.log("🎤 Pre-start state:",{currentMode:H,sessionStarted:Z,loading:G}),O(!0),ee(!0),q("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),me("USER_STARTED_VOICE_SESSION",{agentId:P,participantName:X});const ae=await L.startSession(P,{participantName:X||"User",modalities:["voice",...p?["video"]:[]]});console.log("✅ Voice session started successfully:",ae.id),M(ae),O(!1),y&&y(ae.id)}catch(ae){console.error("❌ Failed to start voice session:",ae),cs({title:"Failed to start voice session",description:ae instanceof Error?ae.message:"Unknown error occurred"}),O(!1),ee(!1),q("welcome")}},De=async()=>{try{O(!0),ee(!0),q("chat"),me("USER_STARTED_CHAT_SESSION",{agentId:P,participantName:X});const ae=await L.startSession(P,{participantName:X||"User",modalities:["chat"]});M(ae),O(!1),y&&y(ae.id)}catch(ae){console.error("Failed to start chat session:",ae),cs({title:"Failed to start chat session",description:ae instanceof Error?ae.message:"Unknown error occurred"}),O(!1),ee(!1),q("welcome")}},rt=async()=>{try{console.log("📺 Starting video session...",{agentId:P,participantName:X}),console.log("📺 Pre-start state:",{currentMode:H,sessionStarted:Z,loading:G}),O(!0),ee(!0),q("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),me("USER_STARTED_VIDEO_SESSION",{agentId:P,participantName:X});const ae=await L.startSession(P,{participantName:X||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",ae.id),M(ae),O(!1),y&&y(ae.id)}catch(ae){console.error("❌ Failed to start video session:",ae),cs({title:"Failed to start video session",description:ae instanceof Error?ae.message:"Unknown error occurred"}),O(!1),ee(!1),q("welcome")}},ot=()=>{q("welcome"),se&&se(e.displayType||"widget"),re&&Z&&(ee(!1),M(null),L.disconnect()),j==="popup"&&!U&&N(!0)},Fe=()=>{const ae=!U;N(ae),$&&$(ae),!ae&&!(re&&Z)&&(q("welcome"),ee(!1),M(null))},Gs=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},Xs=()=>{e.onDisplayTypeChange&&e.onDisplayTypeChange("fullscreen")};f.useEffect(()=>{var ae,qe,$e;if(F&&L){console.log("🔄 Syncing widget state with existing client session state");const xe=L.getCurrentSession(),qs=L.connected;console.log("🔍 Existing session state:",{hasSession:!!xe,sessionId:xe==null?void 0:xe.id,isConnected:qs,activeModalities:xe==null?void 0:xe.activeModalities}),xe&&(console.log("✅ Restoring session state from existing client"),M(xe),ee(!0),O(!1),(ae=xe.activeModalities)!=null&&ae.includes("chat")?q("chat"):(qe=xe.activeModalities)!=null&&qe.includes("voice")?q("voice"):($e=xe.activeModalities)!=null&&$e.includes("video")&&q("video"))}},[F,L]),f.useEffect(()=>()=>{console.log("🧹 Cleaning up widget component"),F?console.log("🔄 Widget cleanup: preserving passed client instance"):(console.log("🧹 Widget cleanup: disconnecting self-created client"),L.disconnect())},[L,F]);let Rt="w-96",Tn="h-[25rem]",jn={};if(h&&(h.startsWith("w-")?Rt=h:(jn.width=h,Rt="")),m&&(m.startsWith("h-")?Tn=m:(jn.height=m,Tn="")),j==="popup"&&!U)return console.log("🟡 Showing popup trigger button"),c.jsx(L2,{onClick:Fe,text:I,position:V,theme:b});console.log("🟢 Rendering widget content, displayType:",j,"isPopupOpen:",U,"currentMode:",H,"sessionStarted:",Z,"loading:",G);let Yt=`voxket-widget-root theme-${b}`,Vt={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};j==="widget"?(Yt+=` flex items-center justify-center min-h-fit ${Rt} ${Tn} ${u}`,Vt={...Vt,...jn}):(Yt=`${u||""}`,Vt={});const Pn=c.jsx(c.Fragment,{children:c.jsxs(dn,{mode:"wait",children:[H==="welcome"&&!G&&c.jsx(D2,{agentId:P,participantName:X||"",onAgentIdChange:B,onParticipantNameChange:_,onStartCall:Ae,onStartChat:De,onStartVideo:rt,disabled:Z||G,prompts:o,statusMessage:a,title:l,subTitle:d,theme:b,modalities:W,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),H==="voice"&&c.jsxs(ke.RoomContext.Provider,{value:D,children:[c.jsx(ke.RoomAudioRenderer,{}),c.jsx(ke.StartAudio,{label:"Start Audio"}),c.jsx(R2,{loadingText:g,participantName:X||"User",capabilities:ne,sessionStarted:Z,disabled:!Z,theme:b,client:L,displayType:j,onBack:j==="popup"?Fe:ot,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),H==="chat"&&c.jsx(V2,{client:L,theme:b,displayType:j,onBack:j==="popup"?Fe:ot,onEndChat:ot,disabled:!Z,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),H==="video"&&c.jsxs(ke.RoomContext.Provider,{value:D,children:[c.jsx(ke.RoomAudioRenderer,{}),c.jsx(ke.StartAudio,{label:"Start Audio"}),c.jsx(I2,{client:L,theme:b,displayType:j,onBack:j==="popup"?Fe:ot,onEndCall:ot,disabled:!Z,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return j==="fullscreen"||j==="popup"?(console.log("📱 Rendering fullscreen/popup mode, displayType:",j),c.jsx(Nl,{theme:b,displayType:j,popupPosition:V,onClose:j==="fullscreen"?Gs:Fe,children:Pn})):(console.log("📦 Rendering widget mode"),c.jsx("div",{className:Yt,style:Vt,children:c.jsx(Nl,{theme:b,displayType:j,popupPosition:V,onExpand:Xs,children:Pn})}))}function F2({logs:e,onClear:t,onExport:n}){const[s,r]=E.useState(!1),[i,o]=E.useState(""),a=e.filter(l=>!i||l.event.toLowerCase().includes(i.toLowerCase()));return s?c.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[c.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"text",placeholder:"Filter events...",value:i,onChange:l=>o(l.target.value),className:"px-3 py-1 border rounded text-sm"}),c.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),c.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),c.jsx("button",{onClick:()=>r(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?c.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):c.jsx("div",{className:"space-y-2",children:a.map((l,d)=>c.jsxs("div",{className:"border rounded p-3 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"font-semibold text-blue-600",children:l.event}),c.jsx("span",{className:"text-gray-500 text-xs",children:new Date(l.timestamp).toLocaleTimeString()})]}),l.sessionId&&c.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",l.sessionId]}),l.data&&c.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:c.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(l.data,null,2)})})]},d))})})]})}):c.jsxs("button",{onClick:()=>r(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function O2({metrics:e}){return e?c.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[c.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Session ID:"}),c.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Start Time:"}),c.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Messages:"}),c.jsx("div",{children:e.totalMessages})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Participants:"}),c.jsx("div",{children:e.participantCount})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),c.jsx("div",{children:e.connectionIssues})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Duration:"}),c.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function Kt(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:s,endSession:r}=ht(),i=E.useCallback(async(a,l)=>await s(a,l),[s]),o=E.useCallback(async()=>await r(),[r]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:i,stop:o}}function tf(){const{sessionMetrics:e,currentSession:t}=ht();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function nf(){const{setMicrophoneEnabled:e,client:t}=ht(),[n,s]=E.useState(!1),[r,i]=E.useState(!1),o=E.useCallback(async()=>{if(!r){i(!0);try{const d=!n;await e(d),s(d)}catch(d){console.error("Failed to toggle microphone:",d)}finally{i(!1)}}},[n,r,e]),a=E.useCallback(async()=>{if(!(n||r)){i(!0);try{await e(!0),s(!0)}catch(d){console.error("Failed to enable microphone:",d)}finally{i(!1)}}},[n,r,e]),l=E.useCallback(async()=>{if(!(!n||r)){i(!0);try{await e(!1),s(!1)}catch(d){console.error("Failed to disable microphone:",d)}finally{i(!1)}}},[n,r,e]);return{isEnabled:n,isLoading:r,toggle:o,enable:a,disable:l}}function sf(){const{setCameraEnabled:e}=ht(),[t,n]=E.useState(!1),[s,r]=E.useState(!1),i=E.useCallback(async()=>{if(!s){r(!0);try{const l=!t;await e(l),n(l)}catch(l){console.error("Failed to toggle camera:",l)}finally{r(!1)}}},[t,s,e]),o=E.useCallback(async()=>{if(!(t||s)){r(!0);try{await e(!0),n(!0)}catch(l){console.error("Failed to enable camera:",l)}finally{r(!1)}}},[t,s,e]),a=E.useCallback(async()=>{if(!(!t||s)){r(!0);try{await e(!1),n(!1)}catch(l){console.error("Failed to disable camera:",l)}finally{r(!1)}}},[t,s,e]);return{isEnabled:t,isLoading:s,toggle:i,enable:o,disable:a}}function rf(){const{startScreenShare:e,stopScreenShare:t}=ht(),[n,s]=E.useState(!1),[r,i]=E.useState(!1),o=E.useCallback(async()=>{if(!(n||r)){i(!0);try{await e(),s(!0)}catch(d){console.error("Failed to start screen share:",d)}finally{i(!1)}}},[n,r,e]),a=E.useCallback(async()=>{if(!(!n||r)){i(!0);try{await t(),s(!1)}catch(d){console.error("Failed to stop screen share:",d)}finally{i(!1)}}},[n,r,t]),l=E.useCallback(async()=>{n?await a():await o()},[n,o,a]);return{isSharing:n,isLoading:r,start:o,stop:a,toggle:l}}function _2(){const{client:e}=ht(),[t,n]=E.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),s=E.useMemo(()=>t.tracks.find(p=>p.isLocal),[t.tracks]),r=E.useMemo(()=>t.tracks.filter(p=>!p.isLocal),[t.tracks]),i=E.useCallback(async()=>{try{s!=null&&s.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(p){throw console.error("Failed to toggle camera:",p),p}},[e,s]),o=E.useCallback(async()=>{try{t.tracks.find(v=>v.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(p){throw console.error("Failed to toggle screen share:",p),p}},[e,t.tracks]),a=E.useCallback(p=>{n(v=>({...v,layout:p}))},[]),l=E.useCallback(p=>{n(v=>({...v,pinnedTrack:p}))},[]),d=E.useCallback(()=>{n(p=>({...p,pinnedTrack:void 0}))},[]),u=E.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(p=>({...p,isRecording:!0}))}catch(p){throw console.error("Failed to start recording:",p),p}},[e]),h=E.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(p=>({...p,isRecording:!1}))}catch(p){throw console.error("Failed to stop recording:",p),p}},[e]),m=E.useCallback(p=>t.tracks.find(v=>v.id===p),[t.tracks]),g=E.useCallback(p=>t.tracks.filter(v=>v.participantId===p),[t.tracks]),x=E.useCallback(p=>p.isEnabled&&t.tracks.includes(p),[t.tracks]);return E.useEffect(()=>{if(!e)return;const p=y=>{n(w=>({...w,tracks:[...w.tracks.filter(S=>S.id!==y.id),y]}))},v=y=>{n(w=>{var S;return{...w,tracks:w.tracks.filter(k=>k.id!==y),pinnedTrack:((S=w.pinnedTrack)==null?void 0:S.id)===y?void 0:w.pinnedTrack}})},b=y=>{n(w=>({...w,tracks:w.tracks.map(S=>S.id===y.id?y:S)}))};return e.on("videoTrackAdded",p),e.on("videoTrackRemoved",v),e.on("videoTrackUpdated",b),()=>{e.off("videoTrackAdded",p),e.off("videoTrackRemoved",v),e.off("videoTrackUpdated",b)}},[e]),{tracks:t.tracks,localTrack:s,remoteTraracks:r,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:i,toggleScreenShare:o,setLayout:a,pinTrack:l,unpinTrack:d,startRecording:u,stopRecording:h,getTrackById:m,getTracksByParticipant:g,isTrackActive:x}}function Ys(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=ht(),[s,r]=E.useState(!1),i=E.useCallback(async d=>{if(!(!d.trim()||s||!n)){r(!0);try{await t(d.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{r(!1)}}},[t,s,n]),{userMessages:o,agentMessages:a,allMessages:l}=E.useMemo(()=>{const d=e.filter(h=>h.sender.type==="participant"),u=e.filter(h=>h.sender.type==="agent");return{userMessages:d,agentMessages:u,allMessages:e}},[e]);return{messages:l,userMessages:o,agentMessages:a,messageCount:l.length,isSending:s,canSend:!!n&&!s,send:i}}function $2(){const{send:e,isSending:t,canSend:n}=Ys(),[s,r]=E.useState(""),i=E.useCallback(async()=>{if(!(!s.trim()||!n))try{await e(s),r("")}catch(a){throw a}},[s,e,n]),o=E.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),i())},[i]);return{value:s,setValue:r,send:i,handleKeyPress:o,isSending:t,canSend:n&&s.trim().length>0}}function gi(){const{isConnected:e,isConnecting:t,connectionError:n,connect:s,disconnect:r}=ht(),i=E.useCallback(async()=>{if(!(e||t))try{await s()}catch(a){throw console.error("Failed to connect:",a),a}},[s,e,t]),o=E.useCallback(async()=>{if(e)try{await r()}catch(a){throw console.error("Failed to disconnect:",a),a}},[r,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:i,disconnect:o}}function of(){const{participants:e}=ht();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const af=E.createContext({}),ts=()=>E.useContext(af);function lf({children:e,...t}){return c.jsx(af.Provider,{value:t,children:e})}function Cs({name:e,children:t,fallback:n,className:s}){return c.jsx("div",{className:`voxket-slot voxket-slot--${e} ${s||""}`,children:t||n})}function cf(e,t={}){return Object.assign(e,t)}function df({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:s=!0,customControls:r,className:i=""}){const o=Kt(),a=nf(),l=sf(),d=rf(),u=ts(),h=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,o.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",i].filter(Boolean).join(" ");return!o.isActive&&!s?c.jsx("div",{className:h,children:c.jsx("div",{className:"voxket-controls-inactive",children:c.jsx("p",{children:"Controls available during active session"})})}):c.jsxs("div",{className:h,children:[s&&c.jsx("div",{className:"voxket-session-actions",children:o.isActive?c.jsx("button",{onClick:o.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):c.jsx(B2,{})}),o.isActive&&c.jsxs("div",{className:"voxket-media-controls",children:[e&&c.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[c.jsx("span",{className:"voxket-icon",children:"🎤"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),t&&c.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isEnabled?"voxket-button--active":""}`,title:l.isEnabled?"Stop camera":"Start camera",children:[c.jsx("span",{className:"voxket-icon",children:"📹"}),l.isLoading?"Loading...":l.isEnabled?"Stop Video":"Start Video"]}),n&&c.jsxs("button",{onClick:d.toggle,disabled:d.isLoading,className:`voxket-button voxket-button--media ${d.isSharing?"voxket-button--active":""}`,title:d.isSharing?"Stop screen share":"Start screen share",children:[c.jsx("span",{className:"voxket-icon",children:"🖥️"}),d.isLoading?"Loading...":d.isSharing?"Stop Share":"Share Screen"]})]}),r&&c.jsx("div",{className:"voxket-custom-controls",children:r})]})}function B2(){Kt();const[e,t]=E.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(s){console.error("Failed to start session:",s)}finally{t(!1)}};return c.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function xi({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:s=""}){const r=Kt(),i=gi(),o=ts(),a=["voxket-session-header",`voxket-session-header--${o.variant||"default"}`,`voxket-session-header--${o.size||"md"}`,s].filter(Boolean).join(" ");return c.jsxs("div",{className:a,children:[e&&c.jsxs("div",{className:"voxket-connection-status",children:[c.jsx("div",{className:`voxket-status-indicator ${i.isConnected?"connected":"disconnected"}`}),c.jsx("span",{className:"voxket-status-text",children:i.isConnecting?"Connecting...":i.isConnected?"Connected":"Disconnected"})]}),t&&r.session&&c.jsxs("div",{className:"voxket-session-info",children:[c.jsxs("div",{className:"voxket-session-id",children:["Session: ",r.session.id.slice(-8)]}),c.jsxs("div",{className:"voxket-session-state",children:["State: ",r.state]})]}),n&&r.session&&c.jsxs("div",{className:"voxket-agent-info",children:[c.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",r.session.agentId]}),c.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",r.session.activeModalities.join(", ")]})]}),i.error&&c.jsxs("div",{className:"voxket-error-message",children:["Error: ",i.error.message]})]})}function yi({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:s=""}){const r=Kt(),i=Ys(),o=ts(),a=["voxket-session-content",`voxket-session-content--${o.variant||"default"}`,`voxket-session-content--${o.size||"md"}`,s].filter(Boolean).join(" ");return r.isActive?c.jsx("div",{className:a,children:n||c.jsxs(c.Fragment,{children:[e&&c.jsxs("div",{className:"voxket-chat-container",children:[c.jsxs("div",{className:"voxket-chat-messages",children:[i.messages.map(l=>c.jsxs("div",{className:`voxket-message voxket-message--${l.sender.type}`,children:[c.jsxs("div",{className:"voxket-message-header",children:[c.jsx("span",{className:"voxket-message-sender",children:l.sender.name}),c.jsx("span",{className:"voxket-message-time",children:l.timestamp.toLocaleTimeString()})]}),c.jsx("div",{className:"voxket-message-content",children:l.content})]},l.id)),i.messages.length===0&&c.jsx("div",{className:"voxket-empty-messages",children:c.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),c.jsx(H2,{})]}),t&&c.jsx("div",{className:"voxket-transcriptions",children:c.jsx("div",{className:"voxket-transcription-placeholder",children:c.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):c.jsx("div",{className:a,children:c.jsx("div",{className:"voxket-inactive-state",children:c.jsxs("div",{className:"voxket-inactive-message",children:[c.jsx("h3",{children:"Start a conversation"}),c.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function H2(){const e=Ys(),[t,n]=E.useState(""),s=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(i){console.error("Failed to send message:",i)}},r=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),s())};return c.jsxs("div",{className:"voxket-chat-input",children:[c.jsx("input",{type:"text",value:t,onChange:i=>n(i.target.value),onKeyPress:r,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),c.jsx("button",{onClick:s,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function vi({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:s,className:r=""}){const i=Kt(),o=tf(),a=of(),l=ts(),d=["voxket-session-footer",`voxket-session-footer--${l.variant||"default"}`,`voxket-session-footer--${l.size||"md"}`,r].filter(Boolean).join(" ");return i.isActive?c.jsx("div",{className:d,children:s||c.jsxs(c.Fragment,{children:[n&&c.jsxs("div",{className:"voxket-session-status",children:[c.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),c.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&o.metrics&&c.jsxs("div",{className:"voxket-session-metrics",children:[c.jsxs("div",{className:"voxket-metric",children:[c.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),c.jsx("span",{className:"voxket-metric-value",children:U2(o.duration||0)})]}),c.jsxs("div",{className:"voxket-metric",children:[c.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),c.jsx("span",{className:"voxket-metric-value",children:o.metrics.messageCount})]})]}),t&&c.jsxs("div",{className:"voxket-participants-info",children:[c.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&c.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(u=>c.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):c.jsx("div",{className:d,children:c.jsx("div",{className:"voxket-footer-inactive",children:c.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function U2(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function z2({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:s,onSessionEnd:r,variant:i="default",size:o="md",theme:a,className:l="",children:d}){var g;const u=Kt(),h=gi();E.useEffect(()=>{n&&e&&h.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,h.isConnected,u.isActive]),E.useEffect(()=>{var x;(x=u.session)!=null&&x.id&&s&&s(u.session.id)},[(g=u.session)==null?void 0:g.id,s]),E.useEffect(()=>()=>{u.isActive&&r&&u.stop().then(r).catch(console.error)},[]);const m=["voxket-session",`voxket-session--${i}`,`voxket-session--${o}`,u.isActive?"voxket-session--active":"voxket-session--inactive",l].filter(Boolean).join(" ");return c.jsx(lf,{variant:i,size:o,theme:a,className:l,children:c.jsx("div",{className:m,children:d||c.jsxs(c.Fragment,{children:[c.jsx(Cs,{name:"header",fallback:c.jsx(xi,{})}),c.jsx(Cs,{name:"content",fallback:c.jsx(yi,{})}),c.jsx(Cs,{name:"footer",fallback:c.jsx(vi,{})})]})})})}const uf=cf(z2,{Header:xi,Content:yi,Footer:vi,Controls:df}),Ht={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},go={...Ht,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},xo={...Ht,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},ff=E.createContext(null),hf=()=>{const e=E.useContext(ff);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function Z2({theme:e="default",themes:t={},children:n,cssVariables:s=!0,className:r=""}){const[i,o]=E.useState(()=>{const m={default:Ht,dark:go,enterprise:xo,...t};return typeof e=="string"?m[e]||Ht:e}),[a,l]=E.useState(()=>({default:Ht,dark:go,enterprise:xo,...t})),d=m=>{if(typeof m=="string"){const g=a[m];g&&o(g)}else o(m)},u=m=>{l(g=>({...g,[m.name]:m}))};E.useEffect(()=>{if(s&&typeof document<"u"){const m=document.documentElement;Object.entries(mf(i)).forEach(([g,x])=>{m.style.setProperty(`--voxket-${g}`,x)})}},[i,s]);const h={theme:i,setTheme:d,themes:a,registerTheme:u};return c.jsx(ff.Provider,{value:h,children:c.jsx("div",{className:`voxket-theme voxket-theme--${i.name} ${r}`,children:n})})}function mf(e){const t={},n=(s,r="")=>{for(const[i,o]of Object.entries(s)){const a=r?`${r}-${i}`:i;typeof o=="object"&&o!==null&&!Array.isArray(o)?n(o,a):t[a]=String(o)}};return n(e),t}function W2(e=Ht,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function K2(e){var n;const{theme:t}=hf();return((n=t.components)==null?void 0:n[e])||{}}const Y2=pi("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&G2(e),t.enableVoiceActivation&&X2(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&q2(e,t)}});function G2(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function X2(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function q2(e,t){console.log("Playing audio response:",t.content)}const J2=pi("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&Q2(),t.enableFileUpload&&ew(e),t.enableCustomComponents&&tw(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?nw(e,t):t.type==="text"&&n.enableRichText&&sw(e,t)}});function Q2(e){console.log("Rich text support enabled")}function ew(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function tw(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",rw),t.set("form",ow),t.set("card",iw),t.set("chart",aw)}function nw(e,t){const{componentType:n,props:s}=t.metadata;console.log("Rendering custom component:",n,s),e.emit("chat.component.render",{type:n,props:s,timestamp:new Date})}function sw(e,t){console.log("Processing rich text message:",t.content)}function rw(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function ow(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function iw(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function aw(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function Es({track:e,participantName:t,showControls:n=!0,showName:s=!0,showMuteIndicator:r=!0,isPinned:i=!1,className:o="",onClick:a,onPin:l,onUnpin:d}){const u=E.useRef(null),[h,m]=E.useState(!1);E.useEffect(()=>{if(!u.current||!e.isEnabled)return;const v=u.current;return v.srcObject=null,()=>{v.srcObject&&(v.srcObject=null)}},[e]);const g=()=>{a==null||a(e)},x=v=>{v.stopPropagation(),i?d==null||d(e):l==null||l(e)},p=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",i?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",h?"voxket-video-tile--hovered":"",o].filter(Boolean).join(" ");return c.jsxs("div",{className:p,onClick:g,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[c.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&c.jsxs("div",{className:"voxket-video-placeholder",children:[c.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"🖥️":"📹"}),c.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),c.jsxs("div",{className:"voxket-video-overlay",children:[s&&t&&c.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),r&&!e.isEnabled&&c.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(h||i)&&c.jsxs("div",{className:"voxket-video-controls",children:[c.jsx("button",{className:`voxket-video-control-btn ${i?"voxket-video-control-btn--active":""}`,onClick:x,title:i?"Unpin video":"Pin video",children:"📌"}),e.isScreenShare&&c.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),e.source&&c.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&c.jsx("div",{className:"voxket-video-loading",children:c.jsx("div",{className:"voxket-spinner"})})]})}function lw({tracks:e,layout:t,className:n="",onLayoutChange:s,onTrackClick:r,maxVisibleTracks:i=9,showPagination:o=!0}){const[a,l]=E.useState(0),[d,u]=E.useState(null),h=E.useMemo(()=>{let y=[...e];t.type==="speaker"&&d&&(y=[d,...e.filter(k=>k.id!==d.id)]);const w=a*i,S=w+i;return y.slice(w,S)},[e,t,d,a,i]),m=Math.ceil(e.length/i),g=E.useMemo(()=>{const y=h.length;switch(t.type){case"grid":const w=Math.ceil(Math.sqrt(y)),S=Math.ceil(y/w);return{display:"grid",gridTemplateColumns:`repeat(${w}, 1fr)`,gridTemplateRows:`repeat(${S}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,h.length]),x=y=>{u(y)},p=()=>{u(null)},v=y=>{s==null||s({...t,type:y})},b=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${h.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?c.jsx("div",{className:"voxket-video-grid-empty",children:c.jsxs("div",{className:"voxket-video-grid-empty-content",children:[c.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),c.jsx("p",{children:"No video tracks available"})]})}):c.jsxs("div",{className:b,children:[c.jsxs("div",{className:"voxket-video-grid-controls",children:[c.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(y=>c.jsx("button",{className:`voxket-layout-btn ${t.type===y?"voxket-layout-btn--active":""}`,onClick:()=>v(y),title:`Switch to ${y} layout`,children:cw(y)},y))}),c.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),c.jsx("div",{className:"voxket-video-grid-content",style:g,children:t.type==="speaker"&&d?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"voxket-video-speaker-main",children:c.jsx(Es,{track:d,participantName:`Participant ${d.participantId}`,isPinned:!0,onClick:r,onUnpin:p})}),c.jsx("div",{className:"voxket-video-speaker-sidebar",children:h.filter(y=>y.id!==d.id).map(y=>c.jsx(Es,{track:y,participantName:`Participant ${y.participantId}`,showControls:!1,onClick:r,onPin:x},y.id))})]}):h.map(y=>c.jsx(Es,{track:y,participantName:`Participant ${y.participantId}`,isPinned:(d==null?void 0:d.id)===y.id,onClick:r,onPin:x,onUnpin:p},y.id))}),o&&m>1&&c.jsxs("div",{className:"voxket-video-pagination",children:[c.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.max(0,a-1)),disabled:a===0,children:"←"}),c.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",m]}),c.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.min(m-1,a+1)),disabled:a===m-1,children:"→"})]})]})}function cw(e){switch(e){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function dw({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:s,showLayoutControls:r=!0,showCameraControls:i=!0,showScreenShareControls:o=!0,className:a=""}){const l=["voxket-video-controls",a].filter(Boolean).join(" "),d=u=>{s==null||s({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return c.jsxs("div",{className:l,children:[i&&c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),c.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[c.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"📹":"📷"}),c.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&c.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," × ",e.dimensions.height]})]}),o&&c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),c.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[c.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"🛑":"🖥️"}),c.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),r&&c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),c.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:u,icon:h,label:m})=>c.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>d(u),title:`Switch to ${m} layout`,children:[c.jsx("span",{className:"voxket-control-icon",children:h}),c.jsx("span",{className:"voxket-control-label",children:m})]},u))})]}),c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),c.jsxs("div",{className:"voxket-video-settings",children:[c.jsxs("div",{className:"voxket-setting-group",children:[c.jsx("label",{className:"voxket-setting-label",children:"Quality"}),c.jsxs("select",{className:"voxket-setting-select",children:[c.jsx("option",{value:"high",children:"High (720p)"}),c.jsx("option",{value:"medium",children:"Medium (480p)"}),c.jsx("option",{value:"low",children:"Low (240p)"})]})]}),c.jsxs("div",{className:"voxket-setting-group",children:[c.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),c.jsxs("select",{className:"voxket-setting-select",children:[c.jsx("option",{value:"30",children:"30 fps"}),c.jsx("option",{value:"15",children:"15 fps"}),c.jsx("option",{value:"10",children:"10 fps"})]})]}),c.jsxs("div",{className:"voxket-setting-group",children:[c.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),c.jsxs("select",{className:"voxket-setting-select",children:[c.jsx("option",{value:"unlimited",children:"Unlimited"}),c.jsx("option",{value:"1000",children:"1 Mbps"}),c.jsx("option",{value:"500",children:"500 Kbps"}),c.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),c.jsxs("div",{className:"voxket-video-stats",children:[c.jsxs("div",{className:"voxket-stat-item",children:[c.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),c.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}×${e.dimensions.height}`:"N/A"})]}),c.jsxs("div",{className:"voxket-stat-item",children:[c.jsx("span",{className:"voxket-stat-label",children:"Source:"}),c.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),c.jsxs("div",{className:"voxket-stat-item",children:[c.jsx("span",{className:"voxket-stat-label",children:"Status:"}),c.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const pf=({handler:e,loadData:t,data:n,client:s,addLocalMessage:r})=>{const[i,o]=f.useState(null),[a,l]=f.useState(!0),[d,u]=f.useState(!1),[h]=f.useState(Date.now());f.useEffect(()=>{(async()=>{try{if(l(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const v={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};o(v),console.log("📋 AssignmentView: Assignment loaded from RPC data:",v)}}catch(v){console.error("📋 AssignmentView: Error loading assignment:",v),o({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{l(!1)}})()},[n,t]);const m=({message:p,assignment:v})=>{const b=p.toLowerCase().includes("declined"),y=b?"bg-red-50 border-red-200":"bg-green-50 border-green-200",w=b?"text-red-700":"text-green-700",S=b?"❌":"🎉";return c.jsxs("div",{className:`max-w-sm mx-auto ${y} border rounded-lg shadow p-3 flex flex-col items-center`,children:[c.jsx("div",{className:"text-2xl mb-2",children:S}),c.jsx("div",{className:`${w} font-semibold text-sm mb-1`,children:p}),c.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:v.title}),c.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},g=async()=>{if(!(!i||!e)){u(!0);try{const p={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",p),e.didSuccess(p,c.jsx(m,{message:"Assignment accepted!",assignment:i}))}catch(p){console.error("📋 AssignmentView: Error accepting assignment:",p),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},x=async()=>{if(!(!i||!e)){u(!0);try{const p={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",p),e.didSuccess(p,c.jsx(m,{message:"Assignment declined",assignment:i}))}catch(p){console.error("📋 AssignmentView: Error declining assignment:",p),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return a?c.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:c.jsxs("div",{className:"flex items-center justify-center py-4",children:[c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),c.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):i?c.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[c.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:c.jsx("div",{className:"flex items-center justify-between",children:c.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:i.title})})}),c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:c.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:i.description})}),c.jsx("div",{className:"mb-3",children:c.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[c.jsx("span",{className:"text-xs mr-1",children:"📅"}),c.jsxs("span",{children:["Est: ",i.estimated_time_of_completion]})]})}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:g,disabled:d,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?c.jsxs("span",{className:"flex items-center justify-center",children:[c.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),c.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),c.jsx("button",{onClick:x,disabled:d,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):c.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:c.jsxs("div",{className:"text-center py-4",children:[c.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),c.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function uw(){const[e,t]=f.useState(null),[n,s]=f.useState([]);f.useEffect(()=>{const a=new es({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(a),a.on("rpc.method.called",l=>{console.log("RPC Method Called:",l)}),a.on("rpc.interaction.completed",l=>{console.log("RPC Interaction Completed:",l)}),()=>{a.disconnect()}},[]);const r=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",pf,"embedded");const a=e.getRegisteredRpcMethods();s(a),console.log("✅ Assignment RPC registered successfully")}catch(a){console.error("❌ Failed to register assignment RPC:",a)}},i=async()=>{if(!e)return;const a=({handler:l,timeout:d})=>{const[u,h]=f.useState(""),m=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],g=p=>{h(p)},x=()=>{const p=m.find(v=>v.id===u);l==null||l.didSuccess({selectedProduct:u,productName:p==null?void 0:p.name,price:p==null?void 0:p.price,timestamp:new Date().toISOString()})};return c.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[c.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),c.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),c.jsx("div",{className:"space-y-3 mb-6",children:m.map(p=>c.jsx("div",{onClick:()=>g(p.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===p.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{children:[c.jsx("h4",{className:"font-medium",children:p.name}),c.jsx("p",{className:"text-gray-600 text-sm",children:p.price})]}),c.jsx("div",{className:`w-4 h-4 rounded-full ${u===p.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},p.id))}),c.jsxs("div",{className:"flex justify-end space-x-3",children:[c.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),c.jsx("button",{onClick:x,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),d&&c.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",d," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",a,"modal");const l=e.getRegisteredRpcMethods();s(l),console.log("✅ Product Recommendation RPC registered successfully")}catch(l){console.error("❌ Failed to register product recommendation RPC:",l)}},o=async()=>{if(!e)return;const a=({handler:l})=>{const[d,u]=f.useState(0),[h,m]=f.useState(""),g=()=>{l==null||l.didSuccess({rating:d,comment:h,timestamp:new Date().toISOString()})};return c.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[c.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),c.jsxs("div",{className:"mb-4",children:[c.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),c.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(x=>c.jsx("button",{onClick:()=>u(x),className:`text-2xl ${x<=d?"text-yellow-400":"text-gray-300"}`,children:"⭐"},x))})]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),c.jsx("textarea",{value:h,onChange:x=>m(x.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),c.jsxs("div",{className:"flex justify-end space-x-2",children:[c.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),c.jsx("button",{onClick:g,disabled:d===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",a,"embedded");const l=e.getRegisteredRpcMethods();s(l),console.log("✅ Feedback RPC registered successfully")}catch(l){console.error("❌ Failed to register feedback RPC:",l)}};return c.jsxs("div",{className:"p-6",children:[c.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),c.jsxs("div",{className:"space-y-4 mb-6",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),c.jsxs("div",{className:"space-x-2",children:[c.jsx("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),c.jsx("button",{onClick:i,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),c.jsx("button",{onClick:o,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?c.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>c.jsx("li",{className:"text-gray-700",children:c.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):c.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),c.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),c.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[c.jsxs("li",{children:["Register RPC methods with React components using ",c.jsx("code",{children:"client.registerFrontendRPC()"})]}),c.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),c.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),c.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),c.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),c.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[c.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),c.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),c.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
318
+ `,style:{minHeight:"2.5rem",display:o===i?"block":"none"},children:s},o))})}function $j({statusMessage:t,theme:e}){const n=St(e);return m.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[m.jsx("div",{className:n.statusIndicator}),m.jsx("span",{className:`text-xs ${n.text.muted}`,children:t})]})}const Hj=({disabled:t,onStartCall:e,onStartChat:n,onStartVideo:i,prompts:r=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:s="Agent is ready",title:o="Choose how to interact",subTitle:a="Ask me anything or give me a task to complete",theme:c="vox",modalities:l=["voice","chat","video"]})=>{const d=St(c),u=l.includes("voice"),f=l.includes("chat"),p=l.includes("video"),g=[u,f,p].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:l,hasVoice:u,hasChat:f,hasVideo:p,totalButtons:g,onStartVideo:!!i}),m.jsxs("div",{inert:t,className:"flex p-8 flex-col items-center h-full justify-center w-full",children:[m.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[m.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[m.jsx("div",{className:d.pulseRings.ring1}),m.jsx("div",{className:d.pulseRings.ring2,style:{animationDelay:"0.5s"}}),m.jsx("div",{className:d.pulseRings.ring3,style:{animationDelay:"1s"}})]}),m.jsx("div",{className:"relative z-10 flex items-center justify-center",children:u&&f&&p?m.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[m.jsx(Wo,{onClick:e,disabled:t,theme:c}),m.jsx(Bl,{onClick:n,disabled:t,theme:c}),m.jsx($l,{onClick:i||e,disabled:t,theme:c})]}):g>1?m.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[u&&m.jsx(Wo,{onClick:e,disabled:t,theme:c}),f&&m.jsx(Bl,{onClick:n,disabled:t,theme:c}),p&&i&&m.jsx($l,{onClick:i,disabled:t,theme:c})]}):m.jsx("div",{className:"flex items-center justify-center",children:u?m.jsx(Wo,{onClick:e,disabled:t,theme:c}):f?m.jsx(Bl,{onClick:n,disabled:t,theme:c}):p&&i?m.jsx($l,{onClick:i,disabled:t,theme:c}):m.jsx(Wo,{onClick:e,disabled:t,theme:c})})})]}),m.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[m.jsx("h3",{className:`text-xl font-semibold mb-2 ${d.text.accent}`,children:o}),m.jsx("p",{className:`text-sm leading-relaxed px-4 ${d.text.secondary}`,children:a}),g>1&&m.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[u&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(nw,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Voice"})]}),f&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(tw,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Chat"})]}),p&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(iw,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Video"})]})]})]}),m.jsx(Bj,{prompts:r,theme:c}),m.jsx($j,{statusMessage:s,theme:c})]})};function rw({room:t,onSessionEnd:e,onSessionStart:n,enableConsoleLogging:i=!0,enableLocalStorage:r=!0,voxketSessionId:s}={}){const[o,a]=v.useState(null),[c,l]=v.useState([]),[d,u]=v.useState(null),[f,p]=v.useState([]),g=v.useCallback((w,C)=>{const S={timestamp:new Date,event:w,data:C,sessionId:o==null?void 0:o.sessionId,participantId:d==null?void 0:d.identity};if(l(x=>[...x,S]),r){const x=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");x.push(S),localStorage.setItem("voxket-session-logs",JSON.stringify(x))}return S},[o==null?void 0:o.sessionId,d==null?void 0:d.identity,i,r]);v.useEffect(()=>{if(!t)return;const w=()=>{const k=s||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,I=new Date,N={sessionId:k,startTime:I,totalMessages:0,connectionIssues:0,participantCount:f.length,events:[]};a(N),g("SESSION_STARTED",{sessionId:k,startTime:I}),n==null||n(k)},C=()=>{if(o){const k=new Date,I=k.getTime()-o.startTime.getTime(),N={...o,endTime:k,duration:I,events:c};g("SESSION_ENDED",{sessionId:o.sessionId,duration:`${Math.round(I/1e3)}s`,totalMessages:o.totalMessages,connectionIssues:o.connectionIssues}),e==null||e(N),a(null),l([])}},S=k=>{g("CONNECTION_STATE_CHANGED",{state:k}),k===ge.Reconnecting&&o&&(a(I=>I?{...I,connectionIssues:I.connectionIssues+1}:null),g("CONNECTION_ISSUE",{type:"reconnecting"}))},x=k=>{g("TRACK_PUBLISHED",{trackKind:k.kind,trackSource:k.source})},T=k=>{g("TRACK_UNPUBLISHED",{trackKind:k.kind,trackSource:k.source})},E=(k,I)=>{o&&a(N=>N?{...N,totalMessages:N.totalMessages+1}:null),g("DATA_RECEIVED",{participantId:I==null?void 0:I.identity,dataSize:k.length})},P=k=>{g("PARTICIPANT_CONNECTED",{participantId:k.identity,participantName:k.name}),p(I=>[...I,k]),o&&a(I=>I?{...I,participantCount:I.participantCount+1}:null)},_=k=>{g("PARTICIPANT_DISCONNECTED",{participantId:k.identity,participantName:k.name}),p(I=>I.filter(N=>N.identity!==k.identity))};return t.localParticipant&&u(t.localParticipant),t.on(U.Connected,w),t.on(U.Disconnected,C),t.on(U.ConnectionStateChanged,S),t.on(U.TrackPublished,x),t.on(U.TrackUnpublished,T),t.on(U.DataReceived,E),t.on(U.ParticipantConnected,P),t.on(U.ParticipantDisconnected,_),()=>{t.off(U.Connected,w),t.off(U.Disconnected,C),t.off(U.ConnectionStateChanged,S),t.off(U.TrackPublished,x),t.off(U.TrackUnpublished,T),t.off(U.DataReceived,E),t.off(U.ParticipantConnected,P),t.off(U.ParticipantDisconnected,_)}},[t,o,c,f.length,g,e,n]);const h=v.useCallback(()=>r?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):c,[c,r]),y=v.useCallback(()=>{r&&localStorage.removeItem("voxket-session-logs"),l([])},[r]),b=v.useCallback(()=>{const w=h(),C=JSON.stringify(w,null,2),S="data:application/json;charset=utf-8,"+encodeURIComponent(C),x=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,T=document.createElement("a");T.setAttribute("href",S),T.setAttribute("download",x),T.click()},[h]);return{sessionMetrics:o,sessionLogs:c,logEvent:g,getSessionLogs:h,clearSessionLogs:y,exportSessionLogs:b}}var wr={},R0;function zj(){if(R0)return wr;R0=1;var t=xu;if(process.env.NODE_ENV==="production")wr.createRoot=t.createRoot,wr.hydrateRoot=t.hydrateRoot;else{var e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;wr.createRoot=function(n,i){e.usingClientEntryPoint=!0;try{return t.createRoot(n,i)}finally{e.usingClientEntryPoint=!1}},wr.hydrateRoot=function(n,i,r){e.usingClientEntryPoint=!0;try{return t.hydrateRoot(n,i,r)}finally{e.usingClientEntryPoint=!1}}}return wr}var Wj=zj();class rh{constructor(){at(this,"listeners",{})}on(e,n){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n),()=>this.off(e,n)}once(e,n){const i=(...r)=>{this.off(e,i),n(...r)};return this.on(e,i)}off(e,n){const i=this.listeners[e];if(!i)return;const r=i.indexOf(n);r>-1&&i.splice(r,1)}removeAllListeners(e){e?delete this.listeners[e]:this.listeners={}}emit(e,...n){const i=this.listeners[e];if(!i)return;const r=[...i];for(const s of r)try{s(...n)}catch(o){console.error(`Error in event listener for ${String(e)}:`,o)}}listenerCount(e){var n;return((n=this.listeners[e])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class sw{constructor(e){at(this,"plugins",new Map);at(this,"installedPlugins",new Set);at(this,"context");this.context={client:e,emit:e.emit.bind(e),on:e.on.bind(e),config:{}}}register(e){if(this.plugins.has(e.name))throw new Error(`Plugin '${e.name}' is already registered`);if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${e.name}' depends on '${n}' which is not registered`)}this.plugins.set(e.name,e)}async install(e,n){const i=this.plugins.get(e);if(!i)throw new Error(`Plugin '${e}' is not registered`);if(this.installedPlugins.has(e))throw new Error(`Plugin '${e}' is already installed`);if(i.dependencies)for(const s of i.dependencies)this.installedPlugins.has(s)||await this.install(s);const r={...this.context,config:{...i.config,...n}};i.install&&await i.install(r),this.installedPlugins.add(e),this.setupPluginEvents(i,r)}async uninstall(e){var i;const n=this.plugins.get(e);if(!n)throw new Error(`Plugin '${e}' is not registered`);if(this.installedPlugins.has(e)){for(const[r,s]of this.plugins)if(this.installedPlugins.has(r)&&((i=s.dependencies)!=null&&i.includes(e)))throw new Error(`Cannot uninstall '${e}' because '${r}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(e)}}isInstalled(e){return this.installedPlugins.has(e)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(e){return this.plugins.get(e)}setupPluginEvents(e,n){e.onSessionStart&&n.on("session.started",i=>{e.onSessionStart(n,i.id)}),e.onSessionEnd&&n.on("session.ended",i=>{e.onSessionEnd(n,i.id)}),e.onAgentResponse&&n.on("agent.response",i=>{e.onAgentResponse(n,i)})}}function qj(t){return t}function sh(t,e,n){return{name:t,version:"1.0.0",description:`${e} modality plugin`,install:async i=>{n.onActivate&&await n.onActivate(i)},uninstall:async i=>{n.onDeactivate&&await n.onDeactivate(i)},onAgentResponse:n.onMessage}}const Kj={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async t=>{console.log("Analytics plugin installed"),t.on("session.started",e=>{console.log("Analytics: Session started",e.id)}),t.on("session.ended",(e,n)=>{console.log("Analytics: Session ended",e.id,n)}),t.on("chat.message.sent",e=>{console.log("Analytics: User message sent",e.content.length)})}},Gj={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async t=>{console.log("Debug plugin installed");const e=t.emit;t.emit=(n,...i)=>(console.log(`[Debug] Event: ${String(n)}`,i),e(n,...i))}},Zj={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async t=>{console.log("Metrics plugin installed");const e=new Map;t.on("session.started",n=>{e.set(n.id,{startTime:Date.now(),events:[]})}),t.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},ow=R.createContext(null);function aw({config:t,children:e,autoConnect:n=!1}){const[i,r]=R.useState(null),[s,o]=R.useState(!1),[a,c]=R.useState(!1),[l,d]=R.useState(null),[u,f]=R.useState(null),[p,g]=R.useState("idle"),[h,y]=R.useState(null),[b,w]=R.useState([]),[C,S]=R.useState([]),[x,T]=R.useState([]);R.useEffect(()=>{const O=new bo(t);return r(O),E(O),n&&P(O),()=>{O.disconnect().catch(console.error)}},[t,n]);const E=O=>{O.on("connection.connecting",()=>{c(!0),d(null)}),O.on("connection.connected",()=>{o(!0),c(!1),d(null)}),O.on("connection.disconnected",()=>{o(!1),c(!1),f(null),g("idle"),w([]),S([]),T([])}),O.on("connection.error",oe=>{d(oe),c(!1)}),O.on("session.created",oe=>{f(oe),g(oe.state)}),O.on("session.state.changed",oe=>{g(oe),u&&f({...u,state:oe})}),O.on("session.ended",(oe,L)=>{f(null),g("idle"),y(L),w([]),S([]),T([])}),O.on("participant.joined",oe=>{w(L=>[...L,oe])}),O.on("participant.left",oe=>{w(L=>L.filter(F=>F.id!==oe.id))}),O.on("chat.message.received",oe=>{S(L=>[...L,oe])}),O.on("chat.message.sent",oe=>{S(L=>[...L,oe])}),O.on("transcription.received",oe=>{T(L=>[...L,oe])})},P=async O=>{const oe=O||i;if(oe)try{await oe.connect()}catch(L){console.error("Failed to connect:",L)}},X={client:i,isConnected:s,isConnecting:a,connectionError:l,currentSession:u,sessionState:p,sessionMetrics:h,participants:b,chatMessages:C,transcriptions:x,connect:()=>P(),disconnect:async()=>{if(i)try{await i.disconnect()}catch(O){console.error("Failed to disconnect:",O)}},createSession:async(O,oe={})=>{if(!i)throw new Error("Client not initialized");const L={agentId:O,participantName:oe.participantName||"User",metadata:oe.metadata,modalities:oe.modalities||["voice"]};return await i.createSession(L)},endSession:async()=>i?await i.endSession():null,sendChatMessage:async O=>{if(!i)throw new Error("Client not initialized");await i.sendChatMessage(O)},setMicrophoneEnabled:async O=>{if(!i)throw new Error("Client not initialized");await i.setMicrophoneEnabled(O)},setCameraEnabled:async O=>{if(!i)throw new Error("Client not initialized");await i.setCameraEnabled(O)},startScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.startScreenShare()},stopScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.stopScreenShare()}};return m.jsx(ow.Provider,{value:X,children:e})}function jn(){const t=R.useContext(ow);if(!t)throw new Error("useVoxket must be used within a VoxketProvider");return t}class Yj extends rh{constructor(n){super();at(this,"room",null);at(this,"registeredMethods",new Map);at(this,"activeInteractions",new Map);at(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,i,r="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const s={methodName:n,component:i,presentationMode:r};this.registeredMethods.set(n,s);try{this.room.registerRpcMethod(n,async o=>{console.log(`RpcManager: RPC method '${n}' called by ${o.callerIdentity}`),console.log("RpcManager: Payload:",o.payload),this.emit("rpc.method.called",{methodName:n,data:o});let a;console.log(`RpcManager: Current registration for '${n}':`,s);let c=o.responseTimeout||30;try{a=JSON.parse(o.payload)}catch{a=o.payload}try{const l=await this.awaitUserInteraction(n,i,r,a,c);return JSON.stringify(l)}catch(l){throw console.error(`RpcManager: Error in RPC method '${n}':`,l),l}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(o){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,o),o}}async awaitUserInteraction(n,i,r,s,o){return new Promise((a,c)=>{const l=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${o} seconds`);const d={didSuccess:(f,p)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,f),this.clearInteraction(l),this.currentInteraction=null;const g={success:!0,message:"User interaction completed successfully",data:f,timestamp:new Date,...p?{successView:p}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:g}),a(g)},didFail:f=>{console.log(`RpcManager: User interaction failed for method: ${n}`,f),this.clearInteraction(l);const p={success:!1,message:"User interaction failed",error:f,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:p}),a(p)},dismissView:()=>{var p;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(p=this.currentInteraction)==null?void 0:p.methodName),this.clearInteraction(l),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const f={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:f}),this.emit("rpc.interaction.completed",{methodName:n,response:f}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(f)},didTimeout:f=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(l),this.currentInteraction=null;const p={success:!0,message:`User interaction timed out after ${o} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...f?{timeoutView:f}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:p}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(p)}},u=setTimeout(()=>{d.didTimeout&&d.didTimeout()},o);this.activeInteractions.set(l,{resolve:f=>a(JSON.parse(f)),reject:c,timeoutId:u}),this.currentInteraction={isVisible:!0,methodName:n,component:i,presentationMode:r,timeout:o,data:s,handler:d},this.emit("rpc.interaction.started",{methodName:n,presentationMode:r}),setTimeout(async()=>{var f;if((f=this.currentInteraction)!=null&&f.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,s)}catch(p){console.error("RpcManager: Error loading data into component:",p),d.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const i=this.activeInteractions.get(n);i&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(i.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,i]of this.activeInteractions)clearTimeout(i.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class De extends Error{constructor(e,n,i){super(e),this.code=n,this.details=i,this.name="VoxketError"}}class bo extends rh{constructor(n){super();at(this,"config");at(this,"room",null);at(this,"pluginManager");at(this,"rpcManager");at(this,"isConnected",!1);at(this,"currentSession",null);at(this,"connectionState",ge.Disconnected);at(this,"renderedComponents",new Map);at(this,"textStreamHandlersRegistered",!1);at(this,"currentAgentInfo",null);at(this,"chatMessages",[]);this.config=n,this.pluginManager=new sw(this),this.rpcManager=new Yj,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,i;this.isConnected=!0,(i=(n=this.config).onConnected)==null||i.call(n)}),this.on("connection.disconnected",n=>{var i,r;this.isConnected=!1,(r=(i=this.config).onDisconnected)==null||r.call(i,n)}),this.on("connection.error",n=>{var i,r;(r=(i=this.config).onError)==null||r.call(i,n)}),this.on("chat.message.received",n=>{var i,r;this.addChatMessage(n),(r=(i=this.config).onMessageReceived)==null||r.call(i,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var i,r;(r=(i=this.config).onTranscriptionReceived)==null||r.call(i,n)}),this.on("session.state.changed",n=>{var i,r;(r=(i=this.config).onSessionStateChanged)==null||r.call(i,n)}),this.on("session.created",n=>{var i,r;(r=(i=this.config).onSessionStart)==null||r.call(i,n.id)}),this.on("session.ended",(n,i)=>{var r,s;(s=(r=this.config).onSessionEnd)==null||s.call(r,i)}),this.on("participant.joined",n=>{var i,r;(r=(i=this.config).onUserJoined)==null||r.call(i,n.id)}),this.on("participant.left",n=>{var i,r;(r=(i=this.config).onUserLeft)==null||r.call(i,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new pi,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(U.Connected,()=>{var n,i;this.connectionState=ge.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(i=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&i.includes("voice")&&setTimeout(async()=>{var r;try{(r=this.room)!=null&&r.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(s){console.warn("VoxketClient: Failed to enable microphone after room connection:",s)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(U.Disconnected,n=>{this.connectionState=ge.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(U.ConnectionStateChanged,n=>{this.connectionState=n,n===ge.Connecting&&this.emit("connection.connecting")}),this.room.on(U.ParticipantConnected,n=>{const i={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",i)}),this.room.on(U.ParticipantDisconnected,n=>{const i={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",i)}))}setupTextStreamHandlers(){if(this.room){try{this.room.registerTextStreamHandler("lk.chat",async(n,i)=>{try{const r=await n.readAll(),s={id:`msg_${Date.now()}_${i.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:r,timestamp:new Date,sender:{id:i.identity||"user",name:i.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",s)}catch(r){console.error("VoxketClient: Failed to process lk.chat message:",r)}})}catch(n){console.warn("VoxketClient: lk.chat handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("lk.transcription",async(n,i)=>{var r,s;try{const o=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let a="";const c=((r=this.currentAgentInfo)==null?void 0:r.name)||i.identity||"AI Assistant",l={id:o,content:"",timestamp:new Date,sender:{id:i.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",l);for await(const f of n){a+=f;const p=this.convertMarkdownToText(a),g={...l,content:p,metadata:{...l.metadata,streaming:!0}};this.emit("chat.message.updated",g)}const d=this.convertMarkdownToText(a),u={...l,content:d,metadata:{...l.metadata,streaming:!1}};this.emit("chat.message.updated",u)}catch(o){console.error("VoxketClient: Failed to process lk.transcription message:",o);try{const a=await n.readAll(),c=((s=this.currentAgentInfo)==null?void 0:s.name)||i.identity||"AI Assistant",l={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:a,timestamp:new Date,sender:{id:i.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",l)}catch(a){console.error("VoxketClient: Fallback failed for lk.transcription:",a)}}})}catch(n){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("suggested_response",async n=>{const i=await n.readAll();let r=[];try{r=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(s){console.warn("VoxketClient: Failed to parse suggested_response:",s,i)}this.emit("suggested.response",r)})}catch(n){console.warn("VoxketClient: suggested_response handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("agent_state_changed",async(n,i)=>{const r=await n.readAll();let s={};try{s=typeof r=="string"?JSON.parse(r.replace(/'/g,'"')):r}catch(o){console.warn("VoxketClient: Failed to parse agent_state_changed:",o,r)}s.new_state==="speaking"?this.emit("agent.speaking",s):s.new_state==="thinking"&&this.emit("agent.thinking",s)})}catch(n){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("images",async(n,i)=>{try{const r=await n.readAll()}catch(r){console.error("VoxketClient: Error processing images stream:",r)}})}catch(n){console.warn("VoxketClient: images handler already registered, skipping:",n)}try{this.room.registerByteStreamHandler("images",async(n,i)=>{var r,s;try{const o=n.info,a={id:`img_${Date.now()}_${i.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${o.name||"Image"}`,sender:{id:i.identity||"agent",name:i.identity||"Agent",type:i.identity===((s=(r=this.room)==null?void 0:r.localParticipant)==null?void 0:s.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.mimeType,streamId:o.id,downloading:!0}};this.emit("chat.message.received",a),n.onProgress&&(n.onProgress=f=>{const p={...a,metadata:{...a.metadata,downloadProgress:f||0}};this.emit("chat.message.updated",p)});const c=[];for await(const f of n)c.push(f);const l=new Blob(c,{type:o.mimeType||"application/octet-stream"}),d=URL.createObjectURL(l),u={...a,metadata:{...a.metadata,downloading:!1,downloadProgress:1,downloadUrl:d,blob:l}};this.emit("chat.message.updated",u)}catch(o){console.error("VoxketClient: Error processing image attachment:",o)}})}catch(n){console.warn("VoxketClient: image handler already registered, skipping:",n)}this.textStreamHandlersRegistered=!0}}async fetchConnectionDetails(n,i,r){const s=n||this.config.agentId||"default-agent",o=i||this.config.participantName||"User",a=r||this.config.modalities||["voice"];try{const c={agent_id:s,participant_name:o,participant_metadata:{user_id:""},modality:a[0]},l=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!l.ok){let f=`HTTP ${l.status}: Failed to fetch connection details`;try{const p=await l.json();p&&(p.error?f=`API Error: ${p.error}`:p.detail?f=`API Error: ${p.detail}`:p.message&&(f=`API Error: ${p.message}`))}catch{try{const g=await l.text();g&&(f=`API Error: ${g}`)}catch{}}throw new Error(f)}const d=await l.json();let u;return d.agent_info&&(u={id:d.agent_info.id||s,name:d.agent_info.name||"AI Assistant",avatar:d.agent_info.avatar,capabilities:d.agent_info.capabilities||["voice_interaction","text_chat"],metadata:d.agent_info.metadata||{}},this.currentAgentInfo=u),{serverUrl:d.wss_url,participantToken:d.token,voxketSessionId:d.session_id,agentInfo:u}}catch(c){console.error("VoxketClient: fetchConnectionDetails failed:",c);const l=new De(`Failed to fetch connection details: ${c instanceof Error?c.message:"Unknown error"}`,"CONNECTION_FAILED",c);throw this.emit("connection.error",l),l}}async connect(n,i,r){var s;try{this.emit("connection.connecting");const o=await this.fetchConnectionDetails(n,i,r);return await((s=this.room)==null?void 0:s.connect(o.serverUrl,o.participantToken)),this.isConnected=!0,o}catch(o){console.error("VoxketClient: Connection failed:",o);const a=new De(`Failed to connect to Voxket services: ${o instanceof Error?o.message:"Unknown error"}`,"CONNECTION_FAILED",o);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new pi,this.setupRoomEventListeners()}catch(i){const r=new De("Failed to disconnect properly","NETWORK_ERROR",i);throw this.emit("connection.error",r),r}}async createSession(n){var i,r;try{const s=await this.connect(n.agentId,n.participantName,n.modalities),o={id:s.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:s.agentInfo||this.currentAgentInfo};if(this.currentSession=o,this.emit("session.created",o),(i=n.modalities)!=null&&i.includes("voice"))try{await new Promise(a=>setTimeout(a,500)),(r=this.room)!=null&&r.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(a){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",a)}return setTimeout(()=>{this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state))},1e3),o}catch(s){throw console.error("VoxketClient: Failed to create session:",s),s instanceof De?s:s instanceof TypeError&&s.message.includes("fetch")?new De("Network connection failed","CONNECTION_FAILED",s):s instanceof Error&&s.message.includes("Failed to fetch connection details")?new De(`API connection failed: ${s.message}`,"CONNECTION_FAILED",s):new De(`Failed to create session: ${s instanceof Error?s.message:"Unknown error"}`,"SESSION_NOT_FOUND",s)}}async startSession(n,i){const r={agentId:n||this.config.agentId||"default-agent",participantName:(i==null?void 0:i.participantName)||this.config.participantName||"User",modalities:(i==null?void 0:i.modalities)||this.config.modalities||["voice","chat"],metadata:i==null?void 0:i.metadata};return this.createSession(r)}async endSession(){var n,i;if(!this.currentSession)return null;try{const r={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((i=this.room)==null?void 0:i.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,r),await this.disconnect(),r}catch(r){throw new De("Failed to end session","SESSION_NOT_FOUND",r)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(r=>r.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const i=this.chatMessages.findIndex(r=>r.id===n.id);i!==-1&&(this.chatMessages[i]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var c,l,d;const i=this.resolveTarget(n.target||"body"),r=this.getTargetKey(i),s=this.renderedComponents.get(r);s&&s.target===i||this.removeUI(i);const o=(s==null?void 0:s.root)||Wj.createRoot(i),a={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((l=n.modality)==null?void 0:l.includes("video"))===!0,suportsScreenShare:((d=n.modality)==null?void 0:d.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};o.render(R.createElement(aw,{config:this.config,autoConnect:n.autoStart||!1,children:R.createElement(cw,a)})),this.renderedComponents.set(r,{root:o,target:i})}removeUI(n){const i=n?this.resolveTarget(n):null;if(i){const r=this.getTargetKey(i),s=this.renderedComponents.get(r);s&&(s.root.unmount(),this.renderedComponents.delete(r),i.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(a=>{try{a.remove()}catch(c){console.warn("Failed to remove element:",c)}}),i===document.body&&i.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&c.classList.contains("backdrop-blur-sm"))try{c.remove()}catch(l){console.warn("Failed to remove fixed element:",l)}}))}}removeAllUI(){for(const[n,i]of this.renderedComponents)i.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(i=>{if(i.classList.contains("bg-black")&&(i.classList.contains("backdrop-blur-sm")||i.classList.contains("bg-opacity-30")))try{i.remove()}catch(r){console.warn("Failed to remove overlay:",r)}})}resolveTarget(n){if(typeof n=="string"){const i=document.querySelector(n);if(!i)throw new Error(`Target element not found: ${n}`);return i}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,i){var r;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new De("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new De("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new De("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const s={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:i||{}},o=await((r=this.room)==null?void 0:r.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",s)}catch(s){throw console.error("VoxketClient: Failed to send chat message:",s),new De("Failed to send message","NETWORK_ERROR",s)}}async sendChatMessage(n,i){return this.sendMessage(n,i)}async sendAttachments(n,i){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new De("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new De("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new De("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new De("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(s=>s.type.startsWith("image/"));if(r.length===0)throw new De("Only image files are allowed","INVALID_PARAMETER");r.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const s=r.map(async(o,a)=>{const l={id:`att_${Date.now()}_${a}`,content:`📎 ${o.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...i,type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.type,uploading:!0}};this.emit("chat.message.sent",l);const d=await this.room.localParticipant.sendFile(o,{mimeType:o.type,topic:"images",onProgress:f=>{const p={...l,metadata:{...l.metadata,uploadProgress:f}};this.emit("chat.message.updated",p)}});try{const f=new FileReader,p=new Promise((y,b)=>{f.onload=()=>{typeof f.result=="string"?y(f.result):b(new Error("Failed to convert to base64"))},f.onerror=b});f.readAsDataURL(o);const h={type:"image",data:await p,filename:o.name,mimeType:o.type,size:o.size};await this.room.localParticipant.sendText(JSON.stringify(h),{topic:"images",destinationIdentities:[]})}catch(f){console.warn("VoxketClient: Failed to send image data to agent:",f);try{const p=`I've shared an image: ${o.name}`;await this.room.localParticipant.sendText(p,{topic:"lk.chat",destinationIdentities:[]})}catch(p){console.warn("VoxketClient: Failed to send image notification to agent:",p)}}const u={...l,metadata:{...l.metadata,uploading:!1,uploadProgress:1,streamId:d.id}};return this.emit("chat.message.updated",u),d});await Promise.all(s)}catch(s){throw console.error("VoxketClient: Failed to send attachments:",s),new De("Failed to send attachments","NETWORK_ERROR",s)}}async sendAttachment(n,i){return this.sendAttachments([n],i)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var i,r;try{const s=(i=this.room)==null?void 0:i.localParticipant.isMicrophoneEnabled,o=n??!s;await((r=this.room)==null?void 0:r.localParticipant.setMicrophoneEnabled(o)),o?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(s){throw console.error("VoxketClient: Failed to toggle microphone:",s),new De("Failed to toggle microphone","PERMISSION_DENIED",s)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var i,r;try{const s=(i=this.room)==null?void 0:i.localParticipant.isCameraEnabled,o=n??!s;await((r=this.room)==null?void 0:r.localParticipant.setCameraEnabled(o)),o?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(s){throw console.error("VoxketClient: Failed to toggle camera:",s),new De("Failed to toggle camera","PERMISSION_DENIED",s)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(i){throw new De("Failed to start screen share","PERMISSION_DENIED",i)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(i){throw new De("Failed to stop screen share","PERMISSION_DENIED",i)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(i=>i.kind==="audioinput")}catch(n){throw new De("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(i=>i.kind==="videoinput")}catch(n){throw new De("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var i;try{if(!((i=this.room)!=null&&i.localParticipant))throw new Error("Not connected to room")}catch(r){throw new De("Failed to set audio input device","DEVICE_ERROR",r)}}async setVideoInputDevice(n){var i;try{if(!((i=this.room)!=null&&i.localParticipant))throw new Error("Not connected to room")}catch(r){throw new De("Failed to set video input device","DEVICE_ERROR",r)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const i=n.permissions;if(!i)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const r=s=>!!i.canPublish&&(i.canPublishSources.length===0||i.canPublishSources.includes(s));return{camera:r(1),microphone:r(2),screenShare:r(3),data:i.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===ge.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===V.Source.Microphone)return i.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===V.Source.Camera)return i.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===V.Source.ScreenShare)return i.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(i=>{n.push({id:i.identity,name:i.name||i.identity,isLocal:!1})}),n}getSessionMetrics(){var n,i;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((i=this.room)==null?void 0:i.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(i){throw new De("Failed to start recording","RECORDING_ERROR",i)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(i){throw new De("Failed to stop recording","RECORDING_ERROR",i)}}async registerFrontendRPC(n,i,r="embedded"){return this.rpcManager.registerFrontendRPC(n,i,r)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,i){return this.on(n,i)}registerEventEmitter(n,i){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async r=>{try{const s=await r.readAll();i(s)}catch(s){console.error(`Error processing event for topic '${n}':`,s)}})}catch(r){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,r)}}convertMarkdownToText(n){if(!n)return"";let i=n;return i=i.replace(/\*\*(.*?)\*\*/g,"$1"),i=i.replace(/__(.*?)__/g,"$1"),i=i.replace(/\*(.*?)\*/g,"$1"),i=i.replace(/_(.*?)_/g,"$1"),i=i.replace(/~~(.*?)~~/g,"$1"),i=i.replace(/`([^`]+)`/g,"$1"),i=i.replace(/```[\s\S]*?```/g,""),i=i.replace(/^#{1,6}\s+/gm,""),i=i.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),i.trim()}}const Jj=xe.create(Pj),Xj=xe.create(Lj),Qj=xe.create(Uj),eL=xe.create(Hj);function tL({onClick:t,text:e="Open Chat",position:n="bottom-right",theme:i}){const r={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},s=St(i);return m.jsx(xe.button,{onClick:t,className:`fixed ${r[n]} z-50 px-4 py-2 rounded-full shadow-lg ${s.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:e})}function A0({children:t,theme:e,displayType:n="widget",onClose:i,popupPosition:r="bottom-right",onExpand:s}){const o=St(e);if(n==="fullscreen")return m.jsx("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",children:m.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",children:[i&&m.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),i()},className:"absolute top-4 cursor-pointer right-4 z-[100] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),m.jsxs("div",{id:"voice-card",className:`${o.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[m.jsx("div",{className:o.cardTopGradient}),m.jsx("div",{className:o.cardPurpleBlur}),m.jsx("div",{className:o.cardPinkBlur}),m.jsx("div",{className:" flex flex-col h-full",children:t}),m.jsx("div",{className:o.cardPulse1}),m.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return m.jsx("div",{className:"fixed rounded-2xl inset-0 z-50 pointer-events-none",children:m.jsxs("div",{className:`fixed rounded-2xl ${a[r]} pointer-events-auto`,children:[i&&m.jsx("button",{onClick:i,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),m.jsxs("div",{id:"voice-card",className:`${o.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[m.jsx("div",{className:o.cardPurpleBlur}),m.jsx("div",{className:o.cardPinkBlur}),m.jsx("div",{className:" flex flex-col h-full",children:t}),m.jsx("div",{className:o.cardPulse1}),m.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return m.jsxs("div",{id:"voice-card",className:`${o.card}`,children:[s&&m.jsx("button",{onClick:s,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),m.jsx("div",{className:o.cardTopGradient}),m.jsx("div",{className:o.cardPurpleBlur}),m.jsx("div",{className:o.cardPinkBlur}),t,m.jsx("div",{className:o.cardPulse1}),m.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})}function cw(t){if(typeof window>"u")return null;console.log("🎯 Widget component rendering with props:",{displayType:t.displayType,popupPosition:t.popupPosition,theme:t.theme});const{agentId:e,participantName:n,baseUrl:i,appSecret:r,appId:s,prompts:o,statusMessage:a,welcomeTitle:c,welcomeSubTitle:l,className:d,width:u,height:f,loadingText:p,suportsChatInput:g=!0,suportsVideoInput:h=!0,suportsScreenShare:y=!0,theme:b="vox",onSessionStart:w,onSessionEnd:C,enableSessionLogging:S=!0,onSessionLogsUpdate:x,onSessionMetricsUpdate:T,modalities:E=["voice"],displayType:P="widget",popupPosition:_="bottom-right",popupTriggerText:k="Open Chat",onPopupToggle:I,voxketClient:N,onDisplayTypeChange:K}=t,[J,se]=v.useState(()=>N?!!N.getCurrentSession():!1),[ie,X]=v.useState(!1),[O,oe]=v.useState(e||""),[L,F]=v.useState(n||"User"),[te,j]=v.useState(()=>N?N.getCurrentSession():null),[q,ee]=v.useState(()=>{var ve,tn,At;if(N){const $e=N.getCurrentSession();if((ve=$e==null?void 0:$e.activeModalities)!=null&&ve.includes("chat"))return"chat";if((tn=$e==null?void 0:$e.activeModalities)!=null&&tn.includes("voice"))return"voice";if((At=$e==null?void 0:$e.activeModalities)!=null&&At.includes("video"))return"video"}return"welcome"}),[G,D]=v.useState(!1);v.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",P)},[P]),v.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:q,sessionStarted:J,loading:ie,currentSession:te==null?void 0:te.id,isPopupOpen:G})},[q,J,ie,te,G]);const $=v.useMemo(()=>{if(N)return console.log("🔄 Using passed VoxketClient to preserve session state"),N;console.log("🆕 Creating new VoxketClient instance");const ve={appId:s,appSecret:r,baseUrl:i,agentId:O,participantName:L||"User",modalities:E};return new bo(ve)},[N,s,r,i,O,L,E]),Q=E,W=v.useMemo(()=>$.getRoom()||new pi,[$]),ce={suportsChatInput:g,suportsVideoInput:h,suportsScreenShare:y},{sessionMetrics:z,sessionLogs:me,logEvent:Ee}=rw({room:W,onSessionStart:w,onSessionEnd:C,enableConsoleLogging:S,enableLocalStorage:S,voxketSessionId:te==null?void 0:te.id});v.useEffect(()=>{x&&x(me)},[me,x]),v.useEffect(()=>{T&&z&&T(z)},[z,T]),v.useEffect(()=>{const ve=At=>{console.log("🔴 Room disconnected:",At),X(!1),se(!1),j(null),ee("welcome")},tn=At=>{console.log("📹 Media devices error:",At),No({title:"Allow access to your microphone/camera",description:`${At.name}: ${At.message}`})};return W.on(U.MediaDevicesError,tn),W.on(U.Disconnected,ve),()=>{W.off(U.Disconnected,ve),W.off(U.MediaDevicesError,tn)}},[W]);const qe=async()=>{try{console.log("🎤 Starting voice session...",{agentId:O,participantName:L}),console.log("🎤 Pre-start state:",{currentMode:q,sessionStarted:J,loading:ie}),X(!0),se(!0),ee("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),Ee("USER_STARTED_VOICE_SESSION",{agentId:O,participantName:L});const ve=await $.startSession(O,{participantName:L||"User",modalities:["voice",...h?["video"]:[]]});console.log("✅ Voice session started successfully:",ve.id),j(ve),X(!1),w&&w(ve.id)}catch(ve){console.error("❌ Failed to start voice session:",ve),No({title:"Failed to start voice session",description:ve instanceof Error?ve.message:"Unknown error occurred"}),X(!1),se(!1),ee("welcome")}},Ct=async()=>{try{X(!0),se(!0),ee("chat"),Ee("USER_STARTED_CHAT_SESSION",{agentId:O,participantName:L});const ve=await $.startSession(O,{participantName:L||"User",modalities:["chat"]});j(ve),X(!1),w&&w(ve.id)}catch(ve){console.error("Failed to start chat session:",ve),No({title:"Failed to start chat session",description:ve instanceof Error?ve.message:"Unknown error occurred"}),X(!1),se(!1),ee("welcome")}},gn=async()=>{try{console.log("📺 Starting video session...",{agentId:O,participantName:L}),console.log("📺 Pre-start state:",{currentMode:q,sessionStarted:J,loading:ie}),X(!0),se(!0),ee("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),Ee("USER_STARTED_VIDEO_SESSION",{agentId:O,participantName:L});const ve=await $.startSession(O,{participantName:L||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",ve.id),j(ve),X(!1),w&&w(ve.id)}catch(ve){console.error("❌ Failed to start video session:",ve),No({title:"Failed to start video session",description:ve instanceof Error?ve.message:"Unknown error occurred"}),X(!1),se(!1),ee("welcome")}},vn=()=>{ee("welcome"),K&&K(t.displayType||"widget"),te&&J&&(se(!1),j(null),$.disconnect()),P==="popup"&&!G&&D(!0)},Et=()=>{const ve=!G;D(ve),I&&I(ve),!ve&&!(te&&J)&&(ee("welcome"),se(!1),j(null))},Pc=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),t.onDisplayTypeChange?t.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},Rc=()=>{t.onDisplayTypeChange&&t.onDisplayTypeChange("fullscreen")};v.useEffect(()=>{var ve,tn,At;if(N&&$){console.log("🔄 Syncing widget state with existing client session state");const $e=$.getCurrentSession(),Ac=$.connected;console.log("🔍 Existing session state:",{hasSession:!!$e,sessionId:$e==null?void 0:$e.id,isConnected:Ac,activeModalities:$e==null?void 0:$e.activeModalities}),$e&&(console.log("✅ Restoring session state from existing client"),j($e),se(!0),X(!1),(ve=$e.activeModalities)!=null&&ve.includes("chat")?ee("chat"):(tn=$e.activeModalities)!=null&&tn.includes("voice")?ee("voice"):(At=$e.activeModalities)!=null&&At.includes("video")&&ee("video"))}},[N,$]),v.useEffect(()=>()=>{console.log("🧹 Cleaning up widget component"),N?console.log("🔄 Widget cleanup: preserving passed client instance"):(console.log("🧹 Widget cleanup: disconnecting self-created client"),$.disconnect())},[$,N]);let _i="w-96",ms="h-[25rem]",ps={};if(u&&(u.startsWith("w-")?_i=u:(ps.width=u,_i="")),f&&(f.startsWith("h-")?ms=f:(ps.height=f,ms="")),P==="popup"&&!G)return console.log("🟡 Showing popup trigger button"),m.jsx(tL,{onClick:Et,text:k,position:_,theme:b});console.log("🟢 Rendering widget content, displayType:",P,"isPopupOpen:",G,"currentMode:",q,"sessionStarted:",J,"loading:",ie);let or=`voxket-widget-root theme-${b}`,Ni={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};P==="widget"?(or+=` flex items-center justify-center min-h-fit ${_i} ${ms} ${d}`,Ni={...Ni,...ps}):(or=`${d||""}`,Ni={});const gs=m.jsx(m.Fragment,{children:m.jsxs(Vr,{mode:"wait",children:[q==="welcome"&&!ie&&m.jsx(eL,{agentId:O,participantName:L||"",onAgentIdChange:oe,onParticipantNameChange:F,onStartCall:qe,onStartChat:Ct,onStartVideo:gn,disabled:J||ie,prompts:o,statusMessage:a,title:c,subTitle:l,theme:b,modalities:Q,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),q==="voice"&&m.jsxs(Da.Provider,{value:W,children:[m.jsx(tg,{}),m.jsx(Xp,{label:"Start Audio"}),m.jsx(Jj,{loadingText:p,participantName:L||"User",capabilities:ce,sessionStarted:J,disabled:!J,theme:b,client:$,displayType:P,onBack:P==="popup"?Et:vn,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),q==="chat"&&m.jsx(Xj,{client:$,theme:b,displayType:P,onBack:P==="popup"?Et:vn,onEndChat:vn,disabled:!J,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),q==="video"&&m.jsxs(Da.Provider,{value:W,children:[m.jsx(tg,{}),m.jsx(Xp,{label:"Start Audio"}),m.jsx(Qj,{client:$,theme:b,displayType:P,onBack:P==="popup"?Et:vn,onEndCall:vn,disabled:!J,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return P==="fullscreen"||P==="popup"?(console.log("📱 Rendering fullscreen/popup mode, displayType:",P),m.jsx(A0,{theme:b,displayType:P,popupPosition:_,onClose:P==="fullscreen"?Pc:Et,children:gs})):(console.log("📦 Rendering widget mode"),m.jsx("div",{className:or,style:Ni,children:m.jsx(A0,{theme:b,displayType:P,popupPosition:_,onExpand:Rc,children:gs})}))}function nL({logs:t,onClear:e,onExport:n}){const[i,r]=R.useState(!1),[s,o]=R.useState(""),a=t.filter(c=>!s||c.event.toLowerCase().includes(s.toLowerCase()));return i?m.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:m.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[m.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[m.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",t.length,")"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",placeholder:"Filter events...",value:s,onChange:c=>o(c.target.value),className:"px-3 py-1 border rounded text-sm"}),m.jsx("button",{onClick:e,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),m.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),m.jsx("button",{onClick:()=>r(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),m.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?m.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):m.jsx("div",{className:"space-y-2",children:a.map((c,l)=>m.jsxs("div",{className:"border rounded p-3 text-sm",children:[m.jsxs("div",{className:"flex items-center justify-between mb-1",children:[m.jsx("span",{className:"font-semibold text-blue-600",children:c.event}),m.jsx("span",{className:"text-gray-500 text-xs",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.sessionId&&m.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",c.sessionId]}),c.data&&m.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:m.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(c.data,null,2)})})]},l))})})]})}):m.jsxs("button",{onClick:()=>r(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",t.length,")"]})}function iL({metrics:t}){return t?m.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[m.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),m.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Session ID:"}),m.jsx("div",{className:"font-mono text-xs",children:t.sessionId})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Start Time:"}),m.jsx("div",{children:new Date(t.startTime).toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Messages:"}),m.jsx("div",{children:t.totalMessages})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Participants:"}),m.jsx("div",{children:t.participantCount})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),m.jsx("div",{children:t.connectionIssues})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Duration:"}),m.jsxs("div",{children:[Math.round((Date.now()-new Date(t.startTime).getTime())/1e3),"s"]})]})]})]}):null}function sr(){const{currentSession:t,sessionState:e,sessionMetrics:n,createSession:i,endSession:r}=jn(),s=R.useCallback(async(a,c)=>await i(a,c),[i]),o=R.useCallback(async()=>await r(),[r]);return{session:t,state:e,metrics:n,isActive:t!==null&&e!=="disconnected",isConnecting:e==="connecting",isConnected:e==="connected"||e==="active",start:s,stop:o}}function lw(){const{sessionMetrics:t,currentSession:e}=jn();return{metrics:t,sessionId:e==null?void 0:e.id,duration:t==null?void 0:t.duration,participantCount:t==null?void 0:t.participantCount,messageCount:t==null?void 0:t.messageCount,audioQuality:t==null?void 0:t.audioQuality,networkStats:t==null?void 0:t.networkStats}}function dw(){const{setMicrophoneEnabled:t,client:e}=jn(),[n,i]=R.useState(!1),[r,s]=R.useState(!1),o=R.useCallback(async()=>{if(!r){s(!0);try{const l=!n;await t(l),i(l)}catch(l){console.error("Failed to toggle microphone:",l)}finally{s(!1)}}},[n,r,t]),a=R.useCallback(async()=>{if(!(n||r)){s(!0);try{await t(!0),i(!0)}catch(l){console.error("Failed to enable microphone:",l)}finally{s(!1)}}},[n,r,t]),c=R.useCallback(async()=>{if(!(!n||r)){s(!0);try{await t(!1),i(!1)}catch(l){console.error("Failed to disable microphone:",l)}finally{s(!1)}}},[n,r,t]);return{isEnabled:n,isLoading:r,toggle:o,enable:a,disable:c}}function uw(){const{setCameraEnabled:t}=jn(),[e,n]=R.useState(!1),[i,r]=R.useState(!1),s=R.useCallback(async()=>{if(!i){r(!0);try{const c=!e;await t(c),n(c)}catch(c){console.error("Failed to toggle camera:",c)}finally{r(!1)}}},[e,i,t]),o=R.useCallback(async()=>{if(!(e||i)){r(!0);try{await t(!0),n(!0)}catch(c){console.error("Failed to enable camera:",c)}finally{r(!1)}}},[e,i,t]),a=R.useCallback(async()=>{if(!(!e||i)){r(!0);try{await t(!1),n(!1)}catch(c){console.error("Failed to disable camera:",c)}finally{r(!1)}}},[e,i,t]);return{isEnabled:e,isLoading:i,toggle:s,enable:o,disable:a}}function fw(){const{startScreenShare:t,stopScreenShare:e}=jn(),[n,i]=R.useState(!1),[r,s]=R.useState(!1),o=R.useCallback(async()=>{if(!(n||r)){s(!0);try{await t(),i(!0)}catch(l){console.error("Failed to start screen share:",l)}finally{s(!1)}}},[n,r,t]),a=R.useCallback(async()=>{if(!(!n||r)){s(!0);try{await e(),i(!1)}catch(l){console.error("Failed to stop screen share:",l)}finally{s(!1)}}},[n,r,e]),c=R.useCallback(async()=>{n?await a():await o()},[n,o,a]);return{isSharing:n,isLoading:r,start:o,stop:a,toggle:c}}function rL(){const{client:t}=jn(),[e,n]=R.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),i=R.useMemo(()=>e.tracks.find(h=>h.isLocal),[e.tracks]),r=R.useMemo(()=>e.tracks.filter(h=>!h.isLocal),[e.tracks]),s=R.useCallback(async()=>{try{i!=null&&i.isEnabled?await(t==null?void 0:t.disableCamera()):await(t==null?void 0:t.enableCamera())}catch(h){throw console.error("Failed to toggle camera:",h),h}},[t,i]),o=R.useCallback(async()=>{try{e.tracks.find(y=>y.isScreenShare)?await(t==null?void 0:t.stopScreenShare()):await(t==null?void 0:t.startScreenShare())}catch(h){throw console.error("Failed to toggle screen share:",h),h}},[t,e.tracks]),a=R.useCallback(h=>{n(y=>({...y,layout:h}))},[]),c=R.useCallback(h=>{n(y=>({...y,pinnedTrack:h}))},[]),l=R.useCallback(()=>{n(h=>({...h,pinnedTrack:void 0}))},[]),d=R.useCallback(async()=>{try{await(t==null?void 0:t.startRecording()),n(h=>({...h,isRecording:!0}))}catch(h){throw console.error("Failed to start recording:",h),h}},[t]),u=R.useCallback(async()=>{try{await(t==null?void 0:t.stopRecording()),n(h=>({...h,isRecording:!1}))}catch(h){throw console.error("Failed to stop recording:",h),h}},[t]),f=R.useCallback(h=>e.tracks.find(y=>y.id===h),[e.tracks]),p=R.useCallback(h=>e.tracks.filter(y=>y.participantId===h),[e.tracks]),g=R.useCallback(h=>h.isEnabled&&e.tracks.includes(h),[e.tracks]);return R.useEffect(()=>{if(!t)return;const h=w=>{n(C=>({...C,tracks:[...C.tracks.filter(S=>S.id!==w.id),w]}))},y=w=>{n(C=>{var S;return{...C,tracks:C.tracks.filter(x=>x.id!==w),pinnedTrack:((S=C.pinnedTrack)==null?void 0:S.id)===w?void 0:C.pinnedTrack}})},b=w=>{n(C=>({...C,tracks:C.tracks.map(S=>S.id===w.id?w:S)}))};return t.on("videoTrackAdded",h),t.on("videoTrackRemoved",y),t.on("videoTrackUpdated",b),()=>{t.off("videoTrackAdded",h),t.off("videoTrackRemoved",y),t.off("videoTrackUpdated",b)}},[t]),{tracks:e.tracks,localTrack:i,remoteTraracks:r,pinnedTrack:e.pinnedTrack,layout:e.layout,isRecording:e.isRecording,toggleCamera:s,toggleScreenShare:o,setLayout:a,pinTrack:c,unpinTrack:l,startRecording:d,stopRecording:u,getTrackById:f,getTracksByParticipant:p,isTrackActive:g}}function Ec(){const{chatMessages:t,sendChatMessage:e,currentSession:n}=jn(),[i,r]=R.useState(!1),s=R.useCallback(async l=>{if(!(!l.trim()||i||!n)){r(!0);try{await e(l.trim())}catch(d){throw console.error("Failed to send chat message:",d),d}finally{r(!1)}}},[e,i,n]),{userMessages:o,agentMessages:a,allMessages:c}=R.useMemo(()=>{const l=t.filter(u=>u.sender.type==="participant"),d=t.filter(u=>u.sender.type==="agent");return{userMessages:l,agentMessages:d,allMessages:t}},[t]);return{messages:c,userMessages:o,agentMessages:a,messageCount:c.length,isSending:i,canSend:!!n&&!i,send:s}}function sL(){const{send:t,isSending:e,canSend:n}=Ec(),[i,r]=R.useState(""),s=R.useCallback(async()=>{if(!(!i.trim()||!n))try{await t(i),r("")}catch(a){throw a}},[i,t,n]),o=R.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),s())},[s]);return{value:i,setValue:r,send:s,handleKeyPress:o,isSending:e,canSend:n&&i.trim().length>0}}function oh(){const{isConnected:t,isConnecting:e,connectionError:n,connect:i,disconnect:r}=jn(),s=R.useCallback(async()=>{if(!(t||e))try{await i()}catch(a){throw console.error("Failed to connect:",a),a}},[i,t,e]),o=R.useCallback(async()=>{if(t)try{await r()}catch(a){throw console.error("Failed to disconnect:",a),a}},[r,t]);return{isConnected:t,isConnecting:e,isDisconnected:!t&&!e,error:n,hasError:!!n,connect:s,disconnect:o}}function hw(){const{participants:t}=jn();return{participants:t,count:t.length,localParticipant:t.find(e=>e.isLocal),remoteParticipants:t.filter(e=>!e.isLocal)}}const mw=R.createContext({}),xo=()=>R.useContext(mw);function pw({children:t,...e}){return m.jsx(mw.Provider,{value:e,children:t})}function ya({name:t,children:e,fallback:n,className:i}){return m.jsx("div",{className:`voxket-slot voxket-slot--${t} ${i||""}`,children:e||n})}function gw(t,e={}){return Object.assign(t,e)}function vw({showMicrophoneControl:t=!0,showCameraControl:e=!0,showScreenShareControl:n=!0,showSessionActions:i=!0,customControls:r,className:s=""}){const o=sr(),a=dw(),c=uw(),l=fw(),d=xo(),u=["voxket-session-controls",`voxket-session-controls--${d.variant||"default"}`,`voxket-session-controls--${d.size||"md"}`,o.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",s].filter(Boolean).join(" ");return!o.isActive&&!i?m.jsx("div",{className:u,children:m.jsx("div",{className:"voxket-controls-inactive",children:m.jsx("p",{children:"Controls available during active session"})})}):m.jsxs("div",{className:u,children:[i&&m.jsx("div",{className:"voxket-session-actions",children:o.isActive?m.jsx("button",{onClick:o.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):m.jsx(oL,{})}),o.isActive&&m.jsxs("div",{className:"voxket-media-controls",children:[t&&m.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[m.jsx("span",{className:"voxket-icon",children:"🎤"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),e&&m.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isEnabled?"voxket-button--active":""}`,title:c.isEnabled?"Stop camera":"Start camera",children:[m.jsx("span",{className:"voxket-icon",children:"📹"}),c.isLoading?"Loading...":c.isEnabled?"Stop Video":"Start Video"]}),n&&m.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isSharing?"voxket-button--active":""}`,title:l.isSharing?"Stop screen share":"Start screen share",children:[m.jsx("span",{className:"voxket-icon",children:"🖥️"}),l.isLoading?"Loading...":l.isSharing?"Stop Share":"Share Screen"]})]}),r&&m.jsx("div",{className:"voxket-custom-controls",children:r})]})}function oL(){sr();const[t,e]=R.useState(!1),n=async()=>{e(!0);try{console.log("Start session - agentId needed")}catch(i){console.error("Failed to start session:",i)}finally{e(!1)}};return m.jsx("button",{onClick:n,disabled:t,className:"voxket-button voxket-button--primary",children:t?"Starting...":"Start Session"})}function ah({showConnectionStatus:t=!0,showSessionInfo:e=!0,showAgentInfo:n=!0,className:i=""}){const r=sr(),s=oh(),o=xo(),a=["voxket-session-header",`voxket-session-header--${o.variant||"default"}`,`voxket-session-header--${o.size||"md"}`,i].filter(Boolean).join(" ");return m.jsxs("div",{className:a,children:[t&&m.jsxs("div",{className:"voxket-connection-status",children:[m.jsx("div",{className:`voxket-status-indicator ${s.isConnected?"connected":"disconnected"}`}),m.jsx("span",{className:"voxket-status-text",children:s.isConnecting?"Connecting...":s.isConnected?"Connected":"Disconnected"})]}),e&&r.session&&m.jsxs("div",{className:"voxket-session-info",children:[m.jsxs("div",{className:"voxket-session-id",children:["Session: ",r.session.id.slice(-8)]}),m.jsxs("div",{className:"voxket-session-state",children:["State: ",r.state]})]}),n&&r.session&&m.jsxs("div",{className:"voxket-agent-info",children:[m.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",r.session.agentId]}),m.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",r.session.activeModalities.join(", ")]})]}),s.error&&m.jsxs("div",{className:"voxket-error-message",children:["Error: ",s.error.message]})]})}function ch({showChat:t=!0,showTranscriptions:e=!1,customContent:n,className:i=""}){const r=sr(),s=Ec(),o=xo(),a=["voxket-session-content",`voxket-session-content--${o.variant||"default"}`,`voxket-session-content--${o.size||"md"}`,i].filter(Boolean).join(" ");return r.isActive?m.jsx("div",{className:a,children:n||m.jsxs(m.Fragment,{children:[t&&m.jsxs("div",{className:"voxket-chat-container",children:[m.jsxs("div",{className:"voxket-chat-messages",children:[s.messages.map(c=>m.jsxs("div",{className:`voxket-message voxket-message--${c.sender.type}`,children:[m.jsxs("div",{className:"voxket-message-header",children:[m.jsx("span",{className:"voxket-message-sender",children:c.sender.name}),m.jsx("span",{className:"voxket-message-time",children:c.timestamp.toLocaleTimeString()})]}),m.jsx("div",{className:"voxket-message-content",children:c.content})]},c.id)),s.messages.length===0&&m.jsx("div",{className:"voxket-empty-messages",children:m.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),m.jsx(aL,{})]}),e&&m.jsx("div",{className:"voxket-transcriptions",children:m.jsx("div",{className:"voxket-transcription-placeholder",children:m.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):m.jsx("div",{className:a,children:m.jsx("div",{className:"voxket-inactive-state",children:m.jsxs("div",{className:"voxket-inactive-message",children:[m.jsx("h3",{children:"Start a conversation"}),m.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function aL(){const t=Ec(),[e,n]=R.useState(""),i=async()=>{if(!(!e.trim()||!t.canSend))try{await t.send(e),n("")}catch(s){console.error("Failed to send message:",s)}},r=s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i())};return m.jsxs("div",{className:"voxket-chat-input",children:[m.jsx("input",{type:"text",value:e,onChange:s=>n(s.target.value),onKeyPress:r,placeholder:"Type your message...",disabled:!t.canSend,className:"voxket-input"}),m.jsx("button",{onClick:i,disabled:!t.canSend||!e.trim(),className:"voxket-send-button",children:t.isSending?"Sending...":"Send"})]})}function lh({showMetrics:t=!0,showParticipants:e=!0,showStatus:n=!0,customFooter:i,className:r=""}){const s=sr(),o=lw(),a=hw(),c=xo(),l=["voxket-session-footer",`voxket-session-footer--${c.variant||"default"}`,`voxket-session-footer--${c.size||"md"}`,r].filter(Boolean).join(" ");return s.isActive?m.jsx("div",{className:l,children:i||m.jsxs(m.Fragment,{children:[n&&m.jsxs("div",{className:"voxket-session-status",children:[m.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),m.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),t&&o.metrics&&m.jsxs("div",{className:"voxket-session-metrics",children:[m.jsxs("div",{className:"voxket-metric",children:[m.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),m.jsx("span",{className:"voxket-metric-value",children:cL(o.duration||0)})]}),m.jsxs("div",{className:"voxket-metric",children:[m.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),m.jsx("span",{className:"voxket-metric-value",children:o.metrics.messageCount})]})]}),e&&m.jsxs("div",{className:"voxket-participants-info",children:[m.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&m.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(d=>m.jsx("span",{className:"voxket-participant-name",children:d.name},d.id))})]})]})}):m.jsx("div",{className:l,children:m.jsx("div",{className:"voxket-footer-inactive",children:m.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function cL(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),i=Math.floor(n/60);return i>0?`${i}:${(n%60).toString().padStart(2,"0")}:${(e%60).toString().padStart(2,"0")}`:`${n}:${(e%60).toString().padStart(2,"0")}`}function lL({agentId:t,sessionConfig:e,autoStart:n=!1,onSessionStart:i,onSessionEnd:r,variant:s="default",size:o="md",theme:a,className:c="",children:l}){var p;const d=sr(),u=oh();R.useEffect(()=>{n&&t&&u.isConnected&&!d.isActive&&d.start(t,e).catch(console.error)},[n,t,u.isConnected,d.isActive]),R.useEffect(()=>{var g;(g=d.session)!=null&&g.id&&i&&i(d.session.id)},[(p=d.session)==null?void 0:p.id,i]),R.useEffect(()=>()=>{d.isActive&&r&&d.stop().then(r).catch(console.error)},[]);const f=["voxket-session",`voxket-session--${s}`,`voxket-session--${o}`,d.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return m.jsx(pw,{variant:s,size:o,theme:a,className:c,children:m.jsx("div",{className:f,children:l||m.jsxs(m.Fragment,{children:[m.jsx(ya,{name:"header",fallback:m.jsx(ah,{})}),m.jsx(ya,{name:"content",fallback:m.jsx(ch,{})}),m.jsx(ya,{name:"footer",fallback:m.jsx(lh,{})})]})})})}const yw=gw(lL,{Header:ah,Content:ch,Footer:lh,Controls:vw}),Gi={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},yu={...Gi,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},bu={...Gi,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},bw=R.createContext(null),xw=()=>{const t=R.useContext(bw);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};function dL({theme:t="default",themes:e={},children:n,cssVariables:i=!0,className:r=""}){const[s,o]=R.useState(()=>{const f={default:Gi,dark:yu,enterprise:bu,...e};return typeof t=="string"?f[t]||Gi:t}),[a,c]=R.useState(()=>({default:Gi,dark:yu,enterprise:bu,...e})),l=f=>{if(typeof f=="string"){const p=a[f];p&&o(p)}else o(f)},d=f=>{c(p=>({...p,[f.name]:f}))};R.useEffect(()=>{if(i&&typeof document<"u"){const f=document.documentElement;Object.entries(Sw(s)).forEach(([p,g])=>{f.style.setProperty(`--voxket-${p}`,g)})}},[s,i]);const u={theme:s,setTheme:l,themes:a,registerTheme:d};return m.jsx(bw.Provider,{value:u,children:m.jsx("div",{className:`voxket-theme voxket-theme--${s.name} ${r}`,children:n})})}function Sw(t){const e={},n=(i,r="")=>{for(const[s,o]of Object.entries(i)){const a=r?`${r}-${s}`:s;typeof o=="object"&&o!==null&&!Array.isArray(o)?n(o,a):e[a]=String(o)}};return n(t),e}function uL(t=Gi,e){return{...t,...e,colors:{...t.colors,...e.colors},typography:{...t.typography,...e.typography},spacing:{...t.spacing,...e.spacing},borderRadius:{...t.borderRadius,...e.borderRadius},shadows:{...t.shadows,...e.shadows}}}function fL(t){var n;const{theme:e}=xw();return((n=e.components)==null?void 0:n[t])||{}}const hL=sh("voice-modality","voice",{onActivate:async t=>{const e=t.config;e.enableTranscription&&mL(t),e.enableVoiceActivation&&pL(t,e),console.log("Voice modality activated",e)},onDeactivate:async t=>{console.log("Voice modality deactivated")},onMessage:async(t,e)=>{e.type==="audio"&&gL(t,e)}});function mL(t,e){t.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),t.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function pL(t,e){const n=e.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function gL(t,e){console.log("Playing audio response:",e.content)}const vL=sh("chat-modality","chat",{onActivate:async t=>{const e=t.config;e.enableRichText&&yL(),e.enableFileUpload&&bL(t),e.enableCustomComponents&&xL(),console.log("Chat modality activated",e)},onDeactivate:async t=>{console.log("Chat modality deactivated")},onMessage:async(t,e)=>{const n=t.config;e.type==="ui_component"?SL(t,e):e.type==="text"&&n.enableRichText&&wL(t,e)}});function yL(t){console.log("Rich text support enabled")}function bL(t){console.log("File upload enabled"),t.on("chat.file.uploaded",e=>{console.log("File uploaded:",e.name)})}function xL(t){console.log("Custom components enabled");const e=new Map;e.set("quick-actions",CL),e.set("form",kL),e.set("card",TL),e.set("chart",EL)}function SL(t,e){const{componentType:n,props:i}=e.metadata;console.log("Rendering custom component:",n,i),t.emit("chat.component.render",{type:n,props:i,timestamp:new Date})}function wL(t,e){console.log("Processing rich text message:",e.content)}function CL(t){return{type:"quick-actions",actions:t.actions||[],layout:t.layout||"horizontal"}}function kL(t){return{type:"form",fields:t.fields||[],submitAction:t.submitAction,validation:t.validation}}function TL(t){return{type:"card",title:t.title,content:t.content,actions:t.actions,variant:t.variant||"default"}}function EL(t){return{type:"chart",chartType:t.chartType||"line",data:t.data,options:t.options}}function ba({track:t,participantName:e,showControls:n=!0,showName:i=!0,showMuteIndicator:r=!0,isPinned:s=!1,className:o="",onClick:a,onPin:c,onUnpin:l}){const d=R.useRef(null),[u,f]=R.useState(!1);R.useEffect(()=>{if(!d.current||!t.isEnabled)return;const y=d.current;return y.srcObject=null,()=>{y.srcObject&&(y.srcObject=null)}},[t]);const p=()=>{a==null||a(t)},g=y=>{y.stopPropagation(),s?l==null||l(t):c==null||c(t)},h=["voxket-video-tile",t.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",t.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",s?"voxket-video-tile--pinned":"",t.isEnabled?"":"voxket-video-tile--disabled",u?"voxket-video-tile--hovered":"",o].filter(Boolean).join(" ");return m.jsxs("div",{className:h,onClick:p,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{aspectRatio:t.dimensions?`${t.dimensions.width} / ${t.dimensions.height}`:"16 / 9"},children:[m.jsx("video",{ref:d,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:t.isLocal}),!t.isEnabled&&m.jsxs("div",{className:"voxket-video-placeholder",children:[m.jsx("div",{className:"voxket-video-placeholder-icon",children:t.isScreenShare?"🖥️":"📹"}),m.jsx("p",{className:"voxket-video-placeholder-text",children:t.isScreenShare?"Screen sharing paused":"Camera off"})]}),m.jsxs("div",{className:"voxket-video-overlay",children:[i&&e&&m.jsxs("div",{className:"voxket-video-name",children:[e,t.isLocal&&" (You)"]}),r&&!t.isEnabled&&m.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(u||s)&&m.jsxs("div",{className:"voxket-video-controls",children:[m.jsx("button",{className:`voxket-video-control-btn ${s?"voxket-video-control-btn--active":""}`,onClick:g,title:s?"Unpin video":"Pin video",children:"📌"}),t.isScreenShare&&m.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),t.source&&m.jsx("div",{className:"voxket-video-source",children:t.source})]})]}),!t.isEnabled&&m.jsx("div",{className:"voxket-video-loading",children:m.jsx("div",{className:"voxket-spinner"})})]})}function PL({tracks:t,layout:e,className:n="",onLayoutChange:i,onTrackClick:r,maxVisibleTracks:s=9,showPagination:o=!0}){const[a,c]=R.useState(0),[l,d]=R.useState(null),u=R.useMemo(()=>{let w=[...t];e.type==="speaker"&&l&&(w=[l,...t.filter(x=>x.id!==l.id)]);const C=a*s,S=C+s;return w.slice(C,S)},[t,e,l,a,s]),f=Math.ceil(t.length/s),p=R.useMemo(()=>{const w=u.length;switch(e.type){case"grid":const C=Math.ceil(Math.sqrt(w)),S=Math.ceil(w/C);return{display:"grid",gridTemplateColumns:`repeat(${C}, 1fr)`,gridTemplateRows:`repeat(${S}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[e.type,u.length]),g=w=>{d(w)},h=()=>{d(null)},y=w=>{i==null||i({...e,type:w})},b=["voxket-video-grid",`voxket-video-grid--${e.type}`,`voxket-video-grid--${u.length}-tracks`,n].filter(Boolean).join(" ");return t.length===0?m.jsx("div",{className:"voxket-video-grid-empty",children:m.jsxs("div",{className:"voxket-video-grid-empty-content",children:[m.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),m.jsx("p",{children:"No video tracks available"})]})}):m.jsxs("div",{className:b,children:[m.jsxs("div",{className:"voxket-video-grid-controls",children:[m.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(w=>m.jsx("button",{className:`voxket-layout-btn ${e.type===w?"voxket-layout-btn--active":""}`,onClick:()=>y(w),title:`Switch to ${w} layout`,children:RL(w)},w))}),m.jsxs("div",{className:"voxket-video-count",children:[t.length," participant",t.length!==1?"s":""]})]}),m.jsx("div",{className:"voxket-video-grid-content",style:p,children:e.type==="speaker"&&l?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"voxket-video-speaker-main",children:m.jsx(ba,{track:l,participantName:`Participant ${l.participantId}`,isPinned:!0,onClick:r,onUnpin:h})}),m.jsx("div",{className:"voxket-video-speaker-sidebar",children:u.filter(w=>w.id!==l.id).map(w=>m.jsx(ba,{track:w,participantName:`Participant ${w.participantId}`,showControls:!1,onClick:r,onPin:g},w.id))})]}):u.map(w=>m.jsx(ba,{track:w,participantName:`Participant ${w.participantId}`,isPinned:(l==null?void 0:l.id)===w.id,onClick:r,onPin:g,onUnpin:h},w.id))}),o&&f>1&&m.jsxs("div",{className:"voxket-video-pagination",children:[m.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.max(0,a-1)),disabled:a===0,children:"←"}),m.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",f]}),m.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(f-1,a+1)),disabled:a===f-1,children:"→"})]})]})}function RL(t){switch(t){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function AL({localTrack:t,onToggleCamera:e,onToggleScreenShare:n,onLayoutChange:i,showLayoutControls:r=!0,showCameraControls:s=!0,showScreenShareControls:o=!0,className:a=""}){const c=["voxket-video-controls",a].filter(Boolean).join(" "),l=d=>{i==null||i({type:d,showLocalVideo:!0,aspectRatio:"16:9"})};return m.jsxs("div",{className:c,children:[s&&m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),m.jsxs("button",{className:`voxket-control-btn ${t!=null&&t.isEnabled?"voxket-control-btn--active":""}`,onClick:e,title:t!=null&&t.isEnabled?"Turn off camera":"Turn on camera",children:[m.jsx("span",{className:"voxket-control-icon",children:t!=null&&t.isEnabled?"📹":"📷"}),m.jsx("span",{className:"voxket-control-label",children:t!=null&&t.isEnabled?"Camera On":"Camera Off"})]}),(t==null?void 0:t.dimensions)&&m.jsxs("div",{className:"voxket-video-info",children:[t.dimensions.width," × ",t.dimensions.height]})]}),o&&m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),m.jsxs("button",{className:`voxket-control-btn ${t!=null&&t.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:t!=null&&t.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[m.jsx("span",{className:"voxket-control-icon",children:t!=null&&t.isScreenShare?"🛑":"🖥️"}),m.jsx("span",{className:"voxket-control-label",children:t!=null&&t.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),r&&m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),m.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:d,icon:u,label:f})=>m.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>l(d),title:`Switch to ${f} layout`,children:[m.jsx("span",{className:"voxket-control-icon",children:u}),m.jsx("span",{className:"voxket-control-label",children:f})]},d))})]}),m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),m.jsxs("div",{className:"voxket-video-settings",children:[m.jsxs("div",{className:"voxket-setting-group",children:[m.jsx("label",{className:"voxket-setting-label",children:"Quality"}),m.jsxs("select",{className:"voxket-setting-select",children:[m.jsx("option",{value:"high",children:"High (720p)"}),m.jsx("option",{value:"medium",children:"Medium (480p)"}),m.jsx("option",{value:"low",children:"Low (240p)"})]})]}),m.jsxs("div",{className:"voxket-setting-group",children:[m.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),m.jsxs("select",{className:"voxket-setting-select",children:[m.jsx("option",{value:"30",children:"30 fps"}),m.jsx("option",{value:"15",children:"15 fps"}),m.jsx("option",{value:"10",children:"10 fps"})]})]}),m.jsxs("div",{className:"voxket-setting-group",children:[m.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),m.jsxs("select",{className:"voxket-setting-select",children:[m.jsx("option",{value:"unlimited",children:"Unlimited"}),m.jsx("option",{value:"1000",children:"1 Mbps"}),m.jsx("option",{value:"500",children:"500 Kbps"}),m.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),m.jsxs("div",{className:"voxket-video-stats",children:[m.jsxs("div",{className:"voxket-stat-item",children:[m.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),m.jsx("span",{className:"voxket-stat-value",children:t!=null&&t.dimensions?`${t.dimensions.width}×${t.dimensions.height}`:"N/A"})]}),m.jsxs("div",{className:"voxket-stat-item",children:[m.jsx("span",{className:"voxket-stat-label",children:"Source:"}),m.jsx("span",{className:"voxket-stat-value",children:(t==null?void 0:t.source)||"None"})]}),m.jsxs("div",{className:"voxket-stat-item",children:[m.jsx("span",{className:"voxket-stat-label",children:"Status:"}),m.jsx("span",{className:`voxket-stat-value ${t!=null&&t.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:t!=null&&t.isEnabled?"Active":"Inactive"})]})]})]})]})}const ww=({handler:t,loadData:e,data:n,client:i,addLocalMessage:r})=>{const[s,o]=v.useState(null),[a,c]=v.useState(!0),[l,d]=v.useState(!1),[u]=v.useState(Date.now());v.useEffect(()=>{(async()=>{try{if(c(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const y={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};o(y),console.log("📋 AssignmentView: Assignment loaded from RPC data:",y)}}catch(y){console.error("📋 AssignmentView: Error loading assignment:",y),o({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{c(!1)}})()},[n,e]);const f=({message:h,assignment:y})=>{const b=h.toLowerCase().includes("declined"),w=b?"bg-red-50 border-red-200":"bg-green-50 border-green-200",C=b?"text-red-700":"text-green-700",S=b?"❌":"🎉";return m.jsxs("div",{className:`max-w-sm mx-auto ${w} border rounded-lg shadow p-3 flex flex-col items-center`,children:[m.jsx("div",{className:"text-2xl mb-2",children:S}),m.jsx("div",{className:`${C} font-semibold text-sm mb-1`,children:h}),m.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:y.title}),m.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},p=async()=>{if(!(!s||!t)){d(!0);try{const h={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",h),t.didSuccess(h,m.jsx(f,{message:"Assignment accepted!",assignment:s}))}catch(h){console.error("📋 AssignmentView: Error accepting assignment:",h),t.didFail({error:"Failed to accept assignment"})}finally{d(!1)}}},g=async()=>{if(!(!s||!t)){d(!0);try{const h={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",h),t.didSuccess(h,m.jsx(f,{message:"Assignment declined",assignment:s}))}catch(h){console.error("📋 AssignmentView: Error declining assignment:",h),t.didFail({error:"Failed to decline assignment"})}finally{d(!1)}}};return a?m.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:m.jsxs("div",{className:"flex items-center justify-center py-4",children:[m.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),m.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):s?m.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[m.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:m.jsx("div",{className:"flex items-center justify-between",children:m.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:s.title})})}),m.jsxs("div",{className:"p-3",children:[m.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:m.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:s.description})}),m.jsx("div",{className:"mb-3",children:m.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[m.jsx("span",{className:"text-xs mr-1",children:"📅"}),m.jsxs("span",{children:["Est: ",s.estimated_time_of_completion]})]})}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("button",{onClick:p,disabled:l,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:l?m.jsxs("span",{className:"flex items-center justify-center",children:[m.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),m.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),m.jsx("button",{onClick:g,disabled:l,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):m.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:m.jsxs("div",{className:"text-center py-4",children:[m.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),m.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function IL(){const[t,e]=v.useState(null),[n,i]=v.useState([]);v.useEffect(()=>{const a=new bo({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return e(a),a.on("rpc.method.called",c=>{console.log("RPC Method Called:",c)}),a.on("rpc.interaction.completed",c=>{console.log("RPC Interaction Completed:",c)}),()=>{a.disconnect()}},[]);const r=async()=>{if(t)try{await t.registerFrontendRPC("give_assignment",ww,"embedded");const a=t.getRegisteredRpcMethods();i(a),console.log("✅ Assignment RPC registered successfully")}catch(a){console.error("❌ Failed to register assignment RPC:",a)}},s=async()=>{if(!t)return;const a=({handler:c,timeout:l})=>{const[d,u]=v.useState(""),f=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],p=h=>{u(h)},g=()=>{const h=f.find(y=>y.id===d);c==null||c.didSuccess({selectedProduct:d,productName:h==null?void 0:h.name,price:h==null?void 0:h.price,timestamp:new Date().toISOString()})};return m.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[m.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),m.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),m.jsx("div",{className:"space-y-3 mb-6",children:f.map(h=>m.jsx("div",{onClick:()=>p(h.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${d===h.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:m.jsxs("div",{className:"flex justify-between items-center",children:[m.jsxs("div",{children:[m.jsx("h4",{className:"font-medium",children:h.name}),m.jsx("p",{className:"text-gray-600 text-sm",children:h.price})]}),m.jsx("div",{className:`w-4 h-4 rounded-full ${d===h.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},h.id))}),m.jsxs("div",{className:"flex justify-end space-x-3",children:[m.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),m.jsx("button",{onClick:g,disabled:!d,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),l&&m.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",l," seconds"]})]})};try{await t.registerFrontendRPC("recommend_product",a,"modal");const c=t.getRegisteredRpcMethods();i(c),console.log("✅ Product Recommendation RPC registered successfully")}catch(c){console.error("❌ Failed to register product recommendation RPC:",c)}},o=async()=>{if(!t)return;const a=({handler:c})=>{const[l,d]=v.useState(0),[u,f]=v.useState(""),p=()=>{c==null||c.didSuccess({rating:l,comment:u,timestamp:new Date().toISOString()})};return m.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[m.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),m.jsxs("div",{className:"mb-4",children:[m.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),m.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(g=>m.jsx("button",{onClick:()=>d(g),className:`text-2xl ${g<=l?"text-yellow-400":"text-gray-300"}`,children:"⭐"},g))})]}),m.jsxs("div",{className:"mb-4",children:[m.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),m.jsx("textarea",{value:u,onChange:g=>f(g.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),m.jsxs("div",{className:"flex justify-end space-x-2",children:[m.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),m.jsx("button",{onClick:p,disabled:l===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await t.registerFrontendRPC("collect_feedback",a,"embedded");const c=t.getRegisteredRpcMethods();i(c),console.log("✅ Feedback RPC registered successfully")}catch(c){console.error("❌ Failed to register feedback RPC:",c)}};return m.jsxs("div",{className:"p-6",children:[m.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),m.jsxs("div",{className:"space-y-4 mb-6",children:[m.jsxs("div",{children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),m.jsxs("div",{className:"space-x-2",children:[m.jsx("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),m.jsx("button",{onClick:s,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),m.jsx("button",{onClick:o,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?m.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>m.jsx("li",{className:"text-gray-700",children:m.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):m.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),m.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),m.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[m.jsxs("li",{children:["Register RPC methods with React components using ",m.jsx("code",{children:"client.registerFrontendRPC()"})]}),m.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),m.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),m.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),m.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),m.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[m.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),m.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),m.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
207
319
  const response = await participant.performRpc({
208
320
  method: 'give_assignment',
209
321
  data: JSON.stringify({
@@ -214,4 +326,4 @@ const response = await participant.performRpc({
214
326
  })
215
327
  });
216
328
 
217
- console.log('User response:', response);`})]})]})}const fw={async checkAvailableRpcs(e){const t=e.getRegisteredRpcMethods();return console.log("🔍 Agent: Available RPC methods:",t),t},async triggerAssignment(e,t){const n={title:"Complete Q4 Sales Analysis Report",description:"Please analyze the Q4 sales data and create a comprehensive report with insights, trends, and recommendations for the upcoming quarter. Include visualizations and executive summary.",estimated_time_of_completion:"2-3 hours"};try{console.log("🤖 Agent: Triggering give_assignment RPC with data:",n);const s=await e.localParticipant.performRpc(t,"give_assignment",JSON.stringify(n),{responseTimeout:12e4}),r=JSON.parse(s);return console.log("✅ Agent: Received user response:",r),await this.processAssignmentResponse(r),r}catch(s){throw console.error("❌ Agent: RPC failed:",s),s}},async processAssignmentResponse(e){console.log("🧠 Agent: Processing assignment response...");const t=e.status,n=e.assignmentId,s=e.timeSpent;return t==="accepted"?(console.log("🎉 Agent: User accepted the assignment!"),console.log(`� Assignment ID: ${n}`),console.log(`⏱️ Time to respond: ${s}ms`),console.log("💬 Agent: Sending follow-up:","Great! I've recorded that you've accepted the assignment. You'll receive the detailed requirements and access to the data shortly. Let me know if you need any clarification!")):t==="declined"?(console.log("❌ Agent: User declined the assignment"),console.log("💬 Agent: Sending follow-up:","No problem! Is there anything specific about this assignment that doesn't work for you? I can suggest alternatives or modify the requirements.")):t==="completed"&&(console.log("✅ Agent: User completed the assignment"),console.log("💬 Agent: Sending follow-up:","Excellent work! Could you please share the completed report? I'm excited to review your analysis and insights.")),{status:t,assignmentId:n,timeSpent:s,processed:!0,followupAction:t==="accepted"?"send_requirements":t==="declined"?"offer_alternatives":"request_deliverables"}},getAssignmentExamples(){return{marketing:{title:"Create Social Media Campaign",description:"Design and plan a social media campaign for our new product launch. Include content calendar, post designs, and engagement strategy.",estimated_time_of_completion:"4-5 hours"},technical:{title:"API Integration Documentation",description:"Create comprehensive documentation for our new API endpoints, including examples, error codes, and best practices for developers.",estimated_time_of_completion:"6-8 hours"},research:{title:"Market Research Analysis",description:"Research and analyze competitor pricing strategies in our target market. Provide recommendations for our pricing model.",estimated_time_of_completion:"3-4 hours"},quick:{title:"Customer Feedback Summary",description:"Review this week's customer feedback and create a summary of key themes and actionable insights.",estimated_time_of_completion:"30-45 minutes"}}}},hw=e=>typeof window>"u"?null:E.createElement(ef,e);exports.AssignmentView=pf;exports.CompoundProvider=lf;exports.InteractiveComponent=xn;exports.PluginManager=qu;exports.RpcExamples=uw;exports.SessionContainer=uf;exports.SessionContent=yi;exports.SessionControls=df;exports.SessionFooter=vi;exports.SessionHeader=xi;exports.SessionLogViewer=F2;exports.SessionMetricsComponent=O2;exports.Slot=Cs;exports.ThemeProvider=Z2;exports.VideoControls=dw;exports.VideoGrid=lw;exports.VideoTile=Es;exports.VoxketClient=es;exports.VoxketEventEmitter=mi;exports.VoxketProvider=Qu;exports.VoxketSDK=es;exports.VoxketSessionComponent=uf;exports.agentRpcExample=fw;exports.analyticsPlugin=j2;exports.chatModalityPlugin=J2;exports.createCustomTheme=W2;exports.createModalityPlugin=pi;exports.createPlugin=T2;exports.darkTheme=go;exports.debugPlugin=P2;exports.default=hw;exports.defaultTheme=Ht;exports.enterpriseTheme=xo;exports.flattenTheme=mf;exports.metricsPlugin=M2;exports.useComponentTheme=K2;exports.useCompoundContext=ts;exports.useSessionLogging=Xu;exports.useTheme=hf;exports.useVoxket=ht;exports.useVoxketCamera=sf;exports.useVoxketChat=Ys;exports.useVoxketChatInput=$2;exports.useVoxketConnection=gi;exports.useVoxketMetrics=tf;exports.useVoxketMicrophone=nf;exports.useVoxketParticipants=of;exports.useVoxketScreenShare=rf;exports.useVoxketSession=Kt;exports.useVoxketVideo=_2;exports.voiceModalityPlugin=Y2;exports.withCompoundComponent=cf;
329
+ console.log('User response:', response);`})]})]})}const ML={async checkAvailableRpcs(t){const e=t.getRegisteredRpcMethods();return console.log("🔍 Agent: Available RPC methods:",e),e},async triggerAssignment(t,e){const n={title:"Complete Q4 Sales Analysis Report",description:"Please analyze the Q4 sales data and create a comprehensive report with insights, trends, and recommendations for the upcoming quarter. Include visualizations and executive summary.",estimated_time_of_completion:"2-3 hours"};try{console.log("🤖 Agent: Triggering give_assignment RPC with data:",n);const i=await t.localParticipant.performRpc(e,"give_assignment",JSON.stringify(n),{responseTimeout:12e4}),r=JSON.parse(i);return console.log("✅ Agent: Received user response:",r),await this.processAssignmentResponse(r),r}catch(i){throw console.error("❌ Agent: RPC failed:",i),i}},async processAssignmentResponse(t){console.log("🧠 Agent: Processing assignment response...");const e=t.status,n=t.assignmentId,i=t.timeSpent;return e==="accepted"?(console.log("🎉 Agent: User accepted the assignment!"),console.log(`� Assignment ID: ${n}`),console.log(`⏱️ Time to respond: ${i}ms`),console.log("💬 Agent: Sending follow-up:","Great! I've recorded that you've accepted the assignment. You'll receive the detailed requirements and access to the data shortly. Let me know if you need any clarification!")):e==="declined"?(console.log("❌ Agent: User declined the assignment"),console.log("💬 Agent: Sending follow-up:","No problem! Is there anything specific about this assignment that doesn't work for you? I can suggest alternatives or modify the requirements.")):e==="completed"&&(console.log("✅ Agent: User completed the assignment"),console.log("💬 Agent: Sending follow-up:","Excellent work! Could you please share the completed report? I'm excited to review your analysis and insights.")),{status:e,assignmentId:n,timeSpent:i,processed:!0,followupAction:e==="accepted"?"send_requirements":e==="declined"?"offer_alternatives":"request_deliverables"}},getAssignmentExamples(){return{marketing:{title:"Create Social Media Campaign",description:"Design and plan a social media campaign for our new product launch. Include content calendar, post designs, and engagement strategy.",estimated_time_of_completion:"4-5 hours"},technical:{title:"API Integration Documentation",description:"Create comprehensive documentation for our new API endpoints, including examples, error codes, and best practices for developers.",estimated_time_of_completion:"6-8 hours"},research:{title:"Market Research Analysis",description:"Research and analyze competitor pricing strategies in our target market. Provide recommendations for our pricing model.",estimated_time_of_completion:"3-4 hours"},quick:{title:"Customer Feedback Summary",description:"Review this week's customer feedback and create a summary of key themes and actionable insights.",estimated_time_of_completion:"30-45 minutes"}}}},_L=t=>typeof window>"u"?null:R.createElement(cw,t);exports.AssignmentView=ww;exports.CompoundProvider=pw;exports.InteractiveComponent=Qr;exports.PluginManager=sw;exports.RpcExamples=IL;exports.SessionContainer=yw;exports.SessionContent=ch;exports.SessionControls=vw;exports.SessionFooter=lh;exports.SessionHeader=ah;exports.SessionLogViewer=nL;exports.SessionMetricsComponent=iL;exports.Slot=ya;exports.ThemeProvider=dL;exports.VideoControls=AL;exports.VideoGrid=PL;exports.VideoTile=ba;exports.VoxketClient=bo;exports.VoxketEventEmitter=rh;exports.VoxketProvider=aw;exports.VoxketSDK=bo;exports.VoxketSessionComponent=yw;exports.agentRpcExample=ML;exports.analyticsPlugin=Kj;exports.chatModalityPlugin=vL;exports.createCustomTheme=uL;exports.createModalityPlugin=sh;exports.createPlugin=qj;exports.darkTheme=yu;exports.debugPlugin=Gj;exports.default=_L;exports.defaultTheme=Gi;exports.enterpriseTheme=bu;exports.flattenTheme=Sw;exports.metricsPlugin=Zj;exports.useComponentTheme=fL;exports.useCompoundContext=xo;exports.useSessionLogging=rw;exports.useTheme=xw;exports.useVoxket=jn;exports.useVoxketCamera=uw;exports.useVoxketChat=Ec;exports.useVoxketChatInput=sL;exports.useVoxketConnection=oh;exports.useVoxketMetrics=lw;exports.useVoxketMicrophone=dw;exports.useVoxketParticipants=hw;exports.useVoxketScreenShare=fw;exports.useVoxketSession=sr;exports.useVoxketVideo=rL;exports.voiceModalityPlugin=hL;exports.withCompoundComponent=gw;