@voxket-ai/voxket-live 1.0.53 → 1.0.54

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 +177 -94
  2. package/dist/index.js +35647 -13144
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,209 +1,292 @@
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={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
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={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
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`
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=`
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:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
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(`
1
+ "use strict";var $S=Object.defineProperty;var HS=(t,e,n)=>e in t?$S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ye=(t,e,n)=>HS(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react"),m=require("react/jsx-runtime"),Wg=require("react-dom"),zS=require("react-dom/client");function qg(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=qg(R),xa=qg(Wg);function WS(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 qS=Object.defineProperty,KS=(t,e,n)=>e in t?qS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dh=(t,e,n)=>KS(t,typeof e!="symbol"?e+"":e,n);let yt=class{constructor(){Dh(this,"_locking"),Dh(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 He(t,e){if(!t)throw new Error(e)}const GS=34028234663852886e22,ZS=-34028234663852886e22,YS=4294967295,JS=2147483647,XS=-2147483648;function So(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>JS||t<XS)throw new Error("invalid int 32: "+t)}function pl(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>YS||t<0)throw new Error("invalid uint 32: "+t)}function Kg(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>GS||t<ZS))throw new Error("invalid float 32: "+t)}const Gg=Symbol("@bufbuild/protobuf/enum-type");function QS(t){const e=t[Gg];return He(e,"missing enum type on enum object"),e}function Zg(t,e,n,i){t[Gg]=Yg(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function Yg(t,e,n){const i=Object.create(null),r=Object.create(null),s=[];for(const o of e){const a=Jg(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 ew(t,e,n){const i={};for(const r of e){const s=Jg(r);i[s.localName]=s.no,i[s.no]=s.localName}return Zg(i,t,e),i}function Jg(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class qd{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 tw(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 qd),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 nw(){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 wo=4294967296;function jh(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>=wo&&(r=r+(i/wo|0),i=i%wo)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?Qg(i,r):Kd(i,r)}function iw(t,e){let n=Kd(t,e);const i=n.hi&2147483648;i&&(n=Qg(n.lo,n.hi));const r=Xg(n.lo,n.hi);return i?"-"+r:r}function Xg(t,e){if({lo:t,hi:e}=rw(t,e),e<=2097151)return String(wo*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()+Lh(o)+Lh(s)}function rw(t,e){return{lo:t>>>0,hi:e>>>0}}function Kd(t,e){return{lo:t|0,hi:e|0}}function Qg(t,e){return e=~e,t?t=~t+1:e+=1,Kd(t,e)}const Lh=t=>{const e=String(t);return"0000000".slice(e.length)+e};function Vh(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 sw(){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 ow(){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=>He(/^-?[0-9]+$/.test(r),"int64 invalid: ".concat(r)),i=r=>He(/^[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),jh(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),i(r),jh(r)},dec(r,s){return iw(r,s)},uDec(r,s){return Xg(r,s)}}}const De=ow();var G;(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"})(G||(G={}));var Xn;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(Xn||(Xn={}));function Bn(t,e,n){if(e===n)return!0;if(t==G.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 G.UINT64:case G.FIXED64:case G.INT64:case G.SFIXED64:case G.SINT64:return e==n}return!1}function Tr(t,e){switch(t){case G.BOOL:return!1;case G.UINT64:case G.FIXED64:case G.INT64:case G.SFIXED64:case G.SINT64:return e==0?De.zero:"0";case G.DOUBLE:case G.FLOAT:return 0;case G.BYTES:return new Uint8Array(0);case G.STRING:return"";default:return 0}}function e0(t,e){switch(t){case G.BOOL:return e===!1;case G.STRING:return e==="";case G.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var Ge;(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"})(Ge||(Ge={}));class aw{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(pl(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return So(e),Vh(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){Kg(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){pl(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){So(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return So(e),e=(e<<1^e>>31)>>>0,Vh(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),i=new DataView(n.buffer),r=De.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=De.uEnc(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=De.enc(e);return oc(n.lo,n.hi,this.buf),this}sint64(e){let n=De.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=De.uEnc(e);return oc(n.lo,n.hi,this.buf),this}}class cw{constructor(e,n){this.varint64=nw,this.uint32=sw,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 Ge.Varint:for(;this.buf[this.pos++]&128;);break;case Ge.Bit64:this.pos+=4;case Ge.Bit32:this.pos+=4;break;case Ge.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Ge.StartGroup:for(;;){const[s,o]=this.tag();if(o===Ge.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 De.dec(...this.varint64())}uint64(){return De.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),i=-(e&1);return e=(e>>>1|(n&1)<<31)^i,n=n>>>1^i,De.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 De.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return De.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 lw(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 t0(t){const e=t.field.localName,n=Object.create(null);return n[e]=dw(t),[n,()=>n[e]]}function dw(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 Tr(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 uw(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 En="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Sa=[];for(let t=0;t<En.length;t++)Sa[En[t].charCodeAt(0)]=t;Sa[45]=En.indexOf("+");Sa[95]=En.indexOf("/");const n0={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=Sa[t.charCodeAt(a)],s===void 0)switch(t[a]){case"=":r=0;case`
2
+ `: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+=En[i>>2],r=(i&3)<<4,n=1;break;case 1:e+=En[r|i>>4],r=(i&15)<<2,n=2;break;case 2:e+=En[r|i>>6],e+=En[i&63],n=0;break}return n&&(e+=En[r],e+="=",n==1&&(e+="=")),e}};function hw(t,e,n){r0(e,t);const i=e.runtime.bin.makeReadOptions(n),r=uw(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,o]=t0(e);for(const a of r)e.runtime.bin.readField(s,i.readerFactory(a.data),e.field,a.wireType,i);return o()}function fw(t,e,n,i){r0(e,t);const r=e.runtime.bin.makeReadOptions(i),s=e.runtime.bin.makeWriteOptions(i);if(i0(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 i0(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 r0(t,e){He(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function s0(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:!e0(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function Fh(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?Tr(t.T,t.L):void 0;break;case"message":e[n]=void 0;break}}function Pn(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(qd.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 o0(t,e){return Pn(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}G.DOUBLE,G.FLOAT,G.INT64,G.UINT64,G.INT32,G.UINT32,G.BOOL,G.STRING,G.BYTES;const Uh={ignoreUnknownFields:!1},Bh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function mw(t){return t?Object.assign(Object.assign({},Uh),t):Uh}function pw(t){return t?Object.assign(Object.assign({},Bh),t):Bh}const Zo=Symbol(),ko=Symbol();function gw(){return{makeReadOptions:mw,makeWriteOptions:pw,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(rn(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)}$h(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,h]=t0(d);$h(u,a,d.field,n,d),fw(i,d,h(),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(!s0(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!yw(r))continue}const o=r.oneof?t[r.oneof.localName].value:t[r.localName],a=Hh(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&&i0(t,a)){const c=hw(t,a,e),l=Hh(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??Xn.BIGINT,!0)},writeScalar(t,e,n){if(e!==void 0&&(n||e0(t,e)))return Co(t,e)},debug:rn}}function rn(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 $h(t,e,n,i,r){let s=n.localName;if(n.repeated){if(He(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(rn(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(rn(a)));switch(n.kind){case"message":o.push(n.T.fromJson(a,i));break;case"enum":const c=ac(n.T,a,i.ignoreUnknownFields,!0);c!==ko&&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(rn(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(rn(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=vw(n.K,a)}catch(d){let u="cannot decode map key for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(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=ac(n.V.T,c,i.ignoreUnknownFields,!0);d!==ko&&(o[l]=d);break;case"scalar":try{o[l]=ds(n.V.T,c,Xn.BIGINT,!0)}catch(u){let h="cannot decode map value for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e));throw u instanceof Error&&u.message.length>0&&(h+=": ".concat(u.message)),new Error(h)}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];Pn(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=ac(n.T,e,i.ignoreUnknownFields,!1);switch(c){case Zo:Fh(n,t);break;case ko:break;default:t[s]=c;break}break;case"scalar":try{const l=ds(n.T,e,n.L,!1);switch(l){case Zo:Fh(n,t);break;default:t[s]=l;break}}catch(l){let d="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e));throw l instanceof Error&&l.message.length>0&&(d+=": ".concat(l.message)),new Error(d)}break}}function vw(t,e){if(t===G.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return ds(t,e,Xn.BIGINT,!0).toString()}function ds(t,e,n,i){if(e===null)return i?Tr(t,n):Zo;switch(t){case G.DOUBLE:case G.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==G.FLOAT&&Kg(r),r;case G.INT32:case G.FIXED32:case G.SFIXED32:case G.SINT32:case G.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==G.UINT32||t==G.FIXED32?pl(s):So(s),s;case G.INT64:case G.SFIXED64:case G.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=De.parse(e);return n?o.toString():o;case G.FIXED64:case G.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=De.uParse(e);return n?a.toString():a;case G.BOOL:if(typeof e!="boolean")break;return e;case G.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case G.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return n0.dec(e)}throw new Error}function ac(t,e,n,i){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:i?t.values[0].no:Zo;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 ko;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(rn(e)))}function yw(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function Hh(t,e,n){if(t.kind=="map"){He(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()]=Co(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()]=cc(s,a,n.enumAsInteger);break}return n.emitDefaultValues||r.length>0?i:void 0}if(t.repeated){He(Array.isArray(e));const i=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)i.push(Co(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)i.push(cc(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 Co(t.T,e);case"enum":return cc(t.T,e,n.enumAsInteger);case"message":return o0(t.T,e).toJson(n)}}function cc(t,e,n){var i;if(He(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 Co(t,e){switch(t){case G.INT32:case G.SFIXED32:case G.SINT32:case G.FIXED32:case G.UINT32:return He(typeof e=="number"),e;case G.FLOAT:case G.DOUBLE:return He(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case G.STRING:return He(typeof e=="string"),e;case G.BOOL:return He(typeof e=="boolean"),e;case G.UINT64:case G.FIXED64:case G.INT64:case G.SFIXED64:case G.SINT64:return He(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case G.BYTES:return He(e instanceof Uint8Array),n0.enc(e)}}const zi=Symbol("@bufbuild/protobuf/unknown-fields"),zh={readUnknownFields:!0,readerFactory:t=>new cw(t)},Wh={writeUnknownFields:!0,writerFactory:()=>new aw};function bw(t){return t?Object.assign(Object.assign({},zh),t):zh}function xw(t){return t?Object.assign(Object.assign({},Wh),t):Wh}function Sw(){return{makeReadOptions:bw,makeWriteOptions:xw,listUnknownFields(t){var e;return(e=t[zi])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[zi]},writeUnknownFields(t,e){const i=t[zi];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[zi])||(r[zi]=[]),r[zi].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==Ge.EndGroup));){const l=s.fields.find(a);if(!l){const d=e.skip(c,a);i.readUnknownFields&&this.onUnknownField(t,a,c,d);continue}qh(t,e,l,c,i)}if(r&&(c!=Ge.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:qh,writeMessage(t,e,n){const i=t.getType();for(const r of i.fields.byNumber()){if(!s0(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];Kh(r,s,e,n)}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,i){e!==void 0&&Kh(t,e,n,i)}}}function qh(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"?G.INT32:n.T;let c=Yo;if(n.kind=="scalar"&&n.L>0&&(c=kw),s){let h=t[o];if(i==Ge.LengthDelimited&&a!=G.STRING&&a!=G.BYTES){let g=e.uint32()+e.pos;for(;e.pos<g;)h.push(c(e,a))}else h.push(c(e,a))}else t[o]=c(e,a);break;case"message":const l=n.T;s?t[o].push(To(e,new l,r,n)):Pn(t[o])?To(e,t[o],r,n):(t[o]=To(e,new l,r,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(t[o]=l.fieldWrapper.unwrapField(t[o])));break;case"map":let[d,u]=ww(n,e,r);t[o][d]=u;break}}function To(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 ww(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=Yo(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=Yo(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=To(e,new t.V.T,n,void 0);break}break}}if(s===void 0&&(s=Tr(t.K,Xn.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),o===void 0)switch(t.V.kind){case"scalar":o=Tr(t.V.T,Xn.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[s,o]}function kw(t,e){const n=Yo(t,e);return typeof n=="bigint"?n.toString():n}function Yo(t,e){switch(e){case G.STRING:return t.string();case G.BOOL:return t.bool();case G.DOUBLE:return t.double();case G.FLOAT:return t.float();case G.INT32:return t.int32();case G.INT64:return t.int64();case G.UINT64:return t.uint64();case G.FIXED64:return t.fixed64();case G.BYTES:return t.bytes();case G.FIXED32:return t.fixed32();case G.SFIXED32:return t.sfixed32();case G.SFIXED64:return t.sfixed64();case G.SINT64:return t.sint64();case G.UINT32:return t.uint32();case G.SINT32:return t.sint32()}}function Kh(t,e,n,i){He(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?G.INT32:t.T;if(r)if(He(Array.isArray(e)),t.packed)Tw(n,s,t.no,e);else for(const o of e)us(n,s,t.no,o);else us(n,s,t.no,e);break;case"message":if(r){He(Array.isArray(e));for(const o of e)Gh(n,i,t,o)}else Gh(n,i,t,e);break;case"map":He(typeof e=="object"&&e!=null);for(const[o,a]of Object.entries(e))Cw(n,i,t,o,a);break}}function Cw(t,e,n,i,r){t.tag(n.no,Ge.LengthDelimited),t.fork();let s=i;switch(n.K){case G.INT32:case G.FIXED32:case G.UINT32:case G.SFIXED32:case G.SINT32:s=Number.parseInt(i);break;case G.BOOL:He(i=="true"||i=="false"),s=i=="true";break}switch(us(t,n.K,1,s),n.V.kind){case"scalar":us(t,n.V.T,2,r);break;case"enum":us(t,G.INT32,2,r);break;case"message":He(r!==void 0),t.tag(2,Ge.LengthDelimited).bytes(r.toBinary(e));break}t.join()}function Gh(t,e,n,i){const r=o0(n.T,i);n.delimited?t.tag(n.no,Ge.StartGroup).raw(r.toBinary(e)).tag(n.no,Ge.EndGroup):t.tag(n.no,Ge.LengthDelimited).bytes(r.toBinary(e))}function us(t,e,n,i){He(i!==void 0);let[r,s]=a0(e);t.tag(n,r)[s](i)}function Tw(t,e,n,i){if(!i.length)return;t.tag(n,Ge.LengthDelimited).fork();let[,r]=a0(e);for(let s=0;s<i.length;s++)t[r](i[s]);t.join()}function a0(t){let e=Ge.Varint;switch(t){case G.BYTES:case G.STRING:e=Ge.LengthDelimited;break;case G.DOUBLE:case G.FIXED64:case G.SFIXED64:e=Ge.Bit64;break;case G.FIXED32:case G.SFIXED32:case G.FLOAT:e=Ge.Bit32;break}const n=G[t].toLowerCase();return[e,n]}function Ew(){return{setEnumType:Zg,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"&&!Pn(l,c.T)?l=new c.T(l):c&&c.kind==="scalar"&&c.T===G.BYTES&&(l=Gr(l)),s[r]={case:a,value:l};break;case"scalar":case"enum":let d=o[r];i.T===G.BYTES&&(d=i.repeated?d.map(Gr):Gr(d)),s[r]=d;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===G.BYTES)for(const[p,g]of Object.entries(o[r]))s[r][p]=Gr(g);else Object.assign(s[r],o[r]);break;case"message":const h=i.V.T;for(const p of Object.keys(o[r])){let g=o[r][p];h.fieldWrapper||(g=new h(g)),s[r][p]=g}break}break;case"message":const u=i.T;if(i.repeated)s[r]=o[r].map(h=>Pn(h,u)?h:new u(h));else{const h=o[r];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?s[r]=Gr(h):s[r]=h:s[r]=Pn(h,u)?h:new u(h)}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)=>Bn(i.T,o,s[a]));case"enum":return r.every((o,a)=>Bn(G.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&&!Pn(o)&&(o=i.T.fieldWrapper.wrapField(o)),a!==void 0&&!Pn(a)&&(a=i.T.fieldWrapper.wrapField(a))),i.T.equals(o,a);case"enum":return Bn(G.INT32,r,s);case"scalar":return Bn(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 Bn(G.INT32,r.value,s.value);case"scalar":return Bn(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(h=>d.equals(r[h],s[h]));case"enum":return l.every(h=>Bn(G.INT32,r[h],s[h]));case"scalar":const u=i.V.T;return l.every(h=>Bn(u,r[h],s[h]))}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(Ys);else if(r.kind=="map"){o=i[r.localName];for(const[a,c]of Object.entries(s))o[a]=Ys(c)}else r.kind=="oneof"?o=r.findField(s.case)?{case:s.case,value:Ys(s.value)}:{case:void 0}:o=Ys(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 Ys(t){if(t===void 0)return t;if(Pn(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Gr(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Pw(t,e,n){return{syntax:t,json:gw(),bin:Sw(),util:Object.assign(Object.assign({},Ew()),{newFieldList:e,initFields:n}),makeMessageType(i,r,s){return tw(this,i,r,s)},makeEnum:ew,makeEnumType:Yg,getEnumType:QS,makeExtension(i,r,s){return lw(this,i,r,s)}}}class Rw{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 c0(t,e){const n=l0(t);return e?n:Ow(_w(n))}function Aw(t){return c0(t,!1)}const Iw=l0;function l0(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 Mw=new Set(["constructor","toString","toJSON","valueOf"]),Nw=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),d0=t=>"".concat(t,"$"),_w=t=>Nw.has(t)?d0(t):t,Ow=t=>Mw.has(t)?d0(t):t;class Dw{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=Aw(e)}addField(e){He(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 jw(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=c0(d.name,d.oneof!==void 0),u.jsonName=(n=d.jsonName)!==null&&n!==void 0?n:Iw(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:Xn.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!=G.BYTES&&d.T!=G.STRING),d.oneof!==void 0){const h=typeof d.oneof=="string"?d.oneof:d.oneof.name;(!l||l.name!=h)&&(l=new Dw(h)),u.oneof=l,l.addField(u)}c.push(u)}return c}const U=Pw("proto3",t=>new Rw(t,e=>jw(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]=Tr(e.T,e.L);break}}});class vt extends qd{constructor(e){super(),this.seconds=De.zero,this.nanos=0,U.util.initPartial(e,this)}fromJson(e,n){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(U.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=De.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 vt.fromDate(new Date)}static fromDate(e){const n=e.getTime();return new vt({seconds:De.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(e,n){return new vt().fromBinary(e,n)}static fromJson(e,n){return new vt().fromJson(e,n)}static fromJsonString(e,n){return new vt().fromJsonString(e,n)}static equals(e,n){return U.util.equals(vt,e,n)}}vt.runtime=U;vt.typeName="google.protobuf.Timestamp";vt.fields=U.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Lw=U.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:vt},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:Vw,repeated:!0},{no:5,name:"events",kind:"message",T:Uw,repeated:!0}]),Vw=U.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:Fw,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Fw=U.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:vt},{no:3,name:"value",kind:"scalar",T:2}]),Uw=U.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:vt},{no:7,name:"normalized_end_timestamp",kind:"message",T:vt,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),u0=U.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Wt=U.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Xe=U.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"}]),Gd=U.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),rs=U.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),ys=U.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Kt=U.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"}]),Wi=U.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"}]),Bw=U.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),st=U.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"}]),wa=U.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:Jo,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:C0}]),Jo=U.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),$w=U.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:U.getEnumType(Xe),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}]),_i=U.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:U.getEnumType(hr)},{no:4,name:"tracks",kind:"message",T:ir,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:$w},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:U.getEnumType(Oi)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:U.getEnumType(Kt)},{no:18,name:"kind_details",kind:"enum",T:U.getEnumType(Hw),repeated:!0}]),hr=U.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Oi=U.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),Hw=U.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),Ct=U.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),zw=U.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:Pi,repeated:!0}]),ir=U.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:U.getEnumType(Wt)},{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:U.getEnumType(Xe)},{no:10,name:"layers",kind:"message",T:Pi,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:zw,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:U.getEnumType(Ct)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:C0},{no:19,name:"audio_features",kind:"enum",T:U.getEnumType(st),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:U.getEnumType(u0)}]),Pi=U.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:U.getEnumType(Gd)},{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}]),gt=U.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:U.getEnumType(me)},{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:f0,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Ww,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:m0,oneof:"value"},{no:7,name:"transcription",kind:"message",T:qw,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Lw,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:gl,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:p0,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:g0,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:v0,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:yl,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:bl,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:xl,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),me=U.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),Ww=U.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:h0,repeated:!0}]),h0=U.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}]),f0=U.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}]),m0=U.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),qw=U.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:Kw,repeated:!0}]),Kw=U.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}]),gl=U.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}]),p0=U.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}]),g0=U.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),v0=U.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:y0,oneof:"value"}]),y0=U.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}]),b0=U.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),x0=U.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:U.getEnumType(S0)},{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}]),S0=U.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),Gw=U.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:U.getEnumType(w0)},{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}]),w0=U.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"}]),k0=U.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:Zh},{no:2,name:"screen",kind:"message",T:Zh},{no:3,name:"resume_connection",kind:"enum",T:U.getEnumType(ys)},{no:4,name:"disabled_codecs",kind:"message",T:Zw},{no:5,name:"force_relay",kind:"enum",T:U.getEnumType(ys)}]),Zh=U.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:U.getEnumType(ys)}]),Zw=U.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:Jo,repeated:!0},{no:2,name:"publish",kind:"message",T:Jo,repeated:!0}]),C0=U.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),vl=U.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),T0=U.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:U.getEnumType(vl)},{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"}),E0=U.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),yl=U.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:U.getEnumType(Ct)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:T0,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:E0,oneof:"content_header"}],{localName:"DataStream_Header"}),bl=U.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"}),xl=U.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"}),qt=U.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Sl=U.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Yw=U.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),Jw=U.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:Di,oneof:"message"},{no:2,name:"answer",kind:"message",T:Di,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Zd,oneof:"message"},{no:4,name:"add_track",kind:"message",T:kl,oneof:"message"},{no:5,name:"mute",kind:"message",T:Yd,oneof:"message"},{no:6,name:"subscription",kind:"message",T:ka,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:P0,oneof:"message"},{no:8,name:"leave",kind:"message",T:Ca,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:A0,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:_0,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:O0,oneof:"message"},{no:13,name:"simulate",kind:"message",T:nn,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:I0,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:L0,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:R0,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:nk,oneof:"message"}]),Yh=U.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:Xw,oneof:"message"},{no:2,name:"answer",kind:"message",T:Di,oneof:"message"},{no:3,name:"offer",kind:"message",T:Di,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Zd,oneof:"message"},{no:5,name:"update",kind:"message",T:tk,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Jd,oneof:"message"},{no:8,name:"leave",kind:"message",T:Ca,oneof:"message"},{no:9,name:"mute",kind:"message",T:Yd,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:ik,oneof:"message"},{no:11,name:"room_update",kind:"message",T:rk,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:ok,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:ck,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:dk,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:uk,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:ek,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:Qw,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:fk,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:gk,oneof:"message"},{no:22,name:"request_response",kind:"message",T:vk,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:yk,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:hk,oneof:"message"}]),wl=U.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),kl=U.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:U.getEnumType(Wt)},{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:U.getEnumType(Xe)},{no:9,name:"layers",kind:"message",T:Pi,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:wl,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:U.getEnumType(Ct)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:U.getEnumType(u0)},{no:17,name:"audio_features",kind:"enum",T:U.getEnumType(st),repeated:!0}]),Zd=U.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:U.getEnumType(qt)},{no:3,name:"final",kind:"scalar",T:8}]),Yd=U.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),Xw=U.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:wa},{no:2,name:"participant",kind:"message",T:_i},{no:3,name:"other_participants",kind:"message",T:_i,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:M0,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:k0},{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:x0},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Jo,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),Qw=U.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:M0,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:k0},{no:3,name:"server_info",kind:"message",T:x0},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),Jd=U.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:ir}]),ek=U.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Di=U.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}]),tk=U.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:_i,repeated:!0}]),ka=U.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:b0,repeated:!0}]),P0=U.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:U.getEnumType(Gd)},{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}]),R0=U.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:U.getEnumType(st),repeated:!0}]),nk=U.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}]),Ca=U.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:U.getEnumType(Kt)},{no:3,name:"action",kind:"enum",T:U.getEnumType(fr)},{no:4,name:"regions",kind:"message",T:mk}]),fr=U.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),A0=U.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Pi,repeated:!0}]),I0=U.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}]),M0=U.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}]),ik=U.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:h0,repeated:!0}]),rk=U.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:wa}]),sk=U.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:U.getEnumType(rs)},{no:3,name:"score",kind:"scalar",T:2}]),ok=U.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:sk,repeated:!0}]),ak=U.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:U.getEnumType(Sl)}]),ck=U.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:ak,repeated:!0}]),Xd=U.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:U.getEnumType(Gd)},{no:2,name:"enabled",kind:"scalar",T:8}]),lk=U.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Xd,repeated:!0}]),dk=U.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Xd,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:lk,repeated:!0}]),N0=U.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}]),_0=U.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:N0,repeated:!0}]),uk=U.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}]),hk=U.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:wa},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:_i},{no:4,name:"other_participants",kind:"message",T:_i,repeated:!0}]),O0=U.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:Di},{no:2,name:"subscription",kind:"message",T:ka},{no:3,name:"publish_tracks",kind:"message",T:Jd,repeated:!0},{no:4,name:"data_channels",kind:"message",T:j0,repeated:!0},{no:5,name:"offer",kind:"message",T:Di},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:D0,repeated:!0}]),D0=U.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),j0=U.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:U.getEnumType(qt)}]),nn=U.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:U.getEnumType(Yw),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"}]),L0=U.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),fk=U.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),mk=U.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:pk,repeated:!0}]),pk=U.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}]),gk=U.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:U.getEnumType(Bw)}]),vk=U.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:U.getEnumType(Qd)},{no:3,name:"message",kind:"scalar",T:9}]),Qd=U.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),yk=U.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function bk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Eo={exports:{}},xk=Eo.exports,Jh;function Sk(){return Jh||(Jh=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(xk,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(f,y){var b=f[y];if(typeof b.bind=="function")return b.bind(f);try{return Function.prototype.bind.call(b,f)}catch{return function(){return Function.prototype.apply.apply(b,[f,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(f){return f==="debug"&&(f="log"),typeof console===n?!1:f==="trace"&&i?c:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):e}function d(){for(var f=this.getLevel(),y=0;y<r.length;y++){var b=r[y];this[b]=y<f?e:this.methodFactory(b,f,this.name)}if(this.log=this.debug,typeof console===n&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==n&&(d.call(this),this[f].apply(this,arguments))}}function h(f,y,b){return l(f)||u.apply(this,arguments)}function p(f,y){var b=this,w,k,S,x="loglevel";typeof f=="string"?x+=":"+f:typeof f=="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,Z=encodeURIComponent(x),Q=N.indexOf(Z+"=");Q!==-1&&(I=/^([^;]+)/.exec(N.slice(Q+Z.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 M(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=f,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=y||h,b.getLevel=function(){return S??k??w},b.setLevel=function(I,N){return S=M(I),N!==!1&&T(S),d.call(b)},b.setDefaultLevel=function(I){k=M(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=M(o.getLevel())),d.call(b),o===b)for(var I in s)s[I].rebuild()},w=M(o?o.getLevel():"WARN");var C=E();C!=null&&(S=M(C)),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})}(Eo)),Eo.exports}var Ta=Sk(),Cl;(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"})(Cl||(Cl={}));var Zt;(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"})(Zt||(Zt={}));let ye=Ta.getLogger("livekit");const wk=Object.values(Zt).map(t=>Ta.getLogger(t));ye.setDefaultLevel(Cl.info);function Nn(t){const e=Ta.getLogger(t);return e.setDefaultLevel(ye.getLevel()),e}function kk(t,e){for(const n of wk)n.setLevel(t)}const Ck=Ta.getLogger("lk-e2ee"),Zr=7e3,Tk=[0,300,4*300,9*300,16*300,Zr,Zr,Zr,Zr,Zr];class Ek{constructor(e){this._retryDelays=e!==void 0?[...e]:Tk}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 Pk(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 Xh(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 Rn(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 Xh=="function"?Xh(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 Js={exports:{}},Qh;function Rk(){if(Qh)return Js.exports;Qh=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)}Js.exports=s,Js.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",M=this._events;if(M!==void 0)P=P&&M.error===void 0;else if(!P)return!1;if(P){var C;if(T.length>0&&(C=T[0]),C instanceof Error)throw C;var I=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw I.context=C,I}var N=M[x];if(N===void 0)return!1;if(typeof N=="function")e(N,this,T);else for(var Z=N.length,Q=g(N,Z),E=0;E<Z;++E)e(Q[E],this,T);return!0};function l(S,x,T,E){var P,M,C;if(a(T),M=S._events,M===void 0?(M=S._events=Object.create(null),S._eventsCount=0):(M.newListener!==void 0&&(S.emit("newListener",x,T.listener?T.listener:T),M=S._events),C=M[x]),C===void 0)C=M[x]=T,++S._eventsCount;else if(typeof C=="function"?C=M[x]=E?[T,C]:[C,T]:E?C.unshift(T):C.push(T),P=c(S),P>0&&C.length>P&&!C.warned){C.warned=!0;var I=new Error("Possible EventEmitter memory leak detected. "+C.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");I.name="MaxListenersExceededWarning",I.emitter=S,I.type=x,I.count=C.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,M,C,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(M=-1,C=E.length-1;C>=0;C--)if(E[C]===T||E[C].listener===T){I=E[C].listener,M=C;break}if(M<0)return this;M===0?E.shift():f(E,M),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 M=Object.keys(E),C;for(P=0;P<M.length;++P)C=M[P],C!=="removeListener"&&this.removeAllListeners(C);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 h(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 h(this,x,!0)},s.prototype.rawListeners=function(x){return h(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 f(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(C){S.removeListener(x,M),E(C)}function M(){typeof S.removeListener=="function"&&S.removeListener("error",P),T([].slice.call(arguments))}k(S,x,M,{once:!0}),x!=="error"&&w(S,P,{once:!0})})}function w(S,x,T){typeof S.on=="function"&&k(S,"error",x,T)}function k(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(M){E.once&&S.removeEventListener(x,P),T(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}return Js.exports}var vn=Rk();let V0=!0,F0=!0;function ss(t,e,n){const i=t.match(e);return i&&i.length>=n&&parseFloat(i[n],10)}function $i(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 Ak(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(V0=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Ik(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(F0=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function U0(){if(typeof window=="object"){if(V0)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function eu(t,e){F0&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Mk(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(ss(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(ss(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(ss(n.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=ss(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function ef(t){return Object.prototype.toString.call(t)==="[object Object]"}function B0(t){return ef(t)?Object.keys(t).reduce(function(e,n){const i=ef(t[n]),r=i?B0(t[n]):t[n],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[n]:r})},{}):t}function Tl(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Tl(t,t.get(e[i]),n):i.endsWith("Ids")&&e[i].forEach(r=>{Tl(t,t.get(r),n)})}))}function tf(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&&Tl(t,a,r)})}),r}const nf=U0;function $0(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(h,p){return h?h+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){c.optional=c.optional||[];let h={};typeof d.ideal=="number"?(h[u("min",l)]=d.ideal,c.optional.push(h),h={},h[u("max",l)]=d.ideal,c.optional.push(h)):(h[u("",l)]=d.ideal,c.optional.push(h))}d.exact!==void 0&&typeof d.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[u("",l)]=d.exact):["min","max"].forEach(h=>{d[h]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[u(h,l)]=d[h])})}),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,h){u in d&&!(h in d)&&(d[h]=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(h=>{h=h.filter(g=>g.kind==="videoinput");let p=h.find(g=>u.some(f=>g.label.toLowerCase().includes(f)));return!p&&h.length&&u.includes("back")&&(p=h[h.length-1]),p&&(a.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),a.video=i(a.video),nf("chrome: "+JSON.stringify(a)),c(a)})}a.video=i(a.video)}return nf("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 H0(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function z0(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 $i(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function W0(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 q0(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=>tf(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}),$i(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>tf(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 K0(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 G0(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return K0(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 h=[].slice.call(arguments,1);if(h.length!==1||!h[0].getTracks().find(f=>f===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(f=>f.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 f=new t.MediaStream([d]);this._streams[u.id]=f,this._reverseStreams[f.id]=u,this.addStream(f)}return this.getSenders().find(f=>f.track===d)};function s(l,d){let u=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(h=>{const p=l._reverseStreams[h],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(h=>{const p=l._reverseStreams[h],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 h=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[g=>{const f=s(this,g);h[0].apply(null,[f])},g=>{h[1]&&h[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 h;Object.keys(this._streams).forEach(p=>{this._streams[p].getTracks().find(f=>d.track===f)&&(h=this._streams[p])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(d.track),this.dispatchEvent(new Event("negotiationneeded")))}}function El(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 Z0(t,e){$i(t,"negotiationneeded",n=>{const i=n.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return n})}var rf=Object.freeze({__proto__:null,fixNegotiationNeeded:Z0,shimAddTrackRemoveTrack:G0,shimAddTrackRemoveTrackWithNative:K0,shimGetSendersWithDtmf:W0,shimGetUserMedia:$0,shimMediaStream:H0,shimOnTrack:z0,shimPeerConnection:El,shimSenderReceiverGetStats:q0});function Y0(t,e){const n=t&&t.navigator,i=t&&t.MediaStreamTrack;if(n.getUserMedia=function(r,s,o){eu("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 Nk(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 J0(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 Pl(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 X0(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 Q0(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}),$i(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ev(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){eu("removeStream","removeTrack"),this.getSenders().forEach(i=>{i.track&&n.getTracks().includes(i.track)&&this.removeTrack(i)})})}function tv(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function nv(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 iv(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 rv(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 sv(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 sf=Object.freeze({__proto__:null,shimAddTransceiver:nv,shimCreateAnswer:sv,shimCreateOffer:rv,shimGetDisplayMedia:Nk,shimGetParameters:iv,shimGetUserMedia:Y0,shimOnTrack:J0,shimPeerConnection:Pl,shimRTCDataChannel:tv,shimReceiverGetStats:Q0,shimRemoveStream:ev,shimSenderGetStats:X0});function ov(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 av(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 cv(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],h=n.apply(this,[u]);return d?(h.then(l,d),Promise.resolve()):h},e.createAnswer=function(l,d){const u=arguments.length>=2?arguments[2]:arguments[0],h=i.apply(this,[u]);return d?(h.then(l,d),Promise.resolve()):h};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 lv(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(dv(r))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(i,r,s){e.mediaDevices.getUserMedia(i).then(r,s)}).bind(e))}function dv(t){return t&&t.video!==void 0?Object.assign({},t,{video:B0(t.video)}):t}function uv(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?(eu("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 hv(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 fv(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 mv(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var of=Object.freeze({__proto__:null,shimAudioContext:mv,shimCallbacksAPI:cv,shimConstraints:dv,shimCreateOfferLegacy:fv,shimGetUserMedia:lv,shimLocalStreamsAPI:ov,shimRTCIceServerUrls:uv,shimRemoteStreamsAPI:av,shimTrackEventTransceiver:hv}),lc={exports:{}},af;function _k(){return af||(af=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(`
3
+ `).map(i=>i.trim())},e.splitSections=function(n){return n.split(`
4
+ m=`).map((r,s)=>(s>0?"m="+r:r).trim()+`\r
5
+ `)},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
6
+ `},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
7
+ `},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
8
+ `}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
9
+ `}),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
10
+ `;return n.fingerprints.forEach(s=>{r+="a=fingerprint:"+s.algorithm+" "+s.value+`\r
11
+ `}),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
12
+ `},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
13
+ a=ice-pwd:`+n.password+`\r
14
+ `;return n.iceLite&&(i+=`a=ice-lite\r
15
+ `),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
16
+ `,r+=`c=IN IP4 0.0.0.0\r
17
+ `,r+=`a=rtcp:9 IN IP4 0.0.0.0\r
18
+ `,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
19
+ `),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(h=>e.parseSsrcMedia(h)).filter(h=>h.attribute==="cname"),c=a.length>0&&a[0].ssrc;let l;const d=e.matchPrefix(n,"a=ssrc-group:FID").map(h=>h.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(h=>{if(h.name.toUpperCase()==="RTX"&&h.parameters.apt){let p={ssrc:c,codecPayloadType:parseInt(h.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(h=>{h.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
20
+ `),n.mux&&(i+=`a=rtcp-mux\r
21
+ `),n.ssrc!==void 0&&n.cname&&(i+="a=ssrc:"+n.ssrc+" cname:"+n.cname+`\r
22
+ `),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
23
+ `,`c=IN IP4 0.0.0.0\r
24
+ `,"a=sctp-port:"+i.port+`\r
25
+ `]:r=["m="+n.kind+" 9 "+n.protocol+" "+i.port+`\r
26
+ `,`c=IN IP4 0.0.0.0\r
27
+ `,"a=sctpmap:"+i.port+" "+i.protocol+` 65535\r
28
+ `],i.maxMessageSize!==void 0&&r.push("a=max-message-size:"+i.maxMessageSize+`\r
29
+ `),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
30
+ o=`+(r||"thisisadapterortc")+" "+s+" "+o+` IN IP4 127.0.0.1\r
31
+ s=-\r
32
+ t=0 0\r
33
+ `},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 pv=_k(),mr=bk(pv),Ok=WS({__proto__:null,default:mr},[pv]);function Po(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=mr.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,$i(t,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new t.RTCIceCandidate(n.candidate),writable:"false"}),n))}function Rl(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||$i(t,"icecandidate",e=>{if(e.candidate){const n=mr.parseCandidate(e.candidate.candidate);n.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function Ro(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=mr.splitSections(a.sdp);return c.shift(),c.some(l=>{const d=mr.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=mr.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 h={};Object.defineProperty(h,"maxMessageSize",{get(){return u}}),this._sctp=h}return o.apply(this,arguments)}}function Ao(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},$i(t,"datachannel",i=>(e(i.channel,i.target),i))}function Al(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 Il(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(`
34
+ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
35
+ `).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
36
+ `);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 Io(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 Mo(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 Dk=Object.freeze({__proto__:null,removeExtmapAllowMixed:Il,shimAddIceCandidateNullOrEmpty:Io,shimConnectionState:Al,shimMaxMessageSize:Ro,shimParameterlessSetLocalDescription:Mo,shimRTCIceCandidate:Po,shimRTCIceCandidateRelayProtocol:Rl,shimSendThrowTypeError:Ao});function jk(){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=U0,i=Mk(t),r={browserDetails:i,commonShim:Dk,extractVersion:ss,disableLog:Ak,disableWarnings:Ik,sdp:Ok};switch(i.browser){case"chrome":if(!rf||!El||!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=rf,Io(t,i),Mo(t),$0(t,i),H0(t),El(t,i),z0(t),G0(t,i),W0(t),q0(t),Z0(t,i),Po(t),Rl(t),Al(t),Ro(t,i),Ao(t),Il(t,i);break;case"firefox":if(!sf||!Pl||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),r;n("adapter.js shimming firefox."),r.browserShim=sf,Io(t,i),Mo(t),Y0(t,i),Pl(t,i),J0(t),ev(t),X0(t),Q0(t),tv(t),nv(t),iv(t),rv(t),sv(t),Po(t),Al(t),Ro(t,i),Ao(t);break;case"safari":if(!of||!e.shimSafari)return n("Safari shim is not included in this adapter release."),r;n("adapter.js shimming safari."),r.browserShim=of,Io(t,i),Mo(t),uv(t),fv(t),cv(t),ov(t),av(t),hv(t),lv(t),mv(t),Po(t),Rl(t),Ro(t,i),Ao(t),Il(t,i);break;default:n("Unsupported browser!");break}return r}jk({window:typeof window>"u"?void 0:window});const Lk=10,Yr="lk_e2ee",Vk="LKFrameEncryptionKey",Fk={sharedKey:!1,ratchetSalt:Vk,ratchetWindowSize:8,failureTolerance:Lk,keyringSize:16};var Yn;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Yn||(Yn={}));var cf;(function(t){t.KeyRatcheted="keyRatcheted"})(cf||(cf={}));var Zn;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(Zn||(Zn={}));var lf;(function(t){t.Error="cryptorError"})(lf||(lf={}));function Uk(){return Bk()||Ml()}function Ml(){return typeof window.RTCRtpScriptTransform<"u"}function Bk(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class Dj extends vn.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(n,i,r)=>{ye.debug("key ratcheted event received",{ratchetResult:n,participantId:i,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Fk),e),this.on(Yn.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(Yn.SetKey,r)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,n){this.emit(Yn.RatchetRequest,e,n)}}class li extends Error{constructor(e,n){super(n||"an error has occured"),this.name="LiveKitError",this.code=e}}var be;(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"})(be||(be={}));class Ne extends li{constructor(e,n,i,r){super(1,e),this.name="ConnectionError",this.status=i,this.reason=n,this.context=r,this.reasonName=be[n]}}class tu extends li{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class An extends li{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class $k extends li{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class nt extends li{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Nl extends li{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class df extends li{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class uf extends li{constructor(e,n){super(15,e),this.reason=n,this.reasonName=typeof n=="string"?n:Qd[n]}}var Xo;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(Xo||(Xo={}));(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})(Xo||(Xo={}));var hf;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(hf||(hf={}));var V;(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"})(V||(V={}));var q;(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"})(q||(q={}));var re;(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"})(re||(re={}));var ne;(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"})(ne||(ne={}));function Hk(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 zk=/version\/(\d+(\.?_?\d+)+)/i;let dc;function Pt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(dc===void 0||e){const i=Wk.find(r=>{let{test:s}=r;return s.test(n)});dc=i==null?void 0:i.describe(n)}return dc}const Wk=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:No(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:uc(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:No(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:uc(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:No(zk,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:uc(t)}}}];function No(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 uc(t){return t.includes("mac os")?No(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var qk="2.13.8";const Kk=qk,Gk=16;class lt{}lt.setTimeout=function(){return setTimeout(...arguments)};lt.setInterval=function(){return setInterval(...arguments)};lt.clearTimeout=function(){return clearTimeout(...arguments)};lt.clearInterval=function(){return clearInterval(...arguments)};const Zk=5e3,Jr=[];var Dt;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Dt||(Dt={}));class D extends vn.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=D.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=ye,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Zk):this.handleAppVisibilityChanged()},this.log=Nn((r=i.loggerName)!==null&&r!==void 0?r:Zt.Track),this.loggerContextCb=i.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=D.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ve(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===D.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===D.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(Jr.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&Jr.splice(Jr.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),rr(this.mediaStreamTrack,e);const i=e.srcObject.getTracks(),r=i.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(r?ne.AudioPlaybackStarted:ne.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(r?ne.AudioPlaybackFailed:ne.VideoPlaybackFailed,s):s.name==="AbortError"?ye.debug("".concat(r?"audio":"video"," playback aborted, likely due to new play request")):ye.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(ne.ElementAttached,e),e}detach(e){try{if(e){pr(this.mediaStreamTrack,e);const i=this.attachedElements.indexOf(e);return i>=0&&(this.attachedElements.splice(i,1),this.recycleElement(e),this.emit(ne.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(i=>{pr(this.mediaStreamTrack,i),n.push(i),this.recycleElement(i),this.emit(ne.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=Nn(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),Jr.forEach(i=>{i.parentElement||(n=!1)}),n&&Jr.push(e)}}handleAppVisibilityChanged(){return A(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===D.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){bt()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){bt()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function rr(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)),(!ji()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(ji()||Er())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function pr(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 Wt.AUDIO;case e.Video:return Wt.VIDEO;default:return Wt.DATA}}t.kindToProto=r;function s(l){switch(l){case Wt.AUDIO:return e.Audio;case Wt.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function o(l){switch(l){case n.Camera:return Xe.CAMERA;case n.Microphone:return Xe.MICROPHONE;case n.ScreenShare:return Xe.SCREEN_SHARE;case n.ScreenShareAudio:return Xe.SCREEN_SHARE_AUDIO;default:return Xe.UNKNOWN}}t.sourceToProto=o;function a(l){switch(l){case Xe.CAMERA:return n.Camera;case Xe.MICROPHONE:return n.Microphone;case Xe.SCREEN_SHARE:return n.ScreenShare;case Xe.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=a;function c(l){switch(l){case Sl.ACTIVE:return i.Active;case Sl.PAUSED:return i.Paused;default:return i.Unknown}}t.streamStateFromProto=c})(D||(D={}));class Ae{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 Yk=["vp8","h264"],Jk=["vp8","h264","vp9","av1"];function Xk(t){return!!Yk.find(e=>e===t)}var ff;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(ff||(ff={}));var _l;(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}})(_l||(_l={}));const bs={h90:new Ae(160,90,9e4,20),h180:new Ae(320,180,16e4,20),h216:new Ae(384,216,18e4,20),h360:new Ae(640,360,45e4,20),h540:new Ae(960,540,8e5,25),h720:new Ae(1280,720,17e5,30),h1080:new Ae(1920,1080,3e6,30),h1440:new Ae(2560,1440,5e6,30),h2160:new Ae(3840,2160,8e6,30)},Ol={h120:new Ae(160,120,7e4,20),h180:new Ae(240,180,125e3,20),h240:new Ae(320,240,14e4,20),h360:new Ae(480,360,33e4,20),h480:new Ae(640,480,5e5,20),h540:new Ae(720,540,6e5,25),h720:new Ae(960,720,13e5,30),h1080:new Ae(1440,1080,23e5,30),h1440:new Ae(1920,1440,38e5,30)},nu={h360fps3:new Ae(640,360,2e5,3,"medium"),h360fps15:new Ae(640,360,4e5,15,"medium"),h720fps5:new Ae(1280,720,8e5,5,"medium"),h720fps15:new Ae(1280,720,15e5,15,"medium"),h720fps30:new Ae(1280,720,2e6,30,"medium"),h1080fps15:new Ae(1920,1080,25e5,15,"medium"),h1080fps30:new Ae(1920,1080,5e6,30,"medium"),original:new Ae(0,0,7e6,30,"medium")},Qk="|",mf="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function eC(t){const e=t.split(Qk);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function St(t){return A(this,void 0,void 0,function*(){return new Promise(e=>lt.setTimeout(e,t))})}function Dl(){return"addTransceiver"in RTCPeerConnection.prototype}function jl(){return"addTrack"in RTCPeerConnection.prototype}function tC(){if(!("getCapabilities"in RTCRtpSender)||ji())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 nC(){if(!("getCapabilities"in RTCRtpSender)||Er())return!1;if(ji()){const n=Pt();if(n!=null&&n.version&&Qn(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 Mn(t){return t==="av1"||t==="vp9"}function Ll(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function iC(){return typeof RTCPeerConnection>"u"?!1:Dl()||jl()}function Er(){var t;return((t=Pt())===null||t===void 0?void 0:t.name)==="Firefox"}function ji(){var t;return((t=Pt())===null||t===void 0?void 0:t.name)==="Safari"}function pf(){const t=Pt();return(t==null?void 0:t.name)==="Safari"||(t==null?void 0:t.os)==="iOS"}function rC(){const t=Pt();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function sC(t){return t||(t=Pt()),(t==null?void 0:t.name)==="Safari"&&Qn(t.version,"18.3")>0}function gv(){var t,e;return bt()?(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 oC(){const t=Pt(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Qn(e,t.osVersion)>=0?!0:t.name==="Safari"&&Qn(e,t.version)>=0}function bt(){return typeof document<"u"}function mn(){return navigator.product=="ReactNative"}function Vl(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function vv(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function yv(){if(!mn())return;let t=vv();if(t)return t.platform}function gf(){if(bt())return window.devicePixelRatio;if(mn()){let t=vv();if(t)return t.devicePixelRatio}return 1}function Qn(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 aC(t){for(const e of t)e.target.handleResize(e)}function cC(t){for(const e of t)e.target.handleVisibilityChanged(e)}let hc=null;const vf=()=>(hc||(hc=new ResizeObserver(aC)),hc);let fc=null;const yf=()=>(fc||(fc=new IntersectionObserver(cC,{root:null,rootMargin:"0px"})),fc);function lC(){var t;const e=new Gw({sdk:w0.JS,protocol:Gk,version:Kk});return mn()&&(e.os=(t=yv())!==null&&t!==void 0?t:""),e}function bf(){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 Xr;function mc(){if(!Xr){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(),[Xr]=i.stream.getAudioTracks(),!Xr)throw Error("Could not get empty media stream audio track");Xr.enabled=!1}return Xr.clone()}class sr{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 dC(t,e){const n=Object.assign({cloneTrack:!1,fftSize:2048,smoothingTimeConstant:.8,minDecibels:-100,maxDecibels:-80},e),i=ru();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 h of a)d+=Math.pow(h/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 uC(t){return Jk.includes(t)}function Jn(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 hC(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Fl(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function fC(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 mC(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 xf(t){switch(t.reason){case be.LeaveRequest:return t.context;case be.Cancelled:return Kt.CLIENT_INITIATED;case be.NotAllowed:return Kt.USER_REJECTED;case be.ServerUnreachable:return Kt.JOIN_FAILURE;default:return Kt.UNKNOWN_REASON}}function _o(t){return t!==void 0?Number(t):void 0}function Si(t){return t!==void 0?BigInt(t):void 0}function gr(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function ln(t){return!!t&&t.kind==D.Kind.Audio}function jr(t){return!!t&&t.kind==D.Kind.Video}function $n(t){return gr(t)&&jr(t)}function Cn(t){return gr(t)&&ln(t)}function Ul(t){return!!t&&!t.isLocal}function pC(t){return!!t&&!t.isLocal}function pc(t){return Ul(t)&&jr(t)}function gC(t){return t.isLocal}function vC(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 bv(t,e,n){var i,r,s,o;const{optionsWithoutProcessor:a,audioProcessor:c,videoProcessor:l}=Sv(t??{}),d=e==null?void 0:e.processor,u=n==null?void 0:n.processor,h=a??{};return h.audio===!0&&(h.audio={}),h.video===!0&&(h.video={}),h.audio&&(Bl(h.audio,e),(i=(s=h.audio).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||d)&&(h.audio.processor=c??d)),h.video&&(Bl(h.video,n),(r=(o=h.video).deviceId)!==null&&r!==void 0||(o.deviceId={ideal:"default"}),(l||u)&&(h.video.processor=l??u)),h}function Bl(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function iu(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":Bl(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 xv(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=ru();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 St(n),r.getByteTimeDomainData(o);const c=o.some(l=>l!==128&&l!==0);return i.close(),!c}return!1}()})}function ru(){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 yC(t){return t==="audioinput"?D.Source.Microphone:t==="videoinput"?D.Source.Camera:D.Source.Unknown}function $l(t){return t===D.Source.Microphone?"audioinput":t===D.Source.Camera?"videoinput":void 0}function bC(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,ji()?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 Oo(t){return t.split("/")[1].toLowerCase()}function xC(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new Jd({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function ve(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?ve(t.track):{})}}function SC(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function wC(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 Sv(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:Hk(e)}}function kC(t){switch(t){case Xe.CAMERA:return D.Source.Camera;case Xe.MICROPHONE:return D.Source.Microphone;case Xe.SCREEN_SHARE:return D.Source.ScreenShare;case Xe.SCREEN_SHARE_AUDIO:return D.Source.ScreenShareAudio;default:return D.Source.Unknown}}class CC extends vn.EventEmitter{constructor(e){super(),this.onWorkerMessage=n=>{var i,r;const{kind:s,data:o}=n.data;switch(s){case"error":ye.error(o.error.message),this.emit(Zn.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(Zn.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(Zn.ParticipantEncryptionStatusChanged,o.enabled,a)}break;case"ratchetKey":this.keyProvider.emit(Yn.KeyRatcheted,o.ratchetResult,o.participantIdentity,o.keyIndex);break}},this.onWorkerError=n=>{ye.error("e2ee worker encountered an error:",{error:n.error}),this.emit(Zn.EncryptionError,n.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!Uk())throw new tu("tried to setup end-to-end encryption on an unsupported browser");if(ye.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&&(ye.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){ye.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?ye.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(re.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(V.TrackPublished,(i,r)=>this.setParticipantCryptorEnabled(i.trackInfo.encryption!==Ct.NONE,r.identity)),e.on(V.ConnectionStateChanged,i=>{i===he.Connected&&e.remoteParticipants.forEach(r=>{r.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==Ct.NONE,r.identity)})})}).on(V.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(V.TrackSubscribed,(i,r,s)=>{this.setupE2EEReceiver(i,s.identity,r.trackInfo)}).on(V.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(q.LocalTrackPublished,i=>A(this,void 0,void 0,function*(){this.setupE2EESender(i.track,i.track.sender)})),n.on(Yn.SetKey,i=>this.postKey(i)).on(Yn.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"?Oo(i.mimeType):void 0)}}setupE2EESender(e,n){if(!gr(e)||!n){n||ye.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(Ml()){const s={kind:"decode",participantIdentity:i,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(Yr 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:Yr in e}};this.worker.postMessage(a,[o,s])}e[Yr]=!0}})}handleSender(e,n,i){var r;if(!(Yr 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(Ml()){ye.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{ye.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[Yr]=!0}}}const gc="default";class ot{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new ot),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=ot.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){ye.debug("awaiting getUserMedia promise");try{n?yield ot.userMediaPromiseMap.get(n):yield Promise.all(ot.userMediaPromiseMap.values())}catch{ye.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(r&&!(ji()&&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!==gc)return n;const r=yield this.getDevices(e),s=r.find(a=>a.deviceId===gc);if(!s){ye.warn("could not reliably determine default device");return}const o=r.find(a=>a.deviceId!==gc&&a.groupId===(i??s.groupId));if(!o){ye.warn("could not reliably determine default device");return}return o==null?void 0:o.deviceId})}hasDeviceInUse(e){return e?ot.userMediaPromiseMap.has(e):ot.userMediaPromiseMap.size>0}}ot.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];ot.userMediaPromiseMap=new Map;var hs;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(hs||(hs={}));class TC{constructor(){this.pendingTasks=new Map,this.taskMutex=new yt,this.nextTaskIndex=0}run(e){return A(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:hs.WAITING};this.pendingTasks.set(n.id,n);const i=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=hs.RUNNING,yield e()}finally{n.status=hs.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 EC(t,e){const n=new URL(hC(t));return e.forEach((i,r)=>{n.searchParams.set(r,i)}),wv(n,"rtc")}function PC(t){const e=new URL(Fl(t));return wv(e,"validate")}function RC(t){return t.endsWith("/")?t:"".concat(t,"/")}function wv(t,e){return t.pathname="".concat(RC(t.pathname)).concat(e),t.toString()}const AC=["syncState","trickle","offer","answer","simulate","leave"];function IC(t){const e=AC.indexOf(t.case)>=0;return ye.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var _e;(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"})(_e||(_e={}));class su{get currentState(){return this.state}get isDisconnected(){return this.state===_e.DISCONNECTING||this.state===_e.DISCONNECTED}get isEstablishingConnection(){return this.state===_e.CONNECTING||this.state===_e.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=_e.DISCONNECTED,this.log=ye,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=Nn((i=n.loggerName)!==null&&i!==void 0?i:Zt.Signal),this.loggerContextCb=n.loggerContextCb,this.useJSON=e,this.requestQueue=new TC,this.queuedRequests=[],this.closingLock=new yt,this.connectionLock=new yt,this.state=_e.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=_e.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=_e.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=lC(),o=MC(n,s,i),a=EC(e,o),c=PC(a);return new Promise((l,d)=>A(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const h=()=>A(this,void 0,void 0,function*(){this.close(),clearTimeout(p),d(new Ne("room connection has been cancelled (signal)",be.Cancelled))}),p=setTimeout(()=>{this.close(),d(new Ne("room connection has timed out (signal)",be.ServerUnreachable))},i.websocketTimeout);r!=null&&r.aborted&&h(),r==null||r.addEventListener("abort",h);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=f=>A(this,void 0,void 0,function*(){if(this.state!==_e.CONNECTED){this.state=_e.DISCONNECTED,clearTimeout(p);try{const y=yield fetch(c);if(y.status.toFixed(0).startsWith("4")){const b=yield y.text();d(new Ne(b,be.NotAllowed,y.status))}else d(new Ne("Encountered unknown websocket error during connection: ".concat(f.toString()),be.InternalError,y.status))}catch(y){d(new Ne(y instanceof Error?y.message:"server was not reachable",be.ServerUnreachable))}return}this.handleWSError(f)}),this.ws.onmessage=f=>A(this,void 0,void 0,function*(){var y,b,w;let k;if(typeof f.data=="string"){const S=JSON.parse(f.data);k=Yh.fromJson(S,{ignoreUnknownFields:!0})}else if(f.data instanceof ArrayBuffer)k=Yh.fromBinary(new Uint8Array(f.data));else{this.log.error("could not decode websocket message: ".concat(typeof f.data),this.logContext);return}if(this.state!==_e.CONNECTED){let S=!1;if(((y=k.message)===null||y===void 0?void 0:y.case)==="join"?(this.state=_e.CONNECTED,r==null||r.removeEventListener("abort",h),this.pingTimeoutDuration=k.message.value.pingTimeout,this.pingIntervalDuration=k.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(k.message.value)):this.state===_e.RECONNECTING&&k.message.case!=="leave"?(this.state=_e.CONNECTED,r==null||r.removeEventListener("abort",h),this.startPingInterval(),((b=k.message)===null||b===void 0?void 0:b.case)==="reconnect"?l(k.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),l(void 0),S=!0)):this.isEstablishingConnection&&k.message.case==="leave"?d(new Ne("Received leave request while trying to (re)connect",be.LeaveRequest,void 0,k.message.value.reason)):i.reconnect||d(new Ne("did not receive join response, got ".concat((w=k.message)===null||w===void 0?void 0:w.case," instead"),be.InternalError)),!S)return}this.signalLatency&&(yield St(this.signalLatency)),this.handleSignalResponse(k)}),this.ws.onclose=f=>{this.isEstablishingConnection&&d(new Ne("Websocket got closed during a (re)connection attempt",be.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:f.reason,code:f.code,wasClean:f.wasClean,state:this.state})),this.handleOnClose(f.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=_e.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,St(250)])),e.ws=void 0}}finally{n&&(e.state=_e.DISCONNECTED),i()}}()})}sendOffer(e,n){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:Qo(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:Qo(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 Zd({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new Yd({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 I0({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 A0({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new _0({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:De.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new L0({timestamp:De.parse(Date.now()),rtt:De.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new R0({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new Ca({reason:Kt.CLIENT_INITIATED,action:fr.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&&!IC(n)&&i.state===_e.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 St(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 Jw({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=Sf(r.value);this.onAnswer&&this.onAnswer(o,r.value.id)}else if(r.case==="offer"){const o=Sf(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===_e.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=lt.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&&lt.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=lt.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&lt.clearInterval(this.pingInterval)}}function Sf(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 Qo(t,e){return new Di({sdp:t.sdp,type:t.type,id:e})}function MC(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",mn()?"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 wf{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 NC{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 Ut={},vc={},yc={exports:{}},kf;function ou(){if(kf)return yc.exports;kf=1;var t=yc.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")})}),yc.exports}var Cf;function _C(){return Cf||(Cf=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=ou(),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 h=u[0],p=u.slice(2);h==="m"&&(l.push({rtp:[],fmtp:[]}),d=l[l.length-1]);for(var g=0;g<(r[h]||[]).length;g+=1){var f=r[h][g];if(f.reg.test(p))return i(f,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}})})}}(vc)),vc}var bc,Tf;function OC(){if(Tf)return bc;Tf=1;var t=ou(),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 h=a.names[u];a.name?d.push(c[a.name][h]):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 bc=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(h){h.name in o&&o[h.name]!=null?d.push(i(u,h,o)):h.push in o&&o[h.push]!=null&&o[h.push].forEach(function(p){d.push(i(u,h,p))})})}),o.media.forEach(function(u){d.push(i("m",t.m[0],u)),l.forEach(function(h){t[h].forEach(function(p){p.name in u&&u[p.name]!=null?d.push(i(h,p,u)):p.push in u&&u[p.push]!=null&&u[p.push].forEach(function(g){d.push(i(h,p,g))})})})}),d.join(`\r
37
+ `)+`\r
38
+ `},bc}var Ef;function DC(){if(Ef)return Ut;Ef=1;var t=_C(),e=OC(),n=ou();return Ut.grammar=n,Ut.write=e,Ut.parse=t.parse,Ut.parseParams=t.parseParams,Ut.parseFmtpConfig=t.parseFmtpConfig,Ut.parsePayloads=t.parsePayloads,Ut.parseRemoteCandidates=t.parseRemoteCandidates,Ut.parseImageAttributes=t.parseImageAttributes,Ut.parseSimulcastStreamList=t.parseSimulcastStreamList,Ut}var zn=DC();function au(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 h=function(){var p=[].slice.call(arguments),g=this;return new Promise(function(f,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 k=t.apply(g,p);a&&a(k),d.forEach(function(S){return(0,S.resolve)(k)}),d=[]}},u()),b){var w=t.apply(g,p);return a&&a(w),f(w)}d.push({resolve:f,reject:y})})};return h.cancel=function(p){s!==void 0&&clearTimeout(s),d.forEach(function(g){return(0,g.reject)(p)}),d=[]},h}const jC=.7,LC=20,vr={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class Pf extends vn.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=ye,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=au(r=>A(this,void 0,void 0,function*(){this.emit(vr.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(r)r(s);else throw s}}),LC),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=Nn((i=n.loggerName)!==null&&i!==void 0?i:Zt.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}=VC(e);this.remoteStereoMids=s,this.remoteNackMids=o}else if(e.type==="answer"){const s=zn.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=zn.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(vr.NegotiationComplete),e.sdp&&zn.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(vr.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=zn.parse((n=r.sdp)!==null&&n!==void 0?n:"");if(s.media.forEach(o=>{Af(o),o.type==="audio"?Rf(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||(Mn(a.codec)&&this.ensureVideoDDExtensionForSVC(o,s),a.codec!=="av1"))return!0;const l=Math.round(a.maxbr*jC);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,zn.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=zn.parse((e=n.sdp)!==null&&e!==void 0?e:"");return i.media.forEach(r=>{Af(r),r.type==="audio"&&Rf(r,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,zn.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 nt("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 nt("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 Nl(s)}})}ensureVideoDDExtensionForSVC(e,n){var i,r;if(!((i=e.ext)===null||i===void 0?void 0:i.some(o=>o.uri===mf))){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:mf})}}}function Rf(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 VC(t){var e;const n=[],i=[],r=zn.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 Af(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 Hl="vp8",FC={audioPreset:_l.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:nu.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Hl,backupCodec:!0,preConnectBuffer:!1},kv={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Cv={deviceId:{ideal:"default"},resolution:bs.h720.resolution},UC={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new Ek,disconnectOnPageLeave:!0,webAudioMix:!1},cu={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var $e;(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"})($e||($e={}));class BC{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,n,i){var r;this.peerConnectionTimeout=cu.peerConnectionTimeout,this.log=ye,this.updateState=()=>{var s;const o=this.state,a=this.requiredTransports.map(c=>c.getConnectionState());a.every(c=>c==="connected")?this.state=$e.CONNECTED:a.some(c=>c==="failed")?this.state=$e.FAILED:a.some(c=>c==="connecting")?this.state=$e.CONNECTING:a.every(c=>c==="closed")?this.state=$e.CLOSED:a.some(c=>c==="closed")?this.state=$e.CLOSING:a.every(c=>c==="new")&&(this.state=$e.NEW),o!==this.state&&(this.log.debug("pc state change: from ".concat($e[o]," to ").concat($e[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=Nn((r=i.loggerName)!==null&&r!==void 0?r:Zt.PCManager),this.loggerOptions=i,this.isPublisherConnectionRequired=!n,this.isSubscriberConnectionRequired=n,this.publisher=new Pf(e,i),this.subscriber=new Pf(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,qt.PUBLISHER)},this.subscriber.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,qt.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=$e.NEW,this.connectionLock=new yt,this.remoteOfferLock=new yt}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===qt.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(vr.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(vr.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===qt.PUBLISHER?this.publisher.getConnectedAddress():e===qt.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),lt.clearTimeout(u),l(new Ne("room connection has been cancelled",be.Cancelled))};r!=null&&r.signal.aborted&&d(),r==null||r.signal.addEventListener("abort",d);const u=lt.setTimeout(()=>{r==null||r.signal.removeEventListener("abort",d),l(new Ne("could not establish pc connection",be.InternalError))},o);for(;this.state!==$e.CONNECTED;)if(yield St(50),r!=null&&r.signal.aborted){l(new Ne("room connection has been cancelled",be.Cancelled));return}lt.clearTimeout(u),r==null||r.signal.removeEventListener("abort",d),c()}))}()})}}class ze extends Error{constructor(e,n,i){super(n),this.code=e,this.message=If(n,ze.MAX_MESSAGE_BYTES),this.data=i?If(i,ze.MAX_DATA_BYTES):void 0}static fromProto(e){return new ze(e.code,e.message,e.data)}toProto(){return new y0({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new ze(ze.ErrorCode[e],ze.ErrorMessage[e],n)}}ze.MAX_MESSAGE_BYTES=256;ze.MAX_DATA_BYTES=15360;ze.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};ze.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 Tv=15360;function lu(t){return new TextEncoder().encode(t).length}function If(t,e){if(lu(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 du=2e3;function Ea(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 $C{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const HC=uu?MediaRecorder:$C;class zC extends HC{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 WC(){return uu}const qC=1e3,KC=1e4;class Ev extends D{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=au(()=>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(ne.Ended,this)},this.reacquireTrack=!1,this.providedByUser=r,this.muteLock=new yt,this.pauseUpstreamLock=new yt,this.processorLock=new yt,this.restartLock=new yt,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),i&&(this._constraints=i)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==D.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=>{pr(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&&(rr(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=>{rr(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]:qC;return function*(){var i;if(e.kind===D.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((i=Pt())===null||i===void 0?void 0:i.os)==="iOS"&&(yield St(10));const r=Date.now();for(;Date.now()-r<n;){const s=e.dimensions;if(s)return s;yield St(50)}throw new An("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===Jn(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Jn(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===D.Source.ScreenShare)return;const{deviceId:i,groupId:r}=e._mediaStreamTrack.getSettings(),s=e.kind===D.Kind.Audio?"audioinput":"videoinput";return n?ot.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 An("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=Pk(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===D.Kind.Video?o.video=i||r?{deviceId:i,facingMode:r}:!0:o.audio=i?{deviceId:i}:!0,this.attachedElements.forEach(l=>{pr(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(ne.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?ne.Muted:ne.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),gv()&&(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(ne.UpstreamPaused,this);const i=Pt();if((i==null?void 0:i.name)==="Safari"&&Qn(i.version,"12.0")<0)throw new tu("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(ne.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(rr(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&&(pr(i._mediaStreamTrack,l),rr(i.processor.processedTrack,l));yield(s=i.sender)===null||s===void 0?void 0:s.replaceTrack(i.processor.processedTrack)}i.emit(ne.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(ne.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!WC()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(!this.localTrackRecorder)this.localTrackRecorder=new zC(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()},KC)}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 ea extends Ev{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,D.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=Ea(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(ne.AudioTrackFeatureUpdate,this,st.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(ne.AudioTrackFeatureUpdate,this,st.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===D.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!==Jn(this._constraints.deviceId);return this.source===D.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=iu({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(){bt()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},du)))}setProcessor(e){return A(this,void 0,void 0,function*(){var n;const i=yield this.processorLock.lock();try{if(!mn()&&!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(ne.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 xv(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(ne.AudioSilenceDetected)),e})}}function GC(t,e,n){switch(t.kind){case"audio":return new ea(t,e,!1,void 0,n);case"video":return new ta(t,e,!1,n);default:throw new An("unsupported track type: ".concat(t.kind))}}const ZC=Object.values(bs),YC=Object.values(Ol),JC=Object.values(nu),XC=[bs.h180,bs.h360],QC=[Ol.h180,Ol.h360],eT=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var i,r;return new Ae(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)}),zl=["q","h","f"];function Wl(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=nT(t,e,n,l),ye.debug("using video encoding",o));const d=o.maxFramerate,u=new Ae(e,n,o.maxBitrate,o.maxFramerate,o.priority);if(c&&Mn(l)){const g=new Pv(c),f=[];if(g.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(c));const y=Pt();if(ji()||mn()||(y==null?void 0:y.name)==="Chrome"&&Qn(y==null?void 0:y.version,"113")<0){const b=g.suffix=="h"?2:3,w=sC(y);for(let k=0;k<g.spatial;k+=1)f.push({rid:zl[2-k],maxBitrate:o.maxBitrate/Math.pow(b,k),maxFramerate:u.encoding.maxFramerate,scaleResolutionDownBy:w?Math.pow(2,k):void 0});f[0].scalabilityMode=c}else f.push({maxBitrate:o.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:c});return u.encoding.priority&&(f[0].priority=u.encoding.priority,f[0].networkPriority=u.encoding.priority),ye.debug("using svc encoding",{encodings:f}),f}if(!a)return[o];let h=[];t?h=(r=Nf(i==null?void 0:i.screenShareSimulcastLayers))!==null&&r!==void 0?r:Mf(t,u):h=(s=Nf(i==null?void 0:i.videoSimulcastLayers))!==null&&s!==void 0?s:Mf(t,u);let p;if(h.length>0){const g=h[0];h.length>1&&([,p]=h);const f=Math.max(e,n);if(f>=960&&p)return xc(e,n,[g,p,u],d);if(f>=480)return xc(e,n,[g,u],d)}return xc(e,n,[u])}function tT(t,e,n){var i,r,s,o;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&ye.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===D.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),Wl(t.source===D.Source.ScreenShare,c,l,n)}function nT(t,e,n,i){const r=iT(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 iT(t,e,n){if(t)return JC;const i=e>n?e/n:n/e;return Math.abs(i-16/9)<Math.abs(i-4/3)?ZC:YC}function Mf(t,e){if(t)return eT(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)?XC:QC}function xc(t,e,n,i){const r=[];if(n.forEach((s,o)=>{if(o>=zl.length)return;const a=Math.min(t,e),l={rid:zl[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=Er()||o===0;s.encoding.priority&&u&&(l.priority=s.encoding.priority,l.networkPriority=s.encoding.priority),r.push(l)}),mn()&&yv()==="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,ye.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),ye.info('Setting framerate of encoding "'.concat((c=a.rid)!==null&&c!==void 0?c:"",'" to ').concat(s)),a.maxFramerate=s)})}return r}function Nf(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 Pv{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 rT(t){return t.source===D.Source.ScreenShare||t.constraints.height&&Jn(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const sT=5e3;class ta extends Ev{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,D.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+=Ea(c,u)}),this._currentBitrate=a}this.prevStats=o}),this.senderLock=new yt}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!bt())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()},du))}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=Rn(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=Rn(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===D.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===D.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=Dt.LOW;i<=Dt.HIGH;i+=1)n.push(new Xd({quality:i,enabled:i<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(Mn(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=iu({video:e});typeof u.video!="boolean"&&(a=u.video)}yield this.restart(a);try{for(var c=!0,l=Rn(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 h=!0,p=Rn(r.simulcastCodecs.values()),g;g=yield p.next(),o=g.done,!o;h=!0)l=g.value,h=!1,yield(u=l.sender)===null||u===void 0?void 0:u.replaceTrack(r.processor.processedTrack)}catch(f){a={error:f}}finally{try{!h&&!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)},sT))}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(Mn(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const l=[];try{for(n=!0,i=Rn(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(Mn(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 h of d.qualities)if(h.enabled){l.push(d.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(d.codec),this.logContext),yield _f(u.sender,u.encodings,d.qualities,this.senderLock,Mn(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 _f(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),gv()&&this.isInBackground&&this.source===D.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function _f(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((h,p)=>{var g;let f=(g=h.rid)!==null&&g!==void 0?g:"";f===""&&(f="q");const y=Rv(f),b=n.find(w=>w.quality===y);b&&h.active!==b.enabled&&(d=!0,h.active=b.enabled,s.debug("setting layer ".concat(b.quality," to ").concat(h.active?"enabled":"disabled"),o),Er()&&(b.enabled?(h.scaleResolutionDownBy=e[p].scaleResolutionDownBy,h.maxBitrate=e[p].maxBitrate,h.maxFrameRate=e[p].maxFrameRate):(h.scaleResolutionDownBy=4,h.maxBitrate=10,h.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 Rv(t){switch(t){case"f":return Dt.HIGH;case"h":return Dt.MEDIUM;case"q":return Dt.LOW;default:return Dt.HIGH}}function Of(t,e,n,i){if(!n)return[new Pi({quality:Dt.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(i){const r=n[0].scalabilityMode,s=new Pv(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 Pi({quality:Math.min(Dt.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=Rv((o=r.rid)!==null&&o!==void 0?o:"");return new Pi({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 Df="_lossy",jf="_reliable",oT=2*1e3,Sc="leave-reconnect",aT=3e4;var Bt;(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"})(Bt||(Bt={}));class cT extends vn.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=cu.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=Bt.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=ye,this.reliableDataSequence=1,this.reliableMessageBuffer=new wf,this.reliableReceivedState=new NC(aT),this.handleDataChannel=i=>A(this,[i],void 0,function(r){var s=this;let{channel:o}=r;return function*(){if(o){if(o.label===jf)s.reliableDCSub=o;else if(o.label===Df)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=gt.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(re.ActiveSpeakersUpdate,c.value.value.speakers):(((s=c.value)===null||s===void 0?void 0:s.case)==="user"&&dT(c,c.value.value),this.emit(re.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?me.LOSSY:me.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(re.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(a===null){s(o);return}i===Sc&&(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=lt.setTimeout(()=>this.attemptReconnect(r).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((i,r)=>{this.pcState===Bt.Connected&&i();const s=()=>{this.off(re.Disconnected,o),i()},o=()=>{this.off(re.Restarted,s),r()};this.once(re.Restarted,s),this.once(re.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(re.DCBufferStatusChanged,r,i))},this.isBufferStatusLow=i=>{const r=this.dataChannelForKind(i);if(r)return i===me.RELIABLE&&this.reliableMessageBuffer.alignBufferedAmount(r.bufferedAmount),r.bufferedAmount<=r.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===_e.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(Wi.RR_SIGNAL_DISCONNECTED))},this.log=Nn((n=e.loggerName)!==null&&n!==void 0?n:Zt.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new su(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new yt,this.dataProcessLock=new yt,this.dcBufferStatus=new Map([[me.LOSSY,!0],[me.RELIABLE,!0]]),this.client.onParticipantUpdate=i=>this.emit(re.ParticipantUpdate,i),this.client.onConnectionQuality=i=>this.emit(re.ConnectionQualityUpdate,i),this.client.onRoomUpdate=i=>this.emit(re.RoomUpdate,i),this.client.onSubscriptionError=i=>this.emit(re.SubscriptionError,i),this.client.onSubscriptionPermissionUpdate=i=>this.emit(re.SubscriptionPermissionUpdate,i),this.client.onSpeakersChanged=i=>this.emit(re.SpeakersChanged,i),this.client.onStreamStateUpdate=i=>this.emit(re.StreamStateChanged,i),this.client.onRequestResponse=i=>this.emit(re.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(re.SignalConnected,s),s}catch(s){if(s instanceof Ne&&s.reason===be.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(re.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 wf,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 An("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 Ne("publication of local track timed out, no response from server",be.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!==$e.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const r=this.makeRTCConfiguration(e);this.pcManager=new BC(r,e.subscriberPrimary,this.loggerOptions),this.emit(re.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===$e.CONNECTED){const d=this.pcState===Bt.New;this.pcState=Bt.Connected,d&&this.emit(re.Connected,e)}else s===$e.FAILED&&this.pcState===Bt.Connected&&(this.pcState=Bt.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?Wi.RR_SUBSCRIBER_FAILED:Wi.RR_PUBLISHER_FAILED));const c=this.client.isDisconnected||this.client.currentState===_e.RECONNECTING,l=[$e.FAILED,$e.CLOSING,$e.CLOSED].includes(s);c&&l&&!this._isClosed&&this.emit(re.Offline)}),this.pcManager.onTrack=s=>{this.emit(re.MediaTrackAdded,s.track,s.streams[0],s.receiver)},lT((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(re.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(re.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(re.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(re.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(re.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Wi.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 fr.DISCONNECT:this.emit(re.Disconnected,e==null?void 0:e.reason),this.close();break;case fr.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Sc);break;case fr.RESUME:this.handleDisconnect(Sc)}}}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===ys.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(Df,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(jf,{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(Dl())return yield this.createTransceiverRTCRtpSender(e,n,i);if(jl())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new nt("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,i,r){return A(this,void 0,void 0,function*(){if(Dl())return this.createSimulcastTransceiverSender(e,n,i,r);if(jl())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new nt("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,i){return A(this,void 0,void 0,function*(){if(!this.pcManager)throw new nt("publisher is closed");const r=[];e.mediaStream&&r.push(e.mediaStream),jr(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 nt("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 nt("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){ye.warn("already attempting reconnect, returning early",this.logContext);return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===ys.DISABLED||((r=(i=this.pcManager)===null||i===void 0?void 0:i.currentState)!==null&&r!==void 0?r:$e.NEW)===$e.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 nt?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:s})),o=!1):s instanceof qi||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",Wi.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(re.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 nt("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(re.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 qi;s=yield this.join(e??this.url,this.token,this.signalOpts)}catch(o){throw o instanceof Ne&&o.reason===be.NotAllowed?new nt("could not reconnect, token might be expired"):new qi}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(re.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==_e.CONNECTED)throw new qi("Signal connection got severed during reconnect");(n=this.regionUrlProvider)===null||n===void 0||n.resetAttempts(),this.emit(re.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 nt("could not reconnect, url or token not saved");if(!this.pcManager)throw new nt("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(re.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 Ne&&r.reason===be.NotAllowed?new nt("could not reconnect, token might be expired"):r instanceof Ne&&r.reason===be.LeaveRequest?r:new qi(s)}if(this.emit(re.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!==_e.CONNECTED)throw new qi("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(re.Resumed)})}waitForPCInitialConnection(e,n){return A(this,void 0,void 0,function*(){if(!this.pcManager)throw new nt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return A(this,void 0,void 0,function*(){this.pcState=Bt.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield St(oT),!this.pcManager)throw new nt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Bt.Connected}catch(e){throw this.pcState=Bt.Disconnected,new Ne("could not establish PC connection, ".concat(e.message),be.InternalError)}})}publishRpcResponse(e,n,i,r){return A(this,void 0,void 0,function*(){const s=new gt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcResponse",value:new v0({requestId:n,value:r?{case:"error",value:r.toProto()}:{case:"payload",value:i??""}})}});yield this.sendDataPacket(s,me.RELIABLE)})}publishRpcAck(e,n){return A(this,void 0,void 0,function*(){const i=new gt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcAck",value:new g0({requestId:n})}});yield this.sendDataPacket(i,me.RELIABLE)})}sendDataPacket(e,n){return A(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(n),n===me.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const i=e.toBinary(),r=this.dataChannelForKind(n);if(r){if(n===me.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(me.RELIABLE);const n=this.dataChannelForKind(me.RELIABLE);n&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(i=>{n.send(i.data)})),this.updateAndEmitDCBufferStatus(me.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(re.Closing,r);!this.dcBufferStatus.get(e);)yield St(10);this.off(re.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 nt("PC manager is closed");const o=r?i.pcManager.subscriber:i.pcManager.publisher,a=r?"Subscriber":"Publisher";if(!o)throw new Ne("".concat(a," connection not set"),be.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 St(50)}throw new Ne("could not establish ".concat(a," connection, state: ").concat(o.getICEConnectionState()),be.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!==$e.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 Nl("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(re.Closing,r),this.pcManager.publisher.once(vr.RTPVideoPayloadTypes,s=>{const o=new Map;s.forEach(a=>{const c=a.codec.toLowerCase();uC(c)&&o.set(a.payload,c)}),this.emit(re.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(i),e()}catch(s){s instanceof Nl&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Wi.RR_UNKNOWN),n(s)}finally{this.off(re.Closing,r)}}))})}dataChannelForKind(e,n){if(n){if(e===me.LOSSY)return this.lossyDCSub;if(e===me.RELIABLE)return this.reliableDCSub}else{if(e===me.LOSSY)return this.lossyDC;if(e===me.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 O0({answer:s?Qo({sdp:s.sdp,type:s.type}):void 0,offer:o?Qo({sdp:o.sdp,type:o.type}):void 0,subscription:new ka({trackSids:c,subscribe:!a,participantTracks:[]}),publishTracks:xC(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:l,datachannelReceiveStates:this.reliableReceivedState.map((d,u)=>new D0({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 j0({label:i.label,id:i.id,target:r}))};return n(this.dataChannelForKind(me.LOSSY),qt.PUBLISHER),n(this.dataChannelForKind(me.RELIABLE),qt.PUBLISHER),n(this.dataChannelForKind(me.LOSSY,!0),qt.SUBSCRIBER),n(this.dataChannelForKind(me.RELIABLE,!0),qt.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&lt.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){bt()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){bt()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class qi extends Error{}function lT(t){return t!==void 0&&t>13}function dT(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 ql{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 Vl(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),ye.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(uT(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 Ne("Could not fetch region settings: ".concat(n.statusText),n.status===401?be.NotAllowed:be.InternalError,n.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function uT(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class Av{get info(){return this._info}constructor(e,n,i){this.reader=n,this.totalByteSize=i,this._info=e,this.bytesReceived=0}}class hT extends Av{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=Rn(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 fT extends Av{constructor(e,n,i){super(e,n,i),this.receivedChunks=new Map}handleChunkReceived(e){var n;const i=_o(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=Rn(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 Iv{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 mT extends Iv{}class pT extends Iv{}class Mv extends D{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?ne.Muted:ne.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(ne.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(),du)),SC()&&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(ne.TimeSyncUpdate,{timestamp:r,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class Nv extends Mv{constructor(e,n,i,r,s,o){super(e,n,D.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=Ea(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;mn()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(mn())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(Ll(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&Ll(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(ne.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(r=>{this.emit(ne.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 wc=100;class gT extends Mv{constructor(e,n,i,r,s){super(e,n,D.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=Ea(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=au(()=>{this.updateDimensions()},wc),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?pr(this._mediaStreamTrack,n):rr(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 vT(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<wc){lt.setTimeout(()=>{this.updateVisibility()},wc);return}this.lastVisible=o,this.emit(ne.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(ne.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?gf():n||(gf()>2?2:1)}}class vT{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=Qr(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=Qr(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)},this.onLeavePiP=()=>{var i;this.isPiP=Qr(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.element=e,this.isIntersecting=n??Kl(e),this.isPiP=bt()&&Qr(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,i;this.isIntersecting=Kl(this.element),this.isPiP=Qr(this.element),this.element.handleResize=()=>{var r;(r=this.handleResize)===null||r===void 0||r.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,yf().observe(this.element),vf().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=yf())===null||e===void 0||e.unobserve(this.element),(n=vf())===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 Qr(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?Kl(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function Kl(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 Tn extends vn.EventEmitter{constructor(e,n,i,r){var s;super(),this.metadataMuted=!1,this.encryption=Ct.NONE,this.log=ye,this.handleMuted=()=>{this.emit(ne.Muted)},this.handleUnmuted=()=>{this.emit(ne.Unmuted)},this.log=Nn((s=r==null?void 0:r.loggerName)!==null&&s!==void 0?s:Zt.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=i,this.source=D.Source.Unknown}setTrack(e){this.track&&(this.track.off(ne.Muted,this.handleMuted),this.track.off(ne.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(ne.Muted,this.handleMuted),e.on(ne.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ve(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==Ct.NONE}get audioTrack(){if(ln(this.track))return this.track}get videoTrack(){if(jr(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=D.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===D.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={}))})(Tn||(Tn={}));class Gl extends Tn{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(ne.Ended)},this.updateInfo(n),this.setTrack(i)}setTrack(e){this.track&&this.track.off(ne.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(ne.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(ln(this.track)){const n=this.track.getSourceTrackSettings(),i=new Set;return n.autoGainControl&&i.add(st.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&i.add(st.TF_ECHO_CANCELLATION),n.noiseSuppression&&i.add(st.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&i.add(st.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||i.add(st.TF_NO_DTX),this.track.enhancedNoiseCancellation&&i.add(st.TF_ENHANCED_NOISE_CANCELLATION),Array.from(i.values())}else return[]}}function Pa(t,e){return A(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:i,videoProcessor:r,optionsWithoutProcessor:s}=Sv(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=bv(s,kv,Cv),l=iu(c),d=navigator.mediaDevices.getUserMedia(l);s.audio&&(ot.userMediaPromiseMap.set("audioinput",d),d.catch(()=>ot.userMediaPromiseMap.delete("audioinput"))),s.video&&(ot.userMediaPromiseMap.set("videoinput",d),d.catch(()=>ot.userMediaPromiseMap.delete("videoinput")));try{const u=yield d;return yield Promise.all(u.getTracks().map(h=>A(this,void 0,void 0,function*(){const p=h.kind==="audio";let g=p?c.audio:c.video;(typeof g=="boolean"||!g)&&(g={});let f;const y=p?l.audio:l.video;typeof y!="boolean"&&(f=y);const b=h.getSettings().deviceId;f!=null&&f.deviceId&&Jn(f.deviceId)!==b?f.deviceId=b:f||(f={deviceId:b});const w=GC(h,f,e);return w.kind===D.Kind.Video?w.source=D.Source.Camera:w.kind===D.Kind.Audio&&(w.source=D.Source.Microphone),w.mediaStream=u,ln(w)&&i?yield w.setProcessor(i):jr(w)&&r&&(yield w.setProcessor(r)),w})))}catch(u){if(!n)throw u;return Pa(Object.assign(Object.assign({},t),{audio:o,video:a}),e)}})}function yT(t){return A(this,void 0,void 0,function*(){return(yield Pa({audio:!1,video:!0}))[0]})}function bT(t){return A(this,void 0,void 0,function*(){return(yield Pa({audio:!0,video:!1}))[0]})}var Kn;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Kn||(Kn={}));function xT(t){switch(t){case rs.EXCELLENT:return Kn.Excellent;case rs.GOOD:return Kn.Good;case rs.POOR:return Kn.Poor;case rs.LOST:return Kn.Lost;default:return Kn.Unknown}}class _v extends vn.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===Oi.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===hr.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]:Oi.STANDARD;var c;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Kn.Unknown,this.log=ye,this.log=Nn((c=o==null?void 0:o.loggerName)!==null&&c!==void 0?c:Zt.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 sr,this.once(q.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(D.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(D.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(D.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===hr.ACTIVE&&((n=this.participantInfo)===null||n===void 0?void 0:n.state)!==hr.ACTIVE&&this.emit(q.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(q.ParticipantMetadataChanged,i)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(q.ParticipantNameChanged,e)}_setAttributes(e){const n=wC(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(q.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 h;return d!==((h=this.permissions)===null||h===void 0?void 0:h.canPublishSources[u])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,l&&this.emit(q.ParticipantPermissionsChanged,c),l}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(q.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=xT(e),n!==this._connectionQuality&&this.emit(q.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=>ln(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on(ne.Muted,()=>{this.emit(q.TrackMuted,e)}),e.on(ne.Unmuted,()=>{this.emit(q.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case D.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case D.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function ST(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 N0({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 Lf=15e3;class wT extends _v{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=Ct.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new sr)},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(h=>this.log.warn(h.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 sr),(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!==Qd.OK&&d.reject(new uf(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=ze.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=>ST(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),ve(o)));return}this.engine.updateMuteStatus(o.sid,a)},this.onTrackUpstreamPaused=o=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),ve(o))),this.onTrackMuted(o,!0)},this.onTrackUpstreamResumed=o=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),ve(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 h=this.videoTrackPublications.get(o.trackSid);if(!h){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}if(!h.videoTrack)return;const p=yield h.videoTrack.setPublishingCodecs(o.subscribedCodecs);try{for(var g=!0,f=Rn(p),y;y=yield f.next(),a=y.done,!a;g=!0){d=y.value,g=!1;const b=d;Xk(b)&&(this.log.debug("publish ".concat(b," for ").concat(h.videoTrack.sid),Object.assign(Object.assign({},this.logContext),ve(h))),yield this.publishAdditionalCodecForTrack(h.videoTrack,b,h.options))}}catch(b){c={error:b}}finally{try{!g&&!a&&(l=f.return)&&(yield l.call(f))}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===D.Source.ScreenShare||o.source===D.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),ve(o))),this.unpublishTrack(o);else if(o.isUserProvided)yield o.mute();else if(Cn(o)||$n(o))try{if(bt())try{const a=yield navigator==null?void 0:navigator.permissions.query({name:o.source===D.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),ve(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),ve(o))),Cn(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),ve(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!==Ct.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(re.RemoteMute,(n,i)=>{const r=this.trackPublications.get(n);!r||!r.track||(i?r.mute():r.unmute())}),this.engine.on(re.Connected,this.handleReconnected).on(re.SignalConnected,this.handleSignalConnected).on(re.SignalRestarted,this.handleReconnected).on(re.SignalResumed,this.handleReconnected).on(re.Restarting,this.handleReconnecting).on(re.Resuming,this.handleReconnecting).on(re.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(re.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(re.Disconnected,this.handleDisconnected).on(re.SignalRequestResponse,this.handleSignalRequestResponse).on(re.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 h=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(h,{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[f,y]=g;return this.attributes[f]===y||y===""&&!this.attributes[f]}))){this.pendingSignalRequests.delete(h),a();return}yield St(50)}c(new uf("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&c(u)}}))}()})}setCameraEnabled(e,n,i){return this.setTrackEnabled(D.Source.Camera,e,n,i)}setMicrophoneEnabled(e,n,i){return this.setTrackEnabled(D.Source.Microphone,e,n,i)}setScreenShareEnabled(e,n,i){return this.setTrackEnabled(D.Source.ScreenShare,e,n,i)}setPermissions(e){const n=this.permissions,i=super.setPermissions(e);return i&&n&&this.emit(q.ParticipantPermissionsChanged,n),i}setE2EEEnabled(e){return A(this,void 0,void 0,function*(){this.encryptionType=e?Ct.GCM:Ct.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 D.Source.Camera:c=yield this.createTracks({video:(s=i)!==null&&s!==void 0?s:!0});break;case D.Source.Microphone:c=yield this.createTracks({audio:(o=i)!==null&&o!==void 0?o:!0});break;case D.Source.ScreenShare:c=yield this.createScreenTracks(Object.assign({},i));break;default:throw new An(e)}}catch(l){throw c==null||c.forEach(d=>{d.stop()}),l instanceof Error&&this.emit(q.MediaDevicesError,l,$l(e)),this.pendingPublishing.delete(e),l}for(const l of c)e===D.Source.Microphone&&ln(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),ve(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===D.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const c=this.getTrackPublication(D.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(D.Source.Camera)||this.pendingPublishing.has(D.Source.Microphone))){this.pendingPublishing.add(D.Source.Camera),this.pendingPublishing.add(D.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(D.Source.Camera),this.pendingPublishing.delete(D.Source.Microphone)}}})}createTracks(e){return A(this,void 0,void 0,function*(){var n,i;e??(e={});const r=bv(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 Pa(r,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(ln(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=D.Source.Microphone,this.emit(q.AudioStreamAcquired)),jr(a)&&(this.cameraError=void 0,a.source=D.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 tu("getDisplayMedia not supported");e.resolution===void 0&&!rC()&&(e.resolution=nu.h1080fps30.resolution);const n=bC(e),i=yield navigator.mediaDevices.getDisplayMedia(n),r=i.getVideoTracks();if(r.length===0)throw new An("no video track found");const s=new ta(r[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=D.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const o=[s];if(i.getAudioTracks().length>0){this.emit(q.AudioStreamAcquired);const a=new ea(i.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=D.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;Cn(i)&&i.setAudioContext(s.audioContext),yield(a=s.reconnectFuture)===null||a===void 0?void 0:a.promise,s.republishPromise&&!o&&(yield s.republishPromise),gr(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 D.Source.Microphone:b="audioinput";break;case D.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 ea(i,u,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":i=new ta(i,u,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new An("unsupported MediaStreamTrack kind ".concat(i.kind))}else i.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let h;if(s.trackPublications.forEach(b=>{b.track&&b.track===i&&(h=b)}),h)return s.log.warn("track has already been published, skipping",Object.assign(Object.assign({},s.logContext),ve(h))),h;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),ve(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 f=Object.assign(Object.assign({},s.roomOptions.publishDefaults),r);!oC()&&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)),f.simulcast=!1),f.source&&(i.source=f.source);const y=new Promise((b,w)=>A(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==_e.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:ve(i)}));const k=setTimeout(()=>{w(new df("publishing rejected as engine not connected within timeout",408))},15e3);yield this.waitUntilEngineConnected(),clearTimeout(k);const S=yield this.publish(i,f,g);b(S)}else try{const k=yield this.publish(i,f,g);b(k)}catch(k){w(k)}}catch(k){w(k)}}));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 sr),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),ve(e))),!1;const{canPublish:n,canPublishSources:i}=this.permissions;return n&&(i.length===0||i.map(r=>kC(r)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),ve(e))),!1)}publish(e,n,i){return A(this,void 0,void 0,function*(){var r,s,o,a,c,l,d,u,h,p;if(!this.hasPermissionsToPublish(e))throw new df("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(M=>gr(e)&&M.source===e.source)&&e.source!==D.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),ve(e))),n.stopMicTrackOnMute&&ln(e)&&(e.stopOnMute=!0),e.source===D.Source.ScreenShare&&Er()&&(n.simulcast=!1),n.videoCodec==="av1"&&!tC()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!nC()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=Hl),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(M=>n.videoCodec===Oo(M.mime))||(n.videoCodec=Oo(this.enabledPublishVideoCodecs[0].mime)));const f=n.videoCodec;e.on(ne.Muted,this.onTrackMuted),e.on(ne.Unmuted,this.onTrackUnmuted),e.on(ne.Ended,this.handleTrackEnded),e.on(ne.UpstreamPaused,this.onTrackUpstreamPaused),e.on(ne.UpstreamResumed,this.onTrackUpstreamResumed),e.on(ne.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const y=[],b=!(!((r=n.dtx)!==null&&r!==void 0)||r),w=e.getSourceTrackSettings();w.autoGainControl&&y.push(st.TF_AUTO_GAIN_CONTROL),w.echoCancellation&&y.push(st.TF_ECHO_CANCELLATION),w.noiseSuppression&&y.push(st.TF_NOISE_SUPPRESSION),w.channelCount&&w.channelCount>1&&y.push(st.TF_STEREO),b&&y.push(st.TF_NO_DTX),Cn(e)&&e.hasPreConnectBuffer&&y.push(st.TF_PRECONNECT_BUFFER);const k=new kl({cid:e.mediaStreamTrack.id,name:n.name,type:D.kindToProto(e.kind),muted:e.isMuted,source:D.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===D.Kind.Video){let M={width:0,height:0};try{M=yield e.waitForDimensions()}catch{const I=(a=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&a!==void 0?a:bs.h720.resolution;M={width:I.width,height:I.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{dims:M}))}k.width=M.width,k.height=M.height,$n(e)&&(Mn(f)&&(e.source===D.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),ve(e))))),n.scalabilityMode=(c=n.scalabilityMode)!==null&&c!==void 0?c:"L3T3_KEY"),k.simulcastCodecs=[new wl({codec:f,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:Hl}),n.backupCodec&&f!==n.backupCodec.codec&&k.encryption===Ct.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),k.simulcastCodecs.push(new wl({codec:n.backupCodec.codec,cid:""})))),S=Wl(e.source===D.Source.ScreenShare,k.width,k.height,n),k.layers=Of(k.width,k.height,S,Mn(n.videoCodec))}else e.kind===D.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=(h=n.audioPreset)===null||h===void 0?void 0:h.priority)!==null&&p!==void 0?p:"high"}]);if(!this.engine||this.engine.isClosed)throw new nt("cannot publish track when not connected");const x=()=>A(this,void 0,void 0,function*(){var M,C,I;if(!this.engine.pcManager)throw new nt("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,S),$n(e)&&((M=n.degradationPreference)!==null&&M!==void 0||(n.degradationPreference=rT(e)),e.setDegradationPreference(n.degradationPreference)),S)if(Er()&&e.kind===D.Kind.Audio){let N;for(const Z of this.engine.pcManager.publisher.getTransceivers())if(Z.sender===e.sender){N=Z;break}N&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:N,codec:"opus",maxbr:!((C=S[0])===null||C===void 0)&&C.maxBitrate?S[0].maxBitrate/1e3:0})}else e.codec&&Mn(e.codec)&&(!((I=S[0])===null||I===void 0)&&I.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:k.cid,codec:e.codec,maxbr:S[0].maxBitrate/1e3});yield this.engine.negotiate()});let T;const E=new Promise((M,C)=>A(this,void 0,void 0,function*(){var I;try{T=yield this.engine.addTrack(k),M(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(Z=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{error:Z}))})),C(N)}}));if(this.enabledPublishVideoCodecs.length>0)T=(yield Promise.all([E,x()]))[0];else{T=yield E;let M;if(T.codecs.forEach(C=>{M===void 0&&(M=C.mimeType)}),M&&e.kind===D.Kind.Video){const C=Oo(M);C!==f&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{codec:C})),n.videoCodec=C,S=Wl(e.source===D.Source.ScreenShare,k.width,k.height,n))}yield x()}const P=new Gl(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})),$n(e)?e.startMonitor(this.engine.client):Cn(e)&&e.startMonitor(),this.addTrackPublication(P),this.emit(q.LocalTrackPublished,P),Cn(e)&&T.audioFeatures.includes(st.TF_PRECONNECT_BUFFER)){const M=e.getPreConnectBuffer();this.on(q.LocalTrackSubscribed,C=>{if(C.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),ve(e))),e.stopPreConnectBuffer()}}),M&&new Promise((I,N)=>A(this,void 0,void 0,function*(){var Z,Q,se,te,Y,_;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),ve(e)));const ee=setTimeout(()=>{N(new Error("agent not active within 10 seconds"))},1e4),j=yield this.waitUntilActiveAgentPresent();clearTimeout(ee),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),ve(e)));const W=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((Y=w.sampleRate)!==null&&Y!==void 0?Y:"48000"),channels:String((_=w.channelCount)!==null&&_!==void 0?_:"1")}});try{for(var ie=!0,L=Rn(M),F;F=yield L.next(),Z=F.done,!Z;ie=!0){te=F.value,ie=!1;const J=te;yield W.write(J)}}catch(J){Q={error:J}}finally{try{!ie&&!Z&&(se=L.return)&&(yield se.call(L))}finally{if(Q)throw Q.error}}yield W.close(),I()}catch(ee){N(ee)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),ve(e)))}).catch(I=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),ve(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!==Ct.NONE)return;let s;if(this.trackPublications.forEach(p=>{p.track&&p.track===e&&(s=p)}),!s)throw new An("track is not published");if(!$n(e))throw new An("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=tT(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),ve(e)));return}const c=e.addSimulcastTrack(n,a);if(!c)return;const l=new kl({cid:c.mediaStreamTrack.id,type:D.kindToProto(e.kind),muted:e.isMuted,source:D.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:c.mediaStreamTrack.id}]});if(l.layers=Of(l.width,l.height,a),!this.engine||this.engine.isClosed)throw new nt("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()}),h=(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:h}))})}unpublishTrack(e,n){return A(this,void 0,void 0,function*(){var i,r;if(gr(e)){const l=this.pendingPublishPromises.get(e);l&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),ve(e))),yield l)}const s=this.getPublicationForTrack(e),o=s?ve(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(ne.Muted,this.onTrackMuted),e.off(ne.Unmuted,this.onTrackUnmuted),e.off(ne.Ended,this.handleTrackEnded),e.off(ne.UpstreamPaused,this.onTrackUpstreamPaused),e.off(ne.UpstreamResumed,this.onTrackUpstreamResumed),e.off(ne.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<$e.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),$n(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 D.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case D.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}return this.emit(q.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!==D.Source.ScreenShare&&l.source!==D.Source.ScreenShareAudio&&(Cn(l)||$n(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?me.RELIABLE:me.LOSSY,o=r.destinationIdentities,a=r.topic,c=new gt({kind:s,value:{case:"user",value:new f0({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 gt({kind:me.RELIABLE,value:{case:"sipDtmf",value:new m0({code:e,digit:n})}});yield this.engine.sendDataPacket(i,me.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 gt({value:{case:"chatMessage",value:new gl(Object.assign(Object.assign({},i),{timestamp:De.parse(i.timestamp)}))}});return yield this.engine.sendDataPacket(r,me.RELIABLE),this.emit(q.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 gt({value:{case:"chatMessage",value:new gl(Object.assign(Object.assign({},i),{timestamp:De.parse(i.timestamp),editTimestamp:De.parse(i.editTimestamp)}))}});return yield this.engine.sendDataPacket(r,me.RELIABLE),this.emit(q.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,h)=>{var p;c[h]=u;const g=c.reduce((f,y)=>f+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,h)=>A(this,void 0,void 0,function*(){return this._sendFile(a[h],u,{topic:n.topic,mimeType:u.type,onProgress:p=>{l(p,h+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 yl({streamId:r,mimeType:s.mimeType,topic:s.topic,timestamp:Si(s.timestamp),totalLength:Si(e==null?void 0:e.totalSize),attributes:s.attributes,contentHeader:{case:"textHeader",value:new T0({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"?vl.UPDATE:vl.CREATE})}}),a=e==null?void 0:e.destinationIdentities,c=new gt({destinationIdentities:a,value:{case:"streamHeader",value:o}});yield this.engine.sendDataPacket(c,me.RELIABLE);let l=0;const d=this,u=new WritableStream({write(g){return A(this,void 0,void 0,function*(){for(const f of vC(g,Lf)){yield d.engine.waitForBufferStatusLow(me.RELIABLE);const y=new bl({content:f,streamId:r,chunkIndex:Si(l)}),b=new gt({destinationIdentities:a,value:{case:"streamChunk",value:y}});yield d.engine.sendDataPacket(b,me.RELIABLE),l+=1}})},close(){return A(this,void 0,void 0,function*(){const g=new xl({streamId:r}),f=new gt({destinationIdentities:a,value:{case:"streamTrailer",value:g}});yield d.engine.sendDataPacket(f,me.RELIABLE)})},abort(g){console.log("Sink error:",g)}});let h=()=>A(this,void 0,void 0,function*(){yield p.close()});d.engine.once(re.Closing,h);const p=new mT(u,s,()=>this.engine.off(re.Closing,h));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 yl({totalLength:Si((o=l.size)!==null&&o!==void 0?o:0),mimeType:l.mimeType,streamId:a,topic:l.topic,timestamp:Si(Date.now()),attributes:l.attributes,contentHeader:{case:"byteHeader",value:new E0({name:l.name})}}),u=new gt({destinationIdentities:c,value:{case:"streamHeader",value:d}});yield this.engine.sendDataPacket(u,me.RELIABLE);let h=0;const p=new yt,g=this.engine,f=this.log,y=new WritableStream({write(w){return A(this,void 0,void 0,function*(){const k=yield p.lock();let S=0;try{for(;S<w.byteLength;){const x=w.slice(S,S+Lf);yield g.waitForBufferStatusLow(me.RELIABLE);const T=new gt({destinationIdentities:c,value:{case:"streamChunk",value:new bl({content:x,streamId:a,chunkIndex:Si(h)})}});yield g.sendDataPacket(T,me.RELIABLE),h+=1,S+=x.byteLength}}finally{k()}})},close(){return A(this,void 0,void 0,function*(){const w=new xl({streamId:a}),k=new gt({destinationIdentities:c,value:{case:"streamTrailer",value:w}});yield g.sendDataPacket(k,me.RELIABLE)})},abort(w){f.error("Sink error:",w)}});return new pT(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,h,p,g;if(lu(o)>Tv){d(ze.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((h=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||h===void 0)&&h.version&&Qn((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(ze.builtIn("UNSUPPORTED_SERVER"));return}const f=crypto.randomUUID();yield this.publishRpcRequest(r,f,s,o,a-2e3);const y=setTimeout(()=>{this.pendingAcks.delete(f),d(ze.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(f),clearTimeout(b)},2e3);this.pendingAcks.set(f,{resolve:()=>{clearTimeout(y)},participantIdentity:r});const b=setTimeout(()=>{this.pendingResponses.delete(f),d(ze.builtIn("RESPONSE_TIMEOUT"))},a);this.pendingResponses.set(f,{resolve:(w,k)=>{clearTimeout(b),this.pendingAcks.has(f)&&(console.warn("RPC response received before ack",f),this.pendingAcks.delete(f),clearTimeout(y)),k?d(k):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 gt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcRequest",value:new p0({id:n,method:i,payload:r,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(o,me.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,ze.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),ve(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 sr),this.activeAgentFuture.promise)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(i=>{const r=i.track;r&&(e instanceof MediaStreamTrack?(Cn(r)||$n(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 St(20)}})}}class na extends Tn{constructor(e,n,i,r){super(e,n.sid,n.name,r),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=Dt.HIGH,this.handleEnded=s=>{this.setTrack(void 0),this.emit(ne.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 ka({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new b0({participantSid:"",trackSids:[this.trackSid]})]});this.emit(ne.UpdateSubscription,r),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(i)}get subscriptionStatus(){return this.subscribed===!1?Tn.SubscriptionStatus.Unsubscribed:super.isSubscribed?Tn.SubscriptionStatus.Subscribed:Tn.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Tn.PermissionStatus.Allowed:Tn.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||(pc(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&pc(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(ne.VideoDimensionsChanged,this.handleVideoDimensionsChange),r.off(ne.VisibilityChanged,this.handleVisibilityChange),r.off(ne.Ended,this.handleEnded),r.detach(),r.stopMonitor(),this.emit(ne.Unsubscribed,r)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(ne.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(ne.VisibilityChanged,this.handleVisibilityChange),e.on(ne.Ended,this.handleEnded),this.emit(ne.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(ne.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?ne.Muted:ne.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit(ne.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(ne.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===D.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 pc(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new P0({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=Dt.HIGH,this.emit(ne.UpdateSettings,e)}}class ia extends _v{static fromParticipantInfo(e,n,i){return new ia(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]:Oi.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(ne.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),ve(e))),this.signalClient.sendUpdateTrackSettings(n)}),e.on(ne.UpdateSubscription,n=>{n.participantTracks.forEach(i=>{i.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on(ne.SubscriptionPermissionChanged,n=>{this.emit(q.TrackSubscriptionPermissionChanged,e,n)}),e.on(ne.SubscriptionStatusChanged,n=>{this.emit(q.TrackSubscriptionStatusChanged,e,n)}),e.on(ne.Subscribed,n=>{this.emit(q.TrackSubscribed,n,e)}),e.on(ne.Unsubscribed,n=>{this.emit(q.TrackUnsubscribed,n,e)}),e.on(ne.SubscriptionFailed,n=>{this.emit(q.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]:D.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]:D.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(q.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),ve(a))),this.emit(q.TrackSubscriptionFailed,n);return}const c=e.kind==="video";let l;return c?l=new gT(e,n,r,s):l=new Nv(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)&&Ul(l)&&ln(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=D.kindFromProto(r.type);if(!c)return;a=new na(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!==D.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:ve(l),newTrack:ve(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),ve(r))),this.unpublishTrack(r.trackSid,!0))}),i.forEach(r=>{this.emit(q.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 D.Kind.Audio:this.audioTrackPublications.delete(e);break;case D.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(q.TrackUnpublished,i)}setAudioOutput(e){return A(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(i=>{var r;ln(i.track)&&Ul(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 he;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(he||(he={}));const kT=4*1e3;class ei extends vn.EventEmitter{constructor(e){var n,i,r,s;if(super(),n=this,this.state=he.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=ye,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(!iC())throw mn()?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===he.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(he.Connecting),((l=this.regionUrlProvider)===null||l===void 0?void 0:l.getServerUrl().toString())!==o&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),Vl(new URL(o))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new ql(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,f)=>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(f??o,a,c,w),this.abortController=void 0,p()}catch(k){if(this.regionUrlProvider&&k instanceof Ne&&k.reason!==be.Cancelled&&k.reason!==be.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 Ne&&(x.status===401||x.reason===be.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(k.message,". Retrying with another region: ").concat(S),this.logContext),this.recreateEngine(),yield u(p,g,S)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,xf(k)),g(k))}else{let S=Kt.UNKNOWN_REASON;k instanceof Ne&&(S=xf(k)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,S),g(k)}}}),h=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new sr((p,g)=>{u(p,g,h)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(o,a,c,l,d,u)=>A(this,void 0,void 0,function*(){var h,p,g;const f=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=f.serverInfo;if(y||(y={version:f.serverVersion,region:f.serverRegion}),this.serverInfo=y,this.log.debug("connected to Livekit Server ".concat(Object.entries(y).map(b=>{let[w,k]=b;return"".concat(w,": ").concat(k)}).join(", ")),{room:(h=f.room)===null||h===void 0?void 0:h.name,roomSid:(p=f.room)===null||p===void 0?void 0:p.sid,identity:(g=f.participant)===null||g===void 0?void 0:g.identity}),!y.version)throw new $k("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),f}),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===he.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({},cu),c),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const h=yield this.connectSignal(o,a,this.engine,this.connOptions,this.options,l);this.applyJoinResponse(h),this.setupLocalParticipantEvents(),this.emit(V.SignalConnected)}catch(h){yield this.engine.close(),this.recreateEngine();const p=new Ne("could not establish signal connection",be.ServerUnreachable);throw h instanceof Error&&(p.message="".concat(p.message,": ").concat(h.message)),h instanceof Ne&&(p.reason=h.reason,p.status=h.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:h})),p}if(l.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ne("Connection attempt aborted",be.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,l)}catch(h){throw yield this.engine.close(),this.recreateEngine(),h}bt()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),bt()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(he.Connected),this.emit(V.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,h,p,g;const f=yield l.disconnectLock.lock();try{if(l.state===he.Disconnected){l.log.debug("already disconnected",l.logContext);return}l.log.info("disconnect from room",Object.assign({},l.logContext)),(l.state===he.Connecting||l.state===he.Reconnecting||l.isResuming)&&(l.log.warn("abort connection attempt",l.logContext),(u=l.abortController)===null||u===void 0||u.abort(),(p=(h=l.connectFuture)===null||h===void 0?void 0:h.reject)===null||p===void 0||p.call(h,new Ne("Client initiated disconnect",be.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,Kt.CLIENT_INITIATED),l.engine=void 0}finally{f()}}()})},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=Pt();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=mc();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(V.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(he.Reconnecting)&&this.emit(V.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(he.Connected),this.emit(V.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===hr.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(V.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(V.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=D.streamStateFromProto(a.state);d!==l.track.streamState&&(l.track.streamState=d,c.emit(q.TrackStreamStateChanged,l,l.track.streamState),this.emitWhenConnected(V.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(V.DataReceived,a.payload,o,c,a.topic),o==null||o.emit(q.DataReceived,a.payload,c)},this.handleSipDtmf=(o,a)=>{this.emit(V.SipDTMFReceived,a,o),o==null||o.emit(q.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=fC(a,this.transcriptionReceivedTimes);l==null||l.emit(ne.TranscriptionReceived,d),c==null||c.emit(q.TranscriptionReceived,d,l),this.emit(V.TranscriptionReceived,d,c,l)},this.handleChatMessage=(o,a)=>{const c=mC(a);this.emit(V.ChatMessage,c,o)},this.handleMetrics=(o,a)=>{this.emit(V.MetricsReceived,o,a)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(V.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(V.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(V.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(V.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>A(this,void 0,void 0,function*(){var o;((o=Pt())===null||o===void 0?void 0:o.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(V.MediaDevicesChanged)}),this.handleRoomUpdate=o=>{const a=this.roomInfo;this.roomInfo=o,a&&a.metadata!==o.metadata&&this.emitWhenConnected(V.RoomMetadataChanged,o.metadata),(a==null?void 0:a.activeRecording)!==o.activeRecording&&this.emitWhenConnected(V.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(V.ParticipantMetadataChanged,o,this.localParticipant)},this.onLocalParticipantNameChanged=o=>{this.emit(V.ParticipantNameChanged,o,this.localParticipant)},this.onLocalAttributesChanged=o=>{this.emit(V.ParticipantAttributesChanged,o,this.localParticipant)},this.onLocalTrackMuted=o=>{this.emit(V.TrackMuted,o,this.localParticipant)},this.onLocalTrackUnmuted=o=>{this.emit(V.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,h;(a=o.track)===null||a===void 0||a.on(ne.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=o.track)===null||c===void 0||c.on(ne.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(V.LocalTrackPublished,o,this.localParticipant),Cn(o.track)&&(yield o.track.checkForSilence())&&this.emit(V.LocalAudioSilenceDetected,o);const p=yield(h=o.track)===null||h===void 0?void 0:h.getDeviceId(!1),g=$l(o.source);g&&p&&p!==this.localParticipant.activeDeviceMap.get(g)&&(this.localParticipant.activeDeviceMap.set(g,p),this.emit(V.ActiveDeviceChanged,g,p))}),this.onLocalTrackUnpublished=o=>{var a,c;(a=o.track)===null||a===void 0||a.off(ne.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=o.track)===null||c===void 0||c.off(ne.Restarted,this.onLocalTrackRestarted),this.emit(V.LocalTrackUnpublished,o,this.localParticipant)},this.onLocalTrackRestarted=o=>A(this,void 0,void 0,function*(){const a=yield o.getDeviceId(!1),c=$l(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(V.ActiveDeviceChanged,c,a))}),this.onLocalConnectionQualityChanged=o=>{this.emit(V.ConnectionQualityChanged,o,this.localParticipant)},this.onMediaDevicesError=(o,a)=>{this.emit(V.MediaDevicesError,o,a)},this.onLocalParticipantPermissionsChanged=o=>{this.emit(V.ParticipantPermissionsChanged,o,this.localParticipant)},this.onLocalChatMessageSent=o=>{this.emit(V.ChatMessage,o,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},UC),e),this.log=Nn((i=this.options.loggerName)!==null&&i!==void 0?i:Zt.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},kv),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Cv),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},FC),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new yt,this.localParticipant=new wT("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Jn(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Jn(this.options.audioCaptureDefaults.deviceId)),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&this.switchActiveDevice("audiooutput",Jn(this.options.audioOutput.deviceId)).catch(o=>this.log.warn("Could not set audio output: ".concat(o.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),bt()){const o=new AbortController;(s=navigator.mediaDevices)===null||s===void 0||s.addEventListener("devicechange",this.handleDeviceChange,{signal:o.signal}),ei.cleanupRegistry&&ei.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,ze.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(i);if(!a){yield this.engine.publishRpcResponse(e,n,null,ze.builtIn("UNSUPPORTED_METHOD"));return}let c=null,l=null;try{const d=yield a({requestId:n,callerIdentity:e,payload:r,responseTimeout:s});lu(d)>Tv?(c=ze.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(i))):l=d}catch(d){d instanceof ze?c=d:(console.warn("Uncaught error returned by RPC handler for ".concat(i,". Returning APPLICATION_ERROR instead."),d),c=ze.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 CC(this.options.e2ee),this.e2eeManager.on(Zn.ParticipantEncryptionStatusChanged,(n,i)=>{gC(i)&&(this.isE2EEEnabled=n),this.emit(V.ParticipantEncryptionStatusChanged,n,i)}),this.e2eeManager.on(Zn.EncryptionError,n=>this.emit(V.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===he.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,n)=>{const i=r=>{r.sid!==""&&(this.engine.off(re.RoomUpdate,i),e(r.sid))};this.engine.on(re.RoomUpdate,i),this.once(V.Disconnected,()=>{this.engine.off(re.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 cT(this.options),this.engine.on(re.ParticipantUpdate,this.handleParticipantUpdates).on(re.RoomUpdate,this.handleRoomUpdate).on(re.SpeakersChanged,this.handleSpeakersChanged).on(re.StreamStateChanged,this.handleStreamStateUpdate).on(re.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(re.SubscriptionError,this.handleSubscriptionError).on(re.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(re.MediaTrackAdded,(e,n,i)=>{this.onTrackAdded(e,n,i)}).on(re.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(re.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(re.DataPacketReceived,this.handleDataPacket).on(re.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(he.SignalReconnecting)&&this.emit(V.SignalReconnecting)}).on(re.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(he.Connected)&&this.emit(V.Reconnected)}).on(re.SignalResumed,()=>{this.bufferedEvents=[],(this.state===he.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(re.Restarting,this.handleRestarting).on(re.SignalRestarted,this.handleSignalRestarted).on(re.Offline,()=>{this.setAndEmitConnectionState(he.Reconnecting)&&this.emit(V.Reconnecting)}).on(re.DCBufferStatusChanged,(e,n)=>{this.emit(V.DCBufferStatusChanged,e,n)}).on(re.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(q.LocalTrackSubscribed,n),this.emitWhenConnected(V.LocalTrackSubscribed,n,this.localParticipant)}).on(re.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(V.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 ot.getInstance().getDevices(e,n)}prepareConnection(e,n){return A(this,void 0,void 0,function*(){if(this.state===he.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(Vl(new URL(e))&&n){this.regionUrlProvider=new ql(e,n);const i=yield this.regionUrlProvider.getNextBestRegionUrl();i&&this.state===he.Disconnected&&(this.regionUrl=i,yield fetch(Fl(i),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(i),this.logContext))}else yield fetch(Fl(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 nn({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":r=new nn({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":r=new nn({scenario:{case:"serverLeave",value:!0}});break;case"migration":r=new nn({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 nn({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 nn({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 nn({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 Ca({reason:Kt.CLIENT_INITIATED,action:fr.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");r=new nn({scenario:{case:"subscriberBandwidth",value:Si(n)}});break;case"leave-full-reconnect":r=new nn({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,h,p;let g=!0,f=!1;const y=o?{exact:r}:r;if(i==="audioinput"){f=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===D.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 k=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&&k&&(f=!0)}else if(i==="videoinput"){f=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(k=>k.source===D.Source.Camera);try{g=(yield Promise.all(w.map(k=>{var S;return(S=k.videoTrack)===null||S===void 0?void 0:S.setDeviceId(y)}))).every(k=>k===!0)}catch(k){throw s.options.videoCaptureDefaults.deviceId=b,k}}else if(i==="audiooutput"){if(f=!0,!Ll()&&!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 ot.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&&((h=s.audioContext)===null||h===void 0||h.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 f&&(s.localParticipant.activeDeviceMap.set(i,r),s.emit(V.ActiveDeviceChanged,i,r)),g}()})}setupLocalParticipantEvents(){this.localParticipant.on(q.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(q.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(q.AttributesChanged,this.onLocalAttributesChanged).on(q.TrackMuted,this.onLocalTrackMuted).on(q.TrackUnmuted,this.onLocalTrackUnmuted).on(q.LocalTrackPublished,this.onLocalTrackPublished).on(q.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(q.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(q.MediaDevicesError,this.onMediaDevicesError).on(q.AudioStreamAcquired,this.startAudio).on(q.ChatMessage,this.onLocalChatMessageSent).on(q.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===he.Connecting||this.state===he.Reconnecting){const d=()=>{this.onTrackAdded(e,n,i),u()},u=()=>{this.off(V.Reconnected,d),this.off(V.Connected,d),this.off(V.Disconnected,u)};this.once(V.Reconnected,d),this.once(V.Connected,d),this.once(V.Disconnected,u);return}if(this.state===he.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=eC(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!==he.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(q.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(q.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(q.AttributesChanged,this.onLocalAttributesChanged).off(q.TrackMuted,this.onLocalTrackMuted).off(q.TrackUnmuted,this.onLocalTrackUnmuted).off(q.LocalTrackPublished,this.onLocalTrackPublished).off(q.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(q.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(q.MediaDevicesError,this.onMediaDevicesError).off(q.AudioStreamAcquired,this.startAudio).off(q.ChatMessage,this.onLocalChatMessageSent).off(q.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),bt()&&(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(he.Disconnected),this.emit(V.Disconnected,n)}}}handleParticipantDisconnected(e,n){var i;this.remoteParticipants.delete(e),n&&(n.trackPublications.forEach(r=>{n.unpublishTrack(r.trackSid,!0)}),this.emit(V.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:_o(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 hT(o,a,_o(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 fT(o,a,_o(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=ot.getInstance().previousDevices,s=yield ot.getInstance().getDevices(void 0,!1),o=Pt();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(V.ActiveDeviceChanged,c.kind,c.deviceId)}const a=["audiooutput","audioinput","videoinput"];for(let c of a){const l=yC(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),h=this.getActiveDevice(c);if(h===((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)!==h){yield this.switchActiveDevice(c,u[0].deviceId);continue}c==="audioinput"&&!pf()||c==="videoinput"||u.length>0&&!u.find(p=>p.deviceId===this.getActiveDevice(c))&&(c!=="audiooutput"||!pf())&&(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=ru())!==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(),St(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(V.AudioPlaybackStatusChanged,i))})}createParticipant(e,n){var i;let r;return n?r=ia.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):r=new ia(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(V.ParticipantConnected,i),i.on(q.TrackPublished,r=>{this.emitWhenConnected(V.TrackPublished,r,i)}).on(q.TrackSubscribed,(r,s)=>{r.kind===D.Kind.Audio?(r.on(ne.AudioPlaybackStarted,this.handleAudioPlaybackStarted),r.on(ne.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):r.kind===D.Kind.Video&&(r.on(ne.VideoPlaybackFailed,this.handleVideoPlaybackFailed),r.on(ne.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(V.TrackSubscribed,r,s,i)}).on(q.TrackUnpublished,r=>{this.emit(V.TrackUnpublished,r,i)}).on(q.TrackUnsubscribed,(r,s)=>{this.emit(V.TrackUnsubscribed,r,s,i)}).on(q.TrackMuted,r=>{this.emitWhenConnected(V.TrackMuted,r,i)}).on(q.TrackUnmuted,r=>{this.emitWhenConnected(V.TrackUnmuted,r,i)}).on(q.ParticipantMetadataChanged,r=>{this.emitWhenConnected(V.ParticipantMetadataChanged,r,i)}).on(q.ParticipantNameChanged,r=>{this.emitWhenConnected(V.ParticipantNameChanged,r,i)}).on(q.AttributesChanged,r=>{this.emitWhenConnected(V.ParticipantAttributesChanged,r,i)}).on(q.ConnectionQualityChanged,r=>{this.emitWhenConnected(V.ConnectionQualityChanged,r,i)}).on(q.ParticipantPermissionsChanged,r=>{this.emitWhenConnected(V.ParticipantPermissionsChanged,r,i)}).on(q.TrackSubscriptionStatusChanged,(r,s)=>{this.emitWhenConnected(V.TrackSubscriptionStatusChanged,r,s,i)}).on(q.TrackSubscriptionFailed,(r,s)=>{this.emit(V.TrackSubscriptionFailed,r,i,s)}).on(q.TrackSubscriptionPermissionChanged,(r,s)=>{this.emitWhenConnected(V.TrackSubscriptionPermissionChanged,r,s,i)}).on(q.Active,()=>{this.emitWhenConnected(V.ParticipantActive,i),i.kind===Oi.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&&pC(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=lt.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,Kt.STATE_MISMATCH))):e=0},kT)}clearConnectionReconcile(){this.connectionReconcileInterval&&lt.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(V.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===he.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,i]);else if(this.state===he.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 wa({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:De.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new _i({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(V.SignalConnected),this.emit(V.Connected),this.setAndEmitConnectionState(he.Connected),r.video){const o=new Gl(D.Kind.Video,new ir({source:Xe.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO,name:"video-dummy"}),new ta(r.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:bf(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(q.LocalTrackPublished,o)}if(r.audio){const o=new Gl(D.Kind.Audio,new ir({source:Xe.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO}),new ea(r.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:mc(),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(q.LocalTrackPublished,o)}for(let o=0;o<s.count-1;o+=1){let a=new _i({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(o),state:hr.ACTIVE,tracks:[],joinedAt:De.parse(Date.now())});const c=this.getOrCreateParticipant(a.identity,a);if(s.video){const l=bf(160*((i=s.aspectRatios[o%s.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),d=new ir({source:Xe.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO});c.addSubscribedMediaTrack(l,d.sid,new MediaStream([l]),new RTCRtpReceiver),a.tracks=[...a.tracks,d]}if(s.audio){const l=mc(),d=new ir({source:Xe.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.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!==V.ActiveSpeakersChanged&&e!==V.TranscriptionReceived){const s=Ov(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)}}ei.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function Ov(t){return t.map(e=>{if(e)return Array.isArray(e)?Ov(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var zt;(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"})(zt||(zt={}));class di extends vn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=zt.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new ei(i.roomOptions),this.connectOptions=i.connectOptions,this.options=i}run(e){return A(this,void 0,void 0,function*(){if(this.status!==zt.IDLE)throw Error("check is running already");this.setStatus(zt.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!==zt.SKIPPED&&this.setStatus(this.isSuccess()?zt.SUCCESS:zt.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===he.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!==he.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(zt.SKIPPED)}switchProtocol(e){return A(this,void 0,void 0,function*(){let n=!1,i=!1;if(this.room.on(V.Reconnecting,()=>{n=!0}),this.room.once(V.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 St(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 CT extends di{get description(){return"Cloud regions"}perform(){return A(this,void 0,void 0,function*(){const e=new ql(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(),h=yield(i=this.room.engine.pcManager)===null||i===void 0?void 0:i.publisher.getStats(),p={region:r,rtt:1e4,duration:u-d};return h==null||h.forEach(g=>{g.type==="candidate-pair"&&g.nominated&&(p.rtt=g.currentRoundTripTime*1e3)}),yield this.disconnect(),p})}}const kc=1e4;class TT extends di{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/(kc/1e3)*100).toFixed(2),"%")),i.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((i.qualityLimitationDurations.cpu/(kc/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 h=yield l.getRTCStatsReport();h==null||h.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(h=>setTimeout(h,kc)),clearInterval(u),a.stop(),n.remove(),yield this.disconnect(),d})}}class ET extends di{get description(){return"Can publish audio"}perform(){return A(this,void 0,void 0,function*(){var e;const n=yield this.connect(),i=yield bT();if(yield xv(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 PT extends di{get description(){return"Can publish video"}perform(){return A(this,void 0,void 0,function*(){var e;const n=yield this.connect(),i=yield yT();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,h=(c=(a=d.height)!==null&&a!==void 0?a:i.videoHeight)!==null&&c!==void 0?c:720;l.width=u,l.height=h;const p=l.getContext("2d");p.drawImage(i,0,0);const f=p.getImageData(0,0,l.width,l.height).data;let y=!0;for(let b=0;b<f.length;b+=4)if(f[b]!==0||f[b+1]!==0||f[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 RT extends di{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(V.SignalReconnecting,a).on(V.Reconnecting,a).on(V.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!==he.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 AT extends di{get description(){return"Can connect via TURN"}perform(){return A(this,void 0,void 0,function*(){var e,n;const i=new su,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 IT extends di{get description(){return"Establishing WebRTC connection"}perform(){return A(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(V.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&&(MT(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(),ye.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 MT(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 NT extends di{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 su;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)===S0.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 jj extends vn.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:zt.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!==zt.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(NT)})}checkWebRTC(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(IT)})}checkTURN(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(AT)})}checkReconnect(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(RT)})}checkPublishAudio(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(ET)})}checkPublishVideo(){return A(this,void 0,void 0,function*(){return this.createAndRunCheck(PT)})}checkConnectionProtocol(){return A(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(TT);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(CT)})}}const hu=R.createContext({});function fu(t){const e=R.useRef(null);return e.current===null&&(e.current=t()),e.current}const mu=typeof window<"u",Dv=mu?R.useLayoutEffect:R.useEffect,Ra=R.createContext(null);function pu(t,e){t.indexOf(e)===-1&&t.push(e)}function gu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const _n=(t,e,n)=>n>e?e:n<t?t:n;function Zl(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Lr=()=>{},On=()=>{};process.env.NODE_ENV!=="production"&&(Lr=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(Zl(e,n))},On=(t,e,n)=>{if(!t)throw new Error(Zl(e,n))});const Dn={},jv=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Lv(t){return typeof t=="object"&&t!==null}const Vv=t=>/^0[^.\s]+$/u.test(t);function vu(t){let e;return()=>(e===void 0&&(e=t()),e)}const jt=t=>t,_T=(t,e)=>n=>e(t(n)),js=(...t)=>t.reduce(_T),xs=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class yu{constructor(){this.subscriptions=[]}add(e){return pu(this.subscriptions,e),()=>gu(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 Gt=t=>t*1e3,dn=t=>t/1e3;function Fv(t,e){return e?t*(1e3/e):0}const Vf=new Set;function bu(t,e,n){t||Vf.has(e)||(console.warn(Zl(e,n)),Vf.add(e))}const Uv=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,OT=1e-7,DT=12;function jT(t,e,n,i,r){let s,o,a=0;do o=e+(n-e)/2,s=Uv(o,i,r)-t,s>0?n=o:e=o;while(Math.abs(s)>OT&&++a<DT);return o}function Ls(t,e,n,i){if(t===e&&n===i)return jt;const r=s=>jT(s,0,1,t,n);return s=>s===0||s===1?s:Uv(r(s),e,i)}const Bv=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,$v=t=>e=>1-t(1-e),Hv=Ls(.33,1.53,.69,.99),xu=$v(Hv),zv=Bv(xu),Wv=t=>(t*=2)<1?.5*xu(t):.5*(2-Math.pow(2,-10*(t-1))),Su=t=>1-Math.sin(Math.acos(t)),qv=$v(Su),Kv=Bv(Su),LT=Ls(.42,0,1,1),VT=Ls(0,0,.58,1),Gv=Ls(.42,0,.58,1),FT=t=>Array.isArray(t)&&typeof t[0]!="number",Zv=t=>Array.isArray(t)&&typeof t[0]=="number",Ff={linear:jt,easeIn:LT,easeInOut:Gv,easeOut:VT,circIn:Su,circInOut:Kv,circOut:qv,backIn:xu,backInOut:zv,backOut:Hv,anticipate:Wv},UT=t=>typeof t=="string",Uf=t=>{if(Zv(t)){On(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,i,r]=t;return Ls(e,n,i,r)}else if(UT(t))return On(Ff[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Ff[t];return t},Xs=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function BT(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,h=!1)=>{const g=h&&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 $T=40;function Yv(t,e){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=Xs.reduce((k,S)=>(k[S]=BT(s),k),{}),{setup:a,read:c,resolveKeyframes:l,preUpdate:d,update:u,preRender:h,render:p,postRender:g}=o,f=()=>{const k=Dn.useManualTiming?r.timestamp:performance.now();n=!1,Dn.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(k-r.timestamp,$T),1)),r.timestamp=k,r.isProcessing=!0,a.process(r),c.process(r),l.process(r),d.process(r),u.process(r),h.process(r),p.process(r),g.process(r),r.isProcessing=!1,n&&e&&(i=!1,t(f))},y=()=>{n=!0,i=!0,r.isProcessing||t(f)};return{schedule:Xs.reduce((k,S)=>{const x=o[S];return k[S]=(T,E=!1,P=!1)=>(n||y(),x.schedule(T,E,P)),k},{}),cancel:k=>{for(let S=0;S<Xs.length;S++)o[Xs[S]].cancel(k)},state:r,steps:o}}const{schedule:je,cancel:ti,state:at,steps:Cc}=Yv(typeof requestAnimationFrame<"u"?requestAnimationFrame:jt,!0);let Do;function HT(){Do=void 0}const xt={now:()=>(Do===void 0&&xt.set(at.isProcessing||Dn.useManualTiming?at.timestamp:performance.now()),Do),set:t=>{Do=t,queueMicrotask(HT)}},Jv=t=>e=>typeof e=="string"&&e.startsWith(t),wu=Jv("--"),zT=Jv("var(--"),ku=t=>zT(t)?WT.test(t.split("/*")[0].trim()):!1,WT=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Vr={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ss={...Vr,transform:t=>_n(0,1,t)},Qs={...Vr,default:1},fs=t=>Math.round(t*1e5)/1e5,Cu=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function qT(t){return t==null}const KT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tu=(t,e)=>n=>!!(typeof n=="string"&&KT.test(n)&&n.startsWith(t)||e&&!qT(n)&&Object.prototype.hasOwnProperty.call(n,e)),Xv=(t,e,n)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(Cu);return{[t]:parseFloat(r),[e]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},GT=t=>_n(0,255,t),Tc={...Vr,transform:t=>Math.round(GT(t))},Ci={test:Tu("rgb","red"),parse:Xv("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Tc.transform(t)+", "+Tc.transform(e)+", "+Tc.transform(n)+", "+fs(Ss.transform(i))+")"};function ZT(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 Yl={test:Tu("#"),parse:ZT,transform:Ci.transform},Vs=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Wn=Vs("deg"),un=Vs("%"),de=Vs("px"),YT=Vs("vh"),JT=Vs("vw"),Bf={...un,parse:t=>un.parse(t)/100,transform:t=>un.transform(t*100)},or={test:Tu("hsl","hue"),parse:Xv("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+un.transform(fs(e))+", "+un.transform(fs(n))+", "+fs(Ss.transform(i))+")"},Je={test:t=>Ci.test(t)||Yl.test(t)||or.test(t),parse:t=>Ci.test(t)?Ci.parse(t):or.test(t)?or.parse(t):Yl.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ci.transform(t):or.transform(t),getAnimatableNone:t=>{const e=Je.parse(t);return e.alpha=0,Je.transform(e)}},XT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function QT(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Cu))==null?void 0:e.length)||0)+(((n=t.match(XT))==null?void 0:n.length)||0)>0}const Qv="number",ey="color",e2="var",t2="var(",$f="${}",n2=/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 ws(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(n2,c=>(Je.test(c)?(i.color.push(s),r.push(ey),n.push(Je.parse(c))):c.startsWith(t2)?(i.var.push(s),r.push(e2),n.push(c)):(i.number.push(s),r.push(Qv),n.push(parseFloat(c))),++s,$f)).split($f);return{values:n,split:a,indexes:i,types:r}}function ty(t){return ws(t).values}function ny(t){const{split:e,types:n}=ws(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===Qv?s+=fs(r[o]):a===ey?s+=Je.transform(r[o]):s+=r[o]}return s}}const i2=t=>typeof t=="number"?0:Je.test(t)?Je.getAnimatableNone(t):t;function r2(t){const e=ty(t);return ny(t)(e.map(i2))}const ni={test:QT,parse:ty,createTransformer:ny,getAnimatableNone:r2};function Ec(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 s2({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=Ec(c,a,t+1/3),s=Ec(c,a,t),o=Ec(c,a,t-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function ra(t,e){return n=>n>0?e:t}const Ve=(t,e,n)=>t+(e-t)*n,Pc=(t,e,n)=>{const i=t*t,r=n*(e*e-i)+i;return r<0?0:Math.sqrt(r)},o2=[Yl,Ci,or],a2=t=>o2.find(e=>e.test(t));function Hf(t){const e=a2(t);if(Lr(!!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===or&&(n=s2(n)),n}const zf=(t,e)=>{const n=Hf(t),i=Hf(e);if(!n||!i)return ra(t,e);const r={...n};return s=>(r.red=Pc(n.red,i.red,s),r.green=Pc(n.green,i.green,s),r.blue=Pc(n.blue,i.blue,s),r.alpha=Ve(n.alpha,i.alpha,s),Ci.transform(r))},Jl=new Set(["none","hidden"]);function c2(t,e){return Jl.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function l2(t,e){return n=>Ve(t,e,n)}function Eu(t){return typeof t=="number"?l2:typeof t=="string"?ku(t)?ra:Je.test(t)?zf:h2:Array.isArray(t)?iy:typeof t=="object"?Je.test(t)?zf:d2:ra}function iy(t,e){const n=[...t],i=n.length,r=t.map((s,o)=>Eu(s)(s,e[o]));return s=>{for(let o=0;o<i;o++)n[o]=r[o](s);return n}}function d2(t,e){const n={...t,...e},i={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(i[r]=Eu(t[r])(t[r],e[r]));return r=>{for(const s in i)n[s]=i[s](r);return n}}function u2(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 h2=(t,e)=>{const n=ni.createTransformer(e),i=ws(t),r=ws(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?Jl.has(t)&&!r.values.length||Jl.has(e)&&!i.values.length?c2(t,e):js(iy(u2(i,r),r.values),n):(Lr(!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"),ra(t,e))};function ry(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ve(t,e,n):Eu(t)(t,e)}const f2=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>je.update(e,n),stop:()=>ti(e),now:()=>at.isProcessing?at.timestamp:xt.now()}},sy=(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)})`},sa=2e4;function Pu(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<sa;)e+=n,i=t.next(e);return e>=sa?1/0:e}function m2(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Pu(i),sa);return{type:"keyframes",ease:s=>i.next(r*s).value/e,duration:dn(r)}}const p2=5;function oy(t,e,n){const i=Math.max(e-p2,0);return Fv(n-t(i),e-i)}const Le={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},Rc=.001;function g2({duration:t=Le.duration,bounce:e=Le.bounce,velocity:n=Le.velocity,mass:i=Le.mass}){let r,s;Lr(t<=Gt(Le.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=_n(Le.minDamping,Le.maxDamping,o),t=_n(Le.minDuration,Le.maxDuration,dn(t)),o<1?(r=l=>{const d=l*o,u=d*t,h=d-n,p=Xl(l,o),g=Math.exp(-u);return Rc-h/p*g},s=l=>{const u=l*o*t,h=u*n+n,p=Math.pow(o,2)*Math.pow(l,2)*t,g=Math.exp(-u),f=Xl(Math.pow(l,2),o);return(-r(l)+Rc>0?-1:1)*((h-p)*g)/f}):(r=l=>{const d=Math.exp(-l*t),u=(l-n)*t+1;return-Rc+d*u},s=l=>{const d=Math.exp(-l*t),u=(n-l)*(t*t);return d*u});const a=5/t,c=y2(r,s,a);if(t=Gt(t),isNaN(c))return{stiffness:Le.stiffness,damping:Le.damping,duration:t};{const l=Math.pow(c,2)*i;return{stiffness:l,damping:o*2*Math.sqrt(i*l),duration:t}}}const v2=12;function y2(t,e,n){let i=n;for(let r=1;r<v2;r++)i=i-t(i)/e(i);return i}function Xl(t,e){return t*Math.sqrt(1-e*e)}const b2=["duration","bounce"],x2=["stiffness","damping","mass"];function Wf(t,e){return e.some(n=>t[n]!==void 0)}function S2(t){let e={velocity:Le.velocity,stiffness:Le.stiffness,damping:Le.damping,mass:Le.mass,isResolvedFromDuration:!1,...t};if(!Wf(t,x2)&&Wf(t,b2))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*_n(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Le.mass,stiffness:r,damping:s}}else{const n=g2(t);e={...e,...n,mass:Le.mass},e.isResolvedFromDuration=!0}return e}function oa(t=Le.visualDuration,e=Le.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:h,isResolvedFromDuration:p}=S2({...n,velocity:-dn(n.velocity||0)}),g=h||0,f=l/(2*Math.sqrt(c*d)),y=o-s,b=dn(Math.sqrt(c/d)),w=Math.abs(y)<5;i||(i=w?Le.restSpeed.granular:Le.restSpeed.default),r||(r=w?Le.restDelta.granular:Le.restDelta.default);let k;if(f<1){const x=Xl(b,f);k=T=>{const E=Math.exp(-f*b*T);return o-E*((g+f*b*y)/x*Math.sin(x*T)+y*Math.cos(x*T))}}else if(f===1)k=x=>o-Math.exp(-b*x)*(y+(g+b*y)*x);else{const x=b*Math.sqrt(f*f-1);k=T=>{const E=Math.exp(-f*b*T),P=Math.min(x*T,300);return o-E*((g+f*b*y)*Math.sinh(P)+x*y*Math.cosh(P))/x}}const S={calculatedDuration:p&&u||null,next:x=>{const T=k(x);if(p)a.done=x>=u;else{let E=x===0?g:0;f<1&&(E=x===0?Gt(g):oy(k,x,T));const P=Math.abs(E)<=i,M=Math.abs(o-T)<=r;a.done=P&&M}return a.value=a.done?o:T,a},toString:()=>{const x=Math.min(Pu(S),sa),T=sy(E=>S.next(x*E).value,x,30);return x+"ms "+T},toTransition:()=>{}};return S}oa.applyToOptions=t=>{const e=m2(t,100,oa);return t.ease=e.ease,t.duration=Gt(e.duration),t.type="keyframes",t};function Ql({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],h={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 f=n*e;const y=u+f,b=o===void 0?y:o(y);b!==y&&(f=b-u);const w=P=>-f*Math.exp(-P/i),k=P=>b+w(P),S=P=>{const M=w(P),C=k(P);h.done=Math.abs(M)<=l,h.value=h.done?b:C};let x,T;const E=P=>{p(h.value)&&(x=P,T=oa({keyframes:[h.value,g(h.value)],velocity:oy(k,P,h.value),damping:r,stiffness:s,restDelta:l,restSpeed:d}))};return E(0),{calculatedDuration:null,next:P=>{let M=!1;return!T&&x===void 0&&(M=!0,S(P),E(P)),x!==void 0&&P>=x?T.next(P-x):(!M&&S(P),h)}}}function w2(t,e,n){const i=[],r=n||Dn.mix||ry,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]||jt:e;a=js(c,a)}i.push(a)}return i}function k2(t,e,{clamp:n=!0,ease:i,mixer:r}={}){const s=t.length;if(On(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=w2(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 h=xs(t[u],t[u+1],d);return a[u](h)};return n?d=>l(_n(t[0],t[s-1],d)):l}function C2(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=xs(0,e,i);t.push(Ve(n,1,r))}}function T2(t){const e=[0];return C2(e,t.length-1),e}function E2(t,e){return t.map(n=>n*e)}function P2(t,e){return t.map(()=>e||Gv).splice(0,t.length-1)}function ar({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const r=FT(i)?i.map(Uf):Uf(i),s={done:!1,value:e[0]},o=E2(n&&n.length===e.length?n:T2(e),t),a=k2(o,e,{ease:Array.isArray(r)?r:P2(e,r)});return{calculatedDuration:t,next:c=>(s.value=a(c),s.done=c>=t,s)}}const R2=t=>t!==null;function Ru(t,{repeat:e,repeatType:n="loop"},i,r=1){const s=t.filter(R2),a=r<0||e&&n!=="loop"&&e%2===1?0:s.length-1;return!a||i===void 0?s[a]:i}const A2={decay:Ql,inertia:Ql,tween:ar,keyframes:ar,spring:oa};function ay(t){typeof t.type=="string"&&(t.type=A2[t.type])}class Au{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 I2=t=>t/100;class Iu extends Au{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!==xt.now()&&this.tick(xt.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;ay(e);const{type:n=ar,repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=e;let{keyframes:a}=e;const c=n||ar;process.env.NODE_ENV!=="production"&&c!==ar&&On(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),c!==ar&&typeof a[0]!="number"&&(this.mixKeyframes=js(I2,ry(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=Pu(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:h,repeatDelay:p,type:g,onUpdate:f,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 k=this.currentTime,S=i;if(u){const P=Math.min(this.currentTime,r)/a;let M=Math.floor(P),C=P%1;!C&&P>=1&&(C=1),C===1&&M--,M=Math.min(M,u+1),!!(M%2)&&(h==="reverse"?(C=1-C,p&&(C-=p/a)):h==="mirror"&&(S=o)),k=_n(0,1,C)*a}const x=w?{done:!1,value:d[0]}:S.next(k);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!==Ql&&(x.value=Ru(d,this.options,y,this.speed)),f&&f(x.value),E&&this.finish(),x}then(e,n){return this.finished.then(e,n)}get duration(){return dn(this.calculatedDuration)}get time(){return dn(this.currentTime)}set time(e){var n;e=Gt(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(xt.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=dn(this.currentTime))}play(){var r,s;if(this.isStopped)return;const{driver:e=f2,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(xt.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 M2(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ti=t=>t*180/Math.PI,ed=t=>{const e=Ti(Math.atan2(t[1],t[0]));return td(e)},N2={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:ed,rotateZ:ed,skewX:t=>Ti(Math.atan(t[1])),skewY:t=>Ti(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},td=t=>(t=t%360,t<0&&(t+=360),t),qf=ed,Kf=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Gf=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),_2={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Kf,scaleY:Gf,scale:t=>(Kf(t)+Gf(t))/2,rotateX:t=>td(Ti(Math.atan2(t[6],t[5]))),rotateY:t=>td(Ti(Math.atan2(-t[2],t[0]))),rotateZ:qf,rotate:qf,skewX:t=>Ti(Math.atan(t[4])),skewY:t=>Ti(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function nd(t){return t.includes("scale")?1:0}function id(t,e){if(!t||t==="none")return nd(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(n)i=_2,r=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=N2,r=a}if(!r)return nd(e);const s=i[e],o=r[1].split(",").map(D2);return typeof s=="function"?s(o):o[s]}const O2=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return id(n,e)};function D2(t){return parseFloat(t.trim())}const Fr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ur=new Set(Fr),Zf=t=>t===Vr||t===de,j2=new Set(["x","y","z"]),L2=Fr.filter(t=>!j2.has(t));function V2(t){const e=[];return L2.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const Ri={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})=>id(e,"x"),y:(t,{transform:e})=>id(e,"y")};Ri.translateX=Ri.x;Ri.translateY=Ri.y;const Ai=new Set;let rd=!1,sd=!1,od=!1;function cy(){if(sd){const t=Array.from(Ai).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const r=V2(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)})}sd=!1,rd=!1,Ai.forEach(t=>t.complete(od)),Ai.clear()}function ly(){Ai.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(sd=!0)})}function F2(){od=!0,ly(),cy(),od=!1}class Mu{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?(Ai.add(this),rd||(rd=!0,je.read(ly),je.resolveKeyframes(cy))):(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])}M2(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ai.delete(this)}cancel(){this.state==="scheduled"&&(Ai.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const U2=t=>t.startsWith("--");function B2(t,e,n){U2(e)?t.style.setProperty(e,n):t.style[e]=n}const $2=vu(()=>window.ScrollTimeline!==void 0),H2={};function z2(t,e){const n=vu(t);return()=>H2[e]??n()}const dy=z2(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),os=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Yf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:os([0,.65,.55,1]),circOut:os([.55,0,1,.45]),backIn:os([.31,.01,.66,-.59]),backOut:os([.33,1.53,.69,.99])};function uy(t,e){if(t)return typeof t=="function"?dy()?sy(t,e):"ease-out":Zv(t)?os(t):Array.isArray(t)?t.map(n=>uy(n,e)||Yf.easeOut):Yf[t]}function W2(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=uy(a,r);Array.isArray(u)&&(d.easing=u);const h={delay:i,duration:r,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return l&&(h.pseudoElement=l),t.animate(d,h)}function hy(t){return typeof t=="function"&&"applyToOptions"in t}function q2({type:t,...e}){return hy(t)&&dy()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class K2 extends Au{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,On(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=q2(e);this.animation=W2(n,i,r,l,s),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const d=Ru(r,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(d):B2(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 dn(Number(e))}get time(){return dn(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Gt(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&&$2()?(this.animation.timeline=e,jt):n(this)}}const fy={anticipate:Wv,backInOut:zv,circInOut:Kv};function G2(t){return t in fy}function Z2(t){typeof t.ease=="string"&&G2(t.ease)&&(t.ease=fy[t.ease])}const Jf=10;class Y2 extends K2{constructor(e){Z2(e),ay(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 Iu({...o,autoplay:!1}),c=Gt(this.finishedTime??this.time);n.setWithVelocity(a.sample(c-Jf).value,a.sample(c).value,Jf),a.stop()}}const Xf=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(ni.test(t)||t==="0")&&!t.startsWith("url("));function J2(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 X2(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=Xf(r,e),a=Xf(s,e);return Lr(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:J2(t)||(n==="spring"||hy(n))&&i}function ad(t){t.duration=0,t.type}const Q2=new Set(["opacity","clipPath","filter","transform"]),eE=vu(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function tE(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 eE()&&n&&Q2.has(n)&&(n!=="transform"||!l)&&!c&&!i&&r!=="mirror"&&s!==0&&o!=="inertia"}const nE=40;class iE extends Au{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 f,y;this._animation&&(this._animation.stop(),(f=this.stopTimeline)==null||f.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=xt.now();const h={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)||Mu;this.keyframeResolver=new p(a,(f,y,b)=>this.onKeyframesResolved(f,y,h,!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=xt.now(),X2(e,s,o,a)||((Dn.instantAnimations||!c)&&(d==null||d(Ru(e,i,n))),e[0]=e[e.length-1],ad(i),i.repeat=0);const h={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>nE?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},p=!l&&tE(h)?new Y2({...h,element:h.motionValue.owner.current}):new Iu(h);p.finished.then(()=>this.notifyFinished()).catch(jt),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(),F2()),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 rE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function sE(t){const e=rE.exec(t);if(!e)return[,];const[,n,i,r]=e;return[`--${n??i}`,r]}const oE=4;function my(t,e,n=1){On(n<=oE,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=sE(t);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return jv(o)?parseFloat(o):o}return ku(r)?my(r,e,n+1):r}function Nu(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const py=new Set(["width","height","top","left","right","bottom",...Fr]),aE={test:t=>t==="auto",parse:t=>t},gy=t=>e=>e.test(t),vy=[Vr,de,un,Wn,JT,YT,aE],Qf=t=>vy.find(gy(t));function cE(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Vv(t):!0}const lE=new Set(["brightness","contrast","saturate","opacity"]);function dE(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Cu)||[];if(!i)return t;const r=n.replace(i,"");let s=lE.has(e)?1:0;return i!==n&&(s*=100),e+"("+s+r+")"}const uE=/\b([a-z-]*)\(.*?\)/gu,cd={...ni,getAnimatableNone:t=>{const e=t.match(uE);return e?e.map(dE).join(" "):t}},em={...Vr,transform:Math.round},hE={rotate:Wn,rotateX:Wn,rotateY:Wn,rotateZ:Wn,scale:Qs,scaleX:Qs,scaleY:Qs,scaleZ:Qs,skew:Wn,skewX:Wn,skewY:Wn,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:Ss,originX:Bf,originY:Bf,originZ:de},_u={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...hE,zIndex:em,fillOpacity:Ss,strokeOpacity:Ss,numOctaves:em},fE={..._u,color:Je,backgroundColor:Je,outlineColor:Je,fill:Je,stroke:Je,borderColor:Je,borderTopColor:Je,borderRightColor:Je,borderBottomColor:Je,borderLeftColor:Je,filter:cd,WebkitFilter:cd},yy=t=>fE[t];function by(t,e){let n=yy(t);return n!==cd&&(n=ni),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const mE=new Set(["auto","none","0"]);function pE(t,e,n){let i=0,r;for(;i<t.length&&!r;){const s=t[i];typeof s=="string"&&!mE.has(s)&&ws(s).values.length&&(r=t[i]),i++}if(r&&n)for(const s of e)t[s]=by(n,r)}class gE extends Mu{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(),ku(l))){const d=my(l,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!py.has(i)||e.length!==2)return;const[r,s]=e,o=Qf(r),a=Qf(s);if(o!==a)if(Zf(o)&&Zf(a))for(let c=0;c<e.length;c++){const l=e[c];typeof l=="string"&&(e[c]=parseFloat(l))}else Ri[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let r=0;r<e.length;r++)(e[r]===null||cE(e[r]))&&i.push(r);i.length&&pE(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=Ri[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]=Ri[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 vE(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 xy=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Sy(t){return Lv(t)&&"offsetHeight"in t}const tm=30,yE=t=>!isNaN(parseFloat(t));class bE{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var s;const r=xt.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=xt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yE(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&bu(!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 yu);const i=this.events[e].add(n);return e==="change"?()=>{i(),je.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=xt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>tm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,tm);return Fv(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 Pr(t,e){return new bE(t,e)}const{schedule:Ou}=Yv(queueMicrotask,!1),$t={x:!1,y:!1};function wy(){return $t.x||$t.y}function xE(t){return t==="x"||t==="y"?$t[t]?null:($t[t]=!0,()=>{$t[t]=!1}):$t.x||$t.y?null:($t.x=$t.y=!0,()=>{$t.x=$t.y=!1})}function ky(t,e){const n=vE(t),i=new AbortController,r={passive:!0,...e,signal:i.signal};return[n,r,()=>i.abort()]}function nm(t){return!(t.pointerType==="touch"||wy())}function SE(t,e,n={}){const[i,r,s]=ky(t,n),o=a=>{if(!nm(a))return;const{target:c}=a,l=e(c,a);if(typeof l!="function"||!c)return;const d=u=>{nm(u)&&(l(u),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,r)};return i.forEach(a=>{a.addEventListener("pointerenter",o,r)}),s}const Cy=(t,e)=>e?t===e?!0:Cy(t,e.parentElement):!1,Du=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,wE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function kE(t){return wE.has(t.tagName)||t.tabIndex!==-1}const jo=new WeakSet;function im(t){return e=>{e.key==="Enter"&&t(e)}}function Ac(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const CE=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=im(()=>{if(jo.has(n))return;Ac(n,"down");const r=im(()=>{Ac(n,"up")}),s=()=>Ac(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 rm(t){return Du(t)&&!wy()}function TE(t,e,n={}){const[i,r,s]=ky(t,n),o=a=>{const c=a.currentTarget;if(!rm(a))return;jo.add(c);const l=e(c,a),d=(p,g)=>{window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",h),jo.has(c)&&jo.delete(c),rm(p)&&typeof l=="function"&&l(p,{success:g})},u=p=>{d(p,c===window||c===document||n.useGlobalTarget||Cy(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",u,r),window.addEventListener("pointercancel",h,r)};return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),Sy(a)&&(a.addEventListener("focus",l=>CE(l,r)),!kE(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function Ty(t){return Lv(t)&&"ownerSVGElement"in t}function EE(t){return Ty(t)&&t.tagName==="svg"}const mt=t=>!!(t&&t.getVelocity),PE=[...vy,Je,ni],RE=t=>PE.find(gy(t)),ju=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class AE extends v.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=n.offsetParent,r=Sy(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 IE({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(ju);return R.useInsertionEffect(()=>{const{width:c,height:l,top:d,left:u,right:h}=o.current;if(e||!s.current||!c||!l)return;const p=n==="left"?`left: ${u}`:`right: ${h}`;s.current.dataset.motionPopId=r;const g=document.createElement("style");a&&(g.nonce=a);const f=i??document.head;return f.appendChild(g),g.sheet&&g.sheet.insertRule(`
31
39
  [data-motion-pop-id="${r}"] {
32
40
  position: absolute !important;
33
- width: ${l}px !important;
34
- height: ${d}px !important;
35
- ${g}px !important;
36
- top: ${u}px !important;
41
+ width: ${c}px !important;
42
+ height: ${l}px !important;
43
+ ${p}px !important;
44
+ top: ${d}px !important;
37
45
  }
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,`;
46
+ `),()=>{f.contains(g)&&f.removeChild(g)}},[e]),m.jsx(AE,{isPresent:e,childRef:s,sizeRef:o,children:v.cloneElement(t,{ref:s})})}const ME=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o,anchorX:a,root:c})=>{const l=fu(NE),d=R.useId();let u=!0,h=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&&(h={...h}),R.useMemo(()=>{l.forEach((p,g)=>l.set(g,!1))},[n]),v.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),o==="popLayout"&&(t=m.jsx(IE,{isPresent:n,anchorX:a,root:c,children:t})),m.jsx(Ra.Provider,{value:h,children:t})};function NE(){return new Map}function Ey(t=!0){const e=R.useContext(Ra);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 sm(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const yr=({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]=Ey(o),u=R.useMemo(()=>sm(t),[t]),h=o&&!l?[]:u.map(eo),p=R.useRef(!0),g=R.useRef(u),f=fu(()=>new Map),[y,b]=R.useState(u),[w,k]=R.useState(u);Dv(()=>{p.current=!1,g.current=u;for(let T=0;T<w.length;T++){const E=eo(w[T]);h.includes(E)?f.delete(E):f.get(E)!==!0&&f.set(E,!1)}},[w,h.length,h.join("-")]);const S=[];if(u!==y){let T=[...u];for(let E=0;E<w.length;E++){const P=w[E],M=eo(P);h.includes(M)||(T.splice(E,0,P),S.push(P))}return s==="wait"&&S.length&&(T=S),k(sm(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(hu);return m.jsx(m.Fragment,{children:w.map(T=>{const E=eo(T),P=o&&!l?!1:u===w||h.includes(E),M=()=>{if(f.has(E))f.set(E,!0);else return;let C=!0;f.forEach(I=>{I||(C=!1)}),C&&(x==null||x(),k(g.current),o&&(d==null||d()),i&&i())};return m.jsx(ME,{isPresent:P,initial:!p.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:c,onExitComplete:P?void 0:M,anchorX:a,children:T},E)})})},Py=R.createContext({strict:!1}),om={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"]},Rr={};for(const t in om)Rr[t]={isEnabled:e=>om[t].some(n=>!!e[n])};function _E(t){for(const e in t)Rr[e]={...Rr[e],...t[e]}}const OE=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 aa(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||OE.has(t)}let Ry=t=>!aa(t);function DE(t){typeof t=="function"&&(Ry=e=>e.startsWith("on")?!aa(e):t(e))}try{DE(require("@emotion/is-prop-valid").default)}catch{}function jE(t,e,n){const i={};for(const r in t)r==="values"&&typeof t.values=="object"||(Ry(r)||n===!0&&aa(r)||!e&&!aa(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}const Aa=R.createContext({});function Ia(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function ks(t){return typeof t=="string"||Array.isArray(t)}const Lu=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Vu=["initial",...Lu];function Ma(t){return Ia(t.animate)||Vu.some(e=>ks(t[e]))}function Ay(t){return!!(Ma(t)||t.variants)}function LE(t,e){if(Ma(t)){const{initial:n,animate:i}=t;return{initial:n===!1||ks(n)?n:void 0,animate:ks(i)?i:void 0}}return t.inherit!==!1?e:{}}function VE(t){const{initial:e,animate:n}=LE(t,R.useContext(Aa));return R.useMemo(()=>({initial:e,animate:n}),[am(e),am(n)])}function am(t){return Array.isArray(t)?t.join(" "):t}const Cs={};function FE(t){for(const e in t)Cs[e]=t[e],wu(e)&&(Cs[e].isCSSVariable=!0)}function Iy(t,{layout:e,layoutId:n}){return Ur.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Cs[t]||t==="opacity")}const UE={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},BE=Fr.length;function $E(t,e,n){let i="",r=!0;for(let s=0;s<BE;s++){const o=Fr[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=xy(a,_u[o]);if(!c){r=!1;const d=UE[o]||o;i+=`${d}(${l}) `}n&&(e[o]=l)}}return i=i.trim(),n?i=n(e,r?"":i):r&&(i="none"),i}function Fu(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(Ur.has(c)){o=!0;continue}else if(wu(c)){r[c]=l;continue}else{const d=xy(l,_u[c]);c.startsWith("origin")?(a=!0,s[c]=d):i[c]=d}}if(e.transform||(o||n?i.transform=$E(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 Uu=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function My(t,e,n){for(const i in e)!mt(e[i])&&!Iy(i,n)&&(t[i]=e[i])}function HE({transformTemplate:t},e){return R.useMemo(()=>{const n=Uu();return Fu(n,e,t),Object.assign({},n.vars,n.style)},[e])}function zE(t,e){const n=t.style||{},i={};return My(i,n,t),Object.assign(i,HE(t,e)),i}function WE(t,e){const n={},i=zE(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 qE={offset:"stroke-dashoffset",array:"stroke-dasharray"},KE={offset:"strokeDashoffset",array:"strokeDasharray"};function GE(t,e,n=1,i=0,r=!0){t.pathLength=1;const s=r?qE:KE;t[s.offset]=de.transform(-i);const o=de.transform(e),a=de.transform(n);t[s.array]=`${o} ${a}`}function Ny(t,{attrX:e,attrY:n,attrScale:i,pathLength:r,pathSpacing:s=1,pathOffset:o=0,...a},c,l,d){if(Fu(t,a,l),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:u,style:h}=t;u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.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&&GE(u,r,s,o,!1)}const _y=()=>({...Uu(),attrs:{}}),Oy=t=>typeof t=="string"&&t.toLowerCase()==="svg";function ZE(t,e,n,i){const r=R.useMemo(()=>{const s=_y();return Ny(s,e,Oy(i),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};My(s,t.style,t),r.style={...s,...r.style}}return r}const YE=["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 Bu(t){return typeof t!="string"||t.includes("-")?!1:!!(YE.indexOf(t)>-1||/[A-Z]/u.test(t))}function JE(t,e,n,{latestValues:i},r,s=!1){const a=(Bu(t)?ZE:WE)(e,i,r,t),c=jE(e,typeof t=="string",s),l=t!==R.Fragment?{...c,...a,ref:n}:{},{children:d}=e,u=R.useMemo(()=>mt(d)?d.get():d,[d]);return R.createElement(t,{...l,children:u})}function cm(t){const e=[{},{}];return t==null||t.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function $u(t,e,n,i){if(typeof e=="function"){const[r,s]=cm(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]=cm(i);e=e(n!==void 0?n:t.custom,r,s)}return e}function Lo(t){return mt(t)?t.get():t}function XE({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,r){return{latestValues:QE(n,i,r,t),renderState:e()}}function QE(t,e,n,i){const r={},s=i(t,{});for(const h in s)r[h]=Lo(s[h]);let{initial:o,animate:a}=t;const c=Ma(t),l=Ay(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"&&!Ia(u)){const h=Array.isArray(u)?u:[u];for(let p=0;p<h.length;p++){const g=$u(t,h[p]);if(g){const{transitionEnd:f,transition:y,...b}=g;for(const w in b){let k=b[w];if(Array.isArray(k)){const S=d?k.length-1:0;k=k[S]}k!==null&&(r[w]=k)}for(const w in f)r[w]=f[w]}}}return r}const Dy=t=>(e,n)=>{const i=R.useContext(Aa),r=R.useContext(Ra),s=()=>XE(t,e,i,r);return n?s():fu(s)};function Hu(t,e,n){var s;const{style:i}=t,r={};for(const o in i)(mt(i[o])||e.style&&mt(e.style[o])||Iy(o,t)||((s=n==null?void 0:n.getValue(o))==null?void 0:s.liveStyle)!==void 0)&&(r[o]=i[o]);return r}const eP=Dy({scrapeMotionValuesFromProps:Hu,createRenderState:Uu});function jy(t,e,n){const i=Hu(t,e,n);for(const r in t)if(mt(t[r])||mt(e[r])){const s=Fr.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=t[r]}return i}const tP=Dy({scrapeMotionValuesFromProps:jy,createRenderState:_y}),nP=Symbol.for("motionComponentSymbol");function cr(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function iP(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):cr(n)&&(n.current=i))},[e])}const zu=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),rP="framerAppearId",Ly="data-"+zu(rP),Vy=R.createContext({});function sP(t,e,n,i,r){var f,y;const{visualElement:s}=R.useContext(Aa),o=R.useContext(Py),a=R.useContext(Ra),c=R.useContext(ju).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(Vy);d&&!d.projection&&r&&(d.type==="html"||d.type==="svg")&&oP(l.current,n,r,u);const h=R.useRef(!1);R.useInsertionEffect(()=>{d&&h.current&&d.update(n,a)});const p=n[Ly],g=R.useRef(!!p&&!((f=window.MotionHandoffIsComplete)!=null&&f.call(window,p))&&((y=window.MotionHasOptimisedAnimation)==null?void 0:y.call(window,p)));return Dv(()=>{d&&(h.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 oP(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:Fy(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&cr(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:d,layoutScroll:c,layoutRoot:l})}function Fy(t){if(t)return t.options.allowProjection!==!1?t.projection:Fy(t.parent)}function Ic(t,{forwardMotionProps:e=!1}={},n,i){n&&_E(n);const r=Bu(t)?tP:eP;function s(a,c){let l;const d={...R.useContext(ju),...a,layoutId:aP(a)},{isStatic:u}=d,h=VE(a),p=r(a,u);if(!u&&mu){cP(d,n);const g=lP(d);l=g.MeasureLayout,h.visualElement=sP(t,p,d,i,g.ProjectionNode)}return m.jsxs(Aa.Provider,{value:h,children:[l&&h.visualElement?m.jsx(l,{visualElement:h.visualElement,...d}):null,JE(t,a,iP(p,h.visualElement,c),p,u,e)]})}s.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=R.forwardRef(s);return o[nP]=t,o}function aP({layoutId:t}){const e=R.useContext(hu).id;return e&&t!==void 0?e+"-"+t:t}function cP(t,e){const n=R.useContext(Py).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?Lr(!1,i,"lazy-strict-mode"):On(!1,i,"lazy-strict-mode")}}function lP(t){const{drag:e,layout:n}=Rr;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 dP(t,e){if(typeof Proxy>"u")return Ic;const n=new Map,i=(s,o)=>Ic(s,o,t,e),r=(s,o)=>(process.env.NODE_ENV!=="production"&&bu(!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,Ic(o,void 0,t,e)),n.get(o))})}function Uy({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function uP({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hP(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 Mc(t){return t===void 0||t===1}function ld({scale:t,scaleX:e,scaleY:n}){return!Mc(t)||!Mc(e)||!Mc(n)}function wi(t){return ld(t)||By(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function By(t){return lm(t.x)||lm(t.y)}function lm(t){return t&&t!=="0%"}function ca(t,e,n){const i=t-n,r=e*i;return n+r}function dm(t,e,n,i,r){return r!==void 0&&(t=ca(t,r,i)),ca(t,n,i)+e}function dd(t,e=0,n=1,i,r){t.min=dm(t.min,e,n,i,r),t.max=dm(t.max,e,n,i,r)}function $y(t,{x:e,y:n}){dd(t.x,e.translate,e.scale,e.originPoint),dd(t.y,n.translate,n.scale,n.originPoint)}const um=.999999999999,hm=1.0000000000001;function fP(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&&dr(t,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,$y(t,o)),i&&wi(s.latestValues)&&dr(t,s.latestValues))}e.x<hm&&e.x>um&&(e.x=1),e.y<hm&&e.y>um&&(e.y=1)}function lr(t,e){t.min=t.min+e,t.max=t.max+e}function fm(t,e,n,i,r=.5){const s=Ve(t.min,t.max,r);dd(t,e,n,s,i)}function dr(t,e){fm(t.x,e.x,e.scaleX,e.scale,e.originX),fm(t.y,e.y,e.scaleY,e.scale,e.originY)}function Hy(t,e){return Uy(hP(t.getBoundingClientRect(),e))}function mP(t,e,n){const i=Hy(t,n),{scroll:r}=e;return r&&(lr(i.x,r.offset.x),lr(i.y,r.offset.y)),i}const mm=()=>({translate:0,scale:1,origin:0,originPoint:0}),ur=()=>({x:mm(),y:mm()}),pm=()=>({min:0,max:0}),qe=()=>({x:pm(),y:pm()}),ud={current:null},zy={current:!1};function pP(){if(zy.current=!0,!!mu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ud.current=t.matches;t.addEventListener("change",e),e()}else ud.current=!1}const gP=new WeakMap;function vP(t,e,n){for(const i in e){const r=e[i],s=n[i];if(mt(r))t.addValue(i,r);else if(mt(s))t.addValue(i,Pr(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,Pr(o!==void 0?o:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const gm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class yP{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=Mu,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 h=xt.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,je.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=Ma(n),this.isVariantNode=Ay(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in u){const p=u[h];c[h]!==void 0&&mt(p)&&p.set(c[h])}}mount(e){var n;this.current=e,gP.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)),zy.current||pP(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ud.current,process.env.NODE_ENV!=="production"&&bu(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(),ti(this.notifyUpdate),ti(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=Ur.has(e);i&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&je.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 Rr){const n=Rr[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):qe()}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<gm.length;i++){const r=gm[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=vP(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=Pr(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"&&(jv(i)||Vv(i))?i=parseFloat(i):!RE(i)&&ni.test(n)&&(i=by(e,n)),this.setBaseTarget(e,mt(i)?i.get():i)),mt(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=$u(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&&!mt(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 yu),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Ou.render(this.render)}}class Wy extends yP{constructor(){super(...arguments),this.KeyframeResolver=gE}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;mt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function qy(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 bP(t){return window.getComputedStyle(t)}class xP extends Wy{constructor(){super(...arguments),this.type="html",this.renderInstance=qy}readValueFromInstance(e,n){var i;if(Ur.has(n))return(i=this.projection)!=null&&i.isProjecting?nd(n):O2(e,n);{const r=bP(e),s=(wu(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Hy(e,n)}build(e,n,i){Fu(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Hu(e,n,i)}}const Ky=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 SP(t,e,n,i){qy(t,e,void 0,i);for(const r in e.attrs)t.setAttribute(Ky.has(r)?r:zu(r),e.attrs[r])}class wP extends Wy{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=qe}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Ur.has(n)){const i=yy(n);return i&&i.default||0}return n=Ky.has(n)?n:zu(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return jy(e,n,i)}build(e,n,i){Ny(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,r){SP(e,n,i,r)}mount(e){this.isSVGTag=Oy(e.tagName),super.mount(e)}}const kP=(t,e)=>Bu(t)?new wP(e):new xP(e,{allowProjection:t!==R.Fragment});function br(t,e,n){const i=t.getProps();return $u(i,e,n!==void 0?n:i.custom,t)}const hd=t=>Array.isArray(t);function CP(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Pr(n))}function TP(t){return hd(t)?t[t.length-1]||0:t}function EP(t,e){const n=br(t,e);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const o in s){const a=TP(s[o]);CP(t,o,a)}}function PP(t){return!!(mt(t)&&t.add)}function fd(t,e){const n=t.getValue("willChange");if(PP(n))return n.add(e);if(!n&&Dn.WillChange){const i=new Dn.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function Gy(t){return t.props[Ly]}const RP=t=>t!==null;function AP(t,{repeat:e,repeatType:n="loop"},i){const r=t.filter(RP),s=e&&n!=="loop"&&e%2===1?0:r.length-1;return r[s]}const IP={type:"spring",stiffness:500,damping:25,restSpeed:10},MP=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),NP={type:"keyframes",duration:.8},_P={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},OP=(t,{keyframes:e})=>e.length>2?NP:Ur.has(t)?t.startsWith("scale")?MP(e[1]):IP:_P;function DP({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 Wu=(t,e,n,i={},r,s)=>o=>{const a=Nu(i,t)||{},c=a.delay||i.delay||0;let{elapsed:l=0}=i;l=l-Gt(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:h=>{e.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:r};DP(a)||Object.assign(d,OP(t,d)),d.duration&&(d.duration=Gt(d.duration)),d.repeatDelay&&(d.repeatDelay=Gt(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let u=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(ad(d),d.delay===0&&(u=!0)),(Dn.instantAnimations||Dn.skipAnimations)&&(u=!0,ad(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,u&&!s&&e.get()!==void 0){const h=AP(d.keyframes,a);if(h!==void 0){je.update(()=>{d.onUpdate(h),d.onComplete()});return}}return a.isSync?new Iu(d):new iE(d)};function jP({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function Zy(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),h=a[d];if(h===void 0||l&&jP(l,d))continue;const p={delay:n,...Nu(s||{},d)},g=u.get();if(g!==void 0&&!u.isAnimating&&!Array.isArray(h)&&h===g&&!p.velocity)continue;let f=!1;if(window.MotionHandoffAnimation){const b=Gy(t);if(b){const w=window.MotionHandoffAnimation(b,d,je);w!==null&&(p.startTime=w,f=!0)}}fd(t,d),u.start(Wu(d,u,h,t.shouldReduceMotion&&py.has(d)?{type:!1}:p,t,f));const y=u.animation;y&&c.push(y)}return o&&Promise.all(c).then(()=>{je.update(()=>{o&&EP(t,o)})}),c}function Yy(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 md(t,e,n={}){var c;const i=br(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(Zy(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:u,staggerDirection:h}=r;return LP(t,e,l,d,u,h,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 LP(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(md(c,e,{...o,delay:n+(typeof i=="function"?0:i)+Yy(t.variantChildren,c,i,r,s)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(a)}function VP(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>md(t,s,n));i=Promise.all(r)}else if(typeof e=="string")i=md(t,e,n);else{const r=typeof e=="function"?br(t,e,n.custom):e;i=Promise.all(Zy(t,r,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}function Jy(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 FP=Vu.length;function Xy(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Xy(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<FP;n++){const i=Vu[n],r=t.props[i];(ks(r)||r===!1)&&(e[i]=r)}return e}const UP=[...Lu].reverse(),BP=Lu.length;function $P(t){return e=>Promise.all(e.map(({animation:n,options:i})=>VP(t,n,i)))}function HP(t){let e=$P(t),n=vm(),i=!0;const r=c=>(l,d)=>{var h;const u=br(t,d,c==="exit"?(h=t.presenceContext)==null?void 0:h.custom:void 0);if(u){const{transition:p,transitionEnd:g,...f}=u;l={...l,...f,...g}}return l};function s(c){e=c(t)}function o(c){const{props:l}=t,d=Xy(t.parent)||{},u=[],h=new Set;let p={},g=1/0;for(let y=0;y<BP;y++){const b=UP[y],w=n[b],k=l[b]!==void 0?l[b]:d[b],S=ks(k),x=b===c?w.isActive:null;x===!1&&(g=y);let T=k===d[b]&&k!==l[b]&&S;if(T&&i&&t.manuallyAnimateOnMount&&(T=!1),w.protectedKeys={...p},!w.isActive&&x===null||!k&&!w.prevProp||Ia(k)||typeof k=="boolean")continue;const E=zP(w.prevProp,k);let P=E||b===c&&w.isActive&&!T&&S||y>g&&S,M=!1;const C=Array.isArray(k)?k:[k];let I=C.reduce(r(b),{});x===!1&&(I={});const{prevResolvedValues:N={}}=w,Z={...N,...I},Q=Y=>{P=!0,h.has(Y)&&(M=!0,h.delete(Y)),w.needsAnimating[Y]=!0;const _=t.getValue(Y);_&&(_.liveStyle=!1)};for(const Y in Z){const _=I[Y],ie=N[Y];if(p.hasOwnProperty(Y))continue;let L=!1;hd(_)&&hd(ie)?L=!Jy(_,ie):L=_!==ie,L?_!=null?Q(Y):h.add(Y):_!==void 0&&h.has(Y)?Q(Y):w.protectedKeys[Y]=!0}w.prevProp=k,w.prevResolvedValues=I,w.isActive&&(p={...p,...I}),i&&t.blockInitialAnimation&&(P=!1);const se=T&&E;P&&(!se||M)&&u.push(...C.map(Y=>{const _={type:b};if(typeof Y=="string"&&i&&!se&&t.manuallyAnimateOnMount&&t.parent){const{parent:ie}=t,L=br(ie,Y);if(ie.enteringChildren&&L){const{delayChildren:F}=L.transition||{};_.delay=Yy(ie.enteringChildren,t,F)}}return{animation:Y,options:_}}))}if(h.size){const y={};if(typeof l.initial!="boolean"){const b=br(t,Array.isArray(l.initial)?l.initial[0]:l.initial);b&&b.transition&&(y.transition=b.transition)}h.forEach(b=>{const w=t.getBaseTarget(b),k=t.getValue(b);k&&(k.liveStyle=!0),y[b]=w??null}),u.push({animation:y})}let f=!!u.length;return i&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(f=!1),i=!1,f?e(u):Promise.resolve()}function a(c,l){var u;if(n[c].isActive===l)return Promise.resolve();(u=t.variantChildren)==null||u.forEach(h=>{var p;return(p=h.animationState)==null?void 0:p.setActive(c,l)}),n[c].isActive=l;const d=o(c);for(const h in n)n[h].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=vm(),i=!0}}}function zP(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Jy(e,t):!1}function bi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vm(){return{animate:bi(!0),whileInView:bi(),whileHover:bi(),whileTap:bi(),whileDrag:bi(),whileFocus:bi(),exit:bi()}}class ui{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WP extends ui{constructor(e){super(e),e.animationState||(e.animationState=HP(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ia(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 qP=0;class KP extends ui{constructor(){super(...arguments),this.id=qP++}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 GP={animation:{Feature:WP},exit:{Feature:KP}};function Ts(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Fs(t){return{point:{x:t.pageX,y:t.pageY}}}const ZP=t=>e=>Du(e)&&t(e,Fs(e));function ms(t,e,n,i){return Ts(t,e,ZP(n),i)}const Qy=1e-4,YP=1-Qy,JP=1+Qy,eb=.01,XP=0-eb,QP=0+eb;function pt(t){return t.max-t.min}function eR(t,e,n){return Math.abs(t-e)<=n}function ym(t,e,n,i=.5){t.origin=i,t.originPoint=Ve(e.min,e.max,t.origin),t.scale=pt(n)/pt(e),t.translate=Ve(n.min,n.max,t.origin)-t.originPoint,(t.scale>=YP&&t.scale<=JP||isNaN(t.scale))&&(t.scale=1),(t.translate>=XP&&t.translate<=QP||isNaN(t.translate))&&(t.translate=0)}function ps(t,e,n,i){ym(t.x,e.x,n.x,i?i.originX:void 0),ym(t.y,e.y,n.y,i?i.originY:void 0)}function bm(t,e,n){t.min=n.min+e.min,t.max=t.min+pt(e)}function tR(t,e,n){bm(t.x,e.x,n.x),bm(t.y,e.y,n.y)}function xm(t,e,n){t.min=e.min-n.min,t.max=t.min+pt(e)}function gs(t,e,n){xm(t.x,e.x,n.x),xm(t.y,e.y,n.y)}function Nt(t){return[t("x"),t("y")]}const tb=({current:t})=>t?t.ownerDocument.defaultView:null,Sm=(t,e)=>Math.abs(t-e);function nR(t,e){const n=Sm(t.x,e.x),i=Sm(t.y,e.y);return Math.sqrt(n**2+i**2)}class nb{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 h=_c(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=nR(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:f}=h,{timestamp:y}=at;this.history.push({...f,timestamp:y});const{onStart:b,onMove:w}=this.handlers;p||(b&&b(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Nc(p,this.transformPagePoint),je.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:g,onSessionEnd:f,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=_c(h.type==="pointercancel"?this.lastMoveEventInfo:Nc(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(h,b),f&&f(h,b)},!Du(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=r||window;const a=Fs(e),c=Nc(a,this.transformPagePoint),{point:l}=c,{timestamp:d}=at;this.history=[{...l,timestamp:d}];const{onSessionStart:u}=n;u&&u(e,_c(c,this.history)),this.removeListeners=js(ms(this.contextWindow,"pointermove",this.handlePointerMove),ms(this.contextWindow,"pointerup",this.handlePointerUp),ms(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ti(this.updatePoint)}}function Nc(t,e){return e?{point:e(t.point)}:t}function wm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function _c({point:t},e){return{point:t,delta:wm(t,ib(e)),offset:wm(t,iR(e)),velocity:rR(e,.1)}}function iR(t){return t[0]}function ib(t){return t[t.length-1]}function rR(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const r=ib(t);for(;n>=0&&(i=t[n],!(r.timestamp-i.timestamp>Gt(e)));)n--;if(!i)return{x:0,y:0};const s=dn(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 sR(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Ve(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Ve(n,t,i.max):Math.min(t,n)),t}function km(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 oR(t,{top:e,left:n,bottom:i,right:r}){return{x:km(t.x,n,r),y:km(t.y,e,i)}}function Cm(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 aR(t,e){return{x:Cm(t.x,e.x),y:Cm(t.y,e.y)}}function cR(t,e){let n=.5;const i=pt(t),r=pt(e);return r>i?n=xs(e.min,e.max-i,t.min):i>r&&(n=xs(t.min,t.max-r,e.min)),_n(0,1,n)}function lR(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 pd=.35;function dR(t=pd){return t===!1?t=0:t===!0&&(t=pd),{x:Tm(t,"left","right"),y:Tm(t,"top","bottom")}}function Tm(t,e,n){return{min:Em(t,e),max:Em(t,n)}}function Em(t,e){return typeof t=="number"?t:t[e]||0}const uR=new WeakMap;class hR{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=qe(),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:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Fs(u).point)},o=(u,h)=>{const{drag:p,dragPropagation:g,onDragStart:f}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xE(p),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Nt(b=>{let w=this.getAxisMotionValue(b).get()||0;if(un.test(w)){const{projection:k}=this.visualElement;if(k&&k.layout){const S=k.layout.layoutBox[b];S&&(w=pt(S)*(parseFloat(w)/100))}}this.originPoint[b]=w}),f&&je.postRender(()=>f(u,h)),fd(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:f,onDrag:y}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=h;if(g&&this.currentDirection===null){this.currentDirection=fR(b),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",h.point,b),this.updateAxis("y",h.point,b),this.visualElement.render(),y&&y(u,h)},c=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h,this.stop(u,h),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>Nt(u=>{var h;return this.getAnimationState(u)==="paused"&&((h=this.getAxisMotionValue(u).animation)==null?void 0:h.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new nb(e,{onSessionStart:s,onStart:o,onMove:a,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:i,contextWindow:tb(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&&je.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||!to(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=sR(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&&cr(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=oR(i.layoutBox,e):this.constraints=!1,this.elastic=dR(n),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Nt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=lR(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!cr(e))return!1;const i=e.current;On(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=mP(i,r.root,this.visualElement.getTransformPagePoint());let o=aR(r.layout.layoutBox,s);if(n){const a=n(uP(o));this.hasMutatedConstraints=!!a,a&&(o=Uy(a))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=Nt(d=>{if(!to(d,n,this.currentDirection))return;let u=c&&c[d]||{};o&&(u={min:0,max:0});const h=r?200:1e6,p=r?40:1e7,g={type:"inertia",velocity:i?e[d]:0,bounceStiffness:h,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 fd(this.visualElement,e),i.start(Wu(e,i,0,n,this.visualElement,!1))}stopAnimation(){Nt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Nt(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){Nt(n=>{const{drag:i}=this.getProps();if(!to(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]-Ve(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!cr(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Nt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const c=a.get();r[o]=cR({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(),Nt(o=>{if(!to(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(Ve(c,l,r[o]))})}addListeners(){if(!this.visualElement.current)return;uR.set(this.visualElement,this);const e=this.visualElement.current,n=ms(e,"pointerdown",c=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();cr(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()),je.read(i);const o=Ts(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(Nt(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=pd,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function to(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function fR(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class mR extends ui{constructor(e){super(e),this.removeGroupControls=jt,this.removeListeners=jt,this.controls=new hR(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jt}unmount(){this.removeGroupControls(),this.removeListeners()}}const Pm=t=>(e,n)=>{t&&je.postRender(()=>t(e,n))};class pR extends ui{constructor(){super(...arguments),this.removePointerDownListener=jt}onPointerDown(e){this.session=new nb(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:tb(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:Pm(e),onStart:Pm(n),onMove:i,onEnd:(s,o)=>{delete this.session,r&&je.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=ms(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 Vo={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Rm(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const es={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Rm(t,e.target.x),i=Rm(t,e.target.y);return`${n}% ${i}%`}},gR={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,r=ni.parse(t);if(r.length>5)return i;const s=ni.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=Ve(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 Oc=!1;class vR extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;FE(yR),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),Oc&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Vo.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,{projection:o}=i;return o&&(o.isPresent=s,Oc=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||je.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Ou.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=e;Oc=!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 rb(t){const[e,n]=Ey(),i=R.useContext(hu);return m.jsx(vR,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(Vy),isPresent:e,safeToRemove:n})}const yR={borderRadius:{...es,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:es,borderTopRightRadius:es,borderBottomLeftRadius:es,borderBottomRightRadius:es,boxShadow:gR};function bR(t,e,n){const i=mt(t)?t:Pr(t);return i.start(Wu("",i,e,n)),i.animation}const xR=(t,e)=>t.depth-e.depth;class SR{constructor(){this.children=[],this.isDirty=!1}add(e){pu(this.children,e),this.isDirty=!0}remove(e){gu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(xR),this.isDirty=!1,this.children.forEach(e)}}function wR(t,e){const n=xt.now(),i=({timestamp:r})=>{const s=r-n;s>=e&&(ti(i),t(s-e))};return je.setup(i,!0),()=>ti(i)}const sb=["TopLeft","TopRight","BottomLeft","BottomRight"],kR=sb.length,Am=t=>typeof t=="string"?parseFloat(t):t,Im=t=>typeof t=="number"||de.test(t);function CR(t,e,n,i,r,s){r?(t.opacity=Ve(0,n.opacity??1,TR(i)),t.opacityExit=Ve(e.opacity??1,0,ER(i))):s&&(t.opacity=Ve(e.opacity??1,n.opacity??1,i));for(let o=0;o<kR;o++){const a=`border${sb[o]}Radius`;let c=Mm(e,a),l=Mm(n,a);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||Im(c)===Im(l)?(t[a]=Math.max(Ve(Am(c),Am(l),i),0),(un.test(l)||un.test(c))&&(t[a]+="%")):t[a]=l}(e.rotate||n.rotate)&&(t.rotate=Ve(e.rotate||0,n.rotate||0,i))}function Mm(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const TR=ob(0,.5,qv),ER=ob(.5,.95,jt);function ob(t,e,n){return i=>i<t?0:i>e?1:n(xs(t,e,i))}function Nm(t,e){t.min=e.min,t.max=e.max}function Mt(t,e){Nm(t.x,e.x),Nm(t.y,e.y)}function _m(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Om(t,e,n,i,r){return t-=e,t=ca(t,1/n,i),r!==void 0&&(t=ca(t,1/r,i)),t}function PR(t,e=0,n=1,i=.5,r,s=t,o=t){if(un.test(e)&&(e=parseFloat(e),e=Ve(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Ve(s.min,s.max,i);t===s&&(a-=e),t.min=Om(t.min,e,n,a,r),t.max=Om(t.max,e,n,a,r)}function Dm(t,e,[n,i,r],s,o){PR(t,e[n],e[i],e[r],e.scale,s,o)}const RR=["x","scaleX","originX"],AR=["y","scaleY","originY"];function jm(t,e,n,i){Dm(t.x,e,RR,n?n.x:void 0,i?i.x:void 0),Dm(t.y,e,AR,n?n.y:void 0,i?i.y:void 0)}function Lm(t){return t.translate===0&&t.scale===1}function ab(t){return Lm(t.x)&&Lm(t.y)}function Vm(t,e){return t.min===e.min&&t.max===e.max}function IR(t,e){return Vm(t.x,e.x)&&Vm(t.y,e.y)}function Fm(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function cb(t,e){return Fm(t.x,e.x)&&Fm(t.y,e.y)}function Um(t){return pt(t.x)/pt(t.y)}function Bm(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class MR{constructor(){this.members=[]}add(e){pu(this.members,e),e.scheduleRender()}remove(e){if(gu(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 NR(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:h,skewX:p,skewY:g}=n;l&&(i=`perspective(${l}px) ${i}`),d&&(i+=`rotate(${d}deg) `),u&&(i+=`rotateX(${u}deg) `),h&&(i+=`rotateY(${h}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 Dc=["","X","Y","Z"],_R=1e3;let OR=0;function jc(t,e,n,i){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),i&&(i[t]=0))}function lb(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Gy(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",je,!(r||s))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&lb(i)}function db({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=OR++,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(LR),this.nodes.forEach(BR),this.nodes.forEach($R),this.nodes.forEach(VR)},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 SR)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new yu),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=Ty(o)&&!EE(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 h=()=>this.root.updateBlockedByResize=!1;je.read(()=>{u=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==u&&(u=p,this.root.updateBlockedByResize=!0,d&&d(),d=wR(h,250),Vo.hasAnimatedSinceResize&&(Vo.hasAnimatedSinceResize=!1,this.nodes.forEach(zm)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&l&&(a||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:u,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||l.getDefaultTransition()||KR,{onLayoutAnimationStart:f,onLayoutAnimationComplete:y}=l.getProps(),b=!this.targetLayout||!cb(this.targetLayout,p),w=!u&&h;if(this.options.layoutRoot||this.resumeFrom||w||u&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...Nu(g,"layout"),onPlay:f,onComplete:y};(l.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(d,w)}else u||zm(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(),ti(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(HR),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&&lb(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($m);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Hm);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(UR),this.nodes.forEach(DR),this.nodes.forEach(jR)):this.nodes.forEach(Hm),this.clearAllSnapshots();const a=xt.now();at.delta=_n(0,1e3/60,a-at.timestamp),at.timestamp=a,at.isProcessing=!0,Cc.update.process(at),Cc.preRender.process(at),Cc.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ou.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(FR),this.sharedNodes.forEach(zR)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,je.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){je.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!pt(this.snapshot.measuredBox.x)&&!pt(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=qe(),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&&!ab(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,d=l!==this.prevTransformTemplateValue;o&&this.instance&&(a||wi(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)),GR(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var l;const{visualElement:o}=this.options;if(!o)return qe();const a=o.measureViewportBox();if(!(((l=this.scroll)==null?void 0:l.wasRoot)||this.path.some(ZR))){const{scroll:d}=this.root;d&&(lr(a.x,d.offset.x),lr(a.y,d.offset.y))}return a}removeElementScroll(o){var c;const a=qe();if(Mt(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:h}=d;d!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&Mt(a,o),lr(a.x,u.offset.x),lr(a.y,u.offset.y))}return a}applyTransform(o,a=!1){const c=qe();Mt(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&&dr(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),wi(d.latestValues)&&dr(c,d.latestValues)}return wi(this.latestValues)&&dr(c,this.latestValues),c}removeTransform(o){const a=qe();Mt(a,o);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!wi(l.latestValues))continue;ld(l.latestValues)&&l.updateSnapshot();const d=qe(),u=l.measurePageBox();Mt(d,u),jm(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,d)}return wi(this.latestValues)&&jm(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!==at.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var h;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||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:u}=this.options;if(!(!this.layout||!(d||u))){if(this.resolvedRelativeTargetAt=at.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qe(),this.relativeTargetOrigin=qe(),gs(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Mt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=qe(),this.targetWithTransforms=qe()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),tR(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mt(this.target,this.layout.layoutBox),$y(this.target,this.targetDelta)):Mt(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=qe(),this.relativeTargetOrigin=qe(),gs(this.relativeTargetOrigin,this.target,p.target),Mt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||ld(this.parent.latestValues)||By(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===at.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;Mt(this.layoutCorrected,this.layout.layoutBox);const u=this.treeScale.x,h=this.treeScale.y;fP(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=qe());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_m(this.prevProjectionDelta.x,this.projectionDelta.x),_m(this.prevProjectionDelta.y,this.projectionDelta.y)),ps(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==u||this.treeScale.y!==h||!Bm(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bm(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=ur(),this.projectionDelta=ur(),this.projectionDeltaWithTransform=ur()}setAnimationOrigin(o,a=!1){const c=this.snapshot,l=c?c.latestValues:{},d={...this.latestValues},u=ur();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const h=qe(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,f=p!==g,y=this.getStack(),b=!y||y.members.length<=1,w=!!(f&&!b&&this.options.crossfade===!0&&!this.path.some(qR));this.animationProgress=0;let k;this.mixTargetDelta=S=>{const x=S/1e3;Wm(u.x,o.x,x),Wm(u.y,o.y,x),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(gs(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),WR(this.relativeTarget,this.relativeTargetOrigin,h,x),k&&IR(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=qe()),Mt(k,this.relativeTarget)),f&&(this.animationValues=d,CR(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&&(ti(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=je.update(()=>{Vo.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Pr(0)),this.currentAnimation=bR(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(_R),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&&ub(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||qe();const u=pt(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+u;const h=pt(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Mt(a,c),dr(a,d),ps(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new MR),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&&jc("z",o,l,this.animationValues);for(let d=0;d<Dc.length;d++)jc(`rotate${Dc[d]}`,o,l,this.animationValues),jc(`skew${Dc[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=Lo(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=Lo(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!wi(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=l.animationValues||l.latestValues;this.applyTransformsToTarget();let u=NR(this.projectionDeltaWithTransform,this.treeScale,d);c&&(u=c(d,u)),o.transform=u;const{x:h,y:p}=this.projectionDelta;o.transformOrigin=`${h.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 Cs){if(d[g]===void 0)continue;const{correct:f,applyTo:y,isCSSVariable:b}=Cs[g],w=u==="none"?d[g]:f(d[g],l);if(y){const k=y.length;for(let S=0;S<k;S++)o[y[S]]=w}else b?this.options.visualElement.renderState.vars[g]=w:o[g]=w}this.options.layoutId&&(o.pointerEvents=l===this?Lo(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($m),this.root.sharedNodes.clear()}}}function DR(t){t.updateLayout()}function jR(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"?Nt(u=>{const h=o?e.measuredBox[u]:e.layoutBox[u],p=pt(h);h.min=i[u].min,h.max=h.min+p}):ub(s,e.layoutBox,i)&&Nt(u=>{const h=o?e.measuredBox[u]:e.layoutBox[u],p=pt(i[u]);h.max=h.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+p)});const a=ur();ps(a,i,e.layoutBox);const c=ur();o?ps(c,t.applyTransform(r,!0),e.measuredBox):ps(c,i,e.layoutBox);const l=!ab(a);let d=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:p}=u;if(h&&p){const g=qe();gs(g,e.layoutBox,h.layoutBox);const f=qe();gs(f,i,p.layoutBox),cb(g,f)||(d=!0),u.options.layoutRoot&&(t.relativeTarget=f,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 LR(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 VR(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function FR(t){t.clearSnapshot()}function $m(t){t.clearMeasurements()}function Hm(t){t.isLayoutDirty=!1}function UR(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function zm(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function BR(t){t.resolveTargetDelta()}function $R(t){t.calcProjection()}function HR(t){t.resetSkewAndRotation()}function zR(t){t.removeLeadSnapshot()}function Wm(t,e,n){t.translate=Ve(e.translate,0,n),t.scale=Ve(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function qm(t,e,n,i){t.min=Ve(e.min,n.min,i),t.max=Ve(e.max,n.max,i)}function WR(t,e,n,i){qm(t.x,e.x,n.x,i),qm(t.y,e.y,n.y,i)}function qR(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const KR={duration:.45,ease:[.4,0,.1,1]},Km=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Gm=Km("applewebkit/")&&!Km("chrome/")?Math.round:jt;function Zm(t){t.min=Gm(t.min),t.max=Gm(t.max)}function GR(t){Zm(t.x),Zm(t.y)}function ub(t,e,n){return t==="position"||t==="preserve-aspect"&&!eR(Um(e),Um(n),.2)}function ZR(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const YR=db({attachResizeListener:(t,e)=>Ts(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Lc={current:void 0},hb=db({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Lc.current){const t=new YR({});t.mount(window),t.setOptions({layoutScroll:!0}),Lc.current=t}return Lc.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),JR={pan:{Feature:pR},drag:{Feature:mR,ProjectionNode:hb,MeasureLayout:rb}};function Ym(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&&je.postRender(()=>s(e,Fs(e)))}class XR extends ui{mount(){const{current:e}=this.node;e&&(this.unmount=SE(e,(n,i)=>(Ym(this.node,i,"Start"),r=>Ym(this.node,r,"End"))))}unmount(){}}class QR extends ui{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=js(Ts(this.node.current,"focus",()=>this.onFocus()),Ts(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Jm(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&&je.postRender(()=>s(e,Fs(e)))}class eA extends ui{mount(){const{current:e}=this.node;e&&(this.unmount=TE(e,(n,i)=>(Jm(this.node,i,"Start"),(r,{success:s})=>Jm(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const gd=new WeakMap,Vc=new WeakMap,tA=t=>{const e=gd.get(t.target);e&&e(t)},nA=t=>{t.forEach(tA)};function iA({root:t,...e}){const n=t||document;Vc.has(n)||Vc.set(n,{});const i=Vc.get(n),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(nA,{root:t,...e})),i[r]}function rA(t,e,n){const i=iA(e);return gd.set(t,n),i.observe(t),()=>{gd.delete(t),i.unobserve(t)}}const sA={some:0,all:1};class oA extends ui{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:sA[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(),h=l?d:u;h&&h(c)};return rA(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(aA(e,n))&&this.startObserver()}unmount(){}}function aA({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const cA={inView:{Feature:oA},tap:{Feature:eA},focus:{Feature:QR},hover:{Feature:XR}},lA={layout:{ProjectionNode:hb,MeasureLayout:rb}},dA={...GP,...cA,...JR,...lA},ge=dP(dA,kP);var no=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vd={exports:{}},uA=vd.exports,Xm;function hA(){return Xm||(Xm=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(uA,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(f,y){var b=f[y];if(typeof b.bind=="function")return b.bind(f);try{return Function.prototype.bind.call(b,f)}catch{return function(){return Function.prototype.apply.apply(b,[f,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(f){return f==="debug"&&(f="log"),typeof console===n?!1:f==="trace"&&i?c:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):e}function d(){for(var f=this.getLevel(),y=0;y<r.length;y++){var b=r[y];this[b]=y<f?e:this.methodFactory(b,f,this.name)}if(this.log=this.debug,typeof console===n&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==n&&(d.call(this),this[f].apply(this,arguments))}}function h(f,y,b){return l(f)||u.apply(this,arguments)}function p(f,y){var b=this,w,k,S,x="loglevel";typeof f=="string"?x+=":"+f:typeof f=="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,Z=encodeURIComponent(x),Q=N.indexOf(Z+"=");Q!==-1&&(I=/^([^;]+)/.exec(N.slice(Q+Z.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 M(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=f,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=y||h,b.getLevel=function(){return S??k??w},b.setLevel=function(I,N){return S=M(I),N!==!1&&T(S),d.call(b)},b.setDefaultLevel=function(I){k=M(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=M(o.getLevel())),d.call(b),o===b)for(var I in s)s[I].rebuild()},w=M(o?o.getLevel():"WARN");var C=E();C!=null&&(S=M(C)),d.call(b)}o=new p,o.getLogger=function(f){if(typeof f!="symbol"&&typeof f!="string"||f==="")throw new TypeError("You must supply a name when creating a logger.");var y=s[f];return y||(y=s[f]=new p(f,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})}(vd)),vd.exports}var fA=hA();const mA=fb(fA);var yd=function(t,e){return yd=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])},yd(t,e)};function Fn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");yd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function pA(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 mb(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 Ar(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 Es(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 Ps(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 xr(t){return this instanceof xr?(this.v=t,this):new xr(t)}function gA(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(f){return new Promise(function(y,b){s.push([p,f,y,b])>1||c(p,f)})},g&&(r[p]=g(r[p])))}function c(p,g){try{l(i[p](g))}catch(f){h(s[0][3],f)}}function l(p){p.value instanceof xr?Promise.resolve(p.value.v).then(d,u):h(s[0][2],p)}function d(p){c("next",p)}function u(p){c("throw",p)}function h(p,g){p(g),s.shift(),s.length&&c(s[0][0],s[0][1])}}function vA(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 Ar=="function"?Ar(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 et(t){return typeof t=="function"}function qu(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 Fc=qu(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
47
+ `+e.map(function(n,i){return i+1+") "+n.toString()}).join(`
48
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function la(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Us=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=Ar(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(f){e={error:f}}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(et(d))try{d()}catch(f){s=f instanceof Fc?f.errors:[f]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=Ar(u),p=h.next();!p.done;p=h.next()){var g=p.value;try{Qm(g)}catch(f){s=s??[],f instanceof Fc?s=Ps(Ps([],Es(s)),Es(f.errors)):s.push(f)}}}catch(f){i={error:f}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}}if(s)throw new Fc(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Qm(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)&&la(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&la(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),pb=Us.EMPTY;function gb(t){return t instanceof Us||t&&"closed"in t&&et(t.remove)&&et(t.add)&&et(t.unsubscribe)}function Qm(t){et(t)?t():t.unsubscribe()}var yA={Promise:void 0},bA={setTimeout:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,Ps([t,e],Es(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function vb(t){bA.setTimeout(function(){throw t})}function bd(){}function Fo(t){t()}var Ku=function(t){Fn(e,t);function e(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,gb(n)&&n.add(i)):i.destination=wA,i}return e.create=function(n,i,r){return new Rs(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}(Us),xA=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){io(i)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(i){io(i)}else io(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){io(n)}},t}(),Rs=function(t){Fn(e,t);function e(n,i,r){var s=t.call(this)||this,o;return et(n)||!n?o={next:n??void 0,error:i??void 0,complete:r??void 0}:o=n,s.destination=new xA(o),s}return e}(Ku);function io(t){vb(t)}function SA(t){throw t}var wA={closed:!0,next:bd,error:SA,complete:bd},Gu=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Zu(t){return t}function kA(t){return t.length===0?Zu:t.length===1?t[0]:function(e){return t.reduce(function(n,i){return i(n)},e)}}var it=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=TA(e)?e:new Rs(e,n,i);return Fo(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=ep(n),new n(function(r,s){var o=new Rs({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[Gu]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return kA(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=ep(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 ep(t){var e;return(e=t??yA.Promise)!==null&&e!==void 0?e:Promise}function CA(t){return t&&et(t.next)&&et(t.error)&&et(t.complete)}function TA(t){return t&&t instanceof Ku||CA(t)&&gb(t)}function EA(t){return et(t==null?void 0:t.lift)}function yn(t){return function(e){if(EA(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 ii(t,e,n,i,r){return new PA(t,e,n,i,r)}var PA=function(t){Fn(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}(Ku),RA=qu(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Ir=function(t){Fn(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 tp(this,this);return i.operator=n,i},e.prototype._throwIfClosed=function(){if(this.closed)throw new RA},e.prototype.next=function(n){var i=this;Fo(function(){var r,s;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var o=Ar(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;Fo(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;Fo(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?pb:(this.currentObservers=null,a.push(n),new Us(function(){i.currentObservers=null,la(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 it;return n.source=this,n},e.create=function(n,i){return new tp(n,i)},e}(it),tp=function(t){Fn(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:pb},e}(Ir),AA=function(t){Fn(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}(Ir),IA={now:function(){return Date.now()}},MA=function(t){Fn(e,t);function e(n,i){return t.call(this)||this}return e.prototype.schedule=function(n,i){return this},e}(Us),np={setInterval:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setInterval.apply(void 0,Ps([t,e],Es(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},NA=function(t){Fn(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),np.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&&np.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,la(s,this),i!=null&&(this.id=this.recycleAsyncId(r,i,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(MA),ip=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=IA.now,t}(),_A=function(t){Fn(e,t);function e(n,i){i===void 0&&(i=ip.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}(ip);new _A(NA);function OA(t){return t&&et(t.schedule)}function DA(t){return t[t.length-1]}function yb(t){return OA(DA(t))?t.pop():void 0}var bb=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function xb(t){return et(t==null?void 0:t.then)}function Sb(t){return et(t[Gu])}function wb(t){return Symbol.asyncIterator&&et(t==null?void 0:t[Symbol.asyncIterator])}function kb(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 jA(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Cb=jA();function Tb(t){return et(t==null?void 0:t[Cb])}function Eb(t){return gA(this,arguments,function(){var e,n,i,r;return mb(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,xr(e.read())];case 3:return n=s.sent(),i=n.value,r=n.done,r?[4,xr(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,xr(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 Pb(t){return et(t==null?void 0:t.getReader)}function hi(t){if(t instanceof it)return t;if(t!=null){if(Sb(t))return LA(t);if(bb(t))return VA(t);if(xb(t))return FA(t);if(wb(t))return Rb(t);if(Tb(t))return UA(t);if(Pb(t))return BA(t)}throw kb(t)}function LA(t){return new it(function(e){var n=t[Gu]();if(et(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function VA(t){return new it(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function FA(t){return new it(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,vb)})}function UA(t){return new it(function(e){var n,i;try{for(var r=Ar(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 Rb(t){return new it(function(e){$A(t,e).catch(function(n){return e.error(n)})})}function BA(t){return Rb(Eb(t))}function $A(t,e){var n,i,r,s;return pA(this,void 0,void 0,function(){var o,a;return mb(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=vA(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 Ii(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 Ab(t,e){return e===void 0&&(e=0),yn(function(n,i){n.subscribe(ii(i,function(r){return Ii(i,t,function(){return i.next(r)},e)},function(){return Ii(i,t,function(){return i.complete()},e)},function(r){return Ii(i,t,function(){return i.error(r)},e)}))})}function Ib(t,e){return e===void 0&&(e=0),yn(function(n,i){i.add(t.schedule(function(){return n.subscribe(i)},e))})}function HA(t,e){return hi(t).pipe(Ib(e),Ab(e))}function zA(t,e){return hi(t).pipe(Ib(e),Ab(e))}function WA(t,e){return new it(function(n){var i=0;return e.schedule(function(){i===t.length?n.complete():(n.next(t[i++]),n.closed||this.schedule())})})}function qA(t,e){return new it(function(n){var i;return Ii(n,e,function(){i=t[Cb](),Ii(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 et(i==null?void 0:i.return)&&i.return()}})}function Mb(t,e){if(!t)throw new Error("Iterable cannot be null");return new it(function(n){Ii(n,e,function(){var i=t[Symbol.asyncIterator]();Ii(n,e,function(){i.next().then(function(r){r.done?n.complete():n.next(r.value)})},0,!0)})})}function KA(t,e){return Mb(Eb(t),e)}function GA(t,e){if(t!=null){if(Sb(t))return HA(t,e);if(bb(t))return WA(t,e);if(xb(t))return zA(t,e);if(wb(t))return Mb(t,e);if(Tb(t))return qA(t,e);if(Pb(t))return KA(t,e)}throw kb(t)}function Yu(t,e){return e?GA(t,e):hi(t)}qu(function(t){return function(e){e===void 0&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}});function Lt(t,e){return yn(function(n,i){var r=0;n.subscribe(ii(i,function(s){i.next(t.call(e,s,r++))}))})}function ZA(t,e,n,i,r,s,o,a){var c=[],l=0,d=0,u=!1,h=function(){u&&!c.length&&!l&&e.complete()},p=function(f){return l<i?g(f):c.push(f)},g=function(f){l++;var y=!1;hi(n(f,d++)).subscribe(ii(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();h()}catch(w){e.error(w)}}))};return t.subscribe(ii(e,p,function(){u=!0,h()})),function(){}}function Nb(t,e,n){return n===void 0&&(n=1/0),et(e)?Nb(function(i,r){return Lt(function(s,o){return e(i,s,r,o)})(hi(t(i,r)))},n):(typeof e=="number"&&(n=e),yn(function(i,r){return ZA(i,r,t,n)}))}function YA(t){return Nb(Zu,t)}function JA(){return YA(1)}function rp(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return JA()(Yu(t,yb(t)))}function _b(t,e){return yn(function(n,i){var r=0;n.subscribe(ii(i,function(s){return t.call(e,s,r++)&&i.next(s)}))})}function XA(t,e,n,i,r){return function(s,o){var a=n,c=e,l=0;s.subscribe(ii(o,function(d){var u=l++;c=a?t(c,d,u):(a=!0,d),o.next(c)},r))}}function xd(t,e){return yn(XA(t,e,arguments.length>=2,!0))}function QA(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new Ir}: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,h,p=0,g=!1,f=!1,y=function(){u==null||u.unsubscribe(),u=void 0},b=function(){y(),d=h=void 0,g=f=!1},w=function(){var k=d;b(),k==null||k.unsubscribe()};return yn(function(k,S){p++,!f&&!g&&y();var x=h=h??n();S.add(function(){p--,p===0&&!f&&!g&&(u=Uc(w,c))}),x.subscribe(S),!d&&p>0&&(d=new Rs({next:function(T){return x.next(T)},error:function(T){f=!0,y(),u=Uc(b,r,T),x.error(T)},complete:function(){g=!0,y(),u=Uc(b,o),x.complete()}}),hi(k).subscribe(d))})(l)}}function Uc(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 Rs({next:function(){r.unsubscribe(),t()}});return hi(e.apply(void 0,Ps([],Es(n)))).subscribe(r)}}function fi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=yb(t);return yn(function(i,r){(n?rp(t,i,n):rp(t,i)).subscribe(r)})}function sp(t){return yn(function(e,n){hi(t).subscribe(ii(n,function(){return n.complete()},bd)),!n.closed&&e.subscribe(n)})}function eI(t,e,n){var i=et(t)||e||n?{next:t,error:e,complete:n}:t;return i?yn(function(r,s){var o;(o=i.subscribe)===null||o===void 0||o.call(i);var a=!0;r.subscribe(ii(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)}))}):Zu}var tI=Object.defineProperty,nI=Object.defineProperties,iI=Object.getOwnPropertyDescriptors,op=Object.getOwnPropertySymbols,rI=Object.prototype.hasOwnProperty,sI=Object.prototype.propertyIsEnumerable,ap=(t,e,n)=>e in t?tI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gn=(t,e)=>{for(var n in e||(e={}))rI.call(e,n)&&ap(t,n,e[n]);if(op)for(var n of op(e))sI.call(e,n)&&ap(t,n,e[n]);return t},ki=(t,e)=>nI(t,iI(e)),Mr=(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())}),oI="lk";function Ju(t){return typeof t>"u"?!1:aI(t)||cI(t)}function aI(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 cI(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("publication")&&typeof t.publication<"u":!1}function lI(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&typeof t.publication>"u":!1}function Ob(t){if(typeof t=="string"||typeof t=="number")return`${t}`;if(lI(t))return`${t.participant.identity}_${t.source}_placeholder`;if(Ju(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 dI=[V.ConnectionStateChanged,V.RoomMetadataChanged,V.ActiveSpeakersChanged,V.ConnectionQualityChanged,V.ParticipantConnected,V.ParticipantDisconnected,V.ParticipantPermissionsChanged,V.ParticipantMetadataChanged,V.ParticipantNameChanged,V.ParticipantAttributesChanged,V.TrackMuted,V.TrackUnmuted,V.TrackPublished,V.TrackUnpublished,V.TrackStreamStateChanged,V.TrackSubscriptionFailed,V.TrackSubscriptionPermissionChanged,V.TrackSubscriptionStatusChanged],Db=[...dI,V.LocalTrackPublished,V.LocalTrackUnpublished],uI=[q.TrackPublished,q.TrackUnpublished,q.TrackMuted,q.TrackUnmuted,q.TrackStreamStateChanged,q.TrackSubscribed,q.TrackUnsubscribed,q.TrackSubscriptionPermissionChanged,q.TrackSubscriptionFailed,q.LocalTrackPublished,q.LocalTrackUnpublished],hI=[q.ConnectionQualityChanged,q.IsSpeakingChanged,q.ParticipantMetadataChanged,q.ParticipantPermissionsChanged,q.TrackMuted,q.TrackUnmuted,q.TrackPublished,q.TrackUnpublished,q.TrackStreamStateChanged,q.TrackSubscriptionFailed,q.TrackSubscriptionPermissionChanged,q.TrackSubscriptionStatusChanged];[...hI,q.LocalTrackPublished,q.LocalTrackUnpublished];var pn=mA.getLogger("lk-components-js");pn.setDefaultLevel("WARN");function fI(t,e){var n;return ki(Gn({},t),{receivedAtMediaTimestamp:(n=e.rtpTimestamp)!=null?n:0,receivedAt:e.timestamp})}function mI(t,e,n){return[...t,...e].reduceRight((i,r)=>(i.find(s=>s.id===r.id)||i.unshift(r),i),[]).slice(0-n)}function jb(t){return typeof t=="object"}function Lb(t){return Array.isArray(t)&&t.filter(jb).length>0}function Vb(t){return`${oI}-${t}`}function pI(t){const e=Sd(t),n=Bb(t.participant).pipe(Lt(()=>Sd(t)),fi(e));return{className:Vb(t.source===D.Source.Camera||t.source===D.Source.ScreenShare?"participant-media-video":"participant-media-audio"),trackObserver:n}}function Sd(t){if(Ju(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 Xu(t,...e){return new it(n=>{const i=()=>{n.next(t)};return e.forEach(r=>{t.on(r,i)}),()=>{e.forEach(r=>{t.off(r,i)})}}).pipe(fi(t))}function Fb(t,e){return new it(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function gI(t){return Fb(t,V.ConnectionStateChanged).pipe(Lt(([e])=>e),fi(t.state))}function vI(t){return Fb(t,V.DataReceived)}function yI(t){return Xu(t,V.AudioPlaybackStatusChanged).pipe(Lt(e=>({canPlayAudio:e.canPlaybackAudio})))}function Ub(t,...e){return new it(n=>{const i=()=>{n.next(t)};return e.forEach(r=>{t.on(r,i)}),()=>{e.forEach(r=>{t.off(r,i)})}}).pipe(fi(t))}function Bb(t){return Ub(t,q.TrackMuted,q.TrackUnmuted,q.ParticipantPermissionsChanged,q.TrackPublished,q.TrackUnpublished,q.LocalTrackPublished,q.LocalTrackUnpublished,q.MediaDevicesError,q.TrackSubscriptionStatusChanged).pipe(Lt(e=>{const{isMicrophoneEnabled:n,isCameraEnabled:i,isScreenShareEnabled:r}=e,s=e.getTrackPublication(D.Source.Microphone),o=e.getTrackPublication(D.Source.Camera);return{isCameraEnabled:i,isMicrophoneEnabled:n,isScreenShareEnabled:r,cameraTrack:o,microphoneTrack:s,participant:e}}))}function bI(t,e){return new it(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function xI(t,e={}){var n;let i;const r=new it(c=>(i=c,()=>a.unsubscribe())).pipe(fi(Array.from(t.remoteParticipants.values()))),s=(n=e.additionalRoomEvents)!=null?n:Db,o=Array.from(new Set([V.ParticipantConnected,V.ParticipantDisconnected,V.ConnectionStateChanged,...s])),a=Xu(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 cp(t){return typeof t>"u"?new it:bI(t,q.AttributesChanged).pipe(Lt(([e])=>({changed:e,attributes:t.attributes})),fi({changed:t.attributes,attributes:t.attributes}))}var $b={CHAT:"lk.chat",TRANSCRIPTION:"lk.transcription"},SI={CHAT:"lk-chat-topic"};function Hb(t,e){return Mr(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 wI(t,e,n){const i=Array.isArray(e)?e:[e],r=vI(t).pipe(_b(([,,,a])=>e===void 0||a!==void 0&&i.includes(a)),Lt(([a,c,,l])=>({payload:a,topic:l,from:c})));let s;const o=new it(a=>{s=a});return{messageObservable:r,isSendingObservable:o,send:(a,...c)=>Mr(this,[a,...c],function*(l,d={}){s.next(!0);try{yield Hb(t.localParticipant,l,Gn({topic:i[0]},d))}finally{s.next(!1)}})}}var ro=new WeakMap;function kI(t){return t.ignoreLegacy==!0}var CI=t=>JSON.parse(new TextDecoder().decode(t)),TI=t=>new TextEncoder().encode(JSON.stringify(t));function EI(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)&&Qn((E=t.serverInfo)==null?void 0:E.version,"1.8.2")>0},l=new Ir,d=(n=void 0)!=null?n:$b.CHAT,u=(i=void 0)!=null?i:SI.CHAT;let h=!1;ro.has(t)||(h=!0);const p=(r=ro.get(t))!=null?r:new Map,g=(s=p.get(d))!=null?s:new Ir;p.set(d,g),ro.set(t,p);const f=(o=void 0)!=null?o:CI;if(h){t.registerTextStreamHandler(d,(T,E)=>Mr(this,null,function*(){const{id:P,timestamp:M}=T.info;Yu(T).pipe(xd((C,I)=>C+I),Lt(C=>({id:P,timestamp:M,message:C,from:t.getParticipantByIdentity(E.identity)}))).subscribe({next:C=>g.next(C)})}));const{messageObservable:x}=wI(t,[u]);x.pipe(Lt(T=>{const E=f(T.payload);return kI(E)?void 0:ki(Gn({},E),{from:T.from})}),_b(T=>!!T),sp(l)).subscribe(g)}const y=g.pipe(xd((x,T)=>{if("id"in T&&x.find(E=>{var P,M;return((P=E.from)==null?void 0:P.identity)===((M=T.from)==null?void 0:M.identity)&&E.id===T.id})){const E=x.findIndex(P=>P.id===T.id);if(E>-1){const P=x[E];x[E]=ki(Gn({},T),{timestamp:P.timestamp,editTimestamp:T.timestamp})}return[...x]}return[...x,T]},[]),sp(l)),b=new AA(!1),w=(a=void 0)!=null?a:TI,k=(x,T)=>Mr(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=ki(Gn({},E),{attachedFiles:T.attachments}),M=ki(Gn({},P),{from:t.localParticipant,attributes:T.attributes});g.next(M);const C=w(ki(Gn({},E),{ignoreLegacy:c()}));try{yield Hb(t.localParticipant,C,{reliable:!0,topic:u})}catch(I){pn.info("could not send message in legacy chat format",I)}return M}finally{b.next(!1)}});function S(){l.next(),l.complete(),g.complete(),ro.delete(t),t.unregisterTextStreamHandler(d)}return t.once(V.Disconnected,S),{messageObservable:y,isSendingObservable:b,send:k}}function PI(){const t=e=>Mr(this,null,function*(){pn.info("Start Audio for room: ",e),yield e.startAudio()});return{className:Vb("start-audio-button"),roomAudioPlaybackAllowedObservable:yI,handleStartAudioPlayback:t}}function lp(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 dp(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 RI(t,e,n){var i,r;const s=(i=n.additionalRoomEvents)!=null?i:Db,o=(r=n.onlySubscribed)!=null?r:!0,a=Array.from(new Set([V.ParticipantConnected,V.ParticipantDisconnected,V.ConnectionStateChanged,V.LocalTrackPublished,V.LocalTrackUnpublished,V.TrackPublished,V.TrackUnpublished,V.TrackSubscriptionStatusChanged,...s]).values());return Xu(t,...a).pipe(Lt(c=>{const l=lp(c,e,o);return pn.debug(`TrackReference[] was updated. (length ${l.trackReferences.length})`,l),l}),fi(lp(t,e,o)))}function AI(t,e){return Ub(t,...uI).pipe(Lt(n=>{const i=dp(n,e);return pn.debug(`TrackReference[] was updated. (length ${i.length})`,i),i}),fi(dp(t,e)))}function zb(t,e){return new it(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function II(t){return zb(t,ne.TranscriptionReceived)}function MI(t){return zb(t,ne.TimeSyncUpdate).pipe(Lt(([e])=>e))}var Bc=null,$c=null,NI=0;function up(){return Bc||(Bc=new Map),Bc}function _I(){return $c||($c=new WeakMap),$c}function OI(t,e){const n=_I();let i=n.get(t);return i||(i=`room_${NI++}`,n.set(t,i)),`${i}:${e}`}function DI(t,e){const n=OI(t,e),i=up(),r=i.get(n);if(r)return r;const s=new Ir;let o=[];const a="lk.segment_id",c=s.pipe(eI({subscribe:()=>{t.registerTextStreamHandler(e,(l,d)=>Mr(this,null,function*(){var u;const h=Yu(l).pipe(xd((g,f)=>g+f,"")),p=!!((u=l.info.attributes)!=null&&u[a]);h.subscribe(g=>{const f=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])});f!==-1?(o[f]=ki(Gn({},o[f]),{text:g}),s.next([...o])):(o.push({text:g,participantInfo:d,streamInfo:l.info}),s.next([...o]))})}))},finalize:()=>{t.unregisterTextStreamHandler(e)}}),QA());return i.set(n,c),t.on(V.Disconnected,()=>{up().delete(n),o=[],s.next([])}),c}v.createContext(void 0);const jI=v.createContext(void 0);function Wb(){return v.useContext(jI)}function qb(t){const e=Wb(),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 LI=v.createContext(void 0);function Kb(){return v.useContext(LI)}const da=v.createContext(void 0);function Bs(){const t=v.useContext(da);if(!t)throw Error("tried to access room context outside of livekit room component");return t}function Gb(){return v.useContext(da)}function $s(t){const e=Gb(),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 Zb(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=Zb(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Yb(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Zb(t))&&(i&&(i+=" "),i+=e);return i}function VI(...t){return(...e)=>{for(const n of t)if(typeof n=="function")try{n(...e)}catch(i){console.error(i)}}}function Jb(...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]=VI(s,o):(r==="className"||r==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[r]=Yb(s,o):e[r]=o!==void 0?o:s}}return e}function FI(t){return t!==void 0}function Xb(...t){return Jb(...t.filter(FI))}function UI(t,e,n){return v.Children.map(t,i=>v.isValidElement(i)&&v.Children.only(t)?(i.props.className&&(e??(e={}),e.className=Yb(i.props.className,e.className),e.style={...i.props.style,...e.style}),v.cloneElement(i,{...e,key:n})):i)}function ri(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 Qu(t){const e=$s(t),n=v.useMemo(()=>gI(e),[e]);return ri(n,e.state)}function BI(t={}){const e=$s(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),[h,p]=v.useState(n.lastCameraError),[g,f]=v.useState(void 0),[y,b]=v.useState(void 0),w=k=>{a(k.isCameraEnabled),s(k.isMicrophoneEnabled),l(k.isScreenShareEnabled),b(k.cameraTrack),f(k.microphoneTrack),u(k.participant.lastMicrophoneError),p(k.participant.lastCameraError),i(k.participant)};return v.useEffect(()=>{const k=Bb(e.localParticipant).subscribe(w);return()=>k.unsubscribe()},[e]),{isMicrophoneEnabled:r,isScreenShareEnabled:c,isCameraEnabled:o,microphoneTrack:g,cameraTrack:y,lastMicrophoneError:d,lastCameraError:h,localParticipant:n}}function Qb(t={}){const e=$s(t.room),[n,i]=v.useState([]);return v.useEffect(()=>{const r=xI(e,{additionalRoomEvents:t.updateOnlyOn}).subscribe(i);return()=>r.unsubscribe()},[e,JSON.stringify(t.updateOnlyOn)]),n}function $I({room:t,props:e}){const n=$s(t),{className:i,roomAudioPlaybackAllowedObservable:r,handleStartAudioPlayback:s}=v.useMemo(()=>PI(),[]),o=v.useMemo(()=>r(n),[n,r]),{canPlayAudio:a}=ri(o,{canPlayAudio:n.canPlaybackAudio});return{mergedProps:v.useMemo(()=>Jb(e,{className:i,onClick:()=>{s(n)},style:{display:a?"none":"block"}}),[e,i,a,s,n]),canPlayAudio:a}}function eh(t=[D.Source.Camera,D.Source.Microphone,D.Source.ScreenShare,D.Source.ScreenShareAudio,D.Source.Unknown],e={}){const n=$s(e.room),[i,r]=v.useState([]),[s,o]=v.useState([]),a=v.useMemo(()=>t.map(c=>jb(c)?c.source:c),[JSON.stringify(t)]);return v.useEffect(()=>{const c=RI(n,a,{additionalRoomEvents:e.updateOnlyOn,onlySubscribed:e.onlySubscribed}).subscribe(({trackReferences:l,participants:d})=>{pn.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(Lb(t)){const c=zI(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;pn.debug(`Add ${u} placeholder for participant ${d.identity}.`);const h={participant:d,source:u};l.push(h)})}),l}else return i},[i,s,t])}function HI(t,e){const n=new Set(t);for(const i of e)n.delete(i);return n}function zI(t,e){const n=new Map;if(Lb(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(HI(new Set(i),new Set(s)));o.length>0&&n.set(r.identity,o)})}return n}function WI(t){const e=Bs(),n=Qu(e),i=v.useMemo(()=>n===he.Disconnected,[n]),r=v.useMemo(()=>EI(e),[e,t,i]),s=ri(r.isSendingObservable,!1),o=ri(r.messageObservable,[]);return{send:r.send,chatMessages:o,isSending:s}}const qI=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))},KI={bands:5,loPass:100,hiPass:600,updateInterval:32,analyserOptions:{fftSize:2048}};function GI(t,e={}){var n;const i=t instanceof D?t:(n=t==null?void 0:t.publication)==null?void 0:n.track,r={...KI,...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}=dC(i,r.analyserOptions),l=a.frequencyBinCount,d=new Float32Array(l),u=setInterval(()=>{a.getFloatFrequencyData(d);let h=new Float32Array(d.length);for(let y=0;y<d.length;y++)h[y]=d[y];h=h.slice(e.loPass,e.hiPass);const p=qI(h),g=Math.ceil(p.length/r.bands),f=[];for(let y=0;y<r.bands;y++){const b=p.slice(y*g,(y+1)*g).reduce((w,k)=>w+=k,0);f.push(b/g)}o(f)},r.updateInterval);return()=>{c(),clearInterval(u)}},[i,i==null?void 0:i.mediaStream,JSON.stringify(e)]),s}function hp(t,e){const n=Kb(),i=Qb({updateOnlyOn:[]}),r=v.useMemo(()=>e?i.find(o=>o.identity===e):n,[e,i,n]),s=v.useMemo(()=>{if(r)return AI(r,{sources:t})},[r,JSON.stringify(t)]);return ri(s,[])}function ZI(t){var e,n,i;const r=v.useMemo(()=>{var s;return(s=t==null?void 0:t.publication)!=null&&s.track?MI(t==null?void 0:t.publication.track):void 0},[(e=t==null?void 0:t.publication)==null?void 0:e.track]);return ri(r,{timestamp:Date.now(),rtpTimestamp:(i=(n=t==null?void 0:t.publication)==null?void 0:n.track)==null?void 0:i.rtpTimestamp})}const YI={bufferSize:100};function JI(t,e){const n={...YI,...e},[i,r]=v.useState([]),s=ZI(t),o=a=>{var c;(c=n.onTranscription)==null||c.call(n,a),r(l=>mI(l,a.map(d=>fI(d,s)),n.bufferSize))};return v.useEffect(()=>{if(!(t!=null&&t.publication))return;const a=II(t.publication).subscribe(c=>{o(...c)});return()=>{a.unsubscribe()}},[t&&Ob(t),o]),{segments:i}}function XI(t={}){const e=Kb(),n=t.participant??e,i=v.useMemo(()=>cp(n),[n]);return ri(i,{attributes:n==null?void 0:n.attributes})}const fp="lk.agent.state";function e1(){const t=Qb(),e=t.find(u=>u.kind===Oi.AGENT&&!("lk.publish_on_behalf"in u.attributes)),n=t.find(u=>u.kind===Oi.AGENT&&u.attributes["lk.publish_on_behalf"]===(e==null?void 0:e.identity)),i=hp([D.Source.Microphone,D.Source.Camera],e==null?void 0:e.identity),r=hp([D.Source.Microphone,D.Source.Camera],n==null?void 0:n.identity),s=i.find(u=>u.source===D.Source.Microphone)??r.find(u=>u.source===D.Source.Microphone),o=i.find(u=>u.source===D.Source.Camera)??r.find(u=>u.source===D.Source.Camera),{segments:a}=JI(s),c=Qu(),{attributes:l}=XI({participant:e}),d=v.useMemo(()=>c===he.Disconnected?"disconnected":c===he.Connecting||!e||!(l!=null&&l[fp])?"connecting":l[fp],[l,e,c]);return{agent:e,state:d,audioTrack:s,videoTrack:o,agentTranscriptions:a,agentAttributes:l}}function QI(t){const e=Bs(),n=Qu(e)===he.Disconnected,i=v.useMemo(()=>DI(e,t),[e,t]);return{textStreams:ri(n?void 0:i,[])}}function eM(t){const{participantIdentities:e,trackSids:n}={},{textStreams:i}=QI($b.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 mp=v.forwardRef(function({label:t="Allow Audio",...e},n){const i=Bs(),{mergedProps:r}=$I({room:i,props:e});return v.createElement("button",{ref:n,...r},t)});function t1(t,e={}){const[n,i]=v.useState(Sd(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"),h=v.useRef(),{className:p,trackObserver:g}=v.useMemo(()=>pI(t),[t.participant.sid??t.participant.identity,t.source,Ju(t)&&t.publication.trackSid]);return v.useEffect(()=>{const f=g.subscribe(y=>{pn.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()=>f==null?void 0:f.unsubscribe()},[g]),v.useEffect(()=>{var f,y;return c&&(h.current&&c.detach(h.current),(f=e.element)!=null&&f.current&&!(t.participant.isLocal&&(c==null?void 0:c.kind)==="audio")&&c.attach(e.element.current)),h.current=(y=e.element)==null?void 0:y.current,()=>{h.current&&(c==null||c.detach(h.current))}},[c,e.element]),v.useEffect(()=>{var f,y;if(typeof((f=n==null?void 0:n.dimensions)==null?void 0:f.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:Xb(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 Hc,pp;function tM(){if(pp)return Hc;pp=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 no=="object"&&no&&no.Object===Object&&no,l=typeof self=="object"&&self&&self.Object===Object&&self,d=c||l||Function("return this")(),u=Object.prototype,h=u.toString,p=Math.max,g=Math.min,f=function(){return d.Date.now()};function y(x,T,E){var P,M,C,I,N,Z,Q=0,se=!1,te=!1,Y=!0;if(typeof x!="function")throw new TypeError(t);T=S(T)||0,b(E)&&(se=!!E.leading,te="maxWait"in E,C=te?p(S(E.maxWait)||0,T):C,Y="trailing"in E?!!E.trailing:Y);function _(O){var $=P,X=M;return P=M=void 0,Q=O,I=x.apply(X,$),I}function ie(O){return Q=O,N=setTimeout(ee,T),se?_(O):I}function L(O){var $=O-Z,X=O-Q,z=T-$;return te?g(z,C-X):z}function F(O){var $=O-Z,X=O-Q;return Z===void 0||$>=T||$<0||te&&X>=C}function ee(){var O=f();if(F(O))return j(O);N=setTimeout(ee,L(O))}function j(O){return N=void 0,Y&&P?_(O):(P=M=void 0,I)}function W(){N!==void 0&&clearTimeout(N),Q=0,P=Z=M=N=void 0}function J(){return N===void 0?I:j(f())}function K(){var O=f(),$=F(O);if(P=arguments,M=this,Z=O,$){if(N===void 0)return ie(Z);if(te)return N=setTimeout(ee,T),_(Z)}return N===void 0&&(N=setTimeout(ee,T)),I}return K.cancel=W,K.flush=J,K}function b(x){var T=typeof x;return!!x&&(T=="object"||T=="function")}function w(x){return!!x&&typeof x=="object"}function k(x){return typeof x=="symbol"||w(x)&&h.call(x)==n}function S(x){if(typeof x=="number")return x;if(k(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 Hc=y,Hc}var nM=tM();const gp=fb(nM);function iM(t){const e=R.useRef(t);e.current=t,R.useEffect(()=>()=>{e.current()},[])}function rM(t,e=500,n){const i=R.useRef();iM(()=>{i.current&&i.current.cancel()});const r=R.useMemo(()=>{const s=gp(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=gp(t,e,n)},[t,e,n]),r}function sM(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=rM(o,e,n);return i(a.current,r)||(c(r),a.current=r),[s,c]}function oM({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 h=((o=l.entry)==null?void 0:o.isIntersecting)&&i;R.useEffect(()=>{if(!a||!("IntersectionObserver"in window)||h)return;const f=new IntersectionObserver(y=>{const b=Array.isArray(f.thresholds)?f.thresholds:[f.thresholds];y.forEach(w=>{const k=w.isIntersecting&&b.some(S=>w.intersectionRatio>=S);d({isIntersecting:k,entry:w}),u.current&&u.current(k,w)})},{threshold:t,root:e,rootMargin:n});return f.observe(a),()=>{f.disconnect()}},[a,JSON.stringify(t),e,n,h,i]);const p=R.useRef(null);R.useEffect(()=>{var f;!a&&(f=l.entry)!=null&&f.target&&!i&&!h&&p.current!==l.entry.target&&(p.current=l.entry.target,d({isIntersecting:r,entry:void 0}))},[a,l.entry,i,h,r]);const g=[c,!!l.isIntersecting,l.entry];return g.ref=g[0],g.isIntersecting=g[1],g.entry=g[2],g}const th=v.forwardRef(function({onTrackClick:t,onClick:e,onSubscriptionStatusChanged:n,trackRef:i,manageSubscription:r,...s},o){const a=qb(i),c=v.useRef(null);v.useImperativeHandle(o,()=>c.current);const l=oM({root:c.current}),[d]=sM(l,3e3);v.useEffect(()=>{r&&a.publication instanceof na&&(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 na&&(l==null?void 0:l.isIntersecting)===!0&&a.publication.setSubscribed(!0)},[l,a,r]);const{elementProps:u,publication:h,isSubscribed:p}=t1(a,{element:c,props:s});v.useEffect(()=>{n==null||n(!!p)},[p,n]);const g=f=>{e==null||e(f),t==null||t({participant:a==null?void 0:a.participant,track:h})};return v.createElement("video",{ref:c,...u,muted:!0,onClick:g})}),aM=v.forwardRef(function({trackRef:t,onSubscriptionStatusChanged:e,volume:n,...i},r){const s=qb(t),o=v.useRef(null);v.useImperativeHandle(r,()=>o.current);const{elementProps:a,isSubscribed:c,track:l,publication:d}=t1(s,{element:o,props:i});return v.useEffect(()=>{e==null||e(!!c)},[c,e]),v.useEffect(()=>{l===void 0||n===void 0||(l instanceof Nv?l.setVolume(n):pn.warn("Volume can only be set on remote audio tracks."))},[n,l]),v.useEffect(()=>{d===void 0||i.muted===void 0||(d instanceof na?d.setEnabled(!i.muted):pn.warn("Can only call setEnabled on remote track publications."))},[i.muted,d,l]),v.createElement("audio",{ref:o,...a})});function vp({volume:t,muted:e}){const n=eh([D.Source.Microphone,D.Source.ScreenShareAudio,D.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0}).filter(i=>!i.participant.isLocal&&i.publication.kind===D.Kind.Audio);return v.createElement("div",{style:{display:"none"}},n.map(i=>v.createElement(aM,{key:Ob(i),trackRef:i,volume:t,muted:e})))}const cM=t=>{const e=[];for(let n=0;n<t;n++)e.push([n,t-1-n]);return e},yp=t=>[[Math.floor(t/2)],[-1]],lM=(t,e,n)=>{const[i,r]=R.useState(0),[s,o]=R.useState([[]]);R.useEffect(()=>{if(t==="thinking")o(yp(e));else if(t==="connecting"||t==="initializing"){const c=[...cM(e)];o(c)}else o(t==="listening"?yp(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]},dM=new Map([["connecting",2e3],["initializing",2e3],["listening",500],["thinking",150]]),uM=(t,e)=>{if(t===void 0)return 1e3;let n=dM.get(t);if(n)switch(t){case"connecting":n/=e;break}return n},n1=v.forwardRef(function({state:t,options:e,barCount:n=15,trackRef:i,children:r,...s},o){const a=Xb(s,{className:"lk-audio-bar-visualizer"});let c=Wb();i&&(c=i);const l=GI(c,{bands:n,loPass:100,hiPass:200}),d=(e==null?void 0:e.minHeight)??20,u=(e==null?void 0:e.maxHeight)??100,h=lM(t,n,uM(t,n)??100);return v.createElement("div",{ref:o,...a,"data-lk-va-state":t},l.map((p,g)=>r?UI(r,{"data-lk-highlighted":h.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":h.includes(g),"data-lk-bar-index":g,className:`lk-audio-bar ${h.includes(g)&&"lk-highlighted"}`,style:{height:`${Math.min(u,Math.max(d,p*100+5))}%`}})))});function hM(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 wd=1;class fM{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:wd++,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(pM(l)&&!l.ok){s=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${l.status}`):n.error,h=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:h,...g})}else if(l instanceof Error){s=!1;const u=typeof n.error=="function"?await n.error(l):n.error,h=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:h,...g})}else if(n.success!==void 0){s=!1;const u=typeof n.success=="function"?await n.success(l):n.success,h=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:h,...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)||wd++;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 _t=new fM,mM=(t,e)=>{const n=(e==null?void 0:e.id)||wd++;return _t.addToast({title:t,...e,id:n}),n},pM=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",gM=mM,vM=()=>_t.toasts,yM=()=>_t.getActiveToasts(),i1=Object.assign(gM,{success:_t.success,info:_t.info,warning:_t.warning,error:_t.error,custom:_t.custom,message:_t.message,promise:_t.promise,dismiss:_t.dismiss,loading:_t.loading},{getHistory:vM,getToasts:yM});hM("[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 Xt=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))});Xt.displayName="SSRBase";const bM=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"}))]]),nh=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:bM}));nh.displayName="CaretDownIcon";const xM=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"}))]]),r1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:xM}));r1.displayName="CaretUpIcon";const SM=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"}))]]),s1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:SM}));s1.displayName="ChatTextIcon";const wM=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"}))]]),o1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:wM}));o1.displayName="CheckIcon";const kM=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"}))]]),a1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:kM}));a1.displayName="MicrophoneIcon";const CM=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"}))]]),c1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:CM}));c1.displayName="MicrophoneSlashIcon";const TM=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"}))]]),l1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:TM}));l1.displayName="MonitorArrowUpIcon";const EM=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"}))]]),ih=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:EM}));ih.displayName="SpinnerIcon";const PM=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"}))]]),d1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:PM}));d1.displayName="VideoCameraIcon";const RM=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"}))]]),u1=v.forwardRef((t,e)=>v.createElement(Xt,{ref:e,...t,weights:RM}));u1.displayName="VideoCameraSlashIcon";const AM=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"}))]]),IM=R.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),h1=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:h="regular",mirrored:p=!1,...g}=v.useContext(IM);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??h))});h1.displayName="IconBase";const f1=v.forwardRef((t,e)=>v.createElement(h1,{ref:e,...t,weights:AM}));f1.displayName="WarningIcon";function m1(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=m1(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Na(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=m1(t))&&(i&&(i+=" "),i+=e);return i}const bp=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,xp=Na,_a=(t,e)=>n=>{var i;if((e==null?void 0:e.variants)==null)return xp(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 h=bp(d)||bp(u);return r[l][h]}),a=n&&Object.entries(n).reduce((l,d)=>{let[u,h]=d;return h===void 0||(l[u]=h),l},{}),c=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((l,d)=>{let{class:u,className:h,...p}=d;return Object.entries(p).every(g=>{let[f,y]=g;return Array.isArray(y)?y.includes({...s,...a}[f]):{...s,...a}[f]===y})?[...l,u,h]:l},[]);return xp(t,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},rh="-",MM=t=>{const e=_M(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o=>{const a=o.split(rh);return a[0]===""&&a.length!==1&&a.shift(),p1(a,e)||NM(o)},getConflictingClassGroupIds:(o,a)=>{const c=n[o]||[];return a&&i[o]?[...c,...i[o]]:c}}},p1=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],i=e.nextPart.get(n),r=i?p1(t.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=t.join(rh);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},Sp=/^\[(.+)\]$/,NM=t=>{if(Sp.test(t)){const e=Sp.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},_M=t=>{const{theme:e,classGroups:n}=t,i={nextPart:new Map,validators:[]};for(const r in n)kd(n[r],i,r,e);return i},kd=(t,e,n,i)=>{t.forEach(r=>{if(typeof r=="string"){const s=r===""?e:wp(e,r);s.classGroupId=n;return}if(typeof r=="function"){if(OM(r)){kd(r(i),e,n,i);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,o])=>{kd(o,wp(e,s),n,i)})})},wp=(t,e)=>{let n=t;return e.split(rh).forEach(i=>{n.nextPart.has(i)||n.nextPart.set(i,{nextPart:new Map,validators:[]}),n=n.nextPart.get(i)}),n},OM=t=>t.isThemeGetter,DM=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)}}},Cd="!",Td=":",jM=Td.length,LM=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 f=r[g];if(o===0&&a===0){if(f===Td){s.push(r.slice(c,g)),c=g+jM;continue}if(f==="/"){l=g;continue}}f==="["?o++:f==="]"?o--:f==="("?a++:f===")"&&a--}const d=s.length===0?r:r.substring(c),u=VM(d),h=u!==d,p=l&&l>c?l-c:void 0;return{modifiers:s,hasImportantModifier:h,baseClassName:u,maybePostfixModifierPosition:p}};if(e){const r=e+Td,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},VM=t=>t.endsWith(Cd)?t.substring(0,t.length-1):t.startsWith(Cd)?t.substring(1):t,FM=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}},UM=t=>({cache:DM(t.cacheSize),parseClassName:LM(t),sortModifiers:FM(t),...MM(t)}),BM=/\s+/,$M=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:s}=e,o=[],a=t.trim().split(BM);let c="";for(let l=a.length-1;l>=0;l-=1){const d=a[l],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:f}=n(d);if(u){c=d+(c.length>0?" "+c:c);continue}let y=!!f,b=i(y?g.substring(0,f):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(h).join(":"),k=p?w+Cd:w,S=k+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(k+E)}c=d+(c.length>0?" "+c:c)}return c};function HM(){let t=0,e,n,i="";for(;t<arguments.length;)(e=arguments[t++])&&(n=g1(e))&&(i&&(i+=" "),i+=n);return i}const g1=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=g1(t[i]))&&(n&&(n+=" "),n+=e);return n};function zM(t,...e){let n,i,r,s=o;function o(c){const l=e.reduce((d,u)=>u(d),t());return n=UM(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=$M(c,n);return r(c,d),d}return function(){return s(HM.apply(null,arguments))}}const tt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},v1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,y1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,WM=/^\d+\/\d+$/,qM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,KM=/\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$/,GM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ZM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ki=t=>WM.test(t),fe=t=>!!t&&!Number.isNaN(Number(t)),Hn=t=>!!t&&Number.isInteger(Number(t)),zc=t=>t.endsWith("%")&&fe(t.slice(0,-1)),Sn=t=>qM.test(t),JM=()=>!0,XM=t=>KM.test(t)&&!GM.test(t),b1=()=>!1,QM=t=>ZM.test(t),e4=t=>YM.test(t),t4=t=>!ae(t)&&!ce(t),n4=t=>Br(t,w1,b1),ae=t=>v1.test(t),xi=t=>Br(t,k1,XM),Wc=t=>Br(t,a4,fe),kp=t=>Br(t,x1,b1),i4=t=>Br(t,S1,e4),so=t=>Br(t,C1,QM),ce=t=>y1.test(t),ts=t=>$r(t,k1),r4=t=>$r(t,c4),Cp=t=>$r(t,x1),s4=t=>$r(t,w1),o4=t=>$r(t,S1),oo=t=>$r(t,C1,!0),Br=(t,e,n)=>{const i=v1.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},$r=(t,e,n=!1)=>{const i=y1.exec(t);return i?i[1]?e(i[1]):n:!1},x1=t=>t==="position"||t==="percentage",S1=t=>t==="image"||t==="url",w1=t=>t==="length"||t==="size"||t==="bg-size",k1=t=>t==="length",a4=t=>t==="number",c4=t=>t==="family-name",C1=t=>t==="shadow",l4=()=>{const t=tt("color"),e=tt("font"),n=tt("text"),i=tt("font-weight"),r=tt("tracking"),s=tt("leading"),o=tt("breakpoint"),a=tt("container"),c=tt("spacing"),l=tt("radius"),d=tt("shadow"),u=tt("inset-shadow"),h=tt("text-shadow"),p=tt("drop-shadow"),g=tt("blur"),f=tt("perspective"),y=tt("aspect"),b=tt("ease"),w=tt("animate"),k=()=>["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(),ce,ae],T=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],P=()=>[ce,ae,c],M=()=>[Ki,"full","auto",...P()],C=()=>[Hn,"none","subgrid",ce,ae],I=()=>["auto",{span:["full",Hn,ce,ae]},Hn,ce,ae],N=()=>[Hn,"auto",ce,ae],Z=()=>["auto","min","max","fr",ce,ae],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],se=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...P()],Y=()=>[Ki,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],_=()=>[t,ce,ae],ie=()=>[...S(),Cp,kp,{position:[ce,ae]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",s4,n4,{size:[ce,ae]}],ee=()=>[zc,ts,xi],j=()=>["","none","full",l,ce,ae],W=()=>["",fe,ts,xi],J=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[fe,zc,Cp,kp],$=()=>["","none",g,ce,ae],X=()=>["none",fe,ce,ae],z=()=>["none",fe,ce,ae],oe=()=>[fe,ce,ae],H=()=>[Ki,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Sn],breakpoint:[Sn],color:[JM],container:[Sn],"drop-shadow":[Sn],ease:["in","out","in-out"],font:[t4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Sn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Sn],shadow:[Sn],spacing:["px",fe],text:[Sn],"text-shadow":[Sn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ki,ae,ce,y]}],container:["container"],columns:[{columns:[fe,ae,ce,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Hn,"auto",ce,ae]}],basis:[{basis:[Ki,"full","auto",a,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[fe,Ki,"auto","initial","none",ae]}],grow:[{grow:["",fe,ce,ae]}],shrink:[{shrink:["",fe,ce,ae]}],order:[{order:[Hn,"first","last","none",ce,ae]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":C()}],"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":Z()}],"auto-rows":[{"auto-rows":Z()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...se(),"normal"]}],"justify-self":[{"justify-self":["auto",...se()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...se(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"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:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[a,"screen",...Y()]}],"min-w":[{"min-w":[a,"screen","none",...Y()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,ts,xi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ce,Wc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zc,ae]}],"font-family":[{font:[r4,ae,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,ce,ae]}],"line-clamp":[{"line-clamp":[fe,"none",ce,Wc]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",ce,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[fe,"from-font","auto",ce,xi]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[fe,"auto",ce,ae]}],"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",ce,ae]}],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",ce,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hn,ce,ae],radial:["",ce,ae],conic:[Hn,ce,ae]},o4,i4]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],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:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[fe,ce,ae]}],"outline-w":[{outline:["",fe,ts,xi]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,oo,so]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,oo,so]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[fe,xi]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",h,oo,so]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[fe,ce,ae]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"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":[fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[ce,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":[fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,ae]}],filter:[{filter:["","none",ce,ae]}],blur:[{blur:$()}],brightness:[{brightness:[fe,ce,ae]}],contrast:[{contrast:[fe,ce,ae]}],"drop-shadow":[{"drop-shadow":["","none",p,oo,so]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",fe,ce,ae]}],"hue-rotate":[{"hue-rotate":[fe,ce,ae]}],invert:[{invert:["",fe,ce,ae]}],saturate:[{saturate:[fe,ce,ae]}],sepia:[{sepia:["",fe,ce,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,ae]}],"backdrop-blur":[{"backdrop-blur":$()}],"backdrop-brightness":[{"backdrop-brightness":[fe,ce,ae]}],"backdrop-contrast":[{"backdrop-contrast":[fe,ce,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",fe,ce,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[fe,ce,ae]}],"backdrop-invert":[{"backdrop-invert":["",fe,ce,ae]}],"backdrop-opacity":[{"backdrop-opacity":[fe,ce,ae]}],"backdrop-saturate":[{"backdrop-saturate":[fe,ce,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",fe,ce,ae]}],"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",ce,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[fe,"initial",ce,ae]}],ease:[{ease:["linear","initial",b,ce,ae]}],delay:[{delay:[fe,ce,ae]}],animate:[{animate:["none",w,ce,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,ce,ae]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:z()}],"scale-x":[{"scale-x":z()}],"scale-y":[{"scale-y":z()}],"scale-z":[{"scale-z":z()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[ce,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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",ce,ae]}],"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",ce,ae]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[fe,ts,xi,Wc]}],stroke:[{stroke:["none",..._()]}],"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"]}},d4=zM(l4);function le(...t){return d4(Na(t))}function u4(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 h4=_a(["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 f4({className:t,variant:e,...n}){return m.jsx("div",{"data-slot":"alert",role:"alert",className:le(h4({variant:e}),t),...n})}function m4({className:t,...e}){return m.jsx("div",{"data-slot":"alert-title",className:le("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...e})}function p4({className:t,...e}){return m.jsx("div",{"data-slot":"alert-description",className:le("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...e})}function ao(t){return i1.custom(e=>m.jsx(g4,{id:e,title:t.title,description:t.description}),{duration:1e4})}function g4(t){const{title:e,id:n,description:i}=t;return m.jsxs(f4,{onClick:()=>i1.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(f1,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),m.jsxs("div",{className:"flex flex-col",children:[m.jsx(m4,{className:"text-base font-semibold text-white mb-1",children:e}),m.jsx(p4,{className:"text-sm text-gray-300 leading-snug",children:i})]})]})}function Tp(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function T1(...t){return e=>{let n=!1;const i=t.map(r=>{const s=Tp(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():Tp(t[r],null)}}}}function dt(...t){return v.useCallback(T1(...t),t)}function As(t){const e=y4(t),n=v.forwardRef((i,r)=>{const{children:s,...o}=i,a=v.Children.toArray(s),c=a.find(x4);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 v4=As("Slot");function y4(t){const e=v.forwardRef((n,i)=>{const{children:r,...s}=n;if(v.isValidElement(r)){const o=w4(r),a=S4(s,r.props);return r.type!==v.Fragment&&(a.ref=i?T1(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 b4=Symbol("radix.slottable");function x4(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===b4}function S4(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 w4(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 k4=_a(["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 C4({className:t,variant:e,size:n,asChild:i=!1,...r}){const s=i?v4:"button";return m.jsx(s,{"data-slot":"button",className:le(k4({variant:e,size:n,className:t})),...r})}function T4({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:le("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(C4,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}function Ke(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 wt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},E4=v[" useInsertionEffect ".trim().toString()]||wt;function Ed({prop:t,defaultProp:e,onChange:n=()=>{},caller:i}){const[r,s,o]=P4({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 h=R4(d)?d(t):d;h!==t&&((u=o.current)==null||u.call(o,h))}else s(d)},[a,t,s,o]);return[c,l]}function P4({defaultProp:t,onChange:e}){const[n,i]=v.useState(t),r=v.useRef(n),s=v.useRef(e);return E4(()=>{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 R4(t){return typeof t=="function"}var A4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=A4.reduce((t,e)=>{const n=As(`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 I4(t,e){t&&xa.flushSync(()=>t.dispatchEvent(e))}var E1="Toggle",P1=v.forwardRef((t,e)=>{const{pressed:n,defaultPressed:i,onPressedChange:r,...s}=t,[o,a]=Ed({prop:n,onChange:r,defaultProp:i??!1,caller:E1});return m.jsx(We.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:Ke(t.onClick,()=>{t.disabled||a(!o)})})});P1.displayName=E1;var M4=P1;const N4=_a(["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 R1({className:t,variant:e,size:n,...i}){return m.jsx(M4,{"data-slot":"toggle",className:le(N4({variant:e,size:n,className:t})),...i})}function _4(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 O4(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 qc(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 D4(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 j4(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 L4(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 Ep(t,[e,n]){return Math.min(n,Math.max(e,t))}function sh(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:h,children:p,...g}=u,f=((b=h==null?void 0:h[t])==null?void 0:b[c])||a,y=v.useMemo(()=>g,Object.values(g));return m.jsx(f.Provider,{value:y,children:p})};l.displayName=s+"Provider";function d(u,h){var f;const p=((f=h==null?void 0:h[t])==null?void 0:f[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,V4(r,...e)]}function V4(...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 F4(t){const e=t+"CollectionProvider",[n,i]=sh(e),[r,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=f=>{const{scope:y,children:b}=f,w=R.useRef(null),k=R.useRef(new Map).current;return m.jsx(r,{scope:y,itemMap:k,collectionRef:w,children:b})};o.displayName=e;const a=t+"CollectionSlot",c=As(a),l=R.forwardRef((f,y)=>{const{scope:b,children:w}=f,k=s(a,b),S=dt(y,k.collectionRef);return m.jsx(c,{ref:S,children:w})});l.displayName=a;const d=t+"CollectionItemSlot",u="data-radix-collection-item",h=As(d),p=R.forwardRef((f,y)=>{const{scope:b,children:w,...k}=f,S=R.useRef(null),x=dt(y,S),T=s(d,b);return R.useEffect(()=>(T.itemMap.set(S,{ref:S,...k}),()=>void T.itemMap.delete(S))),m.jsx(h,{[u]:"",ref:x,children:w})});p.displayName=d;function g(f){const y=s(t+"CollectionConsumer",f);return R.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const k=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,E)=>k.indexOf(T.ref.current)-k.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},g,i]}var U4=v.createContext(void 0);function B4(t){const e=v.useContext(U4);return t||e||"ltr"}function Li(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 $4(t,e=globalThis==null?void 0:globalThis.document){const n=Li(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 H4="DismissableLayer",Pd="dismissableLayer.update",z4="dismissableLayer.pointerDownOutside",W4="dismissableLayer.focusOutside",Pp,A1=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I1=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=v.useContext(A1),[d,u]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=dt(e,E=>u(E)),f=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=f.indexOf(y),w=d?f.indexOf(d):-1,k=l.layersWithOutsidePointerEventsDisabled.size>0,S=w>=b,x=G4(E=>{const P=E.target,M=[...l.branches].some(C=>C.contains(P));!S||M||(r==null||r(E),o==null||o(E),E.defaultPrevented||a==null||a())},h),T=Z4(E=>{const P=E.target;[...l.branches].some(C=>C.contains(P))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},h);return $4(E=>{w===l.layers.size-1&&(i==null||i(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},h),v.useEffect(()=>{if(d)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Pp=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),Rp(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Pp)}},[d,h,n,l]),v.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),Rp())},[d,l]),v.useEffect(()=>{const E=()=>p({});return document.addEventListener(Pd,E),()=>document.removeEventListener(Pd,E)},[]),m.jsx(We.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...t.style},onFocusCapture:Ke(t.onFocusCapture,T.onFocusCapture),onBlurCapture:Ke(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ke(t.onPointerDownCapture,x.onPointerDownCapture)})});I1.displayName=H4;var q4="DismissableLayerBranch",K4=v.forwardRef((t,e)=>{const n=v.useContext(A1),i=v.useRef(null),r=dt(e,i);return v.useEffect(()=>{const s=i.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(We.div,{...t,ref:r})});K4.displayName=q4;function G4(t,e=globalThis==null?void 0:globalThis.document){const n=Li(t),i=v.useRef(!1),r=v.useRef(()=>{});return v.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let c=function(){M1(z4,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 Z4(t,e=globalThis==null?void 0:globalThis.document){const n=Li(t),i=v.useRef(!1);return v.useEffect(()=>{const r=s=>{s.target&&!i.current&&M1(W4,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 Rp(){const t=new CustomEvent(Pd);document.dispatchEvent(t)}function M1(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?I4(r,s):r.dispatchEvent(s)}var Kc=0;function Y4(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Ap()),document.body.insertAdjacentElement("beforeend",t[1]??Ap()),Kc++,()=>{Kc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Kc--}},[])}function Ap(){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 Gc="focusScope.autoFocusOnMount",Zc="focusScope.autoFocusOnUnmount",Ip={bubbles:!1,cancelable:!0},J4="FocusScope",N1=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=t,[a,c]=v.useState(null),l=Li(r),d=Li(s),u=v.useRef(null),h=dt(e,f=>c(f)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(i){let f=function(k){if(p.paused||!a)return;const S=k.target;a.contains(S)?u.current=S:qn(u.current,{select:!0})},y=function(k){if(p.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||qn(u.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const x of k)x.removedNodes.length>0&&qn(a)};document.addEventListener("focusin",f),document.addEventListener("focusout",y);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",y),w.disconnect()}}},[i,a,p.paused]),v.useEffect(()=>{if(a){Np.add(p);const f=document.activeElement;if(!a.contains(f)){const b=new CustomEvent(Gc,Ip);a.addEventListener(Gc,l),a.dispatchEvent(b),b.defaultPrevented||(X4(iN(_1(a)),{select:!0}),document.activeElement===f&&qn(a))}return()=>{a.removeEventListener(Gc,l),setTimeout(()=>{const b=new CustomEvent(Zc,Ip);a.addEventListener(Zc,d),a.dispatchEvent(b),b.defaultPrevented||qn(f??document.body,{select:!0}),a.removeEventListener(Zc,d),Np.remove(p)},0)}}},[a,l,d,p]);const g=v.useCallback(f=>{if(!n&&!i||p.paused)return;const y=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(y&&b){const w=f.currentTarget,[k,S]=Q4(w);k&&S?!f.shiftKey&&b===S?(f.preventDefault(),n&&qn(k,{select:!0})):f.shiftKey&&b===k&&(f.preventDefault(),n&&qn(S,{select:!0})):b===w&&f.preventDefault()}},[n,i,p.paused]);return m.jsx(We.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});N1.displayName=J4;function X4(t,{select:e=!1}={}){const n=document.activeElement;for(const i of t)if(qn(i,{select:e}),document.activeElement!==n)return}function Q4(t){const e=_1(t),n=Mp(e,t),i=Mp(e.reverse(),t);return[n,i]}function _1(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 Mp(t,e){for(const n of t)if(!eN(n,{upTo:e}))return n}function eN(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 tN(t){return t instanceof HTMLInputElement&&"select"in t}function qn(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&tN(t)&&e&&t.select()}}var Np=nN();function nN(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=_p(t,e),t.unshift(e)},remove(e){var n;t=_p(t,e),(n=t[0])==null||n.resume()}}}function _p(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}function iN(t){return t.filter(e=>e.tagName!=="A")}var rN=v[" useId ".trim().toString()]||(()=>{}),sN=0;function oh(t){const[e,n]=v.useState(rN());return wt(()=>{n(i=>i??String(sN++))},[t]),t||(e?`radix-${e}`:"")}const oN=["top","right","bottom","left"],si=Math.min,Tt=Math.max,ua=Math.round,co=Math.floor,hn=t=>({x:t,y:t}),aN={left:"right",right:"left",bottom:"top",top:"bottom"},cN={start:"end",end:"start"};function Rd(t,e,n){return Tt(t,si(e,n))}function jn(t,e){return typeof t=="function"?t(e):t}function Ln(t){return t.split("-")[0]}function Hr(t){return t.split("-")[1]}function ah(t){return t==="x"?"y":"x"}function ch(t){return t==="y"?"height":"width"}const lN=new Set(["top","bottom"]);function cn(t){return lN.has(Ln(t))?"y":"x"}function lh(t){return ah(cn(t))}function dN(t,e,n){n===void 0&&(n=!1);const i=Hr(t),r=lh(t),s=ch(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ha(o)),[o,ha(o)]}function uN(t){const e=ha(t);return[Ad(t),e,Ad(e)]}function Ad(t){return t.replace(/start|end/g,e=>cN[e])}const Op=["left","right"],Dp=["right","left"],hN=["top","bottom"],fN=["bottom","top"];function mN(t,e,n){switch(t){case"top":case"bottom":return n?e?Dp:Op:e?Op:Dp;case"left":case"right":return e?hN:fN;default:return[]}}function pN(t,e,n,i){const r=Hr(t);let s=mN(Ln(t),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(Ad)))),s}function ha(t){return t.replace(/left|right|bottom|top/g,e=>aN[e])}function gN(t){return{top:0,right:0,bottom:0,left:0,...t}}function O1(t){return typeof t!="number"?gN(t):{top:t,right:t,bottom:t,left:t}}function fa(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 jp(t,e,n){let{reference:i,floating:r}=t;const s=cn(e),o=lh(e),a=ch(o),c=Ln(e),l=s==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,h=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(Hr(e)){case"start":p[o]-=h*(n&&l?-1:1);break;case"end":p[o]+=h*(n&&l?-1:1);break}return p}const vN=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}=jp(l,i,c),h=i,p={},g=0;for(let f=0;f<a.length;f++){const{name:y,fn:b}=a[f],{x:w,y:k,data:S,reset:x}=await b({x:d,y:u,initialPlacement:i,placement:h,strategy:r,middlewareData:p,rects:l,platform:o,elements:{reference:t,floating:e}});d=w??d,u=k??u,p={...p,[y]:{...p[y],...S}},x&&g<=50&&(g++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:r}):x.rects),{x:d,y:u}=jp(l,h,c)),f=-1)}return{x:d,y:u,placement:h,strategy:r,middlewareData:p}};async function Is(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:h=!1,padding:p=0}=jn(e,t),g=O1(p),y=a[h?u==="floating"?"reference":"floating":u],b=fa(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,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},x=fa(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:k,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 yN=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}=jn(t,e)||{};if(l==null)return{};const u=O1(d),h={x:n,y:i},p=lh(r),g=ch(p),f=await o.getDimensions(l),y=p==="y",b=y?"top":"left",w=y?"bottom":"right",k=y?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-h[p]-s.floating[g],x=h[p]-s.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let E=T?T[k]:0;(!E||!await(o.isElement==null?void 0:o.isElement(T)))&&(E=a.floating[k]||s.floating[g]);const P=S/2-x/2,M=E/2-f[g]/2-1,C=si(u[b],M),I=si(u[w],M),N=C,Z=E-f[g]-I,Q=E/2-f[g]/2+P,se=Rd(N,Q,Z),te=!c.arrow&&Hr(r)!=null&&Q!==se&&s.reference[g]/2-(Q<N?C:I)-f[g]/2<0,Y=te?Q<N?Q-N:Q-Z:0;return{[p]:h[p]+Y,data:{[p]:se,centerOffset:Q-se-Y,...te&&{alignmentOffset:Y}},reset:te}}}),bN=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:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0,...y}=jn(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Ln(r),w=cn(a),k=Ln(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=h||(k||!f?[ha(a)]:uN(a)),T=g!=="none";!h&&T&&x.push(...pN(a,f,g,S));const E=[a,...x],P=await Is(e,y),M=[];let C=((i=s.flip)==null?void 0:i.overflows)||[];if(d&&M.push(P[b]),u){const Q=dN(r,o,S);M.push(P[Q[0]],P[Q[1]])}if(C=[...C,{placement:r,overflows:M}],!M.every(Q=>Q<=0)){var I,N;const Q=(((I=s.flip)==null?void 0:I.index)||0)+1,se=E[Q];if(se&&(!(u==="alignment"?w!==cn(se):!1)||C.every(_=>_.overflows[0]>0&&cn(_.placement)===w)))return{data:{index:Q,overflows:C},reset:{placement:se}};let te=(N=C.filter(Y=>Y.overflows[0]<=0).sort((Y,_)=>Y.overflows[1]-_.overflows[1])[0])==null?void 0:N.placement;if(!te)switch(p){case"bestFit":{var Z;const Y=(Z=C.filter(_=>{if(T){const ie=cn(_.placement);return ie===w||ie==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(ie=>ie>0).reduce((ie,L)=>ie+L,0)]).sort((_,ie)=>_[1]-ie[1])[0])==null?void 0:Z[0];Y&&(te=Y);break}case"initialPlacement":te=a;break}if(r!==te)return{reset:{placement:te}}}return{}}}};function Lp(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Vp(t){return oN.some(e=>t[e]>=0)}const xN=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:i="referenceHidden",...r}=jn(t,e);switch(i){case"referenceHidden":{const s=await Is(e,{...r,elementContext:"reference"}),o=Lp(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Vp(o)}}}case"escaped":{const s=await Is(e,{...r,altBoundary:!0}),o=Lp(s,n.floating);return{data:{escapedOffsets:o,escaped:Vp(o)}}}default:return{}}}}},D1=new Set(["left","top"]);async function SN(t,e){const{placement:n,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Ln(n),a=Hr(n),c=cn(n)==="y",l=D1.has(o)?-1:1,d=s&&c?-1:1,u=jn(e,t);let{mainAxis:h,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:h*l}:{x:h*l,y:p*d}}const wN=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 SN(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}}}}},kN=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}=jn(t,e),l={x:n,y:i},d=await Is(e,c),u=cn(Ln(r)),h=ah(u);let p=l[h],g=l[u];if(s){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+d[y],k=p-d[b];p=Rd(w,p,k)}if(o){const y=u==="y"?"top":"left",b=u==="y"?"bottom":"right",w=g+d[y],k=g-d[b];g=Rd(w,g,k)}const f=a.fn({...e,[h]:p,[u]:g});return{...f,data:{x:f.x-n,y:f.y-i,enabled:{[h]: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}=jn(t,e),d={x:n,y:i},u=cn(r),h=ah(u);let p=d[h],g=d[u];const f=jn(a,e),y=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const k=h==="y"?"height":"width",S=s.reference[h]-s.floating[k]+y.mainAxis,x=s.reference[h]+s.reference[k]-y.mainAxis;p<S?p=S:p>x&&(p=x)}if(l){var b,w;const k=h==="y"?"width":"height",S=D1.has(Ln(r)),x=s.reference[u]-s.floating[k]+(S&&((b=o.offset)==null?void 0:b[u])||0)+(S?0:y.crossAxis),T=s.reference[u]+s.reference[k]+(S?0:((w=o.offset)==null?void 0:w[u])||0)-(S?y.crossAxis:0);g<x?g=x:g>T&&(g=T)}return{[h]:p,[u]:g}}}},TN=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}=jn(t,e),d=await Is(e,l),u=Ln(r),h=Hr(r),p=cn(r)==="y",{width:g,height:f}=s.floating;let y,b;u==="top"||u==="bottom"?(y=u,b=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,y=h==="end"?"top":"bottom");const w=f-d.top-d.bottom,k=g-d.left-d.right,S=si(f-d[y],w),x=si(g-d[b],k),T=!e.middlewareData.shift;let E=S,P=x;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=k),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(E=w),T&&!h){const C=Tt(d.left,0),I=Tt(d.right,0),N=Tt(d.top,0),Z=Tt(d.bottom,0);p?P=g-2*(C!==0||I!==0?C+I:Tt(d.left,d.right)):E=f-2*(N!==0||Z!==0?N+Z:Tt(d.top,d.bottom))}await c({...e,availableWidth:P,availableHeight:E});const M=await o.getDimensions(a.floating);return g!==M.width||f!==M.height?{reset:{rects:!0}}:{}}}};function Oa(){return typeof window<"u"}function zr(t){return j1(t)?(t.nodeName||"").toLowerCase():"#document"}function Rt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function bn(t){var e;return(e=(j1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function j1(t){return Oa()?t instanceof Node||t instanceof Rt(t).Node:!1}function Yt(t){return Oa()?t instanceof Element||t instanceof Rt(t).Element:!1}function gn(t){return Oa()?t instanceof HTMLElement||t instanceof Rt(t).HTMLElement:!1}function Fp(t){return!Oa()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Rt(t).ShadowRoot}const EN=new Set(["inline","contents"]);function Hs(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=Jt(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!EN.has(r)}const PN=new Set(["table","td","th"]);function RN(t){return PN.has(zr(t))}const AN=[":popover-open",":modal"];function Da(t){return AN.some(e=>{try{return t.matches(e)}catch{return!1}})}const IN=["transform","translate","scale","rotate","perspective"],MN=["transform","translate","scale","rotate","perspective","filter"],NN=["paint","layout","strict","content"];function dh(t){const e=uh(),n=Yt(t)?Jt(t):t;return IN.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)||MN.some(i=>(n.willChange||"").includes(i))||NN.some(i=>(n.contain||"").includes(i))}function _N(t){let e=oi(t);for(;gn(e)&&!Nr(e);){if(dh(e))return e;if(Da(e))return null;e=oi(e)}return null}function uh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ON=new Set(["html","body","#document"]);function Nr(t){return ON.has(zr(t))}function Jt(t){return Rt(t).getComputedStyle(t)}function ja(t){return Yt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oi(t){if(zr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Fp(t)&&t.host||bn(t);return Fp(e)?e.host:e}function L1(t){const e=oi(t);return Nr(e)?t.ownerDocument?t.ownerDocument.body:t.body:gn(e)&&Hs(e)?e:L1(e)}function Ms(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=L1(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),o=Rt(r);if(s){const a=Id(o);return e.concat(o,o.visualViewport||[],Hs(r)?r:[],a&&n?Ms(a):[])}return e.concat(r,Ms(r,[],n))}function Id(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function V1(t){const e=Jt(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=gn(t),s=r?t.offsetWidth:n,o=r?t.offsetHeight:i,a=ua(n)!==s||ua(i)!==o;return a&&(n=s,i=o),{width:n,height:i,$:a}}function hh(t){return Yt(t)?t:t.contextElement}function Sr(t){const e=hh(t);if(!gn(e))return hn(1);const n=e.getBoundingClientRect(),{width:i,height:r,$:s}=V1(e);let o=(s?ua(n.width):n.width)/i,a=(s?ua(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const DN=hn(0);function F1(t){const e=Rt(t);return!uh()||!e.visualViewport?DN:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jN(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Rt(t)?!1:e}function Vi(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=hh(t);let o=hn(1);e&&(i?Yt(i)&&(o=Sr(i)):o=Sr(t));const a=jN(s,n,i)?F1(s):hn(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 h=Rt(s),p=i&&Yt(i)?Rt(i):i;let g=h,f=Id(g);for(;f&&i&&p!==g;){const y=Sr(f),b=f.getBoundingClientRect(),w=Jt(f),k=b.left+(f.clientLeft+parseFloat(w.paddingLeft))*y.x,S=b.top+(f.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,l*=y.y,d*=y.x,u*=y.y,c+=k,l+=S,g=Rt(f),f=Id(g)}}return fa({width:d,height:u,x:c,y:l})}function fh(t,e){const n=ja(t).scrollLeft;return e?e.left+n:Vi(bn(t)).left+n}function U1(t,e,n){n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=i.left+e.scrollLeft-(n?0:fh(t,i)),s=i.top+e.scrollTop;return{x:r,y:s}}function LN(t){let{elements:e,rect:n,offsetParent:i,strategy:r}=t;const s=r==="fixed",o=bn(i),a=e?Da(e.floating):!1;if(i===o||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=hn(1);const d=hn(0),u=gn(i);if((u||!u&&!s)&&((zr(i)!=="body"||Hs(o))&&(c=ja(i)),gn(i))){const p=Vi(i);l=Sr(i),d.x=p.x+i.clientLeft,d.y=p.y+i.clientTop}const h=o&&!u&&!s?U1(o,c,!0):hn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+h.x,y:n.y*l.y-c.scrollTop*l.y+d.y+h.y}}function VN(t){return Array.from(t.getClientRects())}function FN(t){const e=bn(t),n=ja(t),i=t.ownerDocument.body,r=Tt(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Tt(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-n.scrollLeft+fh(t);const a=-n.scrollTop;return Jt(i).direction==="rtl"&&(o+=Tt(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function UN(t,e){const n=Rt(t),i=bn(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=uh();(!l||l&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}return{width:s,height:o,x:a,y:c}}const BN=new Set(["absolute","fixed"]);function $N(t,e){const n=Vi(t,!0,e==="fixed"),i=n.top+t.clientTop,r=n.left+t.clientLeft,s=gn(t)?Sr(t):hn(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 Up(t,e,n){let i;if(e==="viewport")i=UN(t,n);else if(e==="document")i=FN(bn(t));else if(Yt(e))i=$N(e,n);else{const r=F1(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return fa(i)}function B1(t,e){const n=oi(t);return n===e||!Yt(n)||Nr(n)?!1:Jt(n).position==="fixed"||B1(n,e)}function HN(t,e){const n=e.get(t);if(n)return n;let i=Ms(t,[],!1).filter(a=>Yt(a)&&zr(a)!=="body"),r=null;const s=Jt(t).position==="fixed";let o=s?oi(t):t;for(;Yt(o)&&!Nr(o);){const a=Jt(o),c=dh(o);!c&&a.position==="fixed"&&(r=null),(s?!c&&!r:!c&&a.position==="static"&&!!r&&BN.has(r.position)||Hs(o)&&!c&&B1(t,o))?i=i.filter(d=>d!==o):r=a,o=oi(o)}return e.set(t,i),i}function zN(t){let{element:e,boundary:n,rootBoundary:i,strategy:r}=t;const o=[...n==="clippingAncestors"?Da(e)?[]:HN(e,this._c):[].concat(n),i],a=o[0],c=o.reduce((l,d)=>{const u=Up(e,d,r);return l.top=Tt(u.top,l.top),l.right=si(u.right,l.right),l.bottom=si(u.bottom,l.bottom),l.left=Tt(u.left,l.left),l},Up(e,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function WN(t){const{width:e,height:n}=V1(t);return{width:e,height:n}}function qN(t,e,n){const i=gn(e),r=bn(e),s=n==="fixed",o=Vi(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=hn(0);function l(){c.x=fh(r)}if(i||!i&&!s)if((zr(e)!=="body"||Hs(r))&&(a=ja(e)),i){const p=Vi(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?U1(r,a):hn(0),u=o.left+a.scrollLeft-c.x-d.x,h=o.top+a.scrollTop-c.y-d.y;return{x:u,y:h,width:o.width,height:o.height}}function Yc(t){return Jt(t).position==="static"}function Bp(t,e){if(!gn(t)||Jt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bn(t)===n&&(n=n.ownerDocument.body),n}function $1(t,e){const n=Rt(t);if(Da(t))return n;if(!gn(t)){let r=oi(t);for(;r&&!Nr(r);){if(Yt(r)&&!Yc(r))return r;r=oi(r)}return n}let i=Bp(t,e);for(;i&&RN(i)&&Yc(i);)i=Bp(i,e);return i&&Nr(i)&&Yc(i)&&!dh(i)?n:i||_N(t)||n}const KN=async function(t){const e=this.getOffsetParent||$1,n=this.getDimensions,i=await n(t.floating);return{reference:qN(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function GN(t){return Jt(t).direction==="rtl"}const ZN={convertOffsetParentRelativeRectToViewportRelativeRect:LN,getDocumentElement:bn,getClippingRect:zN,getOffsetParent:$1,getElementRects:KN,getClientRects:VN,getDimensions:WN,getScale:Sr,isElement:Yt,isRTL:GN};function H1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function YN(t,e){let n=null,i;const r=bn(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:h,height:p}=l;if(a||e(),!h||!p)return;const g=co(u),f=co(r.clientWidth-(d+h)),y=co(r.clientHeight-(u+p)),b=co(d),k={rootMargin:-g+"px "+-f+"px "+-y+"px "+-b+"px",threshold:Tt(0,si(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&&!H1(l,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(x,{...k,root:r.ownerDocument})}catch{n=new IntersectionObserver(x,k)}n.observe(t)}return o(!0),s}function JN(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=hh(t),d=r||s?[...l?Ms(l):[],...Ms(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const u=l&&a?YN(l,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),n()}),l&&!c&&p.observe(l),p.observe(e));let g,f=c?Vi(t):null;c&&y();function y(){const b=Vi(t);f&&!H1(f,b)&&n(),f=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 XN=wN,QN=kN,e_=bN,t_=TN,n_=xN,$p=yN,i_=CN,r_=(t,e,n)=>{const i=new Map,r={platform:ZN,...n},s={...r.platform,_c:i};return vN(t,e,{...r,platform:s})};var s_=typeof document<"u",o_=function(){},Uo=s_?R.useLayoutEffect:o_;function ma(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(!ma(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)&&!ma(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function z1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Hp(t,e){const n=z1(t);return Math.round(e*n)/n}function Jc(t){const e=v.useRef(t);return Uo(()=>{e.current=t}),e}function a_(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}),[h,p]=v.useState(i);ma(h,i)||p(i);const[g,f]=v.useState(null),[y,b]=v.useState(null),w=v.useCallback(_=>{_!==T.current&&(T.current=_,f(_))},[]),k=v.useCallback(_=>{_!==E.current&&(E.current=_,b(_))},[]),S=s||g,x=o||y,T=v.useRef(null),E=v.useRef(null),P=v.useRef(d),M=c!=null,C=Jc(c),I=Jc(r),N=Jc(l),Z=v.useCallback(()=>{if(!T.current||!E.current)return;const _={placement:e,strategy:n,middleware:h};I.current&&(_.platform=I.current),r_(T.current,E.current,_).then(ie=>{const L={...ie,isPositioned:N.current!==!1};Q.current&&!ma(P.current,L)&&(P.current=L,xa.flushSync(()=>{u(L)}))})},[h,e,n,I,N]);Uo(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[l]);const Q=v.useRef(!1);Uo(()=>(Q.current=!0,()=>{Q.current=!1}),[]),Uo(()=>{if(S&&(T.current=S),x&&(E.current=x),S&&x){if(C.current)return C.current(S,x,Z);Z()}},[S,x,Z,C,M]);const se=v.useMemo(()=>({reference:T,floating:E,setReference:w,setFloating:k}),[w,k]),te=v.useMemo(()=>({reference:S,floating:x}),[S,x]),Y=v.useMemo(()=>{const _={position:n,left:0,top:0};if(!te.floating)return _;const ie=Hp(te.floating,d.x),L=Hp(te.floating,d.y);return a?{..._,transform:"translate("+ie+"px, "+L+"px)",...z1(te.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:L}},[n,a,te.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:Z,refs:se,elements:te,floatingStyles:Y}),[d,Z,se,te,Y])}const c_=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?$p({element:i.current,padding:r}).fn(n):{}:i?$p({element:i,padding:r}).fn(n):{}}}},l_=(t,e)=>({...XN(t),options:[t,e]}),d_=(t,e)=>({...QN(t),options:[t,e]}),u_=(t,e)=>({...i_(t),options:[t,e]}),h_=(t,e)=>({...e_(t),options:[t,e]}),f_=(t,e)=>({...t_(t),options:[t,e]}),m_=(t,e)=>({...n_(t),options:[t,e]}),p_=(t,e)=>({...c_(t),options:[t,e]});var g_="Arrow",W1=v.forwardRef((t,e)=>{const{children:n,width:i=10,height:r=5,...s}=t;return m.jsx(We.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"})})});W1.displayName=g_;var v_=W1;function y_(t){const[e,n]=v.useState(void 0);return wt(()=>{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 mh="Popper",[q1,K1]=sh(mh),[b_,G1]=q1(mh),Z1=t=>{const{__scopePopper:e,children:n}=t,[i,r]=v.useState(null);return m.jsx(b_,{scope:e,anchor:i,onAnchorChange:r,children:n})};Z1.displayName=mh;var Y1="PopperAnchor",J1=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...r}=t,s=G1(Y1,n),o=v.useRef(null),a=dt(e,o);return v.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:m.jsx(We.div,{...r,ref:a})});J1.displayName=Y1;var ph="PopperContent",[x_,S_]=q1(ph),X1=v.forwardRef((t,e)=>{var O,$,X,z,oe,H;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:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...f}=t,y=G1(ph,n),[b,w]=v.useState(null),k=dt(e,ue=>w(ue)),[S,x]=v.useState(null),T=y_(S),E=(T==null?void 0:T.width)??0,P=(T==null?void 0:T.height)??0,M=i+(s!=="center"?"-"+s:""),C=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(l)?l:[l],N=I.length>0,Z={padding:C,boundary:I.filter(k_),altBoundary:N},{refs:Q,floatingStyles:se,placement:te,isPositioned:Y,middlewareData:_}=a_({strategy:"fixed",placement:M,whileElementsMounted:(...ue)=>JN(...ue,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[l_({mainAxis:r+P,alignmentAxis:o}),c&&d_({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?u_():void 0,...Z}),c&&h_({...Z}),f_({...Z,apply:({elements:ue,rects:Se,availableWidth:rt,availableHeight:Qt})=>{const{width:vi,height:yi}=Se.reference,en=ue.floating.style;en.setProperty("--radix-popper-available-width",`${rt}px`),en.setProperty("--radix-popper-available-height",`${Qt}px`),en.setProperty("--radix-popper-anchor-width",`${vi}px`),en.setProperty("--radix-popper-anchor-height",`${yi}px`)}}),S&&p_({element:S,padding:a}),C_({arrowWidth:E,arrowHeight:P}),h&&m_({strategy:"referenceHidden",...Z})]}),[ie,L]=tx(te),F=Li(g);wt(()=>{Y&&(F==null||F())},[Y,F]);const ee=(O=_.arrow)==null?void 0:O.x,j=($=_.arrow)==null?void 0:$.y,W=((X=_.arrow)==null?void 0:X.centerOffset)!==0,[J,K]=v.useState();return wt(()=>{b&&K(window.getComputedStyle(b).zIndex)},[b]),m.jsx("div",{ref:Q.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:Y?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(z=_.transformOrigin)==null?void 0:z.x,(oe=_.transformOrigin)==null?void 0:oe.y].join(" "),...((H=_.hide)==null?void 0:H.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:m.jsx(x_,{scope:n,placedSide:ie,onArrowChange:x,arrowX:ee,arrowY:j,shouldHideArrow:W,children:m.jsx(We.div,{"data-side":ie,"data-align":L,...f,ref:k,style:{...f.style,animation:Y?void 0:"none"}})})})});X1.displayName=ph;var Q1="PopperArrow",w_={top:"bottom",right:"left",bottom:"top",left:"right"},ex=v.forwardRef(function(e,n){const{__scopePopper:i,...r}=e,s=S_(Q1,i),o=w_[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(v_,{...r,ref:n,style:{...r.style,display:"block"}})})});ex.displayName=Q1;function k_(t){return t!==null}var C_=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]=tx(n),u={start:"0%",center:"50%",end:"100%"}[d],h=(((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="",f="";return l==="bottom"?(g=o?u:`${h}px`,f=`${-c}px`):l==="top"?(g=o?u:`${h}px`,f=`${i.floating.height+c}px`):l==="right"?(g=`${-c}px`,f=o?u:`${p}px`):l==="left"&&(g=`${i.floating.width+c}px`,f=o?u:`${p}px`),{data:{x:g,y:f}}}});function tx(t){const[e,n="center"]=t.split("-");return[e,n]}var T_=Z1,E_=J1,P_=X1,R_=ex,A_="Portal",nx=v.forwardRef((t,e)=>{var a;const{container:n,...i}=t,[r,s]=v.useState(!1);wt(()=>s(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Wg.createPortal(m.jsx(We.div,{...i,ref:e}),o):null});nx.displayName=A_;function I_(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 ix=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"}),M_="VisuallyHidden",N_=v.forwardRef((t,e)=>m.jsx(We.span,{...t,ref:e,style:{...ix,...t.style}}));N_.displayName=M_;var __=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Gi=new WeakMap,lo=new WeakMap,uo={},Xc=0,rx=function(t){return t&&(t.host||rx(t.parentNode))},O_=function(t,e){return e.map(function(n){if(t.contains(n))return n;var i=rx(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})},D_=function(t,e,n,i){var r=O_(e,Array.isArray(t)?t:[t]);uo[n]||(uo[n]=new WeakMap);var s=uo[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(h){if(a.has(h))d(h);else try{var p=h.getAttribute(i),g=p!==null&&p!=="false",f=(Gi.get(h)||0)+1,y=(s.get(h)||0)+1;Gi.set(h,f),s.set(h,y),o.push(h),f===1&&g&&lo.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(i,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),a.clear(),Xc++,function(){o.forEach(function(u){var h=Gi.get(u)-1,p=s.get(u)-1;Gi.set(u,h),s.set(u,p),h||(lo.has(u)||u.removeAttribute(i),lo.delete(u)),p||u.removeAttribute(n)}),Xc--,Xc||(Gi=new WeakMap,Gi=new WeakMap,lo=new WeakMap,uo={})}},j_=function(t,e,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),r=__(t);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),D_(i,r,n,"aria-hidden")):function(){return null}},an=function(){return an=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},an.apply(this,arguments)};function sx(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 L_(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 Bo="right-scroll-bar-position",$o="width-before-scroll-bar",V_="with-scroll-bars-hidden",F_="--removed-body-scroll-bar-size";function Qc(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function U_(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 B_=typeof window<"u"?v.useLayoutEffect:v.useEffect,zp=new WeakMap;function $_(t,e){var n=U_(null,function(i){return t.forEach(function(r){return Qc(r,i)})});return B_(function(){var i=zp.get(n);if(i){var r=new Set(i),s=new Set(t),o=n.current;r.forEach(function(a){s.has(a)||Qc(a,null)}),s.forEach(function(a){r.has(a)||Qc(a,o)})}zp.set(n,t)},[t]),n}function H_(t){return t}function z_(t,e){e===void 0&&(e=H_);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 W_(t){t===void 0&&(t={});var e=z_(null);return e.options=an({async:!0,ssr:!1},t),e}var ox=function(t){var e=t.sideCar,n=sx(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,an({},n))};ox.isSideCarExport=!0;function q_(t,e){return t.useMedium(e),ox}var ax=W_(),el=function(){},La=v.forwardRef(function(t,e){var n=v.useRef(null),i=v.useState({onScrollCapture:el,onWheelCapture:el,onTouchMoveCapture:el}),r=i[0],s=i[1],o=t.forwardProps,a=t.children,c=t.className,l=t.removeScrollBar,d=t.enabled,u=t.shards,h=t.sideCar,p=t.noRelative,g=t.noIsolation,f=t.inert,y=t.allowPinchZoom,b=t.as,w=b===void 0?"div":b,k=t.gapMode,S=sx(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=h,T=$_([n,e]),E=an(an({},S),r);return v.createElement(v.Fragment,null,d&&v.createElement(x,{sideCar:ax,removeScrollBar:l,shards:u,noRelative:p,noIsolation:g,inert:f,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:k}),o?v.cloneElement(v.Children.only(a),an(an({},E),{ref:T})):v.createElement(w,an({},E,{className:c,ref:T}),a))});La.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};La.classNames={fullWidth:$o,zeroRight:Bo};var K_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function G_(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=K_();return e&&t.setAttribute("nonce",e),t}function Z_(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Y_(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var J_=function(){var t=0,e=null;return{add:function(n){t==0&&(e=G_())&&(Z_(e,n),Y_(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},X_=function(){var t=J_();return function(e,n){v.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},cx=function(){var t=X_(),e=function(n){var i=n.styles,r=n.dynamic;return t(i,r),null};return e},Q_={left:0,top:0,right:0,gap:0},tl=function(t){return parseInt(t||"",10)||0},e8=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[tl(n),tl(i),tl(r)]},t8=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Q_;var e=e8(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])}},n8=cx(),wr="data-scroll-locked",i8=function(t,e,n,i){var r=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
49
+ .`.concat(V_,` {
50
+ overflow: hidden `).concat(i,`;
51
+ padding-right: `).concat(a,"px ").concat(i,`;
42
52
  }
43
- body[`).concat(hn,`] {
44
- overflow: hidden `).concat(s,`;
53
+ body[`).concat(wr,`] {
54
+ overflow: hidden `).concat(i,`;
45
55
  overscroll-behavior: contain;
46
- `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
56
+ `).concat([e&&"position: relative ".concat(i,";"),n==="margin"&&`
47
57
  padding-left: `.concat(r,`px;
48
- padding-top: `).concat(i,`px;
58
+ padding-top: `).concat(s,`px;
49
59
  padding-right: `).concat(o,`px;
50
60
  margin-left:0;
51
61
  margin-top:0;
52
- margin-right: `).concat(a,"px ").concat(s,`;
53
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
62
+ margin-right: `).concat(a,"px ").concat(i,`;
63
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(i,";")].filter(Boolean).join(""),`
54
64
  }
55
65
 
56
- .`).concat(ws,` {
57
- right: `).concat(a,"px ").concat(s,`;
66
+ .`).concat(Bo,` {
67
+ right: `).concat(a,"px ").concat(i,`;
58
68
  }
59
69
 
60
- .`).concat(Ss,` {
61
- margin-right: `).concat(a,"px ").concat(s,`;
70
+ .`).concat($o,` {
71
+ margin-right: `).concat(a,"px ").concat(i,`;
62
72
  }
63
73
 
64
- .`).concat(ws," .").concat(ws,` {
65
- right: 0 `).concat(s,`;
74
+ .`).concat(Bo," .").concat(Bo,` {
75
+ right: 0 `).concat(i,`;
66
76
  }
67
77
 
68
- .`).concat(Ss," .").concat(Ss,` {
69
- margin-right: 0 `).concat(s,`;
78
+ .`).concat($o," .").concat($o,` {
79
+ margin-right: 0 `).concat(i,`;
70
80
  }
71
81
 
72
- body[`).concat(hn,`] {
73
- `).concat(Hy,": ").concat(a,`px;
82
+ body[`).concat(wr,`] {
83
+ `).concat(F_,": ").concat(a,`px;
74
84
  }
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")]})})]})})})}/**
85
+ `)},Wp=function(){var t=parseInt(document.body.getAttribute(wr)||"0",10);return isFinite(t)?t:0},r8=function(){v.useEffect(function(){return document.body.setAttribute(wr,(Wp()+1).toString()),function(){var t=Wp()-1;t<=0?document.body.removeAttribute(wr):document.body.setAttribute(wr,t.toString())}},[])},s8=function(t){var e=t.noRelative,n=t.noImportant,i=t.gapMode,r=i===void 0?"margin":i;r8();var s=v.useMemo(function(){return t8(r)},[r]);return v.createElement(n8,{styles:i8(s,!e,r,n?"":"!important")})},Md=!1;if(typeof window<"u")try{var ho=Object.defineProperty({},"passive",{get:function(){return Md=!0,!0}});window.addEventListener("test",ho,ho),window.removeEventListener("test",ho,ho)}catch{Md=!1}var Zi=Md?{passive:!1}:!1,o8=function(t){return t.tagName==="TEXTAREA"},lx=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!o8(t)&&n[e]==="visible")},a8=function(t){return lx(t,"overflowY")},c8=function(t){return lx(t,"overflowX")},qp=function(t,e){var n=e.ownerDocument,i=e;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=dx(t,i);if(r){var s=ux(t,i),o=s[1],a=s[2];if(o>a)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},l8=function(t){var e=t.scrollTop,n=t.scrollHeight,i=t.clientHeight;return[e,n,i]},d8=function(t){var e=t.scrollLeft,n=t.scrollWidth,i=t.clientWidth;return[e,n,i]},dx=function(t,e){return t==="v"?a8(e):c8(e)},ux=function(t,e){return t==="v"?l8(e):d8(e)},u8=function(t,e){return t==="h"&&e==="rtl"?-1:1},h8=function(t,e,n,i,r){var s=u8(t,window.getComputedStyle(e).direction),o=s*i,a=n.target,c=e.contains(a),l=!1,d=o>0,u=0,h=0;do{if(!a)break;var p=ux(t,a),g=p[0],f=p[1],y=p[2],b=f-y-s*g;(g||b)&&dx(t,a)&&(u+=b,h+=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(h)<1)&&(l=!0),l},fo=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Kp=function(t){return[t.deltaX,t.deltaY]},Gp=function(t){return t&&"current"in t?t.current:t},f8=function(t,e){return t[0]===e[0]&&t[1]===e[1]},m8=function(t){return`
86
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
87
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
88
+ `)},p8=0,Yi=[];function g8(t){var e=v.useRef([]),n=v.useRef([0,0]),i=v.useRef(),r=v.useState(p8++)[0],s=v.useState(cx)[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 f=L_([t.lockRef.current],(t.shards||[]).map(Gp),!0).filter(Boolean);return f.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),f.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var a=v.useCallback(function(f,y){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!o.current.allowPinchZoom;var b=fo(f),w=n.current,k="deltaX"in f?f.deltaX:w[0]-b[0],S="deltaY"in f?f.deltaY:w[1]-b[1],x,T=f.target,E=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in f&&E==="h"&&T.type==="range")return!1;var P=qp(E,T);if(!P)return!0;if(P?x=E:(x=E==="v"?"h":"v",P=qp(E,T)),!P)return!1;if(!i.current&&"changedTouches"in f&&(k||S)&&(i.current=x),!x)return!0;var M=i.current||x;return h8(M,y,f,M==="h"?k:S)},[]),c=v.useCallback(function(f){var y=f;if(!(!Yi.length||Yi[Yi.length-1]!==s)){var b="deltaY"in y?Kp(y):fo(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 k=(o.current.shards||[]).map(Gp).filter(Boolean).filter(function(x){return x.contains(y.target)}),S=k.length>0?a(y,k[0]):!o.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),l=v.useCallback(function(f,y,b,w){var k={name:f,delta:y,target:b,should:w,shadowParent:v8(b)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(S){return S!==k})},1)},[]),d=v.useCallback(function(f){n.current=fo(f),i.current=void 0},[]),u=v.useCallback(function(f){l(f.type,Kp(f),f.target,a(f,t.lockRef.current))},[]),h=v.useCallback(function(f){l(f.type,fo(f),f.target,a(f,t.lockRef.current))},[]);v.useEffect(function(){return Yi.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Zi),document.addEventListener("touchmove",c,Zi),document.addEventListener("touchstart",d,Zi),function(){Yi=Yi.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Zi),document.removeEventListener("touchmove",c,Zi),document.removeEventListener("touchstart",d,Zi)}},[]);var p=t.removeScrollBar,g=t.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:m8(r)}):null,p?v.createElement(s8,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function v8(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const y8=q_(ax,g8);var hx=v.forwardRef(function(t,e){return v.createElement(La,an({},t,{ref:e,sideCar:y8}))});hx.classNames=La.classNames;var b8=[" ","Enter","ArrowUp","ArrowDown"],x8=[" ","Enter"],Fi="Select",[Va,Fa,S8]=F4(Fi),[Wr,Vj]=sh(Fi,[S8,K1]),Ua=K1(),[w8,mi]=Wr(Fi),[k8,C8]=Wr(Fi),fx=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:h,required:p,form:g}=t,f=Ua(e),[y,b]=v.useState(null),[w,k]=v.useState(null),[S,x]=v.useState(!1),T=B4(l),[E,P]=Ed({prop:i,defaultProp:r??!1,onChange:s,caller:Fi}),[M,C]=Ed({prop:o,defaultProp:a,onChange:c,caller:Fi}),I=v.useRef(null),N=y?g||!!y.closest("form"):!0,[Z,Q]=v.useState(new Set),se=Array.from(Z).map(te=>te.props.value).join(";");return m.jsx(T_,{...f,children:m.jsxs(w8,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:x,contentId:oh(),value:M,onValueChange:C,open:E,onOpenChange:P,dir:T,triggerPointerDownPosRef:I,disabled:h,children:[m.jsx(Va.Provider,{scope:e,children:m.jsx(k8,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(te=>{Q(Y=>new Set(Y).add(te))},[]),onNativeOptionRemove:v.useCallback(te=>{Q(Y=>{const _=new Set(Y);return _.delete(te),_})},[]),children:n})}),N?m.jsxs(Dx,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:u,value:M,onChange:te=>C(te.target.value),disabled:h,form:g,children:[M===void 0?m.jsx("option",{value:""}):null,Array.from(Z)]},se):null]})})};fx.displayName=Fi;var mx="SelectTrigger",px=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...r}=t,s=Ua(n),o=mi(mx,n),a=o.disabled||i,c=dt(e,o.onTriggerChange),l=Fa(n),d=v.useRef("touch"),[u,h,p]=Lx(f=>{const y=l().filter(k=>!k.disabled),b=y.find(k=>k.value===o.value),w=Vx(y,f,b);w!==void 0&&o.onValueChange(w.value)}),g=f=>{a||(o.onOpenChange(!0),p()),f&&(o.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return m.jsx(E_,{asChild:!0,...s,children:m.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":jx(o.value)?"":void 0,...r,ref:c,onClick:Ke(r.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&g(f)}),onPointerDown:Ke(r.onPointerDown,f=>{d.current=f.pointerType;const y=f.target;y.hasPointerCapture(f.pointerId)&&y.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:Ke(r.onKeyDown,f=>{const y=u.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(y&&f.key===" ")&&b8.includes(f.key)&&(g(),f.preventDefault())})})})});px.displayName=mx;var gx="SelectValue",vx=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,children:s,placeholder:o="",...a}=t,c=mi(gx,n),{onValueNodeHasChildrenChange:l}=c,d=s!==void 0,u=dt(e,c.onValueNodeChange);return wt(()=>{l(d)},[l,d]),m.jsx(We.span,{...a,ref:u,style:{pointerEvents:"none"},children:jx(c.value)?m.jsx(m.Fragment,{children:o}):s})});vx.displayName=gx;var T8="SelectIcon",yx=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...r}=t;return m.jsx(We.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});yx.displayName=T8;var E8="SelectPortal",bx=t=>m.jsx(nx,{asChild:!0,...t});bx.displayName=E8;var Ui="SelectContent",xx=v.forwardRef((t,e)=>{const n=mi(Ui,t.__scopeSelect),[i,r]=v.useState();if(wt(()=>{r(new DocumentFragment)},[]),!n.open){const s=i;return s?xa.createPortal(m.jsx(Sx,{scope:t.__scopeSelect,children:m.jsx(Va.Slot,{scope:t.__scopeSelect,children:m.jsx("div",{children:t.children})})}),s):null}return m.jsx(wx,{...t,ref:e})});xx.displayName=Ui;var Ht=10,[Sx,pi]=Wr(Ui),P8="SelectContentImpl",R8=As("SelectContent.RemoveScroll"),wx=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:h,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:y,...b}=t,w=mi(Ui,n),[k,S]=v.useState(null),[x,T]=v.useState(null),E=dt(e,O=>S(O)),[P,M]=v.useState(null),[C,I]=v.useState(null),N=Fa(n),[Z,Q]=v.useState(!1),se=v.useRef(!1);v.useEffect(()=>{if(k)return j_(k)},[k]),Y4();const te=v.useCallback(O=>{const[$,...X]=N().map(H=>H.ref.current),[z]=X.slice(-1),oe=document.activeElement;for(const H of O)if(H===oe||(H==null||H.scrollIntoView({block:"nearest"}),H===$&&x&&(x.scrollTop=0),H===z&&x&&(x.scrollTop=x.scrollHeight),H==null||H.focus(),document.activeElement!==oe))return},[N,x]),Y=v.useCallback(()=>te([P,k]),[te,P,k]);v.useEffect(()=>{Z&&Y()},[Z,Y]);const{onOpenChange:_,triggerPointerDownPosRef:ie}=w;v.useEffect(()=>{if(k){let O={x:0,y:0};const $=z=>{var oe,H;O={x:Math.abs(Math.round(z.pageX)-(((oe=ie.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(z.pageY)-(((H=ie.current)==null?void 0:H.y)??0))}},X=z=>{O.x<=10&&O.y<=10?z.preventDefault():k.contains(z.target)||_(!1),document.removeEventListener("pointermove",$),ie.current=null};return ie.current!==null&&(document.addEventListener("pointermove",$),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",X,{capture:!0})}}},[k,_,ie]),v.useEffect(()=>{const O=()=>_(!1);return window.addEventListener("blur",O),window.addEventListener("resize",O),()=>{window.removeEventListener("blur",O),window.removeEventListener("resize",O)}},[_]);const[L,F]=Lx(O=>{const $=N().filter(oe=>!oe.disabled),X=$.find(oe=>oe.ref.current===document.activeElement),z=Vx($,O,X);z&&setTimeout(()=>z.ref.current.focus())}),ee=v.useCallback((O,$,X)=>{const z=!se.current&&!X;(w.value!==void 0&&w.value===$||z)&&(M(O),z&&(se.current=!0))},[w.value]),j=v.useCallback(()=>k==null?void 0:k.focus(),[k]),W=v.useCallback((O,$,X)=>{const z=!se.current&&!X;(w.value!==void 0&&w.value===$||z)&&I(O)},[w.value]),J=i==="popper"?Nd:kx,K=J===Nd?{side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:f,avoidCollisions:y}:{};return m.jsx(Sx,{scope:n,content:k,viewport:x,onViewportChange:T,itemRefCallback:ee,selectedItem:P,onItemLeave:j,itemTextRefCallback:W,focusSelectedItem:Y,selectedItemText:C,position:i,isPositioned:Z,searchRef:L,children:m.jsx(hx,{as:R8,allowPinchZoom:!0,children:m.jsx(N1,{asChild:!0,trapped:w.open,onMountAutoFocus:O=>{O.preventDefault()},onUnmountAutoFocus:Ke(r,O=>{var $;($=w.trigger)==null||$.focus({preventScroll:!0}),O.preventDefault()}),children:m.jsx(I1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:O=>O.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:m.jsx(J,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:O=>O.preventDefault(),...b,...K,onPlaced:()=>Q(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ke(b.onKeyDown,O=>{const $=O.ctrlKey||O.altKey||O.metaKey;if(O.key==="Tab"&&O.preventDefault(),!$&&O.key.length===1&&F(O.key),["ArrowUp","ArrowDown","Home","End"].includes(O.key)){let z=N().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(O.key)&&(z=z.slice().reverse()),["ArrowUp","ArrowDown"].includes(O.key)){const oe=O.target,H=z.indexOf(oe);z=z.slice(H+1)}setTimeout(()=>te(z)),O.preventDefault()}})})})})})})});wx.displayName=P8;var A8="SelectItemAlignedPosition",kx=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...r}=t,s=mi(Ui,n),o=pi(Ui,n),[a,c]=v.useState(null),[l,d]=v.useState(null),u=dt(e,E=>d(E)),h=Fa(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:f,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=o,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&l&&f&&y&&b){const E=s.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),C=b.getBoundingClientRect();if(s.dir!=="rtl"){const oe=C.left-P.left,H=M.left-oe,ue=E.left-H,Se=E.width+ue,rt=Math.max(Se,P.width),Qt=window.innerWidth-Ht,vi=Ep(H,[Ht,Math.max(Ht,Qt-rt)]);a.style.minWidth=Se+"px",a.style.left=vi+"px"}else{const oe=P.right-C.right,H=window.innerWidth-M.right-oe,ue=window.innerWidth-E.right-H,Se=E.width+ue,rt=Math.max(Se,P.width),Qt=window.innerWidth-Ht,vi=Ep(H,[Ht,Math.max(Ht,Qt-rt)]);a.style.minWidth=Se+"px",a.style.right=vi+"px"}const I=h(),N=window.innerHeight-Ht*2,Z=f.scrollHeight,Q=window.getComputedStyle(l),se=parseInt(Q.borderTopWidth,10),te=parseInt(Q.paddingTop,10),Y=parseInt(Q.borderBottomWidth,10),_=parseInt(Q.paddingBottom,10),ie=se+te+Z+_+Y,L=Math.min(y.offsetHeight*5,ie),F=window.getComputedStyle(f),ee=parseInt(F.paddingTop,10),j=parseInt(F.paddingBottom,10),W=E.top+E.height/2-Ht,J=N-W,K=y.offsetHeight/2,O=y.offsetTop+K,$=se+te+O,X=ie-$;if($<=W){const oe=I.length>0&&y===I[I.length-1].ref.current;a.style.bottom="0px";const H=l.clientHeight-f.offsetTop-f.offsetHeight,ue=Math.max(J,K+(oe?j:0)+H+Y),Se=$+ue;a.style.height=Se+"px"}else{const oe=I.length>0&&y===I[0].ref.current;a.style.top="0px";const ue=Math.max(W,se+f.offsetTop+(oe?ee:0)+K)+X;a.style.height=ue+"px",f.scrollTop=$-W+f.offsetTop}a.style.margin=`${Ht}px 0`,a.style.minHeight=L+"px",a.style.maxHeight=N+"px",i==null||i(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,a,l,f,y,b,s.dir,i]);wt(()=>k(),[k]);const[S,x]=v.useState();wt(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);const T=v.useCallback(E=>{E&&g.current===!0&&(k(),w==null||w(),g.current=!1)},[k,w]);return m.jsx(M8,{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(We.div,{...r,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});kx.displayName=A8;var I8="SelectPopperPosition",Nd=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:r=Ht,...s}=t,o=Ua(n);return m.jsx(P_,{...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)"}})});Nd.displayName=I8;var[M8,gh]=Wr(Ui,{}),_d="SelectViewport",Cx=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...r}=t,s=pi(_d,n),o=gh(_d,n),a=dt(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(Va.Slot,{scope:n,children:m.jsx(We.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Ke(r.onScroll,l=>{const d=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&u){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Ht*2,f=parseFloat(u.style.minHeight),y=parseFloat(u.style.height),b=Math.max(f,y);if(b<g){const w=b+p,k=Math.min(g,w),S=w-k;u.style.height=k+"px",u.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,u.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Cx.displayName=_d;var Tx="SelectGroup",[N8,_8]=Wr(Tx),O8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=oh();return m.jsx(N8,{scope:n,id:r,children:m.jsx(We.div,{role:"group","aria-labelledby":r,...i,ref:e})})});O8.displayName=Tx;var Ex="SelectLabel",D8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=_8(Ex,n);return m.jsx(We.div,{id:r.id,...i,ref:e})});D8.displayName=Ex;var pa="SelectItem",[j8,Px]=Wr(pa),Rx=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:r=!1,textValue:s,...o}=t,a=mi(pa,n),c=pi(pa,n),l=a.value===i,[d,u]=v.useState(s??""),[h,p]=v.useState(!1),g=dt(e,w=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,w,i,r)}),f=oh(),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(j8,{scope:n,value:i,disabled:r,textId:f,isSelected:l,onItemTextChange:v.useCallback(w=>{u(k=>k||((w==null?void 0:w.textContent)??"").trim())},[]),children:m.jsx(Va.ItemSlot,{scope:n,value:i,disabled:r,textValue:d,children:m.jsx(We.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":l&&h,"data-state":l?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:g,onFocus:Ke(o.onFocus,()=>p(!0)),onBlur:Ke(o.onBlur,()=>p(!1)),onClick:Ke(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Ke(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Ke(o.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:Ke(o.onPointerMove,w=>{var k;y.current=w.pointerType,r?(k=c.onItemLeave)==null||k.call(c):y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ke(o.onPointerLeave,w=>{var k;w.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:Ke(o.onKeyDown,w=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&w.key===" "||(x8.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Rx.displayName=pa;var as="SelectItemText",Ax=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,...s}=t,o=mi(as,n),a=pi(as,n),c=Px(as,n),l=C8(as,n),[d,u]=v.useState(null),h=dt(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:f,onNativeOptionRemove:y}=l;return wt(()=>(f(g),()=>y(g)),[f,y,g]),m.jsxs(m.Fragment,{children:[m.jsx(We.span,{id:c.textId,...s,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?xa.createPortal(s.children,o.valueNode):null]})});Ax.displayName=as;var Ix="SelectItemIndicator",Mx=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return Px(Ix,n).isSelected?m.jsx(We.span,{"aria-hidden":!0,...i,ref:e}):null});Mx.displayName=Ix;var Od="SelectScrollUpButton",Nx=v.forwardRef((t,e)=>{const n=pi(Od,t.__scopeSelect),i=gh(Od,t.__scopeSelect),[r,s]=v.useState(!1),o=dt(e,i.onScrollButtonChange);return wt(()=>{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(Ox,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});Nx.displayName=Od;var Dd="SelectScrollDownButton",_x=v.forwardRef((t,e)=>{const n=pi(Dd,t.__scopeSelect),i=gh(Dd,t.__scopeSelect),[r,s]=v.useState(!1),o=dt(e,i.onScrollButtonChange);return wt(()=>{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(Ox,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});_x.displayName=Dd;var Ox=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...r}=t,s=pi("SelectScrollButton",n),o=v.useRef(null),a=Fa(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),wt(()=>{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(We.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:Ke(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:Ke(r.onPointerMove,()=>{var l;(l=s.onItemLeave)==null||l.call(s),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:Ke(r.onPointerLeave,()=>{c()})})}),L8="SelectSeparator",V8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return m.jsx(We.div,{"aria-hidden":!0,...i,ref:e})});V8.displayName=L8;var jd="SelectArrow",F8=v.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=Ua(n),s=mi(jd,n),o=pi(jd,n);return s.open&&o.position==="popper"?m.jsx(R_,{...r,...i,ref:e}):null});F8.displayName=jd;var U8="SelectBubbleInput",Dx=v.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const r=v.useRef(null),s=dt(i,r),o=I_(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(We.select,{...n,style:{...ix,...n.style},ref:s,defaultValue:e})});Dx.displayName=U8;function jx(t){return t===""||t===void 0}function Lx(t){const e=Li(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 Vx(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=B8(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 B8(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var $8=fx,H8=px,z8=vx,W8=yx,q8=bx,K8=xx,G8=Cx,Z8=Rx,Y8=Ax,J8=Mx,X8=Nx,Q8=_x;function Zp({...t}){return m.jsx($8,{"data-slot":"select",...t})}function Yp({...t}){return m.jsx(z8,{"data-slot":"select-value",...t})}function Jp({className:t,size:e="default",children:n,...i}){return m.jsxs(H8,{"data-slot":"select-trigger","data-size":e,className:le(["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(W8,{asChild:!0,children:m.jsx(nh,{weight:"bold",className:"size-4 transition-colors"})})]})}function Xp({className:t,children:e,position:n="popper",...i}){return m.jsx(q8,{children:m.jsxs(K8,{"data-slot":"select-content",className:le(["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(e6,{}),m.jsx(G8,{className:le("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(t6,{})]})})}function Qp({className:t,children:e,...n}){return m.jsxs(Z8,{"data-slot":"select-item",className:le(["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(J8,{children:m.jsx(o1,{className:"size-4",weight:"bold"})})}),m.jsx(Y8,{children:e})]})}function e6({className:t,...e}){return m.jsx(X8,{"data-slot":"select-scroll-up-button",className:le("flex cursor-default items-center justify-center py-1",t),...e,children:m.jsx(r1,{className:"size-4",weight:"bold"})})}function t6({className:t,...e}){return m.jsx(Q8,{"data-slot":"select-scroll-down-button",className:le("flex cursor-default items-center justify-center py-1",t),...e,children:m.jsx(nh,{className:"size-4",weight:"bold"})})}const eg=_a(["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 tg({kind:t,track:e,requestPermissions:n,onError:i,client:r,...s}){const o=s.size||"default";if(!r)return m.jsxs(Zp,{disabled:!0,children:[m.jsx(Jp,{className:le(eg({size:o}),s.className),children:m.jsx(Yp,{placeholder:`Select a ${t}`})}),m.jsx(Xp,{children:m.jsx(Qp,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:c,setActiveMediaDevice:l}=j4(r,t==="audioinput"?"audioinput":"videoinput");return m.jsxs(Zp,{value:c,onValueChange:l,children:[m.jsx(Jp,{className:le(eg({size:o}),s.className,"hover:bg"),children:o!=="sm"&&m.jsx(Yp,{className:"font-mono text-sm",placeholder:`Select a ${t}`})}),m.jsx(Xp,{children:a.map(d=>m.jsx(Qp,{value:d.deviceId,className:"font-mono text-xs",children:d.label},d.deviceId))})]})}function n6(t,e,n=!1){if(n)return ih;switch(t){case D.Source.Microphone:return e?a1:c1;case D.Source.Camera:return e?d1:u1;case D.Source.ScreenShare:return l1;default:return v.Fragment}}function nl({source:t,pressed:e,pending:n,className:i,...r}){const s=n6(t,e??!1,n),o=t===D.Source.Microphone&&!(e??!1)&&!n,a=t===D.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(R1,{pressed:e,"aria-label":`Toggle ${t}`,className:le(i),...r,children:[m.jsx(s,{weight:"bold",className:le(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}function i6(t){return t?_4(t):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function r6(t={}){const{controls:e,saveUserChoices:n=!0,client:i}=t,r={leave:!0,...e};if(!i)return{micTrackRef:{participant:void 0,source:D.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}=O4(i),a=i6(i);D4(i);const c=qc(i,"microphone",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:D.Source.Microphone,error:T})}}),l=qc(i,"camera",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:D.Source.Camera,error:T})}}),d=qc(i,"screenShare",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:D.Source.ScreenShare,error:T})}}),u=v.useMemo(()=>{let T;if(o){for(const[,E]of o.trackPublications)if(E.source===D.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:D.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:h,saveAudioInputDeviceId:p,saveVideoInputEnabled:g,saveVideoInputDeviceId:f}=L4({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=>{f(T??"default"),i&&i.setVideoInputDevice(T)},[f,i]),k=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),h(!c.enabled)},[c,h]),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:k},microphoneToggle:{...c,toggle:S},screenShareToggle:{...d,toggle:x},handleDisconnect:y,handleAudioDeviceChange:b,handleVideoDeviceChange:w}}const s6={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"}},o6={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"}},a6={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"}},ng={dark:s6,light:o6,vox:a6};function ut(t){return ng[t]||ng.vox}function c6({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,h]=v.useState(!1),[p,g]=v.useState(!1),f=ut(c),{micTrackRef:y,visibleControls:b,cameraToggle:w,microphoneToggle:k,screenShareToggle:S,handleAudioDeviceChange:x,handleVideoDeviceChange:T,handleDisconnect:E}=r6({controls:t,saveUserChoices:e,client:l}),P=async M=>{g(!0);try{await(r==null?void 0:r(M))}finally{g(!1)}};return v.useEffect(()=>{s==null||s(u)},[u,s]),v.useEffect(()=>{var M,C,I,N;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!y.participant,hasPublication:!!y.publication,source:y.source,isSubscribed:(M=y.publication)==null?void 0:M.isSubscribed,isMuted:(C=y.publication)==null?void 0:C.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:le(f.controlBar,i),...d,children:[n.suportsChatInput&&m.jsxs("div",{inert:!u,className:le("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(T4,{onSend:P,disabled:p,className:le("w-full",f.chatInput)})}),m.jsx("hr",{className:"border-border my-2 mx-5"})]}),m.jsxs("div",{className:le("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(nl,{variant:"primary",source:D.Source.Microphone,pressed:k.enabled,disabled:k.pending,onPressedChange:k.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(n1,{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:le(["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(tg,{size:"sm",kind:"audioinput",client:l,onError:a?M=>M instanceof Error?a({source:D.Source.Microphone,error:M}):void 0:void 0,onActiveDeviceChange:x,className:le(["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(nl,{variant:"primary",source:D.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(tg,{size:"sm",kind:"videoinput",client:l,onError:a?M=>M instanceof Error?a({source:D.Source.Camera,error:M}):void 0:void 0,onActiveDeviceChange:T,className:le(["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(nl,{variant:"secondary",source:D.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(R1,{variant:"secondary","aria-label":"Toggle chat",pressed:u,onPressedChange:M=>{h(M)},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(s1,{weight:"bold",className:"h-5 w-5"})})})]})]})}const l6=(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}},d6=({entry:t,messageFormatter:e,className:n,participantName:i,...r})=>{var d,u;const{message:s,time:o,locale:a}=l6(t,e),c=((d=t.from)==null?void 0:d.isLocal)??!1;le("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=le("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:le("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:m.jsxs("div",{className:le("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:le("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 u6(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 h6=({className:t,children:e,...n})=>{const i=R.useRef(null);return u6(i),m.jsx("div",{ref:i,className:le("flex flex-col justify-end",t),...n,children:e})},f6=({state:t,audioTrack:e,className:n,ref:i})=>m.jsx("div",{ref:i,className:le("",n),children:m.jsx(n1,{barCount:5,state:t,options:{minHeight:5},trackRef:e,className:le("flex aspect-video w-40 items-center justify-center gap-1"),children:m.jsx("span",{className:le(["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]"])})})}),m6=({videoTrack:t,className:e,ref:n})=>{var i,r;return m.jsx("div",{ref:n,className:le(e),children:m.jsx(th,{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"})})},p6=ge.create(th),g6=({trackRef:t,className:e,ref:n})=>{var i,r;return m.jsx("div",{className:le("bg-muted overflow-hidden rounded-md",e),children:m.jsx(p6,{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:le("h-full w-auto")})})},ig=ge.create(g6),v6=ge.create(f6),y6=ge.create(m6),wn={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},Ji={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 b6(t){const{localParticipant:e}=BI(),n=e.getTrackPublication(t);return R.useMemo(()=>n?{source:t,participant:e,publication:n}:void 0,[t,n,e])}function x6({chatOpen:t}){const{state:e,audioTrack:n,videoTrack:i,agent:{isActive:r=!1}={}}=e1(),[s]=eh([D.Source.ScreenShare]),o=b6(D.Source.Camera),a=o&&!o.publication.isMuted,c=s&&!s.publication.isMuted,l=a||c,d={...wn.transition,delay:t?0:.15},u={...wn.animate,scale:t?1:3,transition:d},h={...wn.animate,transition:d},p=d,g=d,f=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:le(Ji.grid),children:[r&&m.jsx("div",{className:le(["grid",!t&&Ji.agentChatClosed,t&&l&&Ji.agentChatOpenWithSecondTile,t&&!l&&Ji.agentChatOpenWithoutSecondTile]),children:m.jsxs("div",{className:"h-full flex items-center justify-center",children:[!f&&m.jsx(v6,{layoutId:"agent",...wn,animate:u,transition:p,state:e,audioTrack:n,className:le(t?"h-[90px]":"h-auto w-full")},"agent"),f&&m.jsx(y6,{layoutId:"avatar",...wn,animate:h,transition:g,videoTrack:i,className:le(t?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),m.jsx("div",{className:le(["grid",t&&Ji.secondTileChatOpen,!t&&Ji.secondTileChatClosed]),children:m.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&m.jsx(ig,{layout:"position",layoutId:"camera",...wn,trackRef:o,transition:{...wn.transition,delay:t?0:.15},className:"h-[60px] order-1"},"camera"),c&&m.jsx(ig,{layout:"position",layoutId:"screen",...wn,trackRef:s,transition:{...wn.transition,delay:t?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}/**
79
89
  * @license lucide-react v0.522.0 - ISC
80
90
  *
81
91
  * This source code is licensed under the ISC license.
82
92
  * 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};/**
93
+ */const S6=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),w6=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),rg=t=>{const e=w6(t);return e.charAt(0).toUpperCase()+e.slice(1)},Fx=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),k6=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
84
94
  * @license lucide-react v0.522.0 - ISC
85
95
  *
86
96
  * This source code is licensed under the ISC license.
87
97
  * 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"};/**
98
+ */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
99
  * @license lucide-react v0.522.0 - ISC
90
100
  *
91
101
  * This source code is licensed under the ISC license.
92
102
  * 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]]));/**
103
+ */const T6=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:Fx("lucide",r),...!s&&!k6(a)&&{"aria-hidden":"true"},...a},[...o.map(([l,d])=>R.createElement(l,d)),...Array.isArray(s)?s:[s]]));/**
94
104
  * @license lucide-react v0.522.0 - ISC
95
105
  *
96
106
  * This source code is licensed under the ISC license.
97
107
  * 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};/**
108
+ */const ht=(t,e)=>{const n=R.forwardRef(({className:i,...r},s)=>R.createElement(T6,{ref:s,iconNode:e,className:Fx(`lucide-${S6(rg(t))}`,`lucide-${t}`,i),...r}));return n.displayName=rg(t),n};/**
99
109
  * @license lucide-react v0.522.0 - ISC
100
110
  *
101
111
  * This source code is licensed under the ISC license.
102
112
  * 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);/**
113
+ */const E6=[["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"}]],P6=ht("archive",E6);/**
104
114
  * @license lucide-react v0.522.0 - ISC
105
115
  *
106
116
  * This source code is licensed under the ISC license.
107
117
  * 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);/**
118
+ */const R6=[["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"}]],Ux=ht("camera-off",R6);/**
109
119
  * @license lucide-react v0.522.0 - ISC
110
120
  *
111
121
  * This source code is licensed under the ISC license.
112
122
  * 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);/**
123
+ */const A6=[["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"}]],Bx=ht("camera",A6);/**
114
124
  * @license lucide-react v0.522.0 - ISC
115
125
  *
116
126
  * This source code is licensed under the ISC license.
117
127
  * 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);/**
128
+ */const I6=[["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"}]],M6=ht("download",I6);/**
119
129
  * @license lucide-react v0.522.0 - ISC
120
130
  *
121
131
  * This source code is licensed under the ISC license.
122
132
  * 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);/**
133
+ */const N6=[["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=ht("file-text",N6);/**
124
134
  * @license lucide-react v0.522.0 - ISC
125
135
  *
126
136
  * This source code is licensed under the ISC license.
127
137
  * 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);/**
138
+ */const O6=[["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"}]],D6=ht("image",O6);/**
129
139
  * @license lucide-react v0.522.0 - ISC
130
140
  *
131
141
  * This source code is licensed under the ISC license.
132
142
  * 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);/**
143
+ */const j6=[["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"}]],L6=ht("layout-grid",j6);/**
134
144
  * @license lucide-react v0.522.0 - ISC
135
145
  *
136
146
  * This source code is licensed under the ISC license.
137
147
  * 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);/**
148
+ */const V6=[["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"}]],F6=ht("monitor-off",V6);/**
139
149
  * @license lucide-react v0.522.0 - ISC
140
150
  *
141
151
  * This source code is licensed under the ISC license.
142
152
  * 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);/**
153
+ */const U6=[["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"}]],B6=ht("monitor",U6);/**
144
154
  * @license lucide-react v0.522.0 - ISC
145
155
  *
146
156
  * This source code is licensed under the ISC license.
147
157
  * 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);/**
158
+ */const $6=[["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"}]],H6=ht("music",$6);/**
149
159
  * @license lucide-react v0.522.0 - ISC
150
160
  *
151
161
  * This source code is licensed under the ISC license.
152
162
  * 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);/**
163
+ */const z6=[["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"}]],W6=ht("paperclip",z6);/**
154
164
  * @license lucide-react v0.522.0 - ISC
155
165
  *
156
166
  * This source code is licensed under the ISC license.
157
167
  * 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);/**
168
+ */const q6=[["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"}]],$x=ht("phone-off",q6);/**
159
169
  * @license lucide-react v0.522.0 - ISC
160
170
  *
161
171
  * This source code is licensed under the ISC license.
162
172
  * 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);/**
173
+ */const K6=[["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"}]],G6=ht("send-horizontal",K6);/**
164
174
  * @license lucide-react v0.522.0 - ISC
165
175
  *
166
176
  * This source code is licensed under the ISC license.
167
177
  * 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);/**
178
+ */const Z6=[["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"}]],Y6=ht("user",Z6);/**
169
179
  * @license lucide-react v0.522.0 - ISC
170
180
  *
171
181
  * This source code is licensed under the ISC license.
172
182
  * 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);/**
183
+ */const J6=[["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"}]],X6=ht("users",J6);/**
174
184
  * @license lucide-react v0.522.0 - ISC
175
185
  *
176
186
  * This source code is licensed under the ISC license.
177
187
  * 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);/**
188
+ */const Q6=[["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"}]],eO=ht("video",Q6);/**
179
189
  * @license lucide-react v0.522.0 - ISC
180
190
  *
181
191
  * This source code is licensed under the ISC license.
182
192
  * 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:`
193
+ */const tO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nO=ht("x",tO);function sg({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(ge.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 _r({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(yr,{children:m.jsxs(ge.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(sg,{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(nO,{className:"w-5 h-5"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o()})]})});case"embedded":default:return m.jsx(yr,{children:m.jsx(ge.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(sg,{timeout:t.timeout}),o()]})})})}}function iO(){const t=eM(),e=WI(),n=Bs();return{messages:R.useMemo(()=>[...t.map(s=>u4(s,n)),...e.chatMessages].sort((s,o)=>s.timestamp-o.timestamp),[t,e.chatMessages,n]),send:e.send}}const rO=({logLevel:t}={})=>{const e=Bs();v.useEffect(()=>(kk(t??"debug"),window.__lk_room=e,()=>{window.__lk_room=void 0}),[e,t])},og=t=>t,sO=()=>{let t=og;return{configure(e){t=e},generate(e){return t(e)},reset(){t=og}}},oO=sO();function ai(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 Bi(t){if(typeof t!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":ai(7));return t.charAt(0).toUpperCase()+t.slice(1)}function aO(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mo={exports:{}},po={exports:{}},Ce={};/** @license React v16.13.1
194
+ * react-is.production.min.js
195
+ *
196
+ * Copyright (c) Facebook, Inc. and its affiliates.
197
+ *
198
+ * This source code is licensed under the MIT license found in the
199
+ * LICENSE file in the root directory of this source tree.
200
+ */var ag;function cO(){if(ag)return Ce;ag=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,h=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,g=t?Symbol.for("react.lazy"):60116,f=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 k(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 k(x)===l}return Ce.AsyncMode=c,Ce.ConcurrentMode=l,Ce.ContextConsumer=a,Ce.ContextProvider=o,Ce.Element=e,Ce.ForwardRef=d,Ce.Fragment=i,Ce.Lazy=g,Ce.Memo=p,Ce.Portal=n,Ce.Profiler=s,Ce.StrictMode=r,Ce.Suspense=u,Ce.isAsyncMode=function(x){return S(x)||k(x)===c},Ce.isConcurrentMode=S,Ce.isContextConsumer=function(x){return k(x)===a},Ce.isContextProvider=function(x){return k(x)===o},Ce.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===e},Ce.isForwardRef=function(x){return k(x)===d},Ce.isFragment=function(x){return k(x)===i},Ce.isLazy=function(x){return k(x)===g},Ce.isMemo=function(x){return k(x)===p},Ce.isPortal=function(x){return k(x)===n},Ce.isProfiler=function(x){return k(x)===s},Ce.isStrictMode=function(x){return k(x)===r},Ce.isSuspense=function(x){return k(x)===u},Ce.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===i||x===l||x===s||x===r||x===u||x===h||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===f)},Ce.typeOf=k,Ce}var Te={};/** @license React v16.13.1
201
+ * react-is.development.js
202
+ *
203
+ * Copyright (c) Facebook, Inc. and its affiliates.
204
+ *
205
+ * This source code is licensed under the MIT license found in the
206
+ * LICENSE file in the root directory of this source tree.
207
+ */var cg;function lO(){return cg||(cg=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,h=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,g=t?Symbol.for("react.lazy"):60116,f=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 k(H){return typeof H=="string"||typeof H=="function"||H===i||H===l||H===s||H===r||H===u||H===h||typeof H=="object"&&H!==null&&(H.$$typeof===g||H.$$typeof===p||H.$$typeof===o||H.$$typeof===a||H.$$typeof===d||H.$$typeof===y||H.$$typeof===b||H.$$typeof===w||H.$$typeof===f)}function S(H){if(typeof H=="object"&&H!==null){var ue=H.$$typeof;switch(ue){case e:var Se=H.type;switch(Se){case c:case l:case i:case s:case r:case u:return Se;default:var rt=Se&&Se.$$typeof;switch(rt){case a:case d:case g:case p:case o:return rt;default:return ue}}case n:return ue}}}var x=c,T=l,E=a,P=o,M=e,C=d,I=i,N=g,Z=p,Q=n,se=s,te=r,Y=u,_=!1;function ie(H){return _||(_=!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(H)||S(H)===c}function L(H){return S(H)===l}function F(H){return S(H)===a}function ee(H){return S(H)===o}function j(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function W(H){return S(H)===d}function J(H){return S(H)===i}function K(H){return S(H)===g}function O(H){return S(H)===p}function $(H){return S(H)===n}function X(H){return S(H)===s}function z(H){return S(H)===r}function oe(H){return S(H)===u}Te.AsyncMode=x,Te.ConcurrentMode=T,Te.ContextConsumer=E,Te.ContextProvider=P,Te.Element=M,Te.ForwardRef=C,Te.Fragment=I,Te.Lazy=N,Te.Memo=Z,Te.Portal=Q,Te.Profiler=se,Te.StrictMode=te,Te.Suspense=Y,Te.isAsyncMode=ie,Te.isConcurrentMode=L,Te.isContextConsumer=F,Te.isContextProvider=ee,Te.isElement=j,Te.isForwardRef=W,Te.isFragment=J,Te.isLazy=K,Te.isMemo=O,Te.isPortal=$,Te.isProfiler=X,Te.isStrictMode=z,Te.isSuspense=oe,Te.isValidElementType=k,Te.typeOf=S}()),Te}var lg;function Hx(){return lg||(lg=1,process.env.NODE_ENV==="production"?po.exports=cO():po.exports=lO()),po.exports}/*
208
+ object-assign
209
+ (c) Sindre Sorhus
210
+ @license MIT
211
+ */var il,dg;function dO(){if(dg)return il;dg=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 il=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 h=0;h<l.length;h++)n.call(a,l[h])&&(c[l[h]]=a[l[h]])}}return c},il}var rl,ug;function vh(){if(ug)return rl;ug=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return rl=t,rl}var sl,hg;function zx(){return hg||(hg=1,sl=Function.call.bind(Object.prototype.hasOwnProperty)),sl}var ol,fg;function uO(){if(fg)return ol;fg=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var e=vh(),n={},i=zx();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 h=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 h.name="Invariant Violation",h}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 al,mg;function hO(){if(mg)return al;mg=1;var t=Hx(),e=dO(),n=vh(),i=zx(),r=uO(),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 al=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 h="<<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:k,element:S(),elementType:x(),instanceOf:T,node:C(),objectOf:P,oneOf:E,oneOfType:M,shape:N,exact:Z};function g(L,F){return L===F?L!==0||1/L===1/F:L!==L&&F!==F}function f(L,F){this.message=L,this.data=F&&typeof F=="object"?F:{},this.stack=""}f.prototype=Error.prototype;function y(L){if(process.env.NODE_ENV!=="production")var F={},ee=0;function j(J,K,O,$,X,z,oe){if($=$||h,z=z||O,oe!==n){if(c){var H=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 H.name="Invariant Violation",H}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ue=$+":"+O;!F[ue]&&ee<3&&(s("You are manually calling a React.PropTypes validation function for the `"+z+"` 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[ue]=!0,ee++)}}return K[O]==null?J?K[O]===null?new f("The "+X+" `"+z+"` is marked as required "+("in `"+$+"`, but its value is `null`.")):new f("The "+X+" `"+z+"` is marked as required in "+("`"+$+"`, but its value is `undefined`.")):null:L(K,O,$,X,z)}var W=j.bind(null,!1);return W.isRequired=j.bind(null,!0),W}function b(L){function F(ee,j,W,J,K,O){var $=ee[j],X=te($);if(X!==L){var z=Y($);return new f("Invalid "+J+" `"+K+"` of type "+("`"+z+"` supplied to `"+W+"`, expected ")+("`"+L+"`."),{expectedType:L})}return null}return y(F)}function w(){return y(o)}function k(L){function F(ee,j,W,J,K){if(typeof L!="function")return new f("Property `"+K+"` of component `"+W+"` has invalid PropType notation inside arrayOf.");var O=ee[j];if(!Array.isArray(O)){var $=te(O);return new f("Invalid "+J+" `"+K+"` of type "+("`"+$+"` supplied to `"+W+"`, expected an array."))}for(var X=0;X<O.length;X++){var z=L(O,X,W,J,K+"["+X+"]",n);if(z instanceof Error)return z}return null}return y(F)}function S(){function L(F,ee,j,W,J){var K=F[ee];if(!a(K)){var O=te(K);return new f("Invalid "+W+" `"+J+"` of type "+("`"+O+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return y(L)}function x(){function L(F,ee,j,W,J){var K=F[ee];if(!t.isValidElementType(K)){var O=te(K);return new f("Invalid "+W+" `"+J+"` of type "+("`"+O+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return y(L)}function T(L){function F(ee,j,W,J,K){if(!(ee[j]instanceof L)){var O=L.name||h,$=ie(ee[j]);return new f("Invalid "+J+" `"+K+"` of type "+("`"+$+"` supplied to `"+W+"`, expected ")+("instance of `"+O+"`."))}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(ee,j,W,J,K){for(var O=ee[j],$=0;$<L.length;$++)if(g(O,L[$]))return null;var X=JSON.stringify(L,function(oe,H){var ue=Y(H);return ue==="symbol"?String(H):H});return new f("Invalid "+J+" `"+K+"` of value `"+String(O)+"` "+("supplied to `"+W+"`, expected one of "+X+"."))}return y(F)}function P(L){function F(ee,j,W,J,K){if(typeof L!="function")return new f("Property `"+K+"` of component `"+W+"` has invalid PropType notation inside objectOf.");var O=ee[j],$=te(O);if($!=="object")return new f("Invalid "+J+" `"+K+"` of type "+("`"+$+"` supplied to `"+W+"`, expected an object."));for(var X in O)if(i(O,X)){var z=L(O,X,W,J,K+"."+X,n);if(z instanceof Error)return z}return null}return y(F)}function M(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 ee=L[F];if(typeof ee!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+_(ee)+" at index "+F+"."),o}function j(W,J,K,O,$){for(var X=[],z=0;z<L.length;z++){var oe=L[z],H=oe(W,J,K,O,$,n);if(H==null)return null;H.data&&i(H.data,"expectedType")&&X.push(H.data.expectedType)}var ue=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new f("Invalid "+O+" `"+$+"` supplied to "+("`"+K+"`"+ue+"."))}return y(j)}function C(){function L(F,ee,j,W,J){return Q(F[ee])?null:new f("Invalid "+W+" `"+J+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return y(L)}function I(L,F,ee,j,W){return new f((L||"React class")+": "+F+" type `"+ee+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+W+"`.")}function N(L){function F(ee,j,W,J,K){var O=ee[j],$=te(O);if($!=="object")return new f("Invalid "+J+" `"+K+"` of type `"+$+"` "+("supplied to `"+W+"`, expected `object`."));for(var X in L){var z=L[X];if(typeof z!="function")return I(W,J,K,X,Y(z));var oe=z(O,X,W,J,K+"."+X,n);if(oe)return oe}return null}return y(F)}function Z(L){function F(ee,j,W,J,K){var O=ee[j],$=te(O);if($!=="object")return new f("Invalid "+J+" `"+K+"` of type `"+$+"` "+("supplied to `"+W+"`, expected `object`."));var X=e({},ee[j],L);for(var z in X){var oe=L[z];if(i(L,z)&&typeof oe!="function")return I(W,J,K,z,Y(oe));if(!oe)return new f("Invalid "+J+" `"+K+"` key `"+z+"` supplied to `"+W+"`.\nBad object: "+JSON.stringify(ee[j],null," ")+`
212
+ Valid keys: `+JSON.stringify(Object.keys(L),null," "));var H=oe(O,z,W,J,K+"."+z,n);if(H)return H}return null}return y(F)}function Q(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(Q);if(L===null||a(L))return!0;var F=u(L);if(F){var ee=F.call(L),j;if(F!==L.entries){for(;!(j=ee.next()).done;)if(!Q(j.value))return!1}else for(;!(j=ee.next()).done;){var W=j.value;if(W&&!Q(W[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 te(L){var F=typeof L;return Array.isArray(L)?"array":L instanceof RegExp?"object":se(F,L)?"symbol":F}function Y(L){if(typeof L>"u"||L===null)return""+L;var F=te(L);if(F==="object"){if(L instanceof Date)return"date";if(L instanceof RegExp)return"regexp"}return F}function _(L){var F=Y(L);switch(F){case"array":case"object":return"an "+F;case"boolean":case"date":case"regexp":return"a "+F;default:return F}}function ie(L){return!L.constructor||!L.constructor.name?h:L.constructor.name}return p.checkPropTypes=r,p.resetWarningCache=r.resetWarningCache,p.PropTypes=p,p},al}var cl,pg;function fO(){if(pg)return cl;pg=1;var t=vh();function e(){}function n(){}return n.resetWarningCache=e,cl=function(){function i(o,a,c,l,d,u){if(u!==t){var h=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 h.name="Invariant Violation",h}}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},cl}var gg;function mO(){if(gg)return mo.exports;if(gg=1,process.env.NODE_ENV!=="production"){var t=Hx(),e=!0;mo.exports=hO()(t.isElement,e)}else mo.exports=fO()();return mo.exports}var pO=mO();const xe=aO(pO);function gO(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 go={exports:{}},Ee={};/**
213
+ * @license React
214
+ * react-is.production.js
215
+ *
216
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
217
+ *
218
+ * This source code is licensed under the MIT license found in the
219
+ * LICENSE file in the root directory of this source tree.
220
+ */var vg;function vO(){if(vg)return Ee;vg=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"),h=Symbol.for("react.view_transition"),p=Symbol.for("react.client.reference");function g(f){if(typeof f=="object"&&f!==null){var y=f.$$typeof;switch(y){case t:switch(f=f.type,f){case n:case r:case i:case c:case l:case h:return f;default:switch(f=f&&f.$$typeof,f){case o:case a:case u:case d:return f;case s:return f;default:return y}}case e:return y}}}return Ee.ContextConsumer=s,Ee.ContextProvider=o,Ee.Element=t,Ee.ForwardRef=a,Ee.Fragment=n,Ee.Lazy=u,Ee.Memo=d,Ee.Portal=e,Ee.Profiler=r,Ee.StrictMode=i,Ee.Suspense=c,Ee.SuspenseList=l,Ee.isContextConsumer=function(f){return g(f)===s},Ee.isContextProvider=function(f){return g(f)===o},Ee.isElement=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===t},Ee.isForwardRef=function(f){return g(f)===a},Ee.isFragment=function(f){return g(f)===n},Ee.isLazy=function(f){return g(f)===u},Ee.isMemo=function(f){return g(f)===d},Ee.isPortal=function(f){return g(f)===e},Ee.isProfiler=function(f){return g(f)===r},Ee.isStrictMode=function(f){return g(f)===i},Ee.isSuspense=function(f){return g(f)===c},Ee.isSuspenseList=function(f){return g(f)===l},Ee.isValidElementType=function(f){return typeof f=="string"||typeof f=="function"||f===n||f===r||f===i||f===c||f===l||typeof f=="object"&&f!==null&&(f.$$typeof===u||f.$$typeof===d||f.$$typeof===o||f.$$typeof===s||f.$$typeof===a||f.$$typeof===p||f.getModuleId!==void 0)},Ee.typeOf=g,Ee}var Pe={};/**
221
+ * @license React
222
+ * react-is.development.js
223
+ *
224
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
225
+ *
226
+ * This source code is licensed under the MIT license found in the
227
+ * LICENSE file in the root directory of this source tree.
228
+ */var yg;function yO(){return yg||(yg=1,process.env.NODE_ENV!=="production"&&function(){function t(f){if(typeof f=="object"&&f!==null){var y=f.$$typeof;switch(y){case e:switch(f=f.type,f){case i:case s:case r:case l:case d:case p:return f;default:switch(f=f&&f.$$typeof,f){case a:case c:case h:case u:return f;case o:return f;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"),h=Symbol.for("react.lazy"),p=Symbol.for("react.view_transition"),g=Symbol.for("react.client.reference");Pe.ContextConsumer=o,Pe.ContextProvider=a,Pe.Element=e,Pe.ForwardRef=c,Pe.Fragment=i,Pe.Lazy=h,Pe.Memo=u,Pe.Portal=n,Pe.Profiler=s,Pe.StrictMode=r,Pe.Suspense=l,Pe.SuspenseList=d,Pe.isContextConsumer=function(f){return t(f)===o},Pe.isContextProvider=function(f){return t(f)===a},Pe.isElement=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===e},Pe.isForwardRef=function(f){return t(f)===c},Pe.isFragment=function(f){return t(f)===i},Pe.isLazy=function(f){return t(f)===h},Pe.isMemo=function(f){return t(f)===u},Pe.isPortal=function(f){return t(f)===n},Pe.isProfiler=function(f){return t(f)===s},Pe.isStrictMode=function(f){return t(f)===r},Pe.isSuspense=function(f){return t(f)===l},Pe.isSuspenseList=function(f){return t(f)===d},Pe.isValidElementType=function(f){return typeof f=="string"||typeof f=="function"||f===i||f===s||f===r||f===l||f===d||typeof f=="object"&&f!==null&&(f.$$typeof===h||f.$$typeof===u||f.$$typeof===a||f.$$typeof===o||f.$$typeof===c||f.$$typeof===g||f.getModuleId!==void 0)},Pe.typeOf=t}()),Pe}var bg;function bO(){return bg||(bg=1,process.env.NODE_ENV==="production"?go.exports=vO():go.exports=yO()),go.exports}var ga=bO();function In(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 Wx(t){if(v.isValidElement(t)||ga.isValidElementType(t)||!In(t))return t;const e={};return Object.keys(t).forEach(n=>{e[n]=Wx(t[n])}),e}function At(t,e,n={clone:!0}){const i=n.clone?{...t}:t;return In(t)&&In(e)&&Object.keys(e).forEach(r=>{v.isValidElement(e[r])||ga.isValidElementType(e[r])?i[r]=e[r]:In(e[r])&&Object.prototype.hasOwnProperty.call(t,r)&&In(t[r])?i[r]=At(t[r],e[r],n):n.clone?i[r]=In(e[r])?Wx(e[r]):e[r]:i[r]=e[r]}),i}function vs(t,e){return e?At(t,e,{clone:!1}):t}const gi=process.env.NODE_ENV!=="production"?xe.oneOfType([xe.number,xe.string,xe.object,xe.array]):{};function xg(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 xO(t,e){return e==="@"||e.startsWith("@")&&(t.some(n=>e.startsWith(`@${n}`))||!!e.match(/^@\d/))}function SO(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>\`.
229
+ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:ai(18,`(${e})`));return null}const[,i,r]=n,s=Number.isNaN(+i)?i||0:+i;return t.containerQueries(r).up(s)}function wO(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 Ba={xs:0,sm:600,md:900,lg:1200,xl:1536},Sg={keys:["xs","sm","md","lg","xl"],up:t=>`@media (min-width:${Ba[t]}px)`},kO={containerQueries:t=>({up:e=>{let n=typeof e=="number"?e:Ba[e]||e;return typeof n=="number"&&(n=`${n}px`),t?`@container ${t} (min-width:${n})`:`@container (min-width:${n})`}})};function Vn(t,e,n){const i=t.theme||{};if(Array.isArray(e)){const s=i.breakpoints||Sg;return e.reduce((o,a,c)=>(o[s.up(s.keys[c])]=n(e[c]),o),{})}if(typeof e=="object"){const s=i.breakpoints||Sg;return Object.keys(e).reduce((o,a)=>{if(xO(s.keys,a)){const c=SO(i.containerQueries?i:kO,a);c&&(o[c]=n(e[a],a))}else if(Object.keys(s.values||Ba).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 CO(t={}){var n;return((n=t.keys)==null?void 0:n.reduce((i,r)=>{const s=t.up(r);return i[s]={},i},{}))||{}}function wg(t,e){return t.reduce((n,i)=>{const r=n[i];return(!r||Object.keys(r).length===0)&&delete n[i],n},e)}function $a(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 va(t,e,n,i=n){let r;return typeof t=="function"?r=t(n):Array.isArray(t)?r=t[n]||i:r=$a(t,n)||i,e&&(r=e(r,i,t)),r}function Ze(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=$a(c,i)||{};return Vn(o,a,u=>{let h=va(l,r,u);return u===h&&typeof u=="string"&&(h=va(l,r,`${e}${u==="default"?"":Bi(u)}`,u)),n===!1?h:{[n]:h}})};return s.propTypes=process.env.NODE_ENV!=="production"?{[e]:gi}:{},s.filterProps=[e],s}function TO(t){const e={};return n=>(e[n]===void 0&&(e[n]=t(n)),e[n])}const EO={m:"margin",p:"padding"},PO={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},kg={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},RO=TO(t=>{if(t.length>2)if(kg[t])t=kg[t];else return[t];const[e,n]=t.split(""),i=EO[e],r=PO[n]||"";return Array.isArray(r)?r.map(s=>i+s):[i+r]}),Ha=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],za=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],AO=[...Ha,...za];function zs(t,e,n,i){const r=$a(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(`
230
+ `)):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(`
231
+ `)));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(`
232
+ `)),()=>{})}function yh(t){return zs(t,"spacing",8,"spacing")}function Ws(t,e){return typeof e=="string"||e==null?e:t(e)}function IO(t,e){return n=>t.reduce((i,r)=>(i[r]=Ws(e,n),i),{})}function MO(t,e,n,i){if(!e.includes(n))return null;const r=RO(n),s=IO(r,i),o=t[n];return Vn(t,o,s)}function qx(t,e){const n=yh(t.theme);return Object.keys(t).map(i=>MO(t,e,i,n)).reduce(vs,{})}function Ue(t){return qx(t,Ha)}Ue.propTypes=process.env.NODE_ENV!=="production"?Ha.reduce((t,e)=>(t[e]=gi,t),{}):{};Ue.filterProps=Ha;function Be(t){return qx(t,za)}Be.propTypes=process.env.NODE_ENV!=="production"?za.reduce((t,e)=>(t[e]=gi,t),{}):{};Be.filterProps=za;process.env.NODE_ENV!=="production"&&AO.reduce((t,e)=>(t[e]=gi,t),{});function Wa(...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]?vs(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 Ot(t){return typeof t!="number"?t:`${t}px solid`}function Vt(t,e){return Ze({prop:t,themeKey:"borders",transform:e})}const NO=Vt("border",Ot),_O=Vt("borderTop",Ot),OO=Vt("borderRight",Ot),DO=Vt("borderBottom",Ot),jO=Vt("borderLeft",Ot),LO=Vt("borderColor"),VO=Vt("borderTopColor"),FO=Vt("borderRightColor"),UO=Vt("borderBottomColor"),BO=Vt("borderLeftColor"),$O=Vt("outline",Ot),HO=Vt("outlineColor"),qa=t=>{if(t.borderRadius!==void 0&&t.borderRadius!==null){const e=zs(t.theme,"shape.borderRadius",4,"borderRadius"),n=i=>({borderRadius:Ws(e,i)});return Vn(t,t.borderRadius,n)}return null};qa.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:gi}:{};qa.filterProps=["borderRadius"];Wa(NO,_O,OO,DO,jO,LO,VO,FO,UO,BO,qa,$O,HO);const Ka=t=>{if(t.gap!==void 0&&t.gap!==null){const e=zs(t.theme,"spacing",8,"gap"),n=i=>({gap:Ws(e,i)});return Vn(t,t.gap,n)}return null};Ka.propTypes=process.env.NODE_ENV!=="production"?{gap:gi}:{};Ka.filterProps=["gap"];const Ga=t=>{if(t.columnGap!==void 0&&t.columnGap!==null){const e=zs(t.theme,"spacing",8,"columnGap"),n=i=>({columnGap:Ws(e,i)});return Vn(t,t.columnGap,n)}return null};Ga.propTypes=process.env.NODE_ENV!=="production"?{columnGap:gi}:{};Ga.filterProps=["columnGap"];const Za=t=>{if(t.rowGap!==void 0&&t.rowGap!==null){const e=zs(t.theme,"spacing",8,"rowGap"),n=i=>({rowGap:Ws(e,i)});return Vn(t,t.rowGap,n)}return null};Za.propTypes=process.env.NODE_ENV!=="production"?{rowGap:gi}:{};Za.filterProps=["rowGap"];const zO=Ze({prop:"gridColumn"}),WO=Ze({prop:"gridRow"}),qO=Ze({prop:"gridAutoFlow"}),KO=Ze({prop:"gridAutoColumns"}),GO=Ze({prop:"gridAutoRows"}),ZO=Ze({prop:"gridTemplateColumns"}),YO=Ze({prop:"gridTemplateRows"}),JO=Ze({prop:"gridTemplateAreas"}),XO=Ze({prop:"gridArea"});Wa(Ka,Ga,Za,zO,WO,qO,KO,GO,ZO,YO,JO,XO);function kr(t,e){return e==="grey"?e:t}const QO=Ze({prop:"color",themeKey:"palette",transform:kr}),eD=Ze({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:kr}),tD=Ze({prop:"backgroundColor",themeKey:"palette",transform:kr});Wa(QO,eD,tD);function Et(t){return t<=1&&t!==0?`${t*100}%`:t}const nD=Ze({prop:"width",transform:Et}),bh=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])||Ba[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:Et(n)}};return Vn(t,t.maxWidth,e)}return null};bh.filterProps=["maxWidth"];const iD=Ze({prop:"minWidth",transform:Et}),rD=Ze({prop:"height",transform:Et}),sD=Ze({prop:"maxHeight",transform:Et}),oD=Ze({prop:"minHeight",transform:Et});Ze({prop:"size",cssProperty:"width",transform:Et});Ze({prop:"size",cssProperty:"height",transform:Et});const aD=Ze({prop:"boxSizing"});Wa(nD,bh,iD,rD,sD,oD,aD);const Ya={border:{themeKey:"borders",transform:Ot},borderTop:{themeKey:"borders",transform:Ot},borderRight:{themeKey:"borders",transform:Ot},borderBottom:{themeKey:"borders",transform:Ot},borderLeft:{themeKey:"borders",transform:Ot},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Ot},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:qa},color:{themeKey:"palette",transform:kr},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:kr},backgroundColor:{themeKey:"palette",transform:kr},p:{style:Be},pt:{style:Be},pr:{style:Be},pb:{style:Be},pl:{style:Be},px:{style:Be},py:{style:Be},padding:{style:Be},paddingTop:{style:Be},paddingRight:{style:Be},paddingBottom:{style:Be},paddingLeft:{style:Be},paddingX:{style:Be},paddingY:{style:Be},paddingInline:{style:Be},paddingInlineStart:{style:Be},paddingInlineEnd:{style:Be},paddingBlock:{style:Be},paddingBlockStart:{style:Be},paddingBlockEnd:{style:Be},m:{style:Ue},mt:{style:Ue},mr:{style:Ue},mb:{style:Ue},ml:{style:Ue},mx:{style:Ue},my:{style:Ue},margin:{style:Ue},marginTop:{style:Ue},marginRight:{style:Ue},marginBottom:{style:Ue},marginLeft:{style:Ue},marginX:{style:Ue},marginY:{style:Ue},marginInline:{style:Ue},marginInlineStart:{style:Ue},marginInlineEnd:{style:Ue},marginBlock:{style:Ue},marginBlockStart:{style:Ue},marginBlockEnd:{style:Ue},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:Ka},rowGap:{style:Za},columnGap:{style:Ga},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Et},maxWidth:{style:bh},minWidth:{transform:Et},height:{transform:Et},maxHeight:{transform:Et},minHeight:{transform:Et},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 cD(...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 lD(t,e){return typeof t=="function"?t(e):t}function dD(){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 h=$a(r,l)||{};return u?u(o):Vn(o,i,g=>{let f=va(h,d,g);return g===f&&typeof g=="string"&&(f=va(h,d,`${n}${g==="default"?"":Bi(g)}`,g)),c===!1?f:{[c]:f}})}function e(n){const{sx:i,theme:r={},nested:s}=n||{};if(!i)return null;const o=r.unstable_sxConfig??Ya;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=CO(r.breakpoints),u=Object.keys(d);let h=d;return Object.keys(l).forEach(p=>{const g=lD(l[p],r);if(g!=null)if(typeof g=="object")if(o[p])h=vs(h,t(p,g,r,o));else{const f=Vn({theme:r},g,y=>({[p]:y}));cD(f,g)?h[p]=e({sx:g,theme:r,nested:!0}):h=vs(h,f)}else h=vs(h,t(p,g,r,o))}),!s&&r.modularCssLayers?{"@layer sx":xg(r,wg(u,h))}:xg(r,wg(u,h))}return Array.isArray(i)?i.map(a):a(i)}return e}const Or=dD();Or.filterProps=["sx"];function Ld(){return Ld=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},Ld.apply(null,arguments)}function uD(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 hD(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 fD=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(hD(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var s=uD(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}(),ft="-ms-",ya="-moz-",we="-webkit-",Kx="comm",xh="rule",Sh="decl",mD="@import",Gx="@keyframes",pD="@layer",gD=Math.abs,Ja=String.fromCharCode,vD=Object.assign;function yD(t,e){return ct(t,0)^45?(((e<<2^ct(t,0))<<2^ct(t,1))<<2^ct(t,2))<<2^ct(t,3):0}function Zx(t){return t.trim()}function bD(t,e){return(t=e.exec(t))?t[0]:t}function ke(t,e,n){return t.replace(e,n)}function Vd(t,e){return t.indexOf(e)}function ct(t,e){return t.charCodeAt(e)|0}function Ns(t,e,n){return t.slice(e,n)}function sn(t){return t.length}function wh(t){return t.length}function vo(t,e){return e.push(t),t}function xD(t,e){return t.map(e).join("")}var Xa=1,Dr=1,Yx=0,kt=0,Qe=0,qr="";function Qa(t,e,n,i,r,s,o){return{value:t,root:e,parent:n,type:i,props:r,children:s,line:Xa,column:Dr,length:o,return:""}}function ns(t,e){return vD(Qa("",null,null,"",null,null,0),t,{length:-t.length},e)}function SD(){return Qe}function wD(){return Qe=kt>0?ct(qr,--kt):0,Dr--,Qe===10&&(Dr=1,Xa--),Qe}function It(){return Qe=kt<Yx?ct(qr,kt++):0,Dr++,Qe===10&&(Dr=1,Xa++),Qe}function fn(){return ct(qr,kt)}function Ho(){return kt}function qs(t,e){return Ns(qr,t,e)}function _s(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 Jx(t){return Xa=Dr=1,Yx=sn(qr=t),kt=0,[]}function Xx(t){return qr="",t}function zo(t){return Zx(qs(kt-1,Fd(t===91?t+2:t===40?t+1:t)))}function kD(t){for(;(Qe=fn())&&Qe<33;)It();return _s(t)>2||_s(Qe)>3?"":" "}function CD(t,e){for(;--e&&It()&&!(Qe<48||Qe>102||Qe>57&&Qe<65||Qe>70&&Qe<97););return qs(t,Ho()+(e<6&&fn()==32&&It()==32))}function Fd(t){for(;It();)switch(Qe){case t:return kt;case 34:case 39:t!==34&&t!==39&&Fd(Qe);break;case 40:t===41&&Fd(t);break;case 92:It();break}return kt}function TD(t,e){for(;It()&&t+Qe!==57;)if(t+Qe===84&&fn()===47)break;return"/*"+qs(e,kt-1)+"*"+Ja(t===47?t:It())}function ED(t){for(;!_s(fn());)It();return qs(t,kt)}function PD(t){return Xx(Wo("",null,null,null,[""],t=Jx(t),0,[0],t))}function Wo(t,e,n,i,r,s,o,a,c){for(var l=0,d=0,u=o,h=0,p=0,g=0,f=1,y=1,b=1,w=0,k="",S=r,x=s,T=i,E=k;y;)switch(g=w,w=It()){case 40:if(g!=108&&ct(E,u-1)==58){Vd(E+=ke(zo(w),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:E+=zo(w);break;case 9:case 10:case 13:case 32:E+=kD(g);break;case 92:E+=CD(Ho()-1,7);continue;case 47:switch(fn()){case 42:case 47:vo(RD(TD(It(),Ho()),e,n),c);break;default:E+="/"}break;case 123*f:a[l++]=sn(E)*b;case 125*f:case 59:case 0:switch(w){case 0:case 125:y=0;case 59+d:b==-1&&(E=ke(E,/\f/g,"")),p>0&&sn(E)-u&&vo(p>32?Tg(E+";",i,n,u-1):Tg(ke(E," ","")+";",i,n,u-2),c);break;case 59:E+=";";default:if(vo(T=Cg(E,e,n,l,d,r,a,k,S=[],x=[],u),s),w===123)if(d===0)Wo(E,e,T,T,S,s,u,a,x);else switch(h===99&&ct(E,3)===110?100:h){case 100:case 108:case 109:case 115:Wo(t,T,T,i&&vo(Cg(t,T,T,0,0,r,a,k,r,S=[],u),x),r,x,u,a,i?S:x);break;default:Wo(E,T,T,T,[""],x,0,a,x)}}l=d=p=0,f=b=1,k=E="",u=o;break;case 58:u=1+sn(E),p=g;default:if(f<1){if(w==123)--f;else if(w==125&&f++==0&&wD()==125)continue}switch(E+=Ja(w),w*f){case 38:b=d>0?1:(E+="\f",-1);break;case 44:a[l++]=(sn(E)-1)*b,b=1;break;case 64:fn()===45&&(E+=zo(It())),h=fn(),d=u=sn(k=E+=ED(Ho())),w++;break;case 45:g===45&&sn(E)==2&&(f=0)}}return s}function Cg(t,e,n,i,r,s,o,a,c,l,d){for(var u=r-1,h=r===0?s:[""],p=wh(h),g=0,f=0,y=0;g<i;++g)for(var b=0,w=Ns(t,u+1,u=gD(f=o[g])),k=t;b<p;++b)(k=Zx(f>0?h[b]+" "+w:ke(w,/&\f/g,h[b])))&&(c[y++]=k);return Qa(t,e,n,r===0?xh:a,c,l,d)}function RD(t,e,n){return Qa(t,e,n,Kx,Ja(SD()),Ns(t,2,-2),0)}function Tg(t,e,n,i){return Qa(t,e,n,Sh,Ns(t,0,i),Ns(t,i+1,-1),i)}function Cr(t,e){for(var n="",i=wh(t),r=0;r<i;r++)n+=e(t[r],r,t,e)||"";return n}function AD(t,e,n,i){switch(t.type){case pD:if(t.children.length)break;case mD:case Sh:return t.return=t.return||t.value;case Kx:return"";case Gx:return t.return=t.value+"{"+Cr(t.children,i)+"}";case xh:t.value=t.props.join(",")}return sn(n=Cr(t.children,i))?t.return=t.value+"{"+n+"}":""}function ID(t){var e=wh(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 MD(t){return function(e){e.root||(e=e.return)&&t(e)}}function Qx(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var ND=function(e,n,i){for(var r=0,s=0;r=s,s=fn(),r===38&&s===12&&(n[i]=1),!_s(s);)It();return qs(e,kt)},_D=function(e,n){var i=-1,r=44;do switch(_s(r)){case 0:r===38&&fn()===12&&(n[i]=1),e[i]+=ND(kt-1,n,i);break;case 2:e[i]+=zo(r);break;case 4:if(r===44){e[++i]=fn()===58?"&\f":"",n[i]=e[i].length;break}default:e[i]+=Ja(r)}while(r=It());return e},OD=function(e,n){return Xx(_D(Jx(e),n))},Eg=new WeakMap,DD=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&&!Eg.get(i))&&!r){Eg.set(e,!0);for(var s=[],o=OD(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]}}},jD=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function eS(t,e){switch(yD(t,e)){case 5103:return we+"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 we+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return we+t+ya+t+ft+t+t;case 6828:case 4268:return we+t+ft+t+t;case 6165:return we+t+ft+"flex-"+t+t;case 5187:return we+t+ke(t,/(\w+).+(:[^]+)/,we+"box-$1$2"+ft+"flex-$1$2")+t;case 5443:return we+t+ft+"flex-item-"+ke(t,/flex-|-self/,"")+t;case 4675:return we+t+ft+"flex-line-pack"+ke(t,/align-content|flex-|-self/,"")+t;case 5548:return we+t+ft+ke(t,"shrink","negative")+t;case 5292:return we+t+ft+ke(t,"basis","preferred-size")+t;case 6060:return we+"box-"+ke(t,"-grow","")+we+t+ft+ke(t,"grow","positive")+t;case 4554:return we+ke(t,/([^-])(transform)/g,"$1"+we+"$2")+t;case 6187:return ke(ke(ke(t,/(zoom-|grab)/,we+"$1"),/(image-set)/,we+"$1"),t,"")+t;case 5495:case 3959:return ke(t,/(image-set\([^]*)/,we+"$1$`$1");case 4968:return ke(ke(t,/(.+:)(flex-)?(.*)/,we+"box-pack:$3"+ft+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+we+t+t;case 4095:case 3583:case 4068:case 2532:return ke(t,/(.+)-inline(.+)/,we+"$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(ct(t,e+1)){case 109:if(ct(t,e+4)!==45)break;case 102:return ke(t,/(.+:)(.+)-([^]+)/,"$1"+we+"$2-$3$1"+ya+(ct(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~Vd(t,"stretch")?eS(ke(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(ct(t,e+1)!==115)break;case 6444:switch(ct(t,sn(t)-3-(~Vd(t,"!important")&&10))){case 107:return ke(t,":",":"+we)+t;case 101:return ke(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+we+(ct(t,14)===45?"inline-":"")+"box$3$1"+we+"$2$3$1"+ft+"$2box$3")+t}break;case 5936:switch(ct(t,e+11)){case 114:return we+t+ft+ke(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return we+t+ft+ke(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return we+t+ft+ke(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return we+t+ft+t+t}return t}var LD=function(e,n,i,r){if(e.length>-1&&!e.return)switch(e.type){case Sh:e.return=eS(e.value,e.length);break;case Gx:return Cr([ns(e,{value:ke(e.value,"@","@"+we)})],r);case xh:if(e.length)return xD(e.props,function(s){switch(bD(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Cr([ns(e,{props:[ke(s,/:(read-\w+)/,":"+ya+"$1")]})],r);case"::placeholder":return Cr([ns(e,{props:[ke(s,/:(plac\w+)/,":"+we+"input-$1")]}),ns(e,{props:[ke(s,/:(plac\w+)/,":"+ya+"$1")]}),ns(e,{props:[ke(s,/:(plac\w+)/,ft+"input-$1")]})],r)}return""})}},VD=[LD],FD=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(f){var y=f.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(f),f.setAttribute("data-s",""))})}var r=e.stylisPlugins||VD,s={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(f){for(var y=f.getAttribute("data-emotion").split(" "),b=1;b<y.length;b++)s[y[b]]=!0;a.push(f)});var c,l=[DD,jD];{var d,u=[AD,MD(function(f){d.insert(f)})],h=ID(l.concat(r,u)),p=function(y){return Cr(PD(y),h)};c=function(y,b,w,k){d=w,p(y?y+"{"+b.styles+"}":b.styles),k&&(g.inserted[b.name]=!0)}}var g={key:n,sheet:new fD({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},UD=!0;function BD(t,e,n){var i="";return n.split(" ").forEach(function(r){t[r]!==void 0?e.push(t[r]+";"):r&&(i+=r+" ")}),i}var tS=function(e,n,i){var r=e.key+"-"+n.name;(i===!1||UD===!1)&&e.registered[r]===void 0&&(e.registered[r]=n.styles)},$D=function(e,n,i){tS(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 HD(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 zD={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},WD=/[A-Z]|^ms/g,qD=/_EMO_([^_]+?)_([^]*?)_EMO_/g,nS=function(e){return e.charCodeAt(1)===45},Pg=function(e){return e!=null&&typeof e!="boolean"},ll=Qx(function(t){return nS(t)?t:t.replace(WD,"-$&").toLowerCase()}),Rg=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(qD,function(i,r,s){return on={name:r,styles:s,next:on},r})}return zD[e]!==1&&!nS(e)&&typeof n=="number"&&n!==0?n+"px":n};function Os(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 on={name:r.name,styles:r.styles,next:on},r.name;var s=n;if(s.styles!==void 0){var o=s.next;if(o!==void 0)for(;o!==void 0;)on={name:o.name,styles:o.styles,next:on},o=o.next;var a=s.styles+";";return a}return KD(t,e,n)}case"function":{if(t!==void 0){var c=on,l=n(t);return on=c,Os(t,e,l)}break}}var d=n;if(e==null)return d;var u=e[d];return u!==void 0?u:d}function KD(t,e,n){var i="";if(Array.isArray(n))for(var r=0;r<n.length;r++)i+=Os(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]+"}":Pg(a)&&(i+=ll(s)+":"+Rg(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++)Pg(o[c])&&(i+=ll(s)+":"+Rg(s,o[c])+";");else{var l=Os(t,e,o);switch(s){case"animation":case"animationName":{i+=ll(s)+":"+l+";";break}default:i+=s+"{"+l+"}"}}}return i}var Ag=/label:\s*([^\s;{]+)\s*(;|$)/g,on;function iS(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="";on=void 0;var s=t[0];if(s==null||s.raw===void 0)i=!1,r+=Os(n,e,s);else{var o=s;r+=o[0]}for(var a=1;a<t.length;a++)if(r+=Os(n,e,t[a]),i){var c=s;r+=c[a]}Ag.lastIndex=0;for(var l="",d;(d=Ag.exec(r))!==null;)l+="-"+d[1];var u=HD(r)+l;return{name:u,styles:r,next:on}}var GD=function(e){return e()},ZD=v.useInsertionEffect?v.useInsertionEffect:!1,YD=ZD||GD,rS=v.createContext(typeof HTMLElement<"u"?FD({key:"css"}):null);rS.Provider;var JD=function(e){return R.forwardRef(function(n,i){var r=R.useContext(rS);return e(n,r,i)})},XD=v.createContext({}),QD=/^((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)-.*))$/,e3=Qx(function(t){return QD.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),t3=e3,n3=function(e){return e!=="theme"},Ig=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?t3:n3},Mg=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},i3=function(e){var n=e.cache,i=e.serialized,r=e.isStringTag;return tS(n,i,r),YD(function(){return $D(n,i,r)}),null},r3=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=Mg(e,n,i),c=a||Ig(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 h=d[0];u.push(h[0]);for(var p=d.length,g=1;g<p;g++)u.push(d[g],h[g])}var f=JD(function(y,b,w){var k=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(XD)}typeof y.className=="string"?S=BD(b.registered,x,y.className):y.className!=null&&(S=y.className+" ");var P=iS(u.concat(x),b.registered,T);S+=b.key+"-"+P.name,o!==void 0&&(S+=" "+o);var M=l&&a===void 0?Ig(k):c,C={};for(var I in y)l&&I==="as"||M(I)&&(C[I]=y[I]);return C.className=S,w&&(C.ref=w),v.createElement(v.Fragment,null,v.createElement(i3,{cache:b,serialized:P,isStringTag:typeof k=="string"}),v.createElement(k,C))});return f.displayName=s!==void 0?s:"Styled("+(typeof r=="string"?r:r.displayName||r.name||"Component")+")",f.defaultProps=e.defaultProps,f.__emotion_real=f,f.__emotion_base=r,f.__emotion_styles=u,f.__emotion_forwardProp=a,Object.defineProperty(f,"toString",{value:function(){return"."+o}}),f.withComponent=function(y,b){var w=t(y,Ld({},n,b,{shouldForwardProp:Mg(f,b,!0)}));return w.apply(void 0,u)},f}},s3=["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"],Ud=r3.bind(null);s3.forEach(function(t){Ud[t]=Ud(t)});/**
233
+ * @mui/styled-engine v7.2.0
234
+ *
235
+ * @license MIT
236
+ * This source code is licensed under the MIT license found in the
237
+ * LICENSE file in the root directory of this source tree.
238
+ */function o3(t,e){const n=Ud(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(`
239
+ `)):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 a3(t,e){Array.isArray(t.__emotion_styles)&&(t.__emotion_styles=e(t.__emotion_styles))}const Ng=[];function Mi(t){return Ng[0]=t,iS(Ng)}const c3=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 l3(t){const{values:e={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:i=5,...r}=t,s=c3(e),o=Object.keys(s);function a(h){return`@media (min-width:${typeof e[h]=="number"?e[h]:h}${n})`}function c(h){return`@media (max-width:${(typeof e[h]=="number"?e[h]:h)-i/100}${n})`}function l(h,p){const g=o.indexOf(p);return`@media (min-width:${typeof e[h]=="number"?e[h]:h}${n}) and (max-width:${(g!==-1&&typeof e[o[g]]=="number"?e[o[g]]:p)-i/100}${n})`}function d(h){return o.indexOf(h)+1<o.length?l(h,o[o.indexOf(h)+1]):a(h)}function u(h){const p=o.indexOf(h);return p===0?a(o[1]):p===o.length-1?c(o[p]):l(h,o[o.indexOf(h)+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 d3={borderRadius:4};function sS(t=8,e=yh({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 u3(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 oS(t={},...e){const{breakpoints:n={},palette:i={},spacing:r,shape:s={},...o}=t,a=l3(n),c=sS(r);let l=At({breakpoints:a,direction:"ltr",components:{},palette:{mode:"light",...i},spacing:c,shape:{...d3,...s}},o);return l=wO(l),l.applyStyles=u3,l=e.reduce((d,u)=>At(d,u),l),l.unstable_sxConfig={...Ya,...o==null?void 0:o.unstable_sxConfig},l.unstable_sx=function(u){return Or({sx:u,theme:this})},l}const h3={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 kh(t,e,n="Mui"){const i=h3[e];return i?`${n}-${i}`:`${oO.generate(t)}-${e}`}function f3(t,e,n="Mui"){const i={};return e.forEach(r=>{i[r]=kh(t,r,n)}),i}function aS(t,e=""){return t.displayName||t.name||e}function _g(t,e,n){const i=aS(e);return t.displayName||(i!==""?`${n}(${i})`:n)}function m3(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="function")return aS(t,"Component");if(typeof t=="object")switch(t.$$typeof){case ga.ForwardRef:return _g(t,t.render,"ForwardRef");case ga.Memo:return _g(t,t.type,"memo");default:return}}}function cS(t){const{variants:e,...n}=t,i={variants:e,style:Mi(n),isProcessed:!0};return i.style===n||e&&e.forEach(r=>{typeof r.style!="function"&&(r.style=Mi(r.style))}),i}const p3=oS();function dl(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}function Ei(t,e){return e&&t&&typeof t=="object"&&t.styles&&!t.styles.startsWith("@layer")&&(t.styles=`@layer ${e}{${String(t.styles)}}`),t}function g3(t){return t?(e,n)=>n[t]:null}function v3(t,e,n){t.theme=S3(t.theme)?n:t.theme[e]||t.theme}function qo(t,e,n){const i=typeof e=="function"?e(t):e;if(Array.isArray(i))return i.flatMap(r=>qo(t,r,n));if(Array.isArray(i==null?void 0:i.variants)){let r;if(i.isProcessed)r=n?Ei(i.style,n):i.style;else{const{variants:s,...o}=i;r=n?Ei(Mi(o),n):o}return lS(t,i.variants,[r],n)}return i!=null&&i.isProcessed?n?Ei(Mi(i.style),n):i.style:n?Ei(Mi(i),n):i}function lS(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?Ei(Mi(a.style(r)),i):a.style(r))):n.push(i?Ei(Mi(a.style),i):a.style)}return n}function y3(t={}){const{themeId:e,defaultTheme:n=p3,rootShouldForwardProp:i=dl,slotShouldForwardProp:r=dl}=t;function s(a){v3(a,e,n)}return(a,c={})=>{a3(a,T=>T.filter(E=>E!==Or));const{name:l,slot:d,skipVariantsResolver:u,skipSx:h,overridesResolver:p=g3(dS(d)),...g}=c,f=l&&l.startsWith("Mui")||d?"components":"custom",y=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,b=h||!1;let w=dl;d==="Root"||d==="root"?w=i:d?w=r:w3(a)&&(w=void 0);const k=o3(a,{shouldForwardProp:w,label:x3(l,d),...g}),S=T=>{if(T.__emotion_real===T)return T;if(typeof T=="function")return function(P){return qo(P,T,P.theme.modularCssLayers?f:void 0)};if(In(T)){const E=cS(T);return function(M){return E.variants?qo(M,E,M.theme.modularCssLayers?f:void 0):M.theme.modularCssLayers?Ei(E.style,f):E.style}}return T},x=(...T)=>{const E=[],P=T.map(S),M=[];if(E.push(s),l&&p&&M.push(function(Z){var Y,_;const se=(_=(Y=Z.theme.components)==null?void 0:Y[l])==null?void 0:_.styleOverrides;if(!se)return null;const te={};for(const ie in se)te[ie]=qo(Z,se[ie],Z.theme.modularCssLayers?"theme":void 0);return p(Z,te)}),l&&!y&&M.push(function(Z){var te,Y;const Q=Z.theme,se=(Y=(te=Q==null?void 0:Q.components)==null?void 0:te[l])==null?void 0:Y.variants;return se?lS(Z,se,[],Z.theme.modularCssLayers?"theme":void 0):null}),b||M.push(Or),Array.isArray(P[0])){const N=P.shift(),Z=new Array(E.length).fill(""),Q=new Array(M.length).fill("");let se;se=[...Z,...N,...Q],se.raw=[...Z,...N.raw,...Q],E.unshift(se)}const C=[...E,...P,...M],I=k(...C);return a.muiName&&(I.muiName=a.muiName),process.env.NODE_ENV!=="production"&&(I.displayName=b3(l,d,a)),I};return k.withConfig&&(x.withConfig=k.withConfig),x}}function b3(t,e,n){return t?`${t}${Bi(e||"")}`:`Styled(${m3(n)})`}function x3(t,e){let n;return process.env.NODE_ENV!=="production"&&t&&(n=`${t}-${dS(e||"Root")}`),n}function S3(t){for(const e in t)return!1;return!0}function w3(t){return typeof t=="string"&&t.charCodeAt(0)>96}function dS(t){return t&&t.charAt(0).toLowerCase()+t.slice(1)}function Bd(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]=Bd(o[l],a[l],n)}}}else s==="className"&&n&&e.className?i.className=Na(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 k3(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}function Ch(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}].`),k3(t,e,n)}function C3(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(C3(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.
240
+ The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:ai(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.
241
+ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:ai(10,r))}else i=i.split(",");return i=i.map(s=>parseFloat(s)),{type:n,values:i,colorSpace:r}}const T3=t=>{const e=ci(t);return e.values.slice(0,3).map((n,i)=>e.type.includes("hsl")&&i!==0?`${n}%`:n).join(" ")},cs=(t,e)=>{try{return T3(t)}catch{return e&&process.env.NODE_ENV!=="production"&&console.warn(e),t}};function ec(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 uS(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])),ec({type:a,values:c})}function $d(t){t=ci(t);let e=t.type==="hsl"||t.type==="hsla"?ci(uS(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 Og(t,e){const n=$d(t),i=$d(e);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}function E3(t,e){return t=ci(t),e=Ch(e),(t.type==="rgb"||t.type==="hsl")&&(t.type+="a"),t.type==="color"?t.values[3]=`/${e}`:t.values[3]=e,ec(t)}function yo(t,e,n){try{return E3(t,e)}catch{return t}}function Th(t,e){if(t=ci(t),e=Ch(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 ec(t)}function Ie(t,e,n){try{return Th(t,e)}catch{return t}}function Eh(t,e){if(t=ci(t),e=Ch(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 ec(t)}function Me(t,e,n){try{return Eh(t,e)}catch{return t}}function P3(t,e=.15){return $d(t)>.5?Th(t,e):Eh(t,e)}function bo(t,e,n){try{return P3(t,e)}catch{return t}}const R3=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(xe.node,xe.object);function A3(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?Bd(r.defaultProps,i,e.components.mergeClassNameAndStyle):!r.styleOverrides&&!r.variants?Bd(r,i,e.components.mergeClassNameAndStyle):i}function I3({props:t,name:e}){const n=v.useContext(R3);return A3({props:t,name:e,theme:{components:n}})}const Dg={theme:void 0};function M3(t){let e,n;return function(r){let s=e;return(s===void 0||r.theme!==n)&&(Dg.theme=r.theme,s=cS(t(Dg)),e=s,n=r.theme),s}}function N3(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 jg=(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])})},_3=(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)},O3=(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 ul(t,e){const{prefix:n,shouldSkipGeneratingVar:i}=e||{},r={},s={},o={};return _3(t,(a,c,l)=>{if((typeof c=="string"||typeof c=="number")&&(!i||!i(a,c))){const d=`--${n?`${n}-`:""}${a.join("-")}`,u=O3(a,c);Object.assign(r,{[d]:u}),jg(s,a,`var(${d})`,l),jg(o,a,`var(${d}, ${u})`,l)}},a=>a[0]==="vars"),{css:r,vars:s,varsWithDefaults:o}}function D3(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}=ul(c,e);let h=u;const p={},{[a]:g,...f}=s;if(Object.entries(f||{}).forEach(([k,S])=>{const{vars:x,css:T,varsWithDefaults:E}=ul(S,e);h=At(h,E),p[k]={css:T,vars:x}}),g){const{css:k,vars:S,varsWithDefaults:x}=ul(g,e);h=At(h,x),p[a]={css:k,vars:S}}function y(k,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"]`),k){if(x==="media")return t.defaultColorScheme===k?":root":{[`@media (prefers-color-scheme: ${((E=(T=s[k])==null?void 0:T.palette)==null?void 0:E.mode)||k})`]:{":root":S}};if(x)return t.defaultColorScheme===k?`:root, ${x.replace("%s",String(k))}`:x.replace("%s",String(k))}return":root"}return{vars:h,generateThemeVars:()=>{let k={...l};return Object.entries(p).forEach(([,{vars:S}])=>{k=At(k,S)}),k},generateStyleSheets:()=>{var P,M;const k=[],S=t.defaultColorScheme||"light";function x(C,I){Object.keys(I).length&&k.push(typeof C=="string"?{[C]:{...I}}:C)}x(n(void 0,{...d}),d);const{[S]:T,...E}=p;if(T){const{css:C}=T,I=(M=(P=s[S])==null?void 0:P.palette)==null?void 0:M.mode,N=!i&&I?{colorScheme:I,...C}:{...C};x(n(S,{...N}),N)}return Object.entries(E).forEach(([C,{css:I}])=>{var Q,se;const N=(se=(Q=s[C])==null?void 0:Q.palette)==null?void 0:se.mode,Z=!i&&N?{colorScheme:N,...I}:{...I};x(n(C,{...Z}),Z)}),k}}}function j3(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 Ds={black:"#000",white:"#fff"},L3={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"},Xi={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Qi={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},is={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},er={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},tr={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},nr={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function hS(){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:Ds.white,default:Ds.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 V3=hS();function fS(){return{text:{primary:Ds.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:Ds.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 Lg=fS();function Vg(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=Eh(t.main,r):e==="dark"&&(t.dark=Th(t.main,s)))}function F3(t="light"){return t==="dark"?{main:er[200],light:er[50],dark:er[400]}:{main:er[700],light:er[400],dark:er[800]}}function U3(t="light"){return t==="dark"?{main:Xi[200],light:Xi[50],dark:Xi[400]}:{main:Xi[500],light:Xi[300],dark:Xi[700]}}function B3(t="light"){return t==="dark"?{main:Qi[500],light:Qi[300],dark:Qi[700]}:{main:Qi[700],light:Qi[400],dark:Qi[800]}}function $3(t="light"){return t==="dark"?{main:tr[400],light:tr[300],dark:tr[700]}:{main:tr[700],light:tr[500],dark:tr[900]}}function H3(t="light"){return t==="dark"?{main:nr[400],light:nr[300],dark:nr[700]}:{main:nr[800],light:nr[500],dark:nr[900]}}function z3(t="light"){return t==="dark"?{main:is[400],light:is[300],dark:is[700]}:{main:"#ed6c02",light:is[500],dark:is[900]}}function Ph(t){const{mode:e="light",contrastThreshold:n=3,tonalOffset:i=.2,...r}=t,s=t.primary||F3(e),o=t.secondary||U3(e),a=t.error||B3(e),c=t.info||$3(e),l=t.success||H3(e),d=t.warning||z3(e);function u(f){const y=Og(f,Lg.text.primary)>=n?Lg.text.primary:V3.text.primary;if(process.env.NODE_ENV!=="production"){const b=Og(f,y);b<3&&console.error([`MUI: The contrast ratio of ${b}:1 for ${y} on ${f}`,"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(`
242
+ `))}return y}const h=({color:f,name:y,mainShade:b=500,lightShade:w=300,darkShade:k=700})=>{if(f={...f},!f.main&&f[b]&&(f.main=f[b]),!f.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${y?` (${y})`:""} provided to augmentColor(color) is invalid.
243
+ The color object needs to have a \`main\` property or a \`${b}\` property.`:ai(11,y?` (${y})`:"",b));if(typeof f.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${y?` (${y})`:""} provided to augmentColor(color) is invalid.
244
+ \`color.main\` should be a string, but \`${JSON.stringify(f.main)}\` was provided instead.
245
+
246
+ Did you intend to use one of the following approaches?
247
+
248
+ import { green } from "@mui/material/colors";
249
+
250
+ const theme1 = createTheme({ palette: {
251
+ primary: green,
252
+ } });
253
+
254
+ const theme2 = createTheme({ palette: {
255
+ primary: { main: green[500] },
256
+ } });`:ai(12,y?` (${y})`:"",JSON.stringify(f.main)));return Vg(f,"light",w,i),Vg(f,"dark",k,i),f.contrastText||(f.contrastText=u(f.main)),f};let p;return e==="light"?p=hS():e==="dark"&&(p=fS()),process.env.NODE_ENV!=="production"&&(p||console.error(`MUI: The palette mode \`${e}\` is not supported.`)),At({common:{...Ds},mode:e,primary:h({color:s,name:"primary"}),secondary:h({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:a,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:c,name:"info"}),success:h({color:l,name:"success"}),grey:L3,contrastThreshold:n,getContrastText:u,augmentColor:h,tonalOffset:i,...p},r)}function W3(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 q3(t,e){return{toolbar:{minHeight:56,[t.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[t.up("sm")]:{minHeight:64}},...e}}function K3(t){return Math.round(t*1e5)/1e5}const Fg={textTransform:"uppercase"},Ug='"Roboto", "Helvetica", "Arial", sans-serif';function G3(t,e){const{fontFamily:n=Ug,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 h=i/14,p=d||(y=>`${y/c*h}rem`),g=(y,b,w,k,S)=>({fontFamily:n,fontWeight:y,fontSize:p(b),lineHeight:w,...n===Ug?{letterSpacing:`${K3(k/b)}em`}:{},...S,...l}),f={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,Fg),caption:g(s,12,1.66,.4),overline:g(s,12,2.66,1,Fg),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return At({htmlFontSize:c,pxToRem:p,fontFamily:n,fontSize:i,fontWeightLight:r,fontWeightRegular:s,fontWeightMedium:o,fontWeightBold:a,...f},u,{clone:!1})}const Z3=.2,Y3=.14,J3=.12;function Oe(...t){return[`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px rgba(0,0,0,${Z3})`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px rgba(0,0,0,${Y3})`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px rgba(0,0,0,${J3})`].join(",")}const X3=["none",Oe(0,2,1,-1,0,1,1,0,0,1,3,0),Oe(0,3,1,-2,0,2,2,0,0,1,5,0),Oe(0,3,3,-2,0,3,4,0,0,1,8,0),Oe(0,2,4,-1,0,4,5,0,0,1,10,0),Oe(0,3,5,-1,0,5,8,0,0,1,14,0),Oe(0,3,5,-1,0,6,10,0,0,1,18,0),Oe(0,4,5,-2,0,7,10,1,0,2,16,1),Oe(0,5,5,-3,0,8,10,1,0,3,14,2),Oe(0,5,6,-3,0,9,12,1,0,3,16,2),Oe(0,6,6,-3,0,10,14,1,0,4,18,3),Oe(0,6,7,-4,0,11,15,1,0,4,20,3),Oe(0,7,8,-4,0,12,17,2,0,5,22,4),Oe(0,7,8,-4,0,13,19,2,0,5,24,4),Oe(0,7,9,-4,0,14,21,2,0,5,26,4),Oe(0,8,9,-5,0,15,22,2,0,6,28,5),Oe(0,8,10,-5,0,16,24,2,0,6,30,5),Oe(0,8,11,-5,0,17,26,2,0,6,32,5),Oe(0,9,11,-5,0,18,28,2,0,7,34,6),Oe(0,9,12,-6,0,19,29,2,0,7,36,6),Oe(0,10,13,-6,0,20,31,3,0,8,38,7),Oe(0,10,13,-6,0,21,33,3,0,8,40,7),Oe(0,10,14,-6,0,22,35,3,0,8,42,7),Oe(0,11,14,-7,0,23,36,3,0,9,44,8),Oe(0,11,15,-7,0,24,38,3,0,9,46,8)],Q3={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)"},e5={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Bg(t){return`${Math.round(t)}ms`}function t5(t){if(!t)return 0;const e=t/36;return Math.min(Math.round((4+15*e**.25+e/5)*10),3e3)}function n5(t){const e={...Q3,...t.easing},n={...e5,...t.duration};return{getAutoHeightDuration:t5,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=h=>typeof h=="string",u=h=>!Number.isNaN(parseFloat(h));!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(`
257
+ `)),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:Bg(o)} ${a} ${typeof c=="string"?c:Bg(c)}`).join(",")},...t,easing:e,duration:n}}const i5={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function r5(t){return In(t)||typeof t>"u"||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||Array.isArray(t)}function mS(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];!r5(a)||o.startsWith("unstable_")?delete i[o]:In(a)&&(i[o]={...a},n(i[o]))}}return n(e),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
258
+
259
+ const theme = ${JSON.stringify(e,null,2)};
260
+
261
+ theme.breakpoints = createBreakpoints(theme.breakpoints || {});
262
+ theme.transitions = createTransitions(theme.transitions || {});
263
+
264
+ export default theme;`}function Hd(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.":ai(20));const d=Ph(s),u=oS(t);let h=At(u,{mixins:q3(u.breakpoints,i),palette:d,shadows:X3.slice(),typography:G3(d,a),transitions:n5(o),zIndex:{...i5}});if(h=At(h,l),h=e.reduce((p,g)=>At(p,g),h),process.env.NODE_ENV!=="production"){const p=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],g=(f,y)=>{let b;for(b in f){const w=f[b];if(p.includes(b)&&Object.keys(w).length>0){if(process.env.NODE_ENV!=="production"){const k=kh("",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(f,null,2),"",`Instead, you need to use the '&.${k}' syntax:`,JSON.stringify({root:{[`&.${k}`]:w}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
265
+ `))}f[b]={}}}};Object.keys(h.components).forEach(f=>{const y=h.components[f].styleOverrides;y&&f.startsWith("Mui")&&g(y,f)})}return h.unstable_sxConfig={...Ya,...l==null?void 0:l.unstable_sxConfig},h.unstable_sx=function(g){return Or({sx:g,theme:this})},h.toRuntimeSource=mS,h}function s5(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 o5=[...Array(25)].map((t,e)=>{if(e===0)return"none";const n=s5(e);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function pS(t){return{inputPlaceholder:t==="dark"?.5:.42,inputUnderline:t==="dark"?.7:.42,switchTrackDisabled:t==="dark"?.2:.12,switchTrack:t==="dark"?.3:.38}}function gS(t){return t==="dark"?o5:[]}function a5(t){const{palette:e={mode:"light"},opacity:n,overlays:i,...r}=t,s=Ph(e);return{palette:s,opacity:{...pS(s.mode),...n},overlays:i||gS(s.mode),...r}}function c5(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 l5=t=>[...[...Array(25)].map((e,n)=>`--${t?`${t}-`:""}overlays-${n}`),`--${t?`${t}-`:""}palette-AppBar-darkBg`,`--${t?`${t}-`:""}palette-AppBar-darkColor`],d5=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 l5(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 u5(t,e){e.forEach(n=>{t[n]||(t[n]={})})}function B(t,e,n){!t[e]&&n&&(t[e]=n)}function ls(t){return typeof t!="string"||!t.startsWith("hsl")?t:uS(t)}function kn(t,e){`${e}Channel`in t||(t[`${e}Channel`]=cs(ls(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().
266
+ 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 h5(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const tn=t=>{try{return t()}catch{}},f5=(t="mui")=>N3(t);function hl(t,e,n,i){if(!e)return;e=e===!0?{}:e;const r=i==="dark"?"dark":"light";if(!n){t[i]=a5({...e,palette:{mode:r,...e==null?void 0:e.palette}});return}const{palette:s,...o}=Hd({...n,palette:{mode:r,...e==null?void 0:e.palette}});return t[i]={...e,palette:s,opacity:{...pS(r),...e==null?void 0:e.opacity},overlays:(e==null?void 0:e.overlays)||gS(r)},o}function m5(t={},...e){const{colorSchemes:n={light:!0},defaultColorScheme:i,disableCssColorScheme:r=!1,cssVarPrefix:s="mui",shouldSkipGeneratingVar:o=c5,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),h=f5(s),{[u]:p,light:g,dark:f,...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.`:ai(21,u));const k=hl(b,w,l,u);g&&!b.light&&hl(b,g,void 0,"light"),f&&!b.dark&&hl(b,f,void 0,"dark");let S={defaultColorScheme:u,...k,cssVarPrefix:s,colorSchemeSelector:a,rootSelector:c,getCssVar:h,colorSchemes:b,font:{...W3(k.typography),...k.font},spacing:h5(l.spacing)};Object.keys(S.colorSchemes).forEach(M=>{const C=S.colorSchemes[M].palette,I=N=>{const Z=N.split("-"),Q=Z[1],se=Z[2];return h(N,C[Q][se])};if(C.mode==="light"&&(B(C.common,"background","#fff"),B(C.common,"onBackground","#000")),C.mode==="dark"&&(B(C.common,"background","#000"),B(C.common,"onBackground","#fff")),u5(C,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),C.mode==="light"){B(C.Alert,"errorColor",Ie(C.error.light,.6)),B(C.Alert,"infoColor",Ie(C.info.light,.6)),B(C.Alert,"successColor",Ie(C.success.light,.6)),B(C.Alert,"warningColor",Ie(C.warning.light,.6)),B(C.Alert,"errorFilledBg",I("palette-error-main")),B(C.Alert,"infoFilledBg",I("palette-info-main")),B(C.Alert,"successFilledBg",I("palette-success-main")),B(C.Alert,"warningFilledBg",I("palette-warning-main")),B(C.Alert,"errorFilledColor",tn(()=>C.getContrastText(C.error.main))),B(C.Alert,"infoFilledColor",tn(()=>C.getContrastText(C.info.main))),B(C.Alert,"successFilledColor",tn(()=>C.getContrastText(C.success.main))),B(C.Alert,"warningFilledColor",tn(()=>C.getContrastText(C.warning.main))),B(C.Alert,"errorStandardBg",Me(C.error.light,.9)),B(C.Alert,"infoStandardBg",Me(C.info.light,.9)),B(C.Alert,"successStandardBg",Me(C.success.light,.9)),B(C.Alert,"warningStandardBg",Me(C.warning.light,.9)),B(C.Alert,"errorIconColor",I("palette-error-main")),B(C.Alert,"infoIconColor",I("palette-info-main")),B(C.Alert,"successIconColor",I("palette-success-main")),B(C.Alert,"warningIconColor",I("palette-warning-main")),B(C.AppBar,"defaultBg",I("palette-grey-100")),B(C.Avatar,"defaultBg",I("palette-grey-400")),B(C.Button,"inheritContainedBg",I("palette-grey-300")),B(C.Button,"inheritContainedHoverBg",I("palette-grey-A100")),B(C.Chip,"defaultBorder",I("palette-grey-400")),B(C.Chip,"defaultAvatarColor",I("palette-grey-700")),B(C.Chip,"defaultIconColor",I("palette-grey-700")),B(C.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),B(C.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),B(C.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),B(C.LinearProgress,"primaryBg",Me(C.primary.main,.62)),B(C.LinearProgress,"secondaryBg",Me(C.secondary.main,.62)),B(C.LinearProgress,"errorBg",Me(C.error.main,.62)),B(C.LinearProgress,"infoBg",Me(C.info.main,.62)),B(C.LinearProgress,"successBg",Me(C.success.main,.62)),B(C.LinearProgress,"warningBg",Me(C.warning.main,.62)),B(C.Skeleton,"bg",`rgba(${I("palette-text-primaryChannel")} / 0.11)`),B(C.Slider,"primaryTrack",Me(C.primary.main,.62)),B(C.Slider,"secondaryTrack",Me(C.secondary.main,.62)),B(C.Slider,"errorTrack",Me(C.error.main,.62)),B(C.Slider,"infoTrack",Me(C.info.main,.62)),B(C.Slider,"successTrack",Me(C.success.main,.62)),B(C.Slider,"warningTrack",Me(C.warning.main,.62));const N=bo(C.background.default,.8);B(C.SnackbarContent,"bg",N),B(C.SnackbarContent,"color",tn(()=>C.getContrastText(N))),B(C.SpeedDialAction,"fabHoverBg",bo(C.background.paper,.15)),B(C.StepConnector,"border",I("palette-grey-400")),B(C.StepContent,"border",I("palette-grey-400")),B(C.Switch,"defaultColor",I("palette-common-white")),B(C.Switch,"defaultDisabledColor",I("palette-grey-100")),B(C.Switch,"primaryDisabledColor",Me(C.primary.main,.62)),B(C.Switch,"secondaryDisabledColor",Me(C.secondary.main,.62)),B(C.Switch,"errorDisabledColor",Me(C.error.main,.62)),B(C.Switch,"infoDisabledColor",Me(C.info.main,.62)),B(C.Switch,"successDisabledColor",Me(C.success.main,.62)),B(C.Switch,"warningDisabledColor",Me(C.warning.main,.62)),B(C.TableCell,"border",Me(yo(C.divider,1),.88)),B(C.Tooltip,"bg",yo(C.grey[700],.92))}if(C.mode==="dark"){B(C.Alert,"errorColor",Me(C.error.light,.6)),B(C.Alert,"infoColor",Me(C.info.light,.6)),B(C.Alert,"successColor",Me(C.success.light,.6)),B(C.Alert,"warningColor",Me(C.warning.light,.6)),B(C.Alert,"errorFilledBg",I("palette-error-dark")),B(C.Alert,"infoFilledBg",I("palette-info-dark")),B(C.Alert,"successFilledBg",I("palette-success-dark")),B(C.Alert,"warningFilledBg",I("palette-warning-dark")),B(C.Alert,"errorFilledColor",tn(()=>C.getContrastText(C.error.dark))),B(C.Alert,"infoFilledColor",tn(()=>C.getContrastText(C.info.dark))),B(C.Alert,"successFilledColor",tn(()=>C.getContrastText(C.success.dark))),B(C.Alert,"warningFilledColor",tn(()=>C.getContrastText(C.warning.dark))),B(C.Alert,"errorStandardBg",Ie(C.error.light,.9)),B(C.Alert,"infoStandardBg",Ie(C.info.light,.9)),B(C.Alert,"successStandardBg",Ie(C.success.light,.9)),B(C.Alert,"warningStandardBg",Ie(C.warning.light,.9)),B(C.Alert,"errorIconColor",I("palette-error-main")),B(C.Alert,"infoIconColor",I("palette-info-main")),B(C.Alert,"successIconColor",I("palette-success-main")),B(C.Alert,"warningIconColor",I("palette-warning-main")),B(C.AppBar,"defaultBg",I("palette-grey-900")),B(C.AppBar,"darkBg",I("palette-background-paper")),B(C.AppBar,"darkColor",I("palette-text-primary")),B(C.Avatar,"defaultBg",I("palette-grey-600")),B(C.Button,"inheritContainedBg",I("palette-grey-800")),B(C.Button,"inheritContainedHoverBg",I("palette-grey-700")),B(C.Chip,"defaultBorder",I("palette-grey-700")),B(C.Chip,"defaultAvatarColor",I("palette-grey-300")),B(C.Chip,"defaultIconColor",I("palette-grey-300")),B(C.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),B(C.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),B(C.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),B(C.LinearProgress,"primaryBg",Ie(C.primary.main,.5)),B(C.LinearProgress,"secondaryBg",Ie(C.secondary.main,.5)),B(C.LinearProgress,"errorBg",Ie(C.error.main,.5)),B(C.LinearProgress,"infoBg",Ie(C.info.main,.5)),B(C.LinearProgress,"successBg",Ie(C.success.main,.5)),B(C.LinearProgress,"warningBg",Ie(C.warning.main,.5)),B(C.Skeleton,"bg",`rgba(${I("palette-text-primaryChannel")} / 0.13)`),B(C.Slider,"primaryTrack",Ie(C.primary.main,.5)),B(C.Slider,"secondaryTrack",Ie(C.secondary.main,.5)),B(C.Slider,"errorTrack",Ie(C.error.main,.5)),B(C.Slider,"infoTrack",Ie(C.info.main,.5)),B(C.Slider,"successTrack",Ie(C.success.main,.5)),B(C.Slider,"warningTrack",Ie(C.warning.main,.5));const N=bo(C.background.default,.98);B(C.SnackbarContent,"bg",N),B(C.SnackbarContent,"color",tn(()=>C.getContrastText(N))),B(C.SpeedDialAction,"fabHoverBg",bo(C.background.paper,.15)),B(C.StepConnector,"border",I("palette-grey-600")),B(C.StepContent,"border",I("palette-grey-600")),B(C.Switch,"defaultColor",I("palette-grey-300")),B(C.Switch,"defaultDisabledColor",I("palette-grey-600")),B(C.Switch,"primaryDisabledColor",Ie(C.primary.main,.55)),B(C.Switch,"secondaryDisabledColor",Ie(C.secondary.main,.55)),B(C.Switch,"errorDisabledColor",Ie(C.error.main,.55)),B(C.Switch,"infoDisabledColor",Ie(C.info.main,.55)),B(C.Switch,"successDisabledColor",Ie(C.success.main,.55)),B(C.Switch,"warningDisabledColor",Ie(C.warning.main,.55)),B(C.TableCell,"border",Ie(yo(C.divider,1),.68)),B(C.Tooltip,"bg",yo(C.grey[700],.92))}kn(C.background,"default"),kn(C.background,"paper"),kn(C.common,"background"),kn(C.common,"onBackground"),kn(C,"divider"),Object.keys(C).forEach(N=>{const Z=C[N];N!=="tonalOffset"&&Z&&typeof Z=="object"&&(Z.main&&B(C[N],"mainChannel",cs(ls(Z.main))),Z.light&&B(C[N],"lightChannel",cs(ls(Z.light))),Z.dark&&B(C[N],"darkChannel",cs(ls(Z.dark))),Z.contrastText&&B(C[N],"contrastTextChannel",cs(ls(Z.contrastText))),N==="text"&&(kn(C[N],"primary"),kn(C[N],"secondary")),N==="action"&&(Z.active&&kn(C[N],"active"),Z.selected&&kn(C[N],"selected")))})}),S=e.reduce((M,C)=>At(M,C),S);const x={prefix:s,disableCssColorScheme:r,shouldSkipGeneratingVar:o,getSelector:d5(S)},{vars:T,generateThemeVars:E,generateStyleSheets:P}=D3(S,x);return S.vars=T,Object.entries(S.colorSchemes[S.defaultColorScheme]).forEach(([M,C])=>{S[M]=C}),S.generateThemeVars=E,S.generateStyleSheets=P,S.generateSpacing=function(){return sS(l.spacing,yh(this))},S.getColorSchemeSelector=j3(a),S.spacing=S.generateSpacing(),S.shouldSkipGeneratingVar=o,S.unstable_sxConfig={...Ya,...l==null?void 0:l.unstable_sxConfig},S.unstable_sx=function(C){return Or({sx:C,theme:this})},S.toRuntimeSource=mS,S}function $g(t,e,n){t.colorSchemes&&n&&(t.colorSchemes[e]={...n!==!0&&n,palette:Ph({...n===!0?{}:n.palette,mode:e})})}function p5(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 Hd(t,...e);let d=n;"palette"in t||l[a]&&(l[a]!==!0?d=l[a].palette:a==="dark"&&(d={mode:"dark"}));const u=Hd({...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},$g(u,"dark",l.dark)),u.palette.mode==="dark"&&(u.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:u.palette},$g(u,"light",l.light)),u}return!n&&!("light"in l)&&a==="light"&&(l.light=!0),m5({...o,colorSchemes:l,defaultColorScheme:a,...typeof i!="boolean"&&i},...e)}const g5=p5(),v5="$$material";function y5(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const b5=t=>y5(t)&&t!=="classes",x5=y3({themeId:v5,defaultTheme:g5,rootShouldForwardProp:b5}),S5=M3;process.env.NODE_ENV!=="production"&&(xe.node,xe.object.isRequired);function w5(t){return I3(t)}function k5(t){return kh("MuiSvgIcon",t)}f3("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const C5=t=>{const{color:e,fontSize:n,classes:i}=t,r={root:["root",e!=="inherit"&&`color${Bi(e)}`,`fontSize${Bi(n)}`]};return gO(r,k5,i)},T5=x5("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color!=="inherit"&&e[`color${Bi(n.color)}`],e[`fontSize${Bi(n.fontSize)}`]]}})(S5(({theme:t})=>{var e,n,i,r,s,o,a,c,l,d,u,h,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:f=>!f.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(([,f])=>f&&f.main).map(([f])=>{var y,b;return{props:{color:f},style:{color:(b=(y=(t.vars??t).palette)==null?void 0:y[f])==null?void 0:b.main}}}),{props:{color:"action"},style:{color:(h=(u=(t.vars??t).palette)==null?void 0:u.action)==null?void 0:h.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}}]}})),ba=v.forwardRef(function(e,n){const i=w5({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:h="0 0 24 24",...p}=i,g=v.isValidElement(r)&&r.type==="svg",f={...i,color:o,component:a,fontSize:c,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:h,hasSvgAsChild:g},y={};d||(y.viewBox=h);const b=C5(f);return m.jsxs(T5,{as:a,className:Na(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:f,children:[g?r.props.children:r,u?m.jsx("title",{children:u}):null]})});process.env.NODE_ENV!=="production"&&(ba.propTypes={children:xe.node,classes:xe.object,className:xe.string,color:xe.oneOfType([xe.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),xe.string]),component:xe.elementType,fontSize:xe.oneOfType([xe.oneOf(["inherit","large","medium","small"]),xe.string]),htmlColor:xe.string,inheritViewBox:xe.bool,shapeRendering:xe.string,sx:xe.oneOfType([xe.arrayOf(xe.oneOfType([xe.func,xe.object,xe.bool])),xe.func,xe.object]),titleAccess:xe.string,viewBox:xe.string});ba.muiName="SvgIcon";function Kr(t,e){function n(i,r){return m.jsx(ba,{"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=ba.muiName,v.memo(v.forwardRef(n))}const E5=Kr(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"),P5=Kr(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"),R5=Kr([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"),vS=Kr(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"),yS=Kr(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"),bS=Kr(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"),A5=({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 Q,se,te,Y,_,ie,L;const[d,u]=R.useState(!1),[h,p]=R.useState(!1),[g,f]=R.useState(()=>{var ee;const F=(ee=a==null?void 0:a.getCurrentInteraction)==null?void 0:ee.call(a);return console.log("SessionView: Initializing with existing interaction:",(F==null?void 0:F.methodName)||"none"),F||null}),{messages:y,send:b}=iO(),w=R.useRef(null),k=R.useRef(null),{agent:{isActive:S=!1}={}}=e1(),x=ut(o),T=R.useMemo(()=>a&&typeof a.getCurrentSession=="function"?!!a.getCurrentSession():!1,[a]),E=S||T;R.useEffect(()=>{var F,ee;console.log("🤖 SessionView agent state:",{isAgentActive:S,hasActiveSession:T,effectiveAgentActive:E,sessionStarted:n,clientSession:(ee=(F=a==null?void 0:a.getCurrentSession)==null?void 0:F.call(a))==null?void 0:ee.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)},ee=j=>{console.log("🔴 Client disconnected:",j),f(null),u(!1),p(!1)};return a.on("connection.connected",F),a.on("connection.disconnected",ee),()=>{a.off("connection.connected",F),a.off("connection.disconnected",ee)}},[a]),R.useEffect(()=>{if(!a)return;const F=J=>{console.log("🎯 SessionView: RPC Interaction started:",J);const K=a.getCurrentInteraction();K&&(console.log("📱 SessionView: Setting current interaction:",K.methodName,"mode:",K.presentationMode),f(K))},ee=J=>{console.log("✅ SessionView: RPC Interaction completed:",J),f(null)},j=async J=>{console.log("⏰ SessionView: RPC Interaction timeout:",J),f(null)},W=async J=>{console.log("❌ SessionView: RPC Interaction dismissed:",J),f(null)};return a.on("rpc.interaction.started",F),a.on("rpc.interaction.completed",ee),a.on("rpc.interaction.timeout",j),a.on("rpc.interaction.dismissed",W),()=>{a.off("rpc.interaction.started",F),a.off("rpc.interaction.completed",ee),a.off("rpc.interaction.timeout",j),a.off("rpc.interaction.dismissed",W)}},[a]),R.useEffect(()=>{if(!a)return;const F=a.getCurrentInteraction();F?(console.log("🔄 SessionView: Syncing with existing interaction:",F.methodName),f(F)):f(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,ee,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=(ee=a==null?void 0:a.getCurrentSession)==null?void 0:ee.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]),rO(),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,W;console.log("📝 SessionView: Messages updated, count:",y.length),y.length>0&&console.log("📝 SessionView: Latest messages:",y.slice(-3).map(J=>{var K,O,$,X,z,oe,H;return{id:J.id,message:J.message,timestamp:J.timestamp,from:((K=J.from)==null?void 0:K.name)||((O=J.from)==null?void 0:O.identity),fromType:J.from===void 0?"unknown":"participant",isLocal:(($=J.from)==null?void 0:$.identity)===((oe=(z=(X=a==null?void 0:a.getCurrentSession)==null?void 0:X.call(a))==null?void 0:z.localParticipant)==null?void 0:oe.identity),messageLength:((H=J.message)==null?void 0:H.length)||0}}));const F=((j=a==null?void 0:a.getTranscriptions)==null?void 0:j.call(a))||[],ee=((W=a==null?void 0:a.getChatMessages)==null?void 0:W.call(a))||[];console.log("📝 SessionView: Raw transcriptions count:",F.length),console.log("📝 SessionView: Raw chat messages count:",ee.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 M=R.useCallback(F=>{console.log("📝 SessionView: Adding local message for voice session context:",F)},[]),C=R.useCallback(async F=>{try{a&&typeof a.sendAttachments=="function"&&(await a.sendAttachments(F),console.log("📎 SessionView: Attachments sent successfully:",F.map(ee=>ee.name)))}catch(ee){console.error("❌ SessionView: Failed to send attachments:",ee)}},[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),f(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),f(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 ee,j;const F=((j=(ee=a==null?void 0:a.getCurrentSession)==null?void 0:ee.call(a))==null?void 0:j.id)||null;k.current&&!F&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:k.current,currentSession:F,displayType:c,sessionStarted:n,effectiveAgentActive:E}),k.current=F},[a,c,n,E]);const N=le("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"),Z=l&&(c==="popup"||c==="fullscreen");return m.jsxs("main",{ref:i,inert:t,className:le(N,"relative"),style:{minHeight:0},children:[Z&&m.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((Q=x.chatHeader)==null?void 0:Q.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(ge.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(ih,{className:x.spinner,weight:"bold"})}),m.jsx(ge.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:h?"Agent is taking longer than expected...":s}),m.jsx(ge.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${x.text.muted} mt-2 text-center opacity-60`,children:h?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),h&&l&&m.jsx(ge.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:le("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:le("flex-shrink-0 px-4 py-3 border-b",c==="fullscreen"?"px-8":"px-5",((te=x.chatHeader)==null?void 0:te.container)||"border-gray-200 dark:border-gray-700"),children:[m.jsx("h3",{className:le("font-semibold text-lg",((Y=x.text)==null?void 0:Y.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),m.jsxs("p",{className:le("text-sm",((_=x.text)==null?void 0:_.muted)||"text-gray-600 dark:text-gray-400"),children:[y.length," messages"]})]}),m.jsx("div",{className:le("flex-1 flex flex-col min-h-0",c==="fullscreen"?"px-8":"px-5"),children:m.jsx(h6,{className:"flex-1 flex flex-col min-h-0 h-full",children:m.jsxs("div",{className:`flex-1 flex flex-col h-full ${le("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:le("text-lg font-medium mb-2",((ie=x.text)==null?void 0:ie.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),m.jsx("p",{className:le("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(yr,{mode:"popLayout",children:y.map((F,ee)=>m.jsx(ge.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:ee*.02},layout:!0,children:m.jsx(d6,{participantName:r,entry:F})},F.id||`message-${ee}`))})})]})]})})})]}),!d&&m.jsxs("div",{className:le("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(ge.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(x6,{chatOpen:d})}),m.jsx(yr,{mode:"wait",children:g&&g.presentationMode==="embedded"&&m.jsx(ge.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:le("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(_r,{interaction:g,theme:o,onDismiss:()=>{var F;return(F=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:F.call(a)},client:a,addLocalMessage:M})})},`embedded-${g.methodName}`)})]})]})]}),m.jsx(yr,{mode:"wait",children:g&&g.presentationMode!=="embedded"&&!d&&m.jsx("div",{className:le("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",c==="fullscreen"?"bg-black/70":"bg-black/50"),children:m.jsx(ge.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:le("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(_r,{interaction:g,theme:o,onDismiss:()=>{var F;return(F=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:F.call(a)},client:a,addLocalMessage:M})},`modal-${g.methodName}`)})}),m.jsx(ge.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(I5,{capabilities:e,onSendMessage:P,onSendAttachments:C,onEndCall:I,onChatOpenChange:u,disabled:t,theme:o,client:a,sessionStarted:n})})]})};function I5({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),h=R.useRef(null);R.useEffect(()=>{const w=()=>{const k=navigator.userAgent.toLowerCase(),x=["android","iphone","ipad","mobile","tablet"].some(P=>k.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 k=w.target.files;if(k&&k.length>0){const x=Array.from(k).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 k=w.target.files;if(k&&k.length>0){const S=k[0];S.type.startsWith("image/")&&n&&n([S]),h.current&&(h.current.value="")}},f=()=>{!s&&u.current&&u.current.click()},y=()=>{!s&&l&&h.current&&h.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:le("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:h,type:"file",onChange:g,className:"hidden",accept:"image/*",capture:"environment"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:f,disabled:s,className:le("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(E5,{className:"w-5 h-5"})}),l&&m.jsx("button",{onClick:y,disabled:s,className:le("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(R5,{className:"w-5 h-5"})})]}),m.jsx("div",{className:"flex-1 flex justify-center px-4",children:m.jsx(c6,{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:le("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(P5,{className:"w-5 h-5"})})})]})})}function M5({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,h]=v.useState(!1),p=ut(i);v.useEffect(()=>{const S=()=>{const x=navigator.userAgent.toLowerCase(),E=["android","iphone","ipad","mobile","tablet"].some(C=>x.includes(C)),P="ontouchstart"in window||navigator.maxTouchPoints>0,M=window.innerWidth<=768;h(E||P&&M)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const g=S=>{S.preventDefault(),s.trim()&&!n&&(t(s.trim()),o(""))},f=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()},k=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(ge.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(W6,{className:"w-4 h-4"})}),u&&m.jsx(ge.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(Bx,{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:k,className:"hidden",accept:"image/*",capture:"environment"}),m.jsx("textarea",{value:s,onChange:S=>o(S.target.value),onKeyDown:f,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(ge.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(G6,{className:"w-4 h-4"})}),r&&m.jsx(ge.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($x,{className:"w-4 h-4"})})]})})})}function N5({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(ge.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 _5({message:t,theme:e,isOwn:n,isStreaming:i=!1}){var o,a;const r=ut(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
267
  relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover
185
268
  ${n?`${r.chatMessage.own} rounded-br-md`:`${r.chatMessage.other} rounded-bl-md`}
186
- ${s?"shimmer":""}
269
+ ${i?"shimmer":""}
187
270
  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:`
271
+ `,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(j5,{message:t,theme:e,isOwn:n}):i&&!n?m.jsx(N5,{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 O5(t,e){return t.startsWith("image/")?D6:t.startsWith("video/")?eO:t.startsWith("audio/")?H6:t.includes("zip")||t.includes("rar")||t.includes("archive")?P6:_6}function D5(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 j5({message:t,theme:e,isOwn:n}){const i=ut(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,h=r==null?void 0:r.downloadUrl,p=r==null?void 0:r.file,g=O5(a),f=c||l,y=c?d:u,b=c?"Downloading...":l?"Uploading...":"Complete",[w,k]=v.useState(null);v.useEffect(()=>{if(h)k(h);else if(p&&a.startsWith("image/")){const E=URL.createObjectURL(p);return k(E),()=>URL.revokeObjectURL(E)}else k(null)},[h,p,a]);const S=()=>{if(h){const E=document.createElement("a");E.href=h,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
272
  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:`
273
+ ${e==="light"?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-gray-800/50 border-gray-700 hover:bg-gray-700/50"}
274
+ `,children:[m.jsx("div",{className:`
192
275
  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:`
276
+ ${e==="light"?"bg-blue-100 text-blue-600":"bg-blue-900/50 text-blue-400"}
277
+ `,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&&D5(o),f&&m.jsxs(m.Fragment,{children:[o>0&&" • ",b," ",Math.round(y*100),"%"]})]}),f&&m.jsx("div",{className:`
195
278
  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:`
279
+ ${e==="light"?"bg-gray-200":"bg-gray-700"}
280
+ `,children:m.jsx(ge.div,{className:`h-full ${e==="light"?"bg-blue-500":"bg-blue-400"}`,initial:{width:0},animate:{width:`${y*100}%`},transition:{duration:.3}})})]}),h&&!f&&m.jsx(ge.button,{onClick:S,whileHover:{scale:1.05},whileTap:{scale:.95},className:`
198
281
  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:`
282
+ ${e==="light"?"hover:bg-gray-200 text-gray-600 hover:text-gray-800":"hover:bg-gray-600 text-gray-400 hover:text-gray-200"}
283
+ `,"aria-label":"Download file",children:m.jsx(M6,{className:"w-4 h-4"})})]})]})}function L5(){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 V5(){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 F5({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(),W=t&&typeof t.getChatMessages=="function"&&t.getChatMessages().length>0;return!j&&!W}),[h,p]=v.useState(new Set),[g,f]=v.useState([]),[y,b]=v.useState(!1),[w,k]=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=ut(e);v.useEffect(()=>{const j=()=>{const W=navigator.userAgent.toLowerCase(),K=["android","iphone","ipad","mobile","tablet"].some(z=>W.includes(z)),O="ontouchstart"in window||navigator.maxTouchPoints>0,$=window.innerWidth<=768,X=K||O&&$;b(X),X&&r==="widget"&&k(!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(),M=(P==null?void 0:P.name)||"AI Assistant",C=M.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2),I=v.useCallback(j=>{const W={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(J=>(console.log("ChatView: Adding local message:",W.id),[...J,W]))},[]);v.useEffect(()=>{var j,W,J,K,O;console.log("💬 ChatView loading state:",{isLoading:d,hasActiveSession:!!((j=t==null?void 0:t.getCurrentSession)!=null&&j.call(t)),messagesCount:o.length,sessionId:(J=(W=t==null?void 0:t.getCurrentSession)==null?void 0:W.call(t))==null?void 0:J.id,hasStoredMessages:!!((O=(K=t==null?void 0:t.getChatMessages)==null?void 0:K.call(t))!=null&&O.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=K=>{if(console.log("ChatView: Received message:",K),u(!1),S&&K.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",S.methodName),f(O=>[...O,K]);return}K.sender.type==="agent"&&l(!1),a(O=>{var X;if(O.some(z=>z.id===K.id))return console.log("ChatView: Message already exists, skipping:",K.id),O;if(console.log("ChatView: Adding new message:",K.id),K.sender.type==="agent"&&(p(z=>new Set(z).add(K.id)),!((X=K.metadata)!=null&&X.streaming))){const z=K.content.length*35+1e3;setTimeout(()=>{p(oe=>{const H=new Set(oe);return H.delete(K.id),H})},z)}return[...O,K]}),setTimeout(()=>N(!0),0)},W=K=>{var O;if(console.log("ChatView: Updated message:",K),S&&K.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",S.methodName),f($=>{const X=$.findIndex(z=>z.id===K.id);if(X>=0){const z=[...$];return z[X]=K,z}else return[...$,K]});return}a($=>$.map(X=>X.id===K.id?{...K}:X)),setTimeout(()=>N(!0),0),(O=K.metadata)!=null&&O.streaming||p($=>{const X=new Set($);return X.delete(K.id),X})},J=K=>{console.log("ChatView: Sent message:",K),u(!1),a(O=>O.some(X=>X.id===K.id)?(console.log("ChatView: Sent message already exists, skipping:",K.id),O):(console.log("ChatView: Adding sent message:",K.id),[...O,K])),setTimeout(()=>N(!0),0)};return t.on("chat.message.received",j),t.on("chat.message.updated",W),t.on("chat.message.sent",J),()=>{t.off("chat.message.received",j),t.off("chat.message.updated",W),t.off("chat.message.sent",J)}},[t,S]),v.useEffect(()=>{const j=O=>{console.log("ChatView: RPC interaction started:",O);const $=t.getCurrentInteraction();console.log("ChatView: Got interaction from client:",$==null?void 0:$.methodName),x($),l(!1),N(!0),setTimeout(()=>{N(!1)},100)},W=O=>{if(console.log("ChatView: RPC interaction completed:",O),x(null),g.length>0&&(console.log("ChatView: Processing",g.length,"queued messages"),a($=>{const X=[...$];return g.forEach(z=>{var H;if(!X.some(ue=>ue.id===z.id)&&(console.log("ChatView: Adding queued message:",z.id),X.push(z),z.sender.type==="agent"&&(p(ue=>new Set(ue).add(z.id)),!((H=z.metadata)!=null&&H.streaming)))){const ue=z.content.length*35+1e3;setTimeout(()=>{p(Se=>{const rt=new Set(Se);return rt.delete(z.id),rt})},ue)}}),X}),f([]),setTimeout(()=>N(!0),0)),O&&O.response&&O.response.success){let $=null;O.response.successView?$=O.response.successView:O.successView&&($=O.successView),a(X=>{const z=[...X].reverse().findIndex(Se=>Se.sender.type==="participant");let oe=X.length;z!==-1&&(oe=X.length-z);const H={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(L5,{})}};t&&typeof t.addChatMessage=="function"&&t.addChatMessage(H);const ue=[...X];return ue.splice(oe,0,H),ue})}},J=async O=>{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(X=>{const z=[...X];return g.forEach(oe=>{var ue;if(!z.some(Se=>Se.id===oe.id)&&(z.push(oe),oe.sender.type==="agent"&&(p(Se=>new Set(Se).add(oe.id)),!((ue=oe.metadata)!=null&&ue.streaming)))){const Se=oe.content.length*35+1e3;setTimeout(()=>{p(rt=>{const Qt=new Set(rt);return Qt.delete(oe.id),Qt})},Se)}}),z}),f([]),setTimeout(()=>N(!0),0));let $=null;O&&O.response&&O.response.timeoutView?$=O.response.timeoutView:O&&O.timeoutView&&($=O.timeoutView),a(X=>{const z={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:M,type:"agent"},metadata:{type:"timeoutView",view:$||m.jsx(V5,{})}};return t&&typeof t.addChatMessage=="function"&&t.addChatMessage(z),[...X,z]}),setTimeout(()=>{t.getCurrentInteraction()||x(null)},100)},K=async O=>{console.log("ChatView: RPC interaction dismissed:",O),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 X=[...$];return g.forEach(z=>{var H;if(!X.some(ue=>ue.id===z.id)&&(X.push(z),z.sender.type==="agent"&&(p(ue=>new Set(ue).add(z.id)),!((H=z.metadata)!=null&&H.streaming)))){const ue=z.content.length*35+1e3;setTimeout(()=>{p(Se=>{const rt=new Set(Se);return rt.delete(z.id),rt})},ue)}}),X}),f([]),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",W),t.on("rpc.interaction.timeout",J),t.on("rpc.interaction.dismissed",K),()=>{t.off("rpc.interaction.started",j),t.off("rpc.interaction.completed",W),t.off("rpc.interaction.timeout",J),t.off("rpc.interaction.dismissed",K)}},[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)},W=()=>{console.log("ChatView: Agent is speaking"),l(!1)};return t.on("agent.thinking",j),t.on("agent.speaking",W),()=>{t.off("agent.thinking",j),t.off("agent.speaking",W)}},[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 Z=async j=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user message send"),t.dismissCurrentInteraction(),x(null)),await t.sendChatMessage(j)}catch(W){console.error("Failed to send message:",W)}},Q=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(W=>W.name))}catch(W){console.error("Failed to send attachments:",W)}},[se,te]=v.useState([]);if(v.useEffect(()=>{const j=W=>{te(Array.isArray(W)?W:["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 ",M,"..."]})]})}const Y=w&&y?"fullscreen":r,_=Y==="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",ie=Y==="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=Y==="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",ee=()=>{k(!1),n&&n()};return m.jsxs("div",{className:_,children:[m.jsx("div",{className:ie,children:m.jsxs("div",{className:"flex items-center gap-2",children:[w&&y&&m.jsx(ge.button,{onClick:ee,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}),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(ge.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:C}),m.jsxs("p",{className:`text-base mb-2 ${w&&y?"text-white":E.text.secondary}`,children:[M," 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,W)=>{var J,K;return m.jsx("div",{children:((J=j.metadata)==null?void 0:J.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(ge.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"})})]})]})}):((K=j.metadata)==null?void 0:K.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:C}),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(_5,{message:j,theme:e,isOwn:j.sender.type==="participant",isStreaming:h.has(j.id)})},j.id)}),c&&!S&&m.jsx(ge.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:C}),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(ge.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(ge.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:C}),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(_r,{interaction:S,theme:e,onDismiss:()=>t.dismissCurrentInteraction(),client:t,addLocalMessage:I},S.methodName),m.jsx(ge.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,W)=>{var J;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
284
+ ${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":((J=E.suggestedResponse)==null?void 0:J.container)||"bg-gradient-to-br from-blue-500 to-purple-600 text-white border-blue-400 hover:from-blue-600 hover:to-purple-700"}
285
+ `,style:{boxShadow:e==="vox"?"0 2px 8px 0 rgba(80,60,200,0.10)":void 0,borderWidth:1},onClick:()=>{Z(j),te([])},children:j},j+W)})}),S&&S.presentationMode!=="embedded"&&m.jsx(_r,{interaction:S,theme:e,onDismiss:()=>t.dismissCurrentInteraction(),client:t,addLocalMessage:I},S.methodName),m.jsx(ge.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:F,children:m.jsx(M5,{onSendMessage:Z,onSendAttachments:Q,disabled:i,theme:e,onEndChat:s})})]})}function U5({onToggleCamera:t,onToggleScreenShare:e,onEndCall:n,onBack:i,theme:r,cameraEnabled:s,screenShareEnabled:o,isCameraLoading:a,isScreenShareLoading:c,disabled:l}){const d=ut(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(Bx,{className:"w-5 h-5"}):m.jsx(Ux,{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(F6,{className:"w-5 h-5"}):m.jsx(B6,{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($x,{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 Hg({trackRef:t,participant:e,isLocal:n=!1,className:i="",theme:r}){var c;const s=ut(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(th,{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(Y6,{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(Ux,{className:"w-4 h-4"})})]})}function B5({trackRefs:t,participants:e,theme:n,localParticipant:i}){const r=t.find(d=>d.source===D.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(Hg,{trackRef:r,participant:i,isLocal:!0,theme:n,className:"min-h-0"}),s.map((d,u)=>{var h;return m.jsx(Hg,{trackRef:d,participant:d.participant,isLocal:!1,theme:n,className:"min-h-0"},((h=d.publication)==null?void 0:h.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(X6,{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 $5({client:t,theme:e="vox",onBack:n,disabled:i=!1,displayType:r,onEndCall:s}){const o=ut(e),a=Gb(),[c,l]=v.useState(!1),[d,u]=v.useState(!1),[h,p]=v.useState(!1),[g,f]=v.useState(!1),[y,b]=v.useState(null),w=eh([D.Source.Camera,D.Source.ScreenShare],{onlySubscribed:!1});w.filter(E=>E.source===D.Source.Camera),w.filter(E=>E.source===D.Source.ScreenShare);const k=v.useMemo(()=>a?Array.from(a.remoteParticipants.values()):[],[a]),S=v.useCallback(async()=>{if(!(!a||h)){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,h]),x=v.useCallback(async()=>{if(!(!a||g)){f(!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{f(!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:[k.length+1," participant",k.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(L6,{className:"w-4 h-4"})})})]}),m.jsx("div",{className:"flex-1 p-4 min-h-0",children:m.jsx(B5,{trackRefs:w,participants:k,localParticipant:a==null?void 0:a.localParticipant,theme:e})}),y&&m.jsx(ge.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(_r,{interaction:y,onDismiss:()=>b(null),theme:e})}),m.jsx(U5,{onToggleCamera:S,onToggleScreenShare:x,onEndCall:T,onBack:n,theme:e,cameraEnabled:c,screenShareEnabled:d,isCameraLoading:h,isScreenShareLoading:g,disabled:i})]})}function xo({onClick:t,disabled:e,theme:n}){const i=ut(n);return m.jsx("button",{className:i.micButton,onClick:t,disabled:e,"aria-label":"Start Voice Session",type:"button",children:m.jsx(yS,{})})}function fl({onClick:t,disabled:e,theme:n}){const i=ut(n);return m.jsx("button",{className:i.chatButton,onClick:t,disabled:e,"aria-label":"Start Chat Session",type:"button",children:m.jsx(vS,{})})}function ml({onClick:t,disabled:e,theme:n}){const i=ut(n);return m.jsx("button",{className:i.videoButton,onClick:t,disabled:e,"aria-label":"Start Video Session",type:"button",children:m.jsx(bS,{})})}function H5({prompts:t,theme:e}){const n=ut(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
286
  ${n.promptSlider}
204
- ${o===s?"opacity-100":"opacity-0"}
287
+ ${o===i?"opacity-100":"opacity-0"}
205
288
  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
289
+ `,style:{minHeight:"2.5rem",display:o===i?"block":"none"},children:s},o))})}function z5({statusMessage:t,theme:e}){const n=ut(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 W5=({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=ut(c),u=l.includes("voice"),h=l.includes("chat"),p=l.includes("video"),g=[u,h,p].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:l,hasVoice:u,hasChat:h,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&&h&&p?m.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[m.jsx(xo,{onClick:e,disabled:t,theme:c}),m.jsx(fl,{onClick:n,disabled:t,theme:c}),m.jsx(ml,{onClick:i||e,disabled:t,theme:c})]}):g>1?m.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[u&&m.jsx(xo,{onClick:e,disabled:t,theme:c}),h&&m.jsx(fl,{onClick:n,disabled:t,theme:c}),p&&i&&m.jsx(ml,{onClick:i,disabled:t,theme:c})]}):m.jsx("div",{className:"flex items-center justify-center",children:u?m.jsx(xo,{onClick:e,disabled:t,theme:c}):h?m.jsx(fl,{onClick:n,disabled:t,theme:c}):p&&i?m.jsx(ml,{onClick:i,disabled:t,theme:c}):m.jsx(xo,{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(yS,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Voice"})]}),h&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(vS,{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(bS,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Video"})]})]})]}),m.jsx(H5,{prompts:r,theme:c}),m.jsx(z5,{statusMessage:s,theme:c})]})};function xS({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),[h,p]=v.useState([]),g=v.useCallback((w,k)=>{const S={timestamp:new Date,event:w,data:k,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 C=s||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,I=new Date,N={sessionId:C,startTime:I,totalMessages:0,connectionIssues:0,participantCount:h.length,events:[]};a(N),g("SESSION_STARTED",{sessionId:C,startTime:I}),n==null||n(C)},k=()=>{if(o){const C=new Date,I=C.getTime()-o.startTime.getTime(),N={...o,endTime:C,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=C=>{g("CONNECTION_STATE_CHANGED",{state:C}),C===he.Reconnecting&&o&&(a(I=>I?{...I,connectionIssues:I.connectionIssues+1}:null),g("CONNECTION_ISSUE",{type:"reconnecting"}))},x=C=>{g("TRACK_PUBLISHED",{trackKind:C.kind,trackSource:C.source})},T=C=>{g("TRACK_UNPUBLISHED",{trackKind:C.kind,trackSource:C.source})},E=(C,I)=>{o&&a(N=>N?{...N,totalMessages:N.totalMessages+1}:null),g("DATA_RECEIVED",{participantId:I==null?void 0:I.identity,dataSize:C.length})},P=C=>{g("PARTICIPANT_CONNECTED",{participantId:C.identity,participantName:C.name}),p(I=>[...I,C]),o&&a(I=>I?{...I,participantCount:I.participantCount+1}:null)},M=C=>{g("PARTICIPANT_DISCONNECTED",{participantId:C.identity,participantName:C.name}),p(I=>I.filter(N=>N.identity!==C.identity))};return t.localParticipant&&u(t.localParticipant),t.on(V.Connected,w),t.on(V.Disconnected,k),t.on(V.ConnectionStateChanged,S),t.on(V.TrackPublished,x),t.on(V.TrackUnpublished,T),t.on(V.DataReceived,E),t.on(V.ParticipantConnected,P),t.on(V.ParticipantDisconnected,M),()=>{t.off(V.Connected,w),t.off(V.Disconnected,k),t.off(V.ConnectionStateChanged,S),t.off(V.TrackPublished,x),t.off(V.TrackUnpublished,T),t.off(V.DataReceived,E),t.off(V.ParticipantConnected,P),t.off(V.ParticipantDisconnected,M)}},[t,o,c,h.length,g,e,n]);const f=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=f(),k=JSON.stringify(w,null,2),S="data:application/json;charset=utf-8,"+encodeURIComponent(k),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()},[f]);return{sessionMetrics:o,sessionLogs:c,logEvent:g,getSessionLogs:f,clearSessionLogs:y,exportSessionLogs:b}}class Rh{constructor(){Ye(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 SS{constructor(e){Ye(this,"plugins",new Map);Ye(this,"installedPlugins",new Set);Ye(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 q5(t){return t}function Ah(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 K5={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)})}},G5={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))}},Z5={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})})}},wS=R.createContext(null);function kS({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,h]=R.useState(null),[p,g]=R.useState("idle"),[f,y]=R.useState(null),[b,w]=R.useState([]),[k,S]=R.useState([]),[x,T]=R.useState([]);R.useEffect(()=>{const _=new Ks(t);return r(_),E(_),n&&P(_),()=>{_.disconnect().catch(console.error)}},[t,n]);const E=_=>{_.on("connection.connecting",()=>{c(!0),d(null)}),_.on("connection.connected",()=>{o(!0),c(!1),d(null)}),_.on("connection.disconnected",()=>{o(!1),c(!1),h(null),g("idle"),w([]),S([]),T([])}),_.on("connection.error",ie=>{d(ie),c(!1)}),_.on("session.created",ie=>{h(ie),g(ie.state)}),_.on("session.state.changed",ie=>{g(ie),u&&h({...u,state:ie})}),_.on("session.ended",(ie,L)=>{h(null),g("idle"),y(L),w([]),S([]),T([])}),_.on("participant.joined",ie=>{w(L=>[...L,ie])}),_.on("participant.left",ie=>{w(L=>L.filter(F=>F.id!==ie.id))}),_.on("chat.message.received",ie=>{S(L=>[...L,ie])}),_.on("chat.message.sent",ie=>{S(L=>[...L,ie])}),_.on("transcription.received",ie=>{T(L=>[...L,ie])})},P=async _=>{const ie=_||i;if(ie)try{await ie.connect()}catch(L){console.error("Failed to connect:",L)}},Y={client:i,isConnected:s,isConnecting:a,connectionError:l,currentSession:u,sessionState:p,sessionMetrics:f,participants:b,chatMessages:k,transcriptions:x,connect:()=>P(),disconnect:async()=>{if(i)try{await i.disconnect()}catch(_){console.error("Failed to disconnect:",_)}},createSession:async(_,ie={})=>{if(!i)throw new Error("Client not initialized");const L={agentId:_,participantName:ie.participantName||"User",metadata:ie.metadata,modalities:ie.modalities||["voice"]};return await i.createSession(L)},endSession:async()=>i?await i.endSession():null,sendChatMessage:async _=>{if(!i)throw new Error("Client not initialized");await i.sendChatMessage(_)},setMicrophoneEnabled:async _=>{if(!i)throw new Error("Client not initialized");await i.setMicrophoneEnabled(_)},setCameraEnabled:async _=>{if(!i)throw new Error("Client not initialized");await i.setCameraEnabled(_)},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(wS.Provider,{value:Y,children:e})}function xn(){const t=R.useContext(wS);if(!t)throw new Error("useVoxket must be used within a VoxketProvider");return t}class Y5 extends Rh{constructor(n){super();Ye(this,"room",null);Ye(this,"registeredMethods",new Map);Ye(this,"activeInteractions",new Map);Ye(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:(h,p)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,h),this.clearInteraction(l),this.currentInteraction=null;const g={success:!0,message:"User interaction completed successfully",data:h,timestamp:new Date,...p?{successView:p}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:g}),a(g)},didFail:h=>{console.log(`RpcManager: User interaction failed for method: ${n}`,h),this.clearInteraction(l);const p={success:!1,message:"User interaction failed",error:h,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 h={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:h}),this.emit("rpc.interaction.completed",{methodName:n,response:h}),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(h)},didTimeout:h=>{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,...h?{timeoutView:h}:{}};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:h=>a(JSON.parse(h)),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 h;if((h=this.currentInteraction)!=null&&h.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 Re extends Error{constructor(e,n,i){super(e),this.code=n,this.details=i,this.name="VoxketError"}}class Ks extends Rh{constructor(n){super();Ye(this,"config");Ye(this,"room",null);Ye(this,"pluginManager");Ye(this,"rpcManager");Ye(this,"isConnected",!1);Ye(this,"currentSession",null);Ye(this,"connectionState",he.Disconnected);Ye(this,"renderedComponents",new Map);Ye(this,"textStreamHandlersRegistered",!1);Ye(this,"currentAgentInfo",null);Ye(this,"chatMessages",[]);this.config=n,this.pluginManager=new SS(this),this.rpcManager=new Y5,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 ei,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(V.Connected,()=>{var n,i;this.connectionState=he.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(V.Disconnected,n=>{this.connectionState=he.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(V.ConnectionStateChanged,n=>{this.connectionState=n,n===he.Connecting&&this.emit("connection.connecting")}),this.room.on(V.ParticipantConnected,n=>{const i={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",i)}),this.room.on(V.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 h of n){a+=h;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=h=>{const p={...a,metadata:{...a.metadata,downloadProgress:h||0}};this.emit("chat.message.updated",p)});const c=[];for await(const h of n)c.push(h);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 h=`HTTP ${l.status}: Failed to fetch connection details`;try{const p=await l.json();p&&(p.error?h=`API Error: ${p.error}`:p.detail?h=`API Error: ${p.detail}`:p.message&&(h=`API Error: ${p.message}`))}catch{try{const g=await l.text();g&&(h=`API Error: ${g}`)}catch{}}throw new Error(h)}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 Re(`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 Re(`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 ei,this.setupRoomEventListeners()}catch(i){const r=new Re("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 Re?s:s instanceof TypeError&&s.message.includes("fetch")?new Re("Network connection failed","CONNECTION_FAILED",s):s instanceof Error&&s.message.includes("Failed to fetch connection details")?new Re(`API connection failed: ${s.message}`,"CONNECTION_FAILED",s):new Re(`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 Re("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)||zS.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(kS,{config:this.config,autoConnect:n.autoStart||!1,children:R.createElement(CS,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 Re("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Re("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Re("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 Re("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 Re("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Re("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Re("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new Re("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(s=>s.type.startsWith("image/"));if(r.length===0)throw new Re("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:h=>{const p={...l,metadata:{...l.metadata,uploadProgress:h}};this.emit("chat.message.updated",p)}});try{const h=new FileReader,p=new Promise((y,b)=>{h.onload=()=>{typeof h.result=="string"?y(h.result):b(new Error("Failed to convert to base64"))},h.onerror=b});h.readAsDataURL(o);const f={type:"image",data:await p,filename:o.name,mimeType:o.type,size:o.size};await this.room.localParticipant.sendText(JSON.stringify(f),{topic:"images",destinationIdentities:[]})}catch(h){console.warn("VoxketClient: Failed to send image data to agent:",h);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 Re("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 Re("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 Re("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 Re("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 Re("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 Re("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 Re("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 Re("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 Re("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===he.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===D.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===D.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===D.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 Re("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 Re("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 J5=ge.create(A5),X5=ge.create(F5),Q5=ge.create($5),ej=ge.create(W5);function tj({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=ut(i);return m.jsx(ge.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 zg({children:t,theme:e,displayType:n="widget",onClose:i,popupPosition:r="bottom-right",onExpand:s}){const o=ut(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 CS(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:h,loadingText:p,suportsChatInput:g=!0,suportsVideoInput:f=!0,suportsScreenShare:y=!0,theme:b="vox",onSessionStart:w,onSessionEnd:k,enableSessionLogging:S=!0,onSessionLogsUpdate:x,onSessionMetricsUpdate:T,modalities:E=["voice"],displayType:P="widget",popupPosition:M="bottom-right",popupTriggerText:C="Open Chat",onPopupToggle:I,voxketClient:N,onDisplayTypeChange:Z}=t,[Q,se]=v.useState(()=>N?!!N.getCurrentSession():!1),[te,Y]=v.useState(!1),[_,ie]=v.useState(e||""),[L,F]=v.useState(n||"User"),[ee,j]=v.useState(()=>N?N.getCurrentSession():null),[W,J]=v.useState(()=>{var pe,Un,Ft;if(N){const Fe=N.getCurrentSession();if((pe=Fe==null?void 0:Fe.activeModalities)!=null&&pe.includes("chat"))return"chat";if((Un=Fe==null?void 0:Fe.activeModalities)!=null&&Un.includes("voice"))return"voice";if((Ft=Fe==null?void 0:Fe.activeModalities)!=null&&Ft.includes("video"))return"video"}return"welcome"}),[K,O]=v.useState(!1);v.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",P)},[P]),v.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:W,sessionStarted:Q,loading:te,currentSession:ee==null?void 0:ee.id,isPopupOpen:K})},[W,Q,te,ee,K]);const $=v.useMemo(()=>{if(N)return console.log("🔄 Using passed VoxketClient to preserve session state"),N;console.log("🆕 Creating new VoxketClient instance");const pe={appId:s,appSecret:r,baseUrl:i,agentId:_,participantName:L||"User",modalities:E};return new Ks(pe)},[N,s,r,i,_,L,E]),X=E,z=v.useMemo(()=>$.getRoom()||new ei,[$]),oe={suportsChatInput:g,suportsVideoInput:f,suportsScreenShare:y},{sessionMetrics:H,sessionLogs:ue,logEvent:Se}=xS({room:z,onSessionStart:w,onSessionEnd:k,enableConsoleLogging:S,enableLocalStorage:S,voxketSessionId:ee==null?void 0:ee.id});v.useEffect(()=>{x&&x(ue)},[ue,x]),v.useEffect(()=>{T&&H&&T(H)},[H,T]),v.useEffect(()=>{const pe=Ft=>{console.log("🔴 Room disconnected:",Ft),Y(!1),se(!1),j(null),J("welcome")},Un=Ft=>{console.log("📹 Media devices error:",Ft),ao({title:"Allow access to your microphone/camera",description:`${Ft.name}: ${Ft.message}`})};return z.on(V.MediaDevicesError,Un),z.on(V.Disconnected,pe),()=>{z.off(V.Disconnected,pe),z.off(V.MediaDevicesError,Un)}},[z]);const rt=async()=>{try{console.log("🎤 Starting voice session...",{agentId:_,participantName:L}),console.log("🎤 Pre-start state:",{currentMode:W,sessionStarted:Q,loading:te}),Y(!0),se(!0),J("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),Se("USER_STARTED_VOICE_SESSION",{agentId:_,participantName:L});const pe=await $.startSession(_,{participantName:L||"User",modalities:["voice",...f?["video"]:[]]});console.log("✅ Voice session started successfully:",pe.id),j(pe),Y(!1),w&&w(pe.id)}catch(pe){console.error("❌ Failed to start voice session:",pe),ao({title:"Failed to start voice session",description:pe instanceof Error?pe.message:"Unknown error occurred"}),Y(!1),se(!1),J("welcome")}},Qt=async()=>{try{Y(!0),se(!0),J("chat"),Se("USER_STARTED_CHAT_SESSION",{agentId:_,participantName:L});const pe=await $.startSession(_,{participantName:L||"User",modalities:["chat"]});j(pe),Y(!1),w&&w(pe.id)}catch(pe){console.error("Failed to start chat session:",pe),ao({title:"Failed to start chat session",description:pe instanceof Error?pe.message:"Unknown error occurred"}),Y(!1),se(!1),J("welcome")}},vi=async()=>{try{console.log("📺 Starting video session...",{agentId:_,participantName:L}),console.log("📺 Pre-start state:",{currentMode:W,sessionStarted:Q,loading:te}),Y(!0),se(!0),J("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),Se("USER_STARTED_VIDEO_SESSION",{agentId:_,participantName:L});const pe=await $.startSession(_,{participantName:L||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",pe.id),j(pe),Y(!1),w&&w(pe.id)}catch(pe){console.error("❌ Failed to start video session:",pe),ao({title:"Failed to start video session",description:pe instanceof Error?pe.message:"Unknown error occurred"}),Y(!1),se(!1),J("welcome")}},yi=()=>{J("welcome"),Z&&Z(t.displayType||"widget"),ee&&Q&&(se(!1),j(null),$.disconnect()),P==="popup"&&!K&&O(!0)},en=()=>{const pe=!K;O(pe),I&&I(pe),!pe&&!(ee&&Q)&&(J("welcome"),se(!1),j(null))},FS=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),t.onDisplayTypeChange?t.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},US=()=>{t.onDisplayTypeChange&&t.onDisplayTypeChange("fullscreen")};v.useEffect(()=>{var pe,Un,Ft;if(N&&$){console.log("🔄 Syncing widget state with existing client session state");const Fe=$.getCurrentSession(),BS=$.connected;console.log("🔍 Existing session state:",{hasSession:!!Fe,sessionId:Fe==null?void 0:Fe.id,isConnected:BS,activeModalities:Fe==null?void 0:Fe.activeModalities}),Fe&&(console.log("✅ Restoring session state from existing client"),j(Fe),se(!0),Y(!1),(pe=Fe.activeModalities)!=null&&pe.includes("chat")?J("chat"):(Un=Fe.activeModalities)!=null&&Un.includes("voice")?J("voice"):(Ft=Fe.activeModalities)!=null&&Ft.includes("video")&&J("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 nc="w-96",ic="h-[25rem]",rc={};if(u&&(u.startsWith("w-")?nc=u:(rc.width=u,nc="")),h&&(h.startsWith("h-")?ic=h:(rc.height=h,ic="")),P==="popup"&&!K)return console.log("🟡 Showing popup trigger button"),m.jsx(tj,{onClick:en,text:C,position:M,theme:b});console.log("🟢 Rendering widget content, displayType:",P,"isPopupOpen:",K,"currentMode:",W,"sessionStarted:",Q,"loading:",te);let sc=`voxket-widget-root theme-${b}`,Zs={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};P==="widget"?(sc+=` flex items-center justify-center min-h-fit ${nc} ${ic} ${d}`,Zs={...Zs,...rc}):(sc=`${d||""}`,Zs={});const Oh=m.jsx(m.Fragment,{children:m.jsxs(yr,{mode:"wait",children:[W==="welcome"&&!te&&m.jsx(ej,{agentId:_,participantName:L||"",onAgentIdChange:ie,onParticipantNameChange:F,onStartCall:rt,onStartChat:Qt,onStartVideo:vi,disabled:Q||te,prompts:o,statusMessage:a,title:c,subTitle:l,theme:b,modalities:X,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),W==="voice"&&m.jsxs(da.Provider,{value:z,children:[m.jsx(vp,{}),m.jsx(mp,{label:"Start Audio"}),m.jsx(J5,{loadingText:p,participantName:L||"User",capabilities:oe,sessionStarted:Q,disabled:!Q,theme:b,client:$,displayType:P,onBack:P==="popup"?en:yi,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),W==="chat"&&m.jsx(X5,{client:$,theme:b,displayType:P,onBack:P==="popup"?en:yi,onEndChat:yi,disabled:!Q,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),W==="video"&&m.jsxs(da.Provider,{value:z,children:[m.jsx(vp,{}),m.jsx(mp,{label:"Start Audio"}),m.jsx(Q5,{client:$,theme:b,displayType:P,onBack:P==="popup"?en:yi,onEndCall:yi,disabled:!Q,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(zg,{theme:b,displayType:P,popupPosition:M,onClose:P==="fullscreen"?FS:en,children:Oh})):(console.log("📦 Rendering widget mode"),m.jsx("div",{className:sc,style:Zs,children:m.jsx(zg,{theme:b,displayType:P,popupPosition:M,onExpand:US,children:Oh})}))}function nj({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 ij({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 Hi(){const{currentSession:t,sessionState:e,sessionMetrics:n,createSession:i,endSession:r}=xn(),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 TS(){const{sessionMetrics:t,currentSession:e}=xn();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 ES(){const{setMicrophoneEnabled:t,client:e}=xn(),[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 PS(){const{setCameraEnabled:t}=xn(),[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 RS(){const{startScreenShare:t,stopScreenShare:e}=xn(),[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 rj(){const{client:t}=xn(),[e,n]=R.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),i=R.useMemo(()=>e.tracks.find(f=>f.isLocal),[e.tracks]),r=R.useMemo(()=>e.tracks.filter(f=>!f.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(f){throw console.error("Failed to toggle camera:",f),f}},[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(f){throw console.error("Failed to toggle screen share:",f),f}},[t,e.tracks]),a=R.useCallback(f=>{n(y=>({...y,layout:f}))},[]),c=R.useCallback(f=>{n(y=>({...y,pinnedTrack:f}))},[]),l=R.useCallback(()=>{n(f=>({...f,pinnedTrack:void 0}))},[]),d=R.useCallback(async()=>{try{await(t==null?void 0:t.startRecording()),n(f=>({...f,isRecording:!0}))}catch(f){throw console.error("Failed to start recording:",f),f}},[t]),u=R.useCallback(async()=>{try{await(t==null?void 0:t.stopRecording()),n(f=>({...f,isRecording:!1}))}catch(f){throw console.error("Failed to stop recording:",f),f}},[t]),h=R.useCallback(f=>e.tracks.find(y=>y.id===f),[e.tracks]),p=R.useCallback(f=>e.tracks.filter(y=>y.participantId===f),[e.tracks]),g=R.useCallback(f=>f.isEnabled&&e.tracks.includes(f),[e.tracks]);return R.useEffect(()=>{if(!t)return;const f=w=>{n(k=>({...k,tracks:[...k.tracks.filter(S=>S.id!==w.id),w]}))},y=w=>{n(k=>{var S;return{...k,tracks:k.tracks.filter(x=>x.id!==w),pinnedTrack:((S=k.pinnedTrack)==null?void 0:S.id)===w?void 0:k.pinnedTrack}})},b=w=>{n(k=>({...k,tracks:k.tracks.map(S=>S.id===w.id?w:S)}))};return t.on("videoTrackAdded",f),t.on("videoTrackRemoved",y),t.on("videoTrackUpdated",b),()=>{t.off("videoTrackAdded",f),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:h,getTracksByParticipant:p,isTrackActive:g}}function tc(){const{chatMessages:t,sendChatMessage:e,currentSession:n}=xn(),[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 sj(){const{send:t,isSending:e,canSend:n}=tc(),[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 Ih(){const{isConnected:t,isConnecting:e,connectionError:n,connect:i,disconnect:r}=xn(),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 AS(){const{participants:t}=xn();return{participants:t,count:t.length,localParticipant:t.find(e=>e.isLocal),remoteParticipants:t.filter(e=>!e.isLocal)}}const IS=R.createContext({}),Gs=()=>R.useContext(IS);function MS({children:t,...e}){return m.jsx(IS.Provider,{value:e,children:t})}function Ko({name:t,children:e,fallback:n,className:i}){return m.jsx("div",{className:`voxket-slot voxket-slot--${t} ${i||""}`,children:e||n})}function NS(t,e={}){return Object.assign(t,e)}function _S({showMicrophoneControl:t=!0,showCameraControl:e=!0,showScreenShareControl:n=!0,showSessionActions:i=!0,customControls:r,className:s=""}){const o=Hi(),a=ES(),c=PS(),l=RS(),d=Gs(),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(oj,{})}),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 oj(){Hi();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 Mh({showConnectionStatus:t=!0,showSessionInfo:e=!0,showAgentInfo:n=!0,className:i=""}){const r=Hi(),s=Ih(),o=Gs(),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 Nh({showChat:t=!0,showTranscriptions:e=!1,customContent:n,className:i=""}){const r=Hi(),s=tc(),o=Gs(),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(aj,{})]}),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 aj(){const t=tc(),[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 _h({showMetrics:t=!0,showParticipants:e=!0,showStatus:n=!0,customFooter:i,className:r=""}){const s=Hi(),o=TS(),a=AS(),c=Gs(),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:cj(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 cj(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 lj({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=Hi(),u=Ih();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 h=["voxket-session",`voxket-session--${s}`,`voxket-session--${o}`,d.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return m.jsx(MS,{variant:s,size:o,theme:a,className:c,children:m.jsx("div",{className:h,children:l||m.jsxs(m.Fragment,{children:[m.jsx(Ko,{name:"header",fallback:m.jsx(Mh,{})}),m.jsx(Ko,{name:"content",fallback:m.jsx(Nh,{})}),m.jsx(Ko,{name:"footer",fallback:m.jsx(_h,{})})]})})})}const OS=NS(lj,{Header:Mh,Content:Nh,Footer:_h,Controls:_S}),Ni={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)"}},zd={...Ni,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)"}},Wd={...Ni,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"}},DS=R.createContext(null),jS=()=>{const t=R.useContext(DS);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};function dj({theme:t="default",themes:e={},children:n,cssVariables:i=!0,className:r=""}){const[s,o]=R.useState(()=>{const h={default:Ni,dark:zd,enterprise:Wd,...e};return typeof t=="string"?h[t]||Ni:t}),[a,c]=R.useState(()=>({default:Ni,dark:zd,enterprise:Wd,...e})),l=h=>{if(typeof h=="string"){const p=a[h];p&&o(p)}else o(h)},d=h=>{c(p=>({...p,[h.name]:h}))};R.useEffect(()=>{if(i&&typeof document<"u"){const h=document.documentElement;Object.entries(LS(s)).forEach(([p,g])=>{h.style.setProperty(`--voxket-${p}`,g)})}},[s,i]);const u={theme:s,setTheme:l,themes:a,registerTheme:d};return m.jsx(DS.Provider,{value:u,children:m.jsx("div",{className:`voxket-theme voxket-theme--${s.name} ${r}`,children:n})})}function LS(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 uj(t=Ni,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 hj(t){var n;const{theme:e}=jS();return((n=e.components)==null?void 0:n[t])||{}}const fj=Ah("voice-modality","voice",{onActivate:async t=>{const e=t.config;e.enableTranscription&&mj(t),e.enableVoiceActivation&&pj(t,e),console.log("Voice modality activated",e)},onDeactivate:async t=>{console.log("Voice modality deactivated")},onMessage:async(t,e)=>{e.type==="audio"&&gj(t,e)}});function mj(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 pj(t,e){const n=e.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function gj(t,e){console.log("Playing audio response:",e.content)}const vj=Ah("chat-modality","chat",{onActivate:async t=>{const e=t.config;e.enableRichText&&yj(),e.enableFileUpload&&bj(t),e.enableCustomComponents&&xj(),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"?Sj(t,e):e.type==="text"&&n.enableRichText&&wj(t,e)}});function yj(t){console.log("Rich text support enabled")}function bj(t){console.log("File upload enabled"),t.on("chat.file.uploaded",e=>{console.log("File uploaded:",e.name)})}function xj(t){console.log("Custom components enabled");const e=new Map;e.set("quick-actions",kj),e.set("form",Cj),e.set("card",Tj),e.set("chart",Ej)}function Sj(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 wj(t,e){console.log("Processing rich text message:",e.content)}function kj(t){return{type:"quick-actions",actions:t.actions||[],layout:t.layout||"horizontal"}}function Cj(t){return{type:"form",fields:t.fields||[],submitAction:t.submitAction,validation:t.validation}}function Tj(t){return{type:"card",title:t.title,content:t.content,actions:t.actions,variant:t.variant||"default"}}function Ej(t){return{type:"chart",chartType:t.chartType||"line",data:t.data,options:t.options}}function Go({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,h]=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)},f=["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:f,onClick:p,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!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 Pj({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 k=a*s,S=k+s;return w.slice(k,S)},[t,e,l,a,s]),h=Math.ceil(t.length/s),p=R.useMemo(()=>{const w=u.length;switch(e.type){case"grid":const k=Math.ceil(Math.sqrt(w)),S=Math.ceil(w/k);return{display:"grid",gridTemplateColumns:`repeat(${k}, 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)},f=()=>{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:Rj(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(Go,{track:l,participantName:`Participant ${l.participantId}`,isPinned:!0,onClick:r,onUnpin:f})}),m.jsx("div",{className:"voxket-video-speaker-sidebar",children:u.filter(w=>w.id!==l.id).map(w=>m.jsx(Go,{track:w,participantName:`Participant ${w.participantId}`,showControls:!1,onClick:r,onPin:g},w.id))})]}):u.map(w=>m.jsx(Go,{track:w,participantName:`Participant ${w.participantId}`,isPinned:(l==null?void 0:l.id)===w.id,onClick:r,onPin:g,onUnpin:f},w.id))}),o&&h>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 ",h]}),m.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(h-1,a+1)),disabled:a===h-1,children:"→"})]})]})}function Rj(t){switch(t){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function Aj({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:h})=>m.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>l(d),title:`Switch to ${h} layout`,children:[m.jsx("span",{className:"voxket-control-icon",children:u}),m.jsx("span",{className:"voxket-control-label",children:h})]},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 VS=({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 h=({message:f,assignment:y})=>{const b=f.toLowerCase().includes("declined"),w=b?"bg-red-50 border-red-200":"bg-green-50 border-green-200",k=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:`${k} font-semibold text-sm mb-1`,children:f}),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 f={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",f),t.didSuccess(f,m.jsx(h,{message:"Assignment accepted!",assignment:s}))}catch(f){console.error("📋 AssignmentView: Error accepting assignment:",f),t.didFail({error:"Failed to accept assignment"})}finally{d(!1)}}},g=async()=>{if(!(!s||!t)){d(!0);try{const f={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",f),t.didSuccess(f,m.jsx(h,{message:"Assignment declined",assignment:s}))}catch(f){console.error("📋 AssignmentView: Error declining assignment:",f),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 Ij(){const[t,e]=v.useState(null),[n,i]=v.useState([]);v.useEffect(()=>{const a=new Ks({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",VS,"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(""),h=[{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=f=>{u(f)},g=()=>{const f=h.find(y=>y.id===d);c==null||c.didSuccess({selectedProduct:d,productName:f==null?void 0:f.name,price:f==null?void 0:f.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:h.map(f=>m.jsx("div",{onClick:()=>p(f.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${d===f.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:f.name}),m.jsx("p",{className:"text-gray-600 text-sm",children:f.price})]}),m.jsx("div",{className:`w-4 h-4 rounded-full ${d===f.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},f.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,h]=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=>h(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
290
  const response = await participant.performRpc({
208
291
  method: 'give_assignment',
209
292
  data: JSON.stringify({
@@ -214,4 +297,4 @@ const response = await participant.performRpc({
214
297
  })
215
298
  });
216
299
 
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;
300
+ console.log('User response:', response);`})]})]})}const Mj={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"}}}},Nj=t=>typeof window>"u"?null:R.createElement(CS,t);exports.AssignmentView=VS;exports.CompoundProvider=MS;exports.InteractiveComponent=_r;exports.PluginManager=SS;exports.RpcExamples=Ij;exports.SessionContainer=OS;exports.SessionContent=Nh;exports.SessionControls=_S;exports.SessionFooter=_h;exports.SessionHeader=Mh;exports.SessionLogViewer=nj;exports.SessionMetricsComponent=ij;exports.Slot=Ko;exports.ThemeProvider=dj;exports.VideoControls=Aj;exports.VideoGrid=Pj;exports.VideoTile=Go;exports.VoxketClient=Ks;exports.VoxketEventEmitter=Rh;exports.VoxketProvider=kS;exports.VoxketSDK=Ks;exports.VoxketSessionComponent=OS;exports.agentRpcExample=Mj;exports.analyticsPlugin=K5;exports.chatModalityPlugin=vj;exports.createCustomTheme=uj;exports.createModalityPlugin=Ah;exports.createPlugin=q5;exports.darkTheme=zd;exports.debugPlugin=G5;exports.default=Nj;exports.defaultTheme=Ni;exports.enterpriseTheme=Wd;exports.flattenTheme=LS;exports.metricsPlugin=Z5;exports.useComponentTheme=hj;exports.useCompoundContext=Gs;exports.useSessionLogging=xS;exports.useTheme=jS;exports.useVoxket=xn;exports.useVoxketCamera=PS;exports.useVoxketChat=tc;exports.useVoxketChatInput=sj;exports.useVoxketConnection=Ih;exports.useVoxketMetrics=TS;exports.useVoxketMicrophone=ES;exports.useVoxketParticipants=AS;exports.useVoxketScreenShare=RS;exports.useVoxketSession=Hi;exports.useVoxketVideo=rj;exports.voiceModalityPlugin=fj;exports.withCompoundComponent=NS;