function _mergeNamespaces(x,C){for(var E=0;E<C.length;E++){const w=C[E];if(typeof w!="string"&&!Array.isArray(w)){for(const T in w)if(T!=="default"&&!(T in x)){const _=Object.getOwnPropertyDescriptor(w,T);_&&Object.defineProperty(x,T,_.get?_:{enumerable:!0,get:()=>w[T]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const T of document.querySelectorAll('link[rel="modulepreload"]'))w(T);new MutationObserver(T=>{for(const _ of T)if(_.type==="childList")for(const S of _.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&w(S)}).observe(document,{childList:!0,subtree:!0});function E(T){const _={};return T.integrity&&(_.integrity=T.integrity),T.referrerPolicy&&(_.referrerPolicy=T.referrerPolicy),T.crossOrigin==="use-credentials"?_.credentials="include":T.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function w(T){if(T.ep)return;T.ep=!0;const _=E(T);fetch(T.href,_)}})();var commonjsGlobal$1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var jsxRuntime={exports:{}},reactJsxRuntime_production={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredReactJsxRuntime_production;function requireReactJsxRuntime_production(){if(hasRequiredReactJsxRuntime_production)return reactJsxRuntime_production;hasRequiredReactJsxRuntime_production=1;var x=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function E(w,T,_){var S=null;if(_!==void 0&&(S=""+_),T.key!==void 0&&(S=""+T.key),"key"in T){_={};for(var R in T)R!=="key"&&(_[R]=T[R])}else _=T;return T=_.ref,{$$typeof:x,type:w,key:S,ref:T!==void 0?T:null,props:_}}return reactJsxRuntime_production.Fragment=C,reactJsxRuntime_production.jsx=E,reactJsxRuntime_production.jsxs=E,reactJsxRuntime_production}var hasRequiredJsxRuntime;function requireJsxRuntime(){return hasRequiredJsxRuntime||(hasRequiredJsxRuntime=1,jsxRuntime.exports=requireReactJsxRuntime_production()),jsxRuntime.exports}var jsxRuntimeExports=requireJsxRuntime(),react={exports:{}},react_production={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredReact_production;function requireReact_production(){if(hasRequiredReact_production)return react_production;hasRequiredReact_production=1;var x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),O=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ee=Symbol.iterator;function te(Pe){return Pe===null||typeof Pe!="object"?null:(Pe=ee&&Pe[ee]||Pe["@@iterator"],typeof Pe=="function"?Pe:null)}var ie={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ne=Object.assign,ae={};function oe(Pe,$e,He){this.props=Pe,this.context=$e,this.refs=ae,this.updater=He||ie}oe.prototype.isReactComponent={},oe.prototype.setState=function(Pe,$e){if(typeof Pe!="object"&&typeof Pe!="function"&&Pe!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Pe,$e,"setState")},oe.prototype.forceUpdate=function(Pe){this.updater.enqueueForceUpdate(this,Pe,"forceUpdate")};function le(){}le.prototype=oe.prototype;function fe(Pe,$e,He){this.props=Pe,this.context=$e,this.refs=ae,this.updater=He||ie}var de=fe.prototype=new le;de.constructor=fe,ne(de,oe.prototype),de.isPureReactComponent=!0;var ce=Array.isArray,pe={H:null,A:null,T:null,S:null,V:null},he=Object.prototype.hasOwnProperty;function me(Pe,$e,He,je,Ne,Oe){return He=Oe.ref,{$$typeof:x,type:Pe,key:$e,ref:He!==void 0?He:null,props:Oe}}function ve(Pe,$e){return me(Pe.type,$e,void 0,void 0,void 0,Pe.props)}function ye(Pe){return typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===x}function Se(Pe){var $e={"=":"=0",":":"=2"};return"$"+Pe.replace(/[=:]/g,function(He){return $e[He]})}var Ce=/\/+/g;function be(Pe,$e){return typeof Pe=="object"&&Pe!==null&&Pe.key!=null?Se(""+Pe.key):$e.toString(36)}function Ee(){}function Ae(Pe){switch(Pe.status){case"fulfilled":return Pe.value;case"rejected":throw Pe.reason;default:switch(typeof Pe.status=="string"?Pe.then(Ee,Ee):(Pe.status="pending",Pe.then(function($e){Pe.status==="pending"&&(Pe.status="fulfilled",Pe.value=$e)},function($e){Pe.status==="pending"&&(Pe.status="rejected",Pe.reason=$e)})),Pe.status){case"fulfilled":return Pe.value;case"rejected":throw Pe.reason}}throw Pe}function Ie(Pe,$e,He,je,Ne){var Oe=typeof Pe;(Oe==="undefined"||Oe==="boolean")&&(Pe=null);var Ve=!1;if(Pe===null)Ve=!0;else switch(Oe){case"bigint":case"string":case"number":Ve=!0;break;case"object":switch(Pe.$$typeof){case x:case C:Ve=!0;break;case H:return Ve=Pe._init,Ie(Ve(Pe._payload),$e,He,je,Ne)}}if(Ve)return Ne=Ne(Pe),Ve=je===""?"."+be(Pe,0):je,ce(Ne)?(He="",Ve!=null&&(He=Ve.replace(Ce,"$&/")+"/"),Ie(Ne,$e,He,"",function(ir){return ir})):Ne!=null&&(ye(Ne)&&(Ne=ve(Ne,He+(Ne.key==null||Pe&&Pe.key===Ne.key?"":(""+Ne.key).replace(Ce,"$&/")+"/")+Ve)),$e.push(Ne)),1;Ve=0;var Ht=je===""?".":je+":";if(ce(Pe))for(var Kt=0;Kt<Pe.length;Kt++)je=Pe[Kt],Oe=Ht+be(je,Kt),Ve+=Ie(je,$e,He,Oe,Ne);else if(Kt=te(Pe),typeof Kt=="function")for(Pe=Kt.call(Pe),Kt=0;!(je=Pe.next()).done;)je=je.value,Oe=Ht+be(je,Kt++),Ve+=Ie(je,$e,He,Oe,Ne);else if(Oe==="object"){if(typeof Pe.then=="function")return Ie(Ae(Pe),$e,He,je,Ne);throw $e=String(Pe),Error("Objects are not valid as a React child (found: "+($e==="[object Object]"?"object with keys {"+Object.keys(Pe).join(", ")+"}":$e)+"). If you meant to render a collection of children, use an array instead.")}return Ve}function Te(Pe,$e,He){if(Pe==null)return Pe;var je=[],Ne=0;return Ie(Pe,je,"","",function(Oe){return $e.call(He,Oe,Ne++)}),je}function De(Pe){if(Pe._status===-1){var $e=Pe._result;$e=$e(),$e.then(function(He){(Pe._status===0||Pe._status===-1)&&(Pe._status=1,Pe._result=He)},function(He){(Pe._status===0||Pe._status===-1)&&(Pe._status=2,Pe._result=He)}),Pe._status===-1&&(Pe._status=0,Pe._result=$e)}if(Pe._status===1)return Pe._result.default;throw Pe._result}var Ue=typeof reportError=="function"?reportError:function(Pe){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof Pe=="object"&&Pe!==null&&typeof Pe.message=="string"?String(Pe.message):String(Pe),error:Pe});if(!window.dispatchEvent($e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",Pe);return}console.error(Pe)};function ze(){}return react_production.Children={map:Te,forEach:function(Pe,$e,He){Te(Pe,function(){$e.apply(this,arguments)},He)},count:function(Pe){var $e=0;return Te(Pe,function(){$e++}),$e},toArray:function(Pe){return Te(Pe,function($e){return $e})||[]},only:function(Pe){if(!ye(Pe))throw Error("React.Children.only expected to receive a single React element child.");return Pe}},react_production.Component=oe,react_production.Fragment=E,react_production.Profiler=T,react_production.PureComponent=fe,react_production.StrictMode=w,react_production.Suspense=A,react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=pe,react_production.__COMPILER_RUNTIME={__proto__:null,c:function(Pe){return pe.H.useMemoCache(Pe)}},react_production.cache=function(Pe){return function(){return Pe.apply(null,arguments)}},react_production.cloneElement=function(Pe,$e,He){if(Pe==null)throw Error("The argument must be a React element, but you passed "+Pe+".");var je=ne({},Pe.props),Ne=Pe.key,Oe=void 0;if($e!=null)for(Ve in $e.ref!==void 0&&(Oe=void 0),$e.key!==void 0&&(Ne=""+$e.key),$e)!he.call($e,Ve)||Ve==="key"||Ve==="__self"||Ve==="__source"||Ve==="ref"&&$e.ref===void 0||(je[Ve]=$e[Ve]);var Ve=arguments.length-2;if(Ve===1)je.children=He;else if(1<Ve){for(var Ht=Array(Ve),Kt=0;Kt<Ve;Kt++)Ht[Kt]=arguments[Kt+2];je.children=Ht}return me(Pe.type,Ne,void 0,void 0,Oe,je)},react_production.createContext=function(Pe){return Pe={$$typeof:S,_currentValue:Pe,_currentValue2:Pe,_threadCount:0,Provider:null,Consumer:null},Pe.Provider=Pe,Pe.Consumer={$$typeof:_,_context:Pe},Pe},react_production.createElement=function(Pe,$e,He){var je,Ne={},Oe=null;if($e!=null)for(je in $e.key!==void 0&&(Oe=""+$e.key),$e)he.call($e,je)&&je!=="key"&&je!=="__self"&&je!=="__source"&&(Ne[je]=$e[je]);var Ve=arguments.length-2;if(Ve===1)Ne.children=He;else if(1<Ve){for(var Ht=Array(Ve),Kt=0;Kt<Ve;Kt++)Ht[Kt]=arguments[Kt+2];Ne.children=Ht}if(Pe&&Pe.defaultProps)for(je in Ve=Pe.defaultProps,Ve)Ne[je]===void 0&&(Ne[je]=Ve[je]);return me(Pe,Oe,void 0,void 0,null,Ne)},react_production.createRef=function(){return{current:null}},react_production.forwardRef=function(Pe){return{$$typeof:R,render:Pe}},react_production.isValidElement=ye,react_production.lazy=function(Pe){return{$$typeof:H,_payload:{_status:-1,_result:Pe},_init:De}},react_production.memo=function(Pe,$e){return{$$typeof:O,type:Pe,compare:$e===void 0?null:$e}},react_production.startTransition=function(Pe){var $e=pe.T,He={};pe.T=He;try{var je=Pe(),Ne=pe.S;Ne!==null&&Ne(He,je),typeof je=="object"&&je!==null&&typeof je.then=="function"&&je.then(ze,Ue)}catch(Oe){Ue(Oe)}finally{pe.T=$e}},react_production.unstable_useCacheRefresh=function(){return pe.H.useCacheRefresh()},react_production.use=function(Pe){return pe.H.use(Pe)},react_production.useActionState=function(Pe,$e,He){return pe.H.useActionState(Pe,$e,He)},react_production.useCallback=function(Pe,$e){return pe.H.useCallback(Pe,$e)},react_production.useContext=function(Pe){return pe.H.useContext(Pe)},react_production.useDebugValue=function(){},react_production.useDeferredValue=function(Pe,$e){return pe.H.useDeferredValue(Pe,$e)},react_production.useEffect=function(Pe,$e,He){var je=pe.H;if(typeof He=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return je.useEffect(Pe,$e)},react_production.useId=function(){return pe.H.useId()},react_production.useImperativeHandle=function(Pe,$e,He){return pe.H.useImperativeHandle(Pe,$e,He)},react_production.useInsertionEffect=function(Pe,$e){return pe.H.useInsertionEffect(Pe,$e)},react_production.useLayoutEffect=function(Pe,$e){return pe.H.useLayoutEffect(Pe,$e)},react_production.useMemo=function(Pe,$e){return pe.H.useMemo(Pe,$e)},react_production.useOptimistic=function(Pe,$e){return pe.H.useOptimistic(Pe,$e)},react_production.useReducer=function(Pe,$e,He){return pe.H.useReducer(Pe,$e,He)},react_production.useRef=function(Pe){return pe.H.useRef(Pe)},react_production.useState=function(Pe){return pe.H.useState(Pe)},react_production.useSyncExternalStore=function(Pe,$e,He){return pe.H.useSyncExternalStore(Pe,$e,He)},react_production.useTransition=function(){return pe.H.useTransition()},react_production.version="19.1.1",react_production}var hasRequiredReact;function requireReact(){return hasRequiredReact||(hasRequiredReact=1,react.exports=requireReact_production()),react.exports}var reactExports=requireReact();const React=getDefaultExportFromCjs(reactExports),React$1=_mergeNamespaces({__proto__:null,default:React},[reactExports]);var client={exports:{}},reactDomClient_production={},scheduler={exports:{}},scheduler_production={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredScheduler_production;function requireScheduler_production(){return hasRequiredScheduler_production||(hasRequiredScheduler_production=1,function(x){function C(Te,De){var Ue=Te.length;Te.push(De);e:for(;0<Ue;){var ze=Ue-1>>>1,Pe=Te[ze];if(0<T(Pe,De))Te[ze]=De,Te[Ue]=Pe,Ue=ze;else break e}}function E(Te){return Te.length===0?null:Te[0]}function w(Te){if(Te.length===0)return null;var De=Te[0],Ue=Te.pop();if(Ue!==De){Te[0]=Ue;e:for(var ze=0,Pe=Te.length,$e=Pe>>>1;ze<$e;){var He=2*(ze+1)-1,je=Te[He],Ne=He+1,Oe=Te[Ne];if(0>T(je,Ue))Ne<Pe&&0>T(Oe,je)?(Te[ze]=Oe,Te[Ne]=Ue,ze=Ne):(Te[ze]=je,Te[He]=Ue,ze=He);else if(Ne<Pe&&0>T(Oe,Ue))Te[ze]=Oe,Te[Ne]=Ue,ze=Ne;else break e}}return De}function T(Te,De){var Ue=Te.sortIndex-De.sortIndex;return Ue!==0?Ue:Te.id-De.id}if(x.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var _=performance;x.unstable_now=function(){return _.now()}}else{var S=Date,R=S.now();x.unstable_now=function(){return S.now()-R}}var A=[],O=[],H=1,ee=null,te=3,ie=!1,ne=!1,ae=!1,oe=!1,le=typeof setTimeout=="function"?setTimeout:null,fe=typeof clearTimeout=="function"?clearTimeout:null,de=typeof setImmediate<"u"?setImmediate:null;function ce(Te){for(var De=E(O);De!==null;){if(De.callback===null)w(O);else if(De.startTime<=Te)w(O),De.sortIndex=De.expirationTime,C(A,De);else break;De=E(O)}}function pe(Te){if(ae=!1,ce(Te),!ne)if(E(A)!==null)ne=!0,he||(he=!0,be());else{var De=E(O);De!==null&&Ie(pe,De.startTime-Te)}}var he=!1,me=-1,ve=5,ye=-1;function Se(){return oe?!0:!(x.unstable_now()-ye<ve)}function Ce(){if(oe=!1,he){var Te=x.unstable_now();ye=Te;var De=!0;try{e:{ne=!1,ae&&(ae=!1,fe(me),me=-1),ie=!0;var Ue=te;try{t:{for(ce(Te),ee=E(A);ee!==null&&!(ee.expirationTime>Te&&Se());){var ze=ee.callback;if(typeof ze=="function"){ee.callback=null,te=ee.priorityLevel;var Pe=ze(ee.expirationTime<=Te);if(Te=x.unstable_now(),typeof Pe=="function"){ee.callback=Pe,ce(Te),De=!0;break t}ee===E(A)&&w(A),ce(Te)}else w(A);ee=E(A)}if(ee!==null)De=!0;else{var $e=E(O);$e!==null&&Ie(pe,$e.startTime-Te),De=!1}}break e}finally{ee=null,te=Ue,ie=!1}De=void 0}}finally{De?be():he=!1}}}var be;if(typeof de=="function")be=function(){de(Ce)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Ae=Ee.port2;Ee.port1.onmessage=Ce,be=function(){Ae.postMessage(null)}}else be=function(){le(Ce,0)};function Ie(Te,De){me=le(function(){Te(x.unstable_now())},De)}x.unstable_IdlePriority=5,x.unstable_ImmediatePriority=1,x.unstable_LowPriority=4,x.unstable_NormalPriority=3,x.unstable_Profiling=null,x.unstable_UserBlockingPriority=2,x.unstable_cancelCallback=function(Te){Te.callback=null},x.unstable_forceFrameRate=function(Te){0>Te||125<Te?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ve=0<Te?Math.floor(1e3/Te):5},x.unstable_getCurrentPriorityLevel=function(){return te},x.unstable_next=function(Te){switch(te){case 1:case 2:case 3:var De=3;break;default:De=te}var Ue=te;te=De;try{return Te()}finally{te=Ue}},x.unstable_requestPaint=function(){oe=!0},x.unstable_runWithPriority=function(Te,De){switch(Te){case 1:case 2:case 3:case 4:case 5:break;default:Te=3}var Ue=te;te=Te;try{return De()}finally{te=Ue}},x.unstable_scheduleCallback=function(Te,De,Ue){var ze=x.unstable_now();switch(typeof Ue=="object"&&Ue!==null?(Ue=Ue.delay,Ue=typeof Ue=="number"&&0<Ue?ze+Ue:ze):Ue=ze,Te){case 1:var Pe=-1;break;case 2:Pe=250;break;case 5:Pe=1073741823;break;case 4:Pe=1e4;break;default:Pe=5e3}return Pe=Ue+Pe,Te={id:H++,callback:De,priorityLevel:Te,startTime:Ue,expirationTime:Pe,sortIndex:-1},Ue>ze?(Te.sortIndex=Ue,C(O,Te),E(A)===null&&Te===E(O)&&(ae?(fe(me),me=-1):ae=!0,Ie(pe,Ue-ze))):(Te.sortIndex=Pe,C(A,Te),ne||ie||(ne=!0,he||(he=!0,be()))),Te},x.unstable_shouldYield=Se,x.unstable_wrapCallback=function(Te){var De=te;return function(){var Ue=te;te=De;try{return Te.apply(this,arguments)}finally{te=Ue}}}}(scheduler_production)),scheduler_production}var hasRequiredScheduler;function requireScheduler(){return hasRequiredScheduler||(hasRequiredScheduler=1,scheduler.exports=requireScheduler_production()),scheduler.exports}var reactDom={exports:{}},reactDom_production={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredReactDom_production;function requireReactDom_production(){if(hasRequiredReactDom_production)return reactDom_production;hasRequiredReactDom_production=1;var x=requireReact();function C(A){var O="https://react.dev/errors/"+A;if(1<arguments.length){O+="?args[]="+encodeURIComponent(arguments[1]);for(var H=2;H<arguments.length;H++)O+="&args[]="+encodeURIComponent(arguments[H])}return"Minified React error #"+A+"; visit "+O+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function E(){}var w={d:{f:E,r:function(){throw Error(C(522))},D:E,C:E,L:E,m:E,X:E,S:E,M:E},p:0,findDOMNode:null},T=Symbol.for("react.portal");function _(A,O,H){var ee=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:ee==null?null:""+ee,children:A,containerInfo:O,implementation:H}}var S=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function R(A,O){if(A==="font")return"";if(typeof O=="string")return O==="use-credentials"?O:""}return reactDom_production.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,reactDom_production.createPortal=function(A,O){var H=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!O||O.nodeType!==1&&O.nodeType!==9&&O.nodeType!==11)throw Error(C(299));return _(A,O,null,H)},reactDom_production.flushSync=function(A){var O=S.T,H=w.p;try{if(S.T=null,w.p=2,A)return A()}finally{S.T=O,w.p=H,w.d.f()}},reactDom_production.preconnect=function(A,O){typeof A=="string"&&(O?(O=O.crossOrigin,O=typeof O=="string"?O==="use-credentials"?O:"":void 0):O=null,w.d.C(A,O))},reactDom_production.prefetchDNS=function(A){typeof A=="string"&&w.d.D(A)},reactDom_production.preinit=function(A,O){if(typeof A=="string"&&O&&typeof O.as=="string"){var H=O.as,ee=R(H,O.crossOrigin),te=typeof O.integrity=="string"?O.integrity:void 0,ie=typeof O.fetchPriority=="string"?O.fetchPriority:void 0;H==="style"?w.d.S(A,typeof O.precedence=="string"?O.precedence:void 0,{crossOrigin:ee,integrity:te,fetchPriority:ie}):H==="script"&&w.d.X(A,{crossOrigin:ee,integrity:te,fetchPriority:ie,nonce:typeof O.nonce=="string"?O.nonce:void 0})}},reactDom_production.preinitModule=function(A,O){if(typeof A=="string")if(typeof O=="object"&&O!==null){if(O.as==null||O.as==="script"){var H=R(O.as,O.crossOrigin);w.d.M(A,{crossOrigin:H,integrity:typeof O.integrity=="string"?O.integrity:void 0,nonce:typeof O.nonce=="string"?O.nonce:void 0})}}else O==null&&w.d.M(A)},reactDom_production.preload=function(A,O){if(typeof A=="string"&&typeof O=="object"&&O!==null&&typeof O.as=="string"){var H=O.as,ee=R(H,O.crossOrigin);w.d.L(A,H,{crossOrigin:ee,integrity:typeof O.integrity=="string"?O.integrity:void 0,nonce:typeof O.nonce=="string"?O.nonce:void 0,type:typeof O.type=="string"?O.type:void 0,fetchPriority:typeof O.fetchPriority=="string"?O.fetchPriority:void 0,referrerPolicy:typeof O.referrerPolicy=="string"?O.referrerPolicy:void 0,imageSrcSet:typeof O.imageSrcSet=="string"?O.imageSrcSet:void 0,imageSizes:typeof O.imageSizes=="string"?O.imageSizes:void 0,media:typeof O.media=="string"?O.media:void 0})}},reactDom_production.preloadModule=function(A,O){if(typeof A=="string")if(O){var H=R(O.as,O.crossOrigin);w.d.m(A,{as:typeof O.as=="string"&&O.as!=="script"?O.as:void 0,crossOrigin:H,integrity:typeof O.integrity=="string"?O.integrity:void 0})}else w.d.m(A)},reactDom_production.requestFormReset=function(A){w.d.r(A)},reactDom_production.unstable_batchedUpdates=function(A,O){return A(O)},reactDom_production.useFormState=function(A,O,H){return S.H.useFormState(A,O,H)},reactDom_production.useFormStatus=function(){return S.H.useHostTransitionStatus()},reactDom_production.version="19.1.1",reactDom_production}var hasRequiredReactDom;function requireReactDom(){if(hasRequiredReactDom)return reactDom.exports;hasRequiredReactDom=1;function x(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(x)}catch(C){console.error(C)}}return x(),reactDom.exports=requireReactDom_production(),reactDom.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredReactDomClient_production;function requireReactDomClient_production(){if(hasRequiredReactDomClient_production)return reactDomClient_production;hasRequiredReactDomClient_production=1;var x=requireScheduler(),C=requireReact(),E=requireReactDom();function w(M){var D="https://react.dev/errors/"+M;if(1<arguments.length){D+="?args[]="+encodeURIComponent(arguments[1]);for(var Y=2;Y<arguments.length;Y++)D+="&args[]="+encodeURIComponent(arguments[Y])}return"Minified React error #"+M+"; visit "+D+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function T(M){return!(!M||M.nodeType!==1&&M.nodeType!==9&&M.nodeType!==11)}function _(M){var D=M,Y=M;if(M.alternate)for(;D.return;)D=D.return;else{M=D;do D=M,(D.flags&4098)!==0&&(Y=D.return),M=D.return;while(M)}return D.tag===3?Y:null}function S(M){if(M.tag===13){var D=M.memoizedState;if(D===null&&(M=M.alternate,M!==null&&(D=M.memoizedState)),D!==null)return D.dehydrated}return null}function R(M){if(_(M)!==M)throw Error(w(188))}function A(M){var D=M.alternate;if(!D){if(D=_(M),D===null)throw Error(w(188));return D!==M?null:M}for(var Y=M,se=D;;){var ue=Y.return;if(ue===null)break;var ge=ue.alternate;if(ge===null){if(se=ue.return,se!==null){Y=se;continue}break}if(ue.child===ge.child){for(ge=ue.child;ge;){if(ge===Y)return R(ue),M;if(ge===se)return R(ue),D;ge=ge.sibling}throw Error(w(188))}if(Y.return!==se.return)Y=ue,se=ge;else{for(var we=!1,Me=ue.child;Me;){if(Me===Y){we=!0,Y=ue,se=ge;break}if(Me===se){we=!0,se=ue,Y=ge;break}Me=Me.sibling}if(!we){for(Me=ge.child;Me;){if(Me===Y){we=!0,Y=ge,se=ue;break}if(Me===se){we=!0,se=ge,Y=ue;break}Me=Me.sibling}if(!we)throw Error(w(189))}}if(Y.alternate!==se)throw Error(w(190))}if(Y.tag!==3)throw Error(w(188));return Y.stateNode.current===Y?M:D}function O(M){var D=M.tag;if(D===5||D===26||D===27||D===6)return M;for(M=M.child;M!==null;){if(D=O(M),D!==null)return D;M=M.sibling}return null}var H=Object.assign,ee=Symbol.for("react.element"),te=Symbol.for("react.transitional.element"),ie=Symbol.for("react.portal"),ne=Symbol.for("react.fragment"),ae=Symbol.for("react.strict_mode"),oe=Symbol.for("react.profiler"),le=Symbol.for("react.provider"),fe=Symbol.for("react.consumer"),de=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),pe=Symbol.for("react.suspense"),he=Symbol.for("react.suspense_list"),me=Symbol.for("react.memo"),ve=Symbol.for("react.lazy"),ye=Symbol.for("react.activity"),Se=Symbol.for("react.memo_cache_sentinel"),Ce=Symbol.iterator;function be(M){return M===null||typeof M!="object"?null:(M=Ce&&M[Ce]||M["@@iterator"],typeof M=="function"?M:null)}var Ee=Symbol.for("react.client.reference");function Ae(M){if(M==null)return null;if(typeof M=="function")return M.$$typeof===Ee?null:M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case ne:return"Fragment";case oe:return"Profiler";case ae:return"StrictMode";case pe:return"Suspense";case he:return"SuspenseList";case ye:return"Activity"}if(typeof M=="object")switch(M.$$typeof){case ie:return"Portal";case de:return(M.displayName||"Context")+".Provider";case fe:return(M._context.displayName||"Context")+".Consumer";case ce:var D=M.render;return M=M.displayName,M||(M=D.displayName||D.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case me:return D=M.displayName||null,D!==null?D:Ae(M.type)||"Memo";case ve:D=M._payload,M=M._init;try{return Ae(M(D))}catch{}}return null}var Ie=Array.isArray,Te=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,De=E.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ue={pending:!1,data:null,method:null,action:null},ze=[],Pe=-1;function $e(M){return{current:M}}function He(M){0>Pe||(M.current=ze[Pe],ze[Pe]=null,Pe--)}function je(M,D){Pe++,ze[Pe]=M.current,M.current=D}var Ne=$e(null),Oe=$e(null),Ve=$e(null),Ht=$e(null);function Kt(M,D){switch(je(Ve,D),je(Oe,M),je(Ne,null),D.nodeType){case 9:case 11:M=(M=D.documentElement)&&(M=M.namespaceURI)?kf(M):0;break;default:if(M=D.tagName,D=D.namespaceURI)D=kf(D),M=_f(D,M);else switch(M){case"svg":M=1;break;case"math":M=2;break;default:M=0}}He(Ne),je(Ne,M)}function ir(){He(Ne),He(Oe),He(Ve)}function $t(M){M.memoizedState!==null&&je(Ht,M);var D=Ne.current,Y=_f(D,M.type);D!==Y&&(je(Oe,M),je(Ne,Y))}function tr(M){Oe.current===M&&(He(Ne),He(Oe)),Ht.current===M&&(He(Ht),Wa._currentValue=Ue)}var ar=Object.prototype.hasOwnProperty,gr=x.unstable_scheduleCallback,er=x.unstable_cancelCallback,sr=x.unstable_shouldYield,pr=x.unstable_requestPaint,ur=x.unstable_now,Sr=x.unstable_getCurrentPriorityLevel,hr=x.unstable_ImmediatePriority,yr=x.unstable_UserBlockingPriority,xr=x.unstable_NormalPriority,Yt=x.unstable_LowPriority,Jt=x.unstable_IdlePriority,mr=x.log,Cr=x.unstable_setDisableYieldValue,zt=null,Ft=null;function kt(M){if(typeof mr=="function"&&Cr(M),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(zt,M)}catch{}}var ke=Math.clz32?Math.clz32:Ze,Be=Math.log,et=Math.LN2;function Ze(M){return M>>>=0,M===0?32:31-(Be(M)/et|0)|0}var Qe=256,Ke=4194304;function Je(M){var D=M&42;if(D!==0)return D;switch(M&-M){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return M&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return M&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return M}}function Re(M,D,Y){var se=M.pendingLanes;if(se===0)return 0;var ue=0,ge=M.suspendedLanes,we=M.pingedLanes;M=M.warmLanes;var Me=se&134217727;return Me!==0?(se=Me&~ge,se!==0?ue=Je(se):(we&=Me,we!==0?ue=Je(we):Y||(Y=Me&~M,Y!==0&&(ue=Je(Y))))):(Me=se&~ge,Me!==0?ue=Je(Me):we!==0?ue=Je(we):Y||(Y=se&~M,Y!==0&&(ue=Je(Y)))),ue===0?0:D!==0&&D!==ue&&(D&ge)===0&&(ge=ue&-ue,Y=D&-D,ge>=Y||ge===32&&(Y&4194048)!==0)?D:ue}function Bt(M,D){return(M.pendingLanes&~(M.suspendedLanes&~M.pingedLanes)&D)===0}function Fe(M,D){switch(M){case 1:case 2:case 4:case 8:case 64:return D+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return D+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var M=Qe;return Qe<<=1,(Qe&4194048)===0&&(Qe=256),M}function nr(){var M=Ke;return Ke<<=1,(Ke&62914560)===0&&(Ke=4194304),M}function jt(M){for(var D=[],Y=0;31>Y;Y++)D.push(M);return D}function vr(M,D){M.pendingLanes|=D,D!==268435456&&(M.suspendedLanes=0,M.pingedLanes=0,M.warmLanes=0)}function it(M,D,Y,se,ue,ge){var we=M.pendingLanes;M.pendingLanes=Y,M.suspendedLanes=0,M.pingedLanes=0,M.warmLanes=0,M.expiredLanes&=Y,M.entangledLanes&=Y,M.errorRecoveryDisabledLanes&=Y,M.shellSuspendCounter=0;var Me=M.entanglements,qe=M.expirationTimes,St=M.hiddenUpdates;for(Y=we&~Y;0<Y;){var Zt=31-ke(Y),or=1<<Zt;Me[Zt]=0,qe[Zt]=-1;var Rt=St[Zt];if(Rt!==null)for(St[Zt]=null,Zt=0;Zt<Rt.length;Zt++){var Tt=Rt[Zt];Tt!==null&&(Tt.lane&=-536870913)}Y&=~or}se!==0&&dt(M,se,0),ge!==0&&ue===0&&M.tag!==0&&(M.suspendedLanes|=ge&~(we&~D))}function dt(M,D,Y){M.pendingLanes|=D,M.suspendedLanes&=~D;var se=31-ke(D);M.entangledLanes|=D,M.entanglements[se]=M.entanglements[se]|1073741824|Y&4194090}function xe(M,D){var Y=M.entangledLanes|=D;for(M=M.entanglements;Y;){var se=31-ke(Y),ue=1<<se;ue&D|M[se]&D&&(M[se]|=D),Y&=~ue}}function Xe(M){switch(M){case 2:M=1;break;case 8:M=4;break;case 32:M=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:M=128;break;case 268435456:M=134217728;break;default:M=0}return M}function _e(M){return M&=-M,2<M?8<M?(M&134217727)!==0?32:268435456:8:2}function ct(){var M=De.p;return M!==0?M:(M=window.event,M===void 0?32:Gf(M.type))}function Dt(M,D){var Y=De.p;try{return De.p=M,D()}finally{De.p=Y}}var cr=Math.random().toString(36).slice(2),fr="__reactFiber$"+cr,dr="__reactProps$"+cr,jr="__reactContainer$"+cr,Rr="__reactEvents$"+cr,ki="__reactListeners$"+cr,_i="__reactHandles$"+cr,Fr="__reactResources$"+cr,Kr="__reactMarker$"+cr;function Ur(M){delete M[fr],delete M[dr],delete M[Rr],delete M[ki],delete M[_i]}function ai(M){var D=M[fr];if(D)return D;for(var Y=M.parentNode;Y;){if(D=Y[jr]||Y[fr]){if(Y=D.alternate,D.child!==null||Y!==null&&Y.child!==null)for(M=If(M);M!==null;){if(Y=M[fr])return Y;M=If(M)}return D}M=Y,Y=M.parentNode}return null}function ii(M){if(M=M[fr]||M[jr]){var D=M.tag;if(D===5||D===6||D===13||D===26||D===27||D===3)return M}return null}function Fi(M){var D=M.tag;if(D===5||D===26||D===27||D===6)return M.stateNode;throw Error(w(33))}function Ai(M){var D=M[Fr];return D||(D=M[Fr]={hoistableStyles:new Map,hoistableScripts:new Map}),D}function Zr(M){M[Kr]=!0}var yo=new Set,xo={};function Ji(M,D){Yi(M,D),Yi(M+"Capture",D)}function Yi(M,D){for(xo[M]=D,M=0;M<D.length;M++)yo.add(D[M])}var rs=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),So={},is={};function Zs(M){return ar.call(is,M)?!0:ar.call(So,M)?!1:rs.test(M)?is[M]=!0:(So[M]=!0,!1)}function Bn(M,D,Y){if(Zs(D))if(Y===null)M.removeAttribute(D);else{switch(typeof Y){case"undefined":case"function":case"symbol":M.removeAttribute(D);return;case"boolean":var se=D.toLowerCase().slice(0,5);if(se!=="data-"&&se!=="aria-"){M.removeAttribute(D);return}}M.setAttribute(D,""+Y)}}function jn(M,D,Y){if(Y===null)M.removeAttribute(D);else{switch(typeof Y){case"undefined":case"function":case"symbol":case"boolean":M.removeAttribute(D);return}M.setAttribute(D,""+Y)}}function Ei(M,D,Y,se){if(se===null)M.removeAttribute(Y);else{switch(typeof se){case"undefined":case"function":case"symbol":case"boolean":M.removeAttribute(Y);return}M.setAttributeNS(D,Y,""+se)}}var Co,ns;function rn(M){if(Co===void 0)try{throw Error()}catch(Y){var D=Y.stack.trim().match(/\n( *(at )?)/);Co=D&&D[1]||"",ns=-1<Y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<Y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Co+M+ns}var Eo=!1;function wo(M,D){if(!M||Eo)return"";Eo=!0;var Y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var se={DetermineComponentFrameRoot:function(){try{if(D){var or=function(){throw Error()};if(Object.defineProperty(or.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(or,[])}catch(Tt){var Rt=Tt}Reflect.construct(M,[],or)}else{try{or.call()}catch(Tt){Rt=Tt}M.call(or.prototype)}}else{try{throw Error()}catch(Tt){Rt=Tt}(or=M())&&typeof or.catch=="function"&&or.catch(function(){})}}catch(Tt){if(Tt&&Rt&&typeof Tt.stack=="string")return[Tt.stack,Rt.stack]}return[null,null]}};se.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var ue=Object.getOwnPropertyDescriptor(se.DetermineComponentFrameRoot,"name");ue&&ue.configurable&&Object.defineProperty(se.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ge=se.DetermineComponentFrameRoot(),we=ge[0],Me=ge[1];if(we&&Me){var qe=we.split(`
`),St=Me.split(`
`);for(ue=se=0;se<qe.length&&!qe[se].includes("DetermineComponentFrameRoot");)se++;for(;ue<St.length&&!St[ue].includes("DetermineComponentFrameRoot");)ue++;if(se===qe.length||ue===St.length)for(se=qe.length-1,ue=St.length-1;1<=se&&0<=ue&&qe[se]!==St[ue];)ue--;for(;1<=se&&0<=ue;se--,ue--)if(qe[se]!==St[ue]){if(se!==1||ue!==1)do if(se--,ue--,0>ue||qe[se]!==St[ue]){var Zt=`
`+qe[se].replace(" at new "," at ");return M.displayName&&Zt.includes("<anonymous>")&&(Zt=Zt.replace("<anonymous>",M.displayName)),Zt}while(1<=se&&0<=ue);break}}}finally{Eo=!1,Error.prepareStackTrace=Y}return(Y=M?M.displayName||M.name:"")?rn(Y):""}function Qs(M){switch(M.tag){case 26:case 27:case 5:return rn(M.type);case 16:return rn("Lazy");case 13:return rn("Suspense");case 19:return rn("SuspenseList");case 0:case 15:return wo(M.type,!1);case 11:return wo(M.type.render,!1);case 1:return wo(M.type,!0);case 31:return rn("Activity");default:return""}}function os(M){try{var D="";do D+=Qs(M),M=M.return;while(M);return D}catch(Y){return`
Error generating stack: `+Y.message+`
`+Y.stack}}function yi(M){switch(typeof M){case"bigint":case"boolean":case"number":case"string":case"undefined":return M;case"object":return M;default:return""}}function ss(M){var D=M.type;return(M=M.nodeName)&&M.toLowerCase()==="input"&&(D==="checkbox"||D==="radio")}function ea(M){var D=ss(M)?"checked":"value",Y=Object.getOwnPropertyDescriptor(M.constructor.prototype,D),se=""+M[D];if(!M.hasOwnProperty(D)&&typeof Y<"u"&&typeof Y.get=="function"&&typeof Y.set=="function"){var ue=Y.get,ge=Y.set;return Object.defineProperty(M,D,{configurable:!0,get:function(){return ue.call(this)},set:function(we){se=""+we,ge.call(this,we)}}),Object.defineProperty(M,D,{enumerable:Y.enumerable}),{getValue:function(){return se},setValue:function(we){se=""+we},stopTracking:function(){M._valueTracker=null,delete M[D]}}}}function Ln(M){M._valueTracker||(M._valueTracker=ea(M))}function as(M){if(!M)return!1;var D=M._valueTracker;if(!D)return!0;var Y=D.getValue(),se="";return M&&(se=ss(M)?M.checked?"true":"false":M.value),M=se,M!==Y?(D.setValue(M),!0):!1}function Fn(M){if(M=M||(typeof document<"u"?document:void 0),typeof M>"u")return null;try{return M.activeElement||M.body}catch{return M.body}}var ta=/[\n"\\]/g;function xi(M){return M.replace(ta,function(D){return"\\"+D.charCodeAt(0).toString(16)+" "})}function Ro(M,D,Y,se,ue,ge,we,Me){M.name="",we!=null&&typeof we!="function"&&typeof we!="symbol"&&typeof we!="boolean"?M.type=we:M.removeAttribute("type"),D!=null?we==="number"?(D===0&&M.value===""||M.value!=D)&&(M.value=""+yi(D)):M.value!==""+yi(D)&&(M.value=""+yi(D)):we!=="submit"&&we!=="reset"||M.removeAttribute("value"),D!=null?To(M,we,yi(D)):Y!=null?To(M,we,yi(Y)):se!=null&&M.removeAttribute("value"),ue==null&&ge!=null&&(M.defaultChecked=!!ge),ue!=null&&(M.checked=ue&&typeof ue!="function"&&typeof ue!="symbol"),Me!=null&&typeof Me!="function"&&typeof Me!="symbol"&&typeof Me!="boolean"?M.name=""+yi(Me):M.removeAttribute("name")}function ls(M,D,Y,se,ue,ge,we,Me){if(ge!=null&&typeof ge!="function"&&typeof ge!="symbol"&&typeof ge!="boolean"&&(M.type=ge),D!=null||Y!=null){if(!(ge!=="submit"&&ge!=="reset"||D!=null))return;Y=Y!=null?""+yi(Y):"",D=D!=null?""+yi(D):Y,Me||D===M.value||(M.value=D),M.defaultValue=D}se=se??ue,se=typeof se!="function"&&typeof se!="symbol"&&!!se,M.checked=Me?M.checked:!!se,M.defaultChecked=!!se,we!=null&&typeof we!="function"&&typeof we!="symbol"&&typeof we!="boolean"&&(M.name=we)}function To(M,D,Y){D==="number"&&Fn(M.ownerDocument)===M||M.defaultValue===""+Y||(M.defaultValue=""+Y)}function nn(M,D,Y,se){if(M=M.options,D){D={};for(var ue=0;ue<Y.length;ue++)D["$"+Y[ue]]=!0;for(Y=0;Y<M.length;Y++)ue=D.hasOwnProperty("$"+M[Y].value),M[Y].selected!==ue&&(M[Y].selected=ue),ue&&se&&(M[Y].defaultSelected=!0)}else{for(Y=""+yi(Y),D=null,ue=0;ue<M.length;ue++){if(M[ue].value===Y){M[ue].selected=!0,se&&(M[ue].defaultSelected=!0);return}D!==null||M[ue].disabled||(D=M[ue])}D!==null&&(D.selected=!0)}}function cs(M,D,Y){if(D!=null&&(D=""+yi(D),D!==M.value&&(M.value=D),Y==null)){M.defaultValue!==D&&(M.defaultValue=D);return}M.defaultValue=Y!=null?""+yi(Y):""}function us(M,D,Y,se){if(D==null){if(se!=null){if(Y!=null)throw Error(w(92));if(Ie(se)){if(1<se.length)throw Error(w(93));se=se[0]}Y=se}Y==null&&(Y=""),D=Y}Y=yi(D),M.defaultValue=Y,se=M.textContent,se===Y&&se!==""&&se!==null&&(M.value=se)}function sn(M,D){if(D){var Y=M.firstChild;if(Y&&Y===M.lastChild&&Y.nodeType===3){Y.nodeValue=D;return}}M.textContent=D}var ra=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ds(M,D,Y){var se=D.indexOf("--")===0;Y==null||typeof Y=="boolean"||Y===""?se?M.setProperty(D,""):D==="float"?M.cssFloat="":M[D]="":se?M.setProperty(D,Y):typeof Y!="number"||Y===0||ra.has(D)?D==="float"?M.cssFloat=Y:M[D]=(""+Y).trim():M[D]=Y+"px"}function ps(M,D,Y){if(D!=null&&typeof D!="object")throw Error(w(62));if(M=M.style,Y!=null){for(var se in Y)!Y.hasOwnProperty(se)||D!=null&&D.hasOwnProperty(se)||(se.indexOf("--")===0?M.setProperty(se,""):se==="float"?M.cssFloat="":M[se]="");for(var ue in D)se=D[ue],D.hasOwnProperty(ue)&&Y[ue]!==se&&ds(M,ue,se)}else for(var ge in D)D.hasOwnProperty(ge)&&ds(M,ge,D[ge])}function ko(M){if(M.indexOf("-")===-1)return!1;switch(M){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ia=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),na=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Vn(M){return na.test(""+M)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":M}var Ao=null;function Po(M){return M=M.target||M.srcElement||window,M.correspondingUseElement&&(M=M.correspondingUseElement),M.nodeType===3?M.parentNode:M}var an=null,ln=null;function hs(M){var D=ii(M);if(D&&(M=D.stateNode)){var Y=M[dr]||null;e:switch(M=D.stateNode,D.type){case"input":if(Ro(M,Y.value,Y.defaultValue,Y.defaultValue,Y.checked,Y.defaultChecked,Y.type,Y.name),D=Y.name,Y.type==="radio"&&D!=null){for(Y=M;Y.parentNode;)Y=Y.parentNode;for(Y=Y.querySelectorAll('input[name="'+xi(""+D)+'"][type="radio"]'),D=0;D<Y.length;D++){var se=Y[D];if(se!==M&&se.form===M.form){var ue=se[dr]||null;if(!ue)throw Error(w(90));Ro(se,ue.value,ue.defaultValue,ue.defaultValue,ue.checked,ue.defaultChecked,ue.type,ue.name)}}for(D=0;D<Y.length;D++)se=Y[D],se.form===M.form&&as(se)}break e;case"textarea":cs(M,Y.value,Y.defaultValue);break e;case"select":D=Y.value,D!=null&&nn(M,!!Y.multiple,D,!1)}}}var Mo=!1;function fs(M,D,Y){if(Mo)return M(D,Y);Mo=!0;try{var se=M(D);return se}finally{if(Mo=!1,(an!==null||ln!==null)&&(Wl(),an&&(D=an,M=ln,ln=an=null,hs(D),M)))for(D=0;D<M.length;D++)hs(M[D])}}function bn(M,D){var Y=M.stateNode;if(Y===null)return null;var se=Y[dr]||null;if(se===null)return null;Y=se[D];e:switch(D){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(se=!se.disabled)||(M=M.type,se=!(M==="button"||M==="input"||M==="select"||M==="textarea")),M=!se;break e;default:M=!1}if(M)return null;if(Y&&typeof Y!="function")throw Error(w(231,D,typeof Y));return Y}var Pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Io=!1;if(Pi)try{var cn={};Object.defineProperty(cn,"passive",{get:function(){Io=!0}}),window.addEventListener("test",cn,cn),window.removeEventListener("test",cn,cn)}catch{Io=!1}var Vi=null,ut=null,Le=null;function We(){if(Le)return Le;var M,D=ut,Y=D.length,se,ue="value"in Vi?Vi.value:Vi.textContent,ge=ue.length;for(M=0;M<Y&&D[M]===ue[M];M++);var we=Y-M;for(se=1;se<=we&&D[Y-se]===ue[ge-se];se++);return Le=ue.slice(M,1<se?1-se:void 0)}function Ut(M){var D=M.keyCode;return"charCode"in M?(M=M.charCode,M===0&&D===13&&(M=13)):M=D,M===10&&(M=13),32<=M||M===13?M:0}function lr(){return!0}function Ar(){return!1}function Ir(M){function D(Y,se,ue,ge,we){this._reactName=Y,this._targetInst=ue,this.type=se,this.nativeEvent=ge,this.target=we,this.currentTarget=null;for(var Me in M)M.hasOwnProperty(Me)&&(Y=M[Me],this[Me]=Y?Y(ge):ge[Me]);return this.isDefaultPrevented=(ge.defaultPrevented!=null?ge.defaultPrevented:ge.returnValue===!1)?lr:Ar,this.isPropagationStopped=Ar,this}return H(D.prototype,{preventDefault:function(){this.defaultPrevented=!0;var Y=this.nativeEvent;Y&&(Y.preventDefault?Y.preventDefault():typeof Y.returnValue!="unknown"&&(Y.returnValue=!1),this.isDefaultPrevented=lr)},stopPropagation:function(){var Y=this.nativeEvent;Y&&(Y.stopPropagation?Y.stopPropagation():typeof Y.cancelBubble!="unknown"&&(Y.cancelBubble=!0),this.isPropagationStopped=lr)},persist:function(){},isPersistent:lr}),D}var Yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(M){return M.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xi=Ir(Yr),yn=H({},Yr,{view:0,detail:0}),oa=Ir(yn),Nn,Un,un,xn=H({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:aa,button:0,buttons:0,relatedTarget:function(M){return M.relatedTarget===void 0?M.fromElement===M.srcElement?M.toElement:M.fromElement:M.relatedTarget},movementX:function(M){return"movementX"in M?M.movementX:(M!==un&&(un&&M.type==="mousemove"?(Nn=M.screenX-un.screenX,Un=M.screenY-un.screenY):Un=Nn=0,un=M),Nn)},movementY:function(M){return"movementY"in M?M.movementY:Un}}),el=Ir(xn),xc=H({},xn,{dataTransfer:0}),Sc=Ir(xc),Cc=H({},yn,{relatedTarget:0}),sa=Ir(Cc),Ec=H({},Yr,{animationName:0,elapsedTime:0,pseudoElement:0}),wc=Ir(Ec),Rc=H({},Yr,{clipboardData:function(M){return"clipboardData"in M?M.clipboardData:window.clipboardData}}),Tc=Ir(Rc),kc=H({},Yr,{data:0}),tl=Ir(kc),_c={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ac={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Pc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mc(M){var D=this.nativeEvent;return D.getModifierState?D.getModifierState(M):(M=Pc[M])?!!D[M]:!1}function aa(){return Mc}var Ic=H({},yn,{key:function(M){if(M.key){var D=_c[M.key]||M.key;if(D!=="Unidentified")return D}return M.type==="keypress"?(M=Ut(M),M===13?"Enter":String.fromCharCode(M)):M.type==="keydown"||M.type==="keyup"?Ac[M.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:aa,charCode:function(M){return M.type==="keypress"?Ut(M):0},keyCode:function(M){return M.type==="keydown"||M.type==="keyup"?M.keyCode:0},which:function(M){return M.type==="keypress"?Ut(M):M.type==="keydown"||M.type==="keyup"?M.keyCode:0}}),Oc=Ir(Ic),Dc=H({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rl=Ir(Dc),Bc=H({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:aa}),jc=Ir(Bc),Lc=H({},Yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fc=Ir(Lc),Vc=H({},xn,{deltaX:function(M){return"deltaX"in M?M.deltaX:"wheelDeltaX"in M?-M.wheelDeltaX:0},deltaY:function(M){return"deltaY"in M?M.deltaY:"wheelDeltaY"in M?-M.wheelDeltaY:"wheelDelta"in M?-M.wheelDelta:0},deltaZ:0,deltaMode:0}),Nc=Ir(Vc),Uc=H({},Yr,{newState:0,oldState:0}),qc=Ir(Uc),$c=[9,13,27,32],la=Pi&&"CompositionEvent"in window,Oo=null;Pi&&"documentMode"in document&&(Oo=document.documentMode);var zc=Pi&&"TextEvent"in window&&!Oo,il=Pi&&(!la||Oo&&8<Oo&&11>=Oo),nl=" ",ol=!1;function sl(M,D){switch(M){case"keyup":return $c.indexOf(D.keyCode)!==-1;case"keydown":return D.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function al(M){return M=M.detail,typeof M=="object"&&"data"in M?M.data:null}var qn=!1;function Hc(M,D){switch(M){case"compositionend":return al(D);case"keypress":return D.which!==32?null:(ol=!0,nl);case"textInput":return M=D.data,M===nl&&ol?null:M;default:return null}}function Wc(M,D){if(qn)return M==="compositionend"||!la&&sl(M,D)?(M=We(),Le=ut=Vi=null,qn=!1,M):null;switch(M){case"paste":return null;case"keypress":if(!(D.ctrlKey||D.altKey||D.metaKey)||D.ctrlKey&&D.altKey){if(D.char&&1<D.char.length)return D.char;if(D.which)return String.fromCharCode(D.which)}return null;case"compositionend":return il&&D.locale!=="ko"?null:D.data;default:return null}}var Gc={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ll(M){var D=M&&M.nodeName&&M.nodeName.toLowerCase();return D==="input"?!!Gc[M.type]:D==="textarea"}function cl(M,D,Y,se){an?ln?ln.push(se):ln=[se]:an=se,D=Zl(D,"onChange"),0<D.length&&(Y=new Xi("onChange","change",null,Y,se),M.push({event:Y,listeners:D}))}var Do=null,Bo=null;function Kc(M){Cf(M,0)}function ms(M){var D=Fi(M);if(as(D))return M}function ul(M,D){if(M==="change")return D}var dl=!1;if(Pi){var ca;if(Pi){var ua="oninput"in document;if(!ua){var gs=document.createElement("div");gs.setAttribute("oninput","return;"),ua=typeof gs.oninput=="function"}ca=ua}else ca=!1;dl=ca&&(!document.documentMode||9<document.documentMode)}function pl(){Do&&(Do.detachEvent("onpropertychange",hl),Bo=Do=null)}function hl(M){if(M.propertyName==="value"&&ms(Bo)){var D=[];cl(D,Bo,M,Po(M)),fs(Kc,D)}}function Jc(M,D,Y){M==="focusin"?(pl(),Do=D,Bo=Y,Do.attachEvent("onpropertychange",hl)):M==="focusout"&&pl()}function vs(M){if(M==="selectionchange"||M==="keyup"||M==="keydown")return ms(Bo)}function gm(M,D){if(M==="click")return ms(D)}function vm(M,D){if(M==="input"||M==="change")return ms(D)}function bm(M,D){return M===D&&(M!==0||1/M===1/D)||M!==M&&D!==D}var Mi=typeof Object.is=="function"?Object.is:bm;function da(M,D){if(Mi(M,D))return!0;if(typeof M!="object"||M===null||typeof D!="object"||D===null)return!1;var Y=Object.keys(M),se=Object.keys(D);if(Y.length!==se.length)return!1;for(se=0;se<Y.length;se++){var ue=Y[se];if(!ar.call(D,ue)||!Mi(M[ue],D[ue]))return!1}return!0}function Wd(M){for(;M&&M.firstChild;)M=M.firstChild;return M}function Gd(M,D){var Y=Wd(M);M=0;for(var se;Y;){if(Y.nodeType===3){if(se=M+Y.textContent.length,M<=D&&se>=D)return{node:Y,offset:D-M};M=se}e:{for(;Y;){if(Y.nextSibling){Y=Y.nextSibling;break e}Y=Y.parentNode}Y=void 0}Y=Wd(Y)}}function Kd(M,D){return M&&D?M===D?!0:M&&M.nodeType===3?!1:D&&D.nodeType===3?Kd(M,D.parentNode):"contains"in M?M.contains(D):M.compareDocumentPosition?!!(M.compareDocumentPosition(D)&16):!1:!1}function Jd(M){M=M!=null&&M.ownerDocument!=null&&M.ownerDocument.defaultView!=null?M.ownerDocument.defaultView:window;for(var D=Fn(M.document);D instanceof M.HTMLIFrameElement;){try{var Y=typeof D.contentWindow.location.href=="string"}catch{Y=!1}if(Y)M=D.contentWindow;else break;D=Fn(M.document)}return D}function Yc(M){var D=M&&M.nodeName&&M.nodeName.toLowerCase();return D&&(D==="input"&&(M.type==="text"||M.type==="search"||M.type==="tel"||M.type==="url"||M.type==="password")||D==="textarea"||M.contentEditable==="true")}var ym=Pi&&"documentMode"in document&&11>=document.documentMode,bs=null,Xc=null,pa=null,Zc=!1;function Yd(M,D,Y){var se=Y.window===Y?Y.document:Y.nodeType===9?Y:Y.ownerDocument;Zc||bs==null||bs!==Fn(se)||(se=bs,"selectionStart"in se&&Yc(se)?se={start:se.selectionStart,end:se.selectionEnd}:(se=(se.ownerDocument&&se.ownerDocument.defaultView||window).getSelection(),se={anchorNode:se.anchorNode,anchorOffset:se.anchorOffset,focusNode:se.focusNode,focusOffset:se.focusOffset}),pa&&da(pa,se)||(pa=se,se=Zl(Xc,"onSelect"),0<se.length&&(D=new Xi("onSelect","select",null,D,Y),M.push({event:D,listeners:se}),D.target=bs)))}function jo(M,D){var Y={};return Y[M.toLowerCase()]=D.toLowerCase(),Y["Webkit"+M]="webkit"+D,Y["Moz"+M]="moz"+D,Y}var ys={animationend:jo("Animation","AnimationEnd"),animationiteration:jo("Animation","AnimationIteration"),animationstart:jo("Animation","AnimationStart"),transitionrun:jo("Transition","TransitionRun"),transitionstart:jo("Transition","TransitionStart"),transitioncancel:jo("Transition","TransitionCancel"),transitionend:jo("Transition","TransitionEnd")},Qc={},Xd={};Pi&&(Xd=document.createElement("div").style,"AnimationEvent"in window||(delete ys.animationend.animation,delete ys.animationiteration.animation,delete ys.animationstart.animation),"TransitionEvent"in window||delete ys.transitionend.transition);function Lo(M){if(Qc[M])return Qc[M];if(!ys[M])return M;var D=ys[M],Y;for(Y in D)if(D.hasOwnProperty(Y)&&Y in Xd)return Qc[M]=D[Y];return M}var Zd=Lo("animationend"),Qd=Lo("animationiteration"),ep=Lo("animationstart"),xm=Lo("transitionrun"),Sm=Lo("transitionstart"),Cm=Lo("transitioncancel"),tp=Lo("transitionend"),rp=new Map,eu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");eu.push("scrollEnd");function Zi(M,D){rp.set(M,D),Ji(D,[M])}var ip=new WeakMap;function Ni(M,D){if(typeof M=="object"&&M!==null){var Y=ip.get(M);return Y!==void 0?Y:(D={value:M,source:D,stack:os(D)},ip.set(M,D),D)}return{value:M,source:D,stack:os(D)}}var Ui=[],xs=0,tu=0;function fl(){for(var M=xs,D=tu=xs=0;D<M;){var Y=Ui[D];Ui[D++]=null;var se=Ui[D];Ui[D++]=null;var ue=Ui[D];Ui[D++]=null;var ge=Ui[D];if(Ui[D++]=null,se!==null&&ue!==null){var we=se.pending;we===null?ue.next=ue:(ue.next=we.next,we.next=ue),se.pending=ue}ge!==0&&np(Y,ue,ge)}}function ml(M,D,Y,se){Ui[xs++]=M,Ui[xs++]=D,Ui[xs++]=Y,Ui[xs++]=se,tu|=se,M.lanes|=se,M=M.alternate,M!==null&&(M.lanes|=se)}function ru(M,D,Y,se){return ml(M,D,Y,se),gl(M)}function Ss(M,D){return ml(M,null,null,D),gl(M)}function np(M,D,Y){M.lanes|=Y;var se=M.alternate;se!==null&&(se.lanes|=Y);for(var ue=!1,ge=M.return;ge!==null;)ge.childLanes|=Y,se=ge.alternate,se!==null&&(se.childLanes|=Y),ge.tag===22&&(M=ge.stateNode,M===null||M._visibility&1||(ue=!0)),M=ge,ge=ge.return;return M.tag===3?(ge=M.stateNode,ue&&D!==null&&(ue=31-ke(Y),M=ge.hiddenUpdates,se=M[ue],se===null?M[ue]=[D]:se.push(D),D.lane=Y|536870912),ge):null}function gl(M){if(50<Fa)throw Fa=0,ld=null,Error(w(185));for(var D=M.return;D!==null;)M=D,D=M.return;return M.tag===3?M.stateNode:null}var Cs={};function Em(M,D,Y,se){this.tag=M,this.key=Y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=D,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=se,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ii(M,D,Y,se){return new Em(M,D,Y,se)}function iu(M){return M=M.prototype,!(!M||!M.isReactComponent)}function Sn(M,D){var Y=M.alternate;return Y===null?(Y=Ii(M.tag,D,M.key,M.mode),Y.elementType=M.elementType,Y.type=M.type,Y.stateNode=M.stateNode,Y.alternate=M,M.alternate=Y):(Y.pendingProps=D,Y.type=M.type,Y.flags=0,Y.subtreeFlags=0,Y.deletions=null),Y.flags=M.flags&65011712,Y.childLanes=M.childLanes,Y.lanes=M.lanes,Y.child=M.child,Y.memoizedProps=M.memoizedProps,Y.memoizedState=M.memoizedState,Y.updateQueue=M.updateQueue,D=M.dependencies,Y.dependencies=D===null?null:{lanes:D.lanes,firstContext:D.firstContext},Y.sibling=M.sibling,Y.index=M.index,Y.ref=M.ref,Y.refCleanup=M.refCleanup,Y}function op(M,D){M.flags&=65011714;var Y=M.alternate;return Y===null?(M.childLanes=0,M.lanes=D,M.child=null,M.subtreeFlags=0,M.memoizedProps=null,M.memoizedState=null,M.updateQueue=null,M.dependencies=null,M.stateNode=null):(M.childLanes=Y.childLanes,M.lanes=Y.lanes,M.child=Y.child,M.subtreeFlags=0,M.deletions=null,M.memoizedProps=Y.memoizedProps,M.memoizedState=Y.memoizedState,M.updateQueue=Y.updateQueue,M.type=Y.type,D=Y.dependencies,M.dependencies=D===null?null:{lanes:D.lanes,firstContext:D.firstContext}),M}function vl(M,D,Y,se,ue,ge){var we=0;if(se=M,typeof M=="function")iu(M)&&(we=1);else if(typeof M=="string")we=Rg(M,Y,Ne.current)?26:M==="html"||M==="head"||M==="body"?27:5;else e:switch(M){case ye:return M=Ii(31,Y,D,ue),M.elementType=ye,M.lanes=ge,M;case ne:return Fo(Y.children,ue,ge,D);case ae:we=8,ue|=24;break;case oe:return M=Ii(12,Y,D,ue|2),M.elementType=oe,M.lanes=ge,M;case pe:return M=Ii(13,Y,D,ue),M.elementType=pe,M.lanes=ge,M;case he:return M=Ii(19,Y,D,ue),M.elementType=he,M.lanes=ge,M;default:if(typeof M=="object"&&M!==null)switch(M.$$typeof){case le:case de:we=10;break e;case fe:we=9;break e;case ce:we=11;break e;case me:we=14;break e;case ve:we=16,se=null;break e}we=29,Y=Error(w(130,M===null?"null":typeof M,"")),se=null}return D=Ii(we,Y,D,ue),D.elementType=M,D.type=se,D.lanes=ge,D}function Fo(M,D,Y,se){return M=Ii(7,M,se,D),M.lanes=Y,M}function nu(M,D,Y){return M=Ii(6,M,null,D),M.lanes=Y,M}function ou(M,D,Y){return D=Ii(4,M.children!==null?M.children:[],M.key,D),D.lanes=Y,D.stateNode={containerInfo:M.containerInfo,pendingChildren:null,implementation:M.implementation},D}var Es=[],ws=0,bl=null,yl=0,qi=[],$i=0,Vo=null,Cn=1,En="";function No(M,D){Es[ws++]=yl,Es[ws++]=bl,bl=M,yl=D}function sp(M,D,Y){qi[$i++]=Cn,qi[$i++]=En,qi[$i++]=Vo,Vo=M;var se=Cn;M=En;var ue=32-ke(se)-1;se&=~(1<<ue),Y+=1;var ge=32-ke(D)+ue;if(30<ge){var we=ue-ue%5;ge=(se&(1<<we)-1).toString(32),se>>=we,ue-=we,Cn=1<<32-ke(D)+ue|Y<<ue|se,En=ge+M}else Cn=1<<ge|Y<<ue|se,En=M}function su(M){M.return!==null&&(No(M,1),sp(M,1,0))}function au(M){for(;M===bl;)bl=Es[--ws],Es[ws]=null,yl=Es[--ws],Es[ws]=null;for(;M===Vo;)Vo=qi[--$i],qi[$i]=null,En=qi[--$i],qi[$i]=null,Cn=qi[--$i],qi[$i]=null}var Ci=null,ti=null,Nr=!1,Uo=null,dn=!1,lu=Error(w(519));function qo(M){var D=Error(w(418,""));throw ma(Ni(D,M)),lu}function ap(M){var D=M.stateNode,Y=M.type,se=M.memoizedProps;switch(D[fr]=M,D[dr]=se,Y){case"dialog":Dr("cancel",D),Dr("close",D);break;case"iframe":case"object":case"embed":Dr("load",D);break;case"video":case"audio":for(Y=0;Y<Na.length;Y++)Dr(Na[Y],D);break;case"source":Dr("error",D);break;case"img":case"image":case"link":Dr("error",D),Dr("load",D);break;case"details":Dr("toggle",D);break;case"input":Dr("invalid",D),ls(D,se.value,se.defaultValue,se.checked,se.defaultChecked,se.type,se.name,!0),Ln(D);break;case"select":Dr("invalid",D);break;case"textarea":Dr("invalid",D),us(D,se.value,se.defaultValue,se.children),Ln(D)}Y=se.children,typeof Y!="string"&&typeof Y!="number"&&typeof Y!="bigint"||D.textContent===""+Y||se.suppressHydrationWarning===!0||Tf(D.textContent,Y)?(se.popover!=null&&(Dr("beforetoggle",D),Dr("toggle",D)),se.onScroll!=null&&Dr("scroll",D),se.onScrollEnd!=null&&Dr("scrollend",D),se.onClick!=null&&(D.onclick=Ql),D=!0):D=!1,D||qo(M)}function lp(M){for(Ci=M.return;Ci;)switch(Ci.tag){case 5:case 13:dn=!1;return;case 27:case 3:dn=!0;return;default:Ci=Ci.return}}function ha(M){if(M!==Ci)return!1;if(!Nr)return lp(M),Nr=!0,!1;var D=M.tag,Y;if((Y=D!==3&&D!==27)&&((Y=D===5)&&(Y=M.type,Y=!(Y!=="form"&&Y!=="button")||wd(M.type,M.memoizedProps)),Y=!Y),Y&&ti&&qo(M),lp(M),D===13){if(M=M.memoizedState,M=M!==null?M.dehydrated:null,!M)throw Error(w(317));e:{for(M=M.nextSibling,D=0;M;){if(M.nodeType===8)if(Y=M.data,Y==="/$"){if(D===0){ti=en(M.nextSibling);break e}D--}else Y!=="$"&&Y!=="$!"&&Y!=="$?"||D++;M=M.nextSibling}ti=null}}else D===27?(D=ti,uo(M.type)?(M=_d,_d=null,ti=M):ti=D):ti=Ci?en(M.stateNode.nextSibling):null;return!0}function fa(){ti=Ci=null,Nr=!1}function cp(){var M=Uo;return M!==null&&(Ti===null?Ti=M:Ti.push.apply(Ti,M),Uo=null),M}function ma(M){Uo===null?Uo=[M]:Uo.push(M)}var cu=$e(null),$o=null,wn=null;function $n(M,D,Y){je(cu,D._currentValue),D._currentValue=Y}function Rn(M){M._currentValue=cu.current,He(cu)}function uu(M,D,Y){for(;M!==null;){var se=M.alternate;if((M.childLanes&D)!==D?(M.childLanes|=D,se!==null&&(se.childLanes|=D)):se!==null&&(se.childLanes&D)!==D&&(se.childLanes|=D),M===Y)break;M=M.return}}function du(M,D,Y,se){var ue=M.child;for(ue!==null&&(ue.return=M);ue!==null;){var ge=ue.dependencies;if(ge!==null){var we=ue.child;ge=ge.firstContext;e:for(;ge!==null;){var Me=ge;ge=ue;for(var qe=0;qe<D.length;qe++)if(Me.context===D[qe]){ge.lanes|=Y,Me=ge.alternate,Me!==null&&(Me.lanes|=Y),uu(ge.return,Y,M),se||(we=null);break e}ge=Me.next}}else if(ue.tag===18){if(we=ue.return,we===null)throw Error(w(341));we.lanes|=Y,ge=we.alternate,ge!==null&&(ge.lanes|=Y),uu(we,Y,M),we=null}else we=ue.child;if(we!==null)we.return=ue;else for(we=ue;we!==null;){if(we===M){we=null;break}if(ue=we.sibling,ue!==null){ue.return=we.return,we=ue;break}we=we.return}ue=we}}function ga(M,D,Y,se){M=null;for(var ue=D,ge=!1;ue!==null;){if(!ge){if((ue.flags&524288)!==0)ge=!0;else if((ue.flags&262144)!==0)break}if(ue.tag===10){var we=ue.alternate;if(we===null)throw Error(w(387));if(we=we.memoizedProps,we!==null){var Me=ue.type;Mi(ue.pendingProps.value,we.value)||(M!==null?M.push(Me):M=[Me])}}else if(ue===Ht.current){if(we=ue.alternate,we===null)throw Error(w(387));we.memoizedState.memoizedState!==ue.memoizedState.memoizedState&&(M!==null?M.push(Wa):M=[Wa])}ue=ue.return}M!==null&&du(D,M,Y,se),D.flags|=262144}function xl(M){for(M=M.firstContext;M!==null;){if(!Mi(M.context._currentValue,M.memoizedValue))return!0;M=M.next}return!1}function zo(M){$o=M,wn=null,M=M.dependencies,M!==null&&(M.firstContext=null)}function Si(M){return up($o,M)}function Sl(M,D){return $o===null&&zo(M),up(M,D)}function up(M,D){var Y=D._currentValue;if(D={context:D,memoizedValue:Y,next:null},wn===null){if(M===null)throw Error(w(308));wn=D,M.dependencies={lanes:0,firstContext:D},M.flags|=524288}else wn=wn.next=D;return Y}var wm=typeof AbortController<"u"?AbortController:function(){var M=[],D=this.signal={aborted:!1,addEventListener:function(Y,se){M.push(se)}};this.abort=function(){D.aborted=!0,M.forEach(function(Y){return Y()})}},Rm=x.unstable_scheduleCallback,Tm=x.unstable_NormalPriority,di={$$typeof:de,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new wm,data:new Map,refCount:0}}function va(M){M.refCount--,M.refCount===0&&Rm(Tm,function(){M.controller.abort()})}var ba=null,hu=0,Rs=0,Ts=null;function km(M,D){if(ba===null){var Y=ba=[];hu=0,Rs=md(),Ts={status:"pending",value:void 0,then:function(se){Y.push(se)}}}return hu++,D.then(dp,dp),D}function dp(){if(--hu===0&&ba!==null){Ts!==null&&(Ts.status="fulfilled");var M=ba;ba=null,Rs=0,Ts=null;for(var D=0;D<M.length;D++)(0,M[D])()}}function _m(M,D){var Y=[],se={status:"pending",value:null,reason:null,then:function(ue){Y.push(ue)}};return M.then(function(){se.status="fulfilled",se.value=D;for(var ue=0;ue<Y.length;ue++)(0,Y[ue])(D)},function(ue){for(se.status="rejected",se.reason=ue,ue=0;ue<Y.length;ue++)(0,Y[ue])(void 0)}),se}var pp=Te.S;Te.S=function(M,D){typeof D=="object"&&D!==null&&typeof D.then=="function"&&km(M,D),pp!==null&&pp(M,D)};var Ho=$e(null);function fu(){var M=Ho.current;return M!==null?M:Jr.pooledCache}function Cl(M,D){D===null?je(Ho,Ho.current):je(Ho,D.pool)}function hp(){var M=fu();return M===null?null:{parent:di._currentValue,pool:M}}var ya=Error(w(460)),fp=Error(w(474)),El=Error(w(542)),mu={then:function(){}};function mp(M){return M=M.status,M==="fulfilled"||M==="rejected"}function wl(){}function gp(M,D,Y){switch(Y=M[Y],Y===void 0?M.push(D):Y!==D&&(D.then(wl,wl),D=Y),D.status){case"fulfilled":return D.value;case"rejected":throw M=D.reason,bp(M),M;default:if(typeof D.status=="string")D.then(wl,wl);else{if(M=Jr,M!==null&&100<M.shellSuspendCounter)throw Error(w(482));M=D,M.status="pending",M.then(function(se){if(D.status==="pending"){var ue=D;ue.status="fulfilled",ue.value=se}},function(se){if(D.status==="pending"){var ue=D;ue.status="rejected",ue.reason=se}})}switch(D.status){case"fulfilled":return D.value;case"rejected":throw M=D.reason,bp(M),M}throw xa=D,ya}}var xa=null;function vp(){if(xa===null)throw Error(w(459));var M=xa;return xa=null,M}function bp(M){if(M===ya||M===El)throw Error(w(483))}var zn=!1;function gu(M){M.updateQueue={baseState:M.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vu(M,D){M=M.updateQueue,D.updateQueue===M&&(D.updateQueue={baseState:M.baseState,firstBaseUpdate:M.firstBaseUpdate,lastBaseUpdate:M.lastBaseUpdate,shared:M.shared,callbacks:null})}function Hn(M){return{lane:M,tag:0,payload:null,callback:null,next:null}}function Wn(M,D,Y){var se=M.updateQueue;if(se===null)return null;if(se=se.shared,(qr&2)!==0){var ue=se.pending;return ue===null?D.next=D:(D.next=ue.next,ue.next=D),se.pending=D,D=gl(M),np(M,null,Y),D}return ml(M,se,D,Y),gl(M)}function Sa(M,D,Y){if(D=D.updateQueue,D!==null&&(D=D.shared,(Y&4194048)!==0)){var se=D.lanes;se&=M.pendingLanes,Y|=se,D.lanes=Y,xe(M,Y)}}function bu(M,D){var Y=M.updateQueue,se=M.alternate;if(se!==null&&(se=se.updateQueue,Y===se)){var ue=null,ge=null;if(Y=Y.firstBaseUpdate,Y!==null){do{var we={lane:Y.lane,tag:Y.tag,payload:Y.payload,callback:null,next:null};ge===null?ue=ge=we:ge=ge.next=we,Y=Y.next}while(Y!==null);ge===null?ue=ge=D:ge=ge.next=D}else ue=ge=D;Y={baseState:se.baseState,firstBaseUpdate:ue,lastBaseUpdate:ge,shared:se.shared,callbacks:se.callbacks},M.updateQueue=Y;return}M=Y.lastBaseUpdate,M===null?Y.firstBaseUpdate=D:M.next=D,Y.lastBaseUpdate=D}var yu=!1;function Ca(){if(yu){var M=Ts;if(M!==null)throw M}}function Ea(M,D,Y,se){yu=!1;var ue=M.updateQueue;zn=!1;var ge=ue.firstBaseUpdate,we=ue.lastBaseUpdate,Me=ue.shared.pending;if(Me!==null){ue.shared.pending=null;var qe=Me,St=qe.next;qe.next=null,we===null?ge=St:we.next=St,we=qe;var Zt=M.alternate;Zt!==null&&(Zt=Zt.updateQueue,Me=Zt.lastBaseUpdate,Me!==we&&(Me===null?Zt.firstBaseUpdate=St:Me.next=St,Zt.lastBaseUpdate=qe))}if(ge!==null){var or=ue.baseState;we=0,Zt=St=qe=null,Me=ge;do{var Rt=Me.lane&-536870913,Tt=Rt!==Me.lane;if(Tt?(Lr&Rt)===Rt:(se&Rt)===Rt){Rt!==0&&Rt===Rs&&(yu=!0),Zt!==null&&(Zt=Zt.next={lane:0,tag:Me.tag,payload:Me.payload,callback:null,next:null});e:{var _r=M,Tr=Me;Rt=D;var Wr=Y;switch(Tr.tag){case 1:if(_r=Tr.payload,typeof _r=="function"){or=_r.call(Wr,or,Rt);break e}or=_r;break e;case 3:_r.flags=_r.flags&-65537|128;case 0:if(_r=Tr.payload,Rt=typeof _r=="function"?_r.call(Wr,or,Rt):_r,Rt==null)break e;or=H({},or,Rt);break e;case 2:zn=!0}}Rt=Me.callback,Rt!==null&&(M.flags|=64,Tt&&(M.flags|=8192),Tt=ue.callbacks,Tt===null?ue.callbacks=[Rt]:Tt.push(Rt))}else Tt={lane:Rt,tag:Me.tag,payload:Me.payload,callback:Me.callback,next:null},Zt===null?(St=Zt=Tt,qe=or):Zt=Zt.next=Tt,we|=Rt;if(Me=Me.next,Me===null){if(Me=ue.shared.pending,Me===null)break;Tt=Me,Me=Tt.next,Tt.next=null,ue.lastBaseUpdate=Tt,ue.shared.pending=null}}while(!0);Zt===null&&(qe=or),ue.baseState=qe,ue.firstBaseUpdate=St,ue.lastBaseUpdate=Zt,ge===null&&(ue.shared.lanes=0),eo|=we,M.lanes=we,M.memoizedState=or}}function yp(M,D){if(typeof M!="function")throw Error(w(191,M));M.call(D)}function xp(M,D){var Y=M.callbacks;if(Y!==null)for(M.callbacks=null,M=0;M<Y.length;M++)yp(Y[M],D)}var ks=$e(null),Rl=$e(0);function Sp(M,D){M=In,je(Rl,M),je(ks,D),In=M|D.baseLanes}function xu(){je(Rl,In),je(ks,ks.current)}function Su(){In=Rl.current,He(ks),He(Rl)}var Gn=0,Pr=null,zr=null,li=null,Tl=!1,As=!1,Wo=!1,kl=0,wa=0,Ps=null,Am=0;function ni(){throw Error(w(321))}function Cu(M,D){if(D===null)return!1;for(var Y=0;Y<D.length&&Y<M.length;Y++)if(!Mi(M[Y],D[Y]))return!1;return!0}function Eu(M,D,Y,se,ue,ge){return Gn=ge,Pr=D,D.memoizedState=null,D.updateQueue=null,D.lanes=0,Te.H=M===null||M.memoizedState===null?oh:sh,Wo=!1,ge=Y(se,ue),Wo=!1,As&&(ge=Ep(D,Y,se,ue)),Cp(M),ge}function Cp(M){Te.H=Ol;var D=zr!==null&&zr.next!==null;if(Gn=0,li=zr=Pr=null,Tl=!1,wa=0,Ps=null,D)throw Error(w(300));M===null||hi||(M=M.dependencies,M!==null&&xl(M)&&(hi=!0))}function Ep(M,D,Y,se){Pr=M;var ue=0;do{if(As&&(Ps=null),wa=0,As=!1,25<=ue)throw Error(w(301));if(ue+=1,li=zr=null,M.updateQueue!=null){var ge=M.updateQueue;ge.lastEffect=null,ge.events=null,ge.stores=null,ge.memoCache!=null&&(ge.memoCache.index=0)}Te.H=jm,ge=D(Y,se)}while(As);return ge}function Pm(){var M=Te.H,D=M.useState()[0];return D=typeof D.then=="function"?Ra(D):D,M=M.useState()[0],(zr!==null?zr.memoizedState:null)!==M&&(Pr.flags|=1024),D}function wu(){var M=kl!==0;return kl=0,M}function Ru(M,D,Y){D.updateQueue=M.updateQueue,D.flags&=-2053,M.lanes&=~Y}function Tu(M){if(Tl){for(M=M.memoizedState;M!==null;){var D=M.queue;D!==null&&(D.pending=null),M=M.next}Tl=!1}Gn=0,li=zr=Pr=null,As=!1,wa=kl=0,Ps=null}function wi(){var M={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return li===null?Pr.memoizedState=li=M:li=li.next=M,li}function ci(){if(zr===null){var M=Pr.alternate;M=M!==null?M.memoizedState:null}else M=zr.next;var D=li===null?Pr.memoizedState:li.next;if(D!==null)li=D,zr=M;else{if(M===null)throw Pr.alternate===null?Error(w(467)):Error(w(310));zr=M,M={memoizedState:zr.memoizedState,baseState:zr.baseState,baseQueue:zr.baseQueue,queue:zr.queue,next:null},li===null?Pr.memoizedState=li=M:li=li.next=M}return li}function ku(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ra(M){var D=wa;return wa+=1,Ps===null&&(Ps=[]),M=gp(Ps,M,D),D=Pr,(li===null?D.memoizedState:li.next)===null&&(D=D.alternate,Te.H=D===null||D.memoizedState===null?oh:sh),M}function _l(M){if(M!==null&&typeof M=="object"){if(typeof M.then=="function")return Ra(M);if(M.$$typeof===de)return Si(M)}throw Error(w(438,String(M)))}function _u(M){var D=null,Y=Pr.updateQueue;if(Y!==null&&(D=Y.memoCache),D==null){var se=Pr.alternate;se!==null&&(se=se.updateQueue,se!==null&&(se=se.memoCache,se!=null&&(D={data:se.data.map(function(ue){return ue.slice()}),index:0})))}if(D==null&&(D={data:[],index:0}),Y===null&&(Y=ku(),Pr.updateQueue=Y),Y.memoCache=D,Y=D.data[D.index],Y===void 0)for(Y=D.data[D.index]=Array(M),se=0;se<M;se++)Y[se]=Se;return D.index++,Y}function Tn(M,D){return typeof D=="function"?D(M):D}function Al(M){var D=ci();return Au(D,zr,M)}function Au(M,D,Y){var se=M.queue;if(se===null)throw Error(w(311));se.lastRenderedReducer=Y;var ue=M.baseQueue,ge=se.pending;if(ge!==null){if(ue!==null){var we=ue.next;ue.next=ge.next,ge.next=we}D.baseQueue=ue=ge,se.pending=null}if(ge=M.baseState,ue===null)M.memoizedState=ge;else{D=ue.next;var Me=we=null,qe=null,St=D,Zt=!1;do{var or=St.lane&-536870913;if(or!==St.lane?(Lr&or)===or:(Gn&or)===or){var Rt=St.revertLane;if(Rt===0)qe!==null&&(qe=qe.next={lane:0,revertLane:0,action:St.action,hasEagerState:St.hasEagerState,eagerState:St.eagerState,next:null}),or===Rs&&(Zt=!0);else if((Gn&Rt)===Rt){St=St.next,Rt===Rs&&(Zt=!0);continue}else or={lane:0,revertLane:St.revertLane,action:St.action,hasEagerState:St.hasEagerState,eagerState:St.eagerState,next:null},qe===null?(Me=qe=or,we=ge):qe=qe.next=or,Pr.lanes|=Rt,eo|=Rt;or=St.action,Wo&&Y(ge,or),ge=St.hasEagerState?St.eagerState:Y(ge,or)}else Rt={lane:or,revertLane:St.revertLane,action:St.action,hasEagerState:St.hasEagerState,eagerState:St.eagerState,next:null},qe===null?(Me=qe=Rt,we=ge):qe=qe.next=Rt,Pr.lanes|=or,eo|=or;St=St.next}while(St!==null&&St!==D);if(qe===null?we=ge:qe.next=Me,!Mi(ge,M.memoizedState)&&(hi=!0,Zt&&(Y=Ts,Y!==null)))throw Y;M.memoizedState=ge,M.baseState=we,M.baseQueue=qe,se.lastRenderedState=ge}return ue===null&&(se.lanes=0),[M.memoizedState,se.dispatch]}function Pu(M){var D=ci(),Y=D.queue;if(Y===null)throw Error(w(311));Y.lastRenderedReducer=M;var se=Y.dispatch,ue=Y.pending,ge=D.memoizedState;if(ue!==null){Y.pending=null;var we=ue=ue.next;do ge=M(ge,we.action),we=we.next;while(we!==ue);Mi(ge,D.memoizedState)||(hi=!0),D.memoizedState=ge,D.baseQueue===null&&(D.baseState=ge),Y.lastRenderedState=ge}return[ge,se]}function wp(M,D,Y){var se=Pr,ue=ci(),ge=Nr;if(ge){if(Y===void 0)throw Error(w(407));Y=Y()}else Y=D();var we=!Mi((zr||ue).memoizedState,Y);we&&(ue.memoizedState=Y,hi=!0),ue=ue.queue;var Me=kp.bind(null,se,ue,M);if(Ta(2048,8,Me,[M]),ue.getSnapshot!==D||we||li!==null&&li.memoizedState.tag&1){if(se.flags|=2048,Ms(9,Pl(),Tp.bind(null,se,ue,Y,D),null),Jr===null)throw Error(w(349));ge||(Gn&124)!==0||Rp(se,D,Y)}return Y}function Rp(M,D,Y){M.flags|=16384,M={getSnapshot:D,value:Y},D=Pr.updateQueue,D===null?(D=ku(),Pr.updateQueue=D,D.stores=[M]):(Y=D.stores,Y===null?D.stores=[M]:Y.push(M))}function Tp(M,D,Y,se){D.value=Y,D.getSnapshot=se,Ap(D)&&Pp(M)}function kp(M,D,Y){return Y(function(){Ap(D)&&Pp(M)})}function Ap(M){var D=M.getSnapshot;M=M.value;try{var Y=D();return!Mi(M,Y)}catch{return!0}}function Pp(M){var D=Ss(M,2);D!==null&&Li(D,M,2)}function Mu(M){var D=wi();if(typeof M=="function"){var Y=M;if(M=Y(),Wo){kt(!0);try{Y()}finally{kt(!1)}}}return D.memoizedState=D.baseState=M,D.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tn,lastRenderedState:M},D}function Mp(M,D,Y,se){return M.baseState=Y,Au(M,zr,typeof se=="function"?se:Tn)}function Mm(M,D,Y,se,ue){if(Il(M))throw Error(w(485));if(M=D.action,M!==null){var ge={payload:ue,action:M,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(we){ge.listeners.push(we)}};Te.T!==null?Y(!0):ge.isTransition=!1,se(ge),Y=D.pending,Y===null?(ge.next=D.pending=ge,Ip(D,ge)):(ge.next=Y.next,D.pending=Y.next=ge)}}function Ip(M,D){var Y=D.action,se=D.payload,ue=M.state;if(D.isTransition){var ge=Te.T,we={};Te.T=we;try{var Me=Y(ue,se),qe=Te.S;qe!==null&&qe(we,Me),Op(M,D,Me)}catch(St){Iu(M,D,St)}finally{Te.T=ge}}else try{ge=Y(ue,se),Op(M,D,ge)}catch(St){Iu(M,D,St)}}function Op(M,D,Y){Y!==null&&typeof Y=="object"&&typeof Y.then=="function"?Y.then(function(se){Dp(M,D,se)},function(se){return Iu(M,D,se)}):Dp(M,D,Y)}function Dp(M,D,Y){D.status="fulfilled",D.value=Y,Bp(D),M.state=Y,D=M.pending,D!==null&&(Y=D.next,Y===D?M.pending=null:(Y=Y.next,D.next=Y,Ip(M,Y)))}function Iu(M,D,Y){var se=M.pending;if(M.pending=null,se!==null){se=se.next;do D.status="rejected",D.reason=Y,Bp(D),D=D.next;while(D!==se)}M.action=null}function Bp(M){M=M.listeners;for(var D=0;D<M.length;D++)(0,M[D])()}function jp(M,D){return D}function Lp(M,D){if(Nr){var Y=Jr.formState;if(Y!==null){e:{var se=Pr;if(Nr){if(ti){t:{for(var ue=ti,ge=dn;ue.nodeType!==8;){if(!ge){ue=null;break t}if(ue=en(ue.nextSibling),ue===null){ue=null;break t}}ge=ue.data,ue=ge==="F!"||ge==="F"?ue:null}if(ue){ti=en(ue.nextSibling),se=ue.data==="F!";break e}}qo(se)}se=!1}se&&(D=Y[0])}}return Y=wi(),Y.memoizedState=Y.baseState=D,se={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jp,lastRenderedState:D},Y.queue=se,Y=rh.bind(null,Pr,se),se.dispatch=Y,se=Mu(!1),ge=Lu.bind(null,Pr,!1,se.queue),se=wi(),ue={state:D,dispatch:null,action:M,pending:null},se.queue=ue,Y=Mm.bind(null,Pr,ue,ge,Y),ue.dispatch=Y,se.memoizedState=M,[D,Y,!1]}function Fp(M){var D=ci();return Vp(D,zr,M)}function Vp(M,D,Y){if(D=Au(M,D,jp)[0],M=Al(Tn)[0],typeof D=="object"&&D!==null&&typeof D.then=="function")try{var se=Ra(D)}catch(we){throw we===ya?El:we}else se=D;D=ci();var ue=D.queue,ge=ue.dispatch;return Y!==D.memoizedState&&(Pr.flags|=2048,Ms(9,Pl(),Im.bind(null,ue,Y),null)),[se,ge,M]}function Im(M,D){M.action=D}function Np(M){var D=ci(),Y=zr;if(Y!==null)return Vp(D,Y,M);ci(),D=D.memoizedState,Y=ci();var se=Y.queue.dispatch;return Y.memoizedState=M,[D,se,!1]}function Ms(M,D,Y,se){return M={tag:M,create:Y,deps:se,inst:D,next:null},D=Pr.updateQueue,D===null&&(D=ku(),Pr.updateQueue=D),Y=D.lastEffect,Y===null?D.lastEffect=M.next=M:(se=Y.next,Y.next=M,M.next=se,D.lastEffect=M),M}function Pl(){return{destroy:void 0,resource:void 0}}function Up(){return ci().memoizedState}function Ml(M,D,Y,se){var ue=wi();se=se===void 0?null:se,Pr.flags|=M,ue.memoizedState=Ms(1|D,Pl(),Y,se)}function Ta(M,D,Y,se){var ue=ci();se=se===void 0?null:se;var ge=ue.memoizedState.inst;zr!==null&&se!==null&&Cu(se,zr.memoizedState.deps)?ue.memoizedState=Ms(D,ge,Y,se):(Pr.flags|=M,ue.memoizedState=Ms(1|D,ge,Y,se))}function qp(M,D){Ml(8390656,8,M,D)}function $p(M,D){Ta(2048,8,M,D)}function zp(M,D){return Ta(4,2,M,D)}function Hp(M,D){return Ta(4,4,M,D)}function Wp(M,D){if(typeof D=="function"){M=M();var Y=D(M);return function(){typeof Y=="function"?Y():D(null)}}if(D!=null)return M=M(),D.current=M,function(){D.current=null}}function Gp(M,D,Y){Y=Y!=null?Y.concat([M]):null,Ta(4,4,Wp.bind(null,D,M),Y)}function Ou(){}function Kp(M,D){var Y=ci();D=D===void 0?null:D;var se=Y.memoizedState;return D!==null&&Cu(D,se[1])?se[0]:(Y.memoizedState=[M,D],M)}function Jp(M,D){var Y=ci();D=D===void 0?null:D;var se=Y.memoizedState;if(D!==null&&Cu(D,se[1]))return se[0];if(se=M(),Wo){kt(!0);try{M()}finally{kt(!1)}}return Y.memoizedState=[se,D],se}function Du(M,D,Y){return Y===void 0||(Gn&1073741824)!==0?M.memoizedState=D:(M.memoizedState=Y,M=Zh(),Pr.lanes|=M,eo|=M,Y)}function Yp(M,D,Y,se){return Mi(Y,D)?Y:ks.current!==null?(M=Du(M,Y,se),Mi(M,D)||(hi=!0),M):(Gn&42)===0?(hi=!0,M.memoizedState=Y):(M=Zh(),Pr.lanes|=M,eo|=M,D)}function Xp(M,D,Y,se,ue){var ge=De.p;De.p=ge!==0&&8>ge?ge:8;var we=Te.T,Me={};Te.T=Me,Lu(M,!1,D,Y);try{var qe=ue(),St=Te.S;if(St!==null&&St(Me,qe),qe!==null&&typeof qe=="object"&&typeof qe.then=="function"){var Zt=_m(qe,se);ka(M,D,Zt,ji(M))}else ka(M,D,se,ji(M))}catch(or){ka(M,D,{then:function(){},status:"rejected",reason:or},ji())}finally{De.p=ge,Te.T=we}}function Om(){}function Bu(M,D,Y,se){if(M.tag!==5)throw Error(w(476));var ue=Zp(M).queue;Xp(M,ue,D,Ue,Y===null?Om:function(){return Qp(M),Y(se)})}function Zp(M){var D=M.memoizedState;if(D!==null)return D;D={memoizedState:Ue,baseState:Ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tn,lastRenderedState:Ue},next:null};var Y={};return D.next={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tn,lastRenderedState:Y},next:null},M.memoizedState=D,M=M.alternate,M!==null&&(M.memoizedState=D),D}function Qp(M){var D=Zp(M).next.queue;ka(M,D,{},ji())}function ju(){return Si(Wa)}function eh(){return ci().memoizedState}function th(){return ci().memoizedState}function Dm(M){for(var D=M.return;D!==null;){switch(D.tag){case 24:case 3:var Y=ji();M=Hn(Y);var se=Wn(D,M,Y);se!==null&&(Li(se,D,Y),Sa(se,D,Y)),D={cache:pu()},M.payload=D;return}D=D.return}}function Bm(M,D,Y){var se=ji();Y={lane:se,revertLane:0,action:Y,hasEagerState:!1,eagerState:null,next:null},Il(M)?ih(D,Y):(Y=ru(M,D,Y,se),Y!==null&&(Li(Y,M,se),nh(Y,D,se)))}function rh(M,D,Y){var se=ji();ka(M,D,Y,se)}function ka(M,D,Y,se){var ue={lane:se,revertLane:0,action:Y,hasEagerState:!1,eagerState:null,next:null};if(Il(M))ih(D,ue);else{var ge=M.alternate;if(M.lanes===0&&(ge===null||ge.lanes===0)&&(ge=D.lastRenderedReducer,ge!==null))try{var we=D.lastRenderedState,Me=ge(we,Y);if(ue.hasEagerState=!0,ue.eagerState=Me,Mi(Me,we))return ml(M,D,ue,0),Jr===null&&fl(),!1}catch{}finally{}if(Y=ru(M,D,ue,se),Y!==null)return Li(Y,M,se),nh(Y,D,se),!0}return!1}function Lu(M,D,Y,se){if(se={lane:2,revertLane:md(),action:se,hasEagerState:!1,eagerState:null,next:null},Il(M)){if(D)throw Error(w(479))}else D=ru(M,Y,se,2),D!==null&&Li(D,M,2)}function Il(M){var D=M.alternate;return M===Pr||D!==null&&D===Pr}function ih(M,D){As=Tl=!0;var Y=M.pending;Y===null?D.next=D:(D.next=Y.next,Y.next=D),M.pending=D}function nh(M,D,Y){if((Y&4194048)!==0){var se=D.lanes;se&=M.pendingLanes,Y|=se,D.lanes=Y,xe(M,Y)}}var Ol={readContext:Si,use:_l,useCallback:ni,useContext:ni,useEffect:ni,useImperativeHandle:ni,useLayoutEffect:ni,useInsertionEffect:ni,useMemo:ni,useReducer:ni,useRef:ni,useState:ni,useDebugValue:ni,useDeferredValue:ni,useTransition:ni,useSyncExternalStore:ni,useId:ni,useHostTransitionStatus:ni,useFormState:ni,useActionState:ni,useOptimistic:ni,useMemoCache:ni,useCacheRefresh:ni},oh={readContext:Si,use:_l,useCallback:function(M,D){return wi().memoizedState=[M,D===void 0?null:D],M},useContext:Si,useEffect:qp,useImperativeHandle:function(M,D,Y){Y=Y!=null?Y.concat([M]):null,Ml(4194308,4,Wp.bind(null,D,M),Y)},useLayoutEffect:function(M,D){return Ml(4194308,4,M,D)},useInsertionEffect:function(M,D){Ml(4,2,M,D)},useMemo:function(M,D){var Y=wi();D=D===void 0?null:D;var se=M();if(Wo){kt(!0);try{M()}finally{kt(!1)}}return Y.memoizedState=[se,D],se},useReducer:function(M,D,Y){var se=wi();if(Y!==void 0){var ue=Y(D);if(Wo){kt(!0);try{Y(D)}finally{kt(!1)}}}else ue=D;return se.memoizedState=se.baseState=ue,M={pending:null,lanes:0,dispatch:null,lastRenderedReducer:M,lastRenderedState:ue},se.queue=M,M=M.dispatch=Bm.bind(null,Pr,M),[se.memoizedState,M]},useRef:function(M){var D=wi();return M={current:M},D.memoizedState=M},useState:function(M){M=Mu(M);var D=M.queue,Y=rh.bind(null,Pr,D);return D.dispatch=Y,[M.memoizedState,Y]},useDebugValue:Ou,useDeferredValue:function(M,D){var Y=wi();return Du(Y,M,D)},useTransition:function(){var M=Mu(!1);return M=Xp.bind(null,Pr,M.queue,!0,!1),wi().memoizedState=M,[!1,M]},useSyncExternalStore:function(M,D,Y){var se=Pr,ue=wi();if(Nr){if(Y===void 0)throw Error(w(407));Y=Y()}else{if(Y=D(),Jr===null)throw Error(w(349));(Lr&124)!==0||Rp(se,D,Y)}ue.memoizedState=Y;var ge={value:Y,getSnapshot:D};return ue.queue=ge,qp(kp.bind(null,se,ge,M),[M]),se.flags|=2048,Ms(9,Pl(),Tp.bind(null,se,ge,Y,D),null),Y},useId:function(){var M=wi(),D=Jr.identifierPrefix;if(Nr){var Y=En,se=Cn;Y=(se&~(1<<32-ke(se)-1)).toString(32)+Y,D="«"+D+"R"+Y,Y=kl++,0<Y&&(D+="H"+Y.toString(32)),D+="»"}else Y=Am++,D="«"+D+"r"+Y.toString(32)+"»";return M.memoizedState=D},useHostTransitionStatus:ju,useFormState:Lp,useActionState:Lp,useOptimistic:function(M){var D=wi();D.memoizedState=D.baseState=M;var Y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return D.queue=Y,D=Lu.bind(null,Pr,!0,Y),Y.dispatch=D,[M,D]},useMemoCache:_u,useCacheRefresh:function(){return wi().memoizedState=Dm.bind(null,Pr)}},sh={readContext:Si,use:_l,useCallback:Kp,useContext:Si,useEffect:$p,useImperativeHandle:Gp,useInsertionEffect:zp,useLayoutEffect:Hp,useMemo:Jp,useReducer:Al,useRef:Up,useState:function(){return Al(Tn)},useDebugValue:Ou,useDeferredValue:function(M,D){var Y=ci();return Yp(Y,zr.memoizedState,M,D)},useTransition:function(){var M=Al(Tn)[0],D=ci().memoizedState;return[typeof M=="boolean"?M:Ra(M),D]},useSyncExternalStore:wp,useId:eh,useHostTransitionStatus:ju,useFormState:Fp,useActionState:Fp,useOptimistic:function(M,D){var Y=ci();return Mp(Y,zr,M,D)},useMemoCache:_u,useCacheRefresh:th},jm={readContext:Si,use:_l,useCallback:Kp,useContext:Si,useEffect:$p,useImperativeHandle:Gp,useInsertionEffect:zp,useLayoutEffect:Hp,useMemo:Jp,useReducer:Pu,useRef:Up,useState:function(){return Pu(Tn)},useDebugValue:Ou,useDeferredValue:function(M,D){var Y=ci();return zr===null?Du(Y,M,D):Yp(Y,zr.memoizedState,M,D)},useTransition:function(){var M=Pu(Tn)[0],D=ci().memoizedState;return[typeof M=="boolean"?M:Ra(M),D]},useSyncExternalStore:wp,useId:eh,useHostTransitionStatus:ju,useFormState:Np,useActionState:Np,useOptimistic:function(M,D){var Y=ci();return zr!==null?Mp(Y,zr,M,D):(Y.baseState=M,[M,Y.queue.dispatch])},useMemoCache:_u,useCacheRefresh:th},Is=null,Aa=0;function Dl(M){var D=Aa;return Aa+=1,Is===null&&(Is=[]),gp(Is,M,D)}function Pa(M,D){D=D.props.ref,M.ref=D!==void 0?D:null}function Bl(M,D){throw D.$$typeof===ee?Error(w(525)):(M=Object.prototype.toString.call(D),Error(w(31,M==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":M)))}function ah(M){var D=M._init;return D(M._payload)}function lh(M){function D(ot,Ye){if(M){var ft=ot.deletions;ft===null?(ot.deletions=[Ye],ot.flags|=16):ft.push(Ye)}}function Y(ot,Ye){if(!M)return null;for(;Ye!==null;)D(ot,Ye),Ye=Ye.sibling;return null}function se(ot){for(var Ye=new Map;ot!==null;)ot.key!==null?Ye.set(ot.key,ot):Ye.set(ot.index,ot),ot=ot.sibling;return Ye}function ue(ot,Ye){return ot=Sn(ot,Ye),ot.index=0,ot.sibling=null,ot}function ge(ot,Ye,ft){return ot.index=ft,M?(ft=ot.alternate,ft!==null?(ft=ft.index,ft<Ye?(ot.flags|=67108866,Ye):ft):(ot.flags|=67108866,Ye)):(ot.flags|=1048576,Ye)}function we(ot){return M&&ot.alternate===null&&(ot.flags|=67108866),ot}function Me(ot,Ye,ft,rr){return Ye===null||Ye.tag!==6?(Ye=nu(ft,ot.mode,rr),Ye.return=ot,Ye):(Ye=ue(Ye,ft),Ye.return=ot,Ye)}function qe(ot,Ye,ft,rr){var Er=ft.type;return Er===ne?Zt(ot,Ye,ft.props.children,rr,ft.key):Ye!==null&&(Ye.elementType===Er||typeof Er=="object"&&Er!==null&&Er.$$typeof===ve&&ah(Er)===Ye.type)?(Ye=ue(Ye,ft.props),Pa(Ye,ft),Ye.return=ot,Ye):(Ye=vl(ft.type,ft.key,ft.props,null,ot.mode,rr),Pa(Ye,ft),Ye.return=ot,Ye)}function St(ot,Ye,ft,rr){return Ye===null||Ye.tag!==4||Ye.stateNode.containerInfo!==ft.containerInfo||Ye.stateNode.implementation!==ft.implementation?(Ye=ou(ft,ot.mode,rr),Ye.return=ot,Ye):(Ye=ue(Ye,ft.children||[]),Ye.return=ot,Ye)}function Zt(ot,Ye,ft,rr,Er){return Ye===null||Ye.tag!==7?(Ye=Fo(ft,ot.mode,rr,Er),Ye.return=ot,Ye):(Ye=ue(Ye,ft),Ye.return=ot,Ye)}function or(ot,Ye,ft){if(typeof Ye=="string"&&Ye!==""||typeof Ye=="number"||typeof Ye=="bigint")return Ye=nu(""+Ye,ot.mode,ft),Ye.return=ot,Ye;if(typeof Ye=="object"&&Ye!==null){switch(Ye.$$typeof){case te:return ft=vl(Ye.type,Ye.key,Ye.props,null,ot.mode,ft),Pa(ft,Ye),ft.return=ot,ft;case ie:return Ye=ou(Ye,ot.mode,ft),Ye.return=ot,Ye;case ve:var rr=Ye._init;return Ye=rr(Ye._payload),or(ot,Ye,ft)}if(Ie(Ye)||be(Ye))return Ye=Fo(Ye,ot.mode,ft,null),Ye.return=ot,Ye;if(typeof Ye.then=="function")return or(ot,Dl(Ye),ft);if(Ye.$$typeof===de)return or(ot,Sl(ot,Ye),ft);Bl(ot,Ye)}return null}function Rt(ot,Ye,ft,rr){var Er=Ye!==null?Ye.key:null;if(typeof ft=="string"&&ft!==""||typeof ft=="number"||typeof ft=="bigint")return Er!==null?null:Me(ot,Ye,""+ft,rr);if(typeof ft=="object"&&ft!==null){switch(ft.$$typeof){case te:return ft.key===Er?qe(ot,Ye,ft,rr):null;case ie:return ft.key===Er?St(ot,Ye,ft,rr):null;case ve:return Er=ft._init,ft=Er(ft._payload),Rt(ot,Ye,ft,rr)}if(Ie(ft)||be(ft))return Er!==null?null:Zt(ot,Ye,ft,rr,null);if(typeof ft.then=="function")return Rt(ot,Ye,Dl(ft),rr);if(ft.$$typeof===de)return Rt(ot,Ye,Sl(ot,ft),rr);Bl(ot,ft)}return null}function Tt(ot,Ye,ft,rr,Er){if(typeof rr=="string"&&rr!==""||typeof rr=="number"||typeof rr=="bigint")return ot=ot.get(ft)||null,Me(Ye,ot,""+rr,Er);if(typeof rr=="object"&&rr!==null){switch(rr.$$typeof){case te:return ot=ot.get(rr.key===null?ft:rr.key)||null,qe(Ye,ot,rr,Er);case ie:return ot=ot.get(rr.key===null?ft:rr.key)||null,St(Ye,ot,rr,Er);case ve:var Mr=rr._init;return rr=Mr(rr._payload),Tt(ot,Ye,ft,rr,Er)}if(Ie(rr)||be(rr))return ot=ot.get(ft)||null,Zt(Ye,ot,rr,Er,null);if(typeof rr.then=="function")return Tt(ot,Ye,ft,Dl(rr),Er);if(rr.$$typeof===de)return Tt(ot,Ye,ft,Sl(Ye,rr),Er);Bl(Ye,rr)}return null}function _r(ot,Ye,ft,rr){for(var Er=null,Mr=null,wr=Ye,kr=Ye=0,mi=null;wr!==null&&kr<ft.length;kr++){wr.index>kr?(mi=wr,wr=null):mi=wr.sibling;var Vr=Rt(ot,wr,ft[kr],rr);if(Vr===null){wr===null&&(wr=mi);break}M&&wr&&Vr.alternate===null&&D(ot,wr),Ye=ge(Vr,Ye,kr),Mr===null?Er=Vr:Mr.sibling=Vr,Mr=Vr,wr=mi}if(kr===ft.length)return Y(ot,wr),Nr&&No(ot,kr),Er;if(wr===null){for(;kr<ft.length;kr++)wr=or(ot,ft[kr],rr),wr!==null&&(Ye=ge(wr,Ye,kr),Mr===null?Er=wr:Mr.sibling=wr,Mr=wr);return Nr&&No(ot,kr),Er}for(wr=se(wr);kr<ft.length;kr++)mi=Tt(wr,ot,kr,ft[kr],rr),mi!==null&&(M&&mi.alternate!==null&&wr.delete(mi.key===null?kr:mi.key),Ye=ge(mi,Ye,kr),Mr===null?Er=mi:Mr.sibling=mi,Mr=mi);return M&&wr.forEach(function(go){return D(ot,go)}),Nr&&No(ot,kr),Er}function Tr(ot,Ye,ft,rr){if(ft==null)throw Error(w(151));for(var Er=null,Mr=null,wr=Ye,kr=Ye=0,mi=null,Vr=ft.next();wr!==null&&!Vr.done;kr++,Vr=ft.next()){wr.index>kr?(mi=wr,wr=null):mi=wr.sibling;var go=Rt(ot,wr,Vr.value,rr);if(go===null){wr===null&&(wr=mi);break}M&&wr&&go.alternate===null&&D(ot,wr),Ye=ge(go,Ye,kr),Mr===null?Er=go:Mr.sibling=go,Mr=go,wr=mi}if(Vr.done)return Y(ot,wr),Nr&&No(ot,kr),Er;if(wr===null){for(;!Vr.done;kr++,Vr=ft.next())Vr=or(ot,Vr.value,rr),Vr!==null&&(Ye=ge(Vr,Ye,kr),Mr===null?Er=Vr:Mr.sibling=Vr,Mr=Vr);return Nr&&No(ot,kr),Er}for(wr=se(wr);!Vr.done;kr++,Vr=ft.next())Vr=Tt(wr,ot,kr,Vr.value,rr),Vr!==null&&(M&&Vr.alternate!==null&&wr.delete(Vr.key===null?kr:Vr.key),Ye=ge(Vr,Ye,kr),Mr===null?Er=Vr:Mr.sibling=Vr,Mr=Vr);return M&&wr.forEach(function(Lg){return D(ot,Lg)}),Nr&&No(ot,kr),Er}function Wr(ot,Ye,ft,rr){if(typeof ft=="object"&&ft!==null&&ft.type===ne&&ft.key===null&&(ft=ft.props.children),typeof ft=="object"&&ft!==null){switch(ft.$$typeof){case te:e:{for(var Er=ft.key;Ye!==null;){if(Ye.key===Er){if(Er=ft.type,Er===ne){if(Ye.tag===7){Y(ot,Ye.sibling),rr=ue(Ye,ft.props.children),rr.return=ot,ot=rr;break e}}else if(Ye.elementType===Er||typeof Er=="object"&&Er!==null&&Er.$$typeof===ve&&ah(Er)===Ye.type){Y(ot,Ye.sibling),rr=ue(Ye,ft.props),Pa(rr,ft),rr.return=ot,ot=rr;break e}Y(ot,Ye);break}else D(ot,Ye);Ye=Ye.sibling}ft.type===ne?(rr=Fo(ft.props.children,ot.mode,rr,ft.key),rr.return=ot,ot=rr):(rr=vl(ft.type,ft.key,ft.props,null,ot.mode,rr),Pa(rr,ft),rr.return=ot,ot=rr)}return we(ot);case ie:e:{for(Er=ft.key;Ye!==null;){if(Ye.key===Er)if(Ye.tag===4&&Ye.stateNode.containerInfo===ft.containerInfo&&Ye.stateNode.implementation===ft.implementation){Y(ot,Ye.sibling),rr=ue(Ye,ft.children||[]),rr.return=ot,ot=rr;break e}else{Y(ot,Ye);break}else D(ot,Ye);Ye=Ye.sibling}rr=ou(ft,ot.mode,rr),rr.return=ot,ot=rr}return we(ot);case ve:return Er=ft._init,ft=Er(ft._payload),Wr(ot,Ye,ft,rr)}if(Ie(ft))return _r(ot,Ye,ft,rr);if(be(ft)){if(Er=be(ft),typeof Er!="function")throw Error(w(150));return ft=Er.call(ft),Tr(ot,Ye,ft,rr)}if(typeof ft.then=="function")return Wr(ot,Ye,Dl(ft),rr);if(ft.$$typeof===de)return Wr(ot,Ye,Sl(ot,ft),rr);Bl(ot,ft)}return typeof ft=="string"&&ft!==""||typeof ft=="number"||typeof ft=="bigint"?(ft=""+ft,Ye!==null&&Ye.tag===6?(Y(ot,Ye.sibling),rr=ue(Ye,ft),rr.return=ot,ot=rr):(Y(ot,Ye),rr=nu(ft,ot.mode,rr),rr.return=ot,ot=rr),we(ot)):Y(ot,Ye)}return function(ot,Ye,ft,rr){try{Aa=0;var Er=Wr(ot,Ye,ft,rr);return Is=null,Er}catch(wr){if(wr===ya||wr===El)throw wr;var Mr=Ii(29,wr,null,ot.mode);return Mr.lanes=rr,Mr.return=ot,Mr}finally{}}}var Os=lh(!0),ch=lh(!1),zi=$e(null),pn=null;function Kn(M){var D=M.alternate;je(pi,pi.current&1),je(zi,M),pn===null&&(D===null||ks.current!==null||D.memoizedState!==null)&&(pn=M)}function uh(M){if(M.tag===22){if(je(pi,pi.current),je(zi,M),pn===null){var D=M.alternate;D!==null&&D.memoizedState!==null&&(pn=M)}}else Jn()}function Jn(){je(pi,pi.current),je(zi,zi.current)}function kn(M){He(zi),pn===M&&(pn=null),He(pi)}var pi=$e(0);function jl(M){for(var D=M;D!==null;){if(D.tag===13){var Y=D.memoizedState;if(Y!==null&&(Y=Y.dehydrated,Y===null||Y.data==="$?"||kd(Y)))return D}else if(D.tag===19&&D.memoizedProps.revealOrder!==void 0){if((D.flags&128)!==0)return D}else if(D.child!==null){D.child.return=D,D=D.child;continue}if(D===M)break;for(;D.sibling===null;){if(D.return===null||D.return===M)return null;D=D.return}D.sibling.return=D.return,D=D.sibling}return null}function Fu(M,D,Y,se){D=M.memoizedState,Y=Y(se,D),Y=Y==null?D:H({},D,Y),M.memoizedState=Y,M.lanes===0&&(M.updateQueue.baseState=Y)}var Vu={enqueueSetState:function(M,D,Y){M=M._reactInternals;var se=ji(),ue=Hn(se);ue.payload=D,Y!=null&&(ue.callback=Y),D=Wn(M,ue,se),D!==null&&(Li(D,M,se),Sa(D,M,se))},enqueueReplaceState:function(M,D,Y){M=M._reactInternals;var se=ji(),ue=Hn(se);ue.tag=1,ue.payload=D,Y!=null&&(ue.callback=Y),D=Wn(M,ue,se),D!==null&&(Li(D,M,se),Sa(D,M,se))},enqueueForceUpdate:function(M,D){M=M._reactInternals;var Y=ji(),se=Hn(Y);se.tag=2,D!=null&&(se.callback=D),D=Wn(M,se,Y),D!==null&&(Li(D,M,Y),Sa(D,M,Y))}};function dh(M,D,Y,se,ue,ge,we){return M=M.stateNode,typeof M.shouldComponentUpdate=="function"?M.shouldComponentUpdate(se,ge,we):D.prototype&&D.prototype.isPureReactComponent?!da(Y,se)||!da(ue,ge):!0}function ph(M,D,Y,se){M=D.state,typeof D.componentWillReceiveProps=="function"&&D.componentWillReceiveProps(Y,se),typeof D.UNSAFE_componentWillReceiveProps=="function"&&D.UNSAFE_componentWillReceiveProps(Y,se),D.state!==M&&Vu.enqueueReplaceState(D,D.state,null)}function Go(M,D){var Y=D;if("ref"in D){Y={};for(var se in D)se!=="ref"&&(Y[se]=D[se])}if(M=M.defaultProps){Y===D&&(Y=H({},Y));for(var ue in M)Y[ue]===void 0&&(Y[ue]=M[ue])}return Y}var Ll=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)};function hh(M){Ll(M)}function fh(M){console.error(M)}function mh(M){Ll(M)}function Fl(M,D){try{var Y=M.onUncaughtError;Y(D.value,{componentStack:D.stack})}catch(se){setTimeout(function(){throw se})}}function gh(M,D,Y){try{var se=M.onCaughtError;se(Y.value,{componentStack:Y.stack,errorBoundary:D.tag===1?D.stateNode:null})}catch(ue){setTimeout(function(){throw ue})}}function Nu(M,D,Y){return Y=Hn(Y),Y.tag=3,Y.payload={element:null},Y.callback=function(){Fl(M,D)},Y}function vh(M){return M=Hn(M),M.tag=3,M}function bh(M,D,Y,se){var ue=Y.type.getDerivedStateFromError;if(typeof ue=="function"){var ge=se.value;M.payload=function(){return ue(ge)},M.callback=function(){gh(D,Y,se)}}var we=Y.stateNode;we!==null&&typeof we.componentDidCatch=="function"&&(M.callback=function(){gh(D,Y,se),typeof ue!="function"&&(to===null?to=new Set([this]):to.add(this));var Me=se.stack;this.componentDidCatch(se.value,{componentStack:Me!==null?Me:""})})}function Lm(M,D,Y,se,ue){if(Y.flags|=32768,se!==null&&typeof se=="object"&&typeof se.then=="function"){if(D=Y.alternate,D!==null&&ga(D,Y,ue,!0),Y=zi.current,Y!==null){switch(Y.tag){case 13:return pn===null?ud():Y.alternate===null&&ri===0&&(ri=3),Y.flags&=-257,Y.flags|=65536,Y.lanes=ue,se===mu?Y.flags|=16384:(D=Y.updateQueue,D===null?Y.updateQueue=new Set([se]):D.add(se),pd(M,se,ue)),!1;case 22:return Y.flags|=65536,se===mu?Y.flags|=16384:(D=Y.updateQueue,D===null?(D={transitions:null,markerInstances:null,retryQueue:new Set([se])},Y.updateQueue=D):(Y=D.retryQueue,Y===null?D.retryQueue=new Set([se]):Y.add(se)),pd(M,se,ue)),!1}throw Error(w(435,Y.tag))}return pd(M,se,ue),ud(),!1}if(Nr)return D=zi.current,D!==null?((D.flags&65536)===0&&(D.flags|=256),D.flags|=65536,D.lanes=ue,se!==lu&&(M=Error(w(422),{cause:se}),ma(Ni(M,Y)))):(se!==lu&&(D=Error(w(423),{cause:se}),ma(Ni(D,Y))),M=M.current.alternate,M.flags|=65536,ue&=-ue,M.lanes|=ue,se=Ni(se,Y),ue=Nu(M.stateNode,se,ue),bu(M,ue),ri!==4&&(ri=2)),!1;var ge=Error(w(520),{cause:se});if(ge=Ni(ge,Y),La===null?La=[ge]:La.push(ge),ri!==4&&(ri=2),D===null)return!0;se=Ni(se,Y),Y=D;do{switch(Y.tag){case 3:return Y.flags|=65536,M=ue&-ue,Y.lanes|=M,M=Nu(Y.stateNode,se,M),bu(Y,M),!1;case 1:if(D=Y.type,ge=Y.stateNode,(Y.flags&128)===0&&(typeof D.getDerivedStateFromError=="function"||ge!==null&&typeof ge.componentDidCatch=="function"&&(to===null||!to.has(ge))))return Y.flags|=65536,ue&=-ue,Y.lanes|=ue,ue=vh(ue),bh(ue,M,Y,se),bu(Y,ue),!1}Y=Y.return}while(Y!==null);return!1}var yh=Error(w(461)),hi=!1;function gi(M,D,Y,se){D.child=M===null?ch(D,null,Y,se):Os(D,M.child,Y,se)}function xh(M,D,Y,se,ue){Y=Y.render;var ge=D.ref;if("ref"in se){var we={};for(var Me in se)Me!=="ref"&&(we[Me]=se[Me])}else we=se;return zo(D),se=Eu(M,D,Y,we,ge,ue),Me=wu(),M!==null&&!hi?(Ru(M,D,ue),_n(M,D,ue)):(Nr&&Me&&su(D),D.flags|=1,gi(M,D,se,ue),D.child)}function Sh(M,D,Y,se,ue){if(M===null){var ge=Y.type;return typeof ge=="function"&&!iu(ge)&&ge.defaultProps===void 0&&Y.compare===null?(D.tag=15,D.type=ge,Ch(M,D,ge,se,ue)):(M=vl(Y.type,null,se,D,D.mode,ue),M.ref=D.ref,M.return=D,D.child=M)}if(ge=M.child,!Ku(M,ue)){var we=ge.memoizedProps;if(Y=Y.compare,Y=Y!==null?Y:da,Y(we,se)&&M.ref===D.ref)return _n(M,D,ue)}return D.flags|=1,M=Sn(ge,se),M.ref=D.ref,M.return=D,D.child=M}function Ch(M,D,Y,se,ue){if(M!==null){var ge=M.memoizedProps;if(da(ge,se)&&M.ref===D.ref)if(hi=!1,D.pendingProps=se=ge,Ku(M,ue))(M.flags&131072)!==0&&(hi=!0);else return D.lanes=M.lanes,_n(M,D,ue)}return Uu(M,D,Y,se,ue)}function Eh(M,D,Y){var se=D.pendingProps,ue=se.children,ge=M!==null?M.memoizedState:null;if(se.mode==="hidden"){if((D.flags&128)!==0){if(se=ge!==null?ge.baseLanes|Y:Y,M!==null){for(ue=D.child=M.child,ge=0;ue!==null;)ge=ge|ue.lanes|ue.childLanes,ue=ue.sibling;D.childLanes=ge&~se}else D.childLanes=0,D.child=null;return wh(M,D,se,Y)}if((Y&536870912)!==0)D.memoizedState={baseLanes:0,cachePool:null},M!==null&&Cl(D,ge!==null?ge.cachePool:null),ge!==null?Sp(D,ge):xu(),uh(D);else return D.lanes=D.childLanes=536870912,wh(M,D,ge!==null?ge.baseLanes|Y:Y,Y)}else ge!==null?(Cl(D,ge.cachePool),Sp(D,ge),Jn(),D.memoizedState=null):(M!==null&&Cl(D,null),xu(),Jn());return gi(M,D,ue,Y),D.child}function wh(M,D,Y,se){var ue=fu();return ue=ue===null?null:{parent:di._currentValue,pool:ue},D.memoizedState={baseLanes:Y,cachePool:ue},M!==null&&Cl(D,null),xu(),uh(D),M!==null&&ga(M,D,se,!0),null}function Vl(M,D){var Y=D.ref;if(Y===null)M!==null&&M.ref!==null&&(D.flags|=4194816);else{if(typeof Y!="function"&&typeof Y!="object")throw Error(w(284));(M===null||M.ref!==Y)&&(D.flags|=4194816)}}function Uu(M,D,Y,se,ue){return zo(D),Y=Eu(M,D,Y,se,void 0,ue),se=wu(),M!==null&&!hi?(Ru(M,D,ue),_n(M,D,ue)):(Nr&&se&&su(D),D.flags|=1,gi(M,D,Y,ue),D.child)}function Rh(M,D,Y,se,ue,ge){return zo(D),D.updateQueue=null,Y=Ep(D,se,Y,ue),Cp(M),se=wu(),M!==null&&!hi?(Ru(M,D,ge),_n(M,D,ge)):(Nr&&se&&su(D),D.flags|=1,gi(M,D,Y,ge),D.child)}function Th(M,D,Y,se,ue){if(zo(D),D.stateNode===null){var ge=Cs,we=Y.contextType;typeof we=="object"&&we!==null&&(ge=Si(we)),ge=new Y(se,ge),D.memoizedState=ge.state!==null&&ge.state!==void 0?ge.state:null,ge.updater=Vu,D.stateNode=ge,ge._reactInternals=D,ge=D.stateNode,ge.props=se,ge.state=D.memoizedState,ge.refs={},gu(D),we=Y.contextType,ge.context=typeof we=="object"&&we!==null?Si(we):Cs,ge.state=D.memoizedState,we=Y.getDerivedStateFromProps,typeof we=="function"&&(Fu(D,Y,we,se),ge.state=D.memoizedState),typeof Y.getDerivedStateFromProps=="function"||typeof ge.getSnapshotBeforeUpdate=="function"||typeof ge.UNSAFE_componentWillMount!="function"&&typeof ge.componentWillMount!="function"||(we=ge.state,typeof ge.componentWillMount=="function"&&ge.componentWillMount(),typeof ge.UNSAFE_componentWillMount=="function"&&ge.UNSAFE_componentWillMount(),we!==ge.state&&Vu.enqueueReplaceState(ge,ge.state,null),Ea(D,se,ge,ue),Ca(),ge.state=D.memoizedState),typeof ge.componentDidMount=="function"&&(D.flags|=4194308),se=!0}else if(M===null){ge=D.stateNode;var Me=D.memoizedProps,qe=Go(Y,Me);ge.props=qe;var St=ge.context,Zt=Y.contextType;we=Cs,typeof Zt=="object"&&Zt!==null&&(we=Si(Zt));var or=Y.getDerivedStateFromProps;Zt=typeof or=="function"||typeof ge.getSnapshotBeforeUpdate=="function",Me=D.pendingProps!==Me,Zt||typeof ge.UNSAFE_componentWillReceiveProps!="function"&&typeof ge.componentWillReceiveProps!="function"||(Me||St!==we)&&ph(D,ge,se,we),zn=!1;var Rt=D.memoizedState;ge.state=Rt,Ea(D,se,ge,ue),Ca(),St=D.memoizedState,Me||Rt!==St||zn?(typeof or=="function"&&(Fu(D,Y,or,se),St=D.memoizedState),(qe=zn||dh(D,Y,qe,se,Rt,St,we))?(Zt||typeof ge.UNSAFE_componentWillMount!="function"&&typeof ge.componentWillMount!="function"||(typeof ge.componentWillMount=="function"&&ge.componentWillMount(),typeof ge.UNSAFE_componentWillMount=="function"&&ge.UNSAFE_componentWillMount()),typeof ge.componentDidMount=="function"&&(D.flags|=4194308)):(typeof ge.componentDidMount=="function"&&(D.flags|=4194308),D.memoizedProps=se,D.memoizedState=St),ge.props=se,ge.state=St,ge.context=we,se=qe):(typeof ge.componentDidMount=="function"&&(D.flags|=4194308),se=!1)}else{ge=D.stateNode,vu(M,D),we=D.memoizedProps,Zt=Go(Y,we),ge.props=Zt,or=D.pendingProps,Rt=ge.context,St=Y.contextType,qe=Cs,typeof St=="object"&&St!==null&&(qe=Si(St)),Me=Y.getDerivedStateFromProps,(St=typeof Me=="function"||typeof ge.getSnapshotBeforeUpdate=="function")||typeof ge.UNSAFE_componentWillReceiveProps!="function"&&typeof ge.componentWillReceiveProps!="function"||(we!==or||Rt!==qe)&&ph(D,ge,se,qe),zn=!1,Rt=D.memoizedState,ge.state=Rt,Ea(D,se,ge,ue),Ca();var Tt=D.memoizedState;we!==or||Rt!==Tt||zn||M!==null&&M.dependencies!==null&&xl(M.dependencies)?(typeof Me=="function"&&(Fu(D,Y,Me,se),Tt=D.memoizedState),(Zt=zn||dh(D,Y,Zt,se,Rt,Tt,qe)||M!==null&&M.dependencies!==null&&xl(M.dependencies))?(St||typeof ge.UNSAFE_componentWillUpdate!="function"&&typeof ge.componentWillUpdate!="function"||(typeof ge.componentWillUpdate=="function"&&ge.componentWillUpdate(se,Tt,qe),typeof ge.UNSAFE_componentWillUpdate=="function"&&ge.UNSAFE_componentWillUpdate(se,Tt,qe)),typeof ge.componentDidUpdate=="function"&&(D.flags|=4),typeof ge.getSnapshotBeforeUpdate=="function"&&(D.flags|=1024)):(typeof ge.componentDidUpdate!="function"||we===M.memoizedProps&&Rt===M.memoizedState||(D.flags|=4),typeof ge.getSnapshotBeforeUpdate!="function"||we===M.memoizedProps&&Rt===M.memoizedState||(D.flags|=1024),D.memoizedProps=se,D.memoizedState=Tt),ge.props=se,ge.state=Tt,ge.context=qe,se=Zt):(typeof ge.componentDidUpdate!="function"||we===M.memoizedProps&&Rt===M.memoizedState||(D.flags|=4),typeof ge.getSnapshotBeforeUpdate!="function"||we===M.memoizedProps&&Rt===M.memoizedState||(D.flags|=1024),se=!1)}return ge=se,Vl(M,D),se=(D.flags&128)!==0,ge||se?(ge=D.stateNode,Y=se&&typeof Y.getDerivedStateFromError!="function"?null:ge.render(),D.flags|=1,M!==null&&se?(D.child=Os(D,M.child,null,ue),D.child=Os(D,null,Y,ue)):gi(M,D,Y,ue),D.memoizedState=ge.state,M=D.child):M=_n(M,D,ue),M}function kh(M,D,Y,se){return fa(),D.flags|=256,gi(M,D,Y,se),D.child}var qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $u(M){return{baseLanes:M,cachePool:hp()}}function zu(M,D,Y){return M=M!==null?M.childLanes&~Y:0,D&&(M|=Hi),M}function _h(M,D,Y){var se=D.pendingProps,ue=!1,ge=(D.flags&128)!==0,we;if((we=ge)||(we=M!==null&&M.memoizedState===null?!1:(pi.current&2)!==0),we&&(ue=!0,D.flags&=-129),we=(D.flags&32)!==0,D.flags&=-33,M===null){if(Nr){if(ue?Kn(D):Jn(),Nr){var Me=ti,qe;if(qe=Me){e:{for(qe=Me,Me=dn;qe.nodeType!==8;){if(!Me){Me=null;break e}if(qe=en(qe.nextSibling),qe===null){Me=null;break e}}Me=qe}Me!==null?(D.memoizedState={dehydrated:Me,treeContext:Vo!==null?{id:Cn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},qe=Ii(18,null,null,0),qe.stateNode=Me,qe.return=D,D.child=qe,Ci=D,ti=null,qe=!0):qe=!1}qe||qo(D)}if(Me=D.memoizedState,Me!==null&&(Me=Me.dehydrated,Me!==null))return kd(Me)?D.lanes=32:D.lanes=536870912,null;kn(D)}return Me=se.children,se=se.fallback,ue?(Jn(),ue=D.mode,Me=Nl({mode:"hidden",children:Me},ue),se=Fo(se,ue,Y,null),Me.return=D,se.return=D,Me.sibling=se,D.child=Me,ue=D.child,ue.memoizedState=$u(Y),ue.childLanes=zu(M,we,Y),D.memoizedState=qu,se):(Kn(D),Hu(D,Me))}if(qe=M.memoizedState,qe!==null&&(Me=qe.dehydrated,Me!==null)){if(ge)D.flags&256?(Kn(D),D.flags&=-257,D=Wu(M,D,Y)):D.memoizedState!==null?(Jn(),D.child=M.child,D.flags|=128,D=null):(Jn(),ue=se.fallback,Me=D.mode,se=Nl({mode:"visible",children:se.children},Me),ue=Fo(ue,Me,Y,null),ue.flags|=2,se.return=D,ue.return=D,se.sibling=ue,D.child=se,Os(D,M.child,null,Y),se=D.child,se.memoizedState=$u(Y),se.childLanes=zu(M,we,Y),D.memoizedState=qu,D=ue);else if(Kn(D),kd(Me)){if(we=Me.nextSibling&&Me.nextSibling.dataset,we)var St=we.dgst;we=St,se=Error(w(419)),se.stack="",se.digest=we,ma({value:se,source:null,stack:null}),D=Wu(M,D,Y)}else if(hi||ga(M,D,Y,!1),we=(Y&M.childLanes)!==0,hi||we){if(we=Jr,we!==null&&(se=Y&-Y,se=(se&42)!==0?1:Xe(se),se=(se&(we.suspendedLanes|Y))!==0?0:se,se!==0&&se!==qe.retryLane))throw qe.retryLane=se,Ss(M,se),Li(we,M,se),yh;Me.data==="$?"||ud(),D=Wu(M,D,Y)}else Me.data==="$?"?(D.flags|=192,D.child=M.child,D=null):(M=qe.treeContext,ti=en(Me.nextSibling),Ci=D,Nr=!0,Uo=null,dn=!1,M!==null&&(qi[$i++]=Cn,qi[$i++]=En,qi[$i++]=Vo,Cn=M.id,En=M.overflow,Vo=D),D=Hu(D,se.children),D.flags|=4096);return D}return ue?(Jn(),ue=se.fallback,Me=D.mode,qe=M.child,St=qe.sibling,se=Sn(qe,{mode:"hidden",children:se.children}),se.subtreeFlags=qe.subtreeFlags&65011712,St!==null?ue=Sn(St,ue):(ue=Fo(ue,Me,Y,null),ue.flags|=2),ue.return=D,se.return=D,se.sibling=ue,D.child=se,se=ue,ue=D.child,Me=M.child.memoizedState,Me===null?Me=$u(Y):(qe=Me.cachePool,qe!==null?(St=di._currentValue,qe=qe.parent!==St?{parent:St,pool:St}:qe):qe=hp(),Me={baseLanes:Me.baseLanes|Y,cachePool:qe}),ue.memoizedState=Me,ue.childLanes=zu(M,we,Y),D.memoizedState=qu,se):(Kn(D),Y=M.child,M=Y.sibling,Y=Sn(Y,{mode:"visible",children:se.children}),Y.return=D,Y.sibling=null,M!==null&&(we=D.deletions,we===null?(D.deletions=[M],D.flags|=16):we.push(M)),D.child=Y,D.memoizedState=null,Y)}function Hu(M,D){return D=Nl({mode:"visible",children:D},M.mode),D.return=M,M.child=D}function Nl(M,D){return M=Ii(22,M,null,D),M.lanes=0,M.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},M}function Wu(M,D,Y){return Os(D,M.child,null,Y),M=Hu(D,D.pendingProps.children),M.flags|=2,D.memoizedState=null,M}function Ah(M,D,Y){M.lanes|=D;var se=M.alternate;se!==null&&(se.lanes|=D),uu(M.return,D,Y)}function Gu(M,D,Y,se,ue){var ge=M.memoizedState;ge===null?M.memoizedState={isBackwards:D,rendering:null,renderingStartTime:0,last:se,tail:Y,tailMode:ue}:(ge.isBackwards=D,ge.rendering=null,ge.renderingStartTime=0,ge.last=se,ge.tail=Y,ge.tailMode=ue)}function Ph(M,D,Y){var se=D.pendingProps,ue=se.revealOrder,ge=se.tail;if(gi(M,D,se.children,Y),se=pi.current,(se&2)!==0)se=se&1|2,D.flags|=128;else{if(M!==null&&(M.flags&128)!==0)e:for(M=D.child;M!==null;){if(M.tag===13)M.memoizedState!==null&&Ah(M,Y,D);else if(M.tag===19)Ah(M,Y,D);else if(M.child!==null){M.child.return=M,M=M.child;continue}if(M===D)break e;for(;M.sibling===null;){if(M.return===null||M.return===D)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}se&=1}switch(je(pi,se),ue){case"forwards":for(Y=D.child,ue=null;Y!==null;)M=Y.alternate,M!==null&&jl(M)===null&&(ue=Y),Y=Y.sibling;Y=ue,Y===null?(ue=D.child,D.child=null):(ue=Y.sibling,Y.sibling=null),Gu(D,!1,ue,Y,ge);break;case"backwards":for(Y=null,ue=D.child,D.child=null;ue!==null;){if(M=ue.alternate,M!==null&&jl(M)===null){D.child=ue;break}M=ue.sibling,ue.sibling=Y,Y=ue,ue=M}Gu(D,!0,Y,null,ge);break;case"together":Gu(D,!1,null,null,void 0);break;default:D.memoizedState=null}return D.child}function _n(M,D,Y){if(M!==null&&(D.dependencies=M.dependencies),eo|=D.lanes,(Y&D.childLanes)===0)if(M!==null){if(ga(M,D,Y,!1),(Y&D.childLanes)===0)return null}else return null;if(M!==null&&D.child!==M.child)throw Error(w(153));if(D.child!==null){for(M=D.child,Y=Sn(M,M.pendingProps),D.child=Y,Y.return=D;M.sibling!==null;)M=M.sibling,Y=Y.sibling=Sn(M,M.pendingProps),Y.return=D;Y.sibling=null}return D.child}function Ku(M,D){return(M.lanes&D)!==0?!0:(M=M.dependencies,!!(M!==null&&xl(M)))}function Fm(M,D,Y){switch(D.tag){case 3:Kt(D,D.stateNode.containerInfo),$n(D,di,M.memoizedState.cache),fa();break;case 27:case 5:$t(D);break;case 4:Kt(D,D.stateNode.containerInfo);break;case 10:$n(D,D.type,D.memoizedProps.value);break;case 13:var se=D.memoizedState;if(se!==null)return se.dehydrated!==null?(Kn(D),D.flags|=128,null):(Y&D.child.childLanes)!==0?_h(M,D,Y):(Kn(D),M=_n(M,D,Y),M!==null?M.sibling:null);Kn(D);break;case 19:var ue=(M.flags&128)!==0;if(se=(Y&D.childLanes)!==0,se||(ga(M,D,Y,!1),se=(Y&D.childLanes)!==0),ue){if(se)return Ph(M,D,Y);D.flags|=128}if(ue=D.memoizedState,ue!==null&&(ue.rendering=null,ue.tail=null,ue.lastEffect=null),je(pi,pi.current),se)break;return null;case 22:case 23:return D.lanes=0,Eh(M,D,Y);case 24:$n(D,di,M.memoizedState.cache)}return _n(M,D,Y)}function Mh(M,D,Y){if(M!==null)if(M.memoizedProps!==D.pendingProps)hi=!0;else{if(!Ku(M,Y)&&(D.flags&128)===0)return hi=!1,Fm(M,D,Y);hi=(M.flags&131072)!==0}else hi=!1,Nr&&(D.flags&1048576)!==0&&sp(D,yl,D.index);switch(D.lanes=0,D.tag){case 16:e:{M=D.pendingProps;var se=D.elementType,ue=se._init;if(se=ue(se._payload),D.type=se,typeof se=="function")iu(se)?(M=Go(se,M),D.tag=1,D=Th(null,D,se,M,Y)):(D.tag=0,D=Uu(null,D,se,M,Y));else{if(se!=null){if(ue=se.$$typeof,ue===ce){D.tag=11,D=xh(null,D,se,M,Y);break e}else if(ue===me){D.tag=14,D=Sh(null,D,se,M,Y);break e}}throw D=Ae(se)||se,Error(w(306,D,""))}}return D;case 0:return Uu(M,D,D.type,D.pendingProps,Y);case 1:return se=D.type,ue=Go(se,D.pendingProps),Th(M,D,se,ue,Y);case 3:e:{if(Kt(D,D.stateNode.containerInfo),M===null)throw Error(w(387));se=D.pendingProps;var ge=D.memoizedState;ue=ge.element,vu(M,D),Ea(D,se,null,Y);var we=D.memoizedState;if(se=we.cache,$n(D,di,se),se!==ge.cache&&du(D,[di],Y,!0),Ca(),se=we.element,ge.isDehydrated)if(ge={element:se,isDehydrated:!1,cache:we.cache},D.updateQueue.baseState=ge,D.memoizedState=ge,D.flags&256){D=kh(M,D,se,Y);break e}else if(se!==ue){ue=Ni(Error(w(424)),D),ma(ue),D=kh(M,D,se,Y);break e}else{switch(M=D.stateNode.containerInfo,M.nodeType){case 9:M=M.body;break;default:M=M.nodeName==="HTML"?M.ownerDocument.body:M}for(ti=en(M.firstChild),Ci=D,Nr=!0,Uo=null,dn=!0,Y=ch(D,null,se,Y),D.child=Y;Y;)Y.flags=Y.flags&-3|4096,Y=Y.sibling}else{if(fa(),se===ue){D=_n(M,D,Y);break e}gi(M,D,se,Y)}D=D.child}return D;case 26:return Vl(M,D),M===null?(Y=jf(D.type,null,D.pendingProps,null))?D.memoizedState=Y:Nr||(Y=D.type,M=D.pendingProps,se=ec(Ve.current).createElement(Y),se[fr]=D,se[dr]=M,bi(se,Y,M),Zr(se),D.stateNode=se):D.memoizedState=jf(D.type,M.memoizedProps,D.pendingProps,M.memoizedState),null;case 27:return $t(D),M===null&&Nr&&(se=D.stateNode=Of(D.type,D.pendingProps,Ve.current),Ci=D,dn=!0,ue=ti,uo(D.type)?(_d=ue,ti=en(se.firstChild)):ti=ue),gi(M,D,D.pendingProps.children,Y),Vl(M,D),M===null&&(D.flags|=4194304),D.child;case 5:return M===null&&Nr&&((ue=se=ti)&&(se=pg(se,D.type,D.pendingProps,dn),se!==null?(D.stateNode=se,Ci=D,ti=en(se.firstChild),dn=!1,ue=!0):ue=!1),ue||qo(D)),$t(D),ue=D.type,ge=D.pendingProps,we=M!==null?M.memoizedProps:null,se=ge.children,wd(ue,ge)?se=null:we!==null&&wd(ue,we)&&(D.flags|=32),D.memoizedState!==null&&(ue=Eu(M,D,Pm,null,null,Y),Wa._currentValue=ue),Vl(M,D),gi(M,D,se,Y),D.child;case 6:return M===null&&Nr&&((M=Y=ti)&&(Y=hg(Y,D.pendingProps,dn),Y!==null?(D.stateNode=Y,Ci=D,ti=null,M=!0):M=!1),M||qo(D)),null;case 13:return _h(M,D,Y);case 4:return Kt(D,D.stateNode.containerInfo),se=D.pendingProps,M===null?D.child=Os(D,null,se,Y):gi(M,D,se,Y),D.child;case 11:return xh(M,D,D.type,D.pendingProps,Y);case 7:return gi(M,D,D.pendingProps,Y),D.child;case 8:return gi(M,D,D.pendingProps.children,Y),D.child;case 12:return gi(M,D,D.pendingProps.children,Y),D.child;case 10:return se=D.pendingProps,$n(D,D.type,se.value),gi(M,D,se.children,Y),D.child;case 9:return ue=D.type._context,se=D.pendingProps.children,zo(D),ue=Si(ue),se=se(ue),D.flags|=1,gi(M,D,se,Y),D.child;case 14:return Sh(M,D,D.type,D.pendingProps,Y);case 15:return Ch(M,D,D.type,D.pendingProps,Y);case 19:return Ph(M,D,Y);case 31:return se=D.pendingProps,Y=D.mode,se={mode:se.mode,children:se.children},M===null?(Y=Nl(se,Y),Y.ref=D.ref,D.child=Y,Y.return=D,D=Y):(Y=Sn(M.child,se),Y.ref=D.ref,D.child=Y,Y.return=D,D=Y),D;case 22:return Eh(M,D,Y);case 24:return zo(D),se=Si(di),M===null?(ue=fu(),ue===null&&(ue=Jr,ge=pu(),ue.pooledCache=ge,ge.refCount++,ge!==null&&(ue.pooledCacheLanes|=Y),ue=ge),D.memoizedState={parent:se,cache:ue},gu(D),$n(D,di,ue)):((M.lanes&Y)!==0&&(vu(M,D),Ea(D,null,null,Y),Ca()),ue=M.memoizedState,ge=D.memoizedState,ue.parent!==se?(ue={parent:se,cache:se},D.memoizedState=ue,D.lanes===0&&(D.memoizedState=D.updateQueue.baseState=ue),$n(D,di,se)):(se=ge.cache,$n(D,di,se),se!==ue.cache&&du(D,[di],Y,!0))),gi(M,D,D.pendingProps.children,Y),D.child;case 29:throw D.pendingProps}throw Error(w(156,D.tag))}function An(M){M.flags|=4}function Ih(M,D){if(D.type!=="stylesheet"||(D.state.loading&4)!==0)M.flags&=-16777217;else if(M.flags|=16777216,!Uf(D)){if(D=zi.current,D!==null&&((Lr&4194048)===Lr?pn!==null:(Lr&62914560)!==Lr&&(Lr&536870912)===0||D!==pn))throw xa=mu,fp;M.flags|=8192}}function Ul(M,D){D!==null&&(M.flags|=4),M.flags&16384&&(D=M.tag!==22?nr():536870912,M.lanes|=D,Ls|=D)}function Ma(M,D){if(!Nr)switch(M.tailMode){case"hidden":D=M.tail;for(var Y=null;D!==null;)D.alternate!==null&&(Y=D),D=D.sibling;Y===null?M.tail=null:Y.sibling=null;break;case"collapsed":Y=M.tail;for(var se=null;Y!==null;)Y.alternate!==null&&(se=Y),Y=Y.sibling;se===null?D||M.tail===null?M.tail=null:M.tail.sibling=null:se.sibling=null}}function Qr(M){var D=M.alternate!==null&&M.alternate.child===M.child,Y=0,se=0;if(D)for(var ue=M.child;ue!==null;)Y|=ue.lanes|ue.childLanes,se|=ue.subtreeFlags&65011712,se|=ue.flags&65011712,ue.return=M,ue=ue.sibling;else for(ue=M.child;ue!==null;)Y|=ue.lanes|ue.childLanes,se|=ue.subtreeFlags,se|=ue.flags,ue.return=M,ue=ue.sibling;return M.subtreeFlags|=se,M.childLanes=Y,D}function Vm(M,D,Y){var se=D.pendingProps;switch(au(D),D.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qr(D),null;case 1:return Qr(D),null;case 3:return Y=D.stateNode,se=null,M!==null&&(se=M.memoizedState.cache),D.memoizedState.cache!==se&&(D.flags|=2048),Rn(di),ir(),Y.pendingContext&&(Y.context=Y.pendingContext,Y.pendingContext=null),(M===null||M.child===null)&&(ha(D)?An(D):M===null||M.memoizedState.isDehydrated&&(D.flags&256)===0||(D.flags|=1024,cp())),Qr(D),null;case 26:return Y=D.memoizedState,M===null?(An(D),Y!==null?(Qr(D),Ih(D,Y)):(Qr(D),D.flags&=-16777217)):Y?Y!==M.memoizedState?(An(D),Qr(D),Ih(D,Y)):(Qr(D),D.flags&=-16777217):(M.memoizedProps!==se&&An(D),Qr(D),D.flags&=-16777217),null;case 27:tr(D),Y=Ve.current;var ue=D.type;if(M!==null&&D.stateNode!=null)M.memoizedProps!==se&&An(D);else{if(!se){if(D.stateNode===null)throw Error(w(166));return Qr(D),null}M=Ne.current,ha(D)?ap(D):(M=Of(ue,se,Y),D.stateNode=M,An(D))}return Qr(D),null;case 5:if(tr(D),Y=D.type,M!==null&&D.stateNode!=null)M.memoizedProps!==se&&An(D);else{if(!se){if(D.stateNode===null)throw Error(w(166));return Qr(D),null}if(M=Ne.current,ha(D))ap(D);else{switch(ue=ec(Ve.current),M){case 1:M=ue.createElementNS("http://www.w3.org/2000/svg",Y);break;case 2:M=ue.createElementNS("http://www.w3.org/1998/Math/MathML",Y);break;default:switch(Y){case"svg":M=ue.createElementNS("http://www.w3.org/2000/svg",Y);break;case"math":M=ue.createElementNS("http://www.w3.org/1998/Math/MathML",Y);break;case"script":M=ue.createElement("div"),M.innerHTML="<script><\/script>",M=M.removeChild(M.firstChild);break;case"select":M=typeof se.is=="string"?ue.createElement("select",{is:se.is}):ue.createElement("select"),se.multiple?M.multiple=!0:se.size&&(M.size=se.size);break;default:M=typeof se.is=="string"?ue.createElement(Y,{is:se.is}):ue.createElement(Y)}}M[fr]=D,M[dr]=se;e:for(ue=D.child;ue!==null;){if(ue.tag===5||ue.tag===6)M.appendChild(ue.stateNode);else if(ue.tag!==4&&ue.tag!==27&&ue.child!==null){ue.child.return=ue,ue=ue.child;continue}if(ue===D)break e;for(;ue.sibling===null;){if(ue.return===null||ue.return===D)break e;ue=ue.return}ue.sibling.return=ue.return,ue=ue.sibling}D.stateNode=M;e:switch(bi(M,Y,se),Y){case"button":case"input":case"select":case"textarea":M=!!se.autoFocus;break e;case"img":M=!0;break e;default:M=!1}M&&An(D)}}return Qr(D),D.flags&=-16777217,null;case 6:if(M&&D.stateNode!=null)M.memoizedProps!==se&&An(D);else{if(typeof se!="string"&&D.stateNode===null)throw Error(w(166));if(M=Ve.current,ha(D)){if(M=D.stateNode,Y=D.memoizedProps,se=null,ue=Ci,ue!==null)switch(ue.tag){case 27:case 5:se=ue.memoizedProps}M[fr]=D,M=!!(M.nodeValue===Y||se!==null&&se.suppressHydrationWarning===!0||Tf(M.nodeValue,Y)),M||qo(D)}else M=ec(M).createTextNode(se),M[fr]=D,D.stateNode=M}return Qr(D),null;case 13:if(se=D.memoizedState,M===null||M.memoizedState!==null&&M.memoizedState.dehydrated!==null){if(ue=ha(D),se!==null&&se.dehydrated!==null){if(M===null){if(!ue)throw Error(w(318));if(ue=D.memoizedState,ue=ue!==null?ue.dehydrated:null,!ue)throw Error(w(317));ue[fr]=D}else fa(),(D.flags&128)===0&&(D.memoizedState=null),D.flags|=4;Qr(D),ue=!1}else ue=cp(),M!==null&&M.memoizedState!==null&&(M.memoizedState.hydrationErrors=ue),ue=!0;if(!ue)return D.flags&256?(kn(D),D):(kn(D),null)}if(kn(D),(D.flags&128)!==0)return D.lanes=Y,D;if(Y=se!==null,M=M!==null&&M.memoizedState!==null,Y){se=D.child,ue=null,se.alternate!==null&&se.alternate.memoizedState!==null&&se.alternate.memoizedState.cachePool!==null&&(ue=se.alternate.memoizedState.cachePool.pool);var ge=null;se.memoizedState!==null&&se.memoizedState.cachePool!==null&&(ge=se.memoizedState.cachePool.pool),ge!==ue&&(se.flags|=2048)}return Y!==M&&Y&&(D.child.flags|=8192),Ul(D,D.updateQueue),Qr(D),null;case 4:return ir(),M===null&&yd(D.stateNode.containerInfo),Qr(D),null;case 10:return Rn(D.type),Qr(D),null;case 19:if(He(pi),ue=D.memoizedState,ue===null)return Qr(D),null;if(se=(D.flags&128)!==0,ge=ue.rendering,ge===null)if(se)Ma(ue,!1);else{if(ri!==0||M!==null&&(M.flags&128)!==0)for(M=D.child;M!==null;){if(ge=jl(M),ge!==null){for(D.flags|=128,Ma(ue,!1),M=ge.updateQueue,D.updateQueue=M,Ul(D,M),D.subtreeFlags=0,M=Y,Y=D.child;Y!==null;)op(Y,M),Y=Y.sibling;return je(pi,pi.current&1|2),D.child}M=M.sibling}ue.tail!==null&&ur()>zl&&(D.flags|=128,se=!0,Ma(ue,!1),D.lanes=4194304)}else{if(!se)if(M=jl(ge),M!==null){if(D.flags|=128,se=!0,M=M.updateQueue,D.updateQueue=M,Ul(D,M),Ma(ue,!0),ue.tail===null&&ue.tailMode==="hidden"&&!ge.alternate&&!Nr)return Qr(D),null}else 2*ur()-ue.renderingStartTime>zl&&Y!==536870912&&(D.flags|=128,se=!0,Ma(ue,!1),D.lanes=4194304);ue.isBackwards?(ge.sibling=D.child,D.child=ge):(M=ue.last,M!==null?M.sibling=ge:D.child=ge,ue.last=ge)}return ue.tail!==null?(D=ue.tail,ue.rendering=D,ue.tail=D.sibling,ue.renderingStartTime=ur(),D.sibling=null,M=pi.current,je(pi,se?M&1|2:M&1),D):(Qr(D),null);case 22:case 23:return kn(D),Su(),se=D.memoizedState!==null,M!==null?M.memoizedState!==null!==se&&(D.flags|=8192):se&&(D.flags|=8192),se?(Y&536870912)!==0&&(D.flags&128)===0&&(Qr(D),D.subtreeFlags&6&&(D.flags|=8192)):Qr(D),Y=D.updateQueue,Y!==null&&Ul(D,Y.retryQueue),Y=null,M!==null&&M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(Y=M.memoizedState.cachePool.pool),se=null,D.memoizedState!==null&&D.memoizedState.cachePool!==null&&(se=D.memoizedState.cachePool.pool),se!==Y&&(D.flags|=2048),M!==null&&He(Ho),null;case 24:return Y=null,M!==null&&(Y=M.memoizedState.cache),D.memoizedState.cache!==Y&&(D.flags|=2048),Rn(di),Qr(D),null;case 25:return null;case 30:return null}throw Error(w(156,D.tag))}function Nm(M,D){switch(au(D),D.tag){case 1:return M=D.flags,M&65536?(D.flags=M&-65537|128,D):null;case 3:return Rn(di),ir(),M=D.flags,(M&65536)!==0&&(M&128)===0?(D.flags=M&-65537|128,D):null;case 26:case 27:case 5:return tr(D),null;case 13:if(kn(D),M=D.memoizedState,M!==null&&M.dehydrated!==null){if(D.alternate===null)throw Error(w(340));fa()}return M=D.flags,M&65536?(D.flags=M&-65537|128,D):null;case 19:return He(pi),null;case 4:return ir(),null;case 10:return Rn(D.type),null;case 22:case 23:return kn(D),Su(),M!==null&&He(Ho),M=D.flags,M&65536?(D.flags=M&-65537|128,D):null;case 24:return Rn(di),null;case 25:return null;default:return null}}function Oh(M,D){switch(au(D),D.tag){case 3:Rn(di),ir();break;case 26:case 27:case 5:tr(D);break;case 4:ir();break;case 13:kn(D);break;case 19:He(pi);break;case 10:Rn(D.type);break;case 22:case 23:kn(D),Su(),M!==null&&He(Ho);break;case 24:Rn(di)}}function Ia(M,D){try{var Y=D.updateQueue,se=Y!==null?Y.lastEffect:null;if(se!==null){var ue=se.next;Y=ue;do{if((Y.tag&M)===M){se=void 0;var ge=Y.create,we=Y.inst;se=ge(),we.destroy=se}Y=Y.next}while(Y!==ue)}}catch(Me){Gr(D,D.return,Me)}}function Yn(M,D,Y){try{var se=D.updateQueue,ue=se!==null?se.lastEffect:null;if(ue!==null){var ge=ue.next;se=ge;do{if((se.tag&M)===M){var we=se.inst,Me=we.destroy;if(Me!==void 0){we.destroy=void 0,ue=D;var qe=Y,St=Me;try{St()}catch(Zt){Gr(ue,qe,Zt)}}}se=se.next}while(se!==ge)}}catch(Zt){Gr(D,D.return,Zt)}}function Dh(M){var D=M.updateQueue;if(D!==null){var Y=M.stateNode;try{xp(D,Y)}catch(se){Gr(M,M.return,se)}}}function Bh(M,D,Y){Y.props=Go(M.type,M.memoizedProps),Y.state=M.memoizedState;try{Y.componentWillUnmount()}catch(se){Gr(M,D,se)}}function Oa(M,D){try{var Y=M.ref;if(Y!==null){switch(M.tag){case 26:case 27:case 5:var se=M.stateNode;break;case 30:se=M.stateNode;break;default:se=M.stateNode}typeof Y=="function"?M.refCleanup=Y(se):Y.current=se}}catch(ue){Gr(M,D,ue)}}function hn(M,D){var Y=M.ref,se=M.refCleanup;if(Y!==null)if(typeof se=="function")try{se()}catch(ue){Gr(M,D,ue)}finally{M.refCleanup=null,M=M.alternate,M!=null&&(M.refCleanup=null)}else if(typeof Y=="function")try{Y(null)}catch(ue){Gr(M,D,ue)}else Y.current=null}function jh(M){var D=M.type,Y=M.memoizedProps,se=M.stateNode;try{e:switch(D){case"button":case"input":case"select":case"textarea":Y.autoFocus&&se.focus();break e;case"img":Y.src?se.src=Y.src:Y.srcSet&&(se.srcset=Y.srcSet)}}catch(ue){Gr(M,M.return,ue)}}function Ju(M,D,Y){try{var se=M.stateNode;ag(se,M.type,Y,D),se[dr]=D}catch(ue){Gr(M,M.return,ue)}}function Lh(M){return M.tag===5||M.tag===3||M.tag===26||M.tag===27&&uo(M.type)||M.tag===4}function Yu(M){e:for(;;){for(;M.sibling===null;){if(M.return===null||Lh(M.return))return null;M=M.return}for(M.sibling.return=M.return,M=M.sibling;M.tag!==5&&M.tag!==6&&M.tag!==18;){if(M.tag===27&&uo(M.type)||M.flags&2||M.child===null||M.tag===4)continue e;M.child.return=M,M=M.child}if(!(M.flags&2))return M.stateNode}}function Xu(M,D,Y){var se=M.tag;if(se===5||se===6)M=M.stateNode,D?(Y.nodeType===9?Y.body:Y.nodeName==="HTML"?Y.ownerDocument.body:Y).insertBefore(M,D):(D=Y.nodeType===9?Y.body:Y.nodeName==="HTML"?Y.ownerDocument.body:Y,D.appendChild(M),Y=Y._reactRootContainer,Y!=null||D.onclick!==null||(D.onclick=Ql));else if(se!==4&&(se===27&&uo(M.type)&&(Y=M.stateNode,D=null),M=M.child,M!==null))for(Xu(M,D,Y),M=M.sibling;M!==null;)Xu(M,D,Y),M=M.sibling}function ql(M,D,Y){var se=M.tag;if(se===5||se===6)M=M.stateNode,D?Y.insertBefore(M,D):Y.appendChild(M);else if(se!==4&&(se===27&&uo(M.type)&&(Y=M.stateNode),M=M.child,M!==null))for(ql(M,D,Y),M=M.sibling;M!==null;)ql(M,D,Y),M=M.sibling}function Fh(M){var D=M.stateNode,Y=M.memoizedProps;try{for(var se=M.type,ue=D.attributes;ue.length;)D.removeAttributeNode(ue[0]);bi(D,se,Y),D[fr]=M,D[dr]=Y}catch(ge){Gr(M,M.return,ge)}}var Pn=!1,oi=!1,Zu=!1,Vh=typeof WeakSet=="function"?WeakSet:Set,fi=null;function Um(M,D){if(M=M.containerInfo,Cd=sc,M=Jd(M),Yc(M)){if("selectionStart"in M)var Y={start:M.selectionStart,end:M.selectionEnd};else e:{Y=(Y=M.ownerDocument)&&Y.defaultView||window;var se=Y.getSelection&&Y.getSelection();if(se&&se.rangeCount!==0){Y=se.anchorNode;var ue=se.anchorOffset,ge=se.focusNode;se=se.focusOffset;try{Y.nodeType,ge.nodeType}catch{Y=null;break e}var we=0,Me=-1,qe=-1,St=0,Zt=0,or=M,Rt=null;t:for(;;){for(var Tt;or!==Y||ue!==0&&or.nodeType!==3||(Me=we+ue),or!==ge||se!==0&&or.nodeType!==3||(qe=we+se),or.nodeType===3&&(we+=or.nodeValue.length),(Tt=or.firstChild)!==null;)Rt=or,or=Tt;for(;;){if(or===M)break t;if(Rt===Y&&++St===ue&&(Me=we),Rt===ge&&++Zt===se&&(qe=we),(Tt=or.nextSibling)!==null)break;or=Rt,Rt=or.parentNode}or=Tt}Y=Me===-1||qe===-1?null:{start:Me,end:qe}}else Y=null}Y=Y||{start:0,end:0}}else Y=null;for(Ed={focusedElem:M,selectionRange:Y},sc=!1,fi=D;fi!==null;)if(D=fi,M=D.child,(D.subtreeFlags&1024)!==0&&M!==null)M.return=D,fi=M;else for(;fi!==null;){switch(D=fi,ge=D.alternate,M=D.flags,D.tag){case 0:break;case 11:case 15:break;case 1:if((M&1024)!==0&&ge!==null){M=void 0,Y=D,ue=ge.memoizedProps,ge=ge.memoizedState,se=Y.stateNode;try{var _r=Go(Y.type,ue,Y.elementType===Y.type);M=se.getSnapshotBeforeUpdate(_r,ge),se.__reactInternalSnapshotBeforeUpdate=M}catch(Tr){Gr(Y,Y.return,Tr)}}break;case 3:if((M&1024)!==0){if(M=D.stateNode.containerInfo,Y=M.nodeType,Y===9)Td(M);else if(Y===1)switch(M.nodeName){case"HEAD":case"HTML":case"BODY":Td(M);break;default:M.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((M&1024)!==0)throw Error(w(163))}if(M=D.sibling,M!==null){M.return=D.return,fi=M;break}fi=D.return}}function Nh(M,D,Y){var se=Y.flags;switch(Y.tag){case 0:case 11:case 15:Xn(M,Y),se&4&&Ia(5,Y);break;case 1:if(Xn(M,Y),se&4)if(M=Y.stateNode,D===null)try{M.componentDidMount()}catch(we){Gr(Y,Y.return,we)}else{var ue=Go(Y.type,D.memoizedProps);D=D.memoizedState;try{M.componentDidUpdate(ue,D,M.__reactInternalSnapshotBeforeUpdate)}catch(we){Gr(Y,Y.return,we)}}se&64&&Dh(Y),se&512&&Oa(Y,Y.return);break;case 3:if(Xn(M,Y),se&64&&(M=Y.updateQueue,M!==null)){if(D=null,Y.child!==null)switch(Y.child.tag){case 27:case 5:D=Y.child.stateNode;break;case 1:D=Y.child.stateNode}try{xp(M,D)}catch(we){Gr(Y,Y.return,we)}}break;case 27:D===null&&se&4&&Fh(Y);case 26:case 5:Xn(M,Y),D===null&&se&4&&jh(Y),se&512&&Oa(Y,Y.return);break;case 12:Xn(M,Y);break;case 13:Xn(M,Y),se&4&&$h(M,Y),se&64&&(M=Y.memoizedState,M!==null&&(M=M.dehydrated,M!==null&&(Y=Ym.bind(null,Y),fg(M,Y))));break;case 22:if(se=Y.memoizedState!==null||Pn,!se){D=D!==null&&D.memoizedState!==null||oi,ue=Pn;var ge=oi;Pn=se,(oi=D)&&!ge?Zn(M,Y,(Y.subtreeFlags&8772)!==0):Xn(M,Y),Pn=ue,oi=ge}break;case 30:break;default:Xn(M,Y)}}function Uh(M){var D=M.alternate;D!==null&&(M.alternate=null,Uh(D)),M.child=null,M.deletions=null,M.sibling=null,M.tag===5&&(D=M.stateNode,D!==null&&Ur(D)),M.stateNode=null,M.return=null,M.dependencies=null,M.memoizedProps=null,M.memoizedState=null,M.pendingProps=null,M.stateNode=null,M.updateQueue=null}var Xr=null,Ri=!1;function Mn(M,D,Y){for(Y=Y.child;Y!==null;)qh(M,D,Y),Y=Y.sibling}function qh(M,D,Y){if(Ft&&typeof Ft.onCommitFiberUnmount=="function")try{Ft.onCommitFiberUnmount(zt,Y)}catch{}switch(Y.tag){case 26:oi||hn(Y,D),Mn(M,D,Y),Y.memoizedState?Y.memoizedState.count--:Y.stateNode&&(Y=Y.stateNode,Y.parentNode.removeChild(Y));break;case 27:oi||hn(Y,D);var se=Xr,ue=Ri;uo(Y.type)&&(Xr=Y.stateNode,Ri=!1),Mn(M,D,Y),qa(Y.stateNode),Xr=se,Ri=ue;break;case 5:oi||hn(Y,D);case 6:if(se=Xr,ue=Ri,Xr=null,Mn(M,D,Y),Xr=se,Ri=ue,Xr!==null)if(Ri)try{(Xr.nodeType===9?Xr.body:Xr.nodeName==="HTML"?Xr.ownerDocument.body:Xr).removeChild(Y.stateNode)}catch(ge){Gr(Y,D,ge)}else try{Xr.removeChild(Y.stateNode)}catch(ge){Gr(Y,D,ge)}break;case 18:Xr!==null&&(Ri?(M=Xr,Mf(M.nodeType===9?M.body:M.nodeName==="HTML"?M.ownerDocument.body:M,Y.stateNode),Ya(M)):Mf(Xr,Y.stateNode));break;case 4:se=Xr,ue=Ri,Xr=Y.stateNode.containerInfo,Ri=!0,Mn(M,D,Y),Xr=se,Ri=ue;break;case 0:case 11:case 14:case 15:oi||Yn(2,Y,D),oi||Yn(4,Y,D),Mn(M,D,Y);break;case 1:oi||(hn(Y,D),se=Y.stateNode,typeof se.componentWillUnmount=="function"&&Bh(Y,D,se)),Mn(M,D,Y);break;case 21:Mn(M,D,Y);break;case 22:oi=(se=oi)||Y.memoizedState!==null,Mn(M,D,Y),oi=se;break;default:Mn(M,D,Y)}}function $h(M,D){if(D.memoizedState===null&&(M=D.alternate,M!==null&&(M=M.memoizedState,M!==null&&(M=M.dehydrated,M!==null))))try{Ya(M)}catch(Y){Gr(D,D.return,Y)}}function qm(M){switch(M.tag){case 13:case 19:var D=M.stateNode;return D===null&&(D=M.stateNode=new Vh),D;case 22:return M=M.stateNode,D=M._retryCache,D===null&&(D=M._retryCache=new Vh),D;default:throw Error(w(435,M.tag))}}function Qu(M,D){var Y=qm(M);D.forEach(function(se){var ue=Xm.bind(null,M,se);Y.has(se)||(Y.add(se),se.then(ue,ue))})}function Oi(M,D){var Y=D.deletions;if(Y!==null)for(var se=0;se<Y.length;se++){var ue=Y[se],ge=M,we=D,Me=we;e:for(;Me!==null;){switch(Me.tag){case 27:if(uo(Me.type)){Xr=Me.stateNode,Ri=!1;break e}break;case 5:Xr=Me.stateNode,Ri=!1;break e;case 3:case 4:Xr=Me.stateNode.containerInfo,Ri=!0;break e}Me=Me.return}if(Xr===null)throw Error(w(160));qh(ge,we,ue),Xr=null,Ri=!1,ge=ue.alternate,ge!==null&&(ge.return=null),ue.return=null}if(D.subtreeFlags&13878)for(D=D.child;D!==null;)zh(D,M),D=D.sibling}var Qi=null;function zh(M,D){var Y=M.alternate,se=M.flags;switch(M.tag){case 0:case 11:case 14:case 15:Oi(D,M),Di(M),se&4&&(Yn(3,M,M.return),Ia(3,M),Yn(5,M,M.return));break;case 1:Oi(D,M),Di(M),se&512&&(oi||Y===null||hn(Y,Y.return)),se&64&&Pn&&(M=M.updateQueue,M!==null&&(se=M.callbacks,se!==null&&(Y=M.shared.hiddenCallbacks,M.shared.hiddenCallbacks=Y===null?se:Y.concat(se))));break;case 26:var ue=Qi;if(Oi(D,M),Di(M),se&512&&(oi||Y===null||hn(Y,Y.return)),se&4){var ge=Y!==null?Y.memoizedState:null;if(se=M.memoizedState,Y===null)if(se===null)if(M.stateNode===null){e:{se=M.type,Y=M.memoizedProps,ue=ue.ownerDocument||ue;t:switch(se){case"title":ge=ue.getElementsByTagName("title")[0],(!ge||ge[Kr]||ge[fr]||ge.namespaceURI==="http://www.w3.org/2000/svg"||ge.hasAttribute("itemprop"))&&(ge=ue.createElement(se),ue.head.insertBefore(ge,ue.querySelector("head > title"))),bi(ge,se,Y),ge[fr]=M,Zr(ge),se=ge;break e;case"link":var we=Vf("link","href",ue).get(se+(Y.href||""));if(we){for(var Me=0;Me<we.length;Me++)if(ge=we[Me],ge.getAttribute("href")===(Y.href==null||Y.href===""?null:Y.href)&&ge.getAttribute("rel")===(Y.rel==null?null:Y.rel)&&ge.getAttribute("title")===(Y.title==null?null:Y.title)&&ge.getAttribute("crossorigin")===(Y.crossOrigin==null?null:Y.crossOrigin)){we.splice(Me,1);break t}}ge=ue.createElement(se),bi(ge,se,Y),ue.head.appendChild(ge);break;case"meta":if(we=Vf("meta","content",ue).get(se+(Y.content||""))){for(Me=0;Me<we.length;Me++)if(ge=we[Me],ge.getAttribute("content")===(Y.content==null?null:""+Y.content)&&ge.getAttribute("name")===(Y.name==null?null:Y.name)&&ge.getAttribute("property")===(Y.property==null?null:Y.property)&&ge.getAttribute("http-equiv")===(Y.httpEquiv==null?null:Y.httpEquiv)&&ge.getAttribute("charset")===(Y.charSet==null?null:Y.charSet)){we.splice(Me,1);break t}}ge=ue.createElement(se),bi(ge,se,Y),ue.head.appendChild(ge);break;default:throw Error(w(468,se))}ge[fr]=M,Zr(ge),se=ge}M.stateNode=se}else Nf(ue,M.type,M.stateNode);else M.stateNode=Ff(ue,se,M.memoizedProps);else ge!==se?(ge===null?Y.stateNode!==null&&(Y=Y.stateNode,Y.parentNode.removeChild(Y)):ge.count--,se===null?Nf(ue,M.type,M.stateNode):Ff(ue,se,M.memoizedProps)):se===null&&M.stateNode!==null&&Ju(M,M.memoizedProps,Y.memoizedProps)}break;case 27:Oi(D,M),Di(M),se&512&&(oi||Y===null||hn(Y,Y.return)),Y!==null&&se&4&&Ju(M,M.memoizedProps,Y.memoizedProps);break;case 5:if(Oi(D,M),Di(M),se&512&&(oi||Y===null||hn(Y,Y.return)),M.flags&32){ue=M.stateNode;try{sn(ue,"")}catch(Tt){Gr(M,M.return,Tt)}}se&4&&M.stateNode!=null&&(ue=M.memoizedProps,Ju(M,ue,Y!==null?Y.memoizedProps:ue)),se&1024&&(Zu=!0);break;case 6:if(Oi(D,M),Di(M),se&4){if(M.stateNode===null)throw Error(w(162));se=M.memoizedProps,Y=M.stateNode;try{Y.nodeValue=se}catch(Tt){Gr(M,M.return,Tt)}}break;case 3:if(ic=null,ue=Qi,Qi=tc(D.containerInfo),Oi(D,M),Qi=ue,Di(M),se&4&&Y!==null&&Y.memoizedState.isDehydrated)try{Ya(D.containerInfo)}catch(Tt){Gr(M,M.return,Tt)}Zu&&(Zu=!1,Hh(M));break;case 4:se=Qi,Qi=tc(M.stateNode.containerInfo),Oi(D,M),Di(M),Qi=se;break;case 12:Oi(D,M),Di(M);break;case 13:Oi(D,M),Di(M),M.child.flags&8192&&M.memoizedState!==null!=(Y!==null&&Y.memoizedState!==null)&&(od=ur()),se&4&&(se=M.updateQueue,se!==null&&(M.updateQueue=null,Qu(M,se)));break;case 22:ue=M.memoizedState!==null;var qe=Y!==null&&Y.memoizedState!==null,St=Pn,Zt=oi;if(Pn=St||ue,oi=Zt||qe,Oi(D,M),oi=Zt,Pn=St,Di(M),se&8192)e:for(D=M.stateNode,D._visibility=ue?D._visibility&-2:D._visibility|1,ue&&(Y===null||qe||Pn||oi||Ko(M)),Y=null,D=M;;){if(D.tag===5||D.tag===26){if(Y===null){qe=Y=D;try{if(ge=qe.stateNode,ue)we=ge.style,typeof we.setProperty=="function"?we.setProperty("display","none","important"):we.display="none";else{Me=qe.stateNode;var or=qe.memoizedProps.style,Rt=or!=null&&or.hasOwnProperty("display")?or.display:null;Me.style.display=Rt==null||typeof Rt=="boolean"?"":(""+Rt).trim()}}catch(Tt){Gr(qe,qe.return,Tt)}}}else if(D.tag===6){if(Y===null){qe=D;try{qe.stateNode.nodeValue=ue?"":qe.memoizedProps}catch(Tt){Gr(qe,qe.return,Tt)}}}else if((D.tag!==22&&D.tag!==23||D.memoizedState===null||D===M)&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===M)break e;for(;D.sibling===null;){if(D.return===null||D.return===M)break e;Y===D&&(Y=null),D=D.return}Y===D&&(Y=null),D.sibling.return=D.return,D=D.sibling}se&4&&(se=M.updateQueue,se!==null&&(Y=se.retryQueue,Y!==null&&(se.retryQueue=null,Qu(M,Y))));break;case 19:Oi(D,M),Di(M),se&4&&(se=M.updateQueue,se!==null&&(M.updateQueue=null,Qu(M,se)));break;case 30:break;case 21:break;default:Oi(D,M),Di(M)}}function Di(M){var D=M.flags;if(D&2){try{for(var Y,se=M.return;se!==null;){if(Lh(se)){Y=se;break}se=se.return}if(Y==null)throw Error(w(160));switch(Y.tag){case 27:var ue=Y.stateNode,ge=Yu(M);ql(M,ge,ue);break;case 5:var we=Y.stateNode;Y.flags&32&&(sn(we,""),Y.flags&=-33);var Me=Yu(M);ql(M,Me,we);break;case 3:case 4:var qe=Y.stateNode.containerInfo,St=Yu(M);Xu(M,St,qe);break;default:throw Error(w(161))}}catch(Zt){Gr(M,M.return,Zt)}M.flags&=-3}D&4096&&(M.flags&=-4097)}function Hh(M){if(M.subtreeFlags&1024)for(M=M.child;M!==null;){var D=M;Hh(D),D.tag===5&&D.flags&1024&&D.stateNode.reset(),M=M.sibling}}function Xn(M,D){if(D.subtreeFlags&8772)for(D=D.child;D!==null;)Nh(M,D.alternate,D),D=D.sibling}function Ko(M){for(M=M.child;M!==null;){var D=M;switch(D.tag){case 0:case 11:case 14:case 15:Yn(4,D,D.return),Ko(D);break;case 1:hn(D,D.return);var Y=D.stateNode;typeof Y.componentWillUnmount=="function"&&Bh(D,D.return,Y),Ko(D);break;case 27:qa(D.stateNode);case 26:case 5:hn(D,D.return),Ko(D);break;case 22:D.memoizedState===null&&Ko(D);break;case 30:Ko(D);break;default:Ko(D)}M=M.sibling}}function Zn(M,D,Y){for(Y=Y&&(D.subtreeFlags&8772)!==0,D=D.child;D!==null;){var se=D.alternate,ue=M,ge=D,we=ge.flags;switch(ge.tag){case 0:case 11:case 15:Zn(ue,ge,Y),Ia(4,ge);break;case 1:if(Zn(ue,ge,Y),se=ge,ue=se.stateNode,typeof ue.componentDidMount=="function")try{ue.componentDidMount()}catch(St){Gr(se,se.return,St)}if(se=ge,ue=se.updateQueue,ue!==null){var Me=se.stateNode;try{var qe=ue.shared.hiddenCallbacks;if(qe!==null)for(ue.shared.hiddenCallbacks=null,ue=0;ue<qe.length;ue++)yp(qe[ue],Me)}catch(St){Gr(se,se.return,St)}}Y&&we&64&&Dh(ge),Oa(ge,ge.return);break;case 27:Fh(ge);case 26:case 5:Zn(ue,ge,Y),Y&&se===null&&we&4&&jh(ge),Oa(ge,ge.return);break;case 12:Zn(ue,ge,Y);break;case 13:Zn(ue,ge,Y),Y&&we&4&&$h(ue,ge);break;case 22:ge.memoizedState===null&&Zn(ue,ge,Y),Oa(ge,ge.return);break;case 30:break;default:Zn(ue,ge,Y)}D=D.sibling}}function ed(M,D){var Y=null;M!==null&&M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(Y=M.memoizedState.cachePool.pool),M=null,D.memoizedState!==null&&D.memoizedState.cachePool!==null&&(M=D.memoizedState.cachePool.pool),M!==Y&&(M!=null&&M.refCount++,Y!=null&&va(Y))}function td(M,D){M=null,D.alternate!==null&&(M=D.alternate.memoizedState.cache),D=D.memoizedState.cache,D!==M&&(D.refCount++,M!=null&&va(M))}function fn(M,D,Y,se){if(D.subtreeFlags&10256)for(D=D.child;D!==null;)Wh(M,D,Y,se),D=D.sibling}function Wh(M,D,Y,se){var ue=D.flags;switch(D.tag){case 0:case 11:case 15:fn(M,D,Y,se),ue&2048&&Ia(9,D);break;case 1:fn(M,D,Y,se);break;case 3:fn(M,D,Y,se),ue&2048&&(M=null,D.alternate!==null&&(M=D.alternate.memoizedState.cache),D=D.memoizedState.cache,D!==M&&(D.refCount++,M!=null&&va(M)));break;case 12:if(ue&2048){fn(M,D,Y,se),M=D.stateNode;try{var ge=D.memoizedProps,we=ge.id,Me=ge.onPostCommit;typeof Me=="function"&&Me(we,D.alternate===null?"mount":"update",M.passiveEffectDuration,-0)}catch(qe){Gr(D,D.return,qe)}}else fn(M,D,Y,se);break;case 13:fn(M,D,Y,se);break;case 23:break;case 22:ge=D.stateNode,we=D.alternate,D.memoizedState!==null?ge._visibility&2?fn(M,D,Y,se):Da(M,D):ge._visibility&2?fn(M,D,Y,se):(ge._visibility|=2,Ds(M,D,Y,se,(D.subtreeFlags&10256)!==0)),ue&2048&&ed(we,D);break;case 24:fn(M,D,Y,se),ue&2048&&td(D.alternate,D);break;default:fn(M,D,Y,se)}}function Ds(M,D,Y,se,ue){for(ue=ue&&(D.subtreeFlags&10256)!==0,D=D.child;D!==null;){var ge=M,we=D,Me=Y,qe=se,St=we.flags;switch(we.tag){case 0:case 11:case 15:Ds(ge,we,Me,qe,ue),Ia(8,we);break;case 23:break;case 22:var Zt=we.stateNode;we.memoizedState!==null?Zt._visibility&2?Ds(ge,we,Me,qe,ue):Da(ge,we):(Zt._visibility|=2,Ds(ge,we,Me,qe,ue)),ue&&St&2048&&ed(we.alternate,we);break;case 24:Ds(ge,we,Me,qe,ue),ue&&St&2048&&td(we.alternate,we);break;default:Ds(ge,we,Me,qe,ue)}D=D.sibling}}function Da(M,D){if(D.subtreeFlags&10256)for(D=D.child;D!==null;){var Y=M,se=D,ue=se.flags;switch(se.tag){case 22:Da(Y,se),ue&2048&&ed(se.alternate,se);break;case 24:Da(Y,se),ue&2048&&td(se.alternate,se);break;default:Da(Y,se)}D=D.sibling}}var Ba=8192;function Bs(M){if(M.subtreeFlags&Ba)for(M=M.child;M!==null;)Gh(M),M=M.sibling}function Gh(M){switch(M.tag){case 26:Bs(M),M.flags&Ba&&M.memoizedState!==null&&kg(Qi,M.memoizedState,M.memoizedProps);break;case 5:Bs(M);break;case 3:case 4:var D=Qi;Qi=tc(M.stateNode.containerInfo),Bs(M),Qi=D;break;case 22:M.memoizedState===null&&(D=M.alternate,D!==null&&D.memoizedState!==null?(D=Ba,Ba=16777216,Bs(M),Ba=D):Bs(M));break;default:Bs(M)}}function Kh(M){var D=M.alternate;if(D!==null&&(M=D.child,M!==null)){D.child=null;do D=M.sibling,M.sibling=null,M=D;while(M!==null)}}function ja(M){var D=M.deletions;if((M.flags&16)!==0){if(D!==null)for(var Y=0;Y<D.length;Y++){var se=D[Y];fi=se,Yh(se,M)}Kh(M)}if(M.subtreeFlags&10256)for(M=M.child;M!==null;)Jh(M),M=M.sibling}function Jh(M){switch(M.tag){case 0:case 11:case 15:ja(M),M.flags&2048&&Yn(9,M,M.return);break;case 3:ja(M);break;case 12:ja(M);break;case 22:var D=M.stateNode;M.memoizedState!==null&&D._visibility&2&&(M.return===null||M.return.tag!==13)?(D._visibility&=-3,$l(M)):ja(M);break;default:ja(M)}}function $l(M){var D=M.deletions;if((M.flags&16)!==0){if(D!==null)for(var Y=0;Y<D.length;Y++){var se=D[Y];fi=se,Yh(se,M)}Kh(M)}for(M=M.child;M!==null;){switch(D=M,D.tag){case 0:case 11:case 15:Yn(8,D,D.return),$l(D);break;case 22:Y=D.stateNode,Y._visibility&2&&(Y._visibility&=-3,$l(D));break;default:$l(D)}M=M.sibling}}function Yh(M,D){for(;fi!==null;){var Y=fi;switch(Y.tag){case 0:case 11:case 15:Yn(8,Y,D);break;case 23:case 22:if(Y.memoizedState!==null&&Y.memoizedState.cachePool!==null){var se=Y.memoizedState.cachePool.pool;se!=null&&se.refCount++}break;case 24:va(Y.memoizedState.cache)}if(se=Y.child,se!==null)se.return=Y,fi=se;else e:for(Y=M;fi!==null;){se=fi;var ue=se.sibling,ge=se.return;if(Uh(se),se===Y){fi=null;break e}if(ue!==null){ue.return=ge,fi=ue;break e}fi=ge}}}var $m={getCacheForType:function(M){var D=Si(di),Y=D.data.get(M);return Y===void 0&&(Y=M(),D.data.set(M,Y)),Y}},zm=typeof WeakMap=="function"?WeakMap:Map,qr=0,Jr=null,Or=null,Lr=0,$r=0,Bi=null,Qn=!1,js=!1,rd=!1,In=0,ri=0,eo=0,Jo=0,id=0,Hi=0,Ls=0,La=null,Ti=null,nd=!1,od=0,zl=1/0,Hl=null,to=null,vi=0,oo=null,Fs=null,Vs=0,sd=0,ad=null,Xh=null,Fa=0,ld=null;function ji(){if((qr&2)!==0&&Lr!==0)return Lr&-Lr;if(Te.T!==null){var M=Rs;return M!==0?M:md()}return ct()}function Zh(){Hi===0&&(Hi=(Lr&536870912)===0||Nr?Ge():536870912);var M=zi.current;return M!==null&&(M.flags|=32),Hi}function Li(M,D,Y){(M===Jr&&($r===2||$r===9)||M.cancelPendingCommit!==null)&&(Ns(M,0),co(M,Lr,Hi,!1)),vr(M,Y),((qr&2)===0||M!==Jr)&&(M===Jr&&((qr&2)===0&&(Jo|=Y),ri===4&&co(M,Lr,Hi,!1)),mn(M))}function Qh(M,D,Y){if((qr&6)!==0)throw Error(w(327));var se=!Y&&(D&124)===0&&(D&M.expiredLanes)===0||Bt(M,D),ue=se?Gm(M,D):dd(M,D,!0),ge=se;do{if(ue===0){js&&!se&&co(M,D,0,!1);break}else{if(Y=M.current.alternate,ge&&!Hm(Y)){ue=dd(M,D,!1),ge=!1;continue}if(ue===2){if(ge=D,M.errorRecoveryDisabledLanes&ge)var we=0;else we=M.pendingLanes&-536870913,we=we!==0?we:we&536870912?536870912:0;if(we!==0){D=we;e:{var Me=M;ue=La;var qe=Me.current.memoizedState.isDehydrated;if(qe&&(Ns(Me,we).flags|=256),we=dd(Me,we,!1),we!==2){if(rd&&!qe){Me.errorRecoveryDisabledLanes|=ge,Jo|=ge,ue=4;break e}ge=Ti,Ti=ue,ge!==null&&(Ti===null?Ti=ge:Ti.push.apply(Ti,ge))}ue=we}if(ge=!1,ue!==2)continue}}if(ue===1){Ns(M,0),co(M,D,0,!0);break}e:{switch(se=M,ge=ue,ge){case 0:case 1:throw Error(w(345));case 4:if((D&4194048)!==D)break;case 6:co(se,D,Hi,!Qn);break e;case 2:Ti=null;break;case 3:case 5:break;default:throw Error(w(329))}if((D&62914560)===D&&(ue=od+300-ur(),10<ue)){if(co(se,D,Hi,!Qn),Re(se,0,!0)!==0)break e;se.timeoutHandle=Af(ef.bind(null,se,Y,Ti,Hl,nd,D,Hi,Jo,Ls,Qn,ge,2,-0,0),ue);break e}ef(se,Y,Ti,Hl,nd,D,Hi,Jo,Ls,Qn,ge,0,-0,0)}}break}while(!0);mn(M)}function ef(M,D,Y,se,ue,ge,we,Me,qe,St,Zt,or,Rt,Tt){if(M.timeoutHandle=-1,or=D.subtreeFlags,(or&8192||(or&16785408)===16785408)&&(Ha={stylesheets:null,count:0,unsuspend:Tg},Gh(D),or=_g(),or!==null)){M.cancelPendingCommit=or(lf.bind(null,M,D,ge,Y,se,ue,we,Me,qe,Zt,1,Rt,Tt)),co(M,ge,we,!St);return}lf(M,D,ge,Y,se,ue,we,Me,qe)}function Hm(M){for(var D=M;;){var Y=D.tag;if((Y===0||Y===11||Y===15)&&D.flags&16384&&(Y=D.updateQueue,Y!==null&&(Y=Y.stores,Y!==null)))for(var se=0;se<Y.length;se++){var ue=Y[se],ge=ue.getSnapshot;ue=ue.value;try{if(!Mi(ge(),ue))return!1}catch{return!1}}if(Y=D.child,D.subtreeFlags&16384&&Y!==null)Y.return=D,D=Y;else{if(D===M)break;for(;D.sibling===null;){if(D.return===null||D.return===M)return!0;D=D.return}D.sibling.return=D.return,D=D.sibling}}return!0}function co(M,D,Y,se){D&=~id,D&=~Jo,M.suspendedLanes|=D,M.pingedLanes&=~D,se&&(M.warmLanes|=D),se=M.expirationTimes;for(var ue=D;0<ue;){var ge=31-ke(ue),we=1<<ge;se[ge]=-1,ue&=~we}Y!==0&&dt(M,Y,D)}function Wl(){return(qr&6)===0?(Va(0),!1):!0}function cd(){if(Or!==null){if($r===0)var M=Or.return;else M=Or,wn=$o=null,Tu(M),Is=null,Aa=0,M=Or;for(;M!==null;)Oh(M.alternate,M),M=M.return;Or=null}}function Ns(M,D){var Y=M.timeoutHandle;Y!==-1&&(M.timeoutHandle=-1,cg(Y)),Y=M.cancelPendingCommit,Y!==null&&(M.cancelPendingCommit=null,Y()),cd(),Jr=M,Or=Y=Sn(M.current,null),Lr=D,$r=0,Bi=null,Qn=!1,js=Bt(M,D),rd=!1,Ls=Hi=id=Jo=eo=ri=0,Ti=La=null,nd=!1,(D&8)!==0&&(D|=D&32);var se=M.entangledLanes;if(se!==0)for(M=M.entanglements,se&=D;0<se;){var ue=31-ke(se),ge=1<<ue;D|=M[ue],se&=~ge}return In=D,fl(),Y}function tf(M,D){Pr=null,Te.H=Ol,D===ya||D===El?(D=vp(),$r=3):D===fp?(D=vp(),$r=4):$r=D===yh?8:D!==null&&typeof D=="object"&&typeof D.then=="function"?6:1,Bi=D,Or===null&&(ri=1,Fl(M,Ni(D,M.current)))}function rf(){var M=Te.H;return Te.H=Ol,M===null?Ol:M}function nf(){var M=Te.A;return Te.A=$m,M}function ud(){ri=4,Qn||(Lr&4194048)!==Lr&&zi.current!==null||(js=!0),(eo&134217727)===0&&(Jo&134217727)===0||Jr===null||co(Jr,Lr,Hi,!1)}function dd(M,D,Y){var se=qr;qr|=2;var ue=rf(),ge=nf();(Jr!==M||Lr!==D)&&(Hl=null,Ns(M,D)),D=!1;var we=ri;e:do try{if($r!==0&&Or!==null){var Me=Or,qe=Bi;switch($r){case 8:cd(),we=6;break e;case 3:case 2:case 9:case 6:zi.current===null&&(D=!0);var St=$r;if($r=0,Bi=null,Us(M,Me,qe,St),Y&&js){we=0;break e}break;default:St=$r,$r=0,Bi=null,Us(M,Me,qe,St)}}Wm(),we=ri;break}catch(Zt){tf(M,Zt)}while(!0);return D&&M.shellSuspendCounter++,wn=$o=null,qr=se,Te.H=ue,Te.A=ge,Or===null&&(Jr=null,Lr=0,fl()),we}function Wm(){for(;Or!==null;)of(Or)}function Gm(M,D){var Y=qr;qr|=2;var se=rf(),ue=nf();Jr!==M||Lr!==D?(Hl=null,zl=ur()+500,Ns(M,D)):js=Bt(M,D);e:do try{if($r!==0&&Or!==null){D=Or;var ge=Bi;t:switch($r){case 1:$r=0,Bi=null,Us(M,D,ge,1);break;case 2:case 9:if(mp(ge)){$r=0,Bi=null,sf(D);break}D=function(){$r!==2&&$r!==9||Jr!==M||($r=7),mn(M)},ge.then(D,D);break e;case 3:$r=7;break e;case 4:$r=5;break e;case 7:mp(ge)?($r=0,Bi=null,sf(D)):($r=0,Bi=null,Us(M,D,ge,7));break;case 5:var we=null;switch(Or.tag){case 26:we=Or.memoizedState;case 5:case 27:var Me=Or;if(!we||Uf(we)){$r=0,Bi=null;var qe=Me.sibling;if(qe!==null)Or=qe;else{var St=Me.return;St!==null?(Or=St,Gl(St)):Or=null}break t}}$r=0,Bi=null,Us(M,D,ge,5);break;case 6:$r=0,Bi=null,Us(M,D,ge,6);break;case 8:cd(),ri=6;break e;default:throw Error(w(462))}}Km();break}catch(Zt){tf(M,Zt)}while(!0);return wn=$o=null,Te.H=se,Te.A=ue,qr=Y,Or!==null?0:(Jr=null,Lr=0,fl(),ri)}function Km(){for(;Or!==null&&!sr();)of(Or)}function of(M){var D=Mh(M.alternate,M,In);M.memoizedProps=M.pendingProps,D===null?Gl(M):Or=D}function sf(M){var D=M,Y=D.alternate;switch(D.tag){case 15:case 0:D=Rh(Y,D,D.pendingProps,D.type,void 0,Lr);break;case 11:D=Rh(Y,D,D.pendingProps,D.type.render,D.ref,Lr);break;case 5:Tu(D);default:Oh(Y,D),D=Or=op(D,In),D=Mh(Y,D,In)}M.memoizedProps=M.pendingProps,D===null?Gl(M):Or=D}function Us(M,D,Y,se){wn=$o=null,Tu(D),Is=null,Aa=0;var ue=D.return;try{if(Lm(M,ue,D,Y,Lr)){ri=1,Fl(M,Ni(Y,M.current)),Or=null;return}}catch(ge){if(ue!==null)throw Or=ue,ge;ri=1,Fl(M,Ni(Y,M.current)),Or=null;return}D.flags&32768?(Nr||se===1?M=!0:js||(Lr&536870912)!==0?M=!1:(Qn=M=!0,(se===2||se===9||se===3||se===6)&&(se=zi.current,se!==null&&se.tag===13&&(se.flags|=16384))),af(D,M)):Gl(D)}function Gl(M){var D=M;do{if((D.flags&32768)!==0){af(D,Qn);return}M=D.return;var Y=Vm(D.alternate,D,In);if(Y!==null){Or=Y;return}if(D=D.sibling,D!==null){Or=D;return}Or=D=M}while(D!==null);ri===0&&(ri=5)}function af(M,D){do{var Y=Nm(M.alternate,M);if(Y!==null){Y.flags&=32767,Or=Y;return}if(Y=M.return,Y!==null&&(Y.flags|=32768,Y.subtreeFlags=0,Y.deletions=null),!D&&(M=M.sibling,M!==null)){Or=M;return}Or=M=Y}while(M!==null);ri=6,Or=null}function lf(M,D,Y,se,ue,ge,we,Me,qe){M.cancelPendingCommit=null;do Kl();while(vi!==0);if((qr&6)!==0)throw Error(w(327));if(D!==null){if(D===M.current)throw Error(w(177));if(ge=D.lanes|D.childLanes,ge|=tu,it(M,Y,ge,we,Me,qe),M===Jr&&(Or=Jr=null,Lr=0),Fs=D,oo=M,Vs=Y,sd=ge,ad=ue,Xh=se,(D.subtreeFlags&10256)!==0||(D.flags&10256)!==0?(M.callbackNode=null,M.callbackPriority=0,Zm(xr,function(){return hf(),null})):(M.callbackNode=null,M.callbackPriority=0),se=(D.flags&13878)!==0,(D.subtreeFlags&13878)!==0||se){se=Te.T,Te.T=null,ue=De.p,De.p=2,we=qr,qr|=4;try{Um(M,D,Y)}finally{qr=we,De.p=ue,Te.T=se}}vi=1,cf(),uf(),df()}}function cf(){if(vi===1){vi=0;var M=oo,D=Fs,Y=(D.flags&13878)!==0;if((D.subtreeFlags&13878)!==0||Y){Y=Te.T,Te.T=null;var se=De.p;De.p=2;var ue=qr;qr|=4;try{zh(D,M);var ge=Ed,we=Jd(M.containerInfo),Me=ge.focusedElem,qe=ge.selectionRange;if(we!==Me&&Me&&Me.ownerDocument&&Kd(Me.ownerDocument.documentElement,Me)){if(qe!==null&&Yc(Me)){var St=qe.start,Zt=qe.end;if(Zt===void 0&&(Zt=St),"selectionStart"in Me)Me.selectionStart=St,Me.selectionEnd=Math.min(Zt,Me.value.length);else{var or=Me.ownerDocument||document,Rt=or&&or.defaultView||window;if(Rt.getSelection){var Tt=Rt.getSelection(),_r=Me.textContent.length,Tr=Math.min(qe.start,_r),Wr=qe.end===void 0?Tr:Math.min(qe.end,_r);!Tt.extend&&Tr>Wr&&(we=Wr,Wr=Tr,Tr=we);var ot=Gd(Me,Tr),Ye=Gd(Me,Wr);if(ot&&Ye&&(Tt.rangeCount!==1||Tt.anchorNode!==ot.node||Tt.anchorOffset!==ot.offset||Tt.focusNode!==Ye.node||Tt.focusOffset!==Ye.offset)){var ft=or.createRange();ft.setStart(ot.node,ot.offset),Tt.removeAllRanges(),Tr>Wr?(Tt.addRange(ft),Tt.extend(Ye.node,Ye.offset)):(ft.setEnd(Ye.node,Ye.offset),Tt.addRange(ft))}}}}for(or=[],Tt=Me;Tt=Tt.parentNode;)Tt.nodeType===1&&or.push({element:Tt,left:Tt.scrollLeft,top:Tt.scrollTop});for(typeof Me.focus=="function"&&Me.focus(),Me=0;Me<or.length;Me++){var rr=or[Me];rr.element.scrollLeft=rr.left,rr.element.scrollTop=rr.top}}sc=!!Cd,Ed=Cd=null}finally{qr=ue,De.p=se,Te.T=Y}}M.current=D,vi=2}}function uf(){if(vi===2){vi=0;var M=oo,D=Fs,Y=(D.flags&8772)!==0;if((D.subtreeFlags&8772)!==0||Y){Y=Te.T,Te.T=null;var se=De.p;De.p=2;var ue=qr;qr|=4;try{Nh(M,D.alternate,D)}finally{qr=ue,De.p=se,Te.T=Y}}vi=3}}function df(){if(vi===4||vi===3){vi=0,pr();var M=oo,D=Fs,Y=Vs,se=Xh;(D.subtreeFlags&10256)!==0||(D.flags&10256)!==0?vi=5:(vi=0,Fs=oo=null,pf(M,M.pendingLanes));var ue=M.pendingLanes;if(ue===0&&(to=null),_e(Y),D=D.stateNode,Ft&&typeof Ft.onCommitFiberRoot=="function")try{Ft.onCommitFiberRoot(zt,D,void 0,(D.current.flags&128)===128)}catch{}if(se!==null){D=Te.T,ue=De.p,De.p=2,Te.T=null;try{for(var ge=M.onRecoverableError,we=0;we<se.length;we++){var Me=se[we];ge(Me.value,{componentStack:Me.stack})}}finally{Te.T=D,De.p=ue}}(Vs&3)!==0&&Kl(),mn(M),ue=M.pendingLanes,(Y&4194090)!==0&&(ue&42)!==0?M===ld?Fa++:(Fa=0,ld=M):Fa=0,Va(0)}}function pf(M,D){(M.pooledCacheLanes&=D)===0&&(D=M.pooledCache,D!=null&&(M.pooledCache=null,va(D)))}function Kl(M){return cf(),uf(),df(),hf()}function hf(){if(vi!==5)return!1;var M=oo,D=sd;sd=0;var Y=_e(Vs),se=Te.T,ue=De.p;try{De.p=32>Y?32:Y,Te.T=null,Y=ad,ad=null;var ge=oo,we=Vs;if(vi=0,Fs=oo=null,Vs=0,(qr&6)!==0)throw Error(w(331));var Me=qr;if(qr|=4,Jh(ge.current),Wh(ge,ge.current,we,Y),qr=Me,Va(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(zt,ge)}catch{}return!0}finally{De.p=ue,Te.T=se,pf(M,D)}}function ff(M,D,Y){D=Ni(Y,D),D=Nu(M.stateNode,D,2),M=Wn(M,D,2),M!==null&&(vr(M,2),mn(M))}function Gr(M,D,Y){if(M.tag===3)ff(M,M,Y);else for(;D!==null;){if(D.tag===3){ff(D,M,Y);break}else if(D.tag===1){var se=D.stateNode;if(typeof D.type.getDerivedStateFromError=="function"||typeof se.componentDidCatch=="function"&&(to===null||!to.has(se))){M=Ni(Y,M),Y=vh(2),se=Wn(D,Y,2),se!==null&&(bh(Y,se,D,M),vr(se,2),mn(se));break}}D=D.return}}function pd(M,D,Y){var se=M.pingCache;if(se===null){se=M.pingCache=new zm;var ue=new Set;se.set(D,ue)}else ue=se.get(D),ue===void 0&&(ue=new Set,se.set(D,ue));ue.has(Y)||(rd=!0,ue.add(Y),M=Jm.bind(null,M,D,Y),D.then(M,M))}function Jm(M,D,Y){var se=M.pingCache;se!==null&&se.delete(D),M.pingedLanes|=M.suspendedLanes&Y,M.warmLanes&=~Y,Jr===M&&(Lr&Y)===Y&&(ri===4||ri===3&&(Lr&62914560)===Lr&&300>ur()-od?(qr&2)===0&&Ns(M,0):id|=Y,Ls===Lr&&(Ls=0)),mn(M)}function mf(M,D){D===0&&(D=nr()),M=Ss(M,D),M!==null&&(vr(M,D),mn(M))}function Ym(M){var D=M.memoizedState,Y=0;D!==null&&(Y=D.retryLane),mf(M,Y)}function Xm(M,D){var Y=0;switch(M.tag){case 13:var se=M.stateNode,ue=M.memoizedState;ue!==null&&(Y=ue.retryLane);break;case 19:se=M.stateNode;break;case 22:se=M.stateNode._retryCache;break;default:throw Error(w(314))}se!==null&&se.delete(D),mf(M,Y)}function Zm(M,D){return gr(M,D)}var Jl=null,qs=null,hd=!1,Yl=!1,fd=!1,Yo=0;function mn(M){M!==qs&&M.next===null&&(qs===null?Jl=qs=M:qs=qs.next=M),Yl=!0,hd||(hd=!0,eg())}function Va(M,D){if(!fd&&Yl){fd=!0;do for(var Y=!1,se=Jl;se!==null;){if(M!==0){var ue=se.pendingLanes;if(ue===0)var ge=0;else{var we=se.suspendedLanes,Me=se.pingedLanes;ge=(1<<31-ke(42|M)+1)-1,ge&=ue&~(we&~Me),ge=ge&201326741?ge&201326741|1:ge?ge|2:0}ge!==0&&(Y=!0,yf(se,ge))}else ge=Lr,ge=Re(se,se===Jr?ge:0,se.cancelPendingCommit!==null||se.timeoutHandle!==-1),(ge&3)===0||Bt(se,ge)||(Y=!0,yf(se,ge));se=se.next}while(Y);fd=!1}}function Qm(){gf()}function gf(){Yl=hd=!1;var M=0;Yo!==0&&(lg()&&(M=Yo),Yo=0);for(var D=ur(),Y=null,se=Jl;se!==null;){var ue=se.next,ge=vf(se,D);ge===0?(se.next=null,Y===null?Jl=ue:Y.next=ue,ue===null&&(qs=Y)):(Y=se,(M!==0||(ge&3)!==0)&&(Yl=!0)),se=ue}Va(M)}function vf(M,D){for(var Y=M.suspendedLanes,se=M.pingedLanes,ue=M.expirationTimes,ge=M.pendingLanes&-62914561;0<ge;){var we=31-ke(ge),Me=1<<we,qe=ue[we];qe===-1?((Me&Y)===0||(Me&se)!==0)&&(ue[we]=Fe(Me,D)):qe<=D&&(M.expiredLanes|=Me),ge&=~Me}if(D=Jr,Y=Lr,Y=Re(M,M===D?Y:0,M.cancelPendingCommit!==null||M.timeoutHandle!==-1),se=M.callbackNode,Y===0||M===D&&($r===2||$r===9)||M.cancelPendingCommit!==null)return se!==null&&se!==null&&er(se),M.callbackNode=null,M.callbackPriority=0;if((Y&3)===0||Bt(M,Y)){if(D=Y&-Y,D===M.callbackPriority)return D;switch(se!==null&&er(se),_e(Y)){case 2:case 8:Y=yr;break;case 32:Y=xr;break;case 268435456:Y=Jt;break;default:Y=xr}return se=bf.bind(null,M),Y=gr(Y,se),M.callbackPriority=D,M.callbackNode=Y,D}return se!==null&&se!==null&&er(se),M.callbackPriority=2,M.callbackNode=null,2}function bf(M,D){if(vi!==0&&vi!==5)return M.callbackNode=null,M.callbackPriority=0,null;var Y=M.callbackNode;if(Kl()&&M.callbackNode!==Y)return null;var se=Lr;return se=Re(M,M===Jr?se:0,M.cancelPendingCommit!==null||M.timeoutHandle!==-1),se===0?null:(Qh(M,se,D),vf(M,ur()),M.callbackNode!=null&&M.callbackNode===Y?bf.bind(null,M):null)}function yf(M,D){if(Kl())return null;Qh(M,D,!0)}function eg(){ug(function(){(qr&6)!==0?gr(hr,Qm):gf()})}function md(){return Yo===0&&(Yo=Ge()),Yo}function xf(M){return M==null||typeof M=="symbol"||typeof M=="boolean"?null:typeof M=="function"?M:Vn(""+M)}function Sf(M,D){var Y=D.ownerDocument.createElement("input");return Y.name=D.name,Y.value=D.value,M.id&&Y.setAttribute("form",M.id),D.parentNode.insertBefore(Y,D),M=new FormData(M),Y.parentNode.removeChild(Y),M}function tg(M,D,Y,se,ue){if(D==="submit"&&Y&&Y.stateNode===ue){var ge=xf((ue[dr]||null).action),we=se.submitter;we&&(D=(D=we[dr]||null)?xf(D.formAction):we.getAttribute("formAction"),D!==null&&(ge=D,we=null));var Me=new Xi("action","action",null,se,ue);M.push({event:Me,listeners:[{instance:null,listener:function(){if(se.defaultPrevented){if(Yo!==0){var qe=we?Sf(ue,we):new FormData(ue);Bu(Y,{pending:!0,data:qe,method:ue.method,action:ge},null,qe)}}else typeof ge=="function"&&(Me.preventDefault(),qe=we?Sf(ue,we):new FormData(ue),Bu(Y,{pending:!0,data:qe,method:ue.method,action:ge},ge,qe))},currentTarget:ue}]})}}for(var gd=0;gd<eu.length;gd++){var vd=eu[gd],rg=vd.toLowerCase(),ig=vd[0].toUpperCase()+vd.slice(1);Zi(rg,"on"+ig)}Zi(Zd,"onAnimationEnd"),Zi(Qd,"onAnimationIteration"),Zi(ep,"onAnimationStart"),Zi("dblclick","onDoubleClick"),Zi("focusin","onFocus"),Zi("focusout","onBlur"),Zi(xm,"onTransitionRun"),Zi(Sm,"onTransitionStart"),Zi(Cm,"onTransitionCancel"),Zi(tp,"onTransitionEnd"),Yi("onMouseEnter",["mouseout","mouseover"]),Yi("onMouseLeave",["mouseout","mouseover"]),Yi("onPointerEnter",["pointerout","pointerover"]),Yi("onPointerLeave",["pointerout","pointerover"]),Ji("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ji("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ji("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ji("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ji("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ji("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Na="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ng=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Na));function Cf(M,D){D=(D&4)!==0;for(var Y=0;Y<M.length;Y++){var se=M[Y],ue=se.event;se=se.listeners;e:{var ge=void 0;if(D)for(var we=se.length-1;0<=we;we--){var Me=se[we],qe=Me.instance,St=Me.currentTarget;if(Me=Me.listener,qe!==ge&&ue.isPropagationStopped())break e;ge=Me,ue.currentTarget=St;try{ge(ue)}catch(Zt){Ll(Zt)}ue.currentTarget=null,ge=qe}else for(we=0;we<se.length;we++){if(Me=se[we],qe=Me.instance,St=Me.currentTarget,Me=Me.listener,qe!==ge&&ue.isPropagationStopped())break e;ge=Me,ue.currentTarget=St;try{ge(ue)}catch(Zt){Ll(Zt)}ue.currentTarget=null,ge=qe}}}}function Dr(M,D){var Y=D[Rr];Y===void 0&&(Y=D[Rr]=new Set);var se=M+"__bubble";Y.has(se)||(Ef(D,M,2,!1),Y.add(se))}function bd(M,D,Y){var se=0;D&&(se|=4),Ef(Y,M,se,D)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function yd(M){if(!M[Xl]){M[Xl]=!0,yo.forEach(function(Y){Y!=="selectionchange"&&(ng.has(Y)||bd(Y,!1,M),bd(Y,!0,M))});var D=M.nodeType===9?M:M.ownerDocument;D===null||D[Xl]||(D[Xl]=!0,bd("selectionchange",!1,D))}}function Ef(M,D,Y,se){switch(Gf(D)){case 2:var ue=Mg;break;case 8:ue=Ig;break;default:ue=Od}Y=ue.bind(null,D,Y,M),ue=void 0,!Io||D!=="touchstart"&&D!=="touchmove"&&D!=="wheel"||(ue=!0),se?ue!==void 0?M.addEventListener(D,Y,{capture:!0,passive:ue}):M.addEventListener(D,Y,!0):ue!==void 0?M.addEventListener(D,Y,{passive:ue}):M.addEventListener(D,Y,!1)}function xd(M,D,Y,se,ue){var ge=se;if((D&1)===0&&(D&2)===0&&se!==null)e:for(;;){if(se===null)return;var we=se.tag;if(we===3||we===4){var Me=se.stateNode.containerInfo;if(Me===ue)break;if(we===4)for(we=se.return;we!==null;){var qe=we.tag;if((qe===3||qe===4)&&we.stateNode.containerInfo===ue)return;we=we.return}for(;Me!==null;){if(we=ai(Me),we===null)return;if(qe=we.tag,qe===5||qe===6||qe===26||qe===27){se=ge=we;continue e}Me=Me.parentNode}}se=se.return}fs(function(){var St=ge,Zt=Po(Y),or=[];e:{var Rt=rp.get(M);if(Rt!==void 0){var Tt=Xi,_r=M;switch(M){case"keypress":if(Ut(Y)===0)break e;case"keydown":case"keyup":Tt=Oc;break;case"focusin":_r="focus",Tt=sa;break;case"focusout":_r="blur",Tt=sa;break;case"beforeblur":case"afterblur":Tt=sa;break;case"click":if(Y.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Tt=el;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Tt=Sc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Tt=jc;break;case Zd:case Qd:case ep:Tt=wc;break;case tp:Tt=Fc;break;case"scroll":case"scrollend":Tt=oa;break;case"wheel":Tt=Nc;break;case"copy":case"cut":case"paste":Tt=Tc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Tt=rl;break;case"toggle":case"beforetoggle":Tt=qc}var Tr=(D&4)!==0,Wr=!Tr&&(M==="scroll"||M==="scrollend"),ot=Tr?Rt!==null?Rt+"Capture":null:Rt;Tr=[];for(var Ye=St,ft;Ye!==null;){var rr=Ye;if(ft=rr.stateNode,rr=rr.tag,rr!==5&&rr!==26&&rr!==27||ft===null||ot===null||(rr=bn(Ye,ot),rr!=null&&Tr.push(Ua(Ye,rr,ft))),Wr)break;Ye=Ye.return}0<Tr.length&&(Rt=new Tt(Rt,_r,null,Y,Zt),or.push({event:Rt,listeners:Tr}))}}if((D&7)===0){e:{if(Rt=M==="mouseover"||M==="pointerover",Tt=M==="mouseout"||M==="pointerout",Rt&&Y!==Ao&&(_r=Y.relatedTarget||Y.fromElement)&&(ai(_r)||_r[jr]))break e;if((Tt||Rt)&&(Rt=Zt.window===Zt?Zt:(Rt=Zt.ownerDocument)?Rt.defaultView||Rt.parentWindow:window,Tt?(_r=Y.relatedTarget||Y.toElement,Tt=St,_r=_r?ai(_r):null,_r!==null&&(Wr=_(_r),Tr=_r.tag,_r!==Wr||Tr!==5&&Tr!==27&&Tr!==6)&&(_r=null)):(Tt=null,_r=St),Tt!==_r)){if(Tr=el,rr="onMouseLeave",ot="onMouseEnter",Ye="mouse",(M==="pointerout"||M==="pointerover")&&(Tr=rl,rr="onPointerLeave",ot="onPointerEnter",Ye="pointer"),Wr=Tt==null?Rt:Fi(Tt),ft=_r==null?Rt:Fi(_r),Rt=new Tr(rr,Ye+"leave",Tt,Y,Zt),Rt.target=Wr,Rt.relatedTarget=ft,rr=null,ai(Zt)===St&&(Tr=new Tr(ot,Ye+"enter",_r,Y,Zt),Tr.target=ft,Tr.relatedTarget=Wr,rr=Tr),Wr=rr,Tt&&_r)t:{for(Tr=Tt,ot=_r,Ye=0,ft=Tr;ft;ft=$s(ft))Ye++;for(ft=0,rr=ot;rr;rr=$s(rr))ft++;for(;0<Ye-ft;)Tr=$s(Tr),Ye--;for(;0<ft-Ye;)ot=$s(ot),ft--;for(;Ye--;){if(Tr===ot||ot!==null&&Tr===ot.alternate)break t;Tr=$s(Tr),ot=$s(ot)}Tr=null}else Tr=null;Tt!==null&&wf(or,Rt,Tt,Tr,!1),_r!==null&&Wr!==null&&wf(or,Wr,_r,Tr,!0)}}e:{if(Rt=St?Fi(St):window,Tt=Rt.nodeName&&Rt.nodeName.toLowerCase(),Tt==="select"||Tt==="input"&&Rt.type==="file")var Er=ul;else if(ll(Rt))if(dl)Er=vm;else{Er=vs;var Mr=Jc}else Tt=Rt.nodeName,!Tt||Tt.toLowerCase()!=="input"||Rt.type!=="checkbox"&&Rt.type!=="radio"?St&&ko(St.elementType)&&(Er=ul):Er=gm;if(Er&&(Er=Er(M,St))){cl(or,Er,Y,Zt);break e}Mr&&Mr(M,Rt,St),M==="focusout"&&St&&Rt.type==="number"&&St.memoizedProps.value!=null&&To(Rt,"number",Rt.value)}switch(Mr=St?Fi(St):window,M){case"focusin":(ll(Mr)||Mr.contentEditable==="true")&&(bs=Mr,Xc=St,pa=null);break;case"focusout":pa=Xc=bs=null;break;case"mousedown":Zc=!0;break;case"contextmenu":case"mouseup":case"dragend":Zc=!1,Yd(or,Y,Zt);break;case"selectionchange":if(ym)break;case"keydown":case"keyup":Yd(or,Y,Zt)}var wr;if(la)e:{switch(M){case"compositionstart":var kr="onCompositionStart";break e;case"compositionend":kr="onCompositionEnd";break e;case"compositionupdate":kr="onCompositionUpdate";break e}kr=void 0}else qn?sl(M,Y)&&(kr="onCompositionEnd"):M==="keydown"&&Y.keyCode===229&&(kr="onCompositionStart");kr&&(il&&Y.locale!=="ko"&&(qn||kr!=="onCompositionStart"?kr==="onCompositionEnd"&&qn&&(wr=We()):(Vi=Zt,ut="value"in Vi?Vi.value:Vi.textContent,qn=!0)),Mr=Zl(St,kr),0<Mr.length&&(kr=new tl(kr,M,null,Y,Zt),or.push({event:kr,listeners:Mr}),wr?kr.data=wr:(wr=al(Y),wr!==null&&(kr.data=wr)))),(wr=zc?Hc(M,Y):Wc(M,Y))&&(kr=Zl(St,"onBeforeInput"),0<kr.length&&(Mr=new tl("onBeforeInput","beforeinput",null,Y,Zt),or.push({event:Mr,listeners:kr}),Mr.data=wr)),tg(or,M,St,Y,Zt)}Cf(or,D)})}function Ua(M,D,Y){return{instance:M,listener:D,currentTarget:Y}}function Zl(M,D){for(var Y=D+"Capture",se=[];M!==null;){var ue=M,ge=ue.stateNode;if(ue=ue.tag,ue!==5&&ue!==26&&ue!==27||ge===null||(ue=bn(M,Y),ue!=null&&se.unshift(Ua(M,ue,ge)),ue=bn(M,D),ue!=null&&se.push(Ua(M,ue,ge))),M.tag===3)return se;M=M.return}return[]}function $s(M){if(M===null)return null;do M=M.return;while(M&&M.tag!==5&&M.tag!==27);return M||null}function wf(M,D,Y,se,ue){for(var ge=D._reactName,we=[];Y!==null&&Y!==se;){var Me=Y,qe=Me.alternate,St=Me.stateNode;if(Me=Me.tag,qe!==null&&qe===se)break;Me!==5&&Me!==26&&Me!==27||St===null||(qe=St,ue?(St=bn(Y,ge),St!=null&&we.unshift(Ua(Y,St,qe))):ue||(St=bn(Y,ge),St!=null&&we.push(Ua(Y,St,qe)))),Y=Y.return}we.length!==0&&M.push({event:D,listeners:we})}var og=/\r\n?/g,sg=/\u0000|\uFFFD/g;function Rf(M){return(typeof M=="string"?M:""+M).replace(og,`
`).replace(sg,"")}function Tf(M,D){return D=Rf(D),Rf(M)===D}function Ql(){}function Hr(M,D,Y,se,ue,ge){switch(Y){case"children":typeof se=="string"?D==="body"||D==="textarea"&&se===""||sn(M,se):(typeof se=="number"||typeof se=="bigint")&&D!=="body"&&sn(M,""+se);break;case"className":jn(M,"class",se);break;case"tabIndex":jn(M,"tabindex",se);break;case"dir":case"role":case"viewBox":case"width":case"height":jn(M,Y,se);break;case"style":ps(M,se,ge);break;case"data":if(D!=="object"){jn(M,"data",se);break}case"src":case"href":if(se===""&&(D!=="a"||Y!=="href")){M.removeAttribute(Y);break}if(se==null||typeof se=="function"||typeof se=="symbol"||typeof se=="boolean"){M.removeAttribute(Y);break}se=Vn(""+se),M.setAttribute(Y,se);break;case"action":case"formAction":if(typeof se=="function"){M.setAttribute(Y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof ge=="function"&&(Y==="formAction"?(D!=="input"&&Hr(M,D,"name",ue.name,ue,null),Hr(M,D,"formEncType",ue.formEncType,ue,null),Hr(M,D,"formMethod",ue.formMethod,ue,null),Hr(M,D,"formTarget",ue.formTarget,ue,null)):(Hr(M,D,"encType",ue.encType,ue,null),Hr(M,D,"method",ue.method,ue,null),Hr(M,D,"target",ue.target,ue,null)));if(se==null||typeof se=="symbol"||typeof se=="boolean"){M.removeAttribute(Y);break}se=Vn(""+se),M.setAttribute(Y,se);break;case"onClick":se!=null&&(M.onclick=Ql);break;case"onScroll":se!=null&&Dr("scroll",M);break;case"onScrollEnd":se!=null&&Dr("scrollend",M);break;case"dangerouslySetInnerHTML":if(se!=null){if(typeof se!="object"||!("__html"in se))throw Error(w(61));if(Y=se.__html,Y!=null){if(ue.children!=null)throw Error(w(60));M.innerHTML=Y}}break;case"multiple":M.multiple=se&&typeof se!="function"&&typeof se!="symbol";break;case"muted":M.muted=se&&typeof se!="function"&&typeof se!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(se==null||typeof se=="function"||typeof se=="boolean"||typeof se=="symbol"){M.removeAttribute("xlink:href");break}Y=Vn(""+se),M.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Y);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":se!=null&&typeof se!="function"&&typeof se!="symbol"?M.setAttribute(Y,""+se):M.removeAttribute(Y);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":se&&typeof se!="function"&&typeof se!="symbol"?M.setAttribute(Y,""):M.removeAttribute(Y);break;case"capture":case"download":se===!0?M.setAttribute(Y,""):se!==!1&&se!=null&&typeof se!="function"&&typeof se!="symbol"?M.setAttribute(Y,se):M.removeAttribute(Y);break;case"cols":case"rows":case"size":case"span":se!=null&&typeof se!="function"&&typeof se!="symbol"&&!isNaN(se)&&1<=se?M.setAttribute(Y,se):M.removeAttribute(Y);break;case"rowSpan":case"start":se==null||typeof se=="function"||typeof se=="symbol"||isNaN(se)?M.removeAttribute(Y):M.setAttribute(Y,se);break;case"popover":Dr("beforetoggle",M),Dr("toggle",M),Bn(M,"popover",se);break;case"xlinkActuate":Ei(M,"http://www.w3.org/1999/xlink","xlink:actuate",se);break;case"xlinkArcrole":Ei(M,"http://www.w3.org/1999/xlink","xlink:arcrole",se);break;case"xlinkRole":Ei(M,"http://www.w3.org/1999/xlink","xlink:role",se);break;case"xlinkShow":Ei(M,"http://www.w3.org/1999/xlink","xlink:show",se);break;case"xlinkTitle":Ei(M,"http://www.w3.org/1999/xlink","xlink:title",se);break;case"xlinkType":Ei(M,"http://www.w3.org/1999/xlink","xlink:type",se);break;case"xmlBase":Ei(M,"http://www.w3.org/XML/1998/namespace","xml:base",se);break;case"xmlLang":Ei(M,"http://www.w3.org/XML/1998/namespace","xml:lang",se);break;case"xmlSpace":Ei(M,"http://www.w3.org/XML/1998/namespace","xml:space",se);break;case"is":Bn(M,"is",se);break;case"innerText":case"textContent":break;default:(!(2<Y.length)||Y[0]!=="o"&&Y[0]!=="O"||Y[1]!=="n"&&Y[1]!=="N")&&(Y=ia.get(Y)||Y,Bn(M,Y,se))}}function Sd(M,D,Y,se,ue,ge){switch(Y){case"style":ps(M,se,ge);break;case"dangerouslySetInnerHTML":if(se!=null){if(typeof se!="object"||!("__html"in se))throw Error(w(61));if(Y=se.__html,Y!=null){if(ue.children!=null)throw Error(w(60));M.innerHTML=Y}}break;case"children":typeof se=="string"?sn(M,se):(typeof se=="number"||typeof se=="bigint")&&sn(M,""+se);break;case"onScroll":se!=null&&Dr("scroll",M);break;case"onScrollEnd":se!=null&&Dr("scrollend",M);break;case"onClick":se!=null&&(M.onclick=Ql);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xo.hasOwnProperty(Y))e:{if(Y[0]==="o"&&Y[1]==="n"&&(ue=Y.endsWith("Capture"),D=Y.slice(2,ue?Y.length-7:void 0),ge=M[dr]||null,ge=ge!=null?ge[Y]:null,typeof ge=="function"&&M.removeEventListener(D,ge,ue),typeof se=="function")){typeof ge!="function"&&ge!==null&&(Y in M?M[Y]=null:M.hasAttribute(Y)&&M.removeAttribute(Y)),M.addEventListener(D,se,ue);break e}Y in M?M[Y]=se:se===!0?M.setAttribute(Y,""):Bn(M,Y,se)}}}function bi(M,D,Y){switch(D){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Dr("error",M),Dr("load",M);var se=!1,ue=!1,ge;for(ge in Y)if(Y.hasOwnProperty(ge)){var we=Y[ge];if(we!=null)switch(ge){case"src":se=!0;break;case"srcSet":ue=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(w(137,D));default:Hr(M,D,ge,we,Y,null)}}ue&&Hr(M,D,"srcSet",Y.srcSet,Y,null),se&&Hr(M,D,"src",Y.src,Y,null);return;case"input":Dr("invalid",M);var Me=ge=we=ue=null,qe=null,St=null;for(se in Y)if(Y.hasOwnProperty(se)){var Zt=Y[se];if(Zt!=null)switch(se){case"name":ue=Zt;break;case"type":we=Zt;break;case"checked":qe=Zt;break;case"defaultChecked":St=Zt;break;case"value":ge=Zt;break;case"defaultValue":Me=Zt;break;case"children":case"dangerouslySetInnerHTML":if(Zt!=null)throw Error(w(137,D));break;default:Hr(M,D,se,Zt,Y,null)}}ls(M,ge,Me,qe,St,we,ue,!1),Ln(M);return;case"select":Dr("invalid",M),se=we=ge=null;for(ue in Y)if(Y.hasOwnProperty(ue)&&(Me=Y[ue],Me!=null))switch(ue){case"value":ge=Me;break;case"defaultValue":we=Me;break;case"multiple":se=Me;default:Hr(M,D,ue,Me,Y,null)}D=ge,Y=we,M.multiple=!!se,D!=null?nn(M,!!se,D,!1):Y!=null&&nn(M,!!se,Y,!0);return;case"textarea":Dr("invalid",M),ge=ue=se=null;for(we in Y)if(Y.hasOwnProperty(we)&&(Me=Y[we],Me!=null))switch(we){case"value":se=Me;break;case"defaultValue":ue=Me;break;case"children":ge=Me;break;case"dangerouslySetInnerHTML":if(Me!=null)throw Error(w(91));break;default:Hr(M,D,we,Me,Y,null)}us(M,se,ue,ge),Ln(M);return;case"option":for(qe in Y)if(Y.hasOwnProperty(qe)&&(se=Y[qe],se!=null))switch(qe){case"selected":M.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Hr(M,D,qe,se,Y,null)}return;case"dialog":Dr("beforetoggle",M),Dr("toggle",M),Dr("cancel",M),Dr("close",M);break;case"iframe":case"object":Dr("load",M);break;case"video":case"audio":for(se=0;se<Na.length;se++)Dr(Na[se],M);break;case"image":Dr("error",M),Dr("load",M);break;case"details":Dr("toggle",M);break;case"embed":case"source":case"link":Dr("error",M),Dr("load",M);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(St in Y)if(Y.hasOwnProperty(St)&&(se=Y[St],se!=null))switch(St){case"children":case"dangerouslySetInnerHTML":throw Error(w(137,D));default:Hr(M,D,St,se,Y,null)}return;default:if(ko(D)){for(Zt in Y)Y.hasOwnProperty(Zt)&&(se=Y[Zt],se!==void 0&&Sd(M,D,Zt,se,Y,void 0));return}}for(Me in Y)Y.hasOwnProperty(Me)&&(se=Y[Me],se!=null&&Hr(M,D,Me,se,Y,null))}function ag(M,D,Y,se){switch(D){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var ue=null,ge=null,we=null,Me=null,qe=null,St=null,Zt=null;for(Tt in Y){var or=Y[Tt];if(Y.hasOwnProperty(Tt)&&or!=null)switch(Tt){case"checked":break;case"value":break;case"defaultValue":qe=or;default:se.hasOwnProperty(Tt)||Hr(M,D,Tt,null,se,or)}}for(var Rt in se){var Tt=se[Rt];if(or=Y[Rt],se.hasOwnProperty(Rt)&&(Tt!=null||or!=null))switch(Rt){case"type":ge=Tt;break;case"name":ue=Tt;break;case"checked":St=Tt;break;case"defaultChecked":Zt=Tt;break;case"value":we=Tt;break;case"defaultValue":Me=Tt;break;case"children":case"dangerouslySetInnerHTML":if(Tt!=null)throw Error(w(137,D));break;default:Tt!==or&&Hr(M,D,Rt,Tt,se,or)}}Ro(M,we,Me,qe,St,Zt,ge,ue);return;case"select":Tt=we=Me=Rt=null;for(ge in Y)if(qe=Y[ge],Y.hasOwnProperty(ge)&&qe!=null)switch(ge){case"value":break;case"multiple":Tt=qe;default:se.hasOwnProperty(ge)||Hr(M,D,ge,null,se,qe)}for(ue in se)if(ge=se[ue],qe=Y[ue],se.hasOwnProperty(ue)&&(ge!=null||qe!=null))switch(ue){case"value":Rt=ge;break;case"defaultValue":Me=ge;break;case"multiple":we=ge;default:ge!==qe&&Hr(M,D,ue,ge,se,qe)}D=Me,Y=we,se=Tt,Rt!=null?nn(M,!!Y,Rt,!1):!!se!=!!Y&&(D!=null?nn(M,!!Y,D,!0):nn(M,!!Y,Y?[]:"",!1));return;case"textarea":Tt=Rt=null;for(Me in Y)if(ue=Y[Me],Y.hasOwnProperty(Me)&&ue!=null&&!se.hasOwnProperty(Me))switch(Me){case"value":break;case"children":break;default:Hr(M,D,Me,null,se,ue)}for(we in se)if(ue=se[we],ge=Y[we],se.hasOwnProperty(we)&&(ue!=null||ge!=null))switch(we){case"value":Rt=ue;break;case"defaultValue":Tt=ue;break;case"children":break;case"dangerouslySetInnerHTML":if(ue!=null)throw Error(w(91));break;default:ue!==ge&&Hr(M,D,we,ue,se,ge)}cs(M,Rt,Tt);return;case"option":for(var _r in Y)if(Rt=Y[_r],Y.hasOwnProperty(_r)&&Rt!=null&&!se.hasOwnProperty(_r))switch(_r){case"selected":M.selected=!1;break;default:Hr(M,D,_r,null,se,Rt)}for(qe in se)if(Rt=se[qe],Tt=Y[qe],se.hasOwnProperty(qe)&&Rt!==Tt&&(Rt!=null||Tt!=null))switch(qe){case"selected":M.selected=Rt&&typeof Rt!="function"&&typeof Rt!="symbol";break;default:Hr(M,D,qe,Rt,se,Tt)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Tr in Y)Rt=Y[Tr],Y.hasOwnProperty(Tr)&&Rt!=null&&!se.hasOwnProperty(Tr)&&Hr(M,D,Tr,null,se,Rt);for(St in se)if(Rt=se[St],Tt=Y[St],se.hasOwnProperty(St)&&Rt!==Tt&&(Rt!=null||Tt!=null))switch(St){case"children":case"dangerouslySetInnerHTML":if(Rt!=null)throw Error(w(137,D));break;default:Hr(M,D,St,Rt,se,Tt)}return;default:if(ko(D)){for(var Wr in Y)Rt=Y[Wr],Y.hasOwnProperty(Wr)&&Rt!==void 0&&!se.hasOwnProperty(Wr)&&Sd(M,D,Wr,void 0,se,Rt);for(Zt in se)Rt=se[Zt],Tt=Y[Zt],!se.hasOwnProperty(Zt)||Rt===Tt||Rt===void 0&&Tt===void 0||Sd(M,D,Zt,Rt,se,Tt);return}}for(var ot in Y)Rt=Y[ot],Y.hasOwnProperty(ot)&&Rt!=null&&!se.hasOwnProperty(ot)&&Hr(M,D,ot,null,se,Rt);for(or in se)Rt=se[or],Tt=Y[or],!se.hasOwnProperty(or)||Rt===Tt||Rt==null&&Tt==null||Hr(M,D,or,Rt,se,Tt)}var Cd=null,Ed=null;function ec(M){return M.nodeType===9?M:M.ownerDocument}function kf(M){switch(M){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _f(M,D){if(M===0)switch(D){case"svg":return 1;case"math":return 2;default:return 0}return M===1&&D==="foreignObject"?0:M}function wd(M,D){return M==="textarea"||M==="noscript"||typeof D.children=="string"||typeof D.children=="number"||typeof D.children=="bigint"||typeof D.dangerouslySetInnerHTML=="object"&&D.dangerouslySetInnerHTML!==null&&D.dangerouslySetInnerHTML.__html!=null}var Rd=null;function lg(){var M=window.event;return M&&M.type==="popstate"?M===Rd?!1:(Rd=M,!0):(Rd=null,!1)}var Af=typeof setTimeout=="function"?setTimeout:void 0,cg=typeof clearTimeout=="function"?clearTimeout:void 0,Pf=typeof Promise=="function"?Promise:void 0,ug=typeof queueMicrotask=="function"?queueMicrotask:typeof Pf<"u"?function(M){return Pf.resolve(null).then(M).catch(dg)}:Af;function dg(M){setTimeout(function(){throw M})}function uo(M){return M==="head"}function Mf(M,D){var Y=D,se=0,ue=0;do{var ge=Y.nextSibling;if(M.removeChild(Y),ge&&ge.nodeType===8)if(Y=ge.data,Y==="/$"){if(0<se&&8>se){Y=se;var we=M.ownerDocument;if(Y&1&&qa(we.documentElement),Y&2&&qa(we.body),Y&4)for(Y=we.head,qa(Y),we=Y.firstChild;we;){var Me=we.nextSibling,qe=we.nodeName;we[Kr]||qe==="SCRIPT"||qe==="STYLE"||qe==="LINK"&&we.rel.toLowerCase()==="stylesheet"||Y.removeChild(we),we=Me}}if(ue===0){M.removeChild(ge),Ya(D);return}ue--}else Y==="$"||Y==="$?"||Y==="$!"?ue++:se=Y.charCodeAt(0)-48;else se=0;Y=ge}while(Y);Ya(D)}function Td(M){var D=M.firstChild;for(D&&D.nodeType===10&&(D=D.nextSibling);D;){var Y=D;switch(D=D.nextSibling,Y.nodeName){case"HTML":case"HEAD":case"BODY":Td(Y),Ur(Y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(Y.rel.toLowerCase()==="stylesheet")continue}M.removeChild(Y)}}function pg(M,D,Y,se){for(;M.nodeType===1;){var ue=Y;if(M.nodeName.toLowerCase()!==D.toLowerCase()){if(!se&&(M.nodeName!=="INPUT"||M.type!=="hidden"))break}else if(se){if(!M[Kr])switch(D){case"meta":if(!M.hasAttribute("itemprop"))break;return M;case"link":if(ge=M.getAttribute("rel"),ge==="stylesheet"&&M.hasAttribute("data-precedence"))break;if(ge!==ue.rel||M.getAttribute("href")!==(ue.href==null||ue.href===""?null:ue.href)||M.getAttribute("crossorigin")!==(ue.crossOrigin==null?null:ue.crossOrigin)||M.getAttribute("title")!==(ue.title==null?null:ue.title))break;return M;case"style":if(M.hasAttribute("data-precedence"))break;return M;case"script":if(ge=M.getAttribute("src"),(ge!==(ue.src==null?null:ue.src)||M.getAttribute("type")!==(ue.type==null?null:ue.type)||M.getAttribute("crossorigin")!==(ue.crossOrigin==null?null:ue.crossOrigin))&&ge&&M.hasAttribute("async")&&!M.hasAttribute("itemprop"))break;return M;default:return M}}else if(D==="input"&&M.type==="hidden"){var ge=ue.name==null?null:""+ue.name;if(ue.type==="hidden"&&M.getAttribute("name")===ge)return M}else return M;if(M=en(M.nextSibling),M===null)break}return null}function hg(M,D,Y){if(D==="")return null;for(;M.nodeType!==3;)if((M.nodeType!==1||M.nodeName!=="INPUT"||M.type!=="hidden")&&!Y||(M=en(M.nextSibling),M===null))return null;return M}function kd(M){return M.data==="$!"||M.data==="$?"&&M.ownerDocument.readyState==="complete"}function fg(M,D){var Y=M.ownerDocument;if(M.data!=="$?"||Y.readyState==="complete")D();else{var se=function(){D(),Y.removeEventListener("DOMContentLoaded",se)};Y.addEventListener("DOMContentLoaded",se),M._reactRetry=se}}function en(M){for(;M!=null;M=M.nextSibling){var D=M.nodeType;if(D===1||D===3)break;if(D===8){if(D=M.data,D==="$"||D==="$!"||D==="$?"||D==="F!"||D==="F")break;if(D==="/$")return null}}return M}var _d=null;function If(M){M=M.previousSibling;for(var D=0;M;){if(M.nodeType===8){var Y=M.data;if(Y==="$"||Y==="$!"||Y==="$?"){if(D===0)return M;D--}else Y==="/$"&&D++}M=M.previousSibling}return null}function Of(M,D,Y){switch(D=ec(Y),M){case"html":if(M=D.documentElement,!M)throw Error(w(452));return M;case"head":if(M=D.head,!M)throw Error(w(453));return M;case"body":if(M=D.body,!M)throw Error(w(454));return M;default:throw Error(w(451))}}function qa(M){for(var D=M.attributes;D.length;)M.removeAttributeNode(D[0]);Ur(M)}var Wi=new Map,Df=new Set;function tc(M){return typeof M.getRootNode=="function"?M.getRootNode():M.nodeType===9?M:M.ownerDocument}var On=De.d;De.d={f:mg,r:gg,D:vg,C:bg,L:yg,m:xg,X:Cg,S:Sg,M:Eg};function mg(){var M=On.f(),D=Wl();return M||D}function gg(M){var D=ii(M);D!==null&&D.tag===5&&D.type==="form"?Qp(D):On.r(M)}var zs=typeof document>"u"?null:document;function Bf(M,D,Y){var se=zs;if(se&&typeof D=="string"&&D){var ue=xi(D);ue='link[rel="'+M+'"][href="'+ue+'"]',typeof Y=="string"&&(ue+='[crossorigin="'+Y+'"]'),Df.has(ue)||(Df.add(ue),M={rel:M,crossOrigin:Y,href:D},se.querySelector(ue)===null&&(D=se.createElement("link"),bi(D,"link",M),Zr(D),se.head.appendChild(D)))}}function vg(M){On.D(M),Bf("dns-prefetch",M,null)}function bg(M,D){On.C(M,D),Bf("preconnect",M,D)}function yg(M,D,Y){On.L(M,D,Y);var se=zs;if(se&&M&&D){var ue='link[rel="preload"][as="'+xi(D)+'"]';D==="image"&&Y&&Y.imageSrcSet?(ue+='[imagesrcset="'+xi(Y.imageSrcSet)+'"]',typeof Y.imageSizes=="string"&&(ue+='[imagesizes="'+xi(Y.imageSizes)+'"]')):ue+='[href="'+xi(M)+'"]';var ge=ue;switch(D){case"style":ge=Hs(M);break;case"script":ge=Ws(M)}Wi.has(ge)||(M=H({rel:"preload",href:D==="image"&&Y&&Y.imageSrcSet?void 0:M,as:D},Y),Wi.set(ge,M),se.querySelector(ue)!==null||D==="style"&&se.querySelector($a(ge))||D==="script"&&se.querySelector(za(ge))||(D=se.createElement("link"),bi(D,"link",M),Zr(D),se.head.appendChild(D)))}}function xg(M,D){On.m(M,D);var Y=zs;if(Y&&M){var se=D&&typeof D.as=="string"?D.as:"script",ue='link[rel="modulepreload"][as="'+xi(se)+'"][href="'+xi(M)+'"]',ge=ue;switch(se){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":ge=Ws(M)}if(!Wi.has(ge)&&(M=H({rel:"modulepreload",href:M},D),Wi.set(ge,M),Y.querySelector(ue)===null)){switch(se){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(Y.querySelector(za(ge)))return}se=Y.createElement("link"),bi(se,"link",M),Zr(se),Y.head.appendChild(se)}}}function Sg(M,D,Y){On.S(M,D,Y);var se=zs;if(se&&M){var ue=Ai(se).hoistableStyles,ge=Hs(M);D=D||"default";var we=ue.get(ge);if(!we){var Me={loading:0,preload:null};if(we=se.querySelector($a(ge)))Me.loading=5;else{M=H({rel:"stylesheet",href:M,"data-precedence":D},Y),(Y=Wi.get(ge))&&Ad(M,Y);var qe=we=se.createElement("link");Zr(qe),bi(qe,"link",M),qe._p=new Promise(function(St,Zt){qe.onload=St,qe.onerror=Zt}),qe.addEventListener("load",function(){Me.loading|=1}),qe.addEventListener("error",function(){Me.loading|=2}),Me.loading|=4,rc(we,D,se)}we={type:"stylesheet",instance:we,count:1,state:Me},ue.set(ge,we)}}}function Cg(M,D){On.X(M,D);var Y=zs;if(Y&&M){var se=Ai(Y).hoistableScripts,ue=Ws(M),ge=se.get(ue);ge||(ge=Y.querySelector(za(ue)),ge||(M=H({src:M,async:!0},D),(D=Wi.get(ue))&&Pd(M,D),ge=Y.createElement("script"),Zr(ge),bi(ge,"link",M),Y.head.appendChild(ge)),ge={type:"script",instance:ge,count:1,state:null},se.set(ue,ge))}}function Eg(M,D){On.M(M,D);var Y=zs;if(Y&&M){var se=Ai(Y).hoistableScripts,ue=Ws(M),ge=se.get(ue);ge||(ge=Y.querySelector(za(ue)),ge||(M=H({src:M,async:!0,type:"module"},D),(D=Wi.get(ue))&&Pd(M,D),ge=Y.createElement("script"),Zr(ge),bi(ge,"link",M),Y.head.appendChild(ge)),ge={type:"script",instance:ge,count:1,state:null},se.set(ue,ge))}}function jf(M,D,Y,se){var ue=(ue=Ve.current)?tc(ue):null;if(!ue)throw Error(w(446));switch(M){case"meta":case"title":return null;case"style":return typeof Y.precedence=="string"&&typeof Y.href=="string"?(D=Hs(Y.href),Y=Ai(ue).hoistableStyles,se=Y.get(D),se||(se={type:"style",instance:null,count:0,state:null},Y.set(D,se)),se):{type:"void",instance:null,count:0,state:null};case"link":if(Y.rel==="stylesheet"&&typeof Y.href=="string"&&typeof Y.precedence=="string"){M=Hs(Y.href);var ge=Ai(ue).hoistableStyles,we=ge.get(M);if(we||(ue=ue.ownerDocument||ue,we={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},ge.set(M,we),(ge=ue.querySelector($a(M)))&&!ge._p&&(we.instance=ge,we.state.loading=5),Wi.has(M)||(Y={rel:"preload",as:"style",href:Y.href,crossOrigin:Y.crossOrigin,integrity:Y.integrity,media:Y.media,hrefLang:Y.hrefLang,referrerPolicy:Y.referrerPolicy},Wi.set(M,Y),ge||wg(ue,M,Y,we.state))),D&&se===null)throw Error(w(528,""));return we}if(D&&se!==null)throw Error(w(529,""));return null;case"script":return D=Y.async,Y=Y.src,typeof Y=="string"&&D&&typeof D!="function"&&typeof D!="symbol"?(D=Ws(Y),Y=Ai(ue).hoistableScripts,se=Y.get(D),se||(se={type:"script",instance:null,count:0,state:null},Y.set(D,se)),se):{type:"void",instance:null,count:0,state:null};default:throw Error(w(444,M))}}function Hs(M){return'href="'+xi(M)+'"'}function $a(M){return'link[rel="stylesheet"]['+M+"]"}function Lf(M){return H({},M,{"data-precedence":M.precedence,precedence:null})}function wg(M,D,Y,se){M.querySelector('link[rel="preload"][as="style"]['+D+"]")?se.loading=1:(D=M.createElement("link"),se.preload=D,D.addEventListener("load",function(){return se.loading|=1}),D.addEventListener("error",function(){return se.loading|=2}),bi(D,"link",Y),Zr(D),M.head.appendChild(D))}function Ws(M){return'[src="'+xi(M)+'"]'}function za(M){return"script[async]"+M}function Ff(M,D,Y){if(D.count++,D.instance===null)switch(D.type){case"style":var se=M.querySelector('style[data-href~="'+xi(Y.href)+'"]');if(se)return D.instance=se,Zr(se),se;var ue=H({},Y,{"data-href":Y.href,"data-precedence":Y.precedence,href:null,precedence:null});return se=(M.ownerDocument||M).createElement("style"),Zr(se),bi(se,"style",ue),rc(se,Y.precedence,M),D.instance=se;case"stylesheet":ue=Hs(Y.href);var ge=M.querySelector($a(ue));if(ge)return D.state.loading|=4,D.instance=ge,Zr(ge),ge;se=Lf(Y),(ue=Wi.get(ue))&&Ad(se,ue),ge=(M.ownerDocument||M).createElement("link"),Zr(ge);var we=ge;return we._p=new Promise(function(Me,qe){we.onload=Me,we.onerror=qe}),bi(ge,"link",se),D.state.loading|=4,rc(ge,Y.precedence,M),D.instance=ge;case"script":return ge=Ws(Y.src),(ue=M.querySelector(za(ge)))?(D.instance=ue,Zr(ue),ue):(se=Y,(ue=Wi.get(ge))&&(se=H({},Y),Pd(se,ue)),M=M.ownerDocument||M,ue=M.createElement("script"),Zr(ue),bi(ue,"link",se),M.head.appendChild(ue),D.instance=ue);case"void":return null;default:throw Error(w(443,D.type))}else D.type==="stylesheet"&&(D.state.loading&4)===0&&(se=D.instance,D.state.loading|=4,rc(se,Y.precedence,M));return D.instance}function rc(M,D,Y){for(var se=Y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),ue=se.length?se[se.length-1]:null,ge=ue,we=0;we<se.length;we++){var Me=se[we];if(Me.dataset.precedence===D)ge=Me;else if(ge!==ue)break}ge?ge.parentNode.insertBefore(M,ge.nextSibling):(D=Y.nodeType===9?Y.head:Y,D.insertBefore(M,D.firstChild))}function Ad(M,D){M.crossOrigin==null&&(M.crossOrigin=D.crossOrigin),M.referrerPolicy==null&&(M.referrerPolicy=D.referrerPolicy),M.title==null&&(M.title=D.title)}function Pd(M,D){M.crossOrigin==null&&(M.crossOrigin=D.crossOrigin),M.referrerPolicy==null&&(M.referrerPolicy=D.referrerPolicy),M.integrity==null&&(M.integrity=D.integrity)}var ic=null;function Vf(M,D,Y){if(ic===null){var se=new Map,ue=ic=new Map;ue.set(Y,se)}else ue=ic,se=ue.get(Y),se||(se=new Map,ue.set(Y,se));if(se.has(M))return se;for(se.set(M,null),Y=Y.getElementsByTagName(M),ue=0;ue<Y.length;ue++){var ge=Y[ue];if(!(ge[Kr]||ge[fr]||M==="link"&&ge.getAttribute("rel")==="stylesheet")&&ge.namespaceURI!=="http://www.w3.org/2000/svg"){var we=ge.getAttribute(D)||"";we=M+we;var Me=se.get(we);Me?Me.push(ge):se.set(we,[ge])}}return se}function Nf(M,D,Y){M=M.ownerDocument||M,M.head.insertBefore(Y,D==="title"?M.querySelector("head > title"):null)}function Rg(M,D,Y){if(Y===1||D.itemProp!=null)return!1;switch(M){case"meta":case"title":return!0;case"style":if(typeof D.precedence!="string"||typeof D.href!="string"||D.href==="")break;return!0;case"link":if(typeof D.rel!="string"||typeof D.href!="string"||D.href===""||D.onLoad||D.onError)break;switch(D.rel){case"stylesheet":return M=D.disabled,typeof D.precedence=="string"&&M==null;default:return!0}case"script":if(D.async&&typeof D.async!="function"&&typeof D.async!="symbol"&&!D.onLoad&&!D.onError&&D.src&&typeof D.src=="string")return!0}return!1}function Uf(M){return!(M.type==="stylesheet"&&(M.state.loading&3)===0)}var Ha=null;function Tg(){}function kg(M,D,Y){if(Ha===null)throw Error(w(475));var se=Ha;if(D.type==="stylesheet"&&(typeof Y.media!="string"||matchMedia(Y.media).matches!==!1)&&(D.state.loading&4)===0){if(D.instance===null){var ue=Hs(Y.href),ge=M.querySelector($a(ue));if(ge){M=ge._p,M!==null&&typeof M=="object"&&typeof M.then=="function"&&(se.count++,se=nc.bind(se),M.then(se,se)),D.state.loading|=4,D.instance=ge,Zr(ge);return}ge=M.ownerDocument||M,Y=Lf(Y),(ue=Wi.get(ue))&&Ad(Y,ue),ge=ge.createElement("link"),Zr(ge);var we=ge;we._p=new Promise(function(Me,qe){we.onload=Me,we.onerror=qe}),bi(ge,"link",Y),D.instance=ge}se.stylesheets===null&&(se.stylesheets=new Map),se.stylesheets.set(D,M),(M=D.state.preload)&&(D.state.loading&3)===0&&(se.count++,D=nc.bind(se),M.addEventListener("load",D),M.addEventListener("error",D))}}function _g(){if(Ha===null)throw Error(w(475));var M=Ha;return M.stylesheets&&M.count===0&&Md(M,M.stylesheets),0<M.count?function(D){var Y=setTimeout(function(){if(M.stylesheets&&Md(M,M.stylesheets),M.unsuspend){var se=M.unsuspend;M.unsuspend=null,se()}},6e4);return M.unsuspend=D,function(){M.unsuspend=null,clearTimeout(Y)}}:null}function nc(){if(this.count--,this.count===0){if(this.stylesheets)Md(this,this.stylesheets);else if(this.unsuspend){var M=this.unsuspend;this.unsuspend=null,M()}}}var oc=null;function Md(M,D){M.stylesheets=null,M.unsuspend!==null&&(M.count++,oc=new Map,D.forEach(Ag,M),oc=null,nc.call(M))}function Ag(M,D){if(!(D.state.loading&4)){var Y=oc.get(M);if(Y)var se=Y.get(null);else{Y=new Map,oc.set(M,Y);for(var ue=M.querySelectorAll("link[data-precedence],style[data-precedence]"),ge=0;ge<ue.length;ge++){var we=ue[ge];(we.nodeName==="LINK"||we.getAttribute("media")!=="not all")&&(Y.set(we.dataset.precedence,we),se=we)}se&&Y.set(null,se)}ue=D.instance,we=ue.getAttribute("data-precedence"),ge=Y.get(we)||se,ge===se&&Y.set(null,ue),Y.set(we,ue),this.count++,se=nc.bind(this),ue.addEventListener("load",se),ue.addEventListener("error",se),ge?ge.parentNode.insertBefore(ue,ge.nextSibling):(M=M.nodeType===9?M.head:M,M.insertBefore(ue,M.firstChild)),D.state.loading|=4}}var Wa={$$typeof:de,Provider:null,Consumer:null,_currentValue:Ue,_currentValue2:Ue,_threadCount:0};function Pg(M,D,Y,se,ue,ge,we,Me){this.tag=1,this.containerInfo=M,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=jt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(0),this.hiddenUpdates=jt(null),this.identifierPrefix=se,this.onUncaughtError=ue,this.onCaughtError=ge,this.onRecoverableError=we,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Me,this.incompleteTransitions=new Map}function qf(M,D,Y,se,ue,ge,we,Me,qe,St,Zt,or){return M=new Pg(M,D,Y,we,Me,qe,St,or),D=1,ge===!0&&(D|=24),ge=Ii(3,null,null,D),M.current=ge,ge.stateNode=M,D=pu(),D.refCount++,M.pooledCache=D,D.refCount++,ge.memoizedState={element:se,isDehydrated:Y,cache:D},gu(ge),M}function $f(M){return M?(M=Cs,M):Cs}function zf(M,D,Y,se,ue,ge){ue=$f(ue),se.context===null?se.context=ue:se.pendingContext=ue,se=Hn(D),se.payload={element:Y},ge=ge===void 0?null:ge,ge!==null&&(se.callback=ge),Y=Wn(M,se,D),Y!==null&&(Li(Y,M,D),Sa(Y,M,D))}function Hf(M,D){if(M=M.memoizedState,M!==null&&M.dehydrated!==null){var Y=M.retryLane;M.retryLane=Y!==0&&Y<D?Y:D}}function Id(M,D){Hf(M,D),(M=M.alternate)&&Hf(M,D)}function Wf(M){if(M.tag===13){var D=Ss(M,67108864);D!==null&&Li(D,M,67108864),Id(M,67108864)}}var sc=!0;function Mg(M,D,Y,se){var ue=Te.T;Te.T=null;var ge=De.p;try{De.p=2,Od(M,D,Y,se)}finally{De.p=ge,Te.T=ue}}function Ig(M,D,Y,se){var ue=Te.T;Te.T=null;var ge=De.p;try{De.p=8,Od(M,D,Y,se)}finally{De.p=ge,Te.T=ue}}function Od(M,D,Y,se){if(sc){var ue=Dd(se);if(ue===null)xd(M,D,se,ac,Y),Kf(M,se);else if(Dg(ue,M,D,Y,se))se.stopPropagation();else if(Kf(M,se),D&4&&-1<Og.indexOf(M)){for(;ue!==null;){var ge=ii(ue);if(ge!==null)switch(ge.tag){case 3:if(ge=ge.stateNode,ge.current.memoizedState.isDehydrated){var we=Je(ge.pendingLanes);if(we!==0){var Me=ge;for(Me.pendingLanes|=2,Me.entangledLanes|=2;we;){var qe=1<<31-ke(we);Me.entanglements[1]|=qe,we&=~qe}mn(ge),(qr&6)===0&&(zl=ur()+500,Va(0))}}break;case 13:Me=Ss(ge,2),Me!==null&&Li(Me,ge,2),Wl(),Id(ge,2)}if(ge=Dd(se),ge===null&&xd(M,D,se,ac,Y),ge===ue)break;ue=ge}ue!==null&&se.stopPropagation()}else xd(M,D,se,null,Y)}}function Dd(M){return M=Po(M),Bd(M)}var ac=null;function Bd(M){if(ac=null,M=ai(M),M!==null){var D=_(M);if(D===null)M=null;else{var Y=D.tag;if(Y===13){if(M=S(D),M!==null)return M;M=null}else if(Y===3){if(D.stateNode.current.memoizedState.isDehydrated)return D.tag===3?D.stateNode.containerInfo:null;M=null}else D!==M&&(M=null)}}return ac=M,null}function Gf(M){switch(M){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Sr()){case hr:return 2;case yr:return 8;case xr:case Yt:return 32;case Jt:return 268435456;default:return 32}default:return 32}}var jd=!1,po=null,ho=null,fo=null,Ga=new Map,Ka=new Map,mo=[],Og="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Kf(M,D){switch(M){case"focusin":case"focusout":po=null;break;case"dragenter":case"dragleave":ho=null;break;case"mouseover":case"mouseout":fo=null;break;case"pointerover":case"pointerout":Ga.delete(D.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ka.delete(D.pointerId)}}function Ja(M,D,Y,se,ue,ge){return M===null||M.nativeEvent!==ge?(M={blockedOn:D,domEventName:Y,eventSystemFlags:se,nativeEvent:ge,targetContainers:[ue]},D!==null&&(D=ii(D),D!==null&&Wf(D)),M):(M.eventSystemFlags|=se,D=M.targetContainers,ue!==null&&D.indexOf(ue)===-1&&D.push(ue),M)}function Dg(M,D,Y,se,ue){switch(D){case"focusin":return po=Ja(po,M,D,Y,se,ue),!0;case"dragenter":return ho=Ja(ho,M,D,Y,se,ue),!0;case"mouseover":return fo=Ja(fo,M,D,Y,se,ue),!0;case"pointerover":var ge=ue.pointerId;return Ga.set(ge,Ja(Ga.get(ge)||null,M,D,Y,se,ue)),!0;case"gotpointercapture":return ge=ue.pointerId,Ka.set(ge,Ja(Ka.get(ge)||null,M,D,Y,se,ue)),!0}return!1}function Jf(M){var D=ai(M.target);if(D!==null){var Y=_(D);if(Y!==null){if(D=Y.tag,D===13){if(D=S(Y),D!==null){M.blockedOn=D,Dt(M.priority,function(){if(Y.tag===13){var se=ji();se=Xe(se);var ue=Ss(Y,se);ue!==null&&Li(ue,Y,se),Id(Y,se)}});return}}else if(D===3&&Y.stateNode.current.memoizedState.isDehydrated){M.blockedOn=Y.tag===3?Y.stateNode.containerInfo:null;return}}}M.blockedOn=null}function lc(M){if(M.blockedOn!==null)return!1;for(var D=M.targetContainers;0<D.length;){var Y=Dd(M.nativeEvent);if(Y===null){Y=M.nativeEvent;var se=new Y.constructor(Y.type,Y);Ao=se,Y.target.dispatchEvent(se),Ao=null}else return D=ii(Y),D!==null&&Wf(D),M.blockedOn=Y,!1;D.shift()}return!0}function Yf(M,D,Y){lc(M)&&Y.delete(D)}function Bg(){jd=!1,po!==null&&lc(po)&&(po=null),ho!==null&&lc(ho)&&(ho=null),fo!==null&&lc(fo)&&(fo=null),Ga.forEach(Yf),Ka.forEach(Yf)}function cc(M,D){M.blockedOn===D&&(M.blockedOn=null,jd||(jd=!0,x.unstable_scheduleCallback(x.unstable_NormalPriority,Bg)))}var uc=null;function Xf(M){uc!==M&&(uc=M,x.unstable_scheduleCallback(x.unstable_NormalPriority,function(){uc===M&&(uc=null);for(var D=0;D<M.length;D+=3){var Y=M[D],se=M[D+1],ue=M[D+2];if(typeof se!="function"){if(Bd(se||Y)===null)continue;break}var ge=ii(Y);ge!==null&&(M.splice(D,3),D-=3,Bu(ge,{pending:!0,data:ue,method:Y.method,action:se},se,ue))}}))}function Ya(M){function D(qe){return cc(qe,M)}po!==null&&cc(po,M),ho!==null&&cc(ho,M),fo!==null&&cc(fo,M),Ga.forEach(D),Ka.forEach(D);for(var Y=0;Y<mo.length;Y++){var se=mo[Y];se.blockedOn===M&&(se.blockedOn=null)}for(;0<mo.length&&(Y=mo[0],Y.blockedOn===null);)Jf(Y),Y.blockedOn===null&&mo.shift();if(Y=(M.ownerDocument||M).$$reactFormReplay,Y!=null)for(se=0;se<Y.length;se+=3){var ue=Y[se],ge=Y[se+1],we=ue[dr]||null;if(typeof ge=="function")we||Xf(Y);else if(we){var Me=null;if(ge&&ge.hasAttribute("formAction")){if(ue=ge,we=ge[dr]||null)Me=we.formAction;else if(Bd(ue)!==null)continue}else Me=we.action;typeof Me=="function"?Y[se+1]=Me:(Y.splice(se,3),se-=3),Xf(Y)}}}function Ld(M){this._internalRoot=M}dc.prototype.render=Ld.prototype.render=function(M){var D=this._internalRoot;if(D===null)throw Error(w(409));var Y=D.current,se=ji();zf(Y,se,M,D,null,null)},dc.prototype.unmount=Ld.prototype.unmount=function(){var M=this._internalRoot;if(M!==null){this._internalRoot=null;var D=M.containerInfo;zf(M.current,2,null,M,null,null),Wl(),D[jr]=null}};function dc(M){this._internalRoot=M}dc.prototype.unstable_scheduleHydration=function(M){if(M){var D=ct();M={blockedOn:null,target:M,priority:D};for(var Y=0;Y<mo.length&&D!==0&&D<mo[Y].priority;Y++);mo.splice(Y,0,M),Y===0&&Jf(M)}};var Zf=C.version;if(Zf!=="19.1.1")throw Error(w(527,Zf,"19.1.1"));De.findDOMNode=function(M){var D=M._reactInternals;if(D===void 0)throw typeof M.render=="function"?Error(w(188)):(M=Object.keys(M).join(","),Error(w(268,M)));return M=A(D),M=M!==null?O(M):null,M=M===null?null:M.stateNode,M};var jg={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:Te,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var pc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pc.isDisabled&&pc.supportsFiber)try{zt=pc.inject(jg),Ft=pc}catch{}}return reactDomClient_production.createRoot=function(M,D){if(!T(M))throw Error(w(299));var Y=!1,se="",ue=hh,ge=fh,we=mh,Me=null;return D!=null&&(D.unstable_strictMode===!0&&(Y=!0),D.identifierPrefix!==void 0&&(se=D.identifierPrefix),D.onUncaughtError!==void 0&&(ue=D.onUncaughtError),D.onCaughtError!==void 0&&(ge=D.onCaughtError),D.onRecoverableError!==void 0&&(we=D.onRecoverableError),D.unstable_transitionCallbacks!==void 0&&(Me=D.unstable_transitionCallbacks)),D=qf(M,1,!1,null,null,Y,se,ue,ge,we,Me,null),M[jr]=D.current,yd(M),new Ld(D)},reactDomClient_production.hydrateRoot=function(M,D,Y){if(!T(M))throw Error(w(299));var se=!1,ue="",ge=hh,we=fh,Me=mh,qe=null,St=null;return Y!=null&&(Y.unstable_strictMode===!0&&(se=!0),Y.identifierPrefix!==void 0&&(ue=Y.identifierPrefix),Y.onUncaughtError!==void 0&&(ge=Y.onUncaughtError),Y.onCaughtError!==void 0&&(we=Y.onCaughtError),Y.onRecoverableError!==void 0&&(Me=Y.onRecoverableError),Y.unstable_transitionCallbacks!==void 0&&(qe=Y.unstable_transitionCallbacks),Y.formState!==void 0&&(St=Y.formState)),D=qf(M,1,!0,D,Y??null,se,ue,ge,we,Me,qe,St),D.context=$f(null),Y=D.current,se=ji(),se=Xe(se),ue=Hn(se),ue.callback=null,Wn(Y,ue,se),Y=se,D.current.lanes=Y,vr(D,Y),mn(D),M[jr]=D.current,yd(M),new dc(D)},reactDomClient_production.version="19.1.1",reactDomClient_production}var hasRequiredClient;function requireClient(){if(hasRequiredClient)return client.exports;hasRequiredClient=1;function x(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(x)}catch(C){console.error(C)}}return x(),client.exports=requireReactDomClient_production(),client.exports}var clientExports=requireClient();const warn=(x,C,E,w)=>{const T=[E,{code:C,...w||{}}];if(x?.services?.logger?.forward)return x.services.logger.forward(T,"warn","react-i18next::",!0);isString$1(T[0])&&(T[0]=`react-i18next:: ${T[0]}`),x?.services?.logger?.warn?x.services.logger.warn(...T):console?.warn&&console.warn(...T)},alreadyWarned={},warnOnce=(x,C,E,w)=>{isString$1(E)&&alreadyWarned[E]||(isString$1(E)&&(alreadyWarned[E]=new Date),warn(x,C,E,w))},loadedClb=(x,C)=>()=>{if(x.isInitialized)C();else{const E=()=>{setTimeout(()=>{x.off("initialized",E)},0),C()};x.on("initialized",E)}},loadNamespaces=(x,C,E)=>{x.loadNamespaces(C,loadedClb(x,E))},loadLanguages=(x,C,E,w)=>{if(isString$1(E)&&(E=[E]),x.options.preload&&x.options.preload.indexOf(C)>-1)return loadNamespaces(x,E,w);E.forEach(T=>{x.options.ns.indexOf(T)<0&&x.options.ns.push(T)}),x.loadLanguages(C,loadedClb(x,w))},hasLoadedNamespace=(x,C,E={})=>!C.languages||!C.languages.length?(warnOnce(C,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:C.languages}),!0):C.hasLoadedNamespace(x,{lng:E.lng,precheck:(w,T)=>{if(E.bindI18n&&E.bindI18n.indexOf("languageChanging")>-1&&w.services.backendConnector.backend&&w.isLanguageChangingTo&&!T(w.isLanguageChangingTo,x))return!1}}),isString$1=x=>typeof x=="string",isObject$1=x=>typeof x=="object"&&x!==null,matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},unescapeHtmlEntity=x=>htmlEntities[x],unescape=x=>x.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape};const setDefaults=(x={})=>{defaultOptions={...defaultOptions,...x}},getDefaults$2=()=>defaultOptions;let i18nInstance;const setI18n=x=>{i18nInstance=x},getI18n=()=>i18nInstance,initReactI18next={type:"3rdParty",init(x){setDefaults(x.options.react),setI18n(x)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(C){C.forEach(E=>{this.usedNamespaces[E]||(this.usedNamespaces[E]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious=(x,C)=>{const E=reactExports.useRef();return reactExports.useEffect(()=>{E.current=x},[x,C]),E.current},alwaysNewT=(x,C,E,w)=>x.getFixedT(C,E,w),useMemoizedT=(x,C,E,w)=>reactExports.useCallback(alwaysNewT(x,C,E,w),[x,C,E,w]),useTranslation=(x,C={})=>{const{i18n:E}=C,{i18n:w,defaultNS:T}=reactExports.useContext(I18nContext)||{},_=E||w||getI18n();if(_&&!_.reportNamespaces&&(_.reportNamespaces=new ReportNamespaces),!_){warnOnce(_,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const ce=(he,me)=>isString$1(me)?me:isObject$1(me)&&isString$1(me.defaultValue)?me.defaultValue:Array.isArray(he)?he[he.length-1]:he,pe=[ce,{},!1];return pe.t=ce,pe.i18n={},pe.ready=!1,pe}_.options.react?.wait&&warnOnce(_,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const S={...getDefaults$2(),..._.options.react,...C},{useSuspense:R,keyPrefix:A}=S;let O=T||_.options?.defaultNS;O=isString$1(O)?[O]:O||["translation"],_.reportNamespaces.addUsedNamespaces?.(O);const H=(_.isInitialized||_.initializedStoreOnce)&&O.every(ce=>hasLoadedNamespace(ce,_,S)),ee=useMemoizedT(_,C.lng||null,S.nsMode==="fallback"?O:O[0],A),te=()=>ee,ie=()=>alwaysNewT(_,C.lng||null,S.nsMode==="fallback"?O:O[0],A),[ne,ae]=reactExports.useState(te);let oe=O.join();C.lng&&(oe=`${C.lng}${oe}`);const le=usePrevious(oe),fe=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:ce,bindI18nStore:pe}=S;fe.current=!0,!H&&!R&&(C.lng?loadLanguages(_,C.lng,O,()=>{fe.current&&ae(ie)}):loadNamespaces(_,O,()=>{fe.current&&ae(ie)})),H&&le&&le!==oe&&fe.current&&ae(ie);const he=()=>{fe.current&&ae(ie)};return ce&&_?.on(ce,he),pe&&_?.store.on(pe,he),()=>{fe.current=!1,_&&ce&&ce?.split(" ").forEach(me=>_.off(me,he)),pe&&_&&pe.split(" ").forEach(me=>_.store.off(me,he))}},[_,oe]),reactExports.useEffect(()=>{fe.current&&H&&ae(te)},[_,A,H]);const de=[ne,_,H];if(de.t=ne,de.i18n=_,de.ready=H,H||!H&&!R)return de;throw new Promise(ce=>{C.lng?loadLanguages(_,C.lng,O,()=>ce()):loadNamespaces(_,O,()=>ce())})};function r$1(x){var C,E,w="";if(typeof x=="string"||typeof x=="number")w+=x;else if(typeof x=="object")if(Array.isArray(x)){var T=x.length;for(C=0;C<T;C++)x[C]&&(E=r$1(x[C]))&&(w&&(w+=" "),w+=E)}else for(E in x)x[E]&&(w&&(w+=" "),w+=E);return w}function clsx(){for(var x,C,E=0,w="",T=arguments.length;E<T;E++)(x=arguments[E])&&(C=r$1(x))&&(w&&(w+=" "),w+=C);return w}function Mt(x){if(typeof document>"u")return;let C=document.head||document.getElementsByTagName("head")[0],E=document.createElement("style");E.type="text/css",C.firstChild?C.insertBefore(E,C.firstChild):C.appendChild(E),E.styleSheet?E.styleSheet.cssText=x:E.appendChild(document.createTextNode(x))}Mt(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
`);var L=x=>typeof x=="number"&&!isNaN(x),N=x=>typeof x=="string",P=x=>typeof x=="function",mt=x=>N(x)||L(x),B=x=>N(x)||P(x)?x:null,pt=(x,C)=>x===!1||L(x)&&x>0?x:C,z=x=>reactExports.isValidElement(x)||N(x)||P(x)||L(x);function Z(x,C,E=300){let{scrollHeight:w,style:T}=x;requestAnimationFrame(()=>{T.minHeight="initial",T.height=w+"px",T.transition=`all ${E}ms`,requestAnimationFrame(()=>{T.height="0",T.padding="0",T.margin="0",setTimeout(C,E)})})}function $({enter:x,exit:C,appendPosition:E=!1,collapse:w=!0,collapseDuration:T=300}){return function({children:_,position:S,preventExitTransition:R,done:A,nodeRef:O,isIn:H,playToast:ee}){let te=E?`${x}--${S}`:x,ie=E?`${C}--${S}`:C,ne=reactExports.useRef(0);return reactExports.useLayoutEffect(()=>{let ae=O.current,oe=te.split(" "),le=fe=>{fe.target===O.current&&(ee(),ae.removeEventListener("animationend",le),ae.removeEventListener("animationcancel",le),ne.current===0&&fe.type!=="animationcancel"&&ae.classList.remove(...oe))};ae.classList.add(...oe),ae.addEventListener("animationend",le),ae.addEventListener("animationcancel",le)},[]),reactExports.useEffect(()=>{let ae=O.current,oe=()=>{ae.removeEventListener("animationend",oe),w?Z(ae,A,T):A()};H||(R?oe():(ne.current=1,ae.className+=` ${ie}`,ae.addEventListener("animationend",oe)))},[H]),React.createElement(React.Fragment,null,_)}}function J(x,C){return{content:tt(x.content,x.props),containerId:x.props.containerId,id:x.props.toastId,theme:x.props.theme,type:x.props.type,data:x.props.data||{},isLoading:x.props.isLoading,icon:x.props.icon,reason:x.removalReason,status:C}}function tt(x,C,E=!1){return reactExports.isValidElement(x)&&!N(x.type)?reactExports.cloneElement(x,{closeToast:C.closeToast,toastProps:C,data:C.data,isPaused:E}):P(x)?x({closeToast:C.closeToast,toastProps:C,data:C.data,isPaused:E}):x}function yt({closeToast:x,theme:C,ariaLabel:E="close"}){return React.createElement("button",{className:`Toastify__close-button Toastify__close-button--${C}`,type:"button",onClick:w=>{w.stopPropagation(),x(!0)},"aria-label":E},React.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},React.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function gt({delay:x,isRunning:C,closeToast:E,type:w="default",hide:T,className:_,controlledProgress:S,progress:R,rtl:A,isIn:O,theme:H}){let ee=T||S&&R===0,te={animationDuration:`${x}ms`,animationPlayState:C?"running":"paused"};S&&(te.transform=`scaleX(${R})`);let ie=clsx("Toastify__progress-bar",S?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${H}`,`Toastify__progress-bar--${w}`,{"Toastify__progress-bar--rtl":A}),ne=P(_)?_({rtl:A,type:w,defaultClassName:ie}):clsx(ie,_),ae={[S&&R>=1?"onTransitionEnd":"onAnimationEnd"]:S&&R<1?null:()=>{O&&E()}};return React.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":ee},React.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${H} Toastify__progress-bar--${w}`}),React.createElement("div",{role:"progressbar","aria-hidden":ee?"true":"false","aria-label":"notification timer",className:ne,style:te,...ae}))}var Xt=1,at=()=>`${Xt++}`;function _t$1(x,C,E){let w=1,T=0,_=[],S=[],R=C,A=new Map,O=new Set,H=fe=>(O.add(fe),()=>O.delete(fe)),ee=()=>{S=Array.from(A.values()),O.forEach(fe=>fe())},te=({containerId:fe,toastId:de,updateId:ce})=>{let pe=fe?fe!==x:x!==1,he=A.has(de)&&ce==null;return pe||he},ie=(fe,de)=>{A.forEach(ce=>{var pe;(de==null||de===ce.props.toastId)&&((pe=ce.toggle)==null||pe.call(ce,fe))})},ne=fe=>{var de,ce;(ce=(de=fe.props)==null?void 0:de.onClose)==null||ce.call(de,fe.removalReason),fe.isActive=!1},ae=fe=>{if(fe==null)A.forEach(ne);else{let de=A.get(fe);de&&ne(de)}ee()},oe=()=>{T-=_.length,_=[]},le=fe=>{var de,ce;let{toastId:pe,updateId:he}=fe.props,me=he==null;fe.staleId&&A.delete(fe.staleId),fe.isActive=!0,A.set(pe,fe),ee(),E(J(fe,me?"added":"updated")),me&&((ce=(de=fe.props).onOpen)==null||ce.call(de))};return{id:x,props:R,observe:H,toggle:ie,removeToast:ae,toasts:A,clearQueue:oe,buildToast:(fe,de)=>{if(te(de))return;let{toastId:ce,updateId:pe,data:he,staleId:me,delay:ve}=de,ye=pe==null;ye&&T++;let Se={...R,style:R.toastStyle,key:w++,...Object.fromEntries(Object.entries(de).filter(([be,Ee])=>Ee!=null)),toastId:ce,updateId:pe,data:he,isIn:!1,className:B(de.className||R.toastClassName),progressClassName:B(de.progressClassName||R.progressClassName),autoClose:de.isLoading?!1:pt(de.autoClose,R.autoClose),closeToast(be){A.get(ce).removalReason=be,ae(ce)},deleteToast(){let be=A.get(ce);if(be!=null){if(E(J(be,"removed")),A.delete(ce),T--,T<0&&(T=0),_.length>0){le(_.shift());return}ee()}}};Se.closeButton=R.closeButton,de.closeButton===!1||z(de.closeButton)?Se.closeButton=de.closeButton:de.closeButton===!0&&(Se.closeButton=z(R.closeButton)?R.closeButton:!0);let Ce={content:fe,props:Se,staleId:me};R.limit&&R.limit>0&&T>R.limit&&ye?_.push(Ce):L(ve)?setTimeout(()=>{le(Ce)},ve):le(Ce)},setProps(fe){R=fe},setToggle:(fe,de)=>{let ce=A.get(fe);ce&&(ce.toggle=de)},isToastActive:fe=>{var de;return(de=A.get(fe))==null?void 0:de.isActive},getSnapshot:()=>S}}var I=new Map,F=[],st=new Set,Vt=x=>st.forEach(C=>C(x)),bt=()=>I.size>0;function Qt(){F.forEach(x=>nt(x.content,x.options)),F=[]}var vt=(x,{containerId:C})=>{var E;return(E=I.get(C||1))==null?void 0:E.toasts.get(x)};function X(x,C){var E;if(C)return!!((E=I.get(C))!=null&&E.isToastActive(x));let w=!1;return I.forEach(T=>{T.isToastActive(x)&&(w=!0)}),w}function ht(x){if(!bt()){F=F.filter(C=>x!=null&&C.options.toastId!==x);return}if(x==null||mt(x))I.forEach(C=>{C.removeToast(x)});else if(x&&("containerId"in x||"id"in x)){let C=I.get(x.containerId);C?C.removeToast(x.id):I.forEach(E=>{E.removeToast(x.id)})}}var Ct=(x={})=>{I.forEach(C=>{C.props.limit&&(!x.containerId||C.id===x.containerId)&&C.clearQueue()})};function nt(x,C){z(x)&&(bt()||F.push({content:x,options:C}),I.forEach(E=>{E.buildToast(x,C)}))}function xt(x){var C;(C=I.get(x.containerId||1))==null||C.setToggle(x.id,x.fn)}function rt(x,C){I.forEach(E=>{(C==null||!(C!=null&&C.containerId)||C?.containerId===E.id)&&E.toggle(x,C?.id)})}function Et(x){let C=x.containerId||1;return{subscribe(E){let w=_t$1(C,x,Vt);I.set(C,w);let T=w.observe(E);return Qt(),()=>{T(),I.delete(C)}},setProps(E){var w;(w=I.get(C))==null||w.setProps(E)},getSnapshot(){var E;return(E=I.get(C))==null?void 0:E.getSnapshot()}}}function Pt(x){return st.add(x),()=>{st.delete(x)}}function Wt(x){return x&&(N(x.toastId)||L(x.toastId))?x.toastId:at()}function U(x,C){return nt(x,C),C.toastId}function V(x,C){return{...C,type:C&&C.type||x,toastId:Wt(C)}}function Q(x){return(C,E)=>U(C,V(x,E))}function y(x,C){return U(x,V("default",C))}y.loading=(x,C)=>U(x,V("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...C}));function Gt(x,{pending:C,error:E,success:w},T){let _;C&&(_=N(C)?y.loading(C,T):y.loading(C.render,{...T,...C}));let S={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},R=(O,H,ee)=>{if(H==null){y.dismiss(_);return}let te={type:O,...S,...T,data:ee},ie=N(H)?{render:H}:H;return _?y.update(_,{...te,...ie}):y(ie.render,{...te,...ie}),ee},A=P(x)?x():x;return A.then(O=>R("success",w,O)).catch(O=>R("error",E,O)),A}y.promise=Gt;y.success=Q("success");y.info=Q("info");y.error=Q("error");y.warning=Q("warning");y.warn=y.warning;y.dark=(x,C)=>U(x,V("default",{theme:"dark",...C}));function qt(x){ht(x)}y.dismiss=qt;y.clearWaitingQueue=Ct;y.isActive=X;y.update=(x,C={})=>{let E=vt(x,C);if(E){let{props:w,content:T}=E,_={delay:100,...w,...C,toastId:C.toastId||x,updateId:at()};_.toastId!==x&&(_.staleId=x);let S=_.render||T;delete _.render,U(S,_)}};y.done=x=>{y.update(x,{progress:1})};y.onChange=Pt;y.play=x=>rt(!0,x);y.pause=x=>rt(!1,x);function It(x){var C;let{subscribe:E,getSnapshot:w,setProps:T}=reactExports.useRef(Et(x)).current;T(x);let _=(C=reactExports.useSyncExternalStore(E,w,w))==null?void 0:C.slice();function S(R){if(!_)return[];let A=new Map;return x.newestOnTop&&_.reverse(),_.forEach(O=>{let{position:H}=O.props;A.has(H)||A.set(H,[]),A.get(H).push(O)}),Array.from(A,O=>R(O[0],O[1]))}return{getToastToRender:S,isToastActive:X,count:_?.length}}function At(x){let[C,E]=reactExports.useState(!1),[w,T]=reactExports.useState(!1),_=reactExports.useRef(null),S=reactExports.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:R,pauseOnHover:A,closeToast:O,onClick:H,closeOnClick:ee}=x;xt({id:x.toastId,containerId:x.containerId,fn:E}),reactExports.useEffect(()=>{if(x.pauseOnFocusLoss)return te(),()=>{ie()}},[x.pauseOnFocusLoss]);function te(){document.hasFocus()||le(),window.addEventListener("focus",oe),window.addEventListener("blur",le)}function ie(){window.removeEventListener("focus",oe),window.removeEventListener("blur",le)}function ne(me){if(x.draggable===!0||x.draggable===me.pointerType){fe();let ve=_.current;S.canCloseOnClick=!0,S.canDrag=!0,ve.style.transition="none",x.draggableDirection==="x"?(S.start=me.clientX,S.removalDistance=ve.offsetWidth*(x.draggablePercent/100)):(S.start=me.clientY,S.removalDistance=ve.offsetHeight*(x.draggablePercent===80?x.draggablePercent*1.5:x.draggablePercent)/100)}}function ae(me){let{top:ve,bottom:ye,left:Se,right:Ce}=_.current.getBoundingClientRect();me.nativeEvent.type!=="touchend"&&x.pauseOnHover&&me.clientX>=Se&&me.clientX<=Ce&&me.clientY>=ve&&me.clientY<=ye?le():oe()}function oe(){E(!0)}function le(){E(!1)}function fe(){S.didMove=!1,document.addEventListener("pointermove",ce),document.addEventListener("pointerup",pe)}function de(){document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",pe)}function ce(me){let ve=_.current;if(S.canDrag&&ve){S.didMove=!0,C&&le(),x.draggableDirection==="x"?S.delta=me.clientX-S.start:S.delta=me.clientY-S.start,S.start!==me.clientX&&(S.canCloseOnClick=!1);let ye=x.draggableDirection==="x"?`${S.delta}px, var(--y)`:`0, calc(${S.delta}px + var(--y))`;ve.style.transform=`translate3d(${ye},0)`,ve.style.opacity=`${1-Math.abs(S.delta/S.removalDistance)}`}}function pe(){de();let me=_.current;if(S.canDrag&&S.didMove&&me){if(S.canDrag=!1,Math.abs(S.delta)>S.removalDistance){T(!0),x.closeToast(!0),x.collapseAll();return}me.style.transition="transform 0.2s, opacity 0.2s",me.style.removeProperty("transform"),me.style.removeProperty("opacity")}}let he={onPointerDown:ne,onPointerUp:ae};return R&&A&&(he.onMouseEnter=le,x.stacked||(he.onMouseLeave=oe)),ee&&(he.onClick=me=>{H&&H(me),S.canCloseOnClick&&O(!0)}),{playToast:oe,pauseToast:le,isRunning:C,preventExitTransition:w,toastRef:_,eventHandlers:he}}var Ot=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,G=({theme:x,type:C,isLoading:E,...w})=>React.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:x==="colored"?"currentColor":`var(--toastify-icon-color-${C})`,...w});function ao(x){return React.createElement(G,{...x},React.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function so(x){return React.createElement(G,{...x},React.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function no(x){return React.createElement(G,{...x},React.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function ro(x){return React.createElement(G,{...x},React.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function io(){return React.createElement("div",{className:"Toastify__spinner"})}var W={info:so,warning:ao,success:no,error:ro,spinner:io},lo=x=>x in W;function Nt({theme:x,type:C,isLoading:E,icon:w}){let T=null,_={theme:x,type:C};return w===!1||(P(w)?T=w({..._,isLoading:E}):reactExports.isValidElement(w)?T=reactExports.cloneElement(w,_):E?T=W.spinner():lo(C)&&(T=W[C](_))),T}var wt=x=>{let{isRunning:C,preventExitTransition:E,toastRef:w,eventHandlers:T,playToast:_}=At(x),{closeButton:S,children:R,autoClose:A,onClick:O,type:H,hideProgressBar:ee,closeToast:te,transition:ie,position:ne,className:ae,style:oe,progressClassName:le,updateId:fe,role:de,progress:ce,rtl:pe,toastId:he,deleteToast:me,isIn:ve,isLoading:ye,closeOnClick:Se,theme:Ce,ariaLabel:be}=x,Ee=clsx("Toastify__toast",`Toastify__toast-theme--${Ce}`,`Toastify__toast--${H}`,{"Toastify__toast--rtl":pe},{"Toastify__toast--close-on-click":Se}),Ae=P(ae)?ae({rtl:pe,position:ne,type:H,defaultClassName:Ee}):clsx(Ee,ae),Ie=Nt(x),Te=!!ce||!A,De={closeToast:te,type:H,theme:Ce},Ue=null;return S===!1||(P(S)?Ue=S(De):reactExports.isValidElement(S)?Ue=reactExports.cloneElement(S,De):Ue=yt(De)),React.createElement(ie,{isIn:ve,done:me,position:ne,preventExitTransition:E,nodeRef:w,playToast:_},React.createElement("div",{id:he,tabIndex:0,onClick:O,"data-in":ve,className:Ae,...T,style:oe,ref:w,...ve&&{role:de,"aria-label":be}},Ie!=null&&React.createElement("div",{className:clsx("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!ye})},Ie),tt(R,x,!C),Ue,!x.customProgressBar&&React.createElement(gt,{...fe&&!Te?{key:`p-${fe}`}:{},rtl:pe,theme:Ce,delay:A,isRunning:C,isIn:ve,closeToast:te,hide:ee,type:H,className:le,controlledProgress:Te,progress:ce||0})))},K=(x,C=!1)=>({enter:`Toastify--animate Toastify__${x}-enter`,exit:`Toastify--animate Toastify__${x}-exit`,appendPosition:C}),lt=$(K("bounce",!0)),_o$1={position:"top-right",transition:lt,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:x=>x.altKey&&x.code==="KeyT"};function Lt(x){let C={..._o$1,...x},E=x.stacked,[w,T]=reactExports.useState(!0),_=reactExports.useRef(null),{getToastToRender:S,isToastActive:R,count:A}=It(C),{className:O,style:H,rtl:ee,containerId:te,hotKeys:ie}=C;function ne(oe){let le=clsx("Toastify__toast-container",`Toastify__toast-container--${oe}`,{"Toastify__toast-container--rtl":ee});return P(O)?O({position:oe,rtl:ee,defaultClassName:le}):clsx(le,B(O))}function ae(){E&&(T(!0),y.play())}return Ot(()=>{var oe;if(E){let le=_.current.querySelectorAll('[data-in="true"]'),fe=12,de=(oe=C.position)==null?void 0:oe.includes("top"),ce=0,pe=0;Array.from(le).reverse().forEach((he,me)=>{let ve=he;ve.classList.add("Toastify__toast--stacked"),me>0&&(ve.dataset.collapsed=`${w}`),ve.dataset.pos||(ve.dataset.pos=de?"top":"bot");let ye=ce*(w?.2:1)+(w?0:fe*me);ve.style.setProperty("--y",`${de?ye:ye*-1}px`),ve.style.setProperty("--g",`${fe}`),ve.style.setProperty("--s",`${1-(w?pe:0)}`),ce+=ve.offsetHeight,pe+=.025})}},[w,A,E]),reactExports.useEffect(()=>{function oe(le){var fe;let de=_.current;ie(le)&&((fe=de.querySelector('[tabIndex="0"]'))==null||fe.focus(),T(!1),y.pause()),le.key==="Escape"&&(document.activeElement===de||de!=null&&de.contains(document.activeElement))&&(T(!0),y.play())}return document.addEventListener("keydown",oe),()=>{document.removeEventListener("keydown",oe)}},[ie]),React.createElement("section",{ref:_,className:"Toastify",id:te,onMouseEnter:()=>{E&&(T(!1),y.pause())},onMouseLeave:ae,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":C["aria-label"]},S((oe,le)=>{let fe=le.length?{...H}:{...H,pointerEvents:"none"};return React.createElement("div",{tabIndex:-1,className:ne(oe),"data-stacked":E,style:fe,key:`c-${oe}`},le.map(({content:de,props:ce})=>React.createElement(wt,{...ce,stacked:E,collapseAll:ae,isIn:R(ce.toastId,ce.containerId),key:`t-${ce.key}`},de)))}))}const AppRootContext=reactExports.createContext(null),useAppRoot=()=>{const{t:x}=useTranslation(),C=reactExports.useContext(AppRootContext);if(!C)throw new Error(x("common.error_messages.use_app_root_context_error"));return C},log$1=(x,C,...E)=>{x==="info"?console.log(C,...E):x==="warn"?console.warn(C,...E):x==="error"&&console.error(C,...E)};function composeClasses(x,C,E=void 0){const w={};for(const T in x){const _=x[T];let S="",R=!0;for(let A=0;A<_.length;A+=1){const O=_[A];O&&(S+=(R===!0?"":" ")+C(O),R=!1,E&&E[O]&&(S+=" "+E[O]))}w[T]=S}return w}function formatMuiErrorMessage(x,...C){const E=new URL(`https://mui.com/production-error/?code=${x}`);return C.forEach(w=>E.searchParams.append("args[]",w)),`Minified MUI error #${x}; visit ${E} for the full message.`}function capitalize(x){if(typeof x!="string")throw new Error(formatMuiErrorMessage(7));return x.charAt(0).toUpperCase()+x.slice(1)}function hasCorrectMainProperty(x){return typeof x.main=="string"}function checkSimplePaletteColorValues(x,C=[]){if(!hasCorrectMainProperty(x))return!1;for(const E of C)if(!x.hasOwnProperty(E)||typeof x[E]!="string")return!1;return!0}function createSimplePaletteValueFilter(x=[]){return([,C])=>C&&checkSimplePaletteColorValues(C,x)}function slotShouldForwardProp(x){return x!=="ownerState"&&x!=="theme"&&x!=="sx"&&x!=="as"}const rootShouldForwardProp=x=>slotShouldForwardProp(x)&&x!=="classes";var reactIs$1={exports:{}},reactIs_production={};/**
 * @license React
 * react-is.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredReactIs_production;function requireReactIs_production(){if(hasRequiredReactIs_production)return reactIs_production;hasRequiredReactIs_production=1;var x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),te=Symbol.for("react.view_transition"),ie=Symbol.for("react.client.reference");function ne(ae){if(typeof ae=="object"&&ae!==null){var oe=ae.$$typeof;switch(oe){case x:switch(ae=ae.type,ae){case E:case T:case w:case A:case O:case te:return ae;default:switch(ae=ae&&ae.$$typeof,ae){case S:case R:case ee:case H:return ae;case _:return ae;default:return oe}}case C:return oe}}}return reactIs_production.ContextConsumer=_,reactIs_production.ContextProvider=S,reactIs_production.Element=x,reactIs_production.ForwardRef=R,reactIs_production.Fragment=E,reactIs_production.Lazy=ee,reactIs_production.Memo=H,reactIs_production.Portal=C,reactIs_production.Profiler=T,reactIs_production.StrictMode=w,reactIs_production.Suspense=A,reactIs_production.SuspenseList=O,reactIs_production.isContextConsumer=function(ae){return ne(ae)===_},reactIs_production.isContextProvider=function(ae){return ne(ae)===S},reactIs_production.isElement=function(ae){return typeof ae=="object"&&ae!==null&&ae.$$typeof===x},reactIs_production.isForwardRef=function(ae){return ne(ae)===R},reactIs_production.isFragment=function(ae){return ne(ae)===E},reactIs_production.isLazy=function(ae){return ne(ae)===ee},reactIs_production.isMemo=function(ae){return ne(ae)===H},reactIs_production.isPortal=function(ae){return ne(ae)===C},reactIs_production.isProfiler=function(ae){return ne(ae)===T},reactIs_production.isStrictMode=function(ae){return ne(ae)===w},reactIs_production.isSuspense=function(ae){return ne(ae)===A},reactIs_production.isSuspenseList=function(ae){return ne(ae)===O},reactIs_production.isValidElementType=function(ae){return typeof ae=="string"||typeof ae=="function"||ae===E||ae===T||ae===w||ae===A||ae===O||typeof ae=="object"&&ae!==null&&(ae.$$typeof===ee||ae.$$typeof===H||ae.$$typeof===S||ae.$$typeof===_||ae.$$typeof===R||ae.$$typeof===ie||ae.getModuleId!==void 0)},reactIs_production.typeOf=ne,reactIs_production}var hasRequiredReactIs$1;function requireReactIs$1(){return hasRequiredReactIs$1||(hasRequiredReactIs$1=1,reactIs$1.exports=requireReactIs_production()),reactIs$1.exports}var reactIsExports=requireReactIs$1();function isPlainObject(x){if(typeof x!="object"||x===null)return!1;const C=Object.getPrototypeOf(x);return(C===null||C===Object.prototype||Object.getPrototypeOf(C)===null)&&!(Symbol.toStringTag in x)&&!(Symbol.iterator in x)}function deepClone(x){if(reactExports.isValidElement(x)||reactIsExports.isValidElementType(x)||!isPlainObject(x))return x;const C={};return Object.keys(x).forEach(E=>{C[E]=deepClone(x[E])}),C}function deepmerge(x,C,E={clone:!0}){const w=E.clone?{...x}:x;return isPlainObject(x)&&isPlainObject(C)&&Object.keys(C).forEach(T=>{reactExports.isValidElement(C[T])||reactIsExports.isValidElementType(C[T])?w[T]=C[T]:isPlainObject(C[T])&&Object.prototype.hasOwnProperty.call(x,T)&&isPlainObject(x[T])?w[T]=deepmerge(x[T],C[T],E):E.clone?w[T]=isPlainObject(C[T])?deepClone(C[T]):C[T]:w[T]=C[T]}),w}function merge(x,C){return C?deepmerge(x,C,{clone:!1}):x}function sortContainerQueries(x,C){if(!x.containerQueries)return C;const E=Object.keys(C).filter(w=>w.startsWith("@container")).sort((w,T)=>{const _=/min-width:\s*([0-9.]+)/;return+(w.match(_)?.[1]||0)-+(T.match(_)?.[1]||0)});return E.length?E.reduce((w,T)=>{const _=C[T];return delete w[T],w[T]=_,w},{...C}):C}function isCqShorthand(x,C){return C==="@"||C.startsWith("@")&&(x.some(E=>C.startsWith(`@${E}`))||!!C.match(/^@\d/))}function getContainerQuery(x,C){const E=C.match(/^@([^/]+)?\/?(.+)?$/);if(!E)return null;const[,w,T]=E,_=Number.isNaN(+w)?w||0:+w;return x.containerQueries(T).up(_)}function cssContainerQueries(x){const C=(_,S)=>_.replace("@media",S?`@container ${S}`:"@container");function E(_,S){_.up=(...R)=>C(x.breakpoints.up(...R),S),_.down=(...R)=>C(x.breakpoints.down(...R),S),_.between=(...R)=>C(x.breakpoints.between(...R),S),_.only=(...R)=>C(x.breakpoints.only(...R),S),_.not=(...R)=>{const A=C(x.breakpoints.not(...R),S);return A.includes("not all and")?A.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):A}}const w={},T=_=>(E(w,_),w);return E(T),{...x,containerQueries:T}}const values$1={xs:0,sm:600,md:900,lg:1200,xl:1536},defaultBreakpoints={keys:["xs","sm","md","lg","xl"],up:x=>`@media (min-width:${values$1[x]}px)`},defaultContainerQueries={containerQueries:x=>({up:C=>{let E=typeof C=="number"?C:values$1[C]||C;return typeof E=="number"&&(E=`${E}px`),x?`@container ${x} (min-width:${E})`:`@container (min-width:${E})`}})};function handleBreakpoints(x,C,E){const w=x.theme||{};if(Array.isArray(C)){const _=w.breakpoints||defaultBreakpoints;return C.reduce((S,R,A)=>(S[_.up(_.keys[A])]=E(C[A]),S),{})}if(typeof C=="object"){const _=w.breakpoints||defaultBreakpoints;return Object.keys(C).reduce((S,R)=>{if(isCqShorthand(_.keys,R)){const A=getContainerQuery(w.containerQueries?w:defaultContainerQueries,R);A&&(S[A]=E(C[R],R))}else if(Object.keys(_.values||values$1).includes(R)){const A=_.up(R);S[A]=E(C[R],R)}else{const A=R;S[A]=C[A]}return S},{})}return E(C)}function createEmptyBreakpointObject(x={}){return x.keys?.reduce((E,w)=>{const T=x.up(w);return E[T]={},E},{})||{}}function removeUnusedBreakpoints(x,C){return x.reduce((E,w)=>{const T=E[w];return(!T||Object.keys(T).length===0)&&delete E[w],E},C)}function mergeBreakpointsInOrder(x,...C){const E=createEmptyBreakpointObject(x),w=[E,...C].reduce((T,_)=>deepmerge(T,_),{});return removeUnusedBreakpoints(Object.keys(E),w)}function computeBreakpointsBase(x,C){if(typeof x!="object")return{};const E={},w=Object.keys(C);return Array.isArray(x)?w.forEach((T,_)=>{_<x.length&&(E[T]=!0)}):w.forEach(T=>{x[T]!=null&&(E[T]=!0)}),E}function resolveBreakpointValues({values:x,breakpoints:C,base:E}){const w=E||computeBreakpointsBase(x,C),T=Object.keys(w);if(T.length===0)return x;let _;return T.reduce((S,R,A)=>(Array.isArray(x)?(S[R]=x[A]!=null?x[A]:x[_],_=A):typeof x=="object"?(S[R]=x[R]!=null?x[R]:x[_],_=R):S[R]=x,S),{})}function getPath$1(x,C,E=!0){if(!C||typeof C!="string")return null;if(x&&x.vars&&E){const w=`vars.${C}`.split(".").reduce((T,_)=>T&&T[_]?T[_]:null,x);if(w!=null)return w}return C.split(".").reduce((w,T)=>w&&w[T]!=null?w[T]:null,x)}function getStyleValue$1(x,C,E,w=E){let T;return typeof x=="function"?T=x(E):Array.isArray(x)?T=x[E]||w:T=getPath$1(x,E)||w,C&&(T=C(T,w,x)),T}function style$2(x){const{prop:C,cssProperty:E=x.prop,themeKey:w,transform:T}=x,_=S=>{if(S[C]==null)return null;const R=S[C],A=S.theme,O=getPath$1(A,w)||{};return handleBreakpoints(S,R,ee=>{let te=getStyleValue$1(O,T,ee);return ee===te&&typeof ee=="string"&&(te=getStyleValue$1(O,T,`${C}${ee==="default"?"":capitalize(ee)}`,ee)),E===!1?te:{[E]:te}})};return _.propTypes={},_.filterProps=[C],_}function memoize$2(x){const C={};return E=>(C[E]===void 0&&(C[E]=x(E)),C[E])}const properties={m:"margin",p:"padding"},directions={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},aliases={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},getCssProperties=memoize$2(x=>{if(x.length>2)if(aliases[x])x=aliases[x];else return[x];const[C,E]=x.split(""),w=properties[C],T=directions[E]||"";return Array.isArray(T)?T.map(_=>w+_):[w+T]}),marginKeys=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],paddingKeys=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...marginKeys,...paddingKeys];function createUnaryUnit(x,C,E,w){const T=getPath$1(x,C,!0)??E;return typeof T=="number"||typeof T=="string"?_=>typeof _=="string"?_:typeof T=="string"?T.startsWith("var(")&&_===0?0:T.startsWith("var(")&&_===1?T:`calc(${_} * ${T})`:T*_:Array.isArray(T)?_=>{if(typeof _=="string")return _;const S=Math.abs(_),R=T[S];return _>=0?R:typeof R=="number"?-R:typeof R=="string"&&R.startsWith("var(")?`calc(-1 * ${R})`:`-${R}`}:typeof T=="function"?T:()=>{}}function createUnarySpacing(x){return createUnaryUnit(x,"spacing",8)}function getValue(x,C){return typeof C=="string"||C==null?C:x(C)}function getStyleFromPropValue(x,C){return E=>x.reduce((w,T)=>(w[T]=getValue(C,E),w),{})}function resolveCssProperty(x,C,E,w){if(!C.includes(E))return null;const T=getCssProperties(E),_=getStyleFromPropValue(T,w),S=x[E];return handleBreakpoints(x,S,_)}function style$1(x,C){const E=createUnarySpacing(x.theme);return Object.keys(x).map(w=>resolveCssProperty(x,C,w,E)).reduce(merge,{})}function margin(x){return style$1(x,marginKeys)}margin.propTypes={};margin.filterProps=marginKeys;function padding(x){return style$1(x,paddingKeys)}padding.propTypes={};padding.filterProps=paddingKeys;function compose(...x){const C=x.reduce((w,T)=>(T.filterProps.forEach(_=>{w[_]=T}),w),{}),E=w=>Object.keys(w).reduce((T,_)=>C[_]?merge(T,C[_](w)):T,{});return E.propTypes={},E.filterProps=x.reduce((w,T)=>w.concat(T.filterProps),[]),E}function borderTransform(x){return typeof x!="number"?x:`${x}px solid`}function createBorderStyle(x,C){return style$2({prop:x,themeKey:"borders",transform:C})}const border=createBorderStyle("border",borderTransform),borderTop=createBorderStyle("borderTop",borderTransform),borderRight=createBorderStyle("borderRight",borderTransform),borderBottom=createBorderStyle("borderBottom",borderTransform),borderLeft=createBorderStyle("borderLeft",borderTransform),borderColor=createBorderStyle("borderColor"),borderTopColor=createBorderStyle("borderTopColor"),borderRightColor=createBorderStyle("borderRightColor"),borderBottomColor=createBorderStyle("borderBottomColor"),borderLeftColor=createBorderStyle("borderLeftColor"),outline=createBorderStyle("outline",borderTransform),outlineColor=createBorderStyle("outlineColor"),borderRadius=x=>{if(x.borderRadius!==void 0&&x.borderRadius!==null){const C=createUnaryUnit(x.theme,"shape.borderRadius",4),E=w=>({borderRadius:getValue(C,w)});return handleBreakpoints(x,x.borderRadius,E)}return null};borderRadius.propTypes={};borderRadius.filterProps=["borderRadius"];compose(border,borderTop,borderRight,borderBottom,borderLeft,borderColor,borderTopColor,borderRightColor,borderBottomColor,borderLeftColor,borderRadius,outline,outlineColor);const gap=x=>{if(x.gap!==void 0&&x.gap!==null){const C=createUnaryUnit(x.theme,"spacing",8),E=w=>({gap:getValue(C,w)});return handleBreakpoints(x,x.gap,E)}return null};gap.propTypes={};gap.filterProps=["gap"];const columnGap=x=>{if(x.columnGap!==void 0&&x.columnGap!==null){const C=createUnaryUnit(x.theme,"spacing",8),E=w=>({columnGap:getValue(C,w)});return handleBreakpoints(x,x.columnGap,E)}return null};columnGap.propTypes={};columnGap.filterProps=["columnGap"];const rowGap=x=>{if(x.rowGap!==void 0&&x.rowGap!==null){const C=createUnaryUnit(x.theme,"spacing",8),E=w=>({rowGap:getValue(C,w)});return handleBreakpoints(x,x.rowGap,E)}return null};rowGap.propTypes={};rowGap.filterProps=["rowGap"];const gridColumn=style$2({prop:"gridColumn"}),gridRow=style$2({prop:"gridRow"}),gridAutoFlow=style$2({prop:"gridAutoFlow"}),gridAutoColumns=style$2({prop:"gridAutoColumns"}),gridAutoRows=style$2({prop:"gridAutoRows"}),gridTemplateColumns=style$2({prop:"gridTemplateColumns"}),gridTemplateRows=style$2({prop:"gridTemplateRows"}),gridTemplateAreas=style$2({prop:"gridTemplateAreas"}),gridArea=style$2({prop:"gridArea"});compose(gap,columnGap,rowGap,gridColumn,gridRow,gridAutoFlow,gridAutoColumns,gridAutoRows,gridTemplateColumns,gridTemplateRows,gridTemplateAreas,gridArea);function paletteTransform(x,C){return C==="grey"?C:x}const color=style$2({prop:"color",themeKey:"palette",transform:paletteTransform}),bgcolor=style$2({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:paletteTransform}),backgroundColor=style$2({prop:"backgroundColor",themeKey:"palette",transform:paletteTransform});compose(color,bgcolor,backgroundColor);function sizingTransform(x){return x<=1&&x!==0?`${x*100}%`:x}const width=style$2({prop:"width",transform:sizingTransform}),maxWidth=x=>{if(x.maxWidth!==void 0&&x.maxWidth!==null){const C=E=>{const w=x.theme?.breakpoints?.values?.[E]||values$1[E];return w?x.theme?.breakpoints?.unit!=="px"?{maxWidth:`${w}${x.theme.breakpoints.unit}`}:{maxWidth:w}:{maxWidth:sizingTransform(E)}};return handleBreakpoints(x,x.maxWidth,C)}return null};maxWidth.filterProps=["maxWidth"];const minWidth=style$2({prop:"minWidth",transform:sizingTransform}),height=style$2({prop:"height",transform:sizingTransform}),maxHeight=style$2({prop:"maxHeight",transform:sizingTransform}),minHeight=style$2({prop:"minHeight",transform:sizingTransform});style$2({prop:"size",cssProperty:"width",transform:sizingTransform});style$2({prop:"size",cssProperty:"height",transform:sizingTransform});const boxSizing=style$2({prop:"boxSizing"});compose(width,maxWidth,minWidth,height,maxHeight,minHeight,boxSizing);const defaultSxConfig={border:{themeKey:"borders",transform:borderTransform},borderTop:{themeKey:"borders",transform:borderTransform},borderRight:{themeKey:"borders",transform:borderTransform},borderBottom:{themeKey:"borders",transform:borderTransform},borderLeft:{themeKey:"borders",transform:borderTransform},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:borderTransform},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:borderRadius},color:{themeKey:"palette",transform:paletteTransform},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:paletteTransform},backgroundColor:{themeKey:"palette",transform:paletteTransform},p:{style:padding},pt:{style:padding},pr:{style:padding},pb:{style:padding},pl:{style:padding},px:{style:padding},py:{style:padding},padding:{style:padding},paddingTop:{style:padding},paddingRight:{style:padding},paddingBottom:{style:padding},paddingLeft:{style:padding},paddingX:{style:padding},paddingY:{style:padding},paddingInline:{style:padding},paddingInlineStart:{style:padding},paddingInlineEnd:{style:padding},paddingBlock:{style:padding},paddingBlockStart:{style:padding},paddingBlockEnd:{style:padding},m:{style:margin},mt:{style:margin},mr:{style:margin},mb:{style:margin},ml:{style:margin},mx:{style:margin},my:{style:margin},margin:{style:margin},marginTop:{style:margin},marginRight:{style:margin},marginBottom:{style:margin},marginLeft:{style:margin},marginX:{style:margin},marginY:{style:margin},marginInline:{style:margin},marginInlineStart:{style:margin},marginInlineEnd:{style:margin},marginBlock:{style:margin},marginBlockStart:{style:margin},marginBlockEnd:{style:margin},displayPrint:{cssProperty:!1,transform:x=>({"@media print":{display:x}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:gap},rowGap:{style:rowGap},columnGap:{style:columnGap},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:sizingTransform},maxWidth:{style:maxWidth},minWidth:{transform:sizingTransform},height:{transform:sizingTransform},maxHeight:{transform:sizingTransform},minHeight:{transform:sizingTransform},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 objectsHaveSameKeys(...x){const C=x.reduce((w,T)=>w.concat(Object.keys(T)),[]),E=new Set(C);return x.every(w=>E.size===Object.keys(w).length)}function callIfFn(x,C){return typeof x=="function"?x(C):x}function unstable_createStyleFunctionSx(){function x(E,w,T,_){const S={[E]:w,theme:T},R=_[E];if(!R)return{[E]:w};const{cssProperty:A=E,themeKey:O,transform:H,style:ee}=R;if(w==null)return null;if(O==="typography"&&w==="inherit")return{[E]:w};const te=getPath$1(T,O)||{};return ee?ee(S):handleBreakpoints(S,w,ne=>{let ae=getStyleValue$1(te,H,ne);return ne===ae&&typeof ne=="string"&&(ae=getStyleValue$1(te,H,`${E}${ne==="default"?"":capitalize(ne)}`,ne)),A===!1?ae:{[A]:ae}})}function C(E){const{sx:w,theme:T={},nested:_}=E||{};if(!w)return null;const S=T.unstable_sxConfig??defaultSxConfig;function R(A){let O=A;if(typeof A=="function")O=A(T);else if(typeof A!="object")return A;if(!O)return null;const H=createEmptyBreakpointObject(T.breakpoints),ee=Object.keys(H);let te=H;return Object.keys(O).forEach(ie=>{const ne=callIfFn(O[ie],T);if(ne!=null)if(typeof ne=="object")if(S[ie])te=merge(te,x(ie,ne,T,S));else{const ae=handleBreakpoints({theme:T},ne,oe=>({[ie]:oe}));objectsHaveSameKeys(ae,ne)?te[ie]=C({sx:ne,theme:T,nested:!0}):te=merge(te,ae)}else te=merge(te,x(ie,ne,T,S))}),!_&&T.modularCssLayers?{"@layer sx":sortContainerQueries(T,removeUnusedBreakpoints(ee,te))}:sortContainerQueries(T,removeUnusedBreakpoints(ee,te))}return Array.isArray(w)?w.map(R):R(w)}return C}const styleFunctionSx=unstable_createStyleFunctionSx();styleFunctionSx.filterProps=["sx"];const splitProps=x=>{const C={systemProps:{},otherProps:{}},E=x?.theme?.unstable_sxConfig??defaultSxConfig;return Object.keys(x).forEach(w=>{E[w]?C.systemProps[w]=x[w]:C.otherProps[w]=x[w]}),C};function extendSxProp$1(x){const{sx:C,...E}=x,{systemProps:w,otherProps:T}=splitProps(E);let _;return Array.isArray(C)?_=[w,...C]:typeof C=="function"?_=(...S)=>{const R=C(...S);return isPlainObject(R)?{...w,...R}:w}:_={...w,...C},{...T,sx:_}}function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(x){for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var w in E)({}).hasOwnProperty.call(E,w)&&(x[w]=E[w])}return x},_extends$1.apply(null,arguments)}function sheetForTag(x){if(x.sheet)return x.sheet;for(var C=0;C<document.styleSheets.length;C++)if(document.styleSheets[C].ownerNode===x)return document.styleSheets[C]}function createStyleElement(x){var C=document.createElement("style");return C.setAttribute("data-emotion",x.key),x.nonce!==void 0&&C.setAttribute("nonce",x.nonce),C.appendChild(document.createTextNode("")),C.setAttribute("data-s",""),C}var StyleSheet=function(){function x(E){var w=this;this._insertTag=function(T){var _;w.tags.length===0?w.insertionPoint?_=w.insertionPoint.nextSibling:w.prepend?_=w.container.firstChild:_=w.before:_=w.tags[w.tags.length-1].nextSibling,w.container.insertBefore(T,_),w.tags.push(T)},this.isSpeedy=E.speedy===void 0?!0:E.speedy,this.tags=[],this.ctr=0,this.nonce=E.nonce,this.key=E.key,this.container=E.container,this.prepend=E.prepend,this.insertionPoint=E.insertionPoint,this.before=null}var C=x.prototype;return C.hydrate=function(w){w.forEach(this._insertTag)},C.insert=function(w){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(createStyleElement(this));var T=this.tags[this.tags.length-1];if(this.isSpeedy){var _=sheetForTag(T);try{_.insertRule(w,_.cssRules.length)}catch{}}else T.appendChild(document.createTextNode(w));this.ctr++},C.flush=function(){this.tags.forEach(function(w){var T;return(T=w.parentNode)==null?void 0:T.removeChild(w)}),this.tags=[],this.ctr=0},x}(),MS="-ms-",MOZ="-moz-",WEBKIT="-webkit-",COMMENT="comm",RULESET="rule",DECLARATION="decl",IMPORT="@import",KEYFRAMES="@keyframes",LAYER="@layer",abs=Math.abs,from=String.fromCharCode,assign=Object.assign;function hash$3(x,C){return charat(x,0)^45?(((C<<2^charat(x,0))<<2^charat(x,1))<<2^charat(x,2))<<2^charat(x,3):0}function trim(x){return x.trim()}function match(x,C){return(x=C.exec(x))?x[0]:x}function replace(x,C,E){return x.replace(C,E)}function indexof(x,C){return x.indexOf(C)}function charat(x,C){return x.charCodeAt(C)|0}function substr(x,C,E){return x.slice(C,E)}function strlen(x){return x.length}function sizeof(x){return x.length}function append(x,C){return C.push(x),x}function combine(x,C){return x.map(C).join("")}var line=1,column=1,length=0,position=0,character=0,characters="";function node(x,C,E,w,T,_,S){return{value:x,root:C,parent:E,type:w,props:T,children:_,line,column,length:S,return:""}}function copy$1(x,C){return assign(node("",null,null,"",null,null,0),x,{length:-x.length},C)}function char(){return character}function prev(){return character=position>0?charat(characters,--position):0,column--,character===10&&(column=1,line--),character}function next(){return character=position<length?charat(characters,position++):0,column++,character===10&&(column=1,line++),character}function peek(){return charat(characters,position)}function caret(){return position}function slice$1(x,C){return substr(characters,x,C)}function token(x){switch(x){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 alloc(x){return line=column=1,length=strlen(characters=x),position=0,[]}function dealloc(x){return characters="",x}function delimit(x){return trim(slice$1(position-1,delimiter(x===91?x+2:x===40?x+1:x)))}function whitespace(x){for(;(character=peek())&&character<33;)next();return token(x)>2||token(character)>3?"":" "}function escaping(x,C){for(;--C&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$1(x,caret()+(C<6&&peek()==32&&next()==32))}function delimiter(x){for(;next();)switch(character){case x:return position;case 34:case 39:x!==34&&x!==39&&delimiter(character);break;case 40:x===41&&delimiter(x);break;case 92:next();break}return position}function commenter(x,C){for(;next()&&x+character!==57;)if(x+character===84&&peek()===47)break;return"/*"+slice$1(C,position-1)+"*"+from(x===47?x:next())}function identifier(x){for(;!token(peek());)next();return slice$1(x,position)}function compile(x){return dealloc(parse$1("",null,null,null,[""],x=alloc(x),0,[0],x))}function parse$1(x,C,E,w,T,_,S,R,A){for(var O=0,H=0,ee=S,te=0,ie=0,ne=0,ae=1,oe=1,le=1,fe=0,de="",ce=T,pe=_,he=w,me=de;oe;)switch(ne=fe,fe=next()){case 40:if(ne!=108&&charat(me,ee-1)==58){indexof(me+=replace(delimit(fe),"&","&\f"),"&\f")!=-1&&(le=-1);break}case 34:case 39:case 91:me+=delimit(fe);break;case 9:case 10:case 13:case 32:me+=whitespace(ne);break;case 92:me+=escaping(caret()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next(),caret()),C,E),A);break;default:me+="/"}break;case 123*ae:R[O++]=strlen(me)*le;case 125*ae:case 59:case 0:switch(fe){case 0:case 125:oe=0;case 59+H:le==-1&&(me=replace(me,/\f/g,"")),ie>0&&strlen(me)-ee&&append(ie>32?declaration(me+";",w,E,ee-1):declaration(replace(me," ","")+";",w,E,ee-2),A);break;case 59:me+=";";default:if(append(he=ruleset(me,C,E,O,H,T,R,de,ce=[],pe=[],ee),_),fe===123)if(H===0)parse$1(me,C,he,he,ce,_,ee,R,pe);else switch(te===99&&charat(me,3)===110?100:te){case 100:case 108:case 109:case 115:parse$1(x,he,he,w&&append(ruleset(x,he,he,0,0,T,R,de,T,ce=[],ee),pe),T,pe,ee,R,w?ce:pe);break;default:parse$1(me,he,he,he,[""],pe,0,R,pe)}}O=H=ie=0,ae=le=1,de=me="",ee=S;break;case 58:ee=1+strlen(me),ie=ne;default:if(ae<1){if(fe==123)--ae;else if(fe==125&&ae++==0&&prev()==125)continue}switch(me+=from(fe),fe*ae){case 38:le=H>0?1:(me+="\f",-1);break;case 44:R[O++]=(strlen(me)-1)*le,le=1;break;case 64:peek()===45&&(me+=delimit(next())),te=peek(),H=ee=strlen(de=me+=identifier(caret())),fe++;break;case 45:ne===45&&strlen(me)==2&&(ae=0)}}return _}function ruleset(x,C,E,w,T,_,S,R,A,O,H){for(var ee=T-1,te=T===0?_:[""],ie=sizeof(te),ne=0,ae=0,oe=0;ne<w;++ne)for(var le=0,fe=substr(x,ee+1,ee=abs(ae=S[ne])),de=x;le<ie;++le)(de=trim(ae>0?te[le]+" "+fe:replace(fe,/&\f/g,te[le])))&&(A[oe++]=de);return node(x,C,E,T===0?RULESET:R,A,O,H)}function comment(x,C,E){return node(x,C,E,COMMENT,from(char()),substr(x,2,-2),0)}function declaration(x,C,E,w){return node(x,C,E,DECLARATION,substr(x,0,w),substr(x,w+1,-1),w)}function serialize(x,C){for(var E="",w=sizeof(x),T=0;T<w;T++)E+=C(x[T],T,x,C)||"";return E}function stringify(x,C,E,w){switch(x.type){case LAYER:if(x.children.length)break;case IMPORT:case DECLARATION:return x.return=x.return||x.value;case COMMENT:return"";case KEYFRAMES:return x.return=x.value+"{"+serialize(x.children,w)+"}";case RULESET:x.value=x.props.join(",")}return strlen(E=serialize(x.children,w))?x.return=x.value+"{"+E+"}":""}function middleware(x){var C=sizeof(x);return function(E,w,T,_){for(var S="",R=0;R<C;R++)S+=x[R](E,w,T,_)||"";return S}}function rulesheet(x){return function(C){C.root||(C=C.return)&&x(C)}}function memoize$1(x){var C=Object.create(null);return function(E){return C[E]===void 0&&(C[E]=x(E)),C[E]}}var identifierWithPointTracking=function(C,E,w){for(var T=0,_=0;T=_,_=peek(),T===38&&_===12&&(E[w]=1),!token(_);)next();return slice$1(C,position)},toRules=function(C,E){var w=-1,T=44;do switch(token(T)){case 0:T===38&&peek()===12&&(E[w]=1),C[w]+=identifierWithPointTracking(position-1,E,w);break;case 2:C[w]+=delimit(T);break;case 4:if(T===44){C[++w]=peek()===58?"&\f":"",E[w]=C[w].length;break}default:C[w]+=from(T)}while(T=next());return C},getRules=function(C,E){return dealloc(toRules(alloc(C),E))},fixedElements=new WeakMap,compat=function(C){if(!(C.type!=="rule"||!C.parent||C.length<1)){for(var E=C.value,w=C.parent,T=C.column===w.column&&C.line===w.line;w.type!=="rule";)if(w=w.parent,!w)return;if(!(C.props.length===1&&E.charCodeAt(0)!==58&&!fixedElements.get(w))&&!T){fixedElements.set(C,!0);for(var _=[],S=getRules(E,_),R=w.props,A=0,O=0;A<S.length;A++)for(var H=0;H<R.length;H++,O++)C.props[O]=_[A]?S[A].replace(/&\f/g,R[H]):R[H]+" "+S[A]}}},removeLabel=function(C){if(C.type==="decl"){var E=C.value;E.charCodeAt(0)===108&&E.charCodeAt(2)===98&&(C.return="",C.value="")}};function prefix(x,C){switch(hash$3(x,C)){case 5103:return WEBKIT+"print-"+x+x;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 WEBKIT+x+x;case 5349:case 4246:case 4810:case 6968:case 2756:return WEBKIT+x+MOZ+x+MS+x+x;case 6828:case 4268:return WEBKIT+x+MS+x+x;case 6165:return WEBKIT+x+MS+"flex-"+x+x;case 5187:return WEBKIT+x+replace(x,/(\w+).+(:[^]+)/,WEBKIT+"box-$1$2"+MS+"flex-$1$2")+x;case 5443:return WEBKIT+x+MS+"flex-item-"+replace(x,/flex-|-self/,"")+x;case 4675:return WEBKIT+x+MS+"flex-line-pack"+replace(x,/align-content|flex-|-self/,"")+x;case 5548:return WEBKIT+x+MS+replace(x,"shrink","negative")+x;case 5292:return WEBKIT+x+MS+replace(x,"basis","preferred-size")+x;case 6060:return WEBKIT+"box-"+replace(x,"-grow","")+WEBKIT+x+MS+replace(x,"grow","positive")+x;case 4554:return WEBKIT+replace(x,/([^-])(transform)/g,"$1"+WEBKIT+"$2")+x;case 6187:return replace(replace(replace(x,/(zoom-|grab)/,WEBKIT+"$1"),/(image-set)/,WEBKIT+"$1"),x,"")+x;case 5495:case 3959:return replace(x,/(image-set\([^]*)/,WEBKIT+"$1$`$1");case 4968:return replace(replace(x,/(.+:)(flex-)?(.*)/,WEBKIT+"box-pack:$3"+MS+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+WEBKIT+x+x;case 4095:case 3583:case 4068:case 2532:return replace(x,/(.+)-inline(.+)/,WEBKIT+"$1$2")+x;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(strlen(x)-1-C>6)switch(charat(x,C+1)){case 109:if(charat(x,C+4)!==45)break;case 102:return replace(x,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(x,C+3)==108?"$3":"$2-$3"))+x;case 115:return~indexof(x,"stretch")?prefix(replace(x,"stretch","fill-available"),C)+x:x}break;case 4949:if(charat(x,C+1)!==115)break;case 6444:switch(charat(x,strlen(x)-3-(~indexof(x,"!important")&&10))){case 107:return replace(x,":",":"+WEBKIT)+x;case 101:return replace(x,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(x,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+x}break;case 5936:switch(charat(x,C+11)){case 114:return WEBKIT+x+MS+replace(x,/[svh]\w+-[tblr]{2}/,"tb")+x;case 108:return WEBKIT+x+MS+replace(x,/[svh]\w+-[tblr]{2}/,"tb-rl")+x;case 45:return WEBKIT+x+MS+replace(x,/[svh]\w+-[tblr]{2}/,"lr")+x}return WEBKIT+x+MS+x+x}return x}var prefixer=function(C,E,w,T){if(C.length>-1&&!C.return)switch(C.type){case DECLARATION:C.return=prefix(C.value,C.length);break;case KEYFRAMES:return serialize([copy$1(C,{value:replace(C.value,"@","@"+WEBKIT)})],T);case RULESET:if(C.length)return combine(C.props,function(_){switch(match(_,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy$1(C,{props:[replace(_,/:(read-\w+)/,":"+MOZ+"$1")]})],T);case"::placeholder":return serialize([copy$1(C,{props:[replace(_,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy$1(C,{props:[replace(_,/:(plac\w+)/,":"+MOZ+"$1")]}),copy$1(C,{props:[replace(_,/:(plac\w+)/,MS+"input-$1")]})],T)}return""})}},defaultStylisPlugins=[prefixer],createCache=function(C){var E=C.key;if(E==="css"){var w=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(w,function(ae){var oe=ae.getAttribute("data-emotion");oe.indexOf(" ")!==-1&&(document.head.appendChild(ae),ae.setAttribute("data-s",""))})}var T=C.stylisPlugins||defaultStylisPlugins,_={},S,R=[];S=C.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+E+' "]'),function(ae){for(var oe=ae.getAttribute("data-emotion").split(" "),le=1;le<oe.length;le++)_[oe[le]]=!0;R.push(ae)});var A,O=[compat,removeLabel];{var H,ee=[stringify,rulesheet(function(ae){H.insert(ae)})],te=middleware(O.concat(T,ee)),ie=function(oe){return serialize(compile(oe),te)};A=function(oe,le,fe,de){H=fe,ie(oe?oe+"{"+le.styles+"}":le.styles),de&&(ne.inserted[le.name]=!0)}}var ne={key:E,sheet:new StyleSheet({key:E,container:S,nonce:C.nonce,speedy:C.speedy,prepend:C.prepend,insertionPoint:C.insertionPoint}),nonce:C.nonce,inserted:_,registered:{},insert:A};return ne.sheet.hydrate(R),ne},reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hasRequiredReactIs_production_min;function requireReactIs_production_min(){if(hasRequiredReactIs_production_min)return reactIs_production_min;hasRequiredReactIs_production_min=1;var x=typeof Symbol=="function"&&Symbol.for,C=x?Symbol.for("react.element"):60103,E=x?Symbol.for("react.portal"):60106,w=x?Symbol.for("react.fragment"):60107,T=x?Symbol.for("react.strict_mode"):60108,_=x?Symbol.for("react.profiler"):60114,S=x?Symbol.for("react.provider"):60109,R=x?Symbol.for("react.context"):60110,A=x?Symbol.for("react.async_mode"):60111,O=x?Symbol.for("react.concurrent_mode"):60111,H=x?Symbol.for("react.forward_ref"):60112,ee=x?Symbol.for("react.suspense"):60113,te=x?Symbol.for("react.suspense_list"):60120,ie=x?Symbol.for("react.memo"):60115,ne=x?Symbol.for("react.lazy"):60116,ae=x?Symbol.for("react.block"):60121,oe=x?Symbol.for("react.fundamental"):60117,le=x?Symbol.for("react.responder"):60118,fe=x?Symbol.for("react.scope"):60119;function de(pe){if(typeof pe=="object"&&pe!==null){var he=pe.$$typeof;switch(he){case C:switch(pe=pe.type,pe){case A:case O:case w:case _:case T:case ee:return pe;default:switch(pe=pe&&pe.$$typeof,pe){case R:case H:case ne:case ie:case S:return pe;default:return he}}case E:return he}}}function ce(pe){return de(pe)===O}return reactIs_production_min.AsyncMode=A,reactIs_production_min.ConcurrentMode=O,reactIs_production_min.ContextConsumer=R,reactIs_production_min.ContextProvider=S,reactIs_production_min.Element=C,reactIs_production_min.ForwardRef=H,reactIs_production_min.Fragment=w,reactIs_production_min.Lazy=ne,reactIs_production_min.Memo=ie,reactIs_production_min.Portal=E,reactIs_production_min.Profiler=_,reactIs_production_min.StrictMode=T,reactIs_production_min.Suspense=ee,reactIs_production_min.isAsyncMode=function(pe){return ce(pe)||de(pe)===A},reactIs_production_min.isConcurrentMode=ce,reactIs_production_min.isContextConsumer=function(pe){return de(pe)===R},reactIs_production_min.isContextProvider=function(pe){return de(pe)===S},reactIs_production_min.isElement=function(pe){return typeof pe=="object"&&pe!==null&&pe.$$typeof===C},reactIs_production_min.isForwardRef=function(pe){return de(pe)===H},reactIs_production_min.isFragment=function(pe){return de(pe)===w},reactIs_production_min.isLazy=function(pe){return de(pe)===ne},reactIs_production_min.isMemo=function(pe){return de(pe)===ie},reactIs_production_min.isPortal=function(pe){return de(pe)===E},reactIs_production_min.isProfiler=function(pe){return de(pe)===_},reactIs_production_min.isStrictMode=function(pe){return de(pe)===T},reactIs_production_min.isSuspense=function(pe){return de(pe)===ee},reactIs_production_min.isValidElementType=function(pe){return typeof pe=="string"||typeof pe=="function"||pe===w||pe===O||pe===_||pe===T||pe===ee||pe===te||typeof pe=="object"&&pe!==null&&(pe.$$typeof===ne||pe.$$typeof===ie||pe.$$typeof===S||pe.$$typeof===R||pe.$$typeof===H||pe.$$typeof===oe||pe.$$typeof===le||pe.$$typeof===fe||pe.$$typeof===ae)},reactIs_production_min.typeOf=de,reactIs_production_min}var hasRequiredReactIs;function requireReactIs(){return hasRequiredReactIs||(hasRequiredReactIs=1,reactIs.exports=requireReactIs_production_min()),reactIs.exports}var hoistNonReactStatics_cjs,hasRequiredHoistNonReactStatics_cjs;function requireHoistNonReactStatics_cjs(){if(hasRequiredHoistNonReactStatics_cjs)return hoistNonReactStatics_cjs;hasRequiredHoistNonReactStatics_cjs=1;var x=requireReactIs(),C={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},E={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},w={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},T={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},_={};_[x.ForwardRef]=w,_[x.Memo]=T;function S(ne){return x.isMemo(ne)?T:_[ne.$$typeof]||C}var R=Object.defineProperty,A=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,H=Object.getOwnPropertyDescriptor,ee=Object.getPrototypeOf,te=Object.prototype;function ie(ne,ae,oe){if(typeof ae!="string"){if(te){var le=ee(ae);le&&le!==te&&ie(ne,le,oe)}var fe=A(ae);O&&(fe=fe.concat(O(ae)));for(var de=S(ne),ce=S(ae),pe=0;pe<fe.length;++pe){var he=fe[pe];if(!E[he]&&!(oe&&oe[he])&&!(ce&&ce[he])&&!(de&&de[he])){var me=H(ae,he);try{R(ne,he,me)}catch{}}}}return ne}return hoistNonReactStatics_cjs=ie,hoistNonReactStatics_cjs}requireHoistNonReactStatics_cjs();var isBrowser=!0;function getRegisteredStyles(x,C,E){var w="";return E.split(" ").forEach(function(T){x[T]!==void 0?C.push(x[T]+";"):T&&(w+=T+" ")}),w}var registerStyles=function(C,E,w){var T=C.key+"-"+E.name;(w===!1||isBrowser===!1)&&C.registered[T]===void 0&&(C.registered[T]=E.styles)},insertStyles=function(C,E,w){registerStyles(C,E,w);var T=C.key+"-"+E.name;if(C.inserted[E.name]===void 0){var _=E;do C.insert(E===_?"."+T:"",_,C.sheet,!0),_=_.next;while(_!==void 0)}};function murmur2(x){for(var C=0,E,w=0,T=x.length;T>=4;++w,T-=4)E=x.charCodeAt(w)&255|(x.charCodeAt(++w)&255)<<8|(x.charCodeAt(++w)&255)<<16|(x.charCodeAt(++w)&255)<<24,E=(E&65535)*1540483477+((E>>>16)*59797<<16),E^=E>>>24,C=(E&65535)*1540483477+((E>>>16)*59797<<16)^(C&65535)*1540483477+((C>>>16)*59797<<16);switch(T){case 3:C^=(x.charCodeAt(w+2)&255)<<16;case 2:C^=(x.charCodeAt(w+1)&255)<<8;case 1:C^=x.charCodeAt(w)&255,C=(C&65535)*1540483477+((C>>>16)*59797<<16)}return C^=C>>>13,C=(C&65535)*1540483477+((C>>>16)*59797<<16),((C^C>>>15)>>>0).toString(36)}var unitlessKeys={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},hyphenateRegex=/[A-Z]|^ms/g,animationRegex=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty=function(C){return C.charCodeAt(1)===45},isProcessableValue=function(C){return C!=null&&typeof C!="boolean"},processStyleName=memoize$1(function(x){return isCustomProperty(x)?x:x.replace(hyphenateRegex,"-$&").toLowerCase()}),processStyleValue=function(C,E){switch(C){case"animation":case"animationName":if(typeof E=="string")return E.replace(animationRegex,function(w,T,_){return cursor={name:T,styles:_,next:cursor},T})}return unitlessKeys[C]!==1&&!isCustomProperty(C)&&typeof E=="number"&&E!==0?E+"px":E};function handleInterpolation(x,C,E){if(E==null)return"";var w=E;if(w.__emotion_styles!==void 0)return w;switch(typeof E){case"boolean":return"";case"object":{var T=E;if(T.anim===1)return cursor={name:T.name,styles:T.styles,next:cursor},T.name;var _=E;if(_.styles!==void 0){var S=_.next;if(S!==void 0)for(;S!==void 0;)cursor={name:S.name,styles:S.styles,next:cursor},S=S.next;var R=_.styles+";";return R}return createStringFromObject(x,C,E)}case"function":{if(x!==void 0){var A=cursor,O=E(x);return cursor=A,handleInterpolation(x,C,O)}break}}var H=E;if(C==null)return H;var ee=C[H];return ee!==void 0?ee:H}function createStringFromObject(x,C,E){var w="";if(Array.isArray(E))for(var T=0;T<E.length;T++)w+=handleInterpolation(x,C,E[T])+";";else for(var _ in E){var S=E[_];if(typeof S!="object"){var R=S;C!=null&&C[R]!==void 0?w+=_+"{"+C[R]+"}":isProcessableValue(R)&&(w+=processStyleName(_)+":"+processStyleValue(_,R)+";")}else if(Array.isArray(S)&&typeof S[0]=="string"&&(C==null||C[S[0]]===void 0))for(var A=0;A<S.length;A++)isProcessableValue(S[A])&&(w+=processStyleName(_)+":"+processStyleValue(_,S[A])+";");else{var O=handleInterpolation(x,C,S);switch(_){case"animation":case"animationName":{w+=processStyleName(_)+":"+O+";";break}default:w+=_+"{"+O+"}"}}}return w}var labelPattern=/label:\s*([^\s;{]+)\s*(;|$)/g,cursor;function serializeStyles(x,C,E){if(x.length===1&&typeof x[0]=="object"&&x[0]!==null&&x[0].styles!==void 0)return x[0];var w=!0,T="";cursor=void 0;var _=x[0];if(_==null||_.raw===void 0)w=!1,T+=handleInterpolation(E,C,_);else{var S=_;T+=S[0]}for(var R=1;R<x.length;R++)if(T+=handleInterpolation(E,C,x[R]),w){var A=_;T+=A[R]}labelPattern.lastIndex=0;for(var O="",H;(H=labelPattern.exec(T))!==null;)O+="-"+H[1];var ee=murmur2(T)+O;return{name:ee,styles:T,next:cursor}}var syncFallback=function(C){return C()},useInsertionEffect=React$1.useInsertionEffect?React$1.useInsertionEffect:!1,useInsertionEffectAlwaysWithSyncFallback=useInsertionEffect||syncFallback,useInsertionEffectWithLayoutFallback=useInsertionEffect||reactExports.useLayoutEffect,EmotionCacheContext=reactExports.createContext(typeof HTMLElement<"u"?createCache({key:"css"}):null);EmotionCacheContext.Provider;var withEmotionCache=function(C){return reactExports.forwardRef(function(E,w){var T=reactExports.useContext(EmotionCacheContext);return C(E,T,w)})},ThemeContext$1=reactExports.createContext({}),hasOwn={}.hasOwnProperty,typePropName="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",createEmotionProps=function(C,E){var w={};for(var T in E)hasOwn.call(E,T)&&(w[T]=E[T]);return w[typePropName]=C,w},Insertion$1=function(C){var E=C.cache,w=C.serialized,T=C.isStringTag;return registerStyles(E,w,T),useInsertionEffectAlwaysWithSyncFallback(function(){return insertStyles(E,w,T)}),null},Emotion=withEmotionCache(function(x,C,E){var w=x.css;typeof w=="string"&&C.registered[w]!==void 0&&(w=C.registered[w]);var T=x[typePropName],_=[w],S="";typeof x.className=="string"?S=getRegisteredStyles(C.registered,_,x.className):x.className!=null&&(S=x.className+" ");var R=serializeStyles(_,void 0,reactExports.useContext(ThemeContext$1));S+=C.key+"-"+R.name;var A={};for(var O in x)hasOwn.call(x,O)&&O!=="css"&&O!==typePropName&&(A[O]=x[O]);return A.className=S,E&&(A.ref=E),reactExports.createElement(reactExports.Fragment,null,reactExports.createElement(Insertion$1,{cache:C,serialized:R,isStringTag:typeof T=="string"}),reactExports.createElement(T,A))}),Emotion$1=Emotion,jsx=function(C,E){var w=arguments;if(E==null||!hasOwn.call(E,"css"))return reactExports.createElement.apply(void 0,w);var T=w.length,_=new Array(T);_[0]=Emotion$1,_[1]=createEmotionProps(C,E);for(var S=2;S<T;S++)_[S]=w[S];return reactExports.createElement.apply(null,_)};(function(x){var C;C||(C=x.JSX||(x.JSX={}))})(jsx||(jsx={}));var Global=withEmotionCache(function(x,C){var E=x.styles,w=serializeStyles([E],void 0,reactExports.useContext(ThemeContext$1)),T=reactExports.useRef();return useInsertionEffectWithLayoutFallback(function(){var _=C.key+"-global",S=new C.sheet.constructor({key:_,nonce:C.sheet.nonce,container:C.sheet.container,speedy:C.sheet.isSpeedy}),R=!1,A=document.querySelector('style[data-emotion="'+_+" "+w.name+'"]');return C.sheet.tags.length&&(S.before=C.sheet.tags[0]),A!==null&&(R=!0,A.setAttribute("data-emotion",_),S.hydrate([A])),T.current=[S,R],function(){S.flush()}},[C]),useInsertionEffectWithLayoutFallback(function(){var _=T.current,S=_[0],R=_[1];if(R){_[1]=!1;return}if(w.next!==void 0&&insertStyles(C,w.next,!0),S.tags.length){var A=S.tags[S.tags.length-1].nextElementSibling;S.before=A,S.flush()}C.insert("",w,S,!1)},[C,w.name]),null});function css(){for(var x=arguments.length,C=new Array(x),E=0;E<x;E++)C[E]=arguments[E];return serializeStyles(C)}function keyframes(){var x=css.apply(void 0,arguments),C="animation-"+x.name;return{name:C,styles:"@keyframes "+C+"{"+x.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}var reactPropsRegex=/^((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)-.*))$/,isPropValid=memoize$1(function(x){return reactPropsRegex.test(x)||x.charCodeAt(0)===111&&x.charCodeAt(1)===110&&x.charCodeAt(2)<91}),testOmitPropsOnStringTag=isPropValid,testOmitPropsOnComponent=function(C){return C!=="theme"},getDefaultShouldForwardProp=function(C){return typeof C=="string"&&C.charCodeAt(0)>96?testOmitPropsOnStringTag:testOmitPropsOnComponent},composeShouldForwardProps=function(C,E,w){var T;if(E){var _=E.shouldForwardProp;T=C.__emotion_forwardProp&&_?function(S){return C.__emotion_forwardProp(S)&&_(S)}:_}return typeof T!="function"&&w&&(T=C.__emotion_forwardProp),T},Insertion=function(C){var E=C.cache,w=C.serialized,T=C.isStringTag;return registerStyles(E,w,T),useInsertionEffectAlwaysWithSyncFallback(function(){return insertStyles(E,w,T)}),null},createStyled$1=function x(C,E){var w=C.__emotion_real===C,T=w&&C.__emotion_base||C,_,S;E!==void 0&&(_=E.label,S=E.target);var R=composeShouldForwardProps(C,E,w),A=R||getDefaultShouldForwardProp(T),O=!A("as");return function(){var H=arguments,ee=w&&C.__emotion_styles!==void 0?C.__emotion_styles.slice(0):[];if(_!==void 0&&ee.push("label:"+_+";"),H[0]==null||H[0].raw===void 0)ee.push.apply(ee,H);else{var te=H[0];ee.push(te[0]);for(var ie=H.length,ne=1;ne<ie;ne++)ee.push(H[ne],te[ne])}var ae=withEmotionCache(function(oe,le,fe){var de=O&&oe.as||T,ce="",pe=[],he=oe;if(oe.theme==null){he={};for(var me in oe)he[me]=oe[me];he.theme=reactExports.useContext(ThemeContext$1)}typeof oe.className=="string"?ce=getRegisteredStyles(le.registered,pe,oe.className):oe.className!=null&&(ce=oe.className+" ");var ve=serializeStyles(ee.concat(pe),le.registered,he);ce+=le.key+"-"+ve.name,S!==void 0&&(ce+=" "+S);var ye=O&&R===void 0?getDefaultShouldForwardProp(de):A,Se={};for(var Ce in oe)O&&Ce==="as"||ye(Ce)&&(Se[Ce]=oe[Ce]);return Se.className=ce,fe&&(Se.ref=fe),reactExports.createElement(reactExports.Fragment,null,reactExports.createElement(Insertion,{cache:le,serialized:ve,isStringTag:typeof de=="string"}),reactExports.createElement(de,Se))});return ae.displayName=_!==void 0?_:"Styled("+(typeof T=="string"?T:T.displayName||T.name||"Component")+")",ae.defaultProps=C.defaultProps,ae.__emotion_real=ae,ae.__emotion_base=T,ae.__emotion_styles=ee,ae.__emotion_forwardProp=R,Object.defineProperty(ae,"toString",{value:function(){return"."+S}}),ae.withComponent=function(oe,le){var fe=x(oe,_extends$1({},E,le,{shouldForwardProp:composeShouldForwardProps(ae,le,!0)}));return fe.apply(void 0,ee)},ae}},tags=["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"],styled$3=createStyled$1.bind(null);tags.forEach(function(x){styled$3[x]=styled$3(x)});function isEmpty$2(x){return x==null||Object.keys(x).length===0}function GlobalStyles$2(x){const{styles:C,defaultTheme:E={}}=x,w=typeof C=="function"?T=>C(isEmpty$2(T)?E:T):C;return jsxRuntimeExports.jsx(Global,{styles:w})}function styled$2(x,C){return styled$3(x,C)}function internal_mutateStyles(x,C){Array.isArray(x.__emotion_styles)&&(x.__emotion_styles=C(x.__emotion_styles))}const wrapper=[];function internal_serializeStyles(x){return wrapper[0]=x,serializeStyles(wrapper)}const sortBreakpointsValues=x=>{const C=Object.keys(x).map(E=>({key:E,val:x[E]}))||[];return C.sort((E,w)=>E.val-w.val),C.reduce((E,w)=>({...E,[w.key]:w.val}),{})};function createBreakpoints(x){const{values:C={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:E="px",step:w=5,...T}=x,_=sortBreakpointsValues(C),S=Object.keys(_);function R(te){return`@media (min-width:${typeof C[te]=="number"?C[te]:te}${E})`}function A(te){return`@media (max-width:${(typeof C[te]=="number"?C[te]:te)-w/100}${E})`}function O(te,ie){const ne=S.indexOf(ie);return`@media (min-width:${typeof C[te]=="number"?C[te]:te}${E}) and (max-width:${(ne!==-1&&typeof C[S[ne]]=="number"?C[S[ne]]:ie)-w/100}${E})`}function H(te){return S.indexOf(te)+1<S.length?O(te,S[S.indexOf(te)+1]):R(te)}function ee(te){const ie=S.indexOf(te);return ie===0?R(S[1]):ie===S.length-1?A(S[ie]):O(te,S[S.indexOf(te)+1]).replace("@media","@media not all and")}return{keys:S,values:_,up:R,down:A,between:O,only:H,not:ee,unit:E,...T}}const shape={borderRadius:4};function createSpacing(x=8,C=createUnarySpacing({spacing:x})){if(x.mui)return x;const E=(...w)=>(w.length===0?[1]:w).map(_=>{const S=C(_);return typeof S=="number"?`${S}px`:S}).join(" ");return E.mui=!0,E}function applyStyles$2(x,C){const E=this;if(E.vars){if(!E.colorSchemes?.[x]||typeof E.getColorSchemeSelector!="function")return{};let w=E.getColorSchemeSelector(x);return w==="&"?C:((w.includes("data-")||w.includes("."))&&(w=`*:where(${w.replace(/\s*&$/,"")}) &`),{[w]:C})}return E.palette.mode===x?C:{}}function createTheme$1(x={},...C){const{breakpoints:E={},palette:w={},spacing:T,shape:_={},...S}=x,R=createBreakpoints(E),A=createSpacing(T);let O=deepmerge({breakpoints:R,direction:"ltr",components:{},palette:{mode:"light",...w},spacing:A,shape:{...shape,..._}},S);return O=cssContainerQueries(O),O.applyStyles=applyStyles$2,O=C.reduce((H,ee)=>deepmerge(H,ee),O),O.unstable_sxConfig={...defaultSxConfig,...S?.unstable_sxConfig},O.unstable_sx=function(ee){return styleFunctionSx({sx:ee,theme:this})},O}function isObjectEmpty$2(x){return Object.keys(x).length===0}function useTheme$3(x=null){const C=reactExports.useContext(ThemeContext$1);return!C||isObjectEmpty$2(C)?x:C}const systemDefaultTheme$1=createTheme$1();function useTheme$2(x=systemDefaultTheme$1){return useTheme$3(x)}function wrapGlobalLayer(x){const C=internal_serializeStyles(x);return x!==C&&C.styles?(C.styles.match(/^@layer\s+[^{]*$/)||(C.styles=`@layer global{${C.styles}}`),C):x}function GlobalStyles$1({styles:x,themeId:C,defaultTheme:E={}}){const w=useTheme$2(E),T=C&&w[C]||w;let _=typeof x=="function"?x(T):x;return T.modularCssLayers&&(Array.isArray(_)?_=_.map(S=>wrapGlobalLayer(typeof S=="function"?S(T):S)):_=wrapGlobalLayer(_)),jsxRuntimeExports.jsx(GlobalStyles$2,{styles:_})}const defaultGenerator=x=>x,createClassNameGenerator=()=>{let x=defaultGenerator;return{configure(C){x=C},generate(C){return x(C)},reset(){x=defaultGenerator}}},ClassNameGenerator=createClassNameGenerator();function createBox(x={}){const{themeId:C,defaultTheme:E,defaultClassName:w="MuiBox-root",generateClassName:T}=x,_=styled$2("div",{shouldForwardProp:R=>R!=="theme"&&R!=="sx"&&R!=="as"})(styleFunctionSx);return reactExports.forwardRef(function(A,O){const H=useTheme$2(E),{className:ee,component:te="div",...ie}=extendSxProp$1(A);return jsxRuntimeExports.jsx(_,{as:te,ref:O,className:clsx(ee,T?T(w):w),theme:C&&H[C]||H,...ie})})}const globalStateClasses={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 generateUtilityClass(x,C,E="Mui"){const w=globalStateClasses[C];return w?`${E}-${w}`:`${ClassNameGenerator.generate(x)}-${C}`}function generateUtilityClasses(x,C,E="Mui"){const w={};return C.forEach(T=>{w[T]=generateUtilityClass(x,T,E)}),w}function preprocessStyles(x){const{variants:C,...E}=x,w={variants:C,style:internal_serializeStyles(E),isProcessed:!0};return w.style===E||C&&C.forEach(T=>{typeof T.style!="function"&&(T.style=internal_serializeStyles(T.style))}),w}const systemDefaultTheme=createTheme$1();function shouldForwardProp(x){return x!=="ownerState"&&x!=="theme"&&x!=="sx"&&x!=="as"}function shallowLayer(x,C){return C&&x&&typeof x=="object"&&x.styles&&!x.styles.startsWith("@layer")&&(x.styles=`@layer ${C}{${String(x.styles)}}`),x}function defaultOverridesResolver(x){return x?(C,E)=>E[x]:null}function attachTheme(x,C,E){x.theme=isObjectEmpty$1(x.theme)?E:x.theme[C]||x.theme}function processStyle(x,C,E){const w=typeof C=="function"?C(x):C;if(Array.isArray(w))return w.flatMap(T=>processStyle(x,T,E));if(Array.isArray(w?.variants)){let T;if(w.isProcessed)T=E?shallowLayer(w.style,E):w.style;else{const{variants:_,...S}=w;T=E?shallowLayer(internal_serializeStyles(S),E):S}return processStyleVariants(x,w.variants,[T],E)}return w?.isProcessed?E?shallowLayer(internal_serializeStyles(w.style),E):w.style:E?shallowLayer(internal_serializeStyles(w),E):w}function processStyleVariants(x,C,E=[],w=void 0){let T;e:for(let _=0;_<C.length;_+=1){const S=C[_];if(typeof S.props=="function"){if(T??={...x,...x.ownerState,ownerState:x.ownerState},!S.props(T))continue}else for(const R in S.props)if(x[R]!==S.props[R]&&x.ownerState?.[R]!==S.props[R])continue e;typeof S.style=="function"?(T??={...x,...x.ownerState,ownerState:x.ownerState},E.push(w?shallowLayer(internal_serializeStyles(S.style(T)),w):S.style(T))):E.push(w?shallowLayer(internal_serializeStyles(S.style),w):S.style)}return E}function createStyled(x={}){const{themeId:C,defaultTheme:E=systemDefaultTheme,rootShouldForwardProp:w=shouldForwardProp,slotShouldForwardProp:T=shouldForwardProp}=x;function _(R){attachTheme(R,C,E)}return(R,A={})=>{internal_mutateStyles(R,he=>he.filter(me=>me!==styleFunctionSx));const{name:O,slot:H,skipVariantsResolver:ee,skipSx:te,overridesResolver:ie=defaultOverridesResolver(lowercaseFirstLetter(H)),...ne}=A,ae=O&&O.startsWith("Mui")||H?"components":"custom",oe=ee!==void 0?ee:H&&H!=="Root"&&H!=="root"||!1,le=te||!1;let fe=shouldForwardProp;H==="Root"||H==="root"?fe=w:H?fe=T:isStringTag(R)&&(fe=void 0);const de=styled$2(R,{shouldForwardProp:fe,label:generateStyledLabel(),...ne}),ce=he=>{if(he.__emotion_real===he)return he;if(typeof he=="function")return function(ve){return processStyle(ve,he,ve.theme.modularCssLayers?ae:void 0)};if(isPlainObject(he)){const me=preprocessStyles(he);return function(ye){return me.variants?processStyle(ye,me,ye.theme.modularCssLayers?ae:void 0):ye.theme.modularCssLayers?shallowLayer(me.style,ae):me.style}}return he},pe=(...he)=>{const me=[],ve=he.map(ce),ye=[];if(me.push(_),O&&ie&&ye.push(function(Ee){const Ie=Ee.theme.components?.[O]?.styleOverrides;if(!Ie)return null;const Te={};for(const De in Ie)Te[De]=processStyle(Ee,Ie[De],Ee.theme.modularCssLayers?"theme":void 0);return ie(Ee,Te)}),O&&!oe&&ye.push(function(Ee){const Ie=Ee.theme?.components?.[O]?.variants;return Ie?processStyleVariants(Ee,Ie,[],Ee.theme.modularCssLayers?"theme":void 0):null}),le||ye.push(styleFunctionSx),Array.isArray(ve[0])){const be=ve.shift(),Ee=new Array(me.length).fill(""),Ae=new Array(ye.length).fill("");let Ie;Ie=[...Ee,...be,...Ae],Ie.raw=[...Ee,...be.raw,...Ae],me.unshift(Ie)}const Se=[...me,...ve,...ye],Ce=de(...Se);return R.muiName&&(Ce.muiName=R.muiName),Ce};return de.withConfig&&(pe.withConfig=de.withConfig),pe}}function generateStyledLabel(x,C){return void 0}function isObjectEmpty$1(x){for(const C in x)return!1;return!0}function isStringTag(x){return typeof x=="string"&&x.charCodeAt(0)>96}function lowercaseFirstLetter(x){return x&&x.charAt(0).toLowerCase()+x.slice(1)}const styled$1=createStyled();function resolveProps(x,C,E=!1){const w={...C};for(const T in x)if(Object.prototype.hasOwnProperty.call(x,T)){const _=T;if(_==="components"||_==="slots")w[_]={...x[_],...w[_]};else if(_==="componentsProps"||_==="slotProps"){const S=x[_],R=C[_];if(!R)w[_]=S||{};else if(!S)w[_]=R;else{w[_]={...R};for(const A in S)if(Object.prototype.hasOwnProperty.call(S,A)){const O=A;w[_][O]=resolveProps(S[O],R[O],E)}}}else _==="className"&&E&&C.className?w.className=clsx(x?.className,C?.className):_==="style"&&E&&C.style?w.style={...x?.style,...C?.style}:w[_]===void 0&&(w[_]=x[_])}return w}function getThemeProps$1(x){const{theme:C,name:E,props:w}=x;return!C||!C.components||!C.components[E]||!C.components[E].defaultProps?w:resolveProps(C.components[E].defaultProps,w)}function useThemeProps({props:x,name:C,defaultTheme:E,themeId:w}){let T=useTheme$2(E);return w&&(T=T[w]||T),getThemeProps$1({theme:T,name:C,props:x})}const useEnhancedEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function clamp(x,C=Number.MIN_SAFE_INTEGER,E=Number.MAX_SAFE_INTEGER){return Math.max(C,Math.min(x,E))}function clampWrapper(x,C=0,E=1){return clamp(x,C,E)}function hexToRgb(x){x=x.slice(1);const C=new RegExp(`.{1,${x.length>=6?2:1}}`,"g");let E=x.match(C);return E&&E[0].length===1&&(E=E.map(w=>w+w)),E?`rgb${E.length===4?"a":""}(${E.map((w,T)=>T<3?parseInt(w,16):Math.round(parseInt(w,16)/255*1e3)/1e3).join(", ")})`:""}function decomposeColor(x){if(x.type)return x;if(x.charAt(0)==="#")return decomposeColor(hexToRgb(x));const C=x.indexOf("("),E=x.substring(0,C);if(!["rgb","rgba","hsl","hsla","color"].includes(E))throw new Error(formatMuiErrorMessage(9,x));let w=x.substring(C+1,x.length-1),T;if(E==="color"){if(w=w.split(" "),T=w.shift(),w.length===4&&w[3].charAt(0)==="/"&&(w[3]=w[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(T))throw new Error(formatMuiErrorMessage(10,T))}else w=w.split(",");return w=w.map(_=>parseFloat(_)),{type:E,values:w,colorSpace:T}}const colorChannel=x=>{const C=decomposeColor(x);return C.values.slice(0,3).map((E,w)=>C.type.includes("hsl")&&w!==0?`${E}%`:E).join(" ")},private_safeColorChannel=(x,C)=>{try{return colorChannel(x)}catch{return x}};function recomposeColor(x){const{type:C,colorSpace:E}=x;let{values:w}=x;return C.includes("rgb")?w=w.map((T,_)=>_<3?parseInt(T,10):T):C.includes("hsl")&&(w[1]=`${w[1]}%`,w[2]=`${w[2]}%`),C.includes("color")?w=`${E} ${w.join(" ")}`:w=`${w.join(", ")}`,`${C}(${w})`}function hslToRgb(x){x=decomposeColor(x);const{values:C}=x,E=C[0],w=C[1]/100,T=C[2]/100,_=w*Math.min(T,1-T),S=(O,H=(O+E/30)%12)=>T-_*Math.max(Math.min(H-3,9-H,1),-1);let R="rgb";const A=[Math.round(S(0)*255),Math.round(S(8)*255),Math.round(S(4)*255)];return x.type==="hsla"&&(R+="a",A.push(C[3])),recomposeColor({type:R,values:A})}function getLuminance(x){x=decomposeColor(x);let C=x.type==="hsl"||x.type==="hsla"?decomposeColor(hslToRgb(x)).values:x.values;return C=C.map(E=>(x.type!=="color"&&(E/=255),E<=.03928?E/12.92:((E+.055)/1.055)**2.4)),Number((.2126*C[0]+.7152*C[1]+.0722*C[2]).toFixed(3))}function getContrastRatio(x,C){const E=getLuminance(x),w=getLuminance(C);return(Math.max(E,w)+.05)/(Math.min(E,w)+.05)}function alpha(x,C){return x=decomposeColor(x),C=clampWrapper(C),(x.type==="rgb"||x.type==="hsl")&&(x.type+="a"),x.type==="color"?x.values[3]=`/${C}`:x.values[3]=C,recomposeColor(x)}function private_safeAlpha(x,C,E){try{return alpha(x,C)}catch{return x}}function darken(x,C){if(x=decomposeColor(x),C=clampWrapper(C),x.type.includes("hsl"))x.values[2]*=1-C;else if(x.type.includes("rgb")||x.type.includes("color"))for(let E=0;E<3;E+=1)x.values[E]*=1-C;return recomposeColor(x)}function private_safeDarken(x,C,E){try{return darken(x,C)}catch{return x}}function lighten(x,C){if(x=decomposeColor(x),C=clampWrapper(C),x.type.includes("hsl"))x.values[2]+=(100-x.values[2])*C;else if(x.type.includes("rgb"))for(let E=0;E<3;E+=1)x.values[E]+=(255-x.values[E])*C;else if(x.type.includes("color"))for(let E=0;E<3;E+=1)x.values[E]+=(1-x.values[E])*C;return recomposeColor(x)}function private_safeLighten(x,C,E){try{return lighten(x,C)}catch{return x}}function emphasize(x,C=.15){return getLuminance(x)>.5?darken(x,C):lighten(x,C)}function private_safeEmphasize(x,C,E){try{return emphasize(x,C)}catch{return x}}const ThemeContext=reactExports.createContext(null);function useTheme$1(){return reactExports.useContext(ThemeContext)}const hasSymbol=typeof Symbol=="function"&&Symbol.for,nested=hasSymbol?Symbol.for("mui.nested"):"__THEME_NESTED__";function mergeOuterLocalTheme(x,C){return typeof C=="function"?C(x):{...x,...C}}function ThemeProvider$2(x){const{children:C,theme:E}=x,w=useTheme$1(),T=reactExports.useMemo(()=>{const _=w===null?{...E}:mergeOuterLocalTheme(w,E);return _!=null&&(_[nested]=w!==null),_},[E,w]);return jsxRuntimeExports.jsx(ThemeContext.Provider,{value:T,children:C})}const RtlContext=reactExports.createContext();function RtlProvider({value:x,...C}){return jsxRuntimeExports.jsx(RtlContext.Provider,{value:x??!0,...C})}const useRtl=()=>reactExports.useContext(RtlContext)??!1,PropsContext=reactExports.createContext(void 0);function DefaultPropsProvider({value:x,children:C}){return jsxRuntimeExports.jsx(PropsContext.Provider,{value:x,children:C})}function getThemeProps(x){const{theme:C,name:E,props:w}=x;if(!C||!C.components||!C.components[E])return w;const T=C.components[E];return T.defaultProps?resolveProps(T.defaultProps,w,C.components.mergeClassNameAndStyle):!T.styleOverrides&&!T.variants?resolveProps(T,w,C.components.mergeClassNameAndStyle):w}function useDefaultProps$1({props:x,name:C}){const E=reactExports.useContext(PropsContext);return getThemeProps({props:x,name:C,theme:{components:E}})}let globalId=0;function useGlobalId(x){const[C,E]=reactExports.useState(x),w=x||C;return reactExports.useEffect(()=>{C==null&&(globalId+=1,E(`mui-${globalId}`))},[C]),w}const safeReact={...React$1},maybeReactUseId=safeReact.useId;function useId(x){if(maybeReactUseId!==void 0){const C=maybeReactUseId();return x??C}return useGlobalId(x)}function useLayerOrder(x){const C=useTheme$3(),E=useId()||"",{modularCssLayers:w}=x;let T="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!w||C!==null?T="":typeof w=="string"?T=w.replace(/mui(?!\.)/g,T):T=`@layer ${T};`,useEnhancedEffect(()=>{const _=document.querySelector("head");if(!_)return;const S=_.firstChild;if(T){if(S&&S.hasAttribute?.("data-mui-layer-order")&&S.getAttribute("data-mui-layer-order")===E)return;const R=document.createElement("style");R.setAttribute("data-mui-layer-order",E),R.textContent=T,_.prepend(R)}else _.querySelector(`style[data-mui-layer-order="${E}"]`)?.remove()},[T,E]),T?jsxRuntimeExports.jsx(GlobalStyles$1,{styles:T}):null}const EMPTY_THEME={};function useThemeScoping(x,C,E,w=!1){return reactExports.useMemo(()=>{const T=x&&C[x]||C;if(typeof E=="function"){const _=E(T),S=x?{...C,[x]:_}:_;return w?()=>S:S}return x?{...C,[x]:E}:{...C,...E}},[x,C,E,w])}function ThemeProvider$1(x){const{children:C,theme:E,themeId:w}=x,T=useTheme$3(EMPTY_THEME),_=useTheme$1()||EMPTY_THEME,S=useThemeScoping(w,T,E),R=useThemeScoping(w,_,E,!0),A=(w?S[w]:S).direction==="rtl",O=useLayerOrder(S);return jsxRuntimeExports.jsx(ThemeProvider$2,{theme:R,children:jsxRuntimeExports.jsx(ThemeContext$1.Provider,{value:S,children:jsxRuntimeExports.jsx(RtlProvider,{value:A,children:jsxRuntimeExports.jsxs(DefaultPropsProvider,{value:w?S[w].components:S.components,children:[O,C]})})})})}const arg={theme:void 0};function unstable_memoTheme(x){let C,E;return function(T){let _=C;return(_===void 0||T.theme!==E)&&(arg.theme=T.theme,_=preprocessStyles(x(arg)),C=_,E=T.theme),_}}const DEFAULT_MODE_STORAGE_KEY="mode",DEFAULT_COLOR_SCHEME_STORAGE_KEY="color-scheme",DEFAULT_ATTRIBUTE="data-color-scheme";function InitColorSchemeScript(x){const{defaultMode:C="system",defaultLightColorScheme:E="light",defaultDarkColorScheme:w="dark",modeStorageKey:T=DEFAULT_MODE_STORAGE_KEY,colorSchemeStorageKey:_=DEFAULT_COLOR_SCHEME_STORAGE_KEY,attribute:S=DEFAULT_ATTRIBUTE,colorSchemeNode:R="document.documentElement",nonce:A}=x||{};let O="",H=S;if(S==="class"&&(H=".%s"),S==="data"&&(H="[data-%s]"),H.startsWith(".")){const te=H.substring(1);O+=`${R}.classList.remove('${te}'.replace('%s', light), '${te}'.replace('%s', dark));
      ${R}.classList.add('${te}'.replace('%s', colorScheme));`}const ee=H.match(/\[([^\]]+)\]/);if(ee){const[te,ie]=ee[1].split("=");ie||(O+=`${R}.removeAttribute('${te}'.replace('%s', light));
      ${R}.removeAttribute('${te}'.replace('%s', dark));`),O+=`
      ${R}.setAttribute('${te}'.replace('%s', colorScheme), ${ie?`${ie}.replace('%s', colorScheme)`:'""'});`}else O+=`${R}.setAttribute('${H}', colorScheme);`;return jsxRuntimeExports.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?A:"",dangerouslySetInnerHTML:{__html:`(function() {
try {
  let colorScheme = '';
  const mode = localStorage.getItem('${T}') || '${C}';
  const dark = localStorage.getItem('${_}-dark') || '${w}';
  const light = localStorage.getItem('${_}-light') || '${E}';
  if (mode === 'system') {
    // handle system mode
    const mql = window.matchMedia('(prefers-color-scheme: dark)');
    if (mql.matches) {
      colorScheme = dark
    } else {
      colorScheme = light
    }
  }
  if (mode === 'light') {
    colorScheme = light;
  }
  if (mode === 'dark') {
    colorScheme = dark;
  }
  if (colorScheme) {
    ${O}
  }
} catch(e){}})();`}},"mui-color-scheme-init")}function noop$4(){}const localStorageManager=({key:x,storageWindow:C})=>(!C&&typeof window<"u"&&(C=window),{get(E){if(typeof window>"u")return;if(!C)return E;let w;try{w=C.localStorage.getItem(x)}catch{}return w||E},set:E=>{if(C)try{C.localStorage.setItem(x,E)}catch{}},subscribe:E=>{if(!C)return noop$4;const w=T=>{const _=T.newValue;T.key===x&&E(_)};return C.addEventListener("storage",w),()=>{C.removeEventListener("storage",w)}}});function noop$3(){}function getSystemMode(x){if(typeof window<"u"&&typeof window.matchMedia=="function"&&x==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function processState(x,C){if(x.mode==="light"||x.mode==="system"&&x.systemMode==="light")return C("light");if(x.mode==="dark"||x.mode==="system"&&x.systemMode==="dark")return C("dark")}function getColorScheme(x){return processState(x,C=>{if(C==="light")return x.lightColorScheme;if(C==="dark")return x.darkColorScheme})}function useCurrentColorScheme(x){const{defaultMode:C="light",defaultLightColorScheme:E,defaultDarkColorScheme:w,supportedColorSchemes:T=[],modeStorageKey:_=DEFAULT_MODE_STORAGE_KEY,colorSchemeStorageKey:S=DEFAULT_COLOR_SCHEME_STORAGE_KEY,storageWindow:R=typeof window>"u"?void 0:window,storageManager:A=localStorageManager,noSsr:O=!1}=x,H=T.join(","),ee=T.length>1,te=reactExports.useMemo(()=>A?.({key:_,storageWindow:R}),[A,_,R]),ie=reactExports.useMemo(()=>A?.({key:`${S}-light`,storageWindow:R}),[A,S,R]),ne=reactExports.useMemo(()=>A?.({key:`${S}-dark`,storageWindow:R}),[A,S,R]),[ae,oe]=reactExports.useState(()=>{const ve=te?.get(C)||C,ye=ie?.get(E)||E,Se=ne?.get(w)||w;return{mode:ve,systemMode:getSystemMode(ve),lightColorScheme:ye,darkColorScheme:Se}}),[le,fe]=reactExports.useState(O||!ee);reactExports.useEffect(()=>{fe(!0)},[]);const de=getColorScheme(ae),ce=reactExports.useCallback(ve=>{oe(ye=>{if(ve===ye.mode)return ye;const Se=ve??C;return te?.set(Se),{...ye,mode:Se,systemMode:getSystemMode(Se)}})},[te,C]),pe=reactExports.useCallback(ve=>{ve?typeof ve=="string"?ve&&!H.includes(ve)?console.error(`\`${ve}\` does not exist in \`theme.colorSchemes\`.`):oe(ye=>{const Se={...ye};return processState(ye,Ce=>{Ce==="light"&&(ie?.set(ve),Se.lightColorScheme=ve),Ce==="dark"&&(ne?.set(ve),Se.darkColorScheme=ve)}),Se}):oe(ye=>{const Se={...ye},Ce=ve.light===null?E:ve.light,be=ve.dark===null?w:ve.dark;return Ce&&(H.includes(Ce)?(Se.lightColorScheme=Ce,ie?.set(Ce)):console.error(`\`${Ce}\` does not exist in \`theme.colorSchemes\`.`)),be&&(H.includes(be)?(Se.darkColorScheme=be,ne?.set(be)):console.error(`\`${be}\` does not exist in \`theme.colorSchemes\`.`)),Se}):oe(ye=>(ie?.set(E),ne?.set(w),{...ye,lightColorScheme:E,darkColorScheme:w}))},[H,ie,ne,E,w]),he=reactExports.useCallback(ve=>{ae.mode==="system"&&oe(ye=>{const Se=ve?.matches?"dark":"light";return ye.systemMode===Se?ye:{...ye,systemMode:Se}})},[ae.mode]),me=reactExports.useRef(he);return me.current=he,reactExports.useEffect(()=>{if(typeof window.matchMedia!="function"||!ee)return;const ve=(...Se)=>me.current(...Se),ye=window.matchMedia("(prefers-color-scheme: dark)");return ye.addListener(ve),ve(ye),()=>{ye.removeListener(ve)}},[ee]),reactExports.useEffect(()=>{if(ee){const ve=te?.subscribe(Ce=>{(!Ce||["light","dark","system"].includes(Ce))&&ce(Ce||C)})||noop$3,ye=ie?.subscribe(Ce=>{(!Ce||H.match(Ce))&&pe({light:Ce})})||noop$3,Se=ne?.subscribe(Ce=>{(!Ce||H.match(Ce))&&pe({dark:Ce})})||noop$3;return()=>{ve(),ye(),Se()}}},[pe,ce,H,C,R,ee,te,ie,ne]),{...ae,mode:le?ae.mode:void 0,systemMode:le?ae.systemMode:void 0,colorScheme:le?de:void 0,setMode:ce,setColorScheme:pe}}const DISABLE_CSS_TRANSITION="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function createCssVarsProvider(x){const{themeId:C,theme:E={},modeStorageKey:w=DEFAULT_MODE_STORAGE_KEY,colorSchemeStorageKey:T=DEFAULT_COLOR_SCHEME_STORAGE_KEY,disableTransitionOnChange:_=!1,defaultColorScheme:S,resolveTheme:R}=x,A={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},O=reactExports.createContext(void 0),H=()=>reactExports.useContext(O)||A,ee={},te={};function ie(le){const{children:fe,theme:de,modeStorageKey:ce=w,colorSchemeStorageKey:pe=T,disableTransitionOnChange:he=_,storageManager:me,storageWindow:ve=typeof window>"u"?void 0:window,documentNode:ye=typeof document>"u"?void 0:document,colorSchemeNode:Se=typeof document>"u"?void 0:document.documentElement,disableNestedContext:Ce=!1,disableStyleSheetGeneration:be=!1,defaultMode:Ee="system",forceThemeRerender:Ae=!1,noSsr:Ie}=le,Te=reactExports.useRef(!1),De=useTheme$1(),Ue=reactExports.useContext(O),ze=!!Ue&&!Ce,Pe=reactExports.useMemo(()=>de||(typeof E=="function"?E():E),[de]),$e=Pe[C],He=$e||Pe,{colorSchemes:je=ee,components:Ne=te,cssVarPrefix:Oe}=He,Ve=Object.keys(je).filter(zt=>!!je[zt]).join(","),Ht=reactExports.useMemo(()=>Ve.split(","),[Ve]),Kt=typeof S=="string"?S:S.light,ir=typeof S=="string"?S:S.dark,$t=je[Kt]&&je[ir]?Ee:je[He.defaultColorScheme]?.palette?.mode||He.palette?.mode,{mode:tr,setMode:ar,systemMode:gr,lightColorScheme:er,darkColorScheme:sr,colorScheme:pr,setColorScheme:ur}=useCurrentColorScheme({supportedColorSchemes:Ht,defaultLightColorScheme:Kt,defaultDarkColorScheme:ir,modeStorageKey:ce,colorSchemeStorageKey:pe,defaultMode:$t,storageManager:me,storageWindow:ve,noSsr:Ie});let Sr=tr,hr=pr;ze&&(Sr=Ue.mode,hr=Ue.colorScheme);let yr=hr||He.defaultColorScheme;He.vars&&!Ae&&(yr=He.defaultColorScheme);const xr=reactExports.useMemo(()=>{const zt=He.generateThemeVars?.()||He.vars,Ft={...He,components:Ne,colorSchemes:je,cssVarPrefix:Oe,vars:zt};if(typeof Ft.generateSpacing=="function"&&(Ft.spacing=Ft.generateSpacing()),yr){const kt=je[yr];kt&&typeof kt=="object"&&Object.keys(kt).forEach(ke=>{kt[ke]&&typeof kt[ke]=="object"?Ft[ke]={...Ft[ke],...kt[ke]}:Ft[ke]=kt[ke]})}return R?R(Ft):Ft},[He,yr,Ne,je,Oe]),Yt=He.colorSchemeSelector;useEnhancedEffect(()=>{if(hr&&Se&&Yt&&Yt!=="media"){const zt=Yt;let Ft=Yt;if(zt==="class"&&(Ft=".%s"),zt==="data"&&(Ft="[data-%s]"),zt?.startsWith("data-")&&!zt.includes("%s")&&(Ft=`[${zt}="%s"]`),Ft.startsWith("."))Se.classList.remove(...Ht.map(kt=>Ft.substring(1).replace("%s",kt))),Se.classList.add(Ft.substring(1).replace("%s",hr));else{const kt=Ft.replace("%s",hr).match(/\[([^\]]+)\]/);if(kt){const[ke,Be]=kt[1].split("=");Be||Ht.forEach(et=>{Se.removeAttribute(ke.replace(hr,et))}),Se.setAttribute(ke,Be?Be.replace(/"|'/g,""):"")}else Se.setAttribute(Ft,hr)}}},[hr,Yt,Se,Ht]),reactExports.useEffect(()=>{let zt;if(he&&Te.current&&ye){const Ft=ye.createElement("style");Ft.appendChild(ye.createTextNode(DISABLE_CSS_TRANSITION)),ye.head.appendChild(Ft),window.getComputedStyle(ye.body),zt=setTimeout(()=>{ye.head.removeChild(Ft)},1)}return()=>{clearTimeout(zt)}},[hr,he,ye]),reactExports.useEffect(()=>(Te.current=!0,()=>{Te.current=!1}),[]);const Jt=reactExports.useMemo(()=>({allColorSchemes:Ht,colorScheme:hr,darkColorScheme:sr,lightColorScheme:er,mode:Sr,setColorScheme:ur,setMode:ar,systemMode:gr}),[Ht,hr,sr,er,Sr,ur,ar,gr,xr.colorSchemeSelector]);let mr=!0;(be||He.cssVariables===!1||ze&&De?.cssVarPrefix===Oe)&&(mr=!1);const Cr=jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(ThemeProvider$1,{themeId:$e?C:void 0,theme:xr,children:fe}),mr&&jsxRuntimeExports.jsx(GlobalStyles$2,{styles:xr.generateStyleSheets?.()||[]})]});return ze?Cr:jsxRuntimeExports.jsx(O.Provider,{value:Jt,children:Cr})}const ne=typeof S=="string"?S:S.light,ae=typeof S=="string"?S:S.dark;return{CssVarsProvider:ie,useColorScheme:H,getInitColorSchemeScript:le=>InitColorSchemeScript({colorSchemeStorageKey:T,defaultLightColorScheme:ne,defaultDarkColorScheme:ae,modeStorageKey:w,...le})}}function createGetCssVar$1(x=""){function C(...w){if(!w.length)return"";const T=w[0];return typeof T=="string"&&!T.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${x?`${x}-`:""}${T}${C(...w.slice(1))})`:`, ${T}`}return(w,...T)=>`var(--${x?`${x}-`:""}${w}${C(...T)})`}const assignNestedKeys=(x,C,E,w=[])=>{let T=x;C.forEach((_,S)=>{S===C.length-1?Array.isArray(T)?T[Number(_)]=E:T&&typeof T=="object"&&(T[_]=E):T&&typeof T=="object"&&(T[_]||(T[_]=w.includes(_)?[]:{}),T=T[_])})},walkObjectDeep=(x,C,E)=>{function w(T,_=[],S=[]){Object.entries(T).forEach(([R,A])=>{(!E||E&&!E([..._,R]))&&A!=null&&(typeof A=="object"&&Object.keys(A).length>0?w(A,[..._,R],Array.isArray(A)?[...S,R]:S):C([..._,R],A,S))})}w(x)},getCssValue=(x,C)=>typeof C=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(w=>x.includes(w))||x[x.length-1].toLowerCase().includes("opacity")?C:`${C}px`:C;function cssVarsParser(x,C){const{prefix:E,shouldSkipGeneratingVar:w}=C||{},T={},_={},S={};return walkObjectDeep(x,(R,A,O)=>{if((typeof A=="string"||typeof A=="number")&&(!w||!w(R,A))){const H=`--${E?`${E}-`:""}${R.join("-")}`,ee=getCssValue(R,A);Object.assign(T,{[H]:ee}),assignNestedKeys(_,R,`var(${H})`,O),assignNestedKeys(S,R,`var(${H}, ${ee})`,O)}},R=>R[0]==="vars"),{css:T,vars:_,varsWithDefaults:S}}function prepareCssVars(x,C={}){const{getSelector:E=le,disableCssColorScheme:w,colorSchemeSelector:T,enableContrastVars:_}=C,{colorSchemes:S={},components:R,defaultColorScheme:A="light",...O}=x,{vars:H,css:ee,varsWithDefaults:te}=cssVarsParser(O,C);let ie=te;const ne={},{[A]:ae,...oe}=S;if(Object.entries(oe||{}).forEach(([ce,pe])=>{const{vars:he,css:me,varsWithDefaults:ve}=cssVarsParser(pe,C);ie=deepmerge(ie,ve),ne[ce]={css:me,vars:he}}),ae){const{css:ce,vars:pe,varsWithDefaults:he}=cssVarsParser(ae,C);ie=deepmerge(ie,he),ne[A]={css:ce,vars:pe}}function le(ce,pe){let he=T;if(T==="class"&&(he=".%s"),T==="data"&&(he="[data-%s]"),T?.startsWith("data-")&&!T.includes("%s")&&(he=`[${T}="%s"]`),ce){if(he==="media")return x.defaultColorScheme===ce?":root":{[`@media (prefers-color-scheme: ${S[ce]?.palette?.mode||ce})`]:{":root":pe}};if(he)return x.defaultColorScheme===ce?`:root, ${he.replace("%s",String(ce))}`:he.replace("%s",String(ce))}return":root"}return{vars:ie,generateThemeVars:()=>{let ce={...H};return Object.entries(ne).forEach(([,{vars:pe}])=>{ce=deepmerge(ce,pe)}),ce},generateStyleSheets:()=>{const ce=[],pe=x.defaultColorScheme||"light";function he(ye,Se){Object.keys(Se).length&&ce.push(typeof ye=="string"?{[ye]:{...Se}}:ye)}he(E(void 0,{...ee}),ee);const{[pe]:me,...ve}=ne;if(me){const{css:ye}=me,Se=S[pe]?.palette?.mode,Ce=!w&&Se?{colorScheme:Se,...ye}:{...ye};he(E(pe,{...Ce}),Ce)}return Object.entries(ve).forEach(([ye,{css:Se}])=>{const Ce=S[ye]?.palette?.mode,be=!w&&Ce?{colorScheme:Ce,...Se}:{...Se};he(E(ye,{...be}),be)}),_&&ce.push({":root":{"--__l-threshold":"0.7","--__l":"clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)","--__a":"clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)"}}),ce}}}function createGetColorSchemeSelector(x){return function(E){return x==="media"?`@media (prefers-color-scheme: ${E})`:x?x.startsWith("data-")&&!x.includes("%s")?`[${x}="${E}"] &`:x==="class"?`.${E} &`:x==="data"?`[data-${E}] &`:`${x.replace("%s",E)} &`:"&"}}function isMuiElement(x,C){return reactExports.isValidElement(x)&&C.indexOf(x.type.muiName??x.type?._payload?.value?.muiName)!==-1}const defaultTheme$2=createTheme$1(),defaultCreateStyledComponent=styled$1("div",{name:"MuiStack",slot:"Root"});function useThemePropsDefault(x){return useThemeProps({props:x,name:"MuiStack",defaultTheme:defaultTheme$2})}function joinChildren(x,C){const E=reactExports.Children.toArray(x).filter(Boolean);return E.reduce((w,T,_)=>(w.push(T),_<E.length-1&&w.push(reactExports.cloneElement(C,{key:`separator-${_}`})),w),[])}const getSideFromDirection=x=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[x],style=({ownerState:x,theme:C})=>{let E={display:"flex",flexDirection:"column",...handleBreakpoints({theme:C},resolveBreakpointValues({values:x.direction,breakpoints:C.breakpoints.values}),w=>({flexDirection:w}))};if(x.spacing){const w=createUnarySpacing(C),T=Object.keys(C.breakpoints.values).reduce((A,O)=>((typeof x.spacing=="object"&&x.spacing[O]!=null||typeof x.direction=="object"&&x.direction[O]!=null)&&(A[O]=!0),A),{}),_=resolveBreakpointValues({values:x.direction,base:T}),S=resolveBreakpointValues({values:x.spacing,base:T});typeof _=="object"&&Object.keys(_).forEach((A,O,H)=>{if(!_[A]){const te=O>0?_[H[O-1]]:"column";_[A]=te}}),E=deepmerge(E,handleBreakpoints({theme:C},S,(A,O)=>x.useFlexGap?{gap:getValue(w,A)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${getSideFromDirection(O?_[O]:x.direction)}`]:getValue(w,A)}}))}return E=mergeBreakpointsInOrder(C.breakpoints,E),E};function createStack(x={}){const{createStyledComponent:C=defaultCreateStyledComponent,useThemeProps:E=useThemePropsDefault,componentName:w="MuiStack"}=x,T=()=>composeClasses({root:["root"]},A=>generateUtilityClass(w,A),{}),_=C(style);return reactExports.forwardRef(function(A,O){const H=E(A),ee=extendSxProp$1(H),{component:te="div",direction:ie="column",spacing:ne=0,divider:ae,children:oe,className:le,useFlexGap:fe=!1,...de}=ee,ce={direction:ie,spacing:ne,useFlexGap:fe},pe=T();return jsxRuntimeExports.jsx(_,{as:te,ownerState:ce,ref:O,className:clsx(pe.root,le),...de,children:ae?joinChildren(oe,ae):oe})})}const common$1={black:"#000",white:"#fff"},grey={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"},purple={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},red={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},orange={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},blue={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},lightBlue={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},green={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function getLight(){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:common$1.white,default:common$1.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 light=getLight();function getDark(){return{text:{primary:common$1.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:common$1.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 dark=getDark();function addLightOrDark(x,C,E,w){const T=w.light||w,_=w.dark||w*1.5;x[C]||(x.hasOwnProperty(E)?x[C]=x[E]:C==="light"?x.light=lighten(x.main,T):C==="dark"&&(x.dark=darken(x.main,_)))}function mixLightOrDark(x,C,E,w,T){const _=T.light||T,S=T.dark||T*1.5;C[E]||(C.hasOwnProperty(w)?C[E]=C[w]:E==="light"?C.light=`color-mix(in ${x}, ${C.main}, #fff ${(_*100).toFixed(0)}%)`:E==="dark"&&(C.dark=`color-mix(in ${x}, ${C.main}, #000 ${(S*100).toFixed(0)}%)`))}function getDefaultPrimary(x="light"){return x==="dark"?{main:blue[200],light:blue[50],dark:blue[400]}:{main:blue[700],light:blue[400],dark:blue[800]}}function getDefaultSecondary(x="light"){return x==="dark"?{main:purple[200],light:purple[50],dark:purple[400]}:{main:purple[500],light:purple[300],dark:purple[700]}}function getDefaultError(x="light"){return x==="dark"?{main:red[500],light:red[300],dark:red[700]}:{main:red[700],light:red[400],dark:red[800]}}function getDefaultInfo(x="light"){return x==="dark"?{main:lightBlue[400],light:lightBlue[300],dark:lightBlue[700]}:{main:lightBlue[700],light:lightBlue[500],dark:lightBlue[900]}}function getDefaultSuccess(x="light"){return x==="dark"?{main:green[400],light:green[300],dark:green[700]}:{main:green[800],light:green[500],dark:green[900]}}function getDefaultWarning(x="light"){return x==="dark"?{main:orange[400],light:orange[300],dark:orange[700]}:{main:"#ed6c02",light:orange[500],dark:orange[900]}}function contrastColor(x){return`oklch(from ${x} var(--__l) 0 h / var(--__a))`}function createPalette(x){const{mode:C="light",contrastThreshold:E=3,tonalOffset:w=.2,colorSpace:T,..._}=x,S=x.primary||getDefaultPrimary(C),R=x.secondary||getDefaultSecondary(C),A=x.error||getDefaultError(C),O=x.info||getDefaultInfo(C),H=x.success||getDefaultSuccess(C),ee=x.warning||getDefaultWarning(C);function te(oe){return T?contrastColor(oe):getContrastRatio(oe,dark.text.primary)>=E?dark.text.primary:light.text.primary}const ie=({color:oe,name:le,mainShade:fe=500,lightShade:de=300,darkShade:ce=700})=>{if(oe={...oe},!oe.main&&oe[fe]&&(oe.main=oe[fe]),!oe.hasOwnProperty("main"))throw new Error(formatMuiErrorMessage(11,le?` (${le})`:"",fe));if(typeof oe.main!="string")throw new Error(formatMuiErrorMessage(12,le?` (${le})`:"",JSON.stringify(oe.main)));return T?(mixLightOrDark(T,oe,"light",de,w),mixLightOrDark(T,oe,"dark",ce,w)):(addLightOrDark(oe,"light",de,w),addLightOrDark(oe,"dark",ce,w)),oe.contrastText||(oe.contrastText=te(oe.main)),oe};let ne;return C==="light"?ne=getLight():C==="dark"&&(ne=getDark()),deepmerge({common:{...common$1},mode:C,primary:ie({color:S,name:"primary"}),secondary:ie({color:R,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:ie({color:A,name:"error"}),warning:ie({color:ee,name:"warning"}),info:ie({color:O,name:"info"}),success:ie({color:H,name:"success"}),grey,contrastThreshold:E,getContrastText:te,augmentColor:ie,tonalOffset:w,...ne},_)}function prepareTypographyVars(x){const C={};return Object.entries(x).forEach(w=>{const[T,_]=w;typeof _=="object"&&(C[T]=`${_.fontStyle?`${_.fontStyle} `:""}${_.fontVariant?`${_.fontVariant} `:""}${_.fontWeight?`${_.fontWeight} `:""}${_.fontStretch?`${_.fontStretch} `:""}${_.fontSize||""}${_.lineHeight?`/${_.lineHeight} `:""}${_.fontFamily||""}`)}),C}function createMixins(x,C){return{toolbar:{minHeight:56,[x.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[x.up("sm")]:{minHeight:64}},...C}}function round$2(x){return Math.round(x*1e5)/1e5}const caseAllCaps={textTransform:"uppercase"},defaultFontFamily='"Roboto", "Helvetica", "Arial", sans-serif';function createTypography(x,C){const{fontFamily:E=defaultFontFamily,fontSize:w=14,fontWeightLight:T=300,fontWeightRegular:_=400,fontWeightMedium:S=500,fontWeightBold:R=700,htmlFontSize:A=16,allVariants:O,pxToRem:H,...ee}=typeof C=="function"?C(x):C,te=w/14,ie=H||(oe=>`${oe/A*te}rem`),ne=(oe,le,fe,de,ce)=>({fontFamily:E,fontWeight:oe,fontSize:ie(le),lineHeight:fe,...E===defaultFontFamily?{letterSpacing:`${round$2(de/le)}em`}:{},...ce,...O}),ae={h1:ne(T,96,1.167,-1.5),h2:ne(T,60,1.2,-.5),h3:ne(_,48,1.167,0),h4:ne(_,34,1.235,.25),h5:ne(_,24,1.334,0),h6:ne(S,20,1.6,.15),subtitle1:ne(_,16,1.75,.15),subtitle2:ne(S,14,1.57,.1),body1:ne(_,16,1.5,.15),body2:ne(_,14,1.43,.15),button:ne(S,14,1.75,.4,caseAllCaps),caption:ne(_,12,1.66,.4),overline:ne(_,12,2.66,1,caseAllCaps),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return deepmerge({htmlFontSize:A,pxToRem:ie,fontFamily:E,fontSize:w,fontWeightLight:T,fontWeightRegular:_,fontWeightMedium:S,fontWeightBold:R,...ae},ee,{clone:!1})}const shadowKeyUmbraOpacity=.2,shadowKeyPenumbraOpacity=.14,shadowAmbientShadowOpacity=.12;function createShadow(...x){return[`${x[0]}px ${x[1]}px ${x[2]}px ${x[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`,`${x[4]}px ${x[5]}px ${x[6]}px ${x[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`,`${x[8]}px ${x[9]}px ${x[10]}px ${x[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(",")}const shadows=["none",createShadow(0,2,1,-1,0,1,1,0,0,1,3,0),createShadow(0,3,1,-2,0,2,2,0,0,1,5,0),createShadow(0,3,3,-2,0,3,4,0,0,1,8,0),createShadow(0,2,4,-1,0,4,5,0,0,1,10,0),createShadow(0,3,5,-1,0,5,8,0,0,1,14,0),createShadow(0,3,5,-1,0,6,10,0,0,1,18,0),createShadow(0,4,5,-2,0,7,10,1,0,2,16,1),createShadow(0,5,5,-3,0,8,10,1,0,3,14,2),createShadow(0,5,6,-3,0,9,12,1,0,3,16,2),createShadow(0,6,6,-3,0,10,14,1,0,4,18,3),createShadow(0,6,7,-4,0,11,15,1,0,4,20,3),createShadow(0,7,8,-4,0,12,17,2,0,5,22,4),createShadow(0,7,8,-4,0,13,19,2,0,5,24,4),createShadow(0,7,9,-4,0,14,21,2,0,5,26,4),createShadow(0,8,9,-5,0,15,22,2,0,6,28,5),createShadow(0,8,10,-5,0,16,24,2,0,6,30,5),createShadow(0,8,11,-5,0,17,26,2,0,6,32,5),createShadow(0,9,11,-5,0,18,28,2,0,7,34,6),createShadow(0,9,12,-6,0,19,29,2,0,7,36,6),createShadow(0,10,13,-6,0,20,31,3,0,8,38,7),createShadow(0,10,13,-6,0,21,33,3,0,8,40,7),createShadow(0,10,14,-6,0,22,35,3,0,8,42,7),createShadow(0,11,14,-7,0,23,36,3,0,9,44,8),createShadow(0,11,15,-7,0,24,38,3,0,9,46,8)],easing={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)"},duration={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function formatMs(x){return`${Math.round(x)}ms`}function getAutoHeightDuration(x){if(!x)return 0;const C=x/36;return Math.min(Math.round((4+15*C**.25+C/5)*10),3e3)}function createTransitions(x){const C={...easing,...x.easing},E={...duration,...x.duration};return{getAutoHeightDuration,create:(T=["all"],_={})=>{const{duration:S=E.standard,easing:R=C.easeInOut,delay:A=0,...O}=_;return(Array.isArray(T)?T:[T]).map(H=>`${H} ${typeof S=="string"?S:formatMs(S)} ${R} ${typeof A=="string"?A:formatMs(A)}`).join(",")},...x,easing:C,duration:E}}const zIndex={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function isSerializable(x){return isPlainObject(x)||typeof x>"u"||typeof x=="string"||typeof x=="boolean"||typeof x=="number"||Array.isArray(x)}function stringifyTheme(x={}){const C={...x};function E(w){const T=Object.entries(w);for(let _=0;_<T.length;_++){const[S,R]=T[_];!isSerializable(R)||S.startsWith("unstable_")?delete w[S]:isPlainObject(R)&&(w[S]={...R},E(w[S]))}}return E(C),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';

const theme = ${JSON.stringify(C,null,2)};

theme.breakpoints = createBreakpoints(theme.breakpoints || {});
theme.transitions = createTransitions(theme.transitions || {});

export default theme;`}function coefficientToPercentage(x){return typeof x=="number"?`${(x*100).toFixed(0)}%`:`calc((${x}) * 100%)`}const parseAddition=x=>{if(!Number.isNaN(+x))return+x;const C=x.match(/\d*\.?\d+/g);if(!C)return 0;let E=0;for(let w=0;w<C.length;w+=1)E+=+C[w];return E};function attachColorManipulators(x){Object.assign(x,{alpha(C,E){const w=this||x;return w.colorSpace?`oklch(from ${C} l c h / ${typeof E=="string"?`calc(${E})`:E})`:w.vars?`rgba(${C.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof E=="string"?`calc(${E})`:E})`:alpha(C,parseAddition(E))},lighten(C,E){const w=this||x;return w.colorSpace?`color-mix(in ${w.colorSpace}, ${C}, #fff ${coefficientToPercentage(E)})`:lighten(C,E)},darken(C,E){const w=this||x;return w.colorSpace?`color-mix(in ${w.colorSpace}, ${C}, #000 ${coefficientToPercentage(E)})`:darken(C,E)}})}function createThemeNoVars(x={},...C){const{breakpoints:E,mixins:w={},spacing:T,palette:_={},transitions:S={},typography:R={},shape:A,colorSpace:O,...H}=x;if(x.vars&&x.generateThemeVars===void 0)throw new Error(formatMuiErrorMessage(20));const ee=createPalette({..._,colorSpace:O}),te=createTheme$1(x);let ie=deepmerge(te,{mixins:createMixins(te.breakpoints,w),palette:ee,shadows:shadows.slice(),typography:createTypography(ee,R),transitions:createTransitions(S),zIndex:{...zIndex}});return ie=deepmerge(ie,H),ie=C.reduce((ne,ae)=>deepmerge(ne,ae),ie),ie.unstable_sxConfig={...defaultSxConfig,...H?.unstable_sxConfig},ie.unstable_sx=function(ae){return styleFunctionSx({sx:ae,theme:this})},ie.toRuntimeSource=stringifyTheme,attachColorManipulators(ie),ie}function getOverlayAlpha(x){let C;return x<1?C=5.11916*x**2:C=4.5*Math.log(x+1)+2,Math.round(C*10)/1e3}const defaultDarkOverlays=[...Array(25)].map((x,C)=>{if(C===0)return"none";const E=getOverlayAlpha(C);return`linear-gradient(rgba(255 255 255 / ${E}), rgba(255 255 255 / ${E}))`});function getOpacity(x){return{inputPlaceholder:x==="dark"?.5:.42,inputUnderline:x==="dark"?.7:.42,switchTrackDisabled:x==="dark"?.2:.12,switchTrack:x==="dark"?.3:.38}}function getOverlays(x){return x==="dark"?defaultDarkOverlays:[]}function createColorScheme(x){const{palette:C={mode:"light"},opacity:E,overlays:w,colorSpace:T,..._}=x,S=createPalette({...C,colorSpace:T});return{palette:S,opacity:{...getOpacity(S.mode),...E},overlays:w||getOverlays(S.mode),..._}}function shouldSkipGeneratingVar(x){return!!x[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!x[0].match(/sxConfig$/)||x[0]==="palette"&&!!x[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}const excludeVariablesFromRoot=x=>[...[...Array(25)].map((C,E)=>`--${x?`${x}-`:""}overlays-${E}`),`--${x?`${x}-`:""}palette-AppBar-darkBg`,`--${x?`${x}-`:""}palette-AppBar-darkColor`],defaultGetSelector=x=>(C,E)=>{const w=x.rootSelector||":root",T=x.colorSchemeSelector;let _=T;if(T==="class"&&(_=".%s"),T==="data"&&(_="[data-%s]"),T?.startsWith("data-")&&!T.includes("%s")&&(_=`[${T}="%s"]`),x.defaultColorScheme===C){if(C==="dark"){const S={};return excludeVariablesFromRoot(x.cssVarPrefix).forEach(R=>{S[R]=E[R],delete E[R]}),_==="media"?{[w]:E,"@media (prefers-color-scheme: dark)":{[w]:S}}:_?{[_.replace("%s",C)]:S,[`${w}, ${_.replace("%s",C)}`]:E}:{[w]:{...E,...S}}}if(_&&_!=="media")return`${w}, ${_.replace("%s",String(C))}`}else if(C){if(_==="media")return{[`@media (prefers-color-scheme: ${String(C)})`]:{[w]:E}};if(_)return _.replace("%s",String(C))}return w};function assignNode(x,C){C.forEach(E=>{x[E]||(x[E]={})})}function setColor(x,C,E){!x[C]&&E&&(x[C]=E)}function toRgb(x){return typeof x!="string"||!x.startsWith("hsl")?x:hslToRgb(x)}function setColorChannel(x,C){`${C}Channel`in x||(x[`${C}Channel`]=private_safeColorChannel(toRgb(x[C])))}function getSpacingVal(x){return typeof x=="number"?`${x}px`:typeof x=="string"||typeof x=="function"||Array.isArray(x)?x:"8px"}const silent=x=>{try{return x()}catch{}},createGetCssVar=(x="mui")=>createGetCssVar$1(x);function attachColorScheme$1(x,C,E,w,T){if(!E)return;E=E===!0?{}:E;const _=T==="dark"?"dark":"light";if(!w){C[T]=createColorScheme({...E,palette:{mode:_,...E?.palette},colorSpace:x});return}const{palette:S,...R}=createThemeNoVars({...w,palette:{mode:_,...E?.palette},colorSpace:x});return C[T]={...E,palette:S,opacity:{...getOpacity(_),...E?.opacity},overlays:E?.overlays||getOverlays(_)},R}function createThemeWithVars(x={},...C){const{colorSchemes:E={light:!0},defaultColorScheme:w,disableCssColorScheme:T=!1,cssVarPrefix:_="mui",nativeColor:S=!1,shouldSkipGeneratingVar:R=shouldSkipGeneratingVar,colorSchemeSelector:A=E.light&&E.dark?"media":void 0,rootSelector:O=":root",...H}=x,ee=Object.keys(E)[0],te=w||(E.light&&ee!=="light"?"light":ee),ie=createGetCssVar(_),{[te]:ne,light:ae,dark:oe,...le}=E,fe={...le};let de=ne;if((te==="dark"&&!("dark"in E)||te==="light"&&!("light"in E))&&(de=!0),!de)throw new Error(formatMuiErrorMessage(21,te));let ce;S&&(ce="oklch");const pe=attachColorScheme$1(ce,fe,de,H,te);ae&&!fe.light&&attachColorScheme$1(ce,fe,ae,void 0,"light"),oe&&!fe.dark&&attachColorScheme$1(ce,fe,oe,void 0,"dark");let he={defaultColorScheme:te,...pe,cssVarPrefix:_,colorSchemeSelector:A,rootSelector:O,getCssVar:ie,colorSchemes:fe,font:{...prepareTypographyVars(pe.typography),...pe.font},spacing:getSpacingVal(H.spacing)};Object.keys(he.colorSchemes).forEach(Ce=>{const be=he.colorSchemes[Ce].palette,Ee=Ie=>{const Te=Ie.split("-"),De=Te[1],Ue=Te[2];return ie(Ie,be[De][Ue])};be.mode==="light"&&(setColor(be.common,"background","#fff"),setColor(be.common,"onBackground","#000")),be.mode==="dark"&&(setColor(be.common,"background","#000"),setColor(be.common,"onBackground","#fff"));function Ae(Ie,Te,De){if(ce){let Ue;return Ie===private_safeAlpha&&(Ue=`transparent ${((1-De)*100).toFixed(0)}%`),Ie===private_safeDarken&&(Ue=`#000 ${(De*100).toFixed(0)}%`),Ie===private_safeLighten&&(Ue=`#fff ${(De*100).toFixed(0)}%`),`color-mix(in ${ce}, ${Te}, ${Ue})`}return Ie(Te,De)}if(assignNode(be,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),be.mode==="light"){setColor(be.Alert,"errorColor",Ae(private_safeDarken,be.error.light,.6)),setColor(be.Alert,"infoColor",Ae(private_safeDarken,be.info.light,.6)),setColor(be.Alert,"successColor",Ae(private_safeDarken,be.success.light,.6)),setColor(be.Alert,"warningColor",Ae(private_safeDarken,be.warning.light,.6)),setColor(be.Alert,"errorFilledBg",Ee("palette-error-main")),setColor(be.Alert,"infoFilledBg",Ee("palette-info-main")),setColor(be.Alert,"successFilledBg",Ee("palette-success-main")),setColor(be.Alert,"warningFilledBg",Ee("palette-warning-main")),setColor(be.Alert,"errorFilledColor",silent(()=>be.getContrastText(be.error.main))),setColor(be.Alert,"infoFilledColor",silent(()=>be.getContrastText(be.info.main))),setColor(be.Alert,"successFilledColor",silent(()=>be.getContrastText(be.success.main))),setColor(be.Alert,"warningFilledColor",silent(()=>be.getContrastText(be.warning.main))),setColor(be.Alert,"errorStandardBg",Ae(private_safeLighten,be.error.light,.9)),setColor(be.Alert,"infoStandardBg",Ae(private_safeLighten,be.info.light,.9)),setColor(be.Alert,"successStandardBg",Ae(private_safeLighten,be.success.light,.9)),setColor(be.Alert,"warningStandardBg",Ae(private_safeLighten,be.warning.light,.9)),setColor(be.Alert,"errorIconColor",Ee("palette-error-main")),setColor(be.Alert,"infoIconColor",Ee("palette-info-main")),setColor(be.Alert,"successIconColor",Ee("palette-success-main")),setColor(be.Alert,"warningIconColor",Ee("palette-warning-main")),setColor(be.AppBar,"defaultBg",Ee("palette-grey-100")),setColor(be.Avatar,"defaultBg",Ee("palette-grey-400")),setColor(be.Button,"inheritContainedBg",Ee("palette-grey-300")),setColor(be.Button,"inheritContainedHoverBg",Ee("palette-grey-A100")),setColor(be.Chip,"defaultBorder",Ee("palette-grey-400")),setColor(be.Chip,"defaultAvatarColor",Ee("palette-grey-700")),setColor(be.Chip,"defaultIconColor",Ee("palette-grey-700")),setColor(be.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),setColor(be.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),setColor(be.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),setColor(be.LinearProgress,"primaryBg",Ae(private_safeLighten,be.primary.main,.62)),setColor(be.LinearProgress,"secondaryBg",Ae(private_safeLighten,be.secondary.main,.62)),setColor(be.LinearProgress,"errorBg",Ae(private_safeLighten,be.error.main,.62)),setColor(be.LinearProgress,"infoBg",Ae(private_safeLighten,be.info.main,.62)),setColor(be.LinearProgress,"successBg",Ae(private_safeLighten,be.success.main,.62)),setColor(be.LinearProgress,"warningBg",Ae(private_safeLighten,be.warning.main,.62)),setColor(be.Skeleton,"bg",ce?Ae(private_safeAlpha,be.text.primary,.11):`rgba(${Ee("palette-text-primaryChannel")} / 0.11)`),setColor(be.Slider,"primaryTrack",Ae(private_safeLighten,be.primary.main,.62)),setColor(be.Slider,"secondaryTrack",Ae(private_safeLighten,be.secondary.main,.62)),setColor(be.Slider,"errorTrack",Ae(private_safeLighten,be.error.main,.62)),setColor(be.Slider,"infoTrack",Ae(private_safeLighten,be.info.main,.62)),setColor(be.Slider,"successTrack",Ae(private_safeLighten,be.success.main,.62)),setColor(be.Slider,"warningTrack",Ae(private_safeLighten,be.warning.main,.62));const Ie=ce?Ae(private_safeDarken,be.background.default,.6825):private_safeEmphasize(be.background.default,.8);setColor(be.SnackbarContent,"bg",Ie),setColor(be.SnackbarContent,"color",silent(()=>ce?dark.text.primary:be.getContrastText(Ie))),setColor(be.SpeedDialAction,"fabHoverBg",private_safeEmphasize(be.background.paper,.15)),setColor(be.StepConnector,"border",Ee("palette-grey-400")),setColor(be.StepContent,"border",Ee("palette-grey-400")),setColor(be.Switch,"defaultColor",Ee("palette-common-white")),setColor(be.Switch,"defaultDisabledColor",Ee("palette-grey-100")),setColor(be.Switch,"primaryDisabledColor",Ae(private_safeLighten,be.primary.main,.62)),setColor(be.Switch,"secondaryDisabledColor",Ae(private_safeLighten,be.secondary.main,.62)),setColor(be.Switch,"errorDisabledColor",Ae(private_safeLighten,be.error.main,.62)),setColor(be.Switch,"infoDisabledColor",Ae(private_safeLighten,be.info.main,.62)),setColor(be.Switch,"successDisabledColor",Ae(private_safeLighten,be.success.main,.62)),setColor(be.Switch,"warningDisabledColor",Ae(private_safeLighten,be.warning.main,.62)),setColor(be.TableCell,"border",Ae(private_safeLighten,Ae(private_safeAlpha,be.divider,1),.88)),setColor(be.Tooltip,"bg",Ae(private_safeAlpha,be.grey[700],.92))}if(be.mode==="dark"){setColor(be.Alert,"errorColor",Ae(private_safeLighten,be.error.light,.6)),setColor(be.Alert,"infoColor",Ae(private_safeLighten,be.info.light,.6)),setColor(be.Alert,"successColor",Ae(private_safeLighten,be.success.light,.6)),setColor(be.Alert,"warningColor",Ae(private_safeLighten,be.warning.light,.6)),setColor(be.Alert,"errorFilledBg",Ee("palette-error-dark")),setColor(be.Alert,"infoFilledBg",Ee("palette-info-dark")),setColor(be.Alert,"successFilledBg",Ee("palette-success-dark")),setColor(be.Alert,"warningFilledBg",Ee("palette-warning-dark")),setColor(be.Alert,"errorFilledColor",silent(()=>be.getContrastText(be.error.dark))),setColor(be.Alert,"infoFilledColor",silent(()=>be.getContrastText(be.info.dark))),setColor(be.Alert,"successFilledColor",silent(()=>be.getContrastText(be.success.dark))),setColor(be.Alert,"warningFilledColor",silent(()=>be.getContrastText(be.warning.dark))),setColor(be.Alert,"errorStandardBg",Ae(private_safeDarken,be.error.light,.9)),setColor(be.Alert,"infoStandardBg",Ae(private_safeDarken,be.info.light,.9)),setColor(be.Alert,"successStandardBg",Ae(private_safeDarken,be.success.light,.9)),setColor(be.Alert,"warningStandardBg",Ae(private_safeDarken,be.warning.light,.9)),setColor(be.Alert,"errorIconColor",Ee("palette-error-main")),setColor(be.Alert,"infoIconColor",Ee("palette-info-main")),setColor(be.Alert,"successIconColor",Ee("palette-success-main")),setColor(be.Alert,"warningIconColor",Ee("palette-warning-main")),setColor(be.AppBar,"defaultBg",Ee("palette-grey-900")),setColor(be.AppBar,"darkBg",Ee("palette-background-paper")),setColor(be.AppBar,"darkColor",Ee("palette-text-primary")),setColor(be.Avatar,"defaultBg",Ee("palette-grey-600")),setColor(be.Button,"inheritContainedBg",Ee("palette-grey-800")),setColor(be.Button,"inheritContainedHoverBg",Ee("palette-grey-700")),setColor(be.Chip,"defaultBorder",Ee("palette-grey-700")),setColor(be.Chip,"defaultAvatarColor",Ee("palette-grey-300")),setColor(be.Chip,"defaultIconColor",Ee("palette-grey-300")),setColor(be.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),setColor(be.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),setColor(be.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),setColor(be.LinearProgress,"primaryBg",Ae(private_safeDarken,be.primary.main,.5)),setColor(be.LinearProgress,"secondaryBg",Ae(private_safeDarken,be.secondary.main,.5)),setColor(be.LinearProgress,"errorBg",Ae(private_safeDarken,be.error.main,.5)),setColor(be.LinearProgress,"infoBg",Ae(private_safeDarken,be.info.main,.5)),setColor(be.LinearProgress,"successBg",Ae(private_safeDarken,be.success.main,.5)),setColor(be.LinearProgress,"warningBg",Ae(private_safeDarken,be.warning.main,.5)),setColor(be.Skeleton,"bg",ce?Ae(private_safeAlpha,be.text.primary,.13):`rgba(${Ee("palette-text-primaryChannel")} / 0.13)`),setColor(be.Slider,"primaryTrack",Ae(private_safeDarken,be.primary.main,.5)),setColor(be.Slider,"secondaryTrack",Ae(private_safeDarken,be.secondary.main,.5)),setColor(be.Slider,"errorTrack",Ae(private_safeDarken,be.error.main,.5)),setColor(be.Slider,"infoTrack",Ae(private_safeDarken,be.info.main,.5)),setColor(be.Slider,"successTrack",Ae(private_safeDarken,be.success.main,.5)),setColor(be.Slider,"warningTrack",Ae(private_safeDarken,be.warning.main,.5));const Ie=ce?Ae(private_safeLighten,be.background.default,.985):private_safeEmphasize(be.background.default,.98);setColor(be.SnackbarContent,"bg",Ie),setColor(be.SnackbarContent,"color",silent(()=>ce?light.text.primary:be.getContrastText(Ie))),setColor(be.SpeedDialAction,"fabHoverBg",private_safeEmphasize(be.background.paper,.15)),setColor(be.StepConnector,"border",Ee("palette-grey-600")),setColor(be.StepContent,"border",Ee("palette-grey-600")),setColor(be.Switch,"defaultColor",Ee("palette-grey-300")),setColor(be.Switch,"defaultDisabledColor",Ee("palette-grey-600")),setColor(be.Switch,"primaryDisabledColor",Ae(private_safeDarken,be.primary.main,.55)),setColor(be.Switch,"secondaryDisabledColor",Ae(private_safeDarken,be.secondary.main,.55)),setColor(be.Switch,"errorDisabledColor",Ae(private_safeDarken,be.error.main,.55)),setColor(be.Switch,"infoDisabledColor",Ae(private_safeDarken,be.info.main,.55)),setColor(be.Switch,"successDisabledColor",Ae(private_safeDarken,be.success.main,.55)),setColor(be.Switch,"warningDisabledColor",Ae(private_safeDarken,be.warning.main,.55)),setColor(be.TableCell,"border",Ae(private_safeDarken,Ae(private_safeAlpha,be.divider,1),.68)),setColor(be.Tooltip,"bg",Ae(private_safeAlpha,be.grey[700],.92))}setColorChannel(be.background,"default"),setColorChannel(be.background,"paper"),setColorChannel(be.common,"background"),setColorChannel(be.common,"onBackground"),setColorChannel(be,"divider"),Object.keys(be).forEach(Ie=>{const Te=be[Ie];Ie!=="tonalOffset"&&Te&&typeof Te=="object"&&(Te.main&&setColor(be[Ie],"mainChannel",private_safeColorChannel(toRgb(Te.main))),Te.light&&setColor(be[Ie],"lightChannel",private_safeColorChannel(toRgb(Te.light))),Te.dark&&setColor(be[Ie],"darkChannel",private_safeColorChannel(toRgb(Te.dark))),Te.contrastText&&setColor(be[Ie],"contrastTextChannel",private_safeColorChannel(toRgb(Te.contrastText))),Ie==="text"&&(setColorChannel(be[Ie],"primary"),setColorChannel(be[Ie],"secondary")),Ie==="action"&&(Te.active&&setColorChannel(be[Ie],"active"),Te.selected&&setColorChannel(be[Ie],"selected")))})}),he=C.reduce((Ce,be)=>deepmerge(Ce,be),he);const me={prefix:_,disableCssColorScheme:T,shouldSkipGeneratingVar:R,getSelector:defaultGetSelector(he),enableContrastVars:S},{vars:ve,generateThemeVars:ye,generateStyleSheets:Se}=prepareCssVars(he,me);return he.vars=ve,Object.entries(he.colorSchemes[he.defaultColorScheme]).forEach(([Ce,be])=>{he[Ce]=be}),he.generateThemeVars=ye,he.generateStyleSheets=Se,he.generateSpacing=function(){return createSpacing(H.spacing,createUnarySpacing(this))},he.getColorSchemeSelector=createGetColorSchemeSelector(A),he.spacing=he.generateSpacing(),he.shouldSkipGeneratingVar=R,he.unstable_sxConfig={...defaultSxConfig,...H?.unstable_sxConfig},he.unstable_sx=function(be){return styleFunctionSx({sx:be,theme:this})},he.toRuntimeSource=stringifyTheme,he}function attachColorScheme(x,C,E){x.colorSchemes&&E&&(x.colorSchemes[C]={...E!==!0&&E,palette:createPalette({...E===!0?{}:E.palette,mode:C})})}function createTheme(x={},...C){const{palette:E,cssVariables:w=!1,colorSchemes:T=E?void 0:{light:!0},defaultColorScheme:_=E?.mode,...S}=x,R=_||"light",A=T?.[R],O={...T,...E?{[R]:{...typeof A!="boolean"&&A,palette:E}}:void 0};if(w===!1){if(!("colorSchemes"in x))return createThemeNoVars(x,...C);let H=E;"palette"in x||O[R]&&(O[R]!==!0?H=O[R].palette:R==="dark"&&(H={mode:"dark"}));const ee=createThemeNoVars({...x,palette:H},...C);return ee.defaultColorScheme=R,ee.colorSchemes=O,ee.palette.mode==="light"&&(ee.colorSchemes.light={...O.light!==!0&&O.light,palette:ee.palette},attachColorScheme(ee,"dark",O.dark)),ee.palette.mode==="dark"&&(ee.colorSchemes.dark={...O.dark!==!0&&O.dark,palette:ee.palette},attachColorScheme(ee,"light",O.light)),ee}return!E&&!("light"in O)&&R==="light"&&(O.light=!0),createThemeWithVars({...S,colorSchemes:O,defaultColorScheme:R,...typeof w!="boolean"&&w},...C)}const defaultTheme$1=createTheme(),THEME_ID="$$material";function useTheme(){const x=useTheme$2(defaultTheme$1);return x[THEME_ID]||x}function GlobalStyles(x){return jsxRuntimeExports.jsx(GlobalStyles$1,{...x,defaultTheme:defaultTheme$1,themeId:THEME_ID})}const styled=createStyled({themeId:THEME_ID,defaultTheme:defaultTheme$1,rootShouldForwardProp});function globalCss(x){return function(E){return jsxRuntimeExports.jsx(GlobalStyles,{styles:typeof x=="function"?w=>x({theme:w,...E}):x})}}function internal_createExtendSxProp(){return extendSxProp$1}function useControlled(x){const{controlled:C,default:E,name:w,state:T="value"}=x,{current:_}=reactExports.useRef(C!==void 0),[S,R]=reactExports.useState(E),A=_?C:S,O=reactExports.useCallback(H=>{_||R(H)},[]);return[A,O]}const FormControlContext=reactExports.createContext(void 0);function useFormControl(){return reactExports.useContext(FormControlContext)}function isFocusVisible(x){try{return x.matches(":focus-visible")}catch{}return!1}function useDefaultProps(x){return useDefaultProps$1(x)}function useForkRef(...x){const C=reactExports.useRef(void 0),E=reactExports.useCallback(w=>{const T=x.map(_=>{if(_==null)return null;if(typeof _=="function"){const S=_,R=S(w);return typeof R=="function"?R:()=>{S(null)}}return _.current=w,()=>{_.current=null}});return()=>{T.forEach(_=>_?.())}},x);return reactExports.useMemo(()=>x.every(w=>w==null)?null:w=>{C.current&&(C.current(),C.current=void 0),w!=null&&(C.current=E(w))},x)}function useEventCallback(x){const C=reactExports.useRef(x);return useEnhancedEffect(()=>{C.current=x}),reactExports.useRef((...E)=>(0,C.current)(...E)).current}const UNINITIALIZED={};function useLazyRef(x,C){const E=reactExports.useRef(UNINITIALIZED);return E.current===UNINITIALIZED&&(E.current=x(C)),E}class LazyRipple{static create(){return new LazyRipple}static use(){const C=useLazyRef(LazyRipple.create).current,[E,w]=reactExports.useState(!1);return C.shouldMount=E,C.setShouldMount=w,reactExports.useEffect(C.mountEffect,[E]),C}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=createControlledPromise(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...C){this.mount().then(()=>this.ref.current?.start(...C))}stop(...C){this.mount().then(()=>this.ref.current?.stop(...C))}pulsate(...C){this.mount().then(()=>this.ref.current?.pulsate(...C))}}function useLazyRipple(){return LazyRipple.use()}function createControlledPromise(){let x,C;const E=new Promise((w,T)=>{x=w,C=T});return E.resolve=x,E.reject=C,E}function _extends(){return _extends=Object.assign?Object.assign.bind():function(x){for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var w in E)({}).hasOwnProperty.call(E,w)&&(x[w]=E[w])}return x},_extends.apply(null,arguments)}function _objectWithoutPropertiesLoose(x,C){if(x==null)return{};var E={};for(var w in x)if({}.hasOwnProperty.call(x,w)){if(C.indexOf(w)!==-1)continue;E[w]=x[w]}return E}function _setPrototypeOf(x,C){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(E,w){return E.__proto__=w,E},_setPrototypeOf(x,C)}function _inheritsLoose(x,C){x.prototype=Object.create(C.prototype),x.prototype.constructor=x,_setPrototypeOf(x,C)}var reactDomExports=requireReactDom();const ReactDOM=getDefaultExportFromCjs(reactDomExports),config={disabled:!1},TransitionGroupContext=React.createContext(null);var forceReflow=function(C){return C.scrollTop},UNMOUNTED="unmounted",EXITED="exited",ENTERING="entering",ENTERED="entered",EXITING="exiting",Transition=function(x){_inheritsLoose(C,x);function C(w,T){var _;_=x.call(this,w,T)||this;var S=T,R=S&&!S.isMounting?w.enter:w.appear,A;return _.appearStatus=null,w.in?R?(A=EXITED,_.appearStatus=ENTERING):A=ENTERED:w.unmountOnExit||w.mountOnEnter?A=UNMOUNTED:A=EXITED,_.state={status:A},_.nextCallback=null,_}C.getDerivedStateFromProps=function(T,_){var S=T.in;return S&&_.status===UNMOUNTED?{status:EXITED}:null};var E=C.prototype;return E.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},E.componentDidUpdate=function(T){var _=null;if(T!==this.props){var S=this.state.status;this.props.in?S!==ENTERING&&S!==ENTERED&&(_=ENTERING):(S===ENTERING||S===ENTERED)&&(_=EXITING)}this.updateStatus(!1,_)},E.componentWillUnmount=function(){this.cancelNextCallback()},E.getTimeouts=function(){var T=this.props.timeout,_,S,R;return _=S=R=T,T!=null&&typeof T!="number"&&(_=T.exit,S=T.enter,R=T.appear!==void 0?T.appear:S),{exit:_,enter:S,appear:R}},E.updateStatus=function(T,_){if(T===void 0&&(T=!1),_!==null)if(this.cancelNextCallback(),_===ENTERING){if(this.props.unmountOnExit||this.props.mountOnEnter){var S=this.props.nodeRef?this.props.nodeRef.current:ReactDOM.findDOMNode(this);S&&forceReflow(S)}this.performEnter(T)}else this.performExit();else this.props.unmountOnExit&&this.state.status===EXITED&&this.setState({status:UNMOUNTED})},E.performEnter=function(T){var _=this,S=this.props.enter,R=this.context?this.context.isMounting:T,A=this.props.nodeRef?[R]:[ReactDOM.findDOMNode(this),R],O=A[0],H=A[1],ee=this.getTimeouts(),te=R?ee.appear:ee.enter;if(!T&&!S||config.disabled){this.safeSetState({status:ENTERED},function(){_.props.onEntered(O)});return}this.props.onEnter(O,H),this.safeSetState({status:ENTERING},function(){_.props.onEntering(O,H),_.onTransitionEnd(te,function(){_.safeSetState({status:ENTERED},function(){_.props.onEntered(O,H)})})})},E.performExit=function(){var T=this,_=this.props.exit,S=this.getTimeouts(),R=this.props.nodeRef?void 0:ReactDOM.findDOMNode(this);if(!_||config.disabled){this.safeSetState({status:EXITED},function(){T.props.onExited(R)});return}this.props.onExit(R),this.safeSetState({status:EXITING},function(){T.props.onExiting(R),T.onTransitionEnd(S.exit,function(){T.safeSetState({status:EXITED},function(){T.props.onExited(R)})})})},E.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},E.safeSetState=function(T,_){_=this.setNextCallback(_),this.setState(T,_)},E.setNextCallback=function(T){var _=this,S=!0;return this.nextCallback=function(R){S&&(S=!1,_.nextCallback=null,T(R))},this.nextCallback.cancel=function(){S=!1},this.nextCallback},E.onTransitionEnd=function(T,_){this.setNextCallback(_);var S=this.props.nodeRef?this.props.nodeRef.current:ReactDOM.findDOMNode(this),R=T==null&&!this.props.addEndListener;if(!S||R){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var A=this.props.nodeRef?[this.nextCallback]:[S,this.nextCallback],O=A[0],H=A[1];this.props.addEndListener(O,H)}T!=null&&setTimeout(this.nextCallback,T)},E.render=function(){var T=this.state.status;if(T===UNMOUNTED)return null;var _=this.props,S=_.children;_.in,_.mountOnEnter,_.unmountOnExit,_.appear,_.enter,_.exit,_.timeout,_.addEndListener,_.onEnter,_.onEntering,_.onEntered,_.onExit,_.onExiting,_.onExited,_.nodeRef;var R=_objectWithoutPropertiesLoose(_,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return React.createElement(TransitionGroupContext.Provider,{value:null},typeof S=="function"?S(T,R):React.cloneElement(React.Children.only(S),R))},C}(React.Component);Transition.contextType=TransitionGroupContext;Transition.propTypes={};function noop$2(){}Transition.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:noop$2,onEntering:noop$2,onEntered:noop$2,onExit:noop$2,onExiting:noop$2,onExited:noop$2};Transition.UNMOUNTED=UNMOUNTED;Transition.EXITED=EXITED;Transition.ENTERING=ENTERING;Transition.ENTERED=ENTERED;Transition.EXITING=EXITING;function _assertThisInitialized(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function getChildMapping(x,C){var E=function(_){return C&&reactExports.isValidElement(_)?C(_):_},w=Object.create(null);return x&&reactExports.Children.map(x,function(T){return T}).forEach(function(T){w[T.key]=E(T)}),w}function mergeChildMappings(x,C){x=x||{},C=C||{};function E(H){return H in C?C[H]:x[H]}var w=Object.create(null),T=[];for(var _ in x)_ in C?T.length&&(w[_]=T,T=[]):T.push(_);var S,R={};for(var A in C){if(w[A])for(S=0;S<w[A].length;S++){var O=w[A][S];R[w[A][S]]=E(O)}R[A]=E(A)}for(S=0;S<T.length;S++)R[T[S]]=E(T[S]);return R}function getProp(x,C,E){return E[C]!=null?E[C]:x.props[C]}function getInitialChildMapping(x,C){return getChildMapping(x.children,function(E){return reactExports.cloneElement(E,{onExited:C.bind(null,E),in:!0,appear:getProp(E,"appear",x),enter:getProp(E,"enter",x),exit:getProp(E,"exit",x)})})}function getNextChildMapping(x,C,E){var w=getChildMapping(x.children),T=mergeChildMappings(C,w);return Object.keys(T).forEach(function(_){var S=T[_];if(reactExports.isValidElement(S)){var R=_ in C,A=_ in w,O=C[_],H=reactExports.isValidElement(O)&&!O.props.in;A&&(!R||H)?T[_]=reactExports.cloneElement(S,{onExited:E.bind(null,S),in:!0,exit:getProp(S,"exit",x),enter:getProp(S,"enter",x)}):!A&&R&&!H?T[_]=reactExports.cloneElement(S,{in:!1}):A&&R&&reactExports.isValidElement(O)&&(T[_]=reactExports.cloneElement(S,{onExited:E.bind(null,S),in:O.props.in,exit:getProp(S,"exit",x),enter:getProp(S,"enter",x)}))}}),T}var values=Object.values||function(x){return Object.keys(x).map(function(C){return x[C]})},defaultProps={component:"div",childFactory:function(C){return C}},TransitionGroup=function(x){_inheritsLoose(C,x);function C(w,T){var _;_=x.call(this,w,T)||this;var S=_.handleExited.bind(_assertThisInitialized(_));return _.state={contextValue:{isMounting:!0},handleExited:S,firstRender:!0},_}var E=C.prototype;return E.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},E.componentWillUnmount=function(){this.mounted=!1},C.getDerivedStateFromProps=function(T,_){var S=_.children,R=_.handleExited,A=_.firstRender;return{children:A?getInitialChildMapping(T,R):getNextChildMapping(T,S,R),firstRender:!1}},E.handleExited=function(T,_){var S=getChildMapping(this.props.children);T.key in S||(T.props.onExited&&T.props.onExited(_),this.mounted&&this.setState(function(R){var A=_extends({},R.children);return delete A[T.key],{children:A}}))},E.render=function(){var T=this.props,_=T.component,S=T.childFactory,R=_objectWithoutPropertiesLoose(T,["component","childFactory"]),A=this.state.contextValue,O=values(this.state.children).map(S);return delete R.appear,delete R.enter,delete R.exit,_===null?React.createElement(TransitionGroupContext.Provider,{value:A},O):React.createElement(TransitionGroupContext.Provider,{value:A},React.createElement(_,R,O))},C}(React.Component);TransitionGroup.propTypes={};TransitionGroup.defaultProps=defaultProps;const EMPTY=[];function useOnMount(x){reactExports.useEffect(x,EMPTY)}class Timeout{static create(){return new Timeout}currentId=null;start(C,E){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,E()},C)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function useTimeout(){const x=useLazyRef(Timeout.create).current;return useOnMount(x.disposeEffect),x}function Ripple(x){const{className:C,classes:E,pulsate:w=!1,rippleX:T,rippleY:_,rippleSize:S,in:R,onExited:A,timeout:O}=x,[H,ee]=reactExports.useState(!1),te=clsx(C,E.ripple,E.rippleVisible,w&&E.ripplePulsate),ie={width:S,height:S,top:-(S/2)+_,left:-(S/2)+T},ne=clsx(E.child,H&&E.childLeaving,w&&E.childPulsate);return!R&&!H&&ee(!0),reactExports.useEffect(()=>{if(!R&&A!=null){const ae=setTimeout(A,O);return()=>{clearTimeout(ae)}}},[A,R,O]),jsxRuntimeExports.jsx("span",{className:te,style:ie,children:jsxRuntimeExports.jsx("span",{className:ne})})}const touchRippleClasses=generateUtilityClasses("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),DURATION=550,DELAY_RIPPLE=80,enterKeyframe=keyframes`
  0% {
    transform: scale(0);
    opacity: 0.1;
  }

  100% {
    transform: scale(1);
    opacity: 0.3;
  }
`,exitKeyframe=keyframes`
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
`,pulsateKeyframe=keyframes`
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.92);
  }

  100% {
    transform: scale(1);
  }
`,TouchRippleRoot=styled("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),TouchRippleRipple=styled(Ripple,{name:"MuiTouchRipple",slot:"Ripple"})`
  opacity: 0;
  position: absolute;

  &.${touchRippleClasses.rippleVisible} {
    opacity: 0.3;
    transform: scale(1);
    animation-name: ${enterKeyframe};
    animation-duration: ${DURATION}ms;
    animation-timing-function: ${({theme:x})=>x.transitions.easing.easeInOut};
  }

  &.${touchRippleClasses.ripplePulsate} {
    animation-duration: ${({theme:x})=>x.transitions.duration.shorter}ms;
  }

  & .${touchRippleClasses.child} {
    opacity: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: currentColor;
  }

  & .${touchRippleClasses.childLeaving} {
    opacity: 0;
    animation-name: ${exitKeyframe};
    animation-duration: ${DURATION}ms;
    animation-timing-function: ${({theme:x})=>x.transitions.easing.easeInOut};
  }

  & .${touchRippleClasses.childPulsate} {
    position: absolute;
    /* @noflip */
    left: 0px;
    top: 0;
    animation-name: ${pulsateKeyframe};
    animation-duration: 2500ms;
    animation-timing-function: ${({theme:x})=>x.transitions.easing.easeInOut};
    animation-iteration-count: infinite;
    animation-delay: 200ms;
  }
`,TouchRipple=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiTouchRipple"}),{center:T=!1,classes:_={},className:S,...R}=w,[A,O]=reactExports.useState([]),H=reactExports.useRef(0),ee=reactExports.useRef(null);reactExports.useEffect(()=>{ee.current&&(ee.current(),ee.current=null)},[A]);const te=reactExports.useRef(!1),ie=useTimeout(),ne=reactExports.useRef(null),ae=reactExports.useRef(null),oe=reactExports.useCallback(ce=>{const{pulsate:pe,rippleX:he,rippleY:me,rippleSize:ve,cb:ye}=ce;O(Se=>[...Se,jsxRuntimeExports.jsx(TouchRippleRipple,{classes:{ripple:clsx(_.ripple,touchRippleClasses.ripple),rippleVisible:clsx(_.rippleVisible,touchRippleClasses.rippleVisible),ripplePulsate:clsx(_.ripplePulsate,touchRippleClasses.ripplePulsate),child:clsx(_.child,touchRippleClasses.child),childLeaving:clsx(_.childLeaving,touchRippleClasses.childLeaving),childPulsate:clsx(_.childPulsate,touchRippleClasses.childPulsate)},timeout:DURATION,pulsate:pe,rippleX:he,rippleY:me,rippleSize:ve},H.current)]),H.current+=1,ee.current=ye},[_]),le=reactExports.useCallback((ce={},pe={},he=()=>{})=>{const{pulsate:me=!1,center:ve=T||pe.pulsate,fakeElement:ye=!1}=pe;if(ce?.type==="mousedown"&&te.current){te.current=!1;return}ce?.type==="touchstart"&&(te.current=!0);const Se=ye?null:ae.current,Ce=Se?Se.getBoundingClientRect():{width:0,height:0,left:0,top:0};let be,Ee,Ae;if(ve||ce===void 0||ce.clientX===0&&ce.clientY===0||!ce.clientX&&!ce.touches)be=Math.round(Ce.width/2),Ee=Math.round(Ce.height/2);else{const{clientX:Ie,clientY:Te}=ce.touches&&ce.touches.length>0?ce.touches[0]:ce;be=Math.round(Ie-Ce.left),Ee=Math.round(Te-Ce.top)}if(ve)Ae=Math.sqrt((2*Ce.width**2+Ce.height**2)/3),Ae%2===0&&(Ae+=1);else{const Ie=Math.max(Math.abs((Se?Se.clientWidth:0)-be),be)*2+2,Te=Math.max(Math.abs((Se?Se.clientHeight:0)-Ee),Ee)*2+2;Ae=Math.sqrt(Ie**2+Te**2)}ce?.touches?ne.current===null&&(ne.current=()=>{oe({pulsate:me,rippleX:be,rippleY:Ee,rippleSize:Ae,cb:he})},ie.start(DELAY_RIPPLE,()=>{ne.current&&(ne.current(),ne.current=null)})):oe({pulsate:me,rippleX:be,rippleY:Ee,rippleSize:Ae,cb:he})},[T,oe,ie]),fe=reactExports.useCallback(()=>{le({},{pulsate:!0})},[le]),de=reactExports.useCallback((ce,pe)=>{if(ie.clear(),ce?.type==="touchend"&&ne.current){ne.current(),ne.current=null,ie.start(0,()=>{de(ce,pe)});return}ne.current=null,O(he=>he.length>0?he.slice(1):he),ee.current=pe},[ie]);return reactExports.useImperativeHandle(E,()=>({pulsate:fe,start:le,stop:de}),[fe,le,de]),jsxRuntimeExports.jsx(TouchRippleRoot,{className:clsx(touchRippleClasses.root,_.root,S),ref:ae,...R,children:jsxRuntimeExports.jsx(TransitionGroup,{component:null,exit:!0,children:A})})});function getButtonBaseUtilityClass(x){return generateUtilityClass("MuiButtonBase",x)}const buttonBaseClasses=generateUtilityClasses("MuiButtonBase",["root","disabled","focusVisible"]),useUtilityClasses$D=x=>{const{disabled:C,focusVisible:E,focusVisibleClassName:w,classes:T}=x,S=composeClasses({root:["root",C&&"disabled",E&&"focusVisible"]},getButtonBaseUtilityClass,T);return E&&w&&(S.root+=` ${w}`),S},ButtonBaseRoot=styled("button",{name:"MuiButtonBase",slot:"Root"})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${buttonBaseClasses.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),ButtonBase=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiButtonBase"}),{action:T,centerRipple:_=!1,children:S,className:R,component:A="button",disabled:O=!1,disableRipple:H=!1,disableTouchRipple:ee=!1,focusRipple:te=!1,focusVisibleClassName:ie,LinkComponent:ne="a",onBlur:ae,onClick:oe,onContextMenu:le,onDragLeave:fe,onFocus:de,onFocusVisible:ce,onKeyDown:pe,onKeyUp:he,onMouseDown:me,onMouseLeave:ve,onMouseUp:ye,onTouchEnd:Se,onTouchMove:Ce,onTouchStart:be,tabIndex:Ee=0,TouchRippleProps:Ae,touchRippleRef:Ie,type:Te,...De}=w,Ue=reactExports.useRef(null),ze=useLazyRipple(),Pe=useForkRef(ze.ref,Ie),[$e,He]=reactExports.useState(!1);O&&$e&&He(!1),reactExports.useImperativeHandle(T,()=>({focusVisible:()=>{He(!0),Ue.current.focus()}}),[]);const je=ze.shouldMount&&!H&&!O;reactExports.useEffect(()=>{$e&&te&&!H&&ze.pulsate()},[H,te,$e,ze]);const Ne=useRippleHandler(ze,"start",me,ee),Oe=useRippleHandler(ze,"stop",le,ee),Ve=useRippleHandler(ze,"stop",fe,ee),Ht=useRippleHandler(ze,"stop",ye,ee),Kt=useRippleHandler(ze,"stop",Yt=>{$e&&Yt.preventDefault(),ve&&ve(Yt)},ee),ir=useRippleHandler(ze,"start",be,ee),$t=useRippleHandler(ze,"stop",Se,ee),tr=useRippleHandler(ze,"stop",Ce,ee),ar=useRippleHandler(ze,"stop",Yt=>{isFocusVisible(Yt.target)||He(!1),ae&&ae(Yt)},!1),gr=useEventCallback(Yt=>{Ue.current||(Ue.current=Yt.currentTarget),isFocusVisible(Yt.target)&&(He(!0),ce&&ce(Yt)),de&&de(Yt)}),er=()=>{const Yt=Ue.current;return A&&A!=="button"&&!(Yt.tagName==="A"&&Yt.href)},sr=useEventCallback(Yt=>{te&&!Yt.repeat&&$e&&Yt.key===" "&&ze.stop(Yt,()=>{ze.start(Yt)}),Yt.target===Yt.currentTarget&&er()&&Yt.key===" "&&Yt.preventDefault(),pe&&pe(Yt),Yt.target===Yt.currentTarget&&er()&&Yt.key==="Enter"&&!O&&(Yt.preventDefault(),oe&&oe(Yt))}),pr=useEventCallback(Yt=>{te&&Yt.key===" "&&$e&&!Yt.defaultPrevented&&ze.stop(Yt,()=>{ze.pulsate(Yt)}),he&&he(Yt),oe&&Yt.target===Yt.currentTarget&&er()&&Yt.key===" "&&!Yt.defaultPrevented&&oe(Yt)});let ur=A;ur==="button"&&(De.href||De.to)&&(ur=ne);const Sr={};ur==="button"?(Sr.type=Te===void 0?"button":Te,Sr.disabled=O):(!De.href&&!De.to&&(Sr.role="button"),O&&(Sr["aria-disabled"]=O));const hr=useForkRef(E,Ue),yr={...w,centerRipple:_,component:A,disabled:O,disableRipple:H,disableTouchRipple:ee,focusRipple:te,tabIndex:Ee,focusVisible:$e},xr=useUtilityClasses$D(yr);return jsxRuntimeExports.jsxs(ButtonBaseRoot,{as:ur,className:clsx(xr.root,R),ownerState:yr,onBlur:ar,onClick:oe,onContextMenu:Oe,onFocus:gr,onKeyDown:sr,onKeyUp:pr,onMouseDown:Ne,onMouseLeave:Kt,onMouseUp:Ht,onDragLeave:Ve,onTouchEnd:$t,onTouchMove:tr,onTouchStart:ir,ref:hr,tabIndex:O?-1:Ee,type:Te,...Sr,...De,children:[S,je?jsxRuntimeExports.jsx(TouchRipple,{ref:Pe,center:_,...Ae}):null]})});function useRippleHandler(x,C,E,w=!1){return useEventCallback(T=>(E&&E(T),w||x[C](T),!0))}function getSwitchBaseUtilityClass(x){return generateUtilityClass("PrivateSwitchBase",x)}generateUtilityClasses("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);function isHostComponent$1(x){return typeof x=="string"}function appendOwnerState(x,C,E){return x===void 0||isHostComponent$1(x)?C:{...C,ownerState:{...C.ownerState,...E}}}function resolveComponentProps(x,C,E){return typeof x=="function"?x(C,E):x}function extractEventHandlers(x,C=[]){if(x===void 0)return{};const E={};return Object.keys(x).filter(w=>w.match(/^on[A-Z]/)&&typeof x[w]=="function"&&!C.includes(w)).forEach(w=>{E[w]=x[w]}),E}function omitEventHandlers(x){if(x===void 0)return{};const C={};return Object.keys(x).filter(E=>!(E.match(/^on[A-Z]/)&&typeof x[E]=="function")).forEach(E=>{C[E]=x[E]}),C}function mergeSlotProps$1(x){const{getSlotProps:C,additionalProps:E,externalSlotProps:w,externalForwardedProps:T,className:_}=x;if(!C){const ie=clsx(E?.className,_,T?.className,w?.className),ne={...E?.style,...T?.style,...w?.style},ae={...E,...T,...w};return ie.length>0&&(ae.className=ie),Object.keys(ne).length>0&&(ae.style=ne),{props:ae,internalRef:void 0}}const S=extractEventHandlers({...T,...w}),R=omitEventHandlers(w),A=omitEventHandlers(T),O=C(S),H=clsx(O?.className,E?.className,_,T?.className,w?.className),ee={...O?.style,...E?.style,...T?.style,...w?.style},te={...O,...E,...A,...R};return H.length>0&&(te.className=H),Object.keys(ee).length>0&&(te.style=ee),{props:te,internalRef:O.ref}}function useSlot(x,C){const{className:E,elementType:w,ownerState:T,externalForwardedProps:_,internalForwardedProps:S,shouldForwardComponentProp:R=!1,...A}=C,{component:O,slots:H={[x]:void 0},slotProps:ee={[x]:void 0},...te}=_,ie=H[x]||w,ne=resolveComponentProps(ee[x],T),{props:{component:ae,...oe},internalRef:le}=mergeSlotProps$1({className:E,...A,externalForwardedProps:x==="root"?te:void 0,externalSlotProps:ne}),fe=useForkRef(le,ne?.ref,C.ref),de=x==="root"?ae||O:ae,ce=appendOwnerState(ie,{...x==="root"&&!O&&!H[x]&&S,...x!=="root"&&!H[x]&&S,...oe,...de&&!R&&{as:de},...de&&R&&{component:de},ref:fe},T);return[ie,ce]}const useUtilityClasses$C=x=>{const{classes:C,checked:E,disabled:w,edge:T}=x,_={root:["root",E&&"checked",w&&"disabled",T&&`edge${capitalize(T)}`],input:["input"]};return composeClasses(_,getSwitchBaseUtilityClass,C)},SwitchBaseRoot=styled(ButtonBase,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:x,ownerState:C})=>x==="start"&&C.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:x,ownerState:C})=>x==="end"&&C.size!=="small",style:{marginRight:-12}}]}),SwitchBaseInput=styled("input",{name:"MuiSwitchBase",shouldForwardProp:rootShouldForwardProp})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),SwitchBase=reactExports.forwardRef(function(C,E){const{autoFocus:w,checked:T,checkedIcon:_,defaultChecked:S,disabled:R,disableFocusRipple:A=!1,edge:O=!1,icon:H,id:ee,inputProps:te,inputRef:ie,name:ne,onBlur:ae,onChange:oe,onFocus:le,readOnly:fe,required:de=!1,tabIndex:ce,type:pe,value:he,slots:me={},slotProps:ve={},...ye}=C,[Se,Ce]=useControlled({controlled:T,default:!!S,name:"SwitchBase",state:"checked"}),be=useFormControl(),Ee=Oe=>{le&&le(Oe),be&&be.onFocus&&be.onFocus(Oe)},Ae=Oe=>{ae&&ae(Oe),be&&be.onBlur&&be.onBlur(Oe)},Ie=Oe=>{if(Oe.nativeEvent.defaultPrevented)return;const Ve=Oe.target.checked;Ce(Ve),oe&&oe(Oe,Ve)};let Te=R;be&&typeof Te>"u"&&(Te=be.disabled);const De=pe==="checkbox"||pe==="radio",Ue={...C,checked:Se,disabled:Te,disableFocusRipple:A,edge:O},ze=useUtilityClasses$C(Ue),Pe={slots:me,slotProps:{input:te,...ve}},[$e,He]=useSlot("root",{ref:E,elementType:SwitchBaseRoot,className:ze.root,shouldForwardComponentProp:!0,externalForwardedProps:{...Pe,component:"span",...ye},getSlotProps:Oe=>({...Oe,onFocus:Ve=>{Oe.onFocus?.(Ve),Ee(Ve)},onBlur:Ve=>{Oe.onBlur?.(Ve),Ae(Ve)}}),ownerState:Ue,additionalProps:{centerRipple:!0,focusRipple:!A,disabled:Te,role:void 0,tabIndex:null}}),[je,Ne]=useSlot("input",{ref:ie,elementType:SwitchBaseInput,className:ze.input,externalForwardedProps:Pe,getSlotProps:Oe=>({...Oe,onChange:Ve=>{Oe.onChange?.(Ve),Ie(Ve)}}),ownerState:Ue,additionalProps:{autoFocus:w,checked:T,defaultChecked:S,disabled:Te,id:De?ee:void 0,name:ne,readOnly:fe,required:de,tabIndex:ce,type:pe,...pe==="checkbox"&&he===void 0?{}:{value:he}}});return jsxRuntimeExports.jsxs($e,{...He,children:[jsxRuntimeExports.jsx(je,{...Ne}),Se?_:H]})}),memoTheme=unstable_memoTheme;function getSwitchUtilityClass(x){return generateUtilityClass("MuiSwitch",x)}const switchClasses=generateUtilityClasses("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),useUtilityClasses$B=x=>{const{classes:C,edge:E,size:w,color:T,checked:_,disabled:S}=x,R={root:["root",E&&`edge${capitalize(E)}`,`size${capitalize(w)}`],switchBase:["switchBase",`color${capitalize(T)}`,_&&"checked",S&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},A=composeClasses(R,getSwitchUtilityClass,C);return{...C,...A}},SwitchRoot=styled("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.edge&&C[`edge${capitalize(E.edge)}`],C[`size${capitalize(E.size)}`]]}})({display:"inline-flex",width:34+12*2,height:14+12*2,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"},variants:[{props:{edge:"start"},style:{marginLeft:-8}},{props:{edge:"end"},style:{marginRight:-8}},{props:{size:"small"},style:{width:40,height:24,padding:7,[`& .${switchClasses.thumb}`]:{width:16,height:16},[`& .${switchClasses.switchBase}`]:{padding:4,[`&.${switchClasses.checked}`]:{transform:"translateX(16px)"}}}}]}),SwitchSwitchBase=styled(SwitchBase,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.switchBase,{[`& .${switchClasses.input}`]:C.input},E.color!=="default"&&C[`color${capitalize(E.color)}`]]}})(memoTheme(({theme:x})=>({position:"absolute",top:0,left:0,zIndex:1,color:x.vars?x.vars.palette.Switch.defaultColor:`${x.palette.mode==="light"?x.palette.common.white:x.palette.grey[300]}`,transition:x.transitions.create(["left","transform"],{duration:x.transitions.duration.shortest}),[`&.${switchClasses.checked}`]:{transform:"translateX(20px)"},[`&.${switchClasses.disabled}`]:{color:x.vars?x.vars.palette.Switch.defaultDisabledColor:`${x.palette.mode==="light"?x.palette.grey[100]:x.palette.grey[600]}`},[`&.${switchClasses.checked} + .${switchClasses.track}`]:{opacity:.5},[`&.${switchClasses.disabled} + .${switchClasses.track}`]:{opacity:x.vars?x.vars.opacity.switchTrackDisabled:`${x.palette.mode==="light"?.12:.2}`},[`& .${switchClasses.input}`]:{left:"-100%",width:"300%"}})),memoTheme(({theme:x})=>({"&:hover":{backgroundColor:x.alpha((x.vars||x).palette.action.active,(x.vars||x).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["light"])).map(([C])=>({props:{color:C},style:{[`&.${switchClasses.checked}`]:{color:(x.vars||x).palette[C].main,"&:hover":{backgroundColor:x.alpha((x.vars||x).palette[C].main,(x.vars||x).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${switchClasses.disabled}`]:{color:x.vars?x.vars.palette.Switch[`${C}DisabledColor`]:`${x.palette.mode==="light"?x.lighten(x.palette[C].main,.62):x.darken(x.palette[C].main,.55)}`}},[`&.${switchClasses.checked} + .${switchClasses.track}`]:{backgroundColor:(x.vars||x).palette[C].main}}}))]}))),SwitchTrack=styled("span",{name:"MuiSwitch",slot:"Track"})(memoTheme(({theme:x})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:x.transitions.create(["opacity","background-color"],{duration:x.transitions.duration.shortest}),backgroundColor:x.vars?x.vars.palette.common.onBackground:`${x.palette.mode==="light"?x.palette.common.black:x.palette.common.white}`,opacity:x.vars?x.vars.opacity.switchTrack:`${x.palette.mode==="light"?.38:.3}`}))),SwitchThumb=styled("span",{name:"MuiSwitch",slot:"Thumb"})(memoTheme(({theme:x})=>({boxShadow:(x.vars||x).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"}))),Switch=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiSwitch"}),{className:T,color:_="primary",edge:S=!1,size:R="medium",sx:A,slots:O={},slotProps:H={},...ee}=w,te={...w,color:_,edge:S,size:R},ie=useUtilityClasses$B(te),ne={slots:O,slotProps:H},[ae,oe]=useSlot("root",{className:clsx(ie.root,T),elementType:SwitchRoot,externalForwardedProps:ne,ownerState:te,additionalProps:{sx:A}}),[le,fe]=useSlot("thumb",{className:ie.thumb,elementType:SwitchThumb,externalForwardedProps:ne,ownerState:te}),de=jsxRuntimeExports.jsx(le,{...fe}),[ce,pe]=useSlot("track",{className:ie.track,elementType:SwitchTrack,externalForwardedProps:ne,ownerState:te});return jsxRuntimeExports.jsxs(ae,{...oe,children:[jsxRuntimeExports.jsx(SwitchSwitchBase,{type:"checkbox",icon:de,checkedIcon:de,ref:E,ownerState:te,...ee,classes:{...ie,root:ie.switchBase},slots:{...O.switchBase&&{root:O.switchBase},...O.input&&{input:O.input}},slotProps:{...H.switchBase&&{root:typeof H.switchBase=="function"?H.switchBase(te):H.switchBase},input:{role:"switch"},...H.input&&{input:typeof H.input=="function"?H.input(te):H.input}}}),jsxRuntimeExports.jsx(ce,{...pe})]})});function getReactElementRef(x){return parseInt(reactExports.version,10)>=19?x?.props?.ref||null:x?.ref||null}const reflow=x=>x.scrollTop;function getTransitionProps(x,C){const{timeout:E,easing:w,style:T={}}=x;return{duration:T.transitionDuration??(typeof E=="number"?E:E[C.mode]||0),easing:T.transitionTimingFunction??(typeof w=="object"?w[C.mode]:w),delay:T.transitionDelay}}function getScale(x){return`scale(${x}, ${x**2})`}const styles$2={entering:{opacity:1,transform:getScale(1)},entered:{opacity:1,transform:"none"}},isWebKit154=typeof navigator<"u"&&/^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent)&&/(os |version\/)15(.|_)4/i.test(navigator.userAgent),Grow=reactExports.forwardRef(function(C,E){const{addEndListener:w,appear:T=!0,children:_,easing:S,in:R,onEnter:A,onEntered:O,onEntering:H,onExit:ee,onExited:te,onExiting:ie,style:ne,timeout:ae="auto",TransitionComponent:oe=Transition,...le}=C,fe=useTimeout(),de=reactExports.useRef(),ce=useTheme(),pe=reactExports.useRef(null),he=useForkRef(pe,getReactElementRef(_),E),me=Ie=>Te=>{if(Ie){const De=pe.current;Te===void 0?Ie(De):Ie(De,Te)}},ve=me(H),ye=me((Ie,Te)=>{reflow(Ie);const{duration:De,delay:Ue,easing:ze}=getTransitionProps({style:ne,timeout:ae,easing:S},{mode:"enter"});let Pe;ae==="auto"?(Pe=ce.transitions.getAutoHeightDuration(Ie.clientHeight),de.current=Pe):Pe=De,Ie.style.transition=[ce.transitions.create("opacity",{duration:Pe,delay:Ue}),ce.transitions.create("transform",{duration:isWebKit154?Pe:Pe*.666,delay:Ue,easing:ze})].join(","),A&&A(Ie,Te)}),Se=me(O),Ce=me(ie),be=me(Ie=>{const{duration:Te,delay:De,easing:Ue}=getTransitionProps({style:ne,timeout:ae,easing:S},{mode:"exit"});let ze;ae==="auto"?(ze=ce.transitions.getAutoHeightDuration(Ie.clientHeight),de.current=ze):ze=Te,Ie.style.transition=[ce.transitions.create("opacity",{duration:ze,delay:De}),ce.transitions.create("transform",{duration:isWebKit154?ze:ze*.666,delay:isWebKit154?De:De||ze*.333,easing:Ue})].join(","),Ie.style.opacity=0,Ie.style.transform=getScale(.75),ee&&ee(Ie)}),Ee=me(te),Ae=Ie=>{ae==="auto"&&fe.start(de.current||0,Ie),w&&w(pe.current,Ie)};return jsxRuntimeExports.jsx(oe,{appear:T,in:R,nodeRef:pe,onEnter:ye,onEntered:Se,onEntering:ve,onExit:be,onExited:Ee,onExiting:Ce,addEndListener:Ae,timeout:ae==="auto"?null:ae,...le,children:(Ie,{ownerState:Te,...De})=>reactExports.cloneElement(_,{style:{opacity:0,transform:getScale(.75),visibility:Ie==="exited"&&!R?"hidden":void 0,...styles$2[Ie],...ne,..._.props.style},ref:he,...De})})});Grow&&(Grow.muiSupportAuto=!0);function ownerDocument(x){return x&&x.ownerDocument||document}var top$1="top",bottom="bottom",right="right",left="left",auto="auto",basePlacements=[top$1,bottom,right,left],start="start",end="end",clippingParents="clippingParents",viewport="viewport",popper="popper",reference="reference",variationPlacements=basePlacements.reduce(function(x,C){return x.concat([C+"-"+start,C+"-"+end])},[]),placements=[].concat(basePlacements,[auto]).reduce(function(x,C){return x.concat([C,C+"-"+start,C+"-"+end])},[]),beforeRead="beforeRead",read="read",afterRead="afterRead",beforeMain="beforeMain",main="main",afterMain="afterMain",beforeWrite="beforeWrite",write="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read,afterRead,beforeMain,main,afterMain,beforeWrite,write,afterWrite];function getNodeName(x){return x?(x.nodeName||"").toLowerCase():null}function getWindow(x){if(x==null)return window;if(x.toString()!=="[object Window]"){var C=x.ownerDocument;return C&&C.defaultView||window}return x}function isElement(x){var C=getWindow(x).Element;return x instanceof C||x instanceof Element}function isHTMLElement$1(x){var C=getWindow(x).HTMLElement;return x instanceof C||x instanceof HTMLElement}function isShadowRoot(x){if(typeof ShadowRoot>"u")return!1;var C=getWindow(x).ShadowRoot;return x instanceof C||x instanceof ShadowRoot}function applyStyles(x){var C=x.state;Object.keys(C.elements).forEach(function(E){var w=C.styles[E]||{},T=C.attributes[E]||{},_=C.elements[E];!isHTMLElement$1(_)||!getNodeName(_)||(Object.assign(_.style,w),Object.keys(T).forEach(function(S){var R=T[S];R===!1?_.removeAttribute(S):_.setAttribute(S,R===!0?"":R)}))})}function effect$2(x){var C=x.state,E={popper:{position:C.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(C.elements.popper.style,E.popper),C.styles=E,C.elements.arrow&&Object.assign(C.elements.arrow.style,E.arrow),function(){Object.keys(C.elements).forEach(function(w){var T=C.elements[w],_=C.attributes[w]||{},S=Object.keys(C.styles.hasOwnProperty(w)?C.styles[w]:E[w]),R=S.reduce(function(A,O){return A[O]="",A},{});!isHTMLElement$1(T)||!getNodeName(T)||(Object.assign(T.style,R),Object.keys(_).forEach(function(A){T.removeAttribute(A)}))})}}const applyStyles$1={name:"applyStyles",enabled:!0,phase:"write",fn:applyStyles,effect:effect$2,requires:["computeStyles"]};function getBasePlacement(x){return x.split("-")[0]}var max=Math.max,min=Math.min,round$1=Math.round;function getUAString(){var x=navigator.userAgentData;return x!=null&&x.brands&&Array.isArray(x.brands)?x.brands.map(function(C){return C.brand+"/"+C.version}).join(" "):navigator.userAgent}function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString())}function getBoundingClientRect(x,C,E){C===void 0&&(C=!1),E===void 0&&(E=!1);var w=x.getBoundingClientRect(),T=1,_=1;C&&isHTMLElement$1(x)&&(T=x.offsetWidth>0&&round$1(w.width)/x.offsetWidth||1,_=x.offsetHeight>0&&round$1(w.height)/x.offsetHeight||1);var S=isElement(x)?getWindow(x):window,R=S.visualViewport,A=!isLayoutViewport()&&E,O=(w.left+(A&&R?R.offsetLeft:0))/T,H=(w.top+(A&&R?R.offsetTop:0))/_,ee=w.width/T,te=w.height/_;return{width:ee,height:te,top:H,right:O+ee,bottom:H+te,left:O,x:O,y:H}}function getLayoutRect(x){var C=getBoundingClientRect(x),E=x.offsetWidth,w=x.offsetHeight;return Math.abs(C.width-E)<=1&&(E=C.width),Math.abs(C.height-w)<=1&&(w=C.height),{x:x.offsetLeft,y:x.offsetTop,width:E,height:w}}function contains(x,C){var E=C.getRootNode&&C.getRootNode();if(x.contains(C))return!0;if(E&&isShadowRoot(E)){var w=C;do{if(w&&x.isSameNode(w))return!0;w=w.parentNode||w.host}while(w)}return!1}function getComputedStyle(x){return getWindow(x).getComputedStyle(x)}function isTableElement(x){return["table","td","th"].indexOf(getNodeName(x))>=0}function getDocumentElement(x){return((isElement(x)?x.ownerDocument:x.document)||window.document).documentElement}function getParentNode(x){return getNodeName(x)==="html"?x:x.assignedSlot||x.parentNode||(isShadowRoot(x)?x.host:null)||getDocumentElement(x)}function getTrueOffsetParent(x){return!isHTMLElement$1(x)||getComputedStyle(x).position==="fixed"?null:x.offsetParent}function getContainingBlock(x){var C=/firefox/i.test(getUAString()),E=/Trident/i.test(getUAString());if(E&&isHTMLElement$1(x)){var w=getComputedStyle(x);if(w.position==="fixed")return null}var T=getParentNode(x);for(isShadowRoot(T)&&(T=T.host);isHTMLElement$1(T)&&["html","body"].indexOf(getNodeName(T))<0;){var _=getComputedStyle(T);if(_.transform!=="none"||_.perspective!=="none"||_.contain==="paint"||["transform","perspective"].indexOf(_.willChange)!==-1||C&&_.willChange==="filter"||C&&_.filter&&_.filter!=="none")return T;T=T.parentNode}return null}function getOffsetParent(x){for(var C=getWindow(x),E=getTrueOffsetParent(x);E&&isTableElement(E)&&getComputedStyle(E).position==="static";)E=getTrueOffsetParent(E);return E&&(getNodeName(E)==="html"||getNodeName(E)==="body"&&getComputedStyle(E).position==="static")?C:E||getContainingBlock(x)||C}function getMainAxisFromPlacement(x){return["top","bottom"].indexOf(x)>=0?"x":"y"}function within(x,C,E){return max(x,min(C,E))}function withinMaxClamp(x,C,E){var w=within(x,C,E);return w>E?E:w}function getFreshSideObject(){return{top:0,right:0,bottom:0,left:0}}function mergePaddingObject(x){return Object.assign({},getFreshSideObject(),x)}function expandToHashMap(x,C){return C.reduce(function(E,w){return E[w]=x,E},{})}var toPaddingObject=function(C,E){return C=typeof C=="function"?C(Object.assign({},E.rects,{placement:E.placement})):C,mergePaddingObject(typeof C!="number"?C:expandToHashMap(C,basePlacements))};function arrow(x){var C,E=x.state,w=x.name,T=x.options,_=E.elements.arrow,S=E.modifiersData.popperOffsets,R=getBasePlacement(E.placement),A=getMainAxisFromPlacement(R),O=[left,right].indexOf(R)>=0,H=O?"height":"width";if(!(!_||!S)){var ee=toPaddingObject(T.padding,E),te=getLayoutRect(_),ie=A==="y"?top$1:left,ne=A==="y"?bottom:right,ae=E.rects.reference[H]+E.rects.reference[A]-S[A]-E.rects.popper[H],oe=S[A]-E.rects.reference[A],le=getOffsetParent(_),fe=le?A==="y"?le.clientHeight||0:le.clientWidth||0:0,de=ae/2-oe/2,ce=ee[ie],pe=fe-te[H]-ee[ne],he=fe/2-te[H]/2+de,me=within(ce,he,pe),ve=A;E.modifiersData[w]=(C={},C[ve]=me,C.centerOffset=me-he,C)}}function effect$1(x){var C=x.state,E=x.options,w=E.element,T=w===void 0?"[data-popper-arrow]":w;T!=null&&(typeof T=="string"&&(T=C.elements.popper.querySelector(T),!T)||contains(C.elements.popper,T)&&(C.elements.arrow=T))}const arrow$1={name:"arrow",enabled:!0,phase:"main",fn:arrow,effect:effect$1,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function getVariation(x){return x.split("-")[1]}var unsetSides={top:"auto",right:"auto",bottom:"auto",left:"auto"};function roundOffsetsByDPR(x,C){var E=x.x,w=x.y,T=C.devicePixelRatio||1;return{x:round$1(E*T)/T||0,y:round$1(w*T)/T||0}}function mapToStyles(x){var C,E=x.popper,w=x.popperRect,T=x.placement,_=x.variation,S=x.offsets,R=x.position,A=x.gpuAcceleration,O=x.adaptive,H=x.roundOffsets,ee=x.isFixed,te=S.x,ie=te===void 0?0:te,ne=S.y,ae=ne===void 0?0:ne,oe=typeof H=="function"?H({x:ie,y:ae}):{x:ie,y:ae};ie=oe.x,ae=oe.y;var le=S.hasOwnProperty("x"),fe=S.hasOwnProperty("y"),de=left,ce=top$1,pe=window;if(O){var he=getOffsetParent(E),me="clientHeight",ve="clientWidth";if(he===getWindow(E)&&(he=getDocumentElement(E),getComputedStyle(he).position!=="static"&&R==="absolute"&&(me="scrollHeight",ve="scrollWidth")),he=he,T===top$1||(T===left||T===right)&&_===end){ce=bottom;var ye=ee&&he===pe&&pe.visualViewport?pe.visualViewport.height:he[me];ae-=ye-w.height,ae*=A?1:-1}if(T===left||(T===top$1||T===bottom)&&_===end){de=right;var Se=ee&&he===pe&&pe.visualViewport?pe.visualViewport.width:he[ve];ie-=Se-w.width,ie*=A?1:-1}}var Ce=Object.assign({position:R},O&&unsetSides),be=H===!0?roundOffsetsByDPR({x:ie,y:ae},getWindow(E)):{x:ie,y:ae};if(ie=be.x,ae=be.y,A){var Ee;return Object.assign({},Ce,(Ee={},Ee[ce]=fe?"0":"",Ee[de]=le?"0":"",Ee.transform=(pe.devicePixelRatio||1)<=1?"translate("+ie+"px, "+ae+"px)":"translate3d("+ie+"px, "+ae+"px, 0)",Ee))}return Object.assign({},Ce,(C={},C[ce]=fe?ae+"px":"",C[de]=le?ie+"px":"",C.transform="",C))}function computeStyles(x){var C=x.state,E=x.options,w=E.gpuAcceleration,T=w===void 0?!0:w,_=E.adaptive,S=_===void 0?!0:_,R=E.roundOffsets,A=R===void 0?!0:R,O={placement:getBasePlacement(C.placement),variation:getVariation(C.placement),popper:C.elements.popper,popperRect:C.rects.popper,gpuAcceleration:T,isFixed:C.options.strategy==="fixed"};C.modifiersData.popperOffsets!=null&&(C.styles.popper=Object.assign({},C.styles.popper,mapToStyles(Object.assign({},O,{offsets:C.modifiersData.popperOffsets,position:C.options.strategy,adaptive:S,roundOffsets:A})))),C.modifiersData.arrow!=null&&(C.styles.arrow=Object.assign({},C.styles.arrow,mapToStyles(Object.assign({},O,{offsets:C.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),C.attributes.popper=Object.assign({},C.attributes.popper,{"data-popper-placement":C.placement})}const computeStyles$1={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:computeStyles,data:{}};var passive={passive:!0};function effect(x){var C=x.state,E=x.instance,w=x.options,T=w.scroll,_=T===void 0?!0:T,S=w.resize,R=S===void 0?!0:S,A=getWindow(C.elements.popper),O=[].concat(C.scrollParents.reference,C.scrollParents.popper);return _&&O.forEach(function(H){H.addEventListener("scroll",E.update,passive)}),R&&A.addEventListener("resize",E.update,passive),function(){_&&O.forEach(function(H){H.removeEventListener("scroll",E.update,passive)}),R&&A.removeEventListener("resize",E.update,passive)}}const eventListeners={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect,data:{}};var hash$2={left:"right",right:"left",bottom:"top",top:"bottom"};function getOppositePlacement(x){return x.replace(/left|right|bottom|top/g,function(C){return hash$2[C]})}var hash$1={start:"end",end:"start"};function getOppositeVariationPlacement(x){return x.replace(/start|end/g,function(C){return hash$1[C]})}function getWindowScroll(x){var C=getWindow(x),E=C.pageXOffset,w=C.pageYOffset;return{scrollLeft:E,scrollTop:w}}function getWindowScrollBarX(x){return getBoundingClientRect(getDocumentElement(x)).left+getWindowScroll(x).scrollLeft}function getViewportRect(x,C){var E=getWindow(x),w=getDocumentElement(x),T=E.visualViewport,_=w.clientWidth,S=w.clientHeight,R=0,A=0;if(T){_=T.width,S=T.height;var O=isLayoutViewport();(O||!O&&C==="fixed")&&(R=T.offsetLeft,A=T.offsetTop)}return{width:_,height:S,x:R+getWindowScrollBarX(x),y:A}}function getDocumentRect(x){var C,E=getDocumentElement(x),w=getWindowScroll(x),T=(C=x.ownerDocument)==null?void 0:C.body,_=max(E.scrollWidth,E.clientWidth,T?T.scrollWidth:0,T?T.clientWidth:0),S=max(E.scrollHeight,E.clientHeight,T?T.scrollHeight:0,T?T.clientHeight:0),R=-w.scrollLeft+getWindowScrollBarX(x),A=-w.scrollTop;return getComputedStyle(T||E).direction==="rtl"&&(R+=max(E.clientWidth,T?T.clientWidth:0)-_),{width:_,height:S,x:R,y:A}}function isScrollParent(x){var C=getComputedStyle(x),E=C.overflow,w=C.overflowX,T=C.overflowY;return/auto|scroll|overlay|hidden/.test(E+T+w)}function getScrollParent(x){return["html","body","#document"].indexOf(getNodeName(x))>=0?x.ownerDocument.body:isHTMLElement$1(x)&&isScrollParent(x)?x:getScrollParent(getParentNode(x))}function listScrollParents(x,C){var E;C===void 0&&(C=[]);var w=getScrollParent(x),T=w===((E=x.ownerDocument)==null?void 0:E.body),_=getWindow(w),S=T?[_].concat(_.visualViewport||[],isScrollParent(w)?w:[]):w,R=C.concat(S);return T?R:R.concat(listScrollParents(getParentNode(S)))}function rectToClientRect(x){return Object.assign({},x,{left:x.x,top:x.y,right:x.x+x.width,bottom:x.y+x.height})}function getInnerBoundingClientRect(x,C){var E=getBoundingClientRect(x,!1,C==="fixed");return E.top=E.top+x.clientTop,E.left=E.left+x.clientLeft,E.bottom=E.top+x.clientHeight,E.right=E.left+x.clientWidth,E.width=x.clientWidth,E.height=x.clientHeight,E.x=E.left,E.y=E.top,E}function getClientRectFromMixedType(x,C,E){return C===viewport?rectToClientRect(getViewportRect(x,E)):isElement(C)?getInnerBoundingClientRect(C,E):rectToClientRect(getDocumentRect(getDocumentElement(x)))}function getClippingParents(x){var C=listScrollParents(getParentNode(x)),E=["absolute","fixed"].indexOf(getComputedStyle(x).position)>=0,w=E&&isHTMLElement$1(x)?getOffsetParent(x):x;return isElement(w)?C.filter(function(T){return isElement(T)&&contains(T,w)&&getNodeName(T)!=="body"}):[]}function getClippingRect(x,C,E,w){var T=C==="clippingParents"?getClippingParents(x):[].concat(C),_=[].concat(T,[E]),S=_[0],R=_.reduce(function(A,O){var H=getClientRectFromMixedType(x,O,w);return A.top=max(H.top,A.top),A.right=min(H.right,A.right),A.bottom=min(H.bottom,A.bottom),A.left=max(H.left,A.left),A},getClientRectFromMixedType(x,S,w));return R.width=R.right-R.left,R.height=R.bottom-R.top,R.x=R.left,R.y=R.top,R}function computeOffsets(x){var C=x.reference,E=x.element,w=x.placement,T=w?getBasePlacement(w):null,_=w?getVariation(w):null,S=C.x+C.width/2-E.width/2,R=C.y+C.height/2-E.height/2,A;switch(T){case top$1:A={x:S,y:C.y-E.height};break;case bottom:A={x:S,y:C.y+C.height};break;case right:A={x:C.x+C.width,y:R};break;case left:A={x:C.x-E.width,y:R};break;default:A={x:C.x,y:C.y}}var O=T?getMainAxisFromPlacement(T):null;if(O!=null){var H=O==="y"?"height":"width";switch(_){case start:A[O]=A[O]-(C[H]/2-E[H]/2);break;case end:A[O]=A[O]+(C[H]/2-E[H]/2);break}}return A}function detectOverflow(x,C){C===void 0&&(C={});var E=C,w=E.placement,T=w===void 0?x.placement:w,_=E.strategy,S=_===void 0?x.strategy:_,R=E.boundary,A=R===void 0?clippingParents:R,O=E.rootBoundary,H=O===void 0?viewport:O,ee=E.elementContext,te=ee===void 0?popper:ee,ie=E.altBoundary,ne=ie===void 0?!1:ie,ae=E.padding,oe=ae===void 0?0:ae,le=mergePaddingObject(typeof oe!="number"?oe:expandToHashMap(oe,basePlacements)),fe=te===popper?reference:popper,de=x.rects.popper,ce=x.elements[ne?fe:te],pe=getClippingRect(isElement(ce)?ce:ce.contextElement||getDocumentElement(x.elements.popper),A,H,S),he=getBoundingClientRect(x.elements.reference),me=computeOffsets({reference:he,element:de,placement:T}),ve=rectToClientRect(Object.assign({},de,me)),ye=te===popper?ve:he,Se={top:pe.top-ye.top+le.top,bottom:ye.bottom-pe.bottom+le.bottom,left:pe.left-ye.left+le.left,right:ye.right-pe.right+le.right},Ce=x.modifiersData.offset;if(te===popper&&Ce){var be=Ce[T];Object.keys(Se).forEach(function(Ee){var Ae=[right,bottom].indexOf(Ee)>=0?1:-1,Ie=[top$1,bottom].indexOf(Ee)>=0?"y":"x";Se[Ee]+=be[Ie]*Ae})}return Se}function computeAutoPlacement(x,C){C===void 0&&(C={});var E=C,w=E.placement,T=E.boundary,_=E.rootBoundary,S=E.padding,R=E.flipVariations,A=E.allowedAutoPlacements,O=A===void 0?placements:A,H=getVariation(w),ee=H?R?variationPlacements:variationPlacements.filter(function(ne){return getVariation(ne)===H}):basePlacements,te=ee.filter(function(ne){return O.indexOf(ne)>=0});te.length===0&&(te=ee);var ie=te.reduce(function(ne,ae){return ne[ae]=detectOverflow(x,{placement:ae,boundary:T,rootBoundary:_,padding:S})[getBasePlacement(ae)],ne},{});return Object.keys(ie).sort(function(ne,ae){return ie[ne]-ie[ae]})}function getExpandedFallbackPlacements(x){if(getBasePlacement(x)===auto)return[];var C=getOppositePlacement(x);return[getOppositeVariationPlacement(x),C,getOppositeVariationPlacement(C)]}function flip(x){var C=x.state,E=x.options,w=x.name;if(!C.modifiersData[w]._skip){for(var T=E.mainAxis,_=T===void 0?!0:T,S=E.altAxis,R=S===void 0?!0:S,A=E.fallbackPlacements,O=E.padding,H=E.boundary,ee=E.rootBoundary,te=E.altBoundary,ie=E.flipVariations,ne=ie===void 0?!0:ie,ae=E.allowedAutoPlacements,oe=C.options.placement,le=getBasePlacement(oe),fe=le===oe,de=A||(fe||!ne?[getOppositePlacement(oe)]:getExpandedFallbackPlacements(oe)),ce=[oe].concat(de).reduce(function(Ne,Oe){return Ne.concat(getBasePlacement(Oe)===auto?computeAutoPlacement(C,{placement:Oe,boundary:H,rootBoundary:ee,padding:O,flipVariations:ne,allowedAutoPlacements:ae}):Oe)},[]),pe=C.rects.reference,he=C.rects.popper,me=new Map,ve=!0,ye=ce[0],Se=0;Se<ce.length;Se++){var Ce=ce[Se],be=getBasePlacement(Ce),Ee=getVariation(Ce)===start,Ae=[top$1,bottom].indexOf(be)>=0,Ie=Ae?"width":"height",Te=detectOverflow(C,{placement:Ce,boundary:H,rootBoundary:ee,altBoundary:te,padding:O}),De=Ae?Ee?right:left:Ee?bottom:top$1;pe[Ie]>he[Ie]&&(De=getOppositePlacement(De));var Ue=getOppositePlacement(De),ze=[];if(_&&ze.push(Te[be]<=0),R&&ze.push(Te[De]<=0,Te[Ue]<=0),ze.every(function(Ne){return Ne})){ye=Ce,ve=!1;break}me.set(Ce,ze)}if(ve)for(var Pe=ne?3:1,$e=function(Oe){var Ve=ce.find(function(Ht){var Kt=me.get(Ht);if(Kt)return Kt.slice(0,Oe).every(function(ir){return ir})});if(Ve)return ye=Ve,"break"},He=Pe;He>0;He--){var je=$e(He);if(je==="break")break}C.placement!==ye&&(C.modifiersData[w]._skip=!0,C.placement=ye,C.reset=!0)}}const flip$1={name:"flip",enabled:!0,phase:"main",fn:flip,requiresIfExists:["offset"],data:{_skip:!1}};function getSideOffsets(x,C,E){return E===void 0&&(E={x:0,y:0}),{top:x.top-C.height-E.y,right:x.right-C.width+E.x,bottom:x.bottom-C.height+E.y,left:x.left-C.width-E.x}}function isAnySideFullyClipped(x){return[top$1,right,bottom,left].some(function(C){return x[C]>=0})}function hide(x){var C=x.state,E=x.name,w=C.rects.reference,T=C.rects.popper,_=C.modifiersData.preventOverflow,S=detectOverflow(C,{elementContext:"reference"}),R=detectOverflow(C,{altBoundary:!0}),A=getSideOffsets(S,w),O=getSideOffsets(R,T,_),H=isAnySideFullyClipped(A),ee=isAnySideFullyClipped(O);C.modifiersData[E]={referenceClippingOffsets:A,popperEscapeOffsets:O,isReferenceHidden:H,hasPopperEscaped:ee},C.attributes.popper=Object.assign({},C.attributes.popper,{"data-popper-reference-hidden":H,"data-popper-escaped":ee})}const hide$1={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hide};function distanceAndSkiddingToXY(x,C,E){var w=getBasePlacement(x),T=[left,top$1].indexOf(w)>=0?-1:1,_=typeof E=="function"?E(Object.assign({},C,{placement:x})):E,S=_[0],R=_[1];return S=S||0,R=(R||0)*T,[left,right].indexOf(w)>=0?{x:R,y:S}:{x:S,y:R}}function offset(x){var C=x.state,E=x.options,w=x.name,T=E.offset,_=T===void 0?[0,0]:T,S=placements.reduce(function(H,ee){return H[ee]=distanceAndSkiddingToXY(ee,C.rects,_),H},{}),R=S[C.placement],A=R.x,O=R.y;C.modifiersData.popperOffsets!=null&&(C.modifiersData.popperOffsets.x+=A,C.modifiersData.popperOffsets.y+=O),C.modifiersData[w]=S}const offset$1={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset};function popperOffsets(x){var C=x.state,E=x.name;C.modifiersData[E]=computeOffsets({reference:C.rects.reference,element:C.rects.popper,placement:C.placement})}const popperOffsets$1={name:"popperOffsets",enabled:!0,phase:"read",fn:popperOffsets,data:{}};function getAltAxis(x){return x==="x"?"y":"x"}function preventOverflow(x){var C=x.state,E=x.options,w=x.name,T=E.mainAxis,_=T===void 0?!0:T,S=E.altAxis,R=S===void 0?!1:S,A=E.boundary,O=E.rootBoundary,H=E.altBoundary,ee=E.padding,te=E.tether,ie=te===void 0?!0:te,ne=E.tetherOffset,ae=ne===void 0?0:ne,oe=detectOverflow(C,{boundary:A,rootBoundary:O,padding:ee,altBoundary:H}),le=getBasePlacement(C.placement),fe=getVariation(C.placement),de=!fe,ce=getMainAxisFromPlacement(le),pe=getAltAxis(ce),he=C.modifiersData.popperOffsets,me=C.rects.reference,ve=C.rects.popper,ye=typeof ae=="function"?ae(Object.assign({},C.rects,{placement:C.placement})):ae,Se=typeof ye=="number"?{mainAxis:ye,altAxis:ye}:Object.assign({mainAxis:0,altAxis:0},ye),Ce=C.modifiersData.offset?C.modifiersData.offset[C.placement]:null,be={x:0,y:0};if(he){if(_){var Ee,Ae=ce==="y"?top$1:left,Ie=ce==="y"?bottom:right,Te=ce==="y"?"height":"width",De=he[ce],Ue=De+oe[Ae],ze=De-oe[Ie],Pe=ie?-ve[Te]/2:0,$e=fe===start?me[Te]:ve[Te],He=fe===start?-ve[Te]:-me[Te],je=C.elements.arrow,Ne=ie&&je?getLayoutRect(je):{width:0,height:0},Oe=C.modifiersData["arrow#persistent"]?C.modifiersData["arrow#persistent"].padding:getFreshSideObject(),Ve=Oe[Ae],Ht=Oe[Ie],Kt=within(0,me[Te],Ne[Te]),ir=de?me[Te]/2-Pe-Kt-Ve-Se.mainAxis:$e-Kt-Ve-Se.mainAxis,$t=de?-me[Te]/2+Pe+Kt+Ht+Se.mainAxis:He+Kt+Ht+Se.mainAxis,tr=C.elements.arrow&&getOffsetParent(C.elements.arrow),ar=tr?ce==="y"?tr.clientTop||0:tr.clientLeft||0:0,gr=(Ee=Ce?.[ce])!=null?Ee:0,er=De+ir-gr-ar,sr=De+$t-gr,pr=within(ie?min(Ue,er):Ue,De,ie?max(ze,sr):ze);he[ce]=pr,be[ce]=pr-De}if(R){var ur,Sr=ce==="x"?top$1:left,hr=ce==="x"?bottom:right,yr=he[pe],xr=pe==="y"?"height":"width",Yt=yr+oe[Sr],Jt=yr-oe[hr],mr=[top$1,left].indexOf(le)!==-1,Cr=(ur=Ce?.[pe])!=null?ur:0,zt=mr?Yt:yr-me[xr]-ve[xr]-Cr+Se.altAxis,Ft=mr?yr+me[xr]+ve[xr]-Cr-Se.altAxis:Jt,kt=ie&&mr?withinMaxClamp(zt,yr,Ft):within(ie?zt:Yt,yr,ie?Ft:Jt);he[pe]=kt,be[pe]=kt-yr}C.modifiersData[w]=be}}const preventOverflow$1={name:"preventOverflow",enabled:!0,phase:"main",fn:preventOverflow,requiresIfExists:["offset"]};function getHTMLElementScroll(x){return{scrollLeft:x.scrollLeft,scrollTop:x.scrollTop}}function getNodeScroll(x){return x===getWindow(x)||!isHTMLElement$1(x)?getWindowScroll(x):getHTMLElementScroll(x)}function isElementScaled(x){var C=x.getBoundingClientRect(),E=round$1(C.width)/x.offsetWidth||1,w=round$1(C.height)/x.offsetHeight||1;return E!==1||w!==1}function getCompositeRect(x,C,E){E===void 0&&(E=!1);var w=isHTMLElement$1(C),T=isHTMLElement$1(C)&&isElementScaled(C),_=getDocumentElement(C),S=getBoundingClientRect(x,T,E),R={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(w||!w&&!E)&&((getNodeName(C)!=="body"||isScrollParent(_))&&(R=getNodeScroll(C)),isHTMLElement$1(C)?(A=getBoundingClientRect(C,!0),A.x+=C.clientLeft,A.y+=C.clientTop):_&&(A.x=getWindowScrollBarX(_))),{x:S.left+R.scrollLeft-A.x,y:S.top+R.scrollTop-A.y,width:S.width,height:S.height}}function order$1(x){var C=new Map,E=new Set,w=[];x.forEach(function(_){C.set(_.name,_)});function T(_){E.add(_.name);var S=[].concat(_.requires||[],_.requiresIfExists||[]);S.forEach(function(R){if(!E.has(R)){var A=C.get(R);A&&T(A)}}),w.push(_)}return x.forEach(function(_){E.has(_.name)||T(_)}),w}function orderModifiers(x){var C=order$1(x);return modifierPhases.reduce(function(E,w){return E.concat(C.filter(function(T){return T.phase===w}))},[])}function debounce$1(x){var C;return function(){return C||(C=new Promise(function(E){Promise.resolve().then(function(){C=void 0,E(x())})})),C}}function mergeByName(x){var C=x.reduce(function(E,w){var T=E[w.name];return E[w.name]=T?Object.assign({},T,w,{options:Object.assign({},T.options,w.options),data:Object.assign({},T.data,w.data)}):w,E},{});return Object.keys(C).map(function(E){return C[E]})}var DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var x=arguments.length,C=new Array(x),E=0;E<x;E++)C[E]=arguments[E];return!C.some(function(w){return!(w&&typeof w.getBoundingClientRect=="function")})}function popperGenerator(x){x===void 0&&(x={});var C=x,E=C.defaultModifiers,w=E===void 0?[]:E,T=C.defaultOptions,_=T===void 0?DEFAULT_OPTIONS:T;return function(R,A,O){O===void 0&&(O=_);var H={placement:"bottom",orderedModifiers:[],options:Object.assign({},DEFAULT_OPTIONS,_),modifiersData:{},elements:{reference:R,popper:A},attributes:{},styles:{}},ee=[],te=!1,ie={state:H,setOptions:function(le){var fe=typeof le=="function"?le(H.options):le;ae(),H.options=Object.assign({},_,H.options,fe),H.scrollParents={reference:isElement(R)?listScrollParents(R):R.contextElement?listScrollParents(R.contextElement):[],popper:listScrollParents(A)};var de=orderModifiers(mergeByName([].concat(w,H.options.modifiers)));return H.orderedModifiers=de.filter(function(ce){return ce.enabled}),ne(),ie.update()},forceUpdate:function(){if(!te){var le=H.elements,fe=le.reference,de=le.popper;if(areValidElements(fe,de)){H.rects={reference:getCompositeRect(fe,getOffsetParent(de),H.options.strategy==="fixed"),popper:getLayoutRect(de)},H.reset=!1,H.placement=H.options.placement,H.orderedModifiers.forEach(function(Se){return H.modifiersData[Se.name]=Object.assign({},Se.data)});for(var ce=0;ce<H.orderedModifiers.length;ce++){if(H.reset===!0){H.reset=!1,ce=-1;continue}var pe=H.orderedModifiers[ce],he=pe.fn,me=pe.options,ve=me===void 0?{}:me,ye=pe.name;typeof he=="function"&&(H=he({state:H,options:ve,name:ye,instance:ie})||H)}}}},update:debounce$1(function(){return new Promise(function(oe){ie.forceUpdate(),oe(H)})}),destroy:function(){ae(),te=!0}};if(!areValidElements(R,A))return ie;ie.setOptions(O).then(function(oe){!te&&O.onFirstUpdate&&O.onFirstUpdate(oe)});function ne(){H.orderedModifiers.forEach(function(oe){var le=oe.name,fe=oe.options,de=fe===void 0?{}:fe,ce=oe.effect;if(typeof ce=="function"){var pe=ce({state:H,name:le,instance:ie,options:de}),he=function(){};ee.push(pe||he)}})}function ae(){ee.forEach(function(oe){return oe()}),ee=[]}return ie}}var defaultModifiers=[eventListeners,popperOffsets$1,computeStyles$1,applyStyles$1,offset$1,flip$1,preventOverflow$1,arrow$1,hide$1],createPopper=popperGenerator({defaultModifiers});function useSlotProps(x){const{elementType:C,externalSlotProps:E,ownerState:w,skipResolvingSlotProps:T=!1,..._}=x,S=T?{}:resolveComponentProps(E,w),{props:R,internalRef:A}=mergeSlotProps$1({..._,externalSlotProps:S}),O=useForkRef(A,S?.ref,x.additionalProps?.ref);return appendOwnerState(C,{...R,ref:O},w)}function setRef(x,C){typeof x=="function"?x(C):x&&(x.current=C)}function getContainer$1(x){return typeof x=="function"?x():x}const Portal=reactExports.forwardRef(function(C,E){const{children:w,container:T,disablePortal:_=!1}=C,[S,R]=reactExports.useState(null),A=useForkRef(reactExports.isValidElement(w)?getReactElementRef(w):null,E);if(useEnhancedEffect(()=>{_||R(getContainer$1(T)||document.body)},[T,_]),useEnhancedEffect(()=>{if(S&&!_)return setRef(E,S),()=>{setRef(E,null)}},[E,S,_]),_){if(reactExports.isValidElement(w)){const O={ref:A};return reactExports.cloneElement(w,O)}return w}return S&&reactDomExports.createPortal(w,S)});function getPopperUtilityClass(x){return generateUtilityClass("MuiPopper",x)}generateUtilityClasses("MuiPopper",["root"]);function flipPlacement(x,C){if(C==="ltr")return x;switch(x){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return x}}function resolveAnchorEl$1(x){return typeof x=="function"?x():x}function isHTMLElement(x){return x.nodeType!==void 0}const useUtilityClasses$A=x=>{const{classes:C}=x;return composeClasses({root:["root"]},getPopperUtilityClass,C)},defaultPopperOptions={},PopperTooltip=reactExports.forwardRef(function(C,E){const{anchorEl:w,children:T,direction:_,disablePortal:S,modifiers:R,open:A,placement:O,popperOptions:H,popperRef:ee,slotProps:te={},slots:ie={},TransitionProps:ne,ownerState:ae,...oe}=C,le=reactExports.useRef(null),fe=useForkRef(le,E),de=reactExports.useRef(null),ce=useForkRef(de,ee),pe=reactExports.useRef(ce);useEnhancedEffect(()=>{pe.current=ce},[ce]),reactExports.useImperativeHandle(ee,()=>de.current,[]);const he=flipPlacement(O,_),[me,ve]=reactExports.useState(he),[ye,Se]=reactExports.useState(resolveAnchorEl$1(w));reactExports.useEffect(()=>{de.current&&de.current.forceUpdate()}),reactExports.useEffect(()=>{w&&Se(resolveAnchorEl$1(w))},[w]),useEnhancedEffect(()=>{if(!ye||!A)return;const Ie=Ue=>{ve(Ue.placement)};let Te=[{name:"preventOverflow",options:{altBoundary:S}},{name:"flip",options:{altBoundary:S}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:Ue})=>{Ie(Ue)}}];R!=null&&(Te=Te.concat(R)),H&&H.modifiers!=null&&(Te=Te.concat(H.modifiers));const De=createPopper(ye,le.current,{placement:he,...H,modifiers:Te});return pe.current(De),()=>{De.destroy(),pe.current(null)}},[ye,S,R,A,H,he]);const Ce={placement:me};ne!==null&&(Ce.TransitionProps=ne);const be=useUtilityClasses$A(C),Ee=ie.root??"div",Ae=useSlotProps({elementType:Ee,externalSlotProps:te.root,externalForwardedProps:oe,additionalProps:{role:"tooltip",ref:fe},ownerState:C,className:be.root});return jsxRuntimeExports.jsx(Ee,{...Ae,children:typeof T=="function"?T(Ce):T})}),Popper$1=reactExports.forwardRef(function(C,E){const{anchorEl:w,children:T,container:_,direction:S="ltr",disablePortal:R=!1,keepMounted:A=!1,modifiers:O,open:H,placement:ee="bottom",popperOptions:te=defaultPopperOptions,popperRef:ie,style:ne,transition:ae=!1,slotProps:oe={},slots:le={},...fe}=C,[de,ce]=reactExports.useState(!0),pe=()=>{ce(!1)},he=()=>{ce(!0)};if(!A&&!H&&(!ae||de))return null;let me;if(_)me=_;else if(w){const Se=resolveAnchorEl$1(w);me=Se&&isHTMLElement(Se)?ownerDocument(Se).body:ownerDocument(null).body}const ve=!H&&A&&(!ae||de)?"none":void 0,ye=ae?{in:H,onEnter:pe,onExited:he}:void 0;return jsxRuntimeExports.jsx(Portal,{disablePortal:R,container:me,children:jsxRuntimeExports.jsx(PopperTooltip,{anchorEl:w,direction:S,disablePortal:R,modifiers:O,ref:E,open:ae?!de:H,placement:ee,popperOptions:te,popperRef:ie,slotProps:oe,slots:le,...fe,style:{position:"fixed",top:0,left:0,display:ve,...ne},TransitionProps:ye,children:T})})}),PopperRoot=styled(Popper$1,{name:"MuiPopper",slot:"Root"})({}),Popper=reactExports.forwardRef(function(C,E){const w=useRtl(),T=useDefaultProps({props:C,name:"MuiPopper"}),{anchorEl:_,component:S,components:R,componentsProps:A,container:O,disablePortal:H,keepMounted:ee,modifiers:te,open:ie,placement:ne,popperOptions:ae,popperRef:oe,transition:le,slots:fe,slotProps:de,...ce}=T,pe=fe?.root??R?.Root,he={anchorEl:_,container:O,disablePortal:H,keepMounted:ee,modifiers:te,open:ie,placement:ne,popperOptions:ae,popperRef:oe,transition:le,...ce};return jsxRuntimeExports.jsx(PopperRoot,{as:S,direction:w?"rtl":"ltr",slots:{root:pe},slotProps:de??A,...he,ref:E})});function getTooltipUtilityClass(x){return generateUtilityClass("MuiTooltip",x)}const tooltipClasses=generateUtilityClasses("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);function round(x){return Math.round(x*1e5)/1e5}const useUtilityClasses$z=x=>{const{classes:C,disableInteractive:E,arrow:w,touch:T,placement:_}=x,S={popper:["popper",!E&&"popperInteractive",w&&"popperArrow"],tooltip:["tooltip",w&&"tooltipArrow",T&&"touch",`tooltipPlacement${capitalize(_.split("-")[0])}`],arrow:["arrow"]};return composeClasses(S,getTooltipUtilityClass,C)},TooltipPopper=styled(Popper,{name:"MuiTooltip",slot:"Popper",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.popper,!E.disableInteractive&&C.popperInteractive,E.arrow&&C.popperArrow,!E.open&&C.popperClose]}})(memoTheme(({theme:x})=>({zIndex:(x.vars||x).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:C})=>!C.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:C})=>!C,style:{pointerEvents:"none"}},{props:({ownerState:C})=>C.arrow,style:{[`&[data-popper-placement*="bottom"] .${tooltipClasses.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${tooltipClasses.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:C})=>C.arrow&&!C.isRtl,style:{[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:C})=>C.arrow&&!!C.isRtl,style:{[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:C})=>C.arrow&&!C.isRtl,style:{[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:C})=>C.arrow&&!!C.isRtl,style:{[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),TooltipTooltip=styled("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.tooltip,E.touch&&C.touch,E.arrow&&C.tooltipArrow,C[`tooltipPlacement${capitalize(E.placement.split("-")[0])}`]]}})(memoTheme(({theme:x})=>({backgroundColor:x.vars?x.vars.palette.Tooltip.bg:x.alpha(x.palette.grey[700],.92),borderRadius:(x.vars||x).shape.borderRadius,color:(x.vars||x).palette.common.white,fontFamily:x.typography.fontFamily,padding:"4px 8px",fontSize:x.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:x.typography.fontWeightMedium,[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${tooltipClasses.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${tooltipClasses.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:C})=>C.arrow,style:{position:"relative",margin:0}},{props:({ownerState:C})=>C.touch,style:{padding:"8px 16px",fontSize:x.typography.pxToRem(14),lineHeight:`${round(16/14)}em`,fontWeight:x.typography.fontWeightRegular}},{props:({ownerState:C})=>!C.isRtl,style:{[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:C})=>!C.isRtl&&C.touch,style:{[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:C})=>!!C.isRtl,style:{[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:C})=>!!C.isRtl&&C.touch,style:{[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:C})=>C.touch,style:{[`.${tooltipClasses.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:C})=>C.touch,style:{[`.${tooltipClasses.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),TooltipArrow=styled("span",{name:"MuiTooltip",slot:"Arrow"})(memoTheme(({theme:x})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:x.vars?x.vars.palette.Tooltip.bg:x.alpha(x.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}})));let hystersisOpen=!1;const hystersisTimer=new Timeout;let cursorPosition={x:0,y:0};function composeEventHandler(x,C){return(E,...w)=>{C&&C(E,...w),x(E,...w)}}const Tooltip=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiTooltip"}),{arrow:T=!1,children:_,classes:S,components:R={},componentsProps:A={},describeChild:O=!1,disableFocusListener:H=!1,disableHoverListener:ee=!1,disableInteractive:te=!1,disableTouchListener:ie=!1,enterDelay:ne=100,enterNextDelay:ae=0,enterTouchDelay:oe=700,followCursor:le=!1,id:fe,leaveDelay:de=0,leaveTouchDelay:ce=1500,onClose:pe,onOpen:he,open:me,placement:ve="bottom",PopperComponent:ye,PopperProps:Se={},slotProps:Ce={},slots:be={},title:Ee,TransitionComponent:Ae,TransitionProps:Ie,...Te}=w,De=reactExports.isValidElement(_)?_:jsxRuntimeExports.jsx("span",{children:_}),Ue=useTheme(),ze=useRtl(),[Pe,$e]=reactExports.useState(),[He,je]=reactExports.useState(null),Ne=reactExports.useRef(!1),Oe=te||le,Ve=useTimeout(),Ht=useTimeout(),Kt=useTimeout(),ir=useTimeout(),[$t,tr]=useControlled({controlled:me,default:!1,name:"Tooltip",state:"open"});let ar=$t;const gr=useId(fe),er=reactExports.useRef(),sr=useEventCallback(()=>{er.current!==void 0&&(document.body.style.WebkitUserSelect=er.current,er.current=void 0),ir.clear()});reactExports.useEffect(()=>sr,[sr]);const pr=_e=>{hystersisTimer.clear(),hystersisOpen=!0,tr(!0),he&&!ar&&he(_e)},ur=useEventCallback(_e=>{hystersisTimer.start(800+de,()=>{hystersisOpen=!1}),tr(!1),pe&&ar&&pe(_e),Ve.start(Ue.transitions.duration.shortest,()=>{Ne.current=!1})}),Sr=_e=>{Ne.current&&_e.type!=="touchstart"||(Pe&&Pe.removeAttribute("title"),Ht.clear(),Kt.clear(),ne||hystersisOpen&&ae?Ht.start(hystersisOpen?ae:ne,()=>{pr(_e)}):pr(_e))},hr=_e=>{Ht.clear(),Kt.start(de,()=>{ur(_e)})},[,yr]=reactExports.useState(!1),xr=_e=>{isFocusVisible(_e.target)||(yr(!1),hr(_e))},Yt=_e=>{Pe||$e(_e.currentTarget),isFocusVisible(_e.target)&&(yr(!0),Sr(_e))},Jt=_e=>{Ne.current=!0;const ct=De.props;ct.onTouchStart&&ct.onTouchStart(_e)},mr=_e=>{Jt(_e),Kt.clear(),Ve.clear(),sr(),er.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",ir.start(oe,()=>{document.body.style.WebkitUserSelect=er.current,Sr(_e)})},Cr=_e=>{De.props.onTouchEnd&&De.props.onTouchEnd(_e),sr(),Kt.start(ce,()=>{ur(_e)})};reactExports.useEffect(()=>{if(!ar)return;function _e(ct){ct.key==="Escape"&&ur(ct)}return document.addEventListener("keydown",_e),()=>{document.removeEventListener("keydown",_e)}},[ur,ar]);const zt=useForkRef(getReactElementRef(De),$e,E);!Ee&&Ee!==0&&(ar=!1);const Ft=reactExports.useRef(),kt=_e=>{const ct=De.props;ct.onMouseMove&&ct.onMouseMove(_e),cursorPosition={x:_e.clientX,y:_e.clientY},Ft.current&&Ft.current.update()},ke={},Be=typeof Ee=="string";O?(ke.title=!ar&&Be&&!ee?Ee:null,ke["aria-describedby"]=ar?gr:null):(ke["aria-label"]=Be?Ee:null,ke["aria-labelledby"]=ar&&!Be?gr:null);const et={...ke,...Te,...De.props,className:clsx(Te.className,De.props.className),onTouchStart:Jt,ref:zt,...le?{onMouseMove:kt}:{}},Ze={};ie||(et.onTouchStart=mr,et.onTouchEnd=Cr),ee||(et.onMouseOver=composeEventHandler(Sr,et.onMouseOver),et.onMouseLeave=composeEventHandler(hr,et.onMouseLeave),Oe||(Ze.onMouseOver=Sr,Ze.onMouseLeave=hr)),H||(et.onFocus=composeEventHandler(Yt,et.onFocus),et.onBlur=composeEventHandler(xr,et.onBlur),Oe||(Ze.onFocus=Yt,Ze.onBlur=xr));const Qe={...w,isRtl:ze,arrow:T,disableInteractive:Oe,placement:ve,PopperComponentProp:ye,touch:Ne.current},Ke=typeof Ce.popper=="function"?Ce.popper(Qe):Ce.popper,Je=reactExports.useMemo(()=>{let _e=[{name:"arrow",enabled:!!He,options:{element:He,padding:4}}];return Se.popperOptions?.modifiers&&(_e=_e.concat(Se.popperOptions.modifiers)),Ke?.popperOptions?.modifiers&&(_e=_e.concat(Ke.popperOptions.modifiers)),{...Se.popperOptions,...Ke?.popperOptions,modifiers:_e}},[He,Se.popperOptions,Ke?.popperOptions]),Re=useUtilityClasses$z(Qe),Bt=typeof Ce.transition=="function"?Ce.transition(Qe):Ce.transition,Fe={slots:{popper:R.Popper,transition:R.Transition??Ae,tooltip:R.Tooltip,arrow:R.Arrow,...be},slotProps:{arrow:Ce.arrow??A.arrow,popper:{...Se,...Ke??A.popper},tooltip:Ce.tooltip??A.tooltip,transition:{...Ie,...Bt??A.transition}}},[Ge,nr]=useSlot("popper",{elementType:TooltipPopper,externalForwardedProps:Fe,ownerState:Qe,className:clsx(Re.popper,Se?.className)}),[jt,vr]=useSlot("transition",{elementType:Grow,externalForwardedProps:Fe,ownerState:Qe}),[it,dt]=useSlot("tooltip",{elementType:TooltipTooltip,className:Re.tooltip,externalForwardedProps:Fe,ownerState:Qe}),[xe,Xe]=useSlot("arrow",{elementType:TooltipArrow,className:Re.arrow,externalForwardedProps:Fe,ownerState:Qe,ref:je});return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[reactExports.cloneElement(De,et),jsxRuntimeExports.jsx(Ge,{as:ye??Popper,placement:ve,anchorEl:le?{getBoundingClientRect:()=>({top:cursorPosition.y,left:cursorPosition.x,right:cursorPosition.x,bottom:cursorPosition.y,width:0,height:0})}:Pe,popperRef:Ft,open:Pe?ar:!1,id:gr,transition:!0,...Ze,...nr,popperOptions:Je,children:({TransitionProps:_e})=>jsxRuntimeExports.jsx(jt,{timeout:Ue.transitions.duration.shorter,..._e,...vr,children:jsxRuntimeExports.jsxs(it,{...dt,children:[Ee,T?jsxRuntimeExports.jsx(xe,{...Xe}):null]})})})]})}),codeFilename$6=import.meta.url.split("/").pop(),logPrefix$6=`[${codeFilename$6}]`,LogViewer=()=>{const{t:x}=useTranslation(),{setUnhandledRejectionToastEnabled:C}=useAppRoot(),[E,w]=reactExports.useState(!0),T=reactExports.useRef(E),_=ie=>{T.current=ie,w(ie)},[S,R]=reactExports.useState(""),[A,O]=reactExports.useState(1e3),H=reactExports.useRef(null),ee=reactExports.useMemo(()=>S?S.split(`
`).filter(ie=>ie).length:0,[S]);reactExports.useEffect(()=>{C(!1)},[C]),reactExports.useEffect(()=>{const ie=ne=>{ne.ctrlKey&&ne.key==="r"&&(ne.preventDefault(),_(!T.current))};return window.addEventListener("keydown",ie),()=>{window.removeEventListener("keydown",ie)}},[]),reactExports.useEffect(()=>{let ie;const ne=()=>{T.current?fetch("/vcclient.log").then(ae=>ae.text()).then(ae=>R(ae)):log$1("info",logPrefix$6,"skip fetch"),ie=window.setTimeout(ne,1e3)};return ne(),()=>window.clearTimeout(ie)},[]);const te=reactExports.useMemo(()=>{const ne=S.split(`
`).map((he,me)=>{const ve=he.split(" - ");let ye="",Se="",Ce="",be="",Ee="",Ae="",Ie="";if(ve.length<6)Ee=he;else{ye=ve[0].split(",")[0],Se=ve[1],Ce=ve[2],be=ve[3];const Te=ve[ve.length-2];Ae=Te?(Ue=>{const ze=Ue.split(/[/\\]/),Pe=ze.pop(),$e=ze.pop()||"";return Ue?.includes(".venv")?`(venv)${$e}/${Pe}`:`${$e}/${Pe}`})(Te):"",Ie=ve[ve.length-1],Ee=ve.slice(4,ve.length-2).join(" - ")}return[me,ye,Se,Ce,be,Ee,Ae,Ie]}).slice(-A),ae=["ERROR","Error","error"],oe=["WARNING","Warning","warning"],le=["GPU[cuda]"],fe=ae.concat(oe).concat(le),de=he=>he.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),ce=fe.map(de);return jsxRuntimeExports.jsx("div",{style:{userSelect:"text"},children:ne.map((he,me)=>{const Se=he[5].split(new RegExp(`(${ce.join("|")})`)).map((Ce,be)=>ae.includes(Ce)?jsxRuntimeExports.jsx("span",{style:{color:"red"},children:Ce},be):oe.includes(Ce)?jsxRuntimeExports.jsx("span",{style:{color:"blue"},children:Ce},be):le.includes(Ce)?jsxRuntimeExports.jsx("span",{style:{color:"green"},children:Ce},be):jsxRuntimeExports.jsx("span",{children:Ce},be));return jsxRuntimeExports.jsxs("div",{style:{backgroundColor:me%2==0?"white":"#eeeeee",display:"flex",gap:"20px"},children:[jsxRuntimeExports.jsx("div",{style:{width:"250px",display:"flex",flexDirection:"column"},children:jsxRuntimeExports.jsx(Tooltip,{title:`${he[6]} ${he[7]}`,enterDelay:50,slotProps:{tooltip:{style:{fontSize:"22px",fontWeight:"normal"}}},children:jsxRuntimeExports.jsxs("div",{children:[he[0]," | ",he[1]]})})}),jsxRuntimeExports.jsx("div",{style:{width:"60px",color:he[4]==="ERROR"?"red":he[4]==="WARNING"?"blue":"black"},children:he[4]}),jsxRuntimeExports.jsx("div",{style:{width:"500px"},children:Se})]})})})},[S,A]);return reactExports.useEffect(()=>{S&&H.current&&H.current.scrollIntoView({behavior:"smooth"})},[S]),jsxRuntimeExports.jsxs("div",{style:{margin:"0 auto",padding:"20px",width:"100%"},children:[jsxRuntimeExports.jsx("h2",{children:x("log_viewer.title")}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[x("log_viewer.latest"),jsxRuntimeExports.jsxs("select",{value:A,onChange:ie=>O(Number(ie.target.value)),style:{margin:"0 4px"},children:[jsxRuntimeExports.jsx("option",{value:10,children:"10"}),jsxRuntimeExports.jsx("option",{value:50,children:"50"}),jsxRuntimeExports.jsx("option",{value:100,children:"100"}),jsxRuntimeExports.jsx("option",{value:500,children:"500"}),jsxRuntimeExports.jsx("option",{value:1e3,children:"1000"}),jsxRuntimeExports.jsx("option",{value:5e3,children:"5000"}),jsxRuntimeExports.jsx("option",{value:1e4,children:"10000"}),jsxRuntimeExports.jsx("option",{value:ee,children:x("log_viewer.all_items",{count:ee})})]}),x("log_viewer.items"),jsxRuntimeExports.jsxs("span",{style:{marginLeft:"8px",color:"#888"},children:["/ ",x("log_viewer.total_items",{count:ee})]})]})," ",jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[jsxRuntimeExports.jsx(Switch,{checked:E,onChange:()=>{log$1("info",logPrefix$6,`${E} -> ${!E}`),_(!E)}}),x("log_viewer.autoload",{status:x(E?"log_viewer.on":"log_viewer.off")})]})]}),S?jsxRuntimeExports.jsxs("div",{style:{maxHeight:"calc(100vh - 120px)",overflowY:"auto",border:"1px solid #ccc",borderRadius:"4px",marginTop:"8px"},children:[te,jsxRuntimeExports.jsx("div",{ref:H})]}):jsxRuntimeExports.jsx("div",{children:x("log_viewer.loading")})]})},AppStateContext=reactExports.createContext(null),useAppState=()=>{const{t:x}=useTranslation(),C=reactExports.useContext(AppStateContext);if(!C)throw new Error(x("common.error_messages.use_app_state_context_error"));return C};function ThemeProviderNoVars({theme:x,...C}){const E=THEME_ID in x?x[THEME_ID]:void 0;return jsxRuntimeExports.jsx(ThemeProvider$1,{...C,themeId:E?THEME_ID:void 0,theme:E||x})}const defaultConfig={colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},{CssVarsProvider:InternalCssVarsProvider}=createCssVarsProvider({themeId:THEME_ID,theme:()=>createTheme({cssVariables:!0}),colorSchemeStorageKey:defaultConfig.colorSchemeStorageKey,modeStorageKey:defaultConfig.modeStorageKey,defaultColorScheme:{light:defaultConfig.defaultLightColorScheme,dark:defaultConfig.defaultDarkColorScheme},resolveTheme:x=>{const C={...x,typography:createTypography(x.palette,x.typography)};return C.unstable_sx=function(w){return styleFunctionSx({sx:w,theme:this})},C}}),CssVarsProvider=InternalCssVarsProvider;function ThemeProvider({theme:x,...C}){const E=reactExports.useMemo(()=>{if(typeof x=="function")return x;const w=THEME_ID in x?x[THEME_ID]:x;return"colorSchemes"in w?null:"vars"in w?x:{...x,vars:null}},[x]);return E?jsxRuntimeExports.jsx(ThemeProviderNoVars,{theme:E,...C}):jsxRuntimeExports.jsx(CssVarsProvider,{theme:x,...C})}function createChainedFunction(...x){return x.reduce((C,E)=>E==null?C:function(...T){C.apply(this,T),E.apply(this,T)},()=>{})}function getSvgIconUtilityClass(x){return generateUtilityClass("MuiSvgIcon",x)}generateUtilityClasses("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const useUtilityClasses$y=x=>{const{color:C,fontSize:E,classes:w}=x,T={root:["root",C!=="inherit"&&`color${capitalize(C)}`,`fontSize${capitalize(E)}`]};return composeClasses(T,getSvgIconUtilityClass,w)},SvgIconRoot=styled("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.color!=="inherit"&&C[`color${capitalize(E.color)}`],C[`fontSize${capitalize(E.fontSize)}`]]}})(memoTheme(({theme:x})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:x.transitions?.create?.("fill",{duration:(x.vars??x).transitions?.duration?.shorter}),variants:[{props:C=>!C.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:x.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:x.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:x.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((x.vars??x).palette).filter(([,C])=>C&&C.main).map(([C])=>({props:{color:C},style:{color:(x.vars??x).palette?.[C]?.main}})),{props:{color:"action"},style:{color:(x.vars??x).palette?.action?.active}},{props:{color:"disabled"},style:{color:(x.vars??x).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),SvgIcon=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiSvgIcon"}),{children:T,className:_,color:S="inherit",component:R="svg",fontSize:A="medium",htmlColor:O,inheritViewBox:H=!1,titleAccess:ee,viewBox:te="0 0 24 24",...ie}=w,ne=reactExports.isValidElement(T)&&T.type==="svg",ae={...w,color:S,component:R,fontSize:A,instanceFontSize:C.fontSize,inheritViewBox:H,viewBox:te,hasSvgAsChild:ne},oe={};H||(oe.viewBox=te);const le=useUtilityClasses$y(ae);return jsxRuntimeExports.jsxs(SvgIconRoot,{as:R,className:clsx(le.root,_),focusable:"false",color:O,"aria-hidden":ee?void 0:!0,role:ee?"img":void 0,ref:E,...oe,...ie,...ne&&T.props,ownerState:ae,children:[ne?T.props.children:T,ee?jsxRuntimeExports.jsx("title",{children:ee}):null]})});SvgIcon.muiName="SvgIcon";function createSvgIcon(x,C){function E(w,T){return jsxRuntimeExports.jsx(SvgIcon,{"data-testid":void 0,ref:T,...w,children:x})}return E.muiName=SvgIcon.muiName,reactExports.memo(reactExports.forwardRef(E))}function debounce(x,C=166){let E;function w(...T){const _=()=>{x.apply(this,T)};clearTimeout(E),E=setTimeout(_,C)}return w.clear=()=>{clearTimeout(E)},w}function ownerWindow(x){return ownerDocument(x).defaultView||window}function isEventHandler(x,C){const E=x.charCodeAt(2);return x[0]==="o"&&x[1]==="n"&&E>=65&&E<=90&&typeof C=="function"}function mergeSlotProps(x,C){if(!x)return C;function E(S,R){const A={};return Object.keys(R).forEach(O=>{isEventHandler(O,R[O])&&typeof S[O]=="function"&&(A[O]=(...H)=>{S[O](...H),R[O](...H)})}),A}if(typeof x=="function"||typeof C=="function")return S=>{const R=typeof C=="function"?C(S):C,A=typeof x=="function"?x({...S,...R}):x,O=clsx(S?.className,R?.className,A?.className),H=E(A,R);return{...R,...A,...H,...!!O&&{className:O},...R?.style&&A?.style&&{style:{...R.style,...A.style}},...R?.sx&&A?.sx&&{sx:[...Array.isArray(R.sx)?R.sx:[R.sx],...Array.isArray(A.sx)?A.sx:[A.sx]]}}};const w=C,T=E(x,w),_=clsx(w?.className,x?.className);return{...C,...x,...T,...!!_&&{className:_},...w?.style&&x?.style&&{style:{...w.style,...x.style}},...w?.sx&&x?.sx&&{sx:[...Array.isArray(w.sx)?w.sx:[w.sx],...Array.isArray(x.sx)?x.sx:[x.sx]]}}}function getPaperUtilityClass(x){return generateUtilityClass("MuiPaper",x)}generateUtilityClasses("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const useUtilityClasses$x=x=>{const{square:C,elevation:E,variant:w,classes:T}=x,_={root:["root",w,!C&&"rounded",w==="elevation"&&`elevation${E}`]};return composeClasses(_,getPaperUtilityClass,T)},PaperRoot=styled("div",{name:"MuiPaper",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,C[E.variant],!E.square&&C.rounded,E.variant==="elevation"&&C[`elevation${E.elevation}`]]}})(memoTheme(({theme:x})=>({backgroundColor:(x.vars||x).palette.background.paper,color:(x.vars||x).palette.text.primary,transition:x.transitions.create("box-shadow"),variants:[{props:({ownerState:C})=>!C.square,style:{borderRadius:x.shape.borderRadius}},{props:{variant:"outlined"},style:{border:`1px solid ${(x.vars||x).palette.divider}`}},{props:{variant:"elevation"},style:{boxShadow:"var(--Paper-shadow)",backgroundImage:"var(--Paper-overlay)"}}]}))),Paper=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiPaper"}),T=useTheme(),{className:_,component:S="div",elevation:R=1,square:A=!1,variant:O="elevation",...H}=w,ee={...w,component:S,elevation:R,square:A,variant:O},te=useUtilityClasses$x(ee);return jsxRuntimeExports.jsx(PaperRoot,{as:S,ownerState:ee,className:clsx(te.root,_),ref:E,...H,style:{...O==="elevation"&&{"--Paper-shadow":(T.vars||T).shadows[R],...T.vars&&{"--Paper-overlay":T.vars.overlays?.[R]},...!T.vars&&T.palette.mode==="dark"&&{"--Paper-overlay":`linear-gradient(${alpha("#fff",getOverlayAlpha(R))}, ${alpha("#fff",getOverlayAlpha(R))})`}},...H.style}})});function getCircularProgressUtilityClass(x){return generateUtilityClass("MuiCircularProgress",x)}generateUtilityClasses("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const SIZE=44,circularRotateKeyframe=keyframes`
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
`,circularDashKeyframe=keyframes`
  0% {
    stroke-dasharray: 1px, 200px;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 100px, 200px;
    stroke-dashoffset: -15px;
  }

  100% {
    stroke-dasharray: 1px, 200px;
    stroke-dashoffset: -126px;
  }
`,rotateAnimation=typeof circularRotateKeyframe!="string"?css`
        animation: ${circularRotateKeyframe} 1.4s linear infinite;
      `:null,dashAnimation=typeof circularDashKeyframe!="string"?css`
        animation: ${circularDashKeyframe} 1.4s ease-in-out infinite;
      `:null,useUtilityClasses$w=x=>{const{classes:C,variant:E,color:w,disableShrink:T}=x,_={root:["root",E,`color${capitalize(w)}`],svg:["svg"],circle:["circle",`circle${capitalize(E)}`,T&&"circleDisableShrink"]};return composeClasses(_,getCircularProgressUtilityClass,C)},CircularProgressRoot=styled("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,C[E.variant],C[`color${capitalize(E.color)}`]]}})(memoTheme(({theme:x})=>({display:"inline-block",variants:[{props:{variant:"determinate"},style:{transition:x.transitions.create("transform")}},{props:{variant:"indeterminate"},style:rotateAnimation||{animation:`${circularRotateKeyframe} 1.4s linear infinite`}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{color:(x.vars||x).palette[C].main}}))]}))),CircularProgressSVG=styled("svg",{name:"MuiCircularProgress",slot:"Svg"})({display:"block"}),CircularProgressCircle=styled("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.circle,C[`circle${capitalize(E.variant)}`],E.disableShrink&&C.circleDisableShrink]}})(memoTheme(({theme:x})=>({stroke:"currentColor",variants:[{props:{variant:"determinate"},style:{transition:x.transitions.create("stroke-dashoffset")}},{props:{variant:"indeterminate"},style:{strokeDasharray:"80px, 200px",strokeDashoffset:0}},{props:({ownerState:C})=>C.variant==="indeterminate"&&!C.disableShrink,style:dashAnimation||{animation:`${circularDashKeyframe} 1.4s ease-in-out infinite`}}]}))),CircularProgress=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiCircularProgress"}),{className:T,color:_="primary",disableShrink:S=!1,size:R=40,style:A,thickness:O=3.6,value:H=0,variant:ee="indeterminate",...te}=w,ie={...w,color:_,disableShrink:S,size:R,thickness:O,value:H,variant:ee},ne=useUtilityClasses$w(ie),ae={},oe={},le={};if(ee==="determinate"){const fe=2*Math.PI*((SIZE-O)/2);ae.strokeDasharray=fe.toFixed(3),le["aria-valuenow"]=Math.round(H),ae.strokeDashoffset=`${((100-H)/100*fe).toFixed(3)}px`,oe.transform="rotate(-90deg)"}return jsxRuntimeExports.jsx(CircularProgressRoot,{className:clsx(ne.root,T),style:{width:R,height:R,...oe,...A},ownerState:ie,ref:E,role:"progressbar",...le,...te,children:jsxRuntimeExports.jsx(CircularProgressSVG,{className:ne.svg,ownerState:ie,viewBox:`${SIZE/2} ${SIZE/2} ${SIZE} ${SIZE}`,children:jsxRuntimeExports.jsx(CircularProgressCircle,{className:ne.circle,style:ae,ownerState:ie,cx:SIZE,cy:SIZE,r:(SIZE-O)/2,fill:"none",strokeWidth:O})})})});function getIconButtonUtilityClass(x){return generateUtilityClass("MuiIconButton",x)}const iconButtonClasses=generateUtilityClasses("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge","loading","loadingIndicator","loadingWrapper"]),useUtilityClasses$v=x=>{const{classes:C,disabled:E,color:w,edge:T,size:_,loading:S}=x,R={root:["root",S&&"loading",E&&"disabled",w!=="default"&&`color${capitalize(w)}`,T&&`edge${capitalize(T)}`,`size${capitalize(_)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]};return composeClasses(R,getIconButtonUtilityClass,C)},IconButtonRoot=styled(ButtonBase,{name:"MuiIconButton",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.loading&&C.loading,E.color!=="default"&&C[`color${capitalize(E.color)}`],E.edge&&C[`edge${capitalize(E.edge)}`],C[`size${capitalize(E.size)}`]]}})(memoTheme(({theme:x})=>({textAlign:"center",flex:"0 0 auto",fontSize:x.typography.pxToRem(24),padding:8,borderRadius:"50%",color:(x.vars||x).palette.action.active,transition:x.transitions.create("background-color",{duration:x.transitions.duration.shortest}),variants:[{props:C=>!C.disableRipple,style:{"--IconButton-hoverBg":x.alpha((x.vars||x).palette.action.active,(x.vars||x).palette.action.hoverOpacity),"&:hover":{backgroundColor:"var(--IconButton-hoverBg)","@media (hover: none)":{backgroundColor:"transparent"}}}},{props:{edge:"start"},style:{marginLeft:-12}},{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:{edge:"end"},style:{marginRight:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}}]})),memoTheme(({theme:x})=>({variants:[{props:{color:"inherit"},style:{color:"inherit"}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{color:(x.vars||x).palette[C].main}})),...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{"--IconButton-hoverBg":x.alpha((x.vars||x).palette[C].main,(x.vars||x).palette.action.hoverOpacity)}})),{props:{size:"small"},style:{padding:5,fontSize:x.typography.pxToRem(18)}},{props:{size:"large"},style:{padding:12,fontSize:x.typography.pxToRem(28)}}],[`&.${iconButtonClasses.disabled}`]:{backgroundColor:"transparent",color:(x.vars||x).palette.action.disabled},[`&.${iconButtonClasses.loading}`]:{color:"transparent"}}))),IconButtonLoadingIndicator=styled("span",{name:"MuiIconButton",slot:"LoadingIndicator"})(({theme:x})=>({display:"none",position:"absolute",visibility:"visible",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:(x.vars||x).palette.action.disabled,variants:[{props:{loading:!0},style:{display:"flex"}}]})),IconButton=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiIconButton"}),{edge:T=!1,children:_,className:S,color:R="default",disabled:A=!1,disableFocusRipple:O=!1,size:H="medium",id:ee,loading:te=null,loadingIndicator:ie,...ne}=w,ae=useId(ee),oe=ie??jsxRuntimeExports.jsx(CircularProgress,{"aria-labelledby":ae,color:"inherit",size:16}),le={...w,edge:T,color:R,disabled:A,disableFocusRipple:O,loading:te,loadingIndicator:oe,size:H},fe=useUtilityClasses$v(le);return jsxRuntimeExports.jsxs(IconButtonRoot,{id:te?ae:ee,className:clsx(fe.root,S),centerRipple:!0,focusRipple:!O,disabled:A||te,ref:E,...ne,ownerState:le,children:[typeof te=="boolean"&&jsxRuntimeExports.jsx("span",{className:fe.loadingWrapper,style:{display:"contents"},children:jsxRuntimeExports.jsx(IconButtonLoadingIndicator,{className:fe.loadingIndicator,ownerState:le,children:te&&oe})}),_]})});function getTypographyUtilityClass(x){return generateUtilityClass("MuiTypography",x)}generateUtilityClasses("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const v6Colors={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},extendSxProp=internal_createExtendSxProp(),useUtilityClasses$u=x=>{const{align:C,gutterBottom:E,noWrap:w,paragraph:T,variant:_,classes:S}=x,R={root:["root",_,x.align!=="inherit"&&`align${capitalize(C)}`,E&&"gutterBottom",w&&"noWrap",T&&"paragraph"]};return composeClasses(R,getTypographyUtilityClass,S)},TypographyRoot=styled("span",{name:"MuiTypography",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.variant&&C[E.variant],E.align!=="inherit"&&C[`align${capitalize(E.align)}`],E.noWrap&&C.noWrap,E.gutterBottom&&C.gutterBottom,E.paragraph&&C.paragraph]}})(memoTheme(({theme:x})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(x.typography).filter(([C,E])=>C!=="inherit"&&E&&typeof E=="object").map(([C,E])=>({props:{variant:C},style:E})),...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{color:(x.vars||x).palette[C].main}})),...Object.entries(x.palette?.text||{}).filter(([,C])=>typeof C=="string").map(([C])=>({props:{color:`text${capitalize(C)}`},style:{color:(x.vars||x).palette.text[C]}})),{props:({ownerState:C})=>C.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:C})=>C.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:C})=>C.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:C})=>C.paragraph,style:{marginBottom:16}}]}))),defaultVariantMapping={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Typography=reactExports.forwardRef(function(C,E){const{color:w,...T}=useDefaultProps({props:C,name:"MuiTypography"}),_=!v6Colors[w],S=extendSxProp({...T,..._&&{color:w}}),{align:R="inherit",className:A,component:O,gutterBottom:H=!1,noWrap:ee=!1,paragraph:te=!1,variant:ie="body1",variantMapping:ne=defaultVariantMapping,...ae}=S,oe={...S,align:R,color:w,className:A,component:O,gutterBottom:H,noWrap:ee,paragraph:te,variant:ie,variantMapping:ne},le=O||(te?"p":ne[ie]||defaultVariantMapping[ie])||"span",fe=useUtilityClasses$u(oe);return jsxRuntimeExports.jsx(TypographyRoot,{as:le,ref:E,className:clsx(fe.root,A),...ae,ownerState:oe,style:{...R!=="inherit"&&{"--Typography-textAlign":R},...ae.style}})}),CancelIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}));function getChipUtilityClass(x){return generateUtilityClass("MuiChip",x)}const chipClasses=generateUtilityClasses("MuiChip",["root","sizeSmall","sizeMedium","colorDefault","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","disabled","clickable","clickableColorPrimary","clickableColorSecondary","deletable","deletableColorPrimary","deletableColorSecondary","outlined","filled","outlinedPrimary","outlinedSecondary","filledPrimary","filledSecondary","avatar","avatarSmall","avatarMedium","avatarColorPrimary","avatarColorSecondary","icon","iconSmall","iconMedium","iconColorPrimary","iconColorSecondary","label","labelSmall","labelMedium","deleteIcon","deleteIconSmall","deleteIconMedium","deleteIconColorPrimary","deleteIconColorSecondary","deleteIconOutlinedColorPrimary","deleteIconOutlinedColorSecondary","deleteIconFilledColorPrimary","deleteIconFilledColorSecondary","focusVisible"]),useUtilityClasses$t=x=>{const{classes:C,disabled:E,size:w,color:T,iconColor:_,onDelete:S,clickable:R,variant:A}=x,O={root:["root",A,E&&"disabled",`size${capitalize(w)}`,`color${capitalize(T)}`,R&&"clickable",R&&`clickableColor${capitalize(T)}`,S&&"deletable",S&&`deletableColor${capitalize(T)}`,`${A}${capitalize(T)}`],label:["label",`label${capitalize(w)}`],avatar:["avatar",`avatar${capitalize(w)}`,`avatarColor${capitalize(T)}`],icon:["icon",`icon${capitalize(w)}`,`iconColor${capitalize(_)}`],deleteIcon:["deleteIcon",`deleteIcon${capitalize(w)}`,`deleteIconColor${capitalize(T)}`,`deleteIcon${capitalize(A)}Color${capitalize(T)}`]};return composeClasses(O,getChipUtilityClass,C)},ChipRoot=styled("div",{name:"MuiChip",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x,{color:w,iconColor:T,clickable:_,onDelete:S,size:R,variant:A}=E;return[{[`& .${chipClasses.avatar}`]:C.avatar},{[`& .${chipClasses.avatar}`]:C[`avatar${capitalize(R)}`]},{[`& .${chipClasses.avatar}`]:C[`avatarColor${capitalize(w)}`]},{[`& .${chipClasses.icon}`]:C.icon},{[`& .${chipClasses.icon}`]:C[`icon${capitalize(R)}`]},{[`& .${chipClasses.icon}`]:C[`iconColor${capitalize(T)}`]},{[`& .${chipClasses.deleteIcon}`]:C.deleteIcon},{[`& .${chipClasses.deleteIcon}`]:C[`deleteIcon${capitalize(R)}`]},{[`& .${chipClasses.deleteIcon}`]:C[`deleteIconColor${capitalize(w)}`]},{[`& .${chipClasses.deleteIcon}`]:C[`deleteIcon${capitalize(A)}Color${capitalize(w)}`]},C.root,C[`size${capitalize(R)}`],C[`color${capitalize(w)}`],_&&C.clickable,_&&w!=="default"&&C[`clickableColor${capitalize(w)})`],S&&C.deletable,S&&w!=="default"&&C[`deletableColor${capitalize(w)}`],C[A],C[`${A}${capitalize(w)}`]]}})(memoTheme(({theme:x})=>{const C=x.palette.mode==="light"?x.palette.grey[700]:x.palette.grey[300];return{maxWidth:"100%",fontFamily:x.typography.fontFamily,fontSize:x.typography.pxToRem(13),display:"inline-flex",alignItems:"center",justifyContent:"center",height:32,lineHeight:1.5,color:(x.vars||x).palette.text.primary,backgroundColor:(x.vars||x).palette.action.selected,borderRadius:32/2,whiteSpace:"nowrap",transition:x.transitions.create(["background-color","box-shadow"]),cursor:"unset",outline:0,textDecoration:"none",border:0,padding:0,verticalAlign:"middle",boxSizing:"border-box",[`&.${chipClasses.disabled}`]:{opacity:(x.vars||x).palette.action.disabledOpacity,pointerEvents:"none"},[`& .${chipClasses.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:x.vars?x.vars.palette.Chip.defaultAvatarColor:C,fontSize:x.typography.pxToRem(12)},[`& .${chipClasses.avatarColorPrimary}`]:{color:(x.vars||x).palette.primary.contrastText,backgroundColor:(x.vars||x).palette.primary.dark},[`& .${chipClasses.avatarColorSecondary}`]:{color:(x.vars||x).palette.secondary.contrastText,backgroundColor:(x.vars||x).palette.secondary.dark},[`& .${chipClasses.avatarSmall}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:x.typography.pxToRem(10)},[`& .${chipClasses.icon}`]:{marginLeft:5,marginRight:-6},[`& .${chipClasses.deleteIcon}`]:{WebkitTapHighlightColor:"transparent",color:x.alpha((x.vars||x).palette.text.primary,.26),fontSize:22,cursor:"pointer",margin:"0 5px 0 -6px","&:hover":{color:x.alpha((x.vars||x).palette.text.primary,.4)}},variants:[{props:{size:"small"},style:{height:24,[`& .${chipClasses.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${chipClasses.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["contrastText"])).map(([E])=>({props:{color:E},style:{backgroundColor:(x.vars||x).palette[E].main,color:(x.vars||x).palette[E].contrastText,[`& .${chipClasses.deleteIcon}`]:{color:x.alpha((x.vars||x).palette[E].contrastText,.7),"&:hover, &:active":{color:(x.vars||x).palette[E].contrastText}}}})),{props:E=>E.iconColor===E.color,style:{[`& .${chipClasses.icon}`]:{color:x.vars?x.vars.palette.Chip.defaultIconColor:C}}},{props:E=>E.iconColor===E.color&&E.color!=="default",style:{[`& .${chipClasses.icon}`]:{color:"inherit"}}},{props:{onDelete:!0},style:{[`&.${chipClasses.focusVisible}`]:{backgroundColor:x.alpha((x.vars||x).palette.action.selected,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.focusOpacity}`)}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["dark"])).map(([E])=>({props:{color:E,onDelete:!0},style:{[`&.${chipClasses.focusVisible}`]:{background:(x.vars||x).palette[E].dark}}})),{props:{clickable:!0},style:{userSelect:"none",WebkitTapHighlightColor:"transparent",cursor:"pointer","&:hover":{backgroundColor:x.alpha((x.vars||x).palette.action.selected,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.hoverOpacity}`)},[`&.${chipClasses.focusVisible}`]:{backgroundColor:x.alpha((x.vars||x).palette.action.selected,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.focusOpacity}`)},"&:active":{boxShadow:(x.vars||x).shadows[1]}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["dark"])).map(([E])=>({props:{color:E,clickable:!0},style:{[`&:hover, &.${chipClasses.focusVisible}`]:{backgroundColor:(x.vars||x).palette[E].dark}}})),{props:{variant:"outlined"},style:{backgroundColor:"transparent",border:x.vars?`1px solid ${x.vars.palette.Chip.defaultBorder}`:`1px solid ${x.palette.mode==="light"?x.palette.grey[400]:x.palette.grey[700]}`,[`&.${chipClasses.clickable}:hover`]:{backgroundColor:(x.vars||x).palette.action.hover},[`&.${chipClasses.focusVisible}`]:{backgroundColor:(x.vars||x).palette.action.focus},[`& .${chipClasses.avatar}`]:{marginLeft:4},[`& .${chipClasses.avatarSmall}`]:{marginLeft:2},[`& .${chipClasses.icon}`]:{marginLeft:4},[`& .${chipClasses.iconSmall}`]:{marginLeft:2},[`& .${chipClasses.deleteIcon}`]:{marginRight:5},[`& .${chipClasses.deleteIconSmall}`]:{marginRight:3}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([E])=>({props:{variant:"outlined",color:E},style:{color:(x.vars||x).palette[E].main,border:`1px solid ${x.alpha((x.vars||x).palette[E].main,.7)}`,[`&.${chipClasses.clickable}:hover`]:{backgroundColor:x.alpha((x.vars||x).palette[E].main,(x.vars||x).palette.action.hoverOpacity)},[`&.${chipClasses.focusVisible}`]:{backgroundColor:x.alpha((x.vars||x).palette[E].main,(x.vars||x).palette.action.focusOpacity)},[`& .${chipClasses.deleteIcon}`]:{color:x.alpha((x.vars||x).palette[E].main,.7),"&:hover, &:active":{color:(x.vars||x).palette[E].main}}}}))]}})),ChipLabel=styled("span",{name:"MuiChip",slot:"Label",overridesResolver:(x,C)=>{const{ownerState:E}=x,{size:w}=E;return[C.label,C[`label${capitalize(w)}`]]}})({overflow:"hidden",textOverflow:"ellipsis",paddingLeft:12,paddingRight:12,whiteSpace:"nowrap",variants:[{props:{variant:"outlined"},style:{paddingLeft:11,paddingRight:11}},{props:{size:"small"},style:{paddingLeft:8,paddingRight:8}},{props:{size:"small",variant:"outlined"},style:{paddingLeft:7,paddingRight:7}}]});function isDeleteKeyboardEvent(x){return x.key==="Backspace"||x.key==="Delete"}const Chip=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiChip"}),{avatar:T,className:_,clickable:S,color:R="default",component:A,deleteIcon:O,disabled:H=!1,icon:ee,label:te,onClick:ie,onDelete:ne,onKeyDown:ae,onKeyUp:oe,size:le="medium",variant:fe="filled",tabIndex:de,skipFocusWhenDisabled:ce=!1,slots:pe={},slotProps:he={},...me}=w,ve=reactExports.useRef(null),ye=useForkRef(ve,E),Se=Ve=>{Ve.stopPropagation(),ne&&ne(Ve)},Ce=Ve=>{Ve.currentTarget===Ve.target&&isDeleteKeyboardEvent(Ve)&&Ve.preventDefault(),ae&&ae(Ve)},be=Ve=>{Ve.currentTarget===Ve.target&&ne&&isDeleteKeyboardEvent(Ve)&&ne(Ve),oe&&oe(Ve)},Ee=S!==!1&&ie?!0:S,Ae=Ee||ne?ButtonBase:A||"div",Ie={...w,component:Ae,disabled:H,size:le,color:R,iconColor:reactExports.isValidElement(ee)&&ee.props.color||R,onDelete:!!ne,clickable:Ee,variant:fe},Te=useUtilityClasses$t(Ie),De=Ae===ButtonBase?{component:A||"div",focusVisibleClassName:Te.focusVisible,...ne&&{disableRipple:!0}}:{};let Ue=null;ne&&(Ue=O&&reactExports.isValidElement(O)?reactExports.cloneElement(O,{className:clsx(O.props.className,Te.deleteIcon),onClick:Se}):jsxRuntimeExports.jsx(CancelIcon,{className:Te.deleteIcon,onClick:Se}));let ze=null;T&&reactExports.isValidElement(T)&&(ze=reactExports.cloneElement(T,{className:clsx(Te.avatar,T.props.className)}));let Pe=null;ee&&reactExports.isValidElement(ee)&&(Pe=reactExports.cloneElement(ee,{className:clsx(Te.icon,ee.props.className)}));const $e={slots:pe,slotProps:he},[He,je]=useSlot("root",{elementType:ChipRoot,externalForwardedProps:{...$e,...me},ownerState:Ie,shouldForwardComponentProp:!0,ref:ye,className:clsx(Te.root,_),additionalProps:{disabled:Ee&&H?!0:void 0,tabIndex:ce&&H?-1:de,...De},getSlotProps:Ve=>({...Ve,onClick:Ht=>{Ve.onClick?.(Ht),ie?.(Ht)},onKeyDown:Ht=>{Ve.onKeyDown?.(Ht),Ce?.(Ht)},onKeyUp:Ht=>{Ve.onKeyUp?.(Ht),be?.(Ht)}})}),[Ne,Oe]=useSlot("label",{elementType:ChipLabel,externalForwardedProps:$e,ownerState:Ie,className:Te.label});return jsxRuntimeExports.jsxs(He,{as:Ae,...je,children:[ze||Pe,jsxRuntimeExports.jsx(Ne,{...Oe,children:te}),Ue]})});function getStyleValue(x){return parseInt(x,10)||0}const styles$1={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function isObjectEmpty(x){for(const C in x)return!1;return!0}function isEmpty$1(x){return isObjectEmpty(x)||x.outerHeightStyle===0&&!x.overflowing}const TextareaAutosize=reactExports.forwardRef(function(C,E){const{onChange:w,maxRows:T,minRows:_=1,style:S,value:R,...A}=C,{current:O}=reactExports.useRef(R!=null),H=reactExports.useRef(null),ee=useForkRef(E,H),te=reactExports.useRef(null),ie=reactExports.useRef(null),ne=reactExports.useCallback(()=>{const de=H.current,ce=ie.current;if(!de||!ce)return;const he=ownerWindow(de).getComputedStyle(de);if(he.width==="0px")return{outerHeightStyle:0,overflowing:!1};ce.style.width=he.width,ce.value=de.value||C.placeholder||"x",ce.value.slice(-1)===`
`&&(ce.value+=" ");const me=he.boxSizing,ve=getStyleValue(he.paddingBottom)+getStyleValue(he.paddingTop),ye=getStyleValue(he.borderBottomWidth)+getStyleValue(he.borderTopWidth),Se=ce.scrollHeight;ce.value="x";const Ce=ce.scrollHeight;let be=Se;_&&(be=Math.max(Number(_)*Ce,be)),T&&(be=Math.min(Number(T)*Ce,be)),be=Math.max(be,Ce);const Ee=be+(me==="border-box"?ve+ye:0),Ae=Math.abs(be-Se)<=1;return{outerHeightStyle:Ee,overflowing:Ae}},[T,_,C.placeholder]),ae=useEventCallback(()=>{const de=H.current,ce=ne();if(!de||!ce||isEmpty$1(ce))return!1;const pe=ce.outerHeightStyle;return te.current!=null&&te.current!==pe}),oe=reactExports.useCallback(()=>{const de=H.current,ce=ne();if(!de||!ce||isEmpty$1(ce))return;const pe=ce.outerHeightStyle;te.current!==pe&&(te.current=pe,de.style.height=`${pe}px`),de.style.overflow=ce.overflowing?"hidden":""},[ne]),le=reactExports.useRef(-1);useEnhancedEffect(()=>{const de=debounce(oe),ce=H?.current;if(!ce)return;const pe=ownerWindow(ce);pe.addEventListener("resize",de);let he;return typeof ResizeObserver<"u"&&(he=new ResizeObserver(()=>{ae()&&(he.unobserve(ce),cancelAnimationFrame(le.current),oe(),le.current=requestAnimationFrame(()=>{he.observe(ce)}))}),he.observe(ce)),()=>{de.clear(),cancelAnimationFrame(le.current),pe.removeEventListener("resize",de),he&&he.disconnect()}},[ne,oe,ae]),useEnhancedEffect(()=>{oe()});const fe=de=>{O||oe();const ce=de.target,pe=ce.value.length,he=ce.value.endsWith(`
`),me=ce.selectionStart===pe;he&&me&&ce.setSelectionRange(pe,pe),w&&w(de)};return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx("textarea",{value:R,onChange:fe,ref:ee,rows:_,style:S,...A}),jsxRuntimeExports.jsx("textarea",{"aria-hidden":!0,className:C.className,readOnly:!0,ref:ie,tabIndex:-1,style:{...styles$1.shadow,...S,paddingTop:0,paddingBottom:0}})]})});function isHostComponent(x){return typeof x=="string"}function formControlState({props:x,states:C,muiFormControl:E}){return C.reduce((w,T)=>(w[T]=x[T],E&&typeof x[T]>"u"&&(w[T]=E[T]),w),{})}function hasValue(x){return x!=null&&!(Array.isArray(x)&&x.length===0)}function isFilled(x,C=!1){return x&&(hasValue(x.value)&&x.value!==""||C&&hasValue(x.defaultValue)&&x.defaultValue!=="")}function isAdornedStart(x){return x.startAdornment}function getInputBaseUtilityClass(x){return generateUtilityClass("MuiInputBase",x)}const inputBaseClasses=generateUtilityClasses("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]);var _InputGlobalStyles;const rootOverridesResolver=(x,C)=>{const{ownerState:E}=x;return[C.root,E.formControl&&C.formControl,E.startAdornment&&C.adornedStart,E.endAdornment&&C.adornedEnd,E.error&&C.error,E.size==="small"&&C.sizeSmall,E.multiline&&C.multiline,E.color&&C[`color${capitalize(E.color)}`],E.fullWidth&&C.fullWidth,E.hiddenLabel&&C.hiddenLabel]},inputOverridesResolver=(x,C)=>{const{ownerState:E}=x;return[C.input,E.size==="small"&&C.inputSizeSmall,E.multiline&&C.inputMultiline,E.type==="search"&&C.inputTypeSearch,E.startAdornment&&C.inputAdornedStart,E.endAdornment&&C.inputAdornedEnd,E.hiddenLabel&&C.inputHiddenLabel]},useUtilityClasses$s=x=>{const{classes:C,color:E,disabled:w,error:T,endAdornment:_,focused:S,formControl:R,fullWidth:A,hiddenLabel:O,multiline:H,readOnly:ee,size:te,startAdornment:ie,type:ne}=x,ae={root:["root",`color${capitalize(E)}`,w&&"disabled",T&&"error",A&&"fullWidth",S&&"focused",R&&"formControl",te&&te!=="medium"&&`size${capitalize(te)}`,H&&"multiline",ie&&"adornedStart",_&&"adornedEnd",O&&"hiddenLabel",ee&&"readOnly"],input:["input",w&&"disabled",ne==="search"&&"inputTypeSearch",H&&"inputMultiline",te==="small"&&"inputSizeSmall",O&&"inputHiddenLabel",ie&&"inputAdornedStart",_&&"inputAdornedEnd",ee&&"readOnly"]};return composeClasses(ae,getInputBaseUtilityClass,C)},InputBaseRoot=styled("div",{name:"MuiInputBase",slot:"Root",overridesResolver:rootOverridesResolver})(memoTheme(({theme:x})=>({...x.typography.body1,color:(x.vars||x).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${inputBaseClasses.disabled}`]:{color:(x.vars||x).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:C})=>C.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:C,size:E})=>C.multiline&&E==="small",style:{paddingTop:1}},{props:({ownerState:C})=>C.fullWidth,style:{width:"100%"}}]}))),InputBaseInput=styled("input",{name:"MuiInputBase",slot:"Input",overridesResolver:inputOverridesResolver})(memoTheme(({theme:x})=>{const C=x.palette.mode==="light",E={color:"currentColor",...x.vars?{opacity:x.vars.opacity.inputPlaceholder}:{opacity:C?.42:.5},transition:x.transitions.create("opacity",{duration:x.transitions.duration.shorter})},w={opacity:"0 !important"},T=x.vars?{opacity:x.vars.opacity.inputPlaceholder}:{opacity:C?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":E,"&::-moz-placeholder":E,"&::-ms-input-placeholder":E,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${inputBaseClasses.formControl} &`]:{"&::-webkit-input-placeholder":w,"&::-moz-placeholder":w,"&::-ms-input-placeholder":w,"&:focus::-webkit-input-placeholder":T,"&:focus::-moz-placeholder":T,"&:focus::-ms-input-placeholder":T},[`&.${inputBaseClasses.disabled}`]:{opacity:1,WebkitTextFillColor:(x.vars||x).palette.text.disabled},variants:[{props:({ownerState:_})=>!_.disableInjectingGlobalStyles,style:{animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:_})=>_.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),InputGlobalStyles=globalCss({"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}),InputBase=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiInputBase"}),{"aria-describedby":T,autoComplete:_,autoFocus:S,className:R,color:A,components:O={},componentsProps:H={},defaultValue:ee,disabled:te,disableInjectingGlobalStyles:ie,endAdornment:ne,error:ae,fullWidth:oe=!1,id:le,inputComponent:fe="input",inputProps:de={},inputRef:ce,margin:pe,maxRows:he,minRows:me,multiline:ve=!1,name:ye,onBlur:Se,onChange:Ce,onClick:be,onFocus:Ee,onKeyDown:Ae,onKeyUp:Ie,placeholder:Te,readOnly:De,renderSuffix:Ue,rows:ze,size:Pe,slotProps:$e={},slots:He={},startAdornment:je,type:Ne="text",value:Oe,...Ve}=w,Ht=de.value!=null?de.value:Oe,{current:Kt}=reactExports.useRef(Ht!=null),ir=reactExports.useRef(),$t=reactExports.useCallback(et=>{},[]),tr=useForkRef(ir,ce,de.ref,$t),[ar,gr]=reactExports.useState(!1),er=useFormControl(),sr=formControlState({props:w,muiFormControl:er,states:["color","disabled","error","hiddenLabel","size","required","filled"]});sr.focused=er?er.focused:ar,reactExports.useEffect(()=>{!er&&te&&ar&&(gr(!1),Se&&Se())},[er,te,ar,Se]);const pr=er&&er.onFilled,ur=er&&er.onEmpty,Sr=reactExports.useCallback(et=>{isFilled(et)?pr&&pr():ur&&ur()},[pr,ur]);useEnhancedEffect(()=>{Kt&&Sr({value:Ht})},[Ht,Sr,Kt]);const hr=et=>{Ee&&Ee(et),de.onFocus&&de.onFocus(et),er&&er.onFocus?er.onFocus(et):gr(!0)},yr=et=>{Se&&Se(et),de.onBlur&&de.onBlur(et),er&&er.onBlur?er.onBlur(et):gr(!1)},xr=(et,...Ze)=>{if(!Kt){const Qe=et.target||ir.current;if(Qe==null)throw new Error(formatMuiErrorMessage(1));Sr({value:Qe.value})}de.onChange&&de.onChange(et,...Ze),Ce&&Ce(et,...Ze)};reactExports.useEffect(()=>{Sr(ir.current)},[]);const Yt=et=>{ir.current&&et.currentTarget===et.target&&ir.current.focus(),be&&be(et)};let Jt=fe,mr=de;ve&&Jt==="input"&&(ze?mr={type:void 0,minRows:ze,maxRows:ze,...mr}:mr={type:void 0,maxRows:he,minRows:me,...mr},Jt=TextareaAutosize);const Cr=et=>{Sr(et.animationName==="mui-auto-fill-cancel"?ir.current:{value:"x"})};reactExports.useEffect(()=>{er&&er.setAdornedStart(!!je)},[er,je]);const zt={...w,color:sr.color||"primary",disabled:sr.disabled,endAdornment:ne,error:sr.error,focused:sr.focused,formControl:er,fullWidth:oe,hiddenLabel:sr.hiddenLabel,multiline:ve,size:sr.size,startAdornment:je,type:Ne},Ft=useUtilityClasses$s(zt),kt=He.root||O.Root||InputBaseRoot,ke=$e.root||H.root||{},Be=He.input||O.Input||InputBaseInput;return mr={...mr,...$e.input??H.input},jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[!ie&&typeof InputGlobalStyles=="function"&&(_InputGlobalStyles||(_InputGlobalStyles=jsxRuntimeExports.jsx(InputGlobalStyles,{}))),jsxRuntimeExports.jsxs(kt,{...ke,ref:E,onClick:Yt,...Ve,...!isHostComponent(kt)&&{ownerState:{...zt,...ke.ownerState}},className:clsx(Ft.root,ke.className,R,De&&"MuiInputBase-readOnly"),children:[je,jsxRuntimeExports.jsx(FormControlContext.Provider,{value:null,children:jsxRuntimeExports.jsx(Be,{"aria-invalid":sr.error,"aria-describedby":T,autoComplete:_,autoFocus:S,defaultValue:ee,disabled:sr.disabled,id:le,onAnimationStart:Cr,name:ye,placeholder:Te,readOnly:De,required:sr.required,rows:ze,value:Ht,onKeyDown:Ae,onKeyUp:Ie,type:Ne,...mr,...!isHostComponent(Be)&&{as:Jt,ownerState:{...zt,...mr.ownerState}},ref:tr,className:clsx(Ft.input,mr.className,De&&"MuiInputBase-readOnly"),onBlur:yr,onChange:xr,onFocus:hr})}),ne,Ue?Ue({...sr,startAdornment:je}):null]})]})});function getInputUtilityClass(x){return generateUtilityClass("MuiInput",x)}const inputClasses={...inputBaseClasses,...generateUtilityClasses("MuiInput",["root","underline","input"])};function getOutlinedInputUtilityClass(x){return generateUtilityClass("MuiOutlinedInput",x)}const outlinedInputClasses={...inputBaseClasses,...generateUtilityClasses("MuiOutlinedInput",["root","notchedOutline","input"])};function getFilledInputUtilityClass(x){return generateUtilityClass("MuiFilledInput",x)}const filledInputClasses={...inputBaseClasses,...generateUtilityClasses("MuiFilledInput",["root","underline","input","adornedStart","adornedEnd","sizeSmall","multiline","hiddenLabel"])},ArrowDropDownIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})),styles={entering:{opacity:1},entered:{opacity:1}},Fade=reactExports.forwardRef(function(C,E){const w=useTheme(),T={enter:w.transitions.duration.enteringScreen,exit:w.transitions.duration.leavingScreen},{addEndListener:_,appear:S=!0,children:R,easing:A,in:O,onEnter:H,onEntered:ee,onEntering:te,onExit:ie,onExited:ne,onExiting:ae,style:oe,timeout:le=T,TransitionComponent:fe=Transition,...de}=C,ce=reactExports.useRef(null),pe=useForkRef(ce,getReactElementRef(R),E),he=Ae=>Ie=>{if(Ae){const Te=ce.current;Ie===void 0?Ae(Te):Ae(Te,Ie)}},me=he(te),ve=he((Ae,Ie)=>{reflow(Ae);const Te=getTransitionProps({style:oe,timeout:le,easing:A},{mode:"enter"});Ae.style.webkitTransition=w.transitions.create("opacity",Te),Ae.style.transition=w.transitions.create("opacity",Te),H&&H(Ae,Ie)}),ye=he(ee),Se=he(ae),Ce=he(Ae=>{const Ie=getTransitionProps({style:oe,timeout:le,easing:A},{mode:"exit"});Ae.style.webkitTransition=w.transitions.create("opacity",Ie),Ae.style.transition=w.transitions.create("opacity",Ie),ie&&ie(Ae)}),be=he(ne),Ee=Ae=>{_&&_(ce.current,Ae)};return jsxRuntimeExports.jsx(fe,{appear:S,in:O,nodeRef:ce,onEnter:ve,onEntered:ye,onEntering:me,onExit:Ce,onExited:be,onExiting:Se,addEndListener:Ee,timeout:le,...de,children:(Ae,{ownerState:Ie,...Te})=>reactExports.cloneElement(R,{style:{opacity:0,visibility:Ae==="exited"&&!O?"hidden":void 0,...styles[Ae],...oe,...R.props.style},ref:pe,...Te})})});function getBackdropUtilityClass(x){return generateUtilityClass("MuiBackdrop",x)}generateUtilityClasses("MuiBackdrop",["root","invisible"]);const useUtilityClasses$r=x=>{const{classes:C,invisible:E}=x;return composeClasses({root:["root",E&&"invisible"]},getBackdropUtilityClass,C)},BackdropRoot=styled("div",{name:"MuiBackdrop",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.invisible&&C.invisible]}})({position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",right:0,bottom:0,top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.5)",WebkitTapHighlightColor:"transparent",variants:[{props:{invisible:!0},style:{backgroundColor:"transparent"}}]}),Backdrop=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiBackdrop"}),{children:T,className:_,component:S="div",invisible:R=!1,open:A,components:O={},componentsProps:H={},slotProps:ee={},slots:te={},TransitionComponent:ie,transitionDuration:ne,...ae}=w,oe={...w,component:S,invisible:R},le=useUtilityClasses$r(oe),fe={transition:ie,root:O.Root,...te},de={...H,...ee},ce={component:S,slots:fe,slotProps:de},[pe,he]=useSlot("root",{elementType:BackdropRoot,externalForwardedProps:ce,className:clsx(le.root,_),ownerState:oe}),[me,ve]=useSlot("transition",{elementType:Fade,externalForwardedProps:ce,ownerState:oe});return jsxRuntimeExports.jsx(me,{in:A,timeout:ne,...ae,...ve,children:jsxRuntimeExports.jsx(pe,{"aria-hidden":!0,...he,classes:le,ref:E,children:T})})}),boxClasses=generateUtilityClasses("MuiBox",["root"]),defaultTheme=createTheme(),Box=createBox({themeId:THEME_ID,defaultTheme,defaultClassName:boxClasses.root,generateClassName:ClassNameGenerator.generate});function getButtonUtilityClass(x){return generateUtilityClass("MuiButton",x)}const buttonClasses=generateUtilityClasses("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge","loading","loadingWrapper","loadingIconPlaceholder","loadingIndicator","loadingPositionCenter","loadingPositionStart","loadingPositionEnd"]),ButtonGroupContext=reactExports.createContext({}),ButtonGroupButtonContext=reactExports.createContext(void 0),useUtilityClasses$q=x=>{const{color:C,disableElevation:E,fullWidth:w,size:T,variant:_,loading:S,loadingPosition:R,classes:A}=x,O={root:["root",S&&"loading",_,`${_}${capitalize(C)}`,`size${capitalize(T)}`,`${_}Size${capitalize(T)}`,`color${capitalize(C)}`,E&&"disableElevation",w&&"fullWidth",S&&`loadingPosition${capitalize(R)}`],startIcon:["icon","startIcon",`iconSize${capitalize(T)}`],endIcon:["icon","endIcon",`iconSize${capitalize(T)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]},H=composeClasses(O,getButtonUtilityClass,A);return{...A,...H}},commonIconStyles=[{props:{size:"small"},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:"medium"},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:"large"},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],ButtonRoot=styled(ButtonBase,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiButton",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,C[E.variant],C[`${E.variant}${capitalize(E.color)}`],C[`size${capitalize(E.size)}`],C[`${E.variant}Size${capitalize(E.size)}`],E.color==="inherit"&&C.colorInherit,E.disableElevation&&C.disableElevation,E.fullWidth&&C.fullWidth,E.loading&&C.loading]}})(memoTheme(({theme:x})=>{const C=x.palette.mode==="light"?x.palette.grey[300]:x.palette.grey[800],E=x.palette.mode==="light"?x.palette.grey.A100:x.palette.grey[700];return{...x.typography.button,minWidth:64,padding:"6px 16px",border:0,borderRadius:(x.vars||x).shape.borderRadius,transition:x.transitions.create(["background-color","box-shadow","border-color","color"],{duration:x.transitions.duration.short}),"&:hover":{textDecoration:"none"},[`&.${buttonClasses.disabled}`]:{color:(x.vars||x).palette.action.disabled},variants:[{props:{variant:"contained"},style:{color:"var(--variant-containedColor)",backgroundColor:"var(--variant-containedBg)",boxShadow:(x.vars||x).shadows[2],"&:hover":{boxShadow:(x.vars||x).shadows[4],"@media (hover: none)":{boxShadow:(x.vars||x).shadows[2]}},"&:active":{boxShadow:(x.vars||x).shadows[8]},[`&.${buttonClasses.focusVisible}`]:{boxShadow:(x.vars||x).shadows[6]},[`&.${buttonClasses.disabled}`]:{color:(x.vars||x).palette.action.disabled,boxShadow:(x.vars||x).shadows[0],backgroundColor:(x.vars||x).palette.action.disabledBackground}}},{props:{variant:"outlined"},style:{padding:"5px 15px",border:"1px solid currentColor",borderColor:"var(--variant-outlinedBorder, currentColor)",backgroundColor:"var(--variant-outlinedBg)",color:"var(--variant-outlinedColor)",[`&.${buttonClasses.disabled}`]:{border:`1px solid ${(x.vars||x).palette.action.disabledBackground}`}}},{props:{variant:"text"},style:{padding:"6px 8px",color:"var(--variant-textColor)",backgroundColor:"var(--variant-textBg)"}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([w])=>({props:{color:w},style:{"--variant-textColor":(x.vars||x).palette[w].main,"--variant-outlinedColor":(x.vars||x).palette[w].main,"--variant-outlinedBorder":x.alpha((x.vars||x).palette[w].main,.5),"--variant-containedColor":(x.vars||x).palette[w].contrastText,"--variant-containedBg":(x.vars||x).palette[w].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(x.vars||x).palette[w].dark,"--variant-textBg":x.alpha((x.vars||x).palette[w].main,(x.vars||x).palette.action.hoverOpacity),"--variant-outlinedBorder":(x.vars||x).palette[w].main,"--variant-outlinedBg":x.alpha((x.vars||x).palette[w].main,(x.vars||x).palette.action.hoverOpacity)}}}})),{props:{color:"inherit"},style:{color:"inherit",borderColor:"currentColor","--variant-containedBg":x.vars?x.vars.palette.Button.inheritContainedBg:C,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":x.vars?x.vars.palette.Button.inheritContainedHoverBg:E,"--variant-textBg":x.alpha((x.vars||x).palette.text.primary,(x.vars||x).palette.action.hoverOpacity),"--variant-outlinedBg":x.alpha((x.vars||x).palette.text.primary,(x.vars||x).palette.action.hoverOpacity)}}}},{props:{size:"small",variant:"text"},style:{padding:"4px 5px",fontSize:x.typography.pxToRem(13)}},{props:{size:"large",variant:"text"},style:{padding:"8px 11px",fontSize:x.typography.pxToRem(15)}},{props:{size:"small",variant:"outlined"},style:{padding:"3px 9px",fontSize:x.typography.pxToRem(13)}},{props:{size:"large",variant:"outlined"},style:{padding:"7px 21px",fontSize:x.typography.pxToRem(15)}},{props:{size:"small",variant:"contained"},style:{padding:"4px 10px",fontSize:x.typography.pxToRem(13)}},{props:{size:"large",variant:"contained"},style:{padding:"8px 22px",fontSize:x.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${buttonClasses.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${buttonClasses.disabled}`]:{boxShadow:"none"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{loadingPosition:"center"},style:{transition:x.transitions.create(["background-color","box-shadow","border-color"],{duration:x.transitions.duration.short}),[`&.${buttonClasses.loading}`]:{color:"transparent"}}}]}})),ButtonStartIcon=styled("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.startIcon,E.loading&&C.startIconLoadingStart,C[`iconSize${capitalize(E.size)}`]]}})(({theme:x})=>({display:"inherit",marginRight:8,marginLeft:-4,variants:[{props:{size:"small"},style:{marginLeft:-2}},{props:{loadingPosition:"start",loading:!0},style:{transition:x.transitions.create(["opacity"],{duration:x.transitions.duration.short}),opacity:0}},{props:{loadingPosition:"start",loading:!0,fullWidth:!0},style:{marginRight:-8}},...commonIconStyles]})),ButtonEndIcon=styled("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.endIcon,E.loading&&C.endIconLoadingEnd,C[`iconSize${capitalize(E.size)}`]]}})(({theme:x})=>({display:"inherit",marginRight:-4,marginLeft:8,variants:[{props:{size:"small"},style:{marginRight:-2}},{props:{loadingPosition:"end",loading:!0},style:{transition:x.transitions.create(["opacity"],{duration:x.transitions.duration.short}),opacity:0}},{props:{loadingPosition:"end",loading:!0,fullWidth:!0},style:{marginLeft:-8}},...commonIconStyles]})),ButtonLoadingIndicator=styled("span",{name:"MuiButton",slot:"LoadingIndicator"})(({theme:x})=>({display:"none",position:"absolute",visibility:"visible",variants:[{props:{loading:!0},style:{display:"flex"}},{props:{loadingPosition:"start"},style:{left:14}},{props:{loadingPosition:"start",size:"small"},style:{left:10}},{props:{variant:"text",loadingPosition:"start"},style:{left:6}},{props:{loadingPosition:"center"},style:{left:"50%",transform:"translate(-50%)",color:(x.vars||x).palette.action.disabled}},{props:{loadingPosition:"end"},style:{right:14}},{props:{loadingPosition:"end",size:"small"},style:{right:10}},{props:{variant:"text",loadingPosition:"end"},style:{right:6}},{props:{loadingPosition:"start",fullWidth:!0},style:{position:"relative",left:-10}},{props:{loadingPosition:"end",fullWidth:!0},style:{position:"relative",right:-10}}]})),ButtonLoadingIconPlaceholder=styled("span",{name:"MuiButton",slot:"LoadingIconPlaceholder"})({display:"inline-block",width:"1em",height:"1em"}),Button=reactExports.forwardRef(function(C,E){const w=reactExports.useContext(ButtonGroupContext),T=reactExports.useContext(ButtonGroupButtonContext),_=resolveProps(w,C),S=useDefaultProps({props:_,name:"MuiButton"}),{children:R,color:A="primary",component:O="button",className:H,disabled:ee=!1,disableElevation:te=!1,disableFocusRipple:ie=!1,endIcon:ne,focusVisibleClassName:ae,fullWidth:oe=!1,id:le,loading:fe=null,loadingIndicator:de,loadingPosition:ce="center",size:pe="medium",startIcon:he,type:me,variant:ve="text",...ye}=S,Se=useId(le),Ce=de??jsxRuntimeExports.jsx(CircularProgress,{"aria-labelledby":Se,color:"inherit",size:16}),be={...S,color:A,component:O,disabled:ee,disableElevation:te,disableFocusRipple:ie,fullWidth:oe,loading:fe,loadingIndicator:Ce,loadingPosition:ce,size:pe,type:me,variant:ve},Ee=useUtilityClasses$q(be),Ae=(he||fe&&ce==="start")&&jsxRuntimeExports.jsx(ButtonStartIcon,{className:Ee.startIcon,ownerState:be,children:he||jsxRuntimeExports.jsx(ButtonLoadingIconPlaceholder,{className:Ee.loadingIconPlaceholder,ownerState:be})}),Ie=(ne||fe&&ce==="end")&&jsxRuntimeExports.jsx(ButtonEndIcon,{className:Ee.endIcon,ownerState:be,children:ne||jsxRuntimeExports.jsx(ButtonLoadingIconPlaceholder,{className:Ee.loadingIconPlaceholder,ownerState:be})}),Te=T||"",De=typeof fe=="boolean"?jsxRuntimeExports.jsx("span",{className:Ee.loadingWrapper,style:{display:"contents"},children:fe&&jsxRuntimeExports.jsx(ButtonLoadingIndicator,{className:Ee.loadingIndicator,ownerState:be,children:Ce})}):null;return jsxRuntimeExports.jsxs(ButtonRoot,{ownerState:be,className:clsx(w.className,Ee.root,H,Te),component:O,disabled:ee||fe,focusRipple:!ie,focusVisibleClassName:clsx(Ee.focusVisible,ae),ref:E,type:me,id:fe?Se:le,...ye,classes:Ee,children:[Ae,ce!=="end"&&De,R,ce==="end"&&De,Ie]})});function getValidReactChildren(x){return reactExports.Children.toArray(x).filter(C=>reactExports.isValidElement(C))}function getButtonGroupUtilityClass(x){return generateUtilityClass("MuiButtonGroup",x)}const buttonGroupClasses=generateUtilityClasses("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","horizontal","vertical","colorPrimary","colorSecondary","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]),overridesResolver$2=(x,C)=>{const{ownerState:E}=x;return[{[`& .${buttonGroupClasses.grouped}`]:C.grouped},{[`& .${buttonGroupClasses.grouped}`]:C[`grouped${capitalize(E.orientation)}`]},{[`& .${buttonGroupClasses.grouped}`]:C[`grouped${capitalize(E.variant)}`]},{[`& .${buttonGroupClasses.grouped}`]:C[`grouped${capitalize(E.variant)}${capitalize(E.orientation)}`]},{[`& .${buttonGroupClasses.grouped}`]:C[`grouped${capitalize(E.variant)}${capitalize(E.color)}`]},{[`& .${buttonGroupClasses.firstButton}`]:C.firstButton},{[`& .${buttonGroupClasses.lastButton}`]:C.lastButton},{[`& .${buttonGroupClasses.middleButton}`]:C.middleButton},C.root,C[E.variant],E.disableElevation===!0&&C.disableElevation,E.fullWidth&&C.fullWidth,E.orientation==="vertical"&&C.vertical]},useUtilityClasses$p=x=>{const{classes:C,color:E,disabled:w,disableElevation:T,fullWidth:_,orientation:S,variant:R}=x,A={root:["root",R,S,_&&"fullWidth",T&&"disableElevation",`color${capitalize(E)}`],grouped:["grouped",`grouped${capitalize(S)}`,`grouped${capitalize(R)}`,`grouped${capitalize(R)}${capitalize(S)}`,`grouped${capitalize(R)}${capitalize(E)}`,w&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return composeClasses(A,getButtonGroupUtilityClass,C)},ButtonGroupRoot=styled("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:overridesResolver$2})(memoTheme(({theme:x})=>({display:"inline-flex",borderRadius:(x.vars||x).shape.borderRadius,variants:[{props:{variant:"contained"},style:{boxShadow:(x.vars||x).shadows[2]}},{props:{disableElevation:!0},style:{boxShadow:"none"}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${buttonGroupClasses.lastButton},& .${buttonGroupClasses.middleButton}`]:{borderTopRightRadius:0,borderTopLeftRadius:0},[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderBottomRightRadius:0,borderBottomLeftRadius:0}}},{props:{orientation:"horizontal"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${buttonGroupClasses.lastButton},& .${buttonGroupClasses.middleButton}`]:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}},{props:{variant:"text",orientation:"horizontal"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderRight:x.vars?`1px solid ${x.alpha(x.vars.palette.common.onBackground,.23)}`:`1px solid ${x.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${buttonGroupClasses.disabled}`]:{borderRight:`1px solid ${(x.vars||x).palette.action.disabled}`}}}},{props:{variant:"text",orientation:"vertical"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderBottom:x.vars?`1px solid ${x.alpha(x.vars.palette.common.onBackground,.23)}`:`1px solid ${x.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${buttonGroupClasses.disabled}`]:{borderBottom:`1px solid ${(x.vars||x).palette.action.disabled}`}}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).flatMap(([C])=>[{props:{variant:"text",color:C},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderColor:x.alpha((x.vars||x).palette[C].main,.5)}}}]),{props:{variant:"outlined",orientation:"horizontal"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderRightColor:"transparent","&:hover":{borderRightColor:"currentColor"}},[`& .${buttonGroupClasses.lastButton},& .${buttonGroupClasses.middleButton}`]:{marginLeft:-1}}},{props:{variant:"outlined",orientation:"vertical"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderBottomColor:"transparent","&:hover":{borderBottomColor:"currentColor"}},[`& .${buttonGroupClasses.lastButton},& .${buttonGroupClasses.middleButton}`]:{marginTop:-1}}},{props:{variant:"contained",orientation:"horizontal"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderRight:`1px solid ${(x.vars||x).palette.grey[400]}`,[`&.${buttonGroupClasses.disabled}`]:{borderRight:`1px solid ${(x.vars||x).palette.action.disabled}`}}}},{props:{variant:"contained",orientation:"vertical"},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderBottom:`1px solid ${(x.vars||x).palette.grey[400]}`,[`&.${buttonGroupClasses.disabled}`]:{borderBottom:`1px solid ${(x.vars||x).palette.action.disabled}`}}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["dark"])).map(([C])=>({props:{variant:"contained",color:C},style:{[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]:{borderColor:(x.vars||x).palette[C].dark}}}))],[`& .${buttonGroupClasses.grouped}`]:{minWidth:40,boxShadow:"none",props:{variant:"contained"},style:{"&:hover":{boxShadow:"none"}}}}))),ButtonGroup=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiButtonGroup"}),{children:T,className:_,color:S="primary",component:R="div",disabled:A=!1,disableElevation:O=!1,disableFocusRipple:H=!1,disableRipple:ee=!1,fullWidth:te=!1,orientation:ie="horizontal",size:ne="medium",variant:ae="outlined",...oe}=w,le={...w,color:S,component:R,disabled:A,disableElevation:O,disableFocusRipple:H,disableRipple:ee,fullWidth:te,orientation:ie,size:ne,variant:ae},fe=useUtilityClasses$p(le),de=reactExports.useMemo(()=>({className:fe.grouped,color:S,disabled:A,disableElevation:O,disableFocusRipple:H,disableRipple:ee,fullWidth:te,size:ne,variant:ae}),[S,A,O,H,ee,te,ne,ae,fe.grouped]),ce=getValidReactChildren(T),pe=ce.length,he=me=>{const ve=me===0,ye=me===pe-1;return ve&&ye?"":ve?fe.firstButton:ye?fe.lastButton:fe.middleButton};return jsxRuntimeExports.jsx(ButtonGroupRoot,{as:R,role:"group",className:clsx(fe.root,_),ref:E,ownerState:le,...oe,children:jsxRuntimeExports.jsx(ButtonGroupContext.Provider,{value:de,children:ce.map((me,ve)=>jsxRuntimeExports.jsx(ButtonGroupButtonContext.Provider,{value:he(ve),children:me},ve))})})}),CheckBoxOutlineBlankIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),CheckBoxIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),IndeterminateCheckBoxIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function getCheckboxUtilityClass(x){return generateUtilityClass("MuiCheckbox",x)}const checkboxClasses=generateUtilityClasses("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),useUtilityClasses$o=x=>{const{classes:C,indeterminate:E,color:w,size:T}=x,_={root:["root",E&&"indeterminate",`color${capitalize(w)}`,`size${capitalize(T)}`]},S=composeClasses(_,getCheckboxUtilityClass,C);return{...C,...S}},CheckboxRoot=styled(SwitchBase,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.indeterminate&&C.indeterminate,C[`size${capitalize(E.size)}`],E.color!=="default"&&C[`color${capitalize(E.color)}`]]}})(memoTheme(({theme:x})=>({color:(x.vars||x).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:x.alpha((x.vars||x).palette.action.active,(x.vars||x).palette.action.hoverOpacity)}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C,disableRipple:!1},style:{"&:hover":{backgroundColor:x.alpha((x.vars||x).palette[C].main,(x.vars||x).palette.action.hoverOpacity)}}})),...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{[`&.${checkboxClasses.checked}, &.${checkboxClasses.indeterminate}`]:{color:(x.vars||x).palette[C].main},[`&.${checkboxClasses.disabled}`]:{color:(x.vars||x).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),defaultCheckedIcon=jsxRuntimeExports.jsx(CheckBoxIcon,{}),defaultIcon=jsxRuntimeExports.jsx(CheckBoxOutlineBlankIcon,{}),defaultIndeterminateIcon=jsxRuntimeExports.jsx(IndeterminateCheckBoxIcon,{}),Checkbox=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiCheckbox"}),{checkedIcon:T=defaultCheckedIcon,color:_="primary",icon:S=defaultIcon,indeterminate:R=!1,indeterminateIcon:A=defaultIndeterminateIcon,inputProps:O,size:H="medium",disableRipple:ee=!1,className:te,slots:ie={},slotProps:ne={},...ae}=w,oe=R?A:S,le=R?A:T,fe={...w,disableRipple:ee,color:_,indeterminate:R,size:H},de=useUtilityClasses$o(fe),ce=ne.input??O,[pe,he]=useSlot("root",{ref:E,elementType:CheckboxRoot,className:clsx(de.root,te),shouldForwardComponentProp:!0,externalForwardedProps:{slots:ie,slotProps:ne,...ae},ownerState:fe,additionalProps:{type:"checkbox",icon:reactExports.cloneElement(oe,{fontSize:oe.props.fontSize??H}),checkedIcon:reactExports.cloneElement(le,{fontSize:le.props.fontSize??H}),disableRipple:ee,slots:ie,slotProps:{input:mergeSlotProps(typeof ce=="function"?ce(fe):ce,{"data-indeterminate":R})}}});return jsxRuntimeExports.jsx(pe,{...he,classes:de})});function getScrollbarSize(x=window){const C=x.document.documentElement.clientWidth;return x.innerWidth-C}function isOverflowing(x){const C=ownerDocument(x);return C.body===x?ownerWindow(x).innerWidth>C.documentElement.clientWidth:x.scrollHeight>x.clientHeight}function ariaHidden(x,C){C?x.setAttribute("aria-hidden","true"):x.removeAttribute("aria-hidden")}function getPaddingRight(x){return parseInt(ownerWindow(x).getComputedStyle(x).paddingRight,10)||0}function isAriaHiddenForbiddenOnElement(x){const E=["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].includes(x.tagName),w=x.tagName==="INPUT"&&x.getAttribute("type")==="hidden";return E||w}function ariaHiddenSiblings(x,C,E,w,T){const _=[C,E,...w];[].forEach.call(x.children,S=>{const R=!_.includes(S),A=!isAriaHiddenForbiddenOnElement(S);R&&A&&ariaHidden(S,T)})}function findIndexOf(x,C){let E=-1;return x.some((w,T)=>C(w)?(E=T,!0):!1),E}function handleContainer(x,C){const E=[],w=x.container;if(!C.disableScrollLock){if(isOverflowing(w)){const S=getScrollbarSize(ownerWindow(w));E.push({value:w.style.paddingRight,property:"padding-right",el:w}),w.style.paddingRight=`${getPaddingRight(w)+S}px`;const R=ownerDocument(w).querySelectorAll(".mui-fixed");[].forEach.call(R,A=>{E.push({value:A.style.paddingRight,property:"padding-right",el:A}),A.style.paddingRight=`${getPaddingRight(A)+S}px`})}let _;if(w.parentNode instanceof DocumentFragment)_=ownerDocument(w).body;else{const S=w.parentElement,R=ownerWindow(w);_=S?.nodeName==="HTML"&&R.getComputedStyle(S).overflowY==="scroll"?S:w}E.push({value:_.style.overflow,property:"overflow",el:_},{value:_.style.overflowX,property:"overflow-x",el:_},{value:_.style.overflowY,property:"overflow-y",el:_}),_.style.overflow="hidden"}return()=>{E.forEach(({value:_,el:S,property:R})=>{_?S.style.setProperty(R,_):S.style.removeProperty(R)})}}function getHiddenSiblings(x){const C=[];return[].forEach.call(x.children,E=>{E.getAttribute("aria-hidden")==="true"&&C.push(E)}),C}class ModalManager{constructor(){this.modals=[],this.containers=[]}add(C,E){let w=this.modals.indexOf(C);if(w!==-1)return w;w=this.modals.length,this.modals.push(C),C.modalRef&&ariaHidden(C.modalRef,!1);const T=getHiddenSiblings(E);ariaHiddenSiblings(E,C.mount,C.modalRef,T,!0);const _=findIndexOf(this.containers,S=>S.container===E);return _!==-1?(this.containers[_].modals.push(C),w):(this.containers.push({modals:[C],container:E,restore:null,hiddenSiblings:T}),w)}mount(C,E){const w=findIndexOf(this.containers,_=>_.modals.includes(C)),T=this.containers[w];T.restore||(T.restore=handleContainer(T,E))}remove(C,E=!0){const w=this.modals.indexOf(C);if(w===-1)return w;const T=findIndexOf(this.containers,S=>S.modals.includes(C)),_=this.containers[T];if(_.modals.splice(_.modals.indexOf(C),1),this.modals.splice(w,1),_.modals.length===0)_.restore&&_.restore(),C.modalRef&&ariaHidden(C.modalRef,E),ariaHiddenSiblings(_.container,C.mount,C.modalRef,_.hiddenSiblings,!1),this.containers.splice(T,1);else{const S=_.modals[_.modals.length-1];S.modalRef&&ariaHidden(S.modalRef,!1)}return w}isTopModal(C){return this.modals.length>0&&this.modals[this.modals.length-1]===C}}const candidatesSelector=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])'].join(",");function getTabIndex(x){const C=parseInt(x.getAttribute("tabindex")||"",10);return Number.isNaN(C)?x.contentEditable==="true"||(x.nodeName==="AUDIO"||x.nodeName==="VIDEO"||x.nodeName==="DETAILS")&&x.getAttribute("tabindex")===null?0:x.tabIndex:C}function isNonTabbableRadio(x){if(x.tagName!=="INPUT"||x.type!=="radio"||!x.name)return!1;const C=w=>x.ownerDocument.querySelector(`input[type="radio"]${w}`);let E=C(`[name="${x.name}"]:checked`);return E||(E=C(`[name="${x.name}"]`)),E!==x}function isNodeMatchingSelectorFocusable(x){return!(x.disabled||x.tagName==="INPUT"&&x.type==="hidden"||isNonTabbableRadio(x))}function defaultGetTabbable(x){const C=[],E=[];return Array.from(x.querySelectorAll(candidatesSelector)).forEach((w,T)=>{const _=getTabIndex(w);_===-1||!isNodeMatchingSelectorFocusable(w)||(_===0?C.push(w):E.push({documentOrder:T,tabIndex:_,node:w}))}),E.sort((w,T)=>w.tabIndex===T.tabIndex?w.documentOrder-T.documentOrder:w.tabIndex-T.tabIndex).map(w=>w.node).concat(C)}function defaultIsEnabled(){return!0}function FocusTrap(x){const{children:C,disableAutoFocus:E=!1,disableEnforceFocus:w=!1,disableRestoreFocus:T=!1,getTabbable:_=defaultGetTabbable,isEnabled:S=defaultIsEnabled,open:R}=x,A=reactExports.useRef(!1),O=reactExports.useRef(null),H=reactExports.useRef(null),ee=reactExports.useRef(null),te=reactExports.useRef(null),ie=reactExports.useRef(!1),ne=reactExports.useRef(null),ae=useForkRef(getReactElementRef(C),ne),oe=reactExports.useRef(null);reactExports.useEffect(()=>{!R||!ne.current||(ie.current=!E)},[E,R]),reactExports.useEffect(()=>{if(!R||!ne.current)return;const de=ownerDocument(ne.current);return ne.current.contains(de.activeElement)||(ne.current.hasAttribute("tabIndex")||ne.current.setAttribute("tabIndex","-1"),ie.current&&ne.current.focus()),()=>{T||(ee.current&&ee.current.focus&&(A.current=!0,ee.current.focus()),ee.current=null)}},[R]),reactExports.useEffect(()=>{if(!R||!ne.current)return;const de=ownerDocument(ne.current),ce=me=>{oe.current=me,!(w||!S()||me.key!=="Tab")&&de.activeElement===ne.current&&me.shiftKey&&(A.current=!0,H.current&&H.current.focus())},pe=()=>{const me=ne.current;if(me===null)return;if(!de.hasFocus()||!S()||A.current){A.current=!1;return}if(me.contains(de.activeElement)||w&&de.activeElement!==O.current&&de.activeElement!==H.current)return;if(de.activeElement!==te.current)te.current=null;else if(te.current!==null)return;if(!ie.current)return;let ve=[];if((de.activeElement===O.current||de.activeElement===H.current)&&(ve=_(ne.current)),ve.length>0){const ye=!!(oe.current?.shiftKey&&oe.current?.key==="Tab"),Se=ve[0],Ce=ve[ve.length-1];typeof Se!="string"&&typeof Ce!="string"&&(ye?Ce.focus():Se.focus())}else me.focus()};de.addEventListener("focusin",pe),de.addEventListener("keydown",ce,!0);const he=setInterval(()=>{de.activeElement&&de.activeElement.tagName==="BODY"&&pe()},50);return()=>{clearInterval(he),de.removeEventListener("focusin",pe),de.removeEventListener("keydown",ce,!0)}},[E,w,T,S,R,_]);const le=de=>{ee.current===null&&(ee.current=de.relatedTarget),ie.current=!0,te.current=de.target;const ce=C.props.onFocus;ce&&ce(de)},fe=de=>{ee.current===null&&(ee.current=de.relatedTarget),ie.current=!0};return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{tabIndex:R?0:-1,onFocus:fe,ref:O,"data-testid":"sentinelStart"}),reactExports.cloneElement(C,{ref:ae,onFocus:le}),jsxRuntimeExports.jsx("div",{tabIndex:R?0:-1,onFocus:fe,ref:H,"data-testid":"sentinelEnd"})]})}function getContainer(x){return typeof x=="function"?x():x}function getHasTransition(x){return x?x.props.hasOwnProperty("in"):!1}const noop$1=()=>{},manager=new ModalManager;function useModal(x){const{container:C,disableEscapeKeyDown:E=!1,disableScrollLock:w=!1,closeAfterTransition:T=!1,onTransitionEnter:_,onTransitionExited:S,children:R,onClose:A,open:O,rootRef:H}=x,ee=reactExports.useRef({}),te=reactExports.useRef(null),ie=reactExports.useRef(null),ne=useForkRef(ie,H),[ae,oe]=reactExports.useState(!O),le=getHasTransition(R);let fe=!0;(x["aria-hidden"]==="false"||x["aria-hidden"]===!1)&&(fe=!1);const de=()=>ownerDocument(te.current),ce=()=>(ee.current.modalRef=ie.current,ee.current.mount=te.current,ee.current),pe=()=>{manager.mount(ce(),{disableScrollLock:w}),ie.current&&(ie.current.scrollTop=0)},he=useEventCallback(()=>{const Ie=getContainer(C)||de().body;manager.add(ce(),Ie),ie.current&&pe()}),me=()=>manager.isTopModal(ce()),ve=useEventCallback(Ie=>{te.current=Ie,Ie&&(O&&me()?pe():ie.current&&ariaHidden(ie.current,fe))}),ye=reactExports.useCallback(()=>{manager.remove(ce(),fe)},[fe]);reactExports.useEffect(()=>()=>{ye()},[ye]),reactExports.useEffect(()=>{O?he():(!le||!T)&&ye()},[O,ye,le,T,he]);const Se=Ie=>Te=>{Ie.onKeyDown?.(Te),!(Te.key!=="Escape"||Te.which===229||!me())&&(E||(Te.stopPropagation(),A&&A(Te,"escapeKeyDown")))},Ce=Ie=>Te=>{Ie.onClick?.(Te),Te.target===Te.currentTarget&&A&&A(Te,"backdropClick")};return{getRootProps:(Ie={})=>{const Te=extractEventHandlers(x);delete Te.onTransitionEnter,delete Te.onTransitionExited;const De={...Te,...Ie};return{role:"presentation",...De,onKeyDown:Se(De),ref:ne}},getBackdropProps:(Ie={})=>{const Te=Ie;return{"aria-hidden":!0,...Te,onClick:Ce(Te),open:O}},getTransitionProps:()=>{const Ie=()=>{oe(!1),_&&_()},Te=()=>{oe(!0),S&&S(),T&&ye()};return{onEnter:createChainedFunction(Ie,R?.props.onEnter??noop$1),onExited:createChainedFunction(Te,R?.props.onExited??noop$1)}},rootRef:ne,portalRef:ve,isTopModal:me,exited:ae,hasTransition:le}}function getModalUtilityClass(x){return generateUtilityClass("MuiModal",x)}generateUtilityClasses("MuiModal",["root","hidden","backdrop"]);const useUtilityClasses$n=x=>{const{open:C,exited:E,classes:w}=x;return composeClasses({root:["root",!C&&E&&"hidden"],backdrop:["backdrop"]},getModalUtilityClass,w)},ModalRoot=styled("div",{name:"MuiModal",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,!E.open&&E.exited&&C.hidden]}})(memoTheme(({theme:x})=>({position:"fixed",zIndex:(x.vars||x).zIndex.modal,right:0,bottom:0,top:0,left:0,variants:[{props:({ownerState:C})=>!C.open&&C.exited,style:{visibility:"hidden"}}]}))),ModalBackdrop=styled(Backdrop,{name:"MuiModal",slot:"Backdrop"})({zIndex:-1}),Modal=reactExports.forwardRef(function(C,E){const w=useDefaultProps({name:"MuiModal",props:C}),{BackdropComponent:T=ModalBackdrop,BackdropProps:_,classes:S,className:R,closeAfterTransition:A=!1,children:O,container:H,component:ee,components:te={},componentsProps:ie={},disableAutoFocus:ne=!1,disableEnforceFocus:ae=!1,disableEscapeKeyDown:oe=!1,disablePortal:le=!1,disableRestoreFocus:fe=!1,disableScrollLock:de=!1,hideBackdrop:ce=!1,keepMounted:pe=!1,onClose:he,onTransitionEnter:me,onTransitionExited:ve,open:ye,slotProps:Se={},slots:Ce={},theme:be,...Ee}=w,Ae={...w,closeAfterTransition:A,disableAutoFocus:ne,disableEnforceFocus:ae,disableEscapeKeyDown:oe,disablePortal:le,disableRestoreFocus:fe,disableScrollLock:de,hideBackdrop:ce,keepMounted:pe},{getRootProps:Ie,getBackdropProps:Te,getTransitionProps:De,portalRef:Ue,isTopModal:ze,exited:Pe,hasTransition:$e}=useModal({...Ae,rootRef:E}),He={...Ae,exited:Pe},je=useUtilityClasses$n(He),Ne={};if(O.props.tabIndex===void 0&&(Ne.tabIndex="-1"),$e){const{onEnter:$t,onExited:tr}=De();Ne.onEnter=$t,Ne.onExited=tr}const Oe={slots:{root:te.Root,backdrop:te.Backdrop,...Ce},slotProps:{...ie,...Se}},[Ve,Ht]=useSlot("root",{ref:E,elementType:ModalRoot,externalForwardedProps:{...Oe,...Ee,component:ee},getSlotProps:Ie,ownerState:He,className:clsx(R,je?.root,!He.open&&He.exited&&je?.hidden)}),[Kt,ir]=useSlot("backdrop",{ref:_?.ref,elementType:T,externalForwardedProps:Oe,shouldForwardComponentProp:!0,additionalProps:_,getSlotProps:$t=>Te({...$t,onClick:tr=>{$t?.onClick&&$t.onClick(tr)}}),className:clsx(_?.className,je?.backdrop),ownerState:He});return!pe&&!ye&&(!$e||Pe)?null:jsxRuntimeExports.jsx(Portal,{ref:Ue,container:H,disablePortal:le,children:jsxRuntimeExports.jsxs(Ve,{...Ht,children:[!ce&&T?jsxRuntimeExports.jsx(Kt,{...ir}):null,jsxRuntimeExports.jsx(FocusTrap,{disableEnforceFocus:ae,disableAutoFocus:ne,disableRestoreFocus:fe,isEnabled:ze,open:ye,children:reactExports.cloneElement(O,Ne)})]})})});function getDialogUtilityClass(x){return generateUtilityClass("MuiDialog",x)}const dialogClasses=generateUtilityClasses("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),DialogContext=reactExports.createContext({}),DialogBackdrop=styled(Backdrop,{name:"MuiDialog",slot:"Backdrop",overrides:(x,C)=>C.backdrop})({zIndex:-1}),useUtilityClasses$m=x=>{const{classes:C,scroll:E,maxWidth:w,fullWidth:T,fullScreen:_}=x,S={root:["root"],container:["container",`scroll${capitalize(E)}`],paper:["paper",`paperScroll${capitalize(E)}`,`paperWidth${capitalize(String(w))}`,T&&"paperFullWidth",_&&"paperFullScreen"]};return composeClasses(S,getDialogUtilityClass,C)},DialogRoot=styled(Modal,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),DialogContainer=styled("div",{name:"MuiDialog",slot:"Container",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.container,C[`scroll${capitalize(E.scroll)}`]]}})({height:"100%","@media print":{height:"auto"},outline:0,variants:[{props:{scroll:"paper"},style:{display:"flex",justifyContent:"center",alignItems:"center"}},{props:{scroll:"body"},style:{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}}}]}),DialogPaper=styled(Paper,{name:"MuiDialog",slot:"Paper",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.paper,C[`scrollPaper${capitalize(E.scroll)}`],C[`paperWidth${capitalize(String(E.maxWidth))}`],E.fullWidth&&C.paperFullWidth,E.fullScreen&&C.paperFullScreen]}})(memoTheme(({theme:x})=>({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"},variants:[{props:{scroll:"paper"},style:{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"}},{props:{scroll:"body"},style:{display:"inline-block",verticalAlign:"middle",textAlign:"initial"}},{props:({ownerState:C})=>!C.maxWidth,style:{maxWidth:"calc(100% - 64px)"}},{props:{maxWidth:"xs"},style:{maxWidth:x.breakpoints.unit==="px"?Math.max(x.breakpoints.values.xs,444):`max(${x.breakpoints.values.xs}${x.breakpoints.unit}, 444px)`,[`&.${dialogClasses.paperScrollBody}`]:{[x.breakpoints.down(Math.max(x.breakpoints.values.xs,444)+32*2)]:{maxWidth:"calc(100% - 64px)"}}}},...Object.keys(x.breakpoints.values).filter(C=>C!=="xs").map(C=>({props:{maxWidth:C},style:{maxWidth:`${x.breakpoints.values[C]}${x.breakpoints.unit}`,[`&.${dialogClasses.paperScrollBody}`]:{[x.breakpoints.down(x.breakpoints.values[C]+32*2)]:{maxWidth:"calc(100% - 64px)"}}}})),{props:({ownerState:C})=>C.fullWidth,style:{width:"calc(100% - 64px)"}},{props:({ownerState:C})=>C.fullScreen,style:{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${dialogClasses.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),Dialog=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiDialog"}),T=useTheme(),_={enter:T.transitions.duration.enteringScreen,exit:T.transitions.duration.leavingScreen},{"aria-describedby":S,"aria-labelledby":R,"aria-modal":A=!0,BackdropComponent:O,BackdropProps:H,children:ee,className:te,disableEscapeKeyDown:ie=!1,fullScreen:ne=!1,fullWidth:ae=!1,maxWidth:oe="sm",onClick:le,onClose:fe,open:de,PaperComponent:ce=Paper,PaperProps:pe={},scroll:he="paper",slots:me={},slotProps:ve={},TransitionComponent:ye=Fade,transitionDuration:Se=_,TransitionProps:Ce,...be}=w,Ee={...w,disableEscapeKeyDown:ie,fullScreen:ne,fullWidth:ae,maxWidth:oe,scroll:he},Ae=useUtilityClasses$m(Ee),Ie=reactExports.useRef(),Te=gr=>{Ie.current=gr.target===gr.currentTarget},De=gr=>{le&&le(gr),Ie.current&&(Ie.current=null,fe&&fe(gr,"backdropClick"))},Ue=useId(R),ze=reactExports.useMemo(()=>({titleId:Ue}),[Ue]),Pe={transition:ye,...me},$e={transition:Ce,paper:pe,backdrop:H,...ve},He={slots:Pe,slotProps:$e},[je,Ne]=useSlot("root",{elementType:DialogRoot,shouldForwardComponentProp:!0,externalForwardedProps:He,ownerState:Ee,className:clsx(Ae.root,te),ref:E}),[Oe,Ve]=useSlot("backdrop",{elementType:DialogBackdrop,shouldForwardComponentProp:!0,externalForwardedProps:He,ownerState:Ee}),[Ht,Kt]=useSlot("paper",{elementType:DialogPaper,shouldForwardComponentProp:!0,externalForwardedProps:He,ownerState:Ee,className:clsx(Ae.paper,pe.className)}),[ir,$t]=useSlot("container",{elementType:DialogContainer,externalForwardedProps:He,ownerState:Ee,className:Ae.container}),[tr,ar]=useSlot("transition",{elementType:Fade,externalForwardedProps:He,ownerState:Ee,additionalProps:{appear:!0,in:de,timeout:Se,role:"presentation"}});return jsxRuntimeExports.jsx(je,{closeAfterTransition:!0,slots:{backdrop:Oe},slotProps:{backdrop:{transitionDuration:Se,as:O,...Ve}},disableEscapeKeyDown:ie,onClose:fe,open:de,onClick:De,...Ne,...be,children:jsxRuntimeExports.jsx(tr,{...ar,children:jsxRuntimeExports.jsx(ir,{onMouseDown:Te,...$t,children:jsxRuntimeExports.jsx(Ht,{as:ce,elevation:24,role:"dialog","aria-describedby":S,"aria-labelledby":Ue,"aria-modal":A,...Kt,children:jsxRuntimeExports.jsx(DialogContext.Provider,{value:ze,children:ee})})})})})});function getDialogActionsUtilityClass(x){return generateUtilityClass("MuiDialogActions",x)}generateUtilityClasses("MuiDialogActions",["root","spacing"]);const useUtilityClasses$l=x=>{const{classes:C,disableSpacing:E}=x;return composeClasses({root:["root",!E&&"spacing"]},getDialogActionsUtilityClass,C)},DialogActionsRoot=styled("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,!E.disableSpacing&&C.spacing]}})({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto",variants:[{props:({ownerState:x})=>!x.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),DialogActions=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiDialogActions"}),{className:T,disableSpacing:_=!1,...S}=w,R={...w,disableSpacing:_},A=useUtilityClasses$l(R);return jsxRuntimeExports.jsx(DialogActionsRoot,{className:clsx(A.root,T),ownerState:R,ref:E,...S})});function getDialogContentUtilityClass(x){return generateUtilityClass("MuiDialogContent",x)}generateUtilityClasses("MuiDialogContent",["root","dividers"]);function getDialogTitleUtilityClass(x){return generateUtilityClass("MuiDialogTitle",x)}const dialogTitleClasses=generateUtilityClasses("MuiDialogTitle",["root"]),useUtilityClasses$k=x=>{const{classes:C,dividers:E}=x;return composeClasses({root:["root",E&&"dividers"]},getDialogContentUtilityClass,C)},DialogContentRoot=styled("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.dividers&&C.dividers]}})(memoTheme(({theme:x})=>({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px",variants:[{props:({ownerState:C})=>C.dividers,style:{padding:"16px 24px",borderTop:`1px solid ${(x.vars||x).palette.divider}`,borderBottom:`1px solid ${(x.vars||x).palette.divider}`}},{props:({ownerState:C})=>!C.dividers,style:{[`.${dialogTitleClasses.root} + &`]:{paddingTop:0}}}]}))),DialogContent=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiDialogContent"}),{className:T,dividers:_=!1,...S}=w,R={...w,dividers:_},A=useUtilityClasses$k(R);return jsxRuntimeExports.jsx(DialogContentRoot,{className:clsx(A.root,T),ownerState:R,ref:E,...S})});function getDialogContentTextUtilityClass(x){return generateUtilityClass("MuiDialogContentText",x)}generateUtilityClasses("MuiDialogContentText",["root"]);const useUtilityClasses$j=x=>{const{classes:C}=x,w=composeClasses({root:["root"]},getDialogContentTextUtilityClass,C);return{...C,...w}},DialogContentTextRoot=styled(Typography,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiDialogContentText",slot:"Root"})({}),DialogContentText=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiDialogContentText"}),{children:T,className:_,...S}=w,R=useUtilityClasses$j(S);return jsxRuntimeExports.jsx(DialogContentTextRoot,{component:"p",variant:"body1",color:"textSecondary",ref:E,ownerState:S,className:clsx(R.root,_),...w,classes:R})}),useUtilityClasses$i=x=>{const{classes:C}=x;return composeClasses({root:["root"]},getDialogTitleUtilityClass,C)},DialogTitleRoot=styled(Typography,{name:"MuiDialogTitle",slot:"Root"})({padding:"16px 24px",flex:"0 0 auto"}),DialogTitle=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiDialogTitle"}),{className:T,id:_,...S}=w,R=w,A=useUtilityClasses$i(R),{titleId:O=_}=reactExports.useContext(DialogContext);return jsxRuntimeExports.jsx(DialogTitleRoot,{component:"h2",className:clsx(A.root,T),ownerState:R,ref:E,variant:"h6",id:_??O,...S})}),dividerClasses=generateUtilityClasses("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]),useUtilityClasses$h=x=>{const{classes:C,disableUnderline:E,startAdornment:w,endAdornment:T,size:_,hiddenLabel:S,multiline:R}=x,A={root:["root",!E&&"underline",w&&"adornedStart",T&&"adornedEnd",_==="small"&&`size${capitalize(_)}`,S&&"hiddenLabel",R&&"multiline"],input:["input"]},O=composeClasses(A,getFilledInputUtilityClass,C);return{...C,...O}},FilledInputRoot=styled(InputBaseRoot,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiFilledInput",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[...rootOverridesResolver(x,C),!E.disableUnderline&&C.underline]}})(memoTheme(({theme:x})=>{const C=x.palette.mode==="light",E=C?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",w=C?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",T=C?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",_=C?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{position:"relative",backgroundColor:x.vars?x.vars.palette.FilledInput.bg:w,borderTopLeftRadius:(x.vars||x).shape.borderRadius,borderTopRightRadius:(x.vars||x).shape.borderRadius,transition:x.transitions.create("background-color",{duration:x.transitions.duration.shorter,easing:x.transitions.easing.easeOut}),"&:hover":{backgroundColor:x.vars?x.vars.palette.FilledInput.hoverBg:T,"@media (hover: none)":{backgroundColor:x.vars?x.vars.palette.FilledInput.bg:w}},[`&.${filledInputClasses.focused}`]:{backgroundColor:x.vars?x.vars.palette.FilledInput.bg:w},[`&.${filledInputClasses.disabled}`]:{backgroundColor:x.vars?x.vars.palette.FilledInput.disabledBg:_},variants:[{props:({ownerState:S})=>!S.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:x.transitions.create("transform",{duration:x.transitions.duration.shorter,easing:x.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${filledInputClasses.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${filledInputClasses.error}`]:{"&::before, &::after":{borderBottomColor:(x.vars||x).palette.error.main}},"&::before":{borderBottom:`1px solid ${x.vars?x.alpha(x.vars.palette.common.onBackground,x.vars.opacity.inputUnderline):E}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:x.transitions.create("border-bottom-color",{duration:x.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${filledInputClasses.disabled}, .${filledInputClasses.error}):before`]:{borderBottom:`1px solid ${(x.vars||x).palette.text.primary}`},[`&.${filledInputClasses.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([S])=>({props:{disableUnderline:!1,color:S},style:{"&::after":{borderBottom:`2px solid ${(x.vars||x).palette[S]?.main}`}}})),{props:({ownerState:S})=>S.startAdornment,style:{paddingLeft:12}},{props:({ownerState:S})=>S.endAdornment,style:{paddingRight:12}},{props:({ownerState:S})=>S.multiline,style:{padding:"25px 12px 8px"}},{props:({ownerState:S,size:R})=>S.multiline&&R==="small",style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:S})=>S.multiline&&S.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:S})=>S.multiline&&S.hiddenLabel&&S.size==="small",style:{paddingTop:8,paddingBottom:9}}]}})),FilledInputInput=styled(InputBaseInput,{name:"MuiFilledInput",slot:"Input",overridesResolver:inputOverridesResolver})(memoTheme(({theme:x})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!x.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:x.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:x.palette.mode==="light"?null:"#fff",caretColor:x.palette.mode==="light"?null:"#fff",borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"}},...x.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"},[x.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:C})=>C.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:C})=>C.startAdornment,style:{paddingLeft:0}},{props:({ownerState:C})=>C.endAdornment,style:{paddingRight:0}},{props:({ownerState:C})=>C.hiddenLabel&&C.size==="small",style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:C})=>C.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),FilledInput=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiFilledInput"}),{disableUnderline:T=!1,components:_={},componentsProps:S,fullWidth:R=!1,hiddenLabel:A,inputComponent:O="input",multiline:H=!1,slotProps:ee,slots:te={},type:ie="text",...ne}=w,ae={...w,disableUnderline:T,fullWidth:R,inputComponent:O,multiline:H,type:ie},oe=useUtilityClasses$h(w),le={root:{ownerState:ae},input:{ownerState:ae}},fe=ee??S?deepmerge(le,ee??S):le,de=te.root??_.Root??FilledInputRoot,ce=te.input??_.Input??FilledInputInput;return jsxRuntimeExports.jsx(InputBase,{slots:{root:de,input:ce},slotProps:fe,fullWidth:R,inputComponent:O,multiline:H,ref:E,type:ie,...ne,classes:oe})});FilledInput.muiName="Input";function getFormControlUtilityClasses(x){return generateUtilityClass("MuiFormControl",x)}generateUtilityClasses("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const useUtilityClasses$g=x=>{const{classes:C,margin:E,fullWidth:w}=x,T={root:["root",E!=="none"&&`margin${capitalize(E)}`,w&&"fullWidth"]};return composeClasses(T,getFormControlUtilityClasses,C)},FormControlRoot=styled("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,C[`margin${capitalize(E.margin)}`],E.fullWidth&&C.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),FormControl=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiFormControl"}),{children:T,className:_,color:S="primary",component:R="div",disabled:A=!1,error:O=!1,focused:H,fullWidth:ee=!1,hiddenLabel:te=!1,margin:ie="none",required:ne=!1,size:ae="medium",variant:oe="outlined",...le}=w,fe={...w,color:S,component:R,disabled:A,error:O,fullWidth:ee,hiddenLabel:te,margin:ie,required:ne,size:ae,variant:oe},de=useUtilityClasses$g(fe),[ce,pe]=reactExports.useState(()=>{let Ie=!1;return T&&reactExports.Children.forEach(T,Te=>{if(!isMuiElement(Te,["Input","Select"]))return;const De=isMuiElement(Te,["Select"])?Te.props.input:Te;De&&isAdornedStart(De.props)&&(Ie=!0)}),Ie}),[he,me]=reactExports.useState(()=>{let Ie=!1;return T&&reactExports.Children.forEach(T,Te=>{isMuiElement(Te,["Input","Select"])&&(isFilled(Te.props,!0)||isFilled(Te.props.inputProps,!0))&&(Ie=!0)}),Ie}),[ve,ye]=reactExports.useState(!1);A&&ve&&ye(!1);const Se=H!==void 0&&!A?H:ve;let Ce;reactExports.useRef(!1);const be=reactExports.useCallback(()=>{me(!0)},[]),Ee=reactExports.useCallback(()=>{me(!1)},[]),Ae=reactExports.useMemo(()=>({adornedStart:ce,setAdornedStart:pe,color:S,disabled:A,error:O,filled:he,focused:Se,fullWidth:ee,hiddenLabel:te,size:ae,onBlur:()=>{ye(!1)},onFocus:()=>{ye(!0)},onEmpty:Ee,onFilled:be,registerEffect:Ce,required:ne,variant:oe}),[ce,S,A,O,he,Se,ee,te,Ce,Ee,be,ne,ae,oe]);return jsxRuntimeExports.jsx(FormControlContext.Provider,{value:Ae,children:jsxRuntimeExports.jsx(FormControlRoot,{as:R,ownerState:fe,className:clsx(de.root,_),ref:E,...le,children:T})})});function getFormHelperTextUtilityClasses(x){return generateUtilityClass("MuiFormHelperText",x)}const formHelperTextClasses=generateUtilityClasses("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]);var _span$2;const useUtilityClasses$f=x=>{const{classes:C,contained:E,size:w,disabled:T,error:_,filled:S,focused:R,required:A}=x,O={root:["root",T&&"disabled",_&&"error",w&&`size${capitalize(w)}`,E&&"contained",R&&"focused",S&&"filled",A&&"required"]};return composeClasses(O,getFormHelperTextUtilityClasses,C)},FormHelperTextRoot=styled("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.size&&C[`size${capitalize(E.size)}`],E.contained&&C.contained,E.filled&&C.filled]}})(memoTheme(({theme:x})=>({color:(x.vars||x).palette.text.secondary,...x.typography.caption,textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${formHelperTextClasses.disabled}`]:{color:(x.vars||x).palette.text.disabled},[`&.${formHelperTextClasses.error}`]:{color:(x.vars||x).palette.error.main},variants:[{props:{size:"small"},style:{marginTop:4}},{props:({ownerState:C})=>C.contained,style:{marginLeft:14,marginRight:14}}]}))),FormHelperText=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiFormHelperText"}),{children:T,className:_,component:S="p",disabled:R,error:A,filled:O,focused:H,margin:ee,required:te,variant:ie,...ne}=w,ae=useFormControl(),oe=formControlState({props:w,muiFormControl:ae,states:["variant","size","disabled","error","filled","focused","required"]}),le={...w,component:S,contained:oe.variant==="filled"||oe.variant==="outlined",variant:oe.variant,size:oe.size,disabled:oe.disabled,error:oe.error,filled:oe.filled,focused:oe.focused,required:oe.required};delete le.ownerState;const fe=useUtilityClasses$f(le);return jsxRuntimeExports.jsx(FormHelperTextRoot,{as:S,className:clsx(fe.root,_),ref:E,...ne,ownerState:le,children:T===" "?_span$2||(_span$2=jsxRuntimeExports.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"})):T})});function getFormLabelUtilityClasses(x){return generateUtilityClass("MuiFormLabel",x)}const formLabelClasses=generateUtilityClasses("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),useUtilityClasses$e=x=>{const{classes:C,color:E,focused:w,disabled:T,error:_,filled:S,required:R}=x,A={root:["root",`color${capitalize(E)}`,T&&"disabled",_&&"error",S&&"filled",w&&"focused",R&&"required"],asterisk:["asterisk",_&&"error"]};return composeClasses(A,getFormLabelUtilityClasses,C)},FormLabelRoot=styled("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,E.color==="secondary"&&C.colorSecondary,E.filled&&C.filled]}})(memoTheme(({theme:x})=>({color:(x.vars||x).palette.text.secondary,...x.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{[`&.${formLabelClasses.focused}`]:{color:(x.vars||x).palette[C].main}}})),{props:{},style:{[`&.${formLabelClasses.disabled}`]:{color:(x.vars||x).palette.text.disabled},[`&.${formLabelClasses.error}`]:{color:(x.vars||x).palette.error.main}}}]}))),AsteriskComponent=styled("span",{name:"MuiFormLabel",slot:"Asterisk"})(memoTheme(({theme:x})=>({[`&.${formLabelClasses.error}`]:{color:(x.vars||x).palette.error.main}}))),FormLabel=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiFormLabel"}),{children:T,className:_,color:S,component:R="label",disabled:A,error:O,filled:H,focused:ee,required:te,...ie}=w,ne=useFormControl(),ae=formControlState({props:w,muiFormControl:ne,states:["color","required","focused","disabled","error","filled"]}),oe={...w,color:ae.color||"primary",component:R,disabled:ae.disabled,error:ae.error,filled:ae.filled,focused:ae.focused,required:ae.required},le=useUtilityClasses$e(oe);return jsxRuntimeExports.jsxs(FormLabelRoot,{as:R,ownerState:oe,className:clsx(le.root,_),ref:E,...ie,children:[T,ae.required&&jsxRuntimeExports.jsxs(AsteriskComponent,{ownerState:oe,"aria-hidden":!0,className:le.asterisk,children:[" ","*"]})]})}),useUtilityClasses$d=x=>{const{classes:C,disableUnderline:E}=x,T=composeClasses({root:["root",!E&&"underline"],input:["input"]},getInputUtilityClass,C);return{...C,...T}},InputRoot=styled(InputBaseRoot,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiInput",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[...rootOverridesResolver(x,C),!E.disableUnderline&&C.underline]}})(memoTheme(({theme:x})=>{let E=x.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return x.vars&&(E=x.alpha(x.vars.palette.common.onBackground,x.vars.opacity.inputUnderline)),{position:"relative",variants:[{props:({ownerState:w})=>w.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:w})=>!w.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:x.transitions.create("transform",{duration:x.transitions.duration.shorter,easing:x.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${inputClasses.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${inputClasses.error}`]:{"&::before, &::after":{borderBottomColor:(x.vars||x).palette.error.main}},"&::before":{borderBottom:`1px solid ${E}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:x.transitions.create("border-bottom-color",{duration:x.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${inputClasses.disabled}, .${inputClasses.error}):before`]:{borderBottom:`2px solid ${(x.vars||x).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${E}`}},[`&.${inputClasses.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([w])=>({props:{color:w,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(x.vars||x).palette[w].main}`}}}))]}})),InputInput=styled(InputBaseInput,{name:"MuiInput",slot:"Input",overridesResolver:inputOverridesResolver})({}),Input=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiInput"}),{disableUnderline:T=!1,components:_={},componentsProps:S,fullWidth:R=!1,inputComponent:A="input",multiline:O=!1,slotProps:H,slots:ee={},type:te="text",...ie}=w,ne=useUtilityClasses$d(w),oe={root:{ownerState:{disableUnderline:T}}},le=H??S?deepmerge(H??S,oe):oe,fe=ee.root??_.Root??InputRoot,de=ee.input??_.Input??InputInput;return jsxRuntimeExports.jsx(InputBase,{slots:{root:fe,input:de},slotProps:le,fullWidth:R,inputComponent:A,multiline:O,ref:E,type:te,...ie,classes:ne})});Input.muiName="Input";function getInputLabelUtilityClasses(x){return generateUtilityClass("MuiInputLabel",x)}generateUtilityClasses("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const useUtilityClasses$c=x=>{const{classes:C,formControl:E,size:w,shrink:T,disableAnimation:_,variant:S,required:R}=x,A={root:["root",E&&"formControl",!_&&"animated",T&&"shrink",w&&w!=="medium"&&`size${capitalize(w)}`,S],asterisk:[R&&"asterisk"]},O=composeClasses(A,getInputLabelUtilityClasses,C);return{...C,...O}},InputLabelRoot=styled(FormLabel,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiInputLabel",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[{[`& .${formLabelClasses.asterisk}`]:C.asterisk},C.root,E.formControl&&C.formControl,E.size==="small"&&C.sizeSmall,E.shrink&&C.shrink,!E.disableAnimation&&C.animated,E.focused&&C.focused,C[E.variant]]}})(memoTheme(({theme:x})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:C})=>C.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:C})=>C.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:C})=>!C.disableAnimation,style:{transition:x.transitions.create(["color","transform","max-width"],{duration:x.transitions.duration.shorter,easing:x.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:C,ownerState:E})=>C==="filled"&&E.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:C,ownerState:E,size:w})=>C==="filled"&&E.shrink&&w==="small",style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:C,ownerState:E})=>C==="outlined"&&E.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),InputLabel=reactExports.forwardRef(function(C,E){const w=useDefaultProps({name:"MuiInputLabel",props:C}),{disableAnimation:T=!1,margin:_,shrink:S,variant:R,className:A,...O}=w,H=useFormControl();let ee=S;typeof ee>"u"&&H&&(ee=H.filled||H.focused||H.adornedStart);const te=formControlState({props:w,muiFormControl:H,states:["size","variant","required","focused"]}),ie={...w,disableAnimation:T,formControl:H,shrink:ee,size:te.size,variant:te.variant,required:te.required,focused:te.focused},ne=useUtilityClasses$c(ie);return jsxRuntimeExports.jsx(InputLabelRoot,{"data-shrink":ee,ref:E,className:clsx(ne.root,A),...O,ownerState:ie,classes:ne})});function getLinearProgressUtilityClass(x){return generateUtilityClass("MuiLinearProgress",x)}generateUtilityClasses("MuiLinearProgress",["root","colorPrimary","colorSecondary","determinate","indeterminate","buffer","query","dashed","dashedColorPrimary","dashedColorSecondary","bar","bar1","bar2","barColorPrimary","barColorSecondary","bar1Indeterminate","bar1Determinate","bar1Buffer","bar2Indeterminate","bar2Buffer"]);const TRANSITION_DURATION=4,indeterminate1Keyframe=keyframes`
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
`,indeterminate1Animation=typeof indeterminate1Keyframe!="string"?css`
        animation: ${indeterminate1Keyframe} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
      `:null,indeterminate2Keyframe=keyframes`
  0% {
    left: -200%;
    right: 100%;
  }

  60% {
    left: 107%;
    right: -8%;
  }

  100% {
    left: 107%;
    right: -8%;
  }
`,indeterminate2Animation=typeof indeterminate2Keyframe!="string"?css`
        animation: ${indeterminate2Keyframe} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
      `:null,bufferKeyframe=keyframes`
  0% {
    opacity: 1;
    background-position: 0 -23px;
  }

  60% {
    opacity: 0;
    background-position: 0 -23px;
  }

  100% {
    opacity: 1;
    background-position: -200px -23px;
  }
`,bufferAnimation=typeof bufferKeyframe!="string"?css`
        animation: ${bufferKeyframe} 3s infinite linear;
      `:null,useUtilityClasses$b=x=>{const{classes:C,variant:E,color:w}=x,T={root:["root",`color${capitalize(w)}`,E],dashed:["dashed",`dashedColor${capitalize(w)}`],bar1:["bar","bar1",`barColor${capitalize(w)}`,(E==="indeterminate"||E==="query")&&"bar1Indeterminate",E==="determinate"&&"bar1Determinate",E==="buffer"&&"bar1Buffer"],bar2:["bar","bar2",E!=="buffer"&&`barColor${capitalize(w)}`,E==="buffer"&&`color${capitalize(w)}`,(E==="indeterminate"||E==="query")&&"bar2Indeterminate",E==="buffer"&&"bar2Buffer"]};return composeClasses(T,getLinearProgressUtilityClass,C)},getColorShade=(x,C)=>x.vars?x.vars.palette.LinearProgress[`${C}Bg`]:x.palette.mode==="light"?x.lighten(x.palette[C].main,.62):x.darken(x.palette[C].main,.5),LinearProgressRoot=styled("span",{name:"MuiLinearProgress",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,C[`color${capitalize(E.color)}`],C[E.variant]]}})(memoTheme(({theme:x})=>({position:"relative",overflow:"hidden",display:"block",height:4,zIndex:0,"@media print":{colorAdjust:"exact"},variants:[...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{backgroundColor:getColorShade(x,C)}})),{props:({ownerState:C})=>C.color==="inherit"&&C.variant!=="buffer",style:{"&::before":{content:'""',position:"absolute",left:0,top:0,right:0,bottom:0,backgroundColor:"currentColor",opacity:.3}}},{props:{variant:"buffer"},style:{backgroundColor:"transparent"}},{props:{variant:"query"},style:{transform:"rotate(180deg)"}}]}))),LinearProgressDashed=styled("span",{name:"MuiLinearProgress",slot:"Dashed",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.dashed,C[`dashedColor${capitalize(E.color)}`]]}})(memoTheme(({theme:x})=>({position:"absolute",marginTop:0,height:"100%",width:"100%",backgroundSize:"10px 10px",backgroundPosition:"0 -23px",variants:[{props:{color:"inherit"},style:{opacity:.3,backgroundImage:"radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)"}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>{const E=getColorShade(x,C);return{props:{color:C},style:{backgroundImage:`radial-gradient(${E} 0%, ${E} 16%, transparent 42%)`}}})]})),bufferAnimation||{animation:`${bufferKeyframe} 3s infinite linear`}),LinearProgressBar1=styled("span",{name:"MuiLinearProgress",slot:"Bar1",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.bar,C.bar1,C[`barColor${capitalize(E.color)}`],(E.variant==="indeterminate"||E.variant==="query")&&C.bar1Indeterminate,E.variant==="determinate"&&C.bar1Determinate,E.variant==="buffer"&&C.bar1Buffer]}})(memoTheme(({theme:x})=>({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left",variants:[{props:{color:"inherit"},style:{backgroundColor:"currentColor"}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{backgroundColor:(x.vars||x).palette[C].main}})),{props:{variant:"determinate"},style:{transition:`transform .${TRANSITION_DURATION}s linear`}},{props:{variant:"buffer"},style:{zIndex:1,transition:`transform .${TRANSITION_DURATION}s linear`}},{props:({ownerState:C})=>C.variant==="indeterminate"||C.variant==="query",style:{width:"auto"}},{props:({ownerState:C})=>C.variant==="indeterminate"||C.variant==="query",style:indeterminate1Animation||{animation:`${indeterminate1Keyframe} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),LinearProgressBar2=styled("span",{name:"MuiLinearProgress",slot:"Bar2",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.bar,C.bar2,C[`barColor${capitalize(E.color)}`],(E.variant==="indeterminate"||E.variant==="query")&&C.bar2Indeterminate,E.variant==="buffer"&&C.bar2Buffer]}})(memoTheme(({theme:x})=>({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left",variants:[...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C},style:{"--LinearProgressBar2-barColor":(x.vars||x).palette[C].main}})),{props:({ownerState:C})=>C.variant!=="buffer"&&C.color!=="inherit",style:{backgroundColor:"var(--LinearProgressBar2-barColor, currentColor)"}},{props:({ownerState:C})=>C.variant!=="buffer"&&C.color==="inherit",style:{backgroundColor:"currentColor"}},{props:{color:"inherit"},style:{opacity:.3}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([C])=>({props:{color:C,variant:"buffer"},style:{backgroundColor:getColorShade(x,C),transition:`transform .${TRANSITION_DURATION}s linear`}})),{props:({ownerState:C})=>C.variant==="indeterminate"||C.variant==="query",style:{width:"auto"}},{props:({ownerState:C})=>C.variant==="indeterminate"||C.variant==="query",style:indeterminate2Animation||{animation:`${indeterminate2Keyframe} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),LinearProgress=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiLinearProgress"}),{className:T,color:_="primary",value:S,valueBuffer:R,variant:A="indeterminate",...O}=w,H={...w,color:_,variant:A},ee=useUtilityClasses$b(H),te=useRtl(),ie={},ne={bar1:{},bar2:{}};if((A==="determinate"||A==="buffer")&&S!==void 0){ie["aria-valuenow"]=Math.round(S),ie["aria-valuemin"]=0,ie["aria-valuemax"]=100;let ae=S-100;te&&(ae=-ae),ne.bar1.transform=`translateX(${ae}%)`}if(A==="buffer"&&R!==void 0){let ae=(R||0)-100;te&&(ae=-ae),ne.bar2.transform=`translateX(${ae}%)`}return jsxRuntimeExports.jsxs(LinearProgressRoot,{className:clsx(ee.root,T),ownerState:H,role:"progressbar",...ie,ref:E,...O,children:[A==="buffer"?jsxRuntimeExports.jsx(LinearProgressDashed,{className:ee.dashed,ownerState:H}):null,jsxRuntimeExports.jsx(LinearProgressBar1,{className:ee.bar1,ownerState:H,style:ne.bar1}),A==="determinate"?null:jsxRuntimeExports.jsx(LinearProgressBar2,{className:ee.bar2,ownerState:H,style:ne.bar2})]})}),ListContext=reactExports.createContext({});function getListUtilityClass(x){return generateUtilityClass("MuiList",x)}generateUtilityClasses("MuiList",["root","padding","dense","subheader"]);const useUtilityClasses$a=x=>{const{classes:C,disablePadding:E,dense:w,subheader:T}=x;return composeClasses({root:["root",!E&&"padding",w&&"dense",T&&"subheader"]},getListUtilityClass,C)},ListRoot=styled("ul",{name:"MuiList",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,!E.disablePadding&&C.padding,E.dense&&C.dense,E.subheader&&C.subheader]}})({listStyle:"none",margin:0,padding:0,position:"relative",variants:[{props:({ownerState:x})=>!x.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:x})=>x.subheader,style:{paddingTop:0}}]}),List=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiList"}),{children:T,className:_,component:S="ul",dense:R=!1,disablePadding:A=!1,subheader:O,...H}=w,ee=reactExports.useMemo(()=>({dense:R}),[R]),te={...w,component:S,dense:R,disablePadding:A},ie=useUtilityClasses$a(te);return jsxRuntimeExports.jsx(ListContext.Provider,{value:ee,children:jsxRuntimeExports.jsxs(ListRoot,{as:S,className:clsx(ie.root,_),ref:E,ownerState:te,...H,children:[O,T]})})}),listItemIconClasses=generateUtilityClasses("MuiListItemIcon",["root","alignItemsFlexStart"]),listItemTextClasses=generateUtilityClasses("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);function nextItem(x,C,E){return x===C?x.firstChild:C&&C.nextElementSibling?C.nextElementSibling:E?null:x.firstChild}function previousItem(x,C,E){return x===C?E?x.firstChild:x.lastChild:C&&C.previousElementSibling?C.previousElementSibling:E?null:x.lastChild}function textCriteriaMatches(x,C){if(C===void 0)return!0;let E=x.innerText;return E===void 0&&(E=x.textContent),E=E.trim().toLowerCase(),E.length===0?!1:C.repeating?E[0]===C.keys[0]:E.startsWith(C.keys.join(""))}function moveFocus(x,C,E,w,T,_){let S=!1,R=T(x,C,C?E:!1);for(;R;){if(R===x.firstChild){if(S)return!1;S=!0}const A=w?!1:R.disabled||R.getAttribute("aria-disabled")==="true";if(!R.hasAttribute("tabindex")||!textCriteriaMatches(R,_)||A)R=T(x,R,E);else return R.focus(),!0}return!1}const MenuList=reactExports.forwardRef(function(C,E){const{actions:w,autoFocus:T=!1,autoFocusItem:_=!1,children:S,className:R,disabledItemsFocusable:A=!1,disableListWrap:O=!1,onKeyDown:H,variant:ee="selectedMenu",...te}=C,ie=reactExports.useRef(null),ne=reactExports.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null});useEnhancedEffect(()=>{T&&ie.current.focus()},[T]),reactExports.useImperativeHandle(w,()=>({adjustStyleForScrollbar:(de,{direction:ce})=>{const pe=!ie.current.style.width;if(de.clientHeight<ie.current.clientHeight&&pe){const he=`${getScrollbarSize(ownerWindow(de))}px`;ie.current.style[ce==="rtl"?"paddingLeft":"paddingRight"]=he,ie.current.style.width=`calc(100% + ${he})`}return ie.current}}),[]);const ae=de=>{const ce=ie.current,pe=de.key;if(de.ctrlKey||de.metaKey||de.altKey){H&&H(de);return}const me=ownerDocument(ce).activeElement;if(pe==="ArrowDown")de.preventDefault(),moveFocus(ce,me,O,A,nextItem);else if(pe==="ArrowUp")de.preventDefault(),moveFocus(ce,me,O,A,previousItem);else if(pe==="Home")de.preventDefault(),moveFocus(ce,null,O,A,nextItem);else if(pe==="End")de.preventDefault(),moveFocus(ce,null,O,A,previousItem);else if(pe.length===1){const ve=ne.current,ye=pe.toLowerCase(),Se=performance.now();ve.keys.length>0&&(Se-ve.lastTime>500?(ve.keys=[],ve.repeating=!0,ve.previousKeyMatched=!0):ve.repeating&&ye!==ve.keys[0]&&(ve.repeating=!1)),ve.lastTime=Se,ve.keys.push(ye);const Ce=me&&!ve.repeating&&textCriteriaMatches(me,ve);ve.previousKeyMatched&&(Ce||moveFocus(ce,me,!1,A,nextItem,ve))?de.preventDefault():ve.previousKeyMatched=!1}H&&H(de)},oe=useForkRef(ie,E);let le=-1;reactExports.Children.forEach(S,(de,ce)=>{if(!reactExports.isValidElement(de)){le===ce&&(le+=1,le>=S.length&&(le=-1));return}de.props.disabled||(ee==="selectedMenu"&&de.props.selected||le===-1)&&(le=ce),le===ce&&(de.props.disabled||de.props.muiSkipListHighlight||de.type.muiSkipListHighlight)&&(le+=1,le>=S.length&&(le=-1))});const fe=reactExports.Children.map(S,(de,ce)=>{if(ce===le){const pe={};return _&&(pe.autoFocus=!0),de.props.tabIndex===void 0&&ee==="selectedMenu"&&(pe.tabIndex=0),reactExports.cloneElement(de,pe)}return de});return jsxRuntimeExports.jsx(List,{role:"menu",ref:oe,className:R,onKeyDown:ae,tabIndex:T?0:-1,...te,children:fe})});function getPopoverUtilityClass(x){return generateUtilityClass("MuiPopover",x)}generateUtilityClasses("MuiPopover",["root","paper"]);function getOffsetTop(x,C){let E=0;return typeof C=="number"?E=C:C==="center"?E=x.height/2:C==="bottom"&&(E=x.height),E}function getOffsetLeft(x,C){let E=0;return typeof C=="number"?E=C:C==="center"?E=x.width/2:C==="right"&&(E=x.width),E}function getTransformOriginValue(x){return[x.horizontal,x.vertical].map(C=>typeof C=="number"?`${C}px`:C).join(" ")}function resolveAnchorEl(x){return typeof x=="function"?x():x}const useUtilityClasses$9=x=>{const{classes:C}=x;return composeClasses({root:["root"],paper:["paper"]},getPopoverUtilityClass,C)},PopoverRoot=styled(Modal,{name:"MuiPopover",slot:"Root"})({}),PopoverPaper=styled(Paper,{name:"MuiPopover",slot:"Paper"})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),Popover=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiPopover"}),{action:T,anchorEl:_,anchorOrigin:S={vertical:"top",horizontal:"left"},anchorPosition:R,anchorReference:A="anchorEl",children:O,className:H,container:ee,elevation:te=8,marginThreshold:ie=16,open:ne,PaperProps:ae={},slots:oe={},slotProps:le={},transformOrigin:fe={vertical:"top",horizontal:"left"},TransitionComponent:de,transitionDuration:ce="auto",TransitionProps:pe={},disableScrollLock:he=!1,...me}=w,ve=reactExports.useRef(),ye={...w,anchorOrigin:S,anchorReference:A,elevation:te,marginThreshold:ie,transformOrigin:fe,TransitionComponent:de,transitionDuration:ce,TransitionProps:pe},Se=useUtilityClasses$9(ye),Ce=reactExports.useCallback(()=>{if(A==="anchorPosition")return R;const $t=resolveAnchorEl(_),ar=($t&&$t.nodeType===1?$t:ownerDocument(ve.current).body).getBoundingClientRect();return{top:ar.top+getOffsetTop(ar,S.vertical),left:ar.left+getOffsetLeft(ar,S.horizontal)}},[_,S.horizontal,S.vertical,R,A]),be=reactExports.useCallback($t=>({vertical:getOffsetTop($t,fe.vertical),horizontal:getOffsetLeft($t,fe.horizontal)}),[fe.horizontal,fe.vertical]),Ee=reactExports.useCallback($t=>{const tr={width:$t.offsetWidth,height:$t.offsetHeight},ar=be(tr);if(A==="none")return{top:null,left:null,transformOrigin:getTransformOriginValue(ar)};const gr=Ce();let er=gr.top-ar.vertical,sr=gr.left-ar.horizontal;const pr=er+tr.height,ur=sr+tr.width,Sr=ownerWindow(resolveAnchorEl(_)),hr=Sr.innerHeight-ie,yr=Sr.innerWidth-ie;if(ie!==null&&er<ie){const xr=er-ie;er-=xr,ar.vertical+=xr}else if(ie!==null&&pr>hr){const xr=pr-hr;er-=xr,ar.vertical+=xr}if(ie!==null&&sr<ie){const xr=sr-ie;sr-=xr,ar.horizontal+=xr}else if(ur>yr){const xr=ur-yr;sr-=xr,ar.horizontal+=xr}return{top:`${Math.round(er)}px`,left:`${Math.round(sr)}px`,transformOrigin:getTransformOriginValue(ar)}},[_,A,Ce,be,ie]),[Ae,Ie]=reactExports.useState(ne),Te=reactExports.useCallback(()=>{const $t=ve.current;if(!$t)return;const tr=Ee($t);tr.top!==null&&$t.style.setProperty("top",tr.top),tr.left!==null&&($t.style.left=tr.left),$t.style.transformOrigin=tr.transformOrigin,Ie(!0)},[Ee]);reactExports.useEffect(()=>(he&&window.addEventListener("scroll",Te),()=>window.removeEventListener("scroll",Te)),[_,he,Te]);const De=()=>{Te()},Ue=()=>{Ie(!1)};reactExports.useEffect(()=>{ne&&Te()}),reactExports.useImperativeHandle(T,()=>ne?{updatePosition:()=>{Te()}}:null,[ne,Te]),reactExports.useEffect(()=>{if(!ne)return;const $t=debounce(()=>{Te()}),tr=ownerWindow(resolveAnchorEl(_));return tr.addEventListener("resize",$t),()=>{$t.clear(),tr.removeEventListener("resize",$t)}},[_,ne,Te]);let ze=ce;const Pe={slots:{transition:de,...oe},slotProps:{transition:pe,paper:ae,...le}},[$e,He]=useSlot("transition",{elementType:Grow,externalForwardedProps:Pe,ownerState:ye,getSlotProps:$t=>({...$t,onEntering:(tr,ar)=>{$t.onEntering?.(tr,ar),De()},onExited:tr=>{$t.onExited?.(tr),Ue()}}),additionalProps:{appear:!0,in:ne}});ce==="auto"&&!$e.muiSupportAuto&&(ze=void 0);const je=ee||(_?ownerDocument(resolveAnchorEl(_)).body:void 0),[Ne,{slots:Oe,slotProps:Ve,...Ht}]=useSlot("root",{ref:E,elementType:PopoverRoot,externalForwardedProps:{...Pe,...me},shouldForwardComponentProp:!0,additionalProps:{slots:{backdrop:oe.backdrop},slotProps:{backdrop:mergeSlotProps(typeof le.backdrop=="function"?le.backdrop(ye):le.backdrop,{invisible:!0})},container:je,open:ne},ownerState:ye,className:clsx(Se.root,H)}),[Kt,ir]=useSlot("paper",{ref:ve,className:Se.paper,elementType:PopoverPaper,externalForwardedProps:Pe,shouldForwardComponentProp:!0,additionalProps:{elevation:te,style:Ae?void 0:{opacity:0}},ownerState:ye});return jsxRuntimeExports.jsx(Ne,{...Ht,...!isHostComponent(Ne)&&{slots:Oe,slotProps:Ve,disableScrollLock:he},children:jsxRuntimeExports.jsx($e,{...He,timeout:ze,children:jsxRuntimeExports.jsx(Kt,{...ir,children:O})})})});function getMenuUtilityClass(x){return generateUtilityClass("MuiMenu",x)}generateUtilityClasses("MuiMenu",["root","paper","list"]);const RTL_ORIGIN={vertical:"top",horizontal:"right"},LTR_ORIGIN={vertical:"top",horizontal:"left"},useUtilityClasses$8=x=>{const{classes:C}=x;return composeClasses({root:["root"],paper:["paper"],list:["list"]},getMenuUtilityClass,C)},MenuRoot=styled(Popover,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiMenu",slot:"Root"})({}),MenuPaper=styled(PopoverPaper,{name:"MuiMenu",slot:"Paper"})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),MenuMenuList=styled(MenuList,{name:"MuiMenu",slot:"List"})({outline:0}),Menu=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiMenu"}),{autoFocus:T=!0,children:_,className:S,disableAutoFocusItem:R=!1,MenuListProps:A={},onClose:O,open:H,PaperProps:ee={},PopoverClasses:te,transitionDuration:ie="auto",TransitionProps:{onEntering:ne,...ae}={},variant:oe="selectedMenu",slots:le={},slotProps:fe={},...de}=w,ce=useRtl(),pe={...w,autoFocus:T,disableAutoFocusItem:R,MenuListProps:A,onEntering:ne,PaperProps:ee,transitionDuration:ie,TransitionProps:ae,variant:oe},he=useUtilityClasses$8(pe),me=T&&!R&&H,ve=reactExports.useRef(null),ye=(ze,Pe)=>{ve.current&&ve.current.adjustStyleForScrollbar(ze,{direction:ce?"rtl":"ltr"}),ne&&ne(ze,Pe)},Se=ze=>{ze.key==="Tab"&&(ze.preventDefault(),O&&O(ze,"tabKeyDown"))};let Ce=-1;reactExports.Children.map(_,(ze,Pe)=>{reactExports.isValidElement(ze)&&(ze.props.disabled||(oe==="selectedMenu"&&ze.props.selected||Ce===-1)&&(Ce=Pe))});const be={slots:le,slotProps:{list:A,transition:ae,paper:ee,...fe}},Ee=useSlotProps({elementType:le.root,externalSlotProps:fe.root,ownerState:pe,className:[he.root,S]}),[Ae,Ie]=useSlot("paper",{className:he.paper,elementType:MenuPaper,externalForwardedProps:be,shouldForwardComponentProp:!0,ownerState:pe}),[Te,De]=useSlot("list",{className:clsx(he.list,A.className),elementType:MenuMenuList,shouldForwardComponentProp:!0,externalForwardedProps:be,getSlotProps:ze=>({...ze,onKeyDown:Pe=>{Se(Pe),ze.onKeyDown?.(Pe)}}),ownerState:pe}),Ue=typeof be.slotProps.transition=="function"?be.slotProps.transition(pe):be.slotProps.transition;return jsxRuntimeExports.jsx(MenuRoot,{onClose:O,anchorOrigin:{vertical:"bottom",horizontal:ce?"right":"left"},transformOrigin:ce?RTL_ORIGIN:LTR_ORIGIN,slots:{root:le.root,paper:Ae,backdrop:le.backdrop,...le.transition&&{transition:le.transition}},slotProps:{root:Ee,paper:Ie,backdrop:typeof fe.backdrop=="function"?fe.backdrop(pe):fe.backdrop,transition:{...Ue,onEntering:(...ze)=>{ye(...ze),Ue?.onEntering?.(...ze)}}},open:H,ref:E,transitionDuration:ie,ownerState:pe,...de,classes:te,children:jsxRuntimeExports.jsx(Te,{actions:ve,autoFocus:T&&(Ce===-1||R),autoFocusItem:me,variant:oe,...De,children:_})})});function getMenuItemUtilityClass(x){return generateUtilityClass("MuiMenuItem",x)}const menuItemClasses=generateUtilityClasses("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),overridesResolver$1=(x,C)=>{const{ownerState:E}=x;return[C.root,E.dense&&C.dense,E.divider&&C.divider,!E.disableGutters&&C.gutters]},useUtilityClasses$7=x=>{const{disabled:C,dense:E,divider:w,disableGutters:T,selected:_,classes:S}=x,A=composeClasses({root:["root",E&&"dense",C&&"disabled",!T&&"gutters",w&&"divider",_&&"selected"]},getMenuItemUtilityClass,S);return{...S,...A}},MenuItemRoot=styled(ButtonBase,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:overridesResolver$1})(memoTheme(({theme:x})=>({...x.typography.body1,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap","&:hover":{textDecoration:"none",backgroundColor:(x.vars||x).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${menuItemClasses.selected}`]:{backgroundColor:x.alpha((x.vars||x).palette.primary.main,(x.vars||x).palette.action.selectedOpacity),[`&.${menuItemClasses.focusVisible}`]:{backgroundColor:x.alpha((x.vars||x).palette.primary.main,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.focusOpacity}`)}},[`&.${menuItemClasses.selected}:hover`]:{backgroundColor:x.alpha((x.vars||x).palette.primary.main,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:x.alpha((x.vars||x).palette.primary.main,(x.vars||x).palette.action.selectedOpacity)}},[`&.${menuItemClasses.focusVisible}`]:{backgroundColor:(x.vars||x).palette.action.focus},[`&.${menuItemClasses.disabled}`]:{opacity:(x.vars||x).palette.action.disabledOpacity},[`& + .${dividerClasses.root}`]:{marginTop:x.spacing(1),marginBottom:x.spacing(1)},[`& + .${dividerClasses.inset}`]:{marginLeft:52},[`& .${listItemTextClasses.root}`]:{marginTop:0,marginBottom:0},[`& .${listItemTextClasses.inset}`]:{paddingLeft:36},[`& .${listItemIconClasses.root}`]:{minWidth:36},variants:[{props:({ownerState:C})=>!C.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:C})=>C.divider,style:{borderBottom:`1px solid ${(x.vars||x).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:C})=>!C.dense,style:{[x.breakpoints.up("sm")]:{minHeight:"auto"}}},{props:({ownerState:C})=>C.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...x.typography.body2,[`& .${listItemIconClasses.root} svg`]:{fontSize:"1.25rem"}}}]}))),MenuItem=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiMenuItem"}),{autoFocus:T=!1,component:_="li",dense:S=!1,divider:R=!1,disableGutters:A=!1,focusVisibleClassName:O,role:H="menuitem",tabIndex:ee,className:te,...ie}=w,ne=reactExports.useContext(ListContext),ae=reactExports.useMemo(()=>({dense:S||ne.dense||!1,disableGutters:A}),[ne.dense,S,A]),oe=reactExports.useRef(null);useEnhancedEffect(()=>{T&&oe.current&&oe.current.focus()},[T]);const le={...w,dense:ae.dense,divider:R,disableGutters:A},fe=useUtilityClasses$7(w),de=useForkRef(oe,E);let ce;return w.disabled||(ce=ee!==void 0?ee:-1),jsxRuntimeExports.jsx(ListContext.Provider,{value:ae,children:jsxRuntimeExports.jsx(MenuItemRoot,{ref:de,role:H,tabIndex:ce,component:_,focusVisibleClassName:clsx(fe.focusVisible,O),className:clsx(fe.root,te),...ie,ownerState:le,classes:fe})})});function getNativeSelectUtilityClasses(x){return generateUtilityClass("MuiNativeSelect",x)}const nativeSelectClasses=generateUtilityClasses("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),useUtilityClasses$6=x=>{const{classes:C,variant:E,disabled:w,multiple:T,open:_,error:S}=x,R={select:["select",E,w&&"disabled",T&&"multiple",S&&"error"],icon:["icon",`icon${capitalize(E)}`,_&&"iconOpen",w&&"disabled"]};return composeClasses(R,getNativeSelectUtilityClasses,C)},StyledSelectSelect=styled("select",{name:"MuiNativeSelect"})(({theme:x})=>({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":{borderRadius:0},[`&.${nativeSelectClasses.disabled}`]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(x.vars||x).palette.background.paper},variants:[{props:({ownerState:C})=>C.variant!=="filled"&&C.variant!=="outlined",style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:"filled"},style:{"&&&":{paddingRight:32}}},{props:{variant:"outlined"},style:{borderRadius:(x.vars||x).shape.borderRadius,"&:focus":{borderRadius:(x.vars||x).shape.borderRadius},"&&&":{paddingRight:32}}}]})),NativeSelectSelect=styled(StyledSelectSelect,{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:rootShouldForwardProp,overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.select,C[E.variant],E.error&&C.error,{[`&.${nativeSelectClasses.multiple}`]:C.multiple}]}})({}),StyledSelectIcon=styled("svg",{name:"MuiNativeSelect"})(({theme:x})=>({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(x.vars||x).palette.action.active,[`&.${nativeSelectClasses.disabled}`]:{color:(x.vars||x).palette.action.disabled},variants:[{props:({ownerState:C})=>C.open,style:{transform:"rotate(180deg)"}},{props:{variant:"filled"},style:{right:7}},{props:{variant:"outlined"},style:{right:7}}]})),NativeSelectIcon=styled(StyledSelectIcon,{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.icon,E.variant&&C[`icon${capitalize(E.variant)}`],E.open&&C.iconOpen]}})({}),NativeSelectInput=reactExports.forwardRef(function(C,E){const{className:w,disabled:T,error:_,IconComponent:S,inputRef:R,variant:A="standard",...O}=C,H={...C,disabled:T,variant:A,error:_},ee=useUtilityClasses$6(H);return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(NativeSelectSelect,{ownerState:H,className:clsx(ee.select,w),disabled:T,ref:R||E,...O}),C.multiple?null:jsxRuntimeExports.jsx(NativeSelectIcon,{as:S,ownerState:H,className:ee.icon})]})});var _span$1;const NotchedOutlineRoot$1=styled("fieldset",{name:"MuiNotchedOutlined",shouldForwardProp:rootShouldForwardProp})({textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%"}),NotchedOutlineLegend=styled("legend",{name:"MuiNotchedOutlined",shouldForwardProp:rootShouldForwardProp})(memoTheme(({theme:x})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:({ownerState:C})=>!C.withLabel,style:{padding:0,lineHeight:"11px",transition:x.transitions.create("width",{duration:150,easing:x.transitions.easing.easeOut})}},{props:({ownerState:C})=>C.withLabel,style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:x.transitions.create("max-width",{duration:50,easing:x.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:({ownerState:C})=>C.withLabel&&C.notched,style:{maxWidth:"100%",transition:x.transitions.create("max-width",{duration:100,easing:x.transitions.easing.easeOut,delay:50})}}]})));function NotchedOutline(x){const{children:C,classes:E,className:w,label:T,notched:_,...S}=x,R=T!=null&&T!=="",A={...x,notched:_,withLabel:R};return jsxRuntimeExports.jsx(NotchedOutlineRoot$1,{"aria-hidden":!0,className:w,ownerState:A,...S,children:jsxRuntimeExports.jsx(NotchedOutlineLegend,{ownerState:A,children:R?jsxRuntimeExports.jsx("span",{children:T}):_span$1||(_span$1=jsxRuntimeExports.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"}))})})}const useUtilityClasses$5=x=>{const{classes:C}=x,w=composeClasses({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},getOutlinedInputUtilityClass,C);return{...C,...w}},OutlinedInputRoot=styled(InputBaseRoot,{shouldForwardProp:x=>rootShouldForwardProp(x)||x==="classes",name:"MuiOutlinedInput",slot:"Root",overridesResolver:rootOverridesResolver})(memoTheme(({theme:x})=>{const C=x.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{position:"relative",borderRadius:(x.vars||x).shape.borderRadius,[`&:hover .${outlinedInputClasses.notchedOutline}`]:{borderColor:(x.vars||x).palette.text.primary},"@media (hover: none)":{[`&:hover .${outlinedInputClasses.notchedOutline}`]:{borderColor:x.vars?x.alpha(x.vars.palette.common.onBackground,.23):C}},[`&.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(x.palette).filter(createSimplePaletteValueFilter()).map(([E])=>({props:{color:E},style:{[`&.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]:{borderColor:(x.vars||x).palette[E].main}}})),{props:{},style:{[`&.${outlinedInputClasses.error} .${outlinedInputClasses.notchedOutline}`]:{borderColor:(x.vars||x).palette.error.main},[`&.${outlinedInputClasses.disabled} .${outlinedInputClasses.notchedOutline}`]:{borderColor:(x.vars||x).palette.action.disabled}}},{props:({ownerState:E})=>E.startAdornment,style:{paddingLeft:14}},{props:({ownerState:E})=>E.endAdornment,style:{paddingRight:14}},{props:({ownerState:E})=>E.multiline,style:{padding:"16.5px 14px"}},{props:({ownerState:E,size:w})=>E.multiline&&w==="small",style:{padding:"8.5px 14px"}}]}})),NotchedOutlineRoot=styled(NotchedOutline,{name:"MuiOutlinedInput",slot:"NotchedOutline"})(memoTheme(({theme:x})=>{const C=x.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{borderColor:x.vars?x.alpha(x.vars.palette.common.onBackground,.23):C}})),OutlinedInputInput=styled(InputBaseInput,{name:"MuiOutlinedInput",slot:"Input",overridesResolver:inputOverridesResolver})(memoTheme(({theme:x})=>({padding:"16.5px 14px",...!x.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:x.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:x.palette.mode==="light"?null:"#fff",caretColor:x.palette.mode==="light"?null:"#fff",borderRadius:"inherit"}},...x.vars&&{"&:-webkit-autofill":{borderRadius:"inherit"},[x.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{padding:"8.5px 14px"}},{props:({ownerState:C})=>C.multiline,style:{padding:0}},{props:({ownerState:C})=>C.startAdornment,style:{paddingLeft:0}},{props:({ownerState:C})=>C.endAdornment,style:{paddingRight:0}}]}))),OutlinedInput=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiOutlinedInput"}),{components:T={},fullWidth:_=!1,inputComponent:S="input",label:R,multiline:A=!1,notched:O,slots:H={},slotProps:ee={},type:te="text",...ie}=w,ne=useUtilityClasses$5(w),ae=useFormControl(),oe=formControlState({props:w,muiFormControl:ae,states:["color","disabled","error","focused","hiddenLabel","size","required"]}),le={...w,color:oe.color||"primary",disabled:oe.disabled,error:oe.error,focused:oe.focused,formControl:ae,fullWidth:_,hiddenLabel:oe.hiddenLabel,multiline:A,size:oe.size,type:te},fe=H.root??T.Root??OutlinedInputRoot,de=H.input??T.Input??OutlinedInputInput,[ce,pe]=useSlot("notchedOutline",{elementType:NotchedOutlineRoot,className:ne.notchedOutline,shouldForwardComponentProp:!0,ownerState:le,externalForwardedProps:{slots:H,slotProps:ee},additionalProps:{label:R!=null&&R!==""&&oe.required?jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[R," ","*"]}):R}});return jsxRuntimeExports.jsx(InputBase,{slots:{root:fe,input:de},slotProps:ee,renderSuffix:he=>jsxRuntimeExports.jsx(ce,{...pe,notched:typeof O<"u"?O:!!(he.startAdornment||he.filled||he.focused)}),fullWidth:_,inputComponent:S,multiline:A,ref:E,type:te,...ie,classes:{...ne,notchedOutline:null}})});OutlinedInput.muiName="Input";function getPaginationUtilityClass(x){return generateUtilityClass("MuiPagination",x)}generateUtilityClasses("MuiPagination",["root","ul","outlined","text"]);function usePagination(x={}){const{boundaryCount:C=1,componentName:E="usePagination",count:w=1,defaultPage:T=1,disabled:_=!1,hideNextButton:S=!1,hidePrevButton:R=!1,onChange:A,page:O,showFirstButton:H=!1,showLastButton:ee=!1,siblingCount:te=1,...ie}=x,[ne,ae]=useControlled({controlled:O,default:T,name:E,state:"page"}),oe=(ye,Se)=>{O||ae(Se),A&&A(ye,Se)},le=(ye,Se)=>{const Ce=Se-ye+1;return Array.from({length:Ce},(be,Ee)=>ye+Ee)},fe=le(1,Math.min(C,w)),de=le(Math.max(w-C+1,C+1),w),ce=Math.max(Math.min(ne-te,w-C-te*2-1),C+2),pe=Math.min(Math.max(ne+te,C+te*2+2),w-C-1),he=[...H?["first"]:[],...R?[]:["previous"],...fe,...ce>C+2?["start-ellipsis"]:C+1<w-C?[C+1]:[],...le(ce,pe),...pe<w-C-1?["end-ellipsis"]:w-C>C?[w-C]:[],...de,...S?[]:["next"],...ee?["last"]:[]],me=ye=>{switch(ye){case"first":return 1;case"previous":return ne-1;case"next":return ne+1;case"last":return w;default:return null}};return{items:he.map(ye=>typeof ye=="number"?{onClick:Se=>{oe(Se,ye)},type:"page",page:ye,selected:ye===ne,disabled:_,"aria-current":ye===ne?"page":void 0}:{onClick:Se=>{oe(Se,me(ye))},type:ye,page:me(ye),selected:!1,disabled:_||!ye.includes("ellipsis")&&(ye==="next"||ye==="last"?ne>=w:ne<=1)}),...ie}}function getPaginationItemUtilityClass(x){return generateUtilityClass("MuiPaginationItem",x)}const paginationItemClasses=generateUtilityClasses("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),FirstPageIconDefault=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),LastPageIconDefault=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),NavigateBeforeIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),NavigateNextIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),overridesResolver=(x,C)=>{const{ownerState:E}=x;return[C.root,C[E.variant],C[`size${capitalize(E.size)}`],E.variant==="text"&&C[`text${capitalize(E.color)}`],E.variant==="outlined"&&C[`outlined${capitalize(E.color)}`],E.shape==="rounded"&&C.rounded,E.type==="page"&&C.page,(E.type==="start-ellipsis"||E.type==="end-ellipsis")&&C.ellipsis,(E.type==="previous"||E.type==="next")&&C.previousNext,(E.type==="first"||E.type==="last")&&C.firstLast]},useUtilityClasses$4=x=>{const{classes:C,color:E,disabled:w,selected:T,size:_,shape:S,type:R,variant:A}=x,O={root:["root",`size${capitalize(_)}`,A,S,E!=="standard"&&`color${capitalize(E)}`,E!=="standard"&&`${A}${capitalize(E)}`,w&&"disabled",T&&"selected",{page:"page",first:"firstLast",last:"firstLast","start-ellipsis":"ellipsis","end-ellipsis":"ellipsis",previous:"previousNext",next:"previousNext"}[R]],icon:["icon"]};return composeClasses(O,getPaginationItemUtilityClass,C)},PaginationItemEllipsis=styled("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver})(memoTheme(({theme:x})=>({...x.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,padding:"0 6px",margin:"0 3px",color:(x.vars||x).palette.text.primary,height:"auto",[`&.${paginationItemClasses.disabled}`]:{opacity:(x.vars||x).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:x.typography.pxToRem(15)}}]}))),PaginationItemPage=styled(ButtonBase,{name:"MuiPaginationItem",slot:"Root",overridesResolver})(memoTheme(({theme:x})=>({...x.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,height:32,padding:"0 6px",margin:"0 3px",color:(x.vars||x).palette.text.primary,[`&.${paginationItemClasses.focusVisible}`]:{backgroundColor:(x.vars||x).palette.action.focus},[`&.${paginationItemClasses.disabled}`]:{opacity:(x.vars||x).palette.action.disabledOpacity},transition:x.transitions.create(["color","background-color"],{duration:x.transitions.duration.short}),"&:hover":{backgroundColor:(x.vars||x).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${paginationItemClasses.selected}`]:{backgroundColor:(x.vars||x).palette.action.selected,"&:hover":{backgroundColor:x.alpha((x.vars||x).palette.action.selected,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(x.vars||x).palette.action.selected}},[`&.${paginationItemClasses.focusVisible}`]:{backgroundColor:x.alpha((x.vars||x).palette.action.selected,`${(x.vars||x).palette.action.selectedOpacity} + ${(x.vars||x).palette.action.focusOpacity}`)},[`&.${paginationItemClasses.disabled}`]:{opacity:1,color:(x.vars||x).palette.action.disabled,backgroundColor:(x.vars||x).palette.action.selected}},variants:[{props:{size:"small"},style:{minWidth:26,height:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,height:40,borderRadius:40/2,padding:"0 10px",fontSize:x.typography.pxToRem(15)}},{props:{shape:"rounded"},style:{borderRadius:(x.vars||x).shape.borderRadius}},{props:{variant:"outlined"},style:{border:x.vars?`1px solid ${x.alpha(x.vars.palette.common.onBackground,.23)}`:`1px solid ${x.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${paginationItemClasses.selected}`]:{[`&.${paginationItemClasses.disabled}`]:{borderColor:(x.vars||x).palette.action.disabledBackground,color:(x.vars||x).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${paginationItemClasses.selected}`]:{[`&.${paginationItemClasses.disabled}`]:{color:(x.vars||x).palette.action.disabled}}}},...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["dark","contrastText"])).map(([C])=>({props:{variant:"text",color:C},style:{[`&.${paginationItemClasses.selected}`]:{color:(x.vars||x).palette[C].contrastText,backgroundColor:(x.vars||x).palette[C].main,"&:hover":{backgroundColor:(x.vars||x).palette[C].dark,"@media (hover: none)":{backgroundColor:(x.vars||x).palette[C].main}},[`&.${paginationItemClasses.focusVisible}`]:{backgroundColor:(x.vars||x).palette[C].dark},[`&.${paginationItemClasses.disabled}`]:{color:(x.vars||x).palette.action.disabled}}}})),...Object.entries(x.palette).filter(createSimplePaletteValueFilter(["light"])).map(([C])=>({props:{variant:"outlined",color:C},style:{[`&.${paginationItemClasses.selected}`]:{color:(x.vars||x).palette[C].main,border:`1px solid ${x.alpha((x.vars||x).palette[C].main,.5)}`,backgroundColor:x.alpha((x.vars||x).palette[C].main,(x.vars||x).palette.action.activatedOpacity),"&:hover":{backgroundColor:x.alpha((x.vars||x).palette[C].main,`${(x.vars||x).palette.action.activatedOpacity} + ${(x.vars||x).palette.action.focusOpacity}`),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${paginationItemClasses.focusVisible}`]:{backgroundColor:x.alpha((x.vars||x).palette[C].main,`${(x.vars||x).palette.action.activatedOpacity} + ${(x.vars||x).palette.action.focusOpacity}`)}}}}))]}))),PaginationItemPageIcon=styled("div",{name:"MuiPaginationItem",slot:"Icon"})(memoTheme(({theme:x})=>({fontSize:x.typography.pxToRem(20),margin:"0 -8px",variants:[{props:{size:"small"},style:{fontSize:x.typography.pxToRem(18)}},{props:{size:"large"},style:{fontSize:x.typography.pxToRem(22)}}]}))),PaginationItem=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiPaginationItem"}),{className:T,color:_="standard",component:S,components:R={},disabled:A=!1,page:O,selected:H=!1,shape:ee="circular",size:te="medium",slots:ie={},slotProps:ne={},type:ae="page",variant:oe="text",...le}=w,fe={...w,color:_,disabled:A,selected:H,shape:ee,size:te,type:ae,variant:oe},de=useRtl(),ce=useUtilityClasses$4(fe),pe={slots:{previous:ie.previous??R.previous,next:ie.next??R.next,first:ie.first??R.first,last:ie.last??R.last},slotProps:ne},[he,me]=useSlot("previous",{elementType:NavigateBeforeIcon,externalForwardedProps:pe,ownerState:fe}),[ve,ye]=useSlot("next",{elementType:NavigateNextIcon,externalForwardedProps:pe,ownerState:fe}),[Se,Ce]=useSlot("first",{elementType:FirstPageIconDefault,externalForwardedProps:pe,ownerState:fe}),[be,Ee]=useSlot("last",{elementType:LastPageIconDefault,externalForwardedProps:pe,ownerState:fe}),Ae=de?{previous:"next",next:"previous",first:"last",last:"first"}[ae]:ae,Ie={previous:he,next:ve,first:Se,last:be}[Ae],Te={previous:me,next:ye,first:Ce,last:Ee}[Ae];return ae==="start-ellipsis"||ae==="end-ellipsis"?jsxRuntimeExports.jsx(PaginationItemEllipsis,{ref:E,ownerState:fe,className:clsx(ce.root,T),children:"…"}):jsxRuntimeExports.jsxs(PaginationItemPage,{ref:E,ownerState:fe,component:S,disabled:A,className:clsx(ce.root,T),...le,children:[ae==="page"&&O,Ie?jsxRuntimeExports.jsx(PaginationItemPageIcon,{...Te,className:ce.icon,as:Ie}):null]})}),useUtilityClasses$3=x=>{const{classes:C,variant:E}=x;return composeClasses({root:["root",E],ul:["ul"]},getPaginationUtilityClass,C)},PaginationRoot=styled("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.root,C[E.variant]]}})({}),PaginationUl=styled("ul",{name:"MuiPagination",slot:"Ul"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"});function defaultGetAriaLabel(x,C,E){return x==="page"?`${E?"":"Go to "}page ${C}`:`Go to ${x} page`}const Pagination=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiPagination"}),{boundaryCount:T=1,className:_,color:S="standard",count:R=1,defaultPage:A=1,disabled:O=!1,getItemAriaLabel:H=defaultGetAriaLabel,hideNextButton:ee=!1,hidePrevButton:te=!1,onChange:ie,page:ne,renderItem:ae=Se=>jsxRuntimeExports.jsx(PaginationItem,{...Se}),shape:oe="circular",showFirstButton:le=!1,showLastButton:fe=!1,siblingCount:de=1,size:ce="medium",variant:pe="text",...he}=w,{items:me}=usePagination({...w,componentName:"Pagination"}),ve={...w,boundaryCount:T,color:S,count:R,defaultPage:A,disabled:O,getItemAriaLabel:H,hideNextButton:ee,hidePrevButton:te,renderItem:ae,shape:oe,showFirstButton:le,showLastButton:fe,siblingCount:de,size:ce,variant:pe},ye=useUtilityClasses$3(ve);return jsxRuntimeExports.jsx(PaginationRoot,{"aria-label":"pagination navigation",className:clsx(ye.root,_),ownerState:ve,ref:E,...he,children:jsxRuntimeExports.jsx(PaginationUl,{className:ye.ul,ownerState:ve,children:me.map((Se,Ce)=>jsxRuntimeExports.jsx("li",{children:ae({...Se,color:S,"aria-label":H(Se.type,Se.page,Se.selected),shape:oe,size:ce,variant:pe})},Ce))})})});function getSelectUtilityClasses(x){return generateUtilityClass("MuiSelect",x)}const selectClasses=generateUtilityClasses("MuiSelect",["root","select","multiple","filled","outlined","standard","disabled","focused","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]);var _span;const SelectSelect=styled(StyledSelectSelect,{name:"MuiSelect",slot:"Select",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[{[`&.${selectClasses.select}`]:C.select},{[`&.${selectClasses.select}`]:C[E.variant]},{[`&.${selectClasses.error}`]:C.error},{[`&.${selectClasses.multiple}`]:C.multiple}]}})({[`&.${selectClasses.select}`]:{height:"auto",minHeight:"1.4375em",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}}),SelectIcon=styled(StyledSelectIcon,{name:"MuiSelect",slot:"Icon",overridesResolver:(x,C)=>{const{ownerState:E}=x;return[C.icon,E.variant&&C[`icon${capitalize(E.variant)}`],E.open&&C.iconOpen]}})({}),SelectNativeInput=styled("input",{shouldForwardProp:x=>slotShouldForwardProp(x)&&x!=="classes",name:"MuiSelect",slot:"NativeInput"})({bottom:0,left:0,position:"absolute",opacity:0,pointerEvents:"none",width:"100%",boxSizing:"border-box"});function areEqualValues(x,C){return typeof C=="object"&&C!==null?x===C:String(x)===String(C)}function isEmpty(x){return x==null||typeof x=="string"&&!x.trim()}const useUtilityClasses$2=x=>{const{classes:C,variant:E,disabled:w,multiple:T,open:_,error:S}=x,R={select:["select",E,w&&"disabled",T&&"multiple",S&&"error"],icon:["icon",`icon${capitalize(E)}`,_&&"iconOpen",w&&"disabled"],nativeInput:["nativeInput"]};return composeClasses(R,getSelectUtilityClasses,C)},SelectInput=reactExports.forwardRef(function(C,E){const{"aria-describedby":w,"aria-label":T,autoFocus:_,autoWidth:S,children:R,className:A,defaultOpen:O,defaultValue:H,disabled:ee,displayEmpty:te,error:ie=!1,IconComponent:ne,inputRef:ae,labelId:oe,MenuProps:le={},multiple:fe,name:de,onBlur:ce,onChange:pe,onClose:he,onFocus:me,onOpen:ve,open:ye,readOnly:Se,renderValue:Ce,required:be,SelectDisplayProps:Ee={},tabIndex:Ae,type:Ie,value:Te,variant:De="standard",...Ue}=C,[ze,Pe]=useControlled({controlled:Te,default:H,name:"Select"}),[$e,He]=useControlled({controlled:ye,default:O,name:"Select"}),je=reactExports.useRef(null),Ne=reactExports.useRef(null),[Oe,Ve]=reactExports.useState(null),{current:Ht}=reactExports.useRef(ye!=null),[Kt,ir]=reactExports.useState(),$t=useForkRef(E,ae),tr=reactExports.useCallback(Je=>{Ne.current=Je,Je&&Ve(Je)},[]),ar=Oe?.parentNode;reactExports.useImperativeHandle($t,()=>({focus:()=>{Ne.current.focus()},node:je.current,value:ze}),[ze]),reactExports.useEffect(()=>{O&&$e&&Oe&&!Ht&&(ir(S?null:ar.clientWidth),Ne.current.focus())},[Oe,S]),reactExports.useEffect(()=>{_&&Ne.current.focus()},[_]),reactExports.useEffect(()=>{if(!oe)return;const Je=ownerDocument(Ne.current).getElementById(oe);if(Je){const Re=()=>{getSelection().isCollapsed&&Ne.current.focus()};return Je.addEventListener("click",Re),()=>{Je.removeEventListener("click",Re)}}},[oe]);const gr=(Je,Re)=>{Je?ve&&ve(Re):he&&he(Re),Ht||(ir(S?null:ar.clientWidth),He(Je))},er=Je=>{Je.button===0&&(Je.preventDefault(),Ne.current.focus(),gr(!0,Je))},sr=Je=>{gr(!1,Je)},pr=reactExports.Children.toArray(R),ur=Je=>{const Re=pr.find(Bt=>Bt.props.value===Je.target.value);Re!==void 0&&(Pe(Re.props.value),pe&&pe(Je,Re))},Sr=Je=>Re=>{let Bt;if(Re.currentTarget.hasAttribute("tabindex")){if(fe){Bt=Array.isArray(ze)?ze.slice():[];const Fe=ze.indexOf(Je.props.value);Fe===-1?Bt.push(Je.props.value):Bt.splice(Fe,1)}else Bt=Je.props.value;if(Je.props.onClick&&Je.props.onClick(Re),ze!==Bt&&(Pe(Bt),pe)){const Fe=Re.nativeEvent||Re,Ge=new Fe.constructor(Fe.type,Fe);Object.defineProperty(Ge,"target",{writable:!0,value:{value:Bt,name:de}}),pe(Ge,Je)}fe||gr(!1,Re)}},hr=Je=>{Se||[" ","ArrowUp","ArrowDown","Enter"].includes(Je.key)&&(Je.preventDefault(),gr(!0,Je))},yr=Oe!==null&&$e,xr=Je=>{!yr&&ce&&(Object.defineProperty(Je,"target",{writable:!0,value:{value:ze,name:de}}),ce(Je))};delete Ue["aria-invalid"];let Yt,Jt;const mr=[];let Cr=!1;(isFilled({value:ze})||te)&&(Ce?Yt=Ce(ze):Cr=!0);const zt=pr.map(Je=>{if(!reactExports.isValidElement(Je))return null;let Re;if(fe){if(!Array.isArray(ze))throw new Error(formatMuiErrorMessage(2));Re=ze.some(Bt=>areEqualValues(Bt,Je.props.value)),Re&&Cr&&mr.push(Je.props.children)}else Re=areEqualValues(ze,Je.props.value),Re&&Cr&&(Jt=Je.props.children);return reactExports.cloneElement(Je,{"aria-selected":Re?"true":"false",onClick:Sr(Je),onKeyUp:Bt=>{Bt.key===" "&&Bt.preventDefault(),Je.props.onKeyUp&&Je.props.onKeyUp(Bt)},role:"option",selected:Re,value:void 0,"data-value":Je.props.value})});Cr&&(fe?mr.length===0?Yt=null:Yt=mr.reduce((Je,Re,Bt)=>(Je.push(Re),Bt<mr.length-1&&Je.push(", "),Je),[]):Yt=Jt);let Ft=Kt;!S&&Ht&&Oe&&(Ft=ar.clientWidth);let kt;typeof Ae<"u"?kt=Ae:kt=ee?null:0;const ke=Ee.id||(de?`mui-component-select-${de}`:void 0),Be={...C,variant:De,value:ze,open:yr,error:ie},et=useUtilityClasses$2(Be),Ze={...le.PaperProps,...typeof le.slotProps?.paper=="function"?le.slotProps.paper(Be):le.slotProps?.paper},Qe={...le.MenuListProps,...typeof le.slotProps?.list=="function"?le.slotProps.list(Be):le.slotProps?.list},Ke=useId();return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(SelectSelect,{as:"div",ref:tr,tabIndex:kt,role:"combobox","aria-controls":yr?Ke:void 0,"aria-disabled":ee?"true":void 0,"aria-expanded":yr?"true":"false","aria-haspopup":"listbox","aria-label":T,"aria-labelledby":[oe,ke].filter(Boolean).join(" ")||void 0,"aria-describedby":w,"aria-required":be?"true":void 0,"aria-invalid":ie?"true":void 0,onKeyDown:hr,onMouseDown:ee||Se?null:er,onBlur:xr,onFocus:me,...Ee,ownerState:Be,className:clsx(Ee.className,et.select,A),id:ke,children:isEmpty(Yt)?_span||(_span=jsxRuntimeExports.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"})):Yt}),jsxRuntimeExports.jsx(SelectNativeInput,{"aria-invalid":ie,value:Array.isArray(ze)?ze.join(","):ze,name:de,ref:je,"aria-hidden":!0,onChange:ur,tabIndex:-1,disabled:ee,className:et.nativeInput,autoFocus:_,required:be,...Ue,ownerState:Be}),jsxRuntimeExports.jsx(SelectIcon,{as:ne,className:et.icon,ownerState:Be}),jsxRuntimeExports.jsx(Menu,{id:`menu-${de||""}`,anchorEl:ar,open:yr,onClose:sr,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...le,slotProps:{...le.slotProps,list:{"aria-labelledby":oe,role:"listbox","aria-multiselectable":fe?"true":void 0,disableListWrap:!0,id:Ke,...Qe},paper:{...Ze,style:{minWidth:Ft,...Ze!=null?Ze.style:null}}},children:zt})]})}),useUtilityClasses$1=x=>{const{classes:C}=x,w=composeClasses({root:["root"]},getSelectUtilityClasses,C);return{...C,...w}},styledRootConfig={name:"MuiSelect",slot:"Root",shouldForwardProp:x=>rootShouldForwardProp(x)&&x!=="variant"},StyledInput=styled(Input,styledRootConfig)(""),StyledOutlinedInput=styled(OutlinedInput,styledRootConfig)(""),StyledFilledInput=styled(FilledInput,styledRootConfig)(""),Select=reactExports.forwardRef(function(C,E){const w=useDefaultProps({name:"MuiSelect",props:C}),{autoWidth:T=!1,children:_,classes:S={},className:R,defaultOpen:A=!1,displayEmpty:O=!1,IconComponent:H=ArrowDropDownIcon,id:ee,input:te,inputProps:ie,label:ne,labelId:ae,MenuProps:oe,multiple:le=!1,native:fe=!1,onClose:de,onOpen:ce,open:pe,renderValue:he,SelectDisplayProps:me,variant:ve="outlined",...ye}=w,Se=fe?NativeSelectInput:SelectInput,Ce=useFormControl(),be=formControlState({props:w,muiFormControl:Ce,states:["variant","error"]}),Ee=be.variant||ve,Ae={...w,variant:Ee,classes:S},Ie=useUtilityClasses$1(Ae),{root:Te,...De}=Ie,Ue=te||{standard:jsxRuntimeExports.jsx(StyledInput,{ownerState:Ae}),outlined:jsxRuntimeExports.jsx(StyledOutlinedInput,{label:ne,ownerState:Ae}),filled:jsxRuntimeExports.jsx(StyledFilledInput,{ownerState:Ae})}[Ee],ze=useForkRef(E,getReactElementRef(Ue));return jsxRuntimeExports.jsx(reactExports.Fragment,{children:reactExports.cloneElement(Ue,{inputComponent:Se,inputProps:{children:_,error:be.error,IconComponent:H,variant:Ee,type:void 0,multiple:le,...fe?{id:ee}:{autoWidth:T,defaultOpen:A,displayEmpty:O,labelId:ae,MenuProps:oe,onClose:de,onOpen:ce,open:pe,renderValue:he,SelectDisplayProps:{id:ee,...me}},...ie,classes:ie?deepmerge(De,ie.classes):De,...te?te.props.inputProps:{}},...(le&&fe||O)&&Ee==="outlined"?{notched:!0}:{},ref:ze,className:clsx(Ue.props.className,R,Ie.root),...!te&&{variant:Ee},...ye})})});Select.muiName="Select";const Stack=createStack({createStyledComponent:styled("div",{name:"MuiStack",slot:"Root"}),useThemeProps:x=>useDefaultProps({props:x,name:"MuiStack"})});function getTextFieldUtilityClass(x){return generateUtilityClass("MuiTextField",x)}generateUtilityClasses("MuiTextField",["root"]);const variantComponent={standard:Input,filled:FilledInput,outlined:OutlinedInput},useUtilityClasses=x=>{const{classes:C}=x;return composeClasses({root:["root"]},getTextFieldUtilityClass,C)},TextFieldRoot=styled(FormControl,{name:"MuiTextField",slot:"Root"})({}),TextField=reactExports.forwardRef(function(C,E){const w=useDefaultProps({props:C,name:"MuiTextField"}),{autoComplete:T,autoFocus:_=!1,children:S,className:R,color:A="primary",defaultValue:O,disabled:H=!1,error:ee=!1,FormHelperTextProps:te,fullWidth:ie=!1,helperText:ne,id:ae,InputLabelProps:oe,inputProps:le,InputProps:fe,inputRef:de,label:ce,maxRows:pe,minRows:he,multiline:me=!1,name:ve,onBlur:ye,onChange:Se,onFocus:Ce,placeholder:be,required:Ee=!1,rows:Ae,select:Ie=!1,SelectProps:Te,slots:De={},slotProps:Ue={},type:ze,value:Pe,variant:$e="outlined",...He}=w,je={...w,autoFocus:_,color:A,disabled:H,error:ee,fullWidth:ie,multiline:me,required:Ee,select:Ie,variant:$e},Ne=useUtilityClasses(je),Oe=useId(ae),Ve=ne&&Oe?`${Oe}-helper-text`:void 0,Ht=ce&&Oe?`${Oe}-label`:void 0,Kt=variantComponent[$e],ir={slots:De,slotProps:{input:fe,inputLabel:oe,htmlInput:le,formHelperText:te,select:Te,...Ue}},$t={},tr=ir.slotProps.inputLabel;$e==="outlined"&&(tr&&typeof tr.shrink<"u"&&($t.notched=tr.shrink),$t.label=ce),Ie&&((!Te||!Te.native)&&($t.id=void 0),$t["aria-describedby"]=void 0);const[ar,gr]=useSlot("root",{elementType:TextFieldRoot,shouldForwardComponentProp:!0,externalForwardedProps:{...ir,...He},ownerState:je,className:clsx(Ne.root,R),ref:E,additionalProps:{disabled:H,error:ee,fullWidth:ie,required:Ee,color:A,variant:$e}}),[er,sr]=useSlot("input",{elementType:Kt,externalForwardedProps:ir,additionalProps:$t,ownerState:je}),[pr,ur]=useSlot("inputLabel",{elementType:InputLabel,externalForwardedProps:ir,ownerState:je}),[Sr,hr]=useSlot("htmlInput",{elementType:"input",externalForwardedProps:ir,ownerState:je}),[yr,xr]=useSlot("formHelperText",{elementType:FormHelperText,externalForwardedProps:ir,ownerState:je}),[Yt,Jt]=useSlot("select",{elementType:Select,externalForwardedProps:ir,ownerState:je}),mr=jsxRuntimeExports.jsx(er,{"aria-describedby":Ve,autoComplete:T,autoFocus:_,defaultValue:O,fullWidth:ie,multiline:me,name:ve,rows:Ae,maxRows:pe,minRows:he,type:ze,value:Pe,id:Oe,inputRef:de,onBlur:ye,onChange:Se,onFocus:Ce,placeholder:be,inputProps:hr,slots:{input:De.htmlInput?Sr:void 0},...sr});return jsxRuntimeExports.jsxs(ar,{...gr,children:[ce!=null&&ce!==""&&jsxRuntimeExports.jsx(pr,{htmlFor:Oe,id:Ht,...ur,children:ce}),Ie?jsxRuntimeExports.jsx(Yt,{"aria-describedby":Ve,id:Oe,labelId:Ht,value:Pe,input:mr,...Jt,children:S}):mr,ne&&jsxRuntimeExports.jsx(yr,{id:Ve,...xr,children:ne})]})}),AUDIO_ELEMENT_FOR_PLAY_RESULT="audio-result",AUDIO_ELEMENT_FOR_PLAY_MONITOR="audio-monitor",AUDIO_ELEMENT_FOR_INPUT_MEDIA="AUDIO_ELEMENT_FOR_INPUT_MEDIA",AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK="AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK",LightModeIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),DarkModeIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),LanguageIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"})),DownloadIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),isString=x=>typeof x=="string",defer=()=>{let x,C;const E=new Promise((w,T)=>{x=w,C=T});return E.resolve=x,E.reject=C,E},makeString=x=>x==null?"":""+x,copy=(x,C,E)=>{x.forEach(w=>{C[w]&&(E[w]=C[w])})},lastOfPathSeparatorRegExp=/###/g,cleanKey=x=>x&&x.indexOf("###")>-1?x.replace(lastOfPathSeparatorRegExp,"."):x,canNotTraverseDeeper=x=>!x||isString(x),getLastOfPath=(x,C,E)=>{const w=isString(C)?C.split("."):C;let T=0;for(;T<w.length-1;){if(canNotTraverseDeeper(x))return{};const _=cleanKey(w[T]);!x[_]&&E&&(x[_]=new E),Object.prototype.hasOwnProperty.call(x,_)?x=x[_]:x={},++T}return canNotTraverseDeeper(x)?{}:{obj:x,k:cleanKey(w[T])}},setPath=(x,C,E)=>{const{obj:w,k:T}=getLastOfPath(x,C,Object);if(w!==void 0||C.length===1){w[T]=E;return}let _=C[C.length-1],S=C.slice(0,C.length-1),R=getLastOfPath(x,S,Object);for(;R.obj===void 0&&S.length;)_=`${S[S.length-1]}.${_}`,S=S.slice(0,S.length-1),R=getLastOfPath(x,S,Object),R?.obj&&typeof R.obj[`${R.k}.${_}`]<"u"&&(R.obj=void 0);R.obj[`${R.k}.${_}`]=E},pushPath=(x,C,E,w)=>{const{obj:T,k:_}=getLastOfPath(x,C,Object);T[_]=T[_]||[],T[_].push(E)},getPath=(x,C)=>{const{obj:E,k:w}=getLastOfPath(x,C);if(E&&Object.prototype.hasOwnProperty.call(E,w))return E[w]},getPathWithDefaults=(x,C,E)=>{const w=getPath(x,E);return w!==void 0?w:getPath(C,E)},deepExtend=(x,C,E)=>{for(const w in C)w!=="__proto__"&&w!=="constructor"&&(w in x?isString(x[w])||x[w]instanceof String||isString(C[w])||C[w]instanceof String?E&&(x[w]=C[w]):deepExtend(x[w],C[w],E):x[w]=C[w]);return x},regexEscape=x=>x.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var _entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const escape=x=>isString(x)?x.replace(/[&<>"'\/]/g,C=>_entityMap[C]):x;class RegExpCache{constructor(C){this.capacity=C,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(C){const E=this.regExpMap.get(C);if(E!==void 0)return E;const w=new RegExp(C);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(C,w),this.regExpQueue.push(C),w}}const chars$1=[" ",",","?","!",";"],looksLikeObjectPathRegExpCache=new RegExpCache(20),looksLikeObjectPath=(x,C,E)=>{C=C||"",E=E||"";const w=chars$1.filter(S=>C.indexOf(S)<0&&E.indexOf(S)<0);if(w.length===0)return!0;const T=looksLikeObjectPathRegExpCache.getRegExp(`(${w.map(S=>S==="?"?"\\?":S).join("|")})`);let _=!T.test(x);if(!_){const S=x.indexOf(E);S>0&&!T.test(x.substring(0,S))&&(_=!0)}return _},deepFind=(x,C,E=".")=>{if(!x)return;if(x[C])return Object.prototype.hasOwnProperty.call(x,C)?x[C]:void 0;const w=C.split(E);let T=x;for(let _=0;_<w.length;){if(!T||typeof T!="object")return;let S,R="";for(let A=_;A<w.length;++A)if(A!==_&&(R+=E),R+=w[A],S=T[R],S!==void 0){if(["string","number","boolean"].indexOf(typeof S)>-1&&A<w.length-1)continue;_+=A-_+1;break}T=S}return T},getCleanedCode=x=>x?.replace("_","-"),consoleLogger={type:"logger",log(x){this.output("log",x)},warn(x){this.output("warn",x)},error(x){this.output("error",x)},output(x,C){console?.[x]?.apply?.(console,C)}};class Logger{constructor(C,E={}){this.init(C,E)}init(C,E={}){this.prefix=E.prefix||"i18next:",this.logger=C||consoleLogger,this.options=E,this.debug=E.debug}log(...C){return this.forward(C,"log","",!0)}warn(...C){return this.forward(C,"warn","",!0)}error(...C){return this.forward(C,"error","")}deprecate(...C){return this.forward(C,"warn","WARNING DEPRECATED: ",!0)}forward(C,E,w,T){return T&&!this.debug?null:(isString(C[0])&&(C[0]=`${w}${this.prefix} ${C[0]}`),this.logger[E](C))}create(C){return new Logger(this.logger,{prefix:`${this.prefix}:${C}:`,...this.options})}clone(C){return C=C||this.options,C.prefix=C.prefix||this.prefix,new Logger(this.logger,C)}}var baseLogger=new Logger;class EventEmitter{constructor(){this.observers={}}on(C,E){return C.split(" ").forEach(w=>{this.observers[w]||(this.observers[w]=new Map);const T=this.observers[w].get(E)||0;this.observers[w].set(E,T+1)}),this}off(C,E){if(this.observers[C]){if(!E){delete this.observers[C];return}this.observers[C].delete(E)}}emit(C,...E){this.observers[C]&&Array.from(this.observers[C].entries()).forEach(([T,_])=>{for(let S=0;S<_;S++)T(...E)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([T,_])=>{for(let S=0;S<_;S++)T.apply(T,[C,...E])})}}class ResourceStore extends EventEmitter{constructor(C,E={ns:["translation"],defaultNS:"translation"}){super(),this.data=C||{},this.options=E,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(C){this.options.ns.indexOf(C)<0&&this.options.ns.push(C)}removeNamespaces(C){const E=this.options.ns.indexOf(C);E>-1&&this.options.ns.splice(E,1)}getResource(C,E,w,T={}){const _=T.keySeparator!==void 0?T.keySeparator:this.options.keySeparator,S=T.ignoreJSONStructure!==void 0?T.ignoreJSONStructure:this.options.ignoreJSONStructure;let R;C.indexOf(".")>-1?R=C.split("."):(R=[C,E],w&&(Array.isArray(w)?R.push(...w):isString(w)&&_?R.push(...w.split(_)):R.push(w)));const A=getPath(this.data,R);return!A&&!E&&!w&&C.indexOf(".")>-1&&(C=R[0],E=R[1],w=R.slice(2).join(".")),A||!S||!isString(w)?A:deepFind(this.data?.[C]?.[E],w,_)}addResource(C,E,w,T,_={silent:!1}){const S=_.keySeparator!==void 0?_.keySeparator:this.options.keySeparator;let R=[C,E];w&&(R=R.concat(S?w.split(S):w)),C.indexOf(".")>-1&&(R=C.split("."),T=E,E=R[1]),this.addNamespaces(E),setPath(this.data,R,T),_.silent||this.emit("added",C,E,w,T)}addResources(C,E,w,T={silent:!1}){for(const _ in w)(isString(w[_])||Array.isArray(w[_]))&&this.addResource(C,E,_,w[_],{silent:!0});T.silent||this.emit("added",C,E,w)}addResourceBundle(C,E,w,T,_,S={silent:!1,skipCopy:!1}){let R=[C,E];C.indexOf(".")>-1&&(R=C.split("."),T=w,w=E,E=R[1]),this.addNamespaces(E);let A=getPath(this.data,R)||{};S.skipCopy||(w=JSON.parse(JSON.stringify(w))),T?deepExtend(A,w,_):A={...A,...w},setPath(this.data,R,A),S.silent||this.emit("added",C,E,w)}removeResourceBundle(C,E){this.hasResourceBundle(C,E)&&delete this.data[C][E],this.removeNamespaces(E),this.emit("removed",C,E)}hasResourceBundle(C,E){return this.getResource(C,E)!==void 0}getResourceBundle(C,E){return E||(E=this.options.defaultNS),this.getResource(C,E)}getDataByLanguage(C){return this.data[C]}hasLanguageSomeTranslations(C){const E=this.getDataByLanguage(C);return!!(E&&Object.keys(E)||[]).find(T=>E[T]&&Object.keys(E[T]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(x){this.processors[x.name]=x},handle(x,C,E,w,T){return x.forEach(_=>{C=this.processors[_]?.process(C,E,w,T)??C}),C}};const PATH_KEY=Symbol("i18next/PATH_KEY");function createProxy(){const x=[],C=Object.create(null);let E;return C.get=(w,T)=>(E?.revoke?.(),T===PATH_KEY?x:(x.push(T),E=Proxy.revocable(w,C),E.proxy)),Proxy.revocable(Object.create(null),C).proxy}function keysFromSelector(x,C){const{[PATH_KEY]:E}=x(createProxy());return E.join(C?.keySeparator??".")}const checkedLoadedFor={},shouldHandleAsObject=x=>!isString(x)&&typeof x!="boolean"&&typeof x!="number";class Translator extends EventEmitter{constructor(C,E={}){super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],C,this),this.options=E,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(C){C&&(this.language=C)}exists(C,E={interpolation:{}}){const w={...E};return C==null?!1:this.resolve(C,w)?.res!==void 0}extractFromKey(C,E){let w=E.nsSeparator!==void 0?E.nsSeparator:this.options.nsSeparator;w===void 0&&(w=":");const T=E.keySeparator!==void 0?E.keySeparator:this.options.keySeparator;let _=E.ns||this.options.defaultNS||[];const S=w&&C.indexOf(w)>-1,R=!this.options.userDefinedKeySeparator&&!E.keySeparator&&!this.options.userDefinedNsSeparator&&!E.nsSeparator&&!looksLikeObjectPath(C,w,T);if(S&&!R){const A=C.match(this.interpolator.nestingRegexp);if(A&&A.length>0)return{key:C,namespaces:isString(_)?[_]:_};const O=C.split(w);(w!==T||w===T&&this.options.ns.indexOf(O[0])>-1)&&(_=O.shift()),C=O.join(T)}return{key:C,namespaces:isString(_)?[_]:_}}translate(C,E,w){let T=typeof E=="object"?{...E}:E;if(typeof T!="object"&&this.options.overloadTranslationOptionHandler&&(T=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(T={...T}),T||(T={}),C==null)return"";typeof C=="function"&&(C=keysFromSelector(C,T)),Array.isArray(C)||(C=[String(C)]);const _=T.returnDetails!==void 0?T.returnDetails:this.options.returnDetails,S=T.keySeparator!==void 0?T.keySeparator:this.options.keySeparator,{key:R,namespaces:A}=this.extractFromKey(C[C.length-1],T),O=A[A.length-1];let H=T.nsSeparator!==void 0?T.nsSeparator:this.options.nsSeparator;H===void 0&&(H=":");const ee=T.lng||this.language,te=T.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(ee?.toLowerCase()==="cimode")return te?_?{res:`${O}${H}${R}`,usedKey:R,exactUsedKey:R,usedLng:ee,usedNS:O,usedParams:this.getUsedParamsDetails(T)}:`${O}${H}${R}`:_?{res:R,usedKey:R,exactUsedKey:R,usedLng:ee,usedNS:O,usedParams:this.getUsedParamsDetails(T)}:R;const ie=this.resolve(C,T);let ne=ie?.res;const ae=ie?.usedKey||R,oe=ie?.exactUsedKey||R,le=["[object Number]","[object Function]","[object RegExp]"],fe=T.joinArrays!==void 0?T.joinArrays:this.options.joinArrays,de=!this.i18nFormat||this.i18nFormat.handleAsObject,ce=T.count!==void 0&&!isString(T.count),pe=Translator.hasDefaultValue(T),he=ce?this.pluralResolver.getSuffix(ee,T.count,T):"",me=T.ordinal&&ce?this.pluralResolver.getSuffix(ee,T.count,{ordinal:!1}):"",ve=ce&&!T.ordinal&&T.count===0,ye=ve&&T[`defaultValue${this.options.pluralSeparator}zero`]||T[`defaultValue${he}`]||T[`defaultValue${me}`]||T.defaultValue;let Se=ne;de&&!ne&&pe&&(Se=ye);const Ce=shouldHandleAsObject(Se),be=Object.prototype.toString.apply(Se);if(de&&Se&&Ce&&le.indexOf(be)<0&&!(isString(fe)&&Array.isArray(Se))){if(!T.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Ee=this.options.returnedObjectHandler?this.options.returnedObjectHandler(ae,Se,{...T,ns:A}):`key '${R} (${this.language})' returned an object instead of string.`;return _?(ie.res=Ee,ie.usedParams=this.getUsedParamsDetails(T),ie):Ee}if(S){const Ee=Array.isArray(Se),Ae=Ee?[]:{},Ie=Ee?oe:ae;for(const Te in Se)if(Object.prototype.hasOwnProperty.call(Se,Te)){const De=`${Ie}${S}${Te}`;pe&&!ne?Ae[Te]=this.translate(De,{...T,defaultValue:shouldHandleAsObject(ye)?ye[Te]:void 0,joinArrays:!1,ns:A}):Ae[Te]=this.translate(De,{...T,joinArrays:!1,ns:A}),Ae[Te]===De&&(Ae[Te]=Se[Te])}ne=Ae}}else if(de&&isString(fe)&&Array.isArray(ne))ne=ne.join(fe),ne&&(ne=this.extendTranslation(ne,C,T,w));else{let Ee=!1,Ae=!1;!this.isValidLookup(ne)&&pe&&(Ee=!0,ne=ye),this.isValidLookup(ne)||(Ae=!0,ne=R);const Te=(T.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Ae?void 0:ne,De=pe&&ye!==ne&&this.options.updateMissing;if(Ae||Ee||De){if(this.logger.log(De?"updateKey":"missingKey",ee,O,R,De?ye:ne),S){const $e=this.resolve(R,{...T,keySeparator:!1});$e&&$e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Ue=[];const ze=this.languageUtils.getFallbackCodes(this.options.fallbackLng,T.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ze&&ze[0])for(let $e=0;$e<ze.length;$e++)Ue.push(ze[$e]);else this.options.saveMissingTo==="all"?Ue=this.languageUtils.toResolveHierarchy(T.lng||this.language):Ue.push(T.lng||this.language);const Pe=($e,He,je)=>{const Ne=pe&&je!==ne?je:Te;this.options.missingKeyHandler?this.options.missingKeyHandler($e,O,He,Ne,De,T):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing($e,O,He,Ne,De,T),this.emit("missingKey",$e,O,He,ne)};this.options.saveMissing&&(this.options.saveMissingPlurals&&ce?Ue.forEach($e=>{const He=this.pluralResolver.getSuffixes($e,T);ve&&T[`defaultValue${this.options.pluralSeparator}zero`]&&He.indexOf(`${this.options.pluralSeparator}zero`)<0&&He.push(`${this.options.pluralSeparator}zero`),He.forEach(je=>{Pe([$e],R+je,T[`defaultValue${je}`]||ye)})}):Pe(Ue,R,ye))}ne=this.extendTranslation(ne,C,T,ie,w),Ae&&ne===R&&this.options.appendNamespaceToMissingKey&&(ne=`${O}${H}${R}`),(Ae||Ee)&&this.options.parseMissingKeyHandler&&(ne=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${O}${H}${R}`:R,Ee?ne:void 0,T))}return _?(ie.res=ne,ie.usedParams=this.getUsedParamsDetails(T),ie):ne}extendTranslation(C,E,w,T,_){if(this.i18nFormat?.parse)C=this.i18nFormat.parse(C,{...this.options.interpolation.defaultVariables,...w},w.lng||this.language||T.usedLng,T.usedNS,T.usedKey,{resolved:T});else if(!w.skipInterpolation){w.interpolation&&this.interpolator.init({...w,interpolation:{...this.options.interpolation,...w.interpolation}});const A=isString(C)&&(w?.interpolation?.skipOnVariables!==void 0?w.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let O;if(A){const ee=C.match(this.interpolator.nestingRegexp);O=ee&&ee.length}let H=w.replace&&!isString(w.replace)?w.replace:w;if(this.options.interpolation.defaultVariables&&(H={...this.options.interpolation.defaultVariables,...H}),C=this.interpolator.interpolate(C,H,w.lng||this.language||T.usedLng,w),A){const ee=C.match(this.interpolator.nestingRegexp),te=ee&&ee.length;O<te&&(w.nest=!1)}!w.lng&&T&&T.res&&(w.lng=this.language||T.usedLng),w.nest!==!1&&(C=this.interpolator.nest(C,(...ee)=>_?.[0]===ee[0]&&!w.context?(this.logger.warn(`It seems you are nesting recursively key: ${ee[0]} in key: ${E[0]}`),null):this.translate(...ee,E),w)),w.interpolation&&this.interpolator.reset()}const S=w.postProcess||this.options.postProcess,R=isString(S)?[S]:S;return C!=null&&R?.length&&w.applyPostProcessor!==!1&&(C=postProcessor.handle(R,C,E,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...T,usedParams:this.getUsedParamsDetails(w)},...w}:w,this)),C}resolve(C,E={}){let w,T,_,S,R;return isString(C)&&(C=[C]),C.forEach(A=>{if(this.isValidLookup(w))return;const O=this.extractFromKey(A,E),H=O.key;T=H;let ee=O.namespaces;this.options.fallbackNS&&(ee=ee.concat(this.options.fallbackNS));const te=E.count!==void 0&&!isString(E.count),ie=te&&!E.ordinal&&E.count===0,ne=E.context!==void 0&&(isString(E.context)||typeof E.context=="number")&&E.context!=="",ae=E.lngs?E.lngs:this.languageUtils.toResolveHierarchy(E.lng||this.language,E.fallbackLng);ee.forEach(oe=>{this.isValidLookup(w)||(R=oe,!checkedLoadedFor[`${ae[0]}-${oe}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(R)&&(checkedLoadedFor[`${ae[0]}-${oe}`]=!0,this.logger.warn(`key "${T}" for languages "${ae.join(", ")}" won't get resolved as namespace "${R}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),ae.forEach(le=>{if(this.isValidLookup(w))return;S=le;const fe=[H];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(fe,H,le,oe,E);else{let ce;te&&(ce=this.pluralResolver.getSuffix(le,E.count,E));const pe=`${this.options.pluralSeparator}zero`,he=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(te&&(E.ordinal&&ce.indexOf(he)===0&&fe.push(H+ce.replace(he,this.options.pluralSeparator)),fe.push(H+ce),ie&&fe.push(H+pe)),ne){const me=`${H}${this.options.contextSeparator||"_"}${E.context}`;fe.push(me),te&&(E.ordinal&&ce.indexOf(he)===0&&fe.push(me+ce.replace(he,this.options.pluralSeparator)),fe.push(me+ce),ie&&fe.push(me+pe))}}let de;for(;de=fe.pop();)this.isValidLookup(w)||(_=de,w=this.getResource(le,oe,de,E))}))})}),{res:w,usedKey:T,exactUsedKey:_,usedLng:S,usedNS:R}}isValidLookup(C){return C!==void 0&&!(!this.options.returnNull&&C===null)&&!(!this.options.returnEmptyString&&C==="")}getResource(C,E,w,T={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(C,E,w,T):this.resourceStore.getResource(C,E,w,T)}getUsedParamsDetails(C={}){const E=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],w=C.replace&&!isString(C.replace);let T=w?C.replace:C;if(w&&typeof C.count<"u"&&(T.count=C.count),this.options.interpolation.defaultVariables&&(T={...this.options.interpolation.defaultVariables,...T}),!w){T={...T};for(const _ of E)delete T[_]}return T}static hasDefaultValue(C){const E="defaultValue";for(const w in C)if(Object.prototype.hasOwnProperty.call(C,w)&&E===w.substring(0,E.length)&&C[w]!==void 0)return!0;return!1}}class LanguageUtil{constructor(C){this.options=C,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(C){if(C=getCleanedCode(C),!C||C.indexOf("-")<0)return null;const E=C.split("-");return E.length===2||(E.pop(),E[E.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(E.join("-"))}getLanguagePartFromCode(C){if(C=getCleanedCode(C),!C||C.indexOf("-")<0)return C;const E=C.split("-");return this.formatLanguageCode(E[0])}formatLanguageCode(C){if(isString(C)&&C.indexOf("-")>-1){let E;try{E=Intl.getCanonicalLocales(C)[0]}catch{}return E&&this.options.lowerCaseLng&&(E=E.toLowerCase()),E||(this.options.lowerCaseLng?C.toLowerCase():C)}return this.options.cleanCode||this.options.lowerCaseLng?C.toLowerCase():C}isSupportedCode(C){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(C=this.getLanguagePartFromCode(C)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(C)>-1}getBestMatchFromCodes(C){if(!C)return null;let E;return C.forEach(w=>{if(E)return;const T=this.formatLanguageCode(w);(!this.options.supportedLngs||this.isSupportedCode(T))&&(E=T)}),!E&&this.options.supportedLngs&&C.forEach(w=>{if(E)return;const T=this.getScriptPartFromCode(w);if(this.isSupportedCode(T))return E=T;const _=this.getLanguagePartFromCode(w);if(this.isSupportedCode(_))return E=_;E=this.options.supportedLngs.find(S=>{if(S===_)return S;if(!(S.indexOf("-")<0&&_.indexOf("-")<0)&&(S.indexOf("-")>0&&_.indexOf("-")<0&&S.substring(0,S.indexOf("-"))===_||S.indexOf(_)===0&&_.length>1))return S})}),E||(E=this.getFallbackCodes(this.options.fallbackLng)[0]),E}getFallbackCodes(C,E){if(!C)return[];if(typeof C=="function"&&(C=C(E)),isString(C)&&(C=[C]),Array.isArray(C))return C;if(!E)return C.default||[];let w=C[E];return w||(w=C[this.getScriptPartFromCode(E)]),w||(w=C[this.formatLanguageCode(E)]),w||(w=C[this.getLanguagePartFromCode(E)]),w||(w=C.default),w||[]}toResolveHierarchy(C,E){const w=this.getFallbackCodes((E===!1?[]:E)||this.options.fallbackLng||[],C),T=[],_=S=>{S&&(this.isSupportedCode(S)?T.push(S):this.logger.warn(`rejecting language code not found in supportedLngs: ${S}`))};return isString(C)&&(C.indexOf("-")>-1||C.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&_(this.formatLanguageCode(C)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&_(this.getScriptPartFromCode(C)),this.options.load!=="currentOnly"&&_(this.getLanguagePartFromCode(C))):isString(C)&&_(this.formatLanguageCode(C)),w.forEach(S=>{T.indexOf(S)<0&&_(this.formatLanguageCode(S))}),T}}const suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5},dummyRule={select:x=>x===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class PluralResolver{constructor(C,E={}){this.languageUtils=C,this.options=E,this.logger=baseLogger.create("pluralResolver"),this.pluralRulesCache={}}addRule(C,E){this.rules[C]=E}clearCache(){this.pluralRulesCache={}}getRule(C,E={}){const w=getCleanedCode(C==="dev"?"en":C),T=E.ordinal?"ordinal":"cardinal",_=JSON.stringify({cleanedCode:w,type:T});if(_ in this.pluralRulesCache)return this.pluralRulesCache[_];let S;try{S=new Intl.PluralRules(w,{type:T})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),dummyRule;if(!C.match(/-|_/))return dummyRule;const A=this.languageUtils.getLanguagePartFromCode(C);S=this.getRule(A,E)}return this.pluralRulesCache[_]=S,S}needsPlural(C,E={}){let w=this.getRule(C,E);return w||(w=this.getRule("dev",E)),w?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(C,E,w={}){return this.getSuffixes(C,w).map(T=>`${E}${T}`)}getSuffixes(C,E={}){let w=this.getRule(C,E);return w||(w=this.getRule("dev",E)),w?w.resolvedOptions().pluralCategories.sort((T,_)=>suffixesOrder[T]-suffixesOrder[_]).map(T=>`${this.options.prepend}${E.ordinal?`ordinal${this.options.prepend}`:""}${T}`):[]}getSuffix(C,E,w={}){const T=this.getRule(C,w);return T?`${this.options.prepend}${w.ordinal?`ordinal${this.options.prepend}`:""}${T.select(E)}`:(this.logger.warn(`no plural rule found for: ${C}`),this.getSuffix("dev",E,w))}}const deepFindWithDefaults=(x,C,E,w=".",T=!0)=>{let _=getPathWithDefaults(x,C,E);return!_&&T&&isString(E)&&(_=deepFind(x,E,w),_===void 0&&(_=deepFind(C,E,w))),_},regexSafe=x=>x.replace(/\$/g,"$$$$");class Interpolator{constructor(C={}){this.logger=baseLogger.create("interpolator"),this.options=C,this.format=C?.interpolation?.format||(E=>E),this.init(C)}init(C={}){C.interpolation||(C.interpolation={escapeValue:!0});const{escape:E,escapeValue:w,useRawValueToEscape:T,prefix:_,prefixEscaped:S,suffix:R,suffixEscaped:A,formatSeparator:O,unescapeSuffix:H,unescapePrefix:ee,nestingPrefix:te,nestingPrefixEscaped:ie,nestingSuffix:ne,nestingSuffixEscaped:ae,nestingOptionsSeparator:oe,maxReplaces:le,alwaysFormat:fe}=C.interpolation;this.escape=E!==void 0?E:escape,this.escapeValue=w!==void 0?w:!0,this.useRawValueToEscape=T!==void 0?T:!1,this.prefix=_?regexEscape(_):S||"{{",this.suffix=R?regexEscape(R):A||"}}",this.formatSeparator=O||",",this.unescapePrefix=H?"":ee||"-",this.unescapeSuffix=this.unescapePrefix?"":H||"",this.nestingPrefix=te?regexEscape(te):ie||regexEscape("$t("),this.nestingSuffix=ne?regexEscape(ne):ae||regexEscape(")"),this.nestingOptionsSeparator=oe||",",this.maxReplaces=le||1e3,this.alwaysFormat=fe!==void 0?fe:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const C=(E,w)=>E?.source===w?(E.lastIndex=0,E):new RegExp(w,"g");this.regexp=C(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=C(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=C(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(C,E,w,T){let _,S,R;const A=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},O=ie=>{if(ie.indexOf(this.formatSeparator)<0){const le=deepFindWithDefaults(E,A,ie,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(le,void 0,w,{...T,...E,interpolationkey:ie}):le}const ne=ie.split(this.formatSeparator),ae=ne.shift().trim(),oe=ne.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(E,A,ae,this.options.keySeparator,this.options.ignoreJSONStructure),oe,w,{...T,...E,interpolationkey:ae})};this.resetRegExp();const H=T?.missingInterpolationHandler||this.options.missingInterpolationHandler,ee=T?.interpolation?.skipOnVariables!==void 0?T.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:ie=>regexSafe(ie)},{regex:this.regexp,safeValue:ie=>this.escapeValue?regexSafe(this.escape(ie)):regexSafe(ie)}].forEach(ie=>{for(R=0;_=ie.regex.exec(C);){const ne=_[1].trim();if(S=O(ne),S===void 0)if(typeof H=="function"){const oe=H(C,_,T);S=isString(oe)?oe:""}else if(T&&Object.prototype.hasOwnProperty.call(T,ne))S="";else if(ee){S=_[0];continue}else this.logger.warn(`missed to pass in variable ${ne} for interpolating ${C}`),S="";else!isString(S)&&!this.useRawValueToEscape&&(S=makeString(S));const ae=ie.safeValue(S);if(C=C.replace(_[0],ae),ee?(ie.regex.lastIndex+=S.length,ie.regex.lastIndex-=_[0].length):ie.regex.lastIndex=0,R++,R>=this.maxReplaces)break}}),C}nest(C,E,w={}){let T,_,S;const R=(A,O)=>{const H=this.nestingOptionsSeparator;if(A.indexOf(H)<0)return A;const ee=A.split(new RegExp(`${H}[ ]*{`));let te=`{${ee[1]}`;A=ee[0],te=this.interpolate(te,S);const ie=te.match(/'/g),ne=te.match(/"/g);((ie?.length??0)%2===0&&!ne||ne.length%2!==0)&&(te=te.replace(/'/g,'"'));try{S=JSON.parse(te),O&&(S={...O,...S})}catch(ae){return this.logger.warn(`failed parsing options string in nesting for key ${A}`,ae),`${A}${H}${te}`}return S.defaultValue&&S.defaultValue.indexOf(this.prefix)>-1&&delete S.defaultValue,A};for(;T=this.nestingRegexp.exec(C);){let A=[];S={...w},S=S.replace&&!isString(S.replace)?S.replace:S,S.applyPostProcessor=!1,delete S.defaultValue;const O=/{.*}/.test(T[1])?T[1].lastIndexOf("}")+1:T[1].indexOf(this.formatSeparator);if(O!==-1&&(A=T[1].slice(O).split(this.formatSeparator).map(H=>H.trim()).filter(Boolean),T[1]=T[1].slice(0,O)),_=E(R.call(this,T[1].trim(),S),S),_&&T[0]===C&&!isString(_))return _;isString(_)||(_=makeString(_)),_||(this.logger.warn(`missed to resolve ${T[1]} for nesting ${C}`),_=""),A.length&&(_=A.reduce((H,ee)=>this.format(H,ee,w.lng,{...w,interpolationkey:T[1].trim()}),_.trim())),C=C.replace(T[0],_),this.regexp.lastIndex=0}return C}}const parseFormatStr=x=>{let C=x.toLowerCase().trim();const E={};if(x.indexOf("(")>-1){const w=x.split("(");C=w[0].toLowerCase().trim();const T=w[1].substring(0,w[1].length-1);C==="currency"&&T.indexOf(":")<0?E.currency||(E.currency=T.trim()):C==="relativetime"&&T.indexOf(":")<0?E.range||(E.range=T.trim()):T.split(";").forEach(S=>{if(S){const[R,...A]=S.split(":"),O=A.join(":").trim().replace(/^'+|'+$/g,""),H=R.trim();E[H]||(E[H]=O),O==="false"&&(E[H]=!1),O==="true"&&(E[H]=!0),isNaN(O)||(E[H]=parseInt(O,10))}})}return{formatName:C,formatOptions:E}},createCachedFormatter=x=>{const C={};return(E,w,T)=>{let _=T;T&&T.interpolationkey&&T.formatParams&&T.formatParams[T.interpolationkey]&&T[T.interpolationkey]&&(_={..._,[T.interpolationkey]:void 0});const S=w+JSON.stringify(_);let R=C[S];return R||(R=x(getCleanedCode(w),T),C[S]=R),R(E)}},createNonCachedFormatter=x=>(C,E,w)=>x(getCleanedCode(E),w)(C);class Formatter{constructor(C={}){this.logger=baseLogger.create("formatter"),this.options=C,this.init(C)}init(C,E={interpolation:{}}){this.formatSeparator=E.interpolation.formatSeparator||",";const w=E.cacheInBuiltFormats?createCachedFormatter:createNonCachedFormatter;this.formats={number:w((T,_)=>{const S=new Intl.NumberFormat(T,{..._});return R=>S.format(R)}),currency:w((T,_)=>{const S=new Intl.NumberFormat(T,{..._,style:"currency"});return R=>S.format(R)}),datetime:w((T,_)=>{const S=new Intl.DateTimeFormat(T,{..._});return R=>S.format(R)}),relativetime:w((T,_)=>{const S=new Intl.RelativeTimeFormat(T,{..._});return R=>S.format(R,_.range||"day")}),list:w((T,_)=>{const S=new Intl.ListFormat(T,{..._});return R=>S.format(R)})}}add(C,E){this.formats[C.toLowerCase().trim()]=E}addCached(C,E){this.formats[C.toLowerCase().trim()]=createCachedFormatter(E)}format(C,E,w,T={}){const _=E.split(this.formatSeparator);if(_.length>1&&_[0].indexOf("(")>1&&_[0].indexOf(")")<0&&_.find(R=>R.indexOf(")")>-1)){const R=_.findIndex(A=>A.indexOf(")")>-1);_[0]=[_[0],..._.splice(1,R)].join(this.formatSeparator)}return _.reduce((R,A)=>{const{formatName:O,formatOptions:H}=parseFormatStr(A);if(this.formats[O]){let ee=R;try{const te=T?.formatParams?.[T.interpolationkey]||{},ie=te.locale||te.lng||T.locale||T.lng||w;ee=this.formats[O](R,ie,{...H,...T,...te})}catch(te){this.logger.warn(te)}return ee}else this.logger.warn(`there was no format function for ${O}`);return R},C)}}const removePending=(x,C)=>{x.pending[C]!==void 0&&(delete x.pending[C],x.pendingCount--)};class Connector extends EventEmitter{constructor(C,E,w,T={}){super(),this.backend=C,this.store=E,this.services=w,this.languageUtils=w.languageUtils,this.options=T,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=T.maxParallelReads||10,this.readingCalls=0,this.maxRetries=T.maxRetries>=0?T.maxRetries:5,this.retryTimeout=T.retryTimeout>=1?T.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(w,T.backend,T)}queueLoad(C,E,w,T){const _={},S={},R={},A={};return C.forEach(O=>{let H=!0;E.forEach(ee=>{const te=`${O}|${ee}`;!w.reload&&this.store.hasResourceBundle(O,ee)?this.state[te]=2:this.state[te]<0||(this.state[te]===1?S[te]===void 0&&(S[te]=!0):(this.state[te]=1,H=!1,S[te]===void 0&&(S[te]=!0),_[te]===void 0&&(_[te]=!0),A[ee]===void 0&&(A[ee]=!0)))}),H||(R[O]=!0)}),(Object.keys(_).length||Object.keys(S).length)&&this.queue.push({pending:S,pendingCount:Object.keys(S).length,loaded:{},errors:[],callback:T}),{toLoad:Object.keys(_),pending:Object.keys(S),toLoadLanguages:Object.keys(R),toLoadNamespaces:Object.keys(A)}}loaded(C,E,w){const T=C.split("|"),_=T[0],S=T[1];E&&this.emit("failedLoading",_,S,E),!E&&w&&this.store.addResourceBundle(_,S,w,void 0,void 0,{skipCopy:!0}),this.state[C]=E?-1:2,E&&w&&(this.state[C]=0);const R={};this.queue.forEach(A=>{pushPath(A.loaded,[_],S),removePending(A,C),E&&A.errors.push(E),A.pendingCount===0&&!A.done&&(Object.keys(A.loaded).forEach(O=>{R[O]||(R[O]={});const H=A.loaded[O];H.length&&H.forEach(ee=>{R[O][ee]===void 0&&(R[O][ee]=!0)})}),A.done=!0,A.errors.length?A.callback(A.errors):A.callback())}),this.emit("loaded",R),this.queue=this.queue.filter(A=>!A.done)}read(C,E,w,T=0,_=this.retryTimeout,S){if(!C.length)return S(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:C,ns:E,fcName:w,tried:T,wait:_,callback:S});return}this.readingCalls++;const R=(O,H)=>{if(this.readingCalls--,this.waitingReads.length>0){const ee=this.waitingReads.shift();this.read(ee.lng,ee.ns,ee.fcName,ee.tried,ee.wait,ee.callback)}if(O&&H&&T<this.maxRetries){setTimeout(()=>{this.read.call(this,C,E,w,T+1,_*2,S)},_);return}S(O,H)},A=this.backend[w].bind(this.backend);if(A.length===2){try{const O=A(C,E);O&&typeof O.then=="function"?O.then(H=>R(null,H)).catch(R):R(null,O)}catch(O){R(O)}return}return A(C,E,R)}prepareLoading(C,E,w={},T){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),T&&T();isString(C)&&(C=this.languageUtils.toResolveHierarchy(C)),isString(E)&&(E=[E]);const _=this.queueLoad(C,E,w,T);if(!_.toLoad.length)return _.pending.length||T(),null;_.toLoad.forEach(S=>{this.loadOne(S)})}load(C,E,w){this.prepareLoading(C,E,{},w)}reload(C,E,w){this.prepareLoading(C,E,{reload:!0},w)}loadOne(C,E=""){const w=C.split("|"),T=w[0],_=w[1];this.read(T,_,"read",void 0,void 0,(S,R)=>{S&&this.logger.warn(`${E}loading namespace ${_} for language ${T} failed`,S),!S&&R&&this.logger.log(`${E}loaded namespace ${_} for language ${T}`,R),this.loaded(C,S,R)})}saveMissing(C,E,w,T,_,S={},R=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(E)){this.logger.warn(`did not save key "${w}" as the namespace "${E}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(w==null||w==="")){if(this.backend?.create){const A={...S,isUpdate:_},O=this.backend.create.bind(this.backend);if(O.length<6)try{let H;O.length===5?H=O(C,E,w,T,A):H=O(C,E,w,T),H&&typeof H.then=="function"?H.then(ee=>R(null,ee)).catch(R):R(null,H)}catch(H){R(H)}else O(C,E,w,T,R,A)}!C||!C[0]||this.store.addResource(C[0],E,w,T)}}}const get$1=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:x=>{let C={};if(typeof x[1]=="object"&&(C=x[1]),isString(x[1])&&(C.defaultValue=x[1]),isString(x[2])&&(C.tDescription=x[2]),typeof x[2]=="object"||typeof x[3]=="object"){const E=x[3]||x[2];Object.keys(E).forEach(w=>{C[w]=E[w]})}return C},interpolation:{escapeValue:!0,format:x=>x,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),transformOptions=x=>(isString(x.ns)&&(x.ns=[x.ns]),isString(x.fallbackLng)&&(x.fallbackLng=[x.fallbackLng]),isString(x.fallbackNS)&&(x.fallbackNS=[x.fallbackNS]),x.supportedLngs?.indexOf?.("cimode")<0&&(x.supportedLngs=x.supportedLngs.concat(["cimode"])),typeof x.initImmediate=="boolean"&&(x.initAsync=x.initImmediate),x),noop=()=>{},bindMemberFunctions=x=>{Object.getOwnPropertyNames(Object.getPrototypeOf(x)).forEach(E=>{typeof x[E]=="function"&&(x[E]=x[E].bind(x))})};class I18n extends EventEmitter{constructor(C={},E){if(super(),this.options=transformOptions(C),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),E&&!this.isInitialized&&!C.isClone){if(!this.options.initAsync)return this.init(C,E),this;setTimeout(()=>{this.init(C,E)},0)}}init(C={},E){this.isInitializing=!0,typeof C=="function"&&(E=C,C={}),C.defaultNS==null&&C.ns&&(isString(C.ns)?C.defaultNS=C.ns:C.ns.indexOf("translation")<0&&(C.defaultNS=C.ns[0]));const w=get$1();this.options={...w,...this.options,...transformOptions(C)},this.options.interpolation={...w.interpolation,...this.options.interpolation},C.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=C.keySeparator),C.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=C.nsSeparator);const T=O=>O?typeof O=="function"?new O:O:null;if(!this.options.isClone){this.modules.logger?baseLogger.init(T(this.modules.logger),this.options):baseLogger.init(null,this.options);let O;this.modules.formatter?O=this.modules.formatter:O=Formatter;const H=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const ee=this.services;ee.logger=baseLogger,ee.resourceStore=this.store,ee.languageUtils=H,ee.pluralResolver=new PluralResolver(H,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==w.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),O&&(!this.options.interpolation.format||this.options.interpolation.format===w.interpolation.format)&&(ee.formatter=T(O),ee.formatter.init&&ee.formatter.init(ee,this.options),this.options.interpolation.format=ee.formatter.format.bind(ee.formatter)),ee.interpolator=new Interpolator(this.options),ee.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},ee.backendConnector=new Connector(T(this.modules.backend),ee.resourceStore,ee,this.options),ee.backendConnector.on("*",(ie,...ne)=>{this.emit(ie,...ne)}),this.modules.languageDetector&&(ee.languageDetector=T(this.modules.languageDetector),ee.languageDetector.init&&ee.languageDetector.init(ee,this.options.detection,this.options)),this.modules.i18nFormat&&(ee.i18nFormat=T(this.modules.i18nFormat),ee.i18nFormat.init&&ee.i18nFormat.init(this)),this.translator=new Translator(this.services,this.options),this.translator.on("*",(ie,...ne)=>{this.emit(ie,...ne)}),this.modules.external.forEach(ie=>{ie.init&&ie.init(this)})}if(this.format=this.options.interpolation.format,E||(E=noop),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const O=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);O.length>0&&O[0]!=="dev"&&(this.options.lng=O[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(O=>{this[O]=(...H)=>this.store[O](...H)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(O=>{this[O]=(...H)=>(this.store[O](...H),this)});const R=defer(),A=()=>{const O=(H,ee)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),R.resolve(ee),E(H,ee)};if(this.languages&&!this.isInitialized)return O(null,this.t.bind(this));this.changeLanguage(this.options.lng,O)};return this.options.resources||!this.options.initAsync?A():setTimeout(A,0),R}loadResources(C,E=noop){let w=E;const T=isString(C)?C:this.language;if(typeof C=="function"&&(w=C),!this.options.resources||this.options.partialBundledLanguages){if(T?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return w();const _=[],S=R=>{if(!R||R==="cimode")return;this.services.languageUtils.toResolveHierarchy(R).forEach(O=>{O!=="cimode"&&_.indexOf(O)<0&&_.push(O)})};T?S(T):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(A=>S(A)),this.options.preload?.forEach?.(R=>S(R)),this.services.backendConnector.load(_,this.options.ns,R=>{!R&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),w(R)})}else w(null)}reloadResources(C,E,w){const T=defer();return typeof C=="function"&&(w=C,C=void 0),typeof E=="function"&&(w=E,E=void 0),C||(C=this.languages),E||(E=this.options.ns),w||(w=noop),this.services.backendConnector.reload(C,E,_=>{T.resolve(),w(_)}),T}use(C){if(!C)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!C.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return C.type==="backend"&&(this.modules.backend=C),(C.type==="logger"||C.log&&C.warn&&C.error)&&(this.modules.logger=C),C.type==="languageDetector"&&(this.modules.languageDetector=C),C.type==="i18nFormat"&&(this.modules.i18nFormat=C),C.type==="postProcessor"&&postProcessor.addPostProcessor(C),C.type==="formatter"&&(this.modules.formatter=C),C.type==="3rdParty"&&this.modules.external.push(C),this}setResolvedLanguage(C){if(!(!C||!this.languages)&&!(["cimode","dev"].indexOf(C)>-1)){for(let E=0;E<this.languages.length;E++){const w=this.languages[E];if(!(["cimode","dev"].indexOf(w)>-1)&&this.store.hasLanguageSomeTranslations(w)){this.resolvedLanguage=w;break}}!this.resolvedLanguage&&this.languages.indexOf(C)<0&&this.store.hasLanguageSomeTranslations(C)&&(this.resolvedLanguage=C,this.languages.unshift(C))}}changeLanguage(C,E){this.isLanguageChangingTo=C;const w=defer();this.emit("languageChanging",C);const T=R=>{this.language=R,this.languages=this.services.languageUtils.toResolveHierarchy(R),this.resolvedLanguage=void 0,this.setResolvedLanguage(R)},_=(R,A)=>{A?this.isLanguageChangingTo===C&&(T(A),this.translator.changeLanguage(A),this.isLanguageChangingTo=void 0,this.emit("languageChanged",A),this.logger.log("languageChanged",A)):this.isLanguageChangingTo=void 0,w.resolve((...O)=>this.t(...O)),E&&E(R,(...O)=>this.t(...O))},S=R=>{!C&&!R&&this.services.languageDetector&&(R=[]);const A=isString(R)?R:R&&R[0],O=this.store.hasLanguageSomeTranslations(A)?A:this.services.languageUtils.getBestMatchFromCodes(isString(R)?[R]:R);O&&(this.language||T(O),this.translator.language||this.translator.changeLanguage(O),this.services.languageDetector?.cacheUserLanguage?.(O)),this.loadResources(O,H=>{_(H,O)})};return!C&&this.services.languageDetector&&!this.services.languageDetector.async?S(this.services.languageDetector.detect()):!C&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(S):this.services.languageDetector.detect(S):S(C),w}getFixedT(C,E,w){const T=(_,S,...R)=>{let A;typeof S!="object"?A=this.options.overloadTranslationOptionHandler([_,S].concat(R)):A={...S},A.lng=A.lng||T.lng,A.lngs=A.lngs||T.lngs,A.ns=A.ns||T.ns,A.keyPrefix!==""&&(A.keyPrefix=A.keyPrefix||w||T.keyPrefix);const O=this.options.keySeparator||".";let H;return A.keyPrefix&&Array.isArray(_)?H=_.map(ee=>(typeof ee=="function"&&(ee=keysFromSelector(ee,S)),`${A.keyPrefix}${O}${ee}`)):(typeof _=="function"&&(_=keysFromSelector(_,S)),H=A.keyPrefix?`${A.keyPrefix}${O}${_}`:_),this.t(H,A)};return isString(C)?T.lng=C:T.lngs=C,T.ns=E,T.keyPrefix=w,T}t(...C){return this.translator?.translate(...C)}exists(...C){return this.translator?.exists(...C)}setDefaultNamespace(C){this.options.defaultNS=C}hasLoadedNamespace(C,E={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const w=E.lng||this.resolvedLanguage||this.languages[0],T=this.options?this.options.fallbackLng:!1,_=this.languages[this.languages.length-1];if(w.toLowerCase()==="cimode")return!0;const S=(R,A)=>{const O=this.services.backendConnector.state[`${R}|${A}`];return O===-1||O===0||O===2};if(E.precheck){const R=E.precheck(this,S);if(R!==void 0)return R}return!!(this.hasResourceBundle(w,C)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||S(w,C)&&(!T||S(_,C)))}loadNamespaces(C,E){const w=defer();return this.options.ns?(isString(C)&&(C=[C]),C.forEach(T=>{this.options.ns.indexOf(T)<0&&this.options.ns.push(T)}),this.loadResources(T=>{w.resolve(),E&&E(T)}),w):(E&&E(),Promise.resolve())}loadLanguages(C,E){const w=defer();isString(C)&&(C=[C]);const T=this.options.preload||[],_=C.filter(S=>T.indexOf(S)<0&&this.services.languageUtils.isSupportedCode(S));return _.length?(this.options.preload=T.concat(_),this.loadResources(S=>{w.resolve(),E&&E(S)}),w):(E&&E(),Promise.resolve())}dir(C){if(C||(C=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!C)return"rtl";try{const T=new Intl.Locale(C);if(T&&T.getTextInfo){const _=T.getTextInfo();if(_&&_.direction)return _.direction}}catch{}const E=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],w=this.services?.languageUtils||new LanguageUtil(get$1());return C.toLowerCase().indexOf("-latn")>1?"ltr":E.indexOf(w.getLanguagePartFromCode(C))>-1||C.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(C={},E){return new I18n(C,E)}cloneInstance(C={},E=noop){const w=C.forkResourceStore;w&&delete C.forkResourceStore;const T={...this.options,...C,isClone:!0},_=new I18n(T);if((C.debug!==void 0||C.prefix!==void 0)&&(_.logger=_.logger.clone(C)),["store","services","language"].forEach(R=>{_[R]=this[R]}),_.services={...this.services},_.services.utils={hasLoadedNamespace:_.hasLoadedNamespace.bind(_)},w){const R=Object.keys(this.store.data).reduce((A,O)=>(A[O]={...this.store.data[O]},A[O]=Object.keys(A[O]).reduce((H,ee)=>(H[ee]={...A[O][ee]},H),A[O]),A),{});_.store=new ResourceStore(R,T),_.services.resourceStore=_.store}return _.translator=new Translator(_.services,T),_.translator.on("*",(R,...A)=>{_.emit(R,...A)}),_.init(T,E),_.translator.options=T,_.translator.backendConnector.services.utils={hasLoadedNamespace:_.hasLoadedNamespace.bind(_)},_}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const instance=I18n.createInstance();instance.createInstance=I18n.createInstance;instance.createInstance;instance.dir;instance.init;instance.loadResources;instance.reloadResources;instance.use;instance.changeLanguage;instance.getFixedT;instance.t;instance.exists;instance.setDefaultNamespace;instance.hasLoadedNamespace;instance.loadNamespaces;instance.loadLanguages;const{slice,forEach}=[];function defaults(x){return forEach.call(slice.call(arguments,1),C=>{if(C)for(const E in C)x[E]===void 0&&(x[E]=C[E])}),x}function hasXSS(x){return typeof x!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(E=>E.test(x))}const fieldContentRegExp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,serializeCookie=function(x,C){const w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},T=encodeURIComponent(C);let _=`${x}=${T}`;if(w.maxAge>0){const S=w.maxAge-0;if(Number.isNaN(S))throw new Error("maxAge should be a Number");_+=`; Max-Age=${Math.floor(S)}`}if(w.domain){if(!fieldContentRegExp.test(w.domain))throw new TypeError("option domain is invalid");_+=`; Domain=${w.domain}`}if(w.path){if(!fieldContentRegExp.test(w.path))throw new TypeError("option path is invalid");_+=`; Path=${w.path}`}if(w.expires){if(typeof w.expires.toUTCString!="function")throw new TypeError("option expires is invalid");_+=`; Expires=${w.expires.toUTCString()}`}if(w.httpOnly&&(_+="; HttpOnly"),w.secure&&(_+="; Secure"),w.sameSite)switch(typeof w.sameSite=="string"?w.sameSite.toLowerCase():w.sameSite){case!0:_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"strict":_+="; SameSite=Strict";break;case"none":_+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return w.partitioned&&(_+="; Partitioned"),_},cookie={create(x,C,E,w){let T=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};E&&(T.expires=new Date,T.expires.setTime(T.expires.getTime()+E*60*1e3)),w&&(T.domain=w),document.cookie=serializeCookie(x,C,T)},read(x){const C=`${x}=`,E=document.cookie.split(";");for(let w=0;w<E.length;w++){let T=E[w];for(;T.charAt(0)===" ";)T=T.substring(1,T.length);if(T.indexOf(C)===0)return T.substring(C.length,T.length)}return null},remove(x,C){this.create(x,"",-1,C)}};var cookie$1={name:"cookie",lookup(x){let{lookupCookie:C}=x;if(C&&typeof document<"u")return cookie.read(C)||void 0},cacheUserLanguage(x,C){let{lookupCookie:E,cookieMinutes:w,cookieDomain:T,cookieOptions:_}=C;E&&typeof document<"u"&&cookie.create(E,x,w,T,_)}},querystring={name:"querystring",lookup(x){let{lookupQuerystring:C}=x,E;if(typeof window<"u"){let{search:w}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(w=window.location.hash.substring(window.location.hash.indexOf("?")));const _=w.substring(1).split("&");for(let S=0;S<_.length;S++){const R=_[S].indexOf("=");R>0&&_[S].substring(0,R)===C&&(E=_[S].substring(R+1))}}return E}},hash={name:"hash",lookup(x){let{lookupHash:C,lookupFromHashIndex:E}=x,w;if(typeof window<"u"){const{hash:T}=window.location;if(T&&T.length>2){const _=T.substring(1);if(C){const S=_.split("&");for(let R=0;R<S.length;R++){const A=S[R].indexOf("=");A>0&&S[R].substring(0,A)===C&&(w=S[R].substring(A+1))}}if(w)return w;if(!w&&E>-1){const S=T.match(/\/([a-zA-Z-]*)/g);return Array.isArray(S)?S[typeof E=="number"?E:0]?.replace("/",""):void 0}}}return w}};let hasLocalStorageSupport=null;const localStorageAvailable=()=>{if(hasLocalStorageSupport!==null)return hasLocalStorageSupport;try{if(hasLocalStorageSupport=typeof window<"u"&&window.localStorage!==null,!hasLocalStorageSupport)return!1;const x="i18next.translate.boo";window.localStorage.setItem(x,"foo"),window.localStorage.removeItem(x)}catch{hasLocalStorageSupport=!1}return hasLocalStorageSupport};var localStorage={name:"localStorage",lookup(x){let{lookupLocalStorage:C}=x;if(C&&localStorageAvailable())return window.localStorage.getItem(C)||void 0},cacheUserLanguage(x,C){let{lookupLocalStorage:E}=C;E&&localStorageAvailable()&&window.localStorage.setItem(E,x)}};let hasSessionStorageSupport=null;const sessionStorageAvailable=()=>{if(hasSessionStorageSupport!==null)return hasSessionStorageSupport;try{if(hasSessionStorageSupport=typeof window<"u"&&window.sessionStorage!==null,!hasSessionStorageSupport)return!1;const x="i18next.translate.boo";window.sessionStorage.setItem(x,"foo"),window.sessionStorage.removeItem(x)}catch{hasSessionStorageSupport=!1}return hasSessionStorageSupport};var sessionStorage={name:"sessionStorage",lookup(x){let{lookupSessionStorage:C}=x;if(C&&sessionStorageAvailable())return window.sessionStorage.getItem(C)||void 0},cacheUserLanguage(x,C){let{lookupSessionStorage:E}=C;E&&sessionStorageAvailable()&&window.sessionStorage.setItem(E,x)}},navigator$1={name:"navigator",lookup(x){const C=[];if(typeof navigator<"u"){const{languages:E,userLanguage:w,language:T}=navigator;if(E)for(let _=0;_<E.length;_++)C.push(E[_]);w&&C.push(w),T&&C.push(T)}return C.length>0?C:void 0}},htmlTag={name:"htmlTag",lookup(x){let{htmlTag:C}=x,E;const w=C||(typeof document<"u"?document.documentElement:null);return w&&typeof w.getAttribute=="function"&&(E=w.getAttribute("lang")),E}},path={name:"path",lookup(x){let{lookupFromPathIndex:C}=x;if(typeof window>"u")return;const E=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(E)?E[typeof C=="number"?C:0]?.replace("/",""):void 0}},subdomain={name:"subdomain",lookup(x){let{lookupFromSubdomainIndex:C}=x;const E=typeof C=="number"?C+1:1,w=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(w)return w[E]}};let canCookies=!1;try{document.cookie,canCookies=!0}catch{}const order=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];canCookies||order.splice(1,1);const getDefaults$1=()=>({order,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:x=>x});class Browser{constructor(C){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(C,E)}init(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=C,this.options=defaults(E,this.options||{},getDefaults$1()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=T=>T.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=w,this.addDetector(cookie$1),this.addDetector(querystring),this.addDetector(localStorage),this.addDetector(sessionStorage),this.addDetector(navigator$1),this.addDetector(htmlTag),this.addDetector(path),this.addDetector(subdomain),this.addDetector(hash)}addDetector(C){return this.detectors[C.name]=C,this}detect(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,E=[];return C.forEach(w=>{if(this.detectors[w]){let T=this.detectors[w].lookup(this.options);T&&typeof T=="string"&&(T=[T]),T&&(E=E.concat(T))}}),E=E.filter(w=>w!=null&&!hasXSS(w)).map(w=>this.options.convertDetectedLanguage(w)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?E:E.length>0?E[0]:null}cacheUserLanguage(C){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;E&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(C)>-1||E.forEach(w=>{this.detectors[w]&&this.detectors[w].cacheUserLanguage(C,this.options)}))}}Browser.type="languageDetector";function _typeof$2(x){"@babel/helpers - typeof";return _typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},_typeof$2(x)}function hasXMLHttpRequest(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":_typeof$2(XMLHttpRequest))==="object"}function isPromise(x){return!!x&&typeof x.then=="function"}function makePromise(x){return isPromise(x)?x:Promise.resolve(x)}const scriptRel="modulepreload",assetsURL=function(x,C){return new URL(x,C).href},seen={},__vitePreload=function(C,E,w){let T=Promise.resolve();if(E&&E.length>0){let O=function(H){return Promise.all(H.map(ee=>Promise.resolve(ee).then(te=>({status:"fulfilled",value:te}),te=>({status:"rejected",reason:te}))))};const S=document.getElementsByTagName("link"),R=document.querySelector("meta[property=csp-nonce]"),A=R?.nonce||R?.getAttribute("nonce");T=O(E.map(H=>{if(H=assetsURL(H,w),H in seen)return;seen[H]=!0;const ee=H.endsWith(".css"),te=ee?'[rel="stylesheet"]':"";if(!!w)for(let ae=S.length-1;ae>=0;ae--){const oe=S[ae];if(oe.href===H&&(!ee||oe.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${H}"]${te}`))return;const ne=document.createElement("link");if(ne.rel=ee?"stylesheet":scriptRel,ee||(ne.as="script"),ne.crossOrigin="",ne.href=H,A&&ne.setAttribute("nonce",A),document.head.appendChild(ne),ee)return new Promise((ae,oe)=>{ne.addEventListener("load",ae),ne.addEventListener("error",()=>oe(new Error(`Unable to preload CSS for ${H}`)))})}))}function _(S){const R=new Event("vite:preloadError",{cancelable:!0});if(R.payload=S,window.dispatchEvent(R),!R.defaultPrevented)throw S}return T.then(S=>{for(const R of S||[])R.status==="rejected"&&_(R.reason);return C().catch(_)})};function ownKeys$1(x,C){var E=Object.keys(x);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(x);C&&(w=w.filter(function(T){return Object.getOwnPropertyDescriptor(x,T).enumerable})),E.push.apply(E,w)}return E}function _objectSpread$1(x){for(var C=1;C<arguments.length;C++){var E=arguments[C]!=null?arguments[C]:{};C%2?ownKeys$1(Object(E),!0).forEach(function(w){_defineProperty$1(x,w,E[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(E)):ownKeys$1(Object(E)).forEach(function(w){Object.defineProperty(x,w,Object.getOwnPropertyDescriptor(E,w))})}return x}function _defineProperty$1(x,C,E){return(C=_toPropertyKey$1(C))in x?Object.defineProperty(x,C,{value:E,enumerable:!0,configurable:!0,writable:!0}):x[C]=E,x}function _toPropertyKey$1(x){var C=_toPrimitive$1(x,"string");return _typeof$1(C)=="symbol"?C:C+""}function _toPrimitive$1(x,C){if(_typeof$1(x)!="object"||!x)return x;var E=x[Symbol.toPrimitive];if(E!==void 0){var w=E.call(x,C);if(_typeof$1(w)!="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(x)}function _typeof$1(x){"@babel/helpers - typeof";return _typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},_typeof$1(x)}var fetchApi=typeof fetch=="function"?fetch:void 0;typeof global<"u"&&global.fetch?fetchApi=global.fetch:typeof window<"u"&&window.fetch&&(fetchApi=window.fetch);var XmlHttpRequestApi;hasXMLHttpRequest()&&(typeof global<"u"&&global.XMLHttpRequest?XmlHttpRequestApi=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(XmlHttpRequestApi=window.XMLHttpRequest));var ActiveXObjectApi;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?ActiveXObjectApi=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(ActiveXObjectApi=window.ActiveXObject));typeof fetchApi!="function"&&(fetchApi=void 0);if(!fetchApi&&!XmlHttpRequestApi&&!ActiveXObjectApi)try{__vitePreload(()=>import("./browser-ponyfill-DjjwSE67.js").then(x=>x.b),[],import.meta.url).then(function(x){fetchApi=x.default}).catch(function(){})}catch{}var addQueryString=function(C,E){if(E&&_typeof$1(E)==="object"){var w="";for(var T in E)w+="&"+encodeURIComponent(T)+"="+encodeURIComponent(E[T]);if(!w)return C;C=C+(C.indexOf("?")!==-1?"&":"?")+w.slice(1)}return C},fetchIt=function(C,E,w,T){var _=function(A){if(!A.ok)return w(A.statusText||"Error",{status:A.status});A.text().then(function(O){w(null,{status:A.status,data:O})}).catch(w)};if(T){var S=T(C,E);if(S instanceof Promise){S.then(_).catch(w);return}}typeof fetch=="function"?fetch(C,E).then(_).catch(w):fetchApi(C,E).then(_).catch(w)},omitFetchOptions=!1,requestWithFetch=function(C,E,w,T){C.queryStringParams&&(E=addQueryString(E,C.queryStringParams));var _=_objectSpread$1({},typeof C.customHeaders=="function"?C.customHeaders():C.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(_["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),w&&(_["Content-Type"]="application/json");var S=typeof C.requestOptions=="function"?C.requestOptions(w):C.requestOptions,R=_objectSpread$1({method:w?"POST":"GET",body:w?C.stringify(w):void 0,headers:_},omitFetchOptions?{}:S),A=typeof C.alternateFetch=="function"&&C.alternateFetch.length>=1?C.alternateFetch:void 0;try{fetchIt(E,R,T,A)}catch(O){if(!S||Object.keys(S).length===0||!O.message||O.message.indexOf("not implemented")<0)return T(O);try{Object.keys(S).forEach(function(H){delete R[H]}),fetchIt(E,R,T,A),omitFetchOptions=!0}catch(H){T(H)}}},requestWithXmlHttpRequest=function(C,E,w,T){w&&_typeof$1(w)==="object"&&(w=addQueryString("",w).slice(1)),C.queryStringParams&&(E=addQueryString(E,C.queryStringParams));try{var _=XmlHttpRequestApi?new XmlHttpRequestApi:new ActiveXObjectApi("MSXML2.XMLHTTP.3.0");_.open(w?"POST":"GET",E,1),C.crossDomain||_.setRequestHeader("X-Requested-With","XMLHttpRequest"),_.withCredentials=!!C.withCredentials,w&&_.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),_.overrideMimeType&&_.overrideMimeType("application/json");var S=C.customHeaders;if(S=typeof S=="function"?S():S,S)for(var R in S)_.setRequestHeader(R,S[R]);_.onreadystatechange=function(){_.readyState>3&&T(_.status>=400?_.statusText:null,{status:_.status,data:_.responseText})},_.send(w)}catch(A){console&&console.log(A)}},request=function(C,E,w,T){if(typeof w=="function"&&(T=w,w=void 0),T=T||function(){},fetchApi&&E.indexOf("file:")!==0)return requestWithFetch(C,E,w,T);if(hasXMLHttpRequest()||typeof ActiveXObject=="function")return requestWithXmlHttpRequest(C,E,w,T);T(new Error("No fetch and no xhr implementation found!"))};function _typeof(x){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},_typeof(x)}function ownKeys(x,C){var E=Object.keys(x);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(x);C&&(w=w.filter(function(T){return Object.getOwnPropertyDescriptor(x,T).enumerable})),E.push.apply(E,w)}return E}function _objectSpread(x){for(var C=1;C<arguments.length;C++){var E=arguments[C]!=null?arguments[C]:{};C%2?ownKeys(Object(E),!0).forEach(function(w){_defineProperty(x,w,E[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(E)):ownKeys(Object(E)).forEach(function(w){Object.defineProperty(x,w,Object.getOwnPropertyDescriptor(E,w))})}return x}function _classCallCheck(x,C){if(!(x instanceof C))throw new TypeError("Cannot call a class as a function")}function _defineProperties(x,C){for(var E=0;E<C.length;E++){var w=C[E];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(x,_toPropertyKey(w.key),w)}}function _createClass(x,C,E){return C&&_defineProperties(x.prototype,C),Object.defineProperty(x,"prototype",{writable:!1}),x}function _defineProperty(x,C,E){return(C=_toPropertyKey(C))in x?Object.defineProperty(x,C,{value:E,enumerable:!0,configurable:!0,writable:!0}):x[C]=E,x}function _toPropertyKey(x){var C=_toPrimitive(x,"string");return _typeof(C)=="symbol"?C:C+""}function _toPrimitive(x,C){if(_typeof(x)!="object"||!x)return x;var E=x[Symbol.toPrimitive];if(E!==void 0){var w=E.call(x,C);if(_typeof(w)!="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(x)}var getDefaults=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(E){return JSON.parse(E)},stringify:JSON.stringify,parsePayload:function(E,w,T){return _defineProperty({},w,T||"")},parseLoadPayload:function(E,w){},request,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Backend=function(){function x(C){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};_classCallCheck(this,x),this.services=C,this.options=E,this.allOptions=w,this.type="backend",this.init(C,E,w)}return _createClass(x,[{key:"init",value:function(E){var w=this,T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=E,this.options=_objectSpread(_objectSpread(_objectSpread({},getDefaults()),this.options||{}),T),this.allOptions=_,this.services&&this.options.reloadInterval){var S=setInterval(function(){return w.reload()},this.options.reloadInterval);_typeof(S)==="object"&&typeof S.unref=="function"&&S.unref()}}},{key:"readMulti",value:function(E,w,T){this._readAny(E,E,w,w,T)}},{key:"read",value:function(E,w,T){this._readAny([E],E,[w],w,T)}},{key:"_readAny",value:function(E,w,T,_,S){var R=this,A=this.options.loadPath;typeof this.options.loadPath=="function"&&(A=this.options.loadPath(E,T)),A=makePromise(A),A.then(function(O){if(!O)return S(null,{});var H=R.services.interpolator.interpolate(O,{lng:E.join("+"),ns:T.join("+")});R.loadUrl(H,S,w,_)})}},{key:"loadUrl",value:function(E,w,T,_){var S=this,R=typeof T=="string"?[T]:T,A=typeof _=="string"?[_]:_,O=this.options.parseLoadPayload(R,A);this.options.request(this.options,E,O,function(H,ee){if(ee&&(ee.status>=500&&ee.status<600||!ee.status))return w("failed loading "+E+"; status code: "+ee.status,!0);if(ee&&ee.status>=400&&ee.status<500)return w("failed loading "+E+"; status code: "+ee.status,!1);if(!ee&&H&&H.message){var te=H.message.toLowerCase(),ie=["failed","fetch","network","load"].find(function(oe){return te.indexOf(oe)>-1});if(ie)return w("failed loading "+E+": "+H.message,!0)}if(H)return w(H,!1);var ne,ae;try{typeof ee.data=="string"?ne=S.options.parse(ee.data,T,_):ne=ee.data}catch{ae="failed parsing "+E+" to json"}if(ae)return w(ae,!1);w(null,ne)})}},{key:"create",value:function(E,w,T,_,S){var R=this;if(this.options.addPath){typeof E=="string"&&(E=[E]);var A=this.options.parsePayload(w,T,_),O=0,H=[],ee=[];E.forEach(function(te){var ie=R.options.addPath;typeof R.options.addPath=="function"&&(ie=R.options.addPath(te,w));var ne=R.services.interpolator.interpolate(ie,{lng:te,ns:w});R.options.request(R.options,ne,A,function(ae,oe){O+=1,H.push(ae),ee.push(oe),O===E.length&&typeof S=="function"&&S(H,ee)})})}}},{key:"reload",value:function(){var E=this,w=this.services,T=w.backendConnector,_=w.languageUtils,S=w.logger,R=T.language;if(!(R&&R.toLowerCase()==="cimode")){var A=[],O=function(ee){var te=_.toResolveHierarchy(ee);te.forEach(function(ie){A.indexOf(ie)<0&&A.push(ie)})};O(R),this.allOptions.preload&&this.allOptions.preload.forEach(function(H){return O(H)}),A.forEach(function(H){E.allOptions.ns.forEach(function(ee){T.read(H,ee,"read",null,null,function(te,ie){te&&S.warn("loading namespace ".concat(ee," for language ").concat(H," failed"),te),!te&&ie&&S.log("loaded namespace ".concat(ee," for language ").concat(H),ie),T.loaded("".concat(H,"|").concat(ee),te,ie)})})})}}}])}();Backend.type="backend";instance.use(Backend).use(Browser).use(initReactI18next).init({backend:{loadPath:"/assets/i18n/{{lng}}/{{ns}}.json"},fallbackLng:"en",interpolation:{escapeValue:!1}});const languageNativeNames={en:"English",ja:"日本語",ko:"한국어",de:"Deutsch",ar:"العربية",el:"Ελληνικά",es:"Español",fr:"Français",it:"Italiano",la:"Latina",ms:"Bahasa Melayu",ru:"Русский",zh:"中文"},ConfirmationDialog=({isOpen:x,title:C,message:E,confirmButtonText:w,cancelButtonText:T,onConfirm:_,onCancel:S,showCancelButton:R=!0,messageExtra:A})=>{const O=useTheme();return reactExports.useMemo(()=>x?jsxRuntimeExports.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},onClick:S,children:jsxRuntimeExports.jsxs("div",{style:{backgroundColor:O.palette.background.paper,color:O.palette.text.primary,padding:"20px",borderRadius:"8px",maxWidth:"400px",width:"100%"},onClick:ee=>ee.stopPropagation(),children:[jsxRuntimeExports.jsx("h3",{style:{marginTop:0,color:O.palette.text.primary},children:C}),jsxRuntimeExports.jsx("p",{style:{color:O.palette.text.primary},children:E}),A&&jsxRuntimeExports.jsx("div",{style:{marginTop:8},children:A}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px",marginTop:"20px"},children:[R&&jsxRuntimeExports.jsx(Button,{variant:"contained",color:"primary",onClick:S,children:T}),jsxRuntimeExports.jsx(Button,{onClick:_,variant:"contained",color:"primary",children:w})]})]})}):null,[x,C,E,w,T,_,S,R,A,O])};typeof SuppressedError=="function"&&SuppressedError;function transformCallback(x,C=!1){return window.__TAURI_INTERNALS__.transformCallback(x,C)}async function invoke(x,C={},E){return window.__TAURI_INTERNALS__.invoke(x,C,E)}const CreateIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"})),GitHubIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27"})),AutoAwesomeIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25z"})),LinkArea=()=>{const{displayColorMode:x,setDisplayColorMode:C,setSelectedLanguage:E,selectedLanguage:w}=useAppState(),{initializeServer:T,guiSetting:_}=useAppRoot(),[S,R]=reactExports.useState(!1),{t:A}=useTranslation(),O=reactExports.useCallback(ie=>{E(ie.target.value),instance.changeLanguage(ie.target.value)},[E]),H=reactExports.useCallback(()=>{C(x==="light"?"dark":"light")},[x,C]),ee=reactExports.useCallback(async ie=>{try{await invoke("open_browser_url",{url:ie})}catch(ne){console.warn(A("common.links.url_open_failed"),ne),window.open(ie,"_blank","noopener,noreferrer")}},[A]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",marginBottom:"20px",marginTop:"20px"},children:[jsxRuntimeExports.jsx(Tooltip,{title:A("common.initialize.button"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>{R(!0)},color:"default",size:"small",sx:{px:1.5,marginLeft:"5px",marginRight:"5px",border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},height:"32px"},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",direction:"row",sx:{height:"18px"},children:[jsxRuntimeExports.jsx(AutoAwesomeIcon,{sx:{fontSize:"18px",marginRight:"5px"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"13px",whiteSpace:"nowrap"},children:A("common.initialize.button")})]})})}),jsxRuntimeExports.jsx(Tooltip,{title:A("common.links.models_repo.beatrice"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>{ee("https://prj-beatrice.com/")},color:"default",size:"small",sx:{px:1.5,marginLeft:"5px",marginRight:"5px",border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},height:"32px"},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",direction:"row",sx:{height:"18px"},children:[jsxRuntimeExports.jsx(CreateIcon,{sx:{fontSize:"18px",marginRight:"5px"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"13px",whiteSpace:"nowrap"},children:A("common.links.models_repo.beatrice")})]})})}),jsxRuntimeExports.jsx(Tooltip,{title:A("common.links.create_voice_model"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>{ee("https://github.com/w-okada/beatrice-trainer-colab")},color:"default",size:"small",sx:{px:1.5,marginLeft:"5px",marginRight:"5px",border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},height:"32px"},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",direction:"row",sx:{height:"18px"},children:[jsxRuntimeExports.jsx(CreateIcon,{sx:{fontSize:"18px",marginRight:"5px"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"13px",whiteSpace:"nowrap"},children:A("common.links.create_voice_model")})]})})}),jsxRuntimeExports.jsx(Tooltip,{title:A("common.links.download_native_client"),children:jsxRuntimeExports.jsx("a",{href:"/native_client/voice-changer-native-client-win.exe",download:"voice-changer-native-client-win.exe",style:{textDecoration:"none"},children:jsxRuntimeExports.jsx(IconButton,{color:"default",size:"small",sx:{px:1.5,marginLeft:"5px",marginRight:"5px",border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},height:"32px"},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",direction:"row",sx:{height:"18px"},children:[jsxRuntimeExports.jsx(DownloadIcon,{sx:{fontSize:"18px",marginRight:"5px"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"13px",whiteSpace:"nowrap"},children:A("common.links.download_native_client")})]})})})}),_.lang&&jsxRuntimeExports.jsx(FormControl,{size:"small",sx:{minWidth:120,marginLeft:"35px",marginRight:"5px"},children:jsxRuntimeExports.jsx(Select,{value:w,onChange:O,sx:{height:"32px",fontSize:"13px",marginLeft:"5px",marginRight:"5px"},startAdornment:jsxRuntimeExports.jsx(LanguageIcon,{sx:{fontSize:"1.2rem",marginRight:1}}),children:_.lang.map(ie=>jsxRuntimeExports.jsx(MenuItem,{value:ie,children:languageNativeNames[ie]||ie.toUpperCase()},ie))})}),jsxRuntimeExports.jsx(Tooltip,{title:A(`common.theme.${x==="light"?"dark":"light"}`),children:jsxRuntimeExports.jsx(IconButton,{onClick:H,color:"default",size:"small",sx:{px:1.5,marginLeft:"5px",marginRight:"5px",border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},height:"32px"},children:jsxRuntimeExports.jsx(Stack,{alignItems:"center",direction:"row",sx:{height:"18px"},children:x==="light"?jsxRuntimeExports.jsx(DarkModeIcon,{sx:{fontSize:"18px"}}):jsxRuntimeExports.jsx(LightModeIcon,{sx:{fontSize:"18px"}})})})}),jsxRuntimeExports.jsx(Tooltip,{title:A("common.links.vcclient_repo"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>{ee("https://github.com/w-okada/beatrice-simple-web-app")},color:"default",size:"small",sx:{px:1.5,marginLeft:"5px",marginRight:"5px",border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},height:"32px"},children:jsxRuntimeExports.jsx(Stack,{alignItems:"center",direction:"row",sx:{height:"18px"},children:jsxRuntimeExports.jsx(GitHubIcon,{sx:{fontSize:"18px",marginRight:"5px"}})})})}),jsxRuntimeExports.jsx(ConfirmationDialog,{isOpen:S,title:A("common.initialize.confirm_title"),message:A("common.initialize.confirm_message"),confirmButtonText:A("common.initialize.confirm"),cancelButtonText:A("common.initialize.cancel"),onConfirm:async()=>{await T(),R(!1)},onCancel:()=>{R(!1)}})]}),[T,_.lang,S,A,O,H,w,x])};var define_process_env_default={};const downloadAsWav=(x,C)=>{const E=(O,H,ee)=>{for(var te=0;te<ee.length;te++)O.setUint8(H+te,ee.charCodeAt(te))},w=(O,H,ee)=>{for(var te=0;te<ee.length;te++,H+=2){var ie=Math.max(-1,Math.min(1,ee[te]));O.setInt16(H,ie<0?ie*32768:ie*32767,!0)}},T=new ArrayBuffer(44+x.length*2),_=new DataView(T);E(_,0,"RIFF"),_.setUint32(4,32+x.length*2,!0),E(_,8,"WAVE"),E(_,12,"fmt "),_.setUint32(16,16,!0),_.setUint16(20,1,!0),_.setUint16(22,1,!0),_.setUint32(24,48e3,!0),_.setUint32(28,96e3,!0),_.setUint16(32,2,!0),_.setUint16(34,16,!0),E(_,36,"data"),_.setUint32(40,x.length*2,!0),w(_,44,x);const S=new Blob([_],{type:"audio/wav"}),R=URL.createObjectURL(S),A=document.createElement("a");A.href=R,A.download=C,document.body.appendChild(A),A.click(),document.body.removeChild(A),URL.revokeObjectURL(R)},instanceOfAny$1=(x,C)=>C.some(E=>x instanceof E);let idbProxyableTypes$1,cursorAdvanceMethods$1;function getIdbProxyableTypes$1(){return idbProxyableTypes$1||(idbProxyableTypes$1=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function getCursorAdvanceMethods$1(){return cursorAdvanceMethods$1||(cursorAdvanceMethods$1=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const transactionDoneMap$1=new WeakMap,transformCache$1=new WeakMap,reverseTransformCache$1=new WeakMap;function promisifyRequest$1(x){const C=new Promise((E,w)=>{const T=()=>{x.removeEventListener("success",_),x.removeEventListener("error",S)},_=()=>{E(wrap$1(x.result)),T()},S=()=>{w(x.error),T()};x.addEventListener("success",_),x.addEventListener("error",S)});return reverseTransformCache$1.set(C,x),C}function cacheDonePromiseForTransaction$1(x){if(transactionDoneMap$1.has(x))return;const C=new Promise((E,w)=>{const T=()=>{x.removeEventListener("complete",_),x.removeEventListener("error",S),x.removeEventListener("abort",S)},_=()=>{E(),T()},S=()=>{w(x.error||new DOMException("AbortError","AbortError")),T()};x.addEventListener("complete",_),x.addEventListener("error",S),x.addEventListener("abort",S)});transactionDoneMap$1.set(x,C)}let idbProxyTraps$1={get(x,C,E){if(x instanceof IDBTransaction){if(C==="done")return transactionDoneMap$1.get(x);if(C==="store")return E.objectStoreNames[1]?void 0:E.objectStore(E.objectStoreNames[0])}return wrap$1(x[C])},set(x,C,E){return x[C]=E,!0},has(x,C){return x instanceof IDBTransaction&&(C==="done"||C==="store")?!0:C in x}};function replaceTraps$1(x){idbProxyTraps$1=x(idbProxyTraps$1)}function wrapFunction$1(x){return getCursorAdvanceMethods$1().includes(x)?function(...C){return x.apply(unwrap$1(this),C),wrap$1(this.request)}:function(...C){return wrap$1(x.apply(unwrap$1(this),C))}}function transformCachableValue$1(x){return typeof x=="function"?wrapFunction$1(x):(x instanceof IDBTransaction&&cacheDonePromiseForTransaction$1(x),instanceOfAny$1(x,getIdbProxyableTypes$1())?new Proxy(x,idbProxyTraps$1):x)}function wrap$1(x){if(x instanceof IDBRequest)return promisifyRequest$1(x);if(transformCache$1.has(x))return transformCache$1.get(x);const C=transformCachableValue$1(x);return C!==x&&(transformCache$1.set(x,C),reverseTransformCache$1.set(C,x)),C}const unwrap$1=x=>reverseTransformCache$1.get(x),readMethods$1=["get","getKey","getAll","getAllKeys","count"],writeMethods$1=["put","add","delete","clear"],cachedMethods$1=new Map;function getMethod$1(x,C){if(!(x instanceof IDBDatabase&&!(C in x)&&typeof C=="string"))return;if(cachedMethods$1.get(C))return cachedMethods$1.get(C);const E=C.replace(/FromIndex$/,""),w=C!==E,T=writeMethods$1.includes(E);if(!(E in(w?IDBIndex:IDBObjectStore).prototype)||!(T||readMethods$1.includes(E)))return;const _=async function(S,...R){const A=this.transaction(S,T?"readwrite":"readonly");let O=A.store;return w&&(O=O.index(R.shift())),(await Promise.all([O[E](...R),T&&A.done]))[0]};return cachedMethods$1.set(C,_),_}replaceTraps$1(x=>({...x,get:(C,E,w)=>getMethod$1(C,E)||x.get(C,E,w),has:(C,E)=>!!getMethod$1(C,E)||x.has(C,E)}));const advanceMethodProps$1=["continue","continuePrimaryKey","advance"],methodMap$1={},advanceResults$1=new WeakMap,ittrProxiedCursorToOriginalProxy$1=new WeakMap,cursorIteratorTraps$1={get(x,C){if(!advanceMethodProps$1.includes(C))return x[C];let E=methodMap$1[C];return E||(E=methodMap$1[C]=function(...w){advanceResults$1.set(this,ittrProxiedCursorToOriginalProxy$1.get(this)[C](...w))}),E}};async function*iterate$1(...x){let C=this;if(C instanceof IDBCursor||(C=await C.openCursor(...x)),!C)return;C=C;const E=new Proxy(C,cursorIteratorTraps$1);for(ittrProxiedCursorToOriginalProxy$1.set(E,C),reverseTransformCache$1.set(E,unwrap$1(C));C;)yield E,C=await(advanceResults$1.get(E)||C.continue()),advanceResults$1.delete(E)}function isIteratorProp$1(x,C){return C===Symbol.asyncIterator&&instanceOfAny$1(x,[IDBIndex,IDBObjectStore,IDBCursor])||C==="iterate"&&instanceOfAny$1(x,[IDBIndex,IDBObjectStore])}replaceTraps$1(x=>({...x,get(C,E,w){return isIteratorProp$1(C,E)?iterate$1:x.get(C,E,w)},has(C,E){return isIteratorProp$1(C,E)||x.has(C,E)}}));const MAX_SLOT_INDEX=199,VOICE_CHANGER_CLIENT_EXCEPTION={ERR_HTTP_EXCEPTION:"ERR_HTTP_EXCEPTION"},VoiceChangerInputMode={server:"server",client:"client"},VoiceChangerType={RVC:"RVC",Beatrice_v2:"Beatrice_v2"},EmbedderType={hubert_base_l9fp:"hubert_base_l9fp",hubert_base_l12:"hubert_base_l12",contentvec:"contentvec",hubert_base_japanese_l9fp:"hubert_base_japanese_l9fp",hubert_base_japanese_l12:"hubert_base_japanese_l12",whisper:"whisper",applio_japanese_hubert_base_l12:"applio_japanese_hubert_base_l12",applio_chinese_hubert_base_l12:"applio_chinese_hubert_base_l12",applio_korean_hubert_base_l12:"applio_korean_hubert_base_l12"},PitchEstimatorType={harvest:"harvest",dio:"dio",crepe_full:"crepe_full",crepe_tiny:"crepe_tiny",rmvpe:"rmvpe",rmvpe_onnx:"rmvpe_onnx",fcpe:"fcpe"};class FileUploaderClient{#e;enableFlatPath=!1;constructor(){this.#e=""}setBaseUrl=C=>{C.endsWith("/")&&(C=C.slice(0,-1)),this.#e=C};setEnableFlatPath=C=>{this.enableFlatPath=C};generatePath=C=>this.enableFlatPath?C[0]+C.slice(1).replace(/\//g,"_"):C;uploadFile=async(C,E,w)=>{const T=this.#e+this.generatePath("/api/uploader/upload_file_chunk");w(0,!1);const _=1024*1024;let S=0;const R=E.size,A=C+E.name,O=Math.ceil(R/_);for(;;){const H=[];for(let ee=0;ee<10&&!(S*_>=R);ee++){const te=E.slice(S*_,(S+1)*_),ie=new Promise(ne=>{const ae=new FormData;ae.append("file",new Blob([te])),ae.append("filename",`${A}`),ae.append("index",`${S}`);const oe=new Request(T,{method:"POST",body:ae});fetch(oe).then(async le=>{console.log(await le.text()),ne()})});S+=1,H.push(ie)}if(await Promise.all(H),S*_>=R)break;w(Math.floor(S/(O+1)*100),!1)}return O};concatUploadedFile=async(C,E)=>{const w=this.#e+this.generatePath("/api/uploader/concat_uploaded_file_chunk");await new Promise(T=>{const _=new FormData;_.append("filename",C),_.append("filename_chunk_num",""+E);const S=new Request(w,{method:"POST",body:_});fetch(S).then(async R=>{console.log(await R.text()),T()})})}}class RestResult{}class Ok extends RestResult{value;constructor(C){super(),this.value=C}isOk(){return!0}get(){return this.value}}class Err extends RestResult{error;constructor(C){super(),this.error=C}isOk(){return!1}get(){throw this.error}}class RestClient{#e;constructor(){this.#e=""}setBaseUrl=C=>{C.endsWith("/")&&(C=C.slice(0,-1)),this.#e=C};execFetch=async(C,E="json")=>new Promise(w=>{fetch(C).then(async T=>{if(T.ok){let _;E==="blob"?_=await T.blob():_=await T.json(),w(new Ok(_))}else{const _=await T.text();try{const S=JSON.parse(_);if(S.error!=null){const R=JSON.parse(S.error),A={type:"ERR_HTTP_EXCEPTION",status:T.status,statusText:T.statusText,code:R.code,reason:R.reason,action:R.action,detail:R.detail};w(new Err(A))}else{const R={type:"ERR_HTTP_EXCEPTION",status:T.status,statusText:T.statusText,code:S.code,reason:"no detail",action:"no action",detail:S.detail};w(new Err(R))}}catch(S){const R={type:"ERR_HTTP_EXCEPTION",status:T.status,statusText:T.statusText,code:-1,reason:`JSON parse error: ${S}`,action:"Check server response",detail:_.substring(0,200)};w(new Err(R))}}}).catch(T=>{console.error(T);const _={type:"ERR_HTTP_EXCEPTION",status:0,statusText:"",code:-1,reason:`${T}`,action:"",detail:null};w(new Err(_))})});getRequest=async(C,E="json")=>{let w=C.startsWith("/")?`${this.#e}${C}`:`${this.#e}/${C}`;const T=new Request(w,{method:"GET"}),_=await this.execFetch(T,E);if(!_.isOk())throw _.get();return _.get()};postRequest=async(C,E,w="json")=>{let T=C.startsWith("/")?`${this.#e}${C}`:`${this.#e}/${C}`;const _=new Request(T,{method:"POST",body:JSON.stringify(E),headers:{"Content-Type":"application/json"}}),S=await this.execFetch(_,w);if(!S.isOk())throw S.get();return S.get()};putRequest=async(C,E,w="json")=>{let T=C.startsWith("/")?`${this.#e}${C}`:`${this.#e}/${C}`;const _=new Request(T,{method:"PUT",body:JSON.stringify(E),headers:{"Content-Type":"application/json"}}),S=await this.execFetch(_,w);if(!S.isOk())throw S.get();return S.get()};deleteRequest=async(C,E,w="json")=>{let T=C.startsWith("/")?`${this.#e}${C}`:`${this.#e}/${C}`,_;E!=null?_=new Request(T,{method:"DELETE",body:JSON.stringify(E),headers:{"Content-Type":"application/json"}}):_=new Request(T,{method:"DELETE"});const S=await this.execFetch(_,w);if(!S.isOk())throw S.get();return S.get()}}class VCRestClient{static _instance=null;restClient;fileUploaderClient;enableFlatPath=!1;constructor(){this.restClient=new RestClient,this.fileUploaderClient=new FileUploaderClient}static getInstance=()=>(VCRestClient._instance===null&&(VCRestClient._instance=new VCRestClient),VCRestClient._instance);setBaseUrl=C=>{this.restClient.setBaseUrl(C),this.fileUploaderClient.setBaseUrl(C)};setEnableFlatPath=C=>{this.enableFlatPath=C,this.fileUploaderClient.setEnableFlatPath(C)};generatePath=C=>this.enableFlatPath?C[0]+C.slice(1).replace(/\//g,"_"):C;initializeServer=async()=>{const C=this.generatePath("/api/operation/initialize");await this.restClient.postRequest(C,null)};getServerAudioInputDevices=async(C=!1)=>{let E=this.generatePath("/api/audio-device-manager/input_devices");return C&&(E+="?reload=true"),await this.restClient.getRequest(E)};getServerAudioOutputDevices=async(C=!1)=>{let E=this.generatePath("/api/audio-device-manager/output_devices");return C&&(E+="?reload=true"),await this.restClient.getRequest(E)};getServerProperties=async()=>{const C=this.generatePath("/api/server-properties/properties");return await this.restClient.getRequest(C)};getServerConfiguration=async()=>{const C=this.generatePath("/api/configuration-manager/configuration");return await this.restClient.getRequest(C)};updateServerConfiguration=async C=>{const E=this.generatePath("/api/configuration-manager/configuration");await this.restClient.putRequest(E,C)};getServerGPUInfo=async()=>{const C=this.generatePath("/api/gpu-device-manager/devices");return await this.restClient.getRequest(C)};getServerModuleStatus=async(C=!1)=>{let E=this.generatePath("/api/module-manager/modules");return C&&(E+="?reload=true"),await this.restClient.getRequest(E)};downloadApplioModules=async()=>{const C=this.generatePath("/api/module-manager/modules/operation/download_applio_modules");return await this.restClient.postRequest(C,null)};getSamples=async()=>{const C=this.generatePath("/api/sample-manager/samples");return await this.restClient.getRequest(C)};downloadSample=async(C,E)=>{const w=this.generatePath("/api/sample-manager/samples/operation/download"),T={slot_index:C,sample_id:E};return await this.restClient.postRequest(w,T)};getServerSlotInfos=async()=>{const C=this.generatePath("/api/slot-manager/slots");return await this.restClient.getRequest(C)};getServerSlotInfo=async C=>{const E=this.generatePath(`/api/slot-manager/slots/${C}`);return await this.restClient.getRequest(E)};uploadFile=async(C,E,w)=>{const T=await this.fileUploaderClient.uploadFile(C,E,w);await this.fileUploaderClient.concatUploadedFile(E.name,T)};uploadRVCModelFile=async(C,E,w,T,_)=>{const S=w!=null?2:1;await this.uploadFile("",E,(O,H)=>{_(O/S,!1)}),w!=null&&await this.uploadFile("",w,(O,H)=>{_(O/S+100/S,!1)});const R=this.generatePath("/api/slot-manager/slots"),A={slot_index:C??null,voice_changer_type:"RVC",name:E.name.split(".")[0],model_file:E.name,index_file:w?.name??null,embedder:T};await this.restClient.postRequest(R,A),_(100,!0)};uploadBeatriceV2ModelFile=async(C,E,w)=>{await this.uploadFile("",E,(S,R)=>{w(S/1,!1)});const T=this.generatePath("/api/slot-manager/slots"),_={slot_index:C??null,voice_changer_type:"Beatrice_v2",name:E.name.split(".")[0],zip_file:E.name};await this.restClient.postRequest(T,_),w(100,!0)};uploadIconFile=async(C,E,w)=>{await this.uploadFile("",E,(S,R)=>{w(S,!1)});const T=this.generatePath("/api/slot-manager/slots/operation/set_icon_file"),_={slot_index:C,icon_file:E.name};await this.restClient.postRequest(T,_)};updateServerSlotInfo=async C=>{const E=this.generatePath(`/api/slot-manager/slots/${C.slot_index}`);await this.restClient.putRequest(E,C)};deleteServerSlotInfo=async C=>{const E=this.generatePath(`/api/slot-manager/slots/${C}`);await this.restClient.deleteRequest(E,null)};mergeModels=async C=>{const E=this.generatePath("/api/slot-manager/slots/operation/merge_models");await this.restClient.postRequest(E,C)};exportToOnnx=async C=>{const E=this.generatePath("/api/slot-manager/slots/operation/export_onnx");await this.restClient.postRequest(E,C)};export=async C=>{const E=this.generatePath("/api/slot-manager/slots/operation/export");return await this.restClient.postRequest(E,C,"blob")};moveMergedModel=async C=>{const E=this.generatePath("/api/slot-manager/slots/operation/move_merged_model");await this.restClient.postRequest(E,C)};moveExportedOnnxModel=async C=>{const E=this.generatePath("/api/slot-manager/slots/operation/move_exported_onnx_model");await this.restClient.postRequest(E,C)};moveModel=async C=>{const E=this.generatePath("/api/slot-manager/slots/operation/move_model");await this.restClient.postRequest(E,C)};refreshQueue=async()=>{const C=this.generatePath("/api/voice-changer/operation/refresh_queue");await this.restClient.postRequest(C,null)};startServerDevice=async()=>{const C=this.generatePath("/api/local-voice-changer-interface/operation/start");await this.restClient.postRequest(C,null)};stopServerDevice=async()=>{const C=this.generatePath("/api/local-voice-changer-interface/operation/stop");await this.restClient.postRequest(C,null)};truncateOutputBuffer=async()=>{const C=this.generatePath("/api/local-voice-changer-interface/operation/truncate-output-buffer");await this.restClient.postRequest(C,null)};getVoiceChangerManagerInfo=async()=>{const C=this.generatePath("/api/voice-changer-manager/information");return await this.restClient.getRequest(C)};getLocalVoiceChangerInterfaceInfo=async()=>{const C=this.generatePath("/api/local-voice-changer-interface/information");return await this.restClient.getRequest(C)};getTask=async C=>{const E=this.generatePath(`/api/task-manager/tasks/${C}`);return await this.restClient.getRequest(E)};deleteTask=async C=>{const E=this.generatePath(`/api/task-manager/tasks/${C}`);await this.restClient.deleteRequest(E,null)};uploadBeatriceV2VoiceIconFile=async(C,E,w,T)=>{await this.uploadFile("",w,(R,A)=>{T(R,!1)});const _=this.generatePath("/api/slot-manager/slots/operation/beatricev2/set_voice_icon_file"),S={slot_index:C,voice_index:E,icon_file:w.name};await this.restClient.postRequest(_,S)};updateBeatriceV2VoiceName=async(C,E,w)=>{const T=this.generatePath("/api/slot-manager/slots/operation/beatricev2/set_voice_name"),_={slot_index:C,voice_index:E,voice_name:w};await this.restClient.postRequest(T,_)};updateBeatriceV2VoiceDescription=async(C,E,w)=>{const T=this.generatePath("/api/slot-manager/slots/operation/beatricev2/set_voice_description"),_={slot_index:C,voice_index:E,voice_description:w};await this.restClient.postRequest(T,_)};setLocalVoiceChangerDummyInput=async C=>{const E=this.generatePath("/api/local-voice-changer-interface/operation/set_dummy_input"),w={url:C};await this.restClient.postRequest(E,w)}}const workerjs=`const a = "[voicechanger-worklet-processor]", p = {
  config: "config",
  start: "start",
  stop: "stop",
  sendConvertedVoice: "sendConvertedVoice",
  resetBuffer: "resetBuffer",
  startInputRecording: "startInputRecording",
  stopInputRecording: "stopInputRecording",
  startOutputRecording: "startOutputRecording",
  stopOutputRecording: "stopOutputRecording",
  sendOriginalVoice: "sendOriginalVoice",
  sendRealtimeOutputStatus: "sendRealtimeOutputStatus",
  getOutputBufferSize: "getOutputBufferSize"
}, o = (u, ...s) => {
  u === "info" ? console.log(a, ...s) : u === "warn" ? console.warn(a, ...s) : u === "error" && console.error(a, ...s);
};
class c extends AudioWorkletProcessor {
  BLOCK_SIZE = 128;
  initialized = !1;
  // private volume = 0;
  isStarted = !1;
  passthrough = !1;
  isInputRecordingStarted = !1;
  isOutputRecordingStarted = !1;
  inputRecording = [];
  outputRecording = [];
  realtimeOutputStatusEnabled = !1;
  realtimeOutputStatusSendIntervalSec = 0.2;
  // デフォルト値
  realtimeOutputStatusSendInterval = this.realtimeOutputStatusSendIntervalSec / (this.BLOCK_SIZE / 48e3);
  // デフォルト値 (this.BLOCK_SIZE / 48000)はブロックサイズあたりの秒数
  volumeCalculationBuffer = [];
  processCallCounter = 0;
  // 入力音声バッファ関連のプロパティを追加
  sendingChunkSec = 0.2;
  // デフォルト値
  inputVoiceBuffer = [];
  bufferedSamplesCount = 0;
  SAMPLE_RATE = 48e3;
  // サンプルレート
  playBuffer = [];
  unpushedF32Data = new Float32Array(0);
  /**
   * @constructor
   */
  constructor() {
    super(), o("info", "VoiceChangerWorkletProcessor is created."), this.initialized = !0, this.port.onmessage = this.handleMessage.bind(this);
  }
  trancateBuffer = (s) => {
    for (this.passthrough == !1 && o("info", "Buffer truncated", s); this.playBuffer.length > s; )
      this.playBuffer.shift();
  };
  handleMessage(s) {
    const e = s.data;
    if (e.commandType === "config") {
      const t = e;
      this.realtimeOutputStatusEnabled = t.config.realtimeOutputStatusEnabled, this.passthrough = t.config.isPassthroughEnabled, this.realtimeOutputStatusSendIntervalSec = t.config.realtimeOutputStatusSendIntervalSec, this.realtimeOutputStatusSendInterval = this.realtimeOutputStatusSendIntervalSec / (this.BLOCK_SIZE / 48e3), this.sendingChunkSec = t.config.sendingChunkSec;
      const r = {
        commandType: "config",
        status: "ok"
      };
      this.port.postMessage(r);
      return;
    } else if (e.commandType === "start") {
      if (this.isStarted) {
        o("warn", \`audio processor is already started. \${this.isStarted}\`);
        return;
      }
      this.isStarted = !0;
      const t = {
        commandType: "start",
        status: "ok"
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "stop") {
      if (!this.isStarted) {
        o("warn", \`audio processor is not started. \${this.isStarted}\`);
        return;
      }
      this.isStarted = !1;
      const t = {
        commandType: "stop",
        status: "ok"
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "sendConvertedVoice") {
      const t = e;
      this.addConvertedVoice(t.voice);
      const r = {
        commandType: "sendConvertedVoice",
        status: "ok"
      };
      this.port.postMessage(r);
      return;
    } else if (e.commandType === "resetBuffer") {
      this.trancateBuffer(0), this.resetInputVoiceBuffer();
      const t = {
        commandType: "resetBuffer",
        status: "ok"
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "startInputRecording") {
      this.inputRecording = [], this.isInputRecordingStarted = !0;
      const t = {
        commandType: "startInputRecording",
        status: "ok"
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "stopInputRecording") {
      this.isInputRecordingStarted = !1;
      const t = {
        commandType: "stopInputRecording",
        status: "ok",
        inputRecording: this.inputRecording
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "startOutputRecording") {
      this.outputRecording = [], this.isOutputRecordingStarted = !0;
      const t = {
        commandType: "startOutputRecording",
        status: "ok"
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "stopOutputRecording") {
      this.isOutputRecordingStarted = !1;
      const t = {
        commandType: "stopOutputRecording",
        status: "ok",
        outputRecording: this.outputRecording
      };
      this.port.postMessage(t);
      return;
    } else if (e.commandType === "getOutputBufferSize") {
      const t = {
        commandType: "getOutputBufferSize",
        status: "ok",
        outputBufferSize: this.playBuffer.length * this.BLOCK_SIZE
      };
      this.port.postMessage(t);
      return;
    } else
      o("error", "unknown command", e);
  }
  addConvertedVoice = (s) => {
    const e = s, t = new Float32Array(this.unpushedF32Data.length + e.length);
    t.set(this.unpushedF32Data), t.set(e, this.unpushedF32Data.length), this.isOutputRecordingStarted && this.outputRecording.push(e);
    const r = Math.floor(t.length / this.BLOCK_SIZE);
    for (let n = 0; n < r; n++) {
      const i = t.slice(n * this.BLOCK_SIZE, (n + 1) * this.BLOCK_SIZE);
      this.playBuffer.push(i);
    }
    this.unpushedF32Data = t.slice(r * this.BLOCK_SIZE);
  };
  pushData = (s) => {
    this.inputVoiceBuffer.push(s.slice()), this.bufferedSamplesCount += s.length;
    const e = this.sendingChunkSec * this.SAMPLE_RATE;
    this.bufferedSamplesCount >= e && this.sendBufferedVoice(e), this.isInputRecordingStarted && this.inputRecording.push(s);
  };
  sendBufferedVoice = (s) => {
    const e = this.extractSamplesFromBuffer(s), t = {
      commandType: "sendOriginalVoice",
      voice: e
    };
    this.port.postMessage(t, [e.buffer]);
  };
  extractSamplesFromBuffer = (s) => {
    const e = new Float32Array(s);
    let t = 0, r = s;
    for (; r > 0 && this.inputVoiceBuffer.length > 0; ) {
      const n = this.inputVoiceBuffer[0], i = Math.min(r, n.length);
      e.set(n.subarray(0, i), t), i === n.length ? this.inputVoiceBuffer.shift() : this.inputVoiceBuffer[0] = n.subarray(i), t += i, r -= i, this.bufferedSamplesCount -= i;
    }
    return e.subarray(0, t);
  };
  resetInputVoiceBuffer = () => {
    this.inputVoiceBuffer = [], this.bufferedSamplesCount = 0;
  };
  calculateAndSendRealtimeOutputStatus = () => {
    if (this.volumeCalculationBuffer.length === 0)
      return;
    const s = this.volumeCalculationBuffer.reduce((n, i) => n + i.length, 0), e = new Float32Array(s);
    let t = 0;
    for (const n of this.volumeCalculationBuffer)
      e.set(n, t), t += n.length;
    const r = {
      commandType: "sendRealtimeOutputStatus",
      // volume: this.volume,
      realtimeOutputStatusSendIntervalSec: this.realtimeOutputStatusSendIntervalSec,
      realtimeOutputStatusSendInterval: this.realtimeOutputStatusSendInterval,
      outputBufferSize: this.playBuffer.length * this.BLOCK_SIZE
    };
    this.port.postMessage(r), this.volumeCalculationBuffer = [];
  };
  process(s, e, t) {
    if (!this.initialized)
      return o("warn", "worklet_process not ready"), !0;
    if (this.isStarted) {
      if (this.passthrough) {
        this.trancateBuffer(0);
        const n = s[0];
        return e[0][0].set(n[0]), !0;
      }
      s.length > 0 && s[0].length > 0 ? this.pushData(s[0][0]) : o("warn", "no input data");
    }
    if (this.playBuffer.length === 0)
      return !0;
    const r = this.playBuffer.shift();
    return r ? (this.realtimeOutputStatusEnabled && (this.volumeCalculationBuffer.push(r.slice()), this.processCallCounter++, this.processCallCounter >= this.realtimeOutputStatusSendInterval && (this.calculateAndSendRealtimeOutputStatus(), this.processCallCounter = 0)), e[0][0].set(r), e[0].length == 2 && e[0][1].set(r)) : o("warn", "no voice data"), !0;
  }
}
registerProcessor("voice-changer-worklet-processor", c);
export {
  p as CommandType
};
`,PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(x=>{PACKET_TYPES_REVERSE[PACKET_TYPES[x]]=x});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=x=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(x):x&&x.buffer instanceof ArrayBuffer,encodePacket=({type:x,data:C},E,w)=>withNativeBlob$1&&C instanceof Blob?E?w(C):encodeBlobAsBase64(C,w):withNativeArrayBuffer$2&&(C instanceof ArrayBuffer||isView$1(C))?E?w(C):encodeBlobAsBase64(new Blob([C]),w):w(PACKET_TYPES[x]+(C||"")),encodeBlobAsBase64=(x,C)=>{const E=new FileReader;return E.onload=function(){const w=E.result.split(",")[1];C("b"+(w||""))},E.readAsDataURL(x)};function toArray(x){return x instanceof Uint8Array?x:x instanceof ArrayBuffer?new Uint8Array(x):new Uint8Array(x.buffer,x.byteOffset,x.byteLength)}let TEXT_ENCODER$1;function encodePacketToBinary(x,C){if(withNativeBlob$1&&x.data instanceof Blob)return x.data.arrayBuffer().then(toArray).then(C);if(withNativeArrayBuffer$2&&(x.data instanceof ArrayBuffer||isView$1(x.data)))return C(toArray(x.data));encodePacket(x,!1,E=>{TEXT_ENCODER$1||(TEXT_ENCODER$1=new TextEncoder),C(TEXT_ENCODER$1.encode(E))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let x=0;x<chars.length;x++)lookup$1[chars.charCodeAt(x)]=x;const decode$1=x=>{let C=x.length*.75,E=x.length,w,T=0,_,S,R,A;x[x.length-1]==="="&&(C--,x[x.length-2]==="="&&C--);const O=new ArrayBuffer(C),H=new Uint8Array(O);for(w=0;w<E;w+=4)_=lookup$1[x.charCodeAt(w)],S=lookup$1[x.charCodeAt(w+1)],R=lookup$1[x.charCodeAt(w+2)],A=lookup$1[x.charCodeAt(w+3)],H[T++]=_<<2|S>>4,H[T++]=(S&15)<<4|R>>2,H[T++]=(R&3)<<6|A&63;return O},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(x,C)=>{if(typeof x!="string")return{type:"message",data:mapBinary(x,C)};const E=x.charAt(0);return E==="b"?{type:"message",data:decodeBase64Packet(x.substring(1),C)}:PACKET_TYPES_REVERSE[E]?x.length>1?{type:PACKET_TYPES_REVERSE[E],data:x.substring(1)}:{type:PACKET_TYPES_REVERSE[E]}:ERROR_PACKET},decodeBase64Packet=(x,C)=>{if(withNativeArrayBuffer$1){const E=decode$1(x);return mapBinary(E,C)}else return{base64:!0,data:x}},mapBinary=(x,C)=>{switch(C){case"blob":return x instanceof Blob?x:new Blob([x]);case"arraybuffer":default:return x instanceof ArrayBuffer?x:x.buffer}},SEPARATOR="",encodePayload=(x,C)=>{const E=x.length,w=new Array(E);let T=0;x.forEach((_,S)=>{encodePacket(_,!1,R=>{w[S]=R,++T===E&&C(w.join(SEPARATOR))})})},decodePayload=(x,C)=>{const E=x.split(SEPARATOR),w=[];for(let T=0;T<E.length;T++){const _=decodePacket(E[T],C);if(w.push(_),_.type==="error")break}return w};function createPacketEncoderStream(){return new TransformStream({transform(x,C){encodePacketToBinary(x,E=>{const w=E.length;let T;if(w<126)T=new Uint8Array(1),new DataView(T.buffer).setUint8(0,w);else if(w<65536){T=new Uint8Array(3);const _=new DataView(T.buffer);_.setUint8(0,126),_.setUint16(1,w)}else{T=new Uint8Array(9);const _=new DataView(T.buffer);_.setUint8(0,127),_.setBigUint64(1,BigInt(w))}x.data&&typeof x.data!="string"&&(T[0]|=128),C.enqueue(T),C.enqueue(E)})}})}let TEXT_DECODER;function totalLength(x){return x.reduce((C,E)=>C+E.length,0)}function concatChunks(x,C){if(x[0].length===C)return x.shift();const E=new Uint8Array(C);let w=0;for(let T=0;T<C;T++)E[T]=x[0][w++],w===x[0].length&&(x.shift(),w=0);return x.length&&w<x[0].length&&(x[0]=x[0].slice(w)),E}function createPacketDecoderStream(x,C){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const E=[];let w=0,T=-1,_=!1;return new TransformStream({transform(S,R){for(E.push(S);;){if(w===0){if(totalLength(E)<1)break;const A=concatChunks(E,1);_=(A[0]&128)===128,T=A[0]&127,T<126?w=3:T===126?w=1:w=2}else if(w===1){if(totalLength(E)<2)break;const A=concatChunks(E,2);T=new DataView(A.buffer,A.byteOffset,A.length).getUint16(0),w=3}else if(w===2){if(totalLength(E)<8)break;const A=concatChunks(E,8),O=new DataView(A.buffer,A.byteOffset,A.length),H=O.getUint32(0);if(H>Math.pow(2,21)-1){R.enqueue(ERROR_PACKET);break}T=H*Math.pow(2,32)+O.getUint32(4),w=3}else{if(totalLength(E)<T)break;const A=concatChunks(E,T);R.enqueue(decodePacket(_?A:TEXT_DECODER.decode(A),C)),w=0}if(T===0||T>x){R.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(x){if(x)return mixin(x)}function mixin(x){for(var C in Emitter.prototype)x[C]=Emitter.prototype[C];return x}Emitter.prototype.on=Emitter.prototype.addEventListener=function(x,C){return this._callbacks=this._callbacks||{},(this._callbacks["$"+x]=this._callbacks["$"+x]||[]).push(C),this};Emitter.prototype.once=function(x,C){function E(){this.off(x,E),C.apply(this,arguments)}return E.fn=C,this.on(x,E),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(x,C){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var E=this._callbacks["$"+x];if(!E)return this;if(arguments.length==1)return delete this._callbacks["$"+x],this;for(var w,T=0;T<E.length;T++)if(w=E[T],w===C||w.fn===C){E.splice(T,1);break}return E.length===0&&delete this._callbacks["$"+x],this};Emitter.prototype.emit=function(x){this._callbacks=this._callbacks||{};for(var C=new Array(arguments.length-1),E=this._callbacks["$"+x],w=1;w<arguments.length;w++)C[w-1]=arguments[w];if(E){E=E.slice(0);for(var w=0,T=E.length;w<T;++w)E[w].apply(this,C)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(x){return this._callbacks=this._callbacks||{},this._callbacks["$"+x]||[]};Emitter.prototype.hasListeners=function(x){return!!this.listeners(x).length};const nextTick=typeof Promise=="function"&&typeof Promise.resolve=="function"?x=>Promise.resolve().then(x):(x,C)=>C(x,0),globalThisShim=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),defaultBinaryType="arraybuffer";function pick(x,...C){return C.reduce((E,w)=>(x.hasOwnProperty(w)&&(E[w]=x[w]),E),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(x,C){C.useNativeTimers?(x.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),x.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(x.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),x.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(x){return typeof x=="string"?utf8Length(x):Math.ceil((x.byteLength||x.size)*BASE64_OVERHEAD)}function utf8Length(x){let C=0,E=0;for(let w=0,T=x.length;w<T;w++)C=x.charCodeAt(w),C<128?E+=1:C<2048?E+=2:C<55296||C>=57344?E+=3:(w++,E+=4);return E}function randomString(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function encode(x){let C="";for(let E in x)x.hasOwnProperty(E)&&(C.length&&(C+="&"),C+=encodeURIComponent(E)+"="+encodeURIComponent(x[E]));return C}function decode(x){let C={},E=x.split("&");for(let w=0,T=E.length;w<T;w++){let _=E[w].split("=");C[decodeURIComponent(_[0])]=decodeURIComponent(_[1])}return C}class TransportError extends Error{constructor(C,E,w){super(C),this.description=E,this.context=w,this.type="TransportError"}}class Transport extends Emitter{constructor(C){super(),this.writable=!1,installTimerFunctions(this,C),this.opts=C,this.query=C.query,this.socket=C.socket,this.supportsBinary=!C.forceBase64}onError(C,E,w){return super.emitReserved("error",new TransportError(C,E,w)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(C){this.readyState==="open"&&this.write(C)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(C){const E=decodePacket(C,this.socket.binaryType);this.onPacket(E)}onPacket(C){super.emitReserved("packet",C)}onClose(C){this.readyState="closed",super.emitReserved("close",C)}pause(C){}createUri(C,E={}){return C+"://"+this._hostname()+this._port()+this.opts.path+this._query(E)}_hostname(){const C=this.opts.hostname;return C.indexOf(":")===-1?C:"["+C+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(C){const E=encode(C);return E.length?"?"+E:""}}class Polling extends Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(C){this.readyState="pausing";const E=()=>{this.readyState="paused",C()};if(this._polling||!this.writable){let w=0;this._polling&&(w++,this.once("pollComplete",function(){--w||E()})),this.writable||(w++,this.once("drain",function(){--w||E()}))}else E()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(C){const E=w=>{if(this.readyState==="opening"&&w.type==="open"&&this.onOpen(),w.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(w)};decodePayload(C,this.socket.binaryType).forEach(E),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const C=()=>{this.write([{type:"close"}])};this.readyState==="open"?C():this.once("open",C)}write(C){this.writable=!1,encodePayload(C,E=>{this.doWrite(E,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const C=this.opts.secure?"https":"http",E=this.query||{};return this.opts.timestampRequests!==!1&&(E[this.opts.timestampParam]=randomString()),!this.supportsBinary&&!E.sid&&(E.b64=1),this.createUri(C,E)}}let value=!1;try{value=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const hasCORS=value;function empty(){}class BaseXHR extends Polling{constructor(C){if(super(C),typeof location<"u"){const E=location.protocol==="https:";let w=location.port;w||(w=E?"443":"80"),this.xd=typeof location<"u"&&C.hostname!==location.hostname||w!==C.port}}doWrite(C,E){const w=this.request({method:"POST",data:C});w.on("success",E),w.on("error",(T,_)=>{this.onError("xhr post error",T,_)})}doPoll(){const C=this.request();C.on("data",this.onData.bind(this)),C.on("error",(E,w)=>{this.onError("xhr poll error",E,w)}),this.pollXhr=C}}let Request$1=class hc extends Emitter{constructor(C,E,w){super(),this.createRequest=C,installTimerFunctions(this,w),this._opts=w,this._method=w.method||"GET",this._uri=E,this._data=w.data!==void 0?w.data:null,this._create()}_create(){var C;const E=pick(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");E.xdomain=!!this._opts.xd;const w=this._xhr=this.createRequest(E);try{w.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){w.setDisableHeaderCheck&&w.setDisableHeaderCheck(!0);for(let T in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(T)&&w.setRequestHeader(T,this._opts.extraHeaders[T])}}catch{}if(this._method==="POST")try{w.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{w.setRequestHeader("Accept","*/*")}catch{}(C=this._opts.cookieJar)===null||C===void 0||C.addCookies(w),"withCredentials"in w&&(w.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(w.timeout=this._opts.requestTimeout),w.onreadystatechange=()=>{var T;w.readyState===3&&((T=this._opts.cookieJar)===null||T===void 0||T.parseCookies(w.getResponseHeader("set-cookie"))),w.readyState===4&&(w.status===200||w.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof w.status=="number"?w.status:0)},0))},w.send(this._data)}catch(T){this.setTimeoutFn(()=>{this._onError(T)},0);return}typeof document<"u"&&(this._index=hc.requestsCount++,hc.requests[this._index]=this)}_onError(C){this.emitReserved("error",C,this._xhr),this._cleanup(!0)}_cleanup(C){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=empty,C)try{this._xhr.abort()}catch{}typeof document<"u"&&delete hc.requests[this._index],this._xhr=null}}_onLoad(){const C=this._xhr.responseText;C!==null&&(this.emitReserved("data",C),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const x="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(x,unloadHandler,!1)}}function unloadHandler(){for(let x in Request$1.requests)Request$1.requests.hasOwnProperty(x)&&Request$1.requests[x].abort()}const hasXHR2=function(){const x=newRequest({xdomain:!1});return x&&x.responseType!==null}();class XHR extends BaseXHR{constructor(C){super(C);const E=C&&C.forceBase64;this.supportsBinary=hasXHR2&&!E}request(C={}){return Object.assign(C,{xd:this.xd},this.opts),new Request$1(newRequest,this.uri(),C)}}function newRequest(x){const C=x.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!C||hasCORS))return new XMLHttpRequest}catch{}if(!C)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class BaseWS extends Transport{get name(){return"websocket"}doOpen(){const C=this.uri(),E=this.opts.protocols,w=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(w.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(C,E,w)}catch(T){return this.emitReserved("error",T)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=C=>this.onClose({description:"websocket connection closed",context:C}),this.ws.onmessage=C=>this.onData(C.data),this.ws.onerror=C=>this.onError("websocket error",C)}write(C){this.writable=!1;for(let E=0;E<C.length;E++){const w=C[E],T=E===C.length-1;encodePacket(w,this.supportsBinary,_=>{try{this.doWrite(w,_)}catch{}T&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const C=this.opts.secure?"wss":"ws",E=this.query||{};return this.opts.timestampRequests&&(E[this.opts.timestampParam]=randomString()),this.supportsBinary||(E.b64=1),this.createUri(C,E)}}const WebSocketCtor=globalThisShim.WebSocket||globalThisShim.MozWebSocket;class WS extends BaseWS{createSocket(C,E,w){return isReactNative?new WebSocketCtor(C,E,w):E?new WebSocketCtor(C,E):new WebSocketCtor(C)}doWrite(C,E){this.ws.send(E)}}class WT extends Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(C){return this.emitReserved("error",C)}this._transport.closed.then(()=>{this.onClose()}).catch(C=>{this.onError("webtransport error",C)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(C=>{const E=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),w=C.readable.pipeThrough(E).getReader(),T=createPacketEncoderStream();T.readable.pipeTo(C.writable),this._writer=T.writable.getWriter();const _=()=>{w.read().then(({done:R,value:A})=>{R||(this.onPacket(A),_())}).catch(R=>{})};_();const S={type:"open"};this.query.sid&&(S.data=`{"sid":"${this.query.sid}"}`),this._writer.write(S).then(()=>this.onOpen())})})}write(C){this.writable=!1;for(let E=0;E<C.length;E++){const w=C[E],T=E===C.length-1;this._writer.write(w).then(()=>{T&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var C;(C=this._transport)===null||C===void 0||C.close()}}const transports={websocket:WS,webtransport:WT,polling:XHR},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse(x){if(x.length>8e3)throw"URI too long";const C=x,E=x.indexOf("["),w=x.indexOf("]");E!=-1&&w!=-1&&(x=x.substring(0,E)+x.substring(E,w).replace(/:/g,";")+x.substring(w,x.length));let T=re.exec(x||""),_={},S=14;for(;S--;)_[parts[S]]=T[S]||"";return E!=-1&&w!=-1&&(_.source=C,_.host=_.host.substring(1,_.host.length-1).replace(/;/g,":"),_.authority=_.authority.replace("[","").replace("]","").replace(/;/g,":"),_.ipv6uri=!0),_.pathNames=pathNames(_,_.path),_.queryKey=queryKey(_,_.query),_}function pathNames(x,C){const E=/\/{2,9}/g,w=C.replace(E,"/").split("/");return(C.slice(0,1)=="/"||C.length===0)&&w.splice(0,1),C.slice(-1)=="/"&&w.splice(w.length-1,1),w}function queryKey(x,C){const E={};return C.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(w,T,_){T&&(E[T]=_)}),E}const withEventListeners=typeof addEventListener=="function"&&typeof removeEventListener=="function",OFFLINE_EVENT_LISTENERS=[];withEventListeners&&addEventListener("offline",()=>{OFFLINE_EVENT_LISTENERS.forEach(x=>x())},!1);class SocketWithoutUpgrade extends Emitter{constructor(C,E){if(super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,C&&typeof C=="object"&&(E=C,C=null),C){const w=parse(C);E.hostname=w.host,E.secure=w.protocol==="https"||w.protocol==="wss",E.port=w.port,w.query&&(E.query=w.query)}else E.host&&(E.hostname=parse(E.host).host);installTimerFunctions(this,E),this.secure=E.secure!=null?E.secure:typeof location<"u"&&location.protocol==="https:",E.hostname&&!E.port&&(E.port=this.secure?"443":"80"),this.hostname=E.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=E.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},E.transports.forEach(w=>{const T=w.prototype.name;this.transports.push(T),this._transportsByName[T]=w}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},E),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode(this.opts.query)),withEventListeners&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},OFFLINE_EVENT_LISTENERS.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(C){const E=Object.assign({},this.opts.query);E.EIO=protocol$1,E.transport=C,this.id&&(E.sid=this.id);const w=Object.assign({},this.opts,{query:E,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[C]);return new this._transportsByName[C](w)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const C=this.opts.rememberUpgrade&&SocketWithoutUpgrade.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const E=this.createTransport(C);E.open(),this.setTransport(E)}setTransport(C){this.transport&&this.transport.removeAllListeners(),this.transport=C,C.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",E=>this._onClose("transport close",E))}onOpen(){this.readyState="open",SocketWithoutUpgrade.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(C){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",C),this.emitReserved("heartbeat"),C.type){case"open":this.onHandshake(JSON.parse(C.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const E=new Error("server error");E.code=C.data,this._onError(E);break;case"message":this.emitReserved("data",C.data),this.emitReserved("message",C.data);break}}onHandshake(C){this.emitReserved("handshake",C),this.id=C.sid,this.transport.query.sid=C.sid,this._pingInterval=C.pingInterval,this._pingTimeout=C.pingTimeout,this._maxPayload=C.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const C=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+C,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},C),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const C=this._getWritablePackets();this.transport.send(C),this._prevBufferLen=C.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let C=1;for(let E=0;E<this.writeBuffer.length;E++){const w=this.writeBuffer[E].data;if(w&&(C+=byteLength(w)),E>0&&C>this._maxPayload)return this.writeBuffer.slice(0,E);C+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const C=Date.now()>this._pingTimeoutTime;return C&&(this._pingTimeoutTime=0,nextTick(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),C}write(C,E,w){return this._sendPacket("message",C,E,w),this}send(C,E,w){return this._sendPacket("message",C,E,w),this}_sendPacket(C,E,w,T){if(typeof E=="function"&&(T=E,E=void 0),typeof w=="function"&&(T=w,w=null),this.readyState==="closing"||this.readyState==="closed")return;w=w||{},w.compress=w.compress!==!1;const _={type:C,data:E,options:w};this.emitReserved("packetCreate",_),this.writeBuffer.push(_),T&&this.once("flush",T),this.flush()}close(){const C=()=>{this._onClose("forced close"),this.transport.close()},E=()=>{this.off("upgrade",E),this.off("upgradeError",E),C()},w=()=>{this.once("upgrade",E),this.once("upgradeError",E)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?w():C()}):this.upgrading?w():C()),this}_onError(C){if(SocketWithoutUpgrade.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",C),this._onClose("transport error",C)}_onClose(C,E){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),withEventListeners&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const w=OFFLINE_EVENT_LISTENERS.indexOf(this._offlineEventListener);w!==-1&&OFFLINE_EVENT_LISTENERS.splice(w,1)}this.readyState="closed",this.id=null,this.emitReserved("close",C,E),this.writeBuffer=[],this._prevBufferLen=0}}}SocketWithoutUpgrade.protocol=protocol$1;class SocketWithUpgrade extends SocketWithoutUpgrade{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let C=0;C<this._upgrades.length;C++)this._probe(this._upgrades[C])}_probe(C){let E=this.createTransport(C),w=!1;SocketWithoutUpgrade.priorWebsocketSuccess=!1;const T=()=>{w||(E.send([{type:"ping",data:"probe"}]),E.once("packet",ee=>{if(!w)if(ee.type==="pong"&&ee.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",E),!E)return;SocketWithoutUpgrade.priorWebsocketSuccess=E.name==="websocket",this.transport.pause(()=>{w||this.readyState!=="closed"&&(H(),this.setTransport(E),E.send([{type:"upgrade"}]),this.emitReserved("upgrade",E),E=null,this.upgrading=!1,this.flush())})}else{const te=new Error("probe error");te.transport=E.name,this.emitReserved("upgradeError",te)}}))};function _(){w||(w=!0,H(),E.close(),E=null)}const S=ee=>{const te=new Error("probe error: "+ee);te.transport=E.name,_(),this.emitReserved("upgradeError",te)};function R(){S("transport closed")}function A(){S("socket closed")}function O(ee){E&&ee.name!==E.name&&_()}const H=()=>{E.removeListener("open",T),E.removeListener("error",S),E.removeListener("close",R),this.off("close",A),this.off("upgrading",O)};E.once("open",T),E.once("error",S),E.once("close",R),this.once("close",A),this.once("upgrading",O),this._upgrades.indexOf("webtransport")!==-1&&C!=="webtransport"?this.setTimeoutFn(()=>{w||E.open()},200):E.open()}onHandshake(C){this._upgrades=this._filterUpgrades(C.upgrades),super.onHandshake(C)}_filterUpgrades(C){const E=[];for(let w=0;w<C.length;w++)~this.transports.indexOf(C[w])&&E.push(C[w]);return E}}let Socket$1=class extends SocketWithUpgrade{constructor(x,C={}){const E=typeof x=="object"?x:C;(!E.transports||E.transports&&typeof E.transports[0]=="string")&&(E.transports=(E.transports||["polling","websocket","webtransport"]).map(w=>transports[w]).filter(w=>!!w)),super(x,E)}};function url(x,C="",E){let w=x;E=E||typeof location<"u"&&location,x==null&&(x=E.protocol+"//"+E.host),typeof x=="string"&&(x.charAt(0)==="/"&&(x.charAt(1)==="/"?x=E.protocol+x:x=E.host+x),/^(https?|wss?):\/\//.test(x)||(typeof E<"u"?x=E.protocol+"//"+x:x="https://"+x),w=parse(x)),w.port||(/^(http|ws)$/.test(w.protocol)?w.port="80":/^(http|ws)s$/.test(w.protocol)&&(w.port="443")),w.path=w.path||"/";const T=w.host.indexOf(":")!==-1?"["+w.host+"]":w.host;return w.id=w.protocol+"://"+T+":"+w.port+C,w.href=w.protocol+"://"+T+(E&&E.port===w.port?"":":"+w.port),w}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=x=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(x):x.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(x){return withNativeArrayBuffer&&(x instanceof ArrayBuffer||isView(x))||withNativeBlob&&x instanceof Blob||withNativeFile&&x instanceof File}function hasBinary(x,C){if(!x||typeof x!="object")return!1;if(Array.isArray(x)){for(let E=0,w=x.length;E<w;E++)if(hasBinary(x[E]))return!0;return!1}if(isBinary(x))return!0;if(x.toJSON&&typeof x.toJSON=="function"&&arguments.length===1)return hasBinary(x.toJSON(),!0);for(const E in x)if(Object.prototype.hasOwnProperty.call(x,E)&&hasBinary(x[E]))return!0;return!1}function deconstructPacket(x){const C=[],E=x.data,w=x;return w.data=_deconstructPacket(E,C),w.attachments=C.length,{packet:w,buffers:C}}function _deconstructPacket(x,C){if(!x)return x;if(isBinary(x)){const E={_placeholder:!0,num:C.length};return C.push(x),E}else if(Array.isArray(x)){const E=new Array(x.length);for(let w=0;w<x.length;w++)E[w]=_deconstructPacket(x[w],C);return E}else if(typeof x=="object"&&!(x instanceof Date)){const E={};for(const w in x)Object.prototype.hasOwnProperty.call(x,w)&&(E[w]=_deconstructPacket(x[w],C));return E}return x}function reconstructPacket(x,C){return x.data=_reconstructPacket(x.data,C),delete x.attachments,x}function _reconstructPacket(x,C){if(!x)return x;if(x&&x._placeholder===!0){if(typeof x.num=="number"&&x.num>=0&&x.num<C.length)return C[x.num];throw new Error("illegal attachments")}else if(Array.isArray(x))for(let E=0;E<x.length;E++)x[E]=_reconstructPacket(x[E],C);else if(typeof x=="object")for(const E in x)Object.prototype.hasOwnProperty.call(x,E)&&(x[E]=_reconstructPacket(x[E],C));return x}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(x){x[x.CONNECT=0]="CONNECT",x[x.DISCONNECT=1]="DISCONNECT",x[x.EVENT=2]="EVENT",x[x.ACK=3]="ACK",x[x.CONNECT_ERROR=4]="CONNECT_ERROR",x[x.BINARY_EVENT=5]="BINARY_EVENT",x[x.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(C){this.replacer=C}encode(C){return(C.type===PacketType.EVENT||C.type===PacketType.ACK)&&hasBinary(C)?this.encodeAsBinary({type:C.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:C.nsp,data:C.data,id:C.id}):[this.encodeAsString(C)]}encodeAsString(C){let E=""+C.type;return(C.type===PacketType.BINARY_EVENT||C.type===PacketType.BINARY_ACK)&&(E+=C.attachments+"-"),C.nsp&&C.nsp!=="/"&&(E+=C.nsp+","),C.id!=null&&(E+=C.id),C.data!=null&&(E+=JSON.stringify(C.data,this.replacer)),E}encodeAsBinary(C){const E=deconstructPacket(C),w=this.encodeAsString(E.packet),T=E.buffers;return T.unshift(w),T}}function isObject(x){return Object.prototype.toString.call(x)==="[object Object]"}class Decoder extends Emitter{constructor(C){super(),this.reviver=C}add(C){let E;if(typeof C=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");E=this.decodeString(C);const w=E.type===PacketType.BINARY_EVENT;w||E.type===PacketType.BINARY_ACK?(E.type=w?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(E),E.attachments===0&&super.emitReserved("decoded",E)):super.emitReserved("decoded",E)}else if(isBinary(C)||C.base64)if(this.reconstructor)E=this.reconstructor.takeBinaryData(C),E&&(this.reconstructor=null,super.emitReserved("decoded",E));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+C)}decodeString(C){let E=0;const w={type:Number(C.charAt(0))};if(PacketType[w.type]===void 0)throw new Error("unknown packet type "+w.type);if(w.type===PacketType.BINARY_EVENT||w.type===PacketType.BINARY_ACK){const _=E+1;for(;C.charAt(++E)!=="-"&&E!=C.length;);const S=C.substring(_,E);if(S!=Number(S)||C.charAt(E)!=="-")throw new Error("Illegal attachments");w.attachments=Number(S)}if(C.charAt(E+1)==="/"){const _=E+1;for(;++E&&!(C.charAt(E)===","||E===C.length););w.nsp=C.substring(_,E)}else w.nsp="/";const T=C.charAt(E+1);if(T!==""&&Number(T)==T){const _=E+1;for(;++E;){const S=C.charAt(E);if(S==null||Number(S)!=S){--E;break}if(E===C.length)break}w.id=Number(C.substring(_,E+1))}if(C.charAt(++E)){const _=this.tryParse(C.substr(E));if(Decoder.isPayloadValid(w.type,_))w.data=_;else throw new Error("invalid payload")}return w}tryParse(C){try{return JSON.parse(C,this.reviver)}catch{return!1}}static isPayloadValid(C,E){switch(C){case PacketType.CONNECT:return isObject(E);case PacketType.DISCONNECT:return E===void 0;case PacketType.CONNECT_ERROR:return typeof E=="string"||isObject(E);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(E)&&(typeof E[0]=="number"||typeof E[0]=="string"&&RESERVED_EVENTS$1.indexOf(E[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(E)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(C){this.packet=C,this.buffers=[],this.reconPack=C}takeBinaryData(C){if(this.buffers.push(C),this.buffers.length===this.reconPack.attachments){const E=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),E}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on(x,C,E){return x.on(C,E),function(){x.off(C,E)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(C,E,w){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=C,this.nsp=E,w&&w.auth&&(this.auth=w.auth),this._opts=Object.assign({},w),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const C=this.io;this.subs=[on(C,"open",this.onopen.bind(this)),on(C,"packet",this.onpacket.bind(this)),on(C,"error",this.onerror.bind(this)),on(C,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...C){return C.unshift("message"),this.emit.apply(this,C),this}emit(C,...E){var w,T,_;if(RESERVED_EVENTS.hasOwnProperty(C))throw new Error('"'+C.toString()+'" is a reserved event name');if(E.unshift(C),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(E),this;const S={type:PacketType.EVENT,data:E};if(S.options={},S.options.compress=this.flags.compress!==!1,typeof E[E.length-1]=="function"){const O=this.ids++,H=E.pop();this._registerAckCallback(O,H),S.id=O}const R=(T=(w=this.io.engine)===null||w===void 0?void 0:w.transport)===null||T===void 0?void 0:T.writable,A=this.connected&&!(!((_=this.io.engine)===null||_===void 0)&&_._hasPingExpired());return this.flags.volatile&&!R||(A?(this.notifyOutgoingListeners(S),this.packet(S)):this.sendBuffer.push(S)),this.flags={},this}_registerAckCallback(C,E){var w;const T=(w=this.flags.timeout)!==null&&w!==void 0?w:this._opts.ackTimeout;if(T===void 0){this.acks[C]=E;return}const _=this.io.setTimeoutFn(()=>{delete this.acks[C];for(let R=0;R<this.sendBuffer.length;R++)this.sendBuffer[R].id===C&&this.sendBuffer.splice(R,1);E.call(this,new Error("operation has timed out"))},T),S=(...R)=>{this.io.clearTimeoutFn(_),E.apply(this,R)};S.withError=!0,this.acks[C]=S}emitWithAck(C,...E){return new Promise((w,T)=>{const _=(S,R)=>S?T(S):w(R);_.withError=!0,E.push(_),this.emit(C,...E)})}_addToQueue(C){let E;typeof C[C.length-1]=="function"&&(E=C.pop());const w={id:this._queueSeq++,tryCount:0,pending:!1,args:C,flags:Object.assign({fromQueue:!0},this.flags)};C.push((T,..._)=>w!==this._queue[0]?void 0:(T!==null?w.tryCount>this._opts.retries&&(this._queue.shift(),E&&E(T)):(this._queue.shift(),E&&E(null,..._)),w.pending=!1,this._drainQueue())),this._queue.push(w),this._drainQueue()}_drainQueue(C=!1){if(!this.connected||this._queue.length===0)return;const E=this._queue[0];E.pending&&!C||(E.pending=!0,E.tryCount++,this.flags=E.flags,this.emit.apply(this,E.args))}packet(C){C.nsp=this.nsp,this.io._packet(C)}onopen(){typeof this.auth=="function"?this.auth(C=>{this._sendConnectPacket(C)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(C){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},C):C})}onerror(C){this.connected||this.emitReserved("connect_error",C)}onclose(C,E){this.connected=!1,delete this.id,this.emitReserved("disconnect",C,E),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(C=>{if(!this.sendBuffer.some(E=>String(E.id)===C)){const E=this.acks[C];delete this.acks[C],E.withError&&E.call(this,new Error("socket has been disconnected"))}})}onpacket(C){if(C.nsp===this.nsp)switch(C.type){case PacketType.CONNECT:C.data&&C.data.sid?this.onconnect(C.data.sid,C.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(C);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(C);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const E=new Error(C.data.message);E.data=C.data.data,this.emitReserved("connect_error",E);break}}onevent(C){const E=C.data||[];C.id!=null&&E.push(this.ack(C.id)),this.connected?this.emitEvent(E):this.receiveBuffer.push(Object.freeze(E))}emitEvent(C){if(this._anyListeners&&this._anyListeners.length){const E=this._anyListeners.slice();for(const w of E)w.apply(this,C)}super.emit.apply(this,C),this._pid&&C.length&&typeof C[C.length-1]=="string"&&(this._lastOffset=C[C.length-1])}ack(C){const E=this;let w=!1;return function(...T){w||(w=!0,E.packet({type:PacketType.ACK,id:C,data:T}))}}onack(C){const E=this.acks[C.id];typeof E=="function"&&(delete this.acks[C.id],E.withError&&C.data.unshift(null),E.apply(this,C.data))}onconnect(C,E){this.id=C,this.recovered=E&&this._pid===E,this._pid=E,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(C=>this.emitEvent(C)),this.receiveBuffer=[],this.sendBuffer.forEach(C=>{this.notifyOutgoingListeners(C),this.packet(C)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(C=>C()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(C){return this.flags.compress=C,this}get volatile(){return this.flags.volatile=!0,this}timeout(C){return this.flags.timeout=C,this}onAny(C){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(C),this}prependAny(C){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(C),this}offAny(C){if(!this._anyListeners)return this;if(C){const E=this._anyListeners;for(let w=0;w<E.length;w++)if(C===E[w])return E.splice(w,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(C){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(C),this}prependAnyOutgoing(C){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(C),this}offAnyOutgoing(C){if(!this._anyOutgoingListeners)return this;if(C){const E=this._anyOutgoingListeners;for(let w=0;w<E.length;w++)if(C===E[w])return E.splice(w,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(C){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const E=this._anyOutgoingListeners.slice();for(const w of E)w.apply(this,C.data)}}}function Backoff(x){x=x||{},this.ms=x.min||100,this.max=x.max||1e4,this.factor=x.factor||2,this.jitter=x.jitter>0&&x.jitter<=1?x.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var x=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var C=Math.random(),E=Math.floor(C*this.jitter*x);x=(Math.floor(C*10)&1)==0?x-E:x+E}return Math.min(x,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(x){this.ms=x};Backoff.prototype.setMax=function(x){this.max=x};Backoff.prototype.setJitter=function(x){this.jitter=x};class Manager extends Emitter{constructor(C,E){var w;super(),this.nsps={},this.subs=[],C&&typeof C=="object"&&(E=C,C=void 0),E=E||{},E.path=E.path||"/socket.io",this.opts=E,installTimerFunctions(this,E),this.reconnection(E.reconnection!==!1),this.reconnectionAttempts(E.reconnectionAttempts||1/0),this.reconnectionDelay(E.reconnectionDelay||1e3),this.reconnectionDelayMax(E.reconnectionDelayMax||5e3),this.randomizationFactor((w=E.randomizationFactor)!==null&&w!==void 0?w:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(E.timeout==null?2e4:E.timeout),this._readyState="closed",this.uri=C;const T=E.parser||parser;this.encoder=new T.Encoder,this.decoder=new T.Decoder,this._autoConnect=E.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(C){return arguments.length?(this._reconnection=!!C,C||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(C){return C===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=C,this)}reconnectionDelay(C){var E;return C===void 0?this._reconnectionDelay:(this._reconnectionDelay=C,(E=this.backoff)===null||E===void 0||E.setMin(C),this)}randomizationFactor(C){var E;return C===void 0?this._randomizationFactor:(this._randomizationFactor=C,(E=this.backoff)===null||E===void 0||E.setJitter(C),this)}reconnectionDelayMax(C){var E;return C===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=C,(E=this.backoff)===null||E===void 0||E.setMax(C),this)}timeout(C){return arguments.length?(this._timeout=C,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(C){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const E=this.engine,w=this;this._readyState="opening",this.skipReconnect=!1;const T=on(E,"open",function(){w.onopen(),C&&C()}),_=R=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",R),C?C(R):this.maybeReconnectOnOpen()},S=on(E,"error",_);if(this._timeout!==!1){const R=this._timeout,A=this.setTimeoutFn(()=>{T(),_(new Error("timeout")),E.close()},R);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}return this.subs.push(T),this.subs.push(S),this}connect(C){return this.open(C)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const C=this.engine;this.subs.push(on(C,"ping",this.onping.bind(this)),on(C,"data",this.ondata.bind(this)),on(C,"error",this.onerror.bind(this)),on(C,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(C){try{this.decoder.add(C)}catch(E){this.onclose("parse error",E)}}ondecoded(C){nextTick(()=>{this.emitReserved("packet",C)},this.setTimeoutFn)}onerror(C){this.emitReserved("error",C)}socket(C,E){let w=this.nsps[C];return w?this._autoConnect&&!w.active&&w.connect():(w=new Socket(this,C,E),this.nsps[C]=w),w}_destroy(C){const E=Object.keys(this.nsps);for(const w of E)if(this.nsps[w].active)return;this._close()}_packet(C){const E=this.encoder.encode(C);for(let w=0;w<E.length;w++)this.engine.write(E[w],C.options)}cleanup(){this.subs.forEach(C=>C()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(C,E){var w;this.cleanup(),(w=this.engine)===null||w===void 0||w.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",C,E),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const C=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const E=this.backoff.duration();this._reconnecting=!0;const w=this.setTimeoutFn(()=>{C.skipReconnect||(this.emitReserved("reconnect_attempt",C.backoff.attempts),!C.skipReconnect&&C.open(T=>{T?(C._reconnecting=!1,C.reconnect(),this.emitReserved("reconnect_error",T)):C.onreconnect()}))},E);this.opts.autoUnref&&w.unref(),this.subs.push(()=>{this.clearTimeoutFn(w)})}}onreconnect(){const C=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",C)}}const cache$1={};function lookup(x,C){typeof x=="object"&&(C=x,x=void 0),C=C||{};const E=url(x,C.path||"/socket.io"),w=E.source,T=E.id,_=E.path,S=cache$1[T]&&_ in cache$1[T].nsps,R=C.forceNew||C["force new connection"]||C.multiplex===!1||S;let A;return R?A=new Manager(w,C):(cache$1[T]||(cache$1[T]=new Manager(w,C)),A=cache$1[T]),E.query&&!C.query&&(C.query=E.queryKey),A.socket(E.path,C)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const log=(x,C,...E)=>{x==="info"?console.log(C,...E):x==="warn"?console.warn(C,...E):x==="error"&&console.error(C,...E)},LOG_PREFIX$1="[voicechanger-worklet-node]";class VoiceChangerWorkletNode extends AudioWorkletNode{configurePromiseResolve=null;startPromiseResolve=null;stopPromiseResolve=null;sendConvertedVoicePromiseResolve=null;resetBufferPromiseResolve=null;startInputRecordingPromiseResolve=null;stopInputRecordingPromiseResolve=null;startOutputRecordingPromiseResolve=null;stopOutputRecordingPromiseResolve=null;getOutputBufferSizePromiseResolve=null;listener=null;exceptionListener=null;socket=null;abortControllers=[];setting={protocol:"rest",sendingMode:"single"};currentWorkletSetting={realtimeOutputStatusEnabled:!1,realtimeOutputStatusSendIntervalSec:.2,isPassthroughEnabled:!1,sendingChunkSec:3};constructor(C,E){super(C,"voice-changer-worklet-processor",E),this.port.onmessage=this.handleMessage.bind(this),this.createSocketIO(),log("info","worklet_node","VoiceChangerWorkletNode is created. v2")}getSocketId=()=>this.socket?.id;createSocketIO=()=>{this.socket&&(console.log("close socket"),this.socket.close(),this.socket=null),this.socket=lookup("/test"),this.socket.on("connect_error",C=>{log("error","SIO","connect failed",C),this.socket.close(),this.socket=null}),this.socket.on("connect",()=>{log("info","SIO",`connected on ${this.socket?.id}`)}),this.socket.on("close",()=>{log("info","SIO",`close ${this.socket?.id}`)}),this.socket.on("message",C=>{log("info","SIO","Message received:",C)}),this.socket.on("response",C=>{const E=C[1],w=C[2],T=JSON.parse(w);if(console.log("perf",T),C[0]==0)return;const _=E,S=new Float32Array(_);S.length>1?this.sendConvertedVoice(S):log("info","SIO",`skip short data length:${S.length}`)}),this.socket.on("perf",C=>{log("info","SIO","perf:",C)}),this.socket.on("command",C=>{const E=C[0],w=C[1];log("info","SIO","command received ",E,w)}),this.socket.on("exception",C=>{const E=C[0],w=C[1];log("info","SIO","Exception received: ",E,w),this.exceptionListener&&this.exceptionListener.onException(E,w)}),this.socket.on("data",C=>{const E=C[0],w=C[1];if(this.listener)if(E==="realtime_output_status")try{const T=JSON.parse(w);this.listener.onRealtimeOutputStatus({realtimeOutputStatusSendIntervalSec:T.realtimeOutputStatusSendIntervalSec,realtimeOutputStatusSendInterval:T.realtimeOutputStatusSendInterval,outputBufferSize:T.outputBufferSize,inputRms:T.inputRms,outputRms:T.outputRms})}catch(T){log("error","SIO","Failed to parse realtime_output_status data:",T)}else if(E==="realtime_process_status")try{const T=JSON.parse(w);this.listener.onRealtimeProcessStatus({inputBufferSize:T.inputBufferSize,inputSize:T.inputSize,inputSec:T.inputSec,outputSize:T.outputSize,outputSec:T.outputSec,elapsedTime:T.elapsedTime,dataNum:T.dataNum})}catch(T){log("error","SIO","Failed to parse realtime_process_status data:",T)}else this.listener.onData(E,w)})};setStatusListener=C=>{this.listener=C};setExceptionListener=C=>{this.exceptionListener=C};updateSetting=async C=>{const E=this.setting.protocol!=C.protocol;this.setting=C,E&&this.createSocketIO()};updateWorkletSetting=async C=>{this.currentWorkletSetting={...this.currentWorkletSetting,...C},await this.configure(this.currentWorkletSetting)};handleMessage=async C=>{const E=C.data;if(E.commandType==="config")this.configurePromiseResolve&&(this.configurePromiseResolve(),this.configurePromiseResolve=null);else if(E.commandType==="start")this.startPromiseResolve&&(this.startPromiseResolve(),this.startPromiseResolve=null);else if(E.commandType==="stop")this.stopPromiseResolve&&(this.stopPromiseResolve(),this.stopPromiseResolve=null);else if(E.commandType==="sendConvertedVoice")this.sendConvertedVoicePromiseResolve&&(this.sendConvertedVoicePromiseResolve(),this.sendConvertedVoicePromiseResolve=null);else if(E.commandType==="resetBuffer")this.resetBufferPromiseResolve&&(this.resetBufferPromiseResolve(),this.resetBufferPromiseResolve=null);else if(E.commandType==="startInputRecording")this.startInputRecordingPromiseResolve&&(this.startInputRecordingPromiseResolve(),this.startInputRecordingPromiseResolve=null);else if(E.commandType==="stopInputRecording"){const w=E;this.stopInputRecordingPromiseResolve&&(this.stopInputRecordingPromiseResolve(w.inputRecording),this.stopInputRecordingPromiseResolve=null)}else if(E.commandType==="startOutputRecording")this.startOutputRecordingPromiseResolve&&(this.startOutputRecordingPromiseResolve(),this.startOutputRecordingPromiseResolve=null);else if(E.commandType==="stopOutputRecording"){const w=E;this.stopOutputRecordingPromiseResolve&&(this.stopOutputRecordingPromiseResolve(w.outputRecording),this.stopOutputRecordingPromiseResolve=null)}else if(E.commandType==="sendOriginalVoice"){const w=E;this.handleOriginalVoice(w.voice)}else if(E.commandType==="sendRealtimeOutputStatus"){const w=E;this.listener&&this.listener.onRealtimeOutputStatus({realtimeOutputStatusSendIntervalSec:w.realtimeOutputStatusSendIntervalSec,realtimeOutputStatusSendInterval:w.realtimeOutputStatusSendInterval,outputBufferSize:w.outputBufferSize,inputRms:null,outputRms:null})}else if(E.commandType==="getOutputBufferSize"){const w=E;this.getOutputBufferSizePromiseResolve&&(this.getOutputBufferSizePromiseResolve(w.outputBufferSize),this.getOutputBufferSizePromiseResolve=null)}else log("warn","worklet_node",`Unknown command type: ${E.commandType}`)};handleOriginalVoice=C=>{const E=new Uint8Array(C.buffer);this.sendBuffer(E)};sendBuffer=async C=>{const E=Date.now();if(this.setting.protocol!=="sio")if(this.setting.protocol==="rest"){const w=new AbortController;this.abortControllers.push(w);const T=new FormData;T.append("waveform",new Blob([C]),"waveform.bin");let _="";this.setting.sendingMode=="bulk"?_="/api/voice-changer/convert_chunk_bulk":_="/api/voice-changer/convert_chunk";const S={method:"POST",body:T,headers:{},signal:w.signal};S.headers={"x-timestamp":E.toString()};try{const R=await fetch(_,S);if(R.ok){const A=await R.arrayBuffer(),O=new Float32Array(A);O.length>1?this.sendConvertedVoice(O):log("warn",LOG_PREFIX$1,`skip short data length:${O.length}`)}else console.error("[worklet_node]Error:",R.status)}catch(R){R instanceof Error&&R.name==="AbortError"?log("info",LOG_PREFIX$1,"Fetch request was aborted"):console.error("[worklet_node]Fetch error:",R)}finally{this.abortControllers=this.abortControllers.filter(R=>R!==w)}}else throw"unknown protocol"};configure=async C=>{const E=new Promise(T=>{this.configurePromiseResolve=T}),w={commandType:"config",config:C};this.port.postMessage(w),await E};start=async()=>{const C=new Promise(w=>{this.startPromiseResolve=w}),E={commandType:"start"};this.port.postMessage(E),await C};stop=async()=>{const C=new Promise(w=>{this.stopPromiseResolve=w}),E={commandType:"stop"};this.port.postMessage(E),await C};sendConvertedVoice=async C=>{const E=new Promise(T=>{this.sendConvertedVoicePromiseResolve=T}),w={commandType:"sendConvertedVoice",voice:C};this.port.postMessage(w,[C.buffer]),await E};resetBuffer=async()=>{const C=new Promise(w=>{this.resetBufferPromiseResolve=w}),E={commandType:"resetBuffer"};this.port.postMessage(E),await C};startInputRecording=async()=>{const C=new Promise(w=>{this.startInputRecordingPromiseResolve=w}),E={commandType:"startInputRecording"};this.port.postMessage(E),await C};stopInputRecording=async()=>{const C=new Promise(R=>{this.stopInputRecordingPromiseResolve=R}),E={commandType:"stopInputRecording"};this.port.postMessage(E);const w=await C,T=w.reduce((R,A)=>R+A.length,0),_=new Float32Array(T);let S=0;for(const R of w)_.set(R,S),S+=R.length;return _};startOutputRecording=async()=>{const C=new Promise(w=>{this.startOutputRecordingPromiseResolve=w}),E={commandType:"startOutputRecording"};this.port.postMessage(E),await C};stopOutputRecording=async()=>{const C=new Promise(R=>{this.stopOutputRecordingPromiseResolve=R}),E={commandType:"stopOutputRecording"};this.port.postMessage(E);const w=await C,T=w.reduce((R,A)=>R+A.length,0),_=new Float32Array(T);let S=0;for(const R of w)_.set(R,S),S+=R.length;return _};getOutputBufferSize=async()=>{const C=new Promise(w=>{this.getOutputBufferSizePromiseResolve=w}),E={commandType:"getOutputBufferSize"};return this.port.postMessage(E),await C};abortAllRequests=()=>{this.abortControllers.length>0&&(this.abortControllers.forEach(C=>C.abort()),this.abortControllers=[],log("info",LOG_PREFIX$1,`All fetch requests aborted (${this.abortControllers.length} requests)`))};isRequestPending=()=>this.abortControllers.length>0;getPendingRequestCount=()=>this.abortControllers.length}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(x){if(Object.prototype.hasOwnProperty.call(x,"__esModule"))return x;var C=x.default;if(typeof C=="function"){var E=function w(){var T=!1;try{T=this instanceof w}catch{}return T?Reflect.construct(C,arguments,this.constructor):C.apply(this,arguments)};E.prototype=C.prototype}else E={};return Object.defineProperty(E,"__esModule",{value:!0}),Object.keys(x).forEach(function(w){var T=Object.getOwnPropertyDescriptor(x,w);Object.defineProperty(E,w,T.get?T:{enumerable:!0,get:function(){return x[w]}})}),E}var build$2={},AllHighestVideoBandwidthPolicy={},DefaultVideoStreamIdSet={},hasRequiredDefaultVideoStreamIdSet;function requireDefaultVideoStreamIdSet(){if(hasRequiredDefaultVideoStreamIdSet)return DefaultVideoStreamIdSet;hasRequiredDefaultVideoStreamIdSet=1,Object.defineProperty(DefaultVideoStreamIdSet,"__esModule",{value:!0});let x=class Fd{constructor(E){this.ids=new Set(E)}add(E){this.ids.add(E)}array(){return Array.from(this.ids.values()).sort((E,w)=>E-w)}contain(E){return this.ids.has(E)}forEach(E){this.ids.forEach(E)}empty(){return this.ids.size===0}size(){return this.ids.size}equal(E){if(!E)return this.ids.size===0;const w=this.array(),T=E.array();if(w.length!==T.length)return!1;for(let _=0;_<w.length;_++)if(w[_]!==T[_])return!1;return!0}clone(){return new Fd(this.array())}remove(E){this.ids.delete(E)}toJSON(){return this.array()}truncate(E){const w=this.array();return new Fd(w.splice(0,E))}};return DefaultVideoStreamIdSet.default=x,DefaultVideoStreamIdSet}var hasRequiredAllHighestVideoBandwidthPolicy;function requireAllHighestVideoBandwidthPolicy(){if(hasRequiredAllHighestVideoBandwidthPolicy)return AllHighestVideoBandwidthPolicy;hasRequiredAllHighestVideoBandwidthPolicy=1;var x=AllHighestVideoBandwidthPolicy&&AllHighestVideoBandwidthPolicy.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(AllHighestVideoBandwidthPolicy,"__esModule",{value:!0});const C=x(requireDefaultVideoStreamIdSet());let E=class Qf{constructor(T){this.selfAttendeeId=T,this.reset()}reset(){this.optimalReceiveSet=new C.default,this.subscribedReceiveSet=new C.default,this.videoSources=void 0}updateIndex(T){this.videoIndex=T,this.optimalReceiveSet=this.calculateOptimalReceiveSet(T)}updateMetrics(T){}wantsResubscribe(){return!this.subscribedReceiveSet.equal(this.optimalReceiveSet)}chooseSubscriptions(){return this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveSet.clone()}chooseRemoteVideoSources(T){this.videoSources=T,this.optimalReceiveSet=this.calculateOptimalReceiveSet(this.videoIndex).clone()}calculateOptimalReceiveSet(T){const _=new C.default;if(!this.videoIndex||this.videoIndex.allStreams().empty())return _;const S=T.highestQualityStreamFromEachGroupExcludingSelf(this.selfAttendeeId),R=this.videoSources?this.videoSources:this.videoIndex.allVideoSendingSourcesExcludingSelf(this.selfAttendeeId),A=this.videoIndex.remoteStreamDescriptions(),O=new Map;for(const ee of A)S.contain(ee.streamId)&&O.set(ee.attendeeId,ee);let H=0;for(const ee of R){const te=ee.attendee.attendeeId;if(O.has(te)){const ie=O.get(te);if(H+ie.maxBitrateKbps<=Qf.maxReceiveBitrateKbps)_.add(ie.streamId),H+=ie.maxBitrateKbps;else{console.warn("total bitrate "+(H+ie.maxBitrateKbps)+" exceeds maximum limit (15000). Use chooseRemoteVideoSources to select a subset of participants to avoid this.");break}}}return _}};return AllHighestVideoBandwidthPolicy.default=E,E.maxReceiveBitrateKbps=15e3,AllHighestVideoBandwidthPolicy}var ApplicationMetadata={},hasRequiredApplicationMetadata;function requireApplicationMetadata(){if(hasRequiredApplicationMetadata)return ApplicationMetadata;hasRequiredApplicationMetadata=1,Object.defineProperty(ApplicationMetadata,"__esModule",{value:!0});let x=class em{constructor(E,w){this.appName=E,this.appVersion=w}static create(E,w){const T=/^[a-zA-Z0-9]+[a-zA-Z0-9_-]*[a-zA-Z0-9]+$/g;if(!E||E.length>32)throw new Error("appName should be a valid string and 1 to 32 characters in length");if(!T.test(E))throw new Error(`appName must satisfy ${T} regular expression`);const _=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm;if(!w||w.length>32)throw new Error("appVersion should be a valid string and 1 to 32 characters in length");if(!_.test(w))throw new Error("appVersion must satisfy Semantic Versioning format");return new em(E,w)}};return ApplicationMetadata.default=x,ApplicationMetadata}var AsyncScheduler={},TimeoutScheduler={},hasRequiredTimeoutScheduler;function requireTimeoutScheduler(){if(hasRequiredTimeoutScheduler)return TimeoutScheduler;hasRequiredTimeoutScheduler=1,Object.defineProperty(TimeoutScheduler,"__esModule",{value:!0});let x=class{constructor(C){this.timeoutMs=C,this.timer=null}start(C){this.stop(),this.timer=setTimeout(()=>{clearTimeout(this.timer),C()},this.timeoutMs)}stop(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}};return TimeoutScheduler.default=x,TimeoutScheduler}var hasRequiredAsyncScheduler;function requireAsyncScheduler(){if(hasRequiredAsyncScheduler)return AsyncScheduler;hasRequiredAsyncScheduler=1;var x=AsyncScheduler&&AsyncScheduler.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(AsyncScheduler,"__esModule",{value:!0});const C=x(requireTimeoutScheduler());let E=class extends C.default{constructor(){super(0)}static nextTick(w){setTimeout(w,0)}};return AsyncScheduler.default=E,AsyncScheduler}var AttachMediaInputTask={},VideoLogEvent={},hasRequiredVideoLogEvent;function requireVideoLogEvent(){return hasRequiredVideoLogEvent||(hasRequiredVideoLogEvent=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.VideoLogEvent=void 0;var C;(function(E){E[E.InputAttached=0]="InputAttached",E[E.SendingFailed=1]="SendingFailed",E[E.SendingSuccess=2]="SendingSuccess"})(C=x.VideoLogEvent||(x.VideoLogEvent={})),x.default=C}(VideoLogEvent)),VideoLogEvent}var BaseTask={},OnceTask={},LogLevel={},hasRequiredLogLevel;function requireLogLevel(){return hasRequiredLogLevel||(hasRequiredLogLevel=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.LogLevel=void 0;var C;(function(E){E[E.DEBUG=0]="DEBUG",E[E.INFO=1]="INFO",E[E.WARN=2]="WARN",E[E.ERROR=3]="ERROR",E[E.OFF=4]="OFF"})(C=x.LogLevel||(x.LogLevel={})),x.default=C}(LogLevel)),LogLevel}var hasRequiredOnceTask;function requireOnceTask(){if(hasRequiredOnceTask)return OnceTask;hasRequiredOnceTask=1;var x=OnceTask&&OnceTask.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(OnceTask,"__esModule",{value:!0});const C=x(requireLogLevel()),E=x(requireAsyncScheduler());let w=class{constructor(T,_,S){this.logger=T,this.task=_,this.dependencies=S,this.canceled=!1}name(){return`${this.task.name()} (once)`}cancel(){if(!this.canceled){if(this.dependencies)for(const T of this.dependencies)T.cancel();this.logger.info(`Canceling ${this.name()}`),E.default.nextTick(()=>this.task.cancel()),this.canceled=!0,this.cancelPromise&&E.default.nextTick(()=>this.cancelPromise(new Error(`canceling ${this.name()}`)))}}logDependencies(){if(this.logger.getLogLevel()>C.default.INFO||!this.dependencies)return;const T=this.dependencies.filter(_=>_).map(_=>_.name()).join(", ");this.logger.info(`${this.task.name()} waiting for dependencies: ${T}`)}run(){if(this.promise)return this.promise;const T=this.dependencies?Promise.all(this.dependencies.map(_=>_?.run())):Promise.resolve();return this.logDependencies(),this.ongoing=T.then(()=>this.task.run()),this.promise=new Promise((_,S)=>{this.cancelPromise=S,this.ongoing.then(_).catch(S)})}setParent(T){this.task.setParent(T)}};return OnceTask.default=w,OnceTask}var TaskStatus={},hasRequiredTaskStatus;function requireTaskStatus(){if(hasRequiredTaskStatus)return TaskStatus;hasRequiredTaskStatus=1,Object.defineProperty(TaskStatus,"__esModule",{value:!0});var x;return function(C){C.IDLE="IDLE",C.RUNNING="RUNNING",C.CANCELED="CANCELED",C.FINISHED="FINISHED"}(x||(x={})),TaskStatus.default=x,TaskStatus}var hasRequiredBaseTask;function requireBaseTask(){if(hasRequiredBaseTask)return BaseTask;hasRequiredBaseTask=1;var x=BaseTask&&BaseTask.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=BaseTask&&BaseTask.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(BaseTask,"__esModule",{value:!0});const E=C(requireOnceTask()),w=C(requireTaskStatus());let T=class{constructor(_){this.logger=_,this.taskName="BaseTask",this.parentTask=null,this.status=w.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(..._){return new E.default(this.logger,this,_)}cancel(){}name(){return this.parentTask?`${this.parentTask.name()}/${this.taskName}`:this.taskName}setParent(_){this.parentTask=_}getStatus(){return this.status}logAndThrow(_){throw this.logger.info(_),new Error(_)}baseRun(_){return x(this,void 0,void 0,function*(){try{const S=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case w.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case w.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case w.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=w.default.RUNNING,yield _.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-S)} ms`)}catch(S){throw S}finally{this.status!==w.default.CANCELED&&(this.status=w.default.FINISHED)}})}baseCancel(_){if(this.status===w.default.CANCELED||this.status===w.default.FINISHED){this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`);return}this.logger.info(`canceling task ${this.name()}`),this.status=w.default.CANCELED,_.call(this)}};return BaseTask.default=T,BaseTask}var hasRequiredAttachMediaInputTask;function requireAttachMediaInputTask(){if(hasRequiredAttachMediaInputTask)return AttachMediaInputTask;hasRequiredAttachMediaInputTask=1;var x=AttachMediaInputTask&&AttachMediaInputTask.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=AttachMediaInputTask&&AttachMediaInputTask.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(AttachMediaInputTask,"__esModule",{value:!0});const E=C(requireVideoLogEvent()),w=C(requireBaseTask());let T=class extends w.default{constructor(_){super(_.logger),this.context=_,this.taskName="AttachMediaInputTask"}run(){return x(this,void 0,void 0,function*(){const _=this.context.transceiverController;_.setPeer(this.context.peer),_.setupLocalTransceivers();const S=this.context.activeAudioInput;if(S){const A=S.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield _.setAudioInput(A.length?A[0]:null)}else yield _.setAudioInput(null),this.context.logger.info("no audio track");this.setAudioCodecPreferences();const R=this.context.activeVideoInput;if(R){const A=R.getVideoTracks(),O=A.length?A[0]:null;if(this.context.logger.info("attaching video track to peer connection"),yield _.setVideoInput(O),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){const H=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();_.setEncodingParameters(H)}O&&this.context.statsCollector.logVideoEvent(E.default.InputAttached,this.context.videoDeviceInformation)}else yield _.setVideoInput(null),this.context.logger.info("no video track");this.context.videoSubscriptions=_.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive),this.context.videoStreamIndex.subscribeFrameSent()})}setAudioCodecPreferences(){const _=window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype,S=this.context.audioProfile.hasRedundancyEnabled();if(!_){this.context.logger.warn("Setting codec preferences not supported");return}const R=this.context.transceiverController.localAudioTransceiver(),{codecs:A}=RTCRtpSender.getCapabilities("audio");this.context.logger.debug(`Available audio codecs ${JSON.stringify(A,null,4)}`);const O=A.findIndex(H=>H.mimeType==="audio/red");if(!R){this.context.logger.error("audio transceiver is null");return}if(O>=0){const H=A[O];A.splice(O,1),S?(A.unshift(H),this.context.logger.info("audio/red set as preferred codec")):this.context.logger.info("audio/red removed from preferred codec"),R.setCodecPreferences(A);return}this.context.logger.info("audio/red codec not supported")}};return AttachMediaInputTask.default=T,AttachMediaInputTask}var Attendee={},hasRequiredAttendee;function requireAttendee(){if(hasRequiredAttendee)return Attendee;hasRequiredAttendee=1,Object.defineProperty(Attendee,"__esModule",{value:!0});let x=class{};return Attendee.default=x,Attendee}var AudioLogEvent={},hasRequiredAudioLogEvent;function requireAudioLogEvent(){return hasRequiredAudioLogEvent||(hasRequiredAudioLogEvent=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.AudioLogEvent=void 0;var C;(function(E){E[E.DeviceChanged=0]="DeviceChanged",E[E.MutedLocal=1]="MutedLocal",E[E.UnmutedLocal=2]="UnmutedLocal",E[E.Connected=3]="Connected",E[E.ConnectFailed=4]="ConnectFailed",E[E.RedmicStartLoss=5]="RedmicStartLoss",E[E.RedmicEndLoss=6]="RedmicEndLoss"})(C=x.AudioLogEvent||(x.AudioLogEvent={})),x.default=C}(AudioLogEvent)),AudioLogEvent}var AudioProfile={},DefaultBrowserBehavior={},__spreadArray=function(x,C,E){for(var w=0,T=C.length,_;w<T;w++)(_||!(w in C))&&(_||(_=Array.prototype.slice.call(C,0,w)),_[w]=C[w]);return x.concat(_||Array.prototype.slice.call(C))},BrowserInfo=function(){function x(C,E,w){this.name=C,this.version=E,this.os=w,this.type="browser"}return x}(),NodeInfo=function(){function x(C){this.version=C,this.type="node",this.name="node",this.os=process.platform}return x}(),SearchBotDeviceInfo=function(){function x(C,E,w,T){this.name=C,this.version=E,this.os=w,this.bot=T,this.type="bot-device"}return x}(),BotInfo=function(){function x(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return x}(),ReactNativeInfo=function(){function x(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return x}(),SEARCHBOX_UA_REGEX=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS=3,userAgentRules=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",SEARCHBOX_UA_REGEX]],operatingSystemRules=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function detect(x){return x?parseUserAgent(x):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(x){return x!==""&&userAgentRules.reduce(function(C,E){var w=E[0],T=E[1];if(C)return C;var _=T.exec(x);return!!_&&[w,_]},!1)}function browserName(x){var C=matchUserAgent(x);return C?C[0]:null}function parseUserAgent(x){var C=matchUserAgent(x);if(!C)return null;var E=C[0],w=C[1];if(E==="searchbot")return new BotInfo;var T=w[1]&&w[1].split(".").join("_").split("_").slice(0,3);T?T.length<REQUIRED_VERSION_PARTS&&(T=__spreadArray(__spreadArray([],T,!0),createVersionParts(REQUIRED_VERSION_PARTS-T.length))):T=[];var _=T.join("."),S=detectOS(x),R=SEARCHBOT_OS_REGEX.exec(x);return R&&R[1]?new SearchBotDeviceInfo(E,_,S,R[1]):new BrowserInfo(E,_,S)}function detectOS(x){for(var C=0,E=operatingSystemRules.length;C<E;C++){var w=operatingSystemRules[C],T=w[0],_=w[1],S=_.exec(x);if(S)return T}return null}function getNodeVersion(){var x=typeof process<"u"&&process.version;return x?new NodeInfo(process.version.slice(1)):null}function createVersionParts(x){for(var C=[],E=0;E<x;E++)C.push("0");return C}const es=Object.freeze(Object.defineProperty({__proto__:null,BotInfo,BrowserInfo,NodeInfo,ReactNativeInfo,SearchBotDeviceInfo,browserName,detect,detectOS,getNodeVersion,parseUserAgent},Symbol.toStringTag,{value:"Module"})),require$$0$3=getAugmentedNamespace(es);var uaParser$1={exports:{}},uaParser=uaParser$1.exports,hasRequiredUaParser;function requireUaParser(){return hasRequiredUaParser||(hasRequiredUaParser=1,function(x,C){(function(E,w){var T="1.0.40",_="",S="?",R="function",A="undefined",O="object",H="string",ee="major",te="model",ie="name",ne="type",ae="vendor",oe="version",le="architecture",fe="console",de="mobile",ce="tablet",pe="smarttv",he="wearable",me="embedded",ve=500,ye="Amazon",Se="Apple",Ce="ASUS",be="BlackBerry",Ee="Browser",Ae="Chrome",Ie="Edge",Te="Firefox",De="Google",Ue="Huawei",ze="LG",Pe="Microsoft",$e="Motorola",He="Opera",je="Samsung",Ne="Sharp",Oe="Sony",Ve="Xiaomi",Ht="Zebra",Kt="Facebook",ir="Chromium OS",$t="Mac OS",tr=" Browser",ar=function(zt,Ft){var kt={};for(var ke in zt)Ft[ke]&&Ft[ke].length%2===0?kt[ke]=Ft[ke].concat(zt[ke]):kt[ke]=zt[ke];return kt},gr=function(zt){for(var Ft={},kt=0;kt<zt.length;kt++)Ft[zt[kt].toUpperCase()]=zt[kt];return Ft},er=function(zt,Ft){return typeof zt===H?sr(Ft).indexOf(sr(zt))!==-1:!1},sr=function(zt){return zt.toLowerCase()},pr=function(zt){return typeof zt===H?zt.replace(/[^\d\.]/g,_).split(".")[0]:w},ur=function(zt,Ft){if(typeof zt===H)return zt=zt.replace(/^\s\s*/,_),typeof Ft===A?zt:zt.substring(0,ve)},Sr=function(zt,Ft){for(var kt=0,ke,Be,et,Ze,Qe,Ke;kt<Ft.length&&!Qe;){var Je=Ft[kt],Re=Ft[kt+1];for(ke=Be=0;ke<Je.length&&!Qe&&Je[ke];)if(Qe=Je[ke++].exec(zt),Qe)for(et=0;et<Re.length;et++)Ke=Qe[++Be],Ze=Re[et],typeof Ze===O&&Ze.length>0?Ze.length===2?typeof Ze[1]==R?this[Ze[0]]=Ze[1].call(this,Ke):this[Ze[0]]=Ze[1]:Ze.length===3?typeof Ze[1]===R&&!(Ze[1].exec&&Ze[1].test)?this[Ze[0]]=Ke?Ze[1].call(this,Ke,Ze[2]):w:this[Ze[0]]=Ke?Ke.replace(Ze[1],Ze[2]):w:Ze.length===4&&(this[Ze[0]]=Ke?Ze[3].call(this,Ke.replace(Ze[1],Ze[2])):w):this[Ze]=Ke||w;kt+=2}},hr=function(zt,Ft){for(var kt in Ft)if(typeof Ft[kt]===O&&Ft[kt].length>0){for(var ke=0;ke<Ft[kt].length;ke++)if(er(Ft[kt][ke],zt))return kt===S?w:kt}else if(er(Ft[kt],zt))return kt===S?w:kt;return Ft.hasOwnProperty("*")?Ft["*"]:zt},yr={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},xr={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Yt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[oe,[ie,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[oe,[ie,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[ie,oe],[/opios[\/ ]+([\w\.]+)/i],[oe,[ie,He+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[oe,[ie,He+" GX"]],[/\bopr\/([\w\.]+)/i],[oe,[ie,He]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[oe,[ie,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[oe,[ie,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[ie,oe],[/quark(?:pc)?\/([-\w\.]+)/i],[oe,[ie,"Quark"]],[/\bddg\/([\w\.]+)/i],[oe,[ie,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[oe,[ie,"UC"+Ee]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[oe,[ie,"WeChat"]],[/konqueror\/([\w\.]+)/i],[oe,[ie,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[oe,[ie,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[oe,[ie,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[oe,[ie,"Smart Lenovo "+Ee]],[/(avast|avg)\/([\w\.]+)/i],[[ie,/(.+)/,"$1 Secure "+Ee],oe],[/\bfocus\/([\w\.]+)/i],[oe,[ie,Te+" Focus"]],[/\bopt\/([\w\.]+)/i],[oe,[ie,He+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[oe,[ie,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[oe,[ie,"Dolphin"]],[/coast\/([\w\.]+)/i],[oe,[ie,He+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[oe,[ie,"MIUI"+tr]],[/fxios\/([\w\.-]+)/i],[oe,[ie,Te]],[/\bqihoobrowser\/?([\w\.]*)/i],[oe,[ie,"360"]],[/\b(qq)\/([\w\.]+)/i],[[ie,/(.+)/,"$1Browser"],oe],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[ie,/(.+)/,"$1"+tr],oe],[/samsungbrowser\/([\w\.]+)/i],[oe,[ie,je+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[oe,[ie,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[ie,"Sogou Mobile"],oe],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[ie,oe],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[ie],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[oe,ie],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[ie,Kt],oe],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[ie,oe],[/\bgsa\/([\w\.]+) .*safari\//i],[oe,[ie,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[oe,[ie,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[oe,[ie,Ae+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[ie,Ae+" WebView"],oe],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[oe,[ie,"Android "+Ee]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[ie,oe],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[oe,[ie,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[oe,ie],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[ie,[oe,hr,yr]],[/(webkit|khtml)\/([\w\.]+)/i],[ie,oe],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[ie,"Netscape"],oe],[/(wolvic|librewolf)\/([\w\.]+)/i],[ie,oe],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[oe,[ie,Te+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[ie,[oe,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[ie,[oe,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[le,"amd64"]],[/(ia32(?=;))/i],[[le,sr]],[/((?:i[346]|x)86)[;\)]/i],[[le,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[le,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[le,"armhf"]],[/windows (ce|mobile); ppc;/i],[[le,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[le,/ower/,_,sr]],[/(sun4\w)[;\)]/i],[[le,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[le,sr]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[te,[ae,je],[ne,ce]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[te,[ae,je],[ne,de]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[te,[ae,Se],[ne,de]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[te,[ae,Se],[ne,ce]],[/(macintosh);/i],[te,[ae,Se]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[te,[ae,Ne],[ne,de]],[/(?:honor)([-\w ]+)[;\)]/i],[te,[ae,"Honor"],[ne,de]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[te,[ae,Ue],[ne,ce]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[te,[ae,Ue],[ne,de]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[te,/_/g," "],[ae,Ve],[ne,de]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[te,/_/g," "],[ae,Ve],[ne,ce]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[te,[ae,"OPPO"],[ne,de]],[/\b(opd2\d{3}a?) bui/i],[te,[ae,"OPPO"],[ne,ce]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[te,[ae,"Vivo"],[ne,de]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[te,[ae,"Realme"],[ne,de]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[te,[ae,$e],[ne,de]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[te,[ae,$e],[ne,ce]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[te,[ae,ze],[ne,ce]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[te,[ae,ze],[ne,de]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[te,[ae,"Lenovo"],[ne,ce]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[te,/_/g," "],[ae,"Nokia"],[ne,de]],[/(pixel c)\b/i],[te,[ae,De],[ne,ce]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[te,[ae,De],[ne,de]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[te,[ae,Oe],[ne,de]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[te,"Xperia Tablet"],[ae,Oe],[ne,ce]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[te,[ae,"OnePlus"],[ne,de]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[te,[ae,ye],[ne,ce]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[te,/(.+)/g,"Fire Phone $1"],[ae,ye],[ne,de]],[/(playbook);[-\w\),; ]+(rim)/i],[te,ae,[ne,ce]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[te,[ae,be],[ne,de]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[te,[ae,Ce],[ne,ce]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[te,[ae,Ce],[ne,de]],[/(nexus 9)/i],[te,[ae,"HTC"],[ne,ce]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[ae,[te,/_/g," "],[ne,de]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[te,[ae,"TCL"],[ne,ce]],[/(itel) ((\w+))/i],[[ae,sr],te,[ne,hr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[te,[ae,"Acer"],[ne,ce]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[te,[ae,"Meizu"],[ne,de]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[te,[ae,"Ulefone"],[ne,de]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[te,[ae,"Energizer"],[ne,de]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[te,[ae,"Cat"],[ne,de]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[te,[ae,"Smartfren"],[ne,de]],[/droid.+; (a(?:015|06[35]|142p?))/i],[te,[ae,"Nothing"],[ne,de]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[ae,te,[ne,de]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[ae,te,[ne,ce]],[/(surface duo)/i],[te,[ae,Pe],[ne,ce]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[te,[ae,"Fairphone"],[ne,de]],[/(u304aa)/i],[te,[ae,"AT&T"],[ne,de]],[/\bsie-(\w*)/i],[te,[ae,"Siemens"],[ne,de]],[/\b(rct\w+) b/i],[te,[ae,"RCA"],[ne,ce]],[/\b(venue[\d ]{2,7}) b/i],[te,[ae,"Dell"],[ne,ce]],[/\b(q(?:mv|ta)\w+) b/i],[te,[ae,"Verizon"],[ne,ce]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[te,[ae,"Barnes & Noble"],[ne,ce]],[/\b(tm\d{3}\w+) b/i],[te,[ae,"NuVision"],[ne,ce]],[/\b(k88) b/i],[te,[ae,"ZTE"],[ne,ce]],[/\b(nx\d{3}j) b/i],[te,[ae,"ZTE"],[ne,de]],[/\b(gen\d{3}) b.+49h/i],[te,[ae,"Swiss"],[ne,de]],[/\b(zur\d{3}) b/i],[te,[ae,"Swiss"],[ne,ce]],[/\b((zeki)?tb.*\b) b/i],[te,[ae,"Zeki"],[ne,ce]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[ae,"Dragon Touch"],te,[ne,ce]],[/\b(ns-?\w{0,9}) b/i],[te,[ae,"Insignia"],[ne,ce]],[/\b((nxa|next)-?\w{0,9}) b/i],[te,[ae,"NextBook"],[ne,ce]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[ae,"Voice"],te,[ne,de]],[/\b(lvtel\-)?(v1[12]) b/i],[[ae,"LvTel"],te,[ne,de]],[/\b(ph-1) /i],[te,[ae,"Essential"],[ne,de]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[te,[ae,"Envizen"],[ne,ce]],[/\b(trio[-\w\. ]+) b/i],[te,[ae,"MachSpeed"],[ne,ce]],[/\btu_(1491) b/i],[te,[ae,"Rotor"],[ne,ce]],[/(shield[\w ]+) b/i],[te,[ae,"Nvidia"],[ne,ce]],[/(sprint) (\w+)/i],[ae,te,[ne,de]],[/(kin\.[onetw]{3})/i],[[te,/\./g," "],[ae,Pe],[ne,de]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[te,[ae,Ht],[ne,ce]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[te,[ae,Ht],[ne,de]],[/smart-tv.+(samsung)/i],[ae,[ne,pe]],[/hbbtv.+maple;(\d+)/i],[[te,/^/,"SmartTV"],[ae,je],[ne,pe]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[ae,ze],[ne,pe]],[/(apple) ?tv/i],[ae,[te,Se+" TV"],[ne,pe]],[/crkey/i],[[te,Ae+"cast"],[ae,De],[ne,pe]],[/droid.+aft(\w+)( bui|\))/i],[te,[ae,ye],[ne,pe]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[te,[ae,Ne],[ne,pe]],[/(bravia[\w ]+)( bui|\))/i],[te,[ae,Oe],[ne,pe]],[/(mitv-\w{5}) bui/i],[te,[ae,Ve],[ne,pe]],[/Hbbtv.*(technisat) (.*);/i],[ae,te,[ne,pe]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[ae,ur],[te,ur],[ne,pe]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[ne,pe]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[ae,te,[ne,fe]],[/droid.+; (shield) bui/i],[te,[ae,"Nvidia"],[ne,fe]],[/(playstation [345portablevi]+)/i],[te,[ae,Oe],[ne,fe]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[te,[ae,Pe],[ne,fe]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[te,[ae,je],[ne,he]],[/((pebble))app/i],[ae,te,[ne,he]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[te,[ae,Se],[ne,he]],[/droid.+; (glass) \d/i],[te,[ae,De],[ne,he]],[/droid.+; (wt63?0{2,3})\)/i],[te,[ae,Ht],[ne,he]],[/droid.+; (glass) \d/i],[te,[ae,De],[ne,he]],[/(pico) (4|neo3(?: link|pro)?)/i],[ae,te,[ne,he]],[/; (quest( \d| pro)?)/i],[te,[ae,Kt],[ne,he]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[ae,[ne,me]],[/(aeobc)\b/i],[te,[ae,ye],[ne,me]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[te,[ne,de]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[te,[ne,ce]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[ne,ce]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[ne,de]],[/(android[-\w\. ]{0,9});.+buil/i],[te,[ae,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[oe,[ie,Ie+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[ie,oe],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[oe,[ie,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[ie,oe],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[oe,ie]],os:[[/microsoft (windows) (vista|xp)/i],[ie,oe],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[ie,[oe,hr,xr]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[oe,hr,xr],[ie,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[oe,/_/g,"."],[ie,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[ie,$t],[oe,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[oe,ie],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[ie,oe],[/\(bb(10);/i],[oe,[ie,be]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[oe,[ie,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[oe,[ie,Te+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[oe,[ie,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[oe,[ie,"watchOS"]],[/crkey\/([\d\.]+)/i],[oe,[ie,Ae+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[ie,ir],oe],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[ie,oe],[/(sunos) ?([\w\.\d]*)/i],[[ie,"Solaris"],oe],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[ie,oe]]},Jt=function(zt,Ft){if(typeof zt===O&&(Ft=zt,zt=w),!(this instanceof Jt))return new Jt(zt,Ft).getResult();var kt=typeof E!==A&&E.navigator?E.navigator:w,ke=zt||(kt&&kt.userAgent?kt.userAgent:_),Be=kt&&kt.userAgentData?kt.userAgentData:w,et=Ft?ar(Yt,Ft):Yt,Ze=kt&&kt.userAgent==ke;return this.getBrowser=function(){var Qe={};return Qe[ie]=w,Qe[oe]=w,Sr.call(Qe,ke,et.browser),Qe[ee]=pr(Qe[oe]),Ze&&kt&&kt.brave&&typeof kt.brave.isBrave==R&&(Qe[ie]="Brave"),Qe},this.getCPU=function(){var Qe={};return Qe[le]=w,Sr.call(Qe,ke,et.cpu),Qe},this.getDevice=function(){var Qe={};return Qe[ae]=w,Qe[te]=w,Qe[ne]=w,Sr.call(Qe,ke,et.device),Ze&&!Qe[ne]&&Be&&Be.mobile&&(Qe[ne]=de),Ze&&Qe[te]=="Macintosh"&&kt&&typeof kt.standalone!==A&&kt.maxTouchPoints&&kt.maxTouchPoints>2&&(Qe[te]="iPad",Qe[ne]=ce),Qe},this.getEngine=function(){var Qe={};return Qe[ie]=w,Qe[oe]=w,Sr.call(Qe,ke,et.engine),Qe},this.getOS=function(){var Qe={};return Qe[ie]=w,Qe[oe]=w,Sr.call(Qe,ke,et.os),Ze&&!Qe[ie]&&Be&&Be.platform&&Be.platform!="Unknown"&&(Qe[ie]=Be.platform.replace(/chrome os/i,ir).replace(/macos/i,$t)),Qe},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ke},this.setUA=function(Qe){return ke=typeof Qe===H&&Qe.length>ve?ur(Qe,ve):Qe,this},this.setUA(ke),this};Jt.VERSION=T,Jt.BROWSER=gr([ie,oe,ee]),Jt.CPU=gr([le]),Jt.DEVICE=gr([te,ae,ne,fe,de,pe,ce,he,me]),Jt.ENGINE=Jt.OS=gr([ie,oe]),x.exports&&(C=x.exports=Jt),C.UAParser=Jt;var mr=typeof E!==A&&(E.jQuery||E.Zepto);if(mr&&!mr.ua){var Cr=new Jt;mr.ua=Cr.getResult(),mr.ua.get=function(){return Cr.getUA()},mr.ua.set=function(zt){Cr.setUA(zt);var Ft=Cr.getResult();for(var kt in Ft)mr.ua[kt]=Ft[kt]}}})(typeof window=="object"?window:uaParser)}(uaParser$1,uaParser$1.exports)),uaParser$1.exports}var hasRequiredDefaultBrowserBehavior;function requireDefaultBrowserBehavior(){if(hasRequiredDefaultBrowserBehavior)return DefaultBrowserBehavior;hasRequiredDefaultBrowserBehavior=1;var x=DefaultBrowserBehavior&&DefaultBrowserBehavior.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})};Object.defineProperty(DefaultBrowserBehavior,"__esModule",{value:!0});const C=require$$0$3,E=requireUaParser();let w=class Vd{constructor(){this.FALLBACK_BROWSER={type:"browser",name:"unknown",version:"unknown",os:"unknown"},this.browser=C.detect()||this.FALLBACK_BROWSER,this.uaParserResult=navigator&&navigator.userAgent?new E.UAParser(navigator.userAgent).getResult():null,this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:13,safari:13,opera:66,samsung:12,crios:86,fxios:23,"ios-webview":605,"chromium-webview":92},this.browserName={chrome:"Google Chrome","edge-chromium":"Microsoft Edge",electron:"Electron",firefox:"Mozilla Firefox",ios:"Safari iOS",safari:"Safari",opera:"Opera",samsung:"Samsung Internet",crios:"Chrome iOS",fxios:"Firefox iOS","ios-webview":"WKWebView iOS","chromium-webview":"Chrome WebView"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios","ios-webview","edge-ios"]}version(){return this.browser.version}majorVersion(){return this.version()!==null?parseInt(this.version().split(".")[0]):-1}osMajorVersion(){return parseInt(this.uaParserResult.os.version.split(".")[0])}engine(){return this.uaParserResult.engine.name}engineMajorVersion(){return parseInt(this.uaParserResult.engine.version.split(".")[0])}name(){return this.browser.name}hasChromiumWebRTC(){for(const _ of this.chromeLike)if(_===this.browser.name)return!0;return!1}hasWebKitWebRTC(){for(const _ of this.webkitBrowsers)if(_===this.browser.name)return!0;return!1}hasFirefoxWebRTC(){return this.isFirefox()}requiresPlaybackLatencyHintForAudioContext(){return navigator.userAgent.indexOf("Windows")!==-1}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()&&!this.isIOSEdge()||this.isIOSSafari()&&this.majorVersion()>=Vd.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK||this.majorVersion()>=Vd.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK}supportsBackgroundFilter(){return!(this.name()==="safari"&&this.majorVersion()===15||!this.supportsCanvasCapturedStreamPlayback())}supportsVideoLayersAllocationRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsDependencyDescriptorRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsScalableVideoCoding(){return this.hasChromiumWebRTC()&&this.engine()==="Blink"&&this.engineMajorVersion()>=111}supportsAudioRedundancy(){return this.hasChromiumWebRTC()?this.engineMajorVersion()>=107:!this.hasFirefoxWebRTC()}requiresResolutionAlignment(_,S){return this.isAndroid()&&this.isPixel3()?[Math.ceil(_/64)*64,Math.ceil(S/64)*64]:[_,S]}requiresCheckForSdpConnectionAttributes(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresIceCandidateGatheringTimeoutWorkaround(){return this.hasChromiumWebRTC()}requiresBundlePolicy(){return"max-bundle"}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}doesNotSupportMediaDeviceLabels(){return this.browser.name==="chromium-webview"}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()<this.browserSupport[this.browser.name]||this.browser.name==="firefox"&&this.isAndroid())}isSimulcastSupported(){return this.hasChromiumWebRTC()}supportDownlinkBandwidthEstimation(){return!this.isFirefox()}supportString(){if(this.isAndroid())return`${this.browserName.chrome} ${this.browserSupport.chrome}+, ${this.browserName.samsung} ${this.browserSupport.samsung}+`;const _=[];for(const S in this.browserSupport)_.push(`${this.browserName[S]} ${this.browserSupport[S]}+`);return _.join(", ")}supportedVideoCodecs(){return x(this,void 0,void 0,function*(){const _=new RTCPeerConnection;return _.addTransceiver("video",{direction:"inactive",streams:[]}),(yield _.createOffer({offerToReceiveVideo:!0})).sdp.split(`\r
`).filter(S=>S.includes("a=rtpmap:")).map(S=>S.replace(/.* /,"").replace(/\/.*/,"")).filter((S,R,A)=>A.indexOf(S)===R).filter(S=>S!=="rtx"&&S!=="red"&&S!=="ulpfec")})}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}disableResolutionScaleDown(){return this.isAndroid()}disable480pResolutionScaleDown(){return/( Chrome\/98\.)/i.test(navigator.userAgent)&&this.browser.os.startsWith("Windows")}requiresDisablingH264Encoding(){return this.isIOS()&&(this.version()==="15.1.0"||/( OS 15_1)/i.test(navigator.userAgent))}requiresVideoPlayWorkaround(){return this.isSafari()}requiresAudioContextResetOnDeviceFailureForWebAudio(){return this.isIOS()}isVideoFxSupportedBrowser(){return this.supportsBackgroundFilter()}isIOSSafari(){return this.browser.name==="ios"||this.browser.name==="ios-webview"||this.browser.name==="safari"&&/( Mac )/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1}isSafari(){return this.browser.name==="safari"||this.isIOSSafari()}isFirefox(){return this.browser.name==="firefox"}isIOSFirefox(){return this.browser.name==="fxios"}isIOSChrome(){return this.browser.name==="crios"}isChrome(){return this.browser.name==="chrome"}isEdge(){return this.browser.name==="edge-chromium"}isIOSEdge(){return this.browser.name==="edge-ios"}isSamsungInternet(){return this.browser.name==="samsung"}isAndroid(){return/(android)/i.test(navigator.userAgent)}isPixel3(){return/( pixel 3)/i.test(navigator.userAgent)}isIOS(){return this.isIOSSafari()||this.isIOSChrome()||this.isIOSFirefox()}};return DefaultBrowserBehavior.default=w,w.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK=16,w.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK=106,DefaultBrowserBehavior}var hasRequiredAudioProfile;function requireAudioProfile(){if(hasRequiredAudioProfile)return AudioProfile;hasRequiredAudioProfile=1;var x=AudioProfile&&AudioProfile.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(AudioProfile,"__esModule",{value:!0});const C=x(requireDefaultBrowserBehavior());let E=class fc{constructor(T=null,_=!0){this.audioBitrateBps=T,this.enableAudioRedundancy=new C.default().supportsAudioRedundancy()&&_}static fullbandSpeechMono(T=!0){return new fc(4e4,T)}static fullbandMusicMono(T=!0){return new fc(64e3,T)}static fullbandMusicStereo(T=!0){return new fc(128e3,T)}isStereo(){return this.audioBitrateBps===128e3}hasRedundancyEnabled(){return this.enableAudioRedundancy}};return AudioProfile.default=E,AudioProfile}var AudioVideoControllerState={},hasRequiredAudioVideoControllerState;function requireAudioVideoControllerState(){return hasRequiredAudioVideoControllerState||(hasRequiredAudioVideoControllerState=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=void 0,x.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=25;class C{constructor(){this.logger=null,this.browserBehavior=null,this.meetingSessionConfiguration=null,this.signalingClient=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.activeAudioInput=void 0,this.activeVideoInput=void 0,this.audioMixController=null,this.transceiverController=null,this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.iceGatheringStateEventHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.reconnectController=null,this.removableObservers=[],this.audioProfile=null,this.videoStreamIndex=null,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.lastKnownVideoAvailability=null,this.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.lastVideosToReceive=null,this.videoSubscriptions=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptionLimit=x.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videoSendCodecPreferences=[],this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.prioritizedSendVideoCodecCapabilities=[],this.degradedVideoSendCodecs=[],this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.enableSVC=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null,this.isSessionConnected=!1}resetConnectionSpecificState(){this.peer&&this.peer.close(),this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.transceiverController!==void 0&&this.transceiverController.reset(),this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.videoDownlinkBandwidthPolicy.reset(),this.videoUplinkBandwidthPolicy.reset&&this.videoUplinkBandwidthPolicy.reset(),this.lastVideosToReceive=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptions=null,this.videoSubscriptionLimit=x.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.videoDuplexMode=null,this.isSessionConnected=!1}}x.default=C}(AudioVideoControllerState)),AudioVideoControllerState}var BackgroundBlurStrength={},hasRequiredBackgroundBlurStrength;function requireBackgroundBlurStrength(){if(hasRequiredBackgroundBlurStrength)return BackgroundBlurStrength;hasRequiredBackgroundBlurStrength=1,Object.defineProperty(BackgroundBlurStrength,"__esModule",{value:!0}),BackgroundBlurStrength.BlurStrengthMapper=void 0;const x={LOW:7,MEDIUM:15,HIGH:30};class C{static getBlurAmount(w,T){if(w<=0)throw new Error(`invalid value for blur strength: ${w}`);return Math.round(w*T.height/this.BLUR_STRENGTH_DIVISOR)}}return BackgroundBlurStrength.BlurStrengthMapper=C,C.BLUR_STRENGTH_DIVISOR=540,BackgroundBlurStrength.default=x,BackgroundBlurStrength}var BackgroundBlurVideoFrameProcessor={},BackgroundFilterVideoFrameProcessor={},loader={},fetch$1={},hasRequiredFetch;function requireFetch(){if(hasRequiredFetch)return fetch$1;hasRequiredFetch=1,Object.defineProperty(fetch$1,"__esModule",{value:!0}),fetch$1.isValidRevisionID=fetch$1.isValidAssetGroup=fetch$1.resolveURL=fetch$1.addQueryParams=fetch$1.withQueryString=fetch$1.withRequestHeaders=fetch$1.fetchWithBehavior=void 0;function x(A,O,H){if(!H)return fetch(A,O);const ee=E(A,H),te=C(O,H);return fetch(ee,te)}fetch$1.fetchWithBehavior=x;function C(A,O){return O?.headers?A?Object.assign(Object.assign({},A),{headers:Object.assign(Object.assign({},A.headers||{}),O.headers)}):{headers:O.headers}:A}fetch$1.withRequestHeaders=C;function E(A,O){if(!O?.escapedQueryString)return A;const H=A.lastIndexOf("?")!==-1;return`${A}${H?"&":"?"}${O.escapedQueryString}`}fetch$1.withQueryString=E;function w(A,O){const H=Object.keys(O);if(!H.length)return A;const ee=new URLSearchParams(A?.escapedQueryString);for(const te of H)ee.append(te,O[te]);return Object.assign(Object.assign({},A),{escapedQueryString:ee.toString()})}fetch$1.addQueryParams=w;const T={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};function _(A,O){return x(A,T,O).then(H=>H.redirected?H.url:A)}fetch$1.resolveURL=_;function S(A){return!!A&&/^[-.a-zA-Z0-9]+$/.test(A)}fetch$1.isValidAssetGroup=S;function R(A){return!!A&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(A)}return fetch$1.isValidRevisionID=R,fetch$1}var hasRequiredLoader;function requireLoader(){if(hasRequiredLoader)return loader;hasRequiredLoader=1,Object.defineProperty(loader,"__esModule",{value:!0}),loader.loadWorker=void 0;const x=requireFetch(),C={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"},E=(w,T,_,S)=>{S?.debug(`Loading ${T} worker from ${w}.`);let R=!1;try{R=self.origin===new URL(w).origin}catch(A){S?.error("Could not compare origins.",A)}if(R){const A=(0,x.withQueryString)(w,_);return Promise.resolve(new Worker(A,{name:T}))}return(0,x.fetchWithBehavior)(w,C,_).then(A=>{if(A.ok)return A.blob().then(O=>new Worker(window.URL.createObjectURL(O)));throw new Error("Fetch failed.")})};return loader.loadWorker=E,loader}var support={},hasRequiredSupport;function requireSupport(){return hasRequiredSupport||(hasRequiredSupport=1,function(x){var C=support&&support.__awaiter||function(ae,oe,le,fe){function de(ce){return ce instanceof le?ce:new le(function(pe){pe(ce)})}return new(le||(le=Promise))(function(ce,pe){function he(ye){try{ve(fe.next(ye))}catch(Se){pe(Se)}}function me(ye){try{ve(fe.throw(ye))}catch(Se){pe(Se)}}function ve(ye){ye.done?ce(ye.value):de(ye.value).then(he,me)}ve((fe=fe.apply(ae,oe||[])).next())})};Object.defineProperty(x,"__esModule",{value:!0}),x.isOldChrome=x.supportsWASMStreaming=x.supportsSharedArrayBuffer=x.supportsWASM=x.supportsAudioWorklet=x.supportsWorker=x.supportsVoiceFocusWorker=x.supportsWASMPostMessage=x.isSafari=void 0;const E=requireLoader(),w=(ae=globalThis)=>!!ae.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/),T=(ae=globalThis)=>{const oe=ae.navigator.userAgent,le=oe.match(/Safari\//),fe=oe.match(/Chrom(?:e|ium)\//);return!!(le&&!fe)};x.isSafari=T;const _=(ae=globalThis)=>(0,x.isSafari)(ae)?!1:w(ae)?(ie(ae)||0)<95:!0;x.supportsWASMPostMessage=_;const S=(ae=globalThis,oe,le)=>C(void 0,void 0,void 0,function*(){if(!(0,x.supportsWorker)(ae,le))return!1;const fe=`${oe.paths.workers}worker-v1.js`;try{const de=yield(0,E.loadWorker)(fe,"VoiceFocusTestWorker",oe,le);try{de.terminate()}catch(ce){le?.debug("Failed to terminate worker.",ce)}return!0}catch(de){return le?.info("Failed to fetch and instantiate test worker",de),!1}});x.supportsVoiceFocusWorker=S;const R=(ae=globalThis,oe)=>{try{return!!ae.Worker}catch(le){return oe?.info("Does not support Worker",le),!1}};x.supportsWorker=R;const A=(ae=globalThis,oe)=>{try{return!!ae.AudioWorklet&&!!ae.AudioWorkletNode}catch(le){return oe?.info("Does not support Audio Worklet",le),!1}};x.supportsAudioWorklet=A;const O=(ae=globalThis,oe)=>{try{return!!ae.WebAssembly&&(!!ae.WebAssembly.compile||!!ae.WebAssembly.compileStreaming)}catch(le){return oe?.info("Does not support WASM",le),!1}};x.supportsWASM=O;const H=(ae=globalThis,oe=globalThis,le)=>{try{return!!ae.SharedArrayBuffer&&(!!oe.chrome||!!ae.crossOriginIsolated)}catch{return le?.info("Does not support SharedArrayBuffer."),!1}};x.supportsSharedArrayBuffer=H;const ee=(ae=globalThis,oe)=>{var le;try{return!!(!((le=ae.WebAssembly)===null||le===void 0)&&le.compileStreaming)}catch(fe){return oe?.info("Does not support WASM streaming compilation",fe),!1}};x.supportsWASMStreaming=ee;const te=90,ie=(ae=globalThis)=>{try{if(!ae.chrome)return}catch{}const oe=ae.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/);if(oe)return parseInt(oe[1],10)},ne=(ae=globalThis,oe)=>{const le=ie(ae);return le&&le<te?(oe?.debug(`Chrome ${le} has incomplete SIMD support.`),!0):!1};x.isOldChrome=ne}(support)),support}var ModelSpecBuilder={},hasRequiredModelSpecBuilder;function requireModelSpecBuilder(){if(hasRequiredModelSpecBuilder)return ModelSpecBuilder;hasRequiredModelSpecBuilder=1,Object.defineProperty(ModelSpecBuilder,"__esModule",{value:!0});let x=class tm{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new tm}withDefaultModel(){return this.withSelfieSegmentationDefaults()}withSelfieSegmentationDefaults(){const E={height:144,width:256,range:[0,1],channels:3},w={height:144,width:256,range:[0,1],channels:1},T="https://static.sdkassets.chime.aws/bgblur/models/selfie_segmentation_landscape.tflite";return this.path=T,this.input=E,this.output=w,this}withPath(E){return this.path=E,this}withInput(E){return this.input=E,this}withOutput(E){return this.output=E,this}validate(){if(!this.path)throw new Error("model spec path is not set");if(!this.input)throw new Error("model spec input is not set");if(!this.output)throw new Error("model spec output is not set")}build(){return this.validate(),{path:this.path,input:this.input,output:this.output}}};return ModelSpecBuilder.default=x,ModelSpecBuilder}var Versioning={},version$1={},hasRequiredVersion;function requireVersion(){return hasRequiredVersion||(hasRequiredVersion=1,Object.defineProperty(version$1,"__esModule",{value:!0}),version$1.default={hash:"0b5a81b",raw:"v3.28.0",semverString:"3.28.0"}),version$1}var hasRequiredVersioning;function requireVersioning(){if(hasRequiredVersioning)return Versioning;hasRequiredVersioning=1;var x=Versioning&&Versioning.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(Versioning,"__esModule",{value:!0});const C=x(requireDefaultBrowserBehavior()),E=x(requireVersion());let w=class Xa{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return E.default.semverString}static get sdkVersionSemVer(){var _,S,R,A;const O=E.default.semverString.match(/^(?<major>[0-9]+)\.(?<minor>[0-9]+)((?:\.(?<patch>[0-9]+))(?:-(?<preRelease>[a-zA-Z]+(\.[0-9])*))?)?/);return{major:(_=O?.groups)===null||_===void 0?void 0:_.major,minor:(S=O?.groups)===null||S===void 0?void 0:S.minor,patch:(R=O?.groups)===null||R===void 0?void 0:R.patch,preRelease:(A=O?.groups)===null||A===void 0?void 0:A.preRelease}}static get buildSHA(){return E.default.hash.substring(1)}static get sdkUserAgentLowResolution(){const _=new C.default;return`${_.name()}-${_.majorVersion()}`}static urlWithVersion(_){const S=new URL(_);return S.searchParams.append(Xa.X_AMZN_VERSION,Xa.sdkVersion),S.searchParams.append(Xa.X_AMZN_USER_AGENT,Xa.sdkUserAgentLowResolution),S.toString()}};return Versioning.default=w,w.X_AMZN_VERSION="X-Amzn-Version",w.X_AMZN_USER_AGENT="X-Amzn-User-Agent",Versioning}var hasRequiredBackgroundFilterVideoFrameProcessor;function requireBackgroundFilterVideoFrameProcessor(){if(hasRequiredBackgroundFilterVideoFrameProcessor)return BackgroundFilterVideoFrameProcessor;hasRequiredBackgroundFilterVideoFrameProcessor=1;var x=BackgroundFilterVideoFrameProcessor&&BackgroundFilterVideoFrameProcessor.__awaiter||function(ee,te,ie,ne){function ae(oe){return oe instanceof ie?oe:new ie(function(le){le(oe)})}return new(ie||(ie=Promise))(function(oe,le){function fe(pe){try{ce(ne.next(pe))}catch(he){le(he)}}function de(pe){try{ce(ne.throw(pe))}catch(he){le(he)}}function ce(pe){pe.done?oe(pe.value):ae(pe.value).then(fe,de)}ce((ne=ne.apply(ee,te||[])).next())})},C=BackgroundFilterVideoFrameProcessor&&BackgroundFilterVideoFrameProcessor.__importDefault||function(ee){return ee&&ee.__esModule?ee:{default:ee}};Object.defineProperty(BackgroundFilterVideoFrameProcessor,"__esModule",{value:!0});const E=requireLoader(),w=requireSupport(),T=C(requireModelSpecBuilder()),_=C(requireDefaultBrowserBehavior()),S=C(requireVersioning()),R=()=>T.default.builder().withSelfieSegmentationDefaults().build(),A="https://static.sdkassets.chime.aws",O={worker:`${A}/bgblur/workers/worker.js`,wasm:`${A}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${A}/bgblur/wasm/_cwt-wasm-simd.wasm`};let H=class{static defaultAssetSpec(){const ee=S.default.sdkVersionSemVer;return{assetGroup:`sdk-${ee.major}.${ee.minor}`}}static createUrlWithParams(ee,te){const ie=new URL(ee),ne=Object.keys(te);for(const ae of ne)te[ae]!==void 0&&ie.searchParams.set(ae,te[ae]);return ie.toString()}static resolveSpec(ee){const{paths:te=O,model:ie=R(),assetGroup:ne=this.defaultAssetSpec().assetGroup,revisionID:ae=this.defaultAssetSpec().revisionID}=ee||{},oe={assetGroup:ne,revisionID:ae,sdk:encodeURIComponent(S.default.sdkVersion),ua:encodeURIComponent(S.default.sdkUserAgentLowResolution)};return te.worker=this.createUrlWithParams(te.worker,oe),te.wasm=this.createUrlWithParams(te.wasm,oe),te.simd=this.createUrlWithParams(te.simd,oe),ie.path=this.createUrlWithParams(ie.path,oe),{paths:te,model:ie,assetGroup:ne,revisionID:ae}}static resolveOptions(ee){ee.reportingPeriodMillis||(ee.reportingPeriodMillis=1e3);const te=30;return ee.filterCPUUtilization?(ee.filterCPUUtilization<0||ee.filterCPUUtilization>100)&&(ee.logger.warn(`filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of ${te} percent`),ee.filterCPUUtilization=te):ee.filterCPUUtilization=te,ee}static isSupported(ee,te){const{logger:ie}=te;return typeof globalThis>"u"?(ie.info("Browser does not have globalThis."),Promise.resolve(!1)):new _.default().supportsBackgroundFilter()?w.supportsWASM(globalThis,ie)?this.supportsBackgroundFilter(globalThis,ee,ie):(ie.info("Browser does not support WASM."),Promise.resolve(!1)):(ie.info("Browser is not supported."),Promise.resolve(!1))}static supportsBackgroundFilter(ee=globalThis,te,ie){return x(this,void 0,void 0,function*(){if(!w.supportsWorker(ee,ie))return ie.info("Browser does not support web workers."),!1;const ne=te.paths.worker;try{const ae=yield E.loadWorker(ne,"BackgroundFilterWorker",{},null);try{ae.terminate()}catch(oe){ie.info(`Failed to terminate worker. ${oe.message}`)}return!0}catch(ae){return ie.info(`Failed to fetch and instantiate test worker ${ae.message}`),!1}})}};return BackgroundFilterVideoFrameProcessor.default=H,BackgroundFilterVideoFrameProcessor}var ConsoleLogger={},hasRequiredConsoleLogger;function requireConsoleLogger(){if(hasRequiredConsoleLogger)return ConsoleLogger;hasRequiredConsoleLogger=1;var x=ConsoleLogger&&ConsoleLogger.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(ConsoleLogger,"__esModule",{value:!0});const C=x(requireLogLevel());let E=class{constructor(w,T=C.default.WARN){this.name=w,this.level=T}info(w){this.log(C.default.INFO,w)}warn(w){this.log(C.default.WARN,w)}error(w){this.log(C.default.ERROR,w)}debug(w){C.default.DEBUG<this.level||(typeof w=="string"?this.log(C.default.DEBUG,w):w?this.log(C.default.DEBUG,w()):this.log(C.default.DEBUG,""+w))}setLogLevel(w){this.level=w}getLogLevel(){return this.level}log(w,T){if(w<this.level)return;const _=`${new Date().toISOString()} [${C.default[w]}] ${this.name} - ${T}`;switch(w){case C.default.ERROR:console.error(_);break;case C.default.WARN:console.warn(_);break;case C.default.DEBUG:console.debug(_.replace(/\\r\\n/g,`
`));break;case C.default.INFO:console.info(_);break}}};return ConsoleLogger.default=E,ConsoleLogger}var NoOpVideoFrameProcessor={},hasRequiredNoOpVideoFrameProcessor;function requireNoOpVideoFrameProcessor(){if(hasRequiredNoOpVideoFrameProcessor)return NoOpVideoFrameProcessor;hasRequiredNoOpVideoFrameProcessor=1;var x=NoOpVideoFrameProcessor&&NoOpVideoFrameProcessor.__awaiter||function(E,w,T,_){function S(R){return R instanceof T?R:new T(function(A){A(R)})}return new(T||(T=Promise))(function(R,A){function O(te){try{ee(_.next(te))}catch(ie){A(ie)}}function H(te){try{ee(_.throw(te))}catch(ie){A(ie)}}function ee(te){te.done?R(te.value):S(te.value).then(O,H)}ee((_=_.apply(E,w||[])).next())})};Object.defineProperty(NoOpVideoFrameProcessor,"__esModule",{value:!0});let C=class{process(E){return x(this,void 0,void 0,function*(){return E})}destroy(){return x(this,void 0,void 0,function*(){})}};return NoOpVideoFrameProcessor.default=C,NoOpVideoFrameProcessor}var BackgroundBlurProcessorBuiltIn={},BackgroundBlurProcessorProvided={},BackgroundFilterProcessor={},CanvasVideoFrameBuffer={},hasRequiredCanvasVideoFrameBuffer;function requireCanvasVideoFrameBuffer(){if(hasRequiredCanvasVideoFrameBuffer)return CanvasVideoFrameBuffer;hasRequiredCanvasVideoFrameBuffer=1;var x=CanvasVideoFrameBuffer&&CanvasVideoFrameBuffer.__awaiter||function(E,w,T,_){function S(R){return R instanceof T?R:new T(function(A){A(R)})}return new(T||(T=Promise))(function(R,A){function O(te){try{ee(_.next(te))}catch(ie){A(ie)}}function H(te){try{ee(_.throw(te))}catch(ie){A(ie)}}function ee(te){te.done?R(te.value):S(te.value).then(O,H)}ee((_=_.apply(E,w||[])).next())})};Object.defineProperty(CanvasVideoFrameBuffer,"__esModule",{value:!0});let C=class{constructor(E){this.canvas=E,this.destroyed=!1}destroy(){this.canvas=null,this.destroyed=!0}asCanvasImageSource(){return x(this,void 0,void 0,function*(){return this.destroyed?Promise.reject("canvas buffer is destroyed"):Promise.resolve(this.canvas)})}asCanvasElement(){return this.canvas}};return CanvasVideoFrameBuffer.default=C,CanvasVideoFrameBuffer}var BackgroundFilterFrameCounter={},hasRequiredBackgroundFilterFrameCounter;function requireBackgroundFilterFrameCounter(){if(hasRequiredBackgroundFilterFrameCounter)return BackgroundFilterFrameCounter;hasRequiredBackgroundFilterFrameCounter=1,Object.defineProperty(BackgroundFilterFrameCounter,"__esModule",{value:!0});const x=.8;let C=class{constructor(E,w,T,_){this.delegate=E,this.reportingPeriodMillis=w,this.filterCPUUtilization=T,this.logger=_,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(E){const w=E-this.lastReportedEventTimestamp;if(w>=this.reportingPeriodMillis){const T=this.filterCount,_=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=E,this.framerate===0||T===0)return;const S=Math.round(_/T),R=Math.round(this.framerate*(w/1e3))-T,A=Math.round(100*_/w);S>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:R,avgFilterDurationMillis:S,framerate:this.framerate,periodMillis:w}),A>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:A,filterMillis:_,periodMillis:w})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*x)}frameReceived(E){E!==this.framerate&&(this.framerate=E,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());const w=Date.now();this.reportEvent(w)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}};return BackgroundFilterFrameCounter.default=C,BackgroundFilterFrameCounter}var hasRequiredBackgroundFilterProcessor;function requireBackgroundFilterProcessor(){if(hasRequiredBackgroundFilterProcessor)return BackgroundFilterProcessor;hasRequiredBackgroundFilterProcessor=1;var x=BackgroundFilterProcessor&&BackgroundFilterProcessor.__awaiter||function(A,O,H,ee){function te(ie){return ie instanceof H?ie:new H(function(ne){ne(ie)})}return new(H||(H=Promise))(function(ie,ne){function ae(fe){try{le(ee.next(fe))}catch(de){ne(de)}}function oe(fe){try{le(ee.throw(fe))}catch(de){ne(de)}}function le(fe){fe.done?ie(fe.value):te(fe.value).then(ae,oe)}le((ee=ee.apply(A,O||[])).next())})},C=BackgroundFilterProcessor&&BackgroundFilterProcessor.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(BackgroundFilterProcessor,"__esModule",{value:!0}),BackgroundFilterProcessor.BackgroundFilterMonitor=void 0;const E=requireLoader(),w=C(requireCanvasVideoFrameBuffer()),T=C(requireBackgroundFilterFrameCounter());class _{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise(O=>this.resolve=O)),this.promise}next(O){this.value=O,this.resolve(O),delete this.promise}}let S=class Nd{constructor(O,H,ee,te,ie){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new w.default(this.targetCanvas),this.mask$=new _,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=Nd.createWorkerPromise(),this.loadModelPromise=Nd.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=O,this.validateSpec(H),this.validateOptions(ee),this.spec=H,this.logger=ee.logger,this.delegate=te,this.initCPUMonitor(ee),this.eventController=ie}static createWorkerPromise(){const O={resolve:null,reject:null,promise:null};return O.promise=new Promise((H,ee)=>{O.resolve=H,O.reject=ee}),O}validateSpec(O){if(!O)throw new Error("processor has null spec");if(!O.model)throw new Error("processor spec has null model");if(!O.paths)throw new Error("processor spec has null paths")}validateOptions(O){if(!O)throw new Error("processor has null options");if(!O.logger)throw new Error("processor has null options - logger");if(!O.reportingPeriodMillis)throw new Error("processor has null options - reportingPeriodMillis");if(!O.filterCPUUtilization)throw new Error("processor has null options - filterCPUUtilization")}initCPUMonitor(O){this.videoFramesPerFilterUpdate=1,this.frameCounter=new T.default(this.delegate,O.reportingPeriodMillis,O.filterCPUUtilization,this.logger),this.cpuMonitor=new R(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(O){return JSON.stringify(O,null,2)}handleInitialize(O){if(this.logger.info(`received initialize message: ${this.stringify(O)}`),!O.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(new Error("failed to initialize the module"));return}const H=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:H.path,inputHeight:H.input.height,inputWidth:H.input.width,inputChannels:4,modelRangeMin:H.input.range[0],modelRangeMax:H.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(O){if(this.logger.info(`received load model message: ${this.stringify(O)}`),O.payload!==2){this.logger.error("failed to load model! status: "+O.payload),this.loadModelPromise.reject(new Error("failed to load model! status: "+O.payload));return}this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(O){this.mask$.next(O.payload.output)}handleWorkerEvent(O){const H=O.data;switch(H.msg){case"initialize":this.handleInitialize(H);break;case"loadModel":this.handleLoadModel(H);break;case"predict":this.handlePredict(H);break;default:this.logger.info(`unexpected event msg: ${this.stringify(H)}`);break}}loadAssets(){return x(this,void 0,void 0,function*(){this.logger.info("start initializing the processor");try{this.worker=yield E.loadWorker(this.spec.paths.worker,"BackgroundFilterWorker",{},null),this.worker.addEventListener("message",O=>this.handleWorkerEvent(O)),this.worker.postMessage({msg:"initialize",payload:{wasmPath:this.spec.paths.wasm,simdPath:this.spec.paths.simd}}),yield this.initWorkerPromise.promise,this.logger.info(`successfully initialized the ${this.filterType} worker`),yield this.loadModelPromise.promise,this.logger.info(`successfully loaded ${this.filterType} worker segmentation model`)}catch(O){throw new Error(`could not initialize the ${this.filterType} video frame processor due to '${O.message}'`)}this.logger.info(`successfully initialized the ${this.filterType} processor`)})}process(O){return x(this,void 0,void 0,function*(){if(this.destroyed)return O;this.frameCounter.frameReceived(O[0].framerate),this.cpuMonitor.frameReceived();const H=O[0].asCanvasElement();if(!H)return O;if(!this.modelInitialized)return O[0]=this.canvasVideoFrameBuffer,O;const ee=H.width,te=H.height;if(ee===0||te===0)return O;this.sourceWidth===0&&(this.sourceWidth=ee,this.sourceHeight=te,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight,this.logger.info(`${this.filterType} source width: ${this.sourceWidth}`),this.logger.info(`${this.filterType} source height: ${this.sourceHeight}`),this.initOnFirstExecution()),(this.sourceWidth!==ee||this.sourceHeight!==te)&&(this.sourceWidth=ee,this.sourceHeight=te,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let ie=this.mask$.value;const ne=this.spec.model.input.width/H.width,ae=this.spec.model.input.height/H.height;this.scaledCanvas===void 0&&(this.scaledCanvas=document.createElement("canvas"),this.scaledCanvas.width=this.spec.model.input.width,this.scaledCanvas.height=this.spec.model.input.height);const oe=this.scaledCanvas.getContext("2d");oe.save(),oe.scale(ne,ae),oe.drawImage(H,0,0),oe.restore();const le=oe.getImageData(0,0,this.scaledCanvas.width,this.scaledCanvas.height);if(this.frameNumber%this.videoFramesPerFilterUpdate===0){const fe=this.mask$.whenNext();this.worker.postMessage({msg:"predict",payload:le},[le.data.buffer]),ie=yield fe}this.destroyed||this.drawImageWithMask(H,ie)}catch(ie){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${ie}`),O}finally{this.frameCounter.filterComplete(),this.frameNumber++}return O[0]=this.canvasVideoFrameBuffer,O})}updateVideoFramesPerFilterUpdate(O){O!==this.videoFramesPerFilterUpdate&&(this.videoFramesPerFilterUpdate=O,this.logger.info(`Adjusting filter rate to compensate for CPU utilization. Filter rate is ${this.videoFramesPerFilterUpdate} video frames per filter.`))}destroy(){var O,H,ee,te;return x(this,void 0,void 0,function*(){this.destroyed=!0,this.delegate.removeObserver(this.cpuMonitor),this.canvasVideoFrameBuffer.destroy(),(O=this.worker)===null||O===void 0||O.postMessage({msg:"destroy"}),(H=this.worker)===null||H===void 0||H.postMessage({msg:"stop"}),(ee=this.targetCanvas)===null||ee===void 0||ee.remove(),this.targetCanvas=void 0,(te=this.scaledCanvas)===null||te===void 0||te.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)})}};BackgroundFilterProcessor.default=S;class R{constructor(O,H){this.monitoringPeriodMillis=O,this.observer=H,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){const O=Date.now();O-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=O,this.observer.reduceCPUUtilization())}frameReceived(){const O=Date.now();O-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis*2&&(this.lastCPUChangeTimestamp=O,this.observer.increaseCPUUtilization())}}return BackgroundFilterProcessor.BackgroundFilterMonitor=R,BackgroundFilterProcessor}var BackgroundBlurVideoFrameProcessorDelegate={},BackgroundFilterVideoFrameProcessorDelegate={},hasRequiredBackgroundFilterVideoFrameProcessorDelegate;function requireBackgroundFilterVideoFrameProcessorDelegate(){if(hasRequiredBackgroundFilterVideoFrameProcessorDelegate)return BackgroundFilterVideoFrameProcessorDelegate;hasRequiredBackgroundFilterVideoFrameProcessorDelegate=1,Object.defineProperty(BackgroundFilterVideoFrameProcessorDelegate,"__esModule",{value:!0});let x=class{constructor(){this.observers=new Set}addObserver(C){this.observers.add(C)}removeObserver(C){this.observers.delete(C)}filterFrameDurationHigh(C){var E;for(const w of this.observers)(E=w.filterFrameDurationHigh)===null||E===void 0||E.call(w,C)}filterCPUUtilizationHigh(C){var E;for(const w of this.observers)(E=w.filterCPUUtilizationHigh)===null||E===void 0||E.call(w,C)}};return BackgroundFilterVideoFrameProcessorDelegate.default=x,BackgroundFilterVideoFrameProcessorDelegate}var hasRequiredBackgroundBlurVideoFrameProcessorDelegate;function requireBackgroundBlurVideoFrameProcessorDelegate(){if(hasRequiredBackgroundBlurVideoFrameProcessorDelegate)return BackgroundBlurVideoFrameProcessorDelegate;hasRequiredBackgroundBlurVideoFrameProcessorDelegate=1;var x=BackgroundBlurVideoFrameProcessorDelegate&&BackgroundBlurVideoFrameProcessorDelegate.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(BackgroundBlurVideoFrameProcessorDelegate,"__esModule",{value:!0});const C=x(requireBackgroundFilterVideoFrameProcessorDelegate());let E=class extends C.default{};return BackgroundBlurVideoFrameProcessorDelegate.default=E,BackgroundBlurVideoFrameProcessorDelegate}var hasRequiredBackgroundBlurProcessorProvided;function requireBackgroundBlurProcessorProvided(){if(hasRequiredBackgroundBlurProcessorProvided)return BackgroundBlurProcessorProvided;hasRequiredBackgroundBlurProcessorProvided=1;var x=BackgroundBlurProcessorProvided&&BackgroundBlurProcessorProvided.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=BackgroundBlurProcessorProvided&&BackgroundBlurProcessorProvided.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(BackgroundBlurProcessorProvided,"__esModule",{value:!0});const E=C(requireBackgroundFilterProcessor()),w=requireBackgroundBlurStrength(),T=C(requireBackgroundBlurVideoFrameProcessorDelegate());let _=class extends E.default{constructor(S,R){super("background blur",S,R,new T.default),this.blurAmount=0,this.setBlurStrength(R.blurStrength),this.logger.info("BackgroundBlur processor successfully created"),this.logger.info(`BackgroundBlur spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundBlur options: { blurStrength: ${R.blurStrength}, filterCPUUtilization: ${R.filterCPUUtilization}, reportingPeriodMillis: ${R.reportingPeriodMillis}}`)}validateOptions(S){if(super.validateOptions(S),!S.blurStrength)throw new Error("processor has null options - blurStrength")}initOnFirstExecution(){this.setBlurPixels()}drawImageWithMask(S,R){R||(R=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(R,0,0);const{canvasCtx:A,targetCanvas:O}=this,{width:H,height:ee}=O;A.save(),A.clearRect(0,0,H,ee),A.drawImage(this.scaledCanvas,0,0,H,ee),A.globalCompositeOperation="source-in",A.drawImage(S,0,0,H,ee),A.globalCompositeOperation="destination-over",A.filter=`blur(${this.blurAmount}px)`,A.drawImage(S,0,0,O.width,O.height),A.restore()}setBlurStrength(S){this._blurStrength=S,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=w.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(S){this.delegate.addObserver(S)}removeObserver(S){this.delegate.removeObserver(S)}static isSupported(){return x(this,void 0,void 0,function*(){const S=document.createElement("canvas"),R=S.getContext("2d").filter!==void 0;return S.remove(),R})}setEventController(S){this.eventController?this.eventController=S:(this.eventController=S,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){const S={backgroundBlurEnabled:"true",backgroundBlurStrength:this._blurStrength,backgroundReplacementEnabled:"false",backgroundFilterVersion:1};this.eventController.publishEvent("backgroundFilterConfigSelected",S)}};return BackgroundBlurProcessorProvided.default=_,BackgroundBlurProcessorProvided}var hasRequiredBackgroundBlurProcessorBuiltIn;function requireBackgroundBlurProcessorBuiltIn(){if(hasRequiredBackgroundBlurProcessorBuiltIn)return BackgroundBlurProcessorBuiltIn;hasRequiredBackgroundBlurProcessorBuiltIn=1;var x=BackgroundBlurProcessorBuiltIn&&BackgroundBlurProcessorBuiltIn.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=BackgroundBlurProcessorBuiltIn&&BackgroundBlurProcessorBuiltIn.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(BackgroundBlurProcessorBuiltIn,"__esModule",{value:!0});const E=C(requireBackgroundBlurProcessorProvided()),w=requireBackgroundBlurStrength();let T=class extends E.default{constructor(_,S){super(_,S),this.blurCanvas=document.createElement("canvas"),this.blurCanvasCtx=this.blurCanvas.getContext("2d"),this.blurCanvas.width=this.spec.model.input.width,this.blurCanvas.height=this.spec.model.input.height,this.logger.info("BackgroundBlur processor using builtin blur")}drawImageWithMask(_,S){const R=this.blurredImage,{canvasCtx:A,targetCanvas:O}=this,{width:H,height:ee}=O;if(!S||!R){A.clearRect(0,0,H,ee);return}this.scaledCanvas.getContext("2d").putImageData(S,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),A.save(),A.clearRect(0,0,H,ee),A.drawImage(this.scaledCanvas,0,0,H,ee),A.globalCompositeOperation="source-in",A.drawImage(_,0,0,H,ee),A.globalCompositeOperation="destination-over",A.drawImage(this.blurCanvas,0,0,H,ee),A.restore()}setBlurStrength(_){if(super.setBlurStrength(_),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});const S=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:S.path,inputHeight:S.input.height,inputWidth:S.input.width,inputChannels:4,modelRangeMin:S.input.range[0],modelRangeMax:S.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=w.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(_){if(this.logger.info(`received initialize message: ${this.stringify(_)}`),!_.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(new Error("failed to initialize the module"));return}const S=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:S.path,inputHeight:S.input.height,inputWidth:S.input.width,inputChannels:4,modelRangeMin:S.input.range[0],modelRangeMax:S.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(_){this.blurredImage=_.payload.blurOutput,super.handlePredict(_)}destroy(){const _=Object.create(null,{destroy:{get:()=>super.destroy}});var S;return x(this,void 0,void 0,function*(){_.destroy.call(this),(S=this.blurCanvas)===null||S===void 0||S.remove(),this.blurCanvas=void 0})}};return BackgroundBlurProcessorBuiltIn.default=T,BackgroundBlurProcessorBuiltIn}var hasRequiredBackgroundBlurVideoFrameProcessor;function requireBackgroundBlurVideoFrameProcessor(){if(hasRequiredBackgroundBlurVideoFrameProcessor)return BackgroundBlurVideoFrameProcessor;hasRequiredBackgroundBlurVideoFrameProcessor=1;var x=BackgroundBlurVideoFrameProcessor&&BackgroundBlurVideoFrameProcessor.__awaiter||function(ee,te,ie,ne){function ae(oe){return oe instanceof ie?oe:new ie(function(le){le(oe)})}return new(ie||(ie=Promise))(function(oe,le){function fe(pe){try{ce(ne.next(pe))}catch(he){le(he)}}function de(pe){try{ce(ne.throw(pe))}catch(he){le(he)}}function ce(pe){pe.done?oe(pe.value):ae(pe.value).then(fe,de)}ce((ne=ne.apply(ee,te||[])).next())})},C=BackgroundBlurVideoFrameProcessor&&BackgroundBlurVideoFrameProcessor.__importDefault||function(ee){return ee&&ee.__esModule?ee:{default:ee}};Object.defineProperty(BackgroundBlurVideoFrameProcessor,"__esModule",{value:!0});const E=C(requireBackgroundFilterVideoFrameProcessor()),w=C(requireConsoleLogger()),T=C(requireLogLevel()),_=C(requireNoOpVideoFrameProcessor()),S=C(requireBackgroundBlurProcessorBuiltIn()),R=C(requireBackgroundBlurProcessorProvided()),A=C(requireBackgroundBlurStrength());class O extends _.default{setBlurStrength(){}loadAssets(){return x(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}}let H=class Gs extends E.default{static create(te,ie){return x(this,void 0,void 0,function*(){te=Gs.resolveSpec(te),ie=Gs.resolveOptions(ie);const{logger:ne}=ie,ae=yield Gs.isSupported(te,ie);if(ne.info(`processor is ${ae?"":"not"} supported`),!ae)return ne.warn("Using no-op processor because background blur is not supported"),new O;let oe;return(yield R.default.isSupported())?(ne.info("Using browser-provided background blur"),oe=new R.default(te,ie)):(ne.info("Using built-in background blur"),oe=new S.default(te,ie)),yield oe.loadAssets(),oe})}static resolveOptions(te={}){let ie=Object.assign({},te);return ie.blurStrength||(ie.blurStrength=A.default.MEDIUM),ie.logger||(ie.logger=new w.default("BackgroundBlurProcessor",T.default.INFO)),ie=super.resolveOptions(ie),ie}static isSupported(te,ie){return te=Gs.resolveSpec(te),ie=Gs.resolveOptions(ie),super.isSupported(te,ie)}};return BackgroundBlurVideoFrameProcessor.default=H,BackgroundBlurVideoFrameProcessor}var BackgroundReplacementVideoFrameProcessor={},BackgroundReplacementFilter={},BackgroundReplacementVideoFrameProcessorDelegate={},hasRequiredBackgroundReplacementVideoFrameProcessorDelegate;function requireBackgroundReplacementVideoFrameProcessorDelegate(){if(hasRequiredBackgroundReplacementVideoFrameProcessorDelegate)return BackgroundReplacementVideoFrameProcessorDelegate;hasRequiredBackgroundReplacementVideoFrameProcessorDelegate=1;var x=BackgroundReplacementVideoFrameProcessorDelegate&&BackgroundReplacementVideoFrameProcessorDelegate.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(BackgroundReplacementVideoFrameProcessorDelegate,"__esModule",{value:!0});const C=x(requireBackgroundFilterVideoFrameProcessorDelegate());let E=class extends C.default{};return BackgroundReplacementVideoFrameProcessorDelegate.default=E,BackgroundReplacementVideoFrameProcessorDelegate}var hasRequiredBackgroundReplacementFilter;function requireBackgroundReplacementFilter(){if(hasRequiredBackgroundReplacementFilter)return BackgroundReplacementFilter;hasRequiredBackgroundReplacementFilter=1;var x=BackgroundReplacementFilter&&BackgroundReplacementFilter.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=BackgroundReplacementFilter&&BackgroundReplacementFilter.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(BackgroundReplacementFilter,"__esModule",{value:!0});const E=C(requireBackgroundFilterProcessor()),w=C(requireBackgroundReplacementVideoFrameProcessorDelegate());let T=class Ud extends E.default{constructor(S,R){super("background replacement",S,R,new w.default),this.replacementBlob=R.imageBlob,this.logger.info("BackgroundReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: { filterCPUUtilization: ${R.filterCPUUtilization}, reportingPeriodMillis: ${R.reportingPeriodMillis}}`)}setImageBlob(S){return x(this,void 0,void 0,function*(){this.replacementBlob=S,this.replacementImage=yield Ud.loadImage(this.createReplacementObjectUrl())})}initOnFirstExecution(){}drawImageWithMask(S,R){R||(R=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(R,0,0);const{canvasCtx:A,targetCanvas:O}=this,{width:H,height:ee}=O;A.save(),A.clearRect(0,0,H,ee),A.drawImage(this.scaledCanvas,0,0,H,ee),A.globalCompositeOperation="source-in",A.drawImage(S,0,0,H,ee),A.globalCompositeOperation="destination-over",A.drawImage(this.replacementImage,0,0,O.width,O.height),A.restore()}static loadImageExecutor(S,R,A){const O=new Image;O.crossOrigin="Anonymous",O.addEventListener("load",()=>{S(O)},!1),O.addEventListener("error",H=>{R(new Error(`Could not load replacement image ${O.src}: ${H.message}`))},!1),O.src=A}static loadImage(S){return x(this,void 0,void 0,function*(){return new Promise((R,A)=>this.loadImageExecutor(R,A,S))})}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){const S=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return x(this,void 0,void 0,function*(){this.replacementImage=yield Ud.loadImage(this.createReplacementObjectUrl()),S.loadAssets.call(this)})}addObserver(S){this.delegate.addObserver(S)}removeObserver(S){this.delegate.removeObserver(S)}destroy(){const S=Object.create(null,{destroy:{get:()=>super.destroy}});return x(this,void 0,void 0,function*(){S.destroy.call(this),this.revokeReplacementObjectUrl()})}setEventController(S){this.eventController?this.eventController=S:(this.eventController=S,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){const S={backgroundBlurEnabled:"false",backgroundBlurStrength:"low",backgroundReplacementEnabled:"true",backgroundFilterVersion:1};this.eventController.publishEvent("backgroundFilterConfigSelected",S)}};return BackgroundReplacementFilter.default=T,BackgroundReplacementFilter}var hasRequiredBackgroundReplacementVideoFrameProcessor;function requireBackgroundReplacementVideoFrameProcessor(){if(hasRequiredBackgroundReplacementVideoFrameProcessor)return BackgroundReplacementVideoFrameProcessor;hasRequiredBackgroundReplacementVideoFrameProcessor=1;var x=BackgroundReplacementVideoFrameProcessor&&BackgroundReplacementVideoFrameProcessor.__awaiter||function(O,H,ee,te){function ie(ne){return ne instanceof ee?ne:new ee(function(ae){ae(ne)})}return new(ee||(ee=Promise))(function(ne,ae){function oe(de){try{fe(te.next(de))}catch(ce){ae(ce)}}function le(de){try{fe(te.throw(de))}catch(ce){ae(ce)}}function fe(de){de.done?ne(de.value):ie(de.value).then(oe,le)}fe((te=te.apply(O,H||[])).next())})},C=BackgroundReplacementVideoFrameProcessor&&BackgroundReplacementVideoFrameProcessor.__importDefault||function(O){return O&&O.__esModule?O:{default:O}};Object.defineProperty(BackgroundReplacementVideoFrameProcessor,"__esModule",{value:!0});const E=C(requireBackgroundFilterVideoFrameProcessor()),w=C(requireConsoleLogger()),T=C(requireLogLevel()),_=C(requireNoOpVideoFrameProcessor()),S=C(requireBackgroundReplacementFilter());class R extends _.default{loadAssets(){return x(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}setImageBlob(){return x(this,void 0,void 0,function*(){})}}let A=class rm extends E.default{static create(H,ee){return x(this,void 0,void 0,function*(){H=this.resolveSpec(H),ee=this.resolveOptions(ee),yield this.resolveOptionsAsync(ee);const{logger:te}=ee;if(!(yield rm.isSupported(H,ee)))return te.warn("Using no-op processor because background replacement is not supported"),new R;te.info("Using background replacement filter");const ie=new S.default(H,ee);return yield ie.loadAssets(),ie})}static resolveOptions(H={}){const ee=Object.assign({},H);return ee.logger||(ee.logger=new w.default("BackgroundReplacementProcessor",T.default.INFO)),super.resolveOptions(ee)}static resolveOptionsAsync(H){return x(this,void 0,void 0,function*(){if(!H.imageBlob){const ee=document.createElement("canvas");ee.width=100,ee.height=100;const te=ee.getContext("2d");te.fillStyle="blue",te.fillRect(0,0,100,100);const ie=yield new Promise(ne=>{ee.toBlob(ne)});H.imageBlob=ie}})}static isSupported(H,ee){const te=Object.create(null,{isSupported:{get:()=>super.isSupported}});return x(this,void 0,void 0,function*(){H=this.resolveSpec(H),ee=this.resolveOptions(ee),yield this.resolveOptionsAsync(ee);const ie=ee.imageBlob,ne=URL.createObjectURL(ie);try{yield S.default.loadImage(ne)}catch(ae){return ee.logger.info(`Failed to fetch load replacement image ${ae.message}`),!1}finally{URL.revokeObjectURL(ne)}return te.isSupported.call(this,H,ee)})}};return BackgroundReplacementVideoFrameProcessor.default=A,BackgroundReplacementVideoFrameProcessor}var BaseConnectionHealthPolicy={},hasRequiredBaseConnectionHealthPolicy;function requireBaseConnectionHealthPolicy(){if(hasRequiredBaseConnectionHealthPolicy)return BaseConnectionHealthPolicy;hasRequiredBaseConnectionHealthPolicy=1,Object.defineProperty(BaseConnectionHealthPolicy,"__esModule",{value:!0});let x=class{constructor(C,E,w){this.minHealth=C.minHealth,this.maxHealth=C.maxHealth,this.currentHealth=C.initialHealth,this.currentData=E.clone(),this.name=w}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(C){this.currentData=C}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){const C=this.health();return C!==this.currentHealth?(this.currentHealth=C,C):null}};return BaseConnectionHealthPolicy.default=x,BaseConnectionHealthPolicy}var BitrateParameters={},hasRequiredBitrateParameters;function requireBitrateParameters(){if(hasRequiredBitrateParameters)return BitrateParameters;hasRequiredBitrateParameters=1,Object.defineProperty(BitrateParameters,"__esModule",{value:!0});let x=class{};return BitrateParameters.default=x,BitrateParameters}var CSPMonitor={},hasRequiredCSPMonitor;function requireCSPMonitor(){if(hasRequiredCSPMonitor)return CSPMonitor;hasRequiredCSPMonitor=1,Object.defineProperty(CSPMonitor,"__esModule",{value:!0});let x=class Gi{static register(){!("document"in commonjsGlobal)||!document.addEventListener||Gi.shouldRegisterCSPMonitor&&(Gi.added||(document.addEventListener("securitypolicyviolation",Gi.listener),Gi.added=!0))}static unregister(){!("document"in commonjsGlobal)||!document.removeEventListener||(document.removeEventListener("securitypolicyviolation",Gi.listener),Gi.loggers=new Set,Gi.added=!1)}static disable(){Gi.shouldRegisterCSPMonitor=!1,Gi.unregister()}static addLogger(E){E&&Gi.loggers.add(E)}static removeLogger(E){E&&Gi.loggers.delete(E)}};return CSPMonitor.default=x,x.loggers=new Set,x.shouldRegisterCSPMonitor=!0,x.added=!1,x.listener=C=>{const E=`Security Policy Violation
Blocked URI: ${C.blockedURI}
Violated Directive: ${C.violatedDirective}
Original Policy: ${C.originalPolicy}
Document URI: ${C.documentURI}
Source File: ${C.sourceFile}
Line No.: ${C.lineNumber}
`;for(const w of x.loggers)w.error(E);x.loggers.size===0&&console.error(E)},CSPMonitor}var CheckAudioConnectivityFeedback={},hasRequiredCheckAudioConnectivityFeedback;function requireCheckAudioConnectivityFeedback(){return hasRequiredCheckAudioConnectivityFeedback||(hasRequiredCheckAudioConnectivityFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckAudioConnectivityFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.AudioInputRequestFailed=1]="AudioInputRequestFailed",E[E.AudioInputPermissionDenied=2]="AudioInputPermissionDenied",E[E.ConnectionFailed=3]="ConnectionFailed",E[E.AudioNotReceived=4]="AudioNotReceived"})(C=x.CheckAudioConnectivityFeedback||(x.CheckAudioConnectivityFeedback={})),x.default=C}(CheckAudioConnectivityFeedback)),CheckAudioConnectivityFeedback}var CheckAudioInputFeedback={},hasRequiredCheckAudioInputFeedback;function requireCheckAudioInputFeedback(){return hasRequiredCheckAudioInputFeedback||(hasRequiredCheckAudioInputFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckAudioInputFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.Failed=1]="Failed",E[E.PermissionDenied=2]="PermissionDenied"})(C=x.CheckAudioInputFeedback||(x.CheckAudioInputFeedback={})),x.default=C}(CheckAudioInputFeedback)),CheckAudioInputFeedback}var CheckAudioOutputFeedback={},hasRequiredCheckAudioOutputFeedback;function requireCheckAudioOutputFeedback(){return hasRequiredCheckAudioOutputFeedback||(hasRequiredCheckAudioOutputFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckAudioOutputFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.Failed=1]="Failed"})(C=x.CheckAudioOutputFeedback||(x.CheckAudioOutputFeedback={})),x.default=C}(CheckAudioOutputFeedback)),CheckAudioOutputFeedback}var CheckCameraResolutionFeedback={},hasRequiredCheckCameraResolutionFeedback;function requireCheckCameraResolutionFeedback(){return hasRequiredCheckCameraResolutionFeedback||(hasRequiredCheckCameraResolutionFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckCameraResolutionFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.Failed=1]="Failed",E[E.ResolutionNotSupported=2]="ResolutionNotSupported",E[E.PermissionDenied=3]="PermissionDenied"})(C=x.CheckCameraResolutionFeedback||(x.CheckCameraResolutionFeedback={})),x.default=C}(CheckCameraResolutionFeedback)),CheckCameraResolutionFeedback}var CheckContentShareConnectivityFeedback={},hasRequiredCheckContentShareConnectivityFeedback;function requireCheckContentShareConnectivityFeedback(){return hasRequiredCheckContentShareConnectivityFeedback||(hasRequiredCheckContentShareConnectivityFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckContentShareConnectivityFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.Failed=1]="Failed",E[E.PermissionDenied=2]="PermissionDenied",E[E.TimedOut=3]="TimedOut",E[E.ConnectionFailed=4]="ConnectionFailed"})(C=x.CheckContentShareConnectivityFeedback||(x.CheckContentShareConnectivityFeedback={})),x.default=C}(CheckContentShareConnectivityFeedback)),CheckContentShareConnectivityFeedback}var CheckNetworkTCPConnectivityFeedback={},hasRequiredCheckNetworkTCPConnectivityFeedback;function requireCheckNetworkTCPConnectivityFeedback(){return hasRequiredCheckNetworkTCPConnectivityFeedback||(hasRequiredCheckNetworkTCPConnectivityFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckNetworkTCPConnectivityFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",E[E.ConnectionFailed=2]="ConnectionFailed",E[E.ICENegotiationFailed=3]="ICENegotiationFailed"})(C=x.CheckNetworkTCPConnectivityFeedback||(x.CheckNetworkTCPConnectivityFeedback={})),x.default=C}(CheckNetworkTCPConnectivityFeedback)),CheckNetworkTCPConnectivityFeedback}var CheckNetworkUDPConnectivityFeedback={},hasRequiredCheckNetworkUDPConnectivityFeedback;function requireCheckNetworkUDPConnectivityFeedback(){return hasRequiredCheckNetworkUDPConnectivityFeedback||(hasRequiredCheckNetworkUDPConnectivityFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckNetworkUDPConnectivityFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",E[E.ConnectionFailed=2]="ConnectionFailed",E[E.ICENegotiationFailed=3]="ICENegotiationFailed"})(C=x.CheckNetworkUDPConnectivityFeedback||(x.CheckNetworkUDPConnectivityFeedback={})),x.default=C}(CheckNetworkUDPConnectivityFeedback)),CheckNetworkUDPConnectivityFeedback}var CheckVideoConnectivityFeedback={},hasRequiredCheckVideoConnectivityFeedback;function requireCheckVideoConnectivityFeedback(){return hasRequiredCheckVideoConnectivityFeedback||(hasRequiredCheckVideoConnectivityFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckVideoConnectivityFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.VideoInputRequestFailed=1]="VideoInputRequestFailed",E[E.VideoInputPermissionDenied=2]="VideoInputPermissionDenied",E[E.ConnectionFailed=3]="ConnectionFailed",E[E.VideoNotSent=4]="VideoNotSent"})(C=x.CheckVideoConnectivityFeedback||(x.CheckVideoConnectivityFeedback={})),x.default=C}(CheckVideoConnectivityFeedback)),CheckVideoConnectivityFeedback}var CheckVideoInputFeedback={},hasRequiredCheckVideoInputFeedback;function requireCheckVideoInputFeedback(){return hasRequiredCheckVideoInputFeedback||(hasRequiredCheckVideoInputFeedback=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.CheckVideoInputFeedback=void 0;var C;(function(E){E[E.Succeeded=0]="Succeeded",E[E.Failed=1]="Failed",E[E.PermissionDenied=2]="PermissionDenied"})(C=x.CheckVideoInputFeedback||(x.CheckVideoInputFeedback={})),x.default=C}(CheckVideoInputFeedback)),CheckVideoInputFeedback}var CleanRestartedSessionTask={},hasRequiredCleanRestartedSessionTask;function requireCleanRestartedSessionTask(){if(hasRequiredCleanRestartedSessionTask)return CleanRestartedSessionTask;hasRequiredCleanRestartedSessionTask=1;var x=CleanRestartedSessionTask&&CleanRestartedSessionTask.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=CleanRestartedSessionTask&&CleanRestartedSessionTask.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(CleanRestartedSessionTask,"__esModule",{value:!0});const E=C(requireBaseTask());let w=class extends E.default{constructor(T){super(T.logger),this.context=T,this.taskName="CleanRestartedSessionTask"}run(){return x(this,void 0,void 0,function*(){this.context.resetConnectionSpecificState()})}};return CleanRestartedSessionTask.default=w,CleanRestartedSessionTask}var CleanStoppedSessionTask={},SignalingClientEventType={},hasRequiredSignalingClientEventType;function requireSignalingClientEventType(){return hasRequiredSignalingClientEventType||(hasRequiredSignalingClientEventType=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SignalingClientEventType=void 0;var C;(function(E){E[E.WebSocketConnecting=0]="WebSocketConnecting",E[E.WebSocketOpen=1]="WebSocketOpen",E[E.WebSocketError=2]="WebSocketError",E[E.WebSocketClosing=3]="WebSocketClosing",E[E.WebSocketClosed=4]="WebSocketClosed",E[E.WebSocketFailed=5]="WebSocketFailed",E[E.WebSocketMessage=6]="WebSocketMessage",E[E.WebSocketSendMessageFailure=7]="WebSocketSendMessageFailure",E[E.WebSocketSentMessage=8]="WebSocketSentMessage",E[E.ProtocolDecodeFailure=9]="ProtocolDecodeFailure",E[E.ReceivedSignalFrame=10]="ReceivedSignalFrame",E[E.WebSocketSkippedMessage=11]="WebSocketSkippedMessage"})(C=x.SignalingClientEventType||(x.SignalingClientEventType={})),x.default=C}(SignalingClientEventType)),SignalingClientEventType}var hasRequiredCleanStoppedSessionTask;function requireCleanStoppedSessionTask(){if(hasRequiredCleanStoppedSessionTask)return CleanStoppedSessionTask;hasRequiredCleanStoppedSessionTask=1;var x=CleanStoppedSessionTask&&CleanStoppedSessionTask.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=CleanStoppedSessionTask&&CleanStoppedSessionTask.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(CleanStoppedSessionTask,"__esModule",{value:!0});const E=C(requireSignalingClientEventType()),w=C(requireBaseTask());let T=class extends w.default{constructor(_){super(_.logger),this.context=_,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return x(this,void 0,void 0,function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(_){throw _}finally{for(const S of this.context.removableObservers)S.removeObserver();this.context.resetConnectionSpecificState(),this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.videoUplinkBandwidthPolicy.setTransceiverController&&this.context.videoUplinkBandwidthPolicy.setTransceiverController(void 0),this.context.videoDownlinkBandwidthPolicy.bindToTileController&&this.context.videoDownlinkBandwidthPolicy.bindToTileController(void 0);const _=this.context.videoTileController.getLocalVideoTile();_&&_.bindVideoStream("",!0,null,null,null,null),this.context.videoTileController.removeAllVideoTiles()}})}receiveWebSocketClosedEvent(){return new Promise((_,S)=>{class R{constructor(H){this.signalingClient=H}cancel(){this.signalingClient.removeObserver(this),S(new Error("CleanStoppedSessionTask got canceled while waiting for the WebSocket closed event"))}handleSignalingClientEvent(H){H.type===E.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),_())}}const A=new R(this.context.signalingClient);this.taskCanceler=A,this.context.signalingClient.registerObserver(A)})}};return CleanStoppedSessionTask.default=T,CleanStoppedSessionTask}var ClientMetricReport={},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=x;function x(C,E){for(var w=new Array(arguments.length-1),T=0,_=2,S=!0;_<arguments.length;)w[T++]=arguments[_++];return new Promise(function(R,A){w[T]=function(O){if(S)if(S=!1,O)A(O);else{for(var H=new Array(arguments.length-1),ee=0;ee<H.length;)H[ee++]=arguments[ee];R.apply(null,H)}};try{C.apply(E||null,w)}catch(O){S&&(S=!1,A(O))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(x){var C=x;C.length=function(S){var R=S.length;if(!R)return 0;for(var A=0;--R%4>1&&S.charAt(R)==="=";)++A;return Math.ceil(S.length*3)/4-A};for(var E=new Array(64),w=new Array(123),T=0;T<64;)w[E[T]=T<26?T+65:T<52?T+71:T<62?T-4:T-59|43]=T++;C.encode=function(S,R,A){for(var O=null,H=[],ee=0,te=0,ie;R<A;){var ne=S[R++];switch(te){case 0:H[ee++]=E[ne>>2],ie=(ne&3)<<4,te=1;break;case 1:H[ee++]=E[ie|ne>>4],ie=(ne&15)<<2,te=2;break;case 2:H[ee++]=E[ie|ne>>6],H[ee++]=E[ne&63],te=0;break}ee>8191&&((O||(O=[])).push(String.fromCharCode.apply(String,H)),ee=0)}return te&&(H[ee++]=E[ie],H[ee++]=61,te===1&&(H[ee++]=61)),O?(ee&&O.push(String.fromCharCode.apply(String,H.slice(0,ee))),O.join("")):String.fromCharCode.apply(String,H.slice(0,ee))};var _="invalid encoding";C.decode=function(S,R,A){for(var O=A,H=0,ee,te=0;te<S.length;){var ie=S.charCodeAt(te++);if(ie===61&&H>1)break;if((ie=w[ie])===void 0)throw Error(_);switch(H){case 0:ee=ie,H=1;break;case 1:R[A++]=ee<<2|(ie&48)>>4,ee=ie,H=2;break;case 2:R[A++]=(ee&15)<<4|(ie&60)>>2,ee=ie,H=3;break;case 3:R[A++]=(ee&3)<<6|ie,H=0;break}}if(H===1)throw Error(_);return A-O},C.test=function(S){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(S)}}(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=x;function x(){this._listeners={}}return x.prototype.on=function(C,E,w){return(this._listeners[C]||(this._listeners[C]=[])).push({fn:E,ctx:w||this}),this},x.prototype.off=function(C,E){if(C===void 0)this._listeners={};else if(E===void 0)this._listeners[C]=[];else for(var w=this._listeners[C],T=0;T<w.length;)w[T].fn===E?w.splice(T,1):++T;return this},x.prototype.emit=function(C){var E=this._listeners[C];if(E){for(var w=[],T=1;T<arguments.length;)w.push(arguments[T++]);for(T=0;T<E.length;)E[T].fn.apply(E[T++].ctx,w)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=x(x);function x(_){return typeof Float32Array<"u"?function(){var S=new Float32Array([-0]),R=new Uint8Array(S.buffer),A=R[3]===128;function O(ie,ne,ae){S[0]=ie,ne[ae]=R[0],ne[ae+1]=R[1],ne[ae+2]=R[2],ne[ae+3]=R[3]}function H(ie,ne,ae){S[0]=ie,ne[ae]=R[3],ne[ae+1]=R[2],ne[ae+2]=R[1],ne[ae+3]=R[0]}_.writeFloatLE=A?O:H,_.writeFloatBE=A?H:O;function ee(ie,ne){return R[0]=ie[ne],R[1]=ie[ne+1],R[2]=ie[ne+2],R[3]=ie[ne+3],S[0]}function te(ie,ne){return R[3]=ie[ne],R[2]=ie[ne+1],R[1]=ie[ne+2],R[0]=ie[ne+3],S[0]}_.readFloatLE=A?ee:te,_.readFloatBE=A?te:ee}():function(){function S(A,O,H,ee){var te=O<0?1:0;if(te&&(O=-O),O===0)A(1/O>0?0:2147483648,H,ee);else if(isNaN(O))A(2143289344,H,ee);else if(O>34028234663852886e22)A((te<<31|2139095040)>>>0,H,ee);else if(O<11754943508222875e-54)A((te<<31|Math.round(O/1401298464324817e-60))>>>0,H,ee);else{var ie=Math.floor(Math.log(O)/Math.LN2),ne=Math.round(O*Math.pow(2,-ie)*8388608)&8388607;A((te<<31|ie+127<<23|ne)>>>0,H,ee)}}_.writeFloatLE=S.bind(null,C),_.writeFloatBE=S.bind(null,E);function R(A,O,H){var ee=A(O,H),te=(ee>>31)*2+1,ie=ee>>>23&255,ne=ee&8388607;return ie===255?ne?NaN:te*(1/0):ie===0?te*1401298464324817e-60*ne:te*Math.pow(2,ie-150)*(ne+8388608)}_.readFloatLE=R.bind(null,w),_.readFloatBE=R.bind(null,T)}(),typeof Float64Array<"u"?function(){var S=new Float64Array([-0]),R=new Uint8Array(S.buffer),A=R[7]===128;function O(ie,ne,ae){S[0]=ie,ne[ae]=R[0],ne[ae+1]=R[1],ne[ae+2]=R[2],ne[ae+3]=R[3],ne[ae+4]=R[4],ne[ae+5]=R[5],ne[ae+6]=R[6],ne[ae+7]=R[7]}function H(ie,ne,ae){S[0]=ie,ne[ae]=R[7],ne[ae+1]=R[6],ne[ae+2]=R[5],ne[ae+3]=R[4],ne[ae+4]=R[3],ne[ae+5]=R[2],ne[ae+6]=R[1],ne[ae+7]=R[0]}_.writeDoubleLE=A?O:H,_.writeDoubleBE=A?H:O;function ee(ie,ne){return R[0]=ie[ne],R[1]=ie[ne+1],R[2]=ie[ne+2],R[3]=ie[ne+3],R[4]=ie[ne+4],R[5]=ie[ne+5],R[6]=ie[ne+6],R[7]=ie[ne+7],S[0]}function te(ie,ne){return R[7]=ie[ne],R[6]=ie[ne+1],R[5]=ie[ne+2],R[4]=ie[ne+3],R[3]=ie[ne+4],R[2]=ie[ne+5],R[1]=ie[ne+6],R[0]=ie[ne+7],S[0]}_.readDoubleLE=A?ee:te,_.readDoubleBE=A?te:ee}():function(){function S(A,O,H,ee,te,ie){var ne=ee<0?1:0;if(ne&&(ee=-ee),ee===0)A(0,te,ie+O),A(1/ee>0?0:2147483648,te,ie+H);else if(isNaN(ee))A(0,te,ie+O),A(2146959360,te,ie+H);else if(ee>17976931348623157e292)A(0,te,ie+O),A((ne<<31|2146435072)>>>0,te,ie+H);else{var ae;if(ee<22250738585072014e-324)ae=ee/5e-324,A(ae>>>0,te,ie+O),A((ne<<31|ae/4294967296)>>>0,te,ie+H);else{var oe=Math.floor(Math.log(ee)/Math.LN2);oe===1024&&(oe=1023),ae=ee*Math.pow(2,-oe),A(ae*4503599627370496>>>0,te,ie+O),A((ne<<31|oe+1023<<20|ae*1048576&1048575)>>>0,te,ie+H)}}}_.writeDoubleLE=S.bind(null,C,0,4),_.writeDoubleBE=S.bind(null,E,4,0);function R(A,O,H,ee,te){var ie=A(ee,te+O),ne=A(ee,te+H),ae=(ne>>31)*2+1,oe=ne>>>20&2047,le=4294967296*(ne&1048575)+ie;return oe===2047?le?NaN:ae*(1/0):oe===0?ae*5e-324*le:ae*Math.pow(2,oe-1075)*(le+4503599627370496)}_.readDoubleLE=R.bind(null,w,0,4),_.readDoubleBE=R.bind(null,T,4,0)}(),_}function C(_,S,R){S[R]=_&255,S[R+1]=_>>>8&255,S[R+2]=_>>>16&255,S[R+3]=_>>>24}function E(_,S,R){S[R]=_>>>24,S[R+1]=_>>>16&255,S[R+2]=_>>>8&255,S[R+3]=_&255}function w(_,S){return(_[S]|_[S+1]<<8|_[S+2]<<16|_[S+3]<<24)>>>0}function T(_,S){return(_[S]<<24|_[S+1]<<16|_[S+2]<<8|_[S+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(x){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(x){var C=x;C.length=function(E){for(var w=0,T=0,_=0;_<E.length;++_)T=E.charCodeAt(_),T<128?w+=1:T<2048?w+=2:(T&64512)===55296&&(E.charCodeAt(_+1)&64512)===56320?(++_,w+=4):w+=3;return w},C.read=function(E,w,T){var _=T-w;if(_<1)return"";for(var S=null,R=[],A=0,O;w<T;)O=E[w++],O<128?R[A++]=O:O>191&&O<224?R[A++]=(O&31)<<6|E[w++]&63:O>239&&O<365?(O=((O&7)<<18|(E[w++]&63)<<12|(E[w++]&63)<<6|E[w++]&63)-65536,R[A++]=55296+(O>>10),R[A++]=56320+(O&1023)):R[A++]=(O&15)<<12|(E[w++]&63)<<6|E[w++]&63,A>8191&&((S||(S=[])).push(String.fromCharCode.apply(String,R)),A=0);return S?(A&&S.push(String.fromCharCode.apply(String,R.slice(0,A))),S.join("")):String.fromCharCode.apply(String,R.slice(0,A))},C.write=function(E,w,T){for(var _=T,S,R,A=0;A<E.length;++A)S=E.charCodeAt(A),S<128?w[T++]=S:S<2048?(w[T++]=S>>6|192,w[T++]=S&63|128):(S&64512)===55296&&((R=E.charCodeAt(A+1))&64512)===56320?(S=65536+((S&1023)<<10)+(R&1023),++A,w[T++]=S>>18|240,w[T++]=S>>12&63|128,w[T++]=S>>6&63|128,w[T++]=S&63|128):(w[T++]=S>>12|224,w[T++]=S>>6&63|128,w[T++]=S&63|128);return T-_}}(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=x;function x(C,E,w){var T=w||8192,_=T>>>1,S=null,R=T;return function(A){if(A<1||A>_)return C(A);R+A>T&&(S=C(T),R=0);var O=E.call(S,R,R+=A);return R&7&&(R=(R|7)+1),O}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=C;var x=requireMinimal$1();function C(_,S){this.lo=_>>>0,this.hi=S>>>0}var E=C.zero=new C(0,0);E.toNumber=function(){return 0},E.zzEncode=E.zzDecode=function(){return this},E.length=function(){return 1};var w=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(_){if(_===0)return E;var S=_<0;S&&(_=-_);var R=_>>>0,A=(_-R)/4294967296>>>0;return S&&(A=~A>>>0,R=~R>>>0,++R>4294967295&&(R=0,++A>4294967295&&(A=0))),new C(R,A)},C.from=function(_){if(typeof _=="number")return C.fromNumber(_);if(x.isString(_))if(x.Long)_=x.Long.fromString(_);else return C.fromNumber(parseInt(_,10));return _.low||_.high?new C(_.low>>>0,_.high>>>0):E},C.prototype.toNumber=function(_){if(!_&&this.hi>>>31){var S=~this.lo+1>>>0,R=~this.hi>>>0;return S||(R=R+1>>>0),-(S+R*4294967296)}return this.lo+this.hi*4294967296},C.prototype.toLong=function(_){return x.Long?new x.Long(this.lo|0,this.hi|0,!!_):{low:this.lo|0,high:this.hi|0,unsigned:!!_}};var T=String.prototype.charCodeAt;return C.fromHash=function(_){return _===w?E:new C((T.call(_,0)|T.call(_,1)<<8|T.call(_,2)<<16|T.call(_,3)<<24)>>>0,(T.call(_,4)|T.call(_,5)<<8|T.call(_,6)<<16|T.call(_,7)<<24)>>>0)},C.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},C.prototype.zzEncode=function(){var _=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^_)>>>0,this.lo=(this.lo<<1^_)>>>0,this},C.prototype.zzDecode=function(){var _=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^_)>>>0,this.hi=(this.hi>>>1^_)>>>0,this},C.prototype.length=function(){var _=this.lo,S=(this.lo>>>28|this.hi<<4)>>>0,R=this.hi>>>24;return R===0?S===0?_<16384?_<128?1:2:_<2097152?3:4:S<16384?S<128?5:6:S<2097152?7:8:R<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(x){var C=x;C.asPromise=requireAspromise(),C.base64=requireBase64(),C.EventEmitter=requireEventemitter(),C.float=requireFloat(),C.inquire=requireInquire(),C.utf8=requireUtf8(),C.pool=requirePool(),C.LongBits=requireLongbits(),C.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),C.global=C.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal$1,C.emptyArray=Object.freeze?Object.freeze([]):[],C.emptyObject=Object.freeze?Object.freeze({}):{},C.isInteger=Number.isInteger||function(T){return typeof T=="number"&&isFinite(T)&&Math.floor(T)===T},C.isString=function(T){return typeof T=="string"||T instanceof String},C.isObject=function(T){return T&&typeof T=="object"},C.isset=C.isSet=function(T,_){var S=T[_];return S!=null&&T.hasOwnProperty(_)?typeof S!="object"||(Array.isArray(S)?S.length:Object.keys(S).length)>0:!1},C.Buffer=function(){try{var T=C.inquire("buffer").Buffer;return T.prototype.utf8Write?T:null}catch{return null}}(),C._Buffer_from=null,C._Buffer_allocUnsafe=null,C.newBuffer=function(T){return typeof T=="number"?C.Buffer?C._Buffer_allocUnsafe(T):new C.Array(T):C.Buffer?C._Buffer_from(T):typeof Uint8Array>"u"?T:new Uint8Array(T)},C.Array=typeof Uint8Array<"u"?Uint8Array:Array,C.Long=C.global.dcodeIO&&C.global.dcodeIO.Long||C.global.Long||C.inquire("long"),C.key2Re=/^true|false|0|1$/,C.key32Re=/^-?(?:0|[1-9][0-9]*)$/,C.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,C.longToHash=function(T){return T?C.LongBits.from(T).toHash():C.LongBits.zeroHash},C.longFromHash=function(T,_){var S=C.LongBits.fromHash(T);return C.Long?C.Long.fromBits(S.lo,S.hi,_):S.toNumber(!!_)};function E(T,_,S){for(var R=Object.keys(_),A=0;A<R.length;++A)(T[R[A]]===void 0||!S)&&(T[R[A]]=_[R[A]]);return T}C.merge=E,C.lcFirst=function(T){return T.charAt(0).toLowerCase()+T.substring(1)};function w(T){function _(S,R){if(!(this instanceof _))return new _(S,R);Object.defineProperty(this,"message",{get:function(){return S}}),Error.captureStackTrace?Error.captureStackTrace(this,_):Object.defineProperty(this,"stack",{value:new Error().stack||""}),R&&E(this,R)}return _.prototype=Object.create(Error.prototype,{constructor:{value:_,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return T},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),_}C.newError=w,C.ProtocolError=w("ProtocolError"),C.oneOfGetter=function(T){for(var _={},S=0;S<T.length;++S)_[T[S]]=1;return function(){for(var R=Object.keys(this),A=R.length-1;A>-1;--A)if(_[R[A]]===1&&this[R[A]]!==void 0&&this[R[A]]!==null)return R[A]}},C.oneOfSetter=function(T){return function(_){for(var S=0;S<T.length;++S)T[S]!==_&&delete this[T[S]]}},C.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},C._configure=function(){var T=C.Buffer;if(!T){C._Buffer_from=C._Buffer_allocUnsafe=null;return}C._Buffer_from=T.from!==Uint8Array.from&&T.from||function(_,S){return new T(_,S)},C._Buffer_allocUnsafe=T.allocUnsafe||function(_){return new T(_)}}}(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=A;var x=requireMinimal$1(),C,E=x.LongBits,w=x.base64,T=x.utf8;function _(oe,le,fe){this.fn=oe,this.len=le,this.next=void 0,this.val=fe}function S(){}function R(oe){this.head=oe.head,this.tail=oe.tail,this.len=oe.len,this.next=oe.states}function A(){this.len=0,this.head=new _(S,0,0),this.tail=this.head,this.states=null}var O=function(){return x.Buffer?function(){return(A.create=function(){return new C})()}:function(){return new A}};A.create=O(),A.alloc=function(oe){return new x.Array(oe)},x.Array!==Array&&(A.alloc=x.pool(A.alloc,x.Array.prototype.subarray)),A.prototype._push=function(oe,le,fe){return this.tail=this.tail.next=new _(oe,le,fe),this.len+=le,this};function H(oe,le,fe){le[fe]=oe&255}function ee(oe,le,fe){for(;oe>127;)le[fe++]=oe&127|128,oe>>>=7;le[fe]=oe}function te(oe,le){this.len=oe,this.next=void 0,this.val=le}te.prototype=Object.create(_.prototype),te.prototype.fn=ee,A.prototype.uint32=function(oe){return this.len+=(this.tail=this.tail.next=new te((oe=oe>>>0)<128?1:oe<16384?2:oe<2097152?3:oe<268435456?4:5,oe)).len,this},A.prototype.int32=function(oe){return oe<0?this._push(ie,10,E.fromNumber(oe)):this.uint32(oe)},A.prototype.sint32=function(oe){return this.uint32((oe<<1^oe>>31)>>>0)};function ie(oe,le,fe){for(;oe.hi;)le[fe++]=oe.lo&127|128,oe.lo=(oe.lo>>>7|oe.hi<<25)>>>0,oe.hi>>>=7;for(;oe.lo>127;)le[fe++]=oe.lo&127|128,oe.lo=oe.lo>>>7;le[fe++]=oe.lo}A.prototype.uint64=function(oe){var le=E.from(oe);return this._push(ie,le.length(),le)},A.prototype.int64=A.prototype.uint64,A.prototype.sint64=function(oe){var le=E.from(oe).zzEncode();return this._push(ie,le.length(),le)},A.prototype.bool=function(oe){return this._push(H,1,oe?1:0)};function ne(oe,le,fe){le[fe]=oe&255,le[fe+1]=oe>>>8&255,le[fe+2]=oe>>>16&255,le[fe+3]=oe>>>24}A.prototype.fixed32=function(oe){return this._push(ne,4,oe>>>0)},A.prototype.sfixed32=A.prototype.fixed32,A.prototype.fixed64=function(oe){var le=E.from(oe);return this._push(ne,4,le.lo)._push(ne,4,le.hi)},A.prototype.sfixed64=A.prototype.fixed64,A.prototype.float=function(oe){return this._push(x.float.writeFloatLE,4,oe)},A.prototype.double=function(oe){return this._push(x.float.writeDoubleLE,8,oe)};var ae=x.Array.prototype.set?function(oe,le,fe){le.set(oe,fe)}:function(oe,le,fe){for(var de=0;de<oe.length;++de)le[fe+de]=oe[de]};return A.prototype.bytes=function(oe){var le=oe.length>>>0;if(!le)return this._push(H,1,0);if(x.isString(oe)){var fe=A.alloc(le=w.length(oe));w.decode(oe,fe,0),oe=fe}return this.uint32(le)._push(ae,le,oe)},A.prototype.string=function(oe){var le=T.length(oe);return le?this.uint32(le)._push(T.write,le,oe):this._push(H,1,0)},A.prototype.fork=function(){return this.states=new R(this),this.head=this.tail=new _(S,0,0),this.len=0,this},A.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new _(S,0,0),this.len=0),this},A.prototype.ldelim=function(){var oe=this.head,le=this.tail,fe=this.len;return this.reset().uint32(fe),fe&&(this.tail.next=oe.next,this.tail=le,this.len+=fe),this},A.prototype.finish=function(){for(var oe=this.head.next,le=this.constructor.alloc(this.len),fe=0;oe;)oe.fn(oe.val,le,fe),fe+=oe.len,oe=oe.next;return le},A._configure=function(oe){C=oe,A.create=O(),C._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=E;var x=requireWriter();(E.prototype=Object.create(x.prototype)).constructor=E;var C=requireMinimal$1();function E(){x.call(this)}E._configure=function(){E.alloc=C._Buffer_allocUnsafe,E.writeBytesBuffer=C.Buffer&&C.Buffer.prototype instanceof Uint8Array&&C.Buffer.prototype.set.name==="set"?function(T,_,S){_.set(T,S)}:function(T,_,S){if(T.copy)T.copy(_,S,0,T.length);else for(var R=0;R<T.length;)_[S++]=T[R++]}},E.prototype.bytes=function(T){C.isString(T)&&(T=C._Buffer_from(T,"base64"));var _=T.length>>>0;return this.uint32(_),_&&this._push(E.writeBytesBuffer,_,T),this};function w(T,_,S){T.length<40?C.utf8.write(T,_,S):_.utf8Write?_.utf8Write(T,S):_.write(T,S)}return E.prototype.string=function(T){var _=C.Buffer.byteLength(T);return this.uint32(_),_&&this._push(w,_,T),this},E._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=_;var x=requireMinimal$1(),C,E=x.LongBits,w=x.utf8;function T(ee,te){return RangeError("index out of range: "+ee.pos+" + "+(te||1)+" > "+ee.len)}function _(ee){this.buf=ee,this.pos=0,this.len=ee.length}var S=typeof Uint8Array<"u"?function(ee){if(ee instanceof Uint8Array||Array.isArray(ee))return new _(ee);throw Error("illegal buffer")}:function(ee){if(Array.isArray(ee))return new _(ee);throw Error("illegal buffer")},R=function(){return x.Buffer?function(ee){return(_.create=function(te){return x.Buffer.isBuffer(te)?new C(te):S(te)})(ee)}:S};_.create=R(),_.prototype._slice=x.Array.prototype.subarray||x.Array.prototype.slice,_.prototype.uint32=function(){var ee=4294967295;return function(){if(ee=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(ee=(ee|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(ee=(ee|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(ee=(ee|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(ee=(ee|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return ee;if((this.pos+=5)>this.len)throw this.pos=this.len,T(this,10);return ee}}(),_.prototype.int32=function(){return this.uint32()|0},_.prototype.sint32=function(){var ee=this.uint32();return ee>>>1^-(ee&1)|0};function A(){var ee=new E(0,0),te=0;if(this.len-this.pos>4){for(;te<4;++te)if(ee.lo=(ee.lo|(this.buf[this.pos]&127)<<te*7)>>>0,this.buf[this.pos++]<128)return ee;if(ee.lo=(ee.lo|(this.buf[this.pos]&127)<<28)>>>0,ee.hi=(ee.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return ee;te=0}else{for(;te<3;++te){if(this.pos>=this.len)throw T(this);if(ee.lo=(ee.lo|(this.buf[this.pos]&127)<<te*7)>>>0,this.buf[this.pos++]<128)return ee}return ee.lo=(ee.lo|(this.buf[this.pos++]&127)<<te*7)>>>0,ee}if(this.len-this.pos>4){for(;te<5;++te)if(ee.hi=(ee.hi|(this.buf[this.pos]&127)<<te*7+3)>>>0,this.buf[this.pos++]<128)return ee}else for(;te<5;++te){if(this.pos>=this.len)throw T(this);if(ee.hi=(ee.hi|(this.buf[this.pos]&127)<<te*7+3)>>>0,this.buf[this.pos++]<128)return ee}throw Error("invalid varint encoding")}_.prototype.bool=function(){return this.uint32()!==0};function O(ee,te){return(ee[te-4]|ee[te-3]<<8|ee[te-2]<<16|ee[te-1]<<24)>>>0}_.prototype.fixed32=function(){if(this.pos+4>this.len)throw T(this,4);return O(this.buf,this.pos+=4)},_.prototype.sfixed32=function(){if(this.pos+4>this.len)throw T(this,4);return O(this.buf,this.pos+=4)|0};function H(){if(this.pos+8>this.len)throw T(this,8);return new E(O(this.buf,this.pos+=4),O(this.buf,this.pos+=4))}return _.prototype.float=function(){if(this.pos+4>this.len)throw T(this,4);var ee=x.float.readFloatLE(this.buf,this.pos);return this.pos+=4,ee},_.prototype.double=function(){if(this.pos+8>this.len)throw T(this,4);var ee=x.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,ee},_.prototype.bytes=function(){var ee=this.uint32(),te=this.pos,ie=this.pos+ee;if(ie>this.len)throw T(this,ee);if(this.pos+=ee,Array.isArray(this.buf))return this.buf.slice(te,ie);if(te===ie){var ne=x.Buffer;return ne?ne.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,te,ie)},_.prototype.string=function(){var ee=this.bytes();return w.read(ee,0,ee.length)},_.prototype.skip=function(ee){if(typeof ee=="number"){if(this.pos+ee>this.len)throw T(this,ee);this.pos+=ee}else do if(this.pos>=this.len)throw T(this);while(this.buf[this.pos++]&128);return this},_.prototype.skipType=function(ee){switch(ee){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(ee=this.uint32()&7)!==4;)this.skipType(ee);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+ee+" at offset "+this.pos)}return this},_._configure=function(ee){C=ee,_.create=R(),C._configure();var te=x.Long?"toLong":"toNumber";x.merge(_.prototype,{int64:function(){return A.call(this)[te](!1)},uint64:function(){return A.call(this)[te](!0)},sint64:function(){return A.call(this).zzDecode()[te](!1)},fixed64:function(){return H.call(this)[te](!0)},sfixed64:function(){return H.call(this)[te](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=E;var x=requireReader();(E.prototype=Object.create(x.prototype)).constructor=E;var C=requireMinimal$1();function E(w){x.call(this,w)}return E._configure=function(){C.Buffer&&(E.prototype._slice=C.Buffer.prototype.slice)},E.prototype.string=function(){var w=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+w,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+w,this.len))},E._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=C;var x=requireMinimal$1();(C.prototype=Object.create(x.EventEmitter.prototype)).constructor=C;function C(E,w,T){if(typeof E!="function")throw TypeError("rpcImpl must be a function");x.EventEmitter.call(this),this.rpcImpl=E,this.requestDelimited=!!w,this.responseDelimited=!!T}return C.prototype.rpcCall=function E(w,T,_,S,R){if(!S)throw TypeError("request must be specified");var A=this;if(!R)return x.asPromise(E,A,w,T,_,S);if(!A.rpcImpl){setTimeout(function(){R(Error("already ended"))},0);return}try{return A.rpcImpl(w,T[A.requestDelimited?"encodeDelimited":"encode"](S).finish(),function(O,H){if(O)return A.emit("error",O,w),R(O);if(H===null){A.end(!0);return}if(!(H instanceof _))try{H=_[A.responseDelimited?"decodeDelimited":"decode"](H)}catch(ee){return A.emit("error",ee,w),R(ee)}return A.emit("data",H,w),R(null,H)})}catch(O){A.emit("error",O,w),setTimeout(function(){R(O)},0);return}},C.prototype.end=function(E){return this.rpcImpl&&(E||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(x){var C=x;C.Service=requireService()}(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(x){var C=x;C.build="minimal",C.Writer=requireWriter(),C.BufferWriter=requireWriter_buffer(),C.Reader=requireReader(),C.BufferReader=requireReader_buffer(),C.util=requireMinimal$1(),C.rpc=requireRpc(),C.roots=requireRoots(),C.configure=E;function E(){C.util._configure(),C.Writer._configure(C.BufferWriter),C.Reader._configure(C.BufferReader)}E()}(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var SignalingProtocol,hasRequiredSignalingProtocol;function requireSignalingProtocol(){if(hasRequiredSignalingProtocol)return SignalingProtocol;hasRequiredSignalingProtocol=1;var x=requireMinimal(),C=x.Reader,E=x.Writer,w=x.util,T=x.roots.default||(x.roots.default={});return T.SdkSignalFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.timestampMs=w.Long?w.Long.fromBits(0,0,!0):0,_.prototype.type=1,_.prototype.error=null,_.prototype.join=null,_.prototype.joinack=null,_.prototype.sub=null,_.prototype.suback=null,_.prototype.index=null,_.prototype.pause=null,_.prototype.leave=null,_.prototype.leaveAck=null,_.prototype.bitrates=null,_.prototype.audioControl=null,_.prototype.audioMetadata=null,_.prototype.audioStreamIdInfo=null,_.prototype.pingPong=null,_.prototype.audioStatus=null,_.prototype.clientMetric=null,_.prototype.dataMessage=null,_.prototype.remoteVideoUpdate=null,_.prototype.primaryMeetingJoin=null,_.prototype.primaryMeetingJoinAck=null,_.prototype.primaryMeetingLeave=null,_.prototype.notification=null,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R.uint32(8).uint64(S.timestampMs),R.uint32(16).int32(S.type),S.error!=null&&Object.hasOwnProperty.call(S,"error")&&T.SdkErrorFrame.encode(S.error,R.uint32(26).fork()).ldelim(),S.join!=null&&Object.hasOwnProperty.call(S,"join")&&T.SdkJoinFrame.encode(S.join,R.uint32(34).fork()).ldelim(),S.joinack!=null&&Object.hasOwnProperty.call(S,"joinack")&&T.SdkJoinAckFrame.encode(S.joinack,R.uint32(42).fork()).ldelim(),S.sub!=null&&Object.hasOwnProperty.call(S,"sub")&&T.SdkSubscribeFrame.encode(S.sub,R.uint32(50).fork()).ldelim(),S.suback!=null&&Object.hasOwnProperty.call(S,"suback")&&T.SdkSubscribeAckFrame.encode(S.suback,R.uint32(58).fork()).ldelim(),S.index!=null&&Object.hasOwnProperty.call(S,"index")&&T.SdkIndexFrame.encode(S.index,R.uint32(66).fork()).ldelim(),S.pause!=null&&Object.hasOwnProperty.call(S,"pause")&&T.SdkPauseResumeFrame.encode(S.pause,R.uint32(82).fork()).ldelim(),S.leave!=null&&Object.hasOwnProperty.call(S,"leave")&&T.SdkLeaveFrame.encode(S.leave,R.uint32(90).fork()).ldelim(),S.leaveAck!=null&&Object.hasOwnProperty.call(S,"leaveAck")&&T.SdkLeaveAckFrame.encode(S.leaveAck,R.uint32(98).fork()).ldelim(),S.bitrates!=null&&Object.hasOwnProperty.call(S,"bitrates")&&T.SdkBitrateFrame.encode(S.bitrates,R.uint32(114).fork()).ldelim(),S.audioControl!=null&&Object.hasOwnProperty.call(S,"audioControl")&&T.SdkAudioControlFrame.encode(S.audioControl,R.uint32(138).fork()).ldelim(),S.audioMetadata!=null&&Object.hasOwnProperty.call(S,"audioMetadata")&&T.SdkAudioMetadataFrame.encode(S.audioMetadata,R.uint32(146).fork()).ldelim(),S.audioStreamIdInfo!=null&&Object.hasOwnProperty.call(S,"audioStreamIdInfo")&&T.SdkAudioStreamIdInfoFrame.encode(S.audioStreamIdInfo,R.uint32(154).fork()).ldelim(),S.pingPong!=null&&Object.hasOwnProperty.call(S,"pingPong")&&T.SdkPingPongFrame.encode(S.pingPong,R.uint32(162).fork()).ldelim(),S.audioStatus!=null&&Object.hasOwnProperty.call(S,"audioStatus")&&T.SdkAudioStatusFrame.encode(S.audioStatus,R.uint32(170).fork()).ldelim(),S.clientMetric!=null&&Object.hasOwnProperty.call(S,"clientMetric")&&T.SdkClientMetricFrame.encode(S.clientMetric,R.uint32(178).fork()).ldelim(),S.dataMessage!=null&&Object.hasOwnProperty.call(S,"dataMessage")&&T.SdkDataMessageFrame.encode(S.dataMessage,R.uint32(186).fork()).ldelim(),S.remoteVideoUpdate!=null&&Object.hasOwnProperty.call(S,"remoteVideoUpdate")&&T.SdkRemoteVideoUpdateFrame.encode(S.remoteVideoUpdate,R.uint32(202).fork()).ldelim(),S.primaryMeetingJoin!=null&&Object.hasOwnProperty.call(S,"primaryMeetingJoin")&&T.SdkPrimaryMeetingJoinFrame.encode(S.primaryMeetingJoin,R.uint32(210).fork()).ldelim(),S.primaryMeetingJoinAck!=null&&Object.hasOwnProperty.call(S,"primaryMeetingJoinAck")&&T.SdkPrimaryMeetingJoinAckFrame.encode(S.primaryMeetingJoinAck,R.uint32(218).fork()).ldelim(),S.primaryMeetingLeave!=null&&Object.hasOwnProperty.call(S,"primaryMeetingLeave")&&T.SdkPrimaryMeetingLeaveFrame.encode(S.primaryMeetingLeave,R.uint32(226).fork()).ldelim(),S.notification!=null&&Object.hasOwnProperty.call(S,"notification")&&T.SdkNotificationFrame.encode(S.notification,R.uint32(282).fork()).ldelim(),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkSignalFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.timestampMs=S.uint64();break}case 2:{O.type=S.int32();break}case 3:{O.error=T.SdkErrorFrame.decode(S,S.uint32());break}case 4:{O.join=T.SdkJoinFrame.decode(S,S.uint32());break}case 5:{O.joinack=T.SdkJoinAckFrame.decode(S,S.uint32());break}case 6:{O.sub=T.SdkSubscribeFrame.decode(S,S.uint32());break}case 7:{O.suback=T.SdkSubscribeAckFrame.decode(S,S.uint32());break}case 8:{O.index=T.SdkIndexFrame.decode(S,S.uint32());break}case 10:{O.pause=T.SdkPauseResumeFrame.decode(S,S.uint32());break}case 11:{O.leave=T.SdkLeaveFrame.decode(S,S.uint32());break}case 12:{O.leaveAck=T.SdkLeaveAckFrame.decode(S,S.uint32());break}case 14:{O.bitrates=T.SdkBitrateFrame.decode(S,S.uint32());break}case 17:{O.audioControl=T.SdkAudioControlFrame.decode(S,S.uint32());break}case 18:{O.audioMetadata=T.SdkAudioMetadataFrame.decode(S,S.uint32());break}case 19:{O.audioStreamIdInfo=T.SdkAudioStreamIdInfoFrame.decode(S,S.uint32());break}case 20:{O.pingPong=T.SdkPingPongFrame.decode(S,S.uint32());break}case 21:{O.audioStatus=T.SdkAudioStatusFrame.decode(S,S.uint32());break}case 22:{O.clientMetric=T.SdkClientMetricFrame.decode(S,S.uint32());break}case 23:{O.dataMessage=T.SdkDataMessageFrame.decode(S,S.uint32());break}case 25:{O.remoteVideoUpdate=T.SdkRemoteVideoUpdateFrame.decode(S,S.uint32());break}case 26:{O.primaryMeetingJoin=T.SdkPrimaryMeetingJoinFrame.decode(S,S.uint32());break}case 27:{O.primaryMeetingJoinAck=T.SdkPrimaryMeetingJoinAckFrame.decode(S,S.uint32());break}case 28:{O.primaryMeetingLeave=T.SdkPrimaryMeetingLeaveFrame.decode(S,S.uint32());break}case 35:{O.notification=T.SdkNotificationFrame.decode(S,S.uint32());break}default:S.skipType(H&7);break}}if(!O.hasOwnProperty("timestampMs"))throw w.ProtocolError("missing required 'timestampMs'",{instance:O});if(!O.hasOwnProperty("type"))throw w.ProtocolError("missing required 'type'",{instance:O});return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(!w.isInteger(S.timestampMs)&&!(S.timestampMs&&w.isInteger(S.timestampMs.low)&&w.isInteger(S.timestampMs.high)))return"timestampMs: integer|Long expected";switch(S.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 34:break}if(S.error!=null&&S.hasOwnProperty("error")){var R=T.SdkErrorFrame.verify(S.error);if(R)return"error."+R}if(S.join!=null&&S.hasOwnProperty("join")){var R=T.SdkJoinFrame.verify(S.join);if(R)return"join."+R}if(S.joinack!=null&&S.hasOwnProperty("joinack")){var R=T.SdkJoinAckFrame.verify(S.joinack);if(R)return"joinack."+R}if(S.sub!=null&&S.hasOwnProperty("sub")){var R=T.SdkSubscribeFrame.verify(S.sub);if(R)return"sub."+R}if(S.suback!=null&&S.hasOwnProperty("suback")){var R=T.SdkSubscribeAckFrame.verify(S.suback);if(R)return"suback."+R}if(S.index!=null&&S.hasOwnProperty("index")){var R=T.SdkIndexFrame.verify(S.index);if(R)return"index."+R}if(S.pause!=null&&S.hasOwnProperty("pause")){var R=T.SdkPauseResumeFrame.verify(S.pause);if(R)return"pause."+R}if(S.leave!=null&&S.hasOwnProperty("leave")){var R=T.SdkLeaveFrame.verify(S.leave);if(R)return"leave."+R}if(S.leaveAck!=null&&S.hasOwnProperty("leaveAck")){var R=T.SdkLeaveAckFrame.verify(S.leaveAck);if(R)return"leaveAck."+R}if(S.bitrates!=null&&S.hasOwnProperty("bitrates")){var R=T.SdkBitrateFrame.verify(S.bitrates);if(R)return"bitrates."+R}if(S.audioControl!=null&&S.hasOwnProperty("audioControl")){var R=T.SdkAudioControlFrame.verify(S.audioControl);if(R)return"audioControl."+R}if(S.audioMetadata!=null&&S.hasOwnProperty("audioMetadata")){var R=T.SdkAudioMetadataFrame.verify(S.audioMetadata);if(R)return"audioMetadata."+R}if(S.audioStreamIdInfo!=null&&S.hasOwnProperty("audioStreamIdInfo")){var R=T.SdkAudioStreamIdInfoFrame.verify(S.audioStreamIdInfo);if(R)return"audioStreamIdInfo."+R}if(S.pingPong!=null&&S.hasOwnProperty("pingPong")){var R=T.SdkPingPongFrame.verify(S.pingPong);if(R)return"pingPong."+R}if(S.audioStatus!=null&&S.hasOwnProperty("audioStatus")){var R=T.SdkAudioStatusFrame.verify(S.audioStatus);if(R)return"audioStatus."+R}if(S.clientMetric!=null&&S.hasOwnProperty("clientMetric")){var R=T.SdkClientMetricFrame.verify(S.clientMetric);if(R)return"clientMetric."+R}if(S.dataMessage!=null&&S.hasOwnProperty("dataMessage")){var R=T.SdkDataMessageFrame.verify(S.dataMessage);if(R)return"dataMessage."+R}if(S.remoteVideoUpdate!=null&&S.hasOwnProperty("remoteVideoUpdate")){var R=T.SdkRemoteVideoUpdateFrame.verify(S.remoteVideoUpdate);if(R)return"remoteVideoUpdate."+R}if(S.primaryMeetingJoin!=null&&S.hasOwnProperty("primaryMeetingJoin")){var R=T.SdkPrimaryMeetingJoinFrame.verify(S.primaryMeetingJoin);if(R)return"primaryMeetingJoin."+R}if(S.primaryMeetingJoinAck!=null&&S.hasOwnProperty("primaryMeetingJoinAck")){var R=T.SdkPrimaryMeetingJoinAckFrame.verify(S.primaryMeetingJoinAck);if(R)return"primaryMeetingJoinAck."+R}if(S.primaryMeetingLeave!=null&&S.hasOwnProperty("primaryMeetingLeave")){var R=T.SdkPrimaryMeetingLeaveFrame.verify(S.primaryMeetingLeave);if(R)return"primaryMeetingLeave."+R}if(S.notification!=null&&S.hasOwnProperty("notification")){var R=T.SdkNotificationFrame.verify(S.notification);if(R)return"notification."+R}return null},_.fromObject=function(S){if(S instanceof T.SdkSignalFrame)return S;var R=new T.SdkSignalFrame;switch(S.timestampMs!=null&&(w.Long?(R.timestampMs=w.Long.fromValue(S.timestampMs)).unsigned=!0:typeof S.timestampMs=="string"?R.timestampMs=parseInt(S.timestampMs,10):typeof S.timestampMs=="number"?R.timestampMs=S.timestampMs:typeof S.timestampMs=="object"&&(R.timestampMs=new w.LongBits(S.timestampMs.low>>>0,S.timestampMs.high>>>0).toNumber(!0))),S.type){default:if(typeof S.type=="number"){R.type=S.type;break}break;case"JOIN":case 1:R.type=1;break;case"JOIN_ACK":case 2:R.type=2;break;case"SUBSCRIBE":case 3:R.type=3;break;case"SUBSCRIBE_ACK":case 4:R.type=4;break;case"INDEX":case 5:R.type=5;break;case"PAUSE":case 7:R.type=7;break;case"RESUME":case 8:R.type=8;break;case"LEAVE":case 9:R.type=9;break;case"LEAVE_ACK":case 10:R.type=10;break;case"BITRATES":case 13:R.type=13;break;case"AUDIO_CONTROL":case 16:R.type=16;break;case"AUDIO_METADATA":case 17:R.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:R.type=18;break;case"PING_PONG":case 19:R.type=19;break;case"AUDIO_STATUS":case 20:R.type=20;break;case"CLIENT_METRIC":case 21:R.type=21;break;case"DATA_MESSAGE":case 22:R.type=22;break;case"REMOTE_VIDEO_UPDATE":case 24:R.type=24;break;case"PRIMARY_MEETING_JOIN":case 25:R.type=25;break;case"PRIMARY_MEETING_JOIN_ACK":case 26:R.type=26;break;case"PRIMARY_MEETING_LEAVE":case 27:R.type=27;break;case"NOTIFICATION":case 34:R.type=34;break}if(S.error!=null){if(typeof S.error!="object")throw TypeError(".SdkSignalFrame.error: object expected");R.error=T.SdkErrorFrame.fromObject(S.error)}if(S.join!=null){if(typeof S.join!="object")throw TypeError(".SdkSignalFrame.join: object expected");R.join=T.SdkJoinFrame.fromObject(S.join)}if(S.joinack!=null){if(typeof S.joinack!="object")throw TypeError(".SdkSignalFrame.joinack: object expected");R.joinack=T.SdkJoinAckFrame.fromObject(S.joinack)}if(S.sub!=null){if(typeof S.sub!="object")throw TypeError(".SdkSignalFrame.sub: object expected");R.sub=T.SdkSubscribeFrame.fromObject(S.sub)}if(S.suback!=null){if(typeof S.suback!="object")throw TypeError(".SdkSignalFrame.suback: object expected");R.suback=T.SdkSubscribeAckFrame.fromObject(S.suback)}if(S.index!=null){if(typeof S.index!="object")throw TypeError(".SdkSignalFrame.index: object expected");R.index=T.SdkIndexFrame.fromObject(S.index)}if(S.pause!=null){if(typeof S.pause!="object")throw TypeError(".SdkSignalFrame.pause: object expected");R.pause=T.SdkPauseResumeFrame.fromObject(S.pause)}if(S.leave!=null){if(typeof S.leave!="object")throw TypeError(".SdkSignalFrame.leave: object expected");R.leave=T.SdkLeaveFrame.fromObject(S.leave)}if(S.leaveAck!=null){if(typeof S.leaveAck!="object")throw TypeError(".SdkSignalFrame.leaveAck: object expected");R.leaveAck=T.SdkLeaveAckFrame.fromObject(S.leaveAck)}if(S.bitrates!=null){if(typeof S.bitrates!="object")throw TypeError(".SdkSignalFrame.bitrates: object expected");R.bitrates=T.SdkBitrateFrame.fromObject(S.bitrates)}if(S.audioControl!=null){if(typeof S.audioControl!="object")throw TypeError(".SdkSignalFrame.audioControl: object expected");R.audioControl=T.SdkAudioControlFrame.fromObject(S.audioControl)}if(S.audioMetadata!=null){if(typeof S.audioMetadata!="object")throw TypeError(".SdkSignalFrame.audioMetadata: object expected");R.audioMetadata=T.SdkAudioMetadataFrame.fromObject(S.audioMetadata)}if(S.audioStreamIdInfo!=null){if(typeof S.audioStreamIdInfo!="object")throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");R.audioStreamIdInfo=T.SdkAudioStreamIdInfoFrame.fromObject(S.audioStreamIdInfo)}if(S.pingPong!=null){if(typeof S.pingPong!="object")throw TypeError(".SdkSignalFrame.pingPong: object expected");R.pingPong=T.SdkPingPongFrame.fromObject(S.pingPong)}if(S.audioStatus!=null){if(typeof S.audioStatus!="object")throw TypeError(".SdkSignalFrame.audioStatus: object expected");R.audioStatus=T.SdkAudioStatusFrame.fromObject(S.audioStatus)}if(S.clientMetric!=null){if(typeof S.clientMetric!="object")throw TypeError(".SdkSignalFrame.clientMetric: object expected");R.clientMetric=T.SdkClientMetricFrame.fromObject(S.clientMetric)}if(S.dataMessage!=null){if(typeof S.dataMessage!="object")throw TypeError(".SdkSignalFrame.dataMessage: object expected");R.dataMessage=T.SdkDataMessageFrame.fromObject(S.dataMessage)}if(S.remoteVideoUpdate!=null){if(typeof S.remoteVideoUpdate!="object")throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");R.remoteVideoUpdate=T.SdkRemoteVideoUpdateFrame.fromObject(S.remoteVideoUpdate)}if(S.primaryMeetingJoin!=null){if(typeof S.primaryMeetingJoin!="object")throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");R.primaryMeetingJoin=T.SdkPrimaryMeetingJoinFrame.fromObject(S.primaryMeetingJoin)}if(S.primaryMeetingJoinAck!=null){if(typeof S.primaryMeetingJoinAck!="object")throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");R.primaryMeetingJoinAck=T.SdkPrimaryMeetingJoinAckFrame.fromObject(S.primaryMeetingJoinAck)}if(S.primaryMeetingLeave!=null){if(typeof S.primaryMeetingLeave!="object")throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");R.primaryMeetingLeave=T.SdkPrimaryMeetingLeaveFrame.fromObject(S.primaryMeetingLeave)}if(S.notification!=null){if(typeof S.notification!="object")throw TypeError(".SdkSignalFrame.notification: object expected");R.notification=T.SdkNotificationFrame.fromObject(S.notification)}return R},_.toObject=function(S,R){R||(R={});var A={};if(R.defaults){if(w.Long){var O=new w.Long(0,0,!0);A.timestampMs=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.timestampMs=R.longs===String?"0":0;A.type=R.enums===String?"JOIN":1,A.error=null,A.join=null,A.joinack=null,A.sub=null,A.suback=null,A.index=null,A.pause=null,A.leave=null,A.leaveAck=null,A.bitrates=null,A.audioControl=null,A.audioMetadata=null,A.audioStreamIdInfo=null,A.pingPong=null,A.audioStatus=null,A.clientMetric=null,A.dataMessage=null,A.remoteVideoUpdate=null,A.primaryMeetingJoin=null,A.primaryMeetingJoinAck=null,A.primaryMeetingLeave=null,A.notification=null}return S.timestampMs!=null&&S.hasOwnProperty("timestampMs")&&(typeof S.timestampMs=="number"?A.timestampMs=R.longs===String?String(S.timestampMs):S.timestampMs:A.timestampMs=R.longs===String?w.Long.prototype.toString.call(S.timestampMs):R.longs===Number?new w.LongBits(S.timestampMs.low>>>0,S.timestampMs.high>>>0).toNumber(!0):S.timestampMs),S.type!=null&&S.hasOwnProperty("type")&&(A.type=R.enums===String?T.SdkSignalFrame.Type[S.type]===void 0?S.type:T.SdkSignalFrame.Type[S.type]:S.type),S.error!=null&&S.hasOwnProperty("error")&&(A.error=T.SdkErrorFrame.toObject(S.error,R)),S.join!=null&&S.hasOwnProperty("join")&&(A.join=T.SdkJoinFrame.toObject(S.join,R)),S.joinack!=null&&S.hasOwnProperty("joinack")&&(A.joinack=T.SdkJoinAckFrame.toObject(S.joinack,R)),S.sub!=null&&S.hasOwnProperty("sub")&&(A.sub=T.SdkSubscribeFrame.toObject(S.sub,R)),S.suback!=null&&S.hasOwnProperty("suback")&&(A.suback=T.SdkSubscribeAckFrame.toObject(S.suback,R)),S.index!=null&&S.hasOwnProperty("index")&&(A.index=T.SdkIndexFrame.toObject(S.index,R)),S.pause!=null&&S.hasOwnProperty("pause")&&(A.pause=T.SdkPauseResumeFrame.toObject(S.pause,R)),S.leave!=null&&S.hasOwnProperty("leave")&&(A.leave=T.SdkLeaveFrame.toObject(S.leave,R)),S.leaveAck!=null&&S.hasOwnProperty("leaveAck")&&(A.leaveAck=T.SdkLeaveAckFrame.toObject(S.leaveAck,R)),S.bitrates!=null&&S.hasOwnProperty("bitrates")&&(A.bitrates=T.SdkBitrateFrame.toObject(S.bitrates,R)),S.audioControl!=null&&S.hasOwnProperty("audioControl")&&(A.audioControl=T.SdkAudioControlFrame.toObject(S.audioControl,R)),S.audioMetadata!=null&&S.hasOwnProperty("audioMetadata")&&(A.audioMetadata=T.SdkAudioMetadataFrame.toObject(S.audioMetadata,R)),S.audioStreamIdInfo!=null&&S.hasOwnProperty("audioStreamIdInfo")&&(A.audioStreamIdInfo=T.SdkAudioStreamIdInfoFrame.toObject(S.audioStreamIdInfo,R)),S.pingPong!=null&&S.hasOwnProperty("pingPong")&&(A.pingPong=T.SdkPingPongFrame.toObject(S.pingPong,R)),S.audioStatus!=null&&S.hasOwnProperty("audioStatus")&&(A.audioStatus=T.SdkAudioStatusFrame.toObject(S.audioStatus,R)),S.clientMetric!=null&&S.hasOwnProperty("clientMetric")&&(A.clientMetric=T.SdkClientMetricFrame.toObject(S.clientMetric,R)),S.dataMessage!=null&&S.hasOwnProperty("dataMessage")&&(A.dataMessage=T.SdkDataMessageFrame.toObject(S.dataMessage,R)),S.remoteVideoUpdate!=null&&S.hasOwnProperty("remoteVideoUpdate")&&(A.remoteVideoUpdate=T.SdkRemoteVideoUpdateFrame.toObject(S.remoteVideoUpdate,R)),S.primaryMeetingJoin!=null&&S.hasOwnProperty("primaryMeetingJoin")&&(A.primaryMeetingJoin=T.SdkPrimaryMeetingJoinFrame.toObject(S.primaryMeetingJoin,R)),S.primaryMeetingJoinAck!=null&&S.hasOwnProperty("primaryMeetingJoinAck")&&(A.primaryMeetingJoinAck=T.SdkPrimaryMeetingJoinAckFrame.toObject(S.primaryMeetingJoinAck,R)),S.primaryMeetingLeave!=null&&S.hasOwnProperty("primaryMeetingLeave")&&(A.primaryMeetingLeave=T.SdkPrimaryMeetingLeaveFrame.toObject(S.primaryMeetingLeave,R)),S.notification!=null&&S.hasOwnProperty("notification")&&(A.notification=T.SdkNotificationFrame.toObject(S.notification,R)),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkSignalFrame"},_.Type=function(){var S={},R=Object.create(S);return R[S[1]="JOIN"]=1,R[S[2]="JOIN_ACK"]=2,R[S[3]="SUBSCRIBE"]=3,R[S[4]="SUBSCRIBE_ACK"]=4,R[S[5]="INDEX"]=5,R[S[7]="PAUSE"]=7,R[S[8]="RESUME"]=8,R[S[9]="LEAVE"]=9,R[S[10]="LEAVE_ACK"]=10,R[S[13]="BITRATES"]=13,R[S[16]="AUDIO_CONTROL"]=16,R[S[17]="AUDIO_METADATA"]=17,R[S[18]="AUDIO_STREAM_ID_INFO"]=18,R[S[19]="PING_PONG"]=19,R[S[20]="AUDIO_STATUS"]=20,R[S[21]="CLIENT_METRIC"]=21,R[S[22]="DATA_MESSAGE"]=22,R[S[24]="REMOTE_VIDEO_UPDATE"]=24,R[S[25]="PRIMARY_MEETING_JOIN"]=25,R[S[26]="PRIMARY_MEETING_JOIN_ACK"]=26,R[S[27]="PRIMARY_MEETING_LEAVE"]=27,R[S[34]="NOTIFICATION"]=34,R}(),_}(),T.SdkErrorFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.status=0,_.prototype.description="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.status!=null&&Object.hasOwnProperty.call(S,"status")&&R.uint32(8).uint32(S.status),S.description!=null&&Object.hasOwnProperty.call(S,"description")&&R.uint32(18).string(S.description),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkErrorFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.status=S.uint32();break}case 2:{O.description=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.status!=null&&S.hasOwnProperty("status")&&!w.isInteger(S.status)?"status: integer expected":S.description!=null&&S.hasOwnProperty("description")&&!w.isString(S.description)?"description: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkErrorFrame)return S;var R=new T.SdkErrorFrame;return S.status!=null&&(R.status=S.status>>>0),S.description!=null&&(R.description=String(S.description)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.status=0,A.description=""),S.status!=null&&S.hasOwnProperty("status")&&(A.status=S.status),S.description!=null&&S.hasOwnProperty("description")&&(A.description=S.description),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkErrorFrame"},_}(),T.SdkJoinFlags=function(){var _={},S=Object.create(_);return S[_[2]="HAS_STREAM_UPDATE"]=2,S[_[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,S[_[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,S}(),T.SdkClientDetails=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.appName="",_.prototype.appVersion="",_.prototype.deviceModel="",_.prototype.deviceMake="",_.prototype.platformName="",_.prototype.platformVersion="",_.prototype.clientSource="",_.prototype.chimeSdkVersion="",_.prototype.clientUtcOffset="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.appName!=null&&Object.hasOwnProperty.call(S,"appName")&&R.uint32(10).string(S.appName),S.appVersion!=null&&Object.hasOwnProperty.call(S,"appVersion")&&R.uint32(18).string(S.appVersion),S.deviceModel!=null&&Object.hasOwnProperty.call(S,"deviceModel")&&R.uint32(26).string(S.deviceModel),S.deviceMake!=null&&Object.hasOwnProperty.call(S,"deviceMake")&&R.uint32(34).string(S.deviceMake),S.platformName!=null&&Object.hasOwnProperty.call(S,"platformName")&&R.uint32(42).string(S.platformName),S.platformVersion!=null&&Object.hasOwnProperty.call(S,"platformVersion")&&R.uint32(50).string(S.platformVersion),S.clientSource!=null&&Object.hasOwnProperty.call(S,"clientSource")&&R.uint32(58).string(S.clientSource),S.chimeSdkVersion!=null&&Object.hasOwnProperty.call(S,"chimeSdkVersion")&&R.uint32(66).string(S.chimeSdkVersion),S.clientUtcOffset!=null&&Object.hasOwnProperty.call(S,"clientUtcOffset")&&R.uint32(74).string(S.clientUtcOffset),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkClientDetails;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.appName=S.string();break}case 2:{O.appVersion=S.string();break}case 3:{O.deviceModel=S.string();break}case 4:{O.deviceMake=S.string();break}case 5:{O.platformName=S.string();break}case 6:{O.platformVersion=S.string();break}case 7:{O.clientSource=S.string();break}case 8:{O.chimeSdkVersion=S.string();break}case 9:{O.clientUtcOffset=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.appName!=null&&S.hasOwnProperty("appName")&&!w.isString(S.appName)?"appName: string expected":S.appVersion!=null&&S.hasOwnProperty("appVersion")&&!w.isString(S.appVersion)?"appVersion: string expected":S.deviceModel!=null&&S.hasOwnProperty("deviceModel")&&!w.isString(S.deviceModel)?"deviceModel: string expected":S.deviceMake!=null&&S.hasOwnProperty("deviceMake")&&!w.isString(S.deviceMake)?"deviceMake: string expected":S.platformName!=null&&S.hasOwnProperty("platformName")&&!w.isString(S.platformName)?"platformName: string expected":S.platformVersion!=null&&S.hasOwnProperty("platformVersion")&&!w.isString(S.platformVersion)?"platformVersion: string expected":S.clientSource!=null&&S.hasOwnProperty("clientSource")&&!w.isString(S.clientSource)?"clientSource: string expected":S.chimeSdkVersion!=null&&S.hasOwnProperty("chimeSdkVersion")&&!w.isString(S.chimeSdkVersion)?"chimeSdkVersion: string expected":S.clientUtcOffset!=null&&S.hasOwnProperty("clientUtcOffset")&&!w.isString(S.clientUtcOffset)?"clientUtcOffset: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkClientDetails)return S;var R=new T.SdkClientDetails;return S.appName!=null&&(R.appName=String(S.appName)),S.appVersion!=null&&(R.appVersion=String(S.appVersion)),S.deviceModel!=null&&(R.deviceModel=String(S.deviceModel)),S.deviceMake!=null&&(R.deviceMake=String(S.deviceMake)),S.platformName!=null&&(R.platformName=String(S.platformName)),S.platformVersion!=null&&(R.platformVersion=String(S.platformVersion)),S.clientSource!=null&&(R.clientSource=String(S.clientSource)),S.chimeSdkVersion!=null&&(R.chimeSdkVersion=String(S.chimeSdkVersion)),S.clientUtcOffset!=null&&(R.clientUtcOffset=String(S.clientUtcOffset)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.appName="",A.appVersion="",A.deviceModel="",A.deviceMake="",A.platformName="",A.platformVersion="",A.clientSource="",A.chimeSdkVersion="",A.clientUtcOffset=""),S.appName!=null&&S.hasOwnProperty("appName")&&(A.appName=S.appName),S.appVersion!=null&&S.hasOwnProperty("appVersion")&&(A.appVersion=S.appVersion),S.deviceModel!=null&&S.hasOwnProperty("deviceModel")&&(A.deviceModel=S.deviceModel),S.deviceMake!=null&&S.hasOwnProperty("deviceMake")&&(A.deviceMake=S.deviceMake),S.platformName!=null&&S.hasOwnProperty("platformName")&&(A.platformName=S.platformName),S.platformVersion!=null&&S.hasOwnProperty("platformVersion")&&(A.platformVersion=S.platformVersion),S.clientSource!=null&&S.hasOwnProperty("clientSource")&&(A.clientSource=S.clientSource),S.chimeSdkVersion!=null&&S.hasOwnProperty("chimeSdkVersion")&&(A.chimeSdkVersion=S.chimeSdkVersion),S.clientUtcOffset!=null&&S.hasOwnProperty("clientUtcOffset")&&(A.clientUtcOffset=S.clientUtcOffset),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkClientDetails"},_}(),T.SdkServerSideNetworkAdaption=function(){var _={},S=Object.create(_);return S[_[1]="DEFAULT"]=1,S[_[2]="NONE"]=2,S[_[3]="BANDWIDTH_PROBING"]=3,S[_[4]="BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION"]=4,S}(),T.SdkJoinFrame=function(){function _(S){if(this.supportedServerSideNetworkAdaptions=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.protocolVersion=2,_.prototype.maxNumOfVideos=0,_.prototype.flags=0,_.prototype.clientDetails=null,_.prototype.audioSessionId=w.Long?w.Long.fromBits(0,0,!0):0,_.prototype.wantsCompressedSdp=!1,_.prototype.serverSideNetworkAdaption=1,_.prototype.supportedServerSideNetworkAdaptions=w.emptyArray,_.prototype.wantsAllTemporalLayersInIndex=!1,_.prototype.disablePeriodicKeyframeRequestOnContentSender=!1,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.protocolVersion!=null&&Object.hasOwnProperty.call(S,"protocolVersion")&&R.uint32(8).uint32(S.protocolVersion),S.maxNumOfVideos!=null&&Object.hasOwnProperty.call(S,"maxNumOfVideos")&&R.uint32(16).uint32(S.maxNumOfVideos),S.flags!=null&&Object.hasOwnProperty.call(S,"flags")&&R.uint32(24).uint32(S.flags),S.clientDetails!=null&&Object.hasOwnProperty.call(S,"clientDetails")&&T.SdkClientDetails.encode(S.clientDetails,R.uint32(34).fork()).ldelim(),S.audioSessionId!=null&&Object.hasOwnProperty.call(S,"audioSessionId")&&R.uint32(48).uint64(S.audioSessionId),S.wantsCompressedSdp!=null&&Object.hasOwnProperty.call(S,"wantsCompressedSdp")&&R.uint32(56).bool(S.wantsCompressedSdp),S.serverSideNetworkAdaption!=null&&Object.hasOwnProperty.call(S,"serverSideNetworkAdaption")&&R.uint32(80).int32(S.serverSideNetworkAdaption),S.supportedServerSideNetworkAdaptions!=null&&S.supportedServerSideNetworkAdaptions.length)for(var A=0;A<S.supportedServerSideNetworkAdaptions.length;++A)R.uint32(88).int32(S.supportedServerSideNetworkAdaptions[A]);return S.wantsAllTemporalLayersInIndex!=null&&Object.hasOwnProperty.call(S,"wantsAllTemporalLayersInIndex")&&R.uint32(96).bool(S.wantsAllTemporalLayersInIndex),S.disablePeriodicKeyframeRequestOnContentSender!=null&&Object.hasOwnProperty.call(S,"disablePeriodicKeyframeRequestOnContentSender")&&R.uint32(104).bool(S.disablePeriodicKeyframeRequestOnContentSender),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkJoinFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.protocolVersion=S.uint32();break}case 2:{O.maxNumOfVideos=S.uint32();break}case 3:{O.flags=S.uint32();break}case 4:{O.clientDetails=T.SdkClientDetails.decode(S,S.uint32());break}case 6:{O.audioSessionId=S.uint64();break}case 7:{O.wantsCompressedSdp=S.bool();break}case 10:{O.serverSideNetworkAdaption=S.int32();break}case 11:{if(O.supportedServerSideNetworkAdaptions&&O.supportedServerSideNetworkAdaptions.length||(O.supportedServerSideNetworkAdaptions=[]),(H&7)===2)for(var ee=S.uint32()+S.pos;S.pos<ee;)O.supportedServerSideNetworkAdaptions.push(S.int32());else O.supportedServerSideNetworkAdaptions.push(S.int32());break}case 12:{O.wantsAllTemporalLayersInIndex=S.bool();break}case 13:{O.disablePeriodicKeyframeRequestOnContentSender=S.bool();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.protocolVersion!=null&&S.hasOwnProperty("protocolVersion")&&!w.isInteger(S.protocolVersion))return"protocolVersion: integer expected";if(S.maxNumOfVideos!=null&&S.hasOwnProperty("maxNumOfVideos")&&!w.isInteger(S.maxNumOfVideos))return"maxNumOfVideos: integer expected";if(S.flags!=null&&S.hasOwnProperty("flags")&&!w.isInteger(S.flags))return"flags: integer expected";if(S.clientDetails!=null&&S.hasOwnProperty("clientDetails")){var R=T.SdkClientDetails.verify(S.clientDetails);if(R)return"clientDetails."+R}if(S.audioSessionId!=null&&S.hasOwnProperty("audioSessionId")&&!w.isInteger(S.audioSessionId)&&!(S.audioSessionId&&w.isInteger(S.audioSessionId.low)&&w.isInteger(S.audioSessionId.high)))return"audioSessionId: integer|Long expected";if(S.wantsCompressedSdp!=null&&S.hasOwnProperty("wantsCompressedSdp")&&typeof S.wantsCompressedSdp!="boolean")return"wantsCompressedSdp: boolean expected";if(S.serverSideNetworkAdaption!=null&&S.hasOwnProperty("serverSideNetworkAdaption"))switch(S.serverSideNetworkAdaption){default:return"serverSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:break}if(S.supportedServerSideNetworkAdaptions!=null&&S.hasOwnProperty("supportedServerSideNetworkAdaptions")){if(!Array.isArray(S.supportedServerSideNetworkAdaptions))return"supportedServerSideNetworkAdaptions: array expected";for(var A=0;A<S.supportedServerSideNetworkAdaptions.length;++A)switch(S.supportedServerSideNetworkAdaptions[A]){default:return"supportedServerSideNetworkAdaptions: enum value[] expected";case 1:case 2:case 3:case 4:break}}return S.wantsAllTemporalLayersInIndex!=null&&S.hasOwnProperty("wantsAllTemporalLayersInIndex")&&typeof S.wantsAllTemporalLayersInIndex!="boolean"?"wantsAllTemporalLayersInIndex: boolean expected":S.disablePeriodicKeyframeRequestOnContentSender!=null&&S.hasOwnProperty("disablePeriodicKeyframeRequestOnContentSender")&&typeof S.disablePeriodicKeyframeRequestOnContentSender!="boolean"?"disablePeriodicKeyframeRequestOnContentSender: boolean expected":null},_.fromObject=function(S){if(S instanceof T.SdkJoinFrame)return S;var R=new T.SdkJoinFrame;if(S.protocolVersion!=null&&(R.protocolVersion=S.protocolVersion>>>0),S.maxNumOfVideos!=null&&(R.maxNumOfVideos=S.maxNumOfVideos>>>0),S.flags!=null&&(R.flags=S.flags>>>0),S.clientDetails!=null){if(typeof S.clientDetails!="object")throw TypeError(".SdkJoinFrame.clientDetails: object expected");R.clientDetails=T.SdkClientDetails.fromObject(S.clientDetails)}switch(S.audioSessionId!=null&&(w.Long?(R.audioSessionId=w.Long.fromValue(S.audioSessionId)).unsigned=!0:typeof S.audioSessionId=="string"?R.audioSessionId=parseInt(S.audioSessionId,10):typeof S.audioSessionId=="number"?R.audioSessionId=S.audioSessionId:typeof S.audioSessionId=="object"&&(R.audioSessionId=new w.LongBits(S.audioSessionId.low>>>0,S.audioSessionId.high>>>0).toNumber(!0))),S.wantsCompressedSdp!=null&&(R.wantsCompressedSdp=!!S.wantsCompressedSdp),S.serverSideNetworkAdaption){default:if(typeof S.serverSideNetworkAdaption=="number"){R.serverSideNetworkAdaption=S.serverSideNetworkAdaption;break}break;case"DEFAULT":case 1:R.serverSideNetworkAdaption=1;break;case"NONE":case 2:R.serverSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:R.serverSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:R.serverSideNetworkAdaption=4;break}if(S.supportedServerSideNetworkAdaptions){if(!Array.isArray(S.supportedServerSideNetworkAdaptions))throw TypeError(".SdkJoinFrame.supportedServerSideNetworkAdaptions: array expected");R.supportedServerSideNetworkAdaptions=[];for(var A=0;A<S.supportedServerSideNetworkAdaptions.length;++A)switch(S.supportedServerSideNetworkAdaptions[A]){default:if(typeof S.supportedServerSideNetworkAdaptions[A]=="number"){R.supportedServerSideNetworkAdaptions[A]=S.supportedServerSideNetworkAdaptions[A];break}case"DEFAULT":case 1:R.supportedServerSideNetworkAdaptions[A]=1;break;case"NONE":case 2:R.supportedServerSideNetworkAdaptions[A]=2;break;case"BANDWIDTH_PROBING":case 3:R.supportedServerSideNetworkAdaptions[A]=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:R.supportedServerSideNetworkAdaptions[A]=4;break}}return S.wantsAllTemporalLayersInIndex!=null&&(R.wantsAllTemporalLayersInIndex=!!S.wantsAllTemporalLayersInIndex),S.disablePeriodicKeyframeRequestOnContentSender!=null&&(R.disablePeriodicKeyframeRequestOnContentSender=!!S.disablePeriodicKeyframeRequestOnContentSender),R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.supportedServerSideNetworkAdaptions=[]),R.defaults){if(A.protocolVersion=2,A.maxNumOfVideos=0,A.flags=0,A.clientDetails=null,w.Long){var O=new w.Long(0,0,!0);A.audioSessionId=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.audioSessionId=R.longs===String?"0":0;A.wantsCompressedSdp=!1,A.serverSideNetworkAdaption=R.enums===String?"DEFAULT":1,A.wantsAllTemporalLayersInIndex=!1,A.disablePeriodicKeyframeRequestOnContentSender=!1}if(S.protocolVersion!=null&&S.hasOwnProperty("protocolVersion")&&(A.protocolVersion=S.protocolVersion),S.maxNumOfVideos!=null&&S.hasOwnProperty("maxNumOfVideos")&&(A.maxNumOfVideos=S.maxNumOfVideos),S.flags!=null&&S.hasOwnProperty("flags")&&(A.flags=S.flags),S.clientDetails!=null&&S.hasOwnProperty("clientDetails")&&(A.clientDetails=T.SdkClientDetails.toObject(S.clientDetails,R)),S.audioSessionId!=null&&S.hasOwnProperty("audioSessionId")&&(typeof S.audioSessionId=="number"?A.audioSessionId=R.longs===String?String(S.audioSessionId):S.audioSessionId:A.audioSessionId=R.longs===String?w.Long.prototype.toString.call(S.audioSessionId):R.longs===Number?new w.LongBits(S.audioSessionId.low>>>0,S.audioSessionId.high>>>0).toNumber(!0):S.audioSessionId),S.wantsCompressedSdp!=null&&S.hasOwnProperty("wantsCompressedSdp")&&(A.wantsCompressedSdp=S.wantsCompressedSdp),S.serverSideNetworkAdaption!=null&&S.hasOwnProperty("serverSideNetworkAdaption")&&(A.serverSideNetworkAdaption=R.enums===String?T.SdkServerSideNetworkAdaption[S.serverSideNetworkAdaption]===void 0?S.serverSideNetworkAdaption:T.SdkServerSideNetworkAdaption[S.serverSideNetworkAdaption]:S.serverSideNetworkAdaption),S.supportedServerSideNetworkAdaptions&&S.supportedServerSideNetworkAdaptions.length){A.supportedServerSideNetworkAdaptions=[];for(var H=0;H<S.supportedServerSideNetworkAdaptions.length;++H)A.supportedServerSideNetworkAdaptions[H]=R.enums===String?T.SdkServerSideNetworkAdaption[S.supportedServerSideNetworkAdaptions[H]]===void 0?S.supportedServerSideNetworkAdaptions[H]:T.SdkServerSideNetworkAdaption[S.supportedServerSideNetworkAdaptions[H]]:S.supportedServerSideNetworkAdaptions[H]}return S.wantsAllTemporalLayersInIndex!=null&&S.hasOwnProperty("wantsAllTemporalLayersInIndex")&&(A.wantsAllTemporalLayersInIndex=S.wantsAllTemporalLayersInIndex),S.disablePeriodicKeyframeRequestOnContentSender!=null&&S.hasOwnProperty("disablePeriodicKeyframeRequestOnContentSender")&&(A.disablePeriodicKeyframeRequestOnContentSender=S.disablePeriodicKeyframeRequestOnContentSender),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkJoinFrame"},_}(),T.SdkJoinAckFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.turnCredentials=null,_.prototype.videoSubscriptionLimit=0,_.prototype.wantsCompressedSdp=!1,_.prototype.defaultServerSideNetworkAdaption=1,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.turnCredentials!=null&&Object.hasOwnProperty.call(S,"turnCredentials")&&T.SdkTurnCredentials.encode(S.turnCredentials,R.uint32(10).fork()).ldelim(),S.videoSubscriptionLimit!=null&&Object.hasOwnProperty.call(S,"videoSubscriptionLimit")&&R.uint32(16).uint32(S.videoSubscriptionLimit),S.wantsCompressedSdp!=null&&Object.hasOwnProperty.call(S,"wantsCompressedSdp")&&R.uint32(24).bool(S.wantsCompressedSdp),S.defaultServerSideNetworkAdaption!=null&&Object.hasOwnProperty.call(S,"defaultServerSideNetworkAdaption")&&R.uint32(32).int32(S.defaultServerSideNetworkAdaption),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkJoinAckFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.turnCredentials=T.SdkTurnCredentials.decode(S,S.uint32());break}case 2:{O.videoSubscriptionLimit=S.uint32();break}case 3:{O.wantsCompressedSdp=S.bool();break}case 4:{O.defaultServerSideNetworkAdaption=S.int32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.turnCredentials!=null&&S.hasOwnProperty("turnCredentials")){var R=T.SdkTurnCredentials.verify(S.turnCredentials);if(R)return"turnCredentials."+R}if(S.videoSubscriptionLimit!=null&&S.hasOwnProperty("videoSubscriptionLimit")&&!w.isInteger(S.videoSubscriptionLimit))return"videoSubscriptionLimit: integer expected";if(S.wantsCompressedSdp!=null&&S.hasOwnProperty("wantsCompressedSdp")&&typeof S.wantsCompressedSdp!="boolean")return"wantsCompressedSdp: boolean expected";if(S.defaultServerSideNetworkAdaption!=null&&S.hasOwnProperty("defaultServerSideNetworkAdaption"))switch(S.defaultServerSideNetworkAdaption){default:return"defaultServerSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:break}return null},_.fromObject=function(S){if(S instanceof T.SdkJoinAckFrame)return S;var R=new T.SdkJoinAckFrame;if(S.turnCredentials!=null){if(typeof S.turnCredentials!="object")throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");R.turnCredentials=T.SdkTurnCredentials.fromObject(S.turnCredentials)}switch(S.videoSubscriptionLimit!=null&&(R.videoSubscriptionLimit=S.videoSubscriptionLimit>>>0),S.wantsCompressedSdp!=null&&(R.wantsCompressedSdp=!!S.wantsCompressedSdp),S.defaultServerSideNetworkAdaption){default:if(typeof S.defaultServerSideNetworkAdaption=="number"){R.defaultServerSideNetworkAdaption=S.defaultServerSideNetworkAdaption;break}break;case"DEFAULT":case 1:R.defaultServerSideNetworkAdaption=1;break;case"NONE":case 2:R.defaultServerSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:R.defaultServerSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:R.defaultServerSideNetworkAdaption=4;break}return R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.turnCredentials=null,A.videoSubscriptionLimit=0,A.wantsCompressedSdp=!1,A.defaultServerSideNetworkAdaption=R.enums===String?"DEFAULT":1),S.turnCredentials!=null&&S.hasOwnProperty("turnCredentials")&&(A.turnCredentials=T.SdkTurnCredentials.toObject(S.turnCredentials,R)),S.videoSubscriptionLimit!=null&&S.hasOwnProperty("videoSubscriptionLimit")&&(A.videoSubscriptionLimit=S.videoSubscriptionLimit),S.wantsCompressedSdp!=null&&S.hasOwnProperty("wantsCompressedSdp")&&(A.wantsCompressedSdp=S.wantsCompressedSdp),S.defaultServerSideNetworkAdaption!=null&&S.hasOwnProperty("defaultServerSideNetworkAdaption")&&(A.defaultServerSideNetworkAdaption=R.enums===String?T.SdkServerSideNetworkAdaption[S.defaultServerSideNetworkAdaption]===void 0?S.defaultServerSideNetworkAdaption:T.SdkServerSideNetworkAdaption[S.defaultServerSideNetworkAdaption]:S.defaultServerSideNetworkAdaption),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkJoinAckFrame"},_}(),T.SdkLeaveFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkLeaveFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":null},_.fromObject=function(S){return S instanceof T.SdkLeaveFrame?S:new T.SdkLeaveFrame},_.toObject=function(){return{}},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkLeaveFrame"},_}(),T.SdkLeaveAckFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkLeaveAckFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":null},_.fromObject=function(S){return S instanceof T.SdkLeaveAckFrame?S:new T.SdkLeaveAckFrame},_.toObject=function(){return{}},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkLeaveAckFrame"},_}(),T.SdkStreamServiceType=function(){var _={},S=Object.create(_);return S[_[1]="RX"]=1,S[_[2]="TX"]=2,S[_[3]="DUPLEX"]=3,S}(),T.SdkStreamMediaType=function(){var _={},S=Object.create(_);return S[_[1]="AUDIO"]=1,S[_[2]="VIDEO"]=2,S}(),T.SdkSubscribeFrame=function(){function _(S){if(this.sendStreams=[],this.receiveStreamIds=[],this.videoSubscriptionConfiguration=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.duplex=1,_.prototype.sendStreams=w.emptyArray,_.prototype.receiveStreamIds=w.emptyArray,_.prototype.sdpOffer="",_.prototype.audioHost="",_.prototype.audioCheckin=!1,_.prototype.audioMuted=!1,_.prototype.compressedSdpOffer=w.newBuffer([]),_.prototype.videoSubscriptionConfiguration=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.duplex!=null&&Object.hasOwnProperty.call(S,"duplex")&&R.uint32(8).int32(S.duplex),S.sendStreams!=null&&S.sendStreams.length)for(var A=0;A<S.sendStreams.length;++A)T.SdkStreamDescriptor.encode(S.sendStreams[A],R.uint32(18).fork()).ldelim();if(S.receiveStreamIds!=null&&S.receiveStreamIds.length)for(var A=0;A<S.receiveStreamIds.length;++A)R.uint32(24).uint32(S.receiveStreamIds[A]);if(S.sdpOffer!=null&&Object.hasOwnProperty.call(S,"sdpOffer")&&R.uint32(34).string(S.sdpOffer),S.audioHost!=null&&Object.hasOwnProperty.call(S,"audioHost")&&R.uint32(42).string(S.audioHost),S.audioCheckin!=null&&Object.hasOwnProperty.call(S,"audioCheckin")&&R.uint32(48).bool(S.audioCheckin),S.audioMuted!=null&&Object.hasOwnProperty.call(S,"audioMuted")&&R.uint32(56).bool(S.audioMuted),S.compressedSdpOffer!=null&&Object.hasOwnProperty.call(S,"compressedSdpOffer")&&R.uint32(66).bytes(S.compressedSdpOffer),S.videoSubscriptionConfiguration!=null&&S.videoSubscriptionConfiguration.length)for(var A=0;A<S.videoSubscriptionConfiguration.length;++A)T.SdkVideoSubscriptionConfiguration.encode(S.videoSubscriptionConfiguration[A],R.uint32(74).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkSubscribeFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.duplex=S.int32();break}case 2:{O.sendStreams&&O.sendStreams.length||(O.sendStreams=[]),O.sendStreams.push(T.SdkStreamDescriptor.decode(S,S.uint32()));break}case 3:{if(O.receiveStreamIds&&O.receiveStreamIds.length||(O.receiveStreamIds=[]),(H&7)===2)for(var ee=S.uint32()+S.pos;S.pos<ee;)O.receiveStreamIds.push(S.uint32());else O.receiveStreamIds.push(S.uint32());break}case 4:{O.sdpOffer=S.string();break}case 5:{O.audioHost=S.string();break}case 6:{O.audioCheckin=S.bool();break}case 7:{O.audioMuted=S.bool();break}case 8:{O.compressedSdpOffer=S.bytes();break}case 9:{O.videoSubscriptionConfiguration&&O.videoSubscriptionConfiguration.length||(O.videoSubscriptionConfiguration=[]),O.videoSubscriptionConfiguration.push(T.SdkVideoSubscriptionConfiguration.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.duplex!=null&&S.hasOwnProperty("duplex"))switch(S.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:break}if(S.sendStreams!=null&&S.hasOwnProperty("sendStreams")){if(!Array.isArray(S.sendStreams))return"sendStreams: array expected";for(var R=0;R<S.sendStreams.length;++R){var A=T.SdkStreamDescriptor.verify(S.sendStreams[R]);if(A)return"sendStreams."+A}}if(S.receiveStreamIds!=null&&S.hasOwnProperty("receiveStreamIds")){if(!Array.isArray(S.receiveStreamIds))return"receiveStreamIds: array expected";for(var R=0;R<S.receiveStreamIds.length;++R)if(!w.isInteger(S.receiveStreamIds[R]))return"receiveStreamIds: integer[] expected"}if(S.sdpOffer!=null&&S.hasOwnProperty("sdpOffer")&&!w.isString(S.sdpOffer))return"sdpOffer: string expected";if(S.audioHost!=null&&S.hasOwnProperty("audioHost")&&!w.isString(S.audioHost))return"audioHost: string expected";if(S.audioCheckin!=null&&S.hasOwnProperty("audioCheckin")&&typeof S.audioCheckin!="boolean")return"audioCheckin: boolean expected";if(S.audioMuted!=null&&S.hasOwnProperty("audioMuted")&&typeof S.audioMuted!="boolean")return"audioMuted: boolean expected";if(S.compressedSdpOffer!=null&&S.hasOwnProperty("compressedSdpOffer")&&!(S.compressedSdpOffer&&typeof S.compressedSdpOffer.length=="number"||w.isString(S.compressedSdpOffer)))return"compressedSdpOffer: buffer expected";if(S.videoSubscriptionConfiguration!=null&&S.hasOwnProperty("videoSubscriptionConfiguration")){if(!Array.isArray(S.videoSubscriptionConfiguration))return"videoSubscriptionConfiguration: array expected";for(var R=0;R<S.videoSubscriptionConfiguration.length;++R){var A=T.SdkVideoSubscriptionConfiguration.verify(S.videoSubscriptionConfiguration[R]);if(A)return"videoSubscriptionConfiguration."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkSubscribeFrame)return S;var R=new T.SdkSubscribeFrame;switch(S.duplex){default:if(typeof S.duplex=="number"){R.duplex=S.duplex;break}break;case"RX":case 1:R.duplex=1;break;case"TX":case 2:R.duplex=2;break;case"DUPLEX":case 3:R.duplex=3;break}if(S.sendStreams){if(!Array.isArray(S.sendStreams))throw TypeError(".SdkSubscribeFrame.sendStreams: array expected");R.sendStreams=[];for(var A=0;A<S.sendStreams.length;++A){if(typeof S.sendStreams[A]!="object")throw TypeError(".SdkSubscribeFrame.sendStreams: object expected");R.sendStreams[A]=T.SdkStreamDescriptor.fromObject(S.sendStreams[A])}}if(S.receiveStreamIds){if(!Array.isArray(S.receiveStreamIds))throw TypeError(".SdkSubscribeFrame.receiveStreamIds: array expected");R.receiveStreamIds=[];for(var A=0;A<S.receiveStreamIds.length;++A)R.receiveStreamIds[A]=S.receiveStreamIds[A]>>>0}if(S.sdpOffer!=null&&(R.sdpOffer=String(S.sdpOffer)),S.audioHost!=null&&(R.audioHost=String(S.audioHost)),S.audioCheckin!=null&&(R.audioCheckin=!!S.audioCheckin),S.audioMuted!=null&&(R.audioMuted=!!S.audioMuted),S.compressedSdpOffer!=null&&(typeof S.compressedSdpOffer=="string"?w.base64.decode(S.compressedSdpOffer,R.compressedSdpOffer=w.newBuffer(w.base64.length(S.compressedSdpOffer)),0):S.compressedSdpOffer.length>=0&&(R.compressedSdpOffer=S.compressedSdpOffer)),S.videoSubscriptionConfiguration){if(!Array.isArray(S.videoSubscriptionConfiguration))throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: array expected");R.videoSubscriptionConfiguration=[];for(var A=0;A<S.videoSubscriptionConfiguration.length;++A){if(typeof S.videoSubscriptionConfiguration[A]!="object")throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: object expected");R.videoSubscriptionConfiguration[A]=T.SdkVideoSubscriptionConfiguration.fromObject(S.videoSubscriptionConfiguration[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.sendStreams=[],A.receiveStreamIds=[],A.videoSubscriptionConfiguration=[]),R.defaults&&(A.duplex=R.enums===String?"RX":1,A.sdpOffer="",A.audioHost="",A.audioCheckin=!1,A.audioMuted=!1,R.bytes===String?A.compressedSdpOffer="":(A.compressedSdpOffer=[],R.bytes!==Array&&(A.compressedSdpOffer=w.newBuffer(A.compressedSdpOffer)))),S.duplex!=null&&S.hasOwnProperty("duplex")&&(A.duplex=R.enums===String?T.SdkStreamServiceType[S.duplex]===void 0?S.duplex:T.SdkStreamServiceType[S.duplex]:S.duplex),S.sendStreams&&S.sendStreams.length){A.sendStreams=[];for(var O=0;O<S.sendStreams.length;++O)A.sendStreams[O]=T.SdkStreamDescriptor.toObject(S.sendStreams[O],R)}if(S.receiveStreamIds&&S.receiveStreamIds.length){A.receiveStreamIds=[];for(var O=0;O<S.receiveStreamIds.length;++O)A.receiveStreamIds[O]=S.receiveStreamIds[O]}if(S.sdpOffer!=null&&S.hasOwnProperty("sdpOffer")&&(A.sdpOffer=S.sdpOffer),S.audioHost!=null&&S.hasOwnProperty("audioHost")&&(A.audioHost=S.audioHost),S.audioCheckin!=null&&S.hasOwnProperty("audioCheckin")&&(A.audioCheckin=S.audioCheckin),S.audioMuted!=null&&S.hasOwnProperty("audioMuted")&&(A.audioMuted=S.audioMuted),S.compressedSdpOffer!=null&&S.hasOwnProperty("compressedSdpOffer")&&(A.compressedSdpOffer=R.bytes===String?w.base64.encode(S.compressedSdpOffer,0,S.compressedSdpOffer.length):R.bytes===Array?Array.prototype.slice.call(S.compressedSdpOffer):S.compressedSdpOffer),S.videoSubscriptionConfiguration&&S.videoSubscriptionConfiguration.length){A.videoSubscriptionConfiguration=[];for(var O=0;O<S.videoSubscriptionConfiguration.length;++O)A.videoSubscriptionConfiguration[O]=T.SdkVideoSubscriptionConfiguration.toObject(S.videoSubscriptionConfiguration[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkSubscribeFrame"},_}(),T.SdkSubscribeAckFrame=function(){function _(S){if(this.allocations=[],this.tracks=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.duplex=1,_.prototype.allocations=w.emptyArray,_.prototype.sdpAnswer="",_.prototype.tracks=w.emptyArray,_.prototype.compressedSdpAnswer=w.newBuffer([]),_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.duplex!=null&&Object.hasOwnProperty.call(S,"duplex")&&R.uint32(8).int32(S.duplex),S.allocations!=null&&S.allocations.length)for(var A=0;A<S.allocations.length;++A)T.SdkStreamAllocation.encode(S.allocations[A],R.uint32(18).fork()).ldelim();if(S.sdpAnswer!=null&&Object.hasOwnProperty.call(S,"sdpAnswer")&&R.uint32(26).string(S.sdpAnswer),S.tracks!=null&&S.tracks.length)for(var A=0;A<S.tracks.length;++A)T.SdkTrackMapping.encode(S.tracks[A],R.uint32(34).fork()).ldelim();return S.compressedSdpAnswer!=null&&Object.hasOwnProperty.call(S,"compressedSdpAnswer")&&R.uint32(42).bytes(S.compressedSdpAnswer),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkSubscribeAckFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.duplex=S.int32();break}case 2:{O.allocations&&O.allocations.length||(O.allocations=[]),O.allocations.push(T.SdkStreamAllocation.decode(S,S.uint32()));break}case 3:{O.sdpAnswer=S.string();break}case 4:{O.tracks&&O.tracks.length||(O.tracks=[]),O.tracks.push(T.SdkTrackMapping.decode(S,S.uint32()));break}case 5:{O.compressedSdpAnswer=S.bytes();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.duplex!=null&&S.hasOwnProperty("duplex"))switch(S.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:break}if(S.allocations!=null&&S.hasOwnProperty("allocations")){if(!Array.isArray(S.allocations))return"allocations: array expected";for(var R=0;R<S.allocations.length;++R){var A=T.SdkStreamAllocation.verify(S.allocations[R]);if(A)return"allocations."+A}}if(S.sdpAnswer!=null&&S.hasOwnProperty("sdpAnswer")&&!w.isString(S.sdpAnswer))return"sdpAnswer: string expected";if(S.tracks!=null&&S.hasOwnProperty("tracks")){if(!Array.isArray(S.tracks))return"tracks: array expected";for(var R=0;R<S.tracks.length;++R){var A=T.SdkTrackMapping.verify(S.tracks[R]);if(A)return"tracks."+A}}return S.compressedSdpAnswer!=null&&S.hasOwnProperty("compressedSdpAnswer")&&!(S.compressedSdpAnswer&&typeof S.compressedSdpAnswer.length=="number"||w.isString(S.compressedSdpAnswer))?"compressedSdpAnswer: buffer expected":null},_.fromObject=function(S){if(S instanceof T.SdkSubscribeAckFrame)return S;var R=new T.SdkSubscribeAckFrame;switch(S.duplex){default:if(typeof S.duplex=="number"){R.duplex=S.duplex;break}break;case"RX":case 1:R.duplex=1;break;case"TX":case 2:R.duplex=2;break;case"DUPLEX":case 3:R.duplex=3;break}if(S.allocations){if(!Array.isArray(S.allocations))throw TypeError(".SdkSubscribeAckFrame.allocations: array expected");R.allocations=[];for(var A=0;A<S.allocations.length;++A){if(typeof S.allocations[A]!="object")throw TypeError(".SdkSubscribeAckFrame.allocations: object expected");R.allocations[A]=T.SdkStreamAllocation.fromObject(S.allocations[A])}}if(S.sdpAnswer!=null&&(R.sdpAnswer=String(S.sdpAnswer)),S.tracks){if(!Array.isArray(S.tracks))throw TypeError(".SdkSubscribeAckFrame.tracks: array expected");R.tracks=[];for(var A=0;A<S.tracks.length;++A){if(typeof S.tracks[A]!="object")throw TypeError(".SdkSubscribeAckFrame.tracks: object expected");R.tracks[A]=T.SdkTrackMapping.fromObject(S.tracks[A])}}return S.compressedSdpAnswer!=null&&(typeof S.compressedSdpAnswer=="string"?w.base64.decode(S.compressedSdpAnswer,R.compressedSdpAnswer=w.newBuffer(w.base64.length(S.compressedSdpAnswer)),0):S.compressedSdpAnswer.length>=0&&(R.compressedSdpAnswer=S.compressedSdpAnswer)),R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.allocations=[],A.tracks=[]),R.defaults&&(A.duplex=R.enums===String?"RX":1,A.sdpAnswer="",R.bytes===String?A.compressedSdpAnswer="":(A.compressedSdpAnswer=[],R.bytes!==Array&&(A.compressedSdpAnswer=w.newBuffer(A.compressedSdpAnswer)))),S.duplex!=null&&S.hasOwnProperty("duplex")&&(A.duplex=R.enums===String?T.SdkStreamServiceType[S.duplex]===void 0?S.duplex:T.SdkStreamServiceType[S.duplex]:S.duplex),S.allocations&&S.allocations.length){A.allocations=[];for(var O=0;O<S.allocations.length;++O)A.allocations[O]=T.SdkStreamAllocation.toObject(S.allocations[O],R)}if(S.sdpAnswer!=null&&S.hasOwnProperty("sdpAnswer")&&(A.sdpAnswer=S.sdpAnswer),S.tracks&&S.tracks.length){A.tracks=[];for(var O=0;O<S.tracks.length;++O)A.tracks[O]=T.SdkTrackMapping.toObject(S.tracks[O],R)}return S.compressedSdpAnswer!=null&&S.hasOwnProperty("compressedSdpAnswer")&&(A.compressedSdpAnswer=R.bytes===String?w.base64.encode(S.compressedSdpAnswer,0,S.compressedSdpAnswer.length):R.bytes===Array?Array.prototype.slice.call(S.compressedSdpAnswer):S.compressedSdpAnswer),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkSubscribeAckFrame"},_}(),T.SdkIndexFrame=function(){function _(S){if(this.sources=[],this.pausedAtSourceIds=[],this.supportedReceiveCodecIntersection=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.atCapacity=!1,_.prototype.sources=w.emptyArray,_.prototype.pausedAtSourceIds=w.emptyArray,_.prototype.numParticipants=0,_.prototype.supportedReceiveCodecIntersection=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.atCapacity!=null&&Object.hasOwnProperty.call(S,"atCapacity")&&R.uint32(8).bool(S.atCapacity),S.sources!=null&&S.sources.length)for(var A=0;A<S.sources.length;++A)T.SdkStreamDescriptor.encode(S.sources[A],R.uint32(18).fork()).ldelim();if(S.pausedAtSourceIds!=null&&S.pausedAtSourceIds.length)for(var A=0;A<S.pausedAtSourceIds.length;++A)R.uint32(24).uint32(S.pausedAtSourceIds[A]);if(S.numParticipants!=null&&Object.hasOwnProperty.call(S,"numParticipants")&&R.uint32(32).uint32(S.numParticipants),S.supportedReceiveCodecIntersection!=null&&S.supportedReceiveCodecIntersection.length)for(var A=0;A<S.supportedReceiveCodecIntersection.length;++A)R.uint32(40).int32(S.supportedReceiveCodecIntersection[A]);return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkIndexFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.atCapacity=S.bool();break}case 2:{O.sources&&O.sources.length||(O.sources=[]),O.sources.push(T.SdkStreamDescriptor.decode(S,S.uint32()));break}case 3:{if(O.pausedAtSourceIds&&O.pausedAtSourceIds.length||(O.pausedAtSourceIds=[]),(H&7)===2)for(var ee=S.uint32()+S.pos;S.pos<ee;)O.pausedAtSourceIds.push(S.uint32());else O.pausedAtSourceIds.push(S.uint32());break}case 4:{O.numParticipants=S.uint32();break}case 5:{if(O.supportedReceiveCodecIntersection&&O.supportedReceiveCodecIntersection.length||(O.supportedReceiveCodecIntersection=[]),(H&7)===2)for(var ee=S.uint32()+S.pos;S.pos<ee;)O.supportedReceiveCodecIntersection.push(S.int32());else O.supportedReceiveCodecIntersection.push(S.int32());break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.atCapacity!=null&&S.hasOwnProperty("atCapacity")&&typeof S.atCapacity!="boolean")return"atCapacity: boolean expected";if(S.sources!=null&&S.hasOwnProperty("sources")){if(!Array.isArray(S.sources))return"sources: array expected";for(var R=0;R<S.sources.length;++R){var A=T.SdkStreamDescriptor.verify(S.sources[R]);if(A)return"sources."+A}}if(S.pausedAtSourceIds!=null&&S.hasOwnProperty("pausedAtSourceIds")){if(!Array.isArray(S.pausedAtSourceIds))return"pausedAtSourceIds: array expected";for(var R=0;R<S.pausedAtSourceIds.length;++R)if(!w.isInteger(S.pausedAtSourceIds[R]))return"pausedAtSourceIds: integer[] expected"}if(S.numParticipants!=null&&S.hasOwnProperty("numParticipants")&&!w.isInteger(S.numParticipants))return"numParticipants: integer expected";if(S.supportedReceiveCodecIntersection!=null&&S.hasOwnProperty("supportedReceiveCodecIntersection")){if(!Array.isArray(S.supportedReceiveCodecIntersection))return"supportedReceiveCodecIntersection: array expected";for(var R=0;R<S.supportedReceiveCodecIntersection.length;++R)switch(S.supportedReceiveCodecIntersection[R]){default:return"supportedReceiveCodecIntersection: enum value[] expected";case 1:case 2:case 3:case 4:case 5:case 6:case 8:case 11:break}}return null},_.fromObject=function(S){if(S instanceof T.SdkIndexFrame)return S;var R=new T.SdkIndexFrame;if(S.atCapacity!=null&&(R.atCapacity=!!S.atCapacity),S.sources){if(!Array.isArray(S.sources))throw TypeError(".SdkIndexFrame.sources: array expected");R.sources=[];for(var A=0;A<S.sources.length;++A){if(typeof S.sources[A]!="object")throw TypeError(".SdkIndexFrame.sources: object expected");R.sources[A]=T.SdkStreamDescriptor.fromObject(S.sources[A])}}if(S.pausedAtSourceIds){if(!Array.isArray(S.pausedAtSourceIds))throw TypeError(".SdkIndexFrame.pausedAtSourceIds: array expected");R.pausedAtSourceIds=[];for(var A=0;A<S.pausedAtSourceIds.length;++A)R.pausedAtSourceIds[A]=S.pausedAtSourceIds[A]>>>0}if(S.numParticipants!=null&&(R.numParticipants=S.numParticipants>>>0),S.supportedReceiveCodecIntersection){if(!Array.isArray(S.supportedReceiveCodecIntersection))throw TypeError(".SdkIndexFrame.supportedReceiveCodecIntersection: array expected");R.supportedReceiveCodecIntersection=[];for(var A=0;A<S.supportedReceiveCodecIntersection.length;++A)switch(S.supportedReceiveCodecIntersection[A]){default:if(typeof S.supportedReceiveCodecIntersection[A]=="number"){R.supportedReceiveCodecIntersection[A]=S.supportedReceiveCodecIntersection[A];break}case"VP8":case 1:R.supportedReceiveCodecIntersection[A]=1;break;case"H264_BASELINE_PROFILE":case 2:R.supportedReceiveCodecIntersection[A]=2;break;case"H264_CONSTRAINED_BASELINE_PROFILE":case 3:R.supportedReceiveCodecIntersection[A]=3;break;case"H264_MAIN_PROFILE":case 4:R.supportedReceiveCodecIntersection[A]=4;break;case"H264_HIGH_PROFILE":case 5:R.supportedReceiveCodecIntersection[A]=5;break;case"H264_CONSTRAINED_HIGH_PROFILE":case 6:R.supportedReceiveCodecIntersection[A]=6;break;case"VP9_PROFILE_0":case 8:R.supportedReceiveCodecIntersection[A]=8;break;case"AV1_MAIN_PROFILE":case 11:R.supportedReceiveCodecIntersection[A]=11;break}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.sources=[],A.pausedAtSourceIds=[],A.supportedReceiveCodecIntersection=[]),R.defaults&&(A.atCapacity=!1,A.numParticipants=0),S.atCapacity!=null&&S.hasOwnProperty("atCapacity")&&(A.atCapacity=S.atCapacity),S.sources&&S.sources.length){A.sources=[];for(var O=0;O<S.sources.length;++O)A.sources[O]=T.SdkStreamDescriptor.toObject(S.sources[O],R)}if(S.pausedAtSourceIds&&S.pausedAtSourceIds.length){A.pausedAtSourceIds=[];for(var O=0;O<S.pausedAtSourceIds.length;++O)A.pausedAtSourceIds[O]=S.pausedAtSourceIds[O]}if(S.numParticipants!=null&&S.hasOwnProperty("numParticipants")&&(A.numParticipants=S.numParticipants),S.supportedReceiveCodecIntersection&&S.supportedReceiveCodecIntersection.length){A.supportedReceiveCodecIntersection=[];for(var O=0;O<S.supportedReceiveCodecIntersection.length;++O)A.supportedReceiveCodecIntersection[O]=R.enums===String?T.SdkVideoCodecCapability[S.supportedReceiveCodecIntersection[O]]===void 0?S.supportedReceiveCodecIntersection[O]:T.SdkVideoCodecCapability[S.supportedReceiveCodecIntersection[O]]:S.supportedReceiveCodecIntersection[O]}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkIndexFrame"},_}(),T.SdkPauseResumeFrame=function(){function _(S){if(this.streamIds=[],this.groupIds=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.streamIds=w.emptyArray,_.prototype.groupIds=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.streamIds!=null&&S.streamIds.length)for(var A=0;A<S.streamIds.length;++A)R.uint32(8).uint32(S.streamIds[A]);if(S.groupIds!=null&&S.groupIds.length)for(var A=0;A<S.groupIds.length;++A)R.uint32(16).uint32(S.groupIds[A]);return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkPauseResumeFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{if(O.streamIds&&O.streamIds.length||(O.streamIds=[]),(H&7)===2)for(var ee=S.uint32()+S.pos;S.pos<ee;)O.streamIds.push(S.uint32());else O.streamIds.push(S.uint32());break}case 2:{if(O.groupIds&&O.groupIds.length||(O.groupIds=[]),(H&7)===2)for(var ee=S.uint32()+S.pos;S.pos<ee;)O.groupIds.push(S.uint32());else O.groupIds.push(S.uint32());break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.streamIds!=null&&S.hasOwnProperty("streamIds")){if(!Array.isArray(S.streamIds))return"streamIds: array expected";for(var R=0;R<S.streamIds.length;++R)if(!w.isInteger(S.streamIds[R]))return"streamIds: integer[] expected"}if(S.groupIds!=null&&S.hasOwnProperty("groupIds")){if(!Array.isArray(S.groupIds))return"groupIds: array expected";for(var R=0;R<S.groupIds.length;++R)if(!w.isInteger(S.groupIds[R]))return"groupIds: integer[] expected"}return null},_.fromObject=function(S){if(S instanceof T.SdkPauseResumeFrame)return S;var R=new T.SdkPauseResumeFrame;if(S.streamIds){if(!Array.isArray(S.streamIds))throw TypeError(".SdkPauseResumeFrame.streamIds: array expected");R.streamIds=[];for(var A=0;A<S.streamIds.length;++A)R.streamIds[A]=S.streamIds[A]>>>0}if(S.groupIds){if(!Array.isArray(S.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");R.groupIds=[];for(var A=0;A<S.groupIds.length;++A)R.groupIds[A]=S.groupIds[A]>>>0}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.streamIds=[],A.groupIds=[]),S.streamIds&&S.streamIds.length){A.streamIds=[];for(var O=0;O<S.streamIds.length;++O)A.streamIds[O]=S.streamIds[O]}if(S.groupIds&&S.groupIds.length){A.groupIds=[];for(var O=0;O<S.groupIds.length;++O)A.groupIds[O]=S.groupIds[O]}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkPauseResumeFrame"},_}(),T.SdkBitrateFrame=function(){function _(S){if(this.bitrates=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.bitrates=w.emptyArray,_.prototype.serverAvailableOutgoingBitrate=0,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.bitrates!=null&&S.bitrates.length)for(var A=0;A<S.bitrates.length;++A)T.SdkBitrate.encode(S.bitrates[A],R.uint32(10).fork()).ldelim();return S.serverAvailableOutgoingBitrate!=null&&Object.hasOwnProperty.call(S,"serverAvailableOutgoingBitrate")&&R.uint32(16).uint32(S.serverAvailableOutgoingBitrate),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkBitrateFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.bitrates&&O.bitrates.length||(O.bitrates=[]),O.bitrates.push(T.SdkBitrate.decode(S,S.uint32()));break}case 2:{O.serverAvailableOutgoingBitrate=S.uint32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.bitrates!=null&&S.hasOwnProperty("bitrates")){if(!Array.isArray(S.bitrates))return"bitrates: array expected";for(var R=0;R<S.bitrates.length;++R){var A=T.SdkBitrate.verify(S.bitrates[R]);if(A)return"bitrates."+A}}return S.serverAvailableOutgoingBitrate!=null&&S.hasOwnProperty("serverAvailableOutgoingBitrate")&&!w.isInteger(S.serverAvailableOutgoingBitrate)?"serverAvailableOutgoingBitrate: integer expected":null},_.fromObject=function(S){if(S instanceof T.SdkBitrateFrame)return S;var R=new T.SdkBitrateFrame;if(S.bitrates){if(!Array.isArray(S.bitrates))throw TypeError(".SdkBitrateFrame.bitrates: array expected");R.bitrates=[];for(var A=0;A<S.bitrates.length;++A){if(typeof S.bitrates[A]!="object")throw TypeError(".SdkBitrateFrame.bitrates: object expected");R.bitrates[A]=T.SdkBitrate.fromObject(S.bitrates[A])}}return S.serverAvailableOutgoingBitrate!=null&&(R.serverAvailableOutgoingBitrate=S.serverAvailableOutgoingBitrate>>>0),R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.bitrates=[]),R.defaults&&(A.serverAvailableOutgoingBitrate=0),S.bitrates&&S.bitrates.length){A.bitrates=[];for(var O=0;O<S.bitrates.length;++O)A.bitrates[O]=T.SdkBitrate.toObject(S.bitrates[O],R)}return S.serverAvailableOutgoingBitrate!=null&&S.hasOwnProperty("serverAvailableOutgoingBitrate")&&(A.serverAvailableOutgoingBitrate=S.serverAvailableOutgoingBitrate),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkBitrateFrame"},_}(),T.SdkStreamDescriptor=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.streamId=0,_.prototype.framerate=0,_.prototype.maxBitrateKbps=0,_.prototype.trackLabel="",_.prototype.groupId=0,_.prototype.avgBitrateBps=0,_.prototype.attendeeId="",_.prototype.mediaType=1,_.prototype.externalUserId="",_.prototype.width=0,_.prototype.height=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.streamId!=null&&Object.hasOwnProperty.call(S,"streamId")&&R.uint32(8).uint32(S.streamId),S.framerate!=null&&Object.hasOwnProperty.call(S,"framerate")&&R.uint32(16).uint32(S.framerate),S.maxBitrateKbps!=null&&Object.hasOwnProperty.call(S,"maxBitrateKbps")&&R.uint32(24).uint32(S.maxBitrateKbps),S.trackLabel!=null&&Object.hasOwnProperty.call(S,"trackLabel")&&R.uint32(34).string(S.trackLabel),S.groupId!=null&&Object.hasOwnProperty.call(S,"groupId")&&R.uint32(48).uint32(S.groupId),S.avgBitrateBps!=null&&Object.hasOwnProperty.call(S,"avgBitrateBps")&&R.uint32(56).uint32(S.avgBitrateBps),S.attendeeId!=null&&Object.hasOwnProperty.call(S,"attendeeId")&&R.uint32(66).string(S.attendeeId),S.mediaType!=null&&Object.hasOwnProperty.call(S,"mediaType")&&R.uint32(72).int32(S.mediaType),S.externalUserId!=null&&Object.hasOwnProperty.call(S,"externalUserId")&&R.uint32(82).string(S.externalUserId),S.width!=null&&Object.hasOwnProperty.call(S,"width")&&R.uint32(88).uint32(S.width),S.height!=null&&Object.hasOwnProperty.call(S,"height")&&R.uint32(96).uint32(S.height),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkStreamDescriptor;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.streamId=S.uint32();break}case 2:{O.framerate=S.uint32();break}case 3:{O.maxBitrateKbps=S.uint32();break}case 4:{O.trackLabel=S.string();break}case 6:{O.groupId=S.uint32();break}case 7:{O.avgBitrateBps=S.uint32();break}case 8:{O.attendeeId=S.string();break}case 9:{O.mediaType=S.int32();break}case 10:{O.externalUserId=S.string();break}case 11:{O.width=S.uint32();break}case 12:{O.height=S.uint32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.streamId!=null&&S.hasOwnProperty("streamId")&&!w.isInteger(S.streamId))return"streamId: integer expected";if(S.framerate!=null&&S.hasOwnProperty("framerate")&&!w.isInteger(S.framerate))return"framerate: integer expected";if(S.maxBitrateKbps!=null&&S.hasOwnProperty("maxBitrateKbps")&&!w.isInteger(S.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(S.trackLabel!=null&&S.hasOwnProperty("trackLabel")&&!w.isString(S.trackLabel))return"trackLabel: string expected";if(S.groupId!=null&&S.hasOwnProperty("groupId")&&!w.isInteger(S.groupId))return"groupId: integer expected";if(S.avgBitrateBps!=null&&S.hasOwnProperty("avgBitrateBps")&&!w.isInteger(S.avgBitrateBps))return"avgBitrateBps: integer expected";if(S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&!w.isString(S.attendeeId))return"attendeeId: string expected";if(S.mediaType!=null&&S.hasOwnProperty("mediaType"))switch(S.mediaType){default:return"mediaType: enum value expected";case 1:case 2:break}return S.externalUserId!=null&&S.hasOwnProperty("externalUserId")&&!w.isString(S.externalUserId)?"externalUserId: string expected":S.width!=null&&S.hasOwnProperty("width")&&!w.isInteger(S.width)?"width: integer expected":S.height!=null&&S.hasOwnProperty("height")&&!w.isInteger(S.height)?"height: integer expected":null},_.fromObject=function(S){if(S instanceof T.SdkStreamDescriptor)return S;var R=new T.SdkStreamDescriptor;switch(S.streamId!=null&&(R.streamId=S.streamId>>>0),S.framerate!=null&&(R.framerate=S.framerate>>>0),S.maxBitrateKbps!=null&&(R.maxBitrateKbps=S.maxBitrateKbps>>>0),S.trackLabel!=null&&(R.trackLabel=String(S.trackLabel)),S.groupId!=null&&(R.groupId=S.groupId>>>0),S.avgBitrateBps!=null&&(R.avgBitrateBps=S.avgBitrateBps>>>0),S.attendeeId!=null&&(R.attendeeId=String(S.attendeeId)),S.mediaType){default:if(typeof S.mediaType=="number"){R.mediaType=S.mediaType;break}break;case"AUDIO":case 1:R.mediaType=1;break;case"VIDEO":case 2:R.mediaType=2;break}return S.externalUserId!=null&&(R.externalUserId=String(S.externalUserId)),S.width!=null&&(R.width=S.width>>>0),S.height!=null&&(R.height=S.height>>>0),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.streamId=0,A.framerate=0,A.maxBitrateKbps=0,A.trackLabel="",A.groupId=0,A.avgBitrateBps=0,A.attendeeId="",A.mediaType=R.enums===String?"AUDIO":1,A.externalUserId="",A.width=0,A.height=0),S.streamId!=null&&S.hasOwnProperty("streamId")&&(A.streamId=S.streamId),S.framerate!=null&&S.hasOwnProperty("framerate")&&(A.framerate=S.framerate),S.maxBitrateKbps!=null&&S.hasOwnProperty("maxBitrateKbps")&&(A.maxBitrateKbps=S.maxBitrateKbps),S.trackLabel!=null&&S.hasOwnProperty("trackLabel")&&(A.trackLabel=S.trackLabel),S.groupId!=null&&S.hasOwnProperty("groupId")&&(A.groupId=S.groupId),S.avgBitrateBps!=null&&S.hasOwnProperty("avgBitrateBps")&&(A.avgBitrateBps=S.avgBitrateBps),S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&(A.attendeeId=S.attendeeId),S.mediaType!=null&&S.hasOwnProperty("mediaType")&&(A.mediaType=R.enums===String?T.SdkStreamMediaType[S.mediaType]===void 0?S.mediaType:T.SdkStreamMediaType[S.mediaType]:S.mediaType),S.externalUserId!=null&&S.hasOwnProperty("externalUserId")&&(A.externalUserId=S.externalUserId),S.width!=null&&S.hasOwnProperty("width")&&(A.width=S.width),S.height!=null&&S.hasOwnProperty("height")&&(A.height=S.height),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkStreamDescriptor"},_}(),T.SdkStreamAllocation=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.trackLabel="",_.prototype.streamId=0,_.prototype.groupId=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.trackLabel!=null&&Object.hasOwnProperty.call(S,"trackLabel")&&R.uint32(10).string(S.trackLabel),S.streamId!=null&&Object.hasOwnProperty.call(S,"streamId")&&R.uint32(16).uint32(S.streamId),S.groupId!=null&&Object.hasOwnProperty.call(S,"groupId")&&R.uint32(24).uint32(S.groupId),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkStreamAllocation;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.trackLabel=S.string();break}case 2:{O.streamId=S.uint32();break}case 3:{O.groupId=S.uint32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.trackLabel!=null&&S.hasOwnProperty("trackLabel")&&!w.isString(S.trackLabel)?"trackLabel: string expected":S.streamId!=null&&S.hasOwnProperty("streamId")&&!w.isInteger(S.streamId)?"streamId: integer expected":S.groupId!=null&&S.hasOwnProperty("groupId")&&!w.isInteger(S.groupId)?"groupId: integer expected":null},_.fromObject=function(S){if(S instanceof T.SdkStreamAllocation)return S;var R=new T.SdkStreamAllocation;return S.trackLabel!=null&&(R.trackLabel=String(S.trackLabel)),S.streamId!=null&&(R.streamId=S.streamId>>>0),S.groupId!=null&&(R.groupId=S.groupId>>>0),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.trackLabel="",A.streamId=0,A.groupId=0),S.trackLabel!=null&&S.hasOwnProperty("trackLabel")&&(A.trackLabel=S.trackLabel),S.streamId!=null&&S.hasOwnProperty("streamId")&&(A.streamId=S.streamId),S.groupId!=null&&S.hasOwnProperty("groupId")&&(A.groupId=S.groupId),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkStreamAllocation"},_}(),T.SdkTrackMapping=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.streamId=0,_.prototype.ssrc=0,_.prototype.trackLabel="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.streamId!=null&&Object.hasOwnProperty.call(S,"streamId")&&R.uint32(8).uint32(S.streamId),S.ssrc!=null&&Object.hasOwnProperty.call(S,"ssrc")&&R.uint32(16).uint32(S.ssrc),S.trackLabel!=null&&Object.hasOwnProperty.call(S,"trackLabel")&&R.uint32(26).string(S.trackLabel),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTrackMapping;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.streamId=S.uint32();break}case 2:{O.ssrc=S.uint32();break}case 3:{O.trackLabel=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.streamId!=null&&S.hasOwnProperty("streamId")&&!w.isInteger(S.streamId)?"streamId: integer expected":S.ssrc!=null&&S.hasOwnProperty("ssrc")&&!w.isInteger(S.ssrc)?"ssrc: integer expected":S.trackLabel!=null&&S.hasOwnProperty("trackLabel")&&!w.isString(S.trackLabel)?"trackLabel: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkTrackMapping)return S;var R=new T.SdkTrackMapping;return S.streamId!=null&&(R.streamId=S.streamId>>>0),S.ssrc!=null&&(R.ssrc=S.ssrc>>>0),S.trackLabel!=null&&(R.trackLabel=String(S.trackLabel)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.streamId=0,A.ssrc=0,A.trackLabel=""),S.streamId!=null&&S.hasOwnProperty("streamId")&&(A.streamId=S.streamId),S.ssrc!=null&&S.hasOwnProperty("ssrc")&&(A.ssrc=S.ssrc),S.trackLabel!=null&&S.hasOwnProperty("trackLabel")&&(A.trackLabel=S.trackLabel),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTrackMapping"},_}(),T.SdkBitrate=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.sourceStreamId=0,_.prototype.avgBitrateBps=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.sourceStreamId!=null&&Object.hasOwnProperty.call(S,"sourceStreamId")&&R.uint32(8).uint32(S.sourceStreamId),S.avgBitrateBps!=null&&Object.hasOwnProperty.call(S,"avgBitrateBps")&&R.uint32(16).uint32(S.avgBitrateBps),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkBitrate;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.sourceStreamId=S.uint32();break}case 2:{O.avgBitrateBps=S.uint32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.sourceStreamId!=null&&S.hasOwnProperty("sourceStreamId")&&!w.isInteger(S.sourceStreamId)?"sourceStreamId: integer expected":S.avgBitrateBps!=null&&S.hasOwnProperty("avgBitrateBps")&&!w.isInteger(S.avgBitrateBps)?"avgBitrateBps: integer expected":null},_.fromObject=function(S){if(S instanceof T.SdkBitrate)return S;var R=new T.SdkBitrate;return S.sourceStreamId!=null&&(R.sourceStreamId=S.sourceStreamId>>>0),S.avgBitrateBps!=null&&(R.avgBitrateBps=S.avgBitrateBps>>>0),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.sourceStreamId=0,A.avgBitrateBps=0),S.sourceStreamId!=null&&S.hasOwnProperty("sourceStreamId")&&(A.sourceStreamId=S.sourceStreamId),S.avgBitrateBps!=null&&S.hasOwnProperty("avgBitrateBps")&&(A.avgBitrateBps=S.avgBitrateBps),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkBitrate"},_}(),T.SdkAudioControlFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.muted=!1,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.muted!=null&&Object.hasOwnProperty.call(S,"muted")&&R.uint32(8).bool(S.muted),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkAudioControlFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.muted=S.bool();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.muted!=null&&S.hasOwnProperty("muted")&&typeof S.muted!="boolean"?"muted: boolean expected":null},_.fromObject=function(S){if(S instanceof T.SdkAudioControlFrame)return S;var R=new T.SdkAudioControlFrame;return S.muted!=null&&(R.muted=!!S.muted),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.muted=!1),S.muted!=null&&S.hasOwnProperty("muted")&&(A.muted=S.muted),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkAudioControlFrame"},_}(),T.SdkAudioMetadataFrame=function(){function _(S){if(this.attendeeStates=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.attendeeStates=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.attendeeStates!=null&&S.attendeeStates.length)for(var A=0;A<S.attendeeStates.length;++A)T.SdkAudioAttendeeState.encode(S.attendeeStates[A],R.uint32(10).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkAudioMetadataFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.attendeeStates&&O.attendeeStates.length||(O.attendeeStates=[]),O.attendeeStates.push(T.SdkAudioAttendeeState.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.attendeeStates!=null&&S.hasOwnProperty("attendeeStates")){if(!Array.isArray(S.attendeeStates))return"attendeeStates: array expected";for(var R=0;R<S.attendeeStates.length;++R){var A=T.SdkAudioAttendeeState.verify(S.attendeeStates[R]);if(A)return"attendeeStates."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkAudioMetadataFrame)return S;var R=new T.SdkAudioMetadataFrame;if(S.attendeeStates){if(!Array.isArray(S.attendeeStates))throw TypeError(".SdkAudioMetadataFrame.attendeeStates: array expected");R.attendeeStates=[];for(var A=0;A<S.attendeeStates.length;++A){if(typeof S.attendeeStates[A]!="object")throw TypeError(".SdkAudioMetadataFrame.attendeeStates: object expected");R.attendeeStates[A]=T.SdkAudioAttendeeState.fromObject(S.attendeeStates[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.attendeeStates=[]),S.attendeeStates&&S.attendeeStates.length){A.attendeeStates=[];for(var O=0;O<S.attendeeStates.length;++O)A.attendeeStates[O]=T.SdkAudioAttendeeState.toObject(S.attendeeStates[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkAudioMetadataFrame"},_}(),T.SdkAudioAttendeeState=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.audioStreamId=0,_.prototype.volume=0,_.prototype.muted=!1,_.prototype.signalStrength=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.audioStreamId!=null&&Object.hasOwnProperty.call(S,"audioStreamId")&&R.uint32(8).uint32(S.audioStreamId),S.volume!=null&&Object.hasOwnProperty.call(S,"volume")&&R.uint32(16).uint32(S.volume),S.muted!=null&&Object.hasOwnProperty.call(S,"muted")&&R.uint32(24).bool(S.muted),S.signalStrength!=null&&Object.hasOwnProperty.call(S,"signalStrength")&&R.uint32(32).uint32(S.signalStrength),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkAudioAttendeeState;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.audioStreamId=S.uint32();break}case 2:{O.volume=S.uint32();break}case 3:{O.muted=S.bool();break}case 4:{O.signalStrength=S.uint32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.audioStreamId!=null&&S.hasOwnProperty("audioStreamId")&&!w.isInteger(S.audioStreamId)?"audioStreamId: integer expected":S.volume!=null&&S.hasOwnProperty("volume")&&!w.isInteger(S.volume)?"volume: integer expected":S.muted!=null&&S.hasOwnProperty("muted")&&typeof S.muted!="boolean"?"muted: boolean expected":S.signalStrength!=null&&S.hasOwnProperty("signalStrength")&&!w.isInteger(S.signalStrength)?"signalStrength: integer expected":null},_.fromObject=function(S){if(S instanceof T.SdkAudioAttendeeState)return S;var R=new T.SdkAudioAttendeeState;return S.audioStreamId!=null&&(R.audioStreamId=S.audioStreamId>>>0),S.volume!=null&&(R.volume=S.volume>>>0),S.muted!=null&&(R.muted=!!S.muted),S.signalStrength!=null&&(R.signalStrength=S.signalStrength>>>0),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.audioStreamId=0,A.volume=0,A.muted=!1,A.signalStrength=0),S.audioStreamId!=null&&S.hasOwnProperty("audioStreamId")&&(A.audioStreamId=S.audioStreamId),S.volume!=null&&S.hasOwnProperty("volume")&&(A.volume=S.volume),S.muted!=null&&S.hasOwnProperty("muted")&&(A.muted=S.muted),S.signalStrength!=null&&S.hasOwnProperty("signalStrength")&&(A.signalStrength=S.signalStrength),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkAudioAttendeeState"},_}(),T.SdkAudioStreamIdInfoFrame=function(){function _(S){if(this.streams=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.streams=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.streams!=null&&S.streams.length)for(var A=0;A<S.streams.length;++A)T.SdkAudioStreamIdInfo.encode(S.streams[A],R.uint32(10).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkAudioStreamIdInfoFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.streams&&O.streams.length||(O.streams=[]),O.streams.push(T.SdkAudioStreamIdInfo.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.streams!=null&&S.hasOwnProperty("streams")){if(!Array.isArray(S.streams))return"streams: array expected";for(var R=0;R<S.streams.length;++R){var A=T.SdkAudioStreamIdInfo.verify(S.streams[R]);if(A)return"streams."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkAudioStreamIdInfoFrame)return S;var R=new T.SdkAudioStreamIdInfoFrame;if(S.streams){if(!Array.isArray(S.streams))throw TypeError(".SdkAudioStreamIdInfoFrame.streams: array expected");R.streams=[];for(var A=0;A<S.streams.length;++A){if(typeof S.streams[A]!="object")throw TypeError(".SdkAudioStreamIdInfoFrame.streams: object expected");R.streams[A]=T.SdkAudioStreamIdInfo.fromObject(S.streams[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.streams=[]),S.streams&&S.streams.length){A.streams=[];for(var O=0;O<S.streams.length;++O)A.streams[O]=T.SdkAudioStreamIdInfo.toObject(S.streams[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkAudioStreamIdInfoFrame"},_}(),T.SdkAudioStreamIdInfo=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.audioStreamId=0,_.prototype.attendeeId="",_.prototype.muted=!1,_.prototype.externalUserId="",_.prototype.dropped=!1,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.audioStreamId!=null&&Object.hasOwnProperty.call(S,"audioStreamId")&&R.uint32(8).uint32(S.audioStreamId),S.attendeeId!=null&&Object.hasOwnProperty.call(S,"attendeeId")&&R.uint32(18).string(S.attendeeId),S.muted!=null&&Object.hasOwnProperty.call(S,"muted")&&R.uint32(24).bool(S.muted),S.externalUserId!=null&&Object.hasOwnProperty.call(S,"externalUserId")&&R.uint32(34).string(S.externalUserId),S.dropped!=null&&Object.hasOwnProperty.call(S,"dropped")&&R.uint32(40).bool(S.dropped),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkAudioStreamIdInfo;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.audioStreamId=S.uint32();break}case 2:{O.attendeeId=S.string();break}case 3:{O.muted=S.bool();break}case 4:{O.externalUserId=S.string();break}case 5:{O.dropped=S.bool();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.audioStreamId!=null&&S.hasOwnProperty("audioStreamId")&&!w.isInteger(S.audioStreamId)?"audioStreamId: integer expected":S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&!w.isString(S.attendeeId)?"attendeeId: string expected":S.muted!=null&&S.hasOwnProperty("muted")&&typeof S.muted!="boolean"?"muted: boolean expected":S.externalUserId!=null&&S.hasOwnProperty("externalUserId")&&!w.isString(S.externalUserId)?"externalUserId: string expected":S.dropped!=null&&S.hasOwnProperty("dropped")&&typeof S.dropped!="boolean"?"dropped: boolean expected":null},_.fromObject=function(S){if(S instanceof T.SdkAudioStreamIdInfo)return S;var R=new T.SdkAudioStreamIdInfo;return S.audioStreamId!=null&&(R.audioStreamId=S.audioStreamId>>>0),S.attendeeId!=null&&(R.attendeeId=String(S.attendeeId)),S.muted!=null&&(R.muted=!!S.muted),S.externalUserId!=null&&(R.externalUserId=String(S.externalUserId)),S.dropped!=null&&(R.dropped=!!S.dropped),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.audioStreamId=0,A.attendeeId="",A.muted=!1,A.externalUserId="",A.dropped=!1),S.audioStreamId!=null&&S.hasOwnProperty("audioStreamId")&&(A.audioStreamId=S.audioStreamId),S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&(A.attendeeId=S.attendeeId),S.muted!=null&&S.hasOwnProperty("muted")&&(A.muted=S.muted),S.externalUserId!=null&&S.hasOwnProperty("externalUserId")&&(A.externalUserId=S.externalUserId),S.dropped!=null&&S.hasOwnProperty("dropped")&&(A.dropped=S.dropped),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkAudioStreamIdInfo"},_}(),T.SdkPingPongType=function(){var _={},S=Object.create(_);return S[_[1]="PING"]=1,S[_[2]="PONG"]=2,S}(),T.SdkPingPongFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.type=1,_.prototype.pingId=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R.uint32(8).int32(S.type),R.uint32(16).uint32(S.pingId),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkPingPongFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.type=S.int32();break}case 2:{O.pingId=S.uint32();break}default:S.skipType(H&7);break}}if(!O.hasOwnProperty("type"))throw w.ProtocolError("missing required 'type'",{instance:O});if(!O.hasOwnProperty("pingId"))throw w.ProtocolError("missing required 'pingId'",{instance:O});return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";switch(S.type){default:return"type: enum value expected";case 1:case 2:break}return w.isInteger(S.pingId)?null:"pingId: integer expected"},_.fromObject=function(S){if(S instanceof T.SdkPingPongFrame)return S;var R=new T.SdkPingPongFrame;switch(S.type){default:if(typeof S.type=="number"){R.type=S.type;break}break;case"PING":case 1:R.type=1;break;case"PONG":case 2:R.type=2;break}return S.pingId!=null&&(R.pingId=S.pingId>>>0),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.type=R.enums===String?"PING":1,A.pingId=0),S.type!=null&&S.hasOwnProperty("type")&&(A.type=R.enums===String?T.SdkPingPongType[S.type]===void 0?S.type:T.SdkPingPongType[S.type]:S.type),S.pingId!=null&&S.hasOwnProperty("pingId")&&(A.pingId=S.pingId),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkPingPongFrame"},_}(),T.SdkAudioStatusFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.audioStatus=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.audioStatus!=null&&Object.hasOwnProperty.call(S,"audioStatus")&&R.uint32(8).uint32(S.audioStatus),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkAudioStatusFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.audioStatus=S.uint32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.audioStatus!=null&&S.hasOwnProperty("audioStatus")&&!w.isInteger(S.audioStatus)?"audioStatus: integer expected":null},_.fromObject=function(S){if(S instanceof T.SdkAudioStatusFrame)return S;var R=new T.SdkAudioStatusFrame;return S.audioStatus!=null&&(R.audioStatus=S.audioStatus>>>0),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.audioStatus=0),S.audioStatus!=null&&S.hasOwnProperty("audioStatus")&&(A.audioStatus=S.audioStatus),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkAudioStatusFrame"},_}(),T.SdkMetric=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.type=1,_.prototype.value=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.type!=null&&Object.hasOwnProperty.call(S,"type")&&R.uint32(8).int32(S.type),S.value!=null&&Object.hasOwnProperty.call(S,"value")&&R.uint32(17).double(S.value),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkMetric;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.type=S.int32();break}case 2:{O.value=S.double();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.type!=null&&S.hasOwnProperty("type"))switch(S.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 60:case 64:case 66:case 69:case 72:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:break}return S.value!=null&&S.hasOwnProperty("value")&&typeof S.value!="number"?"value: number expected":null},_.fromObject=function(S){if(S instanceof T.SdkMetric)return S;var R=new T.SdkMetric;switch(S.type){default:if(typeof S.type=="number"){R.type=S.type;break}break;case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:R.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:R.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:R.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:R.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:R.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:R.type=6;break;case"STUN_RTT_MS":case 7:R.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:R.type=8;break;case"RTC_MIC_JITTER_MS":case 9:R.type=9;break;case"RTC_MIC_PPS":case 10:R.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:R.type=11;break;case"RTC_MIC_BITRATE":case 12:R.type=12;break;case"RTC_MIC_RTT_MS":case 13:R.type=13;break;case"RTC_SPK_PPS":case 14:R.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:R.type=15;break;case"RTC_SPK_JITTER_MS":case 16:R.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:R.type=17;break;case"RTC_SPK_BITRATE":case 18:R.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:R.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:R.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:R.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:R.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:R.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:R.type=24;break;case"VIDEO_ENCODE_MS":case 25:R.type=25;break;case"VIDEO_INPUT_FPS":case 26:R.type=26;break;case"VIDEO_ENCODE_FPS":case 27:R.type=27;break;case"VIDEO_SENT_FPS":case 28:R.type=28;break;case"VIDEO_FIRS_RECEIVED":case 29:R.type=29;break;case"VIDEO_SENT_PPS":case 30:R.type=30;break;case"VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT":case 31:R.type=31;break;case"VIDEO_SENT_BITRATE":case 32:R.type=32;break;case"VIDEO_DROPPED_FPS":case 33:R.type=33;break;case"VIDEO_TARGET_DELAY_MS":case 34:R.type=34;break;case"VIDEO_DECODE_MS":case 35:R.type=35;break;case"VIDEO_OUTPUT_FPS":case 36:R.type=36;break;case"VIDEO_RECEIVED_PPS":case 37:R.type=37;break;case"VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT":case 38:R.type=38;break;case"VIDEO_RENDER_DELAY_MS":case 39:R.type=39;break;case"VIDEO_RECEIVED_FPS":case 40:R.type=40;break;case"VIDEO_DECODE_FPS":case 41:R.type=41;break;case"VIDEO_NACKS_SENT":case 42:R.type=42;break;case"VIDEO_FIRS_SENT":case 43:R.type=43;break;case"VIDEO_RECEIVED_BITRATE":case 44:R.type=44;break;case"VIDEO_CURRENT_DELAY_MS":case 45:R.type=45;break;case"VIDEO_JITTER_BUFFER_MS":case 46:R.type=46;break;case"VIDEO_DISCARDED_PPS":case 47:R.type=47;break;case"VIDEO_PLIS_SENT":case 48:R.type=48;break;case"VIDEO_RECEIVED_JITTER_MS":case 49:R.type=49;break;case"VIDEO_INPUT_HEIGHT":case 60:R.type=60;break;case"VIDEO_ENCODE_HEIGHT":case 64:R.type=64;break;case"VIDEO_SENT_QP_SUM":case 66:R.type=66;break;case"VIDEO_DECODE_HEIGHT":case 69:R.type=69;break;case"VIDEO_RECEIVED_QP_SUM":case 72:R.type=72;break;case"VIDEO_ENCODE_WIDTH":case 86:R.type=86;break;case"VIDEO_DECODE_WIDTH":case 87:R.type=87;break;case"VIDEO_ENCODER_IS_HARDWARE":case 88:R.type=88;break;case"VIDEO_DECODER_IS_HARDWARE":case 89:R.type=89;break;case"VIDEO_FREEZE_COUNT":case 90:R.type=90;break;case"VIDEO_FREEZE_DURATION":case 91:R.type=91;break;case"VIDEO_PAUSE_COUNT":case 92:R.type=92;break;case"VIDEO_PAUSE_DURATION":case 93:R.type=93;break;case"VIDEO_QUALITY_REASON":case 94:R.type=94;break;case"VIDEO_PROCESSING_TIME":case 95:R.type=95;break;case"RTC_SPK_AUDIO_LEVEL":case 96:R.type=96;break;case"RTC_MIC_AUDIO_LEVEL":case 97:R.type=97;break;case"RTC_SPK_TOTAL_LOST":case 98:R.type=98;break;case"RTC_SPK_TOTAL_EXPECTED":case 99:R.type=99;break;case"RTC_SPK_TOTAL_RECOVERED_RED":case 100:R.type=100;break;case"RTC_SPK_TOTAL_RECOVERED_FEC":case 101:R.type=101;break;case"VIDEO_QUALITY_LIMITATION_DURATION_CPU":case 102:R.type=102;break;case"VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU":case 103:R.type=103;break;case"VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE":case 104:R.type=104;break;case"VIDEO_RENDER_HEIGHT":case 105:R.type=105;break;case"VIDEO_RENDER_WIDTH":case 106:R.type=106;break;case"VIDEO_INPUT_WIDTH":case 107:R.type=107;break;case"VIDEO_SENT_JITTER_MS":case 108:R.type=108;break}return S.value!=null&&(R.value=Number(S.value)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.type=R.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,A.value=0),S.type!=null&&S.hasOwnProperty("type")&&(A.type=R.enums===String?T.SdkMetric.Type[S.type]===void 0?S.type:T.SdkMetric.Type[S.type]:S.type),S.value!=null&&S.hasOwnProperty("value")&&(A.value=R.json&&!isFinite(S.value)?String(S.value):S.value),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkMetric"},_.Type=function(){var S={},R=Object.create(S);return R[S[1]="VIDEO_ACTUAL_ENCODER_BITRATE"]=1,R[S[2]="VIDEO_AVAILABLE_SEND_BANDWIDTH"]=2,R[S[3]="VIDEO_RETRANSMIT_BITRATE"]=3,R[S[4]="VIDEO_AVAILABLE_RECEIVE_BANDWIDTH"]=4,R[S[5]="VIDEO_TARGET_ENCODER_BITRATE"]=5,R[S[6]="VIDEO_BUCKET_DELAY_MS"]=6,R[S[7]="STUN_RTT_MS"]=7,R[S[8]="SOCKET_DISCARDED_PPS"]=8,R[S[9]="RTC_MIC_JITTER_MS"]=9,R[S[10]="RTC_MIC_PPS"]=10,R[S[11]="RTC_MIC_FRACTION_PACKET_LOST_PERCENT"]=11,R[S[12]="RTC_MIC_BITRATE"]=12,R[S[13]="RTC_MIC_RTT_MS"]=13,R[S[14]="RTC_SPK_PPS"]=14,R[S[15]="RTC_SPK_FRACTION_PACKET_LOST_PERCENT"]=15,R[S[16]="RTC_SPK_JITTER_MS"]=16,R[S[17]="RTC_SPK_FRACTION_DECODER_LOSS_PERCENT"]=17,R[S[18]="RTC_SPK_BITRATE"]=18,R[S[19]="RTC_SPK_CURRENT_DELAY_MS"]=19,R[S[20]="RTC_SPK_JITTER_BUFFER_MS"]=20,R[S[21]="VIDEO_SENT_RTT_MS"]=21,R[S[22]="VIDEO_ENCODE_USAGE_PERCENT"]=22,R[S[23]="VIDEO_NACKS_RECEIVED"]=23,R[S[24]="VIDEO_PLIS_RECEIVED"]=24,R[S[25]="VIDEO_ENCODE_MS"]=25,R[S[26]="VIDEO_INPUT_FPS"]=26,R[S[27]="VIDEO_ENCODE_FPS"]=27,R[S[28]="VIDEO_SENT_FPS"]=28,R[S[29]="VIDEO_FIRS_RECEIVED"]=29,R[S[30]="VIDEO_SENT_PPS"]=30,R[S[31]="VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT"]=31,R[S[32]="VIDEO_SENT_BITRATE"]=32,R[S[33]="VIDEO_DROPPED_FPS"]=33,R[S[34]="VIDEO_TARGET_DELAY_MS"]=34,R[S[35]="VIDEO_DECODE_MS"]=35,R[S[36]="VIDEO_OUTPUT_FPS"]=36,R[S[37]="VIDEO_RECEIVED_PPS"]=37,R[S[38]="VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT"]=38,R[S[39]="VIDEO_RENDER_DELAY_MS"]=39,R[S[40]="VIDEO_RECEIVED_FPS"]=40,R[S[41]="VIDEO_DECODE_FPS"]=41,R[S[42]="VIDEO_NACKS_SENT"]=42,R[S[43]="VIDEO_FIRS_SENT"]=43,R[S[44]="VIDEO_RECEIVED_BITRATE"]=44,R[S[45]="VIDEO_CURRENT_DELAY_MS"]=45,R[S[46]="VIDEO_JITTER_BUFFER_MS"]=46,R[S[47]="VIDEO_DISCARDED_PPS"]=47,R[S[48]="VIDEO_PLIS_SENT"]=48,R[S[49]="VIDEO_RECEIVED_JITTER_MS"]=49,R[S[60]="VIDEO_INPUT_HEIGHT"]=60,R[S[64]="VIDEO_ENCODE_HEIGHT"]=64,R[S[66]="VIDEO_SENT_QP_SUM"]=66,R[S[69]="VIDEO_DECODE_HEIGHT"]=69,R[S[72]="VIDEO_RECEIVED_QP_SUM"]=72,R[S[86]="VIDEO_ENCODE_WIDTH"]=86,R[S[87]="VIDEO_DECODE_WIDTH"]=87,R[S[88]="VIDEO_ENCODER_IS_HARDWARE"]=88,R[S[89]="VIDEO_DECODER_IS_HARDWARE"]=89,R[S[90]="VIDEO_FREEZE_COUNT"]=90,R[S[91]="VIDEO_FREEZE_DURATION"]=91,R[S[92]="VIDEO_PAUSE_COUNT"]=92,R[S[93]="VIDEO_PAUSE_DURATION"]=93,R[S[94]="VIDEO_QUALITY_REASON"]=94,R[S[95]="VIDEO_PROCESSING_TIME"]=95,R[S[96]="RTC_SPK_AUDIO_LEVEL"]=96,R[S[97]="RTC_MIC_AUDIO_LEVEL"]=97,R[S[98]="RTC_SPK_TOTAL_LOST"]=98,R[S[99]="RTC_SPK_TOTAL_EXPECTED"]=99,R[S[100]="RTC_SPK_TOTAL_RECOVERED_RED"]=100,R[S[101]="RTC_SPK_TOTAL_RECOVERED_FEC"]=101,R[S[102]="VIDEO_QUALITY_LIMITATION_DURATION_CPU"]=102,R[S[103]="VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU"]=103,R[S[104]="VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE"]=104,R[S[105]="VIDEO_RENDER_HEIGHT"]=105,R[S[106]="VIDEO_RENDER_WIDTH"]=106,R[S[107]="VIDEO_INPUT_WIDTH"]=107,R[S[108]="VIDEO_SENT_JITTER_MS"]=108,R}(),_}(),T.SdkStreamMetricFrame=function(){function _(S){if(this.metrics=[],this.dimensions=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.streamId=0,_.prototype.groupId=0,_.prototype.metrics=w.emptyArray,_.prototype.dimensions=w.emptyArray,_.prototype.mediaType=1,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.streamId!=null&&Object.hasOwnProperty.call(S,"streamId")&&R.uint32(24).uint32(S.streamId),S.groupId!=null&&Object.hasOwnProperty.call(S,"groupId")&&R.uint32(32).uint32(S.groupId),S.metrics!=null&&S.metrics.length)for(var A=0;A<S.metrics.length;++A)T.SdkMetric.encode(S.metrics[A],R.uint32(42).fork()).ldelim();if(S.dimensions!=null&&S.dimensions.length)for(var A=0;A<S.dimensions.length;++A)T.SdkStreamDimension.encode(S.dimensions[A],R.uint32(50).fork()).ldelim();return S.mediaType!=null&&Object.hasOwnProperty.call(S,"mediaType")&&R.uint32(56).int32(S.mediaType),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkStreamMetricFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 3:{O.streamId=S.uint32();break}case 4:{O.groupId=S.uint32();break}case 5:{O.metrics&&O.metrics.length||(O.metrics=[]),O.metrics.push(T.SdkMetric.decode(S,S.uint32()));break}case 6:{O.dimensions&&O.dimensions.length||(O.dimensions=[]),O.dimensions.push(T.SdkStreamDimension.decode(S,S.uint32()));break}case 7:{O.mediaType=S.int32();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.streamId!=null&&S.hasOwnProperty("streamId")&&!w.isInteger(S.streamId))return"streamId: integer expected";if(S.groupId!=null&&S.hasOwnProperty("groupId")&&!w.isInteger(S.groupId))return"groupId: integer expected";if(S.metrics!=null&&S.hasOwnProperty("metrics")){if(!Array.isArray(S.metrics))return"metrics: array expected";for(var R=0;R<S.metrics.length;++R){var A=T.SdkMetric.verify(S.metrics[R]);if(A)return"metrics."+A}}if(S.dimensions!=null&&S.hasOwnProperty("dimensions")){if(!Array.isArray(S.dimensions))return"dimensions: array expected";for(var R=0;R<S.dimensions.length;++R){var A=T.SdkStreamDimension.verify(S.dimensions[R]);if(A)return"dimensions."+A}}if(S.mediaType!=null&&S.hasOwnProperty("mediaType"))switch(S.mediaType){default:return"mediaType: enum value expected";case 1:case 2:break}return null},_.fromObject=function(S){if(S instanceof T.SdkStreamMetricFrame)return S;var R=new T.SdkStreamMetricFrame;if(S.streamId!=null&&(R.streamId=S.streamId>>>0),S.groupId!=null&&(R.groupId=S.groupId>>>0),S.metrics){if(!Array.isArray(S.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");R.metrics=[];for(var A=0;A<S.metrics.length;++A){if(typeof S.metrics[A]!="object")throw TypeError(".SdkStreamMetricFrame.metrics: object expected");R.metrics[A]=T.SdkMetric.fromObject(S.metrics[A])}}if(S.dimensions){if(!Array.isArray(S.dimensions))throw TypeError(".SdkStreamMetricFrame.dimensions: array expected");R.dimensions=[];for(var A=0;A<S.dimensions.length;++A){if(typeof S.dimensions[A]!="object")throw TypeError(".SdkStreamMetricFrame.dimensions: object expected");R.dimensions[A]=T.SdkStreamDimension.fromObject(S.dimensions[A])}}switch(S.mediaType){default:if(typeof S.mediaType=="number"){R.mediaType=S.mediaType;break}break;case"AUDIO":case 1:R.mediaType=1;break;case"VIDEO":case 2:R.mediaType=2;break}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.metrics=[],A.dimensions=[]),R.defaults&&(A.streamId=0,A.groupId=0,A.mediaType=R.enums===String?"AUDIO":1),S.streamId!=null&&S.hasOwnProperty("streamId")&&(A.streamId=S.streamId),S.groupId!=null&&S.hasOwnProperty("groupId")&&(A.groupId=S.groupId),S.metrics&&S.metrics.length){A.metrics=[];for(var O=0;O<S.metrics.length;++O)A.metrics[O]=T.SdkMetric.toObject(S.metrics[O],R)}if(S.dimensions&&S.dimensions.length){A.dimensions=[];for(var O=0;O<S.dimensions.length;++O)A.dimensions[O]=T.SdkStreamDimension.toObject(S.dimensions[O],R)}return S.mediaType!=null&&S.hasOwnProperty("mediaType")&&(A.mediaType=R.enums===String?T.SdkStreamMediaType[S.mediaType]===void 0?S.mediaType:T.SdkStreamMediaType[S.mediaType]:S.mediaType),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkStreamMetricFrame"},_}(),T.SdkClientMetricFrame=function(){function _(S){if(this.globalMetrics=[],this.streamMetricFrames=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.globalMetrics=w.emptyArray,_.prototype.streamMetricFrames=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.globalMetrics!=null&&S.globalMetrics.length)for(var A=0;A<S.globalMetrics.length;++A)T.SdkMetric.encode(S.globalMetrics[A],R.uint32(10).fork()).ldelim();if(S.streamMetricFrames!=null&&S.streamMetricFrames.length)for(var A=0;A<S.streamMetricFrames.length;++A)T.SdkStreamMetricFrame.encode(S.streamMetricFrames[A],R.uint32(18).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkClientMetricFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.globalMetrics&&O.globalMetrics.length||(O.globalMetrics=[]),O.globalMetrics.push(T.SdkMetric.decode(S,S.uint32()));break}case 2:{O.streamMetricFrames&&O.streamMetricFrames.length||(O.streamMetricFrames=[]),O.streamMetricFrames.push(T.SdkStreamMetricFrame.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.globalMetrics!=null&&S.hasOwnProperty("globalMetrics")){if(!Array.isArray(S.globalMetrics))return"globalMetrics: array expected";for(var R=0;R<S.globalMetrics.length;++R){var A=T.SdkMetric.verify(S.globalMetrics[R]);if(A)return"globalMetrics."+A}}if(S.streamMetricFrames!=null&&S.hasOwnProperty("streamMetricFrames")){if(!Array.isArray(S.streamMetricFrames))return"streamMetricFrames: array expected";for(var R=0;R<S.streamMetricFrames.length;++R){var A=T.SdkStreamMetricFrame.verify(S.streamMetricFrames[R]);if(A)return"streamMetricFrames."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkClientMetricFrame)return S;var R=new T.SdkClientMetricFrame;if(S.globalMetrics){if(!Array.isArray(S.globalMetrics))throw TypeError(".SdkClientMetricFrame.globalMetrics: array expected");R.globalMetrics=[];for(var A=0;A<S.globalMetrics.length;++A){if(typeof S.globalMetrics[A]!="object")throw TypeError(".SdkClientMetricFrame.globalMetrics: object expected");R.globalMetrics[A]=T.SdkMetric.fromObject(S.globalMetrics[A])}}if(S.streamMetricFrames){if(!Array.isArray(S.streamMetricFrames))throw TypeError(".SdkClientMetricFrame.streamMetricFrames: array expected");R.streamMetricFrames=[];for(var A=0;A<S.streamMetricFrames.length;++A){if(typeof S.streamMetricFrames[A]!="object")throw TypeError(".SdkClientMetricFrame.streamMetricFrames: object expected");R.streamMetricFrames[A]=T.SdkStreamMetricFrame.fromObject(S.streamMetricFrames[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.globalMetrics=[],A.streamMetricFrames=[]),S.globalMetrics&&S.globalMetrics.length){A.globalMetrics=[];for(var O=0;O<S.globalMetrics.length;++O)A.globalMetrics[O]=T.SdkMetric.toObject(S.globalMetrics[O],R)}if(S.streamMetricFrames&&S.streamMetricFrames.length){A.streamMetricFrames=[];for(var O=0;O<S.streamMetricFrames.length;++O)A.streamMetricFrames[O]=T.SdkStreamMetricFrame.toObject(S.streamMetricFrames[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkClientMetricFrame"},_}(),T.SdkStreamDimension=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.type=1,_.prototype.value=null,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.type!=null&&Object.hasOwnProperty.call(S,"type")&&R.uint32(8).int32(S.type),S.value!=null&&Object.hasOwnProperty.call(S,"value")&&T.SdkDimensionValue.encode(S.value,R.uint32(18).fork()).ldelim(),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkStreamDimension;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.type=S.int32();break}case 2:{O.value=T.SdkDimensionValue.decode(S,S.uint32());break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.type!=null&&S.hasOwnProperty("type"))switch(S.type){default:return"type: enum value expected";case 1:case 2:break}if(S.value!=null&&S.hasOwnProperty("value")){var R=T.SdkDimensionValue.verify(S.value);if(R)return"value."+R}return null},_.fromObject=function(S){if(S instanceof T.SdkStreamDimension)return S;var R=new T.SdkStreamDimension;switch(S.type){default:if(typeof S.type=="number"){R.type=S.type;break}break;case"VIDEO_ENCODER_NAME":case 1:R.type=1;break;case"VIDEO_DECODER_NAME":case 2:R.type=2;break}if(S.value!=null){if(typeof S.value!="object")throw TypeError(".SdkStreamDimension.value: object expected");R.value=T.SdkDimensionValue.fromObject(S.value)}return R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.type=R.enums===String?"VIDEO_ENCODER_NAME":1,A.value=null),S.type!=null&&S.hasOwnProperty("type")&&(A.type=R.enums===String?T.SdkStreamDimension.Type[S.type]===void 0?S.type:T.SdkStreamDimension.Type[S.type]:S.type),S.value!=null&&S.hasOwnProperty("value")&&(A.value=T.SdkDimensionValue.toObject(S.value,R)),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkStreamDimension"},_.Type=function(){var S={},R=Object.create(S);return R[S[1]="VIDEO_ENCODER_NAME"]=1,R[S[2]="VIDEO_DECODER_NAME"]=2,R}(),_}(),T.SdkDimensionValue=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.stringValue="",_.prototype.boolValue=!1,_.prototype.uintValue=w.Long?w.Long.fromBits(0,0,!0):0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.stringValue!=null&&Object.hasOwnProperty.call(S,"stringValue")&&R.uint32(10).string(S.stringValue),S.boolValue!=null&&Object.hasOwnProperty.call(S,"boolValue")&&R.uint32(16).bool(S.boolValue),S.uintValue!=null&&Object.hasOwnProperty.call(S,"uintValue")&&R.uint32(24).uint64(S.uintValue),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkDimensionValue;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.stringValue=S.string();break}case 2:{O.boolValue=S.bool();break}case 3:{O.uintValue=S.uint64();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.stringValue!=null&&S.hasOwnProperty("stringValue")&&!w.isString(S.stringValue)?"stringValue: string expected":S.boolValue!=null&&S.hasOwnProperty("boolValue")&&typeof S.boolValue!="boolean"?"boolValue: boolean expected":S.uintValue!=null&&S.hasOwnProperty("uintValue")&&!w.isInteger(S.uintValue)&&!(S.uintValue&&w.isInteger(S.uintValue.low)&&w.isInteger(S.uintValue.high))?"uintValue: integer|Long expected":null},_.fromObject=function(S){if(S instanceof T.SdkDimensionValue)return S;var R=new T.SdkDimensionValue;return S.stringValue!=null&&(R.stringValue=String(S.stringValue)),S.boolValue!=null&&(R.boolValue=!!S.boolValue),S.uintValue!=null&&(w.Long?(R.uintValue=w.Long.fromValue(S.uintValue)).unsigned=!0:typeof S.uintValue=="string"?R.uintValue=parseInt(S.uintValue,10):typeof S.uintValue=="number"?R.uintValue=S.uintValue:typeof S.uintValue=="object"&&(R.uintValue=new w.LongBits(S.uintValue.low>>>0,S.uintValue.high>>>0).toNumber(!0))),R},_.toObject=function(S,R){R||(R={});var A={};if(R.defaults)if(A.stringValue="",A.boolValue=!1,w.Long){var O=new w.Long(0,0,!0);A.uintValue=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.uintValue=R.longs===String?"0":0;return S.stringValue!=null&&S.hasOwnProperty("stringValue")&&(A.stringValue=S.stringValue),S.boolValue!=null&&S.hasOwnProperty("boolValue")&&(A.boolValue=S.boolValue),S.uintValue!=null&&S.hasOwnProperty("uintValue")&&(typeof S.uintValue=="number"?A.uintValue=R.longs===String?String(S.uintValue):S.uintValue:A.uintValue=R.longs===String?w.Long.prototype.toString.call(S.uintValue):R.longs===Number?new w.LongBits(S.uintValue.low>>>0,S.uintValue.high>>>0).toNumber(!0):S.uintValue),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkDimensionValue"},_}(),T.SdkDataMessageFrame=function(){function _(S){if(this.messages=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.messages=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.messages!=null&&S.messages.length)for(var A=0;A<S.messages.length;++A)T.SdkDataMessagePayload.encode(S.messages[A],R.uint32(10).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkDataMessageFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.messages&&O.messages.length||(O.messages=[]),O.messages.push(T.SdkDataMessagePayload.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.messages!=null&&S.hasOwnProperty("messages")){if(!Array.isArray(S.messages))return"messages: array expected";for(var R=0;R<S.messages.length;++R){var A=T.SdkDataMessagePayload.verify(S.messages[R]);if(A)return"messages."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkDataMessageFrame)return S;var R=new T.SdkDataMessageFrame;if(S.messages){if(!Array.isArray(S.messages))throw TypeError(".SdkDataMessageFrame.messages: array expected");R.messages=[];for(var A=0;A<S.messages.length;++A){if(typeof S.messages[A]!="object")throw TypeError(".SdkDataMessageFrame.messages: object expected");R.messages[A]=T.SdkDataMessagePayload.fromObject(S.messages[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.messages=[]),S.messages&&S.messages.length){A.messages=[];for(var O=0;O<S.messages.length;++O)A.messages[O]=T.SdkDataMessagePayload.toObject(S.messages[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkDataMessageFrame"},_}(),T.SdkDataMessagePayload=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.topic="",_.prototype.data=w.newBuffer([]),_.prototype.lifetimeMs=0,_.prototype.senderAttendeeId="",_.prototype.ingestTimeNs=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.senderExternalUserId="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.topic!=null&&Object.hasOwnProperty.call(S,"topic")&&R.uint32(10).string(S.topic),S.data!=null&&Object.hasOwnProperty.call(S,"data")&&R.uint32(18).bytes(S.data),S.lifetimeMs!=null&&Object.hasOwnProperty.call(S,"lifetimeMs")&&R.uint32(24).uint32(S.lifetimeMs),S.senderAttendeeId!=null&&Object.hasOwnProperty.call(S,"senderAttendeeId")&&R.uint32(34).string(S.senderAttendeeId),S.ingestTimeNs!=null&&Object.hasOwnProperty.call(S,"ingestTimeNs")&&R.uint32(40).int64(S.ingestTimeNs),S.senderExternalUserId!=null&&Object.hasOwnProperty.call(S,"senderExternalUserId")&&R.uint32(50).string(S.senderExternalUserId),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkDataMessagePayload;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.topic=S.string();break}case 2:{O.data=S.bytes();break}case 3:{O.lifetimeMs=S.uint32();break}case 4:{O.senderAttendeeId=S.string();break}case 5:{O.ingestTimeNs=S.int64();break}case 6:{O.senderExternalUserId=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.topic!=null&&S.hasOwnProperty("topic")&&!w.isString(S.topic)?"topic: string expected":S.data!=null&&S.hasOwnProperty("data")&&!(S.data&&typeof S.data.length=="number"||w.isString(S.data))?"data: buffer expected":S.lifetimeMs!=null&&S.hasOwnProperty("lifetimeMs")&&!w.isInteger(S.lifetimeMs)?"lifetimeMs: integer expected":S.senderAttendeeId!=null&&S.hasOwnProperty("senderAttendeeId")&&!w.isString(S.senderAttendeeId)?"senderAttendeeId: string expected":S.ingestTimeNs!=null&&S.hasOwnProperty("ingestTimeNs")&&!w.isInteger(S.ingestTimeNs)&&!(S.ingestTimeNs&&w.isInteger(S.ingestTimeNs.low)&&w.isInteger(S.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":S.senderExternalUserId!=null&&S.hasOwnProperty("senderExternalUserId")&&!w.isString(S.senderExternalUserId)?"senderExternalUserId: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkDataMessagePayload)return S;var R=new T.SdkDataMessagePayload;return S.topic!=null&&(R.topic=String(S.topic)),S.data!=null&&(typeof S.data=="string"?w.base64.decode(S.data,R.data=w.newBuffer(w.base64.length(S.data)),0):S.data.length>=0&&(R.data=S.data)),S.lifetimeMs!=null&&(R.lifetimeMs=S.lifetimeMs>>>0),S.senderAttendeeId!=null&&(R.senderAttendeeId=String(S.senderAttendeeId)),S.ingestTimeNs!=null&&(w.Long?(R.ingestTimeNs=w.Long.fromValue(S.ingestTimeNs)).unsigned=!1:typeof S.ingestTimeNs=="string"?R.ingestTimeNs=parseInt(S.ingestTimeNs,10):typeof S.ingestTimeNs=="number"?R.ingestTimeNs=S.ingestTimeNs:typeof S.ingestTimeNs=="object"&&(R.ingestTimeNs=new w.LongBits(S.ingestTimeNs.low>>>0,S.ingestTimeNs.high>>>0).toNumber())),S.senderExternalUserId!=null&&(R.senderExternalUserId=String(S.senderExternalUserId)),R},_.toObject=function(S,R){R||(R={});var A={};if(R.defaults){if(A.topic="",R.bytes===String?A.data="":(A.data=[],R.bytes!==Array&&(A.data=w.newBuffer(A.data))),A.lifetimeMs=0,A.senderAttendeeId="",w.Long){var O=new w.Long(0,0,!1);A.ingestTimeNs=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.ingestTimeNs=R.longs===String?"0":0;A.senderExternalUserId=""}return S.topic!=null&&S.hasOwnProperty("topic")&&(A.topic=S.topic),S.data!=null&&S.hasOwnProperty("data")&&(A.data=R.bytes===String?w.base64.encode(S.data,0,S.data.length):R.bytes===Array?Array.prototype.slice.call(S.data):S.data),S.lifetimeMs!=null&&S.hasOwnProperty("lifetimeMs")&&(A.lifetimeMs=S.lifetimeMs),S.senderAttendeeId!=null&&S.hasOwnProperty("senderAttendeeId")&&(A.senderAttendeeId=S.senderAttendeeId),S.ingestTimeNs!=null&&S.hasOwnProperty("ingestTimeNs")&&(typeof S.ingestTimeNs=="number"?A.ingestTimeNs=R.longs===String?String(S.ingestTimeNs):S.ingestTimeNs:A.ingestTimeNs=R.longs===String?w.Long.prototype.toString.call(S.ingestTimeNs):R.longs===Number?new w.LongBits(S.ingestTimeNs.low>>>0,S.ingestTimeNs.high>>>0).toNumber():S.ingestTimeNs),S.senderExternalUserId!=null&&S.hasOwnProperty("senderExternalUserId")&&(A.senderExternalUserId=S.senderExternalUserId),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkDataMessagePayload"},_}(),T.SdkTurnCredentials=function(){function _(S){if(this.uris=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.username="",_.prototype.password="",_.prototype.ttl=0,_.prototype.uris=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.username!=null&&Object.hasOwnProperty.call(S,"username")&&R.uint32(10).string(S.username),S.password!=null&&Object.hasOwnProperty.call(S,"password")&&R.uint32(18).string(S.password),S.ttl!=null&&Object.hasOwnProperty.call(S,"ttl")&&R.uint32(24).uint32(S.ttl),S.uris!=null&&S.uris.length)for(var A=0;A<S.uris.length;++A)R.uint32(34).string(S.uris[A]);return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTurnCredentials;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.username=S.string();break}case 2:{O.password=S.string();break}case 3:{O.ttl=S.uint32();break}case 4:{O.uris&&O.uris.length||(O.uris=[]),O.uris.push(S.string());break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.username!=null&&S.hasOwnProperty("username")&&!w.isString(S.username))return"username: string expected";if(S.password!=null&&S.hasOwnProperty("password")&&!w.isString(S.password))return"password: string expected";if(S.ttl!=null&&S.hasOwnProperty("ttl")&&!w.isInteger(S.ttl))return"ttl: integer expected";if(S.uris!=null&&S.hasOwnProperty("uris")){if(!Array.isArray(S.uris))return"uris: array expected";for(var R=0;R<S.uris.length;++R)if(!w.isString(S.uris[R]))return"uris: string[] expected"}return null},_.fromObject=function(S){if(S instanceof T.SdkTurnCredentials)return S;var R=new T.SdkTurnCredentials;if(S.username!=null&&(R.username=String(S.username)),S.password!=null&&(R.password=String(S.password)),S.ttl!=null&&(R.ttl=S.ttl>>>0),S.uris){if(!Array.isArray(S.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");R.uris=[];for(var A=0;A<S.uris.length;++A)R.uris[A]=String(S.uris[A])}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.uris=[]),R.defaults&&(A.username="",A.password="",A.ttl=0),S.username!=null&&S.hasOwnProperty("username")&&(A.username=S.username),S.password!=null&&S.hasOwnProperty("password")&&(A.password=S.password),S.ttl!=null&&S.hasOwnProperty("ttl")&&(A.ttl=S.ttl),S.uris&&S.uris.length){A.uris=[];for(var O=0;O<S.uris.length;++O)A.uris[O]=S.uris[O]}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTurnCredentials"},_}(),T.SdkTranscriptItem=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.content="",_.prototype.endTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.speakerAttendeeId="",_.prototype.speakerExternalUserId="",_.prototype.startTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.type=1,_.prototype.vocabularyFilterMatch=!1,_.prototype.confidence=0,_.prototype.stable=!1,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.content!=null&&Object.hasOwnProperty.call(S,"content")&&R.uint32(10).string(S.content),S.endTime!=null&&Object.hasOwnProperty.call(S,"endTime")&&R.uint32(16).int64(S.endTime),S.speakerAttendeeId!=null&&Object.hasOwnProperty.call(S,"speakerAttendeeId")&&R.uint32(26).string(S.speakerAttendeeId),S.speakerExternalUserId!=null&&Object.hasOwnProperty.call(S,"speakerExternalUserId")&&R.uint32(34).string(S.speakerExternalUserId),S.startTime!=null&&Object.hasOwnProperty.call(S,"startTime")&&R.uint32(40).int64(S.startTime),S.type!=null&&Object.hasOwnProperty.call(S,"type")&&R.uint32(48).int32(S.type),S.vocabularyFilterMatch!=null&&Object.hasOwnProperty.call(S,"vocabularyFilterMatch")&&R.uint32(56).bool(S.vocabularyFilterMatch),S.confidence!=null&&Object.hasOwnProperty.call(S,"confidence")&&R.uint32(65).double(S.confidence),S.stable!=null&&Object.hasOwnProperty.call(S,"stable")&&R.uint32(72).bool(S.stable),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptItem;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.content=S.string();break}case 2:{O.endTime=S.int64();break}case 3:{O.speakerAttendeeId=S.string();break}case 4:{O.speakerExternalUserId=S.string();break}case 5:{O.startTime=S.int64();break}case 6:{O.type=S.int32();break}case 7:{O.vocabularyFilterMatch=S.bool();break}case 8:{O.confidence=S.double();break}case 9:{O.stable=S.bool();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.content!=null&&S.hasOwnProperty("content")&&!w.isString(S.content))return"content: string expected";if(S.endTime!=null&&S.hasOwnProperty("endTime")&&!w.isInteger(S.endTime)&&!(S.endTime&&w.isInteger(S.endTime.low)&&w.isInteger(S.endTime.high)))return"endTime: integer|Long expected";if(S.speakerAttendeeId!=null&&S.hasOwnProperty("speakerAttendeeId")&&!w.isString(S.speakerAttendeeId))return"speakerAttendeeId: string expected";if(S.speakerExternalUserId!=null&&S.hasOwnProperty("speakerExternalUserId")&&!w.isString(S.speakerExternalUserId))return"speakerExternalUserId: string expected";if(S.startTime!=null&&S.hasOwnProperty("startTime")&&!w.isInteger(S.startTime)&&!(S.startTime&&w.isInteger(S.startTime.low)&&w.isInteger(S.startTime.high)))return"startTime: integer|Long expected";if(S.type!=null&&S.hasOwnProperty("type"))switch(S.type){default:return"type: enum value expected";case 1:case 2:break}return S.vocabularyFilterMatch!=null&&S.hasOwnProperty("vocabularyFilterMatch")&&typeof S.vocabularyFilterMatch!="boolean"?"vocabularyFilterMatch: boolean expected":S.confidence!=null&&S.hasOwnProperty("confidence")&&typeof S.confidence!="number"?"confidence: number expected":S.stable!=null&&S.hasOwnProperty("stable")&&typeof S.stable!="boolean"?"stable: boolean expected":null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptItem)return S;var R=new T.SdkTranscriptItem;switch(S.content!=null&&(R.content=String(S.content)),S.endTime!=null&&(w.Long?(R.endTime=w.Long.fromValue(S.endTime)).unsigned=!1:typeof S.endTime=="string"?R.endTime=parseInt(S.endTime,10):typeof S.endTime=="number"?R.endTime=S.endTime:typeof S.endTime=="object"&&(R.endTime=new w.LongBits(S.endTime.low>>>0,S.endTime.high>>>0).toNumber())),S.speakerAttendeeId!=null&&(R.speakerAttendeeId=String(S.speakerAttendeeId)),S.speakerExternalUserId!=null&&(R.speakerExternalUserId=String(S.speakerExternalUserId)),S.startTime!=null&&(w.Long?(R.startTime=w.Long.fromValue(S.startTime)).unsigned=!1:typeof S.startTime=="string"?R.startTime=parseInt(S.startTime,10):typeof S.startTime=="number"?R.startTime=S.startTime:typeof S.startTime=="object"&&(R.startTime=new w.LongBits(S.startTime.low>>>0,S.startTime.high>>>0).toNumber())),S.type){default:if(typeof S.type=="number"){R.type=S.type;break}break;case"PRONUNCIATION":case 1:R.type=1;break;case"PUNCTUATION":case 2:R.type=2;break}return S.vocabularyFilterMatch!=null&&(R.vocabularyFilterMatch=!!S.vocabularyFilterMatch),S.confidence!=null&&(R.confidence=Number(S.confidence)),S.stable!=null&&(R.stable=!!S.stable),R},_.toObject=function(S,R){R||(R={});var A={};if(R.defaults){if(A.content="",w.Long){var O=new w.Long(0,0,!1);A.endTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.endTime=R.longs===String?"0":0;if(A.speakerAttendeeId="",A.speakerExternalUserId="",w.Long){var O=new w.Long(0,0,!1);A.startTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.startTime=R.longs===String?"0":0;A.type=R.enums===String?"PRONUNCIATION":1,A.vocabularyFilterMatch=!1,A.confidence=0,A.stable=!1}return S.content!=null&&S.hasOwnProperty("content")&&(A.content=S.content),S.endTime!=null&&S.hasOwnProperty("endTime")&&(typeof S.endTime=="number"?A.endTime=R.longs===String?String(S.endTime):S.endTime:A.endTime=R.longs===String?w.Long.prototype.toString.call(S.endTime):R.longs===Number?new w.LongBits(S.endTime.low>>>0,S.endTime.high>>>0).toNumber():S.endTime),S.speakerAttendeeId!=null&&S.hasOwnProperty("speakerAttendeeId")&&(A.speakerAttendeeId=S.speakerAttendeeId),S.speakerExternalUserId!=null&&S.hasOwnProperty("speakerExternalUserId")&&(A.speakerExternalUserId=S.speakerExternalUserId),S.startTime!=null&&S.hasOwnProperty("startTime")&&(typeof S.startTime=="number"?A.startTime=R.longs===String?String(S.startTime):S.startTime:A.startTime=R.longs===String?w.Long.prototype.toString.call(S.startTime):R.longs===Number?new w.LongBits(S.startTime.low>>>0,S.startTime.high>>>0).toNumber():S.startTime),S.type!=null&&S.hasOwnProperty("type")&&(A.type=R.enums===String?T.SdkTranscriptItem.Type[S.type]===void 0?S.type:T.SdkTranscriptItem.Type[S.type]:S.type),S.vocabularyFilterMatch!=null&&S.hasOwnProperty("vocabularyFilterMatch")&&(A.vocabularyFilterMatch=S.vocabularyFilterMatch),S.confidence!=null&&S.hasOwnProperty("confidence")&&(A.confidence=R.json&&!isFinite(S.confidence)?String(S.confidence):S.confidence),S.stable!=null&&S.hasOwnProperty("stable")&&(A.stable=S.stable),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptItem"},_.Type=function(){var S={},R=Object.create(S);return R[S[1]="PRONUNCIATION"]=1,R[S[2]="PUNCTUATION"]=2,R}(),_}(),T.SdkTranscriptEntity=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.category="",_.prototype.confidence=0,_.prototype.content="",_.prototype.endTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.startTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.type="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.category!=null&&Object.hasOwnProperty.call(S,"category")&&R.uint32(10).string(S.category),S.confidence!=null&&Object.hasOwnProperty.call(S,"confidence")&&R.uint32(17).double(S.confidence),S.content!=null&&Object.hasOwnProperty.call(S,"content")&&R.uint32(26).string(S.content),S.endTime!=null&&Object.hasOwnProperty.call(S,"endTime")&&R.uint32(32).int64(S.endTime),S.startTime!=null&&Object.hasOwnProperty.call(S,"startTime")&&R.uint32(40).int64(S.startTime),S.type!=null&&Object.hasOwnProperty.call(S,"type")&&R.uint32(50).string(S.type),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptEntity;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.category=S.string();break}case 2:{O.confidence=S.double();break}case 3:{O.content=S.string();break}case 4:{O.endTime=S.int64();break}case 5:{O.startTime=S.int64();break}case 6:{O.type=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.category!=null&&S.hasOwnProperty("category")&&!w.isString(S.category)?"category: string expected":S.confidence!=null&&S.hasOwnProperty("confidence")&&typeof S.confidence!="number"?"confidence: number expected":S.content!=null&&S.hasOwnProperty("content")&&!w.isString(S.content)?"content: string expected":S.endTime!=null&&S.hasOwnProperty("endTime")&&!w.isInteger(S.endTime)&&!(S.endTime&&w.isInteger(S.endTime.low)&&w.isInteger(S.endTime.high))?"endTime: integer|Long expected":S.startTime!=null&&S.hasOwnProperty("startTime")&&!w.isInteger(S.startTime)&&!(S.startTime&&w.isInteger(S.startTime.low)&&w.isInteger(S.startTime.high))?"startTime: integer|Long expected":S.type!=null&&S.hasOwnProperty("type")&&!w.isString(S.type)?"type: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptEntity)return S;var R=new T.SdkTranscriptEntity;return S.category!=null&&(R.category=String(S.category)),S.confidence!=null&&(R.confidence=Number(S.confidence)),S.content!=null&&(R.content=String(S.content)),S.endTime!=null&&(w.Long?(R.endTime=w.Long.fromValue(S.endTime)).unsigned=!1:typeof S.endTime=="string"?R.endTime=parseInt(S.endTime,10):typeof S.endTime=="number"?R.endTime=S.endTime:typeof S.endTime=="object"&&(R.endTime=new w.LongBits(S.endTime.low>>>0,S.endTime.high>>>0).toNumber())),S.startTime!=null&&(w.Long?(R.startTime=w.Long.fromValue(S.startTime)).unsigned=!1:typeof S.startTime=="string"?R.startTime=parseInt(S.startTime,10):typeof S.startTime=="number"?R.startTime=S.startTime:typeof S.startTime=="object"&&(R.startTime=new w.LongBits(S.startTime.low>>>0,S.startTime.high>>>0).toNumber())),S.type!=null&&(R.type=String(S.type)),R},_.toObject=function(S,R){R||(R={});var A={};if(R.defaults){if(A.category="",A.confidence=0,A.content="",w.Long){var O=new w.Long(0,0,!1);A.endTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.endTime=R.longs===String?"0":0;if(w.Long){var O=new w.Long(0,0,!1);A.startTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.startTime=R.longs===String?"0":0;A.type=""}return S.category!=null&&S.hasOwnProperty("category")&&(A.category=S.category),S.confidence!=null&&S.hasOwnProperty("confidence")&&(A.confidence=R.json&&!isFinite(S.confidence)?String(S.confidence):S.confidence),S.content!=null&&S.hasOwnProperty("content")&&(A.content=S.content),S.endTime!=null&&S.hasOwnProperty("endTime")&&(typeof S.endTime=="number"?A.endTime=R.longs===String?String(S.endTime):S.endTime:A.endTime=R.longs===String?w.Long.prototype.toString.call(S.endTime):R.longs===Number?new w.LongBits(S.endTime.low>>>0,S.endTime.high>>>0).toNumber():S.endTime),S.startTime!=null&&S.hasOwnProperty("startTime")&&(typeof S.startTime=="number"?A.startTime=R.longs===String?String(S.startTime):S.startTime:A.startTime=R.longs===String?w.Long.prototype.toString.call(S.startTime):R.longs===Number?new w.LongBits(S.startTime.low>>>0,S.startTime.high>>>0).toNumber():S.startTime),S.type!=null&&S.hasOwnProperty("type")&&(A.type=S.type),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptEntity"},_}(),T.SdkTranscriptAlternative=function(){function _(S){if(this.items=[],this.entities=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.items=w.emptyArray,_.prototype.transcript="",_.prototype.entities=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.items!=null&&S.items.length)for(var A=0;A<S.items.length;++A)T.SdkTranscriptItem.encode(S.items[A],R.uint32(10).fork()).ldelim();if(S.transcript!=null&&Object.hasOwnProperty.call(S,"transcript")&&R.uint32(18).string(S.transcript),S.entities!=null&&S.entities.length)for(var A=0;A<S.entities.length;++A)T.SdkTranscriptEntity.encode(S.entities[A],R.uint32(26).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptAlternative;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.items&&O.items.length||(O.items=[]),O.items.push(T.SdkTranscriptItem.decode(S,S.uint32()));break}case 2:{O.transcript=S.string();break}case 3:{O.entities&&O.entities.length||(O.entities=[]),O.entities.push(T.SdkTranscriptEntity.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.items!=null&&S.hasOwnProperty("items")){if(!Array.isArray(S.items))return"items: array expected";for(var R=0;R<S.items.length;++R){var A=T.SdkTranscriptItem.verify(S.items[R]);if(A)return"items."+A}}if(S.transcript!=null&&S.hasOwnProperty("transcript")&&!w.isString(S.transcript))return"transcript: string expected";if(S.entities!=null&&S.hasOwnProperty("entities")){if(!Array.isArray(S.entities))return"entities: array expected";for(var R=0;R<S.entities.length;++R){var A=T.SdkTranscriptEntity.verify(S.entities[R]);if(A)return"entities."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptAlternative)return S;var R=new T.SdkTranscriptAlternative;if(S.items){if(!Array.isArray(S.items))throw TypeError(".SdkTranscriptAlternative.items: array expected");R.items=[];for(var A=0;A<S.items.length;++A){if(typeof S.items[A]!="object")throw TypeError(".SdkTranscriptAlternative.items: object expected");R.items[A]=T.SdkTranscriptItem.fromObject(S.items[A])}}if(S.transcript!=null&&(R.transcript=String(S.transcript)),S.entities){if(!Array.isArray(S.entities))throw TypeError(".SdkTranscriptAlternative.entities: array expected");R.entities=[];for(var A=0;A<S.entities.length;++A){if(typeof S.entities[A]!="object")throw TypeError(".SdkTranscriptAlternative.entities: object expected");R.entities[A]=T.SdkTranscriptEntity.fromObject(S.entities[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.items=[],A.entities=[]),R.defaults&&(A.transcript=""),S.items&&S.items.length){A.items=[];for(var O=0;O<S.items.length;++O)A.items[O]=T.SdkTranscriptItem.toObject(S.items[O],R)}if(S.transcript!=null&&S.hasOwnProperty("transcript")&&(A.transcript=S.transcript),S.entities&&S.entities.length){A.entities=[];for(var O=0;O<S.entities.length;++O)A.entities[O]=T.SdkTranscriptEntity.toObject(S.entities[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptAlternative"},_}(),T.SdkTranscriptLanguageWithScore=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.languageCode="",_.prototype.score=0,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.languageCode!=null&&Object.hasOwnProperty.call(S,"languageCode")&&R.uint32(10).string(S.languageCode),S.score!=null&&Object.hasOwnProperty.call(S,"score")&&R.uint32(17).double(S.score),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptLanguageWithScore;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.languageCode=S.string();break}case 2:{O.score=S.double();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.languageCode!=null&&S.hasOwnProperty("languageCode")&&!w.isString(S.languageCode)?"languageCode: string expected":S.score!=null&&S.hasOwnProperty("score")&&typeof S.score!="number"?"score: number expected":null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptLanguageWithScore)return S;var R=new T.SdkTranscriptLanguageWithScore;return S.languageCode!=null&&(R.languageCode=String(S.languageCode)),S.score!=null&&(R.score=Number(S.score)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.languageCode="",A.score=0),S.languageCode!=null&&S.hasOwnProperty("languageCode")&&(A.languageCode=S.languageCode),S.score!=null&&S.hasOwnProperty("score")&&(A.score=R.json&&!isFinite(S.score)?String(S.score):S.score),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptLanguageWithScore"},_}(),T.SdkTranscriptResult=function(){function _(S){if(this.alternatives=[],this.languageIdentification=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.alternatives=w.emptyArray,_.prototype.channelId="",_.prototype.endTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.isPartial=!1,_.prototype.resultId="",_.prototype.startTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.languageCode="",_.prototype.languageIdentification=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.alternatives!=null&&S.alternatives.length)for(var A=0;A<S.alternatives.length;++A)T.SdkTranscriptAlternative.encode(S.alternatives[A],R.uint32(10).fork()).ldelim();if(S.channelId!=null&&Object.hasOwnProperty.call(S,"channelId")&&R.uint32(18).string(S.channelId),S.endTime!=null&&Object.hasOwnProperty.call(S,"endTime")&&R.uint32(24).int64(S.endTime),S.isPartial!=null&&Object.hasOwnProperty.call(S,"isPartial")&&R.uint32(32).bool(S.isPartial),S.resultId!=null&&Object.hasOwnProperty.call(S,"resultId")&&R.uint32(42).string(S.resultId),S.startTime!=null&&Object.hasOwnProperty.call(S,"startTime")&&R.uint32(48).int64(S.startTime),S.languageCode!=null&&Object.hasOwnProperty.call(S,"languageCode")&&R.uint32(58).string(S.languageCode),S.languageIdentification!=null&&S.languageIdentification.length)for(var A=0;A<S.languageIdentification.length;++A)T.SdkTranscriptLanguageWithScore.encode(S.languageIdentification[A],R.uint32(66).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptResult;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.alternatives&&O.alternatives.length||(O.alternatives=[]),O.alternatives.push(T.SdkTranscriptAlternative.decode(S,S.uint32()));break}case 2:{O.channelId=S.string();break}case 3:{O.endTime=S.int64();break}case 4:{O.isPartial=S.bool();break}case 5:{O.resultId=S.string();break}case 6:{O.startTime=S.int64();break}case 7:{O.languageCode=S.string();break}case 8:{O.languageIdentification&&O.languageIdentification.length||(O.languageIdentification=[]),O.languageIdentification.push(T.SdkTranscriptLanguageWithScore.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.alternatives!=null&&S.hasOwnProperty("alternatives")){if(!Array.isArray(S.alternatives))return"alternatives: array expected";for(var R=0;R<S.alternatives.length;++R){var A=T.SdkTranscriptAlternative.verify(S.alternatives[R]);if(A)return"alternatives."+A}}if(S.channelId!=null&&S.hasOwnProperty("channelId")&&!w.isString(S.channelId))return"channelId: string expected";if(S.endTime!=null&&S.hasOwnProperty("endTime")&&!w.isInteger(S.endTime)&&!(S.endTime&&w.isInteger(S.endTime.low)&&w.isInteger(S.endTime.high)))return"endTime: integer|Long expected";if(S.isPartial!=null&&S.hasOwnProperty("isPartial")&&typeof S.isPartial!="boolean")return"isPartial: boolean expected";if(S.resultId!=null&&S.hasOwnProperty("resultId")&&!w.isString(S.resultId))return"resultId: string expected";if(S.startTime!=null&&S.hasOwnProperty("startTime")&&!w.isInteger(S.startTime)&&!(S.startTime&&w.isInteger(S.startTime.low)&&w.isInteger(S.startTime.high)))return"startTime: integer|Long expected";if(S.languageCode!=null&&S.hasOwnProperty("languageCode")&&!w.isString(S.languageCode))return"languageCode: string expected";if(S.languageIdentification!=null&&S.hasOwnProperty("languageIdentification")){if(!Array.isArray(S.languageIdentification))return"languageIdentification: array expected";for(var R=0;R<S.languageIdentification.length;++R){var A=T.SdkTranscriptLanguageWithScore.verify(S.languageIdentification[R]);if(A)return"languageIdentification."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptResult)return S;var R=new T.SdkTranscriptResult;if(S.alternatives){if(!Array.isArray(S.alternatives))throw TypeError(".SdkTranscriptResult.alternatives: array expected");R.alternatives=[];for(var A=0;A<S.alternatives.length;++A){if(typeof S.alternatives[A]!="object")throw TypeError(".SdkTranscriptResult.alternatives: object expected");R.alternatives[A]=T.SdkTranscriptAlternative.fromObject(S.alternatives[A])}}if(S.channelId!=null&&(R.channelId=String(S.channelId)),S.endTime!=null&&(w.Long?(R.endTime=w.Long.fromValue(S.endTime)).unsigned=!1:typeof S.endTime=="string"?R.endTime=parseInt(S.endTime,10):typeof S.endTime=="number"?R.endTime=S.endTime:typeof S.endTime=="object"&&(R.endTime=new w.LongBits(S.endTime.low>>>0,S.endTime.high>>>0).toNumber())),S.isPartial!=null&&(R.isPartial=!!S.isPartial),S.resultId!=null&&(R.resultId=String(S.resultId)),S.startTime!=null&&(w.Long?(R.startTime=w.Long.fromValue(S.startTime)).unsigned=!1:typeof S.startTime=="string"?R.startTime=parseInt(S.startTime,10):typeof S.startTime=="number"?R.startTime=S.startTime:typeof S.startTime=="object"&&(R.startTime=new w.LongBits(S.startTime.low>>>0,S.startTime.high>>>0).toNumber())),S.languageCode!=null&&(R.languageCode=String(S.languageCode)),S.languageIdentification){if(!Array.isArray(S.languageIdentification))throw TypeError(".SdkTranscriptResult.languageIdentification: array expected");R.languageIdentification=[];for(var A=0;A<S.languageIdentification.length;++A){if(typeof S.languageIdentification[A]!="object")throw TypeError(".SdkTranscriptResult.languageIdentification: object expected");R.languageIdentification[A]=T.SdkTranscriptLanguageWithScore.fromObject(S.languageIdentification[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.alternatives=[],A.languageIdentification=[]),R.defaults){if(A.channelId="",w.Long){var O=new w.Long(0,0,!1);A.endTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.endTime=R.longs===String?"0":0;if(A.isPartial=!1,A.resultId="",w.Long){var O=new w.Long(0,0,!1);A.startTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.startTime=R.longs===String?"0":0;A.languageCode=""}if(S.alternatives&&S.alternatives.length){A.alternatives=[];for(var H=0;H<S.alternatives.length;++H)A.alternatives[H]=T.SdkTranscriptAlternative.toObject(S.alternatives[H],R)}if(S.channelId!=null&&S.hasOwnProperty("channelId")&&(A.channelId=S.channelId),S.endTime!=null&&S.hasOwnProperty("endTime")&&(typeof S.endTime=="number"?A.endTime=R.longs===String?String(S.endTime):S.endTime:A.endTime=R.longs===String?w.Long.prototype.toString.call(S.endTime):R.longs===Number?new w.LongBits(S.endTime.low>>>0,S.endTime.high>>>0).toNumber():S.endTime),S.isPartial!=null&&S.hasOwnProperty("isPartial")&&(A.isPartial=S.isPartial),S.resultId!=null&&S.hasOwnProperty("resultId")&&(A.resultId=S.resultId),S.startTime!=null&&S.hasOwnProperty("startTime")&&(typeof S.startTime=="number"?A.startTime=R.longs===String?String(S.startTime):S.startTime:A.startTime=R.longs===String?w.Long.prototype.toString.call(S.startTime):R.longs===Number?new w.LongBits(S.startTime.low>>>0,S.startTime.high>>>0).toNumber():S.startTime),S.languageCode!=null&&S.hasOwnProperty("languageCode")&&(A.languageCode=S.languageCode),S.languageIdentification&&S.languageIdentification.length){A.languageIdentification=[];for(var H=0;H<S.languageIdentification.length;++H)A.languageIdentification[H]=T.SdkTranscriptLanguageWithScore.toObject(S.languageIdentification[H],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptResult"},_}(),T.SdkTranscript=function(){function _(S){if(this.results=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.results=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.results!=null&&S.results.length)for(var A=0;A<S.results.length;++A)T.SdkTranscriptResult.encode(S.results[A],R.uint32(10).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscript;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.results&&O.results.length||(O.results=[]),O.results.push(T.SdkTranscriptResult.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.results!=null&&S.hasOwnProperty("results")){if(!Array.isArray(S.results))return"results: array expected";for(var R=0;R<S.results.length;++R){var A=T.SdkTranscriptResult.verify(S.results[R]);if(A)return"results."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkTranscript)return S;var R=new T.SdkTranscript;if(S.results){if(!Array.isArray(S.results))throw TypeError(".SdkTranscript.results: array expected");R.results=[];for(var A=0;A<S.results.length;++A){if(typeof S.results[A]!="object")throw TypeError(".SdkTranscript.results: object expected");R.results[A]=T.SdkTranscriptResult.fromObject(S.results[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.results=[]),S.results&&S.results.length){A.results=[];for(var O=0;O<S.results.length;++O)A.results[O]=T.SdkTranscriptResult.toObject(S.results[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscript"},_}(),T.SdkTranscriptionStatus=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.type=1,_.prototype.eventTime=w.Long?w.Long.fromBits(0,0,!1):0,_.prototype.transcriptionRegion="",_.prototype.transcriptionConfiguration="",_.prototype.message="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.type!=null&&Object.hasOwnProperty.call(S,"type")&&R.uint32(8).int32(S.type),S.eventTime!=null&&Object.hasOwnProperty.call(S,"eventTime")&&R.uint32(16).int64(S.eventTime),S.transcriptionRegion!=null&&Object.hasOwnProperty.call(S,"transcriptionRegion")&&R.uint32(26).string(S.transcriptionRegion),S.transcriptionConfiguration!=null&&Object.hasOwnProperty.call(S,"transcriptionConfiguration")&&R.uint32(34).string(S.transcriptionConfiguration),S.message!=null&&Object.hasOwnProperty.call(S,"message")&&R.uint32(42).string(S.message),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptionStatus;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.type=S.int32();break}case 2:{O.eventTime=S.int64();break}case 3:{O.transcriptionRegion=S.string();break}case 4:{O.transcriptionConfiguration=S.string();break}case 5:{O.message=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.type!=null&&S.hasOwnProperty("type"))switch(S.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:break}return S.eventTime!=null&&S.hasOwnProperty("eventTime")&&!w.isInteger(S.eventTime)&&!(S.eventTime&&w.isInteger(S.eventTime.low)&&w.isInteger(S.eventTime.high))?"eventTime: integer|Long expected":S.transcriptionRegion!=null&&S.hasOwnProperty("transcriptionRegion")&&!w.isString(S.transcriptionRegion)?"transcriptionRegion: string expected":S.transcriptionConfiguration!=null&&S.hasOwnProperty("transcriptionConfiguration")&&!w.isString(S.transcriptionConfiguration)?"transcriptionConfiguration: string expected":S.message!=null&&S.hasOwnProperty("message")&&!w.isString(S.message)?"message: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptionStatus)return S;var R=new T.SdkTranscriptionStatus;switch(S.type){default:if(typeof S.type=="number"){R.type=S.type;break}break;case"STARTED":case 1:R.type=1;break;case"INTERRUPTED":case 2:R.type=2;break;case"RESUMED":case 3:R.type=3;break;case"STOPPED":case 4:R.type=4;break;case"FAILED":case 5:R.type=5;break}return S.eventTime!=null&&(w.Long?(R.eventTime=w.Long.fromValue(S.eventTime)).unsigned=!1:typeof S.eventTime=="string"?R.eventTime=parseInt(S.eventTime,10):typeof S.eventTime=="number"?R.eventTime=S.eventTime:typeof S.eventTime=="object"&&(R.eventTime=new w.LongBits(S.eventTime.low>>>0,S.eventTime.high>>>0).toNumber())),S.transcriptionRegion!=null&&(R.transcriptionRegion=String(S.transcriptionRegion)),S.transcriptionConfiguration!=null&&(R.transcriptionConfiguration=String(S.transcriptionConfiguration)),S.message!=null&&(R.message=String(S.message)),R},_.toObject=function(S,R){R||(R={});var A={};if(R.defaults){if(A.type=R.enums===String?"STARTED":1,w.Long){var O=new w.Long(0,0,!1);A.eventTime=R.longs===String?O.toString():R.longs===Number?O.toNumber():O}else A.eventTime=R.longs===String?"0":0;A.transcriptionRegion="",A.transcriptionConfiguration="",A.message=""}return S.type!=null&&S.hasOwnProperty("type")&&(A.type=R.enums===String?T.SdkTranscriptionStatus.Type[S.type]===void 0?S.type:T.SdkTranscriptionStatus.Type[S.type]:S.type),S.eventTime!=null&&S.hasOwnProperty("eventTime")&&(typeof S.eventTime=="number"?A.eventTime=R.longs===String?String(S.eventTime):S.eventTime:A.eventTime=R.longs===String?w.Long.prototype.toString.call(S.eventTime):R.longs===Number?new w.LongBits(S.eventTime.low>>>0,S.eventTime.high>>>0).toNumber():S.eventTime),S.transcriptionRegion!=null&&S.hasOwnProperty("transcriptionRegion")&&(A.transcriptionRegion=S.transcriptionRegion),S.transcriptionConfiguration!=null&&S.hasOwnProperty("transcriptionConfiguration")&&(A.transcriptionConfiguration=S.transcriptionConfiguration),S.message!=null&&S.hasOwnProperty("message")&&(A.message=S.message),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptionStatus"},_.Type=function(){var S={},R=Object.create(S);return R[S[1]="STARTED"]=1,R[S[2]="INTERRUPTED"]=2,R[S[3]="RESUMED"]=3,R[S[4]="STOPPED"]=4,R[S[5]="FAILED"]=5,R}(),_}(),T.SdkTranscriptEvent=function(){function _(R){if(R)for(var A=Object.keys(R),O=0;O<A.length;++O)R[A[O]]!=null&&(this[A[O]]=R[A[O]])}_.prototype.status=null,_.prototype.transcript=null;var S;return Object.defineProperty(_.prototype,"Event",{get:w.oneOfGetter(S=["status","transcript"]),set:w.oneOfSetter(S)}),_.create=function(R){return new _(R)},_.encode=function(R,A){return A||(A=E.create()),R.status!=null&&Object.hasOwnProperty.call(R,"status")&&T.SdkTranscriptionStatus.encode(R.status,A.uint32(10).fork()).ldelim(),R.transcript!=null&&Object.hasOwnProperty.call(R,"transcript")&&T.SdkTranscript.encode(R.transcript,A.uint32(18).fork()).ldelim(),A},_.encodeDelimited=function(R,A){return this.encode(R,A).ldelim()},_.decode=function(R,A){R instanceof C||(R=C.create(R));for(var O=A===void 0?R.len:R.pos+A,H=new T.SdkTranscriptEvent;R.pos<O;){var ee=R.uint32();switch(ee>>>3){case 1:{H.status=T.SdkTranscriptionStatus.decode(R,R.uint32());break}case 2:{H.transcript=T.SdkTranscript.decode(R,R.uint32());break}default:R.skipType(ee&7);break}}return H},_.decodeDelimited=function(R){return R instanceof C||(R=new C(R)),this.decode(R,R.uint32())},_.verify=function(R){if(typeof R!="object"||R===null)return"object expected";var A={};if(R.status!=null&&R.hasOwnProperty("status")){A.Event=1;{var O=T.SdkTranscriptionStatus.verify(R.status);if(O)return"status."+O}}if(R.transcript!=null&&R.hasOwnProperty("transcript")){if(A.Event===1)return"Event: multiple values";A.Event=1;{var O=T.SdkTranscript.verify(R.transcript);if(O)return"transcript."+O}}return null},_.fromObject=function(R){if(R instanceof T.SdkTranscriptEvent)return R;var A=new T.SdkTranscriptEvent;if(R.status!=null){if(typeof R.status!="object")throw TypeError(".SdkTranscriptEvent.status: object expected");A.status=T.SdkTranscriptionStatus.fromObject(R.status)}if(R.transcript!=null){if(typeof R.transcript!="object")throw TypeError(".SdkTranscriptEvent.transcript: object expected");A.transcript=T.SdkTranscript.fromObject(R.transcript)}return A},_.toObject=function(R,A){A||(A={});var O={};return R.status!=null&&R.hasOwnProperty("status")&&(O.status=T.SdkTranscriptionStatus.toObject(R.status,A),A.oneofs&&(O.Event="status")),R.transcript!=null&&R.hasOwnProperty("transcript")&&(O.transcript=T.SdkTranscript.toObject(R.transcript,A),A.oneofs&&(O.Event="transcript")),O},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(R){return R===void 0&&(R="type.googleapis.com"),R+"/SdkTranscriptEvent"},_}(),T.SdkTranscriptFrame=function(){function _(S){if(this.events=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.events=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.events!=null&&S.events.length)for(var A=0;A<S.events.length;++A)T.SdkTranscriptEvent.encode(S.events[A],R.uint32(10).fork()).ldelim();return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkTranscriptFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.events&&O.events.length||(O.events=[]),O.events.push(T.SdkTranscriptEvent.decode(S,S.uint32()));break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.events!=null&&S.hasOwnProperty("events")){if(!Array.isArray(S.events))return"events: array expected";for(var R=0;R<S.events.length;++R){var A=T.SdkTranscriptEvent.verify(S.events[R]);if(A)return"events."+A}}return null},_.fromObject=function(S){if(S instanceof T.SdkTranscriptFrame)return S;var R=new T.SdkTranscriptFrame;if(S.events){if(!Array.isArray(S.events))throw TypeError(".SdkTranscriptFrame.events: array expected");R.events=[];for(var A=0;A<S.events.length;++A){if(typeof S.events[A]!="object")throw TypeError(".SdkTranscriptFrame.events: object expected");R.events[A]=T.SdkTranscriptEvent.fromObject(S.events[A])}}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.events=[]),S.events&&S.events.length){A.events=[];for(var O=0;O<S.events.length;++O)A.events[O]=T.SdkTranscriptEvent.toObject(S.events[O],R)}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkTranscriptFrame"},_}(),T.SdkRemoteVideoUpdateFrame=function(){function _(S){if(this.addedOrUpdatedVideoSubscriptions=[],this.removedVideoSubscriptionMids=[],S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.addedOrUpdatedVideoSubscriptions=w.emptyArray,_.prototype.removedVideoSubscriptionMids=w.emptyArray,_.create=function(S){return new _(S)},_.encode=function(S,R){if(R||(R=E.create()),S.addedOrUpdatedVideoSubscriptions!=null&&S.addedOrUpdatedVideoSubscriptions.length)for(var A=0;A<S.addedOrUpdatedVideoSubscriptions.length;++A)T.SdkVideoSubscriptionConfiguration.encode(S.addedOrUpdatedVideoSubscriptions[A],R.uint32(10).fork()).ldelim();if(S.removedVideoSubscriptionMids!=null&&S.removedVideoSubscriptionMids.length)for(var A=0;A<S.removedVideoSubscriptionMids.length;++A)R.uint32(18).string(S.removedVideoSubscriptionMids[A]);return R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkRemoteVideoUpdateFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.addedOrUpdatedVideoSubscriptions&&O.addedOrUpdatedVideoSubscriptions.length||(O.addedOrUpdatedVideoSubscriptions=[]),O.addedOrUpdatedVideoSubscriptions.push(T.SdkVideoSubscriptionConfiguration.decode(S,S.uint32()));break}case 2:{O.removedVideoSubscriptionMids&&O.removedVideoSubscriptionMids.length||(O.removedVideoSubscriptionMids=[]),O.removedVideoSubscriptionMids.push(S.string());break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.addedOrUpdatedVideoSubscriptions!=null&&S.hasOwnProperty("addedOrUpdatedVideoSubscriptions")){if(!Array.isArray(S.addedOrUpdatedVideoSubscriptions))return"addedOrUpdatedVideoSubscriptions: array expected";for(var R=0;R<S.addedOrUpdatedVideoSubscriptions.length;++R){var A=T.SdkVideoSubscriptionConfiguration.verify(S.addedOrUpdatedVideoSubscriptions[R]);if(A)return"addedOrUpdatedVideoSubscriptions."+A}}if(S.removedVideoSubscriptionMids!=null&&S.hasOwnProperty("removedVideoSubscriptionMids")){if(!Array.isArray(S.removedVideoSubscriptionMids))return"removedVideoSubscriptionMids: array expected";for(var R=0;R<S.removedVideoSubscriptionMids.length;++R)if(!w.isString(S.removedVideoSubscriptionMids[R]))return"removedVideoSubscriptionMids: string[] expected"}return null},_.fromObject=function(S){if(S instanceof T.SdkRemoteVideoUpdateFrame)return S;var R=new T.SdkRemoteVideoUpdateFrame;if(S.addedOrUpdatedVideoSubscriptions){if(!Array.isArray(S.addedOrUpdatedVideoSubscriptions))throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: array expected");R.addedOrUpdatedVideoSubscriptions=[];for(var A=0;A<S.addedOrUpdatedVideoSubscriptions.length;++A){if(typeof S.addedOrUpdatedVideoSubscriptions[A]!="object")throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: object expected");R.addedOrUpdatedVideoSubscriptions[A]=T.SdkVideoSubscriptionConfiguration.fromObject(S.addedOrUpdatedVideoSubscriptions[A])}}if(S.removedVideoSubscriptionMids){if(!Array.isArray(S.removedVideoSubscriptionMids))throw TypeError(".SdkRemoteVideoUpdateFrame.removedVideoSubscriptionMids: array expected");R.removedVideoSubscriptionMids=[];for(var A=0;A<S.removedVideoSubscriptionMids.length;++A)R.removedVideoSubscriptionMids[A]=String(S.removedVideoSubscriptionMids[A])}return R},_.toObject=function(S,R){R||(R={});var A={};if((R.arrays||R.defaults)&&(A.addedOrUpdatedVideoSubscriptions=[],A.removedVideoSubscriptionMids=[]),S.addedOrUpdatedVideoSubscriptions&&S.addedOrUpdatedVideoSubscriptions.length){A.addedOrUpdatedVideoSubscriptions=[];for(var O=0;O<S.addedOrUpdatedVideoSubscriptions.length;++O)A.addedOrUpdatedVideoSubscriptions[O]=T.SdkVideoSubscriptionConfiguration.toObject(S.addedOrUpdatedVideoSubscriptions[O],R)}if(S.removedVideoSubscriptionMids&&S.removedVideoSubscriptionMids.length){A.removedVideoSubscriptionMids=[];for(var O=0;O<S.removedVideoSubscriptionMids.length;++O)A.removedVideoSubscriptionMids[O]=S.removedVideoSubscriptionMids[O]}return A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkRemoteVideoUpdateFrame"},_}(),T.SdkVideoQualityAdaptationPreference=function(){var _={},S=Object.create(_);return S[_[1]="BALANCED"]=1,S[_[2]="MAINTAIN_FRAMERATE"]=2,S[_[3]="MAINTAIN_RESOLUTION"]=3,S}(),T.SdkVideoSubscriptionConfiguration=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.mid="",_.prototype.attendeeId="",_.prototype.streamId=0,_.prototype.priority=0,_.prototype.targetBitrateKbps=0,_.prototype.groupId=0,_.prototype.qualityAdaptationPreference=1,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R.uint32(10).string(S.mid),S.attendeeId!=null&&Object.hasOwnProperty.call(S,"attendeeId")&&R.uint32(18).string(S.attendeeId),S.streamId!=null&&Object.hasOwnProperty.call(S,"streamId")&&R.uint32(24).uint32(S.streamId),S.priority!=null&&Object.hasOwnProperty.call(S,"priority")&&R.uint32(32).uint32(S.priority),S.targetBitrateKbps!=null&&Object.hasOwnProperty.call(S,"targetBitrateKbps")&&R.uint32(40).uint32(S.targetBitrateKbps),S.groupId!=null&&Object.hasOwnProperty.call(S,"groupId")&&R.uint32(48).uint32(S.groupId),S.qualityAdaptationPreference!=null&&Object.hasOwnProperty.call(S,"qualityAdaptationPreference")&&R.uint32(56).int32(S.qualityAdaptationPreference),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkVideoSubscriptionConfiguration;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.mid=S.string();break}case 2:{O.attendeeId=S.string();break}case 3:{O.streamId=S.uint32();break}case 4:{O.priority=S.uint32();break}case 5:{O.targetBitrateKbps=S.uint32();break}case 6:{O.groupId=S.uint32();break}case 7:{O.qualityAdaptationPreference=S.int32();break}default:S.skipType(H&7);break}}if(!O.hasOwnProperty("mid"))throw w.ProtocolError("missing required 'mid'",{instance:O});return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(!w.isString(S.mid))return"mid: string expected";if(S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&!w.isString(S.attendeeId))return"attendeeId: string expected";if(S.streamId!=null&&S.hasOwnProperty("streamId")&&!w.isInteger(S.streamId))return"streamId: integer expected";if(S.priority!=null&&S.hasOwnProperty("priority")&&!w.isInteger(S.priority))return"priority: integer expected";if(S.targetBitrateKbps!=null&&S.hasOwnProperty("targetBitrateKbps")&&!w.isInteger(S.targetBitrateKbps))return"targetBitrateKbps: integer expected";if(S.groupId!=null&&S.hasOwnProperty("groupId")&&!w.isInteger(S.groupId))return"groupId: integer expected";if(S.qualityAdaptationPreference!=null&&S.hasOwnProperty("qualityAdaptationPreference"))switch(S.qualityAdaptationPreference){default:return"qualityAdaptationPreference: enum value expected";case 1:case 2:case 3:break}return null},_.fromObject=function(S){if(S instanceof T.SdkVideoSubscriptionConfiguration)return S;var R=new T.SdkVideoSubscriptionConfiguration;switch(S.mid!=null&&(R.mid=String(S.mid)),S.attendeeId!=null&&(R.attendeeId=String(S.attendeeId)),S.streamId!=null&&(R.streamId=S.streamId>>>0),S.priority!=null&&(R.priority=S.priority>>>0),S.targetBitrateKbps!=null&&(R.targetBitrateKbps=S.targetBitrateKbps>>>0),S.groupId!=null&&(R.groupId=S.groupId>>>0),S.qualityAdaptationPreference){default:if(typeof S.qualityAdaptationPreference=="number"){R.qualityAdaptationPreference=S.qualityAdaptationPreference;break}break;case"BALANCED":case 1:R.qualityAdaptationPreference=1;break;case"MAINTAIN_FRAMERATE":case 2:R.qualityAdaptationPreference=2;break;case"MAINTAIN_RESOLUTION":case 3:R.qualityAdaptationPreference=3;break}return R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.mid="",A.attendeeId="",A.streamId=0,A.priority=0,A.targetBitrateKbps=0,A.groupId=0,A.qualityAdaptationPreference=R.enums===String?"BALANCED":1),S.mid!=null&&S.hasOwnProperty("mid")&&(A.mid=S.mid),S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&(A.attendeeId=S.attendeeId),S.streamId!=null&&S.hasOwnProperty("streamId")&&(A.streamId=S.streamId),S.priority!=null&&S.hasOwnProperty("priority")&&(A.priority=S.priority),S.targetBitrateKbps!=null&&S.hasOwnProperty("targetBitrateKbps")&&(A.targetBitrateKbps=S.targetBitrateKbps),S.groupId!=null&&S.hasOwnProperty("groupId")&&(A.groupId=S.groupId),S.qualityAdaptationPreference!=null&&S.hasOwnProperty("qualityAdaptationPreference")&&(A.qualityAdaptationPreference=R.enums===String?T.SdkVideoQualityAdaptationPreference[S.qualityAdaptationPreference]===void 0?S.qualityAdaptationPreference:T.SdkVideoQualityAdaptationPreference[S.qualityAdaptationPreference]:S.qualityAdaptationPreference),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkVideoSubscriptionConfiguration"},_}(),T.SdkNotificationFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.level=3,_.prototype.message="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.level!=null&&Object.hasOwnProperty.call(S,"level")&&R.uint32(8).int32(S.level),S.message!=null&&Object.hasOwnProperty.call(S,"message")&&R.uint32(18).string(S.message),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkNotificationFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.level=S.int32();break}case 2:{O.message=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.level!=null&&S.hasOwnProperty("level"))switch(S.level){default:return"level: enum value expected";case 1:case 2:case 3:break}return S.message!=null&&S.hasOwnProperty("message")&&!w.isString(S.message)?"message: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkNotificationFrame)return S;var R=new T.SdkNotificationFrame;switch(S.level){case"INFO":case 1:R.level=1;break;case"WARNING":case 2:R.level=2;break;default:if(typeof S.level=="number"){R.level=S.level;break}break;case"ERROR":case 3:R.level=3;break}return S.message!=null&&(R.message=String(S.message)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.level=R.enums===String?"ERROR":3,A.message=""),S.level!=null&&S.hasOwnProperty("level")&&(A.level=R.enums===String?T.SdkNotificationFrame.NotificationLevel[S.level]===void 0?S.level:T.SdkNotificationFrame.NotificationLevel[S.level]:S.level),S.message!=null&&S.hasOwnProperty("message")&&(A.message=S.message),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkNotificationFrame"},_.NotificationLevel=function(){var S={},R=Object.create(S);return R[S[1]="INFO"]=1,R[S[2]="WARNING"]=2,R[S[3]="ERROR"]=3,R}(),_}(),T.SdkPrimaryMeetingJoinFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.credentials=null,_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.credentials!=null&&Object.hasOwnProperty.call(S,"credentials")&&T.SdkMeetingSessionCredentials.encode(S.credentials,R.uint32(10).fork()).ldelim(),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkPrimaryMeetingJoinFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.credentials=T.SdkMeetingSessionCredentials.decode(S,S.uint32());break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){if(typeof S!="object"||S===null)return"object expected";if(S.credentials!=null&&S.hasOwnProperty("credentials")){var R=T.SdkMeetingSessionCredentials.verify(S.credentials);if(R)return"credentials."+R}return null},_.fromObject=function(S){if(S instanceof T.SdkPrimaryMeetingJoinFrame)return S;var R=new T.SdkPrimaryMeetingJoinFrame;if(S.credentials!=null){if(typeof S.credentials!="object")throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");R.credentials=T.SdkMeetingSessionCredentials.fromObject(S.credentials)}return R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.credentials=null),S.credentials!=null&&S.hasOwnProperty("credentials")&&(A.credentials=T.SdkMeetingSessionCredentials.toObject(S.credentials,R)),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkPrimaryMeetingJoinFrame"},_}(),T.SdkPrimaryMeetingJoinAckFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkPrimaryMeetingJoinAckFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":null},_.fromObject=function(S){return S instanceof T.SdkPrimaryMeetingJoinAckFrame?S:new T.SdkPrimaryMeetingJoinAckFrame},_.toObject=function(){return{}},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkPrimaryMeetingJoinAckFrame"},_}(),T.SdkPrimaryMeetingLeaveFrame=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkPrimaryMeetingLeaveFrame;S.pos<A;){var H=S.uint32();switch(H>>>3){default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":null},_.fromObject=function(S){return S instanceof T.SdkPrimaryMeetingLeaveFrame?S:new T.SdkPrimaryMeetingLeaveFrame},_.toObject=function(){return{}},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkPrimaryMeetingLeaveFrame"},_}(),T.SdkMeetingSessionCredentials=function(){function _(S){if(S)for(var R=Object.keys(S),A=0;A<R.length;++A)S[R[A]]!=null&&(this[R[A]]=S[R[A]])}return _.prototype.attendeeId="",_.prototype.externalUserId="",_.prototype.joinToken="",_.create=function(S){return new _(S)},_.encode=function(S,R){return R||(R=E.create()),S.attendeeId!=null&&Object.hasOwnProperty.call(S,"attendeeId")&&R.uint32(10).string(S.attendeeId),S.externalUserId!=null&&Object.hasOwnProperty.call(S,"externalUserId")&&R.uint32(18).string(S.externalUserId),S.joinToken!=null&&Object.hasOwnProperty.call(S,"joinToken")&&R.uint32(26).string(S.joinToken),R},_.encodeDelimited=function(S,R){return this.encode(S,R).ldelim()},_.decode=function(S,R){S instanceof C||(S=C.create(S));for(var A=R===void 0?S.len:S.pos+R,O=new T.SdkMeetingSessionCredentials;S.pos<A;){var H=S.uint32();switch(H>>>3){case 1:{O.attendeeId=S.string();break}case 2:{O.externalUserId=S.string();break}case 3:{O.joinToken=S.string();break}default:S.skipType(H&7);break}}return O},_.decodeDelimited=function(S){return S instanceof C||(S=new C(S)),this.decode(S,S.uint32())},_.verify=function(S){return typeof S!="object"||S===null?"object expected":S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&!w.isString(S.attendeeId)?"attendeeId: string expected":S.externalUserId!=null&&S.hasOwnProperty("externalUserId")&&!w.isString(S.externalUserId)?"externalUserId: string expected":S.joinToken!=null&&S.hasOwnProperty("joinToken")&&!w.isString(S.joinToken)?"joinToken: string expected":null},_.fromObject=function(S){if(S instanceof T.SdkMeetingSessionCredentials)return S;var R=new T.SdkMeetingSessionCredentials;return S.attendeeId!=null&&(R.attendeeId=String(S.attendeeId)),S.externalUserId!=null&&(R.externalUserId=String(S.externalUserId)),S.joinToken!=null&&(R.joinToken=String(S.joinToken)),R},_.toObject=function(S,R){R||(R={});var A={};return R.defaults&&(A.attendeeId="",A.externalUserId="",A.joinToken=""),S.attendeeId!=null&&S.hasOwnProperty("attendeeId")&&(A.attendeeId=S.attendeeId),S.externalUserId!=null&&S.hasOwnProperty("externalUserId")&&(A.externalUserId=S.externalUserId),S.joinToken!=null&&S.hasOwnProperty("joinToken")&&(A.joinToken=S.joinToken),A},_.prototype.toJSON=function(){return this.constructor.toObject(this,x.util.toJSONOptions)},_.getTypeUrl=function(S){return S===void 0&&(S="type.googleapis.com"),S+"/SdkMeetingSessionCredentials"},_}(),T.SdkVideoCodecCapability=function(){var _={},S=Object.create(_);return S[_[1]="VP8"]=1,S[_[2]="H264_BASELINE_PROFILE"]=2,S[_[3]="H264_CONSTRAINED_BASELINE_PROFILE"]=3,S[_[4]="H264_MAIN_PROFILE"]=4,S[_[5]="H264_HIGH_PROFILE"]=5,S[_[6]="H264_CONSTRAINED_HIGH_PROFILE"]=6,S[_[8]="VP9_PROFILE_0"]=8,S[_[11]="AV1_MAIN_PROFILE"]=11,S}(),SignalingProtocol=T,w.Long=void 0,x.configure(),SignalingProtocol}var ClientMetricReportDirection={},hasRequiredClientMetricReportDirection;function requireClientMetricReportDirection(){return hasRequiredClientMetricReportDirection||(hasRequiredClientMetricReportDirection=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.ClientMetricReportDirection=void 0;var C;(function(E){E[E.UPSTREAM=0]="UPSTREAM",E[E.DOWNSTREAM=1]="DOWNSTREAM"})(C=x.ClientMetricReportDirection||(x.ClientMetricReportDirection={})),x.default=C}(ClientMetricReportDirection)),ClientMetricReportDirection}var ClientMetricReportMediaType={},hasRequiredClientMetricReportMediaType;function requireClientMetricReportMediaType(){return hasRequiredClientMetricReportMediaType||(hasRequiredClientMetricReportMediaType=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.ClientMetricReportMediaType=void 0;var C;(function(E){E[E.AUDIO=0]="AUDIO",E[E.VIDEO=1]="VIDEO"})(C=x.ClientMetricReportMediaType||(x.ClientMetricReportMediaType={})),x.default=C}(ClientMetricReportMediaType)),ClientMetricReportMediaType}var GlobalMetricReport={},hasRequiredGlobalMetricReport;function requireGlobalMetricReport(){if(hasRequiredGlobalMetricReport)return GlobalMetricReport;hasRequiredGlobalMetricReport=1,Object.defineProperty(GlobalMetricReport,"__esModule",{value:!0});let x=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}};return GlobalMetricReport.default=x,GlobalMetricReport}var hasRequiredClientMetricReport;function requireClientMetricReport(){if(hasRequiredClientMetricReport)return ClientMetricReport;hasRequiredClientMetricReport=1;var x=ClientMetricReport&&ClientMetricReport.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(ClientMetricReport,"__esModule",{value:!0});const C=requireSignalingProtocol(),E=x(requireClientMetricReportDirection()),w=x(requireClientMetricReportMediaType()),T=x(requireGlobalMetricReport());let _=class im{constructor(R,A,O){this.logger=R,this.videoStreamIndex=A,this.selfAttendeeId=O,this.globalMetricReport=new T.default,this.streamMetricReports={},this.rtcStatsReport={},this.customStatsReports=[],this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.overriddenObservableMetrics=new Map,this.identityValue=(H,ee)=>{const te=ee?this.streamMetricReports[ee]:this.globalMetricReport;return Number(te.currentMetrics[H])},this.decoderLossPercent=(H,ee)=>{const te=this.streamMetricReports[ee],ie=te.currentMetrics.concealedSamples-(te.previousMetrics.concealedSamples||0),ne=te.currentMetrics.totalSamplesReceived-(te.previousMetrics.totalSamplesReceived||0);return ne<=0||ne-ie<=0?0:ie/ne*100},this.packetLossPercent=(H,ee)=>{const te=this.streamMetricReports[ee],ie=te.currentMetrics[H]-(te.previousMetrics[H]||0),ne=te.currentMetrics.packetsLost-(te.previousMetrics.packetsLost||0),ae=ie+ne;return ae<=0||ne<=0?0:ne*100/ae},this.jitterBufferMs=(H,ee)=>{const te=this.streamMetricReports[ee],ie=te.currentMetrics.jitterBufferDelay-(te.previousMetrics.jitterBufferDelay||0),ne=te.currentMetrics.jitterBufferEmittedCount-(te.previousMetrics.jitterBufferEmittedCount||0);return ie<=0||ne<=0?0:ie/ne*1e3},this.countPerSecond=(H,ee)=>{const te=ee?this.streamMetricReports[ee]:this.globalMetricReport;let ie=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(ie<=0)return 0;this.previousTimestampMs<=0&&(ie=1);const ne=te.currentMetrics[H]-(te.previousMetrics[H]||0);return ne<=0?0:Math.trunc(ne/ie)},this.bitsPerSecond=(H,ee)=>{const te=ee?this.streamMetricReports[ee]:this.globalMetricReport;let ie=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(ie<=0)return 0;this.previousTimestampMs<=0&&(ie=1);const ne=(te.currentMetrics[H]-(te.previousMetrics[H]||0))*8;return ne<=0?0:Math.trunc(ne/ie)},this.secondsToMilliseconds=(H,ee)=>{const te=ee?this.streamMetricReports[ee]:this.globalMetricReport;return Number(te.currentMetrics[H]*1e3)},this.averageTimeSpentPerSecondInMilliseconds=(H,ee)=>{const te=ee?this.streamMetricReports[ee]:this.globalMetricReport;let ie=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(ie<=0)return 0;this.previousTimestampMs<=0&&(ie=1);const ne=te.currentMetrics[H]-(te.previousMetrics[H]||0);return ne<=0?0:ne*1e3/ie},this.averageCpuQualityLimitationDurationPerSecondInMilliseconds=(H,ee)=>{const te=this.streamMetricReports[ee];if(te.previousObjectMetrics[H]===void 0||te.currentObjectMetrics[H]===void 0)return NaN;let ie=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(ie<=0)return 0;this.previousTimestampMs<=0&&(ie=1);let ne=0,ae=0;for(const[le,fe]of Object.entries(te.previousObjectMetrics[H]))le==="cpu"&&(ne=fe);for(const[le,fe]of Object.entries(te.currentObjectMetrics[H]))le==="cpu"&&(ae=fe);const oe=ae-ne;return oe<=0?0:oe*1e3/ie},this.isHardwareImplementation=(H,ee)=>{const te=this.streamMetricReports[ee];if(te.currentStringMetrics[H]===void 0)return NaN;const ie=String(te.currentStringMetrics[H]),ne=ie.includes("ExternalDecoder")||ie.includes("ExternalEncoder")||ie.includes("EncodeAccelerator")||ie.includes("DecodeAccelerator"),ae=ie.includes("fallback from");return ne&&!ae?1:0},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:C.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.STUN_RTT_MS},audioLevel:{transform:this.identityValue,type:C.SdkMetric.Type.RTC_MIC_AUDIO_LEVEL,source:"audioLevel"}},this.audioUpstreamMetricMap={jitter:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:C.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:C.SdkMetric.Type.RTC_MIC_BITRATE},roundTripTime:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:C.SdkMetric.Type.RTC_MIC_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"}},this.audioDownstreamMetricMap={concealedSamples:{transform:this.countPerSecond},totalSamplesReceived:{transform:this.countPerSecond},decoderLoss:{transform:this.decoderLossPercent,type:C.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},packetsReceived:{transform:this.countPerSecond,type:C.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:C.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},jitter:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:C.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:C.SdkMetric.Type.RTC_SPK_BITRATE},audioLevel:{transform:this.identityValue,type:C.SdkMetric.Type.RTC_SPK_AUDIO_LEVEL},totalAudioPacketsLost:{transform:this.identityValue,type:C.SdkMetric.Type.RTC_SPK_TOTAL_LOST},totalAudioPacketsExpected:{transform:this.identityValue,type:C.SdkMetric.Type.RTC_SPK_TOTAL_EXPECTED},totalAudioPacketsRecoveredRed:{transform:this.identityValue,type:C.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_RED},totalAudioPacketsRecoveredFec:{transform:this.identityValue,type:C.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_FEC}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_ENCODE_FPS},packetsSent:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:C.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:C.SdkMetric.Type.VIDEO_SENT_BITRATE},qpSum:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.VIDEO_SENT_JITTER_MS},totalEncodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:C.SdkMetric.Type.VIDEO_ENCODE_MS},encoderImplementation:{transform:this.isHardwareImplementation,type:C.SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE},qualityLimitationDurations:{transform:this.averageCpuQualityLimitationDurationPerSecondInMilliseconds,type:C.SdkMetric.Type.VIDEO_QUALITY_LIMITATION_DURATION_CPU},videoCodecDegradationHighEncodeCpu:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU},videoCodecDegradationEncodeFailure:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE},videoInputWidth:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_INPUT_WIDTH},videoInputHeight:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_INPUT_HEIGHT}},this.videoDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:C.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},framesReceived:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:C.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:C.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:C.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},frameHeight:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_DECODE_WIDTH},totalDecodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:C.SdkMetric.Type.VIDEO_DECODE_MS},decoderImplementation:{transform:this.isHardwareImplementation,type:C.SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE},totalFreezesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:C.SdkMetric.Type.VIDEO_FREEZE_DURATION},freezeCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_FREEZE_COUNT},totalPausesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:C.SdkMetric.Type.VIDEO_PAUSE_DURATION},pauseCount:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_PAUSE_COUNT},framesDropped:{transform:this.countPerSecond,type:C.SdkMetric.Type.VIDEO_DROPPED_FPS},videoRenderWidth:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_RENDER_WIDTH},videoRenderHeight:{transform:this.identityValue,type:C.SdkMetric.Type.VIDEO_RENDER_HEIGHT}},this.streamDimensionMap={encoderImplementation:C.SdkStreamDimension.Type.VIDEO_ENCODER_NAME,decoderImplementation:C.SdkStreamDimension.Type.VIDEO_DECODER_NAME},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamFramesInputPerSecond:{source:"framesPerSecond",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamEncoderImplementation:{source:"encoderImplementation",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamTotalEncodeTimePerSecond:{source:"totalEncodeTime",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoUpstreamCpuQualityLimitationDurationPerSecond:{source:"qualityLimitationDurations",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:w.default.VIDEO,dir:E.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:w.default.VIDEO,dir:E.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:w.default.AUDIO,dir:E.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:w.default.AUDIO,dir:E.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:w.default.AUDIO,dir:E.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:w.default.AUDIO,dir:E.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:w.default.AUDIO,dir:E.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:w.default.AUDIO,dir:E.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:w.default.VIDEO,dir:E.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:w.default.VIDEO,dir:E.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:w.default.AUDIO,dir:E.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:w.default.AUDIO,dir:E.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:w.default.AUDIO,dir:E.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:w.default.VIDEO,dir:E.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"},audioDownstreamLevel:{source:"audioLevel",media:w.default.AUDIO,dir:E.default.DOWNSTREAM},audioUpstreamLevel:{source:"audioLevel"}}}getMetricMap(R,A){switch(R){case w.default.AUDIO:switch(A){case E.default.UPSTREAM:return this.audioUpstreamMetricMap;case E.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case w.default.VIDEO:switch(A){case E.default.UPSTREAM:return this.videoUpstreamMetricMap;case E.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getStreamDimensionMap(){return this.streamDimensionMap}getObservableMetricValue(R){if(this.overriddenObservableMetrics.has(R))return this.overriddenObservableMetrics.get(R);const A=this.observableMetricSpec[R],O=this.getMetricMap(A.media,A.dir)[A.source],{transform:H,source:ee}=O;if(A.hasOwnProperty("media"))for(const te in this.streamMetricReports){const ie=this.streamMetricReports[te];if(ie.direction===A.dir&&ie.mediaType===A.media)return H(ee||A.source,Number(te))}else return H(ee||A.source);return 0}getObservableVideoMetricValue(R,A){const O=this.observableVideoMetricSpec[R],H=this.getMetricMap(O.media,O.dir)[O.source],{transform:ee,source:te}=H;return ee(te||O.source,A)}getVideoUpstreamSsrcs(){const R=[];for(const A in this.streamMetricReports)this.streamMetricReports[A].mediaType===w.default.VIDEO&&this.streamMetricReports[A].direction===E.default.UPSTREAM&&R.push(Number(A));return R}getObservableMetrics(){const R={};for(const A in this.observableMetricSpec)R[A]=this.getObservableMetricValue(A);return R}getObservableVideoMetrics(){const R={};if(!this.videoStreamIndex||!this.selfAttendeeId)return this.logger.error("Need to define VideoStreamIndex and selfAttendeeId if using getObservableVideoMetrics API"),R;for(const A in this.streamMetricReports)if(this.streamMetricReports[A].mediaType===w.default.VIDEO){const O={};for(const ie in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[ie].dir===this.streamMetricReports[A].direction){const ne=this.getObservableVideoMetricValue(ie,Number(A));isNaN(ne)||(O[ie]=ne)}const H=this.streamMetricReports[A].groupId,ee=this.streamMetricReports[A].streamId;let te="";this.videoStreamIndex.attendeeIdForGroupId!==void 0?te=H?this.videoStreamIndex.attendeeIdForGroupId(H):this.selfAttendeeId:te=ee?this.videoStreamIndex.attendeeIdForStreamId(ee):this.selfAttendeeId,R[te]=R[te]?R[te]:{},R[te][A]=O}return R}getRTCStatsReport(){return this.rtcStatsReport}clone(){const R=new im(this.logger,this.videoStreamIndex,this.selfAttendeeId);return R.globalMetricReport=this.globalMetricReport,R.streamMetricReports=this.streamMetricReports,R.rtcStatsReport=this.rtcStatsReport,R.customStatsReports=this.customStatsReports,R.currentTimestampMs=this.currentTimestampMs,R.previousTimestampMs=this.previousTimestampMs,R.overriddenObservableMetrics=this.overriddenObservableMetrics,R}print(){const R={globalMetricReport:this.globalMetricReport,streamMetricReports:this.streamMetricReports,currentTimestampMs:this.currentTimestampMs,previousTimestampMs:this.previousTimestampMs};this.logger.debug(()=>`Client Metric Report: ${JSON.stringify(R)}`)}removeDestroyedSsrcs(){for(const R in this.streamMetricReports)this.currentSsrcs[R]||delete this.streamMetricReports[R]}overrideObservableMetric(R,A){this.overriddenObservableMetrics.set(R,A)}};return ClientMetricReport.default=_,ClientMetricReport}var ClientVideoStreamReceivingReport={},hasRequiredClientVideoStreamReceivingReport;function requireClientVideoStreamReceivingReport(){if(hasRequiredClientVideoStreamReceivingReport)return ClientVideoStreamReceivingReport;hasRequiredClientVideoStreamReceivingReport=1,Object.defineProperty(ClientVideoStreamReceivingReport,"__esModule",{value:!0});let x=class{};return ClientVideoStreamReceivingReport.default=x,ClientVideoStreamReceivingReport}var ConnectionHealthData={},hasRequiredConnectionHealthData;function requireConnectionHealthData(){if(hasRequiredConnectionHealthData)return ConnectionHealthData;hasRequiredConnectionHealthData=1,Object.defineProperty(ConnectionHealthData,"__esModule",{value:!0});let x=class Xo{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(E,w){return Date.now()<E+w}setConnectionStartTime(){this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}reset(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now(),this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0}isConnectionStartRecent(E){return Xo.isTimestampRecent(this.connectionStartTimestampMs,E)}isLastPacketLossRecent(E){return Xo.isTimestampRecent(this.lastPacketLossInboundTimestampMs,E)}isGoodSignalRecent(E){return Xo.isTimestampRecent(this.lastGoodSignalTimestampMs,E)}isWeakSignalRecent(E){return Xo.isTimestampRecent(this.lastWeakSignalTimestampMs,E)}isNoSignalRecent(E){return Xo.isTimestampRecent(this.lastNoSignalTimestampMs,E)}clone(){const E=new Xo;return E.connectionStartTimestampMs=this.connectionStartTimestampMs,E.consecutiveStatsWithNoPackets=this.consecutiveStatsWithNoPackets,E.consecutiveStatsWithNoAudioPacketsSent=this.consecutiveStatsWithNoAudioPacketsSent,E.lastPacketLossInboundTimestampMs=this.lastPacketLossInboundTimestampMs,E.lastGoodSignalTimestampMs=this.lastGoodSignalTimestampMs,E.lastWeakSignalTimestampMs=this.lastWeakSignalTimestampMs,E.lastNoSignalTimestampMs=this.lastNoSignalTimestampMs,E.consecutiveMissedPongs=this.consecutiveMissedPongs,E.packetsReceivedInLastMinute=this.packetsReceivedInLastMinute.slice(0),E.fractionPacketsLostInboundInLastMinute=this.fractionPacketsLostInboundInLastMinute.slice(0),E.audioSpeakerDelayMs=this.audioSpeakerDelayMs,E.isVideoEncoderHardware=this.isVideoEncoderHardware,E.videoEncodingTimeInMs=this.videoEncodingTimeInMs,E.videoEncodingTimePerFrameInMs=this.videoEncodingTimePerFrameInMs,E.cpuLimitationDuration=this.cpuLimitationDuration,E.videoInputFps=this.videoInputFps,E.videoEncodeFps=this.videoEncodeFps,E.isContentShare=this.isContentShare,E.numberOfPublishedVideoSources=this.numberOfPublishedVideoSources,E}setConsecutiveMissedPongs(E){this.consecutiveMissedPongs=E}setConsecutiveStatsWithNoPackets(E){this.consecutiveStatsWithNoPackets=E}setConsecutiveStatsWithNoAudioPacketsSent(E){this.consecutiveStatsWithNoAudioPacketsSent=E}setLastPacketLossInboundTimestampMs(E){this.lastPacketLossInboundTimestampMs=E}setLastNoSignalTimestampMs(E){this.lastNoSignalTimestampMs=E}setLastWeakSignalTimestampMs(E){this.lastWeakSignalTimestampMs=E}setLastGoodSignalTimestampMs(E){this.lastGoodSignalTimestampMs=E}setAudioSpeakerDelayMs(E){this.audioSpeakerDelayMs=E}setIsVideoEncoderHardware(E){this.isVideoEncoderHardware=E}setVideoEncodingTimeInMs(E){this.videoEncodingTimeInMs=E}setVideoEncodingTimePerFrameInMs(E){this.videoEncodingTimePerFrameInMs=E}setCpuLimitationDuration(E){this.cpuLimitationDuration=E}setVideoInputFps(E){this.videoInputFps=E}setVideoEncodeFps(E){this.videoEncodeFps=E}setIsContentShare(E){this.isContentShare=E}setNumberOfPublishedVideoSources(E){this.numberOfPublishedVideoSources=E}};return ConnectionHealthData.default=x,ConnectionHealthData}var ConnectionHealthPolicyConfiguration={},VideoEncodingConcurrentSendersHealthPolicy={},VideoEncodingConnectionHealthPolicyName={},hasRequiredVideoEncodingConnectionHealthPolicyName;function requireVideoEncodingConnectionHealthPolicyName(){return hasRequiredVideoEncodingConnectionHealthPolicyName||(hasRequiredVideoEncodingConnectionHealthPolicyName=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.VideoEncodingConnectionHealthPolicyName=void 0;var C;(function(E){E.VideoEncodingCpuHealth="Video Encoding CPU Health",E.VideoEncodingFramerateHealth="Video Encoding framerate Health",E.VideoConcurrentSendersHealth="Video Concurrent Senders Health"})(C=x.VideoEncodingConnectionHealthPolicyName||(x.VideoEncodingConnectionHealthPolicyName={})),x.default=C}(VideoEncodingConnectionHealthPolicyName)),VideoEncodingConnectionHealthPolicyName}var hasRequiredVideoEncodingConcurrentSendersHealthPolicy;function requireVideoEncodingConcurrentSendersHealthPolicy(){if(hasRequiredVideoEncodingConcurrentSendersHealthPolicy)return VideoEncodingConcurrentSendersHealthPolicy;hasRequiredVideoEncodingConcurrentSendersHealthPolicy=1;var x=VideoEncodingConcurrentSendersHealthPolicy&&VideoEncodingConcurrentSendersHealthPolicy.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(VideoEncodingConcurrentSendersHealthPolicy,"__esModule",{value:!0});const C=x(requireBaseConnectionHealthPolicy()),E=x(requireVideoEncodingConnectionHealthPolicyName());let w=class extends C.default{constructor(T,_){super(T,_,E.default.VideoConcurrentSendersHealth),this.concurrentVideoSendersThreshold=T.concurrentVideoSendersThreshold}health(){return this.currentData.isContentShare?this.maximumHealth():this.currentData.numberOfPublishedVideoSources>this.concurrentVideoSendersThreshold?this.minimumHealth():this.maximumHealth()}};return VideoEncodingConcurrentSendersHealthPolicy.default=w,VideoEncodingConcurrentSendersHealthPolicy}var VideoEncodingCpuConnectionHealthPolicy={},hasRequiredVideoEncodingCpuConnectionHealthPolicy;function requireVideoEncodingCpuConnectionHealthPolicy(){if(hasRequiredVideoEncodingCpuConnectionHealthPolicy)return VideoEncodingCpuConnectionHealthPolicy;hasRequiredVideoEncodingCpuConnectionHealthPolicy=1;var x=VideoEncodingCpuConnectionHealthPolicy&&VideoEncodingCpuConnectionHealthPolicy.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(VideoEncodingCpuConnectionHealthPolicy,"__esModule",{value:!0});const C=x(requireBaseConnectionHealthPolicy()),E=x(requireVideoEncodingConnectionHealthPolicyName());let w=class extends C.default{constructor(T,_){super(T,_,E.default.VideoEncodingCpuHealth),this.consecutiveHighEncodeCpuCnt=0,this.consecutiveHighEncodeCpuThreshold=T.consecutiveHighEncodeCpuThreshold,this.highEncodeCpuMsThreshold=T.highEncodeCpuMsThreshold,this.highEncodeCpuMsPerFrameThreshold=T.highEncodeCpuMsPerFrameThreshold}health(){const T=this.currentData.videoEncodingTimeInMs>=this.highEncodeCpuMsThreshold&&this.currentData.videoEncodingTimePerFrameInMs>=this.highEncodeCpuMsPerFrameThreshold;if(!this.currentData.isVideoEncoderHardware&&(T||this.currentData.cpuLimitationDuration>0)){if(this.consecutiveHighEncodeCpuCnt++,this.consecutiveHighEncodeCpuCnt>this.consecutiveHighEncodeCpuThreshold)return this.consecutiveHighEncodeCpuCnt=0,this.minimumHealth()}else this.consecutiveHighEncodeCpuCnt=0;return this.maximumHealth()}};return VideoEncodingCpuConnectionHealthPolicy.default=w,VideoEncodingCpuConnectionHealthPolicy}var VideoEncodingFramerateConnectionHealthPolicy={},hasRequiredVideoEncodingFramerateConnectionHealthPolicy;function requireVideoEncodingFramerateConnectionHealthPolicy(){if(hasRequiredVideoEncodingFramerateConnectionHealthPolicy)return VideoEncodingFramerateConnectionHealthPolicy;hasRequiredVideoEncodingFramerateConnectionHealthPolicy=1;var x=VideoEncodingFramerateConnectionHealthPolicy&&VideoEncodingFramerateConnectionHealthPolicy.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(VideoEncodingFramerateConnectionHealthPolicy,"__esModule",{value:!0});const C=x(requireBaseConnectionHealthPolicy()),E=x(requireVideoEncodingConnectionHealthPolicyName());let w=class extends C.default{constructor(T,_){super(T,_,E.default.VideoEncodingFramerateHealth),this.consecutiveEncodeFailureCnt=0,this.consecutiveVideoEncodingFailureThreshold=T.consecutiveVideoEncodingFailureThreshold}health(){if(this.currentData.videoEncodeFps===0&&this.currentData.videoInputFps>0){if(this.consecutiveEncodeFailureCnt++,this.consecutiveEncodeFailureCnt>this.consecutiveVideoEncodingFailureThreshold)return this.consecutiveEncodeFailureCnt=0,this.minimumHealth()}else this.consecutiveEncodeFailureCnt=0;return this.maximumHealth()}};return VideoEncodingFramerateConnectionHealthPolicy.default=w,VideoEncodingFramerateConnectionHealthPolicy}var hasRequiredConnectionHealthPolicyConfiguration;function requireConnectionHealthPolicyConfiguration(){if(hasRequiredConnectionHealthPolicyConfiguration)return ConnectionHealthPolicyConfiguration;hasRequiredConnectionHealthPolicyConfiguration=1;var x=ConnectionHealthPolicyConfiguration&&ConnectionHealthPolicyConfiguration.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ConnectionHealthPolicyConfiguration,"__esModule",{value:!0});const C=x(requireVideoEncodingConcurrentSendersHealthPolicy()),E=x(requireVideoEncodingCpuConnectionHealthPolicy()),w=x(requireVideoEncodingFramerateConnectionHealthPolicy());let T=class{constructor(){this.minHealth=0,this.maxHealth=1,this.initialHealth=1,this.connectionUnhealthyThreshold=25,this.noSignalThresholdTimeMs=1e4,this.connectionWaitTimeMs=1e4,this.zeroBarsNoSignalTimeMs=5e3,this.oneBarWeakSignalTimeMs=5e3,this.twoBarsTimeMs=5e3,this.threeBarsTimeMs=1e4,this.fourBarsTimeMs=2e4,this.fiveBarsTimeMs=6e4,this.cooldownTimeMs=6e4,this.pastSamplesToConsider=15,this.goodSignalTimeMs=15e3,this.fractionalLoss=.5,this.packetsExpected=50,this.maximumTimesToWarn=2,this.missedPongsLowerThreshold=1,this.missedPongsUpperThreshold=4,this.maximumAudioDelayMs=6e4,this.maximumAudioDelayDataPoints=10,this.sendingAudioFailureSamplesToConsider=2,this.sendingAudioFailureInitialWaitTimeMs=3e3,this.videoEncodingHealthPolicies=[C.default,E.default,w.default],this.consecutiveHighEncodeCpuThreshold=10,this.highEncodeCpuMsThreshold=500,this.highEncodeCpuMsPerFrameThreshold=15,this.consecutiveVideoEncodingFailureThreshold=5,this.concurrentVideoSendersThreshold=15}};return ConnectionHealthPolicyConfiguration.default=T,ConnectionHealthPolicyConfiguration}var ContentShareConstants={},hasRequiredContentShareConstants;function requireContentShareConstants(){if(hasRequiredContentShareConstants)return ContentShareConstants;hasRequiredContentShareConstants=1,Object.defineProperty(ContentShareConstants,"__esModule",{value:!0});var x;return function(C){C.Modality="#content"}(x||(x={})),ContentShareConstants.default=x,ContentShareConstants}var ContentShareMediaStreamBroker={},DefaultDeviceController={},DefaultMediaDeviceFactory={},MediaDeviceProxyHandler={},IntervalScheduler={},hasRequiredIntervalScheduler;function requireIntervalScheduler(){if(hasRequiredIntervalScheduler)return IntervalScheduler;hasRequiredIntervalScheduler=1,Object.defineProperty(IntervalScheduler,"__esModule",{value:!0});let x=class{constructor(C){this.intervalMs=C}start(C){this.stop(),this.timer=setInterval(C,this.intervalMs)}stop(){this.timer!==void 0&&(clearInterval(this.timer),this.timer=void 0)}running(){return this.timer!==void 0}};return IntervalScheduler.default=x,IntervalScheduler}var hasRequiredMediaDeviceProxyHandler;function requireMediaDeviceProxyHandler(){if(hasRequiredMediaDeviceProxyHandler)return MediaDeviceProxyHandler;hasRequiredMediaDeviceProxyHandler=1;var x=MediaDeviceProxyHandler&&MediaDeviceProxyHandler.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=MediaDeviceProxyHandler&&MediaDeviceProxyHandler.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(MediaDeviceProxyHandler,"__esModule",{value:!0});const E=C(requireAsyncScheduler()),w=C(requireIntervalScheduler());let T=class nm{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(S,R,A)=>{if(!Reflect.has(S,R))return;if(!("ondevicechange"in navigator.mediaDevices)){if(R==="addEventListener")return this.patchAddEventListener(S,R,A);if(R==="removeEventListener")return this.patchRemoveEventListener(S,R,A)}const O=Reflect.get(S,R,A);return typeof O=="function"?O.bind(S):O},this.patchAddEventListener=(S,R,A)=>{const O=Reflect.get(S,R,A);return(H,ee,te)=>{if(H==="devicechange")this.deviceChangeListeners.add(ee),this.scheduler||(this.scheduler=new w.default(nm.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists));else return Reflect.apply(O,S,[H,ee,te])}},this.patchRemoveEventListener=(S,R,A)=>{const O=Reflect.get(S,R,A);return(H,ee,te)=>{if(H==="devicechange")this.deviceChangeListeners.delete(ee),this.deviceChangeListeners.size===0&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null);else return Reflect.apply(O,S,[H,ee,te])}},this.pollDeviceLists=()=>x(this,void 0,void 0,function*(){const S=yield this.sortedDeviceList();this.devices&&(S.length!==this.devices.length||S.some((R,A)=>R.deviceId!==this.devices[A].deviceId))&&this.handleDeviceChangeEvent(),this.devices=S})}sortedDeviceList(){return x(this,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort((S,R)=>S.deviceId<R.deviceId?1:S.deviceId>R.deviceId?-1:0)})}handleDeviceChangeEvent(){for(const S of this.deviceChangeListeners)E.default.nextTick(()=>{if(this.deviceChangeListeners.has(S)){const R=new Event("devicechange");typeof S=="function"?S(R):S.handleEvent(R)}})}};return MediaDeviceProxyHandler.default=T,T.INTERVAL_MS=1e3,MediaDeviceProxyHandler}var hasRequiredDefaultMediaDeviceFactory;function requireDefaultMediaDeviceFactory(){if(hasRequiredDefaultMediaDeviceFactory)return DefaultMediaDeviceFactory;hasRequiredDefaultMediaDeviceFactory=1;var x=DefaultMediaDeviceFactory&&DefaultMediaDeviceFactory.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(DefaultMediaDeviceFactory,"__esModule",{value:!0});const C=x(requireMediaDeviceProxyHandler());let E=class{constructor(){this.isMediaDevicesSupported=typeof navigator<"u"&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new C.default);throw new Error("navigator.mediaDevices is not supported")}};return DefaultMediaDeviceFactory.default=E,DefaultMediaDeviceFactory}var PromiseQueue={},hasRequiredPromiseQueue;function requirePromiseQueue(){if(hasRequiredPromiseQueue)return PromiseQueue;hasRequiredPromiseQueue=1,Object.defineProperty(PromiseQueue,"__esModule",{value:!0});let x=class{constructor(){this.queue=Promise.resolve()}add(C){return new Promise((E,w)=>{this.queue=this.queue.then(C).then(E).catch(w)})}};return PromiseQueue.default=x,PromiseQueue}var Types={},hasRequiredTypes$1;function requireTypes$1(){if(hasRequiredTypes$1)return Types;hasRequiredTypes$1=1,Object.defineProperty(Types,"__esModule",{value:!0}),Types.None=Types.Some=Types.Maybe=void 0;class x{static of(T){return T==null?E.of():C.of(T)}}Types.Maybe=x;class C{constructor(T){this.value=T,this.isSome=!0,this.isNone=!1}map(T){return x.of(T(this.value))}flatMap(T){return T(this.value)}get(){return this.value}getOrElse(T){return this.value}defaulting(T){return x.of(this.getOrElse(T))}static of(T){if(T==null)throw new Error("value is ${value}");return new C(T)}}Types.Some=C;class E{constructor(){this.isSome=!1,this.isNone=!0}get(){throw new Error("value is null")}getOrElse(T){return T}map(T){return new E}flatMap(T){return new E}defaulting(T){return x.of(this.getOrElse(T))}static of(){return new E}}return Types.None=E,Types}var DefaultVideoTransformDevice={},DefaultVideoFrameProcessorPipeline={},DefaultVideoFrameProcessorTimer={},hasRequiredDefaultVideoFrameProcessorTimer;function requireDefaultVideoFrameProcessorTimer(){if(hasRequiredDefaultVideoFrameProcessorTimer)return DefaultVideoFrameProcessorTimer;hasRequiredDefaultVideoFrameProcessorTimer=1;var x=DefaultVideoFrameProcessorTimer&&DefaultVideoFrameProcessorTimer.__awaiter||function(E,w,T,_){function S(R){return R instanceof T?R:new T(function(A){A(R)})}return new(T||(T=Promise))(function(R,A){function O(te){try{ee(_.next(te))}catch(ie){A(ie)}}function H(te){try{ee(_.throw(te))}catch(ie){A(ie)}}function ee(te){te.done?R(te.value):S(te.value).then(O,H)}ee((_=_.apply(E,w||[])).next())})};Object.defineProperty(DefaultVideoFrameProcessorTimer,"__esModule",{value:!0});let C=class{constructor(){this.workerTimer=void 0,this.callback=void 0,this.workerTimer=this.createWorkerTimer()}createWorkerTimer(){try{const E=new Blob([`self.onmessage = async function(e){ 
            var timerID = null;
            const awaitTimeout = delay => new Promise( resolve => {
              timerID = setTimeout(resolve, delay);
            })
            await awaitTimeout(e.data);
            postMessage(timerID);
          }`],{type:"application/javascript"});return new Worker(window.URL.createObjectURL(E))}catch{}}start(E,w){return x(this,void 0,void 0,function*(){this.callback=w,this.workerTimer?(this.workerTimer.onmessage=T=>{this.lastTimeout=T.data,this.callback()},this.workerTimer.postMessage(E)):this.lastTimeout=setTimeout(()=>{this.callback()},E)})}destroy(){return x(this,void 0,void 0,function*(){this.callback=void 0,this.lastTimeout&&(clearTimeout(this.lastTimeout),this.lastTimeout=void 0),this.workerTimer&&(this.workerTimer.terminate(),this.workerTimer=void 0)})}};return DefaultVideoFrameProcessorTimer.default=C,DefaultVideoFrameProcessorTimer}var hasRequiredDefaultVideoFrameProcessorPipeline;function requireDefaultVideoFrameProcessorPipeline(){if(hasRequiredDefaultVideoFrameProcessorPipeline)return DefaultVideoFrameProcessorPipeline;hasRequiredDefaultVideoFrameProcessorPipeline=1;var x=DefaultVideoFrameProcessorPipeline&&DefaultVideoFrameProcessorPipeline.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=DefaultVideoFrameProcessorPipeline&&DefaultVideoFrameProcessorPipeline.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(DefaultVideoFrameProcessorPipeline,"__esModule",{value:!0});const E=C(requireCanvasVideoFrameBuffer()),w=C(requireDefaultVideoFrameProcessorTimer()),T=15;let _=class{constructor(S,R,A=new w.default){this.logger=S,this.stages=R,this.fr=T,this.outputMediaStream=new MediaStream,this.videoInput=document.createElement("video"),this.canvasOutput=document.createElement("canvas"),this.outputCtx=this.canvasOutput.getContext("2d"),this.canvasInput=document.createElement("canvas"),this.inputCtx=this.canvasInput.getContext("2d"),this.inputVideoStream=null,this.sourceBuffers=[],this.destBuffers=[],this.observers=new Set,this.hasStarted=!1,this.process=O=>x(this,void 0,void 0,function*(){if(!this.inputVideoStream)return;const H=performance.now();this.videoInput.videoWidth&&(this.canvasInput.width!==this.videoInput.videoWidth&&(this.canvasInput.width=this.videoInput.videoWidth,this.canvasInput.height=this.videoInput.videoHeight,this.sourceBuffers[0].height=this.canvasInput.height,this.sourceBuffers[0].width=this.canvasInput.width,this.sourceBuffers[0].framerate=this.framerate),this.inputCtx.drawImage(this.videoInput,0,0));let ee=[];ee.push(this.sourceBuffers[0]);try{for(const fe of this.processors)ee=yield fe.process(ee)}catch{this.forEachObserver(fe=>{fe.processingDidFailToStart&&fe.processingDidFailToStart()});return}this.destBuffers=ee;let te;try{te=yield this.destBuffers[0].asCanvasImageSource()}catch{this.inputVideoStream&&(this.logger.info("buffers are destroyed and pipeline could not start"),this.forEachObserver(fe=>{fe.processingDidFailToStart&&fe.processingDidFailToStart()}));return}const ie=te.width,ne=te.height;ie!==0&&ne!==0&&(this.canvasOutput.width!==ie&&this.canvasOutput.height!==ne&&(this.canvasOutput.width=ie,this.canvasOutput.height=ne),this.outputCtx.drawImage(te,0,0,ie,ne,0,0,ie,ne),this.hasStarted||(this.hasStarted=!0,this.forEachObserver(fe=>{fe.processingDidStart&&fe.processingDidStart()})));const ae=performance.now()-H,oe=1e3*2/this.framerate-ae,le=Math.max(0,1e3/this.framerate-ae);oe<=0&&this.forEachObserver(fe=>{fe.processingLatencyTooHigh&&fe.processingLatencyTooHigh(ae)}),yield this.timer.start(le,this.process.bind(this))}),this.timer=A}destroy(){if(this.stop(),this.stages)for(const S of this.stages)S.destroy();this.timer.destroy()}get framerate(){return this.fr}set framerate(S){this.fr=S<0||S===void 0?T:S}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(const S of this.outputMediaStream.getVideoTracks())S.stop();this.hasStarted&&(this.hasStarted=!1,this.forEachObserver(S=>{S.processingDidStop&&S.processingDidStop()}))}addObserver(S){this.observers.add(S)}removeObserver(S){this.observers.delete(S)}getInputMediaStream(){return x(this,void 0,void 0,function*(){return this.inputVideoStream})}getActiveOutputMediaStream(){return this.isOutputMediaStreamActive()?this.outputMediaStream:(this.outputMediaStream=this.canvasOutput.captureStream(this.framerate),this.cloneInputAudioTracksToOutput(),this.outputMediaStream)}setInputMediaStream(S){return x(this,void 0,void 0,function*(){if(!S){this.stop();return}if(S.getVideoTracks().length===0){this.logger.error("No video tracks in input media stream, ignoring");return}this.inputVideoStream=S;const R=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${JSON.stringify(R)}`),this.framerate=R.frameRate,this.canvasOutput.width=R.width,this.canvasOutput.height=R.height,this.videoInput.addEventListener("loadedmetadata",this.process),this.videoInput.srcObject=this.inputVideoStream,this.videoInput.setAttribute("playsinline","true");const A=new E.default(this.canvasInput);this.sourceBuffers.push(A),this.videoInput.load();try{yield this.videoInput.play()}catch{this.logger.warn("Video element play() overrided by another load().")}this.cloneInputAudioTracksToOutput()})}cloneInputAudioTracksToOutput(){if(!this.isOutputMediaStreamActive()||this.inputVideoStream===null){this.logger.info("Not cloning input audio tracks to output, do not have media streams ready");return}for(const S of this.outputMediaStream.getAudioTracks())this.logger.info(`Removing audio track ${S.id} from output stream`),this.outputMediaStream.removeTrack(S);for(const S of this.inputVideoStream.getAudioTracks())this.logger.info(`Adding audio track ${S.id} to output stream`),this.outputMediaStream.addTrack(S)}isOutputMediaStreamActive(){return this.outputMediaStream&&this.outputMediaStream.active}set processors(S){this.stages=S}get processors(){return this.stages}forEachObserver(S){for(const R of this.observers)setTimeout(()=>{S(R)},0)}destroyInputMediaStreamAndBuffers(){if(this.inputVideoStream)for(const S of this.inputVideoStream.getTracks())S.stop();this.inputVideoStream=null;for(const S of this.sourceBuffers)S.destroy();this.sourceBuffers=[]}};return DefaultVideoFrameProcessorPipeline.default=_,DefaultVideoFrameProcessorPipeline}var hasRequiredDefaultVideoTransformDevice;function requireDefaultVideoTransformDevice(){if(hasRequiredDefaultVideoTransformDevice)return DefaultVideoTransformDevice;hasRequiredDefaultVideoTransformDevice=1;var x=DefaultVideoTransformDevice&&DefaultVideoTransformDevice.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=DefaultVideoTransformDevice&&DefaultVideoTransformDevice.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(DefaultVideoTransformDevice,"__esModule",{value:!0});const E=C(requireDefaultBrowserBehavior()),w=C(requireDefaultVideoFrameProcessorPipeline());let T=class om{constructor(S,R,A,O=new E.default){this.logger=S,this.device=R,this.processors=A,this.browserBehavior=O,this.observers=new Set,this.pipe=new w.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}passEventControllerToProcessors(S){if(this.pipe.processors)for(const R of this.pipe.processors)typeof R.setEventController=="function"&&R.setEventController(S)}chooseNewInnerDevice(S){const R=new om(this.logger,S,this.processors,this.browserBehavior);return R.pipe=this.pipe,R}getInnerDevice(){return this.device}intrinsicDevice(){return x(this,void 0,void 0,function*(){return this.device})}transformStream(S){return x(this,void 0,void 0,function*(){return yield this.pipe.setInputMediaStream(S),this.inputMediaStream=S,this.pipe.getActiveOutputMediaStream()})}onOutputStreamDisconnect(){this.logger.info("DefaultVideoTransformDevice: detach stopping input media stream");const S=this.device&&this.device.id;if(this.pipe.stop(),!S&&this.inputMediaStream)for(const R of this.inputMediaStream.getVideoTracks())R.stop()}stop(){return x(this,void 0,void 0,function*(){if(this.inputMediaStream)for(const S of this.inputMediaStream.getVideoTracks())S.stop();this.pipe.destroy(),this.inputMediaStream=null})}addObserver(S){this.observers.add(S)}removeObserver(S){this.observers.delete(S)}processingDidStart(){this.logger.info("video transform device processing started"),this.forEachObserver(S=>{S.processingDidStart&&S.processingDidStart()})}processingLatencyTooHigh(S){this.forEachObserver(R=>{R.processingLatencyTooHigh&&R.processingLatencyTooHigh(S)})}processingDidFailToStart(){this.logger.info("video transform device processing failed to start"),this.forEachObserver(S=>{S.processingDidFailToStart&&S.processingDidFailToStart()})}processingDidStop(){this.logger.info("video transform device processing stopped"),this.forEachObserver(S=>{S.processingDidStop&&S.processingDidStop()})}forEachObserver(S){for(const R of this.observers)setTimeout(()=>{S(R)},0)}get framerate(){return this.pipe.framerate}set framerate(S){this.pipe.framerate=S}};return DefaultVideoTransformDevice.default=T,DefaultVideoTransformDevice}var DefaultVideoTile={},DefaultModality={},hasRequiredDefaultModality;function requireDefaultModality(){if(hasRequiredDefaultModality)return DefaultModality;hasRequiredDefaultModality=1;var x=DefaultModality&&DefaultModality.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(DefaultModality,"__esModule",{value:!0});const C=x(requireContentShareConstants());let E=class Zo{constructor(T){this._id=T}id(){return this._id}base(){return this._id?this._id.split(Zo.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";const T=this._id.split(Zo.MODALITY_SEPARATOR);return T.length===2?T[1]:""}hasModality(T){return T!==""&&this.modality()===T}withModality(T){const _=new Zo(this.base()+Zo.MODALITY_SEPARATOR+T);return T===""||this.base()===""||new Zo(_._id).modality()!==T?new Zo(this.base()):_}};return DefaultModality.default=E,E.MODALITY_SEPARATOR=C.default.Modality[0],E.MODALITY_CONTENT=C.default.Modality.substring(1),DefaultModality}var VideoTileState={},hasRequiredVideoTileState;function requireVideoTileState(){if(hasRequiredVideoTileState)return VideoTileState;hasRequiredVideoTileState=1,Object.defineProperty(VideoTileState,"__esModule",{value:!0});let x=class sm{constructor(){this.tileId=null,this.localTile=!1,this.localTileStarted=!1,this.isContent=!1,this.active=!1,this.paused=!1,this.poorConnection=!1,this.boundAttendeeId=null,this.boundExternalUserId=null,this.boundVideoStream=null,this.boundVideoElement=null,this.nameplate=null,this.videoStreamContentWidth=null,this.videoStreamContentHeight=null,this.videoElementCSSWidthPixels=null,this.videoElementCSSHeightPixels=null,this.devicePixelRatio=0,this.videoElementPhysicalWidthPixels=null,this.videoElementPhysicalHeightPixels=null,this.streamId=null,this.groupId=null}clone(){const E=new sm;return E.tileId=this.tileId,E.localTile=this.localTile,E.isContent=this.isContent,E.active=this.active,E.paused=this.paused,E.poorConnection=this.poorConnection,E.boundAttendeeId=this.boundAttendeeId,E.boundExternalUserId=this.boundExternalUserId,E.boundVideoStream=this.boundVideoStream,E.boundVideoElement=this.boundVideoElement,E.nameplate=this.nameplate,E.videoStreamContentWidth=this.videoStreamContentWidth,E.videoStreamContentHeight=this.videoStreamContentHeight,E.videoElementCSSWidthPixels=this.videoElementCSSWidthPixels,E.videoElementCSSHeightPixels=this.videoElementCSSHeightPixels,E.devicePixelRatio=this.devicePixelRatio,E.videoElementPhysicalWidthPixels=this.videoElementPhysicalWidthPixels,E.videoElementPhysicalHeightPixels=this.videoElementPhysicalHeightPixels,E.streamId=this.streamId,E.groupId=this.groupId,E}};return VideoTileState.default=x,VideoTileState}var hasRequiredDefaultVideoTile;function requireDefaultVideoTile(){if(hasRequiredDefaultVideoTile)return DefaultVideoTile;hasRequiredDefaultVideoTile=1;var x=DefaultVideoTile&&DefaultVideoTile.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(DefaultVideoTile,"__esModule",{value:!0});const C=x(requireDefaultBrowserBehavior()),E=x(requireDefaultModality()),w=x(requireVideoTileState());let T=class vo{constructor(S,R,A,O,H=void 0){this.tileController=A,this.devicePixelRatioMonitor=O,this.resolutionMonitor=H,this.tileState=new w.default,this.tileState.tileId=S,this.tileState.localTile=R,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(S,R,A){const O=A&&S.getVideoTracks()[0].getSettings().facingMode!=="environment"?"rotateY(180deg)":"";if(vo.setVideoElementFlag(R,"disablePictureInPicture",A),vo.setVideoElementFlag(R,"disableRemotePlayback",A),R.style.transform!==O&&(R.style.transform=O),R.hasAttribute("controls")&&R.removeAttribute("controls"),R.hasAttribute("autoplay")||R.setAttribute("autoplay","true"),R.hasAttribute("playsinline")||R.setAttribute("playsinline","true"),R.hasAttribute("muted")||(R.setAttribute("muted","true"),R.muted=!0),R.srcObject!==S&&(R.srcObject=S,new C.default().requiresVideoPlayWorkaround()&&R.paused)){const H=R.play();H!==void 0&&H.catch(ee=>{console.warn("Error playing video in Safari",ee)}).then(()=>{console.debug("Video played successfully in Safari")})}}static disconnectVideoStreamFromVideoElement(S,R,A=!1){if(S)if(R)A||(S.srcObject=null,S.style.transform="");else{if(!S.srcObject)return;S.pause(),S.style.transform="",vo.setVideoElementFlag(S,"disablePictureInPicture",!1),vo.setVideoElementFlag(S,"disableRemotePlayback",!1),S.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&vo.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new w.default}devicePixelRatioChanged(S){this.tileState.devicePixelRatio=S,this.sendTileStateUpdate()}id(){return this.tileState.tileId}state(){return this.tileState.clone()}stateRef(){return this.tileState}bindVideoStream(S,R,A,O,H,ee,te,ie){let ne=!1;this.tileState.boundAttendeeId!==S&&(this.tileState.boundAttendeeId=S,new E.default(S).hasModality(E.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),ne=!0),this.tileState.boundExternalUserId!==te&&(this.tileState.boundExternalUserId=te,ne=!0),this.tileState.localTile!==R&&(this.tileState.localTile=R,ne=!0),this.tileState.boundVideoStream!==A&&(this.tileState.boundVideoStream=A,ne=!0),this.tileState.videoStreamContentWidth!==O&&(this.tileState.videoStreamContentWidth=O,ne=!0),this.tileState.videoStreamContentHeight!==H&&(this.tileState.videoStreamContentHeight=H,ne=!0),this.tileState.streamId!==ee&&(this.tileState.streamId=ee,ne=!0),this.tileState.groupId!==ie&&(this.tileState.groupId=ie,ne=!0),ne&&this.sendTileStateUpdate()}bindVideoElement(S){var R;let A=!1;this.tileState.boundVideoElement!==S&&(this.tileState.boundVideoElement=S,(R=this.resolutionMonitor)===null||R===void 0||R.bindVideoElement(this.tileState.boundVideoElement),A=!0),this.tileState.boundVideoElement!==null?(this.tileState.videoElementCSSWidthPixels!==S.clientWidth&&(this.tileState.videoElementCSSWidthPixels=S.clientWidth,A=!0),this.tileState.videoElementCSSHeightPixels!==S.clientHeight&&(this.tileState.videoElementCSSHeightPixels=S.clientHeight,A=!0)):(this.tileState.videoElementCSSWidthPixels=null,this.tileState.videoElementCSSHeightPixels=null),A&&this.sendTileStateUpdate()}pause(){this.tileState.paused||(this.tileState.paused=!0,this.sendTileStateUpdate())}unpause(){this.tileState.paused&&(this.tileState.paused=!1,this.sendTileStateUpdate())}markPoorConnection(){return this.tileState.poorConnection?!1:(this.tileState.poorConnection=!0,this.sendTileStateUpdate(),!0)}unmarkPoorConnection(){return this.tileState.poorConnection?(this.tileState.poorConnection=!1,this.sendTileStateUpdate(),!0):!1}capture(){if(!this.tileState.active)return null;const S=document.createElement("canvas"),R=this.tileState.boundVideoElement;S.width=R.videoWidth||R.width,S.height=R.videoHeight||R.height;const A=S.getContext("2d");return A.drawImage(R,0,0,S.width,S.height),A.getImageData(0,0,S.width,S.height)}setStreamId(S){this.tileState.streamId=S,this.tileController.sendTileStateUpdate(this.state())}sendTileStateUpdate(){this.updateActiveState(),this.updateVideoStreamOnVideoElement(),this.updateVideoElementPhysicalPixels(),this.tileController.sendTileStateUpdate(this.state())}updateActiveState(){this.tileState.active=!!(!this.tileState.paused&&!this.tileState.poorConnection&&this.tileState.boundAttendeeId&&this.tileState.boundVideoElement&&this.tileState.boundVideoStream)}updateVideoElementPhysicalPixels(){typeof this.tileState.videoElementCSSWidthPixels=="number"&&typeof this.tileState.videoElementCSSHeightPixels=="number"?(this.tileState.videoElementPhysicalWidthPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSWidthPixels,this.tileState.videoElementPhysicalHeightPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSHeightPixels):(this.tileState.videoElementPhysicalWidthPixels=null,this.tileState.videoElementPhysicalHeightPixels=null)}updateVideoStreamOnVideoElement(){this.tileState.active?vo.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):vo.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(S,R,A){R in S&&(S[R]=A)}};return DefaultVideoTile.default=T,DefaultVideoTile}var AudioTransformDevice={},hasRequiredAudioTransformDevice;function requireAudioTransformDevice(){if(hasRequiredAudioTransformDevice)return AudioTransformDevice;hasRequiredAudioTransformDevice=1,Object.defineProperty(AudioTransformDevice,"__esModule",{value:!0}),AudioTransformDevice.isAudioTransformDevice=void 0;function x(C){return!!C&&typeof C=="object"&&"mute"in C&&"stop"in C&&"intrinsicDevice"in C}return AudioTransformDevice.isAudioTransformDevice=x,AudioTransformDevice}var DeviceSelection={},hasRequiredDeviceSelection;function requireDeviceSelection(){if(hasRequiredDeviceSelection)return DeviceSelection;hasRequiredDeviceSelection=1,Object.defineProperty(DeviceSelection,"__esModule",{value:!0});let x=class{constructor(){this.groupId=""}matchesConstraints(C){return JSON.stringify(this.constraints)===JSON.stringify(C)}};return DeviceSelection.default=x,DeviceSelection}var GetUserMediaError={},hasRequiredGetUserMediaError;function requireGetUserMediaError(){if(hasRequiredGetUserMediaError)return GetUserMediaError;hasRequiredGetUserMediaError=1,Object.defineProperty(GetUserMediaError,"__esModule",{value:!0});let x=class extends Error{constructor(C,E){super(E||"Error fetching device."),this.cause=C,this.name="GetUserMediaError"}};return GetUserMediaError.default=x,GetUserMediaError}var NotFoundError={},hasRequiredNotFoundError;function requireNotFoundError(){if(hasRequiredNotFoundError)return NotFoundError;hasRequiredNotFoundError=1;var x=NotFoundError&&NotFoundError.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(NotFoundError,"__esModule",{value:!0});const C=x(requireGetUserMediaError());let E=class extends C.default{constructor(w){super(w),this.name="NotFoundError"}};return NotFoundError.default=E,NotFoundError}var NotReadableError={},hasRequiredNotReadableError;function requireNotReadableError(){if(hasRequiredNotReadableError)return NotReadableError;hasRequiredNotReadableError=1;var x=NotReadableError&&NotReadableError.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(NotReadableError,"__esModule",{value:!0});const C=x(requireGetUserMediaError());let E=class extends C.default{constructor(w){super(w),this.name="NotReadableError"}};return NotReadableError.default=E,NotReadableError}var OverconstrainedError={},hasRequiredOverconstrainedError;function requireOverconstrainedError(){if(hasRequiredOverconstrainedError)return OverconstrainedError;hasRequiredOverconstrainedError=1;var x=OverconstrainedError&&OverconstrainedError.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(OverconstrainedError,"__esModule",{value:!0});const C=x(requireGetUserMediaError());let E=class extends C.default{constructor(w,T){super(w),this.constraint=T,this.name="OverconstrainedError"}};return OverconstrainedError.default=E,OverconstrainedError}var PermissionDeniedError={},hasRequiredPermissionDeniedError;function requirePermissionDeniedError(){if(hasRequiredPermissionDeniedError)return PermissionDeniedError;hasRequiredPermissionDeniedError=1;var x=PermissionDeniedError&&PermissionDeniedError.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(PermissionDeniedError,"__esModule",{value:!0});const C=x(requireGetUserMediaError());let E=class extends C.default{constructor(w,T){super(w,T),this.name="PermissionDeniedError"}};return PermissionDeniedError.default=E,PermissionDeniedError}var _TypeError={},hasRequired_TypeError;function require_TypeError(){if(hasRequired_TypeError)return _TypeError;hasRequired_TypeError=1;var x=_TypeError&&_TypeError.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(_TypeError,"__esModule",{value:!0});const C=x(requireGetUserMediaError());class E extends C.default{constructor(T){super(T),this.name="TypeError"}}return _TypeError.default=E,_TypeError}var VideoQualitySettings={},hasRequiredVideoQualitySettings;function requireVideoQualitySettings(){if(hasRequiredVideoQualitySettings)return VideoQualitySettings;hasRequiredVideoQualitySettings=1,Object.defineProperty(VideoQualitySettings,"__esModule",{value:!0});let x=class{constructor(C,E,w){this.videoWidth=C,this.videoHeight=E,this.videoFrameRate=w}equals(C){return this.videoWidth===C.videoWidth&&this.videoHeight===C.videoHeight&&this.videoFrameRate===C.videoFrameRate}};return VideoQualitySettings.default=x,x.VideoDisabled=new x(0,0,0),x.VideoResolutionHD=new x(1280,720,30),x.VideoResolutionFHD=new x(1920,1080,30),x.VideoResolutionUHD=new x(3840,2160,30),VideoQualitySettings}var VideoTransformDevice={},hasRequiredVideoTransformDevice;function requireVideoTransformDevice(){if(hasRequiredVideoTransformDevice)return VideoTransformDevice;hasRequiredVideoTransformDevice=1,Object.defineProperty(VideoTransformDevice,"__esModule",{value:!0}),VideoTransformDevice.isVideoTransformDevice=void 0;function x(C){return!!C&&typeof C=="object"&&"transformStream"in C&&"stop"in C&&"intrinsicDevice"in C}return VideoTransformDevice.isVideoTransformDevice=x,VideoTransformDevice}var hasRequiredDefaultDeviceController;function requireDefaultDeviceController(){if(hasRequiredDefaultDeviceController)return DefaultDeviceController;hasRequiredDefaultDeviceController=1;var x=DefaultDeviceController&&DefaultDeviceController.__awaiter||function(pe,he,me,ve){function ye(Se){return Se instanceof me?Se:new me(function(Ce){Ce(Se)})}return new(me||(me=Promise))(function(Se,Ce){function be(Ie){try{Ae(ve.next(Ie))}catch(Te){Ce(Te)}}function Ee(Ie){try{Ae(ve.throw(Ie))}catch(Te){Ce(Te)}}function Ae(Ie){Ie.done?Se(Ie.value):ye(Ie.value).then(be,Ee)}Ae((ve=ve.apply(pe,he||[])).next())})},C=DefaultDeviceController&&DefaultDeviceController.__importDefault||function(pe){return pe&&pe.__esModule?pe:{default:pe}};Object.defineProperty(DefaultDeviceController,"__esModule",{value:!0});const E=C(requireDefaultBrowserBehavior()),w=C(requireDefaultMediaDeviceFactory()),T=C(requireAsyncScheduler()),_=C(requirePromiseQueue()),S=requireTypes$1(),R=C(requireDefaultVideoTransformDevice()),A=C(requireDefaultVideoTile()),O=requireAudioTransformDevice(),H=C(requireDeviceSelection()),ee=C(requireGetUserMediaError()),te=C(requireNotFoundError()),ie=C(requireNotReadableError()),ne=C(requireOverconstrainedError()),ae=C(requirePermissionDeniedError()),oe=C(require_TypeError()),le=C(requireVideoQualitySettings()),fe=requireVideoTransformDevice();let de=class Br{constructor(he,me,ve=new E.default,ye){this.logger=he,this.browserBehavior=ve,this.eventController=ye,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=void 0,this.deviceChangeObservers=new Set,this.mediaStreamBrokerObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.useMediaConstraintsFallback=!0,this.audioInputTaskQueue=new _.default,this.videoInputTaskQueue=new _.default,this.muted=!1,this.mediaStreamMuteObserver=(Ee,Ae)=>{for(const Ie of this.deviceChangeObservers)T.default.nextTick(()=>{this.deviceChangeObservers.has(Ie)&&Ie.audioInputMuteStateChanged&&Ie.audioInputMuteStateChanged(Ee,Ae)})},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:Se=!1,useMediaConstraintsFallback:Ce=!0}=me||{};this.useWebAudio=Se,this.useMediaConstraintsFallback=Ce,this.videoInputQualitySettings=new le.default(Br.defaultVideoWidth,Br.defaultVideoHeight,Br.defaultVideoFrameRate);const be=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=be[0],this.videoInputQualitySettings.videoHeight=be[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=new w.default().create();const Ee=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(Ee)}`)}catch(Ee){he.error(Ee.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){var he;this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>{this.logger.info("Device change event callback is triggered"),this.handleDeviceChange()},(he=this.mediaDeviceWrapper)===null||he===void 0||he.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){var he;this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),(he=this.mediaDeviceWrapper)===null||he===void 0||he.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){return this.deviceChangeObservers.size?!0:this.activeDevices.audio&&this.activeDevices.audio.constraints!==null||this.activeDevices.video&&this.activeDevices.video.constraints!==null||!!this.audioOutputDeviceId}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){return x(this,void 0,void 0,function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()})}listAudioInputDevices(he=!1){return x(this,void 0,void 0,function*(){const me=yield this.listDevicesOfKind("audioinput",he);return this.trace("listAudioInputDevices",he,me),me})}listVideoInputDevices(he=!1){return x(this,void 0,void 0,function*(){const me=yield this.listDevicesOfKind("videoinput",he);return this.trace("listVideoInputDevices",he,me),me})}listAudioOutputDevices(he=!1){return x(this,void 0,void 0,function*(){const me=yield this.listDevicesOfKind("audiooutput",he);return this.trace("listAudioOutputDevices",he,me),me})}pushAudioMeetingStateForPermissions(he){var me;(me=this.eventController)===null||me===void 0||me.publishEvent(he===void 0?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(he){var me;(me=this.eventController)===null||me===void 0||me.publishEvent(he===void 0?"videoInputUnselected":"videoInputSelected")}startAudioInput(he){return x(this,void 0,void 0,function*(){return yield this.audioInputTaskQueue.add(()=>this.startAudioInputTask(he))})}startAudioInputTask(he){var me;return x(this,void 0,void 0,function*(){if(he===void 0){this.logger.error("Audio input device cannot be undefined");return}try{return O.isAudioTransformDevice(he)?(this.logger.info(`Choosing transform input device ${he}`),yield this.chooseAudioTransformInputDevice(he)):(this.logger.info(`Choosing intrinsic audio input device ${he}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",he)),this.trace("startAudioInputDevice",he,"success"),this.useWebAudio?(this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield(me=this.transform)===null||me===void 0?void 0:me.device.mute(this.muted),this.getMediaStreamDestinationNode().stream):(this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream)}catch(ve){throw ve}})}stopAudioInput(){return x(this,void 0,void 0,function*(){return this.audioInputTaskQueue.add(()=>this.stopAudioInputTask())})}stopAudioInputTask(){return x(this,void 0,void 0,function*(){try{if(this.useWebAudio){this.releaseAudioTransformStream();return}this.stopTracksAndRemoveCallbacks("audio")}finally{this.watchForDeviceChangesIfNecessary(),this.publishAudioInputDidChangeEvent(void 0)}})}chooseAudioTransformInputDevice(he){var me;return x(this,void 0,void 0,function*(){if(((me=this.transform)===null||me===void 0?void 0:me.device)===he)return;if(!this.useWebAudio)throw new Error("Cannot apply transform device without enabling Web Audio.");const ve=Br.getAudioContext();if(!(ve instanceof OfflineAudioContext))switch(ve.state){case"running":break;case"closed":throw new Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield ve.resume()}let ye;try{ye=yield he.createAudioNode(ve)}catch(Ce){throw this.logger.error(`Unable to create transform device node: ${Ce}.`),Ce}const Se=yield he.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",Se),this.logger.debug(`Got inner stream: ${Se}.`),this.setTransform(he,ye)})}chooseVideoTransformInputDevice(he){var me;return x(this,void 0,void 0,function*(){if(this.eventController&&he instanceof R.default&&he.passEventControllerToProcessors(this.eventController),he===this.chosenVideoTransformDevice){this.logger.info("Reselecting same VideoTransformDevice");return}const ve=this.chosenVideoTransformDevice;ve&&this.logger.info("Switched from previous VideoTransformDevice");const ye=!!ve,Se=yield he.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId((me=this.activeDevices.video)===null||me===void 0?void 0:me.stream,Se)){this.logger.info("video transform device needs new intrinsic device"),ye&&ve.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=he,this.activeDevices.video=null,yield this.chooseInputIntrinsicDevice("video",Se),this.logger.info("apply processors to transform"),yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream);return}this.chosenVideoTransformDevice=he,this.logger.info("video transform device uses previous stream"),this.logger.info("apply processors to transform"),yield he.transformStream(this.activeDevices.video.stream)})}startVideoInput(he){return x(this,void 0,void 0,function*(){return yield this.videoInputTaskQueue.add(()=>this.startVideoInputTask(he))})}startVideoInputTask(he){return x(this,void 0,void 0,function*(){if(!he){this.logger.error("Invalid video input device");return}try{return fe.isVideoTransformDevice(he)?(this.logger.info(`Choosing video transform device ${he}`),yield this.chooseVideoTransformInputDevice(he),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream):(this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",he),this.trace("startVideoInputDevice",he),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream)}catch(me){throw me}})}stopVideoInput(){return x(this,void 0,void 0,function*(){return this.videoInputTaskQueue.add(()=>this.stopVideoInputTask())})}stopVideoInputTask(){return x(this,void 0,void 0,function*(){try{if(this.chosenVideoInputIsTransformDevice()){this.releaseVideoTransformStream();return}this.stopTracksAndRemoveCallbacks("video")}finally{this.watchForDeviceChangesIfNecessary(),this.publishVideoInputDidChangeEvent(void 0)}})}chooseAudioOutput(he){return x(this,void 0,void 0,function*(){this.audioOutputDeviceId=he,this.watchForDeviceChangesIfNecessary();const me=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);this.publishAudioOutputDidChangeEvent(me),this.trace("chooseAudioOutput",he,null)})}addDeviceChangeObserver(he){this.logger.info("adding device change observer"),this.deviceChangeObservers.add(he),this.watchForDeviceChangesIfNecessary(),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(he){this.logger.info("removing device change observer"),this.deviceChangeObservers.delete(he),this.watchForDeviceChangesIfNecessary(),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){var he,me;if(!this.activeDevices.audio)return null;const ve=(me=(he=this.transform)===null||he===void 0?void 0:he.nodes)===null||me===void 0?void 0:me.end;if(ve){const ye=ve.context.createAnalyser();return ye.removeOriginalInputs=()=>{try{ve.disconnect(ye)}catch{}},ve.connect(ye),ye}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(he){const me=Br.getAudioContext(),ve=me.createAnalyser(),ye=me.createMediaStreamSource(he);return ye.connect(ve),this.trace("createAnalyserNodeForAudioInput"),ve.removeOriginalInputs=()=>{try{ye.disconnect(ve)}catch{}},ve}startVideoPreviewForVideoInput(he){if(!this.activeDevices.video){this.logger.warn("cannot bind video preview since video input device has not been chosen"),this.trace("startVideoPreviewForVideoInput",he.id);return}A.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,he,!0),this.trace("startVideoPreviewForVideoInput",he.id)}stopVideoPreviewForVideoInput(he){A.default.disconnectVideoStreamFromVideoElement(he,!1),this.trace("stopVideoPreviewForVideoInput",he.id)}setDeviceLabelTrigger(he){if(this.deviceInfoCache){for(const me of this.deviceInfoCache)if(!me.label){this.deviceInfoCache=null;break}}this.deviceLabelTrigger=he,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(he){let me=null;return this.useWebAudio?(me=Br.getAudioContext().createMediaStreamSource(he),me.connect(this.getMediaStreamOutputNode())):this.logger.warn("WebAudio is not enabled, mixIntoAudioInput will not work"),this.trace("mixIntoAudioInput",he.id),me}chooseVideoInputQuality(he,me,ve){const ye=this.browserBehavior.requiresResolutionAlignment(he,me);this.videoInputQualitySettings=new le.default(ye[0],ye[1],ve)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return x(this,void 0,void 0,function*(){return this.activeDevices.audio||(this.logger.info("No audio device chosen, creating empty audio device"),yield this.startAudioInput(null)),this.useWebAudio?this.getMediaStreamDestinationNode().stream:this.activeDevices.audio.stream})}acquireVideoInputStream(){return x(this,void 0,void 0,function*(){if(!this.activeDevices.video)throw new Error("No video device chosen");return this.chosenVideoInputIsTransformDevice()?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream})}acquireDisplayInputStream(he){return x(this,void 0,void 0,function*(){throw new Error("unsupported")})}releaseAudioTransformStream(){this.logger.info("Stopping audio track for Web Audio graph"),this.stopTracksAndRemoveCallbacks("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0)}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallbacks("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallbacks(he){const me=this.activeDevices[he];if(!me)return;const ve=me.endedCallback,ye=me.trackMuteCallback,Se=me.trackUnmuteCallback;for(const Ce of me.stream.getTracks())Ce.stop(),ve&&Ce.removeEventListener("ended",ve),ye&&Ce.removeEventListener("mute",ye),Se&&Ce.removeEventListener("unmute",Se),delete me.endedCallback,delete me.trackMuteCallback,delete me.trackUnmuteCallback,delete this.activeDevices[he]}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}muteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!1)}unmuteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!0)}toggleLocalAudioInputStream(he){var me;let ve=this.activeDevices.audio;if(this.useWebAudio&&(ve=this.getMediaStreamDestinationNode()),!!ve){for(const ye of ve.stream.getTracks())ye.enabled!==he&&(ye.enabled=he);this.muted!==!he&&(this.muted=!he,(me=this.transform)===null||me===void 0||me.device.mute(this.muted))}}static getIntrinsicDeviceId(he){if(!he)return;if(typeof he=="string")return he;if(he.id)return he.id;const me=he.deviceId;if(!me)return;if(typeof me=="string"||Array.isArray(me))return me;const ve=me;if(typeof ve.exact=="string"||Array.isArray(ve.exact))return ve.exact}static createEmptyAudioDevice(){return Br.synthesizeAudioDevice(0)}static synthesizeAudioDevice(he){const me=Br.getAudioContext(),ve=me.createMediaStreamDestination();if(he){const ye=me.createGain();ye.gain.value=.1,ye.connect(ve);const Se=me.createOscillator();Se.frequency.value=he,Se.connect(ye),Se.start()}else{const ye=me.createBufferSource();try{ye.buffer=me.createBuffer(1,me.sampleRate*5,me.sampleRate)}catch(Se){if(Se&&Se.name==="NotSupportedError")ye.buffer=me.createBuffer(1,Br.defaultSampleRate*5,Br.defaultSampleRate);else throw Se}ye.buffer.getChannelData(0)[0]=3e-4,ye.loop=!0,ye.connect(ve),ye.start()}return ve.stream}listDevicesOfKind(he,me){return x(this,void 0,void 0,function*(){return(me||this.deviceInfoCache===null||!this.isWatchingForDeviceChanges())&&(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(he)})}updateDeviceInfoCacheFromBrowser(){var he;return x(this,void 0,void 0,function*(){if(typeof MediaDeviceInfo>"u"){this.deviceInfoCache=[];return}let me=yield navigator.mediaDevices.enumerateDevices(),ve=!0;for(const ye of me)if(!ye.label){ve=!1;break}if(!ve)try{this.logger.info("attempting to trigger media device labels since they are hidden");const ye=yield this.deviceLabelTrigger();me=yield navigator.mediaDevices.enumerateDevices();for(const Se of ye.getTracks())Se.stop()}catch(ye){this.logger.info("unable to get media device labels"),(he=this.eventController)===null||he===void 0||he.publishEvent("deviceLabelTriggerFailed",{deviceLabelTriggerErrorMessage:this.getErrorMessage(ye)})}this.logger.debug(`Update device info cache with devices: ${JSON.stringify(me)}`),this.deviceInfoCache=me})}listCachedDevicesOfKind(he){const me=[];if(this.deviceInfoCache)for(const ve of this.deviceInfoCache)ve.kind===he&&me.push(ve);return me}handleDeviceChange(){return x(this,void 0,void 0,function*(){if(this.deviceInfoCache===null)return;if(this.alreadyHandlingDeviceChange){T.default.nextTick(()=>{this.handleDeviceChange()});return}this.alreadyHandlingDeviceChange=!0;const he=this.listCachedDevicesOfKind("audioinput"),me=this.listCachedDevicesOfKind("videoinput"),ve=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();const ye=this.listCachedDevicesOfKind("audioinput"),Se=this.listCachedDevicesOfKind("videoinput"),Ce=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver(be=>{this.areDeviceListsEqual(he,ye)||S.Maybe.of(be.audioInputsChanged).map(Ee=>Ee.bind(be)(ye)),this.areDeviceListsEqual(me,Se)||S.Maybe.of(be.videoInputsChanged).map(Ee=>Ee.bind(be)(Se)),this.areDeviceListsEqual(ve,Ce)||S.Maybe.of(be.audioOutputsChanged).map(Ee=>Ee.bind(be)(Ce))}),this.alreadyHandlingDeviceChange=!1})}handleDeviceStreamEnded(he,me){return x(this,void 0,void 0,function*(){try{he==="audio"?(this.useWebAudio&&this.browserBehavior.requiresAudioContextResetOnDeviceFailureForWebAudio()?(this.logger.warn("Audio input device which was active is no longer available, suspending and resuming audio context before resetting to empty device to ensure packets are sent"),yield this.stopAudioInput(),Br.suspendAudioContext(),Br.resumeAudioContext()):this.logger.warn("Audio input device which was active is no longer available, resetting to empty device to ensure packets are sent"),yield this.startAudioInput(null)):(this.logger.warn("Video input device which was active is no longer available, stopping video"),yield this.stopVideoInput())}catch{this.logger.error("Failed to choose null device after stream ended.")}he==="audio"?this.forEachObserver(ve=>{S.Maybe.of(ve.audioInputStreamEnded).map(ye=>ye.bind(ve)(me))}):this.forEachObserver(ve=>{S.Maybe.of(ve.videoInputStreamEnded).map(ye=>ye.bind(ve)(me))})})}forEachObserver(he){for(const me of this.deviceChangeObservers)T.default.nextTick(()=>{this.deviceChangeObservers.has(me)&&he(me)})}forEachMediaStreamBrokerObserver(he){for(const me of this.mediaStreamBrokerObservers)T.default.nextTick(()=>{this.mediaStreamBrokerObservers.has(me)&&he(me)})}areDeviceListsEqual(he,me){return JSON.stringify(he.map(ve=>JSON.stringify(ve)).sort())===JSON.stringify(me.map(ve=>JSON.stringify(ve)).sort())}intrinsicDeviceAsMediaStream(he){return he&&he.id?he:null}hasSameMediaStreamId(he,me,ve){var ye,Se,Ce,be;let Ee;return he==="audio"?(Ee=ve?.audio.streamId,!!Ee&&Ee===((Se=(ye=me.constraints)===null||ye===void 0?void 0:ye.audio)===null||Se===void 0?void 0:Se.streamId)):(Ee=ve?.video.streamId,!!Ee&&Ee===((be=(Ce=me?.constraints)===null||Ce===void 0?void 0:Ce.video)===null||be===void 0?void 0:be.streamId))}hasSameGroupId(he,me,ve){if(he==="")return!0;const ye=Br.getIntrinsicDeviceId(ve);return this.logger.debug(`Checking deviceIds ${ye} of type ${typeof ye} with groupId ${he}`),typeof ye=="string"&&he===this.getGroupIdFromDeviceId(me,ye)}getGroupIdFromDeviceId(he,me){if(this.deviceInfoCache!==null){const ve=this.listCachedDevicesOfKind(`${he}input`).find(ye=>ye.deviceId===me);if(ve&&ve.groupId)return this.logger.debug(`GroupId of deviceId ${me} found in cache is ${ve.groupId}`),ve.groupId}return this.logger.debug(`GroupId of deviceId ${me} found in cache is empty`),""}handleGetUserMediaError(he,me){if(!he)throw new ee.default(he);switch(he.name){case"NotReadableError":case"TrackStartError":throw new ie.default(he);case"NotFoundError":case"DevicesNotFoundError":throw new te.default(he);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":throw me&&me<Br.permissionDeniedOriginDetectionThresholdMs?new ae.default(he,"Permission denied by browser"):new ae.default(he,"Permission denied by user");case"OverconstrainedError":case"ConstraintNotSatisfiedError":throw new ne.default(he);case"TypeError":throw new oe.default(he);case"AbortError":default:throw new ee.default(he)}}matchesDeviceSelection(he,me,ve,ye){return ve&&ve.stream.active&&(this.hasSameMediaStreamId(he,ve,ye)||ve.groupId!==null&&this.hasSameGroupId(ve.groupId,he,me))?(this.logger.debug(`Compare current device constraint ${JSON.stringify(ve.constraints)} to proposed constraints ${JSON.stringify(ye)}`),ve.matchesConstraints(ye)):!1}chooseInputIntrinsicDevice(he,me){var ve,ye;return x(this,void 0,void 0,function*(){const Se=this.getMediaStreamConstraints(he,me);if(this.matchesDeviceSelection(he,me,this.activeDevices[he],Se)){this.logger.info(`reusing existing ${he} input device`);return}this.activeDevices[he]&&this.activeDevices[he].stream&&this.stopTracksAndRemoveCallbacks(he);const Ce=Date.now(),be=new H.default;try{this.logger.info(`requesting new ${he} device with constraint ${JSON.stringify(Se)}`);const Ee=this.intrinsicDeviceAsMediaStream(me);he==="audio"&&me===null?(be.stream=Br.createEmptyAudioDevice(),be.constraints=null):Ee?(this.logger.info(`using media stream ${Ee.id} for ${he} device`),be.stream=Ee,be.constraints=Se):(be.stream=yield navigator.mediaDevices.getUserMedia(Se),be.constraints=Se),yield this.handleNewInputDevice(he,be)}catch(Ee){const Ae=this.getErrorMessage(Ee);he==="audio"?(ve=this.eventController)===null||ve===void 0||ve.publishEvent("audioInputFailed",{audioInputErrorMessage:Ae}):(ye=this.eventController)===null||ye===void 0||ye.publishEvent("videoInputFailed",{videoInputErrorMessage:Ae}),this.logger.error(`failed to get ${he} device for constraints ${JSON.stringify(Se)}: ${Ae}`);let Ie=!0;if(Ee&&"constraint"in Ee&&(this.logger.error(`Over-constrained by constraint: ${Ee.constraint}`),this.useMediaConstraintsFallback)){const Te=this.getMediaStreamConstraints(he,me,!0),De=JSON.stringify(Te);if(De!==JSON.stringify(Se)){this.logger.info(`retry requesting new ${he} device with minimal constraint ${De}`);try{be.stream=yield navigator.mediaDevices.getUserMedia(Te),be.constraints=Te,yield this.handleNewInputDevice(he,be),Ie=!1}catch(Ue){this.logger.error(`failed to get ${he} device for constraints ${De}: ${this.getErrorMessage(Ue)}`)}}}if(Ie){if(he==="audio"){this.logger.info(`choosing null ${he} device instead`);try{be.stream=Br.createEmptyAudioDevice(),be.constraints=null,yield this.handleNewInputDevice(he,be)}catch(Te){this.logger.error(`failed to choose null ${he} device. ${Te.name}: ${Te.message}`)}}this.handleGetUserMediaError(Ee,Date.now()-Ce)}}finally{this.watchForDeviceChangesIfNecessary()}})}getErrorMessage(he){return he?he.name&&he.message?`${he.name}: ${he.message}`:he.name?he.name:he.message?he.message:"UnknownError":"UnknownError"}handleNewInputDevice(he,me){var ve;return x(this,void 0,void 0,function*(){this.logger.info(`got ${he} device for constraints ${JSON.stringify(me.constraints)}`);const ye=(ve=this.getMediaTrackSettings(me.stream))===null||ve===void 0?void 0:ve.deviceId;me.groupId=ye?this.getGroupIdFromDeviceId(he,ye):"",this.activeDevices[he]=me,this.logger.debug(`Set activeDevice to ${JSON.stringify(me)}`),this.watchForDeviceChangesIfNecessary();const Se=me.stream.getTracks()[0];if(Se&&(me.endedCallback=()=>{this.activeDevices[he]&&this.activeDevices[he].stream===me.stream&&(this.handleDeviceStreamEnded(he,ye),delete me.endedCallback)},Se.addEventListener("ended",me.endedCallback,{once:!0})),he==="audio"){const Ce=me.stream.getAudioTracks()[0];if(Ce){const be=Ce.getSettings().deviceId||me.stream;me.trackMuteCallback=()=>{this.mediaStreamMuteObserver(be,!0)},me.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(be,!1)},Ce.addEventListener("mute",me.trackMuteCallback,{once:!1}),Ce.addEventListener("unmute",me.trackUnmuteCallback,{once:!1}),this.logger.debug("Notifying mute state after selection"),Ce.muted?me.trackMuteCallback():me.trackUnmuteCallback()}}})}calculateMediaStreamConstraints(he,me,ve,ye){if(ye&&this.listCachedDevicesOfKind(`${he}input`).length===1)return!0;const Se={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?Se.deviceId=me:Se.deviceId={exact:me},ve&&(Se.groupId=ve),ye?Se:he==="video"?(Se.width={ideal:this.videoInputQualitySettings.videoWidth},Se.height={ideal:this.videoInputQualitySettings.videoHeight},Se.frameRate={ideal:this.videoInputQualitySettings.videoFrameRate},Se):(this.supportSampleRateConstraint()&&(Se.sampleRate={ideal:Br.defaultSampleRate}),this.supportSampleSizeConstraint()&&(Se.sampleSize={ideal:Br.defaultSampleSize}),this.supportChannelCountConstraint()&&(Se.channelCount={ideal:Br.defaultChannelCount}),Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},Se))}getMediaStreamConstraintsFromTrackConstraints(he,me){return he==="audio"?{audio:me}:{video:me}}getMediaStreamConstraints(he,me,ve=!1){let ye={};if(!me)return null;const Se=this.intrinsicDeviceAsMediaStream(me);if(Se)return ye.streamId=Se.id,this.getMediaStreamConstraintsFromTrackConstraints(he,ye);if(typeof me=="string"){let Ce="";return this.browserBehavior.requiresGroupIdMediaStreamConstraints()&&(this.deviceInfoCache!==null?Ce=this.getGroupIdFromDeviceId(he,me):this.logger.error("Device cache is not populated. Please make sure to call list devices first")),ye=this.calculateMediaStreamConstraints(he,me,Ce,ve),this.getMediaStreamConstraintsFromTrackConstraints(he,ye)}return ce(me)?(ye=this.calculateMediaStreamConstraints(he,me.deviceId,me.groupId,ve),this.getMediaStreamConstraintsFromTrackConstraints(he,ye)):(ye=me,this.getMediaStreamConstraintsFromTrackConstraints(he,ye))}deviceInfoFromDeviceId(he,me){if(this.deviceInfoCache===null)return null;for(const ve of this.deviceInfoCache)if(ve.kind===he&&ve.deviceId===me)return ve;return null}hasAppliedTransform(){return!!this.transform}isMediaStreamReusableByDeviceId(he,me){if(!he||!he.active||!me)return!1;if(me.id)return he.id===me.id;const ve=this.getMediaTrackSettings(he);if(!ve.deviceId)return!1;const ye=Br.getIntrinsicDeviceId(me);return typeof ye=="string"?ve.deviceId===ye:!1}getMediaTrackSettings(he){var me;return(me=he.getTracks()[0])===null||me===void 0?void 0:me.getSettings()}reconnectAudioInputs(){if(!this.audioInputSourceNode)return;this.audioInputSourceNode.disconnect();const he=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(he)}setTransform(he,me){var ve,ye;(ye=(ve=this.transform)===null||ve===void 0?void 0:ve.nodes)===null||ye===void 0||ye.end.disconnect(),this.transform={nodes:me,device:he};const Se=me?.end,Ce=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${Se} to destination ${Ce}.`),Se?.connect(Ce),this.reconnectAudioInputs()}removeTransform(){var he;const me=this.transform;if(me)return(he=this.transform.nodes)===null||he===void 0||he.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),me}attachAudioInputStreamToAudioContext(he){var me;(me=this.audioInputSourceNode)===null||me===void 0||me.disconnect(),this.audioInputSourceNode=Br.getAudioContext().createMediaStreamSource(he);const ve=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(ve)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=Br.getAudioContext().createMediaStreamDestination()),this.audioInputDestinationNode}getMediaStreamOutputNode(){var he,me;return((me=(he=this.transform)===null||he===void 0?void 0:he.nodes)===null||me===void 0?void 0:me.start)||this.getMediaStreamDestinationNode()}static setDefaultLatencyHint(he){Br.defaultLatencyHint=he}static getAudioContext(){if(!Br.audioContext){const he={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(he.sampleRate=Br.defaultSampleRate),new E.default().requiresPlaybackLatencyHintForAudioContext()&&(he.latencyHint="playback"),Br.defaultLatencyHint&&(he.latencyHint=Br.defaultLatencyHint),Br.audioContext=new(window.AudioContext||window.webkitAudioContext)(he)}return Br.audioContext}static suspendAudioContext(){return x(this,void 0,void 0,function*(){return Br.audioContext?Br.audioContext.suspend():Promise.resolve()})}static resumeAudioContext(){return x(this,void 0,void 0,function*(){return Br.audioContext?Br.audioContext.resume():Promise.resolve()})}static closeAudioContext(){if(Br.audioContext)try{Br.audioContext.close()}catch{}Br.audioContext=null}addMediaStreamBrokerObserver(he){this.mediaStreamBrokerObservers.add(he)}removeMediaStreamBrokerObserver(he){this.mediaStreamBrokerObservers.delete(he)}publishVideoInputDidChangeEvent(he){this.forEachMediaStreamBrokerObserver(me=>{me.videoInputDidChange&&me.videoInputDidChange(he)}),this.pushVideoMeetingStateForPermissions(he)}publishAudioInputDidChangeEvent(he){this.forEachMediaStreamBrokerObserver(me=>{me.audioInputDidChange&&me.audioInputDidChange(he)}),this.pushAudioMeetingStateForPermissions(he)}publishAudioOutputDidChangeEvent(he){this.forEachMediaStreamBrokerObserver(me=>{me.audioOutputDidChange&&me.audioOutputDidChange(he)})}supportSampleRateConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleRate}supportSampleSizeConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleSize}supportChannelCountConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().channelCount}trace(he,me,ve){let ye=`API/DefaultDeviceController/${he}`;typeof me<"u"&&(ye+=` ${JSON.stringify(me)}`),typeof ve<"u"&&(ye+=` -> ${JSON.stringify(ve)}`),this.logger.info(ye)}};DefaultDeviceController.default=de,de.permissionDeniedOriginDetectionThresholdMs=500,de.defaultVideoWidth=960,de.defaultVideoHeight=540,de.defaultVideoFrameRate=15,de.defaultSampleRate=48e3,de.defaultSampleSize=16,de.defaultChannelCount=1,de.audioContext=null;function ce(pe){return typeof pe=="object"&&"deviceId"in pe&&"groupId"in pe&&"kind"in pe&&"label"in pe}return DefaultDeviceController}var hasRequiredContentShareMediaStreamBroker;function requireContentShareMediaStreamBroker(){if(hasRequiredContentShareMediaStreamBroker)return ContentShareMediaStreamBroker;hasRequiredContentShareMediaStreamBroker=1;var x=ContentShareMediaStreamBroker&&ContentShareMediaStreamBroker.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=ContentShareMediaStreamBroker&&ContentShareMediaStreamBroker.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ContentShareMediaStreamBroker,"__esModule",{value:!0});const E=C(requireDefaultBrowserBehavior()),w=C(requireDefaultDeviceController());let T=class qd{constructor(S){this.logger=S}get mediaStream(){return this._mediaStream}set mediaStream(S){this._mediaStream=S}acquireAudioInputStream(){return x(this,void 0,void 0,function*(){return this._mediaStream.getAudioTracks().length===0?(this.logger.info("No audio stream available. Synthesizing an audio stream."),w.default.synthesizeAudioDevice(0)):this._mediaStream})}acquireVideoInputStream(){return x(this,void 0,void 0,function*(){return this._mediaStream})}acquireDisplayInputStream(S){return x(this,void 0,void 0,function*(){return S&&S.video&&S.video.mandatory&&S.video.mandatory.chromeMediaSource&&S.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(S):navigator.mediaDevices.getDisplayMedia(S)})}acquireScreenCaptureDisplayInputStream(S,R){return x(this,void 0,void 0,function*(){return this.acquireDisplayInputStream(this.screenCaptureDisplayMediaConstraints(S,R))})}screenCaptureDisplayMediaConstraints(S,R){return{audio:!!(!S&&new E.default().getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!S&&{frameRate:{max:R||qd.defaultFrameRate}}),S&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:S,maxFrameRate:R||qd.defaultFrameRate}})}}toggleMediaStream(S){let R=!1;if(this.mediaStream)for(let A=0;A<this.mediaStream.getTracks().length;A++)this.mediaStream.getTracks()[A].enabled!==S&&(this.mediaStream.getTracks()[A].enabled=S,R=!0);return R}cleanup(){if(this.mediaStream)for(let S=0;S<this.mediaStream.getTracks().length;S++)this.mediaStream.getTracks()[S].stop();this.mediaStream=null}muteLocalAudioInputStream(){throw new Error("unsupported")}unmuteLocalAudioInputStream(){throw new Error("unsupported")}addMediaStreamBrokerObserver(S){}removeMediaStreamBrokerObserver(S){}};return ContentShareMediaStreamBroker.default=T,T.defaultFrameRate=15,ContentShareMediaStreamBroker}var CreatePeerConnectionTask={},hasRequiredCreatePeerConnectionTask;function requireCreatePeerConnectionTask(){if(hasRequiredCreatePeerConnectionTask)return CreatePeerConnectionTask;hasRequiredCreatePeerConnectionTask=1;var x=CreatePeerConnectionTask&&CreatePeerConnectionTask.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=CreatePeerConnectionTask&&CreatePeerConnectionTask.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(CreatePeerConnectionTask,"__esModule",{value:!0});const E=C(requireBaseTask());let w=class extends E.default{constructor(T){super(T.logger),this.context=T,this.taskName="CreatePeerConnectionTask",this.removeTrackAddedEventListener=null,this.removeTrackRemovedEventListeners={},this.trackEvents=["ended","mute","unmute","isolationchange","overconstrained"],this.removeVideoTrackEventListeners={},this.trackAddedHandler=_=>{const S=_.track;if(this.context.logger.info(`received track event: kind=${S.kind} id=${S.id} label=${S.label}`),_.transceiver&&_.transceiver.currentDirection==="inactive")return;if(_.streams.length===0){this.context.logger.warn("Track event but no stream");return}const R=_.streams[0];S.kind==="audio"?this.context.audioMixController.bindAudioStream(R):S.kind==="video"&&!this.trackIsVideoInput(S)&&this.addRemoteVideoTrack(S,R)}}removeObserver(){this.removeTrackAddedEventListener&&this.removeTrackAddedEventListener();for(const T in this.removeTrackRemovedEventListeners)this.removeTrackRemovedEventListeners[T]()}addPeerConnectionEventLogger(){const T=this.context.peer;T.addEventListener("connectionstatechange",()=>{this.context.logger.info(`peer connection state changed: ${T.connectionState}`)}),T.addEventListener("negotiationneeded",()=>{this.context.logger.info("peer connection negotiation is needed")}),T.addEventListener("icegatheringstatechange",()=>{this.context.logger.info(`peer connection ice gathering state changed: ${T.iceGatheringState}`)}),T.addEventListener("icecandidate",_=>{this.context.logger.info(`peer connection ice candidate: ${_.candidate?_.candidate.candidate:"(null)"}`)}),T.addEventListener("iceconnectionstatechange",()=>{this.context.logger.info(`peer connection ice connection state changed: ${T.iceConnectionState}`)})}run(){return x(this,void 0,void 0,function*(){this.context.removableObservers.push(this);const T=this.context.turnCredentials&&this.context.turnCredentials.uris.length>0?{iceServers:[{urls:this.context.turnCredentials.uris,username:this.context.turnCredentials.username,credential:this.context.turnCredentials.password,credentialType:"password"}],iceTransportPolicy:"relay"}:{};T.bundlePolicy=this.context.browserBehavior.requiresBundlePolicy(),T.sdpSemantics="unified-plan",T.encodedInsertableStreams=this.context.audioProfile.hasRedundancyEnabled(),this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(T),this.addPeerConnectionEventLogger()),this.removeTrackAddedEventListener=()=>{this.context.peer&&this.context.peer.removeEventListener("track",this.trackAddedHandler),this.removeTrackAddedEventListener=null},this.context.peer.addEventListener("track",this.trackAddedHandler)})}trackIsVideoInput(T){return this.context.transceiverController.useTransceivers()?(this.logger.debug(()=>"getting video track type"),this.context.transceiverController.trackIsVideoInput(T)):!1}addRemoteVideoTrack(T,_){var S;const R=_.id,A=this.context.videoStreamIndex.attendeeIdForTrack(R);let O,H;if(this.context.videoTileController.getVideoTileForAttendeeId?(H=this.context.videoTileController.getVideoTileForAttendeeId(A),O=!!(!((S=H?.state())===null||S===void 0)&&S.boundVideoStream)):O=this.context.videoTileController.haveVideoTileForAttendeeId(A),O){this.context.logger.info(`Not adding remote track. Already have tile for attendeeId:  ${A}`);return}H||(H=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${H.id()}`));let ee=this.context.videoStreamIndex.streamIdForTrack(R);typeof ee>"u"&&(this.logger.warn(`stream not found for tile=${H.id()} track=${R}`),ee=null);let te=this.context.videoStreamIndex.groupIdForStreamId(ee);te===void 0&&(te=null);for(let de=0;de<this.trackEvents.length;de++){const ce=this.trackEvents[de],pe=_.getVideoTracks();if(pe&&pe.length){const he=pe[0],me=()=>{this.context.logger.info(`received the ${ce} event for tile=${H.id()} id=${T.id} streamId=${ee}`),ce==="ended"&&this.removeRemoteVideoTrack(T,H.state())};he.addEventListener(ce,me),this.removeVideoTrackEventListeners[T.id]||(this.removeVideoTrackEventListeners[T.id]=[]),this.removeVideoTrackEventListeners[T.id].push(()=>{he.removeEventListener(ce,me)})}}let ie,ne;if(T.getSettings){const de=T.getSettings();ie=de.width,ne=de.height}else{const de=T.getCapabilities();ie=de.width,ne=de.height}const ae=this.context.videoStreamIndex.externalUserIdForTrack(R);H.bindVideoStream(A,!1,_,ie,ne,ee,ae,te),this.logger.info(`video track added, use tile=${H.id()} track=${R} streamId=${ee} groupId=${te}`);const oe="removetrack",le=_,fe=()=>this.removeRemoteVideoTrack(T,H.state());this.removeTrackRemovedEventListeners[T.id]=()=>{le.removeEventListener(oe,fe),delete this.removeTrackRemovedEventListeners[T.id]},le.addEventListener(oe,fe)}removeRemoteVideoTrack(T,_){if(this.removeTrackRemovedEventListeners.hasOwnProperty(T.id)){this.removeTrackRemovedEventListeners[T.id]();for(const S of this.removeVideoTrackEventListeners[T.id])S();delete this.removeVideoTrackEventListeners[T.id]}this.logger.info(`video track ended, removing tile=${_.tileId} id=${T.id} stream=${_.streamId}`),_.streamId?this.context.videosPaused.remove(_.streamId):this.logger.warn(`no stream found for tile=${_.tileId}`),this.context.videoTileController.removeVideoTile(_.tileId)}};return CreatePeerConnectionTask.default=w,w.REMOVE_HANDLER_INTERVAL_MS=1e4,CreatePeerConnectionTask}var CreateSDPTask={},MeetingSessionStatusCode={},hasRequiredMeetingSessionStatusCode;function requireMeetingSessionStatusCode(){return hasRequiredMeetingSessionStatusCode||(hasRequiredMeetingSessionStatusCode=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.MeetingSessionStatusCode=void 0;var C;(function(E){E[E.OK=0]="OK",E[E.Left=1]="Left",E[E.AudioJoinedFromAnotherDevice=2]="AudioJoinedFromAnotherDevice",E[E.AudioAuthenticationRejected=3]="AudioAuthenticationRejected",E[E.AudioCallAtCapacity=4]="AudioCallAtCapacity",E[E.MeetingEnded=5]="MeetingEnded",E[E.AudioInternalServerError=6]="AudioInternalServerError",E[E.AudioServiceUnavailable=7]="AudioServiceUnavailable",E[E.AudioDisconnected=8]="AudioDisconnected",E[E.VideoCallSwitchToViewOnly=9]="VideoCallSwitchToViewOnly",E[E.VideoCallAtSourceCapacity=10]="VideoCallAtSourceCapacity",E[E.SignalingBadRequest=11]="SignalingBadRequest",E[E.SignalingInternalServerError=12]="SignalingInternalServerError",E[E.SignalingRequestFailed=13]="SignalingRequestFailed",E[E.SignalingChannelClosedUnexpectedly=14]="SignalingChannelClosedUnexpectedly",E[E.ICEGatheringTimeoutWorkaround=15]="ICEGatheringTimeoutWorkaround",E[E.ConnectionHealthReconnect=16]="ConnectionHealthReconnect",E[E.RealtimeApiFailed=17]="RealtimeApiFailed",E[E.TaskFailed=18]="TaskFailed",E[E.IncompatibleSDP=19]="IncompatibleSDP",E[E.TURNCredentialsForbidden=20]="TURNCredentialsForbidden",E[E.NoAttendeePresent=21]="NoAttendeePresent",E[E.AudioAttendeeRemoved=22]="AudioAttendeeRemoved",E[E.AudioVideoWasRemovedFromPrimaryMeeting=23]="AudioVideoWasRemovedFromPrimaryMeeting",E[E.AudioVideoDisconnectedWhilePromoted=24]="AudioVideoDisconnectedWhilePromoted",E[E.AudioDisconnectAudio=25]="AudioDisconnectAudio"})(C=x.MeetingSessionStatusCode||(x.MeetingSessionStatusCode={})),x.default=C}(MeetingSessionStatusCode)),MeetingSessionStatusCode}var SDP={},SDPCandidateType={},hasRequiredSDPCandidateType;function requireSDPCandidateType(){return hasRequiredSDPCandidateType||(hasRequiredSDPCandidateType=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SDPCandidateType=void 0;var C;(function(E){E.Host="host",E.ServerReflexive="srflx",E.PeerReflexive="prflx",E.Relay="relay"})(C=x.SDPCandidateType||(x.SDPCandidateType={})),x.default=C}(SDPCandidateType)),SDPCandidateType}var SDPMediaSection={},hasRequiredSDPMediaSection;function requireSDPMediaSection(){if(hasRequiredSDPMediaSection)return SDPMediaSection;hasRequiredSDPMediaSection=1,Object.defineProperty(SDPMediaSection,"__esModule",{value:!0});let x=class{};return SDPMediaSection.default=x,SDPMediaSection}var VideoCodecCapability={},hasRequiredVideoCodecCapability;function requireVideoCodecCapability(){if(hasRequiredVideoCodecCapability)return VideoCodecCapability;hasRequiredVideoCodecCapability=1,Object.defineProperty(VideoCodecCapability,"__esModule",{value:!0});const x=requireSignalingProtocol();let C=class ui{constructor(w,T){this.codecName=w,this.codecCapability=T}equals(w){if(w===void 0||this.codecName!==w.codecName||this.codecCapability.mimeType!==w.codecCapability.mimeType||this.codecCapability.clockRate!==w.codecCapability.clockRate)return!1;const T=this.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(this.codecCapability.sdpFmtpLine,this.codecName):"",_=w.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(w.codecCapability.sdpFmtpLine,w.codecName):"";return T===_}fmtpLineMatches(w,T){const _=this.codecCapability.sdpFmtpLine;if(!_)return!1;const S=`a=fmtp:${T} `;if(!w.startsWith(S))return!1;const R=w.substring(S.length);return this.cleanupFmtpLine(R,this.codecName)===this.cleanupFmtpLine(_,this.codecName)}cleanupFmtpLine(w,T){const _=/;x-google-start-bitrate=\d+/g;let S=w.replace(_,"");if(T==="H264"){const R=/profile-level-id=([0-9a-f]{4})[0-9a-f]{2}/i;S=S.replace(R,"profile-level-id=$1")}return S}static vp8(){return new ui("VP8",{clockRate:9e4,mimeType:"video/VP8"})}static h264BaselineProfile(){return new ui("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"})}static h264ConstrainedBaselineProfile(){return new ui("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"})}static h264MainProfile(){return new ui("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f"})}static h264HighProfile(){return new ui("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f"})}static h264ConstrainedHighProfile(){return new ui("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f"})}static h264(){return ui.h264ConstrainedBaselineProfile()}static vp9Profile0(){return new ui("VP9",{clockRate:9e4,mimeType:"video/VP9",sdpFmtpLine:"profile-id=0"})}static vp9(){return ui.vp9Profile0()}static av1Main(){return new ui("AV1",{clockRate:9e4,mimeType:"video/AV1"})}static av1(){return ui.av1Main()}static fromSignaled(w){switch(w){case x.SdkVideoCodecCapability.VP8:return ui.vp8();case x.SdkVideoCodecCapability.H264_BASELINE_PROFILE:return ui.h264BaselineProfile();case x.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:return ui.h264ConstrainedBaselineProfile();case x.SdkVideoCodecCapability.H264_MAIN_PROFILE:return ui.h264MainProfile();case x.SdkVideoCodecCapability.H264_HIGH_PROFILE:return ui.h264HighProfile();case x.SdkVideoCodecCapability.H264_CONSTRAINED_HIGH_PROFILE:return ui.h264ConstrainedHighProfile();case x.SdkVideoCodecCapability.VP9_PROFILE_0:return ui.vp9Profile0();case x.SdkVideoCodecCapability.AV1_MAIN_PROFILE:return ui.av1Main();default:return}}};return VideoCodecCapability.default=C,VideoCodecCapability}var hasRequiredSDP;function requireSDP(){if(hasRequiredSDP)return SDP;hasRequiredSDP=1;var x=SDP&&SDP.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(SDP,"__esModule",{value:!0});const C=x(requireSDPCandidateType()),E=x(requireSDPMediaSection()),w=x(requireVideoCodecCapability());let T=class br{constructor(S){this.sdp=S}clone(){return new br(this.sdp)}static isRTPCandidate(S){const R=/candidate[:](\S+) (\d+)/g.exec(S);return!(R===null||R[2]!=="1")}static linesToSDP(S){return new br(S.join(br.CRLF))}static candidateTypeFromString(S){switch(S){case C.default.Host:return C.default.Host;case C.default.ServerReflexive:return C.default.ServerReflexive;case C.default.PeerReflexive:return C.default.PeerReflexive;case C.default.Relay:return C.default.Relay}return null}static candidateType(S){const R=/a[=]candidate[:].* typ ([a-z]+) /g.exec(S);return R===null?null:br.candidateTypeFromString(R[1])}static mediaType(S){const R=/m=(audio|video)/g.exec(S);if(R!==null)return R[1]}static mid(S){if(S.includes("a=mid:"))return S.replace(/^(a=mid:)/,"")}static direction(S){const R=/a=(sendrecv|sendonly|recvonly|inactive)/g.exec(S);if(R!==null)return R[1]}static splitLines(S){return S.trim().split(`
`).map(R=>R.trim())}static splitSections(S){return S.split(`
m=`).map((R,A)=>(A>0?"m="+R:R).trim()+br.CRLF)}static findActiveCameraSection(S){let R=0,A=!1;for(const O of S){if(/^m=video/.test(O)&&(O.indexOf("sendrecv")>-1||O.indexOf("sendonly")===-1&&O.indexOf("recvonly")===-1&&O.indexOf("inactive")===-1)){A=!0;break}R++}return A===!1&&(R=-1),R}static extractSSRCsFromFIDGroupLine(S){return/^a=ssrc-group:FID\s(.+)/.exec(S)[1]}static matchPrefix(S,R){return br.splitLines(S).filter(A=>A.indexOf(R)===0)}lines(){return this.sdp.split(br.CRLF)}hasVideo(){return/^m=video/gm.exec(this.sdp)!==null}hasCandidates(){return/a[=]candidate[:]/g.exec(this.sdp)!==null}hasCandidatesForAllMLines(){return!(this.sdp.indexOf("c=IN IP4 0.0.0.0")>-1)}withoutCandidateType(S){return br.linesToSDP(this.lines().filter(R=>br.candidateType(R)!==S))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(C.default.ServerReflexive)}withAudioMaxAverageBitrate(S){if(!S)return this.clone();S=Math.trunc(Math.min(Math.max(S,br.rfc7587LowestBitrate),br.rfc7587HighestBitrate));const R=this.lines(),A=br.findOpusFmtpAttributes(R),O=br.updateOpusFmtpAttributes(R,A,[`maxaveragebitrate=${S}`]);return br.linesToSDP(O)}withStereoAudio(){const S=this.lines(),R=br.findOpusFmtpAttributes(S),A=br.updateOpusFmtpAttributes(S,R,["stereo=1","sprop-stereo=1"]);return br.linesToSDP(A)}static findOpusFmtpAttributes(S){const R=/^a=rtpmap:\s*(\d+)\s+opus\/48000/;let A=!1;const O=[];for(const H of S)if(H.startsWith("m=audio")&&(O.push(null),A=!0),H.startsWith("m=video")&&(A=!1),A){const ee=R.exec(H);ee!==null&&(O[O.length-1]=`a=fmtp:${ee[1]} `)}return O}static updateOpusFmtpAttributes(S,R,A){const O=[];let H=0,ee=null;for(const te of S)if(te.startsWith("m=audio")&&(ee=R[H],H++),te.startsWith("m=video")&&(ee=null),ee&&te.startsWith(ee)){const ie=te.slice(ee.length).split(";"),ne=[];for(const ae of ie)A.findIndex(oe=>oe.startsWith(ae.split("=")[0]))<0&&ne.push(ae);for(const ae of A)ne.push(ae);O.push(ee+ne.join(";"))}else O.push(te);return O}withUnifiedPlanFormat(){let S=this.sdp;return S.includes("mozilla")?this.clone():(S=S.replace("o=-","o=mozilla-chrome"),new br(S))}getUniqueRtpHeaderExtensionId(S){const R=[];for(const O of S)if(/^a=extmap:/.test(O.trim())){const H=+O.split("a=extmap:")[1].split(" ")[0];R.includes(H)||R.push(H)}R.sort((O,H)=>O-H);let A=0;for(const O of R){if(O-A>1)return A+1;A=O}return A===14?-1:A+1}withVideoLayersAllocationRtpHeaderExtension(S){return this.withRtpHeaderExtension(S,br.videoLayersAllocationRtpHeaderExtensionUrl)}withDependencyDescriptorRtpHeaderExtension(S){return this.withRtpHeaderExtension(S,br.dependencyDescriptorRtpHeaderExtensionUrl)}withoutDependencyDescriptorRtpHeaderExtension(){const S=br.splitLines(this.sdp).filter(R=>!R.includes(br.dependencyDescriptorRtpHeaderExtensionUrl));return new br(S.join(br.CRLF)+br.CRLF)}withRtpHeaderExtension(S,R){const A=S?S.getRtpHeaderExtensionId(R):-1,O=A===-1?this.getUniqueRtpHeaderExtensionId(br.splitLines(this.sdp)):A,H=br.splitSections(this.sdp),ee=[];for(let ie of H){if(/^m=video/.test(ie)&&br.getRtpHeaderExtensionIdInSection(ie,R)===-1){const ne=br.splitLines(ie),ae=[];if(O===-1||this.hasRtpHeaderExtensionId(O)){ee.push(ie);continue}for(const oe of ne)if(ae.push(oe),/^a=sendrecv/.test(oe.trim())){const le="a=extmap:"+O+" "+R;ae.push(le)}ie=ae.join(br.CRLF)+br.CRLF}else if(A!==-1&&/^m=video/.test(ie)&&br.getRtpHeaderExtensionIdInSection(ie,R)!==A){const ne=br.splitLines(ie),ae=[];for(const oe of ne){if(/^a=extmap:/.test(oe.trim())&&oe.split("a=extmap:")[1].split(" ")[1]===R){if(!this.hasRtpHeaderExtensionId(A)){const le="a=extmap:"+A+" "+R;ae.push(le)}continue}ae.push(oe)}ie=ae.join(br.CRLF)+br.CRLF}ee.push(ie)}const te=ee.join("");return new br(te)}ssrcForVideoSendingSection(){const S=this.sdp,R=br.splitSections(S);if(R.length<2)return"";const A=br.findActiveCameraSection(R);if(A===-1)return"";const O=br.matchPrefix(R[A],"a=ssrc-group:FID ");if(O.length<1)return"";const H=br.extractSSRCsFromFIDGroupLine(O[0]),[ee]=H.split(" ").map(te=>parseInt(te,10));return ee.toString()}videoSendSectionHasDifferentSSRC(S){const R=this.ssrcForVideoSendingSection(),A=S.ssrcForVideoSendingSection();if(R===""||A==="")return!1;const O=parseInt(R,10),H=parseInt(A,10);return O!==H}removeH264SupportFromSendSection(){const S=this.sdp,R=br.splitSections(S),A=br.findActiveCameraSection(R);if(A===-1)return new br(this.sdp);const O=R[A],H=br.splitLines(O),ee=[],te=new Map;H.forEach(oe=>{if(/^a=rtpmap:/.test(oe)){const le=/^a=rtpmap:([0-9]+)\s/.exec(oe);le&&oe.toLowerCase().includes("h264")&&ee.push(parseInt(le[1],10))}if(/^a=fmtp:/.test(oe)){const le=/^a=fmtp:([0-9]+) apt=([0-9]+)/.exec(oe);if(le&&le.length===3){const fe=parseInt(le[1],10),de=parseInt(le[2],10);te.has(de)?te.get(de).push(fe):te.set(de,[fe])}}});const ie=new Set;for(const oe of ee){ie.add(oe);const le=te.get(oe);if(le)for(const fe of le)ie.add(fe)}if(ee.length>0){const oe=H[0].split(" ");H[0]=oe.filter(le=>!ie.has(parseInt(le))).join(" ")}const ne=H.filter(oe=>{if(!oe.includes("rtpmap")&&!oe.includes("rtcp-fb")&&!oe.includes("fmtp"))return!0;for(const le of ie)if(oe.includes(le.toString()))return!1;return!0});R[A]=ne.join(br.CRLF)+br.CRLF;const ae=R.join("");return new br(ae)}mediaSections(){const S=br.splitSections(this.sdp);if(S.length<2)return[];const R=[];for(let A=1;A<S.length;A++){const O=new E.default,H=br.splitLines(S[A]);for(const ee of H){const te=br.mediaType(ee);if(te!==void 0){O.mediaType=te;continue}const ie=br.direction(ee);if(ie!==void 0){O.direction=ie;continue}const ne=br.mid(ee);if(ne!==void 0){O.mid=ne;continue}}R.push(O)}return R}static getRtpHeaderExtensionIdInSection(S,R){const A=br.splitLines(S);for(const O of A)if(/^a=extmap:/.test(O.trim())){const H=O.split("a=extmap:")[1].split(" "),ee=+H[0];if(H[1]===R)return ee}return-1}getRtpHeaderExtensionId(S){const R=br.splitSections(this.sdp);for(const A of R)if(/^m=video/.test(A)){const O=br.getRtpHeaderExtensionIdInSection(A,S);if(O!==-1)return O}return-1}hasRtpHeaderExtensionId(S){const R=br.splitLines(this.sdp);for(const A of R)if(/^a=extmap:/.test(A.trim())&&+A.split("a=extmap:")[1].split(" ")[0]===S)return!0;return!1}withVideoSendCodecPreferences(S){const R=this.sdp,A=br.splitSections(R),O=br.findActiveCameraSection(A);if(O===-1)return new br(this.sdp);A[O]=this.sectionWithCodecPreferences(A[O],S);const H=A.join("");return new br(H)}sectionWithCodecPreferences(S,R){const A=new Map,O=br.splitLines(S);O.forEach(ie=>{if(!ie.startsWith("a=rtpmap:"))return;const ne=/^a=rtpmap:(\d+)\s/.exec(ie);if(!ne)return;const ae=ne[1];for(const oe of R){if(!ie.includes(`${oe.codecName}/${oe.codecCapability.clockRate}`))continue;let le=!1;if(oe.codecCapability.sdpFmtpLine!==void 0){let fe=!1;for(const de of O){if(oe.fmtpLineMatches(de,parseInt(ae))){le=!0;break}fe||(fe=de.startsWith(`a=fmtp:${ae} profile-id=`))}oe.equals(w.default.vp9Profile0())&&!fe&&(le=!0)}else le=!0;if(le){A.set(ae,oe);break}}});const H=new Set(A.keys()),ee=O[0].split(" ").filter(ie=>!H.has(ie)),te=Array.from(A.entries()).sort(([ie,ne],[ae,oe])=>{const le=R.indexOf(ne),fe=R.indexOf(oe);return le-fe}).map(([ie,ne])=>ie);return ee.splice(3,0,...te),O[0]=ee.join(" "),O.join(br.CRLF)+br.CRLF}highestPriorityVideoSendCodec(){const S=this.prioritizedSendVideoCodecCapabilities();return S.length>0?S[0]:void 0}prioritizedSendVideoCodecCapabilities(){const S=this.sdp,R=br.splitSections(S),A=br.findActiveCameraSection(R);if(A===-1)return[];const O=br.splitLines(R[A]),H=O[0].split(" ");return H.length<4?[]:H.slice(3).map(ee=>this.videoCodecCapabilityForPayloadType(O,ee)).filter(ee=>ee!==void 0&&["VP8","H264","VP9","AV1"].includes(ee.codecName))}videoCodecCapabilityForPayloadType(S,R){let A,O,H;for(const ee of S){const te=/^a=rtpmap:([0-9]+)\s/.exec(ee);if(te&&te[1]===R){const ie=ee.split(" ")[1].split("/");ie.length>=2&&(A=ie[0],O=ie[1])}ee.startsWith(`a=fmtp:${R} `)&&(H=ee.split(" ")[1])}if(A!==void 0)return new w.default(A,{clockRate:parseInt(O),mimeType:`video/${A}`,sdpFmtpLine:H})}getAudioPayloadTypes(){const S=new Map,R=this.sdp,A=br.splitSections(R);return S.set("opus",br.findAudioPayloadType("opus",A)),S.set("red",br.findAudioPayloadType("red",A)),S}static findAudioPayloadType(S,R){const A=`a=rtpmap:\\s*(\\d+)\\s+${S}\\/48000`,O=new RegExp(A);for(const H of R)if(/^m=audio/.test(H)){const ee=O.exec(H);if(ee!==null)return Number(ee[1])}return 0}withStartingVideoSendBitrate(S){const R=br.splitSections(this.sdp),A=br.findActiveCameraSection(R);if(A===-1)return this;const O=br.splitLines(R[A]),H=[];for(const te of O)if(/^a=fmtp:\d*/.test(te)){const ie=te+`;x-google-start-bitrate=${S}`;H.push(ie)}else H.push(te);R[A]=H.join(br.CRLF)+br.CRLF;const ee=R.join("");return new br(ee)}};return SDP.default=T,T.CRLF=`\r
`,T.rfc7587LowestBitrate=6e3,T.rfc7587HighestBitrate=51e4,T.dependencyDescriptorRtpHeaderExtensionUrl="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension",T.videoLayersAllocationRtpHeaderExtensionUrl="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00",SDP}var hasRequiredCreateSDPTask;function requireCreateSDPTask(){if(hasRequiredCreateSDPTask)return CreateSDPTask;hasRequiredCreateSDPTask=1;var x=CreateSDPTask&&CreateSDPTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=CreateSDPTask&&CreateSDPTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(CreateSDPTask,"__esModule",{value:!0});const E=C(requireMeetingSessionStatusCode()),w=C(requireSDP()),T=C(requireBaseTask());let _=class extends T.default{constructor(S){super(S.logger),this.context=S,this.taskName="CreateSDPTask"}cancel(){if(this.cancelPromise){const S=new Error(`canceling ${this.name()}`);this.cancelPromise(S),delete this.cancelPromise}}sessionUsesAudio(){var S,R;return!!(!((R=(S=this.context.meetingSessionConfiguration)===null||S===void 0?void 0:S.urls)===null||R===void 0)&&R.audioHostURL)}sessionUsesVideo(){let S;this.context.transceiverController.useTransceivers()?S=this.context.transceiverController.hasVideoInput():S=this.context.videoTileController.hasStartedLocalVideoTile();const R=!!this.context.videosToReceive&&!this.context.videosToReceive.empty(),A=S||R;return this.context.logger.info(`uses video: ${A} (enabled: true, sending: ${S}, receiving: ${R})`),A}run(){return x(this,void 0,void 0,function*(){const S={offerToReceiveAudio:this.sessionUsesAudio(),offerToReceiveVideo:this.sessionUsesVideo()};this.logger.info(`peer connection offerOptions: ${JSON.stringify(S)}`),yield new Promise((R,A)=>x(this,void 0,void 0,function*(){this.cancelPromise=O=>{A(O)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(S),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new w.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){const O=new Error(`canceling ${this.name()} due to the meeting status code: ${E.default.IncompatibleSDP}`);this.context.previousSdpOffer=null,A(O);return}R()}catch(O){A(O)}finally{delete this.cancelPromise}}))})}};return CreateSDPTask.default=_,CreateSDPTask}var DataMessage={},hasRequiredDataMessage;function requireDataMessage(){if(hasRequiredDataMessage)return DataMessage;hasRequiredDataMessage=1,Object.defineProperty(DataMessage,"__esModule",{value:!0});let x=class{constructor(C,E,w,T,_,S){this.timestampMs=C,this.topic=E,this.data=w,this.senderAttendeeId=T,this.senderExternalUserId=_,this.throttled=!!S}text(){return new TextDecoder().decode(this.data)}json(){return JSON.parse(new TextDecoder().decode(this.data))}};return DataMessage.default=x,DataMessage}var DefaultActiveSpeakerDetector={},hasRequiredDefaultActiveSpeakerDetector;function requireDefaultActiveSpeakerDetector(){if(hasRequiredDefaultActiveSpeakerDetector)return DefaultActiveSpeakerDetector;hasRequiredDefaultActiveSpeakerDetector=1;var x=DefaultActiveSpeakerDetector&&DefaultActiveSpeakerDetector.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=DefaultActiveSpeakerDetector&&DefaultActiveSpeakerDetector.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(DefaultActiveSpeakerDetector,"__esModule",{value:!0});const E=C(requireIntervalScheduler());let w=class{constructor(T,_,S,R=1e3,A=200){this.realtimeController=T,this.selfAttendeeId=_,this.hasBandwidthPriorityCallback=S,this.waitIntervalMs=R,this.updateIntervalMs=A,this.speakerScores={},this.speakerMuteState={},this.detectorCallbackToHandler=new Map,this.detectorCallbackToScoresTimer=new Map,this.detectorCallbackToActivityTimer=new Map,this.hasBandwidthPriority=!1,this.mostRecentUpdateTimestamp={}}needUpdate(T){return this.activeSpeakers?this.speakerScores[T]===0&&this.activeSpeakers.includes(T)||this.speakerScores[T]>0&&!this.activeSpeakers.includes(T):!0}updateActiveSpeakers(T,_,S){if(!this.needUpdate(S))return;const R=[],A=Object.keys(this.speakerScores);for(let ee=0;ee<A.length;ee++){const te=A[ee];R.push({attendeeId:te,activeScore:this.speakerScores[te]})}const O=R.sort((ee,te)=>te.activeScore-ee.activeScore).filter(function(ee){return ee.activeScore>0}).map(function(ee){return ee.attendeeId});this.activeSpeakers=O,_(O);const H=O.length>0&&O[0]===this.selfAttendeeId&&T.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==H&&(this.hasBandwidthPriority=H,this.hasBandwidthPriorityCallback(H))}updateScore(T,_,S,R,A){const O=T.calculateScore(S,R,A);this.speakerScores[S]!==O&&(this.speakerScores[S]=O,this.mostRecentUpdateTimestamp[S]=Date.now(),this.updateActiveSpeakers(T,_,S))}subscribe(T,_,S,R){const A=(H,ee)=>{if(!ee){this.speakerScores[H]=0,this.mostRecentUpdateTimestamp[H]=Date.now(),this.updateActiveSpeakers(T,_,H);return}this.realtimeController.realtimeSubscribeToVolumeIndicator(H,(te,ie,ne,ae)=>{this.mostRecentUpdateTimestamp[te]=Date.now(),ne!==null&&(this.speakerMuteState[te]=ne),this.updateScore(T,_,te,ie,ne)})};this.detectorCallbackToHandler.set(_,A);const O=new E.default(this.updateIntervalMs);if(O.start(()=>{for(const H in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[H]>this.waitIntervalMs&&this.updateScore(T,_,H,0,this.speakerMuteState[H])}),this.detectorCallbackToActivityTimer.set(_,O),S&&R){const H=new E.default(R);H.start(()=>{S(this.speakerScores)}),this.detectorCallbackToScoresTimer.set(_,H)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(A)}unsubscribe(T){const _=this.detectorCallbackToHandler.get(T);this.detectorCallbackToHandler.delete(T),_&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(_);const S=this.detectorCallbackToActivityTimer.get(T);S&&(S.stop(),this.detectorCallbackToActivityTimer.delete(T));const R=this.detectorCallbackToScoresTimer.get(T);R&&(R.stop(),this.detectorCallbackToHandler.delete(T))}destroy(){return x(this,void 0,void 0,function*(){for(const T of this.detectorCallbackToHandler.values())this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(T);for(const T of this.detectorCallbackToActivityTimer.values())T.stop();for(const T of this.detectorCallbackToScoresTimer.values())T.stop();this.detectorCallbackToHandler.clear(),this.detectorCallbackToActivityTimer.clear(),this.detectorCallbackToScoresTimer.clear()})}};return DefaultActiveSpeakerDetector.default=w,DefaultActiveSpeakerDetector}var DefaultActiveSpeakerPolicy={},hasRequiredDefaultActiveSpeakerPolicy;function requireDefaultActiveSpeakerPolicy(){if(hasRequiredDefaultActiveSpeakerPolicy)return DefaultActiveSpeakerPolicy;hasRequiredDefaultActiveSpeakerPolicy=1,Object.defineProperty(DefaultActiveSpeakerPolicy,"__esModule",{value:!0});let x=class{constructor(C=.9,E=.01,w=.2,T=.2){this.speakerWeight=C,this.cutoffThreshold=E,this.silenceThreshold=w,this.takeoverRate=T,this.volumes={}}calculateScore(C,E,w){(w||E===null)&&(E=0),this.volumes.hasOwnProperty(C)||(this.volumes[C]=0),E>this.silenceThreshold?E=1:E=0;const T=this.volumes[C]*this.speakerWeight+E*(1-this.speakerWeight);this.volumes[C]=T;for(const _ in this.volumes)_!==C&&(this.volumes[_]=Math.max(this.volumes[_]-this.takeoverRate*E,0));return T<this.cutoffThreshold?0:T}prioritizeVideoSendBandwidthForActiveSpeaker(){return!0}};return DefaultActiveSpeakerPolicy.default=x,DefaultActiveSpeakerPolicy}var DefaultAudioMixController={},hasRequiredDefaultAudioMixController;function requireDefaultAudioMixController(){if(hasRequiredDefaultAudioMixController)return DefaultAudioMixController;hasRequiredDefaultAudioMixController=1;var x=DefaultAudioMixController&&DefaultAudioMixController.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=DefaultAudioMixController&&DefaultAudioMixController.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(DefaultAudioMixController,"__esModule",{value:!0});const E=C(requireDefaultBrowserBehavior()),w=C(requireAsyncScheduler());let T=class{constructor(_){this.logger=_,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new E.default,this.observers=new Set}bindAudioElement(_){return x(this,void 0,void 0,function*(){if(!_)throw new Error(`Cannot bind audio element: ${_}`);return this.audioElement=_,this.audioElement.autoplay=!0,this.bindAudioMix()})}unbindAudioElement(){this.audioElement&&(this.audioElement.srcObject=null,this.audioElement=null,this.forEachObserver(_=>{this.audioStream&&_.meetingAudioStreamBecameInactive(this.audioStream)}))}bindAudioStream(_){return x(this,void 0,void 0,function*(){if(_){this.audioStream=_;try{yield this.bindAudioMix()}catch(S){this.logger&&this.logger.warn(`Failed to bind audio stream: ${S}`)}}})}bindAudioDevice(_){return x(this,void 0,void 0,function*(){if(_&&!this.browserBehavior.supportsSetSinkId())throw new Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=_,this.bindAudioMix()})}forEachObserver(_){for(const S of this.observers)w.default.nextTick(()=>{_(S)})}bindAudioMix(){var _,S;return x(this,void 0,void 0,function*(){if(!this.audioElement)return;const R=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),R!==this.audioStream&&this.forEachObserver(ie=>{R&&ie.meetingAudioStreamBecameInactive(R),this.audioStream&&ie.meetingAudioStreamBecameActive(this.audioStream)});const A=((_=this.audioDevice)===null||_===void 0?void 0:_.deviceId)!==this.audioElement.sinkId;if(A&&typeof this.audioElement.sinkId>"u")throw new Error("Cannot select audio output device. This browser does not support setSinkId.");const O=this.audioDevice?this.audioDevice.deviceId:"",H=this.audioElement.sinkId;if(O===H)return;const ee=this.audioElement,te=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(ee.srcObject=null),A)try{yield ee.setSinkId(O)}catch(ie){throw(S=this.logger)===null||S===void 0||S.error(`Failed to set sinkId for audio element: ${ie}`),ie}this.browserBehavior.hasChromiumWebRTC()&&(ee.srcObject=te)})}getCurrentMeetingAudioStream(){return x(this,void 0,void 0,function*(){return this.audioStream})}addAudioMixObserver(_){return x(this,void 0,void 0,function*(){this.observers.add(_)})}removeAudioMixObserver(_){return x(this,void 0,void 0,function*(){this.observers.delete(_)})}audioOutputDidChange(_){return x(this,void 0,void 0,function*(){return this.logger.info("Receive an audio output change event"),this.bindAudioDevice(_)})}};return DefaultAudioMixController.default=T,DefaultAudioMixController}var DefaultAudioVideoController={},SignalingAndMetricsConnectionMonitor={},hasRequiredSignalingAndMetricsConnectionMonitor;function requireSignalingAndMetricsConnectionMonitor(){if(hasRequiredSignalingAndMetricsConnectionMonitor)return SignalingAndMetricsConnectionMonitor;hasRequiredSignalingAndMetricsConnectionMonitor=1,Object.defineProperty(SignalingAndMetricsConnectionMonitor,"__esModule",{value:!0});const x=requireTypes$1();let C=class{constructor(E,w,T,_,S){this.audioVideoController=E,this.realtimeController=w,this.connectionHealthData=T,this.pingPong=_,this.statsCollector=S,this.isActive=!1,this.hasSeenValidCandidatePairMetricsBefore=!1,this.lastTotalBytesReceived=0,this.lastTotalStunMessagesReceived=0,this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(R=>{this.isActive&&this.receiveSignalStrengthChange(R)})}start(){this.isActive=!0,this.pingPong.addObserver(this),this.pingPong.start(),this.audioVideoController.addObserver(this)}stop(){this.isActive=!1,this.pingPong.removeObserver(this),this.pingPong.stop(),this.audioVideoController.removeObserver(this)}receiveSignalStrengthChange(E){E===0?this.connectionHealthData.setLastNoSignalTimestampMs(Date.now()):E<=.5?this.connectionHealthData.setLastWeakSignalTimestampMs(Date.now()):this.connectionHealthData.setLastGoodSignalTimestampMs(Date.now()),this.updateConnectionHealth()}didReceivePong(E,w,T){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",w),this.statsCollector.logLatency("ping_pong_clock_skew",T),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(E){let w=0,T=0;const _=E.getObservableMetrics(),S=_.audioPacketsReceived,R=_.audioPacketsReceivedFractionLoss,A=_.audioSpeakerDelayMs;typeof A=="number"&&!isNaN(A)&&this.connectionHealthData.setAudioSpeakerDelayMs(A);const O=E.getRTCStatsReport();let H=0,ee=0;O.forEach(ne=>{ne.type==="candidate-pair"&&(ne.bytesReceived&&(H+=ne.bytesReceived),ne.requestsReceived&&(ee+=ne.requestsReceived),ne.responsesReceived&&(ee+=ne.responsesReceived))});const te=H-this.lastTotalBytesReceived;this.lastTotalBytesReceived=H;const ie=ee-this.lastTotalStunMessagesReceived;if(this.lastTotalStunMessagesReceived=ee,typeof S=="number"&&typeof R=="number"){if(w=S,T=R,w<0||T<0||te<0||ie<0)return}else return;this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,w),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,T),te>0||ie>0?(this.hasSeenValidCandidatePairMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidCandidatePairMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(w===0||T>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),typeof _.audioPacketsSent=="number"&&this.updateAudioPacketsSentInConnectionHealth(_.audioPacketsSent),this.updateVideoEncodingHealth(E),this.updateConnectionHealth()}updateAudioPacketsSentInConnectionHealth(E){E>0?this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(0):this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(this.connectionHealthData.consecutiveStatsWithNoAudioPacketsSent+1)}updateVideoEncodingHealth(E){const w=this.audioVideoController.videoTileController.hasStartedLocalVideoTile(),T=E.getVideoUpstreamSsrcs();if(!w||T.length===0){this.connectionHealthData.setIsVideoEncoderHardware(!1),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(0),this.connectionHealthData.setCpuLimitationDuration(0),this.connectionHealthData.setVideoInputFps(0),this.connectionHealthData.setVideoEncodeFps(0);return}let _=!1,S=0,R=0,A=0,O=0;for(const ee of T)_||(_=!!E.getObservableVideoMetricValue("videoUpstreamEncoderImplementation",ee)),S+=E.getObservableVideoMetricValue("videoUpstreamTotalEncodeTimePerSecond",ee),R+=E.getObservableVideoMetricValue("videoUpstreamCpuQualityLimitationDurationPerSecond",ee),A+=E.getObservableVideoMetricValue("videoUpstreamFramesInputPerSecond",ee),O+=E.getObservableVideoMetricValue("videoUpstreamFramesEncodedPerSecond",ee);const H=O>0?S/O:0;this.connectionHealthData.setIsVideoEncoderHardware(!!_),this.connectionHealthData.setVideoEncodingTimeInMs(S),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(H),this.connectionHealthData.setCpuLimitationDuration(R),this.connectionHealthData.setVideoInputFps(A),this.connectionHealthData.setVideoEncodeFps(O)}addToMinuteWindow(E,w){E.unshift(w),E.length>60&&E.pop()}updateConnectionHealth(){this.audioVideoController.forEachObserver(E=>{x.Maybe.of(E.connectionHealthDidChange).map(w=>w.bind(E)(this.connectionHealthData.clone()))})}};return SignalingAndMetricsConnectionMonitor.default=C,SignalingAndMetricsConnectionMonitor}var MeetingSessionStatus={},hasRequiredMeetingSessionStatus;function requireMeetingSessionStatus(){if(hasRequiredMeetingSessionStatus)return MeetingSessionStatus;hasRequiredMeetingSessionStatus=1;var x=MeetingSessionStatus&&MeetingSessionStatus.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(MeetingSessionStatus,"__esModule",{value:!0});const C=requireSignalingProtocol(),E=x(requireMeetingSessionStatusCode());let w=class ei{constructor(_){this._statusCode=_}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case E.default.AudioAuthenticationRejected:case E.default.AudioCallAtCapacity:case E.default.AudioInternalServerError:case E.default.AudioServiceUnavailable:case E.default.AudioDisconnected:case E.default.VideoCallAtSourceCapacity:case E.default.SignalingBadRequest:case E.default.SignalingInternalServerError:case E.default.SignalingRequestFailed:case E.default.ICEGatheringTimeoutWorkaround:case E.default.ConnectionHealthReconnect:case E.default.RealtimeApiFailed:case E.default.TaskFailed:case E.default.NoAttendeePresent:case E.default.SignalingChannelClosedUnexpectedly:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case E.default.Left:case E.default.AudioJoinedFromAnotherDevice:case E.default.AudioAuthenticationRejected:case E.default.AudioCallAtCapacity:case E.default.MeetingEnded:case E.default.AudioDisconnected:case E.default.TURNCredentialsForbidden:case E.default.SignalingBadRequest:case E.default.SignalingRequestFailed:case E.default.VideoCallAtSourceCapacity:case E.default.RealtimeApiFailed:case E.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case E.default.AudioAuthenticationRejected:case E.default.AudioInternalServerError:case E.default.AudioServiceUnavailable:case E.default.ICEGatheringTimeoutWorkaround:case E.default.SignalingBadRequest:case E.default.SignalingInternalServerError:case E.default.SignalingRequestFailed:case E.default.RealtimeApiFailed:case E.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case E.default.OK:return"Everything is OK so far.";case E.default.Left:return"The attendee left the meeting.";case E.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case E.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case E.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case E.default.MeetingEnded:return"The meeting ended.";case E.default.AudioInternalServerError:case E.default.AudioServiceUnavailable:case E.default.AudioDisconnected:return"The audio connection failed.";case E.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case E.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case E.default.SignalingBadRequest:case E.default.SignalingInternalServerError:case E.default.SignalingRequestFailed:return"The signaling connection failed.";case E.default.ICEGatheringTimeoutWorkaround:return"Gathering ICE candidates timed out. In Chrome, this might indicate that the browser is in a bad state after reconnecting to VPN.";case E.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case E.default.RealtimeApiFailed:return"The real-time API failed. This status code might indicate that the callback you passed to the real-time API threw an exception.";case E.default.TaskFailed:return"The connection failed. See the error message for more details.";case E.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case E.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case E.default.NoAttendeePresent:return"The attendee was not present.";case E.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case E.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";case E.default.AudioVideoDisconnectedWhilePromoted:return"The client disconnected while promoted, which will automatically demote. The attendee must promote again to participate.";case E.default.AudioDisconnectAudio:return"The audio connection failed.";case E.default.SignalingChannelClosedUnexpectedly:return"The signaling channel was closed unexpectedly. This may be due to a network change or backend detected failure.";default:{const _=this._statusCode;throw new Error(`Unhandled case: ${_}`)}}}static fromSignalFrame(_){return _.error&&_.error.status?this.fromSignalingStatus(_.error.status):_.type===C.SdkSignalFrame.Type.AUDIO_STATUS?_.audioStatus?this.fromAudioStatus(_.audioStatus.audioStatus):new ei(E.default.SignalingRequestFailed):_.type===C.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new ei(E.default.AudioVideoWasRemovedFromPrimaryMeeting):new ei(E.default.OK)}static fromAudioStatus(_){switch(_){case 200:return new ei(E.default.OK);case 301:return new ei(E.default.AudioJoinedFromAnotherDevice);case 302:return new ei(E.default.AudioDisconnectAudio);case 403:return new ei(E.default.AudioAuthenticationRejected);case 409:return new ei(E.default.AudioCallAtCapacity);case 410:return new ei(E.default.MeetingEnded);case 411:return new ei(E.default.AudioAttendeeRemoved);case 500:return new ei(E.default.AudioInternalServerError);case 503:return new ei(E.default.AudioServiceUnavailable);default:switch(Math.floor(_/100)){case 2:return new ei(E.default.OK);default:return new ei(E.default.AudioDisconnected)}}}static fromSignalingStatus(_){switch(_){case 206:return new ei(E.default.VideoCallSwitchToViewOnly);case 509:return new ei(E.default.VideoCallAtSourceCapacity);case 403:return new ei(E.default.AudioAuthenticationRejected);case 409:return new ei(E.default.AudioCallAtCapacity);default:switch(Math.floor(_/100)){case 2:return new ei(E.default.OK);case 4:return new ei(E.default.SignalingBadRequest);case 5:return new ei(E.default.SignalingInternalServerError);default:return new ei(E.default.SignalingRequestFailed)}}}};return MeetingSessionStatus.default=w,MeetingSessionStatus}var MeetingSessionVideoAvailability={},hasRequiredMeetingSessionVideoAvailability;function requireMeetingSessionVideoAvailability(){if(hasRequiredMeetingSessionVideoAvailability)return MeetingSessionVideoAvailability;hasRequiredMeetingSessionVideoAvailability=1,Object.defineProperty(MeetingSessionVideoAvailability,"__esModule",{value:!0});let x=class am{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(E){return this.remoteVideoAvailable===E.remoteVideoAvailable&&this.canStartLocalVideo===E.canStartLocalVideo}clone(){const E=new am;return E.remoteVideoAvailable=this.remoteVideoAvailable,E.canStartLocalVideo=this.canStartLocalVideo,E}};return MeetingSessionVideoAvailability.default=x,MeetingSessionVideoAvailability}var DefaultPingPong={},hasRequiredDefaultPingPong;function requireDefaultPingPong(){if(hasRequiredDefaultPingPong)return DefaultPingPong;hasRequiredDefaultPingPong=1;var x=DefaultPingPong&&DefaultPingPong.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(DefaultPingPong,"__esModule",{value:!0});const C=x(requireAsyncScheduler()),E=x(requireIntervalScheduler()),w=x(requireSignalingClientEventType()),T=requireSignalingProtocol(),_=requireTypes$1();let S=class{constructor(R,A,O){this.signalingClient=R,this.intervalMs=A,this.logger=O,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new E.default(this.intervalMs),this.pingId=0}addObserver(R){this.logger.info("adding a ping-pong observer"),this.observerQueue.add(R)}removeObserver(R){this.logger.info("removing a ping-pong observer"),this.observerQueue.delete(R)}forEachObserver(R){for(const A of this.observerQueue)C.default.nextTick(()=>{this.observerQueue.has(A)&&R(A)})}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start(()=>{this.ping()}),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver(A=>{_.Maybe.of(A.didMissPongs).map(O=>O.bind(A)(this.consecutivePongsUnaccountedFor))})),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1&4294967295;const R=T.SdkPingPongFrame.create();R.pingId=this.pingId,R.type=T.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(R),this.logger.debug(()=>`sent ping ${this.pingId}`)}pong(R){const A=T.SdkPingPongFrame.create();A.pingId=R,A.type=T.SdkPingPongType.PONG,this.signalingClient.pingPong(A)}handleSignalingClientEvent(R){switch(R.type){case w.default.WebSocketOpen:this.startPingInterval();break;case w.default.WebSocketFailed:case w.default.WebSocketError:this.logger.warn(`stopped pinging (${w.default[R.type]})`),this.stopPingInterval();break;case w.default.WebSocketClosing:case w.default.WebSocketClosed:this.logger.info(`stopped pinging (${w.default[R.type]})`),this.stopPingInterval();break;case w.default.ReceivedSignalFrame:if(R.message.type!==T.SdkSignalFrame.Type.PING_PONG)break;if(R.message.pingPong.type===T.SdkPingPongType.PONG){const A=R.message.pingPong.pingId;if(A!==this.pingId){this.logger.warn(`unexpected ping id ${A} (expected ${this.pingId})`);break}this.consecutivePongsUnaccountedFor=0;let O;if(typeof R.message.timestampMs=="number")O=R.message.timestampMs;else break;this.logger.debug(()=>`received pong ${A} with timestamp ${O}`);const H=R.timestampMs-this.pingTimestampLocalMs,ee=Math.round(O-H/2),te=this.pingTimestampLocalMs-ee;this.logger.info(`local clock skew estimate=${te}ms from ping-pong time=${H}ms`),this.forEachObserver(ie=>{_.Maybe.of(ie.didReceivePong).map(ne=>ne.bind(ie)(A,te,H))})}else this.pong(R.message.pingPong.pingId);break}}};return DefaultPingPong.default=S,DefaultPingPong}var DefaultRealtimeController={},DefaultTranscriptionController={},TranscriptEvent={},Transcript={},hasRequiredTranscript;function requireTranscript(){if(hasRequiredTranscript)return Transcript;hasRequiredTranscript=1,Object.defineProperty(Transcript,"__esModule",{value:!0});let x=class{};return Transcript.default=x,Transcript}var TranscriptionStatus={},hasRequiredTranscriptionStatus;function requireTranscriptionStatus(){if(hasRequiredTranscriptionStatus)return TranscriptionStatus;hasRequiredTranscriptionStatus=1,Object.defineProperty(TranscriptionStatus,"__esModule",{value:!0});let x=class{};return TranscriptionStatus.default=x,TranscriptionStatus}var TranscriptionStatusType={},hasRequiredTranscriptionStatusType;function requireTranscriptionStatusType(){if(hasRequiredTranscriptionStatusType)return TranscriptionStatusType;hasRequiredTranscriptionStatusType=1,Object.defineProperty(TranscriptionStatusType,"__esModule",{value:!0});var x;return function(C){C.STARTED="started",C.INTERRUPTED="interrupted",C.RESUMED="resumed",C.STOPPED="stopped",C.FAILED="failed"}(x||(x={})),TranscriptionStatusType.default=x,TranscriptionStatusType}var TranscriptItemType={},hasRequiredTranscriptItemType;function requireTranscriptItemType(){if(hasRequiredTranscriptItemType)return TranscriptItemType;hasRequiredTranscriptItemType=1,Object.defineProperty(TranscriptItemType,"__esModule",{value:!0});var x;return function(C){C.PRONUNCIATION="pronunciation",C.PUNCTUATION="punctuation"}(x||(x={})),TranscriptItemType.default=x,TranscriptItemType}var hasRequiredTranscriptEvent;function requireTranscriptEvent(){if(hasRequiredTranscriptEvent)return TranscriptEvent;hasRequiredTranscriptEvent=1;var x=TranscriptEvent&&TranscriptEvent.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(TranscriptEvent,"__esModule",{value:!0}),TranscriptEvent.TranscriptEventConverter=void 0;const C=requireSignalingProtocol(),E=x(requireTranscript()),w=x(requireTranscriptionStatus()),T=x(requireTranscriptionStatusType()),_=x(requireTranscriptItemType()),S={[C.SdkTranscriptionStatus.Type.STARTED]:T.default.STARTED,[C.SdkTranscriptionStatus.Type.INTERRUPTED]:T.default.INTERRUPTED,[C.SdkTranscriptionStatus.Type.RESUMED]:T.default.RESUMED,[C.SdkTranscriptionStatus.Type.STOPPED]:T.default.STOPPED,[C.SdkTranscriptionStatus.Type.FAILED]:T.default.FAILED};class R{static from(O){let H;try{H=C.SdkTranscriptFrame.decode(O.data)}catch(te){throw new Error("Cannot decode transcript data message: "+te)}const ee=[];for(const te of H.events)if(te.status){const ie=S[te.status.type];if(!ie)continue;const ne=new w.default;ne.type=ie,ne.eventTimeMs=te.status.eventTime,ne.transcriptionRegion=te.status.transcriptionRegion,ne.transcriptionConfiguration=te.status.transcriptionConfiguration,te.status.message&&(ne.message=te.status.message),ee.push(ne)}else if(te.transcript){const ie=new E.default;ie.results=[];for(const ne of te.transcript.results){const ae={channelId:ne.channelId,isPartial:ne.isPartial,resultId:ne.resultId,startTimeMs:ne.startTime,endTimeMs:ne.endTime,alternatives:[]};if(ne.languageCode&&(ae.languageCode=ne.languageCode),ne.languageIdentification&&ne.languageIdentification.length>0){ae.languageIdentification=[];for(const oe of ne.languageIdentification){const le={languageCode:oe.languageCode,score:oe.score};ae.languageIdentification.push(le)}}for(const oe of ne.alternatives){const le={items:[],transcript:oe.transcript};for(const fe of oe.items){const de={content:fe.content,attendee:{attendeeId:fe.speakerAttendeeId,externalUserId:fe.speakerExternalUserId},startTimeMs:fe.startTime,endTimeMs:fe.endTime,type:null};switch(fe.vocabularyFilterMatch&&(de.vocabularyFilterMatch=fe.vocabularyFilterMatch),fe.hasOwnProperty("stable")&&(de.stable=fe.stable),fe.hasOwnProperty("confidence")&&(de.confidence=fe.confidence),fe.type){case C.SdkTranscriptItem.Type.PRONUNCIATION:de.type=_.default.PRONUNCIATION;break;case C.SdkTranscriptItem.Type.PUNCTUATION:de.type=_.default.PUNCTUATION;break}le.items.push(de)}for(const fe of oe.entities){le.entities||(le.entities=[]);const de={category:fe.category,confidence:fe.confidence,content:fe.content,startTimeMs:fe.startTime,endTimeMs:fe.endTime};fe.type&&(de.type=fe.type),le.entities.push(de)}ae.alternatives.push(le)}ie.results.push(ae)}ee.push(ie)}return ee}}return TranscriptEvent.TranscriptEventConverter=R,TranscriptEvent}var hasRequiredDefaultTranscriptionController;function requireDefaultTranscriptionController(){return hasRequiredDefaultTranscriptionController||(hasRequiredDefaultTranscriptionController=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;const C=requireTranscriptEvent();x.TRANSCRIPTION_DATA_MESSAGE_TOPIC="aws:chime:transcription";class E{constructor(T){this.realtimeController=T,this.transcriptEventCallbacks=new Set}subscribeToTranscriptEvent(T){this.transcriptEventCallbacks.size===0&&this.realtimeController.realtimeSubscribeToReceiveDataMessage(x.TRANSCRIPTION_DATA_MESSAGE_TOPIC,_=>{for(const S of C.TranscriptEventConverter.from(_))for(const R of this.transcriptEventCallbacks)R(S)}),this.transcriptEventCallbacks.add(T)}unsubscribeFromTranscriptEvent(T){this.transcriptEventCallbacks.delete(T),this.transcriptEventCallbacks.size===0&&this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(x.TRANSCRIPTION_DATA_MESSAGE_TOPIC)}}x.default=E}(DefaultTranscriptionController)),DefaultTranscriptionController}var Utils$1={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return Utils$1;hasRequiredUtils=1;var x=Utils$1&&Utils$1.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(Utils$1,"__esModule",{value:!0}),Utils$1.iterateEvery=Utils$1.SuppressedError=Utils$1.getRandomValues=Utils$1.getFormattedOffset=Utils$1.getDefaultAssetSpec=Utils$1.toLowerCasePropertyNames=Utils$1.isIFramed=Utils$1.wait=void 0;const C=x(requireVersioning());function E(H){return new Promise(ee=>setTimeout(ee,H))}Utils$1.wait=E;function w(){var H;try{return((H=window.frameElement)===null||H===void 0?void 0:H.nodeName)==="IFRAME"||parent!==top}catch{return!0}}Utils$1.isIFramed=w;function T(H){return H===null?null:typeof H!="object"?H:Array.isArray(H)?H.map(T):Object.keys(H).reduce((ee,te)=>{const ie=H[te],ne=typeof ie=="object"?T(ie):ie;return ee[te.toLowerCase()]=ne,ee},{})}Utils$1.toLowerCasePropertyNames=T;function _(){const H=C.default.sdkVersionSemVer;return{assetGroup:`sdk-${H.major}.${H.minor}`}}Utils$1.getDefaultAssetSpec=_;function S(H){const ee=Math.abs(H),te=H<=0?"+":"-",ie=Math.floor(ee/60).toString().padStart(2,"0"),ne=Math.floor(ee%60).toString().padStart(2,"0");return`${te}${ie}:${ne}`}Utils$1.getFormattedOffset=S;function R(H){try{window.crypto.getRandomValues(H)}catch{new DataView(H.buffer).setUint32(0,Math.trunc(Math.random()*Math.pow(2,32)),!0)}}Utils$1.getRandomValues=R;class A extends Error{constructor(ee,te,ie){var ne;super(ie??`${(ne=ee?.message)!==null&&ne!==void 0?ne:ee}`),this.error=ee,this.suppressed=te}}Utils$1.SuppressedError=A;function O(H,ee){if(!H)return;let te;for(const ie of H)try{ee(ie)}catch(ne){te=new A(ne,te)}if(te)throw te}return Utils$1.iterateEvery=O,Utils$1}var RealtimeState={},hasRequiredRealtimeState;function requireRealtimeState(){if(hasRequiredRealtimeState)return RealtimeState;hasRequiredRealtimeState=1,Object.defineProperty(RealtimeState,"__esModule",{value:!0});let x=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}};return RealtimeState.default=x,RealtimeState}var RealtimeVolumeIndicator={},hasRequiredRealtimeVolumeIndicator;function requireRealtimeVolumeIndicator(){if(hasRequiredRealtimeVolumeIndicator)return RealtimeVolumeIndicator;hasRequiredRealtimeVolumeIndicator=1,Object.defineProperty(RealtimeVolumeIndicator,"__esModule",{value:!0});let x=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}};return RealtimeVolumeIndicator.default=x,RealtimeVolumeIndicator}var hasRequiredDefaultRealtimeController;function requireDefaultRealtimeController(){if(hasRequiredDefaultRealtimeController)return DefaultRealtimeController;hasRequiredDefaultRealtimeController=1;var x=DefaultRealtimeController&&DefaultRealtimeController.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(DefaultRealtimeController,"__esModule",{value:!0});const C=x(requireDefaultTranscriptionController()),E=requireUtils(),w=x(requireRealtimeState()),T=x(requireRealtimeVolumeIndicator());let _=class{constructor(S,R){this.mediaStreamBroker=S,this.state=new w.default,this._transcriptionController=R||new C.default(this)}realtimeSetLocalAttendeeId(S,R){this.state.localAttendeeId=S,this.state.localExternalUserId=R}realtimeSetAttendeeIdPresence(S,R,A,O,H){try{R&&(this.state.attendeeIdToExternalUserId[S]=A);for(const ee of this.state.attendeeIdChangesCallbacks)ee(S,R,A,O,H)}catch(ee){this.onError(ee)}}realtimeSubscribeToAttendeeIdPresence(S){try{this.state.attendeeIdChangesCallbacks.push(S)}catch(R){this.onError(R)}}realtimeUnsubscribeToAttendeeIdPresence(S){try{const R=this.state.attendeeIdChangesCallbacks.indexOf(S);R!==-1&&this.state.attendeeIdChangesCallbacks.splice(R,1)}catch(R){this.onError(R)}}realtimeSetCanUnmuteLocalAudio(S){try{if(this.state.canUnmute===S)return;this.state.canUnmute=S;for(const R of this.state.setCanUnmuteLocalAudioCallbacks)R(S)}catch(R){this.onError(R)}}realtimeSubscribeToSetCanUnmuteLocalAudio(S){try{this.state.setCanUnmuteLocalAudioCallbacks.push(S)}catch(R){this.onError(R)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(S){try{const R=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(S);R!==-1&&this.state.setCanUnmuteLocalAudioCallbacks.splice(R,1)}catch(R){this.onError(R)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId);for(const S of this.state.muteAndUnmuteLocalAudioCallbacks)S(!0)}catch(S){this.onError(S)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId);for(const S of this.state.muteAndUnmuteLocalAudioCallbacks)S(!1);return!0}catch(S){return this.onError(S),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(S){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(S)}catch(R){this.onError(R)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(S){try{const R=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(S);R!==-1&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(R,1)}catch(R){this.onError(R)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(S,R){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(S)||(this.state.volumeIndicatorCallbacks[S]=[]),this.state.volumeIndicatorCallbacks[S].push(R),this.sendVolumeIndicatorChange(S,!0,!0,!0,this.state.attendeeIdToExternalUserId[S])}catch(A){this.onError(A)}}realtimeUnsubscribeFromVolumeIndicator(S,R){if(this.state.volumeIndicatorCallbacks[S])if(R){const A=this.state.volumeIndicatorCallbacks[S].indexOf(R);A>=0&&this.state.volumeIndicatorCallbacks[S].splice(A,1)}else delete this.state.volumeIndicatorCallbacks[S]}realtimeUpdateVolumeIndicator(S,R,A,O,H){try{A=this.applyLocalMuteOverride(S,A);const ee=this.getVolumeIndicatorState(S);let te=!1,ie=!1,ne=!1;A!==null&&ee.muted!==A&&(ee.muted=A,ie=!0,ee.muted&&ee.volume!==0&&(ee.volume=0,te=!0)),!ee.muted&&R!==null&&(ee.volume!==R&&(ee.volume=R,te=!0),ee.muted===null&&(ee.muted=!1,ie=!0)),O!==null&&ee.signalStrength!==O&&(ee.signalStrength=O,ne=!0),this.sendVolumeIndicatorChange(S,te,ie,ne,H)}catch(ee){this.onError(ee)}}realtimeSubscribeToLocalSignalStrengthChange(S){try{if(this.state.localSignalStrengthChangeCallbacks.push(S),this.state.localAttendeeId===null)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(R){this.onError(R)}}realtimeUnsubscribeToLocalSignalStrengthChange(S){try{const R=this.state.localSignalStrengthChangeCallbacks.indexOf(S);R!==-1&&this.state.localSignalStrengthChangeCallbacks.splice(R,1)}catch(R){this.onError(R)}}realtimeSubscribeToSendDataMessage(S){try{this.state.sendDataMessageCallbacks.push(S)}catch(R){this.onError(R)}}realtimeUnsubscribeFromSendDataMessage(S){try{const R=this.state.sendDataMessageCallbacks.indexOf(S);R!==-1&&this.state.sendDataMessageCallbacks.splice(R,1)}catch(R){this.onError(R)}}realtimeSendDataMessage(S,R,A){try{for(const O of this.state.sendDataMessageCallbacks)O(S,R,A)}catch(O){this.onError(O)}}realtimeSubscribeToReceiveDataMessage(S,R){try{this.state.receiveDataMessageCallbacks.has(S)?this.state.receiveDataMessageCallbacks.get(S).push(R):this.state.receiveDataMessageCallbacks.set(S,[R])}catch(A){this.onError(A)}}realtimeUnsubscribeFromReceiveDataMessage(S){try{this.state.receiveDataMessageCallbacks.delete(S)}catch(R){this.onError(R)}}realtimeReceiveDataMessage(S){try{E.iterateEvery(this.state.receiveDataMessageCallbacks.get(S.topic),R=>{R(S)})}catch(R){Promise.reject(R)}}realtimeSubscribeToFatalError(S){try{this.state.fatalErrorCallbacks.push(S)}catch(R){this.onError(R)}}realtimeUnsubscribeToFatalError(S){try{const R=this.state.fatalErrorCallbacks.indexOf(S);R!==-1&&this.state.fatalErrorCallbacks.splice(R,1)}catch(R){this.onError(R)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(S){S?this.mediaStreamBroker.unmuteLocalAudioInputStream():this.mediaStreamBroker.muteLocalAudioInputStream()}applyLocalMuteOverride(S,R){const A=this.state.localAttendeeId,O=this.state.muted;return S!==A||!("activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio)?R:O}sendVolumeIndicatorChange(S,R,A,O,H){if(this.sendLocalSignalStrengthChange(S,O),!this.state.volumeIndicatorCallbacks.hasOwnProperty(S))return;const ee=this.getVolumeIndicatorState(S),te=new T.default;if(R&&(te.volume=ee.volume),A&&(te.muted=ee.muted),O&&(te.signalStrength=ee.signalStrength),!this.stateIsEmpty(te))for(const ie of this.state.volumeIndicatorCallbacks[S])ie(S,te.volume,te.muted,te.signalStrength,H)}sendLocalSignalStrengthChange(S,R){if(!R||S!==this.state.localAttendeeId)return;const A=this.getVolumeIndicatorState(S).signalStrength;if(A!==null)for(const O of this.state.localSignalStrengthChangeCallbacks)O(A)}getVolumeIndicatorState(S){return this.state.volumeIndicatorState.hasOwnProperty(S)||(this.state.volumeIndicatorState[S]=new T.default),this.state.volumeIndicatorState[S]}stateIsEmpty(S){return S.volume===null&&S.muted===null&&S.signalStrength===null}onError(S){try{for(const R of this.state.fatalErrorCallbacks)R(S)}catch(R){try{console.error(S),console.error(R)}catch{}}}};return DefaultRealtimeController.default=_,DefaultRealtimeController}var DefaultSessionStateController={},SessionStateControllerAction={},hasRequiredSessionStateControllerAction;function requireSessionStateControllerAction(){return hasRequiredSessionStateControllerAction||(hasRequiredSessionStateControllerAction=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SessionStateControllerAction=void 0;var C;(function(E){E[E.Connect=0]="Connect",E[E.FinishConnecting=1]="FinishConnecting",E[E.Update=2]="Update",E[E.FinishUpdating=3]="FinishUpdating",E[E.Reconnect=4]="Reconnect",E[E.Disconnect=5]="Disconnect",E[E.Fail=6]="Fail",E[E.FinishDisconnecting=7]="FinishDisconnecting"})(C=x.SessionStateControllerAction||(x.SessionStateControllerAction={})),x.default=C}(SessionStateControllerAction)),SessionStateControllerAction}var SessionStateControllerDeferPriority={},hasRequiredSessionStateControllerDeferPriority;function requireSessionStateControllerDeferPriority(){return hasRequiredSessionStateControllerDeferPriority||(hasRequiredSessionStateControllerDeferPriority=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SessionStateControllerDeferPriority=void 0;var C;(function(E){E[E.DoNotDefer=0]="DoNotDefer",E[E.Low=1]="Low",E[E.Medium=2]="Medium",E[E.High=3]="High",E[E.VeryHigh=4]="VeryHigh"})(C=x.SessionStateControllerDeferPriority||(x.SessionStateControllerDeferPriority={})),x.default=C}(SessionStateControllerDeferPriority)),SessionStateControllerDeferPriority}var SessionStateControllerState={},hasRequiredSessionStateControllerState;function requireSessionStateControllerState(){return hasRequiredSessionStateControllerState||(hasRequiredSessionStateControllerState=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SessionStateControllerState=void 0;var C;(function(E){E[E.NotConnected=0]="NotConnected",E[E.Connecting=1]="Connecting",E[E.Connected=2]="Connected",E[E.Updating=3]="Updating",E[E.Disconnecting=4]="Disconnecting"})(C=x.SessionStateControllerState||(x.SessionStateControllerState={})),x.default=C}(SessionStateControllerState)),SessionStateControllerState}var SessionStateControllerTransitionResult={},hasRequiredSessionStateControllerTransitionResult;function requireSessionStateControllerTransitionResult(){return hasRequiredSessionStateControllerTransitionResult||(hasRequiredSessionStateControllerTransitionResult=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SessionStateControllerTransitionResult=void 0;var C;(function(E){E[E.Transitioned=0]="Transitioned",E[E.NoTransitionAvailable=1]="NoTransitionAvailable",E[E.DeferredTransition=2]="DeferredTransition",E[E.TransitionFailed=3]="TransitionFailed"})(C=x.SessionStateControllerTransitionResult||(x.SessionStateControllerTransitionResult={})),x.default=C}(SessionStateControllerTransitionResult)),SessionStateControllerTransitionResult}var hasRequiredDefaultSessionStateController;function requireDefaultSessionStateController(){if(hasRequiredDefaultSessionStateController)return DefaultSessionStateController;hasRequiredDefaultSessionStateController=1,Object.defineProperty(DefaultSessionStateController,"__esModule",{value:!0});const x=requireSessionStateControllerAction(),C=requireSessionStateControllerDeferPriority(),E=requireSessionStateControllerState(),w=requireSessionStateControllerTransitionResult();let T=class{constructor(_){this.logger=_,this.currentState=E.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(_,S){const R=this.currentState;if(R===E.SessionStateControllerState.NotConnected&&_===x.SessionStateControllerAction.Connect)this.transition(E.SessionStateControllerState.Connecting,_);else if(R===E.SessionStateControllerState.Connecting&&_===x.SessionStateControllerAction.Fail)this.transition(E.SessionStateControllerState.Disconnecting,_);else if(R===E.SessionStateControllerState.Connecting&&_===x.SessionStateControllerAction.FinishConnecting)this.transition(E.SessionStateControllerState.Connected,_);else if(R===E.SessionStateControllerState.Connected&&_===x.SessionStateControllerAction.Disconnect)this.transition(E.SessionStateControllerState.Disconnecting,_);else if(R===E.SessionStateControllerState.Connected&&_===x.SessionStateControllerAction.Reconnect)this.transition(E.SessionStateControllerState.Connecting,_);else if(R===E.SessionStateControllerState.Connected&&_===x.SessionStateControllerAction.Fail)this.transition(E.SessionStateControllerState.Disconnecting,_);else if(R===E.SessionStateControllerState.Connected&&_===x.SessionStateControllerAction.Update)this.transition(E.SessionStateControllerState.Updating,_);else if(R===E.SessionStateControllerState.Updating&&_===x.SessionStateControllerAction.Fail)this.transition(E.SessionStateControllerState.Disconnecting,_);else if(R===E.SessionStateControllerState.Updating&&_===x.SessionStateControllerAction.FinishUpdating)this.transition(E.SessionStateControllerState.Connected,_);else if(R===E.SessionStateControllerState.Disconnecting&&_===x.SessionStateControllerAction.FinishDisconnecting)this.transition(E.SessionStateControllerState.NotConnected,_);else return this.canDefer(_)?(this.logger.info(`deferring transition from ${E.SessionStateControllerState[this.currentState]} with ${x.SessionStateControllerAction[_]}`),this.deferAction(_,S),w.SessionStateControllerTransitionResult.DeferredTransition):(this.logger.warn(`no transition found from ${E.SessionStateControllerState[this.currentState]} with ${x.SessionStateControllerAction[_]}`),w.SessionStateControllerTransitionResult.NoTransitionAvailable);try{S()}catch(A){return this.logger.error(`error during state ${E.SessionStateControllerState[this.currentState]} with action ${x.SessionStateControllerAction[_]}: ${A}`),this.logger.info(`rolling back transition to ${E.SessionStateControllerState[R]}`),this.currentState=R,w.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),w.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(_,S){this.logger.info(`transitioning from ${E.SessionStateControllerState[this.currentState]} to ${E.SessionStateControllerState[_]} with ${x.SessionStateControllerAction[S]}`),this.currentState=_}deferPriority(_){switch(_){case x.SessionStateControllerAction.Disconnect:return C.SessionStateControllerDeferPriority.VeryHigh;case x.SessionStateControllerAction.Fail:return C.SessionStateControllerDeferPriority.High;case x.SessionStateControllerAction.Reconnect:return C.SessionStateControllerDeferPriority.Medium;case x.SessionStateControllerAction.Update:return C.SessionStateControllerDeferPriority.Low;default:return C.SessionStateControllerDeferPriority.DoNotDefer}}deferAction(_,S){this.deferredAction!==null&&this.deferPriority(this.deferredAction)>this.deferPriority(_)||(this.deferredAction=_,this.deferredWork=S)}canDefer(_){return this.deferPriority(_)!==C.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===E.SessionStateControllerState.Connecting||this.currentState===E.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;const _=this.deferredAction,S=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${x.SessionStateControllerAction[_]}`),this.perform(_,S)!==w.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${x.SessionStateControllerAction[_]} in state ${E.SessionStateControllerState[this.currentState]}`)}};return DefaultSessionStateController.default=T,DefaultSessionStateController}var DefaultSignalingClient={},VideoQualityAdaptationPreference={},hasRequiredVideoQualityAdaptationPreference;function requireVideoQualityAdaptationPreference(){return hasRequiredVideoQualityAdaptationPreference||(hasRequiredVideoQualityAdaptationPreference=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.VideoQualityAdaptationPreference=void 0;var C;(function(E){E[E.Balanced=0]="Balanced",E[E.MaintainFramerate=1]="MaintainFramerate",E[E.MaintainResolution=2]="MaintainResolution"})(C=x.VideoQualityAdaptationPreference||(x.VideoQualityAdaptationPreference={})),x.default=C}(VideoQualityAdaptationPreference)),VideoQualityAdaptationPreference}var WebSocketReadyState={},hasRequiredWebSocketReadyState;function requireWebSocketReadyState(){return hasRequiredWebSocketReadyState||(hasRequiredWebSocketReadyState=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.WebSocketReadyState=void 0;var C;(function(E){E[E.None=0]="None",E[E.Connecting=1]="Connecting",E[E.Open=2]="Open",E[E.Closing=3]="Closing",E[E.Closed=4]="Closed"})(C=x.WebSocketReadyState||(x.WebSocketReadyState={})),x.default=C}(WebSocketReadyState)),WebSocketReadyState}var ServerSideNetworkAdaption={},hasRequiredServerSideNetworkAdaption;function requireServerSideNetworkAdaption(){return hasRequiredServerSideNetworkAdaption||(hasRequiredServerSideNetworkAdaption=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.convertServerSideNetworkAdaptionEnumToSignaled=x.convertServerSideNetworkAdaptionEnumFromSignaled=x.serverSideNetworkAdaptionIsNoneOrDefault=x.ServerSideNetworkAdaption=void 0;const C=requireSignalingProtocol();var E;(function(S){S[S.Default=0]="Default",S[S.None=1]="None",S[S.BandwidthProbing=2]="BandwidthProbing",S[S.BandwidthProbingAndRemoteVideoQualityAdaption=3]="BandwidthProbingAndRemoteVideoQualityAdaption"})(E=x.ServerSideNetworkAdaption||(x.ServerSideNetworkAdaption={})),x.default=E;function w(S){return S===E.None||S===E.Default}x.serverSideNetworkAdaptionIsNoneOrDefault=w;function T(S){switch(S){case C.SdkServerSideNetworkAdaption.DEFAULT:return E.Default;case C.SdkServerSideNetworkAdaption.NONE:return E.None;case C.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:return E.BandwidthProbing;case C.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION:return E.BandwidthProbingAndRemoteVideoQualityAdaption}}x.convertServerSideNetworkAdaptionEnumFromSignaled=T;function _(S){switch(S){case E.Default:return C.SdkServerSideNetworkAdaption.DEFAULT;case E.None:return C.SdkServerSideNetworkAdaption.NONE;case E.BandwidthProbing:return C.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING;case E.BandwidthProbingAndRemoteVideoQualityAdaption:return C.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION}}x.convertServerSideNetworkAdaptionEnumToSignaled=_}(ServerSideNetworkAdaption)),ServerSideNetworkAdaption}var SignalingClientEvent={},hasRequiredSignalingClientEvent;function requireSignalingClientEvent(){if(hasRequiredSignalingClientEvent)return SignalingClientEvent;hasRequiredSignalingClientEvent=1;var x=SignalingClientEvent&&SignalingClientEvent.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(SignalingClientEvent,"__esModule",{value:!0});const C=x(requireSignalingClientEventType());let E=class{constructor(w,T,_,S,R){this.client=w,this.type=T,this.message=_,this.closeCode=S,this.closeReason=R,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case C.default.WebSocketFailed:case C.default.WebSocketError:case C.default.WebSocketClosing:case C.default.WebSocketClosed:return!0;default:return!1}}};return SignalingClientEvent.default=E,SignalingClientEvent}var hasRequiredDefaultSignalingClient;function requireDefaultSignalingClient(){if(hasRequiredDefaultSignalingClient)return DefaultSignalingClient;hasRequiredDefaultSignalingClient=1;var x=DefaultSignalingClient&&DefaultSignalingClient.__importDefault||function(te){return te&&te.__esModule?te:{default:te}};Object.defineProperty(DefaultSignalingClient,"__esModule",{value:!0});const C=x(requireDefaultBrowserBehavior()),E=x(requireTimeoutScheduler()),w=requireSignalingProtocol(),T=requireUtils(),_=x(requireVersioning()),S=x(requireVideoQualityAdaptationPreference()),R=x(requireWebSocketReadyState()),A=requireServerSideNetworkAdaption(),O=x(requireSignalingClientEvent()),H=x(requireSignalingClientEventType());let ee=class Za{constructor(ie,ne){this.webSocket=ie,this.logger=ne,this.unloadHandler=null,this.closeEventHandler=ae=>{this.deactivatePageUnloadHandler(),this.resetConnection(),this.sendEvent(new O.default(this,H.default.WebSocketClosed,null,ae.code,ae.reason)),this.serviceConnectionRequestQueue()},this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug(()=>"signaling client init"),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(ie){this.logger.debug(()=>"registering signaling client observer"),this.observerQueue.add(ie)}removeObserver(ie){this.logger.debug(()=>"removing signaling client observer"),this.observerQueue.delete(ie)}openConnection(ie){this.logger.info("adding connection request to queue: "+ie.url()),this.connectionRequestQueue.push(ie),this.closeConnection()}pingPong(ie){this.logger.debug(()=>"sending ping");const ne=w.SdkSignalFrame.create();return ne.type=w.SdkSignalFrame.Type.PING_PONG,ne.pingPong=ie,this.sendMessage(ne),ne.timestampMs}join(ie){this.logger.info("sending join");const ne=w.SdkJoinFrame.create();ne.protocolVersion=2,ne.flags=w.SdkJoinFlags.HAS_STREAM_UPDATE;const ae=new C.default,oe={platformName:ae.name(),platformVersion:ae.version(),clientSource:_.default.sdkName,chimeSdkVersion:_.default.sdkVersion,clientUtcOffset:T.getFormattedOffset(new Date().getTimezoneOffset())};if(ie.applicationMetadata){const{appName:fe,appVersion:de}=ie.applicationMetadata;oe.appName=fe,oe.appVersion=de}ne.clientDetails=w.SdkClientDetails.create(oe),ne.audioSessionId=this.audioSessionId,ne.wantsCompressedSdp=Za.CLIENT_SUPPORTS_COMPRESSION,ne.disablePeriodicKeyframeRequestOnContentSender=ie.disablePeriodicKeyframeRequestOnContentSender,ne.serverSideNetworkAdaption=A.convertServerSideNetworkAdaptionEnumToSignaled(ie.serverSideNetworkAdaption),ne.supportedServerSideNetworkAdaptions=ie.supportedServerSideNetworkAdaptions.map(A.convertServerSideNetworkAdaptionEnumToSignaled),ne.wantsAllTemporalLayersInIndex=ie.wantsAllTemporalLayersInIndex;const le=w.SdkSignalFrame.create();le.type=w.SdkSignalFrame.Type.JOIN,le.join=ne,this.sendMessage(le)}subscribe(ie){const ne=w.SdkSubscribeFrame.create();if(ne.sendStreams=[],ne.sdpOffer=ie.sdpOffer,ie.connectionTypeHasVideo&&(ne.receiveStreamIds=ie.receiveStreamIds),ie.audioHost&&(ne.audioCheckin=ie.audioCheckin,ne.audioHost=ie.audioHost,ne.audioMuted=ie.audioMuted,!ie.audioCheckin)){const oe=w.SdkStreamDescriptor.create();oe.mediaType=w.SdkStreamMediaType.AUDIO,oe.trackLabel="AmazonChimeExpressAudio",oe.attendeeId=ie.attendeeId,oe.streamId=1,oe.groupId=1,oe.framerate=15,oe.maxBitrateKbps=600,oe.avgBitrateBps=4e5,ne.sendStreams.push(oe)}if(ne.compressedSdpOffer=ie.compressedSdpOffer,ne.duplex=w.SdkStreamServiceType.RX,ie.localVideoEnabled){ne.duplex=w.SdkStreamServiceType.DUPLEX;for(let oe=0;oe<ie.videoStreamDescriptions.length;oe++){const le=ie.videoStreamDescriptions[oe].clone();le.attendeeId=ie.attendeeId,ne.sendStreams.push(le.toStreamDescriptor())}}ie.videoSubscriptionConfiguration.length>0&&(ne.videoSubscriptionConfiguration=ie.videoSubscriptionConfiguration.map(this.convertSignalingClientVideoSubscriptionConfiguration));const ae=w.SdkSignalFrame.create();ae.type=w.SdkSignalFrame.Type.SUBSCRIBE,ae.sub=ne,this.sendMessage(ae)}remoteVideoUpdate(ie,ne){const ae=w.SdkRemoteVideoUpdateFrame.create();ae.addedOrUpdatedVideoSubscriptions=ie.map(this.convertSignalingClientVideoSubscriptionConfiguration),ae.removedVideoSubscriptionMids=ne;const oe=w.SdkSignalFrame.create();oe.type=w.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,oe.remoteVideoUpdate=ae,this.sendMessage(oe)}convertSignalingClientVideoSubscriptionConfiguration(ie){const ne=new w.SdkVideoSubscriptionConfiguration;switch(ne.mid=ie.mid,ne.attendeeId=ie.attendeeId,ne.streamId=ie.streamId,ne.groupId=ie.groupId,ne.priority=ie.priority,ne.targetBitrateKbps=ie.targetBitrateKbps,ie.qualityAdaptationPreference){case S.default.Balanced:ne.qualityAdaptationPreference=w.SdkVideoQualityAdaptationPreference.BALANCED;break;case S.default.MaintainFramerate:ne.qualityAdaptationPreference=w.SdkVideoQualityAdaptationPreference.MAINTAIN_FRAMERATE;break;case S.default.MaintainResolution:ne.qualityAdaptationPreference=w.SdkVideoQualityAdaptationPreference.MAINTAIN_RESOLUTION;break;default:ne.qualityAdaptationPreference=w.SdkVideoQualityAdaptationPreference.BALANCED}return ne}leave(){const ie=w.SdkSignalFrame.create();ie.type=w.SdkSignalFrame.Type.LEAVE,ie.leave=w.SdkLeaveFrame.create(),this.sendMessage(ie),this.logger.debug(()=>"sent leave")}sendClientMetrics(ie){const ne=w.SdkSignalFrame.create();ne.type=w.SdkSignalFrame.Type.CLIENT_METRIC,ne.clientMetric=ie,this.sendMessage(ne)}sendDataMessage(ie){const ne=w.SdkSignalFrame.create();ne.type=w.SdkSignalFrame.Type.DATA_MESSAGE,ne.dataMessage=ie,this.sendMessage(ne)}closeConnection(){var ie,ne;if(this.webSocket.readyState()!==R.default.None&&this.webSocket.readyState()!==R.default.Closed){this.isClosing=!0,this.sendEvent(new O.default(this,H.default.WebSocketClosing,null));const ae=new E.default(Za.CLOSE_EVENT_TIMEOUT_MS),oe=le=>{var fe,de;(de=(fe=this.webSocket).removeEventListener)===null||de===void 0||de.call(fe,"close",oe),ae.stop(),this.closeEventHandler(le)};(ne=(ie=this.webSocket).removeEventListener)===null||ne===void 0||ne.call(ie,"close",this.closeEventHandler),this.webSocket.addEventListener("close",oe),ae.start(()=>{oe(new CloseEvent("close",{wasClean:!1,code:1005,reason:"",bubbles:!1}))}),this.webSocket.close(),this.deactivatePageUnloadHandler()}else this.logger.info("no existing signaling client connection needs closing"),this.serviceConnectionRequestQueue()}ready(){return this.webSocket.readyState()===R.default.Open&&!this.isClosing&&this.wasOpened}mute(ie){const ne=w.SdkSignalFrame.create();ne.type=w.SdkSignalFrame.Type.AUDIO_CONTROL;const ae=w.SdkAudioControlFrame.create();ae.muted=ie,ne.audioControl=ae,this.sendMessage(ne)}pause(ie){const ne=w.SdkSignalFrame.create();ne.type=w.SdkSignalFrame.Type.PAUSE,ne.pause=w.SdkPauseResumeFrame.create(),ne.pause.streamIds=ie,this.sendMessage(ne)}resume(ie){const ne=w.SdkSignalFrame.create();ne.type=w.SdkSignalFrame.Type.RESUME,ne.pause=w.SdkPauseResumeFrame.create(),ne.pause.streamIds=ie,this.sendMessage(ne)}resetConnection(){this.webSocket.destroy(),this.wasOpened=!1}sendMessage(ie){ie.timestampMs=Date.now(),this.logger.debug(()=>`sending: ${JSON.stringify(ie)}`);const ne=this.prependWithFrameTypeRTC(w.SdkSignalFrame.encode(ie).finish());if(this.ready()){if(!this.webSocket.send(ne)){this.sendEvent(new O.default(this,H.default.WebSocketSendMessageFailure,null));return}this.sendEvent(new O.default(this,H.default.WebSocketSentMessage,null))}else this.sendEvent(new O.default(this,H.default.WebSocketSkippedMessage,null))}receiveMessage(ie){let ne;try{ne=w.SdkSignalFrame.decode(ie)}catch{this.logger.info(`failed to decode: ${ie}`),this.sendEvent(new O.default(this,H.default.ProtocolDecodeFailure,null));return}this.logger.debug(()=>`received: ${JSON.stringify(ne)}`),this.webSocket.readyState()===R.default.Open?this.sendEvent(new O.default(this,H.default.ReceivedSignalFrame,ne)):this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(ne)}`)}stripFrameTypeRTC(ie){const ne=ie[0];return ne!==Za.FRAME_TYPE_RTC&&ne!==2&&this.logger.warn(`expected FrameTypeRTC for message but got ${ne}`),ie.slice(1)}prependWithFrameTypeRTC(ie){const ne=new Uint8Array(ie.length+1);return ne[0]=Za.FRAME_TYPE_RTC,ne.set(ie,1),ne}serviceConnectionRequestQueue(){if(this.connectionRequestQueue.length===0){this.logger.info("no connection requests to service");return}const ie=this.connectionRequestQueue.shift();this.logger.info(`opening connection to ${ie.url()}`),this.isClosing=!1,this.webSocket.create(ie.url(),ie.protocols()),this.setUpEventListeners(),this.sendEvent(new O.default(this,H.default.WebSocketConnecting,null))}sendEvent(ie){switch(ie.type){case H.default.WebSocketMessage:case H.default.ReceivedSignalFrame:case H.default.WebSocketSentMessage:this.logger.debug(()=>`notifying event: ${H.default[ie.type]}`);break;case H.default.WebSocketSkippedMessage:this.logger.debug(()=>`notifying event: ${H.default[ie.type]}, websocket state=${R.default[this.webSocket.readyState()]}`);break;case H.default.WebSocketClosed:this.logger.info(`notifying event: ${H.default[ie.type]}, 
              code: ${ie.closeCode} reason: ${ie.closeReason}`);break;default:this.logger.info(`notifying event: ${H.default[ie.type]}`);break}for(const ne of this.observerQueue)ne.handleSignalingClientEvent(ie)}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.activatePageUnloadHandler(),this.wasOpened=!0,this.sendEvent(new O.default(this,H.default.WebSocketOpen,null))}),this.webSocket.addEventListener("message",ie=>{this.sendEvent(new O.default(this,H.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(ie.data)))}),this.webSocket.addEventListener("close",this.closeEventHandler),this.webSocket.addEventListener("error",()=>{if(this.isClosing&&!this.wasOpened){this.logger.info("Signaling WebSocket ignoring error closing while connecting");return}this.wasOpened?(this.logger.error("Signaling WebSocket received error while connected"),this.sendEvent(new O.default(this,H.default.WebSocketError,null))):(this.logger.error("Signaling WebSocket received error while connecting"),this.sendEvent(new O.default(this,H.default.WebSocketFailed,null)))})}activatePageUnloadHandler(){this.unloadHandler=()=>{this.leave()};const ie=commonjsGlobal;ie.window&&ie.window.addEventListener&&window.addEventListener("unload",this.unloadHandler)}deactivatePageUnloadHandler(){const ie=commonjsGlobal;ie.window&&ie.window.removeEventListener&&window.removeEventListener("unload",this.unloadHandler),this.unloadHandler=null}generateNewAudioSessionId(){const ie=new Uint32Array(1);return T.getRandomValues(ie),ie[0]}promoteToPrimaryMeeting(ie){const ne=w.SdkMeetingSessionCredentials.create();ne.attendeeId=ie.attendeeId,ne.externalUserId=ie.externalUserId,ne.joinToken=ie.joinToken;const ae=w.SdkPrimaryMeetingJoinFrame.create();ae.credentials=ne;const oe=w.SdkSignalFrame.create();oe.type=w.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,oe.primaryMeetingJoin=ae,this.sendMessage(oe)}demoteFromPrimaryMeeting(){const ie=w.SdkPrimaryMeetingLeaveFrame.create(),ne=w.SdkSignalFrame.create();ne.type=w.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,ne.primaryMeetingLeave=ie,this.sendMessage(ne)}};return DefaultSignalingClient.default=ee,ee.FRAME_TYPE_RTC=5,ee.CLOSE_EVENT_TIMEOUT_MS=2e3,ee.CLIENT_SUPPORTS_COMPRESSION=!0,DefaultSignalingClient}var SignalingClientVideoSubscriptionConfiguration={},hasRequiredSignalingClientVideoSubscriptionConfiguration;function requireSignalingClientVideoSubscriptionConfiguration(){if(hasRequiredSignalingClientVideoSubscriptionConfiguration)return SignalingClientVideoSubscriptionConfiguration;hasRequiredSignalingClientVideoSubscriptionConfiguration=1,Object.defineProperty(SignalingClientVideoSubscriptionConfiguration,"__esModule",{value:!0});let x=class{equals(C){return C!==void 0&&this.mid===C.mid&&this.attendeeId===C.attendeeId&&this.streamId===C.streamId&&this.groupId===C.groupId&&this.priority===C.priority&&this.targetBitrateKbps===C.targetBitrateKbps&&this.qualityAdaptationPreference===C.qualityAdaptationPreference}};return SignalingClientVideoSubscriptionConfiguration.default=x,SignalingClientVideoSubscriptionConfiguration}var StatsCollector={},RedundantAudioRecoveryMetricReport={},hasRequiredRedundantAudioRecoveryMetricReport;function requireRedundantAudioRecoveryMetricReport(){if(hasRequiredRedundantAudioRecoveryMetricReport)return RedundantAudioRecoveryMetricReport;hasRequiredRedundantAudioRecoveryMetricReport=1,Object.defineProperty(RedundantAudioRecoveryMetricReport,"__esModule",{value:!0});let x=class{constructor(){this.currentTimestampMs=0,this.ssrc=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsExpected=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}};return RedundantAudioRecoveryMetricReport.default=x,RedundantAudioRecoveryMetricReport}var StreamMetricReport={},hasRequiredStreamMetricReport;function requireStreamMetricReport(){if(hasRequiredStreamMetricReport)return StreamMetricReport;hasRequiredStreamMetricReport=1,Object.defineProperty(StreamMetricReport,"__esModule",{value:!0});let x=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}};return StreamMetricReport.default=x,StreamMetricReport}var MeetingSessionLifecycleEvent={},hasRequiredMeetingSessionLifecycleEvent;function requireMeetingSessionLifecycleEvent(){return hasRequiredMeetingSessionLifecycleEvent||(hasRequiredMeetingSessionLifecycleEvent=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.MeetingSessionLifecycleEvent=void 0;var C;(function(E){E[E.Connecting=0]="Connecting",E[E.Started=1]="Started",E[E.Stopped=2]="Stopped"})(C=x.MeetingSessionLifecycleEvent||(x.MeetingSessionLifecycleEvent={})),x.default=C}(MeetingSessionLifecycleEvent)),MeetingSessionLifecycleEvent}var MeetingSessionLifecycleEventCondition={},hasRequiredMeetingSessionLifecycleEventCondition;function requireMeetingSessionLifecycleEventCondition(){return hasRequiredMeetingSessionLifecycleEventCondition||(hasRequiredMeetingSessionLifecycleEventCondition=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.MeetingSessionLifecycleEventCondition=void 0;var C;(function(E){E[E.ConnectingNew=0]="ConnectingNew",E[E.ReconnectingExisting=1]="ReconnectingExisting",E[E.StartedNew=2]="StartedNew",E[E.StartedExisting=3]="StartedExisting",E[E.StartedAfterReconnect=4]="StartedAfterReconnect",E[E.StoppedCleanly=5]="StoppedCleanly",E[E.StoppedWithFailure=6]="StoppedWithFailure"})(C=x.MeetingSessionLifecycleEventCondition||(x.MeetingSessionLifecycleEventCondition={})),x.default=C}(MeetingSessionLifecycleEventCondition)),MeetingSessionLifecycleEventCondition}var hasRequiredStatsCollector;function requireStatsCollector(){if(hasRequiredStatsCollector)return StatsCollector;hasRequiredStatsCollector=1;var x=StatsCollector&&StatsCollector.__awaiter||function(ae,oe,le,fe){function de(ce){return ce instanceof le?ce:new le(function(pe){pe(ce)})}return new(le||(le=Promise))(function(ce,pe){function he(ye){try{ve(fe.next(ye))}catch(Se){pe(Se)}}function me(ye){try{ve(fe.throw(ye))}catch(Se){pe(Se)}}function ve(ye){ye.done?ce(ye.value):de(ye.value).then(he,me)}ve((fe=fe.apply(ae,oe||[])).next())})},C=StatsCollector&&StatsCollector.__importDefault||function(ae){return ae&&ae.__esModule?ae:{default:ae}};Object.defineProperty(StatsCollector,"__esModule",{value:!0});const E=C(requireClientMetricReport()),w=C(requireClientMetricReportDirection()),T=C(requireClientMetricReportMediaType()),_=C(requireRedundantAudioRecoveryMetricReport()),S=C(requireStreamMetricReport()),R=C(requireMeetingSessionLifecycleEvent()),A=C(requireMeetingSessionLifecycleEventCondition()),O=C(requireIntervalScheduler()),H=requireSignalingProtocol(),ee=requireTypes$1(),te=C(requireAudioLogEvent()),ie=C(requireVideoLogEvent());let ne=class mc{constructor(oe,le,fe=mc.INTERVAL_MS){this.audioVideoController=oe,this.logger=le,this.interval=fe,this.intervalScheduler=null,this.redRecoveryMetricReport=new _.default,this.lastRedRecoveryMetricReportConsumedTimestampMs=0,this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0,this.resolutionMap=new Map,this.metricsAddTime=(de,ce,pe)=>{},this.metricsLogEvent=(de,ce)=>{}}toAttribute(oe){return this.toSuffix(oe).substring(1)}toSuffix(oe){return oe.toLowerCase()===oe?`_${oe}`:oe.toUpperCase()===oe?`_${oe.toLowerCase()}`:oe.replace(/([A-Z][a-z]+)/g,function(le){return`_${le}`}).replace(/([A-Z][A-Z]+)/g,function(le){return`_${le}`}).toLowerCase()}logLatency(oe,le,fe){const de=this.toSuffix(oe);this.logEventTime("meeting"+de,le,fe)}logStateTimeout(oe,le){const fe=this.toSuffix(oe);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},le),{state:`state${fe}`}))}logAudioEvent(oe,le){const fe="audio"+this.toSuffix(te.default[oe]);this.logEvent(fe,le)}logVideoEvent(oe,le){const fe="video"+this.toSuffix(ie.default[oe]);this.logEvent(fe,le)}logEventTime(oe,le,fe={}){const de=Object.assign(Object.assign({},fe),{call_id:this.audioVideoController.configuration.meetingId,client_type:mc.CLIENT_TYPE,metric_type:"latency"});this.logger.debug(()=>`[StatsCollector] ${oe}: ${JSON.stringify(de)}`),this.metricsAddTime(oe,le,de)}logMeetingSessionStatus(oe){const le=`${oe.statusCode()}`;this.logEvent(le);const fe={status:le,status_code:`${oe.statusCode()}`};this.logEvent("meeting_session_status",fe),oe.isTerminal()&&this.logEvent("meeting_session_stopped",fe),oe.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",fe),oe.isFailure()&&this.logEvent("meeting_session_failed",fe)}logLifecycleEvent(oe,le){const fe={lifecycle_event:`lifecycle${this.toSuffix(R.default[oe])}`,lifecycle_event_code:`${oe}`,lifecycle_event_condition:`condition${this.toSuffix(A.default[le])}`,lifecycle_event_condition_code:`${le}`};this.logEvent("meeting_session_lifecycle",fe)}logEvent(oe,le={}){const fe=Object.assign(Object.assign({},le),{call_id:this.audioVideoController.configuration.meetingId,client_type:mc.CLIENT_TYPE});this.logger.debug(()=>`[StatsCollector] ${oe}: ${JSON.stringify(fe)}`),this.metricsLogEvent(oe,fe)}start(oe,le){return this.intervalScheduler?!1:(this.logger.info("Starting StatsCollector"),this.signalingClient=oe,this.videoStreamIndex=le,this.clientMetricReport=new E.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new O.default(this.interval),this.intervalScheduler.start(()=>x(this,void 0,void 0,function*(){yield this.getStatsWrapper()})),!0)}stop(){this.logger.info("Stopping StatsCollector"),this.intervalScheduler&&this.intervalScheduler.stop(),this.intervalScheduler=null}videoTileResolutionDidChange(oe,le,fe){this.resolutionMap.set(oe,{width:le,height:fe})}videoTileUnbound(oe){this.resolutionMap.delete(oe)}updateMetricValues(oe,le){const fe=le?this.clientMetricReport.streamMetricReports[Number(oe.ssrc)]:this.clientMetricReport.globalMetricReport;let de;if(le){const ce=fe.mediaType,pe=fe.direction;de=this.clientMetricReport.getMetricMap(ce,pe),ce===T.default.VIDEO&&pe===w.default.DOWNSTREAM&&this.addRenderResolutionToVideoDownstreamMetrics(fe,oe.ssrc)}else de=this.clientMetricReport.getMetricMap();for(const ce in oe)ce in de&&(typeof oe[ce]=="number"?(fe.previousMetrics[ce]=fe.currentMetrics[ce],fe.currentMetrics[ce]=oe[ce]):typeof oe[ce]=="string"?fe.currentStringMetrics[ce]=oe[ce]:typeof oe[ce]=="object"?(fe.previousObjectMetrics[ce]=fe.currentObjectMetrics[ce]===void 0?oe[ce]:fe.currentObjectMetrics[ce],fe.currentObjectMetrics[ce]=oe[ce]):this.logger.error(`Unknown metric value type ${typeof oe[ce]} for metric ${ce}`))}processRawMetricReports(oe){this.clientMetricReport.currentSsrcs={};const le=Date.now();for(const fe of oe){if(this.isVideoSourceMetricReport(fe))continue;const de=this.isStreamRawMetricReport(fe);if(de){const ce=this.clientMetricReport.streamMetricReports[Number(fe.ssrc)];if(ce)ce.mediaType===T.default.VIDEO&&ce.direction===w.default.UPSTREAM?ce.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(fe.rid):ce.streamId=this.videoStreamIndex.streamIdForSSRC(Number(fe.ssrc));else{const pe=new S.default;pe.mediaType=this.getMediaType(fe),pe.direction=this.getDirectionType(fe),pe.mediaType===T.default.VIDEO&&pe.direction===w.default.UPSTREAM?pe.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(fe.rid):this.videoStreamIndex.allStreams().empty()||(pe.streamId=this.videoStreamIndex.streamIdForSSRC(Number(fe.ssrc)),this.videoStreamIndex.groupIdForSSRC!==void 0&&(pe.groupId=this.videoStreamIndex.groupIdForSSRC(Number(fe.ssrc)))),this.clientMetricReport.streamMetricReports[Number(fe.ssrc)]=pe}this.clientMetricReport.currentSsrcs[Number(fe.ssrc)]=1}this.updateMetricValues(fe,de)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=le,this.clientMetricReport.print()}addStreamMetricDimensionFrames(oe,le){const fe=this.clientMetricReport.getStreamDimensionMap();for(const de in le.currentStringMetrics)if(de in fe){const ce=H.SdkStreamDimension.create();ce.type=fe[de];const pe=H.SdkDimensionValue.create();pe.stringValue=le.currentStringMetrics[de],ce.value=pe,oe.dimensions.push(ce)}}addMetricFrame(oe,le,fe,de){const ce=fe.type,pe=fe.transform,he=fe.source,me=le.streamMetricFrames.length,ve=le.streamMetricFrames[me-1];if(ce){const ye=H.SdkMetric.create();ye.type=ce,ye.value=pe(he||oe,de),de?ve.metrics.push(ye):le.globalMetrics.push(ye)}}addGlobalMetricsToProtobuf(oe){const le=this.clientMetricReport.getMetricMap();for(const fe in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(fe,oe,le[fe])}addStreamMetricsToProtobuf(oe){for(const le in this.clientMetricReport.streamMetricReports){const fe=this.clientMetricReport.streamMetricReports[le],de=H.SdkStreamMetricFrame.create();de.streamId=fe.streamId,de.mediaType=fe.mediaType===T.default.AUDIO?H.SdkStreamMediaType.AUDIO:H.SdkStreamMediaType.VIDEO,de.metrics=[],this.addStreamMetricDimensionFrames(de,fe),oe.streamMetricFrames.push(de);const ce=this.clientMetricReport.getMetricMap(fe.mediaType,fe.direction);for(const pe in ce)this.hasMetricDependenciesInReport(pe,fe)&&this.addMetricFrame(pe,oe,ce[pe],Number(le))}}hasMetricDependenciesInReport(oe,le){return oe==="decoderLoss"&&le.currentMetrics.concealedSamples!==void 0&&le.currentMetrics.totalSamplesReceived!==void 0||oe==="jitterBufferMs"&&le.currentMetrics.jitterBufferDelay!==void 0&&le.currentMetrics.jitterBufferEmittedCount!==void 0||oe in le.currentMetrics||oe in le.currentStringMetrics||oe in le.currentObjectMetrics}makeClientMetricProtobuf(){const oe=H.SdkClientMetricFrame.create();return oe.globalMetrics=[],oe.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(oe),this.addStreamMetricsToProtobuf(oe),oe}sendClientMetricProtobuf(oe){this.signalingClient.sendClientMetrics(oe)}isStreamRawMetricReport(oe){return["inbound-rtp","inbound-rtp-red","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(oe.type)||this.isVideoSourceMetricReport(oe)}getMediaType(oe){return oe.kind==="audio"?T.default.AUDIO:T.default.VIDEO}getDirectionType(oe){const{type:le}=oe;return le==="inbound-rtp"||le==="remote-outbound-rtp"||le==="inbound-rtp-red"?w.default.DOWNSTREAM:w.default.UPSTREAM}isValidStandardRawMetric(oe){return oe.type==="inbound-rtp"||oe.type==="inbound-rtp-red"||oe.type==="outbound-rtp"||oe.type==="remote-inbound-rtp"||oe.type==="remote-outbound-rtp"||oe.type==="candidate-pair"&&oe.state==="succeeded"||oe.type==="media-source"}isValidSsrc(oe){let le=!0;return this.isStreamRawMetricReport(oe)&&this.getDirectionType(oe)===w.default.DOWNSTREAM&&this.getMediaType(oe)===T.default.VIDEO&&(le=this.videoStreamIndex.streamIdForSSRC(Number(oe.ssrc))>0),le}isValidRawMetricReport(oe){return this.isValidStandardRawMetric(oe)&&this.isValidSsrc(oe)}filterRawMetricReports(oe){const le=[];for(const fe of oe)this.isValidRawMetricReport(fe)&&le.push(fe);return le}handleRawMetricReports(oe){const le=this.filterRawMetricReports(oe);this.logger.debug(()=>`Filtered raw metrics : ${JSON.stringify(le)}`);const fe=[];this.maybeAddRedRecoveryMetrics(fe);const de=this.getVideoUpstreamSsrcFromRawMetricReports(le);de!==null&&this.addVideoCodecDegradationMetrics(fe,de),this.clientMetricReport.customStatsReports=fe,le.push(...fe),this.processRawMetricReports(le),this.updateVideoSourceMetrics(le);const ce=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(ce),this.audioVideoController.forEachObserver(pe=>{ee.Maybe.of(pe.metricsDidReceive).map(he=>he.bind(pe)(this.clientMetricReport.clone()))})}getStatsWrapper(){return x(this,void 0,void 0,function*(){if(!this.audioVideoController.rtcPeerConnection)return;const oe=[];try{const le=yield this.audioVideoController.rtcPeerConnection.getStats();this.clientMetricReport.rtcStatsReport=le,le.forEach(fe=>{oe.push(fe)}),this.handleRawMetricReports(oe)}catch(le){this.logger.error(le.message)}})}overrideObservableMetric(oe,le){this.clientMetricReport.overrideObservableMetric(oe,le)}recoveryMetricsDidReceive(oe){this.redRecoveryMetricReport=oe}maybeAddRedRecoveryMetrics(oe){this.redRecoveryMetricReport.currentTimestampMs!==this.lastRedRecoveryMetricReportConsumedTimestampMs&&(oe.push({kind:"audio",type:"inbound-rtp-red",ssrc:this.redRecoveryMetricReport.ssrc,timestamp:this.redRecoveryMetricReport.currentTimestampMs,totalAudioPacketsLost:this.redRecoveryMetricReport.totalAudioPacketsLost,totalAudioPacketsExpected:this.redRecoveryMetricReport.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.redRecoveryMetricReport.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.redRecoveryMetricReport.totalAudioPacketsRecoveredFec}),this.lastRedRecoveryMetricReportConsumedTimestampMs=this.redRecoveryMetricReport.currentTimestampMs)}videoCodecDegradationHighEncodeCpuDidReceive(){this.videoCodecDegradationHighEncodeCpuCount+=1}videoCodecDegradationEncodeFailureDidReceive(){this.videoCodecDegradationEncodeFailureCount+=1}videoCodecDegradationConcurrentSendersDidReceive(){this.videoCodecDegradationConcurrentSendersCount+=1}addVideoCodecDegradationMetrics(oe,le){oe.push({kind:"video",type:"outbound-rtp",ssrc:le,timestamp:Date.now(),videoCodecDegradationHighEncodeCpu:this.videoCodecDegradationHighEncodeCpuCount,videoCodecDegradationEncodeFailure:this.videoCodecDegradationEncodeFailureCount,videoCodecDegradationConcurrentSenders:this.videoCodecDegradationConcurrentSendersCount}),this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0}getVideoUpstreamSsrcFromRawMetricReports(oe){for(const le of oe)if(this.isStreamRawMetricReport(le)&&this.getMediaType(le)===T.default.VIDEO&&this.getDirectionType(le)===w.default.UPSTREAM)return le.ssrc;return null}isVideoSourceMetricReport(oe){return oe.type==="media-source"&&oe.kind==="video"}addRenderResolutionToVideoDownstreamMetrics(oe,le){const fe=this.videoStreamIndex.streamIdForSSRC(Number(le)),de=this.videoStreamIndex.attendeeIdForStreamId(fe);if(fe===void 0||de===""){this.logger.warn(`No attendee found for ssrc ${le}`);return}this.resolutionMap.has(de)&&(oe.currentMetrics.videoRenderWidth=this.resolutionMap.get(de).width,oe.currentMetrics.videoRenderHeight=this.resolutionMap.get(de).height)}updateVideoSourceMetrics(oe){for(const le of oe)if(this.isVideoSourceMetricReport(le)){const fe=this.clientMetricReport.getVideoUpstreamSsrcs();if(fe.length===0){this.logger.warn("No video upstream ssrcs found");return}for(const de of fe)this.clientMetricReport.streamMetricReports[de].currentMetrics.videoInputWidth=le.width,this.clientMetricReport.streamMetricReports[de].currentMetrics.videoInputHeight=le.height}}};return StatsCollector.default=ne,ne.INTERVAL_MS=1e3,ne.CLIENT_TYPE="amazon-chime-sdk-js",StatsCollector}var FinishGatheringICECandidatesTask={},hasRequiredFinishGatheringICECandidatesTask;function requireFinishGatheringICECandidatesTask(){if(hasRequiredFinishGatheringICECandidatesTask)return FinishGatheringICECandidatesTask;hasRequiredFinishGatheringICECandidatesTask=1;var x=FinishGatheringICECandidatesTask&&FinishGatheringICECandidatesTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=FinishGatheringICECandidatesTask&&FinishGatheringICECandidatesTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(FinishGatheringICECandidatesTask,"__esModule",{value:!0});const E=C(requireMeetingSessionStatusCode()),w=C(requireSDP()),T=C(requireBaseTask());let _=class lm extends T.default{constructor(R,A=lm.CHROME_VPN_TIMEOUT_MS){super(R.logger),this.context=R,this.chromeVpnTimeoutMs=A,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let R;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMs<this.context.meetingSessionConfiguration.connectionTimeoutMs&&Date.now()-this.startTimestampMs>this.chromeVpnTimeoutMs&&(R=new Error(`canceling ${this.name()} due to the meeting status code: ${E.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(R=R||new Error(`canceling ${this.name()}`),this.cancelPromise(R),delete this.cancelPromise)}run(){return x(this,void 0,void 0,function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new w.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines()){this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`);return}}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if((this.context.browserBehavior.hasFirefoxWebRTC()||this.context.peer.iceGatheringState==="complete")&&new w.default(this.context.peer.localDescription.sdp).hasCandidates()){this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering");return}try{yield new Promise((R,A)=>{this.cancelPromise=O=>{this.removeEventListener(),A(O)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if(this.context.peer.iceGatheringState==="complete"){this.removeEventListener(),R(),delete this.cancelPromise;return}},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=O=>{if(this.context.logger.info(`ice candidate: ${O.candidate?O.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),O.candidate&&(w.default.isRTPCandidate(O.candidate.candidate)&&this.context.iceCandidates.push(O.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1)){this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),R(),delete this.cancelPromise;return}this.context.peer.iceGatheringState==="complete"&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),!new w.default(this.context.peer.localDescription.sdp).hasCandidates()||this.context.iceCandidates.length===0?(A(new Error("no ice candidates were gathered")),delete this.cancelPromise):(R(),delete this.cancelPromise))},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()})}catch(R){throw R}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}})}};return FinishGatheringICECandidatesTask.default=_,_.CHROME_VPN_TIMEOUT_MS=5e3,FinishGatheringICECandidatesTask}var JoinAndReceiveIndexTask={},MeetingSessionTURNCredentials={},hasRequiredMeetingSessionTURNCredentials;function requireMeetingSessionTURNCredentials(){if(hasRequiredMeetingSessionTURNCredentials)return MeetingSessionTURNCredentials;hasRequiredMeetingSessionTURNCredentials=1,Object.defineProperty(MeetingSessionTURNCredentials,"__esModule",{value:!0});let x=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}};return MeetingSessionTURNCredentials.default=x,MeetingSessionTURNCredentials}var SignalingClientJoin={},hasRequiredSignalingClientJoin;function requireSignalingClientJoin(){if(hasRequiredSignalingClientJoin)return SignalingClientJoin;hasRequiredSignalingClientJoin=1;var x=SignalingClientJoin&&SignalingClientJoin.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(SignalingClientJoin,"__esModule",{value:!0});const C=x(requireServerSideNetworkAdaption());let E=class{constructor(w){this.applicationMetadata=w,this.serverSideNetworkAdaption=C.default.Default,this.supportedServerSideNetworkAdaptions=[],this.wantsAllTemporalLayersInIndex=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1}};return SignalingClientJoin.default=E,SignalingClientJoin}var hasRequiredJoinAndReceiveIndexTask;function requireJoinAndReceiveIndexTask(){if(hasRequiredJoinAndReceiveIndexTask)return JoinAndReceiveIndexTask;hasRequiredJoinAndReceiveIndexTask=1;var x=JoinAndReceiveIndexTask&&JoinAndReceiveIndexTask.__createBinding||(Object.create?function(ne,ae,oe,le){le===void 0&&(le=oe),Object.defineProperty(ne,le,{enumerable:!0,get:function(){return ae[oe]}})}:function(ne,ae,oe,le){le===void 0&&(le=oe),ne[le]=ae[oe]}),C=JoinAndReceiveIndexTask&&JoinAndReceiveIndexTask.__setModuleDefault||(Object.create?function(ne,ae){Object.defineProperty(ne,"default",{enumerable:!0,value:ae})}:function(ne,ae){ne.default=ae}),E=JoinAndReceiveIndexTask&&JoinAndReceiveIndexTask.__importStar||function(ne){if(ne&&ne.__esModule)return ne;var ae={};if(ne!=null)for(var oe in ne)oe!=="default"&&Object.prototype.hasOwnProperty.call(ne,oe)&&x(ae,ne,oe);return C(ae,ne),ae},w=JoinAndReceiveIndexTask&&JoinAndReceiveIndexTask.__awaiter||function(ne,ae,oe,le){function fe(de){return de instanceof oe?de:new oe(function(ce){ce(de)})}return new(oe||(oe=Promise))(function(de,ce){function pe(ve){try{me(le.next(ve))}catch(ye){ce(ye)}}function he(ve){try{me(le.throw(ve))}catch(ye){ce(ye)}}function me(ve){ve.done?de(ve.value):fe(ve.value).then(pe,he)}me((le=le.apply(ne,ae||[])).next())})},T=JoinAndReceiveIndexTask&&JoinAndReceiveIndexTask.__importDefault||function(ne){return ne&&ne.__esModule?ne:{default:ne}};Object.defineProperty(JoinAndReceiveIndexTask,"__esModule",{value:!0});const _=T(requireMeetingSessionStatus()),S=T(requireMeetingSessionStatusCode()),R=T(requireMeetingSessionTURNCredentials()),A=E(requireServerSideNetworkAdaption()),O=T(requireSignalingClientEventType()),H=T(requireSignalingClientJoin()),ee=requireSignalingProtocol(),te=T(requireBaseTask());let ie=class extends te.default{constructor(ne){super(ne.logger),this.context=ne,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return w(this,void 0,void 0,function*(){const ne=yield new Promise((ae,oe)=>{const le=this.context;le.turnCredentials=null;class fe{constructor(he){this.signalingClient=he}cancel(){this.signalingClient.removeObserver(this),oe(new Error("JoinAndReceiveIndexTask got canceled while waiting for SdkIndexFrame"))}handleSignalingClientEvent(he){if(he.type===O.default.WebSocketClosed){let ve=`The signaling connection was closed with code ${he.closeCode} and reason: ${he.closeReason}`;le.logger.warn(ve);let ye=S.default.SignalingBadRequest;he.closeCode===4410?(ve="The meeting already ended.",le.logger.warn(ve),ye=S.default.MeetingEnded):he.closeCode>=4500&&he.closeCode<4600&&(ye=S.default.SignalingInternalServerError),le.audioVideoController.handleMeetingSessionStatus(new _.default(ye),new Error(ve));return}if(he.type!==O.default.ReceivedSignalFrame)return;if(he.message.type===ee.SdkSignalFrame.Type.JOIN_ACK){const ve=he.message.joinack;if(!ve){le.audioVideoController.handleMeetingSessionStatus(new _.default(S.default.SignalingRequestFailed),new Error("Join ACK message did not include expected frame"));return}if(ve.videoSubscriptionLimit&&(le.videoSubscriptionLimit=ve.videoSubscriptionLimit),le.serverSupportsCompression=ve.wantsCompressedSdp,ve.defaultServerSideNetworkAdaption!==void 0&&ve.defaultServerSideNetworkAdaption!==A.default.Default&&le.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption!==void 0){const ye=ve.defaultServerSideNetworkAdaption;le.logger.info(`Overriding server side network adaption value to ${ye}`),le.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(A.convertServerSideNetworkAdaptionEnumFromSignaled(ye))}ve&&ve.turnCredentials?(le.turnCredentials=new R.default,le.turnCredentials.username=ve.turnCredentials.username,le.turnCredentials.password=ve.turnCredentials.password,le.turnCredentials.ttl=ve.turnCredentials.ttl,le.turnCredentials.uris=ve.turnCredentials.uris.map(ye=>le.meetingSessionConfiguration.urls.urlRewriter(ye)).filter(ye=>!!ye)):le.logger.error("missing TURN credentials in JoinAckFrame");return}if(he.message.type!==ee.SdkSignalFrame.Type.INDEX)return;this.signalingClient.removeObserver(this);const me=he.message.index;ae(me)}}const de=new fe(this.context.signalingClient);this.context.signalingClient.registerObserver(de),this.taskCanceler=de,this.context.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1;const ce=new H.default(this.context.meetingSessionConfiguration.applicationMetadata);this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption!==void 0&&this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions!==void 0&&(ce.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),ce.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex!==void 0&&(ce.wantsAllTemporalLayersInIndex=this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex()),ce.disablePeriodicKeyframeRequestOnContentSender=this.context.meetingSessionConfiguration.disablePeriodicKeyframeRequestOnContentSender,this.context.signalingClient.join(ce)});this.context.logger.info(`received first index ${JSON.stringify(ne)}`),this.context.indexFrame=ne})}};return JoinAndReceiveIndexTask.default=ie,JoinAndReceiveIndexTask}var LeaveAndReceiveLeaveAckTask={},hasRequiredLeaveAndReceiveLeaveAckTask;function requireLeaveAndReceiveLeaveAckTask(){if(hasRequiredLeaveAndReceiveLeaveAckTask)return LeaveAndReceiveLeaveAckTask;hasRequiredLeaveAndReceiveLeaveAckTask=1;var x=LeaveAndReceiveLeaveAckTask&&LeaveAndReceiveLeaveAckTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=LeaveAndReceiveLeaveAckTask&&LeaveAndReceiveLeaveAckTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(LeaveAndReceiveLeaveAckTask,"__esModule",{value:!0});const E=C(requireSignalingClientEventType()),w=requireSignalingProtocol(),T=C(requireBaseTask());let _=class extends T.default{constructor(S){super(S.logger),this.context=S,this.taskName="LeaveAndReceiveLeaveAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return x(this,void 0,void 0,function*(){this.context.signalingClient.ready()&&(this.context.signalingClient.leave(),this.context.logger.info("sent leave"),yield this.receiveLeaveAck())})}receiveLeaveAck(){return new Promise((S,R)=>{class A{constructor(ee,te){this.signalingClient=ee,this.logger=te}cancel(){this.signalingClient.removeObserver(this),R(new Error("LeaveAndReceiveLeaveAckTask got canceled while waiting for IndexFrame"))}handleSignalingClientEvent(ee){if(ee.isConnectionTerminated()){this.signalingClient.removeObserver(this),this.logger.info("LeaveAndReceiveLeaveAckTask connection terminated"),S();return}ee.type===E.default.ReceivedSignalFrame&&ee.message.type===w.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),S())}}const O=new A(this.context.signalingClient,this.context.logger);this.taskCanceler=O,this.context.signalingClient.registerObserver(O)})}};return LeaveAndReceiveLeaveAckTask.default=_,LeaveAndReceiveLeaveAckTask}var ListenForVolumeIndicatorsTask={},hasRequiredListenForVolumeIndicatorsTask;function requireListenForVolumeIndicatorsTask(){if(hasRequiredListenForVolumeIndicatorsTask)return ListenForVolumeIndicatorsTask;hasRequiredListenForVolumeIndicatorsTask=1;var x=ListenForVolumeIndicatorsTask&&ListenForVolumeIndicatorsTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=ListenForVolumeIndicatorsTask&&ListenForVolumeIndicatorsTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(ListenForVolumeIndicatorsTask,"__esModule",{value:!0});const E=C(requireSignalingClientEventType()),w=requireSignalingProtocol(),T=C(requireBaseTask());let _=class extends T.default{constructor(S){super(S.logger),this.context=S,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=R=>{this.context.signalingClient.mute(R)}}run(){return x(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(S){if(S.type===E.default.ReceivedSignalFrame){if(S.message.type===w.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const R=S.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(R)}else if(S.message.type===w.SdkSignalFrame.Type.AUDIO_METADATA){const R=S.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(R)}}}};return ListenForVolumeIndicatorsTask.default=_,ListenForVolumeIndicatorsTask}var MonitorTask={},ReconnectionHealthPolicy={},hasRequiredReconnectionHealthPolicy;function requireReconnectionHealthPolicy(){if(hasRequiredReconnectionHealthPolicy)return ReconnectionHealthPolicy;hasRequiredReconnectionHealthPolicy=1;var x=ReconnectionHealthPolicy&&ReconnectionHealthPolicy.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(ReconnectionHealthPolicy,"__esModule",{value:!0});const C=x(requireBaseConnectionHealthPolicy());let E=class tn extends C.default{constructor(T,_,S){super(_,S,"Reconnection Health"),this.logger=T,this.audioDelayPointsOverMaximum=0,tn.CONNECTION_UNHEALTHY_THRESHOLD=_.connectionUnhealthyThreshold,tn.CONNECTION_WAIT_TIME_MS=_.connectionWaitTimeMs,tn.MISSED_PONGS_THRESHOLD=_.missedPongsUpperThreshold,tn.MAXIMUM_AUDIO_DELAY_MS=_.maximumAudioDelayMs,tn.MAXIMUM_AUDIO_DELAY_DATA_POINTS=_.maximumAudioDelayDataPoints}health(){if(this.currentData.isConnectionStartRecent(tn.CONNECTION_WAIT_TIME_MS))return 1;const T=this.currentData.consecutiveStatsWithNoPackets>=tn.CONNECTION_UNHEALTHY_THRESHOLD,_=this.currentData.consecutiveMissedPongs>=tn.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>tn.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;const S=this.audioDelayPointsOverMaximum>tn.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return S&&(this.audioDelayPointsOverMaximum=0),T||_||S?(this.logger.warn(`reconnection recommended due to: no packets received: ${T}, missed pongs: ${_}, bad audio delay: ${S}`),0):1}};return ReconnectionHealthPolicy.default=E,ReconnectionHealthPolicy}var SendingAudioFailureConnectionHealthPolicy={},hasRequiredSendingAudioFailureConnectionHealthPolicy;function requireSendingAudioFailureConnectionHealthPolicy(){if(hasRequiredSendingAudioFailureConnectionHealthPolicy)return SendingAudioFailureConnectionHealthPolicy;hasRequiredSendingAudioFailureConnectionHealthPolicy=1;var x=SendingAudioFailureConnectionHealthPolicy&&SendingAudioFailureConnectionHealthPolicy.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(SendingAudioFailureConnectionHealthPolicy,"__esModule",{value:!0});const C=x(requireBaseConnectionHealthPolicy());let E=class extends C.default{constructor(w,T,_){super(T,_,"Sending Audio Health"),this.logger=w,this.sendingAudioFailureSamplesToConsider=T.sendingAudioFailureSamplesToConsider>0?T.sendingAudioFailureSamplesToConsider:1,this.sendingAudioFailureInitialWaitTimeMs=T.sendingAudioFailureInitialWaitTimeMs,this.maximumTimesToWarn=T.maximumTimesToWarn,this.coolDownTimeMs=T.cooldownTimeMs,this.lastWarnTimestampMs=0,this.warnCount=0}isSendingAudioUnhealthy(){const w=!this.currentData.isConnectionStartRecent(this.sendingAudioFailureInitialWaitTimeMs),T=this.currentData.consecutiveStatsWithNoAudioPacketsSent>=this.sendingAudioFailureSamplesToConsider;return w&&T}health(){if(this.isSendingAudioUnhealthy()){const w=Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs;return this.currentHealth>this.minimumHealth()&&!w?(this.logger.warn(`Sending Audio is unhealthy for ${this.sendingAudioFailureSamplesToConsider} seconds consecutively.`),this.warnCount++,this.warnCount>this.maximumTimesToWarn?(this.logger.warn("SendingAudioFailure health policy maximum warnings breached. Falling back to reporting healthy."),this.maximumHealth()):(this.lastWarnTimestampMs=Date.now(),this.minimumHealth())):this.currentHealth}return this.maximumHealth()}};return SendingAudioFailureConnectionHealthPolicy.default=E,SendingAudioFailureConnectionHealthPolicy}var UnusableAudioWarningConnectionHealthPolicy={},hasRequiredUnusableAudioWarningConnectionHealthPolicy;function requireUnusableAudioWarningConnectionHealthPolicy(){if(hasRequiredUnusableAudioWarningConnectionHealthPolicy)return UnusableAudioWarningConnectionHealthPolicy;hasRequiredUnusableAudioWarningConnectionHealthPolicy=1;var x=UnusableAudioWarningConnectionHealthPolicy&&UnusableAudioWarningConnectionHealthPolicy.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(UnusableAudioWarningConnectionHealthPolicy,"__esModule",{value:!0});const C=x(requireBaseConnectionHealthPolicy());let E=class extends C.default{constructor(w,T){super(w,T,"Unusable Audio Warning"),this.coolDownTimeMs=w.cooldownTimeMs,this.pastSamplesToConsider=w.pastSamplesToConsider,this.fractionalLoss=w.fractionalLoss,this.packetsExpected=w.packetsExpected,this.maximumTimesToWarn=w.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length<this.pastSamplesToConsider)return 0;const w=this.pastSamplesToConsider,T=w*this.packetsExpected;let _=0;for(let S=0;S<w;S++)_+=this.currentData.packetsReceivedInLastMinute[S];return Math.min(Math.max(1-_/T,0),1)}health(){return Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs?this.currentHealth:this.calculateFractionalLoss()>=this.fractionalLoss?this.currentHealth!==0&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?1:0:1}};return UnusableAudioWarningConnectionHealthPolicy.default=E,UnusableAudioWarningConnectionHealthPolicy}var hasRequiredMonitorTask;function requireMonitorTask(){if(hasRequiredMonitorTask)return MonitorTask;hasRequiredMonitorTask=1;var x=MonitorTask&&MonitorTask.__awaiter||function(le,fe,de,ce){function pe(he){return he instanceof de?he:new de(function(me){me(he)})}return new(de||(de=Promise))(function(he,me){function ve(Ce){try{Se(ce.next(Ce))}catch(be){me(be)}}function ye(Ce){try{Se(ce.throw(Ce))}catch(be){me(be)}}function Se(Ce){Ce.done?he(Ce.value):pe(Ce.value).then(ve,ye)}Se((ce=ce.apply(le,fe||[])).next())})},C=MonitorTask&&MonitorTask.__importDefault||function(le){return le&&le.__esModule?le:{default:le}};Object.defineProperty(MonitorTask,"__esModule",{value:!0});const E=C(requireClientMetricReportDirection()),w=C(requireClientMetricReportMediaType()),T=C(requireReconnectionHealthPolicy()),_=C(requireSendingAudioFailureConnectionHealthPolicy()),S=C(requireUnusableAudioWarningConnectionHealthPolicy()),R=C(requireVideoEncodingConnectionHealthPolicyName()),A=C(requireMeetingSessionStatus()),O=C(requireMeetingSessionStatusCode()),H=C(requireVideoCodecCapability()),ee=C(requireSignalingClientEventType()),te=requireSignalingProtocol(),ie=C(requireAudioLogEvent()),ne=requireTypes$1(),ae=C(requireBaseTask());let oe=class extends ae.default{constructor(le,fe,de){super(le.logger),this.context=le,this.initialConnectionHealthData=de,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.isResubscribeCheckPaused=!1,this.pendingMetricsReport=void 0,this.videoEncodingHealthPolicies=[],this.checkAndSendWeakSignalEvent=ce=>{const pe=ce<1,he=this.prevSignalStrength<1,me=pe?he?null:ie.default.RedmicStartLoss:he?ie.default.RedmicEndLoss:null;me&&this.context.statsCollector.logAudioEvent(me),this.prevSignalStrength=ce},this.realtimeFatalErrorCallback=ce=>{this.logger.error(`realtime error: ${ce}: ${ce.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new A.default(O.default.RealtimeApiFailed),ce)},this.realtimeAttendeeIdPresenceHandler=(ce,pe)=>{var he;const me=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${me}`),me===ce&&pe&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,(he=this.context.eventController)===null||he===void 0||he.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs}))},this.generateBaseAudioVideoEventAttributes=()=>{const{signalingOpenDurationMs:ce,startTimeMs:pe,iceGatheringDurationMs:he,attendeePresenceDurationMs:me,meetingStartDurationMs:ve}=this.context;return{meetingDurationMs:pe===null?0:Math.round(Date.now()-pe),signalingOpenDurationMs:ce,iceGatheringDurationMs:he,attendeePresenceDurationMs:me,meetingStartDurationMs:ve}},this.generateAudioVideoEventAttributesForReceivingAudioDropped=()=>{const ce=this.generateBaseAudioVideoEventAttributes();return Object.assign(Object.assign({},ce),{maxVideoTileCount:this.context.maxVideoTileCount,poorConnectionCount:this.context.poorConnectionCount})},this.reconnectionHealthPolicy=new T.default(le.logger,Object.assign({},fe),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new S.default(Object.assign({},fe),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new _.default(le.logger,Object.assign({},fe),this.initialConnectionHealthData.clone());for(const ce of fe.videoEncodingHealthPolicies)this.videoEncodingHealthPolicies.push(new ce(Object.assign({},fe),this.initialConnectionHealthData.clone()))}removeObserver(){this.context.audioVideoController.removeObserver(this),this.context.realtimeController.realtimeUnsubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.signalingClient.removeObserver(this)}run(){return x(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.audioVideoController.addObserver(this),this.context.realtimeController.realtimeSubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.connectionMonitor.start(),this.context.statsCollector.start(this.context.signalingClient,this.context.videoStreamIndex),this.context.signalingClient.registerObserver(this)})}pauseResubscribeCheck(){this.isResubscribeCheckPaused=!0}resumeResubscribeCheck(){this.isResubscribeCheckPaused&&(this.isResubscribeCheckPaused=!1,this.pendingMetricsReport&&(this.context.logger.info("Resuming resubscribe check with pending metrics report"),this.checkResubscribe(this.pendingMetricsReport)&&this.context.audioVideoController.update({needsRenegotiation:!1})))}videoTileDidUpdate(le){this.context.maxVideoTileCount=Math.max(this.context.maxVideoTileCount,this.context.videoTileController.getAllVideoTiles().length)}checkResubscribe(le){if(this.isResubscribeCheckPaused){this.context.logger.info("Resubscribe check is paused, setting incoming client metric report as pending"),this.pendingMetricsReport=le;return}else this.pendingMetricsReport=void 0;const fe=le.getObservableMetrics(),de=fe.availableOutgoingBitrate,ce=fe.nackCountReceivedPerSecond;let pe=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(le);const he=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(pe=pe||he,he){const me=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions();this.context.videosToReceive=me.truncate(this.context.videoSubscriptionLimit),me.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.logger.info(`trigger resubscribe for down=${he}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:de/1e3,nackCountPerSecond:ce});const me=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();pe=pe||me,me&&(this.logger.info(`trigger resubscribe for up=${me}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters())}return pe}metricsDidReceive(le){if(this.checkResubscribe(le)&&this.context.audioVideoController.update({needsRenegotiation:!1}),!this.currentAvailableStreamAvgBitrates)return;const fe=le.streamMetricReports,de=new Map;for(const ce in fe)fe[ce].mediaType===w.default.VIDEO&&fe[ce].direction===E.default.DOWNSTREAM&&de.set(fe[ce].streamId,fe[ce])}connectionHealthDidChange(le){le.consecutiveMissedPongs===0&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.applyHealthPolicy(this.reconnectionHealthPolicy,le,()=>{this.context.audioVideoController.handleMeetingSessionStatus(new A.default(O.default.ConnectionHealthReconnect),null)}),this.applyHealthPolicy(this.unusableAudioWarningHealthPolicy,le,()=>{var fe;this.context.poorConnectionCount+=1;const de=this.generateAudioVideoEventAttributesForReceivingAudioDropped();(fe=this.context.eventController)===null||fe===void 0||fe.publishEvent("receivingAudioDropped",de),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver(ce=>{ne.Maybe.of(ce.connectionDidSuggestStopVideo).map(pe=>pe.bind(ce)())}):this.context.audioVideoController.forEachObserver(ce=>{ne.Maybe.of(ce.connectionDidBecomePoor).map(pe=>pe.bind(ce)())})},()=>{this.context.audioVideoController.forEachObserver(fe=>{ne.Maybe.of(fe.connectionDidBecomeGood).map(de=>de.bind(fe)())})});for(const fe of this.videoEncodingHealthPolicies)this.applyHealthPolicy(fe,le,()=>{switch(this.degradeVideoCodec(fe.name),fe.name){case R.default.VideoEncodingCpuHealth:this.context.statsCollector.videoCodecDegradationHighEncodeCpuDidReceive();break;case R.default.VideoEncodingFramerateHealth:this.context.statsCollector.videoCodecDegradationEncodeFailureDidReceive();break;case R.default.VideoConcurrentSendersHealth:this.context.statsCollector.videoCodecDegradationConcurrentSendersDidReceive();break}});this.context.isSessionConnected&&this.applyHealthPolicy(this.sendingAudioFailureHealthPolicy,le,()=>{var fe;const de=this.generateBaseAudioVideoEventAttributes();(fe=this.context.eventController)===null||fe===void 0||fe.publishEvent("sendingAudioFailed",de)},()=>{var fe;const de=this.generateBaseAudioVideoEventAttributes();(fe=this.context.eventController)===null||fe===void 0||fe.publishEvent("sendingAudioRecovered",de)})}applyHealthPolicy(le,fe,de,ce){le.update(fe);const pe=le.healthIfChanged();pe!==null&&(this.logger.info(`${le.name} value is now ${pe}`),pe<=le.minimumHealth()?ne.Maybe.of(de).map(he=>he.bind(this)()):ne.Maybe.of(ce).map(he=>he.bind(this)()))}handleBitrateFrame(le){this.currentAvailableStreamAvgBitrates=le,le.serverAvailableOutgoingBitrate>0&&(this.logger.info(`Received server side estimation of available incoming bitrate ${le.serverAvailableOutgoingBitrate}kbps`),this.context.statsCollector.overrideObservableMetric("availableIncomingBitrate",le.serverAvailableOutgoingBitrate*1e3))}handleSignalingClientEvent(le){var fe;if(le.type===ee.default.WebSocketClosed&&this.isUnexpectedWebsocketCloseCode(le.closeCode)||le.type===ee.default.WebSocketError||le.type===ee.default.WebSocketFailed){if(le.type===ee.default.WebSocketClosed&&this.context.logger.info(`The signaling connection was closed with code ${le.closeCode} and reason: ${le.closeReason}`),!this.hasSignalingError){const de=this.generateAudioVideoEventAttributesForReceivingAudioDropped();(fe=this.context.eventController)===null||fe===void 0||fe.publishEvent("signalingDropped",de),this.hasSignalingError=!0}this.context.isSessionConnected&&this.context.audioVideoController.handleMeetingSessionStatus(new A.default(this.isInternalServerFailureCloseCode(le.closeCode)?O.default.SignalingInternalServerError:O.default.SignalingChannelClosedUnexpectedly),null)}else le.type===ee.default.WebSocketOpen&&(this.hasSignalingError=!1);if(le.type===ee.default.ReceivedSignalFrame){if(le.message.type===te.SdkSignalFrame.Type.NOTIFICATION){switch(le.message.notification.level){case te.SdkNotificationFrame.NotificationLevel.INFO:this.logger.info(`Received notification from server: ${le.message.notification.message}`);break;case te.SdkNotificationFrame.NotificationLevel.WARNING:this.logger.warn(`Received warning from server: ${le.message.notification.message}`);break;case te.SdkNotificationFrame.NotificationLevel.ERROR:this.logger.error(`Received error from server: ${le.message.notification.message}`);break;default:this.logger.error(`Received notification from server with unknown level ${le.message.notification.level}: ${le.message.notification.message}`);break}return}if(le.message.bitrates){const ce=le.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(ce),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(le.message.bitrates)}const de=A.default.fromSignalFrame(le.message);le.message.type!==te.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&de.statusCode()!==O.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(de,null)}}isUnexpectedWebsocketCloseCode(le){return le===1006||this.isInternalServerFailureCloseCode(le)}isInternalServerFailureCloseCode(le){return le>=4500&&le<4600}degradeVideoCodec(le){if(this.context.meetingSupportedVideoSendCodecPreferences!==void 0&&this.context.meetingSupportedVideoSendCodecPreferences.length>1&&!(this.context.meetingSupportedVideoSendCodecPreferences[0].equals(H.default.h264ConstrainedBaselineProfile())||this.context.meetingSupportedVideoSendCodecPreferences[0].equals(H.default.vp8()))){const fe=[];for(const de of this.context.videoSendCodecPreferences)de.equals(this.context.meetingSupportedVideoSendCodecPreferences[0])||fe.push(de);fe.length>0?(this.context.logger.info(`Downgrading codec from ${this.context.meetingSupportedVideoSendCodecPreferences[0].codecName} to ${fe[0].codecName} due to ${le}`),this.context.degradedVideoSendCodecs.push(this.context.meetingSupportedVideoSendCodecPreferences[0]),this.context.meetingSupportedVideoSendCodecPreferences=fe,this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),this.context.audioVideoController.update({needsRenegotiation:!0})):this.context.logger.warn(`Degrading video codec failed since there is no alternative codec to select. Currently degraded codecs: ${this.context.degradedVideoSendCodecs.map(de=>de.codecName).join(",")}`)}}};return MonitorTask.default=oe,MonitorTask}var OpenSignalingConnectionTask={},SignalingClientConnectionRequest={},hasRequiredSignalingClientConnectionRequest;function requireSignalingClientConnectionRequest(){if(hasRequiredSignalingClientConnectionRequest)return SignalingClientConnectionRequest;hasRequiredSignalingClientConnectionRequest=1,Object.defineProperty(SignalingClientConnectionRequest,"__esModule",{value:!0});let x=class{constructor(C,E){this.signalingURL=C,this.joinToken=E}url(){return this.signalingURL+"?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1"}protocols(){return["_aws_wt_session",this.joinToken]}};return SignalingClientConnectionRequest.default=x,SignalingClientConnectionRequest}var hasRequiredOpenSignalingConnectionTask;function requireOpenSignalingConnectionTask(){if(hasRequiredOpenSignalingConnectionTask)return OpenSignalingConnectionTask;hasRequiredOpenSignalingConnectionTask=1;var x=OpenSignalingConnectionTask&&OpenSignalingConnectionTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=OpenSignalingConnectionTask&&OpenSignalingConnectionTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(OpenSignalingConnectionTask,"__esModule",{value:!0});const E=C(requireSignalingClientConnectionRequest()),w=C(requireSignalingClientEventType()),T=C(requireBaseTask());let _=class extends T.default{constructor(S){super(S.logger),this.context=S,this.taskName="OpenSignalingConnectionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return x(this,void 0,void 0,function*(){const S=this.context.meetingSessionConfiguration;this.context.signalingClient.openConnection(new E.default(S.urls.signalingURL,S.credentials.joinToken));const R=Date.now();try{yield new Promise((A,O)=>{class H{constructor(ie){this.signalingClient=ie}cancel(){this.signalingClient.removeObserver(this),O(new Error("OpenSignalingConnectionTask got canceled while waiting to open signaling connection"))}handleSignalingClientEvent(ie){switch(ie.type){case w.default.WebSocketOpen:this.signalingClient.removeObserver(this),A();break;case w.default.WebSocketFailed:this.signalingClient.removeObserver(this),O(new Error("WebSocket connection failed"));break}}}const ee=new H(this.context.signalingClient);this.context.signalingClient.registerObserver(ee),this.taskCanceler=ee})}catch(A){throw A}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-R),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}})}};return OpenSignalingConnectionTask.default=_,OpenSignalingConnectionTask}var ParallelGroupTask={},hasRequiredParallelGroupTask;function requireParallelGroupTask(){if(hasRequiredParallelGroupTask)return ParallelGroupTask;hasRequiredParallelGroupTask=1;var x=ParallelGroupTask&&ParallelGroupTask.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=ParallelGroupTask&&ParallelGroupTask.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(ParallelGroupTask,"__esModule",{value:!0});const E=C(requireBaseTask());let w=class extends E.default{constructor(T,_,S){super(T),this.taskName=_,this.tasksToRunParallel=S;for(const R of S)R.setParent(this)}cancel(){for(const T of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${T.name()}`),T.cancel()}run(){return x(this,void 0,void 0,function*(){const T=[];for(const S of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${S.name()}`),T.push(S.run());const _=[];for(let S=0;S<T.length;S++){try{yield T[S]}catch(R){_.push(`task ${this.tasksToRunParallel[S].name()} failed: ${R.message}`)}this.logger.info(`parallel group task ${this.name()} completed subtask ${this.tasksToRunParallel[S].name()}`)}if(_.length>0){const S=_.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${S}`)}this.logger.info(`parallel group task ${this.name()} completed`)})}};return ParallelGroupTask.default=w,ParallelGroupTask}var PromoteToPrimaryMeetingTask={},hasRequiredPromoteToPrimaryMeetingTask;function requirePromoteToPrimaryMeetingTask(){if(hasRequiredPromoteToPrimaryMeetingTask)return PromoteToPrimaryMeetingTask;hasRequiredPromoteToPrimaryMeetingTask=1;var x=PromoteToPrimaryMeetingTask&&PromoteToPrimaryMeetingTask.__awaiter||function(R,A,O,H){function ee(te){return te instanceof O?te:new O(function(ie){ie(te)})}return new(O||(O=Promise))(function(te,ie){function ne(le){try{oe(H.next(le))}catch(fe){ie(fe)}}function ae(le){try{oe(H.throw(le))}catch(fe){ie(fe)}}function oe(le){le.done?te(le.value):ee(le.value).then(ne,ae)}oe((H=H.apply(R,A||[])).next())})},C=PromoteToPrimaryMeetingTask&&PromoteToPrimaryMeetingTask.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(PromoteToPrimaryMeetingTask,"__esModule",{value:!0});const E=requireBuild(),w=C(requireSignalingClientEventType()),T=requireSignalingProtocol(),_=C(requireBaseTask());let S=class extends _.default{constructor(R,A,O){super(R.logger),this.context=R,this.credentials=A,this.completionCallback=O,this.taskName="PromoteToPrimaryMeetingTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return x(this,void 0,void 0,function*(){this.context.signalingClient.ready()?(this.context.signalingClient.promoteToPrimaryMeeting(this.credentials),this.context.logger.info("Sent request to join primary meeting"),yield this.receivePrimaryMeetingJoinAck()):this.completionCallback(new E.MeetingSessionStatus(E.MeetingSessionStatusCode.SignalingRequestFailed))})}receivePrimaryMeetingJoinAck(){return new Promise((R,A)=>{class O{constructor(te,ie,ne){this.signalingClient=te,this.completionCallback=ie,this.logger=ne}cancel(){this.signalingClient.removeObserver(this),this.completionCallback(new E.MeetingSessionStatus(E.MeetingSessionStatusCode.SignalingRequestFailed)),R()}handleSignalingClientEvent(te){te.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new E.MeetingSessionStatus(E.MeetingSessionStatusCode.SignalingRequestFailed)),R()),te.type===w.default.ReceivedSignalFrame&&te.message.type===T.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(E.MeetingSessionStatus.fromSignalFrame(te.message)),R())}}const H=new O(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=H,this.context.signalingClient.registerObserver(H)})}};return PromoteToPrimaryMeetingTask.default=S,PromoteToPrimaryMeetingTask}var ReceiveAudioInputTask={},hasRequiredReceiveAudioInputTask;function requireReceiveAudioInputTask(){if(hasRequiredReceiveAudioInputTask)return ReceiveAudioInputTask;hasRequiredReceiveAudioInputTask=1;var x=ReceiveAudioInputTask&&ReceiveAudioInputTask.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=ReceiveAudioInputTask&&ReceiveAudioInputTask.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(ReceiveAudioInputTask,"__esModule",{value:!0});const E=C(requireBaseTask());let w=class extends E.default{constructor(T){super(T.logger),this.context=T,this.taskName="ReceiveAudioInputTask"}run(){var T,_;return x(this,void 0,void 0,function*(){if(!(!((_=(T=this.context.meetingSessionConfiguration)===null||T===void 0?void 0:T.urls)===null||_===void 0)&&_.audioHostURL)){this.context.logger.info("No audio connection: not acquiring audio input");return}if(this.context.activeAudioInput){this.context.logger.info("an active audio input exists");return}let S;try{S=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch{this.context.logger.warn("could not acquire audio input from current device")}S?this.context.activeAudioInput=S:this.context.logger.warn("an audio input is not available")})}};return ReceiveAudioInputTask.default=w,ReceiveAudioInputTask}var ReceiveRemoteVideoPauseResumeTask={},hasRequiredReceiveRemoteVideoPauseResumeTask;function requireReceiveRemoteVideoPauseResumeTask(){if(hasRequiredReceiveRemoteVideoPauseResumeTask)return ReceiveRemoteVideoPauseResumeTask;hasRequiredReceiveRemoteVideoPauseResumeTask=1;var x=ReceiveRemoteVideoPauseResumeTask&&ReceiveRemoteVideoPauseResumeTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=ReceiveRemoteVideoPauseResumeTask&&ReceiveRemoteVideoPauseResumeTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(ReceiveRemoteVideoPauseResumeTask,"__esModule",{value:!0});const E=C(requireSignalingClientEventType()),w=requireSignalingProtocol(),T=C(requireBaseTask());class _ extends T.default{constructor(R){super(R.logger),this.context=R,this.taskName="ReceiveRemoteVideoPauseResume",this.serverPausedVideoTileIds=new Set}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return x(this,void 0,void 0,function*(){this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}updateSubscribedGroupdIds(R){const A=new Set;for(const O of R){const H=this.context.videoStreamIndex.attendeeIdForGroupId(O);if(H.length===0){this.logger.warn(`Could not find attendee ID for newly subscribed group ID ${O}`);continue}let ee=this.context.videoTileController.getVideoTileForAttendeeId(H);ee===void 0&&(this.logger.info(`No existing video tile for attendee ID ${H} with new group ID ${O}. Creating new one.`),ee=this.context.videoTileController.addVideoTile(),ee.bindVideoStream(H,!1,null,0,0,0,null)),A.add(ee.id())}this.serverPausedVideoTileIds.forEach(O=>{A.has(O)||this.serverPausedVideoTileIds.delete(O)})}handleSignalingClientEvent(R){if(R.type!==E.default.ReceivedSignalFrame||R.message.type!==w.SdkSignalFrame.Type.PAUSE&&R.message.type!==w.SdkSignalFrame.Type.RESUME)return;const A=R.message.pause,O=R.message.type;if(this.logger.info(`Received new ${O===w.SdkSignalFrame.Type.PAUSE?"pause":"resume"} frame: ${JSON.stringify(A)}`),!A||this.context.videoTileController.getVideoTileForAttendeeId===void 0||this.context.videoDownlinkBandwidthPolicy.forEachObserver===void 0||this.context.videoStreamIndex.attendeeIdForGroupId===void 0)return;const H=A.groupIds.map(ee=>{const te=this.context.videoStreamIndex.attendeeIdForGroupId(ee);if(te.length===0){this.logger.warn(`Could not find attendee ID for paused group ID ${ee}`);return}return this.context.videoTileController.getVideoTileForAttendeeId(te)});for(const ee of H)ee!==void 0&&(O===w.SdkSignalFrame.Type.PAUSE?ee.state().paused||(this.serverPausedVideoTileIds.add(ee.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(te=>{te.tileWillBePausedByDownlinkPolicy(ee.id())}),ee.pause()):ee.state().paused&&this.serverPausedVideoTileIds.has(ee.id())&&(this.serverPausedVideoTileIds.delete(ee.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(te=>{te.tileWillBeUnpausedByDownlinkPolicy(ee.id())}),ee.unpause()))}}return ReceiveRemoteVideoPauseResumeTask.default=_,ReceiveRemoteVideoPauseResumeTask}var ReceiveVideoInputTask={},hasRequiredReceiveVideoInputTask;function requireReceiveVideoInputTask(){if(hasRequiredReceiveVideoInputTask)return ReceiveVideoInputTask;hasRequiredReceiveVideoInputTask=1;var x=ReceiveVideoInputTask&&ReceiveVideoInputTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=ReceiveVideoInputTask&&ReceiveVideoInputTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(ReceiveVideoInputTask,"__esModule",{value:!0});const E=C(requireDefaultModality()),w=requireSignalingProtocol(),T=C(requireBaseTask());let _=class extends T.default{constructor(S){super(S.logger),this.context=S,this.taskName="ReceiveVideoInputTask"}checkAndApplyVideoConstraint(S,R,A,O,H){return x(this,void 0,void 0,function*(){const ee=S?this.context.meetingSessionConfiguration.meetingFeatures.contentMaxResolution:this.context.meetingSessionConfiguration.meetingFeatures.videoMaxResolution;if(!S&&A<=ee.videoWidth&&O<=ee.videoHeight&&H<=ee.videoFrameRate)return;const te={resizeMode:{ideal:"none"},width:{max:ee.videoWidth},height:{max:ee.videoHeight},frameRate:{ideal:H,max:ee.videoFrameRate}};try{yield R.applyConstraints(te)}catch{this.context.logger.info(`Could not apply constraint for video track (content = ${S})`)}})}run(){return x(this,void 0,void 0,function*(){const S=this.context.videoDuplexMode===w.SdkStreamServiceType.RX||this.context.videoDuplexMode===w.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=S?w.SdkStreamServiceType.DUPLEX:w.SdkStreamServiceType.TX:this.context.videoDuplexMode=S?w.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile()){this.context.logger.info("has not started local video tile"),this.context.activeVideoInput&&(this.context.activeVideoInput=void 0,this.context.videoStreamIndex.integrateUplinkPolicyDecision([]));return}const R=this.context.videoTileController.getLocalVideoTile();let A;try{A=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch{this.context.logger.warn("could not acquire video input from current device"),this.context.videoTileController.stopLocalVideoTile()}if(this.context.enableSimulcast){const O=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(O.values()))}if(this.context.activeVideoInput=A,A){const O=A.getVideoTracks();if(!O||O.length===0)return;const H=this.context.meetingSessionConfiguration.credentials.attendeeId,ee=new E.default(H).hasModality(E.default.MODALITY_CONTENT),te=O[0].getSettings();this.checkAndApplyVideoConstraint(ee,O[0],te.width,te.height,te.frameRate);const ie=this.context.audioVideoController.configuration.credentials.externalUserId;R.bindVideoStream(H,!0,A,te.width,te.height,null,ie);for(const ne of O)this.logger.info(`Using video device label=${ne.label} id=${ne.id}`),this.context.videoDeviceInformation.current_camera_name=ne.label,this.context.videoDeviceInformation.current_camera_id=ne.id}})}};return ReceiveVideoInputTask.default=_,ReceiveVideoInputTask}var ReceiveVideoStreamIndexTask={},hasRequiredReceiveVideoStreamIndexTask;function requireReceiveVideoStreamIndexTask(){if(hasRequiredReceiveVideoStreamIndexTask)return ReceiveVideoStreamIndexTask;hasRequiredReceiveVideoStreamIndexTask=1;var x=ReceiveVideoStreamIndexTask&&ReceiveVideoStreamIndexTask.__awaiter||function(H,ee,te,ie){function ne(ae){return ae instanceof te?ae:new te(function(oe){oe(ae)})}return new(te||(te=Promise))(function(ae,oe){function le(ce){try{de(ie.next(ce))}catch(pe){oe(pe)}}function fe(ce){try{de(ie.throw(ce))}catch(pe){oe(pe)}}function de(ce){ce.done?ae(ce.value):ne(ce.value).then(le,fe)}de((ie=ie.apply(H,ee||[])).next())})},C=ReceiveVideoStreamIndexTask&&ReceiveVideoStreamIndexTask.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(ReceiveVideoStreamIndexTask,"__esModule",{value:!0});const E=C(requireMeetingSessionVideoAvailability()),w=C(requireDefaultModality()),T=C(requireVideoCodecCapability()),_=C(requireSignalingClientEventType()),S=requireSignalingProtocol(),R=requireTypes$1(),A=C(requireBaseTask());let O=class extends A.default{constructor(H){super(H.logger),this.context=H,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return x(this,void 0,void 0,function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}handleSignalingClientEvent(H){if(H.type!==_.default.ReceivedSignalFrame||H.message.type!==S.SdkSignalFrame.Type.INDEX)return;const ee=H.message.index;this.context.logger.info(`received new index ${JSON.stringify(ee)}`),this.handleIndexFrame(ee)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(H){if(!H)return;if(this.isIngestionPaused){this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),this.pendingIndex=H;return}else this.pendingIndex=null;const ee=this.context.audioVideoController.configuration.credentials.attendeeId;H.sources=H.sources.filter(le=>{const fe=new w.default(le.attendeeId);return!(fe.base()===ee&&fe.hasModality(w.default.MODALITY_CONTENT))});const{videoStreamIndex:te,videoDownlinkBandwidthPolicy:ie,videoUplinkBandwidthPolicy:ne}=this.context,ae=te.allVideoSendingSourcesExcludingSelf(ee);te.integrateIndexFrame(H),ie.updateIndex(te),ne.updateIndex(te),this.resubscribe(ie,ne),this.updateVideoAvailability(H),this.handleIndexVideosPausedAtSource(),H.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(H);const oe=te.allVideoSendingSourcesExcludingSelf(ee);this.areVideoSourcesEqual(ae,oe)||this.context.audioVideoController.forEachObserver(le=>{R.Maybe.of(le.remoteVideoSourcesDidChange).map(fe=>fe.bind(le)(oe))})}areVideoSourcesEqual(H,ee){if(H.length!==ee.length)return!1;const te=(ae,oe)=>ae.attendee.attendeeId.localeCompare(oe.attendee.attendeeId),ie=[...H].sort(te),ne=[...ee].sort(te);for(let ae=0;ae<ie.length;ae++)if(ie[ae].attendee.attendeeId!==ne[ae].attendee.attendeeId)return!1;return!0}resubscribe(H,ee){const te=H.wantsResubscribe(),ie=(this.context.videoDuplexMode===S.SdkStreamServiceType.TX||this.context.videoDuplexMode===S.SdkStreamServiceType.DUPLEX)&&ee.wantsResubscribe(),ne=te||ie;if(this.logger.info(`should resubscribe: ${ne} (downlink: ${te} uplink: ${ie})`),!ne)return;const ae=H.chooseSubscriptions();this.context.videosToReceive=ae.truncate(this.context.videoSubscriptionLimit),ae.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=ee.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${ie} down=${te}; videosToReceive=[${this.context.videosToReceive.array()}] captureParams=${JSON.stringify(this.context.videoCaptureAndEncodeParameter)}`),this.context.audioVideoController.update({needsRenegotiation:!1})}updateVideoAvailability(H){if(!this.context.videosToReceive){this.logger.error("videosToReceive must be set in the meeting context.");return}const ee=new E.default;ee.remoteVideoAvailable=!this.context.videosToReceive.empty(),ee.canStartLocalVideo=!H.atCapacity,(!this.context.lastKnownVideoAvailability||!this.context.lastKnownVideoAvailability.equal(ee))&&(this.context.lastKnownVideoAvailability=ee.clone(),this.context.audioVideoController.forEachObserver(te=>{R.Maybe.of(te.videoAvailabilityDidChange).map(ie=>ie.bind(te)(ee.clone()))}))}handleSupportedVideoReceiveCodecIntersection(H){if(this.context.videoSendCodecPreferences===void 0)return;const ee=[];let te=!1;for(const ie of this.context.videoSendCodecPreferences){if(this.context.degradedVideoSendCodecs.some(ne=>ie.equals(ne))){this.logger.info(`Skipping ${ie.codecName} since the codec has been identfied as degraded`);continue}for(const ne of H.supportedReceiveCodecIntersection)if(ie.equals(T.default.fromSignaled(ne))){ee.push(ie);break}}if(ee.length>0){const ie=ee.find(ne=>this.context.prioritizedSendVideoCodecCapabilities.some(ae=>ne.equals(ae)));this.context.currentVideoSendCodec!==void 0&&(ie===void 0||!this.context.currentVideoSendCodec.equals(ie))&&(te=!0),this.context.meetingSupportedVideoSendCodecPreferences=ee}else this.logger.warn("Interesection of meeting receive codec support and send codec preferences has no overlap, falling back to just values provided in `setVideoCodecSendPreferences`"),this.context.meetingSupportedVideoSendCodecPreferences=void 0;this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),te&&this.context.audioVideoController.update({needsRenegotiation:!0})}handleIndexVideosPausedAtSource(){const H=this.context.videoStreamIndex.streamsPausedAtSource();for(const ee of this.context.videoTileController.getAllVideoTiles()){const te=ee.state();H.contain(te.streamId)?ee.markPoorConnection()&&this.logger.info(`marks the tile ${te.tileId} as having a poor connection`):ee.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${te.tileId} as having a poor connection`)}}};return ReceiveVideoStreamIndexTask.default=O,ReceiveVideoStreamIndexTask}var SendAndReceiveDataMessagesTask={},hasRequiredSendAndReceiveDataMessagesTask;function requireSendAndReceiveDataMessagesTask(){if(hasRequiredSendAndReceiveDataMessagesTask)return SendAndReceiveDataMessagesTask;hasRequiredSendAndReceiveDataMessagesTask=1;var x=SendAndReceiveDataMessagesTask&&SendAndReceiveDataMessagesTask.__awaiter||function(R,A,O,H){function ee(te){return te instanceof O?te:new O(function(ie){ie(te)})}return new(O||(O=Promise))(function(te,ie){function ne(le){try{oe(H.next(le))}catch(fe){ie(fe)}}function ae(le){try{oe(H.throw(le))}catch(fe){ie(fe)}}function oe(le){le.done?te(le.value):ee(le.value).then(ne,ae)}oe((H=H.apply(R,A||[])).next())})},C=SendAndReceiveDataMessagesTask&&SendAndReceiveDataMessagesTask.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(SendAndReceiveDataMessagesTask,"__esModule",{value:!0});const E=C(requireDataMessage()),w=C(requireSignalingClientEventType()),T=requireSignalingProtocol(),_=C(requireBaseTask());let S=class $d extends _.default{constructor(A){super(A.logger),this.context=A,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(O,H,ee)=>{if(this.context.signalingClient.ready()){let te;H instanceof Uint8Array?te=H:typeof H=="string"?te=new TextEncoder().encode(H):te=new TextEncoder().encode(JSON.stringify(H)),this.validateDataMessage(O,te,ee);const ie=T.SdkDataMessagePayload.create();ie.topic=O,ie.lifetimeMs=ee,ie.data=te;const ne=T.SdkDataMessageFrame.create();ne.messages=[ie],this.context.signalingClient.sendDataMessage(ne)}else this.context.logger.error("Cannot send data message because signaling client is not ready")}}run(){return x(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(A){if(A.type===w.default.ReceivedSignalFrame&&A.message.type===T.SdkSignalFrame.Type.DATA_MESSAGE)for(const O of A.message.dataMessage.messages){const H=new E.default(O.ingestTimeNs/1e6,O.topic,O.data,O.senderAttendeeId,O.senderExternalUserId,O.ingestTimeNs===0);this.context.realtimeController.realtimeReceiveDataMessage(H)}}validateDataMessage(A,O,H){if(!$d.TOPIC_REGEX.test(A))throw new Error("Invalid topic");if(O.length>$d.DATA_SIZE)throw new Error("Data size has to be less than 2048 bytes");if(H&&H<0)throw new Error("The life time of the message has to be non negative")}};return SendAndReceiveDataMessagesTask.default=S,S.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),S.DATA_SIZE=2048,SendAndReceiveDataMessagesTask}var SerialGroupTask={},hasRequiredSerialGroupTask;function requireSerialGroupTask(){if(hasRequiredSerialGroupTask)return SerialGroupTask;hasRequiredSerialGroupTask=1;var x=SerialGroupTask&&SerialGroupTask.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=SerialGroupTask&&SerialGroupTask.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(SerialGroupTask,"__esModule",{value:!0});const E=C(requireBaseTask()),w=C(requireTaskStatus());let T=class extends E.default{constructor(_,S,R){super(_),this.taskName=S,this.tasksToRunSerially=R,this.currentTask=null;for(const A of R)A.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return x(this,void 0,void 0,function*(){for(const _ of this.tasksToRunSerially){this.getStatus()===w.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${_.name()}`),this.currentTask=_,yield _.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${_.name()}`)}catch(S){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${S.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)})}};return SerialGroupTask.default=T,SerialGroupTask}var SetLocalDescriptionTask={},hasRequiredSetLocalDescriptionTask;function requireSetLocalDescriptionTask(){if(hasRequiredSetLocalDescriptionTask)return SetLocalDescriptionTask;hasRequiredSetLocalDescriptionTask=1;var x=SetLocalDescriptionTask&&SetLocalDescriptionTask.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=SetLocalDescriptionTask&&SetLocalDescriptionTask.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(SetLocalDescriptionTask,"__esModule",{value:!0});const E=C(requireDefaultBrowserBehavior()),w=C(requireSDP()),T=C(requireBaseTask());let _=class extends T.default{constructor(S){super(S.logger),this.context=S,this.taskName="SetLocalDescriptionTask"}cancel(){if(this.cancelPromise){const S=new Error(`canceling ${this.name()}`);this.cancelPromise(S),delete this.cancelPromise}}run(){return x(this,void 0,void 0,function*(){const S=this.context.peer;let R=this.context.sdpOfferInit.sdp;if(this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(R=new w.default(R).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),this.context.browserBehavior.supportsDependencyDescriptorRtpHeaderExtension()&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension!==void 0&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()&&(R=new w.default(R).withDependencyDescriptorRtpHeaderExtension(this.context.previousSdpOffer).sdp),new E.default().requiresDisablingH264Encoding()&&(R=new w.default(R).removeH264SupportFromSendSection().sdp),R=new w.default(R).withStartingVideoSendBitrate(1e3).sdp,this.context.videoSendCodecPreferences!==void 0&&this.context.videoSendCodecPreferences.length>0&&(R=new w.default(R).withVideoSendCodecPreferences(this.context.meetingSupportedVideoSendCodecPreferences!==void 0?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(R=new w.default(R).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(R=new w.default(R).withStereoAudio().sdp),this.context.audioProfile.hasRedundancyEnabled())){const O=new w.default(R).getAudioPayloadTypes();this.context.transceiverController&&this.context.transceiverController.setAudioPayloadTypes&&this.context.transceiverController.setAudioPayloadTypes(O)}this.logger.debug(()=>`local description is >>>${R}<<<`);const A={type:"offer",sdp:R,toJSON:null};yield new Promise((O,H)=>x(this,void 0,void 0,function*(){this.cancelPromise=ee=>{H(ee)};try{yield S.setLocalDescription(A),O()}catch(ee){H(ee)}finally{delete this.cancelPromise}})),this.context.logger.info("set local description")})}};return SetLocalDescriptionTask.default=_,SetLocalDescriptionTask}var SetRemoteDescriptionTask={},hasRequiredSetRemoteDescriptionTask;function requireSetRemoteDescriptionTask(){if(hasRequiredSetRemoteDescriptionTask)return SetRemoteDescriptionTask;hasRequiredSetRemoteDescriptionTask=1;var x=SetRemoteDescriptionTask&&SetRemoteDescriptionTask.__awaiter||function(R,A,O,H){function ee(te){return te instanceof O?te:new O(function(ie){ie(te)})}return new(O||(O=Promise))(function(te,ie){function ne(le){try{oe(H.next(le))}catch(fe){ie(fe)}}function ae(le){try{oe(H.throw(le))}catch(fe){ie(fe)}}function oe(le){le.done?te(le.value):ee(le.value).then(ne,ae)}oe((H=H.apply(R,A||[])).next())})},C=SetRemoteDescriptionTask&&SetRemoteDescriptionTask.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(SetRemoteDescriptionTask,"__esModule",{value:!0});const E=C(requireDefaultModality()),w=C(requireSDP()),T=C(requireVideoCodecCapability()),_=C(requireBaseTask());let S=class extends _.default{constructor(R){super(R.logger),this.context=R,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){var R;return x(this,void 0,void 0,function*(){this.context.peer||this.logAndThrow("session does not have peer connection; bypass set remote description");let A=this.context.sdpAnswer;A=new w.default(A).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(A=new w.default(A).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(A=new w.default(A).withStereoAudio().sdp)),this.context.videoSendCodecPreferences!==void 0&&this.context.videoSendCodecPreferences.length>0&&(A=new w.default(A).withVideoSendCodecPreferences(this.context.meetingSupportedVideoSendCodecPreferences!==void 0?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.prioritizedSendVideoCodecCapabilities=new w.default(A).prioritizedSendVideoCodecCapabilities(),this.context.currentVideoSendCodec=this.context.prioritizedSendVideoCodecCapabilities.length>0?this.context.prioritizedSendVideoCodecCapabilities[0]:void 0;const O=this.context.activeVideoInput;if(O!==void 0){const ee=this.context.audioVideoController.configuration.credentials.attendeeId,te=new E.default(ee).hasModality(E.default.MODALITY_CONTENT),ie=O.getVideoTracks()[0];te&&(((R=this.context.currentVideoSendCodec)===null||R===void 0?void 0:R.codecName)===T.default.av1Main().codecName?(ie.contentHint="text",this.logger.info(`Setting content hint to text for AV1, attendee: ${ee}`)):this.context.audioVideoController.configuration.enableSVC&&(ie.contentHint="motion",this.logger.info(`Setting content hint to motion to enable SVC, attendee: ${ee}`)))}this.logger.info(`processed remote description is >>>${A}<<<`);const H={type:"answer",sdp:A,toJSON:null};try{yield this.createICEConnectionCompletedPromise(H)}catch(ee){throw ee}})}createICEConnectionCompletedPromise(R){return new Promise((A,O)=>x(this,void 0,void 0,function*(){const H=()=>{(this.context.peer.iceConnectionState==="connected"||this.context.peer.iceConnectionState==="completed")&&(this.context.peer.removeEventListener("iceconnectionstatechange",H),A())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",H),O(new Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",H);try{yield this.context.peer.setRemoteDescription(R),this.logger.info("set remote description, waiting for ICE connection"),H()}catch(ee){O(ee)}}))}};return SetRemoteDescriptionTask.default=S,SetRemoteDescriptionTask}var SubscribeAndReceiveSubscribeAckTask={},ZLIBTextCompressor={},pako={},deflate$1={},deflate={},trees={},hasRequiredTrees;function requireTrees(){if(hasRequiredTrees)return trees;hasRequiredTrees=1;const x=4,C=0,E=1,w=2;function T(ke){let Be=ke.length;for(;--Be>=0;)ke[Be]=0}const _=0,S=1,R=2,A=3,O=258,H=29,ee=256,te=ee+1+H,ie=30,ne=19,ae=2*te+1,oe=15,le=16,fe=7,de=256,ce=16,pe=17,he=18,me=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ve=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ye=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Se=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ce=512,be=new Array((te+2)*2);T(be);const Ee=new Array(ie*2);T(Ee);const Ae=new Array(Ce);T(Ae);const Ie=new Array(O-A+1);T(Ie);const Te=new Array(H);T(Te);const De=new Array(ie);T(De);function Ue(ke,Be,et,Ze,Qe){this.static_tree=ke,this.extra_bits=Be,this.extra_base=et,this.elems=Ze,this.max_length=Qe,this.has_stree=ke&&ke.length}let ze,Pe,$e;function He(ke,Be){this.dyn_tree=ke,this.max_code=0,this.stat_desc=Be}const je=ke=>ke<256?Ae[ke]:Ae[256+(ke>>>7)],Ne=(ke,Be)=>{ke.pending_buf[ke.pending++]=Be&255,ke.pending_buf[ke.pending++]=Be>>>8&255},Oe=(ke,Be,et)=>{ke.bi_valid>le-et?(ke.bi_buf|=Be<<ke.bi_valid&65535,Ne(ke,ke.bi_buf),ke.bi_buf=Be>>le-ke.bi_valid,ke.bi_valid+=et-le):(ke.bi_buf|=Be<<ke.bi_valid&65535,ke.bi_valid+=et)},Ve=(ke,Be,et)=>{Oe(ke,et[Be*2],et[Be*2+1])},Ht=(ke,Be)=>{let et=0;do et|=ke&1,ke>>>=1,et<<=1;while(--Be>0);return et>>>1},Kt=ke=>{ke.bi_valid===16?(Ne(ke,ke.bi_buf),ke.bi_buf=0,ke.bi_valid=0):ke.bi_valid>=8&&(ke.pending_buf[ke.pending++]=ke.bi_buf&255,ke.bi_buf>>=8,ke.bi_valid-=8)},ir=(ke,Be)=>{const et=Be.dyn_tree,Ze=Be.max_code,Qe=Be.stat_desc.static_tree,Ke=Be.stat_desc.has_stree,Je=Be.stat_desc.extra_bits,Re=Be.stat_desc.extra_base,Bt=Be.stat_desc.max_length;let Fe,Ge,nr,jt,vr,it,dt=0;for(jt=0;jt<=oe;jt++)ke.bl_count[jt]=0;for(et[ke.heap[ke.heap_max]*2+1]=0,Fe=ke.heap_max+1;Fe<ae;Fe++)Ge=ke.heap[Fe],jt=et[et[Ge*2+1]*2+1]+1,jt>Bt&&(jt=Bt,dt++),et[Ge*2+1]=jt,!(Ge>Ze)&&(ke.bl_count[jt]++,vr=0,Ge>=Re&&(vr=Je[Ge-Re]),it=et[Ge*2],ke.opt_len+=it*(jt+vr),Ke&&(ke.static_len+=it*(Qe[Ge*2+1]+vr)));if(dt!==0){do{for(jt=Bt-1;ke.bl_count[jt]===0;)jt--;ke.bl_count[jt]--,ke.bl_count[jt+1]+=2,ke.bl_count[Bt]--,dt-=2}while(dt>0);for(jt=Bt;jt!==0;jt--)for(Ge=ke.bl_count[jt];Ge!==0;)nr=ke.heap[--Fe],!(nr>Ze)&&(et[nr*2+1]!==jt&&(ke.opt_len+=(jt-et[nr*2+1])*et[nr*2],et[nr*2+1]=jt),Ge--)}},$t=(ke,Be,et)=>{const Ze=new Array(oe+1);let Qe=0,Ke,Je;for(Ke=1;Ke<=oe;Ke++)Qe=Qe+et[Ke-1]<<1,Ze[Ke]=Qe;for(Je=0;Je<=Be;Je++){let Re=ke[Je*2+1];Re!==0&&(ke[Je*2]=Ht(Ze[Re]++,Re))}},tr=()=>{let ke,Be,et,Ze,Qe;const Ke=new Array(oe+1);for(et=0,Ze=0;Ze<H-1;Ze++)for(Te[Ze]=et,ke=0;ke<1<<me[Ze];ke++)Ie[et++]=Ze;for(Ie[et-1]=Ze,Qe=0,Ze=0;Ze<16;Ze++)for(De[Ze]=Qe,ke=0;ke<1<<ve[Ze];ke++)Ae[Qe++]=Ze;for(Qe>>=7;Ze<ie;Ze++)for(De[Ze]=Qe<<7,ke=0;ke<1<<ve[Ze]-7;ke++)Ae[256+Qe++]=Ze;for(Be=0;Be<=oe;Be++)Ke[Be]=0;for(ke=0;ke<=143;)be[ke*2+1]=8,ke++,Ke[8]++;for(;ke<=255;)be[ke*2+1]=9,ke++,Ke[9]++;for(;ke<=279;)be[ke*2+1]=7,ke++,Ke[7]++;for(;ke<=287;)be[ke*2+1]=8,ke++,Ke[8]++;for($t(be,te+1,Ke),ke=0;ke<ie;ke++)Ee[ke*2+1]=5,Ee[ke*2]=Ht(ke,5);ze=new Ue(be,me,ee+1,te,oe),Pe=new Ue(Ee,ve,0,ie,oe),$e=new Ue(new Array(0),ye,0,ne,fe)},ar=ke=>{let Be;for(Be=0;Be<te;Be++)ke.dyn_ltree[Be*2]=0;for(Be=0;Be<ie;Be++)ke.dyn_dtree[Be*2]=0;for(Be=0;Be<ne;Be++)ke.bl_tree[Be*2]=0;ke.dyn_ltree[de*2]=1,ke.opt_len=ke.static_len=0,ke.sym_next=ke.matches=0},gr=ke=>{ke.bi_valid>8?Ne(ke,ke.bi_buf):ke.bi_valid>0&&(ke.pending_buf[ke.pending++]=ke.bi_buf),ke.bi_buf=0,ke.bi_valid=0},er=(ke,Be,et,Ze)=>{const Qe=Be*2,Ke=et*2;return ke[Qe]<ke[Ke]||ke[Qe]===ke[Ke]&&Ze[Be]<=Ze[et]},sr=(ke,Be,et)=>{const Ze=ke.heap[et];let Qe=et<<1;for(;Qe<=ke.heap_len&&(Qe<ke.heap_len&&er(Be,ke.heap[Qe+1],ke.heap[Qe],ke.depth)&&Qe++,!er(Be,Ze,ke.heap[Qe],ke.depth));)ke.heap[et]=ke.heap[Qe],et=Qe,Qe<<=1;ke.heap[et]=Ze},pr=(ke,Be,et)=>{let Ze,Qe,Ke=0,Je,Re;if(ke.sym_next!==0)do Ze=ke.pending_buf[ke.sym_buf+Ke++]&255,Ze+=(ke.pending_buf[ke.sym_buf+Ke++]&255)<<8,Qe=ke.pending_buf[ke.sym_buf+Ke++],Ze===0?Ve(ke,Qe,Be):(Je=Ie[Qe],Ve(ke,Je+ee+1,Be),Re=me[Je],Re!==0&&(Qe-=Te[Je],Oe(ke,Qe,Re)),Ze--,Je=je(Ze),Ve(ke,Je,et),Re=ve[Je],Re!==0&&(Ze-=De[Je],Oe(ke,Ze,Re)));while(Ke<ke.sym_next);Ve(ke,de,Be)},ur=(ke,Be)=>{const et=Be.dyn_tree,Ze=Be.stat_desc.static_tree,Qe=Be.stat_desc.has_stree,Ke=Be.stat_desc.elems;let Je,Re,Bt=-1,Fe;for(ke.heap_len=0,ke.heap_max=ae,Je=0;Je<Ke;Je++)et[Je*2]!==0?(ke.heap[++ke.heap_len]=Bt=Je,ke.depth[Je]=0):et[Je*2+1]=0;for(;ke.heap_len<2;)Fe=ke.heap[++ke.heap_len]=Bt<2?++Bt:0,et[Fe*2]=1,ke.depth[Fe]=0,ke.opt_len--,Qe&&(ke.static_len-=Ze[Fe*2+1]);for(Be.max_code=Bt,Je=ke.heap_len>>1;Je>=1;Je--)sr(ke,et,Je);Fe=Ke;do Je=ke.heap[1],ke.heap[1]=ke.heap[ke.heap_len--],sr(ke,et,1),Re=ke.heap[1],ke.heap[--ke.heap_max]=Je,ke.heap[--ke.heap_max]=Re,et[Fe*2]=et[Je*2]+et[Re*2],ke.depth[Fe]=(ke.depth[Je]>=ke.depth[Re]?ke.depth[Je]:ke.depth[Re])+1,et[Je*2+1]=et[Re*2+1]=Fe,ke.heap[1]=Fe++,sr(ke,et,1);while(ke.heap_len>=2);ke.heap[--ke.heap_max]=ke.heap[1],ir(ke,Be),$t(et,Bt,ke.bl_count)},Sr=(ke,Be,et)=>{let Ze,Qe=-1,Ke,Je=Be[0*2+1],Re=0,Bt=7,Fe=4;for(Je===0&&(Bt=138,Fe=3),Be[(et+1)*2+1]=65535,Ze=0;Ze<=et;Ze++)Ke=Je,Je=Be[(Ze+1)*2+1],!(++Re<Bt&&Ke===Je)&&(Re<Fe?ke.bl_tree[Ke*2]+=Re:Ke!==0?(Ke!==Qe&&ke.bl_tree[Ke*2]++,ke.bl_tree[ce*2]++):Re<=10?ke.bl_tree[pe*2]++:ke.bl_tree[he*2]++,Re=0,Qe=Ke,Je===0?(Bt=138,Fe=3):Ke===Je?(Bt=6,Fe=3):(Bt=7,Fe=4))},hr=(ke,Be,et)=>{let Ze,Qe=-1,Ke,Je=Be[0*2+1],Re=0,Bt=7,Fe=4;for(Je===0&&(Bt=138,Fe=3),Ze=0;Ze<=et;Ze++)if(Ke=Je,Je=Be[(Ze+1)*2+1],!(++Re<Bt&&Ke===Je)){if(Re<Fe)do Ve(ke,Ke,ke.bl_tree);while(--Re!==0);else Ke!==0?(Ke!==Qe&&(Ve(ke,Ke,ke.bl_tree),Re--),Ve(ke,ce,ke.bl_tree),Oe(ke,Re-3,2)):Re<=10?(Ve(ke,pe,ke.bl_tree),Oe(ke,Re-3,3)):(Ve(ke,he,ke.bl_tree),Oe(ke,Re-11,7));Re=0,Qe=Ke,Je===0?(Bt=138,Fe=3):Ke===Je?(Bt=6,Fe=3):(Bt=7,Fe=4)}},yr=ke=>{let Be;for(Sr(ke,ke.dyn_ltree,ke.l_desc.max_code),Sr(ke,ke.dyn_dtree,ke.d_desc.max_code),ur(ke,ke.bl_desc),Be=ne-1;Be>=3&&ke.bl_tree[Se[Be]*2+1]===0;Be--);return ke.opt_len+=3*(Be+1)+5+5+4,Be},xr=(ke,Be,et,Ze)=>{let Qe;for(Oe(ke,Be-257,5),Oe(ke,et-1,5),Oe(ke,Ze-4,4),Qe=0;Qe<Ze;Qe++)Oe(ke,ke.bl_tree[Se[Qe]*2+1],3);hr(ke,ke.dyn_ltree,Be-1),hr(ke,ke.dyn_dtree,et-1)},Yt=ke=>{let Be=4093624447,et;for(et=0;et<=31;et++,Be>>>=1)if(Be&1&&ke.dyn_ltree[et*2]!==0)return C;if(ke.dyn_ltree[9*2]!==0||ke.dyn_ltree[10*2]!==0||ke.dyn_ltree[13*2]!==0)return E;for(et=32;et<ee;et++)if(ke.dyn_ltree[et*2]!==0)return E;return C};let Jt=!1;const mr=ke=>{Jt||(tr(),Jt=!0),ke.l_desc=new He(ke.dyn_ltree,ze),ke.d_desc=new He(ke.dyn_dtree,Pe),ke.bl_desc=new He(ke.bl_tree,$e),ke.bi_buf=0,ke.bi_valid=0,ar(ke)},Cr=(ke,Be,et,Ze)=>{Oe(ke,(_<<1)+(Ze?1:0),3),gr(ke),Ne(ke,et),Ne(ke,~et),et&&ke.pending_buf.set(ke.window.subarray(Be,Be+et),ke.pending),ke.pending+=et},zt=ke=>{Oe(ke,S<<1,3),Ve(ke,de,be),Kt(ke)},Ft=(ke,Be,et,Ze)=>{let Qe,Ke,Je=0;ke.level>0?(ke.strm.data_type===w&&(ke.strm.data_type=Yt(ke)),ur(ke,ke.l_desc),ur(ke,ke.d_desc),Je=yr(ke),Qe=ke.opt_len+3+7>>>3,Ke=ke.static_len+3+7>>>3,Ke<=Qe&&(Qe=Ke)):Qe=Ke=et+5,et+4<=Qe&&Be!==-1?Cr(ke,Be,et,Ze):ke.strategy===x||Ke===Qe?(Oe(ke,(S<<1)+(Ze?1:0),3),pr(ke,be,Ee)):(Oe(ke,(R<<1)+(Ze?1:0),3),xr(ke,ke.l_desc.max_code+1,ke.d_desc.max_code+1,Je+1),pr(ke,ke.dyn_ltree,ke.dyn_dtree)),ar(ke),Ze&&gr(ke)},kt=(ke,Be,et)=>(ke.pending_buf[ke.sym_buf+ke.sym_next++]=Be,ke.pending_buf[ke.sym_buf+ke.sym_next++]=Be>>8,ke.pending_buf[ke.sym_buf+ke.sym_next++]=et,Be===0?ke.dyn_ltree[et*2]++:(ke.matches++,Be--,ke.dyn_ltree[(Ie[et]+ee+1)*2]++,ke.dyn_dtree[je(Be)*2]++),ke.sym_next===ke.sym_end);return trees._tr_init=mr,trees._tr_stored_block=Cr,trees._tr_flush_block=Ft,trees._tr_tally=kt,trees._tr_align=zt,trees}var adler32_1,hasRequiredAdler32;function requireAdler32(){return hasRequiredAdler32||(hasRequiredAdler32=1,adler32_1=(x,C,E,w)=>{let T=x&65535|0,_=x>>>16&65535|0,S=0;for(;E!==0;){S=E>2e3?2e3:E,E-=S;do T=T+C[w++]|0,_=_+T|0;while(--S);T%=65521,_%=65521}return T|_<<16|0}),adler32_1}var crc32_1,hasRequiredCrc32;function requireCrc32(){if(hasRequiredCrc32)return crc32_1;hasRequiredCrc32=1;const x=()=>{let E,w=[];for(var T=0;T<256;T++){E=T;for(var _=0;_<8;_++)E=E&1?3988292384^E>>>1:E>>>1;w[T]=E}return w},C=new Uint32Array(x());return crc32_1=(E,w,T,_)=>{const S=C,R=_+T;E^=-1;for(let A=_;A<R;A++)E=E>>>8^S[(E^w[A])&255];return E^-1},crc32_1}var messages,hasRequiredMessages;function requireMessages(){return hasRequiredMessages||(hasRequiredMessages=1,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}),messages}var constants$1,hasRequiredConstants$1;function requireConstants$1(){return hasRequiredConstants$1||(hasRequiredConstants$1=1,constants$1={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}),constants$1}var hasRequiredDeflate$1;function requireDeflate$1(){if(hasRequiredDeflate$1)return deflate;hasRequiredDeflate$1=1;const{_tr_init:x,_tr_stored_block:C,_tr_flush_block:E,_tr_tally:w,_tr_align:T}=requireTrees(),_=requireAdler32(),S=requireCrc32(),R=requireMessages(),{Z_NO_FLUSH:A,Z_PARTIAL_FLUSH:O,Z_FULL_FLUSH:H,Z_FINISH:ee,Z_BLOCK:te,Z_OK:ie,Z_STREAM_END:ne,Z_STREAM_ERROR:ae,Z_DATA_ERROR:oe,Z_BUF_ERROR:le,Z_DEFAULT_COMPRESSION:fe,Z_FILTERED:de,Z_HUFFMAN_ONLY:ce,Z_RLE:pe,Z_FIXED:he,Z_DEFAULT_STRATEGY:me,Z_UNKNOWN:ve,Z_DEFLATED:ye}=requireConstants$1(),Se=9,Ce=15,be=8,Ee=286,Ae=30,Ie=19,Te=2*Ee+1,De=15,Ue=3,ze=258,Pe=ze+Ue+1,$e=32,He=42,je=57,Ne=69,Oe=73,Ve=91,Ht=103,Kt=113,ir=666,$t=1,tr=2,ar=3,gr=4,er=3,sr=(xe,Xe)=>(xe.msg=R[Xe],Xe),pr=xe=>xe*2-(xe>4?9:0),ur=xe=>{let Xe=xe.length;for(;--Xe>=0;)xe[Xe]=0},Sr=xe=>{let Xe,_e,ct,Dt=xe.w_size;Xe=xe.hash_size,ct=Xe;do _e=xe.head[--ct],xe.head[ct]=_e>=Dt?_e-Dt:0;while(--Xe);Xe=Dt,ct=Xe;do _e=xe.prev[--ct],xe.prev[ct]=_e>=Dt?_e-Dt:0;while(--Xe)};let hr=(xe,Xe,_e)=>(Xe<<xe.hash_shift^_e)&xe.hash_mask;const yr=xe=>{const Xe=xe.state;let _e=Xe.pending;_e>xe.avail_out&&(_e=xe.avail_out),_e!==0&&(xe.output.set(Xe.pending_buf.subarray(Xe.pending_out,Xe.pending_out+_e),xe.next_out),xe.next_out+=_e,Xe.pending_out+=_e,xe.total_out+=_e,xe.avail_out-=_e,Xe.pending-=_e,Xe.pending===0&&(Xe.pending_out=0))},xr=(xe,Xe)=>{E(xe,xe.block_start>=0?xe.block_start:-1,xe.strstart-xe.block_start,Xe),xe.block_start=xe.strstart,yr(xe.strm)},Yt=(xe,Xe)=>{xe.pending_buf[xe.pending++]=Xe},Jt=(xe,Xe)=>{xe.pending_buf[xe.pending++]=Xe>>>8&255,xe.pending_buf[xe.pending++]=Xe&255},mr=(xe,Xe,_e,ct)=>{let Dt=xe.avail_in;return Dt>ct&&(Dt=ct),Dt===0?0:(xe.avail_in-=Dt,Xe.set(xe.input.subarray(xe.next_in,xe.next_in+Dt),_e),xe.state.wrap===1?xe.adler=_(xe.adler,Xe,Dt,_e):xe.state.wrap===2&&(xe.adler=S(xe.adler,Xe,Dt,_e)),xe.next_in+=Dt,xe.total_in+=Dt,Dt)},Cr=(xe,Xe)=>{let _e=xe.max_chain_length,ct=xe.strstart,Dt,cr,fr=xe.prev_length,dr=xe.nice_match;const jr=xe.strstart>xe.w_size-Pe?xe.strstart-(xe.w_size-Pe):0,Rr=xe.window,ki=xe.w_mask,_i=xe.prev,Fr=xe.strstart+ze;let Kr=Rr[ct+fr-1],Ur=Rr[ct+fr];xe.prev_length>=xe.good_match&&(_e>>=2),dr>xe.lookahead&&(dr=xe.lookahead);do if(Dt=Xe,!(Rr[Dt+fr]!==Ur||Rr[Dt+fr-1]!==Kr||Rr[Dt]!==Rr[ct]||Rr[++Dt]!==Rr[ct+1])){ct+=2,Dt++;do;while(Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&Rr[++ct]===Rr[++Dt]&&ct<Fr);if(cr=ze-(Fr-ct),ct=Fr-ze,cr>fr){if(xe.match_start=Xe,fr=cr,cr>=dr)break;Kr=Rr[ct+fr-1],Ur=Rr[ct+fr]}}while((Xe=_i[Xe&ki])>jr&&--_e!==0);return fr<=xe.lookahead?fr:xe.lookahead},zt=xe=>{const Xe=xe.w_size;let _e,ct,Dt;do{if(ct=xe.window_size-xe.lookahead-xe.strstart,xe.strstart>=Xe+(Xe-Pe)&&(xe.window.set(xe.window.subarray(Xe,Xe+Xe-ct),0),xe.match_start-=Xe,xe.strstart-=Xe,xe.block_start-=Xe,xe.insert>xe.strstart&&(xe.insert=xe.strstart),Sr(xe),ct+=Xe),xe.strm.avail_in===0)break;if(_e=mr(xe.strm,xe.window,xe.strstart+xe.lookahead,ct),xe.lookahead+=_e,xe.lookahead+xe.insert>=Ue)for(Dt=xe.strstart-xe.insert,xe.ins_h=xe.window[Dt],xe.ins_h=hr(xe,xe.ins_h,xe.window[Dt+1]);xe.insert&&(xe.ins_h=hr(xe,xe.ins_h,xe.window[Dt+Ue-1]),xe.prev[Dt&xe.w_mask]=xe.head[xe.ins_h],xe.head[xe.ins_h]=Dt,Dt++,xe.insert--,!(xe.lookahead+xe.insert<Ue)););}while(xe.lookahead<Pe&&xe.strm.avail_in!==0)},Ft=(xe,Xe)=>{let _e=xe.pending_buf_size-5>xe.w_size?xe.w_size:xe.pending_buf_size-5,ct,Dt,cr,fr=0,dr=xe.strm.avail_in;do{if(ct=65535,cr=xe.bi_valid+42>>3,xe.strm.avail_out<cr||(cr=xe.strm.avail_out-cr,Dt=xe.strstart-xe.block_start,ct>Dt+xe.strm.avail_in&&(ct=Dt+xe.strm.avail_in),ct>cr&&(ct=cr),ct<_e&&(ct===0&&Xe!==ee||Xe===A||ct!==Dt+xe.strm.avail_in)))break;fr=Xe===ee&&ct===Dt+xe.strm.avail_in?1:0,C(xe,0,0,fr),xe.pending_buf[xe.pending-4]=ct,xe.pending_buf[xe.pending-3]=ct>>8,xe.pending_buf[xe.pending-2]=~ct,xe.pending_buf[xe.pending-1]=~ct>>8,yr(xe.strm),Dt&&(Dt>ct&&(Dt=ct),xe.strm.output.set(xe.window.subarray(xe.block_start,xe.block_start+Dt),xe.strm.next_out),xe.strm.next_out+=Dt,xe.strm.avail_out-=Dt,xe.strm.total_out+=Dt,xe.block_start+=Dt,ct-=Dt),ct&&(mr(xe.strm,xe.strm.output,xe.strm.next_out,ct),xe.strm.next_out+=ct,xe.strm.avail_out-=ct,xe.strm.total_out+=ct)}while(fr===0);return dr-=xe.strm.avail_in,dr&&(dr>=xe.w_size?(xe.matches=2,xe.window.set(xe.strm.input.subarray(xe.strm.next_in-xe.w_size,xe.strm.next_in),0),xe.strstart=xe.w_size,xe.insert=xe.strstart):(xe.window_size-xe.strstart<=dr&&(xe.strstart-=xe.w_size,xe.window.set(xe.window.subarray(xe.w_size,xe.w_size+xe.strstart),0),xe.matches<2&&xe.matches++,xe.insert>xe.strstart&&(xe.insert=xe.strstart)),xe.window.set(xe.strm.input.subarray(xe.strm.next_in-dr,xe.strm.next_in),xe.strstart),xe.strstart+=dr,xe.insert+=dr>xe.w_size-xe.insert?xe.w_size-xe.insert:dr),xe.block_start=xe.strstart),xe.high_water<xe.strstart&&(xe.high_water=xe.strstart),fr?gr:Xe!==A&&Xe!==ee&&xe.strm.avail_in===0&&xe.strstart===xe.block_start?tr:(cr=xe.window_size-xe.strstart,xe.strm.avail_in>cr&&xe.block_start>=xe.w_size&&(xe.block_start-=xe.w_size,xe.strstart-=xe.w_size,xe.window.set(xe.window.subarray(xe.w_size,xe.w_size+xe.strstart),0),xe.matches<2&&xe.matches++,cr+=xe.w_size,xe.insert>xe.strstart&&(xe.insert=xe.strstart)),cr>xe.strm.avail_in&&(cr=xe.strm.avail_in),cr&&(mr(xe.strm,xe.window,xe.strstart,cr),xe.strstart+=cr,xe.insert+=cr>xe.w_size-xe.insert?xe.w_size-xe.insert:cr),xe.high_water<xe.strstart&&(xe.high_water=xe.strstart),cr=xe.bi_valid+42>>3,cr=xe.pending_buf_size-cr>65535?65535:xe.pending_buf_size-cr,_e=cr>xe.w_size?xe.w_size:cr,Dt=xe.strstart-xe.block_start,(Dt>=_e||(Dt||Xe===ee)&&Xe!==A&&xe.strm.avail_in===0&&Dt<=cr)&&(ct=Dt>cr?cr:Dt,fr=Xe===ee&&xe.strm.avail_in===0&&ct===Dt?1:0,C(xe,xe.block_start,ct,fr),xe.block_start+=ct,yr(xe.strm)),fr?ar:$t)},kt=(xe,Xe)=>{let _e,ct;for(;;){if(xe.lookahead<Pe){if(zt(xe),xe.lookahead<Pe&&Xe===A)return $t;if(xe.lookahead===0)break}if(_e=0,xe.lookahead>=Ue&&(xe.ins_h=hr(xe,xe.ins_h,xe.window[xe.strstart+Ue-1]),_e=xe.prev[xe.strstart&xe.w_mask]=xe.head[xe.ins_h],xe.head[xe.ins_h]=xe.strstart),_e!==0&&xe.strstart-_e<=xe.w_size-Pe&&(xe.match_length=Cr(xe,_e)),xe.match_length>=Ue)if(ct=w(xe,xe.strstart-xe.match_start,xe.match_length-Ue),xe.lookahead-=xe.match_length,xe.match_length<=xe.max_lazy_match&&xe.lookahead>=Ue){xe.match_length--;do xe.strstart++,xe.ins_h=hr(xe,xe.ins_h,xe.window[xe.strstart+Ue-1]),_e=xe.prev[xe.strstart&xe.w_mask]=xe.head[xe.ins_h],xe.head[xe.ins_h]=xe.strstart;while(--xe.match_length!==0);xe.strstart++}else xe.strstart+=xe.match_length,xe.match_length=0,xe.ins_h=xe.window[xe.strstart],xe.ins_h=hr(xe,xe.ins_h,xe.window[xe.strstart+1]);else ct=w(xe,0,xe.window[xe.strstart]),xe.lookahead--,xe.strstart++;if(ct&&(xr(xe,!1),xe.strm.avail_out===0))return $t}return xe.insert=xe.strstart<Ue-1?xe.strstart:Ue-1,Xe===ee?(xr(xe,!0),xe.strm.avail_out===0?ar:gr):xe.sym_next&&(xr(xe,!1),xe.strm.avail_out===0)?$t:tr},ke=(xe,Xe)=>{let _e,ct,Dt;for(;;){if(xe.lookahead<Pe){if(zt(xe),xe.lookahead<Pe&&Xe===A)return $t;if(xe.lookahead===0)break}if(_e=0,xe.lookahead>=Ue&&(xe.ins_h=hr(xe,xe.ins_h,xe.window[xe.strstart+Ue-1]),_e=xe.prev[xe.strstart&xe.w_mask]=xe.head[xe.ins_h],xe.head[xe.ins_h]=xe.strstart),xe.prev_length=xe.match_length,xe.prev_match=xe.match_start,xe.match_length=Ue-1,_e!==0&&xe.prev_length<xe.max_lazy_match&&xe.strstart-_e<=xe.w_size-Pe&&(xe.match_length=Cr(xe,_e),xe.match_length<=5&&(xe.strategy===de||xe.match_length===Ue&&xe.strstart-xe.match_start>4096)&&(xe.match_length=Ue-1)),xe.prev_length>=Ue&&xe.match_length<=xe.prev_length){Dt=xe.strstart+xe.lookahead-Ue,ct=w(xe,xe.strstart-1-xe.prev_match,xe.prev_length-Ue),xe.lookahead-=xe.prev_length-1,xe.prev_length-=2;do++xe.strstart<=Dt&&(xe.ins_h=hr(xe,xe.ins_h,xe.window[xe.strstart+Ue-1]),_e=xe.prev[xe.strstart&xe.w_mask]=xe.head[xe.ins_h],xe.head[xe.ins_h]=xe.strstart);while(--xe.prev_length!==0);if(xe.match_available=0,xe.match_length=Ue-1,xe.strstart++,ct&&(xr(xe,!1),xe.strm.avail_out===0))return $t}else if(xe.match_available){if(ct=w(xe,0,xe.window[xe.strstart-1]),ct&&xr(xe,!1),xe.strstart++,xe.lookahead--,xe.strm.avail_out===0)return $t}else xe.match_available=1,xe.strstart++,xe.lookahead--}return xe.match_available&&(ct=w(xe,0,xe.window[xe.strstart-1]),xe.match_available=0),xe.insert=xe.strstart<Ue-1?xe.strstart:Ue-1,Xe===ee?(xr(xe,!0),xe.strm.avail_out===0?ar:gr):xe.sym_next&&(xr(xe,!1),xe.strm.avail_out===0)?$t:tr},Be=(xe,Xe)=>{let _e,ct,Dt,cr;const fr=xe.window;for(;;){if(xe.lookahead<=ze){if(zt(xe),xe.lookahead<=ze&&Xe===A)return $t;if(xe.lookahead===0)break}if(xe.match_length=0,xe.lookahead>=Ue&&xe.strstart>0&&(Dt=xe.strstart-1,ct=fr[Dt],ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt])){cr=xe.strstart+ze;do;while(ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt]&&ct===fr[++Dt]&&Dt<cr);xe.match_length=ze-(cr-Dt),xe.match_length>xe.lookahead&&(xe.match_length=xe.lookahead)}if(xe.match_length>=Ue?(_e=w(xe,1,xe.match_length-Ue),xe.lookahead-=xe.match_length,xe.strstart+=xe.match_length,xe.match_length=0):(_e=w(xe,0,xe.window[xe.strstart]),xe.lookahead--,xe.strstart++),_e&&(xr(xe,!1),xe.strm.avail_out===0))return $t}return xe.insert=0,Xe===ee?(xr(xe,!0),xe.strm.avail_out===0?ar:gr):xe.sym_next&&(xr(xe,!1),xe.strm.avail_out===0)?$t:tr},et=(xe,Xe)=>{let _e;for(;;){if(xe.lookahead===0&&(zt(xe),xe.lookahead===0)){if(Xe===A)return $t;break}if(xe.match_length=0,_e=w(xe,0,xe.window[xe.strstart]),xe.lookahead--,xe.strstart++,_e&&(xr(xe,!1),xe.strm.avail_out===0))return $t}return xe.insert=0,Xe===ee?(xr(xe,!0),xe.strm.avail_out===0?ar:gr):xe.sym_next&&(xr(xe,!1),xe.strm.avail_out===0)?$t:tr};function Ze(xe,Xe,_e,ct,Dt){this.good_length=xe,this.max_lazy=Xe,this.nice_length=_e,this.max_chain=ct,this.func=Dt}const Qe=[new Ze(0,0,0,0,Ft),new Ze(4,4,8,4,kt),new Ze(4,5,16,8,kt),new Ze(4,6,32,32,kt),new Ze(4,4,16,16,ke),new Ze(8,16,32,32,ke),new Ze(8,16,128,128,ke),new Ze(8,32,128,256,ke),new Ze(32,128,258,1024,ke),new Ze(32,258,258,4096,ke)],Ke=xe=>{xe.window_size=2*xe.w_size,ur(xe.head),xe.max_lazy_match=Qe[xe.level].max_lazy,xe.good_match=Qe[xe.level].good_length,xe.nice_match=Qe[xe.level].nice_length,xe.max_chain_length=Qe[xe.level].max_chain,xe.strstart=0,xe.block_start=0,xe.lookahead=0,xe.insert=0,xe.match_length=xe.prev_length=Ue-1,xe.match_available=0,xe.ins_h=0};function Je(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ye,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Te*2),this.dyn_dtree=new Uint16Array((2*Ae+1)*2),this.bl_tree=new Uint16Array((2*Ie+1)*2),ur(this.dyn_ltree),ur(this.dyn_dtree),ur(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(De+1),this.heap=new Uint16Array(2*Ee+1),ur(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Ee+1),ur(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Re=xe=>{if(!xe)return 1;const Xe=xe.state;return!Xe||Xe.strm!==xe||Xe.status!==He&&Xe.status!==je&&Xe.status!==Ne&&Xe.status!==Oe&&Xe.status!==Ve&&Xe.status!==Ht&&Xe.status!==Kt&&Xe.status!==ir?1:0},Bt=xe=>{if(Re(xe))return sr(xe,ae);xe.total_in=xe.total_out=0,xe.data_type=ve;const Xe=xe.state;return Xe.pending=0,Xe.pending_out=0,Xe.wrap<0&&(Xe.wrap=-Xe.wrap),Xe.status=Xe.wrap===2?je:Xe.wrap?He:Kt,xe.adler=Xe.wrap===2?0:1,Xe.last_flush=-2,x(Xe),ie},Fe=xe=>{const Xe=Bt(xe);return Xe===ie&&Ke(xe.state),Xe},Ge=(xe,Xe)=>Re(xe)||xe.state.wrap!==2?ae:(xe.state.gzhead=Xe,ie),nr=(xe,Xe,_e,ct,Dt,cr)=>{if(!xe)return ae;let fr=1;if(Xe===fe&&(Xe=6),ct<0?(fr=0,ct=-ct):ct>15&&(fr=2,ct-=16),Dt<1||Dt>Se||_e!==ye||ct<8||ct>15||Xe<0||Xe>9||cr<0||cr>he||ct===8&&fr!==1)return sr(xe,ae);ct===8&&(ct=9);const dr=new Je;return xe.state=dr,dr.strm=xe,dr.status=He,dr.wrap=fr,dr.gzhead=null,dr.w_bits=ct,dr.w_size=1<<dr.w_bits,dr.w_mask=dr.w_size-1,dr.hash_bits=Dt+7,dr.hash_size=1<<dr.hash_bits,dr.hash_mask=dr.hash_size-1,dr.hash_shift=~~((dr.hash_bits+Ue-1)/Ue),dr.window=new Uint8Array(dr.w_size*2),dr.head=new Uint16Array(dr.hash_size),dr.prev=new Uint16Array(dr.w_size),dr.lit_bufsize=1<<Dt+6,dr.pending_buf_size=dr.lit_bufsize*4,dr.pending_buf=new Uint8Array(dr.pending_buf_size),dr.sym_buf=dr.lit_bufsize,dr.sym_end=(dr.lit_bufsize-1)*3,dr.level=Xe,dr.strategy=cr,dr.method=_e,Fe(xe)},jt=(xe,Xe)=>nr(xe,Xe,ye,Ce,be,me),vr=(xe,Xe)=>{if(Re(xe)||Xe>te||Xe<0)return xe?sr(xe,ae):ae;const _e=xe.state;if(!xe.output||xe.avail_in!==0&&!xe.input||_e.status===ir&&Xe!==ee)return sr(xe,xe.avail_out===0?le:ae);const ct=_e.last_flush;if(_e.last_flush=Xe,_e.pending!==0){if(yr(xe),xe.avail_out===0)return _e.last_flush=-1,ie}else if(xe.avail_in===0&&pr(Xe)<=pr(ct)&&Xe!==ee)return sr(xe,le);if(_e.status===ir&&xe.avail_in!==0)return sr(xe,le);if(_e.status===He&&_e.wrap===0&&(_e.status=Kt),_e.status===He){let Dt=ye+(_e.w_bits-8<<4)<<8,cr=-1;if(_e.strategy>=ce||_e.level<2?cr=0:_e.level<6?cr=1:_e.level===6?cr=2:cr=3,Dt|=cr<<6,_e.strstart!==0&&(Dt|=$e),Dt+=31-Dt%31,Jt(_e,Dt),_e.strstart!==0&&(Jt(_e,xe.adler>>>16),Jt(_e,xe.adler&65535)),xe.adler=1,_e.status=Kt,yr(xe),_e.pending!==0)return _e.last_flush=-1,ie}if(_e.status===je){if(xe.adler=0,Yt(_e,31),Yt(_e,139),Yt(_e,8),_e.gzhead)Yt(_e,(_e.gzhead.text?1:0)+(_e.gzhead.hcrc?2:0)+(_e.gzhead.extra?4:0)+(_e.gzhead.name?8:0)+(_e.gzhead.comment?16:0)),Yt(_e,_e.gzhead.time&255),Yt(_e,_e.gzhead.time>>8&255),Yt(_e,_e.gzhead.time>>16&255),Yt(_e,_e.gzhead.time>>24&255),Yt(_e,_e.level===9?2:_e.strategy>=ce||_e.level<2?4:0),Yt(_e,_e.gzhead.os&255),_e.gzhead.extra&&_e.gzhead.extra.length&&(Yt(_e,_e.gzhead.extra.length&255),Yt(_e,_e.gzhead.extra.length>>8&255)),_e.gzhead.hcrc&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending,0)),_e.gzindex=0,_e.status=Ne;else if(Yt(_e,0),Yt(_e,0),Yt(_e,0),Yt(_e,0),Yt(_e,0),Yt(_e,_e.level===9?2:_e.strategy>=ce||_e.level<2?4:0),Yt(_e,er),_e.status=Kt,yr(xe),_e.pending!==0)return _e.last_flush=-1,ie}if(_e.status===Ne){if(_e.gzhead.extra){let Dt=_e.pending,cr=(_e.gzhead.extra.length&65535)-_e.gzindex;for(;_e.pending+cr>_e.pending_buf_size;){let dr=_e.pending_buf_size-_e.pending;if(_e.pending_buf.set(_e.gzhead.extra.subarray(_e.gzindex,_e.gzindex+dr),_e.pending),_e.pending=_e.pending_buf_size,_e.gzhead.hcrc&&_e.pending>Dt&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending-Dt,Dt)),_e.gzindex+=dr,yr(xe),_e.pending!==0)return _e.last_flush=-1,ie;Dt=0,cr-=dr}let fr=new Uint8Array(_e.gzhead.extra);_e.pending_buf.set(fr.subarray(_e.gzindex,_e.gzindex+cr),_e.pending),_e.pending+=cr,_e.gzhead.hcrc&&_e.pending>Dt&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending-Dt,Dt)),_e.gzindex=0}_e.status=Oe}if(_e.status===Oe){if(_e.gzhead.name){let Dt=_e.pending,cr;do{if(_e.pending===_e.pending_buf_size){if(_e.gzhead.hcrc&&_e.pending>Dt&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending-Dt,Dt)),yr(xe),_e.pending!==0)return _e.last_flush=-1,ie;Dt=0}_e.gzindex<_e.gzhead.name.length?cr=_e.gzhead.name.charCodeAt(_e.gzindex++)&255:cr=0,Yt(_e,cr)}while(cr!==0);_e.gzhead.hcrc&&_e.pending>Dt&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending-Dt,Dt)),_e.gzindex=0}_e.status=Ve}if(_e.status===Ve){if(_e.gzhead.comment){let Dt=_e.pending,cr;do{if(_e.pending===_e.pending_buf_size){if(_e.gzhead.hcrc&&_e.pending>Dt&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending-Dt,Dt)),yr(xe),_e.pending!==0)return _e.last_flush=-1,ie;Dt=0}_e.gzindex<_e.gzhead.comment.length?cr=_e.gzhead.comment.charCodeAt(_e.gzindex++)&255:cr=0,Yt(_e,cr)}while(cr!==0);_e.gzhead.hcrc&&_e.pending>Dt&&(xe.adler=S(xe.adler,_e.pending_buf,_e.pending-Dt,Dt))}_e.status=Ht}if(_e.status===Ht){if(_e.gzhead.hcrc){if(_e.pending+2>_e.pending_buf_size&&(yr(xe),_e.pending!==0))return _e.last_flush=-1,ie;Yt(_e,xe.adler&255),Yt(_e,xe.adler>>8&255),xe.adler=0}if(_e.status=Kt,yr(xe),_e.pending!==0)return _e.last_flush=-1,ie}if(xe.avail_in!==0||_e.lookahead!==0||Xe!==A&&_e.status!==ir){let Dt=_e.level===0?Ft(_e,Xe):_e.strategy===ce?et(_e,Xe):_e.strategy===pe?Be(_e,Xe):Qe[_e.level].func(_e,Xe);if((Dt===ar||Dt===gr)&&(_e.status=ir),Dt===$t||Dt===ar)return xe.avail_out===0&&(_e.last_flush=-1),ie;if(Dt===tr&&(Xe===O?T(_e):Xe!==te&&(C(_e,0,0,!1),Xe===H&&(ur(_e.head),_e.lookahead===0&&(_e.strstart=0,_e.block_start=0,_e.insert=0))),yr(xe),xe.avail_out===0))return _e.last_flush=-1,ie}return Xe!==ee?ie:_e.wrap<=0?ne:(_e.wrap===2?(Yt(_e,xe.adler&255),Yt(_e,xe.adler>>8&255),Yt(_e,xe.adler>>16&255),Yt(_e,xe.adler>>24&255),Yt(_e,xe.total_in&255),Yt(_e,xe.total_in>>8&255),Yt(_e,xe.total_in>>16&255),Yt(_e,xe.total_in>>24&255)):(Jt(_e,xe.adler>>>16),Jt(_e,xe.adler&65535)),yr(xe),_e.wrap>0&&(_e.wrap=-_e.wrap),_e.pending!==0?ie:ne)},it=xe=>{if(Re(xe))return ae;const Xe=xe.state.status;return xe.state=null,Xe===Kt?sr(xe,oe):ie},dt=(xe,Xe)=>{let _e=Xe.length;if(Re(xe))return ae;const ct=xe.state,Dt=ct.wrap;if(Dt===2||Dt===1&&ct.status!==He||ct.lookahead)return ae;if(Dt===1&&(xe.adler=_(xe.adler,Xe,_e,0)),ct.wrap=0,_e>=ct.w_size){Dt===0&&(ur(ct.head),ct.strstart=0,ct.block_start=0,ct.insert=0);let jr=new Uint8Array(ct.w_size);jr.set(Xe.subarray(_e-ct.w_size,_e),0),Xe=jr,_e=ct.w_size}const cr=xe.avail_in,fr=xe.next_in,dr=xe.input;for(xe.avail_in=_e,xe.next_in=0,xe.input=Xe,zt(ct);ct.lookahead>=Ue;){let jr=ct.strstart,Rr=ct.lookahead-(Ue-1);do ct.ins_h=hr(ct,ct.ins_h,ct.window[jr+Ue-1]),ct.prev[jr&ct.w_mask]=ct.head[ct.ins_h],ct.head[ct.ins_h]=jr,jr++;while(--Rr);ct.strstart=jr,ct.lookahead=Ue-1,zt(ct)}return ct.strstart+=ct.lookahead,ct.block_start=ct.strstart,ct.insert=ct.lookahead,ct.lookahead=0,ct.match_length=ct.prev_length=Ue-1,ct.match_available=0,xe.next_in=fr,xe.input=dr,xe.avail_in=cr,ct.wrap=Dt,ie};return deflate.deflateInit=jt,deflate.deflateInit2=nr,deflate.deflateReset=Fe,deflate.deflateResetKeep=Bt,deflate.deflateSetHeader=Ge,deflate.deflate=vr,deflate.deflateEnd=it,deflate.deflateSetDictionary=dt,deflate.deflateInfo="pako deflate (from Nodeca project)",deflate}var common={},hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common;hasRequiredCommon=1;const x=(C,E)=>Object.prototype.hasOwnProperty.call(C,E);return common.assign=function(C){const E=Array.prototype.slice.call(arguments,1);for(;E.length;){const w=E.shift();if(w){if(typeof w!="object")throw new TypeError(w+"must be non-object");for(const T in w)x(w,T)&&(C[T]=w[T])}}return C},common.flattenChunks=C=>{let E=0;for(let T=0,_=C.length;T<_;T++)E+=C[T].length;const w=new Uint8Array(E);for(let T=0,_=0,S=C.length;T<S;T++){let R=C[T];w.set(R,_),_+=R.length}return w},common}var strings={},hasRequiredStrings;function requireStrings(){if(hasRequiredStrings)return strings;hasRequiredStrings=1;let x=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{x=!1}const C=new Uint8Array(256);for(let w=0;w<256;w++)C[w]=w>=252?6:w>=248?5:w>=240?4:w>=224?3:w>=192?2:1;C[254]=C[254]=1,strings.string2buf=w=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(w);let T,_,S,R,A,O=w.length,H=0;for(R=0;R<O;R++)_=w.charCodeAt(R),(_&64512)===55296&&R+1<O&&(S=w.charCodeAt(R+1),(S&64512)===56320&&(_=65536+(_-55296<<10)+(S-56320),R++)),H+=_<128?1:_<2048?2:_<65536?3:4;for(T=new Uint8Array(H),A=0,R=0;A<H;R++)_=w.charCodeAt(R),(_&64512)===55296&&R+1<O&&(S=w.charCodeAt(R+1),(S&64512)===56320&&(_=65536+(_-55296<<10)+(S-56320),R++)),_<128?T[A++]=_:_<2048?(T[A++]=192|_>>>6,T[A++]=128|_&63):_<65536?(T[A++]=224|_>>>12,T[A++]=128|_>>>6&63,T[A++]=128|_&63):(T[A++]=240|_>>>18,T[A++]=128|_>>>12&63,T[A++]=128|_>>>6&63,T[A++]=128|_&63);return T};const E=(w,T)=>{if(T<65534&&w.subarray&&x)return String.fromCharCode.apply(null,w.length===T?w:w.subarray(0,T));let _="";for(let S=0;S<T;S++)_+=String.fromCharCode(w[S]);return _};return strings.buf2string=(w,T)=>{const _=T||w.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(w.subarray(0,T));let S,R;const A=new Array(_*2);for(R=0,S=0;S<_;){let O=w[S++];if(O<128){A[R++]=O;continue}let H=C[O];if(H>4){A[R++]=65533,S+=H-1;continue}for(O&=H===2?31:H===3?15:7;H>1&&S<_;)O=O<<6|w[S++]&63,H--;if(H>1){A[R++]=65533;continue}O<65536?A[R++]=O:(O-=65536,A[R++]=55296|O>>10&1023,A[R++]=56320|O&1023)}return E(A,R)},strings.utf8border=(w,T)=>{T=T||w.length,T>w.length&&(T=w.length);let _=T-1;for(;_>=0&&(w[_]&192)===128;)_--;return _<0||_===0?T:_+C[w[_]]>T?_:T},strings}var zstream,hasRequiredZstream;function requireZstream(){if(hasRequiredZstream)return zstream;hasRequiredZstream=1;function x(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}return zstream=x,zstream}var hasRequiredDeflate;function requireDeflate(){if(hasRequiredDeflate)return deflate$1;hasRequiredDeflate=1;const x=requireDeflate$1(),C=requireCommon(),E=requireStrings(),w=requireMessages(),T=requireZstream(),_=Object.prototype.toString,{Z_NO_FLUSH:S,Z_SYNC_FLUSH:R,Z_FULL_FLUSH:A,Z_FINISH:O,Z_OK:H,Z_STREAM_END:ee,Z_DEFAULT_COMPRESSION:te,Z_DEFAULT_STRATEGY:ie,Z_DEFLATED:ne}=requireConstants$1();function ae(de){this.options=C.assign({level:te,method:ne,chunkSize:16384,windowBits:15,memLevel:8,strategy:ie},de||{});let ce=this.options;ce.raw&&ce.windowBits>0?ce.windowBits=-ce.windowBits:ce.gzip&&ce.windowBits>0&&ce.windowBits<16&&(ce.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new T,this.strm.avail_out=0;let pe=x.deflateInit2(this.strm,ce.level,ce.method,ce.windowBits,ce.memLevel,ce.strategy);if(pe!==H)throw new Error(w[pe]);if(ce.header&&x.deflateSetHeader(this.strm,ce.header),ce.dictionary){let he;if(typeof ce.dictionary=="string"?he=E.string2buf(ce.dictionary):_.call(ce.dictionary)==="[object ArrayBuffer]"?he=new Uint8Array(ce.dictionary):he=ce.dictionary,pe=x.deflateSetDictionary(this.strm,he),pe!==H)throw new Error(w[pe]);this._dict_set=!0}}ae.prototype.push=function(de,ce){const pe=this.strm,he=this.options.chunkSize;let me,ve;if(this.ended)return!1;for(ce===~~ce?ve=ce:ve=ce===!0?O:S,typeof de=="string"?pe.input=E.string2buf(de):_.call(de)==="[object ArrayBuffer]"?pe.input=new Uint8Array(de):pe.input=de,pe.next_in=0,pe.avail_in=pe.input.length;;){if(pe.avail_out===0&&(pe.output=new Uint8Array(he),pe.next_out=0,pe.avail_out=he),(ve===R||ve===A)&&pe.avail_out<=6){this.onData(pe.output.subarray(0,pe.next_out)),pe.avail_out=0;continue}if(me=x.deflate(pe,ve),me===ee)return pe.next_out>0&&this.onData(pe.output.subarray(0,pe.next_out)),me=x.deflateEnd(this.strm),this.onEnd(me),this.ended=!0,me===H;if(pe.avail_out===0){this.onData(pe.output);continue}if(ve>0&&pe.next_out>0){this.onData(pe.output.subarray(0,pe.next_out)),pe.avail_out=0;continue}if(pe.avail_in===0)break}return!0},ae.prototype.onData=function(de){this.chunks.push(de)},ae.prototype.onEnd=function(de){de===H&&(this.result=C.flattenChunks(this.chunks)),this.chunks=[],this.err=de,this.msg=this.strm.msg};function oe(de,ce){const pe=new ae(ce);if(pe.push(de,!0),pe.err)throw pe.msg||w[pe.err];return pe.result}function le(de,ce){return ce=ce||{},ce.raw=!0,oe(de,ce)}function fe(de,ce){return ce=ce||{},ce.gzip=!0,oe(de,ce)}return deflate$1.Deflate=ae,deflate$1.deflate=oe,deflate$1.deflateRaw=le,deflate$1.gzip=fe,deflate$1.constants=requireConstants$1(),deflate$1}var inflate$1={},inflate={},inffast,hasRequiredInffast;function requireInffast(){if(hasRequiredInffast)return inffast;hasRequiredInffast=1;const x=16209,C=16191;return inffast=function(E,w){let T,_,S,R,A,O,H,ee,te,ie,ne,ae,oe,le,fe,de,ce,pe,he,me,ve,ye,Se,Ce;const be=E.state;T=E.next_in,Se=E.input,_=T+(E.avail_in-5),S=E.next_out,Ce=E.output,R=S-(w-E.avail_out),A=S+(E.avail_out-257),O=be.dmax,H=be.wsize,ee=be.whave,te=be.wnext,ie=be.window,ne=be.hold,ae=be.bits,oe=be.lencode,le=be.distcode,fe=(1<<be.lenbits)-1,de=(1<<be.distbits)-1;e:do{ae<15&&(ne+=Se[T++]<<ae,ae+=8,ne+=Se[T++]<<ae,ae+=8),ce=oe[ne&fe];t:for(;;){if(pe=ce>>>24,ne>>>=pe,ae-=pe,pe=ce>>>16&255,pe===0)Ce[S++]=ce&65535;else if(pe&16){he=ce&65535,pe&=15,pe&&(ae<pe&&(ne+=Se[T++]<<ae,ae+=8),he+=ne&(1<<pe)-1,ne>>>=pe,ae-=pe),ae<15&&(ne+=Se[T++]<<ae,ae+=8,ne+=Se[T++]<<ae,ae+=8),ce=le[ne&de];r:for(;;){if(pe=ce>>>24,ne>>>=pe,ae-=pe,pe=ce>>>16&255,pe&16){if(me=ce&65535,pe&=15,ae<pe&&(ne+=Se[T++]<<ae,ae+=8,ae<pe&&(ne+=Se[T++]<<ae,ae+=8)),me+=ne&(1<<pe)-1,me>O){E.msg="invalid distance too far back",be.mode=x;break e}if(ne>>>=pe,ae-=pe,pe=S-R,me>pe){if(pe=me-pe,pe>ee&&be.sane){E.msg="invalid distance too far back",be.mode=x;break e}if(ve=0,ye=ie,te===0){if(ve+=H-pe,pe<he){he-=pe;do Ce[S++]=ie[ve++];while(--pe);ve=S-me,ye=Ce}}else if(te<pe){if(ve+=H+te-pe,pe-=te,pe<he){he-=pe;do Ce[S++]=ie[ve++];while(--pe);if(ve=0,te<he){pe=te,he-=pe;do Ce[S++]=ie[ve++];while(--pe);ve=S-me,ye=Ce}}}else if(ve+=te-pe,pe<he){he-=pe;do Ce[S++]=ie[ve++];while(--pe);ve=S-me,ye=Ce}for(;he>2;)Ce[S++]=ye[ve++],Ce[S++]=ye[ve++],Ce[S++]=ye[ve++],he-=3;he&&(Ce[S++]=ye[ve++],he>1&&(Ce[S++]=ye[ve++]))}else{ve=S-me;do Ce[S++]=Ce[ve++],Ce[S++]=Ce[ve++],Ce[S++]=Ce[ve++],he-=3;while(he>2);he&&(Ce[S++]=Ce[ve++],he>1&&(Ce[S++]=Ce[ve++]))}}else if((pe&64)===0){ce=le[(ce&65535)+(ne&(1<<pe)-1)];continue r}else{E.msg="invalid distance code",be.mode=x;break e}break}}else if((pe&64)===0){ce=oe[(ce&65535)+(ne&(1<<pe)-1)];continue t}else if(pe&32){be.mode=C;break e}else{E.msg="invalid literal/length code",be.mode=x;break e}break}}while(T<_&&S<A);he=ae>>3,T-=he,ae-=he<<3,ne&=(1<<ae)-1,E.next_in=T,E.next_out=S,E.avail_in=T<_?5+(_-T):5-(T-_),E.avail_out=S<A?257+(A-S):257-(S-A),be.hold=ne,be.bits=ae},inffast}var inftrees,hasRequiredInftrees;function requireInftrees(){if(hasRequiredInftrees)return inftrees;hasRequiredInftrees=1;const x=15,C=852,E=592,w=0,T=1,_=2,S=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),R=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),A=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),O=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);return inftrees=(H,ee,te,ie,ne,ae,oe,le)=>{const fe=le.bits;let de=0,ce=0,pe=0,he=0,me=0,ve=0,ye=0,Se=0,Ce=0,be=0,Ee,Ae,Ie,Te,De,Ue=null,ze;const Pe=new Uint16Array(x+1),$e=new Uint16Array(x+1);let He=null,je,Ne,Oe;for(de=0;de<=x;de++)Pe[de]=0;for(ce=0;ce<ie;ce++)Pe[ee[te+ce]]++;for(me=fe,he=x;he>=1&&Pe[he]===0;he--);if(me>he&&(me=he),he===0)return ne[ae++]=1<<24|64<<16|0,ne[ae++]=1<<24|64<<16|0,le.bits=1,0;for(pe=1;pe<he&&Pe[pe]===0;pe++);for(me<pe&&(me=pe),Se=1,de=1;de<=x;de++)if(Se<<=1,Se-=Pe[de],Se<0)return-1;if(Se>0&&(H===w||he!==1))return-1;for($e[1]=0,de=1;de<x;de++)$e[de+1]=$e[de]+Pe[de];for(ce=0;ce<ie;ce++)ee[te+ce]!==0&&(oe[$e[ee[te+ce]]++]=ce);if(H===w?(Ue=He=oe,ze=20):H===T?(Ue=S,He=R,ze=257):(Ue=A,He=O,ze=0),be=0,ce=0,de=pe,De=ae,ve=me,ye=0,Ie=-1,Ce=1<<me,Te=Ce-1,H===T&&Ce>C||H===_&&Ce>E)return 1;for(;;){je=de-ye,oe[ce]+1<ze?(Ne=0,Oe=oe[ce]):oe[ce]>=ze?(Ne=He[oe[ce]-ze],Oe=Ue[oe[ce]-ze]):(Ne=96,Oe=0),Ee=1<<de-ye,Ae=1<<ve,pe=Ae;do Ae-=Ee,ne[De+(be>>ye)+Ae]=je<<24|Ne<<16|Oe|0;while(Ae!==0);for(Ee=1<<de-1;be&Ee;)Ee>>=1;if(Ee!==0?(be&=Ee-1,be+=Ee):be=0,ce++,--Pe[de]===0){if(de===he)break;de=ee[te+oe[ce]]}if(de>me&&(be&Te)!==Ie){for(ye===0&&(ye=me),De+=pe,ve=de-ye,Se=1<<ve;ve+ye<he&&(Se-=Pe[ve+ye],!(Se<=0));)ve++,Se<<=1;if(Ce+=1<<ve,H===T&&Ce>C||H===_&&Ce>E)return 1;Ie=be&Te,ne[Ie]=me<<24|ve<<16|De-ae|0}}return be!==0&&(ne[De+be]=de-ye<<24|64<<16|0),le.bits=me,0},inftrees}var hasRequiredInflate$1;function requireInflate$1(){if(hasRequiredInflate$1)return inflate;hasRequiredInflate$1=1;const x=requireAdler32(),C=requireCrc32(),E=requireInffast(),w=requireInftrees(),T=0,_=1,S=2,{Z_FINISH:R,Z_BLOCK:A,Z_TREES:O,Z_OK:H,Z_STREAM_END:ee,Z_NEED_DICT:te,Z_STREAM_ERROR:ie,Z_DATA_ERROR:ne,Z_MEM_ERROR:ae,Z_BUF_ERROR:oe,Z_DEFLATED:le}=requireConstants$1(),fe=16180,de=16181,ce=16182,pe=16183,he=16184,me=16185,ve=16186,ye=16187,Se=16188,Ce=16189,be=16190,Ee=16191,Ae=16192,Ie=16193,Te=16194,De=16195,Ue=16196,ze=16197,Pe=16198,$e=16199,He=16200,je=16201,Ne=16202,Oe=16203,Ve=16204,Ht=16205,Kt=16206,ir=16207,$t=16208,tr=16209,ar=16210,gr=16211,er=852,sr=592,pr=15,ur=Ke=>(Ke>>>24&255)+(Ke>>>8&65280)+((Ke&65280)<<8)+((Ke&255)<<24);function Sr(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const hr=Ke=>{if(!Ke)return 1;const Je=Ke.state;return!Je||Je.strm!==Ke||Je.mode<fe||Je.mode>gr?1:0},yr=Ke=>{if(hr(Ke))return ie;const Je=Ke.state;return Ke.total_in=Ke.total_out=Je.total=0,Ke.msg="",Je.wrap&&(Ke.adler=Je.wrap&1),Je.mode=fe,Je.last=0,Je.havedict=0,Je.flags=-1,Je.dmax=32768,Je.head=null,Je.hold=0,Je.bits=0,Je.lencode=Je.lendyn=new Int32Array(er),Je.distcode=Je.distdyn=new Int32Array(sr),Je.sane=1,Je.back=-1,H},xr=Ke=>{if(hr(Ke))return ie;const Je=Ke.state;return Je.wsize=0,Je.whave=0,Je.wnext=0,yr(Ke)},Yt=(Ke,Je)=>{let Re;if(hr(Ke))return ie;const Bt=Ke.state;return Je<0?(Re=0,Je=-Je):(Re=(Je>>4)+5,Je<48&&(Je&=15)),Je&&(Je<8||Je>15)?ie:(Bt.window!==null&&Bt.wbits!==Je&&(Bt.window=null),Bt.wrap=Re,Bt.wbits=Je,xr(Ke))},Jt=(Ke,Je)=>{if(!Ke)return ie;const Re=new Sr;Ke.state=Re,Re.strm=Ke,Re.window=null,Re.mode=fe;const Bt=Yt(Ke,Je);return Bt!==H&&(Ke.state=null),Bt},mr=Ke=>Jt(Ke,pr);let Cr=!0,zt,Ft;const kt=Ke=>{if(Cr){zt=new Int32Array(512),Ft=new Int32Array(32);let Je=0;for(;Je<144;)Ke.lens[Je++]=8;for(;Je<256;)Ke.lens[Je++]=9;for(;Je<280;)Ke.lens[Je++]=7;for(;Je<288;)Ke.lens[Je++]=8;for(w(_,Ke.lens,0,288,zt,0,Ke.work,{bits:9}),Je=0;Je<32;)Ke.lens[Je++]=5;w(S,Ke.lens,0,32,Ft,0,Ke.work,{bits:5}),Cr=!1}Ke.lencode=zt,Ke.lenbits=9,Ke.distcode=Ft,Ke.distbits=5},ke=(Ke,Je,Re,Bt)=>{let Fe;const Ge=Ke.state;return Ge.window===null&&(Ge.wsize=1<<Ge.wbits,Ge.wnext=0,Ge.whave=0,Ge.window=new Uint8Array(Ge.wsize)),Bt>=Ge.wsize?(Ge.window.set(Je.subarray(Re-Ge.wsize,Re),0),Ge.wnext=0,Ge.whave=Ge.wsize):(Fe=Ge.wsize-Ge.wnext,Fe>Bt&&(Fe=Bt),Ge.window.set(Je.subarray(Re-Bt,Re-Bt+Fe),Ge.wnext),Bt-=Fe,Bt?(Ge.window.set(Je.subarray(Re-Bt,Re),0),Ge.wnext=Bt,Ge.whave=Ge.wsize):(Ge.wnext+=Fe,Ge.wnext===Ge.wsize&&(Ge.wnext=0),Ge.whave<Ge.wsize&&(Ge.whave+=Fe))),0},Be=(Ke,Je)=>{let Re,Bt,Fe,Ge,nr,jt,vr,it,dt,xe,Xe,_e,ct,Dt,cr=0,fr,dr,jr,Rr,ki,_i,Fr,Kr;const Ur=new Uint8Array(4);let ai,ii;const Fi=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(hr(Ke)||!Ke.output||!Ke.input&&Ke.avail_in!==0)return ie;Re=Ke.state,Re.mode===Ee&&(Re.mode=Ae),nr=Ke.next_out,Fe=Ke.output,vr=Ke.avail_out,Ge=Ke.next_in,Bt=Ke.input,jt=Ke.avail_in,it=Re.hold,dt=Re.bits,xe=jt,Xe=vr,Kr=H;e:for(;;)switch(Re.mode){case fe:if(Re.wrap===0){Re.mode=Ae;break}for(;dt<16;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(Re.wrap&2&&it===35615){Re.wbits===0&&(Re.wbits=15),Re.check=0,Ur[0]=it&255,Ur[1]=it>>>8&255,Re.check=C(Re.check,Ur,2,0),it=0,dt=0,Re.mode=de;break}if(Re.head&&(Re.head.done=!1),!(Re.wrap&1)||(((it&255)<<8)+(it>>8))%31){Ke.msg="incorrect header check",Re.mode=tr;break}if((it&15)!==le){Ke.msg="unknown compression method",Re.mode=tr;break}if(it>>>=4,dt-=4,Fr=(it&15)+8,Re.wbits===0&&(Re.wbits=Fr),Fr>15||Fr>Re.wbits){Ke.msg="invalid window size",Re.mode=tr;break}Re.dmax=1<<Re.wbits,Re.flags=0,Ke.adler=Re.check=1,Re.mode=it&512?Ce:Ee,it=0,dt=0;break;case de:for(;dt<16;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(Re.flags=it,(Re.flags&255)!==le){Ke.msg="unknown compression method",Re.mode=tr;break}if(Re.flags&57344){Ke.msg="unknown header flags set",Re.mode=tr;break}Re.head&&(Re.head.text=it>>8&1),Re.flags&512&&Re.wrap&4&&(Ur[0]=it&255,Ur[1]=it>>>8&255,Re.check=C(Re.check,Ur,2,0)),it=0,dt=0,Re.mode=ce;case ce:for(;dt<32;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Re.head&&(Re.head.time=it),Re.flags&512&&Re.wrap&4&&(Ur[0]=it&255,Ur[1]=it>>>8&255,Ur[2]=it>>>16&255,Ur[3]=it>>>24&255,Re.check=C(Re.check,Ur,4,0)),it=0,dt=0,Re.mode=pe;case pe:for(;dt<16;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Re.head&&(Re.head.xflags=it&255,Re.head.os=it>>8),Re.flags&512&&Re.wrap&4&&(Ur[0]=it&255,Ur[1]=it>>>8&255,Re.check=C(Re.check,Ur,2,0)),it=0,dt=0,Re.mode=he;case he:if(Re.flags&1024){for(;dt<16;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Re.length=it,Re.head&&(Re.head.extra_len=it),Re.flags&512&&Re.wrap&4&&(Ur[0]=it&255,Ur[1]=it>>>8&255,Re.check=C(Re.check,Ur,2,0)),it=0,dt=0}else Re.head&&(Re.head.extra=null);Re.mode=me;case me:if(Re.flags&1024&&(_e=Re.length,_e>jt&&(_e=jt),_e&&(Re.head&&(Fr=Re.head.extra_len-Re.length,Re.head.extra||(Re.head.extra=new Uint8Array(Re.head.extra_len)),Re.head.extra.set(Bt.subarray(Ge,Ge+_e),Fr)),Re.flags&512&&Re.wrap&4&&(Re.check=C(Re.check,Bt,_e,Ge)),jt-=_e,Ge+=_e,Re.length-=_e),Re.length))break e;Re.length=0,Re.mode=ve;case ve:if(Re.flags&2048){if(jt===0)break e;_e=0;do Fr=Bt[Ge+_e++],Re.head&&Fr&&Re.length<65536&&(Re.head.name+=String.fromCharCode(Fr));while(Fr&&_e<jt);if(Re.flags&512&&Re.wrap&4&&(Re.check=C(Re.check,Bt,_e,Ge)),jt-=_e,Ge+=_e,Fr)break e}else Re.head&&(Re.head.name=null);Re.length=0,Re.mode=ye;case ye:if(Re.flags&4096){if(jt===0)break e;_e=0;do Fr=Bt[Ge+_e++],Re.head&&Fr&&Re.length<65536&&(Re.head.comment+=String.fromCharCode(Fr));while(Fr&&_e<jt);if(Re.flags&512&&Re.wrap&4&&(Re.check=C(Re.check,Bt,_e,Ge)),jt-=_e,Ge+=_e,Fr)break e}else Re.head&&(Re.head.comment=null);Re.mode=Se;case Se:if(Re.flags&512){for(;dt<16;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(Re.wrap&4&&it!==(Re.check&65535)){Ke.msg="header crc mismatch",Re.mode=tr;break}it=0,dt=0}Re.head&&(Re.head.hcrc=Re.flags>>9&1,Re.head.done=!0),Ke.adler=Re.check=0,Re.mode=Ee;break;case Ce:for(;dt<32;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Ke.adler=Re.check=ur(it),it=0,dt=0,Re.mode=be;case be:if(Re.havedict===0)return Ke.next_out=nr,Ke.avail_out=vr,Ke.next_in=Ge,Ke.avail_in=jt,Re.hold=it,Re.bits=dt,te;Ke.adler=Re.check=1,Re.mode=Ee;case Ee:if(Je===A||Je===O)break e;case Ae:if(Re.last){it>>>=dt&7,dt-=dt&7,Re.mode=Kt;break}for(;dt<3;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}switch(Re.last=it&1,it>>>=1,dt-=1,it&3){case 0:Re.mode=Ie;break;case 1:if(kt(Re),Re.mode=$e,Je===O){it>>>=2,dt-=2;break e}break;case 2:Re.mode=Ue;break;case 3:Ke.msg="invalid block type",Re.mode=tr}it>>>=2,dt-=2;break;case Ie:for(it>>>=dt&7,dt-=dt&7;dt<32;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if((it&65535)!==(it>>>16^65535)){Ke.msg="invalid stored block lengths",Re.mode=tr;break}if(Re.length=it&65535,it=0,dt=0,Re.mode=Te,Je===O)break e;case Te:Re.mode=De;case De:if(_e=Re.length,_e){if(_e>jt&&(_e=jt),_e>vr&&(_e=vr),_e===0)break e;Fe.set(Bt.subarray(Ge,Ge+_e),nr),jt-=_e,Ge+=_e,vr-=_e,nr+=_e,Re.length-=_e;break}Re.mode=Ee;break;case Ue:for(;dt<14;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(Re.nlen=(it&31)+257,it>>>=5,dt-=5,Re.ndist=(it&31)+1,it>>>=5,dt-=5,Re.ncode=(it&15)+4,it>>>=4,dt-=4,Re.nlen>286||Re.ndist>30){Ke.msg="too many length or distance symbols",Re.mode=tr;break}Re.have=0,Re.mode=ze;case ze:for(;Re.have<Re.ncode;){for(;dt<3;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Re.lens[Fi[Re.have++]]=it&7,it>>>=3,dt-=3}for(;Re.have<19;)Re.lens[Fi[Re.have++]]=0;if(Re.lencode=Re.lendyn,Re.lenbits=7,ai={bits:Re.lenbits},Kr=w(T,Re.lens,0,19,Re.lencode,0,Re.work,ai),Re.lenbits=ai.bits,Kr){Ke.msg="invalid code lengths set",Re.mode=tr;break}Re.have=0,Re.mode=Pe;case Pe:for(;Re.have<Re.nlen+Re.ndist;){for(;cr=Re.lencode[it&(1<<Re.lenbits)-1],fr=cr>>>24,dr=cr>>>16&255,jr=cr&65535,!(fr<=dt);){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(jr<16)it>>>=fr,dt-=fr,Re.lens[Re.have++]=jr;else{if(jr===16){for(ii=fr+2;dt<ii;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(it>>>=fr,dt-=fr,Re.have===0){Ke.msg="invalid bit length repeat",Re.mode=tr;break}Fr=Re.lens[Re.have-1],_e=3+(it&3),it>>>=2,dt-=2}else if(jr===17){for(ii=fr+3;dt<ii;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}it>>>=fr,dt-=fr,Fr=0,_e=3+(it&7),it>>>=3,dt-=3}else{for(ii=fr+7;dt<ii;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}it>>>=fr,dt-=fr,Fr=0,_e=11+(it&127),it>>>=7,dt-=7}if(Re.have+_e>Re.nlen+Re.ndist){Ke.msg="invalid bit length repeat",Re.mode=tr;break}for(;_e--;)Re.lens[Re.have++]=Fr}}if(Re.mode===tr)break;if(Re.lens[256]===0){Ke.msg="invalid code -- missing end-of-block",Re.mode=tr;break}if(Re.lenbits=9,ai={bits:Re.lenbits},Kr=w(_,Re.lens,0,Re.nlen,Re.lencode,0,Re.work,ai),Re.lenbits=ai.bits,Kr){Ke.msg="invalid literal/lengths set",Re.mode=tr;break}if(Re.distbits=6,Re.distcode=Re.distdyn,ai={bits:Re.distbits},Kr=w(S,Re.lens,Re.nlen,Re.ndist,Re.distcode,0,Re.work,ai),Re.distbits=ai.bits,Kr){Ke.msg="invalid distances set",Re.mode=tr;break}if(Re.mode=$e,Je===O)break e;case $e:Re.mode=He;case He:if(jt>=6&&vr>=258){Ke.next_out=nr,Ke.avail_out=vr,Ke.next_in=Ge,Ke.avail_in=jt,Re.hold=it,Re.bits=dt,E(Ke,Xe),nr=Ke.next_out,Fe=Ke.output,vr=Ke.avail_out,Ge=Ke.next_in,Bt=Ke.input,jt=Ke.avail_in,it=Re.hold,dt=Re.bits,Re.mode===Ee&&(Re.back=-1);break}for(Re.back=0;cr=Re.lencode[it&(1<<Re.lenbits)-1],fr=cr>>>24,dr=cr>>>16&255,jr=cr&65535,!(fr<=dt);){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(dr&&(dr&240)===0){for(Rr=fr,ki=dr,_i=jr;cr=Re.lencode[_i+((it&(1<<Rr+ki)-1)>>Rr)],fr=cr>>>24,dr=cr>>>16&255,jr=cr&65535,!(Rr+fr<=dt);){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}it>>>=Rr,dt-=Rr,Re.back+=Rr}if(it>>>=fr,dt-=fr,Re.back+=fr,Re.length=jr,dr===0){Re.mode=Ht;break}if(dr&32){Re.back=-1,Re.mode=Ee;break}if(dr&64){Ke.msg="invalid literal/length code",Re.mode=tr;break}Re.extra=dr&15,Re.mode=je;case je:if(Re.extra){for(ii=Re.extra;dt<ii;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Re.length+=it&(1<<Re.extra)-1,it>>>=Re.extra,dt-=Re.extra,Re.back+=Re.extra}Re.was=Re.length,Re.mode=Ne;case Ne:for(;cr=Re.distcode[it&(1<<Re.distbits)-1],fr=cr>>>24,dr=cr>>>16&255,jr=cr&65535,!(fr<=dt);){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if((dr&240)===0){for(Rr=fr,ki=dr,_i=jr;cr=Re.distcode[_i+((it&(1<<Rr+ki)-1)>>Rr)],fr=cr>>>24,dr=cr>>>16&255,jr=cr&65535,!(Rr+fr<=dt);){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}it>>>=Rr,dt-=Rr,Re.back+=Rr}if(it>>>=fr,dt-=fr,Re.back+=fr,dr&64){Ke.msg="invalid distance code",Re.mode=tr;break}Re.offset=jr,Re.extra=dr&15,Re.mode=Oe;case Oe:if(Re.extra){for(ii=Re.extra;dt<ii;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}Re.offset+=it&(1<<Re.extra)-1,it>>>=Re.extra,dt-=Re.extra,Re.back+=Re.extra}if(Re.offset>Re.dmax){Ke.msg="invalid distance too far back",Re.mode=tr;break}Re.mode=Ve;case Ve:if(vr===0)break e;if(_e=Xe-vr,Re.offset>_e){if(_e=Re.offset-_e,_e>Re.whave&&Re.sane){Ke.msg="invalid distance too far back",Re.mode=tr;break}_e>Re.wnext?(_e-=Re.wnext,ct=Re.wsize-_e):ct=Re.wnext-_e,_e>Re.length&&(_e=Re.length),Dt=Re.window}else Dt=Fe,ct=nr-Re.offset,_e=Re.length;_e>vr&&(_e=vr),vr-=_e,Re.length-=_e;do Fe[nr++]=Dt[ct++];while(--_e);Re.length===0&&(Re.mode=He);break;case Ht:if(vr===0)break e;Fe[nr++]=Re.length,vr--,Re.mode=He;break;case Kt:if(Re.wrap){for(;dt<32;){if(jt===0)break e;jt--,it|=Bt[Ge++]<<dt,dt+=8}if(Xe-=vr,Ke.total_out+=Xe,Re.total+=Xe,Re.wrap&4&&Xe&&(Ke.adler=Re.check=Re.flags?C(Re.check,Fe,Xe,nr-Xe):x(Re.check,Fe,Xe,nr-Xe)),Xe=vr,Re.wrap&4&&(Re.flags?it:ur(it))!==Re.check){Ke.msg="incorrect data check",Re.mode=tr;break}it=0,dt=0}Re.mode=ir;case ir:if(Re.wrap&&Re.flags){for(;dt<32;){if(jt===0)break e;jt--,it+=Bt[Ge++]<<dt,dt+=8}if(Re.wrap&4&&it!==(Re.total&4294967295)){Ke.msg="incorrect length check",Re.mode=tr;break}it=0,dt=0}Re.mode=$t;case $t:Kr=ee;break e;case tr:Kr=ne;break e;case ar:return ae;case gr:default:return ie}return Ke.next_out=nr,Ke.avail_out=vr,Ke.next_in=Ge,Ke.avail_in=jt,Re.hold=it,Re.bits=dt,(Re.wsize||Xe!==Ke.avail_out&&Re.mode<tr&&(Re.mode<Kt||Je!==R))&&ke(Ke,Ke.output,Ke.next_out,Xe-Ke.avail_out),xe-=Ke.avail_in,Xe-=Ke.avail_out,Ke.total_in+=xe,Ke.total_out+=Xe,Re.total+=Xe,Re.wrap&4&&Xe&&(Ke.adler=Re.check=Re.flags?C(Re.check,Fe,Xe,Ke.next_out-Xe):x(Re.check,Fe,Xe,Ke.next_out-Xe)),Ke.data_type=Re.bits+(Re.last?64:0)+(Re.mode===Ee?128:0)+(Re.mode===$e||Re.mode===Te?256:0),(xe===0&&Xe===0||Je===R)&&Kr===H&&(Kr=oe),Kr},et=Ke=>{if(hr(Ke))return ie;let Je=Ke.state;return Je.window&&(Je.window=null),Ke.state=null,H},Ze=(Ke,Je)=>{if(hr(Ke))return ie;const Re=Ke.state;return(Re.wrap&2)===0?ie:(Re.head=Je,Je.done=!1,H)},Qe=(Ke,Je)=>{const Re=Je.length;let Bt,Fe,Ge;return hr(Ke)||(Bt=Ke.state,Bt.wrap!==0&&Bt.mode!==be)?ie:Bt.mode===be&&(Fe=1,Fe=x(Fe,Je,Re,0),Fe!==Bt.check)?ne:(Ge=ke(Ke,Je,Re,Re),Ge?(Bt.mode=ar,ae):(Bt.havedict=1,H))};return inflate.inflateReset=xr,inflate.inflateReset2=Yt,inflate.inflateResetKeep=yr,inflate.inflateInit=mr,inflate.inflateInit2=Jt,inflate.inflate=Be,inflate.inflateEnd=et,inflate.inflateGetHeader=Ze,inflate.inflateSetDictionary=Qe,inflate.inflateInfo="pako inflate (from Nodeca project)",inflate}var gzheader,hasRequiredGzheader;function requireGzheader(){if(hasRequiredGzheader)return gzheader;hasRequiredGzheader=1;function x(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}return gzheader=x,gzheader}var hasRequiredInflate;function requireInflate(){if(hasRequiredInflate)return inflate$1;hasRequiredInflate=1;const x=requireInflate$1(),C=requireCommon(),E=requireStrings(),w=requireMessages(),T=requireZstream(),_=requireGzheader(),S=Object.prototype.toString,{Z_NO_FLUSH:R,Z_FINISH:A,Z_OK:O,Z_STREAM_END:H,Z_NEED_DICT:ee,Z_STREAM_ERROR:te,Z_DATA_ERROR:ie,Z_MEM_ERROR:ne}=requireConstants$1();function ae(fe){this.options=C.assign({chunkSize:1024*64,windowBits:15,to:""},fe||{});const de=this.options;de.raw&&de.windowBits>=0&&de.windowBits<16&&(de.windowBits=-de.windowBits,de.windowBits===0&&(de.windowBits=-15)),de.windowBits>=0&&de.windowBits<16&&!(fe&&fe.windowBits)&&(de.windowBits+=32),de.windowBits>15&&de.windowBits<48&&(de.windowBits&15)===0&&(de.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new T,this.strm.avail_out=0;let ce=x.inflateInit2(this.strm,de.windowBits);if(ce!==O)throw new Error(w[ce]);if(this.header=new _,x.inflateGetHeader(this.strm,this.header),de.dictionary&&(typeof de.dictionary=="string"?de.dictionary=E.string2buf(de.dictionary):S.call(de.dictionary)==="[object ArrayBuffer]"&&(de.dictionary=new Uint8Array(de.dictionary)),de.raw&&(ce=x.inflateSetDictionary(this.strm,de.dictionary),ce!==O)))throw new Error(w[ce])}ae.prototype.push=function(fe,de){const ce=this.strm,pe=this.options.chunkSize,he=this.options.dictionary;let me,ve,ye;if(this.ended)return!1;for(de===~~de?ve=de:ve=de===!0?A:R,S.call(fe)==="[object ArrayBuffer]"?ce.input=new Uint8Array(fe):ce.input=fe,ce.next_in=0,ce.avail_in=ce.input.length;;){for(ce.avail_out===0&&(ce.output=new Uint8Array(pe),ce.next_out=0,ce.avail_out=pe),me=x.inflate(ce,ve),me===ee&&he&&(me=x.inflateSetDictionary(ce,he),me===O?me=x.inflate(ce,ve):me===ie&&(me=ee));ce.avail_in>0&&me===H&&ce.state.wrap>0&&fe[ce.next_in]!==0;)x.inflateReset(ce),me=x.inflate(ce,ve);switch(me){case te:case ie:case ee:case ne:return this.onEnd(me),this.ended=!0,!1}if(ye=ce.avail_out,ce.next_out&&(ce.avail_out===0||me===H))if(this.options.to==="string"){let Se=E.utf8border(ce.output,ce.next_out),Ce=ce.next_out-Se,be=E.buf2string(ce.output,Se);ce.next_out=Ce,ce.avail_out=pe-Ce,Ce&&ce.output.set(ce.output.subarray(Se,Se+Ce),0),this.onData(be)}else this.onData(ce.output.length===ce.next_out?ce.output:ce.output.subarray(0,ce.next_out));if(!(me===O&&ye===0)){if(me===H)return me=x.inflateEnd(this.strm),this.onEnd(me),this.ended=!0,!0;if(ce.avail_in===0)break}}return!0},ae.prototype.onData=function(fe){this.chunks.push(fe)},ae.prototype.onEnd=function(fe){fe===O&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=C.flattenChunks(this.chunks)),this.chunks=[],this.err=fe,this.msg=this.strm.msg};function oe(fe,de){const ce=new ae(de);if(ce.push(fe),ce.err)throw ce.msg||w[ce.err];return ce.result}function le(fe,de){return de=de||{},de.raw=!0,oe(fe,de)}return inflate$1.Inflate=ae,inflate$1.inflate=oe,inflate$1.inflateRaw=le,inflate$1.ungzip=oe,inflate$1.constants=requireConstants$1(),inflate$1}var hasRequiredPako;function requirePako(){if(hasRequiredPako)return pako;hasRequiredPako=1;const{Deflate:x,deflate:C,deflateRaw:E,gzip:w}=requireDeflate(),{Inflate:T,inflate:_,inflateRaw:S,ungzip:R}=requireInflate(),A=requireConstants$1();return pako.Deflate=x,pako.deflate=C,pako.deflateRaw=E,pako.gzip=w,pako.Inflate=T,pako.inflate=_,pako.inflateRaw=S,pako.ungzip=R,pako.constants=A,pako}var hasRequiredZLIBTextCompressor;function requireZLIBTextCompressor(){if(hasRequiredZLIBTextCompressor)return ZLIBTextCompressor;hasRequiredZLIBTextCompressor=1,Object.defineProperty(ZLIBTextCompressor,"__esModule",{value:!0});const x=requirePako();let C=class gc{constructor(w){this.logger=w}compress(w,T){if(T.length>0){const S=Math.min(T.length,gc.MAX_DICTIONARY_SIZE);T=T.slice(0,S)}const _={memLevel:gc.Z_MEM_LEVEL,dictionary:T};return x.deflateRaw(w,_)}decompress(w,T){if(T.length>0){const R=Math.min(T.length,gc.MAX_DICTIONARY_SIZE);T=T.slice(0,R)}const _={to:"string",dictionary:T,chunkSize:4096};let S="";try{S=x.inflateRaw(w,_)}catch(R){this.logger.error(`failed to decompress the string with error: [${R}]`)}return S}};return ZLIBTextCompressor.default=C,C.Z_MEM_LEVEL=9,C.MAX_DICTIONARY_SIZE=31744,ZLIBTextCompressor}var SignalingClientSubscribe={},hasRequiredSignalingClientSubscribe;function requireSignalingClientSubscribe(){if(hasRequiredSignalingClientSubscribe)return SignalingClientSubscribe;hasRequiredSignalingClientSubscribe=1,Object.defineProperty(SignalingClientSubscribe,"__esModule",{value:!0});let x=class{constructor(C,E,w,T,_,S,R,A,O,H){this.attendeeId=C,this.sdpOffer=E,this.audioHost=w,this.audioMuted=T,this.audioCheckin=_,this.receiveStreamIds=S,this.localVideoEnabled=R,this.videoStreamDescriptions=A,this.connectionTypeHasVideo=O,this.compressedSdpOffer=H,this.videoSubscriptionConfiguration=[]}};return SignalingClientSubscribe.default=x,SignalingClientSubscribe}var VideoPreferences={},hasRequiredVideoPreferences;function requireVideoPreferences(){if(hasRequiredVideoPreferences)return VideoPreferences;hasRequiredVideoPreferences=1;var x=VideoPreferences&&VideoPreferences.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(VideoPreferences,"__esModule",{value:!0}),VideoPreferences.VideoPreferences=VideoPreferences.MutableVideoPreferences=VideoPreferences.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=void 0;const C=x(requireSignalingClientVideoSubscriptionConfiguration());function E(R,A,O){if(R.transceiverController.getMidForGroupId===void 0||R.videoStreamIndex.attendeeIdForGroupId===void 0||O===void 0)return[];const H=new Array,ee=new Map,te=new Map;for(const ie of A){const ne=R.transceiverController.getMidForGroupId(ie);if(ne===void 0)continue;const ae=R.videoStreamIndex.attendeeIdForGroupId(ie);ee.set(ae,ne),te.set(ae,ie)}for(const ie of O){const ne=new C.default,ae=ee.get(ie.attendeeId);ae!==void 0&&(ne.mid=ae,ne.attendeeId=ie.attendeeId,ne.groupId=te.get(ie.attendeeId),ne.priority=Number.MAX_SAFE_INTEGER-ie.priority,ne.targetBitrateKbps=ie.targetSizeToBitrateKbps(ie.targetSize),ne.qualityAdaptationPreference=ie.degradationPreference,H.push(ne))}return H}VideoPreferences.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=E;class w{constructor(A=[]){this.items=A}static default(){return new w([])}[Symbol.iterator](){let A=0;const O=this.items;return{next(){return A<O.length?{done:!1,value:O[A++]}:{done:!0,value:null}}}}first(){return this.items[0]}add(A){this.items.push(A)}replaceFirst(A,O){const H=this.items.findIndex(O);H===-1?this.items.push(A):this.has(A)?this.items.splice(H,1):this.items[H]=A}remove(A){this.items=this.items.filter(O=>!O.equals(A))}clear(){this.items=[]}isEmpty(){return this.items.length===0}equals(A){if(A===this)return!0;if(A.items.length!==this.items.length)return!1;for(const O of this.items)if(!A.items.some(H=>H.equals(O)))return!1;return!0}has(A){return this.items.some(O=>O.equals(A))}some(A){return this.items.some(A)}clone(){return new w([...this.items])}sort(){this.items.sort((A,O)=>A.partialCompare(O))}modify(){return new T(this)}}class T{constructor(A=new w){this.items=A,this.copied=!1}cow(){this.copied||(this.items=this.items.clone(),this.copied=!0)}add(A){this.items.has(A)||(this.cow(),this.items.add(A))}replaceFirst(A,O){this.items.has(A)&&!this.items.some(O)||(this.cow(),this.items.replaceFirst(A,O))}remove(A){this.items.has(A)&&(this.cow(),this.items.remove(A))}some(A){return this.items.some(A)}clear(){this.items.isEmpty()||(this.cow(),this.items.clear())}build(){return this.copied&&this.items.sort(),this.copied=!1,this.items}}class _{constructor(A){this.builder=A}add(A){this.builder.add(A)}replaceFirst(A,O){this.builder.replaceFirst(A,O)}remove(A){this.builder.remove(A)}some(A){return this.builder.some(A)}clear(){this.builder.clear()}build(){return new S(this.builder.build())}}VideoPreferences.MutableVideoPreferences=_;let S=class zd{constructor(A){this.items=A}static prepare(){return new _(new T)}static default(){return new zd(w.default())}[Symbol.iterator](){return this.items[Symbol.iterator]()}highestPriority(){var A;return(A=this.items.first())===null||A===void 0?void 0:A.priority}sorted(){return this.items[Symbol.iterator]()}equals(A){return A===this||this.items.equals(A.items)}modify(){return new _(this.items.modify())}some(A){return this.items.some(A)}isEmpty(){return this.items.isEmpty()}clone(){const A=zd.prepare();for(const O of this.items)A.add(O.clone());return A.build()}};return VideoPreferences.VideoPreferences=S,VideoPreferences.default=S,VideoPreferences}var hasRequiredSubscribeAndReceiveSubscribeAckTask;function requireSubscribeAndReceiveSubscribeAckTask(){if(hasRequiredSubscribeAndReceiveSubscribeAckTask)return SubscribeAndReceiveSubscribeAckTask;hasRequiredSubscribeAndReceiveSubscribeAckTask=1;var x=SubscribeAndReceiveSubscribeAckTask&&SubscribeAndReceiveSubscribeAckTask.__awaiter||function(ie,ne,ae,oe){function le(fe){return fe instanceof ae?fe:new ae(function(de){de(fe)})}return new(ae||(ae=Promise))(function(fe,de){function ce(me){try{he(oe.next(me))}catch(ve){de(ve)}}function pe(me){try{he(oe.throw(me))}catch(ve){de(ve)}}function he(me){me.done?fe(me.value):le(me.value).then(ce,pe)}he((oe=oe.apply(ie,ne||[])).next())})},C=SubscribeAndReceiveSubscribeAckTask&&SubscribeAndReceiveSubscribeAckTask.__importDefault||function(ie){return ie&&ie.__esModule?ie:{default:ie}};Object.defineProperty(SubscribeAndReceiveSubscribeAckTask,"__esModule",{value:!0});const E=C(requireMeetingSessionStatus()),w=C(requireMeetingSessionStatusCode()),T=C(requireSDP()),_=C(requireZLIBTextCompressor()),S=requireServerSideNetworkAdaption(),R=C(requireSignalingClientEventType()),A=C(requireSignalingClientSubscribe()),O=requireSignalingProtocol(),H=requireVideoPreferences(),ee=C(requireBaseTask());let te=class extends ee.default{constructor(ie){super(ie.logger),this.context=ie,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new _.default(ie.logger)}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return x(this,void 0,void 0,function*(){let ie="";if(this.context.peer&&this.context.peer.localDescription&&(ie=new T.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().sdp),!this.context.enableSimulcast){let pe=0,he=0;this.context.videoCaptureAndEncodeParameter&&(pe=this.context.videoCaptureAndEncodeParameter.captureFrameRate(),he=this.context.videoCaptureAndEncodeParameter.encodeBitrates()[0]);const me={rid:"hi",maxBitrate:he*1e3,maxFramerate:pe,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([me])}const ne=this.fixUpSubscriptionOrder(ie,this.context.videoSubscriptions),ae=this.context.videoDuplexMode===O.SdkStreamServiceType.TX||this.context.videoDuplexMode===O.SdkStreamServiceType.DUPLEX;let oe,le=ie;if((this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension===void 0||!this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension())&&(le=new T.default(le).withoutDependencyDescriptorRtpHeaderExtension().sdp),this.context.serverSupportsCompression){const pe=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";oe=this.textCompressor.compress(le,pe),this.context.logger.info(`Compressed the SDP message from ${le.length} to ${oe.length} bytes.`),ie=""}this.context.previousSdpOffer=new T.default(ie);const fe=new A.default(this.context.meetingSessionConfiguration.credentials.attendeeId,ie,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,ne,ae,this.context.videoStreamIndex.localStreamDescriptions(),!0,oe);this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption!==void 0&&!S.serverSideNetworkAdaptionIsNoneOrDefault(this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())&&this.context.videoDownlinkBandwidthPolicy.getVideoPreferences!==void 0&&(fe.videoSubscriptionConfiguration=H.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(this.context,ne.map(pe=>pe===0?0:this.context.videoStreamIndex.groupIdForStreamId(pe)),this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(fe)}`),this.context.signalingClient.subscribe(fe);const de=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(de)}`);let ce="";de.compressedSdpAnswer&&de.compressedSdpAnswer.length?(ce=this.textCompressor.decompress(de.compressedSdpAnswer,this.context.previousSdpAnswerAsString),ce.length===0&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${de.compressedSdpAnswer.length} to ${ce.length} bytes.`),this.context.sdpAnswer=ce):this.context.sdpAnswer=de.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(de)})}fixUpSubscriptionOrder(ie,ne){if(this.context.transceiverController.getMidForStreamId===void 0)return ne;const ae=new Map;for(const fe of ne){const de=this.context.transceiverController.getMidForStreamId(fe);if(de===void 0){fe!==0&&this.logger.warn(`Could not find MID for stream ID: ${fe}`);continue}ae.set(de,fe)}const oe=new T.default(ie).mediaSections(),le=[];for(const fe of oe)if(fe.mediaType==="video")if(fe.direction==="recvonly"){const de=ae.get(fe.mid);if(de===void 0){this.logger.warn(`Could not find stream ID for MID: ${fe.mid}`);continue}le.push(de)}else le.push(0);return this.logger.info(`Fixed up ${JSON.stringify(ne)} to ${JSON.stringify(le)} (may be same))}`),le}receiveSubscribeAck(){return new Promise((ie,ne)=>{const ae=this.context;class oe{constructor(de){this.signalingClient=de}cancel(){this.signalingClient.removeObserver(this),ne(new Error("SubscribeAndReceiveSubscribeAckTask got canceled while waiting for SdkSubscribeAckFrame"))}handleSignalingClientEvent(de){if(de.isConnectionTerminated()){const pe=`SubscribeAndReceiveSubscribeAckTask connection was terminated with code ${de.closeCode} and reason: ${de.closeReason}`;ae.logger.warn(pe);let he=w.default.TaskFailed;de.closeCode>=4500&&de.closeCode<4600&&(he=w.default.SignalingInternalServerError),ae.audioVideoController.handleMeetingSessionStatus(new E.default(he),new Error(pe));return}if(de.type!==R.default.ReceivedSignalFrame||de.message.type!==O.SdkSignalFrame.Type.SUBSCRIBE_ACK)return;this.signalingClient.removeObserver(this);const ce=de.message.suback;ie(ce)}}const le=new oe(this.context.signalingClient);this.context.signalingClient.registerObserver(le),this.taskCanceler=le})}};return SubscribeAndReceiveSubscribeAckTask.default=te,SubscribeAndReceiveSubscribeAckTask}var TimeoutTask={},hasRequiredTimeoutTask;function requireTimeoutTask(){if(hasRequiredTimeoutTask)return TimeoutTask;hasRequiredTimeoutTask=1;var x=TimeoutTask&&TimeoutTask.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=TimeoutTask&&TimeoutTask.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(TimeoutTask,"__esModule",{value:!0});const E=C(requireTimeoutScheduler()),w=C(requireBaseTask());let T=class extends w.default{constructor(_,S,R){super(_),this.taskToRunBeforeTimeout=S,this.timeoutMs=R,this.taskName=`Timeout${this.timeoutMs}ms`,S.setParent(this)}cancel(){this.logger.info(`canceling timeout task ${this.name()} subtask ${this.taskToRunBeforeTimeout}`),this.taskToRunBeforeTimeout.cancel()}run(){return x(this,void 0,void 0,function*(){const _=new E.default(this.timeoutMs);_.start(()=>{this.logger.info(`timeout reached for task ${this.name()}`),this.taskToRunBeforeTimeout.cancel()});try{yield this.taskToRunBeforeTimeout.run()}finally{_.stop()}this.logger.info(`timeout task ${this.name()} completed`)})}};return TimeoutTask.default=T,TimeoutTask}var WaitForAttendeePresenceTask={},hasRequiredWaitForAttendeePresenceTask;function requireWaitForAttendeePresenceTask(){if(hasRequiredWaitForAttendeePresenceTask)return WaitForAttendeePresenceTask;hasRequiredWaitForAttendeePresenceTask=1;var x=WaitForAttendeePresenceTask&&WaitForAttendeePresenceTask.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=WaitForAttendeePresenceTask&&WaitForAttendeePresenceTask.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(WaitForAttendeePresenceTask,"__esModule",{value:!0});const E=C(requireMeetingSessionStatusCode()),w=C(requireBaseTask());let T=class extends w.default{constructor(_){super(_.logger),this.context=_,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){const _=new Error(`canceling ${this.name()} due to the meeting status code: ${E.default.NoAttendeePresent}`);this.cancelPromise(_),delete this.cancelPromise}}run(){return x(this,void 0,void 0,function*(){const _=this.context.meetingSessionConfiguration.credentials.attendeeId;return new Promise((S,R)=>{const A=(O,H,ee,te,ie)=>{_===O&&H&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(A),S(),delete this.cancelPromise)};this.cancelPromise=O=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(A),R(O)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(A)})})}};return WaitForAttendeePresenceTask.default=T,WaitForAttendeePresenceTask}var DefaultTransceiverController={},RedundantAudioEncoder={},hasRequiredRedundantAudioEncoder;function requireRedundantAudioEncoder(){if(hasRequiredRedundantAudioEncoder)return RedundantAudioEncoder;hasRequiredRedundantAudioEncoder=1,Object.defineProperty(RedundantAudioEncoder,"__esModule",{value:!0});let x=class Ki{constructor(){this.maxRedPacketSizeBytes=1024,this.maxAudioPayloadSizeBytes=1e3,this.maxRedTimestampOffset=16384,this.redHeaderSizeBytes=4,this.redLastHeaderSizeBytes=1,this.redPacketizationTime=960,this.redPacketDistance=2,this.maxRedEncodings=2,this.redMaxRecoveryDistance=this.redPacketDistance*this.maxRedEncodings+1,this.maxEncodingHistorySize=10,this.numRedundantEncodings=0,this.redundancyEnabled=!0,this.lossReportInterval=48e3*5,this.maxOutOfOrderPacketDistance=16,this.OPUS_BAD_ARG=-1,this.OPUS_INVALID_PACKET=-4,this.OPUS_MAX_OPUS_FRAMES=48,this.OPUS_MAX_FRAME_SIZE_BYTES=1275,this.encodingHistory=new Array,this.opusPayloadType=0,this.redPayloadType=0,this.initializePacketLogs()}static initializeWorker(){Ki.log("Initializing RedundantAudioEncoder");const E=new Ki;self.RTCRtpScriptTransformer&&(self.onrtctransform=w=>{w.transformer.options.type==="SenderTransform"?E.setupSenderTransform(w.transformer.readable,w.transformer.writable):w.transformer.options.type==="ReceiverTransform"?E.setupReceiverTransform(w.transformer.readable,w.transformer.writable):w.transformer.options.type==="PassthroughTransform"&&E.setupPassthroughTransform(w.transformer.readable,w.transformer.writable)}),self.onmessage=w=>{w.data.msgType==="StartRedWorker"?(E.setupSenderTransform(w.data.send.readable,w.data.send.writable),E.setupReceiverTransform(w.data.receive.readable,w.data.receive.writable)):w.data.msgType==="PassthroughTransform"?(E.setupPassthroughTransform(w.data.send.readable,w.data.send.writable),E.setupPassthroughTransform(w.data.receive.readable,w.data.receive.writable)):w.data.msgType==="RedPayloadType"?E.setRedPayloadType(w.data.payloadType):w.data.msgType==="OpusPayloadType"?E.setOpusPayloadType(w.data.payloadType):w.data.msgType==="UpdateNumRedundantEncodings"?E.setNumRedundantEncodings(w.data.numRedundantEncodings):w.data.msgType==="Enable"?E.setRedundancyEnabled(!0):w.data.msgType==="Disable"&&E.setRedundancyEnabled(!1)}}static log(E){Ki.shouldLog&&self.postMessage({type:"REDWorkerLog",log:`[AudioRed] ${E}`})}static getNumRedundantEncodingsForPacketLoss(E){let w=0,T=!1;return E<=8?w=0:E<=18?w=1:E<=75?w=2:(w=0,T=!0),[w,T]}setupPassthroughTransform(E,w){Ki.log("Setting up passthrough transform"),E.pipeTo(w)}setupSenderTransform(E,w){Ki.log("Setting up sender RED transform");const T=new TransformStream({transform:this.senderTransform.bind(this)});E.pipeThrough(T).pipeTo(w)}setupReceiverTransform(E,w){Ki.log("Setting up receiver RED transform");const T=new TransformStream({transform:this.receivePacketLogTransform.bind(this)});E.pipeThrough(T).pipeTo(w)}setRedPayloadType(E){this.redPayloadType=E,Ki.log(`red payload type set to ${this.redPayloadType}`)}setOpusPayloadType(E){this.opusPayloadType=E,Ki.log(`opus payload type set to ${this.opusPayloadType}`)}setNumRedundantEncodings(E){this.numRedundantEncodings=E,this.numRedundantEncodings>this.maxRedEncodings&&(this.numRedundantEncodings=this.maxRedEncodings),Ki.log(`Updated numRedundantEncodings to ${this.numRedundantEncodings}`)}setRedundancyEnabled(E){this.redundancyEnabled=E,Ki.log(`redundancy ${this.redundancyEnabled?"enabled":"disabled"}`)}enqueueAudioFrameIfPayloadSizeIsValid(E,w){E.data.byteLength>this.maxAudioPayloadSizeBytes||w.enqueue(E)}senderTransform(E,w){if(E.getMetadata().payloadType!==this.redPayloadType){this.enqueueAudioFrameIfPayloadSizeIsValid(E,w);return}const T=this.getPrimaryPayload(E.timestamp,E.data);if(!T){this.enqueueAudioFrameIfPayloadSizeIsValid(E,w);return}const _=this.encode(E.timestamp,T);if(!_){this.enqueueAudioFrameIfPayloadSizeIsValid(E,w);return}E.data=_,this.enqueueAudioFrameIfPayloadSizeIsValid(E,w)}getPrimaryPayload(E,w){const T=this.splitEncodings(E,w);return!T||T.length<1?null:T[T.length-1].payload}splitEncodings(E,w,T=!1,_=void 0){const S=new DataView(w);let R=S.byteLength,A=0,O=0,H=0,ee=0,te=!1;const ie=new Array,ne=new Array,ae=new Array;for(;R>0;)if(te=(S.getUint8(ee)&128)===0,te){if((S.getUint8(ee)&127)!==this.opusPayloadType||(A+=this.redLastHeaderSizeBytes,O+=this.redLastHeaderSizeBytes,A>=S.byteLength))return null;H=S.byteLength-A;break}else{if(R<this.redHeaderSizeBytes)return null;const ce=((S.getUint8(ee+2)&3)<<8)+S.getUint8(ee+3);ne.push(ce);const pe=S.getUint16(ee+1)>>2,he=E-pe;ae.push(he),A+=ce+this.redHeaderSizeBytes,O+=this.redHeaderSizeBytes,ee+=this.redHeaderSizeBytes,R-=this.redHeaderSizeBytes}if(!te)return _!==void 0?(ie.push({payload:w,isRedundant:!1,seq:_}),ie):null;let oe=O;for(let ce=0;ce<ae.length;ce++){const pe=new ArrayBuffer(ne[ce]);new Uint8Array(pe).set(new Uint8Array(S.buffer,oe,ne[ce]),0);const he={timestamp:ae[ce],payload:pe,isRedundant:!0};T&&(he.hasFec=this.opusPacketHasFec(new DataView(pe),pe.byteLength)),ie.push(he),oe+=ne[ce]}const le=S.byteLength-H,fe=new ArrayBuffer(H);new Uint8Array(fe).set(new Uint8Array(S.buffer,le,H),0);const de={timestamp:E,payload:fe,isRedundant:!1,seq:_};return T&&(de.hasFec=this.opusPacketHasFec(new DataView(fe),fe.byteLength)),ie.push(de),ie}encode(E,w){const T=w.byteLength;if(T===0||T>=this.maxRedPacketSizeBytes||T>=this.maxAudioPayloadSizeBytes)return null;const _=this.numRedundantEncodings;let S=this.redLastHeaderSizeBytes,R=T,A=this.maxAudioPayloadSizeBytes-T-S;const O=new Array,H=new Array;if(this.redundancyEnabled){let ae=this.uint32WrapAround(E-this.redPacketizationTime*this.redPacketDistance);for(let oe=0;oe<_&&!(this.uint32WrapAround(E-ae)>=this.maxRedTimestampOffset);oe++){let le=ae,fe=this.encodingHistory.find(de=>de.timestamp===le);if(fe||(le=this.uint32WrapAround(ae-this.redPacketizationTime),fe=this.encodingHistory.find(de=>de.timestamp===le)),fe){const de=fe.payload.byteLength;if(A<this.redHeaderSizeBytes+de)break;A-=this.redHeaderSizeBytes+de,S+=this.redHeaderSizeBytes,R+=de,O.unshift(fe.timestamp),H.unshift(fe.payload)}ae-=this.redPacketizationTime*this.redPacketDistance,ae=this.uint32WrapAround(ae)}}const ee=new ArrayBuffer(S+R),te=new DataView(ee);let ie=0;for(let ae=0;ae<O.length;ae++){const oe=E-O[ae];te.setUint8(ie,this.opusPayloadType|128),te.setUint16(ie+1,oe<<2|H[ae].byteLength>>8),te.setUint8(ie+3,H[ae].byteLength&255),ie+=this.redHeaderSizeBytes}te.setUint8(ie,this.opusPayloadType),ie+=this.redLastHeaderSizeBytes;const ne=new Uint8Array(ee);for(let ae=0;ae<H.length;ae++)ne.set(new Uint8Array(H[ae]),ie),ie+=H[ae].byteLength;return ne.set(new Uint8Array(w),ie),ie+=w.byteLength,ie!==S+R?null:(this.updateEncodingHistory(E,w),ee)}updateEncodingHistory(E,w){for(const _ of this.encodingHistory){const S=this.redPacketizationTime*this.redMaxRecoveryDistance;if(E-_.timestamp>=S)this.encodingHistory.shift();else break}const T=new DataView(w);(this.opusPacketIsCeltOnly(T)||this.opusPacketHasVoiceActivity(T,T.byteLength)>0)&&(this.encodingHistory.length+1>this.maxEncodingHistorySize&&(this.encodingHistory.length=0),this.encodingHistory.push({timestamp:E,payload:w}))}initializePacketLogs(){const E=this.maxOutOfOrderPacketDistance+this.redMaxRecoveryDistance;this.primaryPacketLog={window:new Array(E),index:0,windowSize:E},this.redRecoveryLog={window:new Array(E),index:0,windowSize:E},this.fecRecoveryLog={window:new Array(E),index:0,windowSize:E},this.totalAudioPacketsExpected=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}receivePacketLogTransform(E,w){const T=E.getMetadata();if(T.payloadType!==this.redPayloadType){this.enqueueAudioFrameIfPayloadSizeIsValid(E,w);return}const _=this.splitEncodings(E.timestamp,E.data,!0,T.sequenceNumber);if(!_){this.enqueueAudioFrameIfPayloadSizeIsValid(E,w);return}for(let S=_.length-1;S>=0;S--)this.updateLossStats(_[S])&&(this.updateRedStats(_[S]),this.updateFecStats(_[S]));this.maybeReportLossStats(T.synchronizationSource,_[_.length-1].timestamp),this.enqueueAudioFrameIfPayloadSizeIsValid(E,w)}updateLossStats(E){if(E.isRedundant)return!0;const w=E.timestamp,T=E.seq;if(this.totalAudioPacketsExpected===0)return this.totalAudioPacketsExpected=1,this.newestSequenceNumber=T,this.addTimestamp(this.primaryPacketLog,w),!0;const _=this.int16(T-this.newestSequenceNumber);return _<-this.maxOutOfOrderPacketDistance?!1:(_<0?this.hasTimestamp(this.primaryPacketLog,w)||(this.totalAudioPacketsLost>0&&this.totalAudioPacketsLost--,this.addTimestamp(this.primaryPacketLog,w),this.removeFromRecoveryWindows(w)):_>1&&(this.totalAudioPacketsLost+=_-1),_>0&&(this.totalAudioPacketsExpected+=_,this.newestSequenceNumber=E.seq,this.addTimestamp(this.primaryPacketLog,w)),!0)}updateRedStats(E){if(!E.isRedundant||this.totalAudioPacketsLost===0)return;const w=E.timestamp;this.hasTimestamp(this.primaryPacketLog,w)||(this.hasTimestamp(this.redRecoveryLog,w)||(this.totalAudioPacketsRecoveredRed++,this.addTimestamp(this.redRecoveryLog,w)),this.removeTimestamp(this.fecRecoveryLog,w)&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--)}updateFecStats(E){if(!E.hasFec||this.totalAudioPacketsLost===0)return;const w=E.timestamp-this.redPacketizationTime;this.hasTimestamp(this.primaryPacketLog,w)||this.hasTimestamp(this.redRecoveryLog,w)||this.hasTimestamp(this.fecRecoveryLog,w)||(this.totalAudioPacketsRecoveredFec++,this.addTimestamp(this.fecRecoveryLog,w))}maybeReportLossStats(E,w){w===void 0||w-this.lastLossReportTimestamp<this.lossReportInterval||(Ki.shouldReportStats&&self.postMessage({type:"RedundantAudioEncoderStats",ssrc:E,totalAudioPacketsLost:this.totalAudioPacketsLost,totalAudioPacketsExpected:this.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.totalAudioPacketsRecoveredFec}),this.lastLossReportTimestamp=w)}addTimestamp(E,w){w!==void 0&&(E.window[E.index]=w,E.index=(E.index+1)%E.windowSize)}hasTimestamp(E,w){return!!E.window.find(T=>T===w)}removeTimestamp(E,w){const T=E.window.indexOf(w);return T>=0?(E.window[T]=void 0,!0):!1}removeFromRecoveryWindows(E){let w=this.removeTimestamp(this.redRecoveryLog,E);w&&this.totalAudioPacketsRecoveredRed>0&&this.totalAudioPacketsRecoveredRed--,w=this.removeTimestamp(this.fecRecoveryLog,E),w&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--}uint32WrapAround(E){let w=E;return E>=4294967296?w=E-4294967296:E<0&&(w=4294967296+E),w}int16(E){return E<<16>>16}opusPacketIsCeltOnly(E){return!!(E.getUint8(0)&128)}opusPacketGetSamplesPerFrame(E,w){w=Math.round(w),w=Math.min(Math.max(w,-Math.pow(2,32)),Math.pow(2,32)-1);let T,_;return this.opusPacketIsCeltOnly(E)?(_=E.getUint8(0)>>3&3,T=(w<<_)/400):(E.getUint8(0)&96)===96?T=E.getUint8(0)&8?w/50:w/100:(_=E.getUint8(0)>>3&3,_===3?T=w*60/1e3:T=(w<<_)/100),T}opusNumSilkFrames(E){let w=this.opusPacketGetSamplesPerFrame(E,48e3)/48;switch(w<10&&(w=10),w){case 10:case 20:return 1;case 40:return 2;case 60:return 3;default:return 0}}opusPacketGetNumChannels(E){return E.getUint8(0)&4?2:1}opusParseSize(E,w,T,_){return T<1?(_[0]=-1,-1):E.getUint8(w)<252?(_[0]=E.getUint8(w),1):T<2?(_[0]=-1,-1):(_[0]=4*E.getUint8(w+1)+E.getUint8(w),2)}opusPacketParseImpl(E,w,T,_,S,R,A,O){if(!R||w<0)return this.OPUS_BAD_ARG;if(w===0)return this.OPUS_INVALID_PACKET;let H,ee,te=0,ie=!1;const ne=E.getUint8(0);_&&(_[0]=ne);let ae=w-1,oe=1,le=ae;switch(ne&3){case 0:H=1;break;case 1:if(H=2,ie=!0,!T){if(ae&1)return this.OPUS_INVALID_PACKET;le=ae/2,R[0][0]=le}break;case 2:if(H=2,ee=this.opusParseSize(E,oe,ae,R[0]),ae-=ee,R[0][0]<0||R[0][0]>ae)return this.OPUS_INVALID_PACKET;oe+=ee,le=ae-R[0][0];break;default:if(ae<1)return this.OPUS_INVALID_PACKET;const fe=E.getUint8(oe++);if(--ae,H=fe&63,H<=0)return this.OPUS_INVALID_PACKET;if(this.opusPacketGetSamplesPerFrame(E,48e3)*H>5760)return this.OPUS_INVALID_PACKET;if(fe&64){let de,ce;do{if(ae<=0)return this.OPUS_INVALID_PACKET;de=E.getUint8(oe++),--ae,ce=de===255?254:de,ae-=ce,te+=ce}while(de===255)}if(ae<0)return this.OPUS_INVALID_PACKET;if(ie=!(fe&128),ie){if(!T){if(le=Math.trunc(ae/H),le*H!==ae)return this.OPUS_INVALID_PACKET;for(let de=0;de<H-1;++de)R[de][0]=le}}else{le=ae;for(let de=0;de<H-1;++de){if(ee=this.opusParseSize(E,oe,ae,R[de]),ae-=ee,R[de][0]<0||R[de][0]>ae)return this.OPUS_INVALID_PACKET;oe+=ee,le-=ee+R[de][0]}if(le<0)return this.OPUS_INVALID_PACKET}}if(T){if(ee=this.opusParseSize(E,oe,ae,R[H-1]),ae-=ee,R[H-1][0]<0||R[H-1][0]>ae)return this.OPUS_INVALID_PACKET;if(oe+=ee,ie){if(R[H-1][0]*H>ae)return this.OPUS_INVALID_PACKET;for(let fe=0;fe<H-1;++fe)R[fe][0]=R[H-1][0]}else if(!(ee+R[H-1][0]<=le))return this.OPUS_INVALID_PACKET}else{if(le>this.OPUS_MAX_FRAME_SIZE_BYTES)return this.OPUS_INVALID_PACKET;R[H-1][0]=le}A&&(A[0]=oe);for(let fe=0;fe<H;++fe)S&&(S[fe][0]=oe),oe+=R[fe][0];return O&&(O[0]=oe+te),H}opusPacketParse(E,w,T,_,S,R){return this.opusPacketParseImpl(E,w,!1,T,_,S,R,null)}opusPacketHasVoiceActivity(E,w){if(!E||w<=0)return 0;if(this.opusPacketIsCeltOnly(E))return-1;const T=this.opusNumSilkFrames(E);if(T===0)return-1;const _=new Array(this.OPUS_MAX_OPUS_FRAMES),S=new Array(this.OPUS_MAX_OPUS_FRAMES);for(let A=0;A<this.OPUS_MAX_OPUS_FRAMES;++A)_[A]=[void 0],S[A]=[void 0];const R=this.opusPacketParse(E,w,null,_,S,null);if(R<0)return-1;for(let A=0;A<R;++A)if(!(S[A][0]<1)&&(E.getUint8(_[A][0])>>8-T||this.opusPacketGetNumChannels(E)===2&&E.getUint8(_[A][0])<<T+1>>8-T))return 1;return 0}opusPacketHasFec(E,w){if(!E||w<=0||this.opusPacketIsCeltOnly(E))return!1;const T=new Array(this.OPUS_MAX_OPUS_FRAMES),_=new Array(this.OPUS_MAX_OPUS_FRAMES);for(let A=0;A<this.OPUS_MAX_OPUS_FRAMES;++A)T[A]=[void 0],_[A]=[void 0];if(this.opusPacketParse(E,w,null,T,_,null)<0||_[0][0]<=1)return!1;const S=this.opusNumSilkFrames(E);if(S===0)return!1;const R=this.opusPacketGetNumChannels(E);if(R!==1&&R!==2)return!1;for(let A=0;A<R;A++)if(E.getUint8(T[0][0])&128>>(A+1)*(S+1)-1)return!0;return!1}};return RedundantAudioEncoder.default=x,x.shouldLog=!1,x.shouldReportStats=!1,RedundantAudioEncoder}var RedundantAudioEncoderWorkerCode={},hasRequiredRedundantAudioEncoderWorkerCode;function requireRedundantAudioEncoderWorkerCode(){if(hasRequiredRedundantAudioEncoderWorkerCode)return RedundantAudioEncoderWorkerCode;hasRequiredRedundantAudioEncoderWorkerCode=1,Object.defineProperty(RedundantAudioEncoderWorkerCode,"__esModule",{value:!0});const x=`class RedundantAudioEncoder {
    constructor() {
        // Each payload must be less than 1024 bytes to fit the 10 bit block length
        this.maxRedPacketSizeBytes = 1 << 10;
        // Limit payload to 1000 bytes to handle small MTU. 1000 is chosen because in Chromium-based browsers, writing audio
        // payloads larger than 1000 bytes using the WebRTC Insertable Streams API (which is used to enable dynamic audio
        // redundancy) will cause an error to be thrown and cause audio flow to permanently stop. See
        // https://crbug.com/1248479.
        this.maxAudioPayloadSizeBytes = 1000;
        // Each payload can encode a timestamp delta of 14 bits
        this.maxRedTimestampOffset = 1 << 14;
        // 4 byte RED header
        this.redHeaderSizeBytes = 4;
        // reduced size for last RED header
        this.redLastHeaderSizeBytes = 1;
        // P-Time for Opus 20 msec packets
        // We do not support other p-times or clock rates
        this.redPacketizationTime = 960;
        // distance between redundant payloads, Opus FEC handles a distance of 1
        // TODO(https://issues.amazon.com/issues/ChimeSDKAudio-55):
        // Consider making this dynamic
        this.redPacketDistance = 2;
        // maximum number of redundant payloads per RTP packet
        this.maxRedEncodings = 2;
        // Maximum number of encodings that can be recovered with a single RED packet, assuming the primary and redundant
        // payloads have FEC.
        this.redMaxRecoveryDistance = this.redPacketDistance * this.maxRedEncodings + 1;
        // maximum history of prior payloads to keep
        // generally we will expire old entries based on timestamp
        // this limit is in place just to make sure the history does not
        // grow too large in the case of erroneous timestamp inputs
        this.maxEncodingHistorySize = 10;
        // Current number of encodings we want to send
        // to the remote end. This will be dynamically
        // updated through the setNumEncodingsFromPacketloss API
        this.numRedundantEncodings = 0;
        // Used to enable or disable redundancy
        // in response to very high packet loss events
        this.redundancyEnabled = true;
        // Loss stats are reported to the main thread every 5 seconds.
        // Since timestamp differences between 2 consecutive packets
        // give us the number of samples in each channel, 1 second
        // is equivalent to 48000 samples:
        // P-time * (1000ms/1s)
        // = (960 samples/20ms) * (1000ms/1s)
        // = 48000 samples/s
        this.lossReportInterval = 48000 * 5;
        // Maximum distance of a packet from the most recent packet timestamp
        // that we will consider for recovery.
        this.maxOutOfOrderPacketDistance = 16;
        /**
         * Below are Opus helper methods and constants.
         */
        this.OPUS_BAD_ARG = -1;
        this.OPUS_INVALID_PACKET = -4;
        // Max number of Opus frames in an Opus packet is 48 (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5).
        this.OPUS_MAX_OPUS_FRAMES = 48;
        // Max number of bytes that any individual Opus frame can have.
        this.OPUS_MAX_FRAME_SIZE_BYTES = 1275;
        this.encodingHistory = new Array();
        this.opusPayloadType = 0;
        this.redPayloadType = 0;
        this.initializePacketLogs();
    }
    /**
     * Creates an instance of RedundantAudioEncoder and sets up callbacks.
     */
    static initializeWorker() {
        RedundantAudioEncoder.log('Initializing RedundantAudioEncoder');
        const encoder = new RedundantAudioEncoder();
        // RED encoding is done using WebRTC Encoded Transform
        // https://github.com/w3c/webrtc-encoded-transform/blob/main/explainer.md
        // Check the DedicatedWorkerGlobalScope for existence of
        // RTCRtpScriptTransformer interface. If exists, then
        // RTCRtpScriptTransform is supported by this browser.
        // @ts-ignore
        if (self.RTCRtpScriptTransformer) {
            // @ts-ignore
            self.onrtctransform = (event) => {
                if (event.transformer.options.type === 'SenderTransform') {
                    encoder.setupSenderTransform(event.transformer.readable, event.transformer.writable);
                }
                else if (event.transformer.options.type === 'ReceiverTransform') {
                    encoder.setupReceiverTransform(event.transformer.readable, event.transformer.writable);
                }
                else if (event.transformer.options.type === 'PassthroughTransform') {
                    encoder.setupPassthroughTransform(event.transformer.readable, event.transformer.writable);
                }
            };
        }
        self.onmessage = (event) => {
            if (event.data.msgType === 'StartRedWorker') {
                encoder.setupSenderTransform(event.data.send.readable, event.data.send.writable);
                encoder.setupReceiverTransform(event.data.receive.readable, event.data.receive.writable);
            }
            else if (event.data.msgType === 'PassthroughTransform') {
                encoder.setupPassthroughTransform(event.data.send.readable, event.data.send.writable);
                encoder.setupPassthroughTransform(event.data.receive.readable, event.data.receive.writable);
            }
            else if (event.data.msgType === 'RedPayloadType') {
                encoder.setRedPayloadType(event.data.payloadType);
            }
            else if (event.data.msgType === 'OpusPayloadType') {
                encoder.setOpusPayloadType(event.data.payloadType);
            }
            else if (event.data.msgType === 'UpdateNumRedundantEncodings') {
                encoder.setNumRedundantEncodings(event.data.numRedundantEncodings);
            }
            else if (event.data.msgType === 'Enable') {
                encoder.setRedundancyEnabled(true);
            }
            else if (event.data.msgType === 'Disable') {
                encoder.setRedundancyEnabled(false);
            }
        };
    }
    /**
     * Post logs to the main thread
     */
    static log(msg) {
        if (RedundantAudioEncoder.shouldLog) {
            // @ts-ignore
            self.postMessage({
                type: 'REDWorkerLog',
                log: \`[AudioRed] \${msg}\`,
            });
        }
    }
    /**
     * Returns the number of encodings based on packetLoss value. This is used by \`DefaultTransceiverController\` to
     * determine when to alert the encoder to update the number of encodings. It also determines if we need to
     * turn off red in cases of very high packet loss to avoid congestion collapse.
     */
    static getNumRedundantEncodingsForPacketLoss(packetLoss) {
        let recommendedRedundantEncodings = 0;
        let shouldTurnOffRed = false;
        if (packetLoss <= 8) {
            recommendedRedundantEncodings = 0;
        }
        else if (packetLoss <= 18) {
            recommendedRedundantEncodings = 1;
        }
        else if (packetLoss <= 75) {
            recommendedRedundantEncodings = 2;
        }
        else {
            recommendedRedundantEncodings = 0;
            shouldTurnOffRed = true;
        }
        return [recommendedRedundantEncodings, shouldTurnOffRed];
    }
    /**
     * Sets up a passthrough (no-op) transform for the given streams.
     */
    setupPassthroughTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up passthrough transform');
        readable.pipeTo(writable);
    }
    /**
     * Sets up the transform stream and pipes the outgoing encoded audio frames through the transform function.
     */
    setupSenderTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up sender RED transform');
        const transformStream = new TransformStream({
            transform: this.senderTransform.bind(this),
        });
        readable.pipeThrough(transformStream).pipeTo(writable);
        return;
    }
    /**
     * Sets up the transform stream and pipes the received encoded audio frames through the transform function.
     */
    setupReceiverTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up receiver RED transform');
        const transformStream = new TransformStream({
            transform: this.receivePacketLogTransform.bind(this),
        });
        readable.pipeThrough(transformStream).pipeTo(writable);
        return;
    }
    /**
     * Set the RED payload type ideally obtained from local offer.
     */
    setRedPayloadType(payloadType) {
        this.redPayloadType = payloadType;
        RedundantAudioEncoder.log(\`red payload type set to \${this.redPayloadType}\`);
    }
    /**
     * Set the opus payload type ideally obtained from local offer.
     */
    setOpusPayloadType(payloadType) {
        this.opusPayloadType = payloadType;
        RedundantAudioEncoder.log(\`opus payload type set to \${this.opusPayloadType}\`);
    }
    /**
     * Set the number of redundant encodings
     */
    setNumRedundantEncodings(numRedundantEncodings) {
        this.numRedundantEncodings = numRedundantEncodings;
        if (this.numRedundantEncodings > this.maxRedEncodings) {
            this.numRedundantEncodings = this.maxRedEncodings;
        }
        RedundantAudioEncoder.log(\`Updated numRedundantEncodings to \${this.numRedundantEncodings}\`);
    }
    /**
     * Enable or disable redundancy in response to
     * high packet loss event.
     */
    setRedundancyEnabled(enabled) {
        this.redundancyEnabled = enabled;
        RedundantAudioEncoder.log(\`redundancy \${this.redundancyEnabled ? 'enabled' : 'disabled'}\`);
    }
    /**
     * Helper function to only enqueue audio frames if they do not exceed the audio payload byte limit imposed by
     * Chromium-based browsers. Chromium will throw an error (https://crbug.com/1248479) if an audio payload larger than
     * 1000 bytes is enqueued. Any controller that attempts to enqueue an audio payload larger than 1000 bytes will
     * encounter this error and will permanently stop sending or receiving audio.
     */
    enqueueAudioFrameIfPayloadSizeIsValid(
    // @ts-ignore
    frame, controller) {
        if (frame.data.byteLength > this.maxAudioPayloadSizeBytes)
            return;
        controller.enqueue(frame);
    }
    /**
     * Receives encoded frames and modifies as needed before sending to transport.
     */
    senderTransform(
    // @ts-ignore
    frame, controller) {
        const frameMetadata = frame.getMetadata();
        // @ts-ignore
        if (frameMetadata.payloadType !== this.redPayloadType) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        const primaryPayloadBuffer = this.getPrimaryPayload(frame.timestamp, frame.data);
        if (!primaryPayloadBuffer) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        const encodedBuffer = this.encode(frame.timestamp, primaryPayloadBuffer);
        /* istanbul ignore next */
        if (!encodedBuffer) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        frame.data = encodedBuffer;
        this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
        return;
    }
    /**
     * Get the primary payload from encoding
     */
    getPrimaryPayload(primaryTimestamp, frame) {
        const encodings = this.splitEncodings(primaryTimestamp, frame);
        if (!encodings || encodings.length < 1)
            return null;
        return encodings[encodings.length - 1].payload;
    }
    /**
     * Split up the encoding received into primary and redundant encodings
     * These will be ordered oldest to newest which is the same ordering
     * in the RTP red payload.
     */
    splitEncodings(primaryTimestamp, frame, getFecInfo = false, primarySequenceNumber = undefined) {
        // process RED headers (according to RFC 2198)
        //   0                   1                   2                   3
        //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //  |F|   block PT  |  timestamp offset         |   block length    |
        //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //
        // last header
        //   0 1 2 3 4 5 6 7
        //  +-+-+-+-+-+-+-+-+
        //  |0|   Block PT  |
        //  +-+-+-+-+-+-+-+-+
        const payload = new DataView(frame);
        let payloadSizeBytes = payload.byteLength;
        let totalPayloadSizeBytes = 0;
        let totalHeaderSizeBytes = 0;
        let primaryPayloadSizeBytes = 0;
        let payloadOffset = 0;
        let gotLastBlock = false;
        const encodings = new Array();
        const redundantEncodingBlockLengths = new Array();
        const redundantEncodingTimestamps = new Array();
        while (payloadSizeBytes > 0) {
            gotLastBlock = (payload.getUint8(payloadOffset) & 0x80) === 0;
            if (gotLastBlock) {
                // Bits 1 through 7 are payload type
                const payloadType = payload.getUint8(payloadOffset) & 0x7f;
                // Unexpected payload type. This is a bad packet.
                if (payloadType !== this.opusPayloadType) {
                    return null;
                }
                totalPayloadSizeBytes += this.redLastHeaderSizeBytes;
                totalHeaderSizeBytes += this.redLastHeaderSizeBytes;
                // Accumulated block lengths are equal to or larger than the buffer, which means there is no primary block. This
                // is a bad packet.
                if (totalPayloadSizeBytes >= payload.byteLength) {
                    return null;
                }
                primaryPayloadSizeBytes = payload.byteLength - totalPayloadSizeBytes;
                break;
            }
            else {
                if (payloadSizeBytes < this.redHeaderSizeBytes) {
                    return null;
                }
                // Bits 22 through 31 are payload length
                const blockLength = ((payload.getUint8(payloadOffset + 2) & 0x03) << 8) + payload.getUint8(payloadOffset + 3);
                redundantEncodingBlockLengths.push(blockLength);
                const timestampOffset = payload.getUint16(payloadOffset + 1) >> 2;
                const timestamp = primaryTimestamp - timestampOffset;
                redundantEncodingTimestamps.push(timestamp);
                totalPayloadSizeBytes += blockLength + this.redHeaderSizeBytes;
                totalHeaderSizeBytes += this.redHeaderSizeBytes;
                payloadOffset += this.redHeaderSizeBytes;
                payloadSizeBytes -= this.redHeaderSizeBytes;
            }
        }
        // The last block was never found. The packet we received
        // does not have a good RED payload.
        if (!gotLastBlock) {
            // Note that sequence numbers only exist for
            // incoming audio frames.
            if (primarySequenceNumber !== undefined) {
                // This could be a possible padding packet used
                // for BWE with a good sequence number.
                // Create a dummy encoding to make sure loss values
                // are calculated correctly by consuming sequence number.
                // Note that for the receive side, we process packets only
                // for loss/recovery calculations and forward the original
                // packet without changing it even in the error case.
                encodings.push({
                    payload: frame,
                    isRedundant: false,
                    seq: primarySequenceNumber,
                });
                return encodings;
            }
            // This is a bad packet.
            return null;
        }
        let redundantPayloadOffset = totalHeaderSizeBytes;
        for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
            const redundantPayloadBuffer = new ArrayBuffer(redundantEncodingBlockLengths[i]);
            const redundantPayloadArray = new Uint8Array(redundantPayloadBuffer);
            redundantPayloadArray.set(new Uint8Array(payload.buffer, redundantPayloadOffset, redundantEncodingBlockLengths[i]), 0);
            const encoding = {
                timestamp: redundantEncodingTimestamps[i],
                payload: redundantPayloadBuffer,
                isRedundant: true,
            };
            if (getFecInfo) {
                encoding.hasFec = this.opusPacketHasFec(new DataView(redundantPayloadBuffer), redundantPayloadBuffer.byteLength);
            }
            encodings.push(encoding);
            redundantPayloadOffset += redundantEncodingBlockLengths[i];
        }
        const primaryPayloadOffset = payload.byteLength - primaryPayloadSizeBytes;
        const primaryPayloadBuffer = new ArrayBuffer(primaryPayloadSizeBytes);
        const primaryArray = new Uint8Array(primaryPayloadBuffer);
        primaryArray.set(new Uint8Array(payload.buffer, primaryPayloadOffset, primaryPayloadSizeBytes), 0);
        const encoding = {
            timestamp: primaryTimestamp,
            payload: primaryPayloadBuffer,
            isRedundant: false,
            seq: primarySequenceNumber,
        };
        if (getFecInfo) {
            encoding.hasFec = this.opusPacketHasFec(new DataView(primaryPayloadBuffer), primaryPayloadBuffer.byteLength);
        }
        encodings.push(encoding);
        return encodings;
    }
    /**
     * Create a new encoding with current primary payload and the older payloads of choice.
     */
    encode(primaryTimestamp, primaryPayload) {
        const primaryPayloadSize = primaryPayload.byteLength;
        // Payload size needs to be valid.
        if (primaryPayloadSize === 0 ||
            primaryPayloadSize >= this.maxRedPacketSizeBytes ||
            primaryPayloadSize >= this.maxAudioPayloadSizeBytes) {
            return null;
        }
        const numRedundantEncodings = this.numRedundantEncodings;
        let headerSizeBytes = this.redLastHeaderSizeBytes;
        let payloadSizeBytes = primaryPayloadSize;
        let bytesAvailable = this.maxAudioPayloadSizeBytes - primaryPayloadSize - headerSizeBytes;
        const redundantEncodingTimestamps = new Array();
        const redundantEncodingPayloads = new Array();
        // If redundancy is disabled then only send the primary payload
        if (this.redundancyEnabled) {
            // Determine how much redundancy we can fit into our packet
            let redundantTimestamp = this.uint32WrapAround(primaryTimestamp - this.redPacketizationTime * this.redPacketDistance);
            for (let i = 0; i < numRedundantEncodings; i++) {
                // Do not add redundant encodings that are beyond the maximum timestamp offset.
                if (this.uint32WrapAround(primaryTimestamp - redundantTimestamp) >= this.maxRedTimestampOffset) {
                    break;
                }
                let findTimestamp = redundantTimestamp;
                let encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
                if (!encoding) {
                    // If not found or not important then look for the previous packet.
                    // The current packet may have included FEC for the previous, so just
                    // use the previous packet instead provided that it has voice activity.
                    findTimestamp = this.uint32WrapAround(redundantTimestamp - this.redPacketizationTime);
                    encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
                }
                if (encoding) {
                    const redundantEncodingSizeBytes = encoding.payload.byteLength;
                    // Only add redundancy if there are enough bytes available.
                    if (bytesAvailable < this.redHeaderSizeBytes + redundantEncodingSizeBytes)
                        break;
                    bytesAvailable -= this.redHeaderSizeBytes + redundantEncodingSizeBytes;
                    headerSizeBytes += this.redHeaderSizeBytes;
                    payloadSizeBytes += redundantEncodingSizeBytes;
                    redundantEncodingTimestamps.unshift(encoding.timestamp);
                    redundantEncodingPayloads.unshift(encoding.payload);
                }
                redundantTimestamp -= this.redPacketizationTime * this.redPacketDistance;
                redundantTimestamp = this.uint32WrapAround(redundantTimestamp);
            }
        }
        const redPayloadBuffer = new ArrayBuffer(headerSizeBytes + payloadSizeBytes);
        const redPayloadView = new DataView(redPayloadBuffer);
        // Add redundant encoding header(s) to new buffer
        let redPayloadOffset = 0;
        for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
            const timestampDelta = primaryTimestamp - redundantEncodingTimestamps[i];
            redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType | 0x80);
            redPayloadView.setUint16(redPayloadOffset + 1, (timestampDelta << 2) | (redundantEncodingPayloads[i].byteLength >> 8));
            redPayloadView.setUint8(redPayloadOffset + 3, redundantEncodingPayloads[i].byteLength & 0xff);
            redPayloadOffset += this.redHeaderSizeBytes;
        }
        // Add primary encoding header to new buffer
        redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType);
        redPayloadOffset += this.redLastHeaderSizeBytes;
        // Add redundant payload(s) to new buffer
        const redPayloadArray = new Uint8Array(redPayloadBuffer);
        for (let i = 0; i < redundantEncodingPayloads.length; i++) {
            redPayloadArray.set(new Uint8Array(redundantEncodingPayloads[i]), redPayloadOffset);
            redPayloadOffset += redundantEncodingPayloads[i].byteLength;
        }
        // Add primary payload to new buffer
        redPayloadArray.set(new Uint8Array(primaryPayload), redPayloadOffset);
        redPayloadOffset += primaryPayload.byteLength;
        /* istanbul ignore next */
        // Sanity check that we got the expected total payload size.
        if (redPayloadOffset !== headerSizeBytes + payloadSizeBytes)
            return null;
        this.updateEncodingHistory(primaryTimestamp, primaryPayload);
        return redPayloadBuffer;
    }
    /**
     * Update the encoding history with the latest primary encoding
     */
    updateEncodingHistory(primaryTimestamp, primaryPayload) {
        // Remove encodings from the history if they are too old.
        for (const encoding of this.encodingHistory) {
            const maxTimestampDelta = this.redPacketizationTime * this.redMaxRecoveryDistance;
            if (primaryTimestamp - encoding.timestamp >= maxTimestampDelta) {
                this.encodingHistory.shift();
            }
            else {
                break;
            }
        }
        // Only add an encoding to the history if the encoding is deemed to be important. An encoding is important if it is
        // a CELT-only packet or contains voice activity.
        const packet = new DataView(primaryPayload);
        if (this.opusPacketIsCeltOnly(packet) ||
            this.opusPacketHasVoiceActivity(packet, packet.byteLength) > 0) {
            // Check if adding an encoding will cause the length of the encoding history to exceed the maximum history size.
            // This is not expected to happen but could occur if we get incorrect timestamps. We want to make sure our memory
            // usage is bounded. In this case, just clear the history and start over from empty.
            if (this.encodingHistory.length + 1 > this.maxEncodingHistorySize)
                this.encodingHistory.length = 0;
            this.encodingHistory.push({ timestamp: primaryTimestamp, payload: primaryPayload });
        }
    }
    /**
     * Initialize packet logs and metric values.
     */
    initializePacketLogs() {
        // The extra space from the max RED recovery distance is to ensure that we do not incorrectly count recovery for
        // packets that have already been received but are outside of the max out-of-order distance.
        const packetLogSize = this.maxOutOfOrderPacketDistance + this.redMaxRecoveryDistance;
        this.primaryPacketLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.redRecoveryLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.fecRecoveryLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.totalAudioPacketsExpected = 0;
        this.totalAudioPacketsLost = 0;
        this.totalAudioPacketsRecoveredRed = 0;
        this.totalAudioPacketsRecoveredFec = 0;
    }
    /**
     * Receives encoded frames from the server
     * and adds the timestamps to a packet log
     * to calculate an approximate recovery metric.
     */
    receivePacketLogTransform(
    // @ts-ignore
    frame, controller) {
        const frameMetadata = frame.getMetadata();
        // @ts-ignore
        if (frameMetadata.payloadType !== this.redPayloadType) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        // @ts-ignore
        const encodings = this.splitEncodings(frame.timestamp, frame.data, 
        /*getFecInfo*/ true, frameMetadata.sequenceNumber);
        if (!encodings) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        for (let i = encodings.length - 1; i >= 0; i--) {
            if (this.updateLossStats(encodings[i])) {
                this.updateRedStats(encodings[i]);
                this.updateFecStats(encodings[i]);
            }
        }
        this.maybeReportLossStats(frameMetadata.synchronizationSource, encodings[encodings.length - 1].timestamp);
        this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
    }
    /**
     * Adds a timestamp to the primary packet log.
     * This also updates totalAudioPacketsLost and totalAudioPacketsExpected by looking
     * at the difference between timestamps.
     *
     * @param encoding : The encoding to be analyzed
     * @returns false if sequence number was greater than max out of order distance
     *          true otherwise
     */
    updateLossStats(encoding) {
        if (encoding.isRedundant)
            return true;
        const timestamp = encoding.timestamp;
        const seq = encoding.seq;
        if (this.totalAudioPacketsExpected === 0) {
            this.totalAudioPacketsExpected = 1;
            this.newestSequenceNumber = seq;
            this.addTimestamp(this.primaryPacketLog, timestamp);
            return true;
        }
        const diff = this.int16(seq - this.newestSequenceNumber);
        if (diff < -this.maxOutOfOrderPacketDistance)
            return false;
        if (diff < 0) {
            if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
                if (this.totalAudioPacketsLost > 0)
                    this.totalAudioPacketsLost--;
                this.addTimestamp(this.primaryPacketLog, timestamp);
                this.removeFromRecoveryWindows(timestamp);
            }
        }
        else if (diff > 1) {
            this.totalAudioPacketsLost += diff - 1;
        }
        if (diff > 0) {
            this.totalAudioPacketsExpected += diff;
            this.newestSequenceNumber = encoding.seq;
            this.addTimestamp(this.primaryPacketLog, timestamp);
        }
        return true;
    }
    /**
     * Adds a timestamp to the red recovery log if it is not present in
     * the primary packet log and if it's not too old.
     *
     * @param encoding : The encoding to be analyzed
     */
    updateRedStats(encoding) {
        if (!encoding.isRedundant || this.totalAudioPacketsLost === 0)
            return;
        const timestamp = encoding.timestamp;
        if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
            if (!this.hasTimestamp(this.redRecoveryLog, timestamp)) {
                this.totalAudioPacketsRecoveredRed++;
                this.addTimestamp(this.redRecoveryLog, timestamp);
            }
            if (this.removeTimestamp(this.fecRecoveryLog, timestamp)) {
                /* istanbul ignore else */
                if (this.totalAudioPacketsRecoveredFec > 0)
                    this.totalAudioPacketsRecoveredFec--;
            }
        }
    }
    /**
     * Adds a timestamp to the fec recovery log if it is not present in
     * the primary packet log and red recovery log and if it is not too old.
     *
     * @param encoding : The encoding to be analyzed
     */
    updateFecStats(encoding) {
        if (!encoding.hasFec || this.totalAudioPacketsLost === 0)
            return;
        const fecTimestamp = encoding.timestamp - this.redPacketizationTime;
        if (this.hasTimestamp(this.primaryPacketLog, fecTimestamp) ||
            this.hasTimestamp(this.redRecoveryLog, fecTimestamp) ||
            this.hasTimestamp(this.fecRecoveryLog, fecTimestamp)) {
            return;
        }
        this.totalAudioPacketsRecoveredFec++;
        this.addTimestamp(this.fecRecoveryLog, fecTimestamp);
    }
    /**
     * Reports loss metrics to DefaultTransceiverController
     *
     * @param timestamp : Timestamp of most recent primary packet
     */
    maybeReportLossStats(ssrc, timestamp) {
        if (timestamp === undefined ||
            timestamp - this.lastLossReportTimestamp < this.lossReportInterval)
            return;
        /* istanbul ignore next */
        if (RedundantAudioEncoder.shouldReportStats) {
            // @ts-ignore
            self.postMessage({
                type: 'RedundantAudioEncoderStats',
                ssrc,
                totalAudioPacketsLost: this.totalAudioPacketsLost,
                totalAudioPacketsExpected: this.totalAudioPacketsExpected,
                totalAudioPacketsRecoveredRed: this.totalAudioPacketsRecoveredRed,
                totalAudioPacketsRecoveredFec: this.totalAudioPacketsRecoveredFec,
            });
        }
        this.lastLossReportTimestamp = timestamp;
    }
    /**
     * Adds a timestamp to a packet log
     *
     * @param packetLog : The packetlog to add the timestamp to
     * @param timestamp : The timestamp that should be added
     */
    addTimestamp(packetLog, timestamp) {
        if (timestamp === undefined) {
            return;
        }
        packetLog.window[packetLog.index] = timestamp;
        packetLog.index = (packetLog.index + 1) % packetLog.windowSize;
    }
    /**
     * Checks if a timestamp is in a packetlog
     *
     * @param packetLog : The packetlog to search
     * @param timestamp : The timestamp to search for
     * @returns true if timestamp is present, false otherwise
     */
    hasTimestamp(packetLog, timestamp) {
        const element = packetLog.window.find(t => t === timestamp);
        return !!element;
    }
    /**
     * Removes a timestamp from a packet log
     *
     * @param packetLog : The packetlog from which the timestamp should be removed
     * @param timestamp : The timestamp to be removed
     * @returns true if timestamp was present in the log and removed, false otherwise
     */
    removeTimestamp(packetLog, timestamp) {
        const index = packetLog.window.indexOf(timestamp);
        if (index >= 0) {
            packetLog.window[index] = undefined;
            return true;
        }
        return false;
    }
    /**
     * Removes a timestamp from red and fec recovery windows.
     *
     * @param timestamp : The timestamp to be removed
     */
    removeFromRecoveryWindows(timestamp) {
        let removed = this.removeTimestamp(this.redRecoveryLog, timestamp);
        if (removed) {
            if (this.totalAudioPacketsRecoveredRed > 0)
                this.totalAudioPacketsRecoveredRed--;
        }
        removed = this.removeTimestamp(this.fecRecoveryLog, timestamp);
        if (removed) {
            if (this.totalAudioPacketsRecoveredFec > 0)
                this.totalAudioPacketsRecoveredFec--;
        }
    }
    /**
     * Converts the supplied argument to 32-bit unsigned integer
     */
    uint32WrapAround(num) {
        const mod = 4294967296; // 2^32
        let res = num;
        if (num >= mod) {
            res = num - mod;
        }
        else if (num < 0) {
            res = mod + num;
        }
        return res;
    }
    /**
     * Converts the supplied argument to 16-bit signed integer
     */
    int16(num) {
        return (num << 16) >> 16;
    }
    /**
     * Determines if an Opus packet is in CELT-only mode.
     *
     * @param packet Opus packet.
     * @returns \`true\` if the packet is in CELT-only mode.
     */
    opusPacketIsCeltOnly(packet) {
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        // Since CELT-only packets are represented using configurations 16 to 31, the highest 'config' bit will always be 1
        // for CELT-only packets.
        return !!(packet.getUint8(0) & 0x80);
    }
    /**
     * Gets the number of samples per frame from an Opus packet.
     *
     * @param packet Opus packet. This must contain at least one byte of data.
     * @param sampleRateHz 32-bit integer sampling rate in Hz. This must be a multiple of 400 or inaccurate results will
     *                     be returned.
     * @returns Number of samples per frame.
     */
    opusPacketGetSamplesPerFrame(packet, sampleRateHz) {
        // Sample rate must be a 32-bit integer.
        sampleRateHz = Math.round(sampleRateHz);
        sampleRateHz = Math.min(Math.max(sampleRateHz, -(Math.pow(2, 32))), Math.pow(2, 32) - 1);
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        let numSamples;
        let frameSizeOption;
        // Case for CELT-only packet.
        if (this.opusPacketIsCeltOnly(packet)) {
            // The lower 3 'config' bits indicate the frame size option.
            frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
            // The frame size options 0, 1, 2, 3 correspond to frame sizes of 2.5, 5, 10, 20 ms. Notice that the frame sizes
            // can be represented as (2.5 * 2^0), (2.5 * 2^1), (2.5 * 2^2), (2.5 * 2^3) ms. So, the number of samples can be
            // calculated as follows:
            // (sample/s) * (1s/1000ms) * (2.5ms) * 2^(frameSizeOption)
            // = (sample/s) * (1s/400) * 2^(frameSizeOption)
            // = (sample/s) * 2^(frameSizeOption) * (1s/400)
            numSamples = (sampleRateHz << frameSizeOption) / 400;
        }
        // Case for Hybrid packet. Since Hybrid packets are represented using configurations 12 to 15, bits 1 and 2 in the
        // above TOC byte diagram will both be 1.
        else if ((packet.getUint8(0) & 0x60) === 0x60) {
            // In the case of configuration 13 or 15, bit 4 in the above TOC byte diagram will be 1. Configurations 13 and 15
            // correspond to a 20ms frame size, so the number of samples is calculated as follows:
            // (sample/s) * (1s/1000ms) * (20ms)
            // = (sample/s) * (1s/50)
            //
            // In the case of configuration 12 or 14, bit 4 in the above TOC byte diagram will be 0. Configurations 12 and 14
            // correspond to a 10ms frame size, so the number of samples is calculated as follows:
            // (sample/s) * (1s/1000ms) * (10ms)
            // = (sample/s) * (1s/100)
            numSamples = packet.getUint8(0) & 0x08 ? sampleRateHz / 50 : sampleRateHz / 100;
        }
        // Case for SILK-only packet.
        else {
            // The lower 3 'config' bits indicate the frame size option for SILK-only packets.
            frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
            if (frameSizeOption === 3) {
                // Frame size option 3 corresponds to a frame size of 60ms, so the number of samples is calculated as follows:
                // (sample/s) * (1s/1000ms) * (60ms)
                // = (sample/s) * (60ms) * (1s/1000ms)
                numSamples = (sampleRateHz * 60) / 1000;
            }
            else {
                // The frame size options 0, 1, 2 correspond to frame sizes of 10, 20, 40 ms. Notice that the frame sizes can be
                // represented as (10 * 2^0), (10 * 2^1), (10 * 2^2) ms. So, the number of samples can be calculated as follows:
                // (sample/s) * (1s/1000ms) * (10ms) * 2^(frameSizeOption)
                // = (sample/s) * (1s/100) * 2^(frameSizeOption)
                // = (sample/s) * 2^(frameSizeOption) * (1s/100)
                numSamples = (sampleRateHz << frameSizeOption) / 100;
            }
        }
        return numSamples;
    }
    /**
     * Gets the number of SILK frames per Opus frame.
     *
     * @param packet Opus packet.
     * @returns Number of SILK frames per Opus frame.
     */
    opusNumSilkFrames(packet) {
        // For computing the frame length in ms, the sample rate is not important since it cancels out. We use 48 kHz, but
        // any valid sample rate would work.
        //
        // To calculate the length of a frame (with a 48kHz sample rate) in ms:
        // (samples/frame) * (1s/48000 samples) * (1000ms/s)
        // = (samples/frame) * (1000ms/48000 samples)
        // = (samples/frame) * (1ms/48 samples)
        let frameLengthMs = this.opusPacketGetSamplesPerFrame(packet, 48000) / 48;
        if (frameLengthMs < 10)
            frameLengthMs = 10;
        // The number of SILK frames per Opus frame is described in https://www.rfc-editor.org/rfc/rfc6716#section-4.2.2.
        switch (frameLengthMs) {
            case 10:
            case 20:
                return 1;
            case 40:
                return 2;
            case 60:
                return 3;
            // It is not possible to reach the default case since an Opus packet can only encode sizes of 2.5, 5, 10, 20, 40,
            // or 60 ms, so we ignore the default case for test coverage.
            /* istanbul ignore next */
            default:
                return 0;
        }
    }
    /**
     * Gets the number of channels from an Opus packet.
     *
     * @param packet Opus packet.
     * @returns Number of channels.
     */
    opusPacketGetNumChannels(packet) {
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        // The 's' bit indicates mono or stereo audio, with 0 indicating mono and 1 indicating stereo.
        return packet.getUint8(0) & 0x4 ? 2 : 1;
    }
    /**
     * Determine the size (in bytes) of an Opus frame.
     *
     * @param packet Opus packet.
     * @param byteOffset Offset (from the start of the packet) to the byte containing the size information.
     * @param remainingBytes Remaining number of bytes to parse from the Opus packet.
     * @param sizeBytes Variable to store the parsed frame size (in bytes).
     * @returns Number of bytes that were parsed to determine the frame size.
     */
    opusParseSize(packet, byteOffset, remainingBytes, sizeBytes) {
        // See https://www.rfc-editor.org/rfc/rfc6716#section-3.2.1 for an explanation of how frame size is represented.
        // If there are no remaining bytes to parse the size from, then the size cannot be determined.
        if (remainingBytes < 1) {
            sizeBytes[0] = -1;
            return -1;
        }
        // If the first byte is in the range 0...251, then this value is the size of the frame.
        else if (packet.getUint8(byteOffset) < 252) {
            sizeBytes[0] = packet.getUint8(byteOffset);
            return 1;
        }
        // If the first byte is in the range 252...255, a second byte is needed. If there is no second byte, then the size
        // cannot be determined.
        else if (remainingBytes < 2) {
            sizeBytes[0] = -1;
            return -1;
        }
        // The total size of the frame given two size bytes is:
        // (4 * secondSizeByte) + firstSizeByte
        else {
            sizeBytes[0] = 4 * packet.getUint8(byteOffset + 1) + packet.getUint8(byteOffset);
            return 2;
        }
    }
    /**
     * Parse binary data containing an Opus packet into one or more Opus frames.
     *
     * @param data Binary data containing an Opus packet to be parsed. The data should begin with the first byte (i.e the
     *             TOC byte) of an Opus packet. Note that the size of the data does not have to equal the size of the
     *             contained Opus packet.
     * @param lenBytes Size of the data (in bytes).
     * @param selfDelimited Indicates if the Opus packet is self-delimiting
     *                      (https://www.rfc-editor.org/rfc/rfc6716#appendix-B).
     * @param tocByte Optional variable to store the TOC (table of contents) byte.
     * @param frameOffsets Optional variable to store the offsets (from the start of the data) to the first bytes of each
     *                     Opus frame.
     * @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
     * @param payloadOffset Optional variable to store the offset (from the start of the data) to the first byte of the
     *                      payload.
     * @param packetLenBytes Optional variable to store the length of the Opus packet (in bytes).
     * @returns Number of Opus frames.
     */
    opusPacketParseImpl(data, lenBytes, selfDelimited, tocByte, frameOffsets, frameSizes, payloadOffset, packetLenBytes) {
        if (!frameSizes || lenBytes < 0)
            return this.OPUS_BAD_ARG;
        if (lenBytes === 0)
            return this.OPUS_INVALID_PACKET;
        // The number of Opus frames in the packet.
        let numFrames;
        // Intermediate storage for the number of bytes parsed to determine the size of a frame.
        let numBytesParsed;
        // The number of the padding bytes (excluding the padding count bytes) in the packet.
        let paddingBytes = 0;
        // Indicates whether CBR (constant bitrate) framing is used.
        let cbr = false;
        // The TOC (table of contents) byte (https://www.rfc-editor.org/rfc/rfc6716#section-3.1).
        const toc = data.getUint8(0);
        // Store the TOC byte.
        if (tocByte)
            tocByte[0] = toc;
        // The remaining number of bytes to parse from the packet. Note that the TOC byte has already been parsed, hence the
        // minus 1.
        let remainingBytes = lenBytes - 1;
        // This keeps track of where we are in the packet. This starts at 1 since the TOC byte has already been read.
        let byteOffset = 1;
        // The size of the last Opus frame in bytes.
        let lastSizeBytes = remainingBytes;
        // Read the \`c\` bits (i.e. code bits) from the TOC byte.
        switch (toc & 0x3) {
            // A code 0 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.2) has one frame.
            case 0:
                numFrames = 1;
                break;
            // A code 1 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.3) has two CBR (constant bitrate) frames.
            case 1:
                numFrames = 2;
                cbr = true;
                if (!selfDelimited) {
                    // Undelimited code 1 packets must be an even number of data bytes, otherwise the packet is invalid.
                    if (remainingBytes & 0x1)
                        return this.OPUS_INVALID_PACKET;
                    // The sizes of both frames are equal (i.e. half of the number of data bytes).
                    lastSizeBytes = remainingBytes / 2;
                    // If \`lastSizeBytes\` is too large, we will catch it later.
                    frameSizes[0][0] = lastSizeBytes;
                }
                break;
            // A code 2 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.4) has two VBR (variable bitrate) frames.
            case 2:
                numFrames = 2;
                numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[0]);
                remainingBytes -= numBytesParsed;
                // The parsed size of the first frame cannot be larger than the number of remaining bytes in the packet.
                if (frameSizes[0][0] < 0 || frameSizes[0][0] > remainingBytes) {
                    return this.OPUS_INVALID_PACKET;
                }
                byteOffset += numBytesParsed;
                // The size of the second frame is the remaining number of bytes after the first frame.
                lastSizeBytes = remainingBytes - frameSizes[0][0];
                break;
            // A code 3 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5) has multiple CBR/VBR frames (from 0 to
            // 120 ms).
            default:
                // Code 3 packets must have at least 2 bytes (i.e. at least 1 byte after the TOC byte).
                if (remainingBytes < 1)
                    return this.OPUS_INVALID_PACKET;
                // Frame count byte format:
                //  0
                //  0 1 2 3 4 5 6 7
                // +-+-+-+-+-+-+-+-+
                // |v|p|     M     |
                // +-+-+-+-+-+-+-+-+
                //
                // Read the frame count byte, which immediately follows the TOC byte.
                const frameCountByte = data.getUint8(byteOffset++);
                --remainingBytes;
                // Read the 'M' bits of the frame count byte, which encode the number of frames.
                numFrames = frameCountByte & 0x3f;
                // The number of frames in a code 3 packet must not be 0.
                if (numFrames <= 0)
                    return this.OPUS_INVALID_PACKET;
                const samplesPerFrame = this.opusPacketGetSamplesPerFrame(data, 48000);
                // A single frame can have at most 2880 samples, which happens in the case where 60ms of 48kHz audio is encoded
                // per frame. A code 3 packet cannot contain more than 120ms of audio, so the total number of samples cannot
                // exceed 2880 * 2 = 5760.
                if (samplesPerFrame * numFrames > 5760)
                    return this.OPUS_INVALID_PACKET;
                // Parse padding bytes if the 'p' bit is 1.
                if (frameCountByte & 0x40) {
                    let paddingCountByte;
                    let numPaddingBytes;
                    // Remove padding bytes (including padding count bytes) from the remaining byte count.
                    do {
                        // Sanity check that there are enough bytes to parse and remove the padding.
                        if (remainingBytes <= 0)
                            return this.OPUS_INVALID_PACKET;
                        // Get the next padding count byte.
                        paddingCountByte = data.getUint8(byteOffset++);
                        --remainingBytes;
                        // If the padding count byte has a value in the range 0...254, then the total size of the padding is the
                        // value in the padding count byte.
                        //
                        // If the padding count byte has value 255, then the total size of the padding is 254 plus the value in the
                        // next padding count byte. Therefore, keep reading padding count bytes while the value is 255.
                        numPaddingBytes = paddingCountByte === 255 ? 254 : paddingCountByte;
                        remainingBytes -= numPaddingBytes;
                        paddingBytes += numPaddingBytes;
                    } while (paddingCountByte === 255);
                }
                // Sanity check that the remaining number of bytes is not negative after removing the padding.
                if (remainingBytes < 0)
                    return this.OPUS_INVALID_PACKET;
                // Read the 'v' bit (i.e. VBR bit).
                cbr = !(frameCountByte & 0x80);
                // VBR case
                if (!cbr) {
                    lastSizeBytes = remainingBytes;
                    // Let M be the number of frames. There will be M - 1 frame length indicators (which can be 1 or 2 bytes)
                    // corresponding to the lengths of frames 0 to M - 2. The size of the last frame (i.e. frame M - 1) is the
                    // number of data bytes after the end of frame M - 2 and before the start of the padding bytes.
                    for (let i = 0; i < numFrames - 1; ++i) {
                        numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[i]);
                        remainingBytes -= numBytesParsed;
                        // The remaining number of data bytes must be enough to contain each frame.
                        if (frameSizes[i][0] < 0 || frameSizes[i][0] > remainingBytes) {
                            return this.OPUS_INVALID_PACKET;
                        }
                        byteOffset += numBytesParsed;
                        lastSizeBytes -= numBytesParsed + frameSizes[i][0];
                    }
                    // Sanity check that the size of the last frame is not negative.
                    if (lastSizeBytes < 0)
                        return this.OPUS_INVALID_PACKET;
                }
                // CBR case
                else if (!selfDelimited) {
                    // The size of each frame is the number of data bytes divided by the number of frames.
                    lastSizeBytes = Math.trunc(remainingBytes / numFrames);
                    // The number of data bytes must be a non-negative integer multiple of the number of frames.
                    if (lastSizeBytes * numFrames !== remainingBytes)
                        return this.OPUS_INVALID_PACKET;
                    // All frames have equal size in the undelimited CBR case.
                    for (let i = 0; i < numFrames - 1; ++i) {
                        frameSizes[i][0] = lastSizeBytes;
                    }
                }
        }
        // Self-delimited framing uses an extra 1 or 2 bytes, immediately preceding the data bytes, to indicate either the
        // size of the last frame (for code 0, code 2, and VBR code 3 packets) or the size of all the frames (for code 1 and
        // CBR code 3 packets). See https://www.rfc-editor.org/rfc/rfc6716#appendix-B.
        if (selfDelimited) {
            // The extra frame size byte(s) will always indicate the size of the last frame.
            numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[numFrames - 1]);
            remainingBytes -= numBytesParsed;
            // There must be enough data bytes for the last frame.
            if (frameSizes[numFrames - 1][0] < 0 || frameSizes[numFrames - 1][0] > remainingBytes) {
                return this.OPUS_INVALID_PACKET;
            }
            byteOffset += numBytesParsed;
            // For CBR packets, the sizes of all the frames are equal.
            if (cbr) {
                // There must be enough data bytes for all the frames.
                if (frameSizes[numFrames - 1][0] * numFrames > remainingBytes) {
                    return this.OPUS_INVALID_PACKET;
                }
                for (let i = 0; i < numFrames - 1; ++i) {
                    frameSizes[i][0] = frameSizes[numFrames - 1][0];
                }
            }
            // At this point, \`lastSizeBytes\` contains the size of the last frame plus the size of the extra frame size
            // byte(s), so sanity check that \`lastSizeBytes\` is the upper bound for the size of the last frame.
            else if (!(numBytesParsed + frameSizes[numFrames - 1][0] <= lastSizeBytes)) {
                return this.OPUS_INVALID_PACKET;
            }
        }
        // Undelimited case
        else {
            // Because the size of the last packet is not encoded explicitly, it is possible that the size of the last packet
            // (or of all the packets, for the CBR case) is larger than maximum frame size.
            if (lastSizeBytes > this.OPUS_MAX_FRAME_SIZE_BYTES)
                return this.OPUS_INVALID_PACKET;
            frameSizes[numFrames - 1][0] = lastSizeBytes;
        }
        // Store the offset to the start of the payload.
        if (payloadOffset)
            payloadOffset[0] = byteOffset;
        // Store the offsets to the start of each frame.
        for (let i = 0; i < numFrames; ++i) {
            if (frameOffsets)
                frameOffsets[i][0] = byteOffset;
            byteOffset += frameSizes[i][0];
        }
        // Store the length of the Opus packet.
        if (packetLenBytes)
            packetLenBytes[0] = byteOffset + paddingBytes;
        return numFrames;
    }
    /**
     * Parse a single undelimited Opus packet into one or more Opus frames.
     *
     * @param packet Opus packet to be parsed.
     * @param lenBytes Size of the packet (in bytes).
     * @param tocByte Optional variable to store the TOC (table of contents) byte.
     * @param frameOffsets Optional variable to store the offsets (from the start of the packet) to the first bytes of
     *                     each Opus frame.
     * @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
     * @param payloadOffset Optional variable to store the offset (from the start of the packet) to the first byte of the
     *                      payload.
     * @returns Number of Opus frames.
     */
    opusPacketParse(packet, lenBytes, tocByte, frameOffsets, frameSizes, payloadOffset) {
        return this.opusPacketParseImpl(packet, lenBytes, 
        /* selfDelimited */ false, tocByte, frameOffsets, frameSizes, payloadOffset, null);
    }
    /**
     * This function returns the SILK VAD (voice activity detection) information encoded in the Opus packet. For CELT-only
     * packets that do not have VAD information, it returns -1.
     *
     * @param packet Opus packet.
     * @param lenBytes Size of the packet (in bytes).
     * @returns  0: no frame had the VAD flag set.
     *           1: at least one frame had the VAD flag set.
     *          -1: VAD status could not be determined.
     */
    opusPacketHasVoiceActivity(packet, lenBytes) {
        if (!packet || lenBytes <= 0)
            return 0;
        // In CELT-only mode, we can not determine whether there is VAD.
        if (this.opusPacketIsCeltOnly(packet))
            return -1;
        const numSilkFrames = this.opusNumSilkFrames(packet);
        // It is not possible for \`opusNumSilkFrames()\` to return 0, so we ignore the next sanity check for test coverage.
        /* istanbul ignore next */
        if (numSilkFrames === 0)
            return -1;
        const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
        const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
        for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
            opusFrameOffsets[i] = [undefined];
            opusFrameSizes[i] = [undefined];
        }
        // Parse packet to get the Opus frames.
        const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
        // VAD status cannot be determined for invalid packets.
        if (numOpusFrames < 0)
            return -1;
        // Iterate over all Opus frames, which may contain multiple SILK frames, to determine the VAD status.
        for (let i = 0; i < numOpusFrames; ++i) {
            if (opusFrameSizes[i][0] < 1)
                continue;
            // LP layer header bits format (https://www.rfc-editor.org/rfc/rfc6716#section-4.2.3):
            //
            // Mono case:
            // +-----------------+----------+
            // | 1 to 3 VAD bits | LBRR bit |
            // +-----------------+----------+
            //
            // Stereo case:
            // +---------------------+--------------+----------------------+---------------+
            // | 1 to 3 mid VAD bits | mid LBRR bit | 1 to 3 side VAD bits | side LBRR bit |
            // +---------------------+--------------+----------------------+---------------+
            // The upper 1 to 3 bits (dependent on the number of SILK frames) of the LP layer contain VAD bits. If any of
            // these VAD bits are 1, then voice activity is present.
            if (packet.getUint8(opusFrameOffsets[i][0]) >> (8 - numSilkFrames))
                return 1;
            // In the stereo case, there is a second set of 1 to 3 VAD bits, so also check these VAD bits.
            const channels = this.opusPacketGetNumChannels(packet);
            if (channels === 2 &&
                (packet.getUint8(opusFrameOffsets[i][0]) << (numSilkFrames + 1)) >> (8 - numSilkFrames)) {
                return 1;
            }
        }
        // No voice activity was detected.
        return 0;
    }
    /**
     * This method is based on Definition of the Opus Audio Codec
     * (https://tools.ietf.org/html/rfc6716). Basically, this method is based on
     * parsing the LP layer of an Opus packet, particularly the LBRR flag.
     *
     * @param packet Opus packet.
     * @param lenBytes Size of the packet (in bytes).
     * @returns  true: packet has fec encoding about previous packet.
     *           false: no fec encoding present.
     */
    opusPacketHasFec(packet, lenBytes) {
        if (!packet || lenBytes <= 0)
            return false;
        // In CELT-only mode, packets should not have FEC.
        if (this.opusPacketIsCeltOnly(packet))
            return false;
        const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
        const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
        for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
            opusFrameOffsets[i] = [undefined];
            opusFrameSizes[i] = [undefined];
        }
        // Parse packet to get the Opus frames.
        const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
        if (numOpusFrames < 0)
            return false;
        /* istanbul ignore next */
        if (opusFrameSizes[0][0] <= 1)
            return false;
        const numSilkFrames = this.opusNumSilkFrames(packet);
        /* istanbul ignore next */
        if (numSilkFrames === 0)
            return false;
        const channels = this.opusPacketGetNumChannels(packet);
        /* istanbul ignore next */
        if (channels !== 1 && channels !== 2)
            return false;
        // A frame starts with the LP layer. The LP layer begins with two to eight
        // header bits.These consist of one VAD bit per SILK frame (up to 3),
        // followed by a single flag indicating the presence of LBRR frames.
        // For a stereo packet, these first flags correspond to the mid channel, and
        // a second set of flags is included for the side channel. Because these are
        // the first symbols decoded by the range coder and because they are coded
        // as binary values with uniform probability, they can be extracted directly
        // from the most significant bits of the first byte of compressed data.
        for (let i = 0; i < channels; i++) {
            if (packet.getUint8(opusFrameOffsets[0][0]) & (0x80 >> ((i + 1) * (numSilkFrames + 1) - 1)))
                return true;
        }
        return false;
    }
}
RedundantAudioEncoder.shouldLog = true;
RedundantAudioEncoder.shouldReportStats = true;
RedundantAudioEncoder.initializeWorker();
`;return RedundantAudioEncoderWorkerCode.default=x,RedundantAudioEncoderWorkerCode}var hasRequiredDefaultTransceiverController;function requireDefaultTransceiverController(){if(hasRequiredDefaultTransceiverController)return DefaultTransceiverController;hasRequiredDefaultTransceiverController=1;var x=DefaultTransceiverController&&DefaultTransceiverController.__awaiter||function(A,O,H,ee){function te(ie){return ie instanceof H?ie:new H(function(ne){ne(ie)})}return new(H||(H=Promise))(function(ie,ne){function ae(fe){try{le(ee.next(fe))}catch(de){ne(de)}}function oe(fe){try{le(ee.throw(fe))}catch(de){ne(de)}}function le(fe){fe.done?ie(fe.value):te(fe.value).then(ae,oe)}le((ee=ee.apply(A,O||[])).next())})},C=DefaultTransceiverController&&DefaultTransceiverController.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(DefaultTransceiverController,"__esModule",{value:!0});const E=C(requireAudioProfile()),w=C(requireRedundantAudioRecoveryMetricReport()),T=C(requireRedundantAudioEncoder()),_=C(requireRedundantAudioEncoderWorkerCode()),S=C(requireAsyncScheduler());let R=class{constructor(A,O,H){this.logger=A,this.browserBehavior=O,this.meetingSessionContext=H,this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null,this.streamIdToTransceiver=new Map,this.groupIdToTransceiver=new Map,this.audioRedWorker=null,this.audioRedWorkerURL=null,this.audioMetricsHistory=new Array,this.redMetricsObservers=new Set,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.maxAudioMetricsHistory=20,this.audioRedPacketLossShortEvalPeriodMs=5*1e3,this.audioRedPacketLossLongEvalPeriodMs=15*1e3,this.audioRedHoldDownTimeMs=5*60*1e3,this.redRecoveryTimeMs=1*60*1e3}setEncodingParameters(A){return x(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||this._localCameraTransceiver.direction!=="sendrecv")return;const O=this._localCameraTransceiver.sender;if(!A||A.size===0)return;const H=Array.from(A.values()),ee=O.getParameters();if(!ee.encodings||ee.encodings.length===0)ee.encodings=H;else for(const te of ee.encodings)for(const ie of H){if((te.rid||ie.rid)&&te.rid!==ie.rid)continue;let ne;for(ne in ie)ne==="rid"||ne==="codecPayloadType"||ie.hasOwnProperty(ne)&&(te[ne]=ie[ne])}yield O.setParameters(ee)})}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(A){return x(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||this._localCameraTransceiver.direction!=="sendrecv")return;const O=this._localCameraTransceiver.sender;if(!O||A<=0)return;const H=O.getParameters();H.encodings||(H.encodings=[{}]);for(const ee of H.encodings)ee.maxBitrate=A*1e3;yield O.setParameters(H)})}setPeer(A){this.peer=A}reset(){this.destroyAudioRedWorkerAndStates(),this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null}useTransceivers(){return!!this.peer&&typeof this.peer.getTransceivers<"u"}hasVideoInput(){return!(!this._localCameraTransceiver||this._localCameraTransceiver.direction!=="sendrecv")}trackIsVideoInput(A){return this._localCameraTransceiver?A===this._localCameraTransceiver.sender.track||A===this._localCameraTransceiver.receiver.track:!1}setupLocalTransceivers(){var A,O;this.useTransceivers()&&(!this.defaultMediaStream&&typeof MediaStream<"u"&&(this.defaultMediaStream=new MediaStream),this._localAudioTransceiver||(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),!((O=(A=this.meetingSessionContext)===null||A===void 0?void 0:A.audioProfile)===null||O===void 0)&&O.hasRedundancyEnabled()&&this.setupAudioRedWorker()),this._localCameraTransceiver||(this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}replaceAudioTrack(A){return x(this,void 0,void 0,function*(){return!this._localAudioTransceiver||this._localAudioTransceiver.direction!=="sendrecv"?(this.logger.info("audio transceiver direction is not set up or not activated"),!1):(yield this._localAudioTransceiver.sender.replaceTrack(A),!0)})}setAudioInput(A){return x(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localAudioTransceiver,A)})}setVideoInput(A){return x(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localCameraTransceiver,A)})}updateVideoTransceivers(A,O){if(!this.useTransceivers())return O.array();const H=this.peer.getTransceivers();return this.videoSubscriptions=[0],O=O.clone(),this.updateTransceivers(H,A,O),this.logger.debug(()=>this.debugDumpTransceivers()),this.videoSubscriptions}updateTransceivers(A,O,H){const ee=H.array();A.length!==0&&!A[0].stop?(this.logger.info("Updating transceivers without `stop` function"),this.updateTransceiverWithoutStop(A,O,ee)):A.length!==0&&this.updateTransceiverWithStop(A,O,ee);for(const te of ee){const ie=this.addTransceiver("video",{direction:"recvonly",streams:[new MediaStream]});this.streamIdToTransceiver.set(te,ie),this.groupIdToTransceiver.set(O.groupIdForStreamId(te),ie),this.videoSubscriptions.push(te),this.logger.info(`adding transceiver mid: ${ie.mid} subscription: ${te} direction: recvonly`)}}updateTransceiverWithStop(A,O,H){let ee=1;this.videoSubscriptions=[0];for(const te of A){if(te===this._localCameraTransceiver||!this.transceiverIsVideo(te)||!te.mid)continue;let ie=!1;const ne=O.streamIdForTrack("v_"+te.mid);if(te.direction!=="inactive"&&ne!==void 0){for(const[ae,oe]of H.entries())if(O.StreamIdsInSameGroup(ne,oe)){te.direction="recvonly",this.videoSubscriptions[ee]=oe,ie=!0,this.streamIdToTransceiver.delete(ne),this.streamIdToTransceiver.set(oe,te),H.splice(ae,1);break}}if(!ie){this.videoSubscriptions[ee]=0,this.logger.info(`Stopping MID: ${te.mid}, direction: ${te.direction}, current direction: ${te.currentDirection}`),te.stop();for(const[ae,oe]of this.streamIdToTransceiver.entries())te.mid===oe.mid&&(this.streamIdToTransceiver.delete(ae),this.groupIdToTransceiver.delete(O.groupIdForStreamId(ae)))}ee+=1}}updateTransceiverWithoutStop(A,O,H){let ee=1;for(const te of A)if(!(te===this._localCameraTransceiver||!this.transceiverIsVideo(te))){if(this.videoSubscriptions[ee]=0,te.direction!=="inactive"){const ie=O.streamIdForTrack("v_"+te.mid);if(ie!==void 0){for(const[ne,ae]of H.entries())if(O.StreamIdsInSameGroup(ie,ae)){te.direction="recvonly",this.videoSubscriptions[ee]=ae,this.streamIdToTransceiver.delete(ie),this.streamIdToTransceiver.set(ae,te),H.splice(ne,1);break}}}ee+=1}ee=1;for(const te of A)if(!(te===this._localCameraTransceiver||!this.transceiverIsVideo(te))){if(te.direction==="inactive"&&H.length>0){te.direction="recvonly";const ie=H.shift();this.videoSubscriptions[ee]=ie,this.streamIdToTransceiver.set(ie,te),this.groupIdToTransceiver.set(O.groupIdForStreamId(ie),te)}else if(this.videoSubscriptions[ee]===0){te.direction="inactive";for(const[ie,ne]of this.streamIdToTransceiver.entries())te===ne&&(this.streamIdToTransceiver.delete(ie),this.groupIdToTransceiver.delete(O.groupIdForStreamId(ie)))}ee+=1}}getMidForStreamId(A){var O;return(O=this.streamIdToTransceiver.get(A))===null||O===void 0?void 0:O.mid}setStreamIdForMid(A,O){for(const[H,ee]of this.streamIdToTransceiver.entries())if(ee.mid===A){this.streamIdToTransceiver.delete(H),this.streamIdToTransceiver.set(O,ee);return}}getMidForGroupId(A){var O,H;return(H=(O=this.groupIdToTransceiver.get(A))===null||O===void 0?void 0:O.mid)!==null&&H!==void 0?H:void 0}transceiverIsVideo(A){return A.receiver&&A.receiver.track&&A.receiver.track.kind==="video"||A.sender&&A.sender.track&&A.sender.track.kind==="video"}debugDumpTransceivers(){let A="",O=0;for(const H of this.peer.getTransceivers())this.transceiverIsVideo(H)&&(A+=`transceiver index=${O} mid=${H.mid} subscription=${this.videoSubscriptions[O]} direction=${H.direction}
`,O+=1);return A}setTransceiverInput(A,O){return x(this,void 0,void 0,function*(){A&&(O?A.direction="sendrecv":A.direction="inactive",yield A.sender.replaceTrack(O))})}forEachRedMetricsObserver(A){for(const O of this.redMetricsObservers)S.default.nextTick(()=>{this.redMetricsObservers.has(O)&&O.recoveryMetricsDidReceive(A)})}disableAudioRedundancy(){this.meetingSessionContext.audioProfile=new E.default(this.meetingSessionContext.audioProfile.audioBitrateBps,!1),this.meetingSessionContext.audioVideoController.setAudioProfile(this.meetingSessionContext.audioProfile)}setupAudioRedWorker(){var A,O;const H=!!window.RTCRtpScriptTransform,ee=!!RTCRtpSender.prototype.createEncodedStreams;if(H)this.logger.info("[AudioRed] Supports encoded insertable streams using RTCRtpScriptTransform");else if(ee)this.logger.info("[AudioRed] Supports encoded insertable streams using TransformStream");else throw this.disableAudioRedundancy(),new Error("[AudioRed] Encoded insertable streams not supported. Recreating peer connection with audio redundancy disabled.");try{this.audioRedWorkerURL=URL.createObjectURL(new Blob([_.default],{type:"application/javascript"})),this.logger.info(`[AudioRed] Redundant audio worker URL ${this.audioRedWorkerURL}`),this.audioRedWorker=new Worker(this.audioRedWorkerURL)}catch(te){throw this.logger.error(`[AudioRed] Unable to create audio red worker due to ${te}`),URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker=null,this.disableAudioRedundancy(),this.logger.info("[AudioRed] Recreating peer connection with audio redundancy disabled"),te}if(this.audioRedEnabled=!0,this.audioRedWorker.onmessage=te=>{if(te.data.type==="REDWorkerLog")this.logger.info(te.data.log);else if(te.data.type==="RedundantAudioEncoderStats"){const ie=new w.default;ie.currentTimestampMs=Date.now(),ie.ssrc=te.data.ssrc,ie.totalAudioPacketsLost=te.data.totalAudioPacketsLost,ie.totalAudioPacketsExpected=te.data.totalAudioPacketsExpected,ie.totalAudioPacketsRecoveredRed=te.data.totalAudioPacketsRecoveredRed,ie.totalAudioPacketsRecoveredFec=te.data.totalAudioPacketsRecoveredFec,this.forEachRedMetricsObserver(ie)}},H)this._localAudioTransceiver.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"SenderTransform"}),this._localAudioTransceiver.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"ReceiverTransform"});else if(ee){const te=this._localAudioTransceiver.sender.createEncodedStreams(),ie=this._localAudioTransceiver.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"StartRedWorker",send:te,receive:ie},[te.readable,te.writable,ie.readable,ie.writable])}(A=this.meetingSessionContext)===null||A===void 0||A.audioVideoController.addObserver(this),this.addRedundantAudioRecoveryMetricsObserver((O=this.meetingSessionContext)===null||O===void 0?void 0:O.statsCollector)}addTransceiver(A,O){var H;const ee=this.peer.addTransceiver(A,O);if(!(!((H=this.peer.getConfiguration())===null||H===void 0)&&H.encodedInsertableStreams)||!this.audioRedWorker)return ee;const te=!!window.RTCRtpScriptTransform,ie=!!RTCRtpSender.prototype.createEncodedStreams;if(te)ee.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"}),ee.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"});else if(ie){const ne=ee.sender.createEncodedStreams(),ae=ee.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"PassthroughTransform",send:ne,receive:ae},[ne.readable,ne.writable,ae.readable,ae.writable])}return ee}destroyAudioRedWorkerAndStates(){var A,O;this.audioRedWorker&&(URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker.terminate(),this.audioRedWorker=null,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.audioRedEnabled=!0,(A=this.meetingSessionContext)===null||A===void 0||A.audioVideoController.removeObserver(this),this.removeRedundantAudioRecoveryMetricsObserver((O=this.meetingSessionContext)===null||O===void 0?void 0:O.statsCollector))}setAudioPayloadTypes(A){this.audioRedWorker&&(this.audioRedWorker.postMessage({msgType:"RedPayloadType",payloadType:A.get("red")}),this.audioRedWorker.postMessage({msgType:"OpusPayloadType",payloadType:A.get("opus")}))}metricsDidReceive(A){const{currentTimestampMs:O}=A,H=A.getRTCStatsReport();let ee=0,te=0,ie=0;H.forEach(de=>{de.kind==="audio"&&(de.type==="outbound-rtp"?te=de.packetsSent:de.type==="remote-inbound-rtp"&&(ee=de.timestamp,ie=de.packetsLost))}),(this.audioMetricsHistory.length===0||ee>this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs&&te>this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent)&&this.audioMetricsHistory.push({timestampMs:ee,totalPacketsSent:te,totalPacketsLost:ie}),this.audioMetricsHistory.length>this.maxAudioMetricsHistory&&this.audioMetricsHistory.shift();const ne=this.lossPercent(this.audioRedPacketLossShortEvalPeriodMs),ae=this.lossPercent(this.audioRedPacketLossLongEvalPeriodMs),oe=Math.max(ne,ae),[le,fe]=T.default.getNumRedundantEncodingsForPacketLoss(oe);if(fe){this.lastHighPacketLossEventTimestampMs=O,this.audioRedEnabled&&(this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Disable"}),this.audioRedEnabled=!1,this.lastAudioRedTurnOffTimestampMs=O);return}else if(!this.audioRedEnabled){const de=O-this.lastAudioRedTurnOffTimestampMs,ce=O-this.lastHighPacketLossEventTimestampMs;if(de>=this.audioRedPacketLossLongEvalPeriodMs&&ce<this.redRecoveryTimeMs)return;this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Enable"}),this.audioRedEnabled=!0,this.maybeResetHoldDownTimer(O)}this.shouldUpdateAudioRedWorkerEncodings(O,le)&&this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"UpdateNumRedundantEncodings",numRedundantEncodings:le})}maybeResetHoldDownTimer(A){this.currentNumRedundantEncodings>0&&(this.lastRedHolddownTimerStartTimestampMs=A)}lossPercent(A){if(this.audioMetricsHistory.length<2)return 0;const O=this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs,H=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent,ee=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsLost;for(let te=this.audioMetricsHistory.length-2;te>=0;te--)if(O-this.audioMetricsHistory[te].timestampMs>=A){const ie=ee-this.audioMetricsHistory[te].totalPacketsLost,ne=H-this.audioMetricsHistory[te].totalPacketsSent,ae=100*(ie/ne);return Math.max(0,Math.min(ae,100))}return 0}shouldUpdateAudioRedWorkerEncodings(A,O){return this.currentNumRedundantEncodings===O?(this.maybeResetHoldDownTimer(A),!1):O<this.currentNumRedundantEncodings&&A-this.lastRedHolddownTimerStartTimestampMs<this.audioRedHoldDownTimeMs?!1:(this.currentNumRedundantEncodings=O,this.maybeResetHoldDownTimer(A),!0)}addRedundantAudioRecoveryMetricsObserver(A){this.redMetricsObservers.add(A)}removeRedundantAudioRecoveryMetricsObserver(A){this.redMetricsObservers.delete(A)}};return DefaultTransceiverController.default=R,DefaultTransceiverController}var SimulcastContentShareTransceiverController={},SimulcastTransceiverController={},hasRequiredSimulcastTransceiverController;function requireSimulcastTransceiverController(){if(hasRequiredSimulcastTransceiverController)return SimulcastTransceiverController;hasRequiredSimulcastTransceiverController=1;var x=SimulcastTransceiverController&&SimulcastTransceiverController.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=SimulcastTransceiverController&&SimulcastTransceiverController.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(SimulcastTransceiverController,"__esModule",{value:!0});const E=C(requireDefaultTransceiverController());let w=class gn extends E.default{constructor(_,S,R){super(_,S,R),this.videoQualityControlParameterMap=new Map;let A=4;for(let O=0;O<gn.NAME_ARR_ASCENDING.length;O++){const H=gn.NAME_ARR_ASCENDING[O];this.videoQualityControlParameterMap.set(H,{rid:H,scaleResolutionDownBy:A,maxBitrate:gn.BITRATE_ARR_ASCENDING[O]*1e3}),A=A/2}}setEncodingParameters(_){return x(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||this._localCameraTransceiver.direction!=="sendrecv")return;const S=this._localCameraTransceiver.sender,R=Array.from(_.values());if(R.length<=0)return;const A=S.getParameters();if(!A.encodings)A.encodings=R;else for(const O of A.encodings)O.rid===gn.LOW_LEVEL_NAME&&this.copyEncodingParams(_.get(gn.LOW_LEVEL_NAME),O),O.rid===gn.MID_LEVEL_NAME&&this.copyEncodingParams(_.get(gn.MID_LEVEL_NAME),O),O.rid===gn.HIGH_LEVEL_NAME&&this.copyEncodingParams(_.get(gn.HIGH_LEVEL_NAME),O);yield S.setParameters(A),this.logVideoTransceiverParameters()})}setVideoSendingBitrateKbps(_){return x(this,void 0,void 0,function*(){})}setupLocalTransceivers(){var _,S;if(this.useTransceivers()&&(!this.defaultMediaStream&&typeof MediaStream<"u"&&(this.defaultMediaStream=new MediaStream),this._localAudioTransceiver||(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),!((S=(_=this.meetingSessionContext)===null||_===void 0?void 0:_.audioProfile)===null||S===void 0)&&S.hasRedundancyEnabled()&&this.setupAudioRedWorker()),!this._localCameraTransceiver)){const R=Array.from(this.videoQualityControlParameterMap.values());this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream],sendEncodings:R})}}logVideoTransceiverParameters(){const _=this._localCameraTransceiver.sender.getParameters().encodings;let S=`simulcast: current encoding parameters 
`;for(const R of _)S+=`rid=${R.rid} maxBitrate=${R.maxBitrate} active=${R.active} scaleDownBy=${R.scaleResolutionDownBy} maxFrameRate = ${R.maxFramerate} 
`;this.logger.info(S)}copyEncodingParams(_,S){S.active=_.active,S.maxBitrate=_.maxBitrate,S.scaleResolutionDownBy=_.scaleResolutionDownBy,S.maxFramerate=_.maxFramerate}};return SimulcastTransceiverController.default=w,w.LOW_LEVEL_NAME="low",w.MID_LEVEL_NAME="mid",w.HIGH_LEVEL_NAME="hi",w.NAME_ARR_ASCENDING=["low","mid","hi"],w.BITRATE_ARR_ASCENDING=[200,400,1100],SimulcastTransceiverController}var hasRequiredSimulcastContentShareTransceiverController;function requireSimulcastContentShareTransceiverController(){if(hasRequiredSimulcastContentShareTransceiverController)return SimulcastContentShareTransceiverController;hasRequiredSimulcastContentShareTransceiverController=1;var x=SimulcastContentShareTransceiverController&&SimulcastContentShareTransceiverController.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=SimulcastContentShareTransceiverController&&SimulcastContentShareTransceiverController.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(SimulcastContentShareTransceiverController,"__esModule",{value:!0});const E=C(requireSimulcastTransceiverController());let w=class vc extends E.default{constructor(_,S,R){super(_,S,R);let A=2;this.videoQualityControlParameterMap=new Map;for(let O=0;O<vc.NAME_ARR_ASCENDING.length;O++){const H=vc.NAME_ARR_ASCENDING[O];this.videoQualityControlParameterMap.set(H,{rid:H,scaleResolutionDownBy:A,maxBitrate:vc.BITRATE_ARR_ASCENDING[O]*1e3}),A=A/2}}setEncodingParameters(_){return x(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||this._localCameraTransceiver.direction!=="sendrecv")return;const S=this._localCameraTransceiver.sender,R=Array.from(_.values());if(R.length<=0)return;const A=S.getParameters();if(!A.encodings)A.encodings=R;else for(let O=0;O<A.encodings.length;O++)A.encodings[O].rid===E.default.LOW_LEVEL_NAME&&this.copyEncodingParams(_.get(E.default.LOW_LEVEL_NAME),A.encodings[O]),A.encodings[O].rid===E.default.HIGH_LEVEL_NAME&&this.copyEncodingParams(_.get(E.default.HIGH_LEVEL_NAME),A.encodings[O]);yield S.setParameters(A),this.logVideoTransceiverParameters()})}};return SimulcastContentShareTransceiverController.default=w,w.NAME_ARR_ASCENDING=["low","hi"],w.BITRATE_ARR_ASCENDING=[300,1200],SimulcastContentShareTransceiverController}var VideoOnlyTransceiverController={},hasRequiredVideoOnlyTransceiverController;function requireVideoOnlyTransceiverController(){if(hasRequiredVideoOnlyTransceiverController)return VideoOnlyTransceiverController;hasRequiredVideoOnlyTransceiverController=1;var x=VideoOnlyTransceiverController&&VideoOnlyTransceiverController.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(VideoOnlyTransceiverController,"__esModule",{value:!0});const C=x(requireDefaultTransceiverController());let E=class extends C.default{constructor(w,T,_){super(w,T,_)}setupLocalTransceivers(){this.useTransceivers()&&(!this.defaultMediaStream&&typeof MediaStream<"u"&&(this.defaultMediaStream=new MediaStream),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}};return VideoOnlyTransceiverController.default=E,VideoOnlyTransceiverController}var DefaultVideoCaptureAndEncodeParameter={},hasRequiredDefaultVideoCaptureAndEncodeParameter;function requireDefaultVideoCaptureAndEncodeParameter(){if(hasRequiredDefaultVideoCaptureAndEncodeParameter)return DefaultVideoCaptureAndEncodeParameter;hasRequiredDefaultVideoCaptureAndEncodeParameter=1,Object.defineProperty(DefaultVideoCaptureAndEncodeParameter,"__esModule",{value:!0});let x=class cm{constructor(E,w,T,_,S,R=1,A=!1){this.cameraWidth=E,this.cameraHeight=w,this.cameraFrameRate=T,this.maxEncodeBitrateKbps=_,this.isSimulcast=S,this.scaleResolutionDownBy=R,this.isSVC=A}equal(E){let w=E.captureWidth()===this.cameraWidth&&E.captureHeight()===this.cameraHeight&&E.captureFrameRate()===this.cameraFrameRate&&E.encodeBitrates().length===this.encodeBitrates().length&&E.encodeScaleResolutionDownBy().length===this.encodeScaleResolutionDownBy().length&&E.encodeWidths().length===this.encodeWidths().length&&E.encodeHeights().length===this.encodeHeights().length&&E.isSVCEncoding()===this.isSVC;if(w){for(let T=0;T<E.encodeWidths().length;T++)if(E.encodeWidths()[T]!==this.encodeWidths()[T]||E.encodeHeights()[T]!==this.encodeHeights()[T]||E.encodeBitrates()[T]!==this.encodeBitrates()[T]||E.encodeScaleResolutionDownBy()[T]!==this.encodeScaleResolutionDownBy()[T])return w=!1,w}return w}clone(){return new cm(this.cameraWidth,this.cameraHeight,this.cameraFrameRate,this.maxEncodeBitrateKbps,this.isSimulcast,this.scaleResolutionDownBy,this.isSVC)}captureWidth(){return this.cameraWidth}captureHeight(){return this.cameraHeight}captureFrameRate(){return this.cameraFrameRate}encodeBitrates(){return[this.maxEncodeBitrateKbps]}encodeScaleResolutionDownBy(){return[this.scaleResolutionDownBy]}encodeWidths(){return[this.cameraWidth]}encodeHeights(){return[this.cameraHeight]}isSVCEncoding(){return this.isSVC}};return DefaultVideoCaptureAndEncodeParameter.default=x,DefaultVideoCaptureAndEncodeParameter}var VideoAdaptiveProbePolicy={},VideoPreference={},TargetDisplaySize={},hasRequiredTargetDisplaySize;function requireTargetDisplaySize(){return hasRequiredTargetDisplaySize||(hasRequiredTargetDisplaySize=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.TargetDisplaySize=void 0;var C;(function(E){E[E.Low=0]="Low",E[E.Medium=1]="Medium",E[E.High=2]="High",E[E.Maximum=3]="Maximum"})(C=x.TargetDisplaySize||(x.TargetDisplaySize={})),x.default=C}(TargetDisplaySize)),TargetDisplaySize}var hasRequiredVideoPreference;function requireVideoPreference(){if(hasRequiredVideoPreference)return VideoPreference;hasRequiredVideoPreference=1;var x=VideoPreference&&VideoPreference.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(VideoPreference,"__esModule",{value:!0});const C=x(requireTargetDisplaySize()),E=x(requireVideoQualityAdaptationPreference());let w=class Ks{constructor(_,S,R,A){this.attendeeId=_,this.priority=S,this.targetSize=R!==void 0?R:C.default.Maximum,this.degradationPreference=A!==void 0?A:E.default.Balanced}partialCompare(_){return this.priority-_.priority}equals(_){return this.attendeeId===_.attendeeId&&this.targetSize===_.targetSize&&this.priority===_.priority&&this.degradationPreference===_.degradationPreference}clone(){return new Ks(this.attendeeId,this.priority,this.targetSize,this.degradationPreference)}targetSizeToBitrateKbps(_){switch(_){case C.default.Maximum:return Ks.MAXIMUM_BITRATE_KBPS;case C.default.High:return Ks.HIGH_BITRATE_KBPS;case C.default.Medium:return Ks.MID_BITRATE_KBPS;case C.default.Low:return Ks.LOW_BITRATE_KBPS}}};return VideoPreference.default=w,w.LOW_BITRATE_KBPS=300,w.MID_BITRATE_KBPS=600,w.HIGH_BITRATE_KBPS=1500,w.MAXIMUM_BITRATE_KBPS=1e4,VideoPreference}var VideoPriorityBasedPolicy={},VideoSource={},hasRequiredVideoSource;function requireVideoSource(){if(hasRequiredVideoSource)return VideoSource;hasRequiredVideoSource=1,Object.defineProperty(VideoSource,"__esModule",{value:!0});let x=class{};return VideoSource.default=x,VideoSource}var VideoPriorityBasedPolicyConfig={},hasRequiredVideoPriorityBasedPolicyConfig;function requireVideoPriorityBasedPolicyConfig(){if(hasRequiredVideoPriorityBasedPolicyConfig)return VideoPriorityBasedPolicyConfig;hasRequiredVideoPriorityBasedPolicyConfig=1;var x=VideoPriorityBasedPolicyConfig&&VideoPriorityBasedPolicyConfig.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(VideoPriorityBasedPolicyConfig,"__esModule",{value:!0});const C=x(requireServerSideNetworkAdaption());let E=class Qa{constructor(T=0,_=0){this.networkIssueResponseDelayFactor=T,this.networkIssueRecoveryDelayFactor=_,this.currentNetworkEvent=0,this.bandwidthDecreaseTimestamp=0,this.referenceBitrate=0,this.serverSideNetworkAdaption=C.default.BandwidthProbingAndRemoteVideoQualityAdaption,T<0?T=0:T>1&&(T=1),this.networkIssueResponseDelayFactor=T,_<0?_=0:_>1&&(_=1),this.networkIssueRecoveryDelayFactor=_}allowSubscribe(T,_){let S=0;const R=this.currentNetworkEvent;if(_>this.referenceBitrate)return this.currentNetworkEvent=2,this.referenceBitrate=_,!0;if(_<this.referenceBitrate){if(this.currentNetworkEvent=1,S=this.getSubscribeDelay(this.currentNetworkEvent,T),R!==1)this.bandwidthDecreaseTimestamp=Date.now();else if(Date.now()-this.bandwidthDecreaseTimestamp>S)return this.referenceBitrate=_,!0;return!1}else return this.currentNetworkEvent=0,!1}getSubscribeDelay(T,_){let S=Qa.MINIMUM_DELAY_MS;const R=Qa.MAXIMUM_DELAY_MS-Qa.MINIMUM_DELAY_MS,A=this.networkIssueResponseDelayFactor;switch(T){case 1:S+=R*A*(1+_/10),S=Math.min(Qa.MAXIMUM_DELAY_MS,S);break}return S}};return VideoPriorityBasedPolicyConfig.default=E,E.MINIMUM_DELAY_MS=2e3,E.MAXIMUM_DELAY_MS=8e3,E.Default=new E(0,0),E.UnstableNetworkPreset=new E(0,1),E.StableNetworkPreset=new E(1,0),VideoPriorityBasedPolicyConfig}var hasRequiredVideoPriorityBasedPolicy;function requireVideoPriorityBasedPolicy(){if(hasRequiredVideoPriorityBasedPolicy)return VideoPriorityBasedPolicy;hasRequiredVideoPriorityBasedPolicy=1;var x=VideoPriorityBasedPolicy&&VideoPriorityBasedPolicy.__createBinding||(Object.create?function(ce,pe,he,me){me===void 0&&(me=he),Object.defineProperty(ce,me,{enumerable:!0,get:function(){return pe[he]}})}:function(ce,pe,he,me){me===void 0&&(me=he),ce[me]=pe[he]}),C=VideoPriorityBasedPolicy&&VideoPriorityBasedPolicy.__setModuleDefault||(Object.create?function(ce,pe){Object.defineProperty(ce,"default",{enumerable:!0,value:pe})}:function(ce,pe){ce.default=pe}),E=VideoPriorityBasedPolicy&&VideoPriorityBasedPolicy.__importStar||function(ce){if(ce&&ce.__esModule)return ce;var pe={};if(ce!=null)for(var he in ce)he!=="default"&&Object.prototype.hasOwnProperty.call(ce,he)&&x(pe,ce,he);return C(pe,ce),pe},w=VideoPriorityBasedPolicy&&VideoPriorityBasedPolicy.__importDefault||function(ce){return ce&&ce.__esModule?ce:{default:ce}};Object.defineProperty(VideoPriorityBasedPolicy,"__esModule",{value:!0});const T=w(requireAttendee()),_=w(requireClientMetricReportDirection()),S=w(requireClientMetricReportMediaType()),R=w(requireContentShareConstants()),A=requireLogLevel(),O=E(requireServerSideNetworkAdaption()),H=w(requireVideoSource()),ee=w(requireDefaultVideoStreamIdSet()),te=w(requireAllHighestVideoBandwidthPolicy()),ie=w(requireTargetDisplaySize()),ne=w(requireVideoPreference()),ae=requireVideoPreferences(),oe=w(requireVideoPriorityBasedPolicyConfig()),le=w(requireVideoQualityAdaptationPreference());class fe{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}}let de=class si{constructor(pe,he=oe.default.Default){this.logger=pe,this.videoPriorityBasedPolicyConfig=he,this.shouldPauseTiles=!0,this.observerQueue=new Set,this.pausedBwAttendeeIds=new Set,this.wantsResubscribeObserver=void 0,this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption===O.default.Default&&(this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption=O.default.BandwidthProbingAndRemoteVideoQualityAdaption),this.reset()}reset(){this.allHighestPolicy=new te.default(""),this.optimalReceiveSet=new ee.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new ee.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new ee.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=si.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=si.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new fe,this.prevDownlinkStats=new fe,this.probeFailed=!1,this.serverSideNetworkAdaption=this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption,this.pendingActionAfterUpdatedPreferences=!1}bindToTileController(pe){this.tileController=pe,this.logger.info("tileController bound")}setWantsResubscribeObserver(pe){this.wantsResubscribeObserver=pe}chooseRemoteVideoSources(pe){var he;if(!(!((he=this.videoPreferences)===null||he===void 0)&&he.equals(pe))){if(this.videoPreferences=pe?.clone(),!O.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)&&(this.pendingActionAfterUpdatedPreferences=!0,this.wantsResubscribeObserver!==void 0&&(this.wantsResubscribeObserver(),this.pendingActionAfterUpdatedPreferences=!1),this.serverSideNetworkAdaption===O.default.BandwidthProbingAndRemoteVideoQualityAdaption)){const me=new Array;for(const ve of this.videoPreferences){const ye=new H.default;ye.attendee=new T.default,ye.attendee.attendeeId=ve.attendeeId,me.push(ye)}this.allHighestPolicy.chooseRemoteVideoSources(me);return}this.videoPreferencesUpdated=!0,this.logger.info(`bwe: setVideoPreferences bwe: new preferences: ${JSON.stringify(pe)}`)}}updateIndex(pe){this.videoIndex=pe,this.serverSideNetworkAdaption===O.default.BandwidthProbingAndRemoteVideoQualityAdaption&&this.allHighestPolicy.updateIndex(pe),this.videoPreferences||this.updateDefaultVideoPreferences()}updateDefaultVideoPreferences(){const pe=new Set;for(const ye of this.videoIndex.remoteStreamDescriptions())pe.add(ye.attendeeId);const he=ae.VideoPreferences.prepare(),me=pe.size;let ve=ie.default.Maximum;me>8?ve=ie.default.Low:me>4&&(ve=ie.default.Medium);for(const ye of pe)he.add(new ne.default(ye,1,ve));this.defaultVideoPreferences=he.build()}updateMetrics(pe){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new fe;const he=pe.getObservableMetrics();this.downlinkStats.bandwidthEstimateKbps=he.availableIncomingBitrate/1e3;for(const me in pe.streamMetricReports){const ve=Number.parseInt(me,10),ye=pe.streamMetricReports[ve];ye.direction===_.default.DOWNSTREAM&&ye.mediaType===S.default.VIDEO&&(ye.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=pe.countPerSecond("nackCount",ve)),ye.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=pe.countPerSecond("packetsLost",ve)),ye.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=pe.bitsPerSecond("bytesReceived",ve)/1e3))}}wantsResubscribe(){let pe=!1;return!O.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)&&(pe||(pe=this.pendingActionAfterUpdatedPreferences),this.serverSideNetworkAdaption===O.default.BandwidthProbingAndRemoteVideoQualityAdaption)?pe||this.allHighestPolicy.wantsResubscribe():(this.calculateOptimalReceiveSet(),pe||(pe=!this.subscribedReceiveSet.equal(this.optimalReceiveSet)),pe)}chooseSubscriptions(){return!O.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)&&(this.pendingActionAfterUpdatedPreferences=!1,this.serverSideNetworkAdaption===O.default.BandwidthProbingAndRemoteVideoQualityAdaption)?this.allHighestPolicy.chooseSubscriptions():(this.subscribedReceiveSet.equal(this.optimalReceiveSet)||(this.lastSubscribeTimestamp=Date.now()),this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveStreams=this.optimalReceiveStreams.slice(),this.subscribedReceiveSet.clone())}addObserver(pe){this.observerQueue.add(pe)}removeObserver(pe){this.observerQueue.delete(pe)}forEachObserver(pe){for(const he of this.observerQueue)pe(he)}setVideoPriorityBasedPolicyConfigs(pe){this.videoPriorityBasedPolicyConfig=pe}calculateOptimalReceiveStreams(){var pe;const he=[],me=this.videoIndex.remoteStreamDescriptions();if(me.length===0||!((pe=this.videoPreferences)===null||pe===void 0)&&pe.isEmpty()){this.optimalReceiveStreams=[];return}const ve=this.rateProbeState;this.cleanBwPausedTiles(me),this.handleAppPausedStreams(he,me);const ye=new Map;for(const je of this.getCurrentVideoPreferences())ye.set(je.attendeeId,je);const Se=me.filter(je=>ye.has(je.attendeeId)),Ce=!this.streamsWithPreferenceDidChange(Se),be=!this.startupPeriod&&Ce;if(be&&Date.now()-this.lastSubscribeTimestamp<this.timeBeforeAllowSubscribeMs)return;Se.sort((je,Ne)=>je.maxBitrateKbps===Ne.maxBitrateKbps?je.streamId-Ne.streamId:je.maxBitrateKbps-Ne.maxBitrateKbps);for(const je of Se)(je.avgBitrateKbps===0||je.avgBitrateKbps>je.maxBitrateKbps)&&(je.attendeeId.endsWith(R.default.Modality)&&je.maxBitrateKbps<100?je.maxBitrateKbps=je.avgBitrateKbps:je.avgBitrateKbps=je.maxBitrateKbps);const Ee=new Set;for(const je of this.getCurrentVideoPreferences()){const Ne=Se.filter(Kt=>Kt.attendeeId===je.attendeeId);if(Ne.length<3)continue;let Oe=15,Ve=320*480;Ne.forEach(Kt=>{Oe=Math.max(Oe,Kt.maxFrameRate),Ve=Math.max(Ve,Kt.totalPixels())}),Ne.sort((Kt,ir)=>{if(je.degradationPreference===le.default.MaintainResolution)return Math.abs(Kt.maxFrameRate-ir.maxFrameRate)<2?Kt.totalPixels()-ir.totalPixels():Kt.maxFrameRate-ir.maxFrameRate;if(je.degradationPreference===le.default.MaintainFramerate)return Kt.totalPixels()===ir.totalPixels()?Kt.maxFrameRate-ir.maxFrameRate:Kt.totalPixels()-ir.totalPixels();{const $t=tr=>tr.avgBitrateKbps*Math.pow(2,5*tr.maxFrameRate/Oe*Math.pow(4,tr.totalPixels()/Ve));return $t(Kt)-$t(ir)}});let Ht;for(const Kt of Ne){if(Ht!==void 0&&(Kt.maxFrameRate<Ht.maxFrameRate&&Math.abs(Ht.maxFrameRate-Kt.maxFrameRate)>2||Kt.totalPixels()<Ht.totalPixels())){Ee.add(Kt.streamId);continue}Ht=Kt}}const Ae=Se.filter(je=>!Ee.has(je.streamId));this.logger.info(`Filtered to ${JSON.stringify(Ae)}`);const Ie={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};Ie.targetDownlinkBitrate=this.determineTargetRate();const Te=this.subscribedReceiveSet.size(),De=this.downlinkStats.bandwidthEstimateKbps,Ue=!this.videoPriorityBasedPolicyConfig.allowSubscribe(Te,De);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=si.MIN_TIME_BETWEEN_SUBSCRIBE_MS,be&&Ue))return;const ze=this.priorityPolicy(Ie,Ae,he),Pe=!O.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption);let $e=0;if(!Pe&&!this.startupPeriod&&Ce?this.rateProbeState==="Probing"?$e=this.handleProbe(he,Ie.targetDownlinkBitrate):Ie.deltaToNextUpgrade!==0&&($e=this.maybeOverrideOrProbe(he,Ie,ze)):(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0),this.previousStreamsWithPreference=Se,this.videoPreferencesUpdated=!1,$e===1){this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),this.prevTargetRateKbps=Ie.targetDownlinkBitrate;return}if($e===2){const je=this.calculateSubscribeRate(this.preProbeNonPausedReceiveStreams);this.optimalReceiveStreams=this.preProbeReceiveStreams.slice(),this.processBwPausedStreams(Se,this.preProbeNonPausedReceiveStreams),this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+je);return}this.optimalNonPausedReceiveStreams=he.slice();const He=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(Se,he),this.logger.getLogLevel()<=A.LogLevel.INFO&&(this.logCount%15===0||this.rateProbeState!==ve||this.optimalReceiveStreams.length!==he.length||He!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(me,Ie.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=Ie.targetDownlinkBitrate,this.optimalReceiveStreams=he.slice()}calculateOptimalReceiveSet(){const pe=new ee.default;this.calculateOptimalReceiveStreams();for(const he of this.optimalReceiveStreams)pe.add(he.streamId);if(!this.optimalReceiveSet.equal(pe)){const he=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(pe)} subscribedRate:${he}`)}this.optimalReceiveSet=pe}determineTargetRate(){let pe=0;const he=Date.now();return this.downlinkStats.bandwidthEstimateKbps!==0?(this.firstEstimateTimestamp===0&&(this.firstEstimateTimestamp=he),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>si.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||he-this.firstEstimateTimestamp>si.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?pe=si.DEFAULT_BANDWIDTH_KBPS:this.rateProbeState==="Probing"&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost<si.SPURIOUS_PACKET_LOST_THRESHOLD?(this.logger.info(`bwe: In probe state, overriding estimate ${this.downlinkStats.bandwidthEstimateKbps} with actual receive bitrate ${this.downlinkStats.usedBandwidthKbps}`),pe=this.downlinkStats.usedBandwidthKbps+si.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS):pe=this.downlinkStats.bandwidthEstimateKbps):this.firstEstimateTimestamp===0?pe=si.DEFAULT_BANDWIDTH_KBPS:pe=this.prevTargetRateKbps,!this.startupPeriod&&(this.usingPrevTargetRate&&this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps||this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps*(100-si.LARGE_RATE_CHANGE_TRIGGER_PERCENT)/100||this.downlinkStats.bandwidthEstimateKbps<this.downlinkStats.usedBandwidthKbps*si.LARGE_RATE_CHANGE_TRIGGER_PERCENT/100)&&this.downlinkStats.packetsLost===0?(this.logger.debug(()=>"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps),this.usingPrevTargetRate=!0,pe=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,pe>15e3&&this.logger.warn("bwe: "+pe+" exceeds maximum limit (15000). Limit TargetDisplaySize with VideoPreferences to avoid this."),Math.min(pe,15e3)}setProbeState(pe){if(this.rateProbeState===pe)return!1;const he=Date.now();switch(pe){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(this.lastProbeTimestamp===0||he-this.lastProbeTimestamp>si.MIN_TIME_BETWEEN_PROBE_MS)this.probePendingStartTimestamp=he;else return!1;break;case"Probing":if(he-this.probePendingStartTimestamp>this.timeBeforeAllowProbeMs)this.lastProbeTimestamp=he,this.preProbeReceiveStreams=this.subscribedReceiveStreams.slice(),this.preProbeNonPausedReceiveStreams=this.optimalNonPausedReceiveStreams,this.timeBeforeAllowProbeMs=Math.min(this.timeBeforeAllowProbeMs*2,si.MAX_HOLD_BEFORE_PROBE_MS);else return!1;break}return this.logger.info("bwe: setProbeState to "+pe+" from "+this.rateProbeState),this.rateProbeState=pe,!0}upgradeToStream(pe,he){for(let me=0;me<pe.length;me++)if(pe[me].groupId===he.groupId){const ve=he.avgBitrateKbps-pe[me].avgBitrateKbps;return this.logger.info("bwe: upgradeStream from "+JSON.stringify(pe[me])+" to "+he),this.lastUpgradeRateKbps=ve,pe[me]=he,ve}return pe.push(he),this.lastUpgradeRateKbps=he.avgBitrateKbps,this.lastUpgradeRateKbps}handleProbe(pe,he){if(Date.now()-this.lastProbeTimestamp>si.MAX_ALLOWED_PROBE_TIME_MS)return this.logger.info("bwe: Canceling probe due to timeout"),this.setProbeState("Not Probing"),0;if(this.downlinkStats.packetsLost>0&&(this.logger.info(`bwe: Probe encountering packets lost:${this.downlinkStats.packetsLost}`),this.downlinkStats.packetsLost>si.SPURIOUS_PACKET_LOST_THRESHOLD))return this.setProbeState("Not Probing"),this.logger.info(`bwe: Canceling probe due to packets lost:${this.downlinkStats.packetsLost}`),this.probeFailed=!0,this.timeBeforeAllowSubscribeMs=Math.max(si.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.timeBeforeAllowSubscribeMs)*3,2;const me=this.calculateSubscribeRate(this.optimalReceiveStreams);return this.chosenStreamsSameAsLast(pe)||he>me?(this.logger.info("bwe: Probe successful"),this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=si.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(pe,he,me){const ve=this.chosenStreamsSameAsLast(pe);let ye=0;const Se=he.targetDownlinkBitrate>si.LOW_BITRATE_THRESHOLD_KBPS?si.TARGET_RATE_CHANGE_TRIGGER_PERCENT:si.TARGET_RATE_CHANGE_TRIGGER_PERCENT*2,Ce=he.targetDownlinkBitrate*Se/100;if(this.targetRateBaselineForDeltaCheckKbps=this.targetRateBaselineForDeltaCheckKbps!==void 0?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!ve&&Math.abs(he.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)<Ce?(this.logger.info("bwe: MaybeOverrideOrProbe: Reuse last decision based on delta rate. {"+JSON.stringify(this.subscribedReceiveSet)+"}"),ye=1):this.targetRateBaselineForDeltaCheckKbps=he.targetDownlinkBitrate,this.downlinkStats.packetsLost>this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,ye;if(ve||ye===1)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(pe,me),ye=0);break}else this.setProbeState("Not Probing");return ye}calculateSubscribeRate(pe){let he=0;for(const me of pe)!this.pausedStreamIds.contain(me.streamId)&&!this.pausedBwAttendeeIds.has(me.attendeeId)&&(he+=me.maxBitrateKbps);return he}handleAppPausedStreams(pe,he){if(!this.tileController){this.logger.warn("tileController not found!");return}this.pausedStreamIds=new ee.default;const me=this.tileController.getAllRemoteVideoTiles();for(const ve of me){const ye=ve.state();if(ye.paused&&!this.pausedBwAttendeeIds.has(ye.boundAttendeeId)){let Se=he.length;for(;Se--;)he[Se].attendeeId===ye.boundAttendeeId&&(this.logger.info("bwe: removed paused attendee "+ye.boundAttendeeId+" streamId: "+he[Se].streamId),this.pausedStreamIds.add(he[Se].streamId),this.subscribedReceiveSet.contain(he[Se].streamId)&&pe.push(he[Se]),he.splice(Se,1))}}}processBwPausedStreams(pe,he){if(!this.tileController){this.logger.warn("tileController not found!");return}const me=this.getCurrentVideoPreferences();if(me&&this.shouldPauseTiles){const ve=this.tileController.getAllVideoTiles();for(const ye of me){const Se=this.getVideoTileForAttendeeId(ye.attendeeId,ve),Ce=Se?.state().paused||!1;if(he.some(be=>be.attendeeId===ye.attendeeId))Ce&&this.pausedBwAttendeeIds.has(ye.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${ye.attendeeId} due to bandwidth`),this.forEachObserver(be=>{be.tileWillBeUnpausedByDownlinkPolicy(Se.id())}),this.tileController.unpauseVideoTile(Se.id()),this.pausedBwAttendeeIds.delete(ye.attendeeId));else{const be=pe.some(Ee=>Ee.attendeeId===ye.attendeeId);if(Se&&be){const Ee=this.optimalReceiveStreams.find(Ae=>Ae.attendeeId===ye.attendeeId);Ee!==void 0&&(Ce||(this.logger.info(`bwe: pausing streamId ${Ee.streamId} attendee ${ye.attendeeId} due to bandwidth`),this.forEachObserver(Ae=>{Ae.tileWillBePausedByDownlinkPolicy(Se.id())}),this.tileController.pauseVideoTile(Se.id())),he.push(Ee)),this.pausedBwAttendeeIds.add(ye.attendeeId)}else if(be){const Ee=this.tileController.addVideoTile();Ee.bindVideoStream(ye.attendeeId,!1,null,0,0,0,null),this.forEachObserver(Ae=>{Ae.tileWillBePausedByDownlinkPolicy(Ee.id())}),Ee.pause(),this.logger.info(`bwe: Created video tile ${Ee.id()} for bw paused attendee ${ye.attendeeId}`),this.pausedBwAttendeeIds.add(ye.attendeeId)}}}}}cleanBwPausedTiles(pe){if(!this.tileController){this.logger.warn("tileController not found!");return}const he=this.tileController.getAllRemoteVideoTiles(),me=this.getCurrentVideoPreferences();for(const ve of he){const ye=ve.state();ye.boundVideoStream||(pe.some(Se=>Se.attendeeId===ye.boundAttendeeId)?me!==void 0&&!me.some(Se=>Se.attendeeId===ye.boundAttendeeId)&&this.tileController.removeVideoTile(ye.tileId):(this.tileController.removeVideoTile(ye.tileId),this.logger.info(`bwe: Removed video tile ${ye.tileId} for bw paused attendee ${ye.boundAttendeeId}`)))}}priorityPolicy(pe,he,me){let ve;const ye=this.getCurrentVideoPreferences(),Se=ye.highestPriority();let Ce,be=Se;for(;be!==-1;){Ce=-1;for(const Ee of ye)if(Ee.priority===be)for(const Ae of he)Ae.attendeeId===Ee.attendeeId&&(me.some(Ie=>Ie.groupId===Ae.groupId)||(pe.chosenTotalBitrate+Ae.avgBitrateKbps<=pe.targetDownlinkBitrate?(me.push(Ae),pe.chosenTotalBitrate+=Ae.avgBitrateKbps):pe.deltaToNextUpgrade===0&&(pe.deltaToNextUpgrade=Ae.avgBitrateKbps,ve=Ae)));else if(Ee.priority>be){Ce=Ee.priority;break}for(const Ee of ye)if(Ee.priority===be){for(const Ae of he)if(Ae.attendeeId===Ee.attendeeId){const Ie=me.findIndex(Te=>Te.groupId===Ae.groupId&&Te.maxBitrateKbps<=Ae.maxBitrateKbps&&Te.avgBitrateKbps<Ae.avgBitrateKbps);if(Ie!==-1){const Te=Ae.avgBitrateKbps-me[Ie].avgBitrateKbps;this.hasSimulcastStreams(he,Ae.attendeeId,Ae.groupId)&&this.canUpgrade(Ae.avgBitrateKbps,Ee.targetSize,Ee.targetSizeToBitrateKbps(Ee.targetSize),Ae.attendeeId.endsWith(R.default.Modality))?(this.logger.info(`bwe: attendee: ${Ae.attendeeId} group: ${Ae.groupId} has simulcast and can upgrade avgBitrate: ${Ae.avgBitrateKbps} target: ${Ee.targetSizeToBitrateKbps(Ee.targetSize)} targetTotalBitrate: ${pe.targetDownlinkBitrate}`),pe.chosenTotalBitrate+Te<=pe.targetDownlinkBitrate?(pe.chosenTotalBitrate+=Te,me[Ie]=Ae):pe.deltaToNextUpgrade===0&&(pe.deltaToNextUpgrade=Te,ve=Ae)):this.logger.info("bwe: cannot upgrade stream quality beyond target size")}}}else if(Ee.priority>be)break;if(be===Se&&pe.deltaToNextUpgrade!==0)break;be=Ce}return ve}getVideoTileForAttendeeId(pe,he){for(const me of he)if(me.state().boundAttendeeId===pe)return me;return null}canUpgrade(pe,he,me,ve){let ye=!1;return(he===ie.default.High||!ve&&pe<=me||ve&&he===ie.default.Medium&&pe<=me)&&(ye=!0),ye?(this.logger.info(`bwe: canUpgrade: bitrateKbps: ${pe} targetBitrateKbps: ${me}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbps: ${pe} targetBitrateKbps: ${me}`),!1)}hasSimulcastStreams(pe,he,me){let ve=0;for(const ye of pe)ye.attendeeId===he&&ye.groupId===me&&ve++;return this.logger.info(`bwe: attendeeId: ${he} groupId: ${me} hasSimulcastStreams: streamCount: ${ve}`),ve>1}streamsWithPreferenceDidChange(pe){if(this.previousStreamsWithPreference===void 0||pe.length!==this.previousStreamsWithPreference.length||this.videoPreferencesUpdated===!0)return!0;for(const he of pe)if(this.previousStreamsWithPreference.find(me=>me.groupId===he.groupId&&me.streamId===he.streamId&&me.maxBitrateKbps===he.maxBitrateKbps)===void 0)return!0;return!1}chosenStreamsSameAsLast(pe){if(this.optimalNonPausedReceiveStreams.length!==pe.length)return!1;for(const he of this.optimalNonPausedReceiveStreams)if(!pe.some(me=>me.streamId===he.streamId))return!1;return!0}policyStateLogStr(pe,he){const me=this.calculateSubscribeRate(this.optimalReceiveStreams),ve={targetBitrate:he,subscribedRate:me,probeState:this.rateProbeState,startupPeriod:this.startupPeriod};let ye="remoteInfos: [";for(const Ce of pe)ye+=`{grpId:${Ce.groupId} strId:${Ce.streamId} maxBr:${Ce.maxBitrateKbps} avgBr:${Ce.avgBitrateKbps}}, `;ye+="]";let Se=`bwe: optimalReceiveSet ${JSON.stringify(ve)}
bwe:   prev ${JSON.stringify(this.prevDownlinkStats)}
bwe:   now  ${JSON.stringify(this.downlinkStats)}
bwe:   ${ye}
`;return(this.pausedStreamIds.size()>0||this.pausedBwAttendeeIds.size>0)&&(Se+=`bwe:   paused: app stream ids ${JSON.stringify(this.pausedStreamIds)}  bw attendees { ${Array.from(this.pausedBwAttendeeIds).join(" ")} }
`),this.videoPreferences?Se+=`bwe:   preferences: ${JSON.stringify(this.videoPreferences)}`:Se+=`bwe:   default preferences: ${JSON.stringify(this.defaultVideoPreferences)}`,Se}getCurrentVideoPreferences(){return this.videoPreferences||this.defaultVideoPreferences}getServerSideNetworkAdaption(){return this.serverSideNetworkAdaption}setServerSideNetworkAdaption(pe){this.serverSideNetworkAdaption=pe,this.setProbeState("Not Probing")}supportedServerSideNetworkAdaptions(){return[O.default.None,O.default.BandwidthProbing,O.default.BandwidthProbingAndRemoteVideoQualityAdaption]}getVideoPreferences(){let pe=this.getCurrentVideoPreferences();return pe||(pe=ae.VideoPreferences.prepare().build()),pe}wantsAllTemporalLayersInIndex(){return!0}};return VideoPriorityBasedPolicy.default=de,de.DEFAULT_BANDWIDTH_KBPS=2800,de.STARTUP_PERIOD_MS=6e3,de.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,de.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,de.LOW_BITRATE_THRESHOLD_KBPS=300,de.MIN_TIME_BETWEEN_PROBE_MS=5e3,de.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,de.MAX_HOLD_BEFORE_PROBE_MS=3e4,de.MAX_ALLOWED_PROBE_TIME_MS=6e4,de.SPURIOUS_PACKET_LOST_THRESHOLD=2,de.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100,VideoPriorityBasedPolicy}var hasRequiredVideoAdaptiveProbePolicy;function requireVideoAdaptiveProbePolicy(){if(hasRequiredVideoAdaptiveProbePolicy)return VideoAdaptiveProbePolicy;hasRequiredVideoAdaptiveProbePolicy=1;var x=VideoAdaptiveProbePolicy&&VideoAdaptiveProbePolicy.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(VideoAdaptiveProbePolicy,"__esModule",{value:!0});const C=x(requireContentShareConstants()),E=x(requireServerSideNetworkAdaption()),w=x(requireVideoPreference()),T=requireVideoPreferences(),_=x(requireVideoPriorityBasedPolicy()),S=x(requireVideoPriorityBasedPolicyConfig());let R=class um extends _.default{constructor(O){super(O,um.createConfig()),this.logger=O,super.shouldPauseTiles=!1,this.videoPreferences=void 0}static createConfig(){const O=new S.default;return O.serverSideNetworkAdaption=E.default.None,O}reset(){super.reset(),super.shouldPauseTiles=!1,this.videoPreferences=void 0}updateIndex(O){super.updateIndex(O);const H=T.VideoPreferences.prepare();let ee=!1;const te=O.remoteStreamDescriptions();for(const ie of te)H.some(ne=>ne.attendeeId===ie.attendeeId)||(ie.attendeeId.endsWith(C.default.Modality)?(H.add(new w.default(ie.attendeeId,1)),ee=!0):H.add(new w.default(ie.attendeeId,2)));ee?(this.videoPreferences=H.build(),this.videoPreferencesUpdated=!0):this.videoPreferences=void 0}chooseRemoteVideoSources(O){this.logger.error("chooseRemoteVideoSources should not be called by VideoAdaptiveProbePolicy")}};return VideoAdaptiveProbePolicy.default=R,VideoAdaptiveProbePolicy}var DefaultVideoStreamIndex={},VideoStreamDescription={},hasRequiredVideoStreamDescription;function requireVideoStreamDescription(){if(hasRequiredVideoStreamDescription)return VideoStreamDescription;hasRequiredVideoStreamDescription=1,Object.defineProperty(VideoStreamDescription,"__esModule",{value:!0});const x=requireSignalingProtocol();let C=class dm{constructor(w,T,_,S,R){this.attendeeId="",this.groupId=0,this.streamId=0,this.ssrc=0,this.trackLabel="",this.maxBitrateKbps=0,this.avgBitrateKbps=0,this.maxFrameRate=0,this.width=0,this.height=0,this.timeEnabled=0,this.disabledByWebRTC=!1,this.disabledByUplinkPolicy=!1,this.rid="",this.attendeeId=w,this.groupId=T,this.streamId=_,this.maxBitrateKbps=S,this.avgBitrateKbps=R}clone(){const w=new dm;return w.attendeeId=this.attendeeId,w.groupId=this.groupId,w.streamId=this.streamId,w.ssrc=this.ssrc,w.trackLabel=this.trackLabel,w.maxBitrateKbps=this.maxBitrateKbps,w.avgBitrateKbps=this.avgBitrateKbps,w.maxFrameRate=this.maxFrameRate,w.timeEnabled=this.timeEnabled,w.disabledByUplinkPolicy=this.disabledByUplinkPolicy,w.width=this.width,w.height=this.height,w}toStreamDescriptor(){const w=x.SdkStreamDescriptor.create();return w.mediaType=x.SdkStreamMediaType.VIDEO,w.trackLabel=this.trackLabel,w.attendeeId=this.attendeeId,w.streamId=this.streamId,w.groupId=this.groupId,w.framerate=this.maxFrameRate,w.maxBitrateKbps=this.disabledByUplinkPolicy?0:this.maxBitrateKbps,w.avgBitrateBps=this.avgBitrateKbps,w}totalPixels(){return this.width*this.height}};return VideoStreamDescription.default=C,VideoStreamDescription}var hasRequiredDefaultVideoStreamIndex;function requireDefaultVideoStreamIndex(){if(hasRequiredDefaultVideoStreamIndex)return DefaultVideoStreamIndex;hasRequiredDefaultVideoStreamIndex=1;var x=DefaultVideoStreamIndex&&DefaultVideoStreamIndex.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(DefaultVideoStreamIndex,"__esModule",{value:!0});const C=requireSignalingProtocol(),E=x(requireDefaultVideoStreamIdSet()),w=x(requireVideoStreamDescription());let T=class{constructor(_){this.logger=_,this.currentIndex=null,this.indexForSubscribe=null,this.indexForLastRemoteVideoUpdate=null,this.currentSubscribeAck=null,this.subscribeTrackToStreamMap=null,this.subscribeStreamToAttendeeMap=null,this.subscribeStreamToExternalUserIdMap=null,this.subscribeSsrcToStreamMap=null,this.subscribeSsrcToGroupMap=null,this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null,this.videoStreamDescription=new w.default,this.sendVideoStreamId=0,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}convertBpsToKbps(_){return _>0&&_<1e3?1:Math.trunc(_/1e3)}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];const _=[];return this.currentIndex.sources.forEach(S=>{const R=new w.default;R.attendeeId=S.attendeeId,R.groupId=S.groupId,R.streamId=S.streamId,R.maxBitrateKbps=S.maxBitrateKbps,R.avgBitrateKbps=this.convertBpsToKbps(S.avgBitrateBps),R.width=S.width,R.height=S.height,R.maxFrameRate=S.framerate,_.push(R)}),_}integrateUplinkPolicyDecision(_){if(_&&_.length){const S=_[0];this.videoStreamDescription.maxBitrateKbps=S.maxBitrate/1e3,this.videoStreamDescription.maxFrameRate=S.maxFramerate}}integrateIndexFrame(_){if(this.currentIndex=_,!_)return;const S=new Map;let R=!1;for(const A of _.sources){if(!S.has(A.attendeeId)){S.set(A.attendeeId,A.groupId);continue}const O=S.get(A.attendeeId);O<A.groupId&&(this.logger.warn(`Old group ID ${O} found for attendee ID ${A.attendeeId}, replacing with newer group ID ${A.groupId}`),S.set(A.attendeeId,A.groupId)),R=!0}R&&(this.currentIndex.sources=this.currentIndex.sources.filter(A=>S.get(A.attendeeId)===A.groupId)),this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}remoteVideoUpdateSent(){this.indexForLastRemoteVideoUpdate=this.currentIndex}integrateSubscribeAckFrame(_){this.currentSubscribeAck=_,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToGroupMap=this.buildSSRCToGroupMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe),this.sendVideoStreamId=0,_.allocations&&_.allocations!==void 0&&_.allocations.length>0&&(this.sendVideoStreamId=_.allocations[0].streamId)}integrateBitratesFrame(_){if(this.currentIndex)for(const S of _.bitrates){const R=this.currentIndex.sources.find(A=>A.streamId===S.sourceStreamId);R!==void 0&&(R.avgBitrateBps=S.avgBitrateBps)}}allStreams(){const _=new E.default;if(this.currentIndex)for(const S of this.currentIndex.sources)_.add(S.streamId);return _}allVideoSendingSourcesExcludingSelf(_){const S=[],R=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(const A of this.currentIndex.sources){const{attendeeId:O,externalUserId:H,mediaType:ee}=A;O!==_&&ee===C.SdkStreamMediaType.VIDEO&&(R.has(O)||(S.push({attendee:{attendeeId:O,externalUserId:H}}),R.add(O)))}return S}streamSelectionUnderBandwidthConstraint(_,S,R,A){const O=new Set;if(this.currentIndex)for(const ne of this.currentIndex.sources)ne.attendeeId===_||ne.mediaType!==C.SdkStreamMediaType.VIDEO||!S.has(ne.attendeeId)&&!R.has(ne.attendeeId)&&O.add(ne.attendeeId);const H=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(_),ee=new Map;let te=0;H.forEach((ne,ae)=>{ee.set(ae,ne[0]),te+=ne[0].maxBitrateKbps}),te=this.trySelectHighBitrateForAttendees(H,S,te,A,ee),this.trySelectHighBitrateForAttendees(H,O,te,A,ee);const ie=new E.default;for(const ne of ee.values())ie.add(ne.streamId);return ie}highestQualityStreamFromEachGroupExcludingSelf(_){const S=new E.default;if(this.currentIndex){const R=new Map;for(const A of this.currentIndex.sources)A.attendeeId===_||A.mediaType!==C.SdkStreamMediaType.VIDEO||(!R.has(A.groupId)||A.maxBitrateKbps>R.get(A.groupId).maxBitrateKbps)&&R.set(A.groupId,A);for(const A of R.values())S.add(A.streamId)}return S}numberOfVideoPublishingParticipantsExcludingSelf(_){return this.highestQualityStreamFromEachGroupExcludingSelf(_).array().length}numberOfParticipants(){return this.currentIndex.numParticipants?this.currentIndex.numParticipants:-1}attendeeIdForTrack(_){const S=this.streamIdForTrack(_);return S===void 0||!this.subscribeStreamToAttendeeMap?(this.logger.warn(`no attendee found for track ${_}`),""):this.subscribeStreamToAttendeeMap.get(S)||(this.logger.info(`track ${_} (stream ${S}) does not correspond to a known attendee`),"")}externalUserIdForTrack(_){const S=this.streamIdForTrack(_);return S===void 0||!this.subscribeStreamToExternalUserIdMap?(this.logger.warn(`no external user id found for track ${_}`),""):this.subscribeStreamToExternalUserIdMap.get(S)||(this.logger.info(`track ${_} (stream ${S}) does not correspond to a known externalUserId`),"")}attendeeIdForStreamId(_){if(!this.streamToAttendeeMap)if(this.currentIndex)this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex);else return"";return this.streamToAttendeeMap.get(_)||(this.logger.info(`stream ID ${_} does not correspond to a known attendee`),"")}attendeeIdForGroupId(_){if(!this.groupIdToAttendeeMap)if(this.currentIndex)this.groupIdToAttendeeMap=this.buildGroupIdToAttendeeMap(this.currentIndex);else return"";return this.groupIdToAttendeeMap.get(_)||(this.logger.info(`group ID ${_} does not correspond to a known attendee`),"")}groupIdForStreamId(_){if(!(!this.currentIndex||!this.currentIndex.sources)){for(const S of this.currentIndex.sources)if(S.streamId===_)return S.groupId;if(this.indexForSubscribe){for(const S of this.indexForSubscribe.sources)if(S.streamId===_)return S.groupId}if(this.indexForLastRemoteVideoUpdate){for(const S of this.indexForLastRemoteVideoUpdate.sources)if(S.streamId===_)return S.groupId}}}StreamIdsInSameGroup(_,S){return this.groupIdForStreamId(_)===this.groupIdForStreamId(S)}streamIdForTrack(_){if(this.subscribeTrackToStreamMap)return this.subscribeTrackToStreamMap.get(_)}streamIdForSSRC(_){if(this.subscribeSsrcToStreamMap)return this.subscribeSsrcToStreamMap.get(_)}overrideStreamIdMappings(_,S){if(this.subscribeTrackToStreamMap){for(const[R,A]of this.subscribeTrackToStreamMap.entries())if(_===A){this.subscribeTrackToStreamMap.set(R,S);break}}if(this.subscribeSsrcToStreamMap){for(const[R,A]of this.subscribeSsrcToStreamMap.entries())if(_===A){this.subscribeSsrcToStreamMap.set(R,S);break}}}groupIdForSSRC(_){if(this.subscribeSsrcToGroupMap)return this.subscribeSsrcToGroupMap.get(_)}streamsPausedAtSource(){const _=new E.default;if(this.currentIndex)for(const S of this.currentIndex.pausedAtSourceIds)_.add(S);return _}sendVideoStreamIdFromRid(_){return this.sendVideoStreamId}buildTrackToStreamMap(_){const S=new Map;this.logger.debug(()=>`trackMap ${JSON.stringify(_.tracks)}`);for(const R of _.tracks)R.trackLabel.length>0&&R.streamId>0&&S.set(R.trackLabel,R.streamId);return S}buildSSRCToStreamMap(_){const S=new Map;this.logger.debug(()=>`ssrcMap ${JSON.stringify(_.tracks)}`);for(const R of _.tracks)R.trackLabel.length>0&&R.streamId>0&&S.set(R.ssrc,R.streamId);return S}buildSSRCToGroupMap(_){const S=new Map;for(const R of _.tracks)R.trackLabel.length>0&&R.streamId>0&&S.set(R.ssrc,this.groupIdForStreamId(R.streamId));return S}buildStreamToAttendeeMap(_){const S=new Map;if(_)for(const R of _.sources)S.set(R.streamId,R.attendeeId);return S}buildGroupIdToAttendeeMap(_){const S=new Map;for(const R of _.sources)S.set(R.groupId,R.attendeeId);return S}buildStreamExternalUserIdMap(_){const S=new Map;if(_)for(const R of _.sources)R.externalUserId&&S.set(R.streamId,R.externalUserId);return S}trySelectHighBitrateForAttendees(_,S,R,A,O){for(const H of S){if(R>=A)break;if(_.has(H)){const ee=_.get(H);for(const te of ee.reverse())if(R-O.get(H).maxBitrateKbps+te.maxBitrateKbps<A){R=R-O.get(H).maxBitrateKbps+te.maxBitrateKbps,O.set(H,te);break}}}return R}buildAttendeeToSortedStreamDescriptorMapExcludingSelf(_){const S=new Map;if(this.currentIndex)for(const R of this.currentIndex.sources)R.attendeeId===_||R.mediaType!==C.SdkStreamMediaType.VIDEO||(S.has(R.attendeeId)?S.get(R.attendeeId).push(R):S.set(R.attendeeId,[R]));return S.forEach((R,A)=>{R.sort((O,H)=>O.maxBitrateKbps>H.maxBitrateKbps?1:O.maxBitrateKbps<H.maxBitrateKbps?-1:0)}),S}};return DefaultVideoStreamIndex.default=T,DefaultVideoStreamIndex}var SimulcastVideoStreamIndex={},hasRequiredSimulcastVideoStreamIndex;function requireSimulcastVideoStreamIndex(){if(hasRequiredSimulcastVideoStreamIndex)return SimulcastVideoStreamIndex;hasRequiredSimulcastVideoStreamIndex=1;var x=SimulcastVideoStreamIndex&&SimulcastVideoStreamIndex.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(SimulcastVideoStreamIndex,"__esModule",{value:!0});const C=requireSignalingProtocol(),E=x(requireDefaultVideoStreamIndex()),w=x(requireVideoStreamDescription());let T=class Js extends E.default{constructor(){super(...arguments),this.streamIdToBitrateKbpsMap=new Map,this._localStreamInfos=[],this._sendRidToVideoStreamIdMap=new Map}localStreamDescriptions(){const S=[];return this._localStreamInfos.forEach(R=>{S.push(R.clone())}),S}integrateUplinkPolicyDecision(S){let R=!0,A=0;for(let O=0;O<S.length;O++){const H=S[O].maxBitrate/1e3,ee=S[O].maxFramerate;if(!R||O===this._localStreamInfos.length){R=!1;const te=new w.default;te.maxBitrateKbps=H,te.maxFrameRate=ee,te.disabledByUplinkPolicy=H===0,te.rid=S[O].rid,H!==0&&(te.timeEnabled=Date.now()),this._localStreamInfos.push(te),A++;continue}this._localStreamInfos[A].maxBitrateKbps===0&&H>0&&(this._localStreamInfos[A].timeEnabled=Date.now()),this._localStreamInfos[A].maxBitrateKbps=H,this._localStreamInfos[A].maxFrameRate=ee,this._localStreamInfos[A].disabledByUplinkPolicy=H===0,A++}R&&this._localStreamInfos.splice(A)}integrateBitratesFrame(S){super.integrateBitratesFrame(S);const R=new Set,A=new Set(this.streamIdToBitrateKbpsMap.keys());for(const O of S.bitrates)R.add(O.sourceStreamId),this.streamIdToBitrateKbpsMap.set(O.sourceStreamId,this.convertBpsToKbps(O.avgBitrateBps));for(const O of A)R.has(O)||(this.streamIdToBitrateKbpsMap.get(O)===Js.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(O,Js.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(O,Js.NOT_SENDING_STREAM_BITRATE));this.logLocalStreamDescriptions()}logLocalStreamDescriptions(){let S="";for(const R of this._localStreamInfos)S+=`streamId=${R.streamId} maxBitrate=${R.maxBitrateKbps} disabledByUplink=${R.disabledByUplinkPolicy}
`;this.logger.debug(()=>S)}integrateIndexFrame(S){super.integrateIndexFrame(S);const R=new Set,A=new Set(this.streamIdToBitrateKbpsMap.keys());for(const O of this.currentIndex.sources)O.mediaType===C.SdkStreamMediaType.VIDEO&&(R.add(O.streamId),this.streamIdToBitrateKbpsMap.has(O.streamId)||this.streamIdToBitrateKbpsMap.set(O.streamId,Js.UNSEEN_STREAM_BITRATE));for(const O of A)R.has(O)||this.streamIdToBitrateKbpsMap.delete(O)}integrateSubscribeAckFrame(S){if(super.integrateSubscribeAckFrame(S),!S.allocations||S.allocations===void 0)return;let R=0;this._sendRidToVideoStreamIdMap.clear();for(const A of S.allocations){if(this._localStreamInfos.length<R+1){this.logger.info("simulcast: allocation has more than number of local streams");break}this._localStreamInfos[R].groupId=A.groupId,this._localStreamInfos[R].streamId=A.streamId,this.streamIdToBitrateKbpsMap.has(A.streamId)||this.streamIdToBitrateKbpsMap.set(A.streamId,Js.UNSEEN_STREAM_BITRATE),this._sendRidToVideoStreamIdMap.set(this._localStreamInfos[R].rid,A.streamId),R++}}sendVideoStreamIdFromRid(S){let R=0;return this._sendRidToVideoStreamIdMap.has(S)&&(R=this._sendRidToVideoStreamIdMap.get(S)),R}};return SimulcastVideoStreamIndex.default=T,T.UNSEEN_STREAM_BITRATE=-2,T.RECENTLY_INACTIVE_STREAM_BITRATE=-1,T.NOT_SENDING_STREAM_BITRATE=0,T.BitratesMsgFrequencyMs=4e3,SimulcastVideoStreamIndex}var DefaultVideoTileController={},DefaultDevicePixelRatioMonitor={},hasRequiredDefaultDevicePixelRatioMonitor;function requireDefaultDevicePixelRatioMonitor(){if(hasRequiredDefaultDevicePixelRatioMonitor)return DefaultDevicePixelRatioMonitor;hasRequiredDefaultDevicePixelRatioMonitor=1;var x=DefaultDevicePixelRatioMonitor&&DefaultDevicePixelRatioMonitor.__awaiter||function(E,w,T,_){function S(R){return R instanceof T?R:new T(function(A){A(R)})}return new(T||(T=Promise))(function(R,A){function O(te){try{ee(_.next(te))}catch(ie){A(ie)}}function H(te){try{ee(_.throw(te))}catch(ie){A(ie)}}function ee(te){te.done?R(te.value):S(te.value).then(O,H)}ee((_=_.apply(E,w||[])).next())})};Object.defineProperty(DefaultDevicePixelRatioMonitor,"__esModule",{value:!0});let C=class{constructor(E,w){if(this.devicePixelRatioSource=E,this.observerQueue=new Set,this.mediaQueryListener=()=>{this.observerQueue.forEach(_=>{_.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())})},typeof window>"u")return;const T=matchMedia(`(resolution: ${this.devicePixelRatioSource.devicePixelRatio()}dppx)`);typeof T.addEventListener=="function"?(T.addEventListener("change",this.mediaQueryListener),this.mediaQueryList=T):typeof T.addListener=="function"?(T.addListener(this.mediaQueryListener),this.mediaQueryList=T):w.warn("ignoring DefaultDevicePixelRatioMonitor")}destroy(){return x(this,void 0,void 0,function*(){this.mediaQueryList&&(typeof this.mediaQueryList.addEventListener=="function"?this.mediaQueryList.removeEventListener("change",this.mediaQueryListener):this.mediaQueryList.removeListener(this.mediaQueryListener)),delete this.mediaQueryListener,this.observerQueue.clear()})}registerObserver(E){this.observerQueue.add(E),E.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}removeObserver(E){this.observerQueue.delete(E)}};return DefaultDevicePixelRatioMonitor.default=C,DefaultDevicePixelRatioMonitor}var DevicePixelRatioWindowSource={},hasRequiredDevicePixelRatioWindowSource;function requireDevicePixelRatioWindowSource(){if(hasRequiredDevicePixelRatioWindowSource)return DevicePixelRatioWindowSource;hasRequiredDevicePixelRatioWindowSource=1,Object.defineProperty(DevicePixelRatioWindowSource,"__esModule",{value:!0});let x=class{devicePixelRatio(){return typeof window>"u"||!window||!window.devicePixelRatio?1:window.devicePixelRatio}};return DevicePixelRatioWindowSource.default=x,DevicePixelRatioWindowSource}var DefaultVideoElementResolutionMonitor={},hasRequiredDefaultVideoElementResolutionMonitor;function requireDefaultVideoElementResolutionMonitor(){if(hasRequiredDefaultVideoElementResolutionMonitor)return DefaultVideoElementResolutionMonitor;hasRequiredDefaultVideoElementResolutionMonitor=1,Object.defineProperty(DefaultVideoElementResolutionMonitor,"__esModule",{value:!0});let x=class{constructor(){this.observerQueue=new Set,this.element=null,this.resizeObserver=new ResizeObserver(C=>{for(const E of C){const{width:w,height:T}=E.contentRect;this.notifyObservers(w,T)}})}notifyObservers(C,E){for(const w of this.observerQueue)w.videoElementResolutionChanged(C,E)}registerObserver(C){this.observerQueue.add(C)}removeObserver(C){this.observerQueue.delete(C)}bindVideoElement(C){this.element!==C&&(this.element&&this.resizeObserver.unobserve(this.element),this.element=C,this.element&&this.resizeObserver.observe(this.element))}};return DefaultVideoElementResolutionMonitor.default=x,DefaultVideoElementResolutionMonitor}var hasRequiredDefaultVideoTileController;function requireDefaultVideoTileController(){if(hasRequiredDefaultVideoTileController)return DefaultVideoTileController;hasRequiredDefaultVideoTileController=1;var x=DefaultVideoTileController&&DefaultVideoTileController.__awaiter||function(O,H,ee,te){function ie(ne){return ne instanceof ee?ne:new ee(function(ae){ae(ne)})}return new(ee||(ee=Promise))(function(ne,ae){function oe(de){try{fe(te.next(de))}catch(ce){ae(ce)}}function le(de){try{fe(te.throw(de))}catch(ce){ae(ce)}}function fe(de){de.done?ne(de.value):ie(de.value).then(oe,le)}fe((te=te.apply(O,H||[])).next())})},C=DefaultVideoTileController&&DefaultVideoTileController.__importDefault||function(O){return O&&O.__esModule?O:{default:O}};Object.defineProperty(DefaultVideoTileController,"__esModule",{value:!0});const E=C(requireVideoQualitySettings()),w=C(requireDefaultDevicePixelRatioMonitor()),T=C(requireDevicePixelRatioWindowSource()),_=requireTypes$1(),S=C(requireDefaultVideoElementResolutionMonitor()),R=C(requireDefaultVideoTile());let A=class{constructor(O,H,ee){this.tileFactory=O,this.audioVideoController=H,this.logger=ee,this.tileMap=new Map,this.nextTileId=1,this.currentLocalTile=null,this.currentPausedTilesByIds=new Set,this.resolutionObservers=new Set,this.keepLastFrameWhenPaused=!1,this.keepLastFrameWhenPaused=H.configuration.keepLastFrameWhenPaused}createDevicePixelRatioMonitorIfNeeded(){this.devicePixelRatioMonitor||(this.devicePixelRatioMonitor=new w.default(new T.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return x(this,void 0,void 0,function*(){if(this.tileMap.size||!this.devicePixelRatioMonitor)return;const O=this.devicePixelRatioMonitor;return this.devicePixelRatioMonitor=void 0,O.destroy()})}bindVideoElement(O,H){const ee=this.getVideoTile(O);if(ee===null){this.logger.warn(`Ignoring video element binding for unknown tile id ${O}`);return}ee.bindVideoElement(H)}unbindVideoElement(O,H=!0){const ee=this.getVideoTile(O);if(ee===null){this.logger.warn(`Ignoring video element unbinding for unknown tile id ${O}`);return}this.logger.info("Unbinding the video element"),this.notifyRemoteObserversOfUnbound(ee.state().boundAttendeeId);const te=ee.stateRef().boundVideoElement;ee.bindVideoElement(null),H&&(this.logger.info("Cleaning up the video element"),R.default.disconnectVideoStreamFromVideoElement(te,!1))}startLocalVideoTile(){if(this.audioVideoController.configuration.meetingFeatures.videoMaxResolution===E.default.VideoDisabled)return this.logger.warn("Could not start camera video because max video resolution was set to None"),-1;const O=this.findOrCreateLocalVideoTile();return this.currentLocalTile.stateRef().localTileStarted=!0,this.audioVideoController.update({needsRenegotiation:!0}),O.id()}stopLocalVideoTile(){this.currentLocalTile&&(this.currentLocalTile.stateRef().localTileStarted=!1,this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId),this.audioVideoController.update({needsRenegotiation:!0}))}hasStartedLocalVideoTile(){return!!(this.currentLocalTile&&this.currentLocalTile.stateRef().localTileStarted)}removeLocalVideoTile(){this.currentLocalTile&&this.removeVideoTile(this.currentLocalTile.id())}getLocalVideoTile(){return this.currentLocalTile}pauseVideoTile(O){const H=this.getVideoTile(O);H&&(this.currentPausedTilesByIds.has(O)||(this.audioVideoController.pauseReceivingStream(H.stateRef().streamId),this.currentPausedTilesByIds.add(O)),H.pause())}unpauseVideoTile(O){const H=this.getVideoTile(O);H&&(this.currentPausedTilesByIds.has(O)&&(this.audioVideoController.resumeReceivingStream(H.stateRef().streamId),this.currentPausedTilesByIds.delete(O)),H.unpause())}getVideoTile(O){return this.tileMap.has(O)?this.tileMap.get(O):null}getVideoTileArea(O){const H=O.state();let ee=0,te=0;return H.boundVideoElement&&(ee=H.boundVideoElement.clientHeight*H.devicePixelRatio,te=H.boundVideoElement.clientWidth*H.devicePixelRatio),ee*te}getAllRemoteVideoTiles(){const O=new Array;return this.tileMap.forEach((H,ee)=>{(!this.currentLocalTile||ee!==this.currentLocalTile.id())&&O.push(H)}),O}getAllVideoTiles(){return Array.from(this.tileMap.values())}addVideoTile(O=!1){const H=this.nextTileId;this.nextTileId+=1,this.createDevicePixelRatioMonitorIfNeeded();const ee=this.tileFactory.makeTile(H,O,this,this.devicePixelRatioMonitor,this.createResolutionMonitor(H));return this.tileMap.set(H,ee),ee}removeVideoTile(O){if(!this.tileMap.has(O))return;const H=this.tileMap.get(O);this.currentLocalTile===H&&(this.currentLocalTile=null),H.destroy(),this.tileMap.delete(O),this.audioVideoController.forEachObserver(ee=>{_.Maybe.of(ee.videoTileWasRemoved).map(te=>te.bind(ee)(O))}),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(O){const H=[];for(const ee of this.getAllVideoTiles()){const te=ee.state();te.boundAttendeeId===O&&(this.removeVideoTile(te.tileId),H.push(te.tileId))}return H}removeAllVideoTiles(){const O=Array.from(this.tileMap.keys());for(const H of O)this.removeVideoTile(H)}sendTileStateUpdate(O){this.audioVideoController.forEachObserver(H=>{_.Maybe.of(H.videoTileDidUpdate).map(ee=>ee.bind(H)(O))})}haveVideoTilesWithStreams(){for(const O of this.getAllVideoTiles())if(O.state().boundVideoStream)return!0;return!1}haveVideoTileForAttendeeId(O){return!!this.getVideoTileForAttendeeId(O)}getVideoTileForAttendeeId(O){for(const H of this.getAllVideoTiles())if(H.state().boundAttendeeId===O)return H}captureVideoTile(O){const H=this.getVideoTile(O);return H?H.capture():null}registerVideoTileResolutionObserver(O){this.resolutionObservers.add(O)}removeVideoTileResolutionObserver(O){this.resolutionObservers.delete(O)}notifyResolutionObserversOfChange(O,H,ee){for(const te of this.resolutionObservers)te.videoTileResolutionDidChange(O,H,ee)}notifyRemoteObserversOfUnbound(O){for(const H of this.resolutionObservers)H.videoTileUnbound(O)}createResolutionMonitor(O){const H=new class{constructor(te,ie){this.controller=te,this.tileId=ie}videoElementResolutionChanged(te,ie){const ne=this.controller.getVideoTile(this.tileId);if(ne){const ae=ne.state().boundAttendeeId;this.controller.notifyResolutionObserversOfChange(ae,te,ie)}}}(this,O),ee=new S.default;return ee.registerObserver(H),ee}findOrCreateLocalVideoTile(){return this.currentLocalTile?this.currentLocalTile:(this.currentLocalTile=this.addVideoTile(!0),this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId),this.currentLocalTile)}};return DefaultVideoTileController.default=A,DefaultVideoTileController}var DefaultVideoTileFactory={},hasRequiredDefaultVideoTileFactory;function requireDefaultVideoTileFactory(){if(hasRequiredDefaultVideoTileFactory)return DefaultVideoTileFactory;hasRequiredDefaultVideoTileFactory=1;var x=DefaultVideoTileFactory&&DefaultVideoTileFactory.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(DefaultVideoTileFactory,"__esModule",{value:!0});const C=x(requireDefaultVideoTile());let E=class{makeTile(w,T,_,S,R){return new C.default(w,T,_,S,R)}};return DefaultVideoTileFactory.default=E,DefaultVideoTileFactory}var DefaultSimulcastUplinkPolicy={},SimulcastLayers={},hasRequiredSimulcastLayers;function requireSimulcastLayers(){return hasRequiredSimulcastLayers||(hasRequiredSimulcastLayers=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.SimulcastLayers=void 0;var C;(function(E){E[E.Low=0]="Low",E[E.LowAndMedium=1]="LowAndMedium",E[E.LowAndHigh=2]="LowAndHigh",E[E.Medium=3]="Medium",E[E.MediumAndHigh=4]="MediumAndHigh",E[E.High=5]="High"})(C=x.SimulcastLayers||(x.SimulcastLayers={})),x.default=C}(SimulcastLayers)),SimulcastLayers}var hasRequiredDefaultSimulcastUplinkPolicy;function requireDefaultSimulcastUplinkPolicy(){if(hasRequiredDefaultSimulcastUplinkPolicy)return DefaultSimulcastUplinkPolicy;hasRequiredDefaultSimulcastUplinkPolicy=1;var x=DefaultSimulcastUplinkPolicy&&DefaultSimulcastUplinkPolicy.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(DefaultSimulcastUplinkPolicy,"__esModule",{value:!0});const C=x(requireSimulcastLayers()),E=x(requireSimulcastTransceiverController()),w=requireTypes$1(),T=x(requireDefaultVideoCaptureAndEncodeParameter()),_=x(requireBitrateParameters());let S=class vn{constructor(A,O){this.selfAttendeeId=A,this.logger=O,this.numSenders=0,this.shouldDisableSimulcast=!1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.videoIndex=null,this.observerQueue=new Set,this.hiTargetBitrateKbps=vn.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=vn.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=vn.kLowTargetBitrateKbpsHd,this.enableFhdVideo=!1,this.optimalParameters=new T.default(0,0,0,0,!0),this.parametersInEffect=new T.default(0,0,0,0,!0),this.currentQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps]),this.newQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps])}updateConnectionMetric(A){}calculateEncodingParameters(){const A=[new _.default,new _.default,new _.default];this.shouldDisableSimulcast?(this.newActiveStreams=0,A[0].maxBitrateKbps=0,A[1].maxBitrateKbps=this.hiTargetBitrateKbps,A[2].maxBitrateKbps=0):this.numSenders<=4?(this.newActiveStreams=1,A[0].maxBitrateKbps=this.lowTargetBitrateKbps,A[1].maxBitrateKbps=0,A[2].maxBitrateKbps=this.hiTargetBitrateKbps):(this.newActiveStreams=2,A[0].maxBitrateKbps=this.lowTargetBitrateKbps*2/3,A[1].maxBitrateKbps=this.numSenders<=6?this.midTargetBitrateKbps:this.midTargetBitrateKbps*.6,A[2].maxBitrateKbps=0);const O=A.map((H,ee,te)=>H.maxBitrateKbps);return this.newQualityMap=this.fillEncodingParamWithBitrates(O),this.encodingParametersEqual()||this.logger.info(`simulcast: policy:calculateEncodingParameters numSources:${this.numSenders} shouldDisableSimulcast:${this.shouldDisableSimulcast} newQualityMap: ${this.getQualityMapString(this.newQualityMap)}`),this.newQualityMap}chooseMediaTrackConstraints(){}chooseEncodingParameters(){return this.currentQualityMap=this.newQualityMap,this.activeStreamsToPublish!==this.newActiveStreams&&(this.activeStreamsToPublish=this.newActiveStreams,this.publishEncodingSimulcastLayer()),this.currentQualityMap}updateIndex(A){const O=A.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+1,H=O!==this.numSenders,ee=A.numberOfParticipants(),te=ee>=0&&ee<=2,ie=this.shouldDisableSimulcast!==te;this.numSenders=O,this.shouldDisableSimulcast=te,this.optimalParameters=new T.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=A,(H||ie)&&(this.newQualityMap=this.calculateEncodingParameters())}wantsResubscribe(){return!this.encodingParametersEqual()}compareEncodingParameter(A,O){return JSON.stringify(A)===JSON.stringify(O)}encodingParametersEqual(){let A=!1;for(const O of E.default.NAME_ARR_ASCENDING)if(A=A||!this.compareEncodingParameter(this.newQualityMap.get(O),this.currentQualityMap.get(O)),A)break;return!A}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){return this.enableFhdVideo?1920:1280}captureHeight(){return this.enableFhdVideo?1080:768}captureFrameRate(){return 15}maxBandwidthKbps(){return this.enableFhdVideo?2500:1400}setIdealMaxBandwidthKbps(A){}setHasBandwidthPriority(A){}setHighResolutionFeatureEnabled(A){this.enableFhdVideo=A,this.hiTargetBitrateKbps=A?vn.kHiTargetBitrateKbpsFhd:vn.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=A?vn.kMidTargetBitrateKbpsFhd:vn.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=A?vn.kLowTargetBitrateKbpsFhd:vn.kLowTargetBitrateKbpsHd}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!0}fillEncodingParamWithBitrates(A){const O=new Map,H=1e3,ee=E.default.NAME_ARR_ASCENDING,te=A;let ie=this.shouldDisableSimulcast?1:4;for(let ne=0;ne<ee.length;ne++){const ae=ee[ne];O.set(ae,{rid:ae,active:te[ne]>0,scaleResolutionDownBy:Math.max(ie,1),maxBitrate:te[ne]*H}),ie=ie/2}return O}getQualityMapString(A){let O="";return this.videoIndex.localStreamDescriptions().length===3&&A.forEach(H=>{O+=`{ rid: ${H.rid} active:${H.active} maxBitrate:${H.maxBitrate}}`}),O}getEncodingSimulcastLayer(A){switch(A){case 0:return C.default.High;case 1:return C.default.LowAndHigh;case 2:return C.default.LowAndMedium}}publishEncodingSimulcastLayer(){const A=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver(O=>{w.Maybe.of(O.encodingSimulcastLayersDidChange).map(H=>H.bind(O)(A))})}addObserver(A){this.logger.info("adding simulcast uplink observer"),this.observerQueue.add(A)}removeObserver(A){this.logger.info("removing simulcast uplink observer"),this.observerQueue.delete(A)}forEachObserver(A){for(const O of this.observerQueue)A(O)}};return DefaultSimulcastUplinkPolicy.default=S,S.kHiTargetBitrateKbpsHd=1200,S.kMidTargetBitrateKbpsHd=600,S.kLowTargetBitrateKbpsHd=300,S.kHiTargetBitrateKbpsFhd=2e3,S.kMidTargetBitrateKbpsFhd=1e3,S.kLowTargetBitrateKbpsFhd=500,DefaultSimulcastUplinkPolicy}var NScaleVideoUplinkBandwidthPolicy={},hasRequiredNScaleVideoUplinkBandwidthPolicy;function requireNScaleVideoUplinkBandwidthPolicy(){if(hasRequiredNScaleVideoUplinkBandwidthPolicy)return NScaleVideoUplinkBandwidthPolicy;hasRequiredNScaleVideoUplinkBandwidthPolicy=1;var x=NScaleVideoUplinkBandwidthPolicy&&NScaleVideoUplinkBandwidthPolicy.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})},C=NScaleVideoUplinkBandwidthPolicy&&NScaleVideoUplinkBandwidthPolicy.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(NScaleVideoUplinkBandwidthPolicy,"__esModule",{value:!0});const E=C(requireDefaultVideoCaptureAndEncodeParameter());let w=class Ys{constructor(_,S=!0,R=void 0,A=void 0){this.selfAttendeeId=_,this.scaleResolution=S,this.logger=R,this.browserBehavior=A,this.numberOfPublishedVideoSources=void 0,this.idealMaxBandwidthKbps=1500,this.hasBandwidthPriority=!1,this.encodingParamMap=new Map,this.enableHighResolutionFeature=!1,this.enableSVC=!1,this.isUsingSVCCodec=!0,this.numParticipants=0,this.reset()}reset(){this.numberOfPublishedVideoSources=void 0,this.optimalParameters=new E.default(0,0,0,0,!1),this.parametersInEffect=new E.default(0,0,0,0,!1),this.encodingParamMap.set(Ys.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(_){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(_){var S;let R=!0;this.transceiverController&&(R=this.transceiverController.hasVideoInput());const A=_.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+(R?1:0),O=_.numberOfParticipants();if(this.numParticipants===O&&this.numberOfPublishedVideoSources===A){(S=this.logger)===null||S===void 0||S.debug("Skipping update index; Number of participants has not changed");return}this.numberOfPublishedVideoSources=A,this.numParticipants=O,this.updateOptimalParameters()}wantsResubscribe(){return!this.parametersInEffect.equal(this.optimalParameters)}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}updateOptimalParameters(){let _=1;if(this.transceiverController){const S=this.getStreamCaptureSetting();S&&(_=this.calculateEncodingParameters(S).scaleResolutionDownBy)}this.optimalParameters=new E.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,_,this.enableSVC&&this.numParticipants>2&&this.isUsingSVCCodec)}captureWidth(){let _=640;return this.getNumberOfPublishedVideoSources()>4&&(_=320),_}captureHeight(){let _=384;return this.getNumberOfPublishedVideoSources()>4&&(_=192),_}captureFrameRate(){return 15}maxBandwidthKbps(){if(this.hasBandwidthPriority)return Math.trunc(this.idealMaxBandwidthKbps);let _=0;return this.getNumberOfPublishedVideoSources()<=2?_=this.idealMaxBandwidthKbps:this.getNumberOfPublishedVideoSources()<=4?_=this.idealMaxBandwidthKbps*2/3:_=(544/11+14880/(11*this.getNumberOfPublishedVideoSources()))/600*this.idealMaxBandwidthKbps,Math.trunc(_)}setIdealMaxBandwidthKbps(_){this.idealMaxBandwidthKbps=_}setHasBandwidthPriority(_){this.hasBandwidthPriority=_}setTransceiverController(_){this.transceiverController=_}setSVCEnabled(_){var S;this.enableSVC=_,(S=this.logger)===null||S===void 0||S.info(`setSVCEnabled, enable: ${_}}`)}setHighResolutionFeatureEnabled(_){this.enableHighResolutionFeature=_}updateTransceiverController(){return x(this,void 0,void 0,function*(){const _=this.getStreamCaptureSetting();if(!_)return;const S=this.calculateEncodingParameters(_);this.shouldUpdateEndcodingParameters(S)&&(this.encodingParamMap.set(Ys.encodingMapKey,S),this.transceiverController.setEncodingParameters(this.encodingParamMap))})}shouldUpdateEndcodingParameters(_){var S,R;const A=(R=(S=this.transceiverController.localVideoTransceiver().sender.getParameters())===null||S===void 0?void 0:S.encodings)===null||R===void 0?void 0:R[0];return _.maxBitrate!==A?.maxBitrate||_.scaleResolutionDownBy!==A?.scaleResolutionDownBy||_?.scalabilityMode!==A?.scalabilityMode}calculateEncodingParameters(_){var S,R,A;const O=this.maxBandwidthKbps()*1e3;let H=1,ee=720;if(_.height!==void 0&&_.width!==void 0&&this.scaleResolution&&!this.hasBandwidthPriority&&this.getNumberOfPublishedVideoSources()>2&&(ee=Ys.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),Ys.targetHeightArray.length-1)][this.enableHighResolutionFeature?1:0],ee===480&&!((S=this.browserBehavior)===null||S===void 0)&&S.disable480pResolutionScaleDown()&&(ee=360),H=Math.max(Math.min(_.height,_.width)/ee,1),(R=this.logger)===null||R===void 0||R.info(`Resolution scale factor is ${H} for capture resolution ${_.width}x${_.height}. New dimension is ${_.width/H}x${_.height/H}`)),this.enableSVC){let te;return this.numParticipants>=0&&this.numParticipants<3||!this.isUsingSVCCodec?te="L1T1":te="L3T3",(A=this.logger)===null||A===void 0||A.info(`calculateEncodingParameters: SVC: ${this.enableSVC}    participants: ${this.numParticipants}     publishers: ${this.getNumberOfPublishedVideoSources()}     bitrate: ${O}  targetHeight: ${ee}  scalabilityMode: ${te}   isUsingSVCCodec: ${this.isUsingSVCCodec}`),{scaleResolutionDownBy:H,maxBitrate:O,scalabilityMode:te}}else return{scaleResolutionDownBy:H,maxBitrate:O}}getStreamCaptureSetting(){var _,S,R,A;return(A=(R=(S=(_=this.transceiverController)===null||_===void 0?void 0:_.localVideoTransceiver())===null||S===void 0?void 0:S.sender)===null||R===void 0?void 0:R.track)===null||A===void 0?void 0:A.getSettings()}getNumberOfPublishedVideoSources(){var _;return(_=this.numberOfPublishedVideoSources)!==null&&_!==void 0?_:0}wantsVideoDependencyDescriptorRtpHeaderExtension(){return this.enableSVC}setMeetingSupportedVideoSendCodecs(_,S){const R=_??S,A=R.length>0&&Ys.SVCCodecNames.includes(R[0].codecName);A!==this.isUsingSVCCodec&&(this.isUsingSVCCodec=A,this.updateOptimalParameters())}};return NScaleVideoUplinkBandwidthPolicy.default=w,w.encodingMapKey="video",w.targetHeightArray=[[0,0],[0,0],[0,0],[540,720],[540,720],[480,540],[480,540],[480,540],[480,540],[360,480],[360,480],[360,480],[360,480],[270,360],[270,360],[270,360],[270,360],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270]],w.SVCCodecNames=["VP9"],NScaleVideoUplinkBandwidthPolicy}var DefaultVolumeIndicatorAdapter={},hasRequiredDefaultVolumeIndicatorAdapter;function requireDefaultVolumeIndicatorAdapter(){if(hasRequiredDefaultVolumeIndicatorAdapter)return DefaultVolumeIndicatorAdapter;hasRequiredDefaultVolumeIndicatorAdapter=1,Object.defineProperty(DefaultVolumeIndicatorAdapter,"__esModule",{value:!0});let x=class bc{constructor(E,w,T,_,S){this.logger=E,this.realtimeController=w,this.minVolumeDecibels=T,this.maxVolumeDecibels=_,this.selfAttendeeId=S,this.streamIdToAttendeeId={},this.streamIdToExternalUserId={},this.warnedAboutMissingStreamIdMapping={},this.attendeeIdToStreamId={},this.sessionReconnected=!1}onReconnect(){this.sessionReconnected=!0}sendRealtimeUpdatesForAudioStreamIdInfo(E){let w=0;for(const T of E.streams){const _=!!T.attendeeId,S=!!T.externalUserId,R=T.hasOwnProperty("muted"),A=!!T.dropped;if(_){this.attendeeIdToStreamId[T.attendeeId]&&this.attendeeIdToStreamId[T.attendeeId]<T.audioStreamId&&delete this.attendeeIdToStreamId[T.attendeeId],this.streamIdToAttendeeId[T.audioStreamId]=T.attendeeId;const O=S?T.externalUserId:T.attendeeId;this.streamIdToExternalUserId[T.audioStreamId]=O,this.attendeeIdToStreamId[T.attendeeId]=T.audioStreamId,this.realtimeController.realtimeSetAttendeeIdPresence(T.attendeeId,!0,O,!1,{attendeeIndex:w++,attendeesInFrame:E.streams.length})}if(R){const O=this.streamIdToAttendeeId[T.audioStreamId],H=this.streamIdToExternalUserId[T.audioStreamId];this.realtimeController.realtimeUpdateVolumeIndicator(O,null,T.muted,null,H)}if(!_&&!R){const O=this.streamIdToAttendeeId[T.audioStreamId];if(O){const H=this.streamIdToExternalUserId[T.audioStreamId];delete this.streamIdToAttendeeId[T.audioStreamId],delete this.streamIdToExternalUserId[T.audioStreamId],delete this.warnedAboutMissingStreamIdMapping[T.audioStreamId],this.attendeeIdToStreamId[O]===T.audioStreamId&&delete this.attendeeIdToStreamId[O];let ee=!1;for(const te of Object.keys(this.streamIdToAttendeeId)){const ie=parseInt(te);if(ie>T.audioStreamId&&this.streamIdToAttendeeId[ie]===O){ee=!0;break}}ee||this.realtimeController.realtimeSetAttendeeIdPresence(O,!1,H,A,{attendeeIndex:w++,attendeesInFrame:E.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(E),this.sessionReconnected=!1)}cleanUpState(E){const w=Object.values(this.streamIdToAttendeeId),T=E.streams.map(S=>S.attendeeId),_=w.filter(S=>!T.includes(S));for(const[S,R]of _.entries()){const A=this.attendeeIdToStreamId[R],O=this.streamIdToExternalUserId[A];if(delete this.streamIdToAttendeeId[A],delete this.streamIdToExternalUserId[A],delete this.warnedAboutMissingStreamIdMapping[A],delete this.attendeeIdToStreamId[R],R===this.selfAttendeeId){this.logger.warn("the volume indicator adapter cleans up the current attendee (presence = false) after reconnection");continue}this.realtimeController.realtimeSetAttendeeIdPresence(R,!1,O,!1,{attendeeIndex:S,attendeesInFrame:R.length})}}sendRealtimeUpdatesForAudioMetadata(E){let w=null,T=null;for(const _ of E.attendeeStates){const S=this.attendeeIdForStreamId(_.audioStreamId);_.hasOwnProperty("volume")&&(w===null&&(w={}),S!==null&&(w[S]=this.normalizedVolume(_))),_.hasOwnProperty("signalStrength")&&(T===null&&(T={}),S!==null&&(T[S]=this.normalizedSignalStrength(_)))}this.applyRealtimeUpdatesForAudioMetadata(w,T)}normalizedVolume(E){const w=1-(-E.volume-this.maxVolumeDecibels)/(this.minVolumeDecibels-this.maxVolumeDecibels);return Math.min(Math.max(w,0),1)}normalizedSignalStrength(E){const w=E.signalStrength/bc.MAX_SIGNAL_STRENGTH_LEVELS;return Math.min(Math.max(w,0),1)}applyRealtimeUpdatesForAudioMetadata(E,w){for(const T in this.streamIdToAttendeeId){const _=this.streamIdToAttendeeId[T],S=this.streamIdToExternalUserId[T];let R=null,A=null;E!==null&&(E.hasOwnProperty(_)?R=E[_]:R=bc.IMPLICIT_VOLUME),w!==null&&(w.hasOwnProperty(_)?A=w[_]:A=bc.IMPLICIT_SIGNAL_STRENGTH),(R!==null||A!==null)&&this.realtimeController.realtimeUpdateVolumeIndicator(_,R,null,A,S)}}attendeeIdForStreamId(E){return E===0?null:this.streamIdToAttendeeId[E]||(this.warnedAboutMissingStreamIdMapping[E]||(this.warnedAboutMissingStreamIdMapping[E]=!0,this.logger.warn(`volume indicator stream id ${E} seen before being defined`)),null)}};return DefaultVolumeIndicatorAdapter.default=x,x.MAX_SIGNAL_STRENGTH_LEVELS=2,x.IMPLICIT_VOLUME=0,x.IMPLICIT_SIGNAL_STRENGTH=1,DefaultVolumeIndicatorAdapter}var hasRequiredDefaultAudioVideoController;function requireDefaultAudioVideoController(){if(hasRequiredDefaultAudioVideoController)return DefaultAudioVideoController;hasRequiredDefaultAudioVideoController=1;var x=DefaultAudioVideoController&&DefaultAudioVideoController.__createBinding||(Object.create?function(Bt,Fe,Ge,nr){nr===void 0&&(nr=Ge),Object.defineProperty(Bt,nr,{enumerable:!0,get:function(){return Fe[Ge]}})}:function(Bt,Fe,Ge,nr){nr===void 0&&(nr=Ge),Bt[nr]=Fe[Ge]}),C=DefaultAudioVideoController&&DefaultAudioVideoController.__setModuleDefault||(Object.create?function(Bt,Fe){Object.defineProperty(Bt,"default",{enumerable:!0,value:Fe})}:function(Bt,Fe){Bt.default=Fe}),E=DefaultAudioVideoController&&DefaultAudioVideoController.__importStar||function(Bt){if(Bt&&Bt.__esModule)return Bt;var Fe={};if(Bt!=null)for(var Ge in Bt)Ge!=="default"&&Object.prototype.hasOwnProperty.call(Bt,Ge)&&x(Fe,Bt,Ge);return C(Fe,Bt),Fe},w=DefaultAudioVideoController&&DefaultAudioVideoController.__awaiter||function(Bt,Fe,Ge,nr){function jt(vr){return vr instanceof Ge?vr:new Ge(function(it){it(vr)})}return new(Ge||(Ge=Promise))(function(vr,it){function dt(_e){try{Xe(nr.next(_e))}catch(ct){it(ct)}}function xe(_e){try{Xe(nr.throw(_e))}catch(ct){it(ct)}}function Xe(_e){_e.done?vr(_e.value):jt(_e.value).then(dt,xe)}Xe((nr=nr.apply(Bt,Fe||[])).next())})},T=DefaultAudioVideoController&&DefaultAudioVideoController.__importDefault||function(Bt){return Bt&&Bt.__esModule?Bt:{default:Bt}};Object.defineProperty(DefaultAudioVideoController,"__esModule",{value:!0});const _=T(requireDefaultActiveSpeakerDetector()),S=T(requireDefaultAudioMixController()),R=T(requireAudioProfile()),A=T(requireDefaultBrowserBehavior()),O=T(requireConnectionHealthData()),H=T(requireSignalingAndMetricsConnectionMonitor()),ee=T(requireVideoQualitySettings()),te=T(requireMeetingSessionStatus()),ie=T(requireMeetingSessionStatusCode()),ne=T(requireMeetingSessionVideoAvailability()),ae=T(requireDefaultModality()),oe=T(requireDefaultPingPong()),le=T(requireDefaultRealtimeController()),fe=T(requireAsyncScheduler()),de=T(requireVideoCodecCapability()),ce=T(requireDefaultSessionStateController()),pe=T(requireSessionStateControllerAction()),he=T(requireSessionStateControllerState()),me=T(requireSessionStateControllerTransitionResult()),ve=T(requireDefaultSignalingClient()),ye=E(requireServerSideNetworkAdaption()),Se=T(requireSignalingClientEventType()),Ce=T(requireSignalingClientVideoSubscriptionConfiguration()),be=requireSignalingProtocol(),Ee=T(requireStatsCollector()),Ae=T(requireAttachMediaInputTask()),Ie=T(requireCleanRestartedSessionTask()),Te=T(requireCleanStoppedSessionTask()),De=T(requireCreatePeerConnectionTask()),Ue=T(requireCreateSDPTask()),ze=T(requireFinishGatheringICECandidatesTask()),Pe=T(requireJoinAndReceiveIndexTask()),$e=T(requireLeaveAndReceiveLeaveAckTask()),He=T(requireListenForVolumeIndicatorsTask()),je=T(requireMonitorTask()),Ne=T(requireOpenSignalingConnectionTask()),Oe=T(requireParallelGroupTask()),Ve=T(requirePromoteToPrimaryMeetingTask()),Ht=T(requireReceiveAudioInputTask()),Kt=T(requireReceiveRemoteVideoPauseResumeTask()),ir=T(requireReceiveVideoInputTask()),$t=T(requireReceiveVideoStreamIndexTask()),tr=T(requireSendAndReceiveDataMessagesTask()),ar=T(requireSerialGroupTask()),gr=T(requireSetLocalDescriptionTask()),er=T(requireSetRemoteDescriptionTask()),sr=T(requireSubscribeAndReceiveSubscribeAckTask()),pr=T(requireTimeoutTask()),ur=T(requireWaitForAttendeePresenceTask()),Sr=T(requireDefaultTransceiverController()),hr=T(requireSimulcastContentShareTransceiverController()),yr=T(requireSimulcastTransceiverController()),xr=T(requireVideoOnlyTransceiverController()),Yt=requireTypes$1(),Jt=T(requireDefaultVideoCaptureAndEncodeParameter()),mr=T(requireAllHighestVideoBandwidthPolicy()),Cr=T(requireVideoAdaptiveProbePolicy()),zt=requireVideoPreferences(),Ft=T(requireDefaultVideoStreamIdSet()),kt=T(requireDefaultVideoStreamIndex()),ke=T(requireSimulcastVideoStreamIndex()),Be=T(requireDefaultVideoTileController()),et=T(requireDefaultVideoTileFactory()),Ze=T(requireDefaultSimulcastUplinkPolicy()),Qe=T(requireNScaleVideoUplinkBandwidthPolicy()),Ke=T(requireDefaultVolumeIndicatorAdapter()),Je=T(requireAudioVideoControllerState());let Re=class yc{constructor(Fe,Ge,nr,jt,vr,it){this._audioProfile=new R.default,this.connectionHealthData=new O.default,this.observerQueue=new Set,this.meetingSessionContext=new Je.default,this.enableSimulcast=!1,this.enableSVC=!1,this.useUpdateTransceiverControllerForUplink=!1,this.totalRetryCount=0,this.startAudioVideoTimestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!1,this.receiveIndexTask=void 0,this.monitorTask=void 0,this.receiveRemotePauseResumeTask=void 0,this.destroyed=!1,this._logger=Ge,this.sessionStateController=new ce.default(this._logger),this._configuration=Fe,this._webSocketAdapter=nr,this._realtimeController=new le.default(jt),this._realtimeController.realtimeSetLocalAttendeeId(Fe.credentials.attendeeId,Fe.credentials.externalUserId),this._mediaStreamBroker=jt,this._reconnectController=vr,this._videoTileController=new Be.default(new et.default,this,this._logger),this._audioMixController=new S.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=it,this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers||(new ae.default(this.configuration.credentials.attendeeId).hasModality(ae.default.MODALITY_CONTENT)&&new A.default().hasChromiumWebRTC()?this.videoSendCodecPreferences=[de.default.av1Main(),de.default.vp9Profile0(),de.default.h264ConstrainedBaselineProfile(),de.default.vp8()]:this.videoSendCodecPreferences=[de.default.vp9Profile0(),de.default.h264ConstrainedBaselineProfile(),de.default.vp8()])}destroy(){return w(this,void 0,void 0,function*(){this.observerQueue.clear(),this._mediaStreamBroker.removeMediaStreamBrokerObserver(this._audioMixController),this.destroyed=!0})}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new _.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}get eventController(){return this._eventController}getRTCPeerConnectionStats(Fe){return this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent||(this.logger.warn("The `getRTCPeerConnectionStats()` is on its way to be deprecated. It makes an additional call to the `getStats` API and therefore may cause slight performance degradation. Please use the new API `clientMetricReport.getRTCStatsReport()` returned by `metricsDidReceive(clientMetricReport)` callback instead."),this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!0),this.rtcPeerConnection?this.rtcPeerConnection.getStats(Fe):null}setAudioProfile(Fe){this._audioProfile=Fe}addObserver(Fe){this.logger.info("adding meeting observer"),this.observerQueue.add(Fe)}removeObserver(Fe){this.logger.info("removing meeting observer"),this.observerQueue.delete(Fe)}forEachObserver(Fe){for(const Ge of this.observerQueue)fe.default.nextTick(()=>{this.observerQueue.has(Ge)&&Fe(Ge)})}initSignalingClient(){this.connectionHealthData.reset(),!this.meetingSessionContext.signalingClient&&(this.meetingSessionContext=new Je.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new A.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.audioProfile=this._audioProfile,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new ve.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){this.meetingSessionContext.signalingClient.removeObserver(this.preStartObserver),this.preStartObserver=void 0}prestart(){return this.logger.info("Pre-connecting signaling connection."),this.createOrReuseSignalingTask().run().then(()=>{const Fe=()=>w(this,void 0,void 0,function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()});this.preStartObserver={handleSignalingClientEvent(Ge){Ge.type===Se.default.WebSocketClosed&&Fe()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)}).catch(Fe=>{this.logger.error(`Signaling task pre-start failed: ${Fe}`),this.signalingTask=void 0})}start(Fe){this.startReturningPromise(Fe).then(()=>{this.logger.info("start completed")}).catch(Ge=>{this.logger.error(`start failed: ${Ge}`)})}startReturningPromise(Fe){return Fe?.signalingOnly===!0?this.prestart():(this.activeSpeakerDetector,new Promise((Ge,nr)=>{this.sessionStateController.perform(pe.default.Connect,()=>{this.actionConnect(!1).then(Ge).catch(nr)})}))}connectWithPromises(Fe){const Ge=this.meetingSessionContext,nr=(cr,fr)=>new pr.default(this.logger,fr,cr);this.monitorTask=new je.default(Ge,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);const jt=this.monitorTask.once(),vr=new Ht.default(Ge).once();this.receiveIndexTask=new $t.default(Ge),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();const it=new ar.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new He.default(Ge),new tr.default(Ge),new Pe.default(Ge),this.receiveIndexTask]).once(),dt=new De.default(Ge).once(it),xe=new Ae.default(Ge).once(dt,vr),Xe=new Ue.default(Ge).once(xe),_e=new gr.default(Ge).once(Xe),ct=new ze.default(Ge).once(_e),Dt=new sr.default(Ge).once(ct);return this.receiveRemotePauseResumeTask=new Kt.default(Ge),this.receiveRemotePauseResumeTask.once(Dt),new ar.default(this.logger,this.wrapTaskName("AudioVideoStart"),[jt,nr(this.configuration.connectionTimeoutMs,new ar.default(this.logger,"Peer",[Dt,this.receiveRemotePauseResumeTask,Fe?new pr.default(this.logger,new Oe.default(this.logger,"FinalizeConnection",[new ur.default(Ge),new er.default(Ge)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new er.default(Ge)]))])}actionConnect(Fe){var Ge;return w(this,void 0,void 0,function*(){this.initSignalingClient(),this.uninstallPreStartObserver(),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this,this.enableSimulcast=this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&new A.default().hasChromiumWebRTC(),this.enableSimulcast&&this.configuration.enableSVC&&this.logger.warn("SVC cannot be enabled at the same time as simulcast. Disabling SVC, using simulcast."),this.enableSVC=!this.enableSimulcast&&this.configuration.enableSVC&&new A.default().supportsScalableVideoCoding();const nr=!!this.configuration.urls.audioHostURL;if(nr?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new ae.default(this.configuration.credentials.attendeeId).hasModality(ae.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new hr.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext):this.meetingSessionContext.transceiverController=new yr.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new Sr.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new xr.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)),this.meetingSessionContext.volumeIndicatorAdapter=new Ke.default(this.logger,this._realtimeController,yc.MIN_VOLUME_DECIBELS,yc.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.meetingSessionContext.enableSVC=this.enableSVC,this.enableSimulcast){let it=this.meetingSessionContext.videoUplinkBandwidthPolicy;it||(it=new Ze.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=it),it.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new Cr.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new ke.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new kt.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new Qe.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.videoUplinkBandwidthPolicy.setSVCEnabled(this.enableSVC)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new mr.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController&&this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController&&(this.useUpdateTransceiverControllerForUplink=!0,this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController(this.meetingSessionContext.transceiverController)),this.meetingSessionContext.audioProfile=this._audioProfile;if(new ae.default(this.configuration.credentials.attendeeId).hasModality(ae.default.MODALITY_CONTENT)){const it=this.configuration.meetingFeatures.contentMaxResolution===ee.default.VideoResolutionUHD;it&&this.setVideoMaxBandwidthKbps(2500),this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(it)}else{const it=this.configuration.meetingFeatures.videoMaxResolution===ee.default.VideoResolutionFHD;this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(it)}this.meetingSessionContext.videoUplinkBandwidthPolicy&&this.maxUplinkBandwidthKbps&&this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(this.maxUplinkBandwidthKbps),this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController(this._videoTileController),this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver(()=>this.update({needsRenegotiation:!1})),this.meetingSessionContext.lastKnownVideoAvailability=new ne.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new Jt.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new Ft.default,this.meetingSessionContext.videosPaused=new Ft.default,this.meetingSessionContext.statsCollector=new Ee.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new H.default(this,this._realtimeController,this.connectionHealthData,new oe.default(this.meetingSessionContext.signalingClient,yc.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},this._videoTileController.registerVideoTileResolutionObserver(this.meetingSessionContext.statsCollector),Fe||(this.totalRetryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver(it=>{Yt.Maybe.of(it.audioVideoDidStartConnecting).map(dt=>dt.bind(it)(!1))}),(Ge=this.eventController)===null||Ge===void 0||Ge.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);const jt=nr&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;this.logger.info("Needs to wait for attendee presence? "+jt);const vr=this.connectWithPromises(jt);try{yield vr.run(),this.connectionHealthData.setConnectionStartTime();const it=new ae.default(this.configuration.credentials.attendeeId).hasModality(ae.default.MODALITY_CONTENT);this.connectionHealthData.setIsContentShare(it),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(pe.default.FinishConnecting,()=>{this.eventController&&(this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,this.eventController.publishEvent("meetingStartSucceeded",{maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,poorConnectionCount:this.meetingSessionContext.poorConnectionCount,retryCount:this.totalRetryCount,signalingOpenDurationMs:this.meetingSessionContext.signalingOpenDurationMs,iceGatheringDurationMs:this.meetingSessionContext.iceGatheringDurationMs,meetingStartDurationMs:this.meetingSessionContext.meetingStartDurationMs})),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()})}catch(it){this.signalingTask=void 0;const dt=new te.default(this.getMeetingStatusCode(it)||ie.default.TaskFailed);if(this.logger.info(`Start failed: ${dt} due to error ${it}.`),this.sessionStateController.state()===he.default.NotConnected){this.logger.info("Start failed and not connected. Not cleaning up.");return}this.sessionStateController.perform(pe.default.Fail,()=>w(this,void 0,void 0,function*(){yield this.actionDisconnect(dt,!0,it),this.handleMeetingSessionStatus(dt,it)||this.notifyStop(dt,it)}))}})}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new pr.default(this.logger,new Ne.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=be.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.meetingSessionContext.isSessionConnected=!0,this.forEachObserver(Fe=>{Yt.Maybe.of(Fe.audioVideoDidStart).map(Ge=>Ge.bind(Fe)())}),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var Fe;return this._reconnectController.disableReconnect(),this.sessionStateController.state()===he.default.NotConnected?((Fe=this.meetingSessionContext.signalingClient)===null||Fe===void 0||Fe.closeConnection(),this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise((Ge,nr)=>{this.sessionStateController.perform(pe.default.Disconnect,()=>{this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new te.default(ie.default.Left),!1,null).then(Ge).catch(nr)})})}stop(){this.stopReturningPromise()}actionDisconnect(Fe,Ge,nr){return w(this,void 0,void 0,function*(){try{yield new ar.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new pr.default(this.logger,new $e.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch{this.logger.info("fail to stop")}try{const jt=[new pr.default(this.logger,new Te.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new ar.default(this.logger,this.wrapTaskName("AudioVideoClean"),jt).run()}catch{this.logger.info("fail to clean")}this.sessionStateController.perform(pe.default.FinishDisconnecting,()=>{Ge||this.notifyStop(Fe,nr)}),this._videoTileController.removeVideoTileResolutionObserver(this.meetingSessionContext.statsCollector)})}update(Fe={needsRenegotiation:!0}){let Ge=Fe.needsRenegotiation;if(Ge||(Ge=this.meetingSessionContext.peer===void 0),Ge||(Ge=!this.updateRemoteVideosFromPolicy()),Ge||(Ge=!this.updateLocalVideoFromPolicy()),this.meetingSessionContext.lastVideosToReceive=this.meetingSessionContext.videosToReceive,!Ge)return this.logger.info("Update request does not require resubscribe"),this.actionFinishUpdating(),!0;this.logger.info("Update request requires resubscribe"),this.updateNumberOfPublishedVideoSources();const nr=this.sessionStateController.perform(pe.default.Update,()=>{this.actionUpdateWithRenegotiation(!0)});return nr===me.default.Transitioned||nr===me.default.DeferredTransition}updateNumberOfPublishedVideoSources(){const Fe=this.configuration.credentials.attendeeId,Ge=this._videoTileController.hasStartedLocalVideoTile();if(this.meetingSessionContext.videoStreamIndex!==null){const nr=this.meetingSessionContext.videoStreamIndex.numberOfVideoPublishingParticipantsExcludingSelf(Fe)+(Ge?1:0);this.connectionHealthData.setNumberOfPublishedVideoSources(nr)}}updateRemoteVideosFromPolicy(){if(this.meetingSessionContext.videoDownlinkBandwidthPolicy&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.getVideoPreferences!==void 0&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption!==void 0&&!ye.serverSideNetworkAdaptionIsNoneOrDefault(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())){if(!this.sendRemoteVideoUpdate())return!1;if(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()===ye.default.BandwidthProbingAndRemoteVideoQualityAdaption)return this.isNotAddingOrRemovingStreams()}return this.updateRemoteVideosIfNotAddingOrRemovingStreams()}updateRemoteVideosIfNotAddingOrRemovingStreams(){const Fe=this.detectChangesInVideosToReceive();if(Fe===void 0)return!1;const Ge=Fe.added,nr=Fe.simulcastStreamUpdates,jt=Fe.removed,vr=this.meetingSessionContext,it=[];for(const[dt,xe]of nr.entries()){const Xe=new Ce.default;if(Xe.streamId=xe,Xe.attendeeId=vr.videoStreamIndex.attendeeIdForStreamId(xe),Xe.mid=vr.transceiverController.getMidForStreamId(dt),Xe.mid===void 0)return this.logger.info(`No MID found for stream ID ${dt}, cannot update stream without renegotiation`),!1;if(it.push(Xe),vr.transceiverController.setStreamIdForMid(Xe.mid,xe),vr.videoStreamIndex.overrideStreamIdMappings(dt,xe),vr.videoTileController.haveVideoTileForAttendeeId(Xe.attendeeId)){const _e=vr.videoTileController.getVideoTileForAttendeeId(Xe.attendeeId);if(!_e.setStreamId)return!1;_e.setStreamId(xe)}}return it.length!==0&&vr.signalingClient.remoteVideoUpdate(it,[]),Ge.length!==0||jt.length!==0?!1:(vr.videoStreamIndex.remoteVideoUpdateSent(),!0)}detectChangesInVideosToReceive(){const Fe=this.meetingSessionContext;if(Fe.videosToReceive===null||!Fe.transceiverController||!Fe.transceiverController.getMidForStreamId||!Fe.transceiverController.setStreamIdForMid||!Fe.videosToReceive.forEach||!Fe.signalingClient.remoteVideoUpdate||!Fe.videoStreamIndex.overrideStreamIdMappings)return;let Ge=[];const nr=new Map;let jt=[];if(Fe.lastVideosToReceive===null)Ge=Fe.videosToReceive.array();else{const vr=Fe.videoStreamIndex;Fe.videosToReceive.forEach(it=>{if(Fe.lastVideosToReceive.contain(it))return;let dt=!1;Fe.lastVideosToReceive.forEach(xe=>{dt||vr.StreamIdsInSameGroup(xe,it)&&(nr.set(xe,it),dt=!0)}),dt||Ge.push(it)}),jt=Fe.lastVideosToReceive.array().filter(it=>{const dt=Fe.videosToReceive.contain(it),xe=nr.has(it);return!dt&&!xe})}return this.logger.info(`Request to update remote videos with added: [${Ge}], updated: [${Array.from(nr.entries()).map(([vr,it])=>`${vr}->${it}`).join(",")}], removed: [${jt}]`),{added:Ge,removed:jt,simulcastStreamUpdates:nr}}isNotAddingOrRemovingStreams(){const Fe=this.detectChangesInVideosToReceive();if(Fe===void 0)return!1;const Ge=Fe.added,nr=Fe.removed;return Ge.length!==0||nr.length!==0?!1:(this.meetingSessionContext.videoStreamIndex.remoteVideoUpdateSent(),!0)}sendRemoteVideoUpdate(){const Fe=this.meetingSessionContext;if(Fe.videosToReceive===null)return!1;const Ge=Fe.videosToReceive.array().map(dt=>Fe.videoStreamIndex.groupIdForStreamId(dt));this.receiveRemotePauseResumeTask.updateSubscribedGroupdIds(new Set(Ge));const nr=zt.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(Fe,Ge,Fe.videoDownlinkBandwidthPolicy.getVideoPreferences()),jt=new Map,vr=[];for(const dt of nr){let xe=!1;if(!Fe.lastVideoSubscriptionConfiguration.has(dt.groupId))xe=!0;else{const Xe=Fe.lastVideoSubscriptionConfiguration.get(dt.groupId);dt.equals(Xe)||(this.logger.debug(`${JSON.stringify(dt)} does not equal ${JSON.stringify(Xe)}, sending update`),xe=!0)}jt.set(dt.groupId,dt),xe&&vr.push(dt)}Fe.lastVideoSubscriptionConfiguration=jt;const it=[];if(Fe.lastVideosToReceive!==null){const dt=new Set(Ge);for(const xe of Fe.lastVideosToReceive.array()){const Xe=Fe.videoStreamIndex.groupIdForStreamId(xe);if(!dt.has(Xe)){const _e=Fe.transceiverController.getMidForGroupId(Xe);if(_e===void 0){Fe.logger.warn(`Could not find MID for group ID to remove: ${Xe}`);continue}it.push(_e)}}}return(vr.length!==0||it.length!==0)&&Fe.signalingClient.remoteVideoUpdate(vr,it),!0}updateLocalVideoFromPolicy(){if(this.meetingSessionContext.enableSimulcast){const Fe=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseEncodingParameters();if(this.mayNeedRenegotiationForSimulcastLayerChange&&this.meetingSessionContext.transceiverController.hasVideoInput()&&!this.negotiatedBitrateLayersAllocationRtpHeaderExtension())return this.logger.info("Needs regenotiation for local video simulcast layer change"),this.mayNeedRenegotiationForSimulcastLayerChange=!1,!1;this.meetingSessionContext.transceiverController.setEncodingParameters(Fe)}else this.meetingSessionContext.videoCaptureAndEncodeParameter=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters();return this.logger.info("Updated local video from policy without renegotiation"),!0}negotiatedBitrateLayersAllocationRtpHeaderExtension(){if(!this.meetingSessionContext.transceiverController.localVideoTransceiver())return!1;const Fe=this.meetingSessionContext.transceiverController.localVideoTransceiver().sender.getParameters();return!Fe||!Fe.headerExtensions?!1:Fe.headerExtensions.some(Ge=>Ge.uri==="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00")}restartLocalVideo(Fe){const Ge=()=>w(this,void 0,void 0,function*(){this._videoTileController.hasStartedLocalVideoTile()&&(this.logger.info("stopping local video tile prior to local video restart"),this._videoTileController.stopLocalVideoTile(),this.logger.info("preparing local video restart update"),yield this.actionUpdateWithRenegotiation(!1),this.logger.info("starting local video tile for local video restart"),this._videoTileController.startLocalVideoTile()),this.logger.info("finalizing local video restart update"),yield this.actionUpdateWithRenegotiation(!0),Fe()}),nr=this.sessionStateController.perform(pe.default.Update,()=>{Ge()});return nr===me.default.Transitioned||nr===me.default.DeferredTransition}replaceLocalVideo(Fe){return w(this,void 0,void 0,function*(){if(!Fe||Fe.getVideoTracks().length<1)throw new Error("could not acquire video track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw new Error("no active meeting and peer connection");const Ge=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(Ge){const nr=Ge.state(),jt=Fe.getVideoTracks()[0].getSettings();Ge.bindVideoStream(nr.boundAttendeeId,!0,Fe,jt.width,jt.height,nr.streamId,nr.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(Fe.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=Fe,this.logger.info("Local video input is updated")})}replaceLocalAudio(Fe){return w(this,void 0,void 0,function*(){if(!Fe||Fe.getAudioTracks().length<1)throw new Error("could not acquire audio track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw new Error("no active meeting and peer connection");if(this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime(),!(yield this.meetingSessionContext.transceiverController.replaceAudioTrack(Fe.getAudioTracks()[0])))throw new Error("Failed to replace audio track");this.meetingSessionContext.activeAudioInput=Fe,this.logger.info("Local audio input is updated")})}actionUpdateWithRenegotiation(Fe){return w(this,void 0,void 0,function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new ar.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new ir.default(this.meetingSessionContext),new pr.default(this.logger,new ar.default(this.logger,"UpdateSession",[new Ae.default(this.meetingSessionContext),new Ue.default(this.meetingSessionContext),new gr.default(this.meetingSessionContext),new ze.default(this.meetingSessionContext),new sr.default(this.meetingSessionContext),new er.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),Fe&&this.sessionStateController.perform(pe.default.FinishUpdating,()=>{this.actionFinishUpdating()})}catch(Ge){this.sessionStateController.perform(pe.default.FinishUpdating,()=>{const nr=new te.default(this.getMeetingStatusCode(Ge)||ie.default.TaskFailed);nr.statusCode()!==ie.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(nr,Ge)})}})}notifyStop(Fe,Ge){var nr;if(this.forEachObserver(jt=>{Yt.Maybe.of(jt.audioVideoDidStop).map(vr=>vr.bind(jt)(Fe))}),this.eventController){const{signalingOpenDurationMs:jt,poorConnectionCount:vr,startTimeMs:it,iceGatheringDurationMs:dt,attendeePresenceDurationMs:xe,meetingStartDurationMs:Xe}=this.meetingSessionContext,_e={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:it===null?0:Math.round(Date.now()-it),meetingStatus:ie.default[Fe.statusCode()],signalingOpenDurationMs:jt,iceGatheringDurationMs:dt,attendeePresenceDurationMs:xe,poorConnectionCount:vr,meetingStartDurationMs:Xe,retryCount:this.totalRetryCount},ct=Ge&&Ge.message||((nr=Fe.toString)===null||nr===void 0?void 0:nr.call(Fe))||"";_e.meetingDurationMs===0?(_e.meetingErrorMessage=ct,delete _e.meetingDurationMs,delete _e.attendeePresenceDurationMs,delete _e.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",_e)):Fe.isFailure()||Fe.isAudioConnectionFailure()?(_e.meetingErrorMessage=ct,this.eventController.publishEvent("meetingFailed",_e)):this.eventController.publishEvent("meetingEnded",_e)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{const Fe=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(Fe)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(Fe,Ge){this.promotedToPrimaryMeeting&&(this.promotedToPrimaryMeeting=!1,this.forEachObserver(jt=>{Yt.Maybe.of(jt.audioVideoWasDemotedFromPrimaryMeeting).map(vr=>vr.bind(jt)(new te.default(ie.default.AudioVideoDisconnectedWhilePromoted)))}));const nr=this._reconnectController.retryWithBackoff(()=>w(this,void 0,void 0,function*(){this.sessionStateController.state()===he.default.NotConnected?this.sessionStateController.perform(pe.default.Connect,()=>{this.actionConnect(!0)}):this.sessionStateController.perform(pe.default.Reconnect,()=>{this.actionReconnect(Fe)}),this.totalRetryCount+=1}),()=>{this.logger.info("canceled retry")});return nr||this.sessionStateController.perform(pe.default.Fail,()=>{this.actionDisconnect(Fe,!1,Ge)}),nr}actionReconnect(Fe){return w(this,void 0,void 0,function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver(Ge=>{Yt.Maybe.of(Ge.audioVideoDidStartConnecting).map(nr=>nr.bind(Ge)(!0))})),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset(),this.receiveRemotePauseResumeTask=new Kt.default(this.meetingSessionContext);try{yield new ar.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new pr.default(this.logger,new ar.default(this.logger,"Media",[new Ie.default(this.meetingSessionContext),new ar.default(this.logger,"Signaling",[new Ne.default(this.meetingSessionContext),new Pe.default(this.meetingSessionContext)]),new De.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new ir.default(this.meetingSessionContext),new pr.default(this.logger,new ar.default(this.logger,"UpdateSession",[new Ae.default(this.meetingSessionContext),new Ue.default(this.meetingSessionContext),new gr.default(this.meetingSessionContext),new ze.default(this.meetingSessionContext),new sr.default(this.meetingSessionContext),new er.default(this.meetingSessionContext),this.receiveRemotePauseResumeTask]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(pe.default.FinishConnecting,()=>{if(this.eventController){const{signalingOpenDurationMs:Ge,poorConnectionCount:nr,startTimeMs:jt,iceGatheringDurationMs:vr,attendeePresenceDurationMs:it,meetingStartDurationMs:dt}=this.meetingSessionContext,xe={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:Math.round(Date.now()-jt),meetingStatus:ie.default[Fe.statusCode()],signalingOpenDurationMs:Ge,iceGatheringDurationMs:vr,attendeePresenceDurationMs:it,poorConnectionCount:nr,meetingStartDurationMs:dt,retryCount:this.totalRetryCount};this.eventController.publishEvent("meetingReconnected",xe)}this.actionFinishConnecting()})}catch(Ge){this.sessionStateController.perform(pe.default.FinishConnecting,()=>{this.logger.info("failed to reconnect audio-video session");const nr=new te.default(this.getMeetingStatusCode(Ge)||ie.default.TaskFailed);this.handleMeetingSessionStatus(nr,Ge)})}this.connectionHealthData.setConnectionStartTime()})}wrapTaskName(Fe){return`${Fe}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}getMeetingStatusCode(Fe){const Ge=/the meeting status code: (\d+)/.exec(Fe&&Fe.message);return Ge&&Ge.length>1?Number.parseInt(Ge[1],10):null}enforceBandwidthLimitationForSender(Fe){return w(this,void 0,void 0,function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(Fe)})}handleMeetingSessionStatus(Fe,Ge){if(this.logger.info(`handling status: ${ie.default[Fe.statusCode()]}`),Fe.isTerminal()||this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(Fe),Fe.statusCode()===ie.default.IncompatibleSDP)return this.restartLocalVideo(()=>{this.logger.info("handled incompatible SDP by attempting to restart video")}),!0;if(Fe.statusCode()===ie.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver(nr=>{Yt.Maybe.of(nr.videoSendDidBecomeUnavailable).map(jt=>jt.bind(nr)())}),!1;if(Fe.statusCode()===ie.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver(nr=>{Yt.Maybe.of(nr.audioVideoWasDemotedFromPrimaryMeeting).map(jt=>jt.bind(nr)(Fe))}),!1;if(Fe.isTerminal()&&(this.logger.error("session will not be reconnected"),this.meetingSessionContext.reconnectController&&this.meetingSessionContext.reconnectController.disableReconnect()),(Fe.isFailure()||Fe.isTerminal())&&this.meetingSessionContext.reconnectController){const nr=this.reconnect(Fe,Ge);return nr?this.logger.warn(`The audio video controller will reconnect due to status code ${ie.default[Fe.statusCode()]}${Ge?` and error: ${Ge.message}`:""}`):this.logger.error(`The audio video controller failed with status code ${ie.default[Fe.statusCode()]}${Ge?` and error: ${Ge.message}`:""}`),nr}return!1}setVideoMaxBandwidthKbps(Fe){if(Fe<=0)throw new Error("Max bandwidth kbps has to be greater than 0");this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&(this.logger.info(`video send has ideal max bandwidth ${Fe} kbps`),this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(Fe)),this.maxUplinkBandwidthKbps=Fe}handleHasBandwidthPriority(Fe){return w(this,void 0,void 0,function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){if(this.useUpdateTransceiverControllerForUplink){this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(Fe),yield this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();return}const Ge=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(Fe);const nr=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();Ge!==nr&&(this.logger.info(`video send bandwidth priority ${Fe} max has changed from ${Ge} kbps to ${nr} kbps`),yield this.enforceBandwidthLimitationForSender(nr))}})}pauseReceivingStream(Fe){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.pause([Fe])}resumeReceivingStream(Fe){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.resume([Fe])}setVideoCodecSendPreferences(Fe){this.videoSendCodecPreferences=Fe,this.meetingSessionContext.videoSendCodecPreferences=Fe,this.sessionStateController.state()!==he.default.NotConnected&&this.update({needsRenegotiation:!0})}getRemoteVideoSources(){const{videoStreamIndex:Fe}=this.meetingSessionContext;if(!Fe)return this.logger.info("meeting has not started"),[];const Ge=this.configuration.credentials.attendeeId;return Fe.allVideoSendingSourcesExcludingSelf(Ge)}encodingSimulcastLayersDidChange(Fe){this.mayNeedRenegotiationForSimulcastLayerChange=!0,this.forEachObserver(Ge=>{Yt.Maybe.of(Ge.encodingSimulcastLayersDidChange).map(nr=>nr.bind(Ge)(Fe))})}promoteToPrimaryMeeting(Fe){return this.actionPromoteToPrimaryMeeting(Fe)}actionPromoteToPrimaryMeeting(Fe){return w(this,void 0,void 0,function*(){let Ge=new te.default(ie.default.SignalingRequestFailed);return yield new ar.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new pr.default(this.logger,new Ve.default(this.meetingSessionContext,Fe,nr=>{Ge=nr}),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=Ge.statusCode()===ie.default.OK,Ge})}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver(Fe=>{Yt.Maybe.of(Fe.audioVideoWasDemotedFromPrimaryMeeting).map(Ge=>Ge.bind(Fe)(new te.default(ie.default.OK)))})}videoInputDidChange(Fe){return w(this,void 0,void 0,function*(){if(this.logger.info("Receive a video input change event"),!this.meetingSessionContext||!this.meetingSessionContext.peer){this.logger.info("Skip updating video input because there is no active meeting and peer connection");return}this._videoTileController.hasStartedLocalVideoTile()&&(Fe?yield this.replaceLocalVideo(Fe):this._videoTileController.stopLocalVideoTile())})}audioInputDidChange(Fe){return w(this,void 0,void 0,function*(){if(this.logger.info("Receive an audio input change event"),!this.meetingSessionContext||!this.meetingSessionContext.peer){this.logger.info("Skip updating audio input because there is no active meeting and peer connection");return}if(!Fe)try{Fe=yield this.mediaStreamBroker.acquireAudioInputStream()}catch{this.logger.error("Could not acquire audio track from mediaStreamBroker");return}yield this.replaceLocalAudio(Fe)})}};return DefaultAudioVideoController.default=Re,Re.MIN_VOLUME_DECIBELS=-42,Re.MAX_VOLUME_DECIBELS=-14,Re.PING_PONG_INTERVAL_MS=1e4,DefaultAudioVideoController}var DefaultAudioVideoFacade={},hasRequiredDefaultAudioVideoFacade;function requireDefaultAudioVideoFacade(){if(hasRequiredDefaultAudioVideoFacade)return DefaultAudioVideoFacade;hasRequiredDefaultAudioVideoFacade=1;var x=DefaultAudioVideoFacade&&DefaultAudioVideoFacade.__awaiter||function(w,T,_,S){function R(A){return A instanceof _?A:new _(function(O){O(A)})}return new(_||(_=Promise))(function(A,O){function H(ie){try{te(S.next(ie))}catch(ne){O(ne)}}function ee(ie){try{te(S.throw(ie))}catch(ne){O(ne)}}function te(ie){ie.done?A(ie.value):R(ie.value).then(H,ee)}te((S=S.apply(w,T||[])).next())})};Object.defineProperty(DefaultAudioVideoFacade,"__esModule",{value:!0});const C=requireVideoTransformDevice();let E=class{constructor(w,T,_,S,R,A){this.audioVideoController=w,this.videoTileController=T,this.realtimeController=_,this.audioMixController=S,this.deviceController=R,this.contentShareController=A}addObserver(w){this.audioVideoController.addObserver(w),this.trace("addObserver")}removeObserver(w){this.audioVideoController.removeObserver(w),this.trace("removeObserver")}setAudioProfile(w){this.trace("setAudioProfile",w),this.audioVideoController.setAudioProfile(w)}start(w){this.audioVideoController.start(w),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(w){return this.trace("getRTCPeerConnectionStats",w?w.id:null),this.audioVideoController.getRTCPeerConnectionStats(w)}bindAudioElement(w){const T=this.audioMixController.bindAudioElement(w);return this.trace("bindAudioElement",w.id,T),T}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(w){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(w)}removeAudioMixObserver(w){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(w)}bindVideoElement(w,T){this.videoTileController.bindVideoElement(w,T),this.trace("bindVideoElement",{tileId:w,videoElementId:T.id})}unbindVideoElement(w,T=!0){this.videoTileController.unbindVideoElement(w,T),this.trace("unbindVideoElement",{tileId:w,cleanUpVideoElement:T})}startLocalVideoTile(){const w=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,w),w}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){const w=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,w),w}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){const w=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),w}pauseVideoTile(w){this.videoTileController.pauseVideoTile(w),this.trace("pauseVideoTile",w)}unpauseVideoTile(w){this.videoTileController.unpauseVideoTile(w),this.trace("unpauseVideoTile",w)}getVideoTile(w){const T=this.videoTileController.getVideoTile(w);return this.trace("getVideoTile",w),T}getAllRemoteVideoTiles(){const w=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),w}getAllVideoTiles(){const w=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),w}addVideoTile(){const w=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,w.state()),w}removeVideoTile(w){this.videoTileController.removeVideoTile(w),this.trace("removeVideoTile",w)}removeVideoTilesByAttendeeId(w){const T=this.videoTileController.removeVideoTilesByAttendeeId(w);return this.trace("removeVideoTilesByAttendeeId",w,T),T}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(w){const T=this.videoTileController.captureVideoTile(w);return this.trace("captureVideoTile",w),T}realtimeSubscribeToAttendeeIdPresence(w){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(w),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(w){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(w),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(w){this.realtimeController.realtimeSetCanUnmuteLocalAudio(w),this.trace("realtimeSetCanUnmuteLocalAudio",w)}realtimeSubscribeToSetCanUnmuteLocalAudio(w){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(w),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(w){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(w),this.trace("realtimeUnsubscribeToSetCanUnmuteLocalAudio")}realtimeCanUnmuteLocalAudio(){const w=this.realtimeController.realtimeCanUnmuteLocalAudio();return this.trace("realtimeCanUnmuteLocalAudio",null,w),w}realtimeMuteLocalAudio(){this.realtimeController.realtimeMuteLocalAudio(),this.trace("realtimeMuteLocalAudio")}realtimeUnmuteLocalAudio(){const w=this.realtimeController.realtimeUnmuteLocalAudio();return this.trace("realtimeUnmuteLocalAudio"),w}realtimeSubscribeToMuteAndUnmuteLocalAudio(w){this.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(w),this.trace("realtimeSubscribeToMuteAndUnmuteLocalAudio")}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(w){this.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(w),this.trace("realtimeUnsubscribeToMuteAndUnmuteLocalAudio")}realtimeIsLocalAudioMuted(){const w=this.realtimeController.realtimeIsLocalAudioMuted();return this.trace("realtimeIsLocalAudioMuted"),w}realtimeSubscribeToVolumeIndicator(w,T){this.realtimeController.realtimeSubscribeToVolumeIndicator(w,T),this.trace("realtimeSubscribeToVolumeIndicator",w)}realtimeUnsubscribeFromVolumeIndicator(w,T){this.realtimeController.realtimeUnsubscribeFromVolumeIndicator(w,T),this.trace("realtimeUnsubscribeFromVolumeIndicator",w,T)}realtimeSubscribeToLocalSignalStrengthChange(w){this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(w),this.trace("realtimeSubscribeToLocalSignalStrengthChange")}realtimeUnsubscribeToLocalSignalStrengthChange(w){this.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(w),this.trace("realtimeUnsubscribeToLocalSignalStrengthChange")}realtimeSendDataMessage(w,T,_){this.realtimeController.realtimeSendDataMessage(w,T,_),this.trace("realtimeSendDataMessage")}realtimeSubscribeToReceiveDataMessage(w,T){this.realtimeController.realtimeSubscribeToReceiveDataMessage(w,T),this.trace("realtimeSubscribeToReceiveDataMessage")}realtimeUnsubscribeFromReceiveDataMessage(w){this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(w),this.trace("realtimeUnsubscribeFromReceiveDataMessage")}realtimeSubscribeToFatalError(w){this.realtimeController.realtimeSubscribeToFatalError(w),this.trace("realtimeSubscribeToFatalError")}realtimeUnsubscribeToFatalError(w){this.realtimeController.realtimeUnsubscribeToFatalError(w),this.trace("realtimeUnsubscribeToFatalError")}subscribeToActiveSpeakerDetector(w,T,_,S){this.audioVideoController.activeSpeakerDetector.subscribe(w,T,_,S),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(w){this.audioVideoController.activeSpeakerDetector.unsubscribe(w),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(w=!1){return x(this,void 0,void 0,function*(){const T=yield this.deviceController.listAudioInputDevices(w);return this.trace("listAudioInputDevices",w,T),T})}listVideoInputDevices(w=!1){return x(this,void 0,void 0,function*(){const T=yield this.deviceController.listVideoInputDevices(w);return this.trace("listVideoInputDevices",w,T),T})}listAudioOutputDevices(w=!1){return x(this,void 0,void 0,function*(){const T=yield this.deviceController.listAudioOutputDevices(w);return this.trace("listAudioOutputDevices",w,T),T})}startAudioInput(w){return x(this,void 0,void 0,function*(){return this.trace("startAudioInput",w),this.deviceController.startAudioInput(w)})}stopAudioInput(){return x(this,void 0,void 0,function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()})}startVideoInput(w){return x(this,void 0,void 0,function*(){return C.isVideoTransformDevice(w)?this.trace("startVideoInput with transform device"):this.trace("startVideoInput",w),this.deviceController.startVideoInput(w)})}stopVideoInput(){return x(this,void 0,void 0,function*(){return this.trace("stopVideoInput"),this.deviceController.stopVideoInput()})}chooseAudioOutput(w){const T=this.deviceController.chooseAudioOutput(w);return this.trace("chooseAudioOutput",w),T}addDeviceChangeObserver(w){this.deviceController.addDeviceChangeObserver(w),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(w){this.deviceController.removeDeviceChangeObserver(w),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){const w=this.deviceController.createAnalyserNodeForAudioInput();return this.trace("createAnalyserNodeForAudioInput"),w}startVideoPreviewForVideoInput(w){this.deviceController.startVideoPreviewForVideoInput(w),this.trace("startVideoPreviewForVideoInput",w.id)}stopVideoPreviewForVideoInput(w){this.deviceController.stopVideoPreviewForVideoInput(w),this.trace("stopVideoPreviewForVideoInput",w.id)}setDeviceLabelTrigger(w){this.deviceController.setDeviceLabelTrigger(w),this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(w){const T=this.deviceController.mixIntoAudioInput(w);return this.trace("mixIntoAudioInput",w.id),T}chooseVideoInputQuality(w,T,_){this.deviceController.chooseVideoInputQuality(w,T,_),this.trace("chooseVideoInputQuality",{width:w,height:T,frameRate:_})}setVideoMaxBandwidthKbps(w){this.audioVideoController.setVideoMaxBandwidthKbps(w),this.trace("setVideoMaxBandwidthKbps",w)}setVideoCodecSendPreferences(w){this.audioVideoController.setVideoCodecSendPreferences(w),this.trace("setVideoCodecSendPreferences",w)}getVideoInputQualitySettings(){const w=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),w}setContentAudioProfile(w){this.trace("setContentAudioProfile",w),this.contentShareController.setContentAudioProfile(w)}enableSimulcastForContentShare(w,T){this.trace("enableSimulcastForContentShare"),this.contentShareController.enableSimulcastForContentShare(w,T)}enableSVCForContentShare(w){this.trace("enableSVCForContentShare"),this.contentShareController.enableSVCForContentShare(w)}startContentShare(w){const T=this.contentShareController.startContentShare(w);return this.trace("startContentShare"),T}startContentShareFromScreenCapture(w,T){const _=this.contentShareController.startContentShareFromScreenCapture(w,T);return this.trace("startContentShareFromScreenCapture"),_}pauseContentShare(){this.contentShareController.pauseContentShare(),this.trace("pauseContentShare")}unpauseContentShare(){this.contentShareController.unpauseContentShare(),this.trace("unpauseContentShare")}stopContentShare(){this.contentShareController.stopContentShare(),this.trace("stopContentShare")}addContentShareObserver(w){this.contentShareController.addContentShareObserver(w),this.trace("addContentShareObserver")}removeContentShareObserver(w){this.contentShareController.removeContentShareObserver(w),this.trace("removeContentShareObserver")}setContentShareVideoCodecPreferences(w){this.contentShareController.setContentShareVideoCodecPreferences(w),this.trace("setContentShareVideoCodecPreferences")}trace(w,T,_){const S=this.audioVideoController.configuration.meetingId,R=this.audioVideoController.configuration.credentials.attendeeId;let A=`API/DefaultAudioVideoFacade/${S}/${R}/${w}`;typeof T<"u"&&(A+=` ${JSON.stringify(T)}`),typeof _<"u"&&(A+=` -> ${JSON.stringify(_)}`),this.audioVideoController.logger.info(A)}getRemoteVideoSources(){const w=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,w),w}get transcriptionController(){return this.realtimeController.transcriptionController}promoteToPrimaryMeeting(w){this.audioVideoController.removeObserver(this),this.audioVideoController.addObserver(this);const T=this.audioVideoController.promoteToPrimaryMeeting(w);return this.trace("promoteToPrimaryMeeting",null,T),T}demoteFromPrimaryMeeting(){this.trace("demoteFromPrimaryMeeting"),this.audioVideoController.demoteFromPrimaryMeeting()}audioVideoWasDemotedFromPrimaryMeeting(w){this.contentShareController.stopContentShare(),this.audioVideoController.removeObserver(this)}};return DefaultAudioVideoFacade.default=E,DefaultAudioVideoFacade}var DefaultContentShareController={},MeetingSessionConfiguration={},MeetingFeatures={},hasRequiredMeetingFeatures;function requireMeetingFeatures(){if(hasRequiredMeetingFeatures)return MeetingFeatures;hasRequiredMeetingFeatures=1;var x=MeetingFeatures&&MeetingFeatures.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(MeetingFeatures,"__esModule",{value:!0});const C=x(requireVideoQualitySettings());let E=class pm{constructor(T=C.default.VideoResolutionHD,_=C.default.VideoResolutionFHD){this.videoMaxResolution=T,this.contentMaxResolution=_}clone(){return new pm(this.videoMaxResolution,this.contentMaxResolution)}};return MeetingFeatures.default=E,MeetingFeatures}var MeetingSessionCredentials={},hasRequiredMeetingSessionCredentials;function requireMeetingSessionCredentials(){if(hasRequiredMeetingSessionCredentials)return MeetingSessionCredentials;hasRequiredMeetingSessionCredentials=1,Object.defineProperty(MeetingSessionCredentials,"__esModule",{value:!0});let x=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:this.joinToken===null?null:"<redacted>"}}};return MeetingSessionCredentials.default=x,MeetingSessionCredentials}var MeetingSessionURLs={},hasRequiredMeetingSessionURLs;function requireMeetingSessionURLs(){if(hasRequiredMeetingSessionURLs)return MeetingSessionURLs;hasRequiredMeetingSessionURLs=1,Object.defineProperty(MeetingSessionURLs,"__esModule",{value:!0});let x=class{constructor(){this._audioHostURL=null,this._signalingURL=null,this._turnControlURL=null,this._eventIngestionURL=null,this.urlRewriter=C=>C}get audioHostURL(){return this.urlRewriter(this._audioHostURL)}set audioHostURL(C){this._audioHostURL=C}get signalingURL(){return this.urlRewriter(this._signalingURL)}set signalingURL(C){this._signalingURL=C}get turnControlURL(){return this.urlRewriter(this._turnControlURL)}set turnControlURL(C){this._turnControlURL=C}get eventIngestionURL(){return this.urlRewriter(this._eventIngestionURL)}set eventIngestionURL(C){this._eventIngestionURL=C}};return MeetingSessionURLs.default=x,MeetingSessionURLs}var hasRequiredMeetingSessionConfiguration;function requireMeetingSessionConfiguration(){if(hasRequiredMeetingSessionConfiguration)return MeetingSessionConfiguration;hasRequiredMeetingSessionConfiguration=1;var x=MeetingSessionConfiguration&&MeetingSessionConfiguration.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(MeetingSessionConfiguration,"__esModule",{value:!0});const C=x(requireConnectionHealthPolicyConfiguration()),E=x(requireVideoQualitySettings()),w=requireUtils(),T=x(requireMeetingFeatures()),_=x(requireMeetingSessionCredentials()),S=x(requireMeetingSessionURLs());let R=class{constructor(A,O){var H,ee;if(this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new C.default,this.reconnectTimeoutMs=120*1e3,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1*1e3,this.reconnectLongBackOffMs=5*1e3,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.enableSVC=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1,this.meetingFeatures=new T.default,A){A=w.toLowerCasePropertyNames(A),A.meeting&&(A=A.meeting),this.meetingId=A.meetingid,this.externalMeetingId=A.externalmeetingid,this.urls=new S.default,this.urls.audioHostURL=A.mediaplacement.audiohosturl,this.urls.signalingURL=A.mediaplacement.signalingurl,this.urls.turnControlURL=A.mediaplacement.turncontrolurl,A.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=A.mediaplacement.eventingestionurl);const te=(ie,ne)=>{switch(ie){case"None":return E.default.VideoDisabled;case"HD":return E.default.VideoResolutionHD;case"FHD":return E.default.VideoResolutionFHD;case"UHD":return E.default.VideoResolutionUHD;default:return ne}};if(((H=A.meetingfeatures)===null||H===void 0?void 0:H.video)!==void 0||((ee=A.meetingfeatures)===null||ee===void 0?void 0:ee.content)!==void 0){const ie=A.meetingfeatures.video===void 0?"HD":A.meetingfeatures.video.maxresolution,ne=A.meetingfeatures.content===void 0?"FHD":A.meetingfeatures.content.maxresolution;this.meetingFeatures=new T.default(te(ie,E.default.VideoResolutionHD),te(ne,E.default.VideoResolutionFHD))}}O&&(O=w.toLowerCasePropertyNames(O),O.attendee&&(O=O.attendee),this.credentials=new _.default,this.credentials.attendeeId=O.attendeeid,this.credentials.externalUserId=O.externaluserid,this.credentials.joinToken=O.jointoken)}};return MeetingSessionConfiguration.default=R,MeetingSessionConfiguration}var NoVideoDownlinkBandwidthPolicy={},hasRequiredNoVideoDownlinkBandwidthPolicy;function requireNoVideoDownlinkBandwidthPolicy(){if(hasRequiredNoVideoDownlinkBandwidthPolicy)return NoVideoDownlinkBandwidthPolicy;hasRequiredNoVideoDownlinkBandwidthPolicy=1;var x=NoVideoDownlinkBandwidthPolicy&&NoVideoDownlinkBandwidthPolicy.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(NoVideoDownlinkBandwidthPolicy,"__esModule",{value:!0});const C=x(requireDefaultVideoStreamIdSet());let E=class{reset(){}updateIndex(w){}updateMetrics(w){}wantsResubscribe(){return!1}chooseSubscriptions(){return new C.default}};return NoVideoDownlinkBandwidthPolicy.default=E,NoVideoDownlinkBandwidthPolicy}var DefaultSimulcastUplinkPolicyForContentShare={},hasRequiredDefaultSimulcastUplinkPolicyForContentShare;function requireDefaultSimulcastUplinkPolicyForContentShare(){if(hasRequiredDefaultSimulcastUplinkPolicyForContentShare)return DefaultSimulcastUplinkPolicyForContentShare;hasRequiredDefaultSimulcastUplinkPolicyForContentShare=1;var x=DefaultSimulcastUplinkPolicyForContentShare&&DefaultSimulcastUplinkPolicyForContentShare.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(DefaultSimulcastUplinkPolicyForContentShare,"__esModule",{value:!0});const C=x(requireSimulcastContentShareTransceiverController());let E=class{constructor(w,T){this.encodingParams=T,this.enableUhdContent=!1,this.defaultHiTargetBitrateKbps=1200,this.defaultLowTargetBitrateKbps=300}updateConnectionMetric(w){}chooseMediaTrackConstraints(){}chooseEncodingParameters(){var w,T,_,S,R,A,O,H,ee,te,ie,ne;const ae=new Map,oe=1e3,le=C.default.NAME_ARR_ASCENDING;return ae.set(le[0],{rid:le[0],active:!0,scaleResolutionDownBy:((T=(w=this.encodingParams)===null||w===void 0?void 0:w.low)===null||T===void 0?void 0:T.scaleResolutionDownBy)||2,maxBitrate:(((S=(_=this.encodingParams)===null||_===void 0?void 0:_.low)===null||S===void 0?void 0:S.maxBitrateKbps)||this.defaultLowTargetBitrateKbps)*oe,maxFramerate:((A=(R=this.encodingParams)===null||R===void 0?void 0:R.low)===null||A===void 0?void 0:A.maxFramerate)||5}),ae.set(le[1],{rid:le[1],active:!0,scaleResolutionDownBy:((H=(O=this.encodingParams)===null||O===void 0?void 0:O.high)===null||H===void 0?void 0:H.scaleResolutionDownBy)||1,maxBitrate:(((te=(ee=this.encodingParams)===null||ee===void 0?void 0:ee.high)===null||te===void 0?void 0:te.maxBitrateKbps)||this.defaultHiTargetBitrateKbps)*oe,maxFramerate:(ne=(ie=this.encodingParams)===null||ie===void 0?void 0:ie.high)===null||ne===void 0?void 0:ne.maxFramerate}),ae}updateIndex(w){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){}maxBandwidthKbps(){return this.enableUhdContent?2e3:1200}setIdealMaxBandwidthKbps(w){}setHasBandwidthPriority(w){}setHighResolutionFeatureEnabled(w){this.enableUhdContent=w,this.defaultHiTargetBitrateKbps=w?2e3:1200,this.defaultLowTargetBitrateKbps=w?500:300}addObserver(w){}removeObserver(w){}forEachObserver(w){}};return DefaultSimulcastUplinkPolicyForContentShare.default=E,DefaultSimulcastUplinkPolicyForContentShare}var hasRequiredDefaultContentShareController;function requireDefaultContentShareController(){if(hasRequiredDefaultContentShareController)return DefaultContentShareController;hasRequiredDefaultContentShareController=1;var x=DefaultContentShareController&&DefaultContentShareController.__awaiter||function(te,ie,ne,ae){function oe(le){return le instanceof ne?le:new ne(function(fe){fe(le)})}return new(ne||(ne=Promise))(function(le,fe){function de(he){try{pe(ae.next(he))}catch(me){fe(me)}}function ce(he){try{pe(ae.throw(he))}catch(me){fe(me)}}function pe(he){he.done?le(he.value):oe(he.value).then(de,ce)}pe((ae=ae.apply(te,ie||[])).next())})},C=DefaultContentShareController&&DefaultContentShareController.__importDefault||function(te){return te&&te.__esModule?te:{default:te}};Object.defineProperty(DefaultContentShareController,"__esModule",{value:!0});const E=C(requireVideoQualitySettings()),w=C(requireMeetingSessionConfiguration()),T=C(requireMeetingSessionCredentials()),_=C(requireDefaultModality()),S=C(requireAsyncScheduler()),R=requireTypes$1(),A=C(requireNoVideoDownlinkBandwidthPolicy()),O=C(requireDefaultSimulcastUplinkPolicyForContentShare()),H=C(requireContentShareConstants());let ee=class{constructor(te,ie,ne){this.mediaStreamBroker=te,this.contentAudioVideo=ie,this.attendeeAudioVideo=ne,this.observerQueue=new Set,this.destroyed=!1,this.contentAudioVideo.addObserver(this),this.setupContentShareEvents()}static createContentShareMeetingSessionConfigure(te){const ie=new w.default;return ie.meetingId=te.meetingId,ie.externalMeetingId=te.externalMeetingId,ie.urls=te.urls,ie.disablePeriodicKeyframeRequestOnContentSender=te.disablePeriodicKeyframeRequestOnContentSender,ie.credentials=new T.default,ie.credentials.attendeeId=te.credentials.attendeeId+H.default.Modality,ie.credentials.externalUserId=te.credentials.externalUserId,ie.credentials.joinToken=te.credentials.joinToken+H.default.Modality,ie.meetingFeatures=te.meetingFeatures.clone(),ie.videoDownlinkBandwidthPolicy=new A.default,ie}setContentAudioProfile(te){this.contentAudioVideo.setAudioProfile(te)}enableSimulcastForContentShare(te,ie){te?(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=new O.default(this.contentAudioVideo.logger,ie)):(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=void 0)}enableSVCForContentShare(te){te?this.contentAudioVideo.configuration.enableSVC=!0:this.contentAudioVideo.configuration.enableSVC=!1}startContentShare(te){return x(this,void 0,void 0,function*(){if(te){if(this.contentAudioVideo.configuration.meetingFeatures.contentMaxResolution===E.default.VideoDisabled){this.contentAudioVideo.logger.info("Could not start content because max content resolution was set to None");return}this.mediaStreamBroker.mediaStream=te;for(let ie=0;ie<this.mediaStreamBroker.mediaStream.getTracks().length;ie++)this.mediaStreamBroker.mediaStream.getTracks()[ie].addEventListener("ended",()=>{this.stopContentShare()});this.contentAudioVideo.start()}})}startContentShareFromScreenCapture(te,ie){return x(this,void 0,void 0,function*(){const ne=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(te,ie);return yield this.startContentShare(ne),ne})}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver(te=>{R.Maybe.of(te.contentShareDidPause).map(ie=>ie.call(te))})}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver(te=>{R.Maybe.of(te.contentShareDidUnpause).map(ie=>ie.call(te))})}setContentShareVideoCodecPreferences(te){this.contentAudioVideo.setVideoCodecSendPreferences(te)}destroy(){return x(this,void 0,void 0,function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)})}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(te){this.observerQueue.add(te)}removeContentShareObserver(te){this.observerQueue.delete(te)}forEachContentShareObserver(te){for(const ie of this.observerQueue)S.default.nextTick(()=>{this.observerQueue.has(ie)&&te(ie)})}audioVideoDidStart(){var te;((te=this.mediaStreamBroker.mediaStream)===null||te===void 0?void 0:te.getVideoTracks().length)>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(te){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver(ie=>{R.Maybe.of(ie.contentShareDidStop).map(ne=>ne.call(ie))})}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence((te,ie,ne,ae)=>{const oe=new _.default(te).hasModality(_.default.MODALITY_CONTENT),le=new _.default(te).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!oe||!le||!ie||this.contentShareTile)return;const fe=this.mediaStreamBroker.mediaStream;if(fe?.getVideoTracks().length){this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();const de=fe.getVideoTracks()[0];let ce,pe;if(de.getSettings){const he=de.getSettings();ce=he.width,pe=he.height}else{const he=de.getCapabilities();ce=he.width,pe=he.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,fe,ce,pe,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver(de=>{R.Maybe.of(de.contentShareDidStart).map(ce=>ce.call(de))})})}};return DefaultContentShareController.default=ee,DefaultContentShareController}var DefaultEventController={},Destroyable={},hasRequiredDestroyable;function requireDestroyable(){if(hasRequiredDestroyable)return Destroyable;hasRequiredDestroyable=1,Object.defineProperty(Destroyable,"__esModule",{value:!0}),Destroyable.isDestroyable=void 0;function x(C){return C&&"destroy"in C}return Destroyable.isDestroyable=x,Destroyable}var EventIngestionConfiguration={},EventBufferConfiguration={},hasRequiredEventBufferConfiguration;function requireEventBufferConfiguration(){if(hasRequiredEventBufferConfiguration)return EventBufferConfiguration;hasRequiredEventBufferConfiguration=1,Object.defineProperty(EventBufferConfiguration,"__esModule",{value:!0});let x=class{constructor(C=5e3,E=2,w=64,T=100,_=15){this.flushIntervalMs=C,this.flushSize=E,this.maxBufferCapacityKb=w,this.totalBufferItems=T,this.retryCountLimit=_}};return EventBufferConfiguration.default=x,EventBufferConfiguration}var hasRequiredEventIngestionConfiguration;function requireEventIngestionConfiguration(){if(hasRequiredEventIngestionConfiguration)return EventIngestionConfiguration;hasRequiredEventIngestionConfiguration=1;var x=EventIngestionConfiguration&&EventIngestionConfiguration.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(EventIngestionConfiguration,"__esModule",{value:!0});const C=x(requireEventBufferConfiguration());let E=class{constructor(w,T,_=new C.default){this.eventsClientConfiguration=w,this.ingestionURL=T,this.eventBufferConfiguration=_}};return EventIngestionConfiguration.default=E,EventIngestionConfiguration}var DefaultMeetingEventReporter={},InMemoryJSONEventBuffer={},FullJitterBackoff={},hasRequiredFullJitterBackoff;function requireFullJitterBackoff(){if(hasRequiredFullJitterBackoff)return FullJitterBackoff;hasRequiredFullJitterBackoff=1,Object.defineProperty(FullJitterBackoff,"__esModule",{value:!0});let x=class{constructor(C,E,w){this.fixedWaitMs=C,this.shortBackoffMs=E,this.longBackoffMs=w,this.currentRetry=0,this.fixedWaitMs<0&&(this.fixedWaitMs=0),this.shortBackoffMs<0&&(this.shortBackoffMs=0),this.longBackoffMs<0&&(this.longBackoffMs=0),this.reset()}reset(){this.currentRetry=0}nextBackoffAmountMs(){const C=Math.random()*Math.min(this.longBackoffMs,this.shortBackoffMs*Math.pow(2,this.currentRetry))+this.fixedWaitMs;return this.currentRetry+=1,C}};return FullJitterBackoff.default=x,FullJitterBackoff}var DefaultUserAgentParser={},hasRequiredDefaultUserAgentParser;function requireDefaultUserAgentParser(){if(hasRequiredDefaultUserAgentParser)return DefaultUserAgentParser;hasRequiredDefaultUserAgentParser=1;var x=DefaultUserAgentParser&&DefaultUserAgentParser.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(DefaultUserAgentParser,"__esModule",{value:!0});const C=requireUaParser(),E=x(requireVersioning());let w=class Qo{constructor(_){var S,R,A,O,H,ee,te;try{this.parserResult=navigator&&navigator.userAgent?new C.UAParser(navigator.userAgent).getResult():void 0}catch(ie){_.error(ie.message)}this.browserMajorVersion=((A=(R=(S=this.parserResult)===null||S===void 0?void 0:S.browser)===null||R===void 0?void 0:R.version)===null||A===void 0?void 0:A.split(".")[0])||Qo.UNAVAILABLE,this.browserName=((O=this.parserResult)===null||O===void 0?void 0:O.browser.name)||Qo.UNAVAILABLE,this.browserVersion=((H=this.parserResult)===null||H===void 0?void 0:H.browser.version)||Qo.UNAVAILABLE,this.deviceName=[((ee=this.parserResult)===null||ee===void 0?void 0:ee.device.vendor)||"",((te=this.parserResult)===null||te===void 0?void 0:te.device.model)||""].join(" ").trim()||Qo.UNAVAILABLE}getParserResult(){var _,S;return{browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,osName:((_=this.parserResult)===null||_===void 0?void 0:_.os.name)||Qo.UNAVAILABLE,osVersion:((S=this.parserResult)===null||S===void 0?void 0:S.os.version)||Qo.UNAVAILABLE,sdkVersion:E.default.sdkVersion,sdkName:E.default.sdkName}}};return DefaultUserAgentParser.default=w,w.UNAVAILABLE="Unavailable",DefaultUserAgentParser}var hasRequiredInMemoryJSONEventBuffer;function requireInMemoryJSONEventBuffer(){if(hasRequiredInMemoryJSONEventBuffer)return InMemoryJSONEventBuffer;hasRequiredInMemoryJSONEventBuffer=1;var x=InMemoryJSONEventBuffer&&InMemoryJSONEventBuffer.__awaiter||function(A,O,H,ee){function te(ie){return ie instanceof H?ie:new H(function(ne){ne(ie)})}return new(H||(H=Promise))(function(ie,ne){function ae(fe){try{le(ee.next(fe))}catch(de){ne(de)}}function oe(fe){try{le(ee.throw(fe))}catch(de){ne(de)}}function le(fe){fe.done?ie(fe.value):te(fe.value).then(ae,oe)}le((ee=ee.apply(A,O||[])).next())})},C=InMemoryJSONEventBuffer&&InMemoryJSONEventBuffer.__rest||function(A,O){var H={};for(var ee in A)Object.prototype.hasOwnProperty.call(A,ee)&&O.indexOf(ee)<0&&(H[ee]=A[ee]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function")for(var te=0,ee=Object.getOwnPropertySymbols(A);te<ee.length;te++)O.indexOf(ee[te])<0&&Object.prototype.propertyIsEnumerable.call(A,ee[te])&&(H[ee[te]]=A[ee[te]]);return H},E=InMemoryJSONEventBuffer&&InMemoryJSONEventBuffer.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(InMemoryJSONEventBuffer,"__esModule",{value:!0});const w=E(requireFullJitterBackoff()),T=E(requireIntervalScheduler()),_=E(requireDefaultUserAgentParser()),S=requireUtils();let R=class bo{constructor(O,H,ee,te,ie){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=Se=>({type:Se.type,v:Se.v,payloads:[...Se.payloads]}),this.sendEvents=()=>x(this,void 0,void 0,function*(){if(this.lock)return;const Se=this.getItems(this.flushSize);if(Se.length===0)return;this.lock=!0;const Ce=this.makeRequestBody(Se);let be=!1;const Ee=Date.now();this.metadata.browserName.toLowerCase()==="firefox"&&this.cancellableEvents.set(Ee,Se);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${Ce}`);const Ae=yield this.send(Ce);if(this.cancellableEvents.delete(Ee),!Ae.ok)this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${Ce} with response status ${Ae.status}`),be=!0;else try{const Ie=yield Ae.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${Ce} message: ${JSON.stringify(Ie)}`)}catch(Ie){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${Ie} for events ${Ce}`)}}catch(Ae){be=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${Ce} to the ingestion endpoint ${Ae}`)}finally{this.lock=!1}be&&(this.cancellableEvents.delete(Ee),this.failedIngestionEvents.push(...Se))});const ne=new _.default(ie).getParserResult(),{browserMajorVersion:ae}=ne,oe=C(ne,["browserMajorVersion"]),le=H.toJSON(),{type:fe,v:de}=le,ce=C(le,["type","v"]);this.authenticationToken=H.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},oe),ce),Object.keys(this.metadata).forEach(Se=>this.attributesToFilter.push(Se)),this.type=fe,this.v=de,this.ingestionURL=ee,this.logger=ie,this.importantEvents=new Set(te);const{maxBufferCapacityKb:pe,totalBufferItems:he,flushSize:me,flushIntervalMs:ve,retryCountLimit:ye}=O;this.maxBufferCapacityBytes=pe*1024,this.totalBufferItems=he,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/he),this.flushIntervalMs=ve,this.flushSize=me,this.retryCountLimit=ye,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=Se=>this.beaconEventHandler(Se),this.addEventListeners()}addEventListeners(){!this.beaconEventListener||!("window"in commonjsGlobal)||!window.addEventListener||!("document"in commonjsGlobal)||!document.addEventListener||(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - addEventListeners - adding pagehide and visibility change event listeners"),window.addEventListener("pagehide",this.beaconEventListener),document.addEventListener("visibilitychange",this.beaconEventListener))}beaconEventHandler(O){(O.type==="visibilitychange"&&document.visibilityState==="hidden"||O.type==="pagehide")&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - beaconEventHandler is triggered calling sendBeacon"),this.sendBeacon())}removeEventListeners(){!this.beaconEventListener||!("window"in commonjsGlobal)||!window.removeEventListener||!("document"in commonjsGlobal)||!document.removeEventListener||(window.removeEventListener("pagehide",this.beaconEventListener),document.removeEventListener("visibilitychange",this.beaconEventListener),this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - removeEventListeners - removing pagehide and visibility change event listeners"))}start(){var O;this.removeEventListeners(),this.addEventListeners(),(O=this.intervalScheduler)===null||O===void 0||O.stop(),this.intervalScheduler=new T.default(this.flushIntervalMs),this.intervalScheduler.start(()=>this.sendEvents())}stop(){var O;(O=this.intervalScheduler)===null||O===void 0||O.stop(),this.intervalScheduler=void 0,this.sendBeacon(),this.removeEventListeners()}addItem(O){return x(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(O)}`);const{name:H,ts:ee,attributes:te}=O,ie=te&&this.filterAttributes(te,this.attributesToFilter),ne=Object.assign({name:H,ts:ee},ie);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(ne)}`);const ae=this.getSize(ne);if(ae>bo.MAX_ITEM_SIZE_BYTES_ALLOWED)throw new Error(`Event Reporting - Item to be added has size ${ae} bytes. Item cannot exceed max item size allowed of ${bo.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(H)){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(ne)}`),this.sendEventImmediately({name:H,ts:ee,attributes:ie});return}if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),new Error("Buffer full");if(this.currentIngestionEvent.payloads.push(ne),this.ingestionEventSize+=ae,this.bufferItemThresholdReached(ae)){const oe=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);this.buffer.push(oe),this.bufferSize+=this.ingestionEventSize,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - buffer item threshold reached updated buffer ${JSON.stringify(this.buffer)}`)}})}filterAttributes(O,H){const ee=new Set(H);return Object.keys(O).filter(te=>ee.has(te)).forEach(te=>delete O[te]),O}initializeAndGetCurrentIngestionEvent(){const O={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(O),O}bufferItemThresholdReached(O){return O+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===bo.MAX_PAYLOAD_ITEMS}getSize(O){let H=0;if(typeof O=="object")for(const[ee,te]of Object.entries(O))H+=this.getPrimitiveSize(ee),H+=this.getSize(te);else H+=this.getPrimitiveSize(O);return H}getPrimitiveSize(O){let H=0;return typeof O=="string"?H+=O.length*2:typeof O=="number"&&(H+=8),H}isFull(){return this.bufferSize===this.maxBufferCapacityBytes||this.buffer.length===this.totalBufferItems}isEmpty(){return this.buffer.length===0||this.bufferSize===0}getItems(O,H=0){return this.isEmpty()?[]:(O=Math.min(this.buffer.length,O+1),this.buffer.splice(H,O))}makeBeaconRequestBody(O){const H={metadata:this.metadata,events:O,authorization:this.authenticationToken};return JSON.stringify(H)}makeRequestBody(O){const H={metadata:this.metadata,events:O};return JSON.stringify(H)}sendEventImmediately(O){return x(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(O)}`);const{name:H,ts:ee,attributes:te}=O,ie={type:this.type,v:this.v,payloads:[Object.assign({name:H,ts:ee},te)]};let ne=!1,ae=null;const oe=this.makeRequestBody([ie]);try{if(ae=yield this.send(oe),ae.ok){try{const le=yield ae.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${oe}, message: ${JSON.stringify(le)}`)}catch(le){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${le} for event ${oe}`)}return}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${oe} with response status ${ae.status}`),ne=!0}catch(le){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${oe} to the ingestion endpoint ${le}.`),ne=!0;try{if(this.metadata.browserName.toLowerCase()==="firefox"){const fe=this.makeBeaconRequestBody([ie]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${fe}`),navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,fe)?ne=!1:ne=!0}}catch{this.logger.warn(`Event Reporting - Error sending beacon for an important event ${oe}`),ne=!0}}ne&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${oe}`),this.failedIngestionEvents.push(ie))})}send(O){return x(this,void 0,void 0,function*(){const H=new w.default(bo.RETRY_FIXED_BACKOFF_WAIT_MS,bo.RETRY_SHORT_BACKOFF_MS,bo.RETRY_LONG_BACKOFF_MS);try{let ee=0;for(;ee<this.retryCountLimit;){const te=yield fetch(this.ingestionURL,{method:"POST",headers:{Authorization:`Bearer ${this.authenticationToken}`},body:O});if(te.ok||!bo.SENDING_FAILURE_CODES.has(te.status))return te;if(this.logger.warn(`Will retry sending failure for ${O} due to status code ${te.status}.`),ee++,ee<this.retryCountLimit){const ie=H.nextBackoffAmountMs();yield S.wait(ie)}}if(ee===this.retryCountLimit)throw new Error(`Retry count limit reached for ${O}`)}catch(ee){throw ee}})}sendBeacon(){return x(this,void 0,void 0,function*(){const O=this.buffer;if(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out buffer events ${JSON.stringify(O)}`),this.buffer=[],this.currentIngestionEvent.payloads.length>0){const ee=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);O.push(ee),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(ee)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){const ee=this.failedIngestionEvents.map(te=>this.deepCopyCurrentIngestionEvent(te));O.push(...ee),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(ee)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>0&&(this.cancellableEvents.forEach(ee=>{O.push(...ee),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out each cancellable event ${JSON.stringify(ee)}`)}),this.cancellableEvents.clear()),O.length===0)return;const H=this.makeBeaconRequestBody(O);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - beacon data to send ${H}`);try{navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,H)||this.logger.warn(`Event Reporting - Browser failed to queue beacon data ${H}`)}catch(ee){this.logger.warn(`Event Reporting - Sending beacon data ${H} failed with error ${ee}`)}})}reset(){this.maxBufferCapacityBytes=0,this.totalBufferItems=0,this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.lock=!1,this.beaconEventListener=void 0,this.cancellableEvents.clear()}destroy(){return x(this,void 0,void 0,function*(){this.stop(),this.reset()})}};return InMemoryJSONEventBuffer.default=R,R.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),R.RETRY_FIXED_BACKOFF_WAIT_MS=0,R.RETRY_SHORT_BACKOFF_MS=1e3,R.RETRY_LONG_BACKOFF_MS=15e3,R.MAX_PAYLOAD_ITEMS=2,R.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3,InMemoryJSONEventBuffer}var hasRequiredDefaultMeetingEventReporter;function requireDefaultMeetingEventReporter(){if(hasRequiredDefaultMeetingEventReporter)return DefaultMeetingEventReporter;hasRequiredDefaultMeetingEventReporter=1;var x=DefaultMeetingEventReporter&&DefaultMeetingEventReporter.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=DefaultMeetingEventReporter&&DefaultMeetingEventReporter.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(DefaultMeetingEventReporter,"__esModule",{value:!0});const E=requireDestroyable(),w=C(requireInMemoryJSONEventBuffer());let T=class{constructor(_,S){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded","deviceLabelTriggerFailed"],this.destroyed=!1;const{eventsClientConfiguration:R,ingestionURL:A,eventBufferConfiguration:O}=_,{eventsToIgnore:H}=R;this.eventBuffer=new w.default(O,R,A,this.importantEvents,S),this.logger=S,this.eventsToIgnore=H,this.start()}start(){if(!this.reportingEvents)try{this.eventBuffer.start(),this.logger.info("Event reporting started"),this.reportingEvents=!0}catch(_){this.logger.error(`Event Reporting - Error starting the event buffer ${_}`)}}stop(){if(this.reportingEvents)try{this.eventBuffer.stop(),this.logger.info("Event reporting stopped"),this.reportingEvents=!1}catch(_){this.logger.error(`Event Reporting - Error stopping the event buffer ${_}`)}}reportEvent(_,S,R){return x(this,void 0,void 0,function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${_}, ${S}, ${JSON.stringify(R)}`),this.eventsToIgnore.includes(S)){this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - ${S} event will be ignored as it is in events to ignore`);return}try{this.logger.debug("Event Reporting - DefaultMeetingEventReporter - adding item to event buffer"),yield this.eventBuffer.addItem({ts:_,name:S,attributes:R})}catch(A){this.logger.error(`Event Reporting - Error adding event to buffer ${A}`)}})}destroy(){return x(this,void 0,void 0,function*(){this.destroyed=!0,this.stop(),E.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0})}};return DefaultMeetingEventReporter.default=T,DefaultMeetingEventReporter}var MeetingEventsClientConfiguration={},hasRequiredMeetingEventsClientConfiguration;function requireMeetingEventsClientConfiguration(){if(hasRequiredMeetingEventsClientConfiguration)return MeetingEventsClientConfiguration;hasRequiredMeetingEventsClientConfiguration=1,Object.defineProperty(MeetingEventsClientConfiguration,"__esModule",{value:!0});let x=class{constructor(C,E,w,T=[]){this.type="Meet",this.v=1,this.meetingId=C,this.attendeeId=E,this.eventsToIgnore=T,this.authenticationToken=w}getAuthenticationToken(){return this.authenticationToken}toJSON(){const C={};return C.type=this.type,C.v=this.v,C.meetingId=this.meetingId,C.attendeeId=this.attendeeId,C}};return MeetingEventsClientConfiguration.default=x,MeetingEventsClientConfiguration}var flattenEventAttributes={},hasRequiredFlattenEventAttributes;function requireFlattenEventAttributes(){if(hasRequiredFlattenEventAttributes)return flattenEventAttributes;hasRequiredFlattenEventAttributes=1,Object.defineProperty(flattenEventAttributes,"__esModule",{value:!0});const x=C=>{const E={};for(const[w,T]of Object.entries(C))if(!(T==null||T===""))if(typeof T=="number"||typeof T=="string")E[w]=T;else throw new TypeError("Unhandled type received while flattening attributes.");return E};return flattenEventAttributes.default=x,flattenEventAttributes}var hasRequiredDefaultEventController;function requireDefaultEventController(){if(hasRequiredDefaultEventController)return DefaultEventController;hasRequiredDefaultEventController=1;var x=DefaultEventController&&DefaultEventController.__awaiter||function(ee,te,ie,ne){function ae(oe){return oe instanceof ie?oe:new ie(function(le){le(oe)})}return new(ie||(ie=Promise))(function(oe,le){function fe(pe){try{ce(ne.next(pe))}catch(he){le(he)}}function de(pe){try{ce(ne.throw(pe))}catch(he){le(he)}}function ce(pe){pe.done?oe(pe.value):ae(pe.value).then(fe,de)}ce((ne=ne.apply(ee,te||[])).next())})},C=DefaultEventController&&DefaultEventController.__importDefault||function(ee){return ee&&ee.__esModule?ee:{default:ee}};Object.defineProperty(DefaultEventController,"__esModule",{value:!0});const E=requireUaParser(),w=requireDestroyable(),T=C(requireEventIngestionConfiguration()),_=C(requireDefaultMeetingEventReporter()),S=C(requireMeetingEventsClientConfiguration()),R=C(requireAsyncScheduler()),A=C(requireVersioning()),O=C(requireFlattenEventAttributes());let H=class ts{constructor(te,ie,ne){var ae,oe,le,fe,de,ce,pe;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=ie,this.configuration=te,this.setupEventReporter(te,ie,ne);try{this.parserResult=navigator&&navigator.userAgent?new E.UAParser(navigator.userAgent).getResult():null}catch(he){this.logger.error(he.message)}this.browserMajorVersion=((le=(oe=(ae=this.parserResult)===null||ae===void 0?void 0:ae.browser)===null||oe===void 0?void 0:oe.version)===null||le===void 0?void 0:le.split(".")[0])||ts.UNAVAILABLE,this.browserName=((fe=this.parserResult)===null||fe===void 0?void 0:fe.browser.name)||ts.UNAVAILABLE,this.browserVersion=((de=this.parserResult)===null||de===void 0?void 0:de.browser.version)||ts.UNAVAILABLE,this.deviceName=[((ce=this.parserResult)===null||ce===void 0?void 0:ce.device.vendor)||"",((pe=this.parserResult)===null||pe===void 0?void 0:pe.device.model)||""].join(" ").trim()||ts.UNAVAILABLE}addObserver(te){this.observerSet.add(te)}removeObserver(te){this.observerSet.delete(te)}forEachObserver(te){for(const ie of this.observerSet)R.default.nextTick(()=>{this.observerSet.has(ie)&&te(ie)})}publishEvent(te,ie){return x(this,void 0,void 0,function*(){const ne=Date.now();this.meetingHistoryStates.push({name:te,timestampMs:ne});const ae=Object.freeze(Object.assign(this.getAttributes(ne),ie));this.forEachObserver(oe=>{oe.eventDidReceive(te,ae)}),this.reportEvent(te,ne,ie)})}reportEvent(te,ie,ne){var ae;return x(this,void 0,void 0,function*(){let oe;try{ne&&(oe=O.default(ne)),yield(ae=this.eventReporter)===null||ae===void 0?void 0:ae.reportEvent(ie,te,oe)}catch(le){this.logger.error(`Error reporting event ${le}`)}})}setupEventReporter(te,ie,ne){if(ne)this._eventReporter=ne;else if(te.urls){const ae=te.urls.eventIngestionURL;if(ae){this.logger.info("Event ingestion URL is present in the configuration");const{meetingId:oe,credentials:{attendeeId:le,joinToken:fe}}=te,de=new S.default(oe,le,fe),ce=new T.default(de,ae);this._eventReporter=new _.default(ce,ie)}}}getAttributes(te){var ie,ne;return{attendeeId:this.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:typeof this.configuration.externalMeetingId=="string"?this.configuration.externalMeetingId:"",externalUserId:this.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.configuration.meetingId,osName:((ie=this.parserResult)===null||ie===void 0?void 0:ie.os.name)||ts.UNAVAILABLE,osVersion:((ne=this.parserResult)===null||ne===void 0?void 0:ne.os.version)||ts.UNAVAILABLE,sdkVersion:A.default.sdkVersion,sdkName:A.default.sdkName,timestampMs:te}}get eventReporter(){return this._eventReporter}destroy(){return x(this,void 0,void 0,function*(){w.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0})}};return DefaultEventController.default=H,H.UNAVAILABLE="Unavailable",DefaultEventController}var DefaultMeetingReadinessChecker={},MeetingReadinessCheckerConfiguration={},hasRequiredMeetingReadinessCheckerConfiguration;function requireMeetingReadinessCheckerConfiguration(){if(hasRequiredMeetingReadinessCheckerConfiguration)return MeetingReadinessCheckerConfiguration;hasRequiredMeetingReadinessCheckerConfiguration=1,Object.defineProperty(MeetingReadinessCheckerConfiguration,"__esModule",{value:!0});let x=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3,this.audioOutputFrequency=440,this.audioOutputGain=.1}};return MeetingReadinessCheckerConfiguration.default=x,MeetingReadinessCheckerConfiguration}var hasRequiredDefaultMeetingReadinessChecker;function requireDefaultMeetingReadinessChecker(){if(hasRequiredDefaultMeetingReadinessChecker)return DefaultMeetingReadinessChecker;hasRequiredDefaultMeetingReadinessChecker=1;var x=DefaultMeetingReadinessChecker&&DefaultMeetingReadinessChecker.__awaiter||function(de,ce,pe,he){function me(ve){return ve instanceof pe?ve:new pe(function(ye){ye(ve)})}return new(pe||(pe=Promise))(function(ve,ye){function Se(Ee){try{be(he.next(Ee))}catch(Ae){ye(Ae)}}function Ce(Ee){try{be(he.throw(Ee))}catch(Ae){ye(Ae)}}function be(Ee){Ee.done?ve(Ee.value):me(Ee.value).then(Se,Ce)}be((he=he.apply(de,ce||[])).next())})},C=DefaultMeetingReadinessChecker&&DefaultMeetingReadinessChecker.__importDefault||function(de){return de&&de.__esModule?de:{default:de}};Object.defineProperty(DefaultMeetingReadinessChecker,"__esModule",{value:!0});const E=C(requireDefaultAudioMixController()),w=C(requireDefaultBrowserBehavior()),T=C(requireDefaultDeviceController()),_=C(requirePermissionDeniedError()),S=C(requireBaseTask()),R=C(requireTimeoutTask()),A=C(requireCheckAudioConnectivityFeedback()),O=C(requireCheckAudioInputFeedback()),H=C(requireCheckAudioOutputFeedback()),ee=C(requireCheckCameraResolutionFeedback()),te=C(requireCheckContentShareConnectivityFeedback()),ie=C(requireCheckNetworkTCPConnectivityFeedback()),ne=C(requireCheckNetworkUDPConnectivityFeedback()),ae=C(requireCheckVideoConnectivityFeedback()),oe=C(requireCheckVideoInputFeedback()),le=C(requireMeetingReadinessCheckerConfiguration());let fe=class hm{constructor(ce,pe,he=new le.default){this.logger=ce,this.meetingSession=pe,this.configuration=he,this.browserBehavior=new w.default}static delay(ce){return x(this,void 0,void 0,function*(){return new Promise(pe=>setTimeout(pe,ce))})}checkAudioInput(ce){return x(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(ce),yield this.meetingSession.audioVideo.stopAudioInput(),O.default.Succeeded}catch(pe){return this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${pe}`),pe instanceof _.default?O.default.PermissionDenied:O.default.Failed}})}checkAudioOutput(ce,pe,he=null){return x(this,void 0,void 0,function*(){try{const me=ce?T.default.getIntrinsicDeviceId(ce):"";return yield this.playTone(me,this.configuration.audioOutputFrequency,he),(yield pe())?H.default.Succeeded:H.default.Failed}catch(me){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${me}`),H.default.Failed}finally{this.stopTone()}})}playTone(ce,pe,he){return x(this,void 0,void 0,function*(){const me=this.configuration.audioOutputGain;this.oscillatorNode&&this.stopTone(),this.audioContext=T.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=pe,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);const ve=this.audioContext.currentTime+.1;this.gainNode.gain.linearRampToValueAtTime(0,ve),this.gainNode.gain.linearRampToValueAtTime(me,ve+.1),this.oscillatorNode.start();const ye=new E.default(this.logger);try{this.browserBehavior.supportsSetSinkId()&&(yield ye.bindAudioDevice({deviceId:ce}))}catch(Se){this.logger.error(`Failed to bind audio device: ${Se}`)}try{yield ye.bindAudioElement(he||new Audio)}catch(Se){this.logger.error(`Failed to bind audio element: ${Se}`)}yield ye.bindAudioStream(this.destinationStream.stream)})}stopTone(){if(!this.audioContext||!this.gainNode||!this.oscillatorNode||!this.destinationStream)return;const ce=1,pe=.1,he=this.configuration.audioOutputGain,me=this.audioContext.currentTime;this.gainNode.gain.linearRampToValueAtTime(he,me+pe+ce),this.gainNode.gain.linearRampToValueAtTime(0,me+pe*2+ce),this.oscillatorNode.stop(),this.oscillatorNode.disconnect(this.gainNode),this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null}checkVideoInput(ce){return x(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(ce),yield this.meetingSession.audioVideo.stopVideoInput(),oe.default.Succeeded}catch(pe){return this.logger.error(`MeetingReadinessChecker: Video check failed with error ${pe}`),pe instanceof _.default?oe.default.PermissionDenied:oe.default.Failed}})}checkCameraResolution(ce,pe,he){return x(this,void 0,void 0,function*(){let me;try{const ve=T.default.getIntrinsicDeviceId(ce),ye={video:this.calculateVideoConstraint(ve,pe,he)};me=yield navigator.mediaDevices.getUserMedia(ye)}catch(ve){return this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${pe} height ${he} failed with error ${ve}`),ve&&ve.name==="OverconstrainedError"?ee.default.ResolutionNotSupported:ve&&ve.name==="NotAllowedError"?ee.default.PermissionDenied:ee.default.Failed}finally{me&&me.getTracks().forEach(function(ve){ve.stop()})}return ee.default.Succeeded})}calculateVideoConstraint(ce,pe,he){const me=this.browserBehavior.requiresResolutionAlignment(pe,he),ve={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(ve.deviceId=ce,ve.width=pe,ve.height=he):(ve.deviceId={exact:ce},ve.width={exact:me[0]},ve.height={exact:me[1]}),ve}checkContentShareConnectivity(ce){return x(this,void 0,void 0,function*(){let pe=!1,he=!1;const me={contentShareDidStart:()=>{pe=!0}},ve={audioVideoDidStart:()=>{he=!0}};try{return this.meetingSession.audioVideo.addObserver(ve),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(me),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(ce),yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return he&&pe})),he?(yield this.stopMeeting(),pe?te.default.Succeeded:te.default.TimedOut):te.default.ConnectionFailed}catch(ye){return this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${ye}`),ye.name==="NotAllowedError"?te.default.PermissionDenied:te.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(ve),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(me)}})}checkAudioConnectivity(ce){return x(this,void 0,void 0,function*(){let pe=!1;const he={packetsReceived:0},me=this.meetingSession.audioVideo,ve={metricsDidReceive(Se){Se.getRTCStatsReport().forEach(Ce=>{Ce.type==="inbound-rtp"&&(Ce.mediaType==="audio"||Ce.kind==="audio")&&(he.packetsReceived=Ce.packetsReceived)})}},ye=(Se,Ce,be,Ee)=>{Se===this.meetingSession.configuration.credentials.attendeeId&&Ce&&(pe=!0)};try{yield me.startAudioInput(ce)}catch(Se){return this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${Se}`),Se instanceof _.default?A.default.AudioInputPermissionDenied:A.default.AudioInputRequestFailed}return me.realtimeSubscribeToAttendeeIdPresence(ye),me.addObserver(ve),(yield this.startMeeting())?(yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return this.isAudioConnectionSuccessful(pe,he)})),me.removeObserver(ve),me.realtimeUnsubscribeToAttendeeIdPresence(ye),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),this.isAudioConnectionSuccessful(pe,he)?A.default.Succeeded:A.default.AudioNotReceived):(me.removeObserver(ve),me.realtimeUnsubscribeToAttendeeIdPresence(ye),yield this.meetingSession.audioVideo.stopAudioInput(),A.default.ConnectionFailed)})}checkVideoConnectivity(ce){return x(this,void 0,void 0,function*(){const pe=this.meetingSession.audioVideo;let he=0;const me={metricsDidReceive(ve){ve.getRTCStatsReport().forEach(ye=>{ye.type==="outbound-rtp"&&(ye.mediaType==="video"||ye.kind==="video")&&(he=ye.packetsSent)})}};try{yield pe.startVideoInput(ce)}catch(ve){return this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${ve}`),ve instanceof _.default?ae.default.VideoInputPermissionDenied:ae.default.VideoInputRequestFailed}return pe.addObserver(me),(yield this.startMeeting())?(pe.startLocalVideoTile(),yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return he>0})),yield pe.stopVideoInput(),yield this.stopMeeting(),pe.removeObserver(me),he<=0?ae.default.VideoNotSent:ae.default.Succeeded):ae.default.ConnectionFailed})}checkNetworkUDPConnectivity(){return x(this,void 0,void 0,function*(){let ce=!1;const pe={metricsDidReceive(me){me.getRTCStatsReport().forEach(ve=>{ve.type==="candidate-pair"&&ve.state==="succeeded"&&(ce=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(me){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${me}`),ne.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=me=>{const ve=this.originalURLRewriter(me);return ve.includes("transport=tcp")?"":ve};const he=this.meetingSession.audioVideo;return he.addObserver(pe),(yield this.startMeeting())?(yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return ce})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),he.removeObserver(pe),ce?ne.default.Succeeded:ne.default.ICENegotiationFailed):(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,ne.default.ConnectionFailed)})}checkNetworkTCPConnectivity(){return x(this,void 0,void 0,function*(){let ce=!1;const pe={metricsDidReceive(me){me.getRTCStatsReport().forEach(ve=>{ve.type==="candidate-pair"&&ve.state==="succeeded"&&(ce=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(me){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${me}`),ie.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=me=>{const ve=this.originalURLRewriter(me);return ve.includes("transport=udp")?"":ve};const he=this.meetingSession.audioVideo;return he.addObserver(pe),(yield this.startMeeting())?(yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return ce})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),he.removeObserver(pe),ce?ie.default.Succeeded:ie.default.ICENegotiationFailed):(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,ie.default.ConnectionFailed)})}startMeeting(){return x(this,void 0,void 0,function*(){let ce=!1;const pe={audioVideoDidStart:()=>{ce=!0}};return this.meetingSession.audioVideo.addObserver(pe),this.meetingSession.audioVideo.start(),yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return ce})),this.meetingSession.audioVideo.removeObserver(pe),ce})}stopMeeting(){return x(this,void 0,void 0,function*(){let ce=!1;const pe={audioVideoDidStop:he=>{ce=!0}};return this.meetingSession.audioVideo.addObserver(pe),this.meetingSession.audioVideo.stop(),yield this.executeTimeoutTask(()=>x(this,void 0,void 0,function*(){return ce})),this.meetingSession.audioVideo.removeObserver(pe),ce})}executeTimeoutTask(ce){return x(this,void 0,void 0,function*(){let pe=!1;class he extends S.default{constructor(ve,ye){super(ve),this.waitDurationMs=ye,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return x(this,void 0,void 0,function*(){for(;!this.isCancelled;){if(yield ce()){pe=!0;break}yield hm.delay(this.waitDurationMs)}})}}return yield new R.default(this.logger,new he(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs).run(),pe})}isAudioConnectionSuccessful(ce,pe){return ce&&pe.packetsReceived>0}};return DefaultMeetingReadinessChecker.default=fe,DefaultMeetingReadinessChecker}var DefaultMeetingSession={},DefaultReconnectController={},hasRequiredDefaultReconnectController;function requireDefaultReconnectController(){if(hasRequiredDefaultReconnectController)return DefaultReconnectController;hasRequiredDefaultReconnectController=1;var x=DefaultReconnectController&&DefaultReconnectController.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(DefaultReconnectController,"__esModule",{value:!0});const C=x(requireTimeoutScheduler());let E=class fm{constructor(T,_){this.reconnectTimeoutMs=T,this.backoffPolicy=_,this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this._isFirstConnection=!0,this.backoffTimer=null,this.backoffCancel=null,this.reset()}timeSpentReconnectingMs(){return this.firstConnectionAttempted?Date.now()-this.firstConnectionAttemptTimestampMs:0}hasPastReconnectDeadline(){return Date.now()-this.lastActiveTimestampMs>=this.reconnectTimeoutMs?!0:this.timeSpentReconnectingMs()>=this.reconnectTimeoutMs}reset(){this.cancel(),this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this.backoffPolicy.reset()}startedConnectionAttempt(T){this._isFirstConnection=T,this.firstConnectionAttempted||(this.firstConnectionAttempted=!0,this.firstConnectionAttemptTimestampMs=Date.now())}hasStartedConnectionAttempt(){return this.firstConnectionAttempted}isFirstConnection(){return this._isFirstConnection}disableReconnect(){this.shouldReconnect=!1}enableRestartPeerConnection(){this.onlyRestartPeerConnection=!0}cancel(){this.disableReconnect(),this.backoffTimer&&(this.backoffTimer.stop(),this.backoffCancel&&(this.backoffCancel(),this.backoffCancel=null))}retryWithBackoff(T,_){const S=this.shouldReconnect&&!this.hasPastReconnectDeadline();return S&&(this.backoffCancel=_,this.backoffTimer=new C.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start(()=>{this.backoffCancel=null,T()})),S}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new fm(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(T){this.lastActiveTimestampMs=T}};return DefaultReconnectController.default=E,DefaultReconnectController}var DefaultWebSocketAdapter={},hasRequiredDefaultWebSocketAdapter;function requireDefaultWebSocketAdapter(){if(hasRequiredDefaultWebSocketAdapter)return DefaultWebSocketAdapter;hasRequiredDefaultWebSocketAdapter=1;var x=DefaultWebSocketAdapter&&DefaultWebSocketAdapter.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(DefaultWebSocketAdapter,"__esModule",{value:!0});const C=x(requireVersioning()),E=x(requireWebSocketReadyState());let w=class{constructor(T){this.logger=T}create(T,_,S){this.connection=new WebSocket(S?T:C.default.urlWithVersion(T),_),this.connection.binaryType="arraybuffer"}send(T){if(!this.connection)return this.logger.error("WebSocket not yet created or already destroyed."),!1;try{return T instanceof Uint8Array?this.connection.send(T.buffer):this.connection.send(T),!0}catch(_){return this.logger.debug(()=>`send error: ${_.message}, websocket state=${E.default[this.readyState()]}`),!1}}close(T,_){var S;(S=this.connection)===null||S===void 0||S.close(T,_)}destroy(){this.connection=void 0}addEventListener(T,_){if(!this.connection){this.logger.warn("Cannot add event listener with no WebSocket connection.");return}this.connection.addEventListener(T,_)}removeEventListener(T,_){var S;(S=this.connection)===null||S===void 0||S.removeEventListener(T,_)}readyState(){if(!this.connection)return E.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return E.default.Connecting;case WebSocket.OPEN:return E.default.Open;case WebSocket.CLOSING:return E.default.Closing;case WebSocket.CLOSED:return E.default.Closed}}};return DefaultWebSocketAdapter.default=w,DefaultWebSocketAdapter}var hasRequiredDefaultMeetingSession;function requireDefaultMeetingSession(){if(hasRequiredDefaultMeetingSession)return DefaultMeetingSession;hasRequiredDefaultMeetingSession=1;var x=DefaultMeetingSession&&DefaultMeetingSession.__awaiter||function(ne,ae,oe,le){function fe(de){return de instanceof oe?de:new oe(function(ce){ce(de)})}return new(oe||(oe=Promise))(function(de,ce){function pe(ve){try{me(le.next(ve))}catch(ye){ce(ye)}}function he(ve){try{me(le.throw(ve))}catch(ye){ce(ye)}}function me(ve){ve.done?de(ve.value):fe(ve.value).then(pe,he)}me((le=le.apply(ne,ae||[])).next())})},C=DefaultMeetingSession&&DefaultMeetingSession.__importDefault||function(ne){return ne&&ne.__esModule?ne:{default:ne}};Object.defineProperty(DefaultMeetingSession,"__esModule",{value:!0});const E=C(requireDefaultAudioVideoController()),w=C(requireDefaultAudioVideoFacade()),T=C(requireFullJitterBackoff()),_=C(requireDefaultBrowserBehavior()),S=C(requireContentShareMediaStreamBroker()),R=C(requireDefaultContentShareController()),A=C(requireCSPMonitor()),O=requireDestroyable(),H=C(requireDefaultEventController()),ee=C(requireDefaultReconnectController()),te=C(requireDefaultWebSocketAdapter());let ie=class{constructor(ne,ae,oe,le){this._eventController=le,this._configuration=ne,this._logger=ae,this.checkBrowserSupportAndFeatureConfiguration(),A.default.addLogger(this._logger),A.default.register(),this._eventController||(this._eventController=new H.default(ne,ae)),oe.eventController||(oe.eventController=this.eventController),this.audioVideoController=new E.default(this._configuration,this._logger,new te.default(this._logger),oe,new ee.default(this._configuration.reconnectTimeoutMs,new T.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=oe,this.logger.info(`MeetingFeatures: ${JSON.stringify(ne.meetingFeatures)}`);const fe=new S.default(this._logger);this.contentShareController=new R.default(fe,new E.default(R.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new te.default(this._logger),fe,new ee.default(this._configuration.reconnectTimeoutMs,new T.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new w.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return x(this,void 0,void 0,function*(){O.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),O.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),O.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),A.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventController=void 0})}checkBrowserSupportAndFeatureConfiguration(){const ne=new _.default,ae=`${ne.name()} ${ne.majorVersion()} (${ne.version()})`;if(this.logger.info(`browser is ${ae}`),ne.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${ne.supportString()}.`),this._configuration.videoUplinkBandwidthPolicy)if(this.isSimulcastUplinkPolicy(this._configuration.videoUplinkBandwidthPolicy)){if(!ne.hasChromiumWebRTC())throw new Error("Simulcast is only supported on Chromium-based browsers");this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0}else this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1;this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(ne.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${ne.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast is only supported on Chromium-based browsers")),this._configuration.enableSVC&&(this._configuration.enableSVC=!1,this.logger.info("SVC is not successfully enabled since simulcast is enabled"))),this._configuration.enableSVC&&!ne.supportsScalableVideoCoding()&&(this._configuration.enableSVC=!1,this.logger.info("SVC is only supported on Chromium-based browsers with version 111 or above"))}isSimulcastUplinkPolicy(ne){return!!(ne&&ne.addObserver)}};return DefaultMeetingSession.default=ie,DefaultMeetingSession}var DefaultMessagingSession={};const getHttpHandlerExtensionConfiguration=x=>({setHttpHandler(C){x.httpHandler=C},httpHandler(){return x.httpHandler},updateHttpClientConfig(C,E){x.httpHandler?.updateHttpClientConfig(C,E)},httpHandlerConfigs(){return x.httpHandler.httpHandlerConfigs()}}),resolveHttpHandlerRuntimeConfig=x=>({httpHandler:x.httpHandler()});var HttpAuthLocation;(function(x){x.HEADER="header",x.QUERY="query"})(HttpAuthLocation||(HttpAuthLocation={}));var HttpApiKeyAuthLocation;(function(x){x.HEADER="header",x.QUERY="query"})(HttpApiKeyAuthLocation||(HttpApiKeyAuthLocation={}));var EndpointURLScheme;(function(x){x.HTTP="http",x.HTTPS="https"})(EndpointURLScheme||(EndpointURLScheme={}));var AlgorithmId;(function(x){x.MD5="md5",x.CRC32="crc32",x.CRC32C="crc32c",x.SHA1="sha1",x.SHA256="sha256"})(AlgorithmId||(AlgorithmId={}));var FieldPosition;(function(x){x[x.HEADER=0]="HEADER",x[x.TRAILER=1]="TRAILER"})(FieldPosition||(FieldPosition={}));const SMITHY_CONTEXT_KEY="__smithy_context";var IniSectionType;(function(x){x.PROFILE="profile",x.SSO_SESSION="sso-session",x.SERVICES="services"})(IniSectionType||(IniSectionType={}));var RequestHandlerProtocol;(function(x){x.HTTP_0_9="http/0.9",x.HTTP_1_0="http/1.0",x.TDS_8_0="tds/8.0"})(RequestHandlerProtocol||(RequestHandlerProtocol={}));class HttpRequest{constructor(C){this.method=C.method||"GET",this.hostname=C.hostname||"localhost",this.port=C.port,this.query=C.query||{},this.headers=C.headers||{},this.body=C.body,this.protocol=C.protocol?C.protocol.slice(-1)!==":"?`${C.protocol}:`:C.protocol:"https:",this.path=C.path?C.path.charAt(0)!=="/"?`/${C.path}`:C.path:"/",this.username=C.username,this.password=C.password,this.fragment=C.fragment}static clone(C){const E=new HttpRequest({...C,headers:{...C.headers}});return E.query&&(E.query=cloneQuery(E.query)),E}static isInstance(C){if(!C)return!1;const E=C;return"method"in E&&"protocol"in E&&"hostname"in E&&"path"in E&&typeof E.query=="object"&&typeof E.headers=="object"}clone(){return HttpRequest.clone(this)}}function cloneQuery(x){return Object.keys(x).reduce((C,E)=>{const w=x[E];return{...C,[E]:Array.isArray(w)?[...w]:w}},{})}class HttpResponse{constructor(C){this.statusCode=C.statusCode,this.reason=C.reason,this.headers=C.headers||{},this.body=C.body}static isInstance(C){if(!C)return!1;const E=C;return typeof E.statusCode=="number"&&typeof E.headers=="object"}}const hostHeaderMiddleware=x=>C=>async E=>{if(!HttpRequest.isInstance(E.request))return C(E);const{request:w}=E,{handlerProtocol:T=""}=x.requestHandler.metadata||{};if(T.indexOf("h2")>=0&&!w.headers[":authority"])delete w.headers.host,w.headers[":authority"]=w.hostname+(w.port?":"+w.port:"");else if(!w.headers.host){let _=w.hostname;w.port!=null&&(_+=`:${w.port}`),w.headers.host=_}return C(E)},hostHeaderMiddlewareOptions={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},getHostHeaderPlugin=x=>({applyToStack:C=>{C.add(hostHeaderMiddleware(x),hostHeaderMiddlewareOptions)}}),loggerMiddleware=()=>(x,C)=>async E=>{try{const w=await x(E),{clientName:T,commandName:_,logger:S,dynamoDbDocumentClientOptions:R={}}=C,{overrideInputFilterSensitiveLog:A,overrideOutputFilterSensitiveLog:O}=R,H=A??C.inputFilterSensitiveLog,ee=O??C.outputFilterSensitiveLog,{$metadata:te,...ie}=w.output;return S?.info?.({clientName:T,commandName:_,input:H(E.input),output:ee(ie),metadata:te}),w}catch(w){const{clientName:T,commandName:_,logger:S,dynamoDbDocumentClientOptions:R={}}=C,{overrideInputFilterSensitiveLog:A}=R,O=A??C.inputFilterSensitiveLog;throw S?.error?.({clientName:T,commandName:_,input:O(E.input),error:w,metadata:w.$metadata}),w}},loggerMiddlewareOptions={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},getLoggerPlugin=x=>({applyToStack:C=>{C.add(loggerMiddleware(),loggerMiddlewareOptions)}}),TRACE_ID_HEADER_NAME="X-Amzn-Trace-Id",ENV_LAMBDA_FUNCTION_NAME="AWS_LAMBDA_FUNCTION_NAME",ENV_TRACE_ID="_X_AMZN_TRACE_ID",recursionDetectionMiddleware=x=>C=>async E=>{const{request:w}=E;if(!HttpRequest.isInstance(w)||x.runtime!=="node")return C(E);const T=Object.keys(w.headers??{}).find(A=>A.toLowerCase()===TRACE_ID_HEADER_NAME.toLowerCase())??TRACE_ID_HEADER_NAME;if(w.headers.hasOwnProperty(T))return C(E);const _=define_process_env_default[ENV_LAMBDA_FUNCTION_NAME],S=define_process_env_default[ENV_TRACE_ID],R=A=>typeof A=="string"&&A.length>0;return R(_)&&R(S)&&(w.headers[TRACE_ID_HEADER_NAME]=S),C({...E,request:w})},addRecursionDetectionMiddlewareOptions={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},getRecursionDetectionPlugin=x=>({applyToStack:C=>{C.add(recursionDetectionMiddleware(x),addRecursionDetectionMiddlewareOptions)}}),getSmithyContext=x=>x[SMITHY_CONTEXT_KEY]||(x[SMITHY_CONTEXT_KEY]={}),normalizeProvider$1=x=>{if(typeof x=="function")return x;const C=Promise.resolve(x);return()=>C},resolveAuthOptions=(x,C)=>{if(!C||C.length===0)return x;const E=[];for(const w of C)for(const T of x)T.schemeId.split("#")[1]===w&&E.push(T);for(const w of x)E.find(({schemeId:T})=>T===w.schemeId)||E.push(w);return E};function convertHttpAuthSchemesToMap(x){const C=new Map;for(const E of x)C.set(E.schemeId,E);return C}const httpAuthSchemeMiddleware=(x,C)=>(E,w)=>async T=>{const _=x.httpAuthSchemeProvider(await C.httpAuthSchemeParametersProvider(x,w,T.input)),S=x.authSchemePreference?await x.authSchemePreference():[],R=resolveAuthOptions(_,S),A=convertHttpAuthSchemesToMap(x.httpAuthSchemes),O=getSmithyContext(w),H=[];for(const ee of R){const te=A.get(ee.schemeId);if(!te){H.push(`HttpAuthScheme \`${ee.schemeId}\` was not enabled for this service.`);continue}const ie=te.identityProvider(await C.identityProviderConfigProvider(x));if(!ie){H.push(`HttpAuthScheme \`${ee.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:ne={},signingProperties:ae={}}=ee.propertiesExtractor?.(x,w)||{};ee.identityProperties=Object.assign(ee.identityProperties||{},ne),ee.signingProperties=Object.assign(ee.signingProperties||{},ae),O.selectedHttpAuthScheme={httpAuthOption:ee,identity:await ie(ee.identityProperties),signer:te.signer};break}if(!O.selectedHttpAuthScheme)throw new Error(H.join(`
`));return E(T)},httpAuthSchemeEndpointRuleSetMiddlewareOptions={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},getHttpAuthSchemeEndpointRuleSetPlugin=(x,{httpAuthSchemeParametersProvider:C,identityProviderConfigProvider:E})=>({applyToStack:w=>{w.addRelativeTo(httpAuthSchemeMiddleware(x,{httpAuthSchemeParametersProvider:C,identityProviderConfigProvider:E}),httpAuthSchemeEndpointRuleSetMiddlewareOptions)}}),deserializerMiddleware=(x,C)=>(E,w)=>async T=>{const{response:_}=await E(T);try{const S=await C(_,x);return{response:_,output:S}}catch(S){if(Object.defineProperty(S,"$response",{value:_}),!("$metadata"in S)){const R="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{S.message+=`
  `+R}catch{!w.logger||w.logger?.constructor?.name==="NoOpLogger"?console.warn(R):w.logger?.warn?.(R)}typeof S.$responseBodyText<"u"&&S.$response&&(S.$response.body=S.$responseBodyText);try{if(HttpResponse.isInstance(_)){const{headers:A={}}=_,O=Object.entries(A);S.$metadata={httpStatusCode:_.statusCode,requestId:findHeader(/^x-[\w-]+-request-?id$/,O),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,O),cfId:findHeader(/^x-[\w-]+-cf-id$/,O)}}}catch{}}throw S}},findHeader=(x,C)=>(C.find(([E])=>E.match(x))||[void 0,void 0])[1],serializerMiddleware=(x,C)=>(E,w)=>async T=>{const _=x,S=w.endpointV2?.url&&_.urlParser?async()=>_.urlParser(w.endpointV2.url):_.endpoint;if(!S)throw new Error("No valid endpoint provider available.");const R=await C(T.input,{...x,endpoint:S});return E({...T,request:R})},deserializerMiddlewareOption={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},serializerMiddlewareOption={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSerdePlugin(x,C,E){return{applyToStack:w=>{w.add(deserializerMiddleware(x,E),deserializerMiddlewareOption),w.add(serializerMiddleware(x,C),serializerMiddlewareOption)}}}serializerMiddlewareOption.name;const defaultErrorHandler=x=>C=>{throw C},defaultSuccessHandler=(x,C)=>{},httpSigningMiddleware=x=>(C,E)=>async w=>{if(!HttpRequest.isInstance(w.request))return C(w);const T=getSmithyContext(E).selectedHttpAuthScheme;if(!T)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:_={}},identity:S,signer:R}=T,A=await C({...w,request:await R.sign(w.request,S,_)}).catch((R.errorHandler||defaultErrorHandler)(_));return(R.successHandler||defaultSuccessHandler)(A.response,_),A},httpSigningMiddlewareOptions={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},getHttpSigningPlugin=x=>({applyToStack:C=>{C.addRelativeTo(httpSigningMiddleware(),httpSigningMiddlewareOptions)}}),normalizeProvider=x=>{if(typeof x=="function")return x;const C=Promise.resolve(x);return()=>C},makePagedClientRequest=async(x,C,E,w=_=>_,...T)=>{let _=new x(E);return _=w(_)??_,await C.send(_,...T)};function createPaginator(x,C,E,w,T){return async function*(_,S,...R){const A=S;let O=_.startingToken??A[E],H=!0,ee;for(;H;){if(A[E]=O,A[T]=A[T]??_.pageSize,_.client instanceof x)ee=await makePagedClientRequest(C,_.client,S,_.withCommand,...R);else throw new Error(`Invalid client, expected instance of ${x.name}`);yield ee;const te=O;O=get(ee,w),H=!!(O&&(!_.stopOnSameToken||O!==te))}return void 0}}const get=(x,C)=>{let E=x;const w=C.split(".");for(const T of w){if(!E||typeof E!="object")return;E=E[T]}return E},alphabetByEncoding={},alphabetByValue=new Array(64);for(let x=0,C=65,E=90;x+C<=E;x++){const w=String.fromCharCode(x+C);alphabetByEncoding[w]=x,alphabetByValue[x]=w}for(let x=0,C=97,E=122;x+C<=E;x++){const w=String.fromCharCode(x+C),T=x+26;alphabetByEncoding[w]=T,alphabetByValue[T]=w}for(let x=0;x<10;x++){alphabetByEncoding[x.toString(10)]=x+52;const C=x.toString(10),E=x+52;alphabetByEncoding[C]=E,alphabetByValue[E]=C}alphabetByEncoding["+"]=62;alphabetByValue[62]="+";alphabetByEncoding["/"]=63;alphabetByValue[63]="/";const bitsPerLetter=6,bitsPerByte=8,maxLetterValue=63,fromBase64=x=>{let C=x.length/4*3;x.slice(-2)==="=="?C-=2:x.slice(-1)==="="&&C--;const E=new ArrayBuffer(C),w=new DataView(E);for(let T=0;T<x.length;T+=4){let _=0,S=0;for(let O=T,H=T+3;O<=H;O++)if(x[O]!=="="){if(!(x[O]in alphabetByEncoding))throw new TypeError(`Invalid character ${x[O]} in base64 string.`);_|=alphabetByEncoding[x[O]]<<(H-O)*bitsPerLetter,S+=bitsPerLetter}else _>>=bitsPerLetter;const R=T/4*3;_>>=S%bitsPerByte;const A=Math.floor(S/bitsPerByte);for(let O=0;O<A;O++){const H=(A-O-1)*bitsPerByte;w.setUint8(R+O,(_&255<<H)>>H)}}return new Uint8Array(E)},fromUtf8$5=x=>new TextEncoder().encode(x),toUint8Array=x=>typeof x=="string"?fromUtf8$5(x):ArrayBuffer.isView(x)?new Uint8Array(x.buffer,x.byteOffset,x.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(x),toUtf8$3=x=>{if(typeof x=="string")return x;if(typeof x!="object"||typeof x.byteOffset!="number"||typeof x.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(x)};function toBase64(x){let C;typeof x=="string"?C=fromUtf8$5(x):C=x;const E=typeof C=="object"&&typeof C.length=="number",w=typeof C=="object"&&typeof C.byteOffset=="number"&&typeof C.byteLength=="number";if(!E&&!w)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let T="";for(let _=0;_<C.length;_+=3){let S=0,R=0;for(let O=_,H=Math.min(_+3,C.length);O<H;O++)S|=C[O]<<(H-O-1)*bitsPerByte,R+=bitsPerByte;const A=Math.ceil(R/bitsPerLetter);S<<=A*bitsPerLetter-R;for(let O=1;O<=A;O++){const H=(A-O)*bitsPerLetter;T+=alphabetByValue[(S&maxLetterValue<<H)>>H]}T+="==".slice(0,4-A)}return T}function transformToString(x,C="utf-8"){return C==="base64"?toBase64(x):toUtf8$3(x)}function transformFromString(x,C){return C==="base64"?Uint8ArrayBlobAdapter.mutate(fromBase64(x)):Uint8ArrayBlobAdapter.mutate(fromUtf8$5(x))}class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(C,E="utf-8"){switch(typeof C){case"string":return transformFromString(C,E);default:throw new Error(`Unsupported conversion from ${typeof C} to Uint8ArrayBlobAdapter.`)}}static mutate(C){return Object.setPrototypeOf(C,Uint8ArrayBlobAdapter.prototype),C}transformToString(C="utf-8"){return transformToString(this,C)}}const escapeUri=x=>encodeURIComponent(x).replace(/[!'()*]/g,hexEncode),hexEncode=x=>`%${x.charCodeAt(0).toString(16).toUpperCase()}`;function buildQueryString(x){const C=[];for(let E of Object.keys(x).sort()){const w=x[E];if(E=escapeUri(E),Array.isArray(w))for(let T=0,_=w.length;T<_;T++)C.push(`${E}=${escapeUri(w[T])}`);else{let T=E;(w||typeof w=="string")&&(T+=`=${escapeUri(w)}`),C.push(T)}}return C.join("&")}function createRequest(x,C){return new Request(x,C)}function requestTimeout(x=0){return new Promise((C,E)=>{x&&setTimeout(()=>{const w=new Error(`Request did not complete within ${x} ms`);w.name="TimeoutError",E(w)},x)})}const keepAliveSupport={supported:void 0};class FetchHttpHandler{static create(C){return typeof C?.handle=="function"?C:new FetchHttpHandler(C)}constructor(C){typeof C=="function"?this.configProvider=C().then(E=>E||{}):(this.config=C??{},this.configProvider=Promise.resolve(this.config)),keepAliveSupport.supported===void 0&&(keepAliveSupport.supported=typeof Request<"u"&&"keepalive"in createRequest("https://[::1]"))}destroy(){}async handle(C,{abortSignal:E}={}){this.config||(this.config=await this.configProvider);const w=this.config.requestTimeout,T=this.config.keepAlive===!0,_=this.config.credentials;if(E?.aborted){const le=new Error("Request aborted");return le.name="AbortError",Promise.reject(le)}let S=C.path;const R=buildQueryString(C.query||{});R&&(S+=`?${R}`),C.fragment&&(S+=`#${C.fragment}`);let A="";if(C.username!=null||C.password!=null){const le=C.username??"",fe=C.password??"";A=`${le}:${fe}@`}const{port:O,method:H}=C,ee=`${C.protocol}//${A}${C.hostname}${O?`:${O}`:""}${S}`,te=H==="GET"||H==="HEAD"?void 0:C.body,ie={body:te,headers:new Headers(C.headers),method:H,credentials:_};this.config?.cache&&(ie.cache=this.config.cache),te&&(ie.duplex="half"),typeof AbortController<"u"&&(ie.signal=E),keepAliveSupport.supported&&(ie.keepalive=T),typeof this.config.requestInit=="function"&&Object.assign(ie,this.config.requestInit(C));let ne=()=>{};const ae=createRequest(ee,ie),oe=[fetch(ae).then(le=>{const fe=le.headers,de={};for(const ce of fe.entries())de[ce[0]]=ce[1];return le.body!=null?{response:new HttpResponse({headers:de,reason:le.statusText,statusCode:le.status,body:le.body})}:le.blob().then(ce=>({response:new HttpResponse({headers:de,reason:le.statusText,statusCode:le.status,body:ce})}))}),requestTimeout(w)];return E&&oe.push(new Promise((le,fe)=>{const de=()=>{const ce=new Error("Request aborted");ce.name="AbortError",fe(ce)};if(typeof E.addEventListener=="function"){const ce=E;ce.addEventListener("abort",de,{once:!0}),ne=()=>ce.removeEventListener("abort",de)}else E.onabort=de})),Promise.race(oe).finally(ne)}updateHttpClientConfig(C,E){this.config=void 0,this.configProvider=this.configProvider.then(w=>(w[C]=E,w))}httpHandlerConfigs(){return this.config??{}}}const streamCollector=async x=>typeof Blob=="function"&&x instanceof Blob||x.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await x.arrayBuffer()):collectBlob(x):collectStream(x);async function collectBlob(x){const C=await readToBase64(x),E=fromBase64(C);return new Uint8Array(E)}async function collectStream(x){const C=[],E=x.getReader();let w=!1,T=0;for(;!w;){const{done:R,value:A}=await E.read();A&&(C.push(A),T+=A.length),w=R}const _=new Uint8Array(T);let S=0;for(const R of C)_.set(R,S),S+=R.length;return _}function readToBase64(x){return new Promise((C,E)=>{const w=new FileReader;w.onloadend=()=>{if(w.readyState!==2)return E(new Error("Reader aborted too early"));const T=w.result??"",_=T.indexOf(","),S=_>-1?_+1:T.length;C(T.substring(S))},w.onabort=()=>E(new Error("Read aborted")),w.onerror=()=>E(w.error),w.readAsDataURL(x)})}const SHORT_TO_HEX$1={},HEX_TO_SHORT$1={};for(let x=0;x<256;x++){let C=x.toString(16).toLowerCase();C.length===1&&(C=`0${C}`),SHORT_TO_HEX$1[x]=C,HEX_TO_SHORT$1[C]=x}function fromHex$1(x){if(x.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const C=new Uint8Array(x.length/2);for(let E=0;E<x.length;E+=2){const w=x.slice(E,E+2).toLowerCase();if(w in HEX_TO_SHORT$1)C[E/2]=HEX_TO_SHORT$1[w];else throw new Error(`Cannot decode unrecognized sequence ${w} as hexadecimal`)}return C}function toHex$1(x){let C="";for(let E=0;E<x.byteLength;E++)C+=SHORT_TO_HEX$1[x[E]];return C}const collectBody=async(x=new Uint8Array,C)=>{if(x instanceof Uint8Array)return Uint8ArrayBlobAdapter.mutate(x);if(!x)return Uint8ArrayBlobAdapter.mutate(new Uint8Array);const E=C.streamCollector(x);return Uint8ArrayBlobAdapter.mutate(await E)};function extendedEncodeURIComponent(x){return encodeURIComponent(x).replace(/[!'()*]/g,function(C){return"%"+C.charCodeAt(0).toString(16).toUpperCase()})}const resolvedPath=(x,C,E,w,T,_)=>{if(C!=null&&C[E]!==void 0){const S=w();if(S.length<=0)throw new Error("Empty value provided for input HTTP label: "+E+".");x=x.replace(T,_?S.split("/").map(R=>extendedEncodeURIComponent(R)).join("/"):extendedEncodeURIComponent(S))}else throw new Error("No value provided for input HTTP label: "+E+".");return x};function requestBuilder(x,C){return new RequestBuilder(x,C)}class RequestBuilder{constructor(C,E){this.input=C,this.context=E,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){const{hostname:C,protocol:E="https",port:w,path:T}=await this.context.endpoint();this.path=T;for(const _ of this.resolvePathStack)_(this.path);return new HttpRequest({protocol:E,hostname:this.hostname||C,port:w,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(C){return this.hostname=C,this}bp(C){return this.resolvePathStack.push(E=>{this.path=`${E?.endsWith("/")?E.slice(0,-1):E||""}`+C}),this}p(C,E,w,T){return this.resolvePathStack.push(_=>{this.path=resolvedPath(_,this.input,C,E,w,T)}),this}h(C){return this.headers=C,this}q(C){return this.query=C,this}b(C){return this.body=C,this}m(C){return this.method=C,this}}function setFeature$1(x,C,E){x.__smithy_context?x.__smithy_context.features||(x.__smithy_context.features={}):x.__smithy_context={features:{}},x.__smithy_context.features[C]=E}class DefaultIdentityProviderConfig{constructor(C){this.authSchemes=new Map;for(const[E,w]of Object.entries(C))w!==void 0&&this.authSchemes.set(E,w)}getIdentityProvider(C){return this.authSchemes.get(C)}}const createIsIdentityExpiredFunction=x=>C=>doesIdentityRequireRefresh(C)&&C.expiration.getTime()-Date.now()<x,EXPIRATION_MS=3e5,isIdentityExpired=createIsIdentityExpiredFunction(EXPIRATION_MS),doesIdentityRequireRefresh=x=>x.expiration!==void 0,memoizeIdentityProvider=(x,C,E)=>{if(x===void 0)return;const w=typeof x!="function"?async()=>Promise.resolve(x):x;let T,_,S,R=!1;const A=async O=>{_||(_=w(O));try{T=await _,S=!0,R=!1}finally{_=void 0}return T};return C===void 0?async O=>((!S||O?.forceRefresh)&&(T=await A(O)),T):async O=>((!S||O?.forceRefresh)&&(T=await A(O)),R?T:E(T)?(C(T)&&await A(O),T):(R=!0,T))},DEFAULT_UA_APP_ID=void 0;function isValidUserAgentAppId(x){return x===void 0?!0:typeof x=="string"&&x.length<=50}function resolveUserAgentConfig(x){const C=normalizeProvider(x.userAgentAppId??DEFAULT_UA_APP_ID),{customUserAgent:E}=x;return Object.assign(x,{customUserAgent:typeof E=="string"?[[E]]:E,userAgentAppId:async()=>{const w=await C();if(!isValidUserAgentAppId(w)){const T=x.logger?.constructor?.name==="NoOpLogger"||!x.logger?console:x.logger;typeof w!="string"?T?.warn("userAgentAppId must be a string or undefined."):w.length>50&&T?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return w}})}class EndpointCache{constructor({size:C,params:E}){this.data=new Map,this.parameters=[],this.capacity=C??50,E&&(this.parameters=E)}get(C,E){const w=this.hash(C);if(w===!1)return E();if(!this.data.has(w)){if(this.data.size>this.capacity+10){const T=this.data.keys();let _=0;for(;;){const{value:S,done:R}=T.next();if(this.data.delete(S),R||++_>10)break}}this.data.set(w,E())}return this.data.get(w)}size(){return this.data.size}hash(C){let E="";const{parameters:w}=this;if(w.length===0)return!1;for(const T of w){const _=String(C[T]??"");if(_.includes("|;"))return!1;E+=_+"|;"}return E}}const IP_V4_REGEX=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),isIpAddress=x=>IP_V4_REGEX.test(x)||x.startsWith("[")&&x.endsWith("]"),VALID_HOST_LABEL_REGEX=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel=(x,C=!1)=>{if(!C)return VALID_HOST_LABEL_REGEX.test(x);const E=x.split(".");for(const w of E)if(!isValidHostLabel(w))return!1;return!0},customEndpointFunctions={},debugId="endpoints";function toDebugString(x){return typeof x!="object"||x==null?x:"ref"in x?`$${toDebugString(x.ref)}`:"fn"in x?`${x.fn}(${(x.argv||[]).map(toDebugString).join(", ")})`:JSON.stringify(x,null,2)}class EndpointError extends Error{constructor(C){super(C),this.name="EndpointError"}}const booleanEquals=(x,C)=>x===C,getAttrPathList=x=>{const C=x.split("."),E=[];for(const w of C){const T=w.indexOf("[");if(T!==-1){if(w.indexOf("]")!==w.length-1)throw new EndpointError(`Path: '${x}' does not end with ']'`);const _=w.slice(T+1,-1);if(Number.isNaN(parseInt(_)))throw new EndpointError(`Invalid array index: '${_}' in path: '${x}'`);T!==0&&E.push(w.slice(0,T)),E.push(_)}else E.push(w)}return E},getAttr=(x,C)=>getAttrPathList(C).reduce((E,w)=>{if(typeof E!="object")throw new EndpointError(`Index '${w}' in '${C}' not found in '${JSON.stringify(x)}'`);return Array.isArray(E)?E[parseInt(w)]:E[w]},x),isSet=x=>x!=null,not=x=>!x,DEFAULT_PORTS={[EndpointURLScheme.HTTP]:80,[EndpointURLScheme.HTTPS]:443},parseURL=x=>{const C=(()=>{try{if(x instanceof URL)return x;if(typeof x=="object"&&"hostname"in x){const{hostname:te,port:ie,protocol:ne="",path:ae="",query:oe={}}=x,le=new URL(`${ne}//${te}${ie?`:${ie}`:""}${ae}`);return le.search=Object.entries(oe).map(([fe,de])=>`${fe}=${de}`).join("&"),le}return new URL(x)}catch{return null}})();if(!C)return console.error(`Unable to parse ${JSON.stringify(x)} as a whatwg URL.`),null;const E=C.href,{host:w,hostname:T,pathname:_,protocol:S,search:R}=C;if(R)return null;const A=S.slice(0,-1);if(!Object.values(EndpointURLScheme).includes(A))return null;const O=isIpAddress(T),H=E.includes(`${w}:${DEFAULT_PORTS[A]}`)||typeof x=="string"&&x.includes(`${w}:${DEFAULT_PORTS[A]}`),ee=`${w}${H?`:${DEFAULT_PORTS[A]}`:""}`;return{scheme:A,authority:ee,path:_,normalizedPath:_.endsWith("/")?_:`${_}/`,isIp:O}},stringEquals=(x,C)=>x===C,substring=(x,C,E,w)=>C>=E||x.length<E?null:w?x.substring(x.length-E,x.length-C):x.substring(C,E),uriEncode=x=>encodeURIComponent(x).replace(/[!*'()]/g,C=>`%${C.charCodeAt(0).toString(16).toUpperCase()}`),endpointFunctions={booleanEquals,getAttr,isSet,isValidHostLabel,not,parseURL,stringEquals,substring,uriEncode},evaluateTemplate=(x,C)=>{const E=[],w={...C.endpointParams,...C.referenceRecord};let T=0;for(;T<x.length;){const _=x.indexOf("{",T);if(_===-1){E.push(x.slice(T));break}E.push(x.slice(T,_));const S=x.indexOf("}",_);if(S===-1){E.push(x.slice(_));break}x[_+1]==="{"&&x[S+1]==="}"&&(E.push(x.slice(_+1,S)),T=S+2);const R=x.substring(_+1,S);if(R.includes("#")){const[A,O]=R.split("#");E.push(getAttr(w[A],O))}else E.push(w[R]);T=S+1}return E.join("")},getReferenceValue=({ref:x},C)=>({...C.endpointParams,...C.referenceRecord})[x],evaluateExpression=(x,C,E)=>{if(typeof x=="string")return evaluateTemplate(x,E);if(x.fn)return callFunction(x,E);if(x.ref)return getReferenceValue(x,E);throw new EndpointError(`'${C}': ${String(x)} is not a string, function or reference.`)},callFunction=({fn:x,argv:C},E)=>{const w=C.map(_=>["boolean","number"].includes(typeof _)?_:evaluateExpression(_,"arg",E)),T=x.split(".");return T[0]in customEndpointFunctions&&T[1]!=null?customEndpointFunctions[T[0]][T[1]](...w):endpointFunctions[x](...w)},evaluateCondition=({assign:x,...C},E)=>{if(x&&x in E.referenceRecord)throw new EndpointError(`'${x}' is already defined in Reference Record.`);const w=callFunction(C,E);return E.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(C)} = ${toDebugString(w)}`),{result:w===""?!0:!!w,...x!=null&&{toAssign:{name:x,value:w}}}},evaluateConditions=(x=[],C)=>{const E={};for(const w of x){const{result:T,toAssign:_}=evaluateCondition(w,{...C,referenceRecord:{...C.referenceRecord,...E}});if(!T)return{result:T};_&&(E[_.name]=_.value,C.logger?.debug?.(`${debugId} assign: ${_.name} := ${toDebugString(_.value)}`))}return{result:!0,referenceRecord:E}},getEndpointHeaders=(x,C)=>Object.entries(x).reduce((E,[w,T])=>({...E,[w]:T.map(_=>{const S=evaluateExpression(_,"Header value entry",C);if(typeof S!="string")throw new EndpointError(`Header '${w}' value '${S}' is not a string`);return S})}),{}),getEndpointProperty=(x,C)=>{if(Array.isArray(x))return x.map(E=>getEndpointProperty(E,C));switch(typeof x){case"string":return evaluateTemplate(x,C);case"object":if(x===null)throw new EndpointError(`Unexpected endpoint property: ${x}`);return getEndpointProperties(x,C);case"boolean":return x;default:throw new EndpointError(`Unexpected endpoint property type: ${typeof x}`)}},getEndpointProperties=(x,C)=>Object.entries(x).reduce((E,[w,T])=>({...E,[w]:getEndpointProperty(T,C)}),{}),getEndpointUrl=(x,C)=>{const E=evaluateExpression(x,"Endpoint URL",C);if(typeof E=="string")try{return new URL(E)}catch(w){throw console.error(`Failed to construct URL with ${E}`,w),w}throw new EndpointError(`Endpoint URL must be a string, got ${typeof E}`)},evaluateEndpointRule=(x,C)=>{const{conditions:E,endpoint:w}=x,{result:T,referenceRecord:_}=evaluateConditions(E,C);if(!T)return;const S={...C,referenceRecord:{...C.referenceRecord,..._}},{url:R,properties:A,headers:O}=w;return C.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(w)}`),{...O!=null&&{headers:getEndpointHeaders(O,S)},...A!=null&&{properties:getEndpointProperties(A,S)},url:getEndpointUrl(R,S)}},evaluateErrorRule=(x,C)=>{const{conditions:E,error:w}=x,{result:T,referenceRecord:_}=evaluateConditions(E,C);if(T)throw new EndpointError(evaluateExpression(w,"Error",{...C,referenceRecord:{...C.referenceRecord,..._}}))},evaluateTreeRule=(x,C)=>{const{conditions:E,rules:w}=x,{result:T,referenceRecord:_}=evaluateConditions(E,C);if(T)return evaluateRules(w,{...C,referenceRecord:{...C.referenceRecord,..._}})},evaluateRules=(x,C)=>{for(const E of x)if(E.type==="endpoint"){const w=evaluateEndpointRule(E,C);if(w)return w}else if(E.type==="error")evaluateErrorRule(E,C);else if(E.type==="tree"){const w=evaluateTreeRule(E,C);if(w)return w}else throw new EndpointError(`Unknown endpoint rule: ${E}`);throw new EndpointError("Rules evaluation failed")},resolveEndpoint=(x,C)=>{const{endpointParams:E,logger:w}=C,{parameters:T,rules:_}=x;C.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(E)}`);const S=Object.entries(T).filter(([,O])=>O.default!=null).map(([O,H])=>[O,H.default]);if(S.length>0)for(const[O,H]of S)E[O]=E[O]??H;const R=Object.entries(T).filter(([,O])=>O.required).map(([O])=>O);for(const O of R)if(E[O]==null)throw new EndpointError(`Missing required parameter: '${O}'`);const A=evaluateRules(_,{endpointParams:E,logger:w,referenceRecord:{}});return C.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(A)}`),A},isVirtualHostableS3Bucket=(x,C=!1)=>{if(C){for(const E of x.split("."))if(!isVirtualHostableS3Bucket(E))return!1;return!0}return!(!isValidHostLabel(x)||x.length<3||x.length>63||x!==x.toLowerCase()||isIpAddress(x))},ARN_DELIMITER=":",RESOURCE_DELIMITER="/",parseArn=x=>{const C=x.split(ARN_DELIMITER);if(C.length<6)return null;const[E,w,T,_,S,...R]=C;if(E!=="arn"||w===""||T===""||R.join(ARN_DELIMITER)==="")return null;const A=R.map(O=>O.split(RESOURCE_DELIMITER)).flat();return{partition:w,service:T,region:_,accountId:S,resourceId:A}},partitions=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"AWS ISOE (Europe) global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"AWS ISOF global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"amazonaws.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}}],partitionsInfo={partitions};let selectedPartitionsInfo=partitionsInfo;const partition=x=>{const{partitions:C}=selectedPartitionsInfo;for(const w of C){const{regions:T,outputs:_}=w;for(const[S,R]of Object.entries(T))if(S===x)return{..._,...R}}for(const w of C){const{regionRegex:T,outputs:_}=w;if(new RegExp(T).test(x))return{..._}}const E=C.find(w=>w.id==="aws");if(!E)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...E.outputs}},awsEndpointFunctions={isVirtualHostableS3Bucket,parseArn,partition};customEndpointFunctions.aws=awsEndpointFunctions;function setCredentialFeature(x,C,E){return x.$source||(x.$source={}),x.$source[C]=E,x}function setFeature(x,C,E){x.__aws_sdk_context?x.__aws_sdk_context.features||(x.__aws_sdk_context.features={}):x.__aws_sdk_context={features:{}},x.__aws_sdk_context.features[C]=E}const getDateHeader=x=>HttpResponse.isInstance(x)?x.headers?.date??x.headers?.Date:void 0,getSkewCorrectedDate=x=>new Date(Date.now()+x),isClockSkewed=(x,C)=>Math.abs(getSkewCorrectedDate(C).getTime()-x)>=3e5,getUpdatedSystemClockOffset=(x,C)=>{const E=Date.parse(x);return isClockSkewed(E,C)?E-Date.now():C},throwSigningPropertyError=(x,C)=>{if(!C)throw new Error(`Property \`${x}\` is not resolved for AWS SDK SigV4Auth`);return C},validateSigningProperties=async x=>{const C=throwSigningPropertyError("context",x.context),E=throwSigningPropertyError("config",x.config),w=C.endpointV2?.properties?.authSchemes?.[0],T=await throwSigningPropertyError("signer",E.signer)(w),_=x?.signingRegion,S=x?.signingRegionSet,R=x?.signingName;return{config:E,signer:T,signingRegion:_,signingRegionSet:S,signingName:R}};class AwsSdkSigV4Signer{async sign(C,E,w){if(!HttpRequest.isInstance(C))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const T=await validateSigningProperties(w),{config:_,signer:S}=T;let{signingRegion:R,signingName:A}=T;const O=w.context;if(O?.authSchemes?.length??!1){const[H,ee]=O.authSchemes;H?.name==="sigv4a"&&ee?.name==="sigv4"&&(R=ee?.signingRegion??R,A=ee?.signingName??A)}return await S.sign(C,{signingDate:getSkewCorrectedDate(_.systemClockOffset),signingRegion:R,signingService:A})}errorHandler(C){return E=>{const w=E.ServerTime??getDateHeader(E.$response);if(w){const T=throwSigningPropertyError("config",C.config),_=T.systemClockOffset;T.systemClockOffset=getUpdatedSystemClockOffset(w,T.systemClockOffset),T.systemClockOffset!==_&&E.$metadata&&(E.$metadata.clockSkewCorrected=!0)}throw E}}successHandler(C,E){const w=getDateHeader(C);if(w){const T=throwSigningPropertyError("config",E.config);T.systemClockOffset=getUpdatedSystemClockOffset(w,T.systemClockOffset)}}}const memoize=(x,C,E)=>{let w,T,_,S=!1;const R=async()=>{T||(T=x());try{w=await T,_=!0,S=!1}finally{T=void 0}return w};return async A=>((!_||A?.forceRefresh)&&(w=await R()),w)},ALGORITHM_QUERY_PARAM="X-Amz-Algorithm",CREDENTIAL_QUERY_PARAM="X-Amz-Credential",AMZ_DATE_QUERY_PARAM="X-Amz-Date",SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders",EXPIRES_QUERY_PARAM="X-Amz-Expires",SIGNATURE_QUERY_PARAM="X-Amz-Signature",TOKEN_QUERY_PARAM="X-Amz-Security-Token",AUTH_HEADER="authorization",AMZ_DATE_HEADER=AMZ_DATE_QUERY_PARAM.toLowerCase(),DATE_HEADER="date",GENERATED_HEADERS=[AUTH_HEADER,AMZ_DATE_HEADER,DATE_HEADER],SIGNATURE_HEADER=SIGNATURE_QUERY_PARAM.toLowerCase(),SHA256_HEADER="x-amz-content-sha256",TOKEN_HEADER=TOKEN_QUERY_PARAM.toLowerCase(),ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},PROXY_HEADER_PATTERN=/^proxy-/,SEC_HEADER_PATTERN=/^sec-/,ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256",EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD",UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD",MAX_CACHE_SIZE=50,KEY_TYPE_IDENTIFIER="aws4_request",MAX_PRESIGNED_TTL=60*60*24*7,signingKeyCache={},cacheQueue=[],createScope=(x,C,E)=>`${x}/${C}/${E}/${KEY_TYPE_IDENTIFIER}`,getSigningKey=async(x,C,E,w,T)=>{const _=await hmac(x,C.secretAccessKey,C.accessKeyId),S=`${E}:${w}:${T}:${toHex$1(_)}:${C.sessionToken}`;if(S in signingKeyCache)return signingKeyCache[S];for(cacheQueue.push(S);cacheQueue.length>MAX_CACHE_SIZE;)delete signingKeyCache[cacheQueue.shift()];let R=`AWS4${C.secretAccessKey}`;for(const A of[E,w,T,KEY_TYPE_IDENTIFIER])R=await hmac(x,R,A);return signingKeyCache[S]=R},hmac=(x,C,E)=>{const w=new x(C);return w.update(toUint8Array(E)),w.digest()},getCanonicalHeaders=({headers:x},C,E)=>{const w={};for(const T of Object.keys(x).sort()){if(x[T]==null)continue;const _=T.toLowerCase();(_ in ALWAYS_UNSIGNABLE_HEADERS||C?.has(_)||PROXY_HEADER_PATTERN.test(_)||SEC_HEADER_PATTERN.test(_))&&(!E||E&&!E.has(_))||(w[_]=x[T].trim().replace(/\s+/g," "))}return w},isArrayBuffer=x=>typeof ArrayBuffer=="function"&&x instanceof ArrayBuffer||Object.prototype.toString.call(x)==="[object ArrayBuffer]",getPayloadHash=async({headers:x,body:C},E)=>{for(const w of Object.keys(x))if(w.toLowerCase()===SHA256_HEADER)return x[w];if(C==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof C=="string"||ArrayBuffer.isView(C)||isArrayBuffer(C)){const w=new E;return w.update(toUint8Array(C)),toHex$1(await w.digest())}return UNSIGNED_PAYLOAD};class HeaderFormatter{format(C){const E=[];for(const _ of Object.keys(C)){const S=fromUtf8$5(_);E.push(Uint8Array.from([S.byteLength]),S,this.formatHeaderValue(C[_]))}const w=new Uint8Array(E.reduce((_,S)=>_+S.byteLength,0));let T=0;for(const _ of E)w.set(_,T),T+=_.byteLength;return w}formatHeaderValue(C){switch(C.type){case"boolean":return Uint8Array.from([C.value?0:1]);case"byte":return Uint8Array.from([2,C.value]);case"short":const E=new DataView(new ArrayBuffer(3));return E.setUint8(0,3),E.setInt16(1,C.value,!1),new Uint8Array(E.buffer);case"integer":const w=new DataView(new ArrayBuffer(5));return w.setUint8(0,4),w.setInt32(1,C.value,!1),new Uint8Array(w.buffer);case"long":const T=new Uint8Array(9);return T[0]=5,T.set(C.value.bytes,1),T;case"binary":const _=new DataView(new ArrayBuffer(3+C.value.byteLength));_.setUint8(0,6),_.setUint16(1,C.value.byteLength,!1);const S=new Uint8Array(_.buffer);return S.set(C.value,3),S;case"string":const R=fromUtf8$5(C.value),A=new DataView(new ArrayBuffer(3+R.byteLength));A.setUint8(0,7),A.setUint16(1,R.byteLength,!1);const O=new Uint8Array(A.buffer);return O.set(R,3),O;case"timestamp":const H=new Uint8Array(9);return H[0]=8,H.set(Int64.fromNumber(C.value.valueOf()).bytes,1),H;case"uuid":if(!UUID_PATTERN.test(C.value))throw new Error(`Invalid UUID received: ${C.value}`);const ee=new Uint8Array(17);return ee[0]=9,ee.set(fromHex$1(C.value.replace(/\-/g,"")),1),ee}}}var HEADER_VALUE_TYPE;(function(x){x[x.boolTrue=0]="boolTrue",x[x.boolFalse=1]="boolFalse",x[x.byte=2]="byte",x[x.short=3]="short",x[x.integer=4]="integer",x[x.long=5]="long",x[x.byteArray=6]="byteArray",x[x.string=7]="string",x[x.timestamp=8]="timestamp",x[x.uuid=9]="uuid"})(HEADER_VALUE_TYPE||(HEADER_VALUE_TYPE={}));const UUID_PATTERN=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Int64{constructor(C){if(this.bytes=C,C.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(C){if(C>9223372036854776e3||C<-9223372036854776e3)throw new Error(`${C} is too large (or, if negative, too small) to represent as an Int64`);const E=new Uint8Array(8);for(let w=7,T=Math.abs(Math.round(C));w>-1&&T>0;w--,T/=256)E[w]=T;return C<0&&negate(E),new Int64(E)}valueOf(){const C=this.bytes.slice(0),E=C[0]&128;return E&&negate(C),parseInt(toHex$1(C),16)*(E?-1:1)}toString(){return String(this.valueOf())}}function negate(x){for(let C=0;C<8;C++)x[C]^=255;for(let C=7;C>-1&&(x[C]++,x[C]===0);C--);}const hasHeader=(x,C)=>{x=x.toLowerCase();for(const E of Object.keys(C))if(x===E.toLowerCase())return!0;return!1},moveHeadersToQuery=(x,C={})=>{const{headers:E,query:w={}}=HttpRequest.clone(x);for(const T of Object.keys(E)){const _=T.toLowerCase();(_.slice(0,6)==="x-amz-"&&!C.unhoistableHeaders?.has(_)||C.hoistableHeaders?.has(_))&&(w[T]=E[T],delete E[T])}return{...x,headers:E,query:w}},prepareRequest=x=>{x=HttpRequest.clone(x);for(const C of Object.keys(x.headers))GENERATED_HEADERS.indexOf(C.toLowerCase())>-1&&delete x.headers[C];return x},getCanonicalQuery=({query:x={}})=>{const C=[],E={};for(const w of Object.keys(x)){if(w.toLowerCase()===SIGNATURE_HEADER)continue;const T=escapeUri(w);C.push(T);const _=x[w];typeof _=="string"?E[T]=`${T}=${escapeUri(_)}`:Array.isArray(_)&&(E[T]=_.slice(0).reduce((S,R)=>S.concat([`${T}=${escapeUri(R)}`]),[]).sort().join("&"))}return C.sort().map(w=>E[w]).filter(w=>w).join("&")},iso8601=x=>toDate(x).toISOString().replace(/\.\d{3}Z$/,"Z"),toDate=x=>typeof x=="number"?new Date(x*1e3):typeof x=="string"?Number(x)?new Date(Number(x)*1e3):new Date(x):x;class SignatureV4Base{constructor({applyChecksum:C,credentials:E,region:w,service:T,sha256:_,uriEscapePath:S=!0}){this.service=T,this.sha256=_,this.uriEscapePath=S,this.applyChecksum=typeof C=="boolean"?C:!0,this.regionProvider=normalizeProvider$1(w),this.credentialProvider=normalizeProvider$1(E)}createCanonicalRequest(C,E,w){const T=Object.keys(E).sort();return`${C.method}
${this.getCanonicalPath(C)}
${getCanonicalQuery(C)}
${T.map(_=>`${_}:${E[_]}`).join(`
`)}

${T.join(";")}
${w}`}async createStringToSign(C,E,w,T){const _=new this.sha256;_.update(toUint8Array(w));const S=await _.digest();return`${T}
${C}
${E}
${toHex$1(S)}`}getCanonicalPath({path:C}){if(this.uriEscapePath){const E=[];for(const T of C.split("/"))T?.length!==0&&T!=="."&&(T===".."?E.pop():E.push(T));const w=`${C?.startsWith("/")?"/":""}${E.join("/")}${E.length>0&&C?.endsWith("/")?"/":""}`;return escapeUri(w).replace(/%2F/g,"/")}return C}validateResolvedCredentials(C){if(typeof C!="object"||typeof C.accessKeyId!="string"||typeof C.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(C){const E=iso8601(C).replace(/[\-:]/g,"");return{longDate:E,shortDate:E.slice(0,8)}}getCanonicalHeaderList(C){return Object.keys(C).sort().join(";")}}class SignatureV4 extends SignatureV4Base{constructor({applyChecksum:C,credentials:E,region:w,service:T,sha256:_,uriEscapePath:S=!0}){super({applyChecksum:C,credentials:E,region:w,service:T,sha256:_,uriEscapePath:S}),this.headerFormatter=new HeaderFormatter}async presign(C,E={}){const{signingDate:w=new Date,expiresIn:T=3600,unsignableHeaders:_,unhoistableHeaders:S,signableHeaders:R,hoistableHeaders:A,signingRegion:O,signingService:H}=E,ee=await this.credentialProvider();this.validateResolvedCredentials(ee);const te=O??await this.regionProvider(),{longDate:ie,shortDate:ne}=this.formatDate(w);if(T>MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const ae=createScope(ne,te,H??this.service),oe=moveHeadersToQuery(prepareRequest(C),{unhoistableHeaders:S,hoistableHeaders:A});ee.sessionToken&&(oe.query[TOKEN_QUERY_PARAM]=ee.sessionToken),oe.query[ALGORITHM_QUERY_PARAM]=ALGORITHM_IDENTIFIER,oe.query[CREDENTIAL_QUERY_PARAM]=`${ee.accessKeyId}/${ae}`,oe.query[AMZ_DATE_QUERY_PARAM]=ie,oe.query[EXPIRES_QUERY_PARAM]=T.toString(10);const le=getCanonicalHeaders(oe,_,R);return oe.query[SIGNED_HEADERS_QUERY_PARAM]=this.getCanonicalHeaderList(le),oe.query[SIGNATURE_QUERY_PARAM]=await this.getSignature(ie,ae,this.getSigningKey(ee,te,ne,H),this.createCanonicalRequest(oe,le,await getPayloadHash(C,this.sha256))),oe}async sign(C,E){return typeof C=="string"?this.signString(C,E):C.headers&&C.payload?this.signEvent(C,E):C.message?this.signMessage(C,E):this.signRequest(C,E)}async signEvent({headers:C,payload:E},{signingDate:w=new Date,priorSignature:T,signingRegion:_,signingService:S}){const R=_??await this.regionProvider(),{shortDate:A,longDate:O}=this.formatDate(w),H=createScope(A,R,S??this.service),ee=await getPayloadHash({headers:{},body:E},this.sha256),te=new this.sha256;te.update(C);const ie=toHex$1(await te.digest()),ne=[EVENT_ALGORITHM_IDENTIFIER,O,H,T,ie,ee].join(`
`);return this.signString(ne,{signingDate:w,signingRegion:R,signingService:S})}async signMessage(C,{signingDate:E=new Date,signingRegion:w,signingService:T}){return this.signEvent({headers:this.headerFormatter.format(C.message.headers),payload:C.message.body},{signingDate:E,signingRegion:w,signingService:T,priorSignature:C.priorSignature}).then(_=>({message:C.message,signature:_}))}async signString(C,{signingDate:E=new Date,signingRegion:w,signingService:T}={}){const _=await this.credentialProvider();this.validateResolvedCredentials(_);const S=w??await this.regionProvider(),{shortDate:R}=this.formatDate(E),A=new this.sha256(await this.getSigningKey(_,S,R,T));return A.update(toUint8Array(C)),toHex$1(await A.digest())}async signRequest(C,{signingDate:E=new Date,signableHeaders:w,unsignableHeaders:T,signingRegion:_,signingService:S}={}){const R=await this.credentialProvider();this.validateResolvedCredentials(R);const A=_??await this.regionProvider(),O=prepareRequest(C),{longDate:H,shortDate:ee}=this.formatDate(E),te=createScope(ee,A,S??this.service);O.headers[AMZ_DATE_HEADER]=H,R.sessionToken&&(O.headers[TOKEN_HEADER]=R.sessionToken);const ie=await getPayloadHash(O,this.sha256);!hasHeader(SHA256_HEADER,O.headers)&&this.applyChecksum&&(O.headers[SHA256_HEADER]=ie);const ne=getCanonicalHeaders(O,T,w),ae=await this.getSignature(H,te,this.getSigningKey(R,A,ee,S),this.createCanonicalRequest(O,ne,ie));return O.headers[AUTH_HEADER]=`${ALGORITHM_IDENTIFIER} Credential=${R.accessKeyId}/${te}, SignedHeaders=${this.getCanonicalHeaderList(ne)}, Signature=${ae}`,O}async getSignature(C,E,w,T){const _=await this.createStringToSign(C,E,T,ALGORITHM_IDENTIFIER),S=new this.sha256(await w);return S.update(toUint8Array(_)),toHex$1(await S.digest())}getSigningKey(C,E,w,T){return getSigningKey(this.sha256,C,w,E,T||this.service)}}const resolveAwsSdkSigV4Config=x=>{let C=x.credentials,E=!!x.credentials,w;Object.defineProperty(x,"credentials",{set(A){A&&A!==C&&A!==w&&(E=!0),C=A;const O=normalizeCredentialProvider(x,{credentials:C,credentialDefaultProvider:x.credentialDefaultProvider}),H=bindCallerConfig(x,O);E&&!H.attributed?(w=async ee=>H(ee).then(te=>setCredentialFeature(te,"CREDENTIALS_CODE","e")),w.memoized=H.memoized,w.configBound=H.configBound,w.attributed=!0):w=H},get(){return w},enumerable:!0,configurable:!0}),x.credentials=C;const{signingEscapePath:T=!0,systemClockOffset:_=x.systemClockOffset||0,sha256:S}=x;let R;return x.signer?R=normalizeProvider(x.signer):x.regionInfoProvider?R=()=>normalizeProvider(x.region)().then(async A=>[await x.regionInfoProvider(A,{useFipsEndpoint:await x.useFipsEndpoint(),useDualstackEndpoint:await x.useDualstackEndpoint()})||{},A]).then(([A,O])=>{const{signingRegion:H,signingService:ee}=A;x.signingRegion=x.signingRegion||H||O,x.signingName=x.signingName||ee||x.serviceId;const te={...x,credentials:x.credentials,region:x.signingRegion,service:x.signingName,sha256:S,uriEscapePath:T},ie=x.signerConstructor||SignatureV4;return new ie(te)}):R=async A=>{A=Object.assign({},{name:"sigv4",signingName:x.signingName||x.defaultSigningName,signingRegion:await normalizeProvider(x.region)(),properties:{}},A);const O=A.signingRegion,H=A.signingName;x.signingRegion=x.signingRegion||O,x.signingName=x.signingName||H||x.serviceId;const ee={...x,credentials:x.credentials,region:x.signingRegion,service:x.signingName,sha256:S,uriEscapePath:T},te=x.signerConstructor||SignatureV4;return new te(ee)},Object.assign(x,{systemClockOffset:_,signingEscapePath:T,signer:R})};function normalizeCredentialProvider(x,{credentials:C,credentialDefaultProvider:E}){let w;return C?C?.memoized?w=C:w=memoizeIdentityProvider(C,isIdentityExpired,doesIdentityRequireRefresh):E?w=normalizeProvider(E(Object.assign({},x,{parentClientConfig:x}))):w=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},w.memoized=!0,w}function bindCallerConfig(x,C){if(C.configBound)return C;const E=async w=>C({...w,callerClientConfig:x});return E.memoized=C.memoized,E.configBound=!0,E}const getAllAliases=(x,C)=>{const E=[];if(x&&E.push(x),C)for(const w of C)E.push(w);return E},getMiddlewareNameWithAliases=(x,C)=>`${x||"anonymous"}${C&&C.length>0?` (a.k.a. ${C.join(",")})`:""}`,constructStack=()=>{let x=[],C=[],E=!1;const w=new Set,T=ee=>ee.sort((te,ie)=>stepWeights[ie.step]-stepWeights[te.step]||priorityWeights[ie.priority||"normal"]-priorityWeights[te.priority||"normal"]),_=ee=>{let te=!1;const ie=ne=>{const ae=getAllAliases(ne.name,ne.aliases);if(ae.includes(ee)){te=!0;for(const oe of ae)w.delete(oe);return!1}return!0};return x=x.filter(ie),C=C.filter(ie),te},S=ee=>{let te=!1;const ie=ne=>{if(ne.middleware===ee){te=!0;for(const ae of getAllAliases(ne.name,ne.aliases))w.delete(ae);return!1}return!0};return x=x.filter(ie),C=C.filter(ie),te},R=ee=>(x.forEach(te=>{ee.add(te.middleware,{...te})}),C.forEach(te=>{ee.addRelativeTo(te.middleware,{...te})}),ee.identifyOnResolve?.(H.identifyOnResolve()),ee),A=ee=>{const te=[];return ee.before.forEach(ie=>{ie.before.length===0&&ie.after.length===0?te.push(ie):te.push(...A(ie))}),te.push(ee),ee.after.reverse().forEach(ie=>{ie.before.length===0&&ie.after.length===0?te.push(ie):te.push(...A(ie))}),te},O=(ee=!1)=>{const te=[],ie=[],ne={};return x.forEach(ae=>{const oe={...ae,before:[],after:[]};for(const le of getAllAliases(oe.name,oe.aliases))ne[le]=oe;te.push(oe)}),C.forEach(ae=>{const oe={...ae,before:[],after:[]};for(const le of getAllAliases(oe.name,oe.aliases))ne[le]=oe;ie.push(oe)}),ie.forEach(ae=>{if(ae.toMiddleware){const oe=ne[ae.toMiddleware];if(oe===void 0){if(ee)return;throw new Error(`${ae.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(ae.name,ae.aliases)} middleware ${ae.relation} ${ae.toMiddleware}`)}ae.relation==="after"&&oe.after.push(ae),ae.relation==="before"&&oe.before.push(ae)}}),T(te).map(A).reduce((ae,oe)=>(ae.push(...oe),ae),[])},H={add:(ee,te={})=>{const{name:ie,override:ne,aliases:ae}=te,oe={step:"initialize",priority:"normal",middleware:ee,...te},le=getAllAliases(ie,ae);if(le.length>0){if(le.some(fe=>w.has(fe))){if(!ne)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(ie,ae)}'`);for(const fe of le){const de=x.findIndex(pe=>pe.name===fe||pe.aliases?.some(he=>he===fe));if(de===-1)continue;const ce=x[de];if(ce.step!==oe.step||oe.priority!==ce.priority)throw new Error(`"${getMiddlewareNameWithAliases(ce.name,ce.aliases)}" middleware with ${ce.priority} priority in ${ce.step} step cannot be overridden by "${getMiddlewareNameWithAliases(ie,ae)}" middleware with ${oe.priority} priority in ${oe.step} step.`);x.splice(de,1)}}for(const fe of le)w.add(fe)}x.push(oe)},addRelativeTo:(ee,te)=>{const{name:ie,override:ne,aliases:ae}=te,oe={middleware:ee,...te},le=getAllAliases(ie,ae);if(le.length>0){if(le.some(fe=>w.has(fe))){if(!ne)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(ie,ae)}'`);for(const fe of le){const de=C.findIndex(pe=>pe.name===fe||pe.aliases?.some(he=>he===fe));if(de===-1)continue;const ce=C[de];if(ce.toMiddleware!==oe.toMiddleware||ce.relation!==oe.relation)throw new Error(`"${getMiddlewareNameWithAliases(ce.name,ce.aliases)}" middleware ${ce.relation} "${ce.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(ie,ae)}" middleware ${oe.relation} "${oe.toMiddleware}" middleware.`);C.splice(de,1)}}for(const fe of le)w.add(fe)}C.push(oe)},clone:()=>R(constructStack()),use:ee=>{ee.applyToStack(H)},remove:ee=>typeof ee=="string"?_(ee):S(ee),removeByTag:ee=>{let te=!1;const ie=ne=>{const{tags:ae,name:oe,aliases:le}=ne;if(ae&&ae.includes(ee)){const fe=getAllAliases(oe,le);for(const de of fe)w.delete(de);return te=!0,!1}return!0};return x=x.filter(ie),C=C.filter(ie),te},concat:ee=>{const te=R(constructStack());return te.use(ee),te.identifyOnResolve(E||te.identifyOnResolve()||(ee.identifyOnResolve?.()??!1)),te},applyToStack:R,identify:()=>O(!0).map(ee=>{const te=ee.step??ee.relation+" "+ee.toMiddleware;return getMiddlewareNameWithAliases(ee.name,ee.aliases)+" - "+te}),identifyOnResolve(ee){return typeof ee=="boolean"&&(E=ee),E},resolve:(ee,te)=>{for(const ie of O().map(ne=>ne.middleware).reverse())ee=ie(ee,te);return E&&console.log(H.identify()),ee}};return H},stepWeights={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},priorityWeights={high:3,normal:2,low:1};class Client{constructor(C){this.config=C,this.middlewareStack=constructStack()}send(C,E,w){const T=typeof E!="function"?E:void 0,_=typeof E=="function"?E:w,S=T===void 0&&this.config.cacheMiddleware===!0;let R;if(S){this.handlers||(this.handlers=new WeakMap);const A=this.handlers;A.has(C.constructor)?R=A.get(C.constructor):(R=C.resolveMiddleware(this.middlewareStack,this.config,T),A.set(C.constructor,R))}else delete this.handlers,R=C.resolveMiddleware(this.middlewareStack,this.config,T);if(_)R(C).then(A=>_(null,A.output),A=>_(A)).catch(()=>{});else return R(C).then(A=>A.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}class Command{constructor(){this.middlewareStack=constructStack()}static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(C,E,w,{middlewareFn:T,clientName:_,commandName:S,inputFilterSensitiveLog:R,outputFilterSensitiveLog:A,smithyContext:O,additionalContext:H,CommandCtor:ee}){for(const oe of T.bind(this)(ee,C,E,w))this.middlewareStack.use(oe);const te=C.concat(this.middlewareStack),{logger:ie}=E,ne={logger:ie,clientName:_,commandName:S,inputFilterSensitiveLog:R,outputFilterSensitiveLog:A,[SMITHY_CONTEXT_KEY]:{commandInstance:this,...O},...H},{requestHandler:ae}=E;return te.resolve(oe=>ae.handle(oe.request,w||{}),ne)}}class ClassBuilder{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=C=>C,this._outputFilterSensitiveLog=C=>C,this._serializer=null,this._deserializer=null}init(C){this._init=C}ep(C){return this._ep=C,this}m(C){return this._middlewareFn=C,this}s(C,E,w={}){return this._smithyContext={service:C,operation:E,...w},this}c(C={}){return this._additionalContext=C,this}n(C,E){return this._clientName=C,this._commandName=E,this}f(C=w=>w,E=w=>w){return this._inputFilterSensitiveLog=C,this._outputFilterSensitiveLog=E,this}ser(C){return this._serializer=C,this}de(C){return this._deserializer=C,this}build(){const C=this;let E;return E=class extends Command{static getEndpointParameterInstructions(){return C._ep}constructor(...[w]){super(),this.serialize=C._serializer,this.deserialize=C._deserializer,this.input=w??{},C._init(this)}resolveMiddleware(w,T,_){return this.resolveMiddlewareWithContext(w,T,_,{CommandCtor:E,middlewareFn:C._middlewareFn,clientName:C._clientName,commandName:C._commandName,inputFilterSensitiveLog:C._inputFilterSensitiveLog,outputFilterSensitiveLog:C._outputFilterSensitiveLog,smithyContext:C._smithyContext,additionalContext:C._additionalContext})}}}}const SENSITIVE_STRING="***SensitiveInformation***",createAggregatedClient=(x,C)=>{for(const E of Object.keys(x)){const w=x[E],T=async function(S,R,A){const O=new w(S);if(typeof R=="function")this.send(O,R);else if(typeof A=="function"){if(typeof R!="object")throw new Error(`Expected http options but got ${typeof R}`);this.send(O,R||{},A)}else return this.send(O,R)},_=(E[0].toLowerCase()+E.slice(1)).replace(/Command$/,"");C.prototype[_]=T}},expectBoolean=x=>{if(x!=null){if(typeof x=="number"){if((x===0||x===1)&&logger.warn(stackTraceWarning(`Expected boolean, got ${typeof x}: ${x}`)),x===0)return!1;if(x===1)return!0}if(typeof x=="string"){const C=x.toLowerCase();if((C==="false"||C==="true")&&logger.warn(stackTraceWarning(`Expected boolean, got ${typeof x}: ${x}`)),C==="false")return!1;if(C==="true")return!0}if(typeof x=="boolean")return x;throw new TypeError(`Expected boolean, got ${typeof x}: ${x}`)}},expectNumber=x=>{if(x!=null){if(typeof x=="string"){const C=parseFloat(x);if(!Number.isNaN(C))return String(C)!==String(x)&&logger.warn(stackTraceWarning(`Expected number but observed string: ${x}`)),C}if(typeof x=="number")return x;throw new TypeError(`Expected number, got ${typeof x}: ${x}`)}},expectNonNull=(x,C)=>{if(x==null)throw C?new TypeError(`Expected a non-null value for ${C}`):new TypeError("Expected a non-null value");return x},expectObject=x=>{if(x==null)return;if(typeof x=="object"&&!Array.isArray(x))return x;const C=Array.isArray(x)?"array":typeof x;throw new TypeError(`Expected object, got ${C}: ${x}`)},expectString=x=>{if(x!=null){if(typeof x=="string")return x;if(["boolean","number","bigint"].includes(typeof x))return logger.warn(stackTraceWarning(`Expected string, got ${typeof x}: ${x}`)),String(x);throw new TypeError(`Expected string, got ${typeof x}: ${x}`)}},strictParseDouble=x=>expectNumber(typeof x=="string"?parseNumber(x):x),NUMBER_REGEX=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,parseNumber=x=>{const C=x.match(NUMBER_REGEX);if(C===null||C[0].length!==x.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(x)},stackTraceWarning=x=>String(new TypeError(x).stack||x).split(`
`).slice(0,5).filter(C=>!C.includes("stackTraceWarning")).join(`
`),logger={warn:console.warn},parseEpochTimestamp=x=>{if(x==null)return;let C;if(typeof x=="number")C=x;else if(typeof x=="string")C=strictParseDouble(x);else if(typeof x=="object"&&x.tag===1)C=x.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(C)||C===1/0||C===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(C*1e3))};class ServiceException extends Error{constructor(C){super(C.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=C.name,this.$fault=C.$fault,this.$metadata=C.$metadata}static isInstance(C){if(!C)return!1;const E=C;return ServiceException.prototype.isPrototypeOf(E)||!!E.$fault&&!!E.$metadata&&(E.$fault==="client"||E.$fault==="server")}static[Symbol.hasInstance](C){if(!C)return!1;const E=C;return this===ServiceException?ServiceException.isInstance(C):ServiceException.isInstance(C)?E.name&&this.name?this.prototype.isPrototypeOf(C)||E.name===this.name:this.prototype.isPrototypeOf(C):!1}}const decorateServiceException=(x,C={})=>{Object.entries(C).filter(([,w])=>w!==void 0).forEach(([w,T])=>{(x[w]==null||x[w]==="")&&(x[w]=T)});const E=x.message||x.Message||"UnknownError";return x.message=E,delete x.Message,x},throwDefaultError$1=({output:x,parsedBody:C,exceptionCtor:E,errorCode:w})=>{const T=deserializeMetadata$1(x),_=T.httpStatusCode?T.httpStatusCode+"":void 0,S=new E({name:C?.code||C?.Code||w||_||"UnknownError",$fault:"client",$metadata:T});throw decorateServiceException(S,C)},withBaseException=x=>({output:C,parsedBody:E,errorCode:w})=>{throwDefaultError$1({output:C,parsedBody:E,exceptionCtor:x,errorCode:w})},deserializeMetadata$1=x=>({httpStatusCode:x.statusCode,requestId:x.headers["x-amzn-requestid"]??x.headers["x-amzn-request-id"]??x.headers["x-amz-request-id"],extendedRequestId:x.headers["x-amz-id-2"],cfId:x.headers["x-amz-cf-id"]}),loadConfigsForDefaultMode=x=>{switch(x){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},getChecksumConfiguration=x=>{const C=[];for(const E in AlgorithmId){const w=AlgorithmId[E];x[w]!==void 0&&C.push({algorithmId:()=>w,checksumConstructor:()=>x[w]})}return{addChecksumAlgorithm(E){C.push(E)},checksumAlgorithms(){return C}}},resolveChecksumRuntimeConfig=x=>{const C={};return x.checksumAlgorithms().forEach(E=>{C[E.algorithmId()]=E.checksumConstructor()}),C},getRetryConfiguration=x=>({setRetryStrategy(C){x.retryStrategy=C},retryStrategy(){return x.retryStrategy}}),resolveRetryRuntimeConfig=x=>{const C={};return C.retryStrategy=x.retryStrategy(),C},getDefaultExtensionConfiguration=x=>Object.assign(getChecksumConfiguration(x),getRetryConfiguration(x)),resolveDefaultRuntimeConfig=x=>Object.assign(resolveChecksumRuntimeConfig(x),resolveRetryRuntimeConfig(x)),isSerializableHeaderValue=x=>x!=null;let NoOpLogger$1=class{trace(){}debug(){}info(){}warn(){}error(){}};function map(x,C,E){let w,T,_;if(typeof C>"u"&&typeof E>"u")w={},_=x;else{if(w=x,typeof C=="function")return T=C,_=E,mapWithFilter(w,T,_);_=C}for(const S of Object.keys(_)){if(!Array.isArray(_[S])){w[S]=_[S];continue}applyInstruction(w,null,_,S)}return w}const take=(x,C)=>{const E={};for(const w in C)applyInstruction(E,x,C,w);return E},mapWithFilter=(x,C,E)=>map(x,Object.entries(E).reduce((w,[T,_])=>(Array.isArray(_)?w[T]=_:typeof _=="function"?w[T]=[C,_()]:w[T]=[C,_],w),{})),applyInstruction=(x,C,E,w)=>{if(C!==null){let S=E[w];typeof S=="function"&&(S=[,S]);const[R=nonNullish,A=pass,O=w]=S;(typeof R=="function"&&R(C[O])||typeof R!="function"&&R)&&(x[w]=A(C[O]));return}let[T,_]=E[w];if(typeof _=="function"){let S;const R=T===void 0&&(S=_())!=null,A=typeof T=="function"&&!!T(void 0)||typeof T!="function"&&!!T;R?x[w]=S:A&&(x[w]=_())}else{const S=T===void 0&&_!=null,R=typeof T=="function"&&!!T(_)||typeof T!="function"&&!!T;(S||R)&&(x[w]=_)}},nonNullish=x=>x!=null,pass=x=>x,serializeDateTime=x=>x.toISOString().replace(".000Z","Z"),_json=x=>{if(x==null)return{};if(Array.isArray(x))return x.filter(C=>C!=null).map(_json);if(typeof x=="object"){const C={};for(const E of Object.keys(x))x[E]!=null&&(C[E]=_json(x[E]));return C}return x},collectBodyString=(x,C)=>collectBody(x,C).then(E=>C.utf8Encoder(E)),parseJsonBody=(x,C)=>collectBodyString(x,C).then(E=>{if(E.length)try{return JSON.parse(E)}catch(w){throw w?.name==="SyntaxError"&&Object.defineProperty(w,"$responseBodyText",{value:E}),w}return{}}),parseJsonErrorBody=async(x,C)=>{const E=await parseJsonBody(x,C);return E.message=E.message??E.Message,E},loadRestJsonErrorCode=(x,C)=>{const E=(_,S)=>Object.keys(_).find(R=>R.toLowerCase()===S.toLowerCase()),w=_=>{let S=_;return typeof S=="number"&&(S=S.toString()),S.indexOf(",")>=0&&(S=S.split(",")[0]),S.indexOf(":")>=0&&(S=S.split(":")[0]),S.indexOf("#")>=0&&(S=S.split("#")[1]),S},T=E(x.headers,"x-amzn-errortype");if(T!==void 0)return w(x.headers[T]);if(C.code!==void 0)return w(C.code);if(C.__type!==void 0)return w(C.__type)},ACCOUNT_ID_ENDPOINT_REGEX=/\d{12}\.ddb/;async function checkFeatures(x,C,E){if(E.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&setFeature(x,"PROTOCOL_RPC_V2_CBOR","M"),typeof C.retryStrategy=="function"){const T=await C.retryStrategy();typeof T.acquireInitialRetryToken=="function"?T.constructor?.name?.includes("Adaptive")?setFeature(x,"RETRY_MODE_ADAPTIVE","F"):setFeature(x,"RETRY_MODE_STANDARD","E"):setFeature(x,"RETRY_MODE_LEGACY","D")}if(typeof C.accountIdEndpointMode=="function"){const T=x.endpointV2;switch(String(T?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)&&setFeature(x,"ACCOUNT_ID_ENDPOINT","O"),await C.accountIdEndpointMode?.()){case"disabled":setFeature(x,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":setFeature(x,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":setFeature(x,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const w=x.__smithy_context?.selectedHttpAuthScheme?.identity;if(w?.$source){const T=w;T.accountId&&setFeature(x,"RESOLVED_ACCOUNT_ID","T");for(const[_,S]of Object.entries(T.$source??{}))setFeature(x,_,S)}}const USER_AGENT="user-agent",X_AMZ_USER_AGENT="x-amz-user-agent",SPACE=" ",UA_NAME_SEPARATOR="/",UA_NAME_ESCAPE_REGEX=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,UA_VALUE_ESCAPE_REGEX=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,UA_ESCAPE_CHAR="-",BYTE_LIMIT=1024;function encodeFeatures(x){let C="";for(const E in x){const w=x[E];if(C.length+w.length+1<=BYTE_LIMIT){C.length?C+=","+w:C+=w;continue}break}return C}const userAgentMiddleware=x=>(C,E)=>async w=>{const{request:T}=w;if(!HttpRequest.isInstance(T))return C(w);const{headers:_}=T,S=E?.userAgent?.map(escapeUserAgent)||[],R=(await x.defaultUserAgentProvider()).map(escapeUserAgent);await checkFeatures(E,x,w);const A=E;R.push(`m/${encodeFeatures(Object.assign({},E.__smithy_context?.features,A.__aws_sdk_context?.features))}`);const O=x?.customUserAgent?.map(escapeUserAgent)||[],H=await x.userAgentAppId();H&&R.push(escapeUserAgent([`app/${H}`]));const ee=[].concat([...R,...S,...O]).join(SPACE),te=[...R.filter(ie=>ie.startsWith("aws-sdk-")),...O].join(SPACE);return x.runtime!=="browser"?(te&&(_[X_AMZ_USER_AGENT]=_[X_AMZ_USER_AGENT]?`${_[USER_AGENT]} ${te}`:te),_[USER_AGENT]=ee):_[X_AMZ_USER_AGENT]=ee,C({...w,request:T})},escapeUserAgent=x=>{const C=x[0].split(UA_NAME_SEPARATOR).map(S=>S.replace(UA_NAME_ESCAPE_REGEX,UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR),E=x[1]?.replace(UA_VALUE_ESCAPE_REGEX,UA_ESCAPE_CHAR),w=C.indexOf(UA_NAME_SEPARATOR),T=C.substring(0,w);let _=C.substring(w+1);return T==="api"&&(_=_.toLowerCase()),[T,_,E].filter(S=>S&&S.length>0).reduce((S,R,A)=>{switch(A){case 0:return R;case 1:return`${S}/${R}`;default:return`${S}#${R}`}},"")},getUserAgentMiddlewareOptions={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},getUserAgentPlugin=x=>({applyToStack:C=>{C.add(userAgentMiddleware(x),getUserAgentMiddlewareOptions)}});var SelectorType;(function(x){x.ENV="env",x.CONFIG="shared config entry"})(SelectorType||(SelectorType={}));const DEFAULT_USE_DUALSTACK_ENDPOINT=!1,DEFAULT_USE_FIPS_ENDPOINT=!1,isFipsRegion=x=>typeof x=="string"&&(x.startsWith("fips-")||x.endsWith("-fips")),getRealRegion=x=>isFipsRegion(x)?["fips-aws-global","aws-fips"].includes(x)?"us-east-1":x.replace(/fips-(dkr-|prod-)?|-fips/,""):x,resolveRegionConfig=x=>{const{region:C,useFipsEndpoint:E}=x;if(!C)throw new Error("Region is missing");return Object.assign(x,{region:async()=>{if(typeof C=="string")return getRealRegion(C);const w=await C();return getRealRegion(w)},useFipsEndpoint:async()=>{const w=typeof C=="string"?C:await C();return isFipsRegion(w)?!0:typeof E!="function"?Promise.resolve(!!E):E()}})},CONTENT_LENGTH_HEADER="content-length";function contentLengthMiddleware(x){return C=>async E=>{const w=E.request;if(HttpRequest.isInstance(w)){const{body:T,headers:_}=w;if(T&&Object.keys(_).map(S=>S.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER)===-1)try{const S=x(T);w.headers={...w.headers,[CONTENT_LENGTH_HEADER]:String(S)}}catch{}}return C({...E,request:w})}}const contentLengthMiddlewareOptions={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},getContentLengthPlugin=x=>({applyToStack:C=>{C.add(contentLengthMiddleware(x.bodyLengthChecker),contentLengthMiddlewareOptions)}}),resolveParamsForS3=async x=>{const C=x?.Bucket||"";if(typeof x.Bucket=="string"&&(x.Bucket=C.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName(C)){if(x.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!isDnsCompatibleBucketName(C)||C.indexOf(".")!==-1&&!String(x.Endpoint).startsWith("http:")||C.toLowerCase()!==C||C.length<3)&&(x.ForcePathStyle=!0);return x.DisableMultiRegionAccessPoints&&(x.disableMultiRegionAccessPoints=!0,x.DisableMRAP=!0),x},DOMAIN_PATTERN=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,IP_ADDRESS_PATTERN=/(\d+\.){3}\d+/,DOTS_PATTERN=/\.\./,isDnsCompatibleBucketName=x=>DOMAIN_PATTERN.test(x)&&!IP_ADDRESS_PATTERN.test(x)&&!DOTS_PATTERN.test(x),isArnBucketName=x=>{const[C,E,w,,,T]=x.split(":"),_=C==="arn"&&x.split(":").length>=6,S=!!(_&&E&&w&&T);if(_&&!S)throw new Error(`Invalid ARN: ${x} was an invalid ARN.`);return S},createConfigValueProvider=(x,C,E)=>{const w=async()=>{const T=E[x]??E[C];return typeof T=="function"?T():T};return x==="credentialScope"||C==="CredentialScope"?async()=>{const T=typeof E.credentials=="function"?await E.credentials():E.credentials;return T?.credentialScope??T?.CredentialScope}:x==="accountId"||C==="AccountId"?async()=>{const T=typeof E.credentials=="function"?await E.credentials():E.credentials;return T?.accountId??T?.AccountId}:x==="endpoint"||C==="endpoint"?async()=>{const T=await w();if(T&&typeof T=="object"){if("url"in T)return T.url.href;if("hostname"in T){const{protocol:_,hostname:S,port:R,path:A}=T;return`${_}//${S}${R?":"+R:""}${A}`}}return T}:w},getEndpointFromConfig=async x=>{};function parseQueryString(x){const C={};if(x=x.replace(/^\?/,""),x)for(const E of x.split("&")){let[w,T=null]=E.split("=");w=decodeURIComponent(w),T&&(T=decodeURIComponent(T)),w in C?Array.isArray(C[w])?C[w].push(T):C[w]=[C[w],T]:C[w]=T}return C}const parseUrl=x=>{if(typeof x=="string")return parseUrl(new URL(x));const{hostname:C,pathname:E,port:w,protocol:T,search:_}=x;let S;return _&&(S=parseQueryString(_)),{hostname:C,port:w?parseInt(w):void 0,protocol:T,path:E,query:S}},toEndpointV1=x=>typeof x=="object"?"url"in x?parseUrl(x.url):x:parseUrl(x),getEndpointFromInstructions=async(x,C,E,w)=>{if(!E.endpoint){let _;E.serviceConfiguredEndpoint?_=await E.serviceConfiguredEndpoint():_=await getEndpointFromConfig(E.serviceId),_&&(E.endpoint=()=>Promise.resolve(toEndpointV1(_)))}const T=await resolveParams(x,C,E);if(typeof E.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return E.endpointProvider(T,w)},resolveParams=async(x,C,E)=>{const w={},T=C?.getEndpointParameterInstructions?.()||{};for(const[_,S]of Object.entries(T))switch(S.type){case"staticContextParams":w[_]=S.value;break;case"contextParams":w[_]=x[S.name];break;case"clientContextParams":case"builtInParams":w[_]=await createConfigValueProvider(S.name,_,E)();break;case"operationContextParams":w[_]=S.get(x);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(S))}return Object.keys(T).length===0&&Object.assign(w,E),String(E.serviceId).toLowerCase()==="s3"&&await resolveParamsForS3(w),w},endpointMiddleware=({config:x,instructions:C})=>(E,w)=>async T=>{x.endpoint&&setFeature$1(w,"ENDPOINT_OVERRIDE","N");const _=await getEndpointFromInstructions(T.input,{getEndpointParameterInstructions(){return C}},{...x},w);w.endpointV2=_,w.authSchemes=_.properties?.authSchemes;const S=w.authSchemes?.[0];if(S){w.signing_region=S.signingRegion,w.signing_service=S.signingName;const R=getSmithyContext(w)?.selectedHttpAuthScheme?.httpAuthOption;R&&(R.signingProperties=Object.assign(R.signingProperties||{},{signing_region:S.signingRegion,signingRegion:S.signingRegion,signing_service:S.signingName,signingName:S.signingName,signingRegionSet:S.signingRegionSet},S.properties))}return E({...T})},endpointMiddlewareOptions={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:serializerMiddlewareOption.name},getEndpointPlugin=(x,C)=>({applyToStack:E=>{E.addRelativeTo(endpointMiddleware({config:x,instructions:C}),endpointMiddlewareOptions)}}),resolveEndpointConfig=x=>{const C=x.tls??!0,{endpoint:E,useDualstackEndpoint:w,useFipsEndpoint:T}=x,_=E!=null?async()=>toEndpointV1(await normalizeProvider$1(E)()):void 0,S=Object.assign(x,{endpoint:_,tls:C,isCustomEndpoint:!!E,useDualstackEndpoint:normalizeProvider$1(w??!1),useFipsEndpoint:normalizeProvider$1(T??!1)});let R;return S.serviceConfiguredEndpoint=async()=>(x.serviceId&&!R&&(R=getEndpointFromConfig(x.serviceId)),R),S};var RETRY_MODES;(function(x){x.STANDARD="standard",x.ADAPTIVE="adaptive"})(RETRY_MODES||(RETRY_MODES={}));const DEFAULT_MAX_ATTEMPTS=3,DEFAULT_RETRY_MODE=RETRY_MODES.STANDARD,THROTTLING_ERROR_CODES=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],TRANSIENT_ERROR_CODES=["TimeoutError","RequestTimeout","RequestTimeoutException"],TRANSIENT_ERROR_STATUS_CODES=[500,502,503,504],NODEJS_TIMEOUT_ERROR_CODES=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],isClockSkewCorrectedError=x=>x.$metadata?.clockSkewCorrected,isBrowserNetworkError=x=>{const C=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return x&&x instanceof TypeError?C.has(x.message):!1},isThrottlingError=x=>x.$metadata?.httpStatusCode===429||THROTTLING_ERROR_CODES.includes(x.name)||x.$retryable?.throttling==!0,isTransientError=(x,C=0)=>isClockSkewCorrectedError(x)||TRANSIENT_ERROR_CODES.includes(x.name)||NODEJS_TIMEOUT_ERROR_CODES.includes(x?.code||"")||TRANSIENT_ERROR_STATUS_CODES.includes(x.$metadata?.httpStatusCode||0)||isBrowserNetworkError(x)||x.cause!==void 0&&C<=10&&isTransientError(x.cause,C+1),isServerError=x=>{if(x.$metadata?.httpStatusCode!==void 0){const C=x.$metadata.httpStatusCode;return 500<=C&&C<=599&&!isTransientError(x)}return!1};class DefaultRateLimiter{constructor(C){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=C?.beta??.7,this.minCapacity=C?.minCapacity??1,this.minFillRate=C?.minFillRate??.5,this.scaleConstant=C?.scaleConstant??.4,this.smooth=C?.smooth??.8;const E=this.getCurrentTimeInSeconds();this.lastThrottleTime=E,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(C){if(this.enabled){if(this.refillTokenBucket(),C>this.currentCapacity){const E=(C-this.currentCapacity)/this.fillRate*1e3;await new Promise(w=>DefaultRateLimiter.setTimeoutFn(w,E))}this.currentCapacity=this.currentCapacity-C}}refillTokenBucket(){const C=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=C;return}const E=(C-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+E),this.lastTimestamp=C}updateClientSendingRate(C){let E;if(this.updateMeasuredRate(),isThrottlingError(C)){const T=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=T,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),E=this.cubicThrottle(T),this.enableTokenBucket()}else this.calculateTimeWindow(),E=this.cubicSuccess(this.getCurrentTimeInSeconds());const w=Math.min(E,2*this.measuredTxRate);this.updateTokenBucketRate(w)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(C){return this.getPrecise(C*this.beta)}cubicSuccess(C){return this.getPrecise(this.scaleConstant*Math.pow(C-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(C){this.refillTokenBucket(),this.fillRate=Math.max(C,this.minFillRate),this.maxCapacity=Math.max(C,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const C=this.getCurrentTimeInSeconds(),E=Math.floor(C*2)/2;if(this.requestCount++,E>this.lastTxRateBucket){const w=this.requestCount/(E-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(w*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=E}}getPrecise(C){return parseFloat(C.toFixed(8))}}DefaultRateLimiter.setTimeoutFn=setTimeout;const DEFAULT_RETRY_DELAY_BASE=100,MAXIMUM_RETRY_DELAY=20*1e3,THROTTLING_RETRY_DELAY_BASE=500,INITIAL_RETRY_TOKENS=500,RETRY_COST=5,TIMEOUT_RETRY_COST=10,NO_RETRY_INCREMENT=1,INVOCATION_ID_HEADER="amz-sdk-invocation-id",REQUEST_HEADER="amz-sdk-request",getDefaultRetryBackoffStrategy=()=>{let x=DEFAULT_RETRY_DELAY_BASE;return{computeNextBackoffDelay:C=>Math.floor(Math.min(MAXIMUM_RETRY_DELAY,Math.random()*2**C*x)),setDelayBase:C=>{x=C}}},createDefaultRetryToken=({retryDelay:x,retryCount:C,retryCost:E})=>({getRetryCount:()=>C,getRetryDelay:()=>Math.min(MAXIMUM_RETRY_DELAY,x),getRetryCost:()=>E});class StandardRetryStrategy{constructor(C){this.maxAttempts=C,this.mode=RETRY_MODES.STANDARD,this.capacity=INITIAL_RETRY_TOKENS,this.retryBackoffStrategy=getDefaultRetryBackoffStrategy(),this.maxAttemptsProvider=typeof C=="function"?C:async()=>C}async acquireInitialRetryToken(C){return createDefaultRetryToken({retryDelay:DEFAULT_RETRY_DELAY_BASE,retryCount:0})}async refreshRetryTokenForRetry(C,E){const w=await this.getMaxAttempts();if(this.shouldRetry(C,E,w)){const T=E.errorType;this.retryBackoffStrategy.setDelayBase(T==="THROTTLING"?THROTTLING_RETRY_DELAY_BASE:DEFAULT_RETRY_DELAY_BASE);const _=this.retryBackoffStrategy.computeNextBackoffDelay(C.getRetryCount()),S=E.retryAfterHint?Math.max(E.retryAfterHint.getTime()-Date.now()||0,_):_,R=this.getCapacityCost(T);return this.capacity-=R,createDefaultRetryToken({retryDelay:S,retryCount:C.getRetryCount()+1,retryCost:R})}throw new Error("No retry token available")}recordSuccess(C){this.capacity=Math.max(INITIAL_RETRY_TOKENS,this.capacity+(C.getRetryCost()??NO_RETRY_INCREMENT))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`),DEFAULT_MAX_ATTEMPTS}}shouldRetry(C,E,w){return C.getRetryCount()+1<w&&this.capacity>=this.getCapacityCost(E.errorType)&&this.isRetryableError(E.errorType)}getCapacityCost(C){return C==="TRANSIENT"?TIMEOUT_RETRY_COST:RETRY_COST}isRetryableError(C){return C==="THROTTLING"||C==="TRANSIENT"}}class AdaptiveRetryStrategy{constructor(C,E){this.maxAttemptsProvider=C,this.mode=RETRY_MODES.ADAPTIVE;const{rateLimiter:w}=E??{};this.rateLimiter=w??new DefaultRateLimiter,this.standardRetryStrategy=new StandardRetryStrategy(C)}async acquireInitialRetryToken(C){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(C)}async refreshRetryTokenForRetry(C,E){return this.rateLimiter.updateClientSendingRate(E),this.standardRetryStrategy.refreshRetryTokenForRetry(C,E)}recordSuccess(C){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(C)}}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const byteToHex=[];for(let x=0;x<256;++x)byteToHex.push((x+256).toString(16).slice(1));function unsafeStringify(x,C=0){return byteToHex[x[C+0]]+byteToHex[x[C+1]]+byteToHex[x[C+2]]+byteToHex[x[C+3]]+"-"+byteToHex[x[C+4]]+byteToHex[x[C+5]]+"-"+byteToHex[x[C+6]]+byteToHex[x[C+7]]+"-"+byteToHex[x[C+8]]+byteToHex[x[C+9]]+"-"+byteToHex[x[C+10]]+byteToHex[x[C+11]]+byteToHex[x[C+12]]+byteToHex[x[C+13]]+byteToHex[x[C+14]]+byteToHex[x[C+15]]}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(x,C,E){if(native.randomUUID&&!x)return native.randomUUID();x=x||{};const w=x.random||(x.rng||rng)();return w[6]=w[6]&15|64,w[8]=w[8]&63|128,unsafeStringify(w)}const asSdkError=x=>x instanceof Error?x:x instanceof Object?Object.assign(new Error,x):typeof x=="string"?new Error(x):new Error(`AWS SDK error wrapper for ${x}`),resolveRetryConfig=x=>{const{retryStrategy:C,retryMode:E,maxAttempts:w}=x,T=normalizeProvider$1(w??DEFAULT_MAX_ATTEMPTS);return Object.assign(x,{maxAttempts:T,retryStrategy:async()=>C||(await normalizeProvider$1(E)()===RETRY_MODES.ADAPTIVE?new AdaptiveRetryStrategy(T):new StandardRetryStrategy(T))})},isStreamingPayload=x=>x?.body instanceof ReadableStream,retryMiddleware=x=>(C,E)=>async w=>{let T=await x.retryStrategy();const _=await x.maxAttempts();if(isRetryStrategyV2(T)){T=T;let S=await T.acquireInitialRetryToken(E.partition_id),R=new Error,A=0,O=0;const{request:H}=w,ee=HttpRequest.isInstance(H);for(ee&&(H.headers[INVOCATION_ID_HEADER]=v4());;)try{ee&&(H.headers[REQUEST_HEADER]=`attempt=${A+1}; max=${_}`);const{response:te,output:ie}=await C(w);return T.recordSuccess(S),ie.$metadata.attempts=A+1,ie.$metadata.totalRetryDelay=O,{response:te,output:ie}}catch(te){const ie=getRetryErrorInfo(te);if(R=asSdkError(te),ee&&isStreamingPayload(H))throw(E.logger instanceof NoOpLogger$1?console:E.logger)?.warn("An error was encountered in a non-retryable streaming request."),R;try{S=await T.refreshRetryTokenForRetry(S,ie)}catch{throw R.$metadata||(R.$metadata={}),R.$metadata.attempts=A+1,R.$metadata.totalRetryDelay=O,R}A=S.getRetryCount();const ne=S.getRetryDelay();O+=ne,await new Promise(ae=>setTimeout(ae,ne))}}else return T=T,T?.mode&&(E.userAgent=[...E.userAgent||[],["cfg/retry-mode",T.mode]]),T.retry(C,w)},isRetryStrategyV2=x=>typeof x.acquireInitialRetryToken<"u"&&typeof x.refreshRetryTokenForRetry<"u"&&typeof x.recordSuccess<"u",getRetryErrorInfo=x=>{const C={error:x,errorType:getRetryErrorType(x)},E=getRetryAfterHint(x.$response);return E&&(C.retryAfterHint=E),C},getRetryErrorType=x=>isThrottlingError(x)?"THROTTLING":isTransientError(x)?"TRANSIENT":isServerError(x)?"SERVER_ERROR":"CLIENT_ERROR",retryMiddlewareOptions={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryPlugin=x=>({applyToStack:C=>{C.add(retryMiddleware(x),retryMiddlewareOptions)}}),getRetryAfterHint=x=>{if(!HttpResponse.isInstance(x))return;const C=Object.keys(x.headers).find(T=>T.toLowerCase()==="retry-after");if(!C)return;const E=x.headers[C],w=Number(E);return Number.isNaN(w)?new Date(E):new Date(w*1e3)},defaultChimeSDKMessagingHttpAuthSchemeParametersProvider=async(x,C,E)=>({operation:getSmithyContext(C).operation,region:await normalizeProvider$1(x.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(x){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"chime",region:x.region},propertiesExtractor:(C,E)=>({signingProperties:{config:C,context:E}})}}const defaultChimeSDKMessagingHttpAuthSchemeProvider=x=>{const C=[];switch(x.operation){default:C.push(createAwsAuthSigv4HttpAuthOption(x))}return C},resolveHttpAuthSchemeConfig=x=>{const C=resolveAwsSdkSigV4Config(x);return Object.assign(C,{authSchemePreference:normalizeProvider$1(x.authSchemePreference??[])})},resolveClientEndpointParameters=x=>Object.assign(x,{useDualstackEndpoint:x.useDualstackEndpoint??!1,useFipsEndpoint:x.useFipsEndpoint??!1,defaultSigningName:"chime"}),commonParams={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},version="3.810.0",packageInfo={version},fromUtf8$4=x=>new TextEncoder().encode(x);var fromUtf8$3=typeof Buffer<"u"&&Buffer.from?function(x){return Buffer.from(x,"utf8")}:fromUtf8$4;function convertToBuffer$1(x){return x instanceof Uint8Array?x:typeof x=="string"?fromUtf8$3(x):ArrayBuffer.isView(x)?new Uint8Array(x.buffer,x.byteOffset,x.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(x)}function isEmptyData$1(x){return typeof x=="string"?x.length===0:x.byteLength===0}var SHA_256_HASH={name:"SHA-256"},SHA_256_HMAC_ALGO={name:"HMAC",hash:SHA_256_HASH},EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const fallbackWindow={};function locateWindow(){return typeof window<"u"?window:typeof self<"u"?self:fallbackWindow}var Sha256$2=function(){function x(C){this.toHash=new Uint8Array(0),this.secret=C,this.reset()}return x.prototype.update=function(C){if(!isEmptyData$1(C)){var E=convertToBuffer$1(C),w=new Uint8Array(this.toHash.byteLength+E.byteLength);w.set(this.toHash,0),w.set(E,this.toHash.byteLength),this.toHash=w}},x.prototype.digest=function(){var C=this;return this.key?this.key.then(function(E){return locateWindow().crypto.subtle.sign(SHA_256_HMAC_ALGO,E,C.toHash).then(function(w){return new Uint8Array(w)})}):isEmptyData$1(this.toHash)?Promise.resolve(EMPTY_DATA_SHA_256):Promise.resolve().then(function(){return locateWindow().crypto.subtle.digest(SHA_256_HASH,C.toHash)}).then(function(E){return Promise.resolve(new Uint8Array(E))})},x.prototype.reset=function(){var C=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(E,w){locateWindow().crypto.subtle.importKey("raw",convertToBuffer$1(C.secret),SHA_256_HMAC_ALGO,!1,["sign"]).then(E,w)}),this.key.catch(function(){}))},x}();function __awaiter$1(x,C,E,w){function T(_){return _ instanceof E?_:new E(function(S){S(_)})}return new(E||(E=Promise))(function(_,S){function R(H){try{O(w.next(H))}catch(ee){S(ee)}}function A(H){try{O(w.throw(H))}catch(ee){S(ee)}}function O(H){H.done?_(H.value):T(H.value).then(R,A)}O((w=w.apply(x,[])).next())})}function __generator$1(x,C){var E={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},w,T,_,S=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return S.next=R(0),S.throw=R(1),S.return=R(2),typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function R(O){return function(H){return A([O,H])}}function A(O){if(w)throw new TypeError("Generator is already executing.");for(;S&&(S=0,O[0]&&(E=0)),E;)try{if(w=1,T&&(_=O[0]&2?T.return:O[0]?T.throw||((_=T.return)&&_.call(T),0):T.next)&&!(_=_.call(T,O[1])).done)return _;switch(T=0,_&&(O=[O[0]&2,_.value]),O[0]){case 0:case 1:_=O;break;case 4:return E.label++,{value:O[1],done:!1};case 5:E.label++,T=O[1],O=[0];continue;case 7:O=E.ops.pop(),E.trys.pop();continue;default:if(_=E.trys,!(_=_.length>0&&_[_.length-1])&&(O[0]===6||O[0]===2)){E=0;continue}if(O[0]===3&&(!_||O[1]>_[0]&&O[1]<_[3])){E.label=O[1];break}if(O[0]===6&&E.label<_[1]){E.label=_[1],_=O;break}if(_&&E.label<_[2]){E.label=_[2],E.ops.push(O);break}_[2]&&E.ops.pop(),E.trys.pop();continue}O=C.call(x,E)}catch(H){O=[6,H],T=0}finally{w=_=0}if(O[0]&5)throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}}var BLOCK_SIZE=64,DIGEST_LENGTH=32,KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],MAX_HASHABLE_LENGTH=Math.pow(2,53)-1,RawSha256$1=function(){function x(){this.state=Int32Array.from(INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return x.prototype.update=function(C){if(this.finished)throw new Error("Attempted to update an already finished hash.");var E=0,w=C.byteLength;if(this.bytesHashed+=w,this.bytesHashed*8>MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;w>0;)this.buffer[this.bufferLength++]=C[E++],w--,this.bufferLength===BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},x.prototype.digest=function(){if(!this.finished){var C=this.bytesHashed*8,E=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),w=this.bufferLength;if(E.setUint8(this.bufferLength++,128),w%BLOCK_SIZE>=BLOCK_SIZE-8){for(var T=this.bufferLength;T<BLOCK_SIZE;T++)E.setUint8(T,0);this.hashBuffer(),this.bufferLength=0}for(var T=this.bufferLength;T<BLOCK_SIZE-8;T++)E.setUint8(T,0);E.setUint32(BLOCK_SIZE-8,Math.floor(C/4294967296),!0),E.setUint32(BLOCK_SIZE-4,C),this.hashBuffer(),this.finished=!0}for(var _=new Uint8Array(DIGEST_LENGTH),T=0;T<8;T++)_[T*4]=this.state[T]>>>24&255,_[T*4+1]=this.state[T]>>>16&255,_[T*4+2]=this.state[T]>>>8&255,_[T*4+3]=this.state[T]>>>0&255;return _},x.prototype.hashBuffer=function(){for(var C=this,E=C.buffer,w=C.state,T=w[0],_=w[1],S=w[2],R=w[3],A=w[4],O=w[5],H=w[6],ee=w[7],te=0;te<BLOCK_SIZE;te++){if(te<16)this.temp[te]=(E[te*4]&255)<<24|(E[te*4+1]&255)<<16|(E[te*4+2]&255)<<8|E[te*4+3]&255;else{var ie=this.temp[te-2],ne=(ie>>>17|ie<<15)^(ie>>>19|ie<<13)^ie>>>10;ie=this.temp[te-15];var ae=(ie>>>7|ie<<25)^(ie>>>18|ie<<14)^ie>>>3;this.temp[te]=(ne+this.temp[te-7]|0)+(ae+this.temp[te-16]|0)}var oe=(((A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&O^~A&H)|0)+(ee+(KEY[te]+this.temp[te]|0)|0)|0,le=((T>>>2|T<<30)^(T>>>13|T<<19)^(T>>>22|T<<10))+(T&_^T&S^_&S)|0;ee=H,H=O,O=A,A=R+oe|0,R=S,S=_,_=T,T=oe+le|0}w[0]+=T,w[1]+=_,w[2]+=S,w[3]+=R,w[4]+=A,w[5]+=O,w[6]+=H,w[7]+=ee},x}(),Sha256$1=function(){function x(C){this.secret=C,this.hash=new RawSha256$1,this.reset()}return x.prototype.update=function(C){if(!(isEmptyData$1(C)||this.error))try{this.hash.update(convertToBuffer$1(C))}catch(E){this.error=E}},x.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},x.prototype.digest=function(){return __awaiter$1(this,void 0,void 0,function(){return __generator$1(this,function(C){return[2,this.digestSync()]})})},x.prototype.reset=function(){if(this.hash=new RawSha256$1,this.secret){this.outer=new RawSha256$1;var C=bufferFromSecret(this.secret),E=new Uint8Array(BLOCK_SIZE);E.set(C);for(var w=0;w<BLOCK_SIZE;w++)C[w]^=54,E[w]^=92;this.hash.update(C),this.outer.update(E);for(var w=0;w<C.byteLength;w++)C[w]=0}},x}();function bufferFromSecret(x){var C=convertToBuffer$1(x);if(C.byteLength>BLOCK_SIZE){var E=new RawSha256$1;E.update(C),C=E.digest()}var w=new Uint8Array(BLOCK_SIZE);return w.set(C),w}var subtleCryptoMethods=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function supportsWebCrypto(x){if(supportsSecureRandom(x)&&typeof x.crypto.subtle=="object"){var C=x.crypto.subtle;return supportsSubtleCrypto(C)}return!1}function supportsSecureRandom(x){if(typeof x=="object"&&typeof x.crypto=="object"){var C=x.crypto.getRandomValues;return typeof C=="function"}return!1}function supportsSubtleCrypto(x){return x&&subtleCryptoMethods.every(function(C){return typeof x[C]=="function"})}var Sha256=function(){function x(C){supportsWebCrypto(locateWindow())?this.hash=new Sha256$2(C):this.hash=new Sha256$1(C)}return x.prototype.update=function(C,E){this.hash.update(convertToBuffer$1(C))},x.prototype.digest=function(){return this.hash.digest()},x.prototype.reset=function(){this.hash.reset()},x}();const BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(C,E){const w=E.match(C);return w&&w.length>0&&w[1]||""}static getSecondMatch(C,E){const w=E.match(C);return w&&w.length>1&&w[2]||""}static matchAndReturnConst(C,E,w){if(C.test(E))return w}static getWindowsVersionName(C){switch(C){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(C){const E=C.split(".").splice(0,2).map(w=>parseInt(w,10)||0);if(E.push(0),E[0]===10)switch(E[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(C){const E=C.split(".").splice(0,2).map(w=>parseInt(w,10)||0);if(E.push(0),!(E[0]===1&&E[1]<5)){if(E[0]===1&&E[1]<6)return"Cupcake";if(E[0]===1&&E[1]>=6)return"Donut";if(E[0]===2&&E[1]<2)return"Eclair";if(E[0]===2&&E[1]===2)return"Froyo";if(E[0]===2&&E[1]>2)return"Gingerbread";if(E[0]===3)return"Honeycomb";if(E[0]===4&&E[1]<1)return"Ice Cream Sandwich";if(E[0]===4&&E[1]<4)return"Jelly Bean";if(E[0]===4&&E[1]>=4)return"KitKat";if(E[0]===5)return"Lollipop";if(E[0]===6)return"Marshmallow";if(E[0]===7)return"Nougat";if(E[0]===8)return"Oreo";if(E[0]===9)return"Pie"}}static getVersionPrecision(C){return C.split(".").length}static compareVersions(C,E,w=!1){const T=Utils.getVersionPrecision(C),_=Utils.getVersionPrecision(E);let S=Math.max(T,_),R=0;const A=Utils.map([C,E],O=>{const H=S-Utils.getVersionPrecision(O),ee=O+new Array(H+1).join(".0");return Utils.map(ee.split("."),te=>new Array(20-te.length).join("0")+te).reverse()});for(w&&(R=S-Math.min(T,_)),S-=1;S>=R;){if(A[0][S]>A[1][S])return 1;if(A[0][S]===A[1][S]){if(S===R)return 0;S-=1}else if(A[0][S]<A[1][S])return-1}}static map(C,E){const w=[];let T;if(Array.prototype.map)return Array.prototype.map.call(C,E);for(T=0;T<C.length;T+=1)w.push(E(C[T]));return w}static find(C,E){let w,T;if(Array.prototype.find)return Array.prototype.find.call(C,E);for(w=0,T=C.length;w<T;w+=1){const _=C[w];if(E(_,w))return _}}static assign(C,...E){const w=C;let T,_;if(Object.assign)return Object.assign(C,...E);for(T=0,_=E.length;T<_;T+=1){const S=E[T];typeof S=="object"&&S!==null&&Object.keys(S).forEach(R=>{w[R]=S[R]})}return C}static getBrowserAlias(C){return BROWSER_ALIASES_MAP[C]}static getBrowserTypeByAlias(C){return BROWSER_MAP[C]||""}}const commonVersionIdentifier=/version\/(\d+(\.?_?\d+)+)/i,browsersList=[{test:[/googlebot/i],describe(x){const C={name:"Googlebot"},E=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/opera/i],describe(x){const C={name:"Opera"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/opr\/|opios/i],describe(x){const C={name:"Opera"},E=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/SamsungBrowser/i],describe(x){const C={name:"Samsung Internet for Android"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/Whale/i],describe(x){const C={name:"NAVER Whale Browser"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/MZBrowser/i],describe(x){const C={name:"MZ Browser"},E=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/focus/i],describe(x){const C={name:"Focus"},E=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/swing/i],describe(x){const C={name:"Swing"},E=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/coast/i],describe(x){const C={name:"Opera Coast"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(x){const C={name:"Opera Touch"},E=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/yabrowser/i],describe(x){const C={name:"Yandex Browser"},E=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/ucbrowser/i],describe(x){const C={name:"UC Browser"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/Maxthon|mxios/i],describe(x){const C={name:"Maxthon"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/epiphany/i],describe(x){const C={name:"Epiphany"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/puffin/i],describe(x){const C={name:"Puffin"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/sleipnir/i],describe(x){const C={name:"Sleipnir"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/k-meleon/i],describe(x){const C={name:"K-Meleon"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/micromessenger/i],describe(x){const C={name:"WeChat"},E=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/qqbrowser/i],describe(x){const C={name:/qqbrowserlite/i.test(x)?"QQ Browser Lite":"QQ Browser"},E=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/msie|trident/i],describe(x){const C={name:"Internet Explorer"},E=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/\sedg\//i],describe(x){const C={name:"Microsoft Edge"},E=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/edg([ea]|ios)/i],describe(x){const C={name:"Microsoft Edge"},E=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/vivaldi/i],describe(x){const C={name:"Vivaldi"},E=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/seamonkey/i],describe(x){const C={name:"SeaMonkey"},E=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/sailfish/i],describe(x){const C={name:"Sailfish"},E=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,x);return E&&(C.version=E),C}},{test:[/silk/i],describe(x){const C={name:"Amazon Silk"},E=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/phantom/i],describe(x){const C={name:"PhantomJS"},E=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/slimerjs/i],describe(x){const C={name:"SlimerJS"},E=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(x){const C={name:"BlackBerry"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/(web|hpw)[o0]s/i],describe(x){const C={name:"WebOS Browser"},E=Utils.getFirstMatch(commonVersionIdentifier,x)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/bada/i],describe(x){const C={name:"Bada"},E=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/tizen/i],describe(x){const C={name:"Tizen"},E=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/qupzilla/i],describe(x){const C={name:"QupZilla"},E=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/firefox|iceweasel|fxios/i],describe(x){const C={name:"Firefox"},E=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/electron/i],describe(x){const C={name:"Electron"},E=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/MiuiBrowser/i],describe(x){const C={name:"Miui"},E=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/chromium/i],describe(x){const C={name:"Chromium"},E=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,x)||Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/chrome|crios|crmo/i],describe(x){const C={name:"Chrome"},E=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/GSA/i],describe(x){const C={name:"Google Search"},E=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test(x){const C=!x.test(/like android/i),E=x.test(/android/i);return C&&E},describe(x){const C={name:"Android Browser"},E=Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/playstation 4/i],describe(x){const C={name:"PlayStation 4"},E=Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/safari|applewebkit/i],describe(x){const C={name:"Safari"},E=Utils.getFirstMatch(commonVersionIdentifier,x);return E&&(C.version=E),C}},{test:[/.*/i],describe(x){const C=/^(.*)\/(.*) /,E=/^(.*)\/(.*)[ \t]\((.*)/,w=x.search("\\(")!==-1?E:C;return{name:Utils.getFirstMatch(w,x),version:Utils.getSecondMatch(w,x)}}}],osParsersList=[{test:[/Roku\/DVP/],describe(x){const C=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,x);return{name:OS_MAP.Roku,version:C}}},{test:[/windows phone/i],describe(x){const C=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,x);return{name:OS_MAP.WindowsPhone,version:C}}},{test:[/windows /i],describe(x){const C=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,x),E=Utils.getWindowsVersionName(C);return{name:OS_MAP.Windows,version:C,versionName:E}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(x){const C={name:OS_MAP.iOS},E=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,x);return E&&(C.version=E),C}},{test:[/macintosh/i],describe(x){const C=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,x).replace(/[_\s]/g,"."),E=Utils.getMacOSVersionName(C),w={name:OS_MAP.MacOS,version:C};return E&&(w.versionName=E),w}},{test:[/(ipod|iphone|ipad)/i],describe(x){const C=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,x).replace(/[_\s]/g,".");return{name:OS_MAP.iOS,version:C}}},{test(x){const C=!x.test(/like android/i),E=x.test(/android/i);return C&&E},describe(x){const C=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,x),E=Utils.getAndroidVersionName(C),w={name:OS_MAP.Android,version:C};return E&&(w.versionName=E),w}},{test:[/(web|hpw)[o0]s/i],describe(x){const C=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,x),E={name:OS_MAP.WebOS};return C&&C.length&&(E.version=C),E}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(x){const C=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,x)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,x)||Utils.getFirstMatch(/\bbb(\d+)/i,x);return{name:OS_MAP.BlackBerry,version:C}}},{test:[/bada/i],describe(x){const C=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,x);return{name:OS_MAP.Bada,version:C}}},{test:[/tizen/i],describe(x){const C=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,x);return{name:OS_MAP.Tizen,version:C}}},{test:[/linux/i],describe(){return{name:OS_MAP.Linux}}},{test:[/CrOS/],describe(){return{name:OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe(x){const C=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,x);return{name:OS_MAP.PlayStation4,version:C}}}],platformParsersList=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(x){const C=Utils.getFirstMatch(/(can-l01)/i,x)&&"Nova",E={type:PLATFORMS_MAP.mobile,vendor:"Huawei"};return C&&(E.model=C),E}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:PLATFORMS_MAP.tablet}}},{test(x){const C=x.test(/ipod|iphone/i),E=x.test(/like (ipod|iphone)/i);return C&&!E},describe(x){const C=Utils.getFirstMatch(/(ipod|iphone)/i,x);return{type:PLATFORMS_MAP.mobile,vendor:"Apple",model:C}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:PLATFORMS_MAP.mobile}}},{test(x){return x.getBrowserName(!0)==="blackberry"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test(x){return x.getBrowserName(!0)==="bada"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(x){return x.getBrowserName()==="windows phone"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test(x){const C=Number(String(x.getOSVersion()).split(".")[0]);return x.getOSName(!0)==="android"&&C>=3},describe(){return{type:PLATFORMS_MAP.tablet}}},{test(x){return x.getOSName(!0)==="android"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(x){return x.getOSName(!0)==="macos"},describe(){return{type:PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test(x){return x.getOSName(!0)==="windows"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(x){return x.getOSName(!0)==="linux"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(x){return x.getOSName(!0)==="playstation 4"},describe(){return{type:PLATFORMS_MAP.tv}}},{test(x){return x.getOSName(!0)==="roku"},describe(){return{type:PLATFORMS_MAP.tv}}}],enginesParsersList=[{test(x){return x.getBrowserName(!0)==="microsoft edge"},describe(x){if(/\sedg\//i.test(x))return{name:ENGINE_MAP.Blink};const C=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,x);return{name:ENGINE_MAP.EdgeHTML,version:C}}},{test:[/trident/i],describe(x){const C={name:ENGINE_MAP.Trident},E=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test(x){return x.test(/presto/i)},describe(x){const C={name:ENGINE_MAP.Presto},E=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test(x){const C=x.test(/gecko/i),E=x.test(/like gecko/i);return C&&!E},describe(x){const C={name:ENGINE_MAP.Gecko},E=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe(x){const C={name:ENGINE_MAP.WebKit},E=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,x);return E&&(C.version=E),C}}];class Parser{constructor(C,E=!1){if(C==null||C==="")throw new Error("UserAgent parameter can't be empty");this._ua=C,this.parsedResult={},E!==!0&&this.parse()}getUA(){return this._ua}test(C){return C.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const C=Utils.find(browsersList,E=>{if(typeof E.test=="function")return E.test(this);if(E.test instanceof Array)return E.test.some(w=>this.test(w));throw new Error("Browser's test function is not valid")});return C&&(this.parsedResult.browser=C.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(C){return C?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const C=Utils.find(osParsersList,E=>{if(typeof E.test=="function")return E.test(this);if(E.test instanceof Array)return E.test.some(w=>this.test(w));throw new Error("Browser's test function is not valid")});return C&&(this.parsedResult.os=C.describe(this.getUA())),this.parsedResult.os}getOSName(C){const{name:E}=this.getOS();return C?String(E).toLowerCase()||"":E||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(C=!1){const{type:E}=this.getPlatform();return C?String(E).toLowerCase()||"":E||""}parsePlatform(){this.parsedResult.platform={};const C=Utils.find(platformParsersList,E=>{if(typeof E.test=="function")return E.test(this);if(E.test instanceof Array)return E.test.some(w=>this.test(w));throw new Error("Browser's test function is not valid")});return C&&(this.parsedResult.platform=C.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(C){return C?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const C=Utils.find(enginesParsersList,E=>{if(typeof E.test=="function")return E.test(this);if(E.test instanceof Array)return E.test.some(w=>this.test(w));throw new Error("Browser's test function is not valid")});return C&&(this.parsedResult.engine=C.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(C){const E={};let w=0;const T={};let _=0;if(Object.keys(C).forEach(S=>{const R=C[S];typeof R=="string"?(T[S]=R,_+=1):typeof R=="object"&&(E[S]=R,w+=1)}),w>0){const S=Object.keys(E),R=Utils.find(S,O=>this.isOS(O));if(R){const O=this.satisfies(E[R]);if(O!==void 0)return O}const A=Utils.find(S,O=>this.isPlatform(O));if(A){const O=this.satisfies(E[A]);if(O!==void 0)return O}}if(_>0){const S=Object.keys(T),R=Utils.find(S,A=>this.isBrowser(A,!0));if(R!==void 0)return this.compareVersion(T[R])}}isBrowser(C,E=!1){const w=this.getBrowserName().toLowerCase();let T=C.toLowerCase();const _=Utils.getBrowserTypeByAlias(T);return E&&_&&(T=_.toLowerCase()),T===w}compareVersion(C){let E=[0],w=C,T=!1;const _=this.getBrowserVersion();if(typeof _=="string")return C[0]===">"||C[0]==="<"?(w=C.substr(1),C[1]==="="?(T=!0,w=C.substr(2)):E=[],C[0]===">"?E.push(1):E.push(-1)):C[0]==="="?w=C.substr(1):C[0]==="~"&&(T=!0,w=C.substr(1)),E.indexOf(Utils.compareVersions(_,w,T))>-1}isOS(C){return this.getOSName(!0)===String(C).toLowerCase()}isPlatform(C){return this.getPlatformType(!0)===String(C).toLowerCase()}isEngine(C){return this.getEngineName(!0)===String(C).toLowerCase()}is(C,E=!1){return this.isBrowser(C,E)||this.isOS(C)||this.isPlatform(C)}some(C=[]){return C.some(E=>this.is(E))}}/*!
 * Bowser - a browser detector
 * https://github.com/lancedikson/bowser
 * MIT License | (c) Dustin Diaz 2012-2015
 * MIT License | (c) Denis Demchenko 2015-2019
 */class Bowser{static getParser(C,E=!1){if(typeof C!="string")throw new Error("UserAgent should be a string");return new Parser(C,E)}static parse(C){return new Parser(C).getResult()}static get BROWSER_MAP(){return BROWSER_MAP}static get ENGINE_MAP(){return ENGINE_MAP}static get OS_MAP(){return OS_MAP}static get PLATFORMS_MAP(){return PLATFORMS_MAP}}const createDefaultUserAgentProvider=({serviceId:x,clientVersion:C})=>async E=>{const w=typeof window<"u"&&window?.navigator?.userAgent?Bowser.parse(window.navigator.userAgent):void 0,T=[["aws-sdk-js",C],["ua","2.1"],[`os/${w?.os?.name||"other"}`,w?.os?.version],["lang/js"],["md/browser",`${w?.browser?.name??"unknown"}_${w?.browser?.version??"unknown"}`]];x&&T.push([`api/${x}`,C]);const _=await E?.userAgentAppId?.();return _&&T.push([`app/${_}`]),T},invalidProvider=x=>()=>Promise.reject(x),TEXT_ENCODER=typeof TextEncoder=="function"?new TextEncoder:null,calculateBodyLength=x=>{if(typeof x=="string"){if(TEXT_ENCODER)return TEXT_ENCODER.encode(x).byteLength;let C=x.length;for(let E=C-1;E>=0;E--){const w=x.charCodeAt(E);w>127&&w<=2047?C++:w>2047&&w<=65535&&(C+=2),w>=56320&&w<=57343&&E--}return C}else{if(typeof x.byteLength=="number")return x.byteLength;if(typeof x.size=="number")return x.size}throw new Error(`Body Length computation failed for ${x}`)},s="required",t="fn",u="argv",v="ref",a=!0,b="isSet",c="booleanEquals",d="error",e="endpoint",f="tree",g="PartitionResult",h={[s]:!1,type:"String"},i={[s]:!0,default:!1,type:"Boolean"},j={[v]:"Endpoint"},k={[t]:c,[u]:[{[v]:"UseFIPS"},!0]},l={[t]:c,[u]:[{[v]:"UseDualStack"},!0]},m={},n={[t]:"getAttr",[u]:[{[v]:g},"supportsFIPS"]},o={[t]:c,[u]:[!0,{[t]:"getAttr",[u]:[{[v]:g},"supportsDualStack"]}]},p=[k],q=[l],r=[{[v]:"Region"}],_data={parameters:{Region:h,UseDualStack:i,UseFIPS:i,Endpoint:h},rules:[{conditions:[{[t]:b,[u]:[j]}],rules:[{conditions:p,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:q,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:j,properties:m,headers:m},type:e}],type:f},{conditions:[{[t]:b,[u]:r}],rules:[{conditions:[{[t]:"aws.partition",[u]:r,assign:g}],rules:[{conditions:[k,l],rules:[{conditions:[{[t]:c,[u]:[a,n]},o],rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:m,headers:m},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:p,rules:[{conditions:[{[t]:c,[u]:[n,a]}],rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:m,headers:m},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:q,rules:[{conditions:[o],rules:[{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:m,headers:m},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dnsSuffix}",properties:m,headers:m},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]},ruleSet=_data,cache=new EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver=(x,C={})=>cache.get(x,()=>resolveEndpoint(ruleSet,{endpointParams:x,logger:C.logger}));customEndpointFunctions.aws=awsEndpointFunctions;const getRuntimeConfig$1=x=>({apiVersion:"2021-05-15",base64Decoder:x?.base64Decoder??fromBase64,base64Encoder:x?.base64Encoder??toBase64,disableHostPrefix:x?.disableHostPrefix??!1,endpointProvider:x?.endpointProvider??defaultEndpointResolver,extensions:x?.extensions??[],httpAuthSchemeProvider:x?.httpAuthSchemeProvider??defaultChimeSDKMessagingHttpAuthSchemeProvider,httpAuthSchemes:x?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:C=>C.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:x?.logger??new NoOpLogger$1,serviceId:x?.serviceId??"Chime SDK Messaging",urlParser:x?.urlParser??parseUrl,utf8Decoder:x?.utf8Decoder??fromUtf8$5,utf8Encoder:x?.utf8Encoder??toUtf8$3}),DEFAULTS_MODE_OPTIONS=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig=({defaultsMode:x}={})=>memoize(async()=>{const C=typeof x=="function"?await x():x;switch(C?.toLowerCase()){case"auto":return Promise.resolve(isMobileBrowser()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(C?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${C}`)}}),isMobileBrowser=()=>{const x=(typeof window<"u"&&window?.navigator?.userAgent?Bowser.parse(window.navigator.userAgent):void 0)?.platform?.type;return x==="tablet"||x==="mobile"},getRuntimeConfig=x=>{const C=resolveDefaultsModeConfig(x),E=()=>C().then(loadConfigsForDefaultMode),w=getRuntimeConfig$1(x);return{...w,...x,runtime:"browser",defaultsMode:C,bodyLengthChecker:x?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:x?.credentialDefaultProvider??(T=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:x?.defaultUserAgentProvider??createDefaultUserAgentProvider({serviceId:w.serviceId,clientVersion:packageInfo.version}),maxAttempts:x?.maxAttempts??DEFAULT_MAX_ATTEMPTS,region:x?.region??invalidProvider("Region is missing"),requestHandler:FetchHttpHandler.create(x?.requestHandler??E),retryMode:x?.retryMode??(async()=>(await E()).retryMode||DEFAULT_RETRY_MODE),sha256:x?.sha256??Sha256,streamCollector:x?.streamCollector??streamCollector,useDualstackEndpoint:x?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),useFipsEndpoint:x?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))}},getAwsRegionExtensionConfiguration=x=>({setRegion(C){x.region=C},region(){return x.region}}),resolveAwsRegionExtensionConfiguration=x=>({region:x.region()}),getHttpAuthExtensionConfiguration=x=>{const C=x.httpAuthSchemes;let E=x.httpAuthSchemeProvider,w=x.credentials;return{setHttpAuthScheme(T){const _=C.findIndex(S=>S.schemeId===T.schemeId);_===-1?C.push(T):C.splice(_,1,T)},httpAuthSchemes(){return C},setHttpAuthSchemeProvider(T){E=T},httpAuthSchemeProvider(){return E},setCredentials(T){w=T},credentials(){return w}}},resolveHttpAuthRuntimeConfig=x=>({httpAuthSchemes:x.httpAuthSchemes(),httpAuthSchemeProvider:x.httpAuthSchemeProvider(),credentials:x.credentials()}),resolveRuntimeExtensions=(x,C)=>{const E=Object.assign(getAwsRegionExtensionConfiguration(x),getDefaultExtensionConfiguration(x),getHttpHandlerExtensionConfiguration(x),getHttpAuthExtensionConfiguration(x));return C.forEach(w=>w.configure(E)),Object.assign(x,resolveAwsRegionExtensionConfiguration(E),resolveDefaultRuntimeConfig(E),resolveHttpHandlerRuntimeConfig(E),resolveHttpAuthRuntimeConfig(E))};class ChimeSDKMessagingClient extends Client{config;constructor(...[C]){const E=getRuntimeConfig(C||{});super(E),this.initConfig=E;const w=resolveClientEndpointParameters(E),T=resolveUserAgentConfig(w),_=resolveRetryConfig(T),S=resolveRegionConfig(_),R=S,A=resolveEndpointConfig(R),O=resolveHttpAuthSchemeConfig(A),H=resolveRuntimeExtensions(O,C?.extensions||[]);this.config=H,this.middlewareStack.use(getUserAgentPlugin(this.config)),this.middlewareStack.use(getRetryPlugin(this.config)),this.middlewareStack.use(getContentLengthPlugin(this.config)),this.middlewareStack.use(getHostHeaderPlugin(this.config)),this.middlewareStack.use(getLoggerPlugin(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:defaultChimeSDKMessagingHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async ee=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":ee.credentials})})),this.middlewareStack.use(getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class ChimeSDKMessagingServiceException extends ServiceException{constructor(C){super(C),Object.setPrototypeOf(this,ChimeSDKMessagingServiceException.prototype)}}const AllowNotifications={ALL:"ALL",FILTERED:"FILTERED",NONE:"NONE"},ChannelMembershipType={DEFAULT:"DEFAULT",HIDDEN:"HIDDEN"},ErrorCode={AccessDenied:"AccessDenied",BadRequest:"BadRequest",Conflict:"Conflict",Forbidden:"Forbidden",NotFound:"NotFound",PhoneNumberAssociationsExist:"PhoneNumberAssociationsExist",PreconditionFailed:"PreconditionFailed",ResourceLimitExceeded:"ResourceLimitExceeded",ServiceFailure:"ServiceFailure",ServiceUnavailable:"ServiceUnavailable",Throttled:"Throttled",Throttling:"Throttling",Unauthorized:"Unauthorized",Unprocessable:"Unprocessable",VoiceConnectorGroupAssociationsExist:"VoiceConnectorGroupAssociationsExist"};class BadRequestException extends ChimeSDKMessagingServiceException{name="BadRequestException";$fault="client";Code;Message;constructor(C){super({name:"BadRequestException",$fault:"client",...C}),Object.setPrototypeOf(this,BadRequestException.prototype),this.Code=C.Code,this.Message=C.Message}}class ConflictException extends ChimeSDKMessagingServiceException{name="ConflictException";$fault="client";Code;Message;constructor(C){super({name:"ConflictException",$fault:"client",...C}),Object.setPrototypeOf(this,ConflictException.prototype),this.Code=C.Code,this.Message=C.Message}}class ForbiddenException extends ChimeSDKMessagingServiceException{name="ForbiddenException";$fault="client";Code;Message;constructor(C){super({name:"ForbiddenException",$fault:"client",...C}),Object.setPrototypeOf(this,ForbiddenException.prototype),this.Code=C.Code,this.Message=C.Message}}class NotFoundException extends ChimeSDKMessagingServiceException{name="NotFoundException";$fault="client";Code;Message;constructor(C){super({name:"NotFoundException",$fault:"client",...C}),Object.setPrototypeOf(this,NotFoundException.prototype),this.Code=C.Code,this.Message=C.Message}}class ServiceFailureException extends ChimeSDKMessagingServiceException{name="ServiceFailureException";$fault="server";Code;Message;constructor(C){super({name:"ServiceFailureException",$fault:"server",...C}),Object.setPrototypeOf(this,ServiceFailureException.prototype),this.Code=C.Code,this.Message=C.Message}}class ServiceUnavailableException extends ChimeSDKMessagingServiceException{name="ServiceUnavailableException";$fault="server";Code;Message;constructor(C){super({name:"ServiceUnavailableException",$fault:"server",...C}),Object.setPrototypeOf(this,ServiceUnavailableException.prototype),this.Code=C.Code,this.Message=C.Message}}class ThrottledClientException extends ChimeSDKMessagingServiceException{name="ThrottledClientException";$fault="client";Code;Message;constructor(C){super({name:"ThrottledClientException",$fault:"client",...C}),Object.setPrototypeOf(this,ThrottledClientException.prototype),this.Code=C.Code,this.Message=C.Message}}class UnauthorizedClientException extends ChimeSDKMessagingServiceException{name="UnauthorizedClientException";$fault="client";Code;Message;constructor(C){super({name:"UnauthorizedClientException",$fault:"client",...C}),Object.setPrototypeOf(this,UnauthorizedClientException.prototype),this.Code=C.Code,this.Message=C.Message}}class ResourceLimitExceededException extends ChimeSDKMessagingServiceException{name="ResourceLimitExceededException";$fault="client";Code;Message;constructor(C){super({name:"ResourceLimitExceededException",$fault:"client",...C}),Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Code=C.Code,this.Message=C.Message}}const ExpirationCriterion={CREATED_TIMESTAMP:"CREATED_TIMESTAMP",LAST_MESSAGE_TIMESTAMP:"LAST_MESSAGE_TIMESTAMP"},ChannelMode={RESTRICTED:"RESTRICTED",UNRESTRICTED:"UNRESTRICTED"},ChannelPrivacy={PRIVATE:"PRIVATE",PUBLIC:"PUBLIC"},InvocationType={ASYNC:"ASYNC"},FallbackAction={ABORT:"ABORT",CONTINUE:"CONTINUE"},PushNotificationType={DEFAULT:"DEFAULT",VOIP:"VOIP"},ChannelMessagePersistenceType={NON_PERSISTENT:"NON_PERSISTENT",PERSISTENT:"PERSISTENT"},ChannelMessageStatus={DENIED:"DENIED",FAILED:"FAILED",PENDING:"PENDING",SENT:"SENT"},ChannelMessageType={CONTROL:"CONTROL",STANDARD:"STANDARD"},MessagingDataType={Channel:"Channel",ChannelMessage:"ChannelMessage"},SortOrder={ASCENDING:"ASCENDING",DESCENDING:"DESCENDING"},SearchFieldKey={MEMBERS:"MEMBERS"},SearchFieldOperator={EQUALS:"EQUALS",INCLUDES:"INCLUDES"},IdentityFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING}}),BatchChannelMembershipsFilterSensitiveLog=x=>({...x,...x.InvitedBy&&{InvitedBy:IdentityFilterSensitiveLog(x.InvitedBy)},...x.Members&&{Members:x.Members.map(C=>IdentityFilterSensitiveLog(C))}}),BatchCreateChannelMembershipResponseFilterSensitiveLog=x=>({...x,...x.BatchChannelMemberships&&{BatchChannelMemberships:BatchChannelMembershipsFilterSensitiveLog(x.BatchChannelMemberships)}}),ChannelFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(x.CreatedBy)}}),ChannelAssociatedWithFlowSummaryFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING}}),ChannelBanFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)},...x.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(x.CreatedBy)}}),ChannelBanSummaryFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)}}),ProcessorFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING}}),ChannelFlowFilterSensitiveLog=x=>({...x,...x.Processors&&{Processors:x.Processors.map(C=>ProcessorFilterSensitiveLog(C))},...x.Name&&{Name:SENSITIVE_STRING}}),MessageAttributeValueFilterSensitiveLog=x=>({...x,...x.StringValues&&{StringValues:SENSITIVE_STRING}}),PushNotificationConfigurationFilterSensitiveLog=x=>({...x,...x.Title&&{Title:SENSITIVE_STRING},...x.Body&&{Body:SENSITIVE_STRING}}),ChannelMessageCallbackFilterSensitiveLog=x=>({...x,...x.Content&&{Content:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.PushNotification&&{PushNotification:PushNotificationConfigurationFilterSensitiveLog(x.PushNotification)},...x.MessageAttributes&&{MessageAttributes:Object.entries(x.MessageAttributes).reduce((C,[E,w])=>(C[E]=MessageAttributeValueFilterSensitiveLog(w),C),{})},...x.ContentType&&{ContentType:SENSITIVE_STRING}}),ChannelFlowCallbackRequestFilterSensitiveLog=x=>({...x,...x.ChannelMessage&&{ChannelMessage:ChannelMessageCallbackFilterSensitiveLog(x.ChannelMessage)}}),ChannelFlowSummaryFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING},...x.Processors&&{Processors:x.Processors.map(C=>ProcessorFilterSensitiveLog(C))}}),ChannelMembershipFilterSensitiveLog=x=>({...x,...x.InvitedBy&&{InvitedBy:IdentityFilterSensitiveLog(x.InvitedBy)},...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)}}),ChannelSummaryFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING}}),ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog=x=>({...x,...x.ChannelSummary&&{ChannelSummary:ChannelSummaryFilterSensitiveLog(x.ChannelSummary)}}),PushNotificationPreferencesFilterSensitiveLog=x=>({...x,...x.FilterRule&&{FilterRule:SENSITIVE_STRING}}),ChannelMembershipPreferencesFilterSensitiveLog=x=>({...x,...x.PushNotifications&&{PushNotifications:PushNotificationPreferencesFilterSensitiveLog(x.PushNotifications)}}),ChannelMembershipSummaryFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)}}),ChannelMessageFilterSensitiveLog=x=>({...x,...x.Content&&{Content:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.Sender&&{Sender:IdentityFilterSensitiveLog(x.Sender)},...x.MessageAttributes&&{MessageAttributes:Object.entries(x.MessageAttributes).reduce((C,[E,w])=>(C[E]=MessageAttributeValueFilterSensitiveLog(w),C),{})},...x.ContentType&&{ContentType:SENSITIVE_STRING}}),ChannelMessageSummaryFilterSensitiveLog=x=>({...x,...x.Content&&{Content:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.Sender&&{Sender:IdentityFilterSensitiveLog(x.Sender)},...x.MessageAttributes&&{MessageAttributes:Object.entries(x.MessageAttributes).reduce((C,[E,w])=>(C[E]=MessageAttributeValueFilterSensitiveLog(w),C),{})},...x.ContentType&&{ContentType:SENSITIVE_STRING}}),ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog=x=>({...x,...x.ChannelSummary&&{ChannelSummary:ChannelSummaryFilterSensitiveLog(x.ChannelSummary)}}),ChannelModeratorFilterSensitiveLog=x=>({...x,...x.Moderator&&{Moderator:IdentityFilterSensitiveLog(x.Moderator)},...x.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(x.CreatedBy)}}),ChannelModeratorSummaryFilterSensitiveLog=x=>({...x,...x.Moderator&&{Moderator:IdentityFilterSensitiveLog(x.Moderator)}}),TagFilterSensitiveLog=x=>({...x,...x.Key&&{Key:SENSITIVE_STRING},...x.Value&&{Value:SENSITIVE_STRING}}),CreateChannelRequestFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.ClientRequestToken&&{ClientRequestToken:SENSITIVE_STRING},...x.Tags&&{Tags:x.Tags.map(C=>TagFilterSensitiveLog(C))},...x.ChannelId&&{ChannelId:SENSITIVE_STRING}}),CreateChannelBanResponseFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)}}),CreateChannelFlowRequestFilterSensitiveLog=x=>({...x,...x.Processors&&{Processors:x.Processors.map(C=>ProcessorFilterSensitiveLog(C))},...x.Name&&{Name:SENSITIVE_STRING},...x.Tags&&{Tags:x.Tags.map(C=>TagFilterSensitiveLog(C))},...x.ClientRequestToken&&{ClientRequestToken:SENSITIVE_STRING}}),CreateChannelMembershipResponseFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)}}),CreateChannelModeratorResponseFilterSensitiveLog=x=>({...x,...x.ChannelModerator&&{ChannelModerator:IdentityFilterSensitiveLog(x.ChannelModerator)}}),DescribeChannelResponseFilterSensitiveLog=x=>({...x,...x.Channel&&{Channel:ChannelFilterSensitiveLog(x.Channel)}}),DescribeChannelBanResponseFilterSensitiveLog=x=>({...x,...x.ChannelBan&&{ChannelBan:ChannelBanFilterSensitiveLog(x.ChannelBan)}}),DescribeChannelFlowResponseFilterSensitiveLog=x=>({...x,...x.ChannelFlow&&{ChannelFlow:ChannelFlowFilterSensitiveLog(x.ChannelFlow)}}),DescribeChannelMembershipResponseFilterSensitiveLog=x=>({...x,...x.ChannelMembership&&{ChannelMembership:ChannelMembershipFilterSensitiveLog(x.ChannelMembership)}}),DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog=x=>({...x,...x.ChannelMembership&&{ChannelMembership:ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog(x.ChannelMembership)}}),DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog=x=>({...x,...x.Channel&&{Channel:ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog(x.Channel)}}),DescribeChannelModeratorResponseFilterSensitiveLog=x=>({...x,...x.ChannelModerator&&{ChannelModerator:ChannelModeratorFilterSensitiveLog(x.ChannelModerator)}}),GetChannelMembershipPreferencesResponseFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)},...x.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(x.Preferences)}}),GetChannelMessageResponseFilterSensitiveLog=x=>({...x,...x.ChannelMessage&&{ChannelMessage:ChannelMessageFilterSensitiveLog(x.ChannelMessage)}}),ListChannelBansRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelBansResponseFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING},...x.ChannelBans&&{ChannelBans:x.ChannelBans.map(C=>ChannelBanSummaryFilterSensitiveLog(C))}}),ListChannelFlowsRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelFlowsResponseFilterSensitiveLog=x=>({...x,...x.ChannelFlows&&{ChannelFlows:x.ChannelFlows.map(C=>ChannelFlowSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelMembershipsRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelMembershipsResponseFilterSensitiveLog=x=>({...x,...x.ChannelMemberships&&{ChannelMemberships:x.ChannelMemberships.map(C=>ChannelMembershipSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog=x=>({...x,...x.ChannelMemberships&&{ChannelMemberships:x.ChannelMemberships.map(C=>ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelMessagesRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelMessagesResponseFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING},...x.ChannelMessages&&{ChannelMessages:x.ChannelMessages.map(C=>ChannelMessageSummaryFilterSensitiveLog(C))}}),ListChannelModeratorsRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelModeratorsResponseFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING},...x.ChannelModerators&&{ChannelModerators:x.ChannelModerators.map(C=>ChannelModeratorSummaryFilterSensitiveLog(C))}}),ListChannelsRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelsResponseFilterSensitiveLog=x=>({...x,...x.Channels&&{Channels:x.Channels.map(C=>ChannelSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog=x=>({...x,...x.Channels&&{Channels:x.Channels.map(C=>ChannelAssociatedWithFlowSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog=x=>({...x,...x.Channels&&{Channels:x.Channels.map(C=>ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListSubChannelsRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListSubChannelsResponseFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),ListTagsForResourceResponseFilterSensitiveLog=x=>({...x,...x.Tags&&{Tags:x.Tags.map(C=>TagFilterSensitiveLog(C))}}),PutChannelMembershipPreferencesRequestFilterSensitiveLog=x=>({...x,...x.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(x.Preferences)}}),PutChannelMembershipPreferencesResponseFilterSensitiveLog=x=>({...x,...x.Member&&{Member:IdentityFilterSensitiveLog(x.Member)},...x.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(x.Preferences)}}),SearchChannelsRequestFilterSensitiveLog=x=>({...x,...x.NextToken&&{NextToken:SENSITIVE_STRING}}),SearchChannelsResponseFilterSensitiveLog=x=>({...x,...x.Channels&&{Channels:x.Channels.map(C=>ChannelSummaryFilterSensitiveLog(C))},...x.NextToken&&{NextToken:SENSITIVE_STRING}}),SendChannelMessageRequestFilterSensitiveLog=x=>({...x,...x.Content&&{Content:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.ClientRequestToken&&{ClientRequestToken:SENSITIVE_STRING},...x.PushNotification&&{PushNotification:PushNotificationConfigurationFilterSensitiveLog(x.PushNotification)},...x.MessageAttributes&&{MessageAttributes:Object.entries(x.MessageAttributes).reduce((C,[E,w])=>(C[E]=MessageAttributeValueFilterSensitiveLog(w),C),{})},...x.ContentType&&{ContentType:SENSITIVE_STRING}}),TagResourceRequestFilterSensitiveLog=x=>({...x,...x.Tags&&{Tags:x.Tags.map(C=>TagFilterSensitiveLog(C))}}),UntagResourceRequestFilterSensitiveLog=x=>({...x,...x.TagKeys&&{TagKeys:SENSITIVE_STRING}}),UpdateChannelRequestFilterSensitiveLog=x=>({...x,...x.Name&&{Name:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING}}),UpdateChannelFlowRequestFilterSensitiveLog=x=>({...x,...x.Processors&&{Processors:x.Processors.map(C=>ProcessorFilterSensitiveLog(C))},...x.Name&&{Name:SENSITIVE_STRING}}),UpdateChannelMessageRequestFilterSensitiveLog=x=>({...x,...x.Content&&{Content:SENSITIVE_STRING},...x.Metadata&&{Metadata:SENSITIVE_STRING},...x.ContentType&&{ContentType:SENSITIVE_STRING}}),se_AssociateChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/channel-flow"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{ChannelFlowArn:[]})),E.m("PUT").h(w).b(T),E.build()},se_BatchCreateChannelMembershipCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/memberships"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_o]:[,"batch-create"]});let _;return _=JSON.stringify(take(x,{MemberArns:S=>_json(S),SubChannelId:[],Type:[]})),E.m("POST").h(w).q(T).b(_),E.build()},se_ChannelFlowCallbackCommand=async(x,C)=>{const E=requestBuilder(x,C),w={"content-type":"application/json"};E.bp("/channels/{ChannelArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_o]:[,"channel-flow-callback"]});let _;return _=JSON.stringify(take(x,{CallbackId:[!0,S=>S??v4()],ChannelMessage:S=>_json(S),DeleteResource:[]})),E.m("POST").h(w).q(T).b(_),E.build()},se_CreateChannelCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels");let T;return T=JSON.stringify(take(x,{AppInstanceArn:[],ChannelId:[],ClientRequestToken:[!0,_=>_??v4()],ElasticChannelConfiguration:_=>_json(_),ExpirationSettings:_=>_json(_),MemberArns:_=>_json(_),Metadata:[],Mode:[],ModeratorArns:_=>_json(_),Name:[],Privacy:[],Tags:_=>_json(_)})),E.m("POST").h(w).b(T),E.build()},se_CreateChannelBanCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/bans"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{MemberArn:[]})),E.m("POST").h(w).b(T),E.build()},se_CreateChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w={"content-type":"application/json"};E.bp("/channel-flows");let T;return T=JSON.stringify(take(x,{AppInstanceArn:[],ClientRequestToken:[!0,_=>_??v4()],Name:[],Processors:_=>_json(_),Tags:_=>_json(_)})),E.m("POST").h(w).b(T),E.build()},se_CreateChannelMembershipCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/memberships"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{MemberArn:[],SubChannelId:[],Type:[]})),E.m("POST").h(w).b(T),E.build()},se_CreateChannelModeratorCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/moderators"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{ChannelModeratorArn:[]})),E.m("POST").h(w).b(T),E.build()},se_DeleteChannelCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.m("DELETE").h(w).b(void 0),E.build()},se_DeleteChannelBanCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/bans/{MemberArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MemberArn",()=>x.MemberArn,"{MemberArn}",!1),E.m("DELETE").h(w).b(void 0),E.build()},se_DeleteChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};return E.bp("/channel-flows/{ChannelFlowArn}"),E.p("ChannelFlowArn",()=>x.ChannelFlowArn,"{ChannelFlowArn}",!1),E.m("DELETE").h(w).b(void 0),E.build()},se_DeleteChannelMembershipCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/memberships/{MemberArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MemberArn",()=>x.MemberArn,"{MemberArn}",!1);const T=map({[_sci]:[,x[_SCI]]});return E.m("DELETE").h(w).q(T).b(void 0),E.build()},se_DeleteChannelMessageCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages/{MessageId}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MessageId",()=>x.MessageId,"{MessageId}",!1);const T=map({[_sci]:[,x[_SCI]]});return E.m("DELETE").h(w).q(T).b(void 0),E.build()},se_DeleteChannelModeratorCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("ChannelModeratorArn",()=>x.ChannelModeratorArn,"{ChannelModeratorArn}",!1),E.m("DELETE").h(w).b(void 0),E.build()},se_DeleteMessagingStreamingConfigurationsCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};return E.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),E.p("AppInstanceArn",()=>x.AppInstanceArn,"{AppInstanceArn}",!1),E.m("DELETE").h(w).b(void 0),E.build()},se_DescribeChannelCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.m("GET").h(w).b(void 0),E.build()},se_DescribeChannelBanCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/bans/{MemberArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MemberArn",()=>x.MemberArn,"{MemberArn}",!1),E.m("GET").h(w).b(void 0),E.build()},se_DescribeChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};return E.bp("/channel-flows/{ChannelFlowArn}"),E.p("ChannelFlowArn",()=>x.ChannelFlowArn,"{ChannelFlowArn}",!1),E.m("GET").h(w).b(void 0),E.build()},se_DescribeChannelMembershipCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/memberships/{MemberArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MemberArn",()=>x.MemberArn,"{MemberArn}",!1);const T=map({[_sci]:[,x[_SCI]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_DescribeChannelMembershipForAppInstanceUserCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_s]:[,"app-instance-user-membership"],[_aiua]:[,expectNonNull(x[_AIUA],"AppInstanceUserArn")]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_DescribeChannelModeratedByAppInstanceUserCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_s]:[,"app-instance-user-moderated-channel"],[_aiua]:[,expectNonNull(x[_AIUA],"AppInstanceUserArn")]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_DescribeChannelModeratorCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("ChannelModeratorArn",()=>x.ChannelModeratorArn,"{ChannelModeratorArn}",!1),E.m("GET").h(w).b(void 0),E.build()},se_DisassociateChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("ChannelFlowArn",()=>x.ChannelFlowArn,"{ChannelFlowArn}",!1),E.m("DELETE").h(w).b(void 0),E.build()},se_GetChannelMembershipPreferencesCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/memberships/{MemberArn}/preferences"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MemberArn",()=>x.MemberArn,"{MemberArn}",!1),E.m("GET").h(w).b(void 0),E.build()},se_GetChannelMessageCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages/{MessageId}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MessageId",()=>x.MessageId,"{MessageId}",!1);const T=map({[_sci]:[,x[_SCI]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_GetChannelMessageStatusCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages/{MessageId}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MessageId",()=>x.MessageId,"{MessageId}",!1);const T=map({[_s]:[,"message-status"],[_sci]:[,x[_SCI]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_GetMessagingSessionEndpointCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};return E.bp("/endpoints/messaging-session"),E.m("GET").h(w).b(void 0),E.build()},se_GetMessagingStreamingConfigurationsCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};return E.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),E.p("AppInstanceArn",()=>x.AppInstanceArn,"{AppInstanceArn}",!1),E.m("GET").h(w).b(void 0),E.build()},se_ListChannelBansCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/bans"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelFlowsCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};E.bp("/channel-flows");const T=map({[_aia]:[,expectNonNull(x[_AIA],"AppInstanceArn")],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelMembershipsCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/memberships"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_t]:[,x[_T]],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]],[_sci]:[,x[_SCI]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelMembershipsForAppInstanceUserCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels");const T=map({[_s]:[,"app-instance-user-memberships"],[_aiua]:[,x[_AIUA]],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelMessagesCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_so]:[,x[_SO]],[_nb]:[()=>x.NotBefore!==void 0,()=>serializeDateTime(x[_NB]).toString()],[_na]:[()=>x.NotAfter!==void 0,()=>serializeDateTime(x[_NA]).toString()],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]],[_sci]:[,x[_SCI]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelModeratorsCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/moderators"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelsCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels");const T=map({[_aia]:[,expectNonNull(x[_AIA],"AppInstanceArn")],[_p]:[,x[_P]],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelsAssociatedWithChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};E.bp("/channels");const T=map({[_s]:[,"channel-flow-associations"],[_cfa]:[,expectNonNull(x[_CFA],"ChannelFlowArn")],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListChannelsModeratedByAppInstanceUserCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels");const T=map({[_s]:[,"app-instance-user-moderated-channels"],[_aiua]:[,x[_AIUA]],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListSubChannelsCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/subchannels"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);const T=map({[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_ListTagsForResourceCommand=async(x,C)=>{const E=requestBuilder(x,C),w={};E.bp("/tags");const T=map({[_a]:[,expectNonNull(x[_RARN],"ResourceARN")]});return E.m("GET").h(w).q(T).b(void 0),E.build()},se_PutChannelExpirationSettingsCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/expiration-settings"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{ExpirationSettings:_=>_json(_)})),E.m("PUT").h(w).b(T),E.build()},se_PutChannelMembershipPreferencesCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/memberships/{MemberArn}/preferences"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MemberArn",()=>x.MemberArn,"{MemberArn}",!1);let T;return T=JSON.stringify(take(x,{Preferences:_=>_json(_)})),E.m("PUT").h(w).b(T),E.build()},se_PutMessagingStreamingConfigurationsCommand=async(x,C)=>{const E=requestBuilder(x,C),w={"content-type":"application/json"};E.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),E.p("AppInstanceArn",()=>x.AppInstanceArn,"{AppInstanceArn}",!1);let T;return T=JSON.stringify(take(x,{StreamingConfigurations:_=>_json(_)})),E.m("PUT").h(w).b(T),E.build()},se_RedactChannelMessageCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages/{MessageId}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MessageId",()=>x.MessageId,"{MessageId}",!1);const T=map({[_o]:[,"redact"]});let _;return _=JSON.stringify(take(x,{SubChannelId:[]})),E.m("POST").h(w).q(T).b(_),E.build()},se_SearchChannelsCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels");const T=map({[_o]:[,"search"],[_mr]:[()=>x.MaxResults!==void 0,()=>x[_MR].toString()],[_nt]:[,x[_NT]]});let _;return _=JSON.stringify(take(x,{Fields:S=>_json(S)})),E.m("POST").h(w).q(T).b(_),E.build()},se_SendChannelMessageCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{ClientRequestToken:[!0,_=>_??v4()],Content:[],ContentType:[],MessageAttributes:_=>_json(_),Metadata:[],Persistence:[],PushNotification:_=>_json(_),SubChannelId:[],Target:_=>_json(_),Type:[]})),E.m("POST").h(w).b(T),E.build()},se_TagResourceCommand=async(x,C)=>{const E=requestBuilder(x,C),w={"content-type":"application/json"};E.bp("/tags");const T=map({[_o]:[,"tag-resource"]});let _;return _=JSON.stringify(take(x,{ResourceARN:[],Tags:S=>_json(S)})),E.m("POST").h(w).q(T).b(_),E.build()},se_UntagResourceCommand=async(x,C)=>{const E=requestBuilder(x,C),w={"content-type":"application/json"};E.bp("/tags");const T=map({[_o]:[,"untag-resource"]});let _;return _=JSON.stringify(take(x,{ResourceARN:[],TagKeys:S=>_json(S)})),E.m("POST").h(w).q(T).b(_),E.build()},se_UpdateChannelCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1);let T;return T=JSON.stringify(take(x,{Metadata:[],Mode:[],Name:[]})),E.m("PUT").h(w).b(T),E.build()},se_UpdateChannelFlowCommand=async(x,C)=>{const E=requestBuilder(x,C),w={"content-type":"application/json"};E.bp("/channel-flows/{ChannelFlowArn}"),E.p("ChannelFlowArn",()=>x.ChannelFlowArn,"{ChannelFlowArn}",!1);let T;return T=JSON.stringify(take(x,{Name:[],Processors:_=>_json(_)})),E.m("PUT").h(w).b(T),E.build()},se_UpdateChannelMessageCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{"content-type":"application/json",[_xacb]:x[_CB]});E.bp("/channels/{ChannelArn}/messages/{MessageId}"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.p("MessageId",()=>x.MessageId,"{MessageId}",!1);let T;return T=JSON.stringify(take(x,{Content:[],ContentType:[],Metadata:[],SubChannelId:[]})),E.m("PUT").h(w).b(T),E.build()},se_UpdateChannelReadMarkerCommand=async(x,C)=>{const E=requestBuilder(x,C),w=map({},isSerializableHeaderValue,{[_xacb]:x[_CB]});return E.bp("/channels/{ChannelArn}/readMarker"),E.p("ChannelArn",()=>x.ChannelArn,"{ChannelArn}",!1),E.m("PUT").h(w).b(void 0),E.build()},de_AssociateChannelFlowCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_BatchCreateChannelMembershipCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{BatchChannelMemberships:_json,Errors:_json});return Object.assign(E,T),E},de_ChannelFlowCallbackCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{CallbackId:expectString,ChannelArn:expectString});return Object.assign(E,T),E},de_CreateChannelCommand=async(x,C)=>{if(x.statusCode!==201&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString});return Object.assign(E,T),E},de_CreateChannelBanCommand=async(x,C)=>{if(x.statusCode!==201&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,Member:_json});return Object.assign(E,T),E},de_CreateChannelFlowCommand=async(x,C)=>{if(x.statusCode!==201&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelFlowArn:expectString});return Object.assign(E,T),E},de_CreateChannelMembershipCommand=async(x,C)=>{if(x.statusCode!==201&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,Member:_json,SubChannelId:expectString});return Object.assign(E,T),E},de_CreateChannelModeratorCommand=async(x,C)=>{if(x.statusCode!==201&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,ChannelModerator:_json});return Object.assign(E,T),E},de_DeleteChannelCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DeleteChannelBanCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DeleteChannelFlowCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DeleteChannelMembershipCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DeleteChannelMessageCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DeleteChannelModeratorCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DeleteMessagingStreamingConfigurationsCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_DescribeChannelCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Channel:_=>de_Channel(_)});return Object.assign(E,T),E},de_DescribeChannelBanCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelBan:_=>de_ChannelBan(_)});return Object.assign(E,T),E},de_DescribeChannelFlowCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelFlow:_=>de_ChannelFlow(_)});return Object.assign(E,T),E},de_DescribeChannelMembershipCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelMembership:_=>de_ChannelMembership(_)});return Object.assign(E,T),E},de_DescribeChannelMembershipForAppInstanceUserCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelMembership:_=>de_ChannelMembershipForAppInstanceUserSummary(_)});return Object.assign(E,T),E},de_DescribeChannelModeratedByAppInstanceUserCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Channel:_=>de_ChannelModeratedByAppInstanceUserSummary(_)});return Object.assign(E,T),E},de_DescribeChannelModeratorCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelModerator:_=>de_ChannelModerator(_)});return Object.assign(E,T),E},de_DisassociateChannelFlowCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_GetChannelMembershipPreferencesCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,Member:_json,Preferences:_json});return Object.assign(E,T),E},de_GetChannelMessageCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelMessage:_=>de_ChannelMessage(_)});return Object.assign(E,T),E},de_GetChannelMessageStatusCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Status:_json});return Object.assign(E,T),E},de_GetMessagingSessionEndpointCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Endpoint:_json});return Object.assign(E,T),E},de_GetMessagingStreamingConfigurationsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{StreamingConfigurations:_json});return Object.assign(E,T),E},de_ListChannelBansCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,ChannelBans:_json,NextToken:expectString});return Object.assign(E,T),E},de_ListChannelFlowsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelFlows:_json,NextToken:expectString});return Object.assign(E,T),E},de_ListChannelMembershipsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,ChannelMemberships:_json,NextToken:expectString});return Object.assign(E,T),E},de_ListChannelMembershipsForAppInstanceUserCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelMemberships:_=>de_ChannelMembershipForAppInstanceUserSummaryList(_),NextToken:expectString});return Object.assign(E,T),E},de_ListChannelMessagesCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,ChannelMessages:_=>de_ChannelMessageSummaryList(_),NextToken:expectString,SubChannelId:expectString});return Object.assign(E,T),E},de_ListChannelModeratorsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,ChannelModerators:_json,NextToken:expectString});return Object.assign(E,T),E},de_ListChannelsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Channels:_=>de_ChannelSummaryList(_),NextToken:expectString});return Object.assign(E,T),E},de_ListChannelsAssociatedWithChannelFlowCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Channels:_json,NextToken:expectString});return Object.assign(E,T),E},de_ListChannelsModeratedByAppInstanceUserCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Channels:_=>de_ChannelModeratedByAppInstanceUserSummaryList(_),NextToken:expectString});return Object.assign(E,T),E},de_ListSubChannelsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,NextToken:expectString,SubChannels:_json});return Object.assign(E,T),E},de_ListTagsForResourceCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Tags:_json});return Object.assign(E,T),E},de_PutChannelExpirationSettingsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,ExpirationSettings:_json});return Object.assign(E,T),E},de_PutChannelMembershipPreferencesCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,Member:_json,Preferences:_json});return Object.assign(E,T),E},de_PutMessagingStreamingConfigurationsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{StreamingConfigurations:_json});return Object.assign(E,T),E},de_RedactChannelMessageCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,MessageId:expectString,SubChannelId:expectString});return Object.assign(E,T),E},de_SearchChannelsCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{Channels:_=>de_ChannelSummaryList(_),NextToken:expectString});return Object.assign(E,T),E},de_SendChannelMessageCommand=async(x,C)=>{if(x.statusCode!==201&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,MessageId:expectString,Status:_json,SubChannelId:expectString});return Object.assign(E,T),E},de_TagResourceCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_UntagResourceCommand=async(x,C)=>{if(x.statusCode!==204&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)});return await collectBody(x.body,C),E},de_UpdateChannelCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString});return Object.assign(E,T),E},de_UpdateChannelFlowCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelFlowArn:expectString});return Object.assign(E,T),E},de_UpdateChannelMessageCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString,MessageId:expectString,Status:_json,SubChannelId:expectString});return Object.assign(E,T),E},de_UpdateChannelReadMarkerCommand=async(x,C)=>{if(x.statusCode!==200&&x.statusCode>=300)return de_CommandError(x,C);const E=map({$metadata:deserializeMetadata(x)}),w=expectNonNull(expectObject(await parseJsonBody(x.body,C)),"body"),T=take(w,{ChannelArn:expectString});return Object.assign(E,T),E},de_CommandError=async(x,C)=>{const E={...x,body:await parseJsonErrorBody(x.body,C)},w=loadRestJsonErrorCode(x,E.body);switch(w){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await de_BadRequestExceptionRes(E);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await de_ConflictExceptionRes(E);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await de_ForbiddenExceptionRes(E);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await de_NotFoundExceptionRes(E);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await de_ServiceFailureExceptionRes(E);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await de_ServiceUnavailableExceptionRes(E);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await de_ThrottledClientExceptionRes(E);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await de_UnauthorizedClientExceptionRes(E);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(E);default:const T=E.body;return throwDefaultError({output:x,parsedBody:T,errorCode:w})}},throwDefaultError=withBaseException(ChimeSDKMessagingServiceException),de_BadRequestExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new BadRequestException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_ConflictExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new ConflictException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_ForbiddenExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new ForbiddenException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_NotFoundExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new NotFoundException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_ResourceLimitExceededExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new ResourceLimitExceededException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_ServiceFailureExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new ServiceFailureException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_ServiceUnavailableExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new ServiceUnavailableException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_ThrottledClientExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new ThrottledClientException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_UnauthorizedClientExceptionRes=async(x,C)=>{const E=map({}),w=x.body,T=take(w,{Code:expectString,Message:expectString});Object.assign(E,T);const _=new UnauthorizedClientException({$metadata:deserializeMetadata(x),...E});return decorateServiceException(_,x.body)},de_AppInstanceUserMembershipSummary=(x,C)=>take(x,{ReadMarkerTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),SubChannelId:expectString,Type:expectString}),de_Channel=(x,C)=>take(x,{ChannelArn:expectString,ChannelFlowArn:expectString,CreatedBy:_json,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),ElasticChannelConfiguration:_json,ExpirationSettings:_json,LastMessageTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),LastUpdatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),Metadata:expectString,Mode:expectString,Name:expectString,Privacy:expectString}),de_ChannelBan=(x,C)=>take(x,{ChannelArn:expectString,CreatedBy:_json,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),Member:_json}),de_ChannelFlow=(x,C)=>take(x,{ChannelFlowArn:expectString,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),LastUpdatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),Name:expectString,Processors:_json}),de_ChannelMembership=(x,C)=>take(x,{ChannelArn:expectString,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),InvitedBy:_json,LastUpdatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),Member:_json,SubChannelId:expectString,Type:expectString}),de_ChannelMembershipForAppInstanceUserSummary=(x,C)=>take(x,{AppInstanceUserMembershipSummary:E=>de_AppInstanceUserMembershipSummary(E),ChannelSummary:E=>de_ChannelSummary(E)}),de_ChannelMembershipForAppInstanceUserSummaryList=(x,C)=>(x||[]).filter(E=>E!=null).map(E=>de_ChannelMembershipForAppInstanceUserSummary(E)),de_ChannelMessage=(x,C)=>take(x,{ChannelArn:expectString,Content:expectString,ContentType:expectString,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),LastEditedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),LastUpdatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),MessageAttributes:_json,MessageId:expectString,Metadata:expectString,Persistence:expectString,Redacted:expectBoolean,Sender:_json,Status:_json,SubChannelId:expectString,Target:_json,Type:expectString}),de_ChannelMessageSummary=(x,C)=>take(x,{Content:expectString,ContentType:expectString,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),LastEditedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),LastUpdatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),MessageAttributes:_json,MessageId:expectString,Metadata:expectString,Redacted:expectBoolean,Sender:_json,Status:_json,Target:_json,Type:expectString}),de_ChannelMessageSummaryList=(x,C)=>(x||[]).filter(E=>E!=null).map(E=>de_ChannelMessageSummary(E)),de_ChannelModeratedByAppInstanceUserSummary=(x,C)=>take(x,{ChannelSummary:E=>de_ChannelSummary(E)}),de_ChannelModeratedByAppInstanceUserSummaryList=(x,C)=>(x||[]).filter(E=>E!=null).map(E=>de_ChannelModeratedByAppInstanceUserSummary(E)),de_ChannelModerator=(x,C)=>take(x,{ChannelArn:expectString,CreatedBy:_json,CreatedTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),Moderator:_json}),de_ChannelSummary=(x,C)=>take(x,{ChannelArn:expectString,LastMessageTimestamp:E=>expectNonNull(parseEpochTimestamp(expectNumber(E))),Metadata:expectString,Mode:expectString,Name:expectString,Privacy:expectString}),de_ChannelSummaryList=(x,C)=>(x||[]).filter(E=>E!=null).map(E=>de_ChannelSummary(E)),deserializeMetadata=x=>({httpStatusCode:x.statusCode,requestId:x.headers["x-amzn-requestid"]??x.headers["x-amzn-request-id"]??x.headers["x-amz-request-id"],extendedRequestId:x.headers["x-amz-id-2"],cfId:x.headers["x-amz-cf-id"]}),_AIA="AppInstanceArn",_AIUA="AppInstanceUserArn",_CB="ChimeBearer",_CFA="ChannelFlowArn",_MR="MaxResults",_NA="NotAfter",_NB="NotBefore",_NT="NextToken",_P="Privacy",_RARN="ResourceARN",_SCI="SubChannelId",_SO="SortOrder",_T="Type",_a="arn",_aia="app-instance-arn",_aiua="app-instance-user-arn",_cfa="channel-flow-arn",_mr="max-results",_na="not-after",_nb="not-before",_nt="next-token",_o="operation",_p="privacy",_s="scope",_sci="sub-channel-id",_so="sort-order",_t="type",_xacb="x-amz-chime-bearer";class AssociateChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","AssociateChannelFlow",{}).n("ChimeSDKMessagingClient","AssociateChannelFlowCommand").f(void 0,void 0).ser(se_AssociateChannelFlowCommand).de(de_AssociateChannelFlowCommand).build(){}class BatchCreateChannelMembershipCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","BatchCreateChannelMembership",{}).n("ChimeSDKMessagingClient","BatchCreateChannelMembershipCommand").f(void 0,BatchCreateChannelMembershipResponseFilterSensitiveLog).ser(se_BatchCreateChannelMembershipCommand).de(de_BatchCreateChannelMembershipCommand).build(){}class ChannelFlowCallbackCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ChannelFlowCallback",{}).n("ChimeSDKMessagingClient","ChannelFlowCallbackCommand").f(ChannelFlowCallbackRequestFilterSensitiveLog,void 0).ser(se_ChannelFlowCallbackCommand).de(de_ChannelFlowCallbackCommand).build(){}class CreateChannelBanCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelBan",{}).n("ChimeSDKMessagingClient","CreateChannelBanCommand").f(void 0,CreateChannelBanResponseFilterSensitiveLog).ser(se_CreateChannelBanCommand).de(de_CreateChannelBanCommand).build(){}class CreateChannelCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannel",{}).n("ChimeSDKMessagingClient","CreateChannelCommand").f(CreateChannelRequestFilterSensitiveLog,void 0).ser(se_CreateChannelCommand).de(de_CreateChannelCommand).build(){}class CreateChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelFlow",{}).n("ChimeSDKMessagingClient","CreateChannelFlowCommand").f(CreateChannelFlowRequestFilterSensitiveLog,void 0).ser(se_CreateChannelFlowCommand).de(de_CreateChannelFlowCommand).build(){}class CreateChannelMembershipCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelMembership",{}).n("ChimeSDKMessagingClient","CreateChannelMembershipCommand").f(void 0,CreateChannelMembershipResponseFilterSensitiveLog).ser(se_CreateChannelMembershipCommand).de(de_CreateChannelMembershipCommand).build(){}class CreateChannelModeratorCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelModerator",{}).n("ChimeSDKMessagingClient","CreateChannelModeratorCommand").f(void 0,CreateChannelModeratorResponseFilterSensitiveLog).ser(se_CreateChannelModeratorCommand).de(de_CreateChannelModeratorCommand).build(){}class DeleteChannelBanCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelBan",{}).n("ChimeSDKMessagingClient","DeleteChannelBanCommand").f(void 0,void 0).ser(se_DeleteChannelBanCommand).de(de_DeleteChannelBanCommand).build(){}class DeleteChannelCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannel",{}).n("ChimeSDKMessagingClient","DeleteChannelCommand").f(void 0,void 0).ser(se_DeleteChannelCommand).de(de_DeleteChannelCommand).build(){}class DeleteChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelFlow",{}).n("ChimeSDKMessagingClient","DeleteChannelFlowCommand").f(void 0,void 0).ser(se_DeleteChannelFlowCommand).de(de_DeleteChannelFlowCommand).build(){}class DeleteChannelMembershipCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelMembership",{}).n("ChimeSDKMessagingClient","DeleteChannelMembershipCommand").f(void 0,void 0).ser(se_DeleteChannelMembershipCommand).de(de_DeleteChannelMembershipCommand).build(){}class DeleteChannelMessageCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelMessage",{}).n("ChimeSDKMessagingClient","DeleteChannelMessageCommand").f(void 0,void 0).ser(se_DeleteChannelMessageCommand).de(de_DeleteChannelMessageCommand).build(){}class DeleteChannelModeratorCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelModerator",{}).n("ChimeSDKMessagingClient","DeleteChannelModeratorCommand").f(void 0,void 0).ser(se_DeleteChannelModeratorCommand).de(de_DeleteChannelModeratorCommand).build(){}class DeleteMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","DeleteMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_DeleteMessagingStreamingConfigurationsCommand).de(de_DeleteMessagingStreamingConfigurationsCommand).build(){}class DescribeChannelBanCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelBan",{}).n("ChimeSDKMessagingClient","DescribeChannelBanCommand").f(void 0,DescribeChannelBanResponseFilterSensitiveLog).ser(se_DescribeChannelBanCommand).de(de_DescribeChannelBanCommand).build(){}class DescribeChannelCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannel",{}).n("ChimeSDKMessagingClient","DescribeChannelCommand").f(void 0,DescribeChannelResponseFilterSensitiveLog).ser(se_DescribeChannelCommand).de(de_DescribeChannelCommand).build(){}class DescribeChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelFlow",{}).n("ChimeSDKMessagingClient","DescribeChannelFlowCommand").f(void 0,DescribeChannelFlowResponseFilterSensitiveLog).ser(se_DescribeChannelFlowCommand).de(de_DescribeChannelFlowCommand).build(){}class DescribeChannelMembershipCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelMembership",{}).n("ChimeSDKMessagingClient","DescribeChannelMembershipCommand").f(void 0,DescribeChannelMembershipResponseFilterSensitiveLog).ser(se_DescribeChannelMembershipCommand).de(de_DescribeChannelMembershipCommand).build(){}class DescribeChannelMembershipForAppInstanceUserCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelMembershipForAppInstanceUser",{}).n("ChimeSDKMessagingClient","DescribeChannelMembershipForAppInstanceUserCommand").f(void 0,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog).ser(se_DescribeChannelMembershipForAppInstanceUserCommand).de(de_DescribeChannelMembershipForAppInstanceUserCommand).build(){}class DescribeChannelModeratedByAppInstanceUserCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelModeratedByAppInstanceUser",{}).n("ChimeSDKMessagingClient","DescribeChannelModeratedByAppInstanceUserCommand").f(void 0,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog).ser(se_DescribeChannelModeratedByAppInstanceUserCommand).de(de_DescribeChannelModeratedByAppInstanceUserCommand).build(){}class DescribeChannelModeratorCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelModerator",{}).n("ChimeSDKMessagingClient","DescribeChannelModeratorCommand").f(void 0,DescribeChannelModeratorResponseFilterSensitiveLog).ser(se_DescribeChannelModeratorCommand).de(de_DescribeChannelModeratorCommand).build(){}class DisassociateChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DisassociateChannelFlow",{}).n("ChimeSDKMessagingClient","DisassociateChannelFlowCommand").f(void 0,void 0).ser(se_DisassociateChannelFlowCommand).de(de_DisassociateChannelFlowCommand).build(){}class GetChannelMembershipPreferencesCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMembershipPreferences",{}).n("ChimeSDKMessagingClient","GetChannelMembershipPreferencesCommand").f(void 0,GetChannelMembershipPreferencesResponseFilterSensitiveLog).ser(se_GetChannelMembershipPreferencesCommand).de(de_GetChannelMembershipPreferencesCommand).build(){}class GetChannelMessageCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMessage",{}).n("ChimeSDKMessagingClient","GetChannelMessageCommand").f(void 0,GetChannelMessageResponseFilterSensitiveLog).ser(se_GetChannelMessageCommand).de(de_GetChannelMessageCommand).build(){}class GetChannelMessageStatusCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMessageStatus",{}).n("ChimeSDKMessagingClient","GetChannelMessageStatusCommand").f(void 0,void 0).ser(se_GetChannelMessageStatusCommand).de(de_GetChannelMessageStatusCommand).build(){}class GetMessagingSessionEndpointCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetMessagingSessionEndpoint",{}).n("ChimeSDKMessagingClient","GetMessagingSessionEndpointCommand").f(void 0,void 0).ser(se_GetMessagingSessionEndpointCommand).de(de_GetMessagingSessionEndpointCommand).build(){}class GetMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","GetMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_GetMessagingStreamingConfigurationsCommand).de(de_GetMessagingStreamingConfigurationsCommand).build(){}class ListChannelBansCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelBans",{}).n("ChimeSDKMessagingClient","ListChannelBansCommand").f(ListChannelBansRequestFilterSensitiveLog,ListChannelBansResponseFilterSensitiveLog).ser(se_ListChannelBansCommand).de(de_ListChannelBansCommand).build(){}class ListChannelFlowsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelFlows",{}).n("ChimeSDKMessagingClient","ListChannelFlowsCommand").f(ListChannelFlowsRequestFilterSensitiveLog,ListChannelFlowsResponseFilterSensitiveLog).ser(se_ListChannelFlowsCommand).de(de_ListChannelFlowsCommand).build(){}class ListChannelMembershipsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMemberships",{}).n("ChimeSDKMessagingClient","ListChannelMembershipsCommand").f(ListChannelMembershipsRequestFilterSensitiveLog,ListChannelMembershipsResponseFilterSensitiveLog).ser(se_ListChannelMembershipsCommand).de(de_ListChannelMembershipsCommand).build(){}class ListChannelMembershipsForAppInstanceUserCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMembershipsForAppInstanceUser",{}).n("ChimeSDKMessagingClient","ListChannelMembershipsForAppInstanceUserCommand").f(ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog).ser(se_ListChannelMembershipsForAppInstanceUserCommand).de(de_ListChannelMembershipsForAppInstanceUserCommand).build(){}class ListChannelMessagesCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMessages",{}).n("ChimeSDKMessagingClient","ListChannelMessagesCommand").f(ListChannelMessagesRequestFilterSensitiveLog,ListChannelMessagesResponseFilterSensitiveLog).ser(se_ListChannelMessagesCommand).de(de_ListChannelMessagesCommand).build(){}class ListChannelModeratorsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelModerators",{}).n("ChimeSDKMessagingClient","ListChannelModeratorsCommand").f(ListChannelModeratorsRequestFilterSensitiveLog,ListChannelModeratorsResponseFilterSensitiveLog).ser(se_ListChannelModeratorsCommand).de(de_ListChannelModeratorsCommand).build(){}class ListChannelsAssociatedWithChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelsAssociatedWithChannelFlow",{}).n("ChimeSDKMessagingClient","ListChannelsAssociatedWithChannelFlowCommand").f(ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog).ser(se_ListChannelsAssociatedWithChannelFlowCommand).de(de_ListChannelsAssociatedWithChannelFlowCommand).build(){}class ListChannelsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannels",{}).n("ChimeSDKMessagingClient","ListChannelsCommand").f(ListChannelsRequestFilterSensitiveLog,ListChannelsResponseFilterSensitiveLog).ser(se_ListChannelsCommand).de(de_ListChannelsCommand).build(){}class ListChannelsModeratedByAppInstanceUserCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelsModeratedByAppInstanceUser",{}).n("ChimeSDKMessagingClient","ListChannelsModeratedByAppInstanceUserCommand").f(ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog).ser(se_ListChannelsModeratedByAppInstanceUserCommand).de(de_ListChannelsModeratedByAppInstanceUserCommand).build(){}class ListSubChannelsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListSubChannels",{}).n("ChimeSDKMessagingClient","ListSubChannelsCommand").f(ListSubChannelsRequestFilterSensitiveLog,ListSubChannelsResponseFilterSensitiveLog).ser(se_ListSubChannelsCommand).de(de_ListSubChannelsCommand).build(){}class ListTagsForResourceCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListTagsForResource",{}).n("ChimeSDKMessagingClient","ListTagsForResourceCommand").f(void 0,ListTagsForResourceResponseFilterSensitiveLog).ser(se_ListTagsForResourceCommand).de(de_ListTagsForResourceCommand).build(){}class PutChannelExpirationSettingsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutChannelExpirationSettings",{}).n("ChimeSDKMessagingClient","PutChannelExpirationSettingsCommand").f(void 0,void 0).ser(se_PutChannelExpirationSettingsCommand).de(de_PutChannelExpirationSettingsCommand).build(){}class PutChannelMembershipPreferencesCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutChannelMembershipPreferences",{}).n("ChimeSDKMessagingClient","PutChannelMembershipPreferencesCommand").f(PutChannelMembershipPreferencesRequestFilterSensitiveLog,PutChannelMembershipPreferencesResponseFilterSensitiveLog).ser(se_PutChannelMembershipPreferencesCommand).de(de_PutChannelMembershipPreferencesCommand).build(){}class PutMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","PutMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_PutMessagingStreamingConfigurationsCommand).de(de_PutMessagingStreamingConfigurationsCommand).build(){}class RedactChannelMessageCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","RedactChannelMessage",{}).n("ChimeSDKMessagingClient","RedactChannelMessageCommand").f(void 0,void 0).ser(se_RedactChannelMessageCommand).de(de_RedactChannelMessageCommand).build(){}class SearchChannelsCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","SearchChannels",{}).n("ChimeSDKMessagingClient","SearchChannelsCommand").f(SearchChannelsRequestFilterSensitiveLog,SearchChannelsResponseFilterSensitiveLog).ser(se_SearchChannelsCommand).de(de_SearchChannelsCommand).build(){}class SendChannelMessageCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","SendChannelMessage",{}).n("ChimeSDKMessagingClient","SendChannelMessageCommand").f(SendChannelMessageRequestFilterSensitiveLog,void 0).ser(se_SendChannelMessageCommand).de(de_SendChannelMessageCommand).build(){}class TagResourceCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","TagResource",{}).n("ChimeSDKMessagingClient","TagResourceCommand").f(TagResourceRequestFilterSensitiveLog,void 0).ser(se_TagResourceCommand).de(de_TagResourceCommand).build(){}class UntagResourceCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UntagResource",{}).n("ChimeSDKMessagingClient","UntagResourceCommand").f(UntagResourceRequestFilterSensitiveLog,void 0).ser(se_UntagResourceCommand).de(de_UntagResourceCommand).build(){}class UpdateChannelCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannel",{}).n("ChimeSDKMessagingClient","UpdateChannelCommand").f(UpdateChannelRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelCommand).de(de_UpdateChannelCommand).build(){}class UpdateChannelFlowCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelFlow",{}).n("ChimeSDKMessagingClient","UpdateChannelFlowCommand").f(UpdateChannelFlowRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelFlowCommand).de(de_UpdateChannelFlowCommand).build(){}class UpdateChannelMessageCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelMessage",{}).n("ChimeSDKMessagingClient","UpdateChannelMessageCommand").f(UpdateChannelMessageRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelMessageCommand).de(de_UpdateChannelMessageCommand).build(){}class UpdateChannelReadMarkerCommand extends Command.classBuilder().ep(commonParams).m(function(C,E,w,T){return[getSerdePlugin(w,this.serialize,this.deserialize),getEndpointPlugin(w,C.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelReadMarker",{}).n("ChimeSDKMessagingClient","UpdateChannelReadMarkerCommand").f(void 0,void 0).ser(se_UpdateChannelReadMarkerCommand).de(de_UpdateChannelReadMarkerCommand).build(){}const commands={AssociateChannelFlowCommand,BatchCreateChannelMembershipCommand,ChannelFlowCallbackCommand,CreateChannelCommand,CreateChannelBanCommand,CreateChannelFlowCommand,CreateChannelMembershipCommand,CreateChannelModeratorCommand,DeleteChannelCommand,DeleteChannelBanCommand,DeleteChannelFlowCommand,DeleteChannelMembershipCommand,DeleteChannelMessageCommand,DeleteChannelModeratorCommand,DeleteMessagingStreamingConfigurationsCommand,DescribeChannelCommand,DescribeChannelBanCommand,DescribeChannelFlowCommand,DescribeChannelMembershipCommand,DescribeChannelMembershipForAppInstanceUserCommand,DescribeChannelModeratedByAppInstanceUserCommand,DescribeChannelModeratorCommand,DisassociateChannelFlowCommand,GetChannelMembershipPreferencesCommand,GetChannelMessageCommand,GetChannelMessageStatusCommand,GetMessagingSessionEndpointCommand,GetMessagingStreamingConfigurationsCommand,ListChannelBansCommand,ListChannelFlowsCommand,ListChannelMembershipsCommand,ListChannelMembershipsForAppInstanceUserCommand,ListChannelMessagesCommand,ListChannelModeratorsCommand,ListChannelsCommand,ListChannelsAssociatedWithChannelFlowCommand,ListChannelsModeratedByAppInstanceUserCommand,ListSubChannelsCommand,ListTagsForResourceCommand,PutChannelExpirationSettingsCommand,PutChannelMembershipPreferencesCommand,PutMessagingStreamingConfigurationsCommand,RedactChannelMessageCommand,SearchChannelsCommand,SendChannelMessageCommand,TagResourceCommand,UntagResourceCommand,UpdateChannelCommand,UpdateChannelFlowCommand,UpdateChannelMessageCommand,UpdateChannelReadMarkerCommand};class ChimeSDKMessaging extends ChimeSDKMessagingClient{}createAggregatedClient(commands,ChimeSDKMessaging);const paginateListChannelBans=createPaginator(ChimeSDKMessagingClient,ListChannelBansCommand,"NextToken","NextToken","MaxResults"),paginateListChannelFlows=createPaginator(ChimeSDKMessagingClient,ListChannelFlowsCommand,"NextToken","NextToken","MaxResults"),paginateListChannelMembershipsForAppInstanceUser=createPaginator(ChimeSDKMessagingClient,ListChannelMembershipsForAppInstanceUserCommand,"NextToken","NextToken","MaxResults"),paginateListChannelMemberships=createPaginator(ChimeSDKMessagingClient,ListChannelMembershipsCommand,"NextToken","NextToken","MaxResults"),paginateListChannelMessages=createPaginator(ChimeSDKMessagingClient,ListChannelMessagesCommand,"NextToken","NextToken","MaxResults"),paginateListChannelModerators=createPaginator(ChimeSDKMessagingClient,ListChannelModeratorsCommand,"NextToken","NextToken","MaxResults"),paginateListChannelsAssociatedWithChannelFlow=createPaginator(ChimeSDKMessagingClient,ListChannelsAssociatedWithChannelFlowCommand,"NextToken","NextToken","MaxResults"),paginateListChannelsModeratedByAppInstanceUser=createPaginator(ChimeSDKMessagingClient,ListChannelsModeratedByAppInstanceUserCommand,"NextToken","NextToken","MaxResults"),paginateListChannels=createPaginator(ChimeSDKMessagingClient,ListChannelsCommand,"NextToken","NextToken","MaxResults"),paginateListSubChannels=createPaginator(ChimeSDKMessagingClient,ListSubChannelsCommand,"NextToken","NextToken","MaxResults"),paginateSearchChannels=createPaginator(ChimeSDKMessagingClient,SearchChannelsCommand,"NextToken","NextToken","MaxResults"),distEs$2=Object.freeze(Object.defineProperty({__proto__:null,$Command:Command,AllowNotifications,AssociateChannelFlowCommand,BadRequestException,BatchChannelMembershipsFilterSensitiveLog,BatchCreateChannelMembershipCommand,BatchCreateChannelMembershipResponseFilterSensitiveLog,ChannelAssociatedWithFlowSummaryFilterSensitiveLog,ChannelBanFilterSensitiveLog,ChannelBanSummaryFilterSensitiveLog,ChannelFilterSensitiveLog,ChannelFlowCallbackCommand,ChannelFlowCallbackRequestFilterSensitiveLog,ChannelFlowFilterSensitiveLog,ChannelFlowSummaryFilterSensitiveLog,ChannelMembershipFilterSensitiveLog,ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog,ChannelMembershipPreferencesFilterSensitiveLog,ChannelMembershipSummaryFilterSensitiveLog,ChannelMembershipType,ChannelMessageCallbackFilterSensitiveLog,ChannelMessageFilterSensitiveLog,ChannelMessagePersistenceType,ChannelMessageStatus,ChannelMessageSummaryFilterSensitiveLog,ChannelMessageType,ChannelMode,ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog,ChannelModeratorFilterSensitiveLog,ChannelModeratorSummaryFilterSensitiveLog,ChannelPrivacy,ChannelSummaryFilterSensitiveLog,ChimeSDKMessaging,ChimeSDKMessagingClient,ChimeSDKMessagingServiceException,ConflictException,CreateChannelBanCommand,CreateChannelBanResponseFilterSensitiveLog,CreateChannelCommand,CreateChannelFlowCommand,CreateChannelFlowRequestFilterSensitiveLog,CreateChannelMembershipCommand,CreateChannelMembershipResponseFilterSensitiveLog,CreateChannelModeratorCommand,CreateChannelModeratorResponseFilterSensitiveLog,CreateChannelRequestFilterSensitiveLog,DeleteChannelBanCommand,DeleteChannelCommand,DeleteChannelFlowCommand,DeleteChannelMembershipCommand,DeleteChannelMessageCommand,DeleteChannelModeratorCommand,DeleteMessagingStreamingConfigurationsCommand,DescribeChannelBanCommand,DescribeChannelBanResponseFilterSensitiveLog,DescribeChannelCommand,DescribeChannelFlowCommand,DescribeChannelFlowResponseFilterSensitiveLog,DescribeChannelMembershipCommand,DescribeChannelMembershipForAppInstanceUserCommand,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog,DescribeChannelMembershipResponseFilterSensitiveLog,DescribeChannelModeratedByAppInstanceUserCommand,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog,DescribeChannelModeratorCommand,DescribeChannelModeratorResponseFilterSensitiveLog,DescribeChannelResponseFilterSensitiveLog,DisassociateChannelFlowCommand,ErrorCode,ExpirationCriterion,FallbackAction,ForbiddenException,GetChannelMembershipPreferencesCommand,GetChannelMembershipPreferencesResponseFilterSensitiveLog,GetChannelMessageCommand,GetChannelMessageResponseFilterSensitiveLog,GetChannelMessageStatusCommand,GetMessagingSessionEndpointCommand,GetMessagingStreamingConfigurationsCommand,IdentityFilterSensitiveLog,InvocationType,ListChannelBansCommand,ListChannelBansRequestFilterSensitiveLog,ListChannelBansResponseFilterSensitiveLog,ListChannelFlowsCommand,ListChannelFlowsRequestFilterSensitiveLog,ListChannelFlowsResponseFilterSensitiveLog,ListChannelMembershipsCommand,ListChannelMembershipsForAppInstanceUserCommand,ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog,ListChannelMembershipsRequestFilterSensitiveLog,ListChannelMembershipsResponseFilterSensitiveLog,ListChannelMessagesCommand,ListChannelMessagesRequestFilterSensitiveLog,ListChannelMessagesResponseFilterSensitiveLog,ListChannelModeratorsCommand,ListChannelModeratorsRequestFilterSensitiveLog,ListChannelModeratorsResponseFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowCommand,ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog,ListChannelsCommand,ListChannelsModeratedByAppInstanceUserCommand,ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog,ListChannelsRequestFilterSensitiveLog,ListChannelsResponseFilterSensitiveLog,ListSubChannelsCommand,ListSubChannelsRequestFilterSensitiveLog,ListSubChannelsResponseFilterSensitiveLog,ListTagsForResourceCommand,ListTagsForResourceResponseFilterSensitiveLog,MessageAttributeValueFilterSensitiveLog,MessagingDataType,NotFoundException,ProcessorFilterSensitiveLog,PushNotificationConfigurationFilterSensitiveLog,PushNotificationPreferencesFilterSensitiveLog,PushNotificationType,PutChannelExpirationSettingsCommand,PutChannelMembershipPreferencesCommand,PutChannelMembershipPreferencesRequestFilterSensitiveLog,PutChannelMembershipPreferencesResponseFilterSensitiveLog,PutMessagingStreamingConfigurationsCommand,RedactChannelMessageCommand,ResourceLimitExceededException,SearchChannelsCommand,SearchChannelsRequestFilterSensitiveLog,SearchChannelsResponseFilterSensitiveLog,SearchFieldKey,SearchFieldOperator,SendChannelMessageCommand,SendChannelMessageRequestFilterSensitiveLog,ServiceFailureException,ServiceUnavailableException,SortOrder,TagFilterSensitiveLog,TagResourceCommand,TagResourceRequestFilterSensitiveLog,ThrottledClientException,UnauthorizedClientException,UntagResourceCommand,UntagResourceRequestFilterSensitiveLog,UpdateChannelCommand,UpdateChannelFlowCommand,UpdateChannelFlowRequestFilterSensitiveLog,UpdateChannelMessageCommand,UpdateChannelMessageRequestFilterSensitiveLog,UpdateChannelReadMarkerCommand,UpdateChannelRequestFilterSensitiveLog,__Client:Client,paginateListChannelBans,paginateListChannelFlows,paginateListChannelMemberships,paginateListChannelMembershipsForAppInstanceUser,paginateListChannelMessages,paginateListChannelModerators,paginateListChannels,paginateListChannelsAssociatedWithChannelFlow,paginateListChannelsModeratedByAppInstanceUser,paginateListSubChannels,paginateSearchChannels},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(distEs$2);var Message={},hasRequiredMessage;function requireMessage(){if(hasRequiredMessage)return Message;hasRequiredMessage=1,Object.defineProperty(Message,"__esModule",{value:!0});let x=class{constructor(C,E,w){this.type=C,this.headers=E,this.payload=w}};return Message.default=x,Message}var DefaultSigV4={},build$1={};/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var extendStatics=function(x,C){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,w){E.__proto__=w}||function(E,w){for(var T in w)w.hasOwnProperty(T)&&(E[T]=w[T])},extendStatics(x,C)};function __extends(x,C){extendStatics(x,C);function E(){this.constructor=x}x.prototype=C===null?Object.create(C):(E.prototype=C.prototype,new E)}var __assign=function(){return __assign=Object.assign||function(x){for(var C,E=1,w=arguments.length;E<w;E++){C=arguments[E];for(var T in C)Object.prototype.hasOwnProperty.call(C,T)&&(x[T]=C[T])}return x},__assign.apply(this,arguments)};function __rest(x,C){var E={};for(var w in x)Object.prototype.hasOwnProperty.call(x,w)&&C.indexOf(w)<0&&(E[w]=x[w]);if(x!=null&&typeof Object.getOwnPropertySymbols=="function")for(var T=0,w=Object.getOwnPropertySymbols(x);T<w.length;T++)C.indexOf(w[T])<0&&Object.prototype.propertyIsEnumerable.call(x,w[T])&&(E[w[T]]=x[w[T]]);return E}function __decorate(x,C,E,w){var T=arguments.length,_=T<3?C:w===null?w=Object.getOwnPropertyDescriptor(C,E):w,S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(x,C,E,w);else for(var R=x.length-1;R>=0;R--)(S=x[R])&&(_=(T<3?S(_):T>3?S(C,E,_):S(C,E))||_);return T>3&&_&&Object.defineProperty(C,E,_),_}function __param(x,C){return function(E,w){C(E,w,x)}}function __metadata(x,C){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(x,C)}function __awaiter(x,C,E,w){function T(_){return _ instanceof E?_:new E(function(S){S(_)})}return new(E||(E=Promise))(function(_,S){function R(H){try{O(w.next(H))}catch(ee){S(ee)}}function A(H){try{O(w.throw(H))}catch(ee){S(ee)}}function O(H){H.done?_(H.value):T(H.value).then(R,A)}O((w=w.apply(x,C||[])).next())})}function __generator(x,C){var E={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},w,T,_,S;return S={next:R(0),throw:R(1),return:R(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function R(O){return function(H){return A([O,H])}}function A(O){if(w)throw new TypeError("Generator is already executing.");for(;E;)try{if(w=1,T&&(_=O[0]&2?T.return:O[0]?T.throw||((_=T.return)&&_.call(T),0):T.next)&&!(_=_.call(T,O[1])).done)return _;switch(T=0,_&&(O=[O[0]&2,_.value]),O[0]){case 0:case 1:_=O;break;case 4:return E.label++,{value:O[1],done:!1};case 5:E.label++,T=O[1],O=[0];continue;case 7:O=E.ops.pop(),E.trys.pop();continue;default:if(_=E.trys,!(_=_.length>0&&_[_.length-1])&&(O[0]===6||O[0]===2)){E=0;continue}if(O[0]===3&&(!_||O[1]>_[0]&&O[1]<_[3])){E.label=O[1];break}if(O[0]===6&&E.label<_[1]){E.label=_[1],_=O;break}if(_&&E.label<_[2]){E.label=_[2],E.ops.push(O);break}_[2]&&E.ops.pop(),E.trys.pop();continue}O=C.call(x,E)}catch(H){O=[6,H],T=0}finally{w=_=0}if(O[0]&5)throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}}function __createBinding(x,C,E,w){w===void 0&&(w=E),x[w]=C[E]}function __exportStar(x,C){for(var E in x)E!=="default"&&!C.hasOwnProperty(E)&&(C[E]=x[E])}function __values(x){var C=typeof Symbol=="function"&&Symbol.iterator,E=C&&x[C],w=0;if(E)return E.call(x);if(x&&typeof x.length=="number")return{next:function(){return x&&w>=x.length&&(x=void 0),{value:x&&x[w++],done:!x}}};throw new TypeError(C?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(x,C){var E=typeof Symbol=="function"&&x[Symbol.iterator];if(!E)return x;var w=E.call(x),T,_=[],S;try{for(;(C===void 0||C-- >0)&&!(T=w.next()).done;)_.push(T.value)}catch(R){S={error:R}}finally{try{T&&!T.done&&(E=w.return)&&E.call(w)}finally{if(S)throw S.error}}return _}function __spread(){for(var x=[],C=0;C<arguments.length;C++)x=x.concat(__read(arguments[C]));return x}function __spreadArrays(){for(var x=0,C=0,E=arguments.length;C<E;C++)x+=arguments[C].length;for(var w=Array(x),T=0,C=0;C<E;C++)for(var _=arguments[C],S=0,R=_.length;S<R;S++,T++)w[T]=_[S];return w}function __await(x){return this instanceof __await?(this.v=x,this):new __await(x)}function __asyncGenerator(x,C,E){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var w=E.apply(x,C||[]),T,_=[];return T={},S("next"),S("throw"),S("return"),T[Symbol.asyncIterator]=function(){return this},T;function S(te){w[te]&&(T[te]=function(ie){return new Promise(function(ne,ae){_.push([te,ie,ne,ae])>1||R(te,ie)})})}function R(te,ie){try{A(w[te](ie))}catch(ne){ee(_[0][3],ne)}}function A(te){te.value instanceof __await?Promise.resolve(te.value.v).then(O,H):ee(_[0][2],te)}function O(te){R("next",te)}function H(te){R("throw",te)}function ee(te,ie){te(ie),_.shift(),_.length&&R(_[0][0],_[0][1])}}function __asyncDelegator(x){var C,E;return C={},w("next"),w("throw",function(T){throw T}),w("return"),C[Symbol.iterator]=function(){return this},C;function w(T,_){C[T]=x[T]?function(S){return(E=!E)?{value:__await(x[T](S)),done:T==="return"}:_?_(S):S}:_}}function __asyncValues(x){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var C=x[Symbol.asyncIterator],E;return C?C.call(x):(x=typeof __values=="function"?__values(x):x[Symbol.iterator](),E={},w("next"),w("throw"),w("return"),E[Symbol.asyncIterator]=function(){return this},E);function w(_){E[_]=x[_]&&function(S){return new Promise(function(R,A){S=x[_](S),T(R,A,S.done,S.value)})}}function T(_,S,R,A){Promise.resolve(A).then(function(O){_({value:O,done:R})},S)}}function __makeTemplateObject(x,C){return Object.defineProperty?Object.defineProperty(x,"raw",{value:C}):x.raw=C,x}function __importStar(x){if(x&&x.__esModule)return x;var C={};if(x!=null)for(var E in x)Object.hasOwnProperty.call(x,E)&&(C[E]=x[E]);return C.default=x,C}function __importDefault(x){return x&&x.__esModule?x:{default:x}}function __classPrivateFieldGet(x,C){if(!C.has(x))throw new TypeError("attempted to get private field on non-instance");return C.get(x)}function __classPrivateFieldSet(x,C,E){if(!C.has(x))throw new TypeError("attempted to set private field on non-instance");return C.set(x,E),E}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter,__classPrivateFieldGet,__classPrivateFieldSet,__createBinding,__decorate,__exportStar,__extends,__generator,__importDefault,__importStar,__makeTemplateObject,__metadata,__param,__read,__rest,__spread,__spreadArrays,__values},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(tslib_es6);var jsSha256={},constants={},hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,Object.defineProperty(constants,"__esModule",{value:!0}),constants.MAX_HASHABLE_LENGTH=constants.INIT=constants.KEY=constants.DIGEST_LENGTH=constants.BLOCK_SIZE=void 0,constants.BLOCK_SIZE=64,constants.DIGEST_LENGTH=32,constants.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),constants.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],constants.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1),constants}var RawSha256={},hasRequiredRawSha256;function requireRawSha256(){if(hasRequiredRawSha256)return RawSha256;hasRequiredRawSha256=1,Object.defineProperty(RawSha256,"__esModule",{value:!0}),RawSha256.RawSha256=void 0;var x=requireConstants(),C=function(){function E(){this.state=Int32Array.from(x.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return E.prototype.update=function(w){if(this.finished)throw new Error("Attempted to update an already finished hash.");var T=0,_=w.byteLength;if(this.bytesHashed+=_,this.bytesHashed*8>x.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;_>0;)this.buffer[this.bufferLength++]=w[T++],_--,this.bufferLength===x.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},E.prototype.digest=function(){if(!this.finished){var w=this.bytesHashed*8,T=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),_=this.bufferLength;if(T.setUint8(this.bufferLength++,128),_%x.BLOCK_SIZE>=x.BLOCK_SIZE-8){for(var S=this.bufferLength;S<x.BLOCK_SIZE;S++)T.setUint8(S,0);this.hashBuffer(),this.bufferLength=0}for(var S=this.bufferLength;S<x.BLOCK_SIZE-8;S++)T.setUint8(S,0);T.setUint32(x.BLOCK_SIZE-8,Math.floor(w/4294967296),!0),T.setUint32(x.BLOCK_SIZE-4,w),this.hashBuffer(),this.finished=!0}for(var R=new Uint8Array(x.DIGEST_LENGTH),S=0;S<8;S++)R[S*4]=this.state[S]>>>24&255,R[S*4+1]=this.state[S]>>>16&255,R[S*4+2]=this.state[S]>>>8&255,R[S*4+3]=this.state[S]>>>0&255;return R},E.prototype.hashBuffer=function(){for(var w=this,T=w.buffer,_=w.state,S=_[0],R=_[1],A=_[2],O=_[3],H=_[4],ee=_[5],te=_[6],ie=_[7],ne=0;ne<x.BLOCK_SIZE;ne++){if(ne<16)this.temp[ne]=(T[ne*4]&255)<<24|(T[ne*4+1]&255)<<16|(T[ne*4+2]&255)<<8|T[ne*4+3]&255;else{var ae=this.temp[ne-2],oe=(ae>>>17|ae<<15)^(ae>>>19|ae<<13)^ae>>>10;ae=this.temp[ne-15];var le=(ae>>>7|ae<<25)^(ae>>>18|ae<<14)^ae>>>3;this.temp[ne]=(oe+this.temp[ne-7]|0)+(le+this.temp[ne-16]|0)}var fe=(((H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7))+(H&ee^~H&te)|0)+(ie+(x.KEY[ne]+this.temp[ne]|0)|0)|0,de=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&R^S&A^R&A)|0;ie=te,te=ee,ee=H,H=O+fe|0,O=A,A=R,R=S,S=fe+de|0}_[0]+=S,_[1]+=R,_[2]+=A,_[3]+=O,_[4]+=H,_[5]+=ee,_[6]+=te,_[7]+=ie},E}();return RawSha256.RawSha256=C,RawSha256}var build={},convertToBuffer={};const fromUtf8$2=x=>{const C=[];for(let E=0,w=x.length;E<w;E++){const T=x.charCodeAt(E);if(T<128)C.push(T);else if(T<2048)C.push(T>>6|192,T&63|128);else if(E+1<x.length&&(T&64512)===55296&&(x.charCodeAt(E+1)&64512)===56320){const _=65536+((T&1023)<<10)+(x.charCodeAt(++E)&1023);C.push(_>>18|240,_>>12&63|128,_>>6&63|128,_&63|128)}else C.push(T>>12|224,T>>6&63|128,T&63|128)}return Uint8Array.from(C)},toUtf8$2=x=>{let C="";for(let E=0,w=x.length;E<w;E++){const T=x[E];if(T<128)C+=String.fromCharCode(T);else if(192<=T&&T<224){const _=x[++E];C+=String.fromCharCode((T&31)<<6|_&63)}else if(240<=T&&T<365){const _="%"+[T,x[++E],x[++E],x[++E]].map(S=>S.toString(16)).join("%");C+=decodeURIComponent(_)}else C+=String.fromCharCode((T&15)<<12|(x[++E]&63)<<6|x[++E]&63)}return C};function fromUtf8$1(x){return new TextEncoder().encode(x)}function toUtf8$1(x){return new TextDecoder("utf-8").decode(x)}const fromUtf8=x=>typeof TextEncoder=="function"?fromUtf8$1(x):fromUtf8$2(x),toUtf8=x=>typeof TextDecoder=="function"?toUtf8$1(x):toUtf8$2(x),distEs$1=Object.freeze(Object.defineProperty({__proto__:null,fromUtf8,toUtf8},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(distEs$1);var hasRequiredConvertToBuffer;function requireConvertToBuffer(){if(hasRequiredConvertToBuffer)return convertToBuffer;hasRequiredConvertToBuffer=1,Object.defineProperty(convertToBuffer,"__esModule",{value:!0}),convertToBuffer.convertToBuffer=void 0;var x=require$$0,C=typeof Buffer<"u"&&Buffer.from?function(w){return Buffer.from(w,"utf8")}:x.fromUtf8;function E(w){return w instanceof Uint8Array?w:typeof w=="string"?C(w):ArrayBuffer.isView(w)?new Uint8Array(w.buffer,w.byteOffset,w.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(w)}return convertToBuffer.convertToBuffer=E,convertToBuffer}var isEmptyData={},hasRequiredIsEmptyData;function requireIsEmptyData(){if(hasRequiredIsEmptyData)return isEmptyData;hasRequiredIsEmptyData=1,Object.defineProperty(isEmptyData,"__esModule",{value:!0}),isEmptyData.isEmptyData=void 0;function x(C){return typeof C=="string"?C.length===0:C.byteLength===0}return isEmptyData.isEmptyData=x,isEmptyData}var numToUint8={},hasRequiredNumToUint8;function requireNumToUint8(){if(hasRequiredNumToUint8)return numToUint8;hasRequiredNumToUint8=1,Object.defineProperty(numToUint8,"__esModule",{value:!0}),numToUint8.numToUint8=void 0;function x(C){return new Uint8Array([(C&4278190080)>>24,(C&16711680)>>16,(C&65280)>>8,C&255])}return numToUint8.numToUint8=x,numToUint8}var uint32ArrayFrom={},hasRequiredUint32ArrayFrom;function requireUint32ArrayFrom(){if(hasRequiredUint32ArrayFrom)return uint32ArrayFrom;hasRequiredUint32ArrayFrom=1,Object.defineProperty(uint32ArrayFrom,"__esModule",{value:!0}),uint32ArrayFrom.uint32ArrayFrom=void 0;function x(C){if(!Uint32Array.from){for(var E=new Uint32Array(C.length),w=0;w<C.length;)E[w]=C[w],w+=1;return E}return Uint32Array.from(C)}return uint32ArrayFrom.uint32ArrayFrom=x,uint32ArrayFrom}var hasRequiredBuild$2;function requireBuild$2(){return hasRequiredBuild$2||(hasRequiredBuild$2=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.uint32ArrayFrom=x.numToUint8=x.isEmptyData=x.convertToBuffer=void 0;var C=requireConvertToBuffer();Object.defineProperty(x,"convertToBuffer",{enumerable:!0,get:function(){return C.convertToBuffer}});var E=requireIsEmptyData();Object.defineProperty(x,"isEmptyData",{enumerable:!0,get:function(){return E.isEmptyData}});var w=requireNumToUint8();Object.defineProperty(x,"numToUint8",{enumerable:!0,get:function(){return w.numToUint8}});var T=requireUint32ArrayFrom();Object.defineProperty(x,"uint32ArrayFrom",{enumerable:!0,get:function(){return T.uint32ArrayFrom}})}(build)),build}var hasRequiredJsSha256;function requireJsSha256(){if(hasRequiredJsSha256)return jsSha256;hasRequiredJsSha256=1,Object.defineProperty(jsSha256,"__esModule",{value:!0}),jsSha256.Sha256=void 0;var x=require$$0$1,C=requireConstants(),E=requireRawSha256(),w=requireBuild$2(),T=function(){function S(R){if(this.hash=new E.RawSha256,R){this.outer=new E.RawSha256;var A=_(R),O=new Uint8Array(C.BLOCK_SIZE);O.set(A);for(var H=0;H<C.BLOCK_SIZE;H++)A[H]^=54,O[H]^=92;this.hash.update(A),this.outer.update(O);for(var H=0;H<A.byteLength;H++)A[H]=0}}return S.prototype.update=function(R){if(!((0,w.isEmptyData)(R)||this.error))try{this.hash.update((0,w.convertToBuffer)(R))}catch(A){this.error=A}},S.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},S.prototype.digest=function(){return x.__awaiter(this,void 0,void 0,function(){return x.__generator(this,function(R){return[2,this.digestSync()]})})},S}();jsSha256.Sha256=T;function _(S){var R=(0,w.convertToBuffer)(S);if(R.byteLength>C.BLOCK_SIZE){var A=new E.RawSha256;A.update(R),R=A.digest()}var O=new Uint8Array(C.BLOCK_SIZE);return O.set(R),O}return jsSha256}var hasRequiredBuild$1;function requireBuild$1(){return hasRequiredBuild$1||(hasRequiredBuild$1=1,function(x){Object.defineProperty(x,"__esModule",{value:!0});var C=require$$0$1;C.__exportStar(requireJsSha256(),x)}(build$1)),build$1}const SHORT_TO_HEX={},HEX_TO_SHORT={};for(let x=0;x<256;x++){let C=x.toString(16).toLowerCase();C.length===1&&(C=`0${C}`),SHORT_TO_HEX[x]=C,HEX_TO_SHORT[C]=x}function fromHex(x){if(x.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const C=new Uint8Array(x.length/2);for(let E=0;E<x.length;E+=2){const w=x.slice(E,E+2).toLowerCase();if(w in HEX_TO_SHORT)C[E/2]=HEX_TO_SHORT[w];else throw new Error(`Cannot decode unrecognized sequence ${w} as hexadecimal`)}return C}function toHex(x){let C="";for(let E=0;E<x.byteLength;E++)C+=SHORT_TO_HEX[x[E]];return C}const distEs=Object.freeze(Object.defineProperty({__proto__:null,fromHex,toHex},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(distEs);var hasRequiredDefaultSigV4;function requireDefaultSigV4(){if(hasRequiredDefaultSigV4)return DefaultSigV4;hasRequiredDefaultSigV4=1;var x=DefaultSigV4&&DefaultSigV4.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=DefaultSigV4&&DefaultSigV4.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(DefaultSigV4,"__esModule",{value:!0});const E=requireBuild$1(),w=require$$1,T=C(requireVersioning());let _=class{constructor(S){this.chimeClient=S}makeTwoDigits(S){return S>9?S.toString():"0"+S.toString()}hmac(S,R){const A=new E.Sha256(R);return A.update(S),A.digest()}getDateTimeString(){const S=new Date;return S.getUTCFullYear()+this.makeTwoDigits(S.getUTCMonth()+1)+this.makeTwoDigits(S.getUTCDate())+"T"+this.makeTwoDigits(S.getUTCHours())+this.makeTwoDigits(S.getUTCMinutes())+this.makeTwoDigits(S.getUTCSeconds())+"Z"}getDateString(S){return S.substring(0,S.indexOf("T"))}getSignatureKey(S,R,A,O){return x(this,void 0,void 0,function*(){const H=yield this.hmac(R,"AWS4"+S),ee=yield this.hmac(A,H),te=yield this.hmac(O,ee);return yield this.hmac("aws4_request",te)})}signURL(S,R,A,O,H,ee,te){return x(this,void 0,void 0,function*(){const ie=this.getDateTimeString(),ne=this.getDateString(ie),ae="AWS4-HMAC-SHA256";let oe="";this.chimeClient.config.region instanceof Function?oe=yield this.chimeClient.config.region():oe=this.chimeClient.config.region;const le="host",fe="host:"+O.toLowerCase()+`
`,de=ne+"/"+oe+"/"+A+"/aws4_request";let ce;this.chimeClient.config.credentials instanceof Function?ce=yield this.chimeClient.config.credentials():ce=this.chimeClient.config.credentials;let pe=new Map;pe.set("X-Amz-Algorithm",[ae]),pe.set("X-Amz-Credential",[encodeURIComponent(ce.accessKeyId+"/"+de)]),pe.set("X-Amz-Date",[ie]),pe.set("X-Amz-Expires",["10"]),pe.set("X-Amz-SignedHeaders",["host"]),ce.sessionToken&&pe.set("X-Amz-Security-Token",[encodeURIComponent(ce.sessionToken)]),pe.set(T.default.X_AMZN_VERSION,[encodeURIComponent(T.default.sdkVersion)]),pe.set(T.default.X_AMZN_USER_AGENT,[encodeURIComponent(T.default.sdkUserAgentLowResolution)]),te?.forEach((Ee,Ae)=>{const Ie=encodeURIComponent(Ae);Ee.sort().forEach(Te=>{pe.has(Ie)||pe.set(Ie,[]),pe.get(Ie).push(encodeURIComponent(Te))})});let he="";pe=new Map([...pe.entries()].sort()),pe.forEach((Ee,Ae)=>{Ee.forEach(Ie=>{he.length&&(he+="&"),he+=Ae+"="+Ie})});const me=S+`
`+H+`
`+he+`
`+fe+`
`+le+`
`+w.toHex(yield this.hmac(ee)),ve=w.toHex(yield this.hmac(me)),ye=`AWS4-HMAC-SHA256
`+ie+`
`+ne+"/"+oe+"/"+A+`/aws4_request
`+ve,Se=yield this.getSignatureKey(ce.secretAccessKey,ne,oe,A),Ce=w.toHex(yield this.hmac(ye,Se)),be=he+"&X-Amz-Signature="+Ce;return R+"://"+O+H+"?"+be})}};return DefaultSigV4.default=_,DefaultSigV4}var PrefetchOn={},hasRequiredPrefetchOn;function requirePrefetchOn(){if(hasRequiredPrefetchOn)return PrefetchOn;hasRequiredPrefetchOn=1,Object.defineProperty(PrefetchOn,"__esModule",{value:!0});var x;return function(C){C.Connect="connect"}(x||(x={})),PrefetchOn.default=x,PrefetchOn}var hasRequiredDefaultMessagingSession;function requireDefaultMessagingSession(){if(hasRequiredDefaultMessagingSession)return DefaultMessagingSession;hasRequiredDefaultMessagingSession=1;var x=DefaultMessagingSession&&DefaultMessagingSession.__awaiter||function(ie,ne,ae,oe){function le(fe){return fe instanceof ae?fe:new ae(function(de){de(fe)})}return new(ae||(ae=Promise))(function(fe,de){function ce(me){try{he(oe.next(me))}catch(ve){de(ve)}}function pe(me){try{he(oe.throw(me))}catch(ve){de(ve)}}function he(me){me.done?fe(me.value):le(me.value).then(ce,pe)}he((oe=oe.apply(ie,ne||[])).next())})},C=DefaultMessagingSession&&DefaultMessagingSession.__importDefault||function(ie){return ie&&ie.__esModule?ie:{default:ie}};Object.defineProperty(DefaultMessagingSession,"__esModule",{value:!0});const E=require$$0$2,w=C(requireFullJitterBackoff()),T=C(requireCSPMonitor()),_=C(requireMessage()),S=C(requireDefaultReconnectController()),R=C(requireAsyncScheduler()),A=C(requireDefaultSigV4()),O=C(requireDefaultWebSocketAdapter()),H=C(requireWebSocketReadyState()),ee=C(requirePrefetchOn());let te=class{constructor(ie,ne,ae,oe,le){this.configuration=ie,this.logger=ne,this.webSocket=ae,this.reconnectController=oe,this.sigV4=le,this.observerQueue=new Set,this.webSocket||(this.webSocket=new O.default(this.logger)),this.reconnectController||(this.reconnectController=new S.default(ie.reconnectTimeoutMs,new w.default(ie.reconnectFixedWaitMs,ie.reconnectShortBackoffMs,ie.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new A.default(this.configuration.chimeClient)),T.default.addLogger(this.logger),T.default.register(),this.preBootstrapMessages=[]}addObserver(ie){this.logger.info("adding messaging observer"),this.observerQueue.add(ie)}removeObserver(ie){this.logger.info("removing messaging observer"),this.observerQueue.delete(ie)}start(){return x(this,void 0,void 0,function*(){this.isClosed()?yield this.startConnecting(!1):this.logger.info("messaging session already started")})}stop(){this.isClosed()?this.logger.info("no existing messaging session needs closing"):(this.isClosing=!0,this.webSocket.close(),T.default.removeLogger(this.logger))}forEachObserver(ie){for(const ne of this.observerQueue)R.default.nextTick(()=>{this.observerQueue.has(ne)&&ie(ne)})}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.openEventHandler()}),this.webSocket.addEventListener("message",ie=>{this.receiveMessageHandler(ie.data)}),this.webSocket.addEventListener("close",ie=>{this.closeEventHandler(ie)}),this.webSocket.addEventListener("error",()=>{this.logger.error("WebSocket error")})}startConnecting(ie){return x(this,void 0,void 0,function*(){return yield this.startConnectingInternal(ie),yield new Promise((ne,ae)=>{this.bootstrapResolved=ne,this.bootstrapRejected=ae})})}startConnectingInternal(ie){var ne;return x(this,void 0,void 0,function*(){let ae=this.configuration.endpointUrl;if(ie||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),ie||ae===void 0)try{if(this.configuration.chimeClient.getMessagingSessionEndpoint instanceof Function){const le=yield this.configuration.chimeClient.getMessagingSessionEndpoint();!((ne=le.Endpoint)===null||ne===void 0)&&ne.Url?ae=le.Endpoint.Url:ae=(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}else ae=(yield this.configuration.chimeClient.send(new E.GetMessagingSessionEndpointCommand({}))).Endpoint.Url;this.logger.debug(`Messaging endpoint resolved to: ${ae}`)}catch(le){this.logger.error(`Messaging Session failed to resolve endpoint: ${le}`);const fe=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to get messaging session endpoint URL",bubbles:!1});this.closeEventHandler(fe);return}const oe=yield this.prepareWebSocketUrl(ae);this.logger.info(`opening connection to ${oe}`),ie||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(oe,[],!0),this.forEachObserver(le=>{le.messagingSessionDidStartConnecting&&le.messagingSessionDidStartConnecting(ie)}),this.setUpEventListeners()})}prepareWebSocketUrl(ie){return x(this,void 0,void 0,function*(){const ne=new Map;return ne.set("userArn",[this.configuration.userArn]),ne.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===ee.default.Connect&&ne.set("prefetch-on",[ee.default.Connect]),this.configuration.prefetchSortBy&&ne.set("prefetch-sort-by",[this.configuration.prefetchSortBy]),yield this.sigV4.signURL("GET","wss","chime",ie,"/connect","",ne)})}isClosed(){return this.webSocket.readyState()===H.default.None||this.webSocket.readyState()===H.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(ie){try{const ne=JSON.parse(ie),ae=ne.Headers["x-amz-chime-event-type"],oe=new _.default(ae,ne.Headers,ne.Payload||null);if(!this.isSessionEstablished&&ae==="SESSION_ESTABLISHED"){this.forEachObserver(fe=>{fe.messagingSessionDidStart&&fe.messagingSessionDidStart()}),this.bootstrapResolved(),this.isSessionEstablished=!0;const le=this.preBootstrapMessages.length;for(let fe=0;fe<le;fe++){const de=this.preBootstrapMessages.shift();this.forEachObserver(ce=>{this.sendMessageToObserver(ce,de)})}}else if(!this.isSessionEstablished){this.preBootstrapMessages.push(oe);return}this.forEachObserver(le=>{this.sendMessageToObserver(le,oe)})}catch(ne){this.logger.error(`Messaging parsing failed: ${ne}`)}}sendMessageToObserver(ie,ne){ie.messagingSessionDidReceiveMessage&&ie.messagingSessionDidReceiveMessage(ne)}retryConnection(){return this.reconnectController.retryWithBackoff(()=>x(this,void 0,void 0,function*(){yield this.startConnecting(!0)}),null)}closeEventHandler(ie){this.logger.info(`WebSocket close: ${ie.code} ${ie.reason}`),ie.code!==4999&&this.webSocket.destroy(),!(!this.isClosing&&this.canReconnect(ie.code)&&this.retryConnection())&&(this.isClosing=!1,this.isSessionEstablished?this.forEachObserver(ne=>{ne.messagingSessionDidStop&&ne.messagingSessionDidStop(ie)}):this.bootstrapRejected(ie))}canReconnect(ie){return ie===1001||ie===1006||ie>=1011&&ie<=1014||ie>4e3&&ie!==4002&&ie!==4003&&ie!==4401}};return DefaultMessagingSession.default=te,DefaultMessagingSession}var FullJitterBackoffFactory={},FullJitterLimitedBackoff={},hasRequiredFullJitterLimitedBackoff;function requireFullJitterLimitedBackoff(){if(hasRequiredFullJitterLimitedBackoff)return FullJitterLimitedBackoff;hasRequiredFullJitterLimitedBackoff=1;var x=FullJitterLimitedBackoff&&FullJitterLimitedBackoff.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(FullJitterLimitedBackoff,"__esModule",{value:!0});const C=x(requireFullJitterBackoff());let E=class extends C.default{constructor(w,T,_,S){super(w,T,_),this.limit=S,this.attempts=0}nextBackoffAmountMs(){if(this.attempts++,this.attempts>this.limit)throw new Error("retry limit exceeded");return super.nextBackoffAmountMs()}};return FullJitterLimitedBackoff.default=E,FullJitterLimitedBackoff}var hasRequiredFullJitterBackoffFactory;function requireFullJitterBackoffFactory(){if(hasRequiredFullJitterBackoffFactory)return FullJitterBackoffFactory;hasRequiredFullJitterBackoffFactory=1;var x=FullJitterBackoffFactory&&FullJitterBackoffFactory.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(FullJitterBackoffFactory,"__esModule",{value:!0});const C=x(requireFullJitterBackoff()),E=x(requireFullJitterLimitedBackoff());let w=class{constructor(T,_,S){this.fixedWaitMs=T,this.shortBackoffMs=_,this.longBackoffMs=S}create(){return new C.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(T){return new E.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,T)}};return FullJitterBackoffFactory.default=w,FullJitterBackoffFactory}var Log={},hasRequiredLog;function requireLog(){if(hasRequiredLog)return Log;hasRequiredLog=1,Object.defineProperty(Log,"__esModule",{value:!0});let x=class{constructor(C,E,w,T){this.sequenceNumber=C,this.message=E,this.timestampMs=w,this.logLevel=T}};return Log.default=x,Log}var MessagingSessionConfiguration={},hasRequiredMessagingSessionConfiguration;function requireMessagingSessionConfiguration(){if(hasRequiredMessagingSessionConfiguration)return MessagingSessionConfiguration;hasRequiredMessagingSessionConfiguration=1,Object.defineProperty(MessagingSessionConfiguration,"__esModule",{value:!0});const x=requireUtils();let C=class{constructor(E,w,T,_){this.userArn=E,this.messagingSessionId=w,this.endpointUrl=T,this.chimeClient=_,this.reconnectTimeoutMs=10*1e3,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1*1e3,this.reconnectLongBackoffMs=5*1e3,this.prefetchOn=void 0,this.prefetchSortBy=void 0,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){const E=new Uint32Array(1);return x.getRandomValues(E),E[0].toString()}};return MessagingSessionConfiguration.default=C,MessagingSessionConfiguration}var MultiLogger={},hasRequiredMultiLogger;function requireMultiLogger(){if(hasRequiredMultiLogger)return MultiLogger;hasRequiredMultiLogger=1;var x=MultiLogger&&MultiLogger.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(MultiLogger,"__esModule",{value:!0});const C=x(requireLogLevel());let E=class{constructor(...w){this._loggers=w}info(w){for(const T of this._loggers)T.info(w)}warn(w){for(const T of this._loggers)T.warn(w)}error(w){for(const T of this._loggers)T.error(w)}debug(w){let T,_;typeof w=="string"?_=w:w?_=()=>(T||(T=w()),T):_=""+w;for(const S of this._loggers)S.debug(_)}setLogLevel(w){for(const T of this._loggers)T.setLogLevel(w)}getLogLevel(){for(const w of this._loggers)return w.getLogLevel();return C.default.OFF}};return MultiLogger.default=E,MultiLogger}var NoOpAudioVideoController={},NoOpDebugLogger={},NoOpLogger={},hasRequiredNoOpLogger;function requireNoOpLogger(){if(hasRequiredNoOpLogger)return NoOpLogger;hasRequiredNoOpLogger=1;var x=NoOpLogger&&NoOpLogger.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(NoOpLogger,"__esModule",{value:!0});const C=x(requireLogLevel());let E=class{constructor(w=C.default.OFF){this.level=w}info(w){}warn(w){}error(w){}debug(w){C.default.DEBUG<this.level||typeof w!="string"&&w()}setLogLevel(w){this.level=w}getLogLevel(){return this.level}};return NoOpLogger.default=E,NoOpLogger}var hasRequiredNoOpDebugLogger;function requireNoOpDebugLogger(){if(hasRequiredNoOpDebugLogger)return NoOpDebugLogger;hasRequiredNoOpDebugLogger=1;var x=NoOpDebugLogger&&NoOpDebugLogger.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(NoOpDebugLogger,"__esModule",{value:!0});const C=x(requireLogLevel()),E=x(requireNoOpLogger());let w=class extends E.default{constructor(){super(C.default.DEBUG)}};return NoOpDebugLogger.default=w,NoOpDebugLogger}var NoOpMediaStreamBroker={},hasRequiredNoOpMediaStreamBroker;function requireNoOpMediaStreamBroker(){if(hasRequiredNoOpMediaStreamBroker)return NoOpMediaStreamBroker;hasRequiredNoOpMediaStreamBroker=1,Object.defineProperty(NoOpMediaStreamBroker,"__esModule",{value:!0});let x=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(C){return Promise.reject()}muteLocalAudioInputStream(){}unmuteLocalAudioInputStream(){}addMediaStreamBrokerObserver(C){}removeMediaStreamBrokerObserver(C){}};return NoOpMediaStreamBroker.default=x,NoOpMediaStreamBroker}var hasRequiredNoOpAudioVideoController;function requireNoOpAudioVideoController(){if(hasRequiredNoOpAudioVideoController)return NoOpAudioVideoController;hasRequiredNoOpAudioVideoController=1;var x=NoOpAudioVideoController&&NoOpAudioVideoController.__importDefault||function(ne){return ne&&ne.__esModule?ne:{default:ne}};Object.defineProperty(NoOpAudioVideoController,"__esModule",{value:!0});const C=x(requireFullJitterBackoff()),E=x(requireDefaultEventController()),w=x(requireNoOpDebugLogger()),T=x(requireNoOpMediaStreamBroker()),_=x(requireMeetingSessionConfiguration()),S=x(requireMeetingSessionCredentials()),R=x(requireMeetingSessionStatus()),A=x(requireMeetingSessionStatusCode()),O=x(requireMeetingSessionURLs()),H=x(requireDefaultReconnectController()),ee=x(requireDefaultWebSocketAdapter()),te=x(requireDefaultAudioVideoController());let ie=class extends te.default{constructor(ne){const ae=new _.default;ae.meetingId="",ae.externalMeetingId="",ae.credentials=new S.default,ae.credentials.attendeeId="",ae.credentials.joinToken="",ae.urls=new O.default,ae.urls.turnControlURL="",ae.urls.audioHostURL="",ae.urls.signalingURL="wss://localhost/";const oe=new w.default;super(ne||ae,oe,new ee.default(new w.default),new T.default,new H.default(0,new C.default(0,0,0)),new E.default(ne||ae,oe))}setAudioProfile(ne){}start(){}stop(){}promoteToPrimaryMeeting(ne){return Promise.resolve(new R.default(A.default.OK))}demoteFromPrimaryMeeting(){}};return NoOpAudioVideoController.default=ie,NoOpAudioVideoController}var NoOpDeviceController={},hasRequiredNoOpDeviceController;function requireNoOpDeviceController(){if(hasRequiredNoOpDeviceController)return NoOpDeviceController;hasRequiredNoOpDeviceController=1;var x=NoOpDeviceController&&NoOpDeviceController.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=NoOpDeviceController&&NoOpDeviceController.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(NoOpDeviceController,"__esModule",{value:!0}),NoOpDeviceController.NoOpDeviceControllerWithEventController=void 0;const E=C(requireNoOpMediaStreamBroker()),w=C(requireVideoQualitySettings());let T=class extends E.default{constructor(S){super(),this.destroyed=!1}destroy(){return x(this,void 0,void 0,function*(){this.destroyed=!0})}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}startAudioInput(S){return Promise.reject()}stopAudioInput(){return Promise.resolve()}startVideoInput(S){return Promise.reject()}stopVideoInput(){return Promise.resolve()}chooseAudioOutput(S){return Promise.reject()}addDeviceChangeObserver(S){}removeDeviceChangeObserver(S){}createAnalyserNodeForAudioInput(){return null}startVideoPreviewForVideoInput(S){}stopVideoPreviewForVideoInput(S){}setDeviceLabelTrigger(S){}mixIntoAudioInput(S){return null}chooseVideoInputQuality(S,R,A){}getVideoInputQualitySettings(){return w.default.VideoDisabled}};NoOpDeviceController.default=T;class _ extends T{constructor(R){super(),this.eventController=R}}return NoOpDeviceController.NoOpDeviceControllerWithEventController=_,NoOpDeviceController}var NoOpEventReporter={},hasRequiredNoOpEventReporter;function requireNoOpEventReporter(){if(hasRequiredNoOpEventReporter)return NoOpEventReporter;hasRequiredNoOpEventReporter=1,Object.defineProperty(NoOpEventReporter,"__esModule",{value:!0});let x=class{constructor(){}reportEvent(C,E,w){}start(){}stop(){}};return NoOpEventReporter.default=x,NoOpEventReporter}var NoOpTask={},hasRequiredNoOpTask;function requireNoOpTask(){if(hasRequiredNoOpTask)return NoOpTask;hasRequiredNoOpTask=1,Object.defineProperty(NoOpTask,"__esModule",{value:!0});let x=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(C){}};return NoOpTask.default=x,NoOpTask}var NoOpVideoElementFactory={},hasRequiredNoOpVideoElementFactory;function requireNoOpVideoElementFactory(){if(hasRequiredNoOpVideoElementFactory)return NoOpVideoElementFactory;hasRequiredNoOpVideoElementFactory=1,Object.defineProperty(NoOpVideoElementFactory,"__esModule",{value:!0});let x=class{create(){const C={clientWidth:400,clientHeight:300,width:400,height:300,videoWidth:400,videoHeight:300,style:{transform:""},hasAttribute:()=>!1,removeAttribute:()=>{},setAttribute:()=>{},srcObject:!1,paused:!0,pause:()=>{C.paused=!0},play:()=>(C.paused=!1,Promise.resolve())};return C}};return NoOpVideoElementFactory.default=x,NoOpVideoElementFactory}var NoVideoUplinkBandwidthPolicy={},hasRequiredNoVideoUplinkBandwidthPolicy;function requireNoVideoUplinkBandwidthPolicy(){if(hasRequiredNoVideoUplinkBandwidthPolicy)return NoVideoUplinkBandwidthPolicy;hasRequiredNoVideoUplinkBandwidthPolicy=1;var x=NoVideoUplinkBandwidthPolicy&&NoVideoUplinkBandwidthPolicy.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(NoVideoUplinkBandwidthPolicy,"__esModule",{value:!0});const C=x(requireDefaultVideoCaptureAndEncodeParameter());let E=class{constructor(){}updateConnectionMetric(w){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(w){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new C.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(w){}setHasBandwidthPriority(w){}setHighResolutionFeatureEnabled(w){}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!1}};return NoVideoUplinkBandwidthPolicy.default=E,NoVideoUplinkBandwidthPolicy}var POSTLogger={},hasRequiredPOSTLogger;function requirePOSTLogger(){if(hasRequiredPOSTLogger)return POSTLogger;hasRequiredPOSTLogger=1;var x=POSTLogger&&POSTLogger.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})},C=POSTLogger&&POSTLogger.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(POSTLogger,"__esModule",{value:!0});const E=C(requireIntervalScheduler()),w=C(requireLog()),T=C(requireLogLevel());let _=class Hd{constructor(R){this.logCapture=[],this.lock=!1,this.sequenceNumber=0;const{url:A,batchSize:O=Hd.BATCH_SIZE,intervalMs:H=Hd.INTERVAL_MS,logLevel:ee=T.default.WARN,metadata:te,headers:ie}=R;this.url=A,this.batchSize=O,this.intervalMs=H,this.logLevel=ee,this.metadata=te,this.headers=ie,this.start(),this.eventListener=()=>{this.stop()},this.addEventListener()}addEventListener(){!this.eventListener||!("window"in commonjsGlobal)||!window.addEventListener||window.addEventListener("unload",this.eventListener)}removeEventListener(){!this.eventListener||!("window"in commonjsGlobal)||!window.removeEventListener||window.removeEventListener("unload",this.eventListener)}debug(R){T.default.DEBUG<this.logLevel||(typeof R=="string"?this.log(T.default.DEBUG,R):R?this.log(T.default.DEBUG,R()):this.log(T.default.DEBUG,""+R))}info(R){this.log(T.default.INFO,R)}warn(R){this.log(T.default.WARN,R)}error(R){this.log(T.default.ERROR,R)}setLogLevel(R){this.logLevel=R}getLogLevel(){return this.logLevel}getLogCaptureSize(){return this.logCapture.length}start(){this.addEventListener(),this.intervalScheduler=new E.default(this.intervalMs),this.intervalScheduler.start(()=>x(this,void 0,void 0,function*(){if(this.lock===!0||this.getLogCaptureSize()===0)return;this.lock=!0;const R=this.logCapture.slice(0,this.batchSize),A=this.makeRequestBody(R);try{(yield fetch(this.url,Object.assign({method:"POST",body:A},this.headers?{headers:this.headers}:{}))).status===200&&(this.logCapture=this.logCapture.slice(R.length))}catch(O){console.warn("[POSTLogger] "+O.message)}finally{this.lock=!1}}))}stop(){var R;(R=this.intervalScheduler)===null||R===void 0||R.stop(),this.intervalScheduler=void 0,this.removeEventListener();const A=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,A)}destroy(){return x(this,void 0,void 0,function*(){this.stop(),this.metadata=void 0,this.headers=void 0,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.batchSize=0,this.intervalMs=0,this.url=void 0})}makeRequestBody(R){return JSON.stringify(Object.assign(Object.assign({},this.metadata),{logs:R}))}log(R,A){if(R<this.logLevel)return;const O=Date.now();this.logCapture.push(new w.default(this.sequenceNumber,A,O,T.default[R])),this.sequenceNumber+=1}};return POSTLogger.default=_,_.BATCH_SIZE=85,_.INTERVAL_MS=2e3,POSTLogger}var PrefetchSortBy={},hasRequiredPrefetchSortBy;function requirePrefetchSortBy(){if(hasRequiredPrefetchSortBy)return PrefetchSortBy;hasRequiredPrefetchSortBy=1,Object.defineProperty(PrefetchSortBy,"__esModule",{value:!0});var x;return function(C){C.Unread="unread",C.LastMessageTimestamp="last-message-timestamp"}(x||(x={})),PrefetchSortBy.default=x,PrefetchSortBy}var RealtimeAttendeePositionInFrame={},hasRequiredRealtimeAttendeePositionInFrame;function requireRealtimeAttendeePositionInFrame(){if(hasRequiredRealtimeAttendeePositionInFrame)return RealtimeAttendeePositionInFrame;hasRequiredRealtimeAttendeePositionInFrame=1,Object.defineProperty(RealtimeAttendeePositionInFrame,"__esModule",{value:!0});let x=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}};return RealtimeAttendeePositionInFrame.default=x,RealtimeAttendeePositionInFrame}var RunnableTask={},hasRequiredRunnableTask;function requireRunnableTask(){if(hasRequiredRunnableTask)return RunnableTask;hasRequiredRunnableTask=1;var x=RunnableTask&&RunnableTask.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(RunnableTask,"__esModule",{value:!0});const C=x(requireBaseTask());let E=class extends C.default{constructor(w,T,_="RunnableTask"){super(w),this.fn=T,this.taskName=_}run(){return this.fn().then(()=>{})}};return RunnableTask.default=E,RunnableTask}var SingleNodeAudioTransformDevice={},hasRequiredSingleNodeAudioTransformDevice;function requireSingleNodeAudioTransformDevice(){if(hasRequiredSingleNodeAudioTransformDevice)return SingleNodeAudioTransformDevice;hasRequiredSingleNodeAudioTransformDevice=1;var x=SingleNodeAudioTransformDevice&&SingleNodeAudioTransformDevice.__awaiter||function(E,w,T,_){function S(R){return R instanceof T?R:new T(function(A){A(R)})}return new(T||(T=Promise))(function(R,A){function O(te){try{ee(_.next(te))}catch(ie){A(ie)}}function H(te){try{ee(_.throw(te))}catch(ie){A(ie)}}function ee(te){te.done?R(te.value):S(te.value).then(O,H)}ee((_=_.apply(E,w||[])).next())})};Object.defineProperty(SingleNodeAudioTransformDevice,"__esModule",{value:!0});let C=class{constructor(E){this.inner=E}mute(E){return x(this,void 0,void 0,function*(){})}stop(){var E;return x(this,void 0,void 0,function*(){(E=this.node)===null||E===void 0||E.disconnect()})}intrinsicDevice(){return x(this,void 0,void 0,function*(){return this.inner})}createAudioNode(E){var w;return x(this,void 0,void 0,function*(){return(w=this.node)===null||w===void 0||w.disconnect(),this.node=yield this.createSingleAudioNode(E),{start:this.node,end:this.node}})}};return SingleNodeAudioTransformDevice.default=C,SingleNodeAudioTransformDevice}var TranscriptAlternative={},hasRequiredTranscriptAlternative;function requireTranscriptAlternative(){if(hasRequiredTranscriptAlternative)return TranscriptAlternative;hasRequiredTranscriptAlternative=1,Object.defineProperty(TranscriptAlternative,"__esModule",{value:!0});let x=class{};return TranscriptAlternative.default=x,TranscriptAlternative}var TranscriptEntity={},hasRequiredTranscriptEntity;function requireTranscriptEntity(){if(hasRequiredTranscriptEntity)return TranscriptEntity;hasRequiredTranscriptEntity=1,Object.defineProperty(TranscriptEntity,"__esModule",{value:!0});let x=class{};return TranscriptEntity.default=x,TranscriptEntity}var TranscriptItem={},hasRequiredTranscriptItem;function requireTranscriptItem(){if(hasRequiredTranscriptItem)return TranscriptItem;hasRequiredTranscriptItem=1,Object.defineProperty(TranscriptItem,"__esModule",{value:!0});let x=class{};return TranscriptItem.default=x,TranscriptItem}var TranscriptLanguageWithScore={},hasRequiredTranscriptLanguageWithScore;function requireTranscriptLanguageWithScore(){if(hasRequiredTranscriptLanguageWithScore)return TranscriptLanguageWithScore;hasRequiredTranscriptLanguageWithScore=1,Object.defineProperty(TranscriptLanguageWithScore,"__esModule",{value:!0});let x=class{};return TranscriptLanguageWithScore.default=x,TranscriptLanguageWithScore}var TranscriptResult={},hasRequiredTranscriptResult;function requireTranscriptResult(){if(hasRequiredTranscriptResult)return TranscriptResult;hasRequiredTranscriptResult=1,Object.defineProperty(TranscriptResult,"__esModule",{value:!0});let x=class{};return TranscriptResult.default=x,TranscriptResult}var VideoFxProcessor={},DeferredPromise={},hasRequiredDeferredPromise;function requireDeferredPromise(){if(hasRequiredDeferredPromise)return DeferredPromise;hasRequiredDeferredPromise=1,Object.defineProperty(DeferredPromise,"__esModule",{value:!0}),DeferredPromise.DeferredPromise=void 0;let x=class{constructor(){this.promise=new Promise((C,E)=>{this.resolve=C,this.reject=E})}getPromise(){return this.promise}resolvePromise(C){this.resolve(C)}resolveAndReplacePromise(C){this.resolve(C),this.promise=new Promise((E,w)=>{this.resolve=E,this.reject=w})}rejectPromise(C){this.reject(C)}rejectAndReplacePromise(C){this.reject(C),this.promise=new Promise((E,w)=>{this.resolve=E,this.reject=w})}};return DeferredPromise.DeferredPromise=x,DeferredPromise}var VideoFxCanvasOpsManager={},VideoFxConstants={},hasRequiredVideoFxConstants;function requireVideoFxConstants(){return hasRequiredVideoFxConstants||(hasRequiredVideoFxConstants=1,function(x){Object.defineProperty(x,"__esModule",{value:!0}),x.DEFAULT_VIDEO_FX_SPEC=x.FXLIB_PATH=x.WORKER_PATH=x.CDN_BASE_PATH=x.RESOURCE_CONSTRAINTS=x.SEGMENTATION_MODEL=x.DEFAULT_STREAM_PARAMETERS=x.WORKER_MSG=void 0,x.WORKER_MSG={BUILD_ENGINE_REQUEST:"BuildEngineRequest",BUILD_ENGINE_RESPONSE:"BuildEngineResponse",PERFORM_SEGMENTATION_REQUEST:"PerformSegmentationRequest",PERFORM_SEGMENTATION_RESPONSE:"PerformSegmentationResponse",PERFORM_SEGMENTATION_SAB_REQUEST:"PerformSegmentationSABRequest",PERFORM_SEGMENTATION_SAB_RESPONSE:"PerformSegmentationSABResponse",DESTROY_ASSETS_REQUEST:"DestroyAssetsRequest",DESTROY_ASSETS_RESPONSE:"DestroyAssetsResponse",CLOSE_WORKER_REQUEST:"CloseWorkerRequest"},x.DEFAULT_STREAM_PARAMETERS={FRAMES_PER_SECOND:15,WIDTH_IN_PIXEL:960,HEIGHT_IN_PIXEL:540,CHANNEL_COUNT:4},x.SEGMENTATION_MODEL={LOAD_SUCCESS:2,WIDTH_IN_PIXELS:176,HEIGHT_IN_PIXELS:160},x.RESOURCE_CONSTRAINTS={DEFAULT_PROCESSING_BUDGET_PER_FRAME:50,SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION:1,SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT:500,BLUR_DEFAULT_CYCLE_PERCENTAGE:10,BLUR_SAMPLING_PERIOD_FRAME_COUNT:1e3,MIN_PROCESSING_BUDGET:0,MAX_PROCESSING_BUDGET:100},x.CDN_BASE_PATH="https://static.sdkassets.chime.aws";const C="/ml_media_fx/otherassets";x.WORKER_PATH=`${C}/worker.js`,x.FXLIB_PATH=`${C}/fxlib.js`,x.DEFAULT_VIDEO_FX_SPEC={paths:{cdnBasePath:x.CDN_BASE_PATH,workerPath:x.WORKER_PATH,fxLibPath:x.FXLIB_PATH}}}(VideoFxConstants)),VideoFxConstants}var hasRequiredVideoFxCanvasOpsManager;function requireVideoFxCanvasOpsManager(){if(hasRequiredVideoFxCanvasOpsManager)return VideoFxCanvasOpsManager;hasRequiredVideoFxCanvasOpsManager=1;var x=VideoFxCanvasOpsManager&&VideoFxCanvasOpsManager.__awaiter||function(w,T,_,S){function R(A){return A instanceof _?A:new _(function(O){O(A)})}return new(_||(_=Promise))(function(A,O){function H(ie){try{te(S.next(ie))}catch(ne){O(ne)}}function ee(ie){try{te(S.throw(ie))}catch(ne){O(ne)}}function te(ie){ie.done?A(ie.value):R(ie.value).then(H,ee)}te((S=S.apply(w,T||[])).next())})};Object.defineProperty(VideoFxCanvasOpsManager,"__esModule",{value:!0}),VideoFxCanvasOpsManager.VideoFxCanvasOpsManager=void 0;const C=requireVideoFxConstants();let E=class{constructor(w,T){this.streamParameters=w,this.outputCanvas=T,this.configureCanvasPipeline()}getInferenceInputData(w){return this.inferenceCtx.save(),this.inferenceCtx.scale(this.horizontalResizeScalar,this.verticalResizeScalar),this.inferenceCtx.drawImage(w,0,0),this.inferenceCtx.restore(),this.inferenceCtx.getImageData(0,0,C.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,C.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS)}configureForStreamParameters(w){return x(this,void 0,void 0,function*(){if(this.streamParameters=w,this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.backgroundReplacementCanvas){const T=document.createElement("canvas");T.width=this.streamParameters.width,T.height=this.streamParameters.height,T.getContext("2d").drawImage(this.backgroundReplacementCanvas,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=T}this.configureCanvasPipeline()})}configureCanvasPipeline(){this.inferenceCanvas=document.createElement("canvas"),this.inferenceCtx=this.inferenceCanvas.getContext("2d",{willReadFrequently:!0}),this.inferenceCanvas.width=C.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,this.inferenceCanvas.height=C.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.horizontalResizeScalar=C.SEGMENTATION_MODEL.WIDTH_IN_PIXELS/this.streamParameters.width,this.verticalResizeScalar=C.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS/this.streamParameters.height}getBackgroundReplacementCanvas(){return this.backgroundReplacementCanvas}loadReplacementBackground(w){return x(this,void 0,void 0,function*(){const T=w.backgroundReplacement.backgroundImageURL,_=w.backgroundReplacement.defaultColor;if(T)try{const S=yield this.loadImage(T);this.backgroundReplacementImage=S,this.resizeAndSetReplacementImage(this.backgroundReplacementImage)}catch(S){throw this.logger.error(S),new Error("Failed to set the replacement image.")}else this.resizeAndSetReplacementColor(_)})}resizeAndSetReplacementImage(w){const T=document.createElement("canvas"),_=T.getContext("2d");T.width=this.streamParameters.width,T.height=this.streamParameters.height,_.drawImage(w,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=T}resizeAndSetReplacementColor(w){const T=document.createElement("canvas"),_=T.getContext("2d");T.width=this.streamParameters.width,T.height=this.streamParameters.height,_.fillStyle=w,_.fillRect(0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=T}loadImage(w){return x(this,void 0,void 0,function*(){const T=yield(yield fetch(w).catch(S=>{throw this.logger.error(S.toString()),new Error("Failed to fetch image.")})).blob(),_=new Image;return _.src=URL.createObjectURL(T),new Promise((S,R)=>{_.onload=()=>{S(_)},_.onerror=A=>{R(A)}})})}};return VideoFxCanvasOpsManager.VideoFxCanvasOpsManager=E,VideoFxCanvasOpsManager}var VideoFxSegmentationRateManager={},hasRequiredVideoFxSegmentationRateManager;function requireVideoFxSegmentationRateManager(){if(hasRequiredVideoFxSegmentationRateManager)return VideoFxSegmentationRateManager;hasRequiredVideoFxSegmentationRateManager=1,Object.defineProperty(VideoFxSegmentationRateManager,"__esModule",{value:!0}),VideoFxSegmentationRateManager.VideoFxSegmentationRateManager=void 0;const x=requireVideoFxConstants();let C=class{constructor(E,w){this.logger=E,this.targetSegmentationCyclePercentage=w/100,this.frameCountOverSamplingPeriod=0,this.totalSegmentationDurationOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now(),this.framesPerSegmentation=x.RESOURCE_CONSTRAINTS.SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION}submitFrame(){this.frameCountOverSamplingPeriod++}shouldApplySegmentation(){return this.frameCountOverSamplingPeriod%this.framesPerSegmentation===0}startSegmentation(){this.frameSegmentationStartTime=performance.now()}completeSegmentation(){this.totalSegmentationDurationOverSamplingPeriod+=performance.now()-this.frameSegmentationStartTime,this.frameCountOverSamplingPeriod>=x.RESOURCE_CONSTRAINTS.SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT&&this.adjustFramesPerSegmentation(this.totalSegmentationDurationOverSamplingPeriod/(performance.now()-this.samplingPeriodStartTime))}adjustFramesPerSegmentation(E){E>this.targetSegmentationCyclePercentage?(this.framesPerSegmentation++,this.logger.info(`Segmentation cycle percentage above the configured maximal value. Decreasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)):this.framesPerSegmentation>1&&E<this.targetSegmentationCyclePercentage&&(this.framesPerSegmentation--,this.logger.info(`Segmentation cycle percentage below the configured maximal value. Increasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)),this.totalSegmentationDurationOverSamplingPeriod=0,this.frameCountOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now()}};return VideoFxSegmentationRateManager.VideoFxSegmentationRateManager=C,VideoFxSegmentationRateManager}var hasRequiredVideoFxProcessor;function requireVideoFxProcessor(){if(hasRequiredVideoFxProcessor)return VideoFxProcessor;hasRequiredVideoFxProcessor=1;var x=VideoFxProcessor&&VideoFxProcessor.__awaiter||function(ae,oe,le,fe){function de(ce){return ce instanceof le?ce:new le(function(pe){pe(ce)})}return new(le||(le=Promise))(function(ce,pe){function he(ye){try{ve(fe.next(ye))}catch(Se){pe(Se)}}function me(ye){try{ve(fe.throw(ye))}catch(Se){pe(Se)}}function ve(ye){ye.done?ce(ye.value):de(ye.value).then(he,me)}ve((fe=fe.apply(ae,oe||[])).next())})},C=VideoFxProcessor&&VideoFxProcessor.__importDefault||function(ae){return ae&&ae.__esModule?ae:{default:ae}};Object.defineProperty(VideoFxProcessor,"__esModule",{value:!0});const E=requireFetch(),w=requireLoader(),T=requireSupport(),_=C(requireDefaultBrowserBehavior()),S=C(requireNoOpLogger()),R=requireUtils(),A=C(requireVersioning()),O=C(requireCanvasVideoFrameBuffer()),H=requireDeferredPromise(),ee=requireVideoFxCanvasOpsManager(),te=requireVideoFxConstants(),ie=requireVideoFxSegmentationRateManager();let ne=class Xs{constructor(oe,le=te.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,fe){this.logger=oe,this.outputCanvas=document.createElement("canvas"),this.canvasVideoFrameBuffer=new O.default(this.outputCanvas),this.videoFxSpec=te.DEFAULT_VIDEO_FX_SPEC;try{this.validateProcessingBudgetPerFrame(le)}catch(de){throw this.logger.error(de),new Error(`Cannot instantiate VideoFxProcessor due to invalid processingBudgetPerFrame of ${le}`)}fe&&(this.eventController=fe),this.effectConfig={backgroundBlur:{isEnabled:!1,strength:"low"},backgroundReplacement:{isEnabled:!1,backgroundImageURL:null,defaultColor:"black"}},this.segmentationRequestPromise=new H.DeferredPromise,this.segmentationRateManager=new ie.VideoFxSegmentationRateManager(this.logger,le),this.streamParameters={framerate:te.DEFAULT_STREAM_PARAMETERS.FRAMES_PER_SECOND,width:te.DEFAULT_STREAM_PARAMETERS.WIDTH_IN_PIXEL,height:te.DEFAULT_STREAM_PARAMETERS.HEIGHT_IN_PIXEL,channels:te.DEFAULT_STREAM_PARAMETERS.CHANNEL_COUNT},Xs.isSharedArrayBufferSupported&&(this.sharedImageBuffer=new SharedArrayBuffer(te.SEGMENTATION_MODEL.WIDTH_IN_PIXELS*te.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS*this.streamParameters.channels),this.sharedImageData=new Uint8ClampedArray(this.sharedImageBuffer)),this.logger.info(`VideoFx supports Shared Array Buffer: ${Xs.isSharedArrayBufferSupported}`),this.canvasOpsManager=new ee.VideoFxCanvasOpsManager(this.streamParameters,this.outputCanvas),this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.segmentationMask=new ImageData(this.streamParameters.width,this.streamParameters.height),this.logger.info(`VideoFxProcessor instantiated with a processingBudgetPerFrame of ${le}`)}process(oe){return x(this,void 0,void 0,function*(){return oe})}fxProcess(oe){return x(this,void 0,void 0,function*(){const le=oe[0].asCanvasElement();this.didStreamParametersChange(le)&&(yield this.adjustProcessorForNewStreamParameters(le));try{yield this.manageSegmentationMask(le)}catch(fe){throw this.logger.error(fe),new Error("Video stream could not be processed")}return yield this.renderer.render(le,this.segmentationMask),oe[0]=this.canvasVideoFrameBuffer,oe})}noOpProcess(oe){return x(this,void 0,void 0,function*(){return oe})}didStreamParametersChange(oe){return oe.width!==this.streamParameters.width||oe.height!==this.streamParameters.height}adjustProcessorForNewStreamParameters(oe){return x(this,void 0,void 0,function*(){this.streamParameters.width=oe.width,this.streamParameters.height=oe.height,yield this.canvasOpsManager.configureForStreamParameters(this.streamParameters),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,this.effectConfig)})}destroy(){return x(this,void 0,void 0,function*(){this.canvasVideoFrameBuffer.destroy(),this.fxLibScript&&this.fxLibScript.parentNode&&this.fxLibScript.parentNode.removeChild(this.fxLibScript),this.engineWorker&&(this.destroyedAssetsPromise=new H.DeferredPromise,this.engineWorker.postMessage({msg:te.WORKER_MSG.DESTROY_ASSETS_REQUEST}),yield this.destroyedAssetsPromise.getPromise(),this.engineWorker.postMessage({msg:te.WORKER_MSG.CLOSE_WORKER_REQUEST})),this.logger.info("VideoFxProcessor destroyed.")})}manageSegmentationMask(oe){return x(this,void 0,void 0,function*(){try{if(this.segmentationRateManager.submitFrame(),this.segmentationRateManager.shouldApplySegmentation()){this.segmentationRateManager.startSegmentation();const le=this.canvasOpsManager.getInferenceInputData(oe);this.segmentationMask=yield this.generateSegmentationMask(le),this.segmentationRateManager.completeSegmentation()}}catch(le){throw this.logger.error(le.toString()),new Error("Can not properly manage the returned segmentation mask")}})}generateSegmentationMask(oe){return x(this,void 0,void 0,function*(){Xs.isSharedArrayBufferSupported?(this.sharedImageData.set(oe.data),this.engineWorker.postMessage({msg:te.WORKER_MSG.PERFORM_SEGMENTATION_SAB_REQUEST,payload:this.sharedImageBuffer})):this.engineWorker.postMessage({msg:te.WORKER_MSG.PERFORM_SEGMENTATION_REQUEST,payload:oe},[oe.data.buffer]);try{return yield this.segmentationRequestPromise.getPromise()}catch(le){throw this.logger.error(le.toString()),new Error("Segmentation mask could not be generated")}})}cloneConfigFrom(oe){return{backgroundBlur:{isEnabled:oe.backgroundBlur.isEnabled,strength:oe.backgroundBlur.strength},backgroundReplacement:{isEnabled:oe.backgroundReplacement.isEnabled,backgroundImageURL:oe.backgroundReplacement.backgroundImageURL,defaultColor:oe.backgroundReplacement.defaultColor}}}setVideoFxSpec(oe){oe.paths&&(this.videoFxSpec.paths=oe.paths)}setEffectConfig(oe){return x(this,void 0,void 0,function*(){if(this.sameVideoFxConfig(oe,this.effectConfig))return;const le=this.cloneConfigFrom(oe);try{yield this.validateEffectConfig(le)}catch(fe){throw this.logger.error(fe.toString()),new Error("Provided effect config is invalid, not updating VideoFxProcessor")}le.backgroundReplacement.isEnabled&&(yield this.canvasOpsManager.loadReplacementBackground(le),yield this.renderer.setBackgroundReplacementCanvas(this.canvasOpsManager.getBackgroundReplacementCanvas())),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,le),this.effectConfig=le,!this.effectConfig.backgroundBlur.isEnabled&&!this.effectConfig.backgroundReplacement.isEnabled?this.process=this.noOpProcess:this.process=this.fxProcess,this.logger.info(`VideoFxProcessor effect configuration updated to: ${JSON.stringify(this.effectConfig)}`),this.eventController&&this.publishVideoFxConfigEvent()})}validateEffectConfig(oe){return x(this,void 0,void 0,function*(){if(oe.backgroundBlur.isEnabled&&oe.backgroundReplacement.isEnabled)throw new Error("Invalid VideoFx configuration: Background Blur and Background Replacement can not both be enabled");oe.backgroundReplacement.isEnabled&&(yield this.validateReplacementConfig(oe))})}validateReplacementConfig(oe){return x(this,void 0,void 0,function*(){if(oe.backgroundReplacement.backgroundImageURL&&oe.backgroundReplacement.defaultColor)throw new Error("Invalid VideoFx configuration: Background Replacement can not have both an image URL and default color");if(!oe.backgroundReplacement.backgroundImageURL&&!oe.backgroundReplacement.defaultColor)throw new Error("Invalid VideoFx configuration: Background Replacement image URL and default can not both be null/undefined");try{oe.backgroundReplacement.backgroundImageURL&&(yield this.canvasOpsManager.loadImage(oe.backgroundReplacement.backgroundImageURL))}catch(fe){throw this.logger.error(fe.toString()),new Error("Invalid VideoFx configuration: backgroundImageURL failed to load")}const le=oe.backgroundReplacement.defaultColor;if(le&&le!=="black"&&le!=="#000000"&&le!=="#000"){if(le.includes("#")&&!new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).test(le))throw new Error(`Invalid hexadecimal color code for default replacement background: ${le}`);const fe=document.createElement("canvas").getContext("2d"),de=fe.fillStyle;if(fe.fillStyle=le,fe.fillStyle===de)throw new Error(`Invalid color for default replacement background: ${le}`)}})}validateProcessingBudgetPerFrame(oe){if(oe<te.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET||oe>te.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET)throw new Error(`Invalid resource constraint: cycle percentage must be within range of ${te.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET} and ${te.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET}`)}loadAssets(){return x(this,void 0,void 0,function*(){this.logger.info("Loading required assets for the VideoFxProcessor");try{const oe=this.getVideoFxAssetParams();yield this.loadEngineWorker(oe),yield this.buildEngine(oe),yield this.loadFxLib(oe),this.renderer=constructRenderer(te.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,te.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.effectConfig,this.outputCanvas)}catch(oe){throw this.logger.error(oe.toString()),new Error("Failed to load necessary assets for the VideoFxProcessor")}this.logger.info("Finished loading of essential VideoFxProcessor assets.")})}getVideoFxAssetParams(){const oe=R.getDefaultAssetSpec();return{assetGroup:oe.assetGroup,revisionID:oe.revisionID,sdk:encodeURIComponent(A.default.sdkVersion),ua:encodeURIComponent(A.default.sdkUserAgentLowResolution)}}getPathFromVideoFxAssetParams(oe,le){const fe=new URL(oe);for(const[de,ce]of Object.entries(le))if(ce!==void 0){const pe=encodeURIComponent(de),he=encodeURIComponent(ce);fe.searchParams.set(pe,he)}return fe.toString()}loadEngineWorker(oe){return x(this,void 0,void 0,function*(){try{const le=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.workerPath,oe);this.engineWorker=yield w.loadWorker(le,"VideoFxEngineWorker",{},null),this.logger.info("Successfully loaded the VideoFxProcessor's engine worker"),this.engineWorker.addEventListener("message",fe=>this.engineWorkerReceiver(fe))}catch(le){throw this.logger.error(le.toString()),new Error("Failed to load the VideoFxProcessor's engine worker")}})}buildEngine(oe){return x(this,void 0,void 0,function*(){this.buildEnginePromise=new H.DeferredPromise,this.engineWorker.postMessage({msg:te.WORKER_MSG.BUILD_ENGINE_REQUEST,payload:{cdnBasePath:this.videoFxSpec.paths.cdnBasePath,sdkVersioningParams:oe}});try{yield this.buildEnginePromise.getPromise()}catch(le){throw this.logger.error(le.toString()),new Error("Failed to instantiate the VideoFxEngine")}})}loadFxLib(oe){return x(this,void 0,void 0,function*(){const le=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.fxLibPath,oe),fe={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};try{const de=yield E.fetchWithBehavior(le,fe,{});if(!de.ok)throw new Error("Fetch failed.");const ce=window.URL.createObjectURL(yield de.blob());yield new Promise((pe,he)=>{this.fxLibScript=document.createElement("script"),this.fxLibScript.setAttribute("src",ce),this.fxLibScript.setAttribute("type","module"),this.fxLibScript.setAttribute("async","false"),this.fxLibScript.addEventListener("load",pe),this.fxLibScript.addEventListener("error",he),document.body.appendChild(this.fxLibScript)})}catch(de){throw this.logger.error(de.toString()),new Error("Failed to load the fxlib")}})}getEffectConfig(){return this.cloneConfigFrom(this.effectConfig)}engineWorkerReceiver(oe){const le=oe.data;switch(le.msg){case te.WORKER_MSG.BUILD_ENGINE_RESPONSE:this.settleEngineBuildPromise(le.payload);break;case te.WORKER_MSG.PERFORM_SEGMENTATION_RESPONSE:this.settleSegmentationPromise(le.payload.output);break;case te.WORKER_MSG.PERFORM_SEGMENTATION_SAB_RESPONSE:this.settleSegmentationPromiseSAB();break;case te.WORKER_MSG.DESTROY_ASSETS_RESPONSE:this.destroyedAssetsPromise.resolvePromise();break;default:this.logger.info(`VideoFx worker received unknown event msg: ${JSON.stringify(le)}`);break}}settleEngineBuildPromise(oe){oe!==te.SEGMENTATION_MODEL.LOAD_SUCCESS?this.buildEnginePromise.rejectPromise(new Error("Failed to build VideoFxProcessor's engine")):(this.logger.info("Successfully built the VideoFxEngine"),this.buildEnginePromise.resolvePromise())}settleSegmentationPromise(oe){oe?this.segmentationRequestPromise.resolveAndReplacePromise(oe):this.segmentationRequestPromise.rejectAndReplacePromise(new Error("Failed to perform a segmentation on the input image"))}settleSegmentationPromiseSAB(){try{const oe=new ImageData(new Uint8ClampedArray(this.sharedImageData),te.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,te.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS);this.segmentationRequestPromise.resolveAndReplacePromise(oe)}catch{this.segmentationRequestPromise.rejectAndReplacePromise(new Error("Failed to perform a segmentation with a shared array buffer on the input image"))}}setToNoOpProcess(){this.process=this.noOpProcess}static isSupported(oe=new S.default,le=!0){return x(this,void 0,void 0,function*(){let fe=!0;const de=(he,me)=>{he&&(oe.info(me),fe=!1)};de(typeof globalThis>"u","Browser does not have globalThis."),de(!T.supportsWorker(globalThis,oe),"Browser does not support web workers."),de(!T.supportsWASM(globalThis,oe),"Browser does not support wasm."),de(!document.createElement("canvas").getContext("webgl2"),"Browser does not support webgl.");const ce=new _.default;de(!ce.isVideoFxSupportedBrowser(),"Browser is unsupported for VideoFxProcessor");const pe=()=>x(this,void 0,void 0,function*(){if(le)try{const he=new Xs(oe);yield he.loadAssets(),yield he.destroy()}catch{return oe.info("Browser environment is unable to access the required external assets."),Promise.resolve(!1)}return Promise.resolve(!0)});return Promise.resolve(fe?yield pe():!1)})}static create(oe,le,fe=te.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,de){return x(this,void 0,void 0,function*(){const ce=new Xs(oe,fe);de&&ce.setVideoFxSpec(de);try{return yield ce.loadAssets(),yield ce.setEffectConfig(le),ce}catch(pe){throw oe.error(pe.toString()),ce.setToNoOpProcess(),new Error("VideoFxProcessor built with support for only NoOp processing")}})}setEventController(oe){this.eventController?this.eventController=oe:(this.eventController=oe,this.publishVideoFxConfigEvent())}publishVideoFxConfigEvent(){const oe={backgroundBlurEnabled:this.effectConfig.backgroundBlur.isEnabled.toString(),backgroundBlurStrength:this.effectConfig.backgroundBlur.strength,backgroundReplacementEnabled:this.effectConfig.backgroundReplacement.isEnabled.toString(),backgroundFilterVersion:2};this.eventController.publishEvent("backgroundFilterConfigSelected",oe)}sameVideoFxConfig(oe,le){return oe.backgroundBlur.isEnabled===le.backgroundBlur.isEnabled&&oe.backgroundBlur.strength===le.backgroundBlur.strength&&oe.backgroundReplacement.backgroundImageURL===le.backgroundReplacement.backgroundImageURL&&oe.backgroundReplacement.defaultColor===le.backgroundReplacement.defaultColor&&oe.backgroundReplacement.isEnabled===le.backgroundReplacement.isEnabled}};return VideoFxProcessor.default=ne,ne.isSharedArrayBufferSupported=typeof SharedArrayBuffer<"u",VideoFxProcessor}var VoiceFocusDeviceTransformer={},voicefocus={},decider={},hasRequiredDecider;function requireDecider(){if(hasRequiredDecider)return decider;hasRequiredDecider=1;var x=decider&&decider.__awaiter||function(fe,de,ce,pe){function he(me){return me instanceof ce?me:new ce(function(ve){ve(me)})}return new(ce||(ce=Promise))(function(me,ve){function ye(be){try{Ce(pe.next(be))}catch(Ee){ve(Ee)}}function Se(be){try{Ce(pe.throw(be))}catch(Ee){ve(Ee)}}function Ce(be){be.done?me(be.value):he(be.value).then(ye,Se)}Ce((pe=pe.apply(fe,de||[])).next())})};Object.defineProperty(decider,"__esModule",{value:!0}),decider.decideModel=decider.measureAndDecideExecutionApproach=void 0;const C=requireLoader(),E=requireSupport(),w=3,T=2.5,_=2.63,S=.6,R=.65,A=.5,O=.7,H={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}};class ee{constructor(de,ce){this.fetchConfig=de,this.logger=ce;const pe=`${de.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:de.headers,escapedQueryString:de.escapedQueryString},this.worker=(0,C.loadWorker)(pe,"VoiceFocusEstimator",this.fetchBehavior,ce)}roundtrip(de,ce,pe){return new Promise((he,me)=>{this.worker.then(ve=>{let ye;ye=Se=>{const{message:Ce,key:be}=Se.data;Ce===ce&&be===pe&&(ve.removeEventListener("message",ye),he(Se.data))},ve.addEventListener("message",ye),ve.postMessage(de)}).catch(ve=>{var ye;(ye=this.logger)===null||ye===void 0||ye.error("Failed to load worker.",ve),me(ve)})})}supportsSIMD(de){const ce="simd",pe=de||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,he={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:pe,key:ce};return this.roundtrip(he,"simd-support",ce).then(me=>me.supports)}measure(de,ce){const pe=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,he=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,me=de?he:pe,ve=`bench:${de}`,ye={message:"measure",fetchBehavior:this.fetchBehavior,budget:ce,path:me,key:ve};return this.roundtrip(ye,"measurement",ve).then(Se=>{if(Se.measurement)return Se.measurement;throw new Error("Failed to measure.")})}stop(){this.worker.then(de=>{var ce;(ce=this.logger)===null||ce===void 0||ce.debug("Stopping estimator worker."),de.terminate()}).catch(de=>{})}}const te=(fe,de)=>fe===1?S:de==="quality"?R*fe:A*fe,ie=({supportsSIMD:fe,supportsSAB:de,duration:ce,executionPreference:pe="auto",simdPreference:he,variantPreference:me="auto",namePreference:ve="default",usagePreference:ye,executionQuantaPreference:Se=w},Ce=H,be)=>{const Ee=he==="force"||he!=="disable"&&fe,Ae=ce!==-1,Ie=Ae?(Ee?T:_)/ce:0,Te=Ee?Ce.simd:Ce.wasm,De=Ae?te(Se,ye)*Ie:0,Ue=Ae?O*Ie:0,ze=ve,Pe=Ne=>({supported:!1,reason:Ne});if(Ae){if(Ie<Te.noSupport)return Pe(`Performance score ${Ie} worse than threshold ${Te.noSupport}.`)}else if(pe==="auto"||me==="auto")return Pe(`Missing explicit execution (${pe}) or variant (${me}) preference, but no scoring performed.`);be?.debug(`Bench duration ${ce} yields inline score ${De} and worker score ${Ue}.`);const $e=(Ne,Oe,Ve)=>({supported:!0,useSIMD:Ee,processor:Ne,executionApproach:Oe,variant:Ve,executionQuanta:Oe==="inline"?Se:void 0,name:ze}),He=(Ne,Oe,Ve)=>Oe!=="auto"?!Ae||Ne>Ve[Oe]?Oe:"failed":Ne>Ve.c100?"c100":Ne>Ve.c50?"c50":Ne>Ve.c20?"c20":Ne>Ve.c10?"c10":"failed",je=Ne=>{switch(Ne||"auto"){case"auto":{let Oe=je("inline"),Ve=je("worker");return be?.debug(`Reducing auto preference: ${JSON.stringify(Oe)} vs ${JSON.stringify(Ve)}`),Oe.supported===!1||Ve.supported===!1?Ve:Oe.variant===Ve.variant||Oe.variant==="c50"?Oe:Ve}case"worker":return(0,E.supportsSharedArrayBuffer)(globalThis,window,be)?je("worker-sab"):je("worker-postMessage");case"inline":{const Oe=He(De,me,Te.inline);return Oe==="failed"?Pe(`Performance score ${De} not sufficient for inline use with variant preference ${me}.`):$e("voicefocus-inline-processor","inline",Oe)}case"worker-sab":{if(!de){const Ve="Requested worker-sab but no SharedArrayBuffer support.";return be?.warn(Ve),{supported:!1,reason:Ve}}const Oe=He(Ue,me,Te.worker);return Oe==="failed"?Pe(`Performance score ${Ue} not sufficient for worker use with variant preference ${me}.`):$e("voicefocus-worker-sab-processor","worker-sab",Oe)}case"worker-postMessage":{const Oe=He(Ue,me,Te.worker);if(Oe==="failed")return Pe(`Performance score ${Ue} not sufficient for worker use.`);if(ze==="ns_es"){const Ve="Requested echo suppression but postMessage executor does not support it.";return be?.warn(Ve),{supported:!1,reason:Ve}}return $e("voicefocus-worker-postMessage-processor","worker-postMessage",Oe)}}};return je(pe)},ne=(fe,de,ce,pe)=>x(void 0,void 0,void 0,function*(){const he={supportsSIMD:fe,supportsSAB:(0,E.supportsSharedArrayBuffer)(globalThis,window,ce),duration:-1};if(fe)return ce?.info("Supports SIMD: true (force)"),he;const me=!pe,ve=pe||new ee(de,ce);try{const ye=!(0,E.isOldChrome)(window,ce)&&(yield ve.supportsSIMD());return ce?.info(`Supports SIMD: ${ye} (force: ${fe})`),he.supportsSIMD=ye,he}finally{me&&ve.stop()}}),ae=(fe,de,ce,pe)=>x(void 0,void 0,void 0,function*(){const he=new ee(de,pe);try{const me=yield ne(fe,de,pe,he);if(me.supportsSIMD)try{return me.duration=yield he.measure(!0,ce),pe?.info("SIMD timing:",me.duration),me}catch{pe?.warn("Failed SIMD estimation; falling back to non-SIMD."),me.supportsSIMD=!1}return me.duration=yield he.measure(!1,ce),pe?.info("No-SIMD timing:",me.duration),me}catch(me){throw pe?.error("Could not feature check.",me),me}finally{he.stop()}}),oe=(fe,de,ce,pe=H)=>x(void 0,void 0,void 0,function*(){let he=fe.executionPreference;const{usagePreference:me,variantPreference:ve,namePreference:ye,simdPreference:Se,estimatorBudget:Ce,executionQuantaPreference:be}=fe;me==="interactivity"&&he!=="inline"&&(ce?.debug(`Overriding execution preference ${he} to reflect interactivity preference.`),he="inline");const Ee=Se==="force",Ae=ve!=="auto",Ie=he!=="auto";let Te;try{Ae&&Ie?Te=yield ne(Ee,de,ce):Te=yield ae(Ee,de,Ce,ce)}catch(De){throw ce?.error("Could not load estimator.",De),new Error("Could not load Voice Focus estimator.")}return ie(Object.assign(Object.assign({},Te),{simdPreference:Se,executionPreference:he,variantPreference:ve,namePreference:ye,usagePreference:me,executionQuantaPreference:be}),pe,ce)});decider.measureAndDecideExecutionApproach=oe;const le=({category:fe,name:de,variant:ce,simd:pe,url:he})=>`${fe}-${de}-${ce}-v1${pe?"_simd":""}`;return decider.decideModel=le,decider}var workletInlineNode={},types={},hasRequiredTypes;function requireTypes(){if(hasRequiredTypes)return types;hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0}),types.VoiceFocusAudioWorkletNode=void 0;class x extends(typeof globalThis<"u"&&globalThis.AudioWorkletNode||class{}){}return types.VoiceFocusAudioWorkletNode=x,types}var hasRequiredWorkletInlineNode;function requireWorkletInlineNode(){if(hasRequiredWorkletInlineNode)return workletInlineNode;hasRequiredWorkletInlineNode=1;var x=workletInlineNode&&workletInlineNode.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})};Object.defineProperty(workletInlineNode,"__esModule",{value:!0});const C=requireSupport(),E=requireTypes(),w=5*1e3,T=5*1e3;class _ extends E.VoiceFocusAudioWorkletNode{constructor(R,A){super(R,A.processor,A),this.cpuWarningCount=0,this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.channelCountMode="explicit",this.channelCount=1;const{modelURL:O,worker:H,fetchBehavior:ee,logger:te,delegate:ie}=A;this.logger=te,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=ie,te&&te.debug("VoiceFocusInlineNode:",O),this.worker=H,this.worker.onmessage=this.onWorkerMessage.bind(this);const ne=(0,C.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:ne,key:"model",fetchBehavior:ee,path:O})}onModuleBufferLoaded(R,A){this.port.postMessage({message:"module-buffer",buffer:R,key:A})}onModuleLoaded(R,A){this.port.postMessage({message:"module",module:R,key:A})}enable(){return x(this,void 0,void 0,function*(){this.port.postMessage({message:"enable"})})}disable(){return x(this,void 0,void 0,function*(){this.port.postMessage({message:"disable"})})}setMode(R){return x(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:R})})}stop(){var R;return x(this,void 0,void 0,function*(){this.port.postMessage({message:"stop"});try{(R=this.worker)===null||R===void 0||R.terminate()}catch(A){console.error("failed to terminate worker:",A)}this.disconnect()})}onProcessorMessage(R){var A,O,H,ee,te,ie;const{data:ne}=R,{message:ae}=ne;switch(ae){case"cpu":const{reason:oe,count:le}=ne;oe&&le&&(this.metrics.cpu=Object.assign(Object.assign({},this.metrics.cpu),{[oe]:le+this.metrics.cpu[oe]})),this.cpuWarningCount++;const fe=Date.now(),de=this.cpuWarningLastTriggered||fe,ce=Math.abs(fe-de);(!this.cpuWarningLastTriggered||ce>w)&&((A=this.logger)===null||A===void 0||A.warn(`CPU warning (count: ${this.cpuWarningCount}):`,ae),this.cpuWarningCount=0,this.cpuWarningLastTriggered=fe),(O=this.delegate)===null||O===void 0||O.onCPUWarning();break;case"metrics":const{metrics:pe}=ne;if(!pe){(H=this.logger)===null||H===void 0||H.warn("Got metrics message but no metrics payload");break}if(this.metrics=Object.assign(Object.assign({},this.metrics),pe),this.logger){const he=Date.now();he-((ee=this.metricsLastRecorded)!==null&&ee!==void 0?ee:0)>T&&((te=this.logger)===null||te===void 0||te.debug("Contact metrics:",this.metrics),this.metricsLastRecorded=he)}break;default:(ie=this.logger)===null||ie===void 0||ie.debug("Ignoring processor message.")}}getModelMetrics(){return this.metrics}onWorkerMessage(R){const A=R.data;switch(A.message){case"module-buffer":if(!A.buffer||!A.key)return;this.onModuleBufferLoaded(A.buffer,A.key);break;case"module":if(!A.module||!A.key)return;this.onModuleLoaded(A.module,A.key);break;case"stopped":this.worker&&this.worker.terminate();break;default:return}}}return workletInlineNode.default=_,workletInlineNode}var workletWorkerSabNode={},hasRequiredWorkletWorkerSabNode;function requireWorkletWorkerSabNode(){if(hasRequiredWorkletWorkerSabNode)return workletWorkerSabNode;hasRequiredWorkletWorkerSabNode=1;var x=workletWorkerSabNode&&workletWorkerSabNode.__awaiter||function(S,R,A,O){function H(ee){return ee instanceof A?ee:new A(function(te){te(ee)})}return new(A||(A=Promise))(function(ee,te){function ie(oe){try{ae(O.next(oe))}catch(le){te(le)}}function ne(oe){try{ae(O.throw(oe))}catch(le){te(le)}}function ae(oe){oe.done?ee(oe.value):H(oe.value).then(ie,ne)}ae((O=O.apply(S,R||[])).next())})};Object.defineProperty(workletWorkerSabNode,"__esModule",{value:!0});const C=requireSupport(),E=requireTypes(),w={ready:0,enabled:1},T={disabled:0,enabled:1,stopped:2};class _ extends E.VoiceFocusAudioWorkletNode{constructor(R,A){super(R,A.processor,A),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:O,resamplerURL:H,worker:ee,fetchBehavior:te,delegate:ie}=A;this.delegate=ie,this.worker=ee,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:ne,supportFarendStream:ae}=A.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:R.sampleRate===16e3?160:480,enabled:ne,model:O,supportFarendStream:ae});const oe=(0,C.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:oe,key:"resampler",fetchBehavior:te,path:H})}enable(){return x(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,w.enabled,T.enabled),Atomics.notify(this.state,w.ready,1)):this.worker.postMessage({message:"enable"})})}disable(){return x(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,w.enabled,T.disabled),Atomics.notify(this.state,w.ready,1)):this.worker.postMessage({message:"disable"})})}setMode(R){return x(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:R})})}stop(){return x(this,void 0,void 0,function*(){if(this.state)Atomics.store(this.state,w.enabled,T.stopped),Atomics.notify(this.state,w.ready,1);else try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect()})}getModelMetrics(){}onWorkerMessage(R){var A;const O=R.data;switch(O.message){case"ready":if(!O.shared)throw new Error("No shared state.");this.state=new Int32Array(O.shared.state),this.port.postMessage(O);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":this.port.postMessage(O);break;case"cpu":(A=this.delegate)===null||A===void 0||A.onCPUWarning();break;case"processing":this.port.postMessage(O);break;default:return}}onProcessorMessage(R){var A;const O=R.data;switch(O.message){case"cpu":(A=this.delegate)===null||A===void 0||A.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(O);break}}}return workletWorkerSabNode.default=_,workletWorkerSabNode}var workletWorkerPostMessageNode={},hasRequiredWorkletWorkerPostMessageNode;function requireWorkletWorkerPostMessageNode(){if(hasRequiredWorkletWorkerPostMessageNode)return workletWorkerPostMessageNode;hasRequiredWorkletWorkerPostMessageNode=1;var x=workletWorkerPostMessageNode&&workletWorkerPostMessageNode.__awaiter||function(T,_,S,R){function A(O){return O instanceof S?O:new S(function(H){H(O)})}return new(S||(S=Promise))(function(O,H){function ee(ne){try{ie(R.next(ne))}catch(ae){H(ae)}}function te(ne){try{ie(R.throw(ne))}catch(ae){H(ae)}}function ie(ne){ne.done?O(ne.value):A(ne.value).then(ee,te)}ie((R=R.apply(T,_||[])).next())})};Object.defineProperty(workletWorkerPostMessageNode,"__esModule",{value:!0});const C=requireSupport(),E=requireTypes();class w extends E.VoiceFocusAudioWorkletNode{constructor(_,S){super(_,S.processor,S),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:R,audioBufferURL:A,worker:O,fetchBehavior:H,delegate:ee}=S;this.delegate=ee,this.worker=O,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:te,agc:ie,supportFarendStream:ne}=S.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:_.sampleRate===16e3?160:480,enabled:te,agc:ie,fetchBehavior:H,model:R,supportFarendStream:ne});const ae=(0,C.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:ae,key:"buffer",fetchBehavior:H,path:A})}enable(){return x(this,void 0,void 0,function*(){this.worker.postMessage({message:"enable"})})}disable(){return x(this,void 0,void 0,function*(){this.worker.postMessage({message:"disable"})})}setMode(_){return x(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:_})})}stop(){return x(this,void 0,void 0,function*(){try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect()})}getModelMetrics(){}onWorkerMessage(_){var S;const R=_.data;switch(R.message){case"ready":this.port.postMessage({message:"ready",shared:R.shared},R.shared?Object.values(R.shared):[]);break;case"data":if(!R.buffer)return;this.port.postMessage({message:"data",buffer:R.buffer},[R.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":this.port.postMessage(R);break;case"cpu":(S=this.delegate)===null||S===void 0||S.onCPUWarning();break;case"processing":this.port.postMessage(R);break;default:return}}onProcessorMessage(_){var S;const R=_.data;switch(R.message){case"data":if(!R.buffer)return;this.worker.postMessage({message:"data",buffer:R.buffer},[R.buffer]);break;case"cpu":(S=this.delegate)===null||S===void 0||S.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(R);break;default:return}}}return workletWorkerPostMessageNode.default=w,workletWorkerPostMessageNode}var hasRequiredVoicefocus;function requireVoicefocus(){if(hasRequiredVoicefocus)return voicefocus;hasRequiredVoicefocus=1;var x=voicefocus&&voicefocus.__awaiter||function(me,ve,ye,Se){function Ce(be){return be instanceof ye?be:new ye(function(Ee){Ee(be)})}return new(ye||(ye=Promise))(function(be,Ee){function Ae(De){try{Te(Se.next(De))}catch(Ue){Ee(Ue)}}function Ie(De){try{Te(Se.throw(De))}catch(Ue){Ee(Ue)}}function Te(De){De.done?be(De.value):Ce(De.value).then(Ae,Ie)}Te((Se=Se.apply(me,ve||[])).next())})};Object.defineProperty(voicefocus,"__esModule",{value:!0}),voicefocus.getAudioInput=voicefocus.createAudioContext=voicefocus.VoiceFocus=void 0;const C=requireDecider(),E=requireFetch(),w=requireLoader(),T=requireSupport(),_=requireWorkletInlineNode(),S=requireWorkletWorkerSabNode(),R=requireWorkletWorkerPostMessageNode(),A={useVoiceFocusAGC:!1,useBuiltInAGC:!0},O="stable-v1",H="https://static.sdkassets.chime.aws",ee={processors:`${H}/processors/`,workers:`${H}/workers/`,wasm:`${H}/wasm/`,models:`${H}/wasm/`},te={latencyHint:0},ie={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},ne=Object.assign(Object.assign({},ie),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),ae=Object.assign(Object.assign({},ie),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),oe={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:S.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:R.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:_.default}},le=(me,ve)=>{if(me!==void 0&&!(0,E.isValidAssetGroup)(me))throw new Error(`Invalid asset group ${me}`);if(ve!==void 0&&!(0,E.isValidRevisionID)(ve))throw new Error(`Invalid revision ID ${ve}`)},fe=(me,ve)=>{let ye;if(ve.useBuiltInAGC?ye=ne:ye=ae,!me)return{audio:ye};if(!me.audio)return me;if(me.video)throw new Error("Not adding Voice Focus to multi-device getUserMedia call.");return Object.assign(Object.assign({},me),{audio:me.audio===!0?ye:Object.assign(Object.assign({},me.audio),ye)})},de=(me,ve)=>`${ve.models}${(0,C.decideModel)(me)}.wasm`;class ce{constructor(ve,ye,Se,Ce,be,Ee){this.processorURL=ye,this.nodeConstructor=Se,this.nodeOptions=Ce,this.executionQuanta=be,this.logger=Ee,this.internal={worker:ve,isDestroyed:!1}}getModelMetrics(){var ve;return(ve=this.internal.voiceFocusNode)===null||ve===void 0?void 0:ve.getModelMetrics()}enable(){var ve;(ve=this.internal.voiceFocusNode)===null||ve===void 0||ve.enable()}disable(){var ve;(ve=this.internal.voiceFocusNode)===null||ve===void 0||ve.disable()}setMode(ve){var ye;(ye=this.internal.voiceFocusNode)===null||ye===void 0||ye.setMode(ve)}destroy(){var ve,ye,Se,Ce,be;return x(this,void 0,void 0,function*(){const{worker:Ee,isDestroyed:Ae,voiceFocusNode:Ie,destinationNode:Te,sourceNode:De,audioContext:Ue}=this.internal;if(Ae){(ve=this.logger)===null||ve===void 0||ve.debug("Voice Focus is already destroyed");return}try{Ee?.terminate(),De?.disconnect(),Te?.disconnect(),yield Promise.all([(ye=Ue?.close().catch(ze=>ze))!==null&&ye!==void 0?ye:yield Promise.resolve(),(Se=Ie?.stop().catch(ze=>ze))!==null&&Se!==void 0?Se:yield Promise.resolve()]),this.internal.audioContext=void 0,this.internal.voiceFocusNode=void 0,this.internal.sourceNode=void 0,this.internal.destinationNode=void 0,(Ce=this.logger)===null||Ce===void 0||Ce.debug("Voice Focus destroyed successfully")}catch(ze){throw(be=this.logger)===null||be===void 0||be.error("Error while destroying the Voice Focus instance: ",ze),ze}finally{this.internal.isDestroyed=!0}})}static isSupported(ve,ye){const{fetchBehavior:Se,logger:Ce}=ye||{};if(typeof globalThis>"u")return Ce?.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!(0,T.supportsAudioWorklet)(globalThis,Ce))return Ce?.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!(0,T.supportsWASM)(globalThis,Ce))return Ce?.debug("Browser does not support WASM."),Promise.resolve(!1);(0,T.supportsWASMStreaming)(globalThis,Ce)||Ce?.debug("Browser does not support streaming WASM compilation.");const{assetGroup:be=O,revisionID:Ee,paths:Ae=ee}=ve||{};le(be,Ee);const Ie=Ee?{revisionID:Ee}:{assetGroup:be},Te=(0,E.addQueryParams)(Se,Ie),De=Object.assign(Object.assign({},Te),{paths:Ae});return(0,T.supportsVoiceFocusWorker)(globalThis,De,Ce)}static mungeExecutionPreference(ve,ye){const Se=ve===void 0||ve==="auto";if((0,T.isSafari)(globalThis)){if(Se||ve==="inline")return"inline";if(!Se)throw new Error(`Unsupported execution preference ${ve}`)}if(ve==="worker-sab"&&!(0,T.supportsSharedArrayBuffer)(globalThis,globalThis,ye))throw new Error(`Unsupported execution preference ${ve}`);return ve||"auto"}static configure(ve,ye){return x(this,void 0,void 0,function*(){const{fetchBehavior:Se,preResolve:Ce,logger:be}=ye||{},{category:Ee="voicefocus",name:Ae="default",variant:Ie="auto",assetGroup:Te=O,revisionID:De,simd:Ue="detect",mode:ze="ns",executionPreference:Pe="auto",executionQuantaPreference:$e,usagePreference:He="interactivity",estimatorBudget:je=100,paths:Ne=ee,thresholds:Oe}=ve||{};if(be?.debug("Configuring Voice Focus with spec",ve),Ee!==void 0&&Ee!=="voicefocus")throw new Error(`Unrecognized category ${Ee}`);if(Ae!==void 0&&Ae!=="default"&&Ae!=="ns_es")throw new Error(`Unrecognized feature name ${Ae}`);if(Ie!==void 0&&!["auto","c100","c50","c20","c10"].includes(Ie))throw new Error(`Unrecognized feature variant ${Ie}`);if($e!==void 0&&![1,2,3].includes($e))throw new Error(`Unrecognized execution quanta preference ${$e}`);if(le(Te,De),Ue!==void 0&&!["detect","force","disable"].includes(Ue))throw new Error(`Unrecognized SIMD option ${Ue}`);if(Pe!==void 0&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(Pe))throw new Error(`Unrecognized execution preference ${Pe}`);if(He!==void 0&&!["quality","interactivity"].includes(He))throw new Error(`Unrecognized usage preference ${He}`);const Ve={executionPreference:this.mungeExecutionPreference(Pe,be),usagePreference:He,executionQuantaPreference:$e,variantPreference:Ie,namePreference:Ae,simdPreference:Ue,estimatorBudget:je},Ht=De?{revisionID:De}:{assetGroup:Te},Kt=(0,E.addQueryParams)(Se,Ht),ir=Object.assign({paths:Ne},Kt),$t=yield(0,C.measureAndDecideExecutionApproach)(Ve,ir,be,Oe);if($t.supported===!1)return{supported:!1,reason:$t.reason};be?.info("Decided execution approach",$t);const{useSIMD:tr,processor:ar,variant:gr,executionQuanta:er}=$t,sr={category:Ee||"voicefocus",name:Ae||"default",mode:ze,variant:gr,simd:tr};if(Ce){const pr=de(sr,Ne);sr.url=yield(0,E.resolveURL)(pr,Kt)}return{fetchConfig:ir,model:sr,processor:ar,executionQuanta:er,supported:!0}})}static init(ve,{delegate:ye,preload:Se=!0,logger:Ce}){return x(this,void 0,void 0,function*(){if(ve.supported===!1)throw new Error("Voice Focus not supported. Reason: "+ve.reason);const{model:be,processor:Ee,fetchConfig:Ae,executionQuanta:Ie}=ve,{simd:Te,name:De,mode:Ue}=be,{paths:ze}=Ae;if(Ee!=="voicefocus-inline-processor"&&Ee!=="voicefocus-worker-postMessage-processor"&&Ee!=="voicefocus-worker-sab-processor")throw new Error(`Unknown processor ${Ee}`);const Pe=be.url||de(be,ze);Ce?.debug(`Using model URL ${Pe}.`);const $e=`${ze.wasm}audio_buffer-v1${Te?"_simd":""}.wasm`,He=`${ze.wasm}resampler-v1${Te?"_simd":""}.wasm`,je=`${ze.workers}worker-v1.js`,{file:Ne,node:Oe}=oe[Ee],Ve=`${ze.processors}${Ne}`,Ht=yield(0,w.loadWorker)(je,"VoiceFocusWorker",Ae,Ce);if(Se){Ce?.debug("Preloading",Pe);let $t=(0,T.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";Ht.postMessage({message:$t,preload:!0,key:"model",fetchBehavior:Ae,path:Pe})}const Kt={processor:Ee,worker:Ht,audioBufferURL:$e,resamplerURL:He,fetchBehavior:Ae,modelURL:Pe,delegate:ye,logger:Ce,numberOfInputs:De==="ns_es"?2:1,mode:Ue},ir=new ce(Ht,Ve,Oe,Kt,Ie,Ce);return Promise.resolve(ir)})}createNode(ve,ye){var Se;if(this.internal.isDestroyed)throw new Error("Unable to create node because VoiceFocus worker has been destroyed.");const{voiceFocusSampleRate:Ce=ve.sampleRate===16e3?16e3:48e3,enabled:be=!0,agc:Ee=A}=ye||{},Ae=ye?.es,Ie={voiceFocusSampleRate:Ce,enabled:be,sendBufferCount:10,prefill:6,agc:Ee,executionQuanta:this.executionQuanta,supportFarendStream:Ae,mode:this.nodeOptions.mode},Te=(0,E.withQueryString)(this.processorURL,(Se=this.nodeOptions)===null||Se===void 0?void 0:Se.fetchBehavior);return ve.audioWorklet.addModule(Te).then(()=>new this.nodeConstructor(ve,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:Ie})))}applyToStream(ve,ye,Se){return x(this,void 0,void 0,function*(){if(this.internal.isDestroyed)throw new Error("Unable to apply stream because VoiceFocus worker has been destroyed");const Ce=ye.createMediaStreamSource(ve),be=yield this.applyToSourceNode(Ce,ye,Se),Ee=ye.createMediaStreamDestination();return be.connect(Ee),this.internal=Object.assign(Object.assign({},this.internal),{voiceFocusNode:be,sourceNode:Ce,destinationNode:Ee,audioContext:ye}),{node:be,source:Ce,destination:Ee,stream:Ee.stream}})}applyToSourceNode(ve,ye,Se){return x(this,void 0,void 0,function*(){const Ce=yield this.createNode(ye,Se);return ve.connect(Ce),Ce})}}voicefocus.VoiceFocus=ce;const pe=(me=te)=>new(window.AudioContext||window.webkitAudioContext)(me);voicefocus.createAudioContext=pe;const he=(me,ve,ye)=>x(void 0,void 0,void 0,function*(){var Se,Ce;const{constraints:be,spec:Ee,delegate:Ae,preload:Ie=!0,options:Te}=ve,{logger:De}=ye,Ue=yield ce.configure(Ee,ye);if(!Ue.supported)return(Se=ye.logger)===null||Se===void 0||Se.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(be);const ze=yield ce.init(Ue,{delegate:Ae,preload:Ie,logger:De}),Pe=((Ce=ve.options)===null||Ce===void 0?void 0:Ce.agc)||A,$e=yield window.navigator.mediaDevices.getUserMedia(fe(be,Pe));return ze.applyToStream($e,me,Te).then(He=>He.stream)});return voicefocus.getAudioInput=he,voicefocus}var LoggerAdapter={},hasRequiredLoggerAdapter;function requireLoggerAdapter(){if(hasRequiredLoggerAdapter)return LoggerAdapter;hasRequiredLoggerAdapter=1,Object.defineProperty(LoggerAdapter,"__esModule",{value:!0});function x(E){return E.map(w=>typeof w=="object"?JSON.stringify(w):`${w}`).join(" ")}let C=class{constructor(E){this.base=E}debug(...E){this.base.debug(x(E))}info(...E){this.base.info(x(E))}warn(...E){this.base.warn(x(E))}error(...E){this.base.error(x(E))}};return LoggerAdapter.default=C,LoggerAdapter}var VoiceFocusTransformDevice={},hasRequiredVoiceFocusTransformDevice;function requireVoiceFocusTransformDevice(){if(hasRequiredVoiceFocusTransformDevice)return VoiceFocusTransformDevice;hasRequiredVoiceFocusTransformDevice=1;var x=VoiceFocusTransformDevice&&VoiceFocusTransformDevice.__awaiter||function(_,S,R,A){function O(H){return H instanceof R?H:new R(function(ee){ee(H)})}return new(R||(R=Promise))(function(H,ee){function te(ae){try{ne(A.next(ae))}catch(oe){ee(oe)}}function ie(ae){try{ne(A.throw(ae))}catch(oe){ee(oe)}}function ne(ae){ae.done?H(ae.value):O(ae.value).then(te,ie)}ne((A=A.apply(_,S||[])).next())})},C=VoiceFocusTransformDevice&&VoiceFocusTransformDevice.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(VoiceFocusTransformDevice,"__esModule",{value:!0});const E=C(requireDefaultBrowserBehavior());let w=class mm{constructor(S,R,A,O,H=!1,ee=void 0,te=new E.default,ie=new Map,ne=void 0,ae=void 0){this.device=S,this.voiceFocus=R,this.delegate=A,this.nodeOptions=O,this.failed=H,this.node=ee,this.browserBehavior=te,this.farEndStreamToAudioSourceNode=ie,this.mixDestNode=ne,this.mixSourceNode=ae}getInnerDevice(){return this.device}mute(S){return x(this,void 0,void 0,function*(){this.node&&(S?yield this.node.disable():yield this.node.enable())})}stop(){return x(this,void 0,void 0,function*(){this.node&&(this.node.disconnect(),yield this.node.stop())})}chooseNewInnerDevice(S){return x(this,void 0,void 0,function*(){return this.device===S&&!T(S)?this:new mm(S,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode)})}intrinsicDevice(){return x(this,void 0,void 0,function*(){if(this.failed)return this.device;const S=this.nodeOptions.es,R={echoCancellation:!S,googEchoCancellation:!S,googEchoCancellation2:!S,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googNoiseSuppression2:!1};let A;return this.nodeOptions&&this.nodeOptions.agc!==void 0?A=this.nodeOptions.agc.useBuiltInAGC:A=!0,R.autoGainControl=A,R.googAutoGainControl=A,R.googAutoGainControl2=A,this.device?typeof this.device=="string"?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?R.deviceId=this.device:R.deviceId={exact:this.device},R):this.device.id?this.device:Object.assign(Object.assign({},this.device),R):R})}createAudioNode(S){var R,A;return x(this,void 0,void 0,function*(){if(((R=this.node)===null||R===void 0?void 0:R.context)===S)return{start:this.node,end:this.node};const O=Object.assign({enabled:!0,agc:{useVoiceFocusAGC:!1}},this.nodeOptions);try{if((A=this.node)===null||A===void 0||A.disconnect(),this.node=yield this.voiceFocus.createNode(S,O),this.nodeOptions.es){this.mixDestNode=new MediaStreamAudioDestinationNode(S,{channelCount:1,channelCountMode:"explicit"});for(const te of this.farEndStreamToAudioSourceNode.keys())this.assignFarEndStreamToAudioSourceNode(te);this.createMixSourceNode()}const H=this.node,ee=this.node;return{start:H,end:ee}}catch(H){throw this.failed=!0,this.delegate.onFallback(this,H),H}})}observeMeetingAudio(S){return x(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;S.addAudioMixObserver(this);const R=yield S.getCurrentMeetingAudioStream();R&&this.addFarEndStream(R)})}unObserveMeetingAudio(S){return x(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;S.removeAudioMixObserver(this);const R=yield S.getCurrentMeetingAudioStream();R&&this.removeFarendStream(R)})}addObserver(S){this.delegate.addObserver(S)}removeObserver(S){this.delegate.removeObserver(S)}addFarEndStream(S){return x(this,void 0,void 0,function*(){!this.nodeOptions.es||!S||this.farEndStreamToAudioSourceNode.has(S)||(this.node?this.assignFarEndStreamToAudioSourceNode(S):this.farEndStreamToAudioSourceNode.set(S,null))})}removeFarendStream(S){var R;return x(this,void 0,void 0,function*(){(R=this.farEndStreamToAudioSourceNode.get(S))===null||R===void 0||R.disconnect(),this.farEndStreamToAudioSourceNode.delete(S)})}meetingAudioStreamBecameActive(S){return x(this,void 0,void 0,function*(){this.addFarEndStream(S)})}meetingAudioStreamBecameInactive(S){return x(this,void 0,void 0,function*(){this.removeFarendStream(S)})}assignFarEndStreamToAudioSourceNode(S){const R=this.node.context.createMediaStreamSource(S);R.channelCount=1,R.channelCountMode="explicit",this.farEndStreamToAudioSourceNode.set(S,R),R.connect(this.mixDestNode,0)}createMixSourceNode(){this.mixSourceNode=this.node.context.createMediaStreamSource(this.mixDestNode.stream),this.mixSourceNode.channelCount=1,this.mixSourceNode.channelCountMode="explicit",this.mixSourceNode.connect(this.node,0,1)}};function T(_){return _==="default"?!0:!_||typeof _!="object"?!1:"deviceId"in _&&_.deviceId==="default"||"id"in _&&_.id==="default"}return VoiceFocusTransformDevice.default=w,VoiceFocusTransformDevice}var VoiceFocusTransformDeviceDelegate={},hasRequiredVoiceFocusTransformDeviceDelegate;function requireVoiceFocusTransformDeviceDelegate(){if(hasRequiredVoiceFocusTransformDeviceDelegate)return VoiceFocusTransformDeviceDelegate;hasRequiredVoiceFocusTransformDeviceDelegate=1,Object.defineProperty(VoiceFocusTransformDeviceDelegate,"__esModule",{value:!0});let x=class{constructor(){this.observers=new Set}addObserver(C){this.observers.add(C)}removeObserver(C){this.observers.delete(C)}onFallback(C,E){var w;for(const T of this.observers)(w=T.voiceFocusFellBackToInnerStream)===null||w===void 0||w.call(T,C,E)}onCPUWarning(){var C;for(const E of this.observers)(C=E.voiceFocusInsufficientResources)===null||C===void 0||C.call(E)}};return VoiceFocusTransformDeviceDelegate.default=x,VoiceFocusTransformDeviceDelegate}var hasRequiredVoiceFocusDeviceTransformer;function requireVoiceFocusDeviceTransformer(){if(hasRequiredVoiceFocusDeviceTransformer)return VoiceFocusDeviceTransformer;hasRequiredVoiceFocusDeviceTransformer=1;var x=VoiceFocusDeviceTransformer&&VoiceFocusDeviceTransformer.__awaiter||function(O,H,ee,te){function ie(ne){return ne instanceof ee?ne:new ee(function(ae){ae(ne)})}return new(ee||(ee=Promise))(function(ne,ae){function oe(de){try{fe(te.next(de))}catch(ce){ae(ce)}}function le(de){try{fe(te.throw(de))}catch(ce){ae(ce)}}function fe(de){de.done?ne(de.value):ie(de.value).then(oe,le)}fe((te=te.apply(O,H||[])).next())})},C=VoiceFocusDeviceTransformer&&VoiceFocusDeviceTransformer.__importDefault||function(O){return O&&O.__esModule?O:{default:O}};Object.defineProperty(VoiceFocusDeviceTransformer,"__esModule",{value:!0}),VoiceFocusDeviceTransformer.VoiceFocusDeviceTransformer=void 0;const E=requireVoicefocus(),w=requireUtils(),T=C(requireVersioning()),_=C(requireLoggerAdapter()),S=C(requireVoiceFocusTransformDevice()),R=C(requireVoiceFocusTransformDeviceDelegate());let A=class Dn{constructor(H,{preload:ee=!0,logger:te,fetchBehavior:ie=Dn.defaultFetchBehavior()},ne){this.spec=H,this.supported=!0,this.logger=te,this.vfLogger=te?new _.default(te):void 0,this.preload=ee,this.fetchBehavior=ie,this.spec=Dn.augmentSpec(this.spec),ne&&(this.configuration=Promise.resolve(ne))}static isSupported(H,ee){var te,ie;const ne=Dn.defaultFetchBehavior(),ae=ee?.logger?new _.default(ee.logger):void 0,oe={fetchBehavior:ne,logger:ae};if(w.isIFramed()){if(ee?.allowIFrame===!1)return(te=ee?.logger)===null||te===void 0||te.error("Amazon Voice Focus support check inside iframe: not supported."),Promise.resolve(!1);(ie=ee?.logger)===null||ie===void 0||ie.warn("Amazon Voice Focus support check inside iframe: not recommended.")}return E.VoiceFocus.isSupported(Dn.augmentSpec(H),oe)}static create(H={},ee={},te,ie,ne){var ae,oe,le;return x(this,void 0,void 0,function*(){ie&&ie.Meeting.Meeting&&(ie=ie.Meeting);const fe=((le=(oe=(ae=ie?.Meeting)===null||ae===void 0?void 0:ae.MeetingFeatures)===null||oe===void 0?void 0:oe.Audio)===null||le===void 0?void 0:le.EchoReduction)==="AVAILABLE",de=te&&te.supported===!0&&te.model.name==="ns_es"&&!fe,ce=H.name==="ns_es"&&!fe;if(de||ce)throw new Error("Echo Reduction requested but not enabled.");const pe=new Dn(H,ee,te);return yield pe.init(),pe})}static configure(H={},ee={}){return x(this,void 0,void 0,function*(){return new Dn(H,ee,void 0).configure(!0)})}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(H,ee){return x(this,void 0,void 0,function*(){if(this.supported)try{const[te,ie]=yield this.allocateVoiceFocus(!0),ne=Object.assign(Object.assign({},ee),{es:this.spec.name==="ns_es"});return new S.default(H,te,ie,ne)}catch{return}})}static destroyVoiceFocus(H){var ee;return x(this,void 0,void 0,function*(){(ee=H?.vf)===null||ee===void 0||ee.destroy()})}static augmentSpec(H){return!H||!H.assetGroup&&!H.revisionID?Object.assign(Object.assign({},H),{assetGroup:Dn.currentSDKAssetGroup()}):H}configure(H=!1){return x(this,void 0,void 0,function*(){const ee={fetchBehavior:this.fetchBehavior,preResolve:H,logger:this.vfLogger};return E.VoiceFocus.configure(this.spec,ee)})}init(){var H;return x(this,void 0,void 0,function*(){this.configuration||(this.configuration=this.configure());const ee=yield this.configuration;if(!ee.supported){this.supported=!1;return}this.pendingVoiceFocus=this.createVoiceFocus(ee,this.preload);try{yield this.pendingVoiceFocus}catch(te){(H=this.logger)===null||H===void 0||H.error(`Unable to initialize Amazon Voice Focus: ${te}`),this.supported=!1}})}createVoiceFocus(H,ee){return x(this,void 0,void 0,function*(){const te=new R.default;return this.vf=yield E.VoiceFocus.init(H,{delegate:te,preload:ee,logger:this.vfLogger}),[this.vf,te]})}allocateVoiceFocus(H){return x(this,void 0,void 0,function*(){if(!this.supported)throw new Error("Not supported.");if(this.pendingVoiceFocus){const ee=this.pendingVoiceFocus;return this.pendingVoiceFocus=void 0,ee}return this.createVoiceFocus(yield this.configuration,H)})}static majorVersion(){return T.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return T.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|(?:[1-9][0-9]*))\.(?:0|[1-9][0-9]*)/)[0]}static currentSDKAssetGroup(){const H=this.majorVersion();return H?`sdk-${H}`:"stable-v1"}static defaultFetchBehavior(){const H=Dn.majorMinorVersion()||"unknown",ee=T.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(H)}&ua=${encodeURIComponent(ee)}`}}};return VoiceFocusDeviceTransformer.VoiceFocusDeviceTransformer=A,VoiceFocusDeviceTransformer.default=A,VoiceFocusDeviceTransformer}var hasRequiredBuild;function requireBuild(){return hasRequiredBuild||(hasRequiredBuild=1,function(x){var C=build$2&&build$2.__importDefault||function(vs){return vs&&vs.__esModule?vs:{default:vs}};Object.defineProperty(x,"__esModule",{value:!0}),x.DefaultEventController=x.DefaultDevicePixelRatioMonitor=x.DefaultDeviceController=x.DefaultContentShareController=x.DefaultBrowserBehavior=x.DefaultAudioVideoFacade=x.DefaultAudioVideoController=x.DefaultAudioMixController=x.DefaultActiveSpeakerPolicy=x.DefaultActiveSpeakerDetector=x.DataMessage=x.CreateSDPTask=x.CreatePeerConnectionTask=x.ContentShareMediaStreamBroker=x.ContentShareConstants=x.ConsoleLogger=x.ConnectionHealthPolicyConfiguration=x.ConnectionHealthData=x.ClientVideoStreamReceivingReport=x.ClientMetricReportMediaType=x.ClientMetricReportDirection=x.ClientMetricReport=x.CleanStoppedSessionTask=x.CleanRestartedSessionTask=x.CheckVideoInputFeedback=x.CheckVideoConnectivityFeedback=x.CheckNetworkUDPConnectivityFeedback=x.CheckNetworkTCPConnectivityFeedback=x.CheckContentShareConnectivityFeedback=x.CheckCameraResolutionFeedback=x.CheckAudioOutputFeedback=x.CheckAudioInputFeedback=x.CheckAudioConnectivityFeedback=x.CanvasVideoFrameBuffer=x.CSPMonitor=x.BitrateParameters=x.BaseTask=x.BaseConnectionHealthPolicy=x.BackgroundReplacementVideoFrameProcessor=x.BackgroundFilterVideoFrameProcessor=x.BackgroundBlurVideoFrameProcessor=x.BackgroundBlurStrength=x.AudioVideoControllerState=x.AudioProfile=x.AudioLogEvent=x.Attendee=x.AttachMediaInputTask=x.AsyncScheduler=x.ApplicationMetadata=x.AllHighestVideoBandwidthPolicy=void 0,x.MeetingFeatures=x.MeetingEventsClientConfiguration=x.MediaDeviceProxyHandler=x.Maybe=x.LogLevel=x.Log=x.ListenForVolumeIndicatorsTask=x.LeaveAndReceiveLeaveAckTask=x.JoinAndReceiveIndexTask=x.IntervalScheduler=x.InMemoryJSONEventBuffer=x.GlobalMetricReport=x.GetUserMediaError=x.FullJitterLimitedBackoff=x.FullJitterBackoffFactory=x.FullJitterBackoff=x.FinishGatheringICECandidatesTask=x.EventIngestionConfiguration=x.EventBufferConfiguration=x.DeviceSelection=x.DevicePixelRatioWindowSource=x.DefaultWebSocketAdapter=x.DefaultVolumeIndicatorAdapter=x.DefaultVideoTransformDevice=x.DefaultVideoTileFactory=x.DefaultVideoTileController=x.DefaultVideoTile=x.DefaultVideoStreamIndex=x.DefaultVideoStreamIdSet=x.DefaultVideoFrameProcessorTimer=x.DefaultVideoFrameProcessorPipeline=x.DefaultVideoElementResolutionMonitor=x.DefaultVideoCaptureAndEncodeParameter=x.DefaultUserAgentParser=x.DefaultTranscriptionController=x.DefaultTransceiverController=x.DefaultSimulcastUplinkPolicyForContentShare=x.DefaultSimulcastUplinkPolicy=x.DefaultSignalingClient=x.DefaultSigV4=x.DefaultSessionStateController=x.DefaultReconnectController=x.DefaultRealtimeController=x.DefaultPingPong=x.DefaultModality=x.DefaultMessagingSession=x.DefaultMeetingSession=x.DefaultMeetingReadinessChecker=x.DefaultMeetingEventReporter=x.DefaultMediaDeviceFactory=void 0,x.RedundantAudioEncoder=x.ReconnectionHealthPolicy=x.ReceiveVideoStreamIndexTask=x.ReceiveVideoInputTask=x.ReceiveRemoteVideoPauseResumeTask=x.ReceiveAudioInputTask=x.RealtimeVolumeIndicator=x.RealtimeState=x.RealtimeAttendeePositionInFrame=x.PromoteToPrimaryMeetingTask=x.PromiseQueue=x.PrefetchSortBy=x.PrefetchOn=x.PermissionDeniedError=x.ParallelGroupTask=x.POSTLogger=x.OverconstrainedError=x.OpenSignalingConnectionTask=x.OnceTask=x.NotReadableError=x.NotFoundError=x.None=x.NoVideoUplinkBandwidthPolicy=x.NoVideoDownlinkBandwidthPolicy=x.NoOpVideoFrameProcessor=x.NoOpVideoElementFactory=x.NoOpTask=x.NoOpMediaStreamBroker=x.NoOpLogger=x.NoOpEventReporter=x.NoOpDeviceController=x.NoOpDebugLogger=x.NoOpAudioVideoController=x.NScaleVideoUplinkBandwidthPolicy=x.MutableVideoPreferences=x.MultiLogger=x.MonitorTask=x.ModelSpecBuilder=x.MessagingSessionConfiguration=x.Message=x.MeetingSessionVideoAvailability=x.MeetingSessionURLs=x.MeetingSessionTURNCredentials=x.MeetingSessionStatusCode=x.MeetingSessionStatus=x.MeetingSessionLifecycleEventCondition=x.MeetingSessionLifecycleEvent=x.MeetingSessionCredentials=x.MeetingSessionConfiguration=x.MeetingReadinessCheckerConfiguration=void 0,x.VideoEncodingConcurrentSendersHealthPolicy=x.VideoCodecCapability=x.VideoAdaptiveProbePolicy=x.Versioning=x.UnusableAudioWarningConnectionHealthPolicy=x.TypeError=x.TranscriptionStatusType=x.TranscriptionStatus=x.TranscriptResult=x.TranscriptLanguageWithScore=x.TranscriptItemType=x.TranscriptItem=x.TranscriptEntity=x.TranscriptAlternative=x.Transcript=x.TimeoutTask=x.TimeoutScheduler=x.TaskStatus=x.TargetDisplaySize=x.SubscribeAndReceiveSubscribeAckTask=x.StreamMetricReport=x.Some=x.SingleNodeAudioTransformDevice=x.SimulcastVideoStreamIndex=x.SimulcastTransceiverController=x.SimulcastLayers=x.SimulcastContentShareTransceiverController=x.SignalingClientVideoSubscriptionConfiguration=x.SignalingClientSubscribe=x.SignalingClientJoin=x.SignalingClientEventType=x.SignalingClientEvent=x.SignalingClientConnectionRequest=x.SignalingAndMetricsConnectionMonitor=x.SetRemoteDescriptionTask=x.SetLocalDescriptionTask=x.SessionStateControllerTransitionResult=x.SessionStateControllerState=x.SessionStateControllerDeferPriority=x.SessionStateControllerAction=x.ServerSideNetworkAdaption=x.SerialGroupTask=x.SendingAudioFailureConnectionHealthPolicy=x.SendAndReceiveDataMessagesTask=x.SDPMediaSection=x.SDPCandidateType=x.SDP=x.RunnableTask=x.RedundantAudioRecoveryMetricReport=x.RedundantAudioEncoderWorkerCode=void 0,x.isVideoTransformDevice=x.isDestroyable=x.isAudioTransformDevice=x.ZLIBTextCompressor=x.WebSocketReadyState=x.WaitForAttendeePresenceTask=x.VoiceFocusTransformDevice=x.VoiceFocusDeviceTransformer=x.VideoTileState=x.VideoStreamDescription=x.VideoSource=x.VideoQualitySettings=x.VideoQualityAdaptationPreference=x.VideoPriorityBasedPolicyConfig=x.VideoPriorityBasedPolicy=x.VideoPreferences=x.VideoPreference=x.VideoOnlyTransceiverController=x.VideoLogEvent=x.VideoFxProcessor=x.VideoEncodingFramerateConnectionHealthPolicy=x.VideoEncodingCpuConnectionHealthPolicy=x.VideoEncodingConnectionHealthPolicyName=void 0;const E=C(requireAllHighestVideoBandwidthPolicy());x.AllHighestVideoBandwidthPolicy=E.default;const w=C(requireApplicationMetadata());x.ApplicationMetadata=w.default;const T=C(requireAsyncScheduler());x.AsyncScheduler=T.default;const _=C(requireAttachMediaInputTask());x.AttachMediaInputTask=_.default;const S=C(requireAttendee());x.Attendee=S.default;const R=C(requireAudioLogEvent());x.AudioLogEvent=R.default;const A=C(requireAudioProfile());x.AudioProfile=A.default;const O=C(requireAudioVideoControllerState());x.AudioVideoControllerState=O.default;const H=C(requireBackgroundBlurStrength());x.BackgroundBlurStrength=H.default;const ee=C(requireBackgroundBlurVideoFrameProcessor());x.BackgroundBlurVideoFrameProcessor=ee.default;const te=C(requireBackgroundFilterVideoFrameProcessor());x.BackgroundFilterVideoFrameProcessor=te.default;const ie=C(requireBackgroundReplacementVideoFrameProcessor());x.BackgroundReplacementVideoFrameProcessor=ie.default;const ne=C(requireBaseConnectionHealthPolicy());x.BaseConnectionHealthPolicy=ne.default;const ae=C(requireBaseTask());x.BaseTask=ae.default;const oe=C(requireBitrateParameters());x.BitrateParameters=oe.default;const le=C(requireCSPMonitor());x.CSPMonitor=le.default;const fe=C(requireCanvasVideoFrameBuffer());x.CanvasVideoFrameBuffer=fe.default;const de=C(requireCheckAudioConnectivityFeedback());x.CheckAudioConnectivityFeedback=de.default;const ce=C(requireCheckAudioInputFeedback());x.CheckAudioInputFeedback=ce.default;const pe=C(requireCheckAudioOutputFeedback());x.CheckAudioOutputFeedback=pe.default;const he=C(requireCheckCameraResolutionFeedback());x.CheckCameraResolutionFeedback=he.default;const me=C(requireCheckContentShareConnectivityFeedback());x.CheckContentShareConnectivityFeedback=me.default;const ve=C(requireCheckNetworkTCPConnectivityFeedback());x.CheckNetworkTCPConnectivityFeedback=ve.default;const ye=C(requireCheckNetworkUDPConnectivityFeedback());x.CheckNetworkUDPConnectivityFeedback=ye.default;const Se=C(requireCheckVideoConnectivityFeedback());x.CheckVideoConnectivityFeedback=Se.default;const Ce=C(requireCheckVideoInputFeedback());x.CheckVideoInputFeedback=Ce.default;const be=C(requireCleanRestartedSessionTask());x.CleanRestartedSessionTask=be.default;const Ee=C(requireCleanStoppedSessionTask());x.CleanStoppedSessionTask=Ee.default;const Ae=C(requireClientMetricReport());x.ClientMetricReport=Ae.default;const Ie=C(requireClientMetricReportDirection());x.ClientMetricReportDirection=Ie.default;const Te=C(requireClientMetricReportMediaType());x.ClientMetricReportMediaType=Te.default;const De=C(requireClientVideoStreamReceivingReport());x.ClientVideoStreamReceivingReport=De.default;const Ue=C(requireConnectionHealthData());x.ConnectionHealthData=Ue.default;const ze=C(requireConnectionHealthPolicyConfiguration());x.ConnectionHealthPolicyConfiguration=ze.default;const Pe=C(requireConsoleLogger());x.ConsoleLogger=Pe.default;const $e=C(requireContentShareConstants());x.ContentShareConstants=$e.default;const He=C(requireContentShareMediaStreamBroker());x.ContentShareMediaStreamBroker=He.default;const je=C(requireCreatePeerConnectionTask());x.CreatePeerConnectionTask=je.default;const Ne=C(requireCreateSDPTask());x.CreateSDPTask=Ne.default;const Oe=C(requireDataMessage());x.DataMessage=Oe.default;const Ve=C(requireDefaultActiveSpeakerDetector());x.DefaultActiveSpeakerDetector=Ve.default;const Ht=C(requireDefaultActiveSpeakerPolicy());x.DefaultActiveSpeakerPolicy=Ht.default;const Kt=C(requireDefaultAudioMixController());x.DefaultAudioMixController=Kt.default;const ir=C(requireDefaultAudioVideoController());x.DefaultAudioVideoController=ir.default;const $t=C(requireDefaultAudioVideoFacade());x.DefaultAudioVideoFacade=$t.default;const tr=C(requireDefaultBrowserBehavior());x.DefaultBrowserBehavior=tr.default;const ar=C(requireDefaultContentShareController());x.DefaultContentShareController=ar.default;const gr=C(requireDefaultDeviceController());x.DefaultDeviceController=gr.default;const er=C(requireDefaultDevicePixelRatioMonitor());x.DefaultDevicePixelRatioMonitor=er.default;const sr=C(requireDefaultEventController());x.DefaultEventController=sr.default;const pr=C(requireDefaultMediaDeviceFactory());x.DefaultMediaDeviceFactory=pr.default;const ur=C(requireDefaultMeetingEventReporter());x.DefaultMeetingEventReporter=ur.default;const Sr=C(requireDefaultMeetingReadinessChecker());x.DefaultMeetingReadinessChecker=Sr.default;const hr=C(requireDefaultMeetingSession());x.DefaultMeetingSession=hr.default;const yr=C(requireDefaultMessagingSession());x.DefaultMessagingSession=yr.default;const xr=C(requireDefaultModality());x.DefaultModality=xr.default;const Yt=C(requireDefaultPingPong());x.DefaultPingPong=Yt.default;const Jt=C(requireDefaultRealtimeController());x.DefaultRealtimeController=Jt.default;const mr=C(requireDefaultReconnectController());x.DefaultReconnectController=mr.default;const Cr=C(requireDefaultSessionStateController());x.DefaultSessionStateController=Cr.default;const zt=C(requireDefaultSigV4());x.DefaultSigV4=zt.default;const Ft=C(requireDefaultSignalingClient());x.DefaultSignalingClient=Ft.default;const kt=C(requireDefaultSimulcastUplinkPolicy());x.DefaultSimulcastUplinkPolicy=kt.default;const ke=C(requireDefaultSimulcastUplinkPolicyForContentShare());x.DefaultSimulcastUplinkPolicyForContentShare=ke.default;const Be=C(requireDefaultTransceiverController());x.DefaultTransceiverController=Be.default;const et=C(requireDefaultTranscriptionController());x.DefaultTranscriptionController=et.default;const Ze=C(requireDefaultUserAgentParser());x.DefaultUserAgentParser=Ze.default;const Qe=C(requireDefaultVideoCaptureAndEncodeParameter());x.DefaultVideoCaptureAndEncodeParameter=Qe.default;const Ke=C(requireDefaultVideoElementResolutionMonitor());x.DefaultVideoElementResolutionMonitor=Ke.default;const Je=C(requireDefaultVideoFrameProcessorPipeline());x.DefaultVideoFrameProcessorPipeline=Je.default;const Re=C(requireDefaultVideoFrameProcessorTimer());x.DefaultVideoFrameProcessorTimer=Re.default;const Bt=C(requireDefaultVideoStreamIdSet());x.DefaultVideoStreamIdSet=Bt.default;const Fe=C(requireDefaultVideoStreamIndex());x.DefaultVideoStreamIndex=Fe.default;const Ge=C(requireDefaultVideoTile());x.DefaultVideoTile=Ge.default;const nr=C(requireDefaultVideoTileController());x.DefaultVideoTileController=nr.default;const jt=C(requireDefaultVideoTileFactory());x.DefaultVideoTileFactory=jt.default;const vr=C(requireDefaultVideoTransformDevice());x.DefaultVideoTransformDevice=vr.default;const it=C(requireDefaultVolumeIndicatorAdapter());x.DefaultVolumeIndicatorAdapter=it.default;const dt=C(requireDefaultWebSocketAdapter());x.DefaultWebSocketAdapter=dt.default;const xe=C(requireDevicePixelRatioWindowSource());x.DevicePixelRatioWindowSource=xe.default;const Xe=C(requireDeviceSelection());x.DeviceSelection=Xe.default;const _e=C(requireEventBufferConfiguration());x.EventBufferConfiguration=_e.default;const ct=C(requireEventIngestionConfiguration());x.EventIngestionConfiguration=ct.default;const Dt=C(requireFinishGatheringICECandidatesTask());x.FinishGatheringICECandidatesTask=Dt.default;const cr=C(requireFullJitterBackoff());x.FullJitterBackoff=cr.default;const fr=C(requireFullJitterBackoffFactory());x.FullJitterBackoffFactory=fr.default;const dr=C(requireFullJitterLimitedBackoff());x.FullJitterLimitedBackoff=dr.default;const jr=C(requireGetUserMediaError());x.GetUserMediaError=jr.default;const Rr=C(requireGlobalMetricReport());x.GlobalMetricReport=Rr.default;const ki=C(requireInMemoryJSONEventBuffer());x.InMemoryJSONEventBuffer=ki.default;const _i=C(requireIntervalScheduler());x.IntervalScheduler=_i.default;const Fr=C(requireJoinAndReceiveIndexTask());x.JoinAndReceiveIndexTask=Fr.default;const Kr=C(requireLeaveAndReceiveLeaveAckTask());x.LeaveAndReceiveLeaveAckTask=Kr.default;const Ur=C(requireListenForVolumeIndicatorsTask());x.ListenForVolumeIndicatorsTask=Ur.default;const ai=C(requireLog());x.Log=ai.default;const ii=C(requireLogLevel());x.LogLevel=ii.default;const Fi=C(requireMediaDeviceProxyHandler());x.MediaDeviceProxyHandler=Fi.default;const Ai=C(requireMeetingEventsClientConfiguration());x.MeetingEventsClientConfiguration=Ai.default;const Zr=C(requireMeetingFeatures());x.MeetingFeatures=Zr.default;const yo=C(requireMeetingReadinessCheckerConfiguration());x.MeetingReadinessCheckerConfiguration=yo.default;const xo=C(requireMeetingSessionConfiguration());x.MeetingSessionConfiguration=xo.default;const Ji=C(requireMeetingSessionCredentials());x.MeetingSessionCredentials=Ji.default;const Yi=C(requireMeetingSessionLifecycleEvent());x.MeetingSessionLifecycleEvent=Yi.default;const rs=C(requireMeetingSessionLifecycleEventCondition());x.MeetingSessionLifecycleEventCondition=rs.default;const So=C(requireMeetingSessionStatus());x.MeetingSessionStatus=So.default;const is=C(requireMeetingSessionStatusCode());x.MeetingSessionStatusCode=is.default;const Zs=C(requireMeetingSessionTURNCredentials());x.MeetingSessionTURNCredentials=Zs.default;const Bn=C(requireMeetingSessionURLs());x.MeetingSessionURLs=Bn.default;const jn=C(requireMeetingSessionVideoAvailability());x.MeetingSessionVideoAvailability=jn.default;const Ei=C(requireMessage());x.Message=Ei.default;const Co=C(requireMessagingSessionConfiguration());x.MessagingSessionConfiguration=Co.default;const ns=C(requireModelSpecBuilder());x.ModelSpecBuilder=ns.default;const rn=C(requireMonitorTask());x.MonitorTask=rn.default;const Eo=C(requireMultiLogger());x.MultiLogger=Eo.default;const wo=C(requireNScaleVideoUplinkBandwidthPolicy());x.NScaleVideoUplinkBandwidthPolicy=wo.default;const Qs=C(requireNoOpAudioVideoController());x.NoOpAudioVideoController=Qs.default;const os=C(requireNoOpDebugLogger());x.NoOpDebugLogger=os.default;const yi=C(requireNoOpDeviceController());x.NoOpDeviceController=yi.default;const ss=C(requireNoOpEventReporter());x.NoOpEventReporter=ss.default;const ea=C(requireNoOpLogger());x.NoOpLogger=ea.default;const Ln=C(requireNoOpMediaStreamBroker());x.NoOpMediaStreamBroker=Ln.default;const as=C(requireNoOpTask());x.NoOpTask=as.default;const Fn=C(requireNoOpVideoElementFactory());x.NoOpVideoElementFactory=Fn.default;const ta=C(requireNoOpVideoFrameProcessor());x.NoOpVideoFrameProcessor=ta.default;const xi=C(requireNoVideoDownlinkBandwidthPolicy());x.NoVideoDownlinkBandwidthPolicy=xi.default;const Ro=C(requireNoVideoUplinkBandwidthPolicy());x.NoVideoUplinkBandwidthPolicy=Ro.default;const ls=C(requireNotFoundError());x.NotFoundError=ls.default;const To=C(requireNotReadableError());x.NotReadableError=To.default;const nn=C(requireOnceTask());x.OnceTask=nn.default;const cs=C(requireOpenSignalingConnectionTask());x.OpenSignalingConnectionTask=cs.default;const us=C(requireOverconstrainedError());x.OverconstrainedError=us.default;const sn=C(requirePOSTLogger());x.POSTLogger=sn.default;const ra=C(requireParallelGroupTask());x.ParallelGroupTask=ra.default;const ds=C(requirePermissionDeniedError());x.PermissionDeniedError=ds.default;const ps=C(requirePrefetchOn());x.PrefetchOn=ps.default;const ko=C(requirePrefetchSortBy());x.PrefetchSortBy=ko.default;const ia=C(requirePromiseQueue());x.PromiseQueue=ia.default;const na=C(requirePromoteToPrimaryMeetingTask());x.PromoteToPrimaryMeetingTask=na.default;const Vn=C(requireRealtimeAttendeePositionInFrame());x.RealtimeAttendeePositionInFrame=Vn.default;const Ao=C(requireRealtimeState());x.RealtimeState=Ao.default;const Po=C(requireRealtimeVolumeIndicator());x.RealtimeVolumeIndicator=Po.default;const an=C(requireReceiveAudioInputTask());x.ReceiveAudioInputTask=an.default;const ln=C(requireReceiveRemoteVideoPauseResumeTask());x.ReceiveRemoteVideoPauseResumeTask=ln.default;const hs=C(requireReceiveVideoInputTask());x.ReceiveVideoInputTask=hs.default;const Mo=C(requireReceiveVideoStreamIndexTask());x.ReceiveVideoStreamIndexTask=Mo.default;const fs=C(requireReconnectionHealthPolicy());x.ReconnectionHealthPolicy=fs.default;const bn=C(requireRedundantAudioEncoder());x.RedundantAudioEncoder=bn.default;const Pi=C(requireRedundantAudioEncoderWorkerCode());x.RedundantAudioEncoderWorkerCode=Pi.default;const Io=C(requireRedundantAudioRecoveryMetricReport());x.RedundantAudioRecoveryMetricReport=Io.default;const cn=C(requireRunnableTask());x.RunnableTask=cn.default;const Vi=C(requireSDP());x.SDP=Vi.default;const ut=C(requireSDPCandidateType());x.SDPCandidateType=ut.default;const Le=C(requireSDPMediaSection());x.SDPMediaSection=Le.default;const We=C(requireSendAndReceiveDataMessagesTask());x.SendAndReceiveDataMessagesTask=We.default;const Ut=C(requireSendingAudioFailureConnectionHealthPolicy());x.SendingAudioFailureConnectionHealthPolicy=Ut.default;const lr=C(requireSerialGroupTask());x.SerialGroupTask=lr.default;const Ar=C(requireServerSideNetworkAdaption());x.ServerSideNetworkAdaption=Ar.default;const Ir=C(requireSessionStateControllerAction());x.SessionStateControllerAction=Ir.default;const Yr=C(requireSessionStateControllerDeferPriority());x.SessionStateControllerDeferPriority=Yr.default;const Xi=C(requireSessionStateControllerState());x.SessionStateControllerState=Xi.default;const yn=C(requireSessionStateControllerTransitionResult());x.SessionStateControllerTransitionResult=yn.default;const oa=C(requireSetLocalDescriptionTask());x.SetLocalDescriptionTask=oa.default;const Nn=C(requireSetRemoteDescriptionTask());x.SetRemoteDescriptionTask=Nn.default;const Un=C(requireSignalingAndMetricsConnectionMonitor());x.SignalingAndMetricsConnectionMonitor=Un.default;const un=C(requireSignalingClientConnectionRequest());x.SignalingClientConnectionRequest=un.default;const xn=C(requireSignalingClientEvent());x.SignalingClientEvent=xn.default;const el=C(requireSignalingClientEventType());x.SignalingClientEventType=el.default;const xc=C(requireSignalingClientJoin());x.SignalingClientJoin=xc.default;const Sc=C(requireSignalingClientSubscribe());x.SignalingClientSubscribe=Sc.default;const Cc=C(requireSignalingClientVideoSubscriptionConfiguration());x.SignalingClientVideoSubscriptionConfiguration=Cc.default;const sa=C(requireSimulcastContentShareTransceiverController());x.SimulcastContentShareTransceiverController=sa.default;const Ec=C(requireSimulcastLayers());x.SimulcastLayers=Ec.default;const wc=C(requireSimulcastTransceiverController());x.SimulcastTransceiverController=wc.default;const Rc=C(requireSimulcastVideoStreamIndex());x.SimulcastVideoStreamIndex=Rc.default;const Tc=C(requireSingleNodeAudioTransformDevice());x.SingleNodeAudioTransformDevice=Tc.default;const kc=C(requireStreamMetricReport());x.StreamMetricReport=kc.default;const tl=C(requireSubscribeAndReceiveSubscribeAckTask());x.SubscribeAndReceiveSubscribeAckTask=tl.default;const _c=C(requireTargetDisplaySize());x.TargetDisplaySize=_c.default;const Ac=C(requireTaskStatus());x.TaskStatus=Ac.default;const Pc=C(requireTimeoutScheduler());x.TimeoutScheduler=Pc.default;const Mc=C(requireTimeoutTask());x.TimeoutTask=Mc.default;const aa=C(requireTranscript());x.Transcript=aa.default;const Ic=C(requireTranscriptAlternative());x.TranscriptAlternative=Ic.default;const Oc=C(requireTranscriptEntity());x.TranscriptEntity=Oc.default;const Dc=C(requireTranscriptItem());x.TranscriptItem=Dc.default;const rl=C(requireTranscriptItemType());x.TranscriptItemType=rl.default;const Bc=C(requireTranscriptLanguageWithScore());x.TranscriptLanguageWithScore=Bc.default;const jc=C(requireTranscriptResult());x.TranscriptResult=jc.default;const Lc=C(requireTranscriptionStatus());x.TranscriptionStatus=Lc.default;const Fc=C(requireTranscriptionStatusType());x.TranscriptionStatusType=Fc.default;const Vc=C(require_TypeError());x.TypeError=Vc.default;const Nc=C(requireUnusableAudioWarningConnectionHealthPolicy());x.UnusableAudioWarningConnectionHealthPolicy=Nc.default;const Uc=C(requireVersioning());x.Versioning=Uc.default;const qc=C(requireVideoAdaptiveProbePolicy());x.VideoAdaptiveProbePolicy=qc.default;const $c=C(requireVideoCodecCapability());x.VideoCodecCapability=$c.default;const la=C(requireVideoEncodingConcurrentSendersHealthPolicy());x.VideoEncodingConcurrentSendersHealthPolicy=la.default;const Oo=C(requireVideoEncodingConnectionHealthPolicyName());x.VideoEncodingConnectionHealthPolicyName=Oo.default;const zc=C(requireVideoEncodingCpuConnectionHealthPolicy());x.VideoEncodingCpuConnectionHealthPolicy=zc.default;const il=C(requireVideoEncodingFramerateConnectionHealthPolicy());x.VideoEncodingFramerateConnectionHealthPolicy=il.default;const nl=C(requireVideoFxProcessor());x.VideoFxProcessor=nl.default;const ol=C(requireVideoLogEvent());x.VideoLogEvent=ol.default;const sl=C(requireVideoOnlyTransceiverController());x.VideoOnlyTransceiverController=sl.default;const al=C(requireVideoPreference());x.VideoPreference=al.default;const qn=C(requireVideoPreferences());x.VideoPreferences=qn.default;const Hc=C(requireVideoPriorityBasedPolicy());x.VideoPriorityBasedPolicy=Hc.default;const Wc=C(requireVideoPriorityBasedPolicyConfig());x.VideoPriorityBasedPolicyConfig=Wc.default;const Gc=C(requireVideoQualityAdaptationPreference());x.VideoQualityAdaptationPreference=Gc.default;const ll=C(requireVideoQualitySettings());x.VideoQualitySettings=ll.default;const cl=C(requireVideoSource());x.VideoSource=cl.default;const Do=C(requireVideoStreamDescription());x.VideoStreamDescription=Do.default;const Bo=C(requireVideoTileState());x.VideoTileState=Bo.default;const Kc=C(requireVoiceFocusDeviceTransformer());x.VoiceFocusDeviceTransformer=Kc.default;const ms=C(requireVoiceFocusTransformDevice());x.VoiceFocusTransformDevice=ms.default;const ul=C(requireWaitForAttendeePresenceTask());x.WaitForAttendeePresenceTask=ul.default;const dl=C(requireWebSocketReadyState());x.WebSocketReadyState=dl.default;const ca=C(requireZLIBTextCompressor());x.ZLIBTextCompressor=ca.default;const ua=requireVideoPreferences();Object.defineProperty(x,"MutableVideoPreferences",{enumerable:!0,get:function(){return ua.MutableVideoPreferences}});const gs=requireTypes$1();Object.defineProperty(x,"Some",{enumerable:!0,get:function(){return gs.Some}}),Object.defineProperty(x,"None",{enumerable:!0,get:function(){return gs.None}}),Object.defineProperty(x,"Maybe",{enumerable:!0,get:function(){return gs.Maybe}});const pl=requireAudioTransformDevice();Object.defineProperty(x,"isAudioTransformDevice",{enumerable:!0,get:function(){return pl.isAudioTransformDevice}});const hl=requireDestroyable();Object.defineProperty(x,"isDestroyable",{enumerable:!0,get:function(){return hl.isDestroyable}});const Jc=requireVideoTransformDevice();Object.defineProperty(x,"isVideoTransformDevice",{enumerable:!0,get:function(){return Jc.isVideoTransformDevice}})}(build$2)),build$2}var buildExports=requireBuild();class BlockingQueue{_promises;_resolvers;constructor(){this._resolvers=[],this._promises=[]}_add(){this._promises.push(new Promise(C=>{this._resolvers.push(C)}))}enqueue(C){this._resolvers.length==0&&this._add(),this._resolvers.shift()(C)}dequeue(){return this._promises.length==0&&this._add(),this._promises.shift()}isEmpty(){return this._promises.length==0}isBlocked(){return this._resolvers.length!=0}get length(){return this._promises.length-this._resolvers.length}}const createDummyMediaStream=x=>{const C=x.createMediaStreamDestination(),E=x.createGain();E.gain.value=0,E.connect(C);const w=x.createOscillator();return w.frequency.value=440,w.connect(E),w.start(),C.stream},validateUrl=x=>x?.endsWith("/")?x.substring(0,x.length-1):x,LOG_PREFIX="[voicechanger-client]";class VoiceChangerClient{voiceChangerStatusListener=null;voiceChangerExceptionListener=null;ctx;vfEnable=!1;vf=null;currentDevice=null;currentMediaStream=null;currentMediaStreamAudioSourceNode=null;currentMediaStreamAudioDestinationNode;currentMediaStreamAudioDestinationMonitorNode;inputGainNode;outputGainNode;monitorGainNode;inputAnalyser;outputAnalyser;inputRms=0;outputRms=0;vcInNode;promiseForInitialize;_isVoiceChanging=!1;setting={inputGain:1,outputGain:1,monitorGain:1,audioInput:"none",echoCancel:!1,noiseSuppression:!1,noiseSuppression2:!1,sampleRate:48e3};nodeSetting={protocol:"rest",sendingMode:"bulk"};workletSetting={realtimeOutputStatusEnabled:!1,isPassthroughEnabled:!1,realtimeOutputStatusSendIntervalSec:10,sendingChunkSec:.2};sslCertified=[];sem=new BlockingQueue;constructor(){}initialize(C,E){log("info",LOG_PREFIX,"initializing..."),this.ctx=C,this.vfEnable=E,this.sem.enqueue(0),this.inputGainNode=this.ctx.createGain(),this.outputGainNode=this.ctx.createGain(),this.monitorGainNode=this.ctx.createGain(),this.inputAnalyser=this.ctx.createAnalyser(),this.outputAnalyser=this.ctx.createAnalyser(),this.inputGainNode.gain.value=this.setting.inputGain,this.outputGainNode.gain.value=this.setting.outputGain,this.monitorGainNode.gain.value=this.setting.monitorGain,this.currentMediaStreamAudioDestinationNode=this.ctx.createMediaStreamDestination(),this.currentMediaStreamAudioDestinationMonitorNode=this.ctx.createMediaStreamDestination();const w={outputChannelCount:[1]};this.promiseForInitialize=new Promise(async T=>{const _=URL.createObjectURL(new Blob([workerjs],{type:"text/javascript"}));await this.ctx.audioWorklet.addModule(_);try{this.vcInNode=new VoiceChangerWorkletNode(this.ctx,w),this.vcInNode.connect(this.outputGainNode),this.outputGainNode.connect(this.currentMediaStreamAudioDestinationNode),this.outputGainNode.connect(this.outputAnalyser),this.vcInNode.connect(this.monitorGainNode),this.monitorGainNode.connect(this.currentMediaStreamAudioDestinationMonitorNode)}catch{try{this.ctx.audioWorklet.addModule(_).then(()=>{this.vcInNode=new VoiceChangerWorkletNode(this.ctx,w),this.vcInNode.connect(this.outputGainNode),this.outputGainNode.connect(this.currentMediaStreamAudioDestinationNode),this.vcInNode.connect(this.monitorGainNode),this.monitorGainNode.connect(this.currentMediaStreamAudioDestinationMonitorNode)})}catch(S){log("error",LOG_PREFIX,S)}}if(this.vcInNode.updateSetting(this.nodeSetting),this.vcInNode.updateWorkletSetting(this.workletSetting),this.vfEnable){this.vf=await buildExports.VoiceFocusDeviceTransformer.create({variant:"c20"});const S=createDummyMediaStream(this.ctx);this.currentDevice=await this.vf.createTransformDevice(S)||null}this.setVoiceChangerWorkletNodeListener(),T()})}_lock=async()=>await this.sem.dequeue();_unlock=C=>{this.sem.enqueue(C+1)};isInitialized=async()=>{for(;;){if(this.promiseForInitialize)return await this.promiseForInitialize,!0;await new Promise(C=>setTimeout(C,100))}};getRms=(C,E=0)=>{const w=new Float32Array(C.fftSize);C.getFloatTimeDomainData(w);let T=0;for(let S=0;S<w.length;S++)T+=w[S]*w[S];const _=Math.sqrt(T/w.length);return Math.max(_,E*.95)};setVoiceChangerWorkletNodeListener=()=>{const C={onRealtimeOutputStatus:w=>{w.inputRms==null||w.outputRms==null?(this.inputRms=this.getRms(this.inputAnalyser,this.inputRms),this.outputRms=this.getRms(this.outputAnalyser,this.outputRms),this.voiceChangerStatusListener?.onRealtimeOutputStatus({...w,inputRms:this.inputRms,outputRms:this.outputRms})):w.inputRms!=null&&w.outputRms!=null&&this.voiceChangerStatusListener?.onRealtimeOutputStatus({...w,inputRms:w.inputRms,outputRms:w.outputRms})},onRealtimeProcessStatus:w=>{this.voiceChangerStatusListener?.onRealtimeProcessStatus(w)},onData:(w,T)=>{this.voiceChangerStatusListener?.onData(w,T)}},E={onException:(w,T)=>{this.voiceChangerExceptionListener?.onException(w,T)}};this.vcInNode.setStatusListener(C),this.vcInNode.setExceptionListener(E)};setVoiceChangerStatusListener=C=>{this.voiceChangerStatusListener=C};setVoiceChangerExceptionListener=C=>{this.voiceChangerExceptionListener=C};setup=async()=>{if(log("info",LOG_PREFIX,`Input Setup=> audio: ${this.setting.audioInput}`),log("info",LOG_PREFIX,`Input Setup=> echo: ${this.setting.echoCancel}, noise1: ${this.setting.noiseSuppression}, noise2: ${this.setting.noiseSuppression2}`),this.currentMediaStream&&(this.currentMediaStream.getTracks().forEach(C=>{C.stop()}),this.currentMediaStream=null),typeof this.setting.audioInput=="string")try{this.setting.audioInput=="none"?(log("info",LOG_PREFIX,"Input Setup=> dummy stream."),this.currentMediaStream=createDummyMediaStream(this.ctx)):this.currentMediaStream=await navigator.mediaDevices.getUserMedia({audio:{deviceId:this.setting.audioInput,channelCount:1,sampleRate:this.setting.sampleRate,sampleSize:16,autoGainControl:!1,echoCancellation:this.setting.echoCancel,noiseSuppression:this.setting.noiseSuppression}})}catch(C){throw log("error",LOG_PREFIX,C),this.vcInNode.stop(),C}else this.currentMediaStream=this.setting.audioInput;if(this.currentMediaStreamAudioSourceNode=this.ctx.createMediaStreamSource(this.currentMediaStream),this.inputGainNode.gain.value=this.setting.inputGain,this.currentMediaStreamAudioSourceNode.connect(this.inputGainNode),this.currentDevice&&this.setting.noiseSuppression2){this.currentDevice.chooseNewInnerDevice(this.currentMediaStream);const C=await this.currentDevice.createAudioNode(this.ctx);this.inputGainNode.connect(C.start),C.end.connect(this.vcInNode),C.end.connect(this.inputAnalyser)}else this.inputGainNode.connect(this.vcInNode),this.inputGainNode.connect(this.inputAnalyser);console.log("Input Setup=> success")};get stream(){return this.currentMediaStreamAudioDestinationNode.stream}get monitorStream(){return this.currentMediaStreamAudioDestinationMonitorNode.stream}start=async()=>{await this.vcInNode.start(),this._isVoiceChanging=!0};stop=async()=>{await this.vcInNode.stop(),this._isVoiceChanging=!1};get isVoiceChanging(){return this._isVoiceChanging}setServerUrl=(C,E=!1)=>{const w=validateUrl(C),T=`${location.protocol}//${location.host}`;throw w!=T&&w.length!=0&&location.protocol=="https:"&&this.sslCertified.includes(w)==!1&&E&&(window.confirm("MMVC Server is different from this page's origin. Open tab to open ssl connection. OK? (You can close the opened tab after ssl connection succeed.)")?(window.open(w,"_blank"),this.sslCertified.push(w)):alert("Your voice conversion may fail...")),new Error("setServerUrl not implemented")};getClientSetting=()=>({voiceChangerClientSetting:{...this.setting},workletNodeSetting:{...this.nodeSetting},workletSetting:{...this.workletSetting}});updateClientSetting=async C=>{const E=await this._lock();let w=!1;console.log("updateClientSetting",C),(this.setting.audioInput!=C.audioInput||this.setting.echoCancel!=C.echoCancel||this.setting.noiseSuppression!=C.noiseSuppression||this.setting.noiseSuppression2!=C.noiseSuppression2||this.setting.sampleRate!=C.sampleRate)&&(console.log("updateClientSetting update required"),w=!0),this.setting.inputGain!=C.inputGain&&this._setInputGain(C.inputGain),this.setting.outputGain!=C.outputGain&&this._setOutputGain(C.outputGain),this.setting.monitorGain!=C.monitorGain&&this._setMonitorGain(C.monitorGain),this.setting=C,w&&await this.setup(),await this._unlock(E)};updateNodeSetting=async C=>{const E=await this._lock();this.vcInNode.updateSetting(C),this.nodeSetting=C,await this._unlock(E)};updateWorkletSetting=async C=>{const E=await this._lock();this.vcInNode.updateWorkletSetting(C),this.workletSetting=C,await this._unlock(E)};_setInputGain=C=>{this.inputGainNode&&C!=null&&(this.inputGainNode.gain.value=C)};_setOutputGain=C=>{this.outputGainNode&&C!=null&&(this.outputGainNode.gain.value=C)};_setMonitorGain=C=>{this.monitorGainNode&&C!=null&&(this.monitorGainNode.gain.value=C)};resetBuffer=()=>this.vcInNode.resetBuffer();startInputRecording=()=>{this.vcInNode.startInputRecording()};stopInputRecording=()=>this.vcInNode.stopInputRecording();startOutputRecording=()=>this.vcInNode.startOutputRecording();stopOutputRecording=()=>this.vcInNode.stopOutputRecording();getOutputBufferSize=async()=>await this.vcInNode.getOutputBufferSize();abortAllRequests=()=>this.vcInNode.abortAllRequests();isRequestPending=()=>this.vcInNode.isRequestPending();getPendingRequestCount=()=>this.vcInNode.getPendingRequestCount()}const RightButtonArea=({model:x,isMoving:C,setIsMoving:E,isMovingTarget:w,onUploadClick:T,onSampleModelClick:_})=>{const{t:S}=useTranslation(),R=x.slot_index,{deleteServerSlotInfo:A,moveModel:O,exportModel:H,exportToOnnx:ee,moveExportedOnnxModel:te,triggerToast:ie,serverSlotInfos:ne}=useAppRoot(),[ae,oe]=reactExports.useState(!1),[le,fe]=reactExports.useState(!1),[de,ce]=reactExports.useState(!1),[pe,he]=reactExports.useState(null),[me,ve]=reactExports.useState(0),ye=React.useRef(0),Se=React.useRef(null),[Ce,be]=reactExports.useState(!1),Ee=x.voice_changer_type=="RVC"&&x.is_onnx==!1,Ae=reactExports.useMemo(()=>ne.filter(Oe=>Oe.voice_changer_type==null).map(Oe=>Oe.slot_index).sort((Oe,Ve)=>Oe-Ve),[ne]);React.useEffect(()=>{le&&Ae.length>0&&he(Ae[0])},[le,Ae]);const Ie=()=>{ve(0),ye.current=0;let Oe=0;Se.current&&clearInterval(Se.current),Se.current=setInterval(()=>{Oe+=.3;let Ve=0;Oe<59?Ve=Math.min(99,Oe/59*99):Oe<60?Ve=99+(Oe-59)/1*.01:(Ve=100,Se.current&&clearInterval(Se.current)),ye.current=Ve,ve(Ve)},300)},Te=()=>{Se.current&&clearInterval(Se.current),ve(100),ye.current=100};React.useEffect(()=>(le?ve(0):Te(),()=>{Se.current&&clearInterval(Se.current)}),[le]);const De=reactExports.useMemo(()=>x.voice_changer_type==null?null:jsxRuntimeExports.jsx(IconButton,{onClick:Ve=>{Ve.stopPropagation(),E(R)},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:C===R?"primary.main":"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntimeExports.jsx("path",{d:"M5 9l7-7 7 7M5 15l7 7 7-7"})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S(C===R?"common.model_editor.moving":"common.model_editor.move")})]})}),[C,R,E,S,x.voice_changer_type]),Ue=reactExports.useMemo(()=>x.voice_changer_type==null?null:jsxRuntimeExports.jsx(IconButton,{onClick:async Ve=>{Ve.stopPropagation(),be(!0);try{const Ht=await H({slot_index:R});if(!Ht)return;const Kt=(x.name?x.name:`model_${R}`)+".zip",ir=window.URL.createObjectURL(Ht),$t=document.createElement("a");$t.href=ir,$t.download=Kt,document.body.appendChild($t),$t.click(),document.body.removeChild($t),window.URL.revokeObjectURL(ir)}catch(Ht){console.error(S("common.model_editor.download_failed"),Ht),ie("error",S("common.model_editor.download_failed"))}finally{be(!1)}},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},disabled:Ce,children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),jsxRuntimeExports.jsx("polyline",{points:"7 10 12 15 17 10"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S("common.model_editor.download")})]})}),[x.voice_changer_type,R,S,x.name,H,Ce,ie]),ze=reactExports.useMemo(()=>x.voice_changer_type==null?null:jsxRuntimeExports.jsx(IconButton,{onClick:Ve=>{Ve.stopPropagation(),oe(!0)},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntimeExports.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S("common.model_editor.delete")})]})}),[x.voice_changer_type,S]),Pe=reactExports.useMemo(()=>x.voice_changer_type!=null||w?null:jsxRuntimeExports.jsx(IconButton,{onClick:Ve=>{Ve.stopPropagation(),T(R)},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:w?"primary.main":"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),jsxRuntimeExports.jsx("polyline",{points:"17 8 12 3 7 8"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S("common.model_editor.upload")})]})}),[x.voice_changer_type,w,R,S,T]),$e=reactExports.useMemo(()=>x.voice_changer_type!=null||w==!1?null:jsxRuntimeExports.jsx(IconButton,{onClick:Ve=>{Ve.stopPropagation(),C!=null&&(O(C,R),E(null))},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:w?"primary.main":"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),jsxRuntimeExports.jsx("polyline",{points:"17 8 12 3 7 8"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S("common.model_editor.move_here")})]})}),[x.voice_changer_type,w,C,R,S,O,E]),He=reactExports.useMemo(()=>Ee?jsxRuntimeExports.jsx(IconButton,{onClick:Ve=>{Ve.stopPropagation(),fe(!0)},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},disabled:de,children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("circle",{cx:"12",cy:"3",r:"1.2",fill:"currentColor"}),jsxRuntimeExports.jsx("circle",{cx:"20",cy:"7",r:"1.2",fill:"currentColor"}),jsxRuntimeExports.jsx("circle",{cx:"17",cy:"20",r:"1.2",fill:"currentColor"}),jsxRuntimeExports.jsx("circle",{cx:"7",cy:"20",r:"1.2",fill:"currentColor"}),jsxRuntimeExports.jsx("circle",{cx:"4",cy:"7",r:"1.2",fill:"currentColor"}),jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"1.2",fill:"currentColor"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"20",y2:"7"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"4",y2:"7"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"20",y1:"7",x2:"17",y2:"20"}),jsxRuntimeExports.jsx("line",{x1:"20",y1:"7",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"17",y1:"20",x2:"7",y2:"20"}),jsxRuntimeExports.jsx("line",{x1:"17",y1:"20",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"7",y1:"20",x2:"4",y2:"7"}),jsxRuntimeExports.jsx("line",{x1:"7",y1:"20",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"4",y1:"7",x2:"12",y2:"12"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S("common.model_editor.generate_onnx")})]})}):null,[Ee,S,de]),je=reactExports.useMemo(()=>x.voice_changer_type!=null?null:jsxRuntimeExports.jsx(IconButton,{onClick:async Ve=>{Ve.stopPropagation(),_(R)},color:"default",sx:{height:"43px",width:"160px",border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntimeExports.jsx("path",{d:"M12 8v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntimeExports.jsx("polyline",{points:"9 13 12 16 15 13",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:S("common.model_editor.sample_model")})]})}),[x.voice_changer_type,S,R,_]),Ne=reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",flexShrink:0},children:[De,Ue,ze,He,Pe,$e,je]}),[ze,Ue,$e,De,Pe,He,je]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Ne,jsxRuntimeExports.jsx(ConfirmationDialog,{isOpen:ae,title:S("common.model_editor.delete_model"),message:S("common.model_editor.delete_confirm_message"),confirmButtonText:S("common.model_editor.delete"),cancelButtonText:S("common.model_editor.cancel"),onConfirm:async()=>{await A(R),oe(!1)},onCancel:()=>oe(!1)}),jsxRuntimeExports.jsx(ConfirmationDialog,{isOpen:le,title:S("common.model_editor.generate_onnx"),message:S("common.model_editor.generate_onnx_confirm_message"),confirmButtonText:S("common.model_editor.generate_onnx"),cancelButtonText:S("common.model_editor.cancel"),onConfirm:async()=>{if(pe!=null){ce(!0),Ie();try{await ee({slot_index:R}),await te(pe),Te(),ie("success",S("common.model_editor.generate_onnx_success"))}catch{Te(),ie("error",S("common.model_editor.generate_onnx_failed"))}finally{ce(!1),fe(!1)}}},onCancel:()=>fe(!1),messageExtra:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Box,{sx:{width:"100%",mt:2},children:[jsxRuntimeExports.jsx(LinearProgress,{variant:"determinate",value:me}),jsxRuntimeExports.jsxs("div",{style:{textAlign:"right",fontSize:12,marginTop:4},children:[me.toFixed(2),"%"]})]}),Ae.length>0?jsxRuntimeExports.jsxs(FormControl,{fullWidth:!0,size:"small",sx:{mt:2},children:[jsxRuntimeExports.jsx(InputLabel,{id:"onnx-slot-select-label",children:S("common.model_editor.select_slot")}),jsxRuntimeExports.jsx(Select,{labelId:"onnx-slot-select-label",value:pe??"",label:S("common.model_editor.select_slot"),onChange:Oe=>he(Number(Oe.target.value)),children:Ae.map(Oe=>jsxRuntimeExports.jsx(MenuItem,{value:Oe,children:S("common.model_editor.slot",{number:Oe+1})},Oe))})]}):jsxRuntimeExports.jsx("div",{style:{color:"red",marginTop:8},children:S("common.model_editor.no_empty_slot")})]})}),jsxRuntimeExports.jsx(Dialog,{open:Ce,PaperProps:{sx:{backgroundColor:"background.paper",padding:2}},children:jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsxs(Stack,{spacing:2,alignItems:"center",children:[jsxRuntimeExports.jsx(CircularProgress,{}),jsxRuntimeExports.jsx(Typography,{children:S("common.model_editor.downloading")}),jsxRuntimeExports.jsx(IconButton,{onClick:()=>be(!1),sx:{position:"absolute",right:8,top:8},"aria-label":"close",children:jsxRuntimeExports.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})})]})},IconArea=({model:x})=>{const C=useTheme(),{t:E}=useTranslation(),{uploadIconFile:w,triggerToast:T}=useAppRoot(),_=reactExports.useRef(null),S=reactExports.useCallback(O=>{O.stopPropagation(),x?.name&&_.current&&(_.current.value="",_.current.click())},[x?.name]),R=reactExports.useCallback(async O=>{const H=O.target.files?.[0];if(H&&x?.slot_index!==void 0)try{await w(x.slot_index,H,()=>{}),T("success",E("common.model_editor.icon_upload_success"))}catch{T("error",E("common.model_editor.icon_upload_failed"))}},[x?.slot_index,w,T,E]);return reactExports.useMemo(()=>{const O=x.icon_file?"model_dir/"+x.slot_index+"/"+x.icon_file.split(/[/\\]/).pop():"./assets/icons/human.png";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{type:"file",accept:"image/*",style:{display:"none"},ref:_,onChange:R}),jsxRuntimeExports.jsx("div",{style:{width:"64px",height:"64px",flexShrink:0,borderRadius:"8px",overflow:"hidden",backgroundColor:C.palette.mode==="light"?"#f0f2f5":C.palette.background.default,display:"flex",alignItems:"center",justifyContent:"center",cursor:x?.name?"pointer":"default",position:"relative"},onClick:S,children:x.voice_changer_type!=null?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[x.icon_file?jsxRuntimeExports.jsx("img",{src:O,alt:x.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):jsxRuntimeExports.jsx("div",{style:{fontSize:"24px",fontWeight:"bold",color:C.palette.text.secondary},children:x.name.charAt(0).toUpperCase()}),jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.3)",display:"flex",alignItems:"center",justifyContent:"center",opacity:0,transition:"opacity 0.2s"},onMouseEnter:H=>{H.target.style.opacity="1"},onMouseLeave:H=>{H.target.style.opacity="0"},children:jsxRuntimeExports.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),jsxRuntimeExports.jsx("polyline",{points:"17 8 12 3 7 8"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})})]}):jsxRuntimeExports.jsx("div",{style:{fontSize:"24px",color:C.palette.text.secondary},children:"-"})})]})},[x.name,x.icon_file,x.slot_index,x.voice_changer_type,C.palette.mode,C.palette.text.secondary,C.palette.background.default,R,S])},TagIcon=({label:x,size:C=16})=>jsxRuntimeExports.jsx("span",{style:{display:"inline-flex",alignItems:"center",border:"1.2px solid currentColor",borderRadius:4,padding:"0 6px",fontSize:C*.7,fontWeight:600,marginLeft:4,height:C,lineHeight:`${C}px`,background:"transparent",whiteSpace:"nowrap"},children:x}),InfoArea=({model:x})=>{const{serverSlotInfos:C,updateServerSlotInfo:E}=useAppRoot(),w=useTheme(),{t:T}=useTranslation(),[_,S]=reactExports.useState(""),[R,A]=reactExports.useState(""),[O,H]=reactExports.useState(!1),[ee,te]=reactExports.useState(!1),ie=reactExports.useCallback(async(fe,de)=>{const ce=C.find(pe=>pe.slot_index===fe);if(ce)try{await E({...ce,name:de}),H(!1)}catch(pe){console.error(T("common.model_editor.name_update_failed"),pe)}},[C,E,T]),ne=reactExports.useCallback(async(fe,de)=>{const ce=C.find(pe=>pe.slot_index===fe);if(ce)try{await E({...ce,description:de}),te(!1)}catch(pe){console.error(T("common.model_editor.description_update_failed"),pe)}},[C,E,T]),ae=reactExports.useMemo(()=>O?jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsxRuntimeExports.jsx("input",{type:"text",value:_,onChange:fe=>S(fe.target.value),onKeyDown:async fe=>{fe.key==="Enter"?await ie(x.slot_index,_):fe.key==="Escape"&&H(!1)},style:{padding:"4px 8px",borderRadius:"4px",border:`1px solid ${w.palette.divider}`,backgroundColor:w.palette.background.default,color:w.palette.text.primary},autoFocus:!0}),jsxRuntimeExports.jsx(IconButton,{onClick:async()=>{await ie(x.slot_index,_)},color:"default",sx:{height:"32px",minWidth:"64px",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(Stack,{direction:"row",spacing:1,alignItems:"center",children:jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:T("common.model_editor.save")})})}),jsxRuntimeExports.jsx(IconButton,{onClick:()=>H(!1),color:"default",sx:{height:"32px",minWidth:"64px",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(Stack,{direction:"row",spacing:1,alignItems:"center",children:jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:T("common.model_editor.cancel")})})})]})}):jsxRuntimeExports.jsx("div",{onClick:()=>{ee||(H(!0),S(x.name||""))},style:{cursor:ee?"default":"pointer",color:w.palette.text.primary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),[O,ee,x.name,x.slot_index,_,S,T,w.palette.background.default,w.palette.divider,w.palette.text.primary,ie]),oe=reactExports.useMemo(()=>jsxRuntimeExports.jsx("div",{children:ee?jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginTop:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"text",value:R,onChange:fe=>A(fe.target.value),onKeyDown:async fe=>{fe.key==="Enter"?await ne(x.slot_index,R):fe.key==="Escape"&&te(!1)},style:{padding:"4px 8px",borderRadius:"4px",border:`1px solid ${w.palette.divider}`,backgroundColor:w.palette.background.default,color:w.palette.text.primary,width:"100%"},autoFocus:!0}),jsxRuntimeExports.jsx(IconButton,{onClick:async()=>{await ne(x.slot_index,R)},color:"default",sx:{height:"32px",minWidth:"64px",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(Stack,{direction:"row",spacing:1,alignItems:"center",children:jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:T("common.model_editor.save")})})}),jsxRuntimeExports.jsx(IconButton,{onClick:()=>te(!1),color:"default",sx:{height:"32px",minWidth:"64px",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(Stack,{direction:"row",spacing:1,alignItems:"center",children:jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:T("common.model_editor.cancel")})})})]}):jsxRuntimeExports.jsx("div",{onClick:()=>{O||(te(!0),A(x.description||""))},style:{fontSize:"14px",color:w.palette.text.secondary,marginTop:"4px",cursor:O?"default":"pointer"},children:x.description&&x.description.length>0?x.description:T("common.model_editor.no_description")})}),[ee,O,x.description,x.slot_index,R,A,T,w.palette.background.default,w.palette.divider,w.palette.text.primary,w.palette.text.secondary,ne]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{style:{width:"60%"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",fontWeight:"bold",marginBottom:"4px",color:w.palette.text.primary,gap:"1rem"},children:[jsxRuntimeExports.jsx("span",{children:T("common.model_editor.slot",{number:x.slot_index+1})}),jsxRuntimeExports.jsx("span",{style:{display:"flex",alignItems:"center",gap:"0.3rem"},children:x.voice_changer_type!=null?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TagIcon,{label:x.voice_changer_type}),x.voice_changer_type==="RVC"&&jsxRuntimeExports.jsx(TagIcon,{label:(x.is_onnx?"onnx":"torch")+" "+x.version}),x.voice_changer_type==="RVC"&&jsxRuntimeExports.jsx(TagIcon,{label:x.is_f0?"f0":"non-f0"}),x.voice_changer_type==="RVC"&&jsxRuntimeExports.jsx(TagIcon,{label:x.embedder}),x.voice_changer_type==="Beatrice_v2"&&jsxRuntimeExports.jsx(TagIcon,{label:x.model_info.model.version})]}):null})]}),jsxRuntimeExports.jsx("div",{children:x.voice_changer_type!=null?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ae,oe]}):jsxRuntimeExports.jsx("div",{style:{color:w.palette.text.secondary},children:T("common.model_editor.empty_slot")})})]}),[x,T,w,ae,oe])},CloseIcon=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),ModelUploadDialog=x=>{const{serverProperties:C}=useAppRoot(),{onClose:E}=x,{t:w}=useTranslation(),T=useTheme(),[_,S]=React.useState(VoiceChangerType.RVC),[R,A]=React.useState(null),[O,H]=React.useState(null),[ee,te]=React.useState(null),ie=React.useRef(null),ne=React.useRef(null),ae=React.useRef(null),oe=useAppRoot(),[le,fe]=React.useState(!1),[de,ce]=React.useState(0),[pe,he]=reactExports.useState(!1);reactExports.useEffect(()=>{C.available_voice_changer_types.includes(VoiceChangerType.RVC)?S(VoiceChangerType.RVC):C.available_voice_changer_types.includes(VoiceChangerType.Beatrice_v2)&&S(VoiceChangerType.Beatrice_v2)},[C.available_voice_changer_types]);const me=reactExports.useCallback(async()=>{if(!x.slotIndex&&x.slotIndex!==0)return;const Se=[];if(_===VoiceChangerType.RVC){if(!R){alert(w("common.model_upload.select_model_file_error"));return}Se.push({kind:"rvcModel",file:R}),O&&Se.push({kind:"rvcIndex",file:O})}else if(_===VoiceChangerType.Beatrice_v2){if(!ee){alert(w("common.model_upload.select_zip_error"));return}Se.push({kind:"beatriceV2Zip",file:ee})}else{alert(w("common.model_upload.unsupported_voice_changer_type"));return}fe(!0),ce(0);try{await oe.uploadModelFile(x.slotIndex,_,Se,null,(Ce,be)=>{console.log("uploadModelFile",Ce,be),ce(Ce),be&&(ce(100),he(!0),setTimeout(()=>{fe(!1)},1e3))})}catch(Ce){fe(!1);let be=w("common.model_upload.upload_error");if(console.log(be,Ce),typeof Ce=="object"&&Ce!==null&&"reason"in Ce&&"detail"in Ce&&"action"in Ce){const Ee=Ce;oe.triggerToast("error",jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",fontSize:"1rem"},children:be}),jsxRuntimeExports.jsx("div",{style:{fontSize:"0.9rem"},children:Ee.reason??""}),jsxRuntimeExports.jsxs("div",{style:{fontSize:"0.9rem"},children:[" ",Ee.detail??""," "]}),jsxRuntimeExports.jsx("div",{style:{fontSize:"0.9rem"},children:Ee.action??""})]}));return}else typeof Ce=="object"&&Ce&&"message"in Ce&&typeof Ce.message=="string"&&(be+=Ce.message),oe.triggerToast("error",be)}},[x.slotIndex,_,R,O,ee,oe,w]),ve=reactExports.useCallback(()=>{he(!1),E()},[E]),ye=reactExports.useMemo(()=>jsxRuntimeExports.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:E,children:jsxRuntimeExports.jsxs("div",{style:{backgroundColor:T.palette.background.paper,borderRadius:"8px",padding:"20px",width:"90%",maxWidth:"800px",maxHeight:"80vh",overflow:"auto",color:T.palette.text.primary},onClick:Se=>Se.stopPropagation(),children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntimeExports.jsx("h2",{style:{margin:0},children:w("common.model_upload.title")}),jsxRuntimeExports.jsx(IconButton,{onClick:E,size:"large",sx:{color:T.palette.text.secondary},children:jsxRuntimeExports.jsx(CloseIcon,{})})]}),jsxRuntimeExports.jsx("div",{style:{marginBottom:"20px",color:T.palette.text.primary},children:w("common.model_upload.slot_info",{slotNumber:(x.slotIndex??0)+1})}),jsxRuntimeExports.jsxs(FormControl,{fullWidth:!0,sx:{marginBottom:"20px"},children:[jsxRuntimeExports.jsx(InputLabel,{id:"voice-changer-type-label",children:w("common.model_upload.voice_changer_type")}),jsxRuntimeExports.jsx(Select,{labelId:"voice-changer-type-label",value:_,label:w("common.model_upload.voice_changer_type"),onChange:Se=>{C.available_voice_changer_types.includes(Se.target.value)?S(Se.target.value):alert(w("common.model_upload.unsupported_voice_changer_type_message",{slotNumber:Se.target.value}))},children:C.available_voice_changer_types.map(Se=>jsxRuntimeExports.jsx(MenuItem,{value:Se,children:Se},Se))})]}),_===VoiceChangerType.RVC&&jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntimeExports.jsxs("div",{style:{marginBottom:"10px",display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button,{variant:"outlined",component:"span",onClick:()=>ie.current?.click(),sx:{marginRight:"10px",width:200,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:jsxRuntimeExports.jsx("span",{style:{display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"middle"},children:w("common.model_upload.select_model_file")})}),jsxRuntimeExports.jsx("input",{ref:ie,type:"file",accept:".pth,.onnx",style:{display:"none"},onChange:Se=>A(Se.target.files?.[0]||null)}),R&&jsxRuntimeExports.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},children:R.name})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button,{variant:"outlined",component:"span",onClick:()=>ne.current?.click(),sx:{marginRight:"10px",width:200,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:jsxRuntimeExports.jsx("span",{style:{display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"middle"},children:w("common.model_upload.select_index_file")})}),jsxRuntimeExports.jsx("input",{ref:ne,type:"file",accept:".index,.bin",style:{display:"none"},onChange:Se=>H(Se.target.files?.[0]||null)}),O&&jsxRuntimeExports.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},children:O.name})]})]}),_===VoiceChangerType.Beatrice_v2&&jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px",display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button,{variant:"outlined",component:"span",onClick:()=>ae.current?.click(),sx:{marginRight:"10px",width:200,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:jsxRuntimeExports.jsx("span",{style:{display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"middle"},children:w("common.model_upload.select_zip")})}),jsxRuntimeExports.jsx("input",{ref:ae,type:"file",accept:".zip",style:{display:"none"},onChange:Se=>te(Se.target.files?.[0]||null)}),ee&&jsxRuntimeExports.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},children:ee.name})]}),le&&jsxRuntimeExports.jsxs("div",{style:{marginBottom:20},children:[jsxRuntimeExports.jsx(LinearProgress,{variant:"determinate",value:de}),jsxRuntimeExports.jsxs("div",{style:{textAlign:"right",fontSize:"0.9rem",marginTop:4},children:[de,"%"]})]}),jsxRuntimeExports.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"30px"},children:jsxRuntimeExports.jsx(Button,{variant:"contained",color:"primary",onClick:me,children:w("common.model_upload.upload_button")})})]})}),[E,w,T,_,R,O,ee,me,x.slotIndex,le,de]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ye,jsxRuntimeExports.jsx(ConfirmationDialog,{isOpen:pe,title:w("common.model_upload.upload_complete_title"),message:w("common.model_upload.upload_complete_message"),confirmButtonText:"OK",cancelButtonText:"OK",onConfirm:ve,onCancel:ve,showCancelButton:!1})]})},AudioFile=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 11h-3v3.75c0 1.24-1.01 2.25-2.25 2.25S8.5 17.99 8.5 16.75s1.01-2.25 2.25-2.25c.46 0 .89.14 1.25.38V11h4zm-3-4V3.5L18.5 9z"})),Edit=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"})),ExpandLess=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),ExpandMore=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),FiberManualRecord=createSvgIcon(jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"8"})),GraphicEq=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M7 18h2V6H7zm4 4h2V2h-2zm-8-8h2v-4H3zm12 4h2V6h-2zm4-8v4h2v-4z"})),LibraryMusic=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-2 5h-3v5.5c0 1.38-1.12 2.5-2.5 2.5S10 13.88 10 12.5s1.12-2.5 2.5-2.5c.57 0 1.08.19 1.5.51V5h4zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4z"})),Loop=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"})),Mic=createSvgIcon(jsxRuntimeExports.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"})),NetworkPing=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M12 14.67 3.41 6.09 2 7.5l8.5 8.5H4v2h16v-2h-6.5l5.15-5.15c.26.1.55.15.85.15 1.38 0 2.5-1.12 2.5-2.5S20.88 6 19.5 6 17 7.12 17 8.5c0 .35.07.67.2.97z"})),PlayArrow=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M8 5v14l11-7z"})),ScreenShare=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.11-.9-2-2-2H4c-1.11 0-2 .89-2 2v10c0 1.1.89 2 2 2H0v2h24v-2zm-7-3.53v-2.19c-2.78 0-4.61.85-6 2.72.56-2.67 2.11-5.33 6-5.87V7l4 3.73z"})),Send=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"})),Settings=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"})),Stop=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M6 6h12v12H6z"})),SwapHoriz=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M6.99 11 3 15l3.99 4v-3H14v-2H6.99zM21 9l-3.99-4v3H10v2h7.01v3z"})),Tune=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),VolumeUp=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M3 9v6h4l5 5V4L7 9zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77"})),DownloadProgressDialog=({open:x,sampleName:C,progress:E})=>{const w=useTheme(),{t:T}=useTranslation();return jsxRuntimeExports.jsxs(Dialog,{open:x,maxWidth:"sm",fullWidth:!0,disableEscapeKeyDown:!0,children:[jsxRuntimeExports.jsx(DialogTitle,{sx:{textAlign:"center",pb:1},children:T("common.sample_model_dialog.downloading_title")}),jsxRuntimeExports.jsx(DialogContent,{sx:{pt:1},children:jsxRuntimeExports.jsxs(Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[jsxRuntimeExports.jsx(Typography,{variant:"body1",color:"text.primary",sx:{fontWeight:"medium"},children:C}),jsxRuntimeExports.jsxs(Box,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:1},children:[jsxRuntimeExports.jsx(LinearProgress,{variant:"determinate",value:E,sx:{height:12,borderRadius:6,backgroundColor:w.palette.grey[300],"& .MuiLinearProgress-bar":{borderRadius:6}}}),jsxRuntimeExports.jsxs(Typography,{variant:"h6",color:"text.primary",sx:{textAlign:"center",fontWeight:"bold"},children:[E,"%"]})]}),jsxRuntimeExports.jsx(Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:T("common.sample_model_dialog.downloading_wait_message")})]})})]})},SampleModelDailog=({open:x,onClose:C,slotIndex:E})=>{const{samples:w,downloadSample:T,triggerToast:_,reloadServerSlotInfos:S,getTask:R}=useAppRoot(),A=useTheme(),{t:O}=useTranslation(),[H,ee]=reactExports.useState({isDownloading:!1,progress:0,currentSampleId:null,currentSampleName:""}),te=reactExports.useCallback(async ie=>{const ne=w.find(ae=>ae.id===ie);if(ne)try{ee({isDownloading:!0,progress:0,currentSampleId:ie,currentSampleName:ne.name});const ae=await T(E,ie),oe=async(le,fe)=>{setTimeout(async()=>{const de=await R(le);if(de===null){console.warn("download sample task is null"),ee(he=>({...he,isDownloading:!1}));return}const ce=de.progress||0,pe=Math.round(ce*100);if(ee(he=>({...he,progress:pe})),de.status==="done"){ee(he=>({...he,progress:100})),S(),_("success",O("common.sample_model_dialog.download_success")),setTimeout(()=>{ee({isDownloading:!1,progress:0,currentSampleId:null,currentSampleName:""})},1500),C();return}if(fe>60){console.warn("download sample check is timeout"),ee(he=>({...he,isDownloading:!1})),_("error",O("common.sample_model_dialog.download_timeout"));return}else oe(le,fe+1)},1e3*1)};oe(ae.id,0)}catch{ee(ae=>({...ae,isDownloading:!1})),_("error",O("common.sample_model_dialog.download_error"))}},[T,E,_,w,S,R,C,O]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:C,maxWidth:"sm",fullWidth:!0,children:[jsxRuntimeExports.jsxs(DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[O("common.sample_model_dialog.title"),jsxRuntimeExports.jsx(IconButton,{onClick:C,size:"large",children:jsxRuntimeExports.jsx(CloseIcon,{})})]}),jsxRuntimeExports.jsx("div",{style:{padding:"0 24px 8px 24px",fontSize:14,color:A.palette.text.secondary},children:O("common.sample_model_dialog.slot_id",{slotIndex:E+1})}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[w.length===0&&jsxRuntimeExports.jsx("div",{children:O("common.sample_model_dialog.no_samples")}),w.map(ie=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",borderBottom:`1px solid ${A.palette.divider}`,padding:"8px 0"},children:[jsxRuntimeExports.jsx("div",{style:{width:64,height:64,borderRadius:8,overflow:"hidden",background:A.palette.background.default,display:"flex",alignItems:"center",justifyContent:"center"},children:ie.icon_url?jsxRuntimeExports.jsx("img",{src:ie.icon_url,alt:ie.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):jsxRuntimeExports.jsx("div",{style:{fontSize:32,color:A.palette.text.secondary},children:ie.name.charAt(0).toUpperCase()})}),jsxRuntimeExports.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",fontSize:16,color:A.palette.text.primary},children:ie.name}),jsxRuntimeExports.jsx("div",{style:{fontSize:13,color:A.palette.text.secondary,margin:"2px 0"},children:ie.description}),jsxRuntimeExports.jsxs("div",{style:{fontSize:12,color:A.palette.text.secondary},children:[ie.credit&&jsxRuntimeExports.jsxs("span",{children:[O("common.sample_model.credit")," ",ie.credit," "]}),ie.lang&&jsxRuntimeExports.jsxs("span",{children:[O("common.sample_model.language")," ",ie.lang," "]}),ie.tag&&ie.tag.length>0&&jsxRuntimeExports.jsxs("span",{children:[O("common.sample_model.tags")," ",ie.tag.join(", ")," "]}),ie.terms_of_use_url&&jsxRuntimeExports.jsx("a",{href:ie.terms_of_use_url,target:"_blank",rel:"noopener noreferrer",style:{marginLeft:8,color:A.palette.primary.main,textDecoration:"underline"},children:O("common.sample_model.terms_of_use")})]})]}),jsxRuntimeExports.jsx(Stack,{direction:"row",spacing:1,children:jsxRuntimeExports.jsx(Button,{variant:"contained",color:"primary",onClick:()=>te(ie.id),disabled:H.isDownloading,children:O("common.sample_model_dialog.download_button")})})]},ie.id))]})})]}),jsxRuntimeExports.jsx(DownloadProgressDialog,{open:H.isDownloading,sampleName:H.currentSampleName,progress:H.progress})]})},ModelList=()=>{const{t:x}=useTranslation(),{serverSlotInfos:C}=useAppRoot(),E=useTheme(),[w,T]=reactExports.useState(null),[_,S]=reactExports.useState(10),[R,A]=reactExports.useState(!1),[O,H]=reactExports.useState(null),[ee,te]=reactExports.useState(!1),[ie,ne]=reactExports.useState(null),ae=reactExports.useMemo(()=>C.sort((de,ce)=>de.slot_index-ce.slot_index),[C]);reactExports.useEffect(()=>{if(_>=ae.length)return;const de=setTimeout(()=>{S(ce=>Math.min(ce+5,ae.length))},100);return()=>clearTimeout(de)},[_,ae.length]),reactExports.useEffect(()=>{S(10)},[ae.length]);const oe=de=>{H(de),A(!0)},le=de=>{ne(de),te(!0)},fe=reactExports.useMemo(()=>ae.slice(0,_).map((ce,pe)=>{const he=w!==null&&w!==pe&&ce.voice_changer_type==null;return jsxRuntimeExports.jsxs("div",{style:{padding:"15px",borderBottom:`1px solid ${E.palette.divider}`,display:"flex",alignItems:"center",gap:"15px",backgroundColor:he?E.palette.mode==="light"?"rgba(25, 118, 210, 0.08)":"rgba(144, 202, 249, 0.08)":"transparent",transition:"background-color 0.2s",width:"100%"},onClick:()=>{he&&console.log("isMovingTarget",w,pe)},children:[jsxRuntimeExports.jsx(IconArea,{model:ce}),jsxRuntimeExports.jsx(InfoArea,{model:ce}),jsxRuntimeExports.jsx(RightButtonArea,{model:ce,isMoving:w,setIsMoving:T,isMovingTarget:he,onUploadClick:oe,onSampleModelClick:le})]},pe)}),[ae,_,w,T,E.palette.divider,E.palette.mode]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{style:{maxHeight:"60vh",overflowY:"auto"},children:fe}),w!==null&&jsxRuntimeExports.jsx("div",{style:{position:"sticky",bottom:0,backgroundColor:E.palette.background.paper,padding:"15px",borderTop:`1px solid ${E.palette.divider}`,textAlign:"center"},children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>T(null),color:"default",sx:{height:"48px",minWidth:"160px",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(Stack,{direction:"row",spacing:1,alignItems:"center",children:jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:x("common.model_editor.cancel_move")})})})}),R&&O!==null&&jsxRuntimeExports.jsx(ModelUploadDialog,{onClose:()=>A(!1),slotIndex:O}),ee&&ie!==null&&jsxRuntimeExports.jsx(SampleModelDailog,{open:ee,onClose:()=>te(!1),slotIndex:ie})]})},ModelEditDialog=({onClose:x})=>{const{t:C}=useTranslation(),{serverSlotInfos:E}=useAppRoot(),w=useTheme(),T=reactExports.useMemo(()=>E.filter(S=>S.voice_changer_type!==null).length,[E]);return reactExports.useMemo(()=>jsxRuntimeExports.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,width:"100%"},onClick:x,children:jsxRuntimeExports.jsxs("div",{style:{backgroundColor:w.palette.background.paper,borderRadius:"8px",padding:"20px",width:"90%",maxWidth:"800px",maxHeight:"80vh",overflow:"auto",color:w.palette.text.primary},onClick:S=>S.stopPropagation(),children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",width:"100%"},children:[jsxRuntimeExports.jsx("h2",{style:{margin:0},children:C("common.model_editor.title")}),jsxRuntimeExports.jsx(IconButton,{onClick:x,size:"large",sx:{color:w.palette.text.secondary},children:jsxRuntimeExports.jsx(CloseIcon,{})})]}),jsxRuntimeExports.jsx("div",{style:{marginBottom:"20px",width:"100%"},children:jsxRuntimeExports.jsx("p",{style:{color:w.palette.text.primary},children:C("common.model_editor.slots_in_use",{used:T,total:MAX_SLOT_INDEX})})}),jsxRuntimeExports.jsx(ModelList,{})]})}),[x,C,w,T])},ModelSelector=()=>{const[x,C]=reactExports.useState(!1),[E,w]=reactExports.useState(!1),[T,_]=reactExports.useState(null),[S,R]=reactExports.useState(1),[A,O]=reactExports.useState(5),H=120,ee=15,{serverSlotInfos:te,currentSlotInfo:ie,updateServerConfiguration:ne,serverConfiguration:ae,startServerDevice:oe,stopServerDevice:le,localVoiceChangerInterfaceInfo:fe}=useAppRoot(),de=useTheme(),{t:ce}=useTranslation(),pe=!!fe?.local_voice_changer_interface_active,he=reactExports.useMemo(()=>te.filter(Ee=>Ee.voice_changer_type!==null)||[],[te]);reactExports.useEffect(()=>{const Ee=()=>{const Ae=document.getElementById("model-card-row"),Ie=Ae?Ae.offsetWidth:window.innerWidth-250,Te=Math.max(1,Math.floor((Ie+ee)/(H+ee)));O(Te)};return Ee(),window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[]),reactExports.useEffect(()=>{if(!ie){R(1);return}const Ee=he.findIndex(Te=>Te.slot_index===ie.slot_index);if(Ee===-1){R(1);return}const Ae=Math.floor(Ee/A)+1,Ie=Math.max(1,Math.ceil(he.length/A));R(Math.min(Ae,Ie))},[A,he,ie]);const me=reactExports.useMemo(()=>{const Ee=(S-1)*A;return he.slice(Ee,Ee+A)},[he,S,A]),ve=reactExports.useMemo(()=>Math.max(1,Math.ceil(he.length/A)),[he.length,A]),ye=reactExports.useCallback(async Ee=>{console.log("slotId",Ee),ae.current_slot_index=Ee,await ne(ae),pe&&(await le(),await new Promise(Ae=>setTimeout(Ae,100)),await oe(),await new Promise(Ae=>setTimeout(Ae,100)))},[ae,ne,pe]),Se=reactExports.useCallback(()=>{const Ee=te.filter(Ie=>Ie.voice_changer_type!==null).map(Ie=>Ie.slot_index);let Ae=null;for(let Ie=0;Ie<MAX_SLOT_INDEX;Ie++)if(!Ee.includes(Ie)){Ae=Ie;break}Ae!==null?(_(Ae),w(!0)):alert(ce("common.model_editor.no_empty_slot"))},[te,_,w,ce]),Ce=reactExports.useMemo(()=>me.map(Ee=>{const Ae=Ee.icon_file?"model_dir/"+Ee.slot_index+"/"+Ee.icon_file.split(/[/\\]/).pop():"./assets/icons/human.png",Ie=`${Ee.slot_index+1}.${Ee.name}`;return jsxRuntimeExports.jsxs("div",{onClick:()=>ye(Ee.slot_index),style:{position:"relative",cursor:"pointer",borderRadius:"8px",overflow:"hidden",border:`2px solid ${ie?.slot_index===Ee.slot_index?de.palette.primary.main:"transparent"}`,transition:"all 0.2s ease",width:"120px",height:"160px",display:"flex",flexDirection:"column",background:de.palette.background.paper},children:[jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"120px",position:"relative",backgroundColor:de.palette.mode==="light"?"#f0f2f5":de.palette.background.default},children:Ee.icon_file?jsxRuntimeExports.jsx("img",{src:Ae,alt:Ee.name||"",style:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"}}):jsxRuntimeExports.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"36px",fontWeight:"bold",color:de.palette.text.secondary},children:Ee.name?.charAt(0).toUpperCase()})}),jsxRuntimeExports.jsx("div",{style:{padding:"8px 4px 0 4px",backgroundColor:de.palette.background.paper,borderTop:`1px solid ${de.palette.divider}`,height:"40px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntimeExports.jsx(Tooltip,{title:Ie,placement:"top",arrow:!0,children:jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",fontSize:"13px",color:de.palette.text.primary,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"},children:Ie})})})]},Ee.slot_index)}),[me,de,ye,ie]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{style:{border:`1px solid ${de.palette.divider}`,borderRadius:"8px",overflow:"hidden",backgroundColor:de.palette.background.paper,marginBottom:"20px"},children:[jsxRuntimeExports.jsxs("div",{style:{padding:"15px",borderBottom:`1px solid ${de.palette.divider}`,backgroundColor:de.palette.mode==="light"?"#fafafa":de.palette.background.default,fontWeight:"bold",fontSize:"16px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntimeExports.jsx("span",{children:ce("common.model.list_title")}),jsxRuntimeExports.jsxs("span",{style:{fontSize:"14px",color:de.palette.text.secondary},children:[he.length," / ",MAX_SLOT_INDEX," ",ce("common.model.slots_in_use")]})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex"},children:[jsxRuntimeExports.jsx("div",{style:{flex:"1",minWidth:0},children:he.length===0?jsxRuntimeExports.jsx("p",{style:{padding:"15px",margin:0,color:de.palette.text.primary},children:ce("common.model.no_models")}):jsxRuntimeExports.jsxs("div",{style:{maxHeight:"500px",overflowY:"auto",padding:"15px"},children:[jsxRuntimeExports.jsx("div",{id:"model-card-row",style:{display:"flex",flexDirection:"row",gap:"15px",width:"100%",overflowX:"auto"},children:Ce}),jsxRuntimeExports.jsx(Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:jsxRuntimeExports.jsx(Pagination,{count:ve,page:S,onChange:(Ee,Ae)=>R(Ae),color:"primary",shape:"rounded",size:"small"})})]})}),jsxRuntimeExports.jsxs("div",{style:{width:"200px",flexShrink:0,display:"flex",flexDirection:"column",gap:"10px",padding:"15px",backgroundColor:de.palette.background.paper,borderLeft:`1px solid ${de.palette.divider}`},children:[jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex",width:"100%"},children:jsxRuntimeExports.jsx(Tooltip,{title:ce("common.model.upload.tooltip"),children:jsxRuntimeExports.jsx(IconButton,{onClick:Se,color:"default",size:"large",sx:{height:"48px",width:"100%",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),jsxRuntimeExports.jsx("polyline",{points:"17 8 12 3 7 8"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:ce("common.model.upload.button")})]})})})}),jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex",width:"100%"},children:jsxRuntimeExports.jsx(Tooltip,{title:ce("common.model.edit.tooltip"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>C(!0),color:"default",size:"large",sx:{height:"48px",width:"100%",px:2,border:"2px solid",borderColor:"grey.300",borderRadius:"12px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntimeExports.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),jsxRuntimeExports.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),jsxRuntimeExports.jsx("span",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:ce("common.model.edit.button")})]})})})})]})]})]}),x?jsxRuntimeExports.jsx(ModelEditDialog,{onClose:()=>C(!1)}):null,E&&T!==null&&jsxRuntimeExports.jsx(ModelUploadDialog,{onClose:()=>w(!1),slotIndex:T})]}),[Ce,x,C,E,T,he.length,ce,de.palette.background.default,de.palette.background.paper,de.palette.divider,de.palette.mode,de.palette.text.primary,de.palette.text.secondary,Se,S,ve,R])},HeaderArea=()=>{const{currentSlotInfo:x}=useAppRoot(),{t:C}=useTranslation();return reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{style:{padding:"10px",marginBottom:"20px",width:"100%"},children:[jsxRuntimeExports.jsxs("div",{style:{fontSize:"1.2em",fontWeight:"bold",marginBottom:"8px"},children:[x?`${x.slot_index+1}. `:"",x?.name||C("common.model.not_selected"),x?.voice_changer_type!=null?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TagIcon,{label:x.voice_changer_type}),x.voice_changer_type==="RVC"&&jsxRuntimeExports.jsx(TagIcon,{label:(x.is_onnx?"onnx":"torch")+" "+x.version}),x.voice_changer_type==="RVC"&&jsxRuntimeExports.jsx(TagIcon,{label:x.is_f0?"f0":"non-f0"}),x.voice_changer_type==="RVC"&&jsxRuntimeExports.jsx(TagIcon,{label:x.embedder}),x.voice_changer_type==="Beatrice_v2"&&jsxRuntimeExports.jsx(TagIcon,{label:x.model_info.model.version})]}):null]}),x?.description&&jsxRuntimeExports.jsx("div",{style:{width:"100%",padding:"10px",backgroundColor:"#f5f5f5",borderRadius:"4px",fontSize:"14px",color:"darkslategrey",maxHeight:"100px",overflowY:"auto"},children:x.description}),x?.voice_changer_type==="Beatrice_v2"&&jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("span",{children:C("common.copyright.beatrice_lib_license")}),jsxRuntimeExports.jsx("span",{children:C("common.copyright.beatrice_lib_license2")})]})})]}),[x,C])},codeFilename$5=import.meta.url.split("/").pop(),logPrefix$5=`[${codeFilename$5}]`,VoiceCharacterEditDialog=({open:x,onClose:C})=>{const{currentSlotInfo:E,updateBeatriceV2VoiceName:w,updateBeatriceV2VoiceDescription:T,uploadBeatriceV2VoiceIconFile:_,triggerToast:S}=useAppRoot(),{t:R}=useTranslation(),A=reactExports.useMemo(()=>{if(E==null||E.voice_changer_type==="RVC")return null;if(E.voice_changer_type==="Beatrice_v2"){const pe=E;return pe.model_info.voice[pe.dst_id]}return log$1("error",logPrefix$5,"currentSlotInfo.voice_changer_type is not supported"),null},[E]),[O,H]=reactExports.useState(A?.name||""),[ee,te]=reactExports.useState(A?.description||""),[ie,ne]=reactExports.useState(null),[ae,oe]=reactExports.useState(""),[le,fe]=reactExports.useState(""),de=reactExports.useCallback(pe=>{if(E==null||E.voice_changer_type!=="Beatrice_v2")return null;const he=E,me=he.model_info.voice[pe],ye=he.toml_file.replace(/\\\\/g,"/").replace(/\\/g,"/");return ye.substring(0,ye.lastIndexOf("/"))+"/"+me.portrait.path.split(/[/\\]/).pop()},[E]);return reactExports.useEffect(()=>{if(x&&A){H(A.name),te(A.description),ne(null),fe("");const he=de(E.dst_id);oe(he||"./assets/icons/human.png")}},[x,A,E,de]),reactExports.useEffect(()=>(x||(ae&&ae.startsWith("blob:")&&URL.revokeObjectURL(ae),le&&URL.revokeObjectURL(le)),()=>{ae&&ae.startsWith("blob:")&&URL.revokeObjectURL(ae),le&&URL.revokeObjectURL(le)}),[x,ae,le]),reactExports.useMemo(()=>{if(!E||!A)return null;const pe=()=>{ne(null),C()},he=async()=>{if(!E||E.voice_changer_type!=="Beatrice_v2"){C();return}const ve=E,ye=ve.slot_index,Se=ve.dst_id;try{O!==A?.name&&await w(ye,Se,O),ee!==A?.description&&await T(ye,Se,ee),ie&&await _(ye,Se,ie,()=>{}),S("success",R("common.voice_character_editor.save_success"))}catch{S("error",R("common.voice_character_editor.save_error"))}C()},me=ve=>{if(ve.target.files&&ve.target.files[0]){const ye=ve.target.files[0];ne(ye),le&&URL.revokeObjectURL(le),fe(URL.createObjectURL(ye))}};return jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:pe,maxWidth:"sm",fullWidth:!0,children:[jsxRuntimeExports.jsx(DialogTitle,{children:R("common.voice_character_editor.title")}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[jsxRuntimeExports.jsx(TextField,{label:R("common.voice_character_editor.name"),value:O,onChange:ve=>H(ve.target.value),fullWidth:!0}),jsxRuntimeExports.jsx(TextField,{label:R("common.voice_character_editor.description"),value:ee,onChange:ve=>te(ve.target.value),multiline:!0,rows:4,fullWidth:!0}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx("input",{accept:"image/*",style:{display:"none"},id:"icon-file",type:"file",onChange:me}),jsxRuntimeExports.jsx("label",{htmlFor:"icon-file",children:jsxRuntimeExports.jsx(Button,{variant:"outlined",component:"span",children:R("common.voice_character_editor.select_icon")})}),jsxRuntimeExports.jsxs(Box,{sx:{mt:2,display:"flex",gap:2,alignItems:"center"},children:[ae&&jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Box,{sx:{mb:1,color:"text.secondary"},children:R("common.voice_character_edit_dialog.current_icon")}),jsxRuntimeExports.jsx("img",{src:ae,alt:R("common.voice_character_edit_dialog.current_icon"),style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"4px"}})]}),le&&jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Box,{sx:{mb:1,color:"text.secondary"},children:R("common.voice_character_edit_dialog.new_icon")}),jsxRuntimeExports.jsx("img",{src:le,alt:R("common.voice_character_edit_dialog.new_icon"),style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"4px"}})]})]})]})]})}),jsxRuntimeExports.jsxs(DialogActions,{children:[jsxRuntimeExports.jsx(Button,{onClick:pe,children:R("common.voice_character_editor.cancel")}),jsxRuntimeExports.jsx(Button,{onClick:he,variant:"contained",color:"primary",children:R("common.voice_character_editor.save")})]})]})},[x,A,O,ee,ae,le,C,E,w,T,_,S,ie,R])},codeFilename$4=import.meta.url.split("/").pop(),logPrefix$4=`[${codeFilename$4}]`,PortraitArea=()=>{const{currentSlotInfo:x,updateServerSlotInfo:C}=useAppRoot(),{setOutputBufferSizeCallback:E}=useAppState(),[w,T]=reactExports.useState(!1),{t:_}=useTranslation();reactExports.useEffect(()=>{const ie=document.getElementById("outputBufferSize");E(ne=>{ie!=null&&(ie.textContent=ne.toString())})},[E]);const S=reactExports.useCallback(ie=>{if(x==null||x.voice_changer_type!=="Beatrice_v2")return null;const ne=x,ae=ne.model_info.voice[ie],le=ne.toml_file.replace(/\\\\/g,"/").replace(/\\/g,"/");return le.substring(0,le.lastIndexOf("/"))+"/"+ae.portrait.path.split(/[/\\]/).pop()},[x]),R=reactExports.useMemo(()=>x==null?null:x.voice_changer_type==="RVC"?x.icon_file!=null?"model_dir/"+x.slot_index+"/"+x.icon_file.split(/[/\\]/).pop():"./assets/icons/human.png":x.voice_changer_type==="Beatrice_v2"?S(x.dst_id):(log$1("error",logPrefix$4,"currentSlotInfo.voice_changer_type is not supported"),null),[x,S]),A=reactExports.useMemo(()=>{if(x==null||x.voice_changer_type==="RVC")return null;if(x.voice_changer_type==="Beatrice_v2"){const ie=x;return ie.model_info.voice[ie.dst_id]}return log$1("error",logPrefix$4,"currentSlotInfo.voice_changer_type is not supported"),null},[x]),O=reactExports.useMemo(()=>{if(x==null||x.voice_changer_type==="RVC")return null;if(x.voice_changer_type==="Beatrice_v2"){const ie=x,ae=Object.values(ie.model_info.voice).map((oe,le)=>{const fe=S(le);return jsxRuntimeExports.jsxs(MenuItem,{value:le,sx:{display:"flex",alignItems:"center",gap:"12px",padding:"8px 12px","&:hover":{backgroundColor:"action.hover"}},children:[jsxRuntimeExports.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"4px",overflow:"hidden",flexShrink:0},children:fe?jsxRuntimeExports.jsx("img",{src:fe,alt:oe.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",backgroundColor:"action.hover",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",color:"text.secondary"},children:oe.name.charAt(0)})}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flex:1},children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:500},children:oe.name}),jsxRuntimeExports.jsxs("span",{style:{color:"#666",fontSize:"0.85em"},children:["(",oe.average_pitch,")"]})]})]},le)});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"},children:jsxRuntimeExports.jsx("label",{style:{display:"block",fontWeight:"bold",flex:1},children:_("common.voice.character")})}),jsxRuntimeExports.jsx(FormControl,{fullWidth:!0,children:jsxRuntimeExports.jsx(Select,{value:ie.dst_id,onChange:async oe=>{const le=oe.target.value,fe={...ie,dst_id:le};await C(fe)},sx:{backgroundColor:"background.paper","& .MuiOutlinedInput-notchedOutline":{borderColor:"divider"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"action.active"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"},borderRadius:"8px","& .MuiSelect-select":{padding:"12px",display:"flex",alignItems:"center",gap:"12px"}},MenuProps:{PaperProps:{sx:{borderRadius:"8px",marginTop:"8px",boxShadow:"0 4px 20px rgba(0,0,0,0.1)"}},TransitionProps:{timeout:{enter:10,exit:5}}},children:ae})})]})}return null},[x,S,C,_]),H=reactExports.useMemo(()=>x==null||x.voice_changer_type==="RVC"?null:jsxRuntimeExports.jsx("div",{style:{width:"320px",padding:"10px",backgroundColor:"#f5f5f5",borderRadius:"4px",fontSize:"14px",color:"darkslategrey",maxHeight:"100px",overflowY:"auto"},children:A!=null?A.description:_("common.voice.no_description")}),[x,A,_]),ee=reactExports.useMemo(()=>x==null||x.voice_changer_type==="RVC"?null:jsxRuntimeExports.jsx("div",{style:{marginTop:"8px",display:"flex",justifyContent:"flex-start"},children:jsxRuntimeExports.jsx(Tooltip,{title:_("common.voice.edit_tooltip"),children:jsxRuntimeExports.jsx(IconButton,{size:"small",onClick:()=>T(!0),children:jsxRuntimeExports.jsx(Edit,{fontSize:"small"})})})}),[x,_,T]);return reactExports.useMemo(()=>x==null?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[O,jsxRuntimeExports.jsx("div",{style:{width:"320px",height:"320px",borderRadius:"8px",overflow:"hidden",border:"1px solid #eee",marginRight:"20px",flexShrink:0},children:R?jsxRuntimeExports.jsx("img",{src:R,style:{width:"100%",height:"100%",objectFit:"scale-down"}}):jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",backgroundColor:"action.hover",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"120px",fontWeight:"bold",color:"text.secondary"},children:A?.name?.charAt(0).toUpperCase()})}),H,ee,jsxRuntimeExports.jsx(VoiceCharacterEditDialog,{open:w,onClose:()=>T(!1)})]}),[x,w,R,O,H,ee,A?.name])},WaitingDialog=({open:x,message:C})=>{const{t:E}=useTranslation();return jsxRuntimeExports.jsx(Dialog,{open:x,disableEscapeKeyDown:!0,sx:{"& .MuiDialog-paper":{minWidth:"300px",textAlign:"center"}},children:jsxRuntimeExports.jsx(DialogContent,{sx:{py:4},children:jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",alignItems:"center",gap:2,children:[jsxRuntimeExports.jsx(CircularProgress,{size:40}),jsxRuntimeExports.jsx(Typography,{variant:"body1",children:C||E("common.waiting_dialog.default_message")})]})})})},SettingsDialog=({open:x,onClose:C})=>{const{setSelectedInputAudioDeviceId:E,setOutputAudio:w,setMonitorAudio:T,selectedInputAudioDeviceId:_,outputAudio:S,monitorAudio:R,enableEchoCancellation:A,setEnableEchoCancellation:O,enableNoiseSuppression:H,setEnableNoiseSuppression:ee,enableNoiseSuppression2:te,setEnableNoiseSuppression2:ie,isOutputRecording:ne,isPassthrough:ae,abortAllRequests:oe,isStarted:le}=useAppState(),{audioInputs:fe,audioOutputs:de,serverConfiguration:ce,updateServerConfiguration:pe,serverAudioInputDevices:he,serverAudioOutputDevices:me,serverGpuInfo:ve,localVoiceChangerInterfaceInfo:ye,stopServerDevice:Se,startServerDevice:Ce,serverProperties:be}=useAppRoot(),{t:Ee}=useTranslation(),Ae=ce.voice_changer_input_mode===VoiceChangerInputMode.client,Ie=be.available_audio_input_modes.includes(VoiceChangerInputMode.client),Te=be.available_audio_input_modes.includes(VoiceChangerInputMode.server),De=be.available_processing_units.includes("gpu"),Ue=ce.voice_changer_input_mode===VoiceChangerInputMode.server,ze=!!ye?.local_voice_changer_interface_active||!!ce.recording_started||!!ce.pass_through,Pe=!!ye?.local_voice_changer_interface_active,He=Ue?ze:le||ne||ae,[je,Ne]=reactExports.useState(!1),[Oe,Ve]=reactExports.useState(""),[Ht,Kt]=reactExports.useState(""),[ir,$t]=reactExports.useState(""),tr=reactExports.useMemo(()=>Array.from(new Set(he.map(Be=>Be.host_api))),[he]),ar=reactExports.useMemo(()=>Array.from(new Set(me.map(Be=>Be.host_api))),[me]),gr=reactExports.useMemo(()=>Oe===""?he:he.filter(Be=>Be.host_api===Oe),[he,Oe]),er=reactExports.useMemo(()=>Ht===""?me:me.filter(Be=>Be.host_api===Ht),[me,Ht]),sr=reactExports.useMemo(()=>ir===""?me:me.filter(Be=>Be.host_api===ir),[me,ir]),pr=reactExports.useMemo(()=>he.find(Be=>Be.index===ce.audio_input_device_index),[he,ce.audio_input_device_index]),ur=reactExports.useMemo(()=>me.find(Be=>Be.index===ce.audio_output_device_index),[me,ce.audio_output_device_index]),Sr=reactExports.useMemo(()=>me.find(Be=>Be.index===ce.audio_monitor_device_index),[me,ce.audio_monitor_device_index]),hr=reactExports.useRef(""),yr=reactExports.useRef(""),xr=reactExports.useRef("");reactExports.useEffect(()=>{Ae||Oe!==hr.current&&(hr.current=Oe,Oe!==""&&ce.audio_input_device_index!==-1&&(gr.some(et=>et.index===ce.audio_input_device_index)||pe({...ce,audio_input_device_index:-1,audio_input_device_sample_rate:-1})))},[Oe,gr,Ae,ce,pe]),reactExports.useEffect(()=>{Ae||Ht!==yr.current&&(yr.current=Ht,Ht!==""&&ce.audio_output_device_index!==-1&&(er.some(et=>et.index===ce.audio_output_device_index)||pe({...ce,audio_output_device_index:-1,audio_output_device_sample_rate:-1})))},[Ht,er,Ae,ce,pe]),reactExports.useEffect(()=>{Ae||ir!==xr.current&&(xr.current=ir,ir!==""&&ce.audio_monitor_device_index!==-1&&(sr.some(et=>et.index===ce.audio_monitor_device_index)||pe({...ce,audio_monitor_device_index:-1,audio_monitor_device_sample_rate:-1})))},[ir,sr,Ae,ce,pe]);const Yt=reactExports.useMemo(()=>Ae==!1?null:jsxRuntimeExports.jsx("select",{value:_,onChange:Be=>E(Be.target.value),style:{width:"100%",padding:"8px"},children:fe.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.deviceId,children:Be.label},Be.deviceId))}),[fe,_,E,Ae]),Jt=reactExports.useMemo(()=>Ae?null:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntimeExports.jsxs("select",{value:Oe,onChange:Be=>Ve(Be.target.value),style:{width:"25%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:"",children:Ee("common.settings_dialog.all_hosts")}),tr.map(Be=>jsxRuntimeExports.jsx("option",{value:Be,children:Be},Be))]}),jsxRuntimeExports.jsxs("select",{value:ce.audio_input_device_index,onChange:async Be=>{const et=parseInt(Be.target.value);Ne(!0);try{await pe({...ce,audio_input_device_index:et,audio_input_device_sample_rate:-1}),Pe&&(await Se(),await new Promise(Ze=>setTimeout(Ze,100)),await Ce(),await new Promise(Ze=>setTimeout(Ze,100)))}finally{Ne(!1)}},style:{width:"50%",padding:"8px"},children:[Pe==!1&&jsxRuntimeExports.jsx("option",{value:-1,children:Ee("common.settings_dialog.unselected")},-1),gr.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.index,children:Oe===""?`(${Be.host_api})${Be.name}`:Be.name},Be.index))]}),pr&&pr.available_samplerates.length>0&&jsxRuntimeExports.jsxs("select",{value:ce.audio_input_device_sample_rate,onChange:async Be=>{const et=parseInt(Be.target.value);Ne(!0);try{await pe({...ce,audio_input_device_sample_rate:et}),Pe&&(await Se(),await new Promise(Ze=>setTimeout(Ze,100)),await Ce(),await new Promise(Ze=>setTimeout(Ze,100)))}finally{Ne(!1)}},style:{width:"25%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:-1,children:Ee("common.settings_dialog.auto")}),pr.available_samplerates.map(Be=>jsxRuntimeExports.jsxs("option",{value:Be,children:[Be," Hz"]},Be))]})]}),[Ae,Oe,tr,gr,ce,pe,pr,Ne,Pe,Se,Ce,Ee]),mr=reactExports.useMemo(()=>Ae?jsxRuntimeExports.jsx("select",{value:S,onChange:Be=>w(Be.target.value),style:{width:"100%",padding:"8px"},children:de.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.deviceId,children:Be.label},Be.deviceId))}):null,[de,S,w,Ae]),Cr=reactExports.useMemo(()=>Ae?null:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntimeExports.jsxs("select",{value:Ht,onChange:Be=>Kt(Be.target.value),style:{width:"25%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:"",children:Ee("common.settings_dialog.all_hosts")}),ar.map(Be=>jsxRuntimeExports.jsx("option",{value:Be,children:Be},Be))]}),jsxRuntimeExports.jsxs("select",{value:ce.audio_output_device_index,onChange:async Be=>{const et=parseInt(Be.target.value);Ne(!0);try{await pe({...ce,audio_output_device_index:et,audio_output_device_sample_rate:-1}),Pe&&(await Se(),await new Promise(Ze=>setTimeout(Ze,100)),await Ce(),await new Promise(Ze=>setTimeout(Ze,100)))}finally{Ne(!1)}},style:{width:"50%",padding:"8px"},children:[Pe==!1&&jsxRuntimeExports.jsx("option",{value:-1,children:Ee("common.settings_dialog.unselected")},-1),er.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.index,children:Ht===""?`(${Be.host_api})${Be.name}`:Be.name},Be.index))]}),ur&&ur.available_samplerates.length>0&&jsxRuntimeExports.jsxs("select",{value:ce.audio_output_device_sample_rate,onChange:async Be=>{const et=parseInt(Be.target.value);try{await pe({...ce,audio_output_device_sample_rate:et}),Pe&&(await Se(),await new Promise(Ze=>setTimeout(Ze,100)),await Ce(),await new Promise(Ze=>setTimeout(Ze,100)))}finally{Ne(!1)}},style:{width:"25%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:-1,children:Ee("common.settings_dialog.auto")}),ur.available_samplerates.map(Be=>jsxRuntimeExports.jsxs("option",{value:Be,children:[Be," Hz"]},Be))]})]}),[Ae,Ht,ar,er,ce,pe,ur,Ne,Se,Ce,Pe,Ee]),zt=reactExports.useMemo(()=>Ae?jsxRuntimeExports.jsx("select",{value:R,onChange:Be=>T(Be.target.value),style:{width:"100%",padding:"8px"},children:de.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.deviceId,children:Be.label},Be.deviceId))}):null,[de,R,T,Ae]),Ft=reactExports.useMemo(()=>Ae?null:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntimeExports.jsxs("select",{value:ir,onChange:Be=>$t(Be.target.value),style:{width:"25%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:"",children:Ee("common.settings_dialog.all_hosts")}),ar.map(Be=>jsxRuntimeExports.jsx("option",{value:Be,children:Be},Be))]}),jsxRuntimeExports.jsxs("select",{value:ce.audio_monitor_device_index,onChange:async Be=>{const et=parseInt(Be.target.value);Ne(!0);try{await pe({...ce,audio_monitor_device_index:et,audio_monitor_device_sample_rate:-1}),Pe&&(await Se(),await new Promise(Ze=>setTimeout(Ze,100)),await Ce(),await new Promise(Ze=>setTimeout(Ze,100)))}finally{Ne(!1)}},style:{width:"50%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:-1,children:Ee("common.settings_dialog.unselected")},-1),sr.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.index,children:ir===""?`(${Be.host_api})${Be.name}`:Be.name},Be.index))]}),Sr&&Sr.available_samplerates.length>0&&jsxRuntimeExports.jsxs("select",{value:ce.audio_monitor_device_sample_rate,onChange:async Be=>{const et=parseInt(Be.target.value);Ne(!0);try{await pe({...ce,audio_monitor_device_sample_rate:et}),Pe&&(await Se(),await new Promise(Ze=>setTimeout(Ze,100)),await Ce(),await new Promise(Ze=>setTimeout(Ze,100)))}finally{Ne(!1)}},style:{width:"25%",padding:"8px"},children:[jsxRuntimeExports.jsx("option",{value:-1,children:Ee("common.settings_dialog.auto")}),Sr.available_samplerates.map(Be=>jsxRuntimeExports.jsxs("option",{value:Be,children:[Be," Hz"]},Be))]})]}),[Ae,ir,ar,sr,ce,pe,Sr,Ne,Pe,Se,Ce,Ee]),kt=reactExports.useMemo(()=>{if(!Ae){const Be=he.find(Qe=>Qe.index===ce.audio_input_device_index),et=me.find(Qe=>Qe.index===ce.audio_output_device_index),Ze=me.find(Qe=>Qe.index===ce.audio_monitor_device_index);return Be&&Be.host_api==="Windows WASAPI"||et&&et.host_api==="Windows WASAPI"||Ze&&Ze.host_api==="Windows WASAPI"}return!1},[Ae,he,me,ce.audio_input_device_index,ce.audio_output_device_index,ce.audio_monitor_device_index]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:C,maxWidth:"sm",fullWidth:!0,children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",padding:"20px 20px 0"},children:[jsxRuntimeExports.jsx("h2",{style:{margin:0},children:Ee("common.settings_dialog.title")}),jsxRuntimeExports.jsx("button",{onClick:C,style:{border:"none",background:"none",fontSize:"24px",cursor:"pointer",padding:"0 8px"},children:Ee("common.settings_dialog.close")})]}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",padding:"20px 0"},children:[jsxRuntimeExports.jsxs("div",{style:{marginTop:"16px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:Ee("common.settings_dialog.gpu_settings")}),jsxRuntimeExports.jsx("div",{style:{marginLeft:"16px"},children:jsxRuntimeExports.jsx("select",{value:ce.gpu_device_id_int,onChange:async Be=>{const et=parseInt(Be.target.value);oe(),await pe({...ce,gpu_device_id_int:et})},style:{width:"100%",padding:"8px"},disabled:!De,children:ve.map(Be=>jsxRuntimeExports.jsx("option",{value:Be.device_id_int,children:Be.name},Be.device_id_int))})})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"8px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:Ee("common.settings_dialog.voice_changer_input_mode")}),jsxRuntimeExports.jsxs("div",{style:{marginLeft:"16px"},children:[jsxRuntimeExports.jsxs(ButtonGroup,{variant:"outlined",fullWidth:!0,children:[jsxRuntimeExports.jsx("span",{style:{width:"100%"},children:jsxRuntimeExports.jsx(Button,{variant:ce.voice_changer_input_mode===VoiceChangerInputMode.client?"contained":"outlined",color:ce.voice_changer_input_mode===VoiceChangerInputMode.client?"primary":"inherit",onClick:async()=>{ce.voice_changer_input_mode!==VoiceChangerInputMode.client&&await pe({...ce,voice_changer_input_mode:VoiceChangerInputMode.client,input_sample_rate:48e3,output_sample_rate:48e3,monitor_sample_rate:48e3})},disabled:He||!Ie,children:Ee("common.settings_dialog.client_mode")})}),jsxRuntimeExports.jsx("span",{style:{width:"100%"},children:jsxRuntimeExports.jsx(Button,{variant:ce.voice_changer_input_mode===VoiceChangerInputMode.server?"contained":"outlined",color:ce.voice_changer_input_mode===VoiceChangerInputMode.server?"primary":"inherit",onClick:async()=>{ce.voice_changer_input_mode!==VoiceChangerInputMode.server&&await pe({...ce,voice_changer_input_mode:VoiceChangerInputMode.server})},disabled:He||!Te,children:Ee("common.settings_dialog.server_mode")})})]}),He&&jsxRuntimeExports.jsx("div",{style:{color:"#f44336",fontSize:"12px",marginTop:"4px"},children:Ee("common.settings_dialog.mode_switch_disabled")})]})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"8px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:Ee("common.settings_dialog.audio_device_settings")}),jsxRuntimeExports.jsxs("div",{style:{marginLeft:"16px",display:"flex",flexDirection:"column",gap:"12px"},children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{style:{display:"block",marginBottom:"5px"},children:Ee("common.settings_dialog.input_device")}),Yt,Jt]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{style:{display:"block",marginBottom:"5px"},children:Ee("common.settings_dialog.output_device")}),mr,Cr]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{style:{display:"block",marginBottom:"5px"},children:Ee("common.settings_dialog.monitor_device")}),zt,Ft]}),kt&&jsxRuntimeExports.jsx("div",{style:{marginTop:"8px"},children:jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:ce.wasapi_exclude_emabled,onChange:Be=>pe({...ce,wasapi_exclude_emabled:Be.target.checked})}),Ee("common.settings_dialog.wasapi_exclusive_mode")]})})]})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"16px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:Ee("common.settings_dialog.noise_suppression")}),jsxRuntimeExports.jsxs("div",{style:{marginLeft:"16px",display:"flex",flexDirection:"column",gap:"4px"},children:[Ae&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:A,onChange:Be=>O(Be.target.checked)}),Ee("common.settings_dialog.enable_echo_cancellation")]}),jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:H,onChange:Be=>ee(Be.target.checked)}),Ee("common.settings_dialog.enable_noise_suppression")]}),jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:te,onChange:Be=>ie(Be.target.checked)}),Ee("common.settings_dialog.enable_noise_suppression2")]})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginTop:"8px"},children:[jsxRuntimeExports.jsx("span",{style:{minWidth:"80px"},children:Ee("common.settings_dialog.noise_gate")}),jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"0.5",step:"0.001",value:ce.noise_gate,onChange:async Be=>{await pe({...ce,noise_gate:Number(Be.target.value)})},style:{width:"100%"}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"30px",textAlign:"right"},children:ce.noise_gate})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"12px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:ce.enable_high_pass_filter,onChange:async Be=>{await pe({...ce,enable_high_pass_filter:Be.target.checked})}}),Ee("common.settings_dialog.enable_high_pass_filter")]}),ce.enable_high_pass_filter&&jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginLeft:"24px"},children:[jsxRuntimeExports.jsx("span",{style:{minWidth:"80px"},children:Ee("common.settings_dialog.cutoff")}),jsxRuntimeExports.jsx("input",{type:"range",min:"20",max:"200",step:"10",value:ce.high_pass_filter_cutoff,onChange:async Be=>{await pe({...ce,high_pass_filter_cutoff:Number(Be.target.value)})},style:{width:"100%"}}),jsxRuntimeExports.jsxs("span",{style:{minWidth:"50px",textAlign:"right"},children:[ce.high_pass_filter_cutoff," Hz"]})]})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"12px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:ce.enable_low_pass_filter,onChange:async Be=>{await pe({...ce,enable_low_pass_filter:Be.target.checked})}}),Ee("common.settings_dialog.enable_low_pass_filter")]}),ce.enable_low_pass_filter&&jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginLeft:"24px"},children:[jsxRuntimeExports.jsx("span",{style:{minWidth:"80px"},children:Ee("common.settings_dialog.cutoff")}),jsxRuntimeExports.jsx("input",{type:"range",min:"3500",max:"15000",step:"500",value:ce.low_pass_filter_cutoff,onChange:async Be=>{await pe({...ce,low_pass_filter_cutoff:Number(Be.target.value)})},style:{width:"100%"}}),jsxRuntimeExports.jsxs("span",{style:{minWidth:"50px",textAlign:"right"},children:[ce.low_pass_filter_cutoff," Hz"]})]})]})]})]})]})})]}),jsxRuntimeExports.jsx(WaitingDialog,{open:je,message:Ee("common.settings_dialog.changing_device_settings")})]}),[x,C,Ee,ce,pe,Yt,mr,zt,Jt,Cr,Ft,kt,A,O,H,ee,te,ie,Ae,ve,He,oe,je,Ie,Te,De])},generateTimestamp=()=>{const x=new Date,C=x.getFullYear(),E=String(x.getMonth()+1).padStart(2,"0"),w=String(x.getDate()).padStart(2,"0"),T=String(x.getHours()).padStart(2,"0"),_=String(x.getMinutes()).padStart(2,"0"),S=String(x.getSeconds()).padStart(2,"0");return`${C}${E}${w}_${T}${_}${S}`},downloadFile=async(x,C)=>{try{const w=await(await fetch(x)).blob(),T=URL.createObjectURL(w),_=document.createElement("a");_.href=T,_.download=C,_.click(),URL.revokeObjectURL(T)}catch(E){throw console.error(`Failed to download file ${C}:`,E),E}},downloadServerRecordingFiles=async(x=!1,C=!0)=>{const E=generateTimestamp(),w=[];x&&w.push(downloadFile("./input.wav",`input_${E}.wav`)),C&&w.push(downloadFile("./output.wav",`output_${E}.wav`)),await Promise.all(w)},MainControls=()=>{const{isStarted:x,setIsStarted:C,isOutputRecording:E,setIsOutputRecording:w,isPassthrough:T,setIsPassthrough:_,recordForAnalysis:S}=useAppState(),{t:R}=useTranslation(),[A,O]=reactExports.useState(!1),{serverConfiguration:H,serverGpuInfo:ee,startServerDevice:te,stopServerDevice:ie,localVoiceChangerInterfaceInfo:ne,updateServerConfiguration:ae,triggerToast:oe}=useAppRoot(),le=H.voice_changer_input_mode===VoiceChangerInputMode.server,fe=!!ne?.local_voice_changer_interface_active,de=le?fe:x,ce=le?!fe:!x,pe=le?H.pass_through:T,he=le?H.recording_started:E,me=reactExports.useCallback(async()=>{if(le){if(H.audio_input_device_index===-1||H.audio_output_device_index===-1){oe("error",R("common.controls.device_not_selected_error"));return}await te()}else C(!0)},[le,H.audio_input_device_index,H.audio_output_device_index,oe,R,te,C]),ve=reactExports.useCallback(async()=>{le?await ie():C(!1)},[le,ie,C]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntimeExports.jsx("label",{style:{display:"block",fontWeight:"bold",flex:1},children:R("common.controls.title")}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(()=>{const Se=ee.find(Ce=>Ce.device_id_int===H.gpu_device_id_int);return jsxRuntimeExports.jsx(Chip,{label:`${Se?.name||"cpu"}`,color:"success",size:"small",sx:{fontWeight:"bold",cursor:"default","&:hover":{backgroundColor:"success.main",color:"white",cursor:"default"}},clickable:!0,onClick:()=>O(!0)})})(),jsxRuntimeExports.jsx(Chip,{label:H.voice_changer_input_mode===VoiceChangerInputMode.server?R("common.controls.server_mode"):R("common.controls.client_mode"),color:H.voice_changer_input_mode===VoiceChangerInputMode.server?"secondary":"primary",size:"small",sx:{fontWeight:"bold",cursor:"default","&:hover":{backgroundColor:H.voice_changer_input_mode===VoiceChangerInputMode.server?"secondary.main":"primary.main",color:"white",cursor:"default"}},clickable:!0,onClick:()=>O(!0)})]})]}),jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:2,justifyContent:"flex-start",sx:{my:2},style:{width:"100%"},children:[jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex"},children:jsxRuntimeExports.jsx(Tooltip,{title:R("common.controls.start"),children:jsxRuntimeExports.jsx(IconButton,{onClick:me,color:de?"primary":"default",size:"large",sx:{height:"60px",minWidth:"70px",px:1,border:"2px solid",borderColor:de?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(PlayArrow,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",whiteSpace:"nowrap"},children:R("common.controls.start")})]})})})}),jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex"},children:jsxRuntimeExports.jsx(Tooltip,{title:R("common.controls.stop"),children:jsxRuntimeExports.jsx(IconButton,{onClick:async()=>{await ve()},color:ce?"primary":"default",size:"large",sx:{height:"60px",minWidth:"70px",px:1,border:"2px solid",borderColor:ce?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(Stop,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",whiteSpace:"nowrap"},children:R("common.controls.stop")})]})})})}),jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex"},children:jsxRuntimeExports.jsx(Tooltip,{title:R(he?"common.controls.stop_recording":"common.controls.start_recording"),children:jsxRuntimeExports.jsx(IconButton,{onClick:async()=>{if(le){const Se=!H.recording_started;if(await ae({...H,recording_started:Se}),!Se){console.log(R("common.controls.start_download_recording"));try{S?await downloadServerRecordingFiles(!0,!0):await downloadServerRecordingFiles(!1,!0)}catch(Ce){console.error(R("common.controls.download_recording_failed"),Ce)}}}else{const Se=!E;if(w(Se),S)try{await ae({...H,recording_started:Se}),Se||(console.log(R("common.controls.start_download_server_recording")),await downloadServerRecordingFiles(!0,!0))}catch(Ce){console.error(R("common.controls.server_recording_failed"),Ce)}}},color:he?"primary":"default",size:"large",sx:{height:"60px",minWidth:"70px",px:1,border:"2px solid",borderColor:he?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(FiberManualRecord,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",whiteSpace:"nowrap"},children:R(he?"common.controls.recording":"common.controls.record")})]})})})}),jsxRuntimeExports.jsx(Box,{sx:{width:"20px"}}),jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex"},children:jsxRuntimeExports.jsx(Tooltip,{title:R(pe?"common.controls.passthrough_disable":"common.controls.passthrough_enable"),children:jsxRuntimeExports.jsx(IconButton,{onClick:async()=>{le?await ae({...H,pass_through:!H.pass_through}):_(!T)},color:pe?"primary":"default",size:"large",sx:{height:"60px",minWidth:"70px",px:1,border:"2px solid",borderColor:pe?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(SwapHoriz,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",whiteSpace:"nowrap"},children:R("common.controls.passthrough")})]})})})}),jsxRuntimeExports.jsx(Box,{sx:{minWidth:0,display:"flex"},children:jsxRuntimeExports.jsx(Tooltip,{title:R("common.controls.settings"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>O(!0),color:"default",size:"large",sx:{height:"60px",minWidth:"70px",px:1,border:"2px solid",borderColor:"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(Settings,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",whiteSpace:"nowrap"},children:R("common.controls.settings")})]})})})})]}),jsxRuntimeExports.jsx(SettingsDialog,{open:A,onClose:()=>O(!1)})]}),[w,_,R,E,T,A,O,H,ee,le,de,ce,ae,pe,he,S,me,ve])},instanceOfAny=(x,C)=>C.some(E=>x instanceof E);let idbProxyableTypes,cursorAdvanceMethods;function getIdbProxyableTypes(){return idbProxyableTypes||(idbProxyableTypes=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function getCursorAdvanceMethods(){return cursorAdvanceMethods||(cursorAdvanceMethods=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const transactionDoneMap=new WeakMap,transformCache=new WeakMap,reverseTransformCache=new WeakMap;function promisifyRequest(x){const C=new Promise((E,w)=>{const T=()=>{x.removeEventListener("success",_),x.removeEventListener("error",S)},_=()=>{E(wrap(x.result)),T()},S=()=>{w(x.error),T()};x.addEventListener("success",_),x.addEventListener("error",S)});return reverseTransformCache.set(C,x),C}function cacheDonePromiseForTransaction(x){if(transactionDoneMap.has(x))return;const C=new Promise((E,w)=>{const T=()=>{x.removeEventListener("complete",_),x.removeEventListener("error",S),x.removeEventListener("abort",S)},_=()=>{E(),T()},S=()=>{w(x.error||new DOMException("AbortError","AbortError")),T()};x.addEventListener("complete",_),x.addEventListener("error",S),x.addEventListener("abort",S)});transactionDoneMap.set(x,C)}let idbProxyTraps={get(x,C,E){if(x instanceof IDBTransaction){if(C==="done")return transactionDoneMap.get(x);if(C==="store")return E.objectStoreNames[1]?void 0:E.objectStore(E.objectStoreNames[0])}return wrap(x[C])},set(x,C,E){return x[C]=E,!0},has(x,C){return x instanceof IDBTransaction&&(C==="done"||C==="store")?!0:C in x}};function replaceTraps(x){idbProxyTraps=x(idbProxyTraps)}function wrapFunction(x){return getCursorAdvanceMethods().includes(x)?function(...C){return x.apply(unwrap(this),C),wrap(this.request)}:function(...C){return wrap(x.apply(unwrap(this),C))}}function transformCachableValue(x){return typeof x=="function"?wrapFunction(x):(x instanceof IDBTransaction&&cacheDonePromiseForTransaction(x),instanceOfAny(x,getIdbProxyableTypes())?new Proxy(x,idbProxyTraps):x)}function wrap(x){if(x instanceof IDBRequest)return promisifyRequest(x);if(transformCache.has(x))return transformCache.get(x);const C=transformCachableValue(x);return C!==x&&(transformCache.set(x,C),reverseTransformCache.set(C,x)),C}const unwrap=x=>reverseTransformCache.get(x);function openDB(x,C,{blocked:E,upgrade:w,blocking:T,terminated:_}={}){const S=indexedDB.open(x,C),R=wrap(S);return w&&S.addEventListener("upgradeneeded",A=>{w(wrap(S.result),A.oldVersion,A.newVersion,wrap(S.transaction),A)}),E&&S.addEventListener("blocked",A=>E(A.oldVersion,A.newVersion,A)),R.then(A=>{_&&A.addEventListener("close",()=>_()),T&&A.addEventListener("versionchange",O=>T(O.oldVersion,O.newVersion,O))}).catch(()=>{}),R}const readMethods=["get","getKey","getAll","getAllKeys","count"],writeMethods=["put","add","delete","clear"],cachedMethods=new Map;function getMethod(x,C){if(!(x instanceof IDBDatabase&&!(C in x)&&typeof C=="string"))return;if(cachedMethods.get(C))return cachedMethods.get(C);const E=C.replace(/FromIndex$/,""),w=C!==E,T=writeMethods.includes(E);if(!(E in(w?IDBIndex:IDBObjectStore).prototype)||!(T||readMethods.includes(E)))return;const _=async function(S,...R){const A=this.transaction(S,T?"readwrite":"readonly");let O=A.store;return w&&(O=O.index(R.shift())),(await Promise.all([O[E](...R),T&&A.done]))[0]};return cachedMethods.set(C,_),_}replaceTraps(x=>({...x,get:(C,E,w)=>getMethod(C,E)||x.get(C,E,w),has:(C,E)=>!!getMethod(C,E)||x.has(C,E)}));const advanceMethodProps=["continue","continuePrimaryKey","advance"],methodMap={},advanceResults=new WeakMap,ittrProxiedCursorToOriginalProxy=new WeakMap,cursorIteratorTraps={get(x,C){if(!advanceMethodProps.includes(C))return x[C];let E=methodMap[C];return E||(E=methodMap[C]=function(...w){advanceResults.set(this,ittrProxiedCursorToOriginalProxy.get(this)[C](...w))}),E}};async function*iterate(...x){let C=this;if(C instanceof IDBCursor||(C=await C.openCursor(...x)),!C)return;C=C;const E=new Proxy(C,cursorIteratorTraps);for(ittrProxiedCursorToOriginalProxy.set(E,C),reverseTransformCache.set(E,unwrap(C));C;)yield E,C=await(advanceResults.get(E)||C.continue()),advanceResults.delete(E)}function isIteratorProp(x,C){return C===Symbol.asyncIterator&&instanceOfAny(x,[IDBIndex,IDBObjectStore,IDBCursor])||C==="iterate"&&instanceOfAny(x,[IDBIndex,IDBObjectStore])}replaceTraps(x=>({...x,get(C,E,w){return isIteratorProp(C,E)?iterate:x.get(C,E,w)},has(C,E){return isIteratorProp(C,E)||x.has(C,E)}}));const DB_NAME="vcclient-settings",DB_VERSION=1,STORE_NAME="global-settings";let db=null;const initDB=async()=>db||(db=await openDB(DB_NAME,DB_VERSION,{upgrade(x){x.objectStoreNames.contains(STORE_NAME)||x.createObjectStore(STORE_NAME)}}),db),saveSettings=async x=>{await(await initDB()).put(STORE_NAME,x,"settings")},loadSettings=async()=>(await initDB()).get(STORE_NAME,"settings"),InputAudioType={MICROPHONE:"microphone",FILE:"file",CAPTURE:"capture",SAMPLE:"sample"},useGlobalSetting=()=>{const[x,C]=reactExports.useState(!1),[E,w]=reactExports.useState("light"),[T,_]=reactExports.useState("default"),[S,R]=reactExports.useState("default"),[A,O]=reactExports.useState("default"),[H,ee]=reactExports.useState("default"),[te,ie]=reactExports.useState(null),[ne,ae]=reactExports.useState(null),[oe,le]=reactExports.useState(InputAudioType.MICROPHONE),[fe,de]=reactExports.useState(1),[ce,pe]=reactExports.useState(1),[he,me]=reactExports.useState(0),[ve,ye]=reactExports.useState("ja"),[Se,Ce]=reactExports.useState(!1),[be,Ee]=reactExports.useState(null),[Ae,Ie]=reactExports.useState(!1),[Te,De]=reactExports.useState(!1),[Ue,ze]=reactExports.useState(!1),[Pe,$e]=reactExports.useState(!1),[He,je]=reactExports.useState(!1),[Ne,Oe]=reactExports.useState(!0),[Ve,Ht]=reactExports.useState(2),[Kt,ir]=reactExports.useState("rest"),[$t,tr]=reactExports.useState(!1),[ar,gr]=reactExports.useState(!0);return reactExports.useEffect(()=>{(async()=>{try{const pr=await loadSettings();pr&&(w(pr.displayColorMode),de(pr.nodeInputGain),pe(pr.nodeOutputGain),me(pr.nodeMonitorGain),_(pr.selectedInputAudioDeviceId),O(pr.outputAudio),ee(pr.monitorAudio),le(pr.inputAudioType),ye(pr.selectedLanguage),ze(pr.enableEchoCancellation??!1),$e(pr.enableNoiseSuppression??!1),je(pr.enableNoiseSuppression2??!1),Oe(pr.realtimeOutputStatusEnabled??!1),Ht(pr.realtimeOutputStatusSendIntervalSec??10),ir(pr.protocol??"rest"),tr(pr.recordForAnalysis??!1),gr(pr.showSampleAudioButton??!0))}catch(pr){console.error("Failed to load settings:",pr)}finally{C(!0)}})()},[]),reactExports.useEffect(()=>{if(!x)return;(async()=>{try{await saveSettings({displayColorMode:E,nodeInputGain:fe,nodeOutputGain:ce,nodeMonitorGain:he,selectedInputAudioDeviceId:T,outputAudio:A,monitorAudio:H,inputAudioType:oe,selectedLanguage:ve,enableEchoCancellation:Ue,enableNoiseSuppression:Pe,enableNoiseSuppression2:He,realtimeOutputStatusEnabled:Ne,realtimeOutputStatusSendIntervalSec:Ve,protocol:Kt,recordForAnalysis:$t,showSampleAudioButton:ar})}catch(pr){console.error("Failed to save settings:",pr)}})()},[x,E,fe,ce,he,T,A,H,oe,ve,Ue,Pe,He,Ne,Ve,Kt,$t,ar]),reactExports.useEffect(()=>{R(oe==="microphone"?T:"none")},[oe,T]),{displayColorMode:E,setDisplayColorMode:w,selectedLanguage:ve,setSelectedLanguage:ye,selectedInputAudioDeviceId:T,setSelectedInputAudioDeviceId:_,inputAudio:S,setInputAudio:R,inputAudioType:oe,setInputAudioType:le,outputAudio:A,setOutputAudio:O,monitorAudio:H,setMonitorAudio:ee,outputAudioElementId:te,setOutputAudioElementId:ie,monitorAudioElementId:ne,setMonitorAudioElementId:ae,nodeInputGain:fe,setNodeInputGain:de,nodeOutputGain:ce,setNodeOutputGain:pe,nodeMonitorGain:he,setNodeMonitorGain:me,enableEchoCancellation:Ue,setEnableEchoCancellation:ze,enableNoiseSuppression:Pe,setEnableNoiseSuppression:$e,enableNoiseSuppression2:He,setEnableNoiseSuppression2:je,isOutputRecording:Se,setIsOutputRecording:Ce,outputRecord:be,setOutputRecord:Ee,isStarted:Ae,setIsStarted:Ie,protocol:Kt,setProtocol:ir,isPassthrough:Te,setIsPassthrough:De,realtimeOutputStatusEnabled:Ne,setRealtimeOutputStatusEnabled:Oe,recordForAnalysis:$t,setRecordForAnalysis:tr,showSampleAudioButton:ar,setShowSampleAudioButton:gr,realtimeOutputStatusSendIntervalSec:Ve,setRealtimeOutputStatusSendIntervalSec:Ht}},isDesktopApp=()=>navigator.userAgent.indexOf("Electron")>=0,InputControls=()=>{const{setInputAudio:x,inputAudioType:C,setInputAudioType:E,selectedInputAudioDeviceId:w,showSampleAudioButton:T}=useAppState(),{audioContext:_,serverConfiguration:S,serverAudioInputDevices:R,audioInputs:A,setLocalVoiceChangerDummyInput:O}=useAppRoot(),H=useTheme(),{t:ee}=useTranslation(),te=reactExports.useRef(null),[ie,ne]=reactExports.useState(!1),[ae,oe]=reactExports.useState(!1),[le,fe]=reactExports.useState(!1),[de,ce]=reactExports.useState({}),[pe,he]=reactExports.useState(""),[me,ve]=reactExports.useState(null),ye=reactExports.useRef(null),Se=S.voice_changer_input_mode===VoiceChangerInputMode.server;reactExports.useEffect(()=>{(async()=>{try{const Oe=await(await fetch("./assets/voices/sample_voices.json")).json();ce(Oe)}catch(Ne){console.error(ee("common.controls.sample_voices_load_failed"),Ne)}})()},[ee]),reactExports.useEffect(()=>{Se&&(C===InputAudioType.FILE||C===InputAudioType.CAPTURE)&&E(InputAudioType.MICROPHONE)},[Se,C,E]);const Ce=R.find(je=>je.index===S.audio_input_device_index),be=A.find(je=>je.deviceId===w);reactExports.useEffect(()=>{if(console.log(ee("common.controls.useeffect_log"),me,C),_==null||me==null||C!==InputAudioType.FILE)return;const je=document.getElementById(AUDIO_ELEMENT_FOR_INPUT_MEDIA);if(je==null)return;je.pause(),je.srcObject=null,je.src=URL.createObjectURL(me),je.play(),ye.current||(ye.current=_.createMediaElementSource(je)),ye.current.mediaElement!=je&&(ye.current=_.createMediaElementSource(je));const Ne=_.createMediaStreamDestination();ye.current.connect(Ne),x(Ne.stream);const Oe=document.getElementById(AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK);Oe.srcObject=Ne.stream,Oe.play()},[me,_,x,C,ee]),reactExports.useEffect(()=>{if(_==null||C!==InputAudioType.SAMPLE||pe.length==0||de[pe]==null)return;const je=document.getElementById(AUDIO_ELEMENT_FOR_INPUT_MEDIA);if(je==null){console.error(ee("common.controls.audio_element_null"));return}je.pause(),je.srcObject=null,C===InputAudioType.SAMPLE?je.src=de[pe]:je.src="",je.play(),ye.current||(ye.current=_.createMediaElementSource(je)),ye.current.mediaElement!=je&&(ye.current=_.createMediaElementSource(je));const Ne=_.createMediaStreamDestination();ye.current.connect(Ne),x(Ne.stream);const Oe=document.getElementById(AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK);Oe.srcObject=Ne.stream,Oe.play()},[_,pe,de,x,C,ee]);const Ee=reactExports.useCallback(async je=>{try{let Ne=je;/^https?:\/\//.test(Ne)||(Ne=new URL(Ne,window.location.href).href),O(Ne)}catch(Ne){console.error(ee("common.controls.sample_send_failed"),Ne)}},[O,ee]);reactExports.useEffect(()=>{const je=document.getElementById(AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK);console.log("Echoback muted:::",ae,_),je!=null&&(ae?je.muted=!1:je.muted=!0)},[ae,_,me,pe,C]),reactExports.useEffect(()=>{const je=document.getElementById(AUDIO_ELEMENT_FOR_INPUT_MEDIA);je!=null&&(je.loop=le)},[le]);const Ae=reactExports.useMemo(()=>C!==InputAudioType.MICROPHONE?null:Se==!0?jsxRuntimeExports.jsx("div",{style:{marginBottom:"20px",marginTop:"10px"},children:jsxRuntimeExports.jsxs("label",{style:{display:"block",marginBottom:"5px",fontSize:"12px"},children:[ee("common.controls.mic_device"),":"," ",Ce?`${Ce.name} (ID: ${Ce.index})`:ee("common.controls.no_device")]})}):jsxRuntimeExports.jsx("div",{style:{marginBottom:"20px",marginTop:"10px"},children:jsxRuntimeExports.jsxs("label",{style:{display:"block",marginBottom:"5px",fontSize:"12px"},children:[ee("common.controls.mic_device"),":"," ",be?`${be.label} (ID: ${be.deviceId})`:w]})}),[ee,Se,Ce,be,w,C]),Ie=reactExports.useMemo(()=>jsxRuntimeExports.jsx(Tooltip,{title:ee(le?"common.controls.loop_disable":"common.controls.loop_enable"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>fe(!le),color:le?"primary":"default",size:"large",sx:{height:"40px",width:"40px",minWidth:"40px",border:"2px solid",borderColor:le?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(Loop,{sx:{fontSize:"20px"}})})}),[le,ee]),Te=reactExports.useMemo(()=>jsxRuntimeExports.jsx(Tooltip,{title:ee(ae?"common.controls.echoback_disable":"common.controls.echoback_enable"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>oe(!ae),color:ae?"primary":"default",size:"large",sx:{height:"40px",width:"40px",minWidth:"40px",border:"2px solid",borderColor:ae?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsx(NetworkPing,{sx:{fontSize:"20px"}})})}),[ae,ee]),De=reactExports.useMemo(()=>C!==InputAudioType.FILE?null:jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntimeExports.jsx("div",{onClick:()=>{const je=document.createElement("input");je.type="file",je.onchange=Ne=>{const Oe=Ne.target.files;Oe&&ve(Oe[0])},je.click()},onDragOver:je=>{je.preventDefault(),je.stopPropagation()},onDrop:je=>{je.preventDefault(),je.stopPropagation();const Ne=je.dataTransfer.files;Ne.length>0&&ve(Ne[0])},style:{width:"100%",height:"100px",border:"2px dashed #ccc",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",backgroundColor:H.palette.mode==="light"?"#f8f8f8":"#2f2f2f",marginBottom:"10px",marginTop:"10px"},children:jsxRuntimeExports.jsxs("div",{style:{textAlign:"center"},children:[jsxRuntimeExports.jsx("div",{children:ee("common.controls.drop_files")}),jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",color:"#666"},children:ee("common.controls.supported_formats")})]})}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",marginBottom:"20px"},children:[jsxRuntimeExports.jsx("audio",{id:AUDIO_ELEMENT_FOR_INPUT_MEDIA,controls:!0,style:{flex:1,height:"40px"}}),Ie,Te]}),jsxRuntimeExports.jsx("audio",{id:AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK,controls:!0,style:{width:"100%",marginBottom:"20px"},hidden:!0})]}),[ee,C,Te,Ie,H.palette.mode]),Ue=reactExports.useMemo(()=>C!==InputAudioType.CAPTURE?null:jsxRuntimeExports.jsx("div",{style:{marginBottom:"20px"},children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>{(async()=>{if(te.current&&(te.current.getTracks().forEach(Ne=>{Ne.stop()}),te.current=null),ie==!0){ne(!1);return}try{if(isDesktopApp()){const Ne={audio:{mandatory:{chromeMediaSource:"desktop"}},video:{mandatory:{chromeMediaSource:"desktop"}}};te.current=await navigator.mediaDevices.getUserMedia(Ne)}else te.current=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0})}catch(Ne){console.error(ee("common.controls.capture_error"),Ne);return}if(!te.current){console.error(ee("common.controls.capture_no_media_stream"));return}if(te.current.getAudioTracks().length==0){te.current.getTracks().forEach(Ne=>{Ne.stop()}),te.current=null,console.error(ee("common.controls.capture_no_audio_track"));return}try{x(te.current)}catch(Ne){console.error(ee("common.controls.capture_error"),Ne)}ne(!0)})()},color:ie?"primary":"default",size:"large",sx:{width:"100%",height:"80px",minWidth:"100px",px:2,border:"2px solid",borderColor:ie?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"},marginTop:"10px"},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(ScreenShare,{}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",whiteSpace:"nowrap"},children:ee(ie?"common.controls.stop_capture":"common.controls.screen_capture")})]})})}),[ee,C,ie,x]),ze=reactExports.useMemo(()=>C!==InputAudioType.SAMPLE||Se!=!0||pe==""?null:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginBottom:"10px"},children:[jsxRuntimeExports.jsx(Button,{variant:"outlined",startIcon:jsxRuntimeExports.jsx(PlayArrow,{}),onClick:()=>{de[pe]&&new Audio(de[pe]).play().catch(Ne=>{console.error(ee("common.controls.test_audio_play_failed"),Ne)})},sx:{height:"40px",minWidth:"120px"},children:ee("common.controls.test_play")}),jsxRuntimeExports.jsx(Button,{variant:"contained",startIcon:jsxRuntimeExports.jsx(Send,{}),onClick:()=>{de[pe]&&Ee(de[pe])},sx:{height:"40px",minWidth:"120px"},children:ee("common.controls.send_sample")})]}),[Ee,C,Se,de,pe,ee]),Pe=reactExports.useMemo(()=>C!==InputAudioType.SAMPLE||Se==!0||pe==""?null:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",marginBottom:"20px"},children:[jsxRuntimeExports.jsx("audio",{id:AUDIO_ELEMENT_FOR_INPUT_MEDIA,controls:!0,style:{flex:1,height:"40px"}}),Ie,Te]}),[Te,Ie,C,Se,pe]),$e=reactExports.useMemo(()=>C!==InputAudioType.SAMPLE?null:jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntimeExports.jsx(FormControl,{fullWidth:!0,style:{marginBottom:"10px",marginTop:"10px"},children:jsxRuntimeExports.jsxs(Select,{value:pe,onChange:je=>{const Ne=je.target.value;he(Ne)},displayEmpty:!0,sx:{height:"40px"},children:[jsxRuntimeExports.jsx(MenuItem,{value:"",children:jsxRuntimeExports.jsx("em",{children:ee("common.controls.select_sample")})}),Object.keys(de).map(je=>jsxRuntimeExports.jsx(MenuItem,{value:je,children:je},je))]})}),ze,Pe,jsxRuntimeExports.jsx("audio",{id:AUDIO_ELEMENT_FOR_INPUT_MEDIA_ECHOBACK,controls:!0,style:{width:"100%",marginBottom:"20px"},hidden:!0})]}),[C,de,pe,ee,ze,Pe]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{style:{display:"block",fontWeight:"bold",flex:1},children:ee("common.controls.input_type")}),jsxRuntimeExports.jsxs(Stack,{direction:"row",spacing:2,justifyContent:"flex-start",children:[jsxRuntimeExports.jsx(Tooltip,{title:ee("common.controls.microphone_input"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>E("microphone"),color:C==="microphone"?"primary":"default",size:"large",sx:{width:"70px",minWidth:"70px",height:"60px",border:"2px solid",borderColor:C==="microphone"?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(Mic,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",textAlign:"center",paddingLeft:"2px",paddingRight:"2px"},children:ee("common.controls.microphone")})]})})}),jsxRuntimeExports.jsx(Tooltip,{title:ee("common.controls.file_input"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>E("file"),color:C==="file"?"primary":"default",size:"large",disabled:Se,sx:{width:"70px",minWidth:"70px",height:"60px",border:"2px solid",borderColor:C==="file"?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(AudioFile,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",textAlign:"center",paddingLeft:"2px",paddingRight:"2px"},children:ee("common.controls.file")})]})})}),jsxRuntimeExports.jsx(Tooltip,{title:ee("common.controls.screen_capture"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>E("capture"),color:C==="capture"?"primary":"default",size:"large",disabled:Se,sx:{width:"70px",minWidth:"70px",height:"60px",border:"2px solid",borderColor:C==="capture"?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(ScreenShare,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",textAlign:"center",paddingLeft:"2px",paddingRight:"2px"},children:ee("common.controls.capture")})]})})}),T&&jsxRuntimeExports.jsx(Tooltip,{title:ee("common.controls.sample_input"),children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>E("sample"),color:C==="sample"?"primary":"default",size:"large",sx:{width:"70px",minWidth:"70px",height:"60px",border:"2px solid",borderColor:C==="sample"?"primary.main":"grey.300",borderRadius:"8px","&:hover":{borderColor:"primary.main"}},children:jsxRuntimeExports.jsxs(Stack,{alignItems:"center",children:[jsxRuntimeExports.jsx(LibraryMusic,{sx:{fontSize:"1.5rem"}}),jsxRuntimeExports.jsx("span",{style:{fontSize:"11px",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",textAlign:"center",paddingLeft:"2px",paddingRight:"2px"},children:ee("common.controls.sample")})]})})})]}),Ae,De,Ue,$e]}),[E,ee,C,Se,Ae,De,Ue,$e,T])},VolumeControls=()=>{const{t:x}=useTranslation(),{nodeInputGain:C,nodeOutputGain:E,nodeMonitorGain:w,setNodeInputGain:T,setNodeOutputGain:_,setNodeMonitorGain:S}=useAppState(),{serverConfiguration:R,updateServerConfiguration:A}=useAppRoot(),O=R.voice_changer_input_mode===VoiceChangerInputMode.server,[H,ee]=reactExports.useState(!0),te=O?R.audio_input_device_gain:C,ie=O?R.audio_output_device_gain:E,ne=O?R.audio_monitor_device_gain:w,ae=reactExports.useCallback(async de=>{O?await A({...R,audio_input_device_gain:de}):T(de)},[O,R,A,T]),oe=reactExports.useCallback(async de=>{O?await A({...R,audio_output_device_gain:de}):_(de)},[O,R,A,_]),le=reactExports.useCallback(async de=>{O?await A({...R,audio_monitor_device_gain:de}):S(de)},[O,R,A,S]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"},children:[jsxRuntimeExports.jsx("label",{style:{display:"block",fontWeight:"bold",flex:1},children:x("common.controls.volume_control")}),jsxRuntimeExports.jsx(IconButton,{onClick:()=>ee(!H),size:"small",children:H?jsxRuntimeExports.jsx(ExpandLess,{}):jsxRuntimeExports.jsx(ExpandMore,{})})]}),H&&jsxRuntimeExports.jsxs("div",{style:{border:"1px solid #ddd",borderRadius:"8px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:x("common.controls.input_volume"),children:jsxRuntimeExports.jsx(Mic,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:x("common.controls.input")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"10",step:"0.1",value:te,onChange:async de=>{const ce=parseFloat(de.target.value);await ae(ce)},style:{flex:1}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:te?.toFixed(1)||"unknown"})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:x("common.controls.output_volume"),children:jsxRuntimeExports.jsx(VolumeUp,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:x("common.controls.output1")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"10",step:"0.1",value:ie,onChange:async de=>{const ce=parseFloat(de.target.value);await oe(ce)},style:{flex:1}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:ie?.toFixed(1)||"unknown"})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:x("common.controls.monitor_volume"),children:jsxRuntimeExports.jsx(VolumeUp,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:x("common.controls.output2")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"10",step:"0.1",value:ne,onChange:async de=>{const ce=parseFloat(de.target.value);await le(ce)},style:{flex:1}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:ne?.toFixed(1)||"unknwon"})]})]})]}),[H,x,te,ne,ie,ae,le,oe])},defaultAppGuiSettin={type:"demo",lang:["en","ja"],inputChunkSec:[.1],extraFrameSec:[.1]},useAppGuiSetting=()=>{const[x,C]=reactExports.useState(defaultAppGuiSettin);return reactExports.useEffect(()=>{(async()=>{const T=await(await fetch("/assets/gui_settings/GUI.json",{method:"GET"})).json();C(T)})()},[]),{guiSetting:x}},WaveformIcon=reactExports.forwardRef((x,C)=>{const w=[[2,12],[6,12],[8,18],[11,6],[14,18],[17,6],[20,12],[22,12]].map(([T,_])=>`${T},${_}`).join(" ");return jsxRuntimeExports.jsx("svg",{ref:C,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...x,children:jsxRuntimeExports.jsx("polyline",{points:w})})});WaveformIcon.displayName="WaveformIcon";const WaveformPlusIcon=reactExports.forwardRef((x,C)=>{const w=[[2,12],[6,12],[8,18],[11,6],[14,18],[17,6],[20,12],[22,12]].map(([T,_])=>`${T},${_}`).join(" ");return jsxRuntimeExports.jsxs("svg",{ref:C,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...x,children:[jsxRuntimeExports.jsx("polyline",{points:w}),jsxRuntimeExports.jsxs("g",{children:[jsxRuntimeExports.jsx("line",{x1:"4",y1:"2.5",x2:"4",y2:"7.5",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"1.5",y1:"5",x2:"6.5",y2:"5",stroke:"currentColor",strokeWidth:"2"})]})]})});WaveformPlusIcon.displayName="WaveformPlusIcon";const EmbedderIcon=reactExports.forwardRef((x,C)=>jsxRuntimeExports.jsxs("svg",{ref:C,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...x,children:[jsxRuntimeExports.jsx("line",{x1:"4",y1:"12",x2:"8",y2:"12",strokeWidth:"1.5"}),jsxRuntimeExports.jsx("polyline",{points:"6.5,10 8,12 6.5,14",strokeWidth:"1.5"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"5",x2:"13.5",y2:"5",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"19",x2:"13.5",y2:"19",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"22",y1:"5",x2:"22",y2:"19",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"20.5",y1:"5",x2:"22",y2:"5",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"20.5",y1:"19",x2:"22",y2:"19",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"14",y1:"8",x2:"19",y2:"8",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"14",y1:"11",x2:"16.5",y2:"11",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"14",y1:"14",x2:"20",y2:"14",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"14",y1:"17",x2:"17",y2:"17",strokeWidth:"2"})]}));EmbedderIcon.displayName="EmbedderIcon";const IndexIcon=reactExports.forwardRef((x,C)=>jsxRuntimeExports.jsxs("svg",{ref:C,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...x,children:[jsxRuntimeExports.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"14",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"8",y1:"7",x2:"8",y2:"21",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"8",y1:"7",x2:"10",y2:"7",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"8",y1:"21",x2:"10",y2:"21",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"22",y1:"7",x2:"22",y2:"21",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"20",y1:"7",x2:"22",y2:"7",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"20",y1:"21",x2:"22",y2:"21",strokeWidth:"1"}),jsxRuntimeExports.jsx("line",{x1:"10.5",y1:"10",x2:"18",y2:"10",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"10.5",y1:"12.5",x2:"15",y2:"12.5",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"10.5",y1:"15",x2:"19",y2:"15",strokeWidth:"2"}),jsxRuntimeExports.jsx("line",{x1:"10.5",y1:"17.5",x2:"16.5",y2:"17.5",strokeWidth:"2"})]}));IndexIcon.displayName="IndexIcon";const VoiceControls=()=>{const{currentSlotInfo:x,updateServerSlotInfo:C,serverConfiguration:E,updateServerConfiguration:w}=useAppRoot(),{t:T}=useTranslation(),[_,S]=reactExports.useState(!0),{guiSetting:R}=useAppGuiSetting(),[A,O]=reactExports.useState(!1),[H,ee]=reactExports.useState(!1),[te,ie]=reactExports.useState(null),ne=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="RVC")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x,Ce=Se.pitch_estimator;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",marginTop:"8px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.voice_controls.pitch_estimator_tooltip"),children:jsxRuntimeExports.jsx(GraphicEq,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.voice_controls.pitch_estimator")})]}),jsxRuntimeExports.jsx("select",{value:Ce,onChange:async be=>{const Ee=be.target.value;Se.pitch_estimator!==Ee&&await C({...Se,pitch_estimator:Ee})},style:{flex:1,minWidth:"120px",padding:"4px"},children:Object.values(PitchEstimatorType).map(be=>jsxRuntimeExports.jsx("option",{value:be,children:be},be))})]})},[x,C,T]),ae=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="RVC")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x,Ce=Se.override_embedder;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",marginTop:"8px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.voice_controls.embedder_override_tooltip"),children:jsxRuntimeExports.jsx(EmbedderIcon,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.voice_controls.embedder")})]}),jsxRuntimeExports.jsxs("select",{value:Ce||"",onChange:async be=>{const Ee=be.target.value===""?null:be.target.value;Se.override_embedder!==Ee&&(ie({slotInfo:Se,newEmbedder:Ee,selectElement:be.target}),O(!0))},style:{flex:1,minWidth:"120px",padding:"4px"},children:[jsxRuntimeExports.jsx("option",{value:"",children:T("common.voice_controls.embedder_default",{embedder:Se.embedder})}),Object.values(EmbedderType).map(be=>jsxRuntimeExports.jsx("option",{value:be,children:be},be))]})]})},[x,T]),oe=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});let Se=0;if(x.voice_changer_type=="RVC")Se=x.pitch_shift;else if(x.voice_changer_type=="Beatrice_v2"){const Ee=x;Ee.use_merged_speaker_embedding?Se=Ee.merged_speaker_pitch_shifts[Ee.merged_speaker_id]||0:Se=Ee.pitch_shifts[Ee.dst_id]||0}let Ce=jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}),be=!1;if(x.voice_changer_type=="Beatrice_v2"){const Ee=x;Ce=jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Checkbox,{checked:Ee.auto_pitch_shift,onChange:async Ae=>{await C({...Ee,auto_pitch_shift:Ae.target.checked})}}),T("common.controls.auto_pitch_shift_label")]}),be=Ee.auto_pitch_shift}return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.pitch_adjust"),children:jsxRuntimeExports.jsx(Tune,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.pitch")})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",width:"100%"},children:[Ce,jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsx("input",{type:"range",min:"-24",max:"24",step:"1",value:Se,disabled:be,onChange:Ee=>{const Ae=parseInt(Ee.target.value);if(x!=null){if(x.voice_changer_type=="RVC"){const Ie=x;Ie.pitch_shift=Ae,C(Ie)}else if(x.voice_changer_type=="Beatrice_v2"){const Ie=x;if(Ie.use_merged_speaker_embedding){const Te=Ie.merged_speaker_pitch_shifts;Te[Ie.merged_speaker_id]=Ae}else{const Te=Ie.pitch_shifts;Te[Ie.dst_id]=Ae;for(let De=0;De<Ie.dst_id;De++)Te[De]||(Te[De]=0)}C(Ie)}}},style:{flex:1}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:Se})]})]})]})},[x,C,T]),le=reactExports.useMemo(()=>x==null?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):x.voice_changer_type!="Beatrice_v2"?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsx("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:jsxRuntimeExports.jsx("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"}})})}),[x,C,T]),fe=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="RVC")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x,Ce=Se.index_ratio,be=Se.index_file!=null;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.index_adjust"),children:jsxRuntimeExports.jsx(IndexIcon,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.index")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:Ce,disabled:!be,onChange:Ee=>{if(Ce==null||!be)return;const Ae=parseFloat(Ee.target.value),Ie=x;Ie.index_ratio=Ae,C(Ie)},style:{flex:1,opacity:be?1:.5,cursor:be?"pointer":"not-allowed"}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right",opacity:be?1:.5},children:be?Ce.toFixed(2):"N/A"})]})},[x,T,C]),de=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="Beatrice_v2")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x;let Ce=0;return Se.use_merged_speaker_embedding?Ce=Se.merged_speaker_formant_shifts[Se.merged_speaker_id]||0:Ce=Se.formant_shifts[Se.dst_id]||0,jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.formant_adjust"),children:jsxRuntimeExports.jsx(GraphicEq,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.formant")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"-2",max:"2",step:"0.5",value:Ce,onChange:be=>{if(x==null||x.voice_changer_type!="Beatrice_v2")return;const Ee=parseFloat(be.target.value);if([-2,-1.5,-1,-.5,0,.5,1,1.5,2].includes(Ee)){const Ie=x;if(Ie.use_merged_speaker_embedding){const Te=Ie.merged_speaker_formant_shifts;Te[Ie.merged_speaker_id]=Ee}else{const Te=Ie.formant_shifts;Te[Ie.dst_id]=Ee;for(let De=0;De<Ie.dst_id;De++)Te[De]||(Te[De]=0)}C(Ie)}},style:{flex:1}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:Ce.toFixed(1)})]})},[x,T,C]),ce=reactExports.useMemo(()=>!R.inputChunkSec||R.inputChunkSec.length===0||x==null?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",marginTop:"8px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.chunksec_adjust"),children:jsxRuntimeExports.jsx(WaveformIcon,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.chunksec_label")})]}),jsxRuntimeExports.jsx("select",{value:x.chunk_sec,onChange:async Se=>{const Ce=Number(Se.target.value);x.chunk_sec!==Ce&&await C({...x,chunk_sec:Ce})},style:{flex:1,minWidth:"120px",padding:"4px"},children:R.inputChunkSec.map(Se=>jsxRuntimeExports.jsx("option",{value:Se,children:`${Math.round(48e3*Se)} [${Se} sec]`},Se))})]}),[R.inputChunkSec,x,C,T]),pe=reactExports.useMemo(()=>!R.extraFrameSec||R.extraFrameSec.length===0||!E?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):x?.voice_changer_type!="RVC"?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",marginTop:"8px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.extraframe_adjust"),children:jsxRuntimeExports.jsx(WaveformPlusIcon,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.extraframesec_label")})]}),jsxRuntimeExports.jsx("select",{value:E.extra_frame_sec,onChange:async Se=>{const Ce=Number(Se.target.value);E.extra_frame_sec!==Ce&&await w({...E,extra_frame_sec:Ce})},style:{flex:1,minWidth:"120px",padding:"4px"},children:R.extraFrameSec.map(Se=>jsxRuntimeExports.jsx("option",{value:Se,children:`${Math.round(48e3*Se)} [${Se} sec]`},Se))})]}),[R.extraFrameSec,E,w,T,x?.voice_changer_type]),he=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="Beatrice_v2")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(H==!1)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.min_source_pitch_adjust"),children:jsxRuntimeExports.jsx(GraphicEq,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.min_source_pitch_label")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"30",max:"128",step:"0.1",value:Se.min_source_pitch,onChange:async Ce=>{const be=parseFloat(Ce.target.value);Se.min_source_pitch!==be&&await C({...Se,min_source_pitch:be})},style:{flex:1}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:Se.min_source_pitch.toFixed(1)})]})},[x,T,C,H]),me=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="Beatrice_v2")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(H==!1)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.max_source_pitch_adjust"),children:jsxRuntimeExports.jsx(GraphicEq,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.max_source_pitch_label")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"30",max:"128",step:"0.1",value:Se.max_source_pitch,style:{flex:1},onChange:async Ce=>{const be=parseFloat(Ce.target.value);Se.max_source_pitch!==be&&await C({...Se,max_source_pitch:be})}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:Se.max_source_pitch.toFixed(1)})]})},[x,T,C,H]),ve=reactExports.useMemo(()=>{if(x==null)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(x.voice_changer_type!="Beatrice_v2")return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});if(H==!1)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const Se=x;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{minWidth:"100px",display:"flex",flexDirection:"column",alignItems:"center"},children:[jsxRuntimeExports.jsx(Tooltip,{title:T("common.controls.vq_neighbor_count_adjust"),children:jsxRuntimeExports.jsx(GraphicEq,{})}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",marginTop:"4px",userSelect:"none"},children:T("common.controls.vq_neighbor_count_label")})]}),jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"8",step:"1",value:Se.vq_neighbor_count,style:{flex:1},onChange:async Ce=>{const be=parseInt(Ce.target.value);Se.vq_neighbor_count!==be&&await C({...Se,vq_neighbor_count:be})}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"50px",textAlign:"right"},children:Se.vq_neighbor_count})]})},[x,T,C,H]),ye=reactExports.useMemo(()=>x==null?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"},children:[jsxRuntimeExports.jsx("label",{style:{display:"block",fontWeight:"bold",flex:1},children:T("common.controls.voice_control")}),jsxRuntimeExports.jsx(IconButton,{onClick:()=>S(!_),size:"small",children:_?jsxRuntimeExports.jsx(ExpandLess,{}):jsxRuntimeExports.jsx(ExpandMore,{})})]}),_&&jsxRuntimeExports.jsxs("div",{style:{border:"1px solid #ddd",borderRadius:"8px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[ne,oe,le,fe,de,ce,pe,ae,x.voice_changer_type=="Beatrice_v2"&&jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsx("label",{style:{display:"block",fontWeight:"bold"},children:T("common.controls.advanced_controls")}),jsxRuntimeExports.jsx(IconButton,{onClick:()=>ee(!H),size:"small",children:H?jsxRuntimeExports.jsx(ExpandLess,{}):jsxRuntimeExports.jsx(ExpandMore,{})})]}),he,me,ve]})]}),[x,ne,oe,fe,de,ce,pe,ae,T,_,H]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[ye,jsxRuntimeExports.jsx(ConfirmationDialog,{isOpen:A,title:T("common.voice_controls.embedder_change_title"),message:T("common.voice_controls.embedder_change_message"),confirmButtonText:T("common.voice_controls.embedder_change_confirm"),cancelButtonText:T("common.voice_controls.embedder_change_cancel"),onConfirm:async()=>{te&&await C({...te.slotInfo,override_embedder:te.newEmbedder}),O(!1),ie(null)},onCancel:()=>{te&&(te.selectElement.value=te.slotInfo.override_embedder||""),O(!1),ie(null)}})]})},Controls=()=>{const{currentSlotInfo:x}=useAppRoot();return reactExports.useMemo(()=>x==null?null:jsxRuntimeExports.jsx("div",{style:{flex:1,width:"calc(100% - 340px)"},children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0px",justifyContent:"center",width:"100%"},children:[jsxRuntimeExports.jsx(MainControls,{}),jsxRuntimeExports.jsx(InputControls,{}),jsxRuntimeExports.jsx(VolumeControls,{}),jsxRuntimeExports.jsx(VoiceControls,{})]})}),[x])},codeFilename$3=import.meta.url.split("/").pop(),logPrefix$3=`[${codeFilename$3}]`,Y_AXIS_MULTIPLIER=10,PerformanceArea=()=>{const{t:x}=useTranslation(),{isClientInitialized:C,setVoiceChangerStatusListener:E,outputBufferSizeHistory:w,resetOutputBuffer:T}=useAppState(),{currentSlotInfo:_,serverConfiguration:S,truncateOutputBuffer:R,refreshVoiceChangerIOQueue:A}=useAppRoot(),O=reactExports.useRef(null),H=reactExports.useRef(null),ee=reactExports.useRef(null),te=reactExports.useRef(null),ie=reactExports.useRef(null),ne=reactExports.useRef(null),ae=reactExports.useRef(null),oe=reactExports.useRef(null),le=reactExports.useRef(null),fe=reactExports.useRef([]),de=reactExports.useRef([]),ce=ye=>ye===0?"0.000":ye.toFixed(3),pe=(ye,Se)=>{if(!ye)return;const Ce=ye.getContext("2d");if(!Ce)return;ye.width===0&&(ye.width=300,ye.height=25),Ce.fillStyle="#f0f0f0",Ce.fillRect(0,0,ye.width,ye.height);const be=Math.max(0,Math.min(Se*ye.width,ye.width)),Ee=Ce.createLinearGradient(0,0,ye.width,0);Ee.addColorStop(0,"#4CAF50"),Ee.addColorStop(.7,"#FFC107"),Ee.addColorStop(1,"#F44336"),Ce.fillStyle=Ee,Ce.fillRect(0,0,be,ye.height),Ce.strokeStyle="#ccc",Ce.lineWidth=1,Ce.strokeRect(0,0,ye.width,ye.height)},he=reactExports.useCallback((ye,Se,Ce)=>{if(!ye)return;const be=ye.getContext("2d");if(!be)return;if(ye.width=300,ye.height=120,be.fillStyle="#f8f9fa",be.fillRect(0,0,ye.width,ye.height),Se.length===0&&Ce.length===0){be.strokeStyle="#ddd",be.lineWidth=1,be.strokeRect(0,0,ye.width,ye.height);return}const Ee=Se.slice(-100),Ae=Ce.slice(-100),Ie=Ee.map(Oe=>Oe.size).filter(Oe=>Oe!==null),Te=Ae.map(Oe=>Oe.size).filter(Oe=>Oe!==null),De=[...Ie,...Te],Ue=De.length>0?Math.max(...De):0,ze=_?.chunk_sec||.1,Pe=ze*Y_AXIS_MULTIPLIER,$e=Math.min(Math.max(Ue,.1),Pe),He={top:10,right:10,bottom:20,left:40},je=ye.width-He.left-He.right,Ne=ye.height-He.top-He.bottom;if(be.strokeStyle="#ddd",be.lineWidth=1,be.beginPath(),be.moveTo(He.left,He.top),be.lineTo(He.left,He.top+Ne),be.stroke(),be.beginPath(),be.moveTo(He.left,He.top+Ne),be.lineTo(He.left+je,He.top+Ne),be.stroke(),be.fillStyle="#666",be.font="12px Arial",be.textAlign="right",be.fillText("0s",He.left-5,He.top+Ne),be.fillText(`${$e.toFixed(2)}s`,He.left-5,He.top+5),Ee.length>=2){be.strokeStyle="#FF9800",be.lineWidth=2,be.beginPath();let Oe=!0;Ee.forEach((Ve,Ht)=>{if(Ve.size!==null){const Kt=Math.min(Ve.size,$e),ir=He.left+Ht/(Ee.length-1)*je,$t=He.top+Ne-Kt/$e*Ne;Oe?(be.moveTo(ir,$t),Oe=!1):be.lineTo(ir,$t)}}),be.stroke()}if(Ae.length>=2){be.strokeStyle="#2196F3",be.lineWidth=2,be.beginPath();let Oe=!0;Ae.forEach((Ve,Ht)=>{if(Ve.size!==null){const Kt=Math.min(Ve.size,$e),ir=He.left+Ht/(Ae.length-1)*je,$t=He.top+Ne-Kt/$e*Ne;Oe?(be.moveTo(ir,$t),Oe=!1):be.lineTo(ir,$t)}}),be.stroke()}if(_?.chunk_sec){const Oe=He.top+Ne-ze/$e*Ne;be.strokeStyle="#ff6b6b",be.lineWidth=4,be.setLineDash([5,5]),be.beginPath(),be.moveTo(He.left,Oe),be.lineTo(He.left+je,Oe),be.stroke(),be.setLineDash([]),be.fillStyle="#ff6b6b",be.font="12px Arial",be.textAlign="left",be.fillText(`${ze.toFixed(3)}s`,He.left+5,Oe-5)}be.strokeStyle="#ccc",be.lineWidth=1,be.strokeRect(He.left,He.top,je,Ne)},[_?.chunk_sec]),me=(ye,Se)=>{if(!ye)return;const Ce=ye.getContext("2d");if(!Ce)return;ye.width=300,ye.height=25,Ce.fillStyle="#f8f9fa",Ce.fillRect(0,0,ye.width,ye.height);const be={left:20,right:20,top:5,bottom:5},Ee=ye.width-be.left-be.right,Ae=ye.height-be.top-be.bottom,Ie=0,Te=2,De=be.left+(1-Ie)/(Te-Ie)*Ee;Ce.strokeStyle="#ddd",Ce.lineWidth=1,Ce.strokeRect(be.left,be.top,Ee,Ae),Ce.strokeStyle="#ff4444",Ce.lineWidth=3,Ce.beginPath(),Ce.moveTo(De,be.top),Ce.lineTo(De,be.top+Ae),Ce.stroke();const Ue=Math.max(Ie,Math.min(Te,Se)),ze=be.left+(Ue-Ie)/(Te-Ie)*Ee;Ce.strokeStyle="#2196F3",Ce.lineWidth=2,Ce.beginPath(),Ce.moveTo(ze,be.top),Ce.lineTo(ze,be.top+Ae),Ce.stroke(),Ce.fillStyle="#666",Ce.font="10px Arial",Ce.textAlign="center",Ce.fillText("0",be.left,ye.height-2),Ce.fillText("1",De,ye.height-2),Ce.fillText("2",be.left+Ee,ye.height-2)};return reactExports.useEffect(()=>{if(C)return console.log(logPrefix$3,"Setting up voice changer status listener"),E({onRealtimeOutputStatus:ye=>{if(pe(O.current,ye.inputRms??0),H.current&&(H.current.textContent=`入力音量 Level ${ce(ye.inputRms??0)}`),pe(ee.current,ye.outputRms??0),te.current&&(te.current.textContent=`出力音量 Level ${ce(ye.outputRms??0)}`),ye.outputBufferSize!==void 0&&S?.output_sample_rate){const Se=ye.outputBufferSize/S.output_sample_rate,Ce={timestamp:Date.now(),size:Se},be={timestamp:Date.now(),size:null};de.current=[...de.current,Ce].slice(-100),fe.current=[...fe.current,be].slice(-100),he(ie.current,fe.current,de.current),ae.current&&(ae.current.textContent=x("common.performance.output_buffer_label",{time:Se.toFixed(3)}))}},onRealtimeProcessStatus:ye=>{if(ye.elapsedTime!==void 0&&ye.outputSec!==void 0&&ye.outputSec>0){const Se=ye.elapsedTime/ye.outputSec;me(oe.current,Se),le.current&&(le.current.textContent=`RTF: ${Se.toFixed(3)}`)}if(ye.inputBufferSize!==void 0&&S?.input_sample_rate){const Se=ye.inputBufferSize/S.input_sample_rate,Ce={timestamp:Date.now(),size:Se},be={timestamp:Date.now(),size:null};fe.current=[...fe.current,Ce].slice(-100),de.current=[...de.current,be].slice(-100),he(ie.current,fe.current,de.current),ne.current&&(ne.current.textContent=x("common.performance.input_buffer_label",{time:Se.toFixed(3)}))}},onData:()=>{}}),()=>{E({onRealtimeOutputStatus:()=>{},onRealtimeProcessStatus:()=>{},onData:()=>{}})}},[E,C,he,S.input_sample_rate,S.output_sample_rate,x]),reactExports.useEffect(()=>{w.length>0&&(de.current=w,he(ie.current,fe.current,w))},[w,he]),reactExports.useEffect(()=>{pe(O.current,0),pe(ee.current,0),he(ie.current,[],[]),me(oe.current,0)},[]),reactExports.useMemo(()=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[jsxRuntimeExports.jsxs("div",{id:"input-volume",style:{width:"320px",borderRadius:"8px",overflow:"hidden",border:"1px solid #eee",marginRight:"20px",flexShrink:0,padding:"10px",display:"flex",flexDirection:"column",gap:"5px"},children:[jsxRuntimeExports.jsx("span",{ref:H,style:{fontSize:"12px",color:"#666"},children:x("common.performance.input_volume_level")}),jsxRuntimeExports.jsx("canvas",{ref:O,style:{height:"10px"}})]}),jsxRuntimeExports.jsxs("div",{id:"output-volume",style:{width:"320px",borderRadius:"8px",overflow:"hidden",border:"1px solid #eee",marginRight:"20px",flexShrink:0,padding:"10px",display:"flex",flexDirection:"column",gap:"5px"},children:[jsxRuntimeExports.jsx("span",{ref:te,style:{fontSize:"12px",color:"#666"},children:x("common.performance.output_volume_level")}),jsxRuntimeExports.jsx("canvas",{ref:ee,style:{height:"10px"}})]}),jsxRuntimeExports.jsxs("div",{style:{width:"320px",borderRadius:"8px",overflow:"hidden",border:"1px solid #eee",marginRight:"20px",flexShrink:0,padding:"10px",display:"flex",flexDirection:"column",gap:"5px"},children:[jsxRuntimeExports.jsx("span",{ref:ne,style:{fontSize:"12px",color:"#666"},children:x("common.performance.input_buffer_initial")}),jsxRuntimeExports.jsx("span",{ref:ae,style:{fontSize:"12px",color:"#666"},children:x("common.performance.output_buffer_initial")}),jsxRuntimeExports.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"5px"},children:[jsxRuntimeExports.jsxs("span",{style:{color:"#FF9800"},children:["■ ",x("common.performance.input_buffer")]}),jsxRuntimeExports.jsxs("span",{style:{marginLeft:"10px",color:"#2196F3"},children:["■ ",x("common.performance.output_buffer")]}),jsxRuntimeExports.jsx("button",{style:{marginLeft:"15px",padding:"2px 8px",fontSize:"11px",borderRadius:"4px",border:"1px solid #ddd",backgroundColor:"#f8f9fa",color:"#666",cursor:"pointer",transition:"all 0.2s ease"},onMouseEnter:ye=>{ye.currentTarget.style.backgroundColor="#e9ecef",ye.currentTarget.style.borderColor="#adb5bd"},onMouseLeave:ye=>{ye.currentTarget.style.backgroundColor="#f8f9fa",ye.currentTarget.style.borderColor="#ddd"},onClick:()=>{T(),R(),A()},children:x("common.performance.clear")})]}),jsxRuntimeExports.jsx("canvas",{ref:ie,style:{height:"120px"}})]}),jsxRuntimeExports.jsxs("div",{style:{width:"320px",borderRadius:"8px",overflow:"hidden",border:"1px solid #eee",marginRight:"20px",flexShrink:0,padding:"10px",display:"flex",flexDirection:"column",gap:"5px"},children:[jsxRuntimeExports.jsx("span",{ref:le,style:{fontSize:"12px",color:"#666"},children:"RTF: 0.000"}),jsxRuntimeExports.jsx("canvas",{ref:oe,style:{height:"25px"}})]})]}),[A,T,R,x])},ControlArea=()=>{const{currentSlotInfo:x}=useAppRoot();return reactExports.useMemo(()=>x==null?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:"30px",border:"1px solid #eee",borderRadius:"8px",padding:"20px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",width:"100%"},children:[jsxRuntimeExports.jsx(HeaderArea,{}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"10px",width:"100%"},children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PortraitArea,{}),jsxRuntimeExports.jsx(PerformanceArea,{})]}),jsxRuntimeExports.jsx(Controls,{})]})]}),[x])},AdvancedSettingDialog=({open:x,onClose:C})=>{const{realtimeOutputStatusEnabled:E,setRealtimeOutputStatusEnabled:w,realtimeOutputStatusSendIntervalSec:T,setRealtimeOutputStatusSendIntervalSec:_,recordForAnalysis:S,setRecordForAnalysis:R,showSampleAudioButton:A,setShowSampleAudioButton:O}=useAppState(),{serverConfiguration:H,updateServerConfiguration:ee}=useAppRoot(),{t:te}=useTranslation(),ie=H.voice_changer_input_mode===VoiceChangerInputMode.server,ne=ie?H.realtime_output_status_enabled??!1:E,ae=ie?H.realtime_output_status_send_interval_sec??.2:T,oe=H.realtime_process_status_enabled??!1,le=H.realtime_process_status_send_interval_sec??2,fe=reactExports.useCallback(async me=>{try{if(ie){const ve={...H,realtime_output_status_enabled:me};await ee(ve)}else w(me),console.log("Client config updated successfully")}catch(ve){console.error("Error updating realtime output status setting:",ve)}},[ie,H,ee,w]),de=reactExports.useCallback(async me=>{try{if(ie){const ve={...H,realtime_output_status_send_interval_sec:me};await ee(ve)}else _(me)}catch(ve){console.error("Error updating realtime status send interval setting:",ve)}},[ie,H,ee,_]),ce=reactExports.useCallback(async me=>{console.log("RealtimeProcessStatus config updated successfully",me);try{const ve={...H,realtime_process_status_enabled:me};await ee(ve),console.log("RealtimeProcessStatus config updated successfully")}catch(ve){console.error("Error updating realtime process status setting:",ve)}},[H,ee]),pe=reactExports.useCallback(async me=>{try{const ve={...H,realtime_process_status_send_interval_sec:me};await ee(ve),console.log("RealtimeProcessStatus send interval updated successfully")}catch(ve){console.error("Error updating realtime process status send interval setting:",ve)}},[H,ee]);return reactExports.useMemo(()=>jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:C,maxWidth:"sm",fullWidth:!0,children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",padding:"20px 20px 0"},children:[jsxRuntimeExports.jsx("h2",{style:{margin:0},children:te("common.advanced_settings_dialog.title")}),jsxRuntimeExports.jsx("button",{onClick:C,style:{border:"none",background:"none",fontSize:"24px",cursor:"pointer",padding:"0 8px"},children:"×"})]}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",padding:"20px 0"},children:[jsxRuntimeExports.jsxs("div",{style:{marginTop:"16px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:te("common.advanced_settings_dialog.realtime_analysis_settings")}),jsxRuntimeExports.jsxs("div",{style:{marginLeft:"16px",display:"flex",flexDirection:"column",gap:"8px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:ne,onChange:me=>fe(me.target.checked)}),te("common.advanced_settings_dialog.enable_realtime_io_analysis")]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"8px",paddingLeft:"24px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[jsxRuntimeExports.jsx("span",{style:{minWidth:"120px"},children:te("common.advanced_settings_dialog.send_interval_seconds")}),jsxRuntimeExports.jsx("input",{type:"range",min:"0.04",max:"0.2",step:"0.04",value:ae,onChange:me=>de(Number(me.target.value)),style:{width:"100%"}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"40px",textAlign:"right"},children:ae})]}),jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:te("common.advanced_settings.realtime_description")})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"16px",borderTop:"1px solid #eee",paddingTop:"16px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:oe,onChange:me=>ce(me.target.checked)}),te("common.advanced_settings_dialog.enable_realtime_voice_processing_analysis")]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"8px",paddingLeft:"24px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[jsxRuntimeExports.jsx("span",{style:{minWidth:"120px"},children:te("common.advanced_settings_dialog.send_interval_seconds")}),jsxRuntimeExports.jsx("input",{type:"range",min:"0.1",max:"5.0",step:"0.1",value:le,onChange:me=>pe(Number(me.target.value)),style:{width:"100%"}}),jsxRuntimeExports.jsx("span",{style:{minWidth:"40px",textAlign:"right"},children:le})]}),jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:te("common.advanced_settings.realtime_description")})]})]})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:te("common.advanced_settings.recording_settings")}),jsxRuntimeExports.jsxs("div",{style:{marginLeft:"16px",display:"flex",flexDirection:"column",gap:"8px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:S,onChange:me=>R(me.target.checked)}),te("common.advanced_settings.record_for_analysis")]}),jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",color:"#666",marginLeft:"24px"},children:te("common.advanced_settings.record_for_analysis_description")})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:te("common.advanced_settings.sample_audio_button")}),jsxRuntimeExports.jsxs("div",{style:{marginLeft:"16px",display:"flex",flexDirection:"column",gap:"8px"},children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:A,onChange:me=>O(me.target.checked)}),te("common.advanced_settings.show_sample_audio_button")]}),jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",color:"#666",marginLeft:"24px"},children:te("common.advanced_settings.sample_audio_button_description")})]})]})]})})]}),[x,C,ne,fe,ae,de,oe,ce,le,pe,S,R,ie,te,A,O])},HotkeyContext=reactExports.createContext(null),useHotkey=()=>{const{t:x}=useTranslation(),C=reactExports.useContext(HotkeyContext);if(!C)throw new Error(x("common.error_messages.use_hotkey_context_error"));return C},ShortcutSettingDialog=({open:x,onClose:C})=>{const{config:E,updateShortcut:w,setShorcutEnabled:T,checkDuplicationKey:_,hotKeySettingError:S}=useHotkey(),{t:R}=useTranslation(),[A,O]=reactExports.useState(null),[H,ee]=reactExports.useState(""),[te,ie]=reactExports.useState(null),[ne,ae]=reactExports.useState(null),[oe,le]=reactExports.useState(!1);reactExports.useEffect(()=>{A===null&&ne!==null&&(T(ne),ae(null))},[A,ne,T]);const fe=reactExports.useCallback(()=>{O(null),ee(""),ie(null),le(!1)},[]),de=reactExports.useCallback(async(ve,ye)=>{ve.preventDefault(),ve.stopPropagation();const Se=[];ve.shiftKey&&Se.push("shift"),ve.ctrlKey&&Se.push("control"),ve.altKey&&Se.push("alt"),ve.metaKey&&Se.push("meta");const Ce=ve.key;let be=!1;if(Ce!=="Control"&&Ce!=="Alt"&&Ce!=="Shift"&&Ce!=="Meta")if(Ce===" ")Se.push("Space");else if(Ce==="Enter")Se.push("Enter");else if(Ce==="Tab")Se.push("Tab");else if(Ce==="Escape"){fe();return}else if(Ce==="Backspace")Se.push("Backspace");else if(Ce==="Delete")Se.push("Delete");else if(Ce==="ArrowUp")Se.push("ArrowUp");else if(Ce==="ArrowDown")Se.push("ArrowDown");else if(Ce==="ArrowLeft")Se.push("ArrowLeft");else if(Ce==="ArrowRight")Se.push("ArrowRight");else if(Ce.startsWith("F")&&Ce.length>1)Se.push(Ce);else if(Ce.length===1){const Ee=Ce.toUpperCase();Ee.match(/[A-Z]/)?Se.push(`Key${Ee}`):Ee.match(/[0-9]/)?Se.push(`Digit${Ee}`):Se.push(Ce)}else Se.push(Ce);else be=!0;if(console.log("🎯 duplicateError:11",Se),Se.length>0){const Ee=Se.join("+");if(ee(Ee),!be&&E){const Ae=_(ye,Ee);Ae?ie(Ae):(await w(ye,Ee),fe())}}},[E,w,_,fe]),ce=reactExports.useCallback(()=>{fe()},[fe]),pe=reactExports.useCallback((ve,ye)=>{E&&ne===null&&(ae(E.enabled),T(!1)),O(ve),ee(ye),ie(null),le(!0)},[E,ne,T]),he=reactExports.useCallback(()=>{A!==null&&fe(),C()},[A,fe,C]);return reactExports.useMemo(()=>E?jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:he,maxWidth:"md",fullWidth:!0,children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",padding:"20px 20px 0"},children:[jsxRuntimeExports.jsx("h2",{style:{margin:0},children:R("common.shortcut_settings.title")}),jsxRuntimeExports.jsx("button",{onClick:he,style:{border:"none",background:"none",fontSize:"24px",cursor:"pointer",padding:"0 8px"},children:"×"})]}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",padding:"20px 0"},children:[S&&jsxRuntimeExports.jsx("div",{style:{color:"red",fontSize:"14px",marginBottom:"16px"},children:S}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",opacity:oe?.5:1,pointerEvents:oe?"none":"auto"},children:[jsxRuntimeExports.jsx("input",{type:"checkbox",checked:oe?ne??E.enabled:E.enabled,onChange:ve=>{oe||T(ve.target.checked)},disabled:oe}),R("common.shortcut_settings_dialog.enable_shortcuts")]}),oe&&jsxRuntimeExports.jsx("div",{style:{marginTop:"8px",padding:"8px 12px",backgroundColor:"#fff3cd",border:"1px solid #ffeaa7",borderRadius:"4px",fontSize:"12px",color:"#856404"},children:R("common.shortcut_settings.shortcuts_disabled_notice")})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"16px"},children:R("common.shortcut_settings_dialog.shortcut_settings")}),jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:E.shortcuts.map(ve=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",border:"1px solid #e0e0e0",borderRadius:"4px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[jsxRuntimeExports.jsxs("div",{style:{flex:"1"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"4px"},children:R(ve.display_name)}),jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",color:"#666"},children:R(ve.description)})]}),jsxRuntimeExports.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px",minWidth:"250px"},children:A===ve.action?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{type:"text",value:H,onKeyDown:ye=>de(ye,ve.action),placeholder:R("common.shortcut_settings_dialog.press_key_placeholder"),style:{flex:1,padding:"6px 12px",border:"2px solid #2196F3",borderRadius:"4px",fontSize:"14px",outline:"none"},autoFocus:!0,readOnly:!0}),jsxRuntimeExports.jsx("button",{onClick:ce,style:{padding:"6px 12px",fontSize:"12px",backgroundColor:"#f44336",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},title:R("common.shortcut_settings.cancel_tooltip"),children:"×"})]}):jsxRuntimeExports.jsx("div",{onClick:()=>pe(ve.action,ve.shortcut),style:{flex:1,padding:"6px 12px",backgroundColor:"#f5f5f5",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",minHeight:"20px",cursor:"pointer",transition:"all 0.2s ease"},onMouseEnter:ye=>{ye.currentTarget.style.backgroundColor="#e8e8e8",ye.currentTarget.style.borderColor="#bbb"},onMouseLeave:ye=>{ye.currentTarget.style.backgroundColor="#f5f5f5",ye.currentTarget.style.borderColor="#ddd"},title:R("common.shortcut_settings_dialog.click_to_edit"),children:ve.shortcut||R("common.shortcut_settings_dialog.not_set")})})]}),A===ve.action&&te&&jsxRuntimeExports.jsx("div",{style:{color:"#f44336",fontSize:"12px",marginTop:"4px",paddingLeft:"8px",backgroundColor:"#ffebee",padding:"8px",borderRadius:"4px",border:"1px solid #ffcdd2"},children:te})]},ve.action))})]}),jsxRuntimeExports.jsxs("div",{style:{marginTop:"20px",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"},children:[jsxRuntimeExports.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:R("common.shortcut_settings.usage_instructions.title")}),jsxRuntimeExports.jsxs("div",{style:{fontSize:"14px",lineHeight:"1.5"},children:[jsxRuntimeExports.jsx("div",{children:R("common.shortcut_settings.usage_instructions.instruction1")}),jsxRuntimeExports.jsx("div",{children:R("common.shortcut_settings.usage_instructions.instruction2")}),jsxRuntimeExports.jsx("div",{children:R("common.shortcut_settings.usage_instructions.instruction3")}),jsxRuntimeExports.jsx("div",{children:R("common.shortcut_settings.usage_instructions.instruction4")}),jsxRuntimeExports.jsx("div",{children:R("common.shortcut_settings_dialog.enable_shortcut_checkbox")}),jsxRuntimeExports.jsx("div",{style:{marginTop:"8px",fontSize:"12px",color:"#666"},children:R("common.shortcut_settings_dialog.example")})]})]})]})})]}):jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:he,maxWidth:"sm",fullWidth:!0,children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",padding:"20px 20px 0"},children:[jsxRuntimeExports.jsx("h2",{style:{margin:0},children:R("common.shortcut_settings.title")}),jsxRuntimeExports.jsx("button",{onClick:he,style:{border:"none",background:"none",fontSize:"24px",cursor:"pointer",padding:"0 8px"},children:"×"})]}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsx("div",{style:{padding:"20px",textAlign:"center"},children:R("common.shortcut_settings_dialog.loading")})})]}),[x,he,E,S,A,H,te,oe,ne,de,ce,pe,T,R])},ConfirmDialog=({open:x,onClose:C,onConfirm:E,title:w,message:T,confirmText:_,cancelText:S})=>{const{t:R}=useTranslation(),A=()=>{E(),C()};return jsxRuntimeExports.jsxs(Dialog,{open:x,onClose:C,maxWidth:"sm",fullWidth:!0,children:[jsxRuntimeExports.jsx(DialogTitle,{children:w}),jsxRuntimeExports.jsx(DialogContent,{children:jsxRuntimeExports.jsx(DialogContentText,{children:T})}),jsxRuntimeExports.jsxs(DialogActions,{children:[jsxRuntimeExports.jsx(Button,{onClick:C,color:"primary",children:S||R("common.dialog.cancel")}),jsxRuntimeExports.jsx(Button,{onClick:A,color:"error",variant:"contained",children:_||R("common.dialog.confirm")})]})]})},AdvancedArea=()=>{const{t:x}=useTranslation(),[C,E]=reactExports.useState(!1),[w,T]=reactExports.useState(!1),[_,S]=reactExports.useState(!1),R=()=>{const ie=new URL(window.location.href);ie.searchParams.set("app_mode","LogViewer"),te(ie.toString())},A=()=>{E(!0)},O=()=>{T(!0)},H=()=>{S(!0)},ee=async()=>{try{await invoke("set_clear_site_data_and_stop_app")}catch(ie){console.error("Failed to clear site data and stop app:",ie)}},te=reactExports.useCallback(async ie=>{try{await invoke("open_browser_url",{url:ie})}catch(ne){console.warn(x("common.links.url_open_failed"),ne),window.open(ie,"_blank","noopener,noreferrer")}},[x]);return jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"16px",marginTop:"16px",flexWrap:"wrap"},children:[jsxRuntimeExports.jsx(Button,{size:"small",onClick:R,children:x("common.advanced_area.log")}),jsxRuntimeExports.jsx(Button,{size:"small",onClick:A,children:x("common.advanced_area.advanced_settings")}),jsxRuntimeExports.jsx(Button,{size:"small",onClick:O,children:x("common.advanced_area.key_settings")}),jsxRuntimeExports.jsx(Button,{size:"small",onClick:()=>te("https://github.com/w-okada/voice-changer"),children:x("common.advanced_area.github_repo")}),jsxRuntimeExports.jsx(Button,{size:"small",onClick:H,children:x("common.advanced_area.clear_site_data_and_restart")}),jsxRuntimeExports.jsx(AdvancedSettingDialog,{open:C,onClose:()=>E(!1)}),jsxRuntimeExports.jsx(ShortcutSettingDialog,{open:w,onClose:()=>T(!1)}),jsxRuntimeExports.jsx(ConfirmDialog,{open:_,onClose:()=>S(!1),onConfirm:ee,title:x("common.clear_site_data_confirm.title"),message:x("common.clear_site_data_confirm.message"),confirmText:x("common.dialog.confirm"),cancelText:x("common.dialog.cancel")})]})};function Demo(){const{serverProperties:x}=useAppRoot(),{setOutputAudioElementId:C,setMonitorAudioElementId:E}=useAppState();return reactExports.useEffect(()=>{C(AUDIO_ELEMENT_FOR_PLAY_RESULT),E(AUDIO_ELEMENT_FOR_PLAY_MONITOR)},[]),jsxRuntimeExports.jsxs("div",{style:{maxWidth:"1200px",margin:"0 auto",padding:"20px",width:"100%"},children:[jsxRuntimeExports.jsxs("h2",{children:[x.application_name," ",jsxRuntimeExports.jsxs("span",{style:{fontSize:"1rem",color:"gray"},children:["ver ",x.application_version," ",x.application_edition]})]}),jsxRuntimeExports.jsx(LinkArea,{}),jsxRuntimeExports.jsx(ModelSelector,{}),jsxRuntimeExports.jsx(ControlArea,{}),jsxRuntimeExports.jsx(AdvancedArea,{}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("audio",{hidden:!0,id:AUDIO_ELEMENT_FOR_PLAY_RESULT}),jsxRuntimeExports.jsx("audio",{hidden:!0,id:AUDIO_ELEMENT_FOR_PLAY_MONITOR})]})]})}function App(){const{appMode:x}=useAppRoot(),{displayColorMode:C}=useAppState(),E=reactExports.useMemo(()=>C=="light"?(document.body.classList.toggle("dark-mode",!1),createTheme({palette:{mode:"light"}})):(document.body.classList.toggle("dark-mode",!0),createTheme({palette:{mode:"dark"}})),[C]),w=reactExports.useMemo(()=>{if(x==="App")return jsxRuntimeExports.jsx(Demo,{});if(x==="LogViewer")return jsxRuntimeExports.jsx(LogViewer,{})},[x]);return jsxRuntimeExports.jsxs(ThemeProvider,{theme:E,children:[w,jsxRuntimeExports.jsx(Lt,{style:{zIndex:2001}})]})}const codeFilename$2=import.meta.url.split("/").pop(),logPrefix$2=`[${codeFilename$2}]`,useAudioConfig=x=>{const{t:C}=useTranslation(),[E,w]=reactExports.useState(null),[T,_]=reactExports.useState([]),[S,R]=reactExports.useState([]),A=reactExports.useRef(!1);reactExports.useEffect(()=>{const ee=async()=>{if(A.current==!0)return;A.current=!0;const ae=new URL(window.location.href).searchParams.get("sample_rate")||null;let oe;ae?ae=="default"?(log$1("info",logPrefix$2,"Sample rate: default"),oe=new AudioContext):(log$1("info",logPrefix$2,`Sample rate: ${ae}`),oe=new AudioContext({sampleRate:Number(ae)})):(log$1("info",logPrefix$2,"Sample rate: default(48000)"),oe=new AudioContext({sampleRate:48e3})),await O(),log$1("info",logPrefix$2,oe),w(oe),document.removeEventListener("touchstart",te),document.removeEventListener("mousedown",te)},te=()=>{setTimeout(()=>{ee()},x.createAudioContextDelay)};document.addEventListener("touchstart",te,!1),document.addEventListener("mousedown",te,!1)},[]);const O=async()=>{try{(await navigator.mediaDevices.getUserMedia({video:!1,audio:!0})).getTracks().forEach(ae=>{ae.stop()})}catch(ne){console.warn("Enumerate device error::",ne)}const ee=await navigator.mediaDevices.enumerateDevices(),te=ee.filter(ne=>ne.kind=="audioinput");te.push({deviceId:"none",groupId:"none",kind:"audioinput",label:C("common.controls.device_none"),toJSON:()=>{}}),te.push({deviceId:"file",groupId:"file",kind:"audioinput",label:C("common.controls.device_file"),toJSON:()=>{}}),te.push({deviceId:"screen",groupId:"screen",kind:"audioinput",label:C("common.controls.device_system"),toJSON:()=>{}}),_(te);const ie=ee.filter(ne=>ne.kind=="audiooutput");ie.push({deviceId:"none",groupId:"none",kind:"audiooutput",label:C("common.controls.device_none"),toJSON:()=>{}}),R(ie)};return{audioContext:E,audioInputs:T,audioOutputs:S,reloadDeviceInfo:O}},codeFilename$1=import.meta.url.split("/").pop(),logPrefix$1=`[${codeFilename$1}]`,DefaultServerConfiguration={current_slot_index:-1,voice_changer_input_mode:"client",sio_broadcast:!1,pass_through:!1,recording_started:!1,enable_high_pass_filter:!1,high_pass_filter_cutoff:0,enable_low_pass_filter:!1,low_pass_filter_cutoff:0,volume_tuning_type:"sqrt",audio_input_device_index:-1,audio_output_device_index:-1,audio_monitor_device_index:-1,wasapi_exclude_emabled:!1,audio_input_device_sample_rate:0,audio_output_device_sample_rate:0,audio_monitor_device_sample_rate:0,audio_input_device_gain:0,audio_output_device_gain:0,audio_monitor_device_gain:0,server_device_trancate_buffer_ratio:0,realtime_process_status_enabled:!1,realtime_process_status_send_interval_sec:2,realtime_output_status_enabled:!1,realtime_output_status_send_interval_sec:.2,noise_gate:0,extra_frame_sec:0,crossfade_sec:0,sola_search_frame_sec:0,gpu_device_id_int:0,input_sample_rate:0,output_sample_rate:0,monitor_sample_rate:0},useServerConfig=x=>{const{t:C}=useTranslation(),[E,w]=reactExports.useState(!1),T=reactExports.useMemo(()=>VCRestClient.getInstance(),[]),[_,S]=reactExports.useState(DefaultServerConfiguration),[R,A]=reactExports.useState([]),[O,H]=reactExports.useState([]),[ee,te]=reactExports.useState([]),[ie,ne]=reactExports.useState([]),[ae,oe]=reactExports.useState([]),[le,fe]=reactExports.useState([]),[de,ce]=reactExports.useState({application_name:"",available_voice_changer_types:[],available_audio_input_modes:[],available_processing_units:[],application_version:"",application_edition:""}),[pe,he]=reactExports.useState(),me=reactExports.useCallback(async()=>{const Jt=await T.getServerConfiguration();S(Jt)},[T]),ve=reactExports.useCallback(async(Jt=!1)=>{const mr=await T.getServerAudioInputDevices(Jt);A(mr)},[T]),ye=reactExports.useCallback(async(Jt=!1)=>{const mr=await T.getServerAudioOutputDevices(Jt);H(mr)},[T]),Se=reactExports.useCallback(async()=>{const Jt=await T.getServerGPUInfo();te(Jt)},[T]),Ce=reactExports.useCallback(async(Jt=!1)=>{const mr=await T.getServerModuleStatus(Jt);ne(mr)},[T]),be=reactExports.useCallback(async()=>{const Jt=await T.getSamples();fe(Jt)},[T]),Ee=reactExports.useCallback(async()=>{const Jt=await T.getServerSlotInfos();oe(Jt)},[T]),Ae=reactExports.useCallback(async()=>{const Jt=await T.getServerProperties();ce(Jt)},[T]),Ie=reactExports.useCallback(async()=>{const Jt=await T.getLocalVoiceChangerInterfaceInfo();he(Jt)},[T]);reactExports.useEffect(()=>{E===!1&&(async()=>{log$1("info",logPrefix$1,"load server information"),await me(),await ve(),await ye(),await Se(),await Ce(),await be(),await Ee(),await Ae(),await Ie(),w(!0)})()},[T,me,ve,ye,Se,Ce,be,Ee,Ae,Ie,E]),reactExports.useEffect(()=>{T.setEnableFlatPath(x.flatPath)},[T,x.flatPath]);const Te=reactExports.useCallback(async Jt=>{try{await Jt()}catch(mr){log$1("error",logPrefix$1,C("common.error_messages.error_occurred"),mr);const Cr=mr;if(Cr.type==VOICE_CHANGER_CLIENT_EXCEPTION.ERR_HTTP_EXCEPTION){const zt=`${Cr.status}[${Cr.statusText}]: ${Cr.reason} ${Cr.action}`;x.triggerToast("error",zt)}else throw mr}},[x,C]),De=reactExports.useCallback(async Jt=>{await T.updateServerConfiguration(Jt),me(),Ee()},[T,me,Ee]),Ue=reactExports.useCallback(async Jt=>{await Te(async()=>{await De(Jt)})},[Te,De]),ze=reactExports.useCallback(async()=>{const Jt=await T.downloadApplioModules();return Ce(),Jt},[T,Ce]),Pe=reactExports.useCallback(async(Jt,mr)=>{const Cr=await T.downloadSample(Jt,mr);return Ee(),Cr},[T,Ee]),$e=reactExports.useCallback(async(Jt,mr,Cr,zt=null,Ft)=>{if(mr==="RVC"){const kt=Cr.find(Be=>Be.kind==="rvcModel")?.file,ke=Cr.find(Be=>Be.kind==="rvcIndex")?.file||null;if(!kt)throw new Error(C("common.error_messages.rvc_model_file_required"));await T.uploadRVCModelFile(Jt,kt,ke,zt,Ft)}else if(mr==="Beatrice_v2"){const kt=Cr.find(ke=>ke.kind==="beatriceV2Zip")?.file;if(!kt)throw new Error(C("common.error_messages.beatrice_v2_zip_file_required"));await T.uploadBeatriceV2ModelFile(Jt,kt,Ft)}else throw new Error(C("common.error_messages.not_supported_voice_changer_type"));Ee()},[T,Ee,C]),He=reactExports.useCallback(async Jt=>{await T.updateServerSlotInfo(Jt),Ee()},[T,Ee]),je=reactExports.useCallback(async Jt=>{await T.deleteServerSlotInfo(Jt),Ee()},[T,Ee]),Ne=reactExports.useCallback(async(Jt,mr,Cr)=>{await T.uploadIconFile(Jt,mr,Cr),Ee()},[T,Ee]),Oe=reactExports.useCallback(async(Jt,mr,Cr,zt)=>{await T.uploadBeatriceV2VoiceIconFile(Jt,mr,Cr,zt),Ee()},[T,Ee]),Ve=reactExports.useCallback(async(Jt,mr,Cr)=>{await T.updateBeatriceV2VoiceName(Jt,mr,Cr),Ee()},[T,Ee]),Ht=reactExports.useCallback(async(Jt,mr,Cr)=>{await T.updateBeatriceV2VoiceDescription(Jt,mr,Cr),Ee()},[T,Ee]),Kt=reactExports.useCallback(async Jt=>await T.getTask(Jt),[T]),ir=reactExports.useCallback(async Jt=>{await T.deleteTask(Jt)},[T]),$t=reactExports.useCallback(async()=>{await T.initializeServer(),Ee()},[T,Ee]),tr=reactExports.useCallback(async Jt=>{await T.mergeModels(Jt),Ee()},[T,Ee]),ar=reactExports.useCallback(async Jt=>{await T.exportToOnnx(Jt),Ee()},[T,Ee]),gr=reactExports.useCallback(async Jt=>{const mr=await T.export(Jt);return Ee(),mr},[T,Ee]),er=reactExports.useCallback(async Jt=>{const mr={dst:Jt};await T.moveMergedModel(mr),Ee()},[T,Ee]),sr=reactExports.useCallback(async Jt=>{const mr={dst:Jt};await T.moveExportedOnnxModel(mr),Ee()},[T,Ee]),pr=reactExports.useCallback(async(Jt,mr)=>{const Cr={src:Jt,dst:mr};await T.moveModel(Cr),Ee()},[T,Ee]),ur=reactExports.useCallback(async()=>{await Te(async()=>{await T.startServerDevice()}),Ie()},[T,Te,Ie]),Sr=reactExports.useCallback(async()=>{await T.stopServerDevice(),Ie()},[T,Ie]),hr=reactExports.useCallback(async Jt=>{await T.setLocalVoiceChangerDummyInput(Jt)},[T]),yr=reactExports.useCallback(async()=>{await T.truncateOutputBuffer()},[T]),xr=reactExports.useCallback(async()=>{await T.refreshQueue()},[T]);return reactExports.useEffect(()=>{E!==!1&&(de.available_audio_input_modes.includes(_.voice_changer_input_mode)===!1&&(_.voice_changer_input_mode=de.available_audio_input_modes[0],Ue(_)),_.gpu_device_id_int!=-1&&de.available_processing_units.includes("gpu")===!1&&(_.gpu_device_id_int=-1,Ue(_)))},[de,_.voice_changer_input_mode,E]),{serverConfiguration:_,serverAudioInputDevices:R,serverAudioOutputDevices:O,serverGpuInfo:ee,serverModuleStatus:ie,samples:le,serverSlotInfos:ae,serverProperties:de,localVoiceChangerInterfaceInfo:pe,reloadServerConfiguration:me,reloadServerAudioInputDevices:ve,reloadServerAudioOutputDevices:ye,reloadServerSlotInfos:Ee,reloadServerProperties:Ae,reloadLocalVoiceChangerInterfaceInfo:Ie,reloadServerModuleStatus:Ce,updateServerConfiguration:Ue,downloadApplioModules:ze,downloadSample:Pe,uploadModelFile:$e,updateServerSlotInfo:He,deleteServerSlotInfo:je,uploadIconFile:Ne,uploadBeatriceV2VoiceIconFile:Oe,updateBeatriceV2VoiceName:Ve,updateBeatriceV2VoiceDescription:Ht,getTask:Kt,deleteTask:ir,initializeServer:$t,mergeModels:tr,exportToOnnx:ar,exportModel:gr,moveMergedModel:er,moveExportedOnnxModel:sr,moveModel:pr,startServerDevice:ur,stopServerDevice:Sr,setLocalVoiceChangerDummyInput:hr,truncateOutputBuffer:yr,refreshVoiceChangerIOQueue:xr}};var lib={},uaParser_min$1={exports:{}},uaParser_min=uaParser_min$1.exports,hasRequiredUaParser_min;function requireUaParser_min(){return hasRequiredUaParser_min||(hasRequiredUaParser_min=1,function(x,C){(function(E,w){var T="1.0.40",_="",S="?",R="function",A="undefined",O="object",H="string",ee="major",te="model",ie="name",ne="type",ae="vendor",oe="version",le="architecture",fe="console",de="mobile",ce="tablet",pe="smarttv",he="wearable",me="embedded",ve=500,ye="Amazon",Se="Apple",Ce="ASUS",be="BlackBerry",Ee="Browser",Ae="Chrome",Ie="Edge",Te="Firefox",De="Google",Ue="Huawei",ze="LG",Pe="Microsoft",$e="Motorola",He="Opera",je="Samsung",Ne="Sharp",Oe="Sony",Ve="Xiaomi",Ht="Zebra",Kt="Facebook",ir="Chromium OS",$t="Mac OS",tr=" Browser",ar=function(zt,Ft){var kt={};for(var ke in zt)Ft[ke]&&Ft[ke].length%2===0?kt[ke]=Ft[ke].concat(zt[ke]):kt[ke]=zt[ke];return kt},gr=function(zt){for(var Ft={},kt=0;kt<zt.length;kt++)Ft[zt[kt].toUpperCase()]=zt[kt];return Ft},er=function(zt,Ft){return typeof zt===H?sr(Ft).indexOf(sr(zt))!==-1:!1},sr=function(zt){return zt.toLowerCase()},pr=function(zt){return typeof zt===H?zt.replace(/[^\d\.]/g,_).split(".")[0]:w},ur=function(zt,Ft){if(typeof zt===H)return zt=zt.replace(/^\s\s*/,_),typeof Ft===A?zt:zt.substring(0,ve)},Sr=function(zt,Ft){for(var kt=0,ke,Be,et,Ze,Qe,Ke;kt<Ft.length&&!Qe;){var Je=Ft[kt],Re=Ft[kt+1];for(ke=Be=0;ke<Je.length&&!Qe&&Je[ke];)if(Qe=Je[ke++].exec(zt),Qe)for(et=0;et<Re.length;et++)Ke=Qe[++Be],Ze=Re[et],typeof Ze===O&&Ze.length>0?Ze.length===2?typeof Ze[1]==R?this[Ze[0]]=Ze[1].call(this,Ke):this[Ze[0]]=Ze[1]:Ze.length===3?typeof Ze[1]===R&&!(Ze[1].exec&&Ze[1].test)?this[Ze[0]]=Ke?Ze[1].call(this,Ke,Ze[2]):w:this[Ze[0]]=Ke?Ke.replace(Ze[1],Ze[2]):w:Ze.length===4&&(this[Ze[0]]=Ke?Ze[3].call(this,Ke.replace(Ze[1],Ze[2])):w):this[Ze]=Ke||w;kt+=2}},hr=function(zt,Ft){for(var kt in Ft)if(typeof Ft[kt]===O&&Ft[kt].length>0){for(var ke=0;ke<Ft[kt].length;ke++)if(er(Ft[kt][ke],zt))return kt===S?w:kt}else if(er(Ft[kt],zt))return kt===S?w:kt;return Ft.hasOwnProperty("*")?Ft["*"]:zt},yr={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},xr={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Yt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[oe,[ie,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[oe,[ie,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[ie,oe],[/opios[\/ ]+([\w\.]+)/i],[oe,[ie,He+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[oe,[ie,He+" GX"]],[/\bopr\/([\w\.]+)/i],[oe,[ie,He]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[oe,[ie,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[oe,[ie,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[ie,oe],[/quark(?:pc)?\/([-\w\.]+)/i],[oe,[ie,"Quark"]],[/\bddg\/([\w\.]+)/i],[oe,[ie,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[oe,[ie,"UC"+Ee]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[oe,[ie,"WeChat"]],[/konqueror\/([\w\.]+)/i],[oe,[ie,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[oe,[ie,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[oe,[ie,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[oe,[ie,"Smart Lenovo "+Ee]],[/(avast|avg)\/([\w\.]+)/i],[[ie,/(.+)/,"$1 Secure "+Ee],oe],[/\bfocus\/([\w\.]+)/i],[oe,[ie,Te+" Focus"]],[/\bopt\/([\w\.]+)/i],[oe,[ie,He+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[oe,[ie,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[oe,[ie,"Dolphin"]],[/coast\/([\w\.]+)/i],[oe,[ie,He+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[oe,[ie,"MIUI"+tr]],[/fxios\/([\w\.-]+)/i],[oe,[ie,Te]],[/\bqihoobrowser\/?([\w\.]*)/i],[oe,[ie,"360"]],[/\b(qq)\/([\w\.]+)/i],[[ie,/(.+)/,"$1Browser"],oe],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[ie,/(.+)/,"$1"+tr],oe],[/samsungbrowser\/([\w\.]+)/i],[oe,[ie,je+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[oe,[ie,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[ie,"Sogou Mobile"],oe],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[ie,oe],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[ie],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[oe,ie],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[ie,Kt],oe],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[ie,oe],[/\bgsa\/([\w\.]+) .*safari\//i],[oe,[ie,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[oe,[ie,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[oe,[ie,Ae+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[ie,Ae+" WebView"],oe],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[oe,[ie,"Android "+Ee]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[ie,oe],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[oe,[ie,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[oe,ie],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[ie,[oe,hr,yr]],[/(webkit|khtml)\/([\w\.]+)/i],[ie,oe],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[ie,"Netscape"],oe],[/(wolvic|librewolf)\/([\w\.]+)/i],[ie,oe],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[oe,[ie,Te+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[ie,[oe,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[ie,[oe,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[le,"amd64"]],[/(ia32(?=;))/i],[[le,sr]],[/((?:i[346]|x)86)[;\)]/i],[[le,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[le,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[le,"armhf"]],[/windows (ce|mobile); ppc;/i],[[le,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[le,/ower/,_,sr]],[/(sun4\w)[;\)]/i],[[le,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[le,sr]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[te,[ae,je],[ne,ce]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[te,[ae,je],[ne,de]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[te,[ae,Se],[ne,de]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[te,[ae,Se],[ne,ce]],[/(macintosh);/i],[te,[ae,Se]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[te,[ae,Ne],[ne,de]],[/(?:honor)([-\w ]+)[;\)]/i],[te,[ae,"Honor"],[ne,de]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[te,[ae,Ue],[ne,ce]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[te,[ae,Ue],[ne,de]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[te,/_/g," "],[ae,Ve],[ne,de]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[te,/_/g," "],[ae,Ve],[ne,ce]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[te,[ae,"OPPO"],[ne,de]],[/\b(opd2\d{3}a?) bui/i],[te,[ae,"OPPO"],[ne,ce]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[te,[ae,"Vivo"],[ne,de]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[te,[ae,"Realme"],[ne,de]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[te,[ae,$e],[ne,de]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[te,[ae,$e],[ne,ce]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[te,[ae,ze],[ne,ce]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[te,[ae,ze],[ne,de]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[te,[ae,"Lenovo"],[ne,ce]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[te,/_/g," "],[ae,"Nokia"],[ne,de]],[/(pixel c)\b/i],[te,[ae,De],[ne,ce]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[te,[ae,De],[ne,de]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[te,[ae,Oe],[ne,de]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[te,"Xperia Tablet"],[ae,Oe],[ne,ce]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[te,[ae,"OnePlus"],[ne,de]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[te,[ae,ye],[ne,ce]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[te,/(.+)/g,"Fire Phone $1"],[ae,ye],[ne,de]],[/(playbook);[-\w\),; ]+(rim)/i],[te,ae,[ne,ce]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[te,[ae,be],[ne,de]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[te,[ae,Ce],[ne,ce]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[te,[ae,Ce],[ne,de]],[/(nexus 9)/i],[te,[ae,"HTC"],[ne,ce]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[ae,[te,/_/g," "],[ne,de]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[te,[ae,"TCL"],[ne,ce]],[/(itel) ((\w+))/i],[[ae,sr],te,[ne,hr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[te,[ae,"Acer"],[ne,ce]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[te,[ae,"Meizu"],[ne,de]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[te,[ae,"Ulefone"],[ne,de]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[te,[ae,"Energizer"],[ne,de]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[te,[ae,"Cat"],[ne,de]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[te,[ae,"Smartfren"],[ne,de]],[/droid.+; (a(?:015|06[35]|142p?))/i],[te,[ae,"Nothing"],[ne,de]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[ae,te,[ne,de]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[ae,te,[ne,ce]],[/(surface duo)/i],[te,[ae,Pe],[ne,ce]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[te,[ae,"Fairphone"],[ne,de]],[/(u304aa)/i],[te,[ae,"AT&T"],[ne,de]],[/\bsie-(\w*)/i],[te,[ae,"Siemens"],[ne,de]],[/\b(rct\w+) b/i],[te,[ae,"RCA"],[ne,ce]],[/\b(venue[\d ]{2,7}) b/i],[te,[ae,"Dell"],[ne,ce]],[/\b(q(?:mv|ta)\w+) b/i],[te,[ae,"Verizon"],[ne,ce]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[te,[ae,"Barnes & Noble"],[ne,ce]],[/\b(tm\d{3}\w+) b/i],[te,[ae,"NuVision"],[ne,ce]],[/\b(k88) b/i],[te,[ae,"ZTE"],[ne,ce]],[/\b(nx\d{3}j) b/i],[te,[ae,"ZTE"],[ne,de]],[/\b(gen\d{3}) b.+49h/i],[te,[ae,"Swiss"],[ne,de]],[/\b(zur\d{3}) b/i],[te,[ae,"Swiss"],[ne,ce]],[/\b((zeki)?tb.*\b) b/i],[te,[ae,"Zeki"],[ne,ce]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[ae,"Dragon Touch"],te,[ne,ce]],[/\b(ns-?\w{0,9}) b/i],[te,[ae,"Insignia"],[ne,ce]],[/\b((nxa|next)-?\w{0,9}) b/i],[te,[ae,"NextBook"],[ne,ce]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[ae,"Voice"],te,[ne,de]],[/\b(lvtel\-)?(v1[12]) b/i],[[ae,"LvTel"],te,[ne,de]],[/\b(ph-1) /i],[te,[ae,"Essential"],[ne,de]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[te,[ae,"Envizen"],[ne,ce]],[/\b(trio[-\w\. ]+) b/i],[te,[ae,"MachSpeed"],[ne,ce]],[/\btu_(1491) b/i],[te,[ae,"Rotor"],[ne,ce]],[/(shield[\w ]+) b/i],[te,[ae,"Nvidia"],[ne,ce]],[/(sprint) (\w+)/i],[ae,te,[ne,de]],[/(kin\.[onetw]{3})/i],[[te,/\./g," "],[ae,Pe],[ne,de]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[te,[ae,Ht],[ne,ce]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[te,[ae,Ht],[ne,de]],[/smart-tv.+(samsung)/i],[ae,[ne,pe]],[/hbbtv.+maple;(\d+)/i],[[te,/^/,"SmartTV"],[ae,je],[ne,pe]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[ae,ze],[ne,pe]],[/(apple) ?tv/i],[ae,[te,Se+" TV"],[ne,pe]],[/crkey/i],[[te,Ae+"cast"],[ae,De],[ne,pe]],[/droid.+aft(\w+)( bui|\))/i],[te,[ae,ye],[ne,pe]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[te,[ae,Ne],[ne,pe]],[/(bravia[\w ]+)( bui|\))/i],[te,[ae,Oe],[ne,pe]],[/(mitv-\w{5}) bui/i],[te,[ae,Ve],[ne,pe]],[/Hbbtv.*(technisat) (.*);/i],[ae,te,[ne,pe]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[ae,ur],[te,ur],[ne,pe]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[ne,pe]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[ae,te,[ne,fe]],[/droid.+; (shield) bui/i],[te,[ae,"Nvidia"],[ne,fe]],[/(playstation [345portablevi]+)/i],[te,[ae,Oe],[ne,fe]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[te,[ae,Pe],[ne,fe]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[te,[ae,je],[ne,he]],[/((pebble))app/i],[ae,te,[ne,he]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[te,[ae,Se],[ne,he]],[/droid.+; (glass) \d/i],[te,[ae,De],[ne,he]],[/droid.+; (wt63?0{2,3})\)/i],[te,[ae,Ht],[ne,he]],[/droid.+; (glass) \d/i],[te,[ae,De],[ne,he]],[/(pico) (4|neo3(?: link|pro)?)/i],[ae,te,[ne,he]],[/; (quest( \d| pro)?)/i],[te,[ae,Kt],[ne,he]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[ae,[ne,me]],[/(aeobc)\b/i],[te,[ae,ye],[ne,me]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[te,[ne,de]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[te,[ne,ce]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[ne,ce]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[ne,de]],[/(android[-\w\. ]{0,9});.+buil/i],[te,[ae,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[oe,[ie,Ie+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[ie,oe],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[oe,[ie,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[ie,oe],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[oe,ie]],os:[[/microsoft (windows) (vista|xp)/i],[ie,oe],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[ie,[oe,hr,xr]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[oe,hr,xr],[ie,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[oe,/_/g,"."],[ie,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[ie,$t],[oe,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[oe,ie],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[ie,oe],[/\(bb(10);/i],[oe,[ie,be]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[oe,[ie,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[oe,[ie,Te+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[oe,[ie,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[oe,[ie,"watchOS"]],[/crkey\/([\d\.]+)/i],[oe,[ie,Ae+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[ie,ir],oe],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[ie,oe],[/(sunos) ?([\w\.\d]*)/i],[[ie,"Solaris"],oe],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[ie,oe]]},Jt=function(zt,Ft){if(typeof zt===O&&(Ft=zt,zt=w),!(this instanceof Jt))return new Jt(zt,Ft).getResult();var kt=typeof E!==A&&E.navigator?E.navigator:w,ke=zt||(kt&&kt.userAgent?kt.userAgent:_),Be=kt&&kt.userAgentData?kt.userAgentData:w,et=Ft?ar(Yt,Ft):Yt,Ze=kt&&kt.userAgent==ke;return this.getBrowser=function(){var Qe={};return Qe[ie]=w,Qe[oe]=w,Sr.call(Qe,ke,et.browser),Qe[ee]=pr(Qe[oe]),Ze&&kt&&kt.brave&&typeof kt.brave.isBrave==R&&(Qe[ie]="Brave"),Qe},this.getCPU=function(){var Qe={};return Qe[le]=w,Sr.call(Qe,ke,et.cpu),Qe},this.getDevice=function(){var Qe={};return Qe[ae]=w,Qe[te]=w,Qe[ne]=w,Sr.call(Qe,ke,et.device),Ze&&!Qe[ne]&&Be&&Be.mobile&&(Qe[ne]=de),Ze&&Qe[te]=="Macintosh"&&kt&&typeof kt.standalone!==A&&kt.maxTouchPoints&&kt.maxTouchPoints>2&&(Qe[te]="iPad",Qe[ne]=ce),Qe},this.getEngine=function(){var Qe={};return Qe[ie]=w,Qe[oe]=w,Sr.call(Qe,ke,et.engine),Qe},this.getOS=function(){var Qe={};return Qe[ie]=w,Qe[oe]=w,Sr.call(Qe,ke,et.os),Ze&&!Qe[ie]&&Be&&Be.platform&&Be.platform!="Unknown"&&(Qe[ie]=Be.platform.replace(/chrome os/i,ir).replace(/macos/i,$t)),Qe},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ke},this.setUA=function(Qe){return ke=typeof Qe===H&&Qe.length>ve?ur(Qe,ve):Qe,this},this.setUA(ke),this};Jt.VERSION=T,Jt.BROWSER=gr([ie,oe,ee]),Jt.CPU=gr([le]),Jt.DEVICE=gr([te,ae,ne,fe,de,pe,ce,he,me]),Jt.ENGINE=Jt.OS=gr([ie,oe]),x.exports&&(C=x.exports=Jt),C.UAParser=Jt;var mr=typeof E!==A&&(E.jQuery||E.Zepto);if(mr&&!mr.ua){var Cr=new Jt;mr.ua=Cr.getResult(),mr.ua.get=function(){return Cr.getUA()},mr.ua.set=function(zt){Cr.setUA(zt);var Ft=Cr.getResult();for(var kt in Ft)mr.ua[kt]=Ft[kt]}}})(typeof window=="object"?window:uaParser_min)}(uaParser_min$1,uaParser_min$1.exports)),uaParser_min$1.exports}var hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1,Object.defineProperty(lib,"__esModule",{value:!0});function x(ut){return ut&&typeof ut=="object"&&"default"in ut?ut.default:ut}var C=requireReact(),E=x(C),w=requireUaParser_min(),T=new w,_=T.getBrowser(),S=T.getCPU(),R=T.getDevice(),A=T.getEngine(),O=T.getOS(),H=T.getUA(),ee=function(Le){return T.setUA(Le)},te=function(Le){if(!Le){console.error("No userAgent string was provided");return}var We=new w(Le);return{UA:We,browser:We.getBrowser(),cpu:We.getCPU(),device:We.getDevice(),engine:We.getEngine(),os:We.getOS(),ua:We.getUA(),setUserAgent:function(lr){return We.setUA(lr)}}},ie=Object.freeze({ClientUAInstance:T,browser:_,cpu:S,device:R,engine:A,os:O,ua:H,setUa:ee,parseUserAgent:te});function ne(ut,Le){var We=Object.keys(ut);if(Object.getOwnPropertySymbols){var Ut=Object.getOwnPropertySymbols(ut);Le&&(Ut=Ut.filter(function(lr){return Object.getOwnPropertyDescriptor(ut,lr).enumerable})),We.push.apply(We,Ut)}return We}function ae(ut){for(var Le=1;Le<arguments.length;Le++){var We=arguments[Le]!=null?arguments[Le]:{};Le%2?ne(Object(We),!0).forEach(function(Ut){ce(ut,Ut,We[Ut])}):Object.getOwnPropertyDescriptors?Object.defineProperties(ut,Object.getOwnPropertyDescriptors(We)):ne(Object(We)).forEach(function(Ut){Object.defineProperty(ut,Ut,Object.getOwnPropertyDescriptor(We,Ut))})}return ut}function oe(ut){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?oe=function(Le){return typeof Le}:oe=function(Le){return Le&&typeof Symbol=="function"&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},oe(ut)}function le(ut,Le){if(!(ut instanceof Le))throw new TypeError("Cannot call a class as a function")}function fe(ut,Le){for(var We=0;We<Le.length;We++){var Ut=Le[We];Ut.enumerable=Ut.enumerable||!1,Ut.configurable=!0,"value"in Ut&&(Ut.writable=!0),Object.defineProperty(ut,Ut.key,Ut)}}function de(ut,Le,We){return Le&&fe(ut.prototype,Le),ut}function ce(ut,Le,We){return Le in ut?Object.defineProperty(ut,Le,{value:We,enumerable:!0,configurable:!0,writable:!0}):ut[Le]=We,ut}function pe(){return pe=Object.assign||function(ut){for(var Le=1;Le<arguments.length;Le++){var We=arguments[Le];for(var Ut in We)Object.prototype.hasOwnProperty.call(We,Ut)&&(ut[Ut]=We[Ut])}return ut},pe.apply(this,arguments)}function he(ut,Le){if(typeof Le!="function"&&Le!==null)throw new TypeError("Super expression must either be null or a function");ut.prototype=Object.create(Le&&Le.prototype,{constructor:{value:ut,writable:!0,configurable:!0}}),Le&&ve(ut,Le)}function me(ut){return me=Object.setPrototypeOf?Object.getPrototypeOf:function(We){return We.__proto__||Object.getPrototypeOf(We)},me(ut)}function ve(ut,Le){return ve=Object.setPrototypeOf||function(Ut,lr){return Ut.__proto__=lr,Ut},ve(ut,Le)}function ye(ut,Le){if(ut==null)return{};var We={},Ut=Object.keys(ut),lr,Ar;for(Ar=0;Ar<Ut.length;Ar++)lr=Ut[Ar],!(Le.indexOf(lr)>=0)&&(We[lr]=ut[lr]);return We}function Se(ut,Le){if(ut==null)return{};var We=ye(ut,Le),Ut,lr;if(Object.getOwnPropertySymbols){var Ar=Object.getOwnPropertySymbols(ut);for(lr=0;lr<Ar.length;lr++)Ut=Ar[lr],!(Le.indexOf(Ut)>=0)&&Object.prototype.propertyIsEnumerable.call(ut,Ut)&&(We[Ut]=ut[Ut])}return We}function Ce(ut){if(ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ut}function be(ut,Le){if(Le&&(typeof Le=="object"||typeof Le=="function"))return Le;if(Le!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ce(ut)}function Ee(ut,Le){return Ae(ut)||Ie(ut,Le)||Te(ut,Le)||Ue()}function Ae(ut){if(Array.isArray(ut))return ut}function Ie(ut,Le){var We=ut==null?null:typeof Symbol<"u"&&ut[Symbol.iterator]||ut["@@iterator"];if(We!=null){var Ut=[],lr=!0,Ar=!1,Ir,Yr;try{for(We=We.call(ut);!(lr=(Ir=We.next()).done)&&(Ut.push(Ir.value),!(Le&&Ut.length===Le));lr=!0);}catch(Xi){Ar=!0,Yr=Xi}finally{try{!lr&&We.return!=null&&We.return()}finally{if(Ar)throw Yr}}return Ut}}function Te(ut,Le){if(ut){if(typeof ut=="string")return De(ut,Le);var We=Object.prototype.toString.call(ut).slice(8,-1);if(We==="Object"&&ut.constructor&&(We=ut.constructor.name),We==="Map"||We==="Set")return Array.from(ut);if(We==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(We))return De(ut,Le)}}function De(ut,Le){(Le==null||Le>ut.length)&&(Le=ut.length);for(var We=0,Ut=new Array(Le);We<Le;We++)Ut[We]=ut[We];return Ut}function Ue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ze={Mobile:"mobile",Tablet:"tablet",SmartTv:"smarttv",Console:"console",Wearable:"wearable",Embedded:"embedded",Browser:void 0},Pe={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},$e={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},He={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},je=function(Le){switch(Le){case ze.Mobile:return{isMobile:!0};case ze.Tablet:return{isTablet:!0};case ze.SmartTv:return{isSmartTV:!0};case ze.Console:return{isConsole:!0};case ze.Wearable:return{isWearable:!0};case ze.Browser:return{isBrowser:!0};case ze.Embedded:return{isEmbedded:!0};default:return He}},Ne=function(Le){return ee(Le)},Oe=function(Le){var We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none";return Le||We},Ve=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},Ht=function(Le){var We=Ve();return We&&We.platform&&(We.platform.indexOf(Le)!==-1||We.platform==="MacIntel"&&We.maxTouchPoints>1&&!window.MSStream)},Kt=function(Le,We,Ut,lr,Ar){return{isBrowser:Le,browserMajorVersion:Oe(We.major),browserFullVersion:Oe(We.version),browserName:Oe(We.name),engineName:Oe(Ut.name),engineVersion:Oe(Ut.version),osName:Oe(lr.name),osVersion:Oe(lr.version),userAgent:Oe(Ar)}},ir=function(Le,We,Ut,lr){return ae({},Le,{vendor:Oe(We.vendor),model:Oe(We.model),os:Oe(Ut.name),osVersion:Oe(Ut.version),ua:Oe(lr)})},$t=function(Le,We,Ut,lr){return{isSmartTV:Le,engineName:Oe(We.name),engineVersion:Oe(We.version),osName:Oe(Ut.name),osVersion:Oe(Ut.version),userAgent:Oe(lr)}},tr=function(Le,We,Ut,lr){return{isConsole:Le,engineName:Oe(We.name),engineVersion:Oe(We.version),osName:Oe(Ut.name),osVersion:Oe(Ut.version),userAgent:Oe(lr)}},ar=function(Le,We,Ut,lr){return{isWearable:Le,engineName:Oe(We.name),engineVersion:Oe(We.version),osName:Oe(Ut.name),osVersion:Oe(Ut.version),userAgent:Oe(lr)}},gr=function(Le,We,Ut,lr,Ar){return{isEmbedded:Le,vendor:Oe(We.vendor),model:Oe(We.model),engineName:Oe(Ut.name),engineVersion:Oe(Ut.version),osName:Oe(lr.name),osVersion:Oe(lr.version),userAgent:Oe(Ar)}};function er(ut){var Le=ut?te(ut):ie,We=Le.device,Ut=Le.browser,lr=Le.engine,Ar=Le.os,Ir=Le.ua,Yr=je(We.type),Xi=Yr.isBrowser,yn=Yr.isMobile,oa=Yr.isTablet,Nn=Yr.isSmartTV,Un=Yr.isConsole,un=Yr.isWearable,xn=Yr.isEmbedded;if(Xi)return Kt(Xi,Ut,lr,Ar,Ir);if(Nn)return $t(Nn,lr,Ar,Ir);if(Un)return tr(Un,lr,Ar,Ir);if(yn||oa)return ir(Yr,We,Ar,Ir);if(un)return ar(un,lr,Ar,Ir);if(xn)return gr(xn,We,lr,Ar,Ir)}var sr=function(Le){var We=Le.type;return We===ze.Mobile},pr=function(Le){var We=Le.type;return We===ze.Tablet},ur=function(Le){var We=Le.type;return We===ze.Mobile||We===ze.Tablet},Sr=function(Le){var We=Le.type;return We===ze.SmartTv},hr=function(Le){var We=Le.type;return We===ze.Browser},yr=function(Le){var We=Le.type;return We===ze.Wearable},xr=function(Le){var We=Le.type;return We===ze.Console},Yt=function(Le){var We=Le.type;return We===ze.Embedded},Jt=function(Le){var We=Le.vendor;return Oe(We)},mr=function(Le){var We=Le.model;return Oe(We)},Cr=function(Le){var We=Le.type;return Oe(We,"browser")},zt=function(Le){var We=Le.name;return We===$e.Android},Ft=function(Le){var We=Le.name;return We===$e.Windows},kt=function(Le){var We=Le.name;return We===$e.MAC_OS},ke=function(Le){var We=Le.name;return We===$e.WindowsPhone},Be=function(Le){var We=Le.name;return We===$e.IOS},et=function(Le){var We=Le.version;return Oe(We)},Ze=function(Le){var We=Le.name;return Oe(We)},Qe=function(Le){var We=Le.name;return We===Pe.Chrome},Ke=function(Le){var We=Le.name;return We===Pe.Firefox},Je=function(Le){var We=Le.name;return We===Pe.Chromium},Re=function(Le){var We=Le.name;return We===Pe.Edge},Bt=function(Le){var We=Le.name;return We===Pe.Yandex},Fe=function(Le){var We=Le.name;return We===Pe.Safari||We===Pe.MobileSafari},Ge=function(Le){var We=Le.name;return We===Pe.MobileSafari},nr=function(Le){var We=Le.name;return We===Pe.Opera},jt=function(Le){var We=Le.name;return We===Pe.InternetExplorer||We===Pe.Ie},vr=function(Le){var We=Le.name;return We===Pe.MIUI},it=function(Le){var We=Le.name;return We===Pe.SamsungBrowser},dt=function(Le){var We=Le.version;return Oe(We)},xe=function(Le){var We=Le.major;return Oe(We)},Xe=function(Le){var We=Le.name;return Oe(We)},_e=function(Le){var We=Le.name;return Oe(We)},ct=function(Le){var We=Le.version;return Oe(We)},Dt=function(){var Le=Ve(),We=Le&&Le.userAgent&&Le.userAgent.toLowerCase();return typeof We=="string"?/electron/.test(We):!1},cr=function(Le){return typeof Le=="string"&&Le.indexOf("Edg/")!==-1},fr=function(){var Le=Ve();return Le&&(/iPad|iPhone|iPod/.test(Le.platform)||Le.platform==="MacIntel"&&Le.maxTouchPoints>1)&&!window.MSStream},dr=function(){return Ht("iPad")},jr=function(){return Ht("iPhone")},Rr=function(){return Ht("iPod")},ki=function(Le){return Oe(Le)};function _i(ut){var Le=ut||ie,We=Le.device,Ut=Le.browser,lr=Le.os,Ar=Le.engine,Ir=Le.ua;return{isSmartTV:Sr(We),isConsole:xr(We),isWearable:yr(We),isEmbedded:Yt(We),isMobileSafari:Ge(Ut)||dr(),isChromium:Je(Ut),isMobile:ur(We)||dr(),isMobileOnly:sr(We),isTablet:pr(We)||dr(),isBrowser:hr(We),isDesktop:hr(We),isAndroid:zt(lr),isWinPhone:ke(lr),isIOS:Be(lr)||dr(),isChrome:Qe(Ut),isFirefox:Ke(Ut),isSafari:Fe(Ut),isOpera:nr(Ut),isIE:jt(Ut),osVersion:et(lr),osName:Ze(lr),fullBrowserVersion:dt(Ut),browserVersion:xe(Ut),browserName:Xe(Ut),mobileVendor:Jt(We),mobileModel:mr(We),engineName:_e(Ar),engineVersion:ct(Ar),getUA:ki(Ir),isEdge:Re(Ut)||cr(Ir),isYandex:Bt(Ut),deviceType:Cr(We),isIOS13:fr(),isIPad13:dr(),isIPhone13:jr(),isIPod13:Rr(),isElectron:Dt(),isEdgeChromium:cr(Ir),isLegacyEdge:Re(Ut)&&!cr(Ir),isWindows:Ft(lr),isMacOs:kt(lr),isMIUI:vr(Ut),isSamsungBrowser:it(Ut)}}var Fr=Sr(R),Kr=xr(R),Ur=yr(R),ai=Yt(R),ii=Ge(_)||dr(),Fi=Je(_),Ai=ur(R)||dr(),Zr=sr(R),yo=pr(R)||dr(),xo=hr(R),Ji=hr(R),Yi=zt(O),rs=ke(O),So=Be(O)||dr(),is=Qe(_),Zs=Ke(_),Bn=Fe(_),jn=nr(_),Ei=jt(_),Co=et(O),ns=Ze(O),rn=dt(_),Eo=xe(_),wo=Xe(_),Qs=Jt(R),os=mr(R),yi=_e(A),ss=ct(A),ea=ki(H),Ln=Re(_)||cr(H),as=Bt(_),Fn=Cr(R),ta=fr(),xi=dr(),Ro=jr(),ls=Rr(),To=Dt(),nn=cr(H),cs=Re(_)&&!cr(H),us=Ft(O),sn=kt(O),ra=vr(_),ds=it(_),ps=function(Le){if(!Le||typeof Le!="string"){console.error("No valid user agent string was provided");return}var We=te(Le),Ut=We.device,lr=We.browser,Ar=We.os,Ir=We.engine,Yr=We.ua;return _i({device:Ut,browser:lr,os:Ar,engine:Ir,ua:Yr})},ko=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return Yi?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},ia=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return xo?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},na=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return Ei?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},Vn=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return So?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},Ao=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return Ai?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},Po=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return yo?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},an=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return rs?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},ln=function(Le){var We=Le.renderWithFragment,Ut=Le.children;Le.viewClassName,Le.style;var lr=Se(Le,["renderWithFragment","children","viewClassName","style"]);return Zr?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},hs=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return Fr?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},Mo=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return Kr?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},fs=function(Le){var We=Le.renderWithFragment,Ut=Le.children,lr=Se(Le,["renderWithFragment","children"]);return Ur?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",lr,Ut):null},bn=function(Le){var We=Le.renderWithFragment,Ut=Le.children;Le.viewClassName,Le.style;var lr=Le.condition,Ar=Se(Le,["renderWithFragment","children","viewClassName","style","condition"]);return lr?We?E.createElement(C.Fragment,null,Ut):E.createElement("div",Ar,Ut):null};function Pi(ut){return function(Le){he(We,Le);function We(Ut){var lr;return le(this,We),lr=be(this,me(We).call(this,Ut)),lr.isEventListenerAdded=!1,lr.handleOrientationChange=lr.handleOrientationChange.bind(Ce(lr)),lr.onOrientationChange=lr.onOrientationChange.bind(Ce(lr)),lr.onPageLoad=lr.onPageLoad.bind(Ce(lr)),lr.state={isLandscape:!1,isPortrait:!1},lr}return de(We,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var lr=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:lr===0,isLandscape:lr===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":oe(window))!==void 0&&Ai&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return E.createElement(ut,pe({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),We}(E.Component)}function Io(){var ut=C.useState(function(){var Ar=window.innerWidth>window.innerHeight?90:0;return{isPortrait:Ar===0,isLandscape:Ar===90,orientation:Ar===0?"portrait":"landscape"}}),Le=Ee(ut,2),We=Le[0],Ut=Le[1],lr=C.useCallback(function(){var Ar=window.innerWidth>window.innerHeight?90:0,Ir={isPortrait:Ar===0,isLandscape:Ar===90,orientation:Ar===0?"portrait":"landscape"};We.orientation!==Ir.orientation&&Ut(Ir)},[We.orientation]);return C.useEffect(function(){return(typeof window>"u"?"undefined":oe(window))!==void 0&&Ai&&(lr(),window.addEventListener("load",lr,!1),window.addEventListener("resize",lr,!1)),function(){window.removeEventListener("resize",lr,!1),window.removeEventListener("load",lr,!1)}},[lr]),We}function cn(ut){var Le=ut||window.navigator.userAgent;return te(Le)}function Vi(ut){var Le=ut||window.navigator.userAgent,We=cn(Le),Ut=_i(We);return[Ut,We]}return lib.AndroidView=ko,lib.BrowserTypes=Pe,lib.BrowserView=ia,lib.ConsoleView=Mo,lib.CustomView=bn,lib.IEView=na,lib.IOSView=Vn,lib.MobileOnlyView=ln,lib.MobileView=Ao,lib.OsTypes=$e,lib.SmartTVView=hs,lib.TabletView=Po,lib.WearableView=fs,lib.WinPhoneView=an,lib.browserName=wo,lib.browserVersion=Eo,lib.deviceDetect=er,lib.deviceType=Fn,lib.engineName=yi,lib.engineVersion=ss,lib.fullBrowserVersion=rn,lib.getSelectorsByUserAgent=ps,lib.getUA=ea,lib.isAndroid=Yi,lib.isBrowser=xo,lib.isChrome=is,lib.isChromium=Fi,lib.isConsole=Kr,lib.isDesktop=Ji,lib.isEdge=Ln,lib.isEdgeChromium=nn,lib.isElectron=To,lib.isEmbedded=ai,lib.isFirefox=Zs,lib.isIE=Ei,lib.isIOS=So,lib.isIOS13=ta,lib.isIPad13=xi,lib.isIPhone13=Ro,lib.isIPod13=ls,lib.isLegacyEdge=cs,lib.isMIUI=ra,lib.isMacOs=sn,lib.isMobile=Ai,lib.isMobileOnly=Zr,lib.isMobileSafari=ii,lib.isOpera=jn,lib.isSafari=Bn,lib.isSamsungBrowser=ds,lib.isSmartTV=Fr,lib.isTablet=yo,lib.isWearable=Ur,lib.isWinPhone=rs,lib.isWindows=us,lib.isYandex=as,lib.mobileModel=os,lib.mobileVendor=Qs,lib.osName=ns,lib.osVersion=Co,lib.parseUserAgent=te,lib.setUserAgent=Ne,lib.useDeviceData=cn,lib.useDeviceSelectors=Vi,lib.useMobileOrientation=Io,lib.withOrientationChange=Pi,lib}var libExports=requireLib();const AppRootProvider=({children:x})=>{const{t:C}=useTranslation(),E=reactExports.useCallback((oe,le)=>{y.info(le,{type:oe,position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})},[]),[w,T]=reactExports.useState(!0),_=useAudioConfig({createAudioContextDelay:libExports.isMobile?2e3:0}),S=useAppGuiSetting(),R=reactExports.useMemo(()=>({flatPath:!1,triggerToast:E}),[E]),A=useServerConfig(R),[O,H]=reactExports.useState("App"),[ee,te]=reactExports.useState(null),ie=window.location.origin;reactExports.useEffect(()=>{const fe=new URL(window.location.href).searchParams.get("app_mode")||null;fe=="Test"?H("Test"):fe=="LogViewer"?H("LogViewer"):fe=="JsonViewer"?H("JsonViewer"):H("App")},[]),reactExports.useEffect(()=>{if(A.serverConfiguration==null)return;const oe=A.serverConfiguration.current_slot_index,le=A.serverSlotInfos.find(fe=>fe.slot_index===oe);te(le??null)},[A.serverConfiguration,A.serverSlotInfos]);const ne=reactExports.useCallback(oe=>{const le=oe.reason;log$1("error","Unhandled Rejection",le),log$1("error","Unhandled Rejection",C("common.error_messages.unhandled_rejection_possible_cause")),log$1("error","Unhandled Rejection EVENT",oe),oe.preventDefault()},[C]);reactExports.useEffect(()=>(window.addEventListener("unhandledrejection",ne),()=>{window.removeEventListener("unhandledrejection",ne)}),[w,ne]);const ae={..._,...S,...A,appMode:O,currentSlotInfo:ee,setAppMode:H,origin:ie,triggerToast:E,setUnhandledRejectionToastEnabled:T};return jsxRuntimeExports.jsx(AppRootContext.Provider,{value:ae,children:x})},codeFilename=import.meta.url.split("/").pop(),logPrefix=`[${codeFilename}]`,useVoiceChangerClient=x=>{const{t:C}=useTranslation(),E=x.triggerToast,{currentSlotInfo:w,reloadLocalVoiceChangerInterfaceInfo:T}=useAppRoot(),_=reactExports.useMemo(()=>new VoiceChangerClient,[]),[S,R]=reactExports.useState(!1),[A,O]=reactExports.useState([]),[H,ee]=reactExports.useState(!1),te=reactExports.useRef(null);reactExports.useEffect(()=>{x.ctx!=null&&(log$1("info",logPrefix,"initializing client..... only one called.."),_.initialize(x.ctx,!1),_.setVoiceChangerExceptionListener({onException:(he,me)=>{log$1("error",logPrefix,`onException: ${he} ${me}`),he=="LOCAL_VOICE_CHANGER_INTERFACE_RUN_ERROR_SOUNDDEVICE"?(E("error",C("common.error_messages.server_device_init_failed_sounddevice")),T()):he=="LOCAL_VOICE_CHANGER_INTERFACE_RUN_ERROR_MODEL"&&(E("error",C("common.error_messages.server_device_init_failed_model")),T())}}))},[x.ctx,_,T,E,C]),reactExports.useEffect(()=>{if(!_)return;(async()=>{await _.isInitialized(),R(!0)})()},[_]),reactExports.useEffect(()=>{if(!S)return;log$1("info",logPrefix,"inputAudioType",x.globaSetting.inputAudioType),log$1("info",logPrefix,"inputAudio",x.globaSetting.inputAudio);const me=_.getClientSetting().voiceChangerClientSetting;(x.globaSetting.inputAudioType==="microphone"&&typeof x.globaSetting.inputAudio=="string"||x.globaSetting.inputAudioType==="file"&&x.globaSetting.inputAudio instanceof MediaStream||x.globaSetting.inputAudioType==="capture"&&x.globaSetting.inputAudio instanceof MediaStream||x.globaSetting.inputAudioType==="sample"&&x.globaSetting.inputAudio instanceof MediaStream)&&(me.audioInput=x.globaSetting.inputAudio),me.inputGain=x.globaSetting.nodeInputGain,me.outputGain=x.globaSetting.nodeOutputGain,me.monitorGain=x.globaSetting.nodeMonitorGain,me.echoCancel=x.globaSetting.enableEchoCancellation,me.noiseSuppression=x.globaSetting.enableNoiseSuppression,me.noiseSuppression2=x.globaSetting.enableNoiseSuppression2,console.log("clientSetting",me),_.updateClientSetting({...me})},[_,S,x.globaSetting.inputAudioType,x.globaSetting.inputAudio,x.globaSetting.nodeInputGain,x.globaSetting.nodeOutputGain,x.globaSetting.nodeMonitorGain,x.globaSetting.enableEchoCancellation,x.globaSetting.enableNoiseSuppression,x.globaSetting.enableNoiseSuppression2]),reactExports.useEffect(()=>{(async()=>{if(!S)return;if(x.globaSetting.outputAudioElementId==null){console.warn("[voiceChangerClient] audioOutputElementId not set for audio output.");return}const me=document.getElementById(x.globaSetting.outputAudioElementId);if(!me){console.warn("[voiceChangerClient] audioOutputElementId not set for audio output.");return}if(x.globaSetting.outputAudio=="none"){console.warn("[voiceChangerClient] audioOutputDevice not set for audio output."),me.volume=0,me.muted=!0;return}if(!(await navigator.mediaDevices.enumerateDevices()).filter(Ce=>Ce.kind=="audiooutput").some(Ce=>Ce.deviceId==x.globaSetting.outputAudio)){console.warn(`[voiceChangerClient] audioOutputDevice ${x.globaSetting.outputAudio} not found.`),me.volume=0,me.muted=!0;return}me.srcObject=null,me.srcObject=_.stream;try{await me.setSinkId(x.globaSetting.outputAudio)}catch(Ce){console.log("setSinkId is not supported?",Ce),E("error",C("common.error_messages.set_sink_id_not_supported",{error:Ce}))}me.volume=1,me.paused&&me.play()})()},[_,S,x.globaSetting.outputAudioElementId,x.globaSetting.outputAudio,E,C]),reactExports.useEffect(()=>{(async()=>{if(!S)return;if(x.globaSetting.monitorAudioElementId==null){console.warn("[voiceChangerClient] audioMonitorElementId not set for audio monitor.");return}const me=document.getElementById(x.globaSetting.monitorAudioElementId);if(!me){console.warn("[voiceChangerClient] audioMonitorElementId not set for audio monitor.");return}if(x.globaSetting.monitorAudio=="none"){console.warn("[voiceChangerClient] audioMonitorDevice not set for audio monitor."),me.volume=0,me.muted=!0;return}if(!(await navigator.mediaDevices.enumerateDevices()).filter(Ce=>Ce.kind=="audiooutput").some(Ce=>Ce.deviceId==x.globaSetting.monitorAudio)){console.warn(`[voiceChangerClient] audioMonitorDevice ${x.globaSetting.monitorAudio} not found.`),me.volume=0,me.muted=!0;return}me.srcObject=null,me.srcObject=_.monitorStream;try{await me.setSinkId(x.globaSetting.monitorAudio)}catch(Ce){console.log("setSinkId is not supported?",Ce),E("error",C("common.error_messages.set_sink_id_not_supported",{error:Ce}))}me.volume=1,me.paused&&me.play()})()},[_,S,x.globaSetting.monitorAudioElementId,x.globaSetting.monitorAudio,E,C]),reactExports.useEffect(()=>{(async()=>{if(S)if(x.globaSetting.isOutputRecording==!0)_.startOutputRecording();else{const me=await _.stopOutputRecording();if(me.length>0){const ve=generateTimestamp();downloadAsWav(me,`output_client_${ve}.wav`)}}})()},[_,S,x.globaSetting.isOutputRecording]),reactExports.useEffect(()=>{(async()=>{S&&(x.globaSetting.isStarted==!0?_.start():_.stop())})()},[_,S,x.globaSetting.isStarted]),reactExports.useEffect(()=>{(async()=>{if(!S||!w?.voice_changer_type)return;const ve=_.getClientSetting().workletNodeSetting;let ye="bulk";w.voice_changer_type==VoiceChangerType.RVC,ye="bulk",ve.protocol=x.globaSetting.protocol,ve.sendingMode=ye,await _.updateNodeSetting({...ve}),await _.resetBuffer()})()},[_,S,x.globaSetting.protocol,w?.voice_changer_type]),reactExports.useEffect(()=>{if(!_||!S)return;const me=_.getClientSetting().workletSetting;me.realtimeOutputStatusEnabled=x.globaSetting.realtimeOutputStatusEnabled,me.realtimeOutputStatusSendIntervalSec=x.globaSetting.realtimeOutputStatusSendIntervalSec,me.isPassthroughEnabled=x.globaSetting.isPassthrough,me.sendingChunkSec=w?.chunk_sec??.2,_.updateWorkletSetting(me)},[_,S,x.globaSetting.isPassthrough,x.globaSetting.realtimeOutputStatusEnabled,x.globaSetting.realtimeOutputStatusSendIntervalSec,w?.chunk_sec]),reactExports.useEffect(()=>{S&&_.resetBuffer()},[_,S,w?.chunk_sec]),reactExports.useEffect(()=>{if(!S||!H)return;const he=setInterval(async()=>{try{const me=await _.getOutputBufferSize(),ve=Date.now();O(ye=>[...ye,{timestamp:ve,size:me}].slice(-100))}catch(me){console.error("Failed to get output buffer size:",me)}},100);return()=>clearInterval(he)},[S,H,_]);const ie=()=>A.length>0?A[A.length-1].size:null,ne=()=>{O([])},ae=he=>{ee(he),he||O([])},oe=()=>_.getPendingRequestCount(),le=()=>{_.abortAllRequests()},fe=he=>{te.current=he},de=()=>{_.resetBuffer()},ce=reactExports.useCallback(he=>{_.setVoiceChangerStatusListener(he)},[_]);return{isClientInitialized:S,outputBufferSizeHistory:A,outputBufferSizeMonitoringEnabled:H,getLatestOutputBufferSize:ie,clearOutputBufferSizeHistory:ne,setOutputBufferSizeMonitoringEnabled:ae,getPendingRequestCount:oe,abortAllRequests:le,setOutputBufferSizeCallback:fe,resetOutputBuffer:de,setVoiceChangerStatusListener:ce}},AppStateProvider=({children:x})=>{const{audioContext:C,triggerToast:E}=useAppRoot(),w=useGlobalSetting(),T=useVoiceChangerClient({globaSetting:w,ctx:C,triggerToast:E});reactExports.useEffect(()=>(console.log("AppStateProvider mounted"),()=>{console.log("AppStateProvider unmounted")}),[]);const _={...w,...T};return jsxRuntimeExports.jsx(AppStateContext.Provider,{value:_,children:x})};var TauriEvent;(function(x){x.WINDOW_RESIZED="tauri://resize",x.WINDOW_MOVED="tauri://move",x.WINDOW_CLOSE_REQUESTED="tauri://close-requested",x.WINDOW_DESTROYED="tauri://destroyed",x.WINDOW_FOCUS="tauri://focus",x.WINDOW_BLUR="tauri://blur",x.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",x.WINDOW_THEME_CHANGED="tauri://theme-changed",x.WINDOW_CREATED="tauri://window-created",x.WEBVIEW_CREATED="tauri://webview-created",x.DRAG_ENTER="tauri://drag-enter",x.DRAG_OVER="tauri://drag-over",x.DRAG_DROP="tauri://drag-drop",x.DRAG_LEAVE="tauri://drag-leave"})(TauriEvent||(TauriEvent={}));async function _unlisten(x,C){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(x,C),await invoke("plugin:event|unlisten",{event:x,eventId:C})}async function listen(x,C,E){var w;const T=(w=void 0)!==null&&w!==void 0?w:{kind:"Any"};return invoke("plugin:event|listen",{event:x,target:T,handler:transformCallback(C)}).then(_=>async()=>_unlisten(x,_))}const useHotKeySetting=()=>{const{t:x}=useTranslation(),[C,E]=reactExports.useState(null),[w,T]=reactExports.useState(null),{serverConfiguration:_,localVoiceChangerInterfaceInfo:S,startServerDevice:R,stopServerDevice:A,updateServerConfiguration:O,serverSlotInfos:H,currentSlotInfo:ee,updateServerSlotInfo:te,origin:ie}=useAppRoot(),{isStarted:ne,isPassthrough:ae,setIsStarted:oe,setIsPassthrough:le,setNodeInputGain:fe,nodeInputGain:de,setNodeOutputGain:ce,nodeOutputGain:pe,setNodeMonitorGain:he,nodeMonitorGain:me}=useAppState(),ve=_.voice_changer_input_mode===VoiceChangerInputMode.server,ye=!!S?.local_voice_changer_interface_active,Se=ve?ye:ne,Ce=ve?_.pass_through:ae,be=reactExports.useCallback(async()=>{if(ve){if(_.audio_input_device_index===-1||_.audio_output_device_index===-1)return;await R()}else oe(!0)},[ve,_.audio_input_device_index,_.audio_output_device_index,R,oe]),Ee=reactExports.useCallback(async()=>{ve?await A():oe(!1)},[ve,A,oe]),Ae=reactExports.useCallback(async()=>{ve?await O({..._,pass_through:!0}):le(!0)},[ve,O,le,_]),Ie=reactExports.useCallback(async()=>{ve?await O({..._,pass_through:!1}):le(!1)},[ve,O,le,_]),Te=reactExports.useCallback(async Ne=>{const Oe=ve?_.audio_input_device_gain:de,Ve=Math.min(Math.max(Oe+Ne,0),10);return ve?await O({..._,audio_input_device_gain:Ve}):fe(Ve),Ve},[ve,_,O,fe,de]),De=reactExports.useCallback(async Ne=>{const Oe=ve?_.audio_output_device_gain:pe,Ve=Math.min(Math.max(Oe+Ne,0),10);return ve?await O({..._,audio_output_device_gain:Ve}):ce(Ve),Ve},[ve,_,O,ce,pe]),Ue=reactExports.useCallback(async Ne=>{const Oe=ve?_.audio_monitor_device_gain:me,Ve=Math.min(Math.max(Oe+Ne,0),10);return ve?await O({..._,audio_monitor_device_gain:Ve}):he(Ve),Ve},[ve,_,O,he,me]),ze=async()=>{try{const Ne=await invoke("get_shortcut_settings");console.log(x("common.shortcut_settings.config_load_success"),Ne),E(Ne),T(null)}catch(Ne){T(`${x("common.shortcut_settings.config_load_failed")} ${Ne}`),console.error(x("common.shortcut_settings.settings_load_error"),Ne)}},Pe=async Ne=>{try{await invoke("update_shortcut_settings",{configDto:Ne}),await invoke("register_shortcuts"),E(Ne),T(null),console.log(x("common.shortcut_settings.config_save_success"))}catch(Oe){T(`${x("common.shortcut_settings.config_save_failed")} ${Oe}`),console.error(x("common.shortcut_settings.settings_save_error"),Oe)}},$e=(Ne,Oe)=>{if(!C||!Oe.trim())return null;const Ve=C.shortcuts.find(Ht=>Ht.shortcut===Oe&&Ht.action!==Ne);return Ve?x("common.shortcut_settings.duplicate_key_error",{shortcut:Oe,displayName:Ve.display_name}):null},He=async(Ne,Oe)=>{if(!C)return;const Ve=C.shortcuts.map(Kt=>Kt.action===Ne?{...Kt,shortcut:Oe}:Kt),Ht={...C,shortcuts:Ve};await Pe(Ht)},je=async Ne=>{if(!C)return;const Oe={...C,enabled:Ne};await Pe(Oe)};return reactExports.useEffect(()=>{ze()},[]),reactExports.useEffect(()=>{const Ne=(ir,$t)=>{const tr=H.find(Sr=>Sr.slot_index===ir)||null;if(tr==null||tr.voice_changer_type!=="Beatrice_v2")return null;const ar=tr,gr=ar.model_info.voice[$t],sr=ar.toml_file.replace(/\\\\/g,"/").replace(/\\/g,"/");return sr.substring(0,sr.lastIndexOf("/"))+"/"+gr.portrait.path.split(/[/\\]/).pop()},Oe=ir=>{const $t=H.find(tr=>tr.slot_index===ir)||null;return $t==null?null:$t.voice_changer_type==="RVC"?$t.icon_file!=null?"model_dir/"+$t.slot_index+"/"+$t.icon_file.split(/[/\\]/).pop():"./assets/icons/human.png":$t.voice_changer_type==="Beatrice_v2"?Ne(ir,$t.dst_id):null},Ve={title:x("common.shortcut_settings.vcclient_notification"),message:"operation",icon_url:ie+"/"+Oe(_.current_slot_index)||"./assets/icons/human.png",slot_id:_.current_slot_index,started:Se,passthrough:Ce,input_gain:ve?_.audio_input_device_gain:de,output_gain:ve?_.audio_output_device_gain:pe,monitor_gain:ve?_.audio_monitor_device_gain:me,model_name:ee?.name||x("common.shortcut_settings.unknown_model")},Kt=(async()=>{const ir=await listen("shortcut-action",async $t=>{console.log("🎯 shortcut-action イベント受信:",$t);const{action:tr,volumeType:ar,delta:gr}=$t.payload;switch(Ve.title=x("common.shortcut_settings.vcclient_notification"),tr){case"ShowStatus":{console.log(x("common.shortcut_settings.show_status_action")),Ve.message=x("common.shortcut_settings.status");break}case"NextSlot":{const er=H.filter(hr=>hr.voice_changer_type!==null).map(hr=>hr.slot_index).sort((hr,yr)=>hr-yr);if(er.length<=1){Ve.message=x("common.shortcut_settings.slot_change_skip");break}const sr=_.current_slot_index,pr=er.findIndex(hr=>hr===sr);let ur;pr===-1||pr===er.length-1?ur=er[0]:ur=er[pr+1],await O({..._,current_slot_index:ur}),Ve.message=x("common.shortcut_settings.slot_changed_to_next",{from:sr,to:ur}),Ve.slot_id=ur,Ve.icon_url=ie+"/"+Oe(ur)||"./assets/icons/human.png";const Sr=H.find(hr=>hr.slot_index===ur);Ve.model_name=Sr?.name||x("common.shortcut_settings.unknown_model"),console.log(x("common.shortcut_settings.slot_changed_log",{from:sr,to:ur}));break}case"PreviousSlot":{console.log(x("common.shortcut_settings.previous_slot_action"));const er=H.filter(hr=>hr.voice_changer_type!==null).map(hr=>hr.slot_index).sort((hr,yr)=>hr-yr);if(er.length<=1){Ve.message=x("common.shortcut_settings.slot_change_skip");break}const sr=_.current_slot_index,pr=er.findIndex(hr=>hr===sr);let ur;pr===-1||pr===0?ur=er[er.length-1]:ur=er[pr-1],await O({..._,current_slot_index:ur}),Ve.message=x("common.shortcut_settings.slot_changed_to_previous",{from:sr,to:ur}),Ve.slot_id=ur,Ve.icon_url=ie+"/"+Oe(ur)||"./assets/icons/human.png";const Sr=H.find(hr=>hr.slot_index===ur);Ve.model_name=Sr?.name||x("common.shortcut_settings.unknown_model"),console.log(x("common.shortcut_settings.slot_changed_log",{from:sr,to:ur}));break}case"ToggleVoiceConversion":try{Se?(await Ee(),Ve.message=x("common.shortcut_settings.voice_conversion_stopped"),Ve.started=!1):(await be(),Ve.message=x("common.shortcut_settings.voice_conversion_started"),Ve.started=!0)}catch(er){console.error(x("common.shortcut_settings.notification_window_error"),er)}break;case"TogglePassthrough":try{Ce?(await Ie(),Ve.message=x("common.shortcut_settings.passthrough_disabled"),Ve.passthrough=!1):(await Ae(),Ve.message=x("common.shortcut_settings.passthrough_enabled"),Ve.passthrough=!0)}catch(er){console.error(x("common.shortcut_settings.notification_window_error"),er)}break;case"VolumeChange":if(!gr)return;if(ar==="input"){const er=await Te(gr),sr=Math.round(er*10)/10;Ve.input_gain=sr,Ve.message=x("common.shortcut_settings.input_volume_changed",{volume:sr})}else if(ar==="output"){const er=await De(gr),sr=Math.round(er*10)/10;Ve.output_gain=sr,Ve.message=x("common.shortcut_settings.output_volume_changed",{volume:sr})}else if(ar==="monitor"){const er=await Ue(gr),sr=Math.round(er*10)/10;Ve.monitor_gain=sr,Ve.message=x("common.shortcut_settings.monitor_volume_changed",{volume:sr})}break;case"NextSpeaker":if(ee?.voice_changer_type==="Beatrice_v2"){const er=ee,sr=Object.keys(er.model_info.voice).length,pr=(er.dst_id+1)%sr;er.dst_id=pr,await te(er);const ur=er.model_info.voice[pr];Ve.message=x("common.shortcut_settings.next_speaker",{speaker:ur.name})}else ee?.voice_changer_type==="RVC"&&console.warn("RVCは話者切り替えに対応していません");break;case"PreviousSpeaker":if(ee?.voice_changer_type==="Beatrice_v2"){const er=ee,sr=Object.keys(er.model_info.voice).length,pr=(er.dst_id-1+sr)%sr;er.dst_id=pr,await te(er);const ur=er.model_info.voice[pr];Ve.message=x("common.shortcut_settings.previous_speaker",{speaker:ur.name})}else ee?.voice_changer_type==="RVC"&&console.warn("RVCは話者切り替えに対応していません");break;default:Ve.message=x("common.shortcut_settings.unknown_shortcut_action",{action:tr});break}console.log(x("common.shortcut_settings.notification_payload_log"),Ve),await invoke("show_notification_window_with_message",{params:Ve})});return()=>{ir()}})();return()=>{Kt.then(ir=>ir())}},[ie,Se,Ce,be,Ee,Ae,Ie,Te,De,Ue,_,H,O,ee,ve,de,me,pe,te,x]),{config:C,updateShortcut:He,setShorcutEnabled:je,checkDuplicationKey:$e,hotKeySettingError:w}},HotkeyProvider=({children:x})=>{const E={...useHotKeySetting()};return jsxRuntimeExports.jsx(HotkeyContext.Provider,{value:E,children:x})};clientExports.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(AppRootProvider,{children:jsxRuntimeExports.jsx(AppStateProvider,{children:jsxRuntimeExports.jsx(HotkeyProvider,{children:jsxRuntimeExports.jsx(App,{})})})})}));export{commonjsGlobal$1 as c,getDefaultExportFromCjs as g};
