PageSourceSearch

https://voxbbridge-demo-production.up.railway.app/assets/index-ClMybNsZ.js

js voxbbridge-demo-production.up.railway.app collected 2026-10-03 12:14:49 UTC 2,028,670 bytes, 737 lines download raw bytes

vendor: 7,509 bytes, lines 1-17
1var Vq=Object.defineProperty;var zq=(e,t,n)=>t in e?Vq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rs=(e,t,n)=>zq(e,typeof t!="symbol"?t+"":t,n);function qq(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function g4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Lf={};/**
2 * @license React
3 * react-jsx-runtime.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var a_;function Wq(){if(a_)return Lf;a_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,s){var l=null;if(s!==void 0&&(l=""+s),r.key!==void 0&&(l=""+r.key),"key"in r){s={};for(var c in r)c!=="key"&&(s[c]=r[c])}else s=r;return r=s.ref,{$$typeof:e,type:i,key:l,ref:r!==void 0?r:null,props:s}}return Lf.Fragment=t,Lf.jsx=n,Lf.jsxs=n,Lf}var o_;function Hq(){return o_||(o_=1,bw.exports=Wq()),bw.exports}var a=Hq(),ww={exports:{}},gt={};/**
10 * @license React
11 * react.production.js
12 *
13 * Copyright (c) Meta Platforms, Inc. and affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var l_;function Kq(){if(l_)return gt;l_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function x(L){return L===null||typeof L!="object"?null:(L=v&&L[v]||L["@@iterator"],typeof L=="function"?L:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,N={};function j(L,J,ye){this.props=L,this.context=J,this.refs=N,this.updater=ye||b}j.prototype.isReactComponent={},j.prototype.setState=function(L,J){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,J,"setState")},j.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function T(){}T.prototype=j.prototype;function E(L,J,ye){this.props=L,this.context=J,this.refs=N,this.updater=ye||b}var C=E.prototype=new T;C.constructor=E,S(C,j.prototype),C.isPureReactComponent=!0;var P=Array.isArray;function A(){}var M={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function B(L,J,ye){var Pe=ye.ref;return{$$typeof:e,type:L,key:J,ref:Pe!==void 0?Pe:null,props:ye}}function U(L,J){return B(L.type,J,L.props)}function O(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function F(L){var J={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(ye){return J[ye]})}var ne=/\/+/g;function re(L,J){return typeof L=="object"&&L!==null&&L.key!=null?F(""+L.key):J.toString(36)}function Q(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(A,A):(L.status="pending",L.then(function(J){L.status==="pending"&&(L.status="fulfilled",L.value=J)},function(J){L.status==="pending"&&(L.status="rejected",L.reason=J)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function W(L,J,ye,Pe,Oe){var je=typeof L;(je==="undefined"||je==="boolean")&&(L=null);var Ke=!1;if(L===null)Ke=!0;else switch(je){case"bigint":case"string":case"number":Ke=!0;break;case"object":switch(L.$$typeof){case e:case t:Ke=!0;break;case f:return Ke=L._init,W(Ke(L._payload),J,ye,Pe,Oe)}}if(Ke)return Oe=Oe(L),Ke=Pe===""?"."+re(L,0):Pe,P(Oe)?(ye="",Ke!=null&&(ye=Ke.replace(ne,"$&/")+"/"),W(Oe,J,ye,"",function(Be){return Be})):Oe!=null&&(O(Oe)&&(Oe=U(Oe,ye+(Oe.key==null||L&&L.key===Oe.key?"":(""+Oe.key).replace(ne,"$&/")+"/")+Ke)),J.push(Oe)),1;Ke=0;var ve=Pe===""?".":Pe+":";if(P(L))for(var le=0;le<L.length;le++)Pe=L[le],je=ve+re(Pe,le),Ke+=W(Pe,J,ye,je,Oe);else if(le=x(L),typeof le=="function")for(L=le.call(L),le=0;!(Pe=L.next()).done;)Pe=Pe.value,je=ve+re(Pe,le++),Ke+=W(Pe,J,ye,je,Oe);else if(je==="object"){if(typeof L.then=="function")return W(Q(L),J,ye,Pe,Oe);throw J=String(L),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return Ke}function q(L,J,ye){if(L==null)return L;var Pe=[],Oe=0;return W(L,Pe,"","",function(je){return J.call(ye,je,Oe++)}),Pe}function $(L){if(L._status===-1){var J=L._result;J=J(),J.then(function(ye){(L._status===0||L._status===-1)&&(L._status=1,L._result=ye)},function(ye){(L._status===0||L._status===-1)&&(L._status=2,L._result=ye)}),L._status===-1&&(L._status=0,L._result=J)}if(L._status===1)return L._result.default;throw L._result}var ge=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},ue={map:q,forEach:function(L,J,ye){q(L,function(){J.apply(this,arguments)},ye)},count:function(L){var J=0;return q(L,function(){J++}),J},toArray:function(L){return q(L,function(J){return J})||[]},only:function(L){if(!O(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return gt.Activity=p,gt.Children=ue,gt.Component=j,gt.Fragment=n,gt.Profiler=r,gt.PureComponent=E,gt.StrictMode=i,gt.Suspense=h,gt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,gt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return M.H.useMemoCache(L)}},gt.cache=function(L){return function(){return L.apply(null,arguments)}},gt.cacheSignal=function(){return null},gt.cloneElement=function(L,J,ye){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var Pe=S({},L.props),Oe=L.key;if(J!=null)for(je in J.key!==void 0&&(Oe=""+J.key),J)!R.call(J,je)||je==="
vendor: 11,701 bytes, lines 17-41
17key"||je==="__self"||je==="__source"||je==="ref"&&J.ref===void 0||(Pe[je]=J[je]);var je=arguments.length-2;if(je===1)Pe.children=ye;else if(1<je){for(var Ke=Array(je),ve=0;ve<je;ve++)Ke[ve]=arguments[ve+2];Pe.children=Ke}return B(L.type,Oe,Pe)},gt.createContext=function(L){return L={$$typeof:l,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:s,_context:L},L},gt.createElement=function(L,J,ye){var Pe,Oe={},je=null;if(J!=null)for(Pe in J.key!==void 0&&(je=""+J.key),J)R.call(J,Pe)&&Pe!=="key"&&Pe!=="__self"&&Pe!=="__source"&&(Oe[Pe]=J[Pe]);var Ke=arguments.length-2;if(Ke===1)Oe.children=ye;else if(1<Ke){for(var ve=Array(Ke),le=0;le<Ke;le++)ve[le]=arguments[le+2];Oe.children=ve}if(L&&L.defaultProps)for(Pe in Ke=L.defaultProps,Ke)Oe[Pe]===void 0&&(Oe[Pe]=Ke[Pe]);return B(L,je,Oe)},gt.createRef=function(){return{current:null}},gt.forwardRef=function(L){return{$$typeof:c,render:L}},gt.isValidElement=O,gt.lazy=function(L){return{$$typeof:f,_payload:{_status:-1,_result:L},_init:$}},gt.memo=function(L,J){return{$$typeof:d,type:L,compare:J===void 0?null:J}},gt.startTransition=function(L){var J=M.T,ye={};M.T=ye;try{var Pe=L(),Oe=M.S;Oe!==null&&Oe(ye,Pe),typeof Pe=="object"&&Pe!==null&&typeof Pe.then=="function"&&Pe.then(A,ge)}catch(je){ge(je)}finally{J!==null&&ye.types!==null&&(J.types=ye.types),M.T=J}},gt.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},gt.use=function(L){return M.H.use(L)},gt.useActionState=function(L,J,ye){return M.H.useActionState(L,J,ye)},gt.useCallback=function(L,J){return M.H.useCallback(L,J)},gt.useContext=function(L){return M.H.useContext(L)},gt.useDebugValue=function(){},gt.useDeferredValue=function(L,J){return M.H.useDeferredValue(L,J)},gt.useEffect=function(L,J){return M.H.useEffect(L,J)},gt.useEffectEvent=function(L){return M.H.useEffectEvent(L)},gt.useId=function(){return M.H.useId()},gt.useImperativeHandle=function(L,J,ye){return M.H.useImperativeHandle(L,J,ye)},gt.useInsertionEffect=function(L,J){return M.H.useInsertionEffect(L,J)},gt.useLayoutEffect=function(L,J){return M.H.useLayoutEffect(L,J)},gt.useMemo=function(L,J){return M.H.useMemo(L,J)},gt.useOptimistic=function(L,J){return M.H.useOptimistic(L,J)},gt.useReducer=function(L,J,ye){return M.H.useReducer(L,J,ye)},gt.useRef=function(L){return M.H.useRef(L)},gt.useState=function(L){return M.H.useState(L)},gt.useSyncExternalStore=function(L,J,ye){return M.H.useSyncExternalStore(L,J,ye)},gt.useTransition=function(){return M.H.useTransition()},gt.version="19.2.7",gt}var c_;function Ph(){return c_||(c_=1,ww.exports=Kq()),ww.exports}var w=Ph();const he=g4(w),Gq=qq({__proto__:null,default:he},[w]);var Sw={exports:{}},Uf={},kw={exports:{}},Nw={};/**
18 * @license React
19 * scheduler.production.js
20 *
21 * Copyright (c) Meta Platforms, Inc. and affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var u_;function Yq(){return u_||(u_=1,(function(e){function t(W,q){var $=W.length;W.push(q);e:for(;0<$;){var ge=$-1>>>1,ue=W[ge];if(0<r(ue,q))W[ge]=q,W[$]=ue,$=ge;else break e}}function n(W){return W.length===0?null:W[0]}function i(W){if(W.length===0)return null;var q=W[0],$=W.pop();if($!==q){W[0]=$;e:for(var ge=0,ue=W.length,L=ue>>>1;ge<L;){var J=2*(ge+1)-1,ye=W[J],Pe=J+1,Oe=W[Pe];if(0>r(ye,$))Pe<ue&&0>r(Oe,ye)?(W[ge]=Oe,W[Pe]=$,ge=Pe):(W[ge]=ye,W[J]=$,ge=J);else if(Pe<ue&&0>r(Oe,$))W[ge]=Oe,W[Pe]=$,ge=Pe;else break e}}return q}function r(W,q){var $=W.sortIndex-q.sortIndex;return $!==0?$:W.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var h=[],d=[],f=1,p=null,v=3,x=!1,b=!1,S=!1,N=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(W){for(var q=n(d);q!==null;){if(q.callback===null)i(d);else if(q.startTime<=W)i(d),q.sortIndex=q.expirationTime,t(h,q);else break;q=n(d)}}function P(W){if(S=!1,C(W),!b)if(n(h)!==null)b=!0,A||(A=!0,F());else{var q=n(d);q!==null&&Q(P,q.startTime-W)}}var A=!1,M=-1,R=5,B=-1;function U(){return N?!0:!(e.unstable_now()-B<R)}function O(){if(N=!1,A){var W=e.unstable_now();B=W;var q=!0;try{e:{b=!1,S&&(S=!1,T(M),M=-1),x=!0;var $=v;try{t:{for(C(W),p=n(h);p!==null&&!(p.expirationTime>W&&U());){var ge=p.callback;if(typeof ge=="function"){p.callback=null,v=p.priorityLevel;var ue=ge(p.expirationTime<=W);if(W=e.unstable_now(),typeof ue=="function"){p.callback=ue,C(W),q=!0;break t}p===n(h)&&i(h),C(W)}else i(h);p=n(h)}if(p!==null)q=!0;else{var L=n(d);L!==null&&Q(P,L.startTime-W),q=!1}}break e}finally{p=null,v=$,x=!1}q=void 0}}finally{q?F():A=!1}}}var F;if(typeof E=="function")F=function(){E(O)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=O,F=function(){re.postMessage(null)}}else F=function(){j(O,0)};function Q(W,q){M=j(function(){W(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(W){W.callback=null},e.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<W?Math.floor(1e3/W):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(W){switch(v){case 1:case 2:case 3:var q=3;break;default:q=v}var $=v;v=q;try{return W()}finally{v=$}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(W,q){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var $=v;v=W;try{return q()}finally{v=$}},e.unstable_scheduleCallback=function(W,q,$){var ge=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ge+$:ge):$=ge,W){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=$+ue,W={id:f++,callback:q,priorityLevel:W,startTime:$,expirationTime:ue,sortIndex:-1},$>ge?(W.sortIndex=$,t(d,W),n(h)===null&&W===n(d)&&(S?(T(M),M=-1):S=!0,Q(P,$-ge))):(W.sortIndex=ue,t(h,W),b||x||(b=!0,A||(A=!0,F()))),W},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(W){var q=v;return function(){var $=v;v=q;try{return W.apply(this,arguments)}finally{v=$}}}})(Nw)),Nw}var d_;function Qq(){return d_||(d_=1,kw.exports=Yq()),kw.exports}var jw={exports:{}},gr={};/**
26 * @license React
27 * react-dom.production.js
28 *
29 * Copyright (c) Meta Platforms, Inc. and affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var h_;function Xq(){if(h_)return gr;h_=1;var e=Ph();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)d+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function s(h,d,f){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:p==null?null:""+p,children:h,containerInfo:d,implementation:f}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,gr.createPortal=function(h,d){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return s(h,d,null,f)},gr.flushSync=function(h){var d=l.T,f=i.p;try{if(l.T=null,i.p=2,h)return h()}finally{l.T=d,i.p=f,i.d.f()}},gr.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(h,d))},gr.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},gr.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var f=d.as,p=c(f,d.crossOrigin),v=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;f==="style"?i.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:v,fetchPriority:x}):f==="script"&&i.d.X(h,{crossOrigin:p,integrity:v,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},gr.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var f=c(d.as,d.crossOrigin);i.d.M(h,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(h)},gr.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var f=d.as,p=c(f,d.crossOrigin);i.d.L(h,f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},gr.preloadModule=function(h,d){if(typeof h=="string")if(d){var f=c(d.as,d.crossOrigin);i.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(h)},gr.requestFormReset=function(h){i.d.r(h)},gr.unstable_batchedUpdates=function(h,d){return h(d)},gr.useFormState=function(h,d,f){return l.H.useFormState(h,d,f)},gr.useFormStatus=function(){return l.H.useHostTransitionStatus()},gr.version="19.2.7",gr}var f_;function v4(){if(f_)return jw.exports;f_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),jw.exports=Xq(),jw.exports}/**
34 * @license React
35 * react-dom-client.production.js
36 *
37 * Copyright (c) Meta Platforms, Inc. and affiliates.
38 *
39 * This source code is licensed under the MIT license found in the
40 * LICENSE file in the root directory of this source tree.
41 */var m_;function Jq(){if(m_)return Uf;m_=1;var e=Qq(),t=Ph(),n=v4();function i(o){var u="https://react.dev/errors/"+o;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)u+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+o+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var u=o,m=o;if(o.alternate)for(;u.return;)u=u.return;else{o=u;do u=o,(u.flags&4098)!==0&&(m=u.return),o=u.return;while(o)}return u.tag===3?m:null}function l(o){if(o.tag===13){var u=o.memoizedState;if(u===null&&(o=o.alternate,o!==null&&(u=o.memoizedState)),u!==null)return u.dehydrated}return null}function c(o){if(o.tag===31){var u=o.memoizedState;if(u===null&&(o=o.alternate,o!==null&&(u=o.memoizedState)),u!==null)return u.dehydrated}return null}
vendor: 13,333 bytes, lines 41-48
41function h(o){if(s(o)!==o)throw Error(i(188))}function d(o){var u=o.alternate;if(!u){if(u=s(o),u===null)throw Error(i(188));return u!==o?null:o}for(var m=o,g=u;;){var y=m.return;if(y===null)break;var k=y.alternate;if(k===null){if(g=y.return,g!==null){m=g;continue}break}if(y.child===k.child){for(k=y.child;k;){if(k===m)return h(y),o;if(k===g)return h(y),u;k=k.sibling}throw Error(i(188))}if(m.return!==g.return)m=y,g=k;else{for(var _=!1,D=y.child;D;){if(D===m){_=!0,m=y,g=k;break}if(D===g){_=!0,g=y,m=k;break}D=D.sibling}if(!_){for(D=k.child;D;){if(D===m){_=!0,m=k,g=y;break}if(D===g){_=!0,g=k,m=y;break}D=D.sibling}if(!_)throw Error(i(189))}}if(m.alternate!==g)throw Error(i(190))}if(m.tag!==3)throw Error(i(188));return m.stateNode.current===m?o:u}function f(o){var u=o.tag;if(u===5||u===26||u===27||u===6)return o;for(o=o.child;o!==null;){if(u=f(o),u!==null)return u;o=o.sibling}return null}var p=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),E=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),O=Symbol.iterator;function F(o){return o===null||typeof o!="object"?null:(o=O&&o[O]||o["@@iterator"],typeof o=="function"?o:null)}var ne=Symbol.for("react.client.reference");function re(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===ne?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case S:return"Fragment";case j:return"Profiler";case N:return"StrictMode";case P:return"Suspense";case A:return"SuspenseList";case B:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case b:return"Portal";case E:return o.displayName||"Context";case T:return(o._context.displayName||"Context")+".Consumer";case C:var u=o.render;return o=o.displayName,o||(o=u.displayName||u.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return u=o.displayName||null,u!==null?u:re(o.type)||"Memo";case R:u=o._payload,o=o._init;try{return re(o(u))}catch{}}return null}var Q=Array.isArray,W=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},ge=[],ue=-1;function L(o){return{current:o}}function J(o){0>ue||(o.current=ge[ue],ge[ue]=null,ue--)}function ye(o,u){ue++,ge[ue]=o.current,o.current=u}var Pe=L(null),Oe=L(null),je=L(null),Ke=L(null);function ve(o,u){switch(ye(je,u),ye(Oe,o),ye(Pe,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?AP(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=AP(u),o=PP(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}J(Pe),ye(Pe,o)}function le(){J(Pe),J(Oe),J(je)}function Be(o){o.memoizedState!==null&&ye(Ke,o);var u=Pe.current,m=PP(u,o.type);u!==m&&(ye(Oe,o),ye(Pe,m))}function De(o){Oe.current===o&&(J(Pe),J(Oe)),Ke.current===o&&(J(Ke),Rf._currentValue=$)}var be,nt;function ze(o){if(be===void 0)try{throw Error()}catch(m){var u=m.stack.trim().match(/\n( *(at )?)/);be=u&&u[1]||"",nt=-1<m.stack.indexOf(`
42    at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
43`+be+o+nt}var Le=!1;function ht(o,u){if(!o||Le)return"";Le=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(u){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(xe){var fe=xe}Reflect.construct(o,[],Ne)}else{try{Ne.call()}catch(xe){fe=xe}o.call(Ne.prototype)}}else{try{throw Error()}catch(xe){fe=xe}(Ne=o())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(xe){if(xe&&fe&&typeof xe.stack=="string")return[xe.stack,fe.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=g.DetermineComponentFrameRoot(),_=k[0],D=k[1];if(_&&D){var Y=_.split(`
44`),de=D.split(`
45`);for(y=g=0;g<Y.length&&!Y[g].includes("DetermineComponentFrameRoot");)g++;for(;y<de.length&&!de[y].includes("DetermineComponentFrameRoot");)y++;if(g===Y.length||y===de.length)for(g=Y.length-1,y=de.length-1;1<=g&&0<=y&&Y[g]!==de[y];)y--;for(;1<=g&&0<=y;g--,y--)if(Y[g]!==de[y]){if(g!==1||y!==1)do if(g--,y--,0>y||Y[g]!==de[y]){var Se=`
46`+Y[g].replace(" at new "," at ");return o.displayName&&Se.includes("<anonymous>")&&(Se=Se.replace("<anonymous>",o.displayName)),Se}while(1<=g&&0<=y);break}}}finally{Le=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?ze(m):""}function yt(o,u){switch(o.tag){case 26:case 27:case 5:return ze(o.type);case 16:return ze("Lazy");case 13:return o.child!==u&&u!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return ht(o.type,!1);case 11:return ht(o.type.render,!1);case 1:return ht(o.type,!0);case 31:return ze("Activity");default:return""}}function on(o){try{var u="",m=null;do u+=yt(o,m),m=o,o=o.return;while(o);return u}catch(g){return`
47Error generating stack: `+g.message+`
48`+g.stack}}var bt=Object.prototype.hasOwnProperty,Vt=e.unstable_scheduleCallback,tn=e.unstable_cancelCallback,Qt=e.unstable_shouldYield,Cn=e.unstable_requestPaint,pt=e.unstable_now,kn=e.unstable_getCurrentPriorityLevel,Lt=e.unstable_ImmediatePriority,On=e.unstable_UserBlockingPriority,zt=e.unstable_NormalPriority,si=e.unstable_LowPriority,qn=e.unstable_IdlePriority,qt=e.log,ai=e.unstable_setDisableYieldValue,Zn=null,ct=null;function ln(o){if(typeof qt=="function"&&ai(o),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(Zn,o)}catch{}}var Ut=Math.clz32?Math.clz32:nn,Wn=Math.log,_i=Math.LN2;function nn(o){return o>>>=0,o===0?32:31-(Wn(o)/_i|0)|0}var Bt=256,Dt=262144,K=4194304;function Ze(o){var u=o&42;if(u!==0)return u;switch(o&-o){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:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ft(o,u,m){var g=o.pendingLanes;if(g===0)return 0;var y=0,k=o.suspendedLanes,_=o.pingedLanes;o=o.warmLanes;var D=g&134217727;return D!==0?(g=D&~k,g!==0?y=Ze(g):(_&=D,_!==0?y=Ze(_):m||(m=D&~o,m!==0&&(y=Ze(m))))):(D=g&~k,D!==0?y=Ze(D):_!==0?y=Ze(_):m||(m=g&~o,m!==0&&(y=Ze(m)))),y===0?0:u!==0&&u!==y&&(u&k)===0&&(k=y&-y,m=u&-u,k>=m||k===32&&(m&4194048)!==0)?u:y}function jt(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function oi(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+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 u+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 Gi(){var o=K;return K<<=1,(K&62914560)===0&&(K=4194304),o}function fr(o){for(var u=[],m=0;31>m;m++)u.push(o);return u}function Yi(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function In(o,u,m,g,y,k){var _=o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var D=o.entanglements,Y=o.expirationTimes,de=o.hiddenUpdates;for(m=_&~m;0<m;){var Se=31-Ut(m),Ne=1<<Se;D[Se]=0,Y[Se]=-1;var fe=de[Se];if(fe!==null)for(de[Se]=null,Se=0;Se<fe.length;Se++){var xe=fe[Se];xe!==null&&(xe.lane&=-536870913)}m&=~Ne}g!==0&&Mi(o,g,0),k!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=k&~(_&~u))}function Mi(o,u,m){o.pendingLanes|=u,o.suspendedLanes&=~u;var g=31-Ut(u);o.entangledLanes|=u,o.entanglements[g]=o.entanglements[g]|1073741824|m&261930}function Ur(o,u){var m=o.entangledLanes|=u;for(o=o.entanglements;m;){var g=31-Ut(m),y=1<<g;y&u|o[g]&u&&(o[g]|=u),m&=~y}}function $n(o,u){var m=u&-u;return m=(m&42)!==0?1:li(m),(m&(o.suspendedLanes|u))!==0?0:m}function li(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function ci(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function ot(){var o=q.p;return o!==0?o:(o=window.event,o===void 0?32:ZP(o.type))}function Wt(o,u){var m=q.p;try{return q.p=o,u()}finally{q.p=m}}var Jt=Math.random().toString(36).slice(2),$t="__reactFiber$"+Jt,te="__reactProps$"+Jt,Fe="__reactContainer$"+Jt,dt="__reactEvents$"+Jt,He="__reactListeners$"+Jt,H="__reactHandles$"+Jt,se="__reactResources$"+Jt,G="__reactMarker$"+Jt;function V(o){delete o[$t],delete o[te],delete o[dt],delete o[He],delete o[H]}function ie(o){var u=o[$t];if(u)return u;for(var m=o.parentNode;m;){if(u=m[Fe]||m[$t]){if(m=u.alternate,u.child!==null||m!==null&&m.child!==null)for(o=LP(o);o!==null;){if(m=o[$t])return m;o=LP(o)}return u}o=m,m=o.parentNode}return null}function Z(o){if(o=o[$t]||o[Fe]){var u=o.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return o}return null}function Te(o){var u=o.tag;if(u===5||u===26||u===27||u===6)return o.stateNode;throw Error(i(33))}function we(o){var u=o[se];return u||(u=o[se]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function X(o){o[G]=!0}var Ee=new Set,qe={};function Nt(o,u){mt(o,u),mt(o+"Capture",u)}function mt(o,u){for(qe[o]=u,o=0;o<u.length;o++)Ee.add(u[o])}var Ie=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]*$"),Nn={},kr={};function ks(o){return bt.call(kr,o)?!0:bt.call(Nn,o)?!1:Ie.test(o)?kr[o]=!0:(Nn[o]=!0,!1)}function Br(o,u,m){if(ks(u))if(m===null)o.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":o.removeAttribute(u);return;case"boolean":var g=u.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){o.removeAttribute(u);return}}o.setAttribute(u,""+m)}}function is(o,u,m){if(m===null)o.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttribute(u,""+m)}}function Fr(o,u,m,g){if(g===null)o.removeAttribute(m);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(m);return}o.setAttributeNS(u,m,""+g)}}function mr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function ft(o){var u=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Ri(o,u,m){var g=Object.getOwnPropertyDescriptor(o.constructor.prototype,u);if(!o.hasOwnProperty(u)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var y=g.get,k=g.set;return Object.defineProperty(o,u,{configurable:!0,get:function(){return y.call(this)},set:function(_){m=""+_,k.call(this,_)}}),Object.defineProperty(o,u,{enumerable:g.enumerable}),{getValue:function(){return m},setValue:function(_){m=""+_},stopTracking:function(){o._valueTracker=null,delete o[u]}}}}function Hh(o){if(!o._valueTracker){var u=ft(o)?"checked":"value";o._valueTracker=Ri(o,u,""+o[u])}}function Fp(o){if(!o)return!1;var u=o._valueTracker;if(!u)return!0;var m=u.getValue(),g="";return o&&(g=ft(o)?o.checked?"true":"false":o.value),o=g,o!==m?(u.setValue(o),!0):!1}function bc(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var wb=/[\n"\\]/g;function $r(o){return o.replace(wb,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function qu(o,u,m,g,y,k,_,D){o.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?o.type=_:o.removeAttribute("type"),u!=null?_==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+mr(u)):o.value!==""+mr(u)&&(o.value=""+mr(u)):_!=="submit"&&_!=="reset"||o.removeAttribute("value"),u!=null?Kh(o,_,mr(u)):m!=null?Kh(o,_,mr(m)):g!=null&&o.removeAttribute("value"),y==null&&k!=null&&(o.defaultChecked=!!k),y!=null&&(o.checked=y&&t
vendor: 5,690 bytes, line 48
48ypeof y!="function"&&typeof y!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?o.name=""+mr(D):o.removeAttribute("name")}function $p(o,u,m,g,y,k,_,D){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(o.type=k),u!=null||m!=null){if(!(k!=="submit"&&k!=="reset"||u!=null)){Hh(o);return}m=m!=null?""+mr(m):"",u=u!=null?""+mr(u):m,D||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=D?o.checked:!!g,o.defaultChecked=!!g,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(o.name=_),Hh(o)}function Kh(o,u,m){u==="number"&&bc(o.ownerDocument)===o||o.defaultValue===""+m||(o.defaultValue=""+m)}function hl(o,u,m,g){if(o=o.options,u){u={};for(var y=0;y<m.length;y++)u["$"+m[y]]=!0;for(m=0;m<o.length;m++)y=u.hasOwnProperty("$"+o[m].value),o[m].selected!==y&&(o[m].selected=y),y&&g&&(o[m].defaultSelected=!0)}else{for(m=""+mr(m),u=null,y=0;y<o.length;y++){if(o[y].value===m){o[y].selected=!0,g&&(o[y].defaultSelected=!0);return}u!==null||o[y].disabled||(u=o[y])}u!==null&&(u.selected=!0)}}function Vp(o,u,m){if(u!=null&&(u=""+mr(u),u!==o.value&&(o.value=u),m==null)){o.defaultValue!==u&&(o.defaultValue=u);return}o.defaultValue=m!=null?""+mr(m):""}function zp(o,u,m,g){if(u==null){if(g!=null){if(m!=null)throw Error(i(92));if(Q(g)){if(1<g.length)throw Error(i(93));g=g[0]}m=g}m==null&&(m=""),u=m}m=mr(u),o.defaultValue=m,g=o.textContent,g===m&&g!==""&&g!==null&&(o.value=g),Hh(o)}function fl(o,u){if(u){var m=o.firstChild;if(m&&m===o.lastChild&&m.nodeType===3){m.nodeValue=u;return}}o.textContent=u}var qp=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 Gh(o,u,m){var g=u.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?g?o.setProperty(u,""):u==="float"?o.cssFloat="":o[u]="":g?o.setProperty(u,m):typeof m!="number"||m===0||qp.has(u)?u==="float"?o.cssFloat=m:o[u]=(""+m).trim():o[u]=m+"px"}function Yh(o,u,m){if(u!=null&&typeof u!="object")throw Error(i(62));if(o=o.style,m!=null){for(var g in m)!m.hasOwnProperty(g)||u!=null&&u.hasOwnProperty(g)||(g.indexOf("--")===0?o.setProperty(g,""):g==="float"?o.cssFloat="":o[g]="");for(var y in u)g=u[y],u.hasOwnProperty(y)&&m[y]!==g&&Gh(o,y,g)}else for(var k in u)u.hasOwnProperty(k)&&Gh(o,k,u[k])}function Wu(o){if(o.indexOf("-")===-1)return!1;switch(o){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 Wp=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
48-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"]]),Hp=/^[\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 wc(o){return Hp.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Ns(){}var Hu=null;function Ku(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var fo=null,mo=null;function Qh(o){var u=Z(o);if(u&&(o=u.stateNode)){var m=o[te]||null;e:switch(o=u.stateNode,u.type){case"input":if(qu(o,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),u=m.name,m.type==="radio"&&u!=null){for(m=o;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+$r(""+u)+'"][type="radio"]'),u=0;u<m.length;u++){var g=m[u];if(g!==o&&g.form===o.form){var y=g[te]||null;if(!y)throw Error(i(90));qu(g,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(u=0;u<m.length;u++)g=m[u],g.form===o.form&&Fp(g)}break e;case"textarea":Vp(o,m.value,m.defaultValue);break e;case"select":u=m.value,u!=null&&hl(o,!!m.multiple,u,!1)}}}var Gu=!1;function Xh(o,u,m){if(Gu)return o(u,m);Gu=!0;try{var g=o(u);return g}finally{if(Gu=!1,(fo!==null||mo!==null)&&(Pg(),fo&&(u=fo,o=mo,mo=fo=null,Qh(u),o)))for(u=0;u<o.length;u++)Qh(o[u])}}function ml(o,u){var m=o.stateNode;if(m===null)return null;var g=m[te]||null;if(g===null)return null;m=g[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(m&&typeof m!="function")throw Error(i(231,u,typeof m));return m}var I=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$e=!1;if(I)try{var lt={};Object.defineProperty(lt,"passive",{get:function(){$e=!0}}),window.addEventListener("test",lt,lt),window.removeEventListener("test",lt,lt)}catch{$e=!1}var ei=null,jn=null,Tn=null;function Aa(){if(Tn)return Tn;var o,u=jn,m=u.length,g,y="value"in ei?ei.value:ei.textContent,k=y.length;for(o=0;o<m&&u[o]===y[o];o++);var _=m-o;for(g=1;g<=_&&u[m-g]===y[k-g];g++);return Tn=y.slice(o,1<g?1-g:void 0)}function Zt(o){var u=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&u===13&&(o=13)):o=u,o===10&&(o=13),32<=o||o===13?o:0}function Si(){return!0}function Sc(){return!1}function pr(o){function u(m,g,y,k,_){this._reactName=m,this._targetInst=y,this.type=g,this.nativeEvent=k,this.target=_,this.currentTarget=null;for(var D in o)o.hasOwnProperty(D)&&(m=o[D],this[D]=m?m(k):k[D]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Si:Sc,this.isPropagationStopped=Sc,this}return p(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=Si)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=Si)},persist:function(){},isPersistent:Si}),u}var ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yu=pr(ti),kc=p({},ti,{view:0,detail:0}),Kp=pr(kc),Sb,kb,Jh,Gp=p({},kc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jb,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Jh&&(Jh&&o.type==="mousemove"?(Sb=o.screenX-Jh.screenX,kb=o.screenY-Jh.screenY):kb=Sb=0,Jh=o),Sb)},movementY:function(o){return"movementY"in o?o.movementY:kb}}),M2=pr(Gp),$z=p({},Gp,{dataTransfer:0}),Vz=pr($z),zz=p({},kc,{relatedTarget:0}),Nb=pr(zz),qz=p({},ti,{animationName:0,elapsedTime:0,pseudoElement:0}),Wz=pr(qz),Hz=p({},ti,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Kz=pr(Hz),Gz=p({},ti,{data:0}),R2=pr(Gz),Yz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qz={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"},Xz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Jz(o){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(o):(o=Xz[o])?!!u[o]:!1}function jb(){return Jz}var Zz=p({}
vendor: 5,097 bytes, line 48
48,kc,{key:function(o){if(o.key){var u=Yz[o.key]||o.key;if(u!=="Unidentified")return u}return o.type==="keypress"?(o=Zt(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Qz[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jb,charCode:function(o){return o.type==="keypress"?Zt(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Zt(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),e7=pr(Zz),t7=p({},Gp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),O2=pr(t7),n7=p({},kc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jb}),i7=pr(n7),r7=p({},ti,{propertyName:0,elapsedTime:0,pseudoElement:0}),s7=pr(r7),a7=p({},Gp,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),o7=pr(a7),l7=p({},ti,{newState:0,oldState:0}),c7=pr(l7),u7=[9,13,27,32],Cb=I&&"CompositionEvent"in window,Zh=null;I&&"documentMode"in document&&(Zh=document.documentMode);var d7=I&&"TextEvent"in window&&!Zh,I2=I&&(!Cb||Zh&&8<Zh&&11>=Zh),D2=" ",L2=!1;function U2(o,u){switch(o){case"keyup":return u7.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function B2(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Qu=!1;function h7(o,u){switch(o){case"compositionend":return B2(u);case"keypress":return u.which!==32?null:(L2=!0,D2);case"textInput":return o=u.data,o===D2&&L2?null:o;default:return null}}function f7(o,u){if(Qu)return o==="compositionend"||!Cb&&U2(o,u)?(o=Aa(),Tn=jn=ei=null,Qu=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return I2&&u.locale!=="ko"?null:u.data;default:return null}}var m7={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 F2(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u==="input"?!!m7[o.type]:u==="textarea"}function $2(o,u,m,g){fo?mo?mo.push(g):mo=[g]:fo=g,u=Lg(u,"onChange"),0<u.length&&(m=new Yu("onChange","change",null,m,g),o.push({event:m,listeners:u}))}var ef=null,tf=null;function p7(o){kP(o,0)}function Yp(o){var u=Te(o);if(Fp(u))return o}function V2(o,u){if(o==="change")return u}var z2=!1;if(I){var Tb;if(I){var Eb="oninput"in document;if(!Eb){var q2=document.createElement("div");q2.setAttribute("oninput","return;"),Eb=typeof q2.oninput=="function"}Tb=Eb}else Tb=!1;z2=Tb&&(!document.documentMode||9<document.documentMode)}function W2(){ef&&(ef.detachEvent("onpropertychange",H2),tf=ef=null)}function H2(o){if(o.propertyName==="value"&&Yp(tf)){var u=[];$2(u,tf,o,Ku(o)),Xh(p7,u)}}function g7(o,u,m){o==="focusin"?(W2(),ef=u,tf=m,ef.attachEvent("onpropertychange",H2)):o==="focusout"&&W2()}function v7(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Yp(tf)}function x7(o,u){if(o==="click")return Yp(u)}function y7(o,u){if(o==="input"||o==="change")return Yp(u)}function b7(o,u){return o===u&&(o!==0||1/o===1/u)||o!==o&&u!==u}var rs=typeof Object.is=="function"?Object.is:b7;function nf(o,u){if(rs(o,u))return!0;if(typeof o!="object"||o===null||typeof u!="object"||u===null)return!1;var m=Object.keys(o),g=Object.keys(u);if(m.length!==g.length)return!1;for(g=0;g<m.length;g++){var y=m[g];if(!bt.call(u,y)||!rs(o[y],u[y]))return!1}return!0}function K2(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function G2(o,u){var m=K2(o);o=0;for(var g;m;){if(m.nodeType===3){if(g=o+m.textContent.length,o<=u&&g>=u)return{node:m,offset:u-o};o=g}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=K2(m)}}function Y2(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y2(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function Q2(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=bc(o.document);u instanceof o.HTMLIFrameElement;){try{var m=typeof u.contentWindow.location.href=="string"}catch{m=!1}if(m)o=u.contentWindow;else break;u=bc(o.document)}return u}function Ab(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var w7=I&&"documentMode"in document&&11>=document.documentMode,Xu=null,Pb=null,rf=null,_b=!1;function X2(o,u,m){var g=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;_b||Xu==null||Xu!==bc(g)||(g=Xu,"selectionStart"in g&&Ab(g)?g={start:g.
vendor: 22,479 bytes, line 48
48selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),rf&&nf(rf,g)||(rf=g,g=Lg(Pb,"onSelect"),0<g.length&&(u=new Yu("onSelect","select",null,u,m),o.push({event:u,listeners:g}),u.target=Xu)))}function Nc(o,u){var m={};return m[o.toLowerCase()]=u.toLowerCase(),m["Webkit"+o]="webkit"+u,m["Moz"+o]="moz"+u,m}var Ju={animationend:Nc("Animation","AnimationEnd"),animationiteration:Nc("Animation","AnimationIteration"),animationstart:Nc("Animation","AnimationStart"),transitionrun:Nc("Transition","TransitionRun"),transitionstart:Nc("Transition","TransitionStart"),transitioncancel:Nc("Transition","TransitionCancel"),transitionend:Nc("Transition","TransitionEnd")},Mb={},J2={};I&&(J2=document.createElement("div").style,"AnimationEvent"in window||(delete Ju.animationend.animation,delete Ju.animationiteration.animation,delete Ju.animationstart.animation),"TransitionEvent"in window||delete Ju.transitionend.transition);function jc(o){if(Mb[o])return Mb[o];if(!Ju[o])return o;var u=Ju[o],m;for(m in u)if(u.hasOwnProperty(m)&&m in J2)return Mb[o]=u[m];return o}var Z2=jc("animationend"),eE=jc("animationiteration"),tE=jc("animationstart"),S7=jc("transitionrun"),k7=jc("transitionstart"),N7=jc("transitioncancel"),nE=jc("transitionend"),iE=new Map,Rb="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(" ");Rb.push("scrollEnd");function Js(o,u){iE.set(o,u),Nt(u,[o])}var Qp=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},js=[],Zu=0,Ob=0;function Xp(){for(var o=Zu,u=Ob=Zu=0;u<o;){var m=js[u];js[u++]=null;var g=js[u];js[u++]=null;var y=js[u];js[u++]=null;var k=js[u];if(js[u++]=null,g!==null&&y!==null){var _=g.pending;_===null?y.next=y:(y.next=_.next,_.next=y),g.pending=y}k!==0&&rE(m,y,k)}}function Jp(o,u,m,g){js[Zu++]=o,js[Zu++]=u,js[Zu++]=m,js[Zu++]=g,Ob|=g,o.lanes|=g,o=o.alternate,o!==null&&(o.lanes|=g)}function Ib(o,u,m,g){return Jp(o,u,m,g),Zp(o)}function Cc(o,u){return Jp(o,null,null,u),Zp(o)}function rE(o,u,m){o.lanes|=m;var g=o.alternate;g!==null&&(g.lanes|=m);for(var y=!1,k=o.return;k!==null;)k.childLanes|=m,g=k.alternate,g!==null&&(g.childLanes|=m),k.tag===22&&(o=k.stateNode,o===null||o._visibility&1||(y=!0)),o=k,k=k.return;return o.tag===3?(k=o.stateNode,y&&u!==null&&(y=31-Ut(m),o=k.hiddenUpdates,g=o[y],g===null?o[y]=[u]:g.push(u),u.lane=m|536870912),k):null}function Zp(o){if(50<Cf)throw Cf=0,q1=null,Error(i(185));for(var u=o.return;u!==null;)o=u,u=o.return;return o.tag===3?o.stateNode:null}var ed={};function j7(o,u,m,g){this.tag=o,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ss(o,u,m,g){return new j7(o,u,m,g)}function Db(o){return o=o.prototype,!(!o||!o.isReactComponent)}function po(o,u){var m=o.alternate;return m===null?(m=ss(o.tag,u,o.key,o.mode),m.elementType=o.elementType,m.type=o.type,m.stateNode=o.stateNode,m.alternate=o,o.alternate=m):(m.pendingProps=u,m.type=o.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=o.flags&65011712,m.childLanes=o.childLanes,m.lanes=o.lanes,m.child=o.child,m.memoizedProps=o.memoizedProps,m.memoizedState=o.memoizedState,m.updateQueue=o.updateQueue,u=o.dependencies,m.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},m.sibling=o.sibling,m.index=o.index,m.ref=o.ref,m.refCleanup=o.refCleanup,m}function sE(o,u){o.flags&=65011714;var m=o.alternate;return m===null?(o.childLanes=0,o.lanes=u,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=m.childLanes,o.lanes=m.lanes,o.child=m.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=m.memoizedProps,o.memoizedState=m.memoizedState,o.updateQueue=m.updateQueue,o.type=m.type,u=m.dependencies,o.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),o}function eg(o,u,m,g,y,k){var _=0;if(g=o,typeof o=="function")Db(o)&&(_=1);else if(typeof o=="string")_=Pq(o,m,Pe.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case B:return o=ss(31,m,u,y),o.elementType=B,o.lanes=k,o;case S:return Tc(m.children,y,k,u);case N:_=8,y|=24;break;case j:return o=ss(12,m,u,y|2),o.elementType=j,o.lanes=k,o;case P:return o=ss(13,m,u,y),o.elementType=P,o.lanes=k,o;case A:return o=ss(19,m,u,y),o.elementType=A,o.lanes=k,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case E:_=10;break e;case T:_=9;break e;case C:_=11;break e;case M:_=14;break e;case R:_=16,g=null;break e}_=29,m=Error(i(130,o===null?"null":typeof o,"")),g=null}return u=ss(_,m,u,y),u.elementType=o,u.type=g,u.lanes=k,u}function Tc(o,u,m,g){return o=ss(7,o,g,u),o.lanes=m,o}function Lb(o,u,m){return o=ss(6,o,null,u),o.lanes=m,o}function aE(o){var u=ss(18,null,null,0);return u.stateNode=o,u}function Ub(o,u,m){return u=ss(4,o.children!==null?o.children:[],o.key,u),u.lanes=m,u.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},u}var oE=new WeakMap;function Cs(o,u){if(typeof o=="object"&&o!==null){var m=oE.get(o);return m!==void 0?m:(u={value:o,source:u,stack:on(u)},oE.set(o,u),u)}return{value:o,source:u,stack:on(u)}}var td=[],nd=0,tg=null,sf=0,Ts=[],Es=0,pl=null,Pa=1,_a="";function go(o,u){td[nd++]=sf,td[nd++]=tg,tg=o,sf=u}function lE(o,u,m){Ts[Es++]=Pa,Ts[Es++]=_a,Ts[Es++]=pl,pl=o;var g=Pa;o=_a;var y=32-Ut(g)-1;g&=~(1<<y),m+=1;var k=32-Ut(u)+y;if(30<k){var _=y-y%5;k=(g&(1<<_)-1).toString(32),g>>=_,y-=_,Pa=1<<32-Ut(u)+y|m<<y|g,_a=k+o}else Pa=1<<k|m<<y|g,_a=o}function Bb(o){o.return!==null&&(go(o,1),lE(o,1,0))}function Fb(o){for(;o===tg;)tg=td[--nd],td[nd]=null,sf=td[--nd],td[nd]=null;for(;o===pl;)pl=Ts[--Es],Ts[Es]=null,_a=Ts[--Es],Ts[Es]=null,Pa=Ts[--Es],Ts[Es]=null}function cE(o,u){Ts[Es++]=Pa,Ts[Es++]=_a,Ts[Es++]=pl,Pa=u.id,_a=u.overflow,pl=o}var Qi=null,En=null,Rt=!1,gl=null,As=!1,$b=Error(i(519));function vl(o){var u=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw af(Cs(u,o)),$b}function uE(o){var u=o.stateNode,m=o.type,g=o.memoizedProps;switch(u[$t]=o,u[te]=g,m){case"dialog":Et("cancel",u),Et("close",u);break;case"iframe":case"object":case"embed":Et("load",u);break;case"video":case"audio":for(m=0;m<Ef.length;m++)Et(Ef[m],u);break;case"source":Et("error",u);break;case"img":case"image":case"link":Et("error",u),Et("load",u);break;case"details":Et("toggle",u);break;case"input":Et("invalid",u),$p(u,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Et("invalid",u);break;case"textarea":Et("invalid",u),zp(u,g.value,g.defaultValue,g.children)}m=g.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||u.textContent===""+m||g.suppressHydrationWarning===!0||TP(u.textContent,m)?(g.popover!=null&&(Et("beforetoggle",u),Et("toggle",u)),g.onScroll!=null&&Et("scroll",u),g.onScrollEnd!=null&&Et("scrollend",u),g.onClick!=null&&(u.onclick=Ns),u=!0):u=!1,u||vl(o,!0)}function dE(o){for(Qi=o.return;Qi;)switch(Qi.tag){case 5:case 31:case 13:As=!1;return;case 27:case 3:As=!0;return;default:Qi=Qi.return}}function id(o){if(o!==Qi)return!1;if(!Rt)return dE(o),Rt=!0,!1;var u=o.tag,m;if((m=u!==3&&u!==27)&&((m=u===5)&&(m=o.type,m=!(m!=="form"&&m!=="button")||sw(o.type,o.memoizedProps)),m=!m),m&&En&&vl(o),dE(o),u===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));En=DP(o)}else if(u===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));En=DP(o)}else u===27?(u=En,_l(o.type)?(o=uw,uw=null,En=o):En=u):En=Qi?_s(o.stateNode.nextSibling):null;return!0}function Ec(){En=Qi=null,Rt=!1}function Vb(){var o=gl;return o!==null&&(Wr===null?Wr=o:Wr.push.apply(Wr,o),gl=null),o}function af(o){gl===null?gl=[o]:gl.push(o)}var zb=L(null),Ac=null,vo=null;function xl(o,u,m){ye(zb,u._currentValue),u._currentValue=m}function xo(o){o._currentValue=zb.current,J(zb)}function qb(o,u,m){for(;o!==null;){var g=o.alternate;if((o.childLanes&u)!==u?(o.childLanes|=u,g!==null&&(g.childLanes|=u)):g!==null&&(g.childLanes&u)!==u&&(g.childLanes|=u),o===m)break;o=o.return}}function Wb(o,u,m,g){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var k=y.dependencies;if(k!==null){var _=y.child;k=k.firstContext;e:for(;k!==null;){var D=k;k=y;for(var Y=0;Y<u.length;Y++)if(D.context===u[Y]){k.lanes|=m,D=k.alternate,D!==null&&(D.lanes|=m),qb(k.return,m,o),g||(_=null);break e}k=D.next}}else if(y.tag===18){if(_=y.return,_===null)throw Error(i(341));_.lanes|=m,k=_.alternate,k!==null&&(k.lanes|=m),qb(_,m,o),_=null}else _=y.child;if(_!==null)_.return=y;else for(_=y;_!==null;){if(_===o){_=null;break}if(y=_.sibling,y!==null){y.return=_.return,_=y;break}_=_.return}y=_}}function rd(o,u,m,g){o=null;for(var y=u,k=!1;y!==null;){if(!k){if((y.flags&524288)!==0)k=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var _=y.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var D=y.type;rs(y.pendingProps.value,_.value)||(o!==null?o.push(D):o=[D])}}else if(y===Ke.current){if(_=y.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Rf):o=[Rf])}y=y.return}o!==null&&Wb(u,o,m,g),u.flags|=262144}function ng(o){for(o=o.firstContext;o!==null;){if(!rs(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Pc(o){Ac=o,vo=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Xi(o){return hE(Ac,o)}function ig(o,u){return Ac===null&&Pc(o),hE(o,u)}function hE(o,u){var m=u._currentValue;if(u={context:u,memoizedValue:m,next:null},vo===null){if(o===null)throw Error(i(308));vo=u,o.dependencies={lanes:0,firstContext:u},o.flags|=524288}else vo=vo.next=u;return m}var C7=typeof AbortController<"u"?AbortController:function(){var o=[],u=this.signal={aborted:!1,addEventListener:function(m,g){o.push(g)}};this.abort=function(){u.aborted=!0,o.forEach(function(m){return m()})}},T7=e.unstable_scheduleCallback,E7=e.unstable_NormalPriority,ui={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hb(){return{controller:new C7,data:new Map,refCount:0}}function of(o){o.refCount--,o.refCount===0&&T7(E7,function(){o.controller.abort()})}var lf=null,Kb=0,sd=0,ad=null;function A7(o,u){if(lf===null){var m=lf=[];Kb=0,sd=Q1(),ad={status:"pending",value:void 0,then:function(g){m.push(g)}}}return Kb++,u.then(fE,fE),u}function fE(){if(--Kb===0&&lf!==null){ad!==null&&(ad.status="fulfilled");var o=lf;lf=null,sd=0,ad=null;for(var u=0;u<o.length;u++)(0,o[u])()}}function P7(o,u){var m=[],g={status:"pending",value:null,reason:null,then:function(y){m.push(y)}};return o.then(function(){g.status="fulfilled",g.value=u;for(var y=0;y<m.length;y++)(0,m[y])(u)},function(y){for(g.status="rejected",g.reason=y,y=0;y<m.length;y++)(0,m[y])(void 0)}),g}var mE=W.S;W.S=function(o,u){XA=pt(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&A7(o,u),mE!==null&&mE(o,u)};var _c=L(null);function Gb(){var o=_c.current;return o!==null?o:mn.pooledCache}function rg(o,u){u===null?ye(_c,_c.current):ye(_c,u.pool)}function pE(){var o=Gb();return o===null?null:{parent:ui._currentValue,pool:o}}var od=Error(i(460)),Yb=Error(i(474)),sg=Error(i(542)),ag={then:function(){}};function gE(o){return o=o.status,o==="fulfilled"||o==="rejected"}function vE(o,u,m){switch(m=o[m],m===void 0?o.push(u):m!==u&&(u.then(Ns,Ns),u=m),u.status){case"fulfilled":return u.value;case"rejected":throw o=u.reason,yE(o),o;default:if(typeof u.status=="string")u.then(Ns,Ns);else{if(o=mn,o!==null&&100<o.shellSuspendCounter)throw Error(i(482));o=u,o.status="pending",o.then(function(g){if(u.status==="pending"){var y=u;y.status="fulfilled",y.value=g}},function(g){if(u.status==="pending"){var y=u;y.status="rejected",y.reason=g}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw o=u.reason,yE(o),o}throw Rc=u,od}}function Mc(o){try{var u=o._init;return u(o._payload)}catch(m){throw m!==null&&typeof m=="object"&&typeof m.then=="function"?(Rc=m,od):m}}var Rc=null;function xE(){if(Rc===null)throw Error(i(459));var o=Rc;return Rc=null,o}function yE(o){if(o===od||o===sg)throw Error(i(483))}var ld=null,cf=0;function og(o){var u=cf;return cf+=1,ld===null&&(ld=[]),vE(ld,o,u)}function uf(o,u){u=u.props.ref,o.ref=u!==void 0?u:null}function lg(o,u){throw u.$$typeof===v?Error(i(525)):(o=Object.prototype.toString.call(u),Error(i(31,o==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":o)))}function bE(o){function u(ae,ee){if(o){var ce=ae.deletions;ce===null?(ae.deletions=[ee],ae.flags|=16):ce.push(ee)}}function m(ae,ee){if(!o)return null;for(;ee!==null;)u(ae,ee),ee=ee.sibling;return null}function g(ae){for(var ee=new Map;ae!==null;)ae.key!==null?ee.set(ae.key,ae):ee.set(ae.index,ae),ae=ae.sibling;return ee}function y(ae,ee){return ae=po(ae,ee),ae.index=0,ae.sibling=null,ae}function k(ae,ee,ce){return ae.index=ce,o?(ce=ae.alternate,ce!==null?(ce=ce.index,ce<ee?(ae.flags|=67108866,ee):ce):(ae.flags|=67108866,ee)):(ae.flags|=1048576,ee)}function _(ae){return o&&ae.alternate===null&&(ae.flags|=67108866),ae}function D(ae,ee,ce,ke){return ee===null||ee.tag!==6?(ee=Lb(ce,ae.mode,ke),ee.return=ae,ee):(ee=y(ee,ce),ee.return=ae,ee)}function Y(ae,ee,ce,ke){var it=ce.type;return it===S?Se(ae,ee,ce.props.children,ke,ce.key):ee!==null&&(ee.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===R&&Mc(it)===ee.type)?(ee=y(ee,ce.props),uf(ee,ce),ee.return=ae,ee):(ee=eg(ce.type,ce.key,ce.props,null,ae.mode,ke),uf(ee,ce),ee.return=ae,ee)}function de(ae,ee,ce,ke){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ce.containerInfo||ee.stateNode.implementation!==ce.implementation?(ee=Ub(ce,ae.mode,ke),ee.return=ae,ee):(ee=y(ee,ce.children||[]),ee.return=ae,ee)}function Se(ae,ee,ce,ke,it){return ee===null||ee.tag!==7?(ee=Tc(ce,ae.mode,ke,it),ee.return=ae,ee):(ee=y(ee,ce),ee.return=ae,ee)}function Ne(ae,ee,ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=Lb(""+ee,ae.mode,ce),ee.return=ae,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:return ce=eg(ee.type,ee.key,ee.props,null,ae.mode,ce),uf(ce,ee),ce.return=ae,ce;case b:return ee=Ub(ee,ae.mode,ce),ee.return=ae,ee;case R:return ee=Mc(ee),Ne(ae,ee,ce)}if(Q(ee)||F(ee))return ee=Tc(ee,ae.mode,ce,null),ee.return=ae,ee;if(typeof ee.then=="function")return Ne(ae,og(ee),ce);if(ee.$$typeof===E)return Ne(ae,ig(ae,ee),ce);lg(ae,ee)}return null}function fe(ae,ee,ce,ke){var it=ee!==null?ee.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return it!==null?null:D(ae,ee,""+ce,ke);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case x:return ce.key===it?Y(ae,ee,ce,ke):null;case b:return ce.key===it?de(ae,ee,ce,ke):null;case R:return ce=Mc(ce),fe(ae,ee,ce,ke)}if(Q(ce)||F(ce))return it!==null?null:Se(ae,ee,ce,ke,null);if(typeof ce.then=="function")return fe(ae,ee,og(ce),ke);if(ce.$$typeof===E)return fe(ae,ee,ig(ae,ce),ke);lg(ae,ce)}return null}function xe(ae,ee,ce,ke,it){if(typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint")return ae=ae.get(ce)||null,D(ee,ae,""+ke,it);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case x:return ae=ae.get(ke.key===null?ce:ke.key)||null,Y(ee,ae,ke,it);case b:return ae=ae.get(ke.key===null?ce:ke.key)||null,de(ee,ae,ke,it);case R:return ke=Mc(ke),xe(ae,ee,ce,ke,it)}if(Q(ke)||F(ke))return ae=ae.get(ce)||null,Se(ee,ae,ke,it,null);if(typeof ke.then=="function")return xe(ae,ee,ce,og(ke),it);if(ke.$$typeof===E)return xe(ae,ee,ce,ig(ee,ke),it);lg(ee,ke)}return null}function Ye(ae,ee,ce,ke){for(var it=null,Ht=null,Je=ee,St=ee=0,_t=null;Je!==null&&St<ce.length;St++){Je.index>St?(_t=Je,Je=null):_t=Je.sibling;var Kt=fe(ae,Je,ce[St],ke);if(Kt===null){Je===null&&(Je=_t);break}o&&Je&&Kt.alternate===null&&u(ae,Je),ee=k(Kt,ee,St),Ht===null?it=Kt:Ht.sibling=Kt,Ht=Kt,Je=_t}if(St===ce.length)return m(ae,Je),Rt&&go(ae,St),it;if(Je===null){for(;St<ce.length;St++)Je=Ne(ae,ce[St],ke),Je!==null&&(ee=k(Je,ee,St),Ht===null?it=Je:Ht.sibling=Je,Ht=Je);return Rt&&go(ae,St),it}for(Je=g(Je);St<ce.length;St++)_t=xe(Je,ae,St,ce[St],ke),_t!==null&&(o&&_t.alternate!==null&&Je.delete(_t.key===null?St:_t.key),ee=k(_t,ee,St),Ht===null?it=_t:Ht.sibling=_t,Ht=_t);return o&&Je.forEach(function(Dl){return u(ae,Dl)}),Rt&&go(ae,St),it}function ut(ae,ee,ce,ke){if(ce==null)throw Error(i(151));for(var it=null,Ht=null,Je=ee,St=ee=0,_t=null,Kt=ce.next();Je!==null&&!Kt.done;St++,Kt=ce.next()){Je.index>St?(_t=Je,Je=null):_t=Je.sibling;var Dl=fe(ae,Je,Kt.value,ke);if(Dl===null){Je===null&&(Je=_t);break}o&&Je&&Dl.alternate===null&&u(ae,Je),ee=k(Dl,ee,St),Ht===null?it=Dl:Ht.sibling=Dl,Ht=Dl,Je=_t}if(Kt.done)return m(ae,Je),Rt&&go(ae,St),it;if(Je===null){for(;!Kt.done;St++,Kt=ce.next())Kt=Ne(ae,Kt.value,ke),Kt!==null&&(ee=k(Kt,ee,St),Ht===null?it=Kt:Ht.sibling=Kt,Ht=Kt);return Rt&&go(ae,St),it}for(Je=g(Je);!Kt.done;St++,Kt=ce.next())Kt=xe(Je,ae,St,Kt.value,ke),Kt!==null&&(o&&Kt.alternate!==null&&Je.delete(Kt.key===null?St:Kt.key),ee=k(Kt,ee,St),Ht===null?it=Kt:Ht.sibling=Kt,Ht=Kt);return o&&Je.forEach(function($q){return u(ae,$q)}),Rt&&go(ae,St),it}function dn(ae,ee,ce,ke){if(typeof ce=="object"&&ce!==null&&ce.type===S&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case x:e:{for(var it=ce.key;ee!==null;){if(ee.key===it){if(it=ce.type,it===S){if(ee.tag===7){m(ae,ee.sibling),ke=y(ee,ce.props.children),ke.return=ae,ae=ke;break e}}else if(ee.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===R&&Mc(it)===ee.type){m(ae,ee.sibling),ke=y(ee,ce.props),uf(ke,ce),ke.return=ae,ae=ke;break e}m(ae,ee);break}else u(ae,ee);ee=ee.sibling}ce.type===S?(ke=Tc(ce.props.children,ae.mode,ke,ce.key),ke.return=ae,ae=ke):(ke=eg(ce.type,ce.key,ce.props,null,ae.mode,ke),uf(ke,ce),ke.return=ae,ae=ke)}return _(ae);case b:e:{for(it=ce.key;ee!==null;){if(ee.key===it)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){m(ae,ee.sibling),ke=y(ee,ce.children||[]),ke.return=ae,ae=ke;break e}else{m(ae,ee);break}else u(ae,ee);ee=ee.sibling}ke=Ub(ce,ae.mode,ke),ke.return=ae,ae=ke}return _(ae);case R:return ce=Mc(ce),dn(ae,ee,ce,ke)}if(Q(ce))return Ye(ae,ee,ce,ke);if(F(ce)){if(it=F(ce),typeof it!="function")throw Error(i(150));return ce=it.call(ce),ut(ae,ee,ce,ke)}if(typeof ce.then=="function")return dn(ae,ee,og(ce),ke);if(ce.$$typeof===E)return dn(ae,ee,ig(ae,ce),ke);lg(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,ee!==null&&ee.tag===6?(m(ae,ee.sibling),ke=y(ee,ce),ke.return=ae,ae=ke):(m(ae,ee),ke=Lb(ce,ae.mode,ke),ke.return=ae,ae=ke),_(ae)):m(ae,ee)}return function(ae,ee,ce,ke){try{cf=0;var it=dn(ae,ee,ce,ke);return ld=null,it}catch(Je){if(Je===od||Je===sg)throw Je;var Ht=ss(29,Je,null,ae.mode);return Ht.lanes=ke,Ht.return=ae,Ht}finally{}}}var Oc=bE(!0),wE=bE(!1),yl=!1;function Qb(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xb(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function bl(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function wl(o,u,m){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(Xt&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=Zp(o),rE(o,null,m),u}return Jp(o,g,u,m),Zp(o)}function df(o,u,m){if(u=u.updateQueue,u!==null&&(u=u.shared,(m&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,m|=g,u.lanes=m,Ur(o,m)}}function Jb(o,u){var m=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,m===g)){var y=null,k=null;if(m=m.firstBaseUpdate,m!==null){do{var _={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};k===null?y=k=_:k=k.next=_,m=m.next}while(m!==null);k===null?y=k=u:k=k.next=u}else y=k=u;m={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:k,shared:g.shared,callbacks:g.callbacks},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=u:o.next=u,m.lastBaseUpdate=u}var Zb=!1;function hf(){if(Zb){var o=ad;if(o!==null)throw o}}function ff(o,u,m,g){Zb=!1;var y=o.updateQueue;yl=!1;var k=y.firstBaseUpdate,_=y.lastBaseUpdate,D=y.shared.pending;if(D!==null){y.shared.pending=null;var Y=D,de=Y.next;Y.next=null,_===null?k=de:_.next=de,_=Y;var Se=o.alternate;Se!==null&&(Se=Se.updateQueue,D=Se.lastBaseUpdate,D!==_&&(D===null?Se.firstBaseUpdate=de:D.next=de,Se.lastBaseUpdate=Y))}if(k!==null){var Ne=y.baseState;_=0,Se=de=Y=null,D=k;do{var fe=D.lane&-536870913,xe=fe!==D.lane;if(xe?(Pt&fe)===fe:(g&fe)===fe){fe!==0&&fe===sd&&(Zb=!0),Se!==null&&(Se=Se.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var Ye=o,ut=D;fe=u;var dn=m;switch(ut.tag){case 1:if(Ye=ut.payload,typeof Ye=="function"){Ne=Ye.call(dn,Ne,fe);break e}Ne=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=ut.payload,fe=typeof Ye=="function"?Ye.call(dn,Ne,fe):Ye,fe==null)break e;Ne=p({},Ne,fe);break e;case 2:yl=!0}}fe=D.callback,fe!==null&&(o.flags|=64,xe&&(o.flags|=8192),xe=y.callbacks,xe===null?y.callbacks=[fe]:xe.pu
vendor: 7,166 bytes, line 48
48sh(fe))}else xe={lane:fe,tag:D.tag,payload:D.payload,callback:D.callback,next:null},Se===null?(de=Se=xe,Y=Ne):Se=Se.next=xe,_|=fe;if(D=D.next,D===null){if(D=y.shared.pending,D===null)break;xe=D,D=xe.next,xe.next=null,y.lastBaseUpdate=xe,y.shared.pending=null}}while(!0);Se===null&&(Y=Ne),y.baseState=Y,y.firstBaseUpdate=de,y.lastBaseUpdate=Se,k===null&&(y.shared.lanes=0),Cl|=_,o.lanes=_,o.memoizedState=Ne}}function SE(o,u){if(typeof o!="function")throw Error(i(191,o));o.call(u)}function kE(o,u){var m=o.callbacks;if(m!==null)for(o.callbacks=null,o=0;o<m.length;o++)SE(m[o],u)}var cd=L(null),cg=L(0);function NE(o,u){o=To,ye(cg,o),ye(cd,u),To=o|u.baseLanes}function e1(){ye(cg,To),ye(cd,cd.current)}function t1(){To=cg.current,J(cd),J(cg)}var as=L(null),Ps=null;function Sl(o){var u=o.alternate;ye(ni,ni.current&1),ye(as,o),Ps===null&&(u===null||cd.current!==null||u.memoizedState!==null)&&(Ps=o)}function n1(o){ye(ni,ni.current),ye(as,o),Ps===null&&(Ps=o)}function jE(o){o.tag===22?(ye(ni,ni.current),ye(as,o),Ps===null&&(Ps=o)):kl()}function kl(){ye(ni,ni.current),ye(as,as.current)}function os(o){J(as),Ps===o&&(Ps=null),J(ni)}var ni=L(0);function ug(o){for(var u=o;u!==null;){if(u.tag===13){var m=u.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||lw(m)||cw(m)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var yo=0,wt=null,cn=null,di=null,dg=!1,ud=!1,Ic=!1,hg=0,mf=0,dd=null,_7=0;function Hn(){throw Error(i(321))}function i1(o,u){if(u===null)return!1;for(var m=0;m<u.length&&m<o.length;m++)if(!rs(o[m],u[m]))return!1;return!0}function r1(o,u,m,g,y,k){return yo=k,wt=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,W.H=o===null||o.memoizedState===null?lA:y1,Ic=!1,k=m(g,y),Ic=!1,ud&&(k=TE(u,m,g,y)),CE(o),k}function CE(o){W.H=vf;var u=cn!==null&&cn.next!==null;if(yo=0,di=cn=wt=null,dg=!1,mf=0,dd=null,u)throw Error(i(300));o===null||hi||(o=o.dependencies,o!==null&&ng(o)&&(hi=!0))}function TE(o,u,m,g){wt=o;var y=0;do{if(ud&&(dd=null),mf=0,ud=!1,25<=y)throw Error(i(301));if(y+=1,di=cn=null,o.updateQueue!=null){var k=o.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}W.H=cA,k=u(m,g)}while(ud);return k}function M7(){var o=W.H,u=o.useState()[0];return u=typeof u.then=="function"?pf(u):u,o=o.useState()[0],(cn!==null?cn.memoizedState:null)!==o&&(wt.flags|=1024),u}function s1(){var o=hg!==0;return hg=0,o}function a1(o,u,m){u.updateQueue=o.updateQueue,u.flags&=-2053,o.lanes&=~m}function o1(o){if(dg){for(o=o.memoizedState;o!==null;){var u=o.queue;u!==null&&(u.pending=null),o=o.next}dg=!1}yo=0,di=cn=wt=null,ud=!1,mf=hg=0,dd=null}function Nr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return di===null?wt.memoizedState=di=o:di=di.next=o,di}function ii(){if(cn===null){var o=wt.alternate;o=o!==null?o.memoizedState:null}else o=cn.next;var u=di===null?wt.memoizedState:di.next;if(u!==null)di=u,cn=o;else{if(o===null)throw wt.alternate===null?Error(i(467)):Error(i(310));cn=o,o={memoizedState:cn.memoizedState,baseState:cn.baseState,baseQueue:cn.baseQueue,queue:cn.queue,next:null},di===null?wt.memoizedState=di=o:di=di.next=o}return di}function fg(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pf(o){var u=mf;return mf+=1,dd===null&&(dd=[]),o=vE(dd,o,u),u=wt,(di===null?u.memoizedState:di.next)===null&&(u=u.alternate,W.H=u===null||u.memoizedState===null?lA:y1),o}function mg(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return pf(o);if(o.$$typeof===E)return Xi(o)}throw Error(i(438,String(o)))}function l1(o){var u=null,m=wt.updateQueue;if(m!==null&&(u=m.memoCache),u==null){var g=wt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(u={data:g.data.map(function(y){return y.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),m===null&&(m=fg(),wt.updateQueue=m),m.memoCache=u,m=u.data[u.index],m===void 0)for(m=u.data[u.index]=Array(o),g=0;g<o;g++)m[g]=U;return u.index++,m}function bo(o,u){return typeof u=="function"?u(o):u}function pg(o){var u=ii();return c1(u,cn,o)}function c1(o,u,m){var g=o.queue;if(g===null)throw Error(i(311));g.lastRenderedReducer=m;var y=o.baseQueue,k=g.pending;if(k!==null){if(y!==null){var _=y.next;y.next=k.next,k.next=_}u.baseQueue=y=k,g.pending=null}if(k=o.baseState,y===null)o.memoizedState=k;else{u=y.next;var D=_=null,Y=null,de=u,Se=!1;do{var Ne=de.lane&-536870913;if(Ne!==de.lane?(Pt&Ne)===Ne:(yo&Ne)===Ne){var fe=de.revertLane;if(fe===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),Ne===sd&&(Se=!0);else if((yo&fe)===fe){de=de.next,fe===sd&&(Se=!0);continue}else Ne={lane:0,revertLane:de.revertLane,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},Y===null?(D=Y=Ne,_=k):Y=Y.next=Ne,wt.lanes|=fe,Cl|=fe;Ne=de.action,Ic&&m(k,Ne),k=de.hasEagerState?de.eagerState:m(k,Ne)}else fe={lane:Ne,revertLane:de.revertLane,gesture:de.gesture,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},Y===null?(D=Y=fe,_=k):Y=Y.next=fe,wt.lanes|=Ne,Cl|=Ne;de=de.next}while(de!==null&&de!==u);if(Y===null?_=k:Y.next=D,!rs(k,o.memoizedState)&&(hi=!0,Se&&(m=ad,m!==null)))throw m;o.memoizedState=k,o.baseState=_,o.baseQueue=Y,g.lastRenderedState=k}return y===null&&(g.lanes=0),[o.memoizedState,g.dispatch]}function u1(o){var u=ii(),m=u.queue;if(m===null)throw Error(i(311));m.lastRenderedReducer=o;var g=m.dispatch,y=m.pending,k=u.memoizedState;if(y!==null){m.pending=null;var _=y=y.next;do k=o(k,_.action),_=_.next;while(_!==y);rs(k,u.memoizedState)||(hi=!0),u.memoizedState=k,u.baseQueue===null&&(u.baseState=k),m.lastRenderedState=k}return[k,g]}function EE(o,u,m){var g=wt,y=ii(),k=Rt;if(k){if(m===void 0)throw Error(i(407));m=m()}else m=u();var _=!rs((cn||y).memoizedState,m);if(_&&(y.memoizedState=m,hi=!0),y=y.queue,f1(_E.bind(null,g,y,o),[o]),y.getSnapshot!==u||_||di!==null&&di.memoizedState.tag&1){if(g.flags|=2048,hd(9,{destroy:void 0},PE.bind(null,g,y,m,u),null),mn===null)throw Error(i(349));k||(yo&127)!==0||AE(g,u,m)}return m}function AE(o,u,m){o.flags|=16384,o={getSnapshot:u,value:m},u=wt.updateQueue,u===null?(u=fg(),wt.updateQueue=u,u.stores=[o]):(m=u.stores,m===null?u.stores=[o]:m.push(o))}function PE(o,u,m,g){u.value=m,u.getSnapshot=g,ME(u)&&RE(o)}function _E(o,u,m){return m(function(){ME(u)&&RE(o)})}function ME(o){var u=o.getSnapshot;o=o.value;try{var m=u();return!rs(o,m)}catch{return!0}}function RE(o){var u=Cc(o,2);u!==null&&Hr(u,o,2)}function d1(o){var u=Nr();if(typeof o=="function"){var m=o;if(o=m(),Ic){ln(!0);try{m()}finally{ln(!1)}}}return u.memoizedState=u.baseState=o,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bo,lastRenderedState:o},u}
vendor: 7,674 bytes, line 48
48function OE(o,u,m,g){return o.baseState=m,c1(o,cn,typeof g=="function"?g:bo)}function R7(o,u,m,g,y){if(xg(o))throw Error(i(485));if(o=u.action,o!==null){var k={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){k.listeners.push(_)}};W.T!==null?m(!0):k.isTransition=!1,g(k),m=u.pending,m===null?(k.next=u.pending=k,IE(u,k)):(k.next=m.next,u.pending=m.next=k)}}function IE(o,u){var m=u.action,g=u.payload,y=o.state;if(u.isTransition){var k=W.T,_={};W.T=_;try{var D=m(y,g),Y=W.S;Y!==null&&Y(_,D),DE(o,u,D)}catch(de){h1(o,u,de)}finally{k!==null&&_.types!==null&&(k.types=_.types),W.T=k}}else try{k=m(y,g),DE(o,u,k)}catch(de){h1(o,u,de)}}function DE(o,u,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(g){LE(o,u,g)},function(g){return h1(o,u,g)}):LE(o,u,m)}function LE(o,u,m){u.status="fulfilled",u.value=m,UE(u),o.state=m,u=o.pending,u!==null&&(m=u.next,m===u?o.pending=null:(m=m.next,u.next=m,IE(o,m)))}function h1(o,u,m){var g=o.pending;if(o.pending=null,g!==null){g=g.next;do u.status="rejected",u.reason=m,UE(u),u=u.next;while(u!==g)}o.action=null}function UE(o){o=o.listeners;for(var u=0;u<o.length;u++)(0,o[u])()}function BE(o,u){return u}function FE(o,u){if(Rt){var m=mn.formState;if(m!==null){e:{var g=wt;if(Rt){if(En){t:{for(var y=En,k=As;y.nodeType!==8;){if(!k){y=null;break t}if(y=_s(y.nextSibling),y===null){y=null;break t}}k=y.data,y=k==="F!"||k==="F"?y:null}if(y){En=_s(y.nextSibling),g=y.data==="F!";break e}}vl(g)}g=!1}g&&(u=m[0])}}return m=Nr(),m.memoizedState=m.baseState=u,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:BE,lastRenderedState:u},m.queue=g,m=sA.bind(null,wt,g),g.dispatch=m,g=d1(!1),k=x1.bind(null,wt,!1,g.queue),g=Nr(),y={state:u,dispatch:null,action:o,pending:null},g.queue=y,m=R7.bind(null,wt,y,k,m),y.dispatch=m,g.memoizedState=o,[u,m,!1]}function $E(o){var u=ii();return VE(u,cn,o)}function VE(o,u,m){if(u=c1(o,u,BE)[0],o=pg(bo)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var g=pf(u)}catch(_){throw _===od?sg:_}else g=u;u=ii();var y=u.queue,k=y.dispatch;return m!==u.memoizedState&&(wt.flags|=2048,hd(9,{destroy:void 0},O7.bind(null,y,m),null)),[g,k,o]}function O7(o,u){o.action=u}function zE(o){var u=ii(),m=cn;if(m!==null)return VE(u,m,o);ii(),u=u.memoizedState,m=ii();var g=m.queue.dispatch;return m.memoizedState=o,[u,g,!1]}function hd(o,u,m,g){return o={tag:o,create:m,deps:g,inst:u,next:null},u=wt.updateQueue,u===null&&(u=fg(),wt.updateQueue=u),m=u.lastEffect,m===null?u.lastEffect=o.next=o:(g=m.next,m.next=o,o.next=g,u.lastEffect=o),o}function qE(){return ii().memoizedState}function gg(o,u,m,g){var y=Nr();wt.flags|=o,y.memoizedState=hd(1|u,{destroy:void 0},m,g===void 0?null:g)}function vg(o,u,m,g){var y=ii();g=g===void 0?null:g;var k=y.memoizedState.inst;cn!==null&&g!==null&&i1(g,cn.memoizedState.deps)?y.memoizedState=hd(u,k,m,g):(wt.flags|=o,y.memoizedState=hd(1|u,k,m,g))}function WE(o,u){gg(8390656,8,o,u)}function f1(o,u){vg(2048,8,o,u)}function I7(o){wt.flags|=4;var u=wt.updateQueue;if(u===null)u=fg(),wt.updateQueue=u,u.events=[o];else{var m=u.events;m===null?u.events=[o]:m.push(o)}}function HE(o){var u=ii().memoizedState;return I7({ref:u,nextImpl:o}),function(){if((Xt&2)!==0)throw Error(i(440));return u.impl.apply(void 0,arguments)}}function KE(o,u){return vg(4,2,o,u)}function GE(o,u){return vg(4,4,o,u)}function YE(o,u){if(typeof u=="function"){o=o();var m=u(o);return function(){typeof m=="function"?m():u(null)}}if(u!=null)return o=o(),u.current=o,function(){u.current=null}}function QE(o,u,m){m=m!=null?m.concat([o]):null,vg(4,4,YE.bind(null,u,o),m)}function m1(){}function XE(o,u){var m=ii();u=u===void 0?null:u;var g=m.memoizedState;return u!==null&&i1(u,g[1])?g[0]:(m.memoizedState=[o,u],o)}function JE(o,u){var m=ii();u=u===void 0?null:u;var g=m.memoizedState;if(u!==null&&i1(u,g[1]))return g[0];if(g=o(),Ic){ln(!0);try{o()}finally{ln(!1)}}return m.memoizedState=[g,u],g}function p1(o,u,m){return m===void 0||(yo&1073741824)!==0&&(Pt&261930)===0?o.memoizedState=u:(o.memoizedState=m,o=ZA(),wt.lanes|=o,Cl|=o,m)}function ZE(o,u,m,g){return rs(m,u)?m:cd.current!==null?(o=p1(o,m,g),rs(o,u)||(hi=!0),o):(yo&42)===0||(yo&1073741824)!==0&&(Pt&261930)===0?(hi=!0,o.memoizedState=m):(o=ZA(),wt.lanes|=o,Cl|=o,u)}function eA(o,u,m,g,y){var k=q.p;q.p=k!==0&&8>k?k:8;var _=W.T,D={};W.T=D,x1(o,!1,u,m);try{var Y=y(),de=W.S;if(de!==null&&de(D,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var Se=P7(Y,g);gf(o,u,Se,us(o))}else gf(o,u,g,us(o))}catch(Ne){gf(o,u,{then:function(){},status:"rejected",reason:Ne},us())}finally{q.p=k,_!==null&&D.types!==null&&(_.types=D.types),W.T=_}}function D7(){}function g1(o,u,m,g){if(o.tag!==5)throw Error(i(476));var y=tA(o).queue;eA(o,y,u,$,m===null?D7:function(){return nA(o),m(g)})}function tA(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bo,lastRenderedState:$},next:null};var m={};return u.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bo,lastRenderedState:m},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function nA(o){var u=tA(o);u.next===null&&(u=o.alternate.memoizedState),gf(o,u.next.queue,{},us())}function v1(){return Xi(Rf)}function iA(){return ii().memoizedState}function rA(){return ii().memoizedState}function L7(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var m=us();o=bl(m);var g=wl(u,o,m);g!==null&&(Hr(g,u,m),df(g,u,m)),u={cache:Hb()},o.payload=u;return}u=u.return}}function U7(o,u,m){var g=us();m={lane:g,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},xg(o)?aA(u,m):(m=Ib(o,u,m,g),m!==null&&(Hr(m,o,g),oA(m,u,g)))}function sA(o,u,m){var g=us();gf(o,u,m,g)}function gf(o,u,m,g){var y={lane:g,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(xg(o))aA(u,y);else{var k=o.alternate;if(o.lanes===0&&(k===null||k.lanes===0)&&(k=u.lastRenderedReducer,k!==null))try{var _=u.lastRenderedState,D=k(_,m);if(y.hasEagerState=!0,y.eagerState=D,rs(D,_))return Jp(o,u,y,0),mn===null&&Xp(),!1}catch{}finally{}if(m=Ib(o,u,y,g),m!==null)return Hr(m,o,g),oA(m,u,g),!0}return!1}function x1(o,u,m,g){if(g={lane:2,revertLane:Q1(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},xg(o)){if(u)throw Error(i(479))}else u=Ib(o,m,g,2),u!==null&&Hr(u,o,2)}function xg(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function aA(o,u){ud=dg=!0;var m=o.pending;m===null?u.next=u:(u.next=m.next,m.next=u),o.pending=u}function oA(o,u,m){if((m&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,m|=g,u.lanes=m,Ur(o,m)}}var vf={readContext:Xi,use:mg,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useLayoutEffect:Hn,useInsertionEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useSyncExternalStore:Hn,useId:Hn,useHostTransitionStatus:Hn,useFormState:Hn,useActionState:Hn,useOptimistic:Hn,useMemoCache:Hn,useCacheRefresh:Hn};vf.useEffectEvent=Hn;var lA={readContext:Xi,use:mg,useCallback:function(o,u){return Nr().memoizedState=[o,u===void 0?null:u],o},useContext:Xi,useEffect:WE,useImperativeHandle:function(o,u,m){m=m!=null?m.concat([o]):null,gg(4194308,4,YE.bind(null,u,o),m)},useLayoutEffect:function(o,u){return gg(4194308,4,o,u)},useInsertionEffect:function(o,u){gg(4,2,o,u)},useMemo:function(o,u){var m=Nr();u=u===void 0?null:u;var g=o();if(Ic){ln(!0);try{o()}finally{ln(!1)}}return m.memoizedState=[g,u],g},useReducer:function(o,u,m){var g=Nr();if(m!==void 0){var y=m(u);
vendor: 16,628 bytes, line 48
48if(Ic){ln(!0);try{m(u)}finally{ln(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=U7.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=Nr();return o={current:o},u.memoizedState=o},useState:function(o){o=d1(o);var u=o.queue,m=sA.bind(null,wt,u);return u.dispatch=m,[o.memoizedState,m]},useDebugValue:m1,useDeferredValue:function(o,u){var m=Nr();return p1(m,o,u)},useTransition:function(){var o=d1(!1);return o=eA.bind(null,wt,o.queue,!0,!1),Nr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,m){var g=wt,y=Nr();if(Rt){if(m===void 0)throw Error(i(407));m=m()}else{if(m=u(),mn===null)throw Error(i(349));(Pt&127)!==0||AE(g,u,m)}y.memoizedState=m;var k={value:m,getSnapshot:u};return y.queue=k,WE(_E.bind(null,g,k,o),[o]),g.flags|=2048,hd(9,{destroy:void 0},PE.bind(null,g,k,m,u),null),m},useId:function(){var o=Nr(),u=mn.identifierPrefix;if(Rt){var m=_a,g=Pa;m=(g&~(1<<32-Ut(g)-1)).toString(32)+m,u="_"+u+"R_"+m,m=hg++,0<m&&(u+="H"+m.toString(32)),u+="_"}else m=_7++,u="_"+u+"r_"+m.toString(32)+"_";return o.memoizedState=u},useHostTransitionStatus:v1,useFormState:FE,useActionState:FE,useOptimistic:function(o){var u=Nr();u.memoizedState=u.baseState=o;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=m,u=x1.bind(null,wt,!0,m),m.dispatch=u,[o,u]},useMemoCache:l1,useCacheRefresh:function(){return Nr().memoizedState=L7.bind(null,wt)},useEffectEvent:function(o){var u=Nr(),m={impl:o};return u.memoizedState=m,function(){if((Xt&2)!==0)throw Error(i(440));return m.impl.apply(void 0,arguments)}}},y1={readContext:Xi,use:mg,useCallback:XE,useContext:Xi,useEffect:f1,useImperativeHandle:QE,useInsertionEffect:KE,useLayoutEffect:GE,useMemo:JE,useReducer:pg,useRef:qE,useState:function(){return pg(bo)},useDebugValue:m1,useDeferredValue:function(o,u){var m=ii();return ZE(m,cn.memoizedState,o,u)},useTransition:function(){var o=pg(bo)[0],u=ii().memoizedState;return[typeof o=="boolean"?o:pf(o),u]},useSyncExternalStore:EE,useId:iA,useHostTransitionStatus:v1,useFormState:$E,useActionState:$E,useOptimistic:function(o,u){var m=ii();return OE(m,cn,o,u)},useMemoCache:l1,useCacheRefresh:rA};y1.useEffectEvent=HE;var cA={readContext:Xi,use:mg,useCallback:XE,useContext:Xi,useEffect:f1,useImperativeHandle:QE,useInsertionEffect:KE,useLayoutEffect:GE,useMemo:JE,useReducer:u1,useRef:qE,useState:function(){return u1(bo)},useDebugValue:m1,useDeferredValue:function(o,u){var m=ii();return cn===null?p1(m,o,u):ZE(m,cn.memoizedState,o,u)},useTransition:function(){var o=u1(bo)[0],u=ii().memoizedState;return[typeof o=="boolean"?o:pf(o),u]},useSyncExternalStore:EE,useId:iA,useHostTransitionStatus:v1,useFormState:zE,useActionState:zE,useOptimistic:function(o,u){var m=ii();return cn!==null?OE(m,cn,o,u):(m.baseState=o,[o,m.queue.dispatch])},useMemoCache:l1,useCacheRefresh:rA};cA.useEffectEvent=HE;function b1(o,u,m,g){u=o.memoizedState,m=m(g,u),m=m==null?u:p({},u,m),o.memoizedState=m,o.lanes===0&&(o.updateQueue.baseState=m)}var w1={enqueueSetState:function(o,u,m){o=o._reactInternals;var g=us(),y=bl(g);y.payload=u,m!=null&&(y.callback=m),u=wl(o,y,g),u!==null&&(Hr(u,o,g),df(u,o,g))},enqueueReplaceState:function(o,u,m){o=o._reactInternals;var g=us(),y=bl(g);y.tag=1,y.payload=u,m!=null&&(y.callback=m),u=wl(o,y,g),u!==null&&(Hr(u,o,g),df(u,o,g))},enqueueForceUpdate:function(o,u){o=o._reactInternals;var m=us(),g=bl(m);g.tag=2,u!=null&&(g.callback=u),u=wl(o,g,m),u!==null&&(Hr(u,o,m),df(u,o,m))}};function uA(o,u,m,g,y,k,_){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,k,_):u.prototype&&u.prototype.isPureReactComponent?!nf(m,g)||!nf(y,k):!0}function dA(o,u,m,g){o=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(m,g),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(m,g),u.state!==o&&w1.enqueueReplaceState(u,u.state,null)}function Dc(o,u){var m=u;if("ref"in u){m={};for(var g in u)g!=="ref"&&(m[g]=u[g])}if(o=o.defaultProps){m===u&&(m=p({},m));for(var y in o)m[y]===void 0&&(m[y]=o[y])}return m}function hA(o){Qp(o)}function fA(o){console.error(o)}function mA(o){Qp(o)}function yg(o,u){try{var m=o.onUncaughtError;m(u.value,{componentStack:u.stack})}catch(g){setTimeout(function(){throw g})}}function pA(o,u,m){try{var g=o.onCaughtError;g(m.value,{componentStack:m.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function S1(o,u,m){return m=bl(m),m.tag=3,m.payload={element:null},m.callback=function(){yg(o,u)},m}function gA(o){return o=bl(o),o.tag=3,o}function vA(o,u,m,g){var y=m.type.getDerivedStateFromError;if(typeof y=="function"){var k=g.value;o.payload=function(){return y(k)},o.callback=function(){pA(u,m,g)}}var _=m.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){pA(u,m,g),typeof y!="function"&&(Tl===null?Tl=new Set([this]):Tl.add(this));var D=g.stack;this.componentDidCatch(g.value,{componentStack:D!==null?D:""})})}function B7(o,u,m,g,y){if(m.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(u=m.alternate,u!==null&&rd(u,m,y,!0),m=as.current,m!==null){switch(m.tag){case 31:case 13:return Ps===null?_g():m.alternate===null&&Kn===0&&(Kn=3),m.flags&=-257,m.flags|=65536,m.lanes=y,g===ag?m.flags|=16384:(u=m.updateQueue,u===null?m.updateQueue=new Set([g]):u.add(g),K1(o,g,y)),!1;case 22:return m.flags|=65536,g===ag?m.flags|=16384:(u=m.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([g])},m.updateQueue=u):(m=u.retryQueue,m===null?u.retryQueue=new Set([g]):m.add(g)),K1(o,g,y)),!1}throw Error(i(435,m.tag))}return K1(o,g,y),_g(),!1}if(Rt)return u=as.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=y,g!==$b&&(o=Error(i(422),{cause:g}),af(Cs(o,m)))):(g!==$b&&(u=Error(i(423),{cause:g}),af(Cs(u,m))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,g=Cs(g,m),y=S1(o.stateNode,g,y),Jb(o,y),Kn!==4&&(Kn=2)),!1;var k=Error(i(520),{cause:g});if(k=Cs(k,m),jf===null?jf=[k]:jf.push(k),Kn!==4&&(Kn=2),u===null)return!0;g=Cs(g,m),m=u;do{switch(m.tag){case 3:return m.flags|=65536,o=y&-y,m.lanes|=o,o=S1(m.stateNode,g,o),Jb(m,o),!1;case 1:if(u=m.type,k=m.stateNode,(m.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Tl===null||!Tl.has(k))))return m.flags|=65536,y&=-y,m.lanes|=y,y=gA(y),vA(y,o,m,g),Jb(m,y),!1}m=m.return}while(m!==null);return!1}var k1=Error(i(461)),hi=!1;function Ji(o,u,m,g){u.child=o===null?wE(u,null,m,g):Oc(u,o.child,m,g)}function xA(o,u,m,g,y){m=m.render;var k=u.ref;if("ref"in g){var _={};for(var D in g)D!=="ref"&&(_[D]=g[D])}else _=g;return Pc(u),g=r1(o,u,m,_,k,y),D=s1(),o!==null&&!hi?(a1(o,u,y),wo(o,u,y)):(Rt&&D&&Bb(u),u.flags|=1,Ji(o,u,g,y),u.child)}function yA(o,u,m,g,y){if(o===null){var k=m.type;return typeof k=="function"&&!Db(k)&&k.defaultProps===void 0&&m.compare===null?(u.tag=15,u.type=k,bA(o,u,k,g,y)):(o=eg(m.type,null,g,u,u.mode,y),o.ref=u.ref,o.return=u,u.child=o)}if(k=o.child,!_1(o,y)){var _=k.memoizedProps;if(m=m.compare,m=m!==null?m:nf,m(_,g)&&o.ref===u.ref)return wo(o,u,y)}return u.flags|=1,o=po(k,g),o.ref=u.ref,o.return=u,u.child=o}function bA(o,u,m,g,y){if(o!==null){var k=o.memoizedProps;if(nf(k,g)&&o.ref===u.ref)if(hi=!1,u.pendingProps=g=k,_1(o,y))(o.flags&131072)!==0&&(hi=!0);else return u.lanes=o.lanes,wo(o,u,y)}return N1(o,u,m,g,y)}function wA(o,u,m,g){var y=g.children,k=o!==null?o.memoizedState:null;if(o===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((u.flags&128)!==0){if(k=k!==null?k.baseLanes|m:m,o!==null){for(g=u.child=o.child,y=0;g!==null;)y=y|g.lanes|g.childLanes,g=g.sibling;g=y&~k}else g=0,u.child=null;return SA(o,u,k,m,g)}if((m&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},o!==null&&rg(u,k!==null?k.cachePool:null),k!==null?NE(u,k):e1(),jE(u);else return g=u.lanes=536870912,SA(o,u,k!==null?k.baseLanes|m:m,m,g)}else k!==null?(rg(u,k.cachePool),NE(u,k),kl(),u.memoizedState=null):(o!==null&&rg(u,null),e1(),kl());return Ji(o,u,y,m),u.child}function xf(o,u){return o!==null&&o.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function SA(o,u,m,g,y){var k=Gb();return k=k===null?null:{parent:ui._currentValue,pool:k},u.memoizedState={baseLanes:m,cachePool:k},o!==null&&rg(u,null),e1(),jE(u),o!==null&&rd(o,u,g,!0),u.childLanes=y,null}function bg(o,u){return u=Sg({mode:u.mode,children:u.children},o.mode),u.ref=o.ref,o.child=u,u.return=o,u}function kA(o,u,m){return Oc(u,o.child,null,m),o=bg(u,u.pendingProps),o.flags|=2,os(u),u.memoizedState=null,o}function F7(o,u,m){var g=u.pendingProps,y=(u.flags&128)!==0;if(u.flags&=-129,o===null){if(Rt){if(g.mode==="hidden")return o=bg(u,g),u.lanes=536870912,xf(null,o);if(n1(u),(o=En)?(o=IP(o,As),o=o!==null&&o.data==="&"?o:null,o!==null&&(u.memoizedState={dehydrated:o,treeContext:pl!==null?{id:Pa,overflow:_a}:null,retryLane:536870912,hydrationErrors:null},m=aE(o),m.return=u,u.child=m,Qi=u,En=null)):o=null,o===null)throw vl(u);return u.lanes=536870912,null}return bg(u,g)}var k=o.memoizedState;if(k!==null){var _=k.dehydrated;if(n1(u),y)if(u.flags&256)u.flags&=-257,u=kA(o,u,m);else if(u.memoizedState!==null)u.child=o.child,u.flags|=128,u=null;else throw Error(i(558));else if(hi||rd(o,u,m,!1),y=(m&o.childLanes)!==0,hi||y){if(g=mn,g!==null&&(_=$n(g,m),_!==0&&_!==k.retryLane))throw k.retryLane=_,Cc(o,_),Hr(g,o,_),k1;_g(),u=kA(o,u,m)}else o=k.treeContext,En=_s(_.nextSibling),Qi=u,Rt=!0,gl=null,As=!1,o!==null&&cE(u,o),u=bg(u,g),u.flags|=4096;return u}return o=po(o.child,{mode:g.mode,children:g.children}),o.ref=u.ref,u.child=o,o.return=u,o}function wg(o,u){var m=u.ref;if(m===null)o!==null&&o.ref!==null&&(u.flags|=4194816);else{if(typeof m!="function"&&typeof m!="object")throw Error(i(284));(o===null||o.ref!==m)&&(u.flags|=4194816)}}function N1(o,u,m,g,y){return Pc(u),m=r1(o,u,m,g,void 0,y),g=s1(),o!==null&&!hi?(a1(o,u,y),wo(o,u,y)):(Rt&&g&&Bb(u),u.flags|=1,Ji(o,u,m,y),u.child)}function NA(o,u,m,g,y,k){return Pc(u),u.updateQueue=null,m=TE(u,g,m,y),CE(o),g=s1(),o!==null&&!hi?(a1(o,u,k),wo(o,u,k)):(Rt&&g&&Bb(u),u.flags|=1,Ji(o,u,m,k),u.child)}function jA(o,u,m,g,y){if(Pc(u),u.stateNode===null){var k=ed,_=m.contextType;typeof _=="object"&&_!==null&&(k=Xi(_)),k=new m(g,k),u.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=w1,u.stateNode=k,k._reactInternals=u,k=u.stateNode,k.props=g,k.state=u.memoizedState,k.refs={},Qb(u),_=m.contextType,k.context=typeof _=="object"&&_!==null?Xi(_):ed,k.state=u.memoizedState,_=m.getDerivedStateFromProps,typeof _=="function"&&(b1(u,m,_,g),k.state=u.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(_=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),_!==k.state&&w1.enqueueReplaceState(k,k.state,null),ff(u,g,k,y),hf(),k.state=u.memoizedState),typeof k.componentDidMount=="function"&&(u.flags|=4194308),g=!0}else if(o===null){k=u.stateNode;var D=u.memoizedProps,Y=Dc(m,D);k.props=Y;var de=k.context,Se=m.contextType;_=ed,typeof Se=="object"&&Se!==null&&(_=Xi(Se));var Ne=m.getDerivedStateFromProps;Se=typeof Ne=="function"||typeof k.getSnapshotBeforeUpdate=="function",D=u.pendingProps!==D,Se||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(D||de!==_)&&dA(u,k,g,_),yl=!1;var fe=u.memoizedState;k.state=fe,ff(u,g,k,y),hf(),de=u.memoizedState,D||fe!==de||yl?(typeof Ne=="function"&&(b1(u,m,Ne,g),de=u.memoizedState),(Y=yl||uA(u,m,Y,g,fe,de,_))?(Se||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(u.flags|=4194308)):(typeof k.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=g,u.memoizedState=de),k.props=g,k.state=de,k.context=_,g=Y):(typeof k.componentDidMount=="function"&&(u.flags|=4194308),g=!1)}else{k=u.stateNode,Xb(o,u),_=u.memoizedProps,Se=Dc(m,_),k.props=Se,Ne=u.pendingProps,fe=k.context,de=m.contextType,Y=ed,typeof de=="object"&&de!==null&&(Y=Xi(de)),D=m.getDerivedStateFromProps,(de=typeof D=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(_!==Ne||fe!==Y)&&dA(u,k,g,Y),yl=!1,fe=u.memoizedState,k.state=fe,ff(u,g,k,y),hf();var xe=u.memoizedState;_!==Ne||fe!==xe||yl||o!==null&&o.dependencies!==null&&ng(o.dependencies)?(typeof D=="function"&&(b1(u,m,D,g),xe=u.memoizedState),(Se=yl||uA(u,m,Se,g,fe,xe,Y)||o!==null&&o.dependencies!==null&&ng(o.dependencies))?(de||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(g,xe,Y),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(g,xe,Y)),typeof k.componentDidUpdate=="function"&&(u.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof k.componentDidUpdate!="function"||_===o.memoizedProps&&fe===o.memoizedState||(u.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||_===o.memoizedProps&&fe===o.memoizedState||(u.flags|=1024),u.memoizedProps=g,u.memoizedState=xe),k.props=g,k.state=xe,k.context=Y,g=Se):(typeof k.componentDidUpdate!="function"||_===o.memoizedProps&&fe===o.memoizedState||(u.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||_===o.memoizedProps&&fe===o.memoizedState||(u.flags|=1024),g=!1)}return k=g,wg(o,u),g=(u.flags&128)!==0,k||g?(k=u.stateNode,m=g&&typeof m.getDerivedStateFromError!="function"?null:k.render(),u.flags|=1,o!==null&&g?(u.child=Oc(u,o.child,null,y),u.child=Oc(u,null,m,y)):Ji(o,u,m,y),u.memoizedState=k.state,o=u.child):o=wo(o,u,y),o}function CA(o,u,m,g){return Ec(),u.flags|=256,Ji(o,u,m,g),u.child}var j1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function C1(o){return{baseLanes:o,cachePool:pE()}}function T1(o,u,m){return o=o!==null?o.childLanes&~m:0,u&&(o|=cs),o}function TA(o,u,m){var g=u.pendingProps,y=!1,k=(u.flags&128)!==0,_;if((_=k)||(_=o!==null&&o.memoizedState===null?!1:(ni.current&2)!==0),_&&(y=!0,u.flags&=-129),_=(u.flags&32)!==0,u.flags&=-33,o===null){if(Rt){if(y?Sl(u):kl(),(o=En)?(o=IP(o,As),o=o!==null&&o.data!=="&"?o:null,o!==null&&(u.memoizedState={dehydrated:o,treeContext:pl!==null?{id:Pa,overflow:_a}:null,retryLane:536870912,hydrationErrors:null},m=aE(o),m.return=u,u.child=m,Qi=u,En=null)):o=null,o===null)throw vl(u);return cw(o)?u.lanes=32:u.lanes=536870912,null}var D=g.children;return g=g.fallback,y?(kl(),y=u.mode,D=Sg({mode:"hidden",children:D},y),g=Tc(g,y,m,null),D.return=u,g.return=u,D.sibling=g,u.child=D,g=u.child,g.memoizedState=C1(m),g.childLanes=T1(o,_,m),u.memoizedState=j1,xf(null,g)):(Sl(u),E1(u,D))}var Y=o.memoizedState;if(Y!==null&&(D=Y.dehydrated,D!==null)){if(k)u.flags&256?(Sl(u),u.flags&=-257,u=A1(o,u,m)):u.memoizedState!==null?(kl(),u.child=o.child,u.flags|=128,u=null):(kl(),D=g.fallback,y=u.mode,g=Sg({mode:"visible",children:g.children},y),D=Tc(D,y,m,null),D.flags|=2,g.return=u,D.return=u,g.sibling=D,u.child=g,Oc(u,o.child,null,m),g=u.child,g.memoizedState=C1(m),g.childLanes=T1(o,_,m),u.memoizedState=j1,u=xf(null,g));else if(Sl(u),cw(D)){if(_=D.nextSibling&&D.nextSibling.dataset,_)var de=_.dgst;_=de,g=Error(i(419)),g.stack="",g.digest=_,af({value:g,source:null,stack:null}),u=A1(o,u,m)}else if(hi||rd(o,u,m,!1),_=(m&o.childLanes)!==0,hi||_){if(_=mn,_!==null&&(g=$n(_,m),g!==0&&g!==Y.retryLane))throw Y.retryLane=g,Cc(o,g),Hr(_,o,g),k1;lw(D)||_g(),u=A1(o,u,m)}else lw(D)?(u.flags|=192,u.child=o.child,u=null):(o=Y.treeContext,En=_s(D.nextSibling),Qi=u,Rt=!0,gl=null,As=!1,o!==null&&cE(u,o),u=E1(u,g.children),u.flags|=4096);return u}return y?(kl(),D=g.fallback,y=u.mode,Y=o.child,de=Y.sibling,g=po(Y,{mode:"hidden",children:g.children}),g.subtreeFlags=Y.subtreeFlags&65011712,de!==null?D=po(de,D):(D=Tc(D,y,m,null),D.flags|=2),D.return=u,g.return=u,g.sibling=D,u.child=g,xf(null,g),g=u.child,D=o.child.memoizedState,D===null?D=C1(m):(y=D.cachePool,y!==null?(Y=ui._currentValue,y=y.parent!==Y?{parent:Y,pool:Y}
vendor: 6,169 bytes, line 48
48:y):y=pE(),D={baseLanes:D.baseLanes|m,cachePool:y}),g.memoizedState=D,g.childLanes=T1(o,_,m),u.memoizedState=j1,xf(o.child,g)):(Sl(u),m=o.child,o=m.sibling,m=po(m,{mode:"visible",children:g.children}),m.return=u,m.sibling=null,o!==null&&(_=u.deletions,_===null?(u.deletions=[o],u.flags|=16):_.push(o)),u.child=m,u.memoizedState=null,m)}function E1(o,u){return u=Sg({mode:"visible",children:u},o.mode),u.return=o,o.child=u}function Sg(o,u){return o=ss(22,o,null,u),o.lanes=0,o}function A1(o,u,m){return Oc(u,o.child,null,m),o=E1(u,u.pendingProps.children),o.flags|=2,u.memoizedState=null,o}function EA(o,u,m){o.lanes|=u;var g=o.alternate;g!==null&&(g.lanes|=u),qb(o.return,u,m)}function P1(o,u,m,g,y,k){var _=o.memoizedState;_===null?o.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:g,tail:m,tailMode:y,treeForkCount:k}:(_.isBackwards=u,_.rendering=null,_.renderingStartTime=0,_.last=g,_.tail=m,_.tailMode=y,_.treeForkCount=k)}function AA(o,u,m){var g=u.pendingProps,y=g.revealOrder,k=g.tail;g=g.children;var _=ni.current,D=(_&2)!==0;if(D?(_=_&1|2,u.flags|=128):_&=1,ye(ni,_),Ji(o,u,g,m),g=Rt?sf:0,!D&&o!==null&&(o.flags&128)!==0)e:for(o=u.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&EA(o,m,u);else if(o.tag===19)EA(o,m,u);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===u)break e;for(;o.sibling===null;){if(o.return===null||o.return===u)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(m=u.child,y=null;m!==null;)o=m.alternate,o!==null&&ug(o)===null&&(y=m),m=m.sibling;m=y,m===null?(y=u.child,u.child=null):(y=m.sibling,m.sibling=null),P1(u,!1,y,m,k,g);break;case"backwards":case"unstable_legacy-backwards":for(m=null,y=u.child,u.child=null;y!==null;){if(o=y.alternate,o!==null&&ug(o)===null){u.child=y;break}o=y.sibling,y.sibling=m,m=y,y=o}P1(u,!0,m,null,k,g);break;case"together":P1(u,!1,null,null,void 0,g);break;default:u.memoizedState=null}return u.child}function wo(o,u,m){if(o!==null&&(u.dependencies=o.dependencies),Cl|=u.lanes,(m&u.childLanes)===0)if(o!==null){if(rd(o,u,m,!1),(m&u.childLanes)===0)return null}else return null;if(o!==null&&u.child!==o.child)throw Error(i(153));if(u.child!==null){for(o=u.child,m=po(o,o.pendingProps),u.child=m,m.return=u;o.sibling!==null;)o=o.sibling,m=m.sibling=po(o,o.pendingProps),m.return=u;m.sibling=null}return u.child}function _1(o,u){return(o.lanes&u)!==0?!0:(o=o.dependencies,!!(o!==null&&ng(o)))}function $7(o,u,m){switch(u.tag){case 3:ve(u,u.stateNode.containerInfo),xl(u,ui,o.memoizedState.cache),Ec();break;case 27:case 5:Be(u);break;case 4:ve(u,u.stateNode.containerInfo);break;case 10:xl(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,n1(u),null;break;case 13:var g=u.memoizedState;if(g!==null)return g.dehydrated!==null?(Sl(u),u.flags|=128,null):(m&u.child.childLanes)!==0?TA(o,u,m):(Sl(u),o=wo(o,u,m),o!==null?o.sibling:null);Sl(u);break;case 19:var y=(o.flags&128)!==0;if(g=(m&u.childLanes)!==0,g||(rd(o,u,m,!1),g=(m&u.childLanes)!==0),y){if(g)return AA(o,u,m);u.flags|=128}if(y=u.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ye(ni,ni.current),g)break;return null;case 22:return u.lanes=0,wA(o,u,m,u.pendingProps);case 24:xl(u,ui,o.memoizedState.cache)}return wo(o,u,m)}function PA(o,u,m){if(o!==null)if(o.memoizedProps!==u.pendingProps)hi=!0;else{if(!_1(o,m)&&(u.flags&128)===0)return hi=!1,$7(o,u,m);hi=(o.flags&131072)!==0}else hi=!1,Rt&&(u.flags&1048576)!==0&&lE(u,sf,u.index);switch(u.lanes=0,u.tag){case 16:e:{var g=u.pendingProps;if(o=Mc(u.elementType),u.type=o,typeof o=="function")Db(o)?(g=Dc(o,g),u.tag=1,u=jA(null,u,o,g,m)):(u.tag=0,u=N1(null,u,o,g,m));else{if(o!=null){var y=o.$$typeof;if(y===C){u.tag=11,u=xA(null,u,o,g,m);break e}else if(y===M){u.tag=14,u=yA(null,u,o,g,m);break e}}throw u=re(o)||o,Error(i(306,u,""))}}return u;case 0:return N1(o,u,u.type,u.pendingProps,m);case 1:return g=u.type,y=Dc(g,u.pendingProps),jA(o,u,g,y,m);case 3:e:{if(ve(u,u.stateNode.containerInfo),o===null)throw Error(i(387));g=u.pendingProps;var k=u.memoizedState;y=k.element,Xb(o,u),ff(u,g,null,m);var _=u.memoizedState;if(g=_.cache,xl(u,ui,g),g!==k.cache&&Wb(u,[ui],m,!0),hf(),g=_.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:_.cache},u.updateQueue.baseState=k,u.memoizedState=k,u.flags&256){u=CA(o,u,g,m);break e}else if(g!==y){y=Cs(Error(i(424)),u),af(y),u=CA(o,u,g,m);break e}else{switch(o=u.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(En=_s(o.firstChild),Qi=u,Rt=!0,gl=null,As=!0,m=wE(u,null,g,m),u.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling}else{if(Ec(),g===y){u=wo(o,u,m);break e}Ji(o,u,g,m)}u=u.child}return u;case 26:return wg(o,u),o===null?(m=$P(u.type,null,u.pendingProps,null))?u.memoizedState=m:Rt||(m=u.type,o=u.pendingProps,g=Ug(je.current).createElement(m),g[$t]=u,g[te]=o,Zi(g,m,o),X(g),u.stateNode=g):u.memoizedState=$P(u.type,o.memoizedProps,u.pendingProps,o.memoizedState),null;case 27:return Be(u),o===null&&Rt&&(g=u.stateNode=UP(u.type,u.pendingProps,je.current),Qi=u,As=!0,y=En,_l(u.type)?(uw=y,En=_s(g.firstChild)):En=y),Ji(o,u,u.pendingProps.children,m),wg(o,u),o===null&&(u.flags|=4194304),u.child;case 5:return o===null&&Rt&&((y=g=En)&&(g=vq(g,u.type,u.pendingProps,As),g!==null?(u.stateNode=g,Qi=u,En=_s(g.firstChild),As=!1,y=!0):y=!1),y||vl(u)),Be(u),y=u.type,k=u.pendingProps,_=o!==null?o.memoizedProps:null,g=k.children,sw(y,k)?g=null:_!==null&&sw(y,_)&&(u.flags|=32),u.memoizedState!==null&&(y=r1(o,u,M7,null,null,m),Rf._currentValue=y),wg(o,u),Ji(o,u,g,m),u.child;case 6:return o===null&&Rt&&((o=m=En)&&(m=xq(m,u.pendingProps,As),m!==null?(u.stateNode=m,Qi=u,En=null,o=!0):o=!1),o||vl(u)),null;case 13:return TA(o,u,m);case 4:return ve(u,u.stateNode.containerInfo),g=u.pendingProps,o===null?u.child=Oc(u,null,g,m):Ji(o,u,g,m),u.child;case 11:return xA(o,u,u.type,u.pendingProps,m);case 7:return Ji(o,u,u.pendingProps,m),u.child;case 8:return Ji(o,u,u.pendingProps.children,m),u.child;case 12:return Ji(o,u,u.pendingProps.children,m),u.child;case 10:return g=u.pendingProps,xl(u,u.type,g.value),Ji(o,u,g.children,m),u.child;
vendor: 4,272 bytes, line 48
48case 9:return y=u.type._context,g=u.pendingProps.children,Pc(u),y=Xi(y),g=g(y),u.flags|=1,Ji(o,u,g,m),u.child;case 14:return yA(o,u,u.type,u.pendingProps,m);case 15:return bA(o,u,u.type,u.pendingProps,m);case 19:return AA(o,u,m);case 31:return F7(o,u,m);case 22:return wA(o,u,m,u.pendingProps);case 24:return Pc(u),g=Xi(ui),o===null?(y=Gb(),y===null&&(y=mn,k=Hb(),y.pooledCache=k,k.refCount++,k!==null&&(y.pooledCacheLanes|=m),y=k),u.memoizedState={parent:g,cache:y},Qb(u),xl(u,ui,y)):((o.lanes&m)!==0&&(Xb(o,u),ff(u,null,null,m),hf()),y=o.memoizedState,k=u.memoizedState,y.parent!==g?(y={parent:g,cache:g},u.memoizedState=y,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=y),xl(u,ui,g)):(g=k.cache,xl(u,ui,g),g!==y.cache&&Wb(u,[ui],m,!0))),Ji(o,u,u.pendingProps.children,m),u.child;case 29:throw u.pendingProps}throw Error(i(156,u.tag))}function So(o){o.flags|=4}function M1(o,u,m,g,y){if((u=(o.mode&32)!==0)&&(u=!1),u){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(iP())o.flags|=8192;else throw Rc=ag,Yb}else o.flags&=-16777217}function _A(o,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!HP(u))if(iP())o.flags|=8192;else throw Rc=ag,Yb}function kg(o,u){u!==null&&(o.flags|=4),o.flags&16384&&(u=o.tag!==22?Gi():536870912,o.lanes|=u,gd|=u)}function yf(o,u){if(!Rt)switch(o.tailMode){case"hidden":u=o.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o.tail=null:m.sibling=null;break;case"collapsed":m=o.tail;for(var g=null;m!==null;)m.alternate!==null&&(g=m),m=m.sibling;g===null?u||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function An(o){var u=o.alternate!==null&&o.alternate.child===o.child,m=0,g=0;if(u)for(var y=o.child;y!==null;)m|=y.lanes|y.childLanes,g|=y.subtreeFlags&65011712,g|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)m|=y.lanes|y.childLanes,g|=y.subtreeFlags,g|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=g,o.childLanes=m,u}function V7(o,u,m){var g=u.pendingProps;switch(Fb(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return An(u),null;case 1:return An(u),null;case 3:return m=u.stateNode,g=null,o!==null&&(g=o.memoizedState.cache),u.memoizedState.cache!==g&&(u.flags|=2048),xo(ui),le(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(id(u)?So(u):o===null||o.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,Vb())),An(u),null;case 26:var y=u.type,k=u.memoizedState;return o===null?(So(u),k!==null?(An(u),_A(u,k)):(An(u),M1(u,y,null,g,m))):k?k!==o.memoizedState?(So(u),An(u),_A(u,k)):(An(u),u.flags&=-16777217):(o=o.memoizedProps,o!==g&&So(u),An(u),M1(u,y,o,g,m)),null;case 27:if(De(u),m=je.current,y=u.type,o!==null&&u.stateNode!=null)o.memoizedProps!==g&&So(u);else{if(!g){if(u.stateNode===null)throw Error(i(166));return An(u),null}o=Pe.current,id(u)?uE(u):(o=UP(y,g,m),u.stateNode=o,So(u))}return An(u),null;case 5:if(De(u),y=u.type,o!==null&&u.stateNode!=null)o.memoizedProps!==g&&So(u);else{if(!g){if(u.stateNode===null)throw Error(i(166));return An(u),null}if(k=Pe.current,id(u))uE(u);else{var _=Ug(je.current);switch(k){case 1:k=_.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:k=_.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":k=_.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":k=_.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":k=_.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof g.is=="string"?_.createElement("select",{is:g.is}):_.createElement("select"),g.multiple?k.multiple=!0:g.size&&(k.size=g.size);break;default:k=typeof g.is=="string"?_.createElement(y,{is:g.is}):_.createElement(y)}}k[$t]=u,k[te]=g;e:for(_=u.child;_!==null;){if(_.tag===5||_.tag===6)k.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===u)break e;for(;_.sibling===null;){if(_.return===null||_.return===u)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}u.stateNode=k;e:switch(Zi(k,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoF
vendor: 24,284 bytes, line 48
48ocus;break e;case"img":g=!0;break e;default:g=!1}g&&So(u)}}return An(u),M1(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,m),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&So(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(i(166));if(o=je.current,id(u)){if(o=u.stateNode,m=u.memoizedProps,g=null,y=Qi,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[$t]=u,o=!!(o.nodeValue===m||g!==null&&g.suppressHydrationWarning===!0||TP(o.nodeValue,m)),o||vl(u,!0)}else o=Ug(o).createTextNode(g),o[$t]=u,u.stateNode=o}return An(u),null;case 31:if(m=u.memoizedState,o===null||o.memoizedState!==null){if(g=id(u),m!==null){if(o===null){if(!g)throw Error(i(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));o[$t]=u}else Ec(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;An(u),o=!1}else m=Vb(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=m),o=!0;if(!o)return u.flags&256?(os(u),u):(os(u),null);if((u.flags&128)!==0)throw Error(i(558))}return An(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=id(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(i(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));y[$t]=u}else Ec(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;An(u),y=!1}else y=Vb(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(os(u),u):(os(u),null)}return os(u),(u.flags&128)!==0?(u.lanes=m,u):(m=g!==null,o=o!==null&&o.memoizedState!==null,m&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),k=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(k=g.memoizedState.cachePool.pool),k!==y&&(g.flags|=2048)),m!==o&&m&&(u.child.flags|=8192),kg(u,u.updateQueue),An(u),null);case 4:return le(),o===null&&ew(u.stateNode.containerInfo),An(u),null;case 10:return xo(u.type),An(u),null;case 19:if(J(ni),g=u.memoizedState,g===null)return An(u),null;if(y=(u.flags&128)!==0,k=g.rendering,k===null)if(y)yf(g,!1);else{if(Kn!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(k=ug(o),k!==null){for(u.flags|=128,yf(g,!1),o=k.updateQueue,u.updateQueue=o,kg(u,o),u.subtreeFlags=0,o=m,m=u.child;m!==null;)sE(m,o),m=m.sibling;return ye(ni,ni.current&1|2),Rt&&go(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&pt()>Eg&&(u.flags|=128,y=!0,yf(g,!1),u.lanes=4194304)}else{if(!y)if(o=ug(k),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,kg(u,o),yf(g,!0),g.tail===null&&g.tailMode==="hidden"&&!k.alternate&&!Rt)return An(u),null}else 2*pt()-g.renderingStartTime>Eg&&m!==536870912&&(u.flags|=128,y=!0,yf(g,!1),u.lanes=4194304);g.isBackwards?(k.sibling=u.child,u.child=k):(o=g.last,o!==null?o.sibling=k:u.child=k,g.last=k)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=pt(),o.sibling=null,m=ni.current,ye(ni,y?m&1|2:m&1),Rt&&go(u,g.treeForkCount),o):(An(u),null);case 22:case 23:return os(u),t1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(m&536870912)!==0&&(u.flags&128)===0&&(An(u),u.subtreeFlags&6&&(u.flags|=8192)):An(u),m=u.updateQueue,m!==null&&kg(u,m.retryQueue),m=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==m&&(u.flags|=2048),o!==null&&J(_c),null;case 24:return m=null,o!==null&&(m=o.memoizedState.cache),u.memoizedState.cache!==m&&(u.flags|=2048),xo(ui),An(u),null;case 25:return null;case 30:return null}throw Error(i(156,u.tag))}function z7(o,u){switch(Fb(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return xo(ui),le(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return De(u),null;case 31:if(u.memoizedState!==null){if(os(u),u.alternate===null)throw Error(i(340));Ec()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(os(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(i(340));Ec()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return J(ni),null;case 4:return le(),null;case 10:return xo(u.type),null;case 22:case 23:return os(u),t1(),o!==null&&J(_c),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return xo(ui),null;case 25:return null;default:return null}}function MA(o,u){switch(Fb(u),u.tag){case 3:xo(ui),le();break;case 26:case 27:case 5:De(u);break;case 4:le();break;case 31:u.memoizedState!==null&&os(u);break;case 13:os(u);break;case 19:J(ni);break;case 10:xo(u.type);break;case 22:case 23:os(u),t1(),o!==null&&J(_c);break;case 24:xo(ui)}}function bf(o,u){try{var m=u.updateQueue,g=m!==null?m.lastEffect:null;if(g!==null){var y=g.next;m=y;do{if((m.tag&o)===o){g=void 0;var k=m.create,_=m.inst;g=k(),_.destroy=g}m=m.next}while(m!==y)}}catch(D){sn(u,u.return,D)}}function Nl(o,u,m){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var k=y.next;g=k;do{if((g.tag&o)===o){var _=g.inst,D=_.destroy;if(D!==void 0){_.destroy=void 0,y=u;var Y=m,de=D;try{de()}catch(Se){sn(y,Y,Se)}}}g=g.next}while(g!==k)}}catch(Se){sn(u,u.return,Se)}}function RA(o){var u=o.updateQueue;if(u!==null){var m=o.stateNode;try{kE(u,m)}catch(g){sn(o,o.return,g)}}}function OA(o,u,m){m.props=Dc(o.type,o.memoizedProps),m.state=o.memoizedState;try{m.componentWillUnmount()}catch(g){sn(o,u,g)}}function wf(o,u){try{var m=o.ref;if(m!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof m=="function"?o.refCleanup=m(g):m.current=g}}catch(y){sn(o,u,y)}}function Ma(o,u){var m=o.ref,g=o.refCleanup;if(m!==null)if(typeof g=="function")try{g()}catch(y){sn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(y){sn(o,u,y)}else m.current=null}function IA(o){var u=o.type,m=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":m.autoFocus&&g.focus();break e;case"img":m.src?g.src=m.src:m.srcSet&&(g.srcset=m.srcSet)}}catch(y){sn(o,o.return,y)}}function R1(o,u,m){try{var g=o.stateNode;dq(g,o.type,m,u),g[te]=u}catch(y){sn(o,o.return,y)}}function DA(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&_l(o.type)||o.tag===4}function O1(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||DA(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&_l(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function I1(o,u,m){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(o,u):(u=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,u.appendChild(o),m=m._reactRootContainer,m!=null||u.onclick!==null||(u.onclick=Ns));else if(g!==4&&(g===27&&_l(o.type)&&(m=o.stateNode,u=null),o=o.child,o!==null))for(I1(o,u,m),o=o.sibling;o!==null;)I1(o,u,m),o=o.sibling}function Ng(o,u,m){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?m.insertBefore(o,u):m.appendChild(o);else if(g!==4&&(g===27&&_l(o.type)&&(m=o.stateNode),o=o.child,o!==null))for(Ng(o,u,m),o=o.sibling;o!==null;)Ng(o,u,m),o=o.sibling}function LA(o){var u=o.stateNode,m=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Zi(u,g,m),u[$t]=o,u[te]=m}catch(k){sn(o,o.return,k)}}var ko=!1,fi=!1,D1=!1,UA=typeof WeakSet=="function"?WeakSet:Set,Oi=null;function q7(o,u){if(o=o.containerInfo,iw=Wg,o=Q2(o),Ab(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var g=m.getSelection&&m.getSelection();if(g&&g.rangeCount!==0){m=g.anchorNode;var y=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{m.nodeType,k.nodeType}catch{m=null;break e}var _=0,D=-1,Y=-1,de=0,Se=0,Ne=o,fe=null;t:for(;;){for(var xe;Ne!==m||y!==0&&Ne.nodeType!==3||(D=_+y),Ne!==k||g!==0&&Ne.nodeType!==3||(Y=_+g),Ne.nodeType===3&&(_+=Ne.nodeValue.length),(xe=Ne.firstChild)!==null;)fe=Ne,Ne=xe;for(;;){if(Ne===o)break t;if(fe===m&&++de===y&&(D=_),fe===k&&++Se===g&&(Y=_),(xe=Ne.nextSibling)!==null)break;Ne=fe,fe=Ne.parentNode}Ne=xe}m=D===-1||Y===-1?null:{start:D,end:Y}}else m=null}m=m||{start:0,end:0}}else m=null;for(rw={focusedElem:o,selectionRange:m},Wg=!1,Oi=u;Oi!==null;)if(u=Oi,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,Oi=o;else for(;Oi!==null;){switch(u=Oi,k=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(m=0;m<o.length;m++)y=o[m],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&k!==null){o=void 0,m=u,y=k.memoizedProps,k=k.memoizedState,g=m.stateNode;try{var Ye=Dc(m.type,y);o=g.getSnapshotBeforeUpdate(Ye,k),g.__reactInternalSnapshotBeforeUpdate=o}catch(ut){sn(m,m.return,ut)}}break;case 3:if((o&1024)!==0){if(o=u.stateNode.containerInfo,m=o.nodeType,m===9)ow(o);else if(m===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":ow(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(i(163))}if(o=u.sibling,o!==null){o.return=u.return,Oi=o;break}Oi=u.return}}function BA(o,u,m){var g=m.flags;switch(m.tag){case 0:case 11:case 15:jo(o,m),g&4&&bf(5,m);break;case 1:if(jo(o,m),g&4)if(o=m.stateNode,u===null)try{o.componentDidMount()}catch(_){sn(m,m.return,_)}else{var y=Dc(m.type,u.memoizedProps);u=u.memoizedState;try{o.componentDidUpdate(y,u,o.__reactInternalSnapshotBeforeUpdate)}catch(_){sn(m,m.return,_)}}g&64&&RA(m),g&512&&wf(m,m.return);break;case 3:if(jo(o,m),g&64&&(o=m.updateQueue,o!==null)){if(u=null,m.child!==null)switch(m.child.tag){case 27:case 5:u=m.child.stateNode;break;case 1:u=m.child.stateNode}try{kE(o,u)}catch(_){sn(m,m.return,_)}}break;case 27:u===null&&g&4&&LA(m);case 26:case 5:jo(o,m),u===null&&g&4&&IA(m),g&512&&wf(m,m.return);break;case 12:jo(o,m);break;case 31:jo(o,m),g&4&&VA(o,m);break;case 13:jo(o,m),g&4&&zA(o,m),g&64&&(o=m.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(m=Z7.bind(null,m),yq(o,m))));break;case 22:if(g=m.memoizedState!==null||ko,!g){u=u!==null&&u.memoizedState!==null||fi,y=ko;var k=fi;ko=g,(fi=u)&&!k?Co(o,m,(m.subtreeFlags&8772)!==0):jo(o,m),ko=y,fi=k}break;case 30:break;default:jo(o,m)}}function FA(o){var u=o.alternate;u!==null&&(o.alternate=null,FA(u)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(u=o.stateNode,u!==null&&V(u)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Dn=null,Vr=!1;function No(o,u,m){for(m=m.child;m!==null;)$A(o,u,m),m=m.sibling}function $A(o,u,m){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(Zn,m)}catch{}switch(m.tag){case 26:fi||Ma(m,u),No(o,u,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:fi||Ma(m,u);var g=Dn,y=Vr;_l(m.type)&&(Dn=m.stateNode,Vr=!1),No(o,u,m),Pf(m.stateNode),Dn=g,Vr=y;break;case 5:fi||Ma(m,u);case 6:if(g=Dn,y=Vr,Dn=null,No(o,u,m),Dn=g,Vr=y,Dn!==null)if(Vr)try{(Dn.nodeType===9?Dn.body:Dn.nodeName==="HTML"?Dn.ownerDocument.body:Dn).removeChild(m.stateNode)}catch(k){sn(m,u,k)}else try{Dn.removeChild(m.stateNode)}catch(k){sn(m,u,k)}break;case 18:Dn!==null&&(Vr?(o=Dn,RP(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,m.stateNode),Nd(o)):RP(Dn,m.stateNode));break;case 4:g=Dn,y=Vr,Dn=m.stateNode.containerInfo,Vr=!0,No(o,u,m),Dn=g,Vr=y;break;case 0:case 11:case 14:case 15:Nl(2,m,u),fi||Nl(4,m,u),No(o,u,m);break;case 1:fi||(Ma(m,u),g=m.stateNode,typeof g.componentWillUnmount=="function"&&OA(m,u,g)),No(o,u,m);break;case 21:No(o,u,m);break;case 22:fi=(g=fi)||m.memoizedState!==null,No(o,u,m),fi=g;break;default:No(o,u,m)}}function VA(o,u){if(u.memoizedState===null&&(o=u.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Nd(o)}catch(m){sn(u,u.return,m)}}}function zA(o,u){if(u.memoizedState===null&&(o=u.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Nd(o)}catch(m){sn(u,u.return,m)}}function W7(o){switch(o.tag){case 31:case 13:case 19:var u=o.stateNode;return u===null&&(u=o.stateNode=new UA),u;case 22:return o=o.stateNode,u=o._retryCache,u===null&&(u=o._retryCache=new UA),u;default:throw Error(i(435,o.tag))}}function jg(o,u){var m=W7(o);u.forEach(function(g){if(!m.has(g)){m.add(g);var y=eq.bind(null,o,g);g.then(y,y)}})}function zr(o,u){var m=u.deletions;if(m!==null)for(var g=0;g<m.length;g++){var y=m[g],k=o,_=u,D=_;e:for(;D!==null;){switch(D.tag){case 27:if(_l(D.type)){Dn=D.stateNode,Vr=!1;break e}break;case 5:Dn=D.stateNode,Vr=!1;break e;case 3:case 4:Dn=D.stateNode.containerInfo,Vr=!0;break e}D=D.return}if(Dn===null)throw Error(i(160));$A(k,_,y),Dn=null,Vr=!1,k=y.alternate,k!==null&&(k.return=null),y.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)qA(u,o),u=u.sibling}var Zs=null;function qA(o,u){var m=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:zr(u,o),qr(o),g&4&&(Nl(3,o,o.return),bf(3,o),Nl(5,o,o.return));break;case 1:zr(u,o),qr(o),g&512&&(fi||m===null||Ma(m,m.return)),g&64&&ko&&(o=o.updateQueue,o!==null&&(g=o.callbacks,g!==null&&(m=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=m===null?g:m.concat(g))));break;case 26:var y=Zs;if(zr(u,o),qr(o),g&512&&(fi||m===null||Ma(m,m.return)),g&4){var k=m!==null?m.memoizedState:null;if(g=o.memoizedState,m===null)if(g===null)if(o.stateNode===null){e:{g=o.type,m=o.memoizedProps,y=y.ownerDocument||y;t:switch(g){case"title":k=y.getElementsByTagName("title")[0],(!k||k[G]||k[$t]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=y.createElement(g),y.head.insertBefore(k,y.querySelector("head > title"))),Zi(k,g,m),k[$t]=o,X(k),g=k;break e;case"link":var _=qP("link","href",y).get(g+(m.href||""));if(_){for(var D=0;D<_.length;D++)if(k=_[D],k.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&k.getAttribute("rel")===(m.rel==null?null:m.rel)&&k.getAttribute("title")===(m.title==null?null:m.title)&&k.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){_.splice(D,1);break t}}k=y.createElement(g),Zi(k,g,m),y.head.appendChild(k);break;case"meta":if(_=qP("meta","content",y).get(g+(m.content||""))){for(D=0;D<_.length;D++)if(k=_[D],k.getAttribute("content")===(m.content==null?null:""+m.content)&&k.getAttribute("name")===(m.name==null?null:m.name)&&k.getAttribute("property")===(m.property==null?null:m.property)&&k.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&k.getAttribute("charset")===(m.charSet==null?null:m.charSet)){_.splice(D,1);break t}}k=y.createElement(g),Zi(k,g,m),y.head.appendChild(k);break;default:throw Error(i(468,g))}k[$t]=o,X(k),g=k}o.stateNode=g}else WP(y,o.type,o.stateNode);else o.stateNode=zP(y,g,o.memoizedProps);else k!==g?(k===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):k.count--,g===null?WP(y,o.type,o.stateNode):zP(y,g,o.memoizedProps)):g===null&&o.stateNode!==null&&R1(o,o.memoizedProps,m.memoizedProps)}break;case 27:zr(u,o),qr(o),g&512&&(fi||m===null||Ma(m,m.return)),m!==null&&g&4&&R1(o,o.memoizedProps,m.memoizedProps);break;case 5:if(zr(u,o),qr(o),g&512&&(fi||m===null||Ma(m,m.return)),o.flags&32){y=o.stateNode;try{fl(y,"")}catch(Ye){sn(o,o.return,Ye)}}g&4&&o.stateNode!=null&&(y=o.memoizedProps,R1(o,y,m!==null?m.memoizedProps:y)),g&1024&&(D1=!0);break;case 6:if(zr(u,o),qr(o),g&4){if(o.stateNode===null)throw Error(i(162));g=o.memoizedProps,m=o.stateNode;try{m.nodeValue=g}catch(Ye){sn(o,o.return,Ye)}}break;case 3:if($g=null,y=Zs,Zs=Bg(u.containerInfo),zr(u,o),Zs=y,qr(o),g&4&&m!==null&&m.memoizedState.isDehydrated)try{Nd(u.containerInfo)}catch(Ye){sn(o,o.return,Ye)}D1&&(D1=!1,WA(o));break;case 4:g=Zs,Zs=Bg(o.stateNode.containerInfo),zr(u,o),qr(o),Zs=g;break;case 12:zr(u,o),qr(o);break;case 31:zr(u,o),qr(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,jg(o,g)));break;case 13:zr(u,o),qr(o),o.child.flags&8192&&o.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(Tg=pt()),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,jg(o,g)));break;case 22:y=o.memoizedState!==null;var Y=m!==null&&m.memoizedState!==null,de=ko,Se=fi;if(ko=de||y,fi=Se||Y,zr(u,o),fi=Se,ko=de,qr(o),g&8192)e:for(u=o.stateNode,u._visibility=y?u._visibility&-2:u._visibility|1,y&&(m===null||Y||ko||fi||Lc(o)),m=null,u=o;;){if(u.tag===5||u.tag===26){if(m===null){Y=m=u;try{if(k=Y.stateNode,y)_=k.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{D=Y.stateNode;var Ne=Y.memoizedProps.style,fe=Ne!=null&&Ne.hasOwnProperty("display")?Ne.display:null;D.style.display=fe==null||typeof fe=="boolean"?"":(""+fe).trim()}}catch(Ye){sn(Y,Y.return,Ye)}}}else if(u.tag===6){if(m===null){Y=u;try{Y.stateNode.nodeValue=y?"":Y.memoizedProps}catch(Ye){sn(Y,Y.return,Ye)}}}else if(u.tag===18){if(m===null){Y=u;try{var xe=Y.stateNode;y?OP(xe,!0):OP(Y.stateNode,!1)}catch(Ye){sn(Y,Y.return,Ye)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===o)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break e;for(;u.sibling===null;){if(u.return===null||u.return===o)break e;m===u&&(m=null),u=u.return}m===u&&(m=null),u.sibling.return=u.return,u=u.sibling}g&4&&(g=o.updateQueue,g!==null&&(m=g.retryQueue,m!==null&&(g.retryQueue=null,jg(o,m))));break;case 19:zr(u,o),qr(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,jg(o,g)));break;case 30:break;case 21:break;default:zr(u,o),qr(o)}}function qr(o){var u=o.flags;if(u&2){try{for(var m,g=o.return;g!==null;){if(DA(g)){m=g;break}g=g.return}if(m==null)throw Error(i(160));switch(m.tag){case 27:var y=m.stateNode,k=O1(o);Ng(o,k,y);break;case 5:var _=m.stateNode;m.flags&32&&(fl(_,""),m.flags&=-33);var D=O1(o);Ng(o,D,_);break;case 3:case 4:var Y=m.stateNode.containerInfo,de=O1(o);I1(o,de,Y);break;default:throw Error(i(161))}}catch(Se){sn(o,o.return,Se)}o.flags&=-3}u&4096&&(o.flags&=-4097)}function WA(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var u=o;WA(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),o=o.sibling}}function jo(o,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)BA(o,u.alternate,u),u=u.sibling}function Lc(o){for(o=o.child;o!==null;){var u=o;switch(u.tag){case 0:case 11:case 14:case 15:Nl(4,u,u.return),Lc(u);break;case 1:Ma(u,u.return);var m=u.stateNode;typeof m.componentWillUnmount=="function"&&OA(u,u.return,m),Lc(u);break;case 27:Pf(u.stateNode);case 26:case 5:Ma(u,u.return),Lc(u);break;case 22:u.memoizedState===null&&Lc(u);break;case 30:Lc(u);break;default:Lc(u)}o=o.sibling}}function Co(o,u,m){for(m=m&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var g=u.alternate,y=o,k=u,_=k.flags;switch(k.tag){case 0:case 11:case 15:Co(y,k,m),bf(4,k);break;case 1:if(Co(y,k,m),g=k,y=g.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(de){sn(g,g.return,de)}if(g=k,y=g.updateQueue,y!==null){var D=g.stateNode;try{var Y=y.shared.hiddenCallbacks;if(Y!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Y.length;y++)SE(Y[y],D)}catch(de){sn(g,g.return,de)}}m&&_&64&&RA(k),wf(k,k.return);break;case 27:LA(k);case 26:case 5:Co(y,k,m),m&&g===null&&_&4&&IA(k),wf(k,k.return);break;case 12:Co(y,k,m);break;case 31:Co(y,k,m),m&&_&4&&VA(y,k);break;case 13:Co(y,k,m),m&&_&4&&zA(y,k);break;case 22:k.memoizedState===null&&Co(y,k,m),wf(k,k.return);break;case 30:break;default:Co(y,k,m)}u=u.sibling}}function L1(o,u){var m=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),o=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(o=u.memoizedState.cachePool.pool),o!==m&&(o!=null&&o.refCount++,m!=null&&of(m))}function U1(o,u){o=null,u.alternate!==null&&(o=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==o&&(u.refCount++,o!=null&&of(o))}function ea(o,u,m,g){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)HA(o,u,m,g),u=u.sibling}function HA(o,u,m,g){var y=u.flags;switch(u.tag){case 0:case 11:case 15:ea(o,u,m,g),y&2048&&bf(9,u);break;case 1:ea(o,u,m,g);break;case 3:ea(o,u,m,g),y&2048&&(o=null,u.alternate!==null&&(o=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==o&&(u.refCount++,o!=null&&of(o)));break;case 12:if(y&2048){ea(o,u,m,g),o=u.stateNode;try{var k=u.memoizedProps,_=k.id,D=k.onPostCommit;typeof D=="function"&&D(_,u.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Y){sn(u,u.return,Y)}}else ea(o,u,m,g);break;case 31:ea(o,u,m,g);break;case 13:ea(o,u,m,g);break;case 23:break;case 22:k=u.stateNode,_=u.alternate,u.memoizedState!==null?k._visibility&2?ea(o,u,m,g):Sf(o,u):k._visibility&2?ea(o,u,m,g):(k._visibility|=2,fd(o,u,m,g,(u.subtreeFlags&10256)!==0||!1)),y&2048&&L1(_,u);break;case 24:ea(o,u,m,g),y&2048&&U1(u.alternate,u);break;default:ea(o,u,m,g)}}function fd(o,u,m,g,y){for(y=y&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var k=o,_=u,D=m,Y=g,de=_.flags;switch(_.tag){case 0:case 11:case 15:fd(k,_,D,Y,y),bf(8,_);break;case 23:break;case 22:var Se=_.stateNode;_.memoizedState!==null?Se._visibility&2?fd(k,_,D,Y,y):Sf(k,_):(Se._visibility|=2,fd(k,_,D,Y,y)),y&&de&2048&&L1(_.alternate,_);break;case 24:fd(k,_,D,Y,y),y&&de&2048&&U1(_.alternate,_);break;default:fd(k,_,D,Y,y)}u=u.sibling}}function Sf(o,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var m=o,g=u,y=g.flags;switch(g.tag){case 22:Sf(m,g),y&2048&&L1(g.alternate,g);break;case 24:Sf(m,g),y&2048&&U1(g.alternate,g);break;default:Sf(m,g)}u=u.sibling}}var kf=8192;function md(o,u,m){if(o.subtreeFlags&kf)for(o=o.child;o!==null;)KA(o,u,m),o=o.sibling}function KA(o,u,m){switch(o.tag){case 26:md(o,u,m),o.flags&kf&&o.memoizedState!==null&&_q(m,Zs,o.memoizedState,o.memoizedProps);break;case 5:md(o,u,m);break;case 3:case 4:var g=Zs;Zs=Bg(o.stateNode.containerInfo),md(o,u,m),Zs=g;break;case 22:o.memoizedState===null&&(g=o.alternate,g!==null&&g.memoizedState!==null?(g=kf,kf=16777216,md(o,u,m),kf=g):md(o,u,m));break;default:md(o,u,m)}}function GA(o){var u=o.alternate;if(u!==null&&(o=u.child,o!==null)){u.child=null;do u=o.sibling,o.sibling=null,o=u;while(o!==null)}}function Nf(o){var u=o.deletions;if((o.flags&16)!==0){if(u!==null)for(var m=0;m<u.length;m++){var g=u[m];Oi=g,QA(g,o)}GA(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)YA(o),o=o.sibling}function YA(o){switch(o.tag){case 0:case 11:case 15:Nf(o),o.flags&2048&&Nl(9,o,o.return);break;case 3:Nf(o);break;case 12:Nf(o);break;case 22:var u=o.stateNode;o.memoizedState!==null&&u._visibility&2&&(o.return===null||o.return.tag!==13)?(u._visibility&=-3,Cg(o)):Nf(o);break;default:Nf(o)}}function Cg(o){var u=o.deletions;if((o.flags&16)!==0){if(u!==null)for(var m=0;m<u.length;m++){var g=u[m];Oi=g,QA(g,o)}GA(o)}for(o=o.child;o!==null;){switch(u=o,u.tag){case 0:case 11:case 15:Nl(8,u,u.return),Cg(u);break;case 22:m=u.stateNode,m._visibility&2&&(m._visibility&=-3,Cg(u));break;default:Cg(u)}o=o.sibling}}function QA(o,u){for(;Oi!==null;){var m=Oi;switch(m.tag){case 0:case 11:case 15:Nl(8,m,u);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var g=m.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:of(m.memoizedState.cache)}if(g=m.child,g!==null)g.return=m,Oi=g;else e:for(m=o;Oi!==null;){g=Oi;var y=g.sibling,k=g.return;if(FA(g),g===m){Oi=null;break e}if(y!==null){y.return=k,Oi=y;break e}Oi=k}}}var H7={getCacheForType:function(o){var u=Xi(ui),m=u.data.get(o);return m===void 0&&(m=o(),u.data.set(o,m)),m},cacheSignal:function(){return Xi(ui).controller.signal}},K7=typeof WeakMap=="function"?WeakMap:Map,Xt=0,mn=null,Tt=null,Pt=0,rn=0,ls=null,jl=!1,pd=!1,B1=!1,To=0,Kn=0,Cl=0,Uc=0,F1=0,cs=0,gd=0,jf=null,Wr=null,$1=!1,Tg=0,XA=0,Eg=1/0,Ag=null,Tl=null,ki=0,El=null,vd=null,Eo=0,V1=0,z1=null,JA=null,Cf=0,q1=null;function us(){return(Xt&2)!==0&&Pt!==0?Pt&-Pt:W.T!==null?Q1():ot()}function ZA(){if(cs===0)if((Pt&536870912)===0||Rt){var o=Dt;Dt<<=1,(Dt&3932160)===0&&(Dt=262144),cs=o}else cs=536870912;return o=as.current,o!==null&&(o.flags|=32),cs}
vendor: 14,441 bytes, line 48
48function Hr(o,u,m){(o===mn&&(rn===2||rn===9)||o.cancelPendingCommit!==null)&&(xd(o,0),Al(o,Pt,cs,!1)),Yi(o,m),((Xt&2)===0||o!==mn)&&(o===mn&&((Xt&2)===0&&(Uc|=m),Kn===4&&Al(o,Pt,cs,!1)),Ra(o))}function eP(o,u,m){if((Xt&6)!==0)throw Error(i(327));var g=!m&&(u&127)===0&&(u&o.expiredLanes)===0||jt(o,u),y=g?Q7(o,u):H1(o,u,!0),k=g;do{if(y===0){pd&&!g&&Al(o,u,0,!1);break}else{if(m=o.current.alternate,k&&!G7(m)){y=H1(o,u,!1),k=!1;continue}if(y===2){if(k=u,o.errorRecoveryDisabledLanes&k)var _=0;else _=o.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){u=_;e:{var D=o;y=jf;var Y=D.current.memoizedState.isDehydrated;if(Y&&(xd(D,_).flags|=256),_=H1(D,_,!1),_!==2){if(B1&&!Y){D.errorRecoveryDisabledLanes|=k,Uc|=k,y=4;break e}k=Wr,Wr=y,k!==null&&(Wr===null?Wr=k:Wr.push.apply(Wr,k))}y=_}if(k=!1,y!==2)continue}}if(y===1){xd(o,0),Al(o,u,0,!0);break}e:{switch(g=o,k=y,k){case 0:case 1:throw Error(i(345));case 4:if((u&4194048)!==u)break;case 6:Al(g,u,cs,!jl);break e;case 2:Wr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((u&62914560)===u&&(y=Tg+300-pt(),10<y)){if(Al(g,u,cs,!jl),Ft(g,0,!0)!==0)break e;Eo=u,g.timeoutHandle=_P(tP.bind(null,g,m,Wr,Ag,$1,u,cs,Uc,gd,jl,k,"Throttled",-0,0),y);break e}tP(g,m,Wr,Ag,$1,u,cs,Uc,gd,jl,k,null,-0,0)}}break}while(!0);Ra(o)}function tP(o,u,m,g,y,k,_,D,Y,de,Se,Ne,fe,xe){if(o.timeoutHandle=-1,Ne=u.subtreeFlags,Ne&8192||(Ne&16785408)===16785408){Ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ns},KA(u,k,Ne);var Ye=(k&62914560)===k?Tg-pt():(k&4194048)===k?XA-pt():0;if(Ye=Mq(Ne,Ye),Ye!==null){Eo=k,o.cancelPendingCommit=Ye(cP.bind(null,o,u,k,m,g,y,_,D,Y,Se,Ne,null,fe,xe)),Al(o,k,_,!de);return}}cP(o,u,k,m,g,y,_,D,Y)}function G7(o){for(var u=o;;){var m=u.tag;if((m===0||m===11||m===15)&&u.flags&16384&&(m=u.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var g=0;g<m.length;g++){var y=m[g],k=y.getSnapshot;y=y.value;try{if(!rs(k(),y))return!1}catch{return!1}}if(m=u.child,u.subtreeFlags&16384&&m!==null)m.return=u,u=m;else{if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function Al(o,u,m,g){u&=~F1,u&=~Uc,o.suspendedLanes|=u,o.pingedLanes&=~u,g&&(o.warmLanes|=u),g=o.expirationTimes;for(var y=u;0<y;){var k=31-Ut(y),_=1<<k;g[k]=-1,y&=~_}m!==0&&Mi(o,m,u)}function Pg(){return(Xt&6)===0?(Tf(0),!1):!0}function W1(){if(Tt!==null){if(rn===0)var o=Tt.return;else o=Tt,vo=Ac=null,o1(o),ld=null,cf=0,o=Tt;for(;o!==null;)MA(o.alternate,o),o=o.return;Tt=null}}function xd(o,u){var m=o.timeoutHandle;m!==-1&&(o.timeoutHandle=-1,mq(m)),m=o.cancelPendingCommit,m!==null&&(o.cancelPendingCommit=null,m()),Eo=0,W1(),mn=o,Tt=m=po(o.current,null),Pt=u,rn=0,ls=null,jl=!1,pd=jt(o,u),B1=!1,gd=cs=F1=Uc=Cl=Kn=0,Wr=jf=null,$1=!1,(u&8)!==0&&(u|=u&32);var g=o.entangledLanes;if(g!==0)for(o=o.entanglements,g&=u;0<g;){var y=31-Ut(g),k=1<<y;u|=o[y],g&=~k}return To=u,Xp(),m}function nP(o,u){wt=null,W.H=vf,u===od||u===sg?(u=xE(),rn=3):u===Yb?(u=xE(),rn=4):rn=u===k1?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,ls=u,Tt===null&&(Kn=1,yg(o,Cs(u,o.current)))}function iP(){var o=as.current;return o===null?!0:(Pt&4194048)===Pt?Ps===null:(Pt&62914560)===Pt||(Pt&536870912)!==0?o===Ps:!1}function rP(){var o=W.H;return W.H=vf,o===null?vf:o}function sP(){var o=W.A;return W.A=H7,o}function _g(){Kn=4,jl||(Pt&4194048)!==Pt&&as.current!==null||(pd=!0),(Cl&134217727)===0&&(Uc&134217727)===0||mn===null||Al(mn,Pt,cs,!1)}function H1(o,u,m){var g=Xt;Xt|=2;var y=rP(),k=sP();(mn!==o||Pt!==u)&&(Ag=null,xd(o,u)),u=!1;var _=Kn;e:do try{if(rn!==0&&Tt!==null){var D=Tt,Y=ls;switch(rn){case 8:W1(),_=6;break e;case 3:case 2:case 9:case 6:as.current===null&&(u=!0);var de=rn;if(rn=0,ls=null,yd(o,D,Y,de),m&&pd){_=0;break e}break;default:de=rn,rn=0,ls=null,yd(o,D,Y,de)}}Y7(),_=Kn;break}catch(Se){nP(o,Se)}while(!0);return u&&o.shellSuspendCounter++,vo=Ac=null,Xt=g,W.H=y,W.A=k,Tt===null&&(mn=null,Pt=0,Xp()),_}function Y7(){for(;Tt!==null;)aP(Tt)}function Q7(o,u){var m=Xt;Xt|=2;var g=rP(),y=sP();mn!==o||Pt!==u?(Ag=null,Eg=pt()+500,xd(o,u)):pd=jt(o,u);e:do try{if(rn!==0&&Tt!==null){u=Tt;var k=ls;t:switch(rn){case 1:rn=0,ls=null,yd(o,u,k,1);break;case 2:case 9:if(gE(k)){rn=0,ls=null,oP(u);break}u=function(){rn!==2&&rn!==9||mn!==o||(rn=7),Ra(o)},k.then(u,u);break e;case 3:rn=7;break e;case 4:rn=5;break e;case 7:gE(k)?(rn=0,ls=null,oP(u)):(rn=0,ls=null,yd(o,u,k,7));break;case 5:var _=null;switch(Tt.tag){case 26:_=Tt.memoizedState;case 5:case 27:var D=Tt;if(_?HP(_):D.stateNode.complete){rn=0,ls=null;var Y=D.sibling;if(Y!==null)Tt=Y;else{var de=D.return;de!==null?(Tt=de,Mg(de)):Tt=null}break t}}rn=0,ls=null,yd(o,u,k,5);break;case 6:rn=0,ls=null,yd(o,u,k,6);break;case 8:W1(),Kn=6;break e;default:throw Error(i(462))}}X7();break}catch(Se){nP(o,Se)}while(!0);return vo=Ac=null,W.H=g,W.A=y,Xt=m,Tt!==null?0:(mn=null,Pt=0,Xp(),Kn)}function X7(){for(;Tt!==null&&!Qt();)aP(Tt)}function aP(o){var u=PA(o.alternate,o,To);o.memoizedProps=o.pendingProps,u===null?Mg(o):Tt=u}function oP(o){var u=o,m=u.alternate;switch(u.tag){case 15:case 0:u=NA(m,u,u.pendingProps,u.type,void 0,Pt);break;case 11:u=NA(m,u,u.pendingProps,u.type.render,u.ref,Pt);break;case 5:o1(u);default:MA(m,u),u=Tt=sE(u,To),u=PA(m,u,To)}o.memoizedProps=o.pendingProps,u===null?Mg(o):Tt=u}function yd(o,u,m,g){vo=Ac=null,o1(u),ld=null,cf=0;var y=u.return;try{if(B7(o,y,u,m,Pt)){Kn=1,yg(o,Cs(m,o.current)),Tt=null;return}}catch(k){if(y!==null)throw Tt=y,k;Kn=1,yg(o,Cs(m,o.current)),Tt=null;return}u.flags&32768?(Rt||g===1?o=!0:pd||(Pt&536870912)!==0?o=!1:(jl=o=!0,(g===2||g===9||g===3||g===6)&&(g=as.current,g!==null&&g.tag===13&&(g.flags|=16384))),lP(u,o)):Mg(u)}function Mg(o){var u=o;do{if((u.flags&32768)!==0){lP(u,jl);return}o=u.return;var m=V7(u.alternate,u,To);if(m!==null){Tt=m;return}if(u=u.sibling,u!==null){Tt=u;return}Tt=u=o}while(u!==null);Kn===0&&(Kn=5)}function lP(o,u){do{var m=z7(o.alternate,o);if(m!==null){m.flags&=32767,Tt=m;return}if(m=o.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!u&&(o=o.sibling,o!==null)){Tt=o;return}Tt=o=m}while(o!==null);Kn=6,Tt=null}function cP(o,u,m,g,y,k,_,D,Y){o.cancelPendingCommit=null;do Rg();while(ki!==0);if((Xt&6)!==0)throw Error(i(327));if(u!==null){if(u===o.current)throw Error(i(177));if(k=u.lanes|u.childLanes,k|=Ob,In(o,m,k,_,D,Y),o===mn&&(Tt=mn=null,Pt=0),vd=u,El=o,Eo=m,V1=k,z1=y,JA=g,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,tq(zt,function(){return mP(),null})):(o.callbackNode=null,o.callbackPriority=0),g=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||g){g=W.T,W.T=null,y=q.p,q.p=2,_=Xt,Xt|=4;try{q7(o,u,m)}finally{Xt=_,q.p=y,W.T=g}}ki=1,uP(),dP(),hP()}}function uP(){if(ki===1){ki=0;var o=El,u=vd,m=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||m){m=W.T,W.T=null;var g=q.p;q.p=2;var y=Xt;Xt|=4;try{qA(u,o);var k=rw,_=Q2(o.containerInfo),D=k.focusedElem,Y=k.selectionRange;if(_!==D&&D&&D.ownerDocument&&Y2(D.ownerDocument.documentElement,D)){if(Y!==null&&Ab(D)){var de=Y.start,Se=Y.end;if(Se===void 0&&(Se=de),"selectionStart"in D)D.selectionStart=de,D.selectionEnd=Math.min(Se,D.value.length);else{var Ne=D.ownerDocument||document,fe=Ne&&Ne.defaultView||window;if(fe.getSelection){var xe=fe.getSelection(),Ye=D.textContent.length,ut=Math.min(Y.start,Ye),dn=Y.end===void 0?ut:Math.min(Y.end,Ye);!xe.extend&&ut>dn&&(_=dn,dn=ut,ut=_);var ae=G2(D,ut),ee=G2(D,dn);if(ae&&ee&&(xe.rangeCount!==1||xe.anchorNode!==ae.node||xe.anchorOffset!==ae.offset||xe.focusNode!==ee.node||xe.focusOffset!==ee.offset)){var ce=Ne.createRange();ce.setStart(ae.node,ae.offset),xe.removeAllRanges(),ut>dn?(xe.addRange(ce),xe.extend(ee.node,ee.offset)):(ce.setEnd(ee.node,ee.offset),xe.addRange(ce))}}}}for(Ne=[],xe=D;xe=xe.parentNode;)xe.nodeType===1&&Ne.push({element:xe,left:xe.scrollLeft,top:xe.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<Ne.length;D++){var ke=Ne[D];ke.element.scrollLeft=ke.left,ke.element.scrollTop=ke.top}}Wg=!!iw,rw=iw=null}finally{Xt=y,q.p=g,W.T=m}}o.current=u,ki=2}}function dP(){if(ki===2){ki=0;var o=El,u=vd,m=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||m){m=W.T,W.T=null;var g=q.p;q.p=2;var y=Xt;Xt|=4;try{BA(o,u.alternate,u)}finally{Xt=y,q.p=g,W.T=m}}ki=3}}function hP(){if(ki===4||ki===3){ki=0,Cn();var o=El,u=vd,m=Eo,g=JA;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?ki=5:(ki=0,vd=El=null,fP(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(Tl=null),ci(m),u=u.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(Zn,u,void 0,(u.current.flags&128)===128)}catch{}if(g!==null){u=W.T,y=q.p,q.p=2,W.T=null;try{for(var k=o.onRecoverableError,_=0;_<g.length;_++){var D=g[_];k(D.value,{componentStack:D.stack})}}finally{W.T=u,q.p=y}}(Eo&3)!==0&&Rg(),Ra(o),y=o.pendingLanes,(m&261930)!==0&&(y&42)!==0?o===q1?Cf++:(Cf=0,q1=o):Cf=0,Tf(0)}}function fP(o,u){(o.pooledCacheLanes&=u)===0&&(u=o.pooledCache,u!=null&&(o.pooledCache=null,of(u)))}function Rg(){return uP(),dP(),hP(),mP()}function mP(){if(ki!==5)return!1;var o=El,u=V1;V1=0;var m=ci(Eo),g=W.T,y=q.p;try{q.p=32>m?32:m,W.T=null,m=z1,z1=null;var k=El,_=Eo;if(ki=0,vd=El=null,Eo=0,(Xt&6)!==0)throw Error(i(331));var D=Xt;if(Xt|=4,YA(k.current),HA(k,k.current,_,m),Xt=D,Tf(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(Zn,k)}catch{}return!0}finally{q.p=y,W.T=g,fP(o,u)}}function pP(o,u,m){u=Cs(m,u),u=S1(o.stateNode,u,2),o=wl(o,u,2),o!==null&&(Yi(o,2),Ra(o))}function sn(o,u,m){if(o.tag===3)pP(o,o,m);else for(;u!==null;){if(u.tag===3){pP(u,o,m);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Tl===null||!Tl.has(g))){o=Cs(m,o),m=gA(2),g=wl(u,m,2),g!==null&&(vA(m,g,u,o),Yi(g,2),Ra(g));break}}u=u.return}}function K1(o,u,m){var g=o.pingCache;if(g===null){g=o.pingCache=new K7;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(m)||(B1=!0,y.add(m),o=J7.bind(null,o,u,m),u.then(o,o))}function J7(o,u,m){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&m,o.warmLanes&=~m,mn===o&&(Pt&m)===m&&(Kn===4||Kn===3&&(Pt&62914560)===Pt&&300>pt()-Tg?(Xt&2)===0&&xd(o,0):F1|=m,gd===Pt&&(gd=0)),Ra(o)}function gP(o,u){u===0&&(u=Gi()),o=Cc(o,u),o!==null&&(Yi(o,u),Ra(o))}function Z7(o){var u=o.memoizedState,m=0;u!==null&&(m=u.retryLane),gP(o,m)}function eq(o,u){var m=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(m=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(i(314))}g!==null&&g.delete(u),gP(o,m)}function tq(o,u){return Vt(o,u)}var Og=null,bd=null,G1=!1,Ig=!1,Y1=!1,Pl=0;function Ra(o){o!==bd&&o.next===null&&(bd===null?Og=bd=o:bd=bd.next=o),Ig=!0,G1||(G1=!0,iq())}function Tf(o,u){if(!Y1&&Ig){Y1=!0;do for(var m=!1,g=Og;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var k=0;else{var _=g.suspendedLanes,D=g.pingedLanes;k=(1<<31-Ut(42|o)+1)-1,k&=y&~(_&~D),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(m=!0,bP(g,k))}else k=Pt,k=Ft(g,g===mn?k:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(k&3)===0||jt(g,k)||(m=!0,bP(g,k));g=g.next}while(m);Y1=!1}}function nq(){vP()}function vP(){Ig=G1=!1;var o=0;Pl!==0&&fq()&&(o=Pl);for(var u=pt(),m=null,g=Og;g!==null;){var y=g.next,k=xP(g,u);k===0?(g.next=null,m===null?Og=y:m.next=y,y===null&&(bd=m)):(m=g,(o!==0||(k&3)!==0)&&(Ig=!0)),g=y}ki!==0&&ki!==5||Tf(o),Pl!==0&&(Pl=0)}function xP(o,u){for(var m=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,k=o.pendingLanes&-62914561;0<k;){var _=31-Ut(k),D=1<<_,Y=y[_];Y===-1?((D&m)===0||(D&g)!==0)&&(y[_]=oi(D,u)):Y<=u&&(o.expiredLanes|=D),k&=~D}if(u=mn,m=Pt,m=Ft(o,o===u?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g=o.callbackNode,m===0||o===u&&(rn===2||rn===9)||o.cancelPendingCommit!==null)return g!==null&&g!==null&&tn(g),o.callbackNode=null,o.callbackPriority=0;if((m&3)===0||jt(o,m)){if(u=m&-m,u===o.callbackPriority)return u;switch(g!==null&&tn(g),ci(m)){case 2:case 8:m=On;break;case 32:m=zt;break;case 268435456:m=qn;break;default:m=zt}return g=yP.bind(null,o),m=Vt(m,g),o.callbackPriority=u,o.callbackNode=m,u}return g!==null&&g!==null&&tn(g),o.callbackPriority=2,o.callbackNode=null,2}function yP(o,u){if(ki!==0&&ki!==5)return o.callbackNode=null,o.callbackPriority=0,null;var m=o.callbackNode;if(Rg()&&o.callbackNode!==m)return null;var g=Pt;return g=Ft(o,o===mn?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g===0?null:(eP(o,g,u),xP(o,pt()),o.callbackNode!=null&&o.callbackNode===m?yP.bind(null,o):null)}function bP(o,u){if(Rg())return null;eP(o,u,!0)}function iq(){pq(function(){(Xt&6)!==0?Vt(Lt,nq):vP()})}function Q1(){if(Pl===0){var o=sd;o===0&&(o=Bt,Bt<<=1,(Bt&261888)===0&&(Bt=256)),Pl=o}return Pl}function wP(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:wc(""+o)}function SP(o,u){var m=u.ownerDocument.createElement("input");return m.name=u.name,m.value=u.value,o.id&&m.setAttribute("form",o.id),u.parentNode.insertBefore(m,u),o=new FormData(o),m.parentNode.removeChild(m),o}function rq(o,u,m,g,y){if(u==="submit"&&m&&m.stateNode===y){var k=wP((y[te]||null).action),_=g.submitter;_&&(u=(u=_[te]||null)?wP(u.formAction):_.getAttribute("formAction"),u!==null&&(k=u,_=null));var D=new Yu("action","action",null,g,y);o.push({event:D,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Pl!==0){var Y=_?SP(y,_):new FormData(y);g1(m,{pending:!0,data:Y,method:y.method,action:k},null,Y)}}else typeof k=="function"&&(D.preventDefault(),Y=_?SP(y,_):new FormData(y),g1(m,{pending:!0,data:Y,method:y.method,action:k},k,Y))},currentTarget:y}]})}}for(var X1=0;X1<Rb.length;X1++){var J1=Rb[X1],sq=J1.toLowerCase(),aq=J1[0].toUpperCase()+J1.slice(1);Js(sq,"on"+aq)}Js(Z2,"onAnimationEnd"),Js(eE,"onAnimationIteration"),Js(tE,"onAnimationStart"),Js("dblclick","onDoubleClick"),Js("focusin","onFocus"),Js("focusout","onBlur"),Js(S7,"onTransitionRun"),Js(k7,"onTransitionStart"),Js(N7,"onTransitionCancel"),Js(nE,"onTransitionEnd"),mt("onMouseEnter",["mouseout","mouseover"]),mt("onMouseLeave",["mouseout","mouseover"]),mt("onPointerEnter",["pointerout","pointerover"]),mt("onPointerLeave",["pointerout","pointerover"]),Nt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Nt("onSelect","focusout contextmenu dragend focu
48sin keydown keyup mousedown mouseup selectionchange".split(" ")),Nt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Nt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Nt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Nt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ef="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(" "),oq=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ef));function kP(o,u){u=(u&4)!==0;for(var m=0;m<o.length;m++){var g=o[m],y=g.event;g=g.listeners;e:{var k=void 0;if(u)for(var _=g.length-1;0<=_;_--){var D=g[_],Y=D.instance,de=D.currentTarget;if(D=D.listener,Y!==k&&y.isPropagationStopped())break e;k=D,y.currentTarget=de;try{k(y)}catch(Se){Qp(Se)}y.currentTarget=null,k=Y}else for(_=0;_<g.length;_++){if(D=g[_],Y=D.instance,de=D.currentTarget,D=D.listener,Y!==k&&y.isPropagationStopped())break e;k=D,y.currentTarget=de;try{k(y)}catch(Se){Qp(Se)}y.currentTarget=null,k=Y}}}}function Et(o,u){var m=u[dt];m===void 0&&(m=u[dt]=new Set);var g=o+"__bubble";m.has(g)||(NP(u,o,2,!1),m.add(g))}function Z1(o,u,m){var g=0;u&&(g|=4),NP(m,o,g,u)}var Dg="_reactListening"+Math.random().toString(36).slice(2);function ew(o){if(!o[Dg]){o[Dg]=!0,Ee.forEach(function(m){m!=="selectionchange"&&(oq.has(m)||Z1(m,!1,o),Z1(m,!0,o))});var u=o.nodeType===9?o:o.ownerDocument;u===null||u[Dg]||(u[Dg]=!0,Z1("selectionchange",!1,u))}}function NP(o,u,m,g){switch(ZP(u)){case 2:var y=Iq;break;case 8:y=Dq;break;default:y=pw}m=y.bind(null,u,m,o),y=void 0,!$e||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(y=!0),g?y!==void 0?o.addEventListener(u,m,{capture:!0,passive:y}):o.addEventListener(u,m,!0):y!==void 0?o.addEventListener(u,m,{passive:y}):o.addEventListener(u,m,!1)}function tw(o,u,m,g,y){var k=g;if((u&1)===0&&(u&2)===0&&g!==null)e:for(;;){if(g===null)return;var _=g.tag;if(_===3||_===4){var D=g.stateNode.containerInfo;if(D===y)break;if(_===4)for(_=g.return;_!==null;){var Y=_.tag;if((Y===3||Y===4)&&_.stateNode.containerInfo===y)return;_=_.return}for(;D!==null;){if(_=ie(D),_===null)return;if(Y=_.tag,Y===5||Y===6||Y===26||Y===27){g=k=_;continue e}D=D.parentNode}}g=g.return}Xh(function(){var de=k,Se=Ku(m),Ne=[];e:{var fe=iE.get(o);if(fe!==void 0){var xe=Yu,Ye=o;switch(o){case"keypress":if(Zt(m)===0)break e;case"keydown":case"keyup":xe=e7;break;case"focusin":Ye="focus",xe=Nb;break;case"focusout":Ye="blur",xe=Nb;break;case"beforeblur":case"afterblur":xe=Nb;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=M2;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=Vz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=i7;break;case Z2:case eE:case tE:xe=Wz;break;case nE:xe=s7;break;case"scroll":case"scrollend":xe=Kp;break;case"wheel":xe=o7;break;case"copy":case"cut":case"paste":xe=Kz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=O2;break;case"toggle":case"beforetoggle":xe=c7}var ut=(u&4)!==0,dn=!ut&&(o==="scroll"||o==="scrollend"),ae=ut?fe!==null?fe+"Capture":null:fe;ut=[];for(var ee=de,ce;ee!==null;){var ke=ee;if(ce=ke.stateNode,ke=ke.tag,ke!==5&&ke!==26&&ke!==27||ce===null||ae===null||(ke=ml(ee,ae),ke!=null&&ut.push(Af(ee,ke,ce))),dn)break;ee=ee.return}0<ut.length&&(fe=new xe(fe,Ye,null,m,Se),Ne.push({event:fe,listeners:ut}))}}if((u&7)===0){e:{if(fe=o==="mouseover"||o==="pointerover",xe=o==="mouseout"||o==="pointerout",fe&&m!==Hu&&(Ye=m.relatedTarget||m.fromElement)&&(ie(Ye)||Ye[Fe]))break e;if((xe||fe)&&(fe=Se.window===Se?Se:(fe=Se.ownerDocument)?fe.defaultView||fe.parentWindow:window,xe?(Ye=m.relatedTarget||m.toElement,xe=de,Ye=Ye?ie(Ye):null,Ye!==null&&(dn=s(Ye),ut=Ye.tag,Ye!==dn||ut!==5&&ut!==27&&ut!==6)&&(Ye=null)):(xe=null,Ye=de),xe!==Ye)){if(ut=M2,ke="onMouseLeave",ae="onMouseEnter",ee="mouse",(o==="pointerout"||o==="pointerover")&&(ut=O2,ke="onPointerLeave",ae="onPointerEnter",ee="pointer"),dn=xe==null?fe:Te(xe),ce=Ye==null?fe:Te(Ye),fe=new ut(ke,ee+"leave",xe,m,Se),fe.target=dn,fe.relatedTarget=ce,ke=null,ie(Se)===de&&(ut=new ut(ae,ee+"enter",Ye,m,Se),ut.target=ce,ut.relatedTarget=dn,ke=ut),dn=ke,xe&&Ye)t:{for(ut=lq,ae=xe,ee=Ye,ce=0,ke=ae;ke;ke=ut(ke))ce++;ke=0;for(var it=ee;it;it=ut(it))ke++;for(;0<ce-ke;)ae=ut(ae),ce--;for(;0<ke-ce;)ee=ut(ee),ke--;for(;ce--;){if(ae===ee||ee!==null&&ae===ee.alternate){ut=ae;break t}ae=ut(ae),ee=ut(ee)}ut=null}else ut=null;xe!==null&&jP(Ne,fe,xe,ut,!1),Ye!==null&&dn!==null&&jP(Ne,dn,Ye,ut,!0)}}
vendor: 5,244 bytes, lines 48-49
48e:{if(fe=de?Te(de):window,xe=fe.nodeName&&fe.nodeName.toLowerCase(),xe==="select"||xe==="input"&&fe.type==="file")var Ht=V2;else if(F2(fe))if(z2)Ht=y7;else{Ht=v7;var Je=g7}else xe=fe.nodeName,!xe||xe.toLowerCase()!=="input"||fe.type!=="checkbox"&&fe.type!=="radio"?de&&Wu(de.elementType)&&(Ht=V2):Ht=x7;if(Ht&&(Ht=Ht(o,de))){$2(Ne,Ht,m,Se);break e}Je&&Je(o,fe,de),o==="focusout"&&de&&fe.type==="number"&&de.memoizedProps.value!=null&&Kh(fe,"number",fe.value)}switch(Je=de?Te(de):window,o){case"focusin":(F2(Je)||Je.contentEditable==="true")&&(Xu=Je,Pb=de,rf=null);break;case"focusout":rf=Pb=Xu=null;break;case"mousedown":_b=!0;break;case"contextmenu":case"mouseup":case"dragend":_b=!1,X2(Ne,m,Se);break;case"selectionchange":if(w7)break;case"keydown":case"keyup":X2(Ne,m,Se)}var St;if(Cb)e:{switch(o){case"compositionstart":var _t="onCompositionStart";break e;case"compositionend":_t="onCompositionEnd";break e;case"compositionupdate":_t="onCompositionUpdate";break e}_t=void 0}else Qu?U2(o,m)&&(_t="onCompositionEnd"):o==="keydown"&&m.keyCode===229&&(_t="onCompositionStart");_t&&(I2&&m.locale!=="ko"&&(Qu||_t!=="onCompositionStart"?_t==="onCompositionEnd"&&Qu&&(St=Aa()):(ei=Se,jn="value"in ei?ei.value:ei.textContent,Qu=!0)),Je=Lg(de,_t),0<Je.length&&(_t=new R2(_t,o,null,m,Se),Ne.push({event:_t,listeners:Je}),St?_t.data=St:(St=B2(m),St!==null&&(_t.data=St)))),(St=d7?h7(o,m):f7(o,m))&&(_t=Lg(de,"onBeforeInput"),0<_t.length&&(Je=new R2("onBeforeInput","beforeinput",null,m,Se),Ne.push({event:Je,listeners:_t}),Je.data=St)),rq(Ne,o,de,m,Se)}kP(Ne,u)})}function Af(o,u,m){return{instance:o,listener:u,currentTarget:m}}function Lg(o,u){for(var m=u+"Capture",g=[];o!==null;){var y=o,k=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||k===null||(y=ml(o,m),y!=null&&g.unshift(Af(o,y,k)),y=ml(o,u),y!=null&&g.push(Af(o,y,k))),o.tag===3)return g;o=o.return}return[]}function lq(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function jP(o,u,m,g,y){for(var k=u._reactName,_=[];m!==null&&m!==g;){var D=m,Y=D.alternate,de=D.stateNode;if(D=D.tag,Y!==null&&Y===g)break;D!==5&&D!==26&&D!==27||de===null||(Y=de,y?(de=ml(m,k),de!=null&&_.unshift(Af(m,de,Y))):y||(de=ml(m,k),de!=null&&_.push(Af(m,de,Y)))),m=m.return}_.length!==0&&o.push({event:u,listeners:_})}var cq=/\r\n?/g,uq=/\u0000|\uFFFD/g;function CP(o){return(typeof o=="string"?o:""+o).replace(cq,`
49`).replace(uq,"")}function TP(o,u){return u=CP(u),CP(o)===u}function un(o,u,m,g,y,k){switch(m){case"children":typeof g=="string"?u==="body"||u==="textarea"&&g===""||fl(o,g):(typeof g=="number"||typeof g=="bigint")&&u!=="body"&&fl(o,""+g);break;case"className":is(o,"class",g);break;case"tabIndex":is(o,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":is(o,m,g);break;case"style":Yh(o,g,k);break;case"data":if(u!=="object"){is(o,"data",g);break}case"src":case"href":if(g===""&&(u!=="a"||m!=="href")){o.removeAttribute(m);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(m);break}g=wc(""+g),o.setAttribute(m,g);break;case"action":case"formAction":if(typeof g=="function"){o.setAttribute(m,"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 k=="function"&&(m==="formAction"?(u!=="input"&&un(o,u,"name",y.name,y,null),un(o,u,"formEncType",y.formEncType,y,null),un(o,u,"formMethod",y.formMethod,y,null),un(o,u,"formTarget",y.formTarget,y,null)):(un(o,u,"encType",y.encType,y,null),un(o,u,"method",y.method,y,null),un(o,u,"target",y.target,y,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(m);break}g=wc(""+g),o.setAttribute(m,g);break;case"onClick":g!=null&&(o.onclick=Ns);break;case"onScroll":g!=null&&Et("scroll",o);break;case"onScrollEnd":g!=null&&Et("scrollend",o);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(i(61));if(m=g.__html,m!=null){if(y.children!=null)throw Error(i(60));o.innerHTML=m}}break;case"multiple":o.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":o.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){o.removeAttribute("xlink:href");break}m=wc(""+g),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(m,""+g):o.removeAttribute(m);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"playsInl
49ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(m,""):o.removeAttribute(m);break;case"capture":case"download":g===!0?o.setAttribute(m,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(m,g):o.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?o.setAttribute(m,g):o.removeAttribute(m);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?o.removeAttribute(m):o.setAttribute(m,g);break;case"popover":Et("beforetoggle",o),Et("toggle",o),Br(o,"popover",g);break;case"xlinkActuate":Fr(o,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Fr(o,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Fr(o,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Fr(o,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Fr(o,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Fr(o,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Fr(o,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Fr(o,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Fr(o,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Br(o,"is",g);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=Wp.get(m)||m,Br
vendor: 11,493 bytes, line 49
49(o,m,g))}}function nw(o,u,m,g,y,k){switch(m){case"style":Yh(o,g,k);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(i(61));if(m=g.__html,m!=null){if(y.children!=null)throw Error(i(60));o.innerHTML=m}}break;case"children":typeof g=="string"?fl(o,g):(typeof g=="number"||typeof g=="bigint")&&fl(o,""+g);break;case"onScroll":g!=null&&Et("scroll",o);break;case"onScrollEnd":g!=null&&Et("scrollend",o);break;case"onClick":g!=null&&(o.onclick=Ns);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!qe.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(y=m.endsWith("Capture"),u=m.slice(2,y?m.length-7:void 0),k=o[te]||null,k=k!=null?k[m]:null,typeof k=="function"&&o.removeEventListener(u,k,y),typeof g=="function")){typeof k!="function"&&k!==null&&(m in o?o[m]=null:o.hasAttribute(m)&&o.removeAttribute(m)),o.addEventListener(u,g,y);break e}m in o?o[m]=g:g===!0?o.setAttribute(m,""):Br(o,m,g)}}}function Zi(o,u,m){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Et("error",o),Et("load",o);var g=!1,y=!1,k;for(k in m)if(m.hasOwnProperty(k)){var _=m[k];if(_!=null)switch(k){case"src":g=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,u));default:un(o,u,k,_,m,null)}}y&&un(o,u,"srcSet",m.srcSet,m,null),g&&un(o,u,"src",m.src,m,null);return;case"input":Et("invalid",o);var D=k=_=y=null,Y=null,de=null;for(g in m)if(m.hasOwnProperty(g)){var Se=m[g];if(Se!=null)switch(g){case"name":y=Se;break;case"type":_=Se;break;case"checked":Y=Se;break;case"defaultChecked":de=Se;break;case"value":k=Se;break;case"defaultValue":D=Se;break;case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(i(137,u));break;default:un(o,u,g,Se,m,null)}}$p(o,k,D,Y,de,_,y,!1);return;case"select":Et("invalid",o),g=_=k=null;for(y in m)if(m.hasOwnProperty(y)&&(D=m[y],D!=null))switch(y){case"value":k=D;break;case"defaultValue":_=D;break;case"multiple":g=D;default:un(o,u,y,D,m,null)}u=k,m=_,o.multiple=!!g,u!=null?hl(o,!!g,u,!1):m!=null&&hl(o,!!g,m,!0);return;case"textarea":Et("invalid",o),k=y=g=null;for(_ in m)if(m.hasOwnProperty(_)&&(D=m[_],D!=null))switch(_){case"value":g=D;break;case"defaultValue":y=D;break;case"children":k=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(i(91));break;default:un(o,u,_,D,m,null)}zp(o,g,y,k);return;case"option":for(Y in m)if(m.hasOwnProperty(Y)&&(g=m[Y],g!=null))switch(Y){case"selected":o.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:un(o,u,Y,g,m,null)}return;case"dialog":Et("beforetoggle",o),Et("toggle",o),Et("cancel",o),Et("close",o);break;case"iframe":case"object":Et("load",o);break;case"video":case"audio":for(g=0;g<Ef.length;g++)Et(Ef[g],o);break;case"image":Et("error",o),Et("load",o);break;case"details":Et("toggle",o);break;case"embed":case"source":case"link":Et("error",o),Et("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(de in m)if(m.hasOwnProperty(de)&&(g=m[de],g!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,u));default:un(o,u,de,g,m,null)}return;default:if(Wu(u)){for(Se in m)m.hasOwnProperty(Se)&&(g=m[Se],g!==void 0&&nw(o,u,Se,g,m,void 0));return}}for(D in m)m.hasOwnProperty(D)&&(g=m[D],g!=null&&un(o,u,D,g,m,null))}function dq(o,u,m,g){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,k=null,_=null,D=null,Y=null,de=null,Se=null;for(xe in m){var Ne=m[xe];if(m.hasOwnProperty(xe)&&Ne!=null)switch(xe){case"checked":break;case"value":break;case"defaultValue":Y=Ne;default:g.hasOwnProperty(xe)||un(o,u,xe,null,g,Ne)}}for(var fe in g){var xe=g[fe];if(Ne=m[fe],g.hasOwnProperty(fe)&&(xe!=null||Ne!=null))switch(fe){case"type":k=xe;break;case"name":y=xe;break;case"checked":de=xe;break;case"defaultChecked":Se=xe;break;case"value":_=xe;break;case"defaultValue":D=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(i(137,u));break;default:xe!==Ne&&un(o,u,fe,xe,g,Ne)}}qu(o,_,D,Y,de,Se,k,y);return;case"select":xe=_=D=fe=null;for(k in m)if(Y=m[k],m.hasOwnProperty(k)&&Y!=null)switch(k){case"value":break;case"multiple":xe=Y;default:g.hasOwnProperty(k)||un(o,u,k,null,g,Y)}for(y in g)if(k=g[y],Y=m[y],g.hasOwnProperty(y)&&(k!=null||Y!=null))switch(y){case"value":fe=k;break;case"defaultValue":D=k;break;case"multiple":_=k;default:k!==Y&&un(o,u,y,k,g,Y)}u=D,m=_,g=xe,fe!=null?hl(o,!!m,fe,!1):!!g!=!!m&&(u!=null?hl(o,!!m,u,!0):hl(o,!!m,m?[]:"",!1));return;case"textarea":xe=fe=null;for(D in m)if(y=m[D],m.hasOwnProperty(D)&&y!=null&&!g.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:un(o,u,D,null,g,y)}for(_ in g)if(y=g[_],k=m[_],g.hasOwnProperty(_)&&(y!=null||k!=null))switch(_){case"value":fe=y;break;case"defaultValue":xe=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(i(91));break;default:y!==k&&un(o,u,_,y,g,k)}Vp(o,fe,xe);return;case"option":for(var Ye in m)if(fe=m[Ye],m.hasOwnProperty(Ye)&&fe!=null&&!g.hasOwnProperty(Ye))switch(Ye){case"selected":o.selected=!1;break;default:un(o,u,Ye,null,g,fe)}for(Y in g)if(fe=g[Y],xe=m[Y],g.hasOwnProperty(Y)&&fe!==xe&&(fe!=null||xe!=null))switch(Y){case"selected":o.selected=fe&&typeof fe!="function"&&typeof fe!="symbol";break;default:un(o,u,Y,fe,g,xe)}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 ut in m)fe=m[ut],m.hasOwnProperty(ut)&&fe!=null&&!g.hasOwnProperty(ut)&&un(o,u,ut,null,g,fe);for(de in g)if(fe=g[de],xe=m[de],g.hasOwnProperty(de)&&fe!==xe&&(fe!=null||xe!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(i(137,u));break;default:un(o,u,de,fe,g,xe)}return;default:if(Wu(u)){for(var dn in m)fe=m[dn],m.hasOwnProperty(dn)&&fe!==void 0&&!g.hasOwnProperty(dn)&&nw(o,u,dn,void 0,g,fe);for(Se in g)fe=g[Se],xe=m[Se],!g.hasOwnProperty(Se)||fe===xe||fe===void 0&&xe===void 0||nw(o,u,Se,fe,g,xe);return}}for(var ae in m)fe=m[ae],m.hasOwnProperty(ae)&&fe!=null&&!g.hasOwnProperty(ae)&&un(o,u,ae,null,g,fe);for(Ne in g)fe=g[Ne],xe=m[Ne],!g.hasOwnProperty(Ne)||fe===xe||fe==null&&xe==null||un(o,u,Ne,fe,g,xe)}function EP(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hq(){if(typeof performance.getEntriesByType=="function"){for(var o=0,u=0,m=performance.getEntriesByType("resource"),g=0;g<m.length;g++){var y=m[g],k=y.transferSize,_=y.initiatorType,D=y.duration;if(k&&D&&EP(_)){for(_=0,D=y.responseEnd,g+=1;g<m.length;g++){var Y=m[g],de=Y.startTime;if(de>D)break;var Se=Y.transferSize,Ne=Y.initiatorType;Se&&EP(Ne)&&(Y=Y.responseEnd,_+=Se*(Y<D?1:(D-de)/(Y-de)))}if(--g,u+=8*(k+_)/(y.duration/1e3),o++,10<o)break}}if(0<o)return u/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var iw=null,rw=null;function Ug(o){return o.nodeType===9?o:o.ownerDocument}function AP(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function PP(o,u){if(o===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&u==="foreignObject"?0:o}function sw(o,u){return o==="textarea"||o==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var aw=null;function fq(){var o=window.event;return o&&o.type==="popstate"?o===aw?!1:(aw=o,!0):(aw=null,!1)}var _P=typeof setTimeout=="function"?setTimeout:void 0,mq=typeof clearTimeout=="function"?clearTimeout:void 0,MP=typeof Promise=="function"?Promise:void 0,pq=typeof queueMicrotask=="function"?queueMicrotask:typeof MP<"u"?function(o){return MP.resolve(null).then(o).catch(gq)}:_P;function gq(o){setTimeout(function(){throw o})}function _l(o){return o==="head"}function RP(o,u){var m=u,g=0;do{var y=m.nextSibling;if(o.removeChild(m),y&&y.nodeType===8)if(m=y.data,m==="/$"||m==="/&"){if(g===0){o.removeChild(y),Nd(u);return}g--}else if(m==="$"||m==="$?"||m==="$~"||m==="$!"||m==="&")g++;else if(m==="html")Pf(o.ownerDocument.documentElement);else if(m==="head"){m=o.ownerDocument.head,Pf(m);for(var k=m.firstChild;k;){var _=k.nextSibling,D=k.nodeName;k[G]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&k.rel.toLowerCase()==="stylesheet"||m.removeChild(k),k=_}}else m==="body"&&Pf(o.ownerDocument.body);m=y}while(m);Nd(u)}function OP(o,u){var m=o;o=0;do{var g=m.nextSibling;if(m.nodeType===1?u?(m._stashedDisplay=m.style.display,m.style.display="none"):(m.style.display=m._stashedDisplay||"",m.getAttribute("style")===""&&m.removeAttribute("style")):m.nodeType===3&&(u?(m._stashedText=m.nodeValue,m.nodeValue=""):m.nodeValue=m._stashedText||""),g&&g.nodeType===8)if(m=g.data,m==="/$"){if(o===0)break;o--}else m!=="$"&&m!=="$?"&&m!=="$~"&&m!=="$!"||o++;m=g}while(m)}function ow(o){var u=o.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var m=u;switch(u=u.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":ow(m),V(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}o.removeChild(m)}}function vq(o,u,m,g){for(;o.nodeType===1;){var y=m;if(o.nodeName.toLowerCase()!==u.toLowerCase()){if(!g&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(g){if(!o[G])switch(u){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(k=o.getAttribute("rel"),k==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(k!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(k=o.getAttribute("src"),(k!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&k&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(u==="input"&&o.type==="hidden"){var k=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===k)return o}else return o;if(o=_s(o.nextSibling),o===null)break}return null}function xq(o,u,m){if(u==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!m||(o=_s(o.nextSibling),o===null))return null;return o}function IP(o,u){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=_s(o.nextSibling),o===null))return null;return o}function lw(o){return o.data==="$?"||o.data==="$~"}function cw(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function yq(o,u){var m=o.ownerDocument;if(o.data==="$~")o._reactRetry=u;else if(o.data!=="$?"||m.readyState!=="loading")u();else{var g=function(){u(),m.removeEventListener("DOMContentLoaded",g)};m.addEventListener("DOMContentLoaded",g),o._reactRetry=g}}function _s(o){for(;o!=null;o=o.nextSibling){var u=o.nodeType;if(u===1||u===3)break;if(u===8){if(u=o.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;
vendor: 8,806 bytes, line 49
49if(u==="/$"||u==="/&")return null}}return o}var uw=null;function DP(o){o=o.nextSibling;for(var u=0;o;){if(o.nodeType===8){var m=o.data;if(m==="/$"||m==="/&"){if(u===0)return _s(o.nextSibling);u--}else m!=="$"&&m!=="$!"&&m!=="$?"&&m!=="$~"&&m!=="&"||u++}o=o.nextSibling}return null}function LP(o){o=o.previousSibling;for(var u=0;o;){if(o.nodeType===8){var m=o.data;if(m==="$"||m==="$!"||m==="$?"||m==="$~"||m==="&"){if(u===0)return o;u--}else m!=="/$"&&m!=="/&"||u++}o=o.previousSibling}return null}function UP(o,u,m){switch(u=Ug(m),o){case"html":if(o=u.documentElement,!o)throw Error(i(452));return o;case"head":if(o=u.head,!o)throw Error(i(453));return o;case"body":if(o=u.body,!o)throw Error(i(454));return o;default:throw Error(i(451))}}function Pf(o){for(var u=o.attributes;u.length;)o.removeAttributeNode(u[0]);V(o)}var Ms=new Map,BP=new Set;function Bg(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Ao=q.d;q.d={f:bq,r:wq,D:Sq,C:kq,L:Nq,m:jq,X:Tq,S:Cq,M:Eq};function bq(){var o=Ao.f(),u=Pg();return o||u}function wq(o){var u=Z(o);u!==null&&u.tag===5&&u.type==="form"?nA(u):Ao.r(o)}var wd=typeof document>"u"?null:document;function FP(o,u,m){var g=wd;if(g&&typeof u=="string"&&u){var y=$r(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof m=="string"&&(y+='[crossorigin="'+m+'"]'),BP.has(y)||(BP.add(y),o={rel:o,crossOrigin:m,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Zi(u,"link",o),X(u),g.head.appendChild(u)))}}function Sq(o){Ao.D(o),FP("dns-prefetch",o,null)}function kq(o,u){Ao.C(o,u),FP("preconnect",o,u)}function Nq(o,u,m){Ao.L(o,u,m);var g=wd;if(g&&o&&u){var y='link[rel="preload"][as="'+$r(u)+'"]';u==="image"&&m&&m.imageSrcSet?(y+='[imagesrcset="'+$r(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(y+='[imagesizes="'+$r(m.imageSizes)+'"]')):y+='[href="'+$r(o)+'"]';var k=y;switch(u){case"style":k=Sd(o);break;case"script":k=kd(o)}Ms.has(k)||(o=p({rel:"preload",href:u==="image"&&m&&m.imageSrcSet?void 0:o,as:u},m),Ms.set(k,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(_f(k))||u==="script"&&g.querySelector(Mf(k))||(u=g.createElement("link"),Zi(u,"link",o),X(u),g.head.appendChild(u)))}}function jq(o,u){Ao.m(o,u);var m=wd;if(m&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+$r(g)+'"][href="'+$r(o)+'"]',k=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=kd(o)}if(!Ms.has(k)&&(o=p({rel:"modulepreload",href:o},u),Ms.set(k,o),m.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(Mf(k)))return}g=m.createElement("link"),Zi(g,"link",o),X(g),m.head.appendChild(g)}}}function Cq(o,u,m){Ao.S(o,u,m);var g=wd;if(g&&o){var y=we(g).hoistableStyles,k=Sd(o);u=u||"default";var _=y.get(k);if(!_){var D={loading:0,preload:null};if(_=g.querySelector(_f(k)))D.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},m),(m=Ms.get(k))&&dw(o,m);var Y=_=g.createElement("link");X(Y),Zi(Y,"link",o),Y._p=new Promise(function(de,Se){Y.onload=de,Y.onerror=Se}),Y.addEventListener("load",function(){D.loading|=1}),Y.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Fg(_,u,g)}_={type:"stylesheet",instance:_,count:1,state:D},y.set(k,_)}}}function Tq(o,u){Ao.X(o,u);var m=wd;if(m&&o){var g=we(m).hoistableScripts,y=kd(o),k=g.get(y);k||(k=m.querySelector(Mf(y)),k||(o=p({src:o,async:!0},u),(u=Ms.get(y))&&hw(o,u),k=m.createElement("script"),X(k),Zi(k,"link",o),m.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(y,k))}}function Eq(o,u){Ao.M(o,u);var m=wd;if(m&&o){var g=we(m).hoistableScripts,y=kd(o),k=g.get(y);k||(k=m.querySelector(Mf(y)),k||(o=p({src:o,async:!0,type:"module"},u),(u=Ms.get(y))&&hw(o,u),k=m.createElement("script"),X(k),Zi(k,"link",o),m.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(y,k))}}function $P(o,u,m,g){var y=(y=je.current)?Bg(y):null;if(!y)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(u=Sd(m.href),m=we(y).hoistableStyles,g=m.get(u),g||(g={type:"style",instance:null,count:0,state:null},m.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){o=Sd(m.href);var k=we(y).hoistableStyles,_=k.get(o);if(_||(y=y.ownerDocument||y,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(o,_),(k=y.querySelector(_f(o)))&&!k._p&&(_.instance=k,_.state.loading=5),Ms.has(o)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},Ms.set(o,m),k||Aq(y,o,m,_.state))),u&&g===null)throw Error(i(528,""));return _}if(u&&g!==null)throw Error(i(529,""));return null;case"script":return u=m.async,m=m.src,typeof m=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=kd(m),m=we(y).hoistableScripts,g=m.get(u),g||(g={type:"script",instance:null,count:0,state:null},m.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function Sd(o){return'href="'+$r(o)+'"'}function _f(o){return'link[rel="stylesheet"]['+o+"]"}function VP(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function Aq(o,u,m,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Zi(u,"link",m),X(u),o.head.appendChild(u))}function kd(o){return'[src="'+$r(o)+'"]'}function Mf(o){return"script[async]"+o}function zP(o,u,m){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+$r(m.href)+'"]');if(g)return u.instance=g,X(g),g;var y=p({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),X(g),Zi(g,"style",y),Fg(g,m.precedence,o),u.instance=g;case"stylesheet":y=Sd(m.href);var k=o.querySelector(_f(y));if(k)return u.state.loading|=4,u.instance=k,X(k),k;g=VP(m),(y=Ms.get(y))&&dw(g,y),k=(o.ownerDocument||o).createElement("link"),X(k);var _=k;return _._p=new Promise(function(D,Y){_.onload=D,_.onerror=Y}),Zi(k,"link",g),u.state.loading|=4,Fg(k,m.precedence,o),u.instance=k;case"script":return k=kd(m.src),(y=o.querySelector(Mf(k)))?(u.instance=y,X(y),y):(g=m,(y=Ms.get(k))&&(g=p({},m),hw(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),X(y),Zi(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(i(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Fg(g,m.precedence,o));return u.instance}function Fg(o,u,m){for(var g=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,k=y,_=0;_<g.length;_++){var D=g[_];if(D.dataset.precedence===u)k=D;else if(k!==y)break}k?k.parentNode.insertBefore(o,k.nextSibling):(u=m.nodeType===9?m.head:m,u.insertBefore(o,u.firstChild))}function dw(o,u){o.crossOrigin==null&&(o.crossOrigin=u.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=u.referrerPolicy),o.title==null&&(o.title=u.title)}function hw(o,u){o.crossOrigin==null&&(o.crossOrigin=u.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=u.referrerPolicy),o.integrity==null&&(o.integrity=u.integrity)}var $g=null;function qP(o,u,m){if($g===null){var g=new Map,y=$g=new Map;y.set(m,g)}else y=$g,g=y.get(m),g||(g=new Map,y.set(m,g));if(g.has(o))return g;for(g.set(o,null),m=m.getElementsByTagName(o),y=0;y<m.length;y++){var k=m[y];if(!(k[G]||k[$t]||o==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var _=k.getAttribute(u)||"";_=o+_;var D=g.get(_);D?D.push(k):g.set(_,[k])}}return g}function WP(o,u,m){o=o.ownerDocument||o,o.head.insertBefore(m,u==="title"?o.querySelector("head > title"):null)}function Pq(o,u,m){if(m===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function HP(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function _q(o,u,m,g){if(m.type==="stylesheet"&&(typeof g.media!="str
49ing"||matchMedia(g.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var y=Sd(g.href),k=u.querySelector(_f(y));if(k){u=k._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Vg.bind(o),u.then(o,o)),m.state.loading|=4,m.instance=k,X(k);return}k=u.ownerDocument||u,g=VP(g),(y=Ms.get(y))&&dw(g,y),k=k.createElement("link"),X(k);var _=k;_._p=new Promise(function(D,Y){_.onload=D,_.onerror=Y}),Zi(k,"link",g),m.instance=k}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(m,u),(u=m.state.preload)&&(m.state.loading&3)===0&&(o.count++,m=Vg.bind(o),u.addEventListener("load",m),u.addEventListener("error",m))}}var fw=0;function Mq(o,u){return o.stylesheets&&o.count===0&&qg(o,o.stylesheets),0<o.count||0<o.imgCount?function(m){var g=setTimeout(function(){if(o.stylesheets&&qg(o,o.stylesheets),o.unsuspend){var k=o.unsuspend;o.unsuspend=null,k()}},6e4+u);0<o.imgBytes&&fw===0&&(fw=62500*hq());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&qg(o,o.stylesheets),o.unsuspend)){var k=o.unsuspend;o.unsuspend=null,k()}},(o.imgBytes>fw?50:800)+u);return o.unsuspend=m,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Vg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qg(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var zg=null;function qg(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,zg=new Map,u.forEach(Rq,o),zg=null,Vg.call(o))}function Rq(o,u){if(!(u.state.loading&4)){var m=zg.get(o);if(m)var g=m.get(null);else{m=new Map,zg.set(o,m);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<y.length;k++){var _=y[k];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(m.set(_.dataset.precedence,_),g=_)}g&&m.set(null,g)}y=u.instance,_=y.getAttribute("data-precedence"),k=m.get(_)||g,k===g&&m.set(null,y),m.set(_,y),this.count++,g=Vg.bind(this),y.addEventListener("load",g),y.addEventListener("error",g),k?k.parentNode.insertBefore(y,k.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),u.state.loading|=4}}var Rf={$$typeof:E,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function Oq(o,u,m,g,y,k,_,D,Y){this.tag=1,this.containerInfo=o,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=fr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fr(0),this.hiddenUpdates=fr(null),this.identifierPrefix=g,this.onUncaughtError=y,this.onCaughtError=k,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function KP(o,u,m,g,y,k,_,D,Y,de,Se,Ne){return o=new Oq(o,u,m,_,Y,de,Se,Ne,D),u=1,k===!0&&(u|=24),k=ss(3,null,null,u),o.current=k,k.stateNode=o,u=Hb(),u.refCount++,o.pooledCache=u,u.refCount++,k.memoizedState={element:g,isDehydrated:m,cache:u},Qb(k),o}function GP(o){return o?(o=ed,o):ed}function YP(o,u,m,g,y,k){y=GP(y),g.context===null?g.context=y:g.pendingContext=y,g=bl(u),g.payload={element:m},k=k===void 0?null:k,k!==null&&(g.callback=k),m=wl(o,g,u),m!==null&&(Hr(m,o,u),df(m,o,u))}function QP(o,u){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var m=o.retryLane;o.retryLane=m!==0&&m<u?m:u}}function mw(o,u){QP(o,u),(o=o.alternate)&&QP(o,u)}function XP(o){if(o.tag===13||o.tag===31){var u=Cc(o,67108864);u!==null&&Hr(u,o,67108864),mw(o,67108864)}}function JP(o){if(o.tag===13||o.tag===31){var u=us();u=li(u);var m=Cc(o,u);m!==null&&Hr(m,o,u),mw(o,u)}}var Wg=!0;function Iq(o,u,m,g){var y=W.T;W.T=null;var k=q.p;try{q.p=2,pw(o,u,m,g)}finally{q.p=k,W.T=y}}function Dq(o,u,m,g){var y=W.T;W.T=null;var k=q.p;try{q.p=8,pw(o,u,m,g)}finally{q.p=k,W.T=y}}function pw(o,u,m,g){if(Wg){var y=gw(g);if(y===null)tw(o,u,g,Hg,m),e_(o,g);else if(Uq(y,o,u,m,g))g.stopPropagation();else if(e_(o,g),u&4&&-1<Lq.indexOf(o)){for(;y!==null;){var k=Z(y);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var _=Ze(k.pendingLanes);if(_!==0){var D=k;for(D.pendingLanes|=2,D.entangledLanes|=2;_;){var Y=1<<31-Ut(_);D.entanglements[1]|=Y,_&=~Y}Ra(k),(Xt&6)===0&&(Eg=pt()+500,Tf(0))}}break;case 31:case 13:D=Cc(k,2),D!==null&&Hr(D,k,2),Pg(),mw(k,2)}if(k=gw(g),k===null&&tw(o,u,g,Hg,m),k===y)break;y=k}y!==null&&g.stopPropagation()}else tw(o,u,g,null,m)}}function gw(o){return o=Ku(o),vw(o)}var Hg=null;function vw(o){if(Hg=null,o=ie(o),o!==null){var u=s(o);if(u===null)o=null;else{var m=u.tag;if(m===13){if(o=l(u),o!==null)return o;o=null}else if(m===31){if(o=c(u),o!==null)return o;o=null}else if(m===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;o=null}else u!==o&&(o=null)}}return Hg=o,null}function ZP(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close"
vendor: 5,649 bytes, line 49
49: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(kn()){case Lt:return 2;case On:return 8;case zt:case si:return 32;case qn:return 268435456;default:return 32}default:return 32}}var xw=!1,Ml=null,Rl=null,Ol=null,Of=new Map,If=new Map,Il=[],Lq="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 e_(o,u){switch(o){case"focusin":case"focusout":Ml=null;break;case"dragenter":case"dragleave":Rl=null;break;case"mouseover":case"mouseout":Ol=null;break;case"pointerover":case"pointerout":Of.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":If.delete(u.pointerId)}}function Df(o,u,m,g,y,k){return o===null||o.nativeEvent!==k?(o={blockedOn:u,domEventName:m,eventSystemFlags:g,nativeEvent:k,targetContainers:[y]},u!==null&&(u=Z(u),u!==null&&XP(u)),o):(o.eventSystemFlags|=g,u=o.targetContainers,y!==null&&u.indexOf(y)===-1&&u.push(y),o)}function Uq(o,u,m,g,y){switch(u){case"focusin":return Ml=Df(Ml,o,u,m,g,y),!0;case"dragenter":return Rl=Df(Rl,o,u,m,g,y),!0;case"mouseover":return Ol=Df(Ol,o,u,m,g,y),!0;case"pointerover":var k=y.pointerId;return Of.set(k,Df(Of.get(k)||null,o,u,m,g,y)),!0;case"gotpointercapture":return k=y.pointerId,If.set(k,Df(If.get(k)||null,o,u,m,g,y)),!0}return!1}function t_(o){var u=ie(o.target);if(u!==null){var m=s(u);if(m!==null){if(u=m.tag,u===13){if(u=l(m),u!==null){o.blockedOn=u,Wt(o.priority,function(){JP(m)});return}}else if(u===31){if(u=c(m),u!==null){o.blockedOn=u,Wt(o.priority,function(){JP(m)});return}}else if(u===3&&m.stateNode.current.memoizedState.isDehydrated){o.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Kg(o){if(o.blockedOn!==null)return!1;for(var u=o.targetContainers;0<u.length;){var m=gw(o.nativeEvent);if(m===null){m=o.nativeEvent;var g=new m.constructor(m.type,m);Hu=g,m.target.dispatchEvent(g),Hu=null}else return u=Z(m),u!==null&&XP(u),o.blockedOn=m,!1;u.shift()}return!0}function n_(o,u,m){Kg(o)&&m.delete(u)}function Bq(){xw=!1,Ml!==null&&Kg(Ml)&&(Ml=null),Rl!==null&&Kg(Rl)&&(Rl=null),Ol!==null&&Kg(Ol)&&(Ol=null),Of.forEach(n_),If.forEach(n_)}function Gg(o,u){o.blockedOn===u&&(o.blockedOn=null,xw||(xw=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Bq)))}var Yg=null;function i_(o){Yg!==o&&(Yg=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Yg===o&&(Yg=null);for(var u=0;u<o.length;u+=3){var m=o[u],g=o[u+1],y=o[u+2];if(typeof g!="function"){if(vw(g||m)===null)continue;break}var k=Z(m);k!==null&&(o.splice(u,3),u-=3,g1(k,{pending:!0,data:y,method:m.method,action:g},g,y))}}))}function Nd(o){function u(Y){return Gg(Y,o)}Ml!==null&&Gg(Ml,o),Rl!==null&&Gg(Rl,o),Ol!==null&&Gg(Ol,o),Of.forEach(u),If.forEach(u);for(var m=0;m<Il.length;m++){var g=Il[m];g.blockedOn===o&&(g.blockedOn=null)}for(;0<Il.length&&(m=Il[0],m.blockedOn===null);)t_(m),m.blockedOn===null&&Il.shift();if(m=(o.ownerDocument||o).$$reactFormReplay,m!=null)for(g=0;g<m.length;g+=3){var y=m[g],k=m[g+1],_=y[te]||null;if(typeof k=="function")_||i_(m);else if(_){var D=null;if(k&&k.hasAttribute("formAction")){if(y=k,_=k[te]||null)D=_.formAction;else if(vw(y)!==null)continue}else D=_.action;typeof D=="function"?m[g+1]=D:(m.splice(g,3),g-=3),i_(m)}}}function r_(){function o(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(_){return y=_})},focusReset:"manual",scroll:"manual"})}function u(){y!==null&&(y(),y=null),g||setTimeout(m,20)}function m(){if(!g&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(m,100),function(){g=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),y!==null&&(y(),y=null)}}}function yw(o){this._internalRoot=o}Qg.prototype.render=yw.prototype.render=function(o){var u=this._internalRoot;if(u===null)throw Error(i(409));var m=u.current,g=us();YP(m,g,o,u,null,null)},Qg.prototype.unmount=yw.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var u=o.containerInfo;YP(o.current,2,null,o,null,null),Pg(),u[Fe]=null}};function Qg(o){this._internalRoot=o}
49Qg.prototype.unstable_scheduleHydration=function(o){if(o){var u=ot();o={blockedOn:null,target:o,priority:u};for(var m=0;m<Il.length&&u!==0&&u<Il[m].priority;m++);Il.splice(m,0,o),m===0&&t_(o)}};var s_=t.version;if(s_!=="19.2.7")throw Error(i(527,s_,"19.2.7"));q.findDOMNode=function(o){var u=o._reactInternals;if(u===void 0)throw typeof o.render=="function"?Error(i(188)):(o=Object.keys(o).join(","),Error(i(268,o)));return o=d(u),o=o!==null?f(o):null,o=o===null?null:o.stateNode,o};var Fq={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xg.isDisabled&&Xg.supportsFiber)try{Zn=Xg.inject(Fq),ct=Xg}catch{}}return Uf.createRoot=function(o,u){if(!r(o))throw Error(i(299));var m=!1,g="",y=hA,k=fA,_=mA;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(y=u.onUncaughtError),u.onCaughtError!==void 0&&(k=u.onCaughtError),u.onRecoverableError!==void 0&&(_=u.onRecoverableError)),u=KP(o,1,!1,null,null,m,g,null,y,k,_,r_),o[Fe]=u.current,ew(o),new yw(u)},Uf.hydrateRoot=function(o,u,m){if(!r(o))throw Error(i(299));var g=!1,y="",k=hA,_=fA,D=mA,Y=null;return m!=null&&(m.unstable_strictMode===!0&&(g=!0),m.identifierPrefix!==void 0&&(y=m.identifierPrefix),m.onUncaughtError!==void 0&&(k=m.onUncaughtError),m.onCaughtError!==void 0&&(_=m.onCaughtError),m.onRecoverableError!==void 0&&(D=m.onRecoverableError),m.formState!==void 0&&(Y=m.formState)),u=KP(o,1,!0,u,m??null,g,y,Y,k,_,D,r_),u.context=GP(null),m=u.current,g=us(),g=li(g),y=bl(g),y.callback=null,wl(m,y,g),m=g,u.current.lanes=m,Yi(u,m),Ra(u),o[Fe]=u.current,ew(o),new Qg(u)},Uf.version="19.2.7",Uf}var p_;function Zq(){if(p_)return Sw.exports;p_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sw.exports=Jq(),Sw.exports}var eW=Zq(),Ha=[],Ls=[],tW=Uint8Array,Cw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var jd=0,nW=Cw.length;jd<nW;++jd)Ha[jd]=Cw[jd],Ls[Cw.charCodeAt(jd)]=jd;Ls[45]=62;Ls[95]=63;function iW(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var i=n===t?0:4-n%4;return[n,i]}function rW(e,t,n){return(t+n)*3/4-n}function Rm(e){var t,n=iW(e),i=n[0],r=n[1],s=new tW(rW(e,i,r)),l=0,c=r>0?i-4:i,h;for(h=0;h<c;h+=4)t=Ls[e.charCodeAt(h)]<<18|Ls[e.charCodeAt(h+1)]<<12|Ls[e.charCodeAt(h+2)]<<6|Ls[e.charCodeAt(h+3)],s[l++]=t>>16&255,s[l++]=t>>8&255,s[l++]=t&255;return r===2&&(t=Ls[e.charCodeAt(h)]<<2|Ls[e.charCodeAt(h+1)]>>4,s[l++]=t&255),r===1&&(t=Ls[e.charCodeAt(h)]<<10|Ls[e.charCodeAt(h+1)]<<4|Ls[e.charCodeAt(h+2)]>>2,s[l++]=t>>8&255,s[l++]=t&255),s}function sW(e){return Ha[e>>18&63]+Ha[e>>12&63]+Ha[e>>6&63]+Ha[e&63]}function aW(e,t,n){for(var i,r=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),r.push(sW(i));return r.join("")}function Om(e){for(var t,n=e.length,i=n%3,r=[],s=16383,l=0,c=n-i;l<c;l+=s)r.push(aW(e,l,l+s>c?c:l+s));return i===1?(t=e[n-1],r.push(Ha[t>>2]+Ha[t<<4&63]+"==")):i===2&&(t=(e[n-2]<<8)+e[n-1],r.push(Ha[t>>10]+Ha[t>>4&63]+Ha[t<<2&63]+"=")),r.join("")}function Io(e){if(e===void 0)return{};if(!x4(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function oW(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function x4(e){var r;const t=typeof e=="object",n=Object.getPrototypeOf(e),i=n===null||n===Object.prototype||((r=n==null?void 0:n.constructor)==null?void 0:r.name)==="Object";return t&&i}const y4=!0,uh=BigInt("-9223372036854775808"),Pj=BigInt("9223372036854775807"),mk=BigInt("0"),lW=BigInt("8"),cW=BigInt("256");function b4(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function uW(e){e<mk&&(e-=uh+uh);let t=e.toString(16);t.length%2===1&&(t="0"+t);const n=new Uint8Array(new ArrayBuffer(8));let i=0;for(const r of t.match(/.{2}/g).reverse())n.set([parseInt(r,16)],i++),e>>=lW;return Om(n)}function dW(e){const t=Rm(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=mk,i=mk;for(const r of t)n+=BigInt(r)*cW**i,i++;return n>Pj&&(n+=uh+uh),n}function hW(e){if(e<uh||Pj<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Om(new Uint8Array(t))}function fW(e){const t=Rm(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}const mW=DataView.prototype.setBigInt64?hW:uW,pW=DataView.prototype.getBigInt64?fW:dW,g_=1024;function w4(e){if(e.length>g_)throw new Error(`Field name ${e} exceeds maximum field name length ${g_}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e}
49 has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function dh(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(i=>dh(i));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const i=t[0][0];if(i==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Rm(e.$bytes).buffer}if(i==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return pW(e.$integer)}if(i==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const r=Rm(e.$float);if(r.byteLength!==8)throw new Error(`Received ${r.byteLength} bytes, expected 8 for $float`);const l=new DataView(r.buffer).getFloat64(0,y4);if(!b4(l))throw new Error(`Float ${l} should be encoded as a number`);return l}if(i==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(i==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[i,r]of Object.entries(e))w4(i),n[i]=dh(r);return n}const v_=16384;function mm(e){const t=JSON.stringify(e,(n,i)=>i===void 0?"undefined":typeof i=="bigint"?`${i.toString()}n`:i);if(t.length>v_){const n="[...truncated]";let i=v_-n.length;const r=t.codePointAt(i-1);return r!==void 0&&r>65535&&(i-=1),t.substring(0,i)+n}return t}function pk(e,t,n,i){var l;if(e===void 0){const c=n&&` (present at path ${n} in original object ${mm(t)})`;throw new Error(`undefined is not a valid Convex value${c}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<uh||Pj<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:mW(e)}}if(typeof e=="number")if(b4(e)){const c=new ArrayBuffer(8);return new DataView(c).setFloat64(0,e,y4),{$float:Om(new Uint8Array(c))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Om(new Uint8Array(e))};if(Array.isArray(e))return e.map((c,h)=>pk(c,t,n+`[${h}]`));if(e instanceof Set)throw new Error(Tw(n,"Set",[...e],t));if(e instanceof Map)throw new Error(Tw(n,"Map",[...e],t));if(!x4(e)){const c=(l=e==null?void 0:e.constructor)==null?void 0:l.name,h=c?`${c} `:"";throw new Error(Tw(n,h,e,t))}const r={},s=Object.entries(e);s.sort(([c,h],[d,f])=>c===d?0:c<d?-1:1);for(const[c,h]of s)h!==void 0&&(w4(c),r[c]=pk(h,t,n+`.${c}`));return r}function Tw(e,t,n,i){return e?`${t}${mm(n)} is not a supported Convex type (present at path ${e} in original object ${mm(i)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${mm(n)} is not a supported Convex type.`}function vs(e){return pk(e,e,"")}var gW=Object.defineProperty,vW=(e,t,n)=>t in e?gW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ew=(e,t,n)=>vW(e,typeof t!="symbol"?t+"":t,n),x_,y_;const xW=Symbol.for("ConvexError");class fv extends(y_=Error,x_=xW,y_){constructor(t){super(typeof t=="string"?t:mm(t)),Ew(this,"name","ConvexError"),Ew(this,"data"),Ew(this,x_,!0),this.data=t}}const S4=()=>Array.from({length:4},()=>0);S4();S4();const b_="1.42.1";var yW=Object.defineProperty,bW=(e,t,n)=>t in e?yW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w_=(e,t,n)=>bW(e,typeof t!="symbol"?t+"":t,n);const wW="color:rgb(0, 145, 255)";function k4(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class N4{constructor(t){w_(this,"_onLogLineFuncs"),w_(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let n=Math.random().toString(36).substring(2,15);for(let i=0;i<10&&this._onLogLineFuncs[n]!==void 0;i++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=t,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...t){if(this._verbose)for(const n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...t)}log(...t){for(const n of Object.values(this._onLogLineFuncs))n("info",...t)}warn(...t){for(const n of Object.values(this._onLogLineFuncs))n("warn",...t)}error(...t){for(const n of Object.values(this._onLogLineFuncs))n("error",...t)}}function j4(e){const t=new N4(e);return t.addLogLineListener((n,...i)=>{switch(n){case"debug":console.debug(...i);break;case"info":console.log(...i);break;case"warn":console.warn(...i);break;case"error":console.error(...i);break;default:console.log(...i)}}),t}function C4(e){return new N4(e)}function mv(e,t,n,i,r){const s=k4(n);if(typeof r=="object"&&(r=`ConvexError ${JSON.stringify(r.errorData,null,2)}`),t==="info"){const l=r.match(/^\[.*?\] /);if(l===null){e.error(`[CONVEX ${s}(${i})] Could not parse console.log`);return}const c=r.slice(1,l[0].length-2),h=r.slice(l[0].length);e.log(`%c[CONVEX ${s}(${i})] [${c}]`,wW,h)}else e.error(`[CONVEX ${s}(${i})] ${r}`)}function SW(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function Vd(e,t,n){return`[CONVEX ${k4(e)}(${t})] ${n.errorMessage}
50  Called by client`}function gk(e,t){return t.data=e.errorData,t}function ju(e){const t=e.split(":");let n,i;return t.length===1?(n=t[0],i="default"):(n=t.slice(0,t.length-1).join(":"),i=t[t.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${i}`}function pu(e,t){return JSON.stringify({udfPath:ju(e),args:vs(t)})}function S_(e,t,n){const{initialNumItems:i,id:r}=n;return JSON.stringify({type:"paginated",udfPath:ju(e),args:vs(t),options:vs({initialNumItems:i,id:r})})}
50var kW=Object.defineProperty,NW=(e,t,n)=>t in e?kW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oa=(e,t,n)=>NW(e,typeof t!="symbol"?t+"":t,n);class jW{constructor(){Oa(this,"nextQueryId"),Oa(this,"querySetVersion"),Oa(this,"querySet"),Oa(this,"queryIdToToken"),Oa(this,"identityVersion"),Oa(this,"auth"),Oa(this,"outstandingQueriesOlderThanRestart"),Oa(this,"outstandingAuthOlderThanRestart"),Oa(this,"paused"),Oa(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(t,n,i,r){const s=ju(t),l=pu(s,n),c=this.querySet.get(l);if(c!==void 0)return c.numSubscribers+=1,{queryToken:l,modification:null,unsubscribe:()=>this.removeSubscriber(l)};{const h=this.nextQueryId++,d={id:h,canonicalizedUdfPath:s,args:n,numSubscribers:1,journal:i,componentPath:r};this.querySet.set(l,d),this.queryIdToToken.set(h,l);const f=this.querySetVersion,p=this.querySetVersion+1,v={type:"Add",queryId:h,udfPath:s,args:[vs(n)],journal:i,componentPath:r};return this.paused?this.pendingQuerySetModifications.set(h,v):this.querySetVersion=p,{queryToken:l,modification:{type:"ModifyQuerySet",baseVersion:f,newVersion:p,modifications:[v]},unsubscribe:()=>this.removeSubscriber(l)}}}transition(t){for(const n of t.modifications)switch(n.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);const i=n.journal;if(i!==void 0){const r=this.queryIdToToken.get(n.queryId);r!==void 0&&(this.querySet.get(r).journal=i)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(t,n){const i=ju(t),r=pu(i,n),s=this.querySet.get(r);return s!==void 0?s.id:null}isCurrentOrNewerAuthVersion(t){return t>=this.identityVersion}getAuth(){return this.auth}setAuth(t){this.auth={tokenType:"User",value:t};const n=this.identityVersion;return this.paused||(this.identityVersion=n+1),{type:"Authenticate",baseVersion:n,...this.auth}}setAdminAuth(t,n){const i={tokenType:"Admin",value:t,impersonating:n};this.auth=i;const r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...i}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",tokenType:"None",baseVersion:t}}hasAuth(){return!!this.auth}isNewAuth(t){var n;return((n=this.auth)==null?void 0:n.value)!==t}queryPath(t){const n=this.queryIdToToken.get(t);return n?this.querySet.get(n).canonicalizedUdfPath:null}queryArgs(t){const n=this.queryIdToToken.get(t);return n?this.querySet.get(n).args:null}queryToken(t){return this.queryIdToToken.get(t)??null}queryJournal(t){var n;return(n=this.querySet.get(t))==null?void 0:n.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const t=[];for(const r of this.querySet.values()){const s={type:"Add",queryId:r.id,udfPath:r.canonicalizedUdfPath,args:[vs(r.args)],journal:r.journal,componentPath:r.componentPath};t.push(s),this.outstandingQueriesOlderThanRestart.add(r.id)}this.querySetVersion=1;const n={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:t};if(!this.auth)return this.identityVersion=0,[n,void 0];this.outstandingAuthOlderThanRestart=!0;const i={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[n,i]}pause(){this.paused=!0}resume(){const t=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,n=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,n]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const n=this.querySet.get(t);if(n.numSubscribers>1)return n.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(n.id),this.outstandingQueriesOlderThanRestart.delete(n.id);const i=this.querySetVersion,r=this.querySetVersion+1,s={type:"Remove",queryId:n.id};return this.paused?this.pendingQuerySetModifications.has(n.id)?this.pendingQuerySetModifications.delete(n.id):this.pendingQuerySetModifications.set(n.id,s):this.querySetVersion=r,{type:"ModifyQuerySet",baseVersion:i,newVersion:r,modifications:[s]}}}}var CW=Object.defineProperty,TW=(e,t,n)=>t in e?CW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jg=(e,t,n)=>TW(e,typeof t!="symbol"?t+"":t,n);class EW{constructor(t,n){this.logger=t,this.markConnectionStateDirty=n,Jg(this,"inflightRequests"),Jg(this,"requestsOlderThanRestart"),Jg(this,"inflightMutationsCount",0),Jg(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,n){const i=new Promise(r=>{const s=n?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:s,requestedAt:new Date,onResult:r}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),i}onResponse(t){const n=this.inflightRequests.get(t.requestId);if(n===void 0||n.status.status==="Completed")return null;const i=n.message.type==="Mutation"?"mutation":"action",r=n.message.udfPath;for(const h of t.logLines)mv(this.logger,"info",i,r,h);const s=n.status;let l,c;if(t.success)l={success:!0,logLines:t.logLines,value:dh(t.result)},c=()=>s.onResult(l);else{const h=t.result,{errorData:d}=t;mv(this.logger,"error",i,r,h),l={success:!1,errorMessage:h,errorData:d!==void 0?dh(d):void 0,logLines:t.logLines},c=()=>s.onResult(l)}return t.type==="ActionResponse"||!t.success?(c(),this.inflightRequests.delete(t.requestId),this.requestsOlderThanRestart.delete(t.requestId),n.message.type==="Action"?this.inflightActionsCount--:n.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:l}
50):(n.status={status:"Completed",result:l,ts:t.ts,onResolve:c},null)}removeCompleted(t){const n=new Map;for(const[i,r]of this.inflightRequests.entries()){const s=r.status;s.status==="Completed"&&s.ts.lessThanOrEqual(t)&&(s.onResolve(),n.set(i,s.result),r.message.type==="Mutation"?this.inflightMutationsCount--:r.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(i),this.requestsOlderThanRestart.delete(i))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[n,i]of this.inflightRequests){if(i.status.status==="NotSent"){i.status.status="Requested",t.push(i.message);continue}if(i.message.type==="Mutation")t.push(i.message);else if(i.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,i.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");i.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,n]of this.inflightRequests)if(n.status.status==="NotSent"){n.status.status="Requested",t.push(n.message);continue}return t}hasIncompleteRequests(){for(const t of this.inflightRequests.values())if(t.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let t=Date.now();for(const n of this.inflightRequests.values())n.status.status!=="Completed"&&n.status.requestedAt.getTime()<t&&(t=n.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const Im=Symbol.for("functionName"),T4=Symbol.for("toReferencePath");function AW(e){return e[T4]??null}function PW(e){return e.startsWith("function://")}function _W(e){let t;if(typeof e=="string")PW(e)?t={functionHandle:e}:t={name:e};else if(e[Im])t={name:e[Im]};else{const n=AW(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function Ui(e){const t=_W(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const n=e[Im];if(!n)throw new Error(`${e} is not a functionReference`);return n}function _j(e){return{[Im]:e}}function E4(e=[]){const t={get(n,i){if(typeof i=="string"){const r=[...e,i];return E4(r)}else if(i===Im){if(e.length<2){const l=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${l}\``)}const r=e.slice(0,-1).join("/"),s=e[e.length-1];return s==="default"?r:r+":"+s}else return i===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}const MW=E4();var RW=Object.defineProperty,OW=(e,t,n)=>t in e?RW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pv=(e,t,n)=>OW(e,typeof t!="symbol"?t+"":t,n);class Dm{constructor(t){pv(this,"queryResults"),pv(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const i=Io(n[0]),r=Ui(t),s=this.queryResults.get(pu(r,i));if(s!==void 0)return Dm.queryValue(s.result)}getAllQueries(t){const n=[],i=Ui(t);for(const r of this.queryResults.values())r.udfPath===ju(i)&&n.push({args:r.args,value:Dm.queryValue(r.result)});return n}setQuery(t,n,i){const r=Io(n),s=Ui(t),l=pu(s,r);let c;i===void 0?c=void 0:c={success:!0,value:i,logLines:[]};const h={udfPath:s,args:r,result:c};this.queryResults.set(l,h),this.modifiedQueries.push(l)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}}class IW{constructor(){pv(this,"queryResults"),pv(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,n){this.optimisticUpdates=this.optimisticUpdates.filter(l=>!n.has(l.mutationId));const i=this.queryResults;this.queryResults=new Map(t);const r=new Dm(this.queryResults);for(const l of this.optimisticUpdates)l.update(r);const s=[];for(const[l,c]of this.queryResults){const h=i.get(l);(h===void 0||h.result!==c.result)&&s.push(l)}return s}applyOptimisticUpdate(t,n){this.optimisticUpdates.push({update:t,mutationId:n});const i=new Dm(this.queryResults);return t(i),i.modifiedQueries}rawQueryResult(t){const n=this.queryResults.get(t);if(n!==void 0)return n.result}queryResult(t){const n=this.queryResults.get(t);if(n===void 0)return;const i=n.result;if(i!==void 0){if(i.success)return i.value;throw i.errorData!==void 0?gk(i,new fv(Vd("query",n.udfPath,i))):new Error(Vd("query",n.udfPath,i))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){var i;const n=this.queryResults.get(t);return(i=n==null?void 0:n.result)==null?void 0:i.logLines}}
50var DW=Object.defineProperty,LW=(e,t,n)=>t in e?DW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aw=(e,t,n)=>LW(e,typeof t!="symbol"?t+"":t,n);class Yr{constructor(t,n){Aw(this,"low"),Aw(this,"high"),Aw(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new Yr(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?k_:t>=UW?BW:new Yr(t%pm|0,t/pm|0)}toString(){return(BigInt(this.high)*BigInt(pm)+BigInt(this.low)).toString()}equals(t){return Yr.isLong(t)||(t=Yr.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return Yr.isLong(t)||(t=Yr.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?Yr.fromNumber(t):new Yr(t.low,t.high)}}const k_=new Yr(0,0),N_=65536,pm=N_*N_,UW=pm*pm,BW=new Yr(-1,-1);var FW=Object.defineProperty,$W=(e,t,n)=>t in e?FW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zg=(e,t,n)=>$W(e,typeof t!="symbol"?t+"":t,n);class j_{constructor(t,n){Zg(this,"version"),Zg(this,"remoteQuerySet"),Zg(this,"queryPath"),Zg(this,"logger"),this.version={querySet:0,ts:Yr.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=n}transition(t){const n=t.startVersion;if(this.version.querySet!==n.querySet||this.version.ts.notEquals(n.ts)||this.version.identity!==n.identity)throw new Error(`Invalid start version: ${n.ts.toString()}:${n.querySet}:${n.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const i of t.modifications)switch(i.type){case"QueryUpdated":{const r=this.queryPath(i.queryId);if(r)for(const l of i.logLines)mv(this.logger,"info","query",r,l);const s=dh(i.value??null);this.remoteQuerySet.set(i.queryId,{success:!0,value:s,logLines:i.logLines});break}case"QueryFailed":{const r=this.queryPath(i.queryId);if(r)for(const l of i.logLines)mv(this.logger,"info","query",r,l);const{errorData:s}=i;this.remoteQuerySet.set(i.queryId,{success:!1,errorMessage:i.errorMessage,errorData:s!==void 0?dh(s):void 0,logLines:i.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(i.queryId);break}default:throw new Error(`Invalid modification ${i.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Pw(e){const t=Rm(e);return Yr.fromBytesLE(Array.from(t))}function VW(e){const t=new Uint8Array(e.toBytesLE());return Om(t)}function C_(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:Pw(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Pw(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Pw(e.endVersion.ts)}}}}function zW(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:VW(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var qW=Object.defineProperty,WW=(e,t,n)=>t in e?qW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t,n)=>WW(e,typeof t!="symbol"?t+"":t,n);const HW=1e3,KW=1001,GW=1005,YW=4040;let M0;function Dd(){return M0===void 0&&(M0=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(M0+performance.now())}function T_(){return`t=${Math.round((Dd()-M0)/100)/10}s`}const A4={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function QW(e){if(e===void 0)return"Unknown";
50for(const t of Object.keys(A4))if(e.startsWith(t))return t;return"Unknown"}class XW{constructor(t,n,i,r,s,l){this.markConnectionStateDirty=s,this.debug=l,mi(this,"socket"),mi(this,"connectionCount"),mi(this,"_hasEverConnected",!1),mi(this,"lastCloseReason"),mi(this,"transitionChunkBuffer",null),mi(this,"defaultInitialBackoff"),mi(this,"maxBackoff"),mi(this,"retries"),mi(this,"serverInactivityThreshold"),mi(this,"reconnectDueToServerInactivityTimeout"),mi(this,"scheduledReconnect",null),mi(this,"networkOnlineHandler",null),mi(this,"pendingNetworkRecoveryInfo",null),mi(this,"uri"),mi(this,"onOpen"),mi(this,"onResume"),mi(this,"onMessage"),mi(this,"webSocketConstructor"),mi(this,"logger"),mi(this,"onServerDisconnectError"),this.webSocketConstructor=i,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=t,this.onOpen=n.onOpen,this.onResume=n.onResume,this.onMessage=n.onMessage,this.onServerDisconnectError=n.onServerDisconnectError,this.logger=r,this.setupNetworkListener(),this.connect()}setSocketState(t){this.socket=t,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(t){if(t.partNumber<0||t.partNumber>=t.totalParts||t.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==t.totalParts||this.transitionChunkBuffer.transitionId!==t.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:t.totalParts,transitionId:t.transitionId}),t.partNumber!==this.transitionChunkBuffer.chunks.length){const n=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${n}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const n=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const i=C_(JSON.parse(n));if(i.type!=="Transition")throw new Error(`Expected Transition, got ${i.type} after assembling chunks`);return i}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const t=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:t,paused:"no"}),this.resetServerInactivityTimeout(),t.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:t,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Dd()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",T_(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",T_())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:n}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:n}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(n/1e3)}s of waiting`)}},t.onerror=n=>{this.transitionChunkBuffer=null;const i=n.message;i&&this.logger.log(`WebSocket error message: ${i}`)},t.onmessage=n=>{this.resetServerInactivityTimeout();const i=n.data.length;let r=C_(JSON.parse(n.data));if(this._logVerbose(`received ws message with type ${r.type}`),r.type==="Ping")return;if(r.type==="TransitionChunk"){const l=this.assembleTransition(r);if(!l)return;r=l,this._logVerbose(`assembled full ws message of type ${r.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${r.type} while buffering TransitionChunks`)),r.type==="Transition"&&this.reportLargeTransition({messageLength:i,transition:r}),this.onMessage(r).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=n=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=n.reason||`closed with code ${n.code}`),n.code!==HW&&n.code!==KW&&n.code!==GW&&n.code!==YW){let r=`WebSocket closed with code ${n.code}`;n.reason&&(r+=`: ${n.reason}`),this.logger.log(r),this.onServerDisconnectError&&n.reason&&this.onServerDisconnectError(r)}const i=QW(n.reason);this.scheduleReconnect(i)}}socketState(){return this.socket.state}sendMessage(t){const n={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const i=zW(t),r=JSON.stringify(i);let s=!1;try{this.socket.ws.send(r),s=!0}catch(l){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${l}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${s?"sent":"failed to send"} message with type ${t.type}: ${JSON.stringify(n)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(n)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(t){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const n=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(n)}ms`);const i=Dd(),r=setTimeout(()=>{var s;((s=this.scheduledReconnect)==null?void 0:s.timeout)===r&&(this.scheduledReconnect=null,this.connect())},n);this.scheduledReconnect={timeout:r,scheduledAt:i,backoffMs:n}}closeAndReconnect(t){switch(this._logVerbose(`begin closeAndReconnect with reason ${t}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=t,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const t=this.socket.ws;return t.onmessage=n=>{this._logVerbose("Ignoring message received after close")},new Promise(n=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),n()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=i=>{this._logVerbose("Ignoring message received after close")};const n=new Promise(i=>{t.onclose=()=>{i()}});return t.close(),n}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const t=this.close();return this.setSocketState({state:"terminated"}),t}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const t=this.close();return this.socket={state:"stopped"},t}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let t=null;if(this.scheduledReconnect){const n=Dd()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-n),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(n)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=t!==null?{timeSavedMs:t}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Dd()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(t){this.logger.logVerbose(t)}nextBackoff(t){const i=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:A4[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const r=Math.min(i,this.maxBackoff),s=r*(Math.random()-.5);return r+s}reportLargeTransition({transition:t,messageLength:n}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const i=Dd()-t.clientClockSkew-t.serverTs/1e6,r=`${Math.round(i)}ms`,s=`${Math.round(n/1e4)/100}MB`,l=n/(i/1e3),c=`${Math.round(l/1e4)/100}MB per second`;this._logVerbose(`received ${s} transition in ${r} at ${c}`),n>2e7?this.logger.log(`received query results totaling more that 20MB (${s}
50) which will take a long time to download on slower connections`):i>2e4&&this.logger.log(`received query results totaling ${s} which took more than 20s to arrive (${r})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:i,messageLength:n}})}}function JW(){return ZW()}function ZW(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class sm extends Error{}sm.prototype.name="InvalidTokenError";function eH(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let i=n.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}function tH(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return eH(t)}catch{return atob(t)}}function P4(e,t){if(typeof e!="string")throw new sm("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,i=e.split(".")[n];if(typeof i!="string")throw new sm(`Invalid token specified: missing part #${n+1}`);let r;try{r=tH(i)}catch(s){throw new sm(`Invalid token specified: invalid base64 for part #${n+1} (${s.message})`)}try{return JSON.parse(r)}catch(s){throw new sm(`Invalid token specified: invalid json for part #${n+1} (${s.message})`)}}var nH=Object.defineProperty,iH=(e,t,n)=>t in e?nH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kr=(e,t,n)=>iH(e,typeof t!="symbol"?t+"":t,n);const rH=480*60*60*1e3,E_=2;class sH{constructor(t,n,i){Kr(this,"authState",{state:"noAuth"}),Kr(this,"configVersion",0),Kr(this,"syncState"),Kr(this,"authenticate"),Kr(this,"stopSocket"),Kr(this,"tryRestartSocket"),Kr(this,"pauseSocket"),Kr(this,"resumeSocket"),Kr(this,"clearAuth"),Kr(this,"logger"),Kr(this,"refreshTokenLeewaySeconds"),Kr(this,"initialAuthTokenReuse"),Kr(this,"lastRefreshChange"),Kr(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=n.authenticate,this.stopSocket=n.stopSocket,this.tryRestartSocket=n.tryRestartSocket,this.pauseSocket=n.pauseSocket,this.resumeSocket=n.resumeSocket,this.clearAuth=n.clearAuth,this.logger=i.logger,this.refreshTokenLeewaySeconds=i.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=i.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(t){this.authState.state!=="noAuth"&&this.authState.state!=="initialRefetch"&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==t&&(this.lastRefreshChange=t,this.authState.config.onRefreshChange(t))}async setConfig(t,n,i){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const r=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});if(r.isFromOutdatedConfig)return;const s={fetchToken:t,onAuthChange:n,onRefreshChange:i};r.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:s,hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:"initialRefetch",config:s}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket()}onTransition(t){var n;if(this.syncState.isCurrentOrNewerAuthVersion(t.endVersion.identity)&&!(t.endVersion.identity<=t.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid");const i=(n=this.syncState.getAuth())==null?void 0:n.value;this.initialAuthTokenReuse&&i?this.scheduleTokenRefetch(i,t.clientClockSkew):this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(t){if(t.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:n}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(n+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(t)}async tryToReauthenticate(t){if(this._logVerbose(`attempting to reauthenticate: ${t.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=E_){this.logger.error(`Failed to authenticate: "${t.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${E_-this.tokenConfirmationAttempts} attempts remaining`)),this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state==="noAuth")return;const n=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});n.isFromOutdatedConfig||(n.value&&this.syncState.isNewAuth(n.value)?(this.authenticate(n.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:n.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value?this.syncState.isNewAuth(t.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:t.value,config:this.authState.config}),this.authenticate(t.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(t,n){if(this.authState.state==="noAuth")return;const i=this.decodeToken(t);if(!i){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:r,exp:s}=i;
50if(!r||!s){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const l=s-r;if(l<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let c;if(n!==void 0){const f=(Date.now()-n)/1e3;c=s-f,c<=0&&(c=0)}else c=l;let h=Math.min(rH,(c-this.refreshTokenLeewaySeconds)*1e3);h<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${c}s`),h=0);const d=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},h);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:d,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${h}ms`)}async fetchTokenAndGuardAgainstRace(t,n){const i=++this.configVersion;this._logVerbose(`fetching token with config version ${i}`);const r=await t(n);return this.configVersion!==i?(this._logVerbose(`stale config version, expected ${i}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:r}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(t){t(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:"noAuth"})}setAuthState(t){const n=t.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:t.hadAuth,state:t.state,token:`...${t.token.slice(-7)}`}:{state:t.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(n)}`),t.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=t}decodeToken(t){try{return P4(t)}catch(n){return this._logVerbose(`Error decoding token: ${n instanceof Error?n.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const aH=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function oH(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function lH(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function cH(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of aH){const i=performance.getEntriesByName(n).filter(r=>r.entryType==="mark").filter(r=>r.detail.sessionId===e);t.push(...i)}return t.map(lH)}var uH=Object.defineProperty,dH=(e,t,n)=>t in e?uH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t,n)=>dH(e,typeof t!="symbol"?t+"":t,n);class hH{constructor(t,n,i){if(pi(this,"address"),pi(this,"state"),pi(this,"requestManager"),pi(this,"webSocketManager"),pi(this,"authenticationManager"),pi(this,"remoteQuerySet"),pi(this,"optimisticQueryResults"),pi(this,"_transitionHandlerCounter",0),pi(this,"_nextRequestId"),pi(this,"_onTransitionFns",new Map),pi(this,"_sessionId"),pi(this,"firstMessageReceived",!1),pi(this,"debug"),pi(this,"logger"),pi(this,"maxObservedTimestamp"),pi(this,"connectionStateSubscribers",new Map),pi(this,"nextConnectionStateSubscriberId",0),pi(this,"_lastPublishedConnectionState"),pi(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const x=this.connectionState();if(JSON.stringify(x)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=x;for(const b of this.connectionStateSubscribers.values())b(x)}})}),pi(this,"mark",x=>{this.debug&&oH(x,this.sessionId)}),typeof t=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");(i==null?void 0:i.skipConvexDeploymentUrlCheck)!==!0&&oW(t),i={...i};const r=i.authRefreshTokenLeewaySeconds??10;let s=i.webSocketConstructor;if(!s&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpCl
50ient");s=s||WebSocket,this.debug=i.reportDebugInfoToConvex??!1,this.address=t,this.logger=i.logger===!1?C4({verbose:i.verbose??!1}):i.logger!==!0&&i.logger?i.logger:j4({verbose:i.verbose??!1});const l=t.search("://");if(l===-1)throw new Error("Provided address was not an absolute URL.");const c=t.substring(l+3),h=t.substring(0,l);let d;if(h==="http")d="ws";else if(h==="https")d="wss";else throw new Error(`Unknown parent protocol ${h}`);const f=`${d}://${c}/api/${b_}/sync`;this.state=new jW,this.remoteQuerySet=new j_(x=>this.state.queryPath(x),this.logger),this.requestManager=new EW(this.logger,this.markConnectionStateDirty);const p=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new sH(this.state,{authenticate:x=>{const b=this.state.setAuth(x);return this.webSocketManager.sendMessage(b),b.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:p,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:r,initialAuthTokenReuse:i.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new IW,this.addOnTransitionHandler(x=>{n(x.queries.map(b=>b.token))}),this._nextRequestId=0,this._sessionId=JW();const{unsavedChangesWarning:v}=i;if(typeof window>"u"||typeof window.addEventListener>"u"){if(v===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else v!==!1&&window.addEventListener("beforeunload",x=>{if(this.requestManager.hasIncompleteRequests()){x.preventDefault();const b="Are you sure you want to leave? Your changes may not be saved.";return(x||window.event).returnValue=b,b}});this.webSocketManager=new XW(f,{onOpen:x=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...x,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new j_(N=>this.state.queryPath(N),this.logger);const[b,S]=this.state.restart();S&&this.webSocketManager.sendMessage(S),this.webSocketManager.sendMessage(b);for(const N of this.requestManager.restart())this.webSocketManager.sendMessage(N)},onResume:()=>{const[x,b]=this.state.resume();b&&this.webSocketManager.sendMessage(b),x&&this.webSocketManager.sendMessage(x);for(const S of this.requestManager.resume())this.webSocketManager.sendMessage(S)},onMessage:x=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),x.type){case"Transition":{this.observedTimestamp(x.endVersion.ts),this.authenticationManager.onTransition(x),this.remoteQuerySet.transition(x),this.state.transition(x);const b=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(b);break}case"MutationResponse":{x.success&&this.observedTimestamp(x.ts);const b=this.requestManager.onResponse(x);b!==null&&this.notifyOnQueryResultChanges(new Map([[b.requestId,b.result]]));break}case"ActionResponse":{this.requestManager.onResponse(x);break}case"AuthError":{this.authenticationManager.onAuthError(x);break}case"FatalError":{const b=SW(this.logger,x.error);throw this.webSocketManager.terminate(),b}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:i.onServerDisconnectError},s,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),i.expectAuth&&p()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(t){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(t))&&(this.maxObservedTimestamp=t)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(t){const n=this.remoteQuerySet.remoteQueryResults(),i=new Map;for(const[s,l]of n){const c=this.state.queryToken(s);if(c!==null){const h={result:l,udfPath:this.state.queryPath(s),args:this.state.queryArgs(s)};i.set(c,h)}}const r=this.optimisticQueryResults.ingestQueryResultsFromServer(i,new Set(t.keys()));this.handleTransition({queries:r.map(s=>{const l=this.optimisticQueryResults.rawQueryResult(s);return{token:s,modification:{kind:"Updated",result:l}}}),reflectedMutations:Array.from(t).map(([s,l])=>({requestId:s,result:l})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(t){for(const n of this._onTransitionFns.values())n(t)}addOnTransitionHandler(t){const n=this._transitionHandlerCounter++;
50return this._onTransitionFns.set(n,t),()=>this._onTransitionFns.delete(n)}getCurrentAuthClaims(){const t=this.state.getAuth();let n={};if(t&&t.tokenType==="User")try{n=t?P4(t.value):{}}catch{n={}}else return;return{token:t.value,decoded:n}}setAuth(t,n,i){this.authenticationManager.setConfig(t,n,i)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,n){const i=this.state.setAdminAuth(t,n);this.webSocketManager.sendMessage(i)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,n,i){const r=Io(n),{modification:s,queryToken:l,unsubscribe:c}=this.state.subscribe(t,r,i==null?void 0:i.journal,i==null?void 0:i.componentPath);return s!==null&&this.webSocketManager.sendMessage(s),{queryToken:l,unsubscribe:()=>{const h=c();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,n){const i=Io(n),r=pu(t,i);return this.optimisticQueryResults.queryResult(r)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,n){const i=Io(n),r=pu(t,i);return this.optimisticQueryResults.queryLogs(r)}queryJournal(t,n){const i=Io(n),r=pu(t,i);return this.state.queryJournal(r)}connectionState(){const t=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:t.isConnected,hasEverConnected:t.hasEverConnected,connectionCount:t.connectionCount,connectionRetries:t.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(t){const n=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(n,t),()=>{this.connectionStateSubscribers.delete(n)}}async mutation(t,n,i){const r=await this.mutationInternal(t,n,i);if(!r.success)throw r.errorData!==void 0?gk(r,new fv(Vd("mutation",t,r))):new Error(Vd("mutation",t,r));return r.value}async mutationInternal(t,n,i,r){const{mutationPromise:s}=this.enqueueMutation(t,n,i,r);return s}enqueueMutation(t,n,i,r){const s=Io(n);this.tryReportLongDisconnect();const l=this.nextRequestId;if(this._nextRequestId++,i!==void 0){const f=i.optimisticUpdate;if(f!==void 0){const p=b=>{f(b,s)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},x=this.optimisticQueryResults.applyOptimisticUpdate(p,l).map(b=>{const S=this.localQueryResultByToken(b);return{token:b,modification:{kind:"Updated",result:S===void 0?void 0:{success:!0,value:S,logLines:[]}}}});this.handleTransition({queries:x,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const c={type:"Mutation",requestId:l,udfPath:t,componentPath:r,args:[vs(s)]},h=this.webSocketManager.sendMessage(c),d=this.requestManager.request(c,h);return{requestId:l,mutationPromise:d}}async action(t,n){const i=await this.actionInternal(t,n);if(!i.success)throw i.errorData!==void 0?gk(i,new fv(Vd("action",t,i))):new Error(Vd("action",t,i));return i.value}async actionInternal(t,n,i){const r=Io(n),s=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const l={type:"Action",requestId:s,udfPath:t,componentPath:i,args:[vs(r)]},c=this.webSocketManager.sendMessage(l);return this.requestManager.request(l,c)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const t=cH(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:t})}}tryReportLongDisconnect(){if(!this.debug)return;const t=this.connectionState().timeOfOldestInflightRequest;if(t===null||Date.now()-t.getTime()<=60*1e3)return;const n=`${this.address}/api/debug_event`;fetch(n,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${b_}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(i=>{i.ok||this.logger.warn("Analytics request failed with response:",i.body)}).catch(i=>{this.logger.warn("Analytics response failed with error:",i)})}}function _w(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e==null?void 0:e.toString()}`);return e}var fH=Object.defineProperty,mH=(e,t,n)=>t in e?fH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
50):e[t]=n,A_=(e,t,n)=>mH(e,typeof t!="symbol"?t+"":t,n);class pH{constructor(t,n){this.client=t,this.onTransition=n,A_(this,"paginatedQuerySet",new Map),A_(this,"lastTransitionTs"),this.lastTransitionTs=Yr.fromNumber(0),this.client.addOnTransitionHandler(i=>this.onBaseTransition(i))}subscribe(t,n,i){const r=ju(t),s=S_(r,n,i),l=()=>this.removePaginatedQuerySubscriber(s),c=this.paginatedQuerySet.get(s);return c?(c.numSubscribers+=1,{paginatedQueryToken:s,unsubscribe:l}):(this.paginatedQuerySet.set(s,{token:s,canonicalizedUdfPath:r,args:n,numSubscribers:1,options:{initialNumItems:i.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:i.id}),this.addPageToPaginatedQuery(s,null,i.initialNumItems),{paginatedQueryToken:s,unsubscribe:l})}localQueryResult(t,n,i){const r=ju(t),s=S_(r,n,i);return this.localQueryResultByToken(s)}localQueryResultByToken(t){const n=this.paginatedQuerySet.get(t);if(!n)return;const i=this.activePageQueryTokens(n);if(i.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let r=[],s=!1,l=!1;for(const h of i){const d=this.client.localQueryResultByToken(h);if(d===void 0){s=!0,l=!1;continue}const f=_w(d);r=r.concat(f.page),l=!!f.isDone}let c;return s?c=r.length===0?"LoadingFirstPage":"LoadingMore":l?c="Exhausted":c="CanLoadMore",{results:r,status:c,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const n=t.queries.map(l=>l.token),i=this.queriesContainingTokens(n);let r=[];i.length>0&&(this.processPaginatedQuerySplits(i,l=>this.client.localQueryResultByToken(l)),r=i.map(l=>({token:l,modification:{kind:"Updated",result:this.localQueryResultByToken(l)}})));const s={...t,paginatedQueries:r};this.onTransition(s)}loadMoreOfPaginatedQuery(t,n){this.mustGetPaginatedQuery(t);const i=this.queryTokenForLastPageOfPaginatedQuery(t),r=this.client.localQueryResultByToken(i);if(!r)return!1;const s=_w(r);if(s.isDone)return!1;this.addPageToPaginatedQuery(t,s.continueCursor,n);const l={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:t,modification:{kind:"Updated",result:this.localQueryResultByToken(t)}}]};return this.onTransition(l),!0}queriesContainingTokens(t){if(t.length===0)return[];const n=[],i=new Set(t);for(const[r,s]of this.paginatedQuerySet)for(const l of this.allQueryTokens(s))if(i.has(l)){n.push(r);break}return n}processPaginatedQuerySplits(t,n){for(const i of t){const r=this.mustGetPaginatedQuery(i),{ongoingSplits:s,pageKeyToQuery:l,pageKeys:c}=r;for(const[h,[d,f]]of s)n(l.get(d).queryToken)!==void 0&&n(l.get(f).queryToken)!==void 0&&this.completePaginatedQuerySplit(r,h,d,f);for(const h of c){if(s.has(h))continue;const d=l.get(h).queryToken,f=n(d);if(!f)continue;const p=_w(f);p.splitCursor&&(p.pageStatus==="SplitRecommended"||p.pageStatus==="SplitRequired"||p.page.length>r.options.initialNumItems*2)&&this.splitPaginatedQueryPage(r,h,p.splitCursor,p.continueCursor)}}}splitPaginatedQueryPage(t,n,i,r){const s=t.nextPageKey++,l=t.nextPageKey++,c={cursor:r,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...c,cursor:null,endCursor:i}});t.pageKeyToQuery.set(s,h);const d=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...c,cursor:i,endCursor:r}});t.pageKeyToQuery.set(l,d),t.ongoingSplits.set(n,[s,l])}addPageToPaginatedQuery(t,n,i){const r=this.mustGetPaginatedQuery(t),s=r.nextPageKey++,l={cursor:n,numItems:i,id:r.id},c={...r.args,paginationOpts:l},h=this.client.subscribe(r.canonicalizedUdfPath,c);return r.pageKeys.push(s),r.pageKeyToQuery.set(s,h),h}removePaginatedQuerySubscriber(t){const n=this.paginatedQuerySet.get(t);if(n&&(n.numSubscribers-=1,!(n.numSubscribers>0))){for(const i of n.pageKeyToQuery.values())i.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,n,i,r){const s=t.pageKeyToQuery.get(n);t.pageKeyToQuery.delete(n);const l=t.pageKeys.indexOf(n);t.pageKeys.splice(l,1,i,r),t.ongoingSplits.delete(n),s.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(n=>t.pageKeyToQuery.get(n).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(n=>n.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const n=this.mustGetPaginatedQuery(t),i=n.pageKeys[n.pageKeys.length-1];if(i===void 0)throw new Error(`No pages for paginated query ${t}`);return n.pageKeyToQuery.get(i).queryToken}mustGetPaginatedQuery(t){const n=this.paginatedQuerySet.get(t);if(!n)throw new Error("paginated query no longer exists for token "+t);return n}}function gH({getCurrentValue:e,subscribe:t}){const[n,i]=w.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let r=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(r=e(),i({getCurrentValue:e,subscribe:t,value:r})),w.useEffect(()=>{let s=!1;const l=()=>{s||i(h=>{if(h.getCurrentValue!==e||h.subscribe!==t)return h;const d=e();return h.value===d?h:{...h,value:d}})},c=t(l);return l(),()=>{s=!0,c()}},[e,t]),r}var vH=Object.defineProperty,xH=(e,t,n)=>t in e?vH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Po=(e,t,n)=>xH(e,typeof t!="symbol"?t+"":t,n);const yH=5e3;if(typeof he>"u")throw new Error("Required dependency 'react' not found");function _4(e,t,n){function i(r){return kH(r),t.mutation(e,r,{optimisticUpdate:n})}return i.withOptimisticUpdate=function(s){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${Ui(e)}`);return _4(e,t,s)},i}function bH(e,t){return function(n){return t.action(e,n)}}
50class wH{constructor(t,n){if(Po(this,"address"),Po(this,"cachedSync"),Po(this,"cachedPaginatedQueryClient"),Po(this,"listeners"),Po(this,"options"),Po(this,"closed",!1),Po(this,"_logger"),Po(this,"adminAuth"),Po(this,"fakeUserIdentity"),t===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof t!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof t} instead.`);if(!t.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=t,this.listeners=new Map,this._logger=(n==null?void 0:n.logger)===!1?C4({verbose:(n==null?void 0:n.verbose)??!1}):(n==null?void 0:n.logger)!==!0&&(n!=null&&n.logger)?n.logger:j4({verbose:(n==null?void 0:n.verbose)??!1}),this.options={...n,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=new hH(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new pH(this.cachedSync,t=>this.handleTransition(t)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(t,n,i){if(typeof t=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(t,n??(()=>{}),i)}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,n){if(this.adminAuth=t,this.fakeUserIdentity=n,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,n)}watchQuery(t,...n){const[i,r]=n,s=Ui(t);return{onUpdate:l=>{const{queryToken:c,unsubscribe:h}=this.sync.subscribe(s,i,r),d=this.listeners.get(c);return d!==void 0?d.add(l):this.listeners.set(c,new Set([l])),()=>{if(this.closed)return;const f=this.listeners.get(c);f.delete(l),f.size===0&&this.listeners.delete(c),h()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(s,i)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(s,i)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(s,i)}}}prewarmQuery(t){const n=t.extendSubscriptionFor??yH,r=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(r,n)}watchPaginatedQuery(t,n,i){const r=Ui(t);return{onUpdate:s=>{const{paginatedQueryToken:l,unsubscribe:c}=this.paginatedQueryClient.subscribe(r,n||{},i),h=this.listeners.get(l);return h!==void 0?h.add(s):this.listeners.set(l,new Set([s])),()=>{if(this.closed)return;const d=this.listeners.get(l);d.delete(s),d.size===0&&this.listeners.delete(l),c()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(r,n,i)}}mutation(t,...n){const[i,r]=n,s=Ui(t);return this.sync.mutation(s,i,r)}action(t,...n){const i=Ui(t);return this.sync.action(i,...n)}query(t,...n){const i=this.watchQuery(t,...n),r=i.localQueryResult();return r!==void 0?Promise.resolve(r):new Promise((s,l)=>{const c=i.onUpdate(()=>{c();try{s(i.localQueryResult())}catch(h){l(h)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(t){return this.sync.subscribeToConnectionState(t)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const t=this.cachedSync;this.cachedSync=void 0,await t.close()}}handleTransition(t){const n=t.queries.map(r=>r.token),i=t.paginatedQueries.map(r=>r.token);this.transition([...n,...i])}transition(t){for(const n of t){const i=this.listeners.get(n);if(i)for(const r of i)r()}}}const Wx=he.createContext(void 0);function M4(){return w.useContext(Wx)}const SH=({client:e,children:t})=>he.createElement(Wx.Provider,{value:e},t);function et(e,...t){const n=t[0]==="skip",i=t[0]==="skip"?{}:Io(t[0]),r=typeof e=="string"?_j(e):e,s=Ui(r),l=w.useMemo(()=>n?{}:{query:{query:r,args:i}},[JSON.stringify(vs(i)),s,n]),h=R4(l).query;if(h instanceof Error)throw h;return h}function We(e){const t=typeof e=="string"?_j(e):e,n=w.useContext(Wx);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return w.useMemo(()=>_4(t,n),[n,Ui(t)])}function zo(e){const t=w.useContext(Wx),n=typeof e=="string"?_j(e):e;if(t===void 0)throw new Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return w.useMemo(()=>bH(n,t),[t,Ui(n)])}function kH(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var NH=Object.defineProperty,jH=(e,t,n)=>t in e?NH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mw=(e,t,n)=>jH(e,typeof t!="symbol"?t+"":t,n);class CH{constructor(t){Mw(this,"createWatch"),Mw(this,"queries"),Mw(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const n of Object.keys(t)){const{query:i,args:r,paginationOptions:s}=t[n];if(Ui(i),this.queries[n]===void 0)this.addQuery(n,i,r,s?{paginationOptions:s}:{});else{const l=this.queries[n];(Ui(i)!==Ui(l.query)||JSON.stringify(vs(r))!==JSON.stringify(vs(l.args))||JSON.stringify(s)!==JSON.stringify(l.paginationOptions))&&(this.removeQuery(n),this.addQuery(n,i,r,s?{paginationOptions:s}:{}))}}for(const n of Object.keys(this.queries))t[n]===void 0&&this.removeQuery(n)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const n={};for(const i of Object.keys(t)){const{query:r,args:s}=t[i],l=t[i].paginationOptions;Ui(r);const c=this.createWatch(r,s,l?{paginationOptions:l}:{});let h;try{h=c.localQueryResult()}catch(d){if(d instanceof Error)h=d;else throw d}n[i]=h}return n}setCreateWatch(t){this.createWatch=t;for(const n of Object.keys(this.queries)){const{query:i,args:r,watch:s,paginationOptions:l}=this.queries[n],c="journal"in s?s.journal():void 0;this.removeQuery(n),this.addQuery(n,i,r,{...c?{journal:c}:[],...l?{paginationOptions:l}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,n,i,{paginationOptions:r,journal:s}){if(this.queries[t]!==void 0)throw new Error(`Tried to add a new query with identifier ${t} when it already exists.`);const l=this.createWatch(n,i,{...s?{journal:s}:[],...r?{paginationOptions:r}:{}}),c=l.onUpdate(()=>this.notifyListeners());this.queries[t]={query:n,args:i,watch:l,unsubscribe:c,...r?{paginationOptions:r}:{}}}removeQuery(t){const n=this.queries[t];
50if(n===void 0)throw new Error(`No query found with identifier ${t}.`);n.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function R4(e){const t=M4();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const n=w.useMemo(()=>(i,r,{journal:s,paginationOptions:l})=>l?t.watchPaginatedQuery(i,r,l):t.watchQuery(i,r,s?{journal:s}:{}),[t]);return TH(e,n)}function TH(e,t){const[n]=w.useState(()=>new CH(t));n.createWatch!==t&&n.setCreateWatch(t),w.useEffect(()=>()=>n.destroy(),[n]);const i=w.useMemo(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:r=>(n.setQueries(e),n.subscribe(r))}),[n,e]);return gH(i)}const EH=(e,t,n)=>i=>{const r={...i.queries},s=i.nextPageKey,l=i.nextPageKey+1,c=i.nextPageKey+2;r[s]={query:i.query,args:{...i.args,paginationOpts:{...i.queries[e].args.paginationOpts,endCursor:t}}},r[l]={query:i.query,args:{...i.args,paginationOpts:{...i.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};const h={...i.ongoingSplits};return h[e]=[s,l],{...i,nextPageKey:c,queries:r,ongoingSplits:h}},AH=e=>t=>{const n=t.ongoingSplits[e];if(n===void 0)return t;const i={...t.queries};delete i[e];const r={...t.ongoingSplits};delete r[e];let s=t.pageKeys.slice();const l=t.pageKeys.findIndex(c=>c===e);return l>=0&&(s=[...t.pageKeys.slice(0,l),...n,...t.pageKeys.slice(l+1)]),{...t,queries:i,pageKeys:s,ongoingSplits:r}};function Hx(e,t,n){const{user:i}=MH(e,t,n,!0);return i}const PH=Symbol("includePageKeys"),_H=Symbol("page");function MH(e,t,n,i=!0){if(typeof(n==null?void 0:n.initialNumItems)!="number"||n.initialNumItems<0)throw new Error(`\`options.initialNumItems\` must be a positive number. Received \`${n==null?void 0:n.initialNumItems}\`.`);const r=t==="skip",s=r?{}:t,l=Ui(e),c=w.useMemo(()=>()=>{const E=RH();return{query:e,args:s,id:E,nextPageKey:1,pageKeys:r?[]:[0],queries:r?{}:{0:{query:e,args:{...s,paginationOpts:{numItems:n.initialNumItems,cursor:null,id:E}}}},ongoingSplits:{},skip:r}},[JSON.stringify(vs(s)),l,n.initialNumItems,r]),[h,d]=w.useState(c);let f=h;(Ui(e)!==Ui(h.query)||JSON.stringify(vs(s))!==JSON.stringify(vs(h.args))||r!==h.skip)&&(f=c(),d(f));const v=M4().logger,x=R4(f.queries),b=n[PH]??!1,[S,N,j]=w.useMemo(()=>{var P,A;let E;const C=[];for(const M of f.pageKeys){if(E=x[M],E===void 0)break;if(E instanceof Error){if(E.message.includes("InvalidCursor")||E instanceof fv&&typeof E.data=="object"&&((P=E.data)==null?void 0:P.isConvexSystemError)===!0&&((A=E.data)==null?void 0:A.paginationError)==="InvalidCursor")return v.warn("usePaginatedQuery hit error, resetting pagination state: "+E.message),d(c),[[],void 0,void 0];if(i)throw E;return[C,void 0,E]}const R=f.ongoingSplits[M];if(R!==void 0?x[R[0]]!==void 0&&x[R[1]]!==void 0&&d(AH(M)):E.splitCursor&&(E.pageStatus==="SplitRecommended"||E.pageStatus==="SplitRequired"||E.page.length>n.initialNumItems*2)&&d(EH(M,E.splitCursor,E.continueCursor)),E.pageStatus==="SplitRequired")return[C,void 0,void 0];C.push(...b?E.page.map(B=>({...B,[_H]:M.toString()})):E.page)}return[C,E,void 0]},[x,f.pageKeys,f.ongoingSplits,n.initialNumItems,c,v,b,i]),T=w.useMemo(()=>{if(j!==void 0)return{status:"Error",isLoading:!1,error:j,loadMore:()=>{}};if(N===void 0)return f.nextPageKey===1?{status:"LoadingFirstPage",isLoading:!0,loadMore:()=>{}}:{status:"LoadingMore",isLoading:!0,loadMore:P=>{}};if(N.isDone)return{status:"Exhausted",isLoading:!1,loadMore:P=>{}};const E=N.continueCursor;let C=!1;return{status:"CanLoadMore",isLoading:!1,loadMore:P=>{C||(C=!0,d(A=>{const M=[...A.pageKeys,A.nextPageKey],R={...A.queries};return R[A.nextPageKey]={query:A.query,args:{...A.args,paginationOpts:{numItems:P,cursor:E,id:A.id}}},{...A,nextPageKey:A.nextPageKey+1,pageKeys:M,queries:R}}))}}},[j,N,f.nextPageKey]);return{user:{results:S,...T},internal:{state:f}}}let P_=0;function RH(){return P_++,P_}const O4=w.createContext(void 0);function OH(){const e=w.useContext(O4);if(e===void 0)throw new Error("Could not find `ConvexProviderWithAuth` (or `ConvexProviderWithClerk` or `ConvexProviderWithAuth0`) as an ancestor component. This component may be missing, or you might have two instances of the `convex/react` module loaded in your project.");return e}function IH({children:e,client:t,useAuth:n}){const{isLoading:i,isAuthenticated:r,fetchAccessToken:s}=n(),[l,c]=w.useState(null),[h,d]=w.useState(!1);i&&l!==null&&(c(null),d(!1)),!i&&!r&&l!==!1&&(c(!1),d(!1));const f=r&&(l??!1);return he.createElement(O4.Provider,{value:{isLoading:l===null,isAuthenticated:f,isRefreshing:h&&f}},he.createElement(DH,{authProviderAuthenticated:r,fetchAccessToken:s,authProviderLoading:i,client:t,setIsConvexAuthenticated:c,setIsRefreshing:d}),he.createElement(SH,{client:t},e),he.createElement(LH,{authProviderAuthenticated:r,fetchAccessToken:s,authProviderLoading:i,client:t,setIsConvexAuthenticated:c,setIsRefreshing:d}))}function DH({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:i,setIsConvexAuthenticated:r,setIsRefreshing:s}){return w.useEffect(()=>{let l=!0;if(e)return i.setAuth(t,c=>{l&&r(()=>c)},c=>{l&&s(c)}),()=>{l=!1,r(c=>c?!1:null),s(!1)}},[e,t,n,i,r,s]),null}function LH({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:i,setIsConvexAuthenticated:r,setIsRefreshing:s}){return w.useEffect(()=>{if(e)return()=>{i.clearAuth(),r(()=>null),s(!1)}},[e,t,n,i,r,s]),null}function UH({children:e,client:t,useAuth:n}){const i=BH(n);return he.createElement(IH,{client:t,useAuth:i},e)}function BH(e){return w.useMemo(()=>function(){const{isLoaded:n,isSignedIn:i,getToken:r,orgId:s,orgRole:l,sessionClaims:c}=e(),h=w.useCallback(async({forceRefreshToken:d})=>{try{return(c==null?void 0:c.aud)==="convex"?await r({skipCache:d}):await r({template:"convex",skipCache:d})}catch{return null}},[s,l]);return w.useMemo(()=>({isLoading:!n,isAuthenticated:i??!1,fetchAccessToken:h}),[n,i,h])},[e])}
50var fu,FH=(fu=class extends Error{constructor(n){super(new.target.formatMessage(new.target.kind,n.message,n.code,n.docsUrl),{cause:n.cause});Rs(this,"clerkError",!0);Rs(this,"code");Rs(this,"longMessage");Rs(this,"docsUrl");Rs(this,"cause");Object.setPrototypeOf(this,fu.prototype),this.code=n.code,this.docsUrl=n.docsUrl,this.longMessage=n.longMessage,this.cause=n.cause}get name(){return this.constructor.name}toString(){return`[${this.name}]
51Message:${this.message}`}static formatMessage(n,i,r,s){const l="Clerk:",c=new RegExp(l.replace(" ","\\s*"),"i");return i=i.replace(c,""),i=`${l} ${i.trim()}
52
53(code="${r}")
54
55`,s&&(i+=`
56
57Docs: ${s}`),i}},Rs(fu,"kind","ClerkError"),fu);const $H=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider"});function I4({packageName:e,customMessages:t}){let n=e;function i(s,l){if(!l)return`${n}: ${s}`;let c=s;const h=s.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(const d of h){const f=(l[d[1]]||"").toString();c=c.replace(`{{${d[1]}}}`,f)}return`${n}: ${c}`}const r={...$H,...t};return{setPackageName({packageName:s}){return typeof s=="string"&&(n=s),this},setMessages({customMessages:s}){return Object.assign(r,s||{}),this},throwInvalidPublishableKeyError(s){throw new Error(i(r.InvalidPublishableKeyErrorMessage,s))},throwInvalidProxyUrl(s){throw new Error(i(r.InvalidProxyUrlErrorMessage,s))},throwMissingPublishableKeyError(){throw new Error(i(r.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw new Error(i(r.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(s){throw new Error(i(r.MissingClerkProvider,s))},throw(s){throw new Error(i(s))}}}var mu,vk=(mu=class extends FH{constructor(n,i){super({...i,message:n});Rs(this,"clerkRuntimeError",!0);Object.setPrototypeOf(this,mu.prototype)}},Rs(mu,"kind","ClerkRuntimeError"),mu);const VH={strict_mfa:{afterMinutes:10,level:"multi_factor"},strict:{afterMinutes:10,level:"second_factor"},moderate:{afterMinutes:60,level:"second_factor"},lax:{afterMinutes:1440,level:"second_factor"}},zH=new Set(["first_factor","second_factor","multi_factor"]),qH=new Set(["strict_mfa","strict","moderate","lax"]),WH=e=>typeof e=="number"&&e>0,HH=e=>zH.has(e),KH=e=>qH.has(e),__=e=>typeof e=="number"&&Number.isFinite(e)&&(e===-1||e>=0),Rw=e=>e.replace(/^(org:)*/,"org:"),GH=(e,t)=>{const{orgId:n,orgRole:i,orgPermissions:r}=t,s=e.role!==void 0,l=e.permission!==void 0;return!s&&!l?"skip":s&&typeof e.role!="string"||l&&typeof e.permission!="string"||!n||s&&(typeof i!="string"||!i||Rw(i)!==Rw(e.role))||l&&(!Array.isArray(r)||!r.includes(Rw(e.permission)))?"fail":"pass"},M_=(e,t)=>{const{org:n,user:i}=QH(e),[r,s]=t.split(":"),l=s||r;return r==="org"?n.includes(l):r==="user"?i.includes(l):[...n,...i].includes(l)},YH=(e,t)=>{const{features:n,plans:i}=t,r=e.feature!==void 0,s=e.plan!==void 0;if(!r&&!s)return"skip";if(r&&typeof e.feature!="string"||s&&typeof e.plan!="string")return"fail";if(r){if(typeof n!="string"||!n)return"fail";try{if(!M_(n,e.feature))return"fail"}catch{return"fail"}}if(s){if(typeof i!="string"||!i)return"fail";try{if(!M_(i,e.plan))return"fail"}catch{return"fail"}}return"pass"},QH=e=>{const t=e?e.split(",").map(n=>n.trim()):[];return{org:t.filter(n=>n.split(":")[0].includes("o")).map(n=>n.split(":")[1]),user:t.filter(n=>n.split(":")[0].includes("u")).map(n=>n.split(":")[1])}},XH=e=>{if(!e)return!1;const t=r=>typeof r=="string"?VH[r]:r,n=typeof e=="string"&&KH(e),i=typeof e=="object"&&HH(e.level)&&WH(e.afterMinutes);return n||i?t.bind(null,e):!1},JH=(e,{factorVerificationAge:t})=>{if(e.reverification===void 0)return"skip";if(!t||!Array.isArray(t)||t.length!==2||!__(t[0])||!__(t[1]))return"fail";const n=XH(e.reverification);if(!n)return"fail";const{level:i,afterMinutes:r}=n(),[s,l]=t;if(s===-1&&l===-1)return"fail";const c=s!==-1&&r>s,h=l!==-1&&r>l;switch(i){case"first_factor":return c?"pass":"fail";case"second_factor":return l===-1?c?"pass":"fail":h?"pass":"fail";case"multi_factor":return l===-1?c?"pass":"fail":s===-1?"fail":c&&h?"pass":"fail"}},ZH=e=>e.some(t=>t==="pass")&&e.every(t=>t==="pass"||t==="skip"),eK=e=>t=>e.userId?ZH([GH(t,e),YH(t,e),JH(t,e)]):!1,tK=({authObject:{sessionId:e,sessionStatus:t,userId:n,actor:i,orgId:r,orgRole:s,orgSlug:l,signOut:c,getToken:h,has:d,sessionClaims:f},options:{treatPendingAsSignedOut:p=!0}})=>{if(e===void 0&&n===void 0)return{isLoaded:!1,isSignedIn:void 0,sessionId:e,sessionClaims:void 0,userId:n,actor:void 0,orgId:void 0,orgRole:void 0,orgSlug:void 0,has:void 0,signOut:c,getToken:h};if(e===null&&n===null)return{isLoaded:!0,isSignedIn:!1,sessionId:e,userId:n,sessionClaims:null,actor:null,orgId:null,orgRole:null,orgSlug:null,has:()=>!1,signOut:c,getToken:h};if(p&&t==="pending")return{isLoaded:!0,isSignedIn:!1,sessionId:null,userId:null,sessionClaims:null,actor:null,orgId:null,orgRole:null,orgSlug:null,has:()=>!1,signOut:c,getToken:h};if(e&&f&&n&&r&&s)return{isLoaded:!0,isSignedIn:!0,sessionId:e,sessionClaims:f,userId:n,actor:i||null,orgId:r,orgRole:s,orgSlug:l||null,has:d,signOut:c,getToken:h};if(e&&f&&n&&!r)return{isLoaded:!0,isSignedIn:!0,sessionId:e,sessionClaims:f,userId:n,actor:i||null,orgId:null,orgRole:null,orgSlug:null,has:d,signOut:c,getToken:h}},nK=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],D4=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof global<"u"&&global.Buffer?new global.Buffer(e,"base64").toString():e,L4="pk_live_",iK="pk_test_";function U4(e){if(!e.endsWith("$"))return!1;const t=e.slice(0,-1);return t.includes("$")?!1:t.includes(".")}function R_(e,t={}){if(e=e||"",!e||!xk(e)){if(t.fatal&&!e)throw new Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment c
57onfiguration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(t.fatal&&!xk(e))throw new Error("Publishable key not valid.");return null}const n=e.startsWith(L4)?"production":"development";let i;try{i=D4(e.split("_")[2])}catch{if(t.fatal)throw new Error("Publishable key not valid: Failed to decode key.");return null}if(!U4(i)){if(t.fatal)throw new Error("Publishable key not valid: Decoded key has invalid format.");return null}let r=i.slice(0,-1);return t.proxyUrl?r=t.proxyUrl:n!=="development"&&t.domain&&t.isSatellite&&(r=`clerk.${t.domain}`),{instanceType:n,frontendApi:r}}function xk(e=""){try{if(!(e.startsWith(L4)||e.startsWith(iK)))return!1;const t=e.split("_");if(t.length!==3)return!1;const n=t[2];return n?U4(D4(n)):!1}catch{return!1}}function rK(){const e=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;const n=typeof t=="string"?t:t.hostname;let i=e.get(n);return i===void 0&&(i=nK.some(r=>n.endsWith(r)),e.set(n,i)),i}}}const sK="METHOD_CALLED",aK=.1;function oK(e,t){return{event:sK,eventSamplingRate:aK,payload:{method:e,...t}}}var Ow={exports:{}},Iw={};/**
58 * @license React
59 * use-sync-external-store-shim.production.js
60 *
61 * Copyright (c) Meta Platforms, Inc. and affiliates.
62 *
63 * This source code is licensed under the MIT license found in the
64 * LICENSE file in the root directory of this source tree.
65 */var O_;function lK(){if(O_)return Iw;O_=1;var e=Ph();function t(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var n=typeof Object.is=="function"?Object.is:t,i=e.useState,r=e.useEffect,s=e.useLayoutEffect,l=e.useDebugValue;function c(p,v){var x=v(),b=i({inst:{value:x,getSnapshot:v}}),S=b[0].inst,N=b[1];return s(function(){S.value=x,S.getSnapshot=v,h(S)&&N({inst:S})},[p,x,v]),r(function(){return h(S)&&N({inst:S}),p(function(){h(S)&&N({inst:S})})},[p]),l(x),x}function h(p){var v=p.getSnapshot;p=p.value;try{var x=v();return!n(p,x)}catch{return!0}}function d(p,v){return v()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return Iw.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Iw}var I_;function B4(){return I_||(I_=1,Ow.exports=lK()),Ow.exports}B4();const cK=0,uK=1,dK=2;var D_=Object.prototype.hasOwnProperty;function yk(e,t){var n,i;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((i=e.length)===t.length)for(;i--&&yk(e[i],t[i]););return i===-1}if(!n||typeof e=="object"){i=0;for(n in e)if(D_.call(e,n)&&++i&&!D_.call(t,n)||!(n in t)||!yk(e[n],t[n]))return!1;return Object.keys(t).length===i}}return e!==e&&t!==t}const Kl=new WeakMap,Jl=()=>{},fs=Jl(),gv=Object,va=e=>e===fs,Gl=e=>typeof e=="function",Cu=(e,t)=>({...e,...t}),hK=e=>Gl(e.then),Dw={},e0={},F4="undefined",Kx=typeof window!=F4,bk=typeof document!=F4,fK=Kx&&"Deno"in window,mK=(e,t)=>{const n=Kl.get(e);return[()=>!va(t)&&e.get(t)||Dw,i=>
65{if(!va(t)){const r=e.get(t);t in e0||(e0[t]=r),n[5](t,Cu(r,i),r||Dw)}},n[6],()=>!va(t)&&t in e0?e0[t]:!va(t)&&e.get(t)||Dw]};let wk=!0;const pK=()=>wk,[Sk,kk]=Kx&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Jl,Jl],gK=()=>{const e=bk&&document.visibilityState;return va(e)||e!=="hidden"},vK=e=>(bk&&document.addEventListener("visibilitychange",e),Sk("focus",e),()=>{bk&&document.removeEventListener("visibilitychange",e),kk("focus",e)}),xK=e=>{const t=()=>{wk=!0,e()},n=()=>{wk=!1};return Sk("online",t),Sk("offline",n),()=>{kk("online",t),kk("offline",n)}},yK={isOnline:pK,isVisible:gK},bK={initFocus:vK,initReconnect:xK};he.useId;const Mj=!Kx||fK,wK=Mj?w.useEffect:w.useLayoutEffect,Lw=typeof navigator<"u"&&navigator.connection,L_=!Mj&&Lw&&(["slow-2g","2g"].includes(Lw.effectiveType)||Lw.saveData),t0=new WeakMap,SK=e=>gv.prototype.toString.call(e),Uw=(e,t)=>e===`[object ${t}]`;let kK=0;const Nk=e=>{const t=typeof e,n=SK(e),i=Uw(n,"Date"),r=Uw(n,"RegExp"),s=Uw(n,"Object");let l,c;if(gv(e)===e&&!i&&!r){if(l=t0.get(e),l)return l;if(l=++kK+"~",t0.set(e,l),Array.isArray(e)){for(l="@",c=0;c<e.length;c++)l+=Nk(e[c])+",";t0.set(e,l)}if(s){l="#";const h=gv.keys(e).sort();for(;!va(c=h.pop());)va(e[c])||(l+=c+":"+Nk(e[c])+",");t0.set(e,l)}}else l=i?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return l},$4=e=>{if(Gl(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Nk(e):"",[e,t]};let NK=0;const U_=()=>++NK;async function jK(...e){const[t,n,i,r]=e,s=Cu({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let l=s.populateCache;const c=s.rollbackOnError;let h=s.optimisticData;const d=v=>typeof c=="function"?c(v):c!==!1,f=s.throwOnError;if(Gl(n)){const v=n,x=[],b=t.keys();for(const S of b)!/^\$(inf|sub)\$/.test(S)&&v(t.get(S)._k)&&x.push(S);return Promise.all(x.map(p))}return p(n);async function p(v){const[x]=$4(v);if(!x)return;const[b,S]=mK(t,x),[N,j,T,E]=Kl.get(t),C=()=>{const re=N[x];return(Gl(s.revalidate)?s.revalidate(b().data,v):s.revalidate!==!1)&&(delete T[x],delete E[x],re&&re[0])?re[0](dK).then(()=>b().data):b().data};if(e.length<3)return C();let P=i,A,M=!1;const R=U_();j[x]=[R,0];const B=!va(h),U=b(),O=U.data,F=U._c,ne=va(F)?O:F;if(B&&(h=Gl(h)?h(ne,O):h,S({data:h,_c:ne})),Gl(P))try{P=P(ne)}catch(re){A=re,M=!0}if(P&&hK(P))if(P=await P.catch(re=>{A=re,M=!0}),R!==j[x][0]){if(M)throw A;return P}else M&&B&&d(A)&&(l=!0,S({data:ne,_c:fs}));if(l&&!M)if(Gl(l)){const re=l(P,ne);S({data:re,error:fs,_c:fs})}else S({data:P,error:fs,_c:fs});if(j[x][1]=U_(),Promise.resolve(C()).then(()=>{S({_c:fs})}),M){if(f)throw A;return}return P}}const B_=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},V4=(e,t)=>{if(!Kl.has(e)){const n=Cu(bK,t),i=Object.create(null),r=jK.bind(fs,e);let s=Jl;const l=Object.create(null),c=(f,p)=>{const v=l[f]||[];return l[f]=v,v.push(p),()=>v.splice(v.indexOf(p),1)},h=(f,p,v)=>{e.set(f,p);const x=l[f];if(x)for(const b of x)b(p,v)},d=()=>{if(!Kl.has(e)&&(Kl.set(e,[i,Object.create(null),Object.create(null),Object.create(null),r,h,c]),!Mj)){const f=n.initFocus(setTimeout.bind(fs,B_.bind(fs,i,cK))),p=n.initReconnect(setTimeout.bind(fs,B_.bind(fs,i,uK)));s=()=>{f&&f(),p&&p(),Kl.delete(e)}}};return d(),[e,r,d,s]}return[e,Kl.get(e)[4]]},CK=(e,t,n,i,r)=>{const s=n.errorRetryCount,l=r.retryCount,c=~~((Math.random()+.5)*(1<<(l<8?l:8)))*n.errorRetryInterval;!va(s)&&l>s||setTimeout(i,c,r)},TK=yk,[Rj,EK]=V4(new Map),AK=Cu({onLoadingSlow:Jl,onSuccess:Jl,onError:Jl,onErrorRetry:CK,onDiscarded:Jl,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:L_?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:L_?5e3:3e3,compare:TK,isPaused:()=>!1,cache:Rj,mutate:EK,fallback:{}},yK),PK=(e,t)=>{const n=Cu(e,t);if(t){const{use:i,fallback:r}=e,{use:s,fallback:l}=t;i&&s&&(n.use=i.concat(s)),r&&l&&(n.fallback=Cu(r,l))}return n},F_=w.createContext({}),_K=e=>{const{value:t}=e,n=w.useContext(F_),i=Gl(t),r=w.useMemo(()=>i?t(n):t,[i,n,t]),s=w.useMemo(()=>i?r:PK(n,r),[i,n,r]),l=r&&r.provider,c=w.useRef(fs);l&&!c.current&&(c.current=V4(l(s.cache||Rj),r));const h=c.current;return h&&(s.cache=h[0],s.mutate=h[1]),wK(()=>
65{if(h)return h[2]&&h[2](),h[3]},[]),w.createElement(F_.Provider,Cu(e,{value:s}))},MK="$inf$",z4=Kx&&window.__SWR_DEVTOOLS_USE__,RK=z4?window.__SWR_DEVTOOLS_USE__:[],OK=()=>{z4&&(window.__SWR_DEVTOOLS_REACT__=he)},IK=e=>(t,n,i)=>e(t,n&&((...s)=>{const[l]=$4(t),[,,,c]=Kl.get(Rj);if(l.startsWith(MK))return n(...s);const h=c[l];return va(h)?n(...s):(delete c[l],h)}),i);RK.concat(IK);OK();he.use;const DK=gv.defineProperty(_K,"defaultValue",{value:AK});var $_=Object.prototype.hasOwnProperty;function V_(e,t,n){for(n of e.keys())if(gm(n,t))return n}function gm(e,t){var n,i,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((i=e.length)===t.length)for(;i--&&gm(e[i],t[i]););return i===-1}if(n===Set){if(e.size!==t.size)return!1;for(i of e)if(r=i,r&&typeof r=="object"&&(r=V_(t,r),!r)||!t.has(r))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(i of e)if(r=i[0],r&&typeof r=="object"&&(r=V_(t,r),!r)||!gm(i[1],t.get(r)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((i=e.byteLength)===t.byteLength)for(;i--&&e.getInt8(i)===t.getInt8(i););return i===-1}if(ArrayBuffer.isView(e)){if((i=e.byteLength)===t.byteLength)for(;i--&&e[i]===t[i];);return i===-1}if(!n||typeof e=="object"){i=0;for(n in e)if($_.call(e,n)&&++i&&!$_.call(t,n)||!(n in t)||!gm(e[n],t[n]))return!1;return Object.keys(t).length===i}}return e!==e&&t!==t}function LK(e,t){if(!e)throw typeof t=="string"?new Error(t):new Error(`${t.displayName} not found`)}const il=(e,t)=>{const{assertCtxFn:n=LK}={},i=he.createContext(void 0);return i.displayName=e,[i,()=>{const l=he.useContext(i);return n(l,`${e} not found`),l.value},()=>{const l=he.useContext(i);return l?l.value:{}}]};function UK({swrConfig:e,children:t}){return he.createElement(DK,{value:e},t)}const[q4,W4]=il("ClerkInstanceContext"),[BK]=il("UserContext"),[FK]=il("ClientContext"),[$K]=il("SessionContext");he.createContext({});const[VK]=il("CheckoutContext"),zK=({children:e,...t})=>he.createElement(VK.Provider,{value:{value:t}},e),[qK]=il("OrganizationContext"),WK=({children:e,organization:t,swrConfig:n})=>he.createElement(UK,{swrConfig:n},he.createElement(qK.Provider,{value:{value:{organization:t}}},e));function H4(e){if(!he.useContext(q4)){if(typeof e=="function"){e();return}throw new Error(`${e} can only be used within the <ClerkProvider /> component.
66
67Possible fixes:
681. Ensure that the <ClerkProvider /> is correctly wrapping your application where this component is used.
692. Check for multiple versions of the \`@clerk/shared\` package in your project. Use a tool like \`npm ls @clerk/shared\` to identify multiple versions, and update your dependencies to only rely on one.
70
71Learn more: https://clerk.com/docs/components/clerk-provider`.trim())}}const HK=()=>(H4("useClerk"),W4());typeof window<"u"?he.useLayoutEffect:he.useEffect;const z_=gm,KK=e=>{const t=w.useRef(e);return w.useEffect(()=>{t.current=e},[e]),t.current},ds=(e,t,n)=>{const i=!!n,r=w.useRef(n);w.useEffect(()=>{r.current=n},[n]),w.useEffect(()=>{if(!i||!e)return()=>{};const s=(...l)=>{r.current&&r.current(...l)};return e.on(t,s),()=>{e.off(t,s)}},[i,t,e,r])},K4=he.createContext(null);K4.displayName="ElementsContext";const GK=(e,t)=>{if(!e)throw new Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an <Elements> provider.`);return e},vv=e=>e!==null&&typeof e=="object",YK=(e,t,n)=>vv(e)?Object.keys(e).reduce((i,r)=>{const s=!vv(t)||!G4(e[r],t[r]);return n.includes(r)?(s&&console.warn(`Unsupported prop change: options.${r} is not a mutable property.`),i):s?{...i||{},[r]:e[r]}:i},null):null,q_="[object Object]",G4=(e,t)=>{if(!vv(e)||!vv(t))return e===t;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;const i=Object.prototype.toString.call(e)===q_;if(i!==(Object.prototype.toString.call(t)===q_))return!1;if(!i&&!n)return e===t;const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;const l={};for(let p=0;p<r.length;p+=1)l[r[p]]=!0;for(let p=0;p<s.length;p+=1)l[s[p]]=!0;const c=Object.keys(l);if(c.length!==r.length)return!1;const h=e,d=t,f=p=>G4(h[p],d[p]);return c.every(f)},W_=e=>GK(he.useContext(K4),e),QK=e=>e.charAt(0).toUpperCase()+e.slice(1),XK=(e,t)=>{const n=`${QK(e)}Element`,s=t?l=>{W_(`mounts <${n}>`);const{id:c,className:h}=l;return he.createElement("div",{id:c,className:h})}:({id:l,className:c,fallback:h,options:d={}
71,onBlur:f,onFocus:p,onReady:v,onChange:x,onEscape:b,onClick:S,onLoadError:N,onLoaderStart:j,onNetworksChange:T,onConfirm:E,onCancel:C,onShippingAddressChange:P,onShippingRateChange:A})=>{const M=W_(`mounts <${n}>`),R="elements"in M?M.elements:null,[B,U]=he.useState(null),O=he.useRef(null),F=he.useRef(null),[ne,re]=w.useState(!1);ds(B,"blur",f),ds(B,"focus",p),ds(B,"escape",b),ds(B,"click",S),ds(B,"loaderror",N),ds(B,"loaderstart",j),ds(B,"networkschange",T),ds(B,"confirm",E),ds(B,"cancel",C),ds(B,"shippingaddresschange",P),ds(B,"shippingratechange",A),ds(B,"change",x);let Q;v&&(Q=()=>{re(!0),v(B)}),ds(B,"ready",Q),he.useLayoutEffect(()=>{if(O.current===null&&F.current!==null&&R){let q=null;R&&(q=R.create(e,d)),O.current=q,U(q),q&&q.mount(F.current)}},[R,d]);const W=KK(d);return he.useEffect(()=>{if(!O.current)return;const q=YK(d,W,["paymentRequest"]);q&&"update"in O.current&&O.current.update(q)},[d,W]),he.useLayoutEffect(()=>()=>{if(O.current&&typeof O.current.destroy=="function")try{O.current.destroy(),O.current=null}catch{}},[]),he.createElement(he.Fragment,null,!ne&&h,he.createElement("div",{id:l,style:{height:ne?"unset":"0px",visibility:ne?"visible":"hidden"},className:c,ref:F}))};return s.displayName=n,s.__elementType=e,s};XK("payment",typeof window>"u");il("PaymentElementContext");il("StripeUtilsContext");var wa=I4({packageName:"@clerk/clerk-react"});function JK(e){wa.setMessages(e).setPackageName(e)}var[ZK,eG]=il("AuthContext"),tG=q4,Y4=W4,nG="You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.",iG=e=>`You've passed multiple children components to <${e}/>. You can only pass a single child component or text.`,rG="Invalid state. Feel free to submit a bug or reach out to support here: https://clerk.com/support",Bw="Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.",sG="<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",aG="<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",oG="<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",lG="<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",cG=e=>`<${e} /> can only accept <${e}.Page /> and <${e}.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`,uG=e=>`Missing props. <${e}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`,dG=e=>`Missing props. <${e}.Link /> component requires the following props: url, label and labelIcon.`,hG="<UserButton /> can only accept <UserButton.UserProfilePage />, <UserButton.UserProfileLink /> and <UserButton.MenuItems /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",fG="<UserButton.MenuItems /> component can only accept <UserButton.Action /> and <UserButton.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",mG="<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.",pG="<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.",gG="<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.",vG="Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.",xG="Missing props. <UserButton.Action /> component requires the following props: label.",Q4=e=>{H4(()=>{wa.throwMissingClerkProviderError({source:e})})},X4=e=>new Promise(t=>{const n=i=>{["ready","degraded"].includes(i)&&(t(),e.off("status",n))};e.on("status",n,{notify:!0})}),yG=e=>async t=>(await X4(e),e.session?e.session.getToken(t):null),bG=e=>async(...t)=>
71(await X4(e),e.signOut(...t)),Oj=(e={})=>{var t;Q4("useAuth");const{treatPendingAsSignedOut:n,...i}=e??{},r=i;let l=eG();l.sessionId===void 0&&l.userId===void 0&&(l=r??{});const c=Y4(),h=w.useCallback(yG(c),[c]),d=w.useCallback(bG(c),[c]);return(t=c.telemetry)==null||t.record(oK("useAuth",{treatPendingAsSignedOut:n})),wG({...l,getToken:h,signOut:d},{treatPendingAsSignedOut:n})};function wG(e,{treatPendingAsSignedOut:t=!0}={}){const{userId:n,orgId:i,orgRole:r,has:s,signOut:l,getToken:c,orgPermissions:h,factorVerificationAge:d,sessionClaims:f}=e??{},p=w.useCallback(x=>s?s(x):eK({userId:n,orgId:i,orgRole:r,orgPermissions:h,factorVerificationAge:d,features:(f==null?void 0:f.fea)||"",plans:(f==null?void 0:f.pla)||""})(x),[s,n,i,r,h,d,f]),v=tK({authObject:{...e,getToken:c,signOut:l,has:p},options:{treatPendingAsSignedOut:t}});return v||wa.throw(rG)}var Sn=(e,t)=>{const i=(typeof t=="string"?t:t==null?void 0:t.component)||e.displayName||e.name||"Component";e.displayName=i;const r=typeof t=="string"?void 0:t,s=l=>{Q4(i||"withClerk");const c=Y4();return!c.loaded&&!(r!=null&&r.renderWhileLoading)?null:he.createElement(e,{...l,component:i,clerk:c})};return s.displayName=`withClerk(${i})`,s};const SG=()=>{try{return!1}catch{}return!1},kG=()=>{try{return!1}catch{}return!1},NG=()=>{try{return!0}catch{}return!1},H_=new Set,Ij=(e,t,n)=>{const i=kG()||NG(),r=e;H_.has(r)||i||(H_.add(r),console.warn(`Clerk - DEPRECATION WARNING: "${e}" is deprecated and will be removed in the next major release.
72${t}`))};Sn(({clerk:e,...t})=>{const{client:n,session:i}=e,r=n.signedInSessions?n.signedInSessions.length>0:n.activeSessions&&n.activeSessions.length>0;return he.useEffect(()=>{i===null&&r?e.redirectToAfterSignOut():e.redirectToSignIn(t)},[]),null},"RedirectToSignIn");Sn(({clerk:e,...t})=>(he.useEffect(()=>{e.redirectToSignUp(t)},[]),null),"RedirectToSignUp");Sn(({clerk:e,...t})=>(he.useEffect(()=>{e.redirectToTasks(t)},[]),null),"RedirectToTasks");Sn(({clerk:e})=>(he.useEffect(()=>{Ij("RedirectToUserProfile","Use the `redirectToUserProfile()` method instead."),e.redirectToUserProfile()},[]),null),"RedirectToUserProfile");Sn(({clerk:e})=>(he.useEffect(()=>{Ij("RedirectToOrganizationProfile","Use the `redirectToOrganizationProfile()` method instead."),e.redirectToOrganizationProfile()},[]),null),"RedirectToOrganizationProfile");Sn(({clerk:e})=>(he.useEffect(()=>{Ij("RedirectToCreateOrganization","Use the `redirectToCreateOrganization()` method instead."),e.redirectToCreateOrganization()},[]),null),"RedirectToCreateOrganization");Sn(({clerk:e,...t})=>(he.useEffect(()=>{e.handleRedirectCallback(t)},[]),null),"AuthenticateWithRedirectCallback");function Fw(e,t,n){if(typeof e=="function")return e(t);if(typeof e<"u")return e;if(typeof n<"u")return n}const Er=e=>{SG()&&console.error(`Clerk: ${e}`)};var Dj=v4();const K_=(e,...t)=>{const n={...e};for(const i of t)delete n[i];return n};var Gx=e=>t=>{try{return he.Children.only(e)}catch{return wa.throw(iG(t))}},Yx=(e,t)=>(e||(e=t),typeof e=="string"&&(e=he.createElement("button",null,e)),e),Qx=e=>(...t)=>{if(e&&typeof e=="function")return e(...t)};function jG(e){return typeof e=="function"}var n0=new Map;function CG(e,t,n=1){he.useEffect(()=>{const i=n0.get(e)||0;return i==n?wa.throw(t):(n0.set(e,i+1),()=>{n0.set(e,(n0.get(e)||1)-1)})},[])}function TG(e,t,n){const i=e.displayName||e.name||t||"Component",r=s=>(CG(t,n),he.createElement(e,{...s}));return r.displayName=`withMaxAllowedInstancesGuard(${i})`,r}var vm=e=>{const[t,n]=w.useState(new Map);return e.map(i=>({id:i.id,mount:r=>n(s=>new Map(s).set(String(i.id),r)),unmount:()=>n(r=>{const s=new Map(r);return s.set(String(i.id),null),s}),portal:()=>{const r=t.get(String(i.id));return r?Dj.createPortal(i.component,r):null}}))},jr=(e,t)=>!!e&&he.isValidElement(e)&&(e==null?void 0:e.type)===t,J4=(e,t)=>tL({children:e,reorderItemsLabels:["account","security","billing","apiKeys"],LinkComponent:xp,PageComponent:vp,MenuItemsComponent:Jx,componentName:"UserProfile"},t),Z4=(e,t)=>tL({children:e,reorderItemsLabels:["general","members","billing","apiKeys"],LinkComponent:ey,PageComponent:Zx,componentName:"OrganizationProfile"},t),eL=e=>{const t=[],n=[ey,Zx,Jx,vp,xp];
72return he.Children.forEach(e,i=>{n.some(r=>jr(i,r))||t.push(i)}),t},tL=(e,t)=>{const{children:n,LinkComponent:i,PageComponent:r,MenuItemsComponent:s,reorderItemsLabels:l,componentName:c}=e,{allowForAnyChildren:h=!1}=t||{},d=[];he.Children.forEach(n,T=>{if(!jr(T,r)&&!jr(T,i)&&!jr(T,s)){T&&!h&&Er(cG(c));return}const{props:E}=T,{children:C,label:P,url:A,labelIcon:M}=E;if(jr(T,r))if(G_(E,l))d.push({label:P});else if($w(E))d.push({label:P,labelIcon:M,children:C,url:A});else{Er(uG(c));return}if(jr(T,i))if(Vw(E))d.push({label:P,labelIcon:M,url:A});else{Er(dG(c));return}});const f=[],p=[],v=[];d.forEach((T,E)=>{if($w(T)){f.push({component:T.children,id:E}),p.push({component:T.labelIcon,id:E});return}Vw(T)&&v.push({component:T.labelIcon,id:E})});const x=vm(f),b=vm(p),S=vm(v),N=[],j=[];return d.forEach((T,E)=>{if(G_(T,l)){N.push({label:T.label});return}if($w(T)){const{portal:C,mount:P,unmount:A}=x.find(U=>U.id===E),{portal:M,mount:R,unmount:B}=b.find(U=>U.id===E);N.push({label:T.label,url:T.url,mount:P,unmount:A,mountIcon:R,unmountIcon:B}),j.push(C),j.push(M);return}if(Vw(T)){const{portal:C,mount:P,unmount:A}=S.find(M=>M.id===E);N.push({label:T.label,url:T.url,mountIcon:P,unmountIcon:A}),j.push(C);return}}),{customPages:N,customPagesPortals:j}},G_=(e,t)=>{const{children:n,label:i,url:r,labelIcon:s}=e;return!n&&!r&&!s&&t.some(l=>l===i)},$w=e=>{const{children:t,label:n,url:i,labelIcon:r}=e;return!!t&&!!i&&!!r&&!!n},Vw=e=>{const{children:t,label:n,url:i,labelIcon:r}=e;return!t&&!!i&&!!r&&!!n},EG=(e,t)=>{var n;return AG({children:e,reorderItemsLabels:["manageAccount","signOut"],MenuItemsComponent:Jx,MenuActionComponent:iL,MenuLinkComponent:rL,UserProfileLinkComponent:xp,UserProfilePageComponent:vp,allowForAnyChildren:(n=t==null?void 0:t.allowForAnyChildren)!=null?n:!1})},AG=({children:e,MenuItemsComponent:t,MenuActionComponent:n,MenuLinkComponent:i,UserProfileLinkComponent:r,UserProfilePageComponent:s,reorderItemsLabels:l,allowForAnyChildren:c=!1})=>{const h=[],d=[],f=[];he.Children.forEach(e,S=>{if(!jr(S,t)&&!jr(S,r)&&!jr(S,s)){S&&!c&&Er(hG);return}if(jr(S,r)||jr(S,s))return;const{props:N}=S;he.Children.forEach(N.children,j=>{if(!jr(j,n)&&!jr(j,i)){j&&Er(fG);return}const{props:T}=j,{label:E,labelIcon:C,href:P,onClick:A,open:M}=T;if(jr(j,n))if(Y_(T,l))h.push({label:E});else if(zw(T)){const R={label:E,labelIcon:C};if(A!==void 0)h.push({...R,onClick:A});else if(M!==void 0)h.push({...R,open:M.startsWith("/")?M:`/${M}`});else{Er("Custom menu item must have either onClick or open property");return}}else{Er(xG);return}if(jr(j,i))if(qw(T))h.push({label:E,labelIcon:C,href:P});else{Er(vG);return}})});const p=[],v=[];h.forEach((S,N)=>{zw(S)&&p.push({component:S.labelIcon,id:N}),qw(S)&&v.push({component:S.labelIcon,id:N})});const x=vm(p),b=vm(v);return h.forEach((S,N)=>{if(Y_(S,l)&&d.push({label:S.label}),zw(S)){const{portal:j,mount:T,unmount:E}=x.find(P=>P.id===N),C={label:S.label,mountIcon:T,unmountIcon:E};"onClick"in S?C.onClick=S.onClick:"open"in S&&(C.open=S.open),d.push(C),f.push(j)}if(qw(S)){const{portal:j,mount:T,unmount:E}=b.find(C=>C.id===N);d.push({label:S.label,href:S.href,mountIcon:T,unmountIcon:E}),f.push(j)}}),{customMenuItems:d,customMenuItemsPortals:f}},Y_=(e,t)=>{const{children:n,label:i,onClick:r,labelIcon:s}=e;return!n&&!r&&!s&&t.some(l=>l===i)},zw=e=>{const{label:t,labelIcon:n,onClick:i,open:r}=e;return!!n&&!!t&&(typeof i=="function"||typeof r=="string")},qw=e=>{const{label:t,href:n,labelIcon:i}=e;return!!n&&!!i&&!!t},PG=e=>{const t=e==null?void 0:e.isReady;return n=>new Promise((i,r)=>{const{root:s=document==null?void 0:document.body,selector:l,timeout:c=0}=n;if(!s){r(new Error("No root element provided"));return}let h=s;if(l&&(h=s==null?void 0:s.querySelector(l)),t(h,l)){i();return}const d=new MutationObserver(f=>{for(const p of f)if(!h&&l&&(h=s==null?void 0:s.querySelector(l)),(e.childList&&p.type==="childList"||e.attributes&&p.type==="attributes")&&t(h,l)){d.disconnect(),i();return}});d.observe(s,e),c>0&&setTimeout(()=>{d.disconnect(),r(new Error(`Timeout waiting for ${l}`))},c)})},_G=PG({childList:!0,subtree:!0,isReady:(e,t)=>{var n;return!!(e!=null&&e.childElementCount)&&((n=e==null?void 0:e.matches)==null?void 0:n.call(e,t))&&e.childElementCount>0}});function wr(e,t){const n=w.useRef(),[i,r]=w.useState("rendering");return w.useEffect(()=>{if(!e)throw new Error("Clerk: no component name provided, unable to detect mount.");if(typeof window<"u"&&!n.current){const s=`[data-clerk-component="${e}"]`,l=t==null?void 0:t.selector;n.current=_G({selector:l?s+l:s}).then(()=>{r("rendered")}
72).catch(()=>{r("error")})}},[e,t==null?void 0:t.selector]),i}var i0=e=>"mount"in e,Q_=e=>"open"in e,X_=e=>e==null?void 0:e.map(({mountIcon:t,unmountIcon:n,...i})=>i),qi=class extends he.PureComponent{constructor(){super(...arguments),this.rootRef=he.createRef()}componentDidUpdate(e){var t,n,i,r;if(!i0(e)||!i0(this.props))return;const s=K_(e.props,"customPages","customMenuItems","children"),l=K_(this.props.props,"customPages","customMenuItems","children"),c=((t=s.customPages)==null?void 0:t.length)!==((n=l.customPages)==null?void 0:n.length),h=((i=s.customMenuItems)==null?void 0:i.length)!==((r=l.customMenuItems)==null?void 0:r.length),d=X_(e.props.customMenuItems),f=X_(this.props.props.customMenuItems);(!z_(s,l)||!z_(d,f)||c||h)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&(i0(this.props)&&this.props.mount(this.rootRef.current,this.props.props),Q_(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&(i0(this.props)&&this.props.unmount(this.rootRef.current),Q_(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:e=!1}=this.props,t={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-clerk-component":this.props.component}};return he.createElement(he.Fragment,null,!e&&he.createElement("div",{...t}),this.props.children)}},Xx=e=>{var t,n;return he.createElement(he.Fragment,null,(t=e==null?void 0:e.customPagesPortals)==null?void 0:t.map((i,r)=>w.createElement(i,{key:r})),(n=e==null?void 0:e.customMenuItemsPortals)==null?void 0:n.map((i,r)=>w.createElement(i,{key:r})))},MG=Sn(({clerk:e,component:t,fallback:n,...i})=>
72{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountSignIn,unmount:e.unmountSignIn,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"SignIn",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountSignUp,unmount:e.unmountSignUp,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"SignUp",renderWhileLoading:!0});function vp({children:e}){return Er(sG),he.createElement(he.Fragment,null,e)}function xp({children:e}){return Er(aG),he.createElement(he.Fragment,null,e)}var RG=Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:h}=J4(i.children);return he.createElement(he.Fragment,null,s&&n,he.createElement(qi,{component:t,mount:e.mountUserProfile,unmount:e.unmountUserProfile,updateProps:e.__unstable__updateProps,props:{...i,customPages:c},rootProps:l},he.createElement(Xx,{customPagesPortals:h})))},{component:"UserProfile",renderWhileLoading:!0});Object.assign(RG,{Page:vp,Link:xp});var nL=w.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),OG=Sn(({clerk:e,component:t,fallback:n,...i})=>
72{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:h}=J4(i.children,{allowForAnyChildren:!!i.__experimental_asProvider}),d={...i.userProfileProps,customPages:c},{customMenuItems:f,customMenuItemsPortals:p}=EG(i.children,{allowForAnyChildren:!!i.__experimental_asProvider}),v=eL(i.children),x={mount:e.mountUserButton,unmount:e.unmountUserButton,updateProps:e.__unstable__updateProps,props:{...i,userProfileProps:d,customMenuItems:f}},b={customPagesPortals:h,customMenuItemsPortals:p};return he.createElement(nL.Provider,{value:x},s&&n,e.loaded&&he.createElement(qi,{component:t,...x,hideRootHtmlElement:!!i.__experimental_asProvider,rootProps:l},i.__experimental_asProvider?v:null,he.createElement(Xx,{...b})))},{component:"UserButton",renderWhileLoading:!0});function Jx({children:e}){return Er(mG),he.createElement(he.Fragment,null,e)}function iL({children:e}){return Er(pG),he.createElement(he.Fragment,null,e)}function rL({children:e}){return Er(gG),he.createElement(he.Fragment,null,e)}function IG(e){const t=w.useContext(nL),n={...t,props:{...t.props,...e}};return he.createElement(qi,{...n})}Object.assign(OG,{UserProfilePage:vp,UserProfileLink:xp,MenuItems:Jx,Action:iL,Link:rL,__experimental_Outlet:IG});function Zx({children:e}){return Er(oG),he.createElement(he.Fragment,null,e)}function ey({children:e}){return Er(lG),he.createElement(he.Fragment,null,e)}var DG=Sn(({clerk:e,component:t,fallback:n,...i})=>
72{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:h}=Z4(i.children);return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountOrganizationProfile,unmount:e.unmountOrganizationProfile,updateProps:e.__unstable__updateProps,props:{...i,customPages:c},rootProps:l},he.createElement(Xx,{customPagesPortals:h})))},{component:"OrganizationProfile",renderWhileLoading:!0});Object.assign(DG,{Page:Zx,Link:ey});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountCreateOrganization,unmount:e.unmountCreateOrganization,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"CreateOrganization",renderWhileLoading:!0});var sL=w.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),LG=Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr
72(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:h}=Z4(i.children,{allowForAnyChildren:!!i.__experimental_asProvider}),d={...i.organizationProfileProps,customPages:c},f=eL(i.children),p={mount:e.mountOrganizationSwitcher,unmount:e.unmountOrganizationSwitcher,updateProps:e.__unstable__updateProps,props:{...i,organizationProfileProps:d},rootProps:l,component:t};return e.__experimental_prefetchOrganizationSwitcher(),he.createElement(sL.Provider,{value:p},he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{...p,hideRootHtmlElement:!!i.__experimental_asProvider},i.__experimental_asProvider?f:null,he.createElement(Xx,{customPagesPortals:h}))))},{component:"OrganizationSwitcher",renderWhileLoading:!0});function UG(e){const t=w.useContext(sL),n={...t,props:{...t.props,...e}};return he.createElement(qi,{...n})}Object.assign(LG,{OrganizationProfilePage:Zx,OrganizationProfileLink:ey,__experimental_Outlet:UG});Sn(({clerk:e,component:t,fallback:n,...i})=>
72{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountOrganizationList,unmount:e.unmountOrganizationList,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"OrganizationList",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,open:e.openGoogleOneTap,close:e.closeGoogleOneTap,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"GoogleOneTap",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountWaitlist,unmount:e.unmountWaitlist,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"Waitlist",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>
72{const s=wr(t,{selector:'[data-component-status="ready"]'})==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountPricingTable,unmount:e.unmountPricingTable,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"PricingTable",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountAPIKeys,unmount:e.unmountAPIKeys,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"ApiKeys",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountUserAvatar,unmount:e.unmountUserAvatar,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"UserAvatar",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>
72{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountTaskChooseOrganization,unmount:e.unmountTaskChooseOrganization,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"TaskChooseOrganization",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountTaskResetPassword,unmount:e.unmountTaskResetPassword,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"TaskResetPassword",renderWhileLoading:!0});Sn(({clerk:e,component:t,fallback:n,...i})=>{const s=wr(t)==="rendering"||!e.loaded,l={...s&&n&&{style:{display:"none"}}};return he.createElement(he.Fragment,null,s&&n,e.loaded&&he.createElement(qi,{component:t,mount:e.mountTaskSetupMFA,unmount:e.unmountTaskSetupMFA,updateProps:e.__unstable__updateProps,props:i,rootProps:l}))},{component:"TaskSetupMFA",renderWhileLoading:!0});var aL=e=>{throw TypeError(e)},Lj=(e,t,n)=>t.has(e)||aL("Cannot "+n),Pn=(e,t,n)=>(Lj(e,t,"read from private field"),n?n.call(e):t.get(e)),Fl=(e,t,n)=>t.has(e)?aL("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Bc=(e,t,n,i)=>(Lj(e,t,"write to private field"),t.set(e,n),n),Ww=(e,t,n)=>(Lj(e,t,"access private method"),n);const BG={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(e,t)=>t<5,retryImmediately:!1,jitter:!0},FG=100,oL=async e=>new Promise(t=>setTimeout(t,e)),lL=(e,t)=>t?e*(1+Math.random()):e,$G=e=>{let t=0;const n=()=>{const i=e.initialDelay,r=e.factor;let s=i*Math.pow(r,t);return s=lL(s,e.jitter),Math.min(e.maxDelayBetweenRetries||s,s)};return async()=>{await oL(n()),t++}},VG=async(e,t={})=>{let n=0;const{shouldRetry:i,initialDelay:r,maxDelayBetweenRetries:s,factor:l,retryImmediately:c,jitter:h,onBeforeRetry:d}={...BG,...t},f=$G({initialDelay:r,maxDelayBetweenRetries:s,factor:l,jitter:h});for(;;)try{return await e()}catch(p){if(n++,!i(p,n))throw p;d&&await d(n),c&&n===1?await oL(lL(FG,h)):await f()}},zG="loadScript cannot be called when document does not exist",qG="loadScript cannot be called without a src";async function WG(e="",t){const{async:n,defer:i,beforeLoad:r,crossOrigin:s,nonce:l}=t||{};return VG(()=>new Promise((h,d)=>{e||d(new Error(qG)),(!document||!document.body)&&d(new Error(zG));const f=document.createElement("script");s&&f.setAttribute("crossorigin",s),f.async=n||!1,f.defer=i||!1,f.addEventListener("load",()=>{f.remove(),h(f)}),f.addEventListener("error",p=>{f.remove(),d(p.error??new Error(`failed to load script: ${e}`))}),f.src=e,f.nonce=l,r==null||r(f),document.body.appendChild(f)}),{shouldRetry:(h,d)=>d<=5})}function HG(e){return e?KG(e)||cL(e):!0}function KG(e){return/^http(s)?:\/\//.test(e||"")}function cL(e){return e.startsWith("/")}function GG(e){return e?cL(e)?new URL(e,window.location.origin).toString():e:""}function YG(e){if(!e)return"";let t;if(e.match(/^(clerk\.)+\w*$/))t=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;t=/^(clerk\.)*/gi}return`clerk.${e.replace(t,"")}`}const QG=(e,t="5.125.12")=>{if(e)return e;const n=XG(t);return n?n==="snapshot"?"5.125.12":n:JG(t)},XG=e=>{var t;return(t=e.trim().replace(/^v/,"").match(/-(.+?)(\.|$)/))==null?void 0:t[1]},JG=e=>e.trim().replace(/^v/,"").split(".")[0],uL="failed_to_load_clerk_js",ZG="failed_to_load_clerk_js_timeout",jk="Failed to load Clerk",{isDevOrStagingUrl:eY}=rK(),dL=I4({packageName:"@clerk/shared"});function tY(e){dL.setPackageName({packageName:e})}function Ck(){if(typeof window>"u"||!window.Clerk)return!1;const e=window.Clerk;return typeof e=="object"&&typeof e.load=="function"}function nY(e){if(typeof window>"u"||!window.performance)return!1;const t=performance.getEntriesByName(e,"resource");if(t.length===0)return!1;const n=t[t.length-1];return n.transferSize===0&&n.decodedBodySize===0&&(n.responseEnd===0||n.responseEnd>0&&n.responseStart>
720||"responseStatus"in n&&(n.responseStatus>=400||n.responseStatus===0))}function J_(e,t){return new Promise((n,i)=>{let r=!1;const s=(f,p)=>{clearTimeout(f),clearInterval(p)};t==null||t.addEventListener("error",()=>{s(h,d),i(new vk(jk,{code:uL}))});const l=()=>{r||Ck()&&(r=!0,s(h,d),n(null))},h=setTimeout(()=>{r||(r=!0,s(h,d),Ck()?n(null):i(new vk(jk,{code:ZG})))},e);l();const d=setInterval(()=>{if(r){clearInterval(d);return}l()},100)})}const iY=async e=>{const t=(e==null?void 0:e.scriptLoadTimeout)??15e3;if(Ck())return null;if(!(e!=null&&e.publishableKey))return dL.throwMissingPublishableKeyError(),null;const n=rY(e),i=document.querySelector("script[data-clerk-js-script]");if(i)if(nY(n))i.remove();else try{return await J_(t,i),null}catch{i.remove()}const r=J_(t);return WG(n,{async:!0,crossOrigin:"anonymous",nonce:e.nonce,beforeLoad:aY(e)}).catch(s=>{throw new vk(jk+(s.message?`, ${s.message}`:""),{code:uL,cause:s})}),r},rY=e=>{var f,p;const{clerkJSUrl:t,clerkJSVariant:n,clerkJSVersion:i,proxyUrl:r,domain:s,publishableKey:l}=e;if(t)return t;let c="";r&&HG(r)?c=GG(r).replace(/http(s)?:\/\//,""):s&&!eY(((f=R_(l))==null?void 0:f.frontendApi)||"")?c=YG(s):c=((p=R_(l))==null?void 0:p.frontendApi)||"";const h=n?`${n.replace(/\.+$/,"")}.`:"",d=QG(i);return`https://${c}/npm/@clerk/clerk-js@${d}/dist/clerk.${h}browser.js`},sY=e=>{const t={};return e.publishableKey&&(t["data-clerk-publishable-key"]=e.publishableKey),e.proxyUrl&&(t["data-clerk-proxy-url"]=e.proxyUrl),e.domain&&(t["data-clerk-domain"]=e.domain),e.nonce&&(t.nonce=e.nonce),t},aY=e=>t=>{const n=sY(e);for(const i in n)t.setAttribute(i,n[i])},oY=(e,t,n)=>!e&&n?lY(n):cY(t),lY=e=>{const t=e.userId,n=e.user,i=e.sessionId,r=e.sessionStatus,s=e.sessionClaims;return{userId:t,user:n,sessionId:i,session:e.session,sessionStatus:r,sessionClaims:s,organization:e.organization,orgId:e.orgId,orgRole:e.orgRole,orgPermissions:e.orgPermissions,orgSlug:e.orgSlug,actor:e.actor,factorVerificationAge:e.factorVerificationAge}},cY=e=>{var b,S,N,j;const t=e.user?e.user.id:e.user,n=e.user,i=e.session?e.session.id:e.session,r=e.session,s=(b=e.session)==null?void 0:b.status,l=e.session?(N=(S=e.session.lastActiveToken)==null?void 0:S.jwt)==null?void 0:N.claims:null,c=e.session?e.session.factorVerificationAge:null,h=r==null?void 0:r.actor,d=e.organization,f=e.organization?e.organization.id:e.organization,p=d==null?void 0:d.slug,v=d&&((j=n==null?void 0:n.organizationMemberships)==null?void 0:j.find(T=>T.organization.id===f)),x=v&&v.permissions;return{userId:t,user:n,sessionId:i,session:r,sessionStatus:s,sessionClaims:l,organization:d,orgId:f,orgRole:v&&v.role,orgSlug:p,orgPermissions:x,actor:h,factorVerificationAge:c}};function xv(){return typeof window<"u"}const Z_=(e,t,n,i,r)=>{const{notify:s}=r||{};let l=e.get(n);l||(l=[],e.set(n,l)),l.push(i),s&&t.has(n)&&i(t.get(n))},e5=(e,t,n)=>(e.get(t)||[]).map(i=>i(n)),t5=(e,t,n)=>{const i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},uY=()=>{const e=new Map,t=new Map,n=new Map;return{on:(...r)=>Z_(e,t,...r),prioritizedOn:(...r)=>Z_(n,t,...r),emit:(r,s)=>{t.set(r,s),e5(n,r,s),e5(e,r,s)},off:(...r)=>t5(e,...r),prioritizedOff:(...r)=>t5(n,...r),internal:{retrieveListeners:r=>e.get(r)||[]}}},r0={Status:"status"},dY=()=>uY();typeof window<"u"&&!window.global&&(window.global=typeof global>"u"?window:global);Sn(({clerk:e,children:t,...n})=>{const{appearance:i,signUpFallbackRedirectUrl:r,forceRedirectUrl:s,fallbackRedirectUrl:l,signUpForceRedirectUrl:c,mode:h,initialValues:d,withSignUp:f,oauthFlow:p,...v}=n;t=Yx(t,"Sign in");const x=Gx(t)("SignInButton"),b=()=>{const j={forceRedirectUrl:s,fallbackRedirectUrl:l,signUpFallbackRedirectUrl:r,signUpForceRedirectUrl:c,initialValues:d,withSignUp:f,oauthFlow:p};return h==="modal"?e.openSignIn({...j,appearance:i}):e.redirectToSignIn({...j,signInFallbackRedirectUrl:l,signInForceRedirectUrl:s})},N={...v,onClick:async j=>(x&&typeof x=="object"&&"props"in x&&await Qx(x.props.onClick)(j),b())};return he.cloneElement(x,N)},{component:"SignInButton",renderWhileLoading:!0});Sn(({clerk:e,children:t,...n})=>{const{redirectUrl:i,...r}=n;t=Yx(t,"Sign in with Metamask");const s=Gx(t)("SignInWithMetamaskButton"),l=async()=>{async function d(){await e.authenticateWithMetamask({redirectUrl:i||void 0})}d()},h={...r,onClick:async d=>(await Qx(s.props.onClick)(d),l())};return he.cloneElement(s,h)}
72,{component:"SignInWithMetamask",renderWhileLoading:!0});Sn(({clerk:e,children:t,...n})=>{const{redirectUrl:i="/",signOutOptions:r,...s}=n;t=Yx(t,"Sign out");const l=Gx(t)("SignOutButton"),c=()=>e.signOut({redirectUrl:i,...r}),d={...s,onClick:async f=>(await Qx(l.props.onClick)(f),c())};return he.cloneElement(l,d)},{component:"SignOutButton",renderWhileLoading:!0});Sn(({clerk:e,children:t,...n})=>{const{appearance:i,unsafeMetadata:r,fallbackRedirectUrl:s,forceRedirectUrl:l,signInFallbackRedirectUrl:c,signInForceRedirectUrl:h,mode:d,initialValues:f,oauthFlow:p,...v}=n;t=Yx(t,"Sign up");const x=Gx(t)("SignUpButton"),b=()=>{const j={fallbackRedirectUrl:s,forceRedirectUrl:l,signInFallbackRedirectUrl:c,signInForceRedirectUrl:h,initialValues:f,oauthFlow:p};return d==="modal"?e.openSignUp({...j,appearance:i,unsafeMetadata:r}):e.redirectToSignUp({...j,signUpFallbackRedirectUrl:s,signUpForceRedirectUrl:l})},N={...v,onClick:async j=>(x&&typeof x=="object"&&"props"in x&&await Qx(x.props.onClick)(j),b())};return he.cloneElement(x,N)},{component:"SignUpButton",renderWhileLoading:!0});var hY=()=>({fields:{identifier:null,password:null,code:null},raw:null,global:null}),fY=()=>({fields:{firstName:null,lastName:null,emailAddress:null,phoneNumber:null,password:null,username:null,code:null,captcha:null,legalAccepted:null},raw:null,global:null}),mY=class{constructor(e){this.isomorphicClerk=e,this.signInSignalProxy=this.buildSignInProxy(),this.signUpSignalProxy=this.buildSignUpProxy()}signInSignal(){return this.signInSignalProxy}signUpSignal(){return this.signUpSignalProxy}buildSignInProxy(){const e=this.gateProperty.bind(this),t=()=>this.client.signIn.__internal_future;return{errors:hY(),fetchStatus:"idle",signIn:{status:"needs_identifier",availableStrategies:[],isTransferable:!1,get id(){return e(t,"id",void 0)},get supportedFirstFactors(){return e(t,"supportedFirstFactors",[])},get supportedSecondFactors(){return e(t,"supportedSecondFactors",[])},get secondFactorVerification(){return e(t,"secondFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},get identifier(){return e(t,"identifier",null)},get createdSessionId(){return e(t,"createdSessionId",null)},get userData(){return e(t,"userData",{})},get firstFactorVerification(){return e(t,"firstFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},create:this.gateMethod(t,"create"),password:this.gateMethod(t,"password"),sso:this.gateMethod(t,"sso"),finalize:this.gateMethod(t,"finalize"),emailCode:this.wrapMethods(()=>t().emailCode,["sendCode","verifyCode"]),emailLink:this.wrapStruct(()=>t().emailLink,["sendLink","waitForVerification"],["verification"],{verification:null}),resetPasswordEmailCode:this.wrapMethods(()=>t().resetPasswordEmailCode,["sendCode","verifyCode","submitPassword"]),phoneCode:this.wrapMethods(()=>t().phoneCode,["sendCode","verifyCode"]),mfa:this.wrapMethods(()=>t().mfa,["sendPhoneCode","verifyPhoneCode","verifyTOTP","verifyBackupCode"]),ticket:this.gateMethod(t,"ticket"),passkey:this.gateMethod(t,"passkey"),web3:this.gateMethod(t,"web3")}}}buildSignUpProxy(){const e=this.gateProperty.bind(this),t=this.gateMethod.bind(this),n=this.wrapMethods.bind(this),i=()=>this.client.signUp.__internal_future;return{errors:fY(),fetchStatus:"idle",signUp:{get id(){return e(i,"id",void 0)},get requiredFields(){return e(i,"requiredFields",[])},get optionalFields(){return e(i,"optionalFields",[])},get missingFields(){return e(i,"missingFields",[])},get username(){return e(i,"username",null)},get firstName(){return e(i,"firstName",null)},get lastName(){return e(i,"lastName",null)},get emailAddress(){return e(i,"emailAddress",null)},get phoneNumber(){return e(i,"phoneNumber",null)},get web3Wallet(){return e(i,"web3Wallet",null)},get hasPassword(){return e(i,"hasPassword",!1)},get unsafeMetadata(){return e(i,"unsafeMetadata",{})}
72,get createdSessionId(){return e(i,"createdSessionId",null)},get createdUserId(){return e(i,"createdUserId",null)},get abandonAt(){return e(i,"abandonAt",null)},get legalAcceptedAt(){return e(i,"legalAcceptedAt",null)},get locale(){return e(i,"locale",null)},get status(){return e(i,"status","missing_requirements")},get unverifiedFields(){return e(i,"unverifiedFields",[])},get isTransferable(){return e(i,"isTransferable",!1)},create:t(i,"create"),update:t(i,"update"),sso:t(i,"sso"),password:t(i,"password"),ticket:t(i,"ticket"),web3:t(i,"web3"),finalize:t(i,"finalize"),verifications:n(()=>i().verifications,["sendEmailCode","verifyEmailCode","sendPhoneCode","verifyPhoneCode"])}}}__internal_effect(e){throw new Error("__internal_effect called before Clerk is loaded")}__internal_computed(e){throw new Error("__internal_computed called before Clerk is loaded")}get client(){const e=this.isomorphicClerk.client;if(!e)throw new Error("Clerk client not ready");return e}gateProperty(e,t,n){return!xv()||!this.isomorphicClerk.loaded?n:e()[t]}gateMethod(e,t){return(async(...n)=>{if(!xv())return wa.throw(`Attempted to call a method (${t}) that is not supported on the server.`);this.isomorphicClerk.loaded||await new Promise(r=>this.isomorphicClerk.addOnLoaded(r));const i=e();return i[t].apply(i,n)})}wrapMethods(e,t){return Object.fromEntries(t.map(n=>[n,this.gateMethod(e,n)]))}wrapStruct(e,t,n,i){const r={};for(const s of t)r[s]=this.gateMethod(e,s);for(const s of n)Object.defineProperty(r,s,{get:()=>this.gateProperty(e,s,i[s]),enumerable:!0});return r}};typeof globalThis.__BUILD_DISABLE_RHC__>"u"&&(globalThis.__BUILD_DISABLE_RHC__=!1);var pY={name:"@clerk/clerk-react",version:"5.61.8",environment:"production"},R0,Ld,Ud,$l,$a,O0,zl,am,I0,hL=class fL{constructor(t){Fl(this,am),this.clerkjs=null,this.preopenOneTap=null,this.preopenUserVerification=null,this.preopenEnableOrganizationsPrompt=null,this.preopenSignIn=null,this.preopenCheckout=null,this.preopenPlanDetails=null,this.preopenSubscriptionDetails=null,this.preopenSignUp=null,this.preopenUserProfile=null,this.preopenOrganizationProfile=null,this.preopenCreateOrganization=null,this.preOpenWaitlist=null,this.premountSignInNodes=new Map,this.premountSignUpNodes=new Map,this.premountUserAvatarNodes=new Map,this.premountUserProfileNodes=new Map,this.premountUserButtonNodes=new Map,this.premountOrganizationProfileNodes=new Map,this.premountCreateOrganizationNodes=new Map,this.premountOrganizationSwitcherNodes=new Map,this.premountOrganizationListNodes=new Map,this.premountMethodCalls=new Map,this.premountWaitlistNodes=new Map,this.premountPricingTableNodes=new Map,this.premountAPIKeysNodes=new Map,this.premountOAuthConsentNodes=new Map,this.premountTaskChooseOrganizationNodes=new Map,this.premountTaskResetPasswordNodes=new Map,this.premountTaskSetupMFANodes=new Map,this.premountAddListenerCalls=new Map,this.loadedListeners=[],Fl(this,R0,"loading"),Fl(this,Ld),Fl(this,Ud),Fl(this,$l),Fl(this,$a,dY()),Fl(this,O0),this.buildSignInUrl=r=>{const s=()=>{var l;return((l=this.clerkjs)==null?void 0:l.buildSignInUrl(r))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildSignInUrl",s)},this.buildSignUpUrl=r=>{const s=()=>{var l;return((l=this.clerkjs)==null?void 0:l.buildSignUpUrl(r))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildSignUpUrl",s)},this.buildAfterSignInUrl=(...r)=>{const s=()=>{var l;return((l=this.clerkjs)==null?void 0:l.buildAfterSignInUrl(...r))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildAfterSignInUrl",s)},this.buildAfterSignUpUrl=(...r)=>{const s=()=>{var l;return((l=this.clerkjs)==null?void 0:l.buildAfterSignUpUrl(...r))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildAfterSignUpUrl",s)},this.buildAfterSignOutUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildAfterSignOutUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildAfterSignOutUrl",r)},this.buildNewSubscriptionRedirectUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildNewSubscriptionRedirectUrl())||""};
72if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl",r)},this.buildAfterMultiSessionSingleSignOutUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildAfterMultiSessionSingleSignOutUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl",r)},this.buildUserProfileUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildUserProfileUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildUserProfileUrl",r)},this.buildCreateOrganizationUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildCreateOrganizationUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildCreateOrganizationUrl",r)},this.buildOrganizationProfileUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildOrganizationProfileUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildOrganizationProfileUrl",r)},this.buildWaitlistUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildWaitlistUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildWaitlistUrl",r)},this.buildTasksUrl=()=>{const r=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildTasksUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildTasksUrl",r)},this.buildUrlWithAuth=r=>{const s=()=>{var l;return((l=this.clerkjs)==null?void 0:l.buildUrlWithAuth(r))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildUrlWithAuth",s)},this.handleUnauthenticated=async()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.handleUnauthenticated()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("handleUnauthenticated",r)},this.on=(...r)=>{var s;if((s=this.clerkjs)!=null&&s.on)return this.clerkjs.on(...r);Pn(this,$a).on(...r)},this.off=(...r)=>{var s;if((s=this.clerkjs)!=null&&s.off)return this.clerkjs.off(...r);Pn(this,$a).off(...r)},this.addOnLoaded=r=>{this.loadedListeners.push(r),this.loaded&&this.emitLoaded()},this.emitLoaded=()=>{this.loadedListeners.forEach(r=>r()),this.loadedListeners=[]},this.beforeLoad=r=>{if(!r)throw new Error("Failed to hydrate latest Clerk JS")},this.hydrateClerkJS=r=>{var s,l;if(!r)throw new Error("Failed to hydrate latest Clerk JS");return this.clerkjs=r,this.premountMethodCalls.forEach(c=>c()),this.premountAddListenerCalls.forEach((c,h)=>{c.nativeUnsubscribe=r.addListener(h)}),(s=Pn(this,$a).internal.retrieveListeners("status"))==null||s.forEach(c=>{this.on("status",c,{notify:!0})}),(l=Pn(this,$a).internal.retrieveListeners("queryClientStatus"))==null||l.forEach(c=>{this.on("queryClientStatus",c,{notify:!0})}),this.preopenSignIn!==null&&r.openSignIn(this.preopenSignIn),this.preopenCheckout!==null&&r.__internal_openCheckout(this.preopenCheckout),this.preopenPlanDetails!==null&&r.__internal_openPlanDetails(this.preopenPlanDetails),this.preopenSubscriptionDetails!==null&&r.__internal_openSubscriptionDetails(this.preopenSubscriptionDetails),this.preopenSignUp!==null&&r.openSignUp(this.preopenSignUp),this.preopenUserProfile!==null&&r.openUserProfile(this.preopenUserProfile),this.preopenUserVerification!==null&&r.__internal_openReverification(this.preopenUserVerification),this.preopenOneTap!==null&&r.openGoogleOneTap(this.preopenOneTap),this.preopenOrganizationProfile!==null&&r.openOrganizationProfile(this.preopenOrganizationProfile),this.preopenCreateOrganization!==null&&r.openCreateOrganization(this.preopenCreateOrganization),this.preOpenWaitlist!==null&&r.openWaitlist(this.preOpenWaitlist),this.preopenEnableOrganizationsPrompt&&r.__internal_openEnableOrganizationsPrompt(this.preopenEnableOrganizationsPrompt),this.premountSignInNodes.forEach((c,h)=>{r.mountSignIn(h,c)}),this.premountSignUpNodes.forEach((c,h)=>{r.mountSignUp(h,c)}),this.premountUserProfileNodes.forEach((c,h)=>{r.mountUserProfile(h,c)}),this.premountUserAvatarNodes.forEach((c,h)=>{r.mountUserAvatar(h,c)}
72),this.premountUserButtonNodes.forEach((c,h)=>{r.mountUserButton(h,c)}),this.premountOrganizationListNodes.forEach((c,h)=>{r.mountOrganizationList(h,c)}),this.premountWaitlistNodes.forEach((c,h)=>{r.mountWaitlist(h,c)}),this.premountPricingTableNodes.forEach((c,h)=>{r.mountPricingTable(h,c)}),this.premountAPIKeysNodes.forEach((c,h)=>{r.mountAPIKeys(h,c)}),this.premountOAuthConsentNodes.forEach((c,h)=>{r.__internal_mountOAuthConsent(h,c)}),this.premountTaskChooseOrganizationNodes.forEach((c,h)=>{r.mountTaskChooseOrganization(h,c)}),this.premountTaskResetPasswordNodes.forEach((c,h)=>{r.mountTaskResetPassword(h,c)}),this.premountTaskSetupMFANodes.forEach((c,h)=>{r.mountTaskSetupMFA(h,c)}),typeof this.clerkjs.status>"u"&&Pn(this,$a).emit(r0.Status,"ready"),this.emitLoaded(),this.clerkjs},this.__experimental_checkout=(...r)=>{var s;return(s=this.clerkjs)==null?void 0:s.__experimental_checkout(...r)},this.__unstable__updateProps=async r=>{const s=await Ww(this,am,I0).call(this);if(s&&"__unstable__updateProps"in s)return s.__unstable__updateProps(r)},this.setActive=r=>this.clerkjs?this.clerkjs.setActive(r):Promise.reject(),this.openSignIn=r=>{this.clerkjs&&this.loaded?this.clerkjs.openSignIn(r):this.preopenSignIn=r},this.closeSignIn=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignIn():this.preopenSignIn=null},this.__internal_openCheckout=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openCheckout(r):this.preopenCheckout=r},this.__internal_closeCheckout=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeCheckout():this.preopenCheckout=null},this.__internal_openPlanDetails=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openPlanDetails(r):this.preopenPlanDetails=r},this.__internal_closePlanDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closePlanDetails():this.preopenPlanDetails=null},this.__internal_openSubscriptionDetails=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openSubscriptionDetails(r):this.preopenSubscriptionDetails=r??null},this.__internal_closeSubscriptionDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeSubscriptionDetails():this.preopenSubscriptionDetails=null},this.__internal_openReverification=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openReverification(r):this.preopenUserVerification=r},this.__internal_closeReverification=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeReverification():this.preopenUserVerification=null},this.__internal_openEnableOrganizationsPrompt=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openEnableOrganizationsPrompt(r):this.preopenEnableOrganizationsPrompt=r},this.__internal_closeEnableOrganizationsPrompt=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeEnableOrganizationsPrompt():this.preopenEnableOrganizationsPrompt=null},this.openGoogleOneTap=r=>{this.clerkjs&&this.loaded?this.clerkjs.openGoogleOneTap(r):this.preopenOneTap=r},this.closeGoogleOneTap=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeGoogleOneTap():this.preopenOneTap=null},this.openUserProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.openUserProfile(r):this.preopenUserProfile=r},this.closeUserProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeUserProfile():this.preopenUserProfile=null},this.openOrganizationProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.openOrganizationProfile(r):this.preopenOrganizationProfile=r},this.closeOrganizationProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeOrganizationProfile():this.preopenOrganizationProfile=null},this.openCreateOrganization=r=>{this.clerkjs&&this.loaded?this.clerkjs.openCreateOrganization(r):this.preopenCreateOrganization=r},this.closeCreateOrganization=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeCreateOrganization():this.preopenCreateOrganization=null},this.openWaitlist=r=>{this.clerkjs&&this.loaded?this.clerkjs.openWaitlist(r):this.preOpenWaitlist=r},this.closeWaitlist=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeWaitlist():this.preOpenWaitlist=null},this.openSignUp=r=>{this.clerkjs&&this.loaded?this.clerkjs.openSignUp(r):this.preopenSignUp=r},this.closeSignUp=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignUp():this.preopenSignUp=null}
72,this.mountSignIn=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignIn(r,s):this.premountSignInNodes.set(r,s)},this.unmountSignIn=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignIn(r):this.premountSignInNodes.delete(r)},this.mountSignUp=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignUp(r,s):this.premountSignUpNodes.set(r,s)},this.unmountSignUp=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignUp(r):this.premountSignUpNodes.delete(r)},this.mountUserAvatar=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserAvatar(r,s):this.premountUserAvatarNodes.set(r,s)},this.unmountUserAvatar=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserAvatar(r):this.premountUserAvatarNodes.delete(r)},this.mountUserProfile=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserProfile(r,s):this.premountUserProfileNodes.set(r,s)},this.unmountUserProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserProfile(r):this.premountUserProfileNodes.delete(r)},this.mountOrganizationProfile=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationProfile(r,s):this.premountOrganizationProfileNodes.set(r,s)},this.unmountOrganizationProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationProfile(r):this.premountOrganizationProfileNodes.delete(r)},this.mountCreateOrganization=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountCreateOrganization(r,s):this.premountCreateOrganizationNodes.set(r,s)},this.unmountCreateOrganization=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountCreateOrganization(r):this.premountCreateOrganizationNodes.delete(r)},this.mountOrganizationSwitcher=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationSwitcher(r,s):this.premountOrganizationSwitcherNodes.set(r,s)},this.unmountOrganizationSwitcher=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationSwitcher(r):this.premountOrganizationSwitcherNodes.delete(r)},this.__experimental_prefetchOrganizationSwitcher=()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.__experimental_prefetchOrganizationSwitcher()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher",r)},this.mountOrganizationList=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationList(r,s):this.premountOrganizationListNodes.set(r,s)},this.unmountOrganizationList=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationList(r):this.premountOrganizationListNodes.delete(r)},this.mountUserButton=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserButton(r,s):this.premountUserButtonNodes.set(r,s)},this.unmountUserButton=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserButton(r):this.premountUserButtonNodes.delete(r)},this.mountWaitlist=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountWaitlist(r,s):this.premountWaitlistNodes.set(r,s)},this.unmountWaitlist=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountWaitlist(r):this.premountWaitlistNodes.delete(r)},this.mountPricingTable=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountPricingTable(r,s):this.premountPricingTableNodes.set(r,s)},this.unmountPricingTable=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountPricingTable(r):this.premountPricingTableNodes.delete(r)},this.mountAPIKeys=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountAPIKeys(r,s):this.premountAPIKeysNodes.set(r,s)},this.unmountAPIKeys=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountAPIKeys(r):this.premountAPIKeysNodes.delete(r)},this.__internal_mountOAuthConsent=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_mountOAuthConsent(r,s):this.premountOAuthConsentNodes.set(r,s)},this.__internal_unmountOAuthConsent=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_unmountOAuthConsent(r):this.premountOAuthConsentNodes.delete(r)},this.mountTaskChooseOrganization=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskChooseOrganization(r,s):this.premountTaskChooseOrganizationNodes.set(r,s)},this.unmountTaskChooseOrganization=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskChooseOrganization(r):this.premountTaskChooseOrganizationNodes.delete(r)},this.mountTaskResetPassword=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskResetPassword(r,s):this.premountTaskResetPasswordNodes.set(r,s)},this.unmountTaskResetPassword=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskResetPassword(r):this.premountTaskResetPasswordNodes.delete(r)},this.mountTaskSetupMFA=(r,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskSetupMFA(r,s):this.premountTaskSetupMFANodes.set(r,s)},this.unmountTaskSetupMFA=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskSetupMFA(r):this.premountTaskSetupMFANodes.delete(r)},this.addListener=r=>{if(this.clerkjs)return this.clerkjs.addListener(r);{const s=()=>{var l;const c=this.premountAddListenerCalls.get(r);c&&((l=c.nativeUnsubscribe)==null||l.call(c),this.premountAddListenerCalls.delete(r))};return this.premountAddListenerCalls.set(r,{unsubscribe:s,nativeUnsubscribe:void 0}),s}},this.navigate=r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.navigate(r)};this.clerkjs&&this.loaded?s():this.premountMethodCalls.set("navigate",s)},this.redirectWithAuth=async(...r)=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.redirectWithAuth(...r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectWithAuth",s)},this.redirectToSignIn=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.redirectToSignIn(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectToSignIn",s)},this.redirectToSignUp=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.redirectToSignUp(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectToSignUp",s)},this.redirectToUserProfile=async()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToUserProfile()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToUserProfile",r)},this.redirectToAfterSignUp=()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToAfterSignUp()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToAfterSignUp",r)},this.redirectToAfterSignIn=()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToAfterSignIn()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("redirectToAfterSignIn",r)},this.redirectToAfterSignOut=()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToAfterSignOut()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("redirectToAfterSignOut",r)},this.redirectToOrganizationProfile=async()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToOrganizationProfile()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToOrganizationProfile",r)},this.redirectToCreateOrganization=async()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToCreateOrganization()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToCreateOrganization",r)},this.redirectToWaitlist=async()=>{const r=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToWaitlist()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToWaitlist",r)},this.redirectToTasks=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.redirectToTasks(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectToTasks",s)},this.handleRedirectCallback=async r=>{var s;const l=()=>{var c;return(c=this.clerkjs)==null?void 0:c.handleRedirectCallback(r)};this.clerkjs&&this.loaded?(s=l())==null||s.catch(()=>{}):this.premountMethodCalls.set("handleRedirectCallback",l)},this.handleGoogleOneTapCallback=async(r,s)=>{var l;const c=()=>{var h;
72return(h=this.clerkjs)==null?void 0:h.handleGoogleOneTapCallback(r,s)};this.clerkjs&&this.loaded?(l=c())==null||l.catch(()=>{}):this.premountMethodCalls.set("handleGoogleOneTapCallback",c)},this.handleEmailLinkVerification=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.handleEmailLinkVerification(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("handleEmailLinkVerification",s)},this.authenticateWithMetamask=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.authenticateWithMetamask(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithMetamask",s)},this.authenticateWithCoinbaseWallet=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.authenticateWithCoinbaseWallet(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithCoinbaseWallet",s)},this.authenticateWithBase=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.authenticateWithBase(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithBase",s)},this.authenticateWithOKXWallet=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.authenticateWithOKXWallet(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithOKXWallet",s)},this.authenticateWithSolana=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.authenticateWithSolana(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithSolana",s)},this.authenticateWithWeb3=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.authenticateWithWeb3(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithWeb3",s)},this.authenticateWithGoogleOneTap=async r=>(await Ww(this,am,I0).call(this)).authenticateWithGoogleOneTap(r),this.__internal_loadStripeJs=async()=>(await Ww(this,am,I0).call(this)).__internal_loadStripeJs(),this.createOrganization=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.createOrganization(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("createOrganization",s)},this.getOrganization=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.getOrganization(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("getOrganization",s)},this.joinWaitlist=async r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.joinWaitlist(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("joinWaitlist",s)},this.signOut=async(...r)=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.signOut(...r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("signOut",s)},this.__internal_attemptToEnableEnvironmentSetting=r=>{const s=()=>{var l;return(l=this.clerkjs)==null?void 0:l.__internal_attemptToEnableEnvironmentSetting(r)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("__internal_attemptToEnableEnvironmentSetting",s)};const{Clerk:n=null,publishableKey:i}=t||{};Bc(this,$l,i),Bc(this,Ud,t==null?void 0:t.proxyUrl),Bc(this,Ld,t==null?void 0:t.domain),this.options=t,this.Clerk=n,this.mode=xv()?"browser":"server",Bc(this,O0,new mY(this)),this.options.sdkMetadata||(this.options.sdkMetadata=pY),Pn(this,$a).emit(r0.Status,"loading"),Pn(this,$a).prioritizedOn(r0.Status,r=>Bc(this,R0,r)),Pn(this,$l)&&this.loadClerkJS()}get publishableKey(){return Pn(this,$l)}get loaded(){var t;return((t=this.clerkjs)==null?void 0:t.loaded)||!1}get status(){var t;return this.clerkjs?((t=this.clerkjs)==null?void 0:t.status)||(this.clerkjs.loaded?"ready":"loading"):Pn(this,R0)}static getOrCreateInstance(t){return(!xv()||!Pn(this,zl)||t.Clerk&&Pn(this,zl).Clerk!==t.Clerk||Pn(this,zl).publishableKey!==t.publishableKey)&&Bc(this,zl,new fL(t)),Pn(this,zl)}static clearInstance(){Bc(this,zl,null)}get domain(){return typeof window<"u"&&window.location?Fw(Pn(this,Ld),new URL(window.location.href),""):typeof Pn(this,Ld)=="function"?wa.throw(Bw):Pn(this,Ld)||""}get proxyUrl(){return typeof window<"u"&&window.location?Fw(Pn(this,Ud),new URL(window.location.href),""):typeof Pn(this,Ud)=="function"?wa.throw(Bw):Pn(this,Ud)||""}__internal_getOption(t){var n,i;return(n=this.clerkjs)!=null&&n.__internal_getOption?(i=this.clerkjs)==null?void 0:i.__internal_getOption(t):this.options[t]}get sdkMetadata(){var t;return((t=this.clerkjs)==null?void 0:t.sdkMetadata)||this.options.sdkMetadata||void 0}get instanceType(){var t;return(t=this.clerkjs)==null?void 0:t.instanceType}get frontendApi(){var t;return((t=this.clerkjs)==null?void 0:t.frontendApi)||""}get isStandardBrowser(){var t;return((t=this.clerkjs)==null?void 0:t.isStandardBrowser)||this.options.standardBrowser||!1}get __internal_queryClient(){var t;return(t=this.clerkjs)==null?void 0:t.__internal_queryClient}get isSatellite(){return typeof window<"u"&&window.location?Fw(this.options.isSatellite,new URL(window.location.href),!1):typeof this.options.isSatellite=="function"?wa.throw(Bw):!1}async loadClerkJS(){var t;if(!(this.mode!=="browser"||this.loaded)){typeof window<"u"&&(window.__clerk_publishable_key=Pn(this,$l),window.__clerk_proxy_url=this.proxyUrl,window.__clerk_domain=this.domain);try{if(this.Clerk){let n;jG(this.Clerk)?(n=new this.Clerk(Pn(this,$l),{proxyUrl:this.proxyUrl,domain:this.domain}),this.beforeLoad(n),await n.load(this.options)):(n=this.Clerk,n.loaded||(this.beforeLoad(n),await n.load(this.options))),global.Clerk=n}else if(!__BUILD_DISABLE_RHC__){if(global.Clerk||await iY({...this.options,publishableKey:Pn(this,$l),proxyUrl:this.proxyUrl,domain:this.domain,nonce:this.options.nonce}),!global.Clerk)throw new Error("Failed to download latest ClerkJS. Contact [email protected].");this.beforeLoad(global.Clerk),await global.Clerk.load(this.options)}return(t=global.Clerk)!=null&&t.loaded?this.hydrateClerkJS(global.Clerk):void 0}catch(n){const i=n;Pn(this,$a).emit(r0.Status,"error"),console.error(i.stack||i.message||i);return}}}get version(){var t;
72return(t=this.clerkjs)==null?void 0:t.version}get client(){if(this.clerkjs)return this.clerkjs.client}get session(){if(this.clerkjs)return this.clerkjs.session}get user(){if(this.clerkjs)return this.clerkjs.user}get organization(){if(this.clerkjs)return this.clerkjs.organization}get telemetry(){if(this.clerkjs)return this.clerkjs.telemetry}get __unstable__environment(){if(this.clerkjs)return this.clerkjs.__unstable__environment}get isSignedIn(){return this.clerkjs?this.clerkjs.isSignedIn:!1}get billing(){var t;return(t=this.clerkjs)==null?void 0:t.billing}get __internal_state(){return this.loaded&&this.clerkjs?this.clerkjs.__internal_state:Pn(this,O0)}get apiKeys(){var t;return(t=this.clerkjs)==null?void 0:t.apiKeys}__unstable__setEnvironment(...t){if(this.clerkjs&&"__unstable__setEnvironment"in this.clerkjs)this.clerkjs.__unstable__setEnvironment(t);else return}};R0=new WeakMap;Ld=new WeakMap;Ud=new WeakMap;$l=new WeakMap;$a=new WeakMap;O0=new WeakMap;zl=new WeakMap;am=new WeakSet;I0=function(){return new Promise(e=>{this.addOnLoaded(()=>e(this.clerkjs))})};Fl(hL,zl);var n5=hL;function gY(e){const{isomorphicClerkOptions:t,initialState:n,children:i}=e,{isomorphicClerk:r,clerkStatus:s}=vY(t),[l,c]=he.useState({client:r.client,session:r.session,user:r.user,organization:r.organization});he.useEffect(()=>r.addListener(F=>c({...F})),[]);const h=oY(r.loaded,l,n),d=he.useMemo(()=>({value:r}),[s]),f=he.useMemo(()=>({value:l.client}),[l.client]),{sessionId:p,sessionStatus:v,sessionClaims:x,session:b,userId:S,user:N,orgId:j,actor:T,organization:E,orgRole:C,orgSlug:P,orgPermissions:A,factorVerificationAge:M}=h,R=he.useMemo(()=>({value:{sessionId:p,sessionStatus:v,sessionClaims:x,userId:S,actor:T,orgId:j,orgRole:C,orgSlug:P,orgPermissions:A,factorVerificationAge:M}}),[p,v,S,T,j,C,P,M,x==null?void 0:x.__raw]),B=he.useMemo(()=>({value:b}),[p,b]),U=he.useMemo(()=>({value:N}),[S,N]),O=he.useMemo(()=>({value:{organization:E}}),[j,E]);return he.createElement(tG.Provider,{value:d},he.createElement(FK.Provider,{value:f},he.createElement($K.Provider,{value:B},he.createElement(WK,{...O.value},he.createElement(ZK.Provider,{value:R},he.createElement(BK.Provider,{value:U},he.createElement(zK,{value:void 0},i)))))))}var vY=e=>{const t=he.useRef(n5.getOrCreateInstance(e)),[n,i]=he.useState(t.current.status);return he.useEffect(()=>{t.current.__unstable__updateProps({appearance:e.appearance})},[e.appearance]),he.useEffect(()=>{t.current.__unstable__updateProps({options:e})},[e.localization]),he.useEffect(()=>(t.current.on("status",i),()=>{t.current&&t.current.off("status",i),n5.clearInstance()}),[]),{isomorphicClerk:t.current,clerkStatus:n}};function xY(e){const{initialState:t,children:n,__internal_bypassMissingPublishableKey:i,...r}=e,{publishableKey:s="",Clerk:l}=r;return!l&&!i&&(s?s&&!xk(s)&&wa.throwInvalidPublishableKeyError({key:s}):wa.throwMissingPublishableKeyError()),he.createElement(gY,{initialState:t,isomorphicClerkOptions:r},n)}var mL=TG(xY,"ClerkProvider",nG);mL.displayName="ClerkProvider";JK({packageName:"@clerk/clerk-react"});tY("@clerk/clerk-react");function pL(e,t){const n={get(i,r){if(typeof r=="string"){const s=[...t,r];return pL(e,s)}else if(r===T4){if(t.length<1){const s=[e,...t].join(".");throw new Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${s}\``)}return"_reference/childComponent/"+t.join("/")}else return}};return new Proxy({},n)}const yY=()=>pL("components",[]),me=MW;yY();var Jc=(e=>(e.SUPERADMIN="SUPERADMIN",e.ADMIN="ADMIN",e.USER="USER",e))(Jc||{});/**
73 * @license lucide-react v0.546.0 - ISC
74 *
75 * This source code is licensed under the ISC license.
76 * See the LICENSE file in the root directory of this source tree.
77 */const bY=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wY=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,i)=>i?i.toUpperCase():n.toLowerCase()),i5=e=>{const t=wY(e);return t.charAt(0).toUpperCase()+t.slice(1)},gL=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim(),SY=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
78 * @license lucide-react v0.546.0 - ISC
79 *
80 * This source code is licensed under the ISC license.
81 * See the LICENSE file in the root directory of this source tree.
82 */var kY={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
83 * @license lucide-react v0.546.0 - ISC
84 *
85 * This source code is licensed under the ISC license.
86 * See the LICENSE file in the root directory of this source tree.
87 */const NY=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:l,...c},h)=>w.createElement("svg",{ref:h,...kY,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:gL("lucide",r),...!s&&!SY(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,f])=>w.createElement(d,f)),...Array.isArray(s)?s:[s]]));/**
88 * @license lucide-react v0.546.0 - ISC
89 *
90 * This source code is licensed under the ISC license.
91 * See the LICENSE file in the root directory of this source tree.
92 */const Me=(e,t)=>{const n=w.forwardRef(({className:i,...r},s)=>w.createElement(NY,{ref:s,iconNode:t,className:gL(`lucide-${bY(i5(e))}`,`lucide-${e}`,i),...r}));return n.displayName=i5(e),n};/**
93 * @license lucide-react v0.546.0 - ISC
94 *
95 * This source code is licensed under the ISC license.
96 * See the LICENSE file in the root directory of this source tree.
97 */const jY=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
97-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Tk=Me("activity",jY);/**
98 * @license lucide-react v0.546.0 - ISC
99 *
100 * This source code is licensed under the ISC license.
101 * See the LICENSE file in the root directory of this source tree.
102 */const CY=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],TY=Me("arrow-down",CY);/**
103 * @license lucide-react v0.546.0 - ISC
104 *
105 * This source code is licensed under the ISC license.
106 * See the LICENSE file in the root directory of this source tree.
107 */const EY=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ty=Me("arrow-left",EY);/**
108 * @license lucide-react v0.546.0 - ISC
109 *
110 * This source code is licensed under the ISC license.
111 * See the LICENSE file in the root directory of this source tree.
112 */const AY=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],hs=Me("arrow-right",AY);/**
113 * @license lucide-react v0.546.0 - ISC
114 *
115 * This source code is licensed under the ISC license.
116 * See the LICENSE file in the root directory of this source tree.
117 */const PY=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_Y=Me("arrow-up",PY);/**
118 * @license lucide-react v0.546.0 - ISC
119 *
120 * This source code is licensed under the ISC license.
121 * See the LICENSE file in the root directory of this source tree.
122 */const MY=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],r5=Me("ban",MY);/**
123 * @license lucide-react v0.546.0 - ISC
124 *
125 * This source code is licensed under the ISC license.
126 * See the LICENSE file in the root directory of this source tree.
127 */const RY=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],yv=Me("book-open",RY);/**
128 * @license lucide-react v0.546.0 - ISC
129 *
130 * This source code is licensed under the ISC license.
131 * See the LICENSE file in the root directory of this source tree.
132 */const OY=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ny=Me("bot",OY);/**
133 * @license lucide-react v0.546.0 - ISC
134 *
135 * This source code is licensed under the ISC license.
136 * See the LICENSE file in the root directory of this source tree.
137 */const IY=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],iy=Me("building-2",IY);/**
138 * @license lucide-react v0.546.0 - ISC
139 *
140 * This source code is licensed under the ISC license.
141 * See the LICENSE file in the root directory of this source tree.
142 */const DY=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Ka=Me("calendar-days",DY);/**
143 * @license lucide-react v0.546.0 - ISC
144 *
145 * This source code is licensed under the ISC license.
146 * See the LICENSE file in the root directory of this source tree.
147 */const LY=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],aa=Me("calendar",LY);/**
148 * @license lucide-react v0.546.0 - ISC
149 *
150 * This source code is licensed under the ISC license.
151 * See the LICENSE file in the root directory of this source tree.
152 */const UY=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lm=Me("check",UY);/**
153 * @license lucide-react v0.546.0 - ISC
154 *
155 * This source code is licensed under the ISC license.
156 * See the LICENSE file in the root directory of this source tree.
157 */const BY=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ek=Me("chevron-down",BY);/**
158 * @license lucide-react v0.546.0 - ISC
159 *
160 * This source code is licensed under the ISC license.
161 * See the LICENSE file in the root directory of this source tree.
162 */const FY=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$Y=Me("chevron-left",FY);/**
163 * @license lucide-react v0.546.0 - ISC
164 *
165 * This source code is licensed under the ISC license.
166 * See the LICENSE file in the root directory of this source tree.
167 */const VY=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ry=Me("chevron-right",VY);/**
168 * @license lucide-react v0.546.0 - ISC
169 *
170 * This source code is licensed under the ISC license.
171 * See the LICENSE file in the root directory of this source tree.
172 */const zY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],xa=Me("circle-alert",zY);/**
173 * @license lucide-react v0.546.0 - ISC
174 *
175 * This source code is licensed under the ISC license.
176 * See the LICENSE file in the root directory of this source tree.
177 */const qY=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],WY=Me("circle-check-big",qY);/**
178 * @license lucide-react v0.546.0 - ISC
179 *
180 * This source code is licensed under the ISC license.
181 * See the LICENSE file in the root directory of this source tree.
182 */const HY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kt=Me("circle-check",HY);/**
183 * @license lucide-react v0.546.0 - ISC
184 *
185 * This source code is licensed under the ISC license.
186 * See the LICENSE file in the root directory of this source tree.
187 */const KY=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]],GY=Me("circle-off",KY);/**
188 * @license lucide-react v0.546.0 - ISC
189 *
190 * This source code is licensed under the ISC license.
191 * See the LICENSE file in the root directory of this source tree.
192 */const YY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],QY=Me("circle-question-mark",YY);/**
193 * @license lucide-react v0.546.0 - ISC
194 *
195 * This source code is licensed under the ISC license.
196 * See the LICENSE file in the root directory of this source tree.
197 */const XY=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],cc=Me("clock",XY);/**
198 * @license lucide-react v0.546.0 - ISC
199 *
200 * This source code is licensed under the ISC license.
201 * See the LICENSE file in the root directory of this source tree.
202 */const JY=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ZY=Me("code",JY);/**
203 * @license lucide-react v0.546.0 - ISC
204 *
205 * This source code is licensed under the ISC license.
206 * See the LICENSE file in the root directory of this source tree.
207 */const eQ=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",ke
207y:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],tQ=Me("compass",eQ);/**
208 * @license lucide-react v0.546.0 - ISC
209 *
210 * This source code is licensed under the ISC license.
211 * See the LICENSE file in the root directory of this source tree.
212 */const nQ=[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]],iQ=Me("contact",nQ);/**
213 * @license lucide-react v0.546.0 - ISC
214 *
215 * This source code is licensed under the ISC license.
216 * See the LICENSE file in the root directory of this source tree.
217 */const rQ=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],bv=Me("copy",rQ);/**
218 * @license lucide-react v0.546.0 - ISC
219 *
220 * This source code is licensed under the ISC license.
221 * See the LICENSE file in the root directory of this source tree.
222 */const sQ=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],aQ=Me("credit-card",sQ);/**
223 * @license lucide-react v0.546.0 - ISC
224 *
225 * This source code is licensed under the ISC license.
226 * See the LICENSE file in the root directory of this source tree.
227 */const oQ=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],lQ=Me("crown",oQ);/**
228 * @license lucide-react v0.546.0 - ISC
229 *
230 * This source code is licensed under the ISC license.
231 * See the LICENSE file in the root directory of this source tree.
232 */const cQ=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],D0=Me("database",cQ);/**
233 * @license lucide-react v0.546.0 - ISC
234 *
235 * This source code is licensed under the ISC license.
236 * See the LICENSE file in the root directory of this source tree.
237 */const uQ=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Qd=Me("dollar-sign",uQ);/**
238 * @license lucide-react v0.546.0 - ISC
239 *
240 * This source code is licensed under the ISC license.
241 * See the LICENSE file in the root directory of this source tree.
242 */const dQ=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],hQ=Me("download",dQ);/**
243 * @license lucide-react v0.546.0 - ISC
244 *
245 * This source code is licensed under the ISC license.
246 * See the LICENSE file in the root directory of this source tree.
247 */const fQ=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xm=Me("earth",fQ);/**
248 * @license lucide-react v0.546.0 - ISC
249 *
250 * This source code is licensed under the ISC license.
251 * See the LICENSE file in the root directory of this source tree.
252 */const mQ=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],pQ=Me("eraser",mQ);/**
253 * @license lucide-react v0.546.0 - ISC
254 *
255 * This source code is licensed under the ISC license.
256 * See the LICENSE file in the root directory of this source tree.
257 */const gQ=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],s5=Me("external-link",gQ);/**
258 * @license lucide-react v0.546.0 - ISC
259 *
260 * This source code is licensed under the ISC license.
261 * See the LICENSE file in the root directory of this source tree.
262 */const vQ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ya=Me("file-text",vQ);/**
263 * @license lucide-react v0.546.0 - ISC
264 *
265 * This source code is licensed under the ISC license.
266 * See the LICENSE file in the root directory of this source tree.
267 */const xQ=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],vL=Me("gauge",xQ);/**
268 * @license lucide-react v0.546.0 - ISC
269 *
270 * This source code is licensed under the ISC license.
271 * See the LICENSE file in the root directory of this source tree.
272 */const yQ=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],a5=Me("gift",yQ);/**
273 * @license lucide-react v0.546.0 - ISC
274 *
275 * This source code is licensed under the ISC license.
276 * See the LICENSE file in the root directory of this source tree.
277 */const bQ=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Ak=Me("git-branch",bQ);/**
278 * @license lucide-react v0.546.0 - ISC
279 *
280 * This source code is licensed under the ISC license.
281 * See the LICENSE file in the root directory of this source tree.
282 */const wQ=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],SQ=Me("git-merge",wQ);/**
283 * @license lucide-react v0.546.0 - ISC
284 *
285 * This source code is licensed under the ISC license.
286 * See the LICENSE file in the root directory of this source tree.
287 */const kQ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Yo=Me("globe",kQ);/**
288 * @license lucide-react v0.546.0 - ISC
289 *
290 * This source code is licensed under the ISC license.
291 * See the LICENSE file in the root directory of this source tree.
292 */const NQ=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],jQ=Me("handshake",NQ);/**
293 * @license lucide-react v0.546.0 - ISC
294 *
295 * This source code is licensed under the ISC license.
296 * See the LICENSE file in the root directory of this source tree.
297 */const CQ=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}
297]],TQ=Me("hard-drive",CQ);/**
298 * @license lucide-react v0.546.0 - ISC
299 *
300 * This source code is licensed under the ISC license.
301 * See the LICENSE file in the root directory of this source tree.
302 */const EQ=[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]],AQ=Me("headset",EQ);/**
303 * @license lucide-react v0.546.0 - ISC
304 *
305 * This source code is licensed under the ISC license.
306 * See the LICENSE file in the root directory of this source tree.
307 */const PQ=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],_Q=Me("history",PQ);/**
308 * @license lucide-react v0.546.0 - ISC
309 *
310 * This source code is licensed under the ISC license.
311 * See the LICENSE file in the root directory of this source tree.
312 */const MQ=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],zs=Me("inbox",MQ);/**
313 * @license lucide-react v0.546.0 - ISC
314 *
315 * This source code is licensed under the ISC license.
316 * See the LICENSE file in the root directory of this source tree.
317 */const RQ=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],o5=Me("key-round",RQ);/**
318 * @license lucide-react v0.546.0 - ISC
319 *
320 * This source code is licensed under the ISC license.
321 * See the LICENSE file in the root directory of this source tree.
322 */const OQ=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],xL=Me("layers",OQ);/**
323 * @license lucide-react v0.546.0 - ISC
324 *
325 * This source code is licensed under the ISC license.
326 * See the LICENSE file in the root directory of this source tree.
327 */const IQ=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],yL=Me("layout-grid",IQ);/**
328 * @license lucide-react v0.546.0 - ISC
329 *
330 * This source code is licensed under the ISC license.
331 * See the LICENSE file in the root directory of this source tree.
332 */const DQ=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],l5=Me("link-2",DQ);/**
333 * @license lucide-react v0.546.0 - ISC
334 *
335 * This source code is licensed under the ISC license.
336 * See the LICENSE file in the root directory of this source tree.
337 */const LQ=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],c5=Me("link",LQ);/**
338 * @license lucide-react v0.546.0 - ISC
339 *
340 * This source code is licensed under the ISC license.
341 * See the LICENSE file in the root directory of this source tree.
342 */const UQ=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],BQ=Me("list-checks",UQ);/**
343 * @license lucide-react v0.546.0 - ISC
344 *
345 * This source code is licensed under the ISC license.
346 * See the LICENSE file in the root directory of this source tree.
347 */const FQ=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Bi=Me("loader-circle",FQ);/**
348 * @license lucide-react v0.546.0 - ISC
349 *
350 * This source code is licensed under the ISC license.
351 * See the LICENSE file in the root directory of this source tree.
352 */const $Q=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],VQ=Me("lock",$Q);/**
353 * @license lucide-react v0.546.0 - ISC
354 *
355 * This source code is licensed under the ISC license.
356 * See the LICENSE file in the root directory of this source tree.
357 */const zQ=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],om=Me("log-out",zQ);/**
358 * @license lucide-react v0.546.0 - ISC
359 *
360 * This source code is licensed under the ISC license.
361 * See the LICENSE file in the root directory of this source tree.
362 */const qQ=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],Hw=Me("mail-check",qQ);/**
363 * @license lucide-react v0.546.0 - ISC
364 *
365 * This source code is licensed under the ISC license.
366 * See the LICENSE file in the root directory of this source tree.
367 */const WQ=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],uc=Me("mail",WQ);/**
368 * @license lucide-react v0.546.0 - ISC
369 *
370 * This source code is licensed under the ISC license.
371 * See the LICENSE file in the root directory of this source tree.
372 */const HQ=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],KQ=Me("map-pin",HQ);/**
373 * @license lucide-react v0.546.0 - ISC
374 *
375 * This source code is licensed under the ISC license.
376 * See the LICENSE file in the root directory of this source tree.
377 */const GQ=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],YQ=Me("menu",GQ);/**
378 * @license lucide-react v0.546.0 - ISC
379 *
380 * This source code is licensed under the ISC license.
381 * See the LICENSE file in the root directory of this source tree.
382 */const QQ=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Pk=Me("message-circle",QQ);/**
383 * @license lucide-react v0.546.0 - ISC
384 *
385 * This source code is licensed under the ISC license.
386 * See the LICENSE file in the root directory of this source tree.
387 */const XQ=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],JQ=Me("message-square-text",XQ);/**
388 * @license lucide-react v0.546.0 - ISC
389 *
390 * This source code is licensed under the ISC license.
391 * See the LICENSE file in the root directory of this source tree.
392 */const ZQ=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Na=Me("message-square",ZQ);/**
393 * @license lucide-react v0.546.0 - ISC
394 *
395 * This source code is licensed under the ISC license.
396 * See the LICENSE file in the root directory of this source tree.
397 */const eX=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],tX=Me("mic-off",eX);/**
398 * @license lucide-react v0.546.0 - ISC
399 *
400 * This source code is licensed under the ISC license.
401 * See the LICENSE file in the root directory of this source tree.
402 */const nX=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],Uo=Me("mic",nX);/**
403 * @license lucide-react v0.546.0 - ISC
404 *
405 * This source code is licensed under the ISC license.
406 * See the LICENSE file in the root directory of this source tree.
407 */const iX=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}
407]],rX=Me("network",iX);/**
408 * @license lucide-react v0.546.0 - ISC
409 *
410 * This source code is licensed under the ISC license.
411 * See the LICENSE file in the root directory of this source tree.
412 */const sX=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],u5=Me("package",sX);/**
413 * @license lucide-react v0.546.0 - ISC
414 *
415 * This source code is licensed under the ISC license.
416 * See the LICENSE file in the root directory of this source tree.
417 */const aX=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],oX=Me("palette",aX);/**
418 * @license lucide-react v0.546.0 - ISC
419 *
420 * This source code is licensed under the ISC license.
421 * See the LICENSE file in the root directory of this source tree.
422 */const lX=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],bL=Me("pause",lX);/**
423 * @license lucide-react v0.546.0 - ISC
424 *
425 * This source code is licensed under the ISC license.
426 * See the LICENSE file in the root directory of this source tree.
427 */const cX=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],su=Me("pen",cX);/**
428 * @license lucide-react v0.546.0 - ISC
429 *
430 * This source code is licensed under the ISC license.
431 * See the LICENSE file in the root directory of this source tree.
432 */const uX=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],_k=Me("pencil",uX);/**
433 * @license lucide-react v0.546.0 - ISC
434 *
435 * This source code is licensed under the ISC license.
436 * See the LICENSE file in the root directory of this source tree.
437 */const dX=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],wv=Me("phone-call",dX);/**
438 * @license lucide-react v0.546.0 - ISC
439 *
440 * This source code is licensed under the ISC license.
441 * See the LICENSE file in the root directory of this source tree.
442 */const hX=[["path",{d:"M16 2v6h6",key:"1mfrl5"}],["path",{d:"m22 2-6 6",key:"6f0sa0"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],wL=Me("phone-incoming",hX);/**
443 * @license lucide-react v0.546.0 - ISC
444 *
445 * This source code is licensed under the ISC license.
446 * See the LICENSE file in the root directory of this source tree.
447 */const fX=[["path",{d:"M14 6h8",key:"yd68k4"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],SL=Me("phone-forwarded",fX);/**
448 * @license lucide-react v0.546.0 - ISC
449 *
450 * This source code is licensed under the ISC license.
451 * See the LICENSE file in the root directory of this source tree.
452 */const mX=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 
4520 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],kL=Me("phone-off",mX);/**
453 * @license lucide-react v0.546.0 - ISC
454 *
455 * This source code is licensed under the ISC license.
456 * See the LICENSE file in the root directory of this source tree.
457 */const pX=[["path",{d:"m16 8 6-6",key:"oawc05"}],["path",{d:"M22 8V2h-6",key:"oqy2zc"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],NL=Me("phone-outgoing",pX);/**
458 * @license lucide-react v0.546.0 - ISC
459 *
460 * This source code is licensed under the ISC license.
461 * See the LICENSE file in the root directory of this source tree.
462 */const gX=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Ei=Me("phone",gX);/**
463 * @license lucide-react v0.546.0 - ISC
464 *
465 * This source code is licensed under the ISC license.
466 * See the LICENSE file in the root directory of this source tree.
467 */const vX=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Sv=Me("play",vX);/**
468 * @license lucide-react v0.546.0 - ISC
469 *
470 * This source code is licensed under the ISC license.
471 * See the LICENSE file in the root directory of this source tree.
472 */const xX=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],Sa=Me("plug",xX);/**
473 * @license lucide-react v0.546.0 - ISC
474 *
475 * This source code is licensed under the ISC license.
476 * See the LICENSE file in the root directory of this source tree.
477 */const yX=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],cr=Me("plus",yX);/**
478 * @license lucide-react v0.546.0 - ISC
479 *
480 * This source code is licensed under the ISC license.
481 * See the LICENSE file in the root directory of this source tree.
482 */const bX=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Xd=Me("power",bX);/**
483 * @license lucide-react v0.546.0 - ISC
484 *
485 * This source code is licensed under the ISC license.
486 * See the LICENSE file in the root directory of this source tree.
487 */const wX=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],SX=Me("refresh-cw",wX);/**
488 * @license lucide-react v0.546.0 - ISC
489 *
490 * This source code is licensed under the ISC license.
491 * See the LICENSE file in the root directory of this source tree.
492 */const kX=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],d5=Me("rocket",kX);/**
493 * @license lucide-react v0.546.0 - ISC
494 *
495 * This source code is licensed under the ISC license.
496 * See the LICENSE file in the root directory of this source tree.
497 */const NX=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],$i=Me("save",NX);/**
498 * @license lucide-react v0.546.0 - ISC
499 *
500 * This source code is licensed under the ISC license.
501 * See the LICENSE file in the root directory of this source tree.
502 */const jX=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Uj=Me("search",jX);/**
503 * @license lucide-react v0.546.0 - ISC
504 *
505 * This source code is licensed under the ISC license.
506 * See the LICENSE file in the root directory of this source tree.
507 */const CX=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],yp=Me("send",CX);/**
508 * @license lucide-react v0.546.0 - ISC
509 *
510 * This source code is licensed under the ISC license.
511 * See the LICENSE file in the root directory of this source tree.
512 */const TX=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],EX=Me("server",TX);/**
513 * @license lucide-react v0.546.0 - ISC
514 *
515 * This source code is licensed under the ISC license.
516 * See the LICENSE file in the root directory of this source tree.
517 */const AX=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],PX=Me("settings",AX);/**
518 * @license lucide-react v0.546.0 - ISC
519 *
520 * This source code is licensed under the ISC license.
521 * See the LICENSE file in the root directory of this source tree.
522 */const _X=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
522y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Jd=Me("shield-alert",_X);/**
523 * @license lucide-react v0.546.0 - ISC
524 *
525 * This source code is licensed under the ISC license.
526 * See the LICENSE file in the root directory of this source tree.
527 */const MX=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qa=Me("shield-check",MX);/**
528 * @license lucide-react v0.546.0 - ISC
529 *
530 * This source code is licensed under the ISC license.
531 * See the LICENSE file in the root directory of this source tree.
532 */const RX=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],h5=Me("shield",RX);/**
533 * @license lucide-react v0.546.0 - ISC
534 *
535 * This source code is licensed under the ISC license.
536 * See the LICENSE file in the root directory of this source tree.
537 */const OX=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],gu=Me("sliders-vertical",OX);/**
538 * @license lucide-react v0.546.0 - ISC
539 *
540 * This source code is licensed under the ISC license.
541 * See the LICENSE file in the root directory of this source tree.
542 */const IX=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}
542],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],xs=Me("sparkles",IX);/**
543 * @license lucide-react v0.546.0 - ISC
544 *
545 * This source code is licensed under the ISC license.
546 * See the LICENSE file in the root directory of this source tree.
547 */const DX=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Um=Me("star",DX);/**
548 * @license lucide-react v0.546.0 - ISC
549 *
550 * This source code is licensed under the ISC license.
551 * See the LICENSE file in the root directory of this source tree.
552 */const LX=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],jL=Me("tag",LX);/**
553 * @license lucide-react v0.546.0 - ISC
554 *
555 * This source code is licensed under the ISC license.
556 * See the LICENSE file in the root directory of this source tree.
557 */const UX=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],xi=Me("trash-2",UX);/**
558 * @license lucide-react v0.546.0 - ISC
559 *
560 * This source code is licensed under the ISC license.
561 * See the LICENSE file in the root directory of this source tree.
562 */const BX=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],FX=Me("trash",BX);/**
563 * @license lucide-react v0.546.0 - ISC
564 *
565 * This source code is licensed under the ISC license.
566 * See the LICENSE file in the root directory of this source tree.
567 */const $X=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Mk=Me("trending-up",$X);/**
568 * @license lucide-react v0.546.0 - ISC
569 *
570 * This source code is licensed under the ISC license.
571 * See the LICENSE file in the root directory of this source tree.
572 */const VX=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sy=Me("triangle-alert",VX);/**
573 * @license lucide-react v0.546.0 - ISC
574 *
575 * This source code is licensed under the ISC license.
576 * See the LICENSE file in the root directory of this source tree.
577 */const zX=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],CL=Me("unlink",zX);/**
578 * @license lucide-react v0.546.0 - ISC
579 *
580 * This source code is licensed under the ISC license.
581 * See the LICENSE file in the root directory of this source tree.
582 */const qX=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],qo=Me("user",qX);/**
583 * @license lucide-react v0.546.0 - ISC
584 *
585 * This source code is licensed under the ISC license.
586 * See the LICENSE file in the root directory of this source tree.
587 */const WX=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],HX=Me("users-round",WX);/**
588 * @license lucide-react v0.546.0 - ISC
589 *
590 * This source code is licensed under the ISC license.
591 * See the LICENSE file in the root directory of this source tree.
592 */const KX=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Wo=Me("users",KX);/**
593 * @license lucide-react v0.546.0 - ISC
594 *
595 * This source code is licensed under the ISC license.
596 * See the LICENSE file in the root directory of this source tree.
597 */const GX=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],f5=Me("volume-2",GX);/**
598 * @license lucide-react v0.546.0 - ISC
599 *
600 * This source code is licensed under the ISC license.
601 * See the LICENSE file in the root directory of this source tree.
vendor: 30,345 bytes, lines 602-617
602 */const YX=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Kw=Me("workflow",YX);/**
603 * @license lucide-react v0.546.0 - ISC
604 *
605 * This source code is licensed under the ISC license.
606 * See the LICENSE file in the root directory of this source tree.
607 */const QX=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],kv=Me("wrench",QX);/**
608 * @license lucide-react v0.546.0 - ISC
609 *
610 * This source code is licensed under the ISC license.
611 * See the LICENSE file in the root directory of this source tree.
612 */const XX=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fn=Me("x",XX);/**
613 * @license lucide-react v0.546.0 - ISC
614 *
615 * This source code is licensed under the ISC license.
616 * See the LICENSE file in the root directory of this source tree.
617 */const JX=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Uu=Me("zap",JX),Bj=w.createContext({});function Fj(e){const t=w.useRef(null);return t.current===null&&(t.current=e()),t.current}const ZX=typeof window<"u",$j=ZX?w.useLayoutEffect:w.useEffect,ay=w.createContext(null);function Vj(e,t){e.indexOf(t)===-1&&e.push(t)}function Nv(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const io=(e,t,n)=>n>t?t:n<e?e:n;let zj=()=>{};const dc={},TL=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),EL=e=>typeof e=="object"&&e!==null,AL=e=>/^0[^.\s]+$/u.test(e);function PL(e){let t;return()=>(t===void 0&&(t=e()),t)}const qs=e=>e,bp=(...e)=>e.reduce((t,n)=>i=>n(t(i))),Bm=(e,t,n)=>{const i=t-e;return i?(n-e)/i:1};class qj{constructor(){this.subscriptions=[]}add(t){return Vj(this.subscriptions,t),()=>Nv(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let s=0;s<r;s++){const l=this.subscriptions[s];l&&l(t,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ys=e=>e*1e3,Bs=e=>e/1e3,_L=(e,t)=>t?e*(1e3/t):0,ML=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,eJ=1e-7,tJ=12;function nJ(e,t,n,i,r){let s,l,c=0;do l=t+(n-t)/2,s=ML(l,i,r)-e,s>0?n=l:t=l;while(Math.abs(s)>eJ&&++c<tJ);return l}function wp(e,t,n,i){if(e===t&&n===i)return qs;const r=s=>nJ(s,0,1,e,n);return s=>s===0||s===1?s:ML(r(s),t,i)}const RL=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,OL=e=>t=>1-e(1-t),IL=wp(.33,1.53,.69,.99),Wj=OL(IL),DL=RL(Wj),LL=e=>e>=1?1:(e*=2)<1?.5*Wj(e):.5*(2-Math.pow(2,-10*(e-1))),Hj=e=>1-Math.sin(Math.acos(e)),UL=OL(Hj),BL=RL(Hj),iJ=wp(.42,0,1,1),rJ=wp(0,0,.58,1),FL=wp(.42,0,.58,1),sJ=e=>Array.isArray(e)&&typeof e[0]!="number",$L=e=>Array.isArray(e)&&typeof e[0]=="number",aJ={linear:qs,easeIn:iJ,easeInOut:FL,easeOut:rJ,circIn:Hj,circInOut:BL,circOut:UL,backIn:Wj,backInOut:DL,backOut:IL,anticipate:LL},oJ=e=>typeof e=="string",m5=e=>{if($L(e)){zj(e.length===4);const[t,n,i,r]=e;return wp(t,n,i,r)}else if(oJ(e))return aJ[e];return e},s0=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function lJ(e){let t=new Set,n=new Set,i=!1,r=!1;const s=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){s.has(d)&&(h.schedule(d),e()),d(l)}const h={schedule:(d,f=!1,p=!1)=>{const x=p&&i?t:n;return f&&s.add(d),x.add(d),d},cancel:d=>{n.delete(d),s.delete(d)},process:d=>{if(l=d,i){r=!0;return}i=!0;const f=t;t=n,n=f,t.forEach(c),t.clear(),i=!1,r&&(r=!1,h.process(d))}};return h}const cJ=40;function VL(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,l=s0.reduce((E,C)=>(E[C]=lJ(s),E),{}),{setup:c,read:h,resolveKeyframes:d,preUpdate:f,update:p,preRender:v,render:x,postRender:b}=l,S=()=>{const E=dc.useManualTiming,C=E?r.timestamp:performance.now();n=!1,E||(r.delta=i?1e3/60:Math.max(Math.min(C-r.timestamp,cJ),1)),r.timestamp=C,r.isProcessing=!0,c.process(r),h.process(r),d.process(r),f.process(r),p.process(r),v.process(r),x.process(r),b.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(S))},N=()=>{n=!0,i=!0,r.isProcessing||e(S)};return{schedule:s0.reduce((E,C)=>{const P=l[C];return E[C]=(A,M=!1,R=!1)=>(n||N(),P.schedule(A,M,R)),E},{}),cancel:E=>{for(let C=0;C<s0.length;C++)l[s0[C]].cancel(E)},state:r,steps:l}}const{schedule:bn,cancel:hc,state:nr,steps:Gw}=VL(typeof requestAnimationFrame<"u"?requestAnimationFrame:qs,!0);let L0;function uJ(){L0=void 0}const Ar={now:()=>(L0===void 0&&Ar.set(nr.isProcessing||dc.useManualTiming?nr.timestamp:performance.now()),L0),set:e=>{L0=e,queueMicrotask(uJ)}},zL=e=>t=>typeof t=="string"&&t.startsWith(e),qL=zL("--"),dJ=zL("var(--"),Kj=e=>dJ(e)?hJ.test(e.split("/*")[0].trim()):!1,hJ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function p5(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const _h={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Fm={..._h,transform:e=>io(0,1,e)},a0={..._h,default:1},ym=e=>Math.round(e*1e5)/1e5,Gj=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function fJ(e){return e==null}const mJ=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Yj=(e,t)=>n=>!!(typeof n=="string"&&mJ.test(n)&&n.startsWith(e)||t&&!fJ(n)&&Object.prototype.hasOwnProperty.call(n,t)),WL=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,s,l,c]=i.match(Gj);return{[e]:parseFloat(r),[t]:parseFloat(s),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},pJ=e=>io(0,255,e),Yw={..._h,transform:e=>Math.round(pJ(e))},au={test:Yj("rgb","red"),parse:WL("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+Yw.transform(e)+", "+Yw.transform(t)+", "+Yw.transform(n)+", "+ym(Fm.transform(i))+")"};function gJ(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Rk={test:Yj("#"),parse:gJ,transform:au.transform},Sp=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Mo=Sp("deg"),Za=Sp("%"),Qe=Sp("px"),vJ=Sp("vh"),xJ=Sp("vw"),g5={...Za,parse:e=>Za.parse(e)/100,transform:e=>Za.transform(e*100)},zd={test:Yj("hsl","hue"),parse:WL("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Za.transform(ym(t))+", "+Za.transform(ym(n))+", "+ym(Fm.transform(i))+")"},gi={test:e=>au.test(e)||Rk.test(e)||zd.test(e),parse:e=>au.test(e)?au.parse(e):zd.test(e)?zd.parse(e):Rk.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?au.transform(e):zd.transform(e),getAnimatableNone:e=>{const t=gi.parse(e);return t.alpha=0,gi.transform(t)}},yJ=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bJ(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Gj))==null?void 0:t.length)||0)+(((n=e.match(yJ))==null?void 0:n.length)||0)>0}const HL="number",KL="color",wJ="var",SJ="var(",v5="${}",kJ=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function hh(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const c=t.replace(kJ,h=>(gi.test(h)?(i.color.push(s),r.push(KL),n.push(gi.parse(h))):h.startsWith(SJ)?(i.var.push(s),r.push(wJ),n.push(h)):(i.number.push(s),r.push(HL),n.push(parseFloat(h))),++s,v5)).split(v5);return{values:n,split:c,indexes:i,types:r}}function NJ(e){return hh(e).values}function GL({split:e,types:t}){const n=e.length;return i=>{let r="";for(let s=0;s<n;s++)if(r+=e[s],i[s]!==void 0){const l=t[s];l===HL?r+=ym(i[s]):l===KL?r+=gi.transform(i[s]):r+=i[s]}return r}}function jJ(e){return GL(hh(e))}const CJ=e=>typeof e=="number"?0:gi.test(e)?gi.getAnimatableNone(e):e,TJ=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:CJ(e);function EJ(e){const t=hh(e);return GL(t)(t.values.map((i,r)=>TJ(i,t.split[r])))}const ka={test:bJ,parse:NJ,createTransformer:jJ,getAnimatableNone:EJ};function Qw(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function AJ({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,s=0,l=0;if(!t)r=s=l=n;else{const c=n<.5?n*(1+t):n+t-n*t,h=2*n-c;r=Qw(h,c,e+1/3),s=Qw(h,c,e),l=Qw(h,c,e-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(l*255),alpha:i}}function jv(e,t){return n=>n>0?t:e}const yn=(e,t,n)=>e+(t-e)*n,Xw=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},PJ=[Rk,au,zd],_J=e=>PJ.find(t=>t.test(e));function x5(e){const t=_J(e);if(!t)return!1;let n=t.parse(e);return t===zd&&(n=AJ(n)),n}const y5=(e,t)=>{const n=x5(e),i=x5(t);if(!n||!i)return jv(e,t);const r={...n};return s=>(r.red=Xw(n.red,i.red,s),r.green=Xw(n.green,i.green,s),r.blue=Xw(n.blue,i.blue,s),r.alpha=yn(n.alpha,i.alpha,s),au.transform(r))},Ok=new Set(["none","hidden"]);function MJ(e,t){return Ok.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function RJ(e,t){return n=>yn(e,t,n)}function Qj(e){return typeof e=="number"?RJ:typeof e=="string"?Kj(e)?jv:gi.test(e)?y5:DJ:Array.isArray(e)?YL:typeof e=="object"?gi.test(e)?y5:OJ:jv}function YL(e,t){const n=[...e],i=n.length,r=e.map((s,l)=>Qj(s)(s,t[l]));return s=>{for(let l=0;l<i;l++)n[l]=r[l](s);return n}}function OJ(e,t){const n={...e,...t},i={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(i[r]=Qj(e[r])(e[r],t[r]));return r=>{for(const s in i)n[s]=i[s](r);return n}}function IJ(e,t){const n=[],i={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const s=t.types[r],l=e.indexes[s][i[s]],c=e.values[l]??0;n[r]=c,i[s]++}return n}const DJ=(e,t)=>{const n=ka.createTransformer(t),i=hh(e),r=hh(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Ok.has(e)&&!r.values.length||Ok.has(t)&&!i.values.length?MJ(e,t):bp(YL(IJ(i,r),r.values),n):jv(e,t)};function QL(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?yn(e,t,n):Qj(e)(e,t)}const LJ=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>bn.update(t,n),stop:()=>hc(t),now:()=>nr.isProcessing?nr.timestamp:Ar.now()}},XL=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let s=0;s<r;s++)i+=Math.round(e(s/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Cv=2e4;function Xj(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t<Cv;)t+=n,i=e.next(t);return t>=Cv?1/0:t}function UJ(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(Xj(i),Cv);return{type:"keyframes",ease:s=>i.next(r*s).value/t,duration:Bs(r)}}const Qn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Ik(e,t){return e*Math.sqrt(1-t*t)}const BJ=12;function FJ(e,t,n){let i=n;for(let r=1;r<BJ;r++)i=i-e(i)/t(i);return i}const Jw=.001;function $J({duration:e=Qn.duration,bounce:t=Qn.bounce,velocity:n=Qn.velocity,mass:i=Qn.mass}){let r,s,l=1-t;l=io(Qn.minDamping,Qn.maxDamping,l),e=io(Qn.minDuration,Qn.maxDuration,Bs(e)),l<1?(r=d=>{const f=d*l,p=f*e,v=f-n,x=Ik(d,l),b=Math.exp(-p);return Jw-v/x*b},s=d=>{const p=d*l*e,v=p*n+n,x=Math.pow(l,2)*Math.pow(d,2)*e,b=Math.exp(-p),S=Ik(Math.pow(d,2),l);return(-r(d)+Jw>0?-1:1)*((v-x)*b)/S}):(r=d=>{const f=Math.exp(-d*e),p=(d-n)*e+1;return-Jw+f*p},s=d=>{const f=Math.exp(-d*e),p=(n-d)*(e*e);return f*p});const c=5/e,h=FJ(r,s,c);if(e=ys(e),isNaN(h))return{stiffness:Qn.stiffness,damping:Qn.damping,duration:e};{const d=Math.pow(h,2)*i;return{stiffness:d,damping:l*2*Math.sqrt(i*d),duration:e}}}const VJ=["duration","bounce"],zJ=["stiffness","damping","mass"];function b5(e,t){return t.some(n=>e[n]!==void 0)}function qJ(e){let t={velocity:Qn.velocity,stiffness:Qn.stiffness,damping:Qn.damping,mass:Qn.mass,isResolvedFromDuration:!1,...e};if(!b5(e,zJ)&&b5(e,VJ))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*io(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Qn.mass,stiffness:r,damping:s}}else{const n=$J({...e,velocity:0});t={...t,...n,mass:Qn.mass},t.isResolvedFromDuration=!0}return t}function Tv(e=Qn.visualDuration,t=Qn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],c={done:!1,value:s},{stiffness:h,damping:d,mass:f,duration:p,velocity:v,isResolvedFromDuration:x}=qJ({...n,velocity:-Bs(n.velocity||0)}),b=v||0,S=d/(2*Math.sqrt(h*f)),N=l-s,j=Bs(Math.sqrt(h/f)),T=Math.abs(N)<5;i||(i=T?Qn.restSpeed.granular:Qn.restSpeed.default),r||(r=T?Qn.restDelta.granular:Qn.restDelta.default);let E,C,P,A,M,R;if(S<1)P=Ik(j,S),A=(b+S*j*N)/P,E=U=>{const O=Math.exp(-S*j*U);return l-O*(A*Math.sin(P*U)+N*Math.cos(P*U))},M=S*j*A+N*P,R=S*j*N-A*P,C=U=>Math.exp(-S*j*U)*(M*Math.sin(P*U)+R*Math.cos(P*U));else if(S===1){E=O=>l-Math.exp(-j*O)*(N+(b+j*N)*O);const U=b+j*N;C=O=>Math.exp(-j*O)*(j*U*O-b)}else{const U=j*Math.sqrt(S*S-1);E=re=>{const Q=Math.exp(-S*j*re),W=Math.min(U*re,300);return l-Q*((b+S*j*N)*Math.sinh(W)+U*N*Math.cosh(W))/U};const O=(b+S*j*N)/U,F=S*j*O-N*U,ne=S*j*N-O*U;C=re=>{const Q=Math.exp(-S*j*re),W=Math.min(U*re,300);return Q*(F*Math.sinh(W)+ne*Math.cosh(W))}}const B={calculatedDuration:x&&p||null,velocity:U=>ys(C(U)),next:U=>{if(!x&&S<1){const F=Math.exp(-S*j*U),ne=Math.sin(P*U),re=Math.cos(P*U),Q=l-F*(A*ne+N*re),W=ys(F*(M*ne+R*re));return c.done=Math.abs(W)<=i&&Math.abs(l-Q)<=r,c.value=c.done?l:Q,c}const O=E(U);if(x)c.done=U>=p;else{const F=ys(C(U));c.done=Math.abs(F)<=i&&Math.abs(l-O)<=r}return c.value=c.done?l:O,c},toString:()=>{const U=Math.min(Xj(B),Cv),O=XL(F=>B.next(U*F).value,U,30);return U+"ms "+O},toTransition:()=>{}};return B}Tv.applyToOptions=e=>{const t=UJ(e,100,Tv);return e.ease=t.ease,e.duration=ys(t.duration),e.type="keyframes",e};const WJ=5;function JL(e,t,n){const i=Math.max(t-WJ,0);return _L(n-e(i),t-i)}function Dk({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:l,min:c,max:h,restDelta:d=.5,restSpeed:f}){const p=e[0],v={done:!1,value:p},x=R=>c!==void 0&&R<c||h!==void 0&&R>h,b=R=>c===void 0?h:h===void 0||Math.abs(c-R)<Math.abs(h-R)?c:h;let S=n*t;const N=p+S,j=l===void 0?N:l(N);j!==N&&(S=j-p);const T=R=>-S*Math.exp(-R/i),E=R=>j+T(R),C=R=>{const B=T(R),U=E(R);v.done=Math.abs(B)<=d,v.value=v.done?j:U};let P,A;const M=R=>{x(v.value)&&(P=R,A=Tv({keyframes:[v.value,b(v.value)],velocity:JL(E,R,v.value),damping:r,stiffness:s,restDelta:d,restSpeed:f}))};return M(0),{calculatedDuration:null,next:R=>{let B=!1;return!A&&P===void 0&&(B=!0,C(R),M(R)),P!==void 0&&R>=P?A.next(R-P):(!B&&C(R),v)}}}function HJ(e,t,n){const i=[],r=n||dc.mix||QL,s=e.length-1;for(let l=0;l<s;l++){let c=r(e[l],e[l+1]);if(t){const h=Array.isArray(t)?t[l]||qs:t;c=bp(h,c)}i.push(c)}return i}function KJ(e,t,{clamp:n=!0,ease:i,mixer:r}={}){const s=e.length;if(zj(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=HJ(t,i,r),h=c.length,d=f=>{if(l&&f<e[0])return t[0];let p=0;if(h>1)for(;p<e.length-2&&!(f<e[p+1]);p++);const v=Bm(e[p],e[p+1],f);return c[p](v)};return n?f=>d(io(e[0],e[s-1],f)):d}function GJ(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=Bm(0,t,i);e.push(yn(n,1,r))}}function YJ(e){const t=[0];return GJ(t,e.length-1),t}function QJ(e,t){return e.map(n=>n*t)}function XJ(e,t){return e.map(()=>t||FL).splice(0,e.length-1)}function bm({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=sJ(i)?i.map(m5):m5(i),s={done:!1,value:t[0]},l=QJ(n&&n.length===t.length?n:YJ(t),e),c=KJ(l,t,{ease:Array.isArray(r)?r:XJ(t,r)});return{calculatedDuration:e,next:h=>(s.value=c(h),s.done=h>=e,s)}}const JJ=e=>e!==null;function oy(e,{repeat:t,repeatType:n="loop"},i,r=1){const s=e.filter(JJ),c=r<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!c||i===void 0?s[c]:i}const ZJ={decay:Dk,inertia:Dk,tween:bm,keyframes:bm,spring:Tv};function ZL(e){typeof e.type=="string"&&(e.type=ZJ[e.type])}class Jj{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const eZ=e=>e/100;class Ev extends Jj{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var i,r;const{motionValue:n}=this.options;n&&n.updatedAt!==Ar.now()&&this.tick(Ar.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(i=this.options).onStop)==null||r.call(i))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;ZL(t);const{type:n=bm,repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:l=0}=t;let{keyframes:c}=t;const h=n||bm;h!==bm&&typeof c[0]!="number"&&(this.mixKeyframes=bp(eZ,QL(c[0],c[1])),c=[0,100]);const d=h({...t,keyframes:c});s==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...c].reverse(),velocity:-l})),d.calculatedDuration===null&&(d.calculatedDuration=Xj(d));const{calculatedDuration:f}=d;this.calculatedDuration=f,this.resolvedDuration=f+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:i,totalDuration:r,mixKeyframes:s,mirroredGenerator:l,resolvedDuration:c,calculatedDuration:h}=this;if(this.startTime===null)return i.next(0);const{delay:d=0,keyframes:f,repeat:p,repeatType:v,repeatDelay:x,type:b,onUpdate:S,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const j=this.currentTime-d*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?j<0:j>r;this.currentTime=Math.max(j,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let E=this.currentTime,C=i;if(p){const R=Math.min(this.currentTime,r)/c;let B=Math.floor(R),U=R%1;!U&&R>=1&&(U=1),U===1&&B--,B=Math.min(B,p+1),!!(B%2)&&(v==="reverse"?(U=1-U,x&&(U-=x/c)):v==="mirror"&&(C=l)),E=io(0,1,U)*c}let P;T?(this.delayState.value=f[0],P=this.delayState):P=C.next(E),s&&!T&&(P.value=s(P.value));let{done:A}=P;!T&&h!==null&&(A=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return M&&b!==Dk&&(P.value=oy(f,this.options,N,this.speed)),S&&S(P.value),M&&this.finish(),P}then(t,n){return this.finished.then(t,n)}get duration(){return Bs(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Bs(t)}get time(){return Bs(this.currentTime)}set time(t){t=ys(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return JL(i=>this.generator.next(i).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Ar.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Bs(this.currentTime))}play(){var r,s;if(this.isStopped)return;const{driver:t=LJ,startTime:n}=this.options;this.driver||(this.driver=t(l=>this.tick(l))),(s=(r=this.options).onPlay)==null||s.call(r);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ar.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function tZ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ou=e=>e*180/Math.PI,Lk=e=>{const t=ou(Math.atan2(e[1],e[0]));return Uk(t)},nZ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Lk,rotateZ:Lk,skewX:e=>ou(Math.atan(e[1])),skewY:e=>ou(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Uk=e=>(e=e%360,e<0&&(e+=360),e),w5=Lk,S5=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),k5=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),iZ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:S5,scaleY:k5,scale:e=>(S5(e)+k5(e))/2,rotateX:e=>Uk(ou(Math.atan2(e[6],e[5]))),rotateY:e=>Uk(ou(Math.atan2(-e[2],e[0]))),rotateZ:w5,rotate:w5,skewX:e=>ou(Math.atan(e[4])),skewY:e=>ou(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Bk(e){return e.includes("scale")?1:0}function Fk(e,t){if(!e||e==="none")return Bk(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(n)i=iZ,r=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=nZ,r=c}if(!r)return Bk(t);const s=i[t],l=r[1].split(",").map(sZ);return typeof s=="function"?s(l):l[s]}const rZ=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Fk(n,t)};function sZ(e){return parseFloat(e.trim())}const Mh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Rh=new Set([...Mh,"pathRotation"]),N5=e=>e===_h||e===Qe,aZ=new Set(["x","y","z"]),oZ=Mh.filter(e=>!aZ.has(e));function lZ(e){const t=[];return oZ.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const Zl={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:i})=>{const r=e.max-e.min;return i==="border-box"?r:r-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:i})=>{const r=e.max-e.min;return i==="border-box"?r:r-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Fk(t,"x"),y:(e,{transform:t})=>Fk(t,"y")};Zl.translateX=Zl.x;Zl.translateY=Zl.y;const vu=new Set;let $k=!1,Vk=!1,zk=!1;function e6(){if(Vk){const e=Array.from(vu).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=lZ(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,l])=>{var c;(c=i.getValue(s))==null||c.set(l)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Vk=!1,$k=!1,vu.forEach(e=>e.complete(zk)),vu.clear()}function t6(){vu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Vk=!0)})}function cZ(){zk=!0,t6(),e6(),zk=!1}class Zj{constructor(t,n,i,r,s,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(vu.add(this),$k||($k=!0,bn.read(t6),bn.resolveKeyframes(e6))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;if(t[0]===null){const s=r==null?void 0:r.get(),l=t[t.length-1];if(s!==void 0)t[0]=s;else if(i&&n){const c=i.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),r&&s===void 0&&r.set(t[0])}tZ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),vu.delete(this)}cancel(){this.state==="scheduled"&&(vu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const uZ=e=>e.startsWith("--");function n6(e,t,n){uZ(t)?e.style.setProperty(t,n):e.style[t]=n}const dZ={};function i6(e,t){const n=PL(e);return()=>dZ[t]??n()}const hZ=i6(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),r6=i6(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),lm=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,j5={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:lm([0,.65,.55,1]),circOut:lm([.55,0,1,.45]),backIn:lm([.31,.01,.66,-.59]),backOut:lm([.33,1.53,.69,.99])};function s6(e,t){if(e)return typeof e=="function"?r6()?XL(e,t):"ease-out":$L(e)?lm(e):Array.isArray(e)?e.map(n=>s6(n,t)||j5.easeOut):j5[e]}function fZ(e,t,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:l="loop",ease:c="easeOut",times:h}={},d=void 0){const f={[t]:n};h&&(f.offset=h);const p=s6(c,r);Array.isArray(p)&&(f.easing=p);const v={delay:i,duration:r,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:s+1,direction:l==="reverse"?"alternate":"normal"};return d&&(v.pseudoElement=d),e.animate(f,v)}function a6(e){return typeof e=="function"&&"applyToOptions"in e}function mZ({type:e,...t}){return a6(e)&&r6()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class o6 extends Jj{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:i,keyframes:r,pseudoElement:s,allowFlatten:l=!1,finalKeyframe:c,onComplete:h}=t;this.isPseudoElement=!!s,this.allowFlatten=l,this.options=t,zj(typeof t.type!="string");const d=mZ(t);this.animation=fZ(n,i,r,d,s),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const f=oy(r,this.options,c,this.speed);this.updateMotionValue&&this.updateMotionValue(f),n6(n,i,f),this.animation.cancel()}h==null||h(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,i,r;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((r=(i=this.animation).commitStyles)==null||r.call(i))}get duration(){var n,i;const t=((i=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:i.call(n).duration)||0;return Bs(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Bs(t)}get time(){return Bs(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ys(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:i,observe:r}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&hZ()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),i&&(this.animation.rangeEnd=i),qs):r(this)}}const l6={anticipate:LL,backInOut:DL,circInOut:BL};function pZ(e){return e in l6}function gZ(e){typeof e.ease=="string"&&pZ(e.ease)&&(e.ease=l6[e.ease])}const Zw=10;class vZ extends o6{constructor(t){gZ(t),ZL(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:i,onComplete:r,element:s,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const c=new Ev({...l,autoplay:!1}),h=Math.max(Zw,Ar.now()-this.startTime),d=io(0,Zw,h-Zw),f=c.sample(h).value,{name:p}=this.options;s&&p&&n6(s,p,f),n.setWithVelocity(c.sample(Math.max(0,h-d)).value,f,d),c.stop()}}const C5=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ka.test(e)||e==="0")&&!e.startsWith("url("));function xZ(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function yZ(e,t,n,i){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],l=C5(r,t),c=C5(s,t);return!l||!c?!1:xZ(e)||(n==="spring"||a6(n))&&i}function qk(e){e.duration=0,e.type="keyframes"}const c6=new Set(["opacity","clipPath","filter","transform"]),bZ=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function wZ(e){for(let t=0;t<e.length;
617t++)if(typeof e[t]=="string"&&bZ.test(e[t]))return!0;return!1}const SZ=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),kZ=PL(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function NZ(e){var p;const{motionValue:t,name:n,repeatDelay:i,repeatType:r,damping:s,type:l,keyframes:c}=e;if(!(((p=t==null?void 0:t.owner)==null?void 0:p.current)instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:f}=t.owner.getProps();return kZ()&&n&&(c6.has(n)||SZ.has(n)&&wZ(c))&&(n!=="transform"||!f)&&!d&&!i&&r!=="mirror"&&s!==0&&l!=="inertia"}const jZ=40;class CZ extends Jj{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:l="loop",keyframes:c,name:h,motionValue:d,element:f,...p}){var b;super(),this.stop=()=>{var S,N;this._animation&&(this._animation.stop(),(S=this.stopTimeline)==null||S.call(this)),(N=this.keyframeResolver)==null||N.cancel()},this.createdAt=Ar.now();const v={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:l,name:h,motionValue:d,element:f,...p},x=(f==null?void 0:f.KeyframeResolver)||Zj;this.keyframeResolver=new x(c,(S,N,j)=>this.onKeyframesResolved(S,N,v,!j),h,d,f),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(t,n,i,r){var j,T;this.keyframeResolver=void 0;const{name:s,type:l,velocity:c,delay:h,isHandoff:d,onUpdate:f}=i;this.resolvedAt=Ar.now();let p=!0;yZ(t,s,l,c)||(p=!1,(dc.instantAnimations||!h)&&(f==null||f(oy(t,i,n))),t[0]=t[t.length-1],qk(i),i.repeat=0);const x={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>jZ?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:t},b=p&&!d&&NZ(x),S=(T=(j=x.motionValue)==null?void 0:j.owner)==null?void 0:T.current;let N;if(b)try{N=new vZ({...x,element:S})}catch{N=new Ev(x)}else N=new Ev(x);N.finished.then(()=>{this.notifyFinished()}).catch(qs),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),cZ()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function u6(e,t,n,i=0,r=1){const s=Array.from(e).sort((d,f)=>d.sortNodePosition(f)).indexOf(t),l=e.size,c=(l-1)*i;return typeof n=="function"?n(s,l):r===1?s*i:c-s*i}const T5=30,TZ=e=>!isNaN(parseFloat(e));class EZ{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var s;const r=Ar.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Ar.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=TZ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new qj);const i=this.events[t].add(n);return t==="change"?()=>{i(),bn.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ar.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>T5)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,T5);return _L(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function fh(e,t){return new EZ(e,t)}function d6(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...i}=e;return{...t,...i}}return e}function eC(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?d6(n,e):n}const AZ={type:"spring",stiffness:500,damping:25,restSpeed:10},PZ=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_Z={type:"keyframes",duration:.8},MZ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},RZ=(e,{keyframes:t})=>t.length>2?_Z:Rh.has(e)?e.startsWith("scale")?PZ(t[1]):AZ:MZ,OZ=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function IZ(e){for(const t in e)if(!OZ.has(t))return!0;return!1}const tC=(e,t,n,i={},r,s)=>l=>{const c=eC(i,e)||{},h=c.delay||i.delay||0;let{elapsed:d=0}=i;d=d-ys(h);const f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-d,onUpdate:v=>{t.set(v),c.onUpdate&&c.onUpdate(v)},onComplete:()=>{l(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:s?void 0:r};IZ(c)||Object.assign(f,RZ(e,f)),f.duration&&(f.duration=ys(f.duration)),f.repeatDelay&&(f.repeatDelay=ys(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let p=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(qk(f),f.delay===0&&(p=!0)),(dc.instantAnimations||dc.skipAnimations||r!=null&&r.shouldSkipAnimations||c.skipAnimations)&&(p=!0,qk(f),f.delay=0),f.allowFlatten=!c.type&&!c.ease,p&&!s&&t.get()!==void 0){const v=oy(f.keyframes,c);if(v!==void 0){bn.update(()=>{f.onUpdate(v),f.onComplete()});return}}return c.isSync?new Ev(f):new CZ(f)},DZ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LZ(e){const t=DZ.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}function h6(e,t,n=1){const[i,r]=LZ(e);if(!i)return;const s=window.getComputedStyle(t).getPropertyValue(i);if(s){const l=s.trim();return TL(l)?parseFloat(l):l}return Kj(r)?h6(r,t,n+1):r}function E5(e){const t=[{},{}];
vendor: 5,633 bytes, line 617
617return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function nC(e,t,n,i){if(typeof t=="function"){const[r,s]=E5(i);t=t(n!==void 0?n:e.custom,r,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,s]=E5(i);t=t(n!==void 0?n:e.custom,r,s)}return t}function xu(e,t,n){const i=e.getProps();return nC(i,t,n!==void 0?n:i.custom,e)}const f6=new Set(["width","height","top","left","right","bottom",...Mh]),Wk=e=>Array.isArray(e);function UZ(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,fh(n))}function BZ(e){return Wk(e)?e[e.length-1]||0:e}function FZ(e,t){const n=xu(e,t);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const l in s){const c=BZ(s[l]);UZ(e,l,c)}}const or=e=>!!(e&&e.getVelocity);function $Z(e){return!!(or(e)&&e.add)}function Hk(e,t){const n=e.getValue("willChange");if($Z(n))return n.add(t);if(!n&&dc.WillChange){const i=new dc.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function iC(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const VZ="framerAppearId",m6="data-"+iC(VZ);function p6(e){return e.props[m6]}function zZ({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function g6(e,t,{delay:n=0,transitionOverride:i,type:r}={}){let{transition:s,transitionEnd:l,...c}=t;const h=e.getDefaultTransition();s=s?d6(s,h):h;const d=s==null?void 0:s.reduceMotion,f=s==null?void 0:s.skipAnimations;i&&(s=i);const p=[],v=r&&e.animationState&&e.animationState.getState()[r],x=s==null?void 0:s.path;x&&x.animateVisualElement(e,c,s,n,p);for(const b in c){const S=e.getValue(b,e.latestValues[b]??null),N=c[b];if(N===void 0||v&&zZ(v,b))continue;const j={delay:n,...eC(s||{},b)};f&&(j.skipAnimations=!0);const T=S.get();if(T!==void 0&&!S.isAnimating()&&!Array.isArray(N)&&N===T&&!j.velocity){bn.update(()=>S.set(N));continue}let E=!1;if(window.MotionHandoffAnimation){const A=p6(e);if(A){const M=window.MotionHandoffAnimation(A,b,bn);M!==null&&(j.startTime=M,E=!0)}}Hk(e,b);const C=d??e.shouldReduceMotion;S.start(tC(b,S,N,C&&f6.has(b)?{type:!1}:j,e,E));const P=S.animation;P&&p.push(P)}if(l){const b=()=>bn.update(()=>{l&&FZ(e,l)});p.length?Promise.all(p).then(b):b()}return p}function Kk(e,t,n={}){var h;const i=xu(e,t,n.type==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const s=i?()=>Promise.all(g6(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:f=0,staggerChildren:p,staggerDirection:v}=r;return qZ(e,t,d,f,p,v,n)}:()=>Promise.resolve(),{when:c}=r;if(c){const[d,f]=c==="beforeChildren"?[s,l]:[l,s];return d().then(()=>f())}else return Promise.all([s(),l(n.delay)])}function qZ(e,t,n=0,i=0,r=0,s=1,l){const c=[];for(const h of e.variantChildren)h.notify("AnimationStart",t),c.push(Kk(h,t,{...l,delay:n+(typeof i=="function"?0:i)+u6(e.variantChildren,h,i,r,s)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(c)}function WZ(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(s=>Kk(e,s,n));i=Promise.all(r)}else if(typeof t=="string")i=Kk(e,t,n);else{const r=typeof t=="function"?xu(e,t,n.custom):t;i=Promise.all(g6(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const HZ={test:e=>e==="auto",parse:e=>e},v6=e=>t=>t.test(e),x6=[_h,Qe,Za,Mo,xJ,vJ,HZ],A5=e=>x6.find(v6(e));function KZ(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||AL(e):!0}const GZ=new Set(["brightness","contrast","saturate","opacity"]);function YZ(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(Gj)||[];if(!i)return e;const r=n.replace(i,"");let s=GZ.has(t)?1:0;return i!==n&&(s*=100),t+"("+s+r+")"}const QZ=/\b([a-z-]*)\(.*?\)/gu,Gk={...ka,getAnimatableNone:e=>{const t=e.match(QZ);return t?t.map(YZ).join(" "):e}},Yk={...ka,getAnimatableNone:e=>{const t=ka.parse(e);return ka.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},P5={..._h,transform:Math.round},XZ={rotate:Mo,pathRotation:Mo,rotateX:Mo,rotateY:Mo,rotateZ:Mo,scale:a0,scaleX:a0,scaleY:a0,scaleZ:a0,skew:Mo,skewX:Mo,skewY:Mo,distance:Qe,translateX:Qe,translateY:Qe,translateZ:Qe,x:Qe,y:Qe,z:Qe,perspective:Qe,transformPerspective:Qe,opacity:Fm,originX:g5,originY:g5,originZ:Qe},Av={borderWidth:Qe,borderTopWidth:Qe,borderRightWidth:Qe,borderBottomWidth:Qe,borderLeftWidth:Qe,borderRadius:Qe,borderTopLeftRadius:Qe,borderTopRightRadius:Qe,borderBottomRightRadius:Qe,borderBottomLeftRadius:Qe,width:Qe,maxWidth:Qe,height:Qe,maxHeight:Qe,top:Qe,right:Qe,bottom:Qe,left:Qe,inset:Qe,insetBlock:Qe,insetBlockStart:Qe,insetBlockEnd:Qe,insetInline:Qe,insetInlineStart:Qe,insetInlineEnd:Qe,padding:Qe,paddingTop:Qe,paddingRight:Qe,paddingBottom:Qe,paddingLeft:Qe,paddingBlock:Qe,paddingBlockStart:Qe,paddingBlockEnd:Qe,paddingInline:Qe,paddingInlineStart:Qe,paddingInlineEnd:Qe,margin:Qe,marginTop:Qe,marginRight:Qe,marginBottom:Qe,marginLeft:Qe,marginBlock:Qe,marginBlockStart:Qe,marginBlockEnd:Qe,marginInline:Qe,marginInlineStart:Qe,marginInlineEnd:Qe,fontSize:Qe,backgroundPositionX:Qe,backgroundPositionY:Qe,...XZ,zIndex:P5,fillOpacity:Fm,strokeOpacity:Fm,numOctaves:P5},JZ={...Av,color:gi,backgroundColor:gi,outlineColor:gi,fill:gi,stroke:gi,borderColor:gi,borderTopColor:gi,borderRightColor:gi,borderBottomColor:gi,borderLeftColor:gi,filter:Gk,WebkitFilter:Gk,mask:Yk,WebkitMask:Yk},y6=e=>JZ[e],ZZ=new Set([Gk,Yk]);function b6(e,t){let n=y6(e);return ZZ.has(n)||(n=ka),n.getAnimatableNone?n.getAnimatableNone(t):void 0}
vendor: 1,722 bytes, line 617
617const eee=new Set(["auto","none","0"]);function tee(e,t,n){let i=0,r;for(;i<e.length&&!r;){const s=e[i];typeof s=="string"&&!eee.has(s)&&hh(s).values.length&&(r=e[i]),i++}if(r&&n)for(const s of t)e[s]=b6(n,r)}class nee extends Zj{constructor(t,n,i,r,s){super(t,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let f=0;f<t.length;f++){let p=t[f];if(typeof p=="string"&&(p=p.trim(),Kj(p))){const v=h6(p,n.current);v!==void 0&&(t[f]=v),f===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!f6.has(i)||t.length!==2)return;const[r,s]=t,l=A5(r),c=A5(s),h=p5(r),d=p5(s);if(h!==d&&Zl[i]){this.needsMeasurement=!0;return}if(l!==c)if(N5(l)&&N5(c))for(let f=0;f<t.length;f++){const p=t[f];typeof p=="string"&&(t[f]=parseFloat(p))}else Zl[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,i=[];for(let r=0;r<t.length;r++)(t[r]===null||KZ(t[r]))&&i.push(r);i.length&&tee(t,i,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Zl[i](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(i,r).jump(r,!1)}measureEndState(){var c;const{element:t,name:n,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const s=i.length-1,l=i[s];i[s]=Zl[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),(c=this.removedTransforms)!=null&&c.length&&this.removedTransforms.forEac
vendor: 41,167 bytes, line 617
617h(([h,d])=>{t.getValue(h).set(d)}),this.resolveNoneKeyframes()}}function w6(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const r=(n==null?void 0:n[e])??i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(i=>i!=null)}const Qk=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function U0(e){return EL(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:rC}=VL(queueMicrotask,!1),ia={x:!1,y:!1};function S6(){return ia.x||ia.y}function iee(e){return e==="x"||e==="y"?ia[e]?null:(ia[e]=!0,()=>{ia[e]=!1}):ia.x||ia.y?null:(ia.x=ia.y=!0,()=>{ia.x=ia.y=!1})}function k6(e,t){const n=w6(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function ree(e){return!(e.pointerType==="touch"||S6())}function see(e,t,n={}){const[i,r,s]=k6(e,n);return i.forEach(l=>{let c=!1,h=!1,d;const f=()=>{l.removeEventListener("pointerleave",b)},p=N=>{d&&(d(N),d=void 0),f()},v=N=>{c=!1,window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),h&&(h=!1,p(N))},x=()=>{c=!0,window.addEventListener("pointerup",v,r),window.addEventListener("pointercancel",v,r)},b=N=>{if(N.pointerType!=="touch"){if(c){h=!0;return}p(N)}},S=N=>{if(!ree(N))return;h=!1;const j=t(l,N);typeof j=="function"&&(d=j,l.addEventListener("pointerleave",b,r))};l.addEventListener("pointerenter",S,r),l.addEventListener("pointerdown",x,r)}),s}const N6=(e,t)=>t?e===t?!0:N6(e,t.parentElement):!1,sC=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,aee=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function oee(e){return aee.has(e.tagName)||e.isContentEditable===!0}const lee=new Set(["INPUT","SELECT","TEXTAREA"]);function cee(e){return lee.has(e.tagName)||e.isContentEditable===!0}const B0=new WeakSet;function _5(e){return t=>{t.key==="Enter"&&e(t)}}function eS(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const uee=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=_5(()=>{if(B0.has(n))return;eS(n,"down");const r=_5(()=>{eS(n,"up")}),s=()=>eS(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function M5(e){return sC(e)&&!S6()}const R5=new WeakSet;function dee(e,t,n={}){const[i,r,s]=k6(e,n),l=c=>{const h=c.currentTarget;if(!M5(c)||R5.has(c))return;B0.add(h),n.stopPropagation&&R5.add(c);const d=t(h,c),f={...r,capture:!0},p=(b,S)=>{window.removeEventListener("pointerup",v,f),window.removeEventListener("pointercancel",x,f),B0.has(h)&&B0.delete(h),M5(b)&&typeof d=="function"&&d(b,{success:S})},v=b=>{p(b,h===window||h===document||n.useGlobalTarget||N6(h,b.target))},x=b=>{p(b,!1)};window.addEventListener("pointerup",v,f),window.addEventListener("pointercancel",x,f)};return i.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",l,r),U0(c)&&(c.addEventListener("focus",d=>uee(d,r)),!oee(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),s}function aC(e){return EL(e)&&"ownerSVGElement"in e}const F0=new WeakMap;let Vl;const j6=(e,t,n)=>(i,r)=>r&&r[0]?r[0][e+"Size"]:aC(i)&&"getBBox"in i?i.getBBox()[t]:i[n],hee=j6("inline","width","offsetWidth"),fee=j6("block","height","offsetHeight");function mee({target:e,borderBoxSize:t}){var n;(n=F0.get(e))==null||n.forEach(i=>{i(e,{get width(){return hee(e,t)},get height(){return fee(e,t)}})})}function pee(e){e.forEach(mee)}function gee(){typeof ResizeObserver>"u"||(Vl=new ResizeObserver(pee))}function vee(e,t){Vl||gee();const n=w6(e);return n.forEach(i=>{let r=F0.get(i);r||(r=new Set,F0.set(i,r)),r.add(t),Vl==null||Vl.observe(i)}),()=>{n.forEach(i=>{const r=F0.get(i);r==null||r.delete(t),r!=null&&r.size||Vl==null||Vl.unobserve(i)})}}const $0=new Set;let qd;function xee(){qd=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};$0.forEach(t=>t(e))},window.addEventListener("resize",qd)}function yee(e){return $0.add(e),qd||xee(),()=>{$0.delete(e),!$0.size&&typeof qd=="function"&&(window.removeEventListener("resize",qd),qd=void 0)}}function O5(e,t){return typeof e=="function"?yee(e):vee(e,t)}function bee(e){return aC(e)&&e.tagName==="svg"}const wee=[...x6,gi,ka],See=e=>wee.find(v6(e)),I5=()=>({translate:0,scale:1,origin:0,originPoint:0}),Wd=()=>({x:I5(),y:I5()}),D5=()=>({min:0,max:0}),Ci=()=>({x:D5(),y:D5()}),kee=new WeakMap;function ly(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function $m(e){return typeof e=="string"||Array.isArray(e)}const oC=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lC=["initial",...oC];function cy(e){return ly(e.animate)||lC.some(t=>$m(e[t]))}function C6(e){return!!(cy(e)||e.variants)}function Nee(e,t,n){for(const i in t){const r=t[i],s=n[i];if(or(r))e.addValue(i,r);else if(or(s))e.addValue(i,fh(r,{owner:e}));else if(s!==r)if(e.hasValue(i)){const l=e.getValue(i);l.liveStyle===!0?l.jump(r):l.hasAnimated||l.set(r)}else{const l=e.getStaticValue(i);e.addValue(i,fh(l!==void 0?l:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const Xk={current:null},T6={current:!1},jee=typeof window<"u";function Cee(){if(T6.current=!0,!!jee)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Xk.current=e.matches;e.addEventListener("change",t),t()}else Xk.current=!1}const L5=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Pv={};function E6(e){Pv=e}function Tee(){return Pv}class Eee{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,skipAnimations:s,blockInitialAnimation:l,visualState:c},h={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Zj,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=Ar.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,bn.render(this.render,!1,!0))};const{latestValues:d,renderState:f}=c;this.latestValues=d,this.baseTarget={...d},this.initialValues=n.initial?{...d}:{},this.renderState=f,this.parent=t,this.props=n,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=s,this.options=h,this.blockInitialAnimation=!!l,this.isControllingVariants=cy(n),this.isVariantNode=C6(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...v}=this.scrapeMotionValuesFromProps(n,{},this);for(const x in v){const b=v[x];d[x]!==void 0&&or(b)&&b.set(d[x])}}mount(t){var n,i;if(this.hasBeenMounted)for(const r in this.initialValues)(n=this.values.get(r))==null||n.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=t,kee.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,s)=>this.bindToMotionValue(s,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(T6.current||Cee(),this.shouldReduceMotion=Xk.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),hc(this.notifyUpdate),hc(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const i=this.features[n];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&c6.has(t)&&this.current instanceof HTMLElement){const{factory:l,keyframes:c,times:h,ease:d,duration:f}=n.accelerate,p=new o6({element:this.current,name:t,keyframes:c,times:h,ease:d,duration:ys(f)}),v=l(p);this.valueSubscriptions.set(t,()=>{v(),p.cancel()});return}const i=Rh.has(t);i&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&bn.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),s&&s()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Pv){const n=Pv[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ci()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<L5.length;i++){const r=L5[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s="on"+r,l=t[s];l&&(this.propEventSubscriptions[r]=this.on(r,l))}this.prevMotionValues=Nee(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=fh(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(TL(i)||AL(i))?i=parseFloat(i):!See(i)&&ka.test(n)&&(i=b6(t,n)),this.setBaseTarget(t,or(i)?i.get():i)),or(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var s;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const l=nC(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);l&&(i=l[t])}if(n&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!or(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new qj),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){rC.render(this.render)}}class A6 extends Eee{constructor(){super(...arguments),this.KeyframeResolver=nee}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const i=t.style;return i?i[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;or(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class gc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function P6({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function Aee({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Pee(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function tS(e){return e===void 0||e===1}function Jk({scale:e,scaleX:t,scaleY:n}){return!tS(e)||!tS(t)||!tS(n)}function Hc(e){return Jk(e)||_6(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function _6(e){return U5(e.x)||U5(e.y)}function U5(e){return e&&e!=="0%"}function _v(e,t,n){const i=e-n,r=t*i;return n+r}function B5(e,t,n,i,r){return r!==void 0&&(e=_v(e,r,i)),_v(e,n,i)+t}function Zk(e,t=0,n=1,i,r){e.min=B5(e.min,t,n,i,r),e.max=B5(e.max,t,n,i,r)}function M6(e,{x:t,y:n}){Zk(e.x,t.translate,t.scale,t.originPoint),Zk(e.y,n.translate,n.scale,n.originPoint)}const F5=.999999999999,$5=1.0000000000001;function _ee(e,t,n,i=!1){var c;const r=n.length;if(!r)return;t.x=t.y=1;let s,l;for(let h=0;h<r;h++){s=n[h],l=s.projectionDelta;const{visualElement:d}=s.options;d&&d.props.style&&d.props.style.display==="contents"||(i&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Wa(e.x,-s.scroll.offset.x),Wa(e.y,-s.scroll.offset.y)),l&&(t.x*=l.x.scale,t.y*=l.y.scale,M6(e,l)),i&&Hc(s.latestValues)&&V0(e,s.latestValues,(c=s.layout)==null?void 0:c.layoutBox))}t.x<$5&&t.x>F5&&(t.x=1),t.y<$5&&t.y>F5&&(t.y=1)}function Wa(e,t){e.min+=t,e.max+=t}function V5(e,t,n,i,r=.5){const s=yn(e.min,e.max,r);Zk(e,t,n,s,i)}function z5(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function V0(e,t,n){const i=n??e;V5(e.x,z5(t.x,i.x),t.scaleX,t.scale,t.originX),V5(e.y,z5(t.y,i.y),t.scaleY,t.scale,t.originY)}function R6(e,t){return P6(Pee(e.getBoundingClientRect(),t))}function Mee(e,t,n){const i=R6(e,n),{scroll:r}=t;return r&&(Wa(i.x,r.offset.x),Wa(i.y,r.offset.y)),i}const Ree={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Oee=Mh.length;function Iee(e,t,n){let i="",r=!0;for(let l=0;l<Oee;l++){const c=Mh[l],h=e[c];if(h===void 0)continue;let d=!0;if(typeof h=="number")d=h===(c.startsWith("scale")?1:0);else{const f=parseFloat(h);d=c.startsWith("scale")?f===1:f===0}if(!d||n){const f=Qk(h,Av[c]);if(!d){r=!1;const p=Ree[c]||c;i+=`${p}(${f}) `}n&&(t[c]=f)}}const s=e.pathRotation;return s&&(r=!1,i+=`rotate(${Qk(s,Av.pathRotation)}) `),i=i.trim(),n?i=n(t,r?"":i):r&&(i="none"),i}function cC(e,t,n){const{style:i,vars:r,transformOrigin:s}=e;let l=!1,c=!1;for(const h in t){const d=t[h];if(Rh.has(h)){l=!0;continue}else if(qL(h)){r[h]=d;continue}else{const f=Qk(d,Av[h]);h.startsWith("origin")?(c=!0,s[h]=f):i[h]=f}}if(t.transform||(l||n?i.transform=Iee(t,e.transform,n):i.transform&&(i.transform="none")),c){const{originX:h="50%",originY:d="50%",originZ:f=0}=s;i.transformOrigin=`${h} ${d} ${f}`}}function O6(e,{style:t,vars:n},i,r){const s=e.style;let l;for(l in t)s[l]=t[l];r==null||r.applyProjectionStyles(s,i);for(l in n)s.setProperty(l,n[l])}function q5(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Bf={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Qe.test(e))e=parseFloat(e);else return e;const n=q5(e,t.target.x),i=q5(e,t.target.y);return`${n}% ${i}%`}},Dee={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=ka.parse(e);if(r.length>5)return i;const s=ka.createTransformer(e),l=typeof r[0]!="number"?1:0,c=n.x.scale*t.x,h=n.y.scale*t.y;r[0+l]/=c,r[1+l]/=h;const d=yn(c,h,.5);return typeof r[2+l]=="number"&&(r[2+l]/=d),typeof r[3+l]=="number"&&(r[3+l]/=d),s(r)}},eN={borderRadius:{...Bf,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bf,borderTopRightRadius:Bf,borderBottomLeftRadius:Bf,borderBottomRightRadius:Bf,boxShadow:Dee};function I6(e,{layout:t,layoutId:n}){return Rh.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!eN[e]||e==="opacity")}function uC(e,t,n){var l;const i=e.style,r=t==null?void 0:t.style,s={};if(!i)return s;for(const c in i)(or(i[c])||r&&or(r[c])||I6(c,e)||((l=n==null?void 0:n.getValue(c))==null?void 0:l.liveStyle)!==void 0)&&(s[c]=i[c]);return s}function Lee(e){return window.getComputedStyle(e)}class Uee extends A6{constructor(){super(...arguments),this.type="html",this.renderInstance=O6}readValueFromInstance(t,n){var i;if(Rh.has(n))return(i=this.projection)!=null&&i.isProjecting?Bk(n):rZ(t,n);{const r=Lee(t),s=(qL(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return R6(t,n)}build(t,n,i){cC(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return uC(t,n,i)}}const Bee={offset:"stroke-dashoffset",array:"stroke-dasharray"},Fee={offset:"strokeDashoffset",array:"strokeDasharray"};function $ee(e,t,n=1,i=0,r=!0){e.pathLength=1;const s=r?Bee:Fee;e[s.offset]=`${-i}`,e[s.array]=`${t} ${n}`}const Vee=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function D6(e,{attrX:t,attrY:n,attrScale:i,pathLength:r,pathSpacing:s=1,pathOffset:l=0,...c},h,d,f){if(cC(e,c,d),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:v}=e;p.transform&&(v.transform=p.transform,delete p.transform),(v.transform||p.transformOrigin)&&(v.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),v.transform&&(v.transformBox=(f==null?void 0:f.transformBox)??"fill-box",delete p.transformBox);for(const x of Vee)p[x]!==void 0&&(v[x]=p[x],delete p[x]);t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),i!==void 0&&(p.scale=i),r!==void 0&&$ee(p,r,s,l,!1)}const L6=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),U6=e=>typeof e=="string"&&e.toLowerCase()==="svg";function zee(e,t,n,i){O6(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(L6.has(r)?r:iC(r),t.attrs[r])}function B6(e,t,n){const i=uC(e,t,n);for(const r in e)if(or(e[r])||or(t[r])){const s=Mh.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=e[r]}return i}class qee extends A6{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ci}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Rh.has(n)){const i=y6(n);return i&&i.default||0}return n=L6.has(n)?n:iC(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return B6(t,n,i)}build(t,n,i){D6(t,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,n,i,r){zee(t,n,i,r)}mount(t){this.isSVGTag=U6(t.tagName),super.mount(t)}}const Wee=lC.length;function F6(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?F6(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Wee;n++){const i=lC[n],r=e.props[i];($m(r)||r===!1)&&(t[i]=r)}return t}function $6(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}const Hee=[...oC].reverse(),Kee=oC.length;function Gee(e){return t=>Promise.all(t.map(({animation:n,options:i})=>WZ(e,n,i)))}function Yee(e){let t=Gee(e),n=W5(),i=!0,r=!1;const s=d=>(f,p)=>{var x;const v=xu(e,p,d==="exit"?(x=e.presenceContext)==null?void 0:x.custom:void 0);if(v){const{transition:b,transitionEnd:S,...N}=v;f={...f,...N,...S}}return f};function l(d){t=d(e)}function c(d){const{props:f}=e,p=F6(e.parent)||{},v=[],x=new Set;let b={},S=1/0;for(let j=0;j<Kee;j++){const T=Hee[j],E=n[T],C=f[T]!==void 0?f[T]:p[T],P=$m(C),A=T===d?E.isActive:null;A===!1&&(S=j);let M=C===p[T]&&C!==f[T]&&P;if(M&&(i||r)&&e.manuallyAnimateOnMount&&(M=!1),E.protectedKeys={...b},!E.isActive&&A===null||!C&&!E.prevProp||ly(C)||typeof C=="boolean")continue;if(T==="exit"&&E.isActive&&A!==!0){E.prevResolvedValues&&(b={...b,...E.prevResolvedValues});continue}const R=Qee(E.prevProp,C);let B=R||T===d&&E.isActive&&!M&&P||j>S&&P,U=!1;const O=Array.isArray(C)?C:[C];let F=O.reduce(s(T),{});A===!1&&(F={});const{prevResolvedValues:ne={}}=E,re={...ne,...F},Q=$=>{B=!0,x.has($)&&(U=!0,x.delete($)),E.needsAnimating[$]=!0;const ge=e.getValue($);ge&&(ge.liveStyle=!1)};for(const $ in re){const ge=F[$],ue=ne[$];if(b.hasOwnProperty($))continue;let L=!1;Wk(ge)&&Wk(ue)?L=!$6(ge,ue)||R:L=ge!==ue,L?ge!=null?Q($):x.add($):ge!==void 0&&x.has($)?Q($):E.protectedKeys[$]=!0}E.prevProp=C,E.prevResolvedValues=F,E.isActive&&(b={...b,...F}),(i||r)&&e.blockInitialAnimation&&(B=!1);const W=M&&R;B&&(!W||U)&&v.push(...O.map($=>{const ge={type:T};if(typeof $=="string"&&(i||r)&&!W&&e.manuallyAnimateOnMount&&e.parent){const{parent:ue}=e,L=xu(ue,$);if(ue.enteringChildren&&L){const{delayChildren:J}=L.transition||{};ge.delay=u6(ue.enteringChildren,e,J)}}return{animation:$,options:ge}}))}if(x.size){const j={};if(typeof f.initial!="boolean"){const T=xu(e,Array.isArray(f.initial)?f.initial[0]:f.initial);T&&T.transition&&(j.transition=T.transition)}x.forEach(T=>{const E=e.getBaseTarget(T),C=e.getValue(T);C&&(C.liveStyle=!0),j[T]=E??null}),v.push({animation:j})}let N=!!v.length;return i&&(f.initial===!1||f.initial===f.animate)&&!e.manuallyAnimateOnMount&&(N=!1),i=!1,r=!1,N?t(v):Promise.resolve()}function h(d,f){var v;if(n[d].isActive===f)return Promise.resolve();(v=e.variantChildren)==null||v.forEach(x=>{var b;return(b=x.animationState)==null?void 0:b.setActive(d,f)}),n[d].isActive=f;const p=c(d);for(const x in n)n[x].protectedKeys={};return p}return{animateChanges:c,setActive:h,setAnimateFunction:l,getState:()=>n,reset:()=>{n=W5(),r=!0}}}function Qee(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!$6(t,e):!1}function Fc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function W5(){return{animate:Fc(!0),whileInView:Fc(),whileHover:Fc(),whileTap:Fc(),whileDrag:Fc(),whileFocus:Fc(),exit:Fc()}}function tN(e,t){e.min=t.min,e.max=t.max}function ta(e,t){tN(e.x,t.x),tN(e.y,t.y)}function H5(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const V6=1e-4,Xee=1-V6,Jee=1+V6,z6=.01,Zee=0-z6,ete=0+z6;function Pr(e){return e.max-e.min}function tte(e,t,n){return Math.abs(e-t)<=n}function K5(e,t,n,i=.5){e.origin=i,e.originPoint=yn(t.min,t.max,e.origin),e.scale=Pr(n)/Pr(t),e.translate=yn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Xee&&e.scale<=Jee||isNaN(e.scale))&&(e.scale=1),(e.translate>=Zee&&e.translate<=ete||isNaN(e.translate))&&(e.translate=0)}function wm(e,t,n,i){K5(e.x,t.x,n.x,i?i.originX:void 0),K5(e.y,t.y,n.y,i?i.originY:void 0)}function G5(e,t,n,i=0){const r=i?yn(n.min,n.max,i):n.min;e.min=r+t.min,e.max=e.min+Pr(t)}function nte(e,t,n,i){G5(e.x,t.x,n.x,i==null?void 0:i.x),G5(e.y,t.y,n.y,i==null?void 0:i.y)}function Y5(e,t,n,i=0){const r=i?yn(n.min,n.max,i):n.min;e.min=t.min-r,e.max=e.min+Pr(t)}function Mv(e,t,n,i){Y5(e.x,t.x,n.x,i==null?void 0:i.x),Y5(e.y,t.y,n.y,i==null?void 0:i.y)}function Q5(e,t,n,i,r){return e-=t,e=_v(e,1/n,i),r!==void 0&&(e=_v(e,1/r,i)),e}function ite(e,t=0,n=1,i=.5,r,s=e,l=e){if(Za.test(t)&&(t=parseFloat(t),t=yn(l.min,l.max,t/100)-l.min),typeof t!="number")return;let c=yn(s.min,s.max,i);e===s&&(c-=t),e.min=Q5(e.min,t,n,c,r),e.max=Q5(e.max,t,n,c,r)}function X5(e,t,[n,i,r],s,l){ite(e,t[n],t[i],t[r],t.scale,s,l)}const rte=["x","scaleX","originX"],ste=["y","scaleY","originY"];function J5(e,t,n,i){X5(e.x,t,rte,n?n.x:void 0,i?i.x:void 0),X5(e.y,t,ste,n?n.y:void 0,i?i.y:void 0)}function Z5(e){return e.translate===0&&e.scale===1}function q6(e){return Z5(e.x)&&Z5(e.y)}function eM(e,t){return e.min===t.min&&e.max===t.max}function ate(e,t){return eM(e.x,t.x)&&eM(e.y,t.y)}function tM(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function W6(e,t){return tM(e.x,t.x)&&tM(e.y,t.y)}function nM(e){return Pr(e.x)/Pr(e.y)}function iM(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function za(e){return[e("x"),e("y")]}function ote(e,t,n){let i="";const r=e.x.translate/t.x,s=e.y.translate/t.y,l=(n==null?void 0:n.z)||0;if((r||s||l)&&(i=`translate3d(${r}px, ${s}px, ${l}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:f,pathRotation:p,rotateX:v,rotateY:x,skewX:b,skewY:S}=n;d&&(i=`perspective(${d}px) ${i}`),f&&(i+=`rotate(${f}deg) `),p&&(i+=`rotate(${p}deg) `),v&&(i+=`rotateX(${v}deg) `),x&&(i+=`rotateY(${x}deg) `),b&&(i+=`skewX(${b}deg) `),S&&(i+=`skewY(${S}deg) `)}const c=e.x.scale*t.x,h=e.y.scale*t.y;return(c!==1||h!==1)&&(i+=`scale(${c}, ${h})`),i||"none"}const H6=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],lte=H6.length,rM=e=>typeof e=="string"?parseFloat(e):e,sM=e=>typeof e=="number"||Qe.test(e);function cte(e,t,n,i,r,s){r?(e.opacity=yn(0,n.opacity??1,ute(i)),e.opacityExit=yn(t.opacity??1,0,dte(i))):s&&(e.opacity=yn(t.opacity??1,n.opacity??1,i));for(let l=0;l<lte;l++){const c=H6[l];let h=aM(t,c),d=aM(n,c);if(h===void 0&&d===void 0)continue;h||(h=0),d||(d=0),h===0||d===0||sM(h)===sM(d)?(e[c]=Math.max(yn(rM(h),rM(d),i),0),(Za.test(d)||Za.test(h))&&(e[c]+="%")):e[c]=d}(t.rotate||n.rotate)&&(e.rotate=yn(t.rotate||0,n.rotate||0,i))}function aM(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ute=K6(0,.5,UL),dte=K6(.5,.95,qs);function K6(e,t,n){return i=>i<e?0:i>t?1:n(Bm(e,t,i))}function hte(e,t,n){const i=or(e)?e:fh(e);return i.start(tC("",i,t,n)),i.animation}function Vm(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}const fte=(e,t)=>e.depth-t.depth;class mte{constructor(){this.children=[],this.isDirty=!1}add(t){Vj(this.children,t),this.isDirty=!0}remove(t){Nv(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(fte),this.isDirty=!1,this.children.forEach(t)}}function pte(e,t){const n=Ar.now(),i=({timestamp:r})=>{const s=r-n;s>=t&&(hc(i),e(s-t))};return bn.setup(i,!0),()=>hc(i)}function z0(e){return or(e)?e.get():e}class gte{constructor(){this.members=[]}add(t){Vj(this.members,t);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===t||i===this.lead||i===this.prevLead)continue;const r=i.instance;(!r||r.isConnected===!1)&&!i.snapshot&&(Nv(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(Nv(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let i=this.members.indexOf(t)-1;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1&&((n=r.instance)==null?void 0:n.isConnected)!==!1)return this.promote(r),!0}return!1}promote(t,n){var r;const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=i.options,{layoutDependency:l}=t.options;(s===void 0||s!==l)&&(t.resumeFrom=i,n&&(i.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),(r=t.root)!=null&&r.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,i,r,s,l;(i=(n=t.options).onExitComplete)==null||i.call(n),(l=(r=t.resumingFrom)==null?void 0:(s=r.options).onExitComplete)==null||l.call(s)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const q0={hasAnimatedSinceResize:!0,hasEverUpdated:!1},nS=["","X","Y","Z"],vte=1e3;let xte=0;function iS(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function G6(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=p6(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",bn,!(r||s))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&G6(i)}function Y6({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(l={},c=t==null?void 0:t()){this.id=xte++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(wte),this.nodes.forEach(Tte),this.nodes.forEach(Ete),this.nodes.forEach(Ste)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new mte)}addEventListener(l,c){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new qj),this.eventHandlers.get(l).add(c)}notifyListeners(l,...c){const h=this.eventHandlers.get(l);h&&h.notify(...c)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=aC(l)&&!bee(l),this.instance=l;const{layoutId:c,layout:h,visualElement:d}=this.options;if(d&&!d.current&&d.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||c)&&(this.isLayoutDirty=!0),e){let f,p=0;const v=()=>this.root.updateBlockedByResize=!1;bn.read(()=>{p=window.innerWidth}),e(l,()=>{const x=window.innerWidth;x!==p&&(p=x,this.root.updateBlockedByResize=!0,f&&f(),f=pte(v,250),q0.hasAnimatedSinceResize&&(q0.hasAnimatedSinceResize=!1,this.nodes.forEach(cM)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||h)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:p,hasRelativeLayoutChanged:v,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||Rte,{onLayoutAnimationStart:S,onLayoutAnimationComplete:N}=d.getProps(),j=!this.targetLayout||!W6(this.targetLayout,x),T=!p&&v;if(this.options.layoutRoot||this.resumeFrom||T||p&&(j||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...eC(b,"layout"),onPlay:S,onComplete:N};(d.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(f,T,E.path)}else p||cM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),hc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Ate),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&G6(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const p=this.path[f];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:c,layout:h}=this.options;if(c===void 0&&!h)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const h=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),h&&this.nodes.forEach(Nte),this.nodes.forEach(oM);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(lM);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(jte),this.nodes.forEach(Cte),this.nodes.forEach(yte),this.nodes.forEach(bte)):this.nodes.forEach(lM),this.clearAllSnapshots();const c=Ar.now();nr.delta=io(0,1e3/60,c-nr.timestamp),nr.timestamp=c,nr.isProcessing=!0,Gw.update.process(nr),Gw.preRender.process(nr),Gw.render.process(nr),nr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,rC.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(kte),this.sharedNodes.forEach(Pte)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,bn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){bn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Pr(this.snapshot.measuredBox.x)&&!Pr(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Ci()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(c=!1),c&&this.instance){const h=i(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!r)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!q6(this.projectionDelta),h=this.getTransformTemplate(),d=h?h(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;l&&this.instance&&(c||Hc(this.latestValues)||f)&&(r(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const c=this.measurePageBox();let h=this.removeElementScroll(c);return l&&(h=this.removeTransform(h)),Ote(h),{animationId:this.root.animationId,measuredBox:c,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:l}=this.options;if(!l)return Ci();const c=l.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(Ite))){const{scroll:f}=this.root;f&&(Wa(c.x,f.offset.x),Wa(c.y,f.offset.y))}return c}removeElementScroll(l){var h;const c=Ci();if(ta(c,l),(h=this.scroll)!=null&&h.wasRoot)return c;for(let d=0;d<this.path.length;d++){const f=this.path[d],{scroll:p,options:v}=f;f!==this.root&&p&&v.layoutScroll&&(p.wasRoot&&ta(c,l),Wa(c.x,p.offset.x),Wa(c.y,p.offset.y))}return c}applyTransform(l,c=!1,h){var f,p;const d=h||Ci();ta(d,l);for(let v=0;v<this.path.length;v++){const x=this.path[v];!c&&x.options.layoutScroll&&x.scroll&&x!==x.root&&(Wa(d.x,-x.scroll.offset.x),Wa(d.y,-x.scroll.offset.y)),Hc(x.latestValues)&&V0(d,x.latestValues,(f=x.layout)==null?void 0:f.layoutBox)}return Hc(this.latestValues)&&V0(d,this.latestValues,(p=this.layout)==null?void 0:p.layoutBox),d}removeTransform(l){var h;const c=Ci();ta(c,l);for(let d=0;d<this.path.length;d++){const f=this.path[d];if(!Hc(f.latestValues))continue;let p;f.instance&&(Jk(f.latestValues)&&f.updateSnapshot(),p=Ci(),ta(p,f.measurePageBox())),J5(c,f.latestValues,(h=f.snapshot)==null?void 0:h.layoutBox,p)}return Hc(this.latestValues)&&J5(c,this.latestValues),c}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==nr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){var x;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==c;if(!(l||h&&this.isSharedProjectionDirty||this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:p}=this.options;if(!this.layout||!(f||p))return;this.resolvedRelativeTargetAt=nr.timestamp;const v=this.getClosestProjectingParent();v&&this.linkedParentVersion!==v.layoutVersion&&!v.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&v&&v.layout?this.createRelativeTarget(v,this.layout.layoutBox,v.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ci(),this.targetWithTransforms=Ci()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),nte(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ta(this.target,this.layout.layoutBox),M6(this.target,this.targetDelta)):ta(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?this.createRelativeTarget(v,this.target,v.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Jk(this.parent.latestValues)||_6(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,c,h){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ci(),this.relativeTargetOrigin=Ci(),Mv(this.relativeTargetOrigin,c,h,this.options.layoutAnchor||void 0),ta(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var b;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let h=!0;if((this.isProjectionDirty||(b=this.parent)!=null&&b.isProjectionDirty)&&
vendor: 5,721 bytes, line 617
617(h=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===nr.timestamp&&(h=!1),h)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;ta(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,v=this.treeScale.y;_ee(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Ci());const{target:x}=l;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(H5(this.prevProjectionDelta.x,this.projectionDelta.x),H5(this.prevProjectionDelta.y,this.projectionDelta.y)),wm(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==v||!iM(this.projectionDelta.x,this.prevProjectionDelta.x)||!iM(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){var c;if((c=this.options.visualElement)==null||c.scheduleRender(),l){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Wd(),this.projectionDelta=Wd(),this.projectionDeltaWithTransform=Wd()}setAnimationOrigin(l,c=!1,h){const d=this.snapshot,f=d?d.latestValues:{},p={...this.latestValues},v=Wd();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const x=Ci(),b=d?d.source:void 0,S=this.layout?this.layout.source:void 0,N=b!==S,j=this.getStack(),T=!j||j.members.length<=1,E=!!(N&&!T&&this.options.crossfade===!0&&!this.path.some(Mte));this.animationProgress=0;let C;const P=h==null?void 0:h.interpolateProjection(l);this.mixTargetDelta=A=>{const M=A/1e3,R=P==null?void 0:P(M);R?(v.x.translate=R.x,v.x.scale=yn(l.x.scale,1,M),v.x.origin=l.x.origin,v.x.originPoint=l.x.originPoint,v.y.translate=R.y,v.y.scale=yn(l.y.scale,1,M),v.y.origin=l.y.origin,v.y.originPoint=l.y.originPoint):(uM(v.x,l.x,M),uM(v.y,l.y,M)),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Mv(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_te(this.relativeTarget,this.relativeTargetOrigin,x,M),C&&ate(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=Ci()),ta(C,this.relativeTarget)),N&&(this.animationValues=p,cte(p,f,this.latestValues,M,E,T)),R&&R.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=R.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){var c,h,d;this.notifyListeners("animationStart"),(c=this.currentAnimation)==null||c.stop(),(d=(h=this.resumingFrom)==null?void 0:h.currentAnimation)==null||d.stop(),this.pendingAnimation&&(hc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=bn.update(()=>{q0.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=fh(0)),this.motionValue.jump(0,!1),this.currentAnimation=hte(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(vte),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:c,target:h,layout:d,latestValues:f}=l;if(!(!c||!h||!d)){if(this!==l&&this.layout&&d&&Q6(this.options.animationType,this.layout.layoutBox,d.layoutBox)){h=this.target||Ci();const p=Pr(this.layout.layoutBox.x);h.x.min=l.target.x.min,h.x.max=h.x.min+p;const v=Pr(this.layout.layoutBox.y);h.y.min=l.target.y.min,h.y.max=h.y.min+v}ta(c,h),V0(c,f),wm(this.projectionDeltaWithTransform,this.layoutCorrected,c,f)}}registerSharedNode(l,c){this.sharedNodes.has(l)||this.sharedNodes.set(l,new gte),this.sharedNodes.get(l).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){var c;const{layoutId:l}=this.options;return l?((c=this.getStack())==null?void 0:c.lead)||this:this}getPrevLead(){var c;const{layoutId:l}=this.options;return l?(c=this.getStack())==null?void 0:c.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:c,preserveFollowOpacity:h}={}){const d=this.getStack();d&&d.promote(this,h),l&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}
vendor: 4,517 bytes, line 617
617resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let c=!1;const{latestValues:h}=l;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(c=!0),!c)return;const d={};h.z&&iS("z",l,d,this.animationValues);for(let f=0;f<nS.length;f++)iS(`rotate${nS[f]}`,l,d,this.animationValues),iS(`skew${nS[f]}`,l,d,this.animationValues);l.render();for(const f in d)l.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);l.scheduleRender()}applyProjectionStyles(l,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=z0(c==null?void 0:c.pointerEvents)||"",l.transform=h?h(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=z0(c==null?void 0:c.pointerEvents)||""),this.hasProjected&&!Hc(this.latestValues)&&(l.transform=h?h({},""):"none",this.hasProjected=!1);return}l.visibility="";const f=d.animationValues||d.latestValues;this.applyTransformsToTarget();let p=ote(this.projectionDeltaWithTransform,this.treeScale,f);h&&(p=h(f,p)),l.transform=p;const{x:v,y:x}=this.projectionDelta;l.transformOrigin=`${v.origin*100}% ${x.origin*100}% 0`,d.animationValues?l.opacity=d===this?f.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:l.opacity=d===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const b in eN){if(f[b]===void 0)continue;const{correct:S,applyTo:N,isCSSVariable:j}=eN[b],T=p==="none"?f[b]:S(f[b],d);if(N){const E=N.length;for(let C=0;C<E;C++)l[N[C]]=T}else j?this.options.visualElement.renderState.vars[b]=T:l[b]=T}this.options.layoutId&&(l.pointerEvents=d===this?z0(c==null?void 0:c.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>{var c;return(c=l.currentAnimation)==null?void 0:c.stop()}),this.root.nodes.forEach(oM),this.root.sharedNodes.clear()}}}function yte(e){e.updateLayout()}function bte(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=e.layout,{animationType:s}=e.options,l=t.source!==e.layout.source;if(s==="size")za(p=>{const v=l?t.measuredBox[p]:t.layoutBox[p],x=Pr(v);v.min=i[p].min,v.max=v.min+x});else if(s==="x"||s==="y"){const p=s==="x"?"y":"x";tN(l?t.measuredBox[p]:t.layoutBox[p],i[p])}else Q6(s,t.layoutBox,i)&&za(p=>{const v=l?t.measuredBox[p]:t.layoutBox[p],x=Pr(i[p]);v.max=v.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+x)});const c=Wd();wm(c,i,t.layoutBox);const h=Wd();l?wm(h,e.applyTransform(r,!0),t.measuredBox):wm(h,i,t.layoutBox);const d=!q6(c);let f=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:v,layout:x}=p;if(v&&x){const b=e.options.layoutAnchor||void 0,S=Ci();Mv(S,t.layoutBox,v.layoutBox,b);const N=Ci();Mv(N,i,x.layoutBox,b),W6(S,N)||(f=!0),p.options.layoutRoot&&(e.relativeTarget=N,e.relativeTargetOrigin=S,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:t,delta:h,layoutDelta:c,hasLayoutChanged:d,hasRelativeLayoutChanged:f})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function wte(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Ste(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function kte(e){e.clearSnapshot()}function oM(e){e.clearMeasurements()}function Nte(e){e.isLayoutDirty=!0,e.updateLayout()}function lM(e){e.isLayoutDirty=!1}function jte(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Cte(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function cM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Tte(e){e.resolveTargetDelta()}function Ete(e){e.calcProjection()}
617function Ate(e){e.resetSkewAndRotation()}function Pte(e){e.removeLeadSnapshot()}function uM(e,t,n){e.translate=yn(t.translate,0,n),e.scale=yn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function dM(e,t,n,i){e.min=yn(t.min,n.min,i),e.max=yn(t.max,n.max,i)}function _te(e,t,n,i){dM(e.x,t.x,n.x,i),dM(e.y,t.y,n.y,i)}function Mte(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Rte={duration:.45,ease:[.4,0,.1,1]},hM=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),fM=hM("applewebkit/")&&!hM("chrome/")?Math.round:qs;function mM(e){e.min=fM(e.min),e.max=fM(e.max)}function Ote(e){mM(e.x),mM(e.y)}function Q6(e,t,n){return e==="position"||e==="preserve-aspect"&&!tte(nM(t),nM(n),.2)}function Ite(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Dte=Y6({attachResizeListener:(e,t)=>Vm(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),rS={current:void 0},X6=Y6({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!rS.current){const e=new Dte({});e.mount(window),e.setOptions({layoutScroll:!0}),rS.current=e}return rS.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),dC=w.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function pM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Lte(...e){return t=>{let n=!1;const i=e.map(r=>{const s=pM(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():pM(e[r],null)}}}}function Ute(...e){return w.useCallback(Lte(...e),e)}class Bte extends w.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(U0(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=n.offsetParent,r=U0(i)&&i.offsetWidth||0,s=U0(i)&&i.offsetHeight||0,l=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(l.height),c.width=parseFloat(l.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=r-c.width-c.left,c.bottom=s-c.height-c.top,c.direction=l.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function Fte({children:e,isPresent:t,anchorX:n,anchorY:i,root:r,pop:s}){var v;const l=w.useId(),c=w.useRef(null),h=w.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:d}=w.useContext(dC),f=((v=e.props)==null?void 0:v.ref)??(e==null?void 0:e.ref),p=Ute(c,f);return w.useInsertionEffect(()=>{const{width:x,height:b,top:S,left:N,right:j,bottom:T,direction:E}=h.current;if(t||s===!1||!c.current||!x||!b)return;const C=E==="rtl",P=n==="left"?C?`right: ${j}`:`left: ${N}`:C?`left: ${N}`:`right: ${j}`,A=i==="bottom"?`bottom: ${T}`:`top: ${S}`;c.current.dataset.motionPopId=l;const M=document.createElement("style");d&&(M.nonce=d);const R=r??document.head;return R.appendChild(M),M.sheet&&M.sheet.insertRule(`
618          [data-motion-pop-id="${l}"] {
619            position: absolute !important;
620            width: ${x}px !important;
621            height: ${b}px !important;
622            ${P}px !important;
623            ${A}px !important;
624          }
625        `),()=>{var B;(B=c.current)==null||B.removeAttribute("data-motion-pop-id"),R.contains(M)&&R.removeChild(M)}},[t]),a.jsx(Bte,{isPresent:t,childRef:c,sizeRef:h,pop:s,children:s===!1?e:w.cloneElement(e,{ref:p})})}const $te=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:l,anchorX:c,anchorY:h,root:d})=>{const f=Fj(Vte),p=w.useId(),v=w.useRef(n),x=w.useRef(i);$j(()=>{v.current=n,x.current=i});let b=!0,S=w.useMemo(()=>(b=!1,{id:p,initial:t,isPresent:n,custom:r,onExitComplete:N=>{f.set(N,!0);for(const j of f.values())if(!j)return;i&&i()},register:N=>(f.set(N,!1),()=>{var j;f.delete(N),!v.current&&!f.size&&((j=x.current)==null||j.call(x))})}),[n,f,i]);return s&&b&&(S={...S}),w.useMemo(()=>{f.forEach((N,j)=>f.set(j,!1))},[n]),w.useEffect(()=>{!n&&!f.size&&i&&i()},[n]),e=a.jsx(Fte,{pop:l==="popLayout",isPresent:n,anchorX:c,anchorY:h,root:d,children:e}),a.jsx(ay.Provider,{value:S,children:e})};function Vte(){return new Map}function J6(e=!0){const t=w.useContext(ay);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,s=w.useId();w.useEffect(()=>{if(e)return r(s)},[e]);const l=w.useCallback(()=>e&&i&&i(s),[s,i,e]);return!n&&i?[!1,l]:[!0]}const o0=e=>e.key||"";function gM(e){const t=[];
vendor: 8,068 bytes, line 625
625return w.Children.forEach(e,n=>{w.isValidElement(n)&&t.push(n)}),t}const Zc=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:l=!1,anchorX:c="left",anchorY:h="top",root:d})=>{const[f,p]=J6(l),v=w.useMemo(()=>gM(e),[e]),x=l&&!f?[]:v.map(o0),b=w.useRef(!0),S=w.useRef(v),N=Fj(()=>new Map),j=w.useRef(new Set),[T,E]=w.useState(v),[C,P]=w.useState(v);$j(()=>{b.current=!1,S.current=v;for(let R=0;R<C.length;R++){const B=o0(C[R]);x.includes(B)?(N.delete(B),j.current.delete(B)):N.get(B)!==!0&&N.set(B,!1)}},[C,x.length,x.join("-")]);const A=[];if(v!==T){let R=[...v];for(let B=0;B<C.length;B++){const U=C[B],O=o0(U);x.includes(O)||(R.splice(B,0,U),A.push(U))}return s==="wait"&&A.length&&(R=A),P(gM(R)),E(v),null}const{forceRender:M}=w.useContext(Bj);return a.jsx(a.Fragment,{children:C.map(R=>{const B=o0(R),U=l&&!f?!1:v===C||x.includes(B),O=()=>{if(j.current.has(B))return;if(N.has(B))j.current.add(B),N.set(B,!0);else return;let F=!0;N.forEach(ne=>{ne||(F=!1)}),F&&(M==null||M(),P(S.current),l&&(p==null||p()),i&&i())};return a.jsx($te,{isPresent:U,initial:!b.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:s,root:d,onExitComplete:U?void 0:O,anchorX:c,anchorY:h,children:R},B)})})},Z6=w.createContext({strict:!1}),vM={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let xM=!1;function zte(){if(xM)return;const e={};for(const t in vM)e[t]={isEnabled:n=>vM[t].some(i=>!!n[i])};E6(e),xM=!0}function eU(){return zte(),Tee()}function qte(e){const t=eU();for(const n in e)t[n]={...t[n],...e[n]};E6(t)}const Wte=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Rv(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Wte.has(e)}let tU=e=>!Rv(e);function Hte(e){typeof e=="function"&&(tU=t=>t.startsWith("on")?!Rv(t):e(t))}try{Hte(require("@emotion/is-prop-valid").default)}catch{}function Kte(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||or(e[r])||(tU(r)||n===!0&&Rv(r)||!t&&!Rv(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}const uy=w.createContext({});function Gte(e,t){if(cy(e)){const{initial:n,animate:i}=e;return{initial:n===!1||$m(n)?n:void 0,animate:$m(i)?i:void 0}}return e.inherit!==!1?t:{}}function Yte(e){const{initial:t,animate:n}=Gte(e,w.useContext(uy));return w.useMemo(()=>({initial:t,animate:n}),[yM(t),yM(n)])}function yM(e){return Array.isArray(e)?e.join(" "):e}const hC=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function nU(e,t,n){for(const i in t)!or(t[i])&&!I6(i,n)&&(e[i]=t[i])}function Qte({transformTemplate:e},t){return w.useMemo(()=>{const n=hC();return cC(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Xte(e,t){const n=e.style||{},i={};return nU(i,n,e),Object.assign(i,Qte(e,t)),i}function Jte(e,t){const n={},i=Xte(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const iU=()=>({...hC(),attrs:{}});function Zte(e,t,n,i){const r=w.useMemo(()=>{const s=iU();return D6(s,t,U6(i),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};nU(s,e.style,e),r.style={...s,...r.style}}return r}const ene=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fC(e){return typeof e!="string"||e.includes("-")?!1:!!(ene.indexOf(e)>-1||/[A-Z]/u.test(e))}function tne(e,t,n,{latestValues:i},r,s=!1,l){const h=(l??fC(e)?Zte:Jte)(t,i,r,e),d=Kte(t,typeof e=="string",s),f=e!==w.Fragment?{...d,...h,ref:n}:{},{children:p}=t,v=w.useMemo(()=>or(p)?p.get():p,[p]);return w.createElement(e,{...f,children:v})}function nne({scrapeMotionValuesFromProps:e,createRenderState:t},n,i,r){return{latestValues:ine(n,i,r,e),renderState:t()}}function ine(e,t,n,i){const r={},s=i(e,{});for(const v in s)r[v]=z0(s[v]);let{initial:l,animate:c}=e;const h=cy(e),d=C6(e);t&&d&&!h&&e.inherit!==!1&&(l===void 0&&(l=t.initial),c===void 0&&(c=t.animate));let f=n?n.initial===!1:!1;f=f||l===!1;const p=f?c:l;if(p&&typeof p!="boolean"&&!ly(p)){const v=Array.isArray(p)?p:[p];for(let x=0;x<v.length;x++){const b=nC(e,v[x]);if(b){const{transitionEnd:S,transition:N,...j}=b;for(const T in j){let E=j[T];if(Array.isArray(E)){const C=f?E.length-1:0;E=E[C]}E!==null&&(r[T]=E)}for(const T in S)r[T]=S[T]}}}return r}const rU=e=>(t,n)=>{const i=w.useContext(uy),r=w.useContext(ay),s=()=>nne(e,t,i,r);return n?s():Fj(s)},rne=rU({scrapeMotionValuesFromProps:uC,createRenderState:hC}),sne=rU({scrapeMotionValuesFromProps:B6,createRenderState:iU}),ane=Symbol.for("motionComponentSymbol");function one(e,t,n){const i=w.useRef(n);w.useInsertionEffect(()=>{i.current=n});const r=w.useRef(null);return w.useCallback(s=>{var c;s&&((c=e.onMount)==null||c.call(e,s)),t&&(s?t.mount(s):t.unmount());const l=i.current;if(typeof l=="function")if(s){const h=l(s);typeof h=="function"&&(r.current=h)}else r.current?(r.current(),r.current=null):l(s);else l&&(l.current=s)},[t])}const sU=w.createContext({});function Bd(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function lne(e,t,n,i,r,s){var E,C;const{visualElement:l}=w.useContext(uy),c=w.useContext(Z6),h=w.useContext(ay),d=w.useContext(dC),f=d.reducedMotion,p=d.skipAnimations,v=w.useRef(null),x=w.useRef(!1);i=i||c.renderer,!v.current&&i&&(v.current=i(e,{visualState:t,parent:l,props:n,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:f,skipAnimations:p,isSVG:s}),x.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const b=v.current,S=w.useContext(sU);b&&!b.projection&&r&&(b.type==="html"||b.type==="svg")&&cne(v.current,n,r,S);const N=w.useRef(!1);w.useInsertionEffect(()=>{b&&N.current&&b.update(n,h)});const j=n[m6],T=w.useRef(!!j&&typeof window<"u"&&!((E=window.MotionHandoffIsComplete)!=null&&E.call(window,j))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,j)));return $j(()=>{x.current=!0,b&&(N.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),b.scheduleRenderMicrotask(),T.current&&b.animationState&&b.animationState.animateChanges())}),w.useEffect(()=>{b&&(!T.current&&b.animationState&&b.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var P;(P=window.MotionHandoffMarkAsComplete)==null||P.call(window,j)}),T.current=!1),b.enteringChildren=void 0)}),b}function cne(e,t,n,i){const{layoutId:r,layout:s,drag:l,dragConstraints:c,layoutScroll:h,layoutRoot:d,layoutAnchor:f,layoutCrossfade:p}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:aU(e.parent)),e.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!l||c&&Bd(c),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:p,layoutScroll:h,layoutRoot:d,layoutAnchor:f})}function aU(e){if(e)return e.options.allowProjection!==!1?e.projection:aU(e.parent)}function sS(e,{forwardMotionProps:t=!1,type:n}={},i,r){i&&qte(i);const s=n?n==="svg":fC(e),l=s?sne:rne;function c(d,f){let p;
vendor: 20,327 bytes, line 625
625const v={...w.useContext(dC),...d,layoutId:une(d)},{isStatic:x}=v,b=Yte(d),S=l(d,x);if(!x&&typeof window<"u"){dne();const N=hne(v);p=N.MeasureLayout,b.visualElement=lne(e,S,v,r,N.ProjectionNode,s)}return a.jsxs(uy.Provider,{value:b,children:[p&&b.visualElement?a.jsx(p,{visualElement:b.visualElement,...v}):null,tne(e,d,one(S,b.visualElement,f),S,x,t,s)]})}c.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=w.forwardRef(c);return h[ane]=e,h}function une({layoutId:e}){const t=w.useContext(Bj).id;return t&&e!==void 0?t+"-"+e:e}function dne(e,t){w.useContext(Z6).strict}function hne(e){const t=eU(),{drag:n,layout:i}=t;if(!n&&!i)return{};const r={...n,...i};return{MeasureLayout:n!=null&&n.isEnabled(e)||i!=null&&i.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function fne(e,t){if(typeof Proxy>"u")return sS;const n=new Map,i=(s,l)=>sS(s,l,e,t),r=(s,l)=>i(s,l);return new Proxy(r,{get:(s,l)=>l==="create"?i:(n.has(l)||n.set(l,sS(l,void 0,e,t)),n.get(l))})}const mne=(e,t)=>t.isSVG??fC(e)?new qee(t):new Uee(t,{allowProjection:e!==w.Fragment});class pne extends gc{constructor(t){super(t),t.animationState||(t.animationState=Yee(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ly(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let gne=0;class vne extends gc{constructor(){super(...arguments),this.id=gne++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;if(t&&i===!1){if(this.isExitComplete){const{initial:l,custom:c}=this.node.getProps();if(typeof l=="string"||typeof l=="object"&&l!==null&&!Array.isArray(l)){const h=xu(this.node,l,c);if(h){const{transition:d,transitionEnd:f,...p}=h;for(const v in p)(s=this.node.getValue(v))==null||s.jump(p[v])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const xne={animation:{Feature:pne},exit:{Feature:vne}};function kp(e){return{point:{x:e.pageX,y:e.pageY}}}const yne=e=>t=>sC(t)&&e(t,kp(t));function Sm(e,t,n,i){return Vm(e,t,yne(n),i)}const oU=({current:e})=>e?e.ownerDocument.defaultView:null,bM=(e,t)=>Math.abs(e-t);function bne(e,t){const n=bM(e.x,t.x),i=bM(e.y,t.y);return Math.sqrt(n**2+i**2)}const wM=new Set(["auto","scroll"]);class lU{constructor(t,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:l=3,element:c}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=l0(this.lastRawMoveEventInfo,this.transformPagePoint));const b=aS(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,N=bne(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!N)return;const{point:j}=b,{timestamp:T}=nr;this.history.push({...j,timestamp:T});const{onStart:E,onMove:C}=this.handlers;S||(E&&E(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,b)},this.handlePointerMove=(b,S)=>{this.lastMoveEvent=b,this.lastRawMoveEventInfo=S,this.lastMoveEventInfo=l0(S,this.transformPagePoint),bn.update(this.updatePoint,!0)},this.handlePointerUp=(b,S)=>{this.end();const{onEnd:N,onSessionEnd:j,resumeAnimation:T}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&T&&T(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=aS(b.type==="pointercancel"?this.lastMoveEventInfo:l0(S,this.transformPagePoint),this.history);this.startEvent&&N&&N(b,E),j&&j(b,E)},!sC(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=l,this.contextWindow=r||window;const h=kp(t),d=l0(h,this.transformPagePoint),{point:f}=d,{timestamp:p}=nr;this.history=[{...f,timestamp:p}];const{onSessionStart:v}=n;v&&v(t,aS(d,this.history));const x={passive:!0,capture:!0};this.removeListeners=bp(Sm(this.contextWindow,"pointermove",this.handlePointerMove,x),Sm(this.contextWindow,"pointerup",this.handlePointerUp,x),Sm(this.contextWindow,"pointercancel",this.handlePointerUp,x)),c&&this.startScrollTracking(c)}startScrollTracking(t){let n=t.parentElement;for(;n;){const i=getComputedStyle(n);(wM.has(i.overflowX)||wM.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const i=t===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:r.x-n.x,y:r.y-n.y};s.x===0&&s.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,r),bn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),hc(this.updatePoint)}}function l0(e,t){return t?{point:t(e.point)}:e}function SM(e,t){return{x:e.x-t.x,y:e.y-t.y}}function aS({point:e},t){return{point:e,delta:SM(e,cU(t)),offset:SM(e,wne(t)),velocity:Sne(t,.1)}}function wne(e){return e[0]}function cU(e){return e[e.length-1]}function Sne(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=cU(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>ys(t)));)n--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&r.timestamp-i.timestamp>ys(t)*2&&(i=e[1]);const s=Bs(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const l={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function kne(e,{min:t,max:n},i){return t!==void 0&&e<t?e=i?yn(t,e,i.min):Math.max(e,t):n!==void 0&&e>n&&(e=i?yn(n,e,i.max):Math.min(e,n)),e}function kM(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Nne(e,{top:t,left:n,bottom:i,right:r}){return{x:kM(e.x,n,r),y:kM(e.y,t,i)}}function NM(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,i]=[i,n]),{min:n,max:i}}function jne(e,t){return{x:NM(e.x,t.x),y:NM(e.y,t.y)}}function Cne(e,t){let n=.5;const i=Pr(e),r=Pr(t);return r>i?n=Bm(t.min,t.max-i,e.min):i>r&&(n=Bm(e.min,e.max-r,t.min)),io(0,1,n)}function Tne(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const nN=.35;function Ene(e=nN){return e===!1?e=0:e===!0&&(e=nN),{x:jM(e,"left","right"),y:jM(e,"top","bottom")}}function jM(e,t,n){return{min:CM(e,t),max:CM(e,n)}}function CM(e,t){return typeof e=="number"?e:e[t]||0}const Ane=new WeakMap;class Pne{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ci(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=p=>{n&&this.snapToCursor(kp(p).point),this.stopAnimation()},l=(p,v)=>{const{drag:x,dragPropagation:b,onDragStart:S}=this.getProps();if(x&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=iee(x),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),za(j=>{let T=this.getAxisMotionValue(j).get()||0;if(Za.test(T)){const{projection:E}=this.visualElement;if(E&&E.layout){const C=E.layout.layoutBox[j];C&&(T=Pr(C)*(parseFloat(T)/100))}}this.originPoint[j]=T}),S&&bn.update(()=>S(p,v),!1,!0),Hk(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},c=(p,v)=>{this.latestPointerEvent=p,this.latestPanInfo=v;const{dragPropagation:x,dragDirectionLock:b,onDirectionLock:S,onDrag:N}=this.getProps();if(!x&&!this.openDragLock)return;const{offset:j}=v;if(b&&this.currentDirection===null){this.currentDirection=Mne(j),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",v.point,j),this.updateAxis("y",v.point,j),this.visualElement.render(),N&&bn.update(()=>N(p,v),!1,!0)},h=(p,v)=>{this.latestPointerEvent=p,this.latestPanInfo=v,this.stop(p,v),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:f}=this.getProps();this.panSession=new lU(t,{onSessionStart:s,onStart:l,onMove:c,onSessionEnd:h,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:i,contextWindow:oU(this.visualElement),element:this.visualElement.current})}stop(t,n){const i=t||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!i)return;const{velocity:l}=r;this.startAnimation(l);const{onDragEnd:c}=this.getProps();c&&bn.postRender(()=>c(i,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!c0(t,r,this.currentDirection))return;const s=this.getAxisMotionValue(t);let l=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(l=kne(l,this.constraints[t],this.elastic[t])),s.set(l)}resolveConstraints(){var s;const{dragConstraints:t,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,r=this.constraints;t&&Bd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&i?this.constraints=Nne(i.layoutBox,t):this.constraints=!1,this.elastic=Ene(n),r!==this.constraints&&!Bd(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&za(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=Tne(i.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Bd(t))return!1;const i=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const s=Mee(i,r.root,this.visualElement.getTransformPagePoint());let l=jne(r.layout.layoutBox,s);if(n){const c=n(Aee(l));this.hasMutatedConstraints=!!c,c&&(l=P6(c))}return l}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:l,onDragTransitionEnd:c}=this.getProps(),h=this.constraints||{},d=za(f=>{if(!c0(f,n,this.currentDirection))return;let p=h&&h[f]||{};(l===!0||l===f)&&(p={min:0,max:0});const v=r?200:1e6,x=r?40:1e7,b={type:"inertia",velocity:i?t[f]:0,bounceStiffness:v,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(f,b)});return Promise.all(d).then(c)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return Hk(this.visualElement,t),i.start(tC(t,i,0,n,this.visualElement,!1))}stopAnimation(){za(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps()[n];return r||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){za(n=>{const{drag:i}=this.getProps();if(!c0(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:l,max:c}=r.layout.layoutBox[n],h=s.get()||0;s.set(t[n]-yn(l,c,.5)+h)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Bd(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};za(l=>{const c=this.getAxisMotionValue(l);if(c&&this.constraints!==!1){const h=c.get();r[l]=Cne({min:h,max:h},this.constraints[l])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),za(l=>{if(!c0(l,t,null))return;const c=this.getAxisMotionValue(l),{min:h,max:d}=this.constraints[l];c.set(yn(h,d,r[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Ane.set(this.visualElement,this);const t=this.visualElement.current,n=Sm(t,"pointerdown",d=>{const{drag:f,dragListener:p=!0}=this.getProps(),v=d.target,x=v!==t&&cee(v);f&&p&&!x&&this.start(d)});let i;const r=()=>{const{dragConstraints:d}=this.getProps();Bd(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),i||(i=_ne(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,l=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),bn.read(r);const c=Vm(window,"resize",()=>this.scalePositionWithinConstraints()),h=s.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:f})=>{this.isDragging&&f&&(za(p=>{const v=this.getAxisMotionValue(p);v&&(this.originPoint[p]+=d[p].translate,v.set(v.get()+d[p].translate))}),this.visualElement.render())}));return()=>{c(),n(),l(),h&&h(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:l=nN,dragMomentum:c=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:l,dragMomentum:c}}}function TM(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function _ne(e,t,n){const i=O5(e,TM(n)),r=O5(t,TM(n));return()=>{i(),r()}}function c0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Mne(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Rne extends gc{constructor(t){super(t),this.removeGroupControls=qs,this.removeListeners=qs,this.controls=new Pne(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||qs}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const oS=e=>(t,n)=>{e&&bn.update(()=>e(t,n),!1,!0)};class One extends gc{constructor(){super(...arguments),this.removePointerDownListener=qs}onPointerDown(t){this.session=new lU(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:oU(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:oS(t),onStart:oS(n),onMove:oS(i),onEnd:(s,l)=>{delete this.session,r&&bn.postRender(()=>r(s,l))}}}mount(){this.removePointerDownListener=Sm(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let lS=!1;class Ine extends w.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=t;s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),lS&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),q0.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,{projection:l}=i;return l&&(l.isPresent=s,t.layoutDependency!==n&&l.setOptions({...l.options,layoutDependency:n}),lS=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==s?l.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?l.promote():l.relegate()||bn.postRender(()=>{const c=l.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:i}=t;i&&(i.options.layoutAnchor=n,i.root.didUpdate(),rC.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;lS=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function uU(e){const[t,n]=J6(),i=w.useContext(Bj);return a.jsx(Ine,{...e,layoutGroup:i,switchLayoutGroup:w.useContext(sU),isPresent:t,safeToRemove:n})}const Dne={pan:{Feature:One},drag:{Feature:Rne,ProjectionNode:X6,MeasureLayout:uU}};function EM(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&bn.postRender(()=>s(t,kp(t)))}class Lne extends gc{mount(){const{current:t}=this.node;t&&(this.unmount=see(t,(n,i)=>(EM(this.node,i,"Start"),r=>EM(this.node,r,"End"))))}unmount(){}}class Une extends gc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=bp(Vm(this.node.current,"focus",()=>this.onFocus()),Vm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function AM(e,t,n){const{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&bn.postRender(()=>s(t,kp(t)))}class Bne extends gc{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=dee(t,(r,s)=>(AM(this.node,s,"Start"),(l,{success:c})=>AM(this.node,l,c?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(i==null?void 0:i.tap)===!1})}unmount(){}}const iN=new WeakMap,cS=new WeakMap,Fne=e=>{const t=iN.get(e.target);t&&t(e)},$ne=e=>{e.forEach(Fne)};function Vne({root:e,...t}){const n=e||document;cS.has(n)||cS.set(n,{});const i=cS.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver($ne,{root:e,...t})),i[r]}function zne(e,t,n){const i=Vne(t);return iN.set(e,n),i.observe(e),()=>{iN.delete(e),i.unobserve(e)}}const qne={some:0,all:1};class Wne extends gc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var h;(h=this.stopObserver)==null||h.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=t,l={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:q
vendor: 15,814 bytes, lines 625-626
625ne[r]},c=d=>{const{isIntersecting:f}=d;if(this.isInView===f||(this.isInView=f,s&&!f&&this.hasEnteredView))return;f&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",f);const{onViewportEnter:p,onViewportLeave:v}=this.node.getProps(),x=f?p:v;x&&x(d)};this.stopObserver=zne(this.node.current,l,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Hne(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function Hne({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Kne={inView:{Feature:Wne},tap:{Feature:Bne},focus:{Feature:Une},hover:{Feature:Lne}},Gne={layout:{ProjectionNode:X6,MeasureLayout:uU}},Yne={...xne,...Kne,...Dne,...Gne},Qne=fne(Yne,mne),pn=Qne;var PM={};function Xne(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}var Jne=Object.defineProperty,Zne=(e,t,n)=>t in e?Jne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_M=(e,t,n)=>Zne(e,typeof t!="symbol"?t+"":t,n);class ur{constructor(){_M(this,"_locking"),_M(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let t;const n=new Promise(r=>t=()=>{this._locks-=1,r()}),i=this._locking.then(()=>t);return this._locking=this._locking.then(()=>n),i}}function Xn(e,t){if(!e)throw new Error(t)}const eie=34028234663852886e22,tie=-34028234663852886e22,nie=4294967295,iie=2147483647,rie=-2147483648;function W0(e){if(typeof e!="number")throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>iie||e<rie)throw new Error("invalid int 32: "+e)}function rN(e){if(typeof e!="number")throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>nie||e<0)throw new Error("invalid uint 32: "+e)}function dU(e){if(typeof e!="number")throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>eie||e<tie))throw new Error("invalid float 32: "+e)}const hU=Symbol("@bufbuild/protobuf/enum-type");function sie(e){const t=e[hU];return Xn(t,"missing enum type on enum object"),t}function fU(e,t,n,i){e[hU]=mU(t,n.map(r=>({no:r.no,name:r.name,localName:e[r.no]})))}function mU(e,t,n){const i=Object.create(null),r=Object.create(null),s=[];for(const l of t){const c=pU(l);s.push(c),i[l.name]=c,r[l.no]=c}return{typeName:e,values:s,findName(l){return i[l]},findNumber(l){return r[l]}}}function aie(e,t,n){const i={};for(const r of t){const s=pU(r);i[s.localName]=s.no,i[s.no]=s.localName}return fU(i,e,t),i}function pU(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class mC{equals(t){return this.getType().runtime.util.equals(this.getType(),this,t)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(t,n){const i=this.getType(),r=i.runtime.bin,s=r.makeReadOptions(n);return r.readMessage(this,s.readerFactory(t),t.byteLength,s),this}fromJson(t,n){const i=this.getType(),r=i.runtime.json,s=r.makeReadOptions(n);return r.readMessage(i,t,s,this),this}fromJsonString(t,n){let i;try{i=JSON.parse(t)}catch(r){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(r instanceof Error?r.message:String(r)))}return this.fromJson(i,n)}toBinary(t){const n=this.getType(),i=n.runtime.bin,r=i.makeWriteOptions(t),s=r.writerFactory();return i.writeMessage(this,s,r),s.finish()}toJson(t){const n=this.getType(),i=n.runtime.json,r=i.makeWriteOptions(t);return i.writeMessage(this,r)}toJsonString(t){var n;const i=this.toJson(t);return JSON.stringify(i,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function oie(e,t,n,i){var r;const s=(r=i==null?void 0:i.localName)!==null&&r!==void 0?r:t.substring(t.lastIndexOf(".")+1),l={[s]:function(c){e.util.initFields(this),e.util.initPartial(c,this)}}[s];return Object.setPrototypeOf(l.prototype,new mC),Object.assign(l,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(c,h){return new l().fromBinary(c,h)},fromJson(c,h){return new l().fromJson(c,h)},fromJsonString(c,h){return new l().fromJsonString(c,h)},equals(c,h){return e.util.equals(l,c,h)}}),l}function lie(){let e=0,t=0;for(let i=0;i<28;i+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<i,(r&128)==0)return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,(n&128)==0)return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<i,(r&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function uS(e,t,n){for(let s=0;s<28;s=s+7){const l=e>>>s,c=!(!(l>>>7)&&t==0),h=(c?l|128:l)&255;if(n.push(h),!c)return}const i=e>>>28&15|(t&7)<<4,r=t>>3!=0;if(n.push((r?i|128:i)&255),!!r){for(let s=3;s<31;s=s+7){const l=t>>>s,c=!!(l>>>7),h=(c?l|128:l)&255;if(n.push(h),!c)return}n.push(t>>>31&1)}}const H0=4294967296;function MM(e){const t=e[0]==="-";t&&(e=e.slice(1));const n=1e6;let i=0,r=0;function s(l,c){const h=Number(e.slice(l,c));r*=n,i=i*n+h,i>=H0&&(r=r+(i/H0|0),i=i%H0)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),t?vU(i,r):pC(i,r)}function cie(e,t){let n=pC(e,t);const i=n.hi&2147483648;i&&(n=vU(n.lo,n.hi));const r=gU(n.lo,n.hi);return i?"-"+r:r}function gU(e,t){var n=uie(e,t);if(e=n.lo,t=n.hi,t<=2097151)return String(H0*t+e);const i=e&16777215,r=(e>>>24|t<<8)&16777215,s=t>>16&65535;let l=i+r*6777216+s*6710656,c=r+s*8147497,h=s*2;const d=1e7;return l>=d&&(c+=Math.floor(l/d),l%=d),c>=d&&(h+=Math.floor(c/d),c%=d),h.toString()+RM(c)+RM(l)}function uie(e,t){return{lo:e>>>0,hi:t>>>0}}function pC(e,t){return{lo:e|0,hi:t|0}}function vU(e,t){return t=~t,e?e=~e+1:t+=1,pC(e,t)}const RM=e=>{const t=String(e);return"0000000".slice(t.length)+t};function OM(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e=e>>7;t.push(1)}}function die(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let n=5;(e&128)!==0&&n<10;n++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}function hie(){const e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof process!="object"||typeof PM!="object"||PM.BUF_BIGINT_DISABLE!=="1")){const r=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),l=BigInt("0"),c=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(h){const d=typeof h=="bigint"?h:BigInt(h);if(d>s||d<r)throw new Error("int64 invalid: ".concat(h));return d},uParse(h){const d=typeof h=="bigint"?h:BigInt(h);if(d>c||d<l)throw new Error("uint64 invalid: ".concat(h));return d},enc(h){return e.setBigInt64(0,this.parse(h),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(h){return e.setBigInt64(0,this.uParse(h),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(h,d){return e.setInt32(0,h,!0),e.setInt32(4,d,!0),e.getBigInt64(0,!0)},uDec(h,d){return e.setInt32(0,h,!0),e.setInt32(4,d,!0),e.getBigUint64(0,!0)}}}const n=r=>Xn(/^-?[0-9]+$/.test(r),"int64 invalid: ".concat(r)),i=r=>Xn(/^[0-9]+$/.test(r),"uint64 invalid: ".concat(r));return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),n(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),i(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),n(r),MM(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),i(r),MM(r)},dec(r,s){return cie(r,s)},uDec(r,s){return gU(r,s)}}}const Un=hie();var Ae;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(Ae||(Ae={}));var fc;(function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"})(fc||(fc={}));function Ll(e,t,n){if(t===n)return!0;if(e==Ae.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}switch(e){case Ae.UINT64:case Ae.FIXED64:case Ae.INT64:case Ae.SFIXED64:case Ae.SINT64:return t==n}return!1}function mh(e,t){switch(e){case Ae.BOOL:return!1;case Ae.UINT64:case Ae.FIXED64:case Ae.INT64:case Ae.SFIXED64:case Ae.SINT64:return t==0?Un.zero:"0";case Ae.DOUBLE:case Ae.FLOAT:return 0;case Ae.BYTES:return new Uint8Array(0);case Ae.STRING:return"";default:return 0}}function xU(e,t){switch(e){case Ae.BOOL:return t===!1;case Ae.STRING:return t==="";case Ae.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}function IM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function fie(e){if(Array.isArray(e))return e}function At(e,t,n){return(t=vie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;h=!1}else for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function pie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
626In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tt(e,t){return fie(e)||mie(e,t)||xie(e,t)||pie()}function gie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vie(e){var t=gie(e,"string");return typeof t=="symbol"?t:t+""}function xie(e,t){if(e){if(typeof e=="string")return IM(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?IM(e,t):void 0}}var ri;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(ri||(ri={}));class yie{constructor(t){this.stack=[],this.textEncoder=t??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let t=0;for(let r=0;r<this.chunks.length;r++)t+=this.chunks[r].length;let n=new Uint8Array(t),i=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],i),i+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,n){return this.uint32((t<<3|n)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(rN(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return W0(t),OM(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let n=this.textEncoder.encode(t);return this.uint32(n.byteLength),this.raw(n)}float(t){dU(t);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,t,!0),this.raw(n)}double(t){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,t,!0),this.raw(n)}fixed32(t){rN(t);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t,!0),this.raw(n)}sfixed32(t){W0(t);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,t,!0),this.raw(n)}sint32(t){return W0(t),t=(t<<1^t>>31)>>>0,OM(t,this.buf),this}sfixed64(t){let n=new Uint8Array(8),i=new DataView(n.buffer),r=Un.enc(t);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}fixed64(t){let n=new Uint8Array(8),i=new DataView(n.buffer),r=Un.uEnc(t);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}int64(t){let n=Un.enc(t);return uS(n.lo,n.hi,this.buf),this}sint64(t){let n=Un.enc(t),i=n.hi>>31,r=n.lo<<1^i,s=(n.hi<<1|n.lo>>>31)^i;return uS(r,s,this.buf),this}uint64(t){let n=Un.uEnc(t);return uS(n.lo,n.hi,this.buf),this}}class bie{constructor(t,n){this.varint64=lie,this.uint32=die,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.textDecoder=n??new TextDecoder}tag(){let t=this.uint32(),n=t>>>3,i=t&7;if(n<=0||i<0||i>5)throw new Error("illegal tag: field no "+n+" wire type "+i);return[n,i]}skip(t,n){let i=this.pos;switch(t){case ri.Varint:for(;this.buf[this.pos++]&128;);break;case ri.Bit64:this.pos+=4;case ri.Bit32:this.pos+=4;break;case ri.LengthDelimited:let r=this.uint32();this.pos+=r;break;case ri.StartGroup:for(;;){const s=this.tag(),l=tt(s,2),c=l[0],h=l[1];if(h===ri.EndGroup){if(n!==void 0&&c!==n)throw new Error("invalid end group tag");break}this.skip(h,c)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Un.dec(...this.varint64())}uint64(){return Un.uDec(...this.varint64())}sint64(){let t=this.varint64(),n=tt(t,2),i=n[0],r=n[1],s=-(i&1);return i=(i>>>1|(r&1)<<31)^s,r=r>>>1^s,Un.dec(i,r)}bool(){let t=this.varint64(),n=tt(t,2),i=n[0],r=n[1];return i!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Un.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Un.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),n=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(n,n+t)}string(){return this.textDecoder.decode(this.bytes())}}function wie(e,t,n,i){let r;return{typeName:t,extendee:n,get field(){if(!r){const s=typeof i=="function"?i():i;s.name=t.split(".").pop(),s.jsonName="[".concat(t,"]"),r=e.util.newFieldList([s]).list()[0]}return r},runtime:e}}function yU(e){const t=e.field.localName,n=Object.create(null);return n[t]=Sie(e),[n,()=>n[t]]}function Sie(e){const t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return mh(t.T,t.L);case"message":const n=t.T,i=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}function kie(e,t){if(!t.repeated&&(t.kind=="enum"||t.kind=="scalar")){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(n=>n.no===t.no)}let Bo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
626+/".split(""),dy=[];for(let e=0;e<Bo.length;e++)dy[Bo[e].charCodeAt(0)]=e;dy[45]=Bo.indexOf("+");dy[95]=Bo.indexOf("/");const bU={dec(e){let t=e.length*3/4;e[e.length-2]=="="?t-=2:e[e.length-1]=="="&&(t-=1);let n=new Uint8Array(t),i=0,r=0,s,l=0;for(let c=0;c<e.length;c++){if(s=dy[e.charCodeAt(c)],s===void 0)switch(e[c]){case"=":r=0;case`
627`:case"\r":case"	":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:l=s,r=1;break;case 1:n[i++]=l<<2|(s&48)>>4,l=s,r=2;break;case 2:n[i++]=(l&15)<<4|(s&60)>>2,l=s,r=3;break;case 3:n[i++]=(l&3)<<6|s,r=0;break}}if(r==1)throw Error("invalid base64 string.");return n.subarray(0,i)},enc(e){let t="",n=0,i,r=0;for(let s=0;s<e.length;s++)switch(i=e[s],n){case 0:t+=Bo[i>>2],r=(i&3)<<4,n=1;break;case 1:t+=Bo[r|i>>4],r=(i&15)<<2,n=2;break;case 2:t+=Bo[r|i>>6],t+=Bo[i&63],n=0;break}return n&&(t+=Bo[r],t+="=",n==1&&(t+="=")),t}};function Nie(e,t,n){SU(t,e);const i=t.runtime.bin.makeReadOptions(n),r=kie(e.getType().runtime.bin.listUnknownFields(e),t.field),s=yU(t),l=tt(s,2),c=l[0],h=l[1];for(const d of r)t.runtime.bin.readField(c,i.readerFactory(d.data),t.field,d.wireType,i);return h()}function jie(e,t,n,i){SU(t,e);const r=t.runtime.bin.makeReadOptions(i),s=t.runtime.bin.makeWriteOptions(i);if(wU(e,t)){const d=e.getType().runtime.bin.listUnknownFields(e).filter(f=>f.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(const f of d)e.getType().runtime.bin.onUnknownField(e,f.no,f.wireType,f.data)}const l=s.writerFactory();let c=t.field;!c.opt&&!c.repeated&&(c.kind=="enum"||c.kind=="scalar")&&(c=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(c,n,l,s);const h=r.readerFactory(l.finish());for(;h.pos<h.len;){const d=h.tag(),f=tt(d,2),p=f[0],v=f[1],x=h.skip(v,p);e.getType().runtime.bin.onUnknownField(e,p,v,x)}}function wU(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(i=>i.no==t.field.no)}function SU(e,t){Xn(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName))}function kU(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?t[n]!==void 0:e.kind=="enum"?t[n]!==e.T.values[0].no:!xU(e.T,t[n]);case"message":return t[n]!==void 0;case"map":return Object.keys(t[n]).length>0}}function DM(e,t){const n=e.localName,i=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=i?e.T.values[0].no:void 0;break;case"scalar":t[n]=i?mh(e.T,e.L):void 0;break;case"message":t[n]=void 0;break}}function Fo(e,t){if(e===null||typeof e!="object"||!Object.getOwnPropertyNames(mC.prototype).every(i=>i in e&&typeof e[i]=="function"))return!1;const n=e.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:t===void 0?!0:n.typeName==t.typeName}function NU(e,t){return Fo(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}Ae.DOUBLE,Ae.FLOAT,Ae.INT64,Ae.UINT64,Ae.INT32,Ae.UINT32,Ae.BOOL,Ae.STRING,Ae.BYTES;const LM={ignoreUnknownFields:!1},UM={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Cie(e){return e?Object.assign(Object.assign({},LM),e):LM}function Tie(e){return e?Object.assign(Object.assign({},UM),e):UM}const Ov=Symbol(),K0=Symbol();function Eie(){return{makeReadOptions:Cie,makeWriteOptions:Tie,readMessage(e,t,n,i){if(t==null||Array.isArray(t)||typeof t!="object")throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat(qa(t)));i=i??new e;const r=new Map,s=n.typeRegistry;for(const c of Object.entries(t)){var l=tt(c,2);const h=l[0],d=l[1],f=e.fields.findJsonName(h);if(f){if(f.oneof){if(d===null&&f.kind=="scalar")continue;const p=r.get(f.oneof);if(p!==void 0)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(f.oneof.name,'" present: "').concat(p,'", "').concat(h,'"'));r.set(f.oneof,h)}BM(i,d,f,n,e)}else{let p=!1;if(s!=null&&s.findExtension&&h.startsWith("[")&&h.endsWith("]")){const v=s.findExtension(h.substring(1,h.length-1));if(v&&v.extendee.typeName==e.typeName){p=!0;const x=yU(v),b=tt(x,2),S=b[0],N=b[1];BM(S,d,v.field,n,v),jie(i,v,N(),n)}}if(!p&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(h,'" is unknown'))}}return i},writeMessage(e,t){const n=e.getType(),i={};let r;try{for(r of n.fields.byNumber()){if(!kU(r,e)){if(r.req)throw"required field not set";if(!t.emitDefaultValues||!Pie(r))continue}const l=r.oneof?e[r.oneof.localName].value:e[r.localName],c=FM(r,l,t);c!==void 0&&(i[t.useProtoFieldName?r.name:r.jsonName]=c)}const s=t.typeRegistry;if(s!=null&&s.findExtensionFor)for(const l of n.runtime.bin.listUnknownFields(e)){const c=s.findExtensionFor(n.typeName,l.no);if(c&&wU(e,c)){const h=Nie(e,c,t),d=FM(c.field,h,t);d!==void 0&&(i[c.field.jsonName]=d)}}}catch(s){const l=r?"cannot encode field ".concat(n.typeName,".").concat(r.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),c=s instanceof Error?s.message:String(s);throw new Error(l+(c.length>0?": ".concat(c):""))}return i}
vendor: 34,926 bytes, line 627
627,readScalar(e,t,n){return km(e,t,n??fc.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||xU(e,t)))return G0(e,t)},debug:qa}}function qa(e){if(e===null)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":'"'.concat(e.split('"').join('\\"'),'"');default:return String(e)}}function BM(e,t,n,i,r){let s=n.localName;if(n.repeated){if(Xn(n.kind!="map"),t===null)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(t)));const c=e[s];for(const h of t){if(h===null)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(h)));switch(n.kind){case"message":c.push(n.T.fromJson(h,i));break;case"enum":const d=dS(n.T,h,i.ignoreUnknownFields,!0);d!==K0&&c.push(d);break;case"scalar":try{c.push(km(n.T,h,n.L,!0))}catch(f){let p="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(h));throw f instanceof Error&&f.message.length>0&&(p+=": ".concat(f.message)),new Error(p)}break}}}else if(n.kind=="map"){if(t===null)return;if(typeof t!="object"||Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(t)));const c=e[s];for(const h of Object.entries(t)){var l=tt(h,2);const d=l[0],f=l[1];if(f===null)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: map value null"));let p;try{p=Aie(n.K,d)}catch(v){let x="cannot decode map key for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(t));throw v instanceof Error&&v.message.length>0&&(x+=": ".concat(v.message)),new Error(x)}switch(n.V.kind){case"message":c[p]=n.V.T.fromJson(f,i);break;case"enum":const v=dS(n.V.T,f,i.ignoreUnknownFields,!0);v!==K0&&(c[p]=v);break;case"scalar":try{c[p]=km(n.V.T,f,fc.BIGINT,!0)}catch(x){let b="cannot decode map value for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(t));throw x instanceof Error&&x.message.length>0&&(b+=": ".concat(x.message)),new Error(b)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const c=n.T;if(t===null&&c.typeName!="google.protobuf.Value")return;let h=e[s];Fo(h)?h.fromJson(t,i):(e[s]=h=c.fromJson(t,i),c.fieldWrapper&&!n.oneof&&(e[s]=c.fieldWrapper.unwrapField(h)));break;case"enum":const d=dS(n.T,t,i.ignoreUnknownFields,!1);switch(d){case Ov:DM(n,e);break;case K0:break;default:e[s]=d;break}break;case"scalar":try{const f=km(n.T,t,n.L,!1);switch(f){case Ov:DM(n,e);break;default:e[s]=f;break}}catch(f){let p="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(qa(t));throw f instanceof Error&&f.message.length>0&&(p+=": ".concat(f.message)),new Error(p)}break}}function Aie(e,t){if(e===Ae.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;break}return km(e,t,fc.BIGINT,!0).toString()}function km(e,t,n,i){if(t===null)return i?mh(e,n):Ov;switch(e){case Ae.DOUBLE:case Ae.FLOAT:if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""||typeof t=="string"&&t.trim().length!==t.length||typeof t!="string"&&typeof t!="number")break;const r=Number(t);if(Number.isNaN(r)||!Number.isFinite(r))break;return e==Ae.FLOAT&&dU(r),r;case Ae.INT32:case Ae.FIXED32:case Ae.SFIXED32:case Ae.SINT32:case Ae.UINT32:let s;if(typeof t=="number"?s=t:typeof t=="string"&&t.length>0&&t.trim().length===t.length&&(s=Number(t)),s===void 0)break;return e==Ae.UINT32||e==Ae.FIXED32?rN(s):W0(s),s;case Ae.INT64:case Ae.SFIXED64:case Ae.SINT64:if(typeof t!="number"&&typeof t!="string")break;const l=Un.parse(t);return n?l.toString():l;case Ae.FIXED64:case Ae.UINT64:if(typeof t!="number"&&typeof t!="string")break;const c=Un.uParse(t);return n?c.toString():c;case Ae.BOOL:if(typeof t!="boolean")break;return t;case Ae.STRING:if(typeof t!="string")break;try{encodeURIComponent(t)}catch{throw new Error("invalid UTF8")}return t;case Ae.BYTES:if(t==="")return new Uint8Array(0);if(typeof t!="string")break;return bU.dec(t)}throw new Error}function dS(e,t,n,i){if(t===null)return e.typeName=="google.protobuf.NullValue"?0:i?e.values[0].no:Ov;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const r=e.findName(t);if(r!==void 0)return r.no;if(n)return K0;break}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat(qa(t)))}function Pie(e){return e.repeated||e.kind=="map"?!0:!(e.oneof||e.kind=="message"||e.opt||e.req)}function FM(e,t,n){if(e.kind=="map"){Xn(typeof t=="object"&&t!=null);const l={},c=Object.entries(t);switch(e.V.kind){case"scalar":for(const d of c){var i=tt(d,2);const f=i[0],p=i[1];l[f.toString()]=G0(e.V.T,p)}break;case"message":for(const d of c){var r=tt(d,2);const f=r[0],p=r[1];l[f.toString()]=p.toJson(n)}break;case"enum":const h=e.V.T;for(const d of c){var s=tt(d,2);const f=s[0],p=s[1];l[f.toString()]=hS(h,p,n.enumAsInteger)}break}return n.emitDefaultValues||c.length>0?l:void 0}if(e.repeated){Xn(Array.isArray(t));const l=[];switch(e.kind){case"scalar":for(let c=0;c<t.length;c++)l.push(G0(e.T,t[c]));break;case"enum":for(let c=0;c<t.length;c++)l.push(hS(e.T,t[c],n.enumAsInteger));break;case"message":for(let c=0;c<t.length;c++)l.push(t[c].toJson(n));break}return n.emitDefaultValues||l.length>0?l:void 0}switch(e.kind){case"scalar":return G0(e.T,t);case"enum":return hS(e.T,t,n.enumAsInteger);case"message":return NU(e.T,t).toJson(n)}}function hS(e,t,n){var i;if(Xn(typeof t=="number"),e.typeName=="google.protobuf.NullValue")return null;if(n)return t;const r=e.findNumber(t);return(i=r==null?void 0:r.name)!==null&&i!==void 0?i:t}function G0(e,t){switch(e){case Ae.INT32:case Ae.SFIXED32:case Ae.SINT32:case Ae.FIXED32:case Ae.UINT32:return Xn(typeof t=="number"),t;case Ae.FLOAT:case Ae.DOUBLE:return Xn(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case Ae.STRING:return Xn(typeof t=="string"),t;case Ae.BOOL:return Xn(typeof t=="boolean"),t;case Ae.UINT64:case Ae.FIXED64:case Ae.INT64:case Ae.SFIXED64:case Ae.SINT64:return Xn(typeof t=="bigint"||typeof t=="string"||typeof t=="number"),t.toString();case Ae.BYTES:return Xn(t instanceof Uint8Array),bU.enc(t)}}const Cd=Symbol("@bufbuild/protobuf/unknown-fields"),$M={readUnknownFields:!0,readerFactory:e=>new bie(e)},VM={writeUnknownFields:!0,writerFactory:()=>new yie};function _ie(e){return e?Object.assign(Object.assign({},$M),e):$M}function Mie(e){return e?Object.assign(Object.assign({},VM),e):VM}function Rie(){return{makeReadOptions:_ie,makeWriteOptions:Mie,listUnknownFields(e){var t;return(t=e[Cd])!==null&&t!==void 0?t:[]},discardUnknownFields(e){delete e[Cd]},writeUnknownFields(e,t){const i=e[Cd];if(i)for(const r of i)t.tag(r.no,r.wireType).raw(r.data)},onUnknownField(e,t,n,i){const r=e;Array.isArray(r[Cd])||(r[Cd]=[]),r[Cd].push({no:t,wireType:n,data:i})},readMessage(e,t,n,i,r){const s=e.getType(),l=r?t.len:t.pos+n;let c,h;for(;t.pos<l;){var d=t.tag(),f=tt(d,2);if(c=f[0],h=f[1],r===!0&&h==ri.EndGroup)break;const p=s.fields.find(c);if(!p){const v=t.skip(h,c);i.readUnknownFields&&this.onUnknownField(e,c,h,v);continue}zM(e,t,p,h,i)}if(r&&(h!=ri.EndGroup||c!==n))throw new Error("invalid end group tag")},readField:zM,writeMessage(e,t,n){const i=e.getType();for(const r of i.fields.byNumber()){if(!kU(r,e)){if(r.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(r.name," to binary: required field not set"));continue}const s=r.oneof?e[r.oneof.localName].value:e[r.localName];qM(r,s,t,n)}return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,i){t!==void 0&&qM(e,t,n,i)}}}function zM(e,t,n,i,r){let s=n.repeated,l=n.localName;switch(n.oneof&&(e=e[n.oneof.localName],e.case!=l&&delete e.value,e.case=l,l="value"),n.kind){case"scalar":case"enum":const c=n.kind=="enum"?Ae.INT32:n.T;let h=Iv;if(n.kind=="scalar"&&n.L>0&&(h=Iie),s){let b=e[l];if(i==ri.LengthDelimited&&c!=Ae.STRING&&c!=Ae.BYTES){let N=t.uint32()+t.pos;for(;t.pos<N;)b.push(h(t,c))}else b.push(h(t,c))}else e[l]=h(t,c);break;case"message":const d=n.T;s?e[l].push(Y0(t,new d,r,n)):Fo(e[l])?Y0(t,e[l],r,n):(e[l]=Y0(t,new d,r,n),d.fieldWrapper&&!n.oneof&&!n.repeated&&(e[l]=d.fieldWrapper.unwrapField(e[l])));break;case"map":let f=Oie(n,t,r),p=tt(f,2),v=p[0],x=p[1];e[l][v]=x;break}}function Y0(e,t,n,i){const r=t.getType().runtime.bin,s=i==null?void 0:i.delimited;return r.readMessage(t,e,s?i.no:e.uint32(),n,s),t}function Oie(e,t,n){const i=t.uint32(),r=t.pos+i;let s,l;for(;t.pos<r;){const c=t.tag();switch(tt(c,1)[0]){case 1:s=Iv(t,e.K);break;case 2:switch(e.V.kind){case"scalar":l=Iv(t,e.V.T);break;case"enum":l=t.int32();break;case"message":l=Y0(t,new e.V.T,n,void 0);break}break}}if(s===void 0&&(s=mh(e.K,fc.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),l===void 0)switch(e.V.kind){case"scalar":l=mh(e.V.T,fc.BIGINT);break;case"enum":l=e.V.T.values[0].no;break;case"message":l=new e.V.T;break}return[s,l]}function Iie(e,t){const n=Iv(e,t);return typeof n=="bigint"?n.toString():n}function Iv(e,t){switch(t){case Ae.STRING:return e.string();case Ae.BOOL:return e.bool();case Ae.DOUBLE:return e.double();case Ae.FLOAT:return e.float();case Ae.INT32:return e.int32();case Ae.INT64:return e.int64();case Ae.UINT64:return e.uint64();case Ae.FIXED64:return e.fixed64();case Ae.BYTES:return e.bytes();case Ae.FIXED32:return e.fixed32();case Ae.SFIXED32:return e.sfixed32();case Ae.SFIXED64:return e.sfixed64();case Ae.SINT64:return e.sint64();case Ae.UINT32:return e.uint32();case Ae.SINT32:return e.sint32()}}function qM(e,t,n,i){Xn(t!==void 0);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let l=e.kind=="enum"?Ae.INT32:e.T;if(r)if(Xn(Array.isArray(t)),e.packed)Lie(n,l,e.no,t);else for(const c of t)Nm(n,l,e.no,c);else Nm(n,l,e.no,t);break;case"message":if(r){Xn(Array.isArray(t));for(const c of t)WM(n,i,e,c)}else WM(n,i,e,t);break;case"map":Xn(typeof t=="object"&&t!=null);for(const c of Object.entries(t)){var s=tt(c,2);const h=s[0],d=s[1];Die(n,i,e,h,d)}break}}function Die(e,t,n,i,r){e.tag(n.no,ri.LengthDelimited),e.fork();let s=i;switch(n.K){case Ae.INT32:case Ae.FIXED32:case Ae.UINT32:case Ae.SFIXED32:case Ae.SINT32:s=Number.parseInt(i);break;case Ae.BOOL:Xn(i=="true"||i=="false"),s=i=="true";break}switch(Nm(e,n.K,1,s),n.V.kind){case"scalar":Nm(e,n.V.T,2,r);break;case"enum":Nm(e,Ae.INT32,2,r);break;case"message":Xn(r!==void 0),e.tag(2,ri.LengthDelimited).bytes(r.toBinary(t));break}e.join()}function WM(e,t,n,i){const r=NU(n.T,i);n.delimited?e.tag(n.no,ri.StartGroup).raw(r.toBinary(t)).tag(n.no,ri.EndGroup):e.tag(n.no,ri.LengthDelimited).bytes(r.toBinary(t))}function Nm(e,t,n,i){Xn(i!==void 0);let r=jU(t),s=tt(r,2),l=s[0],c=s[1];e.tag(n,l)[c](i)}function Lie(e,t,n,i){if(!i.length)return;e.tag(n,ri.LengthDelimited).fork();let r=jU(t),s=tt(r,2),l=s[1];for(let c=0;c<i.length;c++)e[l](i[c]);e.join()}function jU(e){let t=ri.Varint;switch(e){case Ae.BYTES:case Ae.STRING:t=ri.LengthDelimited;break;case Ae.DOUBLE:case Ae.FIXED64:case Ae.SFIXED64:t=ri.Bit64;break;case Ae.FIXED32:case Ae.SFIXED32:case Ae.FLOAT:t=ri.Bit32;break}const n=Ae[e].toLowerCase();return[t,n]}function Uie(){return{setEnumType:fU,initPartial(e,t){if(e===void 0)return;const n=t.getType();for(const r of n.fields.byMember()){const s=r.localName,l=t,c=e;if(c[s]!=null)switch(r.kind){case"oneof":const h=c[s].case;if(h===void 0)continue;const d=r.findField(h);let f=c[s].value;d&&d.kind=="message"&&!Fo(f,d.T)?f=new d.T(f):d&&d.kind==="scalar"&&d.T===Ae.BYTES&&(f=Ff(f)),l[s]={case:h,value:f};break;case"scalar":case"enum":let p=c[s];r.T===Ae.BYTES&&(p=r.repeated?p.map(Ff):Ff(p)),l[s]=p;break;case"map":switch(r.V.kind){case"scalar":case"enum":if(r.V.T===Ae.BYTES)for(const b of Object.entries(c[s])){var i=tt(b,2);const S=i[0],N=i[1];l[s][S]=Ff(N)}else Object.assign(l[s],c[s]);break;case"message":const x=r.V.T;for(const b of Object.keys(c[s])){let S=c[s][b];x.fieldWrapper||(S=new x(S)),l[s][b]=S}break}break;case"message":const v=r.T;if(r.repeated)l[s]=c[s].map(x=>Fo(x,v)?x:new v(x));else{const x=c[s];v.fieldWrapper?v.typeName==="google.protobuf.BytesValue"?l[s]=Ff(x):l[s]=x:l[s]=Fo(x,v)?x:new v(x)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(i=>{const r=t[i.localName],s=n[i.localName];if(i.repeated){if(r.length!==s.length)return!1;switch(i.kind){case"message":return r.every((l,c)=>i.T.equals(l,s[c]));case"scalar":return r.every((l,c)=>Ll(i.T,l,s[c]));case"enum":return r.every((l,c)=>Ll(Ae.INT32,l,s[c]))}throw new Error("repeated cannot contain ".concat(i.kind))}switch(i.kind){case"message":let l=r,c=s;return i.T.fieldWrapper&&(l!==void 0&&!Fo(l)&&(l=i.T.fieldWrapper.wrapField(l)),c!==void 0&&!Fo(c)&&(c=i.T.fieldWrapper.wrapField(c))),i.T.equals(l,c);case"enum":return Ll(Ae.INT32,r,s);case"scalar":return Ll(i.T,r,s);case"oneof":if(r.case!==s.case)return!1;const h=i.findField(r.case);if(h===void 0)return!0;switch(h.kind){case"message":return h.T.equals(r.value,s.value);case"enum":return Ll(Ae.INT32,r.value,s.value);case"scalar":return Ll(h.T,r.value,s.value)}throw new Error("oneof cannot contain ".concat(h.kind));case"map":const d=Object.keys(r).concat(Object.keys(s));switch(i.V.kind){case"message":const f=i.V.T;return d.every(v=>f.equals(r[v],s[v]));case"enum":return d.every(v=>Ll(Ae.INT32,r[v],s[v]));case"scalar":const p=i.V.T;return d.every(v=>Ll(p,r[v],s[v]))}break}})},clone(e){const t=e.getType(),n=new t,i=n;for(const s of t.fields.byMember()){const l=e[s.localName];let c;if(s.repeated)c=l.map(u0);else if(s.kind=="map"){c=i[s.localName];for(const h of Object.entries(l)){var r=tt(h,2);const d=r[0],f=r[1];c[d]=u0(f)}}else s.kind=="oneof"?c=s.findField(l.case)?{case:l.case,value:u0(l.value)}:{case:void 0}:c=u0(l);i[s.localName]=c}for(const s of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(i,s.no,s.wireType,s.data);return n}}}function u0(e){if(e===void 0)return e;if(Fo(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Ff(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Bie(e,t,n){return{syntax:e,json:Eie(),bin:Rie(),util:Object.assign(Object.assign({},Uie()),{newFieldList:t,initFields:n}),makeMessageType(i,r,s){return oie(this,i,r,s)},makeEnum:aie,makeEnumType:mU,getEnumType:sie,makeExtension(i,r,s){return wie(this,i,r,s)}}}class Fie{constructor(t,n){this._fields=t,this._normalizer=n}findJsonName(t){if(!this.jsonNames){const n={};for(const i of this.list())n[i.jsonName]=n[i.name]=i;this.jsonNames=n}return this.jsonNames[t]}find(t){if(!this.numbers){const n={};for(const i of this.list())n[i.no]=i;this.numbers=n}return this.numbers[t]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((t,n)=>t.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const t=this.members;let n;for(const i of this.list())i.oneof?i.oneof!==n&&(n=i.oneof,t.push(n)):t.push(i)}return this.members}}function CU(e,t){const n=TU(e);return t?n:Hie(Wie(n))}function $ie(e){return CU(e,!1)}const Vie=TU;function TU(e){let t=!1;const n=[];for(let i=0;i<e.length;i++){let r=e.charAt(i);switch(r){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),t=!1;break;default:t&&(t=!1,r=r.toUpperCase()),n.push(r);break}}return n.join("")}const zie=new Set(["constructor","toString","toJSON","valueOf"]),qie=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),EU=e=>"".concat(e,"$"),Wie=e=>qie.has(e)?EU(e):e,Hie=e=>zie.has(e)?EU(e):e;class Kie{constructor(t){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=t,this.localName=$ie(t)}addField(t){Xn(t.oneof===this,"field ".concat(t.name," not one of ").concat(this.name)),this.fields.push(t)}findField(t){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[t]}}function Gie(e,t){var n,i,r,s,l,c;const h=[];let d;for(const f of typeof e=="function"?e():e){const p=f;if(p.localName=CU(f.name,f.oneof!==void 0),p.jsonName=(n=f.jsonName)!==null&&n!==void 0?n:Vie(f.name),p.repeated=(i=f.repeated)!==null&&i!==void 0?i:!1,f.kind=="scalar"&&(p.L=(r=f.L)!==null&&r!==void 0?r:fc.BIGINT),p.delimited=(s=f.delimited)!==null&&s!==void 0?s:!1,p.req=(l=f.req)!==null&&l!==void 0?l:!1,p.opt=(c=f.opt)!==null&&c!==void 0?c:!1,f.packed===void 0&&(p.packed=f.kind=="enum"||f.kind=="scalar"&&f.T!=Ae.BYTES&&f.T!=Ae.STRING),f.oneof!==void 0){const v=typeof f.oneof=="string"?f.oneof:f.oneof.name;(!d||d.name!=v)&&(d=new Kie(v)),p.oneof=d,d.addField(p)}h.push(p)}return h}const oe=Bie("proto3",e=>new Fie(e,t=>Gie(t)),e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,i=e;if(t.repeated){i[n]=[];continue}switch(t.kind){case"oneof":i[n]={case:void 0};break;case"enum":i[n]=0;break;case"map":i[n]={};break;case"scalar":i[n]=mh(t.T,t.L);break}}});class Qr extends mC{constructor(t){super(),this.seconds=Un.zero,this.nanos=0,oe.util.initPartial(t,this)}fromJson(t,n){if(typeof t!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(oe.json.debug(t)));const i=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const r=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(r))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=Un.parse(r/1e3),this.nanos=0,i[7]&&(this.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),this}toJson(t){const n=Number(this.seconds)*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let i="Z";if(this.nanos>0){const r=(this.nanos+1e9).toString().substring(1);r.substring(3)==="000000"?i="."+r.substring(0,3)+"Z":r.substring(6)==="000"?i="."+r.substring(0,6)+"Z":i="."+r+"Z"}return new Date(n).toISOString().replace(".000Z",i)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return Qr.fromDate(new Date)}static fromDate(t){const n=t.getTime();return new Qr({seconds:Un.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(t,n){return new Qr().fromBinary(t,n)}static fromJson(t,n){return new Qr().fromJson(t,n)}static fromJsonString(t,n){return new Qr().fromJsonString(t,n)}static equals(t,n){return oe.util.equals(Qr,t,n)}}Qr.runtime=oe;Qr.typeName="google.protobuf.Timestamp";Qr.fields=oe.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Yie=oe.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Qr},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:Qie,repeated:!0},{no:5,name:"events",kind:"message",T:Jie,repeated:!0}]),Qie=oe.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:Xie,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Xie=oe.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Qr},{no:3,name:"value",kind:"scalar",T:2}]),Jie=oe.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:Qr},{no:7,name:"normalized_end_timestamp",kind:"message",T:Qr,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),AU=oe.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),la=oe.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),vi=oe.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),gC=oe.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),cm=oe.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),zm=oe.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),ya=oe.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"},{no:16,name:"AGENT_ERROR"}]),Kc=oe.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),Zie=oe.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Di=oe.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),ph=oe.makeEnum("livekit.PacketTrailerFeature",[{no:0,name:"PTF_USER_TIMESTAMP"},{no:1,name:"PTF_FRAME_ID"}]),hy=oe.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:Dv,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:zU}]),Dv=oe.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),ere=oe.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:oe.getEnumType(vi),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8},{no:13,name:"can_manage_agent_session",kind:"scalar",T:8}]),Tu=oe.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:oe.getEnumType(Zd)},{no:4,name:"tracks",kind:"message",T:Hd,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:ere},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:oe.getEnumType(qm)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:oe.getEnumType(ya)},{no:18,name:"kind_details",kind:"enum",T:oe.getEnumType(tre),repeated:!0},{no:19,name:"data_tracks",kind:"message",T:fy,repeated:!0},{no:20,name:"client_protocol",kind:"scalar",T:5}]),Zd=oe.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),qm=oe.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"},{no:7,name:"CONNECTOR"},{no:8,name:"BRIDGE"}]),tre=oe.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"},{no:2,name:"CONNECTOR_WHATSAPP"},{no:3,name:"CONNECTOR_TWILIO"},{no:4,name:"BRIDGE_RTSP"}]),xn=oe.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),nre=oe.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:rc,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:oe.getEnumType(PU)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Hd=oe.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:oe.getEnumType(la)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:oe.getEnumType(vi)},{no:10,name:"layers",kind:"message",T:rc,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:nre,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:oe.getEnumType(xn)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:zU},{no:19,name:"audio_features",kind:"enum",T:oe.getEnumType(Di),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:oe.getEnumType(AU)},{no:21,name:"packet_trailer_features",kind:"enum",T:oe.getEnumType(ph),repeated:!0}]),fy=oe.makeMessageType("livekit.DataTrackInfo",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"sid",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"encryption",kind:"enum",T:oe.getEnumType(xn)}]),ire=oe.makeMessageType("livekit.DataTrackSubscriptionOptions",()=>[{no:1,name:"target_fps",kind:"scalar",T:13,opt:!0}]),rc=oe.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:oe.getEnumType(gC)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9},{no:8,name:"repair_ssrc",kind:"scalar",T:13}]),PU=oe.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),xr=oe.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:oe.getEnumType(sc)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:vC,oneof:"value"},{no:3,name:"speaker",kind:"message",T:rre,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:OU,oneof:"value"},{no:7,name:"transcription",kind:"message",T:sre,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Yie,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:Lv,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:xC,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:my,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:yC,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Uv,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Bv,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Fv,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:_U,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),sc=oe.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),_U=oe.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:oe.getEnumType(xn)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),MU=oe.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:vC,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:Lv,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:xC,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:my,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:yC,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:Uv,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:Bv,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:Fv,oneof:"value"}]),rre=oe.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:RU,repeated:!0}]),RU=oe.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),vC=oe.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),OU=oe.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),sre=oe.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:are,repeated:!0}]),are=oe.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),Lv=oe.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),xC=oe.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13},{no:6,name:"compressed_payload",kind:"scalar",T:12}]),my=oe.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),yC=oe.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:IU,oneof:"value"},{no:4,name:"compressed_payload",kind:"scalar",T:12,oneof:"value"}]),IU=oe.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),DU=oe.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),LU=oe.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:oe.getEnumType(UU)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),UU=oe.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),BU=oe.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:oe.getEnumType(FU)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9},{no:12,name:"client_protocol",kind:"scalar",T:5},{no:13,name:"capabilities",kind:"enum",T:oe.getEnumType($U),repeated:!0}]),FU=oe.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"},{no:14,name:"ESP32"}]),$U=oe.makeEnum("livekit.ClientInfo.Capability",[{no:0,name:"CAP_UNUSED"},{no:1,name:"CAP_PACKET_TRAILER"}]),VU=oe.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:HM},{no:2,name:"screen",kind:"message",T:HM},{no:3,name:"resume_connection",kind:"enum",T:oe.getEnumType(zm)},{no:4,name:"disabled_codecs",kind:"message",T:ore},{no:5,name:"force_relay",kind:"enum",T:oe.getEnumType(zm)}]),HM=oe.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:oe.getEnumType(zm)}]),ore=oe.makeMessageType("livekit.Di
627sabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:Dv,repeated:!0},{no:2,name:"publish",kind:"message",T:Dv,repeated:!0}]),zU=oe.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),sN=oe.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),qU=oe.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:oe.getEnumType(sN)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),WU=oe.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),Uv=oe.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:oe.getEnumType(xn)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:qU,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:WU,oneof:"content_header"}],{localName:"DataStream_Header"}),Bv=oe.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Fv=oe.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),lre=oe.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),ca=oe.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),aN=oe.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),cre=oe.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),ure=oe.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:mc,oneof:"message"},{no:2,name:"answer",kind:"message",T:mc,oneof:"message"},{no:3,name:"trickle",kind:"message",T:py,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Wm,oneof:"message"},{no:5,name:"mute",kind:"message",T:gy,oneof:"message"},{no:6,name:"subscription",kind:"message",T:vy,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:GU,oneof:"message"},{no:8,name:"leave",kind:"message",T:xy,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:QU,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:ZU,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:TC,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Va,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:jC,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:nB,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:NC,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:YU,oneof:"message"},{no:19,name:"publish_data_track_request",kind:"message",T:bC,oneof:"message"},{no:20,name:"unpublish_data_track_request",kind:"message",T:SC,oneof:"message"},{no:21,name:"update_data_subscription",kind:"message",T:HU,oneof:"message"}]),KM=oe.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:mre,oneof:"message"},{no:2,name:"answer",kind:"message",T:mc,oneof:"message"},{no:3,name:"offer",kind:"message",T:mc,oneof:"message"},{no:4,name:"trickle",kind:"message",T:py,oneof:"message"},{no:5,name:"update",kind:"message",T:vre,oneof:"message"},{no:6,name:"track_published",kind:"message",T:kC,oneof:"message"},{no:8,name:"leave",kind:"message",T:xy,oneof:"message"},{no:9,name:"mute",kind:"message",T:gy,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:xre,oneof:"message"},{no:11,name:"room_update",kind:"message",T:yre,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:wre,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:kre,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:jre,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:Tre,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:gre,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:pre,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:Are,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Mre,oneof:"message"},{no:22,name:"request_response",kind:"message",T:Rre,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Ore,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:Ere,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Lre,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:Cre,oneof:"message"},{no:27,name:"publish_data_track_response",kind:"message",T:wC,oneof:"message"},{no:28,name:"unpublish_data_track_response",kind:"message",T:dre,oneof:"message"},{no:29,name:"data_track_subscriber_handles",kind:"message",T:hre,oneof:"message"}]),oN=oe.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:rc,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:oe.getEnumType(PU)}]),Wm=oe.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:oe.getEnumType(la)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:oe.getEnumType(vi)},{no:9,name:"layers",kind:"message",T:rc,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:oN,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:oe.getEnumType(xn)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:oe.getEnumType(AU)},{no:17,name:"audio_features",kind:"enum",T:oe.getEnumType(Di),repeated:!0},{no:18,name:"packet_trailer_features",kind:"enum",T:oe.getEnumType(ph),repeated:!0}]),bC=oe.makeMessageType("livekit.PublishDataTrackRequest",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"encryption",kind:"enum",T:oe.getEnumType(xn)}]),wC=oe.makeMessageType("livekit.PublishDataTrackResponse",()=>[{no:1,name:"info",kind:"message",T:fy}]),SC=oe.makeMessageType("livekit.UnpublishDataTrackRequest",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13}]),dre=oe.makeMessageType("livekit.UnpublishDataTrackResponse",()=>[{no:1,name:"info",kind:"message",T:fy}]),hre=oe.makeMessageType("livekit.DataTrackSubscriberHandles",()=>[{no:1,name:"sub_handles",kind:"map",K:13,V:{kind:"message",T:fre}}]),fre=oe.makeMessageType("livekit.DataTrackSubscriberHandles.PublishedDataTrack",()=>[{no:1,name:"publisher_identity",kind:"scalar",T:9},{no:2,name:"publisher_sid",kind:"scalar",T:9},{no:3,name:"track_sid",kind:"scalar",T:9}],{localName:"DataTrackSubscriberHandles_PublishedDataTrack"}),py=oe.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:oe.getEnumType(ca)},{no:3,name:"final",kind:"scalar",T:8}]),gy=oe.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),mre=oe.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:hy},{no:2,name:"participant",kind:"message",T:Tu},{no:3,name:"other_participants",kind:"message",T:Tu,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:XU,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:VU},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:LU},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Dv,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),pre=oe.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:XU,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:VU},{no:3,name:"server_info",kind:"message",T:LU},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),kC=oe.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Hd}]),gre=oe.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),mc=oe.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13},{no:4,name:"mid_to_track_id",kind:"map",K:9,V:{kind:"scalar",T:9}}]),vre=oe.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:Tu,repeated:!0}]),vy=oe.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:DU,repeated:!0}]),HU=oe.makeMessageType("livekit.UpdateDataSubscription",()=>[{no:1,name:"updates",kind:"message",T:KU,repeated:!0}]),KU=oe.makeMessageType("livekit.UpdateDataSubscription.Update",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"options",kind:"message",T:ire}],{localName:"UpdateDataSubscription_Update"}),GU=oe.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:oe.getEnumType(gC)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),NC=oe.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:oe.getEnumType(Di),repeated:!0}]),YU=oe.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),xy=oe.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:oe.getEnumType(ya)},{no:3,name:"action",kind:"enum",T:oe.getEnumType(eh)},{no:4,name:"regions",kind:"message",T:Pre}]),eh=oe.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),QU=oe.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:rc,repeated:!0}]),jC=oe.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),XU=oe.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),xre=oe.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:RU,repeated:!0}]),yre=oe.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:hy}]),bre=oe.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:oe.getEnumType(cm)},{no:3,name:"score",kind:"scalar",T:2}]),wre=oe.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:bre,repeated:!0}]),Sre=oe.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:oe.getEnumType(aN)}]),kre=oe.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:Sre,repeated:!0}]),CC=oe.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:oe.getEnumType(gC)},{no:2,name:"enabled",kind:"scalar",T:8}]),Nre=oe.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:CC,repeated:!0}]),jre=oe.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:CC,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:Nre,repeated:!0}]),Cre=oe.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:lre,repeated:!0}]),JU=oe.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),ZU=oe.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:JU,repeated:!0}]),Tre=oe.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),Ere=oe.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:hy},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:Tu},{no:4,name:"other_participants",kind:"message",T:Tu,repeated:!0}]),TC=oe.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:mc},{no:2,name:"subscription",kind:"message",T:vy},{no:3,name:"publish_tracks",kind:"message",T:kC,repeated:!0},{no:4,name:"data_channels",kind:"message",T:tB,repeated:!0},{no:5,name:"offer",kind:"message",T:mc},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:eB,repeated:!0},{no:8,name:"publish_data_tracks",kind:"message",T:wC,repeated:!0}]),eB=oe.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),tB=oe.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:oe.getEnumType(ca)}]),Va=oe.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:oe.getEnumType(cre),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}
vendor: 67,389 bytes, lines 627-661
627]),nB=oe.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),Are=oe.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),Pre=oe.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:_re,repeated:!0}]),_re=oe.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),Mre=oe.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:oe.getEnumType(Zie)}]),Rre=oe.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:oe.getEnumType(eu)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:py,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Wm,oneof:"request"},{no:6,name:"mute",kind:"message",T:gy,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:jC,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:NC,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:YU,oneof:"request"},{no:10,name:"publish_data_track",kind:"message",T:bC,oneof:"request"},{no:11,name:"unpublish_data_track",kind:"message",T:SC,oneof:"request"}]),eu=oe.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"},{no:7,name:"INVALID_HANDLE"},{no:8,name:"INVALID_NAME"},{no:9,name:"DUPLICATE_HANDLE"},{no:10,name:"DUPLICATE_NAME"}]),Ore=oe.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),iB=oe.makeMessageType("livekit.ConnectionSettings",()=>[{no:1,name:"auto_subscribe",kind:"scalar",T:8},{no:2,name:"adaptive_stream",kind:"scalar",T:8},{no:3,name:"subscriber_allow_pause",kind:"scalar",T:8,opt:!0},{no:4,name:"disable_ice_lite",kind:"scalar",T:8},{no:5,name:"auto_subscribe_data_track",kind:"scalar",T:8,opt:!0}]),Ire=oe.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:BU},{no:2,name:"connection_settings",kind:"message",T:iB},{no:3,name:"metadata",kind:"scalar",T:9},{no:4,name:"participant_attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"add_track_requests",kind:"message",T:Wm,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:mc},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:oe.getEnumType(Kc)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:TC}]),Dre=oe.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:oe.getEnumType(lN)},{no:2,name:"join_request",kind:"scalar",T:12}]),lN=oe.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),Lre=oe.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function Ure(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q0={exports:{}},Bre=Q0.exports,GM;function Fre(){return GM||(GM=1,(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(Bre,function(){var t=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},l=null;function c(S,N){var j=S[N];if(typeof j.bind=="function")return j.bind(S);try{return Function.prototype.bind.call(j,S)}catch{return function(){return Function.prototype.apply.apply(j,[S,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function d(S){return S==="debug"&&(S="log"),typeof console===n?!1:S==="trace"&&i?h:console[S]!==void 0?c(console,S):console.log!==void 0?c(console,"log"):t}function f(){for(var S=this.getLevel(),N=0;N<r.length;N++){var j=r[N];this[j]=N<S?t:this.methodFactory(j,S,this.name)}if(this.log=this.debug,typeof console===n&&S<this.levels.SILENT)return"No console available for logging"}function p(S){return function(){typeof console!==n&&(f.call(this),this[S].apply(this,arguments))}}function v(S,N,j){return d(S)||p.apply(this,arguments)}function x(S,N){var j=this,T,E,C,P="loglevel";typeof S=="string"?P+=":"+S:typeof S=="symbol"&&(P=void 0);function A(O){var F=(r[O]||"silent").toUpperCase();if(!(typeof window===n||!P)){try{window.localStorage[P]=F;return}catch{}try{window.document.cookie=encodeURIComponent(P)+"="+F+";"}catch{}}}function M(){var O;if(!(typeof window===n||!P)){try{O=window.localStorage[P]}catch{}if(typeof O===n)try{var F=window.document.cookie,ne=encodeURIComponent(P),re=F.indexOf(ne+"=");re!==-1&&(O=/^([^;]+)/.exec(F.slice(re+ne.length+1))[1])}catch{}return j.levels[O]===void 0&&(O=void 0),O}}function R(){if(!(typeof window===n||!P)){try{window.localStorage.removeItem(P)}catch{}try{window.document.cookie=encodeURIComponent(P)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function B(O){var F=O;if(typeof F=="string"&&j.levels[F.toUpperCase()]!==void 0&&(F=j.levels[F.toUpperCase()]),typeof F=="number"&&F>=0&&F<=j.levels.SILENT)return F;throw new TypeError("log.setLevel() called with invalid level: "+O)}j.name=S,j.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},j.methodFactory=N||v,j.getLevel=function(){return C??E??T},j.setLevel=function(O,F){return C=B(O),F!==!1&&A(C),f.call(j)},j.setDefaultLevel=function(O){E=B(O),M()||j.setLevel(O,!1)},j.resetLevel=function(){C=null,R(),f.call(j)},j.enableAll=function(O){j.setLevel(j.levels.TRACE,O)},j.disableAll=function(O){j.setLevel(j.levels.SILENT,O)},j.rebuild=function(){if(l!==j&&(T=B(l.getLevel())),f.call(j),l===j)for(var O in s)s[O].rebuild()},T=B(l?l.getLevel():"WARN");var U=M();U!=null&&(C=B(U)),f.call(j)}l=new x,l.getLogger=function(N){if(typeof N!="symbol"&&typeof N!="string"||N==="")throw new TypeError("You must supply a name when creating a logger.");var j=s[N];return j||(j=s[N]=new x(N,l.methodFactory)),j};var b=typeof window!==n?window.log:void 0;return l.noConflict=function(){return typeof window!==n&&window.log===l&&(window.log=b),l},l.getLoggers=function(){return s},l.default=l,l})})(Q0)),Q0.exports}var yy=Fre(),cN;(function(e){e[e.trace=0]="trace",e[e.debug=1]="debug",e[e.info=2]="info",e[e.warn=3]="warn",e[e.error=4]="error",e[e.silent=5]="silent"})(cN||(cN={}));var zi;(function(e){e.Default="livekit",e.Room="livekit-room",e.TokenSource="livekit-token-source",e.Participant="livekit-participant",e.Track="livekit-track",e.Publication="livekit-track-publication",e.Engine="livekit-engine",e.Signal="livekit-signal",e.PCManager="livekit-pc-manager",e.PCTransport="livekit-pc-transport",e.E2EE="lk-e2ee",e.DataTracks="livekit-data-tracks"})(zi||(zi={}));let vt=yy.getLogger(zi.Default);Object.values(zi).map(e=>yy.getLogger(e));vt.setDefaultLevel(cN.info);function es(e,t){const n=yy.getLogger(e);return n.setDefaultLevel(vt.getLevel()),t?$re(n,t):n}function $re(e,t){const n=r=>(s,l)=>{const c=t(),h=c||l?Object.assign(Object.assign({},c),l):void 0;e[r](s,h)},i=Object.create(e);return i.trace=n("trace"),i.debug=n("debug"),i.info=n("info"),i.warn=n("warn"),i.error=n("error"),i}const Vre=yy.getLogger(zi.E2EE),$f=7e3,zre=[0,300,4*300,9*300,16*300,$f,$f,$f,$f,$f];class qre{constructor(t){this._retryDelays=t!==void 0?[...t]:zre}nextRetryDelayInMs(t){if(t.retryCount>=this._retryDelays.length)return null;const n=this._retryDelays[t.retryCount];return t.retryCount<=1?n:n+Math.random()*1e3}}function Wre(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}function z(e,t,n,i){function r(s){return s instanceof n?s:new n(function(l){l(s)})}return new(n||(n=Promise))(function(s,l){function c(f){try{d(i.next(f))}catch(p){l(p)}}function h(f){try{d(i.throw(f))}catch(p){l(p)}}function d(f){f.done?s(f.value):r(f.value).then(c,h)}d((i=i.apply(e,t||[])).next())})}function YM(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function gh(e){return this instanceof gh?(this.v=e,this):new gh(e)}function Hre(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(e,t||[]),r,s=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",l),r[Symbol.asyncIterator]=function(){return this},r;function l(x){return function(b){return Promise.resolve(b).then(x,p)}}function c(x,b){i[x]&&(r[x]=function(S){return new Promise(function(N,j){s.push([x,S,N,j])>1||h(x,S)})},b&&(r[x]=b(r[x])))}function h(x,b){try{d(i[x](b))}catch(S){v(s[0][3],S)}}function d(x){x.value instanceof gh?Promise.resolve(x.value.v).then(f,p):v(s[0][2],x)}function f(x){h("next",x)}function p(x){h("throw",x)}function v(x,b){x(b),s.shift(),s.length&&h(s[0][0],s[0][1])}}function Kre(e){var t,n;return t={},i("next"),i("throw",function(r){throw r}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(r,s){t[r]=e[r]?function(l){return(n=!n)?{value:gh(e[r](l)),done:!1}:s?s(l):l}:s}}function ua(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof YM=="function"?YM(e):e[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=e[s]&&function(l){return new Promise(function(c,h){l=e[s](l),r(c,h,l.done,l.value)})}}function r(s,l,c,h){Promise.resolve(h).then(function(d){s({value:d,done:c})},l)}}var d0={exports:{}},QM;function Gre(){if(QM)return d0.exports;QM=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(P,A,M){return Function.prototype.apply.call(P,A,M)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(P){return Object.getOwnPropertyNames(P).concat(Object.getOwnPropertySymbols(P))}:n=function(P){return Object.getOwnPropertyNames(P)};function i(C){console&&console.warn&&console.warn(C)}var r=Number.isNaN||function(P){return P!==P};function s(){s.init.call(this)}d0.exports=s,d0.exports.once=j,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function c(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(C){if(typeof C!="number"||C<0||r(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");l=C}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(P){if(typeof P!="number"||P<0||r(P))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+P+".");return this._maxListeners=P,this};function h(C){return C._maxListeners===void 0?s.defaultMaxListeners:C._maxListeners}s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(P){for(var A=[],M=1;M<arguments.length;M++)A.push(arguments[M]);var R=P==="error",B=this._events;if(B!==void 0)R=R&&B.error===void 0;else if(!R)return!1;if(R){var U;if(A.length>0&&(U=A[0]),U instanceof Error)throw U;var O=new Error("Unhandled error."+(U?" ("+U.message+")":""));throw O.context=U,O}var F=B[P];if(F===void 0)return!1;if(typeof F=="function")t(F,this,A);else for(var ne=F.length,re=b(F,ne),M=0;M<ne;++M)t(re[M],this,A);return!0};function d(C,P,A,M){var R,B,U;if(c(A),B=C._events,B===void 0?(B=C._events=Object.create(null),C._eventsCount=0):(B.newListener!==void 0&&(C.emit("newListener",P,A.listener?A.listener:A),B=C._events),U=B[P]),U===void 0)U=B[P]=A,++C._eventsCount;else if(typeof U=="function"?U=B[P]=M?[A,U]:[U,A]:M?U.unshift(A):U.push(A),R=h(C),R>0&&U.length>R&&!U.warned){U.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+U.length+" "+String(P)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=C,O.type=P,O.count=U.length,i(O)}return C}s.prototype.addListener=function(P,A){return d(this,P,A,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(P,A){return d(this,P,A,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(C,P,A){var M={fired:!1,wrapFn:void 0,target:C,type:P,listener:A},R=f.bind(M);return R.listener=A,M.wrapFn=R,R}s.prototype.once=function(P,A){return c(A),this.on(P,p(this,P,A)),this},s.prototype.prependOnceListener=function(P,A){return c(A),this.prependListener(P,p(this,P,A)),this},s.prototype.removeListener=function(P,A){var M,R,B,U,O;if(c(A),R=this._events,R===void 0)return this;if(M=R[P],M===void 0)return this;if(M===A||M.listener===A)--this._eventsCount===0?this._events=Object.create(null):(delete R[P],R.removeListener&&this.emit("removeListener",P,M.listener||A));else if(typeof M!="function"){for(B=-1,U=M.length-1;U>=0;U--)if(M[U]===A||M[U].listener===A){O=M[U].listener,B=U;break}if(B<0)return this;B===0?M.shift():S(M,B),M.length===1&&(R[P]=M[0]),R.removeListener!==void 0&&this.emit("removeListener",P,O||A)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(P){var A,M,R;if(M=this._events,M===void 0)return this;if(M.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):M[P]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete M[P]),this;if(arguments.length===0){var B=Object.keys(M),U;for(R=0;R<B.length;++R)U=B[R],U!=="removeListener"&&this.removeAllListeners(U);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(A=M[P],typeof A=="function")this.removeListener(P,A);else if(A!==void 0)for(R=A.length-1;R>=0;R--)this.removeListener(P,A[R]);return this};function v(C,P,A){var M=C._events;if(M===void 0)return[];var R=M[P];return R===void 0?[]:typeof R=="function"?A?[R.listener||R]:[R]:A?N(R):b(R,R.length)}s.prototype.listeners=function(P){return v(this,P,!0)},s.prototype.rawListeners=function(P){return v(this,P,!1)},s.listenerCount=function(C,P){return typeof C.listenerCount=="function"?C.listenerCount(P):x.call(C,P)},s.prototype.listenerCount=x;function x(C){var P=this._events;if(P!==void 0){var A=P[C];if(typeof A=="function")return 1;if(A!==void 0)return A.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function b(C,P){for(var A=new Array(P),M=0;M<P;++M)A[M]=C[M];return A}function S(C,P){for(;P+1<C.length;P++)C[P]=C[P+1];C.pop()}function N(C){for(var P=new Array(C.length),A=0;A<P.length;++A)P[A]=C[A].listener||C[A];return P}function j(C,P){return new Promise(function(A,M){function R(U){C.removeListener(P,B),M(U)}function B(){typeof C.removeListener=="function"&&C.removeListener("error",R),A([].slice.call(arguments))}E(C,P,B,{once:!0}),P!=="error"&&T(C,R,{once:!0})})}function T(C,P,A){typeof C.on=="function"&&E(C,"error",P,A)}function E(C,P,A,M){if(typeof C.on=="function")M.once?C.once(P,A):C.on(P,A);else if(typeof C.addEventListener=="function")C.addEventListener(P,function R(B){M.once&&C.removeEventListener(P,R),A(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof C)}return d0.exports}var ts=Gre();let rB=!0,sB=!0;function um(e,t,n){const i=e.match(t);return i&&i.length>=n&&parseFloat(i[n],10)}function Bu(e,t,n){if(!e.RTCPeerConnection)return;if(!Object.getOwnPropertyDescriptor(EventTarget.prototype,"addEventListener").writable){EC("Unable to polyfill events");return}const r=e.RTCPeerConnection.prototype,s=r.addEventListener;r.addEventListener=function(c,h){if(c!==t)return s.apply(this,arguments);const d=f=>{const p=n(f);p&&(h.handleEvent?h.handleEvent(p):h(p))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(h,d),s.apply(this,[c,d])};const l=r.removeEventListener;r.removeEventListener=function(c,h){if(c!==t||!this._eventMap||!this._eventMap[t])return l.apply(this,arguments);if(!this._eventMap[t].has(h))return l.apply(this,arguments);const d=this._eventMap[t].get(h);return this._eventMap[t].delete(h),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,l.apply(this,[c,d])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(c){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),c&&this.addEventListener(t,this["_on"+t]=c)},enumerable:!0,configurable:!0})}function Yre(e){return typeof e!="boolean"?new Error("Argument type: "+typeof e+". Please use a boolean."):(rB=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Qre(e){return typeof e!="boolean"?new Error("Argument type: "+typeof e+". Please use a boolean."):(sB=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function EC(){if(typeof window=="object"){if(rB)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function AC(e,t){sB&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Xre(e){const t={browser:null,version:null};if(typeof e>"u"||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const n=e.navigator;if(n.userAgentData&&n.userAgentData.brands){const i=n.userAgentData.brands.find(r=>r.brand==="Chromium");if(i)return{browser:"chrome",version:parseInt(i.version,10)}}if(n.mozGetUserMedia)t.browser="firefox",t.version=parseInt(um(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=parseInt(um(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2))||null;else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser="safari",t.version=parseInt(um(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype,t._safariVersion=um(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser="Not a supported browser.",t;return t}function XM(e){return Object.prototype.toString.call(e)==="[object Object]"}function aB(e){return XM(e)?Object.keys(e).reduce(function(t,n){const i=XM(e[n]),r=i?aB(e[n]):e[n],s=i&&!Object.keys(r).length;return r===void 0||s?t:Object.assign(t,{[n]:r})},{}):e}function uN(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(i=>{i.endsWith("Id")?uN(e,e.get(t[i]),n):i.endsWith("Ids")&&t[i].forEach(r=>{uN(e,e.get(r),n)})}))}function JM(e,t,n){const i=n?"outbound-rtp":"inbound-rtp",r=new Map;if(t===null)return r;const s=[];return e.forEach(l=>{l.type==="track"&&l.trackIdentifier===t.id&&s.push(l)}),s.forEach(l=>{e.forEach(c=>{c.type===i&&c.trackId===l.id&&uN(e,c,r)})}),r}const ZM=EC;function oB(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const i=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const h={};return Object.keys(c).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;const f=typeof c[d]=="object"?c[d]:{ideal:c[d]};f.exact!==void 0&&typeof f.exact=="number"&&(f.min=f.max=f.exact);const p=function(v,x){return v?v+x.charAt(0).toUpperCase()+x.slice(1):x==="deviceId"?"sourceId":x};if(f.ideal!==void 0){h.optional=h.optional||[];let v={};typeof f.ideal=="number"?(v[p("min",d)]=f.ideal,h.optional.push(v),v={},v[p("max",d)]=f.ideal,h.optional.push(v)):(v[p("",d)]=f.ideal,h.optional.push(v))}f.exact!==void 0&&typeof f.exact!="number"?(h.mandatory=h.mandatory||{},h.mandatory[p("",d)]=f.exact):["min","max"].forEach(v=>{f[v]!==void 0&&(h.mandatory=h.mandatory||{},h.mandatory[p(v,d)]=f[v])})}),c.advanced&&(h.optional=(h.optional||[]).concat(c.advanced)),h},r=function(c,h){if(t.version>=61)return h(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const d=function(f,p,v){p in f&&!(v in f)&&(f[v]=f[p],delete f[p])};c=JSON.parse(JSON.stringify(c)),d(c.audio,"autoGainControl","googAutoGainControl"),d(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=i(c.audio)}if(c&&typeof c.video=="object"){let d=c.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});const f=t.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!f)){delete c.video.facingMode;let p;if(d.exact==="environment"||d.ideal==="environment"?p=["back","rear"]:(d.exact==="user"||d.ideal==="user")&&(p=["front"]),p)return n.mediaDevices.enumerateDevices().then(v=>{v=v.filter(b=>b.kind==="videoinput");let x=v.find(b=>p.some(S=>b.label.toLowerCase().includes(S)));return!x&&v.length&&p.includes("back")&&(x=v[v.length-1]),x&&(c.video.deviceId=d.exact?{exact:x.deviceId}:{ideal:x.deviceId}),c.video=i(c.video),ZM("chrome: "+JSON.stringify(c)),h(c)})}c.video=i(c.video)}return ZM("chrome: "+JSON.stringify(c)),h(c)},s=function(c){return t.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},l=function(c,h,d){r(c,f=>{n.webkitGetUserMedia(f,h,p=>{d&&d(s(p))})})};if(n.getUserMedia=l.bind(n),n.mediaDevices.getUserMedia){const c=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(h){return r(h,d=>c(d).then(f=>{if(d.audio&&!f.getAudioTracks().length||d.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(p=>{p.stop()}),new DOMException("","NotFoundError");return f},f=>Promise.reject(s(f))))}}}function lB(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function cB(e,t){if(!(t.version>102))if(typeof e=="object"&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(i){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=i)},enumerable:!0,configurable:!0});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",s=>{let l;e.RTCPeerConnection.prototype.getReceivers?l=this.getReceivers().find(h=>h.track&&h.track.id===s.track.id):l={track:s.track};const c=new Event("track");c.track=s.track,c.receiver=l,c.transceiver={receiver:l},c.streams=[r.stream],this.dispatchEvent(c)}),r.stream.getTracks().forEach(s=>{let l;e.RTCPeerConnection.prototype.getReceivers?l=this.getReceivers().find(h=>h.track&&h.track.id===s.id):l={track:s};const c=new Event("track");c.track=s,c.receiver=l,c.transceiver={receiver:l},c.streams=[r.stream],this.dispatchEvent(c)})},this.addEventListener("addstream",this._ontrackpoly)),n.apply(this,arguments)}}else Bu(e,"track",n=>(n.transceiver||Object.defineProperty(n,"transceiver",{value:{receiver:n.receiver}}),n))}function uB(e){if(typeof e=="object"&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(c,h){let d=r.apply(this,arguments);return d||(d=t(this,c),this._senders.push(d)),d};const s=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(c){s.apply(this,arguments);const h=this._senders.indexOf(c);h!==-1&&this._senders.splice(h,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],n.apply(this,[s]),s.getTracks().forEach(l=>{this._senders.push(t(this,l))})};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(l=>{const c=this._senders.find(h=>h.track===l);c&&this._senders.splice(this._senders.indexOf(c),1)})}}else if(typeof e=="object"&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function dB(e,t){if(t.version>=67||!(typeof e=="object"&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){const l=i.apply(this,[]);return l.forEach(c=>c._pc=this),l});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const l=r.apply(this,arguments);return l._pc=this,l}),e.RTCRtpSender.prototype.getStats=function(){const l=this;return this._pc.getStats().then(c=>JM(c,l.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){const s=i.apply(this,[]);return s.forEach(l=>l._pc=this),s}),Bu(e,"track",r=>(r.receiver._pc=r.srcElement,r)),e.RTCRtpReceiver.prototype.getStats=function(){const s=this;return this._pc.getStats().then(l=>JM(l,s.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;const n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const r=arguments[0];let s,l,c;return this.getSenders().forEach(h=>{h.track===r&&(s?c=!0:s=h)}),this.getReceivers().forEach(h=>(h.track===r&&(l?c=!0:l=h),h.track===r)),c||s&&l?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):s?s.getStats():l?l.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}function hB(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(l=>this._shimmedLocalStreams[l][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(l,c){if(!c)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const h=t.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(h)===-1&&this._shimmedLocalStreams[c.id].push(h):this._shimmedLocalStreams[c.id]=[c,h],h};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(l){this._shimmedLocalStreams=this._shimmedLocalStreams||{},l.getTracks().forEach(d=>{if(this.getSenders().find(p=>p.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});const c=this.getSenders();n.apply(this,arguments);const h=this.getSenders().filter(d=>c.indexOf(d)===-1);this._shimmedLocalStreams[l.id]=[l].concat(h)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(l){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[l.id],i.apply(this,arguments)};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(l){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},l&&Object.keys(this._shimmedLocalStreams).forEach(c=>{const h=this._shimmedLocalStreams[c].indexOf(l);h!==-1&&this._shimmedLocalStreams[c].splice(h,1),this._shimmedLocalStreams[c].length===1&&delete this._shimmedLocalStreams[c]}),r.apply(this,arguments)}}function fB(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return hB(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const f=n.apply(this);return this._reverseStreams=this._reverseStreams||{},f.map(p=>this._reverseStreams[p.id])};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(f){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},f.getTracks().forEach(p=>{if(this.getSenders().find(x=>x.track===p))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[f.id]){const p=new e.MediaStream(f.getTracks());this._streams[f.id]=p,this._reverseStreams[p.id]=f,f=p}i.apply(this,[f])};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(f){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[f.id]||f]),delete this._reverseStreams[this._streams[f.id]?this._streams[f.id].id:f.id],delete this._streams[f.id]},e.RTCPeerConnection.prototype.addTrack=function(f,p){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const v=[].slice.call(arguments,1);if(v.length!==1||!v[0].getTracks().find(S=>S===f))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(S=>S.track===f))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const b=this._streams[p.id];if(b)b.addTrack(f),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const S=new e.MediaStream([f]);this._streams[p.id]=S,this._reverseStreams[S.id]=p,this.addStream(S)}return this.getSenders().find(S=>S.track===f)};function s(d,f){let p=f.sdp;return Object.keys(d._reverseStreams||[]).forEach(v=>{const x=d._reverseStreams[v],b=d._streams[x.id];p=p.replace(new RegExp(b.id,"g"),x.id)}),new RTCSessionDescription({type:f.type,sdp:p})}function l(d,f){let p=f.sdp;return Object.keys(d._reverseStreams||[]).forEach(v=>{const x=d._reverseStreams[v],b=d._streams[x.id];p=p.replace(new RegExp(x.id,"g"),b.id)}),new RTCSessionDescription({type:f.type,sdp:p})}["createOffer","createAnswer"].forEach(function(d){const f=e.RTCPeerConnection.prototype[d],p={[d](){const v=arguments;return arguments.length&&typeof arguments[0]=="function"?f.apply(this,[b=>{const S=s(this,b);v[0].apply(null,[S])},b=>{v[1]&&v[1].apply(null,b)},arguments[2]]):f.apply(this,arguments).then(b=>s(this,b))}};e.RTCPeerConnection.prototype[d]=p[d]});const c=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=l(this,arguments[0]),c.apply(this,arguments))};const h=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const d=h.get.apply(this);return d.type===""?d:s(this,d)}}),e.RTCPeerConnection.prototype.removeTrack=function(f){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!f._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(f._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let v;Object.keys(this._streams).forEach(x=>{this._streams[x].getTracks().find(S=>f.track===S)&&(v=this._streams[x])}),v&&(v.getTracks().length===1?this.removeStream(this._reverseStreams[v.id]):v.removeTrack(f.track),this.dispatchEvent(new Event("negotiationneeded")))}}function dN(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const i=e.RTCPeerConnection.prototype[n],r={[n](){return arguments[0]=new(n==="addIceCandidate"?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};e.RTCPeerConnection.prototype[n]=r[n]})}function mB(e,t){t.version>102||Bu(e,"negotiationneeded",n=>{const i=n.target;if(!((t.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return n})}var eR=Object.freeze({__proto__:null,fixNegotiationNeeded:mB,shimAddTrackRemoveTrack:fB,shimAddTrackRemoveTrackWithNative:hB,shimGetSendersWithDtmf:uB,shimGetUserMedia:oB,shimMediaStream:lB,shimOnTrack:cB,shimPeerConnection:dN,shimSenderReceiverGetStats:dB});function pB(e,t){const n=e&&e.navigator,i=e&&e.MediaStreamTrack;if(n.getUserMedia=function(r,s,l){AC("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(r).then(s,l)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const r=function(l,c,h){c in l&&!(h in l)&&(l[h]=l[c],delete l[c])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(l){return typeof l=="object"&&typeof l.audio=="object"&&(l=JSON.parse(JSON.stringify(l)),r(l.audio,"autoGainControl","mozAutoGainControl"),r(l.audio,"noiseSuppression","mozNoiseSuppression")),s(l)},i&&i.prototype.getSettings){const l=i.prototype.getSettings;i.prototype.getSettings=function(){const c=l.apply(this,arguments);return r(c,"mozAutoGainControl","autoGainControl"),r(c,"mozNoiseSuppression","noiseSuppression"),c}}if(i&&i.prototype.applyConstraints){const l=i.prototype.applyConstraints;i.prototype.applyConstraints=function(c){return this.kind==="audio"&&typeof c=="object"&&(c=JSON.parse(JSON.stringify(c)),r(c,"autoGainControl","mozAutoGainControl"),r(c,"noiseSuppression","mozNoiseSuppression")),l.apply(this,[c])}}}}function Jre(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!(i&&i.video)){const r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return i.video===!0?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}function gB(e){typeof e=="object"&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function hN(e,t){typeof e!="object"||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const i=e.RTCPeerConnection.prototype[n],r={[n](){return arguments[0]=new(n==="addIceCandidate"?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};e.RTCPeerConnection.prototype[n]=r[n]}))}function vB(e,t){if(typeof e!="object"||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||t.version>=151)return;const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const s=Array.prototype.slice.call(arguments),l=s[0],c=s[1],h=s[2];return this.signalingState==="closed"?Promise.resolve(new Map):i.apply(this,[l||null]).then(d=>{if(t.version<53&&!c)try{d.forEach(f=>{f.type=n[f.type]||f.type})}catch(f){if(f.name!=="TypeError")throw f;d.forEach((p,v)=>{d.set(v,Object.assign({},p,{type:n[p.type]||p.type}))})}return d}).then(c,h)}}function xB(e){if(!(typeof e=="object"&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function yB(e){if(!(typeof e=="object"&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),Bu(e,"track",n=>(n.receiver._pc=n.srcElement,n)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function bB(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(n){AC("removeStream","removeTrack"),this.getSenders().forEach(i=>{i.track&&n.getTracks().includes(i.track)&&this.removeTrack(i)})})}function wB(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function SB(e){if(!(typeof e=="object"&&e.RTCPeerConnection))return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let i=arguments[1]&&arguments[1].sendEncodings;i===void 0&&(i=[]),i=[...i];const r=i.length>0;r&&i.forEach(l=>{if("rid"in l&&!/^[a-z0-9]{0,16}$/i.test(l.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in l&&!(parseFloat(l.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in l&&!(parseFloat(l.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const s=t.apply(this,arguments);if(r){const l=s.sender,c=l.getParameters();(!("encodings"in c)||c.encodings.length===1&&Object.keys(c.encodings[0]).length===0)&&(c.encodings=i,l.sendEncodings=i,this.setParametersPromises.push(l.setParameters(c).then(()=>{delete l.sendEncodings}).catch(()=>{delete l.sendEncodings})))}return s})}function kB(e){if(!(typeof e=="object"&&e.RTCRtpSender))return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const i=t.apply(this,arguments);return"encodings"in i||(i.encodings=[].concat(this.sendEncodings||[{}])),i})}function NB(e){if(!(typeof e=="object"&&e.RTCPeerConnection))return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function jB(e){if(!(typeof e=="object"&&e.RTCPeerConnection))return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var tR=Object.freeze({__proto__:null,shimAddTransceiver:SB,shimCreateAnswer:jB,shimCreateOffer:NB,shimGetDisplayMedia:Jre,shimGetParameters:kB,shimGetStats:vB,shimGetUserMedia:pB,shimOnTrack:gB,shimPeerConnection:hN,shimRTCDataChannel:wB,shimReceiverGetStats:yB,shimRemoveStream:bB,shimSenderGetStats:xB});function CB(e){if(!(typeof e!="object"||!e.RTCPeerConnection)){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(i){this._localStreams||(this._localStreams=[]),this._localStreams.includes(i)||this._localStreams.push(i),i.getAudioTracks().forEach(r=>t.call(this,r,i)),i.getVideoTracks().forEach(r=>t.call(this,r,i))},e.RTCPeerConnection.prototype.addTrack=function(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),l=1;l<r;l++)s[l-1]=arguments[l];return s&&s.forEach(c=>{this._localStreams?this._localStreams.includes(c)||this._localStreams.push(c):this._localStreams=[c]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const i=this._localStreams.indexOf(n);if(i===-1)return;this._localStreams.splice(i,1);const r=n.getTracks();this.getSenders().forEach(s=>{r.includes(s.track)&&this.removeTrack(s)})})}}function TB(e){if(!(typeof e!="object"||!e.RTCPeerConnection)&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=i=>{i.streams.forEach(r=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(r))return;this._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,this.dispatchEvent(s)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const i=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(s=>{if(i._remoteStreams||(i._remoteStreams=[]),i._remoteStreams.indexOf(s)>=0)return;i._remoteStreams.push(s);const l=new Event("addstream");l.stream=s,i.dispatchEvent(l)})}),t.apply(i,arguments)}}}function EB(e){if(typeof e!="object"||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,i=t.createAnswer,r=t.setLocalDescription,s=t.setRemoteDescription,l=t.addIceCandidate;t.createOffer=function(d,f){const p=arguments.length>=2?arguments[2]:arguments[0],v=n.apply(this,[p]);return f?(v.then(d,f),Promise.resolve()):v},t.createAnswer=function(d,f){const p=arguments.length>=2?arguments[2]:arguments[0],v=i.apply(this,[p]);return f?(v.then(d,f),Promise.resolve()):v};let c=function(h,d,f){const p=r.apply(this,[h]);return f?(p.then(d,f),Promise.resolve()):p};t.setLocalDescription=c,c=function(h,d,f){const p=s.apply(this,[h]);return f?(p.then(d,f),Promise.resolve()):p},t.setRemoteDescription=c,c=function(h,d,f){const p=l.apply(this,[h]);return f?(p.then(d,f),Promise.resolve()):p},t.addIceCandidate=c}function AB(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const n=t.mediaDevices,i=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=r=>i(PB(r))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=(function(i,r,s){t.mediaDevices.getUserMedia(i).then(r,s)}).bind(t))}function PB(e){return e&&e.video!==void 0?Object.assign({},e,{video:aB(e.video)}):e}function _B(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(i,r){if(i&&i.iceServers){const s=[];for(let l=0;l<i.iceServers.length;l++){let c=i.iceServers[l];c.urls===void 0&&c.url?(AC("RTCIceServer.url","RTCIceServer.urls"),c=JSON.parse(JSON.stringify(c)),c.urls=c.url,delete c.url,s.push(c)):s.push(i.iceServers[l])}i.iceServers=s}return new t(i,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get(){return t.generateCertificate}})}function MB(e){typeof e=="object"&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function RB(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(i){if(i){typeof i.offerToReceiveAudio<"u"&&(i.offerToReceiveAudio=!!i.offerToReceiveAudio);const r=this.getTransceivers().find(l=>l.receiver.track.kind==="audio");i.offerToReceiveAudio===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):i.offerToReceiveAudio===!0&&!r&&this.addTransceiver("audio",{direction:"recvonly"}),typeof i.offerToReceiveVideo<"u"&&(i.offerToReceiveVideo=!!i.offerToReceiveVideo);const s=this.getTransceivers().find(l=>l.receiver.track.kind==="video");i.offerToReceiveVideo===!1&&s?s.direction==="sendrecv"?s.setDirection?s.setDirection("sendonly"):s.direction="sendonly":s.direction==="recvonly"&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive"):i.offerToReceiveVideo===!0&&!s&&this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function OB(e){typeof e!="object"||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var nR=Object.freeze({__proto__:null,shimAudioContext:OB,shimCallbacksAPI:EB,shimConstraints:PB,shimCreateOfferLegacy:RB,shimGetUserMedia:AB,shimLocalStreamsAPI:CB,shimRTCIceServerUrls:_B,shimRemoteStreamsAPI:TB,shimTrackEventTransceiver:MB}),fS={exports:{}},iR;function Zre(){return iR||(iR=1,(function(e){const t={};t.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},t.localCName=t.generateIdentifier(),t.splitLines=function(n){return n.trim().split(`
628`).map(i=>i.trim())},t.splitSections=function(n){return n.split(`
629m=`).map((r,s)=>(s>0?"m="+r:r).trim()+`\r
630`)},t.getDescription=function(n){const i=t.splitSections(n);return i&&i[0]},t.getMediaSections=function(n){const i=t.splitSections(n);return i.shift(),i},t.matchPrefix=function(n,i){return t.splitLines(n).filter(r=>r.indexOf(i)===0)},t.parseCandidate=function(n){let i;n.indexOf("a=candidate:")===0?i=n.substring(12).split(" "):i=n.substring(10).split(" ");const r={foundation:i[0],component:{1:"rtp",2:"rtcp"}[i[1]]||i[1],protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]};for(let s=8;s<i.length;s+=2)switch(i[s]){case"raddr":r.relatedAddress=i[s+1];break;case"rport":r.relatedPort=parseInt(i[s+1],10);break;case"tcptype":r.tcpType=i[s+1];break;case"ufrag":r.ufrag=i[s+1],r.usernameFragment=i[s+1];break;default:r[i[s]]===void 0&&(r[i[s]]=i[s+1]);break}return r},t.writeCandidate=function(n){const i=[];i.push(n.foundation);const r=n.component;r==="rtp"?i.push(1):r==="rtcp"?i.push(2):i.push(r),i.push(n.protocol.toUpperCase()),i.push(n.priority),i.push(n.address||n.ip),i.push(n.port);const s=n.type;return i.push("typ"),i.push(s),s!=="host"&&n.relatedAddress&&n.relatedPort!==void 0&&(i.push("raddr"),i.push(n.relatedAddress),i.push("rport"),i.push(n.relatedPort)),n.tcpType&&n.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(n.tcpType)),(n.usernameFragment||n.ufrag)&&(i.push("ufrag"),i.push(n.usernameFragment||n.ufrag)),"candidate:"+i.join(" ")},t.parseIceOptions=function(n){return n.substring(14).split(" ")},t.parseRtpMap=function(n){let i=n.substring(9).split(" ");const r={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),r.name=i[0],r.clockRate=parseInt(i[1],10),r.channels=i.length===3?parseInt(i[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(n){let i=n.payloadType;n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType);const r=n.channels||n.numChannels||1;return"a=rtpmap:"+i+" "+n.name+"/"+n.clockRate+(r!==1?"/"+r:"")+`\r
631`},t.parseExtmap=function(n){const i=n.substring(9).split(" ");return{id:parseInt(i[0],10),direction:i[0].indexOf("/")>0?i[0].split("/")[1]:"sendrecv",uri:i[1],attributes:i.slice(2).join(" ")}},t.writeExtmap=function(n){return"a=extmap:"+(n.id||n.preferredId)+(n.direction&&n.direction!=="sendrecv"?"/"+n.direction:"")+" "+n.uri+(n.attributes?" "+n.attributes:"")+`\r
632`},t.parseFmtp=function(n){const i={};let r;const s=n.substring(n.indexOf(" ")+1).split(";");for(let l=0;l<s.length;l++)r=s[l].trim().split("="),i[r[0].trim()]=r[1];return i},t.writeFmtp=function(n){let i="",r=n.payloadType;if(n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType),n.parameters&&Object.keys(n.parameters).length){const s=[];Object.keys(n.parameters).forEach(l=>{n.parameters[l]!==void 0?s.push(l+"="+n.parameters[l]):s.push(l)}),i+="a=fmtp:"+r+" "+s.join(";")+`\r
633`}return i},t.parseRtcpFb=function(n){const i=n.substring(n.indexOf(" ")+1).split(" ");return{type:i.shift(),parameter:i.join(" ")}},t.writeRtcpFb=function(n){let i="",r=n.payloadType;return n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType),n.rtcpFeedback&&n.rtcpFeedback.length&&n.rtcpFeedback.forEach(s=>{i+="a=rtcp-fb:"+r+" "+s.type+(s.parameter&&s.parameter.length?" "+s.parameter:"")+`\r
634`}),i},t.parseSsrcMedia=function(n){const i=n.indexOf(" "),r={ssrc:parseInt(n.substring(7,i),10)},s=n.indexOf(":",i);return s>-1?(r.attribute=n.substring(i+1,s),r.value=n.substring(s+1)):r.attribute=n.substring(i+1),r},t.parseSsrcGroup=function(n){const i=n.substring(13).split(" ");return{semantics:i.shift(),ssrcs:i.map(r=>parseInt(r,10))}},t.getMid=function(n){const i=t.matchPrefix(n,"a=mid:")[0];if(i)return i.substring(6)},t.parseFingerprint=function(n){const i=n.substring(14).split(" ");return{algorithm:i[0].toLowerCase(),value:i[1].toUpperCase()}},t.getDtlsParameters=function(n,i){return{role:"auto",fingerprints:t.matchPrefix(n+i,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(n,i){let r="a=setup:"+i+`\r
635`;return n.fingerprints.forEach(s=>{r+="a=fingerprint:"+s.algorithm+" "+s.value+`\r
636`}),r},t.parseCryptoLine=function(n){const i=n.substring(9).split(" ");return{tag:parseInt(i[0],10),cryptoSuite:i[1],keyParams:i[2],sessionParams:i.slice(3)}},t.writeCryptoLine=function(n){return"a=crypto:"+n.tag+" "+n.cryptoSuite+" "+(typeof n.keyParams=="object"?t.writeCryptoKeyParams(n.keyParams):n.keyParams)+(n.sessionParams?" "+n.sessionParams.join(" "):"")+`\r
637`},t.parseCryptoKeyParams=function(n){if(n.indexOf("inline:")!==0)return null;const i=n.substring(7).split("|");return{keyMethod:"inline",keySalt:i[0],lifeTime:i[1],mkiValue:i[2]?i[2].split(":")[0]:void 0,mkiLength:i[2]?i[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(n){return n.keyMethod+":"+n.keySalt+(n.lifeTime?"|"+n.lifeTime:"")+(n.mkiValue&&n.mkiLength?"|"+n.mkiValue+":"+n.mkiLength:"")},t.getCryptoParameters=function(n,i){return t.matchPrefix(n+i,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(n,i){const r=t.matchPrefix(n+i,"a=ice-ufrag:")[0],s=t.matchPrefix(n+i,"a=ice-pwd:")[0];return r&&s?{usernameFragment:r.substring(12),password:s.substring(10)}:null},t.writeIceParameters=function(n){let i="a=ice-ufrag:"+n.usernameFragment+`\r
638a=ice-pwd:`+n.password+`\r
639`;return n.iceLite&&(i+=`a=ice-lite\r
640`),i},t.parseRtpParameters=function(n){const i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},s=t.splitLines(n)[0].split(" ");i.profile=s[2];for(let c=3;c<s.length;c++){const h=s[c],d=t.matchPrefix(n,"a=rtpmap:"+h+" ")[0];if(d){const f=t.parseRtpMap(d),p=t.matchPrefix(n,"a=fmtp:"+h+" ");switch(f.parameters=p.length?t.parseFmtp(p[0]):{},f.rtcpFeedback=t.matchPrefix(n,"a=rtcp-fb:"+h+" ").map(t.parseRtcpFb),i.codecs.push(f),f.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(f.name.toUpperCase());break}}}t.matchPrefix(n,"a=extmap:").forEach(c=>{i.headerExtensions.push(t.parseExtmap(c))});const l=t.matchPrefix(n,"a=rtcp-fb:* ").map(t.parseRtcpFb);return i.codecs.forEach(c=>{l.forEach(h=>{c.rtcpFeedback.find(f=>f.type===h.type&&f.parameter===h.parameter)||c.rtcpFeedback.push(h)})}),i},t.writeRtpDescription=function(n,i){let r="";r+="m="+n+" ",r+=i.codecs.length>0?"9":"0",r+=" "+(i.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=i.codecs.map(l=>l.preferredPayloadType!==void 0?l.preferredPayloadType:l.payloadType).join(" ")+`\r
641`,r+=`c=IN IP4 0.0.0.0\r
642`,r+=`a=rtcp:9 IN IP4 0.0.0.0\r
643`,i.codecs.forEach(l=>{r+=t.writeRtpMap(l),r+=t.writeFmtp(l),r+=t.writeRtcpFb(l)});let s=0;return i.codecs.forEach(l=>{l.maxptime>s&&(s=l.maxptime)}),s>0&&(r+="a=maxptime:"+s+`\r
644`),i.headerExtensions&&i.headerExtensions.forEach(l=>{r+=t.writeExtmap(l)}),r},t.parseRtpEncodingParameters=function(n){const i=[],r=t.parseRtpParameters(n),s=r.fecMechanisms.indexOf("RED")!==-1,l=r.fecMechanisms.indexOf("ULPFEC")!==-1,c=t.matchPrefix(n,"a=ssrc:").map(v=>t.parseSsrcMedia(v)).filter(v=>v.attribute==="cname"),h=c.length>0&&c[0].ssrc;let d;const f=t.matchPrefix(n,"a=ssrc-group:FID").map(v=>v.substring(17).split(" ").map(b=>parseInt(b,10)));f.length>0&&f[0].length>1&&f[0][0]===h&&(d=f[0][1]),r.codecs.forEach(v=>{if(v.name.toUpperCase()==="RTX"&&v.parameters.apt){let x={ssrc:h,codecPayloadType:parseInt(v.parameters.apt,10)};h&&d&&(x.rtx={ssrc:d}),i.push(x),s&&(x=JSON.parse(JSON.stringify(x)),x.fec={ssrc:h,mechanism:l?"red+ulpfec":"red"},i.push(x))}}),i.length===0&&h&&i.push({ssrc:h});let p=t.matchPrefix(n,"b=");return p.length&&(p[0].indexOf("b=TIAS:")===0?p=parseInt(p[0].substring(7),10):p[0].indexOf("b=AS:")===0?p=parseInt(p[0].substring(5),10)*1e3*.95-2e3*8:p=void 0,i.forEach(v=>{v.maxBitrate=p})),i},t.parseRtcpParameters=function(n){const i={},r=t.matchPrefix(n,"a=ssrc:").map(c=>t.parseSsrcMedia(c)).filter(c=>c.attribute==="cname")[0];r&&(i.cname=r.value,i.ssrc=r.ssrc);const s=t.matchPrefix(n,"a=rtcp-rsize");i.reducedSize=s.length>0,i.compound=s.length===0;const l=t.matchPrefix(n,"a=rtcp-mux");return i.mux=l.length>0,i},t.writeRtcpParameters=function(n){let i="";return n.reducedSize&&(i+=`a=rtcp-rsize\r
645`),n.mux&&(i+=`a=rtcp-mux\r
646`),n.ssrc!==void 0&&n.cname&&(i+="a=ssrc:"+n.ssrc+" cname:"+n.cname+`\r
647`),i},t.parseMsid=function(n){let i;const r=t.matchPrefix(n,"a=msid:");if(r.length===1)return i=r[0].substring(7).split(" "),{stream:i[0],track:i[1]};const s=t.matchPrefix(n,"a=ssrc:").map(l=>t.parseSsrcMedia(l)).filter(l=>l.attribute==="msid");if(s.length>0)return i=s[0].value.split(" "),{stream:i[0],track:i[1]}},t.parseSctpDescription=function(n){const i=t.parseMLine(n),r=t.matchPrefix(n,"a=max-message-size:");let s;r.length>0&&(s=parseInt(r[0].substring(19),10)),isNaN(s)&&(s=65536);const l=t.matchPrefix(n,"a=sctp-port:");if(l.length>0)return{port:parseInt(l[0].substring(12),10),protocol:i.fmt,maxMessageSize:s};const c=t.matchPrefix(n,"a=sctpmap:");if(c.length>0){const h=c[0].substring(10).split(" ");return{port:parseInt(h[0],10),protocol:h[1],maxMessageSize:s}}},t.writeSctpDescription=function(n,i){let r=[];return n.protocol!=="DTLS/SCTP"?r=["m="+n.kind+" 9 "+n.protocol+" "+i.protocol+`\r
648`,`c=IN IP4 0.0.0.0\r
649`,"a=sctp-port:"+i.port+`\r
650`]:r=["m="+n.kind+" 9 "+n.protocol+" "+i.port+`\r
651`,`c=IN IP4 0.0.0.0\r
652`,"a=sctpmap:"+i.port+" "+i.protocol+` 65535\r
653`],i.maxMessageSize!==void 0&&r.push("a=max-message-size:"+i.maxMessageSize+`\r
654`),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(n,i,r){let s;const l=i!==void 0?i:2;return n?s=n:s=t.generateSessionId(),`v=0\r
655o=`+(r||"thisisadapterortc")+" "+s+" "+l+` IN IP4 127.0.0.1\r
656s=-\r
657t=0 0\r
658`},t.getDirection=function(n,i){const r=t.splitLines(n);for(let s=0;s<r.length;s++)switch(r[s]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[s].substring(2)}return i?t.getDirection(i):"sendrecv"},t.getKind=function(n){return t.splitLines(n)[0].split(" ")[0].substring(2)},t.isRejected=function(n){return n.split(" ",2)[1]==="0"},t.parseMLine=function(n){const r=t.splitLines(n)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(n){const r=t.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;const i=t.splitLines(n);for(let r=0;r<i.length;r++)if(i[r].length<2||i[r].charAt(1)!=="=")return!1;return!0},e.exports=t})(fS)),fS.exports}var IB=Zre(),th=Ure(IB),ese=Xne({__proto__:null,default:th},[IB]);function X0(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(i){if(typeof i=="object"&&i.candidate&&i.candidate.indexOf("a=")===0&&(i=JSON.parse(JSON.stringify(i)),i.candidate=i.candidate.substring(2)),i.candidate&&i.candidate.length){const r=new t(i),s=th.parseCandidate(i.candidate);for(const l in s)l in r||Object.defineProperty(r,l,{value:s[l]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new t(i)},e.RTCIceCandidate.prototype=t.prototype,Bu(e,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new e.RTCIceCandidate(n.candidate),writable:"false"}),n))}function fN(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Bu(e,"icecandidate",t=>{if(t.candidate){const n=th.parseCandidate(t.candidate.candidate);n.type==="relay"&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return t})}function J0(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(c){if(!c||!c.sdp)return!1;const h=th.splitSections(c.sdp);return h.shift(),h.some(d=>{const f=th.parseMLine(d);return f&&f.kind==="application"&&f.protocol.indexOf("SCTP")!==-1})},i=function(c){const h=c.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(h===null||h.length<2)return-1;const d=parseInt(h[1],10);return d!==d?-1:d},r=function(c){let h=65536;return t.browser==="firefox"&&(t.version<57?c===-1?h=16384:h=2147483637:t.version<60?h=t.version===57?65535:65536:h=2147483637),h},s=function(c,h){let d=65536;t.browser==="firefox"&&t.version===57&&(d=65535);const f=th.matchPrefix(c.sdp,"a=max-message-size:");return f.length>0?d=parseInt(f[0].substring(19),10):t.browser==="firefox"&&h!==-1&&(d=2147483637),d},l=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser==="chrome"&&t.version>=76&&this.getConfiguration().sdpSemantics==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0}),n(arguments[0])){const h=i(arguments[0]),d=r(h),f=s(arguments[0],h);let p;d===0&&f===0?p=Number.POSITIVE_INFINITY:d===0||f===0?p=Math.max(d,f):p=Math.min(d,f);const v={};Object.defineProperty(v,"maxMessageSize",{get(){return p}}),this._sctp=v}return l.apply(this,arguments)}}function Z0(e,t){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype)||t.browser==="chrome"&&t.version>149||t.browser==="firefox"&&t.version>60)return;function n(r,s){const l=r.send;r.send=function(){const h=arguments[0],d=h.length||h.size||h.byteLength;if(r.readyState==="open"&&s.sctp&&d>s.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+s.sctp.maxMessageSize+" bytes)");return l.apply(r,arguments)}}const i=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const s=i.apply(this,arguments);return n(s,this),s},Bu(e,"datachannel",r=>(n(r.channel,r.target),r))}function mN(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const i=t[n];t[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=r=>{const s=r.target;if(s._lastConnectionState!==s.connectionState){s._lastConnectionState=s.connectionState;const l=new Event("connectionstatechange",r);s.dispatchEvent(l)}return r},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})}function pN(e,t){if(!e.RTCPeerConnection||t.browser==="chrome"&&t.version>=71||t.browser==="safari"&&t._safariVersion>=13.1)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(r){if(r&&r.sdp&&r.sdp.indexOf(`
659a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
660`).filter(l=>l.trim()!=="a=extmap-allow-mixed").join(`
661`);e.RTCSessionDescription&&r instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:r.type,sdp:s}):r.sdp=s}return n.apply(this,arguments)}}function ev(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const n=e.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function tv(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const n=e.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){let r=arguments[0]||{};if(typeof r!="object"||r.type&&r.sdp)return n.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer";break}return r.sdp||r.type!=="offer"&&r.type!=="answer"?n.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(l=>n.apply(this,[l]))})}var tse=Object.freeze({__proto__:null,removeExtmapAllowMixed:pN,shimAddIceCandidateNullOrEmpty:ev,shimConnectionState:mN,shimMaxMessageSize:J0,shimParameterlessSetLocalDescription:tv,shimRTCIceCandidate:X0,shimRTCIceCandidateRelayProtocol:fN,shimSendThrowTypeError:Z0});function nse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.window,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const i=EC,r=Xre(t),s={browserDetails:r,commonShim:tse,extractVersion:um,disableLog:Yre,disableWarnings:Qre,sdp:ese};switch(r.browser){case"chrome":if(!eR||!dN||!n.shimChrome)return i("Chrome shim is not included in this adapter release."),s;if(r.version===null)return i("Chrome shim can not determine version, not shimming."),s;i("adapter.js shimming chrome."),s.browserShim=eR,ev(t,r),tv(t),oB(t,r),lB(t),dN(t,r),cB(t,r),fB(t,r),uB(t),dB(t,r),mB(t,r),X0(t),fN(t),mN(t),J0(t,r),Z0(t,r),pN(t,r);break;case"firefox":if(!tR||!hN||!n.shimFirefox)return i("Firefox shim is not included in this adapter release."),s;i("adapter.js shimming firefox."),s.browserShim=tR,ev(t,r),tv(t),pB(t,r),hN(t,r),vB(t,r),gB(t),bB(t),xB(t),yB(t),wB(t),SB(t),kB(t),NB(t),jB(t),X0(t),mN(t),J0(t,r),Z0(t,r);break;case"safari":if(!nR||!n.shimSafari)return i("Safari shim is not included in this adapter release."),s;i("adapter.js shimming safari."),s.browserShim=nR,ev(t,r),tv(t),_B(t),RB(t),EB(t),CB(t),TB(t),MB(t),AB(t),OB(t),X0(t),fN(t),J0(t,r),Z0(t,r),pN(t,r);break;default:i("Unsupported browser!");break}return s}nse({window:typeof window>"u"?void 0:window});var gN,DB;class _r extends(DB=Promise){constructor(t){super(t)}catch(t){return super.catch(t)}static reject(t){return super.reject(t)}static all(t){return super.all(t)}static race(t){return super.race(t)}}gN=_r;_r.resolve=e=>Reflect.get(DB,"resolve",gN).call(gN,e);const ise=/version\/(\d+(\.?_?\d+)+)/i;let mS;function Or(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(mS===void 0||t){const i=rse.find(r=>r.test.test(n));mS=i==null?void 0:i.describe(n)}return mS}const rse=[{test:/firefox|iceweasel|fxios/i,describe(e){return{name:"Firefox",version:nv(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:pS(e)}}},{test:/chrom|crios|crmo/i,describe(e){return{name:"Chrome",version:nv(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("crios")?"iOS":void 0,osVersion:pS(e)}}},{test:/safari|applewebkit/i,describe(e){return{name:"Safari",version:nv(ise,e),os:e.includes("mobile/")?"iOS":"macOS",osVersion:pS(e)}}}];function nv(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const i=t.match(e);return i&&i.length>=n&&i[n]||""}function pS(e){return e.includes("mac os")?nv(/\(.+?(\d+_\d+(:?_\d+)?)/,e,1).replace(/_/g,"."):void 0}var sse="2.20.0";const ase=sse,ose=17,LB=0,$v=1,lse=$v;
661class rl extends Error{constructor(t,n,i){super(n||"an error has occurred"),this.name="LiveKitError",this.code=t,typeof(i==null?void 0:i.cause)<"u"&&(this.cause=i==null?void 0:i.cause)}}class Gs extends rl{}var vn;(function(e){e[e.NotAllowed=0]="NotAllowed",e[e.ServerUnreachable=1]="ServerUnreachable",e[e.InternalError=2]="InternalError",e[e.Cancelled=3]="Cancelled",e[e.LeaveRequest=4]="LeaveRequest",e[e.Timeout=5]="Timeout",e[e.WebSocket=6]="WebSocket",e[e.ServiceNotFound=7]="ServiceNotFound"})(vn||(vn={}));class at extends Gs{constructor(t,n,i,r){super(1,t),this.name="ConnectionError",this.status=i,this.reason=n,this.context=r,this.reasonName=vn[n]}static notAllowed(t,n,i){return new at(t,vn.NotAllowed,n,i)}static timeout(t){return new at(t,vn.Timeout)}static leaveRequest(t,n){return new at(t,vn.LeaveRequest,void 0,n)}static internal(t,n){return new at(t,vn.InternalError,void 0,n)}static cancelled(t){return new at(t,vn.Cancelled)}static serverUnreachable(t,n){return new at(t,vn.ServerUnreachable,n)}static websocket(t,n,i){return new at(t,vn.WebSocket,n,i)}static serviceNotFound(t,n){return new at(t,vn.ServiceNotFound,void 0,n)}}class PC extends rl{constructor(t){super(21,t??"device is unsupported"),this.name="DeviceUnsupportedError"}}class $o extends rl{constructor(t){super(20,t??"track is invalid"),this.name="TrackInvalidError"}}class cse extends rl{constructor(t){super(10,t??"unsupported server"),this.name="UnsupportedServer"}}class Vn extends rl{constructor(t){super(12,t??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class yu extends rl{constructor(t){super(13,t??"unable to negotiate"),this.name="NegotiationError"}}class use extends rl{constructor(t){super(14,t??"unable to publish data"),this.name="PublishDataError"}}class rR extends rl{constructor(t,n){super(15,t),this.name="PublishTrackError",this.status=n}}class sR extends Gs{constructor(t,n){super(15,t),this.name="SignalRequestError",this.reason=n,this.reasonName=typeof n=="string"?n:eu[n]}}var Cr;(function(e){e[e.AlreadyOpened=0]="AlreadyOpened",e[e.AbnormalEnd=1]="AbnormalEnd",e[e.DecodeFailed=2]="DecodeFailed",e[e.LengthExceeded=3]="LengthExceeded",e[e.Incomplete=4]="Incomplete",e[e.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",e[e.EncryptionTypeMismatch=8]="EncryptionTypeMismatch"})(Cr||(Cr={}));class Us extends Gs{constructor(t,n){super(16,t),this.name="DataStreamError",this.reason=n,this.reasonName=Cr[n]}}class Td extends rl{constructor(t){super(18,t),this.name="SignalReconnectError"}}var Vv;(function(e){e.PermissionDenied="PermissionDenied",e.NotFound="NotFound",e.DeviceInUse="DeviceInUse",e.Other="Other"})(Vv||(Vv={}));(function(e){function t(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?e.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?e.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?e.DeviceInUse:e.Other}e.getFailure=t})(Vv||(Vv={}));class yi{}yi.setTimeout=function(){return setTimeout(...arguments)};yi.setInterval=function(){return setInterval(...arguments)};yi.clearTimeout=function(){return clearTimeout(...arguments)};yi.clearInterval=function(){return clearInterval(...arguments)};var _e;(function(e){e.Connected="connected",e.Reconnecting="reconnecting",e.SignalReconnecting="signalReconnecting",e.Reconnected="reconnected",e.Disconnected="disconnected",e.ConnectionStateChanged="connectionStateChanged",e.Moved="moved",e.MediaDevicesChanged="mediaDevicesChanged",e.ParticipantConnected="participantConnected",e.ParticipantDisconnected="participantDisconnected",e.TrackPublished="trackPublished",e.TrackSubscribed="trackSubscribed",e.TrackSubscriptionFailed="trackSubscriptionFailed",e.TrackUnpublished="trackUnpublished",e.TrackUnsubscribed="trackUnsubscribed",e.TrackMuted="trackMuted",e.TrackUnmuted="trackUnmuted",e.LocalTrackPublished="localTrackPublished",e.LocalTrackUnpublished="localTrackUnpublished",e.LocalAudioSilenceDetected="localAudioSilenceDetected",e.ActiveSpeakersChanged="activeSpeakersChanged",e.ParticipantMetadataChanged="participantMetadataChanged",e.ParticipantNameChanged="participantNameChanged",e.ParticipantAttributesChanged="participantAttributesChanged",e.ParticipantActive="participantActive",e.RoomMetadataChanged="roomMetadataChanged",e.DataReceived="dataReceived",e.SipDTMFReceived="sipDTMFReceived",e.TranscriptionReceived="transcriptionReceived",e.ConnectionQualityChanged="connectionQualityChanged",e.TrackStreamStateChanged="trackStreamStateChanged",e.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",e.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",e.AudioPlaybackStatusChanged="audioPlaybackChanged",e.VideoPlaybackStatusChanged="videoPlaybackChanged",e.MediaDevicesError="mediaDevicesError",e.ParticipantPermissionsChanged="participantPermissionsChanged",e.SignalConnected="signalConnected",e.RecordingStatusChanged="recordingStatusChanged",e.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",e.EncryptionError="encryptionError",e.DCBufferStatusChanged="dcBufferStatusChanged",e.ActiveDeviceChanged="activeDeviceChanged",e.ChatMessage="chatMessage",e.LocalTrackSubscribed="localTrackSubscribed",e.MetricsReceived="metricsReceived",e.DataTrackPublished="dataTrackPublished",e.DataTrackUnpublished="dataTrackUnpublished",e.LocalDataTrackPublished="localDataTrackPublished",e.LocalDataTrackUnpublished="localDataTrackUnpublished"})(_e||(_e={}));var Ve;(function(e){e.TrackPublished="trackPublished",e.TrackSubscribed="trackSubscribed",e.TrackSubscriptionFailed="trackSubscriptionFailed",e.TrackUnpublished="trackUnpublished",e.TrackUnsubscribed="trackUnsubscribed",e.TrackMuted="trackMuted",e.TrackUnmuted="trackUnmuted",e.LocalTrackPublished="localTrackPublished",e.LocalTrackUnpublished="localTrackUnpublished",e.LocalTrackCpuConstrained="localTrackCpuConstrained",e.LocalSenderCreated="localSenderCreated",e.ParticipantMetadataChanged="participantMetadataChanged",e.ParticipantNameChanged="participantNameChanged",e.DataReceived="dataReceived",e.SipDTMFReceived="sipDTMFReceived",e.TranscriptionReceived="transcriptionReceived",e.IsSpeakingChanged="isSpeakingChanged",e.ConnectionQualityChanged="connectionQualityChanged",e.TrackStreamStateChanged="trackStreamStateChanged",e.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",e.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",e.TrackCpuConstrained="trackCpuConstrained",e.MediaDevicesError="mediaDevicesError",e.AudioStreamAcquired="audioStreamAcquired",e.ParticipantPermissionsChanged="participantPermissionsChanged",e.PCTrackAdded="pcTrackAdded",e.AttributesChanged="attributesChanged",e.LocalTrackSubscribed="localTrackSubscribed",e.ChatMessage="chatMessage",e.Active="active"})(Ve||(Ve={}));var Re;(function(e){e.TransportsCreated="transportsCreated",e.Connected="connected",e.Disconnected="disconnected",e.Resuming="resuming",e.Resumed="resumed",e.Restarting="restarting",e.Restarted="restarted",e.SignalResumed="signalResumed",e.SignalRestarted="signalRestarted",e.Closing="closing",e.MediaTrackAdded="mediaTrackAdded",e.ActiveSpeakersUpdate="activeSpeakersUpdate",e.DataPacketReceived="dataPacketReceived",e.RTPVideoMapUpdate="rtpVideoMapUpdate",e.DCBufferStatusChanged="dcBufferStatusChanged",e.ParticipantUpdate="participantUpdate",e.RoomUpdate="roomUpdate",e.SpeakersChanged="speakersChanged",e.StreamStateChanged="streamStateChanged",e.ConnectionQualityUpdate="connectionQualityUpdate",e.SubscriptionError="subscriptionError",e.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",e.RemoteMute="remoteMute",e.SubscribedQualityUpdate="subscribedQualityUpdate",e.LocalTrackUnpublished="localTrackUnpublished",e.LocalTrackSubscribed="localTrackSubscribed",e.Offline="offline",e.SignalRequestResponse="signalRequestResponse",e.SignalConnected="signalConnected",e.RoomMoved="roomMoved",e.PublishDataTrackResponse="publishDataTrackResponse",e.UnPublishDataTrackResponse="unPublishDataTrackResponse",e.DataTrackSubscriberHandles="dataTrackSubscriberHandles",e.DataTrackPacketReceived="dataTrackPacketReceived",e.Joined="joined",e.TokenRefreshed="tokenRefreshed",e.ServerRegionsReported="serverRegionsReported"})(Re||(Re={}));var Ue;(function(e){e.Message="message",e.Muted="muted",e.Unmuted="unmuted",e.Restarted="restarted",e.Ended="ended",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed",e.CpuConstrained="cpuConstrained",e.UpdateSettings="updateSettings",e.UpdateSubscription="updateSubscription",e.AudioPlaybackStarted="audioPlaybackStarted",e.AudioPlaybackFailed="audioPlaybackFailed",e.AudioSilenceDetected="audioSilenceDetected",e.VisibilityChanged="visibilityChanged",e.VideoDimensionsChanged="videoDimensionsChanged",e.VideoPlaybackStarted="videoPlaybackStarted",e.VideoPlaybackFailed="videoPlaybackFailed",e.ElementAttached="elementAttached",e.ElementDetached="elementDetached",e.UpstreamPaused="upstreamPaused",e.UpstreamResumed="upstreamResumed",e.SubscriptionPermissionChanged="subscriptionPermissionChanged",e.SubscriptionStatusChanged="subscriptionStatusChanged",e.SubscriptionFailed="subscriptionFailed",e.TrackProcessorUpdate="trackProcessorUpdate",e.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",e.TranscriptionReceived="transcriptionReceived",e.TimeSyncUpdate="timeSyncUpdate",e.PreConnectBufferFlushed="preConnectBufferFlushed"})(Ue||(Ue={}));function dse(e){return typeof e>"u"?e:typeof structuredClone=="function"?typeof e=="object"&&e!==null?structuredClone(Object.assign({},e)):structuredClone(e):JSON.parse(JSON.stringify(e))}class hn{constructor(t,n,i,r,s){if(typeof t=="object")this.width=t.width,this.height=t.height,this.aspectRatio=t.aspectRatio,this.encoding={maxBitrate:t.maxBitrate,maxFramerate:t.maxFramerate,priority:t.priority};else if(n!==void 0&&i!==void 0)this.width=t,this.height=n,this.aspectRatio=t/n,this.encoding={maxBitrate:i,maxFramerate:r,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const hse=["vp8","h264"],fse=["vp8","h264","vp9","av1","h265"];function UB(e){return!!hse.find(t=>t===e)}const mse=UB;var aR;(function(e){e[e.PREFER_REGRESSION=0]="PREFER_REGRESSION",e[e.SIMULCAST=1]="SIMULCAST",e[e.REGRESSION=2]="REGRESSION"}
vendor: 7,655 bytes, line 661
661)(aR||(aR={}));var vN;(function(e){e.telephone={maxBitrate:12e3},e.speech={maxBitrate:24e3},e.music={maxBitrate:48e3},e.musicStereo={maxBitrate:64e3},e.musicHighQuality={maxBitrate:96e3},e.musicHighQualityStereo={maxBitrate:128e3}})(vN||(vN={}));const Hm={h90:new hn(160,90,9e4,20),h180:new hn(320,180,16e4,20),h216:new hn(384,216,18e4,20),h360:new hn(640,360,45e4,20),h540:new hn(960,540,8e5,25),h720:new hn(1280,720,17e5,30),h1080:new hn(1920,1080,3e6,30),h1440:new hn(2560,1440,5e6,30),h2160:new hn(3840,2160,8e6,30)},xN={h120:new hn(160,120,7e4,20),h180:new hn(240,180,125e3,20),h240:new hn(320,240,14e4,20),h360:new hn(480,360,33e4,20),h480:new hn(640,480,5e5,20),h540:new hn(720,540,6e5,25),h720:new hn(960,720,13e5,30),h1080:new hn(1440,1080,23e5,30),h1440:new hn(1920,1440,38e5,30)},_C={h360fps3:new hn(640,360,2e5,3,"medium"),h360fps15:new hn(640,360,4e5,15,"medium"),h720fps5:new hn(1280,720,8e5,5,"medium"),h720fps15:new hn(1280,720,15e5,15,"medium"),h720fps30:new hn(1280,720,2e6,30,"medium"),h1080fps15:new hn(1920,1080,25e5,15,"medium"),h1080fps30:new hn(1920,1080,5e6,30,"medium"),original:new hn(0,0,7e6,30,"medium")};function BB(e,t,n){var i,r,s,l;const c=VB(e??{}),h=c.optionsWithoutProcessor,d=c.audioProcessor,f=c.videoProcessor,p=t==null?void 0:t.processor,v=n==null?void 0:n.processor,x=h??{};return x.audio===!0&&(x.audio={}),x.video===!0&&(x.video={}),x.audio&&(yN(x.audio,t),(i=(s=x.audio).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(d||p)&&(x.audio.processor=d??p)),x.video&&(yN(x.video,n),(r=(l=x.video).deviceId)!==null&&r!==void 0||(l.deviceId={ideal:"default"}),(f||v)&&(x.video.processor=f??v)),x}function yN(e,t){return Object.keys(t).forEach(n=>{e[n]===void 0&&(e[n]=t[n])}),e}function MC(e){var t,n,i,r;const s={};if(e.video)if(typeof e.video=="object"){const l={},c=l,h=e.video;Object.keys(h).forEach(d=>{switch(d){case"resolution":yN(c,h.resolution);break;default:c[d]=h[d]}}),s.video=l,(t=(i=s.video).deviceId)!==null&&t!==void 0||(i.deviceId={ideal:"default"})}else s.video=e.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return e.audio?typeof e.audio=="object"?(s.audio=e.audio,(n=(r=s.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function FB(e){return z(this,arguments,void 0,function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return(function*(){const i=$B();if(i){const r=i.createAnalyser();r.fftSize=2048;const s=r.frequencyBinCount,l=new Uint8Array(s);i.createMediaStreamSource(new MediaStream([t.mediaStreamTrack])).connect(r),yield br(n),r.getByteTimeDomainData(l);const h=l.some(d=>d!==128&&d!==0);return i.close(),!h}return!1})()})}function $B(){var e;const t=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(t){const n=new t({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((e=window.document)===null||e===void 0)&&e.body)){const i=()=>z(this,void 0,void 0,function*(){var r;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}finally{(r=window.document.body)===null||r===void 0||r.removeEventListener("click",i)}});n.addEventListener("statechange",()=>{var r;n.state==="closed"&&((r=window.document.body)===null||r===void 0||r.removeEventListener("click",i))}),window.document.body.addEventListener("click",i)}return n}}function pse(e){return e==="audioinput"?Ce.Source.Microphone:e==="videoinput"?Ce.Source.Camera:Ce.Source.Unknown}function bN(e){return e===Ce.Source.Microphone?"audioinput":e===Ce.Source.Camera?"videoinput":void 0}function gse(e){var t,n;let i=(t=e.video)!==null&&t!==void 0?t:!0;return e.resolution&&e.resolution.width>0&&e.resolution.height>0&&(i=typeof i=="boolean"?{}:i,Au()?i=Object.assign(Object.assign({},i),{width:{max:e.resolution.width},height:{max:e.resolution.height},frameRate:e.resolution.frameRate}):i=Object.assign(Object.assign({},i),{width:{ideal:e.resolution.width},height:{ideal:e.resolution.height},frameRate:e.resolution.frameRate})),{audio:(n=e.audio)!==null&&n!==void 0?n:!1,video:i,controller:e.controller,selfBrowserSurface:e.selfBrowserSurface,surfaceSwitching:e.surfaceSwitching,systemAudio:e.systemAudio,preferCurrentTab:e.preferCurrentTab}}function jm(e){return e.split("/")[1].toLowerCase()}function vse(e){const t=[];return e.forEach(n=>{n.track!==void 0&&t.push(new kC({cid:n.track.mediaStreamID,track:n.trackInfo}))}),t}function Ct(e){return"mediaStreamTrack"in e?{trackID:e.sid,source:e.source,muted:e.isMuted,enabled:e.mediaStreamTrack.enabled,kind:e.kind,streamID:e.mediaStreamID,streamTrackID:e.mediaStreamTrack.id}:{trackID:e.trackSid,enabled:e.isEnabled,muted:e.isMuted,trackInfo:Object.assign({mimeType:e.mimeType,name:e.trackName,encrypted:e.isEncrypted,kind:e.kind,source:e.source},e.track?Ct(e.track):{})}}function xse(){return typeof RTCRtpReceiver<"u"&&typeof RTCRtpReceiver.prototype.getSynchronizationSources=="function"}function yse(e,t){var n;e===void 0&&(e={}),t===void 0&&(t={});const i=[...Object.keys(t),...Object.keys(e)],r={};for(const s of i)e[s]!==t[s]&&(r[s]=(n=t[s])!==null&&n!==void 0?n:"");return r}function VB(e){const t=Object.assign({},e);let n,i;return typeof t.audio=="object"&&t.audio.processor&&(n=t.audio.processor,t.audio=Object.assign(Object.assign({},t.audio),{processor:void 0})),typeof t.video=="object"&&t.video.processor&&(i=t.video.processor,t.video=Object.assign(Object.assign({},t.video),{processor:void 0})),{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:dse(t)}}function bse(e){switch(e){case vi.CAMERA:return Ce.Source.Camera;case vi.MICROPHONE:return Ce.Source.Microphone;case vi.SCREEN_SHARE:return Ce.Source.ScreenShare;case vi.SCREEN_SHARE_AUDIO:return Ce.Source.ScreenShareAudio;default:return Ce.Source.Unknown}}function oR(e,t){return e.width*e.height<t.width*t.height}function wse(e,t){var n;return(n=e.layers)===null||n===void 0?void 0:n.find(i=>i.quality===t)}const Sse=5e3,Vf=[];var ps;(function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=1]="MEDIUM",e[e.HIGH=2]="HIGH"})(ps||(ps={}));class Ce extends ts.EventEmitter{get streamState(){return this._streamState}setStreamState(t){this._streamState=t}constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=Ce.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=vt,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Sse):this.handleAppVisibilityChanged()},this.log=es((r=i.loggerName)!==null&&r!==void 0?r:zi.Track),this.loggerContextCb=i.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=t,this._mediaStreamID=t.id,this.source=Ce.Source.Unknown}get logContext(){var t;return Object.assign(Object.assign({},(t=this.loggerContextCb)===null||t===void 0?void 0:t.call(this)),Ct(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(t){let n="audio";this.kind===Ce.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===Ce.Kind.Video&&this.addAppVisibilityListener(),t||(n==="audio"&&(Vf.forEach(s=>{s.parentElement===null&&!t&&(t=s)}),t&&Vf.splice(Vf.indexOf(t),1)),t||(t=document.createElement(n))),this.attachedElements.includes(t)||this.attachedElements.push(t),Kd(this.mediaStreamTrack,t);const i=t.srcObject.getTracks(),r=i.some(s=>s.kind==="audio");return t.play().then(()=>
661{this.emit(r?Ue.AudioPlaybackStarted:Ue.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(r?Ue.AudioPlaybackFailed:Ue.VideoPlaybackFailed,s):s.name==="AbortError"?vt.debug("".concat(r?"audio":"video"," playback aborted, likely due to new play request")):vt.warn("could not playback ".concat(r?"audio":"video"),s),r&&t&&i.some(l=>l.kind==="video")&&s.name==="NotAllowedError"&&(t.muted=!0,t.play().catch(()=>{}))}),this.emit(Ue.ElementAttached,t),t}detach(t){try{if(t){nh(this.mediaStreamTrack,t);const i=this.attachedElements.indexOf(t);return i>=0&&(this.attachedElements.splice(i,1),this.recycleElement(t),this.emit(Ue.ElementDetached,t)),t}const n=[];return this.attachedElements.forEach(i=>{nh(this.mediaStreamTrack,i),n.push(i),this.recycleElement(i),this.emit(Ue.ElementDetached,i)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(t){t.loggerName&&(this.log=es(t.loggerName)),t.loggerContextCb&&(this.loggerContextCb=t.loggerContextCb)}recycleElement(t){if(t instanceof HTMLAudioElement){let n=!0;t.pause(),Vf.forEach(i=>{i.parentElement||(n=!1)}),n&&Vf.push(t)}}handleAppVisibilityChanged(){return z(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===Ce.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(t=>t.play().catch(()=>{})),0)})}addAppVisibilityListener(){Xr()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Xr()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Kd(e,t){let n;t.srcObject instanceof MediaStream?n=t.srcObject:n=new MediaStream;let i;e.kind==="audio"?i=n.getAudioTracks():i=n.getVideoTracks(),i.includes(e)||(i.forEach(r=>{n.removeTrack(r)}),n.addTrack(e)),(!Au()||!(t instanceof HTMLVideoElement))&&(t.autoplay=!0),t.muted=n.getAudioTracks().length===0,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==n&&(t.srcObject=n,(Au()||Eu())&&t instanceof HTMLVideoElement&&setTimeout(()=>{t.srcObject=n,t.play().catch(()=>{})},0))}function nh(e,t){if(t.srcObject instanceof MediaStream){const n=t.srcObject;n.removeTrack(e),n.getTracks().length>0?t.srcObject=n:t.srcObject=null}}(function(e){let t;(function(d){d.Audio="audio",d.Video="video",d.Unknown="unknown"})(t=e.Kind||(e.Kind={}));let n;(function(d){d.Camera="camera",d.Microphone="microphone",d.ScreenShare="screen_share",d.ScreenShareAudio="screen_share_audio",d.Unknown="unknown"})(n=e.Source||(e.Source={}));let i;(function(d){d.Active="active",d.Paused="paused",d.Unknown="unknown"})(i=e.StreamState||(e.StreamState={}));function r(d){switch(d){case t.Audio:return la.AUDIO;case t.Video:return la.VIDEO;default:return la.DATA}}e.kindToProto=r;function s(d){switch(d){case la.AUDIO:return t.Audio;case la.VIDEO:return t.Video;default:return t.Unknown}}e.kindFromProto=s;function l(d){switch(d){case n.Camera:return vi.CAMERA;case n.Microphone:return vi.MICROPHONE;case n.ScreenShare:return vi.SCREEN_SHARE;case n.ScreenShareAudio:return vi.SCREEN_SHARE_AUDIO;default:return vi.UNKNOWN}}e.sourceToProto=l;function c(d){switch(d){case vi.CAMERA:return n.Camera;case vi.MICROPHONE:return n.Microphone;case vi.SCREEN_SHARE:return n.ScreenShare;case vi.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}e.sourceFromProto=c;function h(d){switch(d){case aN.ACTIVE:return i.Active;case aN.PAUSED:return i.Paused;default:return i.Unknown}}e.streamStateFromProto=h})(Ce||(Ce={}));const kse="|",lR="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function Nse(e){const t=e.split(kse);return t.length>1?[t[0],e.substr(t[0].length+1)]:[e,""]}function br(e){return new _r(t=>yi.setTimeout(t,e))}function wN(){return"addTransceiver"in RTCPeerConnection.prototype}function SN(){return"addTrack"in RTCPeerConnection.prototype}function jse(){if(!("getCapabilities"in RTCRtpSender)||Au()||Eu())return!1;const e=RTCRtpSender.getCapabilities("video");let t=!1;if(e){for(const n of e.codecs)if(n.mimeType.toLowerCase()==="video/av1"){t=!0;break}}return t}function Cse(){if(!("getCapabilities"in RTCRtpSender)||Eu())return!1;if(Au()){const n=Or();if(n!=null&&n.version&&ro(n.version,"16")<0||(n==null?void 0:n.os)==="iOS"&&(n!=null&&n.osVersion)&&ro(n.osVersion,"16")<0)return!1}const e=RTCRtpSender.getCapabilities("video");let t=!1;if(e){for(const n of e.codecs)if(n.mimeType.toLowerCase()==="video/vp9"){t=!0;break}}return t}function da(e){return e==="av1"||e==="vp9"}function kN(e){return!document||Km()?!1:(e||(e=document.createElement("audio")),"setSinkId"in e)}function Tse(){return typeof RTCPeerConnection>"u"?!1:wN()||SN()}function Eu(){var e;return((e=Or())===null||e===void 0?void 0:e.name)==="Firefox"}function Ese(){const e=Or();return!!e&&e.name==="Chrome"&&e.os!=="iOS"}function NN(){return typeof window<"u"&&typeof window.RTCRtpScriptTransform<"u"&&!Ese()}function Au(){var e;return((e=Or())===null||e===void 0?void 0:e.name)==="Safari"}function Km(){const e=Or();return(e==null?void 0:e.name)==="Safari"||(e==null?void 0:e.os)==="iOS"}function Ase(){const e=Or();return(e==null?void 0:e.name)==="Safari"&&e.version.startsWith("17.")||(e==null?void 0:e.os)==="iOS"&&!!(e!=null&&e.osVersion)&&ro(e.osVersion,"17")>=0}function Pse(e){return e||(e=Or()),(e==null?void 0:e.name)==="Safari"&&ro(e.version,"18.3")>0||(e==null?void 0:e.os)==="iOS"&&!!(e!=null&&e.osVersion)&&ro(e.osVersion,"18.3")>0}function zB(){var e,t;return Xr()?(t=(e=navigator.userAgentData)===null||e===void 0?void 0:e.mobile)!==null&&t!==void 0?t:
vendor: 2,137 bytes, line 661
661/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function _se(){const e=Or(),t="17.2";if(e)return e.name!=="Safari"&&e.os!=="iOS"||e.os==="iOS"&&e.osVersion&&ro(e.osVersion,t)>=0?!0:e.name==="Safari"&&ro(e.version,t)>=0}function Xr(){return typeof document<"u"}function ja(){return navigator.product=="ReactNative"}function vh(e){return e.hostname.endsWith(".livekit.cloud")||e.hostname.endsWith(".livekit.run")}function gS(e){return vh(e)?e.hostname.split(".")[0]:null}function qB(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function WB(){if(!ja())return;let e=qB();if(e)return e.platform}function cR(){if(Xr())return window.devicePixelRatio;if(ja()){let e=qB();if(e)return e.devicePixelRatio}return 1}function ro(e,t){const n=e.split("."),i=t.split("."),r=Math.min(n.length,i.length);for(let s=0;s<r;++s){const l=parseInt(n[s],10),c=parseInt(i[s],10);if(l>c)return 1;if(l<c)return-1;if(s===r-1&&l===c)return 0}return e===""&&t!==""?-1:t===""?1:n.length==i.length?0:n.length<i.length?-1:1}function Mse(e){for(const t of e)t.target.handleResize(t)}function Rse(e){for(const t of e)t.target.handleVisibilityChanged(t)}let vS=null;const uR=()=>(vS||(vS=new ResizeObserver(Mse)),vS);let xS=null;const dR=()=>(xS||(xS=new IntersectionObserver(Rse,{root:null,rootMargin:"0px"})),xS);function Ose(e){var t;const n=new BU({capabilities:e,sdk:FU.JS,protocol:ose,clientProtocol:lse,version:ase});return ja()&&(n.os=(t=WB())!==null&&t!==void 0?t:""),n}function hR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const r=document.createElement("canvas");r.width=e,r.height=t;const s=r.getContext("2d");s==null||s.fillRect(0,0,r.width,r.height),i&&s&&(s.beginPath(),s.arc(e/2,t/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const c=r.captureStream().getTracks(),h=tt(c,1),d=h[0];if(!d)throw Error("Could not get empty media stream video track");return d.enabled=n,d}let zf;
661function yS(){if(!zf){const n=new AudioContext,i=n.createOscillator(),r=n.createGain();r.gain.setValueAtTime(0,0);const s=n.createMediaStreamDestination();i.connect(r),r.connect(s),i.start();var e=s.stream.getAudioTracks(),t=tt(e,1);if(zf=t[0],!zf)throw Error("Could not get empty media stream audio track");zf.enabled=!1}return zf.clone()}class Fi{get isResolved(){return this._isResolved}constructor(t,n){this._isResolved=!1,this.onFinally=n,this.promise=new Promise((i,r)=>z(this,void 0,void 0,function*(){this.resolve=i,this.reject=r,t&&(yield t(i,r))})).finally(()=>{var i;this._isResolved=!0,(i=this.onFinally)===null||i===void 0||i.call(this)})}}function Ise(e){return fse.includes(e)}function bu(e){if(typeof e=="string"||typeof e=="number")return e;if(Array.isArray(e))return e[0];if(e.exact!==void 0)return Array.isArray(e.exact)?e.exact[0]:e.exact;if(e.ideal!==void 0)return Array.isArray(e.ideal)?e.ideal[0]:e.ideal;throw Error("could not unwrap constraint")}function Dse(e){return e.startsWith("http")?e.replace(/^(http)/,"ws"):e}function Gm(e){return e.startsWith("ws")?e.replace(/^(ws)/,"http"):e}function Lse(e,t){return e.segments.map(n=>{let i=n.id,r=n.text,s=n.language,l=n.startTime,c=n.endTime,h=n.final;var d;const f=(d=t.get(i))!==null&&d!==void 0?d:Date.now(),p=Date.now();return h?t.delete(i):t.set(i,f),{id:i,text:r,startTime:Number.parseInt(l.toString()),endTime:Number.parseInt(c.toString()),final:h,language:s,firstReceivedTime:f,lastReceivedTime:p}})}function Use(e){const t=e.id,n=e.timestamp,i=e.message,r=e.editTimestamp;return{id:t,timestamp:Number.parseInt(n.toString()),editTimestamp:r?Number.parseInt(r.toString()):void 0,message:i}}function fR(e){switch(e.reason){case vn.LeaveRequest:return e.context;case vn.Cancelled:return ya.CLIENT_INITIATED;case vn.NotAllowed:return ya.USER_REJECTED;case vn.ServerUnreachable:return ya.JOIN_FAILURE;default:return ya.UNKNOWN_REASON}}function iv(e){return e!==void 0?Number(e):void 0}function Gc(e){return e!==void 0?BigInt(e):void 0}function ih(e){return!!e&&!(e instanceof MediaStreamTrack)&&e.isLocal}function eo(e){return!!e&&e.kind==Ce.Kind.Audio}function Jo(e){return!!e&&e.kind==Ce.Kind.Video}function Ia(e){return ih(e)&&Jo(e)}function Ro(e){return ih(e)&&eo(e)}function jN(e){return!!e&&!e.isLocal}function Bse(e){return!!e&&!e.isLocal}function bS(e){return jN(e)&&Jo(e)}function Fse(e){return e.isLocal}function $se(e,t){const n=[];let i=new TextEncoder().encode(e);for(;i.length>t;){let r=t;for(;r>0;){const s=i[r];if(s!==void 0&&(s&192)!==128)break;r--}n.push(i.slice(0,r)),i=i.slice(r)}return i.length>0&&n.push(i),n}function Vse(e){var t;const n=e.get("Cache-Control");if(n){const i=(t=n.match(/(?:^|[,\s])max-age=(\d+)/))===null||t===void 0?void 0:t[1];if(i)return parseInt(i,10)}}function HB(){return typeof CompressionStream<"u"}function zse(){return HB()&&!Eu()}function qse(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=Wse(e,t);return n?i:RC(i,"v1")}function Wse(e,t){const n=new URL(Dse(e));return t.forEach((i,r)=>{n.searchParams.set(r,i)}),RC(n,"rtc")}function Hse(e){const t=new URL(Gm(e));return RC(t,"validate")}function KB(e){return e.endsWith("/")?e:"".concat(e,"/")}function RC(e,t){return e.pathname="".concat(KB(e.pathname)).concat(t),e}function mR(e){if(typeof e=="string")return KM.fromJson(JSON.parse(e),{ignoreUnknownFields:!0});if(e instanceof ArrayBuffer)return KM.fromBinary(new Uint8Array(e));throw new Error("could not decode websocket message: ".concat(typeof e))}function Kse(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Unknown reason";if(!(e instanceof AbortSignal))return t;const n=e.reason;switch(typeof n){case"string":return n;case"object":return n instanceof Error?n.message:t;default:return"toString"in n?n.toString():t}}const Gse=10,qf="lk_e2ee",Yse="LKFrameEncryptionKey",Qse={sharedKey:!1,ratchetSalt:Yse,ratchetWindowSize:8,failureTolerance:Gse,keyringSize:16,keySize:128};var ac;(function(e){e.SetKey="setKey",e.RatchetRequest="ratchetRequest",e.KeyRatcheted="keyRatcheted"})(ac||(ac={}));var pR;(function(e){e.KeyRatcheted="keyRatcheted"})(pR||(pR={}));var ec;(function(e){e.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",e.EncryptionError="encryptionError"})(ec||(ec={}));var gR;(function(e){e.Error="cryptorError"})(gR||(gR={}));function Xse(){return OC()||Jse()}function Jse(){return typeof window<"u"&&typeof window.RTCRtpScriptTransform<"u"}function OC(){return typeof window<"u"&&typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function Zse(e){var t,n,i,r,s;if(((t=e.value)===null||t===void 0?void 0:t.case)!=="sipDtmf"&&((n=e.value)===null||n===void 0?void 0:n.case)!=="metrics"&&((i=e.value)===null||i===void 0?void 0:i.case)!=="speaker"&&((r=e.value)===null||r===void 0?void 0:r.case)!=="transcription"&&((s=e.value)===null||s===void 0?void 0:s.case)!=="encryptedPacket")return new MU({value:e.value})}class nTe extends ts.EventEmitter{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.latestManuallySetKeyIndex=0,this.onKeyRatcheted=(n,i,r)=>{vt.debug("key ratcheted event received",{ratchetResult:n,participantId:i,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Qse),t),this.on(ac.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(t,n,i){const r={key:t,participantIdentity:n,keyIndex:i};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(i??0),r),i!==void 0&&(this.latestManuallySetKeyIndex=i),this.emit
661(ac.SetKey,r,i!==void 0)}getKeys(){return Array.from(this.keyInfoMap.values())}getLatestManuallySetKeyIndex(){return this.latestManuallySetKeyIndex}getOptions(){return this.options}ratchetKey(t,n){this.emit(ac.RatchetRequest,t,n)}}var vR;(function(e){e[e.InvalidKey=0]="InvalidKey",e[e.MissingKey=1]="MissingKey",e[e.InternalError=2]="InternalError"})(vR||(vR={}));function Ym(){return NN()}function Qm(e){return!!(e!=null&&e.worker)&&(OC()||Ym())}function zv(e){return!!(e!=null&&e.timestamp||e!=null&&e.frameId)}function eae(e){const t=[];return e!=null&&e.timestamp&&t.push(ph.PTF_USER_TIMESTAMP),e!=null&&e.frameId&&t.push(ph.PTF_FRAME_ID),t}function tae(e){if(!e||e.length===0)return;const t={};return e.includes(ph.PTF_USER_TIMESTAMP)&&(t.timestamp=!0),e.includes(ph.PTF_FRAME_ID)&&(t.frameId=!0),t.timestamp||t.frameId?t:void 0}function IC(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:50,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i,r;let s;const l=(i=n.isImmediate)!==null&&i!==void 0?i:!1,c=(r=n.callback)!==null&&r!==void 0?r:!1,h=n.maxWait;let d=Date.now(),f=[];function p(){if(h!==void 0){const x=Date.now()-d;if(x+t>=h)return h-x}return t}const v=function(){for(var x=arguments.length,b=new Array(x),S=0;S<x;S++)b[S]=arguments[S];const N=this;return new Promise((j,T)=>{const E=function(){if(s=void 0,d=Date.now(),!l){const P=e.apply(N,b);c&&c(P),f.forEach(A=>{let M=A.resolve;return M(P)}),f=[]}},C=l&&s===void 0;if(s!==void 0&&yi.clearTimeout(s),s=yi.setTimeout(E,p()),C){const P=e.apply(N,b);return c&&c(P),j(P)}f.push({resolve:j,reject:T})})};return v.cancel=function(x){s!==void 0&&yi.clearTimeout(s),f.forEach(b=>{let S=b.reject;return S(x)}),f=[]},v}const DC=2e3;function by(e,t){if(!t)return 0;let n,i;return"bytesReceived"in e?(n=e.bytesReceived,i=t.bytesReceived):"bytesSent"in e&&(n=e.bytesSent,i=t.bytesSent),n===void 0||i===void 0||e.timestamp===void 0||t.timestamp===void 0?0:(n-i)*8*1e3/(e.timestamp-t.timestamp)}class GB extends Ce{constructor(t,n,i,r,s){super(t,i,s),this.sid=n,this.receiver=r}get isLocal(){return!1}setMuted(t){this.isMuted!==t&&(this.isMuted=t,this._mediaStreamTrack.enabled=!t,this.emit(t?Ue.Muted:Ue.Unmuted,this))}setMediaStream(t){this.mediaStream=t;const n=i=>{i.track===this._mediaStreamTrack&&(t.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(Ue.Ended,this))};t.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return z(this,void 0,void 0,function*(){var t;return!((t=this.receiver)===null||t===void 0)&&t.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(t){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=t:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),DC)),xse()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const t=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>t());const i=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(i){const r=i.timestamp,s=i.rtpTimestamp;s&&this.rtpTimestamp!==s&&(this.emit(Ue.TimeSyncUpdate,{timestamp:r,rtpTimestamp:s}),this.rtpTimestamp=s)}};t()}}const wS=100;class LC extends GB{constructor(t,n,i,r,s){super(t,n,Ce.Kind.Video,i,s),this.elementInfos=[],this.monitorReceiver=()=>z(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const l=yield this.getReceiverStats();l&&this.prevStats&&this.receiver&&(this._currentBitrate=by(l,this.prevStats)),this.prevStats=l}),this.debouncedHandleResize=IC(()=>{this.updateDimensions()},wS),this.adaptiveStreamSettings=r}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}lookupFrameMetadata(t){let n=t.rtpTimestamp;var i;return(i=this.frameMetadataExtractor)===null||i===void 0?void 0:i.lookupMetadata(n)}setStreamState(t){super.setStreamState(t),this.log.debug("setStreamState",t),this.isAdaptiveStream&&t===Ce.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}
vendor: 4,750 bytes, line 661
661setMuted(t){super.setMuted(t),this.attachedElements.forEach(n=>{t?nh(this._mediaStreamTrack,n):Kd(this._mediaStreamTrack,n)})}attach(t){if(t?super.attach(t):t=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===t)===void 0){const n=new nae(t);this.observeElementInfo(n)}return t}observeElementInfo(t){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===t)===void 0?(t.handleResize=()=>{this.debouncedHandleResize()},t.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(t),t.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(t){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(i=>i===t);for(const i of n)i.stopObserving();this.elementInfos=this.elementInfos.filter(i=>i!==t),this.updateVisibility(),this.debouncedHandleResize()}detach(t){if(t)return this.stopObservingElement(t),super.detach(t);const n=super.detach();for(const i of n)this.stopObservingElement(i);return n}getDecoderImplementation(){var t;return(t=this.prevStats)===null||t===void 0?void 0:t.decoderImplementation}getReceiverStats(){return z(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const t=yield this.receiver.getStats();let n,i="",r=new Map;return t.forEach(s=>{s.type==="inbound-rtp"?(i=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&r.set(s.id,s)}),n&&i!==""&&r.get(i)&&(n.mimeType=r.get(i).mimeType),n})}stopObservingElement(t){const n=this.elementInfos.filter(i=>i.element===t);for(const i of n)this.stopObservingElementInfo(i)}handleAppVisibilityChanged(){const t=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return z(this,void 0,void 0,function*(){yield t.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(t){var n,i;const r=this.elementInfos.reduce((h,d)=>Math.max(h,d.visibilityChangedAt||0),0),s=!((i=(n=this.adaptiveStreamSettings)===null||n===void 0?void 0:n.pauseVideoInBackground)!==null&&i!==void 0)||i?this.isInBackground:!1,l=this.elementInfos.some(h=>h.pictureInPicture),c=this.elementInfos.some(h=>h.visible)&&!s||l;if(!(this.lastVisible===c&&!t)){if(!c&&Date.now()-r<wS){yi.setTimeout(()=>{this.updateVisibility()},wS);return}this.lastVisible=c,this.emit(Ue.VisibilityChanged,c,this)}}updateDimensions(){var t,n;let i=0,r=0;const s=this.getPixelDensity();for(const l of this.elementInfos){const c=l.width()*s,h=l.height()*s;c+h>i+r&&(i=c,r=h)}((t=this.lastDimensions)===null||t===void 0?void 0:t.width)===i&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===r||(this.lastDimensions={width:i,height:r},this.emit(Ue.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var t;const n=(t=this.adaptiveStreamSettings)===null||t===void 0?void 0:t.pixelDensity;return n==="screen"?cR():n||(cR()>2?2:1)}}class nae{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(t,n){this.onVisibilityChanged=i=>{var r;const s=i.target,l=i.isIntersecting;s===this.element&&(this.isIntersecting=l,this.isPiP=Wf(this.element),this.visibilityChangedAt=Date.now(),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this))},this.onEnterPiP=()=>{var i,r;(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP),queueMicrotask(()=>{requestAnimationFrame(()=>{var s;this.isPiP=Wf(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)})})},this.onLeavePiP=()=>{var i;this.isPiP=Wf(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.element=t,this.isIntersecting=n??CN(t),this.isPiP=Xr()&&Wf(t),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var t,n,i;this.isIntersecting=CN(this.element),this.isPiP=Wf(this.element),this.element.handleResize=()=>{var r;(r=this.handleResize)===null||r===void 0||r.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,dR().observe(this.element),uR().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterP
661iP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(t=window.documentPictureInPicture)===null||t===void 0||t.addEventListener("enter",this.onEnterPiP),(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var t,n,i,r,s;(t=dR())===null||t===void 0||t.unobserve(this.element),(n=uR())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(i=window.documentPictureInPicture)===null||i===void 0||i.removeEventListener("enter",this.onEnterPiP),(s=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function Wf(e){var t,n;return document.pictureInPictureElement===e?!0:!((t=window.documentPictureInPicture)===null||t===void 0)&&t.window?CN(e,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function CN(e,t){const n=t||window;let i=e.offsetTop,r=e.offsetLeft;const s=e.offsetWidth,l=e.offsetHeight,c=e,h=c.hidden,d=getComputedStyle(e),f=d.display;for(;e.offsetParent;)e=e.offsetParent,i+=e.offsetTop,r+=e.offsetLeft;return i<n.pageYOffset+n.innerHeight&&r<n.pageXOffset+n.innerWidth&&i+l>n.pageYOffset&&r+s>n.pageXOffset&&!h&&f!=="none"}class iae extends ts.EventEmitter{constructor(t,n){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=i=>{var r,s;const l=i.data,c=l.kind,h=l.data;switch(c){case"error":if(vt.error(h.error.message),h.uuid){const p=this.decryptDataRequests.get(h.uuid);if(p!=null&&p.reject){p.reject(h.error);break}const v=this.encryptDataRequests.get(h.uuid);if(v!=null&&v.reject){v.reject(h.error);break}}this.emit(ec.EncryptionError,h.error,h.participantIdentity);break;case"initAck":h.enabled&&this.keyProvider.getKeys().forEach(p=>{this.postKey(p,!1)});break;case"enable":if(h.enabled&&this.keyProvider.getKeys().forEach(p=>{this.postKey(p,!1)}),this.encryptionEnabled!==h.enabled&&h.participantIdentity===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity))this.emit(ec.ParticipantEncryptionStatusChanged,h.enabled,this.room.localParticipant),this.encryptionEnabled=h.enabled;else if(h.participantIdentity){const p=(s=this.room)===null||s===void 0?void 0:s.getParticipantByIdentity(h.participantIdentity);if(!p)throw TypeError("couldn't set encryption status, participant not found".concat(h.participantIdentity));this.emit(ec.ParticipantEncryptionStatusChanged,h.enabled,p)}break;case"ratchetKey":this.keyProvider.emit(ac.KeyRatcheted,h.ratchetResult,h.participantIdentity,h.keyIndex);break;case"decryptDataResponse":const d=this.decryptDataRequests.get(h.uuid);d!=null&&d.resolve&&d.resolve(h);break;case"encryptDataResponse":const f=this.encryptDataRequests.get(h.uuid);f!=null&&f.resolve&&f.resolve(h);break;case"packetTrailerMetadata":this.handleFrameMetadata(h.trackId,h.rtpTimestamp,h.ssrc,h.metadata);break}},this.onWorkerError=i=>{vt.error("e2ee worker encountered an error:",{error:i.error}),this.emit(ec.EncryptionError,i.error,void 0)},this.keyProvider=t.keyProvider,this.worker=t.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=n}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}
661setup(t){if(!Xse())throw new PC("tried to setup end-to-end encryption on an unsupported browser");if(vt.info("setting up e2ee"),t!==this.room){this.room=t,this.setupEventListeners(t,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Vre.getLevel()}};this.worker&&(vt.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(t,n){vt.debug("set e2ee to ".concat(t," for participant ").concat(n)),this.postEnable(t,n)}setSifTrailer(t){!t||t.length===0?vt.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(t)}handleFrameMetadata(t,n,i,r){if(this.room){for(const s of[this.room.localParticipant,...this.room.remoteParticipants.values()])for(const l of s.trackPublications.values())if(l.track&&l.track.mediaStreamID===t&&l.track instanceof LC&&l.track.frameMetadataExtractor){l.track.frameMetadataExtractor.storeMetadata(n,i,r);return}}}setupEngine(t){t.on(Re.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(t,n){t.on(_e.TrackPublished,(i,r)=>this.setParticipantCryptorEnabled(i.trackInfo.encryption!==xn.NONE,r.identity)),t.on(_e.ConnectionStateChanged,i=>
661{i===Gt.Connected&&t.remoteParticipants.forEach(r=>{r.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==xn.NONE,r.identity)})})}).on(_e.TrackUnsubscribed,(i,r,s)=>{var l;const c={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:i.mediaStreamID}};(l=this.worker)===null||l===void 0||l.postMessage(c)}).on(_e.TrackSubscribed,(i,r,s)=>{this.setupE2EEReceiver(i,s.identity,r.trackInfo)}).on(_e.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");const i=n.getLatestManuallySetKeyIndex();n.getKeys().forEach(r=>{var s;this.postKey(r,i===((s=r.keyIndex)!==null&&s!==void 0?s:0))}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),t.localParticipant.on(Ve.LocalSenderCreated,(i,r)=>z(this,void 0,void 0,function*(){this.setupE2EESender(r,i)})),t.localParticipant.on(Ve.LocalTrackPublished,i=>{if(!Jo(i.track)||!Km())return;const r={kind:"updateCodec",data:{trackId:i.track.mediaStreamID,codec:jm(i.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity,hasPacketTrailer:!1}};this.worker.postMessage(r)}),n.on(ac.SetKey,(i,r)=>this.postKey(i,r??!0)).on(ac.RatchetRequest,(i,r)=>this.postRatchetRequest(i,r))}encryptData(t){return z(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const n=crypto.randomUUID(),i={kind:"encryptDataRequest",data:{uuid:n,payload:t,participantIdentity:this.room.localParticipant.identity}},r=new Fi;return r.onFinally=()=>{this.encryptDataRequests.delete(n)},this.encryptDataRequests.set(n,r),this.worker.postMessage(i),r.promise})}handleEncryptedData(t,n,i,r){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const s=crypto.randomUUID(),l={kind:"decryptDataRequest",data:{uuid:s,payload:t,iv:n,participantIdentity:i,keyIndex:r}},c=new Fi;return c.onFinally=()=>{this.decryptDataRequests.delete(s)},this.decryptDataRequests.set(s,c),this.worker.postMessage(l),c.promise}postRatchetRequest(t,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const i={kind:"ratchetRequest",data:{participantIdentity:t,keyIndex:n}};this.worker.postMessage(i)}postKey(t,n){let i=t.key,r=t.participantIdentity,s=t.keyIndex;var l;if(!this.worker)throw Error("could not set key, worker is missing");const c={kind:"setKey",data:{participantIdentity:r,isPublisher:r===((l=this.room)===null||l===void 0?void 0:l.localParticipant.identity),key:i,keyIndex:s,updateCurrentKeyIndex:n}};this.worker.postMessage(c)}postEnable(t,n){if(this.worker){const i={kind:"enable",data:{enabled:t,participantIdentity:n}};this.worker.postMessage(i)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(t){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const i={kind:"setRTPMap",data:{map:t,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}postSifTrailer(t){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:t}};this.worker.postMessage(n)}setupE2EEReceiver(t,n,i){if(!t.receiver)return;if(!(i!=null&&i.mimeType)||i.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");const r=t.kind==="video"&&!!i.packetTrailerFeatures&&i.packetTrailerFeatures.length>0;this.handleReceiver(t.receiver,t.mediaStreamID,n,t.kind==="video"?jm(i.mimeType):void 0,r)}setupE2EESender(t,n){var i,r,s;if(!ih(t)||!n){n||vt.warn("early return because sender is not ready");return}this.handleSender(n,t.mediaStreamID,void 0,Jo(t)?(r=(i=t.publishOptions)===null||i===void 0?void 0:i.frameMetadata)!==null&&r!==void 0?r:(s=t.publishOptions)===null||s===void 0?void 0:s.packetTrailer:void 0)}handleReceiver(t,n,i,r,s){return z(this,void 0,void 0,function*(){if(this.worker){if(NN()){const l={kind:"decode",participantIdentity:i,trackId:n,codec:r,hasPacketTrailer:s};t.transform=new RTCRtpScriptTransform(this.worker,l)}else{if(qf in t&&r){const d={kind:"updateCodec",data:{trackId:n,codec:r,participantIdentity:i,hasPacketTrailer:s}};this.worker.postMessage(d);return}let l=t.writableStream,c=t.readableStream;if(!l||!c){const d=t.createEncodedStreams();t.writableStream=d.writable,l=d.writable,t.readableStream=d.readable,c=d.readable}const h={kind:"decode",data:{readableStream:c,writableStream:l,trackId:n,codec:r,participantIdentity:i,isReuse:qf in t,hasPacketTrailer:s}};this.worker.postMessage(h,[c,l])}t[qf]=!0}})}handleSender(t,n,i,r){var s;if(!(qf in t||!this.worker)){if(!(!((s=this.room)===null||s===void 0)&&s.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(NN()){vt.info("initialize script transform");const l={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:i,hasPacketTrailer:zv(r),packetTrailer:r};t.transform=new RTCRtpScriptTransform(this.worker,l)}else{vt.info("initialize encoded streams");const l=t.createEncodedStreams(),c={kind:"encode",data:{readableStream:l.readable,writableStream:l.writable,codec:i,trackId:n,participantIdentity:this.room.localParticipant.identity,isReuse:!1,hasPacketTrailer:zv(r),packetTrailer:r}};this.worker.postMessage(c,[l.readable,l.writable])}t[qf]=!0}}}const rae=300;class sae{constructor(){this.metadataMap=new Map,this.activeSsrc=0}storeMetadata(t,n,i){for(this.activeSsrc!==0&&this.activeSsrc!==n&&this.metadataMap.clear(),this.activeSsrc=n;this.metadataMap.size>=rae;){const r=this.metadataMap.keys().next().value;this.metadataMap.delete(r)}this.metadataMap.set(t,i)}lookupMetadata(t){return this.metadataMap.get(t)}dispose(){this.metadataMap.clear(),this.activeSsrc=0}}class aae{constructor(t){this.extractors=new Map,this.workerPipelines=new Map,this.onWorkerMessage=n=>{const i=n.data;if(i.kind==="metadata"){const r=this.extractors.get(i.data.trackId);r&&r.storeMetadata(i.data.rtpTimestamp,i.data.ssrc,i.data.metadata)}},this.onWorkerError=n=>{vt.error("frame metadata worker encountered an error:",{error:n.error})},this.worker=t==null?void 0:t.worker}setup(t){t!==this.room&&(this.room=t,this.worker&&(this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage({kind:"init"})),t.on(_e.TrackSubscribed,(n,i,r)=>
661{n.kind==="video"&&this.setupReceiver(n,i.trackInfo)}).on(_e.TrackUnsubscribed,n=>{this.teardownTrack(n)}).on(_e.Disconnected,()=>{this.cleanup()}))}setupReceiver(t,n){var i,r,s;const l=t.receiver;if(!l)return;if(!(!!(n!=null&&n.packetTrailerFeatures)&&n.packetTrailerFeatures.length>0)){!((i=this.room)===null||i===void 0)&&i.hasE2EESetup||this.setupPassthroughReceiver(l,t.mediaStreamID);return}if(!Qm(this.worker?{worker:this.worker}:void 0)&&!(!((r=this.room)===null||r===void 0)&&r.hasE2EESetup)){vt.warn("frame metadata transform not supported; skipping extraction");return}const h=new sae,d=t.mediaStreamID;this.extractors.set(d,h),t.frameMetadataExtractor=h,!(!((s=this.room)===null||s===void 0)&&s.hasE2EESetup)&&this.setupWorkerReceiver(l,d,!0)}setupPassthroughReceiver(t,n){if(Ym()){"transform"in t&&(t.transform=null);return}if(this.worker&&Qm({worker:this.worker})&&!this.workerPipelines.has(t)){this.setupWorkerReceiver(t,n,!1);return}this.worker&&this.workerPipelines.has(t)&&this.setupWorkerReceiver(t,n,!1)}setupWorkerReceiver(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;const r=this.worker;if(!r)return;if(Ym()){t.transform=new RTCRtpScriptTransform(r,{kind:"decode",trackId:n});return}const s=this.workerPipelines.get(t);if(s){const h={kind:"updateTrackId",data:{oldTrackId:s,newTrackId:n,hasPacketTrailer:i}};r.postMessage(h),this.workerPipelines.set(t,n);return}if(!("createEncodedStreams"in t)){vt.warn("createEncodedStreams not supported");return}let l;try{l=t.createEncodedStreams()}catch(h){vt.warn("failed to create encoded streams",{error:h});return}const c={kind:"decode",data:{readableStream:l.readable,writableStream:l.writable,trackId:n,hasPacketTrailer:i}};r.postMessage(c,[l.readable,l.writable]),this.workerPipelines.set(t,n)}teardownTrack(t){const n=t.mediaStreamID,i=this.extractors.get(n);i&&(i.dispose(),this.extractors.delete(n)),t instanceof LC&&(t.frameMetadataExtractor=void 0)}cleanup(){var t;for(const n of this.extractors.values())n.dispose();this.extractors.clear(),this.workerPipelines.clear(),(t=this.worker)===null||t===void 0||t.terminate()}}const oae=500,lae=15e3;class rh{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new rh),this._instance}addFailedConnectionAttempt(t){var n;const i=new URL(t),r=gS(i);if(!r)return;let s=(n=this.failedConnectionAttempts.get(r))!==null&&n!==void 0?n:0;this.failedConnectionAttempts.set(r,s+1),this.backOffPromises.set(r,br(Math.min(oae*Math.pow(2,s),lae)))}getBackOffPromise(t){const n=new URL(t),i=n&&gS(n);return i&&this.backOffPromises.get(i)||Promise.resolve()}resetFailedConnectionAttempts(t){const n=new URL(t),i=n&&gS(n);i&&(this.failedConnectionAttempts.set(i,0),this.backOffPromises.set(i,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}rh._instance=null;const SS="default";class Li{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new Li),this.instance}get previousDevices(){return this._previousDevices}getDevices(t){return z(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var s;if(((s=Li.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){vt.debug("awaiting getUserMedia promise");try{n?yield Li.userMediaPromiseMap.get(n):yield Promise.all(Li.userMediaPromiseMap.values())}catch{vt.warn("error waiting for media permissons")}}let l=yield navigator.mediaDevices.enumerateDevices();if(r&&!(Au()&&i.hasDeviceInUse(n))&&(l.filter(h=>h.kind===n).length===0||l.some(h=>{const d=h.label==="",f=n?h.kind===n:!0;return d&&f}))){const h={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},d=yield navigator.mediaDevices.getUserMedia(h);l=yield navigator.mediaDevices.enumerateDevices(),d.getTracks().forEach(f=>{f.stop()})}return i._previousDevices=l,n&&(l=l.filter(c=>c.kind===n)),l})()})}normalizeDeviceId(t,n,i){return z(this,void 0,void 0,function*(){if(n!==SS)return n;const r=yield this.getDevices(t),s=r.find(c=>c.deviceId===SS);if(!s){vt.warn("could not reliably determine default device");return}const l=r.find(c=>c.deviceId!==SS&&c.groupId===(i??s.groupId));if(!l){vt.warn("could not reliably determine default device");return}return l==null?void 0:l.deviceId})}hasDeviceInUse(t){return t?Li.userMediaPromiseMap.has(t):Li.userMediaPromiseMap.size>0}}Li.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];Li.userMediaPromiseMap=new Map;const UC=65535,YB=4294967295;
661class ba{static u16(t){return new ba(t,UC)}static u32(t){return new ba(t,YB)}constructor(t,n){if(this.value=t,t<0)throw new Error("WrapAroundUnsignedInt: cannot faithfully represent an integer smaller than 0");if(n>Number.MAX_SAFE_INTEGER)throw new Error("WrapAroundUnsignedInt: cannot faithfully represent an integer bigger than MAX_SAFE_INTEGER.");this.maxSize=n,this.clamp()}clamp(){for(;this.value>this.maxSize;)this.value-=this.maxSize+1;for(;this.value<0;)this.value+=this.maxSize+1}clone(){return new ba(this.value,this.maxSize)}update(t){this.value=t(this.value),this.clamp()}increment(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.update(n=>n+t)}decrement(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.update(n=>n-t)}getThenIncrement(){const t=this.value;return this.increment(),new ba(t,this.maxSize)}isBefore(t){const n=this.value>>>0,r=(t.value>>>0)-n>>>0;return r!==0&&r<this.maxSize+1}}class sh{static fromRtpTicks(t){return new sh(t,9e4)}static rtpRandom(){const t=Math.round(Math.random()*YB);return sh.fromRtpTicks(t)}constructor(t,n){this.timestamp=ba.u32(t),this.rateInHz=n}asTicks(){return this.timestamp.value}clone(){return new sh(this.timestamp.value,this.rateInHz)}wrappingAdd(t){this.timestamp.increment(t)}isBefore(t){return this.timestamp.isBefore(t.timestamp)}}class tu{constructor(t,n,i){this.epoch=n,this.base=i,this.previous=i.clone(),this.rateInHz=t}static startingNow(t,n){return new tu(n,new Date,t)}static startingAtTime(t,n,i){return new tu(i,t,n)}static rtpStartingNow(t){return tu.startingNow(t,9e4)}static rtpStartingAtTime(t,n){return tu.startingAtTime(t,n,9e4)}now(){return this.at(new Date)}at(t){let n=t.getTime()-this.epoch.getTime(),i=tu.durationInMsToTicks(n,this.rateInHz),r=this.base.clone();return r.wrappingAdd(i),r.isBefore(this.previous)&&(r=this.previous),this.previous=r.clone(),r.clone()}static durationInMsToTicks(t,n){let r=(t*1e6*n+5e8)/1e9;return Math.round(r)}}function BC(e){if(e instanceof DataView)return e;if(e instanceof ArrayBuffer)return new DataView(e);if(e instanceof Uint8Array)return new DataView(e.buffer,e.byteOffset,e.byteLength);throw new Error("Error coercing ".concat(e," to DataView - input was not DataView, ArrayBuffer, or Uint8Array."))}var wu;(function(e){e[e.Reserved=0]="Reserved",e[e.TooLarge=1]="TooLarge"})(wu||(wu={}));class xh extends Gs{constructor(t,n){super(19,t),this.name="DataTrackHandleError",this.reason=n,this.reasonName=wu[n]}isReason(t){return this.reason===t}static tooLarge(){return new xh("Value too large to be a valid track handle",wu.TooLarge)}static reserved(t){return new xh("0x".concat(t.toString(16)," is a reserved value."),wu.Reserved)}}const cae={fromNumber(e){if(e===0)throw xh.reserved(e);if(e>UC)throw xh.tooLarge();return e}};class uae{constructor(){this.value=0}get(){return this.value+=1,this.value>UC?null:this.value}reset(){this.value=0}}const qv={from(e){return{sid:e.sid,pubHandle:e.pubHandle,name:e.name,usesE2ee:e.encryption!==xn.NONE}},toProtobuf(e){return new fy({sid:e.sid,pubHandle:e.pubHandle,name:e.name,encryption:e.usesE2ee?xn.GCM:xn.NONE})}};var Cm;(function(e){e[e.WAITING=0]="WAITING",e[e.RUNNING=1]="RUNNING",e[e.COMPLETED=2]="COMPLETED"})(Cm||(Cm={}));class dae{constructor(){this.pendingTasks=new Map,this.taskMutex=new ur,this.nextTaskIndex=0}run(t){return z(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:Cm.WAITING};this.pendingTasks.set(n.id,n);const i=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=Cm.RUNNING,yield t()}finally{n.status=Cm.COMPLETED,this.pendingTasks.delete(n.id),i()}})}flush(){return z(this,void 0,void 0,function*(){return this.run(()=>z(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}class hae{get readyState(){return this.ws.readyState}constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i,r;if(!((i=n.signal)===null||i===void 0)&&i.aborted)throw new DOMException("This operation was aborted","AbortError");this.url=t;const s=new WebSocket(t,(r=n.protocols)!==null&&r!==void 0?r:[]);s.binaryType="arraybuffer",this.ws=s;const l=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=c.closeCode,d=c.reason;return s.close(h,d)};this.opened=new _r((c,h)=>{const d=()=>{h(at.websocket("Encountered websocket error during connection establishment"))};s.onopen=()=>{c({readable:new ReadableStream({start(f){s.onmessage=p=>{let v=p.data;return f.enqueue(v)},s.onerror=p=>f.error(p)},cancel:l}),writable:new WritableStream({write(f){s.send(f)},abort(){s.close()},close:l}),protocol:s.protocol,extensions:s.extensions}),s.removeEventListener("error",d)},s.addEventListener("error",d)}),this.closed=new _r((c,h)=>{const d=()=>z(this,void 0,void 0,function*(){const f=new _r(v=>{s.readyState!==WebSocket.CLOSED&&s.addEventListener("close",x=>{v(x)},{once:!0})}),p=yield _r.race([br(250),f]);p?c(p):h(at.websocket("Encountered unspecified websocket error without a timely close event"))});
661s.onclose=f=>{let p=f.code,v=f.reason;c({closeCode:p,reason:v}),s.removeEventListener("error",d)},s.addEventListener("error",d)}),n.signal&&(n.signal.onabort=()=>s.close()),this.close=l}}const fae=["syncState","trickle","offer","answer","simulate","leave"];function mae(e){const t=fae.indexOf(e.case)>=0;return vt.trace("request allowed to bypass queue:",{canPass:t,req:e}),t}var gn;(function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTING=3]="DISCONNECTING",e[e.DISCONNECTED=4]="DISCONNECTED"})(gn||(gn={}));const pae=250;class FC{get currentState(){return this.state}get isDisconnected(){return this.state===gn.DISCONNECTING||this.state===gn.DISCONNECTED}get isEstablishingConnection(){return this.state===gn.CONNECTING||this.state===gn.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;this.rtt=0,this.state=gn.DISCONNECTED,this.log=vt,this._requestId=0,this.useV0SignalPath=!1,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0,this.onMediaSectionsRequirement=void 0},this.loggerContextCb=n.loggerContextCb,this.log=es((i=n.loggerName)!==null&&i!==void 0?i:zi.Signal,()=>this.logContext),this.useJSON=t,this.requestQueue=new dae,this.queuedRequests=[],this.closingLock=new ur,this.connectionLock=new ur,this.state=gn.DISCONNECTED}get logContext(){var t,n;return(n=(t=this.loggerContextCb)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:{}}join(t,n,i,r){return z(this,arguments,void 0,function(s,l,c,h){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,p=arguments.length>5?arguments[5]:void 0;return(function*(){return d.state=gn.CONNECTING,d.options=c,yield d.connect(s,l,c,h,f,p)})()})}reconnect(t,n,i,r){return z(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring");return}return this.state=gn.RECONNECTING,this.clearPingInterval(),yield this.connect(t,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:i,reconnectReason:r}),void 0,this.useV0SignalPath)})}connect(t,n,i,r){return z(this,arguments,void 0,function(s,l,c,h){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,p=arguments.length>5?arguments[5]:void 0;return(function*(){const v=yield d.connectionLock.lock();d.connectOptions=c,d.useV0SignalPath=f;const x=Ose(c.clientInfoCapabilities),b=f?gae(l,x,c):yield vae(l,x,c,p),S=qse(s,b,f).toString(),N=Hse(S).toString();return new Promise((j,T)=>z(d,void 0,void 0,function*(){var E,C;try{let P=!1;const A=O=>z(this,void 0,void 0,function*(){if(P)return;P=!0;const F=O instanceof Event?O.currentTarget:O,ne=Kse(F,"Abort handler called");this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close(ne)).catch(re=>{this.log.error(re),this.close()}):this.close(),M(),T(at.cancelled(ne))});h==null||h.addEventListener("abort",A);const M=()=>{clearTimeout(R),h==null||h.removeEventListener("abort",A)},R=setTimeout(()=>{A(at.timeout("room connection has timed out (signal)"))},c.websocketTimeout),B=(O,F)=>{this.handleSignalConnected(O,R,F)},U=new URL(S);if(U.searchParams.has("access_token")&&U.searchParams.set("access_token","<redacted>"),this.ws){const O=performance.now();yield this.close(!1),this.log.debug("closed previous ws connection in ".concat(performance.now()-O,"ms"))}this.log.info("signal connecting to ".concat(U),{reconnect:c.reconnect,reconnectReason:c.reconnectReason}),this.ws=new hae(S);try{this.ws.closed.then(q=>{var $;this.isEstablishingConnection&&T(at.internal("Websocket got closed during a (re)connection attempt: ".concat(q.reason))),q.closeCode!==1e3&&(this.log.warn("websocket closed",{reason:q.reason,code:q.closeCode,wasClean:q.closeCode===1e3,state:this.state}),this.state===gn.CONNECTED&&this.handleOnClose(($=q.reason)!==null&&$!==void 0?$:"Unexpected WS error"))}).catch(q=>{this.isEstablishingConnection&&T(at.internal("Websocket error during a (re)connection attempt: ".concat(q)))});
661const O=yield this.ws.opened.catch(q=>z(this,void 0,void 0,function*(){if(this.state!==gn.CONNECTED){this.state=gn.DISCONNECTED,clearTimeout(R);const $=yield this.handleConnectionError(q,N);T($);return}this.handleWSError(q),T(q)}));if(clearTimeout(R),!O)return;const F=O.readable.getReader();this.streamWriter=O.writable.getWriter();const ne=yield F.read();if(F.releaseLock(),!ne.value)throw at.internal("no message received as first message");const re=mR(ne.value),Q=this.validateFirstMessage(re,(E=c.reconnect)!==null&&E!==void 0?E:!1);if(!Q.isValid){T(Q.error);return}((C=re.message)===null||C===void 0?void 0:C.case)==="join"&&(this.pingTimeoutDuration=re.message.value.pingTimeout,this.pingIntervalDuration=re.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&this.log.debug("ping config",{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration}),this.onJoined&&this.onJoined(re.message.value));const W=Q.shouldProcessFirstMessage?re:void 0;B(O,W),j(Q.response)}catch(O){T(O)}finally{M()}}finally{v()}}))})()})}startReadingLoop(t,n){return z(this,void 0,void 0,function*(){for(n&&this.handleSignalResponse(n);;){this.signalLatency&&(yield br(this.signalLatency));const i=yield t.read(),r=i.done,s=i.value;if(r)break;const l=mR(s);this.handleSignalResponse(l)}})}close(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Close method called on signal client";return(function*(){if([gn.DISCONNECTING||gn.DISCONNECTED].includes(t.state)){t.log.debug("ignoring signal close as it's already in disconnecting state");return}const r=yield t.closingLock.lock();try{if(t.clearPingInterval(),n&&(t.state=gn.DISCONNECTING),t.ws){t.ws.close({closeCode:1e3,reason:i});const s=t.ws.closed;t.ws=void 0,t.streamWriter=void 0,yield Promise.race([s,br(pae)])}}catch(s){t.log.debug("websocket error while closing",{error:s})}finally{n&&(t.state=gn.DISCONNECTED),r()}})()})}sendOffer(t,n){this.log.debug("sending offer",{offerSdp:t.sdp}),this.sendRequest({case:"offer",value:nu(t,n)})}sendAnswer(t,n){return this.log.debug("sending answer",{answerSdp:t.sdp}),this.sendRequest({case:"answer",value:nu(t,n)})}sendIceCandidate(t,n){return this.log.debug("sending ice candidate",{candidate:t}),this.sendRequest({case:"trickle",value:new py({candidateInit:JSON.stringify(t),target:n})})}sendMuteTrack(t,n){return this.sendRequest({case:"mute",value:new gy({sid:t,muted:n})})}sendAddTrack(t){return this.sendRequest({case:"addTrack",value:t})}sendUpdateLocalMetadata(t,n){return z(this,arguments,void 0,function(i,r){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return(function*(){const c=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new jC({requestId:c,metadata:i,name:r,attributes:l})}),c})()})}sendUpdateTrackSettings(t){this.sendRequest({case:"trackSetting",value:t})}sendUpdateSubscription(t){return this.sendRequest({case:"subscription",value:t})}sendSyncState(t){return this.sendRequest({case:"syncState",value:t})}sendUpdateVideoLayers(t,n){return this.sendRequest({case:"updateLayers",value:new QU({trackSid:t,layers:n})})}sendUpdateSubscriptionPermissions(t,n){return this.sendRequest({case:"subscriptionPermission",value:new ZU({allParticipants:t,trackPermissions:n})})}sendSimulateScenario(t){return this.sendRequest({case:"simulate",value:t})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Un.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new nB({timestamp:Un.parse(Date.now()),rtt:Un.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(t,n){return this.sendRequest({case:"updateAudioTrack",value:new NC({trackSid:t,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new xy({reason:ya.CLIENT_INITIATED,action:eh.DISCONNECT})})}sendPublishDataTrackRequest(t,n,i){return this.sendRequest({case:"publishDataTrackRequest",value:new bC({pubHandle:t,name:n,encryption:i?xn.GCM:xn.NONE})})}sendUnPublishDataTrackRequest(t){return this.sendRequest({case:"unpublishDataTrackRequest",value:new SC({pubHandle:t})})}sendUpdateDataSubscription(t,n){return this.sendRequest({case:"updateDataSubscription",value:new HU({updates:[new KU({trackSid:t,subscribe:n})]})})}sendRequest(t){return z(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(function*(){if(!r&&!mae(n)&&i.state===gn.RECONNECTING){i.queuedRequests.push(()=>z(i,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(r||(yield i.requestQueue.flush()),i.signalLatency&&(yield br(i.signalLatency)),i.isDisconnected){i.log.debug("skipping signal request (type: ".concat(n.case,") - SignalClient disconnected"));return}if(!i.streamWriter){i.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case));return}const l=new ure({message:n});try{i.useJSON?yield i.streamWriter.write(l.toJsonString()):yield i.streamWriter.write(l.toBinary().buffer)}catch(c){i.log.error("error sending signal message",{error:c})}})()})}handleSignalResponse(t){var n,i;const r=t.message;if(r==null){this.log.debug("received unsupported message");return}let s=!1;if(r.case==="answer"){const l=xR(r.value);this.onAnswer&&this.onAnswer(l,r.value.id,r.value.midToTrackId)}else if(r.case==="offer"){const l=xR(r.value);this.onOffer&&this.onOffer(l,r.value.id,r.value.midToTrackId)}else if(r.case==="trickle"){const l=JSON.parse(r.value.candidateInit);this.onTrickle&&this.onTrickle(l,r.value.target)}else r.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=r.value.participants)!==null&&n!==void 0?n:[]):r.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(r.value):r.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((i=r.value.speakers)!==null&&i!==void 0?i:[]):r.case==="leave"?this.onLeave&&this.onLeave(r.value):r.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(r.value.sid,r.value.muted):r.case==="roomUpdate"?this.onRoomUpdate&&r.value.room&&this.onRoomUpdate(r.value.room):r.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(r.value):r.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(r.value):r.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(r.value):r.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(r.value):r.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(r.value):r.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(r.value):r.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(r.value):r.case==="pong"||(r.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(r.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):r.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(r.value):r.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(r.value.trackSid):r.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(r.value.token),this.onRoomMoved&&this.onRoomMoved(r.value)):r.case==="mediaSectionsRequirement"?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement
661(r.value):r.case==="publishDataTrackResponse"?this.onPublishDataTrackResponse&&this.onPublishDataTrackResponse(r.value):r.case==="unpublishDataTrackResponse"?this.onUnPublishDataTrackResponse&&this.onUnPublishDataTrackResponse(r.value):r.case==="dataTrackSubscriberHandles"?this.onDataTrackSubscriberHandles&&this.onDataTrackSubscriberHandles(r.value):this.log.debug("unsupported message",{msgCase:r.case}));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const t=this.queuedRequests.shift();t&&this.requestQueue.run(t)}}handleOnClose(t){return z(this,void 0,void 0,function*(){if(this.state===gn.DISCONNECTED)return;const n=this.onClose;yield this.close(void 0,t),this.log.info("websocket connection closed: ".concat(t),{reason:t}),n&&n(t)})}handleWSError(t){this.log.error("websocket error",{error:t})}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set");return}this.pingTimeout=yi.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString())),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&yi.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set");return}this.log.debug("start ping interval"),this.pingInterval=yi.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval"),this.clearPingTimeout(),this.pingInterval&&yi.clearInterval(this.pingInterval)}handleSignalConnected(t,n,i){this.state=gn.CONNECTED,this.log.info("signal connected"),clearTimeout(n),this.startPingInterval(),this.startReadingLoop(t.readable.getReader(),i)}validateFirstMessage(t,n){var i,r,s,l,c;return((i=t.message)===null||i===void 0?void 0:i.case)==="join"?{isValid:!0,response:t.message.value}:this.state===gn.RECONNECTING&&((r=t.message)===null||r===void 0?void 0:r.case)!=="leave"?((s=t.message)===null||s===void 0?void 0:s.case)==="reconnect"?{isValid:!0,response:t.message.value}:(this.log.debug("declaring signal reconnected without reconnect response received"),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&((l=t.message)===null||l===void 0?void 0:l.case)==="leave"?{isValid:!1,error:at.leaveRequest("Received leave request while trying to (re)connect",t.message.value.reason)}:n?{isValid:!1,error:at.internal("Unexpected first message")}:{isValid:!1,error:at.internal("did not receive join response, got ".concat((c=t.message)===null||c===void 0?void 0:c.case," instead"))}}handleConnectionError(t,n){return z(this,void 0,void 0,function*(){try{const i=yield fetch(n);switch(i.status){case 404:const r=yield i.text();return r.includes("requested room does not exist")?at.notAllowed(r,i.status):at.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const s=yield i.text();return at.notAllowed(s,i.status);default:break}return t instanceof at?t:at.internal("Encountered unknown websocket error during connection: ".concat(t),{status:i.status,statusText:i.statusText})}catch(i){return i instanceof at?i:at.serverUnreachable(i instanceof Error?i.message:"server was not reachable")}})}}function xR(e){const t={type:"offer",sdp:e.sdp};switch(e.type){case"answer":case"offer":case"pranswer":case"rollback":t.type=e.type;break}return t}function nu(e,t){return new mc({sdp:e.sdp,type:e.type,id:t})}function gae(e,t,n){var i;const r=new URLSearchParams;return r.set("access_token",e),n.reconnect&&(r.set("reconnect","1"),n.sid&&r.set("sid",n.sid)),r.set("auto_subscribe",n.autoSubscribe?"1":"0"),r.set("sdk",ja()?"reactnative":"js"),r.set("version",t.version),r.set("protocol",t.protocol.toString()),r.set("client_protocol",t.clientProtocol.toString()),t.deviceModel&&r.set("device_model",t.deviceModel),t.os&&r.set("os",t.os),t.osVersion&&r.set("os_version",t.osVersion),t.browser&&r.set("browser",t.browser),t.browserVersion&&r.set("browser_version",t.browserVersion),n.adaptiveStream&&r.set("adaptive_stream","1"),n.reconnectReason&&r.set("reconnect_reason",n.reconnectReason.toString()),!((i=navigator.connection)===null||i===void 0)&&i.type&&r.set("network",navigator.connection.type),r}function vae(e,t,n,i){return z(this,void 0,void 0,function*(){const r=new 
661URLSearchParams;r.set("access_token",e);const s=new Ire({clientInfo:t,connectionSettings:new iB({autoSubscribe:!!n.autoSubscribe,adaptiveStream:!!n.adaptiveStream}),reconnect:!!n.reconnect,participantSid:n.sid?n.sid:void 0,publisherOffer:i});n.reconnectReason&&(s.reconnectReason=n.reconnectReason);const l=s.toBinary();let c,h;if(HB()){const v=new CompressionStream("gzip"),x=v.writable.getWriter();x.write(new Uint8Array(l)),x.close();const b=[],S=v.readable.getReader();for(;;){const E=yield S.read(),C=E.done,P=E.value;if(C)break;b.push(P)}const N=b.reduce((E,C)=>E+C.length,0),j=new Uint8Array(N);let T=0;for(const E of b)j.set(E,T),T+=E.length;c=j,h=lN.GZIP}else c=l,h=lN.NONE;const f=new Dre({joinRequest:c,compression:h}).toBinary(),p=v=>{const x=Array.from(v,b=>String.fromCodePoint(b)).join("");return btoa(x)};return r.set("join_request",p(f).replace(/\+/g,"-").replace(/\//g,"_")),r})}class yR{constructor(){this.buffer=[],this._totalSize=0}push(t){this.buffer.push(t),this._totalSize+=t.data.byteLength}pop(){const t=this.buffer.shift();return t&&(this._totalSize-=t.data.byteLength),t}getAll(){return this.buffer.slice()}popToSequence(t){for(;this.buffer.length>0&&this.buffer[0].sequence<=t;)this.pop()}alignBufferedAmount(t){for(;this.buffer.length>0;){const n=this.buffer[0];if(this._totalSize-n.data.byteLength<=t)break;this.pop()}}get length(){return this.buffer.length}}class xae{constructor(t){this._map=new Map,this._lastCleanup=0,this.ttl=t}set(t,n){const i=Date.now();i-this._lastCleanup>this.ttl/2&&this.cleanup();const r=i+this.ttl;return this._map.set(t,{value:n,expiresAt:r}),this}get(t){const n=this._map.get(t);if(n){if(n.expiresAt<Date.now()){this._map.delete(t);return}return n.value}}has(t){const n=this._map.get(t);return n?n.expiresAt<Date.now()?(this._map.delete(t),!1):!0:!1}delete(t){return this._map.delete(t)}clear(){this._map.clear()}cleanup(){const t=Date.now();for(const i of this._map.entries()){var n=tt(i,2);const r=n[0];n[1].expiresAt<t&&this._map.delete(r)}this._lastCleanup=t}get size(){return this.cleanup(),this._map.size}forEach(t){this.cleanup();for(const i of this._map.entries()){var n=tt(i,2);const r=n[0],s=n[1];s.expiresAt>=Date.now()&&t(s.value,r,this.asValueMap())}}map(t){this.cleanup();const n=[],i=this.asValueMap();for(const s of i.entries()){var r=tt(s,2);const l=r[0],c=r[1];n.push(t(c,l,i))}return n}asValueMap(){const t=new Map;for(const i of this._map.entries()){var n=tt(i,2);const r=n[0],s=n[1];s.expiresAt>=Date.now()&&t.set(r,s.value)}return t}}var na={},kS={},NS={exports:{}},bR;function $C(){if(bR)return NS.exports;bR=1;var e=NS.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(t){return t.encoding?"rtpmap:%d %s/%s/%s":t.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(t){return t.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(t){return t.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S
661*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(t){return"extmap:%d"+(t.direction?"/%s":"%v")+(t["encrypt-uri"]?" %s":"%v")+" %s"+(t.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(t){return t.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(t){var n="candidate:%s %d %s %d %s %d typ %s";return n+=t.raddr!=null?" raddr %s rport %d":"%v%v",n+=t.tcptype!=null?" tcptype %s":"%v",t.generation!=null&&(n+=" generation %d"),n+=t["network-id"]!=null?" network-id %d":"%v",n+=t["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(t){var n="ssrc:%d";return t.attribute!=null&&(n+=" %s",t.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(t){return t.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(t){return t.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(t){return"imageattr:%s %s %s"+(t.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(t){return"simulcast:%s %s"+(t.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"}
vendor: 3,629 bytes, line 661
661,{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(t){return"ts-refclk:%s"+(t.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(t){var n="mediaclk:";return n+=t.id!=null?"id=%s %s":"%v%s",n+=t.mediaClockValue!=null?"=%s":"",n+=t.rateNumerator!=null?" rate=%s":"",n+=t.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(e).forEach(function(t){var n=e[t];n.forEach(function(i){i.reg||(i.reg=/(.*)/),i.format||(i.format="%s")})}),NS.exports}var wR;function yae(){return wR||(wR=1,(function(e){var t=function(c){return String(Number(c))===c?Number(c):c},n=function(c,h,d,f){if(f&&!d)h[f]=t(c[1]);else for(var p=0;p<d.length;p+=1)c[p+1]!=null&&(h[d[p]]=t(c[p+1]))},i=function(c,h,d){var f=c.name&&c.names;c.push&&!h[c.push]?h[c.push]=[]:f&&!h[c.name]&&(h[c.name]={});var p=c.push?{}:f?h[c.name]:h;n(d.match(c.reg),p,c.names,c.name),c.push&&h[c.push].push(p)},r=$C(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(c){var h={},d=[],f=h;return c.split(/(\r\n|\r|\n)/).filter(s).forEach(function(p){var v=p[0],x=p.slice(2);v==="m"&&(d.push({rtp:[],fmtp:[]}),f=d[d.length-1]);for(var b=0;b<(r[v]||[]).length;b+=1){var S=r[v][b];if(S.reg.test(x))return i(S,f,x)}}),h.media=d,h};var l=function(c,h){var d=h.split(/=(.+)/,2);return d.length===2?c[d[0]]=t(d[1]):d.length===1&&h.length>1&&(c[d[0]]=void 0),c};e.parseParams=function(c){return c.split(/;\s?/).reduce(l,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(c){return c.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(c){for(var h=[],d=c.split(" ").map(t),f=0;f<d.length;f+=3)h.push({component:d[f],ip:d[f+1],port:d[f+2]});return h},e.parseImageAttributes=function(c){return c.split(" ").map(function(h){return h.substring(1,h.length-1).split(",").reduce(l,{})})},e.parseSimulcastStreamList=function(c){return c.split(";").map(function(h){return h.split(",").map(function(d){var f,p=!1;return d[0]!=="~"?f=t(d):(f=t(d.substring(1,d.length)),p=!0),{scid:f,paused:p}})})}})(kS)),kS}var jS,SR;function bae(){if(SR)return jS;SR=1;var e=$C(),t=/%[sdv%]/g,n=function(l){var c=1,h=arguments,d=h.length;return l.replace(t,function(f){if(c>=d)return f;var p=h[c];switch(c+=1,f){case"%%":return"%";case"%s":return String(p);case"%d":return Number(p);case"%v":return""}})},i=function(l,c,h){var d=c.format instanceof Function?c.format(c.push?h:h[c.name]):c.format,f=[l+"="+d];if(c.names)for(var p=0;p<c.names.length;p+=1){var v=c.names[p];c.name?f.push(h[c.name][v]):f.push(h[c.names[p]])}else f.push(h[c.name]);return n.apply(null,f)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return jS=function(l,c){c=c||{},l.version==null&&(l.version=0),l.name==null&&(l.name=" "),l.media.forEach(function(p){p.payloads==null&&(p.payloads="")});var h=c.outerOrder||r,d=c.innerOrder||s,f=[];return h.forEach(function(p){e[p].forEach(function(v){v.name in l&&l[v.name]!=null?f.push(i(p,v,l)):v.push in l&&l[v.push]!=null&&l[v.push].forEac
661h(function(x){f.push(i(p,v,x))})})}),l.media.forEach(function(p){f.push(i("m",e.m[0],p)),d.forEach(function(v){e[v].forEach(function(x){x.name in p&&p[x.name]!=null?f.push(i(v,x,p)):x.push in p&&p[x.push]!=null&&p[x.push].forEach(function(b){f.push(i(v,x,b))})})})}),f.join(`\r
662`)+`\r
663`},jS}var kR;function wae(){if(kR)return na;kR=1;var e=yae(),t=bae(),n=$C();return na.grammar=n,na.write=t,na.parse=e.parse,na.parseParams=e.parseParams,na.parseFmtpConfig=e.parseFmtpConfig,na.parsePayloads=e.parsePayloads,na.parseRemoteCandidates=e.parseRemoteCandidates,na.parseImageAttributes=e.parseImageAttributes,na.parseSimulcastStreamList=e.parseSimulcastStreamList,na}var Os=wae();const Sae=.7,kae=20,tc={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",OfferAnswered:"offerAnswered",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class NR extends ts.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;super(),this.log=vt,this.ddExtID=0,this.latestOfferId=0,this.latestAcknowledgedOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=IC(r=>z(this,void 0,void 0,function*(){this.emit(tc.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(r)r(s);else throw s}}),kae),this.close=()=>{this._pc&&(this.pendingInitialOffer=void 0,this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=es((i=n.loggerName)!==null&&i!==void 0?i:zi.PCTransport),this.loggerOptions=n,this.config=t,this._pc=this.createPC(),this.offerLock=new ur}createPC(){const t=new RTCPeerConnection(this.config);return t.onicecandidate=n=>{var i;n.candidate&&((i=this.onIceCandidate)===null||i===void 0||i.call(this,n.candidate))},t.onicecandidateerror=n=>{var i;(i=this.onIceCandidateError)===null||i===void 0||i.call(this,n)},t.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,t.iceConnectionState)},t.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,t.signalingState)},t.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,t.connectionState)},t.ondatachannel=n=>{var i;(i=this.onDataChannel)===null||i===void 0||i.call(this,n)},t.ontrack=n=>{var i;(i=this.onTrack)===null||i===void 0||i.call(this,n)},t}get logContext(){var t,n;return Object.assign({},(n=(t=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(t))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(t){return z(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(t);this.pendingCandidates.push(t)})}setRemoteDescription(t,n){return z(this,void 0,void 0,function*(){var i,r;if(t.type==="answer"&&this.latestOfferId>0&&n>0&&n!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:n,latestOfferId:this.latestOfferId})),!1;let s;if(t.type==="offer"){let l=Nae(t),c=l.stereoMids,h=l.nackMids;this.remoteStereoMids=c,this.remoteNackMids=h}else if(t.type==="answer"){if(this.pendingInitialOffer&&this._pc){const c=this.pendingInitialOffer;this.pendingInitialOffer=void 0;const h=Os.parse((i=c.sdp)!==null&&i!==void 0?i:"");h.media.forEach(d=>{h0(d)}),this.log.debug("setting pending initial offer before processing answer",this.logContext),yield this.setMungedSDP(c,Os.write(h))}const l=Os.parse((r=t.sdp)!==null&&r!==void 0?r:"");l.media.forEach(c=>{const h=VC(c.mid);c.type==="audio"&&this.trackBitrates.some(d=>{if(!d.transceiver||h!=d.transceiver.mid)return!1;let f=0;if(c.rtp.some(v=>v.codec.toUpperCase()===d.codec.toUpperCase()?(f=v.payload,!0):!1),f===0)return!0;let p=!1;for(const v of c.fmtp)if(v.payload===f){v.config=v.config.split(";").filter(x=>!x.includes("maxaveragebitrate")).join(";"),d.maxbr>0&&(v.config+=";maxaveragebitrate=".concat(d.maxbr*1e3)),p=!0;break}return p||d.maxbr>0&&c.fmtp.push({payload:f,config:"maxaveragebitrate=".concat(d.maxbr*1e3)}),!0})}),s=Os.write(l)}
663return yield this.setMungedSDP(t,s,!0),this.pendingCandidates.forEach(l=>{this.pc.addIceCandidate(l)}),this.pendingCandidates=[],this.restartingIce=!1,t.type==="answer"&&(this.latestAcknowledgedOfferId=n,this.emit(tc.OfferAnswered,n)),this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):t.type==="answer"&&(this.emit(tc.NegotiationComplete),t.sdp&&Os.parse(t.sdp).media.forEach(c=>{c.type==="video"&&this.emit(tc.RTPVideoPayloadTypes,c.rtp)})),!0})}createInitialOffer(){return z(this,void 0,void 0,function*(){var t;const n=yield this.offerLock.lock();try{if(this.pc.signalingState!=="stable"){this.log.warn("signaling state is not stable, cannot create initial offer",this.logContext);return}const i=this.latestOfferId+1;this.latestOfferId=i;const r=yield this.pc.createOffer();this.pendingInitialOffer={sdp:r.sdp,type:r.type};const s=Os.parse((t=r.sdp)!==null&&t!==void 0?t:"");return s.media.forEach(l=>{h0(l)}),r.sdp=Os.write(s),{offer:r,offerId:i}}finally{n()}})}createAndSendOffer(t){return z(this,void 0,void 0,function*(){var n;const i=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(t!=null&&t.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&(this._pc.signalingState==="have-local-offer"||this.pendingInitialOffer)){const c=this._pc.remoteDescription;if(t!=null&&t.iceRestart&&c)yield this._pc.setRemoteDescription(c);else{this.renegotiate=!0,this.log.debug("requesting renegotiation",Object.assign({},this.logContext));return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const r=this.latestOfferId+1;this.latestOfferId=r;const s=yield this.pc.createOffer(t);this.log.debug("original offer",Object.assign({sdp:s.sdp},this.logContext));const l=Os.parse((n=s.sdp)!==null&&n!==void 0?n:"");if(l.media.forEach(c=>{h0(c),c.type==="audio"?jR(c,["all"],[]):c.type==="video"&&this.trackBitrates.some(h=>{if(!c.msid||!h.cid||!c.msid.includes(h.cid))return!1;let d=0;if(c.rtp.some(p=>p.codec.toUpperCase()===h.codec.toUpperCase()?(d=p.payload,!0):!1),d===0||(da(h.codec)&&!Au()&&this.ensureVideoDDExtensionForSVC(c,l),!da(h.codec)))return!0;const f=Math.round(h.maxbr*Sae);for(const p of c.fmtp)if(p.payload===d){p.config.includes("x-google-start-bitrate")||(p.config+=";x-google-start-bitrate=".concat(f));break}return!0})}),this.latestOfferId>r){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:r}));return}yield this.setMungedSDP(s,Os.write(l)),this.onOffer(s,this.latestOfferId)}finally{i()}})}createAndSetAnswer(){return z(this,void 0,void 0,function*(){var t;const n=yield this.pc.createAnswer(),i=Os.parse((t=n.sdp)!==null&&t!==void 0?t:"");return i.media.forEach(r=>{h0(r),r.type==="audio"&&jR(r,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,Os.write(i)),n})}createDataChannel(t,n){return this.pc.createDataChannel(t,n)}addTransceiver(t,n){return this.pc.addTransceiver(t,n)}addTransceiverOfKind(t,n){return this.pc.addTransceiver(t,n)}addTrack(t){if(!this._pc)throw new Vn("PC closed, cannot add track");return this._pc.addTrack(t)}setTrackCodecBitrate(t){this.trackBitrates.push(t)}setConfiguration(t){var n;if(!this._pc)throw new Vn("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(t)}canRemoveTrack(){var t;return!!(!((t=this._pc)===null||t===void 0)&&t.removeTrack)}removeTrack(t){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(t)}getConnectionState(){var t,n;return(n=(t=this._pc)===null||t===void 0?void 0:t.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var t,n;return(n=(t=this._pc)===null||t===void 0?void 0:t.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var t,n;return(n=(t=this._pc)===null||t===void 0?void 0:t.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var t,n;return(n=(t=this._pc)===null||t===void 0?void 0:t.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var t,n;return(n=(t=this._pc)===null||t===void 0?void 0:t.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var t;return(t=this._pc)===null||t===void 0?void 0:t.localDescription}getRemoteDescription(){var t;return(t=this.pc)===null||t===void 0?void 0:t.remoteDescription}getStats(){return this.pc.getStats()}getMaxMessageSize(){var t,n;return(n=(t=this._pc)===null||t===void 0?void 0:t.sctp)===null||n===void 0?void 0:n.maxMessageSize}getConnectedAddress(){return z(this,void 0,void 0,function*(){var t;if(!this._pc)return;let n="";const i=new Map,r=new Map;
663if((yield this._pc.getStats()).forEach(c=>{switch(c.type){case"transport":n=c.selectedCandidatePairId;break;case"candidate-pair":n===""&&c.selected&&(n=c.id),i.set(c.id,c);break;case"remote-candidate":r.set(c.id,"".concat(c.address,":").concat(c.port));break}}),n==="")return;const l=(t=i.get(n))===null||t===void 0?void 0:t.remoteCandidateId;if(l!==void 0)return r.get(l)})}setMungedSDP(t,n,i){return z(this,void 0,void 0,function*(){var r,s;const l=t.sdp;if(n){t.sdp=n;try{this.log.debug("setting munged ".concat(i?"remote":"local"," description"),this.logContext),i?yield this.pc.setRemoteDescription(t):yield this.pc.setLocalDescription(t);return}catch(c){this.log.warn("not able to set ".concat(t.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:c,mungedSdp:n,originalSdp:l})),t.sdp=l}}try{i?yield(r=this._pc)===null||r===void 0?void 0:r.setRemoteDescription(t):yield(s=this._pc)===null||s===void 0?void 0:s.setLocalDescription(t)}catch(c){let h="unknown error";c instanceof Error?h=c.message:typeof c=="string"&&(h=c);const d={error:h,sdp:t.sdp};throw n&&n!==l&&(d.mungedSdp=n),!i&&this.pc.remoteDescription&&(d.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(t.type),Object.assign(Object.assign({},this.logContext),{fields:d})),new yu(h)}})}ensureVideoDDExtensionForSVC(t,n){var i,r;if(!((i=t.ext)===null||i===void 0?void 0:i.some(l=>l.uri===lR))){if(this.ddExtID===0){let l=0;n.media.forEach(c=>{var h;(h=c.ext)===null||h===void 0||h.forEach(d=>{d.value>l&&(l=d.value)})}),this.ddExtID=l+1}(r=t.ext)===null||r===void 0||r.push({value:this.ddExtID,uri:lR})}}}function jR(e,t,n){const i=VC(e.mid);let r=0;e.rtp.some(s=>s.codec==="opus"?(r=s.payload,!0):!1),r>0&&(e.rtcpFb||(e.rtcpFb=[]),n.includes(i)&&!e.rtcpFb.some(s=>s.payload===r&&s.type==="nack")&&e.rtcpFb.push({payload:r,type:"nack"}),(t.includes(i)||t.length===1&&t[0]==="all")&&e.fmtp.some(s=>s.payload===r?(s.config.includes("stereo=1")||(s.config+=";stereo=1"),!0):!1))}function Nae(e){var t;const n=[],i=[],r=Os.parse((t=e.sdp)!==null&&t!==void 0?t:"");let s=0;return r.media.forEach(l=>{var c;const h=VC(l.mid);l.type==="audio"&&(l.rtp.some(d=>d.codec==="opus"?(s=d.payload,!0):!1),!((c=l.rtcpFb)===null||c===void 0)&&c.some(d=>d.payload===s&&d.type==="nack")&&i.push(h),l.fmtp.some(d=>d.payload===s?(d.config.includes("sprop-stereo=1")&&n.push(h),!0):!1))}),{stereoMids:n,nackMids:i}}function h0(e){if(e.connection){const t=e.connection.ip.indexOf(":")>=0;(e.connection.version===4&&t||e.connection.version===6&&!t)&&(e.connection.ip="0.0.0.0",e.connection.version=4)}}function VC(e){return typeof e=="number"?e.toFixed(0):e}const TN="vp8",jae={audioPreset:vN.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:_C.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:TN,backupCodec:!0,preConnectBuffer:!1},QB={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},XB={deviceId:{ideal:"default"},resolution:Hm.h720.resolution},Cae={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new qre,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},zC={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var zn;(function(e){e[e.NEW=0]="NEW",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.FAILED=3]="FAILED",e[e.CLOSING=4]="CLOSING",e[e.CLOSED=5]="CLOSED"})(zn||(zn={}));class CR{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(t,n,i){var r;this.peerConnectionTimeout=zC.peerConnectionTimeout,this.log=vt,this.updateState=()=>{var s,l;const c=this.state,h=this.requiredTransports.map(d=>d.getConnectionState());h.every(d=>d==="connected")?this.state=zn.CONNECTED:h.some(d=>d==="failed")?this.state=zn.FAILED:h.some(d=>d==="connecting")?this.state=zn.CONNECTING:h.every(d=>d==="closed")?this.state=zn.CLOSED:h.some(d=>d==="closed")?this.state=zn.CLOSING:h.every(d=>d==="new")&&(this.state=zn.NEW),c!==this.state&&(this.log.debug("pc state change: from ".concat(zn[c]," to ").concat(zn[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),(l=this.subscriber)===null||l===void 0?void 0:l.getConnectionState()))},this.log=es((r=n.loggerName)!==null&&r!==void 0?r:zi.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=t!=="subscriber-primary",this.isSubscriberConnectionRequired=t==="subscriber-primary",this.publisher=new NR(i,n),this._mode=t,t!=="publisher-only"&&(this.subscriber=new NR(i,n),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=s=>{var l;(l=this.onIceCandidate)===null||l===void 0||l.call(this,s,ca.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var l;(l=this.onDataChannel)===null||l===void 0||l.call(this,s)},this.subscriber.onTrack=s=>{var l;(l=this.onTrack)===null||l===void 0||l.call(this,s)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var l;(l=this.onIceCandidate)===null||l===void 0||l.call(this,s,ca.PUBLISHER)},this.publisher.onTrack=s=>{var l;(l=this.onTrack)===null||l===void 0||l.call(this,s)},this.publisher.onOffer=(s,l)=>{var c;
663(c=this.onPublisherOffer)===null||c===void 0||c.call(this,s,l)},this.state=zn.NEW,this.connectionLock=new ur,this.remoteOfferLock=new ur}get logContext(){var t,n;return Object.assign({},(n=(t=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(t))}requirePublisher(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=t,this.updateState()}createAndSendPublisherOffer(t){return this.publisher.createAndSendOffer(t)}setPublisherAnswer(t,n){return this.publisher.setRemoteDescription(t,n)}removeTrack(t){return this.publisher.removeTrack(t)}close(){return z(this,void 0,void 0,function*(){var t;if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const n=this.publisher;for(const i of n.getSenders())try{n.canRemoveTrack()&&n.removeTrack(i)}catch(r){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:r}))}}yield Promise.all([this.publisher.close(),(t=this.subscriber)===null||t===void 0?void 0:t.close()]),this.updateState()})}triggerIceRestart(){return z(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(t,n){return z(this,void 0,void 0,function*(){var i;n===ca.PUBLISHER?yield this.publisher.addIceCandidate(t):yield(i=this.subscriber)===null||i===void 0?void 0:i.addIceCandidate(t)})}createSubscriberAnswerFromOffer(t,n){return z(this,void 0,void 0,function*(){var i,r,s;this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:t.type,sdp:t.sdp,signalingState:(i=this.subscriber)===null||i===void 0?void 0:i.getSignallingState().toString()}));const l=yield this.remoteOfferLock.lock();try{return(yield(r=this.subscriber)===null||r===void 0?void 0:r.setRemoteDescription(t,n))?yield(s=this.subscriber)===null||s===void 0?void 0:s.createAndSetAnswer():void 0}finally{l()}})}updateConfiguration(t,n){var i;this.publisher.setConfiguration(t),(i=this.subscriber)===null||i===void 0||i.setConfiguration(t),n&&this.triggerIceRestart()}ensurePCTransportConnection(t,n){return z(this,void 0,void 0,function*(){var i;const r=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((i=this.requiredTransports)===null||i===void 0?void 0:i.map(s=>this.ensureTransportConnected(s,t,n)))}finally{r()}})}negotiate(t){return z(this,void 0,void 0,function*(){return new _r((n,i)=>{const r=this.publisher.latestOfferId;if(this.publisher.latestAcknowledgedOfferId>r){this.log.debug("negotiation already handled in more recent acknowledged offer",this.logContext),n();return}let s=!1;const l=()=>{s||(s=!0,clearTimeout(d),this.publisher.off(tc.OfferAnswered,c),t.signal.removeEventListener("abort",h))},c=f=>{f>r&&(l(),n())},h=()=>{l(),i(new yu("negotiation aborted"))},d=setTimeout(()=>{l(),i(new yu("negotiation timed out"))},this.peerConnectionTimeout);t.signal.addEventListener("abort",h),this.publisher.on(tc.OfferAnswered,c),this.publisher.negotiate(f=>{l(),f instanceof Error?i(f):i(new Error(String(f)))})})})}addPublisherTransceiver(t,n){return this.publisher.addTransceiver(t,n)}addPublisherTransceiverOfKind(t,n){return this.publisher.addTransceiverOfKind(t,n)}getMidForReceiver(t){const i=(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(r=>r.receiver===t);return i==null?void 0:i.mid}getMaxPublisherMessageSize(){return this.publisher.getMaxMessageSize()}addPublisherTrack(t){return this.publisher.addTrack(t)}createPublisherDataChannel(t,n){return this.publisher.createDataChannel(t,n)}getConnectedAddress(t){return t===ca.PUBLISHER?this.publisher.getConnectedAddress():t===ca.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const t=[];return this.isPublisherConnectionRequired&&t.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&t.push(this.subscriber),t}
663ensureTransportConnected(t,n){return z(this,arguments,void 0,function(i,r){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return(function*(){if(i.getConnectionState()!=="connected")return new Promise((h,d)=>z(s,void 0,void 0,function*(){const f=()=>{this.log.warn("abort transport connection",this.logContext),yi.clearTimeout(p),d(at.cancelled("room connection has been cancelled"))};r!=null&&r.signal.aborted&&f(),r==null||r.signal.addEventListener("abort",f);const p=yi.setTimeout(()=>{r==null||r.signal.removeEventListener("abort",f),d(at.internal("could not establish pc connection"))},l);for(;this.state!==zn.CONNECTED;)if(yield br(50),r!=null&&r.signal.aborted){d(at.cancelled("room connection has been cancelled"));return}yi.clearTimeout(p),r==null||r.signal.removeEventListener("abort",f),h()}))})()})}}const qC=typeof MediaRecorder<"u";class Tae{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const Eae=qC?MediaRecorder:Tae;class Aae extends Eae{constructor(t,n){if(!qC)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([t.mediaStreamTrack]),n);let i,r;const s=()=>r===void 0,l=()=>{this.removeEventListener("dataavailable",i),this.removeEventListener("stop",l),this.removeEventListener("error",c),r==null||r.close(),r=void 0},c=h=>{r==null||r.error(h),this.removeEventListener("dataavailable",i),this.removeEventListener("stop",l),this.removeEventListener("error",c),r=void 0};this.byteStream=new ReadableStream({start:h=>{r=h,i=d=>z(this,void 0,void 0,function*(){let f;if(d.data.arrayBuffer){const p=yield d.data.arrayBuffer();f=new Uint8Array(p)}else if(d.data.byteArray)f=d.data.byteArray;else throw new Error("no data available!");s()||h.enqueue(f)}),this.addEventListener("dataavailable",i)},cancel:()=>{l()}}),this.addEventListener("stop",l),this.addEventListener("error",c)}}function Pae(){return qC}const _ae=1e3,Mae=1e4;class JB extends Ce{get sender(){return this._sender}set sender(t){this._sender=t}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(t,n,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(t,n,s),this.manuallyStopped=!1,this.pendingDeviceChange=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=IC(()=>z(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>z(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(Ue.Ended,this)},this.reacquireTrack=!1,this.providedByUser=r,this.muteLock=new ur,this.pauseUpstreamLock=new ur,this.trackChangeLock=new ur,this.trackChangeLock.lock().then(l=>z(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(t,!0)}finally{l()}})),this._constraints=t.getConstraints(),i&&(this._constraints=i)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==Ce.Kind.Video)return;const t=this._mediaStreamTrack.getSettings(),n=t.width,i=t.height;if(n&&i)return{width:n,height:i}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var t,n;return(n=(t=this.processor)===null||t===void 0?void 0:t.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(t,n,i){return z(this,void 0,void 0,function*(){var r;if(t===this._mediaStreamTrack&&!n)return;this._mediaStreamTrack&&(this.attachedElements.forEach(l=>{nh(this._mediaStreamTrack,l)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([t]),t&&(t.addEventListener("ended",this.handleEnded),t.addEventListener("mute",this.handleTrackMuteEvent),t.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=t.getConstraints());let s;if(this.processor&&t){if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Kd(t,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:t,kind:this.kind,element:this.processorElement,localTrack:this}),s=this.processor.processedTrack}this.sender&&((r=this.sender.transport)===null||r===void 0?void 0:r.state)!=="closed"&&(yield this.sender.replaceTrack(s??t)),!this.providedByUser&&this._mediaStreamTrack!==t&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=t,t&&(this._mediaStreamTrack.enabled=i?!0:!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEac
663h(l=>{Kd(s??t,l)}))})}waitForDimensions(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_ae;return(function*(){var i;if(t.kind===Ce.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((i=Or())===null||i===void 0?void 0:i.os)==="iOS"&&(yield br(10));const r=Date.now();for(;Date.now()-r<n;){const s=t.dimensions;if(s)return s;yield br(50)}throw new $o("unable to get track dimensions after timeout")})()})}setDeviceId(t){return z(this,void 0,void 0,function*(){return this._constraints.deviceId===t&&this._mediaStreamTrack.getSettings().deviceId===bu(t)?!0:(this._constraints.deviceId=t,this.isMuted?(this.pendingDeviceChange=!0,!0):(yield this.restartTrack(),bu(t)===this._mediaStreamTrack.getSettings().deviceId))})}getDeviceId(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){if(t.source===Ce.Source.ScreenShare)return;const i=t._mediaStreamTrack.getSettings(),r=i.deviceId,s=i.groupId,l=t.kind===Ce.Kind.Audio?"audioinput":"videoinput";return n?Li.getInstance().normalizeDeviceId(l,r,s):r})()})}mute(){return z(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return z(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(t,n){return z(this,void 0,void 0,function*(){const i=yield this.trackChangeLock.lock();try{if(!this.sender)throw new $o("unable to replace an unpublished track");let r,s;typeof n=="boolean"?r=n:n!==void 0&&(r=n.userProvidedTrack,s=n.stopProcessor),this.providedByUser=r??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(t),s&&this.processor&&(yield this.internalStopProcessor())}finally{i()}return yield this.onSenderTrackSwapped(),this})}onSenderTrackSwapped(){return z(this,void 0,void 0,function*(){})}restart(t,n){return z(this,void 0,void 0,function*(){this.manuallyStopped=!1;const i=yield this.trackChangeLock.lock();try{t||(t=this._constraints);const r=t,s=r.deviceId,l=r.facingMode,c=Wre(t,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:t}));const h={audio:!1,video:!1};this.kind===Ce.Kind.Video?h.video=s||l?{deviceId:s,facingMode:l}:!0:h.audio=s?Object.assign({deviceId:s},c):!0,this.attachedElements.forEach(p=>{nh(this.mediaStreamTrack,p)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const f=(yield navigator.mediaDevices.getUserMedia(h)).getTracks()[0];return this.kind===Ce.Kind.Video&&(yield f.applyConstraints(c)),f.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(f,!1,n),this._constraints=t,this.pendingDeviceChange=!1,this.emit(Ue.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{i()}})}setTrackMuted(t){this.log.debug("setting ".concat(this.kind," track ").concat(t?"muted":"unmuted"),this.logContext),!(this.isMuted===t&&this._mediaStreamTrack.enabled!==t)&&(this.isMuted=t,this._mediaStreamTrack.enabled=!t,this.emit(t?Ue.Muted:Ue.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const t=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return z(this,void 0,void 0,function*(){yield t.handleAppVisibilityChanged.call(this),zB()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var t;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(t=this.processor)===null||t===void 0||t.destroy(),this.processor=void 0}pauseUpstream(){return z(this,void 0,void 0,function*(){var t;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}
663this._isUpstreamPaused=!0,this.emit(Ue.UpstreamPaused,this);const i=Or();if((i==null?void 0:i.name)==="Safari"&&ro(i.version,"12.0")<0)throw new PC("pauseUpstream is not supported on Safari < 12.");((t=this.sender.transport)===null||t===void 0?void 0:t.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return z(this,void 0,void 0,function*(){var t;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(Ue.UpstreamResumed,this),((t=this.sender.transport)===null||t===void 0?void 0:t.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return z(this,void 0,void 0,function*(){var t;return!((t=this.sender)===null||t===void 0)&&t.getStats?yield this.sender.getStats():void 0})}setProcessor(t){return z(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var s;const l=yield i.trackChangeLock.lock();try{i.log.debug("setting up processor",i.logContext);const c=document.createElement(i.kind),h={kind:i.kind,track:i._mediaStreamTrack,element:c,audioContext:i.audioContext,localTrack:i};if(yield n.init(h),i.log.debug("processor initialized",i.logContext),i.processor&&(yield i.internalStopProcessor()),i.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Kd(i._mediaStreamTrack,c),c.muted=!0,c.play().catch(d=>{d instanceof DOMException&&d.name==="AbortError"?(i.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},i.logContext),{error:d})),setTimeout(()=>{c.play().catch(f=>{i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{err:f}))})},100)):i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{error:d}))}),i.processor=n,i.processorElement=c,i.processor.processedTrack){for(const d of i.attachedElements)d!==i.processorElement&&r&&(nh(i._mediaStreamTrack,d),Kd(i.processor.processedTrack,d));yield(s=i.sender)===null||s===void 0?void 0:s.replaceTrack(i.processor.processedTrack)}i.emit(Ue.TrackProcessorUpdate,i.processor)}finally{l()}yield i.onSenderTrackSwapped()})()})}getProcessor(){return this.processor}stopProcessor(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){const i=yield t.trackChangeLock.lock();try{yield t.internalStopProcessor(n)}finally{i()}yield t.onSenderTrackSwapped()})()})}internalStopProcessor(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){var i,r;t.processor&&(t.log.debug("stopping processor",t.logContext),(i=t.processor.processedTrack)===null||i===void 0||i.stop(),yield t.processor.destroy(),t.processor=void 0,n||((r=t.processorElement)===null||r===void 0||r.remove(),t.processorElement=void 0),yield t._mediaStreamTrack.applyConstraints(t._constraints),yield t.setMediaStreamTrack(t._mediaStreamTrack,!0),t.emit(Ue.TrackProcessorUpdate))})()})}startPreConnectBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!Pae()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(this.localTrackRecorder){this.log.warn("preconnect buffer already started");return}else{let n="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(n)||(n="video/mp4"),this.localTrackRecorder=new Aae(this,{mimeType:n})}this.localTrackRecorder.start(t),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},Mae)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var t;return(t=this.localTrackRecorder)===null||t===void 0?void 0:t.byteStream}getPreConnectBufferMimeType(){var t;return(t=this.localTrackRecorder)===null||t===void 0?void 0:t.mimeType}}class Wv extends JB{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(t,Ce.Kind.Audio,n,i,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>z(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let l;
vendor: 14,099 bytes, line 663
663try{l=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}l&&this.prevStats&&(this._currentBitrate=by(l,this.prevStats)),this.prevStats=l}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(Ue.AudioTrackFeatureUpdate,this,Di.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(Ue.AudioTrackFeatureUpdate,this,Di.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=r,this.checkForSilence()}mute(){const t=Object.create(null,{mute:{get:()=>super.mute}});return z(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Ce.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield t.mute.call(this),this)}finally{n()}})}unmute(){const t=Object.create(null,{unmute:{get:()=>super.unmute}});return z(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===Ce.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||this.pendingDeviceChange)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restart(void 0,!0)),yield t.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}restartTrack(t){return z(this,void 0,void 0,function*(){let n;if(t){const i=MC({audio:t});typeof i.audio!="boolean"&&(n=i.audio)}yield this.restart(n)})}restart(t,n){const i=Object.create(null,{restart:{get:()=>super.restart}});return z(this,void 0,void 0,function*(){const r=yield i.restart.call(this,t,n);return this.checkForSilence(),r})}startMonitor(){Xr()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},DC)))}setProcessor(t){return z(this,void 0,void 0,function*(){var n;const i=yield this.trackChangeLock.lock();try{if(!ja()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const r={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext,localTrack:this};this.log.debug("setting up audio processor ".concat(t.name),this.logContext),yield t.init(r),this.processor=t,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(Ue.TrackProcessorUpdate,this.processor)}finally{i()}})}setAudioContext(t){this.audioContext=t}getSenderStats(){return z(this,void 0,void 0,function*(){var t;if(!(!((t=this.sender)===null||t===void 0)&&t.getStats))return;const n=yield this.sender.getStats();let i;return n.forEach(r=>{r.type==="outbound-rtp"&&(i={type:"audio",streamId:r.id,packetsSent:r.packetsSent,packetsLost:r.packetsLost,bytesSent:r.bytesSent,timestamp:r.timestamp,roundTripTime:r.roundTripTime,jitter:r.jitter})}),i})}checkForSilence(){return z(this,void 0,void 0,function*(){const t=yield FB(this);return t&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(Ue.AudioSilenceDetected)),t})}}function Rae(e,t,n){switch(e.kind){case"audio":return new Wv(e,t,!1,void 0,n);case"video":return new Kv(e,t,!1,n);default:throw new $o("unsupported track type: ".concat(e.kind))}}const Oae=Object.values(Hm),Iae=Object.values(xN),Dae=Object.values(_C),Lae=[Hm.h180,Hm.h360],Uae=[xN.h180,xN.h360],Bae=e=>[{scaleResolutionDownBy:2,fps:e.encoding.maxFramerate}].map(n=>{var i,r;return new hn(Math.floor(e.width/n.scaleResolutionDownBy),Math.floor(e.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(e.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((i=e.encoding.maxFramerate)!==null&&i!==void 0?i:30)/((r=n.fps)!==null&&r!==void 0?r:30))))),n.fps,e.encoding.priority)}),EN=["q","h","f"];function Hv(e,t,n,i){var r,s;let l=i==null?void 0:i.videoEncoding;e&&(l=i==null?void 0:i.screenShareEncoding);const c=i==null?void 0:i.simulcast,h=i==null?void 0:i.scalabilityMode,d=i==null?void 0:i.videoCodec;if(!l&&!c&&!h||!t||!n)return[{}];l||(l=Fae(e,t,n,d),vt.debug("using video encoding",l));const f=l.maxFramerate,p=new hn(t,n,l.maxBitrate,l.maxFramerate,l.priority);if(h&&da(d)){const N=new e8(h),j=[];if(N.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(h));const T=Or();if(Km()||ja()||(T==null?void 0:T.name)==="Chrome"&&ro(T==null?void 0:T.version,"113")<0){const E=N.suffix=="h"?2:3,C=Pse(T);for(let P=0;P<N.spatial;P+=1)j.push({rid:EN[2-P],maxBitrate:l.maxBitrate/Math.pow(E,P),maxFramerate:p.encoding.maxFramerate,scaleResolutionDownBy:C?Math.pow(2,P):void 0});j[0].scalabilityMode=h}else j.push({maxBitrate:l.maxBitrate,maxFramerate:p.encoding.maxFramerate,scalabilityMode:h});return p.encoding.priority&&(j[0].priority=p.encoding.priority,j[0].networkPriority=p.encoding.priority),vt.debug("using svc encoding",{encodings:j}),j}if(!c)return[l];let v;e?v=(r=ER(i==null?void 0:i.screenShareSimulcastLayers))!==null&&r!==void 0?r:TR(e,p):v=(s=ER(i==null?void 0:i.videoSimulcastLayers))!==null&&s!==void 0?s:TR(e,p);let x;if(v.length>0){const N=v[0];if(v.length>1){var b=v,S=tt(b,2);x=S[1]}const j=Math.max(t,n);if(j>=960&&x)return CS(t,n,[N,x,p],f);if(j>=480)return CS(t,n,[N,p],f)}return CS(t,n,[p])}function ZB(e,t,n){var i,r,s,l;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;t!==n.backupCodec.codec&&vt.warn("requested a different codec than specified as backup",{serverRequested:t,backup:n.backupCodec.codec}),n.videoCodec=t,n.videoEncoding=n.backupCodec.encoding;const c=e.mediaStreamTrack.getSettings(),h=(i=c.width)!==null&&i!==void 0?i:(r=e.dimensions)===null||r===void 0?void 0:r.width,d=(s=c.height)!==null&&s!==void 0?s:(l=e.dimensions)===null||l===void 0?void 0:l.height;return e.source===Ce.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),Hv(e.source===Ce.Source.ScreenShare,h,d,n)}function Fae(e,t,n,i){const r=$ae(e,t,n);let s=r[0].encoding;const l=Math.max(t,n);for(let c=0;c<r.length;c+=1){const h=r[c];if(s=h.encoding,h.width>=l)break}if(i)switch(i){case"av1":case"h265":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function $ae(e,t,n){if(e)return Dae;const i=t>n?t/n:n/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?Oae:Iae}function TR(e,t){if(e)return Bae(t);const n=t.width,i=t.height,r=n>i?n/i:i/n;return Math.abs(r-16/9)<Math.abs(r-4/3)?Lae:Uae}function CS(e,t,n,i){const r=[];if(n.forEach((s,l)=>{if(l>=EN.length)return;const c=Math.min(e,t),d={rid:EN[l],scaleResolutionDownBy:Math.max(1,c/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},f=i&&s.encoding.maxFramerate?Math.min(i,s.encoding.maxFramerate):s.encoding.maxFramerate;f&&(d.maxFramerate=f);const p=Or(),v=(p==null?void 0:p.name)==="Firefox"&&p.os!=="iOS"||l===0;s.encoding.priority&&v&&(d.priority=s.encoding.priority,d.networkPriority=s.encoding.priority),r.push(d)}),ja()&&WB()==="ios"){let s;r.forEach(c=>{s?c.maxFramerate&&c.maxFramerate>s&&(s=c.maxFramerate):s=c.maxFramerate});let l=!0;r.forEach(c=>{var h;c.maxFramerate!=s&&(l&&(l=!1,vt.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),vt.info('Setting framerate of encoding "'.concat((h=c.rid)!==null&&h!==void 0?h:"",'" to ').concat(s)),c.maxFramerate=s)})}return r}function ER(e){if(e)return e.slice().sort((t,n)=>{const i=t.encoding,r=n.encoding;return i.maxBitrate>r.maxBitrate?1:i.maxBitrate<r.maxBitrate?-1:i.maxBitrate===r.maxBitrate&&i.maxFramerate&&r.maxFramerate?i.maxFramerate>r.maxFramerate?1:-1:0})}class e8{constructor(t){const n=t.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var t;return"L".concat(this.spatial,"T").concat(this.temporal).concat((t=this.suffix)!==null&&t!==void 0?t:"")}}function Vae(e){return e.source===Ce.Source.ScreenShare||e.constraints.height&&bu(e.constraints.height)>=1080?"maintain-resolution":"balanced"}const zae=5e3;class Kv extends JB{get sender(){return this._sender}set sender(t){this._sender=t,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0;super(t,Ce.Kind.Video,n,i,r),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>z(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(h){this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:h}));return}const l=new Map(s.map(h=>[h.rid,h])),c=s.some(h=>h.qualityLimitationReason==="cpu");if(c!==this.isCpuConstrained&&(this.isCpuConstrained=c,this.isCpuConstrained&&this.emit(Ue.CpuConstrained)),this.prevStats){let h=0;l.forEach((d,f)=>{var p;const v=(p=this.prevStats)===null||p===void 0?void 0:p.get(f);h+=by(d,v)}),this._currentBitrate=h}this.prevStats=l}),this.senderLock=new ur}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(t){var n;if(this.signalClient=t,!Xr())return;const i=(n=this.sender)===null||n===void 0?void 0:n.getParameters();i&&(this.encodings=i.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},DC))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(t=>{t.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const t=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return z(this,void 0,void 0,function*(){var n,i,r,s,l;yield t.pauseUpstream.call(this);try{for(var c=!0,h=ua(this.simulcastCodecs.values()),d;d=yield h.next(),n=d.done,!n;c=!0)s=d.value,c=!1,yield(l=s.sender)===null||l===void 0?void 0:l.replaceTrack(null)}catch(f){i={error:f}}finally{try{!c&&!n&&(r=h.return)&&(yield r.call(h))}finally{if(i)throw i.error}}})}resumeUpstream(){const t=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return z(this,void 0,void 0,function*(){var n,i,r,s,l;yield t.resumeUpstream.call(this);try{for(var c=!0,h=ua(this.simulcastCodecs.values()),d;d=yield h.next(),n=d.done,!n;c=!0){s=d.value,c=!1;const f=s;yield(l=f.sender)===null||l===void 0?void 0:l.replaceTrack(f.mediaStreamTrack)}}catch(f){i={error:f}}finally{try{!c&&!n&&(r=h.return)&&(yield r.call(h))}finally{if(i)throw i.error}}})}mute(){const t=Object.create(null,{mute:{get:()=>super.mute}});return z(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Ce.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield t.mute.call(this),this)}finally{n()}})}unmute(){const t=Object.create(null,{unmute:{get:()=>super.unmute}});return z(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===Ce.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restart(void 0,!0)),yield t.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(t){super.setTrackMuted(t);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!t}getSenderStats(){return z(this,void 0,void 0,function*(){var t;if(!(!((t=this.sender)===null||t===void 0)&&t.getStats))return[];const n=[],i=yield this.sender.getStats();return i.forEach(r=>{var s;if(r.type==="outbound-rtp"){const l={type:"video",streamId:r.id,frameHeight:r.frameHeight,frameWidth:r.frameWidth,framesPerSecond:r.framesPerSecond,framesSent:r.framesSent,firCount:r.firCount,pliCount:r.pliCount,nackCount:r.nackCount,packetsSent:r.packetsSent,bytesSent:r.bytesSent,qualityLimitationReason:r.qualityLimitationReason,qualityLimitationDurations:r.qualityLimitationDurations,qualityLimitationResolutionChanges:r.qualityLimitationResolutionChanges,rid:(s=r.rid)!==null&&s!==void 0?s:r.id,retransmittedPacketsSent:r.retransmittedPacketsSent,targetBitrate:r.targetBitrate,timestamp:r.timestamp},c=i.get(r.remoteId);c&&(l.jitter=c.jitter,l.packetsLost=c.packetsLost,l.roundTripTime=c.roundTripTime),n.push(l)}}),n.sort((r,s)=>{var l,c;return((l=s.frameWidth)!==null&&l!==void 0?l:0)-((c=r.frameWidth)!==null&&c!==void 0?c:0)}),n})}setPublishingQuality(t){const n=[];for(let i=ps.LOW;i<=ps.HIGH;i+=1)n.push(new CC({quality:i,enabled:i<=t}));this.log.debug("setting publishing quality. max quality ".concat(t),this.logContext),this.setPublishingLayers(da(this.codec),n)}restartTrack(t){return z(this,void 0,void 0,function*(){var n,i,r,s,l;let c;if(t){const p=MC({video:t});typeof p.video!="boolean"&&(c=p.video)}yield this.restart(c),this.isCpuConstrained=!1;try{for(var h=!0,d=ua(this.simulcastCodecs.values()),f;f=yield d.next(),n=f.done,!n;h=!0){s=f.value,h=!1;const p=s;p.sender&&((l=p.sender.transport)===null||l===void 0?void 0:l.state)!=="closed"&&(p.mediaStreamTrack=this.mediaStreamTrack.clone(),yield p.sender.replaceTrack(p.mediaStreamTrack))}}catch(p){i={error:p}}finally{try{!h&&!n&&(r=d.return)&&(yield r.call(d))}finally{if(i)throw i.error}}yield this.onSenderTrackSwapped()})}onSenderTrackSwapped(){return z(this,void 0,void 0,function*(){yield this.refreshSen
663derEncodings()})}refreshSenderEncodings(){return z(this,void 0,void 0,function*(){var t;if(!this.sender||!this.publishOptions||this.optimizeForPerformance)return;const n=yield this.senderLock.lock();try{let r;try{r=yield this.waitForDimensions()}catch(c){this.log.warn("could not determine new track dimensions, skipping encoding recompute",Object.assign(Object.assign({},this.logContext),{error:c}));return}if(this.lastEncodedDimensions&&this.lastEncodedDimensions.width===r.width&&this.lastEncodedDimensions.height===r.height)return;const s=this.source===Ce.Source.ScreenShare,l=Hv(s,r.width,r.height,Object.assign({},this.publishOptions));yield this.applyEncodingsToSender(this.sender,l),this.encodings=l,this.lastEncodedDimensions=r;for(const c of this.simulcastCodecs){var i=tt(c,2);const h=i[0],d=i[1];if(!d.sender||((t=d.sender.transport)===null||t===void 0?void 0:t.state)==="closed"||!UB(h))continue;const f=Object.assign({},this.publishOptions),p=ZB(this,h,f);p&&(yield this.applyEncodingsToSender(d.sender,p),d.encodings=p)}}catch(r){this.log.warn("failed to apply recomputed encodings",Object.assign(Object.assign({},this.logContext),{error:r}))}finally{n()}})}applyEncodingsToSender(t,n){return z(this,void 0,void 0,function*(){const i=t.getParameters();!i.encodings||i.encodings.length!==n.length||(i.encodings.forEac
663h((r,s)=>{if(r.active===!1)return;const l=n[s];l.scaleResolutionDownBy!==void 0&&(r.scaleResolutionDownBy=l.scaleResolutionDownBy),l.maxBitrate!==void 0&&(r.maxBitrate=l.maxBitrate),l.maxFramerate!==void 0&&(r.maxFramerate=l.maxFramerate),l.priority!==void 0&&(r.priority=l.priority,r.networkPriority=l.priority)}),this.log.debug("updating sender encodings after track restart",Object.assign(Object.assign({},this.logContext),{encodings:i.encodings})),yield t.setParameters(i))})}setProcessor(t){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return z(this,arguments,void 0,function(i){var r=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var l,c,h,d,f,p;if(yield n.setProcessor.call(r,i,s),!((f=r.processor)===null||f===void 0)&&f.processedTrack)try{for(var v=!0,x=ua(r.simulcastCodecs.values()),b;b=yield x.next(),l=b.done,!l;v=!0)d=b.value,v=!1,yield(p=d.sender)===null||p===void 0?void 0:p.replaceTrack(r.processor.processedTrack)}catch(S){c={error:S}}finally{try{!v&&!l&&(h=x.return)&&(yield h.call(x))}finally{if(c)throw c.error}}})()})}setDegradationPreference(t){return z(this,void 0,void 0,function*(){if(this.degradationPreference=t,this.sender)try{this.log.debug("setting degradationPreference to ".concat(t),this.logContext);const n=this.sender.getParameters();n.degradationPreference=t,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(t,n){if(this.simulcastCodecs.has(t)){this.log.error("".concat(t," already added, skipping adding simulcast codec"),this.logContext);return}const i={codec:t,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(t,i),i}setSimulcastTrackSender(t,n){const i=this.simulcastCodecs.get(t);i&&(i.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},zae))}setPublishingCodecs(t){return z(this,void 0,void 0,function*(){var n,i,r,s,l,c,h;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:t,currentCodec:this.codec})),!this.codec&&t.length>0)return yield this.setPublishingLayers(da(t[0].codec),t[0].qualities),[];this.subscribedCodecs=t;const d=[];try{for(n=!0,i=ua(t);r=yield i.next(),s=r.done,!s;n=!0){h=r.value,n=!1;const f=h;if(!this.codec||this.codec===f.codec)yield this.setPublishingLayers(da(f.codec),f.qualities);else{const p=this.simulcastCodecs.get(f.codec);if(this.log.debug("try setPublishingCodec for ".concat(f.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:p})),!p||!p.sender){for(const v of f.qualities)if(v.enabled){d.push(f.codec);break}}else p.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(f.codec),this.logContext),yield AR(p.sender,p.encodings,f.qualities,this.senderLock,da(f.codec),this.log,this.logContext))}}}catch(f){l={error:f}}finally{try{!n&&!s&&(c=i.return)&&(yield c.call(i))}finally{if(l)throw l.error}}return d})}setPublishingLayers(t,n){return z(this,void 0,void 0,function*(){if(this.optimizeForPerformance){this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:n}));return}this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:n})),!(!this.sender||!this.encodings)&&(yield AR(this.sender,this.encodings,n,this.senderLock,t,this.log,this.logContext))})}prioritizePerformance(){return z(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const t=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const n=this.sender.getParameters();n.encodings=n.encodings.map((i,r)=>{var s;return Object.assign(Object.assign({},i),{active:r===0,scaleResolutionDownBy:Math.max(1,Math.ceil(((s=this.mediaStreamTrack.getSettings().height)!==null&&s!==void 0?s:360)/360)),scalabilityMode:r===0&&da(this.codec)?"L1T3":void 0,maxFramerate:r===0?15:0,maxBitrate:r===0?i.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:n.encodings})),this.encodings=n.encodings,yield this.sender.setParameters(n)}catch(n){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:n})),this.optimizeForPerformance=!1}finally{t()}})}handleAppVisibilityChanged(){const t=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return z(this,void 0,void 0,function*(){yield t.handleAppVisibilityChanged.call(this),zB()&&this.isInBackgroun
663d&&this.source===Ce.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function AR(e,t,n,i,r,s,l){return z(this,void 0,void 0,function*(){const c=yield i.lock();s.debug("setPublishingLayersForSender",Object.assign(Object.assign({},l),{sender:e,qualities:n,senderEncodings:t}));try{const h=e.getParameters(),d=h.encodings;if(!d)return;if(d.length!==t.length){s.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},l),{encodings:d,senderEncodings:t}));return}let f=!1;!1&&d[0].scalabilityMode||(r&&n.some(x=>x.enabled)&&n.forEach(x=>x.enabled=!0),d.forEach((v,x)=>{var b;let S=(b=v.rid)!==null&&b!==void 0?b:"";S===""&&(S="q");const N=t8(S),j=n.find(T=>T.quality===N);j&&v.active!==j.enabled&&(f=!0,v.active=j.enabled,s.debug("setting layer ".concat(j.quality," to ").concat(v.active?"enabled":"disabled"),l),Eu()&&(j.enabled?(v.scaleResolutionDownBy=t[x].scaleResolutionDownBy,v.maxBitrate=t[x].maxBitrate,v.maxFrameRate=t[x].maxFrameRate):(v.scaleResolutionDownBy=4,v.maxBitrate=10,v.maxFrameRate=2)))})),f&&(h.encodings=d,s.debug("setting encodings",Object.assign(Object.assign({},l),{encodings:h.encodings})),yield e.setParameters(h))}finally{c()}})}function t8(e){switch(e){case"f":return ps.HIGH;case"h":return ps.MEDIUM;case"q":return ps.LOW;default:return ps.HIGH}}function PR(e,t,n,i){if(!n)return[new rc({quality:ps.HIGH,width:e,height:t,bitrate:0,ssrc:0})];if(i){const r=n[0].scalabilityMode,s=new e8(r),l=[],c=s.suffix=="h"?1.5:2,h=s.suffix=="h"?2:3;for(let d=0;d<s.spatial;d+=1)l.push(new rc({quality:Math.min(ps.HIGH,s.spatial-1)-d,width:Math.ceil(e/Math.pow(c,d)),height:Math.ceil(t/Math.pow(c,d)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(h,d)):0,ssrc:0}));return l}return n.map(r=>{var s,l,c;const h=(s=r.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let d=t8((l=r.rid)!==null&&l!==void 0?l:"");return new rc({quality:d,width:Math.ceil(e/h),height:Math.ceil(t/h),bitrate:(c=r.maxBitrate)!==null&&c!==void 0?c:0,ssrc:0})})}const _R="_lossy",MR="_reliable",RR="_data_track",qae=2*1e3,TS="leave-reconnect",Wae=3e4,Hae=8*1024,Kae=256*1024,Gae=3,Yae=3;var Ds;(function(e){e[e.New=0]="New",e[e.Connected=1]="Connected",e[e.Disconnected=2]="Disconnected",e[e.Reconnecting=3]="Reconnecting",e[e.Closed=4]="Closed"})(Ds||(Ds={}));var xt;(function(e){e[e.RELIABLE=0]="RELIABLE",e[e.LOSSY=1]="LOSSY",e[e.DATA_TRACK_LOSSY=2]="DATA_TRACK_LOSSY"})(xt||(xt={}));const OR=64e3;class Qae extends ts.EventEmitter{get isClosed(){return this._isClosed}get isNewlyCreated(){return this._isNewlyCreated}get pendingReconnect(){return!!this.reconnectTimeout}constructor(t){var n;super(),this.options=t,this.rtcConfig={},this.peerConnectionTimeout=zC.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=Ds.New,this._isClosed=!0,this._isNewlyCreated=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.shouldFailOnV1Path=!1,this.log=vt,this.reliableDataSequence=1,this.reliableMessageBuffer=new yR,this.reliableReceivedState=new xae(Wae),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.bufferStatusLowClosingFuture=new Fi,this.handleDataChannel=i=>z(this,[i],void 0,function(r){var s=this;let l=r.channel;return(function*(){if(!l)return;let c;if(l.label===MR)s.reliableDCSub=l,c=s.handleDataMessage;else if(l.label===_R)s.lossyDCSub=l,c=s.handleDataMessage;else if(l.label===RR)s.dataTrackDCSub=l,c=s.handleDataTrackMessage;else return;s.log.debug("on data channel ".concat(l.id,", ").concat(l.label)),l.onmessage=c})()}),this.handleDataMessage=i=>z(this,void 0,void 0,function*(){var r,s,l,c,h;const d=yield this.dataProcessLock.lock();try{let f;if(i.data instanceof ArrayBuffer)f=i.data;else if(i.data instanceof Blob)f=yield i.data.arrayBuffer();else{this.log.error("unsupported data type",{data:i.data});return}const p=xr.fromBinary(new Uint8Array(f));if(p.sequence>0&&p.participantSid!==""){const v=this.reliableReceivedState.get(p.participantSid);if(v&&p.sequence<=v)return;this.reliableReceivedState.set(p.participantSid,p.sequence)}if(((r=p.value)===null||r===void 0?void 0:r.case)==="speaker")this.emit
663(Re.ActiveSpeakersUpdate,p.value.value.speakers);else if(((s=p.value)===null||s===void 0?void 0:s.case)==="encryptedPacket"){if(!this.e2eeManager){this.log.error("Received encrypted packet but E2EE not set up");return}const v=yield(l=this.e2eeManager)===null||l===void 0?void 0:l.handleEncryptedData(p.value.value.encryptedValue,p.value.value.iv,p.participantIdentity,p.value.value.keyIndex),x=MU.fromBinary(v.payload),b=new xr({value:x.value,participantIdentity:p.participantIdentity,participantSid:p.participantSid});((c=b.value)===null||c===void 0?void 0:c.case)==="user"&&IR(b,b.value.value),this.emit(Re.DataPacketReceived,b,p.value.value.encryptionType)}else((h=p.value)===null||h===void 0?void 0:h.case)==="user"&&IR(p,p.value.value),this.emit(Re.DataPacketReceived,p,xn.NONE)}finally{d()}}),this.handleDataTrackMessage=i=>z(this,void 0,void 0,function*(){let r;if(i.data instanceof ArrayBuffer)r=i.data;else if(i.data instanceof Blob)r=yield i.data.arrayBuffer();else{this.log.error("unsupported data type",{data:i.data});return}this.emit("dataTrackPacketReceived",new Uint8Array(r))}),this.handleDataError=i=>{if(this._isClosed)return;const s=i.currentTarget.maxRetransmits===0?"lossy":"reliable";if(typeof RTCErrorEvent<"u"&&i instanceof RTCErrorEvent&&i.error){const l=i.error;this.log.error("DataChannel error on ".concat(s,": ").concat(l.message),{error:l,errorDetail:l.errorDetail,sctpCauseCode:l.sctpCauseCode})}else this.log.error("Unknown DataChannel error on ".concat(s),{event:i})},this.handleDataChannelClose=i=>()=>{var r;!this._isClosed&&((r=this.pcManager)===null||r===void 0?void 0:r.publisher.getConnectionState())==="connected"&&this.log.error("publisher data channel '".concat(xt[i],"' closed unexpectedly"),this.logContext)},this.handleBufferedAmountLow=i=>{this.updateAndEmitDCBufferStatus(i)},this.handleDisconnect=(i,r)=>{if(this._isClosed)return;this.log.warn("".concat(i," disconnected")),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=h=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(h,"ms. giving up")),this.emit(Re.Disconnected),this.close()},l=Date.now()-this.reconnectStart;let c=this.getNextRetryDelay({elapsedMs:l,retryCount:this.reconnectAttempts});if(c===null){s(l);return}i===TS&&(c=0),this.log.debug("reconnecting in ".concat(c,"ms")),this.clearReconnectTimeout(),this.token&&this.emit(Re.TokenRefreshed,this.token),this.reconnectTimeout=yi.setTimeout(()=>this.attemptReconnect(r).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((i,r)=>{this.pcState===Ds.Connected&&i();const s=()=>{this.off(Re.Disconnected,l),i()},l=()=>{this.off(Re.Restarted,s),r()};this.once(Re.Restarted,s),this.once(Re.Disconnected,l)}),this.updateAndEmitDCBufferStatus=i=>{if(i===xt.RELIABLE){const s=this.dataChannelForKind(i);s&&this.reliableMessageBuffer.alignBufferedAmount(s.bufferedAmount)}const r=this.isBufferStatusLow(i);typeof r<"u"&&r!==this.dcBufferStatus.get(i)&&(this.dcBufferStatus.set(i,r),this.emit(Re.DCBufferStatusChanged,r,i))},this.isBufferStatusLow=i=>{const r=this.dataChannelForKind(i);if(r)return r.bufferedAmount<=r.bufferedAmountLowThreshold},this.onRtpMapAvailable=i=>{const r=new Map;i.forEach(s=>{const l=s.codec.toLowerCase();Ise(l)&&r.set(s.payload,l)}),this.emit(Re.RTPVideoMapUpdate,r)},this.handleBrowserOnLine=()=>z(this,void 0,void 0,function*(){!this.url||!(yield fetch(Gm(this.url),{method:"HEAD"}).then(r=>r.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===gn.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===gn.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(Kc.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>z(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Gm(this.url),{method:"HEAD"}),br(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=es((n=t.loggerName)!==null&&n!==void 0?n:zi.Engine,()=>this.logContext),this.loggerOptions={loggerName:t.loggerName,loggerContextCb:()=>this.logContext},this.client=new FC(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new ur,this.dataProcessLock=new ur,this.dcBufferStatus=new Map([[xt.RELIABLE,!0],[xt.LOSSY,!0
663],[xt.DATA_TRACK_LOSSY,!0]]),this.client.onParticipantUpdate=i=>this.emit(Re.ParticipantUpdate,i),this.client.onConnectionQuality=i=>this.emit(Re.ConnectionQualityUpdate,i),this.client.onRoomUpdate=i=>this.emit(Re.RoomUpdate,i),this.client.onSubscriptionError=i=>this.emit(Re.SubscriptionError,i),this.client.onSubscriptionPermissionUpdate=i=>this.emit(Re.SubscriptionPermissionUpdate,i),this.client.onSpeakersChanged=i=>this.emit(Re.SpeakersChanged,i),this.client.onStreamStateUpdate=i=>this.emit(Re.StreamStateChanged,i),this.client.onRequestResponse=i=>this.emit(Re.SignalRequestResponse,i),this.client.onParticipantUpdate=i=>this.emit(Re.ParticipantUpdate,i),this.client.onJoined=i=>this.emit(Re.Joined,i),this.on(Re.Closing,()=>{var i,r;(r=(i=this.bufferStatusLowClosingFuture).reject)===null||r===void 0||r.call(i,new Vn("engine closed"))}),this.bufferStatusLowClosingFuture.promise.catch(()=>{})}get logContext(){var t,n,i,r,s,l;return{room:(n=(t=this.latestJoinResponse)===null||t===void 0?void 0:t.room)===null||n===void 0?void 0:n.name,roomID:(r=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.room)===null||r===void 0?void 0:r.sid,participant:(l=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||l===void 0?void 0:l.identity,participantID:this.participantSid}}join(t,n,i,r){return z(this,arguments,void 0,function(s,l,c,h){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){var p,v,x;d._isNewlyCreated=!1,d.url=s,d.token=l,d.signalOpts=c,d.maxJoinAttempts=c.maxRetries;try{d.joinAttempts+=1,d.setupSignalClientCallbacks();const b=!f&&zse();let S;if(b){d.pcManager||(yield d.configure(),d.applyInitialPublisherLayout());const T=yield(p=d.pcManager)===null||p===void 0?void 0:p.publisher.createInitialOffer();T&&(S=nu(T.offer,T.offerId))}if(h!=null&&h.aborted)throw at.cancelled("Connection aborted");if(!f&&d.shouldFailOnV1Path)throw d.shouldFailOnV1Path=!1,at.serviceNotFound("Simulated v1 path failure","v0-rtc");const N=yield d.client.join(s,l,c,h,f,S);d._isClosed=!1,d.latestJoinResponse=N,d.participantSid=(v=N.participant)===null||v===void 0?void 0:v.sid,d.subscriberPrimary=N.subscriberPrimary,b?(x=d.pcManager)===null||x===void 0||x.updateConfiguration(d.makeRTCConfiguration(N)):(d.pcManager||(yield d.configure(N,!f),f||d.applyInitialPublisherLayout()),(!d.subscriberPrimary||N.fastPublish)&&d.negotiate().catch(T=>{d.log.error(T)})),d.registerOnLineListener(),d.clientConfiguration=N.clientConfiguration,d.emit(Re.SignalConnected,N);let j=N.serverInfo;return j||(j={version:N.serverVersion,region:N.serverRegion}),d.log.info("connected to Livekit Server ".concat(Object.entries(j).map(T=>{let E=tt(T,2),C=E[0],P=E[1];return"".concat(C,": ").concat(P)}).join(", "))),{joinResponse:N,serverInfo:j}}catch(b){if(b instanceof at){if(b.reason===vn.ServerUnreachable){if(d.log.warn("Couldn't connect to server, attempt ".concat(d.joinAttempts," of ").concat(d.maxJoinAttempts)),d.joinAttempts<d.maxJoinAttempts)return d.join(s,l,c,h,f)}else if(b.reason===vn.ServiceNotFound)return d.log.warn("Initial connection failed: ".concat(b.message," – Retrying")),d.pcManager&&(d.pcManager.onStateChange=void 0,yield d.cleanupPeerConnections()),d.join(s,l,c,h,!0)}throw b}})()})}close(){return z(this,void 0,void 0,function*(){const t=yield this.closingLock.lock();if(this.isClosed){t();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(Re.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{t()}})}cleanupPeerConnections(){return z(this,void 0,void 0,function*(){var t;const n=i=>{i&&(i.onbufferedamountlow=null,i.onclose=null,i.onclosing=null,i.onerror=null,i.onmessage=null,i.onopen=null,i.close())};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),n(this.dataTrackDC),n(this.dataTrackDCSub),yield(t=this.pcManager)===null||t===void 0?void 0:t.close(),this.pcManager=void 0,this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.dataTrackDC=void 0,this.dataTrackDCSub=void 0,this.reliableMessageBuffer=new yR,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupLossyDataStats(){this.lossyDataStatByterate=0,this.lossyDataStatCurrentBytes=0,this.lossyDataStatInterval&&(clearInterval(this.lossyDataStatInterval),this.lossyDataStatInterval=void 0),this.lossyDataDropCount=0}cleanupClient(){return z(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks();for(const t of Object.keys(this.pendingTrackResolvers))this.pendingTrackResolvers[t].reject();this.pendingTrackResolvers={}})}addTrack(t){if(this.pendingTrackResolvers[t.cid])throw new $o("a track with the same ID has already been published");return new Promise((n,i)=>{const r=setTimeout(()=>{delete this.pendingTrackResolvers[t.cid],i(at.timeout("publication of local track timed out, no response from server"))},1e4);this.pendingTrackResolvers[t.cid]={resolve:s=>{clearTimeout(r),n(s)},reject:()=>{clearTimeout(r),i(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(t)})}removeTrack(t){if(t.track&&this.pendingTrackResolvers[t.track.id]){const n=this.pendingTrackResolvers[t.track.id].reject;n&&n(),delete this.pendingTrackResolvers[t.track.id]}try{return this.pcManager.removeTrack(t),!0}catch(n){this.log.warn("failed to remove track",{error:n})}return!1}updateMuteStatus(t,n){this.client.sendMuteTrack(t,n)}get dataSubscriberReadyState(){var t;return(t=this.reliableDCSub)===null||t===void 0?void 0:t.readyState}getConnectedServerAddress(){return z(this,void 0,void 0,function*(){var t;return(t=this.pcManager)===null||t===void 0?void 0:t.getConnectedAddress()})}setRegionStrategy(t){this.regionStrategy=t}configure(t,n){return z(this,void 0,void 0,function*(){var i;if(!(this.pcManager&&this.pcManager.currentState!==zn.NEW)){if(t){this.participantSid=(i=t.participant)===null||i===void 0?void 0:i.sid;const r=this.makeRTCConfiguration(t);this.pcManager=new CR(n?"publisher-only":t.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions,r)}else{const r=this.makeRTCConfiguration();this.pcManager=new CR("publisher-only",this.loggerOptions,r)}
663this.emit(Re.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(r,s)=>{this.client.sendIceCandidate(r,s)},this.pcManager.onPublisherOffer=(r,s)=>{this.client.sendOffer(r,s)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(r,s,l)=>z(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(r)),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),r===zn.CONNECTED){const d=this.pcState===Ds.New;this.pcState=Ds.Connected,d&&this.emit(Re.Connected,this.latestJoinResponse)}else r===zn.FAILED&&(this.pcState===Ds.Connected||this.pcState===Ds.Reconnecting)&&(this.pcState=Ds.Disconnected,this.handleDisconnect("peerconnection failed",l==="failed"?Kc.RR_SUBSCRIBER_FAILED:Kc.RR_PUBLISHER_FAILED));const c=this.client.isDisconnected||this.client.currentState===gn.RECONNECTING,h=[zn.FAILED,zn.CLOSING,zn.CLOSED].includes(r);c&&h&&!this._isClosed&&this.emit(Re.Offline)}),this.pcManager.onTrack=r=>{r.streams.length!==0&&this.emit(Re.MediaTrackAdded,r.track,r.streams[0],r.receiver)}}})}setupSignalClientCallbacks(){this.client.onAnswer=(t,n,i)=>z(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",{RTCSdpType:t.type,sdp:t.sdp,midToTrackId:i}),this.midToTrackId=i,yield this.pcManager.setPublisherAnswer(t,n))}),this.client.onTrickle=(t,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",{candidate:t,target:n}),this.pcManager.addIceCandidate(t,n))},this.client.onOffer=(t,n,i)=>z(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=n,!this.pcManager)return;this.midToTrackId=i;const r=yield this.pcManager.createSubscriberAnswerFromOffer(t,n);r&&this.client.sendAnswer(r,n)}),this.client.onLocalTrackPublished=t=>{var n;if(this.log.debug("received trackPublishedResponse",{cid:t.cid,track:(n=t.track)===null||n===void 0?void 0:n.sid}),!this.pendingTrackResolvers[t.cid]){this.log.error("missing track resolver for ".concat(t.cid),{cid:t.cid});return}const i=this.pendingTrackResolvers[t.cid].resolve;delete this.pendingTrackResolvers[t.cid],i(t.track)},this.client.onLocalTrackUnpublished=t=>{this.emit(Re.LocalTrackUnpublished,t)},this.client.onLocalTrackSubscribed=t=>{this.emit(Re.LocalTrackSubscribed,t)},this.client.onTokenRefresh=t=>{this.token=t,this.emit(Re.TokenRefreshed,t)},this.client.onRemoteMuteChanged=(t,n)=>{this.emit(Re.RemoteMute,t,n)},this.client.onSubscribedQualityUpdate=t=>{this.emit(Re.SubscribedQualityUpdate,t)},this.client.onRoomMoved=t=>{var n;this.participantSid=(n=t.participant)===null||n===void 0?void 0:n.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=t.room),this.emit(Re.RoomMoved,t)},this.client.onMediaSectionsRequirement=t=>{this.addMediaSections(t.numAudios,t.numVideos),this.negotiate()},this.client.onPublishDataTrackResponse=t=>{this.emit(Re.PublishDataTrackResponse,t)},this.client.onUnPublishDataTrackResponse=t=>{this.emit(Re.UnPublishDataTrackResponse,t)},this.client.onDataTrackSubscriberHandles=t=>{this.emit(Re.DataTrackSubscriberHandles,t)},this.client.onClose=()=>{this.handleDisconnect("signal",Kc.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=t=>{switch(this.log.info("client leave request received (action=".concat(t==null?void 0:t.action,")"),{reason:t==null?void 0:t.reason}),t.regions&&(this.log.debug("updating regions"),this.emit(Re.ServerRegionsReported,t.regions)),t.action){case eh.DISCONNECT:this.emit(Re.Disconnected,t==null?void 0:t.reason),this.close();break;case eh.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(TS);break;case eh.RESUME:this.handleDisconnect(TS)}}}makeRTCConfiguration(t){var n;const i=Object.assign({},this.rtcConfig);if((((n=this.signalOpts)===null||n===void 0?void 0:n.e2eeEnabled)||this.frameMetadataWorker&&!Ym())&&OC()&&(this.log.debug("E2EE - setting up transports with insertable streams"),i.encodedInsertableStreams=!0),i.sdpSemantics="unified-plan",i.continualGatheringPolicy="gather_continually",!t)return i;if(t.iceServers&&!i.iceServers){const s=[];t.iceServers.forEach(l=>{const c={urls:l.urls};l.username&&(c.username=l.username),l.credential&&(c.credential=l.credential),s.push(c)}),i.iceServers=s}return t.clientConfiguration&&t.clientConfiguration.forceRelay===zm.ENABLED&&(i.iceTransportPolicy="relay"),i}applyInitialPublisherLayout(){this.createDataChannels(),ja()||this.addMediaSections(Gae,Yae)}addMediaSections(t,n){var i,r;const s={direction:"recvonly"};for(let l=0;l<t;l++)(i=this.pcManager)===null||i===void 0||i.addPublisherTransceiverOfKind("audio",s);for(let l=0;l<n;l++)(r=this.pcManager)===null||r===void 0||r.addPublisherTransceiverOfKind("video",s)}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null,this.lossyDC.onclose
663=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null,this.reliableDC.onclose=null),this.dataTrackDC&&(this.dataTrackDC.onmessage=null,this.dataTrackDC.onerror=null,this.dataTrackDC.onclose=null),this.lossyDC=this.pcManager.createPublisherDataChannel(_R,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(MR,{ordered:!0}),this.dataTrackDC=this.pcManager.createPublisherDataChannel(RR,{ordered:!1,maxRetransmits:0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.dataTrackDC.onmessage=this.handleDataTrackMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.dataTrackDC.onerror=this.handleDataError,this.lossyDC.onclose=this.handleDataChannelClose(xt.LOSSY),this.reliableDC.onclose=this.handleDataChannelClose(xt.RELIABLE),this.dataTrackDC.onclose=this.handleDataChannelClose(xt.DATA_TRACK_LOSSY),this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.dataTrackDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(xt.LOSSY),this.reliableDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(xt.RELIABLE),this.dataTrackDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(xt.DATA_TRACK_LOSSY),this.cleanupLossyDataStats(),this.lossyDataStatInterval=setInterval(()=>{this.lossyDataStatByterate=this.lossyDataStatCurrentBytes,this.lossyDataStatCurrentBytes=0;const t=this.dataChannelForKind(xt.LOSSY);if(t){const n=this.lossyDataStatByterate/10;t.bufferedAmountLowThreshold=Math.min(Math.max(n,Hae),Kae)}},1e3))}createSender(t,n,i){return z(this,void 0,void 0,function*(){let r;if(wN())r=yield this.createTransceiverRTCRtpSender(t,n,i);else if(SN())this.log.warn("using add-track fallback"),r=yield this.createRTCRtpSender(t.mediaStreamTrack);else throw new Vn("Required webRTC APIs not supported on this device");return this.setupFrameMetadataSender(r,n),r})}createSimulcastSender(t,n,i,r){return z(this,void 0,void 0,function*(){let s;if(wN())s=yield this.createSimulcastTransceiverSender(t,n,i,r);else if(SN())this.log.debug("using add-track fallback"),s=yield this.createRTCRtpSender(t.mediaStreamTrack);else throw new Vn("Cannot stream on this device");return s&&this.setupFrameMetadataSender(s,i),s})}get frameMetadataWorker(){var t,n;return(n=(t=this.options.frameMetadata)!==null&&t!==void 0?t:this.options.packetTrailer)===null||n===void 0?void 0:n.worker}setupFrameMetadataSender(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i,r,s;const l=this.frameMetadataWorker;if(!l||!((i=this.signalOpts)===null||i===void 0)&&i.e2eeEnabled)return;const c=(r=n.frameMetadata)!==null&&r!==void 0?r:n.packetTrailer,h=zv(c);if(Ym()){h&&(t.transform=new RTCRtpScriptTransform(l,{kind:"encode",packetTrailer:c}));return}if(!Qm((s=this.options.frameMetadata)!==null&&s!==void 0?s:this.options.packetTrailer)||!("createEncodedStreams"in t)){h&&this.log.warn("frame metadata transform not supported; skipping write",this.logContext);return}const d=t.createEncodedStreams(),f=d.readable,p=d.writable;h?l.postMessage({kind:"encode",data:{readableStream:f,writableStream:p,packetTrailer:c}},[f,p]):f.pipeTo(p)}createTransceiverRTCRtpSender(t,n,i){return z(this,void 0,void 0,function*(){if(!this.pcManager)throw new Vn("publisher is closed");const r=[];t.mediaStream&&r.push(t.mediaStream),Jo(t)&&(t.codec=n.videoCodec);const s={direction:"sendonly",streams:r};return i&&(s.sendEncodings=i),(yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(t,n,i,r){return z(this,void 0,void 0,function*(){if(!this.pcManager)throw new Vn("publisher is closed");const s={direction:"sendonly"};r&&(s.sendEncodings=r);const l=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(i.videoCodec)return t.setSimulcastTrackSender(i.videoCodec,l.sender),l.sender})}createRTCRtpSender(t){return z(this,void 0,void 0,function*(){if(!this.pcManager)throw new Vn("publisher is closed");return this.pcManager.addPublisherTrack(t)})}attemptReconnect(t){return z(this,void 0,void 0,function*(){var n,i,r;if(!this._isClosed){if(this.attemptingReconnect){this.log.warn("already attempting reconnect, returning early");return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===zm.DISABLED||((r=(i=this.pcManager)===null||i===void 0?void 0:i.currentState)!==null&&r!==void 0?r:zn.NEW)===zn.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(t),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let l=!0;s instanceof Vn?(this.log.debug("received unrecoverable error",{error:s}),l=!1):s instanceof Td||(this.fullReconnectOnNext=!0),l?this.handleDisconnect("reconnect",Kc.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up")),this.emit
vendor: 2,254 bytes, line 663
663(Re.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(t){try{return this.reconnectPolicy.nextRetryDelayInMs(t)}catch(n){this.log.warn("encountered error in reconnect policy",{error:n})}return null}restartConnection(t){return z(this,void 0,void 0,function*(){var n,i,r;try{if(!this.url||!this.token)throw new Vn("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts)),this.emit(Re.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present"),new Td;s=(yield this.join(t??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)).joinResponse}catch(l){throw l instanceof at&&l.reason===vn.NotAllowed?new Vn("could not reconnect, token might be expired"):new Td}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(Re.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==gn.CONNECTED)throw new Td("Signal connection got severed during reconnect");(n=this.regionStrategy)===null||n===void 0||n.resetAttempts(),this.emit(Re.Restarted)}catch(s){const l=yield(i=this.regionStrategy)===null||i===void 0?void 0:i.getNextUrl();if(l){yield this.restartConnection(l);return}else throw(r=this.regionStrategy)===null||r===void 0||r.resetAttempts(),s}})}resumeConnection(t){return z(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new Vn("could not reconnect, url or token not saved");if(!this.pcManager)throw new Vn("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts)),this.emit(Re.Resuming);let i;try{this.setupSignalClientCallbacks(),i=yield this.client.reconnect(this.url,this.token,this.participantSid,t)}catch(r){let s="";throw r instanceof Error&&(s=r.message,this.log.error(r.message,{error:r})),r instanceof at&&r.reason===vn.NotAllowed?new Vn("could not reconnect, token might be expired"):r instanceof at&&r.reason===vn.LeaveRequest?r:new Td(s)}
663if(this.emit(Re.SignalResumed),i){const r=this.makeRTCConfiguration(i);this.pcManager.updateConfiguration(r),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=i.serverInfo)}else this.log.warn("Did not receive reconnect response");if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==gn.CONNECTED)throw new Td("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),i!=null&&i.lastMessageSeq&&this.resendReliableMessagesForResume(i.lastMessageSeq),this.emit(Re.Resumed)})}waitForPCInitialConnection(t,n){return z(this,void 0,void 0,function*(){if(!this.pcManager)throw new Vn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,t)})}waitForPCReconnected(){return z(this,void 0,void 0,function*(){this.pcState=Ds.Reconnecting,this.log.debug("waiting for peer connection to reconnect");try{if(yield br(qae),!this.pcManager)throw new Vn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Ds.Connected}catch(t){throw this.pcState=Ds.Disconnected,at.internal("could not establish PC connection, ".concat(t.message))}})}publishRpcAck(t,n){return z(this,void 0,void 0,function*(){const i=new xr({destinationIdentities:[t],kind:sc.RELIABLE,value:{case:"rpcAck",value:new my({requestId:n})}});yield this.sendDataPacket(i,xt.RELIABLE)})}sendDataPacket(t,n){return z(this,void 0,void 0,function*(){var i,r;if(yield this.ensurePublisherConnected(n),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const c=Zse(t);if(c){const h=yield this.e2eeManager.encryptData(c.toBinary());t.value={case:"encryptedPacket",value:new _U({encryptedValue:h.payload,iv:h.iv,keyIndex:h.keyIndex})}}}n===xt.RELIABLE&&(t.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const s=t.toBinary(),l=Math.min((r=(i=this.pcManager)===null||i===void 0?void 0:i.getMaxPublisherMessageSize())!==null&&r!==void 0?r:OR,OR);if(typeof l<"u"&&l!==0&&s.byteLength>l)throw new use("cannot publish data packet larger than ".concat(l," bytes (got ").concat(s.byteLength,")"));switch(n){case xt.LOSSY:case xt.DATA_TRACK_LOSSY:return this.sendLossyBytes(s,n);case xt.RELIABLE:const c=this.dataChannelForKind(n);if(c){if(yield this.waitForBufferStatusLow(n),this.reliableMessageBuffer.push({data:s,sequence:t.sequence}),this.attemptingReconnect)return;c.send(s)}this.updateAndEmitDCBufferStatus(n);break}})}sendLossyBytes(t,n){return z(this,arguments,void 0,function(i,r){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"drop";return(function*(){yield s.ensurePublisherConnected(r);const c=s.dataChannelForKind(r);if(c){if(!s.isBufferStatusLow(r))switch(l){case"wait":yield s.waitForBufferStatusLow(r);break;case"drop":s.lossyDataDropCount+=1,s.lossyDataDropCount%100===0&&s.log.warn("dropping lossy data channel messages, total dropped: ".concat(s.lossyDataDropCount));return}if(s.lossyDataStatCurrentBytes+=i.byteLength,s.attemptingReconnect)return;c.send(i)}s.updateAndEmitDCBufferStatus(r)})()})}resendReliableMessagesForResume(t){return z(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(xt.RELIABLE);const n=this.dataChannelForKind(xt.RELIABLE);n&&(this.reliableMessageBuffer.popToSequence(t),this.reliableMessageBuffer.getAll().forEach(i=>{n.send(i.data)})),this.updateAndEmitDCBufferStatus(xt.RELIABLE)})}waitForBufferStatusLow(t){return z(this,void 0,void 0,function*(){return new _r((n,i)=>z(this,void 0,void 0,function*(){if(this.isClosed&&i(new Vn("engine closed")),this.isBufferStatusLow(t))n();else{const r=this.dataChannelForKind(t);if(!r){i(new Vn("DataChannel not found, kind: ".concat(t)));return}this.bufferStatusLowClosingFuture.promise.catch(s=>i(s)),r.addEventListener("bufferedamountlow",()=>n(),{once:!0})}}))})}ensureDataTransportConnected(t){return z(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return(function*(){var s;if(!i.pcManager)throw new Vn("PC manager is closed");const l=r?i.pcManager.subscriber:i.pcManager.publisher,c=r?"Subscriber":"Publisher";if(!l)throw at.internal("".concat(c," connection not set"));let h=!1;!r&&!i.dataChannelForKind(n,r)&&(i.createDataChannels(),h=!0),!h&&
663!r&&!i.pcManager.publisher.isICEConnected&&i.pcManager.publisher.getICEConnectionState()!=="checking"&&(h=!0),h&&i.negotiate().catch(p=>{i.log.error(p)});const d=i.dataChannelForKind(n,r);if((d==null?void 0:d.readyState)==="open")return;const f=new Date().getTime()+i.peerConnectionTimeout;for(;new Date().getTime()<f;){if(l.isICEConnected&&((s=i.dataChannelForKind(n,r))===null||s===void 0?void 0:s.readyState)==="open")return;yield br(50)}throw at.internal("could not establish ".concat(c," connection, state: ").concat(l.getICEConnectionState()))})()})}ensurePublisherConnected(t){return z(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(t,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||![zn.CONNECTING,zn.CONNECTED].includes(this.pcManager.currentState)||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return z(this,void 0,void 0,function*(){return new _r((t,n)=>z(this,void 0,void 0,function*(){if(!this.pcManager){n(new yu("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&!this.dataTrackDC&&this.createDataChannels();const i=new AbortController,r=()=>{i.abort(),this.log.debug("engine disconnected while negotiation was ongoing"),t()};this.isClosed&&n(new yu("cannot negotiate on closed engine")),this.on(Re.Closing,r),this.on(Re.Restarting,r),this.pcManager.publisher.off(tc.RTPVideoPayloadTypes,this.onRtpMapAvailable),this.pcManager.publisher.once(tc.RTPVideoPayloadTypes,this.onRtpMapAvailable);try{yield this.pcManager.negotiate(i),t()}catch(s){if(i.signal.aborted){t();return}s instanceof yu&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Kc.RR_UNKNOWN),s instanceof Error?n(s):n(new Error(String(s)))}finally{this.off(Re.Closing,r),this.off(Re.Restarting,r)}}))})}dataChannelForKind(t,n){switch(t){case xt.RELIABLE:return n?this.reliableDCSub:this.reliableDC;case xt.LOSSY:return n?this.lossyDCSub:this.lossyDC;case xt.DATA_TRACK_LOSSY:return n?this.dataTrackDCSub:this.dataTrackDC}}sendSyncState(t,n,i){var r,s,l,c;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup");return}const h=this.pcManager.publisher.getLocalDescription(),d=this.pcManager.publisher.getRemoteDescription(),f=(r=this.pcManager.subscriber)===null||r===void 0?void 0:r.getRemoteDescription(),p=(s=this.pcManager.subscriber)===null||s===void 0?void 0:s.getLocalDescription(),v=(c=(l=this.signalOpts)===null||l===void 0?void 0:l.autoSubscribe)!==null&&c!==void 0?c:!0,x=new Array,b=new Array;t.forEach(S=>{S.isDesired!==v&&x.push(S.trackSid),S.isEnabled||b.push(S.trackSid)}),this.client.sendSyncState(new TC({answer:this.pcManager.mode==="publisher-only"?d?nu({sdp:d.sdp,type:d.type}):void 0:p?nu({sdp:p.sdp,type:p.type}):void 0,offer:this.pcManager.mode==="publisher-only"?h?nu({sdp:h.sdp,type:h.type}):void 0:f?nu({sdp:f.sdp,type:f.type}):void 0,subscription:new vy({trackSids:x,subscribe:!v,participantTracks:[]}),publishTracks:vse(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:b,datachannelReceiveStates:this.reliableReceivedState.map((S,N)=>new eB({publisherSid:N,lastSeq:S})),publishDataTracks:i.map(S=>new wC({info:qv.toProtobuf(S)}))}))}failNext(){this.shouldFailNext=!0}failNextV1Path(){this.shouldFailOnV1Path=!0}dataChannelsInfo(){const t=[],n=(i,r)=>{(i==null?void 0:i.id)!==void 0&&i.id!==null&&t.push(new tB({label:i.label,id:i.id,target:r}))};return n(this.dataChannelForKind(xt.LOSSY),ca.PUBLISHER),n(this.dataChannelForKind(xt.RELIABLE),ca.PUBLISHER),n(this.dataChannelForKind(xt.LOSSY,!0),ca.SUBSCRIBER),n(this.dataChannelForKind(xt.RELIABLE,!0),ca.SUBSCRIBER),t}clearReconnectTimeout(){this.reconnectTimeout&&yi.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Xr()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){Xr()&&(window.removeEventListener("online",this.handleBrowserOnLine),window.removeEventListener("offline",this.handleBrowserOffline))}getTrackIdForReceiver(t){var n;const i=(n=this.pcManager)===null||n===void 0?void 0:n.getMidForReceiver(t);if(i){const r=Object.entries(this.midToTrackId).find(s=>tt(s,1)[0]===i);if(r)return r[1]}}}function IR(e,t){const n=e.participantIdentity?e.participantIdentity:t.participantIdentity;e.participantIdentity=n,t.participantIdentity=n;const i=e.destinationIdentities.length!==0?e.destinationIdentities:t.destinationIdentities;e.destinationIdentities=i,t.destinationIdentities=i}const AN=5e3,Xae=3e4;class Ot{static fetchRegionSettings(t,n,i){return z(this,void 0,void 0,function*(){const r=yield Ot.fetchLock.lock();try{const s=yield fetch("".concat(Jae(t),"/regions"),{headers:{authorization:"Bearer ".concat(n)},signal:i});if(s.ok){const l=Vse(s.headers),c=l?l*1e3:AN;return{regionSettings:yield s.json(),updatedAtInMs:Date.now(),maxAgeInMs:c}}else throw s.status===401?at.notAllowed("Could not fetch region settings: ".concat(s.statusText),s.status):at.internal("Could not fetch region settings: ".concat(s.statusText))}catch(s){throw s instanceof at?s:i!=null&&i.aborted?at.cancelled("Region fetching was aborted"):at.serverUnreachable("C
663ould not fetch region settings, ".concat(s instanceof Error?"".concat(s.name,": ").concat(s.message):s))}finally{r()}})}static scheduleRefetch(t,n,i){return z(this,void 0,void 0,function*(){const r=Ot.settingsTimeouts.get(t.hostname);clearTimeout(r),Ot.settingsTimeouts.set(t.hostname,setTimeout(()=>z(this,void 0,void 0,function*(){try{const s=yield Ot.fetchRegionSettings(t,n);Ot.updateCachedRegionSettings(t,n,s)}catch(s){if(s instanceof at&&s.reason===vn.NotAllowed){vt.debug("token is not valid, cancelling auto region refresh");return}vt.debug("auto refetching of region settings failed",{error:s}),Ot.scheduleRefetch(t,n,i)}}),i))})}static updateCachedRegionSettings(t,n,i){Ot.cache.set(t.hostname,i),Ot.scheduleRefetch(t,n,i.maxAgeInMs)}static stopRefetch(t){const n=Ot.settingsTimeouts.get(t);n&&(clearTimeout(n),Ot.settingsTimeouts.delete(t))}static scheduleCleanup(t){let n=Ot.connectionTrackers.get(t);n&&(n.cleanupTimeout&&clearTimeout(n.cleanupTimeout),n.cleanupTimeout=setTimeout(()=>{const i=Ot.connectionTrackers.get(t);i&&i.connectionCount===0&&(vt.debug("stopping region refetch after disconnect delay",{hostname:t}),Ot.stopRefetch(t)),i&&(i.cleanupTimeout=void 0)},Xae))}static cancelCleanup(t){const n=Ot.connectionTrackers.get(t);n!=null&&n.cleanupTimeout&&(clearTimeout(n.cleanupTimeout),n.cleanupTimeout=void 0)}notifyConnected(){const t=this.serverUrl.hostname;let n=Ot.connectionTrackers.get(t);n||(n={connectionCount:0},Ot.connectionTrackers.set(t,n)),n.connectionCount++,Ot.cancelCleanup(t)}notifyDisconnected(){const t=this.serverUrl.hostname,n=Ot.connectionTrackers.get(t);n&&(n.connectionCount=Math.max(0,n.connectionCount-1),n.connectionCount===0&&Ot.scheduleCleanup(t))}constructor(t,n){this.attemptedRegions=[],this.serverUrl=new URL(t),this.token=n}updateToken(t){var n;this.token=t;const i=this.getServerUrl(),r=Ot.cache.get(i.hostname);Ot.scheduleRefetch(this.serverUrl,this.token,(n=r==null?void 0:r.maxAgeInMs)!==null&&n!==void 0?n:AN)}isCloud(){return vh(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(t){return z(this,void 0,void 0,function*(){return Ot.fetchRegionSettings(this.serverUrl,this.token,t)})}getNextBestRegionUrl(t){return z(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let n=Ot.cache.get(this.serverUrl.hostname);(!n||Date.now()-n.updatedAtInMs>n.maxAgeInMs)&&(n=yield this.fetchRegionSettings(t),Ot.updateCachedRegionSettings(this.serverUrl,this.token,n));const i=n.regionSettings.regions.filter(r=>!this.attemptedRegions.find(s=>s.url===r.url));if(i.length>0){const r=i[0];return this.attemptedRegions.push(r),vt.debug("next region: ".concat(r.region)),r.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(t){Ot.updateCachedRegionSettings(this.serverUrl,this.token,t)}}Ot.cache=new Map;Ot.settingsTimeouts=new Map;Ot.connectionTrackers=new Map;Ot.fetchLock=new ur;function Jae(e){return"".concat(e.protocol.replace("ws","http"),"//").concat(e.host,"/settings")}class n8{get info(){return this._info}validateBytesReceived(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!="number"||this.totalByteSize===0)){if(t&&this.bytesReceived<this.totalByteSize)throw new Us("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),Cr.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new Us("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),Cr.LengthExceeded)}}constructor(t,n,i){this.reader=n,this.totalByteSize=i,this._info=t,this.bytesReceived=0}}class Zae extends n8{handleChunkReceived(t){var n;this.bytesReceived+=t.content.byteLength,this.validateBytesReceived();const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,i)}[Symbol.asyncIterator](){const t=this.reader.getReader();t.closed.catch(()=>{});const n=()=>{t.releaseLock(),this.signal=void 0};return{next:()=>z(this,void 0,void 0,function*(){try{const i=this.signal;if(i!=null&&i.aborted)throw i.reason;const r=yield new Promise((s,l)=>{if(i){const c=()=>l(i.reason);i.addEventListener("abort",c,{once:!0}),t.read().then(s,l).finally(()=>{i.removeEventListener("abort",c)})}else t.read().then(s,l)});return r.done?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(r.value),{done:!1,value:r.value.content})}catch(i){throw n(),i}}),return(){return z(this,void 0,void 0,function*(){return n(),{done:!0,value:void 0}})}}}withAbortSignal(t){return this.signal=t,this}readAll(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(function*(){var i,r,s,l;let c=new Set;const h=n.signal?t.withAbortSignal(n.signal):t;try{for(var d=!0,f=ua(h),p;p=yield f.next(),i=p.done,!i;d=!0){l=p.value,d=!1;const v=l;c.add(v)}}catch(v){r={error:v}}finally{try{!d&&!i&&(s=f.return)&&(yield s.call(f))}finally{if(r)throw r.error}}return Array.from(c)})()})}}class eoe extends n8{constructor(t,n,i){super(t,n,i),this.receivedChunks=new Map}handleChunkReceived(t){var n;const i=iv(t.chunkIndex),r=this.receivedChunks.get(i);if(r&&r.version>t.version)return;this.receivedChunks.set(i,t),this.bytesReceived+=t.content.byteLength,this.validateBytesReceived();const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const t=this.reader.getReader();t.closed.catch(()=>{});const n=new TextDecoder("utf-8",{fatal:!0}),i=this.signal,r=()=>{t.releaseLock(),this.signal=void 0};return{next:()=>z(this,void 0,void 0,function*(){try{if(i!=null&&i.aborted)throw i.reason;const s=yield new Promise((l,c)=>{if(i){const h=()=>c(i.reason);i.addEventListener("abort",h,{once:!0}),t.read().then(l,c).finally(()=>{i.removeEventListener("abort",h)})}else t.read().then(l,c)});if(s.done)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(s.value);let l;try{l=n.decode(s.value.content)}catch(c){throw new Us("Cannot decode datastream chunk ".concat(s.value.chunkIndex," as text: ").concat(c),Cr.DecodeFailed)}return{done:!1,value:l}}}catch(s){throw r(),s}}),return(){return z(this,void 0,void 0,function*(){return r(),{done:!0,value:void 0}})}}}withAbortSignal(t){return this.signal=t,this}readAll(){return z(this,arguments,void 0,function(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(function*(){var i,r,s,l;let c="";const h=n.signal?t.withAbortSignal(n.signal):t;try{for(var d=!0,f=ua(h),p;p=yield f.next(),i=p.done,!i;d=!0)l=p.value,d=!1,c+=l}catch(v){r={error:v}}finally{try{!d&&!i&&(s=f.return)&&(yield s.call(f))}finally{if(r)throw r.error}}return c})()})}}class toe{constructor(){this.log=vt,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.isConnected=!1,this.bufferedPackets=[]}setConnected(t){this.isConnected=t,t&&this.flushBufferedPackets()}flushBufferedPackets(){const t=this.bufferedPackets;this.bufferedPackets=[];for(const n of t){const i=n.packet,r=n.encryptionType;this.handleDataStreamPacket(i,r)}}registerTextStreamHandler(t,n){if(this.textStreamHandlers.has(t))throw new Us('A text stream handler for topic "'.concat(t,'" has already been set.'),Cr.HandlerAlreadyRegistered);this.textStreamHandlers.set(t,n)}unregisterTextStreamHandler(t){this.textStreamHandlers.delete(t)}registerByteStreamHandler(t,n){if(this.byteStreamHandlers.has(t))throw new Us('A byte stream handler for topic "'.concat(t,'" has already been set.'),Cr.HandlerAlreadyRegistered);this.byteStreamHandlers.set(t,n)}unregisterByteStreamHandler(t){this.byteStreamHandlers.delete(t)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear(),this.bufferedPackets=[]}
663validateParticipantHasNoActiveDataStreams(t){const n=Array.from(this.textStreamControllers.entries()).filter(l=>l[1].sendingParticipantIdentity===t),i=Array.from(this.byteStreamControllers.entries()).filter(l=>l[1].sendingParticipantIdentity===t);if(n.length>0||i.length>0){const l=new Us("Participant ".concat(t," unexpectedly disconnected in the middle of sending data"),Cr.AbnormalEnd);for(const c of i){var r=tt(c,2);const h=r[0];r[1].controller.error(l),this.byteStreamControllers.delete(h)}for(const c of n){var s=tt(c,2);const h=s[0];s[1].controller.error(l),this.textStreamControllers.delete(h)}}}handleDataStreamPacket(t,n){if(!this.isConnected){this.bufferedPackets.push({packet:t,encryptionType:n});return}switch(t.value.case){case"streamHeader":return this.handleStreamHeader(t.value.value,t.participantIdentity,n);case"streamChunk":return this.handleStreamChunk(t.value.value,n);case"streamTrailer":return this.handleStreamTrailer(t.value.value,n);default:throw new Error('DataPacket of value "'.concat(t.value.case,'" is not data stream related!'))}}handleStreamHeader(t,n,i){var r;if(t.contentHeader.case==="byteHeader"){const s=this.byteStreamHandlers.get(t.topic);if(!s){this.log.debug("ignoring incoming byte stream due to no handler for topic",t.topic);return}let l;const c={id:t.streamId,name:(r=t.contentHeader.value.name)!==null&&r!==void 0?r:"unknown",mimeType:t.mimeType,size:t.totalLength?Number(t.totalLength):void 0,topic:t.to
663pic,timestamp:iv(t.timestamp),attributes:t.attributes,encryptionType:i},h=new ReadableStream({start:d=>{if(l=d,this.textStreamControllers.has(t.streamId))throw new Us("A data stream read is already in progress for a stream with id ".concat(t.streamId,"."),Cr.AlreadyOpened);this.byteStreamControllers.set(t.streamId,{info:c,controller:l,startTime:Date.now(),sendingParticipantIdentity:n})}});s(new Zae(c,h,iv(t.totalLength)),{identity:n})}else if(t.contentHeader.case==="textHeader"){const s=this.textStreamHandlers.get(t.topic);if(!s){this.log.debug("ignoring incoming text stream due to no handler for topic",t.topic);return}let l;const c={id:t.streamId,mimeType:t.mimeType,size:t.totalLength?Number(t.totalLength):void 0,topic:t.topic,timestamp:Number(t.timestamp),attributes:t.attributes,encryptionType:i,attachedStreamIds:t.contentHeader.value.attachedStreamIds},h=new ReadableStream({start:d=>{if(l=d,this.textStreamControllers.has(t.streamId))throw new Us("A data stream read is already in progress for a stream with id ".concat(t.streamId,"."),Cr.AlreadyOpened);this.textStreamControllers.set(t.streamId,{info:c,controller:l,startTime:Date.now(),sendingParticipantIdentity:n})}});s(new eoe(c,h,iv(t.totalLength)),{identity:n})}}handleStreamChunk(t,n){const i=this.byteStreamControllers.get(t.streamId);i&&(i.info.encryptionType!==n?(i.controller.error(new Us("Encryption type mismatch for stream ".concat(t.streamId,". Expected ").concat(n,", got ").concat(i.info.encryptionType),Cr.EncryptionTypeMismatch)),this.byteStreamControllers.delete(t.streamId)):t.content.length>0&&i.controller.enqueue(t));const r=this.textStreamControllers.get(t.streamId);r&&(r.info.encryptionType!==n?(r.controller.error(new Us("Encryption type mismatch for stream ".concat(t.streamId,". Expected ").concat(n,", got ").concat(r.info.encryptionType),Cr.EncryptionTypeMismatch)),this.textStreamControllers.delete(t.streamId)):t.content.length>0&&r.controller.enqueue(t))}handleStreamTrailer(t,n){const i=this.textStreamControllers.get(t.streamId);i&&(i.info.encryptionType!==n?i.controller.error(new Us("Encryption type mismatch for stream ".concat(t.streamId,". Expected ").concat(n,", got ").concat(i.info.encryptionType),Cr.EncryptionTypeMismatch)):(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),t.attributes),i.controller.close(),this.textStreamControllers.delete(t.streamId)));const r=this.byteStreamControllers.get(t.streamId);r&&(r.info.encryptionType!==n?r.controller.error(new Us("Encryption type mismatch for stream ".concat(t.streamId,". Expected ").concat(n,", got ").concat(r.info.encryptionType),Cr.EncryptionTypeMismatch)):(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),t.attributes),r.controller.close()),this.byteStreamControllers.delete(t.streamId))}}class i8{constructor(t,n,i){this.writableStream=t,this.defaultWriter=t.getWriter(),this.onClose=i,this.info=n}write(t){return this.defaultWriter.write(t)}close(){return z(this,void 0,void 0,function*(){var t;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(t=this.onClose)===null||t===void 0||t.call(this)})}}class noe extends i8{}class ioe extends i8{}const DR=15e3;class roe{constructor(t,n){this.engine=t,this.log=n}setupEngine(t){this.engine=t}sendText(t,n){return z(this,void 0,void 0,function*(){var i;const r=crypto.randomUUID(),l=new TextEncoder().encode(t).byteLength,c=(i=n==null?void 0:n.attachments)===null||i===void 0?void 0:i.map(()=>crypto.randomUUID()),h=new Array(c?c.length+1:1).fill(0),d=(p,v)=>{var x;h[v]=p;const b=h.reduce((S,N)=>S+N,0);(x=n==null?void 0:n.onProgress)===null||x===void 0||x.call(n,b)},f=yield this.streamText({streamId:r,totalSize:l,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:c,attributes:n==null?void 0:n.attributes});return yield f.write(t),d(1,0),yield f.close(),n!=null&&n.attachments&&c&&(yield Promise.all(n.attachments.map((p,v)=>z(this,void 0,void 0,function*(){return this._sendFile(c[v],p,{topic:n.topic,mimeType:p.type,onProgress:x=>{d(x,v+1)}})})))),f.info})}streamText(t){return z(this,void 0,void 0,function*(){var n,i,r;const s=(n=t==null?void 0:t.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),l={id:s,mimeType:"text/plain",timestamp:Date.now(),topic:(i=t==null?void 0:t.topic)!==null&&i!==void 0?i:"",size:t==null?void 0:t.totalSize,attributes:t==null?void 0:t.attributes,encryptionType:!((r=this.engine.e2eeManager)===null||r===void 0)&&r.isDataChannelEncryptionEnabled?xn.GCM:xn.NONE,attachedStreamIds:t==null?void 0:t.attachedStreamIds},c=new Uv({streamId:s,mimeType:l.mimeType,topic:l.topic,timestamp:Gc(l.timestamp),totalLength:Gc(l.size),attributes:l.attributes,contentHeader:{case:"textHeader",value:new qU({version:t==null?void 0:t.ver
663sion,attachedStreamIds:l.attachedStreamIds,replyToStreamId:t==null?void 0:t.replyToStreamId,operationType:(t==null?void 0:t.type)==="update"?sN.UPDATE:sN.CREATE})}}),h=t==null?void 0:t.destinationIdentities,d=new xr({destinationIdentities:h,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(d,xt.RELIABLE);let f=0;const p=this.engine,v=new WritableStream({write(S){return z(this,void 0,void 0,function*(){for(const N of $se(S,DR)){const j=new Bv({content:N,streamId:s,chunkIndex:Gc(f)}),T=new xr({destinationIdentities:h,value:{case:"streamChunk",value:j}});yield p.sendDataPacket(T,xt.RELIABLE),f+=1}})},close(){return z(this,void 0,void 0,function*(){const S=new Fv({streamId:s}),N=new xr({destinationIdentities:h,value:{case:"streamTrailer",value:S}});yield p.sendDataPacket(N,xt.RELIABLE)})},abort(S){console.log("Sink error:",S)}});let x=()=>z(this,void 0,void 0,function*(){yield b.close()});p.once(Re.Closing,x);const b=new noe(v,l,()=>this.engine.off(Re.Closing,x));return b})}sendFile(t,n){return z(this,void 0,void 0,function*(){const i=crypto.randomUUID();return yield this._sendFile(i,t,n),{id:i}})}_sendFile(t,n,i){return z(this,void 0,void 0,function*(){var r;const s=yield this.streamBytes({streamId:t,totalSize:n.size,name:n.name,mimeType:(r=i==null?void 0:i.mimeType)!==null&&r!==void 0?r:n.type,topic:i==null?void 0:i.topic,destinationIdentities:i==null?void 0:i.destinationIdentities}),l=n.stream().getReader();for(;;){const c=yield l.read(),h=c.done,d=c.value;if(h)break;yield s.write(d)}return yield s.close(),s.info})}streamBytes(t){return z(this,void 0,void 0,function*(){var n,i,r,s,l;const c=(n=t==null?void 0:t.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),h=t==null?void 0:t.destinationIdentities,d={id:c,mimeType:(i=t==null?void 0:t.mimeType)!==null&&i!==void 0?i:"application/octet-stream",topic:(r=t==null?void 0:t.topic)!==null&&r!==void 0?r:"",timestamp:Date.now(),attributes:t==null?void 0:t.attributes,size:t==null?void 0:t.totalSize,name:(s=t==null?void 0:t.name)!==null&&s!==void 0?s:"unknown",encryptionType:!((l=this.engine.e2eeManager)===null||l===void 0)&&l.isDataChannelEncryptionEnabled?xn.GCM:xn.NONE},f=new Uv({totalLength:Gc(d.size),mimeType:d.mimeType,streamId:c,topic:d.topic,timestamp:Gc(Date.now()),attributes:d.attributes,contentHeader:{case:"byteHeader",value:new WU({name:d.name})}}),p=new xr({destinationIdentities:h,value:{case:"streamHeader",value:f}});yield this.engine.sendDataPacket(p,xt.RELIABLE);let v=0;const x=new ur,b=this.engine,S=this.log,N=new WritableStream({write(T){return z(this,void 0,void 0,function*(){const E=yield x.lock();let C=0;try{for(;C<T.byteLength;){const P=T.slice(C,C+DR),A=new xr({destinationIdentities:h,value:{case:"streamChunk",value:new Bv({content:P,streamId:c,chunkIndex:Gc(v)})}});yield b.sendDataPacket(A,xt.RELIABLE),v+=1,C+=P.byteLength}}finally{E()}})},close(){return z(this,void 0,void 0,function*(){const T=new Fv({streamId:c}),E=new xr({destinationIdentities:h,value:{case:"streamTrailer",value:T}});yield b.sendDataPacket(E,xt.RELIABLE)})},abort(T){S.error("Sink error:",T)}});return new ioe(N,d)})}}function r8(e){if(e.length===0)return new AbortController().signal;if(e.length===1)return e[0];for(const r of e)if(r.aborted)return r;const t=new AbortController,n=Array(e.length),i=()=>{for(const r of n)r()};return e.forEach((r,s)=>{const l=()=>{t.abort(r.reason),i()};r.addEventListener("abort",l),n[s]=()=>r.removeEventListener("abort",l)}),t.signal}function s8(e){const t=new AbortController;return setTimeout(()=>{t.abort(new DOMException("signal timed out after ".concat(e," ms"),"TimeoutError"))},e),t.signal}const Jn=1,_o=2,LR=4,soe=8,UR=0,BR=12,FR=5,aoe=7,$R=3,ooe=3,VR=2,zR=1,qR=0,WR=3,f0=2,HR=2,loe=1,coe=0;var Oo;(function(e){e[e.TooShort=0]="TooShort",e[e.HeaderOverrun=1]="HeaderOverrun",e[e.MissingExtWords=2]="MissingExtWords",e[e.UnsupportedVersion=3]="UnsupportedVersion",e[e.InvalidHandle=4]="InvalidHandle",e[e.MalformedExt=5]="MalformedExt"})(Oo||(Oo={}));class Tr extends Gs{constructor(t,n,i){super(19,t,i),this.name="DataTrackDeserializeError",this.reason=n,this.reasonName=Oo[n]}static tooShort(){return new Tr("Too short to contain a valid header",Oo.TooShort)}static headerOverrun(){return new Tr("Header exceeds total packet length",Oo.HeaderOverrun)}static missingExtWords(){return new Tr("Extension word indicator is missing",Oo.MissingExtWords)}static unsupportedVersion(t){return new Tr("Unsupported version ".concat(t),Oo.UnsupportedVersion)}
663static invalidHandle(t){return new Tr("invalid track handle: ".concat(t.message),Oo.InvalidHandle,{cause:t})}static malformedExt(t){return new Tr("Extension with tag ".concat(t," is malformed"),Oo.MalformedExt)}}var Tm;(function(e){e[e.TooSmallForHeader=0]="TooSmallForHeader",e[e.TooSmallForPayload=1]="TooSmallForPayload"})(Tm||(Tm={}));class Xm extends Gs{constructor(t,n,i){super(19,t,i),this.name="DataTrackSerializeError",this.reason=n,this.reasonName=Tm[n]}static tooSmallForHeader(){return new Xm("Buffer cannot fit header",Tm.TooSmallForHeader)}static tooSmallForPayload(){return new Xm("Buffer cannot fit payload",Tm.TooSmallForPayload)}}class wy{toBinary(){const t=this.toBinaryLengthBytes(),n=new ArrayBuffer(t),i=new DataView(n),r=this.toBinaryInto(i);if(t!==r)throw new Error("".concat(this.constructor.name,".toBinary: written bytes (").concat(r," bytes) not equal to allocated array buffer length (").concat(t," bytes)."));return new Uint8Array(n)}}var yh;(function(e){e[e.UserTimestamp=2]="UserTimestamp",e[e.E2ee=1]="E2ee"})(yh||(yh={}));class a8 extends wy{}class ha extends a8{constructor(t){super(),this.timestamp=t}toBinaryLengthBytes(){return Jn+Jn+ha.lengthBytes}toBinaryInto(t){let n=0;t.setUint8(n,ha.tag),n+=Jn,t.setUint8(n,ha.lengthBytes),n+=Jn,t.setBigUint64(n,this.timestamp),n+=soe;const i=this.toBinaryLengthBytes();if(n!==i)throw new Error("DataTrackUserTimestampExtension.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(i," bytes"));return n}toJSON(){return{tag:ha.tag,lengthBytes:ha.lengthBytes,timestamp:this.timestamp}}}ha.tag=yh.UserTimestamp;ha.lengthBytes=8;class fa extends a8{constructor(t,n){super(),this.keyIndex=t,this.iv=n}toBinaryLengthBytes(){return Jn+Jn+fa.lengthBytes}toBinaryInto(t){let n=0;t.setUint8(n,fa.tag),n+=Jn,t.setUint8(n,fa.lengthBytes),n+=Jn,t.setUint8(n,this.keyIndex),n+=Jn;for(let r=0;r<this.iv.length;r+=1)t.setUint8(n,this.iv[r]),n+=Jn;const i=this.toBinaryLengthBytes();if(n!==i)throw new Error("DataTrackE2eeExtension.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(i," bytes"));return n}toJSON(){return{tag:fa.tag,lengthBytes:fa.lengthBytes,keyIndex:this.keyIndex,iv:this.iv}}}fa.tag=yh.E2ee;fa.lengthBytes=13;class ah extends wy{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.userTimestamp=t.userTimestamp,this.e2ee=t.e2ee}toBinaryLengthBytes(){let t=0;return this.userTimestamp&&(t+=this.userTimestamp.toBinaryLengthBytes()),this.e2ee&&(t+=this.e2ee.toBinaryLengthBytes()),t}toBinaryInto(t){let n=0;if(this.e2ee){const r=this.e2ee.toBinaryInto(t);n+=r}if(this.userTimestamp){const r=this.userTimestamp.toBinaryInto(new DataView(t.buffer,t.byteOffset+n));n+=r}const i=this.toBinaryLengthBytes();if(n!==i)throw new Error("DataTrackExtensions.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(i," bytes"));return n}static fromBinary(t){const n=BC(t);let i,r,s=0;for(;n.byteLength-s>=Jn+Jn;){const l=n.getUint8(s);s+=Jn;const c=n.getUint8(s);if(s+=Jn,l!==coe)switch(l){case yh.UserTimestamp:if(n.byteLength-s<ha.lengthBytes)throw Tr.malformedExt(l);i=new ha(n.getBigUint64(s)),s+=c;break;case yh.E2ee:if(n.byteLength-s<fa.lengthBytes)throw Tr.malformedExt(l);const h=n.getUint8(s),d=new Uint8Array(12);for(let f=0;f<d.length;f+=1){let p=s;p+=Jn,p+=f*Jn,d[f]=n.getUint8(p)}r=new fa(h,d),s+=c;break;default:if(n.byteLength-s<c)throw Tr.malformedExt(l);s+=c;break}}return[new ah({userTimestamp:i,e2ee:r}),n.byteLength]}toJSON(){var t,n,i,r;return{userTimestamp:(n=(t=this.userTimestamp)===null||t===void 0?void 0:t.toJSON())!==null&&n!==void 0?n:null,e2ee:(r=(i=this.e2ee)===null||i===void 0?void 0:i.toJSON())!==null&&r!==void 0?r:null}}}const o8={from(e){return{payload:e.payload,extensions:new ah({userTimestamp:e.userTimestamp?new ha(e.userTimestamp):void 0})}},lossyIntoFrame(e){var t;return{payload:e.payload,userTimestamp:(t=e.extensions.userTimestamp)===null||t===void 0?void 0:t.timestamp}}},l8=Symbol.for("lk.track"),c8=Symbol.for("lk.data-track");class u8{constructor(t,n,i){this.trackSymbol=l8,this.isLocal=!1,this.typeSymbol=c8,this.info=t,this.manager=n,this.publisherIdentity=i.publisherIdentity}subscribe(t){try{const n=this.manager.openSubscriptionStream(this.info.sid,t==null?void 0:t.signal,t==null?void 0:t.bufferSize),i=tt(n,2),r=i[0];return i[1].catch(()=>{}),r}catch(n){throw n}}setPipelineOptions(t){this.manager.setPipelineOptions(this.info.sid,t)}}class Jm extends wy{constructor(t){var n;super(),this.marker=t.marker,this.trackHandle=t.trackHandle,this.sequence=t.sequence,this.frameNumber=t.frameNumber,this.timestamp=t.timestamp,this.extensions=(n=t.extensions)!==null&&n!==void 0?n:new ah}extensionsMetrics(){const t=this.extensions.toBinaryLengthBytes(),n=Math.ceil((f0+t)/4),i=n*4-f0-t;return{lengthBytes:t,lengthWords:n,paddingLengthBytes:i}}toBinaryLengthBytes(){const t=this.extensionsMetrics(),n=t.lengthBytes,i=t.paddingLengthBytes;let r=BR;return n>0&&(r+=f0+n+i),r}toBinaryInto(t){if(t.byteLength<this.toBinaryLengthBytes())throw Xm.tooSmallForHeader();let n=UR<<FR,i;switch(this.marker){case Ln.Inter:i=qR;break;case Ln.Final:i=zR;break;case Ln.Start:i=VR;break;case Ln.Single:i=WR;break}n|=i<<$R;const r=this.extensionsMetrics(),s=r.lengthBytes,l=r.lengthWords,c=r.paddingLengthBytes;s>0&&(n|=1<<HR);let h=0;if(t.setUint8(h,n),h+=Jn,t.setUint8(h,0),h+=Jn,t.setUint16(h,this.trackHandle),h+=_o,t.setUint16(h,this.sequence.value),h+=_o,t.setUint16(h,this.frameNumber.value),h+=_o,t.setUint32(h,this.timestamp.asTicks()),h+=LR,s>
6630){const f=l-1;t.setUint16(h,f),h+=_o;const p=this.extensions.toBinaryInto(new DataView(t.buffer,t.byteOffset+h));h+=p;for(let v=0;v<c;v+=1)t.setUint8(h,0),h+=Jn}const d=this.toBinaryLengthBytes();if(h!==d)throw new Error("DataTrackPacketHeader.toBinaryInto: Wrote ".concat(h," bytes but expected length was ").concat(d," bytes"));return d}static fromBinary(t){const n=BC(t);if(n.byteLength<BR)throw Tr.tooShort();let i=0;const r=n.getUint8(i);i+=Jn;const s=r>>FR&aoe;if(s>UR)throw Tr.unsupportedVersion(s);let l;switch(r>>$R&ooe){case VR:l=Ln.Start;break;case zR:l=Ln.Final;break;case WR:l=Ln.Single;break;case qR:default:l=Ln.Inter;break}const c=(r>>HR&loe)>0;i+=Jn;let h;try{h=cae.fromNumber(n.getUint16(i))}catch(x){throw x instanceof xh&&(x.isReason(wu.Reserved)||x.isReason(wu.TooLarge))?Tr.invalidHandle(x):x}i+=_o;const d=ba.u16(n.getUint16(i));i+=_o;const f=ba.u16(n.getUint16(i));i+=_o;const p=sh.fromRtpTicks(n.getUint32(i));i+=LR;let v=new ah;if(c){if(n.byteLength-i<_o)throw Tr.missingExtWords();let x=n.getUint16(i);i+=_o;let S=4*(x+1)-f0;if(i+S>n.byteLength)throw Tr.headerOverrun();let N=new DataView(n.buffer,n.byteOffset+i,S);const j=ah.fromBinary(N),T=tt(j,2),E=T[0],C=T[1];v=E,i+=C}return[new Jm({marker:l,trackHandle:h,sequence:d,frameNumber:f,timestamp:p,extensions:v}),i]}toJSON(){return{marker:this.marker,trackHandle:this.trackHandle,sequence:this.sequence.value,frameNumber:this.frameNumber.value,timestamp:this.timestamp.asTicks(),extensions:this.extensions.toJSON()}}}var Ln;(function(e){e[e.Start=0]="Start",e[e.Inter=1]="Inter",e[e.Final=2]="Final",e[e.Single=3]="Single"})(Ln||(Ln={}));class Sy extends wy{constructor(t,n){super(),this.header=t,this.payload=n}toBinaryLengthBytes(){return this.header.toBinaryLengthBytes()+this.payload.byteLength}toBinaryInto(t){let n=0;const i=this.header.toBinaryInto(t);if(n+=i,t.byteLength-n<this.payload.byteLength)throw Xm.tooSmallForPayload();for(let s=0;s<this.payload.length;s+=1)t.setUint8(n,this.payload[s]),n+=Jn;const r=this.toBinaryLengthBytes();if(n!==r)throw new Error("DataTrackPacket.toBinaryInto: Wrote ".concat(n," bytes but expected length was ").concat(r," bytes"));return r}static fromBinary(t){const n=BC(t),i=Jm.fromBinary(n),r=tt(i,2),s=r[0],l=r[1],c=n.buffer.slice(n.byteOffset+l,n.byteOffset+n.byteLength);return[new Sy(s,new Uint8Array(c)),n.byteLength]}toJSON(){return{header:this.header.toJSON(),payload:this.payload}}}const ES=es(zi.DataTracks);class Ga extends Gs{constructor(t,n,i,r){super(19,"Frame ".concat(i," dropped: ").concat(t),r),this.name="DataTrackDepacketizerDropError",this.reason=n,this.reasonName=iu[n],this.frameNumber=i}static interrupted(t,n){return new Ga("Interrupted by the start of a new frame ".concat(n),iu.Interrupted,t)}static unknownFrame(t){return new Ga("Initial packet was never received.",iu.UnknownFrame,t)}static bufferFull(t){return new Ga("Reorder buffer is full.",iu.BufferFull,t)}static incomplete(t,n,i){return new Ga("Not all packets received before final packet. Received ".concat(n," packets, expected ").concat(i," packets."),iu.Incomplete,t)}}var iu;(function(e){e[e.Interrupted=0]="Interrupted",e[e.UnknownFrame=1]="UnknownFrame",e[e.BufferFull=2]="BufferFull",e[e.Incomplete=3]="Incomplete"})(iu||(iu={}));class ky{constructor(){this.partials=new Map}push(t,n){switch(t.header.marker){case Ln.Single:return this.frameFromSingle(t,n);case Ln.Start:return this.beginPartial(t,n);case Ln.Inter:case Ln.Final:return this.pushToPartial(t)}}reset(){this.partials.clear()}peekOldestPartialFrameNumber(){const t=this.partials.keys().next();return t.done?null:t.value}frameFromSingle(t,n){var i;if(t.header.marker!==Ln.Single)throw new Error("Depacketizer.frameFromSingle: packet.header.marker was not FrameMarker.Single, found ".concat(t.header.marker,"."));const r=(i=n==null?void 0:n.maxPartialFrames)!==null&&i!==void 0?i:1;if(this.partials.size>=r){const s=this.peekOldestPartialFrameNumber();if(typeof s!="number")throw new Error("Depacketizer.frameFromSingle: no olde
663st frame number found, but partials.size is ".concat(this.partials.size,"."));if(this.partials.delete(s),n!=null&&n.throwOnInterruption)throw Ga.interrupted(s,t.header.frameNumber.value);ES.warn("Data track frame ".concat(s," was interrupted by single-packet frame ").concat(t.header.frameNumber.value,", dropping."))}return{payload:t.payload,extensions:t.header.extensions}}beginPartial(t,n){var i;if(t.header.marker!==Ln.Start)throw new Error("Depacketizer.beginPartial: packet.header.marker was not FrameMarker.Start, found ".concat(t.header.marker,"."));const r=t.header.sequence,s=t.header.frameNumber.value,l={startSequence:r,extensions:t.header.extensions,payloads:new Map([[r.value,t.payload]])},c=(i=n==null?void 0:n.maxPartialFrames)!==null&&i!==void 0?i:1;for(;this.partials.size>=c;){const h=this.peekOldestPartialFrameNumber();if(typeof h!="number")break;if(this.partials.delete(h),n!=null&&n.throwOnInterruption)throw Ga.interrupted(h,s);ES.warn("Data track partials full (max ".concat(c,"), evicted oldest frame ").concat(h," to make room for new frame ").concat(s,"."))}return this.partials.set(s,l),null}pushToPartial(t){if(t.header.marker!==Ln.Inter&&t.header.marker!==Ln.Final)throw new Error("Depacketizer.pushToPartial: packet.header.marker was not FrameMarker.Inter or FrameMarker.Final, found ".concat(t.header.marker,"."));const n=t.header.frameNumber.value,i=this.partials.get(n);if(!i)throw this.partials.delete(n),Ga.unknownFrame(n);if(i.payloads.size>=ky.MAX_BUFFER_PACKETS)throw this.partials.delete(n),Ga.bufferFull(n);return i.payloads.has(t.header.sequence.value)&&ES.warn("Data track frame ".concat(n," received duplicate packet for sequence ").concat(t.header.sequence.value,", so replacing with newly received packet.")),i.payloads.set(t.header.sequence.value,t.payload),t.header.marker===Ln.Final?this.finalize(n,i,t.header.sequence.value):null}finalize(t,n,i){const r=n.payloads.size;let s=0;for(const d of n.payloads.values())s+=d.length;const l=new Uint8Array(s);let c=n.startSequence.clone(),h=0;for(;;){const d=n.payloads.get(c.value);if(!d)break;n.payloads.delete(c.value);const f=l.length-h;if(d.length>f)throw new Error("Depacketizer.finalize: Expected at least ".concat(d.length," more bytes left in the payload buffer, only got ").concat(f," bytes."));if(l.set(d,h),h+=d.length,c.value!=i){c.increment();continue}return this.partials.delete(t),{payload:l,extensions:n.extensions}}throw this.partials.delete(t),Ga.incomplete(t,r,i-n.startSequence.value+1)}}ky.MAX_BUFFER_PACKETS=128;var ru;(function(e){e[e.Unpublished=0]="Unpublished",e[e.Timeout=1]="Timeout",e[e.Disconnected=2]="Disconnected",e[e.Cancelled=4]="Cancelled"})(ru||(ru={}));class Gr extends Gs{constructor(t,n,i){super(22,t,i),this.name="DataTrackSubscribeError",this.reason=n,this.reasonName=ru[n]}static unpublished(){return new Gr("The track has been unpublished and is no longer available",ru.Unpublished)}static timeout(){return new Gr("Request to subscribe to data track timed-out",ru.Timeout)}static disconnected(){return new Gr("Cannot subscribe to data track when disconnected",ru.Disconnected)}static cancelled(){return new Gr("Subscription to data track cancelled by caller",ru.Cancelled)}}const AS=es(zi.DataTracks);class uoe{constructor(t){var n,i;const r=t.e2eeManager!==null;if(t.info.usesE2ee!==r)throw new Error("IncomingDataTrackPipeline: DataTrackInfo.usesE2ee must match presence of decryptionProvider");const s=new ky;this.publisherIdentity=t.publisherIdentity,this.e2eeManager=(n=t.e2eeManager)!==null&&n!==void 0?n:null,this.depacketizer=s,this.options=(i=t.pipelineOptions)!==null&&i!==void 0?i:{}}updateE2eeManager(t){this.e2eeManager=t}setOptions(t){this.options=t}processPacket(t){return z(this,void 0,void 0,function*(){const n=this.depacketize(t);if(!n)return null;const i=yield this.decryptIfNeeded(n);return i||null})}depacketize(t){let n;try{n=this.depacketizer.push(t,{throwOnInterruption:!1,maxPartialFrames:this.options.maxPartialFrames})}catch(i){return AS.warn("Data frame depacketize error: ".concat(i)),null}return n}decryptIfNeeded(t){return z(this,void 0,void 0,function*(){var n,i;const r=this.e2eeManager;if(!r)return t;const s=(i=(n=t.extensions)===null||n===void 0?void 0:n.e2ee)!==null&&i!==void 0?i:null;if(!s)return AS.error("Missing E2EE meta"),null;let l;try{l=yield r.handleEncryptedData(t.payload,s.iv,this.publisherIdentity,s.keyIndex)}catch(c){return AS.error("Error decrypting packet: ".concat(c)),null}return t.payload=l.payload,t})}}const er=es(zi.DataTracks),doe=1e4,hoe=16;class foe extends ts.EventEmitter{constructor(t){var n;super(),this.descriptors=new Map,this.subscriptionHandles=new Map,this.e2eeManager=(n=t==null?void 0:t.e2eeManager)!==null&&n!==void 0?n:null}updateE2eeManager(t){this.e2eeManager=t;for(const n of this.descriptors.values())n.subscription.type==="active"&&n.subscription.pipeline.updateE2eeManager(t)}setPipelineOptions(t,n){const i=this.descriptors.get(t);if(!i){er.warn("Unknown track ".concat(t,", cannot set pipeline options."));return}i.pipelineOptions=n,i.subscription.type==="active"&&i.subscription.pipeline.setOptions(n)}openSubscriptionStream(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:hoe,r=null;const s=new Fi,l=()=>{n==null||n.removeEventListener("abort",h)},c=()=>
663{if(l(),!r){er.warn("ReadableStream subscribed to ".concat(t," was not started."));return}const f=this.descriptors.get(t);if(!f){er.warn("Unknown track ".concat(t,", skipping cancel..."));return}if(f.subscription.type!=="active"){er.warn("Subscription for track ".concat(t," is not active, skipping cancel..."));return}f.subscription.streamControllers.delete(r),f.subscription.streamControllers.size===0&&this.unSubscribeRequest(f.info.sid)},h=()=>{var f;if(!r)return;const p=this.descriptors.get(t);(p==null?void 0:p.subscription.type)==="active"&&p.subscription.streamControllers.delete(r),r.error(Gr.cancelled()),(f=s.reject)===null||f===void 0||f.call(s,Gr.cancelled()),c()};return[new ReadableStream({start:f=>{r=f,this.subscribeRequest(t,n).then(()=>z(this,void 0,void 0,function*(){var p,v,x;const b=this.descriptors.get(t);if(!b){er.error("Unknown track ".concat(t));const S=Gr.disconnected();f.error(S),(p=s.reject)===null||p===void 0||p.call(s,S);return}if(b.subscription.type!=="active"){er.error("Subscription for track ".concat(t," is not active"));const S=Gr.disconnected();f.error(S),(v=s.reject)===null||v===void 0||v.call(s,S);return}if(n!=null&&n.aborted){h();return}n==null||n.addEventListener("abort",h),b.subscription.streamControllers.set(f,l),(x=s.resolve)===null||x===void 0||x.call(s)})).catch(p=>{var v;f.error(p),(v=s.reject)===null||v===void 0||v.call(s,p)})},cancel:()=>{c()}},new CountQueuingStrategy({highWaterMark:i})),s.promise]}subscribeRequest(t,n){return z(this,void 0,void 0,function*(){const i=this.descriptors.get(t);if(!i)throw new Error("Cannot subscribe to unknown track");const r=(s,l,c)=>z(this,void 0,void 0,function*(){if(s.subscription.type==="active")return;if(s.subscription.type!=="pending")throw new Error("Descriptor for track ".concat(t," is not pending, found ").concat(s.subscription.type));const h=r8([l,c].filter(p=>typeof p<"u")),d=new Fi;s.subscription.completionFuture.promise.then(()=>{var p;return(p=d.resolve)===null||p===void 0?void 0:p.call(d)}).catch(p=>{var v;return(v=d.reject)===null||v===void 0?void 0:v.call(d,p)});const f=()=>{var p;if(s.subscription.type==="pending"){if(s.subscription.pendingRequestCount-=1,c!=null&&c.aborted){s.subscription.cancel();return}if(s.subscription.pendingRequestCount<=0){s.subscription.cancel();return}(p=d.reject)===null||p===void 0||p.call(d,Gr.cancelled())}};h.aborted&&f(),h.addEventListener("abort",f),yield d.promise,h.removeEventListener("abort",f)});switch(i.subscription.type){case"none":{i.subscription={type:"pending",completionFuture:new Fi,pendingRequestCount:1,cancel:()=>{var l,c;const h=i.subscription;i.subscription={type:"none"},this.emit("sfuUpdateSubscription",{sid:t,subscribe:!1}),h.type==="pending"&&((c=(l=h.completionFuture).reject)===null||c===void 0||c.call(l,s.aborted?Gr.timeout():Gr.cancelled()))}},this.emit("sfuUpdateSubscription",{sid:t,subscribe:!0});const s=s8(doe);yield r(i,n,s);return}case"pending":{i.subscription.pendingRequestCount+=1,yield r(i,n);return}case"active":return}})}querySubscribed(){return z(this,void 0,void 0,function*(){return Array.from(this.descriptors.values()).filter(n=>n.subscription.type==="active").map(n=>[n.info,n.publisherIdentity])})}unSubscribeRequest(t){var n;const i=this.descriptors.get(t);if(!i)throw new Error("Cannot subscribe to unknown track");if(i.subscription.type!=="active"){er.warn("Unexpected descriptor state in unSubscribeRequest, expected active, found ".concat((n=i.subscription)===null||n===void 0?void 0:n.type));return}this.closeStreamControllers(i.subscription.streamControllers,t);const r=i.subscription;i.subscription={type:"none"},this.subscriptionHandles.delete(r.subcriptionHandle),this.emit("sfuUpdateSubscription",{sid:t,subscribe:!1})}closeStreamControllers(t,n){for(const r of t){var i=tt(r,2);const s=i[0],l=i[1];l();try{s.close()}catch(c){er.warn("Failed to close readable stream for track ".concat(n,": ").concat(c))}}}receiveSfuPublicationUpdates(t){return z(this,void 0,void 0,function*(){if(t.size===0)return;const n=new Map;for(const s of t.entries()){var i=tt(s,2);const l=i[0],c=i[1],h=new Set;for(const d of c)h.add(d.sid),!this.descriptors.has(d.sid)&&(yield this.handleTrackPublished(l,d));n.set(l,h)}for(const s of n.entries()){var r=tt(s,2);const l=r[0],c=r[1];let d=Array.from(this.descriptors.entries()).filter(f=>{let p=tt(f,2);return p[0],p[1].publisherIdentity===l}).map(f=>tt(f,1)[0]).filter(f=>!c.has(f));for(const f of d)this.handleTrackUnpublished(f)}})}queryPublications(){return z(this,void 0,void 0,function*(){return Array.from(this.descriptors.values()).map(t=>t.info)})}handleTrackPublished(t,n){return z(this,void 0,void 0,function*(){if(this.descriptors.has(n.sid)){er.error("Existing descriptor for track ".concat(n.sid));return}let i={info:n,publisherIdentity:t,subscription:{type:"none"},pipelineOptions:{}};this.descriptors.set(i.info.sid,i);const r=new u8(i.info,this,{publisherIdentity:t});
663this.emit("trackPublished",{track:r})})}handleTrackUnpublished(t){const n=this.descriptors.get(t);if(!n){er.error("Unknown track ".concat(t));return}this.descriptors.delete(t),n.subscription.type==="active"&&(this.closeStreamControllers(n.subscription.streamControllers,t),this.subscriptionHandles.delete(n.subscription.subcriptionHandle)),this.emit("trackUnpublished",{sid:t,publisherIdentity:n.publisherIdentity})}receivedSfuSubscriberHandles(t){for(const i of t.entries()){var n=tt(i,2);const r=n[0],s=n[1];this.registerSubscriberHandle(r,s)}}registerSubscriberHandle(t,n){var i,r;const s=this.descriptors.get(n);if(!s){er.error("Unknown track ".concat(n));return}switch(s.subscription.type){case"none":{er.warn("No subscription for ".concat(n));return}case"active":{s.subscription.subcriptionHandle=t,this.subscriptionHandles.set(t,n);return}case"pending":{const l=new uoe({info:s.info,publisherIdentity:s.publisherIdentity,e2eeManager:this.e2eeManager,pipelineOptions:s.pipelineOptions}),c=s.subscription;s.subscription={type:"active",subcriptionHandle:t,pipeline:l,streamControllers:new Map},this.subscriptionHandles.set(t,n),(r=(i=c.completionFuture).resolve)===null||r===void 0||r.call(i)}}}packetReceived(t){return z(this,void 0,void 0,function*(){let n;try{var i=Sy.fromBinary(t),r=tt(i,1);n=r[0]}catch(h){er.error("Failed to deserialize packet: ".concat(h));return}const s=this.subscriptionHandles.get(n.header.trackHandle);if(!s){er.warn("Unknown subscriber handle ".concat(n.header.trackHandle));return}const l=this.descriptors.get(s);if(!l){er.error("Missing descriptor for track ".concat(s));return}if(l.subscription.type!=="active"){er.warn("Received packet for track ".concat(s," without active subscription"));return}const c=yield l.subscription.pipeline.processPacket(n);if(c)for(const h of l.subscription.streamControllers.keys()){if(h.desiredSize!==null&&h.desiredSize<=0){er.warn("Cannot send frame to subscribers: readable stream is full (desiredSize is ".concat(h.desiredSize,"). To increase this threshold, set a higher 'options.highWaterMark' when calling .subscribe()."));continue}const d=o8.lossyIntoFrame(c);h.enqueue(d)}})}resendSubscriptionUpdates(){for(const n of this.descriptors){var t=tt(n,2);const i=t[0];t[1].subscription.type!=="none"&&this.emit("sfuUpdateSubscription",{sid:i,subscribe:!0})}}handleRemoteParticipantDisconnected(t){var n,i;for(const r of this.descriptors.values())if(r.publisherIdentity===t)switch(r.subscription.type){case"none":break;case"pending":(i=(n=r.subscription.completionFuture).reject)===null||i===void 0||i.call(n,Gr.disconnected());break;case"active":this.unSubscribeRequest(r.info.sid);break}}reset(){var t,n;
663for(const i of this.descriptors.values())this.emit("trackUnpublished",{sid:i.info.sid,publisherIdentity:i.publisherIdentity}),i.subscription.type==="pending"&&((n=(t=i.subscription.completionFuture).reject)===null||n===void 0||n.call(t,Gr.disconnected())),i.subscription.type==="active"&&this.closeStreamControllers(i.subscription.streamControllers,i.info.sid);this.descriptors.clear(),this.subscriptionHandles.clear()}}class Ny extends Gs{constructor(t,n,i){super(19,t,i),this.name="DataTrackPacketizerError",this.reason=n,this.reasonName=Gv[n]}static mtuTooShort(){return new Ny("MTU is too short to send frame",Gv.MtuTooShort)}}var Gv;(function(e){e[e.MtuTooShort=0]="MtuTooShort"})(Gv||(Gv={}));class WC{constructor(t,n){this.sequence=ba.u16(0),this.frameNumber=ba.u16(0),this.clock=tu.rtpStartingNow(sh.rtpRandom()),this.handle=t,this.mtuSizeBytes=n}static computeFrameMarker(t,n){return n<=1?Ln.Single:t===0?Ln.Start:t===n-1?Ln.Final:Ln.Inter}*packetize(t,n){var i;const r=this.frameNumber.getThenIncrement(),s={marker:Ln.Inter,trackHandle:this.handle,sequence:ba.u16(0),frameNumber:r,timestamp:(i=n==null?void 0:n.now)!==null&&i!==void 0?i:this.clock.now(),extensions:t.extensions},l=new Jm(s).toBinaryLengthBytes();if(l>=this.mtuSizeBytes)throw Ny.mtuTooShort();const c=this.mtuSizeBytes-l,h=Math.ceil(t.payload.byteLength/c);for(let f=0,p=0;p<t.payload.byteLength;d=[f+1,p+c],f=d[0],p=d[1],d){var d;const v=this.sequence.getThenIncrement(),x=new Jm(Object.assign(Object.assign({},s),{marker:WC.computeFrameMarker(f,h),sequence:v})),b=Math.min(c,t.payload.byteLength-p),S=new Uint8Array(t.payload.buffer,t.payload.byteOffset+p,b);yield new Sy(x,S)}}}var ra;(function(e){e[e.NotAllowed=0]="NotAllowed",e[e.DuplicateName=1]="DuplicateName",e[e.Timeout=2]="Timeout",e[e.LimitReached=3]="LimitReached",e[e.Disconnected=4]="Disconnected",e[e.Cancelled=5]="Cancelled",e[e.InvalidName=6]="InvalidName",e[e.Unknown=7]="Unknown"})(ra||(ra={}));class Ti extends Gs{constructor(t,n,i){super(21,t,i),this.name="DataTrackPublishError",this.reason=n,this.reasonName=ra[n],this.rawMessage=i==null?void 0:i.rawMessage}static notAllowed(t){return new Ti("Data track publishing unauthorized",ra.NotAllowed,{rawMessage:t})}static duplicateName(t){return new Ti("Track name already taken",ra.DuplicateName,{rawMessage:t})}static invalidName(t){return new Ti("Track name is invalid",ra.InvalidName,{rawMessage:t})}static timeout(){return new Ti("Publish data track timed-out. Does the LiveKit server support data tracks?",ra.Timeout)}static limitReached(t){return new Ti("Data track publication limit reached",ra.LimitReached,{rawMessage:t})}static unknown(t,n){return new Ti("Received RequestResponse for publishDataTrack, but reason was unrecognised (".concat(t,", ").concat(n,")"),ra.Unknown)}static disconnected(){return new Ti("Room disconnected",ra.Disconnected)}static cancelled(){return new Ti("Publish data track cancelled by caller",ra.Cancelled)}}var Em;(function(e){e[e.TrackUnpublished=0]="TrackUnpublished",e[e.Dropped=1]="Dropped"})(Em||(Em={}));class nc extends Gs{constructor(t,n,i){super(22,t,i),this.name="DataTrackPushFrameError",this.reason=n,this.reasonName=Em[n]}static trackUnpublished(){return new nc("Track is no longer published",Em.TrackUnpublished)}static dropped(t){return new nc("Frame was dropped",Em.Dropped,{cause:t})}}var Am;(function(e){e[e.Packetizer=0]="Packetizer",e[e.Encryption=1]="Encryption"})(Am||(Am={}));class Zm extends Gs{constructor(t,n,i){super(21,t,i),this.name="DataTrackOutgoingPipelineError",this.reason=n,this.reasonName=Am[n]}static packetizer(t){return new Zm("Error packetizing frame",Am.Packetizer,{cause:t})}static encryption(t){return new Zm("Error encrypting frame",Am.Encryption,{cause:t})}}class jy{constructor(t,n){this.trackSymbol=l8,this.isLocal=!0,this.typeSymbol=c8,this.handle=null,this.log=vt,this.flushedFuture=new Fi,this.isFlushed=!0,this.handleManagerReset=()=>{var i,r;(r=(i=this.flushedFuture).resolve)===null||r===void 0||r.call(i),this.manager.off("packetsFlushedChange",this.handleManagerPacketsFlushedChange),this.manager.off("reset",this.handleManagerReset)},this.handleManagerPacketsFlushedChange=i=>{var r,s;this.isFlushed=i.isFlushed,i.isFlushed&&((s=(r=this.flushedFuture).resolve)===null||s===void 0||s.call(r),this.flushedFuture=new Fi)},this.options=t,this.manager=n,this.log=es(zi.DataTracks),this.manager.on("packetsFlushedChange",this.handleManagerPacketsFlushedChange),this.manager.on("reset",this.handleManagerReset)}static withExplicitHandle(t,n,i){const r=new jy(t,n);return r.handle=i,r}get info(){const t=this.descriptor;if((t==null?void 0:t.type)==="active")return t.info}get descriptor(){return this.handle?this.manager.getDescriptor(this.handle):null}publish(t){return z(this,void 0,void 0,function*(){try{this.handle=yield this.manager.publishRequest(this.options,t)}catch(n){throw n}})}isPublished(){var t;return((t=this.descriptor)===null||t===void 0?void 0:t.type)==="active"&&this.descriptor.publishState!=="unpublished"}tryPush(t){if(!this.handle)throw nc.trackUnpublished();const n=o8.from(t);try{return this.manager.tryProcessAndSend(this.handle,n)}catch(i){throw i}}flush(){return z(this,void 0,void 0,function*(){if(!this.isFlushed)return this.flushedFuture.promise})}unpublish(){return z(this,void 0,void 0,function*(){if(!this.handle){vt.warn('Data track "'.concat(this.options.name,'" is not published, so unpublishing has no effect.'));return}try{yield this.manager.unpublishRequest(this.handle)}catch(t){throw t}})}}class Cy{constructor(t){this.e2eeManager=t.e2eeManager,this.packetizer=new WC(t.info.pubHandle,Cy.TRANSPORT_MTU_BYTES)}updateE2eeManager(t){this.e2eeManager=t}processFrame(t){return Hre(this,arguments,function*(){const i=yield gh(this.encryptIfNeeded(t));try{yield gh(yield*Kre(ua(this.packetizer.packetize(i))))}catch(r){throw r instanceof Ny?Zm.packetizer(r):r}})}encryptIfNeeded(t){return z(this,void 0,void 0,function*(){if(!this.e2eeManager)return t;let n;try{n=yield this.e2eeManager.encryptData(t.payload)}catch(i){throw Zm.encryption(i)}return t.payload=n.payload,t.extensions.e2ee=new fa(n.keyIndex,n.iv),t})}}Cy.TRANSPORT_MTU_BYTES=16e3;const Da=es(zi.DataTracks),KR={pending(){return{type:"pending",completionFuture:new Fi}},active(e,t){return{type:"active",info:e,publishState:"published",pipeline:new Cy({info:e,e2eeManager:t}),unpublishingFuture:new Fi}}},moe=1e4;class HC extends ts.EventEmitter{constructor(t){var n;super(),this.handleAllocator=new uae,this.descriptors=new Map,this.inFlightPacketCounter=new Map,this.e2eeManager=(n=t==null?void 0:t.e2eeManager)!==null&&n!==void 0?n:null}static withDescriptors(t){const n=new HC;return n.descriptors=t,n}updateE2eeManager(t){this.e2eeManager=t;for(const n of this.descriptors.values())n.type==="active"&&n.pipeline.updateE2eeManager(t)}getDescriptor(t){var n;return(n=this.descriptors.get(t))!==null&&n!==void 0?n:null}tryProcessAndSend(t,n){return z(this,void 0,void 0,function*(){var i,r,s,l,c;const h=this.getDescriptor(t);if((h==null?void 0:h.type)!=="active"||h.publishState==="unpublished")throw nc.trackUnpublished();if(h.publishState==="republishing")throw nc.dropped("Data track republishing");
663try{try{for(var d=!0,f=ua(h.pipeline.processFrame(n)),p;p=yield f.next(),i=p.done,!i;d=!0){l=p.value,d=!1;const v=l,x=(c=this.inFlightPacketCounter.get(t))!==null&&c!==void 0?c:0;this.inFlightPacketCounter.set(t,x+1),x===0&&this.emit("packetsFlushedChange",{handle:t,isFlushed:!1}),this.emit("packetAvailable",{handle:t,bytes:v.toBinary()})}}catch(v){r={error:v}}finally{try{!d&&!i&&(s=f.return)&&(yield s.call(f))}finally{if(r)throw r.error}}}catch(v){throw nc.dropped(v)}})}handlePacketSendComplete(t){var n;let r=((n=this.inFlightPacketCounter.get(t))!==null&&n!==void 0?n:0)-1;r<0&&(Da.warn("OutgoingDataTrackManager.handlePacketSendComplete: inFlightPacketCounter was decremented below 0 (got ".concat(this.inFlightPacketCounter," - resetting to 0. Were more packets send than were emitted?")),r=0),this.inFlightPacketCounter.set(t,r),r===0&&this.emit("packetsFlushedChange",{handle:t,isFlushed:!0})}publishRequest(t,n){return z(this,void 0,void 0,function*(){const i=this.handleAllocator.get();if(!i)throw Ti.limitReached();const r=s8(moe),s=n?r8([n,r]):r;if(this.descriptors.has(i))throw new Error("Descriptor for handle already exists");const l=KR.pending();this.descriptors.set(i,l);const c=()=>{var h,d;const f=this.descriptors.get(i);if(!f){Da.warn("No descriptor for ".concat(i));return}this.descriptors.delete(i),this.emit("sfuUnpublishRequest",{handle:i}),f.type==="pending"&&((d=(h=f.completionFuture).reject)===null||d===void 0||d.call(h,r.aborted?Ti.timeout():Ti.cancelled()))};return s.aborted?(c(),l.completionFuture.promise.then(()=>i)):(s.addEventListener("abort",c),this.emit("sfuPublishRequest",{handle:i,name:t.name,usesE2ee:this.e2eeManager!==null}),yield l.completionFuture.promise,s.removeEventListener("abort",c),this.emit("trackPublished",{track:jy.withExplicitHandle(t,this,i)}),i)})}queryPublished(){return Array.from(this.descriptors.values()).filter(n=>n.type==="active").map(n=>n.info)}unpublishRequest(t){return z(this,void 0,void 0,function*(){const n=this.descriptors.get(t);if(!n){Da.warn("No descriptor for ".concat(t));return}if(n.type!=="active"){Da.warn("Track ".concat(t," not active"));return}this.emit("sfuUnpublishRequest",{handle:t}),yield n.unpublishingFuture.promise,this.inFlightPacketCounter.delete(t),this.emit("trackUnpublished",{sid:n.info.sid})})}receivedSfuPublishResponse(t,n){var i,r,s,l;const c=this.descriptors.get(t);if(!c){Da.warn("No descriptor for ".concat(t));return}switch(this.descriptors.delete(t),c.type){case"pending":{if(n.type==="ok"){const h=n.data,d=h.usesE2ee?this.e2eeManager:null;this.descriptors.set(h.pubHandle,KR.active(h,d)),(r=(i=c.completionFuture).resolve)===null||r===void 0||r.call(i)}else(l=(s=c.completionFuture).reject)===null||l===void 0||l.call(s,n.error);return}case"active":{if(c.publishState!=="republishing"){Da.warn("Track ".concat(t," already active"));return}if(n.type==="error"){Da.warn("Republish failed for track ".concat(t));return}Da.debug("Track ".concat(t," republished")),c.info.sid=n.data.sid,c.publishState="published",this.descriptors.set(c.info.pubHandle,c)}}}receivedSfuUnpublishResponse(t){var n,i;const r=this.descriptors.get(t);if(!r){Da.warn("No descriptor for ".concat(t));return}if(this.descriptors.delete(t),r.type!=="active"){Da.warn("Track ".concat(t," not active"));return}r.publishState="unpublished",(i=(n=r.unpublishingFuture).resolve)===null||i===void 0||i.call(n)}sfuWillRepublishTracks(){var t,n;for(const r of this.descriptors.entries()){var i=tt(r,2);const s=i[0],l=i[1];switch(l.type){case"pending":this.descriptors.delete(s),(n=(t=l.completionFuture).reject)===null||n===void 0||n.call(t,Ti.disconnected());break;case"active":l.publishState="republishing",this.emit("sfuPublishRequest",{handle:l.info.pubHandle,name:l.info.name,usesE2ee:l.info.usesE2ee})}}}reset(){return z(this,void 0,void 0,function*(){var t,n,i,r;this.handleAllocator.reset();for(const s of this.descriptors.values())switch(s.type){case"pending":(n=(t=s.completionFuture).reject)===null||n===void 0||n.call(t,Ti.disconnected());break;case"active":(r=(i=s.unpublishingFuture).resolve)===null||r===void 0||r.call(i),yield this.unpublishRequest(s.info.pubHandle);break}this.descriptors.clear(),this.inFlightPacketCounter.clear(),this.emit
663("reset")})}}class an extends Error{constructor(t,n,i,r){super(n),this.code=t,this.message=GR(n,an.MAX_MESSAGE_BYTES),this.data=i?GR(i,an.MAX_DATA_BYTES):void 0,typeof(r==null?void 0:r.cause)<"u"&&(this.cause=r==null?void 0:r.cause)}static fromProto(t){return new an(t.code,t.message,t.data)}toProto(){return new IU({code:this.code,message:this.message,data:this.data})}static builtIn(t,n,i){return new an(an.ErrorCode[t],an.ErrorMessage[t],n,i)}}an.MAX_MESSAGE_BYTES=256;an.MAX_DATA_BYTES=15360;an.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};an.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const d8=15360,h8="lk.rpc_request",f8="lk.rpc_response";var ar;(function(e){e.RPC_REQUEST_ID="lk.rpc_request_id",e.RPC_REQUEST_METHOD="lk.rpc_request_method",e.RPC_REQUEST_RESPONSE_TIMEOUT_MS="lk.rpc_request_response_timeout_ms",e.RPC_REQUEST_VERSION="l
663k.rpc_request_version"})(ar||(ar={}));const poe=1,m8=2;function KC(e){return new TextEncoder().encode(e).length}function GR(e,t){if(KC(e)<=t)return e;let n=0,i=e.length;const r=new TextEncoder;for(;n<i;){const s=Math.floor((n+i+1)/2);r.encode(e.slice(0,s)).length<=t?n=s:i=s-1}return e.slice(0,n)}class goe extends ts.EventEmitter{constructor(t,n,i,r){super(),this.pendingAcks=new Map,this.pendingResponses=new Map,this.log=t,this.outgoingDataStreamManager=n,this.getRemoteParticipantClientProtocol=i,this.getServerVersion=r}performRpc(t){return z(this,arguments,void 0,function(n){var i=this;let r=n.destinationIdentity,s=n.method,l=n.payload,c=n.responseTimeout,h=c===void 0?15e3:c;return(function*(){const p=i.getRemoteParticipantClientProtocol(r);if(KC(l)>d8&&p<$v)throw an.builtIn("REQUEST_PAYLOAD_TOO_LARGE");const x=i.getServerVersion();if(x&&ro(x,"1.8.0")<0)throw an.builtIn("UNSUPPORTED_SERVER");const b=Math.max(h,8e3),S=crypto.randomUUID(),N=new Fi;let j=null;const T=setTimeout(()=>{var C;i.pendingAcks.delete(S),(C=N.reject)===null||C===void 0||C.call(N,an.builtIn("CONNECTION_TIMEOUT")),i.pendingResponses.delete(S),j!==null&&clearTimeout(j)},7e3);i.pendingAcks.set(S,{resolve:()=>{clearTimeout(T)},participantIdentity:r}),i.pendingResponses.set(S,{completionFuture:N,participantIdentity:r}),yield i.publishRpcRequest(r,S,s,l,b,p),j=setTimeout(()=>{var C;i.pendingResponses.delete(S),(C=N.reject)===null||C===void 0||C.call(N,an.builtIn("RESPONSE_TIMEOUT"))},h);const E=N.promise.finally(()=>{clearTimeout(j),i.pendingAcks.has(S)&&(i.log.warn("RPC response received before ack",S),i.pendingAcks.delete(S),clearTimeout(T))});return[S,E]})()})}publishRpcRequest(t,n,i,r,s,l){return z(this,void 0,void 0,function*(){if(l>=$v){const c=yield this.outgoingDataStreamManager.streamText({topic:h8,destinationIdentities:[t],attributes:{[ar.RPC_REQUEST_ID]:n,[ar.RPC_REQUEST_METHOD]:i,[ar.RPC_REQUEST_RESPONSE_TIMEOUT_MS]:"".concat(s),[ar.RPC_REQUEST_VERSION]:"".concat(m8)}});yield c.write(r),yield c.close();return}this.emit("sendDataPacket",{packet:new xr({destinationIdentities:[t],kind:sc.RELIABLE,value:{case:"rpcRequest",value:new xC({id:n,method:i,payload:r,responseTimeoutMs:s,version:poe})}})})})}handleIncomingDataStream(t,n,i){return z(this,void 0,void 0,function*(){const r=i[ar.RPC_REQUEST_ID];if(!r){this.log.warn("RPC data stream malformed: ".concat(ar.RPC_REQUEST_ID," not set."));return}const s=this.pendingResponses.get(r);if(s&&s.participantIdentity!==n){this.log.warn("RPC response stream for ".concat(r," arrived from unexpected sender ").concat(n,", expected ").concat(s.participantIdentity,". Ignoring."));return}let l;try{l=yield t.readAll()}catch(c){this.log.warn("Error reading RPC response payload: ".concat(c)),this.handleIncomingRpcResponseFailure(r,an.builtIn("APPLICATION_ERROR","Error reading RPC response payload",{cause:c}));return}this.handleIncomingRpcResponseSuccess(r,l)})}handleIncomingRpcResponseSuccess(t,n){var i,r;const s=this.pendingResponses.get(t);s?((r=(i=s.completionFuture).resolve)===null||r===void 0||r.call(i,n),this.pendingResponses.delete(t)):this.log.error("Response received for unexpected RPC request",t)}handleIncomingRpcResponseFailure(t,n){var i,r;const s=this.pendingResponses.get(t);s?((r=(i=s.completionFuture).reject)===null||r===void 0||r.call(i,n),this.pendingResponses.delete(t)):this.log.error("Response received for unexpected RPC request",t)}handleIncomingRpcAck(t){const n=this.pendingAcks.get(t);n?(n.resolve(),this.pendingAcks.delete(t)):this.log.error("Ack received for unexpected RPC request: ".concat(t))}handleParticipantDisconnected(t){var n;for(const l of this.pendingAcks){var i=tt(l,2);const c=i[0];i[1].participantIdentity===t&&this.pendingAcks.delete(c)}for(const l of this.pendingResponses){var r=tt(l,2);const c=r[0];var s=r[1];const h=s.participantIdentity,d=s.completionFuture;h===t&&((n=d.reject)===null||n===void 0||n.call(d,an.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(c))}}}class voe extends ts.EventEmitter{constructor(t,n,i){super(),this.rpcHandlers=new Map,this.log=t,this.outgoingDataStreamManager=n,this.getRemoteParticipantClientProtocol=i}
663registerRpcMethod(t,n){if(this.rpcHandlers.has(t))throw Error("RPC handler already registered for method ".concat(t,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(t,n)}unregisterRpcMethod(t){this.rpcHandlers.delete(t)}handleIncomingRpcRequest(t,n){return z(this,void 0,void 0,function*(){var i;if(this.publishRpcAck(t,n.id),n.version!==1){this.publishRpcResponsePacket(t,n.id,null,an.builtIn("UNSUPPORTED_VERSION"));return}const r=this.rpcHandlers.get(n.method);if(!r){this.publishRpcResponsePacket(t,n.id,null,an.builtIn("UNSUPPORTED_METHOD"));return}let s;try{s=yield r({requestId:n.id,callerIdentity:t,payload:n.payload,responseTimeout:n.responseTimeoutMs})}catch(l){let c;l instanceof an?c=l:(this.log.warn("Uncaught error returned by RPC handler for ".concat(n.method,". Returning APPLICATION_ERROR instead."),l),c=an.builtIn("APPLICATION_ERROR","Uncaught error: ".concat((i=l==null?void 0:l.message)!==null&&i!==void 0?i:l),{cause:l})),this.publishRpcResponsePacket(t,n.id,null,c);return}yield this.publishRpcResponse(t,n.id,s??"")})}handleIncomingDataStream(t,n,i){return z(this,void 0,void 0,function*(){const r=i[ar.RPC_REQUEST_ID],s=i[ar.RP
663C_REQUEST_METHOD],l=parseInt(i[ar.RPC_REQUEST_RESPONSE_TIMEOUT_MS],10),c=parseInt(i[ar.RPC_REQUEST_VERSION],10);if(!r||!s||Number.isNaN(l)||Number.isNaN(c)){this.log.warn("RPC data stream malformed: ".concat(ar.RPC_REQUEST_ID," / ").concat(ar.RPC_REQUEST_METHOD," / ").concat(ar.RPC_REQUEST_RESPONSE_TIMEOUT_MS," / ").concat(ar.RPC_REQUEST_VERSION," not set.")),this.publishRpcResponsePacket(n,r,null,an.builtIn("APPLICATION_ERROR","RPC data stream malformed"));return}if(this.publishRpcAck(n,r),c!==m8){this.publishRpcResponsePacket(n,r,null,an.builtIn("UNSUPPORTED_VERSION"));return}let h;try{h=yield t.readAll()}catch(p){this.log.warn("Error reading RPC request payload: ".concat(p)),this.publishRpcResponsePacket(n,r,null,an.builtIn("APPLICATION_ERROR","Error reading RPC request payload",{cause:p}));return}const d=this.rpcHandlers.get(s);if(!d){this.publishRpcResponsePacket(n,r,null,an.builtIn("UNSUPPORTED_METHOD"));return}let f;try{f=yield d({requestId:r,callerIdentity:n,payload:h,responseTimeout:l})}catch(p){let v;p instanceof an?v=p:(this.log.warn("Uncaught error returned by RPC handler for ".concat(s,". Returning APPLICATION_ERROR instead."),p),v=an.builtIn("APPLICATION_ERROR")),this.publishRpcResponsePacket(n,r,null,v);return}yield this.publishRpcResponse(n,r,f??"")})}publishRpcAck(t,n){this.emit("sendDataPacket",{packet:new xr({destinationIdentities:[t],kind:sc.RELIABLE,value:{case:"rpcAck",value:new my({requestId:n})}})})}publishRpcResponsePacket(t,n,i,r){this.emit("sendDataPacket",{packet:new xr({destinationIdentities:[t],kind:sc.RELIABLE,value:{case:"rpcResponse",value:new yC({requestId:n,value:r?{case:"error",value:r.toProto()}:{case:"payload",value:i??""}})}})})}publishRpcResponse(t,n,i){return z(this,void 0,void 0,function*(){if(this.getRemoteParticipantClientProtocol(t)>=$v){const l=yield this.outgoingDataStreamManager.streamText({topic:f8,destinationIdentities:[t],attributes:{[ar.RPC_REQUEST_ID]:n}});yield l.write(i),yield l.close();return}if(KC(i)>d8){this.log.warn("RPC Response payload too large for request ".concat(n,". To send larger responses, consider updating the sending client.")),this.publishRpcResponsePacket(t,n,null,an.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"));return}this.publishRpcResponsePacket(t,n,i,null)})}}class xoe extends GB{constructor(t,n,i,r,s,l){super(t,n,Ce.Kind.Audio,i,l),this.monitorReceiver=()=>z(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const c=yield this.getReceiverStats();c&&this.prevStats&&this.receiver&&(this._currentBitrate=by(c,this.prevStats)),this.prevStats=c}),this.audioContext=r,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(t){var n;for(const i of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(t,0,.1):i.volume=t;ja()&&this._mediaStreamTrack._setVolume(t),this.elementVolume=t}getVolume(){if(this.elementVolume)return this.elementVolume;if(ja())return 1;let t=0;return this.attachedElements.forEach(n=>{n.volume>t&&(t=n.volume)}),t}setSinkId(t){return z(this,void 0,void 0,function*(){this.sinkId=t,yield Promise.all(this.attachedElements.map(n=>{if(kN(n))return n.setSinkId(t)}))})}attach(t){const n=this.attachedElements.length===0;return t?super.attach(t):t=super.attach(),this.sinkId&&kN(t)&&t.setSinkId(this.sinkId).catch(i=>{this.log.error("Failed to set sink id on remote audio track",i,this.logContext)}),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,t),t.volume=0,t.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),t}detach(t){let n;return t?(n=super.detach(t),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(t){this.audioContext=t,t&&this.attachedElements.length>0?this.connectWebAudio(t,this.attachedElements[0]):t||this.disconnectWebAudio()}setWebAudioPlugins(t){this.webAudioPluginNodes=t,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(t,n){this.disconnectWebAudio(),this.sourceNode=t.createMediaStreamSource(n.srcObject);let i=this.sourceNode;
vendor: 4,814 bytes, line 663
663this.webAudioPluginNodes.forEach(r=>{i.connect(r),i=r}),this.gainNode=t.createGain(),i.connect(this.gainNode),this.gainNode.connect(t.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),t.state!=="running"&&t.resume().then(()=>{t.state!=="running"&&this.emit(Ue.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(r=>{this.emit(Ue.AudioPlaybackFailed,r)})}disconnectWebAudio(){var t,n;(t=this.gainNode)===null||t===void 0||t.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return z(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const t=yield this.receiver.getStats();let n;return t.forEach(i=>{i.type==="inbound-rtp"&&(n={type:"audio",streamId:i.id,timestamp:i.timestamp,jitter:i.jitter,bytesReceived:i.bytesReceived,concealedSamples:i.concealedSamples,concealmentEvents:i.concealmentEvents,silentConcealedSamples:i.silentConcealedSamples,silentConcealmentEvents:i.silentConcealmentEvents,totalAudioEnergy:i.totalAudioEnergy,totalSamplesDuration:i.totalSamplesDuration})}),n})}}class Do extends ts.EventEmitter{constructor(t,n,i,r){var s;super(),this.metadataMuted=!1,this.encryption=xn.NONE,this.log=vt,this.handleMuted=()=>{this.emit(Ue.Muted)},this.handleUnmuted=()=>{this.emit(Ue.Unmuted)},this.log=es((s=r==null?void 0:r.loggerName)!==null&&s!==void 0?s:zi.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=t,this.trackSid=n,this.trackName=i,this.source=Ce.Source.Unknown}setTrack(t){this.track&&(this.track.off(Ue.Muted,this.handleMuted),this.track.off(Ue.Unmuted,this.handleUnmuted)),this.track=t,t&&(t.on(Ue.Muted,this.handleMuted),t.on(Ue.Unmuted,this.handleUnmuted))}get logContext(){var t;return Object.assign(Object.assign({},(t=this.loggerContextCb)===null||t===void 0?void 0:t.call(this)),Ct(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==xn.NONE}get audioTrack(){if(eo(this.track))return this.track}get videoTrack(){if(Jo(this.track))return this.track}updateInfo(t){this.trackSid=t.sid,this.trackName=t.name,this.source=Ce.sourceFromProto(t.source),this.mimeType=t.mimeType,this.kind===Ce.Kind.Video&&t.width>0&&(this.dimensions={width:t.width,height:t.height},this.simulcasted=t.simulcast),this.encryption=t.encryption,this.trackInfo=t,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:t}))}}(function(e){(function(t){t.Desired="desired",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed"})(e.SubscriptionStatus||(e.SubscriptionStatus={})),(function(t){t.Allowed="allowed",t.NotAllowed="not_allowed"})(e.PermissionStatus||(e.PermissionStatus={}))})(Do||(Do={}));class PN extends Do{get isUpstreamPaused(){var t;return(t=this.track)===null||t===void 0?void 0:t.isUpstreamPaused}constructor(t,n,i,r){super(t,n.sid,n.name,r),this.track=void 0,this.handleTrackEnded=()=>{this.emit(Ue.Ended)},this.handleCpuConstrained=()=>{this.track&&Jo(this.track)&&this.emit(Ue.CpuConstrained,this.track)},this.updateInfo(n),this.setTrack(i)}setTrack(t){this.track&&(this.track.off(Ue.Ended,this.handleTrackEnded),this.track.off(Ue.CpuConstrained,this.handleCpuConstrained)),super.setTrack(t),t&&(t.on(Ue.Ended,this.handleTrackEnded),t.on(Ue.CpuConstrained,this.handleCpuConstrained))}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return z(this,void 0,void 0,function*(){var t;return(t=this.track)===null||t===void 0?void 0:t.mute()})}unmute(){return z(this,void 0,void 0,function*(){var t;return(t=this.track)===null||t===void 0?void 0:t.unmute()})}pauseUpstream(){return z(this,void 0,void 0,function*(){var t;yield(t=this.track)===null||t===void 0?void 0:t.pauseUpstream()})}resumeUpstream(){return z(this,void 0,void 0,function*(){var t;yield(t=this.track)===null||t===void 0?void 0:t.resumeUpstream()})}getTrackFeatures(){var t;if(eo(this.track)){const n=this.track.getSourceTrackSettings(),i=new Set;return n.autoGainControl&&i.add(Di.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&i.add(Di.TF_ECHO_CANCELLATION),n.noiseSuppression&&i.add(Di.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&i.add(Di.TF_STEREO),!((t=this.options)===null||t===void 0)&&t.dtx||i.add(Di.TF_NO_DTX),this.track.enhancedNoiseCancellation&&i.add(Di.TF_ENHANCED_NOISE_CANCELLATION),Array.from(i.values())}else return[]}}function Ty(e,t){return z(this,void 0,void 0,function*(){e??(e={});let n=!1;const i=VB(e),r=i.audioProcessor,s=i.videoProcessor,l=i.optionsWithoutProcessor;let c=l.audio,h=l.video;
663if(r&&typeof l.audio=="object"&&(l.audio.processor=r),s&&typeof l.video=="object"&&(l.video.processor=s),e.audio&&typeof l.audio=="object"&&typeof l.audio.deviceId=="string"){const v=l.audio.deviceId;l.audio.deviceId={exact:v},n=!0,c=Object.assign(Object.assign({},l.audio),{deviceId:{ideal:v}})}if(l.video&&typeof l.video=="object"&&typeof l.video.deviceId=="string"){const v=l.video.deviceId;l.video.deviceId={exact:v},n=!0,h=Object.assign(Object.assign({},l.video),{deviceId:{ideal:v}})}l.audio===!0?l.audio={deviceId:"default"}:typeof l.audio=="object"&&l.audio!==null&&(l.audio=Object.assign(Object.assign({},l.audio),{deviceId:l.audio.deviceId||"default"})),l.video===!0?l.video={deviceId:"default"}:typeof l.video=="object"&&!l.video.deviceId&&(l.video.deviceId="default");const d=BB(l,QB,XB),f=MC(d),p=navigator.mediaDevices.getUserMedia(f);l.audio&&(Li.userMediaPromiseMap.set("audioinput",p),p.catch(()=>Li.userMediaPromiseMap.delete("audioinput"))),l.video&&(Li.userMediaPromiseMap.set("videoinput",p),p.catch(()=>Li.userMediaPromiseMap.delete("videoinput")));try{const v=yield p;return yield Promise.all(v.getTracks().map(x=>z(this,void 0,void 0,function*(){const b=x.kind==="audio";let S;const N=b?f.audio:f.video;typeof N!="boolean"&&(S=N);const j=x.getSettings().deviceId;S!=null&&S.deviceId&&bu(S.deviceId)!==j?S.deviceId=j:S||(S={deviceId:j});const T=Rae(x,S,t);return T.kind===Ce.Kind.Video?T.source=Ce.Source.Camera:T.kind===Ce.Kind.Audio&&(T.source=Ce.Source.Microphone),T.mediaStream=v,eo(T)&&r?yield T.setProcessor(r):Jo(T)&&s&&(yield T.setProcessor(s)),T})))}catch(v){if(!n)throw v;return Ty(Object.assign(Object.assign({},e),{audio:c,video:h}),t)}})}function yoe(e){return z(this,void 0,void 0,function*(){return(yield Ty({audio:!1,video:!0}))[0]})}function boe(e){return z(this,void 0,void 0,function*(){return(yield Ty({audio:!0,video:!1}
663))[0]})}var Yl;(function(e){e.Excellent="excellent",e.Good="good",e.Poor="poor",e.Lost="lost",e.Unknown="unknown"})(Yl||(Yl={}));function woe(e){switch(e){case cm.EXCELLENT:return Yl.Excellent;case cm.GOOD:return Yl.Good;case cm.POOR:return Yl.Poor;case cm.LOST:return Yl.Lost;default:return Yl.Unknown}}class p8 extends ts.EventEmitter{get logContext(){var t,n;return Object.assign({},(n=(t=this.loggerOptions)===null||t===void 0?void 0:t.loggerContextCb)===null||n===void 0?void 0:n.call(t))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(t=>t.isEncrypted)}get isAgent(){var t;return((t=this.permissions)===null||t===void 0?void 0:t.agent)||this.kind===qm.AGENT}get isActive(){var t;return((t=this.participantInfo)===null||t===void 0?void 0:t.state)===Zd.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(t,n,i,r,s,l){let c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:qm.STANDARD;var h;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Yl.Unknown,this.log=vt,this.loggerOptions=l,this.log=es((h=l==null?void 0:l.loggerName)!==null&&h!==void 0?h:zi.Participant,()=>this.logContext),this.setMaxListeners(100),this.sid=t,this.identity=n,this.name=i,this.metadata=r,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=c,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(t){for(const i of this.trackPublications){var n=tt(i,2);const r=n[1];if(r.source===t)return r}}getTrackPublicationByName(t){for(const i of this.trackPublications){var n=tt(i,2);const r=n[1];if(r.trackName===t)return r}}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new Fi,this.once(Ve.Active,()=>{var t,n;(n=(t=this.activeFuture)===null||t===void 0?void 0:t.resolve)===null||n===void 0||n.call(t),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var t;const n=this.getTrackPublication(Ce.Source.Camera);return!(!((t=n==null?void 0:n.isMuted)!==null&&t!==void 0)||t)}get isMicrophoneEnabled(){var t;const n=this.getTrackPublication(Ce.Source.Microphone);return!(!((t=n==null?void 0:n.isMuted)!==null&&t!==void 0)||t)}get isScreenShareEnabled(){return!!this.getTrackPublication(Ce.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(t){var n;return this.participantInfo&&this.participantInfo.sid===t.sid&&this.participantInfo.version>t.version?!1:(this.identity=t.identity,this.sid=t.sid,this._setName(t.name),this._setMetadata(t.metadata),this._setAttributes(t.attributes),t.state===Zd.ACTIVE&&((n=this.participantInfo)===null||n===void 0?void 0:n.state)!==Zd.ACTIVE&&this.emit(Ve.Active),t.permission&&this.setPermissions(t.permission),this.participantInfo=t,!0)}_setMetadata(t){const n=this.metadata!==t,i=this.metadata;this.metadata=t,n&&this.emit(Ve.ParticipantMetadataChanged,i)}_setName(t){const n=this.name!==t;this.name=t,n&&this.emit(Ve.ParticipantNameChanged,t)}_setAttributes(t){const n=yse(this.attributes,t);this._attributes=t,Object.keys(n).length>0&&this.emit(Ve.AttributesChanged,n)}setPermissions(t){var n,i,r,s,l,c;const h=this.permissions,d=t.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||t.canSubscribe!==((i=this.permissions)===null||i===void 0?void 0:i.canSubscribe)||t.canPublishData!==((r=this.permissions)===null||r===void 0?void 0:r.canPublishData)||t.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||t.recorder!==((l=this.permissions)===null||l===void 0?void 0:l.recorder)||t.canPublishSources.length!==this.permissions.canPublishSources.length||t.canPublishSources.some((f,p)=>{var v;return f!==((v=this.permissions)===null||v===void 0?void 0:v.canPublishSources[p])})||t.canSubscribeMetrics!==((c=this.permissions)===null||c===void 0?void 0:c.canSubscribeMetrics);
663return this.permissions=t,d&&this.emit(Ve.ParticipantPermissionsChanged,h),d}setIsSpeaking(t){t!==this.isSpeaking&&(this.isSpeaking=t,t&&(this.lastSpokeAt=new Date),this.emit(Ve.IsSpeakingChanged,t))}setConnectionQuality(t){const n=this._connectionQuality;this._connectionQuality=woe(t),n!==this._connectionQuality&&this.emit(Ve.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var t,n;this.activeFuture&&((n=(t=this.activeFuture).reject)===null||n===void 0||n.call(t,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(t){this.audioContext=t,this.audioTrackPublications.forEach(n=>eo(n.track)&&n.track.setAudioContext(t))}addTrackPublication(t){t.on(Ue.Muted,()=>{this.emit(Ve.TrackMuted,t)}),t.on(Ue.Unmuted,()=>{this.emit(Ve.TrackUnmuted,t)});const n=t;switch(n.track&&(n.track.sid=t.trackSid),this.trackPublications.set(t.trackSid,t),t.kind){case Ce.Kind.Audio:this.audioTrackPublications.set(t.trackSid,t);break;case Ce.Kind.Video:this.videoTrackPublications.set(t.trackSid,t);break}}}function Soe(e){var t,n,i;if(!e.participantSid&&!e.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new JU({participantIdentity:(t=e.participantIdentity)!==null&&t!==void 0?t:"",participantSid:(n=e.participantSid)!==null&&n!==void 0?n:"",allTracks:(i=e.allowAll)!==null&&i!==void 0?i:!1,trackSids:e.allowedTrackSids||[]})}class koe extends p8{constructor(t,n,i,r,s,l,c,h){super(t,n,void 0,void 0,void 0,{loggerName:r.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=xn.NONE,this.e2eeStateMutex=new ur,this.enabledPublishVideoCodecs=[],this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Fi)},this.handleReconnected=()=>{var d,f;(f=(d=this.reconnectFuture)===null||d===void 0?void 0:d.resolve)===null||f===void 0||f.call(d),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var d,f,p,v,x,b;this.reconnectFuture&&(this.reconnectFuture.promise.catch(S=>this.log.warn(S.message)),(f=(d=this.reconnectFuture)===null||d===void 0?void 0:d.reject)===null||f===void 0||f.call(d,new Error("Got disconnected during reconnection attempt")),this.reconnectFuture=void 0),this.signalConnectedFuture&&((v=(p=this.signalConnectedFuture).reject)===null||v===void 0||v.call(p,new Error("Got disconnected without signal connected")),this.signalConnectedFuture=void 0),(b=(x=this.activeAgentFuture)===null||x===void 0?void 0:x.reject)===null||b===void 0||b.call(x,new Error("Got disconnected without active agent present")),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=d=>{var f,p;d.participant&&this.updateInfo(d.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new Fi),(p=(f=this.signalConnectedFuture).resolve)===null||p===void 0||p.call(f)},this.handleSignalRequestResponse=d=>{const f=d.requestId,p=d.reason,v=d.message,x=this.pendingSignalRequests.get(f);switch(x&&(p!==eu.OK&&x.reject(new sR(v,p)),this.pendingSignalRequests.delete(f)),d.request.case){case"publishDataTrack":{let b;switch(d.reason){case eu.NOT_ALLOWED:b=Ti.notAllowed(d.message);break;case eu.DUPLICATE_NAME:b=Ti.duplicateName(d.message);break;case eu.INVALID_NAME:b=Ti.invalidName(d.message);break;case eu.LIMIT_EXCEEDED:b=Ti.limitReached(d.message);break;default:b=Ti.unknown(d.reason,d.message);break}this.roomOutgoingDataTrackManager.receivedSfuPublishResponse(d.request.value.pubHandle,{type:"error",error:b});break}}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions}),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(d=>Soe(d)))},this.onTrackUnmuted=d=>{this.onTrackMuted(d,d.isUpstreamPaused)},this.onTrackMuted=(d,f)=>{if(f===void 0&&(f=!0),!d.sid){this.log.error("could not update mute status for unpublished track",Ct(d));return}this.engine.updateMuteStatus(d.sid,f)},this.onTrackUpstreamPaused=d=>{this.log.debug("upstream paused",Ct(d)),this.onTrackMuted(d,!0)},this.onTrackUpstreamResumed=d=>{this.log.debug("upstream resumed",Ct(d)),this.onTrackMuted(d,d.isMuted)},this.onTrackFeatureUpdate=d=>{const f=this.audioTrackPublications.get(d.sid);if(!f){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(d.sid));return}this.engine.client.sendUpdateLocalAudioTrack(f.trackSid,f.getTrackFeatures())},this.onTrackCpuConstrained=(d,f)=>
663{this.log.debug("track cpu constrained",Ct(f)),this.emit(Ve.LocalTrackCpuConstrained,d,f)},this.handleSubscribedQualityUpdate=d=>z(this,void 0,void 0,function*(){var f,p,v,x,b;if(!(!((b=this.roomOptions)===null||b===void 0)&&b.dynacast))return;const S=this.videoTrackPublications.get(d.trackSid);if(!S){this.log.warn("received subscribed quality update for unknown track",{trackSid:d.trackSid});return}if(!S.videoTrack)return;const N=yield S.videoTrack.setPublishingCodecs(d.subscribedCodecs);try{for(var j=!0,T=ua(N),E;E=yield T.next(),f=E.done,!f;j=!0){x=E.value,j=!1;const C=x;mse(C)&&(this.log.debug("publish ".concat(C," for ").concat(S.videoTrack.sid),Ct(S)),yield this.publishAdditionalCodecForTrack(S.videoTrack,C,S.options))}}catch(C){p={error:C}}finally{try{!j&&!f&&(v=T.return)&&(yield v.call(T))}finally{if(p)throw p.error}}}),this.handleLocalTrackUnpublished=d=>{const f=this.trackPublications.get(d.trackSid);if(!f){this.log.warn("received unpublished event for unknown track",{trackSid:d.trackSid});return}this.unpublishTrack(f.track)},this.handleTrackEnded=d=>z(this,void 0,void 0,function*(){if(d.source===Ce.Source.ScreenShare||d.source===Ce.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Ct(d)),this.unpublishTrack(d);else if(d.isUserProvided)yield d.mute();else if(Ro(d)||Ia(d))try{if(Xr())try{const f=yield navigator==null?void 0:navigator.permissions.query({name:d.source===Ce.Source.Camera?"camera":"microphone"});if(f&&f.state==="denied")throw this.log.warn("user has revoked access to ".concat(d.source),Ct(d)),f.onchange=()=>{f.state!=="denied"&&(d.isMuted||d.restartTrack(),f.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}d.isMuted||(this.log.debug("track ended, attempting to use a different device",Ct(d)),Ro(d)?yield d.restartTrack({deviceId:"default"}):yield d.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Ct(d)),yield d.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=i,this.roomOptions=r,this.setupEngine(i),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.roomOutgoingDataStreamManager=s,this.roomOutgoingDataTrackManager=l,this.rpcClientManager=c,this.rpcServerManager=h}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==xn.NONE}getTrackPublication(t){const n=super.getTrackPublication(t);if(n)return n}getTrackPublicationByName(t){const n=super.getTrackPublicationByName(t);if(n)return n}setupEngine(t){var n;this.engine=t,this.engine.on(Re.RemoteMute,(i,r)=>{const s=this.trackPublications.get(i);!s||!s.track||(r?s.mute():s.unmute())}),!((n=this.signalConnectedFuture)===null||n===void 0)&&n.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(Re.Connected,this.handleReconnected).on(Re.SignalConnected,this.handleSignalConnected).on(Re.SignalRestarted,this.handleReconnected).on(Re.SignalResumed,this.handleReconnected).on(Re.Restarting,this.handleReconnecting).on(Re.Resuming,this.handleReconnecting).on(Re.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(Re.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(Re.Closing,this.handleClosing).on(Re.SignalRequestResponse,this.handleSignalRequestResponse)}setMetadata(t){return z(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:t})})}setName(t){return z(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:t})})}setAttributes(t){return z(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:t})})}requestMetadataUpdate(t){return z(this,arguments,void 0,function(n){var i=this;let r=n.metadata,s=n.name,l=n.attributes;return(function*(){return new _r((c,h)=>z(i,void 0,void 0,function*(){var d,f;try{let p=!1;const v=yield this.engine.client.sendUpdateLocalMetadata((d=r??this.metadata)!==null&&d!==void 0?d:"",(f=s??this.name)!==null&&f!==void 0?f:"",l),x=performance.now();for(this.pendingSignalRequests.set(v,{resolve:c,reject:b=>{h(b),p=!0},values:{name:s,metadata:r,attributes:l}});performance.now()-x<5e3&&!p;){if((!s||this.name===s)&&(!r||this.metadata===r)&&(!l||Object.entries(l).every(b=>{let S=tt(b,2),N=S[0],j=S[1];return this.attributes[N]===j||j===""&&!this.attributes[N]}))){this.pendingSignalRequests.delete(v),c();return}yield br(50)}h(new sR("Request to update local metadata timed out","TimeoutError"))}catch(p){p instanceof Error?h(p):h(new Error(String(p)))}}))})()})}setCameraEnabled(t,n,i){return this.setTrackEnabled(Ce.Source.Camera,t,n,i)}setMicrophoneEnabled(t,n,i){return this.setTrackEnabled(Ce.Source.Microphone,t,n,i)}setScreenShareEnabled(t,n,i){return this.setTrackEnabled(Ce.Source.ScreenShare,t,n,i)}setE2EEEnabled(t){return z(this,void 0,void 0,function*(){const n=yield this.e2eeStateMutex.lock();try{if(this.encryptionType=t?xn.GCM:xn.NONE,yield Promise.all(this.pendingPublishPromises.values()),this.trackPublications.size===0||Array.from(this.trackPublications.values()).every(i=>i.isEncrypted===t))return;yield this.republishAllTracks(void 0,!1)}finally{n()}})}setTrackEnabled(t,n,i,r){return z(this,void 0,void 0,function*(){var s,l;this.log.debug("setTrackEnabled",{source:t,enabled:n}),this.republishPromise&&(yield this.republishPromise);let c=this.getTrackPublication(t);
663if(n)if(c)yield c.unmute();else{let p;if(this.pendingPublishing.has(t)){const v=yield this.waitForPendingPublicationOfSource(t);return v||this.log.info("waiting for pending publication promise timed out",{source:t}),yield v==null?void 0:v.unmute(),v}this.pendingPublishing.add(t);try{switch(t){case Ce.Source.Camera:p=yield this.createTracks({video:(s=i)!==null&&s!==void 0?s:!0});break;case Ce.Source.Microphone:p=yield this.createTracks({audio:(l=i)!==null&&l!==void 0?l:!0});break;case Ce.Source.ScreenShare:p=yield this.createScreenTracks(Object.assign({},i));break;default:throw new $o(t)}}catch(v){throw p==null||p.forEach(x=>{x.stop()}),v instanceof Error&&this.emit(Ve.MediaDevicesError,v,bN(t)),this.pendingPublishing.delete(t),v}for(const v of p){const x=Object.assign(Object.assign({},this.roomOptions.publishDefaults),i);t===Ce.Source.Microphone&&eo(v)&&x.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone"),v.startPreConnectBuffer())}try{const v=[];for(const b of p)this.log.info("publishing track",Ct(b)),v.push(this.publishTrack(b,r));const x=yield Promise.all(v);var h=tt(x,1);c=h[0]}catch(v){throw p==null||p.forEach(x=>{x.stop()}),v}finally{this.pendingPublishing.delete(t)}}else if(!(c!=null&&c.track)&&this.pendingPublishing.has(t)&&(c=yield this.waitForPendingPublicationOfSource(t),c||this.log.info("waiting for pending publication promise timed out",{source:t})),c&&c.track)if(t===Ce.Source.ScreenShare){const p=[this.unpublishTrack(c.track)],v=this.getTrackPublication(Ce.Source.ScreenShareAudio);v&&v.track&&p.push(this.unpublishTrack(v.track));var d=yield Promise.all(p),f=tt(d,1);c=f[0]}else yield c.mute();return c})}enableCameraAndMicrophone(){return z(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(Ce.Source.Camera)||this.pendingPublishing.has(Ce.Source.Microphone))){this.pendingPublishing.add(Ce.Source.Camera),this.pendingPublishing.add(Ce.Source.Microphone);try{const t=yield this.createTracks({audio:!0,video:!0});yield Promise.all(t.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(Ce.Source.Camera),this.pendingPublishing.delete(Ce.Source.Microphone)}}})}createTracks(t){return z(this,void 0,void 0,function*(){var n,i;t??(t={});const r=BB(t,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(i=this.roomOptions)===null||i===void 0?void 0:i.videoCaptureDefaults);try{return(yield Ty(r,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(c=>(eo(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=Ce.Source.Microphone,this.emit(Ve.AudioStreamAcquired)),Jo(c)&&(this.cameraError=void 0,c.source=Ce.Source.Camera),c))}catch(s){throw s instanceof Error&&(t.audio&&(this.microphoneError=s),t.video&&(this.cameraError=s)),s}})}createScreenTracks(t){return z(this,void 0,void 0,function*(){if(t===void 0&&(t={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new PC("getDisplayMedia not supported");t.resolution===void 0&&!Ase()&&(t.resolution=_C.h1080fps30.resolution);const n=gse(t),i=yield navigator.mediaDevices.getDisplayMedia(n),r=i.getVideoTracks();if(r.length===0)throw new $o("no video track found");const s=new Kv(r[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=Ce.Source.ScreenShare,t.contentHint&&(s.mediaStreamTrack.contentHint=t.contentHint);const l=[s];if(i.getAudioTracks().length>0){this.emit(Ve.AudioStreamAcquired);const c=new Wv(i.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=Ce.Source.ScreenShareAudio,l.push(c)}return l})}publishTrack(t,n){return z(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(t,n)})}waitForNextEngineRestart(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:15e3;return new Promise((n,i)=>{const r=()=>{clearTimeout(c),this.engine.off(Re.Restarted,s),this.engine.off(Re.Closing,l)},s=()=>{r(),n()},l=()=>{r(),i(new Error("engine closed before restart completed"))},c=setTimeout(()=>{r(),i(new Error("timed out waiting for engine restart"))},t);this.engine.once(Re.Restarted,s),this.engine.once(Re.Closing,l)})}publishOrRepublishTrack(t,n){return z(this,arguments,void 0,function(i,r){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return(function*(){var h,d,f,p;Ro(i)&&i.setAudioContext(s.audioContext),yield(h=s.reconnectFuture)===null||h===void 0?void 0:h.promise,s.republishPromise&&!l&&(yield s.republishPromise),ih(i)&&s.pendingPublishPromises.has(i)&&(yield s.pendingPublishPromises.get(i));let v;if(i instanceof MediaStreamTrack)v=i.getConstraints();else{v=i.constraints;let T;switch(i.source){case Ce.Source.Microphone:T="audioinput";break;case Ce.Source.Camera:T="videoinput"}T&&s.activeDeviceMap.has(T)&&(v=Object.assign(Object.assign({},v),{deviceId:s.activeDeviceMap.get(T)}))}if(i instanceof MediaStreamTrack)switch(i.kind){case"audio":i=new Wv(i,v,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":i=new Kv(i,v,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new $o("unsupported MediaStreamTrack kind ".concat(i.kind))}else i.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let x;if(s.trackPublications.forEach(T=>{T.track&&T.track===i&&(x=T)}),x)return s.log.warn("track has already been published, skipping",Ct(x)),x;const b=Object.assign(Object.assign({},s.roomOptions.publishDefaults),r),S="channelCount"in i.mediaStreamTrack.getSettings()&&i.mediaStreamTrack.getSettings().channelCount===2||i.mediaStreamTrack.getConstraints().channelCount===2,N=(d=b.forceStereo)!==null&&d!==void 0?d:S;N&&(b.dtx===void 0&&s.log.debug("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Ct(i)),b.red===void 0&&s.log.debug("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(f=b.dtx)!==null&&f!==void 0||(b.dtx=!1),(p=b.red)!==null&&p!==void 0||(b.red=!1)),!_se()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2"),b.simulcast=!1),b.source&&(i.source=b.source);const j=new Promise((T,E)=>z(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==gn.CONNECTED){this.log.debug("deferring track publication until signal is connected",{track:Ct(i)});let C=!1;const P=setTimeout(()=>{C=!0,i.stop(),E(new rR("publishing rejected as engine not connected within timeout",408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(P),C)return;const A=yield this.publish(i,b,N);T(A)}else try{const C=yield this.publish(i,b,N);T(C)}catch(C){E(C)}}catch(C){E(C)}}));s.pendingPublishPromises.set(i,j);try{return yield j}catch(T){if(!c&&T instanceof yu)return s.log.warn("negotiation due to track publish failed, retrying after reconnect",{error:T}),s.pendingPublishPromises.delete(i),yield s.waitForNextEngineRestart(),yield s.publishOrRepublishTrack(i,r,l,!0);throw T}finally{s.pendingPublishPromises.delete(i)}})()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new Fi),this.signalConnectedFuture.promise}hasPermissionsToPublish(t){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Ct(t)),!1;
663const n=this.permissions,i=n.canPublish,r=n.canPublishSources;return i&&(r.length===0||r.map(s=>bse(s)).includes(t.source))?!0:(this.log.warn("insufficient permissions to publish",Ct(t)),!1)}publish(t,n,i){return z(this,void 0,void 0,function*(){var r,s,l,c,h,d,f,p,v,x;if(!this.hasPermissionsToPublish(t))throw new rR("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(U=>ih(t)&&U.source===t.source)&&t.source!==Ce.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(t.source),Ct(t)),n.stopMicTrackOnMute&&eo(t)&&(t.stopOnMute=!0),t.source===Ce.Source.ScreenShare&&Eu()&&(n.simulcast=!1),n.videoCodec==="av1"&&!jse()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!Cse()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=TN),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(U=>n.videoCodec===jm(U.mime))||(n.videoCodec=jm(this.enabledPublishVideoCodecs[0].mime)));const S=n.videoCodec;t.on(Ue.Muted,this.onTrackMuted),t.on(Ue.Unmuted,this.onTrackUnmuted),t.on(Ue.Ended,this.handleTrackEnded),t.on(Ue.UpstreamPaused,this.onTrackUpstreamPaused),t.on(Ue.UpstreamResumed,this.onTrackUpstreamResumed),t.on(Ue.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const N=[],j=!(!((r=n.dtx)!==null&&r!==void 0)||r),T=t.getSourceTrackSettings();T.autoGainControl&&N.push(Di.TF_AUTO_GAIN_CONTROL),T.echoCancellation&&N.push(Di.TF_ECHO_CANCELLATION),T.noiseSuppression&&N.push(Di.TF_NOISE_SUPPRESSION),T.channelCount&&T.channelCount>1&&N.push(Di.TF_STEREO),j&&N.push(Di.TF_NO_DTX),Ro(t)&&t.hasPreConnectBuffer&&N.push(Di.TF_PRECONNECT_BUFFER);const E=this.normalizeRequestedFrameMetadataOptions(t,n),C=new Wm({cid:t.mediaStreamTrack.id,name:n.name,type:Ce.kindToProto(t.kind),muted:t.isMuted,source:Ce.sourceToProto(t.source),disableDtx:j,encryption:this.encryptionType,stereo:i,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy,audioFeatures:N,packetTrailerFeatures:E});let P;if(t.kind===Ce.Kind.Video){let U;try{U=yield t.waitForDimensions()}catch{const F=(c=(l=this.roomOptions.videoCaptureDefaults)===null||l===void 0?void 0:l.resolution)!==null&&c!==void 0?c:Hm.h720.resolution;U={width:F.width,height:F.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign({},Ct(t)),{dims:U}))}C.width=U.width,C.height=U.height,Ia(t)&&(da(S)&&(t.source===Ce.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in t.mediaStreamTrack&&(t.mediaStreamTrack.contentHint="motion",this.log.debug("forcing contentHint to motion for screenshare with SVC codecs",Ct(t)))),n.scalabilityMode=(h=n.scalabilityMode)!==null&&h!==void 0?h:"L3T3_KEY"),C.simulcastCodecs=[new oN({codec:S,cid:t.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:TN}),n.backupCodec&&S!==n.backupCodec.codec&&C.encryption===xn.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),C.simulcastCodecs.push(new oN({codec:n.backupCodec.codec,cid:""})))),P=Hv(t.source===Ce.Source.ScreenShare,C.width,C.height,n),C.layers=PR(C.width,C.height,P,da(n.videoCodec))}else t.kind===Ce.Kind.Audio&&(P=[{maxBitrate:(d=n.audioPreset)===null||d===void 0?void 0:d.maxBitrate,priority:(p=(f=n.audioPreset)===null||f===void 0?void 0:f.priority)!==null&&p!==void 0?p:"high",networkPriority:(x=(v=n.audioPreset)===null||v===void 0?void 0:v.priority)!==null&&x!==void 0?x:"high"}]);if(!this.engine||this.engine.isClosed)throw new Vn("cannot publish track when not connected");const A=()=>z(this,void 0,void 0,function*(){var U,O,F;if(!this.engine.pcManager)throw new Vn("pcManager is not ready");if(t.sender=yield this.engine.createSender(t,n,P),Ia(t)&&(t.publishOptions=n),this.emit(Ve.LocalSenderCreated,t.sender,t),Ia(t)&&((U=n.degradationPreference)!==null&&U!==void 0||(n.degradationPreference=Vae(t)),t.setDegradationPreference(n.degradationPreference)),P)if(Eu()&&t.kind===Ce.Kind.Audio){let ne;for(const re of this.engine.pcManager.publisher.getTransceivers())if(re.sender===t.sender){ne=re;break}ne&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:ne,codec:"opus",maxbr:!((O=P[0])===null||O===void 0)&&O.maxBitrate?P[0].maxBitrate/1e3:0}
663)}else t.codec&&da(t.codec)&&(!((F=P[0])===null||F===void 0)&&F.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:C.cid,codec:t.codec,maxbr:P[0].maxBitrate/1e3});yield this.engine.negotiate()});let M;const R=new Promise((U,O)=>z(this,void 0,void 0,function*(){var F;try{M=yield this.engine.addTrack(C),U(M)}catch(ne){if(t.sender&&(!((F=this.engine.pcManager)===null||F===void 0)&&F.publisher)){try{this.engine.pcManager.publisher.removeTrack(t.sender)}catch(re){this.log.error(re)}yield this.engine.negotiate().catch(re=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign({},Ct(t)),{error:re}))})}O(ne)}}));if(this.enabledPublishVideoCodecs.length>0&&E.length===0)M=(yield Promise.all([R,A()]))[0];else{M=yield R;let U;if(M.codecs.forEach(O=>{U===void 0&&(U=O.mimeType)}),U&&t.kind===Ce.Kind.Video){const O=jm(U);O!==S&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign({},Ct(t)),{codec:O})),n.videoCodec=O,P=Hv(t.source===Ce.Source.ScreenShare,C.width,C.height,n))}yield A()}const B=new PN(t.kind,M,t,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(B.on(Ue.CpuConstrained,U=>this.onTrackCpuConstrained(U,B)),B.options=n,t.sid=M.sid,Ia(t)&&(t.publishOptions=n,C.width&&C.height&&(t.lastEncodedDimensions={width:C.width,height:C.height})),this.log.debug("publishing ".concat(t.kind," with encodings"),{encodings:P,trackInfo:M}),Ia(t)?t.startMonitor(this.engine.client):Ro(t)&&t.startMonitor(),this.addTrackPublication(B),this.emit(Ve.LocalTrackPublished,B),Ro(t)&&M.audioFeatures.includes(Di.TF_PRECONNECT_BUFFER)){const U=t.getPreConnectBuffer(),O=t.getPreConnectBufferMimeType();this.on(Ve.LocalTrackSubscribed,F=>{if(F.trackSid===M.sid){if(!t.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed");return}this.log.debug("finished recording preconnect buffer",Ct(t)),t.stopPreConnectBuffer()}}),U&&new Promise((ne,re)=>z(this,void 0,void 0,function*(){var Q,W,q,$,ge,ue;try{this.log.debug("waiting for agent",Ct(t));const Pe=setTimeout(()=>{re(new Error("agent not active within 10 seconds"))},1e4),Oe=yield this.waitUntilActiveAgentPresent();clearTimeout(Pe),this.log.debug("sending preconnect buffer",Ct(t));const je=yield this.streamBytes({name:"preconnect-buffer",mimeType:O,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[Oe.identity],attributes:{trackId:B.trackSid,sampleRate:String((ge=T.sampleRate)!==null&&ge!==void 0?ge:"48000"),channels:String((ue=T.channelCount)!==null&&ue!==void 0?ue:"1")}});try{for(var L=!0,J=ua(U),ye;ye=yield J.next(),Q=ye.done,!Q;L=!0){$=ye.value,L=!1;const Ke=$;yield je.write(Ke)}}catch(Ke){W={error:Ke}}finally{try{!L&&!Q&&(q=J.return)&&(yield q.call(J))}finally{if(W)throw W.error}}yield je.close(),ne()}catch(Pe){re(Pe)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Ct(t))}).catch(ne=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign({},Ct(t)),{error:ne}))})}return B})}canPublishFrameMetadata(){var t;return!!(this.roomOptions.e2ee||this.roomOptions.encryption||Qm((t=this.roomOptions.frameMetadata)!==null&&t!==void 0?t:this.roomOptions.packetTrailer))}normalizeRequestedFrameMetadataOptions(t,n){var i;const r=(i=n.frameMetadata)!==null&&i!==void 0?i:n.packetTrailer;if(t.kind!==Ce.Kind.Video||!zv(r))return n.frameMetadata=void 0,n.packetTrailer=void 0,[];if(!this.canPublishFrameMetadata())return this.log.warn("frame metadata transform not supported; not advertising features",Object.assign(Object.assign({},this.logContext),Ct(t))),n.frameMetadata=void 0,n.packetTrailer=void 0,[];const s=eae(r),l=tae(s);return n.frameMetadata=l,n.packetTrailer=l,s}get isLocal(){return!0}publishAdditionalCodecForTrack(t,n,i){return z(this,void 0,void 0,function*(){var r;if(this.encryptionType!==xn.NONE)return;let s;if(this.trackPublications.forEach(b=>{b.track&&b.track===t&&(s=b)}),!s)throw new $o("track is not published");if(!Ia(t))throw new $o("track is not a video track");const l=Object.assign(Object.assign({},(r=this.roomOptions)===null||r===void 0?void 0:r.publishDefaults),i),c=ZB(t,n,l);if(!c){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Ct(t));return}const h=t.addSimulcastTrack(n,c);if(!h)return;const d=this.normalizeRequestedFrameMetadataOptions(t,l),f=new Wm({cid:h.mediaStreamTrack.id,type:Ce.kindToProto(t.kind),muted:t.isMuted,source:Ce.sourceToProto(t.source),sid:t.sid,packetTrailerFeatures:d,simulcastCodecs:[{codec:l.videoCodec,cid:h.mediaStreamTrack.id}]});if(f.layers=PR(f.width,f.height,c),!this.engine||this.engine.isClosed)throw new Vn("cannot publish track when not connected");const p=()=>z(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(t,h,l,c),yield this.engine.negotiate()}),x=(yield Promise.all([this.engine.addTrack(f),p()]))[0];this.log.debug("published ".concat(n," for track ").concat(t.sid),{encodings:c,trackInfo:x})})}unpublishTrack(t,n){return z(this,void 0,void 0,function*(){var i,r;if(ih(t)){const f=this.pendingPublishPromises.get(t);f&&(this.log.debug("awaiting publish promise before attempting to unpublish",Ct(t)),yield f)}const s=this.getPublicationForTrack(t),l=s?Ct(s):void 0;if(this.log.info("unpublishing track",l),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",l);return}t=s.track,t.off(Ue.Muted,this.onTrackMuted),t.off(Ue.Unmuted,this.onTrackUnmuted),t.off(Ue.Ended,this.handleTrackEnded),t.off(Ue.UpstreamPaused,this.onTrackUpstreamPaused),t.off(Ue.UpstreamResumed,this.onTrackUpstreamResumed),t.off(Ue.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(r=(i=this.roomOptions)===null||i===void 0?void 0:i.stopLocalTrackOnUnpublish)!==null&&r!==void 0?r:!0),n?t.stop():t.stopMonitor();let c=!1;const h=t.sender;if(t.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<zn.FAILED&&h)try{for(const f of this.engine.pcManager.publisher.getTransceivers())f.sender===h&&(f.direction="inactive",c=!0);try{c=this.engine.removeTrack(h)}catch(f){this.log.warn(f),c=!0}if(Ia(t)){for(const f of t.simulcastCodecs){var d=tt(f,2);const p=d[1];if(p.sender){try{c=this.engine.removeTrack(p.sender)}catch(v){this.log.warn(v),c=!0}p.sender=void 0}}t.simulcastCodecs.clear()}}catch(f){this.log.warn("failed to unpublish track",Object.assign(Object.assign({},l),{error:f}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case Ce.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case Ce.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}
663return this.emit(Ve.LocalTrackUnpublished,s),s.setTrack(void 0),c&&(yield this.engine.negotiate()),s})}unpublishTracks(t){return z(this,void 0,void 0,function*(){return(yield Promise.all(t.map(i=>this.unpublishTrack(i)))).filter(i=>!!i)})}republishAllTracks(t){return z(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){i.republishPromise&&(yield i.republishPromise),i.republishPromise=new _r((s,l)=>z(i,void 0,void 0,function*(){try{const c=[];this.trackPublications.forEach(h=>{h.track&&(n&&(h.options=Object.assign(Object.assign({},h.options),n)),c.push(h))}),yield Promise.all(c.map(h=>z(this,void 0,void 0,function*(){const d=h.track;yield this.unpublishTrack(d,!1),r&&!d.isMuted&&d.source!==Ce.Source.ScreenShare&&d.source!==Ce.Source.ScreenShareAudio&&(Ro(d)||Ia(d))&&!d.isUserProvided&&(this.log.debug("restarting existing track",{track:h.trackSid}),yield d.restartTrack()),yield this.publishOrRepublishTrack(d,h.options,!0)}))),s()}catch(c){c instanceof Error?l(c):l(new Error(String(c)))}finally{this.republishPromise=void 0}})),yield i.republishPromise})()})}publishData(t){return z(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return(function*(){const s=r.reliable?xt.RELIABLE:xt.LOSSY,l=r.reliable?sc.RELIABLE:sc.LOSSY,c=r.destinationIdentities,h=r.topic;let d=new vC({participantIdentity:i.identity,payload:n,destinationIdentities:c,topic:h});const f=new xr({kind:l,value:{case:"user",value:d}});yield i.engine.sendDataPacket(f,s)})()})}publishDtmf(t,n){return z(this,void 0,void 0,function*(){const i=new xr({kind:sc.RELIABLE,value:{case:"sipDtmf",value:new OU({code:t,digit:n})}});yield this.engine.sendDataPacket(i,xt.RELIABLE)})}sendChatMessage(t,n){return z(this,void 0,void 0,function*(){const i={id:crypto.randomUUID(),message:t,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},r=new xr({value:{case:"chatMessage",value:new Lv(Object.assign(Object.assign({},i),{timestamp:Un.parse(i.timestamp)}))}});return yield this.engine.sendDataPacket(r,xt.RELIABLE),this.emit(Ve.ChatMessage,i),i})}editChatMessage(t,n){return z(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},n),{message:t,editTimestamp:Date.now()}),r=new xr({value:{case:"chatMessage",value:new Lv(Object.assign(Object.assign({},i),{timestamp:Un.parse(i.timestamp),editTimestamp:Un.parse(i.editTimestamp)}))}});return yield this.engine.sendDataPacket(r,xt.RELIABLE),this.emit(Ve.ChatMessage,i),i})}sendText(t,n){return z(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(t,n)})}streamText(t){return z(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(t)})}sendFile(t,n){return z(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(t,n)})}streamBytes(t){return z(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(t)})}performRpc(t){return this.rpcClientManager.performRpc(t).then(n=>{let i=tt(n,2);return i[0],i[1]})}
663registerRpcMethod(t,n){this.rpcServerManager.registerRpcMethod(t,n)}unregisterRpcMethod(t){this.rpcServerManager.unregisterRpcMethod(t)}setTrackSubscriptionPermissions(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=t,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}setEnabledPublishCodecs(t){this.enabledPublishVideoCodecs=t.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(t){return super.updateInfo(t)?(t.tracks.forEach(n=>{var i,r;const s=this.trackPublications.get(n.sid);if(s){const l=s.isMuted||((r=(i=s.track)===null||i===void 0?void 0:i.isUpstreamPaused)!==null&&r!==void 0?r:!1);l!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign({},Ct(s)),{mutedOnServer:l})),this.engine.client.sendMuteTrack(n.sid,l))}}),!0):!1}setActiveAgent(t){var n,i,r,s;this.firstActiveAgent=t,t&&!this.firstActiveAgent&&(this.firstActiveAgent=t),t?(i=(n=this.activeAgentFuture)===null||n===void 0?void 0:n.resolve)===null||i===void 0||i.call(n,t):(s=(r=this.activeAgentFuture)===null||r===void 0?void 0:r.reject)===null||s===void 0||s.call(r,new Error("Agent disconnected")),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new Fi),this.activeAgentFuture.promise)}getPublicationForTrack(t){let n;return this.trackPublications.forEach(i=>{const r=i.track;r&&(t instanceof MediaStreamTrack?(Ro(r)||Ia(r))&&r.mediaStreamTrack===t&&(n=i):t===r&&(n=i))}),n}waitForPendingPublicationOfSource(t){return z(this,void 0,void 0,function*(){const i=Date.now();for(;Date.now()<i+1e4;){const r=Array.from(this.pendingPublishPromises.entries()).find(s=>tt(s,1)[0].source===t);if(r)return r[1];yield br(20)}})}publishDataTrack(t){return z(this,void 0,void 0,function*(){const n=new jy(t,this.roomOutgoingDataTrackManager);return yield n.publish(),n})}}class YR extends DOMException{constructor(t,n){super(t,"AbortError"),this.reason=n}}class Noe extends Map{constructor(){super(...arguments),this.pending=new Map}set(t,n){var i,r;super.set(t,n);const s=(i=this.pending)===null||i===void 0?void 0:i.get(t);if(s){for(const l of s)l.isResolved||(r=l.resolve)===null||r===void 0||r.call(l,n);this.pending.delete(t)}return this}get[Symbol.toStringTag](){return"DeferrableMap"}getDeferred(t,n){return z(this,void 0,void 0,function*(){const i=this.get(t);if(typeof i<"u")return i;if(n!=null&&n.aborted)throw new YR("The operation was aborted.",n.reason);const r=new Fi(void 0,()=>{const l=this.pending.get(t);if(!l)return;const c=l.indexOf(r);c!==-1&&l.splice(c,1),l.length===0&&this.pending.delete(t)}),s=this.pending.get(t);if(s?s.push(r):this.pending.set(t,[r]),n){const l=()=>{var c;r.isResolved||(c=r.reject)===null||c===void 0||c.call(r,new YR("The operation was aborted.",n.reason))};n.addEventListener("abort",l,{once:!0}),r.promise.finally(()=>{n.removeEventListener("abort",l)})}return r.promise})}}class joe extends Do{constructor(t,n,i,r){super(t,n.sid,n.name,r),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=s=>{this.setTrack(void 0),this.emit(Ue.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.visible=s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensionsAdaptiveStream=s,this.emitTrackUpdate()},this.subscribed=i,this.updateInfo(n)}setSubscribed(t){const n=this.subscriptionStatus,i=this.permissionStatus;this.subscribed=t,t&&(this.allowed=!0);const r=new vy({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new DU({participantSid:"",trackSids:[this.trackSid]})]});this.emit(Ue.UpdateSubscription,r),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(i)}get subscriptionStatus(){return this.subscribed===!1?Do.SubscriptionStatus.Unsubscribed:super.isSubscribed?Do.SubscriptionStatus.Subscribed:Do.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Do.PermissionStatus.Allowed:Do.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return this.requestedDisabled!==void 0?!this.requestedDisabled:this.isAdaptiveStream?this.visible:!0}get isLocal(){return!1}setEnabled(t){!this.isManualOperationAllowed()||this.requestedDisabled===!t||(this.requestedDisabled=!t,this.emitTrackUpdate())}setVideoQuality(t){!this.isManualOperationAllowed()||this.requestedMaxQuality===t||(this.requestedMaxQuality=t,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(t){var n,i;this.isManualOperationAllowed()&&(((n=this.requestedVideoDimensions)===null||n===void 0?void 0:n.width)===t.width&&((i=this.requestedVideoDimensions)===null||i===void 0?void 0:i.height)===t.height||(bS(this.track)&&(this.requestedVideoDimensions=t),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(t){this.isManualOperationAllowed()&&bS(this.track)&&this.fps!==t&&(this.fps=t,this.emitTrackUpdate())}get videoQuality(){var t;return(t=this.requestedMaxQuality)!==null&&t!==void 0?t:ps.HIGH}setTrack(t){const n=this.subscriptionStatus,i=this.permissionStatus,r=this.track;r!==t&&(r&&(r.off(Ue.VideoDimensionsChanged,this.handleVideoDimensionsChange),r.off(Ue.VisibilityChanged,this.handleVisibilityChange),r.off(Ue.Ended,this.handleEnded),r.detach(),r.stopMonitor(),this.emit
vendor: 4,089 bytes, line 663
663(Ue.Unsubscribed,r)),super.setTrack(t),t&&(t.sid=this.trackSid,t.on(Ue.VideoDimensionsChanged,this.handleVideoDimensionsChange),t.on(Ue.VisibilityChanged,this.handleVisibilityChange),t.on(Ue.Ended,this.handleEnded),this.emit(Ue.Subscribed,t)),this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(t){const n=this.subscriptionStatus,i=this.permissionStatus;this.allowed=t,this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(t){this.emit(Ue.SubscriptionFailed,t)}updateInfo(t){super.updateInfo(t);const n=this.metadataMuted;this.metadataMuted=t.muted,this.track?this.track.setMuted(t.muted):n!==t.muted&&this.emit(t.muted?Ue.Muted:Ue.Unmuted)}emitSubscriptionUpdateIfChanged(t){const n=this.subscriptionStatus;t!==n&&this.emit(Ue.SubscriptionStatusChanged,n,t)}emitPermissionUpdateIfChanged(t){this.permissionStatus!==t&&this.emit(Ue.SubscriptionPermissionChanged,this.permissionStatus,t)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return bS(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const t=new GU({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===Ce.Kind.Video){let n=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(n)oR(this.videoDimensionsAdaptiveStream,n)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){const i=wse(this.trackInfo,this.requestedMaxQuality);i&&oR(this.videoDimensionsAdaptiveStream,i)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream;n?(t.width=Math.ceil(n.width),t.height=Math.ceil(n.height)):this.requestedMaxQuality!==void 0?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),t.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:ps.HIGH})),t.quality=ps.HIGH)}this.emit(Ue.UpdateSettings,t)}}class Yv extends p8{static fromParticipantInfo(t,n,i,r){return new Yv(t,n.sid,n.identity,n.name,n.metadata,n.attributes,i,n.kind,n.dataTracks.map(s=>{const l=qv.from(s);return new u8(l,r,{publisherIdentity:n.identity})}),n.clientProtocol)}get logContext(){return Object.assign(Object.assign({},super.logContext),{remoteParticipantID:this.sid,remoteParticipant:this.identity})}constructor(t,n,i,r,s,l,c){let h=arguments.length>7&&arguments[7]!==void 0?arguments[7]:qm.STANDARD,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:[],f=arguments.length>9&&arguments[9]!==void 0?arguments[9]:LB;super(n,i||"",r,s,l,c,h),this.signalClient=t,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.dataTracks=new Noe(d.map(p=>[p.info.name,p])),this.volumeMap=new Map,this.clientProtocol=f}addTrackPublication(t){super.addTrackPublication(t),t.on(Ue.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),Ct(t)),{settings:n})),this.signalClient.sendUpdateTrackSettings(n)}),t.on(Ue.UpdateSubscription,n=>{n.participantTracks.forEach(i=>{i.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),t.on(Ue.SubscriptionPermissionChanged,n=>{this.emit(Ve.TrackSubscriptionPermissionChanged,t,n)}),t.on(Ue.SubscriptionStatusChanged,n=>{this.emit(Ve.TrackSubscriptionStatusChanged,t,n)}),t.on(Ue.Subscribed,n=>{this.emit(Ve.TrackSubscribed,n,t)}),t.on(Ue.Unsubscribed,n=>
vendor: 2,796 bytes, line 663
663{this.emit(Ve.TrackUnsubscribed,n,t)}),t.on(Ue.SubscriptionFailed,n=>{this.emit(Ve.TrackSubscriptionFailed,t.trackSid,n)})}getTrackPublication(t){const n=super.getTrackPublication(t);if(n)return n}getTrackPublicationByName(t){const n=super.getTrackPublicationByName(t);if(n)return n}setVolume(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ce.Source.Microphone;this.volumeMap.set(n,t);const i=this.getTrackPublication(n);i&&i.track&&i.track.setVolume(t)}getVolume(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ce.Source.Microphone;const n=this.getTrackPublication(t);return n&&n.track?n.track.getVolume():this.volumeMap.get(t)}addSubscribedMediaTrack(t,n,i,r,s,l){let c=this.getTrackPublicationBySid(n);if(c||n.startsWith("TR")||this.trackPublications.forEach(f=>{!c&&t.kind===f.kind.toString()&&(c=f)}),!c){if(l===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n})),this.emit(Ve.TrackSubscriptionFailed,n);return}l===void 0&&(l=20),setTimeout(()=>{this.addSubscribedMediaTrack(t,n,i,r,s,l-1)},150);return}if(t.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),Ct(c))),this.emit(Ve.TrackSubscriptionFailed,n);return}const h=t.kind==="video";let d;return h?d=new LC(t,n,r,s):d=new xoe(t,n,r,this.audioContext,this.audioOutput),d.source=c.source,d.isMuted=c.isMuted,d.setMediaStream(i),d.start(),c.setTrack(d),this.volumeMap.has(c.source)&&jN(d)&&eo(d)&&d.setVolume(this.volumeMap.get(c.source)),c}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(t){return this.trackPublications.get(t)}updateInfo(t){if(!super.updateInfo(t))return!1;const n=new Map,i=new Map;return t.tracks.forEach(r=>{var s,l;let c=this.getTrackPublicationBySid(r.sid);if(c)c.updateInfo(r);else{const h=Ce.kindFromProto(r.type);if(!h)return;c=new joe(h,r,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(l=this.loggerOptions)===null||l===void 0?void 0:l.loggerName}),c.updateInfo(r),i.set(r.sid,c);const d=Array.from(this.trackPublications.values()).find(f=>f.source===(c==null?void 0:c.source));d&&c.source!==Ce.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(c.source),Object.assign(Object.assign({},this.logContext),{oldTrack:Ct(d),newTrack:Ct(c)})),this.addTrackPublication(c)}n.set(r.sid,c)}),this.trackPublications.forEach(r=>{n.has(r.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),Ct(r))),this.unpublishTrack(r.trackSid,!0))}
663),i.forEach(r=>{this.emit(Ve.TrackPublished,r)}),!0}unpublishTrack(t,n){const i=this.trackPublications.get(t);if(!i)return;const r=i.track;switch(r&&(r.stop(),i.setTrack(void 0)),this.trackPublications.delete(t),i.kind){case Ce.Kind.Audio:this.audioTrackPublications.delete(t);break;case Ce.Kind.Video:this.videoTrackPublications.delete(t);break}n&&this.emit(Ve.TrackUnpublished,i)}setAudioOutput(t){return z(this,void 0,void 0,function*(){this.audioOutput=t;const n=[];this.audioTrackPublications.forEach(i=>{var r;eo(i.track)&&jN(i.track)&&n.push(i.track.setSinkId((r=t.deviceId)!==null&&r!==void 0?r:"default"))}),yield Promise.all(n)})}addRemoteDataTrack(t){this.dataTracks.set(t.info.name,t)}removeRemoteDataTrack(t){for(const i of this.dataTracks.entries()){var n=tt(i,2);const r=n[0],s=n[1];t===s.info.sid&&this.dataTracks.delete(r)}}emit(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:t,args:i})),super.emit(t,...i)}}var Gt;(function(e){e.Disconnected="disconnected",e.Connecting="connecting",e.Connected="connected",e.Reconnecting="reconnecting",e.SignalReconnecting="signalReconnecting"})(Gt||(Gt={}));const Coe=4*1e3;class bh extends ts.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(t){var n,i,r,s,l,c,h;if(super(),n=this,this.state=Gt.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.e2eeStateMutex=new ur,this.isVideoPlaybackBlocked=!1,this.log=vt,this.bufferedEvents=[],this.isResuming=!1,this.connect=(d,f,p)=>z(this,void 0,void 0,function*(){var v;if(!Tse())throw ja()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const x=yield this.disconnectLock.lock();if(this.state===Gt.Connected)return this.log.info("already connected to room ".concat(this.name)),x(),Promise.resolve();if(this.connectFuture)return x(),this.connectFuture.promise;this.setAndEmitConnectionState(Gt.Connecting),((v=this.regionUrlProvider)===null||v===void 0?void 0:v.getServerUrl().toString())!==KB(d)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),vh(new URL(d))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Ot(d,f):this.regionUrlProvider.updateToken(f),this.regionUrlProvider.fetchRegionSettings().then(N=>{var j;(j=this.regionUrlProvider)===null||j===void 0||j.setServerReportedRegions(N)}).catch(N=>{this.log.warn("could not fetch region settings",{error:N})}));const b=(N,j,T)=>z(this,void 0,void 0,function*(){var E,C;this.abortController&&this.abortController.abort();const P=new AbortController;this.abortController=P,x==null||x();try{if(yield rh.getInstance().getBackOffPromise(d),P.signal.aborted)throw at.cancelled("Connection attempt aborted");yield this.attemptConnection(T??d,f,p,P),this.abortController=void 0,N()}catch(A){if(this.regionUrlProvider&&A instanceof at&&A.reason!==vn.Cancelled&&A.reason!==vn.NotAllowed){let M=null;try{this.log.debug("Fetching next region"),M=yield this.regionUrlProvider.getNextBestRegionUrl((E=this.abortController)===null||E===void 0?void 0:E.signal)}catch(R){if(R instanceof at&&(R.status===401||R.reason===vn.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),j(R);return}}[vn.InternalError,vn.ServerUnreachable,vn.Timeout].includes(A.reason)&&(this.log.debug("Adding failed connection attempt to back off"),rh.getInstance().addFailedConnectionAttempt(d)),M&&!(!((C=this.abortController)===null||C===void 0)&&C.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(A.message,". Retrying with another region: ").concat(M)),this.recreateEngine(!0),yield b(N,j,M)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,fR(A)),j(A))}else{let M=ya.UNKNOWN_REASON;A instanceof at&&(M=fR(A)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,M),j(A)}}}),S=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Fi((N,j)=>{b(N,j,S)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(d,f,p,v,x,b)=>z(this,void 0,void 0,function*(){var S;const N=yield p.join(d,f,{autoSubscribe:v.autoSubscribe,adaptiveStream:typeof x.adaptiveStream=="object"?!0:x.adaptiveStream,clientInfoCapabilities:Qm((S=x.frameMetadata)!==null&&S!==void 0?S:x.packetTrailer)||this.e2eeManager?[$U.CAP_PACKET_TRAILER]:void 0,maxRetries:v.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:v.websocketTimeout},b.signal,!x.singlePeerConnection),j=N.joinResponse,T=N.serverInfo;if(this.serverInfo=T,!T.version)throw new cse("unknown server version");return T.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version"),x.dynacast=!1),j}),this.applyJoinResponse=d=>{const f=d.participant;if(this.localParticipant.sid=f.sid,this.localParticipant.identity=f.identity,this.localParticipant.setEnabledPublishCodecs(d.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(d.sifTrailer)}catch(p){this.log.error(p instanceof Error?p.message:"Could not set SifTrailer",{error:p})}this.handleParticipantUpdates([f,...d.otherParticipants]),d.room&&this.handleRoomUpdate(d.room)},this.attemptConnection=(d,f,p,v)=>z(this,void 0,void 0,function*(){var x,b;this.state===Gt.Reconnecting||this.isResuming||!((x=this.engine)===null||x===void 0)&&x.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt"),this.recreateEngine(!0)):this.maybeCreateEngine(),!((b=this.regionUrlProvider)===null||b===void 0)&&b.isCloud()&&this.engine.setRegionStrategy(this.createRegionStrategy()),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},zC),p),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const S=yield this.connectSignal(d,f,this.engine,this.connOptions,this.options,v);this.applyJoinResponse(S),this.setupLocalParticipantEvents(),this.emit
663(_e.SignalConnected)}catch(S){yield this.engine.close(),this.recreateEngine();const N=v.signal.aborted?at.cancelled("Signal connection aborted"):at.serverUnreachable("could not establish signal connection");throw S instanceof Error&&(N.message="".concat(N.message,": ").concat(S.message)),S instanceof at&&(N.reason=S.reason,N.status=S.status),this.log.debug("error trying to establish signal connection",{error:S}),N}if(v.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),at.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,v)}catch(S){throw yield this.engine.close(),this.recreateEngine(),S}Xr()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Xr()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Gt.Connected),this.emit(_e.Connected),rh.getInstance().resetFailedConnectionAttempts(d),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){for(var d=arguments.length,f=new Array(d),p=0;p<d;p++)f[p]=arguments[p];return z(n,[...f],void 0,function(){var v=this;let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){var b,S,N;const j=yield v.disconnectLock.lock();try{if(v.state===Gt.Disconnected){v.log.debug("already disconnected");return}if(v.log.info("disconnect from room"),v.state===Gt.Connecting||v.state===Gt.Reconnecting||v.isResuming){const T="Abort connection attempt due to user initiated disconnect";v.log.warn(T),(b=v.abortController)===null||b===void 0||b.abort(T),(N=(S=v.connectFuture)===null||S===void 0?void 0:S.reject)===null||N===void 0||N.call(S,at.cancelled("Client initiated disconnect")),v.connectFuture=void 0}v.engine&&(v.engine.client.isDisconnected||(yield v.engine.client.sendLeave()),yield v.engine.close()),v.handleDisconnect(x,ya.CLIENT_INITIATED),v.engine=void 0}finally{j()}})()})},this.onPageLeave=()=>z(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting"),yield this.disconnect()}),this.startAudio=()=>z(this,void 0,void 0,function*(){const d=[],f=Or();if(f&&f.os==="iOS"){const p="livekit-dummy-audio-el";let v=document.getElementById(p);if(!v){v=document.createElement("audio"),v.id=p,v.autoplay=!0,v.hidden=!0;const x=yS();x.enabled=!0;const b=new MediaStream([x]);v.srcObject=b,document.addEventListener("visibilitychange",()=>{v&&(v.srcObject=document.hidden?null:b,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status"),this.startAudio()))}),document.body.append(v),this.once(_e.Disconnected,()=>{v==null||v.remove(),v=null})}d.push(v)}
663this.remoteParticipants.forEach(p=>{p.audioTrackPublications.forEach(v=>{v.track&&v.track.attachedElements.forEach(x=>{d.push(x)})})});try{yield Promise.all([this.acquireAudioContext(),...d.map(p=>(p.muted=!1,p.play()))]),this.handleAudioPlaybackStarted()}catch(p){throw this.handleAudioPlaybackFailed(p),p}}),this.startVideo=()=>z(this,void 0,void 0,function*(){const d=[];for(const f of this.remoteParticipants.values())f.videoTrackPublications.forEach(p=>{var v;(v=p.track)===null||v===void 0||v.attachedElements.forEach(x=>{d.includes(x)||d.push(x)})});yield Promise.all(d.map(f=>f.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(f=>{f.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler")})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const d of this.remoteParticipants.values())this.handleParticipantDisconnected(d.identity,d);this.setAndEmitConnectionState(Gt.Reconnecting)&&this.emit(_e.Reconnecting)},this.handleRestarted=()=>{this.outgoingDataTrackManager.sfuWillRepublishTracks(),this.incomingDataTrackManager.resendSubscriptionUpdates()},this.handleSignalRestarted=d=>z(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(d.serverRegion),{region:d.serverRegion}),this.bufferedEvents=[],this.applyJoinResponse(d);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(f){this.log.error("error trying to re-publish tracks after reconnection",{error:f})}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",{region:d.serverRegion})}catch{return}this.setAndEmitConnectionState(Gt.Connected),this.emit(_e.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=d=>{var f;for(const v of d){if(v.identity===this.localParticipant.identity){this.localParticipant.updateInfo(v);continue}v.identity===""&&(v.identity=(f=this.sidToIdentity.get(v.sid))!==null&&f!==void 0?f:"");let x=this.remoteParticipants.get(v.identity);v.state===Zd.DISCONNECTED?this.handleParticipantDisconnected(v.identity,x):this.getOrCreateParticipant(v.identity,v)}const p=new Map(d.filter(v=>v.identity!==this.localParticipant.identity).map(v=>[v.identity,v.dataTracks.map(x=>qv.from(x))]));this.incomingDataTrackManager.receiveSfuPublicationUpdates(p)},this.handleActiveSpeakersUpdate=d=>{const f=[],p={};d.forEach(v=>{if(p[v.sid]=!0,v.sid===this.localParticipant.sid)this.localParticipant.audioLevel=v.level,this.localParticipant.setIsSpeaking(!0),f.push(this.localParticipant);else{const x=this.getRemoteParticipantBySid(v.sid);x&&(x.audioLevel=v.level,x.setIsSpeaking(!0),f.push(x))}}),p[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEac
663h(v=>{p[v.sid]||(v.audioLevel=0,v.setIsSpeaking(!1))}),this.activeSpeakers=f,this.emitWhenConnected(_e.ActiveSpeakersChanged,f)},this.handleSpeakersChanged=d=>{const f=new Map;this.activeSpeakers.forEach(v=>{const x=this.remoteParticipants.get(v.identity);x&&x.sid!==v.sid||f.set(v.sid,v)}),d.forEach(v=>{let x=this.getRemoteParticipantBySid(v.sid);v.sid===this.localParticipant.sid&&(x=this.localParticipant),x&&(x.audioLevel=v.level,x.setIsSpeaking(v.active),v.active?f.set(v.sid,x):f.delete(v.sid))});const p=Array.from(f.values());p.sort((v,x)=>x.audioLevel-v.audioLevel),this.activeSpeakers=p,this.emitWhenConnected(_e.ActiveSpeakersChanged,p)},this.handleStreamStateUpdate=d=>{d.streamStates.forEach(f=>{const p=this.getRemoteParticipantBySid(f.participantSid);if(!p)return;const v=p.getTrackPublicationBySid(f.trackSid);if(!v||!v.track)return;const x=Ce.streamStateFromProto(f.state);v.track.setStreamState(x),x!==v.track.streamState&&(p.emit(Ve.TrackStreamStateChanged,v,v.track.streamState),this.emitWhenConnected(_e.TrackStreamStateChanged,v,v.track.streamState,p))})},this.handleSubscriptionPermissionUpdate=d=>{const f=this.getRemoteParticipantBySid(d.participantSid);if(!f)return;const p=f.getTrackPublicationBySid(d.trackSid);p&&p.setAllowed(d.allowed)},this.handleSubscriptionError=d=>{const f=Array.from(this.remoteParticipants.values()).find(v=>v.trackPublications.has(d.trackSid));if(!f)return;const p=f.getTrackPublicationBySid(d.trackSid);p&&p.setSubscriptionError(d.err)},this.handleDataPacket=(d,f)=>{const p=this.remoteParticipants.get(d.participantIdentity);if(d.value.case==="user")this.handleUserPacket(p,d.value.value,d.kind,f);else if(d.value.case==="transcription")this.handleTranscription(p,d.value.value);else if(d.value.case==="sipDtmf")this.handleSipDtmf(p,d.value.value);else if(d.value.case==="chatMessage")this.handleChatMessage(p,d.value.value);else if(d.value.case==="metrics")this.handleMetrics(d.value.value,p);else if(d.value.case==="streamHeader"||d.value.case==="streamChunk"||d.value.case==="streamTrailer")this.handleDataStream(d,f);else if(d.value.case==="rpcRequest"){const v=d.value.value;this.rpcServerManager.handleIncomingRpcRequest(d.participantIdentity,v)}else if(d.value.case==="rpcResponse"){const v=d.value.value;switch(v.value.case){case"payload":this.rpcClientManager.handleIncomingRpcResponseSuccess(v.requestId,v.value.value);break;case"error":this.rpcClientManager.handleIncomingRpcResponseFailure(v.requestId,an.fromProto(v.value.value));break;default:this.log.warn("Unknown rpcResponse.value.case: ".concat(v.value.case),this.logContext);break}}else d.value.case==="rpcAck"&&this.rpcClientManager.handleIncomingRpcAck(d.value.value.requestId)},this.handleUserPacket=(d,f,p,v)=>{this.emit(_e.DataReceived,f.payload,d,p,f.topic,v),d==null||d.emit(Ve.DataReceived,f.payload,p,v)},this.handleSipDtmf=(d,f)=>{this.emit(_e.SipDTMFReceived,f,d),d==null||d.emit(Ve.SipDTMFReceived,f)},this.handleTranscription=(d,f)=>{const p=f.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(f.transcribedParticipantIdentity),v=p==null?void 0:p.trackPublications.get(f.trackId),x=Lse(f,this.transcriptionReceivedTimes);v==null||v.emit(Ue.TranscriptionReceived,x),p==null||p.emit(Ve.TranscriptionReceived,x,v),this.emit(_e.TranscriptionReceived,x,p,v)},this.handleChatMessage=(d,f)=>{const p=Use(f);this.emit(_e.ChatMessage,p,d)},this.handleMetrics=(d,f)=>{this.emit(_e.MetricsReceived,d,f)},this.handleDataStream=(d,f)=>{this.incomingDataStreamManager.handleDataStreamPacket(d,f)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(_e.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=d=>{this.log.warn("could not playback audio",{error:d}),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(_e.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(_e.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit
vendor: 4,259 bytes, line 663
663(_e.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>z(this,void 0,void 0,function*(){var d;((d=Or())===null||d===void 0?void 0:d.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(_e.MediaDevicesChanged)}),this.handleRoomUpdate=d=>{const f=this.roomInfo;this.roomInfo=d,f&&f.metadata!==d.metadata&&this.emitWhenConnected(_e.RoomMetadataChanged,d.metadata),(f==null?void 0:f.activeRecording)!==d.activeRecording&&this.emitWhenConnected(_e.RecordingStatusChanged,d.activeRecording)},this.handleConnectionQualityUpdate=d=>{d.updates.forEach(f=>{if(f.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(f.quality);return}const p=this.getRemoteParticipantBySid(f.participantSid);p&&p.setConnectionQuality(f.quality)})},this.getRemoteParticipantClientProtocol=d=>{var f,p;return(p=(f=this.remoteParticipants.get(d))===null||f===void 0?void 0:f.clientProtocol)!==null&&p!==void 0?p:LB},this.onLocalParticipantMetadataChanged=d=>{this.emit(_e.ParticipantMetadataChanged,d,this.localParticipant)},this.onLocalParticipantNameChanged=d=>{this.emit(_e.ParticipantNameChanged,d,this.localParticipant)},this.onLocalAttributesChanged=d=>{this.emit(_e.ParticipantAttributesChanged,d,this.localParticipant)},this.onLocalTrackMuted=d=>{this.emit(_e.TrackMuted,d,this.localParticipant)},this.onLocalTrackUnmuted=d=>{this.emit(_e.TrackUnmuted,d,this.localParticipant)},this.onTrackProcessorUpdate=d=>{var f;(f=d==null?void 0:d.onPublish)===null||f===void 0||f.call(d,this)},this.onLocalTrackPublished=d=>z(this,void 0,void 0,function*(){var f,p,v,x,b,S;(f=d.track)===null||f===void 0||f.on(Ue.TrackProcessorUpdate,this.onTrackProcessorUpdate),(p=d.track)===null||p===void 0||p.on(Ue.Restarted,this.onLocalTrackRestarted),(b=(x=(v=d.track)===null||v===void 0?void 0:v.getProcessor())===null||x===void 0?void 0:x.onPublish)===null||b===void 0||b.call(x,this),this.emit(_e.LocalTrackPublished,d,this.localParticipant),Ro(d.track)&&(yield d.track.checkForSilence())&&this.emit(_e.LocalAudioSilenceDetected,d);const N=yield(S=d.track)===null||S===void 0?void 0:S.getDeviceId(!1),j=bN(d.source);j&&N&&N!==this.localParticipant.activeDeviceMap.get(j)&&(this.localParticipant.activeDeviceMap.set(j,N),this.emit(_e.ActiveDeviceChanged,j,N))}),this.onLocalTrackUnpublished=d=>{var f,p;(f=d.track)===null||f===void 0||f.off(Ue.TrackProcessorUpdate,this.onTrackProcessorUpdate),(p=d.track)===null||p===void 0||p.off(Ue.Restarted,this.onLocalTrackRestarted),this.emit(_e.LocalTrackUnpublished,d,this.localParticipant)},this.onLocalTrackRestarted=d=>z(this,void 0,void 0,function*(){const f=yield d.getDeviceId(!1),p=bN(d.source);p&&f&&f!==this.localParticipant.activeDeviceMap.get(p)&&(this.log.debug("local track restarted, setting ".concat(p," ").concat(f," active")),this.localParticipant.activeDeviceMap.set(p,f),this.emit(_e.ActiveDeviceChanged,p,f))}),this.onLocalConnectionQualityChanged=d=>{this.emit(_e.ConnectionQualityChanged,d,this.localParticipant)},this.onMediaDevicesError=(d,f)=>{this.emit(_e.MediaDevicesError,d,f)},this.onLocalParticipantPermissionsChanged=d=>{this.emit(_e.ParticipantPermissionsChanged,d,this.localParticipant)},this.onLocalChatMessageSent=d=>{this.emit(_e.ChatMessage,d,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},Cae),t),this.log=es((i=this.options.loggerName)!==null&&i!==void 0?i:zi.Room,()=>this.logContext),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},QB),t==null?void 0:t.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},XB),t==null?void 0:t.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},jae),t==null?void 0:t.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new toe,this.outgoingDataStreamManager=new roe(this.engine,this.log),this.incomingDataTrackManager=new foe({e2eeManager:this.e2eeManager}),this.incomingDataTrackManager.on("sfuUpdateSubscription",d=>{this.engine.client.sendUpdateDataSubscription(d.sid,d.subscribe)}).on("trackPublished",d=>{var f;d.track.publisherIdentity!==this.localParticipant.identity&&(this.emit
663(_e.DataTrackPublished,d.track),(f=this.remoteParticipants.get(d.track.publisherIdentity))===null||f===void 0||f.addRemoteDataTrack(d.track))}).on("trackUnpublished",d=>{var f;d.publisherIdentity!==this.localParticipant.identity&&(this.emit(_e.DataTrackUnpublished,d.sid),(f=this.remoteParticipants.get(d.publisherIdentity))===null||f===void 0||f.removeRemoteDataTrack(d.sid))}),this.outgoingDataTrackManager=new HC({e2eeManager:this.e2eeManager}),this.outgoingDataTrackManager.on("sfuPublishRequest",d=>{this.engine.client.sendPublishDataTrackRequest(d.handle,d.name,d.usesE2ee)}).on("sfuUnpublishRequest",d=>{this.engine.client.sendUnPublishDataTrackRequest(d.handle)}).on("trackPublished",d=>{this.emit(_e.LocalDataTrackPublished,d.track)}).on("trackUnpublished",d=>{this.emit(_e.LocalDataTrackUnpublished,d.sid)}).on("packetAvailable",d=>{let f=d.handle,p=d.bytes;this.engine.sendLossyBytes(p,xt.DATA_TRACK_LOSSY,"wait").finally(()=>this.outgoingDataTrackManager.handlePacketSendComplete(f))}),this.registerRpcDataStreamHandler(),this.rpcClientManager=new goe(this.log,this.outgoingDataStreamManager,this.getRemoteParticipantClientProtocol,()=>{var d,f;return(f=(d=this.engine.latestJoinResponse)===null||d===void 0?void 0:d.serverInfo)===null||f===void 0?void 0:f.version}),this.rpcClientManager.on("sendDataPacket",d=>{let f=d.packet;var p;(p=this.engine)===null||p===void 0||p.sendDataPacket(f,xt.RELIABLE)}),this.rpcServerManager=new voe(this.log,this.outgoingDataStreamManager,this.getRemoteParticipantClientProtocol),this.rpcServerManager.on("sendDataPacket",d=>{let f=d.packet;var p;(p=this.engine)===null||p===void 0||p.sendDataPacket(f,xt.RELIABLE)}),this.disconnectLock=new ur,this.localParticipant=new koe("","",this.engine,this.options,this.outgoingDataStreamManager,this.outgoingDataTrackManager,this.rpcClientManager,this.rpcServerManager),this.setupFrameMetadata(),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.incomingDataTrackManager.updateE2eeManager((r=this.e2eeManager)!==null&&r!==void 0?r:null),this.outgoingDataTrackManager.updateE2eeManager((s=this.e2eeManager)!==null&&s!==void 0?s:null),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",bu(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",bu(this.options.audioCaptureDefaults.deviceId)),!((l=this.options.audioOutput)===null||l===void 0)&&l.deviceId&&this.switchActiveDevice("audiooutput",bu(this.options.audioOutput.deviceId)).catch(d=>this.log.warn("Could not set audio output: ".concat(d.message))),Xr()){const d=new AbortController;let f;if(bh.cleanupRegistry){const p=new WeakRef(this);f=()=>{const v=p.deref();v&&v.handleDeviceChange()},bh.cleanupRegistry.register(this,()=>{d.abort()})}else f=this.handleDeviceChange;(h=(c=navigator.mediaDevices)===null||c===void 0?void 0:c.addEventListener)===null||h===void 0||h.call(c,"devicechange",f,{signal:d.signal})}}registerTextStreamHandler(t,n){return this.incomingDataStreamManager.registerTextStreamHandler(t,n)}unregisterTextStreamHandler(t){return this.incomingDataStreamManager.unregisterTextStreamHandler(t)}registerByteStreamHandler(t,n){return this.incomingDataStreamManager.registerByteStreamHandler(t,n)}unregisterByteStreamHandler(t){return this.incomingDataStreamManager.unregisterByteStreamHandler(t)}
663registerRpcMethod(t,n){this.rpcServerManager.registerRpcMethod(t,n)}unregisterRpcMethod(t){this.rpcServerManager.unregisterRpcMethod(t)}setE2EEEnabled(t){return z(this,void 0,void 0,function*(){const n=yield this.e2eeStateMutex.lock();try{if(this.e2eeManager)this.isE2EEEnabled!==t&&(yield this.localParticipant.setE2EEEnabled(t),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(t,this.localParticipant.identity));else throw Error("e2ee not configured, please set e2ee settings within the room options")}finally{n()}})}setupE2EE(){var t,n;const i=!!this.options.encryption,r=this.options.encryption||this.options.e2ee;r&&("e2eeManager"in r?(this.e2eeManager=r.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=i):this.e2eeManager=new iae(r,i),this.e2eeManager.on(ec.ParticipantEncryptionStatusChanged,(s,l)=>{Fse(l)&&(this.isE2EEEnabled=s),this.emit(_e.ParticipantEncryptionStatusChanged,s,l)}),this.e2eeManager.on(ec.EncryptionError,(s,l)=>{const c=l?this.getParticipantByIdentity(l):void 0;this.emit(_e.EncryptionError,s,c)}),(t=this.e2eeManager)===null||t===void 0||t.setup(this),(n=this.e2eeManager)===null||n===void 0||n.setupEngine(this.engine))}setupFrameMetadata(){var t;const n=(t=this.options.frameMetadata)!==null&&t!==void 0?t:this.options.packetTrailer;this.frameMetadataManager=new aae(n),this.frameMetadataManager.setup(this)}get logContext(){var t,n,i;return{room:this.name,roomID:(t=this.roomInfo)===null||t===void 0?void 0:t.sid,participant:(n=this.localParticipant)===null||n===void 0?void 0:n.identity,participantID:(i=this.localParticipant)===null||i===void 0?void 0:i.sid}}get isRecording(){var t,n;return(n=(t=this.roomInfo)===null||t===void 0?void 0:t.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return this.state===Gt.Disconnected?_r.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?_r.resolve(this.roomInfo.sid):new _r((t,n)=>{const i=r=>{r.sid!==""&&(this.engine.off(Re.RoomUpdate,i),t(r.sid))};this.engine.on(Re.RoomUpdate,i),this.once(_e.Disconnected,()=>{this.engine.off(Re.RoomUpdate,i),n(new Vn("Room disconnected before room server id was available"))})})}get name(){var t,n;return(n=(t=this.roomInfo)===null||t===void 0?void 0:t.name)!==null&&n!==void 0?n:""}get metadata(){var t;return(t=this.roomInfo)===null||t===void 0?void 0:t.metadata}get numParticipants(){var t,n;return(n=(t=this.roomInfo)===null||t===void 0?void 0:t.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var t,n;return(n=(t=this.roomInfo)===null||t===void 0?void 0:t.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&(this.engine.isNewlyCreated||!this.engine.isClosed)||(this.engine=new Qae(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(Re.ParticipantUpdate,this.handleParticipantUpdates).on(Re.RoomUpdate,this.handleRoomUpdate).on(Re.SpeakersChanged,this.handleSpeakersChanged).on(Re.StreamStateChanged,this.handleStreamStateUpdate).on(Re.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(Re.SubscriptionError,this.handleSubscriptionError).on(Re.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(Re.MediaTrackAdded,(t,n,i)=>{this.onTrackAdded(t,n,i)}).on(Re.Disconnected,t=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,t)}).on(Re.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(Re.DataPacketReceived,this.handleDataPacket).on(Re.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.debug("Resuming signal connection"),this.setAndEmitConnectionState(Gt.SignalReconnecting)&&this.emit(_e.SignalReconnecting)}).on(Re.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.debug("Resumed signal connection"),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Gt.Connected)&&this.emit(_e.Reconnected)}).on(Re.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Gt.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(Re.Restarting,this.handleRestarting).on(Re.Restarted,this.handleRestarted).on(Re.SignalRestarted,this.handleSignalRestarted).on(Re.Offline,()=>
663{this.setAndEmitConnectionState(Gt.Reconnecting)&&this.emit(_e.Reconnecting)}).on(Re.DCBufferStatusChanged,(t,n)=>{this.emit(_e.DCBufferStatusChanged,t,n)}).on(Re.LocalTrackSubscribed,t=>{this.handleLocalTrackSubscribed(t)}).on(Re.RoomMoved,t=>{this.log.debug("room moved",t),t.room&&this.handleRoomUpdate(t.room),this.remoteParticipants.forEach((n,i)=>{this.handleParticipantDisconnected(i,n)}),this.emit(_e.Moved,t.room.name),t.participant?this.handleParticipantUpdates([t.participant,...t.otherParticipants]):this.handleParticipantUpdates(t.otherParticipants)}).on(Re.PublishDataTrackResponse,t=>{if(!t.info){this.log.warn("received PublishDataTrackResponse, but event.info was ".concat(t.info,", so skipping."));return}this.outgoingDataTrackManager.receivedSfuPublishResponse(t.info.pubHandle,{type:"ok",data:{sid:t.info.sid,pubHandle:t.info.pubHandle,name:t.info.name,usesE2ee:t.info.encryption!==xn.NONE}})}).on(Re.UnPublishDataTrackResponse,t=>{if(!t.info){this.log.warn("received UnPublishDataTrackResponse, but event.info was ".concat(t.info,", so skipping."));return}this.outgoingDataTrackManager.receivedSfuUnpublishResponse(t.info.pubHandle)}).on(Re.DataTrackSubscriberHandles,t=>{const n=new Map(Object.entries(t.subHandles).map(i=>{let r=tt(i,2),s=r[0],l=r[1];return[parseInt(s,10),l.trackSid]}));this.incomingDataTrackManager.receivedSfuSubscriberHandles(n)}).on(Re.DataTrackPacketReceived,t=>{try{this.incomingDataTrackManager.packetReceived(t)}catch(n){throw n}}).on(Re.Joined,t=>{const n=new Map(t.otherParticipants.map(i=>[i.identity,i.dataTracks.map(r=>qv.from(r))]));this.incomingDataTrackManager.receiveSfuPublicationUpdates(n)}).on(Re.TokenRefreshed,t=>{var n;(n=this.regionUrlProvider)===null||n===void 0||n.updateToken(t)}).on(Re.ServerRegionsReported,t=>{var n;(n=this.regionUrlProvider)===null||n===void 0||n.setServerReportedRegions({regionSettings:t,updatedAtInMs:Date.now(),maxAgeInMs:AN})}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}createRegionStrategy(){return{getNextUrl:t=>z(this,void 0,void 0,function*(){return this.regionUrlProvider?this.regionUrlProvider.getNextBestRegionUrl(t):null}),resetAttempts:()=>{var t;return(t=this.regionUrlProvider)===null||t===void 0?void 0:t.resetAttempts()}}}static getLocalDevices(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Li.getInstance().getDevices(t,n)}prepareConnection(t,n){return z(this,void 0,void 0,function*(){if(this.state===Gt.Disconnected){this.log.debug("prepareConnection to ".concat(t));try{if(vh(new URL(t))&&n){this.regionUrlProvider=new Ot(t,n);const i=yield this.regionUrlProvider.getNextBestRegionUrl();i&&this.state===Gt.Disconnected&&(this.regionUrl=i,yield fetch(Gm(i),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(i)))}else yield fetch(Gm(t),{method:"HEAD"})}catch(i){this.log.warn("could not prepare connection",{error:i})}}})}getParticipantByIdentity(t){return this.localParticipant.identity===t?this.localParticipant:this.remoteParticipants.get(t)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(t,n){return z(this,void 0,void 0,function*(){let i=()=>z(this,void 0,void 0,function*(){}),r;switch(t){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"fail-on-v1-path":this.engine.failNextV1Path();break;case"speaker":r=new Va({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":r=new Va({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":r=new Va({scenario:{case:"serverLeave",value:!0}});break;case"migration":r=new Va({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":i=()=>z(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new Va({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>z(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new Va({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":r=new Va({scenario:{case:"switchCandidateProtocol",value:t==="force-tls"?2:1}}),i=()=>z(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new xy({reason:ya.CLIENT_INITIATED,action:eh.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");r=new Va({scenario:{case:"subscriberBandwidth",value:Gc(n)}});break;case"leave-full-reconnect":r=new Va({scenario:{case:"leaveRequestFullReconnect",value:!0}})}r&&(yield this.engine.client.sendSimulateScenario(r),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(t){return this.localParticipant.activeDeviceMap.get(t)}switchActiveDevice(t,n){return z(this,arguments,void 0,function(i,r){var s=this;let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return(function*(){var c,h,d,f,p,v,x;let b=!0,S=!1;const N=l?{exact:r}:r;if(i==="audioinput"){S=s.localParticipant.audioTrackPublications.size===0;const j=(c=s.getActiveDevice(i))!==null&&c!==void 0?c:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=N;const T=Array.from(s.localParticipant.audioTrackPublications.values()).filter(C=>C.source===Ce.Source.Microphone);try{b=(yield Promise.all(T.map(C=>{var P;return(P=C.audioTrack)===null||P===void 0?void 0:P.setDeviceId(N)}))).every(C=>C===!0)}catch(C){throw s.options.audioCaptureDefaults.deviceId=j,C}const E=T.some(C=>{var P,A;return(A=(P=C.track)===null||P===void 0?void 0:P.isMuted)!==null&&A!==void 0?A:!1});b&&E&&(S=!0)}else if(i==="videoinput"){S=s.localParticipant.videoTrackPublications.size===0;const j=(h=s.getActiveDevice(i))!==null&&h!==void 0?h:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=N;const T=Array.from(s.localParticipant.videoTrackPublications.values()).filter(C=>C.source===Ce.Source.Camera);try{b=(yield Promise.all(T.map(C=>{var P;return(P=C.videoTrack)===null||P===void 0?void 0:P.setDeviceId(N)}))).every(C=>C===!0)}catch(C){throw s.options.videoCaptureDefaults.deviceId=j,C}const E=T.some(C=>{var P,A;return(A=(P=C.track)===null||P===void 0?void 0:P.isMuted)!==null&&A!==void 0?A:!1});b&&E&&(S=!0)}else if(i==="audiooutput"){if(S=!0,!kN()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");s.options.webAudioMix&&(r=(d=yield Li.getInstance().normalizeDeviceId("audiooutput",r))!==null&&d!==void 0?d:""),(f=(x=s.options).audioOutput)!==null&&f!==void 0||(x.audioOutput={});const j=(p=s.getActiveDevice(i))!==null&&p!==void 0?p:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=r;try{s.options.webAudioMix&&((v=s.audioContext)===null||v===void 0||v.setSinkId(r)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(T=>T.setAudioOutput({deviceId:r})))}catch(T){throw s.options.audioOutput.deviceId=j,T}}return S&&(s.localParticipant.activeDeviceMap.set(i,r),s.emit(_e.ActiveDeviceChanged,i,r)),b})()})}setupLocalParticipantEvents(){this.localParticipant.on(Ve.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(Ve.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(Ve.AttributesChanged,this.onLocalAttributesChanged).on(Ve.TrackMuted,this.onLocalTrackMuted).on(Ve.TrackUnmuted,this.onLocalTrackUnmuted).on(Ve.LocalTrackPublished,this.onLocalTrackPublished).on(Ve.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(Ve.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(Ve.MediaDevicesError,this.onMediaDevicesError).on(Ve.AudioStreamAcquired,this.startAudio).on(Ve.ChatMessage,this.onLocalChatMessageSent).on(Ve.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(t){const n=this.engine;t&&n&&!n.client.isDisconnected?n.client.sendLeave().finally(()=>n.close()):n==null||n.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(t,n,i){if(this.state===Gt.Connecting||this.state===Gt.Reconnecting){const p=()=>{this.log.debug("deferring on track for later",{mediaTrackId:t.id,mediaStreamId:n.id,tracksInStream:n.getTracks().map(x=>x.id)}),this.onTrackAdded(t,n,i),v()},v=()=>{this.off(_e.Reconnected,p),this.off(_e.Connected,p),this.off(_e.Disconnected,v)};this.once(_e.Reconnected,p),this.once(_e.Connected,p),this.once(_e.Disconnected,v);return}if(this.state===Gt.Disconnected){this.log.warn("skipping incoming track after Room disconnected");return}if(t.readyState==="ended"){this.log.debug("skipping incoming track as it already ended");return}const r=Nse(n.id),s=r[0];let l=r[1],c=t.id;if(l&&l.startsWith("TR")&&(c=l),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant");return}const h=Array.from(this.remoteParticipants.values()).find(p=>p.sid===s);if(!h){s.startsWith("PA")&&this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s));return}if(!c.startsWith("TR")){const p=this.engine.getTrackIdForReceiver(i);if(!p){this.log.error("Tried to add a track whose 'sid' could not be found for a participant, that's not present. Sid: ".concat(s));return}c=p}c.startsWith("TR")||this.log.warn("Tried to add a track whose 'sid' could not be determined for a participant, that's not present. Sid: ".concat(s,", streamId: ").concat(l,", trackId: ").concat(c),{remoteParticipantID:s,streamId:l,trackId:c});let d;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?d=this.options.adaptiveStream:d={});const f=h.addSubscribedMediaTrack(t,c,n,i,d);
663f!=null&&f.isEncrypted&&!this.e2eeManager&&this.emit(_e.EncryptionError,new Error("Encrypted ".concat(f.source," track received from participant ").concat(h.sid,", but room does not have encryption enabled!")))}handleLocalTrackSubscribed(t){const n=()=>this.localParticipant.getTrackPublications().find(h=>h.trackSid===t),i=n();if(i){this.emitLocalTrackSubscribed(i);return}this.log.debug("deferring LocalTrackSubscribed, publication not yet available",{subscribedSid:t});const r=1e4;let s;const l=h=>{h.trackSid===t&&(c(),this.emitLocalTrackSubscribed(h))},c=()=>{clearTimeout(s),this.localParticipant.off(Ve.LocalTrackPublished,l),this.off(_e.Disconnected,c)};this.localParticipant.on(Ve.LocalTrackPublished,l),this.once(_e.Disconnected,c),s=setTimeout(()=>{c();const h=n();h?this.emitLocalTrackSubscribed(h):this.log.warn("could not find local track publication for LocalTrackSubscribed event after timeout",{subscribedSid:t})},r)}emitLocalTrackSubscribed(t){this.localParticipant.emit(Ve.LocalTrackSubscribed,t),this.emitWhenConnected(_e.LocalTrackSubscribed,t,this.localParticipant)}handleDisconnect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var i,r;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.incomingDataTrackManager.reset(),this.outgoingDataTrackManager.reset(),this.state!==Gt.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();
vendor: 3,696 bytes, line 663
663try{this.remoteParticipants.forEach(s=>{s.trackPublications.forEach(l=>{s.unpublishTrack(l.trackSid)})}),this.localParticipant.trackPublications.forEach(s=>{var l,c,h;s.track&&this.localParticipant.unpublishTrack(s.track,t),t?((l=s.track)===null||l===void 0||l.detach(),(c=s.track)===null||c===void 0||c.stop()):(h=s.track)===null||h===void 0||h.stopMonitor()}),this.localParticipant.off(Ve.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(Ve.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(Ve.AttributesChanged,this.onLocalAttributesChanged).off(Ve.TrackMuted,this.onLocalTrackMuted).off(Ve.TrackUnmuted,this.onLocalTrackUnmuted).off(Ve.LocalTrackPublished,this.onLocalTrackPublished).off(Ve.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(Ve.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(Ve.MediaDevicesError,this.onMediaDevicesError).off(Ve.AudioStreamAcquired,this.startAudio).off(Ve.ChatMessage,this.onLocalChatMessageSent).off(Ve.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Xr()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(r=(i=navigator.mediaDevices)===null||i===void 0?void 0:i.removeEventListener)===null||r===void 0||r.call(i,"devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Gt.Disconnected),this.emit(_e.Disconnected,n)}}}handleParticipantDisconnected(t,n){this.remoteParticipants.delete(t),n&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(t),this.incomingDataTrackManager.handleRemoteParticipantDisconnected(t),n.trackPublications.forEach(i=>{n.unpublishTrack(i.trackSid,!0)}),this.emit(_e.ParticipantDisconnected,n),n.setDisconnected(),this.rpcClientManager.handleParticipantDisconnected(n.identity))}selectDefaultDevices(){return z(this,void 0,void 0,function*(){var t,n,i;const r=Li.getInstance().previousDevices,s=yield Li.getInstance().getDevices(void 0,!1),l=Or();if((l==null?void 0:l.name)==="Chrome"&&l.os!=="iOS")for(let h of s){const d=r.find(f=>f.deviceId===h.deviceId);d&&d.label!==""&&d.kind===h.kind&&d.label!==h.label&&this.getActiveDevice(h.kind)==="default"&&this.emit(_e.ActiveDeviceChanged,h.kind,h.deviceId)}const c=["audiooutput","audioinput","videoinput"];for(let h of c){const d=pse(h),f=this.localParticipant.getTrackPublication(d);if(f&&(!((t=f.track)===null||t===void 0)&&t.isUserProvided))continue;const p=s.filter(x=>x.kind===h),v=this.getActiveDevice(h);if(v===((n=r.filter(x=>x.kind===h)[0])===null||n===void 0?void 0:n.deviceId)&&p.length>0&&((i=p[0])===null||i===void 0?void 0:i.deviceId)!==v){yield this.switchActiveDevice(h,p[0].deviceId);continue}h==="audioinput"&&!Km()||h==="videoinput"||p.length>0&&!p.find(x=>x.deviceId===this.getActiveDevice(h))&&(h!=="audiooutput"||!Km())&&(yield this.switchActiveDevice(h,p[0].deviceId))}})}acquireAudioContext(){return z(this,void 0,void 0,function*(){var t,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(t=$B())!==null&&t!==void 0?t:void 0),this.options.webAudioMix&&this.remoteParticipants.forEac
663h(r=>r.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),br(200)])}catch(r){this.log.warn("Could not resume audio context",{error:r})}const i=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";i!==this.canPlaybackAudio&&(this.audioEnabled=i,this.emit(_e.AudioPlaybackStatusChanged,i))})}createParticipant(t,n){var i;let r;return n?r=Yv.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName},this.incomingDataTrackManager):r=new Yv(this.engine.client,"",t,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&r.setAudioContext(this.audioContext),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&r.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message))),r}getOrCreateParticipant(t,n){if(this.remoteParticipants.has(t)){const r=this.remoteParticipants.get(t);return n&&r.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),r}const i=this.createParticipant(t,n);return this.remoteParticipants.set(t,i),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(_e.ParticipantConnected,i),i.on(Ve.TrackPublished,r=>{this.emitWhenConnected(_e.TrackPublished,r,i)}).on(Ve.TrackSubscribed,(r,s)=>{r.kind===Ce.Kind.Audio?(r.on(Ue.AudioPlaybackStarted,this.handleAudioPlaybackStarted),r.on(Ue.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):r.kind===Ce.Kind.Video&&(r.on(Ue.VideoPlaybackFailed,this.handleVideoPlaybackFailed),r.on(Ue.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emitWhenConnected(_e.TrackSubscribed,r,s,i)}).on(Ve.TrackUnpublished,r=>{this.emit(_e.TrackUnpublished,r,i)}).on(Ve.TrackUnsubscribed,(r,s)=>{this.emit(_e.TrackUnsubscribed,r,s,i)}).on(Ve.TrackMuted,r=>{this.emitWhenConnected(_e.TrackMuted,r,i)}).on(Ve.TrackUnmuted,r=>{this.emitWhenConnected(_e.TrackUnmuted,r,i)}).on(Ve.ParticipantMetadataChanged,r=>{this.emitWhenConnected(_e.ParticipantMetadataChanged,r,i)}).on(Ve.ParticipantNameChanged,r=>{this.emitWhenConnected(_e.ParticipantNameChanged,r,i)}).on(Ve.AttributesChanged,r=>{this.emitWhenConnected(_e.ParticipantAttributesChanged,r,i)}).on(Ve.ConnectionQualityChanged,r=>{this.emitWhenConnected(_e.ConnectionQualityChanged,r,i)}).on(Ve.ParticipantPermissionsChanged,r=>{this.emitWhenConnected(_e.ParticipantPermissionsChanged,r,i)}).on(Ve.TrackSubscriptionStatusChanged,(r,s)=>{this.emitWhenConnected(_e.TrackSubscriptionStatusChanged,r,s,i)}).on(Ve.TrackSubscriptionFailed,(r,s)=>{this.emit(_e.TrackSubscriptionFailed,r,i,s)}).on(Ve.TrackSubscriptionPermissionChanged,(r,s)=>{this.emitWhenConnected(_e.TrackSubscriptionPermissionChanged,r,s,i)}).on(Ve.Active,()=>{this.emitWhenConnected(_e.ParticipantActive,i),i.kind===qm.AGENT&&this.localParticipant.setActiveAgent(i)}),n&&i.updateInfo(n),i}sendSyncState(){const t=Array.from(this.remoteParticipants.values()).reduce((r,s)=>(r.push(...s.getTrackPublications()),r),[]),n=this.localParticipant.getTrackPublications(),i=this.outgoingDataTrackManager.queryPublished();this.engine.sendSyncState(t,n,i)}updateSubscriptions(){for(const t of this.remoteParticipants.values())for(const n of t.videoTrackPublications.values())n.isSubscribed&&Bse(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(t){const n=this.sidToIdentity.get(t);if(n)return this.remoteParticipants.get(n)}registerRpcDataStreamHandler(){this.incomingDataStreamManager.registerTextStreamHandler(h8,(t,n)=>z(this,[t,n],void 0,function(i,r){var s=this;let l=r.identity;return(function*(){var c;const h=(c=i.info.attributes)!==null&&c!==void 0?c:{};yield s.rpcServerManager.handleIncomingDataStream(i,l,h)})()})),this.incomingDataStreamManager.registerTextStreamHandler(f8,(t,n)=>z(this,[t,n],void 0,function(i,r){var s=this;let l=r.identity;return(function*(){var c;const h=(c=i.info.attributes)!==null&&c!==void 0?c:{};yield s.rpcClientManager.handleIncomingDataStream(i,l,h)})()}))}registerConnectionReconcile(){this.clearConnectionReconcile();let t=0;this.connectionReconcileInterval=yi.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(t++,this.log.warn("detected connection state mismatch",{numFailures:t,engine:this.engine?{closed:this.engine.isClosed,transportsConnectedOrConnecting:this.engine.verifyTransport()}:void 0}),t>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,ya.STATE_MISMATCH))):t=0},Coe)}clearConnectionReconcile(){this.connectionReconcileInterval&&yi.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(t){return t===this.state?!1:(this.log.info("connection state changed: ".concat(this.state," -> ").concat(t)),this.state=t,this.incomingDataStreamManager.setConnected(t===Gt.Connected),this.emit
vendor: 11,520 bytes, line 663
663(_e.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(t=>{let n=tt(t,2),i=n[0],r=n[1];this.emit(i,...r)}),this.bufferedEvents=[]}emitWhenConnected(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(this.state===Gt.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([t,i]);else if(this.state===Gt.Connected)return this.emit(t,...i);return!1}simulateParticipants(t){return z(this,void 0,void 0,function*(){var n,i,r,s;const l=Object.assign({audio:!0,video:!0,useRealTracks:!1},t.publish),c=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},t.participants);if(this.handleDisconnect(),this.roomInfo=new hy({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:Un.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new Tu({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(_e.SignalConnected),this.emit(_e.Connected),this.setAndEmitConnectionState(Gt.Connected),l.video){const h=new PN(Ce.Kind.Video,new Hd({source:vi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:la.AUDIO,name:"video-dummy"}),new Kv(l.useRealTracks&&(!((n=window.navigator.mediaDevices)===null||n===void 0)&&n.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:hR(160*((i=c.aspectRatios[0])!==null&&i!==void 0?i:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(h),this.localParticipant.emit(Ve.LocalTrackPublished,h)}if(l.audio){const h=new PN(Ce.Kind.Audio,new Hd({source:vi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:la.AUDIO}),new Wv(l.useRealTracks&&(!((r=navigator.mediaDevices)===null||r===void 0)&&r.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:yS(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(h),this.localParticipant.emit(Ve.LocalTrackPublished,h)}for(let h=0;h<c.count-1;h+=1){let d=new Tu({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(h),state:Zd.ACTIVE,tracks:[],joinedAt:Un.parse(Date.now())});const f=this.getOrCreateParticipant(d.identity,d);if(c.video){const p=hR(160*((s=c.aspectRatios[h%c.aspectRatios.length])!==null&&s!==void 0?s:1),160,!1,!0),v=new Hd({source:vi.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:la.AUDIO});f.addSubscribedMediaTrack(p,v.sid,new MediaStream([p]),new RTCRtpReceiver),d.tracks=[...d.tracks,v]}if(c.audio){const p=yS(),v=new Hd({source:vi.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:la.AUDIO});f.addSubscribedMediaTrack(p,v.sid,new MediaStream([p]),new RTCRtpReceiver),d.tracks=[...d.tracks,v]}f.updateInfo(d)}})}emit(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(t!==_e.ActiveSpeakersChanged&&t!==_e.TranscriptionReceived){const s=g8(i).filter(l=>l!==void 0);(t===_e.TrackSubscribed||t===_e.TrackUnsubscribed)&&this.log.trace("subscribe trace: ".concat(t),{event:t,args:s}),this.log.debug("room event ".concat(t),{event:t,args:s})}return super.emit(t,...i)}}bh.cleanupRegistry=typeof FinalizationRegistry<"u"&&typeof WeakRef<"u"&&new FinalizationRegistry(e=>{e()});function g8(e){return e.map(t=>{if(t)return Array.isArray(t)?g8(t):typeof t=="object"?"logContext"in t?t.logContext:void 0:t})}var oa;(function(e){e[e.IDLE=0]="IDLE",e[e.RUNNING=1]="RUNNING",e[e.SKIPPED=2]="SKIPPED",e[e.SUCCESS=3]="SUCCESS",e[e.FAILED=4]="FAILED"})(oa||(oa={}));class vc extends ts.EventEmitter{constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=oa.IDLE,this.logs=[],this.options={},this.url=t,this.token=n,this.name=this.constructor.name,this.room=new bh(i.roomOptions),this.connectOptions=i.connectOptions,this.options=i}run(t){return z(this,void 0,void 0,function*(){if(this.status!==oa.IDLE)throw Error("check is running already");this.setStatus(oa.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==oa.SKIPPED&&this.setStatus(this.isSuccess()?oa.SUCCESS:oa.FAILED),t&&t(),this.getInfo()})}isSuccess(){return!this.logs.some(t=>t.level==="error")}connect(t){return z(this,void 0,void 0,function*(){return this.room.state===Gt.Connected?this.room:(t||(t=this.url),yield this.room.connect(t,this.token,this.connectOptions),this.room)})}disconnect(){return z(this,void 0,void 0,function*(){this.room&&this.room.state!==Gt.Disconnected&&(yield this.room.disconnect(),yield new Promise(t=>setTimeout(t,500)))})}skip(){this.setStatus(oa.SKIPPED)}switchProtocol(t){return z(this,void 0,void 0,function*(){let n=!1,i=!1;if(this.room.on(_e.Reconnecting,()=>{n=!0}),this.room.once(_e.Reconnected,()=>{i=!0}),this.room.simulateScenario("force-".concat(t)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const r=Date.now()+1e4;for(;Date.now()<r;){if(i)return;yield br(100)}throw new Error("Could not reconnect using ".concat(t," protocol after 10 seconds"))})}appendMessage(t){this.logs.push({level:"info",message:t}),this.emit("update",this.getInfo())}appendWarning(t){this.logs.push({level:"warning",message:t}),this.emit("update",this.getInfo())}appendError(t){this.logs.push({level:"error",message:t}),this.emit("update",this.getInfo())}setStatus(t){this.status=t,this.emit("update",this.getInfo())}get engine(){var t;return(t=this.room)===null||t===void 0?void 0:t.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class Toe extends vc{get description(){return"Cloud regions"}perform(){return z(this,void 0,void 0,function*(){const t=new Ot(this.url,this.token);if(!t.isCloud()){this.skip();return}const n=[],i=new Set;for(let s=0;s<3;s++){const l=yield t.getNextBestRegionUrl();if(!l)break;if(i.has(l))continue;i.add(l);const c=yield this.checkCloudRegion(l);this.appendMessage("".concat(c.region," RTT: ").concat(c.rtt,"ms, duration: ").concat(c.duration,"ms")),n.push(c)}n.sort((s,l)=>(s.duration-l.duration)*.5+(s.rtt-l.rtt)*.5);const r=n[0];this.bestStats=r,this.appendMessage("best Cloud region: ".concat(r.region))})}getInfo(){const t=super.getInfo();return t.data=this.bestStats,t}checkCloudRegion(t){return z(this,void 0,void 0,function*(){var n,i;yield this.connect(t),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const r=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!r)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),l=1e3,h=1e6/l,d="A".repeat(l),f=Date.now();for(let b=0;b<h;b++)yield s.write(d);yield s.close();const p=Date.now(),v=yield(i=this.room.engine.pcManager)===null||i===void 0?void 0:i.publisher.getStats(),x={region:r,rtt:1e4,duration:p-f};return v==null||v.forEach(b=>{b.type==="candidate-pair"&&b.nominated&&(x.rtt=b.currentRoundTripTime*1e3)}),yield this.disconnect(),x})}}const PS=1e4;class Eoe extends vc{get description(){return"Connection via UDP vs TCP"}perform(){return z(this,void 0,void 0,function*(){const t=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=t,t.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(t.packetsLost-n.packetsLost)/t.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const i=this.bestStats;this.appendMessage("upstream bitrate: ".concat((i.bitrateTotal/i.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((i.rttTotal/i.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((i.jitterTotal/i.count*1e3).toFixed(2)," ms")),i.packetsLost>0&&this.appendWarning("packets lost: ".concat((i.packetsLost/i.packetsSent*100).toFixed(2),"%")),i.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((i.qualityLimitationDurations.bandwidth/(PS/1e3)*100).toFixed(2),"%")),i.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((i.qualityLimitationDurations.cpu/(PS/1e3)*100).toFixed(2),"%"))})}getInfo(){const t=super.getInfo();return t.data=this.bestStats,t}checkConnectionProtocol(t){return z(this,void 0,void 0,function*(){yield this.connect(),t==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const i=n.getContext("2d");if(!i)throw new Error("Could not get canvas context");let r=0;const s=()=>{r=(r+1)%360,i.fillStyle="hsl(".concat(r,", 100%, 50%)"),i.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const c=n.captureStream(30).getVideoTracks()[0],d=(yield this.room.localParticipant.publishTrack(c,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,f={protocol:t,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},p=setInterval(()=>z(this,void 0,void 0,function*(){const v=yield d.getRTCStatsReport();v==null||v.forEach(x=>{x.type==="outbound-rtp"?(f.packetsSent=x.packetsSent,f.qualityLimitationDurations=x.qualityLimitationDurations,f.bitrateTotal+=x.targetBitrate,f.count++):x.type==="remote-inbound-rtp"&&(f.packetsLost=x.packetsLost,f.rttTotal+=x.roundTripTime,f.jitterTotal+=x.jitter)})}),1e3);return yield new Promise(v=>setTimeout(v,PS)),clearInterval(p),c.stop(),n.remove(),yield this.disconnect(),f})}}class Aoe extends vc{get description(){return"Can publish audio"}perform(){return z(this,void 0,void 0,function*(){var t;const n=yield this.connect(),i=yield boe();if(yield FB(i,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(i),yield new Promise(c=>setTimeout(c,3e3));const s=yield(t=i.sender)===null||t===void 0?void 0:t.getStats();if(!s)throw new Error("Could not get RTCStats");let l=0;if(s.forEach(c=>{c.type==="outbound-rtp"&&(c.kind==="audio"||!c.kind&&c.mediaType==="audio")&&(l=c.packetsSent)}),l===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(l," audio packets"))})}}class Poe extends vc{get description(){return"Can publish video"}perform(){return z(this,void 0,void 0,function*(){var t;const n=yield this.connect(),i=yield yoe();yield this.checkForVideo(i.mediaStreamTrack),n.localParticipant.publishTrack(i),yield new Promise(l=>setTimeout(l,5e3));const r=yield(t=i.sender)===null||t===void 0?void 0:t.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(l=>{l.type==="outbound-rtp"&&(l.kind==="video"||!l.kind&&l.mediaType==="video")&&(s+=l.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(t){return z(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(t.clone());const i=document.createElement("video");
663i.srcObject=n,i.muted=!0,i.autoplay=!0,i.playsInline=!0,i.setAttribute("playsinline","true"),document.body.appendChild(i),yield new Promise(r=>{i.onplay=()=>{setTimeout(()=>{var s,l,c,h;const d=document.createElement("canvas"),f=t.getSettings(),p=(l=(s=f.width)!==null&&s!==void 0?s:i.videoWidth)!==null&&l!==void 0?l:1280,v=(h=(c=f.height)!==null&&c!==void 0?c:i.videoHeight)!==null&&h!==void 0?h:720;d.width=p,d.height=v;const x=d.getContext("2d");x.drawImage(i,0,0);const S=x.getImageData(0,0,d.width,d.height).data;let N=!0;for(let j=0;j<S.length;j+=4)if(S[j]!==0||S[j+1]!==0||S[j+2]!==0){N=!1;break}N?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),r()},1e3)},i.play()}),n.getTracks().forEach(r=>r.stop()),i.remove()})}}class _oe extends vc{get description(){return"Resuming connection after interruption"}perform(){return z(this,void 0,void 0,function*(){var t;const n=yield this.connect();let i=!1,r=!1,s;const l=new Promise(d=>{setTimeout(d,5e3),s=d}),c=()=>{i=!0};n.on(_e.SignalReconnecting,c).on(_e.Reconnecting,c).on(_e.Reconnected,()=>{r=!0,s(!0)}),(t=n.engine.client.ws)===null||t===void 0||t.close();const h=n.engine.client.onClose;if(h&&h(""),yield l,i){if(!r||n.state!==Gt.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class Moe extends vc{get description(){return"Can connect via TURN"}perform(){return z(this,void 0,void 0,function*(){var t,n,i;vh(new URL(this.url))&&(this.appendMessage("Using region specific url"),this.url=(t=yield new Ot(this.url,this.token).getNextBestRegionUrl())!==null&&t!==void 0?t:this.url);const r=new FC,s=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0);let l=!1,c=!1,h=!1;for(let d of s.iceServers)for(let f of d.urls)f.startsWith("turn:")?(c=!0,h=!0):f.startsWith("turns:")&&(c=!0,h=!0,l=!0),f.startsWith("stun:")&&(h=!0);h?c&&!l&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield r.close(),!((i=(n=this.connectOptions)===null||n===void 0?void 0:n.rtcConfig)===null||i===void 0)&&i.iceServers||c?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(d=>setTimeout(d,0)))})}}class Roe extends vc{get description(){return"Establishing WebRTC connection"}perform(){return z(this,void 0,void 0,function*(){let t=!1,n=!1;this.room.on(_e.SignalConnected,()=>{var i;const r=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(s,l)=>{if(s.candidate){const c=new RTCIceCandidate(s);let h="".concat(c.protocol," ").concat(c.address,":").concat(c.port," ").concat(c.type);c.address&&(Ooe(c.address)?h+=" (private)":c.protocol==="tcp"&&c.tcpType==="passive"?(t=!0,h+=" (passive)"):c.protocol==="udp"&&(n=!0)),this.appendMessage(h)}r&&r(s,l)},!((i=this.room.engine.pcManager)===null||i===void 0)&&i.subscriber&&(this.room.engine.pcManager.subscriber.onIceCandidateError=s=>{s instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(s.errorCode," ").concat(s.errorText," ").concat(s.url))})});try{yield this.connect(),vt.info("now the room is connected")}catch(i){throw this.appendWarning("ports need to be open on firewall in order to connect."),i}t||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function Ooe(e){const t=e.split(".");if(t.length===4){if(t[0]==="10")return!0;if(t[0]==="192"&&t[1]==="168")return!0;if(t[0]==="172"){const n=parseInt(t[1],10);if(n>=16&&n<=31)return!0}}return!1}class Ioe extends vc{get description(){return"Connecting to signal connection via WebSocket"}perform(){return z(this,void 0,void 0,function*(){var t,n,i;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let r=new FC,s;try{s=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}catch(l){if(vh(new URL(this.url))){this.appendMessage("Initial connection failed with error ".concat(l.message,". Retrying with region fallback"));const h=yield new Ot(this.url,this.token).getNextBestRegionUrl();h&&(s=yield r.join(h,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0),this.appendMessage("Fallback to region worked. To avoid initial connections failing, ensure you're calling room.prepareConnection() ahead of time"))}}s?(this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((t=s.serverInfo)===null||t===void 0?void 0:t.edition)===UU.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((i=s.serverInfo)===null||i===void 0?void 0:i.region))):this.appendError("Websocket connection could not be established"),yield r.close()})}}class iTe extends ts.EventEmitter{constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=t,this.token=n,this.options=i}getNextCheckId(){const t=this.checkResults.size;return this.checkResults.set(t,{logs:[],status:oa.IDLE,name:"",description:""}),t}
663updateCheck(t,n){this.checkResults.set(t,n),this.emit("checkUpdate",t,n)}isSuccess(){return Array.from(this.checkResults.values()).every(t=>t.status!==oa.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(t){return z(this,void 0,void 0,function*(){const n=this.getNextCheckId(),i=new t(this.url,this.token,this.options),r=l=>{this.updateCheck(n,l)};i.on("update",r);const s=yield i.run();return i.off("update",r),s})}checkWebsocket(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(Ioe)})}checkWebRTC(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(Roe)})}checkTURN(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(Moe)})}checkReconnect(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(_oe)})}checkPublishAudio(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(Aoe)})}checkPublishVideo(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(Poe)})}checkConnectionProtocol(){return z(this,void 0,void 0,function*(){const t=yield this.createAndRunCheck(Eoe);if(t.data&&"protocol"in t.data){const n=t.data;this.options.protocol=n.protocol}return t})}checkCloudRegion(){return z(this,void 0,void 0,function*(){return this.createAndRunCheck(Toe)})}}new TextEncoder;new TextDecoder;class Dr extends Error{constructor(t,n){var i;super(t,n),At(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(i=Error.captureStackTrace)===null||i===void 0||i.call(Error,this,this.constructor)}}At(Dr,"code","ERR_JOSE_GENERIC");class Doe extends Dr{constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(t,{cause:{claim:i,reason:r,payload:n}}),At(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),At(this,"claim",void 0),At(this,"reason",void 0),At(this,"payload",void 0),this.claim=i,this.reason=r,this.payload=n}}At(Doe,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Loe extends Dr{constructor(t,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(t,{cause:{claim:i,reason:r,payload:n}}),At(this,"code","ERR_JWT_EXPIRED"),At(this,"claim",void 0),At(this,"reason",void 0),At(this,"payload",void 0),this.claim=i,this.reason=r,this.payload=n}}
663At(Loe,"code","ERR_JWT_EXPIRED");class Uoe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}At(Uoe,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Boe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JOSE_NOT_SUPPORTED")}}At(Boe,"code","ERR_JOSE_NOT_SUPPORTED");class Foe extends Dr{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"decryption operation failed",n=arguments.length>1?arguments[1]:void 0;super(t,n),At(this,"code","ERR_JWE_DECRYPTION_FAILED")}}At(Foe,"code","ERR_JWE_DECRYPTION_FAILED");class $oe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JWE_INVALID")}}At($oe,"code","ERR_JWE_INVALID");class Voe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JWS_INVALID")}}At(Voe,"code","ERR_JWS_INVALID");class zoe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JWT_INVALID")}}At(zoe,"code","ERR_JWT_INVALID");class qoe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JWK_INVALID")}}At(qoe,"code","ERR_JWK_INVALID");class Woe extends Dr{constructor(){super(...arguments),At(this,"code","ERR_JWKS_INVALID")}}At(Woe,"code","ERR_JWKS_INVALID");class Hoe extends Dr{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"no applicable key found in the JSON Web Key Set",n=arguments.length>1?arguments[1]:void 0;super(t,n),At(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}At(Hoe,"code","ERR_JWKS_NO_MATCHING_KEY");class Koe extends Dr{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"multiple matching keys found in the JSON Web Key Set",n=arguments.length>1?arguments[1]:void 0;super(t,n),At(this,Symbol.asyncIterator,void 0),At(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}
663At(Koe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Goe extends Dr{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"request timed out",n=arguments.length>1?arguments[1]:void 0;super(t,n),At(this,"code","ERR_JWKS_TIMEOUT")}}At(Goe,"code","ERR_JWKS_TIMEOUT");class Yoe extends Dr{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"signature verification failed",n=arguments.length>1?arguments[1]:void 0;super(t,n),At(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}At(Yoe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function Qoe(e){const t=(e||"").trim().match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(!t)return null;let n=Number(t[4])%12;t[6].toUpperCase()==="PM"&&(n+=12);const i=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]),n,Number(t[5]));return Number.isNaN(i.getTime())?null:i}function Xoe(e,t=new Date){const n=Qoe(e);return n!==null&&n.getTime()>t.getTime()}function ql(e,t){return e.filter(n=>!n.isFilled&&Xoe(n.dateTime,t))}function GC({clientId:e,clientName:t,companyName:n,greetingPrompt:i,assignedWorkflowPrompt:r,slots:s,onBookSlot:l,onAddLead:c,onUpdateLead:h,minimal:d=!1,kbItems:f=[],selectedVoiceId:p="sarah",onCollectedDataChange:v,onCallEnded:x,agentName:b="Sarah",voiceAgentId:S,language:N}){const[j,T]=w.useState(!1),[E,C]=w.useState(!1),[P,A]=w.useState([]),[M,R]=w.useState(""),[B,U]=w.useState(!1),[O,F]=w.useState(!1),[ne,re]=w.useState(!1),[Q,W]=w.useState({name:"",email:"",phone:"",purpose:"",bookedSlot:""}),q=w.useRef(Q);w.useEffect(()=>{q.current=Q},[Q]);const $=w.useRef(!1),ge=w.useRef(v);w.useEffect(()=>{ge.current=v}),w.useEffect(()=>{ge.current&&ge.current(Q,j)},[Q,j]);const[ue,L]=w.useState("greet"),J=w.useRef(null),ye=w.useRef(null),Pe=typeof window<"u"&&window.self!==window.top,Oe=w.useRef(null),je=w.useRef(null),Ke=w.useRef(null),ve=w.useRef(null),[le,Be]=w.useState(!0),De=w.useRef(null),be=w.useRef(null),nt=w.useRef([]),ze=w.useRef(null),Le=w.useRef(null),ht=w.useRef(null),yt=w.useRef(null),on=w.useRef(null),bt=w.useRef(null),Vt=w.useRef(null),tn=w.useRef(null),Qt=w.useRef([]),Cn=w.useRef(0),pt=w.useRef(null),kn=w.useRef(null),Lt=w.useRef(null),On=w.useRef([]),zt=w.useRef({ctx:null,micAnalyser:null,agentAnalyser:null,userSpeaking:!1,userSpeechEndAt:null,agentAudioStarted:!1,rafId:null}),[si,qn]=w.useState(null),qt=w.useRef({ctx:null,intervalId:null}),ai=H=>{try{const se=window.AudioContext||window.webkitAudioContext;if(!se)return;const G=new se;if(H==="connect"){const V=(ie,Z,Te)=>{const we=G.createOscillator(),X=G.createGain();we.type="sine",we.frequency.setValueAtTime(ie,G.currentTime+Z),X.gain.setValueAtTime(.04,G.currentTime+Z),X.gain.exponentialRampToValueAtTime(.001,G.currentTime+Z+Te),we.connect(X),X.connect(G.destination),we.start(G.currentTime+Z),we.stop(G.currentTime+Z+Te)};V(520,0,.15),V(660,.12,.15),V(880,.24,.2)}else if(H==="speak"){const V=G.createOscillator(),ie=G.createGain();V.type="triangle",V.frequency.setValueAtTime(680,G.currentTime),ie.gain.setValueAtTime(.03,G.currentTime),ie.gain.exponentialRampToValueAtTime(.001,G.currentTime+.15),V.connect(ie),ie.connect(G.destination),V.start(),V.stop(G.currentTime+.15)}else if(H==="listen"){const V=G.createOscillator(),ie=G.createGain();V.type="sine",V.frequency.setValueAtTime(750,G.currentTime),ie.gain.setValueAtTime(.03,G.currentTime),ie.gain.exponentialRampToValueAtTime(.001,G.currentTime+.08),V.connect(ie),ie.connect(G.destination),V.start(),V.stop(G.currentTime+.08),setTimeout(()=>{const Z=G.createOscillator(),Te=G.createGain();Z.type="sine",Z.frequency.setValueAtTime(850,G.currentTime),Te.gain.setValueAtTime(.03,G.currentTime),Te.gain.exponentialRampToValueAtTime(.001,G.currentTime+.08),Z.connect(Te),Te.connect(G.destination),Z.start(),Z.stop(G.currentTime+.08)},100)}else if(H==="disconnect"){const V=G.createOscillator(),ie=G.createGain();V.type="sawtooth",V.frequency.setValueAtTime(400,G.currentTime),V.frequency.linearRampToValueAtTime(150,G.currentTime+.35),ie.gain.setValueAtTime(.03,G.currentTime),ie.gain.exponentialRampToValueAtTime(.001,G.currentTime+.35),V.connect(ie),ie.connect(G.destination),V.start(),V.stop(G.currentTime+.35)}}catch(se){console.warn("Audio synthesis not fully initialized or allowed by client policies:",se)}},Zn=()=>
663{if(qt.current.intervalId===null)try{const H=window.AudioContext||window.webkitAudioContext;if(!H)return;const se=qt.current.ctx&&qt.current.ctx.state!=="closed"?qt.current.ctx:new H;se.state==="suspended"&&se.resume(),qt.current.ctx=se;const G=()=>{const V=se.currentTime,ie=[[660,0,.18],[990,.16,.22]];for(const[Z,Te,we]of ie){const X=se.createOscillator(),Ee=se.createGain();X.type="sine",X.frequency.setValueAtTime(Z,V+Te),Ee.gain.setValueAtTime(1e-4,V+Te),Ee.gain.exponentialRampToValueAtTime(.13,V+Te+.03),Ee.gain.exponentialRampToValueAtTime(1e-4,V+Te+we),X.connect(Ee),Ee.connect(se.destination),X.start(V+Te),X.stop(V+Te+we+.02)}};G(),qt.current.intervalId=window.setInterval(G,2e3)}catch(H){console.warn("[ringback] failed to start:",H)}},ct=()=>{qt.current.intervalId!==null&&(clearInterval(qt.current.intervalId),qt.current.intervalId=null);const H=qt.current.ctx;if(qt.current.ctx=null,H)try{H.close()}catch{}},ln=w.useRef(j),Ut=w.useRef(E),Wn=w.useRef(B);w.useEffect(()=>{ln.current=j},[j]),w.useEffect(()=>{Ut.current=E},[E]),w.useEffect(()=>{Wn.current=B},[B]),w.useEffect(()=>{if(typeof window<"u"){if(je.current=window.speechSynthesis,je.current)try{je.current.getVoices(),je.current.onvoiceschanged=()=>{je.current&&je.current.getVoices()}}catch(se){console.warn("Voices caching pre-activation failed:",se)}const H=window.SpeechRecognition||window.webkitSpeechRecognition;if(H){const se=new H;se.continuous=!1,se.interimResults=!1,se.lang="en-US",se.onstart=()=>{F(!0)},se.onresult=G=>{const V=G.results[0][0].transcript;Fe(V)},se.onerror=G=>{console.error("Speech recognition error:",G),F(!1),G.error==="not-allowed"&&console.warn("Microphone permission denied.")},se.onend=()=>{if(F(!1),ln.current&&!Ut.current&&!Wn.current)try{se.start()}catch{}},Oe.current=se,re(!0)}}return()=>{li(),je.current&&je.current.cancel(),Oe.current&&Oe.current.abort(),pt.current&&clearTimeout(pt.current)}},[]),w.useEffect(()=>{const H=ye.current;H&&H.scrollTo({top:H.scrollHeight,behavior:"smooth"})},[P,B]);const _i=H=>{const se=new ArrayBuffer(H.length*2),G=new DataView(se);let V=0;for(let we=0;we<H.length;we++,V+=2){let X=Math.max(-1,Math.min(1,H[we]));G.setInt16(V,X<0?X*32768:X*32767,!0)}let ie="";const Z=new Uint8Array(se),Te=Z.byteLength;for(let we=0;we<Te;we++)ie+=String.fromCharCode(Z[we]);return btoa(ie)},nn=H=>{try{if(!bt.current){const qe=window.AudioContext||window.webkitAudioContext;bt.current=new qe({sampleRate:24e3})}const se=bt.current;se.state==="paused"&&se.resume();const G=atob(H),V=G.length,ie=new Uint8Array(V);for(let qe=0;qe<V;qe++)ie[qe]=G.charCodeAt(qe);const Z=new Int16Array(ie.buffer),Te=new Float32Array(Z.length);for(let qe=0;qe<Z.length;qe++)Te[qe]=Z[qe]/32768;const we=se.createBuffer(1,Te.length,24e3);we.getChannelData(0).set(Te);const X=se.createBufferSource();if(X.buffer=we,X.connect(se.destination),be.current)try{X.connect(be.current)}catch(qe){console.warn("Failed to connect agent output to recording node:",qe)}const Ee=se.currentTime;Cn.current<Ee&&(Cn.current=Ee),X.start(Cn.current),Cn.current+=we.duration,Qt.current.push(X),X.onended=()=>{const qe=Qt.current.indexOf(X);qe>-1&&Qt.current.splice(qe,1),Qt.current.length===0&&(pt.current&&clearTimeout(pt.current),pt.current=setTimeout(()=>{Qt.current.length===0&&U(!1)},400))}}catch(se){console.error("Failed to play live audio chunk:",se)}},Bt=()=>{pt.current&&(clearTimeout(pt.current),pt.current=null),fr(),Qt.current.forEach(H=>{try{H.stop()}catch{}}),Qt.current=[],Cn.current=0},Dt=.015,K=250,Ze=()=>{const H=zt.current;if(H.ctx&&H.ctx.state!=="closed")return H.ctx.state==="suspended"&&H.ctx.resume(),H.ctx;try{const se=window.AudioContext||window.webkitAudioContext,G=new se;return G.state==="suspended"&&G.resume(),zt.current.ctx=G,G}catch(se){return console.warn("[latency] failed to create probe AudioContext:",se),null}},Ft=H=>{const se=Ze();if(se)try{const G=se.createMediaStreamSource(H),V=se.createAnalyser();V.fftSize=512,G.connect(V),zt.current.micAnalyser=V}catch(G){console.warn("[latency] failed to tap mic stream:",G)}},jt=H=>{const se=Ze();if(se)try{const G=new MediaStream([H]),V=se.createMediaStreamSource(G),ie=se.createAnalyser();ie.fftSize=512,V.connect(ie),zt.current.agentAnalyser=ie}catch(G){console.warn("[latency] failed to tap agent track:",G)}},oi=H=>{if(!H)return 0;const se=new Uint8Array(H.fftSize);H.getByteTimeDomainData(se);let G=0;for(let V=0;V<se.length;V++){const ie=(se[V]-128)/128;G+=ie*ie}return Math.sqrt(G/se.length)},Gi=()=>{const H=zt.current;if(H.rafId!==null)return;const se=()=>{const G=zt.current,V=oi(G.micAnalyser),ie=oi(G.agentAnalyser),Z=performance.now();if(V>Dt?(G.userSpeaking||(G.userSpeaking=!0),G.userSpeechEndAt=null):G.userSpeaking&&(G.userSpeechEndAt===null&&(G.userSpeechEndAt=Z),Z-(G.userSpeechEndAt??Z)>=K&&(G.userSpeaking=!1)),G.userSpeechEndAt&&ie>Dt){const Te=Math.round(Z-G.userSpeechEndAt);qn(Te),console.log(`[latency] perceived reply = ${Te} ms (user-speech-end → agent-audio-start)`),G.userSpeechEndAt=null}!G.agentAudioStarted&&ie>Dt&&(G.agentAudioStarted=!0,qt.current.intervalId!==null&&(console.log("[ringback] agent audio detected; stopping connecting chime"),ct())),G.rafId=requestAnimationFrame(se)};H.rafId=requestAnimationFrame(se)},fr=()=>{var se,G;const H=zt.current;H.rafId!==null&&(cancelAnimationFrame(H.rafId),H.rafId=null),H.userSpeaking=!1,H.userSpeechEndAt=null,H.agentAudioStarted=!1;try{(se=H.micAnalyser)==null||se.disconnect()}catch{}try{(G=H.agentAnalyser)==null||G.disconnect()}catch{}H.micAnalyser=null,H.agentAnalyser=null},Yi=H=>{if(H.type==="audio"&&H.audio)pt.current&&(clearTimeout(pt.current),pt.current=null),U(!0),nn(H.audio);else if(H.type==="interrupted")console.log("User interrupted agent speaking"),Bt(),U(!1);else if(H.type==="product_link")A(se=>[...se,{sender:"agent",text:H.name?`Product: ${H.name}${H.sku?` (SKU ${H.sku})`:""}`:"Product",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),link:{sku:H.sku||"",name:H.name||"",url:H.url||""}}]);else if(H.type==="extracted"&&H.extracted){console.log("Received real-time extraction update:",H.extracted);const se=q.current,G={name:H.extracted.name||se.name,phone:H.extracted.phone||se.phone,email:H.extracted.email||se.email,purpose:H.extracted.purpose||se.purpose,bookedSlot:H.extracted.bookedSlot||se.bookedSlot};if(W(G),G.bookedSlot&&G.bookedSlot!==se.bookedSlot){const V=s.find(ie=>ie.clientId===e&&ie.dateTime===G.bookedSlot);V&&!V.isFilled&&l(V.id,G.name||"Anonymous Visitor",{email:G.email,phone:G.phone,purpose:G.purpose})}H.leadId&&(Le.current=H.leadId,ht.current?ht.current={...ht.current,id:H.leadId}:ht.current={id:H.leadId,clientId:e})}else if(H.type==="transcription"&&H.text){const se=H.text.toLowerCase();(se.includes("goodbye")||se.includes("bye!")||se.includes("have a wonderful day")||se.includes("have a great day")||se.includes("talk to you soon"))&&(console.log("Client-side speech watchdog detected goodbye signal. Scheduling disconnect."),setTimeout(()=>{Jt(!0)},4e3)),A(G=>{const V=G[G.length-1];
663return V&&V.sender==="agent"&&!V.text.startsWith("Connected to")?[...G.slice(0,-1),{...V,text:V.text+H.text}]:[...G,{sender:"agent",text:H.text,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]})}else H.type==="complete"?(console.log("Live session signaled conversation complete. Gracefully ending after goodbye audio drains."),F(!1),setTimeout(()=>{Jt(!0)},4e3)):H.type==="error"&&(console.error("Live session reported error:",H.message),A(se=>[...se,{sender:"agent",text:`Live connection issue: ${H.message}. Please check your voice provider configuration.`,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]))},In=w.useRef(null),Mi=()=>{const H=In.current;In.current=null,H==null||H.then(se=>se.getTracks().forEach(G=>G.stop())).catch(()=>{})},Ur=async()=>{var V,ie;const H=`web-${Date.now()}`;In.current=navigator.mediaDevices.getUserMedia({audio:!0}),In.current.catch(()=>{});let se;try{se=await fetch("/api/livekit-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:e,callId:H,role:"web",voiceAgentId:S,language:N||void 0})})}catch(Z){return console.warn("LiveKit token endpoint unreachable; falling back to /live relay:",Z),$n()}if(!se.ok){let Z=null;try{Z=await se.json()}catch{}if((Z==null?void 0:Z.status)==="insufficient_balance"){A(Te=>[...Te,{sender:"agent",text:(Z==null?void 0:Z.error)||"Your plan is out of minutes. Please top up to continue.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),Jt(!0);return}if((Z==null?void 0:Z.status)==="rejected"){A(Te=>[...Te,{sender:"agent",text:"All lines are busy right now. Please try again shortly.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),Jt(!0);return}if(se.status===429||(Z==null?void 0:Z.status)==="rate_limited"){A(Te=>[...Te,{sender:"agent",text:(Z==null?void 0:Z.error)||"You have reached the demo call limit. Please try again in a few minutes.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),Jt(!0);return}return console.warn(`LiveKit token endpoint returned ${se.status}; falling back to /live relay.`),$n()}let G;try{G=await se.json()}catch(Z){return console.warn("LiveKit token response unparseable; falling back to /live relay:",Z),$n()}if(!(G!=null&&G.url)||!(G!=null&&G.token))return console.warn("LiveKit token response missing url/token; falling back to /live relay."),$n();try{Bt();const Z=new bh({adaptiveStream:!0,dynacast:!0});kn.current=Z,Lt.current=null,On.current=[],Z.on(_e.TrackSubscribed,mt=>{if(mt.kind!==Ce.Kind.Audio)return;const Ie=document.createElement("audio");Ie.autoplay=!0,Ie.style.display="none",document.body.appendChild(Ie),On.current.push(Ie);try{mt.attach(Ie)}catch(Nn){console.warn("attach agent track failed:",Nn)}jt(mt.mediaStreamTrack);try{const Nn=bt.current;if(Nn&&be.current){const kr=new MediaStream([mt.mediaStreamTrack]);Nn.createMediaStreamSource(kr).connect(be.current)}}catch(Nn){console.warn("Failed to mix agent audio into recording stream:",Nn)}U(!0)}),Z.on(_e.TrackUnsubscribed,mt=>{if(mt.kind===Ce.Kind.Audio){try{mt.detach()}catch{}U(!1)}}),Z.on(_e.DataReceived,mt=>{try{Yi(JSON.parse(new TextDecoder().decode(mt)))}catch(Ie){console.error("Error parsing LiveKit data message:",Ie)}}),await Z.connect(G.url,G.token),console.log(`Connected to LiveKit room ${G.roomName} (pipeline: ${G.pipeline})`),A([{sender:"agent",text:`Connected to ${n}'s virtual assistant, ${b}. Speak naturally to begin...`,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),U(!0),F(!1),pt.current&&clearTimeout(pt.current),pt.current=setTimeout(()=>{Qt.current.length===0&&U(!1)},4e3);const Te=await(In.current??navigator.mediaDevices.getUserMedia({audio:!0}));In.current=null,tn.current=Te,Ft(Te),Gi();const we=window.AudioContext||window.webkitAudioContext;bt.current||(bt.current=new we({sampleRate:24e3}));const X=bt.current,Ee=X.createMediaStreamDestination();be.current=Ee;try{X.createMediaStreamSource(Te).connect(Ee)}catch(mt){console.warn("Failed to mix microphone into recording stream:",mt)}try{await Z.localParticipant.setMicrophoneEnabled(!0);const mt=Z.localParticipant.getTrackPublication(Ce.Source.Microphone);Lt.current=((V=mt==null?void 0:mt.track)==null?void 0:V.mediaStreamTrack)??null}catch(mt){console.warn("Failed to publish microphone track to LiveKit:",mt)}nt.current=[],ze.current=null;let qe;const Nt={mimeType:"",audioBitsPerSecond:32e3};try{qe=new MediaRecorder(Ee.stream,{...Nt,mimeType:"audio/webm"})}catch{try{qe=new MediaRecorder(Ee.stream,{...Nt,mimeType:"audio/mp4"})}catch{qe=new MediaRecorder(Ee.stream,{audioBitsPerSecond:32e3})}}De.current=qe,qe.ondataavailable=mt=>{mt.data&&mt.data.size>0&&nt.current.push(mt.data)},qe.onstop=async()=>
663{if(nt.current.length===0){console.warn("No recording chunks collected.");return}if(!Le.current){console.warn("Recording stopped with no leadId — not uploading (would orphan in R2).");return}const mt=new Blob(nt.current,{type:qe.mimeType||"audio/webm"});nt.current=[];const Ie=Le.current;try{const Nn=await fetch("/api/recording-upload-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:e,leadId:Ie})});if(!Nn.ok)throw new Error(`upload-url endpoint returned ${Nn.status}`);const{uploadUrl:kr,publicUrl:ks}=await Nn.json();if(!kr||!ks)throw new Error("upload-url endpoint returned no URL");const Br=await fetch(kr,{method:"PUT",headers:{"Content-Type":"audio/webm"},body:mt});if(!Br.ok)throw new Error(`R2 PUT returned ${Br.status}`);ze.current=ks,console.log("Recording uploaded to R2:",ks),Le.current&&h&&h(Le.current,{audioRecordingUrl:ks})}catch(Nn){console.warn("Call recording upload failed; falling back to TTS summary:",Nn)}},qe.start(500)}catch(Z){console.error("LiveKit session failed; falling back to /live relay:",Z),ct();try{(ie=kn.current)==null||ie.disconnect()}catch{}return kn.current=null,$n()}},$n=async()=>{try{Mi(),Bt(),ct();const H=window.location.protocol==="https:"?"wss:":"ws:",se=f?f.map(ie=>ie.id).join(","):"",G=`${H}//${window.location.host}/live?clientId=${e}&companyName=${encodeURIComponent(n)}&voiceId=${p}&greetingPrompt=${encodeURIComponent(i||"")}&assignedWorkflowPrompt=${encodeURIComponent(r||"")}&kbIds=${encodeURIComponent(se)}&visitorName=${encodeURIComponent(Q.name)}&visitorPhone=${encodeURIComponent(Q.phone)}&visitorEmail=${encodeURIComponent(Q.email)}&bookedSlot=${encodeURIComponent(Q.bookedSlot)}&visitorPurpose=${encodeURIComponent(Q.purpose)}${N?`&language=${encodeURIComponent(N)}`:""}`;console.log("Connecting to Gemini Live WebSocket:",G);const V=new WebSocket(G);yt.current=V,V.onopen=async()=>{console.log("Gemini Live WebSocket opened"),A([{sender:"agent",text:`Connected. Speak naturally to ${n}'s virtual assistant, ${b}...`,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),U(!0),F(!1),pt.current&&clearTimeout(pt.current),pt.current=setTimeout(()=>{Qt.current.length===0&&U(!1)},4e3);try{const ie=await navigator.mediaDevices.getUserMedia({audio:!0});tn.current=ie;const Z=window.AudioContext||window.webkitAudioContext,Te=new Z({sampleRate:16e3});on.current=Te,bt.current||(bt.current=new Z({sampleRate:24e3}));const we=bt.current,X=we.createMediaStreamDestination();be.current=X;try{we.createMediaStreamSource(ie).connect(X)}catch(Ie){console.warn("Failed to mix microphone into recording stream:",Ie)}const Ee=Te.createMediaStreamSource(ie),qe=Te.createScriptProcessor(4096,1,1);Vt.current=qe,Ee.connect(qe),qe.connect(Te.destination),qe.onaudioprocess=Ie=>{if(V.readyState===WebSocket.OPEN&&!Ut.current&&!Wn.current){const Nn=_i(Ie.inputBuffer.getChannelData(0));V.send(JSON.stringify({audio:Nn}))}},nt.current=[],ze.current=null;let Nt;const mt={mimeType:"",audioBitsPerSecond:32e3};try{Nt=new MediaRecorder(X.stream,{...mt,mimeType:"audio/webm"})}catch{try{Nt=new MediaRecorder(X.stream,{...mt,mimeType:"audio/mp4"})}catch{Nt=new MediaRecorder(X.stream,{audioBitsPerSecond:32e3})}}De.current=Nt,Nt.ondataavailable=Ie=>{Ie.data&&Ie.data.size>0&&nt.current.push(Ie.data)},Nt.onstop=async()=>{if(nt.current.length===0){console.warn("No recording chunks collected.");return}if(!Le.current){console.warn("Recording stopped with no leadId — not uploading (would orphan in R2).");return}const Ie=new Blob(nt.current,{type:Nt.mimeType||"audio/webm"});nt.current=[];const Nn=Le.current;try{const kr=await fetch("/api/recording-upload-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:e,leadId:Nn})});if(!kr.ok)throw new Error(`upload-url endpoint returned ${kr.status}`);const{uploadUrl:ks,publicUrl:Br}=await kr.json();if(!ks||!Br)throw new Error("upload-url endpoint returned no URL");const is=await fetch(ks,{method:"PUT",headers:{"Content-Type":"audio/webm"},body:Ie});if(!is.ok)throw new Error(`R2 PUT returned ${is.status}`);ze.current=Br,console.log("Recording uploaded to R2:",Br),Le.current&&h&&h(Le.current,{audioRecordingUrl:Br})}catch(kr){console.warn("Call recording upload failed; falling back to TTS summary:",kr)}},Nt.start(500)}catch(ie){console.error("Failed to access microphone for live streaming:",ie),A(Z=>[...Z,{sender:"agent",text:"Error: Microphone access is required for real-time live voice. Please grant permission or use Classic Mode.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}])}},V.onmessage=ie=>{try{Yi(JSON.parse(ie.data))}catch(Z){console.error("Error parsing live WS message:",Z)}}
663,V.onclose=()=>{console.log("Gemini Live WebSocket closed"),F(!1),U(!1)},V.onerror=ie=>{console.error("WebSocket connection error:",ie)}}catch(H){console.error("Failed to start Live session:",H)}},li=()=>{if(Bt(),kn.current){try{const H=kn.current;H.removeAllListeners(_e.TrackSubscribed),H.removeAllListeners(_e.TrackUnsubscribed),H.removeAllListeners(_e.DataReceived),H.disconnect()}catch(H){console.warn("Failed to disconnect LiveKit room:",H)}kn.current=null,Lt.current=null}if(On.current.forEach(H=>{try{H.pause(),H.srcObject=null,H.remove()}catch{}}),On.current=[],De.current&&De.current.state!=="inactive")try{De.current.stop()}catch(H){console.warn("Failed to stop media recorder:",H)}if(Vt.current){try{Vt.current.disconnect()}catch{}Vt.current=null}if(on.current){try{on.current.close()}catch{}on.current=null}if(tn.current){try{tn.current.getTracks().forEach(H=>H.stop())}catch{}tn.current=null}if(yt.current){try{yt.current.close()}catch{}yt.current=null}},ci=H=>{if(ai("speak"),!je.current)return;try{je.current.cancel(),je.current.paused&&je.current.resume()}catch(Ie){console.warn("Error during voice reset:",Ie)}U(!0),ve.current&&clearTimeout(ve.current);const se=new SpeechSynthesisUtterance(H),G=["james","david","liam","marcus"].includes(p),V=p==="james",ie=p==="charlotte",Z=p==="liam",Te=p==="chloe",we=je.current.getVoices();let X;ie?X=we.find(Ie=>Ie.lang.toLowerCase().startsWith("fr"))||we.find(Ie=>Ie.name.toLowerCase().includes("charlotte"))||we.find(Ie=>Ie.name.toLowerCase().includes("french")):Z?X=we.find(Ie=>Ie.lang.toLowerCase().startsWith("en-ie"))||we.find(Ie=>Ie.name.toLowerCase().includes("irish"))||we.find(Ie=>Ie.name.toLowerCase().includes("liam")):Te?X=we.find(Ie=>Ie.lang.toLowerCase().startsWith("en-au"))||we.find(Ie=>Ie.name.toLowerCase().includes("australia"))||we.find(Ie=>Ie.name.toLowerCase().includes("karen")):V&&(X=we.find(Ie=>Ie.lang.toLowerCase().startsWith("en-gb"))||we.find(Ie=>Ie.name.toLowerCase().includes("great britain"))||we.find(Ie=>Ie.name.toLowerCase().includes("hazel"))||we.find(Ie=>Ie.name.toLowerCase().includes("daniel"))),X||(G?X=we.find(Ie=>Ie.name.toLowerCase().includes("david")&&Ie.lang.startsWith("en"))||we.find(Ie=>Ie.name.toLowerCase().includes("mark")&&Ie.lang.startsWith("en"))||we.find(Ie=>Ie.name.toLowerCase().includes("male")&&Ie.lang.startsWith("en"))||we.find(Ie=>Ie.name.toLowerCase().includes("google")&&Ie.name.toLowerCase().includes("male"))||we.find(Ie=>Ie.name.toLowerCase().includes("daniel")):X=we.find(Ie=>Ie.name.toLowerCase().includes("natural")&&Ie.lang.startsWith("en")&&!Ie.name.toLowerCase().includes("male"))||we.find(Ie=>Ie.name.toLowerCase().includes("google")&&Ie.lang.startsWith("en")&&!Ie.name.toLowerCase().includes("male"))||we.find(Ie=>Ie.name.toLowerCase().includes("samantha")&&Ie.lang.startsWith("en"))||we.find(Ie=>Ie.name.toLowerCase().includes("zira")&&Ie.lang.startsWith("en"))||we.find(Ie=>Ie.lang.startsWith("en-us"))||we.find(Ie=>Ie.lang.startsWith("en"))),X||(X=we.find(Ie=>Ie.lang.startsWith("en"))||we[0]),X&&(se.voice=X);let Ee=1,qe=1;switch(p){case"james":Ee=.88,qe=.95;break;case"david":Ee=.78,qe=.9;break;case"marcus":Ee=.82,qe=1;break;case"liam":Ee=.92,qe=.96;break;case"emily":Ee=1.12,qe=1.06;break;case"aria":Ee=1.15,qe=.98;break;case"sophia":Ee=1.04,qe=1.04;break;case"charlotte":Ee=1.02,qe=.94;break;case"chloe":Ee=1,qe=1.02;break;case"maya":Ee=.98,qe=1;break;default:Ee=1,qe=1}se.pitch=Ee,se.rate=qe;const Nt=()=>{if(ve.current&&(clearTimeout(ve.current),ve.current=null),U(!1),ai("listen"),ln.current&&!Ut.current&&Oe.current)try{Oe.current.start()}catch{}};
663se.onend=Nt,se.onerror=Ie=>{console.error("SpeechSynthesis error:",Ie),Nt()};const mt=H.length/15*1e3+2500;ve.current=setTimeout(()=>{console.warn("Failsafe triggered: Speech synthesis onend did not fire. Automatically recovering mic state."),Nt()},mt),Ke.current=se,setTimeout(()=>{if(je.current)try{je.current.speak(se)}catch(Ie){console.error("Failed to execute speak:",Ie),Nt()}},100)},ot=()=>{if(T(!0),ai("connect"),Le.current=null,ht.current=null,ze.current=null,nt.current=[],le){zt.current.agentAudioStarted=!1,Zn(),Ur();return}if(je.current)try{je.current.cancel(),je.current.paused&&je.current.resume();const se=new SpeechSynthesisUtterance(" ");se.volume=0,je.current.speak(se)}catch(se){console.warn("Speech engine pre-activation skipped:",se)}let H=i;if(!H){const se=f&&f.find(G=>G.type==="URL");if(se&&se.sourceUrl){const G=new URL(se.sourceUrl).hostname;H=`Thank you for contacting ${n}. I am ${b}, your AI assistant, with answers from ${G}. How can I assist you with our services, pricing, or bookings today?`}else f&&f.length>0?(f.slice(0,2).map(G=>G.fileName).join(" and "),H=`Thank you for contacting ${n}. I am ${b}, your AI receptionist, with answers from your knowledge base. How can I help you today?`):H=`Thank you for contacting ${n}. I am ${b}, your AI receptionist. How can I help you today?`}A([{sender:"agent",text:H,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),L("ask_name"),ci(H)},Wt=()=>{if(Mi(),T(!1),U(!1),F(!1),ve.current&&(clearTimeout(ve.current),ve.current=null),ai("disconnect"),ct(),le?li():(je.current&&je.current.cancel(),Oe.current&&Oe.current.abort()),$t(),x)try{x(q.current,ze.current)}catch(H){console.warn("onCallEnded callback failed:",H)}W({name:"",email:"",phone:"",purpose:"",bookedSlot:""}),L("greet")},Jt=(H=!1)=>{if(H){Wt();return}if($.current)return;$.current=!0;const se="Thank you for calling. It was a pleasure assisting you. Goodbye!";if(F(!1),Oe.current)try{Oe.current.abort()}catch{}A(G=>[...G,{sender:"agent",text:se,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),ci(se),setTimeout(()=>{Wt(),$.current=!1},2800)},$t=()=>{const H=q.current;if(Le.current){ze.current&&h&&h(Le.current,{audioRecordingUrl:ze.current});return}if(!c)return;const se="lead-"+Date.now();Le.current=se;const G={id:se,clientId:e,visitorName:H.name||"Anonymous Caller",visitorEmail:H.email||"[email protected]",visitorPhone:H.phone||"No phone",purpose:H.purpose||"Spoke with Web Voice Receptionist",timestamp:new Date().toISOString(),status:H.bookedSlot?"booked":"new",bookedSlot:H.bookedSlot||void 0,audioRecordingUrl:ze.current||void 0,durationSeconds:Math.floor(Math.random()*90)+40,tokenCost:.45,createdAt:Date.now()};ht.current=G,c(G)},te=()=>{if(E){if(C(!1),kn.current)try{kn.current.localParticipant.setMicrophoneEnabled(!0)}catch{}else if(Oe.current)try{Oe.current.start()}catch{}}else if(C(!0),kn.current)try{kn.current.localParticipant.setMicrophoneEnabled(!1)}catch{}else Oe.current&&Oe.current.abort()},Fe=async H=>{if(!H.trim())return;const se=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(A(G=>[...G,{sender:"user",text:H,time:se}]),R(""),Oe.current&&Oe.current.abort(),le&&yt.current&&yt.current.readyState===WebSocket.OPEN){console.log("Sending text query to Gemini Live Session via WebSocket:",H),yt.current.send(JSON.stringify({text:H}));return}if(le&&kn.current){try{const G=new TextEncoder;kn.current.localParticipant.publishData(G.encode(JSON.stringify({text:H})),{reliable:!0}),console.log("Sent text query to agent worker via LiveKit data message:",H)}catch(G){console.error("Failed to send text via LiveKit data message:",G)}return}U(!0);try{const G=await fetch("/api/receptionist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:H,history:P,companyName:n,greetingPrompt:i,availableSlots:ql(s.filter(ie=>ie.clientId===e)),collectedData:Q,clientId:e,kbItems:f})});if(!G.ok)throw new Error("API request failed");const V=await G.json();if(V.extracted&&(W(V.extracted),V.extracted.bookedSlot&&V.extracted.bookedSlot!==Q.bookedSlot)){const ie=s.find(Z=>Z.clientId===e&&Z.dateTime===V.extracted.bookedSlot);ie&&l(ie.id,V.extracted.name||"Anonymous Visitor",{email:V.extracted.email,phone:V.extracted.phone,purpose:V.extracted.purpose})}if(V.step&&(L(V.step),V.step==="complete")){ci(V.reply),A(ie=>[...ie,{sender:"agent",text:V.reply,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),setTimeout(()=>{Jt(!0)},5e3);return}ci(V.reply),A(ie=>[...ie,{sender:"agent",text:V.reply,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}])}catch(G){console.warn("Receptionist server-side API unavailable, executing local robust fallback logic:",G),setTimeout(()=>{dt(H)},800)}},dt=H=>{let se="";const G=H.trim().toLowerCase();if(ue==="ask_name"){let V=H;G.startsWith("my name is")?V=H.substring(10).trim():G.startsWith("i am")&&(V=H.substring(4).trim()),W(ie=>({...ie,name:V})),L("ask_phone"),se=`Thank you, ${V}. What is a reliable phone number we can reach you at?`}else if(ue==="ask_phone")W(V=>({...V,phone:H})),L("ask_email"),se="Got it. And what is your email address so we can send a booking confirmation?";else if(ue==="ask_email")W(V=>({...V,email:H}
663)),L("ask_purpose"),se="Thank you. Could you briefly explain the purpose of your visit or call today?";else if(ue==="ask_purpose"){W(ie=>({...ie,purpose:H}));const V=ql(s.filter(ie=>ie.clientId===e));V.length>0?(L("ask_booking"),se=`Understood. We have some scheduled slots available for booking. Would you like to schedule an appointment? Here are the open dates: ${V.slice(0,3).map(ie=>ie.dateTime.split(" ")[1]+" "+ie.dateTime.split(" ")[2]).join(", or ")}. Just state which time or slot you prefer!`):(L("complete"),se="Perfect. I have recorded your contact details and request. Our staff will contact you shortly. Is there anything else I can assist you with today?")}else if(ue==="ask_booking"){const V=ql(s.filter(Z=>Z.clientId===e));let ie;for(const Z of V){const we=Z.dateTime.toLowerCase().split(" "),X=we[1],Ee=X.replace(/^0/,"");if(G.includes(X)||G.includes(Ee)||G.includes(we[1]+" "+we[2].toLowerCase())){ie=Z;break}}ie?(l(ie.id,Q.name||"Anonymous Visitor",{email:Q.email,phone:Q.phone,purpose:Q.purpose}),W(Z=>({...Z,bookedSlot:ie.dateTime})),L("complete"),se=`Fantastic! I have booked your appointment for ${ie.dateTime}. A calendar invite has been dispatched to ${Q.email||"your email"}. Thank you for scheduling with us!`):G.includes("no")||G.includes("skip")||G.includes("later")?(L("complete"),se="No problem! I have recorded your details and request. We will follow up via email. Is there anything else I can help you with before we sign off?"):se=`I didn't quite catch a matching time. The options are: ${V.map(Z=>Z.dateTime.split(" ")[1]+" "+Z.dateTime.split(" ")[2]).join(" or ")}. Which one fits you best?`}else if(ue==="complete"){se="Thank you for calling. It was a pleasure assisting you. Goodbye!",ci(se),A(V=>[...V,{sender:"agent",text:se,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),setTimeout(()=>{Jt(!0)},3e3);return}ci(se),A(V=>[...V,{sender:"agent",text:se,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}])},He=H=>{H.key==="Enter"&&Fe(M)};return a.jsxs("div",{className:`bg-white rounded-2xl border border-slate-100 shadow-xl overflow-hidden flex flex-col ${d?"h-[380px]":"h-[500px]"}`,children:[a.jsxs("div",{className:"bg-slate-900 px-4 py-3 flex items-center justify-between text-white border-b border-slate-800",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${j?"bg-emerald-500 animate-ping":"bg-slate-500"}`}),a.jsx("div",{className:`w-3 h-3 rounded-full absolute inset-0 ${j?"bg-emerald-500":"bg-slate-500"}`})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-xs font-semibold text-slate-400 font-display",children:"S2S REALTIME WIDGET"}),a.jsxs("h4",{className:"text-sm font-bold truncate max-w-[180px]",children:[n," Reception"]})]}),j&&si!==null&&a.jsxs("span",{className:`ml-2 px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold ${si<=500?"bg-emerald-500/20 text-emerald-300":"bg-amber-500/20 text-amber-300"}`,title:"Perceived reply time: user-speech-end → agent-audio-start",children:[si,"ms"]})]}),j?a.jsxs("button",{onClick:Jt,className:"bg-rose-600 hover:bg-rose-500 px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1 transition-all cursor-pointer",children:[a.jsx(kL,{className:"w-3.5 h-3.5"})," End Call"]}):a.jsxs("button",{onClick:ot,className:"bg-indigo-600 hover:bg-indigo-500 px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1 transition-all cursor-pointer",children:[a.jsx(wv,{className:"w-3.5 h-3.5"})," Start call"]})]}),a.jsx("div",{className:"flex-1 bg-slate-50 flex flex-col p-4 overflow-y-auto relative",children:j?a.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[a.jsxs("div",{onClick:()=>{if(j&&!E&&!B&&!O&&Oe.current)try{Oe.current.start()}catch{}},className:`bg-white/75 backdrop-blur-sm border border-slate-100 rounded-xl p-3 mb-3 flex items-center justify-between transition-all duration-250 ${j&&!E&&!B&&!O?"hover:bg-amber-50 hover:border-amber-200 cursor-pointer":""}`,title:j&&!E&&!B&&!O?"Click to manually force enable microphone":"",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-[10px] font-mono text-slate-400 uppercase tracking-wider",children:B?"Agent Speaking...":E?"Mic Muted":O?"Listening... Say something!":"Mic Idle (Click to force on)"}),j&&!E&&!B&&!O&&a.jsx("span",{className:"text-[9px] text-amber-600 font-semibold mt-0.5 animate-pulse",children:"Click here to start recording manually if browser blocked microphone!"})]}),a.jsx("div",{className:"flex items-end gap-0.5 h-6",children:[1,2,3,4,5,6,7,8,9,10].map(H=>{let se="h-1",G=`${H*.1}s`;return j&&!E&&(B?se="h-5":O?se="h-3":se="h-1"),a.jsx("div",{style:{animationDelay:G},className:`w-0.5 bg-indigo-600 rounded-full transition-all duration-300 ${j&&!E&&(B||O)?"animate-pulse-wave":""} ${se}`},H)})})]}),Pe&&a.jsxs("div",{className:"bg-amber-50/95 border border-amber-200/60 rounded-xl p-3.5 mb-3 text-[11px] text-amber-800 flex flex-col gap-2.5 shadow-sm",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(xa,{
663className:"w-4.5 h-4.5 text-amber-600 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold text-amber-900 text-xs",children:"Audio & Speech Synthesis Notice"}),a.jsx("p",{className:"mt-1 leading-relaxed text-amber-700/95 font-medium",children:"Browsers block dynamic audio output and Speech Synthesis inside embedded iframe preview sandboxes. To experience the real S2S spoken voice agent, open the platform in a new tab!"})]})]}),a.jsx("div",{className:"flex justify-start",children:a.jsxs("a",{href:window.location.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 bg-amber-600 hover:bg-amber-700 active:bg-amber-800 text-white font-semibold px-3 py-1.5 rounded-lg text-xs transition-all shadow-sm hover:shadow hover:-translate-y-0.5 cursor-pointer",children:[a.jsx(s5,{className:"w-3.5 h-3.5"}),"Open App in New Tab"]})})]}),a.jsxs("div",{className:"bg-indigo-50/50 border border-indigo-100/50 rounded-xl p-3 mb-3 text-[10px] space-y-2",children:[a.jsxs("div",{className:"font-semibold text-indigo-900 uppercase tracking-wide flex items-center justify-between",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(qo,{className:"w-3.5 h-3.5 text-indigo-600"}),"Visitor Credentials & Intake Form"]}),a.jsx("span",{className:"text-[8px] bg-indigo-100 text-indigo-700 px-1.5 py-0.5 rounded font-mono font-bold",children:j?"🔴 LIVE LOCK":"✏️ EDITABLE"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-slate-600",children:[a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-[8px] font-bold text-slate-400",children:"Full Name"}),a.jsx("input",{type:"text",value:Q.name,onChange:H=>W(se=>({...se,name:H.target.value})),placeholder:"e.g. John Doe",className:"bg-white border border-slate-200 outline-none rounded px-1.5 py-1 text-[10px] font-semibold text-slate-800 focus:border-indigo-500"})]}),a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-[8px] font-bold text-slate-400",children:"Phone Number"}),a.jsx("input",{type:"text",value:Q.phone,onChange:H=>W(se=>({...se,phone:H.target.value})),placeholder:"e.g. 555-0199",className:"bg-white border border-slate-200 outline-none rounded px-1.5 py-1 text-[10px] font-semibold text-slate-800 focus:border-indigo-500"})]}),a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-[8px] font-bold text-slate-400",children:"Email Address"}),a.jsx("input",{type:"text",value:Q.email,onChange:H=>W(se=>({...se,email:H.target.value})),placeholder:"e.g. [email protected]",className:"bg-white border border-slate-200 outline-none rounded px-1.5 py-1 text-[10px] font-semibold text-slate-800 focus:border-indigo-500"})]}),a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-[8px] font-bold text-slate-400",children:"Appointment Slot"}),a.jsxs("select",{value:Q.bookedSlot,onChange:H=>W(se=>({...se,bookedSlot:H.target.value})),className:"bg-white border border-slate-200 outline-none rounded px-1.5 py-1 text-[10px] font-semibold text-slate-800 focus:border-indigo-500 cursor-pointer",children:[a.jsx("option",{value:"",children:"-- Select Slot --"}),ql(s.filter(H=>H.clientId===e)).map(H=>a.jsx("option",{value:H.dateTime,children:H.dateTime},H.id))]})]}),a.jsxs("div",{className:"col-span-2 flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-[8px] font-bold text-slate-400",children:"Purpose of Visit"}),a.jsx("input",{type:"text",value:Q.purpose,onChange:H=>W(se=>({...se,purpose:H.target.value})),placeholder:"e.g. Consultation",className:"bg-white border border-slate-200 outline-none rounded px-1.5 py-1 text-[10px] font-semibold text-slate-800 focus:border-indigo-500"})]})]})]}),a.jsxs("div",{ref:ye,className:"flex-1 overflow-y-auto space-y-3 mb-3 pr-1 text-xs",children:[P.map((H,se)=>a.jsx("div",{className:`flex ${H.sender==="user"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] rounded-2xl p-3 ${H.sender==="user"?"bg-indigo-600 text-white rounded-br-none":"bg-white border border-slate-100 text-slate-800 rounded-bl-none shadow-sm"}`,children:[a.jsx("p",{className:"leading-relaxed font-sans",children:H.text}),H.link&&a.jsxs("a",{href:H.link.url||void 0,target:"_blank",rel:"noopener noreferrer",className:`mt-2 flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-semibold no-underline ${H.link.url?"bg-indigo-50 text-indigo-700 border border-indigo-200 hover:bg-indigo-100":"bg-slate-50 text-slate-400 border border-slate-200"}`,children:[H.link.url?a.jsx(s5,{className:"w-3 h-3"}):null,H.link.url?"View product":"Product link pending",H.link.sku&&a.jsxs("span",{className:"opacity-60 font-normal",children:["· SKU ",H.link.sku]})]}),a.jsx("span",{className:"text-[9px] opacity-70 block mt-1 text-right",children:H.time})]})},se)),B&&a.jsx("div",{className:"flex justify-start",children:a.jsxs("div",{className:"bg-white border border-slate-100 rounded-2xl rounded-bl-none p-3 shadow-sm flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-600 rounded-full animate-bounce"}),a.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-600 rounded-full animate-bounce [animation-delay:0.2s]"}),a.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-600 rounded-full animate-bounce [animation-delay:0.4s]"})]})}),a.jsx("div",{ref:J})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:te,className:`p-2.5 rounded-xl border transition-all cursor-pointer ${E?"bg-rose-50 border-rose-100 text-rose-600":"bg-white border-slate-200 text-slate-600 hover:bg-slate-50"}`,title:E?"Unmute microphone":"Mute microphone",children:E?a.jsx(tX,{className:"w-4 h-4"}):a.jsx(Uo,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-white border border-slate-200 rounded-xl px-3 py-1.5 shadow-sm",children:[a.jsx("input",{type:"text",placeholder:"Type message or ask to book slot...",value:M,onChange:H=>R(H.target.value),onKeyDown:He,className:"w-full text-xs bg-transparent border-none outline-none text-slate-800 placeholder-slate-400"}),a.jsx("button",{type:"button",onClick:()=>Fe(M),className:"p-1 hover:bg-indigo-50 rounded-lg text-indigo-600 transition-colors cursor-pointer",children:a.jsx(yp,{className:"w-3.5 h-3.5"})})]})]})]}):a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center p-6",children:[a.jsx(pn.div,{animate:{y:[0,-6,0]},transition:{repeat:1/0,duration:3,ease:"easeInOut"},className:"p-4 bg-indigo-50 rounded-full text-indigo-600 mb-4",children:a.jsx(Uo,{className:"w-8 h-8"})}),a.jsx("h3",{className:"font-bold text-slate-800 text-lg font-display",children:"Test Client's Voice Agent"}),a.jsx("p",{className:"text-xs text-slate-500 max-w-[280px] mt-1",children:"Start a live call to experience the AI receptionist. It will collect your details and book empty slots on the calendar instantly!"}),a.jsxs("button",{onClick:ot,className:"mt-5 bg-indigo-600 hover:bg-indigo-500 text-white font-medium px-5 py-2.5 rounded-xl text-sm transition-all shadow-md hover:shadow-lg cursor-pointer flex items-center gap-2",children:[a.jsx(wv,{className:"w-4 h-4"})," Start Live Audition"]}),a.jsxs("div",{className:"mt-3 bg-slate-200/50 p-1 rounded-xl flex gap-1 w-full max-w-[290px] border border-slate-300/30",children:[a.jsx("button",{onClick:()=>Be(!0),className:`flex-1 py-1.5 px-2 rounded-lg text-[11px] font-bold transition-all cursor-pointer flex items-center justify-center gap-1 ${le?"bg-white text-indigo-600 shadow-sm border border-slate-100":"text-slate-500 hover:text-slate-800"}`,children:"⚡ Live Voice"}),a.jsx("button",{onClick:()=>Be(!1),className:`flex-1 py-1.5 px-2 rounded-lg text-[11px] font-bold transition-all cursor-pointer flex items-center justify-center gap-1 ${le?"text-slate-500 hover:text-slate-800":"bg-white text-indigo-600 shadow-sm border border-slate-100"}`,children:"💬 Classic Mode"})]}),f&&f.length>0&&a.jsxs("div",{className:"mt-5 w-full max-w-[290px] text-left border border-slate-200/50 rounded-xl bg-white p-3 shadow-sm animate-fade-in",children:[a.jsxs("span",{className:"font-bold text-[9px] text-indigo-600 uppercase tracking-wider block mb-1.5 flex items-center gap-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse shrink-0"}),"Active Agent Context Core (",f.length,")"]}),a.jsx("div",{className:"space-y-1.5 max-h-[85px] overflow-y-auto pr-0.5",children:f.map(H=>a.jsxs("div",{className:"flex items-center justify-between text-[10px] bg-slate-50 border border-slate-100 p-1.5 rounded-lg",children:[a.jsx("span",{className:"font-semibold text-slate-700 truncate max-w-[170px]",title:H.fileName,children:H.fileName}),a.jsx("span",{className:"text-[8px] font-bold bg-indigo-50 text-indigo-700 border border-indigo-100 px-1 py-0.2 rounded font-mono shrink-0",children:H.type})]},H.id))})]})]})}),a.jsxs("div",{className:"bg-indigo-50 border-t border-indigo-100 px-3 py-2 flex flex-col gap-1.5 text-[10px]",children:[a.jsxs("div",{className:"flex items-center gap-2 overflow-x-auto",children:[a.jsx(aa,{className:"w-3.5 h-3.5 text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-semibold text-indigo-900 shrink-0",children:"Open Slots:"}),a.jsx("div",{className:"flex gap-1.5 overflow-x-auto py-0.5",children:ql(s.filter(H=>H.clientId===e&&H.dateTime!==Q.bookedSlot)).length>0?ql(s.filter(H=>H.clientId===e&&H.dateTime!==Q.bookedSlot)).map(H=>{const[se,G,V]=H.dateTime.split(" ");return a.jsxs("span",{className:"bg-white border border-indigo-200 text-indigo-700 px-2 py-0.5 rounded-md font-medium shrink-0",children:[G," ",V]},H.id)}):a.jsx("span",{className:"text-slate-400 italic",children:"No other available slots open"})})]}),Q.bookedSlot&&a.jsxs("div",{className:"flex items-center gap-2 border-t border-emerald-100/70 pt-1.5 mt-0.5",children:[a.jsxs("span",{className:"flex h-1.5 w-1.5 relative shrink-0",children:[a.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),a.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-emerald-500"})]}),a.jsx("span",{className:"font-semibold text-emerald-800 shrink-0",children:"Your Reserved Slot:"}),a.jsxs("div",{className:"bg-emerald-500 text-white border border-emerald-600 px-2 py-0.5 rounded-md font-bold shrink-0 shadow-xs animate-pulse flex items-center gap-1 text-[9px]",children:[a.jsx(kt,{className:"w-2.5 h-2.5 text-white shrink-0"}),Q.bookedSlot," (Reserved)"]})]})]})]})}function QR(e){const[t,n,i]=e.split(" ");return{date:t||e,time:i?`${n} ${i}`:n||e}}function Joe(e){const[t,n,i]=e.split("-").map(Number);return!t||!n||!i?e:new Date(t,n-1,i).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function Zoe({open:e,onClose:t,slots:n,clientId:i,onSubmit:r,onContactFallback:s}){const[l,c]=w.useState(null),[h,d]=w.useState({name:"",email:"",ph
663one:"",purpose:""}),[f,p]=w.useState(!1),[v,x]=w.useState(!1),[b,S]=w.useState(null),[N,j]=w.useState(!1),T=ql(n.filter(R=>R.clientId===i&&!R.isFilled)),E=T.find(R=>R.id===l),C=T.reduce((R,B)=>{const{date:U}=QR(B.dateTime);return(R[U]=R[U]||[]).push(B),R},{}),P=()=>{c(null),d({name:"",email:"",phone:"",purpose:""}),p(!1),S(null)},A=()=>{t(),setTimeout(()=>{x(!1),P()},300)},M=async()=>{if(!E){S("Please pick a time slot first.");return}if(N?!h.email.trim():!h.name.trim()||!h.email.trim()){S(N?"Please enter your email.":"Please fill in your name and email so we can confirm the booking.");return}p(!0),S(null);try{await r({slotId:E.id,slotDateTime:E.dateTime,name:N?h.email.trim().split("@")[0]||"Demo request":h.name.trim(),email:h.email.trim(),phone:N?"":h.phone.trim(),purpose:N?"Quick book":h.purpose.trim()||"Demo call"}),x(!0)}catch(R){S((R==null?void 0:R.message)||"Couldn't confirm the booking. Please try again.")}finally{p(!1)}};return a.jsx(Zc,{children:e&&a.jsx(pn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:A,onKeyDown:R=>R.key==="Escape"&&A(),role:"dialog","aria-modal":"true","aria-label":"Book a demo call",children:a.jsxs(pn.div,{initial:{opacity:0,scale:.96,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:12},transition:{type:"spring",stiffness:320,damping:28},className:"bg-white rounded-3xl border border-slate-100 max-w-lg w-full p-6 shadow-2xl relative max-h-[90vh] overflow-y-auto",onClick:R=>R.stopPropagation(),children:[a.jsx("button",{onClick:A,className:"absolute top-5 right-5 p-1.5 hover:bg-slate-100 rounded-lg cursor-pointer transition-colors",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),v?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(pn.div,{initial:{scale:.6,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:260,damping:18},className:"mx-auto w-14 h-14 bg-emerald-50 rounded-2xl flex items-center justify-center mb-4",children:a.jsx(kt,{className:"w-7 h-7 text-emerald-600"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"Demo booked"}),a.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:E?a.jsxs(a.Fragment,{children:["You're set for ",a.jsx("span",{className:"font-bold text-slate-700",children:E.dateTime}),". We'll email a confirmation to ",a.jsx("span",{className:"font-bold text-slate-700",children:h.email})," shortly."]}):"Thanks — we'll confirm your slot by email shortly."}),a.jsx("button",{onClick:A,className:"mt-6 w-full bg-slate-900 hover:bg-slate-800 text-white font-bold py-2.5 rounded-xl text-xs transition-all cursor-pointer",children:"Close"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-5",children:[a.jsxs("span",{className:"text-[10px] font-bold uppercase bg-indigo-50 text-indigo-700 px-2 py-1 rounded-md flex items-center gap-1 w-fit",children:[a.jsx(Ka,{className:"w-3 h-3"})," Book a demo call"]}),a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900 mt-2",children:"Pick a time that works"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Choose an open slot and leave your details — the Vox Bridge team will c
663onfirm by email."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-400 flex items-center gap-1 mb-1.5",children:[a.jsx(cc,{className:"w-3 h-3"})," Available slots"]}),T.length===0?a.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 bg-slate-50/60 p-4 text-center",children:[a.jsx("p",{className:"text-xs text-slate-500",children:"No open slots right now."}),s&&a.jsxs("button",{onClick:()=>{A(),s()},className:"mt-2 inline-flex items-center gap-1.5 text-indigo-600 font-semibold text-xs hover:text-indigo-500 cursor-pointer",children:[a.jsx(Na,{className:"w-3.5 h-3.5"})," Send us a message instead"]})]}):a.jsx("div",{className:"space-y-2.5 max-h-[35vh] overflow-y-auto pr-1",children:Object.entries(C).map(([R,B])=>a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-bold text-slate-500 mb-1",children:Joe(R)}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:B.map(U=>{const{time:O}=QR(U.dateTime),F=U.id===l;return a.jsx("button",{onClick:()=>c(U.id),className:`px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all cursor-pointer border ${F?"bg-indigo-600 text-white border-indigo-600 shadow-md shadow-indigo-600/20":"bg-white text-slate-700 border-slate-200 hover:border-indigo-300 hover:bg-indigo-50/50"}`,children:O},U.id)})})]},R))})]}),a.jsxs("div",{className:"space-y-3 pt-1",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-1.5 p-1 rounded-xl bg-slate-100",children:[a.jsx("button",{type:"button",onClick:()=>j(!1),"aria-pressed":!N,className:`rounded-lg py-2 text-[11px] font-bold transition-colors cursor-pointer ${N?"text-slate-500 hover:text-slate-700":"bg-white text-slate-900 shadow-sm"}`,children:"Full details"}),a.jsx("button",{type:"button",onClick:()=>j(!0),"aria-pressed":N,className:`rounded-lg py-2 text-[11px] font-bold transition-colors cursor-pointer ${N?"bg-white text-indigo-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:"Quick book — email only"})]}),!N&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",children:[a.jsx(qo,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"text",placeholder:"Your name *",value:h.name,onChange:R=>d({...h,name:R.target.value}),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ei,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"tel",placeholder:"Phone (optional)",value:h.phone,onChange:R=>d({...h,phone:R.target.value}),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),a.jsx("textarea",{placeholder:"What would you like to talk about? (optional)",rows:2,value:h.purpose,onChange:R=>d({...h,purpose:R.target.value}),className:"w-full px-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none resize-none"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(uc,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"email",placeholder:"Email *",value:h.email,onChange:R=>d({...h,email:R.target.value}),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]})]}),b&&a.jsx("p",{className:"text-[11px] text-rose-600 font-medium",children:b}),a.jsxs("button",{onClick:M,disabled:f,className:"w-full bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 disabled:cursor-not-allowed text-white font-bold py-2.5 rounded-xl text-xs flex items-center justify-center gap-2 transition-all cursor-pointer",children:[f?a.jsx(Bi,{className:"w-4 h-4 animate-spin"}):a.jsx(Ka,{className:"w-4 h-4"}),f?"Confirming…":"Confirm booking"]}),a.jsx("p",{className:"text-[10px] text-slate-400 text-center",children:"No credit card needed — this books a live demo call with the Vox Bridge team."})]})]})]})})})}function Hf({cc:e,fallback:t,label:n,size:i=20,className:r=""}){const[s,l]=w.useState(!1);if(s)return a.jsx("span",{"aria-hidden":"true",className:r,style:{fontSize:i*.85,lineHeight:1},children:t??e.toUpperCase()});const c=Math.round(i*.75);return a.jsx("img",{src:`https://flagcdn.com/w40/${e}.png`,srcSet:`https://flagcdn.com/w40/${e}.png 1x, https://flagcdn.com/w80/${e}.png 2x`,width:i,height:c,alt:n?`${n} flag`:"","aria-hidden":n?void 0:!0,loading:"lazy",decoding:"async",onError:()=>l(!0),className:`inline-block rounded-[3px] object-cover shadow-[0_0_0_1px_rgba(15,23,42,0.12)] ${r}`,style:{width:i,height:c}})}function ele({open:e,plan:t,onClose:n,onSubmit:i}){const[r,s]=w.useState(""),[l,c]=w.useState(!1),[h,d]=w.useState(!1),[f,p]=w.useState(null),v=w.useRef(null),x=w.useRef(null);
663w.useEffect(()=>{var j,T;if(e){s(""),c(!1),d(!1),p(null),x.current=document.activeElement;const E=requestAnimationFrame(()=>{var C,P;(P=(C=v.current)==null?void 0:C.querySelector("input"))==null||P.focus()});return()=>cancelAnimationFrame(E)}else x.current&&((T=(j=x.current).focus)==null||T.call(j),x.current=null)},[e]);const b=()=>{l||n()},S=j=>{if(j.key==="Escape"){b();return}if(j.key!=="Tab"||!v.current)return;const T=v.current.querySelectorAll("button, a[href], input");if(T.length===0)return;const E=T[0],C=T[T.length-1];j.shiftKey&&document.activeElement===E?(j.preventDefault(),C.focus()):!j.shiftKey&&document.activeElement===C&&(j.preventDefault(),E.focus())},N=async()=>{const j=r.trim();if(!j||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(j)){p("Please enter a valid email.");return}c(!0),p(null);try{await i(j),d(!0)}catch(T){p((T==null?void 0:T.message)||"Couldn't send. Please try again.")}finally{c(!1)}};return a.jsx(Zc,{children:e&&t&&a.jsx(pn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-label":`Start the ${t.name} plan`,onKeyDown:S,onClick:b,children:a.jsxs(pn.div,{ref:v,initial:{opacity:0,scale:.96,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:12},transition:{type:"spring",stiffness:320,damping:28},className:"bg-white rounded-3xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative",onClick:j=>j.stopPropagation(),children:[a.jsx("button",{onClick:b,"aria-label":"Close",disabled:l,className:"absolute top-5 right-5 p-1.5 hover:bg-slate-100 rounded-lg cursor-pointer transition-colors disabled:cursor-not-allowed",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),h?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(pn.div,{initial:{scale:.6,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:260,damping:18},className:"mx-auto w-14 h-14 bg-emerald-50 rounded-2xl flex items-center justify-center mb-4",children:a.jsx(kt,{className:"w-7 h-7 text-emerald-600"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"You're on the list"}),a.jsxs("p",{className:"text-xs text-slate-500 mt-1.5",children:["Thanks — we'll email you a set-up link for ",t.name," within a day. Try the live demo meanwhile."]}),a.jsx("a",{href:"#demo",onClick:b,className:"mt-6 w-full inline-flex items-center justify-center bg-slate-900 hover:bg-slate-800 text-white font-bold py-2.5 rounded-xl text-xs transition-all cursor-pointer",children:"Try the live demo"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase bg-indigo-50 text-indigo-700 px-2 py-1 rounded-md",children:"Start plan"}),a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 mt-2",children:["Get ",t.name," started"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Access is invite-only right now — drop your email and our team will send your set-up link within a day."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("input",{type:"email",placeholder:"Email *",autoFocus:!0,value:r,onChange:j=>s(j.target.value),onKeyDown:j=>j.key==="Enter"&&N(),className:"w-full px-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"}),f&&a.jsx("p",{className:"text-[11px] text-rose-600 font-medium",children:f}),a.jsxs("button",{onClick:N,disabled:l,className:"w-full bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 disabled:cursor-not-allowed text-white font-bold py-2.5 rounded-xl text-xs flex items-center justify-center gap-2 transition-all cursor-pointer",children:[l?a.jsx(Bi,{className:"w-4 h-4 animate-spin"}):a.jsx(yp,{className:"w-4 h-4"}),l?"Sending…":`Start ${t.name}`]}),a.jsx("p",{className:"text-[10px] text-slate-400 text-center",children:"No payment details here — we'll email you first."})]})]})]})})})}const Qv=99,rv=[{key:"en-US",flag:"🇺🇸",cc:"us",label:"US English",language:"English (US)",bcp47:"en-US"},{key:"en-GB",flag:"🇬🇧",cc:"gb",label:"UK English",language:"English (UK)",bcp47:"en-GB"},{key:"ur",flag:"🇵🇰",cc:"pk",label:"Urdu",language:"Urdu",bcp47:"ur"}],sv=[{key:"fr",flag:"🇫🇷",cc:"fr",label:"French",language:"French",bcp47:"fr"},{key:"de",flag:"🇩🇪",cc:"de",label:"German",language:"German",bcp47:"de"},{key:"it",flag:"🇮🇹",cc:"it",label:"Italian",language:"Italian",bcp47:"it"},{key:"es",flag:"🇪🇸",cc:"es",label:"Spanish",language:"Spanish",bcp47:"es"},{key:"pt",flag:"🇵🇹",cc:"pt",label:"Portuguese",language:"Portuguese",bcp47:"pt-PT"},{key:"nl",flag:"🇳🇱",cc:"nl",label:"Dutch",language:"Dutch",bcp47:"nl"},{key:"no",flag:"🇳🇴",cc:"no",label:"Norwegian",language:"Norwegian",bcp47:"nb"},{key:"sv",flag:"🇸🇪",cc:"se",label:"Swedish",language:"Swedish",bcp47:"sv"},{key:"da",flag:"🇩🇰",cc:"dk",label:"Danish",language:"Danish",bcp47:"da"},{key:"pl",flag:"🇵🇱",cc:"pl",label:"Polish",language:"Polish",bcp47:"pl"},{key:"tr",flag:"🇹🇷",cc:"tr",label:"Turkish",language:"Turkish",bcp47:"tr"},{key:"ar",flag:"🇸🇦",cc:"sa",label:"Arabic",language:"Arabic",bcp47:"ar"},{key:"pa",flag:"🇵🇰",cc:"pk",label:"Punjabi",language:"Punjabi",bcp47:"pa"},{key:"hi",flag:"🇮🇳",cc:"in",label:"Hindi",language:"Hindi",bcp47:"hi"},{key:"bn",flag:"🇧🇩",cc:"bd",label:"Bengali",language:"Bengali",bcp47:"bn"},{key:"ja",flag:"🇯🇵",cc:"jp",label:"Japanese",language:"Japanese",bcp47:"ja"},{key:"ko",flag:"🇰🇷",cc:"kr",label:"Korean",language:"Korean",bcp47:"ko"},{key:"zh",flag:"🇨🇳",cc:"cn",label:"Chinese",language:"Chinese",bcp47:"zh-Hans"}],v8=[...rv,...sv],tle="en-US";new Set(v8.map(e=>e.language));function nle(e){if(e)return v8.find(t=>t.key===e)}const _N={GBP:.79,EUR:.92}
663,Fd={USD:{symbol:"$",label:"USD",flag:"🇺🇸",cc:"us"},GBP:{symbol:"£",label:"GBP",flag:"🇬🇧",cc:"gb"},EUR:{symbol:"€",label:"EUR",flag:"🇪🇺",cc:"eu"}},ile=new Set(["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","IS","LI","NO","CH","MC","SM","VA","AD","ME","XK"]);function rle(e){const t=(e||"").toUpperCase();return t==="GB"||t==="UK"||t==="IM"||t==="JE"||t==="GG"?"GBP":ile.has(t)?"EUR":"USD"}function sle(e){const t=e||"";return t==="Europe/London"||t==="Europe/Belfast"||t==="Europe/Jersey"||t==="Europe/Guernsey"||t==="Europe/Isle_of_Man"?"GBP":t.startsWith("Europe/")&&t!=="Europe/Moscow"&&t!=="Europe/Istanbul"&&t!=="Europe/Kiev"&&t!=="Europe/Kyiv"&&t!=="Europe/Minsk"?"EUR":"USD"}function ale(){try{return sle(Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{return"USD"}}function ole(e){if(!e)return null;const t=e.replace(/,/g,"").match(/-?\d+(\.\d+)?/);if(!t)return null;const n=Number(t[0]);return Number.isFinite(n)?n:null}function lle(e,t,n=_N){const i=ole(e);if(i===null||t==="USD")return e;const r=t==="GBP"?n.GBP:n.EUR,s=i*r,l=Fd[t].symbol;return i<1?`${l}${s.toFixed(2)}`:`${l}${Math.round(s).toLocaleString("en-US")}`}function _S(e){return{...e,id:e._id}}function MN(e,t=1200){return e.startsWith("https://images.unsplash.com/")?[400,800,t].map(i=>{const r=new URL(e);return r.searchParams.set("w",String(i)),r.searchParams.set("q","80"),`${r.toString()} ${i}w`}).join(", "):void 0}function XR({src:e,alt:t,className:n="",gradient:i="from-indigo-500 via-purple-500 to-fuchsia-500",sizes:r="(max-width: 1024px) 100vw, 600px",overlay:s}){const l=MN(e);return a.jsxs("div",{className:`relative overflow-hidden bg-gradient-to-br ${i} ${n}`,children:[a.jsx("img",{src:e,srcSet:l,sizes:l?r:void 0,alt:t,loading:"lazy",onError:c=>{c.currentTarget.style.display="none"},className:"absolute inset-0 w-full h-full object-cover object-center"}),s&&a.jsx("div",{"aria-hidden":"true",className:`absolute inset-0 ${s}`})]})}const cle=[{value:"<1s",label:"Replies in under a second"},{value:"24/7",label:"Answers web, phone & WhatsApp"},{value:String(Qv),label:"Languages understood & spoken"},{value:"0",label:"Calls sent to voicemail"}],ule=[{title:"Platform overview",blurb:"what Vox Bridge is and does"},{title:"Pricing",blurb:"tiers, plans, and billing"}
663,{title:"How it works",blurb:"upload a KB, pick a voice, embed the widget"},{title:"Regions & latency",blurb:"where calls route and what that means"}],dle=[{value:"24/7",label:"AI-answered calls, no voicemail"},{value:String(Qv),label:"Languages understood & spoken"},{value:"3",label:"Channels: web · phone · WhatsApp"}],hle=[{icon:Uu,title:"Answers in real time",body:"Live voice on your site keeps the conversation natural — under a second to reply, no robotic pauses, no hold music."},{icon:Qa,title:"Knows your business",body:"Upload PDFs, docs, CSVs, or scrape your site. The agent answers pricing, policy, and service questions in your voice — on-brand on every channel."},{icon:Na,title:"Replies on WhatsApp",body:"Text and voice-note replies on WhatsApp Business, in the same brand voice. Customers message you anytime — the agent answers and follows up."},{icon:Ka,title:"Books the meeting live",body:"Reads your calendar, offers open slots, and confirms the booking on the call — then sends the invite and email confirmation automatically."},{icon:Sa,title:"Takes real actions",body:"Beyond conversation: it checks inventory, looks up orders, sends emails, and writes to your CRM — calling your tools live as it talks."},{icon:oX,title:"Whitelabeled to your brand",body:"Your colors, your domain, your voice. Agencies can resell it as their own with a fully white-labeled dashboard."}],fle=[{icon:xm,name:"Website",status:"Live",live:!0,body:"Real-time voice on your site, embedded in minutes.",mockup:a.jsxs("svg",{viewBox:"0 0 120 72",className:"w-full h-16","aria-hidden":"true",children:[a.jsx("rect",{x:"4",y:"4",width:"112",height:"64",rx:"6",fill:"#ffffff",stroke:"#c7d2fe",strokeWidth:"1.5"}),a.jsx("rect",{x:"4",y:"4",width:"112",height:"10",rx:"6",fill:"#f1f5f9"}),a.jsx("circle",{cx:"12",cy:"9",r:"2",fill:"#fca5a5"}),a.jsx("circle",{cx:"19",cy:"9",r:"2",fill:"#fcd34d"}),a.jsx("circle",{cx:"26",cy:"9",r:"2",fill:"#6ee7b7"}),a.jsx("rect",{x:"36",y:"6.75",width:"52",height:"4.5",rx:"2.25",fill:"#e2e8f0"}),a.jsx("rect",{x:"10",y:"21",width:"44",height:"5",rx:"2.5",fill:"#e2e8f0"}),a.jsx("rect",{x:"10",y:"31",width:"56",height:"4",rx:"2",fill:"#e2e8f0"}),a.jsx("rect",{x:"10",y:"39",width:"38",height:"4",rx:"2",fill:"#e2e8f0"}),a.jsx("rect",{x:"74",y:"28",width:"40",height:"32",rx:"9",fill:"#4f46e5"}),a.jsx("path",{d:"M80 36v8m5-11v14m5-9v5",stroke:"#a5b4fc",strokeWidth:"1.6",fill:"none",strokeLinecap:"round"}),a.jsx("circle",{cx:"100",cy:"50",r:"6",fill:"#22d3ee",opacity:"0.9"}),a.jsx("path",{d:"M97.5 47.5h5a0 0 0 0 1 0 0v5a0 0 0 0 1 0 0h-5a2.5 2.5 0 0 1-2.5-2.5v0a2.5 2.5 0 0 1 2.5-2.5z",fill:"#fff"}),a.jsx("path",{d:"M97.5 49.5l4 2.5-4 2.5z",fill:"#4f46e5"}),a.jsx("rect",{x:"86",y:"1",width:"28",height:"9",rx:"4.5",fill:"#ecfdf5",stroke:"#6ee7b7",strokeWidth:"1"}),a.jsx("circle",{cx:"91.5",cy:"5.5",r:"1.8",fill:"#10b981"}),a.jsx("path",{d:"M90.6 5.5l.7.7 1.3-1.4",stroke:"#10b981",strokeWidth:"1.1",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("text",{x:"95",y:"7.5",fontSize:"4.6",fontWeight:"700",fill:"#059669",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"LIVE"})]})},{icon:Na,name:"WhatsApp Business",status:"Live",live:!0,body:"Text & voice-note replies in your brand voice, anytime.",mockup:a.jsxs("svg",{viewBox:"0 0 120 72",className:"w-full h-16","aria-hidden":"true",children:[a.jsx("rect",{x:"30",y:"6",width:"60",height:"60",rx:"12",fill:"#f6fef9",stroke:"#86efac",strokeWidth:"1.5"}),a.jsx("rect",{x:"30",y:"6",width:"60",height:"14",rx:"12",fill:"#22c55e"}),a.jsx("circle",{cx:"38",cy:"13",r:"4",fill:"#d1fae5"}),a.jsx("rect",{x:"45",y:"10.5",width:"22",height:"5",rx:"2.5",fill:"#eafff3",opacity:"0.95"}),a.jsx("text",{x:"68",y:"14.5",fontSize:"4.2",fontWeight:"600",fill:"#f0fdf4",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"2:41 PM"}),a.jsx("rect",{x:"36",y:"24",width:"30",height:"6",rx:"3",fill:"#e5f7ee"}),a.jsx("rect",{x:"52",y:"33",width:"26",height:"6",rx:"3",fill:"#dcfce7"}),a.jsx("rect",{x:"34",y:"42",width:"40",height:"10",rx:"5",fill:"#b7f2cf"}),a.jsx("path",{d:"M38 45v4m4-6v8m4-6v4",stroke:"#0f9d58",strokeWidth:"1.4",fill:"none",strokeLinecap:"round"}),a.jsx("text",{x:"60",y:"49",fontSize:"4.4",fontWeight:"600",fill:"#0f9d58",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"0:09"}),a.jsx("path",{d:"M68 48.6l.8.8 1.6-1.7",stroke:"#0f9d58",strokeWidth:"1.1",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"86",y:"1",width:"28",height:"9",rx:"4.5",fill:"#ecfdf5",stroke:"#6ee7b7",strokeWidth:"1"}),a.jsx("circle",{cx:"91.5",cy:"5.5",r:"1.8",fill:"#10b981"}),a.jsx("path",{d:"M90.6 5.5l.7.7 1.3-1.4",stroke:"#10b981",strokeWidth:"1.1",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("text",{x:"95",y:"7.5",fontSize:"4.6",fontWeight:"700",fill:"#059669",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"LIVE"})]})},{icon:Ei,name:"Phone line (PSTN)",status:"Live",live:!0,body:"Inbound & outbound calls answered 24/7, with human handoff.",mockup:a.jsxs("svg",{viewBox:"0 0 120 72",className:"w-full h-16","aria-hidden":"true",children:[a.jsx("rect",{x:"30",y:"6",
663width:"60",height:"60",rx:"12",fill:"#fff7ed",stroke:"#fdba74",strokeWidth:"1.5"}),a.jsx("rect",{x:"30",y:"6",width:"60",height:"14",rx:"12",fill:"#fb923c"}),a.jsx("circle",{cx:"38",cy:"13",r:"4",fill:"#ffedd5"}),a.jsx("rect",{x:"45",y:"10.5",width:"20",height:"5",rx:"2.5",fill:"#fff7ed",opacity:"0.95"}),a.jsx("text",{x:"68",y:"14.5",fontSize:"4.2",fontWeight:"600",fill:"#fff7ed",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"12:04"}),a.jsx("circle",{cx:"60",cy:"33",r:"12",fill:"#fed7aa"}),a.jsx("circle",{cx:"60",cy:"30",r:"4.5",fill:"#fb923c"}),a.jsx("path",{d:"M53 41a7.5 7.5 0 0 1 14 0",fill:"#fb923c"}),a.jsx("path",{d:"M40 42v4m4-6v8",stroke:"#fdba74",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),a.jsx("rect",{x:"30",y:"56",width:"60",height:"10",fill:"#fef3c7"}),a.jsx("circle",{cx:"60",cy:"61",r:"4",fill:"#22c55e"}),a.jsx("path",{d:"M58.3 61l1.2 1.2 2.5-2.6",stroke:"#fff",strokeWidth:"1.4",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"86",y:"1",width:"28",height:"9",rx:"4.5",fill:"#ecfdf5",stroke:"#6ee7b7",strokeWidth:"1"}),a.jsx("circle",{cx:"91.5",cy:"5.5",r:"1.8",fill:"#10b981"}),a.jsx("path",{d:"M90.6 5.5l.7.7 1.3-1.4",stroke:"#10b981",strokeWidth:"1.1",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("text",{x:"95",y:"7.5",fontSize:"4.6",fontWeight:"700",fill:"#059669",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"LIVE"})]})},{icon:Uo,name:"WhatsApp voice calls",status:"Coming soon",live:!1,body:"Live voice conversations over WhatsApp, end to end.",mockup:a.jsxs("svg",{viewBox:"0 0 120 72",className:"w-full h-16","aria-hidden":"true",children:[a.jsx("rect",{x:"30",y:"6",width:"60",height:"60",rx:"12",fill:"#f8fafc",stroke:"#cbd5e1",strokeWidth:"1.5"}),a.jsx("rect",{x:"30",y:"6",width:"60",height:"14",rx:"12",fill:"#e2e8f0"}),a.jsx("circle",{cx:"38",cy:"13",r:"4",fill:"#f1f5f9"}),a.jsx("rect",{x:"45",y:"10.5",width:"20",height:"5",rx:"2.5",fill:"#cbd5e1"}),a.jsx("text",{x:"68",y:"14.5",fontSize:"4.2",fontWeight:"600",fill:"#94a3b8",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"Ringing…"}),a.jsx("circle",{cx:"60",cy:"32",r:"12",fill:"#e2e8f0"}),a.jsx("circle",{cx:"60",cy:"29",r:"4.5",fill:"#94a3b8"}),a.jsx("path",{d:"M53 40a7.5 7.5 0 0 1 14 0",fill:"#94a3b8"}),a.jsx("path",{d:"M49 52v3m4.5-5v7m4.5-9v11m4.5-5v7",stroke:"#cbd5e1",strokeWidth:"1.8",fill:"none",strokeLinecap:"round"}),a.jsx("rect",{x:"86",y:"1",width:"30",height:"9",rx:"4.5",fill:"#f8fafc",stroke:"#cbd5e1",strokeWidth:"1"}),a.jsx("circle",{cx:"91.5",cy:"5.5",r:"1.8",fill:"#94a3b8"}),a.jsx("text",{x:"95",y:"7.5",fontSize:"4.4",fontWeight:"700",fill:"#64748b",fontFamily:"ui-sans-serif, system-ui, sans-serif",children:"SOON"})]})}],mle=[{icon:Qa,title:"Upload your knowledge base",body:"Drop in your services, pricing, FAQs, and policies — or point the agent at your website to scrape it automatically."},{icon:Sa,title:"Embed the voice widget",body:"One snippet on your site. The agent greets visitors in your brand voice within seconds."},{icon:Ka,title:"Capture leads & book live",body:"It qualifies the caller, answers their questions, and books a slot on the call — then routes the lead to your CRM."}],ple=[{icon:Ka,title:"Half price for 6 months",body:"Lock in 50% off any plan — founding rate stays yours while you stay subscribed."},{icon:xs,title:"Built around your business",body:"Direct line to the founder. Your knowledge base, calendar and voice tuned until it sounds like your best receptionist."},{icon:Qa,title:"White-glove setup",body:"We set up the agent for you — KB, calendar, embed — live in under a day."}];function Ed(e){return!!(e.annualPrice&&e.annualPrice.trim())}const gle=[{name:"Pay as you go",price:"$0.04",unit:"/ minute",tagline:"Try it on your site today. No commitment.",features:["Live voice agent","Custom knowledge base (PDFs, site scrape)","Appointment booking + calendar sync","Lead capture to dashboard","Email support"],cta:"Start free audition",planKey:"Pay-as-you-go",highlight:!1},{name:"Business",price:"$199",unit:"/ month",tagline:"For local businesses that want every call answered.",features:["5,000 voice minutes / mo","Whitelabel widget + your domain","Google Sheets + CRM webhook sync","Call recordings + transcripts","Priority support"],cta:"Get Business",planKey:"Business",highlight:!0},{name:"Enterprise",price:"Custom",unit:"",tagline:"High-volume, multi-location, custom workflows.",features:["Unlimited minutes & locations","Multi-location voice agents","Custom voice + workflow design","Dedicated capacity","SLA + onboarding engineer"],cta:"Talk to sales",planKey:"Enterprise",highlight:!1}],vle=[{name:"Starter Agency",price:"$99",unit:"/ month",tagline:"Freelancers launching their first voice-AI offering.",features:["Up to 5 client accounts","15,000 voice minutes","Vox Bridge branding","Standard support"],cta:"Select Starter",planKey:"Starter",highlight:!1},{name:"Growth Agency",price:"$299",unit:"/ month",tagline:"Established agencies scaling voice-AI as a service.",features:["Up to 25 client accounts","50,000 voice minutes","Fully whitelabeled dashboard & widgets","Priority support","Dedicated onboarding"],cta:"Select Growth",planKey:"Growth",highlight:!0},{name:"Enterprise",price:"$899",unit:"/ month",tagline:"Call centers & resellers running at scale.",features:["Unlimited clients & domains","200,000 voice minutes","Dedicated capacity","Custom whitelabel onboarding","Custom CRM webhook setup"],cta:"Select Enterprise",planKey:"Enterprise",highlight:!1}],xle=["All","Product","Agency","Channels","Regions"],yle=[{category:"Product",q:"How fast can I get a voice agent on my site?",a:"Most businesses are live in under a day: upload your knowledge base (or point us at your site), pick a voice, embed the widget snippet, and the agent is answering visitors. Custom CRM sync adds a few days."},{category:"Product",q:"What does it actually sound like?",a:"Like a calm, well-briefed receptionist. It replies in under a second, so there are no robotic pauses. Callers rarely realize it's an agent until you tell them."},{category:"Product",q:"Can it answer questions specific to my business?",a:"Yes. Upload PDFs, Word docs, CSV pricing tables, or let it scrape your website. It answers pricing, policy, hours, and service questions from that knowledge base — and stays in your brand voice."},{category:"Agency",q:"I run an agency — can I resell this as my own?",a:'Yes. The whitelabel tiers give you a fully branded dashboard and widgets on your domain, with per-client multipliers so you set the margin. Your clients never see "Vox Bridge".'},{category:"Product",q:"What happens to the leads and recordings?",a:"Every call becomes a structured lead with the caller's name, contact, purpose, booked slot, and recording. It syncs to your dashboard and can flow to Google Sheets, a CRM, or a webhook."},{category:"Regions",q:"Which regions are supported?",a:"Calls currently route through our US region, which gives the best call-start experience for North-American callers and stays responsive for UK/Europe. Asia-Pacific is on the roadmap — 
663contact us if Indo-Pak responsiveness is critical for you."},{category:"Channels",q:"Does it work on my phone line and WhatsApp?",a:"Today the agent is live on your website (real-time voice), WhatsApp Business (text and voice-note replies), and your phone line (PSTN inbound and outbound). WhatsApp voice calls are in active development — the same brain and brand voice follows you onto every channel."}];function ble({onNavigateToAuth:e,onBookSlot:t,onAddLead:n,onUpdateLead:i}){const r=et(me.queries.getPlatformDemo,{}),s=r!=null&&r.client?_S(r.client):null,l=ql(((r==null?void 0:r.slots)??[]).map(_S)),c=((r==null?void 0:r.kbItems)??[]).map(_S),h=We(me.mutations.addLead),[d,f]=w.useState(!1),[p,v]=w.useState({name:"",email:"",phone:"",message:""}),[x,b]=w.useState(!1),[S,N]=w.useState(!1),[j,T]=w.useState(null),E=async()=>{if(!(s!=null&&s.id)){T("The contact form isn't ready yet — please try again in a moment.");return}if(!p.name.trim()||!p.email.trim()||!p.message.trim()){T("Please fill in your name, email, and message.");return}b(!0),T(null);try{await h({clientId:s.id,visitorName:p.name.trim(),visitorEmail:p.email.trim(),visitorPhone:p.phone.trim(),purpose:`Contact form: ${p.message.trim().slice(0,500)}`,timestamp:new Date().toLocaleString(),status:"new",durationSeconds:0,tokenCost:0,channel:"form",source:"landing-contact"}),N(!0),v({name:"",email:"",phone:"",message:""})}catch(K){T((K==null?void 0:K.message)||"Couldn't send your message. Please try again.")}finally{b(!1)}},C=()=>{f(!1),setTimeout(()=>N(!1),300),T(null)},[P,A]=w.useState(!1),[M,R]=w.useState(null),B=K=>{R(K),A(!0)},U=async K=>{if(!M||!(s!=null&&s.id))return;await h({clientId:s.id,visitorName:K.split("@")[0],visitorEmail:K,visitorPhone:"",purpose:`Plan intent: ${M.name} (${M.planKey})`,timestamp:new Date().toLocaleString(),status:"new",durationSeconds:0,tokenCost:0,channel:"form",source:"landing-plan"});const Ft={Starter:"starter",Business:"business","Pay-as-you-go":"payg"}[M.planKey];if(Ft)try{const jt=await fetch("/api/stripe/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:Ft,email:K,currency:ge.toLowerCase()})});if(jt.ok){const{url:oi}=await jt.json();if(oi){window.location.href=oi;return}}}catch{}},[O,F]=w.useState(!1),[ne,re]=w.useState(!1),[Q,W]=w.useState(()=>{try{return localStorage.getItem("vb-cookie-consent")==="1"}catch{return!1}}),[q,$]=w.useState(!1),[ge,ue]=w.useState(()=>{try{const K=localStorage.getItem("vb-currency");if(K==="USD"||K==="GBP"||K==="EUR")return K}catch{}return ale()}),[L,J]=w.useState(_N),[ye,Pe]=w.useState(()=>{try{return!localStorage.getItem("vb-currency")}catch{return!0}});w.useEffect(()=>{let K=!1;return fetch("/api/geo").then(Ze=>Ze.ok?Ze.json():null).then(Ze=>{K||!Ze||(Ze.rates&&J({..._N,...Ze.rates}),Ze.country&&ye&&ue(rle(Ze.country)))}).catch(()=>{}),()=>{K=!0}},[]);const Oe=K=>{ue(K),Pe(!1);try{localStorage.setItem("vb-currency",K)}catch{}},je=K=>lle(K,ge,L),[Ke,ve]=w.useState(tle),[le,Be]=w.useState(!1),De=nle(Ke)??rv[0],[be,nt]=w.useState(!1);w.useEffect(()=>{const K=()=>nt(window.scrollY>300);return K(),window.addEventListener("scroll",K,{passive:!0}),()=>window.removeEventListener("scroll",K)},[]);const[ze,Le]=w.useState(""),[ht,yt]=w.useState("All"),on=yle.filter(K=>{const Ze=ht==="All"||K.category===ht,Ft=ze.trim().toLowerCase(),jt=!Ft||K.q.toLowerCase().includes(Ft)||K.a.toLowerCase().includes(Ft);return Ze&&jt}),[bt,Vt]=w.useState(!1),[tn,Qt]=w.useState(""),[Cn,pt]=w.useState(!1),[kn,Lt]=w.useState(!1),[On,zt]=w.useState(null),si=w.useRef(!1),qn=w.useRef(!1),qt=w.useRef(!1),ai=w.useRef(null),Zn=w.useRef(null);w.useEffect(()=>{if(!window.matchMedia("(hover: hover) and (pointer: fine)").matches)return;const K=jt=>{jt.target.closest('a[href="#demo"], a[href="#pricing"], a[href="#agency-pricing"], a[href="#how"], a[href="#channels"], a[href="#faq"]')&&(qn.current=!0)},Ze=()=>{const jt=document.getElementById("pricing");jt&&window.scrollY>jt.offsetTop-window.innerHeight&&(qt.current=!0)},Ft=jt=>{const oi=jt.relatedTarget;!(jt.clientY<=0&&!oi)||si.current||qn.current||qt.current||(si.current=!0,Vt(!0))};
663return document.addEventListener("click",K,{capture:!0}),window.addEventListener("scroll",Ze,{passive:!0}),document.addEventListener("mouseleave",Ft),()=>{document.removeEventListener("click",K,{capture:!0}),window.removeEventListener("scroll",Ze),document.removeEventListener("mouseleave",Ft)}},[]);const ct=async()=>{if(!tn.trim()){zt("Please enter your email.");return}if(!(s!=null&&s.id)){zt("The form isn't ready yet — please try again in a moment.");return}pt(!0),zt(null);try{await h({clientId:s.id,visitorName:tn.trim().split("@")[0]||"Demo request",visitorEmail:tn.trim(),visitorPhone:"",purpose:"Exit intent: book a demo",timestamp:new Date().toLocaleString(),status:"new",durationSeconds:0,tokenCost:0,channel:"form",source:"landing-exit"}),Lt(!0)}catch(K){zt((K==null?void 0:K.message)||"Couldn't send your request. Please try again.")}finally{pt(!1)}};w.useEffect(()=>{var K,Ze;d?(ai.current=document.activeElement,requestAnimationFrame(()=>{var Ft,jt;(jt=(Ft=Zn.current)==null?void 0:Ft.querySelector("input, textarea, button"))==null||jt.focus()})):ai.current&&((Ze=(K=ai.current).focus)==null||Ze.call(K),ai.current=null)},[d]);const ln=K=>{if(K.key==="Escape"){C();return}if(K.key!=="Tab"||!Zn.current)return;const Ze=Zn.current.querySelectorAll("button, a[href], input, textarea, select");if(Ze.length===0)return;const Ft=Ze[0],jt=Ze[Ze.length-1];K.shiftKey&&document.activeElement===Ft?(K.preventDefault(),jt.focus()):!K.shiftKey&&document.activeElement===jt&&(K.preventDefault(),Ft.focus())},Ut=async K=>{if(!(s!=null&&s.id))throw new Error("The booking form isn't ready yet — please try again in a moment.");t(K.slotId,K.name,{email:K.email,phone:K.phone,purpose:K.purpose}),await h({clientId:s.id,visitorName:K.name,visitorEmail:K.email,visitorPhone:K.phone,purpose:`Demo booking: ${K.purpose}`,timestamp:new Date().toLocaleString(),status:"booked",bookedSlot:K.slotDateTime,durationSeconds:0,tokenCost:0,channel:"form",source:"landing-booking"})},Wn=et(me.queries.listPricingTiers,{}),_i=Wn===void 0,nn=(Wn??[]).filter(K=>K.audience==="direct").length>0?(Wn??[]).filter(K=>K.audience==="direct"):gle,Bt=(Wn??[]).filter(K=>K.audience==="agency").length>0?(Wn??[]).filter(K=>K.audience==="agency"):vle,Dt=({dark:K=!1})=>a.jsxs("div",{className:`rounded-2xl p-6 border flex flex-col ${K?"border-slate-700 bg-slate-900/50":"border-slate-100 bg-white shadow-sm"}`,"aria-hidden":"true",children:[a.jsx("div",{className:`w-24 h-3 rounded-full animate-pulse ${K?"bg-slate-700":"bg-slate-200"}`}),a.jsx("div",{className:`mt-3 w-28 h-8 rounded-lg animate-pulse ${K?"bg-slate-700":"bg-slate-200"}`}),a.jsx("div",{className:`mt-4 w-full h-3 rounded-full animate-pulse ${K?"bg-slate-800":"bg-slate-100"}`}),a.jsx("div",{className:`mt-2 w-5/6 h-3 rounded-full animate-pulse ${K?"bg-slate-800":"bg-slate-100"}`}),a.jsx("div",{className:"space-y-2 mt-5 flex-1",children:[0,1,2,3].map(Ze=>a.jsx("div",{className:`w-full h-2.5 rounded-full animate-pulse ${K?"bg-slate-800":"bg-slate-100"}`},Ze))}),a.jsx("div",{className:`mt-5 w-full h-10 rounded-xl animate-pulse ${K?"bg-slate-800":"bg-slate-200"}`})]});return a.jsxs("div",{className:"min-h-screen bg-white text-slate-800 font-sans flex flex-col",children:[a.jsx("nav",{className:"bg-white/80 backdrop-blur-md sticky top-0 z-40 border-b border-slate-100 px-6 py-3",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"bg-indigo-600 p-2 rounded-xl text-white",children:a.jsx(Uo,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex items-baseline gap-1.5",children:[a.jsx("span",{className:"font-bold font-display text-lg tracking-tight text-slate-900",children:"Vox Bridge"}),a.jsx("span",{className:"text-[9px] bg-indigo-100 text-indigo-700 font-semibold uppercase px-1.5 py-0.5 rounded-md",children:"Voice AI"})]})]}),a.jsxs("div",{className:"hidden md:flex items-center gap-6 text-sm font-medium text-slate-600",children:[a.jsx("a",{href:"#how",className:"hover:text-slate-900 transition-colors",children:"How it works"}),a.jsx("a",{href:"#channels",className:"hover:text-slate-900 transition-colors",children:"Channels"}),a.jsx("a",{href:"#audience",className:"hover:text-slate-900 transition-colors",children:"For Agencies"}),a.jsx("a",{href:"#demo",className:"hover:text-slate-900 transition-colors",children:"Live Demo"}),a.jsx("a",{href:"#pricing",className:"hover:text-slate-900 transition-colors",children:"Pricing"}),a.jsx("a",{href:"#faq",className:"hover:text-slate-900 transition-colors",children:"FAQ"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>F(!0),className:"hidden sm:flex items-center gap-1.5 text-indigo-700 bg-indigo-50 hover:bg-indigo-100 border border-indigo-100 text-xs px-3.5 py-2 rounded-xl font-bold transition-all cursor-pointer",children:[a.jsx(Ka,{className:"w-3.5 h-3.5"}),"Book a demo"]}),a.jsx("button",{onClick:()=>e("login"),className:"hidden sm:inline-flex text-slate-600 hover:text-slate-900 text-sm font-semibold transition-colors cursor-pointer",children:"Sign In"}),a.jsxs("button",{onClick:()=>e("signup"),className:"hidden sm:inline-flex bg-indigo-600 hover:bg-indigo-500 text-white text-xs px-4 py-2 rounded-xl font-bold transition-all shadow-sm hover:shadow cursor-pointer items-center gap-1.5",children:["Get Started ",a.jsx(hs,{className:"w-3.5 h-3.5"})]}),a.jsx("button",{onClick:()=>re(K=>!K),className:"md:hidden p-2 text-slate-700 hover:bg-slate-100 rounded-lg transition-colors cursor-pointer","aria-label":"Toggle navigation menu",children:ne?a.jsx(fn,{className:"w-5 h-5"}):a.jsx(YQ,{className:"w-5 h-5"})})]}),a.jsx(Zc,{children:ne&&a.jsx(pn.div,{initial:{height:0,opacity:0}
663,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeInOut"},className:"md:hidden absolute top-full left-0 right-0 bg-white/95 backdrop-blur-md border-b border-slate-100 shadow-lg overflow-hidden",children:a.jsxs("div",{className:"flex flex-col px-6 py-4 space-y-3",children:[[{href:"#how",label:"How it works"},{href:"#channels",label:"Channels"},{href:"#audience",label:"For Agencies"},{href:"#demo",label:"Live Demo"},{href:"#pricing",label:"Pricing"},{href:"#faq",label:"FAQ"}].map(K=>a.jsx("a",{href:K.href,onClick:()=>re(!1),className:"text-sm font-semibold text-slate-700 hover:text-indigo-600 py-2 px-3 rounded-xl hover:bg-indigo-50 transition-colors",children:K.label},K.href)),a.jsx("hr",{className:"border-slate-100 my-1"}),a.jsxs("button",{onClick:()=>{re(!1),F(!0)},className:"flex items-center gap-2 text-sm font-semibold text-indigo-700 bg-indigo-50 hover:bg-indigo-100 py-2.5 px-3 rounded-xl transition-colors text-left",children:[a.jsx(Ka,{className:"w-4 h-4"})," Book a demo call"]}),a.jsx("button",{onClick:()=>{re(!1),e("login")},className:"text-sm font-semibold text-slate-600 hover:text-slate-900 py-2.5 px-3 rounded-xl hover:bg-slate-50 transition-colors text-left",children:"Sign In"}),a.jsxs("button",{onClick:()=>{re(!1),e("signup")},className:"bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold py-2.5 px-3 rounded-xl transition-all shadow-sm text-left",children:["Get Started ",a.jsx(hs,{className:"w-3.5 h-3.5 inline"})]})]})})})]})}),a.jsxs("section",{className:"relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-indigo-50/60 via-white to-white pointer-events-none"}),a.jsx("div",{className:"absolute -top-24 -right-24 w-96 h-96 bg-indigo-200/40 rounded-full blur-3xl pointer-events-none"}),a.jsx("div",{className:"absolute -bottom-32 -left-24 w-96 h-96 bg-fuchsia-200/30 rounded-full blur-3xl pointer-events-none"}),a.jsxs("div",{className:"relative max-w-7xl mx-auto px-6 py-16 md:py-24 grid grid-cols-1 lg:grid-cols-12 gap-12 items-center",children:[a.jsxs("div",{className:"lg:col-span-7 space-y-7",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold border border-indigo-100 shadow-sm",children:[a.jsx(xs,{className:"w-3.5 h-3.5"}),"Omnichannel Voice AI · Live in under a day"]}),a.jsxs("h1",{className:"text-4xl sm:text-5xl md:text-6xl font-extrabold font-display leading-[1.05] tracking-tight text-slate-900",children:["Every call, text & voice note —",a.jsx("span",{className:"block text-indigo-600",children:"answered, booked & followed up."})]}),a.jsx("p",{className:"text-base sm:text-lg text-slate-600 max-w-2xl leading-relaxed",children:"Vox Bridge is the AI voice agent that picks up on your website, WhatsApp, and phone line — answers from your knowledge base, books the appointment live, fires the confirmation email, and routes a qualified lead to your CRM. Phone-line (PSTN) calls connect straight to the agent, and WhatsApp voice calls are coming soon. Whitelabel it to your clients and keep the margin."}),a.jsxs("div",{className:"flex flex-wrap gap-3 pt-1",children:[a.jsxs("a",{href:"#demo",className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold px-6 py-3.5 rounded-xl transition-all shadow-lg shadow-indigo-600/20 flex items-center gap-2 cursor-pointer",children:[a.jsx(Uo,{className:"w-4 h-4"}),"Try the Voice Agent"]}),a.jsxs(pn.button,{onClick:()=>F(!0),whileHover:{scale:1.04,y:-1},whileTap:{scale:.96},animate:{boxShadow:["0 0 0 0 rgba(217, 70, 239, 0.35)","0 0 0 10px rgba(217, 70, 239, 0)"]},transition:{repeat:1/0,duration:1.8,ease:"easeOut"},className:"bg-gradient-to-r from-indigo-600 via-purple-600 to-fuchsia-600 text-white font-semibold px-6 py-3.5 rounded-xl shadow-lg shadow-fuchsia-600/25 flex items-center gap-2 cursor-pointer",children:[a.jsx(pn.span,{animate:{y:[0,-2,0]},transition:{repeat:1/0,duration:1.8,ease:"easeInOut"},className:"inline-flex",children:a.jsx(Ka,{className:"w-4 h-4"})}),"Book a demo call"]})]}),a.jsxs("p",{className:"text-xs text-slate-400 flex items-center gap-1.5 pt-1",children:[a.jsx(kt,{className:"w-3.5 h-3.5 text-emerald-500"}),"No credit card to audition · Live in under a day"]}),a.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1.5 pt-1.5",children:[a.jsx(Ei,{className:"w-3.5 h-3.5 text-indigo-500"}),"Prefer to talk? Call us at"," ",a.jsx("a",{href:"tel:+16467381670",className:"text-indigo-600 font-semibold hover:text-indigo-500",children:"+1 (646) 738-1670"})," ","or"," ",a.jsx("a",{href:"https://wa.me/16467381670?text=Hi%20Vox%20Bridge!%20I%27d%20like%20to%20learn%20more%20about%20your%20AI%20voice%20agent.",target:"_blank",rel:"noopener noreferrer",className:"text-emerald-600 font-semibold hover:text-emerald-500",children:"WhatsApp us"})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 pt-8 border-t border-slate-200",children:cle.map(K=>a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl sm:text-3xl font-bold font-display text-slate-900",children:K.value}),a.jsx("div",{className:"text-[11px] text-slate-500 font-medium leading-tight mt-0.5",children:K.label})]},K.label))})]}),a.jsxs("div",{id:"demo",className:"lg:col-span-5 bg-white rounded-3xl p-4 shadow-2xl shadow-indigo-900/10 border border-slate-100 flex flex-col justify-between scroll-mt-24",children:[a.jsxs("div",{className:"mb-3 px-2 flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-slate-500",children:[a.jsx(AQ,{className:"w-4 h-4 text-indigo-600"}),"Live Demo — talk to Vox"]}),a.jsxs("span",{className:"text-[10px] font-semibold text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-full flex items-center gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"})," Live now"]})]}),a.jsxs("div",{className:"bg-gradient-to-br from-slate-50 to-indigo-50/50 rounded-2xl p-4 border border-slate-200 mb-4 text-xs",children:[a.jsx("h4",{className:"font-bold text-slate-800",children:"Vox Bridge Platform"}),a.jsx("p",{className:"text-[10px] text-slate-500 mt-0.5",children:"Ask Vox about pricing, whitelabel, or book a demo call."}),a.jsx("div",{className:"h-1 bg-indigo-200 w-16 rounded mt-2"})]}),a.jsxs("fieldset",{className:"mb-4 px-1",children:[a.jsxs("legend",{className:"flex items-center justify-between w-full text-[10px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(xm,{className:"w-3 h-3 text-indigo-600"})," Voice & language"]}),a.jsxs("span",{className:"normal-case tracking-normal font-semibold text-slate-400",children:[Qv," languages supported"]})]}),a.jsx("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup","aria-label":"Demo voice language",children:rv.map(K=>{const Ze=Ke===K.key;return a.jsxs("label",{className:`flex items-center gap-2 rounded-xl border px-2.5 py-2 text-xs font-semibold cursor-pointer transition-colors select-none ${Ze?"border-indigo-500 bg-indigo-50 text-indigo-700 ring-1 ring-indigo-500":"border-slate-200 bg-white text-slate-600 hover:border-indigo-300"}`,children:[a.jsx("input",{type:"radio",name:"demo-language",value:K.key,checked:Ze,onChange:()=>ve(K.key),className:"sr-only"}
663),a.jsx(Hf,{cc:K.cc,fallback:K.flag,size:22}),a.jsx("span",{className:"truncate",children:K.label})]},K.key)})}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>Be(K=>!K),"aria-expanded":le,className:"inline-flex items-center gap-1 text-[11px] font-semibold text-indigo-600 hover:text-indigo-500 cursor-pointer",children:[a.jsx("span",{className:"inline-flex -space-x-1","aria-hidden":"true",children:sv.slice(0,5).map(K=>a.jsx("span",{className:"inline-flex",children:a.jsx(Hf,{cc:K.cc,fallback:K.flag,size:16,className:"ring-1 ring-white"})},K.key))}),"More languages",a.jsx(Ek,{className:`w-3 h-3 transition-transform ${le?"rotate-180":""}`})]}),a.jsxs("span",{className:"text-[10px] text-slate-400 truncate",children:["Speaking ",a.jsxs("span",{className:"font-semibold text-slate-600 inline-flex items-center gap-1 align-middle",children:[a.jsx(Hf,{cc:De.cc,fallback:De.flag,size:14})," ",De.label]})," on your next call"]})]}),a.jsx(Zc,{initial:!1,children:le&&a.jsxs(pn.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:[a.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:sv.map(K=>{const Ze=Ke===K.key;return a.jsxs("button",{type:"button",onClick:()=>ve(K.key),"aria-pressed":Ze,title:K.label,className:`inline-flex items-center gap-1 rounded-full border px-2 py-1 text-[11px] font-semibold cursor-pointer transition-colors ${Ze?"border-indigo-500 bg-indigo-50 text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:border-indigo-300"}`,children:[a.jsx(Hf,{cc:K.cc,fallback:K.flag,size:16})," ",K.label]},K.key)})}),a.jsxs("p",{className:"mt-2 text-[10px] text-slate-400",children:["Plus ",Qv-rv.length-sv.length," more — the agent follows whatever language your caller speaks."]})]},"more-languages")})]}),s?a.jsx(GC,{clientId:s.id,clientName:s.name,companyName:s.companyName,greetingPrompt:s.greetingPrompt,assignedWorkflowPrompt:"",slots:l,kbItems:c,onBookSlot:t,onAddLead:n,onUpdateLead:i,minimal:!0,language:De.language}):a.jsx("div",{className:"rounded-2xl border border-dashed border-slate-200 bg-slate-50/50 p-8 text-center text-xs text-slate-400",children:"Preparing the live demo receptionist…"}),a.jsxs("div",{className:"mt-4 rounded-2xl border border-slate-100 bg-slate-50/60 p-4 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-slate-800",children:[a.jsx(yv,{className:"w-3.5 h-3.5 text-indigo-600 shrink-0"}),"What the demo agent already knows"]}),a.jsx("ul",{className:"mt-2.5 space-y-1.5",children:ule.map(K=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-3 h-3 text-emerald-500 mt-0.5 shrink-0"}),a.jsxs("span",{className:"text-slate-600",children:[a.jsx("span",{className:"font-semibold text-slate-700",children:K.title})," — ",K.blurb]})]},K.title))}),a.jsxs("a",{href:"#how",className:"mt-3 inline-flex items-center gap-1 text-indigo-600 font-semibold hover:text-indigo-500",children:["Train yours on your own docs ",a.jsx(hs,{className:"w-3 h-3"})]})]})]})]})]}),a.jsx("section",{className:"border-y border-slate-100 bg-slate-50/50",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-6 flex flex-wrap items-center justify-center gap-x-10 gap-y-3 text-xs font-semibold text-slate-500",children:[a.jsx("span",{className:"text-slate-400 uppercase tracking-wider text-[10px]",children:"Now onboarding"}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(a5,{className:"w-3.5 h-3.5 text-amber-500"})," 10 founding client spots — 50% off for 6 months"]}),a.jsx("span",{children:"Built by a 20-year creative-tech veteran"}),a.jsx("span",{children:"Live in under a day"})]})}),a.jsx("section",{className:"border-b border-slate-100 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-4 flex flex-wrap items-center justify-center gap-x-8 gap-y-2 text-[11px] text-slate-500",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Qa,{className:"w-3.5 h-3.5 text-emerald-500"})," Encrypted in transit & at rest"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Qa,{className:"w-3.5 h-3.5 text-emerald-500"})," Per-tenant data isolation"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Qa,{className:"w-3.5 h-3.5 text-emerald-500"})," No call recordings without consent"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Qa,{className:"w-3.5 h-3.5 text-emerald-500"})," Delete-your-data on request"]})]})}),a.jsxs("section",{id:"channels",className:"py-16 px-6 max-w-7xl mx-auto w-full scroll-mt-20",children:[a.jsxs("div",{className:"text-center max-w-2xl mx-auto 
663space-y-3 mb-10",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold",children:[a.jsx(xm,{className:"w-3.5 h-3.5"})," One agent, every channel"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Meet your customers wherever they reach you."}),a.jsx("p",{className:"text-slate-500 text-sm sm:text-base",children:"The same brain, brand voice, and knowledge base across every channel — with more on the way."})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:fle.map(K=>a.jsxs("div",{className:"p-5 bg-white rounded-2xl border border-slate-100 shadow-sm flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-indigo-500 to-purple-500 text-white rounded-xl flex items-center justify-center shadow-md shadow-indigo-500/20",children:a.jsx(K.icon,{className:"w-5 h-5"})}),a.jsx("span",{className:`text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full ${K.live?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"}`,children:K.status})]}),K.mockup?a.jsx("div",{className:"mt-4 rounded-xl overflow-hidden border border-slate-100 bg-slate-50/60",children:K.mockup}):null,a.jsx("h3",{className:"font-bold text-slate-900 mt-3 text-sm",children:K.name}),a.jsx("p",{className:"text-xs text-slate-500 leading-relaxed mt-1.5",children:K.body})]},K.name))})]}),a.jsxs("section",{id:"features",className:"py-20 px-6 max-w-7xl mx-auto w-full",children:[a.jsxs(pn.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5},className:"text-center max-w-2xl mx-auto space-y-3 mb-12",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold",children:[a.jsx(Uu,{className:"w-3.5 h-3.5"})," Why Vox Bridge"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Everything a great receptionist does — without the hold music."}),a.jsx("p",{className:"text-slate-500 text-sm sm:text-base",children:"One agent across web, phone, and WhatsApp — answering questions, booking the slot, and taking real actions in your brand voice, on every channel."})]}),a.jsx(pn.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0,margin:"-80px"},transition:{staggerChildren:.08,delayChildren:.15},className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:hle.map(K=>a.jsxs(pn.div,{variants:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0}},transition:{duration:.4},className:"group p-6 bg-white rounded-2xl border border-slate-100 shadow-sm hover:shadow-lg hover:-translate-y-0.5 transition-all",children:[a.jsx("div",{className:"w-11 h-11 bg-gradient-to-br from-indigo-500 to-purple-500 text-white rounded-xl flex items-center justify-center shadow-md shadow-indigo-500/20",children:a.jsx(K.icon,{className:"w-5 h-5"})}),a.jsx("h3",{className:"font-bold text-slate-900 mt-4 text-base",children:K.title}),a.jsx("p",{className:"text-sm text-slate-500 leading-relaxed mt-1.5",children:K.body})]},K.title))}),a.jsxs(pn.div,{initial:{opacity:0,y:24},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5,delay:.1},className:"relative mt-10 overflow-hidden rounded-3xl",children:[a.jsx("img",{src:"https://images.unsplash.com/photo-1522071820081-009f0129c71c?auto=format&fit=crop&w=1600&h=640&q=80",srcSet:MN("https://images.unsplash.com/photo-1522071820081-009f0129c71c?auto=format&fit=crop&w=1600&h=640&q=80",1600),sizes:"(max-width: 1024px) 100vw, 1280px",alt:"A small team heads together over one laptop at a shared desk",loading:"lazy",className:"w-full h-56 sm:h-72 object-cover object-center"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-indigo-950/85 via-indigo-900/55 to-fuchsia-900/35"}),a.jsx("div",{className:"absolute inset-0 flex items-center px-6 sm:px-12",children:a.jsxs("p",{className:"text-white text-lg sm:text-2xl font-bold font-display leading-snug max-w-xl",children:["Front-desk work doesn't stop at 5pm.",a.jsx("span",{className:"block mt-1 text-white/80 text-sm sm:text-base font-medium",children:"Vox Bridge answers the calls your inbox can't — before, during, and after hours."})]})})]})]}),a.jsx("section",{id:"how",className:"py-20 px-6 bg-slate-50/60 border-y border-slate-100",children:a.jsxs("div",{className:"max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-12 gap-12 items-center",children:[a.jsxs("div",{className:"lg:col-span-5 space-y-4",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold border border-indigo-100",children:[a.jsx(Sa,{className:"w-3.5 h-3.5"}
663)," How it works"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Live in three steps — no engineers required."}),a.jsx("p",{className:"text-slate-500 text-sm sm:text-base leading-relaxed",children:"From signup to a working voice receptionist on your site in under a day. The same setup scales whether you run one business or fifty client sites."}),a.jsxs("a",{href:"#demo",className:"inline-flex items-center gap-2 text-indigo-600 font-semibold text-sm hover:text-indigo-500 cursor-pointer",children:["See it live ",a.jsx(hs,{className:"w-4 h-4"})]})]}),a.jsx("div",{className:"lg:col-span-7 grid grid-cols-1 sm:grid-cols-3 gap-4",children:mle.map((K,Ze)=>a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-5 shadow-sm relative",children:[a.jsx("span",{className:"absolute -top-3 left-5 w-7 h-7 rounded-full bg-indigo-600 text-white text-xs font-bold flex items-center justify-center font-mono shadow",children:Ze+1}),a.jsx("div",{className:"w-10 h-10 bg-indigo-50 text-indigo-600 rounded-xl flex items-center justify-center mt-3",children:a.jsx(K.icon,{className:"w-5 h-5"})}),a.jsx("h3",{className:"font-bold text-slate-900 mt-3 text-sm",children:K.title}),a.jsx("p",{className:"text-xs text-slate-500 leading-relaxed mt-1.5",children:K.body})]},K.title))})]})}),a.jsxs("section",{id:"audience",className:"py-20 px-6 max-w-7xl mx-auto w-full scroll-mt-20",children:[a.jsxs(pn.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5},className:"text-center max-w-2xl mx-auto space-y-3 mb-12",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-fuchsia-50 text-fuchsia-700 px-3 py-1 rounded-full text-xs font-semibold",children:[a.jsx(HX,{className:"w-3.5 h-3.5"})," Two ways to use Vox Bridge"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Run it on your site — or resell it as your own."}),a.jsx("p",{className:"text-slate-500 text-sm sm:text-base",children:"Whether you want one voice agent for your business or a voice-AI practice for your agency, the same platform."})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(pn.div,{initial:{opacity:0,x:-30},whileInView:{opacity:1,x:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5,delay:.1},className:"relative rounded-3xl overflow-hidden border border-slate-100 shadow-lg",children:[a.jsx(XR,{src:"https://images.unsplash.com/photo-1626863905121-3b0c0ed7b94c?auto=format&fit=crop&crop=faces&w=1200&q=80",alt:"Receptionist wearing a black headset, ready to greet your callers",className:"h-64 w-full",gradient:"from-indigo-500 via-blue-500 to-cyan-400",overlay:"bg-gradient-to-r from-indigo-950/85 via-indigo-900/55 to-fuchsia-900/35"}),a.jsxs("div",{className:"bg-white p-7 space-y-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-[10px] font-bold bg-indigo-100 text-indigo-700 uppercase px-2 py-0.5 rounded",children:"For Direct Businesses"})}),a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"A receptionist that never misses a call"}),a.jsx("p",{className:"text-sm text-slate-500 leading-relaxed",children:"Put Vox Bridge on your website. It greets every visitor, answers questions from your knowledge base, books the appointment on the call, and routes the lead to your CRM."}),a.jsxs("ul",{className:"space-y-2 text-sm text-slate-700",children:[a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"})," Embed the widget in minutes — no engineers"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"})," Answers pricing, hours & policy from your docs"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"})," Books real slots from your calendar, live"]})]}),a.jsxs("a",{href:"#pricing",className:"inline-flex items-center gap-2 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold px-5 py-2.5 rounded-xl text-sm transition-all cursor-pointer",children:["See business pricing ",a.jsx(hs,{className:"w-4 h-4"})]})]})]}),a.jsxs(pn.div,{initial:{opacity:0,x:30},whileInView:{opacity:1,x:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5,delay:.15},className:"relative rounded-3xl overflow-hidden border border-indigo-100 shadow-lg bg-gradient-to-br from-slate-900 to-indigo-950 text-white",children:[a.jsx(XR,{src:"https://images.unsplash.com/photo-1689951993116-28ed
6635c41241c?auto=format&fit=crop&crop=faces&w=1200&q=80",alt:"Audio mixing control panel — the voice engine behind your white-label agents",className:"h-64 w-full opacity-90",gradient:"from-indigo-700 via-purple-700 to-fuchsia-700",overlay:"bg-gradient-to-r from-indigo-950/85 via-indigo-900/55 to-fuchsia-900/35"}),a.jsxs("div",{className:"p-7 space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[10px] font-bold bg-indigo-500 text-white uppercase px-2 py-0.5 rounded",children:"For Agencies"}),a.jsx("span",{className:"text-[10px] font-bold bg-fuchsia-500 text-white uppercase px-2 py-0.5 rounded",children:"Whitelabel"})]}),a.jsx("h3",{className:"text-xl font-bold font-display",children:"Ship a voice-AI product under your own brand"}),a.jsx("p",{className:"text-sm text-slate-300 leading-relaxed",children:"Give every client a branded voice receptionist with a fully white-labeled dashboard and widgets on your domain. You set per-client pricing and keep the margin; Vox Bridge handles everything behind the scenes."}),a.jsxs("ul",{className:"space-y-2 text-sm text-slate-200",children:[a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-indigo-300 mt-0.5 shrink-0"})," White-labeled dashboard, widgets & domain"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-indigo-300 mt-0.5 shrink-0"})," Per-client multipliers — you set the margin"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-indigo-300 mt-0.5 shrink-0"})," Manage unlimited clients from one console"]})]}),a.jsxs("a",{href:"#agency-pricing",className:"inline-flex items-center gap-2 bg-white text-slate-900 hover:bg-slate-100 font-semibold px-5 py-2.5 rounded-xl text-sm transition-all cursor-pointer",children:["See whitelabel tiers ",a.jsx(hs,{className:"w-4 h-4"})]})]})]})]})]}),a.jsx("section",{className:"py-20 px-6 bg-slate-50/60 border-y border-slate-100",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-10",children:[a.jsxs(pn.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5},className:"text-center max-w-2xl mx-auto space-y-3",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white text-amber-600 px-3 py-1 rounded-full text-xs font-semibold border border-amber-100",children:[a.jsx(Um,{className:"w-3.5 h-3.5 fill-amber-400 stroke-amber-400"})," Don't take our word for it"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Judge it yourself — it's talking right now."}),a.jsx("p",{className:"text-slate-600",children:"No screenshots, no cherry-picked quotes. Scroll up and have a real conversation with the agent — ask it to book a slot, then decide."})]}),a.jsxs("div",{className:"grid lg:grid-cols-2 gap-6 items-stretch",children:[a.jsxs("div",{className:"rounded-3xl border border-slate-100 bg-white p-8 shadow-sm flex flex-col justify-between gap-6",children:[a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Hear it with your own business"}),a.jsx("p",{className:"text-sm text-slate-600 mt-2",children:"We'll train a version of the agent on your website, services and FAQs — then give you a number to call and a widget to click. Free, set up in under a day."})]}),a.jsxs("ul",{className:"space-y-3 text-sm text-slate-700",children:[a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"})," Answers pricing, hours & policy questions from your own content"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"})," Offers real calendar slots and books them live"]}),a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500 mt-0.5 shrink-0"})," No credit card, no contract — keep it if it earns its keep"]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsxs("a",{href:"#demo",className:"inline-flex items-center gap-2 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold px-5 py-2.5 rounded-xl text-sm transition-colors",children:["Talk to the live demo ",a.jsx(hs,{className:"w-4 h-4"})]}),a.jsx("button",{onClick:()=>f(!0),className:"inline-flex items-center gap-2 bg-white text-slate-900 border border-slate-200 hover:border-indigo-300 font-semibold px-5 py-2.5 rounded-xl text-sm transition-colors cursor-pointer",children:"Request my free audition"})]})]}),a.jsxs("div",{className:"rounded-3xl bg-slate-900 text-white p-8 shadow-sm relative overflow-hidden",children:[a.jsx("div",{className:"absolute -top-16 -right-16 w-56 h-56 rounded-full bg-indigo-500/20 blur-2xl"}),a.jsxs("div",{className:"relative space-y-5",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white/10 text-amber-300 px-3 py-1 rounded-full text-xs font-semibold border border-white/10",children:[a.jsx(a5,{className:"w-3.5 h-3.5"})," Founding client program"]}),a.jsx("h3",{className:"text-2xl font-bold font-display",children:"10 spots. Half price for 6 months."}),a.jsx("p",{className:"text-sm text-slate-300",children:"We're a new platform, and we'd rather earn trust with a deal than with adjectives. The first 10 businesses get:"}),a.jsx("ul",{className:"space-y-4",children:ple.map(K=>a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"w-9 h-9 rounded-xl bg-white/10 flex items-center justify-center shrink-0",children:a.jsx(K.icon,{className:"w-4.5 h-4.5 text-amber-300"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold",children:K.title}),a.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:K.body})]})]},K.title))}),a.jsxs("a",{href:"#pricing",className:"inline-flex items-center gap-2 bg-white text-slate-900 hover:bg-slate-100 font-semibold px-5 py-2.5 rounded-xl text-sm transition-colors",children:["Claim a founding spot ",a.jsx(hs,{className:"w-4 h-4"})]})]})]})]})]})}),a.jsxs("section",{id:"pricing",className:"py-20 px-6 max-w-7xl mx-auto w-full scroll-mt-20",children:[a.jsxs("div",{className:"text-center max-w-2xl mx-auto 
663space-y-3 mb-10",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-indigo-50 text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold",children:[a.jsx(Ka,{className:"w-3.5 h-3.5"})," Pricing"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Start small. Scale to a whitelabel practice."}),a.jsx("p",{className:"text-slate-500 text-sm sm:text-base",children:"Direct plans for one business, whitelabel tiers for agencies. Cancel or upgrade anytime."})]}),a.jsxs("div",{className:"flex items-center justify-center gap-3 mb-10",children:[a.jsx("span",{className:`text-xs font-semibold transition-colors ${q?"text-slate-400":"text-slate-900"}`,children:"Monthly"}),a.jsx("button",{onClick:()=>$(K=>!K),className:`relative w-12 h-6 rounded-full transition-colors cursor-pointer ${q?"bg-indigo-600":"bg-slate-300"}`,"aria-label":"Toggle annual billing",children:a.jsx(pn.span,{animate:{x:q?24:2},transition:{type:"spring",stiffness:500,damping:30},className:"absolute top-1 left-0 w-4 h-4 bg-white rounded-full shadow-sm"})}),a.jsxs("span",{className:`text-xs font-semibold transition-colors flex items-center gap-1.5 ${q?"text-indigo-700":"text-slate-400"}`,children:["Annual",q&&a.jsx("span",{className:"text-[9px] bg-indigo-100 text-indigo-700 font-bold px-1.5 py-0.5 rounded",children:"Where offered"})]})]}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 -mt-6 mb-10",children:[a.jsx("div",{className:"inline-flex items-center rounded-full border border-slate-200 bg-white p-0.5 shadow-sm",role:"radiogroup","aria-label":"Display currency",children:["USD","GBP","EUR"].map(K=>a.jsxs("button",{type:"button",role:"radio","aria-checked":ge===K,onClick:()=>Oe(K),className:`px-3 py-1 rounded-full text-[11px] font-semibold transition-colors cursor-pointer ${ge===K?"bg-slate-900 text-white":"text-slate-500 hover:text-slate-900"}`,children:[a.jsx(Hf,{cc:Fd[K].cc,fallback:Fd[K].flag,size:16,className:"align-[-3px]"})," ",Fd[K].label]},K))}),a.jsx("p",{className:"text-[10px] text-slate-400",children:ge==="USD"?"Prices in US dollars.":`Shown in ${Fd[ge].label} at today's rate · billed in ${Fd[ge].label} where available, otherwise USD.`})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5 mb-12",children:_i?a.jsxs(a.Fragment,{children:[a.jsx(Dt,{}),a.jsx(Dt,{}),a.jsx(Dt,{})]}):nn.map(K=>a.jsxs(pn.div,{animate:K.highlight?{boxShadow:["0 0 0 0 rgba(99, 102, 241, 0.25)","0 0 0 8px rgba(99, 102, 241, 0)"]}:void 0,transition:K.highlight?{repeat:1/0,duration:2.5,ease:"easeOut"}:void 0,className:`relative rounded-2xl p-6 border bg-white shadow-sm flex flex-col ${K.highlight?"border-indigo-500 border-2 shadow-lg shadow-indigo-500/10":"border-slate-100"}`,children:[K.highlight&&a.jsx("span",{className:"absolute -top-3 left-6 bg-indigo-600 text-white text-[10px] font-bold uppercase tracking-wide px-2.5 py-1 rounded-full",children:"Most popular"}),a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:K.name}),a.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[a.jsx("span",{className:"text-3xl font-extrabold font-display text-slate-900",children:je(q&&Ed(K)?K.annualPrice:K.price)}),a.jsx("span",{className:"text-sm text-slate-400",children:q&&Ed(K)?"/ yr":K.unit}),q&&Ed(K)&&a.jsx("span",{className:"ml-2 text-[9px] bg-emerald-100 text-emerald-700 font-bold px-1.5 py-0.5 rounded",children:"Best value"})]}),a.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:K.tagline}),a.jsx("ul",{className:"space-y-2 text-xs text-slate-700 mt-4 flex-1",children:K.features.map(Ze=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-3.5 h-3.5 text-emerald-500 mt-0.5 shrink-0"})," ",Ze]},Ze))}),a.jsx("button",{onClick:()=>B(K),className:`mt-5 w-full font-semibold py-2.5 rounded-xl text-sm transition-colors cursor-pointer ${K.highlight?"bg-indigo-600 hover:bg-indigo-500 text-white":"bg-slate-100 hover:bg-slate-200 text-slate-800"}`,children:K.cta})]},K.name))}),a.jsxs("div",{id:"agency-pricing",className:"rounded-3xl bg-slate-900 text-white p-8 md:p-10 scroll-mt-20",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(iy,{className:"w-4 h-4 text-indigo-400"}),a.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-indigo-300",children:"Whitelabel for Agencies"})]}),a.jsx("h3",{className:"text-xl font-bold font-display",children:"Resell voice AI under your own brand"}),a.jsx("p",{className:"text-slate-400 text-sm mt-1",children:"Per-client multipliers, fully white-labeled dashboards & widgets, dedicated support."}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5 mt-8",children:_i?a.jsxs(a.Fragment,{children:[a.jsx(Dt,{dark:!0}),a.jsx(Dt,{dark:!0}),a.jsx(Dt,{dark:!0})]}):Bt.map(K=>a.jsxs(pn.div,{animate:K.highlight?{boxShadow:["0 0 0 0 rgba(129, 140, 248, 0.28)","0 0 0 8px rgba(129, 140, 248, 0)"]}:void 0,transition:K.highlight?{repeat:1/0,duration:2.5,ease:"easeOut"}:void 0,className:`rounded-2xl p-6 border flex flex-col ${K.highlight?"border-indigo-400 border-2 bg-slate-900 shadow-lg":"border-slate-700 bg-slate-900/50"}`,children:[K.highlight&&a.jsx("span",{className:"self-start mb-2 bg-indigo-500 text-white text-[10px] font-bold uppercase tracking-wide px-2.5 py-1 rounded-full",children:"Most popular"}),a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:K.name}),a.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[a.jsx("span",{className:"text-3xl font-extrabold font-display",children:je(q&&Ed(K)?K.annualPrice:K.price)}),a.jsx("span",{className:"text-sm text-slate-400",children:q&&Ed(K)?"/ yr":K.unit}),q&&Ed(K)&&a.jsx("span",{className:"ml-2 text-[9px] bg-emerald-100 text-emerald-700 font-bold px-1.5 py-0.5 rounded",children:"Best value"})]}),a.jsx("p",{className:"text-xs text-slate-400 mt-1.5",children:K.tagline}),a.jsx("ul",{className:"space-y-2 text-xs text-slate-200 mt-4 flex-1",children:K.features.map(Ze=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx(kt,{className:"w-3.5 h-3.5 text-indigo-400 mt-0.5 shrink-0"})," ",Ze]},Ze))}),a.jsx("button",{onClick:()=>B(K),className:`mt-5 w-full font-semibold py-2.5 rounded-xl text-sm transition-colors cursor-pointer ${K.highlight?"bg-indigo-600 hover:bg-indigo-500 text-white":"bg-slate-800 hover:bg-slate-700 text-white"}`,children:K.cta})]},K.name))})]})]}),a.jsxs("section",{className:"relative overflow-hidden bg-slate-950 text-white",children:[a.jsx("img",{src:"https://images.unsplash.com/photo-1521737711867-e3b97375f902?auto=format&fit=crop&w=1600&h=420&q=80",srcSet:MN("https://images.unsplash.com/photo-1521737711867-e3b97375f902?auto=format&fit=crop&w=1600&h=420&q=80",1600),sizes:"(max-width: 1024px) 100vw, 1280px",alt:"An agency team collaborating around a table with laptops and notebooks",loading:"lazy",className:"absolute inset-0 w-full h-full object-cover object-center opacity-30"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-slate-950/80 via-slate-950/45 to-slate-950/90"}),a.jsxs("div",{className:"relative max-w-7xl mx-auto px-6 py-16 sm:py-20 grid grid-cols-1 md:grid-cols-12 gap-10 items-center",children:[a.jsxs("div",{className:"md:col-span-7 max-w-xl",children:[a.jsx("h2",{className:"text-2xl sm:text-3xl font-bold font-display tracking-tight",children:"Built for teams — and the agencies that run them."}),a.jsx("p",{className:"text-slate-300 text-sm sm:text-base mt-2 leading-relaxed",children:"One platform for single-location businesses, multi-location groups, and whitelabel agencies running dozens of clients under their own brand."})]}),a.jsx("div",{className:"md:col-span-5 grid grid-cols-3 gap-4",children:dle.map(K=>a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl sm:text-3xl font-extrabold font-display text-indigo-300",children:K.value}),a.jsx("div",{className:"text-[11px] text-slate-400 font-medium leading-tight mt-1",children:K.label})]},K.label))})]})]}),a.jsx("section",{id:"faq",className:"py-20 px-6 bg-slate-50/60 border-y border-slate-100 scroll-mt-20",children:a.jsxs("div",{className:"max-w-3xl mx-auto 
663space-y-8",children:[a.jsxs("div",{className:"text-center space-y-3",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white text-slate-700 px-3 py-1 rounded-full text-xs font-semibold border border-slate-200",children:[a.jsx(Na,{className:"w-3.5 h-3.5"})," FAQ"]}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight text-slate-900",children:"Questions, answered."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Uj,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"search",placeholder:"Search questions…","aria-label":"Search FAQs",value:ze,onChange:K=>Le(K.target.value),className:"w-full pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-sm focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:xle.map(K=>a.jsx("button",{"aria-pressed":ht===K,onClick:()=>yt(K),className:`px-3 py-1.5 rounded-full text-xs font-semibold transition-colors cursor-pointer ${ht===K?"bg-indigo-600 text-white shadow-sm":"bg-white border border-slate-200 text-slate-600 hover:border-indigo-300 hover:text-indigo-600"}`,children:K},K))}),on.map(K=>a.jsxs("details",{className:"group bg-white rounded-2xl border border-slate-100 shadow-sm overflow-hidden",children:[a.jsxs("summary",{className:"flex items-center justify-between gap-4 p-5 cursor-pointer list-none",children:[a.jsx("span",{className:"font-semibold text-slate-900 text-sm",children:K.q}),a.jsx(Ek,{className:"w-4 h-4 text-slate-400 group-open:rotate-180 transition-transform shrink-0"})]}),a.jsx("div",{className:"px-5 pb-5 text-sm text-slate-600 leading-relaxed -mt-1",children:K.a})]},K.q)),on.length===0&&a.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-200 bg-white p-8 text-center",children:[a.jsx(Na,{className:"w-6 h-6 text-slate-300 mx-auto"}),a.jsx("p",{className:"font-semibold text-slate-900 text-sm mt-2",children:"Still have questions?"}),a.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Can't find what you're looking for — our team usually replies within a few hours."}),a.jsx("button",{onClick:()=>f(!0),className:"mt-4 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs px-5 py-2.5 rounded-xl transition-colors cursor-pointer",children:"Contact us"})]})]})]})}),a.jsx("section",{className:"py-20 px-6",children:a.jsxs("div",{className:"max-w-5xl mx-auto rounded-3xl bg-gradient-to-br from-indigo-600 via-indigo-600 to-fuchsia-600 p-10 md:p-14 text-center text-white shadow-2xl shadow-indigo-600/30 relative overflow-hidden",children:[a.jsx("div",{className:"absolute -top-16 -right-16 w-64 h-64 bg-white/10 rounded-full blur-2xl"}),a.jsx("div",{className:"absolute -bottom-20 -left-10 w-64 h-64 bg-fuchsia-300/20 rounded-full blur-2xl"}),a.jsxs("div",{className:"relative space-y-5",children:[a.jsx(Uo,{className:"w-10 h-10 mx-auto opacity-90"}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold font-display tracking-tight",children:"Hear it for yourself."}),a.jsx("p",{className:"text-indigo-100 text-sm sm:text-base max-w-xl mx-auto",children:"Talk to Vox below — ask about pricing, whitelabel, or book a demo call. It's the same agent your visitors will meet."}),a.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3 pt-2",children:[a.jsxs("a",{href:"#demo",className:"bg-white text-indigo-700 hover:bg-indigo-50 font-semibold px-6 py-3 rounded-xl transition-all shadow-lg flex items-center gap-2 cursor-pointer",children:[a.jsx(Uo,{className:"w-4 h-4"})," Try the live demo"]}),a.jsxs("button",{onClick:()=>e("signup"),className:"bg-indigo-700/40 hover:bg-indigo-700/60 border border-white/20 text-white font-semibold px-6 py-3 rounded-xl transition-all flex items-center gap-2 cursor-pointer",children:["Get started ",a.jsx(hs,{className:"w-4 h-4"})]})]})]})]})}),a.jsxs("footer",{className:"bg-slate-950 text-slate-400 py-12 px-6 border-t border-slate-900 mt-auto",children:[a.jsxs("div",{className:"max-w-7xl mx-auto grid grid-cols-2 md:grid-cols-5 ga
663p-8",children:[a.jsxs("div",{className:"col-span-2 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"bg-indigo-600 p-1.5 rounded-lg text-white",children:a.jsx(Uo,{className:"w-4 h-4"})}),a.jsx("span",{className:"font-bold text-white font-display",children:"Vox Bridge"})]}),a.jsx("p",{className:"text-xs leading-relaxed max-w-xs",children:"Live voice agents for businesses and the agencies that serve them. Capture every call, book the appointment, route the lead."}),a.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-slate-500 pt-1",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(xm,{className:"w-3 h-3"})," Web widget"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(cc,{className:"w-3 h-3"})," Replies in under a second"]})]})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsx("h5",{className:"text-white text-xs font-bold uppercase tracking-wider mb-2",children:"Product"}),a.jsx("a",{href:"#features",className:"block text-xs hover:text-white transition-colors",children:"Features"}),a.jsx("a",{href:"#how",className:"block text-xs hover:text-white transition-colors",children:"How it works"}),a.jsx("a",{href:"#demo",className:"block text-xs hover:text-white transition-colors",children:"Live demo"}),a.jsx("a",{href:"#pricing",className:"block text-xs hover:text-white transition-colors",children:"Pricing"}),a.jsx("a",{href:"/resources",className:"block text-xs hover:text-white transition-colors",children:"Resources"})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsx("h5",{className:"text-white text-xs font-bold uppercase tracking-wider mb-2",children:"For Agencies"}),a.jsx("a",{href:"#audience",className:"block text-xs hover:text-white transition-colors",children:"Whitelabel"}),a.jsx("a",{href:"#agency-pricing",className:"block text-xs hover:text-white transition-colors",children:"Agency tiers"}),a.jsx("a",{href:"#/agencies",className:"block text-xs hover:text-white transition-colors",children:"For Agencies page"}),a.jsx("a",{href:"#faq",className:"block text-xs hover:text-white transition-colors",children:"FAQ"}),a.jsx("a",{href:"#/local-deployment",className:"block text-xs hover:text-white transition-colors",children:"In-country & on-prem deployment"}),a.jsx("button",{onClick:()=>e("signup"),className:"block text-xs hover:text-white transition-colors text-left cursor-pointer",children:"Become a partner"})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsx("h5",{className:"text-white text-xs font-bold uppercase tracking-wider mb-2",children:"Company"}),a.jsx("a",{href:"#/about",className:"block text-xs hover:text-white transition-colors",children:"About"}),a.jsx("button",{onClick:()=>f(!0),className:"block text-xs hover:text-white transition-colors text-left cursor-pointer",children:"Contact"}),a.jsx("a",{href:"#/request-access",className:"block text-xs hover:text-white transition-colors",children:"Request access"}),a.jsx("a",{href:"#/privacy",className:"block text-xs hover:text-white transition-colors",children:"Privacy"}),a.jsx("a",{href:"#/terms",className:"block text-xs hover:text-white transition-colors",children:"Terms of Service"})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-10 pt-6 border-t border-slate-900 flex flex-col sm:flex-row items-center justify-between gap-3 text-[11px]",children:a.jsx("p",{children:"© 2026 Nutshell — Vox Bridge is operated by Nutshell."})})]}),d&&a.jsx("div",{ref:Zn,onKeyDown:ln,role:"dialog","aria-modal":"true","aria-labelledby":"contact-modal-title",className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:C,children:a.jsxs("div",{className:"bg-white rounded-3xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative",onClick:K=>K.stopPropagation(),children:[a.jsx("button",{onClick:C,className:"absolute top-5 right-5 p-1.5 hover:bg-slate-100 rounded-lg cursor-pointer transition-colors",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),S?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"mx-auto w-14 h-14 bg-emerald-50 rounded-2xl flex items-center justify-center mb-4",children:a.jsx(kt,{className:"w-7 h-7 text-emerald-600"})}),a.jsx("h3",{id:"contact-modal-title",className:"text-lg font-bold font-display text-slate-900",children:"Message sent"}),a.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:"Thanks for reaching out — the Vox Bridge team will get back to you shortly."}),a.jsx("button",{onClick:C,className:"mt-6 w-full bg-slate-900 hover:bg-slate-800 text-white font-bold py-2.5 rounded-xl text-xs transition-all cursor-pointer",children:"Close"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase bg-indigo-50 text-indigo-700 px-2 py-1 rounded-md",children:"Contact us"}),a.jsx("h3",{id:"contact-modal-title",className:"text-xl font-bold font-display text-slate-900 mt-2",children:"Get in touch"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Send us a message and we'll respond by email. This also reaches our team inbox."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx(qo,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"text",placeholder:"Your name *",value:p.name,onChange:K=>v({...p,name:K.target.value}),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(uc,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"email",placeholder:"Email *",value:p.email,onChange:K=>v({...p,email:K.target.value}),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ei,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"tel",placeholder:"Phone (optional)",value:p.phone,onChange:K=>v({...p,phone:K.target.value}),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),a.jsx("textarea",{placeholder:"Your message *",rows:4,value:p.message,onChange:K=>v({...p,message:K.target.value}),className:"w-full px-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none resize-none"}),j&&a.jsx("p",{className:"text-[11px] text-rose-600 font-medium",children:j}),a.jsxs("button",{onClick:E,disabled:x||!(s!=null&&s.id),className:"w-full bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 disabled:cursor-not-allowed text-white font-bold py-2.5 rounded-xl text-xs flex items-center justify-center gap-2 transition-all cursor-pointer",children:[a.jsx(yp,{className:"w-4 h-4"}),x?"Sending…":"Send message"]}),!(s!=null&&s.id)&&a.jsx("p",{className:"text-[10px] text-slate-400 text-center",children:"The demo VA is still initializing — this enables once the page is fully loaded."})]})]})]})}),a.jsx(Zoe,{open:O,onClose:()=>F(!1),slots:l,clientId:(s==null?void 0:s.id)??"",onSubmit:Ut,onContactFallback:()=>f(!0)}),a.jsx(ele,{open:P,plan:M,onClose:()=>A(!1),onSubmit:U}),a.jsx(Zc,{children:!Q&&a.jsx(pn.div,{initial:{y:80,opacity:0}
663,animate:{y:0,opacity:1},exit:{y:80,opacity:0},transition:{type:"spring",stiffness:260,damping:24},className:"fixed bottom-0 left-0 right-0 z-50 bg-white border-t border-slate-200 shadow-2xl px-6 py-4",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-xs text-slate-600 leading-relaxed",children:["This site uses cookies for analytics and to power the live voice agent. By continuing, you accept our"," ",a.jsx("a",{href:"#/privacy",className:"text-indigo-600 underline hover:text-indigo-500",children:"Privacy Policy"}),"."]}),a.jsx("div",{className:"flex items-center gap-3 shrink-0",children:a.jsx("button",{onClick:()=>{W(!0);try{localStorage.setItem("vb-cookie-consent","1")}catch{}},className:"bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-bold px-5 py-2 rounded-xl transition-all cursor-pointer",children:"Accept"})})]})})}),a.jsx(Zc,{children:be&&a.jsxs(pn.a,{href:"https://wa.me/16467381670?text=Hi%20Vox%20Bridge!%20I%27d%20like%20to%20learn%20more%20about%20your%20AI%20voice%20agent.",target:"_blank",rel:"noopener noreferrer",initial:{opacity:0,scale:.7,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.7,y:12},transition:{type:"spring",stiffness:300,damping:22},"aria-label":"Chat with us on WhatsApp",className:`fixed right-5 z-40 flex items-center gap-2 rounded-full bg-[#25D366] hover:bg-[#1fbd5a] text-white shadow-lg shadow-emerald-600/25 pl-3.5 pr-4 py-2.5 text-xs font-bold transition-colors cursor-pointer ${Q?"bottom-5":"bottom-20"}`,children:[a.jsx(Pk,{className:"w-5 h-5"}),"WhatsApp us"]})}),a.jsx(Zc,{children:bt&&a.jsx(pn.div,{initial:{opacity:0}
663,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-label":"Before you go — book a demo",onKeyDown:K=>K.key==="Escape"&&Vt(!1),onClick:()=>Vt(!1),children:a.jsxs(pn.div,{initial:{opacity:0,scale:.96,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:12},transition:{type:"spring",stiffness:320,damping:28},className:"bg-white rounded-3xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative",onClick:K=>K.stopPropagation(),children:[a.jsx("button",{onClick:()=>Vt(!1),"aria-label":"Close",className:"absolute top-5 right-5 p-1.5 hover:bg-slate-100 rounded-lg cursor-pointer transition-colors",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),kn?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(pn.div,{initial:{scale:.6,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:260,damping:18},className:"mx-auto w-14 h-14 bg-emerald-50 rounded-2xl flex items-center justify-center mb-4",children:a.jsx(kt,{className:"w-7 h-7 text-emerald-600"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"You're on the list"}),a.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:"We'll be in touch shortly to book your demo call."}),a.jsx("button",{onClick:()=>Vt(!1),className:"mt-6 w-full bg-slate-900 hover:bg-slate-800 text-white font-bold py-2.5 rounded-xl text-xs transition-all cursor-pointer",children:"Close"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase bg-indigo-50 text-indigo-700 px-2 py-1 rounded-md",children:"Before you go"}),a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900 mt-2",children:"Book a demo call"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Leave your email and we'll set up a live walkthrough with the Vox Bridge team."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx(uc,{className:"w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{type:"email",placeholder:"Email *",autoFocus:!0,value:tn,onChange:K=>Qt(K.target.value),onKeyDown:K=>K.key==="Enter"&&ct(),className:"w-full pl-9 pr-3 py-2.5 rounded-xl border border-slate-200 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 outline-none"})]}),On&&a.jsx("p",{className:"text-[11px] text-rose-600 font-medium",children:On}),a.jsxs("button",{onClick:ct,disabled:Cn,className:"w-full bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 disabled:cursor-not-allowed text-white font-bold py-2.5 rounded-xl text-xs flex items-center justify-center gap-2 transition-all cursor-pointer",children:[Cn?a.jsx(Bi,{className:"w-4 h-4 animate-spin"}):a.jsx(Ka,{className:"w-4 h-4"}),Cn?"Sending…":"Book my demo"]}),a.jsx("p",{className:"text-[10px] text-slate-400 text-center",children:"No credit card needed."})]})]})]})})})]})}function wle({initialMode:e="login",initialRole:t,selectedPlan:n,onBackToHome:i}){const r=t===Jc.ADMIN;return a.jsxs("div",{className:"min-h-screen bg-slate-900 text-slate-100 flex flex-col justify-between py-6 px-4 md:px-8 font-sans relative overflow-hidden",children:[a.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[50%] h-[50%] rounded-full bg-indigo-500/10 blur-[120px] pointer-events-none"}),a.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[50%] h-[50%] rounded-full bg-emerald-500/10 blur-[120px] pointer-events-none"}),a.jsxs("header",{className:"max-w-6xl mx-auto w-full flex justify-between items-center z-10",children:[a.jsxs("button",{onClick:i,className:"flex items-center gap-2 text-slate-400 hover:text-white transition-all text-xs font-semibold cursor-pointer group bg-slate-800/50 hover:bg-slate-800 px-3 py-1.5 rounded-xl border border-slate-700/50",children:[a.jsx(ty,{className:"w-3.5 h-3.5 group-hover:-translate-x-1 transition-transform"}),"Back to Vox Bridge Home"]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-slate-400 text-[11px] font-mono",children:"Identity:"}),a.jsx("span",{className:"text-[10px] bg-indigo-500/20 text-indigo-300 font-mono border border-indigo-500/30 px-2 py-0.5 rounded-full",children:"Clerk Secured"})]})]}),a.jsxs("main",{className:"max-w-6xl mx-auto w-full grid grid-cols-1 lg:grid-cols-12 gap-8 items-center py-8 z-10 flex-1",children:[a.jsxs("div",{className:"lg:col-span-5 space-y-6 text-center lg:text-left",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 bg-indigo-500/10 text-indigo-300 border border-indigo-500/20 px-3.5 py-1 rounded-full text-xs font-semibold",children:[a.jsx(tQ,{className:"w-3.5 h-3.5 animate-spin",style:{animationDuration:"6s"}}),"Vox Bridge Identity Hub"]}),a.jsxs("h2",{className:"text-3xl sm:text-4xl font-extrabold font-display leading-tight",children:["Secure Gateway to Your ",a.jsx("span",{className:"text-indigo-400",children:"Voice Agent"})," Workspace."]}),a.jsx("p",{className:"text-slate-400 text-sm leading-relaxed max-w-md mx-auto lg:mx-0",children:"Sign in to manage your team, configure voice agents, set pricing, and review call recordings. Authentication is handled by Clerk."}),a.jsxs("div",{className:"bg-slate-800/40 border border-slate-700/40 rounded-2xl p-4 max-w-md mx-auto lg:mx-0 text-left space-y-3",children:[a.jsxs("h4",{className:"text-xs font-bold text-slate-200 flex items-center gap-1.5",children:[a.jsx(WY,{className:"w-4 h-4 text-emerald-400"}),"Three roles, one platform"]}),a.jsx("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:"Superadmin (global pricing + master templates), Agency (whitelabel reseller), and Client/Merchant (embeds the voice widget). Your role is assigned securely after sign-in — you can't switch roles yourself."})]})]}),a.jsxs("div",{className:"lg:col-span-7 flex flex-col gap-6 w-full max-w-xl mx-auto",children:[n&&a.jsxs("div",{className:"bg-indigo-500/10 border border-indigo-500/30 rounded-2xl px-4 py-3 text-sm text-indigo-200 font-semibold flex items-center gap-2.5",children:[a.jsx(xs,{className:"w-4 h-4 text-indigo-300"}),a.jsxs("span",{children:["You",r?"'re signing up as an agency":"'re signing up"," for the ",a.jsx("span",{className:"text-white",children:n})," plan",r?" — you can finish setup after signing in.":"."]})]}),a.jsxs("div",{className:"bg-slate-950/80 border border-slate-800 shadow-2xl rounded-3xl p-6 md:p-8 relative",children:[a.jsx("div",{className:"flex border-b border-slate-800 mb-6",children:a.jsx("div",{className:"flex-1 pb-3 text-sm font-semibold border-b-2 border-indigo-500 text-white",children:"Sign In"})}),a.jsx("div",{className:"[&_clerk-components]:text-slate-100",children:a.jsx(MG,{appearance:Sle})}),a.jsxs("p",{className:"mt-4 text-center text-[11px] text-slate-500 leading-relaxed",children:["No account yet? Vox Bridge is invite-only —"," ",a.jsx("button",{onClick:()=>{window.location.hash="#/request-access"},className:"text-indigo-400 hover:text-indigo-300 font-semibold cursor-pointer",children:"request access"})," ","and we'll email you an invitation."]})]})]})]}),a.jsx("footer",{className:"text-center text-[11px] text-slate-600 mt-auto border-t border-slate-800/40 pt-4 max-w-6xl mx-auto w-full",children:"© 2026 Vox Bridge SaaS Systems. Authentication by Clerk. Live voice agents for modern teams."})]})}
vendor: 5,152 bytes, line 663
663const Sle={variables:{colorBackground:"#0f172a",colorInputBackground:"#1e293b",colorInputText:"#f1f5f9",colorPrimary:"#4f46e5",colorText:"#f1f5f9",colorTextSecondary:"#94a3b8",colorNeutral:"#334155",borderRadius:"0.75rem"},elements:{card:"bg-transparent shadow-none border-none",formButtonPrimary:"bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold py-2.5 rounded-xl",formFieldInput:"bg-slate-900 border border-slate-800 rounded-xl text-sm text-slate-100 focus:border-indigo-500",headerTitle:"text-slate-100",headerSubtitle:"text-slate-400",footerActionLink:"hidden",socialButtonsBlockButton:"hidden",socialButtonsProviderButton:"hidden"}};function x8(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=x8(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Rn(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=x8(e))&&(i&&(i+=" "),i+=t);return i}var kle=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function YC(e){if(typeof e!="string")return!1;var t=kle;return t.includes(e)}var Nle=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRen
663dering","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","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","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","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],jle=new Set(Nle);function y8(e){return typeof e!="string"?!1:jle.has(e)}function b8(e){return typeof e=="string"&&e.startsWith("data-")}function Ca(e){if(typeof e!="object"||e===null)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(y8(n)||b8(n))&&(t[n]=e[n]);return t}function Ey(e){if(e==null)return null;if(w.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Ca(t)}return typeof e=="object"&&!Array.isArray(e)?Ca(e):null}function Ws(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(y8(n)||b8(n)||YC(n))&&(t[n]=e[n]);return t}function Cle(e){return e==null?null:w.isValidElement(e)?Ws(e.props):typeof e=="object"&&!Array.isArray(e)?Ws(e):null}var Tle=["children","width","height","viewBox","className","style","title","desc"];function RN(){return RN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},RN.apply(null,arguments)}function Ele(e,t){if(e==null)return{};var n,i,r=Ale(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ale(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var w8=w.forwardRef((e,t)=>{var n=e.children,i=e.width,r=e.height,s=e.viewBox,l=e.className,c=e.style,h=e.title,d=e.desc,f=Ele(e,Tle),p=s||{width:i,height:r,x:0,y:0},v=Rn("recharts-surface",l);return w.createElement("svg",RN({},Ws(f),{className:v,width:i,height:r,style:c,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height),ref:t}),w.createElement("title",null,h),w.createElement("desc",null,d),n)}),Ple=["children","className"];function ON(){return ON=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ON.apply(null,arguments)}function _le(e,t){if(e==null)return{};var n,i,r=Mle(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Mle(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var Hs=w.forwardRef((e,t)=>
vendor: 5,630 bytes, line 663
663{var n=e.children,i=e.className,r=_le(e,Ple),s=Rn("recharts-layer",i);return w.createElement("g",ON({className:s},Ws(r),{ref:t}),n)}),Rle=w.createContext(null);function Gn(e){return function(){return e}}const IN=Math.PI,DN=2*IN,Yc=1e-6,Ole=DN-Yc;function S8(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Ile(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return S8;const n=10**t;return function(i){this._+=i[0];for(let r=1,s=i.length;r<s;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class Dle{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?S8:Ile(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,i,r){this._append`Q${+t},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(t,n,i,r,s,l){this._append`C${+t},${+n},${+i},${+r},${this._x1=+s},${this._y1=+l}`}arcTo(t,n,i,r,s){if(t=+t,n=+n,i=+i,r=+r,s=+s,s<0)throw new Error(`negative radius: ${s}`);let l=this._x1,c=this._y1,h=i-t,d=r-n,f=l-t,p=c-n,v=f*f+p*p;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(v>Yc)if(!(Math.abs(p*h-d*f)>Yc)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let x=i-l,b=r-c,S=h*h+d*d,N=x*x+b*b,j=Math.sqrt(S),T=Math.sqrt(v),E=s*Math.tan((IN-Math.acos((S+v-N)/(2*j*T)))/2),C=E/T,P=E/j;Math.abs(C-1)>Yc&&this._append`L${t+C*f},${n+C*p}`,this._append`A${s},${s},0,0,${+(p*x>f*b)},${this._x1=t+P*h},${this._y1=n+P*d}`}}arc(t,n,i,r,s,l){if(t=+t,n=+n,i=+i,l=!!l,i<0)throw new Error(`negative radius: ${i}`);let c=i*Math.cos(r),h=i*Math.sin(r),d=t+c,f=n+h,p=1^l,v=l?r-s:s-r;this._x1===null?this._append`M${d},${f}`:(Math.abs(this._x1-d)>Yc||Math.abs(this._y1-f)>Yc)&&this._append`L${d},${f}`,i&&(v<0&&(v=v%DN+DN),v>Ole?this._append`A${i},${i},0,1,${p},${t-c},${n-h}A${i},${i},0,1,${p},${this._x1=d},${this._y1=f}`:v>Yc&&this._append`A${i},${i},0,${+(v>=IN)},${p},${this._x1=t+i*Math.cos(s)},${this._y1=n+i*Math.sin(s)}`)}rect(t,n,i,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function k8(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const i=Math.floor(n);if(!(i>=0))throw new RangeError(`invalid digits: ${n}`);t=i}return e},()=>new Dle(t)}function QC(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function N8(e){this._context=e}N8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ay(e){return new N8(e)}function j8(e){return e[0]}function C8(e){return e[1]}function T8(e,t){var n=Gn(!0),i=null,r=Ay,s=null,l=k8(c);e=typeof e=="function"?e:e===void 0?j8:Gn(e),t=typeof t=="function"?t:t===void 0?C8:Gn(t);function c(h){var d,f=(h=QC(h)).length,p,v=!1,x;for(i==null&&(s=r(x=l())),d=0;d<=f;++d)!(d<f&&n(p=h[d],d,h))===v&&((v=!v)?s.lineStart():s.lineEnd()),v&&s.point(+e(p,d,h),+t(p,d,h));if(x)return s=null,x+""||null}return c.x=function(h){return arguments.length?(e=typeof h=="function"?h:Gn(+h),c):e},c.y=function(h){return arguments.length?(t=typeof h=="function"?h:Gn(+h),c):t},c.defined=function(h){return arguments.length?(n=typeof h=="function"?h:Gn(!!h),c):n},c.curve=function(h){return arguments.length?(r=h,i!=null&&(s=r(i)),c):r},c.context=function(h){return arguments.length?(h==null?i=s=null:s=r(i=h),c):i},c}function m0(e,t,n){var i=null,r=Gn(!0),s=null,l=Ay,c=null,h=k8(d);e=typeof e=="function"?e:e===void 0?j8:Gn(+e),t=typeof t=="function"?t:Gn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?C8:Gn(+n);function d(p){var v,x,b,S=(p=QC(p)).length,N,j=!1,T,E=new Array(S),C=new Array(S);for(s==null&&(c=l(T=h())),v=0;v<=S;++v){if(!(v<S&&r(N=p[v],v,p))===j)if(j=!j)x=v,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),b=v-1;b>=x;--b)c.point(E[b],C[b]);c.lineEnd(),c.areaEnd()}j&&(E[v]=+e(N,v,p),C[v]=+t(N,v,p),c.point(i?+i(N,v,p):E[v],n?+n(N,v,p):C[v]))}if(T)return c=null,T+""||null}function f(){return T8().defined(r).curve(l).context(s)}return d.x=function(p){return arguments.length?(e=typeof p=="function"?p:Gn(+p),i=null,d):e},d.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Gn(+p),d):e},d.x1=function(p){return arguments.length?(i=p==null?null:typeof p=="function"?p:Gn(+p),d):i},d.y=function(p){return arguments.length?(t=typeof p=="function"?p:Gn(+p),n=null,d):t},d.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Gn(+p),d):t},d.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Gn(+p),d):n},d.lineX0=d.lineY0=function(){return f().x(e).y(t)},d.lineY1=function(){return f().x(e).y(n)},d.lineX1=function(){return f().x(i).y(t)},d.defined=function(p){return arguments.length?(r=typeof p=="function"?p:Gn(!!p),d):r},d.curve=function(p){return arguments.length?(l=p,s!=null&&(c=l(s)),d):l},d.context=function(p){return arguments.length?(p==null?s=c=null:c=l(s=p),d):s},d}class E8{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}
vendor: 6,728 bytes, line 663
663point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function Lle(e){return new E8(e,!0)}function Ule(e){return new E8(e,!1)}function Xv(){}function Jv(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function A8(e){this._context=e}A8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Jv(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Jv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ble(e){return new A8(e)}function P8(e){this._context=e}P8.prototype={areaStart:Xv,areaEnd:Xv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Jv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fle(e){return new P8(e)}function _8(e){this._context=e}_8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:Jv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $le(e){return new _8(e)}function M8(e){this._context=e}M8.prototype={areaStart:Xv,areaEnd:Xv,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Vle(e){return new M8(e)}function JR(e){return e<0?-1:1}function ZR(e,t,n){var i=e._x1-e._x0,r=t-e._x1,s=(e._y1-e._y0)/(i||r<0&&-0),l=(n-e._y1)/(r||i<0&&-0),c=(s*r+l*i)/(i+r);return(JR(s)+JR(l))*Math.min(Math.abs(s),Math.abs(l),.5*Math.abs(c))||0}function eO(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function MS(e,t,n){var i=e._x0,r=e._y0,s=e._x1,l=e._y1,c=(s-i)/3;e._context.bezierCurveTo(i+c,r+c*t,s-c,l-c*n,s,l)}function Zv(e){this._context=e}Zv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:MS(this,this._t0,eO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,MS(this,eO(this,n=ZR(this,e,t)),n);break;default:MS(this,this._t0,n=ZR(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function R8(e){this._context=new O8(e)}(R8.prototype=Object.create(Zv.prototype)).point=function(e,t){Zv.prototype.point.call(this,t,e)};function O8(e){this._context=e}O8.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,s){this._context.bezierCurveTo(t,e,i,n,s,r)}};function zle(e){return new Zv(e)}function qle(e){return new R8(e)}function I8(e){this._context=e}I8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var i=tO(e),r=tO(t),s=0,l=1;l<n;++s,++l)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],e[l],t[l]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function tO(e){var t,n=e.length-1,i,r=new Array(n),s=new Array(n),l=new Array(n);for(r[0]=0,s[0]=2,l[0]=e[0]+2*e[1],t=1;t<n-1;++t)r[t]=1,s[t]=4,l[t]=4*e[t]+2*e[t+1];for(r[n-1]=2,s[n-1]=7,l[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)i=r[t]/s[t-1],s[t]-=i,l[t]-=i*l[t-1];for(r[n-1]=l[n-1]/s[n-1],t=n-2;t>=0;--t)r[t]=(l[t]-r[t+1])/s[t];for(s[n-1]=(e[n]+r[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-r[t+1];return[r,s]}function Wle(e){return new I8(e)}function Py(e,t){this._context=e,this._t=t}Py.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;
663default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Hle(e){return new Py(e,.5)}function Kle(e){return new Py(e,0)}function Gle(e){return new Py(e,1)}function Pu(e,t){if((l=e.length)>1)for(var n=1,i,r,s=e[t[0]],l,c=s.length;n<l;++n)for(r=s,s=e[t[n]],i=0;i<c;++i)s[i][1]+=s[i][0]=isNaN(r[i][1])?r[i][0]:r[i][1]}function LN(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function Yle(e,t){return e[t]}function Qle(e){const t=[];return t.key=e,t}function Xle(){var e=Gn([]),t=LN,n=Pu,i=Yle;function r(s){var l=Array.from(e.apply(this,arguments),Qle),c,h=l.length,d=-1,f;for(const p of s)for(c=0,++d;c<h;++c)(l[c][d]=[0,+i(p,l[c].key,d,s)]).data=p;for(c=0,f=QC(t(l));c<h;++c)l[f[c]].index=c;return n(l,f),l}return r.keys=function(s){return arguments.length?(e=typeof s=="function"?s:Gn(Array.from(s)),r):e},r.value=function(s){return arguments.length?(i=typeof s=="function"?s:Gn(+s),r):i},r.order=function(s){return arguments.length?(t=s==null?LN:typeof s=="function"?s:Gn(Array.from(s)),r):t},r.offset=function(s){return arguments.length?(n=s??Pu,r):n},r}function Jle(e,t){if((i=e.length)>0){for(var n,i,r=0,s=e[0].length,l;r<s;++r){for(l=n=0;n<i;++n)l+=e[n][r][1]||0;if(l)for(n=0;n<i;++n)e[n][r][1]/=l}Pu(e,t)}}function Zle(e,t){if((r=e.length)>0){for(var n=0,i=e[t[0]],r,s=i.length;n<s;++n){for(var l=0,c=0;l<r;++l)c+=e[l][n][1]||0;i[n][1]+=i[n][0]=-c/2}Pu(e,t)}}function ece(e,t){if(!(!((l=e.length)>0)||!((s=(r=e[t[0]]).length)>0))){for(var n=0,i=1,r,s,l;i<s;++i){for(var c=0,h=0,d=0;c<l;++c){for(var f=e[t[c]],p=f[i][1]||0,v=f[i-1][1]||0,x=(p-v)/2,b=0;b<c;++b){var S=e[t[b]],N=S[i][1]||0,j=S[i-1][1]||0;x+=N-j}h+=p,d+=x*p}r[i-1][1]+=r[i-1][0]=n,h&&(n-=d/h)}r[i-1][1]+=r[i-1][0]=n,Pu(e,t)}}function UN(e){return e==="__proto__"}function D8(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function XC(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function L8(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(L8).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function JC(e){if(Array.isArray(e))return e.map(XC);if(typeof e=="symbol")return[e];e=L8(e);const t=[],n=e.length;if(n===0)return t;let i=0,r="",s="",l=!1;
663for(e.charCodeAt(0)===46&&t.push("");i<n;){const c=e[i];if(s)c==="\\"&&i+1<n?(i++,r+=e[i]):c===s?s="":r+=c;else if(l)c==='"'||c==="'"?s=c:c==="]"?(l=!1,t.push(r),r=""):r+=c;else if(c==="[")l=!0,r&&(t.push(r),r="");else if(c==="."){r&&(t.push(r),r="");const h=e[i+1];(h===void 0||h===".")&&t.push("")}else r+=c;i++}return r&&t.push(r),t}function Fu(e,t,n){if(e==null)return n;switch(typeof t){case"string":{if(UN(t))return n;const i=e[t];return i===void 0?D8(t)?Fu(e,JC(t),n):n:i}case"number":case"symbol":{typeof t=="number"&&(t=XC(t));const i=e[t];return i===void 0?n:i}default:{if(Array.isArray(t))return tce(e,t,n);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),UN(t))return n;const i=e[t];return i===void 0?n:i}}}function tce(e,t,n){if(t.length===0)return n;let i=e;for(let r=0;r<t.length;r++){if(i==null||UN(t[r]))return n;i=i[t[r]]}return i===void 0?n:i}var nce=4;function ic(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nce,n=10**t,i=Math.round(e*n)/n;return Object.is(i,-0)?0:i}function rr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return e.reduce((r,s,l)=>{var c=n[l-1];return typeof c=="string"?r+c+s:c!==void 0?r+ic(c)+s:r+s},"")}var Fs=e=>e===0?0:e>0?1:-1,so=e=>typeof e=="number"&&e!=+e,_u=e=>typeof e=="string"&&e.length>1&&e.indexOf("%")===e.length-1,Xe=e=>(typeof e=="number"||e instanceof Number)&&!so(e),ao=e=>Xe(e)||typeof e=="string",ice=0,ep=e=>{var t=++ice;return"".concat(e||"").concat(t)},pc=function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Xe(t)&&typeof t!="string")return i;var s;if(_u(t)){if(n==null)return i;var l=t.indexOf("%");s=n*parseFloat(t.slice(0,l))/100}else s=+t;return so(s)&&(s=i),r&&n!=null&&s>n&&(s=n),s},U8=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},i=0;i<t;i++)if(!n[String(e[i])])n[String(e[i])]=!0;else return!0;return!1};function Ho(e,t,n){return Xe(e)&&Xe(t)?ic(e+n*(t-e)):t}function B8(e,t,n){if(!(!e||!e.length))return e.find(i=>i&&(typeof t=="function"?t(i):Fu(i,t))===n)}var dr=e=>e===null||typeof e>"u",ZC=e=>dr(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Jr(e){return e!=null}function Oh(){}var F8=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,eT=(e,t)=>
663{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(w.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var i={};return Object.keys(n).forEach(r=>{YC(r)&&typeof n[r]=="function"&&(i[r]=(s=>n[r](n,s)))}),i},rce=(e,t,n)=>i=>(e(t,n,i),null),sce=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var i=null;return Object.keys(e).forEach(r=>{var s=e[r];YC(r)&&typeof s=="function"&&(i||(i={}),i[r]=rce(s,t,n))}),i};function nO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function ace(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nO(Object(n),!0).forEach(function(i){oce(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function oce(e,t,n){return(t=lce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lce(e){var t=cce(e,"string");return typeof t=="symbol"?t:t+""}function cce(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ys(e,t){var n=ace({},e),i=t,r=Object.keys(t),s=r.reduce((l,c)=>(l[c]===void 0&&i[c]!==void 0&&(l[c]=i[c]),l),n);return s}function uce(e,t){const n=new Map;for(let i=0;i<e.length;i++){const r=e[i],s=t(r,i,e);n.has(s)||n.set(s,r)}return Array.from(n.values())}function dce(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function $8(e){return e}function hce(e){return function(t){return Fu(t,e)}}function BN(e){return e==null||typeof e!="object"&&typeof e!="function"}function fce(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function mce(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function tT(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const pce="[object RegExp]",V8="[object String]",z8="[object Number]",q8="[object Boolean]",W8="[object Arguments]",gce="[object Symbol]",vce="[object Date]",xce="[object Map]",yce="[object Set]",bce="[object Array]",wce="[object ArrayBuffer]",Sce="[object Object]",kce="[object DataView]",Nce="[object Uint8Array]",jce="[object Uint8ClampedArray]",Cce="[object Uint16Array]",Tce="[object Uint32Array]",Ece="[object Int8Array]",Ace="[object Int16Array]",Pce="[object Int32Array]",_ce="[object Float32Array]",Mce="[object Float64Array]",iO=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Rce(e){return typeof iO.Buffer<"u"&&iO.Buffer.isBuffer(e)}function Oce(e,t){return lu(e,void 0,e,new Map,t)}function lu(e,t,n,i=new Map,r=void 0){const s=r==null?void 0:r(e,t,n,i);if(s!==void 0)return s;if(BN(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){const l=new Array(e.length);i.set(e,l);for(let c=0;c<e.length;c++)l[c]=lu(e[c],c,n,i,r);return Object.hasOwn(e,"index")&&(l.index=e.index),Object.hasOwn(e,"input")&&(l.input=e.input),l}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const l=new RegExp(e.source,e.flags);return l.lastIndex=e.lastIndex,l}if(e instanceof Map){const l=new Map;i.set(e,l);for(const[c,h]of e)l.set(c,lu(h,c,n,i,r));return l}if(e instanceof Set){const l=new Set;i.set(e,l);for(const c of e)l.add(lu(c,void 0,n,i,r));return l}if(Rce(e))return e.subarray();if(fce(e)){const l=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,l);for(let c=0;c<e.length;c++)l[c]=lu(e[c],c,n,i,r);return l}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const l=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,l),sa(l,e,n,i,r),l}if(typeof File<"u"&&e instanceof File){const l=new File([e],e.name,{type:e.type});return i.set(e,l),sa(l,e,n,i,r),l}if(typeof Blob<"u"&&e instanceof Blob){const l=new Blob([e],{type:e.type});return i.set(e,l),sa(l,e,n,i,r),l}if(e instanceof Error){const l=structuredClone(e);return i.set(e,l),l.message=e.message,l.name=e.name,l.stack=e.stack,l.cause=e.cause,l.constructor=e.constructor,sa(l,e,n,i,r),l}if(e instanceof Boolean){const l=new Boolean(e.valueOf());return i.set(e,l),sa(l,e,n,i,r),l}if(e instanceof Number){const l=new Number(e.valueOf());return i.set(e,l),sa(l,e,n,i,r),l}if(e instanceof String){const l=new String(e.valueOf());return i.set(e,l),sa(l,e,n,i,r),l}if(typeof e=="object"&&Ice(e)){const l=Object.create(Object.getPrototypeOf(e));return i.set(e,l),sa(l,e,n,i,r),l}return e}function sa(e,t,n=e,i,r){const s=[...Object.keys(t),...mce(t)];for(let l=0;l<s.length;l++){const c=s[l],h=Object.getOwnPropertyDescriptor(e,c);(h==null||h.writable)&&(e[c]=lu(t[c],c,n,i,r))}}function Ice(e){switch(tT(e)){case W8:case bce:case wce:case kce:case q8:case vce:case _ce:case Mce:case Ece:case Ace:case Pce:case xce:case z8:case Sce:case pce:case yce:case V8:case gce:case Nce:case jce:case Cce:case Tce:return!0;default:return!1}}function Dce(e){return lu(e,void 0,e,new Map,void 0)}function av(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function H8(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function K8(e,t,n){return typeof n!="function"?K8(e,t,()=>{}):FN(e,t,function i(r,s,l,c,h,d){const f=n(r,s,l,c,h,d);return f!==void 0?!!f:FN(r,s,i,d,!1)},new Map,!0)}function FN(e,t,n,i,r=!1){if(t===e)return!0;switch(typeof t){case"object":return Lce(e,t,n,i);case"function":return Object.keys(t).length>0?FN(e,{...t},n,i,r):av(e,t);default:return H8(e)&&r?typeof t=="string"?t==="":!0:av(e,t)}}function Lce(e,t,n,i){if(t==null)return!0;
663if(Array.isArray(t))return G8(e,t,n,i);if(t instanceof Map)return Uce(e,t,n,i);if(t instanceof Set)return Bce(e,t,n,i);const r=Object.keys(t);if(e==null||BN(e))return r.length===0;if(r.length===0)return!0;if(i!=null&&i.has(t))return i.get(t)===e;i==null||i.set(t,e);try{for(let s=0;s<r.length;s++){const l=r[s];if(!BN(e)&&!(l in e)||t[l]===void 0&&e[l]!==void 0||t[l]===null&&e[l]!==null||!n(e[l],t[l],l,e,t,i))return!1}return!0}finally{i==null||i.delete(t)}}function Uce(e,t,n,i){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(const[r,s]of t.entries())if(n(e.get(r),s,r,e,t,i)===!1)return!1;return!0}function G8(e,t,n,i){if(t.length===0)return!0;if(!Array.isArray(e))return!1;const r=new Set;for(let s=0;s<t.length;s++){const l=t[s];let c=!1;for(let h=0;h<e.length;h++){if(r.has(h))continue;const d=e[h];let f=!1;if(n(d,l,s,e,t,i)&&(f=!0),f){r.add(h),c=!0;break}}if(!c)return!1}return!0}function Bce(e,t,n,i){return t.size===0?!0:e instanceof Set?G8([...e],[...t],n,i):!1}function Y8(e,t){return K8(e,t,()=>{})}function Fce(e){return e=Dce(e),t=>Y8(t,e)}function $ce(e,t){return Oce(e,(n,i,r,s)=>{if(typeof e=="object"){if(tT(e)==="[object Object]"&&typeof e.constructor!="function"){const l={};return s.set(e,l),sa(l,e,r,s),l}switch(Object.prototype.toString.call(e)){case z8:case V8:case q8:{const l=new e.constructor(e==null?void 0:e.valueOf());return sa(l,e),l}case W8:{const l={};return sa(l,e),l.length=e.length,l[Symbol.iterator]=e[Symbol.iterator],l}default:return}}})}function Vce(e){return $ce(e)}const zce=/^(?:0|[1-9]\d*)$/;function Q8(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return zce.test(e)}}function qce(e){return e!==null&&typeof e=="object"&&tT(e)==="[object Arguments]"}function Wce(e,t){let n;if(Array.isArray(t)?n=t:typeof t=="string"&&D8(t)&&(e==null?void 0:e[t])==null?n=JC(t):n=[t],n.length===0)return!1;let i=e;for(let r=0;r<n.length;r++){const s=n[r];if((i==null||!Object.hasOwn(i,s))&&!((Array.isArray(i)||qce(i))&&Q8(s)&&s<i.length))return!1;i=i[s]}return!0}function Hce(e,t){switch(typeof e){case"object":Object.is(e==null?void 0:e.valueOf(),-0)&&(e="-0");break;case"number":e=XC(e);break}return t=Vce(t),function(n){const i=Fu(n,e);return i===void 0?Wce(n,e):t===void 0?i===void 0:Y8(i,t)}}function Kce(e){if(e==null)return $8;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?Hce(e[0],e[1]):Fce(e);case"string":case"symbol":case"number":return hce(e)}}function Gce(e){return Number.isSafeInteger(e)&&e>=0}function X8(e){return e!=null&&typeof e!="function"&&Gce(e.length)}function Yce(e){return typeof e=="object"&&e!==null}function Qce(e){return Yce(e)&&X8(e)}function rO(e,t=$8){return Qce(e)?uce(Array.from(e),dce(Kce(t),1)):[]}function Xce(e,t,n){return t===!0?rO(e,n):typeof t=="function"?rO(e,t):e}var RS={exports:{}},OS={};/**
664 * @license React
665 * use-sync-external-store-shim/with-selector.production.js
666 *
667 * Copyright (c) Meta Platforms, Inc. and affiliates.
668 *
669 * This source code is licensed under the MIT license found in the
670 * LICENSE file in the root directory of this source tree.
671 */var sO;function Jce(){if(sO)return OS;sO=1;var e=Ph(),t=B4();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var i=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,l=e.useEffect,c=e.useMemo,h=e.useDebugValue;return OS.useSyncExternalStoreWithSelector=function(d,f,p,v,x){var b=s(null);if(b.current===null){var S={hasValue:!1,value:null};b.current=S}else S=b.current;b=c(function(){function j(A){if(!T){if(T=!0,E=A,A=v(A),x!==void 0&&S.hasValue){var M=S.value;if(x(M,A))return C=M}return C=A}if(M=C,i(E,A))return M;var R=v(A);return x!==void 0&&x(M,R)?(E=A,M):(E=A,C=R)}var T=!1,E,C,P=p===void 0?null:p;return[function(){return j(f())},P===null?void 0:function(){return j(P())}]},[f,p,v,x]);var N=r(d,b[0],b[1]);return l(function(){S.hasValue=!0,S.value=N},[N]),h(N),N},OS}var aO;function Zce(){return aO||(aO=1,RS.exports=Jce()),RS.exports}var eue=Zce(),nT=w.createContext(null),tue=e=>e,wi=()=>{var e=w.useContext(nT);return e?e.store.dispatch:tue},ov=()=>{},nue=()=>ov,iue=(e,t)=>
671e===t;function st(e){var t=w.useContext(nT),n=w.useMemo(()=>t?i=>{if(i!=null)return e(i)}:ov,[t,e]);return eue.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:nue,t?t.store.getState:ov,t?t.store.getState:ov,n,iue)}function rue(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function sue(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${t}[${n}]`)}}var oO=e=>Array.isArray(e)?e:[e];function aue(e){const t=Array.isArray(e[0])?e[0]:e;return sue(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function oue(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var lue=class{constructor(e){this.value=e}deref(){return this.value}},cue=()=>typeof WeakRef>"u"?lue:WeakRef,J8=cue(),uue=0,lO=1;function p0(){return{s:uue,v:void 0,o:null,p:null}}function due(e){return e instanceof J8?e.deref():e}function Z8(e,t={}){let n=p0();const{resultEqualityCheck:i}=t;let r,s=0;function l(){let c=n;const{length:h}=arguments;for(let p=0,v=h;p<v;p++){const x=arguments[p];if(typeof x=="function"||typeof x=="object"&&x!==null){let b=c.o;b===null&&(c.o=b=new WeakMap);const S=b.get(x);S===void 0?(c=p0(),b.set(x,c)):c=S}else{let b=c.p;b===null&&(c.p=b=new Map);const S=b.get(x);S===void 0?(c=p0(),b.set(x,c)):c=S}}const d=c;let f;if(c.s===lO)f=c.v;else if(f=e.apply(null,arguments),s++,i){const p=due(r);p!=null&&i(p,f)&&(f=p,s!==0&&s--),r=typeof f=="object"&&f!==null||typeof f=="function"?new J8(f):f}return d.s=lO,d.v=f,f}return l.clearCache=()=>{n=p0(),l.resetResultsCount()},l.resultsCount=()=>s,l.resetResultsCount=()=>{s=0},l}function hue(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,i=(...r)=>{let s=0,l=0,c,h={},d=r.pop();typeof d=="object"&&(h=d,d=r.pop()),rue(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const f={...n,...h},{memoize:p,memoizeOptions:v=[],argsMemoize:x=Z8,argsMemoizeOptions:b=[]}=f,S=oO(v),N=oO(b),j=aue(r),T=p(function(){return s++,d.apply(null,arguments)},...S),E=x(function(){l++;const P=oue(j,arguments);return c=T.apply(null,P),c},...N);return Object.assign(E,{resultFunc:d,memoizedResultFunc:T,dependencies:j,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:p,argsMemoize:x})};return Object.assign(i,{withTypes:()=>i}),i}var pe=hue(Z8);function fue(e,t=1){const n=[],i=Math.floor(t),r=(s,l)=>{for(let c=0;c<s.length;c++){const h=s[c];Array.isArray(h)&&l<i?r(h,l+1):n.push(h)}};return r(e,0),n}function $N(e,t,n){return H8(n)&&(typeof t=="number"&&X8(n)&&Q8(t)&&t<n.length||typeof t=="string"&&t in n)?av(n[t],e):!1}function cO(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const mue=(e,t,n)=>{if(e!==t){const i=cO(e),r=cO(t);if(i===r&&i===0){if(e<t)return n==="desc"?1:-1;if(e>t)return n==="desc"?-1:1}return n==="desc"?r-i:i-r}return 0};function e9(e){return typeof e=="symbol"||e instanceof Symbol}const pue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gue=/^\w*$/;function vue(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||e9(e)?!0:typeof e=="string"&&(gue.test(e)||!pue.test(e))||t!=null}function xue(e,t,n,i){if(e==null)return[];n=n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(c=>String(c));const r=(c,h)=>{let d=c;for(let f=0;f<h.length&&d!=null;++f)d=d[h[f]];return d},s=(c,h)=>h==null||c==null?h:typeof c=="object"&&"key"in c?Object.hasOwn(h,c.key)?h[c.key]:r(h,c.path):typeof c=="function"?c(h):Array.isArray(c)?r(h,c):typeof h=="object"?h[c]:h,l=t.map(c=>(Array.isArray(c)&&c.length===1&&(c=c[0]),c==null||typeof c=="function"||Array.isArray(c)||vue(c)?c:{key:c,path:JC(c)}));return e.map(c=>({original:c,criteria:l.map(h=>s(h,c))})).slice().sort((c,h)=>{for(let d=0;d<l.length;d++){const f=mue(c.criteria[d],h.criteria[d],n[d]);if(f!==0)return f}return 0}).map(c=>c.original)}function _y(e,...t){const n=t.length;return n>1&&$N(e,t[0],t[1])?t=[]:n>2&&$N(t[0],t[1],t[2])&&(t=[t[0]]),xue(e,fue(t),["asc"])}var t9=e=>e.legend.settings,yue=e=>e.legend.size,bue=e=>e.legend.payload;pe([bue,t9],(e,t)=>{var n=t.itemSorter,i=e.flat(1);return n?_y(i,n):i});function wue(e,t){return jue(e)||Nue(e,t)||kue(e,t)||Sue()}
671function Sue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
672In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kue(e,t){if(e){if(typeof e=="string")return uO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uO(e,t):void 0}}function uO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Nue(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function jue(e){if(Array.isArray(e))return e}var g0=1;function dO(e,t){return Math.abs(e.height-t.height)>g0||Math.abs(e.left-t.left)>g0||Math.abs(e.top-t.top)>g0||Math.abs(e.width-t.width)>g0}function hO(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Cue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=w.useState({height:0,left:0,top:0,width:0}),n=wue(t,2),i=n[0],r=n[1],s=w.useRef(null),l=w.useRef(i);l.current=i;var c=w.useCallback(h=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),h!=null){var d=hO(h);if(dO(d,l.current)&&r(d),typeof ResizeObserver<"u"){var f=new ResizeObserver(()=>{var p=hO(h);dO(p,l.current)&&r(p)});f.observe(h),s.current=f}}},[...e]);return w.useEffect(()=>()=>{var h;(h=s.current)===null||h===void 0||h.disconnect()},[]),[i,c]}function tr(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Tue=typeof Symbol=="function"&&Symbol.observable||"@@observable",fO=Tue,IS=()=>Math.random().toString(36).substring(7).split("").join("."),Eue={INIT:`@@redux/INIT${IS()}`,REPLACE:`@@redux/REPLACE${IS()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${IS()}`},ex=Eue;function iT(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function n9(e,t,n){if(typeof e!="function")throw new Error(tr(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(tr(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(tr(1));return n(n9)(e,t)}let i=e,r=t,s=new Map,l=s,c=0,h=!1;
672function d(){l===s&&(l=new Map,s.forEach((N,j)=>{l.set(j,N)}))}function f(){if(h)throw new Error(tr(3));return r}function p(N){if(typeof N!="function")throw new Error(tr(4));if(h)throw new Error(tr(5));let j=!0;d();const T=c++;return l.set(T,N),function(){if(j){if(h)throw new Error(tr(6));j=!1,d(),l.delete(T),s=null}}}function v(N){if(!iT(N))throw new Error(tr(7));if(typeof N.type>"u")throw new Error(tr(8));if(typeof N.type!="string")throw new Error(tr(17));if(h)throw new Error(tr(9));try{h=!0,r=i(r,N)}finally{h=!1}return(s=l).forEach(T=>{T()}),N}function x(N){if(typeof N!="function")throw new Error(tr(10));i=N,v({type:ex.REPLACE})}function b(){const N=p;return{subscribe(j){if(typeof j!="object"||j===null)throw new Error(tr(11));function T(){const C=j;C.next&&C.next(f())}return T(),{unsubscribe:N(T)}},[fO](){return this}}}return v({type:ex.INIT}),{dispatch:v,subscribe:p,getState:f,replaceReducer:x,[fO]:b}}function Aue(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:ex.INIT})>"u")throw new Error(tr(12));if(typeof n(void 0,{type:ex.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(tr(13))})}function i9(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const l=t[s];typeof e[l]=="function"&&(n[l]=e[l])}const i=Object.keys(n);let r;try{Aue(n)}catch(s){r=s}return function(l={},c){if(r)throw r;let h=!1;const d={};for(let f=0;f<i.length;f++){const p=i[f],v=n[p],x=l[p],b=v(x,c);if(typeof b>"u")throw c&&c.type,new Error(tr(14));d[p]=b,h=h||b!==x}return h=h||i.length!==Object.keys(l).length,h?d:l}}function tx(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...i)=>t(n(...i)))}function Pue(...e){return t=>(n,i)=>{const r=t(n,i);let s=()=>{throw new Error(tr(15))};const l={getState:r.getState,dispatch:(h,...d)=>s(h,...d)},c=e.map(h=>h(l));return s=tx(...c)(r.dispatch),{...r,dispatch:s}}}function r9(e){return iT(e)&&"type"in e&&typeof e.type=="string"}var s9=Symbol.for("immer-nothing"),mO=Symbol.for("immer-draftable"),Ir=Symbol.for("immer-state");function ma(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gs=Object,wh=gs.getPrototypeOf,nx="constructor",My="prototype",VN="configurable",ix="enumerable",lv="writable",tp="value",Zo=e=>!!e&&!!e[Ir];function Ta(e){var t;return e?a9(e)||Oy(e)||!!e[mO]||!!((t=e[nx])!=null&&t[mO])||Iy(e)||Dy(e):!1}var _ue=gs[My][nx].toString(),pO=new WeakMap;function a9(e){if(!e||!rT(e))return!1;const t=wh(e);if(t===null||t===gs[My])return!0;const n=gs.hasOwnProperty.call(t,nx)&&t[nx];if(n===Object)return!0;if(!$d(n))return!1;let i=pO.get(n);return i===void 0&&(i=Function.toString.call(n),pO.set(n,i)),i===_ue}function Ry(e,t,n=!0){Np(e)===0?(n?Reflect.ownKeys(e):gs.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((i,r)=>t(r,i,e))}function Np(e){const t=e[Ir];return t?t.type_:Oy(e)?1:Iy(e)?2:Dy(e)?3:0}var gO=(e,t,n=Np(e))=>n===2?e.has(t):gs[My].hasOwnProperty.call(e,t),zN=(e,t,n=Np(e))=>n===2?e.get(t):e[t],rx=(e,t,n,i=Np(e))=>{i===2?e.set(t,n):i===3?e.add(n):e[t]=n};function Mue(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Oy=Array.isArray,Iy=e=>e instanceof Map,Dy=e=>e instanceof Set,rT=e=>typeof e=="object",$d=e=>typeof e=="function",DS=e=>typeof e=="boolean";function Rue(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Lo=e=>e.copy_||e.base_,sT=e=>e.modified_?e.copy_:e.base_;function qN(e,t){if(Iy(e))return new Map(e);if(Dy(e))return new Set(e);if(Oy(e))return Array[My].slice.call(e);const n=a9(e);if(t===!0||t==="class_only"&&!n){const i=gs.getOwnPropertyDescriptors(e);delete i[Ir];let r=Reflect.ownKeys(i);for(let s=0;s<r.length;s++){const l=r[s],c=i[l];c[lv]===!1&&(c[lv]=!0,c[VN]=!0),(c.get||c.set)&&(i[l]={[VN]:!0,[lv]:!0,[ix]:c[ix],[tp]:e[l]})}return gs.create(wh(e),i)}else{const i=wh(e);if(i!==null&&n)return{...e};const r=gs.create(i);return gs.assign(r,e)}}function aT(e,t=!1){return Ly(e)||Zo(e)||!Ta(e)||(Np(e)>1&&gs.defineProperties(e,{set:v0,add:v0,clear:v0,delete:v0}),gs.freeze(e),t&&Ry(e,(n,i)=>{aT(i,!0)},!1)),e}function Oue(){ma(2)}var v0={[tp]:Oue};function Ly(e){return e===null||!rT(e)?!0:gs.isFrozen(e)}var sx="MapSet",WN="Patches",vO="ArrayMethods",o9={};function Mu(e){const t=o9[e];return t||ma(0,e),t}var xO=e=>!!o9[e],np,l9=()=>np,Iue=(e,t)=>
672({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:xO(sx)?Mu(sx):void 0,arrayMethodsPlugin_:xO(vO)?Mu(vO):void 0});function yO(e,t){t&&(e.patchPlugin_=Mu(WN),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function HN(e){KN(e),e.drafts_.forEach(Due),e.drafts_=null}function KN(e){e===np&&(np=e.parent_)}var bO=e=>np=Iue(np,e);function Due(e){const t=e[Ir];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function wO(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Ir].modified_&&(HN(t),ma(4)),Ta(e)&&(e=SO(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ir].base_,e,t)}else e=SO(t,n);return Lue(t,e,!0),HN(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==s9?e:void 0}function SO(e,t){if(Ly(t))return t;const n=t[Ir];if(!n)return ax(t,e.handledSet_,e);if(!Uy(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:i}=n;if(i)for(;i.length>0;)i.pop()(e);d9(n,e)}return n.copy_}function Lue(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&aT(t,n)}function c9(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Uy=(e,t)=>e.scope_===t,Uue=[];function u9(e,t,n,i){const r=Lo(e),s=e.type_;if(i!==void 0&&zN(r,i,s)===t){rx(r,i,n,s);return}if(!e.draftLocations_){const c=e.draftLocations_=new Map;Ry(r,(h,d)=>{if(Zo(d)){const f=c.get(d)||[];f.push(h),c.set(d,f)}})}const l=e.draftLocations_.get(t)??Uue;for(const c of l)rx(r,c,n,s)}function Bue(e,t,n){e.callbacks_.push(function(r){var c;const s=t;if(!s||!Uy(s,r))return;(c=r.mapSetPlugin_)==null||c.fixSetContents(s);const l=sT(s);u9(e,s.draft_??s,l,n),d9(s,r)})}function d9(e,t){var i;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((i=e.assigned_)==null?void 0:i.size)??0)>0)){const{patchPlugin_:r}=t;if(r){const s=r.getPath(e);s&&r.generatePatches_(e,s,t)}c9(e)}}function Fue(e,t,n){const{scope_:i}=e;if(Zo(n)){const r=n[Ir];Uy(r,i)&&r.callbacks_.push(function(){cv(e);const l=sT(r);u9(e,n,l,t)})}else Ta(n)&&e.callbacks_.push(function(){const s=Lo(e);e.type_===3?s.has(n)&&ax(n,i.handledSet_,i):zN(s,t,e.type_)===n&&i.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ax(zN(e.copy_,t,e.type_),i.handledSet_,i)})}function ax(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Zo(e)||t.has(e)||!Ta(e)||Ly(e)||(t.add(e),Ry(e,(i,r)=>{if(Zo(r)){const s=r[Ir];if(Uy(s,n)){const l=sT(s);rx(e,i,l,e.type_),c9(s)}}else Ta(r)&&ax(r,t,n)})),e}function $ue(e,t){const n=Oy(e),i={type_:n?1:0,scope_:t?t.scope_:l9(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=i,s=ox;n&&(r=[i],s=ip);const{revoke:l,proxy:c}=Proxy.revocable(r,s);return i.draft_=c,i.revoke_=l,[c,i]}var ox={get(e,t){if(t===Ir)return e;let n=e.scope_.arrayMethodsPlugin_;const i=e.type_===1&&typeof t=="string";if(i&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const r=Lo(e);if(!gO(r,t,e.type_))return Vue(e,r,t);const s=r[t];if(e.finalized_||!Ta(s)||i&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&Rue(t))return s;if(s===LS(e.base_,t)){cv(e);const l=e.type_===1?+t:t,c=YN(e.scope_,s,e,l);return e.copy_[l]=c}return s},has(e,t){return t in Lo(e)},ownKeys(e){return Reflect.ownKeys(Lo(e))},set(e,t,n){const i=h9(Lo(e),t);if(i!=null&&i.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const r=LS(Lo(e),t),s=r==null?void 0:r[Ir];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Mue(n,r)&&(n!==void 0||gO(e.base_,t,e.type_)))return!0;cv(e),GN(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),Fue(e,t,n)),!0},deleteProperty(e,t){return cv(e),LS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),GN(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Lo(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i&&{[lv]:!0,[VN]:e.type_!==1||t!=="length",[ix]:i[ix],[tp]:n[t]}},defineProperty(){ma(11)},getPrototypeOf(e){return wh(e.base_)},setPrototypeOf(){ma(12)}},ip={};
672for(let e in ox){let t=ox[e];ip[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}ip.deleteProperty=function(e,t){return ip.set.call(this,e,t,void 0)};ip.set=function(e,t,n){return ox.set.call(this,e[0],t,n,e[0])};function LS(e,t){const n=e[Ir];return(n?Lo(n):e)[t]}function Vue(e,t,n){var r;const i=h9(t,n);return i?tp in i?i[tp]:(r=i.get)==null?void 0:r.call(e.draft_):void 0}function h9(e,t){if(!(t in e))return;let n=wh(e);for(;n;){const i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=wh(n)}}function GN(e){e.modified_||(e.modified_=!0,e.parent_&&GN(e.parent_))}function cv(e){e.copy_||(e.assigned_=new Map,e.copy_=qN(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var zue=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,i,r)=>{if($d(n)&&!$d(i)){const l=i;i=n;const c=this;return function(d=l,...f){return c.produce(d,p=>i.call(this,p,...f))}}$d(i)||ma(6),r!==void 0&&!$d(r)&&ma(7);let s;if(Ta(n)){const l=bO(this),c=YN(l,n,void 0);let h=!0;try{s=i(c),h=!1}finally{h?HN(l):KN(l)}return yO(l,r),wO(s,l)}else if(!n||!rT(n)){if(s=i(n),s===void 0&&(s=n),s===s9&&(s=void 0),this.autoFreeze_&&aT(s,!0),r){const l=[],c=[];Mu(WN).generateReplacementPatches_(n,s,{patches_:l,inversePatches_:c}),r(l,c)}return s}else ma(1,n)},this.produceWithPatches=(n,i)=>{if($d(n))return(c,...h)=>this.produceWithPatches(c,d=>n(d,...h));let r,s;return[this.produce(n,i,(c,h)=>{r=c,s=h}),r,s]},DS(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),DS(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),DS(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ta(t)||ma(8),Zo(t)&&(t=$s(t));const n=bO(this),i=YN(n,t,void 0);return i[Ir].isManual_=!0,KN(n),i}finishDraft(t,n){const i=t&&t[Ir];(!i||!i.isManual_)&&ma(9);const{scope_:r}=i;return yO(r,n),wO(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let i;for(i=n.length-1;i>=0;i--){const s=n[i];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}i>-1&&(n=n.slice(i+1));const r=Mu(WN).applyPatches_;return Zo(t)?r(t,n):this.produce(t,s=>r(s,n))}};function YN(e,t,n,i){const[r,s]=Iy(t)?Mu(sx).proxyMap_(t,n):Dy(t)?Mu(sx).proxySet_(t,n):$ue(t,n);return((n==null?void 0:n.scope_)??l9()).drafts_.push(r),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=i,n&&i!==void 0?Bue(n,s,i):s.callbacks_.push(function(h){var f;(f=h.mapSetPlugin_)==null||f.fixSetContents(s);const{patchPlugin_:d}=h;s.modified_&&d&&d.generatePatches_(s,[],h)}),r}function $s(e){return Zo(e)||ma(10,e),f9(e)}function f9(e){if(!Ta(e)||Ly(e))return e;const t=e[Ir];let n,i=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=qN(e,t.scope_.immer_.useStrictShallowCopy_),i=t.scope_.immer_.shouldUseStrictIteration()}else n=qN(e,!0);return Ry(n,(r,s)=>{rx(n,r,f9(s))},i),t&&(t.finalized_=!1),n}var que=new zue,m9=que.produce;function p9(e){return({dispatch:n,getState:i})=>r=>s=>typeof s=="function"?s(n,i,e):r(s)}var Wue=p9(),Hue=p9,Kue=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?tx:tx.apply(null,arguments)};function ws(e,t){function n(...i){if(t){let r=t(...i);if(!r)throw new Error(bs(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:i[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=i=>r9(i)&&i.type===e,n}var g9=class dm extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,dm.prototype)}static get[Symbol.species](){return dm}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new dm(...t[0].concat(this)):new dm(...t.concat(this))}};function kO(e){return Ta(e)?m9(e,()=>{}):e}function x0(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Gue(e){return typeof e=="boolean"}var Yue=()=>function(t){const{thunk:n=!0,immutableCheck:i=!0,serializableCheck:r=!0,actionCreatorCheck:s=!0}=t??{};let l=new g9;return n&&(Gue(n)?l.push(Wue):l.push(Hue(n.extraArgument))),l},v9="RTK_autoBatch",_n=()=>e=>({payload:e,meta:{[v9]:!0}}),NO=e=>t=>{setTimeout(t,e)},Que=(e,t)=>
672n=>{let i=!1;const r=()=>{i||(i=!0,cancelAnimationFrame(s),clearTimeout(l),n())},s=e(r),l=setTimeout(r,t)},x9=(e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let r=!0,s=!1,l=!1;const c=new Set,h=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Que(window.requestAnimationFrame,100):NO(10):e.type==="callback"?e.queueNotification:NO(e.timeout),d=()=>{l=!1,s&&(s=!1,c.forEach(f=>f()))};return Object.assign({},i,{subscribe(f){const p=()=>r&&f(),v=i.subscribe(p);return c.add(f),()=>{v(),c.delete(f)}},dispatch(f){var p;try{return r=!((p=f==null?void 0:f.meta)!=null&&p[v9]),s=!r,s&&(l||(l=!0,h(d))),i.dispatch(f)}finally{r=!0}}})},Xue=e=>function(n){const{autoBatch:i=!0}=n??{};let r=new g9(e);return i&&r.push(x9(typeof i=="object"?i:void 0)),r};function Jue(e){const t=Yue(),{reducer:n=void 0,middleware:i,devTools:r=!0,preloadedState:s=void 0,enhancers:l=void 0}=e||{};let c;if(typeof n=="function")c=n;else if(iT(n))c=i9(n);else throw new Error(bs(1));let h;typeof i=="function"?h=i(t):h=t();let d=tx;r&&(d=Kue({trace:!1,...typeof r=="object"&&r}));const f=Pue(...h),p=Xue(f);let v=typeof l=="function"?l(p):p();const x=d(...v);return n9(c,s,x)}function y9(e){const t={},n=[];let i;const r={addCase(s,l){const c=typeof s=="string"?s:s.type;if(!c)throw new Error(bs(28));if(c in t)throw new Error(bs(29));return t[c]=l,r},addAsyncThunk(s,l){return l.pending&&(t[s.pending.type]=l.pending),l.rejected&&(t[s.rejected.type]=l.rejected),l.fulfilled&&(t[s.fulfilled.type]=l.fulfilled),l.settled&&n.push({matcher:s.settled,reducer:l.settled}),r},addMatcher(s,l){return n.push({matcher:s,reducer:l}),r},addDefaultCase(s){return i=s,r}};return e(r),[t,n,i]}function Zue(e){return typeof e=="function"}function ede(e,t){let[n,i,r]=y9(t),s;if(Zue(e))s=()=>kO(e());else{const c=kO(e);s=()=>c}function l(c=s(),h){let d=[n[h.type],...i.filter(({matcher:f})=>f(h)).map(({reducer:f})=>f)];return d.filter(f=>!!f).length===0&&(d=[r]),d.reduce((f,p)=>{if(p)if(Zo(f)){const x=p(f,h);return x===void 0?f:x}else{if(Ta(f))return m9(f,v=>p(v,h));{const v=p(f,h);if(v===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return v}}return f},c)}return l.getInitialState=s,l}var tde="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nde=(e=21)=>{let t="",n=e;for(;n--;)t+=tde[Math.random()*64|0];return t},ide=Symbol.for("rtk-slice-createasyncthunk");function rde(e,t){return`${e}/${t}`}function sde({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[ide];return function(r){const{name:s,reducerPath:l=s}=r;if(!s)throw new Error(bs(11));const c=(typeof r.reducers=="function"?r.reducers(ode()):r.reducers)||{},h=Object.keys(c),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(C,P){const A=typeof C=="string"?C:C.type;if(!A)throw new Error(bs(12));if(A in d.sliceCaseReducersByType)throw new Error(bs(13));return d.sliceCaseReducersByType[A]=P,f},addMatcher(C,P){return d.sliceMatchers.push({matcher:C,reducer:P}),f},exposeAction(C,P){return d.actionCreators[C]=P,f},exposeCaseReducer(C,P){return d.sliceCaseReducersByName[C]=P,f}};h.forEach(C=>{const P=c[C],A={reducerName:C,type:rde(s,C),createNotation:typeof r.reducers=="function"};cde(P)?dde(A,P,f,t):lde(A,P,f)});function p(){const[C={},P=[],A=void 0]=typeof r.extraReducers=="function"?y9(r.extraReducers):[r.extraReducers],M={...C,...d.sliceCaseReducersByType};return ede(r.initialState,R=>{for(let B in M)R.addCase(B,M[B]);for(let B of d.sliceMatchers)R.addMatcher(B.matcher,B.reducer);for(let B of P)R.addMatcher(B.matcher,B.reducer);A&&R.addDefaultCase(A)})}const v=C=>C,x=new Map,b=new WeakMap;let S;function N(C,P){return S||(S=p()),S(C,P)}function j(){return S||(S=p()),S.getInitialState()}function T(C,P=!1){function A(R){let B=R[C];return typeof B>"u"&&P&&(B=x0(b,A,j)),B}function M(R=v){const B=x0(x,P,()=>new WeakMap);return x0(B,R,()=>{const U={};for(const[O,F]of Object.entries(r.selectors??{}))U[O]=ade(F,R,()=>x0(b,R,j),P);return U})}return{reducerPath:C,getSelectors:M,get selectors(){return M(A)},selectSlice:A}}const E={name:s,reducer:N,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:j,...T(l),injectInto(C,{reducerPath:P,...A}={}){const M=P??l;return C.inject({reducerPath:M,reducer:N},A),{...E,...T(M,!0)}}};return E}}function ade(e,t,n,i){function r(s,...l){let c=t(s);return typeof c>"u"&&i&&(c=n()),e(c,...l)}return r.unwrapped=e,r}var Sr=sde();function ode(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function lde({type:e,reducerName:t,createNotation:n},i,r){let s,l;if("reducer"in i){if(n&&!ude(i))throw new Error(bs(17));s=i.reducer,l=i.prepare}else s=i;r.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,l?ws(e,l):ws(e))}function cde(e){return e._reducerDefinitionType==="asyncThunk"}function ude(e){return e._reducerDefinitionType==="reducerWithPrepare"}function dde({type:e,reducerName:t},n,i,r){if(!r)throw new Error(bs(18));const{payloadCreator:s,fulfilled:l,pending:c,rejected:h,settled:d,options:f}=n,p=r(e,s,f);
672i.exposeAction(t,p),l&&i.addCase(p.fulfilled,l),c&&i.addCase(p.pending,c),h&&i.addCase(p.rejected,h),d&&i.addMatcher(p.settled,d),i.exposeCaseReducer(t,{fulfilled:l||y0,pending:c||y0,rejected:h||y0,settled:d||y0})}function y0(){}var hde="task",b9="listener",w9="completed",oT="cancelled",fde=`task-${oT}`,mde=`task-${w9}`,QN=`${b9}-${oT}`,pde=`${b9}-${w9}`,By=class{constructor(e){Rs(this,"code");Rs(this,"name","TaskAbortError");Rs(this,"message");this.code=e,this.message=`${hde} ${oT} (reason: ${e})`}},lT=(e,t)=>{if(typeof e!="function")throw new TypeError(bs(32))},lx=()=>{},S9=(e,t=lx)=>(e.catch(t),e),k9=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Su=e=>{if(e.aborted)throw new By(e.reason)};function N9(e,t){let n=lx;return new Promise((i,r)=>{const s=()=>r(new By(e.reason));if(e.aborted){s();return}n=k9(e,s),t.finally(()=>n()).then(i,r)}).finally(()=>{n=lx})}var gde=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof By?"cancelled":"rejected",error:n}}finally{t==null||t()}},cx=e=>t=>S9(N9(e,t).then(n=>(Su(e),n))),j9=e=>{const t=cx(e);return n=>t(new Promise(i=>setTimeout(i,n)))},{assign:oh}=Object,jO={},Fy="listenerMiddleware",vde=(e,t)=>{const n=i=>k9(e,()=>i.abort(e.reason));return(i,r)=>{lT(i);const s=new AbortController;n(s);const l=gde(async()=>{Su(e),Su(s.signal);const c=await i({pause:cx(s.signal),delay:j9(s.signal),signal:s.signal});return Su(s.signal),c},()=>s.abort(mde));return r!=null&&r.autoJoin&&t.push(l.catch(lx)),{result:cx(e)(l),cancel(){s.abort(fde)}}}},xde=(e,t)=>{const n=async(i,r)=>{Su(t);let s=()=>{};const c=[new Promise((h,d)=>{let f=e({predicate:i,effect:(p,v)=>{v.unsubscribe(),h([p,v.getState(),v.getOriginalState()])}});s=()=>{f(),d()}})];r!=null&&c.push(new Promise(h=>setTimeout(h,r,null)));try{const h=await N9(t,Promise.race(c));return Su(t),h}finally{s()}};return((i,r)=>S9(n(i,r)))},C9=e=>{let{type:t,actionCreator:n,matcher:i,predicate:r,effect:s}=e;if(t)r=ws(t).match;else if(n)t=n.type,r=n.match;else if(i)r=i;else if(!r)throw new Error(bs(21));return lT(s),{predicate:r,type:t,effect:s}},T9=oh(e=>{const{type:t,predicate:n,effect:i}=C9(e);return{id:nde(),effect:i,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(bs(22))}}},{withTypes:()=>T9}),CO=(e,t)=>{const{type:n,effect:i,predicate:r}=C9(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===r)&&s.effect===i)},XN=e=>{e.pending.forEach(t=>{t.abort(QN)})},yde=(e,t)=>()=>{for(const n of t.keys())XN(n);e.clear()},TO=(e,t,n)=>{try{e(t,n)}catch(i){setTimeout(()=>{throw i},0)}},E9=oh(ws(`${Fy}/add`),{withTypes:()=>E9}),bde=ws(`${Fy}/removeAll`),A9=oh(ws(`${Fy}/remove`),{withTypes:()=>A9}),wde=(...e)=>{console.error(`${Fy}/error`,...e)},jp=(e={})=>{const t=new Map,n=new Map,i=x=>{const b=n.get(x)??0;n.set(x,b+1)},r=x=>{const b=n.get(x)??1;b===1?n.delete(x):n.set(x,b-1)},{extra:s,onError:l=wde}=e;lT(l);const c=x=>(x.unsubscribe=()=>t.delete(x.id),t.set(x.id,x),b=>{x.unsubscribe(),b!=null&&b.cancelActive&&XN(x)}),h=(x=>{const b=CO(t,x)??T9(x);return c(b)});oh(h,{withTypes:()=>h});const d=x=>{const b=CO(t,x);return b&&(b.unsubscribe(),x.cancelActive&&XN(b)),!!b};oh(d,{withTypes:()=>d});const f=async(x,b,S,N)=>{const j=new AbortController,T=xde(h,j.signal),E=[];try{x.pending.add(j),i(x),await Promise.resolve(x.effect(b,oh({},S,{getOriginalState:N,condition:(C,P)=>T(C,P).then(Boolean),take:T,delay:j9(j.signal),pause:cx(j.signal),extra:s,signal:j.signal,fork:vde(j.signal,E),unsubscribe:x.unsubscribe,subscribe:()=>{t.set(x.id,x)},cancelActiveListeners:()=>{x.pending.forEach((C,P,A)=>{C!==j&&(C.abort(QN),A.delete(C))})},cancel:()=>{j.abort(QN),x.pending.delete(j)},throwIfCancelled:()=>{Su(j.signal)}})))}catch(C){C instanceof By||TO(l,C,{raisedBy:"effect"})}finally{await Promise.all(E),j.abort(pde),r(x),x.pending.delete(j)}},p=yde(t,n);return{middleware:x=>b=>S=>{if(!r9(S))return b(S);if(E9.match(S))return h(S.payload);if(bde.match(S)){p();return}if(A9.match(S))return d(S.payload);let N=x.getState();const j=()=>
672{if(N===jO)throw new Error(bs(23));return N};let T;try{if(T=b(S),t.size>0){const E=x.getState(),C=Array.from(t.values());for(const P of C){let A=!1;try{A=P.predicate(S,E,N)}catch(M){A=!1,TO(l,M,{raisedBy:"predicate"})}A&&f(P,S,x,j)}}}finally{N=jO}return T},startListening:h,stopListening:d,clearListeners:p}};function bs(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Sde={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},P9=Sr({name:"chartLayout",initialState:Sde,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,i,r,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(i=t.payload.right)!==null&&i!==void 0?i:0,e.margin.bottom=(r=t.payload.bottom)!==null&&r!==void 0?r:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),$y=P9.actions,kde=$y.setMargin,Nde=$y.setLayout,jde=$y.setChartSize,Cde=$y.setScale,Tde=P9.reducer;function _9(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function Mt(e){return Number.isFinite(e)}function oo(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function EO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Gd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EO(Object(n),!0).forEach(function(i){Ede(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Ede(e,t,n){return(t=Ade(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ade(e){var t=Pde(e,"string");return typeof t=="symbol"?t:t+""}function Pde(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vi(e,t,n){return dr(e)||dr(t)?n:ao(t)?Fu(e,t,n):typeof t=="function"?t(e):n}var _de=(e,t,n)=>{if(t&&n){var i=n.width,r=n.height,s=t.align,l=t.verticalAlign,c=t.layout;if((c==="vertical"||c==="horizontal"&&l==="middle")&&s!=="center"&&Xe(e[s]))return Gd(Gd({},e),{},{[s]:e[s]+(i||0)});if((c==="horizontal"||c==="vertical"&&s==="center")&&l!=="middle"&&Xe(e[l]))return Gd(Gd({},e),{},{[l]:e[l]+(r||0)})}return e},uo=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",M9=(e,t,n,i)=>{if(i)return e.map(c=>c.coordinate);var r,s,l=e.map(c=>(c.coordinate===t&&(r=!0),c.coordinate===n&&(s=!0),c.coordinate));return r||l.push(t),s||l.push(n),l},R9=(e,t,n)=>{if(!e)return null;var i=e.duplicateDomain,r=e.type,s=e.range,l=e.scale,c=e.realScaleType,h=e.isCategorical,d=e.categoricalDomain,f=e.tickCount,p=e.ticks,v=e.niceTicks,x=e.axisType;if(!l)return null;var b=c==="scaleBand"&&l.bandwidth?l.bandwidth()/2:2,S=r==="category"&&l.bandwidth?l.bandwidth()/b:0;if(S=x==="angleAxis"&&s&&s.length>=2?Fs(s[0]-s[1])*2*S:S,p||v){var N=(p||v||[]).map((j,T)=>{var E=i?i.indexOf(j):j,C=l.map(E);return Mt(C)?{coordinate:C+S,value:j,offset:S,index:T}:null}).filter(Jr);return N}return h&&d?d.map((j,T)=>{var E=l.map(j);return Mt(E)?{coordinate:E+S,value:j,index:T,offset:S}:null}).filter(Jr):l.ticks&&f!=null?l.ticks(f).map((j,T)=>{var E=l.map(j);return Mt(E)?{coordinate:E+S,value:j,index:T,offset:S}:null}).filter(Jr):l.domain().map((j,T)=>{var E=l.map(j);return Mt(E)?{coordinate:E+S,value:i?i[j]:j,index:T,offset:S}:null}).filter(Jr)},Mde=e=>{var t,n=e.length;if(!(n<=0)){var i=(t=e[0])===null||t===void 0?void 0:t.length;if(!(i==null||i<=0))for(var r=0;r<i;++r)for(var s=0,l=0,c=0;c<n;++c){var h=e[c],d=h==null?void 0:h[r];if(d!=null){var f=d[1],p=d[0],v=so(f)?p:f;v>=0?(d[0]=s,s+=v,d[1]=s):(d[0]=l,l+=v,d[1]=l)}}}},Rde=e=>{var t,n=e.length;if(!(n<=0)){var i=(t=e[0])===null||t===void 0?void 0:t.length;if(!(i==null||i<=0))for(var r=0;r<i;++r)for(var s=0,l=0;l<n;++l){var c=e[l],h=c==null?void 0:c[r];if(h!=null){var d=so(h[1])?h[0]:h[1];d>=0?(h[0]=s,s+=d,h[1]=s):(h[0]=0,h[1]=0)}}}},Ode={sign:Mde,expand:Jle,none:Pu,silhouette:Zle,wiggle:ece,positive:Rde},Ide=(e,t,n)=>{var i,r=(i=Ode[n])!==null&&i!==void 0?i:Pu,s=Xle().keys(t).value((c,h)=>Number(Vi(c,h,0))).order(LN).offset(r),l=s(e);return l.forEach((c,h)=>
672{c.forEach((d,f)=>{var p=Vi(e[f],t[h],0);Array.isArray(p)&&p.length===2&&Xe(p[0])&&Xe(p[1])&&(d[0]=p[0],d[1]=p[1])})}),l};function Dde(e){return e==null?void 0:String(e)}function AO(e){var t=e.axis,n=e.ticks,i=e.bandSize,r=e.entry,s=e.index,l=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!dr(r[t.dataKey])){var c=B8(n,"value",r[t.dataKey]);if(c)return c.coordinate+i/2}return n!=null&&n[s]?n[s].coordinate+i/2:null}var h=Vi(r,dr(l)?t.dataKey:l),d=t.scale.map(h);return Xe(d)?d:null}var Lde=e=>{var t=e.flat(2).filter(Xe);return[Math.min(...t),Math.max(...t)]},Ude=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Bde=(e,t,n)=>{if(!(e==null||Object.keys(e).length===0))return Ude(Object.keys(e).reduce((i,r)=>{var s=e[r];if(!s)return i;var l=s.stackedData,c=l.reduce((h,d)=>{var f=_9(d,t,n),p=Lde(f);return!Mt(p[0])||!Mt(p[1])?h:[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]))},PO=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_O=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ux=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!n||i>0)return i}if(e&&t&&t.length>=2){for(var r=_y(t,f=>f.coordinate),s=1/0,l=1,c=r.length;l<c;l++){var h=r[l],d=r[l-1];s=Math.min(((h==null?void 0:h.coordinate)||0)-((d==null?void 0:d.coordinate)||0),s)}return s===1/0?0:s}return n?void 0:0};function MO(e){var t=e.tooltipEntrySettings,n=e.dataKey,i=e.payload,r=e.value,s=e.name;return Gd(Gd({},t),{},{dataKey:n,payload:i,value:r,name:s})}function O9(e,t){if(e!=null)return String(e);if(typeof t=="string")return t}var Fde=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},$de=(e,t)=>t==="centric"?e.angle:e.radius,sl=e=>e.layout.width,al=e=>e.layout.height,Vde=e=>e.layout.scale,I9=e=>e.layout.margin,Vy=pe(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),zy=pe(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),zde="data-recharts-item-index",qde="data-recharts-item-id",Cp=60;function RO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function b0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RO(Object(n),!0).forEach(function(i){Wde(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Wde(e,t,n){return(t=Hde(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hde(e){var t=Kde(e,"string");return typeof t=="symbol"?t:t+""}function Kde(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gde=e=>e.brush.height;function Yde(e){var t=zy(e);return t.reduce((n,i)=>{if(i.orientation==="left"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:Cp;return n+r}return n},0)}function Qde(e){var t=zy(e);return t.reduce((n,i)=>{if(i.orientation==="right"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:Cp;return n+r}return n},0)}function Xde(e){var t=Vy(e);return t.reduce((n,i)=>i.orientation==="top"&&!i.mirror&&!i.hide?n+i.height:n,0)}function Jde(e){var t=Vy(e);return t.reduce((n,i)=>i.orientation==="bottom"&&!i.mirror&&!i.hide?n+i.height:n,0)}var hr=pe([sl,al,I9,Gde,Yde,Qde,Xde,Jde,t9,yue],(e,t,n,i,r,s,l,c,h,d)=>{var f={left:(n.left||0)+r,right:(n.right||0)+s},p={top:(n.top||0)+l,bottom:(n.bottom||0)+c},v=b0(b0({},p),f),x=v.bottom;v.bottom+=i,v=_de(v,h,d);var b=e-v.left-v.right,S=t-v.top-v.bottom;return b0(b0({brushBottom:x},v),{},{width:Math.max(b,0),height:Math.max(S,0)})}),Zde=pe(hr,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),D9=pe(sl,al,(e,t)=>({x:0,y:0,width:e,height:t})),ehe=w.createContext(null),ns=()=>w.useContext(ehe)!=null,qy=e=>e.brush,Wy=pe([qy,hr,I9],(e,t,n)=>({height:e.height,x:Xe(e.x)?e.x:t.left,y:Xe(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:Xe(e.width)?e.width:t.width}));function the(e,t,{signal:n,edges:i}={}){let r,s=null;const l=i!=null&&i.includes("leading"),c=i==null||i.includes("trailing"),h=()=>{s!==null&&(e.apply(r,s),r=void 0,s=null)},d=()=>{c&&h(),x()};let f=null;const p=()=>{f!=null&&clearTimeout(f),f=setTimeout(()=>{f=null,d()},t)},v=()=>{f!==null&&(clearTimeout(f),f=null)},x=()=>{v(),r=void 0,s=null},b=()=>{h()},S=function(...N){if(n!=null&&n.aborted)return;r=this,s=N;const j=f==null;p(),l&&j&&h()};return S.schedule=p,S.cancel=x,S.flush=b,n==null||n.addEventListener("abort",x,{once:!0}),S}function nhe(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:i=!1,trailing:r=!0,maxWait:s}=n,l=Array(2);i&&(l[0]="leading"),r&&(l[1]="trailing");let c,h=null;const d=the(function(...v){c=e.apply(this,v),h=null},t,{edges:l}),f=function(...v){return s!=null&&(h===null&&(h=Date.now()),Date.now()-h>=s)?(c=e.apply(this,v),h=Date.now(),d.cancel(),d.schedule(),c):(d.apply(this,v),c)},p=()=>(d.flush(),c);return f.cancel=d.cancel,f.flush=p,f}function ihe(e,t=0,n={}){const{leading:i=!0,trailing:r=!0}=n;return nhe(e,t,{leading:i,maxWait:t,trailing:r})}var dx=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=0;console.warn(n.replace(/%s/g,()=>r[l++]))}},Xa={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}}
672,L9=(e,t,n)=>{var i=n.width,r=i===void 0?Xa.width:i,s=n.height,l=s===void 0?Xa.height:s,c=n.aspect,h=n.maxHeight,d=_u(r)?e:Number(r),f=_u(l)?t:Number(l);return c&&c>0&&(d?f=d/c:f&&(d=f*c),h&&f!=null&&f>h&&(f=h)),{calculatedWidth:d,calculatedHeight:f}},rhe={width:0,height:0,overflow:"visible"},she={width:0,overflowX:"visible"},ahe={height:0,overflowY:"visible"},ohe={},lhe=e=>{var t=e.width,n=e.height,i=_u(t),r=_u(n);return i&&r?rhe:i?she:r?ahe:ohe};function che(e){var t=e.width,n=e.height,i=e.aspect,r=t,s=n;return r===void 0&&s===void 0?(r=Xa.width,s=Xa.height):r===void 0?r=i&&i>0?void 0:Xa.width:s===void 0&&(s=i&&i>0?void 0:Xa.height),{width:r,height:s}}var uhe=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function hx(){return hx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},hx.apply(null,arguments)}function OO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function IO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OO(Object(n),!0).forEach(function(i){dhe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function dhe(e,t,n){return(t=hhe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hhe(e){var t=fhe(e,"string");return typeof t=="symbol"?t:t+""}function fhe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mhe(e,t){return xhe(e)||vhe(e,t)||ghe(e,t)||phe()}function phe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
673In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ghe(e,t){if(e){if(typeof e=="string")return DO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?DO(e,t):void 0}}function DO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function vhe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function xhe(e){if(Array.isArray(e))return e}function yhe(e,t){if(e==null)return{};var n,i,r=bhe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bhe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var U9=w.createContext(Xa.initialDimension);function whe(e){return oo(e.width)&&oo(e.height)}function B9(e){var t=e.children,n=e.width,i=e.height,r=w.useMemo(()=>({width:n,height:i}),[n,i]);return whe(r)?w.createElement(U9.Provider,{value:r},t):null}var cT=()=>w.useContext(U9),She=w.forwardRef((e,t)=>{var n=e.aspect,i=e.initialDimension,r=i===void 0?Xa.initialDimension:i,s=e.width,l=e.height,c=e.minWidth,h=c===void 0?Xa.minWidth:c,d=e.minHeight,f=e.maxHeight,p=e.children,v=e.debounce,x=v===void 0?Xa.debounce:v,b=e.id,S=e.className,N=e.onResize,j=e.style,T=j===void 0?{}:j,E=yhe(e,uhe),C=w.useRef(null),P=w.useRef();P.current=N,w.useImperativeHandle(t,()=>C.current);var A=w.useState({containerWidth:r.width,containerHeight:r.height}),M=mhe(A,2),R=M[0],B=M[1],U=w.useCallback((W,q)=>{B($=>{var ge=Math.round(W),ue=Math.round(q);return $.containerWidth===ge&&$.containerHeight===ue?$:{containerWidth:ge,containerHeight:ue}})},[]);w.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Oh;var W=L=>{var J,ye=L[0];if(ye!=null){var Pe=ye.contentRect,Oe=Pe.width,je=Pe.height;U(Oe,je),(J=P.current)===null||J===void 0||J.call(P,Oe,je)}};x>0&&(W=ihe(W,x,{trailing:!0,leading:!1}));var q=new ResizeObserver(W),$=C.current.getBoundingClientRect(),ge=$.width,ue=$.height;return U(ge,ue),q.observe(C.current),()=>{q.disconnect()}},[U,x]);var O=R.containerWidth,F=R.containerHeight;dx(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=L9(O,F,{width:s,height:l,aspect:n,maxHeight:f}),re=ne.calculatedWidth,Q=ne.calculatedHeight;return dx(O<0||F<0||re!=null&&re>0||Q!=null&&Q>0,`The width(%s) and height(%s) of chart should be greater than 0,
674       please check the style of container, or the props width(%s) and height(%s),
675       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
676       height and width.`,re,Q,s,l,h,d,n),w.createElement("div",hx({id:b?"".concat(b):void 0,className:Rn("recharts-responsive-container",S),style:IO(IO({},T),{},{width:s,height:l,minWidth:h,minHeight:d,maxHeight:f}),ref:C},E),w.createElement("div",{style:lhe({width:s,height:l})},w.createElement(B9,{width:re,height:Q},p)))}),uT=w.forwardRef((e,t)=>
676{var n=cT();if(oo(n.width)&&oo(n.height))return e.children;var i=che({width:e.width,height:e.height,aspect:e.aspect}),r=i.width,s=i.height,l=L9(void 0,void 0,{width:r,height:s,aspect:e.aspect,maxHeight:e.maxHeight}),c=l.calculatedWidth,h=l.calculatedHeight;return Xe(c)&&Xe(h)?w.createElement(B9,{width:c,height:h},e.children):w.createElement(She,hx({},e,{width:r,height:s,ref:t}))});function dT(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Hy=()=>{var e,t=ns(),n=st(Zde),i=st(Wy),r=(e=st(qy))===null||e===void 0?void 0:e.padding;return!t||!i||!r?n:{width:i.width-r.left-r.right,height:i.height-r.top-r.bottom,x:r.left,y:r.top}},khe={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},F9=()=>{var e;return(e=st(hr))!==null&&e!==void 0?e:khe},$9=()=>st(sl),V9=()=>st(al),Fn=e=>e.layout.layoutType,Ih=()=>st(Fn),hT=()=>{var e=Ih();if(e==="horizontal"||e==="vertical")return e},z9=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},Nhe=()=>{var e=Ih();return e!==void 0},Tp=e=>{var t=wi(),n=ns(),i=e.width,r=e.height,s=cT(),l=i,c=r;return s&&(l=s.width>0?s.width:i,c=s.height>0?s.height:r),w.useEffect(()=>{!n&&oo(l)&&oo(c)&&t(jde({width:l,height:c}))},[t,n,l,c]),null},q9=Symbol.for("immer-nothing"),LO=Symbol.for("immer-draftable"),Ss=Symbol.for("immer-state");function pa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var rp=Object.getPrototypeOf;function Sh(e){return!!e&&!!e[Ss]}function Ru(e){var t;return e?W9(e)||Array.isArray(e)||!!e[LO]||!!((t=e.constructor)!=null&&t[LO])||Ep(e)||Gy(e):!1}var jhe=Object.prototype.constructor.toString(),UO=new WeakMap;function W9(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let i=UO.get(n);return i===void 0&&(i=Function.toString.call(n),UO.set(n,i)),i===jhe}function fx(e,t,n=!0){Ky(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((i,r)=>t(r,i,e))}function Ky(e){const t=e[Ss];return t?t.type_:Array.isArray(e)?1:Ep(e)?2:Gy(e)?3:0}function JN(e,t){return Ky(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function H9(e,t,n){const i=Ky(e);i===2?e.set(t,n):i===3?e.add(n):e[t]=n}function Che(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ep(e){return e instanceof Map}function Gy(e){return e instanceof Set}function Qc(e){return e.copy_||e.base_}function ZN(e,t){if(Ep(e))return new Map(e);if(Gy(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=W9(e);if(t===!0||t==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(e);delete i[Ss];let r=Reflect.ownKeys(i);for(let s=0;s<r.length;s++){const l=r[s],c=i[l];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(i[l]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[l]})}return Object.create(rp(e),i)}else{const i=rp(e);if(i!==null&&n)return{...e};const r=Object.create(i);return Object.assign(r,e)}}function fT(e,t=!1){return Yy(e)||Sh(e)||!Ru(e)||(Ky(e)>1&&Object.defineProperties(e,{set:w0,add:w0,clear:w0,delete:w0}),Object.freeze(e),t&&Object.values(e).forEach(n=>fT(n,!0))),e}function The(){pa(2)}var w0={value:The};function Yy(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Ehe={};function Ou(e){const t=Ehe[e];return t||pa(0,e),t}var sp;function K9(){return sp}function Ahe(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function BO(e,t){t&&(Ou("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ej(e){tj(e),e.drafts_.forEach(Phe),e.drafts_=null}function tj(e){e===sp&&(sp=e.parent_)}function FO(e){return sp=Ahe(sp,e)}function Phe(e){const t=e[Ss];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $O(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Ss].modified_&&(ej(t),pa(4)),Ru(e)&&(e=mx(t,e),t.parent_||px(t,e)),t.patches_&&Ou("Patches").generateReplacementPatches_(n[Ss].base_,e,t.patches_,t.inversePatches_)):e=mx(t,n,[]),ej(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==q9?e:void 0}function mx(e,t,n){if(Yy(t))return t;const i=e.immer_.shouldUseStrictIteration(),r=t[Ss];if(!r)return fx(t,(s,l)=>VO(e,r,t,s,l,n),i),t;if(r.scope_!==e)return t;if(!r.modified_)return px(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let l=s,c=!1;r.type_===3&&(l=new Set(s),s.clear(),c=!0),fx(l,(h,d)=>VO(e,r,s,h,d,n,c),i),px(e,s,!1),n&&e.patches_&&Ou("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function VO(e,t,n,i,r,s,l){if(r==null||typeof r!="object"&&!l)return;const c=Yy(r);if(!(c&&!l)){if(Sh(r)){const h=s&&t&&t.type_!==3&&!JN(t.assigned_,i)?s.concat(i):void 0,d=mx(e,r,h);if(H9(n,i,d),Sh(d))e.canAutoFreeze_=!1;else return}else l&&n.add(r);if(Ru(r)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[i]===r&&c)return;mx(e,r),(!t||!t.scope_.parent_)&&typeof i!="symbol"&&(Ep(n)?n.has(i):Object.prototype.propertyIsEnumerable.call(n,i))&&px(e,r)}}}function px(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&fT(t,n)}function _he(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:K9(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,s=mT;n&&(r=[i],s=ap);const{revoke:l,proxy:c}=Proxy.revocable(r,s);return i.draft_=c,i.revoke_=l,c}var mT={get(e,t){if(t===Ss)return e;const n=Qc(e);if(!JN(n,t))return Mhe(e,n,t);const i=n[t];return e.finalized_||!Ru(i)?i:i===US(e.base_,t)?(BS(e),e.copy_[t]=ij(i,e)):i},has(e,t){return t in Qc(e)},ownKeys(e){return Reflect.ownKeys(Qc(e))},set(e,t,n){const i=G9(Qc(e),t);if(i!=null&&i.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const r=US(Qc(e),t),s=r==null?void 0:r[Ss];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Che(n,r)&&(n!==void 0||JN(e.base_,t)))return!0;BS(e),nj(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return US(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,BS(e),nj(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Qc(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:i.enumerable,value:n[t]}},defineProperty(){pa(11)},getPrototypeOf(e){return rp(e.base_)},setPrototypeOf(){pa(12)}},ap={};fx(mT,(e,t)=>{ap[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ap.deleteProperty=function(e,t){return ap.set.call(this,e,t,void 0)};ap.set=function(e,t,n){return mT.set.call(this,e[0],t,n,e[0])};function US(e,t){const n=e[Ss];return(n?Qc(n):e)[t]}function Mhe(e,t,n){var r;const i=G9(t,n);return i?"value"in i?i.value:(r=i.get)==null?void 0:r.call(e.draft_):void 0}function G9(e,t){if(!(t in e))return;let n=rp(e);for(;n;){const i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=rp(n)}}function nj(e){e.modified_||(e.modified_=!0,e.parent_&&nj(e.parent_))}function BS(e){e.copy_||(e.copy_=ZN(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Rhe=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,i)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const l=this;return function(h=s,...d){return l.produce(h,f=>n.call(this,f,...d))}}typeof n!="function"&&pa(6),i!==void 0&&typeof i!="function"&&pa(7);let r;
676if(Ru(t)){const s=FO(this),l=ij(t,void 0);let c=!0;try{r=n(l),c=!1}finally{c?ej(s):tj(s)}return BO(s,i),$O(r,s)}else if(!t||typeof t!="object"){if(r=n(t),r===void 0&&(r=t),r===q9&&(r=void 0),this.autoFreeze_&&fT(r,!0),i){const s=[],l=[];Ou("Patches").generateReplacementPatches_(t,r,s,l),i(s,l)}return r}else pa(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(l,...c)=>this.produceWithPatches(l,h=>t(h,...c));let i,r;return[this.produce(t,n,(l,c)=>{i=l,r=c}),i,r]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ru(e)||pa(8),Sh(e)&&(e=Ohe(e));const t=FO(this),n=ij(e,void 0);return n[Ss].isManual_=!0,tj(t),n}finishDraft(e,t){const n=e&&e[Ss];(!n||!n.isManual_)&&pa(9);const{scope_:i}=n;return BO(i,t),$O(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(r.path.length===0&&r.op==="replace"){e=r.value;break}}n>-1&&(t=t.slice(n+1));const i=Ou("Patches").applyPatches_;return Sh(e)?i(e,t):this.produce(e,r=>i(r,t))}};function ij(e,t){const n=Ep(e)?Ou("MapSet").proxyMap_(e,t):Gy(e)?Ou("MapSet").proxySet_(e,t):_he(e,t);return(t?t.scope_:K9()).drafts_.push(n),n}function Ohe(e){return Sh(e)||pa(10,e),Y9(e)}function Y9(e){if(!Ru(e)||Yy(e))return e;const t=e[Ss];let n,i=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ZN(e,t.scope_.immer_.useStrictShallowCopy_),i=t.scope_.immer_.shouldUseStrictIteration()}else n=ZN(e,!0);return fx(n,(r,s)=>{H9(n,r,Y9(s))},i),t&&(t.finalized_=!1),n}var Ihe=new Rhe;Ihe.produce;var Dhe={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},Q9=Sr({name:"legend",initialState:Dhe,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:_n()},replaceLegendPayload:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next,s=$s(e).payload.indexOf(i);s>-1&&(e.payload[s]=r)},prepare:_n()},removeLegendPayload:{reducer(e,t){var n=$s(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:_n()}}}),Ap=Q9.actions;Ap.setLegendSize;Ap.setLegendSettings;var Lhe=Ap.addLegendPayload,Uhe=Ap.replaceLegendPayload,Bhe=Ap.removeLegendPayload,Fhe=Q9.reducer,FS={exports:{}},$S={};/**
677 * @license React
678 * use-sync-external-store-with-selector.production.js
679 *
680 * Copyright (c) Meta Platforms, Inc. and affiliates.
681 *
682 * This source code is licensed under the MIT license found in the
683 * LICENSE file in the root directory of this source tree.
684 */var zO;function $he(){if(zO)return $S;zO=1;var e=Ph();function t(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,r=e.useRef,s=e.useEffect,l=e.useMemo,c=e.useDebugValue;return $S.useSyncExternalStoreWithSelector=function(h,d,f,p,v){var x=r(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function N(P){if(!j){if(j=!0,T=P,P=p(P),v!==void 0&&b.hasValue){var A=b.value;if(v(A,P))return E=A}return E=P}if(A=E,n(T,P))return A;var M=p(P);return v!==void 0&&v(A,M)?(T=P,A):(T=P,E=M)}var j=!1,T,E,C=f===void 0?null:f;return[function(){return N(d())},C===null?void 0:function(){return N(C())}]},[d,f,p,v]);var S=i(h,x[0],x[1]);return s(function(){b.hasValue=!0,b.value=S},[S]),c(S),S},$S}var qO;function Vhe(){return qO||(qO=1,FS.exports=$he()),FS.exports}Vhe();function zhe(e){e()}function qhe(){let e=null,t=null;return{clear(){e=null,t=null},notify(){zhe(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let i=e;for(;i;)n.push(i),i=i.next;return n},subscribe(n){let i=!0;const r=t={callback:n,next:null,prev:t};return r.prev?r.prev.next=r:e=r,function(){!i||e===null||(i=!1,r.next?r.next.prev=r.prev:t=r.prev,r.prev?r.prev.next=r.next:e=r.next)}}}}var WO={notify(){},get:()=>[]};function Whe(e,t){let n,i=WO,r=0,s=!1;function l(S){f();const N=i.subscribe(S);let j=!1;return()=>{j||(j=!0,N(),p())}}function c(){i.notify()}function h(){b.onStateChange&&b.onStateChange()}function d(){return s}function f(){r++,n||(n=e.subscribe(h),i=qhe())}function p(){r--,n&&r===0&&(n(),n=void 0,i.clear(),i=WO)}function v(){s||(s=!0,f())}function x(){s&&(s=!1,p())}const b={addNestedSub:l,notifyNestedSubs:c,handleChangeWrapper:h,isSubscribed:d,trySubscribe:v,tryUnsubscribe:x,getListeners:()=>i};return b}var Hhe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Khe=Hhe(),Ghe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Yhe=Ghe(),Qhe=()=>Khe||Yhe?w.useLayoutEffect:w.useEffect,Xhe=Qhe();function HO(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Jhe(e,t){if(HO(e,t))return!0;
684if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!HO(e[n[r]],t[n[r]]))return!1;return!0}var VS=Symbol.for("react-redux-context"),zS=typeof globalThis<"u"?globalThis:{};function Zhe(){if(!w.createContext)return{};const e=zS[VS]??(zS[VS]=new Map);let t=e.get(w.createContext);return t||(t=w.createContext(null),e.set(w.createContext,t)),t}var efe=Zhe();function tfe(e){const{children:t,context:n,serverState:i,store:r}=e,s=w.useMemo(()=>{const h=Whe(r);return{store:r,subscription:h,getServerState:i?()=>i:void 0}},[r,i]),l=w.useMemo(()=>r.getState(),[r]);Xhe(()=>{const{subscription:h}=s;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),l!==r.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[s,l]);const c=n||efe;return w.createElement(c.Provider,{value:s},t)}var nfe=tfe,ife=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function rfe(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Qy(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var i of n)if(ife.has(i)){if(e[i]==null&&t[i]==null)continue;if(!Jhe(e[i],t[i]))return!1}else if(!rfe(e[i],t[i]))return!1;return!0}function rj(){return rj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},rj.apply(null,arguments)}function KO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Kf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KO(Object(n),!0).forEach(function(i){sfe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function sfe(e,t,n){return(t=afe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function afe(e){var t=ofe(e,"string");return typeof t=="symbol"?t:t+""}function ofe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lfe(e,t){return hfe(e)||dfe(e,t)||ufe(e,t)||cfe()}function cfe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
685In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ufe(e,t){if(e){if(typeof e=="string")return GO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GO(e,t):void 0}}function GO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function dfe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function hfe(e){if(Array.isArray(e))return e}function ffe(e){return Array.isArray(e)&&ao(e[0])&&ao(e[1])?e.join(" ~ "):e}var Ad={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function mfe(e,t){return t==null?e:_y(e,t)}var pfe=e=>{var t=e.separator,n=t===void 0?Ad.separator:t,i=e.contentStyle,r=e.itemStyle,s=e.labelStyle,l=s===void 0?Ad.labelStyle:s,c=e.payload,h=e.formatter,d=e.itemSorter,f=e.wrapperClassName,p=e.labelClassName,v=e.label,x=e.labelFormatter,b=e.accessibilityLayer,S=b===void 0?Ad.accessibilityLayer:b,N=()=>
685{if(c&&c.length){var R={padding:0,margin:0},B=mfe(c,d),U=B.map((O,F)=>{if(!O||O.type==="none")return null;var ne=O.formatter||h||ffe,re=O.value,Q=O.name,W=re,q=Q;if(ne){var $=ne(re,Q,O,F,c);if(Array.isArray($)){var ge=lfe($,2);W=ge[0],q=ge[1]}else if($!=null)W=$;else return null}var ue=Kf(Kf({},Ad.itemStyle),{},{color:O.color||Ad.itemStyle.color},r);return w.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:ue},ao(q)?w.createElement("span",{className:"recharts-tooltip-item-name"},q):null,ao(q)?w.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,w.createElement("span",{className:"recharts-tooltip-item-value"},W),w.createElement("span",{className:"recharts-tooltip-item-unit"},O.unit||""))});return w.createElement("ul",{className:"recharts-tooltip-item-list",style:R},U)}return null},j=Kf(Kf({},Ad.contentStyle),i),T=Kf({margin:0},l),E=!dr(v),C=E?v:"",P=Rn("recharts-default-tooltip",f),A=Rn("recharts-tooltip-label",p);E&&x&&c!==void 0&&c!==null&&(C=x(v,c));var M=S?{role:"status","aria-live":"assertive"}:{};return w.createElement("div",rj({className:P,style:j},M),w.createElement("p",{className:A,style:T},w.isValidElement(C)?C:"".concat(C)),N())},Gf="recharts-tooltip-wrapper",gfe={visibility:"hidden"};function vfe(e){var t=e.coordinate,n=e.translateX,i=e.translateY;return Rn(Gf,{["".concat(Gf,"-right")]:Xe(n)&&t&&Xe(t.x)&&n>=t.x,["".concat(Gf,"-left")]:Xe(n)&&t&&Xe(t.x)&&n<t.x,["".concat(Gf,"-bottom")]:Xe(i)&&t&&Xe(t.y)&&i>=t.y,["".concat(Gf,"-top")]:Xe(i)&&t&&Xe(t.y)&&i<t.y})}function YO(e){var t=e.allowEscapeViewBox,n=e.coordinate,i=e.key,r=e.offset,s=e.position,l=e.reverseDirection,c=e.tooltipDimension,h=e.viewBox,d=e.viewBoxDimension;if(s&&Xe(s[i]))return s[i];var f=n[i]-c-(r>0?r:0),p=n[i]+r;if(t[i])return l[i]?f:p;var v=h[i];if(v==null)return 0;if(l[i]){var x=f,b=v;return x<b?Math.max(p,v):Math.max(f,v)}if(d==null)return 0;var S=p+c,N=v+d;return S>N?Math.max(f,v):Math.max(p,v)}function xfe(e){var t=e.translateX,n=e.translateY,i=e.useTranslate3d;return{transform:i?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function yfe(e){var t=e.allowEscapeViewBox,n=e.coordinate,i=e.offsetTop,r=e.offsetLeft,s=e.position,l=e.reverseDirection,c=e.tooltipBox,h=e.useTranslate3d,d=e.viewBox,f,p,v;return c.height>0&&c.width>0&&n?(p=YO({allowEscapeViewBox:t,coordinate:n,key:"x",offset:r,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),v=YO({allowEscapeViewBox:t,coordinate:n,key:"y",offset:i,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),f=xfe({translateX:p,translateY:v,useTranslate3d:h})):f=gfe,{cssProperties:f,cssClasses:vfe({translateX:p,translateY:v,coordinate:n})}}var bfe=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Pp={isSsr:bfe()};function wfe(e,t){return jfe(e)||Nfe(e,t)||kfe(e,t)||Sfe()}function Sfe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
686In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kfe(e,t){if(e){if(typeof e=="string")return QO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?QO(e,t):void 0}}function QO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Nfe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function jfe(e){if(Array.isArray(e))return e}function X9(){var e=w.useState(()=>Pp.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),t=wfe(e,2),n=t[0],i=t[1];return w.useEffect(()=>{if(window.matchMedia){var r=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{i(r.matches)};
686return r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}}},[]),n}function XO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Pd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XO(Object(n),!0).forEach(function(i){Cfe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Cfe(e,t,n){return(t=Tfe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tfe(e){var t=Efe(e,"string");return typeof t=="symbol"?t:t+""}function Efe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Afe(e,t){return Rfe(e)||Mfe(e,t)||_fe(e,t)||Pfe()}function Pfe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
687In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _fe(e,t){if(e){if(typeof e=="string")return JO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JO(e,t):void 0}}function JO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Mfe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function Rfe(e){if(Array.isArray(e))return e}function Ofe(e){if(!(e.prefersReducedMotion&&e.isAnimationActive==="auto")&&e.isAnimationActive&&e.active){var t=typeof e.animationEasing=="string"?e.animationEasing:"ease";return"transform ".concat(e.animationDuration,"ms ").concat(t)}}function Ife(e){var t,n,i,r,s,l,c=X9(),h=w.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),d=Afe(h,2),f=d[0],p=d[1];w.useEffect(()=>{var j=T=>{if(T.key==="Escape"){var E,C,P,A;p({dismissed:!0,dismissedAtCoordinate:{x:(E=(C=e.coordinate)===null||C===void 0?void 0:C.x)!==null&&E!==void 0?E:0,y:(P=(A=e.coordinate)===null||A===void 0?void 0:A.y)!==null&&P!==void 0?P:0}})}};return document.addEventListener("keydown",j),()=>{document.removeEventListener("keydown",j)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),f.dismissed&&(((i=(r=e.coordinate)===null||r===void 0?void 0:r.x)!==null&&i!==void 0?i:0)!==f.dismissedAtCoordinate.x||((s=(l=e.coordinate)===null||l===void 0?void 0:l.y)!==null&&s!==void 0?s:0)!==f.dismissedAtCoordinate.y)&&p(Pd(Pd({},f),{},{dismissed:!1}));var v=yfe({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),x=v.cssClasses,b=v.cssProperties,S=e.hasPortalFromProps?{}:Pd(Pd({transition:Ofe({prefersReducedMotion:c,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},b),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),N=Pd(Pd({},S),{},{visibility:!f.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return w.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:N,ref:e.innerRef},e.children)}var Dfe=w.memo(Ife),J9=()=>{var e;return(e=st(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function sj(){return sj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},sj.apply(null,arguments)}function ZO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function eI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
687t%2?ZO(Object(n),!0).forEach(function(i){Lfe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZO(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Lfe(e,t,n){return(t=Ufe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ufe(e){var t=Bfe(e,"string");return typeof t=="symbol"?t:t+""}function Bfe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tI={curveBasisClosed:Fle,curveBasisOpen:$le,curveBasis:Ble,curveBumpX:Lle,curveBumpY:Ule,curveLinearClosed:Vle,curveLinear:Ay,curveMonotoneX:zle,curveMonotoneY:qle,curveNatural:Wle,curveStep:Hle,curveStepAfter:Gle,curveStepBefore:Kle},gx=e=>Mt(e.x)&&Mt(e.y),nI=e=>e.base!=null&&gx(e.base)&&gx(e),Yf=e=>e.x,Qf=e=>e.y,Ffe=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(ZC(e));if((n==="curveMonotone"||n==="curveBump")&&t){var i=tI["".concat(n).concat(t==="vertical"?"Y":"X")];if(i)return i}return tI[n]||Ay},iI={connectNulls:!1,type:"linear"},$fe=e=>{var t=e.type,n=t===void 0?iI.type:t,i=e.points,r=i===void 0?[]:i,s=e.baseLine,l=e.layout,c=e.connectNulls,h=c===void 0?iI.connectNulls:c,d=Ffe(n,l),f=h?r.filter(gx):r;if(Array.isArray(s)){var p,v=r.map((j,T)=>eI(eI({},j),{},{base:s[T]}));l==="vertical"?p=m0().y(Qf).x1(Yf).x0(j=>j.base.x):p=m0().x(Yf).y1(Qf).y0(j=>j.base.y);var x=p.defined(nI).curve(d),b=h?v.filter(nI):v;return x(b)}var S;l==="vertical"&&Xe(s)?S=m0().y(Qf).x1(Yf).x0(s):Xe(s)?S=m0().x(Yf).y1(Qf).y0(s):S=T8().x(Yf).y(Qf);var N=S.defined(gx).curve(d);return N(f)},uv=e=>{var t=e.className,n=e.points,i=e.path,r=e.pathRef,s=Ih();if((!n||!n.length)&&!i)return null;var l={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},c=n&&n.length?$fe(l):i;return w.createElement("path",sj({},Ca(e),eT(e),{className:Rn("recharts-curve",t),d:c===null?void 0:c,ref:r}))},Vfe=["x","y","top","left","width","height","className"];function aj(){return aj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},aj.apply(null,arguments)}function rI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function zfe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rI(Object(n),!0).forEach(function(i){qfe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rI(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function qfe(e,t,n){return(t=Wfe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wfe(e){var t=Hfe(e,"string");return typeof t=="symbol"?t:t+""}function Hfe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kfe(e,t){if(e==null)return{};var n,i,r=Gfe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gfe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var Yfe=(e,t,n,i,r,s)=>"M".concat(e,",").concat(r,"v").concat(i,"M").concat(s,",").concat(t,"h").concat(n),Qfe=e=>{var t=e.x,n=t===void 0?0:t,i=e.y,r=i===void 0?0:i,s=e.top,l=s===void 0?0:s,c=e.left,h=c===void 0?0:c,d=e.width,f=d===void 0?0:d,p=e.height,v=p===void 0?0:p,x=e.className,b=Kfe(e,Vfe),S=zfe({x:n,y:r,to
687p:l,left:h,width:f,height:v},b);return!Xe(n)||!Xe(r)||!Xe(f)||!Xe(v)||!Xe(l)||!Xe(h)?null:w.createElement("path",aj({},Ws(S),{className:Rn("recharts-cross",x),d:Yfe(n,r,f,v,l,h)}))};function Xfe(e,t,n,i){var r=i/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-r:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-r,width:e==="horizontal"?i:n.width-1,height:e==="horizontal"?n.height-1:i}}var vx=1e-4,Z9=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],eF=(e,t)=>e.map((n,i)=>n*t**i).reduce((n,i)=>n+i),sI=(e,t)=>n=>{var i=Z9(e,t);return eF(i,n)},Jfe=(e,t)=>n=>{var i=Z9(e,t),r=[...i.map((s,l)=>s*l).slice(1),0];return eF(r,n)},Zfe=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var i=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(i==null||i.length!==4)return null;var r=i.map(s=>parseFloat(s));return[r[0],r[1],r[2],r[3]]},eme=function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var r=Zfe(n[0]);if(r)return r}}return n.length===4?n:[0,0,1,1]},tme=(e,t,n,i)=>{var r=sI(e,n),s=sI(t,i),l=Jfe(e,n),c=d=>d>1?1:d<0?0:d,h=d=>{for(var f=d>1?1:d,p=f,v=0;v<8;++v){var x=r(p)-f,b=l(p);if(Math.abs(x-f)<vx||b<vx)return s(p);p=c(p-x/b)}return s(p)};return h.isStepper=!1,h},aI=function(){return tme(...eme(...arguments))},nme=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,i=n===void 0?100:n,r=t.damping,s=r===void 0?8:r,l=t.dt,c=l===void 0?16.67:l,h=1,d=[0],f=0,p=0,v=1e4,x=0;x<v;){var b=-(f-h)*i,S=p*s;if(p+=(b-S)*c/1e3,f+=p*c/1e3,d.push(f),Math.abs(f-h)<vx&&Math.abs(p)<vx)break;x++}d[d.length-1]=h;var N=d.length-1;return j=>{var T,E,C;if(j<=0)return 0;if(j>=1)return h;var P=j*N,A=Math.floor(P),M=P-A;return((T=d[A])!==null&&T!==void 0?T:0)+(((E=d[A+1])!==null&&E!==void 0?E:0)-((C=d[A])!==null&&C!==void 0?C:0))*M}},ime=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return aI(e);case"spring":return nme();default:if(e.split("(")[0]==="cubic-bezier")return aI(e)}return typeof e=="function"?e:null},rme=(e,t,n)=>{var i,r=s=>{var l=t.tick(s);if(t.getState()==="active"){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),i=void 0;return}i=e.setTimeout(r,l);return}i=e.setTimeout(r,l)};return i=e.setTimeout(r,0),()=>{var s;return(s=i)===null||s===void 0?void 0:s()}},tF=w.createContext(rme);tF.Provider;function sme(e){var t=w.useContext(tF);return w.useMemo(()=>e??t,[e,t])}function ame(e,t,n){return(t=ome(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ome(e){var t=lme(e,"string");return typeof t=="symbol"?t:t+""}function lme(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var oI="init",lI="pending",cI="active",cme="completed";function qS(e){return Math.max(0,e)}class ume{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(t){var n;ame(this,"state",oI),this.animationId=t.animationId,this.onAnimationEnd=t.onAnimationEnd,this.animationDuration=qS(t.animationDuration),this.animationBegin=qS(t.animationBegin),this.progress=0,this.from=t.from,this.to=t.to,this.easing=t.easing,(n=t.onAnimationStart)===null||n===void 0||n.call(t)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(t){if(this.getState()===oI)return this.state=lI,this.beginStartedTime=t,this.animationBegin;if(this.getState()===lI){if(this.beginStartedTime==null)throw new Error;var n=t-this.beginStartedTime;return n>=this.animationBegin?(this.state=cI,this.animationStartedTime=t,this.nextAnimationUpdate(0)):qS(this.animationBegin-n)}if(this.getState()===cI){if(this.animationStartedTime==null)throw new Error;var i=t-this.animationStartedTime;return this.setProgress(i/this.animationDuration),this.nextAnimationUpdate(i)}return 0}setProgress(t){this.progress=Math.min(1,Math.max(0,t))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var t;(t=this.onAnimationEnd)===null||t===void 0||t.call(this)}this.state=cme}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class dme extends ume{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Ho(this.getFrom(),this.getTo(),this.getProgress()))}}class hme{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=performance.now(),r=null,s=l=>{l-i>=n?t(l):r=requestAnimationFrame(s)};return r=requestAnimationFrame(s),()=>{r!=null&&cancelAnimationFrame(r)}}}function fme(e,t){return vme(e)||gme(e,t)||pme(e,t)||mme()}
687function mme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
688In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pme(e,t){if(e){if(typeof e=="string")return uI(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uI(e,t):void 0}}function uI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function gme(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function vme(e){if(Array.isArray(e))return e}var xme={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},dI=0,WS=1;function nF(e){var t=Ys(e,xme),n=t.animationId,i=t.isActive,r=t.canBegin,s=t.duration,l=t.easing,c=t.begin,h=t.onAnimationEnd,d=t.onAnimationStart,f=t.children,p=X9(),v=i==="auto"?!Pp.isSsr&&!p:i,x=sme(t.animationController),b=w.useState(v?dI:WS),S=fme(b,2),N=S[0],j=S[1];return w.useEffect(()=>{v||j(WS)},[v]),w.useEffect(()=>{var T=ime(l);if(!v||!r||T==null)return Oh;var E=new hme,C=new dme({animationId:n,easing:T,animationDuration:s,animationBegin:c,onAnimationStart:d,onAnimationEnd:h,from:dI,to:WS});return x(E,C,j)},[x,n,v,r,s,l,c,d,h]),f(Number(N))}function iF(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=w.useRef(ep(t)),i=w.useRef(e);return i.current!==e&&(n.current=ep(t),i.current=e),n.current}var yme=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),bme=(e,t,n)=>e.map(i=>"".concat(yme(i)," ").concat(t,"ms ").concat(n)).join(","),wme=["radiu
688s"],Sme=["radius"],hI,fI,mI,pI,gI,vI,xI,yI,bI,wI;function SI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function kI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SI(Object(n),!0).forEach(function(i){kme(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SI(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function kme(e,t,n){return(t=Nme(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nme(e){var t=jme(e,"string");return typeof t=="symbol"?t:t+""}function jme(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xx(){return xx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},xx.apply(null,arguments)}function NI(e,t){if(e==null)return{};var n,i,r=Cme(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cme(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function Tme(e,t){return _me(e)||Pme(e,t)||Ame(e,t)||Eme()}function Eme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
689In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ame(e,t){if(e){if(typeof e=="string")return jI(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jI(e,t):void 0}}function jI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Pme(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function _me(e){if(Array.isArray(e))return e}function La(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var CI=(e,t,n,i,r)=>{var s=ic(n),l=ic(i),c=Math.min(Math.abs(s)/2,Math.abs(l)/2),h=l>=0?1:-1,d=s>=0?1:-1,f=l>=0&&s>=0||l<0&&s<0?1:0,p;if(c>0&&Array.isArray(r)){for(var v=[0,0,0,0],x=0,b=4;x<b;x++){var S,N=(S=r[x])!==null&&S!==void 0?S:0;v[x]=N>c?c:N}p=rr(hI||(hI=La(["M",",",""])),e,t+h*v[0]),v[0]>0&&(p+=rr(fI||(fI=La(["A ",",",",0,0,",",",",",""])),v[0],v[0],f,e+d*v[0],t)),p+=rr(mI||(mI=La(["L ",",",""])),e+n-d*v[1],t),v[1]>0&&(p+=rr(pI||(pI=La(["A ",",",",0,0,",`,
690        `,",",""])),v[1],v[1],f,e+n,t+h*v[1])),p+=rr(gI||(gI=La(["L ",",",""])),e+n,t+i-h*v[2]),v[2]>0&&(p+=rr(vI||(vI=La(["A ",",",",0,0,",`,
691        `,",",""])),v[2],v[2],f,e+n-d*v[2],t+i)),p+=rr(xI||(xI=La(["L ",",",""])),e+d*v[3],t+i),v[3]>0&&(p+=rr(yI||(yI=La(["A ",",",",0,0,",`,
692        `,",",""])),v[3],v[3],f,e,t+i-h*v[3])),p+="Z"}else if(c>0&&r===+r&&r>0){var j=Math.min(c,r);p=rr(bI||(bI=La(["M ",",",`
693            A `,",",",0,0,",",",",",`
694            L `,",",`
695            A `,",",",0,0,",",",",",`
696            L `,",",`
697            A `,",",",0,0,",",",",",`
698            L `,",",`
699            A `,",",",0,0,",",",","," Z"])),e,t+h*j,j,j,f,e+d*j,t,e+n-d*j,t,j,j,f,e+n,t+h*j,e+n,t+i-h*j,j,j,f,e+n-d*j,t+i,e+d*j,t+i,j,j,f,e,t+i-h*j)}else p=rr(wI||(wI=La(["M ",","," h "," v "," h "," Z"])),e,t,n,i,-n);return p},TI={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Mme=e=>{var t=Ys(e,TI),n=w.useRef(null),i=w.useState(-1),r=Tme(i,2),s=r[0],l=r[1];w.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var $=n.current.getTotalLength();$&&l($)}catch{}},[]);var c=t.x,h=t.y,d=t.width,f=t.height,p=t.radius,v=t.className,x=t.animationEasing,b=t.animationDuration,S=t.animationBegin,N=t.isAnimationActive,j=t.isUpdateAnimationActive,T=w.useRef(d),E=w.useRef(f),C=w.useRef(c),P=w.useRef(h),A=w.useMemo(()=>({x:c,y:h,width:d,height:f,radius:p}),[c,h,d,f,p]),M=iF(A,"rectangle-");if(c!==+c||h!==+h||d!==+d||f!==+f||d===0||f===0)return null;var R=Rn("recharts-rectangle",v);if(!j){var B=Ws(t);B.radius;var U=NI(B,wme);return w.createElement("path",xx({},U,{x:ic(c),y:ic(h),width:ic(d),height:ic(f),radius:typeof p=="number"?p:void 0,className:R,d:CI(c,h,d,f,p)}))}var O=T.current,F=E.current,ne=C.current,re=P.current,Q="0px ".concat(s===-1?1:s,"px"),W="".concat(s,"px ").concat(s,"px"),q=bme(["strokeDasharray"],b,typeof x=="str
699ing"?x:TI.animationEasing);return w.createElement(nF,{animationId:M,key:M,canBegin:s>0,duration:b,easing:x,isActive:j,begin:S},$=>{var ge=Ho(O,d,$),ue=Ho(F,f,$),L=Ho(ne,c,$),J=Ho(re,h,$);n.current&&(T.current=ge,E.current=ue,C.current=L,P.current=J);var ye;N?$>0?ye={transition:q,strokeDasharray:W}:ye={strokeDasharray:Q}:ye={strokeDasharray:W};var Pe=Ws(t);Pe.radius;var Oe=NI(Pe,Sme);return w.createElement("path",xx({},Oe,{radius:typeof p=="number"?p:void 0,className:R,d:CI(L,J,ge,ue,p),ref:n,style:kI(kI({},ye),t.style)}))})};function EI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function AI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EI(Object(n),!0).forEach(function(i){Rme(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EI(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Rme(e,t,n){return(t=Ome(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ome(e){var t=Ime(e,"string");return typeof t=="symbol"?t:t+""}function Ime(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var yx=Math.PI/180,Dme=e=>e*180/Math.PI,lr=(e,t,n,i)=>({x:e+Math.cos(-yx*i)*n,y:t+Math.sin(-yx*i)*n}),Lme=function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(i.left||0)-(i.right||0)),Math.abs(n-(i.top||0)-(i.bottom||0)))/2},Ume=(e,t)=>{var n=e.x,i=e.y,r=t.x,s=t.y;return Math.sqrt((n-r)**2+(i-s)**2)},Bme=(e,t)=>{var n=e.x,i=e.y,r=t.cx,s=t.cy,l=Ume({x:n,y:i},{x:r,y:s});if(l<=0)return{radius:l,angle:0};var c=(n-r)/l,h=Math.acos(c);return i>s&&(h=2*Math.PI-h),{radius:l,angle:Dme(h),angleInRadian:h}},Fme=e=>{var t=e.startAngle,n=e.endAngle,i=Math.floor(t/360),r=Math.floor(n/360),s=Math.min(i,r);return{startAngle:t-s*360,endAngle:n-s*360}},$me=(e,t)=>{var n=t.startAngle,i=t.endAngle,r=Math.floor(n/360),s=Math.floor(i/360),l=Math.min(r,s);return e+l*360},Vme=(e,t)=>{var n=e.relativeX,i=e.relativeY,r=Bme({x:n,y:i},t),s=r.radius,l=r.angle,c=t.innerRadius,h=t.outerRadius;if(s<c||s>h||s===0)return null;var d=Fme(t),f=d.startAngle,p=d.endAngle,v=l,x;if(f<=p){for(;v>p;)v-=360;for(;v<f;)v+=360;x=v>=f&&v<=p}else{for(;v>f;)v-=360;for(;v<p;)v+=360;x=v>=p&&v<=f}return x?AI(AI({},t),{},{radius:s,angle:$me(v,t)}):null};function rF(e){var t=e.cx,n=e.cy,i=e.radius,r=e.startAngle,s=e.endAngle,l=lr(t,n,i,r),c=lr(t,n,i,s);return{points:[l,c],cx:t,cy:n,radius:i,startAngle:r,endAngle:s}}var PI,_I,MI,RI,OI,II,DI;function oj(){return oj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},oj.apply(null,arguments)}function cu(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zme=(e,t)=>{var n=Fs(t-e),i=Math.min(Math.abs(t-e),359.999);return n*i},S0=e=>{var t=e.cx,n=e.cy,i=e.radius,r=e.angle,s=e.sign,l=e.isExternal,c=e.cornerRadius,h=e.cornerIsExternal,d=c*(l?1:-1)+i,f=Math.asin(c/d)/yx,p=h?r:r+s*f,v=lr(t,n,d,p),x=lr(t,n,i,p),b=h?r-s*f:r,S=lr(t,n,d*Math.cos(f*yx),b);return{center:v,circleTangency:x,lineTangency:S,theta:f}},sF=e=>{var t=e.cx,n=e.cy,i=e.innerRadius,r=e.outerRadius,s=e.startAngle,l=e.endAngle,c=zme(s,l),h=s+c,d=lr(t,n,r,s),f=lr(t,n,r,h),p=rr(PI||(PI=cu(["M ",",",`
700    A `,",",`,0,
701    `,",",`,
702    `,",",`
703  `])),d.x,d.y,r,r,+(Math.abs(c)>180),+(s>h),f.x,f.y);if(i>0){var v=lr(t,n,i,s),x=lr(t,n,i,h);p+=rr(_I||(_I=cu(["L ",",",`
704            A `,",",`,0,
705            `,",",`,
706            `,","," Z"])),x.x,x.y,i,i,+(Math.abs(c)>180),+(s<=h),v.x,v.y)}else p+=rr(MI||(MI=cu(["L ",","," Z"])),t,n);return p},qme=e=>{var t=e.cx,n=e.cy,i=e.innerRadius,r=e.outerRadius,s=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,h=e.startAngle,d=e.endAngle,f
706=Fs(d-h),p=S0({cx:t,cy:n,radius:r,angle:h,sign:f,cornerRadius:s,cornerIsExternal:c}),v=p.circleTangency,x=p.lineTangency,b=p.theta,S=S0({cx:t,cy:n,radius:r,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),N=S.circleTangency,j=S.lineTangency,T=S.theta,E=c?Math.abs(h-d):Math.abs(h-d)-b-T;if(E<0)return l?rr(RI||(RI=cu(["M ",",",`
707        a`,",",",0,0,1,",`,0
708        a`,",",",0,0,1,",`,0
709      `])),x.x,x.y,s,s,s*2,s,s,-s*2):sF({cx:t,cy:n,innerRadius:i,outerRadius:r,startAngle:h,endAngle:d});var C=rr(OI||(OI=cu(["M ",",",`
710    A`,",",",0,0,",",",",",`
711    A`,",",",0,",",",",",",",`
712    A`,",",",0,0,",",",",",`
713  `])),x.x,x.y,s,s,+(f<0),v.x,v.y,r,r,+(E>180),+(f<0),N.x,N.y,s,s,+(f<0),j.x,j.y);if(i>0){var P=S0({cx:t,cy:n,radius:i,angle:h,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),A=P.circleTangency,M=P.lineTangency,R=P.theta,B=S0({cx:t,cy:n,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),U=B.circleTangency,O=B.lineTangency,F=B.theta,ne=c?Math.abs(h-d):Math.abs(h-d)-R-F;if(ne<0&&s===0)return"".concat(C,"L").concat(t,",").concat(n,"Z");C+=rr(II||(II=cu(["L",",",`
714      A`,",",",0,0,",",",",",`
715      A`,",",",0,",",",",",",",`
716      A`,",",",0,0,",",",",","Z"])),O.x,O.y,s,s,+(f<0),U.x,U.y,i,i,+(ne>180),+(f>0),A.x,A.y,s,s,+(f<0),M.x,M.y)}else C+=rr(DI||(DI=cu(["L",",","Z"])),t,n);return C},Wme={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Hme=e=>{var t=Ys(e,Wme),n=t.cx,i=t.cy,r=t.innerRadius,s=t.outerRadius,l=t.cornerRadius,c=t.forceCornerRadius,h=t.cornerIsExternal,d=t.startAngle,f=t.endAngle,p=t.className;if(s<r||d===f)return null;var v=Rn("recharts-sector",p),x=s-r,b=pc(l,x,0,!0),S;return b>0&&Math.abs(d-f)<360?S=qme({cx:n,cy:i,innerRadius:r,outerRadius:s,cornerRadius:Math.min(b,x/2),forceCornerRadius:c,cornerIsExternal:h,startAngle:d,endAngle:f}):S=sF({cx:n,cy:i,innerRadius:r,outerRadius:s,startAngle:d,endAngle:f}),w.createElement("path",oj({},Ws(t),{className:v,d:S}))};function Kme(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(F8(t)){if(e==="centric"){var i=t.cx,r=t.cy,s=t.innerRadius,l=t.outerRadius,c=t.angle,h=lr(i,r,s,c),d=lr(i,r,l,c);return[{x:h.x,y:h.y},{x:d.x,y:d.y}]}return rF(t)}}function Gme(e){return e9(e)?NaN:Number(e)}function HS(e){return e?(e=Gme(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function aF(e,t,n){n&&typeof n!="number"&&$N(e,t,n)&&(t=n=void 0),e=HS(e),t===void 0?(t=e,e=0):t=HS(t),n=n===void 0?e<t?1:-1:HS(n);const i=Math.max(Math.ceil((t-e)/(n||1)),0),r=new Array(i);for(let s=0;s<i;s++)r[s]=e,e+=n;return r}var Ea=e=>e.chartData,pT=pe([Ea],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Xy=(e,t,n,i)=>i?pT(e):Ea(e),Yme=(e,t,n)=>n?pT(e):Ea(e),Qme=pe([Xy],e=>{var t=e.chartData,n=e.dataStartIndex,i=e.dataEndIndex;return t!=null?t.slice(n,i+1):[]});pe([pT],e=>{var t=e.chartData,n=e.dataStartIndex,i=e.dataEndIndex;return t!=null?t.slice(n,i+1):[]});var Xme=pe([Ea],e=>{var t=e.chartData,n=e.dataStartIndex,i=e.dataEndIndex;return t!=null?t.slice(n,i+1):[]});function gT(e,t){return tpe(e)||epe(e,t)||Zme(e,t)||Jme()}function Jme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
717In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zme(e,t){if(e){if(typeof e=="string")return LI(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?LI(e,t):void 0}}function LI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function epe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}
vendor: 15,463 bytes, lines 717-718
717finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function tpe(e){if(Array.isArray(e))return e}function to(e){if(Array.isArray(e)&&e.length===2){var t=gT(e,2),n=t[0],i=t[1];if(Mt(n)&&Mt(i))return!0}return!1}function UI(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function oF(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var n=gT(e,2),i=n[0],r=n[1],s,l;if(Mt(i))s=i;else if(typeof i=="function")return;if(Mt(r))l=r;else if(typeof r=="function")return;var c=[s,l];if(to(c))return c}}function npe(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var i=e(t,n);if(to(i))return UI(i,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var r=gT(e,2),s=r[0],l=r[1],c,h;if(s==="auto")t!=null&&(c=Math.min(...t));else if(Xe(s))c=s;else if(typeof s=="function")try{t!=null&&(c=s(t==null?void 0:t[0]))}catch{}else if(typeof s=="string"&&PO.test(s)){var d=PO.exec(s);if(d==null||d[1]==null||t==null)c=void 0;else{var f=+d[1];c=t[0]-f}}else c=t==null?void 0:t[0];if(l==="auto")t!=null&&(h=Math.max(...t));else if(Xe(l))h=l;else if(typeof l=="function")try{t!=null&&(h=l(t==null?void 0:t[1]))}catch{}else if(typeof l=="string"&&_O.test(l)){var p=_O.exec(l);if(p==null||p[1]==null||t==null)h=void 0;else{var v=+p[1];h=t[1]+v}}else h=t==null?void 0:t[1];var x=[c,h];if(to(x))return t==null?x:UI(x,t,n)}}}var Dh=1e9,ipe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},xT,Bn=!0,Ks="[DecimalError] ",ku=Ks+"Invalid argument: ",vT=Ks+"Exponent out of range: ",Lh=Math.floor,Xc=Math.pow,rpe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ms,Ii=1e7,Mn=7,lF=9007199254740991,bx=Lh(lF/Mn),Ge={};Ge.absoluteValue=Ge.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Ge.comparedTo=Ge.cmp=function(e){var t,n,i,r,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(i=s.d.length,r=e.d.length,t=0,n=i<r?i:r;t<n;++t)if(s.d[t]!==e.d[t])return s.d[t]>e.d[t]^s.s<0?1:-1;return i===r?0:i>r^s.s<0?1:-1};Ge.decimalPlaces=Ge.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Mn;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ge.dividedBy=Ge.div=function(e){return Qo(this,new this.constructor(e))};Ge.dividedToIntegerBy=Ge.idiv=function(e){var t=this,n=t.constructor;return wn(Qo(t,new n(e),0,1),n.precision)};Ge.equals=Ge.eq=function(e){return!this.cmp(e)};Ge.exponent=function(){return bi(this)};Ge.greaterThan=Ge.gt=function(e){return this.cmp(e)>0};Ge.greaterThanOrEqualTo=Ge.gte=function(e){return this.cmp(e)>=0};Ge.isInteger=Ge.isint=function(){return this.e>this.d.length-2};Ge.isNegative=Ge.isneg=function(){return this.s<0};Ge.isPositive=Ge.ispos=function(){return this.s>0};Ge.isZero=function(){return this.s===0};Ge.lessThan=Ge.lt=function(e){return this.cmp(e)<0};Ge.lessThanOrEqualTo=Ge.lte=function(e){return this.cmp(e)<1};Ge.logarithm=Ge.log=function(e){var t,n=this,i=n.constructor,r=i.precision,s=r+5;if(e===void 0)e=new i(10);else if(e=new i(e),e.s<1||e.eq(ms))throw Error(Ks+"NaN");if(n.s<1)throw Error(Ks+(n.s?"NaN":"-Infinity"));return n.eq(ms)?new i(0):(Bn=!1,t=Qo(op(n,s),op(e,s),s),Bn=!0,wn(t,r))};Ge.minus=Ge.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?dF(t,e):cF(t,(e.s=-e.s,e))};Ge.modulo=Ge.mod=function(e){var t,n=this,i=n.constructor,r=i.precision;if(e=new i(e),!e.s)throw Error(Ks+"NaN");return n.s?(Bn=!1,t=Qo(n,e,0,1).times(e),Bn=!0,n.minus(t)):wn(new i(n),r)};Ge.naturalExponential=Ge.exp=function(){return uF(this)};Ge.naturalLogarithm=Ge.ln=function(){return op(this)};Ge.negated=Ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ge.plus=Ge.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?cF(t,e):dF(t,(e.s=-e.s,e))};Ge.precision=Ge.sd=function(e){var t,n,i,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ku+e);if(t=bi(r)+1,i=r.d.length-1,n=i*Mn+1,i=r.d[i],i){for(;i%10==0;i/=10)n--;for(i=r.d[0];i>=10;i/=10)n++}return e&&t>n?t:n};Ge.squareRoot=Ge.sqrt=function(){var e,t,n,i,r,s,l,c=this,h=c.constructor;if(c.s<1){if(!c.s)return new h(0);throw Error(Ks+"NaN")}for(e=bi(c),Bn=!1,r=Math.sqrt(+c),r==0||r==1/0?(t=Ja(c.d),(t.length+e)%2==0&&(t+="0"),r=Math.sqrt(t),e=Lh((e+1)/2)-(e<0||e%2),r==1/0?t="5e"+e:(t=r.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),i=new h(t)):i=new h(r.toString()),n=h.precision,r=l=n+3;;)if(s=i,i=s.plus(Qo(c,s,l+2)).times(.5),Ja(s.d).slice(0,l)===(t=Ja(i.d)).slice(0,l)){if(t=t.slice(l-3,l+1),r==l&&t=="4999"){if(wn(s,n+1,0),s.times(s).eq(c)){i=s;break}}else if(t!="9999")break;l+=4}return Bn=!0,wn(i,n)};Ge.times=Ge.mul=function(e){var t,n,i,r,s,l,c,h,d,f=this,p=f.constructor,v=f.d,x=(e=new p(e)).d;if(!f.s||!e.s)return new p(0);for(e.s*=f.s,n=f.e+e.e,h=v.length,d=x.length,h<d&&(s=v,v=x,x=s,l=h,h=d,d=l),s=[],l=h+d,i=l;i--;)s.push(0);for(i=d;--i>=0;){for(t=0,r=h+i;r>i;)c=s[r]+x[i]*v[r-i-1]+t,s[r--]=c%Ii|0,t=c/Ii|0;s[r]=(s[r]+t)%Ii|0}for(;!s[--l];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,Bn?wn(e,p.precision):e};Ge.toDecimalPlaces=Ge.todp=function(e,t){var n=this,i=n.constructor;return n=new i(n),e===void 0?n:(lo(e,0,Dh),t===void 0?t=i.rounding:lo(t,0,8),wn(n,e+bi(n)+1,t))};Ge.toExponential=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=Iu(i,!0):(lo(e,0,Dh),t===void 0?t=r.rounding:lo(t,0,8),i=wn(new r(i),e+1,t),n=Iu(i,!0,e+1)),n};Ge.toFixed=function(e,t){var n,i,r=this,s=r.constructor;return e===void 0?Iu(r):(lo(e,0,Dh),t===void 0?t=s.rounding:lo(t,0,8),i=wn(new s(r),e+bi(r)+1,t),n=Iu(i.abs(),!1,e+bi(i)+1),r.isneg()&&!r.isZero()?"-"+n:n)};Ge.toInteger=Ge.toint=function(){var e=this,t=e.constructor;return wn(new t(e),bi(e)+1,t.rounding)};Ge.toNumber=function(){return+this};Ge.toPower=Ge.pow=function(e){var t,n,i,r,s,l,c=this,h=c.constructor,d=12,f=+(e=new h(e));if(!e.s)return new h(ms);if(c=new h(c),!c.s){if(e.s<1)throw Error(Ks+"Infinity");return c}if(c.eq(ms))return c;if(i=h.precision,e.eq(ms))return wn(c,i);if(t=e.e,n=e.d.length-1,l=t>=n,s=c.s,l){if((n=f<0?-f:f)<=lF){for(r=new h(ms),t=Math.ceil(i/Mn+4),Bn=!1;n%2&&(r=r.times(c),FI(r.d,t)),n=Lh(n/2),n!==0;)c=c.times(c),FI(c.d,t);return Bn=!0,e.s<0?new h(ms).div(r):wn(r,i)}}else if(s<0)throw Error(Ks+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,c.s=1,Bn=!1,r=e.times(op(c,i+d)),Bn=!0,r=uF(r),r.s=s,r};Ge.toPrecision=function(e,t){var n,i,r=this,s=r.constructor;return e===void 0?(n=bi(r),i=Iu(r,n<=s.toExpNeg||n>=s.toExpPos)):(lo(e,1,Dh),t===void 0?t=s.rounding:lo(t,0,8),r=wn(new s(r),e,t),n=bi(r),i=Iu(r,e<=n||n<=s.toExpNeg,e)),i};Ge.toSignificantDigits=Ge.tosd=function(e,t){var n=this,i=n.constructor;return e===void 0?(e=i.precision,t=i.rounding):(lo(e,1,Dh),t===void 0?t=i.rounding:lo(t,0,8)),wn(new i(n),e,t)};Ge.toString=Ge.valueOf=Ge.val=Ge.toJSON=Ge[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=bi(e),n=e.constructor;return Iu(e,t<=n.toExpNeg||t>=n.toExpPos)};function cF(e,t){var n,i,r,s,l,c,h,d,f=e.constructor,p=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),Bn?wn(t,p):t;if(h=e.d,d=t.d,l=e.e,r=t.e,h=h.slice(),s=l-r,s){for(s<0?(i=h,s=-s,c=d.length):(i=d,r=l,c=h.length),l=Math.ceil(p/Mn),c=l>c?l+1:c+1,s>c&&(s=c,i.length=1),i.reverse();s--;)i.push(0);i.reverse()}for(c=h.length,s=d.length,c-s<0&&(s=c,i=d,d=h,h=i),n=0;s;)n=(h[--s]=h[s]+d[s]+n)/Ii|0,h[s]%=Ii;for(n&&(h.unshift(n),++r),c=h.length;h[--c]==0;)h.pop();return t.d=h,t.e=r,Bn?wn(t,p):t}function lo(e,t,n){if(e!==~~e||e<t||e>n)throw Error(ku+e)}function Ja(e){var t,n,i,r=e.length-1,s="",l=e[0];if(r>0){for(s+=l,t=1;t<r;t++)i=e[t]+"",n=Mn-i.length,n&&(s+=Wl(n)),s+=i;l=e[t],i=l+"",n=Mn-i.length,n&&(s+=Wl(n))}else if(l===0)return"0";for(;l%10===0;)l/=10;return s+l}var Qo=(function(){function e(i,r){var s,l=0,c=i.length;for(i=i.slice();c--;)s=i[c]*r+l,i[c]=s%Ii|0,l=s/Ii|0;return l&&i.unshift(l),i}function t(i,r,s,l){var c,h;if(s!=l)h=s>l?1:-1;else for(c=h=0;c<s;c++)if(i[c]!=r[c]){h=i[c]>r[c]?1:-1;break}return h}function n(i,r,s){for(var l=0;s--;)i[s]-=l,l=i[s]<r[s]?1:0,i[s]=l*Ii+i[s]-r[s];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,s,l){var c,h,d,f,p,v,x,b,S,N,j,T,E,C,P,A,M,R,B=i.constructor,U=i.s==r.s?1:-1,O=i.d,F=r.d;if(!i.s)return new B(i);if(!r.s)throw Error(Ks+"Division by zero");for(h=i.e-r.e,M=F.length,P=O.length,x=new B(U),b=x.d=[],d=0;F[d]==(O[d]||0);)++d;if(F[d]>(O[d]||0)&&--h,s==null?T=s=B.precision:l?T=s+(bi(i)-bi(r))+1:T=s,T<0)return new B(0);if(T=T/Mn+2|0,d=0,M==1)for(f=0,F=F[0],T++;(d<P||f)&&T--;d++)E=f*Ii+(O[d]||0),b[d]=E/F|0,f=E%F|0;else{for(f=Ii/(F[0]+1)|0,f>1&&(F=e(F,f),O=e(O,f),M=F.length,P=O.length),C=M,S=O.slice(0,M),N=S.length;N<M;)S[N++]=0;R=F.slice(),R.unshift(0),A=F[0],F[1]>=Ii/2&&++A;do f=0,c=t(F,S,M,N),c<0?(j=S[0],M!=N&&(j=j*Ii+(S[1]||0)),f=j/A|0,f>1?(f>=Ii&&(f=Ii-1),p=e(F,f),v=p.length,N=S.length,c=t(p,S,v,N),c==1&&(f--,n(p,M<v?R:F,v))):(f==0&&(c=f=1),p=F.slice()),v=p.length,v<N&&p.unshift(0),n(S,p,N),c==-1&&(N=S.length,c=t(F,S,M,N),c<1&&(f++,n(S,M<N?R:F,N))),N=S.length):c===0&&(f++,S=[0]),b[d++]=f,c&&S[0]?S[N++]=O[C]||0:(S=[O[C]],N=1);while((C++<P||S[0]!==void 0)&&T--)}return b[0]||b.shift(),x.e=h,wn(x,l?s+bi(x)+1:s)}})();function uF(e,t){var n,i,r,s,l,c,h=0,d=0,f=e.constructor,p=f.precision;if(bi(e)>16)throw Error(vT+bi(e));if(!e.s)return new f(ms);for(Bn=!1,c=p,l=new f(.03125);e.abs().gte(.1);)e=e.times(l),d+=5;for(i=Math.log(Xc(2,d))/Math.LN10*2+5|0,c+=i,n=r=s=new f(ms),f.precision=c;;){if(r=wn(r.times(e),c),n=n.times(++h),l=s.plus(Qo(r,n,c)),Ja(l.d).slice(0,c)===Ja(s.d).slice(0,c)){for(;d--;)s=wn(s.times(s),c);return f.precision=p,t==null?(Bn=!0,wn(s,p)):s}s=l}}function bi(e){for(var t=e.e*Mn,n=e.d[0];n>=10;n/=10)t++;return t}function KS(e,t,n){if(t>e.LN10.sd())throw Bn=!0,n&&(e.precision=n),Error(Ks+"LN10 precision limit exceeded");return wn(new e(e.LN10),t)}function Wl(e){for(var t="";e--;)t+="0";return t}function op(e,t){var n,i,r,s,l,c,h,d,f,p=1,v=10,x=e,b=x.d,S=x.constructor,N=S.precision;if(x.s<1)throw Error(Ks+(x.s?"NaN":"-Infinity"));if(x.eq(ms))return new S(0);if(t==null?(Bn=!1,d=N):d=t,x.eq(10))return t==null&&(Bn=!0),KS(S,d);if(d+=v,S.precision=d,n=Ja(b),i=n.charAt(0),s=bi(x),Math.abs(s)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)x=x.times(e),n=Ja(x.d),i=n.charAt(0),p++;s=bi(x),i>1?(x=new S("0."+n),s++):x=new S(i+"."+n.slice(1))}else return h=KS(S,d+2,N).times(s+""),x=op(new S(i+"."+n.slice(1)),d-v).plus(h),S.precision=N,t==null?(Bn=!0,wn(x,N)):x;for(c=l=x=Qo(x.minus(ms),x.plus(ms),d),f=wn(x.times(x),d),r=3;;){if(l=wn(l.times(f),d),h=c.plus(Qo(l,new S(r),d)),Ja(h.d).slice(0,d)===Ja(c.d).slice(0,d))return c=c.times(2),s!==0&&(c=c.plus(KS(S,d+2,N).times(s+""))),c=Qo(c,new S(p),d),S.precision=N,t==null?(Bn=!0,wn(c,N)):c;c=h,r+=2}}function BI(e,t){var n,i,r;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;t.charCodeAt(i)===48;)++i;for(r=t.length;t.charCodeAt(r-1)===48;)--r;if(t=t.slice(i,r),t){if(r-=i,n=n-i-1,e.e=Lh(n/Mn),e.d=[],i=(n+1)%Mn,n<0&&(i+=Mn),i<r){for(i&&e.d.push(+t.slice(0,i)),r-=Mn;i<r;)e.d.push(+t.slice(i,i+=Mn));t=t.slice(i),i=Mn-t.length}else i-=r;for(;i--;)t+="0";if(e.d.push(+t),Bn&&(e.e>bx||e.e<-bx))throw Error(vT+n)}else e.s=0,e.e=0,e.d=[0];return e}function wn(e,t,n){var i,r,s,l,c,h,d,f,p=e.d;for(l=1,s=p[0];s>=10;s/=10)l++;if(i=t-l,i<0)i+=Mn,r=t,d=p[f=0];else{if(f=Math.ceil((i+1)/Mn),s=p.length,f>=s)return e;for(d=s=p[f],l=1;s>=10;s/=10)l++;i%=Mn,r=i-Mn+l}if(n!==void 0&&(s=Xc(10,l-r-1),c=d/s%10|0,h=t<0||p[f+1]!==void 0||d%s,h=n<4?(c||h)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||h||n==6&&(i>0?r>0?d/Xc(10,l-r):0:p[f-1])%10&1||n==(e.s<0?8:7))),t<1||!p[0])return h?(s=bi(e),p.length=1,t=t-s-1,p[0]=Xc(10,(Mn-t%Mn)%Mn),e.e=Lh(-t/Mn)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(i==0?(p.length=f,s=1,f--):(p.length=f+1,s=Xc(10,Mn-i),p[f]=r>0?(d/Xc(10,l-r)%Xc(10,r)|0)*s:0),h)for(;;)if(f==0){(p[0]+=s)==Ii&&(p[0]=1,++e.e);break}else{if(p[f]+=s,p[f]!=Ii)break;p[f--]=0,s=1}for(i=p.length;p[--i]===0;)p.pop();if(Bn&&(e.e>bx||e.e<-bx))throw Error(vT+bi(e));return e}function dF(e,t){var n,i,r,s,l,c,h,d,f,p,v=e.constructor,x=v.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new v(e),Bn?wn(t,x):t;if(h=e.d,p=t.d,i=t.e,d=e.e,h=h.slice(),l=d-i,l){for(f=l<0,f?(n=h,l=-l,c=p.length):(n=p,i=d,c=h.length),r=Math.max(Math.ceil(x/Mn),c)+2,l>r&&(l=r,n.length=1),n.reverse(),r=l;r--;)n.push(0);n.reverse()}else{for(r=h.length,c=p.length,f=r<c,f&&(c=r),r=0;r<c;r++)if(h[r]!=p[r]){f=h[r]<p[r];break}l=0}for(f&&(n=h,h=p,p=n,t.s=-t.s),c=h.length,r=p.length-c;r>0;--r)h[c++]=0;for(r=p.length;r>l;){if(h[--r]<p[r]){for(s=r;s&&h[--s]===0;)h[s]=Ii-1;--h[s],h[r]+=Ii}h[r]-=p[r]}for(;h[--c]===0;)h.pop();for(;h[0]===0;h.shift())--i;return h[0]?(t.d=h,t.e=i,Bn?wn(t,x):t):new v(0)}function Iu(e,t,n){var i,r=bi(e),s=Ja(e.d),l=s.length;return t?(n&&(i=n-l)>0?s=s.charAt(0)+"."+s.slice(1)+Wl(i):l>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(r<0?"e":"e+")+r):r<0?(s="0."+Wl(-r-1)+s,n&&(i=n-l)>0&&(s+=Wl(i))):r>=l?(s+=Wl(r+1-l),n&&(i=n-r-1)>0&&(s=s+"."+Wl(i))):((i=r+1)<l&&(s=s.slice(0,i)+"."+s.slice(i)),n&&(i=n-l)>0&&(r+1===l&&(s+="."),s+=Wl(i))),e.s<0?"-"+s:s}function FI(e,t){if(e.length>t)return e.length=t,!0}function hF(e){var t,n,i;function r(s){var l=this;if(!(l instanceof r))return new r(s);if(l.constructor=r,s instanceof r){l.s=s.s,l.e=s.e,l.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ku+s);if(s>0)l.s=1;else if(s<0)s=-s,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(s===~~s&&s<1e7){l.e=0,l.d=[s];return}return BI(l,s.toString())}else if(typeof s!="string")throw Error(ku+s);if(s.charCodeAt(0)===45?(s=s.slice(1),l.s=-1):l.s=1,rpe.test(s))BI(l,s);else throw Error(ku+s)}if(r.prototype=Ge,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=hF,r.config=r.set=spe,e===void 0&&(e={}),e)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return r.config(e),r}function spe(e){if(!e||typeof e!="object")throw Error(Ks+"Object expected");var t,n,i,r=["precision",1,Dh,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<r.length;t+=3)if((i=e[n=r[t]])!==void 0)if(Lh(i)===i&&i>=r[t+1]&&i<=r[t+2])this[n]=i;else throw Error(ku+n+": "+i);if((i=e[n="LN10"])!==void 0)if(i==Math.LN10)this[n]=new this(i);else throw Error(ku+n+": "+i);return this}var xT=hF(ipe);ms=new xT(1);const It=xT;function fF(e){var t;return e===0?t=1:t=Math.floor(new It(e).abs().log(10).toNumber())+1,t}function mF(e,t,n){for(var i=new It(e),r=0,s=[];i.lt(t)&&r<1e5;)s.push(i.toNumber()),i=i.add(n),r++;return s}function lp(e,t){return cpe(e)||lpe(e,t)||ope(e,t)||ape()}function ape(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
718In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ope(e,t){if(e){if(typeof e=="string")return $I(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$I(e,t):void 0}}function $I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function lpe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;
718!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function cpe(e){if(Array.isArray(e))return e}var pF=e=>{var t=lp(e,2),n=t[0],i=t[1],r=n,s=i;return n>i&&(r=i,s=n),[r,s]},yT=(e,t,n)=>{if(e.lte(0))return new It(0);var i=fF(e.toNumber()),r=new It(10).pow(i),s=e.div(r),l=i!==1?.05:.1,c=new It(Math.ceil(s.div(l).toNumber())).add(n).mul(l),h=c.mul(r);return t?new It(h.toNumber()):new It(Math.ceil(h.toNumber()))},gF=(e,t,n)=>{var i;if(e.lte(0))return new It(0);var r=[1,2,2.5,5],s=e.toNumber(),l=Math.floor(new It(s).abs().log(10).toNumber()),c=new It(10).pow(l),h=e.div(c).toNumber(),d=r.findIndex(x=>x>=h-1e-10);if(d===-1&&(c=c.mul(10),d=0),d+=n,d>=r.length){var f=Math.floor(d/r.length);d%=r.length,c=c.mul(new It(10).pow(f))}var p=(i=r[d])!==null&&i!==void 0?i:1,v=new It(p).mul(c);return t?v:new It(Math.ceil(v.toNumber()))},upe=(e,t,n)=>{var i=new It(1),r=new It(e);if(!r.isint()&&n){var s=Math.abs(e);s<1?(i=new It(10).pow(fF(e)-1),r=new It(Math.floor(r.div(i).toNumber())).mul(i)):s>1&&(r=new It(Math.floor(e)))}else e===0?r=new It(Math.floor((t-1)/2)):n||(r=new It(Math.floor(e)));for(var l=Math.floor((t-1)/2),c=[],h=0;h<t;h++)c.push(r.add(new It(h-l).mul(i)).toNumber());return c},vF=function(t,n,i,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:yT;if(!Number.isFinite((n-t)/(i-1)))return{step:new It(0),tickMin:new It(0),tickMax:new It(0)};var c=l(new It(n).sub(t).div(i-1),r,s),h;t<=0&&n>=0?h=new It(0):(h=new It(t).add(n).div(2),h=h.sub(new It(h).mod(c)));var d=Math.ceil(h.sub(t).div(c).toNumber()),f=Math.ceil(new It(n).sub(h).div(c).toNumber()),p=d+f+1;return p>i?vF(t,n,i,r,s+1,l):(p<i&&(f=n>0?f+(i-p):f,d=n>0?d:d+(i-p)),{step:c,tickMin:h.sub(new It(d).mul(c)),tickMax:h.add(new It(f).mul(c))})},VI=function(t){var n=lp(t,2),i=n[0],r=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",h=Math.max(s,2),d=pF([i,r]),f=lp(d,2),p=f[0],v=f[1];if(p===-1/0||v===1/0){var x=v===1/0?[p,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),v];return i>r?x.reverse():x}if(p===v)return upe(p,s,l);var b=c==="snap125"?gF:yT,S=vF(p,v,h,l,0,b),N=S.step,j=S.tickMin,T=S.tickMax,E=mF(j,T.add(new It(.1).mul(N)),N);return i>r?E.reverse():E},zI=function(t,n){var i=lp(t,2),r=i[0],s=i[1],l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",h=pF([r,s]),d=lp(h,2),f=d[0],p=d[1];if(f===-1/0||p===1/0)return[r,s];if(f===p)return[f];var v=c==="snap125"?gF:yT,x=Math.max(n,2),b=v(new It(p).sub(f).div(x-1),l,0),S=[...mF(new It(f),new It(p),b),p];return l===!1&&(S=S.map(N=>Math.round(N))),r>s?S.reverse():S},dpe=e=>e.rootProps.barCategoryGap,Jy=e=>e.rootProps.stackOffset,xF=e=>e.rootProps.reverseStackOrder,bT=e=>e.options.chartName,wT=e=>e.rootProps.syncId,yF=e=>e.rootProps.syncMethod,ST=e=>e.options.eventEmitter,hpe=e=>e.rootProps.baseValue,Mr={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},$c={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Ua={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},Zy=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function eb(e,t,n){if(n!=="auto")return n;if(e!=null)return uo(e,t)?"category":"number"}function qI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function wx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qI(Object(n),!0).forEach(function(i){fpe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qI(Object(n)).forEac
718h(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function fpe(e,t,n){return(t=mpe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mpe(e){var t=ppe(e,"string");return typeof t=="symbol"?t:t+""}function ppe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var WI={allowDataOverflow:$c.allowDataOverflow,allowDecimals:$c.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:$c.angleAxisId,includeHidden:!1,name:void 0,reversed:$c.reversed,scale:$c.scale,tick:$c.tick,tickCount:void 0,ticks:void 0,type:$c.type,unit:void 0,niceTicks:"auto"},HI={allowDataOverflow:Ua.allowDataOverflow,allowDecimals:Ua.allowDecimals,allowDuplicatedCategory:Ua.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ua.radiusAxisId,includeHidden:Ua.includeHidden,name:void 0,reversed:Ua.reversed,scale:Ua.scale,tick:Ua.tick,tickCount:Ua.tickCount,ticks:void 0,type:Ua.type,unit:void 0,niceTicks:"auto"},gpe=(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},kT=pe([gpe,z9],(e,t)=>{var n;if(e!=null)return e;var i=(n=eb(t,"angleAxis",WI.type))!==null&&n!==void 0?n:"category";return wx(wx({},WI),{},{type:i})}),vpe=(e,t)=>e.polarAxis.radiusAxis[t],NT=pe([vpe,z9],(e,t)=>{var n;if(e!=null)return e;var i=(n=eb(t,"radiusAxis",HI.type))!==null&&n!==void 0?n:"category";return wx(wx({},HI),{},{type:i})}),tb=e=>e.polarOptions,jT=pe([sl,al,hr],Lme),bF=pe([tb,jT],(e,t)=>{if(e!=null)return pc(e.innerRadius,t,0)}),wF=pe([tb,jT],(e,t)=>{if(e!=null)return pc(e.outerRadius,t,t*.8)}),xpe=e=>{if(e==null)return[0,0];var t=e.startAngle,n=e.endAngle;return[t,n]},SF=pe([tb],xpe);pe([kT,SF],Zy);var kF=pe([jT,bF,wF],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});pe([NT,kF],Zy);var NF=pe([Fn,tb,bF,wF,sl,al],(e,t,n,i,r,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||i==null)){var l=t.cx,c=t.cy,h=t.startAngle,d=t.endAngle;return{cx:pc(l,r,r/2),cy:pc(c,s,s/2),innerRadius:n,outerRadius:i,startAngle:h,endAngle:d,clockWise:!1}}}),Wi=(e,t)=>t,nb=(e,t,n)=>n;function CT(e){return e==null?void 0:e.id}function jF(e,t,n){var i=t.chartData,r=i===void 0?[]:i,s=n.allowDuplicatedCategory,l=n.dataKey,c=new Map;return e.forEach(h=>{var d,f=(d=h.data)!==null&&d!==void 0?d:r;if(!(f==null||f.length===0)){var p=CT(h);f.forEach((v,x)=>{var b=l==null||s?x:String(Vi(v,l,null)),S=Vi(v,h.dataKey,0),N;c.has(b)?N=c.get(b):N={},Object.assign(N,{[p]:S}),c.set(b,N)})}}),Array.from(c.values())}function TT(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var ib=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function rb(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function ype(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}var Hi=e=>{var t=Fn(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Uh=e=>e.tooltip.settings.axisId;function ET(e){if(e!=null){var t=e.ticks,n=e.bandwidth,i=e.range(),r=[Math.min(...i),Math.max(...i)];return{domain:()=>e.domain(),range:(function(s){function l(){return s.apply(this,arguments)}return l.toString=function(){return s.toString()},l})(()=>r),rangeMin:()=>r[0],rangeMax:()=>r[1],isInRange(s){var l=r[0],c=r[1];return l<=c?s>=l&&s<=c:s>=c&&s<=l},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,l)=>{var c=e(s);if(c!=null){if(e.bandwidth&&l!==null&&l!==void 0&&l.position){var h=e.bandwidth();switch(l.position){case"middle":c+=h/2;break;case"end":c+=h;break}}return c}}}}}var bpe=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!to(t)){for(var n,i,r=0;r<t.length;r++){var s=t[r];Mt(s)&&((n===void 0||s<n)&&(n=s),(i===void 0||s>i)&&(i=s))}return n!==void 0&&i!==void 0?[n,i]:void 0}return t}default:return t}};function oc(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function wpe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function AT(e){let t,n,i;e.length!==2?(t=oc,n=(c,h)=>oc(e(c),h),i=(c,h)=>e(c)-h):(t=e===oc||e===wpe?e:Spe,n=e,i=e);function r(c,h,d=0,f=c.length){if(d<f){if(t(h,h)!==0)return f;do{const p=d+f>>>1;n(c[p],h)<0?d=p+1:f=p}while(d<f)}return d}function s(c,h,d=0,f=c.length){if(d<f){if(t(h,h)!==0)return f;do{const p=d+f>>>1;n(c[p],h)<=0?d=p+1:f=p}while(d<f)}return d}function l(c,h,d=0,f=c.length){const p=r(c,h,d,f-1);return p>d&&i(c[p-1],h)>-i(c[p],h)?p-1:p}return{left:r,center:l,right:s}}function Spe(){return 0}function CF(e){return e===null?NaN:+e}function*kpe(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const Npe=AT(oc),_p=Npe.right;AT(CF).center;class KI extends Map{constructor(t,n=Tpe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(GI(this,t))}has(t){return super.has(GI(this,t))}set(t,n){return super.set(jpe(this,t),n)}delete(t){return super.delete(Cpe(this,t))}}function GI({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function jpe({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function Cpe({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(i),e.delete(i)),n}function Tpe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Epe(e=oc){if(e===oc)return TF;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||i===0?i:(e(n,n)===0)-(e(t,t)===0)}}function TF(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Ape=Math.sqrt(50),Ppe=Math.sqrt(10),_pe=Math.sqrt(2);
718function Sx(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),l=s>=Ape?10:s>=Ppe?5:s>=_pe?2:1;let c,h,d;return r<0?(d=Math.pow(10,-r)/l,c=Math.round(e*d),h=Math.round(t*d),c/d<e&&++c,h/d>t&&--h,d=-d):(d=Math.pow(10,r)*l,c=Math.round(e/d),h=Math.round(t/d),c*d<e&&++c,h*d>t&&--h),h<c&&.5<=n&&n<2?Sx(e,t,n*2):[c,h,d]}function lj(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const i=t<e,[r,s,l]=i?Sx(t,e,n):Sx(e,t,n);if(!(s>=r))return[];const c=s-r+1,h=new Array(c);if(i)if(l<0)for(let d=0;d<c;++d)h[d]=(s-d)/-l;else for(let d=0;d<c;++d)h[d]=(s-d)*l;else if(l<0)for(let d=0;d<c;++d)h[d]=(r+d)/-l;else for(let d=0;d<c;++d)h[d]=(r+d)*l;return h}function cj(e,t,n){return t=+t,e=+e,n=+n,Sx(e,t,n)[2]}function uj(e,t,n){t=+t,e=+e,n=+n;const i=t<e,r=i?cj(t,e,n):cj(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function YI(e,t){let n;for(const i of e)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);return n}function QI(e,t){let n;for(const i of e)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);return n}function EF(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=r===void 0?TF:Epe(r);i>n;){if(i-n>600){const h=i-n+1,d=t-n+1,f=Math.log(h),p=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*p*(h-p)/h)*(d-h/2<0?-1:1),x=Math.max(n,Math.floor(t-d*p/h+v)),b=Math.min(i,Math.floor(t+(h-d)*p/h+v));EF(e,t,x,b,r)}const s=e[t];let l=n,c=i;for(Xf(e,n,t),r(e[i],s)>0&&Xf(e,n,i);l<c;){for(Xf(e,l,c),++l,--c;r(e[l],s)<0;)++l;for(;r(e[c],s)>0;)--c}r(e[n],s)===0?Xf(e,n,c):(++c,Xf(e,c,i)),c<=t&&(n=c+1),t<=c&&(i=c-1)}return e}function Xf(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Mpe(e,t,n){if(e=Float64Array.from(kpe(e)),!(!(i=e.length)||isNaN(t=+t))){if(t<=0||i<2)return QI(e);if(t>=1)return YI(e);var i,r=(i-1)*t,s=Math.floor(r),l=YI(EF(e,s).subarray(0,s+1)),c=QI(e.subarray(s+1));return l+(c-l)*(r-s)}}function Rpe(e,t,n=CF){if(!(!(i=e.length)||isNaN(t=+t))){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,s=Math.floor(r),l=+n(e[s],s,e),c=+n(e[s+1],s+1,e);return l+(c-l)*(r-s)}}function Ope(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(r);++i<r;)s[i]=e+i*n;return s}function Qs(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function ol(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const dj=Symbol("implicit");function PT(){var e=new KI,t=[],n=[],i=dj;function r(s){let l=e.get(s);if(l===void 0){if(i!==dj)return i;e.set(s,l=t.push(s)-1)}return n[l%n.length]}return r.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new KI;for(const l of s)e.has(l)||e.set(l,t.push(l)-1);return r},r.range=function(s){return arguments.length?(n=Array.from(s),r):n.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return PT(t,n).unknown(i)},Qs.apply(r,arguments),r}function _T(){var e=PT().unknown(void 0),t=e.domain,n=e.range,i=0,r=1,s,l,c=!1,h=0,d=0,f=.5;delete e.unknown;function p(){var v=t().length,x=r<i,b=x?r:i,S=x?i:r;s=(S-b)/Math.max(1,v-h+d*2),c&&(s=Math.floor(s)),b+=(S-b-s*(v-h))*f,l=s*(1-h),c&&(b=Math.round(b),l=Math.round(l));var N=Ope(v).map(function(j){return b+s*j});return n(x?N.reverse():N)}return e.domain=function(v){return arguments.length?(t(v),p()):t()},e.range=function(v){return arguments.length?([i,r]=v,i=+i,r=+r,p()):[i,r]},e.rangeRound=function(v){return[i,r]=v,i=+i,r=+r,c=!0,p()},e.bandwidth=function(){return l},e.step=function(){return s},e.round=function(v){return arguments.length?(c=!!v,p()):c},e.padding=function(v){return arguments.length?(h=Math.min(1,d=+v),p()):h},e.paddingInner=function(v){return arguments.length?(h=Math.min(1,v),p()):h},e.paddingOuter=function(v){return arguments.length?(d=+v,p()):d},e.align=function(v){return arguments.length?(f=Math.max(0,Math.min(1,v)),p()):f}
vendor: 5,096 bytes, line 718
718,e.copy=function(){return _T(t(),[i,r]).round(c).paddingInner(h).paddingOuter(d).align(f)},Qs.apply(p(),arguments)}function AF(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return AF(t())},e}function Ipe(){return AF(_T.apply(null,arguments).paddingInner(1))}function MT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function PF(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Mp(){}var cp=.7,kx=1/cp,lh="\\s*([+-]?\\d+)\\s*",up="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",no="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Dpe=/^#([0-9a-f]{3,8})$/,Lpe=new RegExp(`^rgb\\(${lh},${lh},${lh}\\)$`),Upe=new RegExp(`^rgb\\(${no},${no},${no}\\)$`),Bpe=new RegExp(`^rgba\\(${lh},${lh},${lh},${up}\\)$`),Fpe=new RegExp(`^rgba\\(${no},${no},${no},${up}\\)$`),$pe=new RegExp(`^hsl\\(${up},${no},${no}\\)$`),Vpe=new RegExp(`^hsla\\(${up},${no},${no},${up}\\)$`),XI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};MT(Mp,dp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:JI,formatHex:JI,formatHex8:zpe,formatHsl:qpe,formatRgb:ZI,toString:ZI});function JI(){return this.rgb().formatHex()}function zpe(){return this.rgb().formatHex8()}function qpe(){return _F(this).formatHsl()}function ZI(){return this.rgb().formatRgb()}function dp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Dpe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?eD(t):n===3?new Zr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?k0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?k0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Lpe.exec(e))?new Zr(t[1],t[2],t[3],1):(t=Upe.exec(e))?new Zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Bpe.exec(e))?k0(t[1],t[2],t[3],t[4]):(t=Fpe.exec(e))?k0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$pe.exec(e))?iD(t[1],t[2]/100,t[3]/100,1):(t=Vpe.exec(e))?iD(t[1],t[2]/100,t[3]/100,t[4]):XI.hasOwnProperty(e)?eD(XI[e]):e==="transparent"?new Zr(NaN,NaN,NaN,0):null}function eD(e){return new Zr(e>>16&255,e>>8&255,e&255,1)}function k0(e,t,n,i){return i<=0&&(e=t=n=NaN),new Zr(e,t,n,i)}function Wpe(e){return e instanceof Mp||(e=dp(e)),e?(e=e.rgb(),new Zr(e.r,e.g,e.b,e.opacity)):new Zr}function hj(e,t,n,i){return arguments.length===1?Wpe(e):new Zr(e,t,n,i??1)}function Zr(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}
vendor: 14,404 bytes, line 718
718MT(Zr,hj,PF(Mp,{brighter(e){return e=e==null?kx:Math.pow(kx,e),new Zr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cp:Math.pow(cp,e),new Zr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zr(Nu(this.r),Nu(this.g),Nu(this.b),Nx(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tD,formatHex:tD,formatHex8:Hpe,formatRgb:nD,toString:nD}));function tD(){return`#${uu(this.r)}${uu(this.g)}${uu(this.b)}`}function Hpe(){return`#${uu(this.r)}${uu(this.g)}${uu(this.b)}${uu((isNaN(this.opacity)?1:this.opacity)*255)}`}function nD(){const e=Nx(this.opacity);return`${e===1?"rgb(":"rgba("}${Nu(this.r)}, ${Nu(this.g)}, ${Nu(this.b)}${e===1?")":`, ${e})`}`}function Nx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Nu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function uu(e){return e=Nu(e),(e<16?"0":"")+e.toString(16)}function iD(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ga(e,t,n,i)}function _F(e){if(e instanceof ga)return new ga(e.h,e.s,e.l,e.opacity);if(e instanceof Mp||(e=dp(e)),!e)return new ga;if(e instanceof ga)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),l=NaN,c=s-r,h=(s+r)/2;return c?(t===s?l=(n-i)/c+(n<i)*6:n===s?l=(i-t)/c+2:l=(t-n)/c+4,c/=h<.5?s+r:2-s-r,l*=60):c=h>0&&h<1?0:l,new ga(l,c,h,e.opacity)}function Kpe(e,t,n,i){return arguments.length===1?_F(e):new ga(e,t,n,i??1)}function ga(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}MT(ga,Kpe,PF(Mp,{brighter(e){return e=e==null?kx:Math.pow(kx,e),new ga(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cp:Math.pow(cp,e),new ga(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new Zr(GS(e>=240?e-240:e+120,r,i),GS(e,r,i),GS(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new ga(rD(this.h),N0(this.s),N0(this.l),Nx(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Nx(this.opacity);return`${e===1?"hsl(":"hsla("}${rD(this.h)}, ${N0(this.s)*100}%, ${N0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rD(e){return e=(e||0)%360,e<0?e+360:e}function N0(e){return Math.max(0,Math.min(1,e||0))}function GS(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const RT=e=>()=>e;function Gpe(e,t){return function(n){return e+n*t}}function Ype(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function Qpe(e){return(e=+e)==1?MF:function(t,n){return n-t?Ype(t,n,e):RT(isNaN(t)?n:t)}}function MF(e,t){var n=t-e;return n?Gpe(e,n):RT(isNaN(e)?t:e)}const sD=(function e(t){var n=Qpe(t);function i(r,s){var l=n((r=hj(r)).r,(s=hj(s)).r),c=n(r.g,s.g),h=n(r.b,s.b),d=MF(r.opacity,s.opacity);return function(f){return r.r=l(f),r.g=c(f),r.b=h(f),r.opacity=d(f),r+""}}return i.gamma=e,i})(1);function Xpe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r<n;++r)i[r]=e[r]*(1-s)+t[r]*s;return i}}function Jpe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Zpe(e,t){var n=t?t.length:0,i=e?Math.min(n,e.length):0,r=new Array(i),s=new Array(n),l;for(l=0;l<i;++l)r[l]=Bh(e[l],t[l]);for(;l<n;++l)s[l]=t[l];return function(c){for(l=0;l<i;++l)s[l]=r[l](c);return s}}function ege(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function jx(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function tge(e,t){var n={},i={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=Bh(e[r],t[r]):i[r]=t[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var fj=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,YS=new RegExp(fj.source,"g");function nge(e){return function(){return e}}function ige(e){return function(t){return e(t)+""}}function rge(e,t){var n=fj.lastIndex=YS.lastIndex=0,i,r,s,l=-1,c=[],h=[];for(e=e+"",t=t+"";(i=fj.exec(e))&&(r=YS.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),c[l]?c[l]+=s:c[++l]=s),(i=i[0])===(r=r[0])?c[l]?c[l]+=r:c[++l]=r:(c[++l]=null,h.push({i:l,x:jx(i,r)})),n=YS.lastIndex;return n<t.length&&(s=t.slice(n),c[l]?c[l]+=s:c[++l]=s),c.length<2?h[0]?ige(h[0].x):nge(t):(t=h.length,function(d){for(var f=0,p;f<t;++f)c[(p=h[f]).i]=p.x(d);return c.join("")})}function Bh(e,t){var n=typeof t,i;return t==null||n==="boolean"?RT(t):(n==="number"?jx:n==="string"?(i=dp(t))?(t=i,sD):rge:t instanceof dp?sD:t instanceof Date?ege:Jpe(t)?Xpe:Array.isArray(t)?Zpe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?tge:jx)(e,t)}function OT(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function sge(e,t){t===void 0&&(t=e,e=Bh);for(var n=0,i=t.length-1,r=t[0],s=new Array(i<0?0:i);n<i;)s[n]=e(r,r=t[++n]);return function(l){var c=Math.max(0,Math.min(i-1,Math.floor(l*=i)));return s[c](l-c)}}function age(e){return function(){return e}}function Cx(e){return+e}var aD=[0,1];function Rr(e){return e}function mj(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:age(isNaN(t)?NaN:.5)}function oge(e,t){var n;return e>t&&(n=e,e=t,t=n),function(i){return Math.max(e,Math.min(t,i))}}function lge(e,t,n){var i=e[0],r=e[1],s=t[0],l=t[1];return r<i?(i=mj(r,i),s=n(l,s)):(i=mj(i,r),s=n(s,l)),function(c){return s(i(c))}}function cge(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),l=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++l<i;)r[l]=mj(e[l],e[l+1]),s[l]=n(t[l],t[l+1]);return function(c){var h=_p(e,c,1,i)-1;return s[h](r[h](c))}}function Rp(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function sb(){var e=aD,t=aD,n=Bh,i,r,s,l=Rr,c,h,d;function f(){var v=Math.min(e.length,t.length);return l!==Rr&&(l=oge(e[0],e[v-1])),c=v>2?cge:lge,h=d=null,p}function p(v){return v==null||isNaN(v=+v)?s:(h||(h=c(e.map(i),t,n)))(i(l(v)))}return p.invert=function(v){return l(r((d||(d=c(t,e.map(i),jx)))(v)))},p.domain=function(v){return arguments.length?(e=Array.from(v,Cx),f()):e.slice()},p.range=function(v){return arguments.length?(t=Array.from(v),f()):t.slice()},p.rangeRound=function(v){return t=Array.from(v),n=OT,f()},p.clamp=function(v){return arguments.length?(l=v?!0:Rr,f()):l!==Rr},p.interpolate=function(v){return arguments.length?(n=v,f()):n},p.unknown=function(v){return arguments.length?(s=v,p):s},function(v,x){return i=v,r=x,f()}}function IT(){return sb()(Rr,Rr)}function uge(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Tx(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function kh(e){return e=Tx(Math.abs(e)),e?e[1]:NaN}function dge(e,t){return function(n,i){for(var r=n.length,s=[],l=0,c=e[0],h=0;r>0&&c>0&&(h+c+1>i&&(c=Math.max(1,i-h)),s.push(n.substring(r-=c,r+c)),!((h+=c+1)>i));)c=e[l=(l+1)%e.length];return s.reverse().join(t)}}function hge(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var fge=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function hp(e){if(!(t=fge.exec(e)))throw new Error("invalid format: "+e);var t;return new DT({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}hp.prototype=DT.prototype;function DT(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}DT.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function mge(e){e:for(var t=e.length,n=1,i=-1,r;n<t;++n)switch(e[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+e[n])break e;i>0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(r+1):e}var Ex;function pge(e,t){var n=Tx(e,t);if(!n)return Ex=void 0,e.toPrecision(t);var i=n[0],r=n[1],s=r-(Ex=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,l=i.length;return s===l?i:s>l?i+new Array(s-l+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Tx(e,Math.max(0,t+s-1))[0]}function oD(e,t){var n=Tx(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const lD={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:uge,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>oD(e*100,t),r:oD,s:pge,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function cD(e){return e}var uD=Array.prototype.map,dD=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function gge(e){var t=e.grouping===void 0||e.thousands===void 0?cD:dge(uD.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",r=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?cD:hge(uD.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",c=e.minus===void 0?"−":e.minus+"",h=e.nan===void 0?"NaN":e.nan+"";function d(p,v){p=hp(p);var x=p.fill,b=p.align,S=p.sign,N=p.symbol,j=p.zero,T=p.width,E=p.comma,C=p.precision,P=p.trim,A=p.type;A==="n"?(E=!0,A="g"):lD[A]||(C===void 0&&(C=12),P=!0,A="g"),(j||x==="0"&&b==="=")&&(j=!0,x="0",b="=");var M=(v&&v.prefix!==void 0?v.prefix:"")+(N==="$"?n:N==="#"&&/[boxX]/.test(A)?"0"+A.toLowerCase():""),R=(N==="$"?i:/[%p]/.test(A)?l:"")+(v&&v.suffix!==void 0?v.suffix:""),B=lD[A],U=/[defgprs%]/.test(A);C=C===void 0?6:/[gprs]/.test(A)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function O(F){var ne=M,re=R,Q,W,q;if(A==="c")re=B(F)+re,F="";else{F=+F;var $=F<0||1/F<0;if(F=isNaN(F)?h:B(Math.abs(F),C),P&&(F=mge(F)),$&&+F==0&&S!=="+"&&($=!1),ne=($?S==="("?S:c:S==="-"||S==="("?"":S)+ne,re=(A==="s"&&!isNaN(F)&&Ex!==void 0?dD[8+Ex/3]:"")+re+($&&S==="("?")":""),U){for(Q=-1,W=F.length;++Q<W;)if(q=F.charCodeAt(Q),48>q||q>57){re=(q===46?r+F.slice(Q+1):F.slice(Q))+re,F=F.slice(0,Q);break}}}E&&!j&&(F=t(F,1/0));var ge=ne.length+F.length+re.length,ue=ge<T?new Array(T-ge+1).join(x):"";switch(E&&j&&(F=t(ue+F,ue.length?T-re.length:1/0),ue=""),b){case"<":F=ne+F+re+ue;break;case"=":F=ne+ue+F+re;break;case"^":F=ue.slice(0,ge=ue.length>>1)+ne+F+re+ue.slice(ge);break;default:F=ue+ne+F+re;break}return s(F)}return O.toString=function(){return p+""},O}function f(p,v){var x=Math.max(-8,Math.min(8,Math.floor(kh(v)/3)))*3,b=Math.pow(10,-x),S=d((p=hp(p),p.type="f",p),{suffix:dD[8+x/3]});return function(N){return S(b*N)}}return{format:d,formatPrefix:f}}var j0,LT,RF;vge({thousands:",",grouping:[3],currency:["$",""]});function vge(e){return j0=gge(e),LT=j0.format,RF=j0.formatPrefix,j0}function xge(e){return Math.max(0,-kh(Math.abs(e)))}function yge(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(kh(t)/3)))*3-kh(Math.abs(e)))}function bge(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,kh(t)-kh(e))+1}function OF(e,t,n,i){var r=uj(e,t,n),s;switch(i=hp(i??",f"),i.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return i.precision==null&&!isNaN(s=yge(r,l))&&(i.precision=s),RF(i,l)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=bge(r,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=xge(r))&&(i.precision=s-(i.type==="%")*2);break}}return LT(i)}function xc(e){var t=e.domain;return e.ticks=function(n){var i=t();return lj(i[0],i[i.length-1],n??10)},e.tickFormat=function(n,i){var r=t();return OF(r[0],r[r.length-1],n??10,i)},e.nice=function(n){n==null&&(n=10);var i=t(),r=0,s=i.length-1,l=i[r],c=i[s],h,d,f=10;for(c<l&&(d=l,l=c,c=d,d=r,r=s,s=d);f-- >0;){if(d=cj(l,c,n),d===h)return i[r]=l,i[s]=c,t(i);if(d>0)l=Math.floor(l/d)*d,c=Math.ceil(c/d)*d;else if(d<0)l=Math.ceil(l*d)/d,c=Math.floor(c*d)/d;else break;h=d}return e},e}function IF(){var e=IT();return e.copy=function(){return Rp(e,IF())},Qs.apply(e,arguments),xc(e)}function DF(e){var t;function n(i){return i==null||isNaN(i=+i)?t:i}return n.invert=n,n.domain=n.range=function(i){return arguments.length?(e=Array.from(i,Cx),n):e.slice()},n.unknown=function(i){return arguments.length?(t=i,n):t},n.copy=function(){return DF(e).unknown(t)},e=arguments.length?Array.from(e,Cx):[0,1],xc(n)}function LF(e,t){e=e.slice();var n=0,i=e.length-1,r=e[n],s=e[i],l;return s<r&&(l=n,n=i,i=l,l=r,r=s,s=l),e[n]=t.floor(r),e[i]=t.ceil(s),e}function hD(e){return Math.log(e)}function fD(e){return Math.exp(e)}function wge(e){return-Math.log(-e)}function Sge(e){return-Math.exp(-e)}function kge(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Nge(e){return e===10?kge:e===Math.E?Math.exp:t=>Math.pow(e,t)}function jge(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function mD(e){return(t,n)=>-e(-t,n)}function UT(e){const t=e(hD,fD),n=t.domain;let i=10,r,s;function l(){return r=jge(i),s=Nge(i),n()[0]<0?(r=mD(r),s=mD(s),e(wge,Sge)):e(hD,fD),t}return t.base=function(c){return arguments.length?(i=+c,l()):i},t.domain=function(c){return arguments.length?(n(c),l()):n()},t.ticks=c=>{const h=n();let d=h[0],f=h[h.length-1];const p=f<d;p&&([d,f]=[f,d]);let v=r(d),x=r(f),b,S;const N=c==null?10:+c;let j=[];if(!(i%1)&&x-v<N){if(v=Math.floor(v),x=Math.ceil(x),d>0){for(;v<=x;++v)for(b=1;b<i;++b)if(S=v<0?b/s(-v):b*s(v),!(S<d)){if(S>f)break;j.push(S)}}else for(;v<=x;++v)for(b=i-1;b>=1;--b)if(S=v>0?b/s(-v):b*s(v),!(S<d)){if(S>f)break;j.push(S)}j.length*2<N&&(j=lj(d,f,N))}else j=lj(v,x,Math.min(x-v,N)).map(s);return p?j.reverse():j},t.tickFormat=(c,h)=>{if(c==null&&(c=10),h==null&&(h=i===10?"s":","),typeof h!="function"&&(!(i%1)&&(h=hp(h)).precision==null&&(h.trim=!0),h=LT(h)
718),c===1/0)return h;const d=Math.max(1,i*c/t.ticks().length);return f=>{let p=f/s(Math.round(r(f)));return p*i<i-.5&&(p*=i),p<=d?h(f):""}},t.nice=()=>n(LF(n(),{floor:c=>s(Math.floor(r(c))),ceil:c=>s(Math.ceil(r(c)))})),t}function UF(){const e=UT(sb()).domain([1,10]);return e.copy=()=>Rp(e,UF()).base(e.base()),Qs.apply(e,arguments),e}function pD(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function gD(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function BT(e){var t=1,n=e(pD(t),gD(t));return n.constant=function(i){return arguments.length?e(pD(t=+i),gD(t)):t},xc(n)}function BF(){var e=BT(sb());return e.copy=function(){return Rp(e,BF()).constant(e.constant())},Qs.apply(e,arguments)}function vD(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Cge(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Tge(e){return e<0?-e*e:e*e}function FT(e){var t=e(Rr,Rr),n=1;function i(){return n===1?e(Rr,Rr):n===.5?e(Cge,Tge):e(vD(n),vD(1/n))}return t.exponent=function(r){return arguments.length?(n=+r,i()):n},xc(t)}function $T(){var e=FT(sb());return e.copy=function(){return Rp(e,$T()).exponent(e.exponent())},Qs.apply(e,arguments),e}function Ege(){return $T.apply(null,arguments).exponent(.5)}function xD(e){return Math.sign(e)*e*e}function Age(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function FF(){var e=IT(),t=[0,1],n=!1,i;function r(s){var l=Age(e(s));return isNaN(l)?i:n?Math.round(l):l}return r.invert=function(s){return e.invert(xD(s))},r.domain=function(s){return arguments.length?(e.domain(s),r):e.domain()},r.range=function(s){return arguments.length?(e.range((t=Array.from(s,Cx)).map(xD)),r):t.slice()},r.rangeRound=function(s){return r.range(s).round(!0)},r.round=function(s){return arguments.length?(n=!!s,r):n},r.clamp=function(s){return arguments.length?(e.clamp(s),r):e.clamp()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return FF(e.domain(),t).round(n).clamp(e.clamp()).unknown(i)},Qs.apply(r,arguments),xc(r)}function $F(){var e=[],t=[],n=[],i;function r(){var l=0,c=Math.max(1,t.length);for(n=new Array(c-1);++l<c;)n[l-1]=Rpe(e,l/c);return s}function s(l){return l==null||isNaN(l=+l)?i:t[_p(n,l)]}return s.invertExtent=function(l){var c=t.indexOf(l);return c<0?[NaN,NaN]:[c>0?n[c-1]:e[0],c<n.length?n[c]:e[e.length-1]]},s.domain=function(l){if(!arguments.length)return e.slice();e=[];for(let c of l)c!=null&&!isNaN(c=+c)&&e.push(c);return e.sort(oc),r()},s.range=function(l){return arguments.length?(t=Array.from(l),r()):t.slice()},s.unknown=function(l){return arguments.length?(i=l,s):i},s.quantiles=function(){return n.slice()},s.copy=function(){return $F().domain(e).range(t).unknown(i)},Qs.apply(s,arguments)}function VF(){var e=0,t=1,n=1,i=[.5],r=[0,1],s;function l(h){return h!=null&&h<=h?r[_p(i,h,0,n)]:s}function c(){var h=-1;for(i=new Array(n);++h<n;)i[h]=((h+1)*t-(h-n)*e)/(n+1);return l}return l.domain=function(h){return arguments.length?([e,t]=h,e=+e,t=+t,c()):[e,t]},l.range=function(h){return arguments.length?(n=(r=Array.from(h)).length-1,c()):r.slice()},l.invertExtent=function(h){var d=r.indexOf(h);return d<0?[NaN,NaN]:d<1?[e,i[0]]:d>=n?[i[n-1],t]:[i[d-1],i[d]]},l.unknown=function(h){return arguments.length&&(s=h),l},l.thresholds=function(){return i.slice()},l.copy=function(){return VF().domain([e,t]).range(r).unknown(s)},Qs.apply(xc(l),arguments)}function zF(){var e=[.5],t=[0,1],n,i=1;function r(s){return s!=null&&s<=s?t[_p(e,s,0,i)]:n}return r.domain=function(s){return arguments.length?(e=Array.from(s),i=Math.min(e.length,t.length-1),r):e.slice()},r.range=function(s){return arguments.length?(t=Array.from(s),i=Math.min(e.length,t.length-1),r):t.slice()},r.invertExtent=function(s){var l=t.indexOf(s);return[e[l-1],e[l]]},r.unknown=function(s){return arguments.length?(n=s,r):n},r.copy=function(){return zF().domain(e).range(t).unknown(n)},Qs.apply(r,arguments)}const QS=new Date,XS=new Date;function Ai(e,t,n,i){function r(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return r.floor=s=>(e(s=new Date(+s)),s),r.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),r.round=s=>{const l=r(s),c=r.ceil(s);return s-l<c-s?l:c},r.offset=(s,l)=>(t(s=new Date(+s),l==null?1:Math.floor(l)),s),r.range=(s,l,c)=>{const h=[];if(s=r.ceil(s),c=c==null?1:Math.floor(c),!(s<l)||!(c>0))return h;let d;do h.push(d=new Date(+s)),t(s,c),e(s);while(d<s&&s<l);return h},r.filter=s=>Ai(l=>{if(l>=l)for(;e(l),!s(l);)l.setTime(l-1)},(l,c)=>{if(l>=l)if(c<0)for(;++c<=0;)for(;t(l,-1),!s(l););else for(;--c>=0;)for(;t(l,1),!s(l););}),n&&(r.count=(s,l)=>(QS.setTime(+s),XS.setTime(+l),e(QS),e(XS),Math.floor(n(QS,XS))),r.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?r.filter(i?l=>i(l)%s===0:l=>r.count(0,l)%s===0):r)),r}const Ax=Ai(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ax.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ai(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ax);Ax.range;
vendor: 4,891 bytes, line 718
718const Ko=1e3,Vs=Ko*60,Go=Vs*60,el=Go*24,VT=el*7,yD=el*30,JS=el*365,du=Ai(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ko)},(e,t)=>(t-e)/Ko,e=>e.getUTCSeconds());du.range;const zT=Ai(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ko)},(e,t)=>{e.setTime(+e+t*Vs)},(e,t)=>(t-e)/Vs,e=>e.getMinutes());zT.range;const qT=Ai(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Vs)},(e,t)=>(t-e)/Vs,e=>e.getUTCMinutes());qT.range;const WT=Ai(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ko-e.getMinutes()*Vs)},(e,t)=>{e.setTime(+e+t*Go)},(e,t)=>(t-e)/Go,e=>e.getHours());WT.range;const HT=Ai(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Go)},(e,t)=>(t-e)/Go,e=>e.getUTCHours());HT.range;const Op=Ai(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Vs)/el,e=>e.getDate()-1);Op.range;const ab=Ai(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/el,e=>e.getUTCDate()-1);ab.range;const qF=Ai(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/el,e=>Math.floor(e/el));qF.range;function $u(e){return Ai(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Vs)/VT)}const ob=$u(0),Px=$u(1),Pge=$u(2),_ge=$u(3),Nh=$u(4),Mge=$u(5),Rge=$u(6);ob.range;Px.range;Pge.range;_ge.range;Nh.range;Mge.range;Rge.range;function Vu(e){return Ai(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/VT)}const lb=Vu(0),_x=Vu(1),Oge=Vu(2),Ige=Vu(3),jh=Vu(4),Dge=Vu(5),Lge=Vu(6);lb.range;_x.range;Oge.range;Ige.range;jh.range;Dge.range;Lge.range;const KT=Ai(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());KT.range;const GT=Ai(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());GT.range;const tl=Ai(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());tl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ai(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});tl.range;const nl=Ai(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());nl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ai(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});nl.range;function WF(e,t,n,i,r,s){const l=[[du,1,Ko],[du,5,5*Ko],[du,15,15*Ko],[du,30,30*Ko],[s,1,Vs],[s,5,5*Vs],[s,15,15*Vs],[s,30,30*Vs],[r,1,Go],[r,3,3*Go],[r,6,6*Go],[r,12,12*Go],[i,1,el],[i,2,2*el],[n,1,VT],[t,1,yD],[t,3,3*yD],[e,1,JS]];function c(d,f,p){const v=f<d;v&&([d,f]=[f,d]);const x=p&&typeof p.range=="function"?p:h(d,f,p),b=x?x.range(d,+f+1):[];return v?b.reverse():b}function h(d,f,p){const v=Math.abs(f-d)/p,x=AT(([,,N])=>N).right(l,v);if(x===l.length)return e.every(uj(d/JS,f/JS,p));if(x===0)return Ax.every(Math.max(uj(d,f,p),1));const[b,S]=l[v/l[x-1][2]<l[x][2]/v?x-1:x];return b.every(S)}return[c,h]}const[Uge,Bge]=WF(nl,GT,lb,qF,HT,qT),[Fge,$ge]=WF(tl,KT,ob,Op,WT,zT);function ZS(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function ek(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Jf(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Vge(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,s=e.days,l=e.shortDays,c=e.months,h=e.shortMonths,d=Zf(r),f=em(r),p=Zf(s),v=em(s),x=Zf(l),b=em(l),S=Zf(c),N=em(c),j=Zf(h),T=em(h),E={a:q,A:$,b:ge,B:ue,c:null,d:jD,e:jD,f:d0e,g:w0e,G:k0e,H:l0e,I:c0e,j:u0e,L:HF,m:h0e,M:f0e,p:L,q:J,Q:ED,s:AD,S:m0e,u:p0e,U:g0e,V:v0e,w:x0e,W:y0e,x:null,X:null,y:b0e,Y:S0e,Z:N0e,"%":TD},C={a:ye,A:Pe,b:Oe,B:je,c:null,d:CD,e:CD,f:E0e,g:U0e,G:F0e,H:j0e,I:C0e,j:T0e,L:GF,m:A0e,M:P0e,p:Ke,q:ve,Q:ED,s:AD,S:_0e,u:M0e,U:R0e,V:O0e,w:I0e,W:D0e,x:null,X:null,y:L0e,Y:B0e,Z:$0e,"%":TD},P={a:U,A:O,b:F,B:ne,c:re,d:kD,e:kD,f:r0e,g:SD,G:wD,H:ND,I:ND,j:e0e,L:i0e,m:Zge,M:t0e,p:B,q:Jge,Q:a0e,s:o0e,S:n0e,u:Kge,U:Gge,V:Yge,w:Hge,W:Qge,x:Q,X:W,y:SD,Y:wD,Z:Xge,"%":s0e};E.x=A(n,E),E.X=A(i,E),E.c=A(t,E),C.x=A(n,C),C.X=A(i,C),C.c=A(t,C);function A(le,Be){return function(De){var be=[],nt=-1,ze=0,Le=le.length,ht,yt,on;for(De instanceof Date||(De=new Date(+De));++nt<Le;
vendor: 7,735 bytes, line 718
718)le.charCodeAt(nt)===37&&(be.push(le.slice(ze,nt)),(yt=bD[ht=le.charAt(++nt)])!=null?ht=le.charAt(++nt):yt=ht==="e"?" ":"0",(on=Be[ht])&&(ht=on(De,yt)),be.push(ht),ze=nt+1);return be.push(le.slice(ze,nt)),be.join("")}}function M(le,Be){return function(De){var be=Jf(1900,void 0,1),nt=R(be,le,De+="",0),ze,Le;if(nt!=De.length)return null;if("Q"in be)return new Date(be.Q);if("s"in be)return new Date(be.s*1e3+("L"in be?be.L:0));if(Be&&!("Z"in be)&&(be.Z=0),"p"in be&&(be.H=be.H%12+be.p*12),be.m===void 0&&(be.m="q"in be?be.q:0),"V"in be){if(be.V<1||be.V>53)return null;"w"in be||(be.w=1),"Z"in be?(ze=ek(Jf(be.y,0,1)),Le=ze.getUTCDay(),ze=Le>4||Le===0?_x.ceil(ze):_x(ze),ze=ab.offset(ze,(be.V-1)*7),be.y=ze.getUTCFullYear(),be.m=ze.getUTCMonth(),be.d=ze.getUTCDate()+(be.w+6)%7):(ze=ZS(Jf(be.y,0,1)),Le=ze.getDay(),ze=Le>4||Le===0?Px.ceil(ze):Px(ze),ze=Op.offset(ze,(be.V-1)*7),be.y=ze.getFullYear(),be.m=ze.getMonth(),be.d=ze.getDate()+(be.w+6)%7)}else("W"in be||"U"in be)&&("w"in be||(be.w="u"in be?be.u%7:"W"in be?1:0),Le="Z"in be?ek(Jf(be.y,0,1)).getUTCDay():ZS(Jf(be.y,0,1)).getDay(),be.m=0,be.d="W"in be?(be.w+6)%7+be.W*7-(Le+5)%7:be.w+be.U*7-(Le+6)%7);return"Z"in be?(be.H+=be.Z/100|0,be.M+=be.Z%100,ek(be)):ZS(be)}}function R(le,Be,De,be){for(var nt=0,ze=Be.length,Le=De.length,ht,yt;nt<ze;){if(be>=Le)return-1;if(ht=Be.charCodeAt(nt++),ht===37){if(ht=Be.charAt(nt++),yt=P[ht in bD?Be.charAt(nt++):ht],!yt||(be=yt(le,De,be))<0)return-1}else if(ht!=De.charCodeAt(be++))return-1}return be}function B(le,Be,De){var be=d.exec(Be.slice(De));return be?(le.p=f.get(be[0].toLowerCase()),De+be[0].length):-1}function U(le,Be,De){var be=x.exec(Be.slice(De));return be?(le.w=b.get(be[0].toLowerCase()),De+be[0].length):-1}function O(le,Be,De){var be=p.exec(Be.slice(De));return be?(le.w=v.get(be[0].toLowerCase()),De+be[0].length):-1}function F(le,Be,De){var be=j.exec(Be.slice(De));return be?(le.m=T.get(be[0].toLowerCase()),De+be[0].length):-1}function ne(le,Be,De){var be=S.exec(Be.slice(De));return be?(le.m=N.get(be[0].toLowerCase()),De+be[0].length):-1}function re(le,Be,De){return R(le,t,Be,De)}function Q(le,Be,De){return R(le,n,Be,De)}function W(le,Be,De){return R(le,i,Be,De)}function q(le){return l[le.getDay()]}function $(le){return s[le.getDay()]}function ge(le){return h[le.getMonth()]}function ue(le){return c[le.getMonth()]}function L(le){return r[+(le.getHours()>=12)]}function J(le){return 1+~~(le.getMonth()/3)}function ye(le){return l[le.getUTCDay()]}function Pe(le){return s[le.getUTCDay()]}function Oe(le){return h[le.getUTCMonth()]}function je(le){return c[le.getUTCMonth()]}function Ke(le){return r[+(le.getUTCHours()>=12)]}function ve(le){return 1+~~(le.getUTCMonth()/3)}return{format:function(le){var Be=A(le+="",E);return Be.toString=function(){return le},Be},parse:function(le){var Be=M(le+="",!1);return Be.toString=function(){return le},Be},utcFormat:function(le){var Be=A(le+="",C);return Be.toString=function(){return le},Be},utcParse:function(le){var Be=M(le+="",!0);return Be.toString=function(){return le},Be}}}var bD={"-":"",_:" ",0:"0"},Ki=/^\s*\d+/,zge=/^%/,qge=/[\\^$*+?|[\]().{}]/g;function Yt(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",s=r.length;return i+(s<n?new Array(n-s+1).join(t)+r:r)}function Wge(e){return e.replace(qge,"\\$&")}function Zf(e){return new RegExp("^(?:"+e.map(Wge).join("|")+")","i")}function em(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Hge(e,t,n){var i=Ki.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function Kge(e,t,n){var i=Ki.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function Gge(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function Yge(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Qge(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function wD(e,t,n){var i=Ki.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function SD(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Xge(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Jge(e,t,n){var i=Ki.exec(t.slice(n,n+1));return i?(e.q=i[0]*3-3,n+i[0].length):-1}function Zge(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function kD(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function e0e(e,t,n){var i=Ki.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function ND(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function t0e(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function n0e(e,t,n){var i=Ki.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function i0e(e,t,n){var i=Ki.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function r0e(e,t,n){var i=Ki.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function s0e(e,t,n){var i=zge.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function a0e(e,t,n){var i=Ki.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function o0e(e,t,n){var i=Ki.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function jD(e,t){return Yt(e.getDate(),t,2)}function l0e(e,t){return Yt(e.getHours(),t,2)}function c0e(e,t){return Yt(e.getHours()%12||12,t,2)}function u0e(e,t){return Yt(1+Op.count(tl(e),e),t,3)}function HF(e,t){return Yt(e.getMilliseconds(),t,3)}function d0e(e,t){return HF(e,t)+"000"}function h0e(e,t){return Yt(e.getMonth()+1,t,2)}function f0e(e,t){return Yt(e.getMinutes(),t,2)}function m0e(e,t){return Yt(e.getSeconds(),t,2)}function p0e(e){var t=e.getDay();return t===0?7:t}function g0e(e,t){return Yt(ob.count(tl(e)-1,e),t,2)}function KF(e){var t=e.getDay();return t>=4||t===0?Nh(e):Nh.ceil(e)}function v0e(e,t){return e=KF(e),Yt(Nh.count(tl(e),e)+(tl(e).getDay()===4),t,2)}function x0e(e){return e.getDay()}function y0e(e,t){return Yt(Px.count(tl(e)-1,e),t,2)}function b0e(e,t){return Yt(e.getFullYear()%100,t,2)}function w0e(e,t){return e=KF(e),Yt(e.getFullYear()%100,t,2)}function S0e(e,t){return Yt(e.getFullYear()%1e4,t,4)}function k0e(e,t){var n=e.getDay();return e=n>=4||n===0?Nh(e):Nh.ceil(e),Yt(e.getFullYear()%1e4,t,4)}function N0e(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Yt(t/60|0,"0",2)+Yt(t%60,"0",2)}function CD(e,t){return Yt(e.getUTCDate(),t,2)}function j0e(e,t){return Yt(e.getUTCHours(),t,2)}function C0e(e,t){return Yt(e.getUTCHours()%12||12,t,2)}function T0e(e,t){return Yt(1+ab.count(nl(e),e),t,3)}function GF(e,t){return Yt(e.getUTCMilliseconds(),t,3)}function E0e(e,t){return GF(e,t)+"000"}function A0e(e,t){return Yt(e.getUTCMonth()+1,t,2)}function P0e(e,t){return Yt(e.getUTCMinutes(),t,2)}function _0e(e,t){return Yt(e.getUTCSeconds(),t,2)}function M0e(e){var t=e.getUTCDay();return t===0?7:t}function R0e(e,t){return Yt(lb.count(nl(e)-1,e),t,2)}function YF(e){var t=e.getUTCDay();return t>=4||t===0?jh(e):jh.ceil(e)}function O0e(e,t){return e=YF(e),Yt(jh.count(nl(e),e)+(nl(e).getUTCDay()===4),t,2)}function I0e(e){return e.getUTCDay()}function D0e(e,t){return Yt(_x.count(nl(e)-1,e),t,2)}function L0e(e,t){return Yt(e.getUTCFullYear()%100,t,2)}function U0e(e,t){return e=YF(e),Yt(e.getUTCFullYear()%100,t,2)}function B0e(e,t){return Yt(e.getUTCFullYear()%1e4,t,4)}function F0e(e,t){var n=e.getUTCDay();return e=n>=4||n===0?jh(e):jh.ceil(e),Yt(e.getUTCFullYear()%1e4,t,4)}function $0e(){return"+0000"}function TD(){return"%"}function ED(e){return+e}function AD(e){return Math.floor(+e/1e3)}var _d,QF,XF;V0e({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
718ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function V0e(e){return _d=Vge(e),QF=_d.format,_d.parse,XF=_d.utcFormat,_d.utcParse,_d}function z0e(e){return new Date(e)}function q0e(e){return e instanceof Date?+e:+new Date(+e)}function YT(e,t,n,i,r,s,l,c,h,d){var f=IT(),p=f.invert,v=f.domain,x=d(".%L"),b=d(":%S"),S=d("%I:%M"),N=d("%I %p"),j=d("%a %d"),T=d("%b %d"),E=d("%B"),C=d("%Y");function P(A){return(h(A)<A?x:c(A)<A?b:l(A)<A?S:s(A)<A?N:i(A)<A?r(A)<A?j:T:n(A)<A?E:C)(A)}return f.invert=function(A){return new Date(p(A))},f.domain=function(A){return arguments.length?v(Array.from(A,q0e)):v().map(z0e)},f.ticks=function(A){var M=v();return e(M[0],M[M.length-1],A??10)},f.tickFormat=function(A,M){return M==null?P:d(M)},f.nice=function(A){var M=v();return(!A||typeof A.range!="function")&&(A=t(M[0],M[M.length-1],A??10)),A?v(LF(M,A)):f},f.copy=function(){return Rp(f,YT(e,t,n,i,r,s,l,c,h,d))},f}function W0e(){return Qs.apply(YT(Fge,$ge,tl,KT,ob,Op,WT,zT,du,QF).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function H0e(){return Qs.apply(YT(Uge,Bge,nl,GT,lb,ab,HT,qT,du,XF).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function cb(){var e=0,t=1,n,i,r,s,l=Rr,c=!1,h;function d(p){return p==null||isNaN(p=+p)?h:l(r===0?.5:(p=(s(p)-n)*r,c?Math.max(0,Math.min(1,p)):p))}d.domain=function(p){return arguments.length?([e,t]=p,n=s(e=+e),i=s(t=+t),r=n===i?0:1/(i-n),d):[e,t]},d.clamp=function(p){return arguments.length?(c=!!p,d):c},d.interpolator=function(p){return arguments.length?(l=p,d):l};function f(p){return function(v){var x,b;return arguments.length?([x,b]=v,l=p(x,b),d):[l(0),l(1)]}}return d.range=f(Bh),d.rangeRound=f(OT),d.unknown=function(p){return arguments.length?(h=p,d):h},function(p){return s=p,n=p(e),i=p(t),r=n===i?0:1/(i-n),d}}function yc(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function JF(){var e=xc(cb()(Rr));return e.copy=function(){return yc(e,JF())},ol.apply(e,arguments)}function ZF(){var e=UT(cb()).domain([1,10]);return e.copy=function(){return yc(e,ZF()).base(e.base())},ol.apply(e,arguments)}function e$(){var e=BT(cb());return e.copy=function(){return yc(e,e$()).constant(e.constant())},ol.apply(e,arguments)}function QT(){var e=FT(cb());return e.copy=function(){return yc(e,QT()).exponent(e.exponent())},ol.apply(e,arguments)}function K0e(){return QT.apply(null,arguments).exponent(.5)}function t$(){var e=[],t=Rr;function n(i){if(i!=null&&!isNaN(i=+i))return t((_p(e,i,1)-1)/(e.length-1))}return n.domain=function(i){if(!arguments.length)return e.slice();e=[];for(let r of i)r!=null&&!isNaN(r=+r)&&e.push(r);return e.sort(oc),n},n.interpolator=function(i){return arguments.length?(t=i,n):t},n.range=function(){return e.map((i,r)=>t(r/(e.length-1)))},n.quantiles=function(i){return Array.from({length:i+1},(r,s)=>Mpe(e,s/i))},n.copy=function(){return t$(t).domain(e)},ol.apply(n,arguments)}function ub(){var e=0,t=.5,n=1,i=1,r,s,l,c,h,d=Rr,f,p=!1,v;function x(S){return isNaN(S=+S)?v:(S=.5+((S=+f(S))-s)*(i*S<i*s?c:h),d(p?Math.max(0,Math.min(1,S)):S))}x.domain=function(S){return arguments.length?([e,t,n]=S,r=f(e=+e),s=f(t=+t),l=f(n=+n),c=r===s?0:.5/(s-r),h=s===l?0:.5/(l-s),i=s<r?-1:1,x):[e,t,n]},x.clamp=function(S){return arguments.length?(p=!!S,x):p},x.interpolator=function(S){return arguments.length?(d=S,x):d};function b(S){return function(N){var j,T,E;return arguments.length?([j,T,E]=N,d=sge(S,[j,T,E]),x):[d(0),d(.5),d(1)]}}return x.range=b(Bh),x.rangeRound=b(OT),x.unknown=function(S){return arguments.length?(v=S,x):v},function(S){return f=S,r=S(e),s=S(t),l=S(n),c=r===s?0:.5/(s-r),h=s===l?0:.5/(l-s),i=s<r?-1:1,x}}function n$(){var e=xc(ub()(Rr));return e.copy=function(){return yc(e,n$())},ol.apply(e,arguments)}function i$(){var e=UT(ub()).domain([.1,1,10]);return e.copy=function(){return yc(e,i$()).base(e.base())},ol.apply(e,arguments)}function r$(){var e=BT(ub());return e.copy=function(){return yc(e,r$()).constant(e.constant())},ol.apply(e,arguments)}function XT(){var e=FT(ub());return e.copy=function(){return yc(e,XT()).exponent(e.exponent())},ol.apply(e,arguments)}function G0e(){return XT.apply(null,arguments).exponent(.5)}const s$=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:_T,scaleDiverging:n$,scaleDivergingLog:i$,scaleDivergingPow:XT,scaleDivergingSqrt:G0e,scaleDivergingSymlog:r$,scaleIdentity:DF,scaleImplicit:dj,scaleLinear:IF,scaleLog:UF,scaleOrdinal:PT,scalePoint:Ipe,scalePow:$T,scaleQuantile:$F,scaleQuantize:VF,scaleRadial:FF,scaleSequential:JF,scaleSequentialLog:ZF,scaleSequentialPow:QT,scaleSequentialQuantile:t$,scaleSequentialSqrt:K0e,scaleSequentialSymlog:e$,scaleSqrt:Ege,scaleSymlog:BF,scaleThreshold:zF,scaleTime:W0e,scaleUtc:H0e,tickFormat:OF},Symbol.toStringTag,{value:"Module"}));function Y0e(e){var t=s$;if(e in t&&typeof t[e]=="function")return t[e]();var n="scale".concat(ZC(e));if(n in t&&typeof t[n]=="function")return t[n]()}function PD(e,t,n){if(typeof e=="function")return e.copy().domain(t).range(n);if(e!=null){var i=Y0e(e);if(i!=null)return i.domain(t).range(n),i}}function JT(e,t,n,i){if(!(n==null||i==null))return typeof e.scale=="function"?PD(e.scale,n,i):PD(t,n,i)}function Q0e(e){return"scale".concat(ZC(e))}function X0e(e){return Q0e(e)in s$}
718var a$=(e,t,n)=>{if(e!=null){var i=e.scale,r=e.type;if(i==="auto")return r==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":r==="category"?"band":"linear";if(typeof i=="string")return X0e(i)?i:"point"}};function J0e(e,t){for(var n=0,i=e.length,r=e[0]<e[e.length-1];n<i;){var s=Math.floor((n+i)/2);(r?e[s]<t:e[s]>t)?n=s+1:i=s}return n}function o$(e,t){if(e){var n=t??e.domain(),i=n.map(s=>{var l;return(l=e(s))!==null&&l!==void 0?l:0}),r=e.range();if(!(n.length===0||r.length<2))return s=>{var l,c,h=J0e(i,s);if(h<=0)return n[0];if(h>=n.length)return n[n.length-1];var d=(l=i[h-1])!==null&&l!==void 0?l:0,f=(c=i[h])!==null&&c!==void 0?c:0;return Math.abs(s-d)<=Math.abs(s-f)?n[h-1]:n[h]}}}function Z0e(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):o$(e,void 0)}function _D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Mx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_D(Object(n),!0).forEach(function(i){eve(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_D(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function eve(e,t,n){return(t=tve(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tve(e){var t=nve(e,"string");return typeof t=="symbol"?t:t+""}function nve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function l$(e,t){return ave(e)||sve(e,t)||rve(e,t)||ive()}function ive(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
719In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rve(e,t){if(e){if(typeof e=="string")return MD(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?MD(e,t):void 0}}function MD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function sve(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function ave(e){if(Array.isArray(e))return e}var pj=[0,"auto"],Ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},c$=(e,t)=>e.cartesianAxis.xAxis[t],ll=(e,t)=>
719{var n=c$(e,t);return n??Ni},ji={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:pj,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:Cp},u$=(e,t)=>e.cartesianAxis.yAxis[t],cl=(e,t)=>{var n=u$(e,t);return n??ji},ove={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},ZT=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??ove},Lr=(e,t,n)=>{switch(t){case"xAxis":return ll(e,n);case"yAxis":return cl(e,n);case"zAxis":return ZT(e,n);case"angleAxis":return kT(e,n);case"radiusAxis":return NT(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},lve=(e,t,n)=>{switch(t){case"xAxis":return ll(e,n);case"yAxis":return cl(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Ip=(e,t,n)=>{switch(t){case"xAxis":return ll(e,n);case"yAxis":return cl(e,n);case"angleAxis":return kT(e,n);case"radiusAxis":return NT(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},d$=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function h$(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var f$=e=>e.graphicalItems.cartesianItems,cve=pe([Wi,nb],h$),m$=(e,t,n)=>e.filter(n).filter(i=>(t==null?void 0:t.includeHidden)===!0?!0:!i.hide),Fh=pe([f$,Lr,cve],m$,{memoizeOptions:{resultEqualityCheck:rb}}),p$=pe([Fh],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(TT)),g$=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),uve=pe([Fh],g$),v$=e=>e.map(t=>t.data).filter(Boolean).flat(1),dve=pe([Fh],e=>e.some(t=>!t.data)),x$=pe([Fh],v$,{memoizeOptions:{resultEqualityCheck:rb}}),y$=(e,t)=>{var n=t.chartData,i=n===void 0?[]:n,r=t.dataStartIndex,s=t.dataEndIndex;return e.length>0?e:i.slice(r,s+1)},e2=pe([x$,Xy],y$),hve=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(i=>({value:Vi(i,t.dataKey)})):n.length>0?n.map(i=>i.dataKey).flatMap(i=>e.map(r=>({value:Vi(r,i)}))):e.map(i=>({value:i})),b$=(e,t,n,i,r,s)=>{var l=i.chartData,c=l===void 0?[]:l,h=i.dataStartIndex,d=i.dataEndIndex,f=hve(e,t,n);if(r&&(t==null?void 0:t.dataKey)!=null&&s.length>0){var p=c.slice(h,d+1),v=p.map(x=>({value:Vi(x,t.dataKey)})).filter(x=>x.value!=null);return[...v,...f]}return f},Dp=pe([e2,Lr,Fh,Xy,dve,x$],b$);function ch(e){if(ao(e)||e instanceof Date){var t=Number(e);if(Mt(t))return t}}function RD(e){if(Array.isArray(e)){var t=[ch(e[0]),ch(e[1])];return to(t)?t:void 0}var n=ch(e);if(n!=null)return[n,n]}function co(e){return e.map(ch).filter(Jr)}function fve(e,t){var n=ch(e),i=ch(t);return n==null&&i==null?0:n==null?-1:i==null?1:n-i}var mve=pe([Dp],e=>e==null?void 0:e.map(t=>t.value).sort(fve));function w$(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function pve(e,t,n){if(!n)return[];if(!n.length)return[];var i;if(typeof t=="number"&&!so(t))i=t;else if(Array.isArray(t)){var r=co(t);r.length>0&&(i=Math.max(...r))}return i==null?[]:co(n.flatMap(s=>{var l=Vi(e,s.dataKey),c,h;if(Array.isArray(l)){var d=l$(l,2);c=d[0],h=d[1]}else c=h=l;if(!(!Mt(c)||!Mt(h)))return[i-c,i+h]}))}var Pi=e=>{var t=Hi(e),n=Uh(e);return Ip(e,t,n)},Ch=pe([Pi],e=>e==null?void 0:e.dataKey),gve=pe([p$,Xy,Pi],jF),S$=(e,t,n,i)=>{var r={},s=t.reduce((l,c)=>{if(c.stackId==null)return l;var h=l[c.stackId];return h==null&&(h=[]),h.push(c),l[c.stackId]=h,l},r);return Object.fromEntries(Object.entries(s).map(l=>{var c=l$(l,2),h=c[0],d=c[1],f=i?[...d].reverse():d,p=f.map(CT);return[h,{stackedData:Ide(e,p,n),graphicalItems:f}]}))},k$=pe([gve,p$,Jy,xF],S$),N$=(e,t,n,i)=>{var r=t.dataStartIndex,s=t.dataEndIndex;if(i==null&&n!=="zAxis")return Bde(e,r,s)},vve=pe([Lr],e=>e.allowDataOverflow),t2=e=>{var t;if(e==null||!("domain"in e))return pj;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=co(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:pj},j$=pe([Lr],t2),C$=pe([j$,vve],oF),xve=pe([k$,Ea,Wi,C$],N$,{memoizeOptions:{resultEqualityCheck:ib}}),n2=e=>
719e.errorBars,yve=(e,t,n)=>e.flatMap(i=>t[i.id]).filter(Boolean).filter(i=>w$(n,i)),Rx=function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=n.filter(Boolean);if(r.length!==0){var s=r.flat(),l=Math.min(...s),c=Math.max(...s);return[l,c]}},T$=function(t,n,i,r,s){var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],c,h;if(i.length>0&&i.forEach(d=>{var f,p=d.data!=null?[...d.data]:l,v=(f=r[d.id])===null||f===void 0?void 0:f.filter(x=>w$(s,x));p.forEach(x=>{var b,S=Vi(x,(b=n.dataKey)!==null&&b!==void 0?b:d.dataKey),N=pve(x,S,v);if(N.length>=2){var j=Math.min(...N),T=Math.max(...N);(c==null||j<c)&&(c=j),(h==null||T>h)&&(h=T)}var E=RD(S);E!=null&&(c=c==null?E[0]:Math.min(c,E[0]),h=h==null?E[1]:Math.max(h,E[1]))})}),(n==null?void 0:n.dataKey)!=null&&i.length===0&&t.forEach(d=>{var f=RD(Vi(d,n.dataKey));f!=null&&(c=c==null?f[0]:Math.min(c,f[0]),h=h==null?f[1]:Math.max(h,f[1]))}),Mt(c)&&Mt(h))return[c,h]},bve=pe([e2,Lr,uve,n2,Wi,Qme],T$,{memoizeOptions:{resultEqualityCheck:ib}});function wve(e){var t=e.value;if(ao(t)||t instanceof Date)return t}var Sve=(e,t,n)=>{var i=e.map(wve).filter(r=>r!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&U8(i))?aF(0,e.length):t.allowDuplicatedCategory?i:Array.from(new Set(i))},E$=e=>e.referenceElements.dots,$h=(e,t,n)=>e.filter(i=>i.ifOverflow==="extendDomain").filter(i=>t==="xAxis"?i.xAxisId===n:i.yAxisId===n),kve=pe([E$,Wi,nb],$h),A$=e=>e.referenceElements.areas,Nve=pe([A$,Wi,nb],$h),P$=e=>e.referenceElements.lines,jve=pe([P$,Wi,nb],$h),_$=(e,t)=>{if(e!=null){var n=co(e.map(i=>t==="xAxis"?i.x:i.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Cve=pe(kve,Wi,_$),M$=(e,t)=>{if(e!=null){var n=co(e.flatMap(i=>[t==="xAxis"?i.x1:i.y1,t==="xAxis"?i.x2:i.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Tve=pe([Nve,Wi],M$);function Eve(e){var t;if(e.x!=null)return co([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(i=>i.x);return n==null||n.length===0?[]:co(n)}function Ave(e){var t;if(e.y!=null)return co([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(i=>i.y);return n==null||n.length===0?[]:co(n)}var R$=(e,t)=>{if(e!=null){var n=e.flatMap(i=>t==="xAxis"?Eve(i):Ave(i));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Pve=pe([jve,Wi],R$),_ve=pe(Cve,Pve,Tve,(e,t,n)=>Rx(e,n,t)),O$=(e,t,n,i,r,s,l,c)=>{if(n!=null)return n;var h=l==="vertical"&&c==="xAxis"||l==="horizontal"&&c==="yAxis",d=h?Rx(i,s,r):Rx(s,r);return npe(t,d,e.allowDataOverflow)},Mve=pe([Lr,j$,C$,xve,bve,_ve,Fn,Wi],O$,{memoizeOptions:{resultEqualityCheck:ib}}),Rve=[0,1],I$=(e,t,n,i,r,s,l)=>{if(!((e==null||n==null||n.length===0)&&l===void 0)){var c=e.dataKey,h=e.type,d=uo(t,s);if(d&&c==null){var f;return aF(0,(f=n==null?void 0:n.length)!==null&&f!==void 0?f:0)}
719return h==="category"?Sve(i,e,d):r==="expand"&&!d?Rve:l}},i2=pe([Lr,Fn,e2,Dp,Jy,Wi,Mve],I$),Vh=pe([Lr,d$,bT],a$),D$=(e,t,n)=>{var i=t.niceTicks;if(i!=="none"){var r=t2(t),s=Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto");if((i==="snap125"||i==="adaptive")&&t!=null&&t.tickCount&&to(e)){if(s)return VI(e,t.tickCount,t.allowDecimals,i);if(t.type==="number")return zI(e,t.tickCount,t.allowDecimals,i)}if(i==="auto"&&n==="linear"&&t!=null&&t.tickCount){if(s&&to(e))return VI(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&to(e))return zI(e,t.tickCount,t.allowDecimals,"adaptive")}}},r2=pe([i2,Ip,Vh],D$),L$=(e,t,n,i)=>{if(i!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&to(t)&&Array.isArray(n)&&n.length>0){var r,s,l=t[0],c=(r=n[0])!==null&&r!==void 0?r:0,h=t[1],d=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(l,c),Math.max(h,d)]}return t},Ove=pe([Lr,i2,r2,Wi],L$),Ive=pe(Dp,Lr,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,i=Array.from(co(e.map(p=>p.value))).sort((p,v)=>p-v),r=i[0],s=i[i.length-1];if(r==null||s==null)return 1/0;var l=s-r;if(l===0)return 1/0;for(var c=0;c<i.length-1;c++){var h=i[c],d=i[c+1];if(!(h==null||d==null)){var f=d-h;n=Math.min(n,f)}}return n/l}}),U$=pe(Ive,Fn,dpe,hr,(e,t,n,i,r)=>r,(e,t,n,i,r)=>{if(!Mt(e))return 0;var s=t==="vertical"?i.height:i.width;if(r==="gap")return e*s/2;if(r==="no-gap"){var l=pc(n,e*s),c=e*s/2;return c-l-(c-l)/s*l}return 0}
719),Dve=(e,t,n)=>{var i=ll(e,t);return i==null||typeof i.padding!="string"?0:U$(e,"xAxis",t,n,i.padding)},Lve=(e,t,n)=>{var i=cl(e,t);return i==null||typeof i.padding!="string"?0:U$(e,"yAxis",t,n,i.padding)},Uve=pe(ll,Dve,(e,t)=>{var n,i;if(e==null)return{left:0,right:0};var r=e.padding;return typeof r=="string"?{left:t,right:t}:{left:((n=r.left)!==null&&n!==void 0?n:0)+t,right:((i=r.right)!==null&&i!==void 0?i:0)+t}}),Bve=pe(cl,Lve,(e,t)=>{var n,i;if(e==null)return{top:0,bottom:0};var r=e.padding;return typeof r=="string"?{top:t,bottom:t}:{top:((n=r.top)!==null&&n!==void 0?n:0)+t,bottom:((i=r.bottom)!==null&&i!==void 0?i:0)+t}}),B$=pe([hr,Uve,Wy,qy,(e,t,n)=>n],(e,t,n,i,r)=>{var s=i.padding;return r?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),F$=pe([hr,Fn,Bve,Wy,qy,(e,t,n)=>n],(e,t,n,i,r,s)=>{var l=r.padding;return s?[i.height-l.bottom,l.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Lp=(e,t,n,i)=>{var r;switch(t){case"xAxis":return B$(e,n,i);case"yAxis":return F$(e,n,i);case"zAxis":return(r=ZT(e,n))===null||r===void 0?void 0:r.range;case"angleAxis":return SF(e);case"radiusAxis":return kF(e,n);default:return}},$$=pe([Lr,Lp],Zy),Fve=pe([Vh,Ove],bpe),s2=pe([Lr,Vh,Fve,$$],JT),V$=(e,t,n,i)=>{if(!(n==null||n.dataKey==null)){var r=n.type,s=n.scale,l=uo(e,i);if(l&&(r==="number"||s!=="auto"))return t.map(c=>c.value)}},a2=pe([Fn,Dp,Ip,Wi],V$),db=pe([s2],ET);pe([s2],Z0e);pe([s2,mve],o$);pe([Fh,n2,Wi],yve);function z$(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var hb=(e,t)=>t,fb=(e,t,n)=>n,$ve=pe(Vy,hb,fb,(e,t,n)=>e.filter(i=>i.orientation===t).filter(i=>i.mirror===n).sort(z$)),Vve=pe(zy,hb,fb,(e,t,n)=>e.filter(i=>i.orientation===t).filter(i=>i.mirror===n).sort(z$)),q$=(e,t)=>({width:e.width,height:t.height}),zve=(e,t)=>{var n=typeof t.width=="number"?t.width:Cp;return{width:n,height:e.height}},qve=pe(hr,ll,q$),Wve=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},Hve=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},Kve=pe(al,hr,$ve,hb,fb,(e,t,n,i,r)=>{var s={},l;return n.forEach(c=>{var h=q$(t,c);l==null&&(l=Wve(t,i,e));var d=i==="top"&&!r||i==="bottom"&&r;s[c.id]=l-Number(d)*h.height,l+=(d?-1:1)*h.height}),s}),Gve=pe(sl,hr,Vve,hb,fb,(e,t,n,i,r)=>{var s={},l;return n.forEach(c=>{var h=zve(t,c);l==null&&(l=Hve(t,i,e));var d=i==="left"&&!r||i==="right"&&r;s[c.id]=l-Number(d)*h.width,l+=(d?-1:1)*h.width}),s}),Yve=(e,t)=>
719{var n=ll(e,t);if(n!=null)return Kve(e,n.orientation,n.mirror)},Qve=pe([hr,ll,Yve,(e,t)=>t],(e,t,n,i)=>{if(t!=null){var r=n==null?void 0:n[i];return r==null?{x:e.left,y:0}:{x:e.left,y:r}}}),Xve=(e,t)=>{var n=cl(e,t);if(n!=null)return Gve(e,n.orientation,n.mirror)},Jve=pe([hr,cl,Xve,(e,t)=>t],(e,t,n,i)=>{if(t!=null){var r=n==null?void 0:n[i];return r==null?{x:0,y:e.top}:{x:r,y:e.top}}}),Zve=pe(hr,cl,(e,t)=>{var n=typeof t.width=="number"?t.width:Cp;return{width:n,height:e.height}}),W$=(e,t,n,i)=>{if(n!=null){var r=n.allowDuplicatedCategory,s=n.type,l=n.dataKey,c=uo(e,i),h=t.map(f=>f.value),d=h.filter(f=>f!=null);if(l&&c&&s==="category"&&r&&U8(d))return h}},o2=pe([Fn,Dp,Lr,Wi],W$),OD=pe([Fn,lve,Vh,db,o2,a2,Lp,r2,Wi],(e,t,n,i,r,s,l,c,h)=>{if(t!=null){var d=uo(e,h);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:h,categoricalDomain:s,duplicateDomain:r,isCategorical:d,niceTicks:c,range:l,realScaleType:n,scale:i}}}),exe=(e,t,n,i,r,s,l,c,h)=>{if(!(t==null||i==null)){var d=uo(e,h),f=t.type,p=t.ticks,v=t.tickCount,x=n==="scaleBand"&&typeof i.bandwidth=="function"?i.bandwidth()/2:2,b=f==="category"&&i.bandwidth?i.bandwidth()/x:0;b=h==="angleAxis"&&s!=null&&s.length>=2?Fs(s[0]-s[1])*2*b:b;var S=p||r;return S?S.map((N,j)=>{var T=l?l.indexOf(N):N,E=i.map(T);return Mt(E)?{index:j,coordinate:E+b,value:N,offset:b}:null}).filter(Jr):d&&c?c.map((N,j)=>{var T=i.map(N);return Mt(T)?{coordinate:T+b,value:N,index:j,offset:b}:null}).filter(Jr):i.ticks?i.ticks(v).map((N,j)=>{var T=i.map(N);return Mt(T)?{coordinate:T+b,value:N,index:j,offset:b}:null}).filter(Jr):i.domain().map((N,j)=>{var T=i.map(N);return Mt(T)?{coordinate:T+b,value:l?l[N]:N,index:j,offset:b}:null}).filter(Jr)}},H$=pe([Fn,Ip,Vh,db,r2,Lp,o2,a2,Wi],exe),txe=(e,t,n,i,r,s,l)=>{if(!(t==null||n==null||i==null||i[0]===i[1])){var c=uo(e,l),h=t.tickCount,d=0;return d=l==="angleAxis"&&(i==null?void 0:i.length)>=2?Fs(i[0]-i[1])*2*d:d,c&&s?s.map((f,p)=>{var v=n.map(f);return Mt(v)?{coordinate:v+d,value:f,index:p,offset:d}:null}).filter(Jr):n.ticks?n.ticks(h).map((f,p)=>{var v=n.map(f);return Mt(v)?{coordinate:v+d,value:f,index:p,offset:d}:null}).filter(Jr):n.domain().map((f,p)=>{var v=n.map(f);return Mt(v)?{coordinate:v+d,value:r?r[f]:f,index:p,offset:d}:null}).filter(Jr)}},K$=pe([Fn,Ip,db,Lp,o2,a2,Wi],txe),G$=pe(Lr,db,(e,t)=>{if(!(e==null||t==null))return Mx(Mx({},e),{},{scale:t})}),nxe=pe([Lr,Vh,i2,$$],JT),ixe=pe([nxe],ET);pe((e,t,n)=>ZT(e,n),ixe,(e,t)=>{if(!(e==null||t==null))return Mx(Mx({},e),{},{scale:t})});var rxe=pe([Fn,Vy,zy],(e,t,n)=>{switch(e){case"horizontal":return t.some(i=>i.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(i=>i.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),sxe=(e,t,n)=>{var i;return(i=e.renderedTicks[t])===null||i===void 0?void 0:i[n]};pe([sxe],e=>{if(!(!e||e.length===0))return t=>{var n,i=1/0,r=e[0];for(var s of e){var l=Math.abs(s.coordinate-t);l<i&&(i=l,r=s)}return(n=r)===null||n===void 0?void 0:n.value}});var Y$=e=>e.options.defaultTooltipEventType,Q$=e=>e.options.validateTooltipEventTypes;function X$(e,t,n){if(e==null)return t;var i=e?"axis":"item";return n==null?t:n.includes(i)?i:t}function Up(e,t){var n=Y$(e),i=Q$(e);return X$(t,n,i)}function axe(e){return st(t=>Up(t,e))}var J$=(e,t)=>{var n,i=Number(t);if(!(so(i)||t==null))return i>=0?e==null||(n=e[i])===null||n===void 0?void 0:n.value:void 0},oxe=e=>e.tooltip.settings,Ql={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},lxe={itemInteraction:{click:Ql,hover:Ql},axisInteraction:{click:Ql,hover:Ql},keyboardInteraction:Ql,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},Z$=Sr({name:"tooltip",initialState:lxe,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:_n()},replaceTooltipEntrySettings:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next,
719s=$s(e).tooltipItemPayloads.indexOf(i);s>-1&&(e.tooltipItemPayloads[s]=r)},prepare:_n()},removeTooltipEntrySettings:{reducer(e,t){var n=$s(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:_n()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),Xs=Z$.actions,cxe=Xs.addTooltipEntrySettings,uxe=Xs.replaceTooltipEntrySettings,dxe=Xs.removeTooltipEntrySettings,hxe=Xs.setTooltipSettingsState,fxe=Xs.setActiveMouseOverItemIndex;Xs.mouseLeaveItem;var eV=Xs.mouseLeaveChart;Xs.setActiveClickItemIndex;var tV=Xs.setMouseOverAxisIndex,mxe=Xs.setMouseClickAxisIndex,hm=Xs.setSyncInteraction,Ox=Xs.setKeyboardInteraction,pxe=Z$.reducer;function ID(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function C0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ID(Object(n),!0).forEach(function(i){gxe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ID(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function gxe(e,t,n){return(t=vxe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vxe(e){var t=xxe(e,"string");return typeof t=="symbol"?t:t+""}function xxe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yxe(e,t,n){return t==="axis"?n==="click"?e.axisInteraction.click:e.axisInteraction.hover:n==="click"?e.itemInteraction.click:e.itemInteraction.hover}function bxe(e){return e.index!=null}var nV=(e,t,n,i)=>{if(t==null)return Ql;var r=yxe(e,t,n);if(r==null)return Ql;if(r.active)return r;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(bxe(r)){if(s)return C0(C0({},r),{},{active:!0})}else if(i!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:i,graphicalItemId:void 0};return C0(C0({},Ql),{},{coordinate:r.coordinate})};function wxe(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function Sxe(e,t){var n=wxe(e),i=t[0],r=t[1];if(n===void 0)return!1;var s=Math.min(i,r),l=Math.max(i,r);return n>=s&&n<=l}function kxe(e,t,n){if(n==null||t==null)return!0;var i=Vi(e,t);return i==null||!to(n)?!0:Sxe(i,n)}var Pm=(e,t,n,i)=>{var r=e==null?void 0:e.index;if(r==null)return null;var s=Number(r);
719if(!Mt(s))return r;var l=0,c=1/0;t.length>0&&(c=t.length-1);var h=Math.max(l,Math.min(s,c)),d=t[h];return d==null||kxe(d,n,i)?String(h):null},iV=(e,t,n,i,r,s,l)=>{if(s!=null){var c=l[0],h=c==null?void 0:c.getPosition(s);if(h!=null)return h;var d=r==null?void 0:r[Number(s)];if(d)switch(n){case"horizontal":return{x:d.coordinate,y:(i.top+t)/2};default:return{x:(i.left+e)/2,y:d.coordinate}}}},rV=(e,t,n,i)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var r;if(n==="hover"?r=e.itemInteraction.hover.graphicalItemId:r=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&r==null)return e.tooltipItemPayloads;if(r==null&&(i!=null||e.keyboardInteraction.active)){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(l=>{var c;return((c=l.settings)===null||c===void 0?void 0:c.graphicalItemId)===r})},sV=e=>e.options.tooltipPayloadSearcher,zh=e=>e.tooltip;function DD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function LD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DD(Object(n),!0).forEach(function(i){Nxe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Nxe(e,t,n){return(t=jxe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jxe(e){var t=Cxe(e,"string");return typeof t=="symbol"?t:t+""}function Cxe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Txe(e){if(typeof e=="string"||typeof e=="number")return e}function Exe(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}function Axe(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e=="function")return t=>e(t)}function UD(e){if(typeof e=="string")return e}function Pxe(e){if(!(e==null||typeof e!="object")){var t="name"in e?Txe(e.name):void 0,n="unit"in e?Exe(e.unit):void 0,i="dataKey"in e?Axe(e.dataKey):void 0,r="payload"in e?e.payload:void 0,s="color"in e?UD(e.color):void 0,l="fill"in e?UD(e.fill):void 0;return{name:t,unit:n,dataKey:i,payload:r,color:s,fill:l}}}function _xe(e,t){return e??t}var aV=(e,t,n,i,r,s,l)=>{if(!(t==null||s==null)){var c=n.chartData,h=n.computedData,d=n.dataStartIndex,f=n.dataEndIndex,p=[];return e.reduce((v,x)=>{var b,S=x.dataDefinedOnItem,N=x.settings,j=_xe(S,c),T=Array.isArray(j)?_9(j,d,f):j,E=(b=N==null?void 0:N.dataKey)!==null&&b!==void 0?b:i,C=N==null?void 0:N.nameKey,P;if(i&&Array.isArray(T)&&!Array.isArray(T[0])&&l==="axis"?P=B8(T,i,r):P=s(T,t,h,C),Array.isArray(P))P.forEach(M=>{var R,B,U=Pxe(M),O=U==null?void 0:U.name,F=U==null?void 0:U.dataKey,ne=U==null?void 0:U.payload,re=LD(LD({},N),{},{name:O,unit:U==null?void 0:U.unit,color:(R=U==null?void 0:U.color)!==null&&R!==void 0?R:N==null?void 0:N.color,fill:(B=U==null?void 0:U.fill)!==null&&B!==void 0?B:N==null?void 0:N.fill});v.push(MO({tooltipEntrySettings:re,dataKey:F,payload:ne,value:Vi(ne,F),name:O==null?void 0:String(O)}))});else{var A;v.push(MO({tooltipEntrySettings:N,dataKey:E,payload:P,value:Vi(P,E),name:(A=Vi(P,C))!==null&&A!==void 0?A:N==null?void 0:N.name}))}return v},p)}},l2=pe([Pi,d$,bT],a$),Mxe=pe([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Rxe=pe([Hi,Uh],h$),zu=pe([Mxe,Pi,Rxe],m$,{memoizeOptions:{resultEqualityCheck:rb}}),Oxe=pe([zu],e=>e.filter(TT)),oV=pe([zu],v$,{memoizeOptions:{resultEqualityCheck:rb}}),Ixe=pe([zu],e=>e.some(t=>!t.data)),Du=pe([oV,Ea],y$),Dxe=pe([Oxe,Ea,Pi],jF),c2=pe([Du,Pi,zu,Ea,Ixe,oV],b$),lV=pe([Pi],t2),Lxe=pe([Pi],e=>e.allowDataOverflow),cV=pe([lV,Lxe],oF),Uxe=pe([zu],e=>e.filter(TT)),Bxe=pe([Dxe,Uxe,Jy,xF],S$),Fxe=pe([Bxe,Ea,Hi,cV],N$),$xe
719=pe([zu],g$),Vxe=pe([Du,Pi,$xe,n2,Hi,Xme],T$,{memoizeOptions:{resultEqualityCheck:ib}}),zxe=pe([E$,Hi,Uh],$h),qxe=pe([zxe,Hi],_$),Wxe=pe([A$,Hi,Uh],$h),Hxe=pe([Wxe,Hi],M$),Kxe=pe([P$,Hi,Uh],$h),Gxe=pe([Kxe,Hi],R$),Yxe=pe([qxe,Gxe,Hxe],Rx),Qxe=pe([Pi,lV,cV,Fxe,Vxe,Yxe,Fn,Hi],O$),Th=pe([Pi,Fn,Du,c2,Jy,Hi,Qxe],I$),Xxe=pe([Th,Pi,l2],D$),Jxe=pe([Pi,Th,Xxe,Hi],L$),uV=e=>{var t=Hi(e),n=Uh(e),i=!1;return Lp(e,t,n,i)},dV=pe([Pi,uV],Zy),Zxe=pe([Pi,l2,Jxe,dV],JT),hV=pe([Zxe],ET),eye=pe([Fn,c2,Pi,Hi],W$),tye=pe([Fn,c2,Pi,Hi],V$),nye=(e,t,n,i,r,s,l,c)=>{if(t){var h=t.type,d=uo(e,c);if(i){var f=n==="scaleBand"&&i.bandwidth?i.bandwidth()/2:2,p=h==="category"&&i.bandwidth?i.bandwidth()/f:0;return p=c==="angleAxis"&&r!=null&&(r==null?void 0:r.length)>=2?Fs(r[0]-r[1])*2*p:p,d&&l?l.map((v,x)=>{var b=i.map(v);return Mt(b)?{coordinate:b+p,value:v,index:x,offset:p}:null}).filter(Jr):i.domain().map((v,x)=>{var b=i.map(v);return Mt(b)?{coordinate:b+p,value:s?s[v]:v,index:x,offset:p}:null}).filter(Jr)}}},ul=pe([Fn,Pi,l2,hV,uV,eye,tye,Hi],nye),u2=pe([Y$,Q$,oxe],(e,t,n)=>X$(n.shared,e,t)),fV=e=>e.tooltip.settings.trigger,d2=e=>e.tooltip.settings.defaultIndex,Bp=pe([zh,u2,fV,d2],nV),fp=pe([Bp,Du,Ch,Th],Pm),mV=pe([ul,fp],J$),iye=pe([Bp],e=>{if(e)return e.dataKey}),rye=pe([Bp],e=>{if(e)return e.graphicalItemId}),pV=pe([zh,u2,fV,d2],rV),sye=pe([sl,al,Fn,hr,ul,d2,pV],iV),aye=pe([Bp,sye],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),oye=pe([Bp],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),lye=pe([pV,fp,Ea,Ch,mV,sV,u2],aV),cye=pe([lye],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function BD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function FD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BD(Object(n),!0).forEach(function(i){uye(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function uye(e,t,n){return(t=dye(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dye(e){var t=hye(e,"string");return typeof t=="symbol"?t:t+""}function hye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fye=()=>st(Pi),mye=()=>{var e=fye(),t=st(ul),n=st(hV);return ux(!e||!n?void 0:FD(FD({},e),{},{scale:n}),t)};function $D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Md(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$D(Object(n),!0).forEach(function(i){pye(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$D(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function pye(e,t,n){return(t=gye(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gye(e){var t=vye(e,"string");return typeof t=="symbol"?t:t+""}function vye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xye=(e,t,n,i)=>{var r=t.find(s=>s&&s.index===n);if(r){if(e==="horizontal")return{x:r.coordinate,y:i.relativeY};if(e==="vertical")return{x:i.relativeX,y:r.coordinate}}return{x:0,y:0}},yye=(e,t,n,i)=>{var r=t.find(d=>d&&d.index===n);if(r){if(e==="centric"){var s=r.coordinate,l=i.radius;return Md(Md(Md({},i),lr(i.cx,i.cy,l,s)),{},{angle:s,radius:l})}var c=r.coordinate,h=i.angle;return Md(Md(Md({},i),lr(i.cx,i.cy,c,h)),{},{angle:h,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function bye(e,t){var n=e.relativeX,i=e.relativeY;return n>=t.left&&n<=t.left+t.width&&i>=t.top&&i<=t.top+t.height}var gV=(e,t,n,i,r)=>{var s,l=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(l<=1||e==null)return 0;if(i==="angleAxis"&&r!=null&&Math.abs(Math.abs(r[1]-r[0])-360)<=1e-6)for(var c=0;c<l;c++){var h,d,f,p,v,x=c>0?(h=n[c-1])===null||h===void 0?void 0:h.coordinate:(d=n[l-1])===null||d===void 0?void 0:d.coordinate,b=(f=n[c])===null||f===void 0?void 0:f.coordinate,S=c>=l-1?(p=n[0])===null||p===void 0?void 0:p.coordinate:(v=n[c+1])===null||v===void 0?void 0:v.coordinate,N=void 0;if(!(x==null||b==null||S==null))if(Fs(b-x)!==Fs(S-b)){var j=[];
719if(Fs(S-b)===Fs(r[1]-r[0])){N=S;var T=b+r[1]-r[0];j[0]=Math.min(T,(T+x)/2),j[1]=Math.max(T,(T+x)/2)}else{N=x;var E=S+r[1]-r[0];j[0]=Math.min(b,(E+b)/2),j[1]=Math.max(b,(E+b)/2)}var C=[Math.min(b,(N+b)/2),Math.max(b,(N+b)/2)];if(e>C[0]&&e<=C[1]||e>=j[0]&&e<=j[1]){var P;return(P=n[c])===null||P===void 0?void 0:P.index}}else{var A=Math.min(x,S),M=Math.max(x,S);if(e>(A+b)/2&&e<=(M+b)/2){var R;return(R=n[c])===null||R===void 0?void 0:R.index}}}else if(t)for(var B=0;B<l;B++){var U=t[B];if(U!=null){var O=t[B+1],F=t[B-1];if(B===0&&O!=null&&e<=(U.coordinate+O.coordinate)/2||B===l-1&&F!=null&&e>(U.coordinate+F.coordinate)/2||B>0&&B<l-1&&F!=null&&O!=null&&e>(U.coordinate+F.coordinate)/2&&e<=(U.coordinate+O.coordinate)/2)return U.index}}return-1},vV=()=>st(bT),h2=(e,t)=>t,xV=(e,t,n)=>n,f2=(e,t,n,i)=>i,wye=pe(ul,e=>_y(e,t=>t.coordinate)),m2=pe([zh,h2,xV,f2],nV),p2=pe([m2,Du,Ch,Th],Pm),Sye=(e,t,n)=>{if(t!=null){var i=zh(e);return t==="axis"?n==="hover"?i.axisInteraction.hover.dataKey:i.axisInteraction.click.dataKey:n==="hover"?i.itemInteraction.hover.dataKey:i.itemInteraction.click.dataKey}},yV=pe([zh,h2,xV,f2],rV),Ix=pe([sl,al,Fn,hr,ul,f2,yV],iV),kye=pe([m2,Ix],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),bV=pe([ul,p2],J$),Nye=pe([yV,p2,Ea,Ch,bV,sV,h2],aV),jye=pe([m2,p2],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),Cye=(e,t,n,i,r,s,l)=>{if(!(!e||!n||!i||!r)&&bye(e,l)){var c=Fde(e,t),h=gV(c,s,r,n,i),d=xye(t,r,h,e);return{activeIndex:String(h),activeCoordinate:d}}},Tye=(e,t,n,i,r,s,l)=>{if(!(!e||!i||!r||!s||!n)){var c=Vme(e,n);if(c){var h=$de(c,t),d=gV(h,l,s,i,r),f=yye(t,s,d,c);return{activeIndex:String(d),activeCoordinate:f}}}},Eye=(e,t,n,i,r,s,l,c)=>{if(!(!e||!t||!i||!r||!s))return t==="horizontal"||t==="vertical"?Cye(e,t,i,r,s,l,c):Tye(e,t,n,i,r,s,l)},Aye=pe(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var i=e[t];if(i!=null)return n?i.panoramaElement:i.element}}),Pye=pe(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(i=>parseInt(i,10)).concat(Object.values(Mr)),n=Array.from(new Set(t));return n.sort((i,r)=>i-r)},{memoizeOptions:{resultEqualityCheck:ype}});function VD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function zD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VD(Object(n),!0).forEach(function(i){_ye(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function _ye(e,t,n){return(t=Mye(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mye(e){var t=Rye(e,"string");return typeof t=="symbol"?t:t+""}function Rye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Oye={},Iye={zIndexMap:Object.values(Mr).reduce((e,t)=>zD(zD({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),Oye)},Dye=new Set(Object.values(Mr));function Lye(e){return Dye.has(e)}var wV=Sr({name:"zIndex",initialState:Iye,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:_n()},unregisterZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Lye(n)&&delete e.zIndexMap[n])},prepare:_n()},registerZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload,i=n.zIndex,r=n.element,s=n.isPanorama;e.zIndexMap[i]?s?e.zIndexMap[i].panoramaElement=r:e.zIndexMap[i].element=r:e.zIndexMap[i]={consumers:0,element:s?void 0:r,panoramaElement:s?r:void 0}},prepare:_n()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:_n()}}}),mb=wV.actions,Uye=mb.registerZIndexPortal,tk=mb.unregisterZIndexPortal,Bye=mb.registerZIndexPortalElement,Fye=mb.unregisterZIndexPortalElement,$ye=wV.reducer;function dl(e){var t=e.zIndex,n=e.children,i=Nhe(),r=i&&t!==void 0&&t!==0,s=ns(),l=w.useRef(void 0),c=w.useRef(new Set),h=wi(),d=st(p=>Aye(p,t,s));if(w.useLayoutEffect(()=>{if(!r){var p=c.current;p.forEach(x=>{h(tk({zIndex:x}))}),p.clear(),l.current=void 0;return}if(c.current.has(t)||(h(Uye({zIndex:t})),c.current.add(t)),d){l.current=d;var v=c.current;v.forEach(x=>{x!==t&&(h(tk({zIndex:x})),v.delete(x))})}},[h,t,r,d]),w.useLayoutEffect(()=>{var p=c.current;return()=>{p.forEach(v=>{h(tk({zIndex:v}))}),p.clear()}},[h]),!r)return n;var f=d??l.current;return f?Dj.createPortal(n,f):null}function gj(){return gj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},gj.apply(null,arguments)}function qD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function T0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
719t%2?qD(Object(n),!0).forEach(function(i){Vye(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Vye(e,t,n){return(t=zye(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zye(e){var t=qye(e,"string");return typeof t=="symbol"?t:t+""}function qye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wye(e){var t=e.cursor,n=e.cursorComp,i=e.cursorProps;return w.isValidElement(t)?w.cloneElement(t,i):w.createElement(n,i)}function Hye(e){var t,n=e.coordinate,i=e.payload,r=e.index,s=e.offset,l=e.tooltipAxisBandSize,c=e.layout,h=e.cursor,d=e.tooltipEventType,f=e.chartName,p=n,v=i,x=r;if(!h||!p||f!=="ScatterChart"&&d!=="axis")return null;var b,S,N;if(f==="ScatterChart")b=p,S=Qfe,N=Mr.cursorLine;else if(f==="BarChart")b=Xfe(c,p,s,l),S=Mme,N=Mr.cursorRectangle;else if(c==="radial"&&F8(p)){var j=rF(p),T=j.cx,E=j.cy,C=j.radius,P=j.startAngle,A=j.endAngle;b={cx:T,cy:E,startAngle:P,endAngle:A,innerRadius:C,outerRadius:C},S=Hme,N=Mr.cursorLine}else b={points:Kme(c,p,s)},S=uv,N=Mr.cursorLine;var M=typeof h=="object"&&"className"in h?h.className:void 0,R=T0(T0(T0(T0({stroke:"#ccc",pointerEvents:"none"},s),b),Ey(h)),{},{payload:v,payloadIndex:x,className:Rn("recharts-tooltip-cursor",M)});return w.createElement(dl,{zIndex:(t=e.zIndex)!==null&&t!==void 0?t:N},w.createElement(Wye,{cursor:h,cursorComp:S,cursorProps:R}))}function Kye(e){var t=mye(),n=F9(),i=Ih(),r=vV();return t==null||n==null||i==null||r==null?null:w.createElement(Hye,gj({}
719,e,{offset:n,layout:i,tooltipAxisBandSize:t,chartName:r}))}var SV=w.createContext(null),Gye=()=>w.useContext(SV),nk={exports:{}},WD;function Yye(){return WD||(WD=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function r(h,d,f){this.fn=h,this.context=d,this.once=f||!1}function s(h,d,f,p,v){if(typeof f!="function")throw new TypeError("The listener must be a function");var x=new r(f,p||h,v),b=n?n+d:d;return h._events[b]?h._events[b].fn?h._events[b]=[h._events[b],x]:h._events[b].push(x):(h._events[b]=x,h._eventsCount++),h}function l(h,d){--h._eventsCount===0?h._events=new i:delete h._events[d]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)t.call(f,p)&&d.push(n?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},c.prototype.listeners=function(d){var f=n?n+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var v=0,x=p.length,b=new Array(x);v<x;v++)b[v]=p[v].fn;return b},c.prototype.listenerCount=function(d){var f=n?n+d:d,p=this._events[f];return p?p.fn?1:p.length:0},c.prototype.emit=function(d,f,p,v,x,b){var S=n?n+d:d;if(!this._events[S])return!1;var N=this._events[S],j=arguments.length,T,E;if(N.fn){switch(N.once&&this.removeListener(d,N.fn,void 0,!0),j){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,f),!0;case 3:return N.fn.call(N.context,f,p),!0;case 4:return N.fn.call(N.context,f,p,v),!0;case 5:return N.fn.call(N.context,f,p,v,x),!0;case 6:return N.fn.call(N.context,f,p,v,x,b),!0}for(E=1,T=new Array(j-1);E<j;E++)T[E-1]=arguments[E];N.fn.apply(N.context,T)}else{var C=N.length,P;for(E=0;E<C;E++)switch(N[E].once&&this.removeListener(d,N[E].fn,void 0,!0),j){case 1:N[E].fn.call(N[E].context);break;case 2:N[E].fn.call(N[E].context,f);break;case 3:N[E].fn.call(N[E].context,f,p);break;case 4:N[E].fn.call(N[E].context,f,p,v);break;default:if(!T)for(P=1,T=new Array(j-1);P<j;P++)T[P-1]=arguments[P];N[E].fn.apply(N[E].context,T)}}return!0},c.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},c.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},c.prototype.removeListener=function(d,f,p,v){var x=n?n+d:d;if(!this._events[x])return this;if(!f)return l(this,x),this;var b=this._events[x];if(b.fn)b.fn===f&&(!v||b.once)&&(!p||b.context===p)&&l(this,x);else{for(var S=0,N=[],j=b.length;S<j;S++)(b[S].fn!==f||v&&!b[S].once||p&&b[S].context!==p)&&N.push(b[S]);N.length?this._events[x]=N.length===1?N[0]:N:l(this,x)}return this},c.prototype.removeAllListeners=function(d){var f;return d?(f=n?n+d:d,this._events[f]&&l(this,f)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(nk)),nk.exports}var Qye=Yye();const Xye=g4(Qye);var mp=new Xye,vj="recharts.syncEvent.tooltip",HD="recharts.syncEvent.brush",Jye=(e,t)=>{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!so(n))return e[n]}},Zye={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},kV=Sr({name:"options",initialState:Zye,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),ebe=kV.reducer,tbe=kV.actions.createEventEmitter;function nbe(e){return e.tooltip.syncInteraction}var ibe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},NV=Sr({name:"chartData",initialState:ibe,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var n=t.payload,i=n.startIndex,r=n.endIndex;i!=null&&(e.dataStartIndex=i),r!=null&&(e.dataEndIndex=r)}}}),g2=NV.actions,KD=g2.setChartData,rbe=g2.setDataStartEndIndexes;g2.setComputedData;var sbe=NV.reducer,abe=["x","y"];function GD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Rd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
719t%2?GD(Object(n),!0).forEach(function(i){obe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function obe(e,t,n){return(t=lbe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lbe(e){var t=cbe(e,"string");return typeof t=="symbol"?t:t+""}function cbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ube(e,t){if(e==null)return{};var n,i,r=dbe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function dbe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function hbe(){var e=st(wT),t=st(ST),n=wi(),i=st(yF),r=st(ul),s=Ih(),l=Hy(),c=st(h=>h.rootProps.className);w.useEffect(()=>{if(e==null)return Oh;var h=(d,f,p)=>{if(t!==p&&e===d){if(f.payload.active===!1){n(hm({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(i==="index"){var v;if(l&&f!==null&&f!==void 0&&(v=f.payload)!==null&&v!==void 0&&v.coordinate&&f.payload.sourceViewBox){var x=f.payload.coordinate,b=x.x,S=x.y,N=ube(x,abe),j=f.payload.sourceViewBox,T=j.x,E=j.y,C=j.width,P=j.height,A=Rd(Rd({},N),{},{x:l.x+(C?(b-T)/C:0)*l.width,y:l.y+(P?(S-E)/P:0)*l.height});n(Rd(Rd({},f),{},{payload:Rd(Rd({},f.payload),{},{coordinate:A})}))}else n(f);return}if(r!=null){var M;if(typeof i=="function"){var R={activeTooltipIndex:f.payload.index==null?void 0:Number(f.payload.index),isTooltipActive:f.payload.active,activeIndex:f.payload.index==null?void 0:Number(f.payload.index),activeLabel:f.payload.label,activeDataKey:f.payload.dataKey,activeCoordinate:f.payload.coordinate},B=i(r,R);M=r[B]}else i==="value"&&(M=r.find(q=>String(q.value)===f.payload.label));var U=f.payload.coordinate;if(U==null||l==null){n(hm({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(M==null){n(hm({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:void 0}));return}var O=U.x,F=U.y,ne=Math.min(O,l.x+l.width),re=Math.min(F,l.y+l.height),Q={x:s==="horizontal"?M.coordinate:ne,y:s==="horizontal"?re:M.coordinate},W=hm({active:f.payload.active,coordinate:Q,dataKey:f.payload.dataKey,index:String(M.index),label:f.payload.label,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:f.payload.graphicalItemId});n(W)}}};return mp.on(vj,h),()=>{mp.off(vj,h)}},[c,n,t,e,i,r,s,l])}function fbe(){var e=st(wT),t=st(ST),n=wi();w.useEffect(()=>{if(e==null)return Oh;var i=(r,s,l)=>{t!==l&&e===r&&n(rbe(s))};return mp.on(HD,i),()=>{mp.off(HD,i)}},[n,t,e])}function mbe(){var e=wi();w.useEffect(()=>{e(tbe())},[e]),hbe(),fbe()}function pbe(e,t,n,i,r,s){var l=st(b=>Sye(b,e,t)),c=st(rye),h=st(ST),d=st(wT),f=st(yF),p=st(nbe),v=(p==null?void 0:p.sourceViewBox)!=null,x=Hy();w.useEffect(()=>{if(!v&&d!=null&&h!=null){var b=hm({active:s,coordinate:n,dataKey:l,index:r,label:typeof i=="number"?String(i):i,sourceViewBox:x,graphicalItemId:c});mp.emit(vj,d,b,h)}},[v,n,l,c,r,i,h,d,f,s,x])}function YD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function QD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YD(Object(n),!0).forEach(function(i){gbe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function gbe(e,t,n){return(t=vbe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vbe(e){var t=xbe(e,"string");return typeof t=="symbol"?t:t+""}function xbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ybe(e,t){return kbe(e)||Sbe(e,t)||wbe(e,t)||bbe()}
719function bbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
720In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wbe(e,t){if(e){if(typeof e=="string")return XD(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?XD(e,t):void 0}}function XD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Sbe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function kbe(e){if(Array.isArray(e))return e}function Nbe(e){return e.dataKey}function jbe(e,t){return w.isValidElement(e)?w.cloneElement(e,t):typeof e=="function"?w.createElement(e,t):w.createElement(pfe,t)}var JD=[],Cbe={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function v2(e){var t,n,i=Ys(e,Cbe),r=i.active,s=i.allowEscapeViewBox,l=i.animationDuration,c=i.animationEasing,h=i.content,d=i.filterNull,f=i.isAnimationActive,p=i.offset,v=i.payloadUniqBy,x=i.position,b=i.reverseDirection,S=i.useTranslate3d,N=i.wrapperStyle,j=i.cursor,T=i.shared,E=i.trigger,C=i.defaultIndex,P=i.portal,A=i.axisId,M=wi(),R=typeof C=="number"?String(C):C;w.useEffect(()=>{M(hxe({shared:T,trigger:E,axisId:A,active:r,defaultIndex:R}))},[M,T,E,A,r,R]);var B=Hy(),U=J9(),O=axe(T),F=(t=st(De=>jye(De,O,E,R)))!==null&&t!==void 0?t:{},ne=F.activeIndex,re=F.isActive,Q=st(De=>Nye(De,O,E,R)),W=st(De=>bV(De,O,E,R)),q=st(De=>kye(De,O,E,R)),$=Q,ge=Gye(),ue=(n=r??re)!==null&&n!==void 0?n:!1,L=Cue([$,ue]),J=ybe(L,2),ye=J[0],Pe=J[1],Oe=O==="axis"?W:void 0;pbe(O,E,q,Oe,ne,ue);var je=P??ge;if(je==null||B==null||O==null)return null;var Ke=$??JD;ue||(Ke=JD),d&&Ke.length&&(Ke=Xce(Ke.filter(De=>De.value!=null&&(De.hide!==!0||i.includeHidden)),v,Nbe));var ve=Ke.length>0,le=QD(QD({},i),{},{payload:Ke,label:Oe,active:ue,activeIndex:ne,coordinate:q,accessibilityLayer:U}),Be=w.createElement(Dfe,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:f,active:ue,coordinate:q,hasPayload:ve,offset:p,position:x,reverseDirection:b,useTranslate3d:S,viewBox:B,wrapperStyle:N,lastBoundingBox:ye,innerRef:Pe,hasPortalFromProps:!!P},jbe(h,le));return w.createElement(w.Fragment,null,Dj.createPortal(Be,je),ue&&w.createElement(Kye,{cursor:j,tooltipEventType:O,coordinate:q,payload:Ke,index:ne}))}function Tbe(e,t,n){return(t=Ebe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ebe(e){var t=Abe(e,"string");return typeof t=="symbol"?t:t+""}function Abe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Pbe{constructor(t){Tbe(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var i=this.cache.keys().next().value;i!=null&&this.cache.delete(i)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function ZD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function _be(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
720t%2?ZD(Object(n),!0).forEach(function(i){Mbe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZD(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Mbe(e,t,n){return(t=Rbe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rbe(e){var t=Obe(e,"string");return typeof t=="symbol"?t:t+""}function Obe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ibe={cacheSize:2e3,enableCache:!0},jV=_be({},Ibe),e3=new Pbe(jV.cacheSize),Dbe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},t3="recharts_measurement_span";function Lbe(e,t){var n=t.fontSize||"",i=t.fontFamily||"",r=t.fontWeight||"",s=t.fontStyle||"",l=t.letterSpacing||"",c=t.textTransform||"";return"".concat(e,"|").concat(n,"|").concat(i,"|").concat(r,"|").concat(s,"|").concat(l,"|").concat(c)}var n3=(e,t)=>{try{var n=document.getElementById(t3);n||(n=document.createElement("span"),n.setAttribute("id",t3),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Dbe,t),n.textContent="".concat(e);var i=n.getBoundingClientRect();return{width:i.width,height:i.height}}catch{return{width:0,height:0}}},_m=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Pp.isSsr)return{width:0,height:0};if(!jV.enableCache)return n3(t,n);var i=Lbe(t,n),r=e3.get(i);if(r)return r;var s=n3(t,n);return e3.set(i,s),s},CV;function Dx(e,t){return $be(e)||Fbe(e,t)||Bbe(e,t)||Ube()}function Ube(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
721In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bbe(e,t){if(e){if(typeof e=="string")return i3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i3(e,t):void 0}}function i3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Fbe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;h=!1}else for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function $be(e){if(Array.isArray(e))return e}function Vbe(e,t,n){return(t=zbe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zbe(e){var t=qbe(e,"string");return typeof t=="symbol"?t:t+""}function qbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var r3=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,s3=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Wbe=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,Hbe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Kbe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Gbe=["cm","mm","pt","pc","in","Q","px"];function Ybe(e){return Gbe.includes(e)}var Yd="NaN";function Qbe(e,t){return e*Kbe[t]}class sr{static parse(t){var n,i=(n=Hbe.exec(t))!==null&&n!==void 0?n:[],r=Dx(i,3),s=r[1],l=r[2];return s==null?sr.NaN:new sr(parseFloat(s),l??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,so(t)&&(this.unit=""),n!==""&&!Wbe.test(n)&&(this.num=NaN,this.unit=""),Ybe(n)&&(this.num=Qbe(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new sr(NaN,""):new sr(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new sr(NaN,""):new sr(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new sr(NaN,""):new sr(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new sr(NaN,""):new sr(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return so(this.num)}}CV=sr;Vbe(sr,"NaN",new CV(NaN,""));function TV(e){if(e==null||e.includes(Yd))return Yd;for(var t=e;t.includes("*")||t.includes("/");){var n,i=(n=r3.exec(t))!==null&&n!==void 0?n:[],r=Dx(i,4),s=r[1],l=r[2],c=r[3],h=sr.parse(s??""),d=sr.parse(c??""),f=l==="*"?h.multiply(d):h.divide(d);if(f.isNaN())return Yd;t=t.replace(r3,f.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var p,v=(p=s3.exec(t))!==null&&p!==void 0?p:[],x=Dx(v,4),b=x[1],S=x[2],N=x[3],j=sr.parse(b??""),T=sr.parse(N??""),E=S==="+"?j.add(T):j.subtract(T);if(E.isNaN())return Yd;t=t.replace(s3,E.toString())}return t}var a3=/\(([^()]*)\)/;function Xbe(e){for(var t=e,n;(n=a3.exec(t))!=null;){var i=n,r=Dx(i,2),s=r[1];t=t.replace(a3,TV(s))}return t}function Jbe(e){var t=e.replace(/\s+/g,"");return t=Xbe(t),t=TV(t),t}function Zbe(e){try{return Jbe(e)}catch{return Yd}}function ik(e){var t=Zbe(e.slice(5,-1));
721return t===Yd?"":t}var e1e=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],t1e=["dx","dy","angle","className","breakAll"];function xj(){return xj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},xj.apply(null,arguments)}function o3(e,t){if(e==null)return{};var n,i,r=n1e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function n1e(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function l3(e,t){return a1e(e)||s1e(e,t)||r1e(e,t)||i1e()}function i1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
722In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r1e(e,t){if(e){if(typeof e=="string")return c3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c3(e,t):void 0}}function c3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function s1e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;h=!1}else for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function a1e(e){if(Array.isArray(e))return e}var EV=/[ \f\n\r\t\v\u2028\u2029]+/,AV=e=>{var t=e.children,n=e.breakAll,i=e.style;try{var r=[];dr(t)||(n?r=t.toString().split(""):r=t.toString().split(EV));var s=r.map(c=>({word:c,width:_m(c,i).width})),l=n?0:_m(" ",i).width;return{wordsWithComputedWidth:s,spaceWidth:l}}catch{return null}};function PV(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function o1e(e){return dr(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var _V=(e,t,n,i)=>e.reduce((r,s)=>{var l=s.word,c=s.width,h=r[r.length-1];if(h&&c!=null&&(t==null||i||h.width+c+n<Number(t)))h.words.push(l),h.width+=c+n;else{var d={words:[l],width:c};r.push(d)}return r},[]),MV=e=>e.reduce((t,n)=>t.width>n.width?t:n),l1e="…",u3=(e,t,n,i,r,s,l,c)=>{var h=e.slice(0,t),d=AV({breakAll:n,style:i,children:h+l1e});if(!d)return[!1,[]];var f=_V(d.wordsWithComputedWidth,s,l,c),p=f.length>r||MV(f).width>Number(s);return[p,f]},c1e=(e,t,n,i,r)=>{var s=e.maxLines,l=e.children,c=e.style,h=e.breakAll,d=Xe(s),f=String(l),p=_V(t,i,n,r);if(!d||r)return p;var v=p.length>s||MV(p).width>Number(i);if(!v)return p;for(var x=0,b=f.length-1,S=0,N;x<=b&&S<=f.length-1;){var j=Math.floor((x+b)/2),T=j-1,E=u3(f,T,h,c,s,i,n,r),C=l3(E,2),P=C[0],A=C[1],M=u3(f,j,h,c,s,i,n,r),R=l3(M,1),B=R[0];if(!P&&!B&&(x=j+1),P&&B&&(b=j-1),!P&&B){N=A;break}S++}return N||p},d3=e=>{var t=dr(e)?[]:e.toString().split(EV);return[{words:t,width:void 0}]},u1e=e=>{var t=e.width,n=e.scaleToFit,i=e.children,r=e.style,s=e.breakAll,l=e.maxLines;if((t||n)&&!Pp.isSsr){var c,h,d=AV({breakAll:s,children:i,style:r});if(d){var f=d.wordsWithComputedWidth,p=d.spaceWidth;c=f,h=p}else return d3(i);return c1e({breakAll:s,children:i,maxLines:l,style:r},c,h,t,!!n)}return d3(i)},RV="#808080",d1e={angle:0,breakAll:!1,capHeight:"0.71em",fill:RV,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},x2=w.forwardRef((e,t)=>{var n=Ys(e,d1e),i=n.x,r=n.y,s=n.lineHeight,l=n.capHeight,c=n.fill,h=n.scaleToFit,d=n.textAnchor,f=n.verticalAnchor,p=o3(n,e1e),v=w.useMemo(()=>u1e({breakAll:p.breakAll,children:p.children,maxLines:p.maxLines,scaleToFit:h,style:p.style,width:p.width}),[p.breakAll,p.children,p.maxLines,h,p.style,p.width]),x=p.dx,b=p.dy,S=p.angle,N=p.className,j=p.breakAll,T=o3(p,t1e);if(!ao(i)||!ao(r)||v.length===0)return null;var E=Number(i)+(Xe(x)?x:0),C=Number(r)+(Xe(b)?b:0);if(!Mt(E)||!Mt(C))return null;var P;switch(f){case"start":P=ik("calc(".concat(l,")"));break;case"middle":P=ik("calc(".concat((v.length-1)/2," * -").concat(s," + (").concat(l," / 2))"));break;default:P=ik("calc(".concat(v.length-1," * -").concat(s,")"));break}var A=[],M=v[0];if(h&&M!=null){var R=M.width,B=p.width;A.push("scale(".concat(Xe(B)&&Xe(R)?B/R:1,")"))}return S&&A.push("rotate(".concat(S,", ").concat(E,", ").concat(C,")")),A.length&&(T.transform=A.join(" ")),w.createElement("text",xj({},Ws(T),{ref:t,x:E,y:C,className:Rn("recharts-text",N),textAnchor:d,fill:c.includes("url")?RV:c}),v.map((U,O)=>{var F=U.words.join(j?"":" ");return w.createElement("tspan",{x:E,dy:O===0?P:s,key:"".concat(F,"-").concat(O)},F)}))});x2.displayName="Text";function h3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Ba(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
722t%2?h3(Object(n),!0).forEach(function(i){h1e(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function h1e(e,t,n){return(t=f1e(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f1e(e){var t=m1e(e,"string");return typeof t=="symbol"?t:t+""}function m1e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var p1e=e=>{var t=e.viewBox,n=e.position,i=e.offset,r=i===void 0?0:i,s=e.parentViewBox,l=dT(t),c=l.x,h=l.y,d=l.height,f=l.upperWidth,p=l.lowerWidth,v=c,x=c+(f-p)/2,b=(v+x)/2,S=(f+p)/2,N=v+f/2,j=d>=0?1:-1,T=j*r,E=j>0?"end":"start",C=j>0?"start":"end",P=f>=0?1:-1,A=P*r,M=P>0?"end":"start",R=P>0?"start":"end",B=s;if(n==="top"){var U={x:v+f/2,y:h-T,horizontalAnchor:"middle",verticalAnchor:E};return B&&(U.height=Math.max(h-B.y,0),U.width=f),U}if(n==="bottom"){var O={x:x+p/2,y:h+d+T,horizontalAnchor:"middle",verticalAnchor:C};return B&&(O.height=Math.max(B.y+B.height-(h+d),0),O.width=p),O}if(n==="left"){var F={x:b-A,y:h+d/2,horizontalAnchor:M,verticalAnchor:"middle"};return B&&(F.width=Math.max(F.x-B.x,0),F.height=d),F}if(n==="right"){var ne={x:b+S+A,y:h+d/2,horizontalAnchor:R,verticalAnchor:"middle"};return B&&(ne.width=Math.max(B.x+B.width-ne.x,0),ne.height=d),ne}var re=B?{width:S,height:d}:{};return n==="insideLeft"?Ba({x:b+A,y:h+d/2,horizontalAnchor:R,verticalAnchor:"middle"},re):n==="insideRight"?Ba({x:b+S-A,y:h+d/2,horizontalAnchor:M,verticalAnchor:"middle"},re):n==="insideTop"?Ba({x:v+f/2,y:h+T,horizontalAnchor:"middle",verticalAnchor:C},re):n==="insideBottom"?Ba({x:x+p/2,y:h+d-T,horizontalAnchor:"middle",verticalAnchor:E},re):n==="insideTopLeft"?Ba({x:v+A,y:h+T,horizontalAnchor:R,verticalAnchor:C},re):n==="insideTopRight"?Ba({x:v+f-A,y:h+T,horizontalAnchor:M,verticalAnchor:C},re):n==="insideBottomLeft"?Ba({x:x+A,y:h+d-T,horizontalAnchor:R,verticalAnchor:E},re):n==="insideBottomRight"?Ba({x:x+p-A,y:h+d-T,horizontalAnchor:M,verticalAnchor:E},re):n&&typeof n=="object"&&(Xe(n.x)||_u(n.x))&&(Xe(n.y)||_u(n.y))?Ba({x:c+pc(n.x,S),y:h+pc(n.y,d),horizontalAnchor:"end",verticalAnchor:"end"},re):Ba({x:N,y:h+d/2,horizontalAnchor:"middle",verticalAnchor:"middle"},re)},g1e=["labelRef"],v1e=["content"];function f3(e,t){if(e==null)return{};var n,i,r=x1e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function x1e(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function m3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function fm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?m3(Object(n),!0).forEach(function(i){y1e(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function y1e(e,t,n){return(t=b1e(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b1e(e){var t=w1e(e,"string");return typeof t=="symbol"?t:t+""}function w1e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vo(){return Vo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Vo.apply(null,arguments)}var OV=w.createContext(null),S1e=e=>{var t=e.x,n=e.y,i=e.upperWidth,r=e.lowerWidth,s=e.width,l=e.height,c=e.children,h=w.useMemo(()=>({x:t,y:n,upperWidth:i,lowerWidth:r,width:s,height:l}),[t,n,i,r,s,l]);return w.createElement(OV.Provider,{value:h},c)},IV=()=>{var e=w.useContext(OV),t=Hy();return e||(t?dT(t):void 0)},k1e=w.createContext(null),N1e=()=>{var e=w.useContext(k1e),t=st(NF);return e||t},j1e=e=>{var t=e.value,n=e.formatter,i=dr(e.children)?t:e.children;return typeof n=="function"?n(i):i},y2=e=>e!=null&&typeof e=="function",C1e=(e,t)=>{var n=Fs(t-e),i=Math.min(Math.abs(t-e),360);return n*i},T1e=(e,t,n,i,r)=>{var s=e.offset,l=e.className,c=r.cx,h=r.cy,d=r.innerRadius,f=r.outerRadius,p=r.startAngle,v=r.endAngle,x=r.clockWise,b=(d+f)/2,S=C1e(p,v),N=S>=0?1:-1,j,T;switch(t){case"insideStart":j=p+N*s,T=x;break;case"insideEnd":j=v-N*s,T=!x;break;case"end":j=v+N*s,T=x;break;default:throw new Error("Unsupported position ".concat(t))}T=S<=0?T:!T;var E=lr(c,h,b,j),C=lr(c,h,b,j+(T?1:-1)*359),P="M".concat(E.x,",").concat(E.y,`
723    A`).concat(b,",").concat(b,",0,1,").concat(T?0:1,`,
724    `).concat(C.x,",").concat(C.y),A=dr(e.id)?ep("recharts-radial-line-"):e.id;return w.createElement("text",Vo({},i,{dominantBaseline:"central",className:Rn("recharts-radial-bar-label",l)}),w.createElement("defs",null,w.createElement("path",{id:A,d:P})),w.createElement("textPath",{xlinkHref:"#".concat(A)},n))},E1e=(e,t,n)=>{var i=e.cx,r=e.cy,s=e.innerRadius,l=e.outerRadius,c=e.startAngle,h=e.endAngle,d=(c+h)/2;if(n==="outside"){var f=lr(i,r,l+t,d),p=f.x,v=f.y;return{x:p,y:v,textAnchor:p>=i?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:i,y:r,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:i,y:r,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:i,y:r,textAnchor:"middle",verticalAnchor:"end"};var x=(s+l)/2,b=lr(i,r,x,d),S=b.x,N=b.y;return{x:S,y:N,textAnchor:"middle",verticalAnchor:"middle"}},dv=e=>e!=null&&"cx"in e&&Xe(e.cx),A1e={angle:0,offset:5,zIndex:Mr.label,position:"middle",textBreakAll:!1};function P1e(e){if(!dv(e))return e;var t=e.cx,n=e.cy,i=e.outerRadius,r=i*2;return{x:t-i,y:n-i,width:r,upperWidth:r,lowerWidth:r,height:r}}function Hl(e){var t=Ys(e,A1e),n=t.viewBox,i=t.parentViewBox,r=t.position,s=t.value,l=t.children,c=t.content,h=t.className,d=
724h===void 0?"":h,f=t.textBreakAll,p=t.labelRef,v=N1e(),x=IV(),b=r==="center"?x:v??x,S,N,j;n==null?S=b:dv(n)?S=n:S=dT(n);var T=P1e(S);if(!S||dr(s)&&dr(l)&&!w.isValidElement(c)&&typeof c!="function")return null;var E=fm(fm({},t),{},{viewBox:S});if(w.isValidElement(c)){E.labelRef;var C=f3(E,g1e);return w.cloneElement(c,C)}if(typeof c=="function"){E.content;var P=f3(E,v1e);if(N=w.createElement(c,P),w.isValidElement(N))return N}else N=j1e(t);var A=Ws(t);if(dv(S)){if(r==="insideStart"||r==="insideEnd"||r==="end")return T1e(t,r,N,A,S);j=E1e(S,t.offset,t.position)}else{if(!T)return null;var M=p1e({viewBox:T,position:r,offset:t.offset,parentViewBox:dv(i)?void 0:i});j=fm(fm({x:M.x,y:M.y,textAnchor:M.horizontalAnchor,verticalAnchor:M.verticalAnchor},M.width!==void 0?{width:M.width}:{}),M.height!==void 0?{height:M.height}:{})}return w.createElement(dl,{zIndex:t.zIndex},w.createElement(x2,Vo({ref:p,className:Rn("recharts-label",d)},A,j,{textAnchor:PV(A.textAnchor)?A.textAnchor:j.textAnchor,breakAll:f}),N))}Hl.displayName="Label";var _1e=(e,t,n)=>{if(!e)return null;var i={viewBox:t,labelRef:n};return e===!0?w.createElement(Hl,Vo({key:"label-implicit"},i)):ao(e)?w.createElement(Hl,Vo({key:"label-implicit",value:e},i)):w.isValidElement(e)?e.type===Hl?w.cloneElement(e,fm({key:"label-implicit"},i)):w.createElement(Hl,Vo({key:"label-implicit",content:e},i)):y2(e)?w.createElement(Hl,Vo({key:"label-implicit",content:e},i)):e&&typeof e=="object"?w.createElement(Hl,Vo({},e,{key:"label-implicit"},i)):null};function M1e(e){var t=e.label,n=e.labelRef,i=IV();return _1e(t,i,n)||null}var R1e=["valueAccessor"],O1e=["dataKey","clockWise","id","textBreakAll","zIndex"];function Lx(){return Lx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Lx.apply(null,arguments)}function p3(e,t){if(e==null)return{};var n,i,r=I1e(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function I1e(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var D1e=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(o1e(t))return t},DV=w.createContext(void 0),L1e=DV.Provider,LV=w.createContext(void 0);LV.Provider;function U1e(){return w.useContext(DV)}function B1e(){return w.useContext(LV)}function hv(e){var t=e.valueAccessor,n=t===void 0?D1e:t,i=p3(e,R1e),r=i.dataKey;i.clockWise;var s=i.id,l=i.textBreakAll,c=i.zIndex,h=p3(i,O1e),d=U1e(),f=B1e(),p=d||f;return!p||!p.length?null:w.createElement(dl,{zIndex:c??Mr.label},w.createElement(Hs,{className:"recharts-label-list"},p.map((v,x)=>{var b,S=dr(r)?n(v,x):Vi(v.payload,r),N=dr(s)?{}:{id:"".concat(s,"-").concat(x)};return w.createElement(Hl,Lx({key:"label-".concat(x)},Ws(v),h,N,{fill:(b=i.fill)!==null&&b!==void 0?b:v.fill,parentViewBox:v.parentViewBox,value:S,textBreakAll:l,viewBox:v.viewBox,index:x,zIndex:0}))})))}hv.displayName="LabelList";function F1e(e){var t=e.label;return t?t===!0?w.createElement(hv,{key:"labelList-implicit"}):w.isValidElement(t)||y2(t)?w.createElement(hv,{key:"labelList-implicit",content:t}):typeof t=="object"?w.createElement(hv,Lx({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function yj(){return yj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},yj.apply(null,arguments)}var UV=e=>{var t=e.cx,n=e.cy,i=e.r,r=e.className,s=Rn("recharts-dot",r);return Xe(t)&&Xe(n)&&Xe(i)?w.createElement("circle",yj({},Ca(e),eT(e),{className:s,cx:t,cy:n,r:i})):null},$1e={radiusAxis:{},angleAxis:{}},BV=Sr({name:"polarAxis",initialState:$1e,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),pb=BV.actions;pb.addRadiusAxis;pb.removeRadiusAxis;pb.addAngleAxis;pb.removeAngleAxis;var V1e=BV.reducer;function z1e(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var FV=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0;function g3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function v3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
724t%2?g3(Object(n),!0).forEach(function(i){q1e(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function q1e(e,t,n){return(t=W1e(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W1e(e){var t=H1e(e,"string");return typeof t=="symbol"?t:t+""}function H1e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $V(e,t){return v3(v3({},t),e)}function K1e(e){return w.isValidElement(e)?e.props:e}function G1e(e,t){return w.cloneElement(e,$V(K1e(e),t))}function Y1e(e){if("index"in e){var t=e.index;return typeof t=="number"||typeof t=="string"?t:void 0}}function Q1e(e){return"isActive"in e&&e.isActive===!0}function X1e(e){var t=e.option,n=e.DefaultShape,i=e.shapeProps,r=e.activeClassName,s=r===void 0?"recharts-active-shape":r,l=e.inActiveClassName,c=l===void 0?"recharts-shape":l,h=Y1e(i),d;return w.isValidElement(t)?d=G1e(t,i):t===n?d=w.createElement(n,i):typeof t=="function"?d=t(i,h):typeof t=="object"?d=w.createElement(n,$V(t,i)):d=w.createElement(n,i),Q1e(i)?w.createElement(Hs,{className:s},d):w.createElement(Hs,{className:c},d)}function J1e(e){var t=e.tooltipEntrySettings,n=wi(),i=ns(),r=w.useRef(null);return w.useLayoutEffect(()=>{i||(r.current===null?n(cxe(t)):r.current!==t&&n(uxe({prev:r.current,next:t})),r.current=t)},[t,n,i]),w.useLayoutEffect(()=>()=>{r.current&&(n(dxe(r.current)),r.current=null)},[n]),null}function Z1e(e){var t=e.legendPayload,n=wi(),i=ns(),r=w.useRef(null);return w.useLayoutEffect(()=>{i||(r.current===null?n(Lhe(t)):r.current!==t&&n(Uhe({prev:r.current,next:t})),r.current=t)},[n,i,t]),w.useLayoutEffect(()=>()=>{r.current&&(n(Bhe(r.current)),r.current=null)},[n]),null}function ewe(e,t){return rwe(e)||iwe(e,t)||nwe(e,t)||twe()}function twe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
725In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nwe(e,t){if(e){if(typeof e=="string")return x3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x3(e,t):void 0}}function x3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function iwe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function rwe(e){if(Array.isArray(e))return e}var b2="index",swe="append";function w2(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=[];for(var r of n)i.push({status:"removed",prev:r});for(var s=0;s<t.length;s++){var l=e[s],c=t[s];l!=null?i.push({status:"matched",prev:l,next:c}):i.push({status:"added",next:c})}return i}function awe(e,t){var n=e.length/t.length,i=t.map((r,s)=>e[Math.floor(s*n)]);return w2(i,t)}function owe(e,t){var n=t.map((i,r)=>e[r]);return w2(n,t)}function lwe(e,t){for(var n=new Map,i=0;i<e.length;i++){var r=e[i];if(r!=null){var s=t(r,i);s!=null&&!n.has(s)&&n.set(s,r)}}return n}function cwe(e,t,n){var i=lwe(e,n),r=new Set,s=t.map((p,v)=>{var x=n(p,v);if(x!=null){var b=i.get(x);if(b!==void 0)return r.add(x),b}}),l=[];for(var c of i){var h=ewe(c,2),d=h[0],f=h[1];r.has(d)||l.push(f)}return w2(s,t,l)}function bj(e,t,n){return t==null?null:e==null?t.map(i=>({status:"added",next:i})):n===b2?awe(e,t):n===swe?owe(e,t):cwe(e,t,n)}function VV(e,t){var n=w.useRef(e),i=w.useRef(t.current),r=w.useRef(!0);n.current!==e&&(n.current=e,i.current=t.current,r.current=!1);var s=w.useCallback(function(l,c){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(c===0){r.current=!0;return}c===1&&(i.current=l),c>0&&r.current&&h&&(t.current=l)},[t]);return{startValue:i.current,syncStepValue:s}}function uwe(e,t){return mwe(e)||fwe(e,t)||hwe(e,t)||dwe()}
725function dwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
726In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hwe(e,t){if(e){if(typeof e=="string")return y3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y3(e,t):void 0}}function y3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function fwe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function mwe(e){if(Array.isArray(e))return e}function pwe(e,t){var n=w.useState(!1),i=uwe(n,2),r=i[0],s=i[1],l=w.useCallback(()=>{typeof e=="function"&&e(),s(!0)},[e]),c=w.useCallback(()=>{typeof t=="function"&&t(),s(!1)},[t]);return{isAnimating:r,handleAnimationStart:l,handleAnimationEnd:c}}function gwe(e){var t,n=e.animationInput,i=e.animationIdPrefix,r=e.items,s=e.previousItemsRef,l=e.isAnimationActive,c=e.animationBegin,h=e.animationDuration,d=e.animationEasing,f=e.onAnimationStart,p=e.onAnimationEnd,v=e.animationInterpolateFn,x=e.animationMatchBy,b=e.shouldUpdatePreviousRef,S=e.children,N=e.layout,j=iF(n,i),T=VV(j,s),E=(t=T.startValue)!==null&&t!==void 0?t:null,C=bj(E,r,x??b2);return w.createElement(nF,{animationId:j,begin:c,duration:h,isActive:l,easing:d,onAnimationEnd:p,onAnimationStart:f,key:j},P=>{var A=E==null,M=r==null?r:v(C,P,N),R=b?b(P):P>0;return T.syncStepValue(M,P,R),M==null?null:S(M,P,A)})}var rk;function vwe(e,t){return wwe(e)||bwe(e,t)||ywe(e,t)||xwe()}function xwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
727In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ywe(e,t){if(e){if(typeof e=="string")return b3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b3(e,t):void 0}}function b3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function bwe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function wwe(e){if(Array.isArray(e))return e}var Swe=()=>{var e=w.useState(()=>ep("uid-")),t=vwe(e,1),n=t[0];return n},zV=(rk=Gq.useId)!==null&&rk!==void 0?rk:Swe;function kwe(e,t){var n=zV();return t||(e?"".concat(e,"-").concat(n):n)}var Nwe=w.createContext(void 0),jwe=e=>{var t=e.id,n=e.type,i=e.children,r=kwe("recharts-".concat(n),t);return w.createElement(Nwe.Provider,{value:r},i(r))},Cwe={cartesianItems:[],polarItems:[]},qV=Sr({name:"graphicalItems",initialState:Cwe,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:_n()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next,s=$s(e).cartesianItems.indexOf(i);s>-1&&(e.cartesianItems[s]=r)},prepare:_n()},removeCartesianGraphicalItem:{reducer(e,t){var n=$s(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:_n()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:_n()},removePolarGraphicalItem:{reducer(e,t){var n=$s(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:_n()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next,s=$s(e).polarItems.indexOf(i);s>-1&&(e.polarItems[s]=r)},prepare:_n()}}}),qh=qV.actions,Twe=qh.addCartesianGraphicalItem,Ewe=qh.replaceCartesianGraphicalItem,Awe=qh.removeCartesianGraphicalItem;qh.addPolarGraphicalItem;qh.removePolarGraphicalItem;qh.replacePolarGraphicalItem;var Pwe=qV.reducer,_we=e=>{var t=wi(),n=w.useRef(null);return w.useLayoutEffect(()=>{n.current===null?t(Twe(e)):n.current!==e&&t(Ewe({prev:n.current,next:e})),n.current=e},[t,e]),w.useLayoutEffect(()=>()=>{n.current&&(t(Awe(n.current)),n.current=null)},[t]),null},Mwe=w.memo(_we),Rwe=["points"];function w3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function sk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
727t%2?w3(Object(n),!0).forEach(function(i){Owe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Owe(e,t,n){return(t=Iwe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Iwe(e){var t=Dwe(e,"string");return typeof t=="symbol"?t:t+""}function Dwe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ux(){return Ux=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Ux.apply(null,arguments)}function Lwe(e,t){if(e==null)return{};var n,i,r=Uwe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Uwe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function Bwe(e){var t=e.option,n=e.dotProps,i=e.className;if(w.isValidElement(t))return w.cloneElement(t,n);if(typeof t=="function")return t(n);var r=Rn(i,typeof t!="boolean"?t.className:""),s=n??{};s.points;var l=Lwe(s,Rwe);return w.createElement(UV,Ux({},l,{className:r}))}function Fwe(e,t){return e==null?!1:t?!0:e.length===1}function $we(e){var t=e.points,n=e.dot,i=e.className,r=e.dotClassName,s=e.dataKey,l=e.baseProps,c=e.needClip,h=e.clipPathId,d=e.zIndex,f=d===void 0?Mr.scatter:d;if(!Fwe(t,n))return null;var p=FV(n),v=Cle(n),x=t.map((S,N)=>{var j,T,E=sk(sk(sk({r:3},l),v),{},{index:N,cx:(j=S.x)!==null&&j!==void 0?j:void 0,cy:(T=S.y)!==null&&T!==void 0?T:void 0,dataKey:s,value:S.value,payload:S.payload,points:t});return w.createElement(Bwe,{key:"dot-".concat(N),option:n,dotProps:E,className:r})}),b={};return c&&h!=null&&(b.clipPath="url(#clipPath-".concat(p?"":"dots-").concat(h,")")),w.createElement(dl,{zIndex:f},w.createElement(Hs,Ux({className:i},b),x))}function S3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function k3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?S3(Object(n),!0).forEach(function(i){Vwe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Vwe(e,t,n){return(t=zwe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zwe(e){var t=qwe(e,"string");return typeof t=="symbol"?t:t+""}function qwe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var WV=0,Wwe={xAxis:{},yAxis:{},zAxis:{}},HV=Sr({name:"cartesianAxis",initialState:Wwe,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:_n()},replaceXAxis:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next;e.xAxis[i.id]!==void 0&&(i.id!==r.id&&delete e.xAxis[i.id],e.xAxis[r.id]=r)},prepare:_n()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:_n()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:_n()},replaceYAxis:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next;e.yAxis[i.id]!==void 0&&(i.id!==r.id&&delete e.yAxis[i.id],e.yAxis[r.id]=r)},prepare:_n()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:_n()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:_n()},replaceZAxis:{reducer(e,t){var n=t.payload,i=n.prev,r=n.next;e.zAxis[i.id]!==void 0&&(i.id!==r.id&&delete e.zAxis[i.id],e.zAxis[r.id]=r)},prepare:_n()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:_n()},updateYAxisWidth(e,t){var n=t.payload,i=n.id,r=n.width,s=e.yAxis[i];if(s){var l,c=s.widthHistory||[];if(c.length===3&&c[0]===c[2]&&r===c[1]&&r!==s.width&&Math.abs(r-((l=c[0])!==null&&l!==void 0?l:0))<=1)return;var h=[...c,r].slice(-3);e.yAxis[i]=k3(k3({},s),{}
727,{width:r,widthHistory:h})}}}}),ho=HV.actions,Hwe=ho.addXAxis,Kwe=ho.replaceXAxis,Gwe=ho.removeXAxis,Ywe=ho.addYAxis,Qwe=ho.replaceYAxis,Xwe=ho.removeYAxis;ho.addZAxis;ho.replaceZAxis;ho.removeZAxis;var Jwe=ho.updateYAxisWidth,Zwe=HV.reducer,eSe=pe([hr],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),tSe=pe([eSe,sl,al],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),S2=()=>st(tSe),nSe=()=>st(cye);function N3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function ak(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N3(Object(n),!0).forEach(function(i){iSe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function iSe(e,t,n){return(t=rSe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rSe(e){var t=sSe(e,"string");return typeof t=="symbol"?t:t+""}function sSe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var aSe=e=>{var t=e.point,n=e.childIndex,i=e.mainColor,r=e.activeDot,s=e.dataKey,l=e.clipPath;if(r===!1||t.x==null||t.y==null)return null;var c={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:i??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},h=ak(ak(ak({},c),Ey(r)),eT(r)),d;return w.isValidElement(r)?d=w.cloneElement(r,h):typeof r=="function"?d=r(h):d=w.createElement(UV,h),w.createElement(Hs,{className:"recharts-active-dot",clipPath:l},d)};function j3(e){var t=e.points,n=e.mainColor,i=e.activeDot,r=e.itemDataKey,s=e.clipPath,l=e.zIndex,c=l===void 0?Mr.activeDot:l,h=st(fp),d=nSe();if(t==null||d==null)return null;var f=t.find(p=>d.includes(p.payload));return dr(f)?null:w.createElement(dl,{zIndex:c},w.createElement(aSe,{point:f,childIndex:Number(h),mainColor:n,dataKey:r,activeDot:i,clipPath:s}))}var oSe=e=>{var t=e.chartData,n=wi(),i=ns();return w.useEffect(()=>i?()=>{}:(n(KD(t)),()=>{n(KD(void 0))}),[t,n,i]),null},C3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},KV=Sr({name:"brush",initialState:C3,reducers:{setBrushSettings(e,t){return t.payload==null?C3:t.payload}}});KV.actions.setBrushSettings;var lSe=KV.reducer;function cSe(e){return(e%180+180)%180}var uSe=function(t){var n=t.width,i=t.height,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=cSe(r),l=s*Math.PI/180,c=Math.atan(i/n),h=l>c&&l<Math.PI-c?i/Math.sin(l):n/Math.cos(l);return Math.abs(h)},dSe={dots:[],areas:[],lines:[]},GV=Sr({name:"referenceElements",initialState:dSe,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=$s(e).dots.findIndex(i=>i===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=$s(e).areas.findIndex(i=>i===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=$s(e).lines.findIndex(i=>i===t.payload);n!==-1&&e.lines.splice(n,1)}}}),Wh=GV.actions;Wh.addDot;Wh.removeDot;Wh.addArea;Wh.removeArea;Wh.addLine;Wh.removeLine;var hSe=GV.reducer;function fSe(e,t){return vSe(e)||gSe(e,t)||pSe(e,t)||mSe()}function mSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
728In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pSe(e,t){if(e){if(typeof e=="string")return T3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T3(e,t):void 0}}function T3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function gSe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;
728!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function vSe(e){if(Array.isArray(e))return e}var xSe=w.createContext(void 0),ySe=e=>{var t=e.children,n=w.useState("".concat(ep("recharts"),"-clip")),i=fSe(n,1),r=i[0],s=S2();if(s==null)return null;var l=s.x,c=s.y,h=s.width,d=s.height;return w.createElement(xSe.Provider,{value:r},w.createElement("defs",null,w.createElement("clipPath",{id:r},w.createElement("rect",{x:l,y:c,height:d,width:h}))),t)};function YV(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],i=0;i<e.length;i+=t){var r=e[i];r!==void 0&&n.push(r)}return n}function bSe(e,t,n){var i={width:e.width+t.width,height:e.height+t.height};return uSe(i,n)}function wSe(e,t,n){var i=n==="width",r=e.x,s=e.y,l=e.width,c=e.height;return t===1?{start:i?r:s,end:i?r+l:s+c}:{start:i?r+l:s+c,end:i?r:s}}function pp(e,t,n,i,r){if(e*t<e*i||e*t>e*r)return!1;var s=n();return e*(t-e*s/2-i)>=0&&e*(t+e*s/2-r)<=0}function SSe(e,t){return YV(e,t+1)}function kSe(e,t,n,i,r){for(var s=(i||[]).slice(),l=t.start,c=t.end,h=0,d=1,f=l,p=function(){var b=i==null?void 0:i[h];if(b===void 0)return{v:YV(i,d)};var S=h,N,j=()=>(N===void 0&&(N=n(b,S)),N),T=b.coordinate,E=h===0||pp(e,T,j,f,c);E||(h=0,f=l,d+=1),E&&(f=T+e*(j()/2+r),h+=d)},v;d<=s.length;)if(v=p(),v)return v.v;return[]}function NSe(e,t,n,i,r){var s=(i||[]).slice(),l=s.length;if(l===0)return[];for(var c=t.start,h=t.end,d=1;d<=l;d++){for(var f=(l-1)%d,p=c,v=!0,x=function(){var C=i[S];if(C==null)return 0;var P=S,A,M=()=>(A===void 0&&(A=n(C,P)),A),R=C.coordinate,B=S===f||pp(e,R,M,p,h);if(!B)return v=!1,1;B&&(p=R+e*(M()/2+r))},b,S=f;S<l&&(b=x(),!(b!==0&&b===1));S+=d);if(v){for(var N=[],j=f;j<l;j+=d){var T=i[j];T!=null&&N.push(T)}return N}}return[]}function E3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function vr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E3(Object(n),!0).forEach(function(i){jSe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function jSe(e,t,n){return(t=CSe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CSe(e){var t=TSe(e,"string");return typeof t=="symbol"?t:t+""}function TSe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ESe(e,t,n,i,r){for(var s=(i||[]).slice(),l=s.length,c=t.start,h=t.end,d=function(v){var x=s[v];if(x==null)return 1;var b=x,S,N=()=>(S===void 0&&(S=n(x,v)),S);if(v===l-1){var j=e*(b.coordinate+e*N()/2-h);s[v]=b=vr(vr({},b),{},{tickCoord:j>0?b.coordinate-j*e:b.coordinate})}else s[v]=b=vr(vr({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var T=pp(e,b.tickCoord,N,c,h);T&&(h=b.tickCoord-e*(N()/2+r),s[v]=vr(vr({},b),{},{isShow:!0}))}},f=l-1;f>=0;f--)d(f);return s}function ASe(e,t,n,i,r,s){var l=(i||[]).slice(),c=l.length,h=t.start,d=t.end;if(s){var f=i[c-1];if(f!=null){var p=n(f,c-1),v=e*(f.coordinate+e*p/2-d);if(l[c-1]=f=vr(vr({},f),{},{tickCoord:v>0?f.coordinate-v*e:f.coordinate}),f.tickCoord!=null){var x=pp(e,f.tickCoord,()=>p,h,d);x&&(d=f.tickCoord-e*(p/2+r),l[c-1]=vr(vr({},f),{},{isShow:!0}))}}}for(var b=s?c-1:c,S=function(T){var E=l[T];if(E==null)return 1;var C=E,P,A=()=>(P===void 0&&(P=n(E,T)),P);if(T===0){var M=e*(C.coordinate-e*A()/2-h);l[T]=C=vr(vr({},C),{},{tickCoord:M<0?C.coordinate-M*e:C.coordinate})}else l[T]=C=vr(vr({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var R=pp(e,C.tickCoord,A,h,d);R&&(h=C.tickCoord+e*(A()/2+r),l[T]=vr(vr({},C),{},{isShow:!0}))}},N=0;N<b;N++)S(N);return l}function k2(e,t,n){var i=e.tick,r=e.ticks,s=e.viewBox,l=e.minTickGap,c=e.orientation,h=e.interval,d=e.tickFormatter,f=e.unit,p=e.angle;if(!r||!r.length||!i)return[];if(Xe(h)||Pp.isSsr){var v;return(v=SSe(r,Xe(h)?h:0))!==null&&v!==void 0?v:[]}var x=[],b=c==="top"||c==="bottom"?"width":"height",S=f&&b==="width"?_m(f,{fontSize:t,letterSpacing:n}):{width:0,height:0},N=(P,A)=>{var M=typeof d=="function"?d(P.value,A):P.value;return b==="width"?bSe(_m(M,{fontSize:t,letterSpacing:n}),S,p):_m(M,{fontSize:t,letterSpacing:n})[b]},j=r[0],T=r[1],E=r.length>=2&&j!=null&&T!=null?Fs(T.coordinate-j.coordinate):1,C=wSe(s,E,b);return h==="equidistantPreserveStart"?kSe(E,C,N,r,l):h==="equidistantPreserveEnd"?NSe(E,C,N,r,l):(h==="preserveStart"||h==="preserveStartEnd"?x=ASe(E,C,N,r,l,h==="preserveStartEnd"):x=ESe(E,C,N,r,l),x.filter(P=>P.isShow))}var PSe=e=>{var t=e.ticks,n=e.label,i=e.labelGapWithTick,r=i,s=e.tickSize,l=s===void 0?0:s,c=e.tickMargin,h=c===void 0?0:c,d=0;if(t){Array.from(t).forEach(x=>
728{if(x){var b=x.getBoundingClientRect();b.width>d&&(d=b.width)}});var f=n?n.getBoundingClientRect().width:0,p=l+h,v=d+p+f+(n?r:0);return Math.round(v)}return 0},_Se={xAxis:{},yAxis:{}},QV=Sr({name:"renderedTicks",initialState:_Se,reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,i=n.axisType,r=n.axisId,s=n.ticks;e[i][r]=s},removeRenderedTicks:(e,t)=>{var n=t.payload,i=n.axisType,r=n.axisId;delete e[i][r]}}}),XV=QV.actions,MSe=XV.setRenderedTicks,RSe=XV.removeRenderedTicks,OSe=QV.reducer,ISe=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function A3(e,t){return BSe(e)||USe(e,t)||LSe(e,t)||DSe()}function DSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
729In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LSe(e,t){if(e){if(typeof e=="string")return P3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P3(e,t):void 0}}function P3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function USe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function BSe(e){if(Array.isArray(e))return e}function FSe(e,t){if(e==null)return{};var n,i,r=$Se(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function $Se(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function Lu(){return Lu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Lu.apply(null,arguments)}function _3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Yn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_3(Object(n),!0).forEach(function(i){VSe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function VSe(e,t,n){return(t=zSe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zSe(e){var t=qSe(e,"string");return typeof t=="symbol"?t:t+""}function qSe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xo={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Mr.axis};function WSe(e){var t=e.x,n=e.y,i=e.width,r=e.height,s=e.orientation,l=e.mirror,c=e.axisLine,h=e.otherSvgProps;if(!c)return null;var d=Yn(Yn(Yn({},h),Ca(c)),{},{fill:"none"});if(s==="top"||s==="bottom"){var f=+(s==="top"&&!l||s==="bottom"&&l);d=Yn(Yn({},d),{},{x1:t,y1:n+f*r,x2:t+i,y2:n+f*r})}else{var p=+(s==="left"&&!l||s==="right"&&l);d=Yn(Yn({},d),{},{x1:t+p*i,y1:n,x2:t+p*i,y2:n+r})}return w.createElement("line",Lu({},d,{className:Rn("recharts-cartesian-axis-line",Fu(c,"className"))}))}function HSe(e,t,n,i,r,s,l,c,h){var d,f,p,v,x,b,S=c?-1:1,N=e.tickSize||l,j=Xe(e.tickCoord)?e.tickCoord:e.coordinate;switch(s){case"top":d=f=e.coordinate,v=n+ +!c*r,p=v-S*N,b=p-S*h,x=j;break;case"left":p=v=e.coordinate,f=t+ +!c*i,d=f-S*N,x=d-S*h,b=j;break;case"right":p=v=e.coordinate,f=t+ +c*i,d=f+S*N,x=d+S*h,b=j;break;default:d=f=e.coordinate,v=n+ +c*r,p=v+S*N,b=p+S*h,x=j;break}return{line:{x1:d,y1:p,x2:f,y2:v},tick:{x,y:b}}}function KSe(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function GSe(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function YSe(e){var t=e.option,n=e.tickProps,i=e.value,r,s=Rn(n.className,"recharts-cartesian-axis-tick-value");if(w.isValidElement(t))r=w.cloneElement(t,Yn(Yn({},n),{},{className:s}));else if(typeof t=="function")r=t(Yn(Yn({},n),{},{className:s}));else{var l="recharts-cartesian-axis-tick-value";
729typeof t!="boolean"&&(l=Rn(l,z1e(t))),r=w.createElement(x2,Lu({},n,{className:l}),i)}return r}function QSe(e){var t=e.ticks,n=e.axisType,i=e.axisId,r=wi();return w.useEffect(()=>{if(i==null||n==null)return Oh;var s=t.map(l=>({value:l.value,coordinate:l.coordinate,offset:l.offset,index:l.index}));return r(MSe({ticks:s,axisId:i,axisType:n})),()=>{r(RSe({axisId:i,axisType:n}))}},[r,t,i,n]),null}var XSe=w.forwardRef((e,t)=>{var n=e.ticks,i=n===void 0?[]:n,r=e.tick,s=e.tickLine,l=e.stroke,c=e.tickFormatter,h=e.unit,d=e.padding,f=e.tickTextProps,p=e.orientation,v=e.mirror,x=e.x,b=e.y,S=e.width,N=e.height,j=e.tickSize,T=e.tickMargin,E=e.fontSize,C=e.letterSpacing,P=e.getTicksConfig,A=e.events,M=e.axisType,R=e.axisId,B=k2(Yn(Yn({},P),{},{ticks:i}),E,C),U=Ca(P),O=Ey(r),F=PV(U.textAnchor)?U.textAnchor:KSe(p,v),ne=GSe(p,v),re={};typeof s=="object"&&(re=s);var Q=Yn(Yn({},U),{},{fill:"none"},re),W=B.map(ge=>Yn({entry:ge},HSe(ge,x,b,S,N,p,j,v,T))),q=W.map(ge=>{var ue=ge.entry,L=ge.line;return w.createElement(Hs,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(ue.value,"-").concat(ue.coordinate,"-").concat(ue.tickCoord)},s&&w.createElement("line",Lu({},Q,L,{className:Rn("recharts-cartesian-axis-tick-line",Fu(s,"className"))})))}),$=W.map((ge,ue)=>{var L,J,ye=ge.entry,Pe=ge.tick,Oe=Yn(Yn(Yn(Yn({verticalAnchor:ne},U),{},{textAnchor:F,stroke:"none",fill:l},Pe),{},{index:ue,payload:ye,visibleTicksCount:B.length,tickFormatter:c,padding:d},f),{},{angle:(L=(J=f==null?void 0:f.angle)!==null&&J!==void 0?J:U.angle)!==null&&L!==void 0?L:0}),je=Yn(Yn({},Oe),O);return w.createElement(Hs,Lu({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ye.value,"-").concat(ye.coordinate,"-").concat(ye.tickCoord)},sce(A,ye,ue)),r&&w.createElement(YSe,{option:r,tickProps:je,value:"".concat(typeof c=="function"?c(ye.value,ue):ye.value).concat(h||"")}))});return w.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(M,"-ticks")},w.createElement(QSe,{ticks:B,axisId:R,axisType:M}),$.length>0&&w.createElement(dl,{zIndex:Mr.label},w.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(M,"-tick-labels"),ref:t},$)),q.length>0&&w.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(M,"-tick-lines")},q))}),JSe=w.forwardRef((e,t)=>{var n=e.axisLine,i=e.width,r=e.height,s=e.className,l=e.hide,c=e.ticks,h=e.axisType,d=e.axisId,f=FSe(e,ISe),p=w.useState(""),v=A3(p,2),x=v[0],b=v[1],S=w.useState(""),N=A3(S,2),j=N[0],T=N[1],E=w.useRef(null);w.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var P;return PSe({ticks:E.current,label:(P=e.labelRef)===null||P===void 0?void 0:P.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var C=w.useCallback(P=>{if(P){var A=P.getElementsByClassName("recharts-cartesian-axis-tick-value");E.current=A;var M=A[0];if(M){var R=window.getComputedStyle(M),B=R.fontSize,U=R.letterSpacing;(B!==x||U!==j)&&(b(B),T(U))}}},[x,j]);return l||i!=null&&i<=0||r!=null&&r<=0?null:w.createElement(dl,{zIndex:e.zIndex},w.createElement(Hs,{className:Rn("recharts-cartesian-axis",s)},w.createElement(WSe,{x:e.x,y:e.y,width:i,height:r,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Ca(e)}),w.createElement(XSe,{ref:C,axisType:h,events:f,fontSize:x,getTicksConfig:e,height:e.height,letterSpacing:j,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:d}),w.createElement(S1e,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},w.createElement(M1e,{label:e.label,labelRef:e.labelRef}),e.children)))}),N2=w.forwardRef((e,t)=>{var n=Ys(e,Xo);return w.createElement(JSe,Lu({},n,{ref:t}))});N2.displayName="CartesianAxis";var ZSe=["x1","y1","x2","y2","key"],eke=["offset"],tke=["xAxisId","yAxisId"],nke=["xAxisId","yAxisId"];function M3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function yr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
729t%2?M3(Object(n),!0).forEach(function(i){ike(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function ike(e,t,n){return(t=rke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rke(e){var t=ske(e,"string");return typeof t=="symbol"?t:t+""}function ske(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hu(){return hu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},hu.apply(null,arguments)}function Bx(e,t){if(e==null)return{};var n,i,r=ake(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ake(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var oke=e=>{var t=e.fill;if(!t||t==="none")return null;var n=e.fillOpacity,i=e.x,r=e.y,s=e.width,l=e.height,c=e.ry;return w.createElement("rect",{x:i,y:r,ry:c,width:s,height:l,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function JV(e){var t=e.option,n=e.lineItemProps,i;if(w.isValidElement(t))i=w.cloneElement(t,n);else if(typeof t=="function")i=t(n);else{var r,s=n.x1,l=n.y1,c=n.x2,h=n.y2,d=n.key,f=Bx(n,ZSe),p=(r=Ca(f))!==null&&r!==void 0?r:{};p.offset;var v=Bx(p,eke);i=w.createElement("line",hu({},v,{x1:s,y1:l,x2:c,y2:h,fill:"none",key:d}))}return i}function lke(e){var t=e.x,n=e.width,i=e.horizontal,r=i===void 0?!0:i,s=e.horizontalPoints;if(!r||!s||!s.length)return null;e.xAxisId,e.yAxisId;var l=Bx(e,tke),c=s.map((h,d)=>{var f=yr(yr({},l),{},{x1:t,y1:h,x2:t+n,y2:h,key:"line-".concat(d),index:d});return w.createElement(JV,{key:"line-".concat(d),option:r,lineItemProps:f})});return w.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function cke(e){var t=e.y,n=e.height,i=e.vertical,r=i===void 0?!0:i,s=e.verticalPoints;if(!r||!s||!s.length)return null;e.xAxisId,e.yAxisId;var l=Bx(e,nke),c=s.map((h,d)=>{var f=yr(yr({},l),{},{x1:h,y1:t,x2:h,y2:t+n,key:"line-".concat(d),index:d});return w.createElement(JV,{option:r,lineItemProps:f,key:"line-".concat(d)})});return w.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function uke(e){var t=e.horizontalFill,n=e.fillOpacity,i=e.x,r=e.y,s=e.width,l=e.height,c=e.horizontalPoints,h=e.horizontal,d=h===void 0?!0:h;if(!d||!t||!t.length||c==null)return null;var f=c.map(v=>Math.round(v+r-r)).sort((v,x)=>v-x);r!==f[0]&&f.unshift(0);var p=f.map((v,x)=>{var b=f[x+1],S=b==null,N=S?r+l-v:b-v;if(N<=0)return null;var j=x%t.length;return w.createElement("rect",{key:"react-".concat(x),y:v,x:i,height:N,width:s,stroke:"none",fill:t[j],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function dke(e){var t=e.vertical,n=t===void 0?!0:t,i=e.verticalFill,r=e.fillOpacity,s=e.x,l=e.y,c=e.width,h=e.height,d=e.verticalPoints;if(!n||!i||!i.length)return null;var f=d.map(v=>Math.round(v+s-s)).sort((v,x)=>v-x);s!==f[0]&&f.unshift(0);var p=f.map((v,x)=>{var b=f[x+1],S=b==null,N=S?s+c-v:b-v;if(N<=0)return null;var j=x%i.length;return w.createElement("rect",{key:"react-".concat(x),x:v,y:l,width:N,height:h,stroke:"none",fill:i[j],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var hke=(e,t)=>{var n=e.xAxis,i=e.width,r=e.height,s=e.offset;return M9(k2(yr(yr(yr({},Xo),n),{},{ticks:R9(n),viewBox:{x:0,y:0,width:i,height:r}})),s.left,s.left+s.width,t)},fke=(e,t)=>{var n=e.yAxis,i=e.width,r=e.height,s=e.offset;return M9(k2(yr(yr(yr({},Xo),n),{}
729,{ticks:R9(n),viewBox:{x:0,y:0,width:i,height:r}})),s.top,s.top+s.height,t)},mke={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Mr.grid};function gb(e){var t=$9(),n=V9(),i=F9(),r=yr(yr({},Ys(e,mke)),{},{x:Xe(e.x)?e.x:i.left,y:Xe(e.y)?e.y:i.top,width:Xe(e.width)?e.width:i.width,height:Xe(e.height)?e.height:i.height}),s=r.xAxisId,l=r.yAxisId,c=r.x,h=r.y,d=r.width,f=r.height,p=r.syncWithTicks,v=r.horizontalValues,x=r.verticalValues,b=ns(),S=st(B=>OD(B,"xAxis",s,b)),N=st(B=>OD(B,"yAxis",l,b));if(!oo(d)||!oo(f)||!Xe(c)||!Xe(h))return null;var j=r.verticalCoordinatesGenerator||hke,T=r.horizontalCoordinatesGenerator||fke,E=r.horizontalPoints,C=r.verticalPoints;if((!E||!E.length)&&typeof T=="function"){var P=v&&v.length,A=T({yAxis:N?yr(yr({},N),{},{ticks:P?v:N.ticks}):void 0,width:t??d,height:n??f,offset:i},P?!0:p);dx(Array.isArray(A),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof A,"]")),Array.isArray(A)&&(E=A)}if((!C||!C.length)&&typeof j=="function"){var M=x&&x.length,R=j({xAxis:S?yr(yr({},S),{},{ticks:M?x:S.ticks}):void 0,width:t??d,height:n??f,offset:i},M?!0:p);dx(Array.isArray(R),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof R,"]")),Array.isArray(R)&&(C=R)}return w.createElement(dl,{zIndex:r.zIndex},w.createElement("g",{className:"recharts-cartesian-grid"},w.createElement(oke,{fill:r.fill,fillOpacity:r.fillOpacity,x:r.x,y:r.y,width:r.width,height:r.height,ry:r.ry}),w.createElement(uke,hu({},r,{horizontalPoints:E})),w.createElement(dke,hu({},r,{verticalPoints:C})),w.createElement(lke,hu({},r,{offset:i,horizontalPoints:E,xAxis:S,yAxis:N})),w.createElement(cke,hu({},r,{offset:i,verticalPoints:C,xAxis:S,yAxis:N}))))}gb.displayName="CartesianGrid";var pke={},ZV=Sr({name:"errorBars",initialState:pke,reducers:{addErrorBar:(e,t)=>{var n=t.payload,i=n.itemId,r=n.errorBar;e[i]||(e[i]=[]),e[i].push(r)},replaceErrorBar:(e,t)=>{var n=t.payload,i=n.itemId,r=n.prev,s=n.next;e[i]&&(e[i]=e[i].map(l=>l.dataKey===r.dataKey&&l.direction===r.direction?s:l))},removeErrorBar:(e,t)=>{var n=t.payload,i=n.itemId,r=n.errorBar;e[i]&&(e[i]=e[i].filter(s=>s.dataKey!==r.dataKey||s.direction!==r.direction))}}}),j2=ZV.actions;j2.addErrorBar;j2.replaceErrorBar;j2.removeErrorBar;var gke=ZV.reducer;function ez(e,t){var n,i,r=st(d=>ll(d,e)),s=st(d=>cl(d,t)),l=(n=r==null?void 0:r.allowDataOverflow)!==null&&n!==void 0?n:Ni.allowDataOverflow,c=(i=s==null?void 0:s.allowDataOverflow)!==null&&i!==void 0?i:ji.allowDataOverflow,h=l||c;return{needClip:h,needClipX:l,needClipY:c}}function vke(e){var t=e.xAxisId,n=e.yAxisId,i=e.clipPathId,r=S2(),s=ez(t,n),l=s.needClipX,c=s.needClipY,h=s.needClip,d=st(E=>B$(E,t,!1)),f=st(E=>F$(E,n,!1));if(!h||!r)return null;var p=r.x,v=r.y,x=r.width,b=r.height,S=l&&d?Math.min(d[0],d[1]):p-x/2,N=c&&f?Math.min(f[0],f[1]):v-b/2,j=l&&d?Math.abs(d[1]-d[0]):x*2,T=c&&f?Math.abs(f[1]-f[0]):b*2;return w.createElement("clipPath",{id:"clipPath-".concat(i)},w.createElement("rect",{x:S,y:N,width:j,height:T}))}function xke(e){var t=Ey(e),n=3,i=2;if(t!=null){var r=t.r,s=t.strokeWidth,l=Number(r),c=Number(s);return(Number.isNaN(l)||l<0)&&(l=n),(Number.isNaN(c)||c<0)&&(c=i),{r:l,strokeWidth:c}}return{r:n,strokeWidth:i}}function C2(e,t){var n,i;return(n=(i=e.graphicalItems.cartesianItems.find(r=>r.id===t))===null||i===void 0?void 0:i.xAxisId)!==null&&n!==void 0?n:WV}function T2(e,t){var n,i;return(n=(i=e.graphicalItems.cartesianItems.find(r=>r.id===t))===null||i===void 0?void 0:i.yAxisId)!==null&&n!==void 0?n:WV}var tz=(e,t,n)=>G$(e,"xAxis",C2(e,t),n),nz=(e,t,n)=>K$(e,"xAxis",C2(e,t),n),iz=(e,t,n)=>G$(e,"yAxis",T2(e,t),n),rz=(e,t,n)=>K$(e,"yAxis",T2(e,t),n),yke=pe([Fn,tz,iz,nz,rz],(e,t,n,i,r)=>uo(e,"xAxis")?ux(t,i,!1):ux(n,r,!1)),bke=(e,t)=>t,sz=pe([f$,bke],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),az=e=>{var t=Fn(e),n=uo(t,"xAxis");return n?"yAxis":"xAxis"},wke=(e,t)=>{var n=az(e);return n==="yAxis"?T2(e,t):C2(e,t)},Ske=(e,t,n)=>k$(e,az(e),wke(e,t),n),kke=pe([sz,Ske],(e,t)=>{var n;
729if(!(e==null||t==null)){var i=e.stackId,r=CT(e);if(!(i==null||r==null)){var s=(n=t[i])===null||n===void 0?void 0:n.stackedData,l=s==null?void 0:s.find(c=>c.key===r);if(l!=null)return l.map(c=>[c[0],c[1]])}}}),Nke=pe([Fn,tz,iz,nz,rz,kke,Yme,yke,sz,hpe],(e,t,n,i,r,s,l,c,h,d)=>{var f=l.chartData,p=l.dataStartIndex,v=l.dataEndIndex;if(!(h==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||i==null||r==null||i.length===0||r.length===0||c==null)){var x=h.data,b;if(x&&x.length>0?b=x:b=f==null?void 0:f.slice(p,v+1),b!=null)return Qke({layout:e,xAxis:t,yAxis:n,xAxisTicks:i,yAxisTicks:r,dataStartIndex:p,areaSettings:h,stackedData:s,displayedData:b,chartBaseValue:d,bandSize:c})}}),jke=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],Cke=["id","baseLine"];function Mm(){return Mm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Mm.apply(null,arguments)}function R3(e,t){if(e==null)return{};var n,i,r=Tke(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tke(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function Eke(e){var t,n,i=e.alpha,r=e.baseLine,s=e.points,l=e.strokeWidth,c=(t=s[0])===null||t===void 0?void 0:t.x,h=(n=s[s.length-1])===null||n===void 0?void 0:n.x;if(!Mt(c)||!Mt(h))return null;var d=i*Math.abs(c-h),f=Math.max(...s.map(p=>p.y||0));return Xe(r)?f=Math.max(r,f):r&&Array.isArray(r)&&r.length&&(f=Math.max(...r.map(p=>p.y||0),f)),Xe(f)?w.createElement("rect",{x:c<h?c:c-d,y:0,width:d,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}function Ake(e){var t,n,i=e.alpha,r=e.baseLine,s=e.points,l=e.strokeWidth,c=(t=s[0])===null||t===void 0?void 0:t.y,h=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Mt(c)||!Mt(h))return null;var d=i*Math.abs(c-h),f=Math.max(...s.map(p=>p.x||0));return Xe(r)?f=Math.max(r,f):r&&Array.isArray(r)&&r.length&&(f=Math.max(...r.map(p=>p.x||0),f)),Xe(f)?w.createElement("rect",{x:0,y:c<h?c:c-d,width:f+(l?parseInt("".concat(l),10):1),height:Math.floor(d)}):null}function Pke(e){var t=e.alpha,n=e.layout,i=e.points,r=e.baseLine,s=e.strokeWidth;return n==="vertical"?w.createElement(Ake,{alpha:t,points:i,baseLine:r,strokeWidth:s}):w.createElement(Eke,{alpha:t,points:i,baseLine:r,strokeWidth:s})}function _ke(e){var t=e.animationElapsedTime,n=t===void 0?1:t,i=e.isAnimating,r=i===void 0?!1:i,s=e.isEntrance,l=s===void 0?!1:s,c=e.layout,h=e.isRange,d=e.stroke,f=e.connectNulls,p=R3(e,jke),v=c==="vertical"?"vertical":"horizontal",x=f??!1,b=zV(),S=p.id,N=p.baseLine,j=R3(p,Cke),T=Ca(j),E=w.createElement(uv,Mm({},p,{id:S,baseLine:N,connectNulls:x,stroke:"none",className:"recharts-area-area",layout:v})),C=d!=="none"&&w.createElement(uv,Mm({},T,{className:"recharts-area-curve",layout:v,type:p.type,connectNulls:x,fill:"none",stroke:d,points:p.points})),P=d!=="none"&&h&&Array.isArray(N)&&w.createElement(uv,Mm({},T,{className:"recharts-area-curve",layout:v,type:p.type,connectNulls:x,fill:"none",stroke:d,points:N}));if(l&&(r||n<1)){var A;return w.createElement(Hs,null,w.createElement("defs",null,w.createElement("clipPath",{id:b},w.createElement(Pke,{alpha:n,points:(A=p.points)!==null&&A!==void 0?A:[],baseLine:N,layout:v,strokeWidth:p.strokeWidth}))),w.createElement(Hs,{clipPath:"url(#".concat(b,")")},E,C,P))}return w.createElement(w.Fragment,null,E,C,P)}var Mke=["id"],Rke=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Fx(){return Fx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Fx.apply(null,arguments)}function oz(e,t){if(e==null)return{};var n,i,r=Oke(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Oke(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function O3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Eh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
729t%2?O3(Object(n),!0).forEach(function(i){Ike(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Ike(e,t,n){return(t=Dke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dke(e){var t=Lke(e,"string");return typeof t=="symbol"?t:t+""}function Lke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Uke=(e,t)=>e==null?[]:t===1?e.flatMap(n=>n.status==="removed"?[]:[n.next]):e.flatMap(n=>n.status==="matched"?[Eh(Eh({},n.next),{},{x:Ho(n.prev.x,n.next.x,t),y:Ho(n.prev.y,n.next.y,t)})]:n.status==="added"?[n.next]:[]),lz={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:b2,animationInterpolateFn:Uke,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:_ke,xAxisId:0,yAxisId:0,zIndex:Mr.area};function $x(e,t){return e&&e!=="none"?e:t}var Bke=e=>{var t=e.dataKey,n=e.name,i=e.stroke,r=e.fill,s=e.legendType,l=e.hide;return[{inactive:l,dataKey:t,type:s,color:$x(i,r),value:O9(n,t),payload:e}]},Fke=w.memo(e=>{var t=e.dataKey,n=e.data,i=e.stroke,r=e.strokeWidth,s=e.fill,l=e.name,c=e.hide,h=e.unit,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:Oh,settings:{stroke:i,strokeWidth:r,fill:s,dataKey:t,nameKey:void 0,name:O9(l,t),hide:c,type:d,color:$x(i,s),unit:h,graphicalItemId:f}};return w.createElement(J1e,{tooltipEntrySettings:p})});function $ke(e){var t=e.clipPathId,n=e.points,i=e.props,r=i.needClip,s=i.dot,l=i.dataKey,c=Ca(i);return w.createElement($we,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:l,baseProps:c,needClip:r,clipPathId:t})}function Vke(e){var t=e.showLabels,n=e.children,i=e.points,r=i.map(s=>{var l,c,h={x:(l=s.x)!==null&&l!==void 0?l:0,y:(c=s.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Eh(Eh({},h),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:h,fill:void 0})});return w.createElement(L1e,{value:t?r:void 0},n)}function zke(e){var t=e.points,n=e.baseLine,i=e.needClip,r=e.clipPathId,s=e.props,l=e.animationElapsedTime,c=e.isAnimating,h=e.isEntrance,d=s.layout,f=s.type,p=s.stroke,v=s.connectNulls,x=s.isRange,b=s.shape,S=s.id,N=oz(s,Mke),j=Ws(N),T=Eh(Eh({},j),{},{id:S,points:t,connectNulls:v,type:f,baseLine:n,layout:d,stroke:p,isRange:x,animationElapsedTime:l,isAnimating:c,isEntrance:h});return w.createElement(w.Fragment,null,(t==null?void 0:t.length)>1&&w.createElement(Hs,{clipPath:i?"url(#clipPath-".concat(r,")"):void 0},w.createElement(X1e,{option:b,DefaultShape:lz.shape,shapeProps:T})),w.createElement($ke,{points:t,props:N,clipPathId:r}))}function qke(e,t,n){if(Xe(e)){var i=Xe(t)?t:void 0;return Ho(i,e,n)}if(dr(e)||so(e)){var r=Xe(t)?t:void 0;return Ho(r,0,n)}return e}function Wke(e){var t=e.needClip,n=e.clipPathId,i=e.props,r=e.previousPointsRef,s=e.previousBaselineRef,l=i.points,c=i.baseLine,h=i.isAnimationActive,d=i.animationBegin,f=i.animationDuration,p=i.animationEasing,v=i.animationMatchBy,x=i.animationInterpolateFn,b=w.useMemo(()=>({points:l,baseLine:c}),[l,c]),S=VV(b,s),N=hT(),j=pwe(i.onAnimationStart,i.onAnimationEnd),T=j.isAnimating,E=j.handleAnimationStart,C=j.handleAnimationEnd,P=S.startValue;if(N==null)return null;var A;return Array.isArray(c)&&Array.isArray(P)?A=bj(P,c,v):Array.isArray(c)?A=bj(null,c,v):A=null,w.createElement(gwe,{animationInput:b,animationIdPrefix:"recharts-area-",items:l,previousItemsRef:r,isAnimationActive:h,animationBegin:d,animationDuration:f,animationEasing:p,onAnimationStart:E,onAnimationEnd:C,animationInterpolateFn:x,animationMatchBy:v,layout:N},(M,R,B)=>{var U;return R===1?U=c:Array.isArray(c)?U=x(A,R,N):U=B?c:qke(c,P,R),S.syncStepValue(U,R),w.createElement(Vke,{showLabels:!T,points:l},i.children,w.createElement(zke,{points:M,baseLine:U,needClip:t,clipPathId:n,props:i,animationElapsedTime:R,isAnimating:T||R<1,isEntrance:B}),w.createElement(F1e,{label:i.label}))})}function Hke(e){var t=e.needClip,n=e.clipPathId,i=e.props,r=w.useRef(null),s=w.useRef();return w.createElement(Wke,{needClip:t,clipPathId:n,props:i,previousPointsRef:r,previousBaselineRef:s})}class Kke extends w.PureComponent{render(){var t=this.props,n=t.hide,i=t.dot,r=t.points,s=t.className,l=t.top,c=t.left,h=t.needClip,d=t.xAxisId,f=t.yAxisId,p=t.width,v=t.height,x=t.id,b=t.baseLine,S=t.zIndex;if(n)return null;var N=Rn("recharts-area",s),j=x,T=xke(i),E=T.r,C=T.strokeWidth,P=FV(i),A=E*2+C,M=h?"url(#clipPath-".concat(P?"":"dots-").concat(j,")"):void 0;return w.createElement(dl,{zIndex:S},w.createElement(Hs,{className:N},h&&w.createElement("defs",null,w.createElement(vke,{clipPathId:j,xAxisId:d,yAxisId:f}),!P&&w.createElement("clipPath",{id:"clipPath-dots-".concat(j)},w.createElement("rect",{x:c-A/2,y:l-A/2,width:p+A,height:v+A}))),w.createElement(Hke,{needClip:h,clipPathId:j,props:this.props})),w.createElement(j3,{points:r,mainColor:$x(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:M}),this.props.isRange&&Array.isArray(b)&&w.createElement(j3,{points:b,mainColor:$x(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:M}))}}function Gke(e){var t,n=e.activeDot,i=e.animationBegin,r=e.animationDuration,s=e.animationEasing,l=e.connectNulls,c=e.dot,h=e.fill,d=e.fillOpacity,f=e.hide,p=e.isAnimationActive,v=e.legendType,x=e.stroke,b=e.xAxisId,S=e.yAxisId,N=oz(e,Rke),j=Ih(),T=vV(),E=ez(b,S),C=E.needClip,P=ns(),A=(t=st(Q=>Nke(Q,e.id,P)))!==null&&t!==void 0?t:{}
729,M=A.points,R=A.isRange,B=A.baseLine,U=S2();if(j!=="horizontal"&&j!=="vertical"||U==null||T!=="AreaChart"&&T!=="ComposedChart")return null;var O=U.height,F=U.width,ne=U.x,re=U.y;return!M||!M.length?null:w.createElement(Kke,Fx({},N,{activeDot:n,animationBegin:i,animationDuration:r,animationEasing:s,baseLine:B,connectNulls:l,dot:c,fill:h,fillOpacity:d,height:O,hide:f,layout:j,isAnimationActive:p,isRange:R,legendType:v,needClip:C,points:M,stroke:x,width:F,left:ne,top:re,xAxisId:b,yAxisId:S}))}var Yke=(e,t,n,i,r)=>{var s=n??t;if(Xe(s))return s;var l=e==="horizontal"?r:i,c=l.scale.domain();if(l.type==="number"){var h=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return s==="dataMin"?d:s==="dataMax"||h<0?h:Math.max(Math.min(c[0],c[1]),0)}return s==="dataMin"?c[0]:s==="dataMax"?c[1]:c[0]};function Qke(e){var t=e.areaSettings,n=t.connectNulls,i=t.baseValue,r=t.dataKey,s=e.stackedData,l=e.layout,c=e.chartBaseValue,h=e.xAxis,d=e.yAxis,f=e.displayedData,p=e.dataStartIndex,v=e.xAxisTicks,x=e.yAxisTicks,b=e.bandSize,S=s&&s.length,N=Yke(l,c,i,h,d),j=l==="horizontal",T=!1,E=f.map((P,A)=>{var M,R,B,U;if(S)U=s[p+A];else{var O=Vi(P,r);Array.isArray(O)?(U=O,T=!0):U=[N,O]}var F=(M=(R=U)===null||R===void 0?void 0:R[1])!==null&&M!==void 0?M:null,ne=F==null||S&&!n&&Vi(P,r)==null;if(j){var re;return{x:AO({axis:h,ticks:v,bandSize:b,entry:P,index:A}),y:ne?null:(re=d.scale.map(F))!==null&&re!==void 0?re:null,value:U,payload:P}}return{x:ne?null:(B=h.scale.map(F))!==null&&B!==void 0?B:null,y:AO({axis:d,ticks:x,bandSize:b,entry:P,index:A}),value:U,payload:P}}),C;return S||T?C=E.map(P=>{var A,M=Array.isArray(P.value)?P.value[0]:null;if(j){var R;return{x:P.x,y:M!=null&&P.y!=null&&(R=d.scale.map(M))!==null&&R!==void 0?R:null,payload:P.payload}}return{x:M!=null&&(A=h.scale.map(M))!==null&&A!==void 0?A:null,y:P.y,payload:P.payload}}):C=j?d.scale.map(N):h.scale.map(N),{points:E,baseLine:C??0,isRange:T}}function Xke(e){var t=Ys(e,lz),n=ns();return w.createElement(jwe,{id:t.id,type:"area"},i=>w.createElement(w.Fragment,null,w.createElement(Z1e,{legendPayload:Bke(t)}),w.createElement(Fke,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:i}),w.createElement(Mwe,{type:"area",id:i,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Dde(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),w.createElement(Gke,Fx({},t,{id:i}))))}var Ah=w.memo(Xke,Qy);Ah.displayName="Area";var Jke=["domain","range"],Zke=["domain","range"];function I3(e,t){if(e==null)return{};var n,i,r=eNe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function eNe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function D3(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function cz(e,t){if(e===t)return!0;var n=e.domain,i=e.range,r=I3(e,Jke),s=t.domain,l=t.range,c=I3(t,Zke);return!D3(n,s)||!D3(i,l)?!1:Qy(r,c)}var tNe=["type"],nNe=["dangerouslySetInnerHTML","ticks","scale"],iNe=["id","scale"];function wj(){return wj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},wj.apply(null,arguments)}function L3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function U3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?L3(Object(n),!0).forEach(function(i){rNe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function rNe(e,t,n){return(t=sNe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sNe(e){var t=aNe(e,"string");return typeof t=="symbol"?t:t+""}function aNe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sj(e,t){if(e==null)return{};var n,i,r=oNe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function oNe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function lNe(e){var t=wi(),n=w.useRef(null),i=hT(),r=e.type,s=Sj(e,tNe),l=eb(i,"xAxis",r),c=w.useMemo(()=>
729{if(l!=null)return U3(U3({},s),{},{type:l})},[s,l]);return w.useLayoutEffect(()=>{c!=null&&(n.current===null?t(Hwe(c)):n.current!==c&&t(Kwe({prev:n.current,next:c})),n.current=c)},[c,t]),w.useLayoutEffect(()=>()=>{n.current&&(t(Gwe(n.current)),n.current=null)},[t]),null}var cNe=e=>{var t=e.xAxisId,n=e.className,i=st(D9),r=ns(),s="xAxis",l=st(v=>H$(v,s,t,r)),c=st(v=>qve(v,t)),h=st(v=>Qve(v,t)),d=st(v=>c$(v,t));if(c==null||h==null||d==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var f=Sj(e,nNe);d.id,d.scale;var p=Sj(d,iNe);return w.createElement(N2,wj({},f,p,{x:h.x,y:h.y,width:c.width,height:c.height,className:Rn("recharts-".concat(s," ").concat(s),n),viewBox:i,ticks:l,axisType:s,axisId:t}))},uNe={allowDataOverflow:Ni.allowDataOverflow,allowDecimals:Ni.allowDecimals,allowDuplicatedCategory:Ni.allowDuplicatedCategory,angle:Ni.angle,axisLine:Xo.axisLine,height:Ni.height,hide:!1,includeHidden:Ni.includeHidden,interval:Ni.interval,label:!1,minTickGap:Ni.minTickGap,mirror:Ni.mirror,orientation:Ni.orientation,padding:Ni.padding,reversed:Ni.reversed,scale:Ni.scale,tick:Ni.tick,tickCount:Ni.tickCount,tickLine:Xo.tickLine,tickSize:Xo.tickSize,type:Ni.type,niceTicks:Ni.niceTicks,xAxisId:0},dNe=e=>{var t=Ys(e,uNe);return w.createElement(w.Fragment,null,w.createElement(lNe,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),w.createElement(cNe,t))},vb=w.memo(dNe,cz);vb.displayName="XAxis";var hNe=["type"],fNe=["dangerouslySetInnerHTML","ticks","scale"],mNe=["id","scale"];function kj(){return kj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},kj.apply(null,arguments)}function B3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function F3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?B3(Object(n),!0).forEach(function(i){pNe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function pNe(e,t,n){return(t=gNe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gNe(e){var t=vNe(e,"string");return typeof t=="symbol"?t:t+""}function vNe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nj(e,t){if(e==null)return{};var n,i,r=xNe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xNe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function yNe(e){var t=wi(),n=w.useRef(null),i=hT(),r=e.type,s=Nj(e,hNe),l=eb(i,"yAxis",r),c=w.useMemo(()=>{if(l!=null)return F3(F3({},s),{},{type:l})},[l,s]);return w.useLayoutEffect(()=>{c!=null&&(n.current===null?t(Ywe(c)):n.current!==c&&t(Qwe({prev:n.current,next:c})),n.current=c)},[c,t]),w.useLayoutEffect(()=>()=>{n.current&&(t(Xwe(n.current)),n.current=null)},[t]),null}function bNe(e){var t=e.yAxisId,n=e.className,i=e.width,r=e.label,s=w.useRef(null),l=w.useRef(null),c=st(D9),h=ns(),d=wi(),f="yAxis",p=st(j=>Zve(j,t)),v=st(j=>Jve(j,t)),x=st(j=>H$(j,f,t,h)),b=st(j=>u$(j,t));if(w.useLayoutEffect(()=>{if(!(i!=="auto"||!p||y2(r)||w.isValidElement(r)||b==null)){var j=s.current;if(j){var T=j.getCalculatedWidth();Math.round(p.width)!==Math.round(T)&&d(Jwe({id:t,width:T}))}}},[x,p,d,r,t,i,b]),p==null||v==null||b==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var S=Nj(e,fNe);b.id,b.scale;var N=Nj(b,mNe);return w.createElement(N2,kj({},S,N,{ref:s,labelRef:l,x:v.x,y:v.y,tickTextProps:i==="auto"?{width:void 0}:{width:i},width:p.width,height:p.height,className:Rn("recharts-".concat(f," ").concat(f),n),viewBox:c,ticks:x,axisType:f,axisId:t}))}var wNe={allowDataOverflow:ji.allowDataOverflow,allowDecimals:ji.allowDecimals,allowDuplicatedCategory:ji.allowDuplicatedCategory,angle:ji.angle,axisLine
729:Xo.axisLine,hide:!1,includeHidden:ji.includeHidden,interval:ji.interval,label:!1,minTickGap:ji.minTickGap,mirror:ji.mirror,orientation:ji.orientation,padding:ji.padding,reversed:ji.reversed,scale:ji.scale,tick:ji.tick,tickCount:ji.tickCount,tickLine:Xo.tickLine,tickSize:Xo.tickSize,type:ji.type,niceTicks:ji.niceTicks,width:ji.width,yAxisId:0},SNe=e=>{var t=Ys(e,wNe);return w.createElement(w.Fragment,null,w.createElement(yNe,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),w.createElement(bNe,t))},xb=w.memo(SNe,cz);xb.displayName="YAxis";var kNe=(e,t)=>t,E2=pe([kNe,Fn,NF,Hi,dV,ul,wye,hr],Eye);function NNe(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function A2(e){var t=e.currentTarget.getBoundingClientRect(),n,i;if(NNe(e)){var r=e.currentTarget.getBBox();n=r.width>0?t.width/r.width:1,i=r.height>0?t.height/r.height:1}else{var s=e.currentTarget;n=s.offsetWidth>0?t.width/s.offsetWidth:1,i=s.offsetHeight>0?t.height/s.offsetHeight:1}var l=(c,h)=>({relativeX:Math.round((c-t.left)/n),relativeY:Math.round((h-t.top)/i)});return"touches"in e?Array.from(e.touches).map(c=>l(c.clientX,c.clientY)):l(e.clientX,e.clientY)}var uz=ws("mouseClick"),dz=jp();dz.startListening({actionCreator:uz,effect:(e,t)=>{var n=e.payload,i=E2(t.getState(),A2(n));(i==null?void 0:i.activeIndex)!=null&&t.dispatch(mxe({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}});var jj=ws("mouseMove"),hz=jp(),Od=null,Vc=null,ok=null;hz.startListening({actionCreator:jj,effect:(e,t)=>{var n=e.payload,i=t.getState(),r=i.eventSettings,s=r.throttleDelay,l=r.throttledEvents,c=l==="all"||(l==null?void 0:l.includes("mousemove"));Od!==null&&(cancelAnimationFrame(Od),Od=null),Vc!==null&&(typeof s!="number"||!c)&&(clearTimeout(Vc),Vc=null),ok=A2(n);var h=()=>{var d=t.getState(),f=Up(d,d.tooltip.settings.shared);if(!ok){Od=null,Vc=null;return}if(f==="axis"){var p=E2(d,ok);(p==null?void 0:p.activeIndex)!=null?t.dispatch(tV({activeIndex:p.activeIndex,activeDataKey:void 0,activeCoordinate:p.activeCoordinate})):t.dispatch(eV())}Od=null,Vc=null};if(!c){h();return}s==="raf"?Od=requestAnimationFrame(h):typeof s=="number"&&Vc===null&&(Vc=setTimeout(h,s))}});function jNe(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var $3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},fz=Sr({name:"rootProps",initialState:$3,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:$3.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),CNe=fz.reducer,TNe=fz.actions.updateOptions,ENe=null,ANe={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},mz=Sr({name:"polarOptions",initialState:ENe,reducers:ANe});mz.actions.updatePolarOptions;var PNe=mz.reducer,pz=ws("keyDown"),gz=ws("focus"),vz=ws("blur"),yb=jp(),Id=null,zc=null,E0=null;yb.startListening({actionCreator:pz,effect:(e,t)=>{E0=e.payload,Id!==null&&(cancelAnimationFrame(Id),Id=null);var n=t.getState(),i=n.eventSettings,r=i.throttleDelay,s=i.throttledEvents,l=s==="all"||s.includes("keydown");zc!==null&&(typeof r!="number"||!l)&&(clearTimeout(zc),zc=null);var c=()=>{try{var h=t.getState(),d=h.rootProps.accessibilityLayer!==!1;if(!d)return;var f=h.tooltip.keyboardInteraction,p=E0;if(p!=="ArrowRight"&&p!=="ArrowLeft"&&p!=="Enter")return;var v=Pm(f,Du(h),Ch(h),Th(h)),x=v==null?-1:Number(v),b=!Number.isFinite(x)||x<0,S=ul(h),N=Du(h),j=Up(h,h.tooltip.settings.shared);if(p==="Enter"){if(b)return;var T=Ix(h,j,"hover",String(f.index));t.dispatch(Ox({active:!f.active,activeIndex:f.index,activeCoordinate:T}));return}var E=rxe(h),C=E==="left-to-right"?1:-1,P=p==="ArrowRight"?1:-1,A;if(b){var M=Ch(h),R=Th(h),B=P*C,U=Q=>({active:!1,index:String(Q),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(A=-1,B>0){for(var O=0;O<N.length;O++)if(Pm(U(O),N,M,R)!=null){A=O;break}}else for(var F=N.length-1;F>=0;F--)if(Pm(U(F),N,M,R)!=null){A=F;break}if(A<0)return}else{A=x+P*C;var ne=(S==null?void 0:S.length)||N.length;if(ne===0||A>=ne||A<0)return}var re=Ix(h,j,"hover",String(A));t.dispatch(Ox({active:!0,activeIndex:A.toString(),activeCoordinate:re}))}finally{Id=null,zc=null}};if(!l){c();return}r==="raf"?Id=requestAnimationFrame(c):typeof r=="number"&&zc===null&&(c(),E0=null,zc=setTimeout(()=>{E0?c():(zc=null,Id=null)},r))}});yb.startListening({actionCreator:gz,effect:(e,t)=>
729{var n=t.getState(),i=n.rootProps.accessibilityLayer!==!1;if(i){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var s="0",l=Up(n,n.tooltip.settings.shared),c=Ix(n,l,"hover",String(s));t.dispatch(Ox({active:!0,activeIndex:s,activeCoordinate:c}))}}}});yb.startListening({actionCreator:vz,effect:(e,t)=>{var n=t.getState(),i=n.rootProps.accessibilityLayer!==!1;if(i){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(Ox({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function xz(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(n,i)=>{if(i==="currentTarget")return t;var r=Reflect.get(n,i);return typeof r=="function"?r.bind(n):r}})}var Is=ws("externalEvent"),yz=jp(),A0=new Map,tm=new Map,lk=new Map;yz.startListening({actionCreator:Is,effect:(e,t)=>{var n=e.payload,i=n.handler,r=n.reactEvent;if(i!=null){var s=r.type,l=xz(r);lk.set(s,{handler:i,reactEvent:l});var c=A0.get(s);c!==void 0&&(cancelAnimationFrame(c),A0.delete(s));var h=t.getState(),d=h.eventSettings,f=d.throttleDelay,p=d.throttledEvents,v=p,x=v==="all"||(v==null?void 0:v.includes(s)),b=tm.get(s);b!==void 0&&(typeof f!="number"||!x)&&(clearTimeout(b),tm.delete(s));var S=()=>{var T=lk.get(s);try{if(!T)return;var E=T.handler,C=T.reactEvent,P=t.getState(),A={activeCoordinate:aye(P),activeDataKey:iye(P),activeIndex:fp(P),activeLabel:mV(P),activeTooltipIndex:fp(P),isTooltipActive:oye(P)};E&&E(A,C)}finally{A0.delete(s),tm.delete(s),lk.delete(s)}};if(!x){S();return}if(f==="raf"){var N=requestAnimationFrame(S);A0.set(s,N)}else if(typeof f=="number"){if(!tm.has(s)){S();var j=setTimeout(S,f);tm.set(s,j)}}else S()}}});var _Ne=pe([zh],e=>e.tooltipItemPayloads),MNe=pe([_Ne,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var i=e.find(s=>s.settings.graphicalItemId===n);if(i!=null){var r=i.getPosition;if(r!=null)return r(t)}}}),bz=ws("touchMove"),wz=jp(),qc=null,Ul=null,V3=null,nm=null;wz.startListening({actionCreator:bz,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){nm=xz(n);var i=t.getState(),r=i.eventSettings,s=r.throttleDelay,l=r.throttledEvents,c=l==="all"||l.includes("touchmove");qc!==null&&(cancelAnimationFrame(qc),qc=null),Ul!==null&&(typeof s!="number"||!c)&&(clearTimeout(Ul),Ul=null),V3=Array.from(n.touches).map(d=>A2({clientX:d.clientX,clientY:d.clientY,currentTarget:n.currentTarget}));var h=()=>{if(nm!=null){var d=t.getState(),f=Up(d,d.tooltip.settings.shared);if(f==="axis"){var p,v=(p=V3)===null||p===void 0?void 0:p[0];if(v==null){qc=null,Ul=null;return}var x=E2(d,v);(x==null?void 0:x.activeIndex)!=null&&t.dispatch(tV({activeIndex:x.activeIndex,activeDataKey:void 0,activeCoordinate:x.activeCoordinate}))}else if(f==="item"){var b,S=nm.touches[0];if(document.elementFromPoint==null||S==null)return;var N=document.elementFromPoint(S.clientX,S.clientY);if(!N||!N.getAttribute)return;var j=N.getAttribute(zde),T=(b=N.getAttribute(qde))!==null&&b!==void 0?b:void 0,E=zu(d).find(A=>A.id===T);if(j==null||E==null||T==null)return;var C=E.dataKey,P=MNe(d,j,T);t.dispatch(fxe({activeDataKey:C,activeIndex:j,activeCoordinate:P,activeGraphicalItemId:T}))}qc=null,Ul=null}};if(!c){h();return}s==="raf"?qc=requestAnimationFrame(h):typeof s=="number"&&Ul===null&&(h(),nm=null,Ul=setTimeout(()=>{nm?h():(Ul=null,qc=null)},s))}}});var Sz={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},kz=Sr({name:"eventSettings",initialState:Sz,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),RNe=kz.actions.setEventSettings,ONe=kz.reducer,INe=i9({brush:lSe,cartesianAxis:Zwe,chartData:sbe,errorBars:gke,eventSettings:ONe,graphicalItems:Pwe,layout:Tde,legend:Fhe,options:ebe,polarAxis:V1e,polarOptions:PNe,referenceElements:hSe,renderedTicks:OSe,rootProps:CNe,tooltip:pxe,zIndex:$ye}),DNe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return Jue({reducer:INe,preloadedState:t,middleware:i=>{var r;return i({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((r="es6")!==null&&r!==void 0?r:"")}).concat([dz.middleware,hz.middleware,yb.middleware,yz.middleware,wz.middleware])},enhancers:i=>{var r=i;return typeof i=="function"&&(r=i()),r.concat(x9({type:"raf"}))},devTools:{serialize:{replacer:jNe},name:"recharts-".concat(n)}})};function LNe(e){var t=e.preloadedState,n=e.children,i=e.reduxStoreName,r=ns(),s=w.useRef(null);if(r)return n;s.current==null&&(s.current=DNe(t,i));var l=nT;return w.createElement(nfe,{context:l,store:s.current},n)}function UNe(e){var t=e.layout,n=e.margin,i=wi(),r=ns();return w.useEffect(()=>{r||(i(Nde(t)),i(kde(n)))},[i,r,t,n]),null}var BNe=w.memo(UNe,Qy);function FNe(e){var t=wi();return w.useEffect(()=>{t(TNe(e))},[t,e]),null}var $Ne=e=>{var t=wi();return w.useEffect(()=>{t(RNe(e))},[t,e]),null},VNe=w.memo($Ne,Qy);function z3(e){var t=e.zIndex,n=e.isPanorama,i=w.useRef(null),r=wi();return w.useLayoutEffect(()=>(i.current&&r(Bye({zIndex:t,element:i.current,isPanorama:n})),()=>{r(Fye({zIndex:t,isPanorama:n}))}),[r,t,n]),w.createElement("g",{tabIndex:-1,ref:i,className:"recharts-zIndex-layer_".concat(t)})}function q3(e){var t=e.children,n=e.isPanorama,i=st(Pye);if(!i||i.length===0)return t;var r=i.filter(l=>l<0),s=i.filter(l=>l>0);return w.createElement(w.Fragment,null,r.map(l=>w.createElement(z3,{key:l,zIndex:l,isPanorama:n})),t,s.map(l=>w.createElement(z3,{key:l,zIndex:l,isPanorama:n})))}var zNe=["children"];function qNe(e,t){if(e==null)return{};var n,i,r=WNe(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function WNe(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function Vx(){return Vx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Vx.apply(null,arguments)}var HNe={width:"100%",height:"100%",display:"block"},KNe=w.forwardRef((e,t)=>
729{var n=$9(),i=V9(),r=J9();if(!oo(n)||!oo(i))return null;var s=e.children,l=e.otherAttributes,c=e.title,h=e.desc,d,f;return l!=null&&(typeof l.tabIndex=="number"?d=l.tabIndex:d=r?0:void 0,typeof l.role=="string"?f=l.role:f=r?"application":void 0),w.createElement(w8,Vx({},l,{title:c,desc:h,role:f,tabIndex:d,width:n,height:i,style:HNe,ref:t}),s)}),GNe=e=>{var t=e.children,n=st(Wy);if(!n)return null;var i=n.width,r=n.height,s=n.y,l=n.x;return w.createElement(w8,{width:i,height:r,x:l,y:s},t)},W3=w.forwardRef((e,t)=>{var n=e.children,i=qNe(e,zNe),r=ns();return r?w.createElement(GNe,null,w.createElement(q3,{isPanorama:!0},n)):w.createElement(KNe,Vx({ref:t},i),w.createElement(q3,{isPanorama:!1},n))});function YNe(e,t){return ZNe(e)||JNe(e,t)||XNe(e,t)||QNe()}function QNe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
730In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XNe(e,t){if(e){if(typeof e=="string")return H3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H3(e,t):void 0}}function H3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function JNe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function ZNe(e){if(Array.isArray(e))return e}function eje(){var e=wi(),t=w.useState(null),n=YNe(t,2),i=n[0],r=n[1],s=st(Vde);return w.useEffect(()=>{if(i!=null){var l=i.getBoundingClientRect(),c=l.width/i.offsetWidth;Mt(c)&&c!==s&&e(Cde(c))}},[i,e,s]),r}function K3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function tje(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?K3(Object(n),!0).forEach(function(i){nje(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function nje(e,t,n){return(t=ije(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ije(e){var t=rje(e,"string");return typeof t=="symbol"?t:t+""}function rje(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lc(){return lc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},lc.apply(null,arguments)}function zx(e,t){return lje(e)||oje(e,t)||aje(e,t)||sje()}function sje(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
731In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aje(e,t){if(e){if(typeof e=="string")return G3(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?G3(e,t):void 0}}function G3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function oje(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,r,s,l,c=[],h=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(h=(i=s.call(n)).done)&&(c.push(i.value),c.length!==t);h=!0);}catch(f){d=!0,r=f}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw r}}return c}}function lje(e){if(Array.isArray(e))return e}var cje=()=>(mbe(),null);function qx(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);
731if(!Number.isNaN(t))return t}return 0}var uje=w.forwardRef((e,t)=>{var n,i,r=w.useRef(null),s=w.useState({containerWidth:qx((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:qx((i=e.style)===null||i===void 0?void 0:i.height)}),l=zx(s,2),c=l[0],h=l[1],d=w.useCallback((p,v)=>{h(x=>{var b=Math.round(p),S=Math.round(v);return x.containerWidth===b&&x.containerHeight===S?x:{containerWidth:b,containerHeight:S}})},[]),f=w.useCallback(p=>{if(typeof t=="function"&&t(p),r.current!=null&&(r.current.disconnect(),r.current=null),p!=null&&typeof ResizeObserver<"u"){var v=p.getBoundingClientRect(),x=v.width,b=v.height;d(x,b);var S=j=>{var T=j[0];if(T!=null){var E=T.contentRect,C=E.width,P=E.height;d(C,P)}},N=new ResizeObserver(S);N.observe(p),r.current=N}},[t,d]);return w.useEffect(()=>()=>{var p=r.current;p!=null&&p.disconnect()},[d]),w.createElement(w.Fragment,null,w.createElement(Tp,{width:c.containerWidth,height:c.containerHeight}),w.createElement("div",lc({ref:f},e)))}),dje=w.forwardRef((e,t)=>{var n=e.width,i=e.height,r=w.useState({containerWidth:qx(n),containerHeight:qx(i)}),s=zx(r,2),l=s[0],c=s[1],h=w.useCallback((f,p)=>{c(v=>{var x=Math.round(f),b=Math.round(p);return v.containerWidth===x&&v.containerHeight===b?v:{containerWidth:x,containerHeight:b}})},[]),d=w.useCallback(f=>{if(typeof t=="function"&&t(f),f!=null){var p=f.getBoundingClientRect(),v=p.width,x=p.height;h(v,x)}},[t,h]);return w.createElement(w.Fragment,null,w.createElement(Tp,{width:l.containerWidth,height:l.containerHeight}),w.createElement("div",lc({ref:d},e)))}),hje=w.forwardRef((e,t)=>{var n=e.width,i=e.height;return w.createElement(w.Fragment,null,w.createElement(Tp,{width:n,height:i}),w.createElement("div",lc({ref:t},e)))}),fje=w.forwardRef((e,t)=>{var n=e.width,i=e.height;return typeof n=="string"||typeof i=="string"?w.createElement(dje,lc({},e,{ref:t})):typeof n=="number"&&typeof i=="number"?w.createElement(hje,lc({},e,{width:n,height:i,ref:t})):w.createElement(w.Fragment,null,w.createElement(Tp,{width:n,height:i}),w.createElement("div",lc({ref:t},e)))});function mje(e){return e?uje:fje}var pje=w.forwardRef((e,t)=>{var n=e.children,i=e.className,r=e.height,s=e.onClick,l=e.onContextMenu,c=e.onDoubleClick,h=e.onMouseDown,d=e.onMouseEnter,f=e.onMouseLeave,p=e.onMouseMove,v=e.onMouseUp,x=e.onTouchEnd,b=e.onTouchMove,S=e.onTouchStart,N=e.style,j=e.width,T=e.responsive,E=e.dispatchTouchEvents,C=E===void 0?!0:E,P=w.useRef(null),A=wi(),M=w.useState(null),R=zx(M,2),B=R[0],U=R[1],O=w.useState(null),F=zx(O,2),ne=F[0],re=F[1],Q=eje(),W=cT(),q=(W==null?void 0:W.width)>0?W.width:j,$=(W==null?void 0:W.height)>0?W.height:r,ge=w.useCallback(Le=>{Q(Le),typeof t=="function"&&t(Le),U(Le),re(Le),Le!=null&&(P.current=Le)},[Q,t,U,re]),ue=w.useCallback(Le=>{A(uz(Le)),A(Is({handler:s,reactEvent:Le}))},[A,s]),L=w.useCallback(Le=>{A(jj(Le)),A(Is({handler:d,reactEvent:Le}))},[A,d]),J=w.useCallback(Le=>{A(eV()),A(Is({handler:f,reactEvent:Le}))},[A,f]),ye=w.useCallback(Le=>{A(jj(Le)),A(Is({handler:p,reactEvent:Le}))},[A,p]),Pe=w.useCallback(()=>{A(gz())},[A]),Oe=w.useCallback(()=>{A(vz())},[A]),je=w.useCallback(Le=>{A(pz(Le.key))},[A]),Ke=w.useCallback(Le=>{A(Is({handler:l,reactEvent:Le}))},[A,l]),ve=w.useCallback(Le=>{A(Is({handler:c,reactEvent:Le}))},[A,c]),le=w.useCallback(Le=>{A(Is({handler:h,reactEvent:Le}))},[A,h]),Be=w.useCallback(Le=>{A(Is({handler:v,reactEvent:Le}))},[A,v]),De=w.useCallback(Le=>{A(Is({handler:S,reactEvent:Le}))},[A,S]),be=w.useCallback(Le=>{C&&A(bz(Le)),A(Is({handler:b,reactEvent:Le}))},[A,C,b]),nt=w.useCallback(Le=>{A(Is({handler:x,reactEvent:Le}))},[A,x]),ze=mje(T);return w.createElement(SV.Provider,{value:B},w.createElement(Rle.Provider,{value:ne},w.createElement(ze,{width:q??(N==null?void 0:N.width),height:$??(N==null?void 0:N.height),className:Rn("recharts-wrapper",i),style:tje({position:"relative",cursor:"default",width:q,height:$}
731,N),onClick:ue,onContextMenu:Ke,onDoubleClick:ve,onFocus:Pe,onBlur:Oe,onKeyDown:je,onMouseDown:le,onMouseEnter:L,onMouseLeave:J,onMouseMove:ye,onMouseUp:Be,onTouchEnd:nt,onTouchMove:be,onTouchStart:De,ref:ge},w.createElement(cje,null),n)))}),gje=["width","height","responsive","children","className","style","compact","title","desc"];function vje(e,t){if(e==null)return{};var n,i,r=xje(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xje(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var yje=w.forwardRef((e,t)=>{var n=e.width,i=e.height,r=e.responsive,s=e.children,l=e.className,c=e.style,h=e.compact,d=e.title,f=e.desc,p=vje(e,gje),v=Ca(p);return h?w.createElement(w.Fragment,null,w.createElement(Tp,{width:n,height:i}),w.createElement(W3,{otherAttributes:v,title:d,desc:f},s)):w.createElement(pje,{className:l,style:c,width:n,height:i,responsive:r??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},w.createElement(W3,{otherAttributes:v,title:d,desc:f,ref:t},w.createElement(ySe,null,s)))});function Cj(){return Cj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Cj.apply(null,arguments)}function Y3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function bje(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Y3(Object(n),!0).forEach(function(i){wje(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Y3(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function wje(e,t,n){return(t=Sje(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sje(e){var t=kje(e,"string");return typeof t=="symbol"?t:t+""}function kje(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nje={top:5,right:5,bottom:5,left:5},jje=bje({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:Nje,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Sz),Cje=w.forwardRef(function(t,n){var i,r=Ys(t.categoricalChartProps,jje),s=t.chartName,l=t.defaultTooltipEventType,c=t.validateTooltipEventTypes,h=t.tooltipPayloadSearcher,d=t.categoricalChartProps,f={chartName:s,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:h,eventEmitter:void 0};return w.createElement(LNe,{preloadedState:{options:f},reduxStoreName:(i=d.id)!==null&&i!==void 0?i:s},w.createElement(oSe,{chartData:d.data}),w.createElement(BNe,{layout:r.layout,margin:r.margin}),w.createElement(VNe,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),w.createElement(FNe,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),w.createElement(yje,Cj({},r,{ref:n})))}),Tje=["axis"],P2=w.forwardRef((e,t)=>w.createElement(Cje,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Tje,tooltipPayloadSearcher:Jye,categoricalChartProps:e,ref:t}));const Eje={web:{icon:Yo,label:"Web",tint:"bg-sky-100 text-sky-700"},phone:{icon:wv,label:"Phone",tint:"bg-violet-100 text-violet-700"},form:{icon:Ya,label:"Form",tint:"bg-amber-100 text-amber-700"}},Aje={widget:"Widget","phone-inbound":"Inbound call","phone-outbound":"Outbound call","landing-contact":"Landing contact","landing-booking":"Demo booking","local-deployment":"Local deployment",agencies:"Agencies page"},Pje=[{key:"all",label:"All"},{key:"web",label:"Web",channel:"web"},{key:"phone",label:"Phone",channel:"phone"},{key:"form",label:"Forms",channel:"form"}],_je={web:[{source:"widget",label:"Widget"}],phone:[{source:"phone-inbound",label:"Inbound"},{source:"phone-outbound",label:"Outbound"}],form:[{source:"landing-contact",label:"Landing contact"},{source:"landing-booking",label:"Demo booking"},{source:"local-deployment",label:"Local deployment"},{source:"agencies",label:"Agencies"}]};function Nz({results:e,status:t,loadMore:n,channel:i,source:r,onFilter:s,clientNameFor:l,emptyHint:c}){const[h,d]=w.useState(null),f=w.useRef(null),[p,v]=w.useState(null);w.useEffect(()=>{let E=!1;return fetch("/api/recording-status").then(C=>C.json()).then(C=>{E||v(!!(C!=null&&C.configured))}).catch(()=>{E||v(!1)}),()=>{E=!0}},[]);const x=t==="LoadingFirstPage",b=t==="CanLoadMore",S=t==="LoadingMore",N=t==="Exhausted";w.useEffect(()=>()=>{if(f.current){try{f.current.pause()}catch{}f.current=null}},[]);const j=E=>
731{const C=E._id||E.id||"",P=E.audioRecordingUrl,A=!!(P&&/^(data:|blob:|https?:)/.test(P));if(f.current){try{f.current.pause()}catch{}f.current=null}if(h===C){d(null);return}if(!A){d(null);return}const M=new Audio(P);f.current=M,M.onended=()=>d(R=>R===C?null:R),M.onerror=()=>d(null),M.play().catch(()=>d(null)),d(C)};if(x)return a.jsxs("div",{className:"space-y-3 flex-1 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(zs,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Leads & Call Recordings"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Loading…"})]})]}),a.jsx("div",{className:"space-y-2",children:[0,1,2,3,4].map(E=>a.jsx("div",{className:"h-12 rounded-xl bg-slate-50 animate-pulse"},E))})]});const T=i?_je[i]:void 0;return a.jsxs("div",{className:"space-y-3 flex-1 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(zs,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Leads & Call Recordings"}),a.jsxs("span",{className:"text-[9px] text-slate-400",children:["Showing ",e.length,b||S?"+":"",". Recordings are stored as public R2 URLs on each lead."]})]}),a.jsx("span",{title:p===!1?"R2 storage env vars missing on the server — recordings cannot upload":"R2 storage configured",className:`shrink-0 px-2 py-0.5 rounded-full text-[9px] font-bold uppercase ${p===!1?"bg-rose-100 text-rose-700":"bg-emerald-100 text-emerald-700"}`,children:p===null?"R2 …":p?"R2 on":"R2 off"})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Pje.map(E=>{const C=E.channel?i===E.channel:!i;return a.jsx("button",{onClick:()=>s(E.channel,void 0),className:`px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wide transition-all ${C?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-500 hover:bg-slate-200"}`,children:E.label},E.key)})}),T&&T.length>0&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 -mt-1",children:[a.jsx("span",{className:"text-[9px] text-slate-400 uppercase font-bold",children:"Source:"}),a.jsxs("button",{onClick:()=>s(i,void 0),className:`px-2 py-0.5 rounded-full text-[10px] font-semibold transition-all ${r?"bg-slate-50 text-slate-500 hover:bg-slate-100":"bg-slate-700 text-white"}`,children:["All ",i]}),T.map(E=>{const C=r===E.source;return a.jsx("button",{onClick:()=>s(i,E.source),className:`px-2 py-0.5 rounded-full text-[10px] font-semibold transition-all ${C?"bg-slate-700 text-white":"bg-slate-50 text-slate-500 hover:bg-slate-100"}`,children:E.label},E.source)})]}),e.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-12",children:[a.jsx("div",{className:"p-3 bg-slate-50 rounded-2xl mb-3",children:a.jsx(zs,{className:"w-8 h-8 text-slate-300"})}),a.jsx("p",{className:"text-sm font-semibold text-slate-500",children:"No leads yet"}),a.jsx("p",{className:"text-xs text-slate-400 mt-1 max-w-xs",children:c||"Inbound calls and contact-form submissions will appear here with any call recordings."})]}):a.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-100",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{className:"bg-slate-50 text-[9px] font-bold uppercase text-slate-400",children:a.jsxs("tr",{children:[l&&a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"VA / Client"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Type"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Caller"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Contact"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Purpose"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Slot"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Duration / Cost"}),a.jsx("th",{className:"py-2.5 px-3 border-r border-slate-100 text-left",children:"Status"}),a.jsx("th",{className:"py-2.5 px-3 text-center w-28",children:"Recording"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100",children:e.map(E=>
731{const C=E._id||E.id||"",P=h===C,A=!!(E.audioRecordingUrl&&/^(data:|blob:|https?:)/.test(E.audioRecordingUrl)),M=E.channel?Eje[E.channel]:void 0,R=M==null?void 0:M.icon,B=E.source?Aje[E.source]:void 0;return a.jsxs("tr",{className:"hover:bg-slate-50/50 align-top",children:[l&&a.jsx("td",{className:"py-3 px-3 border-r border-slate-100",children:a.jsx("div",{className:"font-bold text-slate-800",children:l(E.clientId)||"—"})}),a.jsx("td",{className:"py-3 px-3 border-r border-slate-100",children:M&&R?a.jsxs("div",{className:"flex flex-col items-start gap-1",children:[a.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase ${M.tint}`,children:[a.jsx(R,{className:"w-3 h-3"}),M.label]}),B&&a.jsxs("span",{className:"text-[9px] text-slate-400",children:[B,E.direction?` · ${E.direction}`:""]})]}):a.jsx("span",{className:"text-[9px] text-slate-300 italic",children:"legacy"})}),a.jsxs("td",{className:"py-3 px-3 border-r border-slate-100",children:[a.jsx("div",{className:"font-bold text-slate-800",children:E.visitorName||"Unknown caller"}),a.jsx("div",{className:"text-[10px] text-slate-400 font-mono mt-0.5",children:E.timestamp})]}),a.jsxs("td",{className:"py-3 px-3 border-r border-slate-100 space-y-0.5",children:[E.visitorPhone&&a.jsxs("div",{className:"font-mono text-slate-600 flex items-center gap-1",children:[a.jsx(Ei,{className:"w-3 h-3 text-slate-400"}),E.visitorPhone]}),E.visitorEmail&&a.jsxs("div",{className:"text-slate-500 break-all flex items-center gap-1",children:[a.jsx(uc,{className:"w-3 h-3 text-slate-400 shrink-0"}),E.visitorEmail]}),!E.visitorPhone&&!E.visitorEmail&&a.jsx("span",{className:"text-slate-300 italic",children:"—"})]}),a.jsx("td",{className:"py-3 px-3 border-r border-slate-100 text-slate-600 max-w-[200px]",children:E.purpose||a.jsx("span",{className:"text-slate-300 italic",children:"—"})}),a.jsx("td",{className:"py-3 px-3 border-r border-slate-100",children:E.bookedSlot?a.jsx("span",{className:"font-mono text-[11px] text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-md",children:E.bookedSlot}):a.jsx("span",{className:"text-slate-300 italic",children:"Not booked"})}),a.jsxs("td",{className:"py-3 px-3 border-r border-slate-100 text-slate-600 font-mono text-[11px] space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(cc,{className:"w-3 h-3 text-slate-400"}),Math.round(E.durationSeconds||0),"s"]}),a.jsxs("div",{className:"text-slate-400",children:["$",(E.tokenCost||0).toFixed(2)]})]}),a.jsx("td",{className:"py-3 px-3 border-r border-slate-100",children:a.jsxs("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold uppercase flex items-center gap-1 w-fit ${E.status==="booked"?"bg-emerald-100 text-emerald-700":E.status==="new"?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-600"}`,children:[a.jsx(jL,{className:"w-2.5 h-2.5"}),E.status||"—"]})}),a.jsxs("td",{className:"py-3 px-3 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[a.jsx("button",{onClick:()=>j(E),disabled:!A,title:A?"Play call recording":"No recording available",className:`inline-flex items-center justify-center w-9 h-9 rounded-full transition-all ${A?P?"bg-rose-600 text-white animate-pulse":"bg-indigo-600 hover:bg-indigo-500 text-white":"bg-slate-100 text-slate-300 cursor-not-allowed"} cursor-pointer`,children:P?a.jsx(bL,{className:"w-4 h-4"}):a.jsx(Sv,{className:"w-4 h-4"})}),A&&a.jsx("a",{href:E.audioRecordingUrl,download:`${(E.visitorName||"caller").replace(/\s+/g,"_")}-${(E.timestamp||"").replace(/[^0-9TZ:+-]/g,"")}.wav`,title:"Download recording",className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 text-slate-600 transition-all",children:a.jsx(hQ,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"text-[9px] mt-1",children:A?a.jsxs("span",{className:"text-slate-400",children:["recording",E.recordingPath?` · ${E.recordingPath}`:""]}):E.recordingStatus&&E.recordingStatus.startsWith("failed:")?a.jsxs("span",{className:"text-rose-500 font-semibold",title:E.recordingStatus,children:[E.recordingStatus.replace("failed:","no rec · "),E.recordingPath?` · ${E.recordingPath}`:""]}):a.jsxs("span",{className:"text-slate-400",children:["none",E.recordingPath?` · ${E.recordingPath}`:""]})})]})]},C)})})]})}),(b||S)&&a.jsx("div",{className:"flex justify-center pt-1",children:a.jsxs("button",{onClick:()=>n(50),disabled:!b,className:"inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-slate-100 hover:bg-slate-200 text-slate-700 text-[11px] font-bold transition-all disabled:opacity-60",children:[S?a.jsx(Bi,{className:"w-3.5 h-3.5 animate-spin"}):null,S?"Loading…":"Load more"]})}),N&&e.length>0&&a.jsx("p",{className:"text-center text-[9px] text-slate-400 pt-1",children:"End of leads"})]})}function Q3(){const e=et(me.runpod.getRunPodConfig,{}),t=We(me.mutations.updatePlatformSettings),n=zo(me.runpod.setRunPodPodOn),i=zo(me.runpod.setRunPodPodOff),r=zo(me.runpod.getRunPodPodStatus),[s,l]=w.useState(""),[c,h]=w.useState(""),[d,f]=w.useState(!1),[p,v]=w.useState(null),[x,b]=w.useState(!1),[S,N]=w.useState(null),[j,T]=w.useState(null),E=w.useRef(null);
731w.useEffect(()=>{e&&(l(e.podId??""),h(e.endpoint??""))},[e]),w.useEffect(()=>{if(E.current&&(clearInterval(E.current),E.current=null),(e==null?void 0:e.state)!=="on"){T(null);return}const B=()=>{r({}).then(T).catch(()=>{})};return B(),E.current=setInterval(B,5e3),()=>{E.current&&clearInterval(E.current)}},[e==null?void 0:e.state,r]);const C=(e==null?void 0:e.state)??"off",P=C==="off"?"off":(j==null?void 0:j.readiness)??"starting";async function A(B){B.preventDefault(),f(!0),N(null);try{await t({runpodPodId:s.trim()||void 0,runpodEndpoint:c.trim()||void 0}),v(Date.now())}catch(U){N(`Save failed: ${String((U==null?void 0:U.message)??U).slice(0,160)}`)}finally{f(!1)}}async function M(){b(!0),N(null);try{const B=C==="on"?await i({}):await n({});B.ok?N(C==="on"?"Pod stopped — no longer billing.":"Pod starting — warming models…"):N(B.error??"RunPod action failed")}catch(B){N(`Action failed: ${String((B==null?void 0:B.message)??B).slice(0,160)}`)}finally{b(!1)}}const R={off:{icon:a.jsx(Xd,{className:"w-3 h-3"}),label:"Off",color:"bg-slate-100 text-slate-500"},starting:{icon:a.jsx(Bi,{className:"w-3 h-3 animate-spin"}),label:"Starting…",color:"bg-amber-100 text-amber-700"},ready:{icon:a.jsx(kt,{className:"w-3 h-3"}),label:"Ready for call",color:"bg-emerald-100 text-emerald-700"}}[P];return a.jsxs("div",{className:"border border-slate-100 rounded-2xl p-5 shadow-sm space-y-4 bg-gradient-to-br from-white to-slate-50/50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(Uu,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-bold text-slate-800",children:"RunPod Voice Stack"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Self-hosted GPU pod for stacked-pipeline VAs (open STT/LLM/TTS). On = warm + billable."})]})]}),a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold ${R.color}`,children:[R.icon," ",R.label]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:M,disabled:x||!e,className:`inline-flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ${C==="on"?"bg-rose-600 hover:bg-rose-700 text-white":"bg-emerald-600 hover:bg-emerald-700 text-white"}`,children:C==="on"?a.jsxs(a.Fragment,{children:[a.jsx(Xd,{className:"w-3.5 h-3.5"})," Turn Off"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xd,{className:"w-3.5 h-3.5"})," Turn On"]})}),a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-slate-500",children:[a.jsx(Tk,{className:"w-3 h-3"}),j!=null&&j.lastCheckedAt?`checked ${new Date(j.lastCheckedAt).toLocaleTimeString()}`:e!=null&&e.lastCheckedAt?`last ${new Date(e.lastCheckedAt).toLocaleTimeString()}`:"not checked yet"]})]}),C==="off"&&a.jsxs("div",{className:"flex items-start gap-2 text-[10px] text-amber-700 bg-amber-50 border border-amber-100 rounded-lg p-2.5",children:[a.jsx(sy,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),a.jsx("span",{children:"Pod is off — stacked+RunPod VAs will reject calls fast (no silence). Turn On to test. Billing only while On."})]}),S&&a.jsx("div",{className:"text-[10px] text-slate-600 bg-slate-100 rounded-lg p-2",children:S}),a.jsxs("form",{onSubmit:A,className:"space-y-3 border-t border-slate-100 pt-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase tracking-wider",children:"RunPod Pod ID"}),a.jsx("input",{value:s,onChange:B=>l(B.target.value),placeholder:"pod-xxxx…",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase tracking-wider",children:"Gateway Endpoint (base URL)"}),a.jsx("input",{value:c,onChange:B=>h(B.target.value),placeholder:"https://<pod>:8000",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"submit",disabled:d,className:"px-3 py-1.5 rounded-lg text-[11px] font-bold bg-indigo-600 hover:bg-indigo-700 text-white cursor-pointer disabled:opacity-50",children:d?"Saving…":"Save Pod Config"}),p&&a.jsx("span",{className:"text-[10px] text-emerald-600",children:"saved ✓"})]}),a.jsx("p",{className:"text-[10px] text-slate-400 leading-relaxed",children:"💡 Set the pod id + gateway base URL here, then point a stacked VA's stt/tts/llm endpoints at this URL. The RunPod API key is set server-side (RUNPOD_API_KEY env), never in the browser."})]})]})}const rt="bg-white border border-slate-100 rounded-2xl shadow-sm",Mje=[.5,.75,1,1.25,1.5,2];function X3(e){if(!isFinite(e)||e<0)return"0:00";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}function gp({src:e,compact:t=!1}){const n=w.useRef(null),[i,r]=w.useState(!1),[s,l]=w.useState(0),[c,h]=w.useState(0),[d,f]=w.useState(1),[p,v]=w.useState(!1),[x,b]=w.useState(!1);w.useEffect(()=>{l(0),h(0),r(!1),b(!1)},[e]);const S=()=>{const T=n.current;T&&(i?T.pause():(T.playbackRate=d,T.play().catch(()=>b(!0))))},N=T=>{const E=n.current;E&&(E.currentTime=T,l(T))},j=T=>{f(T),v(!1),n.current&&(n.current.playbackRate=T)};return a.jsxs("div",{className:`w-full rounded-xl bg-slate-900 text-white px-3 py-2 flex items-center gap-2 ${t?"max-w-[280px]":""}`,children:[a.jsx("audio",{ref:n,src:e,preload:"metadata",onPlay:()=>r(!0),onPause:()=>r(!1),onEnded:()=>r(!1),onTimeUpdate:T=>l(T.target.currentTime),onLoadedMetadata:T=>h(T.target.duration),onError:()=>b(!0)}),a.jsx("button",{onClick:S,className:"w-8 h-8 shrink-0 rounded-full bg-indigo-600 hover:bg-indigo-500 flex items-center justify-center cursor-pointer transition-colors",title:i?"Pause":"Play",children:i?a.jsx(bL,{className:"w-4 h-4"}):a.jsx(Sv,{className:"w-4 h-4 ml-0.5"})}),a.jsx("input",{type:"range",min:0,max:c||0,step:.1,value:s,onChange:T=>N(parseFloat(T.target.value)),className:"flex-1 min-w-0 h-1 accent-indigo-500 cursor-pointer","aria-label":"Seek"}),a.jsxs("span",{className:"text-[10px] font-mono text-slate-300 shrink-0",children:[X3(s)," / ",X3(c)]}),a.jsxs("div",{className:"relative shrink-0",children:[a.jsxs("button",{onClick:()=>v(T=>!T),className:"inline-flex items-center gap-1 text-[10px] font-bold px-1.5 py-1 rounded-md bg-slate-800 hover:bg-slate-700 cursor-pointer",title:"Playback speed",children:[a.jsx(vL,{className:"w-3 h-3"})," ",d,"x"]}),p?a.jsx("div",{className:"absolute right-0 bottom-8 z-20 bg-slate-800 border border-slate-700 rounded-lg p-1 space-y-0.5",children:Mje.map(T=>a.jsxs("button",{onClick:()=>j(T),className:`block w-full text-left px-2.5 py-1 rounded text-[10px] font-bold cursor-pointer ${T===d?"bg-indigo-600 text-white":"text-slate-200 hover:bg-slate-700"}`,children:[T,"x"]},T))}):null]}),x?a.jsx("span",{className:"text-[9px] text-rose-400 shrink-0",children:"playback failed"}):null]})}const J3=e=>!!e&&/^(data:|blob:|https?:)/.test(e),Rje=[{key:"",label:"All"},{key:"phone",label:"Calls"},{key:"whatsapp",label:"WhatsApp"},{key:"web",label:"Web"},{key:"form",label:"Forms"}],jz={phone:{icon:Ei,label:"Call",cls:"bg-sky-100 text-sky-700"},whatsapp:{icon:Na,label:"WhatsApp",cls:"bg-emerald-100 text-emerald-700"},web:{icon:Yo,label:"Web",cls:"bg-indigo-100 text-indigo-700"},form:{icon:Ya,label:"Form",cls:"bg-amber-100 text-amber-700"}};
731function Oje(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function Cz(e){return`$${(e/100).toFixed(2)}`}function Ije(e){const t=new Date(e),n=new Date,i=new Date(n);i.setDate(n.getDate()-1);const r=(s,l)=>s.toDateString()===l.toDateString();return r(t,n)?"Today":r(t,i)?"Yesterday":t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function Dje(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Z3(e){if(!e)return"";const t=Math.floor(e/60),n=e%60;return t>0?`${t}m ${n}s`:`${n}s`}function Lje({interaction:e}){const t=jz[e.channel]??{icon:Na,label:e.channel,cls:"bg-slate-100 text-slate-600"},n=t.icon,i=e.direction==="outbound";return a.jsxs("div",{className:"rounded-2xl border border-slate-100 bg-white p-3.5 shadow-sm space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[9px] font-bold uppercase ${t.cls}`,children:[a.jsx(n,{className:"w-3 h-3"})," ",t.label]}),e.direction?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-bold uppercase text-slate-400",children:[i?a.jsx(NL,{className:"w-3 h-3"}):a.jsx(wL,{className:"w-3 h-3"}),e.direction]}):null,e.source?a.jsx("span",{className:"text-[9px] font-mono text-slate-400 uppercase",children:e.source}):null,a.jsx("span",{className:"text-[10px] text-slate-400 font-mono",children:Dje(e.createdAt)}),a.jsx("span",{className:"ml-auto inline-flex items-center gap-1 text-[10px] font-mono font-semibold text-slate-600",children:typeof e.costCents=="number"&&e.costCents>0?Cz(e.costCents):a.jsx("span",{className:"text-slate-300",children:"free"})})]}),(e.visitorName||e.visitorPhone||e.visitorEmail)&&a.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-[10px] text-slate-500",children:[e.visitorName?a.jsx("span",{className:"font-bold text-slate-700",children:e.visitorName}):null,e.visitorPhone?a.jsxs("span",{className:"font-mono",children:["📞 +",e.visitorPhone]}):null,e.visitorEmail?a.jsxs("span",{className:"font-mono",children:["✉️ ",e.visitorEmail]}):null]}),e.kind==="call"?a.jsxs("div",{className:"space-y-1.5",children:[e.text?a.jsx("p",{className:"text-xs text-slate-700",children:e.text}):null,a.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-slate-500 font-mono flex-wrap",children:[e.durationSeconds!=null?a.jsx("span",{children:Z3(e.durationSeconds)}):null,a.jsx("span",{className:`px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase ${e.status==="booked"?"bg-emerald-100 text-emerald-700":e.status==="open"?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-500"}`,children:e.status})]}),J3(e.recordingUrl)?a.jsx(gp,{src:e.recordingUrl}):e.recordingStatus?a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-rose-600 bg-rose-50 border border-rose-200 rounded-lg px-2.5 py-1.5",children:[a.jsx(sy,{className:"w-3 h-3"})," Recording ",e.recordingStatus]}):null]}):e.kind==="whatsapp-text"?a.jsx("div",{className:`flex ${i?"justify-end":"justify-start"}`,children:a.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-2xl text-xs ${i?"bg-indigo-600 text-white rounded-br-sm":"bg-slate-100 text-slate-800 rounded-bl-sm"}`,children:e.text||a.jsx("span",{className:"italic opacity-70",children:"(no text)"})})}):e.kind==="whatsapp-voice"?a.jsxs("div",{className:"space-y-1",children:[J3(e.recordingUrl)?a.jsx(gp,{src:e.recordingUrl}):null,e.durationSeconds?a.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:["Voice note · ",Z3(e.durationSeconds)]}):null,e.text?a.jsxs("p",{className:"text-xs text-slate-600 italic",children:["“",e.text,"”"]}):null]}):e.kind==="booking"?a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-700",children:[a.jsx(aa,{className:"w-4 h-4 text-emerald-600"}),a.jsx("span",{className:"font-semibold",children:e.bookedSlot||e.text||"Appointment booked"}),a.jsx("span",{className:"text-emerald-600 font-bold text-[10px] uppercase ml-auto",children:"Booked"})]}),e.text&&e.text!==e.bookedSlot?a.jsx("p",{className:"text-[11px] text-slate-500 pl-6",children:e.text}):null]}):a.jsx("div",{className:"text-xs text-slate-700",children:e.text||a.jsx("span",{className:"italic text-slate-400",children:"Form submission"})})]})}function Uje({clientId:e,contactId:t,onBack:n}){var W,q;const[i,r]=w.useState(""),[s,l]=w.useState(null),[c,h]=w.useState([]),d=e,f=t,p=et(me.contactQueries.getContactDetail,{clientId:d,contactId:f,paginationOpts:{numItems:25,cursor:s}}),v=(p==null?void 0:p.interactions.page)??[],x=(p==null?void 0:p.interactions.continueCursor)??null;w.useEffect(()=>{h(s===null?v:$=>[...$,...v])},[v]);const b=(p==null?void 0:p.contact)??null,S=We(me.contacts.mergeContacts),N=We(me.contacts.moveInteraction),j=We(me.contacts.updateContactIdentity),[T,E]=w.useState(!1),[C,P]=w.useState(""),[A,M]=w.useState(!1),[R,B]=w.useState(""),[U,O]=w.useState(null),F=et(me.contactQueries.listContacts,A?{clientId:d,search:R||void 0,paginationOpts:{numItems:6,cursor:null}}:"skip");if(!b)return a.jsx("div",{className:`${rt} p-10 flex justify-center`,children:a.jsx(Bi,{className:"w-6 h-6 text-indigo-500 animate-spin"})});const ne=i?c.filter($=>$.channel===i):c,re=new Map;for(const $ of ne){const ge=new Date($.createdAt).toDateString();re.has(ge)||re.set(ge,[]),re.get(ge).push($)}const Q=[...re.entries()];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("button",{onClick:n,className:"inline-flex items-center gap-1.5 text-xs font-bold text-indigo-600 hover:text-indigo-800 cursor-pointer",children:[a.jsx(ty,{className:"w-4 h-4"})," Back to contacts"]}),a.jsxs("div",{className:`${rt} p-5 space-y-3`,children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-indigo-100 text-indigo-700 flex items-center justify-center font-bold text-lg shrink-0",children:Oje(b.name||"")}),a.jsxs("div",{className:"flex-1 min-w-0",children:[T?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{value:C,onChange:$=>P($.target.value),className:"border border-slate-200 rounded-lg px-2 py-1 text-sm font-bold text-slate-800 outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsxs("button",{onClick:async()=>{O("name");try{await j({clientId:d,contactId:f,name:C}),E(!1)}finally{O(null)}},className:"inline-flex items-center gap-1 text-[10px] font-bold text-white bg-emerald-600 hover:bg-emerald-700 px-2 py-1 rounded-lg cursor-pointer",children:[a.jsx($i,{className:"w-3 h-3"})," Save"]}),a.jsx("button",{onClick:()=>E(!1),className:"text-slate-400 hover:text-slate-600 cursor-pointer",children:a.jsx(fn,{className:"w-4 h-4"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display",children:b.name||"Unknown caller"}),a.jsx("button",{onClick:()=>{P(b.name||""),E(!0)},className:"text-slate-400 hover:text-indigo-600 cursor-pointer",title:"Edit name",children:a.jsx(_k,{className:"w-3.5 h-3.5"})}),a.jsxs("button",{onClick:()=>M($=>
731!$),className:"inline-flex items-center gap-1 text-[10px] font-bold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 px-2 py-1 rounded-lg cursor-pointer",children:[a.jsx(SQ,{className:"w-3 h-3"})," Merge into another contact"]})]}),a.jsx("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:(b.channelsUsed??[]).map($=>{const ge=jz[$];if(!ge)return null;const ue=ge.icon;return a.jsxs("span",{className:`inline-flex items-center gap-1 text-[9px] font-bold uppercase px-1.5 py-0.5 rounded-md ${ge.cls}`,children:[a.jsx(ue,{className:"w-2.5 h-2.5"})," ",ge.label]},$)})})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsx("div",{className:"text-[10px] text-slate-400 font-semibold uppercase",children:"Total cost"}),a.jsx("div",{className:"text-lg font-extrabold font-mono text-emerald-600",children:Cz(b.totalCostCents??0)}),Object.entries(b.countsByKind??{}).map(([$,ge])=>a.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:[$,": ",ge]},$))]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(W=b.phones)==null?void 0:W.map($=>a.jsxs("span",{className:"group inline-flex items-center gap-1 text-[10px] font-mono text-slate-600 bg-slate-100 px-2 py-1 rounded-md",children:["📞 +",$,a.jsx("button",{onClick:async()=>{O("id:"+$);try{await j({clientId:d,contactId:f,removePhone:$})}finally{O(null)}},disabled:U==="id:"+$,title:"Remove this number",className:"text-slate-300 hover:text-rose-500 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer disabled:opacity-50",children:a.jsx(fn,{className:"w-3 h-3"})})]},$)),(q=b.emails)==null?void 0:q.map($=>a.jsxs("span",{className:"group inline-flex items-center gap-1 text-[10px] font-mono text-slate-600 bg-slate-100 px-2 py-1 rounded-md",children:["✉️ ",$,a.jsx("button",{onClick:async()=>{O("id:"+$);try{await j({clientId:d,contactId:f,removeEmail:$})}finally{O(null)}},disabled:U==="id:"+$,title:"Remove this email",className:"text-slate-300 hover:text-rose-500 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer disabled:opacity-50",children:a.jsx(fn,{className:"w-3 h-3"})})]},$)),b.waId?a.jsxs("span",{className:"text-[10px] font-mono text-emerald-700 bg-emerald-50 px-2 py-1 rounded-md",children:["WhatsApp +",b.waId]}):null]}),a.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:["First seen ",new Date(b.firstSeenAt).toLocaleString()," · Last activity ",new Date(b.lastActivityAt).toLocaleString()]}),A?a.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-3 space-y-2",children:[a.jsx("div",{className:"text-[11px] font-bold text-slate-700",children:"Merge this contact into:"}),a.jsx("input",{value:R,onChange:$=>B($.target.value),placeholder:"Search name / email / phone…",className:"w-full border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsxs("div",{className:"space-y-1 max-h-40 overflow-auto",children:[((F==null?void 0:F.page)??[]).filter($=>$._id!==t).map($=>{var ge,ue;return a.jsxs("button",{disabled:U==="merge",onClick:async()=>{O("merge");try{await S({clientId:d,fromId:f,toId:$._id}),n()}finally{O(null)}},className:"w-full text-left px-3 py-2 rounded-lg bg-white border border-slate-100 hover:border-indigo-200 text-xs text-slate-700 cursor-pointer disabled:opacity-60",children:[$.name||"Unknown caller"," ",a.jsx("span",{className:"text-slate-400 font-mono",children:(((ge=$.emails)==null?void 0:ge[0])??"")||(((ue=$.phones)==null?void 0:ue[0])??"")})]},$._id)}),((F==null?void 0:F.page)??[]).length===0?a.jsx("div",{className:"text-[10px] text-slate-400 px-2 py-1",children:"No other contacts match."}):null]})]}):null]}),a.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:Rje.map($=>a.jsx("button",{onClick:()=>r($.key),className:`px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all cursor-pointer ${i===$.key?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:$.label},$.key||"all"))}),Q.length===0?a.jsx("div",{className:`${rt} p-10 text-center text-sm text-slate-500`,children:"No communications on this channel yet."}):a.jsxs("div",{className:"space-y-5",children:[Q.map(([$,ge])=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase text-slate-400 tracking-wide",children:Ije(ge[0].createdAt)}),a.jsx("div",{className:"flex-1 h-px bg-slate-100"})]}),a.jsx("div",{className:"space-y-2",children:ge.map(ue=>a.jsxs("div",{className:"relative group",children:[a.jsx(Lje,{interaction:ue}),a.jsx("button",{onClick:async()=>{O(ue._id);try{await N({clientId:d,interactionId:ue._id})}finally{O(null)}},disabled:U===ue._id,title:"Unlink from this contact (moves to the Unlinked bucket)",className:"absolute top-2 right-2 text-slate-300 hover:text-rose-500 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a.jsx(CL,{className:"w-3.5 h-3.5"})})]},ue._id))})]},$)),x?a.jsx("button",{onClick:()=>l(x),className:"w-full py-2.5 text-xs font-bold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-xl transition-all cursor-pointer",children:"Load more"}):null]})]})}const Bje=[{key:"",label:"All"},{key:"phone",label:"Calls"},{key:"whatsapp",label:"WhatsApp"},{key:"web",label:"Web"},{key:"form",label:"Forms"}],e4={phone:Ei,whatsapp:Na,web:Yo,form:Ya};
731function Fje(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function $je(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const r=Math.floor(i/24);return r<7?`${r}d ago`:new Date(e).toLocaleDateString()}function Tz({clientId:e}){const[t,n]=w.useState(""),[i,r]=w.useState(""),[s,l]=w.useState(""),[c,h]=w.useState(null),d=w.useRef(null);w.useEffect(()=>()=>{d.current&&window.clearTimeout(d.current)},[]);const f=Hx(me.contactQueries.listContacts,w.useMemo(()=>({clientId:e,search:i||void 0,channel:s||void 0}),[e,i,s]),{initialNumItems:25}),p=f.results??[];return c?a.jsx(Uje,{clientId:e,contactId:c,onBack:()=>h(null)}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-bold text-slate-900 font-display flex items-center gap-2",children:[a.jsx(Wo,{className:"w-5 h-5 text-indigo-600"})," Contacts"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"One record per person — every call, WhatsApp message, form, and booking across all channels and dates."})]})}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[a.jsx(Uj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),a.jsx("input",{value:t,onChange:v=>{const x=v.target.value;n(x),d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>r(x.trim()),300)},placeholder:"Search by name, email, or phone…",className:"w-full border border-slate-200 rounded-xl pl-9 pr-3 py-2 text-xs text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:Bje.map(v=>a.jsx("button",{onClick:()=>l(v.key),className:`px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all cursor-pointer ${s===v.key?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:v.label},v.key||"all"))})]}),f.status==="LoadingFirstPage"?a.jsx("div",{className:`${rt} p-12 flex justify-center`,children:a.jsx(Bi,{className:"w-6 h-6 text-indigo-500 animate-spin"})}):p.length===0?a.jsxs("div",{className:`${rt} p-10 text-center`,children:[a.jsx(Wo,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-slate-500",children:"No contacts yet. Calls, WhatsApp messages, forms, and bookings will appear here grouped by person."})]}):a.jsxs("div",{className:"space-y-2",children:[f.scanCapped?a.jsx("p",{className:"text-[11px] text-amber-600 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2",children:"Large result set — refine your search or filter to see more."}):null,p.map(v=>{v.latestChannel&&e4[v.latestChannel];const x=v.name||"Unknown caller";return a.jsxs("button",{onClick:()=>h(v._id),className:"w-full text-left flex items-center gap-3 p-3 rounded-2xl border border-slate-100 bg-white hover:border-indigo-200 hover:shadow-sm transition-all cursor-pointer",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-indigo-100 text-indigo-700 flex items-center justify-center font-bold text-sm shrink-0",children:Fje(x)}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-bold text-slate-800 text-sm truncate",children:x}),a.jsx("span",{className:"text-[10px] text-slate-400 font-mono",children:$je(v.lastActivityAt)})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 flex-wrap",children:[(v.channelsUsed??[]).map(b=>{const S=e4[b]??Wo;return a.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-bold uppercase bg-slate-100 text-slate-500 px-1.5 py-0.5 rounded-md",children:[a.jsx(S,{className:"w-2.5 h-2.5"})," ",b]},b)}),typeof v.totalCostCents=="number"&&v.totalCostCents>0?a.jsxs("span",{className:"text-[10px] font-mono font-semibold text-emerald-700 bg-emerald-50 px-1.5 py-0.5 rounded-md",children:["$",(v.totalCostCents/100).toFixed(2)]}):null]})]}),a.jsx(ry,{className:"w-4 h-4 text-slate-300 shrink-0"})]},v._id)}),(f.status==="CanLoadMore"||f.status==="LoadingMore")&&a.jsx("button",{onClick:()=>f.loadMore(25),disabled:f.status==="LoadingMore",className:"w-full py-2.5 text-xs font-bold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-xl transition-all cursor-pointer disabled:opacity-60",children:f.status==="LoadingMore"?"Loading…":"Load more"})]})]})}const Vje=[{key:"",label:"All"},{key:"phone",label:"Calls"},{key:"whatsapp",label:"WhatsApp"},{key:"web",label:"Web"},{key:"form",label:"Forms"}],zje=[{key:"",label:"All types"},{key:"call",label:"Calls"},{key:"whatsapp-text",label:"WhatsApp text"},{key:"whatsapp-voice",label:"Voice notes"},{key:"form",label:"Forms"},{key:"booking",label:"Bookings"}],qje=[{key:"",label:"All statuses"},{key:"new",label:"New"},{key:"booked",label:"Booked"},{key:"open",label:"Open"},{key:"failed",label:"Failed"}],Wje={phone:{icon:Ei,label:"Call",cls:"bg-sky-100 text-sky-700"},whatsapp:{icon:Na,label:"WhatsApp",cls:"bg-emerald-100 text-emerald-700"},web:{icon:Yo,label:"Web",cls:"bg-indigo-100 text-indigo-700"},form:{icon:Ya,label:"Form",cls:"bg-amber-100 text-amber-700"}},t4=e=>!!e&&/^(data:|blob:|https?:)/.test(e);function n4(e){return`$${(e/100).toFixed(2)}`}function i4(e){if(!e)return"";const t=Math.floor(e/60),n=e%60;return t>0?`${t}m ${n}s`:`${n}s`}
731function ck(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Ez({clientId:e,initialRecordingFilter:t=""}){const[n,i]=w.useState(""),[r,s]=w.useState(""),[l,c]=w.useState(""),[h,d]=w.useState(""),[f,p]=w.useState(""),[v,x]=w.useState(t),[b,S]=w.useState(!1);w.useEffect(()=>{t&&x(t)},[t]);const[N,j]=w.useState(""),[T,E]=w.useState(""),C=We(me.contacts.moveInteraction),[P,A]=w.useState(null),[M,R]=w.useState(""),[B,U]=w.useState(null),O=et(me.contactQueries.listContacts,P?{clientId:e,search:M||void 0,paginationOpts:{numItems:6,cursor:null}}:"skip"),F=w.useRef(null);w.useEffect(()=>()=>{F.current&&window.clearTimeout(F.current)},[]);const ne=Hx(me.contactQueries.listInteractions,{clientId:e,search:r||void 0,channel:l||void 0,kind:h||void 0,status:f||void 0,recording:v||void 0,contactId:b?"unlinked":void 0,dateFrom:N?new Date(N).getTime():void 0,dateTo:T?new Date(T+"T23:59:59").getTime():void 0},{initialNumItems:25}),re=ne.results??[],[Q,W]=w.useState({}),q=w.useMemo(()=>{const $=new Map,ge=[];for(const ue of re)ue.channel==="whatsapp"&&ue.threadId?($.has(ue.threadId)||$.set(ue.threadId,[]),$.get(ue.threadId).push(ue)):ge.push(ue);for(const[ue,L]of $){L.sort((ye,Pe)=>ye.createdAt-Pe.createdAt);const J=L[L.length-1];ge.push({...J,_threadMessages:L,_threadCount:L.length,_threadWa:J.waId})}return ge.sort((ue,L)=>L.createdAt-ue.createdAt)},[re]);return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-bold text-slate-900 font-display flex items-center gap-2",children:[a.jsx(zs,{className:"w-5 h-5 text-indigo-600"})," All communications"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Every call, message, form, and booking — newest first. Search finds anything, by person or by what was said."})]})}),a.jsxs("div",{className:"relative",children:[a.jsx(Uj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),a.jsx("input",{value:n,onChange:$=>{const ge=$.target.value;i(ge),F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>s(ge.trim()),300)},placeholder:"Search any message, transcript, purpose, name, email, or phone…",className:"w-full border border-slate-200 rounded-xl pl-9 pr-3 py-2.5 text-xs text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Vje.map($=>a.jsx("button",{onClick:()=>c($.key),className:`px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all cursor-pointer ${l===$.key?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:$.label},$.key||"all")),a.jsx("select",{value:h,onChange:$=>d($.target.value),className:"text-[11px] font-bold bg-slate-100 text-slate-600 border-0 rounded-lg px-2 py-1.5 outline-none cursor-pointer",children:zje.map($=>a.jsx("option",{value:$.key,children:$.label},$.key))}),a.jsx("select",{value:f,onChange:$=>p($.target.value),className:"text-[11px] font-bold bg-slate-100 text-slate-600 border-0 rounded-lg px-2 py-1.5 outline-none cursor-pointer",children:qje.map($=>a.jsx("option",{value:$.key,children:$.label},$.key))}),a.jsxs("select",{value:v,onChange:$=>x($.target.value),className:"text-[11px] font-bold bg-slate-100 text-slate-600 border-0 rounded-lg px-2 py-1.5 outline-none cursor-pointer",title:"Filter by recording outcome",children:[a.jsx("option",{value:"",children:"All recordings"}),a.jsx("option",{value:"recorded",children:"Recorded"}),a.jsx("option",{value:"failed",children:"Recording failed"}),a.jsx("option",{value:"missing",children:"No recording"})]}),a.jsx("input",{type:"date",value:N,onChange:$=>j($.target.value),className:"text-[11px] bg-slate-100 text-slate-600 border-0 rounded-lg px-2 py-1.5 outline-none",title:"From"}),a.jsx("span",{className:"text-[10px] text-slate-400",children:"→"}),a.jsx("input",{type:"date",value:T,onChange:$=>E($.target.value),className:"text-[11px] bg-slate-100 text-slate-600 border-0 rounded-lg px-2 py-1.5 outline-none",title:"To"}),a.jsxs("button",{onClick:()=>S($=>
731!$),className:`inline-flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all cursor-pointer ${b?"bg-amber-500 text-white shadow-sm":"bg-amber-50 text-amber-700 hover:bg-amber-100"}`,title:"Events with no linked contact",children:[a.jsx(l5,{className:"w-3 h-3"})," Unlinked"]})]}),ne.status==="LoadingFirstPage"?a.jsx("div",{className:`${rt} p-12 flex justify-center`,children:a.jsx(Bi,{className:"w-6 h-6 text-indigo-500 animate-spin"})}):re.length===0?a.jsxs("div",{className:`${rt} p-10 text-center`,children:[a.jsx(zs,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-slate-500",children:"No communications match. Adjust filters or the search box."})]}):a.jsxs("div",{className:"space-y-2",children:[ne.scanCapped?a.jsx("p",{className:"text-[11px] text-amber-600 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2",children:"Large result set — refine your search or filters to see more."}):null,q.map($=>{var J;const ge=Wje[$.channel]??{icon:zs,label:$.channel,cls:"bg-slate-100 text-slate-600"},ue=ge.icon,L=$.direction==="outbound";if($._threadMessages){const ye=$._threadMessages,Pe=!!Q[$.threadId],Oe=ye.reduce((je,Ke)=>je+(Ke.costCents??0),0);return a.jsxs("div",{className:`${rt} p-3.5 space-y-2 ${$.contactId?"":"border-amber-200 bg-amber-50/30"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[9px] font-bold uppercase bg-emerald-100 text-emerald-700",children:[a.jsx(Na,{className:"w-3 h-3"})," WhatsApp conversation"]}),a.jsxs("span",{className:"font-mono text-xs font-bold text-emerald-800",children:["+",$._threadWa||"unknown"]}),a.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:[$._threadCount," message",$._threadCount===1?"":"s"]}),a.jsxs("span",{className:"text-[10px] text-slate-400 font-mono ml-auto",children:[ck($.createdAt),Oe>0?` · ${n4(Oe)}`:""]})]}),a.jsx("button",{onClick:()=>W(je=>({...je,[$.threadId]:!Pe})),className:"w-full text-left text-xs text-slate-600 hover:text-slate-800 cursor-pointer",children:a.jsx("span",{className:"line-clamp-2",children:((J=ye[ye.length-1])==null?void 0:J.text)||"Voice note"})}),Pe?a.jsx("div",{className:"space-y-1.5 border-t border-slate-100 pt-2",children:ye.map(je=>a.jsx("div",{className:`flex ${je.direction==="outbound"?"justify-end":"justify-start"}`,children:a.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-2xl text-xs ${je.direction==="outbound"?"bg-indigo-600 text-white rounded-br-sm":"bg-white border border-slate-100 rounded-bl-sm"}`,children:je.kind==="whatsapp-voice"?t4(je.recordingUrl)?a.jsx(gp,{src:je.recordingUrl,compact:!0}):a.jsxs("span",{className:"italic opacity-80",children:["🎙️ Voice note",je.durationSeconds?` · ${i4(je.durationSeconds)}`:"",je.text?` — ${je.text}`:""]}):je.text||a.jsx("span",{className:"italic opacity-70",children:"(no text)"})})},je._id))}):null,a.jsxs("div",{className:"text-[9px] text-slate-400 font-mono",children:[ck($.createdAt)," · latest"]})]},$.threadId)}return a.jsxs("div",{className:`${rt} p-3.5 space-y-1.5 ${$.contactId?"":"border-amber-200 bg-amber-50/30"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[9px] font-bold uppercase ${ge.cls}`,children:[a.jsx(ue,{className:"w-3 h-3"})," ",ge.label]}),$.direction?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-bold uppercase text-slate-400",children:[L?a.jsx(NL,{className:"w-3 h-3"}):a.jsx(wL,{className:"w-3 h-3"}),$.direction]}):null,$.source?a.jsx("span",{className:"text-[9px] font-mono text-slate-400 uppercase",children:$.source}):null,$.contactId?null:a.jsx("span",{className:"inline-flex items-center gap-1 text-[9px] font-bold uppercase bg-amber-100 text-amber-700 px-1.5 py-0.5 rounded-md",children:"Unlinked"}),a.jsxs("span",{className:"text-[10px] text-slate-400 font-mono ml-auto",children:[ck($.createdAt),typeof $.costCents=="number"&&$.costCents>0?` · ${n4($.costCents)}`:"",$.durationSeconds?` · ${i4($.durationSeconds)}`:""]}),$.visitorName||$.visitorPhone||$.visitorEmail?a.jsxs("span",{className:"w-full text-[10px] text-slate-500 font-sans -mt-1",children:[$.visitorName?a.jsx("b",{className:"text-slate-700",children:$.visitorName}):null," ",$.visitorPhone?a.jsxs("span",{className:"font-mono",children:["📞 +",$.visitorPhone]}):null," ",$.visitorEmail?a.jsxs("span",{className:"font-mono",children:["✉️ ",$.visitorEmail]}):null]}):null,$.contactId?a.jsxs("button",{onClick:async()=>{U($._id);try{await C({clientId:e,interactionId:$._id})}finally{U(null)}},disabled:B===$._id,title:"Unlink from this contact",className:"inline-flex items-center gap-1 text-[9px] font-bold text-slate-400 hover:text-rose-500 transition-colors cursor-pointer disabled:opacity-50",children:[a.jsx(CL,{className:"w-3 h-3"})," Unlink"]}):a.jsxs("button",{onClick:()=>{A(P===$._id?null:$._id),R("")},className:"inline-flex items-center gap-1 text-[9px] font-bold text-indigo-600 hover:text-indigo-800 transition-colors cursor-pointer",children:[a.jsx(l5,{className:"w-3 h-3"})," Link"]})]}),P===$._id?a.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-2.5 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{value:M,onChange:ye=>R(ye.target.value),placeholder:"Search contact by name / email / phone…",className:"flex-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsx("button",{onClick:()=>A(null),className:"text-slate-400 hover:text-slate-600 cursor-pointer",children:a.jsx(fn,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-1 max-h-36 overflow-auto",children:[((O==null?void 0:O.page)??[]).map(ye=>{var Pe,Oe;return a.jsxs("button",{disabled:B===$._id,onClick:async()=>{U($._id);try{await C({clientId:e,interactionId:$._id,toContactId:ye._id}),A(null)}finally{U(null)}},className:"w-full text-left px-3 py-1.5 rounded-lg bg-white border border-slate-100 hover:border-indigo-200 text-xs text-slate-700 cursor-pointer disabled:opacity-60",children:[ye.name||"Unknown caller"," ",a.jsx("span",{className:"text-slate-400 font-mono",children:(((Pe=ye.emails)==null?void 0:Pe[0])??"")||(((Oe=ye.phones)==null?void 0:Oe[0])??"")})]},ye._id)}),((O==null?void 0:O.page)??[]).length===0?a.jsx("div",{className:"text-[10px] text-slate-400 px-2 py-1",children:"No contacts match. Type a name/email/phone to search."}):null]})]}):null,$.kind==="whatsapp-text"?a.jsx("div",{className:`flex ${L?"justify-end":"justify-start"}`,children:a.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-2xl text-xs ${L?"bg-indigo-600 text-white rounded-br-sm":"bg-white border border-slate-100 rounded-bl-sm"}`,children:$.text||a.jsx("span",{className:"italic opacity-70",children:"(no text)"})})}):t4($.recordingUrl)?a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a.jsx(gp,{src:$.recordingUrl}),$.text?a.jsx("span",{className:"text-[10px] text-slate-500 italic hidden lg:inline max-w-[40%] truncate",children:$.text}):null]}):a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsx("p",{className:"text-xs text-slate-700 flex-1",children:$.text||$.title}),$.recordingStatus?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-bold text-rose-600 bg-rose-50 border border-rose-200 rounded-md px-1.5 py-0.5 shrink-0",children:[a.jsx(sy,{className:"w-2.5 h-2.5"})," ",$.recordingStatus]}):null]}),$.kind==="booking"?a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-emerald-700",children:[a.jsx(aa,{className:"w-3 h-3"})," Appointment"]}):null]},$._id)}),(ne.status==="CanLoadMore"||ne.status==="LoadingMore")&&a.jsx("button",{onClick:()=>ne.loadMore(25),disabled:ne.status==="LoadingMore",className:"w-full py-2.5 text-xs font-bold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-xl transition-all cursor-pointer disabled:opacity-60",children:ne.status==="LoadingMore"?"Loading…":"Load more"})]})]})}const Hje=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Kje(e){return new Date(e.y,e.m-1,1).toLocaleDateString(void 0,{month:"long",year:"numeric"})}function P0(e){const[t="",n=""]=e.split(" ");return{date:t,time:n}}function Az({clientId:e}){const t=new Date,[n,i]=w.useState({y:t.getFullYear(),m:t.getMonth()+1}),[r,s]=w.useState(null),l=`${n.y}
731-${String(n.m).padStart(2,"0")}`,c=et(me.contactQueries.listBookings,{clientId:e,month:l}),h=c??[],d=new Map;for(const b of h){const S=parseInt(P0(b.dateTime).date.slice(8,10),10);d.has(S)||d.set(S,[]),d.get(S).push(b)}const f=new Date(n.y,n.m-1,1).getDay(),p=new Date(n.y,n.m,0).getDate(),v=[...Array.from({length:f},()=>null),...Array.from({length:p},(b,S)=>S+1)];for(;v.length%7!==0;)v.push(null);const x=b=>{i(({y:S,m:N})=>{const j=new Date(S,N-1+b,1);return{y:j.getFullYear(),m:j.getMonth()+1}})};return a.jsxs("div",{className:`${rt} p-4 space-y-3`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-slate-700",children:[a.jsx(aa,{className:"w-4 h-4 text-indigo-600"})," Bookings calendar"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>x(-1),className:"p-1 rounded-md text-slate-500 hover:bg-slate-100 cursor-pointer",children:a.jsx($Y,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-xs font-bold text-slate-700 min-w-[120px] text-center",children:Kje(n)}),a.jsx("button",{onClick:()=>x(1),className:"p-1 rounded-md text-slate-500 hover:bg-slate-100 cursor-pointer",children:a.jsx(ry,{className:"w-4 h-4"})})]})]}),c===void 0?a.jsx("div",{className:"py-8 flex justify-center",children:a.jsx(Bi,{className:"w-5 h-5 text-indigo-500 animate-spin"})}):h.length===0?a.jsx("div",{className:"py-6 text-center text-xs text-slate-400",children:"No bookings this month."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-7 gap-1",children:[Hje.map(b=>a.jsx("div",{className:"text-center text-[9px] font-bold uppercase text-slate-400 py-1",children:b},b)),v.map((b,S)=>b===null?a.jsx("div",{className:"min-h-[56px] rounded-lg bg-slate-50/50"},`e-${S}`):a.jsxs("div",{className:`min-h-[56px] rounded-lg border p-1 space-y-0.5 ${d.has(b)?"bg-indigo-50/60 border-indigo-100":"bg-white border-slate-100"}`,children:[a.jsx("div",{className:"text-[9px] font-bold text-slate-400",children:b}),(d.get(b)??[]).map(N=>a.jsxs("button",{onClick:()=>s(r===N.id?null:N.id),title:`${N.bookedBy||"Visitor"} — ${P0(N.dateTime).time}`,className:"w-full text-left px-1 py-0.5 rounded bg-emerald-100 text-emerald-800 text-[8px] font-bold truncate hover:bg-emerald-200 cursor-pointer",children:[P0(N.dateTime).time," · ",N.bookedBy||"Visitor"]},N.id))]},b))]}),r?(()=>{const b=h.find(N=>N.id===r);if(!b)return null;const{time:S}=P0(b.dateTime);return a.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-3 text-xs text-slate-700 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-bold",children:b.bookedBy||"Visitor"}),a.jsx("span",{className:"font-mono text-slate-500",children:b.dateTime})]}),b.bookedPhone?a.jsxs("div",{className:"font-mono text-slate-500",children:["📞 +",b.bookedPhone]}):null,b.bookedEmail?a.jsxs("div",{className:"font-mono text-slate-500",children:["✉️ ",b.bookedEmail]}):null,b.bookedPurpose?a.jsx("div",{className:"text-slate-600",children:b.bookedPurpose}):null,a.jsxs("div",{className:"text-[10px] text-emerald-700 font-bold",children:["Booked · ",S]}),b.callRecordingUrl?a.jsxs("div",{className:"pt-1 space-y-1",children:[a.jsx("div",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wide",children:"Related voice call recording"}),a.jsx(gp,{src:b.callRecordingUrl,compact:!0})]}):null]})})():null]})]})}function Pz({clientId:e,onPick:t}){const n=et(me.contactQueries.recordingHealth,{clientId:e});if(n===void 0)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-[11px] text-slate-400",children:[a.jsx(Bi,{className:"w-3.5 h-3.5 animate-spin"})," Loading recording health…"]});const i=n.total,r=[{key:"recorded",label:"Recorded",value:i.recorded,cls:"text-emerald-700 bg-emerald-50 border-emerald-200",icon:kt},{key:"failed",label:"Failed",value:i.failed,cls:"text-rose-700 bg-rose-50 border-rose-200",icon:sy},{key:"missing",label:"Missing",value:i.missing,cls:"text-amber-700 bg-amber-50 border-amber-200",icon:GY}];return a.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 py-2 rounded-xl bg-slate-50 border border-slate-100",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wide text-slate-400 mr-1",children:"Recording health"}),r.map(s=>a.jsxs("button",{onClick:()=>t(s.key),title:`Show ${s.label.toLowerCase()} calls in the feed`,className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg border text-[11px] font-bold transition-transform hover:scale-[1.03] cursor-pointer ${s.cls}`,children:[a.jsx(s.icon,{className:"w-3 h-3"})," ",s.label," ",s.value]},s.key)),i.total===0?a.jsx("span",{className:"text-[10px] text-slate-400",children:"No calls yet"}):null]})}function Gje({className:e="",...t}){return a.jsx("div",{className:`${rt} ${e}`,...t})}const r4={slate:"text-slate-600",indigo:"text-indigo-600",emerald:"text-emerald-600",rose:"text-rose-500"};function ir({icon:e,label:t,value:n,sub:i,tone:r="indigo",className:s=""}){return a.jsxs(Gje,{className:`p-5 space-y-2 ${s}`,children:[a.jsx("span",{className:"text-slate-400 text-xs font-bold font-display",children:t}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e,{className:`w-5 h-5 ${r4[r]??r4.indigo}`}),a.jsx("span",{className:"text-2xl font-extrabold text-slate-900",children:n})]}),i!=null&&a.jsx("p",{className:"text-[10px] text-slate-500",children:i})]})}const Yje=["active","beta","deprecated"],Qje=["free","starter","pro","enterprise"];function Xje(){const e=et(me.toolCatalog.listCatalog,{}
731),t=We(me.toolCatalog.upsertCatalogEntry),n=We(me.toolCatalog.setCatalogStatus),i=We(me.toolCatalog.seedCatalog),[r,s]=w.useState(null),[l,c]=w.useState({}),[h,d]=w.useState(!1),[f,p]=w.useState(null);function v(b){s(b.key),c({name:b.name,description:b.description,version:b.version,category:b.category,planTier:b.planTier??"",defaultEnabled:b.defaultEnabled?"true":"false"}),p(null)}async function x(b,S){d(!0),p(null);try{await t({key:b,name:l.name,description:l.description,version:l.version,category:l.category,configSchema:S.configSchema,defaultEnabled:l.defaultEnabled==="true",planTier:l.planTier||void 0,status:S.status}),s(null)}catch(N){p(N instanceof Error?N.message:String(N))}finally{d(!1)}}return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yv,{className:"w-4 h-4 text-indigo-600"}),a.jsx("h4",{className:"text-sm font-bold text-slate-800",children:"Tool Catalog"}),a.jsxs("button",{onClick:()=>i({}),className:"ml-auto inline-flex items-center gap-1.5 px-3 py-2 text-xs font-semibold text-indigo-600 bg-indigo-50 rounded-lg hover:bg-indigo-100",children:[a.jsx(xs,{className:"w-3.5 h-3.5"})," Seed / re-sync"]})]}),f&&a.jsx("div",{className:"text-[11px] text-rose-600 bg-rose-50 px-3 py-2 rounded-lg",children:f}),a.jsx("div",{className:"space-y-2",children:(e||[]).map(b=>{const S=r===b.key;return a.jsxs("div",{className:"border border-slate-200 rounded-xl p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-xs font-mono font-bold text-slate-800",children:b.key}),a.jsx("select",{value:b.status,onChange:N=>n({key:b.key,status:N.target.value}),className:"px-2 py-1 text-[10px] border border-slate-200 rounded-md",children:Yje.map(N=>a.jsx("option",{value:N,children:N},N))}),b.planTier&&a.jsx("span",{className:"text-[10px] text-slate-400",children:b.planTier}),a.jsx("button",{onClick:()=>S?s(null):v(b),className:"ml-auto text-[11px] font-semibold text-indigo-600 hover:underline",children:S?"Cancel":"Edit"})]}),S?a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[["name","description","version","category"].map(N=>a.jsx("input",{value:l[N]??"",onChange:j=>c(T=>({...T,[N]:j.target.value})),placeholder:N,className:`px-2.5 py-1.5 text-xs border border-slate-200 rounded-lg ${N==="description"?"col-span-2":""}`},N)),a.jsxs("select",{value:l.planTier??"",onChange:N=>c(j=>({...j,planTier:N.target.value})),className:"px-2.5 py-1.5 text-xs border border-slate-200 rounded-lg",children:[a.jsx("option",{value:"",children:"no plan tier"}),Qje.map(N=>a.jsx("option",{value:N,children:N},N))]}),a.jsxs("select",{value:l.defaultEnabled??"false",onChange:N=>c(j=>({...j,defaultEnabled:N.target.value})),className:"px-2.5 py-1.5 text-xs border border-slate-200 rounded-lg",children:[a.jsx("option",{value:"false",children:"default off"}),a.jsx("option",{value:"true",children:"default on"})]}),a.jsxs("button",{onClick:()=>x(b.key,b),disabled:h,className:"col-span-2 inline-flex items-center justify-center gap-1.5 px-3 py-2 text-xs font-semibold text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," Save"]})]}):a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-semibold text-slate-700",children:b.name}),a.jsx("div",{className:"text-[11px] text-slate-500",children:b.description}),a.jsxs("div",{className:"text-[10px] text-slate-400 mt-1",children:["v",b.version," · ",b.category," · default ",b.defaultEnabled?"on":"off"]})]})]},b.key)})})]})}function Jje(e,t){const n=[];return Tj(e,t,"",n),n}function Tj(e,t,n,i){var r;if(!e||typeof e!="object"||typeof e.type!="string"){i.push({path:n,message:"Invalid schema node."});return}switch(e.type){case"object":{if(t===null||typeof t!="object"||Array.isArray(t)){i.push({path:n,message:"Expected an object."});return}const s=e,l=t;for(const c of Object.keys(s.properties)){const h=n?`${n}.${c}`:c;if(l[c]===void 0||l[c]===null){(r=s.required)!=null&&r.includes(c)&&i.push({path:h,message:"Required field is missing."});continue}Tj(s.properties[c],l[c],h,i)}if(s.additionalProperties===!1)for(const c of Object.keys(l))c in s.properties||i.push({path:n?`${n}.${c}`:c,message:"Unknown field (additionalProperties:false)."});return}
731case"string":{if(typeof t!="string"){i.push({path:n,message:"Expected a string."});return}const s=e;s.enum&&!s.enum.includes(t)&&i.push({path:n,message:`Must be one of: ${s.enum.join(", ")}.`});return}case"number":{if(typeof t!="number"||!Number.isFinite(t)){i.push({path:n,message:"Expected a number."});return}const s=e;s.minimum!==void 0&&t<s.minimum&&i.push({path:n,message:`Must be ≥ ${s.minimum}.`}),s.maximum!==void 0&&t>s.maximum&&i.push({path:n,message:`Must be ≤ ${s.maximum}.`});return}case"boolean":{typeof t!="boolean"&&i.push({path:n,message:"Expected a boolean."});return}case"array":{if(!Array.isArray(t)){i.push({path:n,message:"Expected an array."});return}const s=e;s.minItems!==void 0&&t.length<s.minItems&&i.push({path:n,message:`Must have ≥ ${s.minItems} items.`}),s.maxItems!==void 0&&t.length>s.maxItems&&i.push({path:n,message:`Must have ≤ ${s.maxItems} items.`}),t.forEach((l,c)=>Tj(s.items,l,`${n}[${c}]`,i));return}default:i.push({path:n,message:`Unknown schema type "${e.type}".`})}}function _z(e){switch(e.type){case"object":{const t={};for(const[n,i]of Object.entries(e.properties))t[n]=_z(i);return t}case"string":return e.default??"";case"number":return e.default??0;case"boolean":return e.default??!1;case"array":return[]}}function Zje({scope:e,labelPrefix:t,schema:n,initialConfig:i,initialSecretRefs:r,disabled:s,onSave:l}){const[c,h]=w.useState(()=>({..._z(n),...i||{}})),[d,f]=w.useState({}),[p,v]=w.useState({...r}),[x,b]=w.useState(!1),[S,N]=w.useState(null),j=zo(me.secretVault.writeSecret),T=et(me.secretVault.listSecretsForScope,{scope:e}),E=w.useMemo(()=>new Set((T||[]).map(R=>R.label)),[T]);if(n.type!=="object")return a.jsx("div",{className:"text-xs text-slate-500",children:"Tool config schema must be an object."});const C=w.useMemo(()=>Jje(n,c),[n,c]),P=R=>{var B;return(B=C.find(U=>U.path===R))==null?void 0:B.message};function A(R,B){h(U=>({...U,[R]:B}))}async function M(){N(null),b(!0);try{const R={...p};for(const[B,U]of Object.entries(d)){if(!U)continue;const O=`${t}.${B}`,F=await j({scope:e,label:O,plaintext:U}),ne=F==null?void 0:F.id;ne&&(R[B]=ne)}await l(c,R),v(R),f({})}catch(R){N(R instanceof Error?R.message:String(R))}finally{b(!1)}}return a.jsxs("div",{className:"space-y-3",children:[Object.entries(n.properties).map(([R,B])=>{const U=B.title??R,O=B.type==="string"&&B.secret===!0,F=`${t}.${R}`,ne=E.has(F)||!!p[R],re=P(R);return a.jsxs("div",{children:[a.jsxs("label",{className:"block text-[11px] font-semibold text-slate-600 mb-1",children:[U,O&&a.jsx("span",{className:"ml-1.5 text-amber-600",children:"● secret (vault-stored)"})]}),O?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"password",placeholder:ne?"•••••••• (stored — type to replace)":"enter value",value:d[R]??"",disabled:s||x,onChange:Q=>f(W=>({...W,[R]:Q.target.value})),className:"flex-1 px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"}),ne&&!d[R]&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-600",children:[a.jsx(Lm,{className:"w-3 h-3"})," configured"]})]}):B.type==="boolean"?a.jsxs("label",{className:"inline-flex items-center gap-2 text-xs text-slate-700",children:[a.jsx("input",{type:"checkbox",checked:!!c[R],disabled:s||x,onChange:Q=>A(R,Q.target.checked),className:"rounded border-slate-300"}),c[R]?"Enabled":"Disabled"]}):B.type==="number"?a.jsx("input",{type:"number",value:c[R],disabled:s||x,onChange:Q=>A(R,Q.target.value===""?0:Number(Q.target.value)),className:"w-full px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500"}):B.type==="string"&&B.enum?a.jsx("select",{value:c[R],disabled:s||x,onChange:Q=>A(R,Q.target.value),className:"w-full px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500",children:B.enum.map(Q=>a.jsx("option",{value:Q,children:Q},Q))}):a.jsx("input",{type:"text",value:c[R]??"",disabled:s||x,onChange:Q=>A(R,Q.target.value),className:"w-full px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500"}),re&&a.jsx("p",{className:"mt-1 text-[10px] text-rose-600",children:re})]},R)}),S&&a.jsxs("div",{className:"flex items-start gap-2 text-[11px] text-rose-600 bg-rose-50 px-3 py-2 rounded-lg",children:[a.jsx(xa,{
731className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:S})]}),a.jsxs("button",{onClick:M,disabled:s||x||C.length>0,className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs font-semibold text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," ",x?"Saving…":"Save settings"]})]})}function Mz({vas:e}){var S;const[t,n]=w.useState(((S=e[0])==null?void 0:S._id)??""),[i,r]=w.useState(null),s=et(me.toolCatalog.listCatalog,{status:"active"}),l=et(me.vaToolAttachments.listAttachmentsForVa,t?{vaId:t}:"skip"),c=We(me.vaToolAttachments.upsertAttachment),h=We(me.vaToolAttachments.deleteAttachment),d=We(me.vaToolAttachments.setAttachmentEnabled),f=We(me.vaToolAttachments.applyDefaultAttachments),p=new Map((l||[]).map(N=>[N.toolKey,N]));async function v(N,j){t&&(await c({vaId:t,toolKey:N,enabled:!0,config:{},secretRefs:{}}),r(N))}async function x(N){!t||N==="intake"||(await h({vaId:t,toolKey:N}),i===N&&r(null))}async function b(N,j,T){var E;t&&await c({vaId:t,toolKey:N,enabled:((E=p.get(N))==null?void 0:E.enabled)??!0,config:j,secretRefs:T})}return e.length?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(kv,{className:"w-4 h-4 text-indigo-600"}),a.jsx("select",{value:t,onChange:N=>{n(N.target.value),r(null)},className:"px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500",children:e.map(N=>a.jsx("option",{value:N._id,children:N.name||N._id},N._id))}),a.jsx("button",{onClick:()=>f({vaId:t}),className:"ml-auto px-3 py-2 text-xs font-semibold text-indigo-600 bg-indigo-50 rounded-lg hover:bg-indigo-100",children:"Apply default attachments"})]}),a.jsx("div",{className:"space-y-2",children:(s||[]).map(N=>{const j=p.get(N.key),T=N.key==="intake",E=i===N.key;return a.jsxs("div",{className:"border border-slate-200 rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[a.jsx("button",{onClick:()=>j&&r(E?null:N.key),className:"text-slate-400",disabled:!j,children:E?a.jsx(Ek,{className:"w-4 h-4"}):a.jsx(ry,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"text-xs font-semibold text-slate-800 flex items-center gap-2",children:[N.name,T&&a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase",children:"always-on"}),(j==null?void 0:j.enabled)===!1&&a.jsx("span",{className:"text-[9px] font-bold text-amber-500 uppercase",children:"disabled"})]}),a.jsx("div",{className:"text-[11px] text-slate-500",children:N.description})]}),j&&!T&&a.jsx("button",{title:j.enabled?"Disable":"Enable",onClick:()=>d({vaId:t,toolKey:N.key,enabled:!j.enabled}),className:`p-1.5 rounded-lg ${j.enabled?"text-emerald-600 hover:bg-emerald-50":"text-slate-400 hover:bg-slate-50"}`,children:a.jsx(Xd,{className:"w-4 h-4"})}),j?!T&&a.jsx("button",{title:"Detach",onClick:()=>x(N.key),className:"p-1.5 rounded-lg text-rose-500 hover:bg-rose-50",children:a.jsx(xi,{className:"w-4 h-4"})}):!T&&a.jsxs("button",{title:"Attach",onClick:()=>v(N.key),className:"inline-flex items-center gap-1 px-2.5 py-1.5 text-[11px] font-semibold text-indigo-600 bg-indigo-50 rounded-lg hover:bg-indigo-100",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," Attach"]})]}),E&&j&&a.jsx("div",{className:"px-4 py-3 bg-slate-50 border-t border-slate-200",children:a.jsx(Zje,{scope:t,labelPrefix:N.key,schema:N.configSchema,initialConfig:j.config||{},initialSecretRefs:j.secretRefs||{},onSave:(C,P)=>b(N.key,C,P)})})]},N.key)})})]}):a.jsx("div",{className:"text-xs text-slate-500 p-4",children:"No voice agents available for this client."})}function eCe(){const e=zo(me.toolRegistryMigrations.migrateIntegrationsToVaultAttachments),t=zo(me.toolRegistryMigrations.migrateSheetsPrivateKeyToVault),n=zo(me.toolRegistryMigrations.backfillDefaultAttachmentsAllVas),i=zo(me.toolRegistryMigrations.clearLegacyPlaintextApiTokens),[r,s]=w.useState(null),[l,c]=w.useState({}),[h,d]=w.useState(null),[f,p]=w.useState(!0);async function v(x,b){s(x),d(null);try{const S=await b();c(N=>({...N,[x]:S}))}catch(S){d(S instanceof Error?S.message:String(S))}finally{s(null)}}return a.jsxs("div",{className:"border border-slate-200 rounded-xl p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Qa,{className:"w-4 h-4 text-indigo-600"}),a.jsx("h5",{className:"text-sm font-bold text-slate-800",children:"Vault migrations"}),a.jsx("span",{className:"text-[10px] text-slate-400",children:"idempotent · superadmin · run with legacy path still live"})]}),h&&a.jsx("div",{className:"text-[11px] text-rose-600 bg-rose-50 px-3 py-2 rounded-lg",children:h}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[a.jsx(uk,{icon:a.jsx(o5,{className:"w-3.5 h-3.5"}
731),label:"Migrate merchant tokens",sub:"integrations.apiToken → vault + merchant-store attachment per VA",busy:r==="integrations",report:l.integrations?JSON.stringify(l.integrations):null,onClick:()=>v("integrations",()=>e({}))}),a.jsx(uk,{icon:a.jsx(o5,{className:"w-3.5 h-3.5"}),label:"Migrate Sheets keys",sub:"clients.sheetsConfig.privateKey → vault, plaintext cleared",busy:r==="sheets",report:l.sheets?JSON.stringify(l.sheets):null,onClick:()=>v("sheets",()=>t({}))}),a.jsx(uk,{icon:a.jsx(xL,{className:"w-3.5 h-3.5"}),label:"Backfill default attachments",sub:"apply defaultEnabled catalog tools to every VA",busy:r==="attachments",report:l.attachments?JSON.stringify(l.attachments):null,onClick:()=>v("attachments",()=>n({}))})]}),a.jsxs("div",{className:"border-t border-slate-200 pt-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(pQ,{className:"w-3.5 h-3.5 text-amber-600"}),a.jsx("h6",{className:"text-xs font-bold text-slate-800",children:"8.1 data-clear (post-soak)"}),a.jsx("span",{className:"text-[10px] text-slate-400",children:"run only after a release with zero [vault-shim] fallback reads"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"inline-flex items-center gap-1.5 text-[11px] text-slate-600",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:x=>p(x.target.checked),className:"rounded"}),"Dry run (count only, don't clear)"]}),a.jsx("button",{onClick:()=>v("clearTokens",()=>i({dryRun:f})),disabled:r==="clearTokens",className:"px-3 py-1.5 text-xs font-semibold text-white bg-amber-600 rounded-lg hover:bg-amber-700 disabled:opacity-50",children:r==="clearTokens"?"Running…":f?"Dry-run clear":"Clear legacy apiTokens"})]}),l.clearTokens&&a.jsx("pre",{className:"text-[9px] text-slate-600 bg-slate-50 border border-slate-200 rounded p-2 overflow-auto max-h-24 font-mono",children:JSON.stringify(l.clearTokens)}),a.jsxs("p",{className:"text-[10px] text-slate-400 leading-relaxed",children:["Blanks ",a.jsx("code",{children:"integrations.credentials.apiToken"})," on every row still carrying one. The vault (7.1) already holds the encrypted copy; the shim's plaintext fallback is the only reader, so clearing it makes the fallback a no-op — observe zero [vault-shim] no-plaintext logs before the irreversible schema column drop + shim removal."]})]})]})}function uk({icon:e,label:t,sub:n,busy:i,report:r,onClick:s}){return a.jsxs("div",{className:"border border-slate-200 rounded-lg p-3 space-y-2",children:[a.jsxs("button",{onClick:s,disabled:i,className:"w-full inline-flex items-center justify-center gap-1.5 px-3 py-2 text-xs font-semibold text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:[e," ",i?"Running…":t]}),a.jsx("div",{className:"text-[10px] text-slate-500 leading-relaxed",children:n}),r&&a.jsx("pre",{className:"text-[9px] text-slate-600 bg-slate-50 border border-slate-200 rounded p-2 overflow-auto max-h-24 font-mono",children:r})]})}function tCe(e){const t={};for(const n of e.nodes??[]){const i=n.adminEditable??[];if(i.length===0)continue;const r={};for(const s of i)s in n&&(r[s]=n[s]);Object.keys(r).length>0&&(t[n.id]=r)}return t}const s4=["greeting","conversation","branch","tool","hangup"],nCe=["eq","neq","exists","not_exists","contains","gt","lt"],a4=new Set(["eq","neq","contains","gt","lt"]);function o4(e,t){switch(e){case"greeting":return{id:t,type:e,text:"",edges:[{to:""}]};case"conversation":return{id:t,type:e,prompt:"",tools:["intake"],edges:[{to:""}],adminEditable:["prompt","tools"]};case"branch":return{id:t,type:e,edges:[{to:"",when:{field:"",op:"eq",value:""}},{to:""}]};case"tool":return{id:t,type:e,toolKey:"",resultSlot:"",edges:[{to:""}]};case"hangup":return{id:t,type:e,closingText:"",summary:!0,followUpEmail:!0}}}function Rz({vaId:e,mode:t}){const n=et(me.flowDefinitions.getActiveFlow,{vaId:e}),i=et(me.flowDefinitions.listFlowVersions,{vaId:e}),r=et(me.vaToolAttachments.listAttachmentsForVa,{vaId:e}),s=We(me.flowDefinitions.createFlowDraft),l=We(me.flowDefinitions.updateFlowDraft),c=We(me.flowDefinitions.activateFlow),h=We(me.flowDefinitions.adminPatchActive),d=We(me.flowDefinitions.ensureDefaultFlow),f=w.useMemo(()=>(r||[]).filter(Q=>Q.enabled).map(Q=>Q.toolKey),[r]),[p,v]=w.useState(null),[x,b]=w.useState(null),[S,N]=w.useState(null),[j,T]=w.useState(!1),[E,C]=w.useState(!1),P=(n==null?void 0:n.flow)??null,A=p??P;function M(Q){A&&(v({...A,nodes:Q(A.nodes)}),C(!1))}function R(Q,W){M(q=>q.map($=>
731$.id===Q?{...$,...W}:$))}function B(Q){if(!A)return;const W=`${Q}-${Date.now().toString(36)}`;M(q=>[...q,o4(Q,W)])}function U(Q){M(W=>W.filter(q=>q.id!==Q))}function O(Q,W){M(q=>{const $=q.findIndex(L=>L.id===Q),ge=$+W;if($<0||ge<0||ge>=q.length)return q;const ue=[...q];return[ue[$],ue[ge]]=[ue[ge],ue[$]],ue})}function F(Q,W){return t==="superadmin"?!0:(Q.adminEditable??[]).includes(W)}async function ne(){if(A){T(!0),N(null),C(!1);try{if(t==="admin"){const Q={nodes:tCe(A)};await h({vaId:e,patch:Q})}else if(x)await l({flowId:x,flow:A});else{const Q=await s({vaId:e,flow:A});b(Q)}C(!0)}catch(Q){N(Q instanceof Error?Q.message:String(Q))}finally{T(!1)}}}async function re(Q){T(!0),N(null);try{await c({flowId:Q})}catch(W){N(W instanceof Error?W.message:String(W))}finally{T(!1)}}return n===void 0||i===void 0?a.jsx("div",{className:"text-xs text-slate-400 p-4",children:"Loading flow…"}):A?a.jsxs("div",{className:"space-y-4",children:[t==="superadmin"&&a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:s4.map(Q=>a.jsxs("button",{onClick:()=>B(Q),className:"inline-flex items-center gap-1 px-2.5 py-1.5 text-[11px] font-semibold text-indigo-600 bg-indigo-50 rounded-lg hover:bg-indigo-100",children:[a.jsx(cr,{className:"w-3 h-3"})," ",Q]},Q))}),S&&a.jsxs("div",{className:"flex items-start gap-2 text-[11px] text-rose-600 bg-rose-50 px-3 py-2 rounded-lg",children:[a.jsx(xa,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:S})]}),a.jsx("div",{className:"space-y-2",children:A.nodes.map((Q,W)=>a.jsxs("div",{className:"border border-slate-200 rounded-xl p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[10px] font-mono text-slate-400",children:["#",W]}),t==="superadmin"?a.jsx("select",{value:Q.type,onChange:q=>R(Q.id,{...o4(q.target.value,Q.id)}),className:"px-2 py-1 text-[11px] border border-slate-200 rounded-md",children:s4.map(q=>a.jsx("option",{value:q,children:q},q))}):a.jsx("span",{className:"text-xs font-semibold text-slate-700 uppercase",children:Q.type}),a.jsx("input",{value:Q.id,onChange:q=>R(Q.id,{id:q.target.value}),disabled:!F(Q,"id"),className:"px-2 py-1 text-[11px] font-mono border border-slate-200 rounded-md w-32"}),t==="superadmin"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>O(Q.id,-1),className:"p-1 text-slate-400 hover:text-slate-700",children:a.jsx(_Y,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>O(Q.id,1),className:"p-1 text-slate-400 hover:text-slate-700",children:a.jsx(TY,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>U(Q.id),className:"ml-auto p-1 text-rose-500 hover:bg-rose-50 rounded",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]})]}),a.jsx(iCe,{node:Q,attachedTools:f,editable:F,patch:R})]},Q.id))}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap pt-2 border-t border-slate-100",children:[a.jsxs("button",{onClick:ne,disabled:j,className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs font-semibold text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," ",j?"Saving…":t==="admin"?"Save admin edits":x?"Update draft":"Save draft"]}),E&&a.jsx("span",{className:"text-[11px] text-emerald-600",children:"Saved."}),t==="superadmin"&&x&&a.jsxs("button",{onClick:()=>re(x),disabled:j,className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs font-semibold text-white bg-emerald-600 rounded-lg hover:bg-emerald-700 disabled:opacity-50",children:[a.jsx(d5,{className:"w-3.5 h-3.5"})," Activate"]})]}),a.jsxs("div",{className:"pt-3 border-t border-slate-100",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-semibold text-slate-500 mb-2",children:[a.jsx(Ak,{className:"w-3.5 h-3.5"})," Version history"]}),a.jsx("div",{className:"space-y-1",children:(i||[]).map(Q=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{className:"font-mono text-slate-500",children:["v",Q.version]}),a.jsx("span",{className:`px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase ${Q.status==="active"?"bg-emerald-100 text-emerald-700":Q.status==="draft"?"bg-amber-100 text-amber-700":"bg-slate-100 text-slate-500"}`,children:Q.status}),t==="superadmin"&&Q.status!=="active"&&a.jsx("button",{onClick:()=>re(Q._id),className:"text-indigo-600 hover:underline",children:"activate"})]},Q._id))})]})]}):a.jsxs("div",{className:"space-y-3 p-4 border border-dashed border-slate-300 rounded-xl",children:[a.jsx("p",{className:"text-xs text-slate-500",children:"This VA has no active flow."}),t==="superadmin"&&a.jsxs("button",{onClick:()=>d({vaId:e}),className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs font-semibold text-white bg-indigo-600 rounded-lg hover:bg-indigo-700",children:[a.jsx(d5,{className:"w-3.5 h-3.5"})," Materialize & insert default flow"]})]})}function iCe({node:e,attachedTools:t,editable:n,patch:i}){const r=w.useMemo(()=>Array.from(new Set(["intake",...t])),[t]);return e.type==="greeting"?a.jsx("textarea",{value:e.text??"",disabled:!n(e,"text"),onChange:s=>i(e.id,{text:s.target.value}),placeholder:"Opening greeting text",rows:2,className:"w-full px-3 py-2 text-xs border border-slate-200 rounded-lg disabled:bg-slate-50"}):e.type==="conversation"?a.jsxs("div",{className:"space-y-2",children:[a.jsx("textarea",{value:e.prompt??"",disabled:!n(e,"prompt"),onChange:s=>i(e.id,{prompt:s.target.value}),placeholder:"Conversation turn goal / prompt",rows:3,className:"w-full px-3 py-2 text-xs border border-slate-200 rounded-lg disabled:bg-slate-50"}),a.jsxs("div",{className:"flex items-start gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] font-semibold text-slate-500 mt-1.5",children:"Tools:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(s=>{const l=(e.tools??[]).includes(s);return a.jsxs("button",{disabled:!n(e,"tools")||s==="intake",onClick:()=>i(e.id,{tools:l?(e.tools??[]).filter(c=>c!==s):[...e.tools??[],s]}),className:`px-2 py-1 text-[10px] font-semibold rounded-md ${l?"bg-indigo-600 text-white":"bg-slate-100 text-slate-500"} ${s==="intake"?"opacity-60 cursor-not-allowed":"hover:bg-indigo-100"}`,children:[s,s==="intake"&&" ●"]},s)})})]}),a.jsx(l4,{node:e,patch:i})]}):e.type==="branch"?a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-[11px] text-slate-500",children:"Outgoing edges — first match wins; last is the default (no condition)."}),(e.edges??[]).map((s,l)=>a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(sCe,{when:s.when,disabled:!1,onChange:c=>{const h=[...e.edges??[]];h[l]={...s,when:c},i(e.id,{edges:h})}}),a.jsx("span",{className:"text-[10px] text-slate-400",children:"→"}),a.jsx("input",{value:s.to,onChange:c=>{const h=[...e.edges??[]];h[l]={...s,to:c.target.value},i(e.id,{edges:h})},placeholder:"to node id",className:"px-2 py-1 text-[11px] font-mono border border-slate-200 rounded-md w-32"}),rCe(e,l,i)]},l)),a.jsx("button",{onClick:()=>i(e.id,{edges:[...e.edges??[],{to:"",when:{field:"",op:"eq",value:""}}]}),className:"text-[11px] font-semibold text-indigo-600 hover:underline",children:"+ add edge"})]}):e.type==="tool"?a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("select",{value:e.toolKey??"",disabled:!n(e,"toolKey"),onChange:s=>i(e.id,{toolKey:s.target.value}),className:"px-2 py-1.5 text-xs border border-slate-200 rounded-lg col-span-2",children:[a.jsx("option",{value:"",children:"select tool…"}),t.map(s=>a.jsx("option",{value:s,children:s},s))]}),a.jsx("input",{value:e.resultSlot??"",disabled:!n(e,"resultSlot"),onChange:s=>i(e.id,{resultSlot:s.target.value}),placeholder:"resultSlot",className:"px-2 py-1.5 text-[11px] font-mono border border-slate-200 rounded-lg"}),a.jsx("div",{className:"col-span-3",children:a.jsx(l4,{node:e,patch:i})})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("textarea",{value:e.closingText??"",disabled:!n(e,"closingText"),onChange:s=>i(e.id,{closingText:s.target.value}),placeholder:"Closing text",rows:2,className:"w-full px-3 py-2 text-xs border border-slate-200 rounded-lg disabled:bg-slate-50"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("label",{className:"inline-flex items-center gap-1.5 text-[11px] text-slate-600",children:[a.jsx("input",{type:"checkbox",checked:!!e.summary,disabled:!n(e,"summary"),onChange:s=>i(e.id,{summary:s.target.checked})}),"summary"]}),a.jsxs("label",{className:"inline-flex items-center gap-1.5 text-[11px] text-slate-600",children:[a.jsx("input",{type:"checkbox",checked:!!e.followUpEmail,disabled:!n(e,"followUpEmail"),onChange:s=>i(e.id,{followUpEmail:s.target.checked})}),"follow-up email"]})]})]})}function rCe(e,t,n){return a.jsx("button",{onClick:()=>{const i=(e.edges??[]).filter((r,s)=>s!==t);n(e.id,{edges:i})},className:"p-1 text-rose-500 hover:bg-rose-50 rounded",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})}function l4({node:e,patch:t}){const n=(e.edges??[])[0]??{to:""};return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold text-slate-500",children:"next:"}),a.jsx("input",{value:n.to,onChange:i=>t(e.id,{edges:[{to:i.target.value}]}),placeholder:"to node id",className:"px-2 py-1 text-[11px] font-mono border border-slate-200 rounded-md w-40"})]})}
731function sCe({when:e,disabled:t,onChange:n}){if(!e)return a.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase px-1.5 py-0.5 bg-slate-100 rounded-full",children:"default"});const i=e.op;return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:e.field,disabled:t,onChange:r=>n({...e,field:r.target.value}),placeholder:"$state.field",className:"px-2 py-1 text-[11px] font-mono border border-slate-200 rounded-md w-32"}),a.jsx("select",{value:i,disabled:t,onChange:r=>{const s=r.target.value;n({...e,op:s,value:a4.has(s)?e.value:void 0})},className:"px-2 py-1 text-[11px] border border-slate-200 rounded-md",children:nCe.map(r=>a.jsx("option",{value:r,children:r},r))}),a4.has(i)&&a.jsx("input",{value:typeof e.value=="string"?e.value:JSON.stringify(e.value??""),disabled:t,onChange:r=>n({...e,value:r.target.value}),placeholder:"value",className:"px-2 py-1 text-[11px] border border-slate-200 rounded-md w-28"})]})}const aCe=["English","Urdu","Multi","Hindi","Pashto","Punjabi","Bengali","Arabic","Marathi","Tamil","Telugu","Spanish","French","German","Italian","Portuguese","Russian","Turkish","Japanese","Korean","Indonesian","Thai","Vietnamese","Dutch","Polish","Romanian","Ukrainian"];function oCe(e){return aCe}const Oz=[{id:"Puck",name:"Puck",provider:"gemini",gender:"male",accent:"American",description:"Upbeat, friendly male"},{id:"Charon",name:"Charon",provider:"gemini",gender:"male",accent:"American",description:"Deep, measured male"},{id:"Fenrir",name:"Fenrir",provider:"gemini",gender:"male",accent:"Neutral",description:"Gritty, raspy male"},{id:"Orus",name:"Orus",provider:"gemini",gender:"male",accent:"Neutral",description:"Firm, confident male"},{id:"Gacrux",name:"Gacrux",provider:"gemini",gender:"male",accent:"American",description:"Mature, gravelly male"},{id:"Algenib",name:"Algenib",provider:"gemini",gender:"male",accent:"Neutral",description:"Earnest, mid-range male"},{id:"Aoede",name:"Aoede",provider:"gemini",gender:"female",accent:"American",description:"Breezy, warm female"},{id:"Kore",name:"Kore",provider:"gemini",gender:"female",accent:"American",description:"Firm, clear female"},{id:"Leda",name:"Leda",provider:"gemini",gender:"female",accent:"American",description:"Mature, calm female"},{id:"Zephyr",name:"Zephyr",provider:"gemini",gender:"female",accent:"American",description:"Bright, airy female"},{id:"Autonoe",name:"Autonoe",provider:"gemini",gender:"female",accent:"Neutral",description:"Expressive, mid female"},{id:"Despina",name:"Despina",provider:"gemini",gender:"female",accent:"Neutral",description:"Warm, steady female"},{id:"Callirhoe",name:"Callirhoe",provider:"gemini",gender:"female",accent:"Neutral",description:"Gentle, smooth female"},{id:"Laomedeia",name:"Laomedeia",provider:"gemini",gender:"female",accent:"Neutral",description:"Soft, breathy female"},{id:"Sulafat",name:"Sulafat",provider:"gemini",gender:"female",accent:"Neutral",description:"Bright, clear female"},{id:"Achird",name:"Achird",provider:"gemini",gender:"neutral",accent:"Neutral",description:"Neutral, balanced"}],lCe=[{id:"alloy",name:"Alloy",provider:"openai",gender:"neutral",accent:"American",description:"Neutral, versatile"},{id:"ash",name:"Ash",provider:"openai",gender:"male",accent:"American",description:"Calm, low male"},{id:"ballad",name:"Ballad",provider:"openai",gender:"male",accent:"American",description:"Warm, soft male"},{id:"cora",name:"Cora",provider:"openai",gender:"female",accent:"American",description:"Friendly, clear female"},{id:"echo",name:"Echo",provider:"openai",gender:"male",accent:"American",description:"Crisp, neutral male"},{id:"fable",name:"Fable",provider:"openai",gender:"neutral",accent:"British",description:"Theatrical, British"},{id:"sage",name:"Sage",provider:"openai",gender:"female",accent:"American",description:"Calm, mature female"},{id:"shimmer",name:"Shimmer",provider:"openai",gender:"female",accent:"American",description:"Bright, warm female"},{id:"verse",name:"Verse",provider:"openai",gender:"male",accent:"American",description:"Steady, mid male"},{id:"nova",name:"Nova",provider:"openai",gender:"female",accent:"American",description:"Energetic, clear female"},{id:"cherry",name:"Cherry",provider:"openai",gender:"female",accent:"American",description:"Playful, bright female"},{id:"juniper",name:"Juniper",provider:"openai",gender:"female",accent:"American",description:"Soft, warm female"}],Iz=[...Oz,...lCe],cCe=["male","female","neutral"];function Dz(e){return e?Iz.filter(t=>t.provider===e):Oz}function uCe(e){const t=new Set(Dz(e).map(n=>n.accent));return Array.from(t).sort()}function c4(e){if(e)return Iz.find(t=>
731t.id===e)}function bb({provider:e,voice:t,language:n,onChange:i}){const r=e==="openai"?"openai":"gemini",[s,l]=w.useState(""),[c,h]=w.useState(""),d=w.useMemo(()=>uCe(r),[r]),f=w.useMemo(()=>oCe(),[r]),p=w.useMemo(()=>Dz(r).filter(S=>(!s||S.gender===s)&&(!c||S.accent===c)),[r,s,c]),v=c4(t),x=v&&v.provider!==r?v:void 0,b=S=>{const N=c4(S);N&&i({realtimeProvider:N.provider,realtimeVoice:N.id})};return a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wide",children:"Language"}),a.jsxs("select",{value:n,onChange:S=>i({language:S.target.value}),className:"w-full mt-0.5 border border-slate-200 rounded-lg px-2.5 py-1.5 text-[11px] text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"",children:"Inherit / auto"}),f.map(S=>a.jsx("option",{value:S,children:S},S))]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wide",children:"Gender"}),a.jsxs("select",{value:s,onChange:S=>l(S.target.value),className:"w-full mt-0.5 border border-slate-200 rounded-lg px-2.5 py-1.5 text-[11px] text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"",children:"Any"}),cCe.map(S=>a.jsx("option",{value:S,children:S},S))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wide",children:"Accent"}),a.jsxs("select",{value:c,onChange:S=>h(S.target.value),className:"w-full mt-0.5 border border-slate-200 rounded-lg px-2.5 py-1.5 text-[11px] text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"",children:"Any"}),d.map(S=>a.jsx("option",{value:S,children:S},S))]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wide",children:"Voice"}),a.jsxs("select",{value:v&&v.provider===r?v.id:"",onChange:S=>b(S.target.value),className:"w-full mt-0.5 border border-slate-200 rounded-lg px-2.5 py-1.5 text-[11px] text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"",children:"— Select a voice —"}),p.map(S=>a.jsxs("option",{value:S.id,children:[S.name," · ",S.gender," · ",S.accent," — ",S.description]},S.id))]})]}),x&&a.jsxs("p",{className:"text-[9px] text-amber-600",children:["The selected voice “",x.name,"” isn’t available on the platform’s configured provider — pick another voice above. This voice won’t be used until the superadmin switches the provider."]}),!v&&a.jsx("p",{className:"text-[9px] text-slate-400",children:"No voice selected — the model default is used."}),a.jsx("p",{className:"text-[9px] text-slate-400 leading-relaxed",children:"The chosen voice is sent to the realtime model. The language directs which language the agent speaks for the whole conversation (set by a system-prompt directive). Leave fields on “Inherit” to use the superadmin default."})]})}const dCe=["telnyx","twilio"],hCe=["inbound","outbound","both"];function Lz({clientId:e,agencyId:t}){const n=e?{clientId:e}:{},i=et(me.queries.listPhoneNumbers,n)??[],r=et(me.queries.listClients,t?{agencyId:t}:{})??[],s=We(me.mutations.assignPhoneNumber),l=We(me.mutations.setPhoneNumberStatus),c=We(me.mutations.deletePhoneNumber),[h,d]=w.useState(!1),[f,p]=w.useState({clientId:"",number:"",provider:"telnyx",direction:"both",note:""}),[v,x]=w.useState(!1),[b,S]=w.useState(null),N=!!e;async function j(C){C.preventDefault(),S(null);const P=N?e:f.clientId;if(!P){S("Select a client.");return}if(!/^\+\d{6,}$/.test(f.number.trim())){S("Number must be E.164 (e.g. +15125550100).");return}x(!0);try{await s({clientId:P,number:f.number.trim(),provider:f.provider,direction:f.direction,note:f.note||void 0}),p({clientId:"",number:"",provider:"telnyx",direction:"both",note:""}),d(!1)}catch(A){S(String((A==null?void 0:A.message)??A))}finally{x(!1)}}async function T(C){const P=C.status==="active"?"disabled":"active";try{await l({phoneId:C._id,status:P})}catch(A){S(String((A==null?void 0:A.message)??A))}}async function E(C){if(confirm(`Remove ${C.number} from ${C.clientName??"this client"}
731? Inbound calls to it will stop routing.`))try{await c({phoneId:C._id})}catch(P){S(String((P==null?void 0:P.message)??P))}}return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-semibold text-slate-800 flex items-center gap-2",children:[a.jsx(Ei,{className:"w-5 h-5 text-indigo-600"}),"Phone Numbers ",N?"":"(all clients)"]}),a.jsxs("p",{className:"text-sm text-slate-500 mt-0.5",children:["Assign E.164 numbers so inbound calls route to the right tenant. Purchasing the number in Telnyx + pointing its Call Control app at the bridge ",a.jsx("code",{children:"/twiml/inbound"})," is a separate ops step."]})]}),!h&&a.jsxs("button",{onClick:()=>{p(C=>({...C,clientId:N?e:""})),d(!0)},className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700",children:[a.jsx(cr,{className:"w-4 h-4"})," Assign number"]})]}),b&&a.jsx("div",{className:"rounded-lg bg-rose-50 border border-rose-200 text-rose-700 text-sm px-3 py-2",children:b}),h&&a.jsxs("form",{onSubmit:j,className:"rounded-2xl border border-slate-200 bg-slate-50/50 p-4 space-y-3",children:[!N&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Client"}),a.jsxs("select",{value:f.clientId,onChange:C=>p({...f,clientId:C.target.value}),required:!0,className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm bg-white",children:[a.jsx("option",{value:"",children:"Select a client…"}),r.map(C=>a.jsx("option",{value:C._id,children:C.companyName||C.name||C._id},C._id))]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[a.jsxs("div",{className:"sm:col-span-1",children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Number (E.164)"}),a.jsx("input",{value:f.number,onChange:C=>p({...f,number:C.target.value}),placeholder:"+15125550100",required:!0,className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Provider"}),a.jsx("select",{value:f.provider,onChange:C=>p({...f,provider:C.target.value}),className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm bg-white",children:dCe.map(C=>a.jsx("option",{value:C,children:C},C))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Direction"}),a.jsx("select",{value:f.direction,onChange:C=>p({...f,direction:C.target.value}),className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm bg-white",children:hCe.map(C=>a.jsx("option",{value:C,children:C},C))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Note (optional)"}),a.jsx("input",{value:f.note,onChange:C=>p({...f,note:C.target.value}),placeholder:"e.g. sales line, support DID",className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"submit",disabled:v,className:"px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 disabled:opacity-50",children:v?"Saving…":"Assign"}),a.jsx("button",{type:"button",onClick:()=>d(!1),className:"px-3 py-1.5 rounded-lg border border-slate-300 text-slate-600 text-sm hover:bg-slate-100",children:"Cancel"})]})]}),i.length===0?a.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-200 p-8 text-center text-slate-400 text-sm",children:[a.jsx(kL,{className:"w-6 h-6 mx-auto mb-2 opacity-60"}),"No phone numbers assigned yet."]}):a.jsx("div",{className:"overflow-hidden rounded-2xl border border-slate-200",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-slate-50 text-slate-500 text-xs uppercase tracking-wide",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Number"}),!N&&a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Client"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Provider"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Direction"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Status"}),a.jsx("th",{className:"text-right px-4 py-2 font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100",children:i.map(C=>a.jsxs("tr",{className:C.status==="disabled"?"bg-slate-50/50 text-slate-400":"",children:[a.jsx("td",{className:"px-4 py-2.5 font-mono text-slate-700",children:C.number}),!N&&a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:C.clientName??"—"}),a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:C.provider}),a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:C.direction}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`text-[10px] font-bold uppercase px-2 py-0.5 rounded-full ${C.status==="active"?"bg-emerald-100 text-emerald-700":"bg-slate-200 text-slate-500"}`,children:C.status})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx("button",{onClick:()=>T(C),title:C.status==="active"?"Disable":"Enable",className:`p-1.5 rounded-lg ${C.status==="active"?"text-amber-600 hover:bg-amber-50":"text-emerald-600 hover:bg-emerald-50"}`,children:a.jsx(Xd,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>E(C),title:"Remove assignment",className:"p-1.5 rounded-lg text-rose-600 hover:bg-rose-50",children:a.jsx(xi,{className:"w-4 h-4"})})]})})]},C._id))})]})}),a.jsx("p",{className:"text-xs text-slate-400",children:"Telnyx Call Control app + Media Stream webhook must be configured on the purchased number (sip-trunk task 1) and the bridge deployed always-on (task 9) before inbound calls will reach a tenant."})]})}const u4={clientId:"",label:"",dialDestination:"",dtmf:"",note:""};function Uz({clientId:e,agencyId:t}){const n=e?{clientId:e}:{},i=et(me.queries.listExtensions,n)??[],r=et(me.queries.listClients,t?{agencyId:t}:{})??[],s=We(me.mutations.addExtension),l=We(me.mutations.updateExtension),c=We(me.mutations.deleteExtension),[h,d]=w.useState(!1),[f,p]=w.useState({...u4}),[v,x]=w.useState(!1),[b,S]=w.useState(null),[N,j]=w.useState(null),[T,E]=w.useState({label:"",dialDestination:"",dtmf:"",note:""}),C=!!e;function P(O){return/^(sip:|\+\d{6,}$)/.test(O.trim())?null:"Destination must be a SIP URI (sip:…) or E.164 (e.g. +15125550100)."}async function A(O){O.preventDefault(),S(null);const F=C?e:f.clientId;if(!F){S("Select a client.");return}if(!f.label.trim()){S("Label is required.");return}const ne=P(f.dialDestination);if(ne){S(ne);return}x(!0);try{await s({clientId:F,label:f.label.trim(),dialDestination:f.dialDestination.trim(),dtmf:f.dtmf||void 0,note:f.note||void 0}),p({...u4}),d(!1)}catch(re){S(String((re==null?void 0:re.message)??re))}finally{x(!1)}}function M(O){j(O._id),E({label:O.label??"",dialDestination:O.dialDestination??"",dtmf:O.dtmf??"",note:O.note??""}),S(null)}async function R(O){if(S(null),!T.label.trim()){S("Label cannot be empty.");return}const F=P(T.dialDestination);if(F){S(F);return}x(!0);try{await l({extensionId:O._id,label:T.label.trim(),dialDestination:T.dialDestination.trim(),dtmf:T.dtmf||void 0,note:T.note||void 0}),j(null)}catch(ne){S(String((ne==null?void 0:ne.message)??ne))}finally{x(!1)}}async function B(O){const F=O.status==="active"?"disabled":"active";try{await l({extensionId:O._id,status:F})}catch(ne){S(String((ne==null?void 0:ne.message)??ne))}}async function U(O){if(confirm(`Remove extension "${O.label}"? The VA will no longer be able to transfer to it.`))try{await c({extensionId:O._id})}catch(F){S(String((F==null?void 0:F.message)??F))}}return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-semibold text-slate-800 flex items-center gap-2",children:[a.jsx(SL,{className:"w-5 h-5 text-indigo-600"}),"Extensions ",C?"":"(all clients)"]}),a.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:'Map labels ("Sales", "Support") to PBX dial destinations so the voice agent can transfer a live caller to a human extension. A label not listed here never resolves — this is the transfer allowlist.'})]}),!h&&a.jsxs("button",{onClick:()=>{p(O=>({...O,clientId:C?e:""})),d(!0)},className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700",children:[a.jsx(cr,{className:"w-4 h-4"})," Add extension"]})]}),b&&a.jsx("div",{className:"rounded-lg bg-rose-50 border border-rose-200 text-rose-700 text-sm px-3 py-2",children:b}),h&&a.jsxs("form",{onSubmit:A,className:"rounded-2xl border border-slate-200 bg-slate-50/50 p-4 space-y-3",children:[!C&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Client"}),a.jsxs("select",{value:f.clientId,onChange:O=>p({...f,clientId:O.target.value}),required:!0,className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm bg-white",children:[a.jsx("option",{value:"",children:"Select a client…"}),r.map(O=>a.jsx("option",{value:O._id,children:O.companyName||O.name||O._id},O._id))]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Label"}),a.jsx("input",{value:f.label,onChange:O=>p({...f,label:O.target.value}),placeholder:"Sales / Support / Ahmed",required:!0,className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Dial destination"}),a.jsx("input",{value:f.dialDestination,onChange:O=>p({...f,dialDestination:O.target.value}),placeholder:"sip:[email protected]  or  +15125550100",required:!0,className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"DTMF (optional)"}
731),a.jsx("input",{value:f.dtmf,onChange:O=>p({...f,dtmf:O.target.value}),placeholder:"e.g. 101",className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:"Note (optional)"}),a.jsx("input",{value:f.note,onChange:O=>p({...f,note:O.target.value}),placeholder:"e.g. weekday sales line",className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"submit",disabled:v,className:"px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 disabled:opacity-50",children:v?"Saving…":"Add"}),a.jsx("button",{type:"button",onClick:()=>d(!1),className:"px-3 py-1.5 rounded-lg border border-slate-300 text-slate-600 text-sm hover:bg-slate-100",children:"Cancel"})]})]}),i.length===0?a.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-200 p-8 text-center text-slate-400 text-sm",children:[a.jsx(iQ,{className:"w-6 h-6 mx-auto mb-2 opacity-60"}),"No extensions configured yet. The voice agent cannot transfer calls until labels are added here."]}):a.jsx("div",{className:"overflow-hidden rounded-2xl border border-slate-200",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-slate-50 text-slate-500 text-xs uppercase tracking-wide",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Label"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Dial destination"}),!C&&a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Client"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Status"}),a.jsx("th",{className:"text-right px-4 py-2 font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100",children:i.map(O=>a.jsx("tr",{className:O.status==="disabled"?"bg-slate-50/50 text-slate-400":"",children:N===O._id?a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("input",{value:T.label,onChange:F=>E({...T,label:F.target.value}),className:"w-full rounded-lg border border-slate-300 px-2 py-1 text-sm"})}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("input",{value:T.dialDestination,onChange:F=>E({...T,dialDestination:F.target.value}),className:"w-full rounded-lg border border-slate-300 px-2 py-1 text-sm font-mono"})}),!C&&a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:O.clientName??"—"}),a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:O.status}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx("button",{onClick:()=>R(O),disabled:v,title:"Save",className:"p-1.5 rounded-lg text-emerald-600 hover:bg-emerald-50 disabled:opacity-50",children:a.jsx($i,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>j(null),title:"Cancel",className:"p-1.5 rounded-lg text-slate-500 hover:bg-slate-100",children:a.jsx(fn,{className:"w-4 h-4"})})]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"px-4 py-2.5 font-medium text-slate-700",children:O.label}),a.jsx("td",{className:"px-4 py-2.5 font-mono text-slate-600",children:O.dialDestination}),!C&&a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:O.clientName??"—"}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`text-[10px] font-bold uppercase px-2 py-0.5 rounded-full ${O.status==="active"?"bg-emerald-100 text-emerald-700":"bg-slate-200 text-slate-500"}`,children:O.status})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx("button",{onClick:()=>M(O),title:"Edit",className:"p-1.5 rounded-lg text-indigo-600 hover:bg-indigo-50",children:a.jsx(su,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>B(O),title:O.status==="active"?"Disable":"Enable",className:`p-1.5 rounded-lg ${O.status==="active"?"text-amber-600 hover:bg-amber-50":"text-emerald-600 hover:bg-emerald-50"}`,children:a.jsx(Xd,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>U(O),title:"Remove",className:"p-1.5 rounded-lg text-rose-600 hover:bg-rose-50",children:a.jsx(xi,{className:"w-4 h-4"})})]})})]})},O._id))})]})}),a.jsxs("p",{className:"text-xs text-slate-400",children:["Transfers require the telep
731hony bridge to be live (sip-trunk-telephony) and a flow that calls the ",a.jsx("code",{children:"transferToExtension"})," tool. Until then this directory is inert — adding labels here has no effect on calls."]})]})}function Ej(e){return/\b\d{4,8}\b/.test(e)&&/code|verify|confirm|one[\s-]?time|otp|whatsapp/i.test(e)}function fCe(e){if(!Ej(e))return null;const t=e.match(/\b\d{2,4}[\s-]?\d{2,4}\b/);return t?t[0].replace(/\s+/g,""):null}function d4(e){const t=new Date(e),n=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),i=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});return`${n} · ${i}`}function mCe(){const e=et(me.telnyxSms.listInboundSms)??[],t=We(me.telnyxSms.deleteSms),[n,i]=w.useState(null),[r,s]=w.useState(null),l=e.filter(d=>Ej(d.text)).length;async function c(d){const f=fCe(d.text)??d.text;try{await navigator.clipboard.writeText(f),i(d._id),setTimeout(()=>i(p=>p===d._id?null:p),1500)}catch{}}async function h(d){if(confirm(`Delete the message from ${d.from} at ${d4(d.createdAt)}?`))try{s(null),await t({id:d._id})}catch(f){s(String((f==null?void 0:f.message)??f))}}return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-semibold text-slate-800 flex items-center gap-2",children:[a.jsx(zs,{className:"w-5 h-5 text-indigo-600"}),"Inbound SMS Inbox"]}),a.jsxs("p",{className:"text-sm text-slate-500 mt-0.5",children:["Every SMS received by our Telnyx numbers (via the ",a.jsx("code",{children:"/telnyx/sms"})," webhook), newest first. New messages appear here live — a WhatsApp verification code shows up seconds after Meta sends it."]})]}),e.length>0&&a.jsxs("span",{className:"shrink-0 text-[10px] font-bold uppercase px-2.5 py-1 rounded-full bg-indigo-100 text-indigo-700",children:[e.length," msgs",l?` · ${l} code`:""]})]}),r&&a.jsx("div",{className:"rounded-lg bg-rose-50 border border-rose-200 text-rose-700 text-sm px-3 py-2",children:r}),e.length===0?a.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-200 p-8 text-center text-slate-400 text-sm",children:[a.jsx(JQ,{className:"w-6 h-6 mx-auto mb-2 opacity-60"}),`No inbound SMS yet. Trigger Meta's "Resend Code" (or any SMS to a profile number) and it will appear here instantly.`]}):a.jsx("div",{className:"overflow-hidden rounded-2xl border border-slate-200",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-slate-50 text-slate-500 text-xs uppercase tracking-wide",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Received"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"From"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"To (our number)"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Message"}),a.jsx("th",{className:"text-right px-4 py-2 font-medium w-16",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100",children:e.map(d=>{const f=Ej(d.text);return a.jsxs("tr",{className:f?"bg-indigo-50/40":"",children:[a.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap text-slate-500 text-xs",children:d4(d.createdAt)}),a.jsxs("td",{className:"px-4 py-2.5 whitespace-nowrap",children:[a.jsx("div",{className:"font-mono text-slate-700",children:d.from}),d.fromCarrier&&a.jsx("div",{className:"text-[11px] text-slate-400",children:d.fromCarrier})]}),a.jsxs("td",{className:"px-4 py-2.5 whitespace-nowrap",children:[a.jsx("div",{className:"font-mono text-slate-700",children:d.to}),d.toCarrier&&a.jsx("div",{className:"text-[11px] text-slate-400",children:d.toCarrier})]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:`flex-1 break-words ${f?"font-mono text-base text-indigo-800":"text-slate-700"}`,children:d.text}),f&&a.jsx("span",{className:"shrink-0 text-[10px] font-bold uppercase px-1.5 py-0.5 rounded bg-indigo-600 text-white mt-0.5",children:"Code"})]})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx("button",{onClick:()=>c(d),title:f?"Copy code only (no label text)":"Copy message text",className:"p-1.5 rounded-lg text-slate-500 hover:bg-slate-100",children:n===d._id?a.jsx(Lm,{className:"w-4 h-4 text-emerald-600"}):a.jsx(bv,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>h(d),title:"Delete message",className:"p-1.5 rounded-lg text-rose-600 hover:bg-rose-50",children:a.jsx(xi,{className:"w-4 h-4"})})]})})]},d._id)})})]})}),a.jsxs("p",{className:"text-xs text-slate-400",children:["Captures every number on a Telnyx messaging profile pointed at ",a.jsx("code",{children:"/telnyx/sms"})," — no per-number setup needed. Rows auto-expire after 7 days."]})]})}function en({icon:e,label:t,tab:n,activeTab:i,setActiveTab:r,count:s,badge:l}){const c=i===n;return a.jsxs("button",{onClick:()=>r(n),className:`w-full flex items-center gap-2.5 px-3 py-2.5 rounded-xl text-xs font-semibold transition-all cursor-pointer ${c?"bg-indigo-600 text-white shadow-md":"text-slate-600 hover:bg-slate-50"}`,children:[a.jsx(e,{className:"w-4 h-4 shrink-0"}),a.jsx("span",{className:"flex-1 text-left truncate",children:t}),s!==void 0&&a.jsxs("span",{className:c?"text-indigo-200":"text-slate-400",children:["(",s,")"]}),l!==void 0&&l>0&&a.jsx("span",{className:"ml-1 bg-rose-500 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-full",children:l})]})}function Xl({title:e}){return a.jsx("h4",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mt-4 mb-1 px-2 first:mt-2",children:e})}function pCe({agencies:e,workflows:t,logs:n,onAddAgency:i,onUpdateAgency:r,onDeleteAgency:s,onAddWorkflow:l,onUpdateWorkflow:c,onDeleteWorkflow:h,onLogout:d,platformSettings:f,onUpdatePlatformSettings:p}){var qp,Gh,Yh,Wu,Wp,Hp,wc,Ns,Hu,Ku,fo,mo,Qh,Gu,Xh,ml;const[v,x]=w.useState("overview"),[b,S]=w.useState(!1),[N,j]=w.useState(null),[T,E]=w.useState(null),[C,P]=w.useState(null),[A,M]=w.useState(!1),[R,B]=w.useState(null),[U,O]=w.useState(!1),[F,ne]=w.useState(!1),[re,Q]=w.useState(((qp=f==null?void 0:f.voicePipelineConfig)==null?void 0:qp.realtimeVoice)??""),[W,q]=w.useState(((Gh=f==null?void 0:f.voicePipelineConfig)==null?void 0:Gh.language)??"");w.useEffect(()=>{var I,$e;Q(((I=f==null?void 0:f.voicePipelineConfig)==null?void 0:I.realtimeVoice)??""),q((($e=f==null?void 0:f.voicePipelineConfig)==null?void 0:$e.language)??"")},[(Yh=f==null?void 0:f.voicePipelineConfig)==null?void 0:Yh.realtimeVoice,(Wu=f==null?void 0:f.voicePipelineConfig)==null?void 0:Wu.language]);const[$,ge]=w.useState({name:"",email:"",ownerName:"",multiplier:1.5,plan:"Growth",balance:200}),[ue,L]=w.useState({name:"",category:"General Business",description:"",defaultGreeting:"",defaultPrompt:"",baseCostPerMin:.1,suggestedSlots:"09:00 AM, 11:00 AM, 02:00 PM, 04:00 PM"}),ye=et(me.queries.listPricingTiers,{})??[],Pe=We(me.mutations.addPricingTier),Oe=We(me.mutations.updatePricingTier),je=We(me.mutations.deletePricingTier),ve=et(me.billing.dailyCallMetrics,{days:7})??[],Be=et(me.billing.varianceFlaggedSessions,{limit:50})??[],be=et(me.billing.clientBalances,{})??[],nt=We(me.billing.setCostModel),[ze,Le]=w.useState({modelCostPerMin:"",telephonyCostPerMin:"",egressCostPerMin:"",balanceGateMode:"hard",costVariancePct:""}),[ht,yt]=w.useState(!1);w.useEffect(()=>{f&&Le({modelCostPerMin:f.modelCostPerMin!=null?String(f.modelCostPerMin):"",telephonyCostPerMin:f.telephonyCostPerMin!=null?String(f.telephonyCostPerMin):"",egressCostPerMin:f.egressCostPerMin!=null?String(f.egressCostPerMin):"",balanceGateMode:f.balanceGateMode??"hard",costVariancePct:f.costVariancePct!=null?String(f.costVariancePct):""})},[f]);const on=We(me.mutations.setCallLimits),[bt,Vt]=w.useState({perIp:"6",windowMin:"10",perClientHour:"120",demoMaxSeconds:"240"}),[tn,Qt]=w.useState(!1),[Cn,pt]=w.useState(null);w.useEffect(()=>{if(!f)return;const I=f;Vt({perIp:String(I.callRateLimitPerIp??6),windowMin:String(I.callRateLimitWindowMin??10),perClientHour:String(I.callRateLimitPerClientHour??120),demoMaxSeconds:String(I.demoMaxCallSeconds??240)})},[f]);const kn=async I=>{I.preventDefault(),pt(null);try{await on({callRateLimitPerIp:Number(bt.perIp)||6,callRateLimitWindowMin:Number(bt.windowMin)||10,callRateLimitPerClientHour:Number(bt.perClientHour)||120,demoMaxCallSeconds:Number(bt.demoMaxSeconds)||240}),Qt(!0),setTimeout(()=>Qt(!1),2500)}catch($e){pt(($e==null?void 0:$e.message)||"Could not save limits.")}},Lt=async I=>{I.preventDefault(),await nt({modelCostPerMin:Number(ze.modelCostPerMin)||0,telephonyCostPerMin:Number(ze.telephonyCostPerMin)||0,egressCostPerMin:ze.egressCostPerMin===""?void 0:Number(ze.egressCostPerMin)||0,balanceGateMode:ze.balanceGateMode,costVariancePct:Number(ze.costVariancePct)||0}),yt(!0),setTimeout(()=>yt(!1),2500)},On=We(me.mutations.reparentDemoClient),[zt,si]=w.useState(""),[qn,qt]=w.useState(null),[ai,Zn]=w.useState(!1),ct=et(me.voiceAgents.listAllVas,{}),[ln,Ut]=w.useState("");w.useEffect(()=>{var I;ln&&(ct??[]).some($e=>$e._id===ln)||Ut(((I=(ct??[])[0])==null?void 0:I._id)??"")},[ct,ln]);const Wn=We(me.flowDefinitions.backfillAllDefaultFlows),[_i,nn]=w.useState(!1),[Bt,Dt]=w.useState(null);async function K(){nn(!0);try{const I=await Wn({});Dt({created:I.created,skipped:I.skipped,total:I.total})}catch(I){Dt(null),console.error("[backfillAllDefaultFlows]",I)}finally{nn(!1)}}const[Ze,Ft]=w.useState(void 0),[jt,oi]=w.useState(void 0),Gi=Hx(me.queries.listAllLeads,w.useMemo(()=>({channel:Ze,source:jt}),[Ze,jt]),{initialNumItems:50}),fr=Gi.results??[],Yi=We(me.mutations.backfillLeadClassification),[In,Mi]=w.useState(!1),[Ur,$n]=w.useState(null),li=async()=>{Mi(!0),$n(null);try{await Yi({}),$n("Backfill started — legacy leads are being classified in batches. Reload the tab in a moment to see them under their filters.")}catch(I){$n((I==null?void 0:I.message)||"Backfill failed.")}finally{Mi(!1)}},ot=(et(me.queries.listClients,{})??[]).map(I=>({...I,id:I._id})),[Wt,Jt]=w.useState(null),[$t,te]=w.useState("contacts"),[Fe,dt]=w.useState("");w.useEffect(()=>{!Wt&&ot.length&&Jt(ot[0].id)},[Wt,ot]);const He=et(me.accessRequests.listAccessRequests,{})??[],H=He.filter(I=>(I==null?void 0:I.status)==="pending").length,se=We(me.accessRequests.approveAccessRequestAsAgency),G=We(me.accessRequests.approveAccessRequestAsClient),V=We(me.accessRequests.rejectAccessRequest),[ie,Z]=w.useState(null),[Te,we]=w.useState(null),[X,Ee]=w.useState({}),[qe,Nt]=w.useState({}),mt=(I,$e)=>{X[I]||Ee(lt=>({...lt,[I]:{name:$e,multiplier:1.4,plan:"Growth",balance:1e3}}))},Ie=I=>{qe[I]||Nt($e=>{var lt;return{...$e,[I]:{agencyId:((lt=e[0])==null?void 0:lt.id)??"",clientName:""}}})},Nn=async I=>{const $e=X[I];if(!$e||!$e.name.trim()){we("Enter an agency name.");return}Z(I),we(null);try{await se({requestId:I,agencyName:$e.name.trim(),multiplier:$e.multiplier,plan:$e.plan,balance:$e.balance}),we("Approved as agency — a Clerk invitation was sent.")}catch(lt){we((lt==null?void 0:lt.message)||"Approval failed.")}finally{Z(null)}},kr=async I=>{const $e=qe[I];if(!$e||!$e.agencyId||!$e.clientName.trim()){we("Pick an agency and enter a client name.");return}Z(I),we(null);try{await G({requestId:I,agencyId:$e.agencyId,clientName:$e.clientName.trim()}),we("Approved as client — a Clerk invitation was sent.")}catch(lt){we((lt==null?void 0:lt.message)||"Approval failed.")}finally{Z(null)}},ks=async I=>{Z(I),we(null);try{await V({requestId:I}),we("Request rejected.")}catch($e){we(($e==null?void 0:$e.message)||"Reject failed.")}finally{Z(null)}},[Br,is]=w.useState(!1),[Fr,mr]=w.useState(null),[ft,Ri]=w.useState({audie
731nce:"direct",name:"",price:"",unit:"/ month",annualPrice:"",tagline:"",includedMinutes:"",overageRatePerMin:"",monthlyPriceCents:"",features:"",cta:"",planKey:"",highlight:!1,sortOrder:0}),Hh=()=>Ri({audience:"direct",name:"",price:"",unit:"/ month",annualPrice:"",tagline:"",includedMinutes:"",overageRatePerMin:"",monthlyPriceCents:"",features:"",cta:"",planKey:"",highlight:!1,sortOrder:0}),Fp=I=>{I.preventDefault();const $e=ft.features.split(`
732`).map(Zt=>Zt.trim()).filter(Boolean),lt=Zt=>{const Si=Zt.trim();if(Si==="")return;const Sc=Number(Si);return Number.isFinite(Sc)?Sc:void 0},ei=lt(ft.includedMinutes),jn=lt(ft.overageRatePerMin),Tn=lt(ft.monthlyPriceCents),Aa={audience:ft.audience,name:ft.name,price:ft.price,unit:ft.unit,annualPrice:ft.annualPrice.trim()||void 0,tagline:ft.tagline,...ei!==void 0?{includedMinutes:ei}:{},...jn!==void 0?{overageRatePerMin:jn}:{},...Tn!==void 0?{monthlyPriceCents:Tn}:{},features:$e,cta:ft.cta,planKey:ft.planKey||ft.name,highlight:ft.highlight,sortOrder:Number(ft.sortOrder)||0};Fr?Oe({id:Fr,patch:Aa}):Pe(Aa),is(!1),mr(null)},bc=I=>{mr(I._id),Ri({audience:I.audience,name:I.name,price:I.price,unit:I.unit,annualPrice:I.annualPrice||"",tagline:I.tagline,includedMinutes:I.includedMinutes!=null?String(I.includedMinutes):"",overageRatePerMin:I.overageRatePerMin!=null?String(I.overageRatePerMin):"",monthlyPriceCents:I.monthlyPriceCents!=null?String(I.monthlyPriceCents):"",features:(I.features??[]).join(`
733`),cta:I.cta,planKey:I.planKey,highlight:!!I.highlight,sortOrder:I.sortOrder??0}),is(!0)},wb=e.reduce((I,$e)=>I+$e.totalUsageMins,0),$r=e.reduce((I,$e)=>I+$e.revenue,0),qu=e.length,$p=(e.reduce((I,$e)=>I+$e.multiplier,0)/e.length).toFixed(2),Kh=ve,hl=async I=>{if(I.preventDefault(),E(null),N)r(N.id,{name:$.name,email:$.email,multiplier:Number($.multiplier),plan:$.plan,basePricePerMin:.1*Number($.multiplier)});else{const $e={id:"agency-"+Date.now(),name:$.name,email:$.email,ownerName:$.ownerName||void 0,multiplier:Number($.multiplier),basePricePerMin:.1*Number($.multiplier),balance:Number($.balance),plan:$.plan,clientsCount:0,totalUsageMins:0,revenue:0,status:"active"};try{await i($e)}catch(lt){E((lt==null?void 0:lt.message)||"Could not provision that agency.");return}}S(!1),j(null)},Vp=I=>{I.preventDefault();const $e=ue.suggestedSlots.split(",").map(lt=>"2026-06-25 "+lt.trim());if(R)c(R.id,{name:ue.name,category:ue.category,description:ue.description,defaultGreeting:ue.defaultGreeting,defaultPrompt:ue.defaultPrompt,baseCostPerMin:Number(ue.baseCostPerMin),suggestedSlots:$e});else{const lt={id:"wf-"+Date.now(),name:ue.name,category:ue.category,description:ue.description,defaultGreeting:ue.defaultGreeting,defaultPrompt:ue.defaultPrompt,baseCostPerMin:Number(ue.baseCostPerMin),knowledgeBaseFiles:[],suggestedSlots:$e,requiredInputs:["name","email","phone","purpose"]};l(lt)}M(!1),B(null)},zp=I=>{j(I),ge({name:I.name,email:I.email,ownerName:"",multiplier:I.multiplier,plan:I.plan,balance:I.balance}),E(null),S(!0)},fl=I=>{B(I),L({name:I.name,category:I.category,description:I.description,defaultGreeting:I.defaultGreeting,defaultPrompt:I.defaultPrompt,baseCostPerMin:I.baseCostPerMin,suggestedSlots:I.suggestedSlots.map($e=>$e.replace("2026-06-25 ","")).join(", ")}),M(!0)};return a.jsxs("div",{className:"min-h-screen bg-slate-50 text-slate-800 font-sans flex flex-col",children:[a.jsxs("header",{className:"bg-slate-950 text-white px-6 py-4 flex items-center justify-between border-b border-slate-900 sticky top-0 z-30 shadow-md",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-indigo-600 p-2 rounded-xl",children:a.jsx(Yo,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-bold text-lg font-display tracking-tight",children:"Vox Bridge Control"}),a.jsx("span",{className:"text-[9px] bg-red-600 text-white font-bold uppercase px-1.5 py-0.5 rounded-md",children:"SUPERADMIN"})]}),a.jsx("span",{className:"text-[10px] text-slate-400 font-mono",children:"Platform Governance Console"})]})]}),a.jsx("div",{className:"flex items-center gap-4",children:a.jsxs("button",{onClick:d,className:"border border-slate-800 hover:bg-slate-900 text-slate-300 hover:text-white px-4 py-2 rounded-xl text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",children:[a.jsx(om,{className:"w-3.5 h-3.5"}),"Exit Control"]})})]}),a.jsxs("div",{className:"flex-1 max-w-7xl w-full mx-auto p-4 md:p-6 grid grid-cols-1 lg:grid-cols-12 gap-6",children:[a.jsxs("aside",{className:"lg:col-span-3 space-y-2",children:[a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4 space-y-1",children:[a.jsx(en,{icon:Mk,label:"Platform Overview",tab:"overview",activeTab:v,setActiveTab:x}),a.jsx(Xl,{title:"Tenants"}),a.jsx(en,{icon:Wo,label:"Manage Agencies",tab:"agencies",activeTab:v,setActiveTab:x,count:qu}),a.jsx(en,{icon:rX,label:"Hierarchy",tab:"hierarchy",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:Pk,label:"Communications",tab:"communications",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:Hw,label:"Access Requests",tab:"accessRequests",activeTab:v,setActiveTab:x,badge:H}),a.jsx(Xl,{title:"Voice Platform"}),a.jsx(en,{icon:xL,label:"Master Workflows",tab:"workflows",activeTab:v,setActiveTab:x,count:t.length}),a.jsx(en,{icon:yv,label:"Tool Catalog",tab:"catalog",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:kv,label:"Tools (per-VA)",tab:"tools",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:Kw,label:"Flow Editor",tab:"flows",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:Ei,label:"Phone Numbers",tab:"phoneNumbers",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:SL,label:"Extensions",tab:"extensions",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:Na,label:"SMS Inbox",tab:"smsInbox",activeTab:v,setActiveTab:x}),a.jsx(Xl,{title:"Revenue"}),a.jsx(en,{icon:jL,label:"Pricing Tiers",tab:"pricing",activeTab:v,setActiveTab:x,count:ye.length}),a.jsx(en,{icon:Qd,label:"Billing & Cost",tab:"billing",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:zs,label:"Leads & Recordings",tab:"leads",activeTab:v,setActiveTab:x,count:fr.length}),a.jsx(Xl,{title:"Content"}),a.jsx(en,{icon:Yo,label:"Agencies Page Editor",tab:"agenciesPage",activeTab:v,setActiveTab:x}),a.jsx(Xl,{title:"System"}),a.jsx(en,{icon:gu,label:"API & Model Settings",tab:"settings",activeTab:v,setActiveTab:x}),a.jsx(en,{icon:Tk,label:"System Health",tab:"systemHealth",activeTab:v,setActiveTab:x,badge:Be.length||void 0})]}),a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4 space-y-2.5",children:[a.jsx("h4",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider px-1",children:"Platform Rate"}),a.jsxs("div",{className:"flex items-baseline justify-between px-1",children:[a.jsx("span",{className:"text-xs text-slate-500",children:"Base cost"}),a.jsxs("span",{className:"text-sm font-bold font-display text-slate-800",children:["$",(f==null?void 0:f.modelCostPerMin)!=null?Number(f.modelCostPerMin).toFixed(3):"—","/m
733in"]})]}),a.jsxs("div",{className:"flex items-baseline justify-between px-1",children:[a.jsx("span",{className:"text-xs text-slate-500",children:"Avg agency markup"}),a.jsxs("span",{className:"text-sm font-bold font-display text-slate-800",children:[e.length?(e.reduce((I,$e)=>I+$e.multiplier,0)/e.length).toFixed(2):"—","x"]})]}),a.jsxs("div",{className:"flex items-baseline justify-between px-1",children:[a.jsx("span",{className:"text-xs text-slate-500",children:"Agencies"}),a.jsx("span",{className:"text-sm font-bold font-display text-slate-800",children:e.length})]})]})]}),a.jsxs("main",{className:"lg:col-span-9 space-y-6",children:[v==="overview"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsx(ir,{icon:Qd,label:"PLATFORM REVENUE",value:`$${$r.toLocaleString()}`}),a.jsx(ir,{icon:Wo,label:"ACTIVE AGENCIES",value:qu,sub:`• ${H} awaiting approval`}),a.jsx(ir,{icon:cc,label:"TOTAL VOICE MINS",value:wb.toLocaleString()}),a.jsx(ir,{icon:gu,label:"AVG MULTIPLIER",value:`${$p}x`})]}),a.jsxs("div",{className:`${rt} p-6`,children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display",children:"Platform Telemetry Mins"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Aggregated minute consumption across all whitelabel instances."})]}),a.jsx("span",{className:"text-xs font-semibold bg-indigo-50 text-indigo-700 px-2.5 py-1 rounded-lg",children:"Realtime telemetry"})]}),a.jsxs("div",{className:"h-64",children:[a.jsx(uT,{width:"100%",height:"100%",children:a.jsxs(P2,{data:Kh,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsxs("defs",{children:[a.jsxs("linearGradient",{id:"colorMins",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#4f46e5",stopOpacity:.2}),a.jsx("stop",{offset:"95%",stopColor:"#4f46e5",stopOpacity:0})]}),a.jsxs("linearGradient",{id:"colorRev",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.2}),a.jsx("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),a.jsx(gb,{strokeDasharray:"3 3",vertical:!1}),a.jsx(vb,{dataKey:"day",tick:{fontSize:10}}),a.jsx(xb,{tick:{fontSize:10}}),a.jsx(v2,{}),a.jsx(Ah,{type:"monotone",dataKey:"minutes",name:"Minutes",stroke:"#4f46e5",fillOpacity:1,fill:"url(#colorMins)"}),a.jsx(Ah,{type:"monotone",dataKey:"revenue",name:"Revenue $",stroke:"#10b981",fillOpacity:1,fill:"url(#colorRev)"})]})}),ve.length===0&&a.jsx("p",{className:"text-center text-xs text-slate-400 -mt-32 pointer-events-none",children:"No billed calls in the last 7 days yet."})]})]}),a.jsxs("div",{className:`${rt} overflow-hidden`,children:[a.jsxs("div",{className:"p-5 border-b border-slate-100 flex justify-between items-center bg-slate-50/50",children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display text-sm",children:"System Token Ledger"}),a.jsx("span",{className:"text-[10px] font-mono text-slate-400 uppercase",children:"Audit Records"})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left text-xs border-collapse",children:[a.jsx("thead",{className:"bg-slate-100 text-slate-500 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"p-3",children:"Agency"}),a.jsx("th",{className:"p-3",children:"Client"}),a.jsx("th",{className:"p-3",children:"Duration"}),a.jsx("th",{className:"p-3",children:"Base Cost"}),a.jsx("th",{className:"p-3",children:"Agency cost"}),a.jsx("th",{className:"p-3",children:"Final Billing"}),a.jsx("th",{className:"p-3",children:"Tokens Used"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100 text-slate-700",children:n.map(I=>{const $e=e.find(lt=>lt.id===I.agencyId);return a.jsxs("tr",{className:"hover:bg-slate-50 transition-colors",children:[a.jsx("td",{className:"p-3 font-semibold text-slate-900",children:($e==null?void 0:$e.name)||"Unknown"}),a.jsx("td",{className:"p-3",children:"Starlight Dental"}),a.jsxs("td",{className:"p-3",children:[I.durationSeconds,"s"]}),a.jsxs("td",{className:"p-3 font-mono text-slate-500",children:["$",I.baseCost.toFixed(2)]}),a.jsxs("td",{className:"p-3 font-mono text-indigo-600",children:["$",I.agencyCost.toFixed(2)]}),a.jsxs("td",{className:"p-3 font-mono text-emerald-600 font-semibold",children:["$",I.clientCost.toFixed(2)]}),a.jsx("td",{className:"p-3 font-mono text-slate-400",children:I.tokensUsed.toLocaleStr
733ing()})]},I.id)})})]})})]})]}),v==="agencies"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Registered Whitelabel Agencies"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Assign billing plans, token multipliers, and credit lines."})]}),a.jsxs("button",{onClick:()=>{j(null),ge({name:"",email:"",ownerName:"",multiplier:1.5,plan:"Growth",balance:200}),E(null),S(!0)},className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs px-4 py-2.5 rounded-xl flex items-center gap-1.5 transition-all shadow-md cursor-pointer",children:[a.jsx(cr,{className:"w-4 h-4"})," Provision Agency"]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.map(I=>a.jsxs("div",{className:`bg-white border rounded-2xl p-5 shadow-sm space-y-4 relative ${I.status==="suspended"?"border-red-200 bg-red-50/5":"border-slate-100"}`,children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsxs("span",{className:`text-[9px] font-bold uppercase px-2 py-0.5 rounded-md ${I.plan==="Enterprise"?"bg-purple-100 text-purple-700":I.plan==="Growth"?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-700"}`,children:[I.plan," Tier"]}),a.jsx("h4",{className:"font-bold text-slate-900 text-base font-display mt-2",children:I.name}),a.jsx("p",{className:"text-xs text-slate-400",children:I.email})]}),a.jsx("span",{className:`text-[9px] font-bold uppercase px-2 py-0.5 rounded-full flex items-center gap-1 ${I.status==="active"?"bg-emerald-100 text-emerald-700":"bg-rose-100 text-rose-700"}`,children:I.status==="active"?a.jsxs(a.Fragment,{children:[a.jsx(kt,{className:"w-2.5 h-2.5"})," Active"]}):a.jsxs(a.Fragment,{children:[a.jsx(r5,{className:"w-2.5 h-2.5"})," Suspended"]})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 bg-slate-50/70 p-3 rounded-xl border border-slate-100 text-[10px]",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400 block uppercase font-semibold",children:"Clients"}),a.jsxs("span",{className:"text-slate-800 font-bold text-xs mt-0.5",children:[I.clientsCount," accounts"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400 block uppercase font-semibold",children:"Usage mins"}),a.jsxs("span",{className:"text-slate-800 font-bold text-xs mt-0.5",children:[I.totalUsageMins,"m"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400 block uppercase font-semibold",children:"Prepaid Credit"}),a.jsxs("span",{className:"text-emerald-700 font-extrabold text-xs mt-0.5",children:["$",I.balance]})]})]}),a.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-slate-50 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400",children:"Multiplier:"}),a.jsxs("span",{className:"font-bold text-slate-800 ml-1.5",children:[I.multiplier,"x"]})]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>zp(I),className:"p-1.5 hover:bg-slate-100 text-slate-600 hover:text-slate-900 rounded-lg transition-colors cursor-pointer",title:"Edit Multiplier and Info",children:a.jsx(su,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{const $e=I.status==="active"?"suspended":"active";r(I.id,{status:$e})},className:"p-1.5 hover:bg-slate-100 text-rose-600 rounded-lg transition-colors cursor-pointer",title:I.status==="active"?"Suspend Agency":"Unsuspend Agency",children:I.status==="active"?a.jsx(r5,{className:"w-4 h-4"}):a.jsx(kt,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>P(I),className:"p-1.5 hover:bg-rose-50 text-rose-600 hover:text-rose-700 rounded-lg transition-colors cursor-pointer",title:"Delete Agency",children:a.jsx(xi,{className:"w-4 h-4"})})]})]})]},I.id))})]}),v==="hierarchy"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Tenant Hierarchy"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Agency → admin email → clients → end-client users → voice agents → KB docs. Read-only map of who controls what."})]}),a.jsx(vCe,{})]}),v==="workflows"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Master S2S Voice Templates"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Foundational prompts, slot limits, and base per-minute rates."})]}),a.jsxs("button",{onClick:()=>{B(null),L({name:"",category:"General Business",description:"",defaultGreeting:"",defaultPrompt:"",baseCostPerMin:.1,suggestedSlots:"09:00 AM, 11:00 AM, 02:00 PM, 04:00 PM"}),M(!0)},className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs px-4 py-2.5 rounded-xl flex items-center gap-1.5 transition-all shadow-md cursor-pointer",children:[a.jsx(cr,{className:"w-4 h-4"})," Add Master Template"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(I=>a.jsxs("div",{className:`${rt} p-5 space-y-4`,children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-md",children:I.category}),a.jsx("h4",{className:"font-bold text-slate-900 text-base font-display mt-1.5",children:I.name}),a.jsx("p",{className:"text-xs text-slate-500 mt-1",children:I.description})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("span",{className:"text-xs text-slate-400 block font-medium",children:"Base Cost"}),a.jsxs("span",{className:"text-indigo-600 font-extrabold text-sm font-mono",children:["$",I.baseCostPerMin.toFixed(2),"/min"]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 bg-slate-50/70 p-4 rounded-xl border border-slate-100 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-slate-400 block uppercase text-[9px] tracking-wider",children:"Default Greeting"}),a.jsxs("p",{className:"text-slate-700 italic mt-1 font-sans",children:['"',I.defaultGreeting,'"']})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-slate-400 block uppercase text-[9px] tracking-wider",children:"Default Prompt Logic"}),a.jsx("p",{className:"text-slate-600 line-clamp-3 mt-1 font-sans",children:I.defaultPrompt})]})]}),a.jsxs("div",{className:"flex justify-between items-center text-xs pt-2 border-t border-slate-50",children:[a.jsxs("div",{className:"text-slate-500",children:["Default Inputs Captured:"," ",a.jsx("span",{className:"font-bold text-slate-700",children:I.requiredInputs.join(", ")})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>fl(I),className:"px-3 py-1.5 border border-slate-200 hover:bg-slate-50 rounded-lg flex items-center gap-1 font-semibold cursor-pointer",children:[a.jsx(su,{className:"w-3.5 h-3.5"})," Edit Template"]}),a.jsx("button",{onClick:()=>h(I.id),className:"p-1.5 bg-rose-50 text-rose-600 rounded-lg hover:bg-rose-100 transition-colors cursor-pointer",children:a.jsx(xi,{className:"w-4 h-4"})})]})]})]},I.id))})]}),v==="pricing"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Pricing Tiers & Bundles"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Own the public pricing shown on the landing page. Agencies/clients still apply their own multiplier on top for the actual per-call billing."})]}),a.jsxs("button",{onClick:()=>{mr(null),Hh(),is(!0)},className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs px-4 py-2.5 rounded-xl flex items-center gap-1.5 transition-all shadow-md cursor-pointer",children:[a.jsx(cr,{className:"w-4 h-4"})," Add Pricing Tier"]})]}),ye.length===0&&a.jsx("div",{className:"bg-white border border-dashed border-slate-200 rounded-2xl p-8 text-center text-xs text-slate-400",children:"Loading tiers… If this persists, run ensurePlatformDemo to seed defaults."}),ye.filter(I=>I.audience==="direct").length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:"Direct Businesses"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ye.filter(I=>I.audience==="direct").map(I=>a.jsxs("div",{className:`bg-white border rounded-2xl p-5 shadow-sm space-y-3 ${I.highlight?"border-indigo-500 border-2":"border-slate-100"}`,children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded uppercase",children:I.name}),I.highlight&&a.jsx("span",{className:"ml-1 text-[9px] font-bold text-indigo-600",children:"★ Popular"})]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>bc(I),className:"p-1.5 hover:bg-slate-100 text-slate-600 rounded-lg cursor-pointer",children:a.jsx(su,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>je({id:I._id}),className:"p-1.5 hover:bg-rose-50 text-rose-600 rounded-lg cursor-pointer",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:"text-2xl font-extrabold font-display text-slate-900",children:I.price}),a.jsx("span",{className:"text-xs text-slate-400",children:I.unit})]}),a.jsx("p",{className:"text-[11px] text-slate-500",children:I.tagline}),I.includedMinutes?a.jsxs("p",{className:"text-[10px] text-indigo-600 font-semibold",children:[I.includedMinutes.toLocaleStr
733ing()," included minutes"]}):null,I.annualPrice?a.jsxs("p",{className:"text-[10px] text-emerald-600 font-semibold",children:["Annual: ",I.annualPrice,"/yr"]}):a.jsx("p",{className:"text-[10px] text-slate-400",children:"No annual option"}),a.jsx("ul",{className:"space-y-1 text-[11px] text-slate-600",children:(I.features??[]).slice(0,4).map(($e,lt)=>a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx(kt,{className:"w-3 h-3 text-emerald-500 mt-0.5 shrink-0"})," ",$e]},lt))}),a.jsxs("div",{className:"text-[10px] text-slate-400 pt-1 border-t border-slate-50",children:["planKey: ",a.jsx("span",{className:"font-mono",children:I.planKey})," · CTA: ",I.cta]})]},I._id))})]}),ye.filter(I=>I.audience==="agency").length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:"Agency Whitelabel"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ye.filter(I=>I.audience==="agency").map(I=>a.jsxs("div",{className:`bg-slate-900 text-white border rounded-2xl p-5 space-y-3 ${I.highlight?"border-indigo-500 border-2":"border-slate-700"}`,children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold bg-indigo-500 text-white px-2 py-0.5 rounded uppercase",children:I.name}),I.highlight&&a.jsx("span",{className:"ml-1 text-[9px] font-bold text-indigo-300",children:"★ Popular"})]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>bc(I),className:"p-1.5 hover:bg-slate-800 text-slate-300 rounded-lg cursor-pointer",children:a.jsx(su,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>je({id:I._id}),className:"p-1.5 hover:bg-rose-900/40 text-rose-400 rounded-lg cursor-pointer",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:"text-2xl font-extrabold font-display",children:I.price}),a.jsx("span",{className:"text-xs text-slate-400",children:I.unit})]}),a.jsx("p",{className:"text-[11px] text-slate-400",children:I.tagline}),I.includedMinutes?a.jsxs("p",{className:"text-[10px] text-indigo-300 font-semibold",children:[I.includedMinutes.toLocaleString()," included minutes"]}):null,I.annualPrice?a.jsxs("p",{className:"text-[10px] text-emerald-400 font-semibold",children:["Annual: ",I.annualPrice,"/yr"]}):a.jsx("p",{className:"text-[10px] text-slate-500",children:"No annual option"}),a.jsx("ul",{className:"space-y-1 text-[11px] text-slate-200",children:(I.features??[]).slice(0,4).map(($e,lt)=>a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx(kt,{className:"w-3 h-3 text-indigo-400 mt-0.5 shrink-0"})," ",$e]},lt))}),a.jsxs("div",{className:"text-[10px] text-slate-500 pt-1 border-t border-slate-800",children:["planKey: ",a.jsx("span",{className:"font-mono",children:I.planKey})," · CTA: ",I.cta]})]},I._id))})]})]}),v==="billing"&&a.jsxs("div",{className:"space-y-6 animate-fade-in",children:[a.jsxs("div",{className:`${rt} p-6`,children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display",children:"Platform Cost Model"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"The real per-minute platform cost (model + telephony) used to bill every call, plus the balance gate and worker-cost variance threshold."})]}),ht&&a.jsxs("span",{className:"text-[10px] font-semibold bg-emerald-50 text-emerald-700 px-2.5 py-1 rounded-lg flex items-center gap-1",children:[a.jsx(kt,{className:"w-3 h-3"})," Saved"]})]}),a.jsxs("form",{onSubmit:Lt,className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Model $/min"}),a.jsx("input",{type:"number",min:"0",step:"0.001",required:!0,placeholder:"0.04",value:ze.modelCostPerMin,onChange:I=>Le({...ze,modelCostPerMin:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Telephony $/m
733in"}),a.jsx("input",{type:"number",min:"0",step:"0.001",required:!0,placeholder:"0.03 (phone only)",value:ze.telephonyCostPerMin,onChange:I=>Le({...ze,telephonyCostPerMin:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Egress recording $/min"}),a.jsx("input",{type:"number",min:"0",step:"0.001",placeholder:"0 (phone recording leg)",value:ze.egressCostPerMin,onChange:I=>Le({...ze,egressCostPerMin:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Balance gate"}),a.jsxs("select",{value:ze.balanceGateMode,onChange:I=>Le({...ze,balanceGateMode:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600",children:[a.jsx("option",{value:"hard",children:"Hard (block at $0)"}),a.jsx("option",{value:"warn",children:"Warn (allow, flag)"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Variance %"}),a.jsx("input",{type:"number",min:"0",step:"0.01",required:!0,placeholder:"0.25",value:ze.costVariancePct,onChange:I=>Le({...ze,costVariancePct:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsx("div",{className:"md:col-span-4",children:a.jsxs("button",{type:"submit",className:"bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-semibold px-4 py-2 rounded-lg flex items-center gap-2",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," Save cost model"]})})]})]}),a.jsxs("div",{className:`${rt} p-6`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display",children:"Abuse Protection — Call Rate Limits"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Limits how often one visitor can start calls on the public demo and widgets. Applies within about a minute of saving."})]}),tn&&a.jsxs("span",{className:"text-[10px] font-semibold bg-emerald-50 text-emerald-700 px-2.5 py-1 rounded-lg flex items-center gap-1",children:[a.jsx(kt,{className:"w-3 h-3"})," Saved"]})]}),a.jsxs("form",{onSubmit:kn,className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Calls per IP"}),a.jsx("input",{type:"number",min:"1",max:"1000",step:"1",required:!0,value:bt.perIp,onChange:I=>Vt({...bt,perIp:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Per window (minutes)"}),a.jsx("input",{type:"number",min:"1",max:"1440",step:"1",required:!0,value:bt.windowMin,onChange:I=>Vt({...bt,windowMin:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Calls per client / hour"}),a.jsx("input",{type:"number",min:"1",step:"1",required:!0,value:bt.perClientHour,onChange:I=>Vt({...bt,perClientHour:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Demo call max (seconds)"}),a.jsx("input",{type:"number",min:"30",max:"3600",step:"10",required:!0,value:bt.demoMaxSeconds,onChange:I=>Vt({...bt,demoMaxSeconds:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{className:"md:col-span-4 flex items-center gap-3",children:[a.jsxs("button",{type:"submit",className:"bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-semibold px-4 py-2 rounded-lg flex items-center gap-2",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," Save limits"]}),Cn&&a.jsx("span",{className:"text-xs text-rose-600",children:Cn}),a.jsx("span",{className:"text-[11px] text-slate-400",children:"Example: 6 calls per IP every 10 minutes."})]})]})]}),a.jsxs("div",{className:`${rt} p-6`,children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display mb-1",children:"Last 7 Days — Billed Calls"}),a.jsx("p",{className:"text-xs text-slate-500 mb-4",children:"Aggregated from callSessions (real data, not synthetic)."}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left text-xs border-collapse",children:[a.jsx("thead",{className:"bg-slate-100 text-slate-500 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2",children:"Day"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Sessions"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Minutes"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Revenue $"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Platform cost $"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Margin $"})]})}),a.jsxs("tbody",{children:[ve.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-3 py-6 text-center text-slate-400",children:"No billed calls in the last 7 days."})}),ve.map(I=>a.jsxs("tr",{className:"border-t border-slate-100",children:[a.jsxs("td",{className:"px-3 py-2 font-medium text-slate-700",children:[I.day," ",a.jsx("span",{className:"text-slate-400 font-normal",children:I.date})]}),a.jsx("td",{className:"px-3 py-2 text-right text-slate-600",children:I.sessions}),a.jsx("td",{className:"px-3 py-2 text-right text-slate-600",children:I.minutes}),a.jsxs("td",{className:"px-3 py-2 text-right text-emerald-600",children:["$",I.revenue.toFixed(2)]}),a.jsxs("td",{className:"px-3 py-2 text-right text-slate-500",children:["$",I.cost.toFixed(2)]}),a.jsxs("td",{className:"px-3 py-2 text-right font-semibold text-slate-700",children:["$",I.margin.toFixed(2)]})]},I.date))]})]})})]}),a.jsxs("div",{className:`${rt} overflow-hidden`,children:[a.jsxs("div",{className:"p-5 border-b border-slate-100 flex justify-between items-center bg-slate-50/50",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display text-sm",children:"Cost-Variance Flags"}),a.jsx("p",{className:"text-[10px] text-slate-500",children:"Calls where the worker-reported cost diverged from the platform $/min beyond the threshold."})]}),a.jsxs("span",{className:"text-[10px] font-mono text-slate-400 uppercase",children:[Be.length," flagged"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left text-xs border-collapse",children:[a.jsx("thead",{className:"bg-slate-100 text-slate-500 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2",children:"Call"}),a.jsx("th",{className:"px-3 py-2",children:"Channel"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Mins"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Charged $"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Worker cost $"})]})}),a.jsxs("tbody",{children:[Be.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-3 py-6 text-center text-slate-400",children:"No variance flags in the last 30 days."})}),Be.map(I=>a.jsxs("tr",{className:"border-t border-slate-100",children:[a.jsx("td",{className:"px-3 py-2 font-mono text-slate-600 truncate max-w-[160px]",children:I.callId}),a.jsx("td",{className:"px-3 py-2 text-slate-600",children:I.channel}),a.jsx("td",{className:"px-3 py-2 text-right text-slate-600",children:I.minutesBilled}),a.jsxs("td",{className:"px-3 py-2 text-right text-emerald-600",children:["$",(I.costCents/100).toFixed(2)]}),a.jsxs("td",{className:"px-3 py-2 text-right text-amber-600",children:["$",(I.workerCostCents/100).toFixed(2)]})]},I._id))]})]})})]}),a.jsxs("div",{className:`${rt} overflow-hidden`,children:[a.jsxs("div",{className:"p-5 border-b border-slate-100 flex justify-between items-center bg-slate-50/50",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display text-sm",children:"Client Balances & Minutes"}),a.jsx("p",{className:"text-[10px] text-slate-500",children:"Remaining included minutes this cycle + credit balance. Sorted lowest remaining first."})]}),a.jsxs("span",{className:"text-[10px] font-mono text-slate-400 uppercase",children:[be.length," clients"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left text-xs border-collapse",children:[a.jsx("thead",{className:"bg-slate-100 text-slate-500 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2",children:"Client"}),a.jsx("th",{className:"px-3 py-2",children:"Plan"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Included left"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Used"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Balance $"})]})}),a.jsxs("tbody",{children:[be.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-3 py-6 text-center text-slate-400",children:"No clients yet."})}),be.map(I=>a.jsxs("tr",{className:"border-t border-slate-100",children:[a.jsx("td",{className:"px-3 py-2 font-medium text-slate-700",children:I.name||I._id}),a.jsx("td",{className:"px-3 py-2 text-slate-600",children:I.planKey||"—"}),a.jsx("td",{className:"px-3 py-2 text-right",children:a.jsxs("span",{className:I.minutesRemaining===0?"text-rose-600 font-semibold":"text-slate-600",children:[I.minutesRemaining,"/",I.includedMinutes]})}),a.jsx("td",{className:"px-3 py-2 text-right text-slate-500",children:I.includedMinutesUsed}),a.jsxs("td",{className:"px-3 py-2 text-right font-semibold text-slate-700",children:["$",(I.balance??0).toFixed(2)]})]},I._id))]})]})})]})]}),v==="leads"&&a.jsxs("div",{className:`${rt} p-6 animate-fade-in`,children:[a.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3 flex-wrap",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(zs,{className:"w-5 h-5 text-indigo-600"})," Leads & Call Recordings"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:'Every lead across all agencies — inbound call recordings + contact-form submissions (incl. the platform demo VA / landing-page "Contact us").'})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[a.jsx("button",{onClick:li,disabled:In,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-slate-100 hover:bg-slate-200 text-slate-700 text-[11px] font-bold transition-all disabled:opacity-60",children:In?"Backfilling…":"Backfill legacy leads"}),Ur&&a.jsx("span",{className:"text-[10px] text-slate-500 max-w-[280px] text-right",children:Ur})]})]}
733),a.jsx(Nz,{results:fr,status:Gi.status,loadMore:Gi.loadMore,channel:Ze,source:jt,onFilter:(I,$e)=>{Ft(I),oi($e)},clientNameFor:I=>{const $e=fr.find(lt=>lt.clientId===I);return $e?`${$e.clientName} · ${$e.agencyName}`:"—"},emptyHint:"No leads have been captured yet. Inbound calls and landing-page contact submissions will appear here."})]}),v==="communications"&&a.jsxs("div",{className:`${rt} p-6 animate-fade-in`,children:[a.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3 flex-wrap",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(Pk,{className:"w-5 h-5 text-indigo-600"})," Communications"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Contacts, messages, bookings and recordings for one tenant at a time — the same view the end client gets (live, not the leads table)."})]}),a.jsxs("select",{value:Wt??"",onChange:I=>Jt(I.target.value||null),className:"rounded-xl border border-slate-200 px-3 py-2 text-xs font-semibold text-slate-700 bg-white cursor-pointer max-w-xs",children:[ot.length===0&&a.jsx("option",{value:"",children:"Loading clients…"}),ot.map(I=>a.jsxs("option",{value:I.id,children:[I.companyName||I.name,I.email?` (${I.email})`:""]},I.id))]})]}),Wt?a.jsxs("div",{className:"space-y-5",children:[a.jsx(Pz,{clientId:Wt,onPick:I=>{dt(I),te("feed")}}),a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-slate-100 pb-3",children:[a.jsx("button",{onClick:()=>te("contacts"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer ${$t==="contacts"?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"Contacts"}),a.jsx("button",{onClick:()=>te("feed"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer ${$t==="feed"?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"All communications"}),a.jsx("button",{onClick:()=>te("bookings"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer ${$t==="bookings"?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"Bookings"})]}),$t==="contacts"?a.jsx(Tz,{clientId:Wt}):$t==="bookings"?a.jsx(Az,{clientId:Wt}):a.jsx(Ez,{clientId:Wt,initialRecordingFilter:Fe})]}):a.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 p-8 text-center text-slate-400 text-sm",children:"No clients yet — communications appear once a tenant is created."})]}),v==="accessRequests"&&a.jsxs("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(Hw,{className:"w-5 h-5 text-indigo-600"})," Access Requests"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Visitors who requested access via #/request-access. Approve as a new agency (sends a Clerk invitation) or as a client of an existing agency. Invite-only — no public self-signup."})]}),Te&&a.jsx("span",{className:"text-[11px] font-semibold text-slate-600 bg-slate-100 px-2.5 py-1 rounded-lg",children:Te})]}),He.length===0?a.jsx("p",{className:"text-xs text-slate-400 py-8 text-center",children:"No access requests yet. The public request-access form (#/request-access) feeds this queue."}):a.jsx("div",{className:"space-y-3",children:He.map(I=>{const $e=I.status==="pending",lt=X[I._id],ei=qe[I._id];return a.jsxs("div",{className:`border rounded-2xl p-4 ${$e?"border-amber-200 bg-amber-50/40":I.status==="approved"?"border-emerald-200 bg-emerald-50/40":"border-slate-200 bg-slate-50/40"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-sm font-bold text-slate-900",children:I.name||"—"}),a.jsx("span",{className:`text-[9px] font-bold uppercase px-2 py-0.5 rounded-full ${$e?"bg-amber-200 text-amber-800":I.status==="approved"?"bg-emerald-200 text-emerald-800":"bg-slate-200 text-slate-600"}`,children:I.status}),I.planInterest&&a.jsxs("span",{className:"text-[10px] text-slate-500",children:["· ",I.planInterest]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-0.5 break-all",children:I.email}),(I.company||I.phone)&&a.jsxs("p",{className:"text-[11px] text-slate-500 mt-0.5",children:[I.company?`Company: ${I.company}`:"",I.company&&I.phone?" · ":"",I.phone?`☎ ${I.phone}`:""]}),I.intendedUse&&a.jsxs("p",{className:"text-[11px] text-slate-500 mt-1.5 italic",children:["“",I.intendedUse,"”"]}),I.status!=="pending"&&I.decidedAt&&a.jsxs("p",{className:"text-[10px] text-slate-400 mt-1",children:[I.status," ",new Date(I.decidedAt).toLocaleStr
733ing(),I.resultingKind?` · became ${I.resultingKind}`:""]})]}),$e&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{onClick:()=>{mt(I._id,I.company||I.name)},className:"px-2.5 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-[11px] font-bold",children:"Approve as agency"}),a.jsx("button",{onClick:()=>{Ie(I._id)},className:"px-2.5 py-1.5 rounded-lg bg-slate-700 hover:bg-slate-600 text-white text-[11px] font-bold",children:"Approve as client"}),a.jsx("button",{onClick:()=>ks(I._id),disabled:ie===I._id,className:"px-2.5 py-1.5 rounded-lg bg-rose-100 hover:bg-rose-200 text-rose-700 text-[11px] font-bold disabled:opacity-60",children:"Reject"})]})]}),$e&&lt&&a.jsxs("div",{className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-2 items-end bg-white/70 rounded-xl p-3 border border-amber-200",children:[a.jsxs("label",{className:"text-[10px] font-semibold text-slate-600 col-span-2 md:col-span-1",children:["Agency name",a.jsx("input",{value:lt.name,onChange:jn=>Ee(Tn=>({...Tn,[I._id]:{...lt,name:jn.target.value}})),className:"mt-1 w-full bg-white border border-slate-200 rounded-lg text-xs px-2 py-1.5"})]}),a.jsxs("label",{className:"text-[10px] font-semibold text-slate-600",children:["Multiplier",a.jsx("input",{type:"number",step:"0.1",value:lt.multiplier,onChange:jn=>Ee(Tn=>({...Tn,[I._id]:{...lt,multiplier:parseFloat(jn.target.value)||1}})),className:"mt-1 w-full bg-white border border-slate-200 rounded-lg text-xs px-2 py-1.5"})]}),a.jsxs("label",{className:"text-[10px] font-semibold text-slate-600",children:["Plan",a.jsx("input",{value:lt.plan,onChange:jn=>Ee(Tn=>({...Tn,[I._id]:{...lt,plan:jn.target.value}})),className:"mt-1 w-full bg-white border border-slate-200 rounded-lg text-xs px-2 py-1.5"})]}),a.jsxs("label",{className:"text-[10px] font-semibold text-slate-600",children:["Balance (min)",a.jsx("input",{type:"number",value:lt.balance,onChange:jn=>Ee(Tn=>({...Tn,[I._id]:{...lt,balance:parseInt(jn.target.value)||0}})),className:"mt-1 w-full bg-white border border-slate-200 rounded-lg text-xs px-2 py-1.5"})]}),a.jsx("div",{className:"col-span-2 md:col-span-4 flex justify-end",children:a.jsx("button",{onClick:()=>Nn(I._id),disabled:ie===I._id,className:"px-3 py-1.5 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-[11px] font-bold disabled:opacity-60",children:ie===I._id?"Sending invite…":"Send invite & create agency"})})]}),$e&&ei&&a.jsxs("div",{className:"mt-3 grid grid-cols-2 md:grid-cols-3 gap-2 items-end bg-white/70 rounded-xl p-3 border border-amber-200",children:[a.jsxs("label",{className:"text-[10px] font-semibold text-slate-600 col-span-2 md:col-span-1",children:["Agency",a.jsxs("select",{value:ei.agencyId,onChange:jn=>Nt(Tn=>({...Tn,[I._id]:{...ei,agencyId:jn.target.value}})),className:"mt-1 w-full bg-white border border-slate-200 rounded-lg text-xs px-2 py-1.5",children:[a.jsx("option",{value:"",children:"Pick an agency…"}),e.map(jn=>a.jsx("option",{value:jn.id,children:jn.name},jn.id))]})]}),a.jsxs("label",{className:"text-[10px] font-semibold text-slate-600 col-span-2 md:col-span-1",children:["Client name",a.jsx("input",{value:ei.clientName,onChange:jn=>Nt(Tn=>({...Tn,[I._id]:{...ei,clientName:jn.target.value}})),className:"mt-1 w-full bg-white border border-slate-200 rounded-lg text-xs px-2 py-1.5"})]}),a.jsx("div",{className:"col-span-2 md:col-span-1 flex items-end justify-end",children:a.jsx("button",{onClick:()=>kr(I._id),disabled:ie===I._id,className:"px-3 py-1.5 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-[11px] font-bold disabled:opacity-60",children:ie===I._id?"Sending…":"Send invite & create client"})})]})]},I._id)})})]}),v==="agenciesPage"&&a.jsx(gCe,{}),v==="catalog"&&a.jsxs("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(yv,{className:"w-5 h-5 text-indigo-600"})," Tool Catalog"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"The platform tool registry. Edit metadata, plan tier, default-on, and lifecycle status. Schemas are deployed via seed/re-sync."})]}),a.jsx(Bl,{label:"Tool Catalog",children:a.jsx(Xje,{})}),a.jsx(Bl,{label:"Vault Migrations",children:a.jsx(eCe,{})})]}),v==="tools"&&a.jsxs("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(kv,{className:"w-5 h-5 text-indigo-600"})," Tools (per-VA)"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Attach, enable, and configure tools on any VA across all clients. Secret fields are vault-stored."})]}),a.jsx(Bl,{label:"Tools",children:a.jsx(Mz,{vas:ct??[]})})]}),v==="flows"&&a.jsxs("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(Kw,{className:"w-5 h-5 text-indigo-600"})," Flow Editor"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Edit the conversation flow for any VA. Superadmin mode: full structural edit + version history."})]}),a.jsx(Bl,{label:"Flow Editor",children:ct&&ct.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] font-semibold text-slate-500",children:"VA:"}),a.jsx("select",{value:ln,onChange:I=>Ut(I.target.value),className:"px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500",children:ct.map(I=>a.jsx("option",{value:I._id,children:I.name||I._id},I._id))}),a.jsxs("button",{onClick:()=>K(),disabled:_i,className:"ml-auto inline-flex items-center gap-1.5 px-3 py-2 text-xs font-semibold text-indigo-600 bg-indigo-50 rounded-lg hover:bg-indigo-100 disabled:opacity-50",title:"Materialize a v1 active default flow for every VA that doesn't have one. Idempotent. Does NOT enable the flow engine.",children:[a.jsx(xs,{className:"w-3.5 h-3.5"})," ",_i?"Backfilling…":"Backfill default flows"]})]}),Bt&&a.jsxs("div",{className:"text-[11px] text-slate-600 bg-slate-50 border border-slate-200 rounded-lg px-3 py-2",children:["Backfill complete: created ",Bt.created," / skipped ",Bt.skipped," / total ",Bt.total,"."]}),a.jsx(Rz,{vaId:ln,mode:"superadmin"})]}):a.jsx("div",{className:"text-xs text-slate-500 p-4",children:"No voice agents exist yet."})})]}),v==="phoneNumbers"&&a.jsx("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:a.jsx(Bl,{label:"Phone Numbers",children:a.jsx(Lz,{})})}),v==="extensions"&&a.jsx("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:a.jsx(Bl,{label:"Extensions",children:a.jsx(Uz,{})})}),v==="smsInbox"&&a.jsx("div",{className:`${rt} p-6 space-y-4 animate-fade-in`,children:a.jsx(Bl,{label:"Inbound SMS",children:a.jsx(mCe,{})})}),v==="settings"&&a.jsxs("div",{className:`${rt} p-6 space-y-6 animate-fade-in`,children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(gu,{className:"w-5 h-5 text-indigo-600"})," Platform API & Model Settings"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Configure your master Gemini API key and select flagship models for voice calls and receptionists."})]}),a.jsx("div",{className:"border-t border-slate-100 pt-6",children:a.jsxs("form",{onSubmit:I=>{I.preventDefault();const $e=I.currentTarget,lt=$e.elements.namedItem("customApiKey").value,ei=$e.elements.namedItem("selectedModel").value,
733jn=$e.elements.namedItem("selectedStandardModel").value,Tn=$e.elements.namedItem("retentionDays").value,Aa=$e.elements.namedItem("retentionCostPerRecordingPerMonth").value,Zt=Tn===""?void 0:Number(Tn),Si=Aa===""?void 0:Number(Aa),Sc=$e.elements.namedItem("defaultVoicePipeline").value,pr=$e.elements.namedItem("whatsappReplyMode").value,ti=kc=>{var Kp;return((Kp=$e.elements.namedItem(kc))==null?void 0:Kp.value)??""},Yu={realtimeProvider:ti("vpRealtimeProvider")||void 0,realtimeModel:ti("vpRealtimeModel")||void 0,realtimeVoice:re||void 0,language:W||void 0,sttProvider:ti("vpSttProvider")||void 0,sttEndpoint:ti("vpSttEndpoint")||void 0,llmProvider:ti("vpLlmProvider")||void 0,llmEndpoint:ti("vpLlmEndpoint")||void 0,llmModel:ti("vpLlmModel")||void 0,ttsProvider:ti("vpTtsProvider")||void 0,ttsEndpoint:ti("vpTtsEndpoint")||void 0,ttsVoice:ti("vpTtsVoice")||void 0,...ti("vpMaxCallDurationSec")!==""&&Number.isFinite(Number(ti("vpMaxCallDurationSec")))?{maxCallDurationSec:Math.max(1,Math.floor(Number(ti("vpMaxCallDurationSec"))))}:{}};p&&(p({customApiKey:lt,selectedModel:ei,selectedStandardModel:jn,defaultVoicePipeline:Sc,voicePipelineConfig:Yu,whatsappReplyMode:pr,...Zt!==void 0&&Number.isFinite(Zt)?{retentionDays:Zt}:{},...Si!==void 0&&Number.isFinite(Si)?{retentionCostPerRecordingPerMonth:Si}:{}}),ne(!0),setTimeout(()=>ne(!1),4e3))},className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"Custom Gemini API Key"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{name:"customApiKey",type:U?"text":"password",defaultValue:(f==null?void 0:f.customApiKey)||"",placeholder:"Enter custom Gemini API key (optional)",className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all pr-12 font-mono"}),a.jsx("button",{type:"button",onClick:()=>O(!U),className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs font-semibold text-indigo-600 hover:text-indigo-800 focus:outline-none cursor-pointer",children:U?"Hide":"Show"})]}),a.jsxs("p",{className:"text-[10px] text-slate-400 leading-relaxed",children:["💡 ",a.jsx("strong",{children:"Note:"})," Leave empty to use the platform's pre-configured Gemini key. Setting a custom API key ensures your whitelabel clients can run calls on your own billing and quota limits."]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"Voice Agent Live Model (Real-Time Call)"}),a.jsxs("select",{name:"selectedModel",defaultValue:(f==null?void 0:f.selectedModel)||"gemini-3.1-flash-live-preview",className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all cursor-pointer font-semibold",children:[a.jsx("option",{value:"gemini-3.1-flash-live-preview",children:"gemini-3.1-flash-live-preview (Recommended S2S Voice)"}),a.jsx("option",{value:"gemini-2.5-flash",children:"gemini-2.5-flash (Low-latency S2S Voice)"}),a.jsx("option",{value:"gemini-2.0-flash-exp",children:"gemini-2.0-flash-exp (Experimental S2S Voice)"})]}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Selects the high-performance Gemini Live model to power the low-latency real-time voice sessions over WebSockets."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"Standard Fallback Model (Classic & Outbound)"}),a.jsxs("select",{name:"selectedStandardModel",defaultValue:(f==null?void 0:f.selectedStandardModel)||"gemini-3.5-flash",className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all cursor-pointer font-semibold",children:[a.jsx("option",{value:"gemini-3.5-flash",children:"gemini-3.5-flash (Default flagship standard model)"}),a.jsx("option",{value:"gemini-3.1-flash-lite",children:"gemini-3.1-flash-lite (Ultra-fast & cost-efficient)"}),a.jsx("option",{value:"gemini-3.1-pro-preview",children:"gemini-3.1-pro-preview (Max Intelligence & Complex Q&A)"})]}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Powers the classic receptionist REST engine and the multi-step intake extractor, handling structured payloads."})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 pt-2 border-t border-slate-100",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"Call Recording Retention (days)"}),a.jsx("input",{name:"retentionDays",type:"number",min:1,defaultValue:(f==null?void 0:f.retentionDays)??60,className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all font-semibold"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"How long c
733all records + recordings are kept before automatic deletion. Agencies can override this per client; this is the platform default."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"Retention Cost / Recording / Month ($)"}),a.jsx("input",{name:"retentionCostPerRecordingPerMonth",type:"number",min:0,step:"0.01",defaultValue:(f==null?void 0:f.retentionCostPerRecordingPerMonth)??.05,className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all font-semibold"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Billed monthly to each client for every recording kept within its retention window. Set 0 to disable retention billing."})]})]}),a.jsxs("div",{className:"space-y-4 pt-2 border-t border-slate-100",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"Default Voice Pipeline"}),a.jsxs("select",{name:"defaultVoicePipeline",defaultValue:(f==null?void 0:f.defaultVoicePipeline)??"realtime",className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all cursor-pointer font-semibold",children:[a.jsx("option",{value:"realtime",children:"realtime — provider realtime model (Gemini Live / OpenAI Realtime); lowest latency"}),a.jsx("option",{value:"stacked",children:"stacked — STT → LLM → TTS; open-source models, <300 ms target"})]}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Platform default for clients whose agency + client haven't chosen. Both pipelines run concurrently; agencies/clients can override."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"Realtime Provider"}),a.jsx("input",{name:"vpRealtimeProvider",defaultValue:((Wp=f==null?void 0:f.voicePipelineConfig)==null?void 0:Wp.realtimeProvider)??"",placeholder:"gemini",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"Realtime Model"}),a.jsx("input",{name:"vpRealtimeModel",defaultValue:((Hp=f==null?void 0:f.voicePipelineConfig)==null?void 0:Hp.realtimeModel)??"",placeholder:"leave blank = language-auto (Urdu→2.5 native-audio, English→flash-live)",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Pin one model for ALL tenants, or leave blank so each call picks by language (Urdu→gemini-2.5-flash-native-audio for a natural voice, English→flash-live for low latency). Client/agency overrides still win."})]}),a.jsxs("div",{className:"space-y-1.5 md:col-span-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"Realtime Voice & Language"}),a.jsx(bb,{provider:((wc=f==null?void 0:f.voicePipelineConfig)==null?void 0:wc.realtimeProvider)??"",voice:re,language:W,onChange:I=>{I.realtimeVoice!==void 0&&Q(I.realtimeVoice),I.language!==void 0&&q(I.language)}})]})]}),a.jsx("p",{className:"text-[10px] text-slate-500 font-semibold pt-1",children:"Stacked pipeline defaults (STT → LLM → TTS). Leave blank to let agencies/clients set."}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"STT Provider"}),a.jsx("input",{name:"vpSttProvider",defaultValue:((Ns=f==null?void 0:f.voicePipelineConfig)==null?void 0:Ns.sttProvider)??"",placeholder:"deepgram | whisper-local",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"STT Endpoint"}),a.jsx("input",{name:"vpSttEndpoint",defaultValue:((Hu=f==null?void 0:f.voicePipelineConfig)==null?void 0:Hu.sttEndpoint)??"",placeholder:"https://whisper.local/v1",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"LLM Provider"}),a.jsx("input",{name:"vpLlmProvider",defaultValue:((Ku=f==null?void 0:f.voicePipelineConfig)==null?void 0:Ku.llmProvider)??"",placeholder:"groq | openai | llama-local",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"LLM Endpoint"}),a.jsx("input",{name:"vpLlmEndpoint",defaultValue:((fo=f==null?void 0:f.voicePipelineConfig)==null?void 0:fo.llmEndpoint)??"",placeholder:"https://api.groq.com/openai",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"LLM Model"}),a.jsx("input",{name:"vpLlmModel",defaultValue:((mo=f==null?void 0:f.voicePipelineConfig)==null?void 0:mo.llmModel)??"",placeholder:"llama-3.1-70b-versatile",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"TTS Provider"}),a.jsx("input",{name:"vpTtsProvider",defaultValue:((Qh=f==null?void 0:f.voicePipelineConfig)==null?void 0:Qh.ttsProvider)??"",placeholder:"cartesia | piper-local",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"TTS Endpoint"}),a.jsx("input",{name:"vpTtsEndpoint",defaultValue:((Gu=f==null?void 0:f.voicePipelineConfig)==null?void 0:Gu.ttsEndpoint)??"",placeholder:"https://piper.local/v1",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"TTS Voice"}),a.jsx("input",{name:"vpTtsVoice",defaultValue:((Xh=f==null?void 0:f.voicePipelineConfig)==null?void 0:Xh.ttsVoice)??"",placeholder:"en_US-amy",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-600 uppercase",children:"Max Call Duration (sec)"}),a.jsx("input",{name:"vpMaxCallDurationSec",type:"number",min:1,defaultValue:((ml=f==null?void 0:f.voicePipelineConfig)==null?void 0:ml.maxCallDurationSec)??"",placeholder:"180 (3 min)",className:"w-full bg-slate-50 border border-slate-200 rounded-lg px-3 py-2 text-[11px] font-mono"}),a.jsx("p",{className:"text-[9px] text-slate-400",children:"Platform default; calls auto-disconnect after this. Per-VA override in Voice Agents."})]})]})]}),a.jsxs("div",{className:"space-y-2 pt-2 border-t border-slate-100",children:[a.jsx("label",{className:"block text-xs font-bold text-slate-700 uppercase tracking-wider",children:"WhatsApp Reply Format"}),a.jsxs("select",{name:"whatsappReplyMode",defaultValue:(f==null?void 0:f.whatsappReplyMode)??"text-only",className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-3 text-xs transition-all cursor-pointer font-semibold",children:[a.jsx("option",{value:"text-only",children:"text-only — text replies only (voice notes OFF — 
733cheapest)"}),a.jsx("option",{value:"both",children:"both — text + voice note for every reply"}),a.jsx("option",{value:"audio-only",children:"audio-only — voice-note replies only (no text)"}),a.jsx("option",{value:"off",children:"off — text replies only (same as text-only)"})]}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Controls the async WhatsApp customer-care reply format. Voice notes cost more (TTS + audio message); text is near-free. Default text-only."})]}),F&&a.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded-xl p-3 flex items-center gap-2 text-emerald-800 text-xs font-semibold",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-600"}),"Platform API & Flagship Model settings saved successfully! Dev server and Live socket routes have been updated."]}),a.jsx("div",{className:"pt-2",children:a.jsxs("button",{type:"submit",className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs px-5 py-3 rounded-xl flex items-center gap-1.5 transition-all shadow-md cursor-pointer",children:[a.jsx($i,{className:"w-4 h-4"})," Save System Settings"]})})]})}),a.jsx("div",{className:"border-t border-slate-100 pt-6",children:a.jsx(h4,{children:a.jsx(Q3,{})})}),a.jsxs("div",{className:"border-t border-slate-100 pt-6",children:[a.jsxs("h4",{className:"text-sm font-bold font-display text-slate-900 flex items-center gap-2",children:[a.jsx(xs,{className:"w-4 h-4 text-indigo-600"})," Platform Demo VA Ownership"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-1 mb-3",children:"Move the landing-page demo voice agent under a real admin's agency so that admin can amend its knowledge base, greeting, and voice from their AdminDashboard. The public landing widget keeps working (it reads the demo client by id, not agency). One-time action."}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-start sm:items-end",children:[a.jsxs("div",{className:"flex-1 w-full",children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-500 uppercase tracking-wider mb-1",children:"Admin email (agency owner)"}),a.jsx("input",{type:"email",value:zt,onChange:I=>{si(I.target.value),qt(null)},placeholder:"[email protected]",className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-2.5 text-xs transition-all"})]}),a.jsx("button",{type:"button",disabled:ai||!zt.trim(),onClick:async()=>{Zn(!0),qt(null);try{const I=await On({adminEmail:zt.trim()});qt({ok:!0,msg:`Done — demo VA moved to agency ${I.agencyId}. That admin will now see it in their AdminDashboard.`})}catch(I){qt({ok:!1,msg:(I==null?void 0:I.message)||"Reparent failed."})}finally{Zn(!1)}},className:"bg-indigo-600 hover:bg-indigo-500 disabled:opacity-40 disabled:cursor-not-allowed text-white font-semibold text-xs px-4 py-2.5 rounded-xl transition-all shadow-md cursor-pointer whitespace-nowrap",children:ai?"Moving…":"Move Demo VA to Agency"})]}),qn&&a.jsx("div",{className:`mt-3 text-xs rounded-lg px-3 py-2 ${qn.ok?"bg-emerald-50 text-emerald-700 border border-emerald-100":"bg-rose-50 text-rose-700 border border-rose-100"}`,children:qn.msg})]})]}),v==="systemHealth"&&(()=>{const I=ve,$e=I.reduce((Zt,Si)=>Zt+(Si.sessions??0),0),lt=I.reduce((Zt,Si)=>Zt+(Si.minutes??0),0),ei=I.reduce((Zt,Si)=>Zt+(Si.revenue??0),0),jn=I.reduce((Zt,Si)=>Zt+(Si.cost??0),0),Tn=be.filter(Zt=>(Zt.balance??0)<=0||(Zt.minutesRemaining??0)===0),Aa=ct??[];return a.jsx(Bl,{label:"System Health",children:a.jsxs("div",{className:"space-y-6 animate-fade-in",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-bold text-slate-900 font-display text-lg",children:"System Health"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Consolidated platform observability — billing, capacity, and provisioning. Reuses data already loaded for this dashboard."})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsx(ir,{icon:Ei,label:"CALLS (7D)",value:$e,sub:`${lt.toLocaleString()} mins billed`}),a.jsx(ir,{icon:Qd,label:"REVENUE (7D)",value:`$${ei.toFixed(2)}`,sub:`$${jn.toFixed(2)} platform cost`}
733),a.jsx(ir,{icon:Jd,label:"VARIANCE FLAGS",value:Be.length,sub:"Cost-divergent sessions (30d)",tone:Be.length?"rose":"slate"}),a.jsx(ir,{icon:Mk,label:"LOW-BALANCE CLIENTS",value:Tn.length,sub:"Zero balance or exhausted minutes",tone:Tn.length?"rose":"slate"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsx(ir,{icon:Kw,label:"VOICE AGENTS",value:Aa.length,sub:"Across all tenants",tone:"indigo"}),a.jsx(ir,{icon:Hw,label:"PROVISIONING QUEUE",value:H,sub:"Access requests awaiting review",tone:H?"emerald":"slate"}),a.jsx(ir,{icon:Tk,label:"LIVEKIT QUOTA",value:"Manual",sub:"Status known out-of-band — not live",tone:"slate"})]}),a.jsxs("div",{className:`${rt} overflow-hidden`,children:[a.jsxs("div",{className:"p-5 border-b border-slate-100 flex justify-between items-center bg-slate-50/50",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display text-sm",children:"Cost-Variance Flags (latest)"}),a.jsx("p",{className:"text-[10px] text-slate-500",children:"Worker-reported cost diverged from platform $/min beyond threshold."})]}),a.jsxs("span",{className:"text-[10px] font-mono text-slate-400 uppercase",children:[Be.length," total"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left text-xs border-collapse",children:[a.jsx("thead",{className:"bg-slate-100 text-slate-500 font-semibold",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2",children:"Call"}),a.jsx("th",{className:"px-3 py-2",children:"Channel"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Mins"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Charged $"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Worker cost $"})]})}),a.jsxs("tbody",{children:[Be.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-3 py-6 text-center text-slate-400",children:"No variance flags in the last 30 days."})}),Be.slice(0,8).map(Zt=>a.jsxs("tr",{className:"border-t border-slate-100",children:[a.jsx("td",{className:"px-3 py-2 font-mono text-slate-600 truncate max-w-[160px]",children:Zt.callId}),a.jsx("td",{className:"px-3 py-2 text-slate-600",children:Zt.channel}),a.jsx("td",{className:"px-3 py-2 text-right text-slate-600",children:Zt.minutesBilled}),a.jsxs("td",{className:"px-3 py-2 text-right text-emerald-600",children:["$",(Zt.costCents/100).toFixed(2)]}),a.jsxs("td",{className:"px-3 py-2 text-right text-amber-600",children:["$",(Zt.workerCostCents/100).toFixed(2)]})]},Zt._id))]})]})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display text-sm mb-2",children:"Self-Hosted Voice Stack"}),a.jsx(h4,{children:a.jsx(Q3,{})})]})]})})})()]})]}),b&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative my-8 max-h-[90vh] overflow-y-auto",children:[a.jsx("button",{onClick:()=>S(!1),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900 mb-4",children:N?"Modify Whitelabel Agency":"Provision Whitelabel Agency"}),a.jsxs("form",{onSubmit:hl,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Agency Name"}),a.jsx("input",{type:"text",required:!0,placeholder:"Apex AI Automation",value:$.name,onChange:I=>ge({...$,name:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Agency Owner Email (login)"}),a.jsx("input",{type:"email",required:!0,placeholder:"[email protected]",value:$.email,onChange:I=>ge({...$,email:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"}),a.jsx("span",{className:"text-[10px] text-slate-400 mt-1 block",children:"The owner signs up in Clerk with this email and is auto-linked as the agency admin — no separate onboarding step."})]}),!N&&a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Owner Name (optional)"}),a.jsx("input",{type:"text",placeholder:"Jane Doe",value:$.ownerName,onChange:I=>ge({...$,ownerName:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Token Multiplier"}),a.jsx("input",{type:"number",required:!0,step:"0.1",min:"1.0",placeholder:"1.5",value:$.multiplier,onCh
733ange:I=>ge({...$,multiplier:Number(I.target.value)}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"}),a.jsx("span",{className:"text-[10px] text-slate-400 mt-1 block",children:"E.g., 1.5 multiplier charges agency 1.5x master cost."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"SaaS Plan Tier"}),a.jsxs("select",{value:$.plan,onChange:I=>ge({...$,plan:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 bg-white",children:[a.jsx("option",{value:"Starter",children:"Starter ($99)"}),a.jsx("option",{value:"Growth",children:"Growth ($299)"}),a.jsx("option",{value:"Enterprise",children:"Enterprise ($899)"})]})]})]}),!N&&a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Starting Credit Balance ($)"}),a.jsx("input",{type:"number",value:$.balance,onChange:I=>ge({...$,balance:Number(I.target.value)}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),T&&a.jsx("div",{className:"text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded-lg px-3 py-2",children:T}),a.jsxs("div",{className:"flex gap-3 mt-5",children:[a.jsx("button",{type:"button",onClick:()=>S(!1),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"submit",className:"flex-1 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:N?"Save Configuration":"Complete Provisioning"})]})]})]})}),A&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-xl w-full p-6 shadow-2xl relative my-8 max-h-[90vh] overflow-y-auto",children:[a.jsx("button",{onClick:()=>M(!1),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900 mb-4",children:R?"Edit Master Voice Template":"Design Master Voice Template"}),a.jsxs("form",{onSubmit:Vp,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Template Name"}),a.jsx("input",{type:"text",required:!0,placeholder:"Real Estate Concierge",value:ue.name,onChange:I=>L({...ue,name:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Industry Category"}),a.jsx("input",{type:"text",required:!0,placeholder:"Healthcare",value:ue.category,onChange:I=>L({...ue,category:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Base Per-Minute Cost ($)"}),a.jsx("input",{type:"number",required:!0,step:"0.01",min:"0.01",placeholder:"0.10",value:ue.baseCostPerMin,onChange:I=>L({...ue,baseCostPerMin:Number(I.target.value)}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Description Summary"}),a.jsx("textarea",{required:!0,rows:2,placeholder:"Describe what business situation this S2S voice receptionist resolves...",value:ue.description,onChange:I=>L({...ue,description:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Default Greeting Script"}),a.jsx("textarea",{required:!0,rows:3,placeholder:"The first sentence spoken aloud to callers...",value:ue.defaultGreeting,onChange:I=>L({...ue,defaultGreeting:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 font-sans"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Default Prompt Instructions"}),a.jsx("textarea",{required:!0,rows:4,placeholder:"Under the hood AI context, goal boundaries, data intake rules, guidelines...",value:ue.defaultPrompt,onChange:I=>L({...ue,defaultPrompt:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 font-sans"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Suggested Scheduled Slots (Comma separated)"}),a.jsx("input",{type:"text",placeholder:"09:00 AM, 11:30 AM, 02:00 PM, 04:00 PM",value:ue.suggestedSlots,onChange:I=>L({...ue,suggestedSlots:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{className:"flex gap-3 mt-5",children:[a.jsx("button",{type:"button",onClick:()=>M(!1),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"submit",className:"flex-1 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Save S2S Template"})]})]})]})}),Br&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-lg w-full p-6 shadow-2xl relative my-8 max-h-[90vh] overflow-y-auto",children:[a.jsx("button",{onClick:()=>is(!1),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900 mb-4",children:Fr?"Edit Pricing Tier":"Add Pricing Tier"}),a.jsxs("form",{onSubmit:Fp,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Audience"}),a.jsxs("select",{value:ft.audience,onChange:I=>Ri({...ft,audience:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 bg-white",children:[a.jsx("option",{value:"direct",children:"Direct Businesses"}),a.jsx("option",{value:"agency",children:"Agency Whitelabel"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Display Name"}),a.jsx("input",{type:"text",required:!0,placeholder:"Business",value:ft.name,onChange:I=>Ri({...ft,name:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Price (display)"}),a.jsx("input",{type:"text",required:!0,placeholder:"$199",value:ft.price,onChange:I=>Ri({...ft,price:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Unit"}),a.jsx("input",{type:"text",placeholder:"/ month",value:ft.unit,onChange:I=>Ri({...ft,unit:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Annual price (optional)"}),a.jsx("input",{type:"text",placeholder:"$1,990 — blank = no annual option",value:ft.annualPrice,onChange:I=>Ri({...ft,annualPrice:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"}),a.jsx("p",{className:"text-[9px] text-slate-400 mt-1",children:"Shown by the landing-page Annual toggle when set; left untouched when blank."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Included Minutes"}),a.jsx("input",{type:"number",min:"0",placeholder:"5000 (blank = n/a)",value:ft.includedMinutes,onChange:I=>Ri({...ft,includedMinutes:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Overage $/min"}),a.jsx("input",{type:"number",min:"0",step:"0.01",placeholder:"0.12 (blank = legacy rate)",value:ft.overageRatePerMin,onChange:I=>Ri({...ft,overageRatePerMin:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Monthly price (¢)"}),a.jsx("input",{type:"number",min:"0",placeholder:"4900 (= $49/mo)",value:ft.monthlyPriceCents,onChange:I=>Ri({...ft,monthlyPriceCents:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Tagline"}),a.jsx("input",{type:"text",required:!0,placeholder:"For local businesses that want every call answered.",value:ft.tagline,onChange:I=>Ri({...ft,tagline:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Features (one per line)"}),a.jsx("textarea",{rows:4,required:!0,placeholder:`5,000 voice minutes / mo
734Whitelabel widget + your domain
735Priority support`,value:ft.features,onChange:I=>Ri({...ft,features:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 font-sans"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"CTA Label"}),a.jsx("input",{type:"text",required:!0,placeholder:"Get Business",value:ft.cta,onChange:I=>Ri({...ft,cta:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Plan Key"}),a.jsx("input",{type:"text",placeholder:"Business (defaults to name)",value:ft.planKey,onChange:I=>Ri({...ft,planKey:I.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 font-mono"}),a.jsx("span",{className:"text-[9px] text-slate-400 block mt-1",children:"Stored on agencies.plan / clients.activePlan when a visitor picks this tier. Keep stable."})]})]}),a.jsxs("div",{className:"flex items-center justify-between border border-slate-100 rounded-xl px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-700 block",children:'Highlight as "Most popular"'}),a.jsx("span",{className:"text-[10px] text-slate-400",children:"Badges the tier on the landing page."})]}),a.jsx("button",{type:"button",onClick:()=>Ri({...ft,highlight:!ft.highlight}),className:`text-[10px] font-extrabold px-3 py-1.5 rounded-md uppercase transition-all cursor-pointer ${ft.highlight?"bg-indigo-600 text-white":"bg-slate-200 text-slate-700"}`,children:ft.highlight?"ON":"OFF"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Sort Order"}),a.jsx("input",{type:"number",min:"0",value:ft.sortOrder,onChange:I=>Ri({...ft,sortOrder:Number(I.target.value)}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{className:"flex gap-3 mt-5",children:[a.jsx("button",{type:"button",onClick:()=>is(!1),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"submit",className:"flex-1 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:Fr?"
735Save Tier":"Add Tier"})]})]})]})}),C&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative my-8",children:[a.jsx("button",{onClick:()=>P(null),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-50 flex items-center justify-center",children:a.jsx(xi,{className:"w-5 h-5 text-rose-600"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"Delete agency?"})]}),a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed mb-3",children:["This permanently removes ",a.jsx("span",{className:"font-semibold text-slate-900",children:C.name}),", its admin login, and all of its clients. This cannot be undone."]}),C.email&&a.jsx("div",{className:"bg-amber-50 border border-amber-100 rounded-xl p-3 mb-4",children:a.jsxs("p",{className:"text-[11px] text-amber-800 leading-relaxed",children:["The admin email ",a.jsx("span",{className:"font-mono font-semibold",children:C.email})," is freed in Vox Bridge and can be reused to invite a new admin. To invite a ",a.jsx("span",{className:"font-semibold",children:"different person"})," at that same email, also remove their account in the Clerk dashboard so they can sign up fresh."]})}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:()=>P(null),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:()=>{s(C.id),P(null)},className:"flex-1 bg-rose-600 hover:bg-rose-500 text-white font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Delete agency"})]})]})})]})}function gCe(){const e=et(me.queries.getAgencyPageContent),t=We(me.mutations.updatePlatformSettings),[n,i]=w.useState(null),[r,s]=w.useState(null),[l,c]=w.useState(null),[h,d]=w.useState(!1),[f,p]=w.useState(null),[v,x]=w.useState(null);e&&n===null&&r===null&&l===null&&(i(e.margins),s(e.resaleTerms),c(e.setupFlow));const b=n&&r&&l,S=async()=>{d(!0),x(null);try{await t({agencyMargins:n,agencyResaleTerms:r,agencySetupFlow:l}),p(Date.now())}catch(ne){x((ne==null?void 0:ne.message)??String(ne))}finally{d(!1)}},N=ne=>i({...n,...ne}),j=()=>i({...n,tiers:[...n.tiers??[],{label:"New tier",volume:"",marginPct:0}]}),T=(ne,re)=>i({...n,tiers:n.tiers.map((Q,W)=>W===ne?{...Q,...re}:Q)}),E=ne=>i({...n,tiers:n.tiers.filter((re,Q)=>Q!==ne)}),C=ne=>s({...r,...ne}),P=()=>s({...r,bullets:[...r.bullets??[],{id:`b${Date.now()}`,text:""}]}),A=(ne,re)=>s({...r,bullets:r.bullets.map((Q,W)=>W===ne?{...Q,text:re}:Q)}),M=ne=>s({...r,bullets:r.bullets.filter((re,Q)=>Q!==ne)}),R=(ne,re)=>{const Q=[...l.steps??[]],W=ne+re;W<0||W>=Q.length||([Q[ne],Q[W]]=[Q[W],Q[ne]],c({...l,steps:Q}))},B=()=>c({...l,steps:[...l.steps??[],{id:`s${Date.now()}`,title:"New step",body:""}]}),U=(ne,re)=>c({...l,steps:l.steps.map((Q,W)=>W===ne?{...Q,...re}:Q)}),O=ne=>c({...l,steps:l.steps.filter((re,Q)=>Q!==ne)});if(!b)return a.jsx("div",{className:"bg-white border border-dashed border-slate-200 rounded-2xl p-8 text-center text-xs text-slate-400",children:"Loading agency page content…"});const F="w-full text-xs border border-slate-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-start gap-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Agencies Page Editor"}),a.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:["Owns the public ",a.jsx("span",{className:"font-mono",children:"#/agencies"})," page: agency margins, resale terms, and setup flow. Tier ",a.jsx("em",{children:"prices"})," are edited in the Pricing Tiers tab (audience = agency)."]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[f&&!v&&a.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[a.jsx(kt,{className:"w-3.5 h-3.5"})," Saved"]}),a.jsxs("button",{onClick:S,disabled:h,className:"bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-semibold text-xs px-4 py-2.5 rounded-xl flex items-center gap-1.5 transition-all shadow-md cursor-pointer",children:[a.jsx($i,{className:"w-4 h-4"})," ",h?"Saving…":"Save Changes"]})]})]}),v&&a.jsx("div",{className:"bg-rose-50 border border-rose-200 text-rose-700 text-xs rounded-xl px-4 py-3",children:v}),a.jsxs("div",{className:`${rt} p-5 space-y-4`,children:[a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:"Agency Margins"}),a.jsx("input",{className:F,value:n.headline??"",onChange:ne=>N({headline:ne.target.value}),placeholder:"Headline, e.g. Resell under your own brand and keep the margin."}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-slate-600",children:[a.jsx("label",{className:"font-semibold",children:"Default discount %"}),a.jsx("input",{type:"number",className:F+" w-24",value:n.defaultDiscountPct??0,onChange:ne=>N({defaultDiscountPct:Number(ne.target.value)})}),a.jsx("span",{className:"text-slate-400",children:"off list price for every agency by default"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] font-semibold text-slate-500",children:"Margin tiers (by client volume)"}),a.jsxs("button",{onClick:j,className:"text-[11px] font-semibold text-indigo-600 hover:text-indigo-500 flex items-center gap-1 cursor-pointer",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," Add tier"]})]}),(n.tiers??[]).map((ne,re)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{className:F+" flex-1",value:ne.label??"",onChange:Q=>T(re,{label:Q.target.value}),placeholder:"Tier label"}),a.jsx("input",{className:F+" flex-1",value:ne.volume??"",onChange:Q=>T(re,{volume:Q.target.value}),placeholder:"Volume band, e.g. 1–5 clients"}),a.jsx("input",{type:"number",className:F+" w-24",value:ne.marginPct??0,onChange:Q=>T(re,{marginPct:Number(Q.target.value)})}),a.jsx("span",{className:"text-[11px] text-slate-400",children:"%"}),a.jsx("button",{onClick:()=>E(re),className:"p-1.5 hover:bg-rose-50 text-rose-600 rounded-lg cursor-pointer",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]},re))]})]}),a.jsxs("div",{className:`${rt} p-5 space-y-4`,children:[a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:"Resale Terms"}
735),a.jsx("textarea",{className:F,rows:2,value:r.intro??"",onChange:ne=>C({intro:ne.target.value}),placeholder:"Intro paragraph"}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] font-semibold text-slate-500",children:"Bullets"}),a.jsxs("button",{onClick:P,className:"text-[11px] font-semibold text-indigo-600 hover:text-indigo-500 flex items-center gap-1 cursor-pointer",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," Add bullet"]})]}),(r.bullets??[]).map((ne,re)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-slate-300",children:"•"}),a.jsx("input",{className:F+" flex-1",value:ne.text??"",onChange:Q=>A(re,Q.target.value),placeholder:"Term bullet"}),a.jsx("button",{onClick:()=>M(re),className:"p-1.5 hover:bg-rose-50 text-rose-600 rounded-lg cursor-pointer",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]},ne.id??re))]})]}),a.jsxs("div",{className:`${rt} p-5 space-y-4`,children:[a.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-slate-400",children:"Setup Flow (ordered)"}),a.jsxs("div",{className:"space-y-2",children:[(l.steps??[]).map((ne,re)=>{var Q;return a.jsxs("div",{className:"flex items-start gap-2 border border-slate-100 rounded-xl p-3",children:[a.jsxs("div",{className:"flex flex-col gap-0.5 pt-1",children:[a.jsx("button",{onClick:()=>R(re,-1),disabled:re===0,className:"text-slate-400 hover:text-slate-700 disabled:opacity-30 cursor-pointer text-[10px]",children:"▲"}),a.jsx("button",{onClick:()=>R(re,1),disabled:re===(((Q=l.steps)==null?void 0:Q.length)??0)-1,className:"text-slate-400 hover:text-slate-700 disabled:opacity-30 cursor-pointer text-[10px]",children:"▼"})]}),a.jsx("span",{className:"text-[11px] font-bold text-indigo-600 pt-1.5",children:re+1}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("input",{className:F,value:ne.title??"",onChange:W=>U(re,{title:W.target.value}),placeholder:"Step title"}),a.jsx("textarea",{className:F,rows:2,value:ne.body??"",onChange:W=>U(re,{body:W.target.value}),placeholder:"Step description"})]}),a.jsx("button",{onClick:()=>O(re),className:"p-1.5 hover:bg-rose-50 text-rose-600 rounded-lg cursor-pointer mt-1",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]},ne.id??re)}),a.jsxs("button",{onClick:B,className:"text-[11px] font-semibold text-indigo-600 hover:text-indigo-500 flex items-center gap-1 cursor-pointer",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," Add step"]})]})]})]})}class Bl extends he.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){console.error("[FeatureBoundary] panel error caught:",t)}render(){if(this.state.error){const t=/Could not find public function/i.test(this.state.error.message);return a.jsxs("div",{className:"border border-amber-100 rounded-2xl p-5 bg-amber-50/60 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"p-2 bg-amber-100 text-amber-700 rounded-xl",children:a.jsx(Uu,{className:"w-4 h-4"})}),a.jsxs("h4",{className:"text-sm font-bold text-slate-800",children:[this.props.label," — not deployed yet"]})]}),a.jsx("p",{className:"text-[11px] text-slate-600 leading-relaxed",children:t?`The ${this.props.label} functions haven’t been pushed to this Convex deployment yet, so the panel can’t load.`:`The ${this.props.label} panel couldn’t load.`}),a.jsxs("p",{className:"text-[10px] text-slate-500 leading-relaxed",children:["Fix: run ",a.jsx("code",{className:"bg-white border border-slate-200 rounded px-1 py-0.5 font-mono text-[10px]",children:"npx convex dev"})," (or ",a.jsx("code",{className:"bg-white border border-slate-200 rounded px-1 py-0.5 font-mono text-[10px]",children:"npx convex deploy"}),") to push the functions, then reload."]})]})}return this.props.children}}class h4 extends he.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){console.error("[RunPodBoundary] RunPod panel error caught:",t)}
735render(){if(this.state.error){const t=/Could not find public function/i.test(this.state.error.message);return a.jsxs("div",{className:"border border-amber-100 rounded-2xl p-5 bg-amber-50/60 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"p-2 bg-amber-100 text-amber-700 rounded-xl",children:a.jsx(Uu,{className:"w-4 h-4"})}),a.jsx("h4",{className:"text-sm font-bold text-slate-800",children:"RunPod Voice Stack — not deployed yet"})]}),a.jsx("p",{className:"text-[11px] text-slate-600 leading-relaxed",children:t?"The RunPod control functions (convex/runpod.ts) haven’t been pushed to this Convex deployment yet, so the On/Off panel can’t load. The rest of this tab still works.":"The RunPod panel couldn’t load. The rest of this tab still works."}),a.jsxs("p",{className:"text-[10px] text-slate-500 leading-relaxed",children:["Fix: run ",a.jsx("code",{className:"bg-white border border-slate-200 rounded px-1 py-0.5 font-mono text-[10px]",children:"npx convex dev"})," (or ",a.jsx("code",{className:"bg-white border border-slate-200 rounded px-1 py-0.5 font-mono text-[10px]",children:"npx convex deploy"}),") to push the functions, then reload."]})]})}return this.props.children}}function vCe(){const e=et(me.queries.getHierarchy);return e===void 0?a.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[a.jsx(Bi,{className:"w-4 h-4 animate-spin"})," Loading hierarchy…"]}):e.length===0?a.jsx("p",{className:"text-xs text-slate-500",children:"No agencies provisioned yet."}):a.jsx("div",{className:"space-y-4",children:e.map(({agency:t,admins:n,clients:i})=>a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-600 rounded-xl",children:a.jsx(Wo,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h4",{className:"text-sm font-bold text-slate-900 truncate",children:t.name}),a.jsx("p",{className:"text-[11px] text-slate-500 truncate",children:t.email})]}),a.jsxs("span",{className:"text-[10px] font-semibold text-slate-400 bg-slate-50 border border-slate-100 rounded-full px-2 py-0.5",children:[i.length," client",i.length===1?"":"s"]})]}),n.length>0&&a.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:n.map(r=>a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-indigo-700 bg-indigo-50 border border-indigo-100 rounded-full px-2 py-0.5",children:[a.jsx(Jd,{className:"w-3 h-3"})," ADMIN · ",r.email]},r.id))}),i.length>0&&a.jsx("div",{className:"mt-3 space-y-2",children:i.map(r=>a.jsxs("div",{className:"ml-4 border-l-2 border-slate-100 pl-4 py-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"p-1.5 bg-slate-50 text-slate-500 rounded-lg",children:a.jsx(yL,{className:"w-3.5 h-3.5"})}),a.jsx("span",{className:"text-xs font-semibold text-slate-800 truncate",children:r.name}),r.email&&a.jsxs("span",{className:"text-[10px] text-slate-400 truncate",children:["· ",r.email]}),a.jsxs("span",{className:"text-[10px] text-slate-400",children:["· ",r.kbCount," KB doc",r.kbCount===1?"":"s"]})]}),r.users.length>0&&a.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:r.users.map(s=>a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-emerald-700 bg-emerald-50 border border-emerald-100 rounded-full px-2 py-0.5",children:[a.jsx(kt,{className:"w-3 h-3"})," ",s.role," · ",s.email]},s.id))}),r.voiceAgents.length>0&&a.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:r.voiceAgents.map(s=>a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-slate-600 bg-slate-50 border border-slate-100 rounded-full px-2 py-0.5",children:[a.jsx(Ei,{className:"w-3 h-3"})," ",s.name,s.isDefault&&a.jsx("span",{className:"text-[9px] font-bold text-indigo-500",children:"DEFAULT"}),a.jsx("span",{className:`text-[9px] font-bold ${s.status==="active"?"text-emerald-500":"text-amber-500"}`,children:s.status})]},s.id))})]},r.id))})]},t.id))})}
735const f4=["sku","name","price","stock","category","description"];function xCe({clientId:e,autoApproveActions:t,maxAutoApproveValue:n}){const i=(et(me.inventory.listInventory,{clientId:e})??[]).map(L=>({...L,id:L._id})),r=(et(me.inventory.listPendingActions,{clientId:e})??[]).map(L=>({...L,id:L._id})),s=We(me.inventory.addInventoryItem),l=We(me.inventory.updateInventoryItem),c=We(me.inventory.deleteInventoryItem),h=We(me.inventory.reviewAgentAction),d=We(me.inventory.setInventoryAutoApprove),[f,p]=w.useState(!!t),[v,x]=w.useState(n!=null?String(n):""),[b,S]=w.useState({sku:"",name:"",price:"",stock:"",category:"",description:"",url:""}),[N,j]=w.useState(null),[T,E]=w.useState({}),[C,P]=w.useState(null),[A,M]=w.useState({}),[R,B]=w.useState(null),U=(et(me.inventory.listItemHistory,R?{clientId:e,itemId:R}:"skip")??[]).map(L=>({...L,id:L._id})),O=()=>{const L=v.trim()===""||!Number.isFinite(Number(v))?void 0:Number(v);d({clientId:e,autoApproveActions:f,maxAutoApproveValue:L})},F=()=>{!b.sku.trim()||!b.name.trim()||(s({clientId:e,sku:b.sku.trim(),name:b.name.trim(),price:Number(b.price)||0,stock:Number(b.stock)||0,category:b.category.trim()||void 0,description:b.description.trim()||void 0,url:b.url.trim()||void 0}),S({sku:"",name:"",price:"",stock:"",category:"",description:"",url:""}))},ne=L=>{j(L.id),E({sku:L.sku,name:L.name,price:String(L.price),stock:String(L.stock),category:L.category??"",description:L.description??"",url:L.url??""})},re=()=>{N&&(l({id:N,patch:{sku:T.sku.trim(),name:T.name.trim(),price:Number(T.price)||0,stock:Number(T.stock)||0,category:T.category.trim()||void 0,description:T.description.trim()||void 0,url:T.url.trim()||void 0}}),j(null))},Q=L=>void h({id:L.id,decision:"accepted"}),W=L=>void h({id:L.id,decision:"rejected"}),q=L=>{P(L.id);const J=L.after??{};M({sku:String(J.sku??""),name:String(J.name??""),price:String(J.price??""),stock:String(J.stock??""),category:String(J.category??""),description:String(J.description??"")})},$=()=>{C&&(h({id:C,decision:"accepted",editedAfter:{sku:A.sku.trim(),name:A.name.trim(),price:Number(A.price)||0,stock:Number(A.stock)||0,category:A.category.trim()||void 0,description:A.description.trim()||void 0}}),P(null))},ge=L=>{const J=L.after??{};return[J.name,J.sku&&`SKU ${J.sku}`,J.price!=null&&`$${J.price}`,J.stock!=null&&`stock ${J.stock}`,J.category].filter(Boolean).join(" · ")},ue=L=>{const J=L.before??{};return[J.name,J.sku&&`SKU ${J.sku}`,J.price!=null&&`$${J.price}`,J.stock!=null&&`stock ${J.stock}`].filter(Boolean).join(" · ")};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:`${rt} p-4 space-y-3 font-sans`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-amber-50 text-amber-700 rounded-xl text-sm",children:"⚙️"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Agent action approval"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Off = every agent inventory action queues here for human review (foolproof). On = actions below the $ threshold auto-apply."})]})]}),a.jsx("button",{onClick:()=>{p(!f)},className:`w-9 h-5 rounded-full p-0.5 transition-colors cursor-pointer shrink-0 ${f?"bg-emerald-600":"bg-slate-200"}`,children:a.jsx("div",{className:`w-4 h-4 rounded-full bg-white transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase",children:"Auto-approve up to $"}),a.jsx("input",{type:"number",value:v,onChange:L=>x(L.target.value),placeholder:"e.g. 100 (blank = all)",disabled:!f,className:"flex-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-[11px] font-mono bg-white outline-none focus:ring-1 focus:ring-indigo-500 disabled:opacity-50"}),a.jsx("button",{onClick:O,className:"bg-indigo-600 hover:bg-indigo-500 text-white font-bold py-1.5 px-3 rounded-lg text-[11px] cursor-pointer",children:"Save"})]})]}),a.jsxs("div",{className:`${rt} p-4 space-y-3 font-sans`,children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl text-sm",children:"📥"}),a.jsxs("div",{children:[a.jsxs("span",{className:"font-bold text-slate-800 block text-[11px]",children:["Agent actions awaiting review (",r.length,")"]}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"What the voice agent queued during calls. Accept to apply to live inventory (versioned); reject to discard."})]})]}),r.length===0&&a.jsx("p",{className:"text-[10px] text-slate-400 py-2",children:"No pending actions. Place a widget call and ask the agent to add/update an item."}),r.map(L=>a.jsxs("div",{className:"border border-slate-200 rounded-xl p-3 space-y-2 bg-slate-50/50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wide text-indigo-600",children:L.type}),a.jsx("span",{className:"text-[9px] text-slate-400",children:new Date(L.createdAt).toLocaleStr
735ing()})]}),L.type==="create"&&a.jsxs("p",{className:"text-[11px] text-slate-700",children:[a.jsx("span",{className:"text-slate-400",children:"add:"})," ",ge(L)]}),L.type==="update"&&a.jsxs("p",{className:"text-[11px] text-slate-700",children:[a.jsx("span",{className:"text-slate-400",children:ue(L)})," → ",a.jsx("span",{className:"text-slate-900 font-semibold",children:ge(L)})]}),L.type==="delete"&&a.jsxs("p",{className:"text-[11px] text-slate-700",children:[a.jsx("span",{className:"text-rose-600",children:"remove:"})," ",ue(L)]}),C===L.id?a.jsxs("div",{className:"space-y-2 border-t border-slate-200 pt-2",children:[a.jsx("div",{className:"grid grid-cols-2 gap-2",children:f4.map(J=>a.jsx("input",{value:A[J],onChange:ye=>M({...A,[J]:ye.target.value}),placeholder:J,className:"border border-slate-200 rounded-lg px-2 py-1 text-[10px] font-mono bg-white outline-none focus:ring-1 focus:ring-indigo-500"},J))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:$,title:"Apply edited action to live inventory",className:"bg-emerald-600 hover:bg-emerald-500 text-white font-bold py-1.5 px-3 rounded-lg text-[10px] cursor-pointer inline-flex items-center gap-1",children:[a.jsx($i,{className:"w-3 h-3"})," Apply"]}),a.jsx("button",{onClick:()=>P(null),className:"bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold py-1.5 px-3 rounded-lg text-[10px] cursor-pointer",children:"Cancel"})]})]}):a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>Q(L),title:"Accept",className:"bg-emerald-600 hover:bg-emerald-500 text-white font-bold py-1.5 px-3 rounded-lg text-[10px] cursor-pointer inline-flex items-center gap-1",children:[a.jsx(Lm,{className:"w-3 h-3"})," Accept"]}),L.type!=="delete"&&a.jsxs("button",{onClick:()=>q(L),title:"Edit then accept",className:"bg-indigo-600 hover:bg-indigo-500 text-white font-bold py-1.5 px-3 rounded-lg text-[10px] cursor-pointer inline-flex items-center gap-1",children:[a.jsx(_k,{className:"w-3 h-3"})," Edit"]}),a.jsxs("button",{onClick:()=>W(L),title:"Reject",className:"bg-rose-100 hover:bg-rose-200 text-rose-700 font-bold py-1.5 px-3 rounded-lg text-[10px] cursor-pointer inline-flex items-center gap-1",children:[a.jsx(fn,{className:"w-3 h-3"})," Reject"]})]})]},L.id))]}),a.jsxs("div",{className:`${rt} p-4 space-y-3 font-sans`,children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-emerald-50 text-emerald-700 rounded-xl text-sm",children:"📦"}),a.jsxs("div",{children:[a.jsxs("span",{className:"font-bold text-slate-800 block text-[11px]",children:["Live inventory (",i.length,")"]}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"The approved store catalog the agent sees. Each change is versioned."})]})]}),a.jsxs("div",{className:"grid grid-cols-6 gap-2 bg-slate-50/60 rounded-xl p-2",children:[f4.map(L=>a.jsx("input",{value:b[L],onChange:J=>S({...b,[L]:J.target.value}),placeholder:L,className:"border border-slate-200 rounded-lg px-2 py-1.5 text-[10px] font-mono bg-white outline-none focus:ring-1 focus:ring-indigo-500"},L)),a.jsx("input",{value:b.url,onChange:L=>S({...b,url:L.target.value}),placeholder:"product page URL (https://...)",className:"col-span-6 border border-slate-200 rounded-lg px-2 py-1.5 text-[10px] font-mono bg-white outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsxs("button",{onClick:F,className:"col-span-6 bg-indigo-600 hover:bg-indigo-500 text-white font-bold py-1.5 rounded-lg text-[10px] cursor-pointer inline-flex items-center justify-center gap-1",children:[a.jsx(cr,{className:"w-3 h-3"})," Add item"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[10px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-slate-400 border-b border-slate-100",children:[a.jsx("th",{className:"py-1.5 pr-2 font-semibold",children:"SKU"}),a.jsx("th",{className:"py-1.5 pr-2 font-semibold",children:"Name"}),a.jsx("th",{className:"py-1.5 pr-2 font-semibold",children:"Price"}),a.jsx("th",{className:"py-1.5 pr-2 font-semibold",children:"Stock"}),a.jsx("th",{className:"py-1.5 pr-2 font-semibold",children:"Cat."}),a.jsx("th",{className:"py-1.5 pr-2 font-semibold",children:"Ver"}),a.jsx("th",{className:"py-1.5 font-semibold",children:"Actions"})]})}),a.jsxs("tbody",{children:[i.map(L=>a.jsxs(w.Fragment,{children:[a.jsx("tr",{className:"border-b border-slate-50",children:N===L.id?a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"py-1.5 pr-2",children:a.jsx("input",{value:T.sku,onChange:J=>E({...T,sku:J.target.value}),className:"w-full border border-slate-200 rounded px-1 py-0.5 font-mono bg-white"})}),a.jsx("td",{className:"py-1.5 pr-2",children:a.jsx("input",{value:T.name,onChange:J=>E({...T,name:J.target.value}),className:"w-full border border-slate-200 rounded px-1 py-0.5 bg-white"})}),a.jsx("td",{className:"py-1.5 pr-2",children:a.jsx("input",{value:T.price,onChange:J=>E({...T,price:J.target.value}),className:"w-16 border border-slate-200 rounded px-1 py-0.5 font-mono bg-white"})}),a.jsx("td",{className:"py-1.5 pr-2",children:a.jsx("input",{value:T.stock,onChange:J=>E({...T,stock:J.target.value}),className:"w-14 border border-slate-200 rounded px-1 py-0.5 font-mono bg-white"})}),a.jsx("td",{className:"py-1.5 pr-2",children:a.jsx("input",{value:T.category,onChange:J=>E({...T,category:J.target.value}),className:"w-full border border-slate-200 rounded px-1 py-0.5 bg-white"})}),a.jsx("td",{className:"py-1.5 pr-2 text-slate-400",children:L.version}),a.jsxs("td",{className:"py-1.5 space-x-1.5 whitespace-nowrap",children:[a.jsx("button",{onClick:re,title:"Save",className:"text-emerald-600 hover:underline font-bold cursor-pointer inline-flex items-center",children:a.jsx($i,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>j(null),title:"Cancel",className:"text-slate-400 hover:underline cursor-pointer inline-flex items-center",children:a.jsx(fn,{className:"w-3.5 h-3.5"})})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"py-1.5 pr-2 font-mono text-slate-700",children:L.sku}),a.jsxs("td",{className:"py-1.5 pr-2 text-slate-800",children:[L.name,L.url&&a.jsx("span",{title:L.url,children:" 🔗"})]}),a.jsxs("td",{className:"py-1.5 pr-2 font-mono text-slate-700",children:["$",L.price]}),a.jsx("td",{className:"py-1.5 pr-2 font-mono text-slate-700",children:L.stock}),a.jsx("td",{className:"py-1.5 pr-2 text-slate-500",children:L.category||"—"}),a.jsxs("td",{className:"py-1.5 pr-2 text-slate-400",children:["v",L.version]}),a.jsxs("td",{className:"py-1.5 space-x-1.5 whitespace-nowrap",children:[a.jsx("button",{onClick:()=>ne(L),title:"Edit",className:"text-indigo-600 hover:underline font-bold cursor-pointer inline-flex items-center",children:a.jsx(_k,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>B(R===L.id?null:L.id),title:"Version history",className:"text-slate-500 hover:underline cursor-pointer inline-flex items-center",children:a.jsx(_Q,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>{confirm(`Delete ${L.name}? This is logged.`)&&c({id:L.id})},title:"Delete",className:"text-rose-600 hover:underline font-bold cursor-pointer inline-flex items-center",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]})]})}),N===L.id&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"py-1.5 pr-2 bg-slate-50/60",children:a.jsx("input",{value:T.url,onChange:J=>E({...T,url:J.target.value}),placeholder:"product page URL (https://...)",className:"w-full border border-slate-200 rounded px-1 py-0.5 font-mono bg-white text-[10px]"})})}),R===L.id&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"py-2 pl-3 bg-slate-50/70",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("p",{className:"text-[9px] font-bold text-slate-500 uppercase",children:["Version history (",U.length,")"]}),U.length===0&&a.jsx("p",{className:"text-[9px] text-slate-400",children:"No recorded actions."}),U.map(J=>a.jsxs("div",{className:"text-[9px] text-slate-600 flex gap-2",children:[a.jsx("span",{className:"text-slate-400 w-32",children:new Date(J.createdAt).toLocaleStr
735ing()}),a.jsx("span",{className:"font-bold uppercase text-indigo-600 w-14",children:J.type}),a.jsxs("span",{className:"text-slate-500",children:["by ",J.actor,J.appliedBy?` (${J.appliedBy})`:""]}),a.jsx("span",{className:"text-slate-700",children:J.status})]},J.id))]})})})]},L.id)),i.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"py-3 text-[10px] text-slate-400 text-center",children:"No inventory yet — add an item above."})})]})]})})]})]})}const yCe=[["getProduct","Get product (live read)"],["getOrder","Get order (live read)"],["updateStock","Update stock (restock)"],["createOrder","Create order"],["refund","Issue refund"],["createProduct","Create product"],["deleteProduct","Delete product"]],bCe=["GET","POST","PUT","PATCH","DELETE"],m4={getProduct:{method:"GET",path:"/products/{sku}.json"},getOrder:{method:"GET",path:"/orders/{orderId}.json"},updateStock:{method:"PUT",path:"/products/{sku}.json"},createOrder:{method:"POST",path:"/orders.json"},refund:{method:"POST",path:"/orders/{orderId}/refunds.json"},createProduct:{method:"POST",path:"/products.json"},deleteProduct:{method:"DELETE",path:"/products/{sku}.json"}},wCe=[["inventory_create","Create product"],["inventory_update","Update stock / restock"],["inventory_delete","Delete product"],["merchant_issue_refund","Issue refund"],["merchant_create_order","Create order"]],SCe=[["createOrder","Create order"],["updateStock","Update stock / restock"],["refund","Issue refund"],["createProduct","Create product"]],kCe="••••••";function Bz({clientId:e}){const t=et(me.integrationHelpers.getMerchantIntegrationForUI,{clientId:e}),n=We(me.integrationHelpers.setMerchantIntegration),i=We(me.integrationHelpers.setWriteGovernance),[r,s]=w.useState(!1),[l,c]=w.useState(""),[h,d]=w.useState("bearer"),[f,p]=w.useState(""),[v,x]=w.useState(""),[b,S]=w.useState(""),[N,j]=w.useState(!1),[T,E]=w.useState(m4),[C,P]=w.useState({productPath:"",orderPath:"",skuField:"",idField:"",stockField:"",priceField:"",nameField:"",orderIdField:"",productEnvelope:"",orderEnvelope:"",productList:!1,orderList:!1,productUrlTemplate:"",trustProductUrls:!1}),[A,M]=w.useState({}),[R,B]=w.useState(!1),[U,O]=w.useState(!1),[F,ne]=w.useState("human"),[re,Q]=w.useState(""),[W,q]=w.useState([]),[$,ge]=w.useState(!1),[ue,L]=w.useState(!1),[J,ye]=w.useState(null);w.useEffect(()=>{var le,Be,De,be,nt,ze,Le,ht,yt,on,bt,Vt,tn,Qt;if(!t)return;s(!!t.enabled),c(t.baseUrl||""),d(t.authType||"bearer"),p(t.headerName||""),x(t.username||""),S(t.apiTokenMasked||""),j(!1),E({...m4,...t.endpoints||{}}),P({productPath:((le=t.mapping)==null?void 0:le.productPath)||"",orderPath:((Be=t.mapping)==null?void 0:Be.orderPath)||"",skuField:((De=t.mapping)==null?void 0:De.skuField)||"",idField:((be=t.mapping)==null?void 0:be.idField)||"",stockField:((nt=t.mapping)==null?void 0:nt.stockField)||"",priceField:((ze=t.mapping)==null?void 0:ze.priceField)||"",nameField:((Le=t.mapping)==null?void 0:Le.nameField)||"",orderIdField:((ht=t.mapping)==null?void 0:ht.orderIdField)||"",productEnvelope:((yt=t.mapping)==null?void 0:yt.productEnvelope)||"",orderEnvelope:((on=t.mapping)==null?void 0:on.orderEnvelope)||"",productList:!!((bt=t.mapping)!=null&&bt.productList),orderList:!!((Vt=t.mapping)!=null&&Vt.orderList),productUrlTemplate:((tn=t.mapping)==null?void 0:tn.productUrlTemplate)||"",trustProductUrls:!!((Qt=t.mapping)!=null&&Qt.trustProductUrls)}),M(t.templates||{});const ve=t.writeGovernance;ne((ve==null?void 0:ve.mode)||"human"),Q((ve==null?void 0:ve.maxAutoValue)!=null?String(ve.maxAutoValue):""),q((ve==null?void 0:ve.autoTools)||[]),ge(!1)},[t]);const Pe=ve=>{ye(ve),setTimeout(()=>ye(null),3500)},Oe=ve=>{S(ve),j(!0)},je=ve=>q(le=>le.includes(ve)?le.filter(Be=>Be!==ve):[...le,ve]),Ke=async()=>{if(F==="all"&&!$){Pe("Confirm the auto-all risk checkbox before saving.");return}L(!0);try{const ve=N?b:"";await n({clientId:e,enabled:r,baseUrl:l.trim(),apiToken:ve,authType:h,headerName:f.trim()||void 0,username:v.trim()||void 0,endpoints:T,mapping:C.productPath||C.orderPath||C.skuField||C.idField||C.stockField||C.priceField||C.nameField||C.orderIdField||C.productEnvelope||C.orderEnvelope||C.productList||C.orderList||C.productUrlTemplate||C.trustProductUrls?C:void 0,templates:Object.keys(A).length?A:void 0}),await i({clientId:e,mode:F,maxAutoValue:re.trim()===""||!Number.isFinite(Number(re))?void 0:Number(re),autoTools:F==="selectedTools"?W:void 0}),Pe("Merchant integration + write governance saved."),j(!1)}
735catch(ve){Pe((ve==null?void 0:ve.message)||"Save failed.")}finally{L(!1)}};return t===void 0?a.jsx("div",{className:"text-xs text-slate-400 p-6",children:"Loading merchant integration…"}):a.jsxs("div",{className:"space-y-5 text-slate-700",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded-lg",children:a.jsx(Sa,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-slate-900 font-display text-sm",children:"Merchant REST Adapter"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Connect the voice agent to the real store (read products, write orders & refunds)."})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-xs font-semibold cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:r,onChange:ve=>s(ve.target.checked),className:"accent-indigo-600"}),"Enabled"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Base URL"}),a.jsx("input",{value:l,onChange:ve=>c(ve.target.value),placeholder:"https://your-store.myshopify.com/admin/api/2024-10",className:"w-full mt-1 border border-slate-200 rounded-lg px-3 py-2 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Auth Type"}),a.jsxs("select",{value:h,onChange:ve=>d(ve.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-3 py-2 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"bearer",children:"Bearer token"}),a.jsx("option",{value:"header",children:"Custom header"}),a.jsx("option",{value:"basic",children:"Basic (user + pass)"}),a.jsx("option",{value:"query",children:"Query param (?api_key=)"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"API Token / Password"}),a.jsxs("div",{className:"flex gap-2 mt-1",children:[a.jsx("input",{type:"password",value:b,onChange:ve=>Oe(ve.target.value),placeholder:t.hasApiToken?kCe:"paste token",className:"flex-1 border border-slate-200 rounded-lg px-3 py-2 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"}),t.hasApiToken&&!N&&a.jsx("button",{onClick:()=>{S(""),j(!0)},className:"text-[10px] font-bold text-indigo-600 border border-indigo-200 rounded-lg px-2 hover:bg-indigo-50 cursor-pointer",children:"Replace"})]})]}),h==="header"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Header Name"}),a.jsx("input",{value:f,onChange:ve=>p(ve.target.value),placeholder:"X-API-Key",className:"w-full mt-1 border border-slate-200 rounded-lg px-3 py-2 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),h==="basic"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Username"}),a.jsx("input",{value:v,onChange:ve=>x(ve.target.value),placeholder:"service-user",className:"w-full mt-1 border border-slate-200 rounded-lg px-3 py-2 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),a.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[a.jsx("div",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Endpoint Templates"}),a.jsxs("p",{className:"text-[10px] text-slate-400 -mt-1",children:["Path placeholders: ",a.jsx("code",{className:"font-mono",children:"{sku}"}),", ",a.jsx("code",{className:"font-mono",children:"{orderId}"}),", ",a.jsx("code",{className:"font-mono",children:"{merchantId}"}),", ",a.jsx("code",{className:"font-mono",children:"{itemId}"}),". Defaults are Shopify-Admin-REST shaped."]}),yCe.map(([ve,le])=>{var Be,De;return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-44 text-[11px] text-slate-600 shrink-0",children:le}),a.jsx("select",{value:((Be=T[ve])==null?void 0:Be.method)||"GET",onChange:be=>E(nt=>({...nt,[ve]:{...nt[ve]||{path:""},method:be.target.value}})),className:"border border-slate-200 rounded-lg px-2 py-1 text-[10px] font-mono bg-white focus:outline-none focus:ring-1 focus:ring-indigo-500",children:bCe.map(be=>a.jsx("option",{value:be,children:be},be))}),a.jsx("input",{value:((De=T[ve])==null?void 0:De.path)||"",onChange:be=>E(nt=>({...nt,[ve]:{...nt[ve]||{method:"GET"},path:be.target.value}})),className:"flex-1 border border-slate-200 rounded-lg px-2 py-1 text-[11px] font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]},ve)}),a.jsxs("button",{onClick:()=>B(ve=>!ve),className:"text-[10px] font-bold text-slate-500 hover:text-indigo-600 cursor-pointer",children:[R?"▾":"▸"," Advanced field mapping"]}),R&&a.jsxs("div",{className:"space-y-2 pl-3",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[a.jsx(F
735a,{label:"Product envelope (write body, e.g. product)",value:C.productPath,onChange:ve=>P(le=>({...le,productPath:ve}))}),a.jsx(Fa,{label:"Order envelope (write body, e.g. order)",value:C.orderPath,onChange:ve=>P(le=>({...le,orderPath:ve}))}),a.jsx(Fa,{label:"SKU field (read)",value:C.skuField,onChange:ve=>P(le=>({...le,skuField:ve}))}),a.jsx(Fa,{label:"Merchant id field (read, e.g. _id)",value:C.idField,onChange:ve=>P(le=>({...le,idField:ve}))}),a.jsx(Fa,{label:"Stock field (read, e.g. qty)",value:C.stockField,onChange:ve=>P(le=>({...le,stockField:ve}))}),a.jsx(Fa,{label:"Price field (read)",value:C.priceField,onChange:ve=>P(le=>({...le,priceField:ve}))}),a.jsx(Fa,{label:"Name field (read)",value:C.nameField,onChange:ve=>P(le=>({...le,nameField:ve}))}),a.jsx(Fa,{label:"Order-id field (read, e.g. orderId)",value:C.orderIdField,onChange:ve=>P(le=>({...le,orderIdField:ve}))}),a.jsx(Fa,{label:"Read response envelope (e.g. order)",value:C.orderEnvelope,onChange:ve=>P(le=>({...le,orderEnvelope:ve}))}),a.jsx(Fa,{label:"Product read envelope (rare)",value:C.productEnvelope,onChange:ve=>P(le=>({...le,productEnvelope:ve}))})]}),a.jsxs("div",{className:"pt-1",children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Storefront product URL template"}),a.jsx("input",{value:C.productUrlTemplate,onChange:ve=>P(le=>({...le,productUrlTemplate:ve.target.value})),placeholder:"https://yourstore.com/product/{slug}  — {slug} = name slug for the URL, product id for the id-form fallback",className:"w-full mt-1 border border-slate-200 rounded-lg px-3 py-2 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsxs("p",{className:"text-[10px] text-slate-400 mt-1",children:["Generates shareable product-page links when the API doesn't return a URL. ",a.jsx("code",{className:"font-mono",children:"{slug}"})," is filled with the slugified product name (primary) and the product id (fallback). Leave blank to disable links."]}),a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-slate-600 cursor-pointer mt-2",children:[a.jsx("input",{type:"checkbox",checked:C.trustProductUrls,onChange:ve=>P(le=>({...le,trustProductUrls:ve.target.checked})),className:"accent-indigo-600"}),"Storefront is auth-gated / client-rendered SPA — trust the template & use the id-form URL (skip page content validation)"]}),a.jsx("p",{className:"text-[10px] text-slate-400 mt-1",children:"Check this for stores whose product pages don't server-render the product name (login-walled or React/Vue SPAs). Otherwise the agent blanks every link because it can't confirm the page shows the product."})]}),a.jsxs("div",{className:"flex flex-wrap gap-4 pt-1",children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-slate-600 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:C.productList,onChange:ve=>P(le=>({...le,productList:ve.target.checked})),className:"accent-indigo-600"}),"GET product returns a LIST (filter by SKU)"]}),a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-slate-600 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:C.orderList,onChange:ve=>P(le=>({...le,orderList:ve.target.checked})),className:"accent-indigo-600"}),"GET order returns a LIST (filter by order id)"]})]}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Setting any field opts into shape-normalization for reads (defaults: sku/stock/price/name/id/orderId). Leave blank for legacy Shopify behavior."})]}),a.jsxs("button",{onClick:()=>O(ve=>!ve),className:"text-[10px] font-bold text-slate-500 hover:text-indigo-600 cursor-pointer block mt-1",children:[U?"▾":"▸"," Write payload templates (JSON with ","{{placeholders}}",")"]}),U&&a.jsxs("div",{className:"space-y-2 pl-3",children:[a.jsxs("p",{className:"text-[10px] text-slate-400",children:["Per-write-endpoint JSON body. Bare ",a.jsx("code",{className:"font-mono",children:"{{key}}"})," placeholders are filled from the action snapshot (JSON-encoded). Available: ",a.jsx("code",{className:"font-mono",children:"{{customerName}} {{email}} {{phone}} {{sku}} {{quantity}} {{name}} {{price}} {{total}} {{merchantId}} {{generatedOrderId}} {{reason}} {{amount}} {{stock}}"}),". Empty → leave blank for the default raw-body behavior."]}),SCe.map(([ve,le])=>a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-[11px] text-slate-600",children:le}),a.jsx("textarea",{value:A[ve]||"",onChange:Be=>M(De=>({...De,[ve]:Be.target.value})),rows:4,placeholder:`e.g. {
736  "qty": {{stock}}
737}`,className:"w-full border border-slate-200 rounded-lg px-2 py-1 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]},ve))]})]}),a.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-3",children:[a.jsx("div",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Write Governance"}),a.jsx("p",{className:"text-[10px] text-slate-400 -mt-2",children:"How aggressively the agent's writes apply to the REAL store. Human-gated = the store manager reviews each action before it hits the store."}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["human","Human-gated (review each)"],["threshold","Auto under a $ cap"],["selectedTools","Auto for selected tools"],["all","Auto-apply all"]].map(([ve,le])=>a.jsxs("label",{className:`flex items-center gap-2 border rounded-lg px-3 py-2 text-xs cursor-pointer ${F===ve?"border-indigo-300 bg-indigo-50/50":"border-slate-200"}`,children:[a.jsx("input",{type:"radio",name:"govmode",checked:F===ve,onChange:()=>ne(ve),className:"accent-indigo-600"}),le]},ve))}),F==="threshold"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Max auto value ($)"}),a.jsx("input",{value:re,onChange:ve=>Q(ve.target.value),placeholder:"100",type:"number",className:"w-40 mt-1 border border-slate-200 rounded-lg px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsx("p",{className:"text-[10px] text-slate-400 mt-1",children:"Actions whose estimated value (price × stock) is at or below this auto-apply. Refunds/orders are never auto-applied in this mode."})]}),F==="selectedTools"&&a.jsx("div",{className:"flex flex-wrap gap-2",children:wCe.map(([ve,le])=>a.jsxs("label",{className:`flex items-center gap-1.5 border rounded-lg px-2.5 py-1.5 text-[11px] cursor-pointer ${W.includes(ve)?"border-indigo-300 bg-indigo-50/50":"border-slate-200"}`,children:[a.jsx("input",{type:"checkbox",checked:W.includes(ve),onChange:()=>je(ve),className:"accent-indigo-600"}),le]},ve))}),F==="all"&&a.jsxs("label",{className:"flex items-start gap-2 text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded-lg px-3 py-2",children:[a.jsx(Jd,{className:"w-4 h-4 shrink-0 mt-0.5"}),a.jsxs("span",{children:[a.jsx("input",{type:"checkbox",checked:$,onChange:ve=>ge(ve.target.checked),className:"accent-rose-600 mr-1.5 align-middle"}),"I understand ",a.jsx("b",{children:"every"})," agent write (restock, refund, order, price change) will apply to the real store with no review. A misheard SKU could charge or restock the wrong item."]})]})]}),a.jsxs("div",{className:"flex items-center justify-between border-t border-slate-100 pt-3",children:[a.jsx("span",{className:"text-[10px] text-slate-400",children:J??(t.hasApiToken?"Token on file (masked).":"No token set yet.")}),a.jsxs("button",{onClick:Ke,disabled:ue,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-indigo-300 text-white font-semibold text-xs px-4 py-2 rounded-lg flex items-center gap-1.5 cursor-pointer",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," ",ue?"Saving…":"Save Integration"]})]})]})}function Fa({label:e,value:t,onChange:n}){return a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase",children:e}),a.jsx("input",{value:t,onChange:i=>n(i.target.value),placeholder:"(default)",className:"w-full mt-0.5 border border-slate-200 rounded-lg px-2 py-1 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})}const NCe={draft:"bg-slate-100 text-slate-600 border-slate-200",active:"bg-emerald-50 text-emerald-700 border-emerald-200",paused:"bg-amber-50 text-amber-700 border-amber-200"},dk={name:"",status:"draft",greeting:"",personaPrompt:"",realtimeProvider:"",realtimeVoice:"",language:"",realtimeModel:"",maxConcurrentCalls:"",maxCallDurationSec:""};function jCe({clientId:e}){const t=et(me.voiceAgents.listVas,{clientId:e}
737)??[],n=We(me.voiceAgents.createVa),i=We(me.voiceAgents.updateVa),r=We(me.voiceAgents.cloneVa),s=We(me.voiceAgents.deleteVa),l=We(me.voiceAgents.setDefaultVa),[c,h]=w.useState(!1),[d,f]=w.useState(null),[p,v]=w.useState(null),[x,b]=w.useState({...dk}),[S,N]=w.useState(null),[j,T]=w.useState(!1),E=()=>{h(!1),f(null),v(null),b({...dk}),N(null)},C=()=>{f(null),v(null),b({...dk}),N(null),h(!0)},P=O=>{const F=O.voicePipelineConfig??{};f(O._id),v(O.version),b({name:O.name??"",status:O.status??"draft",greeting:O.greeting??"",personaPrompt:O.personaPrompt??"",realtimeProvider:F.realtimeProvider??"",realtimeVoice:F.realtimeVoice??"",language:F.language??"",realtimeModel:F.realtimeModel??"",maxConcurrentCalls:O.maxConcurrentCalls!=null?String(O.maxConcurrentCalls):"",maxCallDurationSec:F.maxCallDurationSec!=null?String(F.maxCallDurationSec):""}),N(null),h(!0)},A=()=>{const O={};x.realtimeProvider.trim()&&(O.realtimeProvider=x.realtimeProvider.trim()),x.realtimeVoice.trim()&&(O.realtimeVoice=x.realtimeVoice.trim()),x.language.trim()&&(O.language=x.language.trim()),x.realtimeModel.trim()&&(O.realtimeModel=x.realtimeModel.trim()),x.maxCallDurationSec.trim()!==""&&Number.isFinite(Number(x.maxCallDurationSec))&&(O.maxCallDurationSec=Math.max(1,Math.floor(Number(x.maxCallDurationSec))));const F=x.maxConcurrentCalls.trim()===""||!Number.isFinite(Number(x.maxConcurrentCalls))?void 0:Math.max(1,Math.floor(Number(x.maxConcurrentCalls)));return{name:x.name.trim()||"Untitled agent",status:x.status,greeting:x.greeting.trim()||void 0,personaPrompt:x.personaPrompt.trim()||void 0,voicePipelineConfig:Object.keys(O).length?O:void 0,maxConcurrentCalls:F}},M=async()=>{N(null),T(!0);try{const O=A();d&&p!==null?await i({id:d,version:p,patch:O}):await n({clientId:e,...O}),E()}catch(O){N((O==null?void 0:O.message)||String(O))}finally{T(!1)}},R=async O=>{N(null);try{await r({id:O._id})}catch(F){N((F==null?void 0:F.message)||String(F))}},B=async O=>{if(N(null),!!confirm(`Delete voice agent "${O.name}"? This cannot be undone.`))try{await s({id:O._id})}catch(F){N((F==null?void 0:F.message)||String(F))}},U=async O=>{N(null);try{await l({id:O._id})}catch(F){N((F==null?void 0:F.message)||String(F))}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Voice Agents"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"First-class per-client voice agents. Each VA has its own greeting, persona, voice, and concurrency quota. One VA per client is the default routing target."})]}),!c&&a.jsxs("button",{onClick:C,className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-[11px] px-3 py-2 rounded-lg flex items-center gap-1.5 transition-all shadow-sm cursor-pointer",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," New VA"]})]}),S&&a.jsxs("div",{className:"text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded-lg px-3 py-2 flex items-start gap-2",children:[a.jsx(xa,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),a.jsx("span",{children:S})]}),t.length===0&&!c?a.jsxs("div",{className:"border border-dashed border-slate-200 rounded-2xl p-6 text-center text-xs text-slate-400 bg-slate-50/30",children:["No voice agents yet. Click ",a.jsx("b",{children:"New VA"})," to create one. A client's first VA becomes the default routing target automatically."]}):a.jsx("div",{className:"space-y-2.5",children:t.map(O=>a.jsxs("div",{className:`bg-white border rounded-xl p-3.5 shadow-sm ${O.status==="paused"?"border-amber-200":"border-slate-100"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(ny,{className:"w-3.5 h-3.5 text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-bold text-slate-800 text-xs truncate",children:O.name}),a.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded border ${NCe[O.status]}`,children:O.status}),O.isDefault&&a.jsxs("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded bg-indigo-600 text-white flex items-center gap-1",children:[a.jsx(Um,{className:"w-2.5 h-2.5 fill-current"})," Default"]})]}),(O.greeting||O.personaPrompt)&&a.jsxs("div",{className:"mt-1 text-[10px] text-slate-500",children:[O.greeting?a.jsxs("span",{children:["“",O.greeting,"”"]}):null,O.personaPrompt?a.jsx("span",{className:"block italic text-slate-400 line-clamp-2",children:O.personaPrompt}):null]}),a.jsx("div",{className:"mt-1.5",children:a.jsx(CCe,{vaId:O._id,maxConcurrentCalls:O.maxConcurrentCalls,status:O.status})})]}),!(c&&d===O._id)&&a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("button",{onClick:()=>P(O),title:"Edit",className:"p-1.5 hover:bg-slate-100 text-slate-600 hover:text-slate-900 rounded-lg transition-colors cursor-pointer",children:a.jsx(su,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>R(O),title:"Clone",className:"p-1.5 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-lg transition-colors cursor-pointer border border-slate-200",children:a.jsx(bv,{className:"w-3.5 h-3.5"})}),!O.isDefault&&a.jsx("button",{onClick:()=>U(O),title:"Set as default",className:"p-1.5 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 rounded-lg transition-colors cursor-pointer border border-indigo-100",children:a.jsx(Um,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>B(O),title:O.isDefault?"Reassign default before deleting":"Delete",disabled:O.isDefault,className:"p-1.5 hover:bg-rose-50 text-rose-600 rounded-lg transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]})]}),c&&d===O._id&&a.jsx("div",{className:"mt-3 pt-3 border-t border-slate-100",children:a.jsx(p4,{form:x,setForm:b,editing:!0,busy:j,onCancel:E,onSave:M})})]},O._id))}),c&&d===null&&a.jsxs("div",{className:"bg-slate-50 border border-indigo-100 rounded-xl p-3.5",children:[a.jsx("div",{className:"text-[10px] font-bold text-indigo-700 uppercase tracking-wider mb-2",children:"New Voice Agent"}),a.jsx(p4,{form:x,setForm:b,editing:!1,busy:j,onCancel:E,onSave:M})]})]})}function CCe({vaId:e,maxConcurrentCalls:t,status:n}){const i=et(me.voiceAgents.getVaEffectiveConfig,{vaId:e});if(i===void 0)return a.jsx("span",{className:"text-[9px] text-slate-400",children:"quota …"});const r=i.activeCount??0,s=i.quota??"?",l=i.ceiling??"?",c=t!=null?` (override ${t})`:"",h=typeof s=="number"&&r>=s;return a.jsxs("span",{className:`text-[9px] font-semibold px-1.5 py-0.5 rounded border ${h?"bg-amber-50 text-amber-700 border-amber-200":"bg-slate-50 text-slate-600 border-slate-200"}`,title:`Effective quota = VA override ?? ceiling. Ceiling ${l}. Active calls right now.`,children:[n==="active"?`${r}/${s} active`:"inactive"," · ceiling ",l,c]})}function p4({form:e,setForm:t,editing:n,busy:i,onCancel:r,onSave:s}){const l="w-full border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-600",c="text-[9px] font-bold text-slate-500 uppercase tracking-wider";return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Name"}),a.jsx("input",{className:l+" mt-1",value:e.name,onChange:h=>t(d=>({...d,name:h.target.value})),placeholder:"e.g. Sales Advisor"})]}),a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Status"}),a.jsxs("select",{className:l+" mt-1 cursor-pointer",value:e.status,onChange:h=>t(d=>({...d,status:h.target.value})),children:[a.jsx("option",{value:"draft",children:"Draft (not routable)"}),a.jsx("option",{value:"active",children:"Active"}),a.jsx("option",{value:"paused",children:"Paused"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Greeting (spoken to open the call)"}),a.jsx("textarea",{className:l+" mt-1 resize-y",rows:2,value:e.greeting,onChange:h=>t(d=>({...d,greeting:h.target.value})),placeholder:"Hello! Thanks for calling. How can I help you today?"})]}),a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Persona / character prompt (optional)"}),a.jsx("textarea",{className:l+" mt-1 resize-y",rows:2,value:e.personaPrompt,onChange:h=>t(d=>({...d,personaPrompt:h.target.value})),placeholder:"e.g. You are Ayesha, a warm, concise sales advisor who saves the sale."}),a.jsx("p",{className:"text-[9px] text-slate-400 mt-1",children:"Overrides the client-level persona. The selected voice's gender directive is always applied on top."})]}),a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Voice"}),a.jsx("div",{className:"mt-1",children:a.jsx(bb,{provider:e.realtimeProvider||"gemini",voice:e.realtimeVoice,language:e.language,onChange:h=>t(d=>({...d,realtimeProvider:h.realtimeProvider??d.realtimeProvider,realtimeVoice:h.realtimeVoice??d.realtimeVoice,language:h.language??d.language}))})})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2.5",children:[a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Realtime model (optional)"}),a.jsx("input",{className:l+" mt-1",value:e.realtimeModel,onChange:h=>t(d=>({...d,realtimeModel:h.target.value})),placeholder:"e.g. gemini-2.5-flash-native-audio-preview-12-2025"})]}),a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Max concurrent calls (optional)"}
737),a.jsx("input",{type:"number",min:1,className:l+" mt-1",value:e.maxConcurrentCalls,onChange:h=>t(d=>({...d,maxConcurrentCalls:h.target.value})),placeholder:"default = ceiling"}),a.jsx("p",{className:"text-[9px] text-slate-400 mt-1",children:"Admins may lower this below the ceiling; superadmin may raise it. Blank = use the ceiling."})]}),a.jsxs("div",{children:[a.jsx("label",{className:c,children:"Max call duration (sec)"}),a.jsx("input",{type:"number",min:1,className:l+" mt-1",value:e.maxCallDurationSec,onChange:h=>t(d=>({...d,maxCallDurationSec:h.target.value})),placeholder:"default 180 (3 min)"}),a.jsx("p",{className:"text-[9px] text-slate-400 mt-1",children:"Call auto-disconnects after this. Blank = 3 min."})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsxs("button",{onClick:s,disabled:i,className:"bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-semibold text-[11px] px-3 py-1.5 rounded-lg flex items-center gap-1.5 transition-all shadow-sm cursor-pointer",children:[a.jsx($i,{className:"w-3.5 h-3.5"})," ",n?"Save changes":"Create VA"]}),a.jsxs("button",{onClick:r,className:"text-[11px] font-semibold text-slate-500 hover:text-slate-800 px-3 py-1.5 rounded-lg flex items-center gap-1.5 transition-colors cursor-pointer",children:[a.jsx(fn,{className:"w-3.5 h-3.5"})," Cancel"]}),i&&a.jsx("span",{className:"text-[10px] text-slate-400",children:"Saving…"})]})]})}const Aj=[{id:"",label:"Shared — all voice agents"},{id:"channel-web",label:"Web Widget agent"},{id:"channel-phone",label:"Inbound Phone agent"},{id:"channel-outbound",label:"Outbound Dialer agent"}],TCe=Object.fromEntries(Aj.map(e=>[e.id,e.label]));function ECe({agency:e,clients:t,workflows:n,logs:i,kbItems:r,onAddClient:s,onUpdateClient:l,onDeleteClient:c,onAddKbItem:h,onDeleteKbItem:d,onLogout:f,onOpenPaywall:p,onUpdateLead:v}){var G;const[x,b]=w.useState("overview"),[S,N]=w.useState(null),[j,T]=w.useState(null),[E,C]=w.useState(null),[P,A]=w.useState(null),M=We(me.mutations.cloneClient),[R,B]=w.useState(null),[U,O]=w.useState(""),[F,ne]=w.useState(null),[re,Q]=w.useState(!1),[W,q]=w.useState(null),[$,ge]=w.useState(null),L=(et(me.queries.listKbItems,j?{clientId:j.id}:"skip")??[]).map(V=>({...V,id:V._id})),[J,ye]=w.useState(void 0),[Pe,Oe]=w.useState(void 0),je=Hx(me.queries.listLeads,j?{clientId:j.id,channel:J,source:Pe}:"skip",{initialNumItems:50}),Ke=(je==null?void 0:je.results)??[],ve=et(me.queries.effectiveVoicePipeline,j?{clientId:j.id}:"skip"),le=(G=ve==null?void 0:ve.config)==null?void 0:G.realtimeProvider,Be=et(me.billing.agencyCallMetrics,{agencyId:e.id,days:28}),[De,be]=w.useState("kb"),nt=et(me.voiceAgents.listVas,j?{clientId:j.id}:"skip"),[ze,Le]=w.useState("");w.useEffect(()=>{var V;ze&&(nt??[]).some(ie=>ie._id===ze)||Le(((V=(nt??[])[0])==null?void 0:V._id)??"")},[nt,ze]);const ht=et(me.googleOAuth.getGoogleConnection,j?{clientId:j.id}:"skip"),yt=et(me.googleOAuth.listSyncLog,j?{clientId:j.id}:"skip"),[on,bt]=w.useState(""),[Vt,tn]=w.useState(""),[Qt,Cn]=w.useState(""),[pt,kn]=w.useState(!1),[Lt,On]=w.useState(null),[zt,si]=w.useState(null),[qn,qt]=w.useState(""),[ai,Zn]=w.useState("HubSpot"),[ct,ln]=w.useState(""),[Ut,Wn]=w.useState(""),[_i,nn]=w.useState("+1 (800) 555-0199"),[Bt,Dt]=w.useState({spreadsheetId:"",sheetName:"Bookings",clientEmail:"",privateKey:"",isEnabled:!1}),[K,Ze]=w.useState(!1),[Ft,jt]=w.useState(""),[oi,Gi]=w.useState(""),[fr,Yi]=w.useState(""),[In,Mi]=w.useState({realtimeProvider:"",realtimeModel:"",realtimeVoice:"",language:"",personaPrompt:"",sttProvider:"",sttEndpoint:"",llmProvider:"",llmEndpoint:"",llmModel:"",ttsProvider:"",ttsEndpoint:"",ttsVoice:"",maxCallDurationSec:""});w.useEffect(()=>{if(!j)return;const V=j.sheetsConfig;Dt({spreadsheetId:(V==null?void 0:V.spreadsheetId)||"",sheetName:(V==null?void 0:V.sheetName)||"Bookings",clientEmail:(V==null?void 0:V.clientEmail)||"",privateKey:(V==null?void 0:V.privateKey)||"",isEnabled:(V==null?void 0:V.isEnabled)??!1}),Ze(j.leadsSheetAttached??!1),jt(j.retentionDaysOverride!=null?String(j.retentionDaysOverride):""),Gi(j.voicePipeline??""),Yi(j.timezone??"");const ie=j.voicePipelineConfig??{};Mi({realtimeProvider:ie.realtimeProvider??"",realtimeModel:ie.realtimeModel??"",realtimeVoice:ie.realtimeVoice??"",language:ie.language??"",personaPrompt:ie.personaPrompt??"",sttProvider:ie.sttProvider??"",sttEndpoint:ie.sttEndpoint??"",llmProvider:ie.llmProvider??"",llmEndpoint:ie.llmEndpoint??"",llmModel:ie.llmModel??"",ttsProvider:ie.ttsProvider??"",ttsEndpoint:ie.ttsEndpoint??"",ttsVoice:ie.ttsVoice??"",maxCallDurationSec:ie.maxCallDurationSec!=null?String(ie.maxCallDurationSec):""})},[j]);const[Ur,$n]=w.useState(!1),[li,ci]=w.useState(null),[ot,Wt]=w.useState({name:"",companyName:"",email:"",userEmail:"",userName:"",assignedWorkflowId:"",multiplier:2,activePlan:"Pro",balance:100}),Jt=t.filter(V=>V.agencyId===e.id),$t=i.filter(V=>V.agencyId===e.id).reduce((V,ie)=>V+Math.floor(ie.durationSeconds/60),0),te=i.filter(V=>V.agencyId===e.id).reduce((V,ie)=>V+ie.clientCost,0),Fe=i.filter(V=>V.agencyId===e.id).reduce((V,ie)=>V+ie.agencyCost,0),dt=te-Fe,He=async V=>{if(V.preventDefault(),A(null),li)l(li.id,{name:ot.name,companyName:ot.companyName,email:ot.email,assignedWorkflowId:ot.assignedWorkflowId,multiplier:Number(ot.multiplier),activePlan:ot.activePlan});else{const ie=n.find(Te=>Te.id===ot.assignedWorkflowId),Z={id:"client-"+Date.now(),agencyId:e.id,name:ot.name,companyName:ot.companyName,email:ot.email,greetingPrompt:(ie==null?void 0:ie.defaultGreeting)||"Hello, welcome to our business!",assignedWorkflowId:ot.assignedWorkflowId,multiplier:Number(ot.multiplier),activePlan:ot.activePlan,balance:Number(ot.balance),status:"active",userEmail:ot.userEmail.trim()||ot.email,userName:ot.userName.trim()||void 0};try{await s(Z)}catch(Te){A((Te==null?void 0:Te.message)||"Could not create that client.");return}}$n(!1),ci(null)},H=V=>{ci(V),Wt({name:V.name,companyName:V.companyName,email:V.email,userEmail:"",userName:"",assignedWorkflowId:V.assignedWorkflowId,multiplier:V.multiplier,activePlan:V.activePlan,balance:V.balance}),A(null),$n(!0)},se=Be??[];return a.jsxs("div",{className:"min-h-screen bg-slate-50 text-slate-800 font-sans flex flex-col",children:[a.jsxs("header",{className:"bg-slate-900 text-white px-6 py-4 flex items-center justify-between border-b border-slate-800 sticky top-0 z-30 shadow-md",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-indigo-600 p-2 rounded-xl text-white",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-bold text-lg font-display tracking-tight",children:e.name}),a.jsx("span",{className:"text-[9px] bg-indigo-500 text-white font-semibold uppercase px-1.5 py-0.5 rounded-md",children:"AGENCY PORTAL"})]}),a.jsx("span",{className:"text-[10px] text-slate-400 font-mono",children:"Whitelabel Dashboard Workspace"})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-right hidden sm:block",children:[a.jsx("span",{className:"text-[10px] text-slate-400 block font-semibold uppercase",children:"Agency Credit Balance"}),a.jsxs("span",{className:"text-sm font-bold text-emerald-400 font-mono",children:["$",e.balance.toFixed(2)]})]}),a.jsx("button",{onClick:p,className:"bg-indigo-600 hover:bg-indigo-500 text-white text-xs px-3.5 py-2 rounded-xl font-bold transition-all shadow-md cursor-pointer",children:"Recharge Balance"}),a.jsx("button",{onClick:f,className:"border border-slate-800 hover:bg-slate-800 text-slate-300 hover:text-white px-3 py-2 rounded-xl text-xs font-semibold transition-all cursor-pointer",children:"Logout"})]})]}),a.jsxs("div",{className:"flex-1 max-w-7xl w-full mx-auto p-4 md:p-6 grid grid-cols-1 lg:grid-cols-12 gap-6",children:[a.jsxs("aside",{className:"lg:col-span-3 space-y-2",children:[a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4 space-y-1",children:[a.jsx("h4",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2 px-2",children:"Agency Control"}),a.jsx(en,{icon:yL,label:"Agency Overview",tab:"overview",activeTab:x,setActiveTab:b}),a.jsx(en,{icon:Wo,label:"Manage Clients",tab:"clients",activeTab:x,setActiveTab:b,count:Jt.length}),a.jsx(en,{icon:PX,label:"Whitelabel Settings",tab:"settings",activeTab:x,setActiveTab:b})]}),a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4 space-y-2.5",children:[a.jsx("h4",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider px-1",children:"Your Agency Rate"}),a.jsxs("div",{className:"flex items-baseline justify-between px-1",children:[a.jsx("span",{className:"text-xs text-slate-500",children:"Billing rate"}),a.jsxs("span",{className:"text-sm font-bold font-display text-slate-800",children:["$",(.04*((e==null?void 0:e.multiplier)??1)).toFixed(2),"/min"]})]}),a.jsxs("div",{className:"flex items-baseline justify-between px-1",children:[a.jsx("span",{className:"text-xs text-slate-500",children:"Agency markup"}),a.jsxs("span",{className:"text-sm font-bold font-display text-slate-800",children:[(e==null?void 0:e.multiplier)??1,"x"]})]}),a.jsx("p",{className:"text-[10px] text-slate-400 leading-relaxed px-1 pt-1 border-t border-slate-100",children:"Set per-client multipliers above this rate to pocket the markup."})]})]}),a.jsxs("main",{className:"lg:col-span-9 space-y-6",children:[x==="overview"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsx(ir,{icon:Qd,label:"COLLECTED FEES",value:`$${te.toFixed(2)}`,sub:"Gross revenue charged to clients"}),a.jsx(ir,{icon:Qd,label:"NET AGENCY PROFIT",value:`$${dt.toFixed(2)}`,sub:"After platform billing costs",tone:"emerald"}),a.jsx(ir,{icon:cc,label:"CLIENT CALL MINS",value:`${$t} mins`,sub:"Aggregated client conversation usage"})]}),a.jsxs("div",{className:`${rt} p-6`,children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display",children:"Agency Revenue Margin History"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Calculated markup payouts week over week."})]}),a.jsx("span",{className:"text-xs font-semibold bg-emerald-50 text-emerald-700 px-2.5 py-1 rounded-lg",children:"Profit-positive stream"})]}),a.jsx("div",{className:"h-64",children:a.jsx(uT,{width:"100%",height:"100%",children:a.jsxs(P2,{data:se,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"colorProfit",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",
737stopColor:"#10b981",stopOpacity:.2}),a.jsx("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),a.jsx(gb,{strokeDasharray:"3 3",vertical:!1}),a.jsx(vb,{dataKey:"name",tick:{fontSize:10}}),a.jsx(xb,{tick:{fontSize:10}}),a.jsx(v2,{}),a.jsx(Ah,{type:"monotone",dataKey:"revenue",stroke:"#10b981",fillOpacity:1,fill:"url(#colorProfit)"})]})})})]}),a.jsxs("div",{className:`${rt} overflow-hidden`,children:[a.jsx("div",{className:"p-5 border-b border-slate-100 bg-slate-50/50",children:a.jsx("h3",{className:"font-bold text-slate-900 font-display text-sm",children:"Client Usage Billing"})}),a.jsx("div",{className:"divide-y divide-slate-100 text-xs",children:Jt.map(V=>{const ie=i.filter(we=>we.clientId===V.id),Z=ie.reduce((we,X)=>we+Math.floor(X.durationSeconds/60),0),Te=ie.reduce((we,X)=>we+X.clientCost,0);return a.jsxs("div",{className:"p-4 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 hover:bg-slate-50/50 transition-colors",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-slate-900",children:V.companyName}),a.jsx("span",{className:"text-slate-400 text-[10px]",children:V.email})]}),a.jsxs("div",{className:"flex items-center gap-8 text-right",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400 block uppercase font-semibold text-[9px]",children:"Multiplier"}),a.jsxs("span",{className:"font-bold text-slate-700",children:[V.multiplier,"x base"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400 block uppercase font-semibold text-[9px]",children:"Duration"}),a.jsxs("span",{className:"font-bold text-slate-700",children:[Z," mins"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-slate-400 block uppercase font-semibold text-[9px]",children:"Billable Earned"}),a.jsxs("span",{className:"font-bold text-emerald-600",children:["$",Te.toFixed(2)]})]})]})]},V.id)})})]})]}),x==="clients"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Agency Clients"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Configure client settings, override default agent prompts, and adjust margins."})]}),a.jsxs("button",{onClick:()=>{var V;ci(null),Wt({name:"",companyName:"",email:"",userEmail:"",userName:"",assignedWorkflowId:((V=n[0])==null?void 0:V.id)||"",multiplier:2,activePlan:"Pro",balance:100}),A(null),$n(!0)},className:"bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs px-4 py-2.5 rounded-xl flex items-center gap-1.5 transition-all shadow-md cursor-pointer",children:[a.jsx(cr,{className:"w-4 h-4"})," Onboard Client"]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Jt.map(V=>{const ie=n.find(Z=>Z.id===V.assignedWorkflowId);return a.jsxs("div",{className:`bg-white border rounded-2xl p-5 shadow-sm space-y-4 relative ${V.status==="suspended"?"border-red-200 bg-red-50/5":"border-slate-100"}`,children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsxs("span",{className:"text-[9px] font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-md uppercase",children:[V.activePlan," Plan"]}),a.jsx("h4",{className:"font-bold text-slate-900 text-base font-display mt-2",children:V.companyName}),a.jsxs("p",{className:"text-xs text-slate-400",children:["Contact: ",V.name," (",V.email,")"]})]}),a.jsx("span",{className:`text-[9px] font-bold uppercase px-2 py-0.5 rounded-full ${V.status==="active"?"bg-emerald-100 text-emerald-700":"bg-rose-100 text-rose-700"}`,children:V.status})]}),a.jsxs("div",{className:"bg-slate-50 p-3 rounded-xl border border-slate-100 text-xs space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Assigned Agent Workflow:"}),a.jsx("span",{className:"font-bold text-slate-800",children:(ie==null?void 0:ie.name)||"None"})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Client Multiplier:"}),a.jsxs("span",{className:"font-bold text-indigo-600 font-mono",children:[V.multiplier,"x"]})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Client Cost Rate:"}),a.jsxs("span",{className:"font-bold text-slate-700 font-mono",children:["$",((ie?ie.baseCostPerMin:.04)*e.multiplier*V.multiplier).toFixed(2),"/min"]})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Direct Prepaid Balance:"}),a.jsxs("span",{className:"font-bold text-emerald-600 font-mono",children:["$",V.balance.toFixed(2)]})]})]}),a.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-slate-50 text-xs",children:[a.jsx("div",{className:"flex items-center gap-1.5",children:a.jsxs("span",{className:"text-[10px] text-slate-400 italic",children:["ID: ",V.id]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>N(V),className:"p-1.5 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 rounded-lg transition-colors cursor-pointer border border-indigo-100",title:"Audition AI — test this voice agent",children:a.jsx(xs,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{var Z;T(V),be("kb"),Zn(((Z=V.attachedOutputs)!=null&&Z.includes("crm_webhook"),"HubSpot")),ln("https://api.hubspot.com/v1/leads/sync"),Wn("shpat_xxxx_xxxx_xxxx")},className:"p-1.5 bg-slate-900 hover:bg-slate-800 text-white rounded-lg transition-colors cursor-pointer border border-slate-800",title:"Configure KB & Data — knowledge base, channels, inventory",children:a.jsx(gu,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{var Te;const Z=`<script src="${window.location.origin}/widget.js" data-client-id="${V.id}" async><\/script>`;(Te=navigator.clipboard)==null||Te.writeText(Z).then(()=>
737{ge(V.id),setTimeout(()=>ge(null),2500)},()=>{window.prompt("Copy this widget snippet:",Z)})},className:"p-1.5 bg-emerald-50 hover:bg-emerald-100 text-emerald-700 rounded-lg transition-colors cursor-pointer border border-emerald-100",title:"Copy Snippet — copy the embed code for this voice agent",children:$===V.id?a.jsx(kt,{className:"w-4 h-4"}):a.jsx(bv,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{B(V),O(`${V.companyName} (copy)`),ne(null),q(null)},className:"p-1.5 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-lg transition-colors cursor-pointer border border-slate-200",title:"Clone — duplicate this voice agent + its knowledge base",children:a.jsx(Ak,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>H(V),className:"p-1.5 hover:bg-slate-100 text-slate-600 hover:text-slate-900 rounded-lg transition-colors cursor-pointer",title:"Edit Multipliers & Profile",children:a.jsx(su,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>{const Z=V.status==="active"?"suspended":"active";l(V.id,{status:Z})},className:"p-1.5 hover:bg-slate-100 text-rose-600 rounded-lg transition-colors cursor-pointer",title:V.status==="active"?"Suspend Client":"Unsuspend Client",children:V.status==="active"?a.jsx(fn,{className:"w-4 h-4"}):a.jsx(Qa,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>C(V),className:"p-1.5 hover:bg-rose-50 text-rose-600 rounded-lg transition-colors cursor-pointer",title:"Delete Client",children:a.jsx(xi,{className:"w-4 h-4"})})]})]})]},V.id)})})]}),x==="settings"&&a.jsxs("div",{className:`${rt} p-6 space-y-6`,children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"Whitelabel Custom Branding Settings"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Fully mask the widget UI and control panel domain to resemble your agency\\'s brand."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Custom Dashboard Title"}),a.jsx("input",{type:"text",className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600",defaultValue:`${e.name} Voice Automation`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Whitelabel Agency Domain"}),a.jsx("input",{type:"text",className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600",defaultValue:`voice.${e.name.toLowerCase().replace(/ /g,"")}.io`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Support Email Routing"}),a.jsx("input",{type:"text",className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600",defaultValue:`support@${e.name.toLowerCase().replace(/ /g,"")}.io`})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-slate-50 border border-slate-100 rounded-xl space-y-3",children:[a.jsx("h5",{className:"font-bold text-xs font-display",children:"Client Widget Masking"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:'Ensure the chat bubble, S2S loading, and S2S voice widget references show only your agency styling without "Vox Bridge" branding tags.'}),a.jsxs("div",{className:"flex items-center justify-between text-xs font-medium pt-1",children:[a.jsx("span",{children:'Remove "Powered by" footer tags'}),a.jsx("span",{className:"text-emerald-600 font-bold",children:"Enabled"})]}),a.jsxs("div",{className:"flex items-center justify-between text-xs font-medium",children:[a.jsx("span",{children:"Custom color accent override"}),a.jsx("span",{className:"text-indigo-600 font-bold",children:"Indigo (#4f46e5)"})]})]}),a.jsxs("button",{className:"w-full bg-slate-900 hover:bg-slate-800 text-white font-semibold py-2.5 rounded-xl text-xs transition-all cursor-pointer flex items-center justify-center gap-1.5",children:[a.jsx($i,{className:"w-3.5 h-3.5 text-indigo-400"}),"Save Branding Configurations"]})]})]})]})]})]}),R&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative my-8 max-h-[90vh] overflow-y-auto",children:[a.jsx("button",{onClick:()=>B(null),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900 mb-1",children:"Clone Voice Agent"}),a.jsxs("p",{className:"text-xs text-slate-500 mb-4",children:["Creates a new client with the same persona, voice, and knowledge base as ",a.jsx("span",{className:"font-semibold text-slate-700",children:R.companyName}),". The new client starts clean (no leads) and its KB is an independent copy. Use it to embed the same agent on another site."]}),!F&&a.jsxs(a.Fragment,{children:[a.jsx("label",{className:"block text-[10px] font-bold text-slate-500 uppercase tracking-wider mb-1",children:"New client name"}),a.jsx("input",{type:"text",value:U,onChange:V=>{O(V.target.value),q(null)},className:"w-full bg-slate-50 border border-slate-200 focus:bg-white focus:border-indigo-600 outline-none rounded-xl px-4 py-2.5 text-sm transition-all mb-3"}),W&&a.jsx("div",{className:"text-xs rounded-lg px-3 py-2 mb-3 bg-rose-50 text-rose-700 border border-rose-100",children:W}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:()=>B(null),className:"px-4 py-2 text-xs font-semibold text-slate-600 hover:bg-slate-100 rounded-xl cursor-pointer",children:"Cancel"}),a.jsx("button",{disabled:re||!U.trim(),onClick:async()=>{Q(!0),q(null);try{const V=await M({sourceClientId:R.id,newName:U.trim()});ne({id:V,name:U.trim()})}catch(V){q((V==null?void 0:V.message)||"Clone failed.")}finally{Q(!1)}},className:"bg-indigo-600 hover:bg-indigo-500 disabled:opacity-40 disabled:cursor-not-allowed text-white font-semibold text-xs px-4 py-2 rounded-xl transition-all shadow-md cursor-pointer",children:re?"Cloning…":"Clone Agent"})]})]}),F&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-xs rounded-lg px-3 py-2 mb-3 bg-emerald-50 text-emerald-700 border border-emerald-100",children:["✓ Cloned to ",a.jsx("span",{className:"font-semibold",children:F.name}),". Paste this snippet into the other site's HTML (before </body>):"]}),a.jsx("pre",{className:"bg-slate-900 text-slate-100 rounded-xl p-3 text-[11px] font-mono overflow-x-auto whitespace-pre-wrap break-all",children:`<script src="${window.location.origin}/widget.js" data-client-id="${F.id}" async><\/script>`}),a.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[a.jsxs("button",{onClick:()=>{var ie;const V=`<script src="${window.location.origin}/widget.js" data-client-id="${F.id}" async><\/script>`;(ie=navigator.clipboard)==null||ie.writeText(V)},className:"px-4 py-2 text-xs font-semibold text-indigo-700 bg-indigo-50 hover:bg-indigo-100 rounded-xl cursor-pointer flex items-center gap-1.5",children:[a.jsx(bv,{className:"w-3.5 h-3.5"})," Copy Snippet"]}),a.jsx("button",{onClick:()=>B(null),className:"px-4 py-2 text-xs font-semibold text-white bg-indigo-600 hover:bg-indigo-500 rounded-xl cursor-pointer",children:"Done"})]})]})]})}),Ur&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative my-8 max-h-[90vh] overflow-y-auto",children:[a.jsx("button",{onClick:()=>$n(!1),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900 mb-4",children:li?"Edit Client Settings":"Onboard New Client"}),a.jsxs("form",{onSubmit:He,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Contact Full Name"}),a.jsx("input",{type:"text",required:!0,placeholder:"Mina Murray",value:ot.name,onChange:V=>Wt({...ot,name:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Company Name"}),a.jsx("input",{type:"text",required:!0,placeholder:"Murray Law Office",value:ot.companyName,onChange:V=>Wt({...ot,companyName:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Client Billing Email"}),a.jsx("input",{type:"email",required:!0,placeholder:"[email protected]",value:ot.email,onChange:V=>Wt({...ot,email:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),!li&&a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Client Login Email (optional)"}),a.jsx("input",{type:"email",placeholder:"Defaults to billing email",value:ot.userEmail,onChange:V=>Wt({...ot,userEmail:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"}),a.jsx("span",{className:"text-[9px] text-slate-400 block mt-1",children:"Pre-provisions a client login. They sign up with this email and auto-link — no password is set by you."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Client Login Name (optional)"}),a.jsx("input",{type:"text",placeholder:"Mina Murray",value:ot.userName,onChange:V=>Wt({...ot,userName:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Assign Voice Agent Template"}),a.jsx("select",{value:ot.assignedWorkflowId,onChange:V=>Wt({...ot,assignedWorkflowId:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 bg-white",children:n.map(V=>
737a.jsxs("option",{value:V.id,children:[V.name," ($",V.baseCostPerMin.toFixed(2)," cost)"]},V.id))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Client Multiplier markup"}),a.jsx("input",{type:"number",required:!0,step:"0.1",min:"1.0",placeholder:"2.0",value:ot.multiplier,onChange:V=>Wt({...ot,multiplier:Number(V.target.value)}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"}),a.jsx("span",{className:"text-[9px] text-slate-400 block mt-1",children:"Multiplies the agency rate to charge client."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Direct SaaS Plan"}),a.jsxs("select",{value:ot.activePlan,onChange:V=>Wt({...ot,activePlan:V.target.value}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600 bg-white",children:[a.jsx("option",{value:"Free",children:"Free ($0)"}),a.jsx("option",{value:"Pro",children:"Pro ($49)"}),a.jsx("option",{value:"Premium",children:"Premium ($149)"})]})]})]}),!li&&a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Starting Client Credit ($)"}),a.jsx("input",{type:"number",value:ot.balance,onChange:V=>Wt({...ot,balance:Number(V.target.value)}),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-600"})]}),P&&a.jsx("div",{className:"text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded-lg px-3 py-2 mt-3",children:P}),a.jsxs("div",{className:"flex gap-3 mt-5",children:[a.jsx("button",{type:"button",onClick:()=>$n(!1),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"submit",className:"flex-1 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:li?"Save Changes":"Onboard"})]})]})]})}),j&&(()=>{const V=L,ie=j.attachedInputs||["web_widget"],Z=j.attachedOutputs||["email_notification"],Te=X=>{const Ee=ie.includes(X)?ie.filter(qe=>qe!==X):[...ie,X];l(j.id,{attachedInputs:Ee}),T(qe=>qe?{...qe,attachedInputs:Ee}:null)},we=X=>{const Ee=Z.includes(X)?Z.filter(qe=>qe!==X):[...Z,X];l(j.id,{attachedOutputs:Ee}),T(qe=>qe?{...qe,attachedOutputs:Ee}:null)};return a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-3xl border border-slate-100 max-w-2xl w-full p-6 shadow-2xl relative my-8 max-h-[90vh] overflow-y-auto flex flex-col",children:[a.jsx("button",{onClick:()=>T(null),className:"absolute top-5 right-5 p-1.5 hover:bg-slate-100 rounded-lg cursor-pointer transition-colors",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsxs("div",{className:"mb-5",children:[a.jsx("span",{className:"text-[10px] font-bold uppercase bg-indigo-50 text-indigo-700 px-2 py-1 rounded-md",children:"ADMIN CONTROL"}),a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 mt-2",children:["Configure ",j.companyName]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Manage core RAG documents, website data scraping, inputs, and output automation nodes."})]}),a.jsxs("div",{className:"flex border-b border-slate-100 mb-6 gap-2",children:[a.jsxs("button",{onClick:()=>be("kb"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="kb"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(Ya,{className:"w-4 h-4"}),a.jsx("span",{children:"Knowledge Base (RAG)"})]}),a.jsxs("button",{onClick:()=>be("pipelines"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="pipelines"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(gu,{className:"w-4 h-4"}),a.jsx("span",{children:"Channels & Webhooks"})]}),a.jsxs("button",{onClick:()=>be("integrations"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="integrations"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(c5,{className:"w-4 h-4"}),a.jsx("span",{children:"Integrations"})]}),a.jsxs("button",{onClick:()=>be("inventory"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="inventory"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(u5,{className:"w-4 h-4"}),a.jsx("span",{children:"Inventory"})]}),a.jsxs("button",{onClick:()=>be("merchant"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="merchant"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(Sa,{className:"w-4 h-4"}),a.jsx("span",{children:"Merchant Store"})]}),a.jsxs("button",{onClick:()=>be("leads"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="leads"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(zs,{className:"w-4 h-4"}),a.jsx("span",{children:"Leads & Recordings"})]}),a.jsxs("button",{onClick:()=>be("voice-agents"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="voice-agents"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(ny,{className:"w-4 h-4"}),a.jsx("span",{children:"Voice Agents"})]}),a.jsxs("button",{onClick:()=>be("tools"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="tools"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(kv,{className:"w-4 h-4"}),a.jsx("span",{children:"Tools"})]}),a.jsxs("button",{onClick:()=>be("flow"),className:`pb-3 text-xs font-bold transition-all px-2 border-b-2 flex items-center gap-1.5 cursor-pointer ${De==="flow"?"border-indigo-600 text-indigo-600":"border-transparent text-slate-400 hover:text-slate-600"}`,children:[a.jsx(Ak,{className:"w-4 h-4"}),a.jsx("span",{children:"Flow"})]})]}),De==="kb"&&a.jsxs("div",{className:"space-y-6 flex-1",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block mb-2",children:"Active RAG Grounding Files"}),V.length===0?a.jsx("div",{className:"border border-dashed border-slate-200 rounded-2xl p-6 text-center text-xs text-slate-400 bg-slate-50/30",children:"No custom knowledge base files uploaded yet. Add a document below to inject custom business context."}):a.jsx("div",{className:"space-y-2 max-h-[180px] overflow-y-auto pr-1",children:V.map(X=>a.jsxs("div",{className:"p-3 bg-slate-50 rounded-xl border border-slate-100 flex items-center justify-between text-xs transition-all hover:bg-slate-100/50",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[X.type==="website"?a.jsx(Yo,{className:"w-4 h-4 text-indigo-500"}):a.jsx(Ya,{className:"w-4 h-4 text-emerald-500"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-slate-800 block",children:X.fileName}),a.jsxs("span",{className:"text-[10px] text-slate-400",children:["Size: ",X.fileSize," • Grounding context active"]}),X.voiceAgentId&&a.jsxs("span",{className:"mt-1 inline-flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider bg-indigo-50 text-indigo-700 px-1.5 py-0.5 rounded",children:[a.jsx(Ei,{className:"w-2.5 h-2.5"}),TCe[X.voiceAgentId]||X.voiceAgentId]})]})]}),a.jsx("button",{onClick:()=>{d(X.id)},className:"p-1 hover:bg-rose-50 rounded-md text-rose-600 transition-all cursor-pointer",title:"Delete file",children:a.jsx(FX,{className:"w-3.5 h-3.5"})})]},X.id))})]}),a.jsxs("div",{className:"bg-slate-50/50 rounded-2xl p-4 border border-slate-100 space-y-3",children:[a.jsx("span",{className:"text-xs font-bold text-slate-800 block",children:"Inject Custom Text Document"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[a.jsxs("div",{className:"md:col-span-1",children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase",children:"Document Title"}),a.jsx("input",{type:"text",placeholder:"faqs_pricing.txt",value:on,onChange:X=>bt(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase",children:"Grounding Knowledge Content (RAG Context)"}),a.jsx("textarea",{placeholder:"Implants are $1200. Dr. Mina is available Tuesdays and Fridays...",rows:2,value:Vt,onChange:X=>tn(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500 font-sans"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase",children:"Tag to voice agent"}),a.jsx("select",{value:qn,onChange:X=>qt(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:Aj.map(X=>a.jsx("option",{value:X.id,children:X.label},X.id))})]}),a.jsxs("button",{onClick:()=>{!on||!Vt||(h({id:"kb-"+Date.now(),clientId:j.id,fileName:on.endsWith(".txt")?on:on+".txt",fileSize:(Vt.length/1024).toFixed(1)+" KB",uploadedAt:new Date().toISOString().split("T")[0],type:"document",content:Vt,voiceAgentId:qn||void 0}),bt(""),tn(""),qt(""))},className:"w-full bg-indigo-600 hover:bg-indigo-500 text-white font-bold py-1.5 rounded-lg text-xs transition-all cursor-pointer flex items-center justify-center gap-1 shadow-sm",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," Ground Custom Document"]})]}),a.jsxs("div",{className:"bg-slate-50/50 rounded-2xl p-4 border border-slate-100 space-y-3",children:[a.jsx("span",{className:"text-xs font-bold text-slate-800 block",children:"Index & Scrape Public Website"}),a.jsx("span",{className:"text-[10px] text-slate-400 block -mt-1",children:"Enter your site's URL — we crawl up to 12 same-site pages, extract the readable content, and let you review/trim before saving it as a grounding source for this client's voice agent."}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"url",placeholder:"https://www.murraylawoffice.com/rates",value:Qt,onChange:X=>Cn(X.target.value),className:"flex-1 border border-slate-200 rounded-lg px-3 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsx("button",{onClick:async()=>
737{if(Qt){kn(!0),si(null),On(null);try{const X=await fetch("/api/scrape-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Qt})}),Ee=await X.json().catch(()=>({}));if(!X.ok)throw new Error((Ee==null?void 0:Ee.error)||`Couldn't fetch that page (HTTP ${X.status}).`);On({title:Ee.title||Qt.replace(/^https?:\/\//,"").replace(/^www\./,""),text:Ee.text||"",finalUrl:Ee.finalUrl||Qt,pages:Ee.pages||1})}catch(X){si((X==null?void 0:X.message)||"Could not reach that URL.")}finally{kn(!1)}}},disabled:pt||!Qt,className:"bg-slate-900 hover:bg-slate-800 disabled:bg-slate-300 text-white font-bold px-4 rounded-lg text-xs transition-all cursor-pointer flex items-center gap-1",children:pt?"Fetching…":a.jsxs(a.Fragment,{children:[a.jsx(Yo,{className:"w-3.5 h-3.5"})," Scrape Site"]})})]}),zt&&a.jsx("div",{className:"text-[11px] text-rose-700 bg-rose-50 border border-rose-200 rounded-lg px-3 py-2",children:zt}),Lt&&a.jsxs("div",{className:"space-y-2 border-t border-slate-200 pt-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Review & edit before saving"}),a.jsx("button",{onClick:()=>{On(null),Cn(""),si(null)},className:"text-[10px] text-slate-400 hover:text-slate-600 font-bold cursor-pointer",children:"Cancel"})]}),a.jsx("input",{type:"text",value:Lt.title,onChange:X=>On({...Lt,title:X.target.value}),className:"w-full border border-slate-200 rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500"}),a.jsx("textarea",{value:Lt.text,onChange:X=>On({...Lt,text:X.target.value}),rows:8,className:"w-full border border-slate-200 rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500 font-sans max-h-64 overflow-y-auto"}),a.jsxs("div",{className:"text-[10px] text-slate-400",children:["Source: ",Lt.finalUrl," • ",Lt.text.length.toLocaleString()," chars • ",Lt.pages," page",Lt.pages===1?"":"s"," crawled",Lt.text.length<300&&a.jsx("span",{className:"block text-amber-600 mt-1",children:"Very little text was extracted — the site may be JavaScript-rendered (not supported) or mostly images. Try a specific content page URL, or paste the text manually below."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase",children:"Tag to voice agent"}),a.jsx("select",{value:qn,onChange:X=>qt(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:Aj.map(X=>a.jsx("option",{value:X.id,children:X.label},X.id))})]}),a.jsxs("button",{onClick:()=>{Lt.text.trim()&&(h({id:"kb-scrape-"+Date.now(),clientId:j.id,fileName:Lt.title||Lt.finalUrl.replace(/^https?:\/\//,"").replace(/^www\./,""),fileSize:(Lt.text.length/1024).toFixed(1)+" KB",uploadedAt:new Date().toISOString().split("T")[0],type:"website",sourceUrl:Lt.finalUrl,content:Lt.text.trim(),voiceAgentId:qn||void 0}),On(null),Cn(""),si(null),qt(""))},disabled:!Lt.text.trim(),className:"w-full bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 text-white font-bold py-1.5 rounded-lg text-xs transition-all cursor-pointer flex items-center justify-center gap-1 shadow-sm",children:[a.jsx(cr,{className:"w-3.5 h-3.5"})," Save as Knowledge Base"]})]})]})]}),De==="pipelines"&&a.jsxs("div",{className:"space-y-5 flex-1 text-xs",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"Authorized Input Channels"}),[{id:"web_widget",name:"Website Embed Widget",desc:"Allow audio chats directly on landing pages"},{id:"twilio_inbound",name:"Twilio Phone Routing",desc:"Active VoIP inbound routing stream"},{id:"whatsapp_voice",name:"WhatsApp Gateway",desc:"Parse incoming WhatsApp audio notes"},{id:"api_voice_gateway",name:"Rest API Voice Gateway",desc:"Secure direct stream routing"}].map(X=>{const Ee=ie.includes(X.id);return a.jsxs("div",{onClick:()=>Te(X.id),className:`p-2.5 border rounded-xl flex items-center justify-between cursor-pointer transition-all ${Ee?"border-indigo-200 bg-indigo-50/20":"border-slate-100 bg-white hover:border-slate-200"}`,children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-700 block text-[11px]",children:X.name}),a.jsx("span",{className:"text-[9px] text-slate-400 mt-0.5 block",children:X.desc})]}),a.jsx("div",{className:`w-7 h-4 rounded-full p-0.5 transition-colors ${Ee?"bg-indigo-600":"bg-slate-200"}`,children:a.jsx("div",{className:`w-3 h-3 rounded-full bg-white transition-transform ${Ee?"translate-x-3":"translate-x-0"}`})})]},X.id)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"Connected Event Outputs"}
737),[{id:"email_notification",name:"Email Confirmation Dispatcher",desc:"Auto-send booking & follow-up receipt emails"},{id:"crm_webhook",name:"Active HubSpot CRM Webhook Sync",desc:"Direct outbound lead sync pipeline"},{id:"google_sheets_append",name:"Google Sheets CRM Append",desc:"Autofill live spreadsheet bookings row"},{id:"zapier_push",name:"Zapier Automation Node",desc:"Forward payloads to multi-step Zap triggers"}].map(X=>{const Ee=Z.includes(X.id);return a.jsxs("div",{onClick:()=>we(X.id),className:`p-2.5 border rounded-xl flex items-center justify-between cursor-pointer transition-all ${Ee?"border-indigo-200 bg-indigo-50/20":"border-slate-100 bg-white hover:border-slate-200"}`,children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-700 block text-[11px]",children:X.name}),a.jsx("span",{className:"text-[9px] text-slate-400 mt-0.5 block",children:X.desc})]}),a.jsx("div",{className:`w-7 h-4 rounded-full p-0.5 transition-colors ${Ee?"bg-indigo-600":"bg-slate-200"}`,children:a.jsx("div",{className:`w-3 h-3 rounded-full bg-white transition-transform ${Ee?"translate-x-3":"translate-x-0"}`})})]},X.id)})]})]}),a.jsxs("div",{className:"bg-slate-50/70 border border-slate-100 rounded-2xl p-4 space-y-3 font-sans",children:[a.jsxs("span",{className:"text-xs font-bold text-slate-800 block flex items-center gap-1",children:[a.jsx(D0,{className:"w-4 h-4 text-indigo-600"})," Outbound Webhook Integration Target"]}),a.jsxs("button",{onClick:()=>be("merchant"),className:"w-full text-left text-[10px] text-indigo-700 bg-indigo-50/40 border border-indigo-100 rounded-lg px-3 py-2 hover:bg-indigo-50 cursor-pointer",children:["→ For a live store connection (Shopify/Woo/ERP REST reads + writes, refunds, write-governance), use the ",a.jsx("b",{children:"Merchant Store"})," tab. The fields below are a placeholder."]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase",children:"CRM Engine Type"}),a.jsxs("select",{value:ai,onChange:X=>Zn(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs bg-white outline-none focus:ring-1 focus:ring-indigo-500 font-medium",children:[a.jsx("option",{value:"HubSpot",children:"HubSpot Integration Node"}),a.jsx("option",{value:"Salesforce",children:"Salesforce CRM Integration"}),a.jsx("option",{value:"PostgreSQL",children:"Direct PostgreSQL DB Hook"}),a.jsx("option",{value:"Zapier",children:"Zapier Automation Webhook"})]})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase",children:"Target Outbound API Webhook Endpoint"}),a.jsx("input",{type:"text",value:ct,onChange:X=>ln(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs font-mono text-slate-700 outline-none focus:ring-1 focus:ring-indigo-500 bg-white"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 font-bold uppercase block",children:"Secure Authorization Database token"}),a.jsx("input",{type:"password",value:Ut,onChange:X=>Wn(X.target.value),className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs font-mono outline-none focus:ring-1 focus:ring-indigo-500 bg-white"})]})]}),a.jsxs("div",{className:"bg-indigo-50/20 border border-indigo-100 rounded-2xl p-4 space-y-2",children:[a.jsxs("span",{className:"text-xs font-bold text-indigo-900 flex items-center gap-1",children:[a.jsx(Ei,{className:"w-4 h-4 text-indigo-600"})," Inbound Telephony SIP Routing (Twilio / S2S)"]}),a.jsxs("div",{className:"flex gap-4 items-center",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[10px] text-indigo-700/80 font-bold uppercase",children:"Assign Inbound Numbers"}),a.jsxs("select",{value:_i,onChange:X=>nn(X.target.value),className:"w-full mt-1 border border-indigo-200 rounded-lg px-2.5 py-1.5 text-xs bg-white outline-none text-indigo-950 font-semibold",children:[a.jsx("option",{value:"+1 (800) 555-0199",children:"+1 (800) 555-0199 (Primary Office Hotline)"}),a.jsx("option",{value:"+1 (888) 987-1234",children:"+1 (888) 987-1234 (Secondary Intake Hotline)"}),a.jsx("option",{value:"+1 (555) 321-4567",children:"+1 (555) 321-4567 (VIP Direct Booking Hotline)"})]})]}),a.jsxs("div",{className:"bg-indigo-50 border border-indigo-100/50 rounded-xl px-3 py-2 text-[10px] text-indigo-700 max-w-xs",children:[a.jsx("span",{className:"font-bold text-indigo-800 block",children:"S2S Latency Guard Active"}),"Real-time WebSockets directly interface voice streams. Response threshold is below 180ms."]})]})]})]}),De==="integrations"&&a.jsxs("div",{className:"space-y-5 flex-1 text-xs",children:[a.jsxs("div",{className:"bg-slate-50/70 border border-slate-100 rounded-2xl p-4 flex items-center justify-between font-sans",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(Ya,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Leads Sheet attached to VA"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Master switch enabling outbound CRM / Sheets / Calendar sync for this client."})]})]}),a.jsx("button",{onClick:()=>{const X=!K;Ze(X),l(j.id,{leadsSheetAttached:X}),T(Ee=>Ee?{...Ee,leadsSheetAttached:X}:null)},className:`text-[10px] font-extrabold px-3 py-1.5 rounded-md uppercase transition-all shadow-sm cursor-pointer ${K?"bg-emerald-600 hover:bg-emerald-700 text-white":"bg-slate-200 hover:bg-slate-300 text-slate-700"}`,children:K?"On":"Off"})]}),a.jsxs("div",{className:`${rt} p-4 space-y-2 font-sans`,children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(cc,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Call Recording Retention (days)"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Override the superadmin platform default for this client. Leave blank to use the platform default."})]})]}),a.jsx("input",{type:"number",min:1,value:Ft,onChange:X=>jt(X.target.value),placeholder:"Platform default",className:"w-full border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{className:`${rt} p-4 space-y-3 font-sans`,children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(gu,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Voice Pipeline"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Override the agency/platform default. realtime = provider S2S model; stacked = STT→LLM→TTS (open-source models). Leave blank to inherit."})]})]}),a.jsxs("select",{value:oi,onChange:X=>Gi(X.target.value),className:"w-full border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"",children:"Inherit default"}),a.jsx("option",{value:"realtime",children:"realtime"}),a.jsx("option",{value:"stacked",children:"stacked"})]}),a.jsx("p",{className:"text-[9px] text-slate-400 pt-1",children:"Voice profile & language (chosen voice is sent to the realtime model; language biases the conversation). The provider, model, and stacked-pipeline endpoints (STT/LLM/TTS) are set by the superadmin — only the voice and language are configurable here."}),a.jsx(bb,{provider:le||In.realtimeProvider||"",voice:In.realtimeVoice,language:In.language,onChange:X=>Mi(Ee=>({...Ee,...X}))}),a.jsxs("div",{className:"pt-2",children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Character / Persona (optional)"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Customize how the agent presents itself — name, personality, tone, speaking style. The voice gender still matches the selected voice. Leave blank for the default receptionist persona."}),a.jsx("textarea",{value:In.personaPrompt,onChange:X=>Mi(Ee=>({...Ee,personaPrompt:X.target.value})),rows:3,placeholder:"e.g. You are Ayesha, a warm, professional receptionist for FH Group. Be concise, friendly, and address the caller as 'sir/ma'am'. Speak in a calm, confident tone.",className:"mt-1.5 w-full border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs text-slate-700 outline-none focus:ring-1 focus:ring-indigo-500 resize-y"})]}),a.jsxs("div",{className:"pt-2",children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Max Call Duration (seconds)"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Calls auto-disconnect after this limit. Blank = platform default (3 min)."}
737),a.jsx("input",{type:"number",min:1,value:In.maxCallDurationSec,onChange:X=>Mi(Ee=>({...Ee,maxCallDurationSec:X.target.value})),placeholder:"180 (3 min)",className:"mt-1.5 w-full md:max-w-xs border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs text-slate-700 outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{className:"pt-2",children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Appointment Calendar Timezone"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Slots are generated + shown in this timezone. Auto follows the language (Urdu→Karachi, English→New York)."}),a.jsxs("select",{value:fr,onChange:X=>Yi(X.target.value),className:"mt-1.5 w-full md:max-w-xs border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500",children:[a.jsx("option",{value:"",children:"Auto (from language)"}),["Asia/Karachi","Asia/Kolkata","Asia/Dhaka","Asia/Riyadh","Asia/Dubai","Europe/London","Europe/Paris","Europe/Berlin","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","Australia/Sydney"].map(X=>a.jsx("option",{value:X,children:X},X))]})]})]}),a.jsxs("div",{className:`${rt} p-4 space-y-3 font-sans`,children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(c5,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Google Workspace (Gmail · Calendar · Sheets)"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Connect the client's Google account so the VA can send email, mark the calendar, and read/write spreadsheets."})]})]}),ht!=null&&ht.connected?a.jsxs("div",{className:"space-y-2 pt-1",children:[a.jsx("div",{className:"flex items-center justify-between border-t border-slate-100 pt-2",children:a.jsxs("span",{className:"text-slate-500 font-bold flex items-center gap-1 text-[11px]",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"})," Connected — ",ht.googleEmail]})}),a.jsxs("div",{className:"text-[9px] text-slate-400",children:["Scopes: ",ht.scopes.map(X=>X.split("/").pop()).join(", ")]}),ht.lastError&&a.jsxs("div",{className:"text-[9px] text-red-500",children:["Last error: ",ht.lastError]})]}):a.jsx("div",{className:"flex items-center justify-between pt-2 border-t border-slate-100",children:a.jsxs("span",{className:"text-slate-500 font-bold flex items-center gap-1 text-[11px]",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-300"})," Not connected"]})}),a.jsxs("div",{className:"bg-indigo-50/60 border border-indigo-100 rounded-xl px-3 py-2 text-[10px] text-indigo-700 leading-relaxed",children:[a.jsx("span",{className:"font-bold",children:"The end client connects their own Google account"})," from their dashboard (",a.jsx("span",{className:"font-mono",children:"Communications → Connections"}),"). This view is read-only — you control which tools (",a.jsx("span",{className:"font-mono",children:"email-send / calendar / sheets"}),") are attached to the VA under Tools."]})]}),a.jsxs("div",{className:`${rt} p-4 space-y-2 font-sans`,children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(zs,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Google Sync Log"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Recent calendar / sheets / email syncs for this client."})]})]}),yt!=null&&yt.length?a.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:yt.map(X=>a.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${X.status==="ok"?"bg-emerald-500":"bg-red-500"}`}),a.jsx("span",{className:"text-slate-500 font-mono shrink-0",children:new Date(X.createdAt).toLocaleStr
737ing()}),a.jsx("span",{className:"text-slate-700 font-bold shrink-0",children:X.kind}),a.jsx("span",{className:"text-slate-400 truncate",children:X.detail})]},X._id))}):a.jsx("p",{className:"text-[10px] text-slate-400",children:"No syncs yet."})]}),a.jsxs("div",{className:`${rt} p-4 space-y-3 font-sans`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-emerald-50 text-emerald-700 rounded-xl",children:a.jsx(Ya,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Google Sheets Direct CRM Connector"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Append every booked reservation to a live spreadsheet."})]})]}),a.jsx("button",{onClick:()=>{const X=!Bt.isEnabled;Dt(Ee=>({...Ee,isEnabled:X})),l(j.id,{sheetsConfig:{...Bt,isEnabled:X}}),T(Ee=>Ee?{...Ee,sheetsConfig:{...Bt,isEnabled:X}}:null)},className:`w-9 h-5 rounded-full p-0.5 transition-colors cursor-pointer shrink-0 ${Bt.isEnabled?"bg-emerald-600":"bg-slate-200"}`,children:a.jsx("div",{className:`w-4 h-4 rounded-full bg-white transition-transform ${Bt.isEnabled?"translate-x-4":"translate-x-0"}`})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase",children:"Spreadsheet ID"}),a.jsx("input",{type:"text",value:Bt.spreadsheetId,onChange:X=>Dt(Ee=>({...Ee,spreadsheetId:X.target.value})),placeholder:"1y2WvG9U-XqP8V-O5W-pY6V_O5W",className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs font-mono text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase",children:"Target Sheet (Tab Name)"}),a.jsx("input",{type:"text",value:Bt.sheetName,onChange:X=>Dt(Ee=>({...Ee,sheetName:X.target.value})),placeholder:"Bookings",className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase",children:"Service Account Client Email"}),a.jsx("input",{type:"email",value:Bt.clientEmail,onChange:X=>Dt(Ee=>({...Ee,clientEmail:X.target.value})),placeholder:"[email protected]",className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-xs font-mono text-slate-700 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[9px] font-bold text-slate-400 uppercase",children:"Service Account Private Key"}),a.jsx("textarea",{rows:2,value:Bt.privateKey,onChange:X=>Dt(Ee=>({...Ee,privateKey:X.target.value})),placeholder:"-----BEGIN PRIVATE KEY-----",className:"w-full mt-1 border border-slate-200 rounded-lg px-2.5 py-1.5 text-[10px] font-mono text-slate-500 bg-white outline-none focus:ring-1 focus:ring-indigo-500"})]})]})]})]}),De==="inventory"&&a.jsxs("div",{className:"space-y-4 flex-1 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-emerald-50 text-emerald-700 rounded-xl",children:a.jsx(u5,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Inventory & Agent Action Review"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"The voice agent can add/update/delete items during a call; every action queues here for review (versioned audit)."})]})]}),a.jsx(xCe,{clientId:j.id,autoApproveActions:j.autoApproveActions,maxAutoApproveValue:j.maxAutoApproveValue})]}),De==="merchant"&&a.jsxs("div",{className:"space-y-4 flex-1 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(Sa,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-[11px]",children:"Merchant Store Connection"}),a.jsx("span",{className:"text-[9px] text-slate-400",children:"Connect the VA to the real store (Sh
737opify/Woo/ERP). Restocks, refunds & orders apply live per the write-governance policy."})]})]}),a.jsx(Bz,{clientId:j.id})]}),De==="leads"&&a.jsx(Nz,{results:Ke,status:(je==null?void 0:je.status)??"LoadingFirstPage",loadMore:X=>je==null?void 0:je.loadMore(X),channel:J,source:Pe,onFilter:(X,Ee)=>{ye(X),Oe(Ee)},emptyHint:"Inbound calls to this voice agent and its contact-form submissions will appear here with any call recordings."}),De==="voice-agents"&&a.jsx(jCe,{clientId:j.id}),De==="tools"&&a.jsx(Mz,{vas:nt??[]}),De==="flow"&&a.jsxs("div",{className:"space-y-3 flex-1",children:[a.jsx("div",{className:"text-[11px] text-slate-500",children:"Edit the conversation wording for this client's voice agents. Structural changes (nodes, branches, tools) are platform-owner only — you can reword each turn's prompt and adjust which attached tools a turn uses."}),(nt??[]).length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold text-slate-500",children:"VA:"}),a.jsx("select",{value:ze,onChange:X=>Le(X.target.value),className:"px-3 py-2 text-xs border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500",children:(nt??[]).map(X=>a.jsx("option",{value:X._id,children:X.name||X._id},X._id))})]}),ze&&a.jsx(Rz,{vaId:ze,mode:"admin"})]}):a.jsx("div",{className:"text-xs text-slate-500 p-4",children:"This client has no voice agents yet."})]}),a.jsxs("div",{className:"mt-6 pt-4 border-t border-slate-100 flex gap-3",children:[a.jsx("button",{onClick:()=>T(null),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold py-2.5 rounded-xl text-xs transition-all cursor-pointer text-center",children:"Close"}),a.jsxs("button",{onClick:()=>{const X=Ft.trim()===""||!Number.isFinite(Number(Ft))?void 0:Number(Ft),Ee=new Set(["realtimeProvider","realtimeModel","sttProvider","sttEndpoint","llmProvider","llmEndpoint","llmModel","ttsProvider","ttsEndpoint","ttsVoice"]),qe={};for(const[Nt,mt]of Object.entries(In))Ee.has(Nt)||mt.trim()!==""&&(qe[Nt]=mt.trim());if(qe.maxCallDurationSec!==void 0){const Nt=Number(qe.maxCallDurationSec);Number.isFinite(Nt)&&Nt>0?qe.maxCallDurationSec=Math.floor(Nt):delete qe.maxCallDurationSec}qe.realtimeProvider="",qe.realtimeModel="";for(const Nt of["sttProvider","sttEndpoint","llmProvider","llmEndpoint","llmModel","ttsProvider","ttsEndpoint","ttsVoice"])qe[Nt]="";l(j.id,{sheetsConfig:{...Bt},leadsSheetAttached:K,...X!==void 0?{retentionDaysOverride:X}:{},...oi?{voicePipeline:oi}:{},...Object.keys(qe).length>0?{voicePipelineConfig:qe}:{},timezone:fr}),T(null),alert(`Data configurations & Knowledge Base grounding successfully saved for ${j.companyName}.`)},className:"flex-1 bg-indigo-600 hover:bg-indigo-500 text-white font-bold py-2.5 rounded-xl text-xs transition-all cursor-pointer text-center shadow-md flex items-center justify-center gap-1",children:[a.jsx($i,{className:"w-4 h-4"})," Save"]})]})]})})})(),S&&(()=>{const V=n.find(Ee=>Ee.id===S.assignedWorkflowId),ie=V?V.name:"Web Receptionist",Z=V?V.description:"Embedded on landing page to capture incoming bookings and answer queries.",Te=V?V.defaultPrompt:"",we=S.greetingPrompt||(V==null?void 0:V.defaultGreeting)||"Hello! Thank you for calling.",X=[{id:"channel-web",name:`${ie} (Web Widget)`,type:"Website Integration",phone:"N/A (Web Audio)",description:Z,greeting:we,prompt:Te},{id:"channel-phone",name:`${ie} (Inbound Line)`,type:"Inbound Phone Line",phone:"+1 (888) 555-VOX-DENT",description:`Direct phone number line routing calls directly to the custom ${ie} receptionist.`,greeting:V?`Thank you for calling our main office hotline! This is your ${V.name}. ${V.defaultGreeting}`:"Thank you for calling our primary office hotline! I am Sarah, your AI Voice coordinator. How can I assist you with your smile today?",prompt:V?`You are a telephone receptionist representing ${S.companyName}. Speak warmly and utilize this workflow context: ${V.defaultPrompt}`:"You are a telephone customer support agent. Help callers book emergency consults or normal dental treatments."},{id:"channel-outbound",name:`${ie} (Outbound Dialer)`,type:"Outbound Campaign Line",phone:"+1 (888) 5
73755-VOX-DIAL",description:`Automated campaign dialer executing customized outbound triage for ${ie}.`,greeting:V?`Hello! This is the ${V.name} calling on behalf of our office. ${V.defaultGreeting}`:"Hello! This is Sarah calling on behalf of our office. I wanted to quickly follow up regarding your inquiry. Would you like to book a slot now?",prompt:V?`You are a proactive outbound caller representing ${S.companyName}. Confirm details and use this workflow: ${V.defaultPrompt}`:"You are a proactive outbound caller. Gather user name and confirm their appointment details."}];return a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-start justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-2xl w-full p-6 shadow-2xl relative space-y-5 my-8",children:[a.jsx("button",{onClick:()=>N(null),className:"absolute top-4 right-4 p-1.5 hover:bg-slate-100 rounded-lg cursor-pointer bg-slate-50 border border-slate-200 shadow-sm z-10",title:"Close Sandbox Dialogue",children:a.jsx(fn,{className:"w-5 h-5 text-slate-500"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-md uppercase",children:"Agency QA Sandbox"}),a.jsxs("h3",{className:"text-xl font-bold font-display text-slate-900 mt-1",children:["Audition Client Agent: ",S.companyName]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Your client has 3 assigned voice agents. Select any channel to simulate and test real-time conversations."})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:X.map(Ee=>a.jsxs("div",{className:"p-3 border border-slate-100 bg-slate-50/50 rounded-xl space-y-1 hover:border-indigo-200 transition-all cursor-pointer",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsx("span",{className:"text-[9px] font-bold text-indigo-600 bg-indigo-50 px-1.5 py-0.2 rounded",children:Ee.type})}),a.jsx("h5",{className:"font-bold text-slate-800 text-xs mt-1 leading-tight",children:Ee.name}),a.jsx("p",{className:"text-[10px] text-slate-400 font-mono",children:Ee.phone}),a.jsx("p",{className:"text-[9px] text-slate-400 leading-normal line-clamp-2 mt-1",children:Ee.description})]},Ee.id))}),a.jsxs("div",{className:"border border-slate-100 rounded-2xl p-5 bg-slate-50/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 pb-3 border-b border-slate-100",children:[a.jsx("div",{className:"bg-indigo-600 text-white p-1.5 rounded-lg text-xs",children:a.jsx(xs,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-bold text-slate-900 text-xs",children:["Active Audition: ",X[0].name]}),a.jsx("p",{className:"text-[9px] text-slate-400",children:"Testing active model outputs with custom client context overrides."})]})]}),a.jsxs("div",{className:"space-y-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-500 text-[10px] uppercase",children:"Opening Script Overrides"}),a.jsxs("p",{className:"bg-white border border-slate-200/50 p-2.5 rounded-lg italic text-slate-600 leading-relaxed mt-1",children:['"',X[0].greeting,'"']})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-500 text-[10px] uppercase",children:"Developer Prompt Directives"}),a.jsx("p",{className:"bg-white border border-slate-200/50 p-2.5 rounded-lg text-slate-500 leading-normal line-clamp-3 mt-1 font-mono text-[10px]",children:X[0].prompt})]})]}),a.jsx("div",{className:"pt-2 border-t border-slate-100",children:a.jsx(GC,{clientId:S.id,clientName:S.name,companyName:S.companyName,greetingPrompt:X[0].greeting,assignedWorkflowPrompt:X[0].prompt,voiceAgentId:X[0].id,slots:[{id:"sa1",clientId:S.id,dateTime:"2026-06-27 10:00 AM",isFilled:!1},{id:"sa2",clientId:S.id,dateTime:"2026-06-27 02:00 PM",isFilled:!1},{id:"sa3",clientId:S.id,dateTime:"2026-06-28 11:00 AM",isFilled:!1}],onBookSlot:(Ee,qe)=>{alert(`[Sandbox] Booked slot ${Ee} for visitor: ${qe}. (Sandbox demo — no CRM sync configured.)`)},onAddLead:()=>{},onUpdateLead:v,minimal:!0})})]}),a.jsx("div",{className:"flex justify-end pt-2",children:a.jsxs("button",{type:"button",onClick:()=>N(null),className:"px-5 py-2.5 bg-slate-800 hover:bg-slate-700 active:bg-slate-900 text-white font-bold rounded-xl text-xs transition-all shadow-md cursor-pointer flex items-center gap-1.5",children:[a.jsx(fn,{className:"w-4 h-4"})," Close Sandbox Workspace"]})})]})})})(),E&&a.jsx("div",{className:"fixed inset-0 bg-slate-950/70 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 max-w-md w-full p-6 shadow-2xl relative my-8",children:[a.jsx("button",{onClick:()=>C(null),className:"absolute top-4 right-4 p-1 hover:bg-slate-100 rounded-lg cursor-pointer",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-slate-900"})}),a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-50 flex items-center justify-center",children:a.jsx(xi,{className:"w-5 h-5 text-rose-600"})}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"Delete client?"})]}),a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed mb-3",children:["This permanently removes ",a.jsx("span",{className:"font-semibold text-slate-900",children:E.companyName||E.name})," and all of its data. This cannot be undone."]}),E.loginEmail&&a.jsx("div",{className:"bg-amber-50 border border-amber-100 rounded-xl p-3 mb-4",children:a.jsxs("p",{className:"text-[11px] text-amber-800 leading-relaxed",children:["This client has a login at ",a.jsx("span",{className:"font-mono font-semibold",children:E.loginEmail}),". That email is freed in Vox Bridge and can be reused to invite a new client. To invite a ",a.jsx("span",{className:"font-semibold",children:"different person"})," at that same email, also remove their account in the Clerk dashboard so they can sign up fresh."]})}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:()=>C(null),className:"flex-1 bg-slate-100 hover:bg-slate-200 text-slate-700 font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:()=>{c(E.id),C(null)},className:"flex-1 bg-rose-600 hover:bg-rose-500 text-white font-semibold py-2 rounded-xl text-sm transition-all cursor-pointer",children:"Delete client"})]})]})})]})}function ACe({clientId:e}){const t=e,n=et(me.googleOAuth.getGoogleConnection,{clientId:t}),i=et(me.googleOAuth.listSyncLog,{clientId:t,limit:10}),r=We(me.googleOAuth.getGoogleAuthUrl),s=We(me.googleOAuth.disconnectGoogle),l=zo(me.googleOAuth.testGoogleConnection),[c,h]=w.useState(null),[d,f]=w.useState(null),[p,v]=w.useState(0);w.useEffect(()=>{const j=T=>{var E,C,P;((E=T.data)==null?void 0:E.type)==="GOOGLE_OAUTH_SUCCESS"?(v(A=>A+1),f({kind:"ok",text:"Google connected — your VA can now use Gmail, Calendar & Sheets."})):((C=T.data)==null?void 0:C.type)==="GOOGLE_OAUTH_ERROR"&&f({kind:"err",text:`Google connect failed: ${((P=T.data)==null?void 0:P.error)??"unknown error"}`})};
737return window.addEventListener("message",j),()=>window.removeEventListener("message",j)},[]);const x=async()=>{h("connect"),f(null);try{const{url:j}=await r({clientId:t});window.open(j,"google-oauth","width=520,height=640")}catch(j){f({kind:"err",text:`Connect failed: ${(j==null?void 0:j.message)??j}`})}finally{h(null)}},b=async()=>{if(window.confirm("Disconnect this Google account? The VA will lose email/calendar/sheets access.")){h("disconnect"),f(null);try{await s({clientId:t}),f({kind:"ok",text:"Google disconnected."})}catch(j){f({kind:"err",text:`Disconnect failed: ${(j==null?void 0:j.message)??j}`})}finally{h(null)}}},S=async()=>{h("test"),f(null);try{const j=await l({clientId:t});f(j!=null&&j.ok?{kind:"ok",text:"Connection OK — token is valid."}:{kind:"err",text:`Test failed: ${(j==null?void 0:j.error)??"unknown"}`})}catch(j){f({kind:"err",text:`Test failed: ${(j==null?void 0:j.message)??j}`})}finally{h(null)}},N=!!(n!=null&&n.connected);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`${rt} p-5 space-y-3`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2.5 rounded-xl ${N?"bg-emerald-100 text-emerald-600":"bg-indigo-50 text-indigo-600"}`,children:N?a.jsx(kt,{className:"w-5 h-5"}):a.jsx(Sa,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"font-bold text-slate-900 text-sm font-display",children:"Google Workspace"}),a.jsx("p",{className:"text-[11px] text-slate-500",children:"Connect your own Google account so your voice agent can send email, create calendar events, and read/write your sheets."})]}),a.jsx("span",{className:`px-2 py-1 rounded-full text-[10px] font-bold uppercase ${N?"bg-emerald-100 text-emerald-700":"bg-slate-100 text-slate-500"}`,children:N?"Connected":"Not connected"})]}),N?a.jsxs("div",{className:"bg-slate-50 rounded-xl p-3 space-y-1.5",children:[a.jsx("div",{className:"flex items-center gap-2 text-xs text-slate-700",children:a.jsx("span",{className:"font-mono font-bold",children:n.googleEmail??"—"})}),a.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:["Scopes: ",(n.scopes??[]).map(j=>j.split("/").pop()).join(" · ")||"—"]}),a.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:["Connected ",n.connectedAt?new Date(n.connectedAt).toLocaleString():"—",n.lastSyncedAt?` · last sync ${new Date(n.lastSyncedAt).toLocaleString()}`:""]}),n.lastError?a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-rose-600 bg-rose-50 border border-rose-200 rounded-lg px-2 py-1.5",children:[a.jsx(xa,{className:"w-3 h-3"})," ",n.lastError]}):null]}):null,a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:N?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:S,disabled:c!==null,className:"inline-flex items-center gap-1.5 text-xs font-bold text-slate-700 bg-slate-100 hover:bg-slate-200 px-3 py-2 rounded-xl transition-all cursor-pointer disabled:opacity-60",children:[c==="test"?a.jsx(Bi,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Uu,{className:"w-3.5 h-3.5"}),"Test"]}),a.jsxs("button",{onClick:b,disabled:c!==null,className:"inline-flex items-center gap-1.5 text-xs font-bold text-rose-600 bg-rose-50 hover:bg-rose-100 px-3 py-2 rounded-xl transition-all cursor-pointer disabled:opacity-60",children:[c==="disconnect"?a.jsx(Bi,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(fn,{className:"w-3.5 h-3.5"}),"Disconnect"]})]}):a.jsxs("button",{onClick:x,disabled:c!==null,className:"inline-flex items-center gap-1.5 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 px-3.5 py-2 rounded-xl transition-all cursor-pointer disabled:opacity-60",children:[c==="connect"?a.jsx(Bi,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Sa,{className:"w-3.5 h-3.5"}),"Connect Google"]})}),d?a.jsxs("div",{className:`flex items-start gap-2 text-[11px] rounded-lg px-3 py-2 ${d.kind==="ok"?"text-emerald-700 bg-emerald-50 border border-emerald-200":"text-rose-700 bg-rose-50 border border-rose-200"}`,children:[d.kind==="ok"?a.jsx(kt,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}
737):a.jsx(xa,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),a.jsx("span",{children:d.text})]}):null,a.jsxs("div",{className:"bg-slate-50 border border-slate-100 rounded-xl p-3 text-[10px] text-slate-500 leading-relaxed space-y-1",children:[a.jsxs("div",{className:"font-bold text-slate-600 uppercase tracking-wide flex items-center gap-1",children:[a.jsx(xa,{className:"w-3 h-3"})," Consent-screen notes"]}),a.jsxs("p",{children:["If Google shows ",a.jsx("em",{children:'"app is being tested"'})," — your account isn't whitelisted yet; ask your agency to add it as a Test user in the Google Cloud console."]}),a.jsxs("p",{children:["If Google shows ",a.jsx("em",{children:`"Google hasn't verified this app"`})," — that's expected while the app is published but not yet verified; you can proceed and connections work (up to Google's user cap)."]})]})]}),a.jsxs("div",{className:`${rt} p-4 space-y-2`,children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-slate-700",children:[a.jsx(SX,{className:"w-3.5 h-3.5 text-slate-400"})," Recent sync activity"]}),i===void 0?a.jsx(Bi,{className:"w-4 h-4 text-indigo-500 animate-spin"}):i.length===0?a.jsx("p",{className:"text-[11px] text-slate-400",children:"No syncs yet. Bookings and leads sync automatically once connected."}):a.jsx("div",{className:"space-y-1 max-h-48 overflow-auto",children:i.map(j=>a.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-mono text-slate-500",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${j.status==="ok"?"bg-emerald-500":j.status==="error"?"bg-rose-500":"bg-slate-300"}`}),a.jsx("span",{className:"shrink-0",children:new Date(j.createdAt).toLocaleTimeString()}),a.jsx("span",{className:"text-slate-600",children:j.kind}),a.jsx("span",{className:"text-slate-400 truncate flex-1",children:j.detail??j.status})]},j._id))})]})]})}const PCe={draft:"bg-slate-100 text-slate-600 border-slate-200",active:"bg-emerald-50 text-emerald-700 border-emerald-200",paused:"bg-amber-50 text-amber-700 border-amber-200"};function _Ce({clientId:e}){const t=et(me.voiceAgents.listVas,{clientId:e})??[];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-slate-800 block text-sm font-display",children:"Voice Agents"}),a.jsx("span",{className:"text-[10px] text-slate-400",children:"The voice agents answering calls for your business — their greeting, persona, voice, and live call load. Contact your account admin to add or edit an agent."})]}),t.length===0?a.jsx("div",{className:"border border-dashed border-slate-200 rounded-2xl p-6 text-center text-xs text-slate-400 bg-slate-50/30",children:"No voice agents configured yet. Your account admin can create one for you."}):a.jsx("div",{className:"space-y-2.5",children:t.map(n=>a.jsx("div",{className:`bg-white border rounded-xl p-3.5 shadow-sm ${n.status==="paused"?"border-amber-200":"border-slate-100"}`,children:a.jsx("div",{className:"flex items-start justify-between gap-3",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(ny,{className:"w-4 h-4 text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-bold text-slate-800 text-sm truncate",children:n.name}),a.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${PCe[n.status]}`,children:n.status}),n.isDefault&&a.jsxs("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded bg-indigo-600 text-white flex items-center gap-1",children:[a.jsx(Um,{className:"w-2.5 h-2.5 fill-current"})," Default"]})]}),(n.greeting||n.personaPrompt)&&a.jsxs("div",{className:"mt-1 text-[11px] text-slate-500",children:[n.greeting?a.jsxs("span",{children:["“",n.greeting,"”"]}):null,n.personaPrompt?a.jsx("span",{className:"block italic text-slate-400 line-clamp-2",children:n.personaPrompt}):null]}),a.jsx("div",{className:"mt-1.5",children:a.jsx(MCe,{vaId:n._id,maxConcurrentCalls:n.maxConcurrentCalls,status:n.status})})]})})},n._id))})]})}function MCe({vaId:e,maxConcurrentCalls:t,status:n}){const i=et(me.voiceAgents.getVaEffectiveConfig,{vaId:e});if(i===void 0)return a.jsx("span",{className:"text-[10px] text-slate-400",children:"quota …"});const r=i.activeCount??0,s=i.quota??"?",l=i.ceiling??"?",c=t!=null?` (override ${t})`:"",h=typeof s=="number"&&r>=s;return a.jsxs("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded border ${h?"bg-amber-50 text-amber-700 border-amber-200":"bg-slate-50 text-slate-600 border-slate-200"}`,title:`Effective quota = VA override ?? ceiling. Ceiling ${l}. Active calls right now.`,children:[n==="active"?`${r}/${s} active`:"inactive"," · ceiling ",l,c]})}const RCe=["Asia/Karachi","Asia/Kolkata","Asia/Dhaka","Asia/Riyadh","Asia/Dubai","Europe/London","Europe/Paris","Europe/Berlin","America/Ne
737w_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","Australia/Sydney"],OCe=e=>{const t=e.getDay(),n=t===0?-6:1-t,i=new Date(e);i.setDate(e.getDate()+n);const r=[],s=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];for(let l=0;l<7;l++){const c=new Date(i);c.setDate(i.getDate()+l);const h=c.getDate(),d=c.getMonth()+1,f=c.getFullYear(),p=d<10?`0${d}`:`${d}`,v=h<10?`0${h}`:`${h}`,x=`${f}-${p}-${v}`;r.push({label:`${s[l]} ${h}`,dateNum:h,fullDate:x,dateObj:c})}return r};function ICe({client:e,leads:t,slots:n,kbItems:i,workflows:r,onUpdateGreeting:s,onAddSlot:l,onDeleteSlot:c,onGenerateSlots:h,onAddKbItem:d,onDeleteKbItem:f,onLogout:p,onBookSlot:v,onAddLead:x,onUpdateLead:b,onUpdateClient:S}){var In,Mi,Ur,$n,li,ci,ot,Wt,Jt,$t;const[N,j]=w.useState("overview"),[T,E]=w.useState("contacts"),[C,P]=w.useState(""),A=r==null?void 0:r.find(te=>te.id===e.assignedWorkflowId),M=A?A.name:"Web Receptionist",[R,B]=w.useState(null),U=(te,Fe="success")=>{B({message:te,type:Fe}),setTimeout(()=>B(null),4e3)},[O,F]=w.useState(e.greetingPrompt),[ne,re]=w.useState(!1),[Q,W]=w.useState(e.widgetColor||"#4f46e5"),[q,$]=w.useState(e.widgetTitle||e.companyName||"Vox Bridge Assistant"),[ge,ue]=w.useState(e.widgetIcon||"phone"),[L,J]=w.useState({realtimeProvider:((In=e.voicePipelineConfig)==null?void 0:In.realtimeProvider)??"",realtimeModel:((Mi=e.voicePipelineConfig)==null?void 0:Mi.realtimeModel)??"",realtimeVoice:((Ur=e.voicePipelineConfig)==null?void 0:Ur.realtimeVoice)??"",language:(($n=e.voicePipelineConfig)==null?void 0:$n.language)??""}),[ye,Pe]=w.useState(!1),Oe=et(me.queries.effectiveVoicePipeline,e?{clientId:e.id}:"skip"),je=(li=Oe==null?void 0:Oe.config)==null?void 0:li.realtimeProvider,Ke=et(me.billing.checkBalance,e?{clientId:e.id}:"skip"),le=et(me.dashboardGates.getClientDashboardConfig,e?{clientId:e.id}:"skip"),Be={merchant:!!((ci=le==null?void 0:le.toolKeys)!=null&&ci.includes("merchant-store")),phone:(((ot=le==null?void 0:le.phoneNumbers)==null?void 0:ot.length)??0)>0||!!(le!=null&&le.hasExtensions),voiceAgents:((le==null?void 0:le.vaCount)??1)>1},De=((Jt=(Wt=le==null?void 0:le.phoneNumbers)==null?void 0:Wt[0])==null?void 0:Jt.number)??null,be=((($t=le==null?void 0:le.phoneNumbers)==null?void 0:$t.length)??0)>0;w.useEffect(()=>{!Be.merchant&&N==="merchant"&&j("overview"),!Be.phone&&N==="phone"&&j("overview"),!Be.voiceAgents&&N==="voice-agents"&&j("overview")},[Be,N]),w.useEffect(()=>{F(e.greetingPrompt),W(e.widgetColor||"#4f46e5"),$(e.widgetTitle||e.companyName||"Vox Bridge Assistant"),ue(e.widgetIcon||"phone");const te=e.voicePipelineConfig??{};J({realtimeProvider:te.realtimeProvider??"",realtimeModel:te.realtimeModel??"",realtimeVoice:te.realtimeVoice??"",language:te.language??""}),Lt(e.timezone||"")},[e]);const[nt,ze]=w.useState(""),[Le,ht]=w.useState("week"),[yt,on]=w.useState(new Date),[bt,Vt]=w.useState(20),[tn,Qt]=w.useState("09:00 AM"),[Cn,pt]=w.useState("05:00 PM"),[kn,Lt]=w.useState(e.timezone||""),[On,zt]=w.useState(!1),si=w.useRef(!1),[qn,qt]=w.useState("channel-web"),[ai,Zn]=w.useState("sarah"),[ct,ln]=w.useState(null),[Ut,Wn]=w.useState(null),_i=w.useRef(void 0),[nn,Bt]=w.useState({});w.useEffect(()=>{si.current||N==="scheduler"&&(n.length>0||h&&(si.current=!0,(async()=>{zt(!0);try{await h({clientId:e.id,workStart:tn,workEnd:Cn,gapMinutes:bt,daysAhead:14,clearExisting:!0})}finally{zt(!1)}})()))},[N,n.length]),w.useEffect(()=>{if(ct!=null&&ct.isActive&&ct.data){const te=_i.current,Fe=ct.data,dt={};let He=!1;Fe.name&&(!te||te.name!==Fe.name)&&(dt.name=!0,He=!0),Fe.phone&&(!te||te.phone!==Fe.phone)&&(dt.phone=!0,He=!0),Fe.email&&(!te||te.email!==Fe.email)&&(dt.email=!0,He=!0),Fe.purpose&&(!te||te.purpose!==Fe.purpose)&&(dt.purpose=!0,He=!0),Fe.bookedSlot&&(!te||te.bookedSlot!==Fe.bookedSlot)&&(dt.bookedSlot=!0,He=!0),He&&(Bt(H=>({...H,...dt})),setTimeout(()=>{Bt(H=>{const se={...H};return Object.keys(dt).forEach(G=>{se[G]=!1}),se})},1e3)),_i.current={...Fe}}else ct!=null&&ct.isActive||(_i.current=void 0)},[ct]);const Dt=t.filter(te=>te.clientId===e.id),K=Dt.filter(te=>te.status==="booked").length,Ze=Dt.filter(te=>te.status==="new").length,Ft=n.filter(te=>te.clientId===e.id),jt=()=>{if(!ct||!ct.isActive)return null;const te=ct.data;return a.jsxs("div",{id:"live-call-monitor-card",className:"bg-slate-950 text-white rounded-2xl p-6 border border-slate-800 shadow-xl space-y-5",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-slate-800 pb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"relative",children:a.jsxs("span",{className:"flex h-3.5 w-3.5 relative",children:[a.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-rose-400 opacity-75"}),a.jsx("span",{className:"relative inline-flex rounded-full h-3.5 w-3.5 bg-rose-500"})]})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-extrabold text-sm font-display tracking-wide uppercase text-slate-200",children:"🔴 Live Voice Intake & Recording Active"}),a.jsx("p",{className:"text-[10px] text-slate-400 font-mono mt-0.5",children:"Sarah S2S Voice Receptionist • Real-time Speech-to-Text & Data Extraction • 16000Hz PCM Stream"})]})]}),a.jsxs("div",{className:"flex items-center gap-1 bg-slate-900/80 px-4 py-2 rounded-xl border border-slate-800",children:[a.jsx("span",{className:"text-[9px] font-mono text-indigo-400 uppercase font-bold mr-1",children:"Signal Wave:"}),a.jsx("div",{className:"h-3 w-1 bg-indigo-500 rounded-full animate-bounce",style:{animationDelay:"0.1s",animationDuration:"0.8s"}}),a.jsx("div",{className:"h-4.5 w-1 bg-violet-400 rounded-full animate-bounce",style:{animationDelay:"0.3s",animationDuration:"0.6s"}}),a.jsx("div",{className:"h-6 w-1 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"0.2s",animationDuration:"1s"}}),a.jsx("div",{className:"h-4 w-1 bg-purple-500 rounded-full animate-bounce",style:{animationDelay:"0.5s",animationDuration:"0.7s"}}),a.jsx("div",{className:"h-2.5 w-1 bg-fuchsia-400 rounded-full animate-bounce",style:{animationDelay:"0.4s",animationDuration:"0.5s"}})]})]}),a.jsxs("div",{className:"space-y-3 font-sans text-left",children:[a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col sm:flex-row sm:items-center justify-between gap-3 transition-all duration-300 ${nn.name?"bg-emerald-900 border-emerald-400 ring-2 ring-emerald-500 shadow-[0_0_15px_rgba(16,185,129,0.5)] scale-[1.01]":te.name?"bg-emerald-950/40 border-emerald-800/60":"bg-slate-900/40 border-slate-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${te.name?"bg-emerald-900/50 text-emerald-400":"bg-slate-800 text-slate-500"}`,children:a.jsx(qo,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wider block",children:"1. Full Name"}),a.jsx("span",{className:`text-xs font-semibold ${te.name?"text-emerald-200":"text-slate-500 font-mono italic animate-pulse"}`,children:te.name||"Awaiting input..."})]})]}),a.jsx("div",{className:"flex items-center",children:te.name?a.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-md font-bold uppercase ${nn.name?"bg-emerald-400 text-slate-950 animate-bounce":"bg-emerald-950/80 text-emerald-400 border border-emerald-800/60"}`,children:nn.name?"⚡ Capturing...":"✓ Extracted"}):a.jsx("span",{className:"text-[8px] px-2 py-0.5 rounded-md font-mono text-slate-500 uppercase bg-slate-900 border border-slate-800",children:"Listening"})})]}),a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col sm:flex-row sm:items-center justify-between gap-3 transition-all duration-300 ${nn.phone?"bg-emerald-900 border-emerald-400 ring-2 ring-emerald-500 shadow-[0_0_15px_rgba(16,185,129,0.5)] scale-[1.01]":te.phone?"bg-emerald-950/40 border-emerald-800/60":"bg-slate-900/40 border-slate-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${te.phone?"bg-emerald-900/50 text-emerald-400":"bg-slate-800 text-slate-500"}`,children:a.jsx(Ei,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wider block",children:"2. Contact Phone"}),a.jsx("span",{className:`text-xs font-semibold ${te.phone?"text-emerald-200":"text-slate-500 font-mono italic"}`,children:te.phone||"Awaiting input..."})]})]}),a.jsx("div",{className:"flex items-center",children:te.phone?a.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-md font-bold uppercase ${nn.phone?"bg-emerald-400 text-slate-950 animate-bounce":"bg-emerald-950/80 text-emerald-400 border border-emerald-800/60"}`,children:nn.phone?"⚡ Capturing...":"✓ Extracted"}):a.jsx("span",{className:"text-[8px] px-2 py-0.5 rounded-md font-mono text-slate-500 uppercase bg-slate-900 border border-slate-800",children:"Listening"})})]}),a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col sm:flex-row sm:items-center justify-between gap-3 transition-all duration-300 ${nn.email?"bg-emerald-900 border-emerald-400 ring-2 ring-emerald-500 shadow-[0_0_15px_rgba(16,185,129,0.5)] scale-[1.01]":te.email?"bg-emerald-950/40 border-emerald-800/60":"bg-slate-900/40 border-slate-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${te.email?"bg-emerald-900/50 text-emerald-400":"bg-slate-800 text-slate-500"}`,children:a.jsx(uc,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wider block",children:"3. Email Address"}),a.jsx("span",{className:`text-xs font-semibold ${te.email?"text-emerald-200":"text-slate-500 font-mono italic"}`,children:te.email||"Awaiting input..."})]})]}),a.jsx("div",{className:"flex items-center",children:te.email?a.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-md font-bold uppercase ${nn.email?"bg-emerald-400 text-slate-950 animate-bounce":"bg-emerald-950/80 text-emerald-400 border border-emerald-800/60"}`,children:nn.email?"⚡ Capturing...":"✓ Extracted"}):a.jsx("span",{className:"text-[8px] px-2 py-0.5 rounded-md font-mono text-slate-500 uppercase bg-slate-900 border border-slate-800",children:"Listening"})})]}),a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col sm:flex-row sm:items-center justify-between gap-3 transition-all duration-300 ${nn.purpose?"bg-emerald-900 border-emerald-400 ring-2 ring-emerald-500 shadow-[0_0_15px_rgba(16,185,129,0.5)] scale-[1.01]":te.purpose?"bg-emerald-950/40 border-emerald-800/60":"bg-slate-900/40 border-slate-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${te.purpose?"bg-emerald-900/50 text-emerald-400":"bg-slate-800 text-slate-500"}`,children:a.jsx(Ya,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wider block",children:"4. Intake Purpose"}),a.jsx("span",{className:`text-xs font-semibold ${te.purpose?"text-emerald-200":"text-slate-500 font-mono italic"}`,children:te.purpose||"Awaiting input..."})]})]}),a.jsx("div",{className:"flex items-center",children:te.purpose?a.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-md font-bold uppercase ${nn.purpose?"bg-emerald-400 text-slate-950 animate-bounce":"bg-emerald-950/80 text-emerald-400 border border-emerald-800/60"}`,children:nn.purpose?"⚡ Capturing...":"✓ Extracted"}):a.jsx("span",{className:"text-[8px] px-2 py-0.5 rounded-md font-mono text-slate-500 uppercase bg-slate-900 border border-slate-800",children:"Listening"})})]}),a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col sm:flex-row sm:items-center justify-between gap-3 transition-all duration-300 ${nn.bookedSlot?"bg-emerald-900 border-emerald-400 ring-2 ring-emerald-500 shadow-[0_0_15px_rgba(16,185,129,0.5)] scale-[1.01]":te.bookedSlot?"bg-emerald-950/40 border-emerald-800/60":"bg-slate-900/40 border-slate-800"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${te.bookedSlot?"bg-emerald-900/50 text-emerald-400":"bg-slate-800 text-slate-500"}`,children:a.jsx(aa,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wider block",children:"5. Appointment Slot"}),a.jsx("span",{className:`text-xs font-semibold ${te.bookedSlot?"text-emerald-200":"text-slate-500 font-mono italic"}`,children:te.bookedSlot||"Negotiating slot..."})]})]}),a.jsx("div",{className:"flex items-center",children:te.bookedSlot?a.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-md font-bold uppercase ${nn.bookedSlot?"bg-emerald-400 text-slate-950 animate-bounce":"bg-emerald-950/80 text-emerald-400 border border-emerald-800/60"}`,children:nn.bookedSlot?"⚡ Booked! 🎉":"✓ Scheduled 🎉"}):a.jsx("span",{className:"text-[8px] px-2 py-0.5 rounded-md font-mono text-slate-500 uppercase bg-slate-900 border border-slate-800",children:"Listening"})})]})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 p-3 rounded-xl flex flex-col sm:flex-row items-center justify-between gap-3 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2 text-slate-400 font-mono text-[10px]",children:[a.jsx(D0,{className:"w-3.5 h-3.5 text-indigo-400 animate-pulse"}),a.jsx("span",{children:"PostgreSQL Synchronized Node:"}),a.jsx("span",{className:"text-emerald-400 font-bold bg-emerald-950/50 border border-emerald-800/30 px-1.5 py-0.5 rounded animate-pulse",children:"● Active Live-Listening and Indexing Stream"})]}),a.jsx("span",{className:"text-[9px] font-mono text-slate-500 bg-slate-950 border border-slate-800 px-2 py-1 rounded",children:"Auto-Saving call recording & data to CRM..."})]})]})},oi=()=>
737{if(!Ut||ct!=null&&ct.isActive)return null;const te=Ut.data,Fe=te.name||te.phone||te.email||te.purpose||te.bookedSlot,dt=[{label:"Full Name",value:te.name,icon:qo},{label:"Phone",value:te.phone,icon:Ei},{label:"Email",value:te.email,icon:uc},{label:"Purpose",value:te.purpose,icon:Ya},{label:"Booked Slot",value:te.bookedSlot,icon:aa}];return a.jsxs("div",{className:"bg-white rounded-2xl p-5 border border-slate-200 shadow-sm space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-slate-100 pb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-500"}),a.jsx("h4",{className:"font-bold text-sm font-display tracking-wide uppercase text-slate-700",children:"Last Call Summary"})]}),a.jsx("button",{onClick:()=>Wn(null),className:"text-[10px] text-slate-400 hover:text-slate-600 font-mono",title:"Dismiss",children:"dismiss"})]}),Fe?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 font-sans",children:dt.map(He=>{const H=He.icon;return a.jsxs("div",{className:"flex items-center gap-2 p-2.5 rounded-lg bg-slate-50 border border-slate-100",children:[a.jsx("div",{className:"p-1.5 rounded-md bg-indigo-50 text-indigo-500",children:a.jsx(H,{className:"w-3.5 h-3.5"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("span",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-wider block",children:He.label}),a.jsx("span",{className:`text-xs font-semibold ${He.value?"text-slate-700":"text-slate-300 italic"}`,children:He.value||"—"})]})]},He.label)})}):a.jsx("p",{className:"text-xs text-slate-400 italic",children:"The call ended before any visitor details were captured. A lead row was still created — check the CRM tab."}),Ut.recordingUrl?a.jsxs("a",{href:Ut.recordingUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-semibold text-indigo-600 hover:text-indigo-500",children:[a.jsx(Sv,{className:"w-3.5 h-3.5"})," Play call recording"]}):a.jsx("p",{className:"text-[11px] text-slate-400",children:"Recording may still be uploading to R2 — it attaches to the lead row in the CRM tab once the upload completes."})]})},Gi=async()=>{re(!0);try{S?await S({id:e.id,greetingPrompt:O,widgetColor:Q,widgetTitle:q,widgetIcon:ge}):await s(O),U("AI Receptionist settings updated successfully!","success")}catch(te){console.error("Failed to save settings:",te),U("Failed to save settings: "+((te==null?void 0:te.message)||String(te)),"error")}finally{re(!1)}},fr=async()=>{Pe(!0);try{const te=new Set(["realtimeProvider","realtimeModel"]),Fe={};for(const[dt,He]of Object.entries(L))te.has(dt)||He.trim()!==""&&(Fe[dt]=He.trim());Fe.realtimeProvider="",Fe.realtimeModel="",S&&await S({id:e.id,voicePipelineConfig:Fe,timezone:kn}),U("Voice profile & language updated!","success")}catch(te){console.error("Failed to save voice config:",te),U("Failed to save voice config: "+((te==null?void 0:te.message)||String(te)),"error")}finally{Pe(!1)}},Yi=(()=>{const te=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Fe={Mon:{Inquiries:12,Bookings:3},Tue:{Inquiries:18,Bookings:6},Wed:{Inquiries:15,Bookings:4},Thu:{Inquiries:22,Bookings:8},Fri:{Inquiries:26,Bookings:11},Sat:{Inquiries:8,Bookings:2},Sun:{Inquiries:14,Bookings:5}},dt=te[new Date().getDay()],He=new Date().toLocaleDateString(),H=Dt.filter(V=>{try{return new Date(V.timestamp).toLocaleDateString()===He||V.timestamp.includes("Today")||V.timestamp.includes("2026-06-26")}catch{return V.timestamp.includes("Today")||V.timestamp.includes("2026-06-26")}}),se=H.length,G=H.filter(V=>V.status==="booked").length;return Object.keys(Fe).map(V=>{const ie=Fe[V];return V===dt?{date:V,Inquiries:ie.Inquiries+se,Bookings:ie.Bookings+G}:{date:V,...ie}})})();return a.jsxs("div",{className:"min-h-screen bg-slate-50 text-slate-800 font-sans flex flex-col relative",children:[R&&a.jsxs("div",{className:`fixed top-5 right-5 z-50 flex items-center gap-2.5 px-4.5 py-3 rounded-2xl shadow-xl border text-xs font-bold transition-all duration-300 max-w-sm ${R.type==="success"?"bg-emerald-900 border-emerald-800 text-emerald-100":R.type==="error"?"bg-rose-900 border-rose-800 text-rose-100":"bg-indigo-950 border-indigo-900 text-indigo-100"}`,children:[R.type==="success"?a.jsx(kt,{className:"w-4.5 h-4.5 text-emerald-400 shrink-0"}
737):a.jsx(xa,{className:"w-4.5 h-4.5 text-indigo-400 shrink-0"}),a.jsx("p",{children:R.message})]}),a.jsxs("header",{className:"bg-slate-900 text-white px-6 py-4 flex items-center justify-between border-b border-slate-800 sticky top-0 z-30 shadow-md",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-indigo-600 p-2 rounded-xl text-white",children:a.jsx(f5,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-bold text-lg font-display tracking-tight",children:e.companyName}),a.jsx("span",{className:"text-[9px] bg-emerald-500 text-white font-bold uppercase px-1.5 py-0.5 rounded-md",children:"CLIENT PORTAL"})]}),a.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:["Assigned Representative: ",M]})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-right hidden sm:block",children:[a.jsx("span",{className:"text-[10px] text-slate-400 block font-semibold uppercase",children:"Token Credit Balance"}),a.jsxs("span",{className:"text-sm font-bold text-emerald-400 font-mono",children:["$",e.balance.toFixed(2)]})]}),a.jsx("button",{onClick:p,className:"border border-slate-800 hover:bg-slate-800 text-slate-300 hover:text-white px-3 py-2 rounded-xl text-xs font-semibold transition-all cursor-pointer",children:"Exit Dashboard"})]})]}),a.jsxs("div",{className:"flex-1 max-w-7xl w-full mx-auto p-4 md:p-6 grid grid-cols-1 lg:grid-cols-12 gap-6",children:[a.jsxs("aside",{className:"lg:col-span-3 space-y-2",children:[a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4 space-y-1",children:[a.jsx(en,{icon:qo,label:"Caller Lead Insights",tab:"overview",activeTab:N,setActiveTab:j}),a.jsx(Xl,{title:"Receptionist"}),a.jsx(en,{icon:xs,label:"Override Greeting Message",tab:"receptionist",activeTab:N,setActiveTab:j}),a.jsx(en,{icon:aa,label:"Configure Time Slots",tab:"scheduler",activeTab:N,setActiveTab:j}),a.jsx(Xl,{title:"Records & Channels"}),a.jsx(en,{icon:zs,label:"Communications",tab:"communications",activeTab:N,setActiveTab:j}),a.jsx(en,{icon:Sa,label:"Connections",tab:"connections",activeTab:N,setActiveTab:j}),Be.merchant&&a.jsx(en,{icon:Sa,label:"Merchant Store",tab:"merchant",activeTab:N,setActiveTab:j}),Be.phone&&a.jsx(en,{icon:Ei,label:"Phone",tab:"phone",activeTab:N,setActiveTab:j}),a.jsx(Xl,{title:"Voice & Testing"}),Be.voiceAgents&&a.jsx(en,{icon:ny,label:"Voice Agents",tab:"voice-agents",activeTab:N,setActiveTab:j}),a.jsx(en,{icon:gu,label:"Audition & Sandbox",tab:"sandbox",activeTab:N,setActiveTab:j})]}),a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-4 space-y-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2 px-1",children:[a.jsx(ZY,{className:"w-4 h-4 text-indigo-500"}),a.jsx("h4",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Install Web Receptionist"})]}),a.jsx("p",{className:"text-[10px] text-slate-500 leading-relaxed px-1",children:"Paste this snippet into your site HTML (before </body>) to add a floating call button."}),a.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-2 font-mono text-[9px] text-slate-700 break-all leading-relaxed select-all",children:['<script src="',window.location.origin,'/widget.js" data-client-id="',e.id,'" async><\/script>']}),a.jsx("button",{onClick:()=>{const te=`<script src="${window.location.origin}/widget.js" data-client-id="${e.id}" async><\/script>`;navigator.clipboard&&navigator.clipboard.writeText?(navigator.clipboard.writeText(te),U("Widget snippet copied — paste it into your site HTML!","success")):U("Widget Code: "+te,"info")},className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-semibold py-1.5 rounded-xl text-[10px] transition-all cursor-pointer",children:"Copy Widget JS Snippet"})]})]}),a.jsxs("main",{className:"lg:col-span-9 space-y-6",children:[N==="overview"&&a.jsxs("div",{className:"space-y-6",children:[(()=>{const te=Ke;if(!te||typeof te.balanceCents!="number")return null;const Fe=te.balanceCents/100,dt=te.minutesRemaining??0,He=te.includedMinutes??0,H=Math.max(0,He-dt),se=te.allow,G=te.mode??"hard",V=He>0?Math.min(100,Math.round(dt/He*100)):0,ie=!se;return a.jsxs("div",{className:`rounded-2xl p-5 border shadow-sm space-y-4 ${ie?"bg-rose-50 border-rose-200":"bg-white border-slate-100"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`p-2 rounded-xl ${ie?"bg-rose-100 text-rose-600":"bg-indigo-50 text-indigo-600"}
737`,children:ie?a.jsx(xa,{className:"w-5 h-5"}):a.jsx(f5,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-sm font-display text-slate-900",children:"Plan Balance & Minutes"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:G==="warn"?"Warn mode — calls stay connected when low.":"Hard gate — a call starts only while this is positive."})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("span",{className:"text-[10px] text-slate-400 block font-semibold uppercase",children:"Credit Balance"}),a.jsxs("span",{className:`text-xl font-extrabold font-mono ${ie?"text-rose-600":"text-emerald-600"}`,children:["$",Fe.toFixed(2)]})]})]}),He>0?a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-[11px] font-semibold",children:[a.jsx("span",{className:"text-slate-600",children:"Included minutes this cycle"}),a.jsxs("span",{className:ie?"text-rose-600":"text-slate-700",children:[dt," remaining · ",H," used of ",He]})]}),a.jsx("div",{className:"h-2 w-full rounded-full bg-slate-100 overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full transition-all ${ie?"bg-rose-500":"bg-indigo-500"}`,style:{width:`${V}%`}})})]}):a.jsx("p",{className:"text-[11px] text-slate-500",children:"Pay-as-you-go plan — every minute is billed from your credit balance as you go."}),ie&&te.reason?a.jsxs("div",{className:"flex items-start gap-2 bg-rose-100/70 border border-rose-200 rounded-xl p-3 text-[11px] text-rose-800",children:[a.jsx(xa,{className:"w-4 h-4 shrink-0 mt-0.5"}),a.jsxs("span",{children:[te.reason," Top up via your agency to resume calls."]})]}):null]})})(),jt(),(()=>{const te=new Date,Fe=te.getFullYear(),dt=String(te.getMonth()+1).padStart(2,"0"),He=String(te.getDate()).padStart(2,"0"),H=`${Fe}-${dt}-${He}`,se=Ft.filter(G=>G.dateTime.startsWith(H)).sort((G,V)=>G.dateTime.localeCompare(V.dateTime));return a.jsxs("div",{className:`${rt} p-5 space-y-4`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"bg-indigo-50 p-2 rounded-xl text-indigo-700",children:a.jsx(aa,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-slate-900 text-sm font-display",children:"Today's Slots"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Live availability — updates the moment a slot is booked."})]})]}),a.jsxs("span",{className:"text-[10px] bg-slate-100 text-slate-500 font-bold px-2.5 py-1 rounded-md",children:[se.filter(G=>G.isFilled).length," / ",se.length," booked"]})]}),se.length===0?a.jsxs("div",{className:"text-center py-6 px-4 bg-slate-50 rounded-xl border border-dashed border-slate-200",children:[a.jsx("p",{className:"text-xs text-slate-500",children:"No slots scheduled for today."}),a.jsx("button",{onClick:()=>j("scheduler"),className:"mt-2 text-[11px] font-bold text-indigo-600 hover:text-indigo-800 cursor-pointer",children:"Open Configure Time Slots"})]}):a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-2.5",children:se.map(G=>{const V=G.dateTime.slice(11);return a.jsxs("div",{className:`px-3 py-2.5 rounded-xl border text-xs flex flex-col gap-1 ${G.isFilled?"bg-emerald-50 border-emerald-100 text-emerald-900":"bg-indigo-50/30 border-indigo-100 text-slate-800"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono font-bold",children:V||G.dateTime}),a.jsx("span",{className:`text-[9px] font-bold uppercase px-1.5 py-0.5 rounded ${G.isFilled?"bg-emerald-200 text-emerald-800":"bg-indigo-200 text-indigo-800"}`,children:G.isFilled?"Booked":"🟢 Open"})]}),G.isFilled&&a.jsxs("div",{className:"text-[10px] text-emerald-950/80 truncate",children:[G.bookedBy||"Booked",G.bookedPurpose?` · "${G.bookedPurpose}"`:""]})]},G.id)})})]})})(),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsx(ir,{icon:qo,label:"TOTAL INTAKES",value:`${Dt.length} callers`,sub:"Collected from live website chats"}),a.jsx(ir,{icon:aa,label:"CALENDAR BOOKINGS",value:`${K} scheduled`,sub:"Booked via lead callbacks",tone:"emerald"}),a.jsx(ir,{icon:xa,label:"UNRESOLVED INQUIRIES",value:`${Ze} follow-ups`,sub:"Awaiting phone/email follow-up",tone:"rose"})]}),a.jsxs("div",{className:`${rt} p-6`,children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-900 font-display",children:"Weekly Lead Generation"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Calls answered versus direct appointments scheduled."})]}),a.jsx("span",{className:"text-xs font-semibold bg-indigo-50 text-indigo-700 px-2.5 py-1 rounded-lg",children:"Realtime logs"})]}),a.jsx("div",{className:"h-64",children:a.jsx(uT,{width:"100%",height:"100%",children:a.jsxs(P2,{data:Yi,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsxs("defs",{children:[a.jsxs("linearGradient",{id:"colorCalls",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",
737stopColor:"#4f46e5",stopOpacity:.15}),a.jsx("stop",{offset:"95%",stopColor:"#4f46e5",stopOpacity:0})]}),a.jsxs("linearGradient",{id:"colorBooked",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.15}),a.jsx("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),a.jsx(gb,{strokeDasharray:"3 3",vertical:!1}),a.jsx(vb,{dataKey:"date",tick:{fontSize:10}}),a.jsx(xb,{tick:{fontSize:10}}),a.jsx(v2,{}),a.jsx(Ah,{type:"monotone",dataKey:"Inquiries",stroke:"#4f46e5",fillOpacity:1,fill:"url(#colorCalls)"}),a.jsx(Ah,{type:"monotone",dataKey:"Bookings",stroke:"#10b981",fillOpacity:1,fill:"url(#colorBooked)"})]})})})]})]}),N==="receptionist"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:`${rt} p-6 space-y-6`,children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-bold font-display text-slate-900",children:["Configure ",M,"'s Greeting"]}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Customize the opening statement spoken by the digital receptionist when website visitors start an audio call."})]}),a.jsxs("div",{className:"space-y-4 font-sans",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Agent Opening Speech Script"}),a.jsx("textarea",{rows:4,value:O,onChange:te=>F(te.target.value),className:"w-full border border-slate-200 rounded-lg px-3 py-2 mt-1 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-600 font-sans",placeholder:"Hello! Welcome to our office. I can assist you with..."}),a.jsx("p",{className:"text-[10px] text-slate-400 mt-1",children:"Make sure to include a clear call-to-action asking callers for their name and inquiry purpose."})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t border-slate-100",children:a.jsx("button",{onClick:Gi,disabled:ne,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 text-white font-semibold text-xs px-5 py-2.5 rounded-xl transition-all shadow-md cursor-pointer flex items-center gap-1.5",children:ne?"Updating Prompts...":a.jsxs(a.Fragment,{children:[a.jsx($i,{className:"w-4 h-4"})," Save Greeting Script"]})})})]})]}),a.jsxs("div",{className:`${rt} p-6 space-y-6`,children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"Voice Profile & Language"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Choose the voice (Male/Female, accents) and conversation language your receptionist uses. Overrides the agency/platform defaults; leave a field blank to inherit."})]}),a.jsxs("div",{className:"font-sans",children:[a.jsx(bb,{provider:je||L.realtimeProvider||"",voice:L.realtimeVoice,language:L.language,onChange:te=>J(Fe=>({...Fe,...te}))}),a.jsxs("div",{className:"pt-4 border-t border-slate-100 mt-4",children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Appointment Calendar Timezone"}),a.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:'Slots are generated + shown in this timezone. Leave on "Auto" to follow the language (Urdu→Karachi, English→New York).'}),a.jsxs("select",{value:kn,onChange:te=>Lt(te.target.value),className:"mt-2 w-full md:max-w-xs border border-slate-200 rounded-lg px-3 py-2 text-sm bg-white",children:[a.jsx("option",{value:"",children:"Auto (from language)"}),RCe.map(te=>a.jsx("option",{value:te,children:te},te))]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t border-slate-100 mt-4",children:a.jsx("button",{onClick:fr,disabled:ye,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 text-white font-semibold text-xs px-5 py-2.5 rounded-xl transition-all shadow-md cursor-pointer flex items-center gap-1.5",children:ye?"Saving Voice...":a.jsxs(a.Fragment,{children:[a.jsx($i,{className:"w-4 h-4"})," Save Voice Profile"]})})})]})]}),a.jsxs("div",{className:`${rt} p-6 space-y-6`,children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900",children:"Customize Web Widget Appearance"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Style the floating voice widget to match your website branding. Updates reflect instantly on all embedded sites."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 font-sans",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Theme Color (HEX)"}),a.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[a.jsx("input",{type:"color",value:Q,onChange:te=>W(te.target.value),className:"w-10 h-10 border border-slate-200 rounded-xl cursor-pointer p-0"}),a.jsx("input",{type:"text",value:Q,onChange:te=>W(te.target.value),className:"flex-1 border border-slate-200 rounded-xl px-3 py-2 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-600 font-mono",placeholder:"#4f46e5"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Widget Header Title"}),a.jsx("input",{type:"text",value:q,onChange:te=>$(te.target.value),className:"w-full border border-slate-200 rounded-xl px-3 py-2 mt-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-600",placeholder:"e.g. Smile Assistant"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-semibold text-slate-500 block",children:"Launcher Icon Style"}),a.jsxs("select",{value:ge,onChange:te=>ue(te.target.value),className:"w-full border border-slate-200 rounded-xl px-3 py-2 mt-1.5 text-xs bg-white focus:outline-none focus:ring-2 focus:ring-indigo-600 cursor-pointer",children:[a.jsx("option",{value:"phone",children:"📞 Phone / Receiver"}),a.jsx("option",{value:"bot",children:"🤖 Robot Assistant"}),a.jsx("option",{value:"support",children:"🎧 Support User"})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t border-slate-100",children:a.jsx("button",{onClick:Gi,disabled:ne,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-300 text-white font-semibold text-xs px-5 py-2.5 rounded-xl transition-all shadow-md cursor-pointer flex items-center gap-1.5",children:ne?"Saving Settings...":a.jsxs(a.Fragment,{children:[a.jsx($i,{className:"w-4 h-4"})," Save Widget Appearance"]})})})]})]}),N==="scheduler"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:`${rt} p-6 space-y-4`,children:[a.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] bg-indigo-50 text-indigo-700 font-bold uppercase px-2 py-1 rounded-md",children:"Calendar Policies"}),a.jsx("h3",{className:"text-lg font-bold font-display text-slate-900 mt-1",children:"S2S Reservation Slots Setup"}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Define your daily working window, appointment durations, and bulk generate slots instantly."})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("button",{onClick:async()=>
737{if(!h){U("Slot generation unavailable.","error");return}zt(!0);try{const te=await h({clientId:e.id,workStart:tn,workEnd:Cn,gapMinutes:bt,daysAhead:14,clearExisting:!0}),Fe=(te==null?void 0:te.created)??0;U(`Regenerated ${Fe} slots (${bt}-min gap, ${tn}–${Cn}) — open slots replaced.`,"success")}catch(te){U((te==null?void 0:te.message)||"Slot generation failed.","error")}finally{zt(!1)}},disabled:On,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-indigo-300 text-white font-bold text-xs px-4 py-2 rounded-xl transition-all shadow-md flex items-center gap-1.5 cursor-pointer",children:[a.jsx(xs,{className:"w-3.5 h-3.5"})," ",On?"Generating…":"Auto-Generate Slots"]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 pt-4 border-t border-slate-100 text-xs font-sans",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Slot Gap (Minutes)"}),a.jsxs("select",{value:bt,onChange:te=>{Vt(Number(te.target.value)),U(`Slot gap updated to ${te.target.value} minutes`,"info")},className:"w-full mt-1.5 border border-slate-200 rounded-lg px-3 py-2 bg-white outline-none focus:ring-1 focus:ring-indigo-500 font-medium text-slate-700",children:[a.jsx("option",{value:10,children:"10 Minutes"}),a.jsx("option",{value:15,children:"15 Minutes"}),a.jsx("option",{value:20,children:"20 Minutes (Default)"}),a.jsx("option",{value:30,children:"30 Minutes"}),a.jsx("option",{value:45,children:"45 Minutes"}),a.jsx("option",{value:60,children:"60 Minutes"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Working Hours Start"}),a.jsxs("select",{value:tn,onChange:te=>Qt(te.target.value),className:"w-full mt-1.5 border border-slate-200 rounded-lg px-3 py-2 bg-white outline-none focus:ring-1 focus:ring-indigo-500 font-medium text-slate-700",children:[a.jsx("option",{value:"08:00 AM",children:"08:00 AM"}),a.jsx("option",{value:"09:00 AM",children:"09:00 AM"}),a.jsx("option",{value:"10:00 AM",children:"10:00 AM"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Working Hours End"}),a.jsxs("select",{value:Cn,onChange:te=>pt(te.target.value),className:"w-full mt-1.5 border border-slate-200 rounded-lg px-3 py-2 bg-white outline-none focus:ring-1 focus:ring-indigo-500 font-medium text-slate-700",children:[a.jsx("option",{value:"04:00 PM",children:"04:00 PM"}),a.jsx("option",{value:"05:00 PM",children:"05:00 PM"}),a.jsx("option",{value:"06:00 PM",children:"06:00 PM"}),a.jsx("option",{value:"07:00 PM",children:"07:00 PM"})]})]})]})]}),a.jsxs("div",{className:"pt-4 border-t border-slate-100 space-y-6 font-sans",children:[a.jsxs("div",{className:"bg-slate-50 border border-slate-100 rounded-2xl p-4 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded-lg",children:a.jsx(aa,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-slate-900 font-display text-sm",children:"Interactive Calendar Matrix"}),a.jsxs("p",{className:"text-[10px] text-slate-400",children:[yt.toLocaleDateString("en-US",{month:"long",year:"numeric"})," Scheduler State"]})]})]}),a.jsxs("div",{className:"bg-slate-200/60 p-1 rounded-xl flex gap-1 self-start sm:self-center text-[11px] font-bold border border-slate-200",children:[a.jsx("button",{onClick:()=>ht("month"),className:`px-3 py-1.5 rounded-lg transition-all cursor-pointer ${Le==="month"?"bg-white text-indigo-600 shadow-sm":"text-slate-500 hover:text-slate-800"}`,children:"Month View"}),a.jsx("button",{onClick:()=>ht("week"),className:`px-3 py-1.5 rounded-lg transition-all cursor-pointer ${Le==="week"?"bg-white text-indigo-600 shadow-sm":"text-slate-500 hover:text-slate-800"}`,children:"Week View"}),a.jsx("button",{onClick:()=>ht("day"),className:`px-3 py-1.5 rounded-lg transition-all cursor-pointer ${Le==="day"?"bg-white text-indigo-600 shadow-sm":"text-slate-500 hover:text-slate-800"}`,children:"Day View"})]})]}),Le==="month"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"grid grid-cols-7 gap-2 text-center text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:[a.jsx("span",{children:"Mon"}),a.jsx("span",{children:"Tue"}),a.jsx("span",{children:"Wed"}),a.jsx("span",{children:"Thu"}),a.jsx("span",{children:"Fri"}),a.jsx("span",{children:"Sat"}),a.jsx("span",{children:"Sun"})]}),a.jsx("div",{className:"grid grid-cols-7 gap-2",children:(()=>{const te=yt.getFullYear(),Fe=yt.getMonth(),dt=Fe+1,He=new Date(te,Fe+1,0).getDate(),H=new Date(te,Fe,1).getDay(),se=H===0?6:H-1,G=Array.from({length:se}).map((ie,Z)=>a.jsx("div",{className:"min-h-[70px] bg-slate-50/20 border border-slate-50 rounded-xl"},`empty-${Z}`)),V=Array.from({length:He}).map((ie,Z)=>{const Te=Z+1,we=dt<10?`0${dt}`:`${dt}`,X=Te<10?`0${Te}`:`${Te}`,Ee=`${te}-${we}-${X}`,qe=n.filter(Nn=>Nn.dateTime.startsWith(Ee)),Nt=qe.filter(Nn=>Nn.isFilled).length,mt=qe.length,Ie=Te===new Date().getDate()&&Fe===new Date().getMonth()&&te===new Date().getFullYear();return a.jsxs("div",{onClick:()=>{on(new Date(te,Fe,Te)),ht("day")},className:`min-h-[70px] p-2 border border-slate-100 rounded-xl flex flex-col justify-between transition-all hover:border-indigo-200 hover:bg-indigo-50/20 cursor-pointer ${Ie?"bg-indigo-50/50 border-indigo-200 ring-1 ring-indigo-500":"bg-white"}`,children:[a.jsx("span",{className:`text-[11px] font-bold ${Ie?"text-indigo-600":"text-slate-700"}`,children:Te}),mt>0?a.jsxs("div",{className:"space-y-1",children:[a.jsxs("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded-md bg-indigo-50 text-indigo-700 block text-center truncate",children:[mt," Slots"]}),Nt>0&&a.jsxs("span",{className:"text-[8px] font-semibold px-1 py-0.2 rounded-md bg-emerald-50 text-emerald-700 block text-center truncate",children:[Nt," Booked"]})]}):a.jsx("span",{className:"text-[8px] text-slate-300 font-mono text-center block",children:"Empty"})]},Z)});return[...G,...V]})()})]}),Le==="week"&&a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-7 gap-4 animate-fade-in text-xs",children:OCe(yt).map(te=>{const Fe=n.filter(He=>He.dateTime.includes(te.fullDate)),dt=te.dateObj.toDateString()===new Date().toDateString();return a.jsxs("div",{className:`bg-slate-50/50 rounded-2xl p-3 border transition-all ${dt?"border-indigo-200 bg-indigo-50/20 shadow-inner":"border-slate-100"}`,children:[a.jsxs("div",{className:"flex justify-between items-center mb-3",children:[a.jsx("span",{className:`font-bold font-display ${dt?"text-indigo-600 font-extrabold":"text-slate-700"}`,children:te.label}),a.jsx("span",{className:"text-[9px] bg-slate-200/60 text-slate-500 font-bold px-1.5 py-0.5 rounded-md",children:Fe.length})]}),a.jsxs("div",{className:"space-y-2 min-h-[140px]",children:[Fe.map(He=>{const H=He.dateTime.split(" ")[1]+" "+(He.dateTime.split(" ")[2]||"");return a.jsxs("div",{className:`p-2 rounded-xl border flex flex-col gap-1 relative group transition-all hover:scale-[1.02] ${He.isFilled?"bg-emerald-50/70 border-emerald-100 text-emerald-800":"bg-white border-slate-100 text-slate-700 hover:border-indigo-200"}`,children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"font-mono font-bold text-[10px]",children:H}),a.jsx("button",{onClick:()=>{c(He.id),U("Slot removed!","info")},className:"p-0.5 text-slate-300 hover:text-rose-600 rounded opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",title:"Remove slot availability",children:a.jsx(xi,{className:"w-3.5 h-3.5"})})]}),a.jsxs("div",{className:"text-[10px] leading-normal flex items-start justify-between gap-1 mt-0.5 min-w-0",children:[He.isFilled?a.jsxs("div",{className:"space-y-0.5 flex-1 min-w-0",children:[a.jsxs("span",{className:"font-semibold text-emerald-950 flex items-center gap-1 min-w-0",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 shrink-0"}),a.jsx("span",{className:"truncate",children:He.bookedBy||"Client"})]}),He.bookedEmail&&a.jsx("p",{className:"text-[9px] text-emerald-900/85 font-mono truncate",children:He.bookedEmail}),He.bookedPurpose&&a.jsxs("p",{className:"text-[9px] text-slate-500 italic truncate",children:['"',He.bookedPurpose,'"']})]}):a.jsx("span",{className:"text-slate-400 font-medium truncate min-w-0 flex-1",children:"🟢 Open"}),He.isFilled?a.jsx("button",{onClick:se=>{se.stopPropagation(),v==null||v(He.id,""),U("Reservation successfully released back to open slots!","success")},className:"text-[9px] font-bold text-rose-600 hover:text-rose-800 bg-rose-50 hover:bg-rose-100 px-1.5 py-0.5 border border-rose-200 rounded transition-all shrink-0 cursor-pointer",title:"Release booking",children:"Release"}):a.jsx("button",{onClick:se=>{se.stopPropagation();const G=prompt("Enter patient/client name to schedule manually:","Ada Lovelace");G&&(v==null||v(He.id,G),U(`Manually booked slot for ${G}!`,"success"))},className:"text-[9px] font-bold text-indigo-600 hover:text-indigo-800 bg-indigo-50 hover:bg-indigo-100 px-2 py-0.5 border border-indigo-200 rounded transition-all shrink-0 cursor-pointer",title:"Book slot manually",children:"Book"})]})]},He.id)}),Fe.length===0&&a.jsx("div",{className:"text-center py-6 text-[10px] text-slate-300 italic",children:"No slots"})]}),a.jsxs("button",{onClick:()=>{const He=prompt("Enter a time slot value (e.g. '10:00 AM' or '03:30 PM'):","02:00 PM");if(He){const H=`${te.fullDate} ${He}`;l({id:`slot-manual-${te.dateNum}-${Date.now()}`,clientId:e.id,dateTime:H,isFilled:!1}),U(`Added slot at ${He} on ${te.fullDate}`,"success")}},className:"mt-3 w-full py-1.5 border border-dashed border-slate-200 hover:border-indigo-300 text-[10px] text-slate-400 hover:text-indigo-600 font-bold rounded-lg transition-all text-center flex items-center justify-center gap-1 cursor-pointer bg-white",children:[a.jsx(cr,{className:"w-3 h-3"})," Add Slot"]})]},te.fullDate)})}),Le==="day"&&(()=>{const te=yt.getFullYear(),Fe=yt.getMonth()+1,dt=yt.getDate(),He=Fe<10?`0${Fe}`:`${Fe}`,H=dt<10?`0${dt}`:`${dt}`,se=`${te}-${He}-${H}`,G=yt.toLocaleDateString("en-US",{weekday:"long"}),V=yt.toLocaleDateString("en-US",{month:"long"}),ie=`${G}, ${V} ${dt}, ${te}`;return a.jsxs("div",{className:"space-y-4 animate-fade-in max-w-xl mx-auto text-xs",children:[a.jsxs("div",{className:"flex justify-between items-center bg-slate-50 p-4 rounded-xl border border-slate-100",children:[a.jsxs("h4",{className:"font-bold text-slate-800 font-display",children:["Day Schedule: ",ie]}),a.jsxs("span",{className:"text-[10px] bg-indigo-50 text-indigo-700 font-bold px-2 py-0.5 rounded-md",children:[n.filter(Z=>Z.dateTime.startsWith(se)).length," slots active"]})]}),a.jsx("div",{className:"divide-y divide-slate-100 border border-slate-100 rounded-xl bg-white overflow-hidden",children:["09:00 AM","10:00 AM","11:00 AM","12:00 PM","01:00 PM","02:00 PM","03:00 PM","04:00 PM","05:00 PM"].map(Z=>{const Te=`${se} ${Z}`,we=n.find(X=>X.dateTime===Te);return a.jsxs("div",{className:"flex items-center gap-4 p-3.5 hover:bg-slate-50/40",children:[a.jsx("span",{className:"w-16 font-mono font-bold text-slate-500 text-center",children:Z}),a.jsx("div",{className:"flex-1",children:we?a.jsxs("div",{className:`p-3 rounded-xl border flex items-center justify-between ${we.isFilled?"bg-emerald-50 border-emerald-100 text-emerald-800":"bg-indigo-50/30 border-indigo-100 text-slate-800"}`,children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-xs",children:we.isFilled?"Booked Reservation":"Open Available Slot"}),we.isFilled&&a.jsxs("div",{className:"text-[10px] text-emerald-950 font-medium mt
737-1 space-y-0.5",children:[a.jsxs("p",{children:["Lead/Caller: ",a.jsx("strong",{className:"font-bold text-emerald-950",children:we.bookedBy})]}),we.bookedEmail&&a.jsxs("p",{children:["Email: ",a.jsx("span",{className:"font-mono text-[9px] text-slate-600",children:we.bookedEmail})]}),we.bookedPhone&&a.jsxs("p",{children:["Phone: ",a.jsx("span",{className:"font-mono text-[9px] text-slate-600",children:we.bookedPhone})]}),we.bookedPurpose&&a.jsxs("p",{children:["Purpose: ",a.jsxs("span",{className:"italic text-slate-600",children:['"',we.bookedPurpose,'"']})]}),a.jsx("div",{className:"mt-1.5 flex items-center gap-1",children:a.jsx("span",{className:"inline-flex items-center gap-1 text-[8px] font-bold bg-emerald-100 text-emerald-800 px-1.5 py-0.5 rounded-md",children:"📧 Confirmation Email Sent"})})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[we.isFilled?a.jsx("button",{onClick:()=>{v==null||v(we.id,""),U("Reservation successfully released back to open slots!","success")},className:"bg-rose-600 hover:bg-rose-500 text-white font-bold text-[10px] px-2.5 py-1 rounded-lg transition-all cursor-pointer",children:"Release Booking"}):a.jsx("button",{onClick:()=>{const X=prompt("Enter patient's name to book manually:","Ada Lovelace");X&&(v==null||v(we.id,X),U(`Manually booked slot for ${X}`,"success"))},className:"bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-[10px] px-2.5 py-1 rounded-lg transition-all cursor-pointer",children:"Book Manually"}),a.jsx("button",{onClick:()=>{c(we.id),U("Slot cleared!","info")},className:"p-1.5 text-slate-400 hover:text-rose-600 rounded-lg hover:bg-rose-50 transition-all cursor-pointer",children:a.jsx(xi,{className:"w-4 h-4"})})]})]}):a.jsxs("button",{onClick:()=>{l({id:`slot-manual-${dt}-${Z.replace(" ","-").replace(":","")}-${Date.now()}`,clientId:e.id,dateTime:Te,isFilled:!1}),U(`Opened slot at ${Z} on ${G} ${V} ${dt}`,"success")},className:"w-full py-2.5 border border-dashed border-slate-200 hover:border-indigo-300 text-slate-400 hover:text-indigo-600 font-bold hover:bg-indigo-50/10 rounded-xl transition-all text-center flex items-center justify-center gap-1 cursor-pointer",children:[a.jsx(cr,{className:"w-4 h-4"})," Open Availability at ",Z]})})]},Z)})})]})})()]}),a.jsxs("div",{className:"bg-slate-50 p-4 rounded-xl border border-slate-100 flex items-start gap-3",children:[a.jsx(D0,{className:"w-5 h-5 text-indigo-600 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"font-bold text-slate-800 text-xs font-display",children:"Active Relational Postgres DB Integration"}),a.jsxs("p",{className:"text-[11px] text-slate-500 leading-relaxed mt-0.5",children:["Your custom database connection is currently ",a.jsx("strong",{className:"text-emerald-600 font-bold",children:"ONLINE"}),". Sarah is pulling slot availability in real time from the ",a.jsx("code",{className:"bg-slate-200/50 px-1 py-0.2 rounded font-mono text-indigo-700 font-semibold text-[10px]",children:"appointments_public_v1"})," schema table."]})]})]})]}),N==="communications"&&a.jsxs("div",{className:"space-y-5",children:[a.jsx(Pz,{clientId:e.id,onPick:te=>{P(te),E("feed")}}),a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-slate-100 pb-3",children:[a.jsx("button",{onClick:()=>E("contacts"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer ${T==="contacts"?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"Contacts"}),a.jsx("button",{onClick:()=>E("feed"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer ${T==="feed"?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"All communications"}),a.jsx("button",{onClick:()=>E("bookings"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer ${T==="bookings"?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"Bookings"})]}),T==="contacts"?a.jsx(Tz,{clientId:e.id}):T==="bookings"?a.jsx(Az,{clientId:e.id}):a.jsx(Ez,{clientId:e.id,initialRecordingFilter:C})]}),N==="connections"&&a.jsx("div",{children:a.jsx(ACe,{clientId:e.id})}),N==="merchant"&&Be.merchant&&a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-6",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[a.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-700 rounded-xl",children:a.jsx(Sa,{className:"w-4 h-4"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-slate-800 text-sm font-display",children:"Merchant Store Connection"}),a.jsx("p",{className:"text-[10px] text-slate-400",children:"Link your real store (Sh
737opify/Woo/ERP). The receptionist can read live stock and apply restocks, refunds & orders — governed by your policy below."})]})]}),a.jsx(Bz,{clientId:e.id})]}),N==="voice-agents"&&Be.voiceAgents&&a.jsx("div",{className:"bg-white rounded-2xl border border-slate-100 p-6",children:a.jsx(_Ce,{clientId:e.id})}),N==="phone"&&Be.phone&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"bg-white rounded-2xl border border-slate-100 p-6",children:a.jsx(Lz,{clientId:e.id})}),a.jsx("div",{className:"bg-white rounded-2xl border border-slate-100 p-6",children:a.jsx(Uz,{clientId:e.id})}),a.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 p-6 space-y-3",children:[a.jsxs("h3",{className:"text-lg font-semibold text-slate-800 flex items-center gap-2",children:[a.jsx(wv,{className:"w-5 h-5 text-indigo-600"})," Call records"]}),a.jsx("p",{className:"text-xs text-slate-500 -mt-1",children:"Inbound + outbound phone calls captured by your voice agent."}),(()=>{const te=Dt.filter(Fe=>Fe.channel==="phone").sort((Fe,dt)=>(dt.createdAt??0)-(Fe.createdAt??0));return te.length===0?a.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 p-8 text-center text-slate-400 text-sm",children:"No phone calls yet. Assigned numbers above will route inbound calls here."}):a.jsx("div",{className:"overflow-hidden rounded-xl border border-slate-200",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-slate-50 text-slate-500 text-xs uppercase tracking-wide",children:a.jsxs("tr",{children:[a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Direction"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"From"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Purpose"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"When"}),a.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Status"}),a.jsx("th",{className:"text-right px-4 py-2 font-medium",children:"Recording"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100",children:te.map(Fe=>a.jsxs("tr",{children:[a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`text-[10px] font-bold uppercase px-2 py-0.5 rounded-full ${Fe.direction==="outbound"?"bg-indigo-100 text-indigo-700":"bg-emerald-100 text-emerald-700"}`,children:Fe.direction||"inbound"})}),a.jsx("td",{className:"px-4 py-2.5 text-slate-600",children:Fe.visitorPhone||Fe.visitorName||"—"}),a.jsx("td",{className:"px-4 py-2.5 text-slate-600 max-w-xs truncate",children:Fe.purpose||"—"}),a.jsx("td",{className:"px-4 py-2.5 text-slate-500",children:Fe.timestamp}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("span",{className:`text-[10px] font-bold uppercase px-2 py-0.5 rounded-full ${Fe.status==="booked"?"bg-emerald-100 text-emerald-700":Fe.status==="contacted"?"bg-sky-100 text-sky-700":"bg-slate-100 text-slate-600"}`,children:Fe.status})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:Fe.audioRecordingUrl?a.jsxs("a",{href:Fe.audioRecordingUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-indigo-600 hover:text-indigo-700 text-xs font-medium",children:[a.jsx(Sv,{className:"w-3.5 h-3.5"})," Play"]}):a.jsx("span",{className:"text-xs text-slate-300",children:"—"})})]},Fe.id))})]})})})()]})]}),N==="sandbox"&&(()=>{var V;const te=r==null?void 0:r.find(ie=>ie.id===e.assignedWorkflowId),Fe=te?te.name:"Web Receptionist",dt=te?te.description:"Launches on your corporate website to capture incoming bookings and explain services.",He=te?te.defaultPrompt:"You are Sarah, a professional front-desk assistant. Answer visitor queries with confidence.",H=O||(te==null?void 0:te.defaultGreeting)||"Hello! Thank you for visiting. I can help you schedule an appointment.",se=[{id:"channel-web",name:`${Fe} (Web Widget)`,type:"Website Embed Widget",tag:"ACTIVE",phone:"N/A (Web Audio)",description:dt,greeting:H,prompt:He},...be&&De?[{id:"channel-phone",name:`${Fe} (Inbound Hotline)`,type:"Phone Number",tag:"LIVE",phone:De,description:`Primary telephone office line running ${Fe}. Answers calls instantly, handles emergency triage, and schedules appointments.`,greeting:te?`Thank y
737ou for calling our main office hotline! This is your ${te.name}. ${te.defaultGreeting}`:"Thank you for calling our main office hotline! I am Sarah, your AI Voice receptionist. How can I help you today?",prompt:te?`You are a telephone receptionist representing ${e.companyName}. Speak warmly and utilize this workflow context: ${te.defaultPrompt}`:"You are a telephone receptionist. Speak warmly and suggest specific open slots from our live list."}]:[]],G=se.find(ie=>ie.id===qn)||se[0];return a.jsxs("div",{className:"space-y-6 animate-fade-in",children:[a.jsx("div",{className:`${rt} p-6`,children:a.jsx("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] bg-indigo-50 text-indigo-700 font-bold uppercase px-2.5 py-1 rounded-md",children:"Audition Playground"}),a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900 mt-2",children:"Live Agent Sandbox & Multi-Agent Testing"}),a.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Test and review all your assigned S2S receptionists, phone lines, and outbound agents from a single unified workspace."})]})})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[a.jsxs("div",{className:"lg:col-span-5 space-y-6",children:[a.jsxs("div",{className:`${rt} p-5 space-y-4`,children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-slate-900 text-xs font-display",children:"1. Select Assigned Agent Line"}),a.jsx("p",{className:"text-[10px] text-slate-400 mt-0.5",children:"Toggle between website widgets, twilio numbers, and campaign lines."})]}),a.jsx("div",{className:"space-y-2.5",children:se.map(ie=>a.jsxs("div",{onClick:()=>{qt(ie.id),U(`Switched sandbox active agent to ${ie.name}`,"info")},className:`p-3.5 border rounded-xl cursor-pointer transition-all flex items-center justify-between ${qn===ie.id?"border-indigo-600 bg-indigo-50/20 shadow-sm":"border-slate-100 hover:border-slate-200 bg-slate-50/50"}`,children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-extrabold text-slate-800 text-xs",children:ie.name}),a.jsx("span",{className:"text-[8px] font-bold bg-white px-1.5 py-0.5 rounded border text-indigo-600",children:ie.tag})]}),a.jsxs("p",{className:"text-[10px] text-slate-400",children:[ie.type," • ",ie.phone]})]}),a.jsx(ry,{className:`w-4 h-4 transition-all ${qn===ie.id?"text-indigo-600 translate-x-0.5":"text-slate-300"}`})]},ie.id))})]}),a.jsxs("div",{className:"bg-slate-900 text-white rounded-2xl p-5 space-y-3 relative overflow-hidden",children:[a.jsx(QY,{className:"w-5 h-5 text-indigo-400"}),a.jsx("h5",{className:"font-bold text-xs font-display",children:"Frequently Asked Questions"}),a.jsxs("div",{className:"space-y-2.5 text-[10px] text-slate-300 leading-relaxed",children:[a.jsxs("div",{children:[a.jsx("strong",{className:"text-white block font-bold",children:"Q: How do I test a specific assigned workflow?"}),a.jsx("span",{children:'A: Use the audition sandbox on the right. Simply click "Start Voice Call" or chat with Sarah to test live. Your scheduled slots and knowledge base files are synced dynamically!'})]}),a.jsxs("div",{children:[a.jsx("strong",{className:"text-white block font-bold",children:"Q: What if I have multiple workflows/numbers?"}),a.jsx("span",{children:"A: We assign a unique webhook channel and twilio number to each. Select the line from the list above, modify its specific greeting, and run isolated simulations!"})]})]})]})]}),a.jsx("div",{className:"lg:col-span-7 space-y-6",children:a.jsxs("div",{className:`${rt} p-6 space-y-5`,children:[a.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-100 pb-4",children:[a.jsx("div",{className:"bg-indigo-600 text-white p-2.5 rounded-xl",children:a.jsx(xs,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[9px] font-mono font-bold bg-slate-100 text-slate-500 px-2 py-0.5 rounded-full uppercase",children:"Sandbox Emulator Active"}),a.jsxs("h4",{className:"font-extrabold text-slate-900 text-sm font-display mt-1",children:["Live Audition Panel: ",G.name]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-xs bg-slate-50/50 p-4 rounded-xl border border-slate-100",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"font-bold text-[10px] text-slate-400 uppercase tracking-wider block",children:"Opening Statement / Greeting override"}),a.jsxs("p",{className:"text-slate-700 italic font-medium leading-relaxed bg-white border border-slate-200/50 p-2.5 rounded-lg",children:['"',G.greeting,'"']})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"font-bold text-[10px] text-slate-400 uppercase tracking-wider block",children:"Developer prompt instructions"}),a.jsx("p",{className:"text-slate-600 line-clamp-4 font-mono text-[10px] bg-white border border-slate-200/50 p-2.5 rounded-lg leading-normal",children:G.prompt})]})]}),a.jsxs("div",{className:"bg-slate-50/70 rounded-2xl p-4.5 border border-slate-200/70 grid grid-cols-1 md:grid-cols-2 gap-5 text-xs",children:[a.jsxs("div",{className:"space-y-3.5",children:[a.jsxs("h5",{className:"font-bold text-slate-800 uppercase text-[10px] tracking-wider flex items-center gap-1.5",children:[a.jsx(D0,{className:"w-4 h-4 text-indigo-600"})," Connection & Credentials Handshake"]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-white rounded-xl border border-slate-100 shadow-sm",children:[a.jsx("span",{className:"text-slate-500 font-medium",children:"Gemini Live API Voice Protocol"}),a.jsxs("span",{className:"font-mono text-[9px] bg-emerald-50 text-emerald-700 border border-emerald-100 px-2 py-0.5 rounded-md font-bold flex items-center gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"ACTIVE (V3.1)"]})]}),a.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-white rounded-xl border border-slate-100 shadow-sm",children:[a.jsx("span",{className:"text-slate-500 font-medium",children:"Relational DB (PostgreSQL)"}),a.jsxs("span",{className:"font-mono text-[9px] bg-indigo-50 text-indigo-700 border border-indigo-100 px-2 py-0.5 rounded-md font-bold flex items-center gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-indigo-500"}
737),"SYNCED (Drizzle)"]})]}),a.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-white rounded-xl border border-slate-100 shadow-sm",children:[a.jsx("span",{className:"text-slate-500 font-medium",children:"Outflow Sheets Sync"}),(V=e.sheetsConfig)!=null&&V.isEnabled?a.jsxs("span",{className:"font-mono text-[9px] bg-emerald-50 text-emerald-700 border border-emerald-100 px-2 py-0.5 rounded-md font-bold flex items-center gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"}),"CONNECTED"]}):a.jsx("span",{className:"font-mono text-[9px] bg-amber-50 text-amber-600 border border-amber-100 px-2 py-0.5 rounded-md font-bold flex items-center gap-1",children:"STANDBY"})]})]})]}),a.jsxs("div",{className:"space-y-3.5",children:[a.jsxs("h5",{className:"font-bold text-slate-800 uppercase text-[10px] tracking-wider flex items-center gap-1.5",children:[a.jsx(aa,{className:"w-4 h-4 text-indigo-600"})," Scheduling Slots Visualizer"]}),(()=>{const ie=n.filter(Ee=>Ee.clientId===e.id),Z=ie.filter(Ee=>Ee.isFilled),Te=ie.filter(Ee=>!Ee.isFilled),we=ie.length,X=we>0?Math.round(Z.length/we*100):0;return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-[10px] font-bold",children:[a.jsxs("span",{className:"text-emerald-700 font-sans flex items-center gap-1",children:[a.jsx(kt,{className:"w-3.5 h-3.5"})," ",Z.length," Booked"]}),a.jsxs("span",{className:"text-indigo-600 font-sans flex items-center gap-1",children:[a.jsx(cc,{className:"w-3.5 h-3.5"})," ",Te.length," Remaining Open"]})]}),a.jsxs("div",{className:"w-full h-3 bg-indigo-100 rounded-full overflow-hidden flex",children:[a.jsx("div",{className:"h-full bg-emerald-500 transition-all duration-500",style:{width:`${X}%`}}),a.jsx("div",{className:"h-full bg-indigo-500 transition-all duration-500",style:{width:`${100-X}%`}})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px]",children:[a.jsxs("div",{className:"p-2.5 bg-white rounded-xl border border-slate-100 shadow-sm flex flex-col",children:[a.jsx("span",{className:"text-slate-400 font-medium uppercase tracking-wider text-[8px]",children:"Booked Rate"}),a.jsxs("span",{className:"font-extrabold text-emerald-700 text-xs mt-0.5",children:[X,"%"]})]}),a.jsxs("div",{className:"p-2.5 bg-white rounded-xl border border-slate-100 shadow-sm flex flex-col",children:[a.jsx("span",{className:"text-slate-400 font-medium uppercase tracking-wider text-[8px]",children:"Capacity status"}),a.jsx("span",{className:"font-extrabold text-indigo-900 text-xs mt-0.5",children:Te.length===0?"Fully Booked":`${Te.length} available`})]})]})]})})()]})]}),a.jsxs("div",{className:"pt-2 space-y-4",children:[jt(),oi(),a.jsx(GC,{clientId:e.id,clientName:e.name,companyName:e.companyName,greetingPrompt:G.greeting,assignedWorkflowPrompt:G.prompt,slots:n,kbItems:i.filter(ie=>ie.clientId===e.id&&(!ie.voiceAgentId||ie.voiceAgentId===G.id)),voiceAgentId:G.id,agentName:Fe,selectedVoiceId:ai,onCallEnded:(ie,Z)=>Wn({data:ie,recordingUrl:Z,at:Date.now()}),onBookSlot:(ie,Z)=>{v?(v(ie,Z),U(`Successfully booked slot in sandbox for ${Z}!`,"success")):U(`Slot book triggered in sandbox for ${Z}!`,"success")},onAddLead:ie=>{x&&(x(ie),U(`New intake log captured for ${ie.visitorName}!`,"success"))},onUpdateLead:b,onCollectedDataChange:(ie,Z)=>ln({isActive:Z,data:ie}),minimal:!0})]}),a.jsxs("div",{className:"text-[10px] text-slate-400 flex items-center justify-between pt-2 border-t border-slate-100",children:[a.jsx("span",{children:"🟢 Live Synchronized Sandbox: Interactive slots, caller intakes, and lead logs sync directly onto your dashboard in real-time!"}),a.jsxs("span",{className:"font-mono text-indigo-600",children:["Target Line: ",G.id.toUpperCase()]})]})]})})]})]})})()]})]})]})}function DCe({isOpen:e,onClose:t,onSuccess:n,targetRole:i,currentTier:r}){const[s,l]=w.useState(r||(i==="ADMIN"?"Growth":"Pro")),[c,h]=w.useState(100),[d,f]=w.useState(!1),[p,v]=w.useState(!1),[x,b]=w.useState(""),[S,N]=w.useState(""),[j,T]=w.useState("");if(!e)return null;const E=[{name:"Starter",price:"$99/mo",multiplier:"1.8x base rate",features:["Up to 5 clients","Standard S2S response","15,000 mins / mo included","Email support"],icon:h5},{name:"Growth",price:"$299/mo",multiplier:"1.5x base rate",features:["Up to 25 clients","Priority S2S response speeds","50,000 mins / mo included","Whitelabeling options","24/7 support"],icon:Um,popular:!0},{name:"Enterprise",price:"$899/mo",multiplier:"1.3x base rate",features:["Unlimited clients","Dedicated voice channels","200,000 mins / mo included","Custom domain mapping","Dedicated SLA account manager"],icon:lQ}],C=[{name:"Free",price:"$0/mo",features:["1 agent active","100 mins/mo","Basic analytics","Default voice matching"]},{name:"Pro",price:"$49/mo",features:["3 agents active","2,500 mins/mo","Custom templates & KB upload","Booking scheduler widget","CRM integration presets"],popular:!0},{name:"Premium",price:"$149/mo",features:["Unlimited agents","10,000 mins/mo","Ultra-low S2S latency","Advanced caller analytics","Live audio call transfer option"]}],P=A=>{A.preventDefault(),v(!0),setTimeout(()=>{v(!1),n(d?c:0,s),t()},1500)};return a.jsx("div",{className:"fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl max-w-4xl w-full max-h-[90vh] overflow-y-auto shadow-2xl border border-slate-100 flex flex-col md:flex-row my-8",children:[a.jsxs("div",{className:"p-6 md:p-8 flex-1 border-r border-slate-100 bg-slate-50/50",children:[a.jsxs("div",{className:"flex justify-between items-start mb-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold font-display text-slate-900",children:"Upgrade SaaS Subscription"}),a.jsx("p",{className:"text-slate-500 text-sm mt-1",children:"Select the tier that best matches your organization\\'s scale."})]}),a.jsx("button",{onClick:t,className:"p-1 hover:bg-slate-200 rounded-lg md:hidden",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400"})})]}),a.jsx("div",{className:"space-y-4",children:i==="ADMIN"?E.map(A=>a.jsxs("div",{onClick:()=>l(A.name),className:`relative p-4 rounded-xl border-2 transition-all cursor-pointer ${s===A.name?"border-indigo-600 bg-indigo-50/20":"border-slate-200 bg-white hover:border-slate-300"}`,children:[A.popular&&a.jsx("span",{className:"absolute top-3 right-3 text-[10px] tracking-wider up
737percase font-semibold bg-indigo-600 text-white px-2 py-0.5 rounded-full",children:"Popular"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s===A.name?"bg-indigo-100 text-indigo-700":"bg-slate-100 text-slate-500"}`,children:a.jsx(A.icon,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-slate-900",children:A.name}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-lg font-bold text-slate-800",children:A.price}),a.jsxs("span",{className:"text-xs text-slate-400",children:["• ",A.multiplier]})]})]})]}),a.jsx("ul",{className:"grid grid-cols-2 gap-x-2 gap-y-1 mt-3 pt-3 border-t border-slate-100 text-xs text-slate-500",children:A.features.slice(0,4).map((M,R)=>a.jsxs("li",{className:"flex items-center gap-1.5",children:[a.jsx(Lm,{className:"w-3.5 h-3.5 text-indigo-600 shrink-0"}),a.jsx("span",{className:"truncate",children:M})]},R))})]},A.name)):C.map(A=>a.jsxs("div",{onClick:()=>l(A.name),className:`relative p-4 rounded-xl border-2 transition-all cursor-pointer ${s===A.name?"border-indigo-600 bg-indigo-50/20":"border-slate-200 bg-white hover:border-slate-300"}`,children:[A.popular&&a.jsx("span",{className:"absolute top-3 right-3 text-[10px] tracking-wider uppercase font-semibold bg-indigo-600 text-white px-2 py-0.5 rounded-full",children:"Popular"}),a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-slate-900",children:A.name}),a.jsx("p",{className:"text-sm text-indigo-600 font-bold mt-0.5",children:A.price})]})}),a.jsx("ul",{className:"mt-3 space-y-1 text-xs text-slate-500",children:A.features.map((M,R)=>a.jsxs("li",{className:"flex items-center gap-1.5",children:[a.jsx(Lm,{className:"w-3.5 h-3.5 text-indigo-600"}),a.jsx("span",{children:M})]},R))})]},A.name))}),a.jsxs("div",{className:"mt-6 pt-5 border-t border-slate-100",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer mb-2",children:[a.jsx("input",{type:"checkbox",checked:d,onChange:A=>f(A.target.checked),className:"rounded text-indigo-600 focus:ring-indigo-500 border-slate-300 w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Add Pre-paid Token Credit Instead"})]}),d&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 bg-white border border-slate-200 rounded-lg px-3 py-2",children:[a.jsx(Qd,{className:"w-5 h-5 text-slate-400"}),a.jsx("input",{type:"number",value:c,onChange:A=>h(Math.max(10,parseInt(A.target.value)||0)),className:"w-full bg-transparent border-none outline-none font-medium text-slate-800",placeholder:"Amount to recharge",min:"10"}),a.jsx("span",{className:"text-xs text-slate-400 bg-slate-100 px-2 py-1 rounded",children:"Min. $10"})]})]})]}),a.jsxs("div",{className:"p-6 md:p-8 w-full md:w-[350px] bg-slate-900 text-white rounded-r-2xl flex flex-col justify-between",children:[a.jsx("div",{className:"hidden md:flex justify-end",children:a.jsx("button",{onClick:t,className:"p-1 hover:bg-slate-800 rounded-lg",children:a.jsx(fn,{className:"w-5 h-5 text-slate-400 hover:text-white"})})}),a.jsxs("form",{onSubmit:P,className:"space-y-5 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-indigo-400 font-semibold text-xs tracking-wider uppercase",children:[a.jsx(h5,{className:"w-4 h-4"}),"Secure Paywall Checkout"]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 font-medium",children:"Subscription / Item"}),a.jsx("div",{className:"text-lg font-bold mt-1",children:d?`Prepaid Credit: $${c}`:`${s} Plan`}),a.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Billed securely in USD via Apex Platform Gateway."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 uppercase font-bold tracking-wider",children:"Cardholder Name"}),a.jsx("input",{type:"text",required:!0,placeholder:"Alex Mercer",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 mt-1 text-sm text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 uppercase font-bold tracking-wider",children:"Card Number"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"text",required:!0,maxLength:19,placeholder:"4111 2222 3333 4444",value:x,onChange:A=>{const M=A.target.value.replace(/\D/g,"").replace(/(.{4})/g,"$1 ").trim();b(M)},className:"w-full bg-slate-800 border border-slate-700 rounded-lg pl-9 pr-3 py-2 mt-1 text-sm text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"}),a.jsx(aQ,{className:"w-4 h-4 text-slate-500 absolute left-3 top-3.5"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 uppercase font-bold tracking-wider",children:"Expiration"}),a.jsx("input",{type:"text",required:!0,maxLength:5,placeholder:"MM/YY",value:S,onChange:A=>{const M=A.target.value.replace(/\D/g,"");N(M.length>2?`${M.slice(0,2)}/${M.slice(2,4)}`:M)},className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 mt-1 text-sm text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-slate-400 uppercase font-bold tracking-wider",children:"CVC"}),a.jsx("input",{type:"text",required:!0,maxLength:3,placeholder:"321",value:j,onChange:A=>T(A.target.value.replace(/\D/g,"")),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 mt-1 text-sm text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"})]})]})]}),a.jsx("button",{type:"submit",disabled:p,className:"w-full bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-700 text-white font-semibold py-2.5 rounded-xl text-sm transition-colors mt-4 flex justify-center items-center gap-2 cursor-pointer",children:p?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent roun
737ded-full animate-spin"}),"Authorizing Charge..."]}):"Pay & Confirm"})]}),a.jsx("p",{className:"text-[10px] text-slate-500 text-center mt-6",children:"Protected by SSL 256-Bit encryption. Payment transactions conform to PCI-DSS rules."})]})]})})}const LCe=[{icon:Qa,title:"Data stays in your country",body:"Every call, transcript, and recording is processed inside your borders. Nothing routes through overseas infrastructure unless you ask it to."},{icon:Uu,title:"Lowest latency for your callers",body:"Callers connect to a local endpoint, so the conversation feels instant — the difference between a natural exchange and a laggy one."},{icon:VQ,title:"Dedicated, not shared",body:"Your deployment runs on infrastructure reserved for you. No noisy neighbours, no shared capacity, no cross-tenant exposure."},{icon:vL,title:"Predictable performance",body:"Because capacity is sized to you and located near your callers, response times stay consistent under your own load, not someone else’s spike."},{icon:iy,title:"Compliance-ready",body:"For regulated industries — finance, healthcare, government — keeping voice data in-country or on-premises simplifies the controls you already operate under."},{icon:cc,title:"You control uptime",body:"Run it where you already have power, connectivity, and backup. Your availability is governed by your environment, not a distant platform."}],UCe=[{name:"Local Cloud",tag:"In-country data centre",icon:EX,accent:"indigo",summary:"We deploy a dedicated instance inside a data centre located in your country. We manage it; you get in-country residency without touching hardware.",points:["Hosted in a data centre within your borders","We handle setup, updates, and monitoring","No hardware or premises required from you","Lower latency than any overseas deployment"],bestFor:"Teams that want in-country data residency without operating their own infrastructure."},{name:"On-Premises",tag:"Your office / premises",icon:TQ,accent:"emerald",summary:"We deploy a dedicated instance inside your own office or private network. Call traffic never leaves your premises.",points:["Runs on hardware inside your building or private network","Call data never traverses a third-party network","Lowest possible latency for on-site and local callers","Full physical retention of every recording"],bestFor:"Regulated or security-conscious organisations that must retain everything on their own premises."}],BCe=[{label:"Where calls are handled",local:"A data centre in your country",onprem:"Your own office / network"},{label:"Data leaves your country",local:"No",onprem:"No"},{label:"Data leaves your network",local:"To the in-country data centre",onprem:"Never"},{label:"Hardware provided by",local:"Us",onprem:"You (we advise on specs)"},{label:"Setup & maintenance",local:"Managed by us",onprem:"Shared (we set up, you host)"},{label:"Caller latency",local:"Low",onprem:"Lowest"}],FCe=[{n:"01",title:"We assess your region",body:"Tell us where your callers are and any residency or compliance requirements. We map that to a deployment option."},{n:"02",title:"We deploy a dedicated instance",body:"We stand up an environment reserved for you — in an in-country data centre or on your premises, per your choice."},{n:"03",title:"Your callers connect locally",body:"Voice traffic routes to your local endpoint. You start taking calls with the latency and data residency you needed."}];function $Ce({onBackHome:e,onNavigateToAuth:t}){const n=et(me.queries.getPlatformDemo,{}),i=n!=null&&n.client?{id:n.client._id}:null,r=We(me.mutations.addLead),[s,l]=w.useState({name:"",email:"",phone:"",company:"",country:"",tier:"Not sure yet",message:""}),[c,h]=w.useState(!1),[d,f]=w.useState(!1),[p,v]=w.useState(null),x=async b=>{if(b.preventDefault(),!(i!=null&&i.id)){v("The form isn’t ready yet — please try again in a moment.");return}if(!s.name.trim()||!s.email.trim()||!s.message.trim()){v("Please fill in your name, email, and a short message.");return}h(!0),v(null);try{const S=["Local deployment enquiry",`Tier: ${s.tier}`,s.company?`Company: ${s.company.trim()}`:null,s.country?`Country/region: ${s.country.trim()}`:null,`Message: ${s.message.trim().slice(0,600)}
737`].filter(Boolean).join(" | ");await r({clientId:i.id,visitorName:s.name.trim(),visitorEmail:s.email.trim(),visitorPhone:s.phone.trim(),purpose:S,timestamp:new Date().toLocaleString(),status:"new",durationSeconds:0,tokenCost:0,channel:"form",source:"local-deployment"}),f(!0),l({name:"",email:"",phone:"",company:"",country:"",tier:"Not sure yet",message:""})}catch(S){v((S==null?void 0:S.message)||"Couldn’t send your enquiry. Please try again.")}finally{h(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50 flex flex-col",children:[a.jsx("header",{className:"sticky top-0 z-30 bg-white/80 backdrop-blur border-b border-slate-100",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 h-16 flex items-center justify-between",children:[a.jsxs("button",{onClick:e,className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("div",{className:"w-8 h-8 rounded-xl bg-indigo-600 text-white grid place-items-center font-extrabold text-sm",children:"V"}),a.jsx("span",{className:"font-extrabold text-slate-900 tracking-tight",children:"Vox Bridge"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:e,className:"text-sm font-semibold text-slate-600 hover:text-slate-900 px-3 py-2 rounded-lg hover:bg-slate-100 transition-colors cursor-pointer",children:"Back to home"}),a.jsx("button",{onClick:()=>t("login"),className:"text-sm font-semibold text-indigo-600 hover:text-indigo-500 px-3 py-2 rounded-lg hover:bg-indigo-50 transition-colors cursor-pointer",children:"Sign in"})]})]})}),a.jsxs("section",{className:"relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-indigo-50 via-white to-slate-50"}),a.jsxs("div",{className:"relative max-w-6xl mx-auto px-5 pt-16 pb-12 text-center",children:[a.jsxs("span",{className:"inline-flex items-center gap-2 bg-white border border-indigo-100 text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold shadow-sm",children:[a.jsx(xm,{className:"w-3.5 h-3.5"})," In-country & on-premises deployment"]}),a.jsxs("h1",{className:"mt-5 text-4xl sm:text-5xl font-extrabold text-slate-900 tracking-tight leading-tight",children:["Voice operations,",a.jsx("br",{className:"hidden sm:block"})," hosted in your country."]}),a.jsx("p",{className:"mt-4 max-w-2xl mx-auto text-base sm:text-lg text-slate-600 leading-relaxed",children:"Your callers connect to a local endpoint. Your call data stays inside your borders — or inside your building. No overseas routing, no shared infrastructure, no per-minute metering."}),a.jsxs("div",{className:"mt-7 flex flex-wrap items-center justify-center gap-3",children:[a.jsxs("a",{href:"#enquiry",className:"inline-flex items-center gap-2 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold px-5 py-3 rounded-xl text-sm shadow-lg shadow-indigo-200 transition-all cursor-pointer",children:["Request a local deployment ",a.jsx(hs,{className:"w-4 h-4"})]}),a.jsx("button",{onClick:e,className:"inline-flex items-center gap-2 bg-white hover:bg-slate-50 border border-slate-200 text-slate-700 font-semibold px-5 py-3 rounded-xl text-sm transition-all cursor-pointer",children:"See it live"})]})]})]}),a.jsx("section",{className:"max-w-6xl mx-auto px-5 py-14 w-full",children:a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5",children:LCe.map(b=>a.jsxs("div",{className:"bg-white border border-slate-200 rounded-2xl p-6 shadow-sm hover:shadow-md transition-shadow",children:[a.jsx("div",{className:"w-11 h-11 rounded-xl bg-indigo-50 text-indigo-600 grid place-items-center mb-4",children:a.jsx(b.icon,{className:"w-5 h-5"})}),a.jsx("h3",{className:"font-bold text-slate-900 text-sm",children:b.title}),a.jsx("p",{className:"mt-2 text-sm text-slate-500 leading-relaxed",children:b.body})]},b.title))})}),a.jsx("section",{className:"bg-white border-y border-slate-100 w-full",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-14",children:[a.jsxs("div",{className:"text-center mb-10",children:[a.jsx("h2",{className:"text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight",children:"Two ways to keep it local"}),a.jsx("p",{className:"mt-3 text-slate-600 max-w-2xl mx-auto text-sm leading-relaxed",children:"Choose where the deployment lives. Both keep your data in-country; only On-Premises keeps it on your network."})]}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:UCe.map(b=>a.jsxs("div",{className:`rounded-3xl border p-7 ${b.accent==="emerald"?"border-emerald-200 bg-emerald-50/40":"border-indigo-200 bg-indigo-50/40"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-12 h-12 rounded-2xl grid place-items-center ${b.accent==="emerald"?"bg-emerald-600 text-white":"bg-indigo-600 text-white"}`,children:a.jsx(b.icon,{className:"w-6 h-6"})}),a.jsxs("div",{children:[a.jsx("div",{className:"font-extrabold text-slate-900 text-lg leading-none",children:b.name}),a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:b.tag})]})]}),a.jsx("p",{className:"mt-4 text-sm text-slate-600 leading-relaxed",children:b.summary}),a.jsx("ul",{className:"mt-4 space-y-2",children:b.points.map(S=>a.jsxs("li",{className:"flex items-start gap-2 text-sm text-slate-700",children:[a.jsx(kt,{className:`w-4 h-4 mt-0.5 shrink-0 ${b.accent==="emerald"?"text-emerald-600":"text-indigo-600"}`}),a.jsx("span",{children:S})]},S))}),a.jsxs("p",{className:"mt-5 text-xs text-slate-500 border-t border-slate-200/70 pt-4",children:[a.jsx("span",{className:"font-semibold text-slate-700",children:"Best for: "}),b.bestFor]})]},b.name))})]})}),a.jsxs("section",{className:"max-w-5xl mx-auto px-5 py-14 w-full",children:[a.jsx("h2",{className:"text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight text-center mb-8",children:"Side by side"}),a.jsx("div",{className:"overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"bg-slate-50 text-[11px] font-bold uppercase text-slate-500",children:a.jsxs("tr",{children:[a.jsx("th",{className:"py-3 px-4 text-left border-r border-slate-100",children:"Consideration"}),a.jsx("th",{className:"py-3 px-4 text-left border-r border-slate-100",children:"Local Cloud"}),a.jsx("th",{className:"py-3 px-4 text-left",children:"On-Premises"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-100",children:BCe.map(b=>a.jsxs("tr",{className:"hover:bg-slate-50/50",children:[a.jsx("td",{className:"py-3 px-4 border-r border-slate-100 font-semibold text-slate-700",children:b.label}),a.jsx("td",{className:"py-3 px-4 border-r border-slate-100 text-slate-600",children:b.local}),a.jsx("td",{className:"py-3 px-4 text-slate-600",children:b.onprem})]},b.label))})]})})]}),a.jsx("section",{className:"bg-slate-900 text-white w-full",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-14",children:[a.jsx("h2",{className:"text-2xl sm:text-3xl font-extrabold tracking-tight text-center mb-10",children:"How it works"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-6",children:FCe.map(b=>a.jsxs("div",{className:"rounded-2xl bg-white/5 border border-white/10 p-6",children:[a.jsx("div",{className:"text-indigo-300 font-extrabold text-lg",children:b.n}),a.jsx("h3",{className:"mt-2 font-bold text-white",children:b.title}),a.jsx("p",{className:"mt-2 text-sm text-slate-300 leading-relaxed",children:b.body})]}
737,b.n))})]})}),a.jsxs("section",{id:"enquiry",className:"max-w-3xl mx-auto px-5 py-16 w-full",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight",children:"Request a local deployment"}),a.jsx("p",{className:"mt-3 text-sm text-slate-600 max-w-xl mx-auto leading-relaxed",children:"Tell us where your callers are and which option you’re considering. We’ll come back with a deployment plan and a live walkthrough."})]}),d?a.jsxs("div",{className:"bg-white border border-emerald-200 rounded-3xl p-8 text-center shadow-sm",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-emerald-100 text-emerald-600 grid place-items-center mx-auto mb-4",children:a.jsx(kt,{className:"w-6 h-6"})}),a.jsx("h3",{className:"font-extrabold text-slate-900",children:"Thank you — your enquiry is in."}),a.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"We’ve received your details and will reach out shortly."}),a.jsxs("button",{onClick:e,className:"mt-5 inline-flex items-center gap-2 text-sm font-semibold text-indigo-600 hover:text-indigo-500 cursor-pointer",children:["Back to home ",a.jsx(hs,{className:"w-4 h-4"})]})]}):a.jsxs("form",{onSubmit:x,className:"bg-white border border-slate-200 rounded-3xl p-7 shadow-xl space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsx(rm,{label:"Your name",icon:qo,children:a.jsx("input",{value:s.name,onChange:b=>l({...s,name:b.target.value}),placeholder:"e.g. Ayesha Khan",className:im})}),a.jsx(rm,{label:"Email",icon:uc,children:a.jsx("input",{type:"email",value:s.email,onChange:b=>l({...s,email:b.target.value}),placeholder:"[email protected]",className:im})}),a.jsx(rm,{label:"Phone (optional)",icon:Ei,children:a.jsx("input",{value:s.phone,onChange:b=>l({...s,phone:b.target.value}),placeholder:"+92 / +44 …",className:im})}),a.jsx(rm,{label:"Company (optional)",icon:iy,children:a.jsx("input",{value:s.company,onChange:b=>l({...s,company:b.target.value}),placeholder:"Company name",className:im})}),a.jsx(rm,{label:"Country / region",icon:KQ,children:a.jsx("input",{value:s.country,onChange:b=>l({...s,country:b.target.value}),placeholder:"e.g. Pakistan, United Kingdom",className:im})}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-bold uppercase text-slate-400 mb-1.5 block",children:"Deployment option"}),a.jsxs("select",{value:s.tier,onChange:b=>l({...s,tier:b.target.value}),className:"w-full bg-slate-50 border border-slate-200 rounded-xl py-2.5 px-3 text-sm text-slate-900 focus:outline-none focus:border-indigo-500",children:[a.jsx("option",{children:"Not sure yet"}),a.jsx("option",{children:"Local Cloud (in-country data centre)"}),a.jsx("option",{children:"On-Premises (my office / premises)"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-bold uppercase text-slate-400 mb-1.5 block",children:"Message"}),a.jsx("textarea",{value:s.message,onChange:b=>l({...s,message:b.target.value}),placeholder:"Where are your callers? Any residency or compliance requirements? Expected call volume?",rows:4,className:"w-full bg-slate-50 border border-slate-200 rounded-xl py-2.5 px-3 text-sm text-slate-900 focus:outline-none focus:border-indigo-500 resize-none"})]}),p&&a.jsxs("div",{className:"flex items-start gap-2 text-xs text-rose-600 font-medium bg-rose-50 border border-rose-100 rounded-xl px-3 py-2.5",children:[a.jsx(fn,{className:"w-4 h-4 mt-0.5 shrink-0"}),a.jsx("span",{children:p})]}),a.jsx("button",{type:"submit",disabled:c,className:"w-full inline-flex items-center justify-center gap-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-semibold py-3 rounded-xl text-sm transition-all cursor-pointer",children:c?"Sending…":a.jsxs(a.Fragment,{children:["Send enquiry ",a.jsx(yp,{className:"w-4 h-4"})]})}),a.jsx("p",{className:"text-[11px] text-slate-400 text-center",children:"Your details are used only to respond to this enquiry. We won’t share them."})]})]}),a.jsx("footer",{className:"bg-slate-900 text-slate-400 mt-auto",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-8 flex flex-col sm:flex-row items-center justify-between gap-3 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-lg bg-indigo-600 text-white grid place-items-center font-extrabold text-[10px]",children:"V"}),a.jsx("span",{className:"font-bold text-slate-200",children:"Vox Bridge"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:e,className:"hover:text-white transition-colors cursor-pointer",children:"Home"}),a.jsx("button",{onClick:()=>t("login"),className:"hover:text-white transition-colors cursor-pointer",children:"Sign in"})]})]})})]})}const im="w-full bg-slate-50 border border-slate-200 rounded-xl py-2.5 px-3 text-sm text-slate-900 focus:outline-none focus:border-indigo-500";function rm({label:e,icon:t,children:n}){return a.jsxs("div",{children:[a.jsxs("label",{className:"text-[11px] font-bold uppercase text-slate-400 mb-1.5 flex items-center gap-1.5",children:[a.jsx(t,{className:"w-3.5 h-3.5 text-slate-400"})," ",e]}),n]})}function VCe({onBackHome:e,onNavigateToAuth:t}){const n=et(me.queries.getAgencyPageContent,{}),r=(et(me.queries.listPricingTiers,{})??[]).filter(h=>h.audience==="agency"),s=n==null?void 0:n.margins,l=n==null?void 0:n.resaleTerms,c=n==null?void 0:n.setupFlow;return a.jsxs("div",{className:"min-h-screen bg-slate-50 flex flex-col",children:[a.jsx("header",{className:"sticky top-0 z-30 bg-white/80 backdrop-blur border-b border-slate-100",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 h-16 flex items-center justify-between",children:[a.jsxs("button",{onClick:e,className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("div",{className:"w-8 h-8 rounded-xl bg-indigo-600 text-white grid place-items-center font-extrabold text-sm",children:"V"}),a.jsx("span",{className:"font-extrabold text-slate-900 tracking-tight",children:"Vox Bridge"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:e,className:"text-sm font-semibold text-slate-600 hover:text-slate-900 px-3 py-2 rounded-lg hover:bg-slate-100 transition-colors cursor-pointer",children:"Back to home"}),a.jsx("button",{onClick:()=>t("login"),className:"text-sm font-semibold text-indigo-600 hover:text-indigo-500 px-3 py-2 rounded-lg hover:bg-indigo-50 transition-colors cursor-pointer",children:"Sign in"})]})]})}),a.jsxs("section",{className:"relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-indigo-50 via-white to-slate-50"}),a.jsxs("div",{className:"relative max-w-6xl mx-auto px-5 pt-16 pb-12 text-center",children:[a.jsxs("span",{className:"inline-flex items-center gap-2 bg-white border border-indigo-100 text-indigo-700 px-3 py-1 rounded-full text-xs font-semibold shadow-sm",children:[a.jsx(Wo,{className:"w-3.5 h-3.5"})," For agencies & partners"]}),a.jsxs("h1",{className:"mt-5 text-4xl sm:text-5xl font-extrabold text-slate-900 tracking-tight leading-tight",children:["Resell voice assistants",a.jsx("br",{className:"hidden sm:block"})," under your own brand."]}),a.jsx("p",{className:"mt-4 max-w-2xl mx-auto text-base sm:text-lg text-slate-600 leading-relaxed",children:(s==null?void 0:s.headline)??"Resell voice assistants under your own brand and keep the margin."}),a.jsxs("div",{className:"mt-7 flex flex-wrap items-center justify-center gap-3",children:[a.jsxs("button",{onClick:()=>
737t("signup","ADMIN"),className:"inline-flex items-center gap-2 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold px-5 py-3 rounded-xl text-sm shadow-lg shadow-indigo-200 transition-all cursor-pointer",children:["Become a partner ",a.jsx(hs,{className:"w-4 h-4"})]}),a.jsx("button",{onClick:e,className:"inline-flex items-center gap-2 bg-white hover:bg-slate-50 border border-slate-200 text-slate-700 font-semibold px-5 py-3 rounded-xl text-sm transition-all cursor-pointer",children:"See it live"})]})]})]}),r.length>0&&a.jsx("section",{className:"bg-white border-y border-slate-100 w-full",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-14",children:[a.jsxs("div",{className:"text-center mb-10",children:[a.jsx("h2",{className:"text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight",children:"Agency plans"}),a.jsx("p",{className:"mt-3 text-slate-600 max-w-2xl mx-auto text-sm leading-relaxed",children:"Platform list prices you resell from. Apply your client price on top; the margin below is what you keep."})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:r.map(h=>a.jsxs("div",{className:`bg-slate-900 text-white border rounded-3xl p-6 space-y-3 ${h.highlight?"border-indigo-500 border-2":"border-slate-700"}`,children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsx("span",{className:"text-[10px] font-bold bg-indigo-500 text-white px-2 py-0.5 rounded uppercase",children:h.name}),h.highlight&&a.jsx("span",{className:"text-[10px] font-bold text-indigo-300",children:"★ Popular"})]}),a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:"text-3xl font-extrabold font-display text-white",children:h.price}),a.jsx("span",{className:"text-xs text-slate-400",children:h.unit})]}),a.jsx("p",{className:"text-[11px] text-slate-300",children:h.tagline}),a.jsx("ul",{className:"space-y-1.5 text-[11px] text-slate-200",children:(h.features??[]).slice(0,5).map((d,f)=>a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx(kt,{className:"w-3 h-3 text-indigo-400 mt-0.5 shrink-0"})," ",d]},f))})]},h._id))})]})}),a.jsxs("section",{className:"max-w-6xl mx-auto px-5 py-14 w-full",children:[a.jsxs("div",{className:"text-center mb-10",children:[a.jsxs("h2",{className:"text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight flex items-center justify-center gap-2",children:[a.jsx(Mk,{className:"w-6 h-6 text-indigo-600"})," Your margin"]}),a.jsxs("p",{className:"mt-3 text-slate-600 max-w-2xl mx-auto text-sm leading-relaxed",children:["Every agency starts at ",a.jsxs("span",{className:"font-bold text-slate-900",children:[(s==null?void 0:s.defaultDiscountPct)??30,"%"]})," off list price by default. Hit a volume band and your margin grows automatically."]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-5",children:((s==null?void 0:s.tiers)??[]).map((h,d)=>a.jsxs("div",{className:"bg-white border border-slate-200 rounded-2xl p-6 shadow-sm text-center",children:[a.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider text-indigo-600",children:h.label}),a.jsx("div",{className:"mt-1 text-xs text-slate-500",children:h.volume}),a.jsxs("div",{className:"mt-4 text-4xl font-extrabold font-display text-slate-900",children:[h.marginPct,"%"]}),a.jsx("div",{className:"mt-1 text-[11px] text-slate-400",children:"of the platform list price"})]},d))})]}),a.jsx("section",{className:"bg-white border-y border-slate-100 w-full",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-5 py-14",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsxs("h2",{className:"text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight flex items-center justify-center gap-2",children:[a.jsx(jQ,{className:"w-6 h-6 text-indigo-600"})," Resale terms"]}),a.jsx("p",{className:"mt-3 text-slate-600 text-sm leading-relaxed",children:l==null?void 0:l.intro})]}),a.jsx("ul",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-3xl mx-auto",children:((l==null?void 0:l.bullets)??[]).map((h,d)=>a.jsxs("li",{className:"flex items-start gap-2 text-sm text-slate-700 bg-slate-50 border border-slate-100 rounded-xl px-4 py-3",children:[a.jsx(kt,{className:"w-4 h-4 text-indigo-600 mt-0.5 shrink-0"}),a.jsx("span",{children:h.text})]},h.id??d))})]})}),a.jsx("section",{className:"bg-slate-900 text-white w-full",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-14",children:[a.jsxs("h2",{className:"text-2xl sm:text-3xl font-extrabold tracking-tight text-center mb-10 flex items-center justify-center gap-2",children:[a.jsx(BQ,{className:"w-6 h-6 text-indigo-400"})," How partnership works"]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-
7375",children:((c==null?void 0:c.steps)??[]).map((h,d)=>a.jsxs("div",{className:"rounded-2xl bg-white/5 border border-white/10 p-6",children:[a.jsx("div",{className:"text-indigo-300 font-extrabold text-lg",children:String(d+1).padStart(2,"0")}),a.jsx("h3",{className:"mt-2 font-bold text-white",children:h.title}),a.jsx("p",{className:"mt-2 text-sm text-slate-300 leading-relaxed",children:h.body})]},h.id??d))})]})}),a.jsx("section",{className:"max-w-3xl mx-auto px-5 py-16 w-full text-center",children:a.jsxs("div",{className:"bg-white border border-slate-200 rounded-3xl p-8 shadow-xl",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-indigo-100 text-indigo-600 grid place-items-center mx-auto mb-4",children:a.jsx(xs,{className:"w-6 h-6"})}),a.jsx("h2",{className:"text-2xl font-extrabold text-slate-900 tracking-tight",children:"Become a partner"}),a.jsx("p",{className:"mt-2 text-sm text-slate-600 max-w-xl mx-auto leading-relaxed",children:"Create your agency account, brand the dashboard, and provision your first client voice assistant in minutes."}),a.jsxs("button",{onClick:()=>t("signup","ADMIN"),className:"mt-6 inline-flex items-center gap-2 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold px-6 py-3 rounded-xl text-sm shadow-lg shadow-indigo-200 transition-all cursor-pointer",children:["Create an agency account ",a.jsx(hs,{className:"w-4 h-4"})]})]})}),a.jsx("footer",{className:"bg-slate-900 text-slate-400 mt-auto",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-8 flex flex-col sm:flex-row items-center justify-between gap-3 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-lg bg-indigo-600 text-white grid place-items-center font-extrabold text-[10px]",children:"V"}),a.jsx("span",{className:"font-bold text-slate-200",children:"Vox Bridge"})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:e,className:"hover:text-white transition-colors cursor-pointer",children:"Home"}),a.jsx("button",{onClick:()=>t("login"),className:"hover:text-white transition-colors cursor-pointer",children:"Sign in"})]})]})})]})}const hk=["Starter","Growth","Scale","Agency / Partner"];function zCe({onBackHome:e}){const t=We(me.accessRequests.addAccessRequest),[n,i]=w.useState({name:"",email:"",company:"",intendedUse:"",planInterest:hk[1],phone:""}),[r,s]=w.useState(!1),[l,c]=w.useState(!1),[h,d]=w.useState(null),f=async()=>{if(!n.name.trim()||!n.email.trim()){d("Please fill in your name and email.");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.email.trim())){d("That email doesn’t look right.");return}s(!0),d(null);try{const p=await t({name:n.name.trim(),email:n.email.trim(),company:n.company.trim()||void 0,intendedUse:n.intendedUse.trim()||void 0,planInterest:n.planInterest,phone:n.phone.trim()||void 0});if(p&&p.ok===!1&&p.reason==="duplicate"){d("You already have a pending request — we’ll be in touch soon. Email changed? Reach out directly."),s(!1);return}c(!0),i({name:"",email:"",company:"",intendedUse:"",planInterest:hk[1],phone:""})}catch(p){d((p==null?void 0:p.message)||"Couldn’t submit your request. Please try again.")}finally{s(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col font-sans relative overflow-hidden",children:[a.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[50%] h-[50%] rounded-full bg-indigo-500/10 blur-[120px] pointer-events-none"}),a.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[50%] h-[50%] rounded-full bg-emerald-500/10 blur-[120px] pointer-events-none"}),a.jsxs("header",{className:"max-w-6xl mx-auto w-full flex justify-between items-center z-10 py-6 px-4 md:px-8",children:[a.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-slate-400 hover:text-white transition-all text-xs font-semibold cursor-pointer group bg-slate-800/50 hover:bg-slate-800 px-3 py-1.5 rounded-xl border border-slate-700/50",children:[a.jsx(ty,{className:"w-3.5 h-3.5 group-hover:-translate-x-1 transition-transform"}),"Back to Vox Bridge Home"]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-slate-400 text-[11px] font-mono",children:"Access:"}),a.jsx("span",{className:"text-[10px] bg-indigo-500/20 text-indigo-300 font-mono border border-indigo-500/30 px-2 py-0.5 rounded-full",children:"Invite-only"})]})]}),a.jsxs("main",{className:"max-w-6xl mx-auto w-full grid grid-cols-1 lg:grid-cols-12 gap-8 items-center py-8 z-10 flex-1 px-4 md:px-8",children:[a.jsxs("div",{className:"lg:col-span-5 space-y-6 text-center lg:text-left",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 bg-indigo-500/10 text-indigo-300 border border-indigo-500/20 px-3.5 py-1 rounded-full text-xs font-semibold",children:[a.jsx(xs,{className:"w-3.5 h-3.5"}),"Request access"]}),a.jsxs("h2",{className:"text-3xl sm:text-4xl font-extrabold leading-tight",children:["Vox Bridge is ",a.jsx("span",{className:"text-indigo-400",children:"invite-only"}),"."]}),a.jsx("p",{className:"text-slate-400 text-sm leading-relaxed max-w-md mx-auto lg:mx-0",children:"Tell us a little about your team and what you’re trying to do. We review every request and email you an invitation to set up your account — you can’t self
737-sign-up because we provision each workspace by hand."}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-4 max-w-md mx-auto lg:mx-0 text-left space-y-2.5",children:[a.jsxs("h4",{className:"text-xs font-bold text-slate-200 flex items-center gap-1.5",children:[a.jsx(kt,{className:"w-4 h-4 text-emerald-400"}),"What happens next"]}),a.jsxs("ol",{className:"text-[11px] text-slate-400 leading-relaxed space-y-1.5 list-decimal list-inside",children:[a.jsx("li",{children:"We review your request (usually within one business day)."}),a.jsx("li",{children:"You get a Clerk invitation email to set your password."}),a.jsx("li",{children:"You sign in to a pre-provisioned agency or client workspace."})]})]})]}),a.jsx("div",{className:"lg:col-span-7 w-full max-w-xl mx-auto",children:a.jsx("div",{className:"bg-slate-900/80 border border-slate-800 shadow-2xl rounded-3xl p-6 md:p-8",children:l?a.jsxs("div",{className:"text-center py-10 space-y-4",children:[a.jsx(kt,{className:"w-12 h-12 text-emerald-400 mx-auto"}),a.jsx("h3",{className:"text-xl font-bold text-white",children:"Request received"}),a.jsx("p",{className:"text-sm text-slate-400 max-w-sm mx-auto",children:"Thanks — we’ll review your request and email you an invitation if it’s a fit. Keep an eye on your inbox (and spam folder)."}),a.jsx("button",{onClick:e,className:"px-5 py-2.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold",children:"Back to home"})]}):a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"Request your invite"}),a.jsx("p",{className:"text-xs text-slate-500 mb-5",children:"All fields except name & email are optional, but the more you share the faster we can approve."}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsx(_0,{icon:a.jsx(qo,{className:"w-4 h-4"}),label:"Name *",children:a.jsx("input",{value:n.name,onChange:p=>i({...n,name:p.target.value}),className:"w-full bg-slate-950 border border-slate-800 rounded-xl text-sm text-slate-100 px-3 py-2.5 focus:border-indigo-500 outline-none",placeholder:"Jane Doe"})}),a.jsx(_0,{icon:a.jsx(uc,{className:"w-4 h-4"}),label:"Email *",children:a.jsx("input",{type:"email",value:n.email,onChange:p=>i({...n,email:p.target.value}),className:"w-full bg-slate-950 border border-slate-800 rounded-xl text-sm text-slate-100 px-3 py-2.5 focus:border-indigo-500 outline-none",placeholder:"[email protected]"})})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsx(_0,{icon:a.jsx(iy,{className:"w-4 h-4"}),label:"Company",children:a.jsx("input",{value:n.company,onChange:p=>i({...n,company:p.target.value}),className:"w-full bg-slate-950 border border-slate-800 rounded-xl text-sm text-slate-100 px-3 py-2.5 focus:border-indigo-500 outline-none",placeholder:"Acme Inc."})}),a.jsx(_0,{icon:a.jsx(Ei,{className:"w-4 h-4"}),label:"Phone (optional)",children:a.jsx("input",{value:n.phone,onChange:p=>i({...n,phone:p.target.value}),className:"w-full bg-slate-950 border border-slate-800 rounded-xl text-sm text-slate-100 px-3 py-2.5 focus:border-indigo-500 outline-none",placeholder:"+1 555 000 0000"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-semibold text-slate-400 mb-1.5",children:"Plan you’re interested in"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:hk.map(p=>a.jsx("button",{type:"button",onClick:()=>i({...n,planInterest:p}),className:`px-3 py-1.5 rounded-xl text-xs font-semibold border transition-colors ${n.planInterest===p?"bg-indigo-600 border-indigo-500 text-white":"bg-slate-950 border-slate-800 text-slate-400 hover:text-white"}`,children:p},p))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-semibold text-slate-400 mb-1.5",children:"What are you trying to do?"}),a.jsx("textarea",{value:n.intendedUse,onChange:p=>i({...n,intendedUse:p.target.value}),rows:3,className:"w-full bg-slate-950 border border-slate-800 rounded-xl text-sm text-slate-100 px-3 py-2.5 focus:border-indigo-500 outline-none resize-none",placeholder:"e.g. We’re an agency serving 12 local-service clients and want to capture after-hours calls as leads."})]}),h&&a.jsx("p",{className:"text-[11px] text-rose-400 font-medium",children:h}),a.jsxs("button",{onClick:f,disabled:r,className:"w-full flex items-center justify-center gap-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-60 text-white text-sm font-semibold py-3 rounded-xl transition-colors",children:[a.jsx(yp,{className:"w-4 h-4"}),r?"Submitting…":"Request access"]})]})]})})})]}),a.jsx("footer",{className:"text-center text-[11px] text-slate-600 mt-auto border-t border-slate-900/40 pt-4 max-w-6xl mx-auto w-full pb-6",children:"© 2026 Vox Bridge SaaS Systems. Invite-only provisioning."})]})}function _0({icon:e,label:t,children:n}){return a.jsxs("div",{children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] font-semibold text-slate-400 mb-1.5",children:[a.jsx("span",{className:"text-slate-500",children:e}),t]}),n]})}
vendor: 6,494 bytes, line 737
737function _2({onBackHome:e,title:t,blurb:n,children:i}){return a.jsxs("div",{className:"min-h-screen bg-slate-50 flex flex-col",children:[a.jsx("header",{className:"bg-slate-950 text-white",children:a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-5 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"bg-indigo-600 p-1.5 rounded-lg",children:a.jsx(Uo,{className:"w-4 h-4"})}),a.jsx("span",{className:"font-bold font-display",children:"Vox Bridge"})]}),a.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-xs text-slate-300 hover:text-white transition-colors cursor-pointer",children:[a.jsx(ty,{className:"w-3.5 h-3.5"})," Back to home"]})]})}),a.jsxs("main",{className:"flex-1 max-w-3xl w-full mx-auto px-6 py-10",children:[a.jsx("h1",{className:"text-2xl font-extrabold text-slate-900 font-display",children:t}),a.jsx("p",{className:"text-sm text-slate-500 mt-1",children:n}),a.jsx("div",{className:"mt-6 prose prose-slate prose-sm max-w-none text-slate-700 leading-relaxed space-y-4",children:i})]}),a.jsx("footer",{className:"bg-slate-950 text-slate-500 text-[11px] py-6 px-6 text-center",children:"© 2026 Vox Bridge SaaS Systems."})]})}function qCe({onBackHome:e}){return a.jsxs(_2,{onBackHome:e,title:"About Vox Bridge",blurb:"Live voice agents for businesses and the agencies that serve them.",children:[a.jsx("p",{children:"Vox Bridge is a voice-AI platform purpose-built for businesses that want every inbound call, website visitor, and WhatsApp message answered — without hiring a human receptionist team. We pair sub-second voice AI with a per-tenant knowledge base, appointment scheduling, and lead routing, so a local business never misses an inquiry and an agency can resell the entire stack under its own brand."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"How it works"}),a.jsx("p",{children:"A business uploads its services, pricing, FAQs, and policies (or points the agent at its website to scrape them automatically). The agent embeds as a widget on the business's site, answers in their brand voice, books appointments on the call, and routes structured leads to their CRM or dashboard. The same brain extends to WhatsApp (text and voice-note replies) and your phone line (PSTN), with WhatsApp voice calls in active development."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"Who we serve"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Direct businesses"})," — A single voice agent on their website, capturing every lead."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Whitelabel agencies"})," — Resell the platform under their own brand with per-client multipliers and a fully branded dashboard."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Enterprises"})," — Multi-location, high-volume deployments with custom workflows, dedicated capacity, and optional in-country/on-premises hosting."]})]}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"Our approach"}),a.jsx("p",{children:`We believe AI receptionists should sound human, reply instantly, and never misrepresent themselves. Every agent is designed to state clearly that it is an AI assistant, transfer to a human when asked, and stay strictly within the knowledge base it was given. We also believe agencies should own the client relationship — our whitelabel tiers keep the agency's brand front and center, never "powered by Vox Bridge" on their end-client sites.`}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"The team"}),a.jsx("p",{children:"Vox Bridge is built by a distributed team of engineers, speech researchers, and go-to-market veterans who have previously shipped products serving tens of thousands of businesses. We are headquartered in the US with team members across North America, Europe, and Asia. Vox Bridge is operated by Nutshell, part of the Arka Studio family of businesses."})]})}function WCe({onBackHome:e}){return a.jsxs(_2,{onBackHome:e,title:"Privacy Policy",blurb:"Last updated: August 2026. How Vox Bridge collects, processes, and protects your data.",children:[a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"1. Data we collect"}),a.jsx("p",{children:"Vox Bridge processes the following categories of data to provide its voice receptionist service:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Call audio and transcripts"})," — Recordings and transcriptions of conversations between an end-user and the voice agent, retained per the tenant's retention setting."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Lead contact details"})," — Name, email address, phone number, and any message the visitor provides, collected at the point of inquiry or booking."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Usage data"})," — Call duration, minutes consumed, token usage, billing records, and feature interactions for metering and platform improvement."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Account information"})," — For registered users: name, email address, organization, and billing information, stored via our authentication provider (Clerk) and payment processor."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Knowledge base content"})," — Documents, PDFs, and website content you upload or scrape to teach the agent about your business."]})]}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"2. How we use data"}),a.jsx("p",{children:"Data is used solely to deliver and improve the service: powering the voice agent's responses, generating transcripts and recordings for quality review, billing and usage metering, and providing you with lead and analytics data within your dashboard. We do not train foundation models on your call audio, transcripts, or knowledge base content without explicit opt-in."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"3. Data sharing"}),a.jsx("p",{children:"We share data only with subprocessors directly required to deliver the service:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"LiveKit"}
737)," — Voice-agent infrastructure (audio routing, room management)"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Google Cloud (Vertex AI / Gemini)"})," — Speech-to-speech inference for live voice conversations"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Cloudflare R2"})," — Object storage for recordings and uploads"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Clerk"})," — Authentication and identity management"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Telnyx"})," — Phone-network connectivity (PSTN calls)"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"OpenAI / Anthropic"})," — LLM inference for non-voice workflows (email drafting, classification, tool calling)"]})]}),a.jsx("p",{children:"Each subprocessor is contractually bound to process data only on our instructions and to maintain security standards consistent with this policy. We do not sell personal data to third parties."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"4. Data retention"}),a.jsx("p",{children:"Call recordings and transcripts are retained for the duration of the tenant's account plus 90 days, unless a shorter retention period is configured by the tenant administrator. Knowledge base documents are retained until deleted by the tenant. Billing records are retained for the period required by law (typically 7 years). Upon account deletion, all tenant-scoped data (recordings, transcripts, leads, KB content) is deleted within 30 days, subject to billing-record retention requirements."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"5. Data security"}),a.jsx("p",{children:"Data is encrypted in transit (TLS 1.3) and at rest (AES-256). Tenant data is logically isolated server-side: an agency or business only ever sees its own customers' data, and access is gated per authenticated user. We enforce least-privilege access controls across our infrastructure and undergo periodic security reviews."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"6. Your rights (GDPR / CCPA)"}),a.jsx("p",{children:"If you are located in the European Economic Area or California, you have the right to: request access to your personal data, request correction or deletion, object to or restrict processing, request data portability, and withdraw consent where processing is based on consent. To exercise these rights, contact us via the footer form on the home page or email [email protected]."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"7. Contact"}),a.jsx("p",{children:"For privacy inquiries: [email protected]. For general inquiries: use the contact form on the home page. Our registered office is available on request."})]})}function HCe({onBackHome:e}){return a.jsxs(_2,{onBackHome:e,title:"Terms of Service",blurb:"Last updated: August 2026. These terms govern your use of the Vox Bridge platform.",children:[a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"1. Service description"}),a.jsx("p",{children:"Vox Bridge provides a voice-AI receptionist platform, including a web widget, WhatsApp integration, phone-line telephony (where available), appointment scheduling, lead capture, and a dashboard for monitoring and configuration. The service is provided as a subscription on a per-minute or per-month basis, depending on the plan selected."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"2. Account & billing"}),a.jsx("p",{children:"Accounts are created through our registration flow or via superadmin provisioning. You are responsible for maintaining the confidentiality of your login credentials and for all activity under your account. Usage is billed per minute of call time (voice) or per message (WhatsApp text/voice notes), subject to the plan and per-client multipliers configured for your tenant. The platform enforces a hard balance gate: when prepaid balance is exhausted, new calls and messages are paused until additional balance is added. Plans and pricing may change with notice; existing balances remain subject to the terms at the time of purchase."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"3. Whitelabel agencies"}),a.jsx("p",{children:"Agencies reselling Vox Bridge under their own brand are responsible for their end-clients' usage, configuration, and billing relationship. Agency administrators must ensure their end-clients are aware of and comply with applicable data-protection and consumer-protection laws. The agency's platform access may be suspended if end-client activity violates these terms. Per-client multipliers, set by the agency or superadmin, apply on top of the platform's base rate and are governed by the platform's billing engine."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"4. Acceptable use"}),a.jsx("p",{children:"You agree not to:"}),a.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[a.jsx("li",{children:"Use the service for unlawful purposes or in violation of any applicable law or regulation."}),a.jsx("li",{children:"Impersonate a real person or entity in a way that deceives end-users (the agent must identify itself as AI)."}),a.jsx("li",{children:"Upload or transmit viruses, malware, or any harmful code through the platform."}),a.jsx("li",{children:"Attempt to reverse-engineer, decompile, or extract the underlying models or infrastru
737cture."}),a.jsx("li",{children:"Use the service in connection with any high-risk activity where failure could result in death, injury, or property damage."})]}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"5. Data ownership & privacy"}),a.jsx("p",{children:"You retain ownership of all content you upload to the platform (knowledge base documents, branding assets, configuration). Vox Bridge claims no intellectual property rights over your content. Our processing of personal data is governed by our Privacy Policy and the Data Processing Agreement (DPA) entered into as part of account registration. Platform-level anonymized usage data may be used for service improvement and benchmarking, but individual call audio and transcripts are never used for model training without explicit opt-in."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"6. Service level & liability"}),a.jsx("p",{children:'Vox Bridge targets 99.9% uptime for the API, dashboard, and agent endpoint, measured monthly. Scheduled maintenance is communicated in advance. The platform provides voice-AI receptionist services "as is" with the understanding that AI-generated responses may occasionally be inaccurate; the service is not a substitute for professional advice (legal, medical, financial). Liability is limited to the fees paid in the 12 months preceding the claim. Neither party is liable for force-majeure events outside its reasonable control.'}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"7. Termination"}),a.jsx("p",{children:"Either party may terminate the agreement with 30 days' written notice. Vox Bridge may suspend access immediately for violation of these terms (particularly the acceptable-use provisions). Upon termination, your data is exported on request within 14 days, then deleted per our Privacy Policy retention schedule."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"8. Governing law"}),a.jsx("p",{children:"These terms are governed by the laws of the State of Delaware, United States, without regard to its conflict-of-law provisions. Any disputes shall be resolved in the courts of Delaware."}),a.jsx("h3",{className:"text-lg font-bold text-slate-900 font-display mt-6",children:"9. Contact"}),a.jsx("p",{children:"For questions about these terms: [email protected]. General inquiries: use the contact form on the home page."})]})}let Fz=!1;function fk(e){Fz=e}function KCe(){return Fz}function Wc(e){return{...e,id:e._id}}const GCe={customApiKey:"",selectedModel:"gemini-3.1-flash-live-preview",selectedStandardModel:"gemini-3.5-flash",retentionDays:60,retentionCostPerRecordingPerMonth:.05,defaultVoicePipeline:"realtime"};function YCe(){const{isLoaded:e,isSignedIn:t}=Oj(),{signOut:n}=HK(),{isLoading:i,isAuthenticated:r}=OH(),[s,l]=w.useState(!1),c=e&&t&&!i&&r&&!s,[h,d]=w.useState("GUEST"),[f,p]=w.useState(()=>window.location.hash);w.useEffect(()=>{const Z=()=>p(window.location.hash);return window.addEventListener("hashchange",Z),()=>window.removeEventListener("hashchange",Z)},[]);const v=f.startsWith("#/local-deployment"),x=f.startsWith("#/agencies"),b=f.startsWith("#/request-access"),S=f.startsWith("#/about"),N=f.startsWith("#/privacy"),j=f.startsWith("#/terms"),T=()=>{history.replaceState(null,"",window.location.pathname+window.location.search),p("")},[E,C]=w.useState(null),[P,A]=w.useState(null),[M,R]=w.useState("login"),[B,U]=w.useState(null),[O,F]=w.useState(null),[ne,re]=w.useState(!1),[Q,W]=w.useState("ADMIN"),q=et(me.users.getCurrentUser,c?{}:"skip"),$=c&&q!==void 0&&!!(q!=null&&q.role)&&!(q!=null&&q.notProvisioned)&&!(q!=null&&q.orphaned)&&!(q!=null&&q.removed),ge=et(me.queries.listAgencies,$?{}:"skip"),ue=et(me.queries.listWorkflows,$?{}:"skip"),L=et(me.queries.listClients,$?{}:"skip"),J=et(me.queries.listLogs,$?{}:"skip"),ye=et(me.queries.getPlatformSettings,(q==null?void 0:q.role)==="SUPERADMIN"?{}:"skip"),Pe=et(me.queries.listRecentLeads,O?{clientId:O}:"skip"),Oe=et(me.queries.listSlots,O?{clientId:O}:"skip"),je=et(me.queries.listKbItems,O?{clientId:O}:"skip"),Ke=(ge??[]).map(Wc),ve=(ue??[]).map(Wc),le=(L??[]).map(Wc),Be=(J??[]).map(Wc),De=(Pe??[]).map(Wc),be=(Oe??[]).map(Wc),nt=(je??[]).map(Wc),ze=ye??GCe,Le=We(me.mutations.addAgency),ht=We(me.mutations.updateAgency),yt=We(me.mutations.deleteAgency),on=We(me.mutations.addWorkflow),bt=We(me.mutations.updateWorkflow),Vt=We(me.mutations.deleteWorkflow),tn=We(me.mutations.addClient),Qt=We(me.mutations.updateClient),Cn=We(me.mutations.deleteClient),pt=We(me.mutations.addSlot),kn=We(me.mutations.deleteSlot),Lt=We(me.mutations.generateSlots),On=We(me.mutations.addKbItem),zt=We(me.mutations.deleteKbItem),si=We(me.mutations.bookSlot),qn=We(me.mutations.addLead),qt=We(me.mutations.updateLead),ai=We(me.mutations.applyPayment),Zn=We(me.mutations.updatePlatformSettings),ct=We(me.mutations.normalizeSlotDates),ln=We(me.mutations.ensurePlatformDemo),Ut=We(me.users.linkCurrentUser);We(me.users.completeOnboarding);const Wn=We(me.mutations.disposeOrphan),_i=w.useRef({}),nn=w.useRef(!1),Bt=w.useRef(!1),Dt=w.useRef(!1),K=w.useRef(!1);w.useEffect(()=>{!q||q.notProvisioned||(q.role==="ADMIN"&&q.agencyId&&B===null&&U(q.agencyId),q.role==="USER"&&q.clientId&&O===null&&F(q.clientId))},[q,B,O]),w.useEffect(()=>{q!=null&&q.pendingLink&&!Dt.current&&(Dt.current=!0,Ut({}))},[q,Ut]),w.useEffect(()=>{q!=null&&q.orphaned&&!K.current&&(K.current=!0,Wn({}))},[q,Wn]),w.useEffect(()=>{(q==null?void 0:q.role)==="SUPERADMIN"&&B===null&&Ke.length>0&&U(Ke[0].id)},[Ke,B,q]),w.useEffect(()=>{if((q==null?void 0:q.role)==="SUPERADMIN"&&B&&O===null){const Z=le.find(Te=>Te.agencyId===B);Z&&F(Z.id)}},[le,B,O,q]),w.useEffect(()=>
737{!nn.current&&ge!==void 0&&(nn.current=!0,ct({}))},[ge,ct]),w.useEffect(()=>{Bt.current||(Bt.current=!0,ln({}))},[ln]);const Ze=Z=>{const{id:Te,...we}=Z;return Le(we)},Ft=(Z,Te)=>{ht({id:Z,patch:Te})},jt=Z=>{yt({id:Z})},oi=Z=>{const{id:Te,...we}=Z;on(we)},Gi=(Z,Te)=>{bt({id:Z,patch:Te})},fr=Z=>{Vt({id:Z})},Yi=Z=>{const{id:Te,...we}=Z;return tn(we)},In=(Z,Te)=>Qt({id:Z,patch:Te}),Mi=Z=>{Cn({id:Z})},Ur=Z=>O?Qt({id:O,patch:{greetingPrompt:Z}}):Promise.resolve(),$n=Z=>{const{id:Te,...we}=Z;pt(we)},li=Z=>{kn({id:Z})},ci=async Z=>await Lt({clientId:Z.clientId,workStart:Z.workStart,workEnd:Z.workEnd,gapMinutes:Z.gapMinutes,daysAhead:Z.daysAhead??14,clearExisting:Z.clearExisting??!0}),ot=Z=>{const{id:Te,...we}=Z;On(we)},Wt=Z=>{zt({id:Z})},Jt=(Z,Te,we)=>{si({id:Z,visitorName:Te,email:we==null?void 0:we.email,phone:we==null?void 0:we.phone,purpose:we==null?void 0:we.purpose})},$t=Z=>{const Te=Z.id,we=Te?_i.current[Te]:void 0;if(we){qt({id:we,patch:Z});return}const{id:X,...Ee}=Z;qn(Ee).then(qe=>{Te&&qe&&(_i.current[Te]=qe)})},te=(Z,Te)=>{qt({id:Z,patch:Te})},Fe=async(Z,Te)=>{ai({targetRole:Q,agencyId:Q==="ADMIN"?B:void 0,clientId:Q==="USER"?O:void 0,amount:Z,subscriptionTier:Te})},dt=Z=>{Zn(Z)},He=Ke.find(Z=>Z.id===B)||Ke[0],H=le.find(Z=>Z.id===O)||le.find(Z=>Z.agencyId===(He==null?void 0:He.id))||le[0],se=()=>{fk(!0),l(!0),setTimeout(()=>fk(!1),1500)};w.useEffect(()=>{s&&n(()=>{d("GUEST"),l(!1)})},[s,n]),w.useEffect(()=>{t&&fk(!1)},[t]);let G;const V=t&&!i&&!r&&!s;return v?G=a.jsx($Ce,{onBackHome:()=>{T(),d("GUEST")},onNavigateToAuth:(Z,Te,we)=>{T(),R(Z),C(Te??null),A(we??null),d("AUTH")}}):x?G=a.jsx(VCe,{onBackHome:()=>{T(),d("GUEST")},onNavigateToAuth:(Z,Te,we)=>{T(),R(Z),C(Te??null),A(we??null),d("AUTH")}}):b?G=a.jsx(zCe,{onBackHome:()=>{T(),d("GUEST")}}):S?G=a.jsx(qCe,{onBackHome:()=>{T(),d("GUEST")}}):N?G=a.jsx(WCe,{onBackHome:()=>{T(),d("GUEST")}}):j?G=a.jsx(HCe,{onBackHome:()=>{T(),d("GUEST")}}):!e||t&&!V&&(!c||q===void 0)?G=a.jsx("div",{className:"flex-1 flex items-center justify-center bg-slate-50",children:a.jsx(Bi,{className:"w-6 h-6 text-indigo-500 animate-spin"})}):V?G=a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-slate-50 gap-3 p-8 text-center max-w-md mx-auto",children:[a.jsx("p",{className:"text-sm text-slate-700 font-semibold",children:"Convex could not verify your Clerk session."}),a.jsxs("p",{className:"text-xs text-slate-500 leading-relaxed",children:["Confirm the Clerk JWT template named ",a.jsx("code",{className:"text-indigo-600",children:"convex"})," exists and that"," ",a.jsx("code",{className:"text-indigo-600",children:"convex/auth.config.ts"})," lists your Clerk Frontend API URL as the domain."]}),a.jsxs("button",{onClick:se,className:"flex items-center gap-2 text-sm text-indigo-600 font-semibold",children:[a.jsx(om,{className:"w-4 h-4"})," Sign out"]})]}):t?q!=null&&q.notProvisioned?G=a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-slate-50 gap-4 p-8 text-center max-w-md mx-auto",children:[a.jsx(Jd,{className:"w-10 h-10 text-amber-500"}),a.jsx("p",{className:"text-base font-bold text-slate-900",children:"You're not provisioned yet"}),a.jsx("p",{className:"text-sm text-slate-500 leading-relaxed",children:"Vox Bridge is invite-only. Your email isn't linked to an account. Please contact the person who invited you, or request access and we'll review it."}),a.jsxs("div",{className:"flex items-center gap-3 justify-center",children:[a.jsx("button",{onClick:()=>{window.location.hash="#/request-access"},className:"px-4 py-2 rounded-xl bg-slate-900 hover:bg-slate-800 text-white text-sm font-semibold",children:"Request access"}),a.jsx("button",{onClick:se,className:"flex items-center gap-2 text-sm text-indigo-600 font-semibold",children:"Sign out"})]})]}):q!=null&&q.removed?G=a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-slate-50 gap-4 p-8 text-center max-w-md mx-auto",children:[a.jsx(Jd,{className:"w-10 h-10 text-amber-500"}),a.jsx("p",{className:"text-base font-bold text-slate-900",children:"Your account was removed"}),a.jsx("p",{className:"text-sm text-slate-500 leading-relaxed",children:q.role===Jc.ADMIN?"Your workspace was removed by the platform administrator. Please contact your administrator to be re-invited.":"Your account was removed by your agency. Please contact your agency administrator to be re-invited."}),a.jsxs("button",{onClick:se,className:"flex items-center gap-2 text-sm text-indigo-600 font-semibold",children:[a.jsx(om,{className:"w-4 h-4"})," Sign out"]})]}):q!=null&&q.orphaned?G=a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-slate-50 gap-4 p-8 text-center max-w-md mx-auto",children:[a.jsx(Jd,{className:"w-10 h-10 text-amber-500"}),a.jsx("p",{className:"text-base font-bold text-slate-900",children:"Your workspace is no longer available"}),a.jsx("p",{className:"text-sm text-slate-500 leading-relaxed",children:q.role===Jc.ADMIN?"Your agency was removed by the platform admin. Contact support if this is unexpected.":"Your account was removed by your agency. Contact your agency admin if this is unexpected."}),a.jsxs("button",{onClick:se,className:"flex items-center gap-2 text-sm text-indigo-600 font-semibold",children:[a.jsx(om,{className:"w-4 h-4"})," Sign out"]})]}):(q==null?void 0:q.role)===Jc.SUPERADMIN?G=a.jsx(pCe,{agencies:Ke,workflows:ve,logs:Be,onAddAgency:Ze,onUpdateAgency:Ft,onDeleteAgency:jt,onAddWorkflow:oi,onUpdateWorkflow:Gi,onDeleteWorkflow:fr,onLogout:se,platformSettings:ze,onUpdatePlatformSettings:dt}):(q==null?void 0:q.role)===Jc.ADMIN?He?G=a.jsx(ECe,{agency:He,clients:le,workflows:ve,logs:Be,kbItems:nt,onAddClient:Yi,onUpdateClient:In,onDeleteClient:Mi,onAddKbItem:ot,onDeleteKbItem:Wt,onLogout:se,onOpenPaywall:()=>{W("ADMIN"),re(!0)},onUpdateLead:te}):G=a.jsx("div",{className:"flex-1 flex items-center justify-center bg-slate-50",children:a.jsx(Bi,{className:"w-6 h-6 text-indigo-500 animate-spin"})}):(q==null?void 0:q.role)===Jc.USER?H?G=a.jsx(ICe,{client:H,leads:De,slots:be,kbItems:nt,workflows:ve,onUpdateGreeting:Ur,onAddSlot:$n,onDeleteSlot:li,onGenerateSlots:ci,onAddKbItem:ot,onDeleteKbItem:Wt,onLogout:se,onBookSlot:Jt,onAddLead:$t,onUpdateLead:te,onUpdateClient:Z=>In(Z.id,Z)}):G=a.jsx("div",{className:"flex-1 flex items-center justify-center bg-slate-50",children:a.jsx(Bi,{className:"w-6 h-6 text-indigo-500 animate-spin"})}):G=a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-slate-50 gap-3 p-8 text-center",children:[a.jsx("p",{className:"text-sm text-slate-600",children:"Your account isn’t configured for a dashboard."}),a.jsxs("button",{onClick:se,className:"flex items-center gap-2 text-sm text-indigo-600 font-semibold",children:[a.jsx(om,{className:"w-4 h-4"})," Sign out"]})]}):h==="AUTH"?G=a.jsx(wle,{initialMode:M,initialRole:E??void 0,selectedPlan:P??void 0,onBackToHome:()=>{window.location.hash&&history.replaceState(null,"",window.location.pathname+window.location.search),d("GUEST")}}):G=a.jsx(ble,{onNavigateToAuth:(Z,Te,we)=>{R(Z),C(Te??null),A(we??null),d("AUTH")},onBookSlot:Jt,onAddLead:$t,onUpdateLead:te}),a.jsxs("div",{className:"min-h-screen bg-slate-50 flex flex-col relative",children:[a.jsx("div",{className:"flex-1 flex flex-col",children:G}),a.jsx(DCe,{isOpen:ne,onClose:()=>re(!1),onSuccess:Fe,targetRole:Q,currentTier:Q==="ADMIN"?He==null?void 0:He.plan:H==null?void 0:H.activePlan})]})}class QCe extends w.Component{constructor(){super(...arguments),this.state={error:null},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(t){return KCe()?{error:null}:{error:t}}componentDidCatch(t){console.error("[ErrorBoundary] render error caught:",t)}componentDidUpdate(t){this.state.error&&t.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){return this.state.error?a.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center max-w-md mx-auto min-h-screen bg-slate-50",children:[a.jsx("p",{className:"text-sm text-slate-700 font-semibold",children:"Something went wrong loading the page."}),a.jsx("p",{className:"text-xs text-slate-500 leading-relaxed",children:"This usually clears on a refresh. If it keeps happening, sign out and back in."}),a.jsx("button",{onClick:this.handleReload,className:"mt-1 px-4 py-2 rounded-md bg-indigo-600 text-white text-sm font-semibold hover:bg-indigo-700",children:"Reload page"})]}):this.props.children}}const XCe=new wH("https://original-panda-503.convex.cloud"),JCe=window.__CLERK_PUBLISHABLE_KEY__||"";function ZCe({children:e}){const{isSignedIn:t}=Oj();return a.jsx(QCe,{resetKey:t,children:e})}eW.createRoot(document.getElementById("root")).render(a.jsx(w.StrictMode,{children:a.jsx(mL,{publishableKey:JCe,routing:"hash",afterSignInUrl:window.location.origin+"/",afterSignUpUrl:window.location.origin+"/",children:a.jsx(UH,{client:XCe,useAuth:Oj,children:a.jsx(ZCe,{children:a.jsx(YCe,{})})})})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.